diff --git a/bower.json b/bower.json index 88b793a..21733af 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,7 @@ "dependencies": { "custom-elements": "webcomponents/custom-elements#remove-mo", "es6-promise": "stefanpenner/es6-promise#^4.0.0", - "html-imports": "webcomponents/html-imports#cleanup", + "html-imports": "webcomponents/html-imports#master", "shadydom": "webcomponents/shadydom#master", "shadycss": "webcomponents/shadycss#master", "template": "webcomponents/template#master", diff --git a/webcomponents-hi-ce-sd.js b/webcomponents-hi-ce-sd.js index 028f1a0..456ec8a 100644 --- a/webcomponents-hi-ce-sd.js +++ b/webcomponents-hi-ce-sd.js @@ -1,6 +1,6 @@ -(function(){'use strict';function po(jr,Br){if(!(jr instanceof Br))throw new TypeError('Cannot call a class as a function')}function co(jr){return jr=_o(jr),ho(uo(jr),jr)}function _o(jr){return jr.replace($o.comments,'').replace($o.port,'')}function uo(jr){let Br={start:0,end:jr.length},Gr=Br;for(let Yr=0,Vr=jr.length;Yr{'complete'===document.readyState&&ko()}))}function ko(){requestAnimationFrame(()=>{(Wr||Hr._elementsHaveApplied)&&Hr.updateStyles(),Wr=!1})}(jr=>{const Br=!!('import'in document.createElement('link'));let Gr=null;!1=='currentScript'in document&&Object.defineProperty(document,'currentScript',{get(){return Gr||('complete'===document.readyState?null:document.scripts[document.scripts.length-1])},configurable:!0});const Yr=/(^\/)|(^#)|(^[\w-\d]*:)/,Vr=/(url\()([^)]*)(\))/g,Jr=/(@import[\s]+(?!url\())([^;]*)(;)/g,Xr=/(]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,Zr={fixUrls(Ns,Ss){Ns.href&&Ns.setAttribute('href',Zr.replaceAttrUrl(Ns.getAttribute('href'),Ss)),Ns.src&&Ns.setAttribute('src',Zr.replaceAttrUrl(Ns.getAttribute('src'),Ss)),'style'===Ns.localName&&Zr.resolveUrlsInStyle(Ns,Ss)},fixUrlAttributes(Ns,Ss){const bs=['action','src','href','url','style'];for(let vs,Es=0;EsTs.search(/({{|\[\[)/)&&(Cs.value='style'===vs?Zr.resolveUrlsInCssText(Ts,Ss):Zr.replaceAttrUrl(Ts,Ss))}},fixUrlsInTemplates(Ns,Ss){const bs=Ns.querySelectorAll('template');for(let Es=0;Es{let Ps=Cs.replace(/["']/g,'');return Ss&&(Ps=Zr.resolveUrl(Ps,Ss)),vs+'\''+Ps+'\''+Ts})},replaceAttrUrl(Ns,Ss){return Ns&&Yr.test(Ns)?Ns:Zr.resolveUrl(Ns,Ss)},resolveUrl(Ns,Ss){if(void 0===Zr.__workingURL){Zr.__workingURL=!1;try{const Es=new URL('b','http://a');Es.pathname='c%20d',Zr.__workingURL='http://a/c%20d'===Es.href}catch(Es){}}if(Zr.__workingURL)return new URL(Ns,Ss).href;let bs=Zr.__tempDoc;return bs||(bs=document.implementation.createHTMLDocument('temp'),Zr.__tempDoc=bs,bs.__base=bs.createElement('base'),bs.head.appendChild(bs.__base),bs.__anchor=bs.createElement('a')),bs.__base.href=Ss,bs.__anchor.href=Ns,bs.__anchor.href||Ns}},zr={async:!0,load(Ns){return new Promise((Ss,bs)=>{if(!Ns)bs({resource:'error: href must be specified'});else if(Ns.match(/^data:/)){const Es=Ns.split(','),vs=Es[0];let Cs=Es[1];Cs=-1{if(4===Es.readyState){let Cs;try{const Ps=Es.getResponseHeader('Location');Ps&&(Cs='/'===Ps.substr(0,1)?location.origin+Ps:Ps)}catch(Ps){console.error(Ps.message)}const Ts={resource:Es.response||Es.responseText,redirectedUrl:Cs};200<=Es.status&&300>Es.status||304===Es.status||0===Es.status?Ss(Ts):bs(Ts)}}),Es.send()}})}},Qr=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent),es='link[rel=import]',ts='import-disable',os=`link[rel=stylesheet][href][type=${ts}]`,rs=`${es}, ${os}, +(function(){'use strict';function po(jr,Br){if(!(jr instanceof Br))throw new TypeError('Cannot call a class as a function')}function co(jr){return jr=_o(jr),ho(uo(jr),jr)}function _o(jr){return jr.replace($o.comments,'').replace($o.port,'')}function uo(jr){let Br={start:0,end:jr.length},Gr=Br;for(let Yr=0,Vr=jr.length;Yr{'complete'===document.readyState&&ko()}))}function ko(){requestAnimationFrame(()=>{(Wr||Hr._elementsHaveApplied)&&Hr.updateStyles(),Wr=!1})}(jr=>{const Br=!!('import'in document.createElement('link'));let Gr=null;!1=='currentScript'in document&&Object.defineProperty(document,'currentScript',{get(){return Gr||('complete'===document.readyState?null:document.scripts[document.scripts.length-1])},configurable:!0});const Yr=/(^\/)|(^#)|(^[\w-\d]*:)/,Vr=/(url\()([^)]*)(\))/g,Jr=/(@import[\s]+(?!url\())([^;]*)(;)/g,Xr=/(]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,Zr={fixUrls(fs,Ns){fs.href&&fs.setAttribute('href',Zr.replaceAttrUrl(fs.getAttribute('href'),Ns)),fs.src&&fs.setAttribute('src',Zr.replaceAttrUrl(fs.getAttribute('src'),Ns)),'style'===fs.localName&&Zr.resolveUrlsInStyle(fs,Ns)},fixUrlAttributes(fs,Ns){const Ss=['action','src','href','url','style'];for(let Es,bs=0;bsCs.search(/({{|\[\[)/)&&(vs.value='style'===Es?Zr.resolveUrlsInCssText(Cs,Ns):Zr.replaceAttrUrl(Cs,Ns))}},fixUrlsInTemplates(fs,Ns){const Ss=fs.querySelectorAll('template');for(let bs=0;bs{let Ts=vs.replace(/["']/g,'');return Ns&&(Ts=Zr.resolveUrl(Ts,Ns)),Es+'\''+Ts+'\''+Cs})},replaceAttrUrl(fs,Ns){return fs&&Yr.test(fs)?fs:Zr.resolveUrl(fs,Ns)},resolveUrl(fs,Ns){if(void 0===Zr.__workingURL){Zr.__workingURL=!1;try{const bs=new URL('b','http://a');bs.pathname='c%20d',Zr.__workingURL='http://a/c%20d'===bs.href}catch(bs){}}if(Zr.__workingURL)return new URL(fs,Ns).href;let Ss=Zr.__tempDoc;return Ss||(Ss=document.implementation.createHTMLDocument('temp'),Zr.__tempDoc=Ss,Ss.__base=Ss.createElement('base'),Ss.head.appendChild(Ss.__base),Ss.__anchor=Ss.createElement('a')),Ss.__base.href=Ns,Ss.__anchor.href=fs,Ss.__anchor.href||fs}},zr={async:!0,load(fs){return new Promise((Ns,Ss)=>{if(!fs)Ss({resource:'error: href must be specified'});else if(fs.match(/^data:/)){const bs=fs.split(','),Es=bs[0];let vs=bs[1];vs=-1{if(4===bs.readyState){let Es;try{const Cs=bs.getResponseHeader('Location');Cs&&(Es='/'===Cs.substr(0,1)?location.origin+Cs:Cs)}catch(Cs){console.error(Cs.message)}const vs={resource:bs.response||bs.responseText,redirectedUrl:Es};304===bs.status||0===bs.status||200<=bs.status&&300>bs.status?Ns(vs):Ss(vs)}}),bs.send()}})}},Qr=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent),es='link[rel=import]',ts='import-disable',os=`link[rel=stylesheet][href][type=${ts}]`,rs=`${es}, ${os}, style:not([type]), link[rel=stylesheet][href]:not([type]), script:not([type]), script[type="application/javascript"], script[type="text/javascript"]`,ns='import-dependency',as=`${es}:not(${ns})`,ds=`script[${ns}]`,ls=`style[${ns}], - link[rel=stylesheet][${ns}]`,ps=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector;const _s=Ns=>{return Ns.nodeType===Node.ELEMENT_NODE&&ps.call(Ns,es)},us=Ns=>{return Ns.__loadPromise||(Ns.__loadPromise=new Promise(Ss=>{hs(Ns)?Ss():Qr&&'style'===Ns.localName?Ns.addEventListener('load',Ss):(Ns.addEventListener('load',Ss),Ns.addEventListener('error',Ss))}).then(()=>{return Ns.__loaded=!0,Ns})),Ns.__loadPromise},hs=Ns=>{return Ns.__loaded=Ns.__loaded||'script'===Ns.localName&&!Ns.src,Ns.__loaded},ms=Ns=>{ys(()=>gs(()=>Ns&&Ns()))},ys=Ns=>{if('loading'!==document.readyState)Ns();else{const Ss=()=>{'loading'!==document.readyState&&(document.removeEventListener('readystatechange',Ss),Ns())};document.addEventListener('readystatechange',Ss)}},gs=Ns=>{let Ss=document.querySelectorAll(as);const bs=[];for(let Cs,Es=0,vs=Ss.length;Es{if(Br)return Ns.ownerDocument;let Ss=Ns.__ownerImport;if(!Ss){for(Ss=Ns;(Ss=Ss.parentNode||Ss.host)&&!_s(Ss););Ns.__ownerImport=Ss}return Ss};if(ms(()=>document.dispatchEvent(new CustomEvent('HTMLImportsLoaded',{cancelable:!0,bubbles:!0,detail:void 0}))),Br){const Ns=Ss=>{const bs=Ss.target;_s(bs)&&(bs.__loaded=!0)};document.addEventListener('load',Ns,!0),document.addEventListener('error',Ns,!0)}else new class{constructor(){this.documents={},this.inflight=0,ys(()=>{new MutationObserver(Ns=>this.handleMutations(Ns)).observe(document.head,{childList:!0,subtree:!0}),this.load()})}load(Ns){const Ss=Ns?this.whenImportLoaded(Ns):this.whenImportsLoaded(document);Ss&&(this.inflight++,Ss.then(()=>{0==--this.inflight&&this.onLoadedAll()}))}whenImportsLoaded(Ns){const Ss=Ns.querySelectorAll(es),bs=[];for(let Es=0,vs=Ss.length;EsNs):null}whenImportLoaded(Ns){const Ss=Ns.href;return void 0===this.documents[Ss]?(this.documents[Ss]='pending',zr.load(Ss).then(bs=>{const Es=this.makeDocument(bs.resource,bs.redirectedUrl||Ss);return this.documents[Ss]=Es,this.whenImportsLoaded(Es)}).catch(()=>this.documents[Ss]=null).then(()=>Ns)):null}makeDocument(Ns,Ss){if(!Ns)return document.createDocumentFragment();Qr&&(Ns=Ns.replace(Xr,(As,xs,Rs)=>{return-1===As.indexOf('type=')?`${xs} type=${ts} ${Rs}`:As}));let bs;const Es=document.createElement('template');if(Es.innerHTML=Ns,Es.content)bs=Es.content;else for(bs=document.createDocumentFragment();Es.firstElementChild;)bs.appendChild(Es.firstElementChild);const vs=bs.querySelector('base');vs&&(Ss=Zr.replaceAttrUrl(vs.getAttribute('href'),Ss),vs.removeAttribute('href'));const Cs=bs.querySelectorAll('dom-module');for(let xs,As=0;Asthis.fireEvents())}flatten(Ns){const Ss=Ns.querySelectorAll(es);for(let vs,bs=0,Es=Ss.length;bs{const Cs=document.createElement('script');vs.removeAttribute(ns);for(let Ts=0,Ps=vs.attributes.length;TsGr=null)});return Ss}waitForStyles(){const Ns=!!document.querySelector(os),Ss=document.querySelectorAll(ls),bs=[];for(let Cs,Es=0,vs=Ss.length;EsCs.removeAttribute(ns))),Ns&&Cs.parentNode!==document.head){let Ts=fs(Cs);for(;Ts&&fs(Ts);)Ts=fs(Ts);const Ps=Cs.parentNode,As=Cs.nextSibling,xs=document.createElement(Cs.localName);xs.__appliedElement=Cs,xs.setAttribute('type','import-placeholder'),Ts.parentNode===document.head?document.head.insertBefore(Cs,Ts):document.head.appendChild(Cs),Ps.insertBefore(xs,As),Cs.removeAttribute('type')}return Promise.all(bs)}fireEvents(){const Ns=document.querySelectorAll(es);for(let bs,Ss=Ns.length-1;0<=Ss&&(bs=Ns[Ss]);Ss--)this.fireEventIfNeeded(bs)}fireEventIfNeeded(Ns){if(!Ns.__loaded){Ns.__loaded=!0,Ns.import&&(Ns.import.readyState='complete');const Ss=Ns.import?'load':'error';Ns.dispatchEvent(new CustomEvent(Ss,{bubbles:!1,cancelable:!1,detail:void 0}))}}handleMutations(Ns){for(let Ss=0;Ss'===Da?'>':'"'===Da?'"':'\xA0'===Da?' ':void 0}function os(Da){return Da.replace(Xn,ts)}function rs(Da){return Da.replace(Zn,ts)}function ns(Da){for(var La={},wa=0;wa'}case Node.TEXT_NODE:{var Ka=Da.data;return La&&Qn[La.localName]?Ka:rs(Ka)}case Node.COMMENT_NODE:return'';default:throw window.console.error(Da),new Error('not implemented');}}function ds(Da,La){'template'===Da.localName&&(Da=Da.content);for(var Fa,wa='',ka=La?La(Da):Da.childNodes,Ua=0,Ha=ka.length;Ua]/g,zn=ns(['area','base','br','col','command','embed','hr','img','input','keygen','link','meta','param','source','track','wbr']),Qn=ns(['style','script','xmp','iframe','noembed','noframes','plaintext','noscript']),ea=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),ta=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),oa=Object.freeze({parentNode:ls,firstChild:ps,lastChild:cs,previousSibling:function(La){return ea.currentNode=La,ea.previousSibling()},nextSibling:function(La){return ea.currentNode=La,ea.nextSibling()},childNodes:_s,parentElement:function(La){return ta.currentNode=La,ta.parentNode()},firstElementChild:us,lastElementChild:hs,previousElementSibling:ms,nextElementSibling:ys,children:gs,innerHTML:fs,textContent:Ns}),ra=new DOMParser,sa=Object.getOwnPropertyDescriptor(Document.prototype,'activeElement'),na={parentElement:Es('parentElement'),parentNode:Es('parentNode'),nextSibling:Es('nextSibling'),previousSibling:Es('previousSibling'),className:{get:function(){return this.getAttribute('class')},set:function(La){this.setAttribute('class',La)},configurable:!0},nextElementSibling:{get:function(){if(bs(this,'nextSibling')){for(var La=this.nextSibling;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.nextSibling;return La}return ys(this)},configurable:!0},previousElementSibling:{get:function(){if(bs(this,'previousSibling')){for(var La=this.previousSibling;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.previousSibling;return La}return ms(this)},configurable:!0}},aa={childNodes:{get:function(){if(bs(this,'firstChild')){if(!this.__shady.childNodes){this.__shady.childNodes=[];for(var La=this.firstChild;La;La=La.nextSibling)this.__shady.childNodes.push(La)}return this.__shady.childNodes}return _s(this)},configurable:!0},firstChild:Es('firstChild'),lastChild:Es('lastChild'),textContent:{get:function(){if(bs(this,'firstChild')){for(var wa,La=[],ka=0,Fa=this.childNodes;wa=Fa[ka];ka++)wa.nodeType!==Node.COMMENT_NODE&&La.push(wa.textContent);return La.join('')}return Ns(this)},set:function(La){this.nodeType===Node.ELEMENT_NODE?(Cs(this),La&&this.appendChild(document.createTextNode(La))):this.nodeValue=La},configurable:!0},firstElementChild:{get:function(){if(bs(this,'firstChild')){for(var La=this.firstChild;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.nextSibling;return La}return us(this)},configurable:!0},lastElementChild:{get:function(){if(bs(this,'lastChild')){for(var La=this.lastChild;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.previousSibling;return La}return hs(this)},configurable:!0},children:{get:function(){return bs(this,'firstChild')?Array.prototype.filter.call(this.childNodes,function(La){return La.nodeType===Node.ELEMENT_NODE}):gs(this)},configurable:!0},innerHTML:{get:function(){var La='template'===this.localName?this.content:this;return bs(this,'firstChild')?ds(La):fs(La)},set:function(La){var wa='template'===this.localName?this.content:this;Cs(wa);var ka=ra.parseFromString(La,'text/html');ka.head&&vs(wa,ka.head),ka.body&&vs(wa,ka.body)},configurable:!0}},da={shadowRoot:{get:function(){return this.shadyRoot},set:function(La){this.shadyRoot=La},configurable:!0}},la={activeElement:{get:function(){return Ps(this)},set:function(){},configurable:!0}},ia=Nn.hasDescriptors?function(){}:function(Da){Da.__shady&&Da.__shady.__outsideAccessors||(Da.__shady=Da.__shady||{},Da.__shady.__outsideAccessors=!0,As(Da,na,!0))},pa=Nn.hasDescriptors?function(){}:function(Da){Da.__shady&&Da.__shady.__insideAccessors||(Da.__shady=Da.__shady||{},Da.__shady.__insideAccessors=!0,As(Da,aa,!0),As(Da,da,!0))},ca=function(La){if(!bs(La,'firstChild')){La.__shady=La.__shady||{},La.__shady.firstChild=ps(La),La.__shady.lastChild=cs(La),pa(La);for(var ka,wa=La.__shady.childNodes=_s(La),Fa=0;Fa+~])'};const Zo='style-scope';class zo{get SCOPE_NAME(){return Zo}dom(jr,Br,Gr){jr.__styleScoped?jr.__styleScoped=null:this._transformDom(jr,Br||'',Gr)}_transformDom(jr,Br,Gr){jr.nodeType===Node.ELEMENT_NODE&&this.element(jr,Br,Gr);let Yr='template'===jr.localName?(jr.content||jr._content).childNodes:jr.children||jr.childNodes;if(Yr)for(let Vr=0;Vr`:${Jr}(${Xr.replace(/\s/g,'')})`),jr=jr.replace(dr,`${sr} $1`),jr=jr.replace(or,(Vr,Jr,Xr)=>{if(!Yr){let Zr=this._transformCompoundSelector(Xr,Jr,Br,Gr);Yr=Yr||Zr.stop,Jr=Zr.combinator,Xr=Zr.value}return Jr+Xr}),jr}_transformCompoundSelector(jr,Br,Gr,Yr){let Vr=jr.indexOf(ar);0<=jr.indexOf(sr)?jr=this._transformHostSelector(jr,Yr):0!==Vr&&(jr=Gr?this._transformSimpleSelector(jr,Gr):jr);let Jr=!1;0<=Vr&&(Br='',Jr=!0);let Xr;return Jr&&(Xr=!0,Jr&&(jr=jr.replace(ir,(Zr,zr)=>` > ${zr}`))),jr=jr.replace(pr,(Zr,zr,Qr)=>`[dir="${Qr}"] ${zr}, ${zr}[dir="${Qr}"]`),{value:jr,combinator:Br,stop:Xr}}_transformSimpleSelector(jr,Br){let Gr=jr.split(_r);return Gr[0]+=Br,Gr.join(_r)}_transformHostSelector(jr,Br){let Gr=jr.match(lr),Yr=Gr&&Gr[2].trim()||'';if(Yr){if(!Yr[0].match(rr)){let Vr=Yr.split(rr)[0];return Vr===Br?Yr:'should_not_match'}return jr.replace(lr,function(Vr,Jr,Xr){return Br+Xr})}return jr.replace(sr,Br)}documentRule(jr){jr.selector=jr.parsedSelector,this.normalizeRootSelector(jr),this._transformRule(jr,this._transformDocumentSelector)}normalizeRootSelector(jr){jr.selector===':root'&&(jr.selector='html')}_transformDocumentSelector(jr){return jr.match(ar)?this._transformComplexSelector(jr,er):this._transformSimpleSelector(jr.trim(),er)}}let Qo=/:(nth[-\w]+)\(([^)]+)\)/,er=`:not(.${Zo})`,tr=',',or=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,rr=/[[.:#*]/,sr=':host',ar='::slotted',dr=/^(::slotted)/,lr=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ir=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,pr=/(.*):dir\((?:(ltr|rtl))\)/,_r=':';var mr=new zo,yr={};const gr=Promise.resolve();class fr{static get(jr){return jr.__styleInfo}static set(jr,Br){return jr.__styleInfo=Br,Br}static invalidate(jr){yr[jr]&&(yr[jr]._applyShimInvalid=!0)}static startValidating(jr){const Br=yr[jr];Br._validating||(Br._validating=!0,gr.then(()=>{Br._applyShimInvalid=!1,Br._validating=!1}))}constructor(jr,Br,Gr,Yr,Vr,Jr){this.styleRules=jr||null,this.placeholder=Br||null,this.ownStylePropertyNames=Gr||[],this.overrideStyleProperties=null,this.elementName=Yr||'',this.cssBuild=Jr||'',this.typeExtension=Vr||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const Nr=window.Element.prototype,Sr=Nr.matches||Nr.matchesSelector||Nr.mozMatchesSelector||Nr.msMatchesSelector||Nr.oMatchesSelector||Nr.webkitMatchesSelector,br=navigator.userAgent.match('Trident'),Er='x-scope';class vr{get XSCOPE_NAME(){return Er}decorateStyles(jr){let Br=this,Gr={},Yr=[],Vr=0;Po(jr,function(Xr){Br.decorateRule(Xr),Xr.index=Vr++,Br.collectPropertiesInCssText(Xr.propertyInfo.cssText,Gr)},function(Zr){Yr.push(Zr)}),jr._keyframes=Yr;let Jr=[];for(let Xr in Gr)Jr.push(Xr);return Jr}decorateRule(jr){if(jr.propertyInfo)return jr.propertyInfo;let Br={},Gr={},Yr=this.collectProperties(jr,Gr);return Yr&&(Br.properties=Gr,jr.rules=null),Br.cssText=this.collectCssText(jr),jr.propertyInfo=Br,Br}collectProperties(jr,Br){let Gr=jr.propertyInfo;if(!Gr){let Yr,Vr=Xo.VAR_ASSIGN,Jr=jr.parsedCssText,Xr,Zr;for(;Yr=Vr.exec(Jr);)Xr=(Yr[2]||Yr[3]).trim(),('inherit'!==Xr||'unset'!==Xr)&&(Br[Yr[1].trim()]=Xr),Zr=!0;return Zr}else if(Gr.properties)return Object.assign(Br,Gr.properties),!0}collectCssText(jr){return this.collectConsumingCssText(jr.parsedCssText)}collectConsumingCssText(jr){return jr.replace(Xo.BRACKETED,'').replace(Xo.VAR_ASSIGN,'')}collectPropertiesInCssText(jr,Br){for(let Gr,Yr;Gr=Xo.VAR_CONSUMED.exec(jr);)Yr=Gr[1],':'!==Gr[2]&&(Br[Yr]=!0)}reify(jr){let Br=Object.getOwnPropertyNames(jr);for(let Yr,Gr=0;Gr *'===Jr||'html'===Jr,Zr=0===Jr.indexOf(':host')&&!Xr;if('shady'===Gr&&(Xr=Jr===Vr+' > *.'+Vr||-1!==Jr.indexOf('html'),Zr=!Xr&&0===Jr.indexOf(Vr)),'shadow'===Gr&&(Xr=':host > *'===Jr||'html'===Jr,Zr=Zr&&!Xr),Xr||Zr){let zr=Vr;Zr&&(Go&&!Br.transformedSelector&&(Br.transformedSelector=mr._transformRuleCss(Br,mr._transformComplexSelector,mr._calcElementScope(jr.is),Vr)),zr=Br.transformedSelector||Vr),Yr({selector:zr,isHost:Zr,isRoot:Xr})}}}hostAndRootPropertiesForScope(jr,Br){let Gr={},Yr={},Vr=this,Jr=Br&&Br.__cssBuild;return Po(Br,function(Xr){Vr.whenHostOrRootRule(jr,Xr,Jr,function(Zr){let zr=jr._element||jr;Sr.call(zr,Zr.selector)&&(Zr.isHost?Vr.collectProperties(Xr,Gr):Vr.collectProperties(Xr,Yr))})},null,!0),{rootProps:Yr,hostProps:Gr}}transformStyles(jr,Br,Gr){let Yr=this,Vr=mr._calcHostScope(jr.is,jr.extends),Jr=jr.extends?'\\'+Vr.slice(0,-1)+'\\]':Vr,Xr=new RegExp(Xo.HOST_PREFIX+Jr+Xo.HOST_SUFFIX),Zr=fr.get(jr).styleRules,zr=this._elementKeyframeTransforms(jr,Zr,Gr);return mr.elementStyles(jr,Zr,function(Qr){Yr.applyProperties(Qr,Br),Go||To(Qr)||!Qr.cssText||(Yr.applyKeyframeTransforms(Qr,zr),Yr._scopeSelector(Qr,Xr,Vr,Gr))})}_elementKeyframeTransforms(jr,Br,Gr){let Yr=Br._keyframes,Vr={};if(!Go&&Yr)for(let Jr=0,Xr=Yr[Jr];Jr=Xr._useCount&&Xr.parentNode&&Xr.parentNode.removeChild(Xr)),Go?Jr.customStyle?(Jr.customStyle.textContent=Vr,Yr=Jr.customStyle):Vr&&(Yr=Ao(Vr,Gr,jr.shadowRoot,Jr.placeholder)):Yr?!Yr.parentNode&&xo(Yr,null,Jr.placeholder):Vr&&(Yr=Ao(Vr,Gr,null,Jr.placeholder)),Yr&&(Yr._useCount=Yr._useCount||0,Jr.customStyle!=Yr&&Yr._useCount++,Jr.customStyle=Yr),br&&(Yr.textContent=Yr.textContent),Yr}applyCustomStyle(jr,Br){let Gr=Co(jr),Yr=this;jr.textContent=vo(Gr,function(Vr){let Jr=Vr.cssText=Vr.parsedCssText;Vr.propertyInfo&&Vr.propertyInfo.cssText&&(Jr=No(Jr),Vr.cssText=Yr.valueForProperties(Jr,Br))})}}var Cr=new vr;let Tr={};const Pr=window.customElements;if(Pr&&!Go){const jr=Pr.define;Pr.define=function(Br,Gr,Yr){return Tr[Br]=Mo(Br),jr.call(Pr,Br,Gr,Yr)}}let xr=Xo.MIXIN_MATCH,Rr=Xo.VAR_ASSIGN,Mr=/;\s*/m,Ir=/^\s*(initial)|(inherit)\s*$/,Or='_-_';class Dr{constructor(){this._map={}}set(jr,Br){jr=jr.trim(),this._map[jr]={properties:Br,dependants:{}}}get(jr){return jr=jr.trim(),this._map[jr]}}class Lr{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new Dr,this._separator=Or,this._boundProduceCssProperties=(jr,Br,Gr,Yr)=>this._produceCssProperties(jr,Br,Gr,Yr)}detectMixin(jr){const Br=xr.test(jr)||Rr.test(jr);return xr.lastIndex=0,Rr.lastIndex=0,Br}transformStyle(jr,Br){let Gr=Co(jr);return this.transformRules(Gr,Br),Gr}transformRules(jr,Br){this._currentTemplate=yr[Br],Po(jr,Gr=>{this.transformRule(Gr)}),this._currentTemplate=null}transformRule(jr){jr.cssText=this.transformCssText(jr.parsedCssText),':root'===jr.selector&&(jr.selector=':host > *')}transformCssText(jr){return jr=jr.replace(Rr,this._boundProduceCssProperties),this._consumeCssProperties(jr)}_getInitialValueForProperty(jr){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(jr)}_consumeCssProperties(jr){for(let Br;Br=xr.exec(jr);){let Gr=Br[0],Yr=Br[1],Vr=Br.index,Jr=Vr+Gr.indexOf('@apply'),Xr=Vr+Gr.length,Zr=jr.slice(0,Jr),zr=jr.slice(Xr),Qr=this._cssTextToMap(Zr),es=this._atApplyToCssProperties(Yr,Qr);jr=[Zr,es,zr].join(''),xr.lastIndex=Vr+es.length}return jr}_atApplyToCssProperties(jr,Br){jr=jr.replace(Mr,'');let Gr=[],Yr=this._map.get(jr);if(Yr||(this._map.set(jr,{}),Yr=this._map.get(jr)),Yr){this._currentTemplate&&(Yr.dependants[this._currentTemplate.name]=this._currentTemplate);let Vr,Jr,Xr;for(Vr in Yr.properties)Xr=Br&&Br[Vr],Jr=[Vr,': var(',jr,Or,Vr],Xr&&Jr.push(',',Xr),Jr.push(')'),Gr.push(Jr.join(''))}return Gr.join('; ')}_replaceInitialOrInherit(jr,Br){let Gr=Ir.exec(Br);return Gr&&(Gr[1]?Br=Lr._getInitialValueForProperty(jr):Br='apply-shim-inherit'),Br}_cssTextToMap(jr){let Br=jr.split(';'),Gr,Yr,Vr={};for(let Xr,Zr,Jr=0;Jr{as&&this._map.get(as)&&(Yr='@apply '+as+';')}),!Yr)return jr;let Vr=this._consumeCssProperties(Yr),Jr=jr.slice(0,jr.indexOf('--')),Xr=this._cssTextToMap(Vr),Zr=Xr,zr=this._map.get(Br),Qr=zr&&zr.properties;Qr?Zr=Object.assign(Object.create(Qr),Xr):this._map.set(Br,Zr);let ts,os,es=[],rs=!1;for(ts in Zr)os=Xr[ts],void 0==os&&(os='initial'),Qr&&!(ts in Qr)&&(rs=!0),es.push(Br+Or+ts+': '+os);return rs&&this._invalidateMixinEntry(zr),zr&&(zr.properties=Zr),Gr&&(Jr=jr+';'+Jr),Jr+es.join('; ')+';'}}let wr=new Lr;window.ApplyShim=wr;let kr=function(){};if(!Go){let jr=Jr=>{return Jr.classList&&!Jr.classList.contains(mr.SCOPE_NAME)||Jr instanceof SVGElement&&(!Jr.hasAttribute('class')||0>Jr.getAttribute('class').indexOf(mr.SCOPE_NAME))},Br=Jr=>{for(let Zr,Xr=0;Xr{Gr.observe(Jr,{childList:!0,subtree:!0})},Vr=window.customElements&&!window.customElements.flush;if(Vr)Yr(document);else{let Jr=()=>{Yr(document.body)};window.HTMLImports?window.HTMLImports.whenReady(Jr):requestAnimationFrame(function(){if('loading'===document.readyState){let Xr=function(){Jr(),document.removeEventListener('readystatechange',Xr)};document.addEventListener('readystatechange',Xr)}else Jr()})}kr=function(){Br(Gr.takeRecords())}}let Fr=new class{constructor(jr=100){this.cache={},this.typeMax=jr}_validate(jr,Br,Gr){for(let Vr,Yr=0;Yrthis.typeMax&&Vr.shift(),this.cache[jr]=Vr}fetch(jr,Br,Gr){let Yr=this.cache[jr];if(Yr)for(let Jr,Vr=Yr.length-1;0<=Vr;Vr--)if(Jr=Yr[Vr],this._validate(Jr,Br,Gr))return Jr}};class Ur{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=fr.set(document.documentElement,new fr({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return Go}get nativeCss(){return Yo}get nativeCssApply(){return!1}flush(){kr()}_generateScopeSelector(jr){let Br=this._scopeCounter[jr]=(this._scopeCounter[jr]||0)+1;return`${jr}-${Br}`}getStyleAst(jr){return Co(jr)}styleAstToString(jr){return vo(jr)}_gatherStyles(jr){let Br=jr.content.querySelectorAll('style'),Gr=[];for(let Vr,Yr=0;Yr{Go?mr.normalizeRootSelector(Gr):mr.documentRule(Gr),this.nativeCss&&!this.nativeCssApply&&wr.transformRule(Gr)}),this.nativeCss?jr.textContent=vo(Br):this._documentOwnerStyleInfo.styleRules.rules.push(Br)}_revalidateApplyShim(jr){if(this.nativeCss&&!this.nativeCssApply){let Br=Co(jr);wr.transformRules(Br),jr.textContent=vo(Br)}}_applyCustomStyleToDocument(jr){this.nativeCss||Cr.applyCustomStyle(jr,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(jr,Br){let Gr;if(!this.nativeCss){let Yr=fr.get(jr)||fr.get(this._styleOwnerForNode(jr));Gr=Yr.styleProperties[Br]}return Gr=Gr||window.getComputedStyle(jr).getPropertyValue(Br),Gr.trim()}setElementClass(jr,Br){let Gr=jr.getRootNode(),Yr=Br?Br.split(/\s/):[],Vr=Gr.host&&Gr.host.localName;if(!Vr){var Jr=jr.getAttribute('class');if(Jr){let Xr=Jr.split(/\s/);for(let Zr=0;Zr{return fs.nodeType===Node.ELEMENT_NODE&&ps.call(fs,es)},us=fs=>{return fs.__loadPromise||(fs.__loadPromise=new Promise(Ns=>{'script'!==fs.localName||fs.src?Qr&&'style'===fs.localName?fs.addEventListener('load',Ns):(fs.addEventListener('load',Ns),fs.addEventListener('error',Ns)):Ns()}).then(()=>{return fs.__loaded=!0,fs})),fs.__loadPromise},hs=fs=>{ms(()=>ys(()=>fs&&fs()))},ms=fs=>{if('loading'!==document.readyState)fs();else{const Ns=()=>{'loading'!==document.readyState&&(document.removeEventListener('readystatechange',Ns),fs())};document.addEventListener('readystatechange',Ns)}},ys=fs=>{let Ns=document.querySelectorAll(as);const Ss=[];for(let vs,bs=0,Es=Ns.length;bs{if(Br)return fs.ownerDocument;let Ns=fs.__ownerImport;if(!Ns){for(Ns=fs;(Ns=Ns.parentNode||Ns.host)&&!_s(Ns););fs.__ownerImport=Ns}return Ns};if(hs(()=>document.dispatchEvent(new CustomEvent('HTMLImportsLoaded',{cancelable:!0,bubbles:!0,detail:void 0}))),Br){const fs=Ns=>{const Ss=Ns.target;_s(Ss)&&(Ss.__loaded=!0)};document.addEventListener('load',fs,!0),document.addEventListener('error',fs,!0)}else new class{constructor(){this.documents={},this.inflight=0,ms(()=>{new MutationObserver(fs=>this.handleMutations(fs)).observe(document.head,{childList:!0,subtree:!0}),this.load()})}load(fs){const Ns=fs?this.whenImportLoaded(fs):this.whenImportsLoaded(document);Ns&&(this.inflight++,Ns.then(()=>{0==--this.inflight&&this.onLoadedAll()}))}whenImportsLoaded(fs){const Ns=fs.querySelectorAll(es),Ss=[];for(let bs=0,Es=Ns.length;bsfs):null}whenImportLoaded(fs){const Ns=fs.href;return void 0===this.documents[Ns]?(this.documents[Ns]='pending',zr.load(Ns).then(Ss=>{const bs=this.makeDocument(Ss.resource,Ss.redirectedUrl||Ns);return this.documents[Ns]=bs,this.whenImportsLoaded(bs)}).catch(()=>this.documents[Ns]=null).then(()=>fs)):null}makeDocument(fs,Ns){if(!fs)return document.createDocumentFragment();Qr&&(fs=fs.replace(Xr,(Ps,As,xs)=>{return-1===Ps.indexOf('type=')?`${As} type=${ts} ${xs}`:Ps}));let Ss;const bs=document.createElement('template');if(bs.innerHTML=fs,bs.content)Ss=bs.content;else for(Ss=document.createDocumentFragment();bs.firstElementChild;)Ss.appendChild(bs.firstElementChild);const Es=Ss.querySelector('base');Es&&(Ns=Zr.replaceAttrUrl(Es.getAttribute('href'),Ns),Es.removeAttribute('href'));const vs=Ss.querySelectorAll('dom-module');for(let As,Ps=0;Psthis.fireEvents())}flatten(fs){const Ns=fs.querySelectorAll(es);for(let Es,Ss=0,bs=Ns.length;Ss{const vs=document.createElement('script');Es.removeAttribute(ns);for(let Cs=0,Ts=Es.attributes.length;CsGr=null)});return Ns}waitForStyles(){const fs=!!document.querySelector(os),Ns=document.querySelectorAll(ls),Ss=[];for(let vs,bs=0,Es=Ns.length;bsvs.removeAttribute(ns))),fs&&vs.parentNode!==document.head){let Cs=gs(vs);for(;Cs&&gs(Cs);)Cs=gs(Cs);const Ts=vs.parentNode,Ps=vs.nextSibling,As=document.createElement(vs.localName);As.__appliedElement=vs,As.setAttribute('type','import-placeholder'),Cs.parentNode===document.head?document.head.insertBefore(vs,Cs):document.head.appendChild(vs),Ts.insertBefore(As,Ps),vs.removeAttribute('type')}return Promise.all(Ss)}fireEvents(){const fs=document.querySelectorAll(es);for(let Ss,Ns=fs.length-1;0<=Ns&&(Ss=fs[Ns]);Ns--)this.fireEventIfNeeded(Ss)}fireEventIfNeeded(fs){if(!fs.__loaded){fs.__loaded=!0,fs.import&&(fs.import.readyState='complete');const Ns=fs.import?'load':'error';fs.dispatchEvent(new CustomEvent(Ns,{bubbles:!1,cancelable:!1,detail:void 0}))}}handleMutations(fs){for(let Ns=0;Ns'===Da?'>':'"'===Da?'"':'\xA0'===Da?' ':void 0}function os(Da){return Da.replace(Xn,ts)}function rs(Da){return Da.replace(Zn,ts)}function ns(Da){for(var La={},wa=0;wa'}case Node.TEXT_NODE:{var Ka=Da.data;return La&&Qn[La.localName]?Ka:rs(Ka)}case Node.COMMENT_NODE:return'';default:throw window.console.error(Da),new Error('not implemented');}}function ds(Da,La){'template'===Da.localName&&(Da=Da.content);for(var Fa,wa='',ka=La?La(Da):Da.childNodes,Ua=0,Ha=ka.length;Ua]/g,zn=ns(['area','base','br','col','command','embed','hr','img','input','keygen','link','meta','param','source','track','wbr']),Qn=ns(['style','script','xmp','iframe','noembed','noframes','plaintext','noscript']),ea=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),ta=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),oa=Object.freeze({parentNode:ls,firstChild:ps,lastChild:cs,previousSibling:function(La){return ea.currentNode=La,ea.previousSibling()},nextSibling:function(La){return ea.currentNode=La,ea.nextSibling()},childNodes:_s,parentElement:function(La){return ta.currentNode=La,ta.parentNode()},firstElementChild:us,lastElementChild:hs,previousElementSibling:ms,nextElementSibling:ys,children:gs,innerHTML:fs,textContent:Ns}),ra=new DOMParser,sa=Object.getOwnPropertyDescriptor(Document.prototype,'activeElement'),na={parentElement:Es('parentElement'),parentNode:Es('parentNode'),nextSibling:Es('nextSibling'),previousSibling:Es('previousSibling'),className:{get:function(){return this.getAttribute('class')},set:function(La){this.setAttribute('class',La)},configurable:!0},nextElementSibling:{get:function(){if(bs(this,'nextSibling')){for(var La=this.nextSibling;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.nextSibling;return La}return ys(this)},configurable:!0},previousElementSibling:{get:function(){if(bs(this,'previousSibling')){for(var La=this.previousSibling;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.previousSibling;return La}return ms(this)},configurable:!0}},aa={childNodes:{get:function(){if(bs(this,'firstChild')){if(!this.__shady.childNodes){this.__shady.childNodes=[];for(var La=this.firstChild;La;La=La.nextSibling)this.__shady.childNodes.push(La)}return this.__shady.childNodes}return _s(this)},configurable:!0},firstChild:Es('firstChild'),lastChild:Es('lastChild'),textContent:{get:function(){if(bs(this,'firstChild')){for(var wa,La=[],ka=0,Fa=this.childNodes;wa=Fa[ka];ka++)wa.nodeType!==Node.COMMENT_NODE&&La.push(wa.textContent);return La.join('')}return Ns(this)},set:function(La){this.nodeType===Node.ELEMENT_NODE?(Cs(this),La&&this.appendChild(document.createTextNode(La))):this.nodeValue=La},configurable:!0},firstElementChild:{get:function(){if(bs(this,'firstChild')){for(var La=this.firstChild;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.nextSibling;return La}return us(this)},configurable:!0},lastElementChild:{get:function(){if(bs(this,'lastChild')){for(var La=this.lastChild;La&&La.nodeType!==Node.ELEMENT_NODE;)La=La.previousSibling;return La}return hs(this)},configurable:!0},children:{get:function(){return bs(this,'firstChild')?Array.prototype.filter.call(this.childNodes,function(La){return La.nodeType===Node.ELEMENT_NODE}):gs(this)},configurable:!0},innerHTML:{get:function(){var La='template'===this.localName?this.content:this;return bs(this,'firstChild')?ds(La):fs(La)},set:function(La){var wa='template'===this.localName?this.content:this;Cs(wa);var ka=ra.parseFromString(La,'text/html');ka.head&&vs(wa,ka.head),ka.body&&vs(wa,ka.body)},configurable:!0}},da={shadowRoot:{get:function(){return this.shadyRoot},set:function(La){this.shadyRoot=La},configurable:!0}},la={activeElement:{get:function(){return Ps(this)},set:function(){},configurable:!0}},ia=Nn.hasDescriptors?function(){}:function(Da){Da.__shady&&Da.__shady.__outsideAccessors||(Da.__shady=Da.__shady||{},Da.__shady.__outsideAccessors=!0,As(Da,na,!0))},pa=Nn.hasDescriptors?function(){}:function(Da){Da.__shady&&Da.__shady.__insideAccessors||(Da.__shady=Da.__shady||{},Da.__shady.__insideAccessors=!0,As(Da,aa,!0),As(Da,da,!0))},ca=function(La){if(!bs(La,'firstChild')){La.__shady=La.__shady||{},La.__shady.firstChild=ps(La),La.__shady.lastChild=cs(La),pa(La);for(var ka,wa=La.__shady.childNodes=_s(La),Fa=0;Fa+~])'};const Zo='style-scope';class zo{get SCOPE_NAME(){return Zo}dom(jr,Br,Gr){jr.__styleScoped?jr.__styleScoped=null:this._transformDom(jr,Br||'',Gr)}_transformDom(jr,Br,Gr){jr.nodeType===Node.ELEMENT_NODE&&this.element(jr,Br,Gr);let Yr='template'===jr.localName?(jr.content||jr._content).childNodes:jr.children||jr.childNodes;if(Yr)for(let Vr=0;Vr`:${Jr}(${Xr.replace(/\s/g,'')})`),jr=jr.replace(dr,`${sr} $1`),jr=jr.replace(or,(Vr,Jr,Xr)=>{if(!Yr){let Zr=this._transformCompoundSelector(Xr,Jr,Br,Gr);Yr=Yr||Zr.stop,Jr=Zr.combinator,Xr=Zr.value}return Jr+Xr}),jr}_transformCompoundSelector(jr,Br,Gr,Yr){let Vr=jr.indexOf(ar);0<=jr.indexOf(sr)?jr=this._transformHostSelector(jr,Yr):0!==Vr&&(jr=Gr?this._transformSimpleSelector(jr,Gr):jr);let Jr=!1;0<=Vr&&(Br='',Jr=!0);let Xr;return Jr&&(Xr=!0,Jr&&(jr=jr.replace(ir,(Zr,zr)=>` > ${zr}`))),jr=jr.replace(pr,(Zr,zr,Qr)=>`[dir="${Qr}"] ${zr}, ${zr}[dir="${Qr}"]`),{value:jr,combinator:Br,stop:Xr}}_transformSimpleSelector(jr,Br){let Gr=jr.split(_r);return Gr[0]+=Br,Gr.join(_r)}_transformHostSelector(jr,Br){let Gr=jr.match(lr),Yr=Gr&&Gr[2].trim()||'';if(Yr){if(!Yr[0].match(rr)){let Vr=Yr.split(rr)[0];return Vr===Br?Yr:'should_not_match'}return jr.replace(lr,function(Vr,Jr,Xr){return Br+Xr})}return jr.replace(sr,Br)}documentRule(jr){jr.selector=jr.parsedSelector,this.normalizeRootSelector(jr),this._transformRule(jr,this._transformDocumentSelector)}normalizeRootSelector(jr){jr.selector===':root'&&(jr.selector='html')}_transformDocumentSelector(jr){return jr.match(ar)?this._transformComplexSelector(jr,er):this._transformSimpleSelector(jr.trim(),er)}}let Qo=/:(nth[-\w]+)\(([^)]+)\)/,er=`:not(.${Zo})`,tr=',',or=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,rr=/[[.:#*]/,sr=':host',ar='::slotted',dr=/^(::slotted)/,lr=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ir=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,pr=/(.*):dir\((?:(ltr|rtl))\)/,_r=':';var mr=new zo,yr={};const gr=Promise.resolve();class fr{static get(jr){return jr.__styleInfo}static set(jr,Br){return jr.__styleInfo=Br,Br}static invalidate(jr){yr[jr]&&(yr[jr]._applyShimInvalid=!0)}static startValidating(jr){const Br=yr[jr];Br._validating||(Br._validating=!0,gr.then(()=>{Br._applyShimInvalid=!1,Br._validating=!1}))}constructor(jr,Br,Gr,Yr,Vr,Jr){this.styleRules=jr||null,this.placeholder=Br||null,this.ownStylePropertyNames=Gr||[],this.overrideStyleProperties=null,this.elementName=Yr||'',this.cssBuild=Jr||'',this.typeExtension=Vr||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const Nr=window.Element.prototype,Sr=Nr.matches||Nr.matchesSelector||Nr.mozMatchesSelector||Nr.msMatchesSelector||Nr.oMatchesSelector||Nr.webkitMatchesSelector,br=navigator.userAgent.match('Trident'),Er='x-scope';class vr{get XSCOPE_NAME(){return Er}decorateStyles(jr){let Br=this,Gr={},Yr=[],Vr=0;Po(jr,function(Xr){Br.decorateRule(Xr),Xr.index=Vr++,Br.collectPropertiesInCssText(Xr.propertyInfo.cssText,Gr)},function(Zr){Yr.push(Zr)}),jr._keyframes=Yr;let Jr=[];for(let Xr in Gr)Jr.push(Xr);return Jr}decorateRule(jr){if(jr.propertyInfo)return jr.propertyInfo;let Br={},Gr={},Yr=this.collectProperties(jr,Gr);return Yr&&(Br.properties=Gr,jr.rules=null),Br.cssText=this.collectCssText(jr),jr.propertyInfo=Br,Br}collectProperties(jr,Br){let Gr=jr.propertyInfo;if(!Gr){let Yr,Vr=Xo.VAR_ASSIGN,Jr=jr.parsedCssText,Xr,Zr;for(;Yr=Vr.exec(Jr);)Xr=(Yr[2]||Yr[3]).trim(),('inherit'!==Xr||'unset'!==Xr)&&(Br[Yr[1].trim()]=Xr),Zr=!0;return Zr}else if(Gr.properties)return Object.assign(Br,Gr.properties),!0}collectCssText(jr){return this.collectConsumingCssText(jr.parsedCssText)}collectConsumingCssText(jr){return jr.replace(Xo.BRACKETED,'').replace(Xo.VAR_ASSIGN,'')}collectPropertiesInCssText(jr,Br){for(let Gr,Yr;Gr=Xo.VAR_CONSUMED.exec(jr);)Yr=Gr[1],':'!==Gr[2]&&(Br[Yr]=!0)}reify(jr){let Br=Object.getOwnPropertyNames(jr);for(let Yr,Gr=0;Gr *'===Jr||'html'===Jr,Zr=0===Jr.indexOf(':host')&&!Xr;if('shady'===Gr&&(Xr=Jr===Vr+' > *.'+Vr||-1!==Jr.indexOf('html'),Zr=!Xr&&0===Jr.indexOf(Vr)),'shadow'===Gr&&(Xr=':host > *'===Jr||'html'===Jr,Zr=Zr&&!Xr),Xr||Zr){let zr=Vr;Zr&&(Go&&!Br.transformedSelector&&(Br.transformedSelector=mr._transformRuleCss(Br,mr._transformComplexSelector,mr._calcElementScope(jr.is),Vr)),zr=Br.transformedSelector||Vr),Yr({selector:zr,isHost:Zr,isRoot:Xr})}}}hostAndRootPropertiesForScope(jr,Br){let Gr={},Yr={},Vr=this,Jr=Br&&Br.__cssBuild;return Po(Br,function(Xr){Vr.whenHostOrRootRule(jr,Xr,Jr,function(Zr){let zr=jr._element||jr;Sr.call(zr,Zr.selector)&&(Zr.isHost?Vr.collectProperties(Xr,Gr):Vr.collectProperties(Xr,Yr))})},null,!0),{rootProps:Yr,hostProps:Gr}}transformStyles(jr,Br,Gr){let Yr=this,Vr=mr._calcHostScope(jr.is,jr.extends),Jr=jr.extends?'\\'+Vr.slice(0,-1)+'\\]':Vr,Xr=new RegExp(Xo.HOST_PREFIX+Jr+Xo.HOST_SUFFIX),Zr=fr.get(jr).styleRules,zr=this._elementKeyframeTransforms(jr,Zr,Gr);return mr.elementStyles(jr,Zr,function(Qr){Yr.applyProperties(Qr,Br),Go||To(Qr)||!Qr.cssText||(Yr.applyKeyframeTransforms(Qr,zr),Yr._scopeSelector(Qr,Xr,Vr,Gr))})}_elementKeyframeTransforms(jr,Br,Gr){let Yr=Br._keyframes,Vr={};if(!Go&&Yr)for(let Jr=0,Xr=Yr[Jr];Jr=Xr._useCount&&Xr.parentNode&&Xr.parentNode.removeChild(Xr)),Go?Jr.customStyle?(Jr.customStyle.textContent=Vr,Yr=Jr.customStyle):Vr&&(Yr=Ao(Vr,Gr,jr.shadowRoot,Jr.placeholder)):Yr?!Yr.parentNode&&xo(Yr,null,Jr.placeholder):Vr&&(Yr=Ao(Vr,Gr,null,Jr.placeholder)),Yr&&(Yr._useCount=Yr._useCount||0,Jr.customStyle!=Yr&&Yr._useCount++,Jr.customStyle=Yr),br&&(Yr.textContent=Yr.textContent),Yr}applyCustomStyle(jr,Br){let Gr=Co(jr),Yr=this;jr.textContent=vo(Gr,function(Vr){let Jr=Vr.cssText=Vr.parsedCssText;Vr.propertyInfo&&Vr.propertyInfo.cssText&&(Jr=No(Jr),Vr.cssText=Yr.valueForProperties(Jr,Br))})}}var Cr=new vr;let Tr={};const Pr=window.customElements;if(Pr&&!Go){const jr=Pr.define;Pr.define=function(Br,Gr,Yr){return Tr[Br]=Mo(Br),jr.call(Pr,Br,Gr,Yr)}}let xr=Xo.MIXIN_MATCH,Rr=Xo.VAR_ASSIGN,Mr=/;\s*/m,Ir=/^\s*(initial)|(inherit)\s*$/,Or='_-_';class Dr{constructor(){this._map={}}set(jr,Br){jr=jr.trim(),this._map[jr]={properties:Br,dependants:{}}}get(jr){return jr=jr.trim(),this._map[jr]}}class Lr{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new Dr,this._separator=Or,this._boundProduceCssProperties=(jr,Br,Gr,Yr)=>this._produceCssProperties(jr,Br,Gr,Yr)}detectMixin(jr){const Br=xr.test(jr)||Rr.test(jr);return xr.lastIndex=0,Rr.lastIndex=0,Br}transformStyle(jr,Br){let Gr=Co(jr);return this.transformRules(Gr,Br),Gr}transformRules(jr,Br){this._currentTemplate=yr[Br],Po(jr,Gr=>{this.transformRule(Gr)}),this._currentTemplate=null}transformRule(jr){jr.cssText=this.transformCssText(jr.parsedCssText),':root'===jr.selector&&(jr.selector=':host > *')}transformCssText(jr){return jr=jr.replace(Rr,this._boundProduceCssProperties),this._consumeCssProperties(jr)}_getInitialValueForProperty(jr){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(jr)}_consumeCssProperties(jr){for(let Br;Br=xr.exec(jr);){let Gr=Br[0],Yr=Br[1],Vr=Br.index,Jr=Vr+Gr.indexOf('@apply'),Xr=Vr+Gr.length,Zr=jr.slice(0,Jr),zr=jr.slice(Xr),Qr=this._cssTextToMap(Zr),es=this._atApplyToCssProperties(Yr,Qr);jr=[Zr,es,zr].join(''),xr.lastIndex=Vr+es.length}return jr}_atApplyToCssProperties(jr,Br){jr=jr.replace(Mr,'');let Gr=[],Yr=this._map.get(jr);if(Yr||(this._map.set(jr,{}),Yr=this._map.get(jr)),Yr){this._currentTemplate&&(Yr.dependants[this._currentTemplate.name]=this._currentTemplate);let Vr,Jr,Xr;for(Vr in Yr.properties)Xr=Br&&Br[Vr],Jr=[Vr,': var(',jr,Or,Vr],Xr&&Jr.push(',',Xr),Jr.push(')'),Gr.push(Jr.join(''))}return Gr.join('; ')}_replaceInitialOrInherit(jr,Br){let Gr=Ir.exec(Br);return Gr&&(Gr[1]?Br=Lr._getInitialValueForProperty(jr):Br='apply-shim-inherit'),Br}_cssTextToMap(jr){let Br=jr.split(';'),Gr,Yr,Vr={};for(let Xr,Zr,Jr=0;Jr{as&&this._map.get(as)&&(Yr='@apply '+as+';')}),!Yr)return jr;let Vr=this._consumeCssProperties(Yr),Jr=jr.slice(0,jr.indexOf('--')),Xr=this._cssTextToMap(Vr),Zr=Xr,zr=this._map.get(Br),Qr=zr&&zr.properties;Qr?Zr=Object.assign(Object.create(Qr),Xr):this._map.set(Br,Zr);let ts,os,es=[],rs=!1;for(ts in Zr)os=Xr[ts],void 0==os&&(os='initial'),Qr&&!(ts in Qr)&&(rs=!0),es.push(Br+Or+ts+': '+os);return rs&&this._invalidateMixinEntry(zr),zr&&(zr.properties=Zr),Gr&&(Jr=jr+';'+Jr),Jr+es.join('; ')+';'}}let wr=new Lr;window.ApplyShim=wr;let kr=function(){};if(!Go){let jr=Jr=>{return Jr.classList&&!Jr.classList.contains(mr.SCOPE_NAME)||Jr instanceof SVGElement&&(!Jr.hasAttribute('class')||0>Jr.getAttribute('class').indexOf(mr.SCOPE_NAME))},Br=Jr=>{for(let Zr,Xr=0;Xr{Gr.observe(Jr,{childList:!0,subtree:!0})},Vr=window.customElements&&!window.customElements.flush;if(Vr)Yr(document);else{let Jr=()=>{Yr(document.body)};window.HTMLImports?window.HTMLImports.whenReady(Jr):requestAnimationFrame(function(){if('loading'===document.readyState){let Xr=function(){Jr(),document.removeEventListener('readystatechange',Xr)};document.addEventListener('readystatechange',Xr)}else Jr()})}kr=function(){Br(Gr.takeRecords())}}let Fr=new class{constructor(jr=100){this.cache={},this.typeMax=jr}_validate(jr,Br,Gr){for(let Vr,Yr=0;Yrthis.typeMax&&Vr.shift(),this.cache[jr]=Vr}fetch(jr,Br,Gr){let Yr=this.cache[jr];if(Yr)for(let Jr,Vr=Yr.length-1;0<=Vr;Vr--)if(Jr=Yr[Vr],this._validate(Jr,Br,Gr))return Jr}};class Ur{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=fr.set(document.documentElement,new fr({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return Go}get nativeCss(){return Yo}get nativeCssApply(){return!1}flush(){kr()}_generateScopeSelector(jr){let Br=this._scopeCounter[jr]=(this._scopeCounter[jr]||0)+1;return`${jr}-${Br}`}getStyleAst(jr){return Co(jr)}styleAstToString(jr){return vo(jr)}_gatherStyles(jr){let Br=jr.content.querySelectorAll('style'),Gr=[];for(let Vr,Yr=0;Yr{Go?mr.normalizeRootSelector(Gr):mr.documentRule(Gr),this.nativeCss&&!this.nativeCssApply&&wr.transformRule(Gr)}),this.nativeCss?jr.textContent=vo(Br):this._documentOwnerStyleInfo.styleRules.rules.push(Br)}_revalidateApplyShim(jr){if(this.nativeCss&&!this.nativeCssApply){let Br=Co(jr);wr.transformRules(Br),jr.textContent=vo(Br)}}_applyCustomStyleToDocument(jr){this.nativeCss||Cr.applyCustomStyle(jr,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(jr,Br){let Gr;if(!this.nativeCss){let Yr=fr.get(jr)||fr.get(this._styleOwnerForNode(jr));Gr=Yr.styleProperties[Br]}return Gr=Gr||window.getComputedStyle(jr).getPropertyValue(Br),Gr.trim()}setElementClass(jr,Br){let Gr=jr.getRootNode(),Yr=Br?Br.split(/\s/):[],Vr=Gr.host&&Gr.host.localName;if(!Vr){var Jr=jr.getAttribute('class');if(Jr){let Xr=Jr.split(/\s/);for(let Zr=0;Zr {\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 = /(]*)(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 Path.resolveUrlsInStyle(element, base);\n }\n },\n\n fixUrlAttributes(element, base) {\n const attrs = ['action', 'src', 'href', 'url', 'style'];\n for (let i = 0, a; i < attrs.length && (a = attrs[i]); i++) {\n const at = element.attributes[a];\n const v = at && at.value;\n // Skip bound attribute values (assume binding is done via {} and []).\n // TODO(valdrin) consider exposing a library-implementable hook.\n if (v && (v.search(/({{|\\[\\[)/) < 0)) {\n at.value = (a === 'style') ?\n Path.resolveUrlsInCssText(v, base) :\n Path.replaceAttrUrl(v, base);\n }\n }\n },\n\n fixUrlsInTemplates(element, base) {\n const t$ = element.querySelectorAll('template');\n for (let i = 0; i < t$.length; i++) {\n Path.fixUrlsInTemplate(t$[i], base);\n }\n },\n\n fixUrlsInTemplate(template, base) {\n const content = template.content;\n if (!content) { // Template not supported.\n return;\n }\n const n$ = content.querySelectorAll(\n 'style, form[action], [src], [href], [url], [style]');\n for (let i = 0; i < n$.length; i++) {\n const n = n$[i];\n if (n.localName == 'style') {\n Path.resolveUrlsInStyle(n, base);\n } else {\n Path.fixUrlAttributes(n, base);\n }\n }\n Path.fixUrlsInTemplates(content, base);\n },\n\n resolveUrlsInStyle(style, linkUrl) {\n style.textContent = Path.resolveUrlsInCssText(style.textContent, linkUrl);\n },\n\n resolveUrlsInCssText(cssText, linkUrl) {\n let r = Path.replaceUrls(cssText, linkUrl, CSS_URL_REGEXP);\n r = Path.replaceUrls(r, linkUrl, CSS_IMPORT_REGEXP);\n return r;\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 * @return {!Promise}\n */\n load(url) {\n return new Promise((resolve, reject) => {\n if (!url) {\n reject({\n resource: 'error: href must be specified'\n });\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 resolve({\n resource: resource\n });\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', url, Xhr.async);\n request.addEventListener('readystatechange', (e) => {\n if (request.readyState === 4) {\n // Servers redirecting an import can add a Location header to help us\n // polyfill correctly.\n let redirectedUrl = undefined;\n try {\n const locationHeader = request.getResponseHeader('Location');\n if (locationHeader) {\n // Relative or full path.\n redirectedUrl = (locationHeader.substr(0, 1) === '/') ?\n location.origin + locationHeader : locationHeader;\n }\n } catch (e) {\n console.error(e.message);\n }\n const resp = {\n resource: (request.response || request.responseText),\n redirectedUrl: redirectedUrl\n };\n if ((request.status >= 200 && request.status < 300) ||\n request.status === 304 || request.status === 0) {\n resolve(resp);\n } else {\n reject(resp);\n }\n }\n });\n request.send();\n }\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 * @type {Function}\n */\n const MATCHES = Element.prototype.matches ||\n Element.prototype.matchesSelector ||\n Element.prototype.mozMatchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.oMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\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 // 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 .\n new MutationObserver(m => this.handleMutations(m)).observe(document.head, {\n childList: true,\n subtree: true\n });\n this.load();\n });\n }\n\n /**\n * Loads the resources needed by the import link and fires the load/error\n * event on the node once finished. If link is not defined or null, loads\n * all imports in the main document.\n * @param {HTMLLinkElement=} link\n */\n load(link) {\n const whenLoadedPromise = link ? this.whenImportLoaded(link) :\n this.whenImportsLoaded(document);\n if (whenLoadedPromise) {\n this.inflight++;\n whenLoadedPromise.then(() => {\n // Wait until all resources are ready.\n if (--this.inflight === 0) {\n this.onLoadedAll();\n }\n });\n }\n }\n\n /**\n * @param {!(HTMLDocument|DocumentFragment)} doc\n * @return {Promise|null}\n */\n whenImportsLoaded(doc) {\n const links = /** @type {!NodeList} */\n (doc.querySelectorAll(importSelector));\n const promises = [];\n for (let i = 0, l = links.length; i < l; i++) {\n const promise = this.whenImportLoaded(links[i]);\n if (promise) {\n promises.push(promise);\n }\n }\n return promises.length ? Promise.all(promises).then(() => doc) : null;\n }\n\n /**\n * @param {!HTMLLinkElement} link\n * @return {Promise|null}\n */\n whenImportLoaded(link) {\n const url = link.href;\n // This resource is already being handled by another import.\n if (this.documents[url] !== undefined) {\n return null;\n }\n // Mark it as pending to notify others this url is being loaded.\n this.documents[url] = 'pending';\n return Xhr.load(url)\n .then((resp) => {\n const doc = this.makeDocument(resp.resource, resp.redirectedUrl || url);\n this.documents[url] = doc;\n // Load subtree.\n return this.whenImportsLoaded(doc);\n })\n .catch(() => this.documents[url] = null)\n .then(() => link);\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 // should be appended to . 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 //