mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
3 lines
34 KiB
JavaScript
3 lines
34 KiB
JavaScript
(function(){'use strict';function d(we){return we=y(we),_(h(we),we)}function y(we){return we.replace(B.comments,'').replace(B.port,'')}function h(we){let Ue={start:0,end:we.length},De=Ue;for(let ke=0,He=we.length;ke<He;ke++)if(we[ke]===q){De.rules||(De.rules=[]);let Fe=De,je=Fe.rules[Fe.rules.length-1];De={start:ke+1,parent:Fe,previous:je},Fe.rules.push(De)}else we[ke]===K&&(De.end=ke+1,De=De.parent||Ue);return Ue}function _(we,Ue){let De=Ue.substring(we.start,we.end-1);if(we.parsedCssText=we.cssText=De.trim(),we.parent){let He=we.previous?we.previous.end:we.parent.start;De=Ue.substring(He,we.start-1),De=S(De),De=De.replace(B.multipleSpaces,' '),De=De.substring(De.lastIndexOf(';')+1);let Fe=we.parsedSelector=we.selector=De.trim();we.atRule=0===Fe.indexOf('@'),we.atRule?0===Fe.indexOf('@media')?we.type=F.MEDIA_RULE:Fe.match(B.keyframesRule)&&(we.type=F.KEYFRAMES_RULE,we.keyframesName=we.selector.split(B.multipleSpaces).pop()):0===Fe.indexOf(X)?we.type=F.MIXIN_RULE:we.type=F.STYLE_RULE}let ke=we.rules;if(ke)for(let je,He=0,Fe=ke.length;He<Fe&&(je=ke[He]);He++)_(je,Ue);return we}function S(we){return we.replace(/\\([0-9a-f]{1,6})\s/gi,function(){let Ue=arguments[1],De=6-Ue.length;for(;De--;)Ue='0'+Ue;return'\\'+Ue})}function g(we,Ue,De){De=De||'';let ke='';if(we.cssText||we.rules){let He=we.rules;if(He&&!C(He))for(let qe,Fe=0,je=He.length;Fe<je&&(qe=He[Fe]);Fe++)ke=g(qe,Ue,ke);else ke=Ue?we.cssText:A(we.cssText),ke=ke.trim(),ke&&(ke=' '+ke+'\n')}return ke&&(we.selector&&(De+=we.selector+' '+q+'\n'),De+=ke,we.selector&&(De+=K+'\n\n')),De}function C(we){return 0===we[0].selector.indexOf(X)}function A(we){return we=E(we),N(we)}function E(we){return we.replace(B.customProp,'').replace(B.mixinProp,'')}function N(we){return we.replace(B.mixinApply,'').replace(B.varApply,'')}function T(we){we&&(W=W&&!we.shimcssproperties,V=V&&!we.shimshadow)}function b(we,Ue){return'string'==typeof we&&(we=d(we)),Ue&&P(we,Ue),g(we,W)}function R(we){return!we.__cssRules&&we.textContent&&(we.__cssRules=d(we.textContent)),we.__cssRules}function I(we){return we.parent&&we.parent.type===F.KEYFRAMES_RULE}function P(we,Ue,De,ke){if(we){let He=!1;if(ke&&we.type===F.MEDIA_RULE){let je=we.selector.match(z.MEDIA_MATCH);je&&!window.matchMedia(je[1]).matches&&(He=!0)}we.type===F.STYLE_RULE?Ue(we):De&&we.type===F.KEYFRAMES_RULE?De(we):we.type===F.MIXIN_RULE&&(He=!0);let Fe=we.rules;if(Fe&&!He)for(let Ke,je=0,qe=Fe.length;je<qe&&(Ke=Fe[je]);je++)P(Ke,Ue,De,ke)}}function M(we,Ue,De,ke){let He=L(we,Ue);return O(He,De,ke)}function O(we,Ue,De){Ue=Ue||document.head;let ke=De&&De.nextSibling||Ue.firstChild;return G=we,Ue.insertBefore(we,ke)}function L(we,Ue){let De=document.createElement('style');return Ue&&De.setAttribute('scope',Ue),De.textContent=we,De}function w(we){let Ue=document.createComment(' Shady DOM styles for '+we+' '),De=G?G.nextSibling:null,ke=document.head;return ke.insertBefore(Ue,De||ke.firstChild),G=Ue,Ue}function U(we,Ue){let De=0;for(let ke=Ue,He=we.length;ke<He;ke++)if('('===we[ke])De++;else if(')'===we[ke]&&0==--De)return ke;return-1}function D(we,Ue){let De=we.indexOf('var(');if(-1===De)return Ue(we,'','','');let ke=U(we,De+3),He=we.substring(De+4,ke),Fe=we.substring(0,De),je=D(we.substring(ke+1),Ue),qe=He.indexOf(',');if(-1===qe)return Ue(Fe,He.trim(),'',je);let Ke=He.substring(0,qe).trim(),Be=He.substring(qe+1).trim();return Ue(Fe,Ke,Be,je)}function k(we,Ue){window.ShadyDOM?window.ShadyDOM.nativeMethods.setAttribute.call(we,'class',Ue):we.setAttribute('class',Ue)}function H(we,Ue){let De=parseInt(we/32);Ue[De]=(Ue[De]||0)|1<<we%32}(function(we){function Ue(ht){return ht.nodeType===Node.ELEMENT_NODE&&ct.call(ht,Je)}function De(ht,_t){mt.forEach(St=>{const gt=ht.attributes[St],Ct=gt&>.value;Ct&&0>Ct.search(/({{|\[\[)/)&&(gt.value='style'===St?nt.resolveUrlsInCssText(Ct,_t):nt.replaceAttrUrl(Ct,_t))})}function ke(ht,_t){const St=ht.content;if(St){const gt=St.querySelectorAll('style, form[action], [src], [href], [url], [style]');for(let Ct=0;Ct<gt.length;Ct++){const xt=gt[Ct];'style'==xt.localName?nt.resolveUrlsInStyle(xt,_t):De(xt,_t)}He(St,_t)}}function He(ht,_t){const St=ht.querySelectorAll('template');for(let gt=0;gt<St.length;gt++)ke(St[gt],_t)}function Fe(ht,_t){const St=ht.querySelectorAll(dt);for(let xt,gt=0,Ct=St.length;gt<Ct&&(xt=St[gt]);gt++)Ve(xt),xt.href&&xt.setAttribute('href',nt.replaceAttrUrl(xt.getAttribute('href'),_t)),xt.src&&xt.setAttribute('src',nt.replaceAttrUrl(xt.getAttribute('src'),_t)),'style'==xt.localName?nt.resolveUrlsInStyle(xt,_t):'script'===xt.localName&&(xt.textContent&&(xt.textContent+=`\n//# sourceURL=${_t}`),xt.setAttribute('type',ut));He(ht,_t)}function je(ht,_t){const St=ht.querySelectorAll('dom-module');for(let gt=0;gt<St.length;gt++){const Ct=St[gt],xt=Ct.getAttribute('assetpath')||'';Ct.setAttribute('assetpath',nt.replaceAttrUrl(xt,_t))}}function qe(ht){const _t=ht.querySelectorAll(`script[type=${ut}]`);let St=Promise.resolve();for(let xt,gt=0,Ct=_t.length;gt<Ct&&(xt=_t[gt]);gt++)St=St.then(()=>{const At=ht.createElement('script');At.textContent=xt.textContent,xt.src&&At.setAttribute('src',xt.getAttribute('src'));const vt=Ve(At).catch(()=>At);return et=At,xt.parentNode.replaceChild(At,xt),vt.then(Et=>{Et===et&&(et=null)})});return St}function Ke(ht){const _t=ht.querySelectorAll(pt),St=[];for(let xt,gt=0,Ct=_t.length;gt<Ct&&(xt=_t[gt]);gt++)St.push(Ve(xt).catch(()=>xt));return Promise.all(St)}function Be(ht){const _t=ht.import.querySelectorAll(it);for(let Ct,St=0,gt=_t.length;St<gt&&(Ct=_t[St]);St++){const xt=document.createElement(Ct.localName);Ve(xt),xt.textContent=Ct.textContent;for(let At=0,vt=Ct.attributes.length;At<vt;At++)xt.setAttribute(Ct.attributes[At].name,Ct.attributes[At].value);Ct.parentNode.removeChild(Ct),ht.parentNode.insertBefore(xt,ht)}}function Xe(ht){const _t=ht.querySelectorAll(Je);for(let gt,St=_t.length-1;0<=St&&(gt=_t[St]);St--)if(!gt.__fired){gt.__fired=!0;const Ct=gt.import?'load':'error';Qe.log&&console.warn('fire',Ct,gt.href),Ve(gt),gt.dispatchEvent(new CustomEvent(Ct,{bubbles:!1,cancelable:!1,detail:void 0}))}}function Ve(ht){return ht.__loadPromise||(ht.__loadPromise=new Promise((_t,St)=>{We(ht)?_t(ht):(ht.addEventListener('load',()=>_t(ht)),ht.addEventListener('error',()=>St(ht)))})),ht.__loadPromise}function We(ht){let _t=!1;if(Ze&&Ue(ht)&&ht.import&&'loading'!==ht.import.readyState)_t=!0;else if(!(yt&&'style'===ht.localName))'script'!==ht.localName||ht.src||(_t=!0);else if(-1==ht.textContent.indexOf('@import'))_t=!0;else if(ht.sheet){_t=!0;const St=ht.sheet.cssRules;for(let gt=0,Ct=St?St.length:0;gt<Ct&&_t;gt++)St[gt].type===CSSRule.IMPORT_RULE&&(_t=!!St[gt].styleSheet)}return _t}function Ye(ht,_t){const St=document.createElement('import-content');return St.style.display='none',_t&&St.setAttribute('import-href',_t),ht&&(St.innerHTML=ht),je(St,_t),Fe(St,_t),St}function Ge(ht,_t){return _t=_t||document,ze(_t).then($e).then(St=>{return ht&&ht(St),St})}function ze(ht){return new Promise(_t=>{'loading'===ht.readyState?ht.addEventListener('readystatechange',()=>{'loading'!==ht.readyState&&_t(ht)}):_t(ht)})}function $e(ht){let _t=ht.querySelectorAll(Je);const St=[],gt={allImports:[],loadedImports:[],errorImports:[]};for(let At,Ct=0,xt=_t.length;Ct<xt&&(At=_t[Ct]);Ct++)ct.call(At,`${Je} ${Je}`)||(gt.allImports.push(At),St.push(Ve(At).then(vt=>{return gt.loadedImports.push(vt),vt}).catch(vt=>{return gt.errorImports.push(vt),vt})));return Promise.all(St).then(()=>gt)}const Je='link[rel=import]',Ze=!!('import'in document.createElement('link')),Qe={bust:!1,log:!1};let et=null;!1=='currentScript'in document&&Object.defineProperty(document,'currentScript',{get:function(){return et||('complete'===document.readyState?null:document.scripts[document.scripts.length-1])},configurable:!0});const tt=/(^\/)|(^#)|(^[\w-\d]*:)/,rt=/(url\()([^)]*)(\))/g,st=/(@import[\s]+(?!url\())([^;]*)(;)/g,nt={resolveUrlsInStyle:function(ht,_t){ht.textContent=nt.resolveUrlsInCssText(ht.textContent,_t)},resolveUrlsInCssText:function(ht,_t){let St=nt.replaceUrls(ht,_t,rt);return St=nt.replaceUrls(St,_t,st),St},replaceUrls:function(ht,_t,St){return ht.replace(St,function(gt,Ct,xt,At){let vt=xt.replace(/["']/g,'');return _t&&(vt=nt._resolveUrl(vt,_t)),Ct+'\''+vt+'\''+At})},replaceAttrUrl:function(ht,_t){return ht&&tt.test(ht)?ht:nt._resolveUrl(ht,_t)},_resolveUrl:function(ht,_t){if(void 0===nt.__workingURL){nt.__workingURL=!1;try{const gt=new URL('b','http://a');gt.pathname='c%20d',nt.__workingURL='http://a/c%20d'===gt.href}catch(gt){}}if(nt.__workingURL)return new URL(ht,_t).href;let St=nt.__tempDoc;return St||(St=document.implementation.createHTMLDocument('temp'),nt.__tempDoc=St,St.__base=St.createElement('base'),St.head.appendChild(St.__base),St.__anchor=St.createElement('a')),St.__base.href=_t,St.__anchor.href=ht,St.__anchor.href||ht}},ot={async:!0,load:function(ht,_t){const St=new XMLHttpRequest;return Qe.bust&&(ht+='?'+Math.random()),St.open('GET',ht,ot.async),St.addEventListener('readystatechange',()=>{if(4===St.readyState){let gt;try{const At=St.getResponseHeader('Location');At&&(gt='/'===At.substr(0,1)?location.origin+At:At)}catch(At){console.error(At.message)}const Ct=200<=St.status&&300>St.status||304===St.status||0===St.status,xt=St.response||St.responseText;_t(!Ct,xt,gt)}}),St.send(),St}};class lt{constructor(ht,_t){this.cache={},this.onload=ht,this.oncomplete=_t,this.inflight=0,this.pending={}}addNodes(ht){this.inflight+=ht.length;for(let gt,_t=0,St=ht.length;_t<St&&(gt=ht[_t]);_t++)this.require(gt);this.checkDone()}addNode(ht){this.inflight++,this.require(ht),this.checkDone()}require(ht){const _t=ht.src||ht.href;this.dedupe(_t,ht)||this.fetch(_t,ht)}dedupe(ht,_t){return this.pending[ht]?(this.pending[ht].push(_t),!0):this.cache[ht]?(this.onload(ht,_t,this.cache[ht]),this.tail(),!0):(this.pending[ht]=[_t],!1)}fetch(ht,_t){if(Qe.log&&console.log('fetch',ht,_t),!ht)this.receive(ht,_t,!0,'error: href must be specified');else if(ht.match(/^data:/)){const St=ht.split(','),gt=St[0];let Ct=St[1];Ct=-1<gt.indexOf(';base64')?atob(Ct):decodeURIComponent(Ct),this.receive(ht,_t,!1,Ct)}else ot.load(ht,(St,gt,Ct)=>this.receive(ht,_t,St,gt,Ct))}receive(ht,_t,St,gt,Ct){this.cache[ht]=gt;const xt=this.pending[ht];for(let Et,At=0,vt=xt.length;At<vt&&(Et=xt[At]);At++)this.onload(ht,Et,gt,St,Ct),this.tail();this.pending[ht]=null}tail(){--this.inflight,this.checkDone()}checkDone(){this.inflight||this.oncomplete()}}const it=['style:not([type])','link[rel=stylesheet][href]:not([type])'].join(','),pt=[`${Je} style:not([type])`,`${Je} link[rel=stylesheet][href]:not([type])`].join(','),dt=[Je,it,'script:not([type])','script[type="application/javascript"]','script[type="text/javascript"]'].join(','),ct=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,mt=['action','src','href','url','style'],ut='import-script',yt=/Trident/.test(navigator.userAgent),ft=!yt&&/Edge\/\d./i.test(navigator.userAgent);new class{constructor(_t){this.documents={},this._doc=_t;const St=_t.querySelectorAll(Je);for(let gt=0,Ct=St.length;gt<Ct;gt++)Ve(St[gt]);new MutationObserver(this._onMutation.bind(this)).observe(_t.head,{childList:!0}),Ze||(this._loader=new lt(this._onLoaded.bind(this),this._onLoadedAll.bind(this)),ze(_t).then(()=>this._loadSubtree(_t)))}_loadSubtree(_t){const St=_t.querySelectorAll(Je);this._loader.addNodes(St)}_onLoaded(_t,St,gt,Ct,xt){if(Qe.log&&console.log('loaded',_t,St),void 0===this.documents[_t])if(Ct)this.documents[_t]=null;else{const At=Ye(gt,xt||_t);this._loadSubtree(At),this.documents[_t]=At}}_onLoadedAll(){this._flatten(this._doc),Promise.all([qe(this._doc),Ke(this._doc)]).then(()=>Xe(this._doc))}_flatten(_t){const St=_t.querySelectorAll(Je);for(let xt,gt=0,Ct=St.length;gt<Ct&&(xt=St[gt]);gt++)xt.import=this.documents[xt.href],xt.import&&!xt.import.__firstImport&&(xt.import.__firstImport=xt,this._flatten(xt.import),_t===document&&((yt||ft)&&Be(xt),this._observe(xt.import)),xt.appendChild(xt.import))}_observe(_t){_t.__importObserver||(_t.__importObserver=new MutationObserver(this._onMutation.bind(this)),_t.__importObserver.observe(_t,{childList:!0,subtree:!0}))}_onMutation(_t){for(let gt,St=0;St<_t.length&&(gt=_t[St]);St++)for(let Ct=0,xt=gt.addedNodes?gt.addedNodes.length:0;Ct<xt;Ct++){const At=gt.addedNodes[Ct];At&&Ue(At)&&(Ze?Ve(At):this._loader.addNode(At))}}}(document),Ge(ht=>document.dispatchEvent(new CustomEvent('HTMLImportsLoaded',{cancelable:!0,bubbles:!0,detail:ht}))),we.useNative=Ze,we.whenReady=Ge})(window.HTMLImports=window.HTMLImports||{}),function(we){'use strict';var Ue=we.flags.shadydom;Ue&&(window.ShadyDOM=window.ShadyDOM||{},ShadyDOM.force=Ue);var De=we.flags.register||we.flags.ce;De&&window.customElements&&(customElements.forcePolyfill=De)}(window.WebComponents);let F={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},q='{',K='}',B={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},X='--',V=!(window.ShadyDOM&&window.ShadyDOM.inUse),W=!navigator.userAgent.match('AppleWebKit/601')&&window.CSS&&CSS.supports&&CSS.supports('box-shadow','0 0 0 var(--foo)'),Y=!1;window.ShadyCSS?T(window.ShadyCSS):window.WebComponents&&T(window.WebComponents.flags);let G=null,z={VAR_ASSIGN:/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}])|$)/gi,MIXIN_MATCH:/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,VAR_CONSUMED:/(--[\w-]+)\s*([:,;)]|$)/gi,ANIMATION_MATCH:/(animation\s*:)|(animation-name\s*:)/,MEDIA_MATCH:/@media[^(]*(\([^)]*\))/,IS_VAR:/^--/,BRACKETED:/\{[^}]*\}/g,HOST_PREFIX:'(?:^|[^.#[:])',HOST_SUFFIX:'($|[.:[\\s>+~])'};const $='style-scope';class J{get SCOPE_NAME(){return $}dom(we,Ue,De){we.__styleScoped?we.__styleScoped=null:this._transformDom(we,Ue||'',De)}_transformDom(we,Ue,De){we.nodeType===Node.ELEMENT_NODE&&this.element(we,Ue,De);let ke='template'===we.localName?(we.content||we._content).childNodes:we.children||we.childNodes;if(ke)for(let He=0;He<ke.length;He++)this._transformDom(ke[He],Ue,De)}element(we,Ue,De){if(Ue)if(we.classList)De?(we.classList.remove($),we.classList.remove(Ue)):(we.classList.add($),we.classList.add(Ue));else if(we.getAttribute){let ke=we.getAttribute('class');if(!De){let He=(ke?ke+' ':'')+$+' '+Ue;k(we,He)}else if(ke){let He=ke.replace($,'').replace(Ue,'');k(we,He)}}}elementStyles(we,Ue,De){let ke=we.__cssBuild,He=V||'shady'===ke?b(Ue,De):this.css(Ue,we.is,we.extends,De)+'\n\n';return He.trim()}css(we,Ue,De,ke){let He=this._calcHostScope(Ue,De);Ue=this._calcElementScope(Ue);let Fe=this;return b(we,function(je){je.isScoped||(Fe.rule(je,Ue,He),je.isScoped=!0),ke&&ke(je,Ue,He)})}_calcElementScope(we){return we?'.'+we:''}_calcHostScope(we,Ue){return Ue?'[is='+we+']':we}rule(we,Ue,De){this._transformRule(we,this._transformComplexSelector,Ue,De)}_transformRule(we,Ue,De,ke){we.selector=we.transformedSelector=this._transformRuleCss(we,Ue,De,ke)}_transformRuleCss(we,Ue,De,ke){let He=we.selector.split(ee);if(!I(we))for(let qe,Fe=0,je=He.length;Fe<je&&(qe=He[Fe]);Fe++)He[Fe]=Ue.call(this,qe,De,ke);return He.join(ee)}_transformComplexSelector(we,Ue,De){let ke=!1;return we=we.trim(),we=we.replace(Z,(He,Fe,je)=>`:${Fe}(${je.replace(/\s/g,'')})`),we=we.replace(oe,`${se} $1`),we=we.replace(te,(He,Fe,je)=>{if(!ke){let qe=this._transformCompoundSelector(je,Fe,Ue,De);ke=ke||qe.stop,Fe=qe.combinator,je=qe.value}return Fe+je}),we}_transformCompoundSelector(we,Ue,De,ke){let He=we.indexOf(ne);0<=we.indexOf(se)?we=this._transformHostSelector(we,ke):0!==He&&(we=De?this._transformSimpleSelector(we,De):we);let Fe=!1;0<=He&&(Ue='',Fe=!0);let je;return Fe&&(je=!0,Fe&&(we=we.replace(ae,(qe,Ke)=>` > ${Ke}`))),we=we.replace(ie,(qe,Ke,Be)=>`[dir="${Be}"] ${Ke}, ${Ke}[dir="${Be}"]`),{value:we,combinator:Ue,stop:je}}_transformSimpleSelector(we,Ue){let De=we.split(pe);return De[0]+=Ue,De.join(pe)}_transformHostSelector(we,Ue){let De=we.match(le),ke=De&&De[2].trim()||'';if(ke){if(!ke[0].match(re)){let He=ke.split(re)[0];return He===Ue?ke:'should_not_match'}return we.replace(le,function(He,Fe,je){return Ue+je})}return we.replace(se,Ue)}documentRule(we){we.selector=we.parsedSelector,this.normalizeRootSelector(we),this._transformRule(we,this._transformDocumentSelector)}normalizeRootSelector(we){':root'===we.selector&&(we.selector='html')}_transformDocumentSelector(we){return we.match(ne)?this._transformComplexSelector(we,Q):this._transformSimpleSelector(we.trim(),Q)}}let Z=/:(nth[-\w]+)\(([^)]+)\)/,Q=`:not(.${$})`,ee=',',te=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,re=/[[.:#*]/,se=':host',ne='::slotted',oe=/^(::slotted)/,le=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ae=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ie=/(.*):dir\((?:(ltr|rtl))\)/,pe=':';var de=new J,me={};const ue=Promise.resolve();class ye{static get(we){return we.__styleInfo}static set(we,Ue){return we.__styleInfo=Ue,Ue}static invalidate(we){me[we]&&(me[we]._applyShimInvalid=!0)}static startValidating(we){const Ue=me[we];Ue._validating||(Ue._validating=!0,ue.then(()=>{Ue._applyShimInvalid=!1,Ue._validating=!1}))}constructor(we,Ue,De,ke,He,Fe){this.styleRules=we||null,this.placeholder=Ue||null,this.ownStylePropertyNames=De||[],this.overrideStyleProperties=null,this.elementName=ke||'',this.cssBuild=Fe||'',this.typeExtension=He||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const fe=window.Element.prototype,he=fe.matches||fe.matchesSelector||fe.mozMatchesSelector||fe.msMatchesSelector||fe.oMatchesSelector||fe.webkitMatchesSelector,_e=navigator.userAgent.match('Trident'),Se='x-scope';class ge{get XSCOPE_NAME(){return Se}decorateStyles(we){let Ue=this,De={},ke=[],He=0;P(we,function(je){Ue.decorateRule(je),je.index=He++,Ue.collectPropertiesInCssText(je.propertyInfo.cssText,De)},function(qe){ke.push(qe)}),we._keyframes=ke;let Fe=[];for(let je in De)Fe.push(je);return Fe}decorateRule(we){if(we.propertyInfo)return we.propertyInfo;let Ue={},De={},ke=this.collectProperties(we,De);return ke&&(Ue.properties=De,we.rules=null),Ue.cssText=this.collectCssText(we),we.propertyInfo=Ue,Ue}collectProperties(we,Ue){let De=we.propertyInfo;if(!De){let ke,He=z.VAR_ASSIGN,Fe=we.parsedCssText,je,qe;for(;ke=He.exec(Fe);)je=(ke[2]||ke[3]).trim(),('inherit'!==je||'unset'!==je)&&(Ue[ke[1].trim()]=je),qe=!0;return qe}else if(De.properties)return Object.assign(Ue,De.properties),!0}collectCssText(we){return this.collectConsumingCssText(we.parsedCssText)}collectConsumingCssText(we){return we.replace(z.BRACKETED,'').replace(z.VAR_ASSIGN,'')}collectPropertiesInCssText(we,Ue){for(let De;De=z.VAR_CONSUMED.exec(we);){let ke=De[1];':'!==De[2]&&(Ue[ke]=!0)}}reify(we){let Ue=Object.getOwnPropertyNames(we);for(let ke,De=0;De<Ue.length;De++)ke=Ue[De],we[ke]=this.valueForProperty(we[ke],we)}valueForProperty(we,Ue){if(we)if(0<=we.indexOf(';'))we=this.valueForProperties(we,Ue);else{let De=this;we=D(we,function(ke,He,Fe,je){if(!He)return ke+je;let qe=De.valueForProperty(Ue[He],Ue);return qe&&'initial'!==qe?'apply-shim-inherit'===qe&&(qe='inherit'):qe=De.valueForProperty(Ue[Fe]||Fe,Ue)||Fe,ke+(qe||'')+je})}return we&&we.trim()||''}valueForProperties(we,Ue){let De=we.split(';');for(let He,Fe,ke=0;ke<De.length;ke++)if(He=De[ke]){if(z.MIXIN_MATCH.lastIndex=0,Fe=z.MIXIN_MATCH.exec(He),Fe)He=this.valueForProperty(Ue[Fe[1]],Ue);else{let je=He.indexOf(':');if(-1!==je){let qe=He.substring(je);qe=qe.trim(),qe=this.valueForProperty(qe,Ue)||qe,He=He.substring(0,je)+qe}}De[ke]=He&&He.lastIndexOf(';')===He.length-1?He.slice(0,-1):He||''}return De.join(';')}applyProperties(we,Ue){let De='';we.propertyInfo||this.decorateRule(we),we.propertyInfo.cssText&&(De=this.valueForProperties(we.propertyInfo.cssText,Ue)),we.cssText=De}applyKeyframeTransforms(we,Ue){let De=we.cssText,ke=we.cssText;if(null==we.hasAnimations&&(we.hasAnimations=z.ANIMATION_MATCH.test(De)),we.hasAnimations){let He;if(null==we.keyframeNamesToTransform)for(let Fe in we.keyframeNamesToTransform=[],Ue)He=Ue[Fe],ke=He(De),De!==ke&&(De=ke,we.keyframeNamesToTransform.push(Fe));else{for(let Fe=0;Fe<we.keyframeNamesToTransform.length;++Fe)He=Ue[we.keyframeNamesToTransform[Fe]],De=He(De);ke=De}}we.cssText=ke}propertyDataFromStyles(we,Ue){let De={},ke=this,He=[];return P(we,function(Fe){Fe.propertyInfo||ke.decorateRule(Fe);let je=Fe.transformedSelector||Fe.parsedSelector;Ue&&Fe.propertyInfo.properties&&je&&he.call(Ue,je)&&(ke.collectProperties(Fe,De),H(Fe.index,He))},null,!0),{properties:De,key:He}}whenHostOrRootRule(we,Ue,De,ke){if(Ue.propertyInfo||this.decorateRule(Ue),!!Ue.propertyInfo.properties){let He=we.is?de._calcHostScope(we.is,we.extends):'html',Fe=Ue.parsedSelector,je=':host > *'===Fe||'html'===Fe,qe=0===Fe.indexOf(':host')&&!je;if('shady'===De&&(je=Fe===He+' > *.'+He||-1!==Fe.indexOf('html'),qe=!je&&0===Fe.indexOf(He)),'shadow'===De&&(je=':host > *'===Fe||'html'===Fe,qe=qe&&!je),je||qe){let Ke=He;qe&&(V&&!Ue.transformedSelector&&(Ue.transformedSelector=de._transformRuleCss(Ue,de._transformComplexSelector,de._calcElementScope(we.is),He)),Ke=Ue.transformedSelector||He),ke({selector:Ke,isHost:qe,isRoot:je})}}}hostAndRootPropertiesForScope(we,Ue){let De={},ke={},He=this,Fe=Ue&&Ue.__cssBuild;return P(Ue,function(je){He.whenHostOrRootRule(we,je,Fe,function(qe){let Ke=we._element||we;he.call(Ke,qe.selector)&&(qe.isHost?He.collectProperties(je,De):He.collectProperties(je,ke))})},null,!0),{rootProps:ke,hostProps:De}}transformStyles(we,Ue,De){let ke=this,He=de._calcHostScope(we.is,we.extends),Fe=we.extends?'\\'+He.slice(0,-1)+'\\]':He,je=new RegExp(z.HOST_PREFIX+Fe+z.HOST_SUFFIX),qe=ye.get(we).styleRules,Ke=this._elementKeyframeTransforms(we,qe,De);return de.elementStyles(we,qe,function(Be){ke.applyProperties(Be,Ue),V||I(Be)||!Be.cssText||(ke.applyKeyframeTransforms(Be,Ke),ke._scopeSelector(Be,je,He,De))})}_elementKeyframeTransforms(we,Ue,De){let ke=Ue._keyframes,He={};if(!V&&ke)for(let Fe=0,je=ke[Fe];Fe<ke.length;je=ke[++Fe])this._scopeKeyframes(je,De),He[je.keyframesName]=this._keyframesRuleTransformer(je);return He}_keyframesRuleTransformer(we){return function(Ue){return Ue.replace(we.keyframesNameRx,we.transformedKeyframesName)}}_scopeKeyframes(we,Ue){we.keyframesNameRx=new RegExp(we.keyframesName,'g'),we.transformedKeyframesName=we.keyframesName+'-'+Ue,we.transformedSelector=we.transformedSelector||we.selector,we.selector=we.transformedSelector.replace(we.keyframesName,we.transformedKeyframesName)}_scopeSelector(we,Ue,De,ke){we.transformedSelector=we.transformedSelector||we.selector;let He=we.transformedSelector,Fe='.'+ke,je=He.split(',');for(let Be,qe=0,Ke=je.length;qe<Ke&&(Be=je[qe]);qe++)je[qe]=Be.match(Ue)?Be.replace(De,Fe):Fe+' '+Be;we.selector=je.join(',')}applyElementScopeSelector(we,Ue,De){let ke=we.getAttribute('class')||'',He=ke;De&&(He=ke.replace(new RegExp('\\s*'+Se+'\\s*'+De+'\\s*','g'),' ')),He+=(He?' ':'')+Se+' '+Ue,ke!==He&&k(we,He)}applyElementStyle(we,Ue,De,ke){let He=ke?ke.textContent||'':this.transformStyles(we,Ue,De),Fe=ye.get(we),je=Fe.customStyle;return je&&!V&&je!==ke&&(je._useCount--,0>=je._useCount&&je.parentNode&&je.parentNode.removeChild(je)),V?Fe.customStyle?(Fe.customStyle.textContent=He,ke=Fe.customStyle):He&&(ke=M(He,De,we.shadowRoot,Fe.placeholder)):ke?!ke.parentNode&&O(ke,null,Fe.placeholder):He&&(ke=M(He,De,null,Fe.placeholder)),ke&&(ke._useCount=ke._useCount||0,Fe.customStyle!=ke&&ke._useCount++,Fe.customStyle=ke),_e&&(ke.textContent=ke.textContent),ke}applyCustomStyle(we,Ue){let De=R(we),ke=this;we.textContent=b(De,function(He){let Fe=He.cssText=He.parsedCssText;He.propertyInfo&&He.propertyInfo.cssText&&(Fe=E(Fe),He.cssText=ke.valueForProperties(Fe,Ue))})}}var Ce=new ge;let xe={};const Ae=window.customElements;if(Ae&&!V){const we=Ae.define;Ae.define=function(Ue,De,ke){return xe[Ue]=w(Ue),we.call(Ae,Ue,De,ke)}}let ve=z.MIXIN_MATCH,Ee=z.VAR_ASSIGN,Ne=/;\s*/m,Te=/^\s*(initial)|(inherit)\s*$/,be='_-_';class Re{constructor(){this._map={}}set(we,Ue){we=we.trim(),this._map[we]={properties:Ue,dependants:{}}}get(we){return we=we.trim(),this._map[we]}}class Ie{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new Re,this._separator=be,this._boundProduceCssProperties=(we,Ue,De,ke)=>this._produceCssProperties(we,Ue,De,ke)}detectMixin(we){const Ue=ve.test(we)||Ee.test(we);return ve.lastIndex=0,Ee.lastIndex=0,Ue}transformStyle(we,Ue){let De=R(we);return this.transformRules(De,Ue),De}transformRules(we,Ue){this._currentTemplate=me[Ue],P(we,De=>{this.transformRule(De)}),this._currentTemplate=null}transformRule(we){we.cssText=this.transformCssText(we.parsedCssText),':root'===we.selector&&(we.selector=':host > *')}transformCssText(we){return we=we.replace(Ee,this._boundProduceCssProperties),this._consumeCssProperties(we)}_getInitialValueForProperty(we){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(we)}_consumeCssProperties(we){for(let Ue;Ue=ve.exec(we);){let De=Ue[0],ke=Ue[1],He=Ue.index,Fe=He+De.indexOf('@apply'),je=He+De.length,qe=we.slice(0,Fe),Ke=we.slice(je),Be=this._cssTextToMap(qe),Xe=this._atApplyToCssProperties(ke,Be);we=[qe,Xe,Ke].join(''),ve.lastIndex=He+Xe.length}return we}_atApplyToCssProperties(we,Ue){we=we.replace(Ne,'');let De=[],ke=this._map.get(we);if(ke||(this._map.set(we,{}),ke=this._map.get(we)),ke){this._currentTemplate&&(ke.dependants[this._currentTemplate.name]=this._currentTemplate);let He,Fe,je;for(He in ke.properties)je=Ue&&Ue[He],Fe=[He,': var(',we,be,He],je&&Fe.push(',',je),Fe.push(')'),De.push(Fe.join(''))}return De.join('; ')}_replaceInitialOrInherit(we,Ue){let De=Te.exec(Ue);return De&&(De[1]?Ue=Ie._getInitialValueForProperty(we):Ue='apply-shim-inherit'),Ue}_cssTextToMap(we){let Ue=we.split(';'),De,ke,He={};for(let je,qe,Fe=0;Fe<Ue.length;Fe++)je=Ue[Fe],je&&(qe=je.split(':'),1<qe.length&&(De=qe[0].trim(),ke=this._replaceInitialOrInherit(De,qe.slice(1).join(':')),He[De]=ke));return He}_invalidateMixinEntry(we){for(let Ue in we.dependants)this._currentTemplate&&Ue===this._currentTemplate.name||ye.invalidate(Ue)}_produceCssProperties(we,Ue,De,ke){if(De&&D(De,(Ge,ze)=>{ze&&this._map.get(ze)&&(ke='@apply '+ze+';')}),!ke)return we;let He=this._consumeCssProperties(ke),Fe=we.slice(0,we.indexOf('--')),je=this._cssTextToMap(He),qe=je,Ke=this._map.get(Ue),Be=Ke&&Ke.properties;Be?qe=Object.assign(Object.create(Be),je):this._map.set(Ue,qe);let Ve,We,Xe=[],Ye=!1;for(Ve in qe)We=je[Ve],void 0==We&&(We='initial'),Be&&!(Ve in Be)&&(Ye=!0),Xe.push(Ue+be+Ve+': '+We);return Ye&&this._invalidateMixinEntry(Ke),Ke&&(Ke.properties=qe),De&&(Fe=we+';'+Fe),Fe+Xe.join('; ')+';'}}let Pe=new Ie;window.ApplyShim=Pe;let Me=function(){};if(!V){let we=Fe=>{return Fe.classList&&!Fe.classList.contains(de.SCOPE_NAME)||Fe instanceof SVGElement&&(!Fe.hasAttribute('class')||0>Fe.getAttribute('class').indexOf(de.SCOPE_NAME))},Ue=Fe=>{for(let je=0;je<Fe.length;je++){let qe=Fe[je];if(qe.target!==document.documentElement&&qe.target!==document.head){for(let Ke=0;Ke<qe.addedNodes.length;Ke++){let Be=qe.addedNodes[Ke];if(we(Be)){let Xe=Be.getRootNode();if(Xe.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let Ve=Xe.host;if(Ve){let We=Ve.is||Ve.localName;de.dom(Be,We)}}}}for(let Ke=0;Ke<qe.removedNodes.length;Ke++){let Be=qe.removedNodes[Ke];if(Be.nodeType===Node.ELEMENT_NODE){let Xe;if(Be.classList?Xe=Array.from(Be.classList):Be.hasAttribute('class')&&(Xe=Be.getAttribute('class').split(/\s+/)),void 0!=Xe){let Ve=Xe.indexOf(de.SCOPE_NAME);if(0<=Ve){let We=Xe[Ve+1];We&&de.dom(Be,We,!0)}}}}}}},De=new MutationObserver(Ue),ke=Fe=>{De.observe(Fe,{childList:!0,subtree:!0})},He=window.customElements&&!window.customElements.flush;if(He)ke(document);else{let Fe=()=>{ke(document.body)};window.HTMLImports?window.HTMLImports.whenReady(Fe):requestAnimationFrame(function(){if('loading'===document.readyState){let je=function(){Fe(),document.removeEventListener('readystatechange',je)};document.addEventListener('readystatechange',je)}else Fe()})}Me=function(){Ue(De.takeRecords())}}let Oe=new class{constructor(Ue=100){this.cache={},this.typeMax=Ue}_validate(Ue,De,ke){for(let He=0;He<ke.length;He++){let Fe=ke[He];if(Ue.properties[Fe]!==De[Fe])return!1}return!0}store(Ue,De,ke,He){let Fe=this.cache[Ue]||[];Fe.push({properties:De,styleElement:ke,scopeSelector:He}),Fe.length>this.typeMax&&Fe.shift(),this.cache[Ue]=Fe}fetch(Ue,De,ke){let He=this.cache[Ue];if(He)for(let Fe=He.length-1;0<=Fe;Fe--){let je=He[Fe];if(this._validate(je,De,ke))return je}}};class Le{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=ye.set(document.documentElement,new ye({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return V}get nativeCss(){return W}get nativeCssApply(){return Y}flush(){Me()}_generateScopeSelector(we){let Ue=this._scopeCounter[we]=(this._scopeCounter[we]||0)+1;return`${we}-${Ue}`}getStyleAst(we){return R(we)}styleAstToString(we){return b(we)}_gatherStyles(we){let Ue=we.content.querySelectorAll('style'),De=[];for(let ke=0;ke<Ue.length;ke++){let He=Ue[ke];De.push(He.textContent),He.parentNode.removeChild(He)}return De.join('').trim()}_getCssBuild(we){let Ue=we.content.querySelector('style');return Ue?Ue.getAttribute('css-build')||'':''}prepareTemplate(we,Ue,De){if(!we._prepared){we._prepared=!0,we.name=Ue,we.extends=De,me[Ue]=we;let ke=this._getCssBuild(we),He=this._gatherStyles(we),Fe={is:Ue,extends:De,__cssBuild:ke};this.nativeShadow||de.dom(we.content,Ue);let je=Pe.detectMixin(He),qe=d(He);je&&this.nativeCss&&!this.nativeCssApply&&Pe.transformRules(qe,Ue),we._styleAst=qe;let Ke=[];if(this.nativeCss||(Ke=Ce.decorateStyles(we._styleAst,Fe)),!Ke.length||this.nativeCss){let Be=this.nativeShadow?we.content:null,Xe=xe[Ue],Ve=this._generateStaticStyle(Fe,we._styleAst,Be,Xe);we._style=Ve}we._ownPropertyNames=Ke}}_generateStaticStyle(we,Ue,De,ke){let He=de.elementStyles(we,Ue);if(He.length)return M(He,we.is,De,ke)}_prepareHost(we){let De,Ue=we.getAttribute('is')||we.localName;Ue!==we.localName&&(De=we.localName);let Fe,je,qe,ke=xe[Ue],He=me[Ue];return He&&(Fe=He._styleAst,je=He._ownPropertyNames,qe=He._cssBuild),ye.set(we,new ye(Fe,ke,je,Ue,De,qe))}applyStyle(we,Ue){let De=we.getAttribute('is')||we.localName,ke=ye.get(we),He=!!ke;if(ke||(ke=this._prepareHost(we)),this._isRootOwner(we)||(this._elementsHaveApplied=!0),window.CustomStyle){let Fe=window.CustomStyle;if(Fe._documentDirty){if(Fe.findStyles(),this.nativeCss?!this.nativeCssApply&&Fe._revalidateApplyShim():this._updateProperties(this._documentOwner,this._documentOwnerStyleInfo),Fe.applyStyles(),!this._elementsHaveApplied)return;if(!this.nativeCss&&(this.updateStyles(),He))return}}if(Ue&&(ke.overrideStyleProperties=ke.overrideStyleProperties||{},Object.assign(ke.overrideStyleProperties,Ue)),this.nativeCss){ke.overrideStyleProperties&&this._updateNativeProperties(we,ke.overrideStyleProperties);let Fe=me[De];if(!Fe&&!this._isRootOwner(we))return;if(Fe&&Fe._applyShimInvalid&&Fe._style){if(Fe._validating||(Pe.transformRules(Fe._styleAst,De),Fe._style.textContent=de.elementStyles(we,ke.styleRules),ye.startValidating(De)),this.nativeShadow){let je=we.shadowRoot;if(je){let qe=je.querySelector('style');qe.textContent=de.elementStyles(we,ke.styleRules)}}ke.styleRules=Fe._styleAst}}else this._updateProperties(we,ke),ke.ownStylePropertyNames&&ke.ownStylePropertyNames.length&&this._applyStyleProperties(we,ke);if(He){let Fe=this._isRootOwner(we)?we:we.shadowRoot;Fe&&this._applyToDescendants(Fe)}}_applyToDescendants(we){let Ue=we.children;for(let ke,De=0;De<Ue.length;De++)ke=Ue[De],ke.shadowRoot&&this.applyStyle(ke),this._applyToDescendants(ke)}_styleOwnerForNode(we){let Ue=we.getRootNode(),De=Ue.host;return De?ye.get(De)?De:this._styleOwnerForNode(De):this._documentOwner}_isRootOwner(we){return we===this._documentOwner}_applyStyleProperties(we,Ue){let De=we.getAttribute('is')||we.localName,ke=Oe.fetch(De,Ue.styleProperties,Ue.ownStylePropertyNames),He=ke&&ke.scopeSelector,Fe=ke?ke.styleElement:null,je=Ue.scopeSelector;Ue.scopeSelector=He||this._generateScopeSelector(De);let qe=Ce.applyElementStyle(we,Ue.styleProperties,Ue.scopeSelector,Fe);return this.nativeShadow||Ce.applyElementScopeSelector(we,Ue.scopeSelector,je),ke||Oe.store(De,Ue.styleProperties,qe,Ue.scopeSelector),qe}_updateProperties(we,Ue){let De=this._styleOwnerForNode(we),ke=ye.get(De),He=ke.styleProperties,Fe=Object.create(He||null),je=Ce.hostAndRootPropertiesForScope(we,Ue.styleRules),qe=Ce.propertyDataFromStyles(ke.styleRules,we),Ke=qe.properties;Object.assign(Fe,je.hostProps,Ke,je.rootProps),this._mixinOverrideStyles(Fe,Ue.overrideStyleProperties),Ce.reify(Fe),Ue.styleProperties=Fe}_mixinOverrideStyles(we,Ue){for(let De in Ue){let ke=Ue[De];(ke||0===ke)&&(we[De]=ke)}}_updateNativeProperties(we,Ue){for(let De in Ue)null===De?we.style.removeProperty(De):we.style.setProperty(De,Ue[De])}updateStyles(we){this.applyStyle(this._documentOwner,we)}_transformCustomStyleForDocument(we){let Ue=R(we);P(Ue,De=>{V?de.normalizeRootSelector(De):de.documentRule(De),this.nativeCss&&!this.nativeCssApply&&Pe.transformRule(De)}),this.nativeCss?we.textContent=b(Ue):this._documentOwnerStyleInfo.styleRules.rules.push(Ue)}_revalidateApplyShim(we){if(this.nativeCss&&!this.nativeCssApply){let Ue=R(we);Pe.transformRules(Ue),we.textContent=b(Ue)}}_applyCustomStyleToDocument(we){this.nativeCss||Ce.applyCustomStyle(we,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(we,Ue){let De;if(!this.nativeCss){let ke=ye.get(we)||ye.get(this._styleOwnerForNode(we));De=ke.styleProperties[Ue]}return De=De||window.getComputedStyle(we).getPropertyValue(Ue),De.trim()}setElementClass(we,Ue){let De=we.getRootNode(),ke=Ue?Ue.split(/\s/):[],He=De.host&&De.host.localName;if(!He){var Fe=we.getAttribute('class');if(Fe){let je=Fe.split(/\s/);for(let qe=0;qe<je.length;qe++)if(je[qe]===de.SCOPE_NAME){He=je[qe+1];break}}}if(He&&ke.push(de.SCOPE_NAME,He),!this.nativeCss){let je=ye.get(we);je&&je.scopeSelector&&ke.push(Ce.XSCOPE_NAME,je.scopeSelector)}k(we,ke.join(' '))}_styleInfoForNode(we){return ye.get(we)}}window.ShadyCSS=new Le,function(){'use strict';window.HTMLImports?HTMLImports.whenReady(function(){requestAnimationFrame(function(){window.dispatchEvent(new CustomEvent('WebComponentsReady'))})}):requestAnimationFrame(function(){window.dispatchEvent(new CustomEvent('WebComponentsReady'))})}(window.WebComponents),function(){var we=document.createElement('style');we.textContent='body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n';var Ue=document.querySelector('head');Ue.insertBefore(we,Ue.firstChild)}(window.WebComponents)})();
|
|
//# sourceMappingURL=webcomponents-hi.min.js.map
|