forked from webcomponents/webcomponentsjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webcomponents-hi-ce.js.map
1 lines (1 loc) · 132 KB
/
webcomponents-hi-ce.js.map
1
{"version":3,"sources":["entrypoints/webcomponents-hi-ce-index.js","bower_components/custom-elements/src/Patch/Element.js","bower_components/custom-elements/src/CustomElementState.js","bower_components/custom-elements/src/Patch/Interface/ChildNode.js","bower_components/custom-elements/src/Patch/Node.js","bower_components/custom-elements/src/Patch/Document.js","bower_components/custom-elements/src/Patch/Interface/ParentNode.js","bower_components/custom-elements/src/Patch/HTMLElement.js","bower_components/custom-elements/src/CustomElementRegistry.js","bower_components/custom-elements/src/Deferred.js","bower_components/custom-elements/src/DocumentConstructionObserver.js","bower_components/custom-elements/src/CustomElementInternals.js","bower_components/custom-elements/src/Utilities.js","bower_components/html-imports/src/html-imports.js","bower_components/custom-elements/src/Patch/Native.js","bower_components/custom-elements/src/AlreadyConstructedMarker.js","bower_components/custom-elements/src/custom-elements.js","src/post-polyfill.js","src/unresolved.js"],"names":["PatchElement","internals","patch_innerHTML","destination","baseDescriptor","Object","defineProperty","enumerable","configurable","get","set","htmlString","removedElements","undefined","isConnected","isConnected$$1","walkDeepDescendantElements","element","push","call","i","length","custom","__CE_state","disconnectedCallback","ownerDocument","__CE_hasRegistry","patchAndUpgradeTree","patchTree","patch_insertAdjacentElement","baseMethod","setPropertyUnchecked","where","wasConnected","insertedElement","disconnectTree","connectTree","Element_attachShadow","Element","prototype","init","__CE_shadowRoot","shadowRoot","console","warn","Element_innerHTML","HTMLElement_innerHTML","HTMLElement","rawDiv","Document_createElement","document","addPatch","Node_cloneNode","innerHTML","assignedValue","content","localName","childNodes","Node_removeChild","Node_appendChild","name","newValue","Element_setAttribute","oldValue","Element_getAttribute","attributeChangedCallback","namespace","Element_setAttributeNS","Element_getAttributeNS","Element_removeAttribute","Element_removeAttributeNS","HTMLElement_insertAdjacentElement","Element_insertAdjacentElement","PatchParentNode","prepend","Element_prepend","append","Element_append","PatchChildNode","before","Element_before","after","Element_after","replaceWith","Element_replaceWith","remove","Element_remove","builtIn","connectedBefore","nodes","filter","node","Node","apply","PatchNode","patch_textContent","nodeType","TEXT_NODE","removedNodes","firstChild","childNodesLength","Array","refNode","DocumentFragment","insertedNodes","slice","nativeResult","Node_insertBefore","nodeWasConnected","deep","clone","nodeToInsert","nodeToRemove","Node_replaceChild","nodeToInsertWasConnected","thisIsConnected","Node_textContent","parts","textContent","join","createTextNode","PatchDocument","Document","definition","localNameToDefinition","constructor","result","patch","Document_importNode","NS_HTML","Document_createElementNS","Document_prepend","Document_append","PatchHTMLElement","window","constructorToDefinition","Error","constructionStack","setPrototypeOf","__CE_definition","lastIndex","AlreadyConstructedMarker$1","CustomElementRegistry","_elementDefinitionIsRunning","_internals","_whenDefinedDeferred","Map","_flushCallback","this._flushCallback","fn","_flushPending","_unflushedLocalNames","_documentConstructionObserver","DocumentConstructionObserver","Deferred","_resolve","_value","_promise","Promise","resolve","doc","_document","_observer","readyState","MutationObserver","_handleMutations","bind","observe","childList","subtree","CustomElementInternals","_localNameToDefinition","_constructorToDefinition","_patches","_hasPatches","isValidCustomElementName","reserved","reservedTagList","has","validForm","test","nativeValue","current","__CE_isImportDocument","parentNode","ShadowRoot","host","nextSiblingOrAncestorSibling","root","start","nextSibling","callback","visitedImports","Set","ELEMENT_NODE","getAttribute","importNode","import","add","child","value","scope","newCustomEvent","type","params","CustomEvent","event","createEvent","initCustomEvent","bubbles","cancelable","detail","importForElement","useNative","closest","importSelector","isImportLink","whenImportsReady","imports","querySelectorAll","rootImportSelector","pending","l","imp","whenElementLoaded","whenDocumentReady","stateChanged","removeEventListener","addEventListener","whenReady","src","onLoadingDone","isIE","rel","Importer","documents","inflight","dynamicImportsMO","m","handleMutations","head","loadImports","createElement","currentScript","scripts","ABS_URL_TEST","CSS_URL_REGEXP","CSS_IMPORT_REGEXP","STYLESHEET_REGEXP","Path","fixUrls","base","href","setAttribute","replaceAttrUrl","r","replaceUrls","text","linkUrl","regexp","replace","pre","url","post","urlPath","resolveUrl","__workingURL","u","URL","pathname","e","__tempDoc","implementation","createHTMLDocument","__base","appendChild","__anchor","Xhr","async","load","success","fail","match","pieces","split","resource","header","indexOf","atob","decodeURIComponent","request","XMLHttpRequest","open","onload","request.onload","redirectedUrl","getResponseHeader","location","origin","protocol","response","responseText","status","send","navigator","userAgent","links","loadImport","link","fireEventIfNeeded","makeDocument","processImportsIfLoadingDone","createDocumentFragment","p1","p2","template","baseEl","querySelector","removeAttribute","n$","importDependenciesSelector","inlineScriptIndex","n","importDependencyAttr","encodeURIComponent","num","disconnect","flatten","scriptsOk","stylesOk","fireEvents","waitForStyles","runScripts","DOCUMENT_FRAGMENT_NODE","cloneScript","s","s$","j","ll","attributes","replaceChild","pendingScriptsSelector","pendingStylesSelector","needsMove","disabledLinkSelector","placeholder","insertBefore","newSibling","dispatchEvent","eventType","mutations","addedNodes","ii","elem","imps","target","HTMLImports","setDefinition","listener","__CE_patched","elements","connectedCallback","upgradeElement","gatherElements","__CE_documentLoadHandled","delete","pop","failed","observedAttributes","toPromise","define","Function","TypeError","SyntaxError","adoptedCallback","getCallback","callbackValue","_flush","shift","deferred","whenDefined","reject","prior","polyfillWrapFlushCallback","outer","inner","flush","createElementNS","cloneNode","removeChild","getOwnPropertyDescriptor","getAttributeNS","setAttributeNS","removeAttributeNS","AlreadyConstructedMarker","priorCustomElements","customElements","runAndClearCallback","flushCallback","cb","origWhenReady","HTMLImports.whenReady","requestAnimationFrame","WebComponents","style"],"mappings":"A;;;;;;;;;;;;;;;;;;;;;;;;aAAC,SAAS,EAAG,CCWEA,QAAA,EAAA,CAASC,CAAT,CAAoB,CAkBjCC,QAASA,EAAe,CAACC,CAAD,CAAcC,CAAd,CAA8B,CACpDC,MAAAC,eAAA,CAAsBH,CAAtB,CAAmC,WAAnC,CAAgD,CAC9CI,WAAYH,CAAAG,WADkC,CAE9CC,aAAc,CAAA,CAFgC,CAG9CC,IAAKL,CAAAK,IAHyC,CAI9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BuK,eAAAb,0BAAA,CAAyC,QAAA,CAASgB,CAAT,CAAa,CACpDD,CAAA,CAAgBC,CAChBC,EAAA,CAAcH,CAAd,CAFoD,CAAtD,CAKAzC,YAAA/H,UAAA,CAAwB4K,QAAA,CAASF,CAAT,CAAa,CACnCC,CAAA,CAAc,QAAA,EAAW,CAInBH,CAAA,EAAJ,CACEzC,WAAA/H,UAAA,CAAsB0K,CAAtB,CADF,CAGEA,CAAA,EAPqB,CAAzB,CADmC,CAlByB,CAiChE3C,WAAA/H,UAAA,CAAsB,QAAA,EAAW,CAC/B6K,qBAAA,CAAsB,QAAA,EAAW,CAC/B5Q,MAAAsN,cAAA,CAAqB,IAAI/I,WAAJ,CAAgB,oBAAhB,CAArB,CAD+B,CAAjC,CAD+B,CAAjC,CArCe,CAAhB,CAAD,CA2CGvE,MAAA6Q,cA3CH,CCAC;SAAA,EAAgB,CAWf,IAAIC,EAAQlW,QAAAgM,cAAA,CAAuB,OAAvB,CACZkK,EAAA9R,YAAA,CAAoB,sIAQpB,KAAI0H,EAAO9L,QAAA2Q,cAAA,CAAuB,MAAvB,CACX7E,EAAA0G,aAAA,CAAkB0D,CAAlB,CAAyBpK,CAAA7I,WAAzB,CArBe,CAAhB,CAAD,CAuBGmC,MAAA6Q,cAvBH,ClBVa,CAAZ,CAAA","file":"webcomponents-hi-ce.js","sourcesContent":["/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n'use strict';\n\n/*\n * Polyfills loaded: HTML Imports, Custom Elements\n * Used in: Safari 10, Firefox once SD is shipped\n */\n\nimport '../bower_components/html-imports/src/html-imports.js'\nimport '../bower_components/custom-elements/src/custom-elements.js'\n\nimport '../src/post-polyfill.js'\nimport '../src/unresolved.js'\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\nimport PatchChildNode from './Interface/ChildNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n if (Native.Element_attachShadow) {\n Utilities.setPropertyUnchecked(Element.prototype, 'attachShadow',\n /**\n * @this {Element}\n * @param {!{mode: string}} init\n * @return {ShadowRoot}\n */\n function(init) {\n const shadowRoot = Native.Element_attachShadow.call(this, init);\n this.__CE_shadowRoot = shadowRoot;\n return shadowRoot;\n });\n } else {\n console.warn('Custom Elements: `Element#attachShadow` was not patched.');\n }\n\n\n function patch_innerHTML(destination, baseDescriptor) {\n Object.defineProperty(destination, 'innerHTML', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: /** @this {Element} */ function(htmlString) {\n const isConnected = Utilities.isConnected(this);\n\n // NOTE: In IE11, when using the native `innerHTML` setter, all nodes\n // that were previously descendants of the context element have all of\n // their children removed as part of the set - the entire subtree is\n // 'disassembled'. This work around walks the subtree *before* using the\n // native setter.\n /** @type {!Array<!Element>|undefined} */\n let removedElements = undefined;\n if (isConnected) {\n removedElements = [];\n Utilities.walkDeepDescendantElements(this, element => {\n if (element !== this) {\n removedElements.push(element);\n }\n });\n }\n\n baseDescriptor.set.call(this, htmlString);\n\n if (removedElements) {\n for (let i = 0; i < removedElements.length; i++) {\n const element = removedElements[i];\n if (element.__CE_state === CEState.custom) {\n internals.disconnectedCallback(element);\n }\n }\n }\n\n // Only create custom elements if this element's owner document is\n // associated with the registry.\n if (!this.ownerDocument.__CE_hasRegistry) {\n internals.patchTree(this);\n } else {\n internals.patchAndUpgradeTree(this);\n }\n return htmlString;\n },\n });\n }\n\n if (Native.Element_innerHTML && Native.Element_innerHTML.get) {\n patch_innerHTML(Element.prototype, Native.Element_innerHTML);\n } else if (Native.HTMLElement_innerHTML && Native.HTMLElement_innerHTML.get) {\n patch_innerHTML(HTMLElement.prototype, Native.HTMLElement_innerHTML);\n } else {\n\n /** @type {HTMLDivElement} */\n const rawDiv = Native.Document_createElement.call(document, 'div');\n\n internals.addPatch(function(element) {\n patch_innerHTML(element, {\n enumerable: true,\n configurable: true,\n // Implements getting `innerHTML` by performing an unpatched `cloneNode`\n // of the element and returning the resulting element's `innerHTML`.\n // TODO: Is this too expensive?\n get: /** @this {Element} */ function() {\n return Native.Node_cloneNode.call(this, true).innerHTML;\n },\n // Implements setting `innerHTML` by creating an unpatched element,\n // setting `innerHTML` of that element and replacing the target\n // element's children with those of the unpatched element.\n set: /** @this {Element} */ function(assignedValue) {\n // NOTE: re-route to `content` for `template` elements.\n // We need to do this because `template.appendChild` does not\n // route into `template.content`.\n /** @type {!Node} */\n const content = this.localName === 'template' ? (/** @type {!HTMLTemplateElement} */ (this)).content : this;\n rawDiv.innerHTML = assignedValue;\n\n while (content.childNodes.length > 0) {\n Native.Node_removeChild.call(content, content.childNodes[0]);\n }\n while (rawDiv.childNodes.length > 0) {\n Native.Node_appendChild.call(content, rawDiv.childNodes[0]);\n }\n },\n });\n });\n }\n\n\n Utilities.setPropertyUnchecked(Element.prototype, 'setAttribute',\n /**\n * @this {Element}\n * @param {string} name\n * @param {string} newValue\n */\n function(name, newValue) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_setAttribute.call(this, name, newValue);\n }\n\n const oldValue = Native.Element_getAttribute.call(this, name);\n Native.Element_setAttribute.call(this, name, newValue);\n newValue = Native.Element_getAttribute.call(this, name);\n if (oldValue !== newValue) {\n internals.attributeChangedCallback(this, name, oldValue, newValue, null);\n }\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'setAttributeNS',\n /**\n * @this {Element}\n * @param {?string} namespace\n * @param {string} name\n * @param {string} newValue\n */\n function(namespace, name, newValue) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n }\n\n const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n if (oldValue !== newValue) {\n internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n }\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'removeAttribute',\n /**\n * @this {Element}\n * @param {string} name\n */\n function(name) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_removeAttribute.call(this, name);\n }\n\n const oldValue = Native.Element_getAttribute.call(this, name);\n Native.Element_removeAttribute.call(this, name);\n if (oldValue !== null) {\n internals.attributeChangedCallback(this, name, oldValue, null, null);\n }\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'removeAttributeNS',\n /**\n * @this {Element}\n * @param {?string} namespace\n * @param {string} name\n */\n function(namespace, name) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_removeAttributeNS.call(this, namespace, name);\n }\n\n const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n Native.Element_removeAttributeNS.call(this, namespace, name);\n // In older browsers, `Element#getAttributeNS` may return the empty string\n // instead of null if the attribute does not exist. For details, see;\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNS#Notes\n const newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n if (oldValue !== newValue) {\n internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n }\n });\n\n\n function patch_insertAdjacentElement(destination, baseMethod) {\n Utilities.setPropertyUnchecked(destination, 'insertAdjacentElement',\n /**\n * @this {Element}\n * @param {string} where\n * @param {!Element} element\n * @return {?Element}\n */\n function(where, element) {\n const wasConnected = Utilities.isConnected(element);\n const insertedElement = /** @type {!Element} */\n (baseMethod.call(this, where, element));\n\n if (wasConnected) {\n internals.disconnectTree(element);\n }\n\n if (Utilities.isConnected(insertedElement)) {\n internals.connectTree(element);\n }\n return insertedElement;\n });\n }\n\n if (Native.HTMLElement_insertAdjacentElement) {\n patch_insertAdjacentElement(HTMLElement.prototype, Native.HTMLElement_insertAdjacentElement);\n } else if (Native.Element_insertAdjacentElement) {\n patch_insertAdjacentElement(Element.prototype, Native.Element_insertAdjacentElement);\n } else {\n console.warn('Custom Elements: `Element#insertAdjacentElement` was not patched.');\n }\n\n\n PatchParentNode(internals, Element.prototype, {\n prepend: Native.Element_prepend,\n append: Native.Element_append,\n });\n\n PatchChildNode(internals, Element.prototype, {\n before: Native.Element_before,\n after: Native.Element_after,\n replaceWith: Native.Element_replaceWith,\n remove: Native.Element_remove,\n });\n};\n","/**\n * @enum {number}\n */\nconst CustomElementState = {\n custom: 1,\n failed: 2,\n};\n\nexport default CustomElementState;\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n * before: !function(...(!Node|string)),\n * after: !function(...(!Node|string)),\n * replaceWith: !function(...(!Node|string)),\n * remove: !function(),\n * }}\n */\nlet ChildNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ChildNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['before'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.before.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['after'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.after.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['replaceWith'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n const wasConnected = Utilities.isConnected(this);\n\n builtIn.replaceWith.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (wasConnected) {\n internals.disconnectTree(this);\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n destination['remove'] = function() {\n const wasConnected = Utilities.isConnected(this);\n\n builtIn.remove.call(this);\n\n if (wasConnected) {\n internals.disconnectTree(this);\n }\n };\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n // `Node#nodeValue` is implemented on `Attr`.\n // `Node#textContent` is implemented on `Attr`, `Element`.\n\n Utilities.setPropertyUnchecked(Node.prototype, 'insertBefore',\n /**\n * @this {Node}\n * @param {!Node} node\n * @param {?Node} refNode\n * @return {!Node}\n */\n function(node, refNode) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'appendChild',\n /**\n * @this {Node}\n * @param {!Node} node\n * @return {!Node}\n */\n function(node) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n const nativeResult = Native.Node_appendChild.call(this, node);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_appendChild.call(this, node);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'cloneNode',\n /**\n * @this {Node}\n * @param {boolean=} deep\n * @return {!Node}\n */\n function(deep) {\n const clone = Native.Node_cloneNode.call(this, deep);\n // Only create custom elements if this element's owner document is\n // associated with the registry.\n if (!this.ownerDocument.__CE_hasRegistry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'removeChild',\n /**\n * @this {Node}\n * @param {!Node} node\n * @return {!Node}\n */\n function(node) {\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_removeChild.call(this, node);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'replaceChild',\n /**\n * @this {Node}\n * @param {!Node} nodeToInsert\n * @param {!Node} nodeToRemove\n * @return {!Node}\n */\n function(nodeToInsert, nodeToRemove) {\n if (nodeToInsert instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(nodeToInsert.childNodes);\n const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n internals.disconnectTree(nodeToRemove);\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeToInsertWasConnected = Utilities.isConnected(nodeToInsert);\n const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n const thisIsConnected = Utilities.isConnected(this);\n\n if (thisIsConnected) {\n internals.disconnectTree(nodeToRemove);\n }\n\n if (nodeToInsertWasConnected) {\n internals.disconnectTree(nodeToInsert);\n }\n\n if (thisIsConnected) {\n internals.connectTree(nodeToInsert);\n }\n\n return nativeResult;\n });\n\n\n function patch_textContent(destination, baseDescriptor) {\n Object.defineProperty(destination, 'textContent', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: /** @this {Node} */ function(assignedValue) {\n // If this is a text node then there are no nodes to disconnect.\n if (this.nodeType === Node.TEXT_NODE) {\n baseDescriptor.set.call(this, assignedValue);\n return;\n }\n\n let removedNodes = undefined;\n // Checking for `firstChild` is faster than reading `childNodes.length`\n // to compare with 0.\n if (this.firstChild) {\n // Using `childNodes` is faster than `children`, even though we only\n // care about elements.\n const childNodes = this.childNodes;\n const childNodesLength = childNodes.length;\n if (childNodesLength > 0 && Utilities.isConnected(this)) {\n // Copying an array by iterating is faster than using slice.\n removedNodes = new Array(childNodesLength);\n for (let i = 0; i < childNodesLength; i++) {\n removedNodes[i] = childNodes[i];\n }\n }\n }\n\n baseDescriptor.set.call(this, assignedValue);\n\n if (removedNodes) {\n for (let i = 0; i < removedNodes.length; i++) {\n internals.disconnectTree(removedNodes[i]);\n }\n }\n },\n });\n }\n\n if (Native.Node_textContent && Native.Node_textContent.get) {\n patch_textContent(Node.prototype, Native.Node_textContent);\n } else {\n internals.addPatch(function(element) {\n patch_textContent(element, {\n enumerable: true,\n configurable: true,\n // NOTE: This implementation of the `textContent` getter assumes that\n // text nodes' `textContent` getter will not be patched.\n get: /** @this {Node} */ function() {\n /** @type {!Array<string>} */\n const parts = [];\n\n for (let i = 0; i < this.childNodes.length; i++) {\n parts.push(this.childNodes[i].textContent);\n }\n\n return parts.join('');\n },\n set: /** @this {Node} */ function(assignedValue) {\n while (this.firstChild) {\n Native.Node_removeChild.call(this, this.firstChild);\n }\n Native.Node_appendChild.call(this, document.createTextNode(assignedValue));\n },\n });\n });\n }\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n Utilities.setPropertyUnchecked(Document.prototype, 'createElement',\n /**\n * @this {Document}\n * @param {string} localName\n * @return {!Element}\n */\n function(localName) {\n // Only create custom elements if this document is associated with the registry.\n if (this.__CE_hasRegistry) {\n const definition = internals.localNameToDefinition(localName);\n if (definition) {\n return new (definition.constructor)();\n }\n }\n\n const result = /** @type {!Element} */\n (Native.Document_createElement.call(this, localName));\n internals.patch(result);\n return result;\n });\n\n Utilities.setPropertyUnchecked(Document.prototype, 'importNode',\n /**\n * @this {Document}\n * @param {!Node} node\n * @param {boolean=} deep\n * @return {!Node}\n */\n function(node, deep) {\n const clone = Native.Document_importNode.call(this, node, deep);\n // Only create custom elements if this document is associated with the registry.\n if (!this.__CE_hasRegistry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n });\n\n const NS_HTML = \"http://www.w3.org/1999/xhtml\";\n\n Utilities.setPropertyUnchecked(Document.prototype, 'createElementNS',\n /**\n * @this {Document}\n * @param {?string} namespace\n * @param {string} localName\n * @return {!Element}\n */\n function(namespace, localName) {\n // Only create custom elements if this document is associated with the registry.\n if (this.__CE_hasRegistry && (namespace === null || namespace === NS_HTML)) {\n const definition = internals.localNameToDefinition(localName);\n if (definition) {\n return new (definition.constructor)();\n }\n }\n\n const result = /** @type {!Element} */\n (Native.Document_createElementNS.call(this, namespace, localName));\n internals.patch(result);\n return result;\n });\n\n PatchParentNode(internals, Document.prototype, {\n prepend: Native.Document_prepend,\n append: Native.Document_append,\n });\n};\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n * prepend: !function(...(!Node|string)),\n * append: !function(...(!Node|string)),\n * }}\n */\nlet ParentNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ParentNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['prepend'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.prepend.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['append'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.append.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport AlreadyConstructedMarker from '../AlreadyConstructedMarker.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n window['HTMLElement'] = (function() {\n /**\n * @type {function(new: HTMLElement): !HTMLElement}\n */\n function HTMLElement() {\n // This should really be `new.target` but `new.target` can't be emulated\n // in ES5. Assuming the user keeps the default value of the constructor's\n // prototype's `constructor` property, this is equivalent.\n /** @type {!Function} */\n const constructor = this.constructor;\n\n const definition = internals.constructorToDefinition(constructor);\n if (!definition) {\n throw new Error('The custom element being constructed was not registered with `customElements`.');\n }\n\n const constructionStack = definition.constructionStack;\n\n if (constructionStack.length === 0) {\n const element = Native.Document_createElement.call(document, definition.localName);\n Object.setPrototypeOf(element, constructor.prototype);\n element.__CE_state = CEState.custom;\n element.__CE_definition = definition;\n internals.patch(element);\n return element;\n }\n\n const lastIndex = constructionStack.length - 1;\n const element = constructionStack[lastIndex];\n if (element === AlreadyConstructedMarker) {\n throw new Error('The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.');\n }\n constructionStack[lastIndex] = AlreadyConstructedMarker;\n\n Object.setPrototypeOf(element, constructor.prototype);\n internals.patch(/** @type {!HTMLElement} */ (element));\n\n return element;\n }\n\n HTMLElement.prototype = Native.HTMLElement.prototype;\n\n return HTMLElement;\n })();\n};\n","import CustomElementInternals from './CustomElementInternals.js';\nimport DocumentConstructionObserver from './DocumentConstructionObserver.js';\nimport Deferred from './Deferred.js';\nimport * as Utilities from './Utilities.js';\n\n/**\n * @unrestricted\n */\nexport default class CustomElementRegistry {\n\n /**\n * @param {!CustomElementInternals} internals\n */\n constructor(internals) {\n /**\n * @private\n * @type {boolean}\n */\n this._elementDefinitionIsRunning = false;\n\n /**\n * @private\n * @type {!CustomElementInternals}\n */\n this._internals = internals;\n\n /**\n * @private\n * @type {!Map<string, !Deferred<undefined>>}\n */\n this._whenDefinedDeferred = new Map();\n\n /**\n * The default flush callback triggers the document walk synchronously.\n * @private\n * @type {!Function}\n */\n this._flushCallback = fn => fn();\n\n /**\n * @private\n * @type {boolean}\n */\n this._flushPending = false;\n\n /**\n * @private\n * @type {!Array<string>}\n */\n this._unflushedLocalNames = [];\n\n /**\n * @private\n * @type {!DocumentConstructionObserver}\n */\n this._documentConstructionObserver = new DocumentConstructionObserver(internals, document);\n }\n\n /**\n * @param {string} localName\n * @param {!Function} constructor\n */\n define(localName, constructor) {\n if (!(constructor instanceof Function)) {\n throw new TypeError('Custom element constructors must be functions.');\n }\n\n if (!Utilities.isValidCustomElementName(localName)) {\n throw new SyntaxError(`The element name '${localName}' is not valid.`);\n }\n\n if (this._internals.localNameToDefinition(localName)) {\n throw new Error(`A custom element with name '${localName}' has already been defined.`);\n }\n\n if (this._elementDefinitionIsRunning) {\n throw new Error('A custom element is already being defined.');\n }\n this._elementDefinitionIsRunning = true;\n\n let connectedCallback;\n let disconnectedCallback;\n let adoptedCallback;\n let attributeChangedCallback;\n let observedAttributes;\n try {\n /** @type {!Object} */\n const prototype = constructor.prototype;\n if (!(prototype instanceof Object)) {\n throw new TypeError('The custom element constructor\\'s prototype is not an object.');\n }\n\n function getCallback(name) {\n const callbackValue = prototype[name];\n if (callbackValue !== undefined && !(callbackValue instanceof Function)) {\n throw new Error(`The '${name}' callback must be a function.`);\n }\n return callbackValue;\n }\n\n connectedCallback = getCallback('connectedCallback');\n disconnectedCallback = getCallback('disconnectedCallback');\n adoptedCallback = getCallback('adoptedCallback');\n attributeChangedCallback = getCallback('attributeChangedCallback');\n observedAttributes = constructor['observedAttributes'] || [];\n } catch (e) {\n return;\n } finally {\n this._elementDefinitionIsRunning = false;\n }\n\n const definition = {\n localName,\n constructor,\n connectedCallback,\n disconnectedCallback,\n adoptedCallback,\n attributeChangedCallback,\n observedAttributes,\n constructionStack: [],\n };\n\n this._internals.setDefinition(localName, definition);\n\n this._unflushedLocalNames.push(localName);\n\n // If we've already called the flush callback and it hasn't called back yet,\n // don't call it again.\n if (!this._flushPending) {\n this._flushPending = true;\n this._flushCallback(() => this._flush());\n }\n }\n\n _flush() {\n // If no new definitions were defined, don't attempt to flush. This could\n // happen if a flush callback keeps the function it is given and calls it\n // multiple times.\n if (this._flushPending === false) return;\n\n this._flushPending = false;\n this._internals.patchAndUpgradeTree(document);\n\n while (this._unflushedLocalNames.length > 0) {\n const localName = this._unflushedLocalNames.shift();\n const deferred = this._whenDefinedDeferred.get(localName);\n if (deferred) {\n deferred.resolve(undefined);\n }\n }\n }\n\n /**\n * @param {string} localName\n * @return {Function|undefined}\n */\n get(localName) {\n const definition = this._internals.localNameToDefinition(localName);\n if (definition) {\n return definition.constructor;\n }\n\n return undefined;\n }\n\n /**\n * @param {string} localName\n * @return {!Promise<undefined>}\n */\n whenDefined(localName) {\n if (!Utilities.isValidCustomElementName(localName)) {\n return Promise.reject(new SyntaxError(`'${localName}' is not a valid custom element name.`));\n }\n\n const prior = this._whenDefinedDeferred.get(localName);\n if (prior) {\n return prior.toPromise();\n }\n\n const deferred = new Deferred();\n this._whenDefinedDeferred.set(localName, deferred);\n\n const definition = this._internals.localNameToDefinition(localName);\n // Resolve immediately only if the given local name has a definition *and*\n // the full document walk to upgrade elements with that local name has\n // already happened.\n if (definition && this._unflushedLocalNames.indexOf(localName) === -1) {\n deferred.resolve(undefined);\n }\n\n return deferred.toPromise();\n }\n\n polyfillWrapFlushCallback(outer) {\n this._documentConstructionObserver.disconnect();\n const inner = this._flushCallback;\n this._flushCallback = flush => outer(() => inner(flush));\n }\n}\n\n// Closure compiler exports.\nwindow['CustomElementRegistry'] = CustomElementRegistry;\nCustomElementRegistry.prototype['define'] = CustomElementRegistry.prototype.define;\nCustomElementRegistry.prototype['get'] = CustomElementRegistry.prototype.get;\nCustomElementRegistry.prototype['whenDefined'] = CustomElementRegistry.prototype.whenDefined;\nCustomElementRegistry.prototype['polyfillWrapFlushCallback'] = CustomElementRegistry.prototype.polyfillWrapFlushCallback;\n","/**\n * @template T\n */\nexport default class Deferred {\n constructor() {\n /**\n * @private\n * @type {T|undefined}\n */\n this._value = undefined;\n\n /**\n * @private\n * @type {Function|undefined}\n */\n this._resolve = undefined;\n\n /**\n * @private\n * @type {!Promise<T>}\n */\n this._promise = new Promise(resolve => {\n this._resolve = resolve;\n\n if (this._value) {\n resolve(this._value);\n }\n });\n }\n\n /**\n * @param {T} value\n */\n resolve(value) {\n if (this._value) {\n throw new Error('Already resolved.');\n }\n\n this._value = value;\n\n if (this._resolve) {\n this._resolve(value);\n }\n }\n\n /**\n * @return {!Promise<T>}\n */\n toPromise() {\n return this._promise;\n }\n}\n","import CustomElementInternals from './CustomElementInternals.js';\n\nexport default class DocumentConstructionObserver {\n constructor(internals, doc) {\n /**\n * @type {!CustomElementInternals}\n */\n this._internals = internals;\n\n /**\n * @type {!Document}\n */\n this._document = doc;\n\n /**\n * @type {MutationObserver|undefined}\n */\n this._observer = undefined;\n\n\n // Simulate tree construction for all currently accessible nodes in the\n // document.\n this._internals.patchAndUpgradeTree(this._document);\n\n if (this._document.readyState === 'loading') {\n this._observer = new MutationObserver(this._handleMutations.bind(this));\n\n // Nodes created by the parser are given to the observer *before* the next\n // task runs. Inline scripts are run in a new task. This means that the\n // observer will be able to handle the newly parsed nodes before the inline\n // script is run.\n this._observer.observe(this._document, {\n childList: true,\n subtree: true,\n });\n }\n }\n\n disconnect() {\n if (this._observer) {\n this._observer.disconnect();\n }\n }\n\n /**\n * @param {!Array<!MutationRecord>} mutations\n */\n _handleMutations(mutations) {\n // Once the document's `readyState` is 'interactive' or 'complete', all new\n // nodes created within that document will be the result of script and\n // should be handled by patching.\n const readyState = this._document.readyState;\n if (readyState === 'interactive' || readyState === 'complete') {\n this.disconnect();\n }\n\n for (let i = 0; i < mutations.length; i++) {\n const addedNodes = mutations[i].addedNodes;\n for (let j = 0; j < addedNodes.length; j++) {\n const node = addedNodes[j];\n this._internals.patchAndUpgradeTree(node);\n }\n }\n }\n}\n","import * as Utilities from './Utilities.js';\nimport CEState from './CustomElementState.js';\n\nexport default class CustomElementInternals {\n constructor() {\n /** @type {!Map<string, !CustomElementDefinition>} */\n this._localNameToDefinition = new Map();\n\n /** @type {!Map<!Function, !CustomElementDefinition>} */\n this._constructorToDefinition = new Map();\n\n /** @type {!Array<!function(!Node)>} */\n this._patches = [];\n\n /** @type {boolean} */\n this._hasPatches = false;\n }\n\n /**\n * @param {string} localName\n * @param {!CustomElementDefinition} definition\n */\n setDefinition(localName, definition) {\n this._localNameToDefinition.set(localName, definition);\n this._constructorToDefinition.set(definition.constructor, definition);\n }\n\n /**\n * @param {string} localName\n * @return {!CustomElementDefinition|undefined}\n */\n localNameToDefinition(localName) {\n return this._localNameToDefinition.get(localName);\n }\n\n /**\n * @param {!Function} constructor\n * @return {!CustomElementDefinition|undefined}\n */\n constructorToDefinition(constructor) {\n return this._constructorToDefinition.get(constructor);\n }\n\n /**\n * @param {!function(!Node)} listener\n */\n addPatch(listener) {\n this._hasPatches = true;\n this._patches.push(listener);\n }\n\n /**\n * @param {!Node} node\n */\n patchTree(node) {\n if (!this._hasPatches) return;\n\n Utilities.walkDeepDescendantElements(node, element => this.patch(element));\n }\n\n /**\n * @param {!Node} node\n */\n patch(node) {\n if (!this._hasPatches) return;\n\n if (node.__CE_patched) return;\n node.__CE_patched = true;\n\n for (let i = 0; i < this._patches.length; i++) {\n this._patches[i](node);\n }\n }\n\n /**\n * @param {!Node} root\n */\n connectTree(root) {\n const elements = [];\n\n Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n if (element.__CE_state === CEState.custom) {\n this.connectedCallback(element);\n } else {\n this.upgradeElement(element);\n }\n }\n }\n\n /**\n * @param {!Node} root\n */\n disconnectTree(root) {\n const elements = [];\n\n Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n if (element.__CE_state === CEState.custom) {\n this.disconnectedCallback(element);\n }\n }\n }\n\n /**\n * Upgrades all uncustomized custom elements at and below a root node for\n * which there is a definition. When custom element reaction callbacks are\n * assumed to be called synchronously (which, by the current DOM / HTML spec\n * definitions, they are *not*), callbacks for both elements customized\n * synchronously by the parser and elements being upgraded occur in the same\n * relative order.\n *\n * NOTE: This function, when used to simulate the construction of a tree that\n * is already created but not customized (i.e. by the parser), does *not*\n * prevent the element from reading the 'final' (true) state of the tree. For\n * example, the element, during truly synchronous parsing / construction would\n * see that it contains no children as they have not yet been inserted.\n * However, this function does not modify the tree, the element will\n * (incorrectly) have children. Additionally, self-modification restrictions\n * for custom element constructors imposed by the DOM spec are *not* enforced.\n *\n *\n * The following nested list shows the steps extending down from the HTML\n * spec's parsing section that cause elements to be synchronously created and\n * upgraded:\n *\n * The \"in body\" insertion mode:\n * https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody\n * - Switch on token:\n * .. other cases ..\n * -> Any other start tag\n * - [Insert an HTML element](below) for the token.\n *\n * Insert an HTML element:\n * https://html.spec.whatwg.org/multipage/syntax.html#insert-an-html-element\n * - Insert a foreign element for the token in the HTML namespace:\n * https://html.spec.whatwg.org/multipage/syntax.html#insert-a-foreign-element\n * - Create an element for a token:\n * https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token\n * - Will execute script flag is true?\n * - (Element queue pushed to the custom element reactions stack.)\n * - Create an element:\n * https://dom.spec.whatwg.org/#concept-create-element\n * - Sync CE flag is true?\n * - Constructor called.\n * - Self-modification restrictions enforced.\n * - Sync CE flag is false?\n * - (Upgrade reaction enqueued.)\n * - Attributes appended to element.\n * (`attributeChangedCallback` reactions enqueued.)\n * - Will execute script flag is true?\n * - (Element queue popped from the custom element reactions stack.\n * Reactions in the popped stack are invoked.)\n * - (Element queue pushed to the custom element reactions stack.)\n * - Insert the element:\n * https://dom.spec.whatwg.org/#concept-node-insert\n * - Shadow-including descendants are connected. During parsing\n * construction, there are no shadow-*excluding* descendants.\n * However, the constructor may have validly attached a shadow\n * tree to itself and added descendants to that shadow tree.\n * (`connectedCallback` reactions enqueued.)\n * - (Element queue popped from the custom element reactions stack.\n * Reactions in the popped stack are invoked.)\n *\n * @param {!Node} root\n * @param {!Set<Node>=} visitedImports\n */\n patchAndUpgradeTree(root, visitedImports = new Set()) {\n const elements = [];\n\n const gatherElements = element => {\n if (element.localName === 'link' && element.getAttribute('rel') === 'import') {\n // The HTML Imports polyfill sets a descendant element of the link to\n // the `import` property, specifically this is *not* a Document.\n const importNode = /** @type {?Node} */ (element.import);\n\n if (importNode instanceof Node && importNode.readyState === 'complete') {\n importNode.__CE_isImportDocument = true;\n\n // Connected links are associated with the registry.\n importNode.__CE_hasRegistry = true;\n } else {\n // If this link's import root is not available, its contents can't be\n // walked. Wait for 'load' and walk it when it's ready.\n element.addEventListener('load', () => {\n const importNode = /** @type {!Node} */ (element.import);\n\n if (importNode.__CE_documentLoadHandled) return;\n importNode.__CE_documentLoadHandled = true;\n\n importNode.__CE_isImportDocument = true;\n\n // Connected links are associated with the registry.\n importNode.__CE_hasRegistry = true;\n\n // Clone the `visitedImports` set that was populated sync during\n // the `patchAndUpgradeTree` call that caused this 'load' handler to\n // be added. Then, remove *this* link's import node so that we can\n // walk that import again, even if it was partially walked later\n // during the same `patchAndUpgradeTree` call.\n const clonedVisitedImports = new Set(visitedImports);\n visitedImports.delete(importNode);\n\n this.patchAndUpgradeTree(importNode, visitedImports);\n });\n }\n } else {\n elements.push(element);\n }\n };\n\n // `walkDeepDescendantElements` populates (and internally checks against)\n // `visitedImports` when traversing a loaded import.\n Utilities.walkDeepDescendantElements(root, gatherElements, visitedImports);\n\n if (this._hasPatches) {\n for (let i = 0; i < elements.length; i++) {\n this.patch(elements[i]);\n }\n }\n\n for (let i = 0; i < elements.length; i++) {\n this.upgradeElement(elements[i]);\n }\n }\n\n /**\n * @param {!Element} element\n */\n upgradeElement(element) {\n const currentState = element.__CE_state;\n if (currentState !== undefined) return;\n\n const definition = this.localNameToDefinition(element.localName);\n if (!definition) return;\n\n definition.constructionStack.push(element);\n\n const constructor = definition.constructor;\n try {\n try {\n let result = new (constructor)();\n if (result !== element) {\n throw new Error('The custom element constructor did not produce the element being upgraded.');\n }\n } finally {\n definition.constructionStack.pop();\n }\n } catch (e) {\n element.__CE_state = CEState.failed;\n throw e;\n }\n\n element.__CE_state = CEState.custom;\n element.__CE_definition = definition;\n\n if (definition.attributeChangedCallback) {\n const observedAttributes = definition.observedAttributes;\n for (let i = 0; i < observedAttributes.length; i++) {\n const name = observedAttributes[i];\n const value = element.getAttribute(name);\n if (value !== null) {\n this.attributeChangedCallback(element, name, null, value, null);\n }\n }\n }\n\n if (Utilities.isConnected(element)) {\n this.connectedCallback(element);\n }\n }\n\n /**\n * @param {!Element} element\n */\n connectedCallback(element) {\n const definition = element.__CE_definition;\n if (definition.connectedCallback) {\n definition.connectedCallback.call(element);\n }\n }\n\n /**\n * @param {!Element} element\n */\n disconnectedCallback(element) {\n const definition = element.__CE_definition;\n if (definition.disconnectedCallback) {\n definition.disconnectedCallback.call(element);\n }\n }\n\n /**\n * @param {!Element} element\n * @param {string} name\n * @param {?string} oldValue\n * @param {?string} newValue\n * @param {?string} namespace\n */\n attributeChangedCallback(element, name, oldValue, newValue, namespace) {\n const definition = element.__CE_definition;\n if (\n definition.attributeChangedCallback &&\n definition.observedAttributes.indexOf(name) > -1\n ) {\n definition.attributeChangedCallback.call(element, name, oldValue, newValue, namespace);\n }\n }\n}\n","const reservedTagList = new Set([\n 'annotation-xml',\n 'color-profile',\n 'font-face',\n 'font-face-src',\n 'font-face-uri',\n 'font-face-format',\n 'font-face-name',\n 'missing-glyph',\n]);\n\n/**\n * @param {string} localName\n * @returns {boolean}\n */\nexport function isValidCustomElementName(localName) {\n const reserved = reservedTagList.has(localName);\n const validForm = /^[a-z][.0-9_a-z]*-[\\-.0-9_a-z]*$/.test(localName);\n return !reserved && validForm;\n}\n\n/**\n * @private\n * @param {!Node} node\n * @return {boolean}\n */\nexport function isConnected(node) {\n // Use `Node#isConnected`, if defined.\n const nativeValue = node.isConnected;\n if (nativeValue !== undefined) {\n return nativeValue;\n }\n\n /** @type {?Node|undefined} */\n let current = node;\n while (current && !(current.__CE_isImportDocument || current instanceof Document)) {\n current = current.parentNode || (window.ShadowRoot && current instanceof ShadowRoot ? current.host : undefined);\n }\n return !!(current && (current.__CE_isImportDocument || current instanceof Document));\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextSiblingOrAncestorSibling(root, start) {\n let node = start;\n while (node && node !== root && !node.nextSibling) {\n node = node.parentNode;\n }\n return (!node || node === root) ? null : node.nextSibling;\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextNode(root, start) {\n return start.firstChild ? start.firstChild : nextSiblingOrAncestorSibling(root, start);\n}\n\n/**\n * @param {!Node} root\n * @param {!function(!Element)} callback\n * @param {!Set<Node>=} visitedImports\n */\nexport function walkDeepDescendantElements(root, callback, visitedImports = new Set()) {\n let node = root;\n while (node) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = /** @type {!Element} */(node);\n\n callback(element);\n\n const localName = element.localName;\n if (localName === 'link' && element.getAttribute('rel') === 'import') {\n // If this import (polyfilled or not) has it's root node available,\n // walk it.\n const importNode = /** @type {!Node} */ (element.import);\n if (importNode instanceof Node && !visitedImports.has(importNode)) {\n // Prevent multiple walks of the same import root.\n visitedImports.add(importNode);\n\n for (let child = importNode.firstChild; child; child = child.nextSibling) {\n walkDeepDescendantElements(child, callback, visitedImports);\n }\n }\n\n // Ignore descendants of import links to prevent attempting to walk the\n // elements created by the HTML Imports polyfill that we just walked\n // above.\n node = nextSiblingOrAncestorSibling(root, element);\n continue;\n } else if (localName === 'template') {\n // Ignore descendants of templates. There shouldn't be any descendants\n // because they will be moved into `.content` during construction in\n // browsers that support template but, in case they exist and are still\n // waiting to be moved by a polyfill, they will be ignored.\n node = nextSiblingOrAncestorSibling(root, element);\n continue;\n }\n\n // Walk shadow roots.\n const shadowRoot = element.__CE_shadowRoot;\n if (shadowRoot) {\n for (let child = shadowRoot.firstChild; child; child = child.nextSibling) {\n walkDeepDescendantElements(child, callback, visitedImports);\n }\n }\n }\n\n node = nextNode(root, node);\n }\n}\n\n/**\n * Used to suppress Closure's \"Modifying the prototype is only allowed if the\n * constructor is in the same scope\" warning without using\n * `@suppress {newCheckTypes, duplicate}` because `newCheckTypes` is too broad.\n *\n * @param {!Object} destination\n * @param {string} name\n * @param {*} value\n */\nexport function setPropertyUnchecked(destination, name, value) {\n destination[name] = value;\n}\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n(scope => {\n\n /********************* base setup *********************/\n const useNative = Boolean('import' in document.createElement('link'));\n\n // Polyfill `currentScript` for browsers without it.\n let currentScript = null;\n if ('currentScript' in document === false) {\n Object.defineProperty(document, 'currentScript', {\n get() {\n return currentScript ||\n // NOTE: only works when called in synchronously executing code.\n // readyState should check if `loading` but IE10 is\n // interactive when scripts run so we cheat. This is not needed by\n // html-imports polyfill but helps generally polyfill `currentScript`.\n (document.readyState !== 'complete' ?\n document.scripts[document.scripts.length - 1] : null);\n },\n configurable: true\n });\n }\n\n /********************* path fixup *********************/\n const ABS_URL_TEST = /(^\\/)|(^#)|(^[\\w-\\d]*:)/;\n const CSS_URL_REGEXP = /(url\\()([^)]*)(\\))/g;\n const CSS_IMPORT_REGEXP = /(@import[\\s]+(?!url\\())([^;]*)(;)/g;\n const STYLESHEET_REGEXP = /(<link[^>]*)(rel=['|\"]?stylesheet['|\"]?[^>]*>)/g;\n\n // path fixup: style elements in imports must be made relative to the main\n // document. We fixup url's in url() and @import.\n const Path = {\n\n fixUrls(element, base) {\n if (element.href) {\n element.setAttribute('href',\n Path.replaceAttrUrl(element.getAttribute('href'), base));\n }\n if (element.src) {\n element.setAttribute('src',\n Path.replaceAttrUrl(element.getAttribute('src'), base));\n }\n if (element.localName === 'style') {\n const r = Path.replaceUrls(element.textContent, base, CSS_URL_REGEXP);\n element.textContent = Path.replaceUrls(r, base, CSS_IMPORT_REGEXP);\n }\n },\n\n replaceUrls(text, linkUrl, regexp) {\n return text.replace(regexp, (m, pre, url, post) => {\n let urlPath = url.replace(/[\"']/g, '');\n if (linkUrl) {\n urlPath = Path.resolveUrl(urlPath, linkUrl);\n }\n return pre + '\\'' + urlPath + '\\'' + post;\n });\n },\n\n replaceAttrUrl(text, linkUrl) {\n if (text && ABS_URL_TEST.test(text)) {\n return text;\n } else {\n return Path.resolveUrl(text, linkUrl);\n }\n },\n\n resolveUrl(url, base) {\n // Lazy feature detection.\n if (Path.__workingURL === undefined) {\n Path.__workingURL = false;\n try {\n const u = new URL('b', 'http://a');\n u.pathname = 'c%20d';\n Path.__workingURL = (u.href === 'http://a/c%20d');\n } catch (e) {}\n }\n\n if (Path.__workingURL) {\n return (new URL(url, base)).href;\n }\n\n // Fallback to creating an anchor into a disconnected document.\n let doc = Path.__tempDoc;\n if (!doc) {\n doc = document.implementation.createHTMLDocument('temp');\n Path.__tempDoc = doc;\n doc.__base = doc.createElement('base');\n doc.head.appendChild(doc.__base);\n doc.__anchor = doc.createElement('a');\n }\n doc.__base.href = base;\n doc.__anchor.href = url;\n return doc.__anchor.href || url;\n }\n };\n\n /********************* Xhr processor *********************/\n const Xhr = {\n\n async: true,\n\n /**\n * @param {!string} url\n * @param {!function(!string, string=)} success\n * @param {!function(!string)} fail\n */\n load(url, success, fail) {\n if (!url) {\n fail('error: href must be specified');\n } else if (url.match(/^data:/)) {\n // Handle Data URI Scheme\n const pieces = url.split(',');\n const header = pieces[0];\n let resource = pieces[1];\n if (header.indexOf(';base64') > -1) {\n resource = atob(resource);\n } else {\n resource = decodeURIComponent(resource);\n }\n success(resource);\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', url, Xhr.async);\n request.onload = () => {\n // Servers redirecting an import can add a Location header to help us\n // polyfill correctly. Handle relative and full paths.\n let redirectedUrl = request.getResponseHeader('Location');\n if (redirectedUrl && redirectedUrl.indexOf('/') === 0) {\n // In IE location.origin might not work\n // https://connect.microsoft.com/IE/feedback/details/1763802/location-origin-is-undefined-in-ie-11-on-windows-10-but-works-on-windows-7\n const origin = (location.origin || location.protocol + '//' + location.host);\n redirectedUrl = origin + redirectedUrl;\n }\n const resource = /** @type {string} */ (request.response || request.responseText);\n if (request.status === 304 || request.status === 0 ||\n request.status >= 200 && request.status < 300) {\n success(resource, redirectedUrl);\n } else {\n fail(resource);\n }\n };\n request.send();\n }\n }\n };\n\n /********************* importer *********************/\n\n const isIE = /Trident/.test(navigator.userAgent) ||\n /Edge\\/\\d./i.test(navigator.userAgent);\n\n const importSelector = 'link[rel=import]';\n\n // Used to disable loading of resources.\n const importDisableType = 'import-disable';\n\n const disabledLinkSelector = `link[rel=stylesheet][href][type=${importDisableType}]`;\n\n const importDependenciesSelector = `${importSelector}, ${disabledLinkSelector},\n style:not([type]), link[rel=stylesheet][href]:not([type]),\n script:not([type]), script[type=\"application/javascript\"],\n script[type=\"text/javascript\"]`;\n\n const importDependencyAttr = 'import-dependency';\n\n const rootImportSelector = `${importSelector}:not(${importDependencyAttr})`;\n\n const pendingScriptsSelector = `script[${importDependencyAttr}]`;\n\n const pendingStylesSelector = `style[${importDependencyAttr}],\n link[rel=stylesheet][${importDependencyAttr}]`;\n\n /**\n * Importer will:\n * - load any linked import documents (with deduping)\n * - whenever an import is loaded, prompt the parser to try to parse\n * - observe imported documents for new elements (these are handled via the\n * dynamic importer)\n */\n class Importer {\n constructor() {\n this.documents = {};\n // Used to keep track of pending loads, so that flattening and firing of\n // events can be done when all resources are ready.\n this.inflight = 0;\n this.dynamicImportsMO = new MutationObserver(m => this.handleMutations(m));\n // 1. Load imports contents\n // 2. Assign them to first import links on the document\n // 3. Wait for import styles & scripts to be done loading/running\n // 4. Fire load/error events\n whenDocumentReady(() => {\n // Observe changes on <head>.\n this.dynamicImportsMO.observe(document.head, {\n childList: true,\n subtree: true\n });\n this.loadImports(document);\n });\n }\n\n /**\n * @param {!(HTMLDocument|DocumentFragment|Element)} doc\n */\n loadImports(doc) {\n const links = /** @type {!NodeList<!HTMLLinkElement>} */\n (doc.querySelectorAll(importSelector));\n for (let i = 0, l = links.length; i < l; i++) {\n this.loadImport(links[i]);\n }\n }\n\n /**\n * @param {!HTMLLinkElement} link\n */\n loadImport(link) {\n const url = link.href;\n // This resource is already being handled by another import.\n if (this.documents[url] !== undefined) {\n // If import is already loaded, we can safely associate it to the link\n // and fire the load/error event.\n const imp = this.documents[url];\n if (imp && imp['__loaded']) {\n link.import = imp;\n this.fireEventIfNeeded(link);\n }\n return;\n }\n this.inflight++;\n // Mark it as pending to notify others this url is being loaded.\n this.documents[url] = 'pending';\n Xhr.load(url, (resource, redirectedUrl) => {\n const doc = this.makeDocument(resource, redirectedUrl || url);\n this.documents[url] = doc;\n this.inflight--;\n // Load subtree.\n this.loadImports(doc);\n this.processImportsIfLoadingDone();\n }, () => {\n // If load fails, handle error.\n this.documents[url] = null;\n this.inflight--;\n this.processImportsIfLoadingDone();\n });\n }\n\n /**\n * Creates a new document containing resource and normalizes urls accordingly.\n * @param {string=} resource\n * @param {string=} url\n * @return {!DocumentFragment}\n */\n makeDocument(resource, url) {\n if (!resource) {\n return document.createDocumentFragment();\n }\n\n if (isIE) {\n // <link rel=stylesheet> should be appended to <head>. Not doing so\n // in IE/Edge breaks the cascading order. We disable the loading by\n // setting the type before setting innerHTML to avoid loading\n // resources twice.\n resource = resource.replace(STYLESHEET_REGEXP, (match, p1, p2) => {\n if (match.indexOf('type=') === -1) {\n return `${p1} type=${importDisableType} ${p2}`;\n }\n return match;\n });\n }\n\n let content;\n const template = /** @type {!HTMLTemplateElement} */\n (document.createElement('template'));\n template.innerHTML = resource;\n if (template.content) {\n // This creates issues in Safari10 when used with shadydom (see #12).\n content = template.content;\n } else {\n // <template> not supported, create fragment and move content into it.\n content = document.createDocumentFragment();\n while (template.firstChild) {\n content.appendChild(template.firstChild);\n }\n }\n\n // Support <base> in imported docs. Resolve url and remove its href.\n const baseEl = content.querySelector('base');\n if (baseEl) {\n url = Path.replaceAttrUrl(baseEl.getAttribute('href'), url);\n baseEl.removeAttribute('href');\n }\n\n const n$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)>} */\n (content.querySelectorAll(importDependenciesSelector));\n // For source map hints.\n let inlineScriptIndex = 0;\n for (let i = 0, l = n$.length, n; i < l && (n = n$[i]); i++) {\n // Listen for load/error events, then fix urls.\n whenElementLoaded(n);\n Path.fixUrls(n, url);\n // Mark for easier selectors.\n n.setAttribute(importDependencyAttr, '');\n // Generate source map hints for inline scripts.\n if (n.localName === 'script' && !n.src && n.textContent) {\n const num = inlineScriptIndex ? `-${inlineScriptIndex}` : '';\n const content = n.textContent + `\\n//# sourceURL=${url}${num}.js\\n`;\n // We use the src attribute so it triggers load/error events, and it's\n // easier to capture errors (e.g. parsing) like this.\n n.setAttribute('src', 'data:text/javascript;charset=utf-8,' + encodeURIComponent(content));\n n.textContent = '';\n inlineScriptIndex++;\n }\n }\n return content;\n }\n\n /**\n * Waits for loaded imports to finish loading scripts and styles, then fires\n * the load/error events.\n */\n processImportsIfLoadingDone() {\n // Wait until all resources are ready, then load import resources.\n if (this.inflight) {\n return;\n }\n\n // Stop observing, flatten & load resource, then restart observing <head>.\n this.dynamicImportsMO.disconnect();\n this.flatten(document);\n // We wait for styles to load, and at the same time we execute the scripts,\n // then fire the load/error events for imports to have faster whenReady\n // callback execution.\n // NOTE: This is different for native behavior where scripts would be\n // executed after the styles before them are loaded.\n // To achieve that, we could select pending styles and scripts in the\n // document and execute them sequentially in their dom order.\n let scriptsOk = false,\n stylesOk = false;\n const onLoadingDone = () => {\n if (stylesOk && scriptsOk) {\n // Restart observing.\n this.dynamicImportsMO.observe(document.head, {\n childList: true,\n subtree: true\n });\n this.fireEvents();\n }\n }\n this.waitForStyles(() => {\n stylesOk = true;\n onLoadingDone();\n });\n this.runScripts(() => {\n scriptsOk = true;\n onLoadingDone();\n });\n }\n\n /**\n * @param {!HTMLDocument} doc\n */\n flatten(doc) {\n const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\n (doc.querySelectorAll(importSelector));\n for (let i = 0, l = n$.length, n; i < l && (n = n$[i]); i++) {\n const imp = this.documents[n.href];\n n.import = /** @type {!Document} */ (imp);\n if (imp && imp.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n // We set the .import to be the link itself, and update its readyState.\n // Other links with the same href will point to this link.\n this.documents[n.href] = n;\n n.readyState = 'loading';\n // Suppress Closure warning about incompatible subtype assignment.\n ( /** @type {!HTMLElement} */ (n).import = n);\n // Override baseURI so that link.import.baseURI can be used seemlessly\n // on native or polyfilled html-imports.\n Object.defineProperty(n, 'baseURI', {\n get: () => n.href,\n configurable: true,\n enumerable: true\n });\n this.flatten(imp);\n n.appendChild(imp);\n }\n }\n }\n\n /**\n * Replaces all the imported scripts with a clone in order to execute them.\n * Updates the `currentScript`.\n * @param {!function()} callback\n */\n runScripts(callback) {\n const s$ = document.querySelectorAll(pendingScriptsSelector);\n const l = s$.length;\n const cloneScript = i => {\n if (i < l) {\n // The pending scripts have been generated through innerHTML and\n // browsers won't execute them for security reasons. We cannot use\n // s.cloneNode(true) either, the only way to run the script is manually\n // creating a new element and copying its attributes.\n const s = s$[i];\n const clone = /** @type {!HTMLScriptElement} */\n (document.createElement('script'));\n // Remove import-dependency attribute to avoid double cloning.\n s.removeAttribute(importDependencyAttr);\n for (let j = 0, ll = s.attributes.length; j < ll; j++) {\n clone.setAttribute(s.attributes[j].name, s.attributes[j].value);\n }\n // Update currentScript and replace original with clone script.\n currentScript = clone;\n s.parentNode.replaceChild(clone, s);\n whenElementLoaded(clone, () => {\n currentScript = null;\n cloneScript(i + 1);\n });\n } else {\n callback();\n }\n };\n cloneScript(0);\n }\n\n /**\n * Waits for all the imported stylesheets/styles to be loaded.\n * @param {!function()} callback\n */\n waitForStyles(callback) {\n const s$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLStyleElement)>} */\n (document.querySelectorAll(pendingStylesSelector));\n let pending = s$.length;\n if (!pending) {\n callback();\n return;\n }\n // <link rel=stylesheet> should be appended to <head>. Not doing so\n // in IE/Edge breaks the cascading order\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10472273/\n // If there is one <link rel=stylesheet> imported, we must move all imported\n // links and styles to <head>.\n const needsMove = isIE && !!document.querySelector(disabledLinkSelector);\n for (let i = 0, l = s$.length, s; i < l && (s = s$[i]); i++) {\n // Listen for load/error events, remove selector once is done loading.\n whenElementLoaded(s, () => {\n s.removeAttribute(importDependencyAttr);\n if (--pending === 0) {\n callback();\n }\n });\n // Check if was already moved to head, to handle the case where the element\n // has already been moved but it is still loading.\n if (needsMove && s.parentNode !== document.head) {\n // Replace the element we're about to move with a placeholder.\n const placeholder = document.createElement(s.localName);\n // Add reference of the moved element.\n placeholder['__appliedElement'] = s;\n // Disable this from appearing in document.styleSheets.\n placeholder.setAttribute('type', 'import-placeholder');\n // Append placeholder next to the sibling, and move original to <head>.\n s.parentNode.insertBefore(placeholder, s.nextSibling);\n let newSibling = importForElement(s);\n while (newSibling && importForElement(newSibling)) {\n newSibling = importForElement(newSibling);\n }\n if (newSibling.parentNode !== document.head) {\n newSibling = null;\n }\n document.head.insertBefore(s, newSibling);\n // Enable the loading of <link rel=stylesheet>.\n s.removeAttribute('type');\n }\n }\n }\n\n /**\n * Fires load/error events for imports in the right order .\n */\n fireEvents() {\n const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\n (document.querySelectorAll(importSelector));\n // Inverse order to have events firing bottom-up.\n for (let i = n$.length - 1, n; i >= 0 && (n = n$[i]); i--) {\n this.fireEventIfNeeded(n);\n }\n }\n\n /**\n * Fires load/error event for the import if this wasn't done already.\n * @param {!HTMLLinkElement} link\n */\n fireEventIfNeeded(link) {\n // Don't fire twice same event.\n if (!link['__loaded']) {\n link['__loaded'] = true;\n // Update link's import readyState.\n link.import && (link.import.readyState = 'complete');\n const eventType = link.import ? 'load' : 'error';\n link.dispatchEvent(newCustomEvent(eventType, {\n bubbles: false,\n cancelable: false,\n detail: undefined\n }));\n }\n }\n\n /**\n * @param {Array<MutationRecord>} mutations\n */\n handleMutations(mutations) {\n for (let i = 0; i < mutations.length; i++) {\n const m = mutations[i];\n if (!m.addedNodes) {\n continue;\n }\n for (let ii = 0; ii < m.addedNodes.length; ii++) {\n const elem = m.addedNodes[ii];\n if (!elem || elem.nodeType !== Node.ELEMENT_NODE) {\n continue;\n }\n // NOTE: added scripts are not updating currentScript in IE.\n if (isImportLink(elem)) {\n this.loadImport( /** @type {!HTMLLinkElement} */ (elem));\n } else {\n this.loadImports( /** @type {!Element} */ (elem));\n }\n }\n }\n }\n }\n\n /**\n * @param {!Node} node\n * @return {boolean}\n */\n const isImportLink = node => {\n return node.nodeType === Node.ELEMENT_NODE && node.localName === 'link' &&\n ( /** @type {!HTMLLinkElement} */ (node).rel === 'import');\n };\n\n /**\n * Waits for an element to finish loading. If already done loading, it will\n * mark the element accordingly.\n * @param {!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)} element\n * @param {function()=} callback\n */\n const whenElementLoaded = (element, callback) => {\n if (element['__loaded']) {\n callback && callback();\n } else if (element.localName === 'script' && !element.src) {\n // Inline scripts don't trigger load/error events, consider them already loaded.\n element['__loaded'] = true;\n callback && callback();\n } else {\n const onLoadingDone = event => {\n element.removeEventListener(event.type, onLoadingDone);\n element['__loaded'] = true;\n callback && callback();\n };\n element.addEventListener('load', onLoadingDone);\n // NOTE: We listen only for load events in IE/Edge, because in IE/Edge\n // <style> with @import will fire error events for each failing @import,\n // and finally will trigger the load event when all @import are\n // finished (even if all fail).\n if (!isIE || element.localName !== 'style') {\n element.addEventListener('error', onLoadingDone);\n }\n }\n }\n\n /**\n * Calls the callback when all imports in the document at call time\n * (or at least document ready) have loaded. Callback is called synchronously\n * if imports are already done loading.\n * @param {function()=} callback\n */\n const whenReady = callback => {\n // 1. ensure the document is in a ready state (has dom), then\n // 2. watch for loading of imports and call callback when done\n whenDocumentReady(() => whenImportsReady(() => callback && callback()));\n }\n\n /**\n * Invokes the callback when document is in ready state. Callback is called\n * synchronously if document is already done loading.\n * @param {!function()} callback\n */\n const whenDocumentReady = callback => {\n if (document.readyState !== 'loading') {\n callback();\n } else {\n const stateChanged = () => {\n if (document.readyState !== 'loading') {\n document.removeEventListener('readystatechange', stateChanged);\n callback();\n }\n }\n document.addEventListener('readystatechange', stateChanged);\n }\n }\n\n /**\n * Invokes the callback after all imports are loaded. Callback is called\n * synchronously if imports are already done loading.\n * @param {!function()} callback\n */\n const whenImportsReady = callback => {\n let imports = /** @type {!NodeList<!HTMLLinkElement>} */\n (document.querySelectorAll(rootImportSelector));\n let pending = imports.length;\n if (!pending) {\n callback();\n return;\n }\n for (let i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {\n whenElementLoaded(imp, () => {\n if (--pending === 0) {\n callback();\n }\n });\n }\n }\n\n /**\n * Returns the import document containing the element.\n * @param {!Node} element\n * @return {HTMLLinkElement|Document|undefined}\n */\n const importForElement = element => {\n if (useNative) {\n // Return only if not in the main doc!\n return element.ownerDocument !== document ? element.ownerDocument : null;\n }\n let doc = element['__importDoc'];\n if (!doc && element.parentNode) {\n doc = /** @type {!Element} */ (element.parentNode);\n if (typeof doc.closest === 'function') {\n // Element.closest returns the element itself if it matches the selector,\n // so we search the closest import starting from the parent.\n doc = doc.closest(importSelector);\n } else {\n // Walk up the parent tree until we find an import.\n while (!isImportLink(doc) && (doc = doc.parentNode)) {}\n }\n element['__importDoc'] = doc;\n }\n return doc;\n }\n\n const newCustomEvent = (type, params) => {\n if (typeof window.CustomEvent === 'function') {\n return new CustomEvent(type, params);\n }\n const event = /** @type {!CustomEvent} */ (document.createEvent('CustomEvent'));\n event.initCustomEvent(type, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);\n return event;\n };\n\n if (useNative) {\n // Check for imports that might already be done loading by the time this\n // script is actually executed. Native imports are blocking, so the ones\n // available in the document by this time should already have failed\n // or have .import defined.\n const imps = /** @type {!NodeList<!HTMLLinkElement>} */\n (document.querySelectorAll(importSelector));\n for (let i = 0, l = imps.length, imp; i < l && (imp = imps[i]); i++) {\n if (!imp.import || imp.import.readyState !== 'loading') {\n imp['__loaded'] = true;\n }\n }\n // Listen for load/error events to capture dynamically added scripts.\n /**\n * @type {!function(!Event)}\n */\n const onLoadingDone = event => {\n const elem = /** @type {!Element} */ (event.target);\n if (isImportLink(elem)) {\n elem['__loaded'] = true;\n }\n };\n document.addEventListener('load', onLoadingDone, true /* useCapture */ );\n document.addEventListener('error', onLoadingDone, true /* useCapture */ );\n } else {\n new Importer();\n }\n\n /**\n Add support for the `HTMLImportsLoaded` event and the `HTMLImports.whenReady`\n method. This api is necessary because unlike the native implementation,\n script elements do not force imports to resolve. Instead, users should wrap\n code in either an `HTMLImportsLoaded` handler or after load time in an\n `HTMLImports.whenReady(callback)` call.\n\n NOTE: This module also supports these apis under the native implementation.\n Therefore, if this file is loaded, the same code can be used under both\n the polyfill and native implementation.\n */\n whenReady(() => document.dispatchEvent(newCustomEvent('HTMLImportsLoaded', {\n cancelable: true,\n bubbles: true,\n detail: undefined\n })));\n\n // exports\n scope.useNative = useNative;\n scope.whenReady = whenReady;\n scope.importForElement = importForElement;\n\n})(window.HTMLImports = (window.HTMLImports || {}));","export default {\n Document_createElement: window.Document.prototype.createElement,\n Document_createElementNS: window.Document.prototype.createElementNS,\n Document_importNode: window.Document.prototype.importNode,\n Document_prepend: window.Document.prototype['prepend'],\n Document_append: window.Document.prototype['append'],\n Node_cloneNode: window.Node.prototype.cloneNode,\n Node_appendChild: window.Node.prototype.appendChild,\n Node_insertBefore: window.Node.prototype.insertBefore,\n Node_removeChild: window.Node.prototype.removeChild,\n Node_replaceChild: window.Node.prototype.replaceChild,\n Node_textContent: Object.getOwnPropertyDescriptor(window.Node.prototype, 'textContent'),\n Element_attachShadow: window.Element.prototype['attachShadow'],\n Element_innerHTML: Object.getOwnPropertyDescriptor(window.Element.prototype, 'innerHTML'),\n Element_getAttribute: window.Element.prototype.getAttribute,\n Element_setAttribute: window.Element.prototype.setAttribute,\n Element_removeAttribute: window.Element.prototype.removeAttribute,\n Element_getAttributeNS: window.Element.prototype.getAttributeNS,\n Element_setAttributeNS: window.Element.prototype.setAttributeNS,\n Element_removeAttributeNS: window.Element.prototype.removeAttributeNS,\n Element_insertAdjacentElement: window.Element.prototype['insertAdjacentElement'],\n Element_prepend: window.Element.prototype['prepend'],\n Element_append: window.Element.prototype['append'],\n Element_before: window.Element.prototype['before'],\n Element_after: window.Element.prototype['after'],\n Element_replaceWith: window.Element.prototype['replaceWith'],\n Element_remove: window.Element.prototype['remove'],\n HTMLElement: window.HTMLElement,\n HTMLElement_innerHTML: Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'innerHTML'),\n HTMLElement_insertAdjacentElement: window.HTMLElement.prototype['insertAdjacentElement'],\n};\n","/**\n * This class exists only to work around Closure's lack of a way to describe\n * singletons. It represents the 'already constructed marker' used in custom\n * element construction stacks.\n *\n * https://html.spec.whatwg.org/#concept-already-constructed-marker\n */\nclass AlreadyConstructedMarker {}\n\nexport default new AlreadyConstructedMarker();\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from './CustomElementInternals.js';\nimport CustomElementRegistry from './CustomElementRegistry.js';\n\nimport PatchHTMLElement from './Patch/HTMLElement.js';\nimport PatchDocument from './Patch/Document.js';\nimport PatchNode from './Patch/Node.js';\nimport PatchElement from './Patch/Element.js';\n\nconst priorCustomElements = window['customElements'];\n\nif (!priorCustomElements ||\n priorCustomElements['forcePolyfill'] ||\n (typeof priorCustomElements['define'] != 'function') ||\n (typeof priorCustomElements['get'] != 'function')) {\n /** @type {!CustomElementInternals} */\n const internals = new CustomElementInternals();\n\n PatchHTMLElement(internals);\n PatchDocument(internals);\n PatchNode(internals);\n PatchElement(internals);\n\n // The main document is always associated with the registry.\n document.__CE_hasRegistry = true;\n\n /** @type {!CustomElementRegistry} */\n const customElements = new CustomElementRegistry(internals);\n\n Object.defineProperty(window, 'customElements', {\n configurable: true,\n enumerable: true,\n value: customElements,\n });\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function(scope) {\n\n 'use strict';\n\n if (customElements && customElements.polyfillWrapFlushCallback) {\n // Here we ensure that the public `HTMLImports.whenReady`\n // always comes *after* custom elements have upgraded.\n let flushCallback;\n function runAndClearCallback() {\n if (flushCallback) {\n let cb = flushCallback;\n flushCallback = null;\n cb();\n return true;\n }\n }\n let origWhenReady = HTMLImports.whenReady;\n customElements.polyfillWrapFlushCallback(function(cb) {\n flushCallback = cb;\n origWhenReady(runAndClearCallback);\n });\n\n HTMLImports.whenReady = function(cb) {\n origWhenReady(function() {\n // custom element code may add dynamic imports\n // to match processing of native custom elements before\n // domContentLoaded, we wait for these imports to resolve first.\n if (runAndClearCallback()) {\n HTMLImports.whenReady(cb);\n } else {\n cb();\n }\n });\n }\n\n }\n\n HTMLImports.whenReady(function() {\n requestAnimationFrame(function() {\n window.dispatchEvent(new CustomEvent('WebComponentsReady'));\n });\n });\n\n})(window.WebComponents);\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function(scope) {\n\n // It's desireable to provide a default stylesheet\n // that's convenient for styling unresolved elements, but\n // it's cumbersome to have to include this manually in every page.\n // It would make sense to put inside some HTMLImport but\n // the HTMLImports polyfill does not allow loading of stylesheets\n // that block rendering. Therefore this injection is tolerated here.\n //\n // NOTE: position: relative fixes IE's failure to inherit opacity\n // when a child is not statically positioned.\n var style = document.createElement('style');\n style.textContent = ''\n + 'body {'\n + 'transition: opacity ease-in 0.2s;'\n + ' } \\n'\n + 'body[unresolved] {'\n + 'opacity: 0; display: block; overflow: hidden; position: relative;'\n + ' } \\n'\n ;\n var head = document.querySelector('head');\n head.insertBefore(style, head.firstChild);\n\n})(window.WebComponents);\n"]}