diff --git a/webcomponents-hi-ce.js b/webcomponents-hi-ce.js index 9509c52..4f0f254 100644 --- a/webcomponents-hi-ce.js +++ b/webcomponents-hi-ce.js @@ -1,6 +1,6 @@ -(function(){'use strict';function _(Mt){return Mt=$(Mt),te(ee(Mt),Mt)}function $(Mt){return Mt.replace(Re.comments,'').replace(Re.port,'')}function ee(Mt){let Lt={start:0,end:Mt.length},wt=Lt;for(let Ot=0,kt=Mt.length;Ot{'complete'===document.readyState&&Ae()}))}function Ae(){requestAnimationFrame(()=>{(Tt||xt._elementsHaveApplied)&&xt.updateStyles(),Tt=!1})}(Mt=>{const Lt=!!('import'in document.createElement('link'));let wt=null;!1=='currentScript'in document&&Object.defineProperty(document,'currentScript',{get(){return wt||('complete'===document.readyState?null:document.scripts[document.scripts.length-1])},configurable:!0});const Ot=/(^\/)|(^#)|(^[\w-\d]*:)/,kt=/(url\()([^)]*)(\))/g,Dt=/(@import[\s]+(?!url\())([^;]*)(;)/g,Ht=/(]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,Ut={fixUrls(or,nr){or.href&&or.setAttribute('href',Ut.replaceAttrUrl(or.getAttribute('href'),nr)),or.src&&or.setAttribute('src',Ut.replaceAttrUrl(or.getAttribute('src'),nr)),'style'===or.localName&&Ut.resolveUrlsInStyle(or,nr)},fixUrlAttributes(or,nr){const sr=['action','src','href','url','style'];for(let ir,ar=0;ardr.search(/({{|\[\[)/)&&(pr.value='style'===ir?Ut.resolveUrlsInCssText(dr,nr):Ut.replaceAttrUrl(dr,nr))}},fixUrlsInTemplates(or,nr){const sr=or.querySelectorAll('template');for(let ar=0;ar{let cr=pr.replace(/["']/g,'');return nr&&(cr=Ut.resolveUrl(cr,nr)),ir+'\''+cr+'\''+dr})},replaceAttrUrl(or,nr){return or&&Ot.test(or)?or:Ut.resolveUrl(or,nr)},resolveUrl(or,nr){if(void 0===Ut.__workingURL){Ut.__workingURL=!1;try{const ar=new URL('b','http://a');ar.pathname='c%20d',Ut.__workingURL='http://a/c%20d'===ar.href}catch(ar){}}if(Ut.__workingURL)return new URL(or,nr).href;let sr=Ut.__tempDoc;return sr||(sr=document.implementation.createHTMLDocument('temp'),Ut.__tempDoc=sr,sr.__base=sr.createElement('base'),sr.head.appendChild(sr.__base),sr.__anchor=sr.createElement('a')),sr.__base.href=nr,sr.__anchor.href=or,sr.__anchor.href||or}},Ft={async:!0,load(or){return new Promise((nr,sr)=>{if(!or)sr({resource:'error: href must be specified'});else if(or.match(/^data:/)){const ar=or.split(','),ir=ar[0];let pr=ar[1];pr=-1{if(4===ar.readyState){let ir;try{const dr=ar.getResponseHeader('Location');dr&&(ir='/'===dr.substr(0,1)?location.origin+dr:dr)}catch(dr){console.error(dr.message)}const pr={resource:ar.response||ar.responseText,redirectedUrl:ir};304===ar.status||0===ar.status||200<=ar.status&&300>ar.status?nr(pr):sr(pr)}}),ar.send()}})}},jt=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent),qt='link[rel=import]',Bt='import-disable',Kt=`link[rel=stylesheet][href][type=${Bt}]`,Xt=`${qt}, ${Kt}, +(function(){'use strict';function _(Mt){return Mt=$(Mt),te(ee(Mt),Mt)}function $(Mt){return Mt.replace(Re.comments,'').replace(Re.port,'')}function ee(Mt){let Ot={start:0,end:Mt.length},Lt=Ot;for(let wt=0,kt=Mt.length;wt{'complete'===document.readyState&&Ae()}))}function Ae(){requestAnimationFrame(()=>{(Tt||xt._elementsHaveApplied)&&xt.updateStyles(),Tt=!1})}(Mt=>{const Ot=!!('import'in document.createElement('link'));let Lt=null;!1=='currentScript'in document&&Object.defineProperty(document,'currentScript',{get(){return Lt||('complete'===document.readyState?null:document.scripts[document.scripts.length-1])},configurable:!0});const wt=/(^\/)|(^#)|(^[\w-\d]*:)/,kt=/(url\()([^)]*)(\))/g,Dt=/(@import[\s]+(?!url\())([^;]*)(;)/g,Ht=/(]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,Ut={fixUrls(or,nr){or.href&&or.setAttribute('href',Ut.replaceAttrUrl(or.getAttribute('href'),nr)),or.src&&or.setAttribute('src',Ut.replaceAttrUrl(or.getAttribute('src'),nr)),'style'===or.localName&&Ut.resolveUrlsInStyle(or,nr)},fixUrlAttributes(or,nr){const sr=['action','src','href','url','style'];for(let ir,ar=0;ardr.search(/({{|\[\[)/)&&(pr.value='style'===ir?Ut.resolveUrlsInCssText(dr,nr):Ut.replaceAttrUrl(dr,nr))}},fixUrlsInTemplates(or,nr){const sr=or.querySelectorAll('template');for(let ar=0;ar{let cr=pr.replace(/["']/g,'');return nr&&(cr=Ut.resolveUrl(cr,nr)),ir+'\''+cr+'\''+dr})},replaceAttrUrl(or,nr){return or&&wt.test(or)?or:Ut.resolveUrl(or,nr)},resolveUrl(or,nr){if(void 0===Ut.__workingURL){Ut.__workingURL=!1;try{const ar=new URL('b','http://a');ar.pathname='c%20d',Ut.__workingURL='http://a/c%20d'===ar.href}catch(ar){}}if(Ut.__workingURL)return new URL(or,nr).href;let sr=Ut.__tempDoc;return sr||(sr=document.implementation.createHTMLDocument('temp'),Ut.__tempDoc=sr,sr.__base=sr.createElement('base'),sr.head.appendChild(sr.__base),sr.__anchor=sr.createElement('a')),sr.__base.href=nr,sr.__anchor.href=or,sr.__anchor.href||or}},Ft={async:!0,load(or){return new Promise((nr,sr)=>{if(!or)sr({resource:'error: href must be specified'});else if(or.match(/^data:/)){const ar=or.split(','),ir=ar[0];let pr=ar[1];pr=-1{if(4===ar.readyState){let ir;try{const dr=ar.getResponseHeader('Location');dr&&(ir='/'===dr.substr(0,1)?location.origin+dr:dr)}catch(dr){console.error(dr.message)}const pr={resource:ar.response||ar.responseText,redirectedUrl:ir};304===ar.status||0===ar.status||200<=ar.status&&300>ar.status?nr(pr):sr(pr)}}),ar.send()}})}},jt=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent),qt='link[rel=import]',Bt='import-disable',Kt=`link[rel=stylesheet][href][type=${Bt}]`,Xt=`${qt}, ${Kt}, style:not([type]), link[rel=stylesheet][href]:not([type]), script:not([type]), script[type="application/javascript"], script[type="text/javascript"]`,Wt='import-dependency',Vt=`${qt}:not(${Wt})`,Gt=`script[${Wt}]`,Yt=`style[${Wt}], - link[rel=stylesheet][${Wt}]`,zt=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector;const Jt=or=>{return or.nodeType===Node.ELEMENT_NODE&&zt.call(or,qt)},Zt=or=>{return or.__loadPromise||(or.__loadPromise=new Promise(nr=>{'script'!==or.localName||or.src?jt&&'style'===or.localName?or.addEventListener('load',nr):(or.addEventListener('load',nr),or.addEventListener('error',nr)):nr()}).then(()=>{return or.__loaded=!0,or})),or.__loadPromise},Qt=or=>{er(()=>tr(()=>or&&or()))},er=or=>{if('loading'!==document.readyState)or();else{const nr=()=>{'loading'!==document.readyState&&(document.removeEventListener('readystatechange',nr),or())};document.addEventListener('readystatechange',nr)}},tr=or=>{let nr=document.querySelectorAll(Vt);const sr=[];for(let pr,ar=0,ir=nr.length;ar{if(Lt)return or.ownerDocument;let nr=or.__ownerImport;if(!nr){for(nr=or;(nr=nr.parentNode||nr.host)&&!Jt(nr););or.__ownerImport=nr}return nr};let lr;if(window.customElements?lr=window.customElements.polyfillFlushCallback:window.customElements={},window.customElements.polyfillFlushCallback=lr?or=>Qt(()=>lr(or)):Qt,Lt){const or=document.querySelectorAll(qt);for(let ir,sr=0,ar=or.length;sr{const ar=sr.target;Jt(ar)&&(ar.__loaded=!0)};document.addEventListener('load',nr,!0),document.addEventListener('error',nr,!0)}else new class{constructor(){this.documents={},this.inflight=0,er(()=>{new MutationObserver(or=>this.handleMutations(or)).observe(document.head,{childList:!0,subtree:!0}),this.load()})}load(or){const nr=or?this.whenImportLoaded(or):this.whenImportsLoaded(document);nr&&(this.inflight++,nr.then(()=>{0==--this.inflight&&this.onLoadedAll()}))}whenImportsLoaded(or){const nr=or.querySelectorAll(qt),sr=[];for(let ar=0,ir=nr.length;aror):null}whenImportLoaded(or){const nr=or.href;return void 0===this.documents[nr]?(this.documents[nr]='pending',Ft.load(nr).then(sr=>{const ar=this.makeDocument(sr.resource,sr.redirectedUrl||nr);return this.documents[nr]=ar,this.whenImportsLoaded(ar)},()=>this.documents[nr]=null).then(()=>or)):null}makeDocument(or,nr){if(!or)return document.createDocumentFragment();jt&&(or=or.replace(Ht,(mr,ur,yr)=>{return-1===mr.indexOf('type=')?`${ur} type=${Bt} ${yr}`:mr}));let sr;const ar=document.createElement('template');if(ar.innerHTML=or,ar.content)sr=ar.content;else for(sr=document.createDocumentFragment();ar.firstElementChild;)sr.appendChild(ar.firstElementChild);const ir=sr.querySelector('base');ir&&(nr=Ut.replaceAttrUrl(ir.getAttribute('href'),nr),ir.removeAttribute('href'));const pr=sr.querySelectorAll('dom-module');for(let ur,mr=0;mrthis.fireEvents())}flatten(or){const nr=or.querySelectorAll(qt);for(let ir,sr=0,ar=nr.length;sr{const pr=document.createElement('script');ir.removeAttribute(Wt);for(let dr=0,cr=ir.attributes.length;drwt=null)});return nr}waitForStyles(){const or=!!document.querySelector(Kt),nr=document.querySelectorAll(Yt),sr=[];for(let pr,ar=0,ir=nr.length;arpr.removeAttribute(Wt))),or&&pr.parentNode!==document.head){let dr=rr(pr);for(;dr&&rr(dr);)dr=rr(dr);const cr=pr.parentNode,mr=pr.nextSibling,ur=document.createElement(pr.localName);ur.__appliedElement=pr,ur.setAttribute('type','import-placeholder'),dr.parentNode===document.head?document.head.insertBefore(pr,dr):document.head.appendChild(pr),cr.insertBefore(ur,mr),pr.removeAttribute('type')}return Promise.all(sr)}fireEvents(){const or=document.querySelectorAll(qt);for(let sr,nr=or.length-1;0<=nr&&(sr=or[nr]);nr--)this.fireEventIfNeeded(sr)}fireEventIfNeeded(or){if(!or.__loaded){or.__loaded=!0,or.import&&(or.import.readyState='complete');const nr=or.import?'load':'error';or.dispatchEvent(new CustomEvent(nr,{bubbles:!1,cancelable:!1,detail:void 0}))}}handleMutations(or){for(let nr=0;nrdocument.dispatchEvent(new CustomEvent('HTMLImportsLoaded',{cancelable:!0,bubbles:!0,detail:void 0}))),Mt.useNative=Lt,Mt.whenReady=Qt,Mt.importForElement=rr})(window.HTMLImports=window.HTMLImports||{}),function(){'use strict';function Mt(kr){var Dr=rr.has(kr);return kr=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(kr),!Dr&&kr}function Lt(kr){var Dr=kr.isConnected;if(void 0!==Dr)return Dr;for(;kr&&!(kr.__CE_isImportDocument||kr instanceof Document);)kr=kr.parentNode||(kr instanceof ShadowRoot?kr.host:void 0);return kr&&(kr.__CE_isImportDocument||kr instanceof Document)}function wt(kr,Dr){for(;Dr&&Dr!==kr&&!Dr.nextSibling;)Dr=Dr.parentNode;return Dr&&Dr!==kr?Dr.nextSibling:null}function Ot(kr,Dr,Hr){Hr=Hr?Hr:new Set;for(var Ur=kr;Ur;){if(Ur.nodeType===Node.ELEMENT_NODE){var Fr=Ur;if(Dr(Fr),'link'===Fr.localName&&'import'===Fr.getAttribute('rel')){if(Ur=Fr.import,Ur instanceof Node&&!Hr.has(Ur))for(Hr.add(Ur),Ur=Ur.firstChild;Ur;Ur=Ur.nextSibling)Ot(Ur,Dr,Hr);Ur=wt(kr,Fr);continue}if(Fr=Fr.__CE_shadowRoot)for(Fr=Fr.firstChild;Fr;Fr=Fr.nextSibling)Ot(Fr,Dr,Hr)}Ur=Ur.firstChild?Ur.firstChild:wt(kr,Ur)}}function kt(kr,Dr,Hr){kr[Dr]=Hr}function Dt(){this.a=new Map,this.f=new Map,this.c=[],this.b=!1}function Ht(kr,Dr,Hr){kr.a.set(Dr,Hr),kr.f.set(Hr.constructor,Hr)}function Ut(kr,Dr){kr.b=!0,kr.c.push(Dr)}function Ft(kr,Dr){kr.b&&Ot(Dr,function(Hr){return jt(kr,Hr)})}function jt(kr,Dr){if(kr.b&&!Dr.__CE_patched){Dr.__CE_patched=!0;for(var Hr=0;Hr+~])'};const He='style-scope';class Ue{get SCOPE_NAME(){return He}dom(Mt,Lt,wt){Mt.__styleScoped?Mt.__styleScoped=null:this._transformDom(Mt,Lt||'',wt)}_transformDom(Mt,Lt,wt){Mt.nodeType===Node.ELEMENT_NODE&&this.element(Mt,Lt,wt);let Ot='template'===Mt.localName?(Mt.content||Mt._content).childNodes:Mt.children||Mt.childNodes;if(Ot)for(let kt=0;kt`:${Dt}(${Ht.replace(/\s/g,'')})`),Mt=Mt.replace(Ge,`${Xe} $1`),Mt=Mt.replace(Be,(kt,Dt,Ht)=>{if(!Ot){let Ut=this._transformCompoundSelector(Ht,Dt,Lt,wt);Ot=Ot||Ut.stop,Dt=Ut.combinator,Ht=Ut.value}return Dt+Ht}),Mt}_transformCompoundSelector(Mt,Lt,wt,Ot){let kt=Mt.indexOf(Ve);0<=Mt.indexOf(Xe)?Mt=this._transformHostSelector(Mt,Ot):0!==kt&&(Mt=wt?this._transformSimpleSelector(Mt,wt):Mt);let Dt=!1;0<=kt&&(Lt='',Dt=!0);let Ht;return Dt&&(Ht=!0,Dt&&(Mt=Mt.replace(ze,(Ut,Ft)=>` > ${Ft}`))),Mt=Mt.replace($e,(Ut,Ft,jt)=>`[dir="${jt}"] ${Ft}, ${Ft}[dir="${jt}"]`),{value:Mt,combinator:Lt,stop:Ht}}_transformSimpleSelector(Mt,Lt){let wt=Mt.split(Ze);return wt[0]+=Lt,wt.join(Ze)}_transformHostSelector(Mt,Lt){let wt=Mt.match(Ye),Ot=wt&&wt[2].trim()||'';if(Ot){if(!Ot[0].match(Ke)){let kt=Ot.split(Ke)[0];return kt===Lt?Ot:'should_not_match'}return Mt.replace(Ye,function(kt,Dt,Ht){return Lt+Ht})}return Mt.replace(Xe,Lt)}documentRule(Mt){Mt.selector=Mt.parsedSelector,this.normalizeRootSelector(Mt),this._transformRule(Mt,this._transformDocumentSelector)}normalizeRootSelector(Mt){Mt.selector===':root'&&(Mt.selector='html')}_transformDocumentSelector(Mt){return Mt.match(Ve)?this._transformComplexSelector(Mt,je):this._transformSimpleSelector(Mt.trim(),je)}}let Fe=/:(nth[-\w]+)\(([^)]+)\)/,je=`:not(.${He})`,qe=',',Be=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,Ke=/[[.:#*]/,Xe=':host',Ve='::slotted',Ge=/^(::slotted)/,Ye=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ze=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,$e=/(.*):dir\((?:(ltr|rtl))\)/,Ze=':';var tt=new Ue,rt={};const lt=Promise.resolve();class ot{static get(Mt){return Mt.__styleInfo}static set(Mt,Lt){return Mt.__styleInfo=Lt,Lt}static invalidate(Mt){rt[Mt]&&(rt[Mt]._applyShimInvalid=!0)}static startValidating(Mt){const Lt=rt[Mt];Lt._validating||(Lt._validating=!0,lt.then(()=>{Lt._applyShimInvalid=!1,Lt._validating=!1}))}constructor(Mt,Lt,wt,Ot,kt,Dt){this.styleRules=Mt||null,this.placeholder=Lt||null,this.ownStylePropertyNames=wt||[],this.overrideStyleProperties=null,this.elementName=Ot||'',this.cssBuild=Dt||'',this.typeExtension=kt||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const nt=window.Element.prototype,st=nt.matches||nt.matchesSelector||nt.mozMatchesSelector||nt.msMatchesSelector||nt.oMatchesSelector||nt.webkitMatchesSelector,it=navigator.userAgent.match('Trident'),pt='x-scope';class dt{get XSCOPE_NAME(){return pt}decorateStyles(Mt){let Lt=this,wt={},Ot=[],kt=0;ye(Mt,function(Ht){Lt.decorateRule(Ht),Ht.index=kt++,Lt.collectPropertiesInCssText(Ht.propertyInfo.cssText,wt)},function(Ut){Ot.push(Ut)}),Mt._keyframes=Ot;let Dt=[];for(let Ht in wt)Dt.push(Ht);return Dt}decorateRule(Mt){if(Mt.propertyInfo)return Mt.propertyInfo;let Lt={},wt={},Ot=this.collectProperties(Mt,wt);return Ot&&(Lt.properties=wt,Mt.rules=null),Lt.cssText=this.collectCssText(Mt),Mt.propertyInfo=Lt,Lt}collectProperties(Mt,Lt){let wt=Mt.propertyInfo;if(!wt){let Ot,kt=De.VAR_ASSIGN,Dt=Mt.parsedCssText,Ht,Ut;for(;Ot=kt.exec(Dt);)Ht=(Ot[2]||Ot[3]).trim(),('inherit'!==Ht||'unset'!==Ht)&&(Lt[Ot[1].trim()]=Ht),Ut=!0;return Ut}else if(wt.properties)return Object.assign(Lt,wt.properties),!0}collectCssText(Mt){return this.collectConsumingCssText(Mt.parsedCssText)}collectConsumingCssText(Mt){return Mt.replace(De.BRACKETED,'').replace(De.VAR_ASSIGN,'')}collectPropertiesInCssText(Mt,Lt){for(let wt,Ot;wt=De.VAR_CONSUMED.exec(Mt);)Ot=wt[1],':'!==wt[2]&&(Lt[Ot]=!0)}reify(Mt){let Lt=Object.getOwnPropertyNames(Mt);for(let Ot,wt=0;wt *'===Dt||'html'===Dt,Ut=0===Dt.indexOf(':host')&&!Ht;if('shady'===wt&&(Ht=Dt===kt+' > *.'+kt||-1!==Dt.indexOf('html'),Ut=!Ht&&0===Dt.indexOf(kt)),'shadow'===wt&&(Ht=':host > *'===Dt||'html'===Dt,Ut=Ut&&!Ht),Ht||Ut){let Ft=kt;Ut&&(Le&&!Lt.transformedSelector&&(Lt.transformedSelector=tt._transformRuleCss(Lt,tt._transformComplexSelector,tt._calcElementScope(Mt.is),kt)),Ft=Lt.transformedSelector||kt),Ot({selector:Ft,isHost:Ut,isRoot:Ht})}}}hostAndRootPropertiesForScope(Mt,Lt){let wt={},Ot={},kt=this,Dt=Lt&&Lt.__cssBuild;return ye(Lt,function(Ht){kt.whenHostOrRootRule(Mt,Ht,Dt,function(Ut){let Ft=Mt._element||Mt;st.call(Ft,Ut.selector)&&(Ut.isHost?kt.collectProperties(Ht,wt):kt.collectProperties(Ht,Ot))})},null,!0),{rootProps:Ot,hostProps:wt}}transformStyles(Mt,Lt,wt){let Ot=this,kt=tt._calcHostScope(Mt.is,Mt.extends),Dt=Mt.extends?'\\'+kt.slice(0,-1)+'\\]':kt,Ht=new RegExp(De.HOST_PREFIX+Dt+De.HOST_SUFFIX),Ut=ot.get(Mt).styleRules,Ft=this._elementKeyframeTransforms(Mt,Ut,wt);return tt.elementStyles(Mt,Ut,function(jt){Ot.applyProperties(jt,Lt),Le||ue(jt)||!jt.cssText||(Ot.applyKeyframeTransforms(jt,Ft),Ot._scopeSelector(jt,Ht,kt,wt))})}_elementKeyframeTransforms(Mt,Lt,wt){let Ot=Lt._keyframes,kt={};if(!Le&&Ot)for(let Dt=0,Ht=Ot[Dt];Dt=Ht._useCount&&Ht.parentNode&&Ht.parentNode.removeChild(Ht)),Le?Dt.customStyle?(Dt.customStyle.textContent=kt,Ot=Dt.customStyle):kt&&(Ot=he(kt,wt,Mt.shadowRoot,Dt.placeholder)):Ot?!Ot.parentNode&&fe(Ot,null,Dt.placeholder):kt&&(Ot=he(kt,wt,null,Dt.placeholder)),Ot&&(Ot._useCount=Ot._useCount||0,Dt.customStyle!=Ot&&Ot._useCount++,Dt.customStyle=Ot),it&&(Ot.textContent=Ot.textContent),Ot}applyCustomStyle(Mt,Lt){let wt=me(Mt),Ot=this;Mt.textContent=de(wt,function(kt){let Dt=kt.cssText=kt.parsedCssText;kt.propertyInfo&&kt.propertyInfo.cssText&&(Dt=se(Dt),kt.cssText=Ot.valueForProperties(Dt,Lt))})}}var ct=new dt;let mt={};const ut=window.customElements;if(ut&&!Le){const Mt=ut.define;ut.define=function(Lt,wt,Ot){return mt[Lt]=ge(Lt),Mt.call(ut,Lt,wt,Ot)}}let ht=De.MIXIN_MATCH,ft=De.VAR_ASSIGN,_t=/;\s*/m,gt=/^\s*(initial)|(inherit)\s*$/,St='_-_';class Ct{constructor(){this._map={}}set(Mt,Lt){Mt=Mt.trim(),this._map[Mt]={properties:Lt,dependants:{}}}get(Mt){return Mt=Mt.trim(),this._map[Mt]}}class bt{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new Ct,this._separator=St,this._boundProduceCssProperties=(Mt,Lt,wt,Ot)=>this._produceCssProperties(Mt,Lt,wt,Ot)}detectMixin(Mt){const Lt=ht.test(Mt)||ft.test(Mt);return ht.lastIndex=0,ft.lastIndex=0,Lt}transformStyle(Mt,Lt){let wt=me(Mt);return this.transformRules(wt,Lt),wt}transformRules(Mt,Lt){this._currentTemplate=rt[Lt],ye(Mt,wt=>{this.transformRule(wt)}),this._currentTemplate=null}transformRule(Mt){Mt.cssText=this.transformCssText(Mt.parsedCssText),':root'===Mt.selector&&(Mt.selector=':host > *')}transformCssText(Mt){return Mt=Mt.replace(ft,this._boundProduceCssProperties),this._consumeCssProperties(Mt)}_getInitialValueForProperty(Mt){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(Mt)}_consumeCssProperties(Mt){for(let Lt;Lt=ht.exec(Mt);){let wt=Lt[0],Ot=Lt[1],kt=Lt.index,Dt=kt+wt.indexOf('@apply'),Ht=kt+wt.length,Ut=Mt.slice(0,Dt),Ft=Mt.slice(Ht),jt=this._cssTextToMap(Ut),qt=this._atApplyToCssProperties(Ot,jt);Mt=[Ut,qt,Ft].join(''),ht.lastIndex=kt+qt.length}return Mt}_atApplyToCssProperties(Mt,Lt){Mt=Mt.replace(_t,'');let wt=[],Ot=this._map.get(Mt);if(Ot||(this._map.set(Mt,{}),Ot=this._map.get(Mt)),Ot){this._currentTemplate&&(Ot.dependants[this._currentTemplate.name]=this._currentTemplate);let kt,Dt,Ht;for(kt in Ot.properties)Ht=Lt&&Lt[kt],Dt=[kt,': var(',Mt,St,kt],Ht&&Dt.push(',',Ht),Dt.push(')'),wt.push(Dt.join(''))}return wt.join('; ')}_replaceInitialOrInherit(Mt,Lt){let wt=gt.exec(Lt);return wt&&(wt[1]?Lt=bt._getInitialValueForProperty(Mt):Lt='apply-shim-inherit'),Lt}_cssTextToMap(Mt){let Lt=Mt.split(';'),wt,Ot,kt={};for(let Ht,Ut,Dt=0;Dt{Vt&&this._map.get(Vt)&&(Ot='@apply '+Vt+';')}),!Ot)return Mt;let kt=this._consumeCssProperties(Ot),Dt=Mt.slice(0,Mt.indexOf('--')),Ht=this._cssTextToMap(kt),Ut=Ht,Ft=this._map.get(Lt),jt=Ft&&Ft.properties;jt?Ut=Object.assign(Object.create(jt),Ht):this._map.set(Lt,Ut);let Bt,Kt,qt=[],Xt=!1;for(Bt in Ut)Kt=Ht[Bt],void 0==Kt&&(Kt='initial'),jt&&!(Bt in jt)&&(Xt=!0),qt.push(Lt+St+Bt+': '+Kt);return Xt&&this._invalidateMixinEntry(Ft),Ft&&(Ft.properties=Ut),wt&&(Dt=Mt+';'+Dt),Dt+qt.join('; ')+';'}}let Et=new bt;window.ApplyShim=Et;let Nt=function(){};if(!Le){let Mt=Dt=>{return Dt.classList&&!Dt.classList.contains(tt.SCOPE_NAME)||Dt instanceof SVGElement&&(!Dt.hasAttribute('class')||0>Dt.getAttribute('class').indexOf(tt.SCOPE_NAME))},Lt=Dt=>{for(let Ut,Ht=0;Ht{wt.observe(Dt,{childList:!0,subtree:!0})},kt=window.customElements&&!window.customElements.flush;if(kt)Ot(document);else{let Dt=()=>{Ot(document.body)};window.HTMLImports?window.HTMLImports.whenReady(Dt):requestAnimationFrame(function(){if('loading'===document.readyState){let Ht=function(){Dt(),document.removeEventListener('readystatechange',Ht)};document.addEventListener('readystatechange',Ht)}else Dt()})}Nt=function(){Lt(wt.takeRecords())}}let At=new class{constructor(Mt=100){this.cache={},this.typeMax=Mt}_validate(Mt,Lt,wt){for(let kt,Ot=0;Otthis.typeMax&&kt.shift(),this.cache[Mt]=kt}fetch(Mt,Lt,wt){let Ot=this.cache[Mt];if(Ot)for(let Dt,kt=Ot.length-1;0<=kt;kt--)if(Dt=Ot[kt],this._validate(Dt,Lt,wt))return Dt}};class vt{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=ot.set(document.documentElement,new ot({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return Le}get nativeCss(){return we}get nativeCssApply(){return!1}flush(){Nt()}_generateScopeSelector(Mt){let Lt=this._scopeCounter[Mt]=(this._scopeCounter[Mt]||0)+1;return`${Mt}-${Lt}`}getStyleAst(Mt){return me(Mt)}styleAstToString(Mt){return de(Mt)}_gatherStyles(Mt){let Lt=Mt.content.querySelectorAll('style'),wt=[];for(let kt,Ot=0;Ot{Le?tt.normalizeRootSelector(wt):tt.documentRule(wt),this.nativeCss&&!this.nativeCssApply&&Et.transformRule(wt)}),this.nativeCss?Mt.textContent=de(Lt):this._documentOwnerStyleInfo.styleRules.rules.push(Lt)}_revalidateApplyShim(Mt){if(this.nativeCss&&!this.nativeCssApply){let Lt=me(Mt);Et.transformRules(Lt),Mt.textContent=de(Lt)}}_applyCustomStyleToDocument(Mt){this.nativeCss||ct.applyCustomStyle(Mt,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(Mt,Lt){let wt;if(!this.nativeCss){let Ot=ot.get(Mt)||ot.get(this._styleOwnerForNode(Mt));wt=Ot.styleProperties[Lt]}return wt=wt||window.getComputedStyle(Mt).getPropertyValue(Lt),wt.trim()}setElementClass(Mt,Lt){let wt=Mt.getRootNode(),Ot=Lt?Lt.split(/\s/):[],kt=wt.host&&wt.host.localName;if(!kt){var Dt=Mt.getAttribute('class');if(Dt){let Ht=Dt.split(/\s/);for(let Ut=0;Ut{return or.nodeType===Node.ELEMENT_NODE&&zt.call(or,qt)},Zt=or=>{return or.__loadPromise||(or.__loadPromise=new Promise(nr=>{'script'!==or.localName||or.src?jt&&'style'===or.localName?or.addEventListener('load',nr):(or.addEventListener('load',nr),or.addEventListener('error',nr)):nr()}).then(()=>{return or.__loaded=!0,or})),or.__loadPromise},Qt=or=>{er(()=>tr(()=>or&&or()))},er=or=>{if('loading'!==document.readyState)or();else{const nr=()=>{'loading'!==document.readyState&&(document.removeEventListener('readystatechange',nr),or())};document.addEventListener('readystatechange',nr)}},tr=or=>{let nr=document.querySelectorAll(Vt);const sr=[];for(let pr,ar=0,ir=nr.length;ar{if(Ot)return or.ownerDocument;let nr=or.__ownerImport;if(!nr){for(nr=or;(nr=nr.parentNode||nr.host)&&!Jt(nr););or.__ownerImport=nr}return nr};let lr;if(window.customElements?lr=window.customElements.polyfillFlushCallback:window.customElements={},window.customElements.polyfillFlushCallback=lr?or=>Qt(()=>lr(or)):Qt,Ot){const or=document.querySelectorAll(qt);for(let ir,sr=0,ar=or.length;sr{const ar=sr.target;Jt(ar)&&(ar.__loaded=!0)};document.addEventListener('load',nr,!0),document.addEventListener('error',nr,!0)}else new class{constructor(){this.documents={},this.inflight=0,er(()=>{new MutationObserver(or=>this.handleMutations(or)).observe(document.head,{childList:!0,subtree:!0}),this.load()})}load(or){const nr=or?this.whenImportLoaded(or):this.whenImportsLoaded(document);nr&&(this.inflight++,nr.then(()=>{0==--this.inflight&&this.onLoadedAll()}))}whenImportsLoaded(or){const nr=or.querySelectorAll(qt),sr=[];for(let ar=0,ir=nr.length;aror):null}whenImportLoaded(or){const nr=or.href;return void 0===this.documents[nr]?(this.documents[nr]='pending',Ft.load(nr).then(sr=>{const ar=this.makeDocument(sr.resource,sr.redirectedUrl||nr);return this.documents[nr]=ar,this.whenImportsLoaded(ar)},()=>this.documents[nr]=null).then(()=>or)):null}makeDocument(or,nr){if(!or)return document.createDocumentFragment();jt&&(or=or.replace(Ht,(mr,ur,yr)=>{return-1===mr.indexOf('type=')?`${ur} type=${Bt} ${yr}`:mr}));let sr;const ar=document.createElement('template');if(ar.innerHTML=or,ar.content)sr=ar.content;else for(sr=document.createDocumentFragment();ar.firstElementChild;)sr.appendChild(ar.firstElementChild);const ir=sr.querySelector('base');ir&&(nr=Ut.replaceAttrUrl(ir.getAttribute('href'),nr),ir.removeAttribute('href'));const pr=sr.querySelectorAll('dom-module');for(let ur,mr=0;mrthis.fireEvents())}flatten(or){const nr=or.querySelectorAll(qt);for(let ir,sr=0,ar=nr.length;sr{const pr=document.createElement('script');ir.removeAttribute(Wt);for(let dr=0,cr=ir.attributes.length;drLt=null)});return nr}waitForStyles(){const or=!!document.querySelector(Kt),nr=document.querySelectorAll(Yt),sr=[];for(let pr,ar=0,ir=nr.length;arpr.removeAttribute(Wt))),or&&pr.parentNode!==document.head){let dr=rr(pr);for(;dr&&rr(dr);)dr=rr(dr);const cr=pr.parentNode,mr=pr.nextSibling,ur=document.createElement(pr.localName);ur.__appliedElement=pr,ur.setAttribute('type','import-placeholder'),dr.parentNode===document.head?document.head.insertBefore(pr,dr):document.head.appendChild(pr),cr.insertBefore(ur,mr),pr.removeAttribute('type')}return Promise.all(sr)}fireEvents(){const or=document.querySelectorAll(qt);for(let sr,nr=or.length-1;0<=nr&&(sr=or[nr]);nr--)this.fireEventIfNeeded(sr)}fireEventIfNeeded(or){if(!or.__loaded){or.__loaded=!0,or.import&&(or.import.readyState='complete');const nr=or.import?'load':'error';or.dispatchEvent(new CustomEvent(nr,{bubbles:!1,cancelable:!1,detail:void 0}))}}handleMutations(or){for(let nr=0;nrdocument.dispatchEvent(new CustomEvent('HTMLImportsLoaded',{cancelable:!0,bubbles:!0,detail:void 0}))),Mt.useNative=Ot,Mt.whenReady=Qt,Mt.importForElement=rr})(window.HTMLImports=window.HTMLImports||{}),function(){'use strict';function Mt(kr){var Dr=rr.has(kr);return kr=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(kr),!Dr&&kr}function Ot(kr){var Dr=kr.isConnected;if(void 0!==Dr)return Dr;for(;kr&&!(kr.__CE_isImportDocument||kr instanceof Document);)kr=kr.parentNode||(ShadowRoot&&kr instanceof ShadowRoot?kr.host:void 0);return kr&&(kr.__CE_isImportDocument||kr instanceof Document)}function Lt(kr,Dr){for(;Dr&&Dr!==kr&&!Dr.nextSibling;)Dr=Dr.parentNode;return Dr&&Dr!==kr?Dr.nextSibling:null}function wt(kr,Dr,Hr){Hr=Hr?Hr:new Set;for(var Ur=kr;Ur;){if(Ur.nodeType===Node.ELEMENT_NODE){var Fr=Ur;Dr(Fr);var jr=Fr.localName;if('link'===jr&&'import'===Fr.getAttribute('rel')){if(Ur=Fr.import,Ur instanceof Node&&!Hr.has(Ur))for(Hr.add(Ur),Ur=Ur.firstChild;Ur;Ur=Ur.nextSibling)wt(Ur,Dr,Hr);Ur=Lt(kr,Fr);continue}else if('template'===jr){Ur=Lt(kr,Fr);continue}if(Fr=Fr.__CE_shadowRoot)for(Fr=Fr.firstChild;Fr;Fr=Fr.nextSibling)wt(Fr,Dr,Hr)}Ur=Ur.firstChild?Ur.firstChild:Lt(kr,Ur)}}function kt(kr,Dr,Hr){kr[Dr]=Hr}function Dt(){this.a=new Map,this.f=new Map,this.c=[],this.b=!1}function Ht(kr,Dr,Hr){kr.a.set(Dr,Hr),kr.f.set(Hr.constructor,Hr)}function Ut(kr,Dr){kr.b=!0,kr.c.push(Dr)}function Ft(kr,Dr){kr.b&&wt(Dr,function(Hr){return jt(kr,Hr)})}function jt(kr,Dr){if(kr.b&&!Dr.__CE_patched){Dr.__CE_patched=!0;for(var Hr=0;Hr+~])'};const He='style-scope';class Ue{get SCOPE_NAME(){return He}dom(Mt,Ot,Lt){Mt.__styleScoped?Mt.__styleScoped=null:this._transformDom(Mt,Ot||'',Lt)}_transformDom(Mt,Ot,Lt){Mt.nodeType===Node.ELEMENT_NODE&&this.element(Mt,Ot,Lt);let wt='template'===Mt.localName?(Mt.content||Mt._content).childNodes:Mt.children||Mt.childNodes;if(wt)for(let kt=0;kt`:${Dt}(${Ht.replace(/\s/g,'')})`),Mt=Mt.replace(Ge,`${Xe} $1`),Mt=Mt.replace(Be,(kt,Dt,Ht)=>{if(!wt){let Ut=this._transformCompoundSelector(Ht,Dt,Ot,Lt);wt=wt||Ut.stop,Dt=Ut.combinator,Ht=Ut.value}return Dt+Ht}),Mt}_transformCompoundSelector(Mt,Ot,Lt,wt){let kt=Mt.indexOf(Ve);0<=Mt.indexOf(Xe)?Mt=this._transformHostSelector(Mt,wt):0!==kt&&(Mt=Lt?this._transformSimpleSelector(Mt,Lt):Mt);let Dt=!1;0<=kt&&(Ot='',Dt=!0);let Ht;return Dt&&(Ht=!0,Dt&&(Mt=Mt.replace(ze,(Ut,Ft)=>` > ${Ft}`))),Mt=Mt.replace($e,(Ut,Ft,jt)=>`[dir="${jt}"] ${Ft}, ${Ft}[dir="${jt}"]`),{value:Mt,combinator:Ot,stop:Ht}}_transformSimpleSelector(Mt,Ot){let Lt=Mt.split(Ze);return Lt[0]+=Ot,Lt.join(Ze)}_transformHostSelector(Mt,Ot){let Lt=Mt.match(Ye),wt=Lt&&Lt[2].trim()||'';if(wt){if(!wt[0].match(Ke)){let kt=wt.split(Ke)[0];return kt===Ot?wt:'should_not_match'}return Mt.replace(Ye,function(kt,Dt,Ht){return Ot+Ht})}return Mt.replace(Xe,Ot)}documentRule(Mt){Mt.selector=Mt.parsedSelector,this.normalizeRootSelector(Mt),this._transformRule(Mt,this._transformDocumentSelector)}normalizeRootSelector(Mt){Mt.selector===':root'&&(Mt.selector='html')}_transformDocumentSelector(Mt){return Mt.match(Ve)?this._transformComplexSelector(Mt,je):this._transformSimpleSelector(Mt.trim(),je)}}let Fe=/:(nth[-\w]+)\(([^)]+)\)/,je=`:not(.${He})`,qe=',',Be=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,Ke=/[[.:#*]/,Xe=':host',Ve='::slotted',Ge=/^(::slotted)/,Ye=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ze=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,$e=/(.*):dir\((?:(ltr|rtl))\)/,Ze=':';var tt=new Ue,rt={};const lt=Promise.resolve();class ot{static get(Mt){return Mt.__styleInfo}static set(Mt,Ot){return Mt.__styleInfo=Ot,Ot}static invalidate(Mt){rt[Mt]&&(rt[Mt]._applyShimInvalid=!0)}static startValidating(Mt){const Ot=rt[Mt];Ot._validating||(Ot._validating=!0,lt.then(()=>{Ot._applyShimInvalid=!1,Ot._validating=!1}))}constructor(Mt,Ot,Lt,wt,kt,Dt){this.styleRules=Mt||null,this.placeholder=Ot||null,this.ownStylePropertyNames=Lt||[],this.overrideStyleProperties=null,this.elementName=wt||'',this.cssBuild=Dt||'',this.typeExtension=kt||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const nt=window.Element.prototype,st=nt.matches||nt.matchesSelector||nt.mozMatchesSelector||nt.msMatchesSelector||nt.oMatchesSelector||nt.webkitMatchesSelector,it=navigator.userAgent.match('Trident'),pt='x-scope';class dt{get XSCOPE_NAME(){return pt}decorateStyles(Mt){let Ot=this,Lt={},wt=[],kt=0;ye(Mt,function(Ht){Ot.decorateRule(Ht),Ht.index=kt++,Ot.collectPropertiesInCssText(Ht.propertyInfo.cssText,Lt)},function(Ut){wt.push(Ut)}),Mt._keyframes=wt;let Dt=[];for(let Ht in Lt)Dt.push(Ht);return Dt}decorateRule(Mt){if(Mt.propertyInfo)return Mt.propertyInfo;let Ot={},Lt={},wt=this.collectProperties(Mt,Lt);return wt&&(Ot.properties=Lt,Mt.rules=null),Ot.cssText=this.collectCssText(Mt),Mt.propertyInfo=Ot,Ot}collectProperties(Mt,Ot){let Lt=Mt.propertyInfo;if(!Lt){let wt,kt=De.VAR_ASSIGN,Dt=Mt.parsedCssText,Ht,Ut;for(;wt=kt.exec(Dt);)Ht=(wt[2]||wt[3]).trim(),('inherit'!==Ht||'unset'!==Ht)&&(Ot[wt[1].trim()]=Ht),Ut=!0;return Ut}else if(Lt.properties)return Object.assign(Ot,Lt.properties),!0}collectCssText(Mt){return this.collectConsumingCssText(Mt.parsedCssText)}collectConsumingCssText(Mt){return Mt.replace(De.BRACKETED,'').replace(De.VAR_ASSIGN,'')}collectPropertiesInCssText(Mt,Ot){for(let Lt,wt;Lt=De.VAR_CONSUMED.exec(Mt);)wt=Lt[1],':'!==Lt[2]&&(Ot[wt]=!0)}reify(Mt){let Ot=Object.getOwnPropertyNames(Mt);for(let wt,Lt=0;Lt *'===Dt||'html'===Dt,Ut=0===Dt.indexOf(':host')&&!Ht;if('shady'===Lt&&(Ht=Dt===kt+' > *.'+kt||-1!==Dt.indexOf('html'),Ut=!Ht&&0===Dt.indexOf(kt)),'shadow'===Lt&&(Ht=':host > *'===Dt||'html'===Dt,Ut=Ut&&!Ht),Ht||Ut){let Ft=kt;Ut&&(Oe&&!Ot.transformedSelector&&(Ot.transformedSelector=tt._transformRuleCss(Ot,tt._transformComplexSelector,tt._calcElementScope(Mt.is),kt)),Ft=Ot.transformedSelector||kt),wt({selector:Ft,isHost:Ut,isRoot:Ht})}}}hostAndRootPropertiesForScope(Mt,Ot){let Lt={},wt={},kt=this,Dt=Ot&&Ot.__cssBuild;return ye(Ot,function(Ht){kt.whenHostOrRootRule(Mt,Ht,Dt,function(Ut){let Ft=Mt._element||Mt;st.call(Ft,Ut.selector)&&(Ut.isHost?kt.collectProperties(Ht,Lt):kt.collectProperties(Ht,wt))})},null,!0),{rootProps:wt,hostProps:Lt}}transformStyles(Mt,Ot,Lt){let wt=this,kt=tt._calcHostScope(Mt.is,Mt.extends),Dt=Mt.extends?'\\'+kt.slice(0,-1)+'\\]':kt,Ht=new RegExp(De.HOST_PREFIX+Dt+De.HOST_SUFFIX),Ut=ot.get(Mt).styleRules,Ft=this._elementKeyframeTransforms(Mt,Ut,Lt);return tt.elementStyles(Mt,Ut,function(jt){wt.applyProperties(jt,Ot),Oe||ue(jt)||!jt.cssText||(wt.applyKeyframeTransforms(jt,Ft),wt._scopeSelector(jt,Ht,kt,Lt))})}_elementKeyframeTransforms(Mt,Ot,Lt){let wt=Ot._keyframes,kt={};if(!Oe&&wt)for(let Dt=0,Ht=wt[Dt];Dt=Ht._useCount&&Ht.parentNode&&Ht.parentNode.removeChild(Ht)),Oe?Dt.customStyle?(Dt.customStyle.textContent=kt,wt=Dt.customStyle):kt&&(wt=he(kt,Lt,Mt.shadowRoot,Dt.placeholder)):wt?!wt.parentNode&&fe(wt,null,Dt.placeholder):kt&&(wt=he(kt,Lt,null,Dt.placeholder)),wt&&(wt._useCount=wt._useCount||0,Dt.customStyle!=wt&&wt._useCount++,Dt.customStyle=wt),it&&(wt.textContent=wt.textContent),wt}applyCustomStyle(Mt,Ot){let Lt=me(Mt),wt=this;Mt.textContent=de(Lt,function(kt){let Dt=kt.cssText=kt.parsedCssText;kt.propertyInfo&&kt.propertyInfo.cssText&&(Dt=se(Dt),kt.cssText=wt.valueForProperties(Dt,Ot))})}}var ct=new dt;let mt={};const ut=window.customElements;if(ut&&!Oe){const Mt=ut.define;ut.define=function(Ot,Lt,wt){return mt[Ot]=ge(Ot),Mt.call(ut,Ot,Lt,wt)}}let ht=De.MIXIN_MATCH,ft=De.VAR_ASSIGN,_t=/;\s*/m,gt=/^\s*(initial)|(inherit)\s*$/,St='_-_';class Ct{constructor(){this._map={}}set(Mt,Ot){Mt=Mt.trim(),this._map[Mt]={properties:Ot,dependants:{}}}get(Mt){return Mt=Mt.trim(),this._map[Mt]}}class bt{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new Ct,this._separator=St,this._boundProduceCssProperties=(Mt,Ot,Lt,wt)=>this._produceCssProperties(Mt,Ot,Lt,wt)}detectMixin(Mt){const Ot=ht.test(Mt)||ft.test(Mt);return ht.lastIndex=0,ft.lastIndex=0,Ot}transformStyle(Mt,Ot){let Lt=me(Mt);return this.transformRules(Lt,Ot),Lt}transformRules(Mt,Ot){this._currentTemplate=rt[Ot],ye(Mt,Lt=>{this.transformRule(Lt)}),this._currentTemplate=null}transformRule(Mt){Mt.cssText=this.transformCssText(Mt.parsedCssText),':root'===Mt.selector&&(Mt.selector=':host > *')}transformCssText(Mt){return Mt=Mt.replace(ft,this._boundProduceCssProperties),this._consumeCssProperties(Mt)}_getInitialValueForProperty(Mt){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(Mt)}_consumeCssProperties(Mt){for(let Ot;Ot=ht.exec(Mt);){let Lt=Ot[0],wt=Ot[1],kt=Ot.index,Dt=kt+Lt.indexOf('@apply'),Ht=kt+Lt.length,Ut=Mt.slice(0,Dt),Ft=Mt.slice(Ht),jt=this._cssTextToMap(Ut),qt=this._atApplyToCssProperties(wt,jt);Mt=[Ut,qt,Ft].join(''),ht.lastIndex=kt+qt.length}return Mt}_atApplyToCssProperties(Mt,Ot){Mt=Mt.replace(_t,'');let Lt=[],wt=this._map.get(Mt);if(wt||(this._map.set(Mt,{}),wt=this._map.get(Mt)),wt){this._currentTemplate&&(wt.dependants[this._currentTemplate.name]=this._currentTemplate);let kt,Dt,Ht;for(kt in wt.properties)Ht=Ot&&Ot[kt],Dt=[kt,': var(',Mt,St,kt],Ht&&Dt.push(',',Ht),Dt.push(')'),Lt.push(Dt.join(''))}return Lt.join('; ')}_replaceInitialOrInherit(Mt,Ot){let Lt=gt.exec(Ot);return Lt&&(Lt[1]?Ot=bt._getInitialValueForProperty(Mt):Ot='apply-shim-inherit'),Ot}_cssTextToMap(Mt){let Ot=Mt.split(';'),Lt,wt,kt={};for(let Ht,Ut,Dt=0;Dt{Vt&&this._map.get(Vt)&&(wt='@apply '+Vt+';')}),!wt)return Mt;let kt=this._consumeCssProperties(wt),Dt=Mt.slice(0,Mt.indexOf('--')),Ht=this._cssTextToMap(kt),Ut=Ht,Ft=this._map.get(Ot),jt=Ft&&Ft.properties;jt?Ut=Object.assign(Object.create(jt),Ht):this._map.set(Ot,Ut);let Bt,Kt,qt=[],Xt=!1;for(Bt in Ut)Kt=Ht[Bt],void 0==Kt&&(Kt='initial'),jt&&!(Bt in jt)&&(Xt=!0),qt.push(Ot+St+Bt+': '+Kt);return Xt&&this._invalidateMixinEntry(Ft),Ft&&(Ft.properties=Ut),Lt&&(Dt=Mt+';'+Dt),Dt+qt.join('; ')+';'}}let Et=new bt;window.ApplyShim=Et;let Nt=function(){};if(!Oe){let Mt=Dt=>{return Dt.classList&&!Dt.classList.contains(tt.SCOPE_NAME)||Dt instanceof SVGElement&&(!Dt.hasAttribute('class')||0>Dt.getAttribute('class').indexOf(tt.SCOPE_NAME))},Ot=Dt=>{for(let Ut,Ht=0;Ht{Lt.observe(Dt,{childList:!0,subtree:!0})},kt=window.customElements&&!window.customElements.flush;if(kt)wt(document);else{let Dt=()=>{wt(document.body)};window.HTMLImports?window.HTMLImports.whenReady(Dt):requestAnimationFrame(function(){if('loading'===document.readyState){let Ht=function(){Dt(),document.removeEventListener('readystatechange',Ht)};document.addEventListener('readystatechange',Ht)}else Dt()})}Nt=function(){Ot(Lt.takeRecords())}}let At=new class{constructor(Mt=100){this.cache={},this.typeMax=Mt}_validate(Mt,Ot,Lt){for(let kt,wt=0;wtthis.typeMax&&kt.shift(),this.cache[Mt]=kt}fetch(Mt,Ot,Lt){let wt=this.cache[Mt];if(wt)for(let Dt,kt=wt.length-1;0<=kt;kt--)if(Dt=wt[kt],this._validate(Dt,Ot,Lt))return Dt}};class vt{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=ot.set(document.documentElement,new ot({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return Oe}get nativeCss(){return Le}get nativeCssApply(){return!1}flush(){Nt()}_generateScopeSelector(Mt){let Ot=this._scopeCounter[Mt]=(this._scopeCounter[Mt]||0)+1;return`${Mt}-${Ot}`}getStyleAst(Mt){return me(Mt)}styleAstToString(Mt){return de(Mt)}_gatherStyles(Mt){let Ot=Mt.content.querySelectorAll('style'),Lt=[];for(let kt,wt=0;wt{Oe?tt.normalizeRootSelector(Lt):tt.documentRule(Lt),this.nativeCss&&!this.nativeCssApply&&Et.transformRule(Lt)}),this.nativeCss?Mt.textContent=de(Ot):this._documentOwnerStyleInfo.styleRules.rules.push(Ot)}_revalidateApplyShim(Mt){if(this.nativeCss&&!this.nativeCssApply){let Ot=me(Mt);Et.transformRules(Ot),Mt.textContent=de(Ot)}}_applyCustomStyleToDocument(Mt){this.nativeCss||ct.applyCustomStyle(Mt,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(Mt,Ot){let Lt;if(!this.nativeCss){let wt=ot.get(Mt)||ot.get(this._styleOwnerForNode(Mt));Lt=wt.styleProperties[Ot]}return Lt=Lt||window.getComputedStyle(Mt).getPropertyValue(Ot),Lt.trim()}setElementClass(Mt,Ot){let Lt=Mt.getRootNode(),wt=Ot?Ot.split(/\s/):[],kt=Lt.host&&Lt.host.localName;if(!kt){var Dt=Mt.getAttribute('class');if(Dt){let Ht=Dt.split(/\s/);for(let Ut=0;Ut {\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', () => {\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 === 304 || request.status === 0 ||\n request.status >= 200 && request.status < 300) {\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 }, () => this.documents[url] = null) // If load fails, handle error.\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 //