mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
11 lines
27 KiB
JavaScript
11 lines
27 KiB
JavaScript
(function(){'use strict';/**
|
|
@license
|
|
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
Code distributed by Google as part of the polymer project is also
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
*/function e(Ye){return Ye=a(Ye),u(d(Ye),Ye)}function a(Ye){return Ye.replace(B.comments,'').replace(B.port,'')}function d(Ye){let Ge={start:0,end:Ye.length},qe=Ge;for(let We=0,ze=Ye.length;We<ze;We++)if(Ye[We]===K){qe.rules||(qe.rules=[]);let $e=qe,Qe=$e.rules[$e.rules.length-1];qe={start:We+1,parent:$e,previous:Qe},$e.rules.push(qe)}else Ye[We]===X&&(qe.end=We+1,qe=qe.parent||Ge);return Ge}function u(Ye,Ge){let qe=Ge.substring(Ye.start,Ye.end-1);if(Ye.parsedCssText=Ye.cssText=qe.trim(),Ye.parent){let ze=Ye.previous?Ye.previous.end:Ye.parent.start;qe=Ge.substring(ze,Ye.start-1),qe=y(qe),qe=qe.replace(B.multipleSpaces,' '),qe=qe.substring(qe.lastIndexOf(';')+1);let $e=Ye.parsedSelector=Ye.selector=qe.trim();Ye.atRule=0===$e.indexOf('@'),Ye.atRule?0===$e.indexOf('@media')?Ye.type=U.MEDIA_RULE:$e.match(B.keyframesRule)&&(Ye.type=U.KEYFRAMES_RULE,Ye.keyframesName=Ye.selector.split(B.multipleSpaces).pop()):0===$e.indexOf(j)?Ye.type=U.MIXIN_RULE:Ye.type=U.STYLE_RULE}let We=Ye.rules;if(We)for(let Qe,ze=0,$e=We.length;ze<$e&&(Qe=We[ze]);ze++)u(Qe,Ge);return Ye}function y(Ye){return Ye.replace(/\\([0-9a-f]{1,6})\s/gi,function(){let Ge=arguments[1],qe=6-Ge.length;for(;qe--;)Ge='0'+Ge;return'\\'+Ge})}function _(Ye,Ge,qe){qe=qe||'';let We='';if(Ye.cssText||Ye.rules){let ze=Ye.rules;if(ze&&!S(ze))for(let Ze,$e=0,Qe=ze.length;$e<Qe&&(Ze=ze[$e]);$e++)We=_(Ze,Ge,We);else We=Ge?Ye.cssText:h(Ye.cssText),We=We.trim(),We&&(We=' '+We+'\n')}return We&&(Ye.selector&&(qe+=Ye.selector+' '+K+'\n'),qe+=We,Ye.selector&&(qe+=X+'\n\n')),qe}function S(Ye){return 0===Ye[0].selector.indexOf(j)}function h(Ye){return Ye=g(Ye),C(Ye)}function g(Ye){return Ye.replace(B.customProp,'').replace(B.mixinProp,'')}function C(Ye){return Ye.replace(B.mixinApply,'').replace(B.varApply,'')}function A(Ye){Ye&&(q=q&&!Ye.shimcssproperties,G=G&&!Ye.shimshadow)}function T(Ye,Ge){return'string'==typeof Ye&&(Ye=e(Ye)),Ge&&P(Ye,Ge),_(Ye,q)}function N(Ye){return!Ye.__cssRules&&Ye.textContent&&(Ye.__cssRules=e(Ye.textContent)),Ye.__cssRules}function R(Ye){return Ye.parent&&Ye.parent.type===U.KEYFRAMES_RULE}function P(Ye,Ge,qe,We){if(Ye){let ze=!1;if(We&&Ye.type===U.MEDIA_RULE){let Qe=Ye.selector.match($.MEDIA_MATCH);Qe&&!window.matchMedia(Qe[1]).matches&&(ze=!0)}Ye.type===U.STYLE_RULE?Ge(Ye):qe&&Ye.type===U.KEYFRAMES_RULE?qe(Ye):Ye.type===U.MIXIN_RULE&&(ze=!0);let $e=Ye.rules;if($e&&!ze)for(let Je,Qe=0,Ze=$e.length;Qe<Ze&&(Je=$e[Qe]);Qe++)P(Je,Ge,qe,We)}}function I(Ye,Ge,qe,We){let ze=M(Ye,Ge);return O(ze,qe,We)}function O(Ye,Ge,qe){Ge=Ge||document.head;let We=qe&&qe.nextSibling||Ge.firstChild;return z=Ye,Ge.insertBefore(Ye,We)}function M(Ye,Ge){let qe=document.createElement('style');return Ge&&qe.setAttribute('scope',Ge),qe.textContent=Ye,qe}function b(Ye){let Ge=document.createComment(' Shady DOM styles for '+Ye+' '),qe=z?z.nextSibling:null,We=document.head;return We.insertBefore(Ge,qe||We.firstChild),z=Ge,Ge}function w(Ye,Ge){let qe=0;for(let We=Ge,ze=Ye.length;We<ze;We++)if('('===Ye[We])qe++;else if(')'===Ye[We]&&0==--qe)return We;return-1}function L(Ye,Ge){let qe=Ye.indexOf('var(');if(-1===qe)return Ge(Ye,'','','');let We=w(Ye,qe+3),ze=Ye.substring(qe+4,We),$e=Ye.substring(0,qe),Qe=L(Ye.substring(We+1),Ge),Ze=ze.indexOf(',');if(-1===Ze)return Ge($e,ze.trim(),'',Qe);let Je=ze.substring(0,Ze).trim(),et=ze.substring(Ze+1).trim();return Ge($e,Je,et,Qe)}function H(Ye,Ge){window.ShadyDOM?window.ShadyDOM.nativeMethods.setAttribute.call(Ye,'class',Ge):Ye.setAttribute('class',Ge)}function D(Ye,Ge){let qe=parseInt(Ye/32);Ge[qe]=(Ge[qe]||0)|1<<Ye%32}function F(){Xe||(Xe=!0,window.HTMLImports?window.HTMLImports.whenReady(k):'complete'===document.readyState?k():document.addEventListener('readystatechange',()=>{'complete'===document.readyState&&k()}))}function k(){requestAnimationFrame(()=>{(Xe||Ke._elementsHaveApplied)&&Ke.updateStyles(),Xe=!1})}let U={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},K='{',X='}',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},j='--',G=!(window.ShadyDOM&&window.ShadyDOM.inUse),q=!navigator.userAgent.match('AppleWebKit/601')&&window.CSS&&CSS.supports&&CSS.supports('box-shadow','0 0 0 var(--foo)');window.ShadyCSS?A(window.ShadyCSS):window.WebComponents&&A(window.WebComponents.flags);let z=null,$={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 Q='style-scope';class Z{get SCOPE_NAME(){return Q}dom(Ye,Ge,qe){Ye.__styleScoped?Ye.__styleScoped=null:this._transformDom(Ye,Ge||'',qe)}_transformDom(Ye,Ge,qe){Ye.nodeType===Node.ELEMENT_NODE&&this.element(Ye,Ge,qe);let We='template'===Ye.localName?(Ye.content||Ye._content).childNodes:Ye.children||Ye.childNodes;if(We)for(let ze=0;ze<We.length;ze++)this._transformDom(We[ze],Ge,qe)}element(Ye,Ge,qe){if(Ge)if(Ye.classList)qe?(Ye.classList.remove(Q),Ye.classList.remove(Ge)):(Ye.classList.add(Q),Ye.classList.add(Ge));else if(Ye.getAttribute){let We=Ye.getAttribute('class');if(!qe){let ze=(We?We+' ':'')+Q+' '+Ge;H(Ye,ze)}else if(We){let ze=We.replace(Q,'').replace(Ge,'');H(Ye,ze)}}}elementStyles(Ye,Ge,qe){let We=Ye.__cssBuild,ze=G||'shady'===We?T(Ge,qe):this.css(Ge,Ye.is,Ye.extends,qe)+'\n\n';return ze.trim()}css(Ye,Ge,qe,We){let ze=this._calcHostScope(Ge,qe);Ge=this._calcElementScope(Ge);let $e=this;return T(Ye,function(Qe){Qe.isScoped||($e.rule(Qe,Ge,ze),Qe.isScoped=!0),We&&We(Qe,Ge,ze)})}_calcElementScope(Ye){return Ye?'.'+Ye:''}_calcHostScope(Ye,Ge){return Ge?'[is='+Ye+']':Ye}rule(Ye,Ge,qe){this._transformRule(Ye,this._transformComplexSelector,Ge,qe)}_transformRule(Ye,Ge,qe,We){Ye.selector=Ye.transformedSelector=this._transformRuleCss(Ye,Ge,qe,We)}_transformRuleCss(Ye,Ge,qe,We){let ze=Ye.selector.split(te);if(!R(Ye))for(let Ze,$e=0,Qe=ze.length;$e<Qe&&(Ze=ze[$e]);$e++)ze[$e]=Ge.call(this,Ze,qe,We);return ze.join(te)}_transformComplexSelector(Ye,Ge,qe){let We=!1;return Ye=Ye.trim(),Ye=Ye.replace(J,(ze,$e,Qe)=>`:${$e}(${Qe.replace(/\s/g,'')})`),Ye=Ye.replace(ae,`${ne} $1`),Ye=Ye.replace(se,(ze,$e,Qe)=>{if(!We){let Ze=this._transformCompoundSelector(Qe,$e,Ge,qe);We=We||Ze.stop,$e=Ze.combinator,Qe=Ze.value}return $e+Qe}),Ye}_transformCompoundSelector(Ye,Ge,qe,We){let ze=Ye.indexOf(le);0<=Ye.indexOf(ne)?Ye=this._transformHostSelector(Ye,We):0!==ze&&(Ye=qe?this._transformSimpleSelector(Ye,qe):Ye);let $e=!1;0<=ze&&(Ge='',$e=!0);let Qe;return $e&&(Qe=!0,$e&&(Ye=Ye.replace(pe,(Ze,Je)=>` > ${Je}`))),Ye=Ye.replace(de,(Ze,Je,et)=>`[dir="${et}"] ${Je}, ${Je}[dir="${et}"]`),{value:Ye,combinator:Ge,stop:Qe}}_transformSimpleSelector(Ye,Ge){let qe=Ye.split(ue);return qe[0]+=Ge,qe.join(ue)}_transformHostSelector(Ye,Ge){let qe=Ye.match(ie),We=qe&&qe[2].trim()||'';if(We){if(!We[0].match(re)){let ze=We.split(re)[0];return ze===Ge?We:'should_not_match'}return Ye.replace(ie,function(ze,$e,Qe){return Ge+Qe})}return Ye.replace(ne,Ge)}documentRule(Ye){Ye.selector=Ye.parsedSelector,this.normalizeRootSelector(Ye),this._transformRule(Ye,this._transformDocumentSelector)}normalizeRootSelector(Ye){Ye.selector===':root'&&(Ye.selector='html')}_transformDocumentSelector(Ye){return Ye.match(le)?this._transformComplexSelector(Ye,ee):this._transformSimpleSelector(Ye.trim(),ee)}}let J=/:(nth[-\w]+)\(([^)]+)\)/,ee=`:not(.${Q})`,te=',',se=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,re=/[[.:#*]/,ne=':host',le='::slotted',ae=/^(::slotted)/,ie=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,pe=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,de=/(.*):dir\((?:(ltr|rtl))\)/,ue=':';var fe=new Z,Se={};const he=Promise.resolve();class ge{static get(Ye){return Ye.__styleInfo}static set(Ye,Ge){return Ye.__styleInfo=Ge,Ge}static invalidate(Ye){Se[Ye]&&(Se[Ye]._applyShimInvalid=!0)}static startValidating(Ye){const Ge=Se[Ye];Ge._validating||(Ge._validating=!0,he.then(()=>{Ge._applyShimInvalid=!1,Ge._validating=!1}))}constructor(Ye,Ge,qe,We,ze,$e){this.styleRules=Ye||null,this.placeholder=Ge||null,this.ownStylePropertyNames=qe||[],this.overrideStyleProperties=null,this.elementName=We||'',this.cssBuild=$e||'',this.typeExtension=ze||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const Ce=window.Element.prototype,xe=Ce.matches||Ce.matchesSelector||Ce.mozMatchesSelector||Ce.msMatchesSelector||Ce.oMatchesSelector||Ce.webkitMatchesSelector,Ee=navigator.userAgent.match('Trident'),Ae='x-scope';class Te{get XSCOPE_NAME(){return Ae}decorateStyles(Ye){let Ge=this,qe={},We=[],ze=0;P(Ye,function(Qe){Ge.decorateRule(Qe),Qe.index=ze++,Ge.collectPropertiesInCssText(Qe.propertyInfo.cssText,qe)},function(Ze){We.push(Ze)}),Ye._keyframes=We;let $e=[];for(let Qe in qe)$e.push(Qe);return $e}decorateRule(Ye){if(Ye.propertyInfo)return Ye.propertyInfo;let Ge={},qe={},We=this.collectProperties(Ye,qe);return We&&(Ge.properties=qe,Ye.rules=null),Ge.cssText=this.collectCssText(Ye),Ye.propertyInfo=Ge,Ge}collectProperties(Ye,Ge){let qe=Ye.propertyInfo;if(!qe){let We,ze=$.VAR_ASSIGN,$e=Ye.parsedCssText,Qe,Ze;for(;We=ze.exec($e);)Qe=(We[2]||We[3]).trim(),('inherit'!==Qe||'unset'!==Qe)&&(Ge[We[1].trim()]=Qe),Ze=!0;return Ze}else if(qe.properties)return Object.assign(Ge,qe.properties),!0}collectCssText(Ye){return this.collectConsumingCssText(Ye.parsedCssText)}collectConsumingCssText(Ye){return Ye.replace($.BRACKETED,'').replace($.VAR_ASSIGN,'')}collectPropertiesInCssText(Ye,Ge){for(let qe,We;qe=$.VAR_CONSUMED.exec(Ye);)We=qe[1],':'!==qe[2]&&(Ge[We]=!0)}reify(Ye){let Ge=Object.getOwnPropertyNames(Ye);for(let We,qe=0;qe<Ge.length;qe++)We=Ge[qe],Ye[We]=this.valueForProperty(Ye[We],Ye)}valueForProperty(Ye,Ge){if(Ye)if(0<=Ye.indexOf(';'))Ye=this.valueForProperties(Ye,Ge);else{let qe=this;Ye=L(Ye,function(ze,$e,Qe,Ze){if(!$e)return ze+Ze;let Je=qe.valueForProperty(Ge[$e],Ge);return Je&&'initial'!==Je?'apply-shim-inherit'===Je&&(Je='inherit'):Je=qe.valueForProperty(Ge[Qe]||Qe,Ge)||Qe,ze+(Je||'')+Ze})}return Ye&&Ye.trim()||''}valueForProperties(Ye,Ge){let qe=Ye.split(';');for(let ze,$e,We=0;We<qe.length;We++)if(ze=qe[We]){if($.MIXIN_MATCH.lastIndex=0,$e=$.MIXIN_MATCH.exec(ze),$e)ze=this.valueForProperty(Ge[$e[1]],Ge);else{let Qe=ze.indexOf(':');if(-1!==Qe){let Ze=ze.substring(Qe);Ze=Ze.trim(),Ze=this.valueForProperty(Ze,Ge)||Ze,ze=ze.substring(0,Qe)+Ze}}qe[We]=ze&&ze.lastIndexOf(';')===ze.length-1?ze.slice(0,-1):ze||''}return qe.join(';')}applyProperties(Ye,Ge){let qe='';Ye.propertyInfo||this.decorateRule(Ye),Ye.propertyInfo.cssText&&(qe=this.valueForProperties(Ye.propertyInfo.cssText,Ge)),Ye.cssText=qe}applyKeyframeTransforms(Ye,Ge){let qe=Ye.cssText,We=Ye.cssText;if(null==Ye.hasAnimations&&(Ye.hasAnimations=$.ANIMATION_MATCH.test(qe)),Ye.hasAnimations){let ze;if(null==Ye.keyframeNamesToTransform)for(let $e in Ye.keyframeNamesToTransform=[],Ge)ze=Ge[$e],We=ze(qe),qe!==We&&(qe=We,Ye.keyframeNamesToTransform.push($e));else{for(let $e=0;$e<Ye.keyframeNamesToTransform.length;++$e)ze=Ge[Ye.keyframeNamesToTransform[$e]],qe=ze(qe);We=qe}}Ye.cssText=We}propertyDataFromStyles(Ye,Ge){let qe={},We=this,ze=[];return P(Ye,function($e){$e.propertyInfo||We.decorateRule($e);let Qe=$e.transformedSelector||$e.parsedSelector;Ge&&$e.propertyInfo.properties&&Qe&&xe.call(Ge,Qe)&&(We.collectProperties($e,qe),D($e.index,ze))},null,!0),{properties:qe,key:ze}}whenHostOrRootRule(Ye,Ge,qe,We){if(Ge.propertyInfo||this.decorateRule(Ge),!!Ge.propertyInfo.properties){let ze=Ye.is?fe._calcHostScope(Ye.is,Ye.extends):'html',$e=Ge.parsedSelector,Qe=':host > *'===$e||'html'===$e,Ze=0===$e.indexOf(':host')&&!Qe;if('shady'===qe&&(Qe=$e===ze+' > *.'+ze||-1!==$e.indexOf('html'),Ze=!Qe&&0===$e.indexOf(ze)),'shadow'===qe&&(Qe=':host > *'===$e||'html'===$e,Ze=Ze&&!Qe),Qe||Ze){let Je=ze;Ze&&(G&&!Ge.transformedSelector&&(Ge.transformedSelector=fe._transformRuleCss(Ge,fe._transformComplexSelector,fe._calcElementScope(Ye.is),ze)),Je=Ge.transformedSelector||ze),We({selector:Je,isHost:Ze,isRoot:Qe})}}}hostAndRootPropertiesForScope(Ye,Ge){let qe={},We={},ze=this,$e=Ge&&Ge.__cssBuild;return P(Ge,function(Qe){ze.whenHostOrRootRule(Ye,Qe,$e,function(Ze){let Je=Ye._element||Ye;xe.call(Je,Ze.selector)&&(Ze.isHost?ze.collectProperties(Qe,qe):ze.collectProperties(Qe,We))})},null,!0),{rootProps:We,hostProps:qe}}transformStyles(Ye,Ge,qe){let We=this,ze=fe._calcHostScope(Ye.is,Ye.extends),$e=Ye.extends?'\\'+ze.slice(0,-1)+'\\]':ze,Qe=new RegExp($.HOST_PREFIX+$e+$.HOST_SUFFIX),Ze=ge.get(Ye).styleRules,Je=this._elementKeyframeTransforms(Ye,Ze,qe);return fe.elementStyles(Ye,Ze,function(et){We.applyProperties(et,Ge),G||R(et)||!et.cssText||(We.applyKeyframeTransforms(et,Je),We._scopeSelector(et,Qe,ze,qe))})}_elementKeyframeTransforms(Ye,Ge,qe){let We=Ge._keyframes,ze={};if(!G&&We)for(let $e=0,Qe=We[$e];$e<We.length;Qe=We[++$e])this._scopeKeyframes(Qe,qe),ze[Qe.keyframesName]=this._keyframesRuleTransformer(Qe);return ze}_keyframesRuleTransformer(Ye){return function(Ge){return Ge.replace(Ye.keyframesNameRx,Ye.transformedKeyframesName)}}_scopeKeyframes(Ye,Ge){Ye.keyframesNameRx=new RegExp(Ye.keyframesName,'g'),Ye.transformedKeyframesName=Ye.keyframesName+'-'+Ge,Ye.transformedSelector=Ye.transformedSelector||Ye.selector,Ye.selector=Ye.transformedSelector.replace(Ye.keyframesName,Ye.transformedKeyframesName)}_scopeSelector(Ye,Ge,qe,We){Ye.transformedSelector=Ye.transformedSelector||Ye.selector;let ze=Ye.transformedSelector,$e='.'+We,Qe=ze.split(',');for(let et,Ze=0,Je=Qe.length;Ze<Je&&(et=Qe[Ze]);Ze++)Qe[Ze]=et.match(Ge)?et.replace(qe,$e):$e+' '+et;Ye.selector=Qe.join(',')}applyElementScopeSelector(Ye,Ge,qe){let We=Ye.getAttribute('class')||'',ze=We;qe&&(ze=We.replace(new RegExp('\\s*'+Ae+'\\s*'+qe+'\\s*','g'),' ')),ze+=(ze?' ':'')+Ae+' '+Ge,We!==ze&&H(Ye,ze)}applyElementStyle(Ye,Ge,qe,We){let ze=We?We.textContent||'':this.transformStyles(Ye,Ge,qe),$e=ge.get(Ye),Qe=$e.customStyle;return Qe&&!G&&Qe!==We&&(Qe._useCount--,0>=Qe._useCount&&Qe.parentNode&&Qe.parentNode.removeChild(Qe)),G?$e.customStyle?($e.customStyle.textContent=ze,We=$e.customStyle):ze&&(We=I(ze,qe,Ye.shadowRoot,$e.placeholder)):We?!We.parentNode&&O(We,null,$e.placeholder):ze&&(We=I(ze,qe,null,$e.placeholder)),We&&(We._useCount=We._useCount||0,$e.customStyle!=We&&We._useCount++,$e.customStyle=We),Ee&&(We.textContent=We.textContent),We}applyCustomStyle(Ye,Ge){let qe=N(Ye),We=this;Ye.textContent=T(qe,function(ze){let $e=ze.cssText=ze.parsedCssText;ze.propertyInfo&&ze.propertyInfo.cssText&&($e=g($e),ze.cssText=We.valueForProperties($e,Ge))})}}var Ne=new Te;let ve={};const Re=window.customElements;if(Re&&!G){const Ye=Re.define;Re.define=function(Ge,qe,We){return ve[Ge]=b(Ge),Ye.call(Re,Ge,qe,We)}}let Ie=$.MIXIN_MATCH,Oe=$.VAR_ASSIGN,Me=/;\s*/m,be=/^\s*(initial)|(inherit)\s*$/,we='_-_';class Le{constructor(){this._map={}}set(Ye,Ge){Ye=Ye.trim(),this._map[Ye]={properties:Ge,dependants:{}}}get(Ye){return Ye=Ye.trim(),this._map[Ye]}}class He{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new Le,this._separator=we,this._boundProduceCssProperties=(Ye,Ge,qe,We)=>this._produceCssProperties(Ye,Ge,qe,We)}detectMixin(Ye){const Ge=Ie.test(Ye)||Oe.test(Ye);return Ie.lastIndex=0,Oe.lastIndex=0,Ge}transformStyle(Ye,Ge){let qe=N(Ye);return this.transformRules(qe,Ge),qe}transformRules(Ye,Ge){this._currentTemplate=Se[Ge],P(Ye,qe=>{this.transformRule(qe)}),this._currentTemplate=null}transformRule(Ye){Ye.cssText=this.transformCssText(Ye.parsedCssText),':root'===Ye.selector&&(Ye.selector=':host > *')}transformCssText(Ye){return Ye=Ye.replace(Oe,this._boundProduceCssProperties),this._consumeCssProperties(Ye)}_getInitialValueForProperty(Ye){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(Ye)}_consumeCssProperties(Ye){for(let Ge;Ge=Ie.exec(Ye);){let qe=Ge[0],We=Ge[1],ze=Ge.index,$e=ze+qe.indexOf('@apply'),Qe=ze+qe.length,Ze=Ye.slice(0,$e),Je=Ye.slice(Qe),et=this._cssTextToMap(Ze),tt=this._atApplyToCssProperties(We,et);Ye=[Ze,tt,Je].join(''),Ie.lastIndex=ze+tt.length}return Ye}_atApplyToCssProperties(Ye,Ge){Ye=Ye.replace(Me,'');let qe=[],We=this._map.get(Ye);if(We||(this._map.set(Ye,{}),We=this._map.get(Ye)),We){this._currentTemplate&&(We.dependants[this._currentTemplate.name]=this._currentTemplate);let ze,$e,Qe;for(ze in We.properties)Qe=Ge&&Ge[ze],$e=[ze,': var(',Ye,we,ze],Qe&&$e.push(',',Qe),$e.push(')'),qe.push($e.join(''))}return qe.join('; ')}_replaceInitialOrInherit(Ye,Ge){let qe=be.exec(Ge);return qe&&(qe[1]?Ge=He._getInitialValueForProperty(Ye):Ge='apply-shim-inherit'),Ge}_cssTextToMap(Ye){let Ge=Ye.split(';'),qe,We,ze={};for(let Qe,Ze,$e=0;$e<Ge.length;$e++)Qe=Ge[$e],Qe&&(Ze=Qe.split(':'),1<Ze.length&&(qe=Ze[0].trim(),We=this._replaceInitialOrInherit(qe,Ze.slice(1).join(':')),ze[qe]=We));return ze}_invalidateMixinEntry(Ye){for(let Ge in Ye.dependants)this._currentTemplate&&Ge===this._currentTemplate.name||ge.invalidate(Ge)}_produceCssProperties(Ye,Ge,qe,We){if(qe&&L(qe,(ot,lt)=>{lt&&this._map.get(lt)&&(We='@apply '+lt+';')}),!We)return Ye;let ze=this._consumeCssProperties(We),$e=Ye.slice(0,Ye.indexOf('--')),Qe=this._cssTextToMap(ze),Ze=Qe,Je=this._map.get(Ge),et=Je&&Je.properties;et?Ze=Object.assign(Object.create(et),Qe):this._map.set(Ge,Ze);let st,rt,tt=[],nt=!1;for(st in Ze)rt=Qe[st],void 0==rt&&(rt='initial'),et&&!(st in et)&&(nt=!0),tt.push(Ge+we+st+': '+rt);return nt&&this._invalidateMixinEntry(Je),Je&&(Je.properties=Ze),qe&&($e=Ye+';'+$e),$e+tt.join('; ')+';'}}let De=new He;window.ApplyShim=De;let Fe=function(){};if(!G){let Ye=$e=>{return $e.classList&&!$e.classList.contains(fe.SCOPE_NAME)||$e instanceof SVGElement&&(!$e.hasAttribute('class')||0>$e.getAttribute('class').indexOf(fe.SCOPE_NAME))},Ge=$e=>{for(let Ze,Qe=0;Qe<$e.length;Qe++)if(Ze=$e[Qe],Ze.target!==document.documentElement&&Ze.target!==document.head){for(let et,Je=0;Je<Ze.addedNodes.length;Je++)if(et=Ze.addedNodes[Je],Ye(et)){let tt=et.getRootNode();if(tt.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let st=tt.host;if(st){let rt=st.is||st.localName;fe.dom(et,rt)}}}for(let et,Je=0;Je<Ze.removedNodes.length;Je++)if(et=Ze.removedNodes[Je],et.nodeType===Node.ELEMENT_NODE){let tt;if(et.classList?tt=Array.from(et.classList):et.hasAttribute('class')&&(tt=et.getAttribute('class').split(/\s+/)),void 0!=tt){let st=tt.indexOf(fe.SCOPE_NAME);if(0<=st){let rt=tt[st+1];rt&&fe.dom(et,rt,!0)}}}}},qe=new MutationObserver(Ge),We=$e=>{qe.observe($e,{childList:!0,subtree:!0})},ze=window.customElements&&!window.customElements.flush;if(ze)We(document);else{let $e=()=>{We(document.body)};window.HTMLImports?window.HTMLImports.whenReady($e):requestAnimationFrame(function(){if('loading'===document.readyState){let Qe=function(){$e(),document.removeEventListener('readystatechange',Qe)};document.addEventListener('readystatechange',Qe)}else $e()})}Fe=function(){Ge(qe.takeRecords())}}let ke=new class{constructor(Ye=100){this.cache={},this.typeMax=Ye}_validate(Ye,Ge,qe){for(let ze,We=0;We<qe.length;We++)if(ze=qe[We],Ye.properties[ze]!==Ge[ze])return!1;return!0}store(Ye,Ge,qe,We){let ze=this.cache[Ye]||[];ze.push({properties:Ge,styleElement:qe,scopeSelector:We}),ze.length>this.typeMax&&ze.shift(),this.cache[Ye]=ze}fetch(Ye,Ge,qe){let We=this.cache[Ye];if(We)for(let $e,ze=We.length-1;0<=ze;ze--)if($e=We[ze],this._validate($e,Ge,qe))return $e}};class Ue{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=ge.set(document.documentElement,new ge({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return G}get nativeCss(){return q}get nativeCssApply(){return!1}flush(){Fe()}_generateScopeSelector(Ye){let Ge=this._scopeCounter[Ye]=(this._scopeCounter[Ye]||0)+1;return`${Ye}-${Ge}`}getStyleAst(Ye){return N(Ye)}styleAstToString(Ye){return T(Ye)}_gatherStyles(Ye){let Ge=Ye.content.querySelectorAll('style'),qe=[];for(let ze,We=0;We<Ge.length;We++)ze=Ge[We],qe.push(ze.textContent),ze.parentNode.removeChild(ze);return qe.join('').trim()}_getCssBuild(Ye){let Ge=Ye.content.querySelector('style');return Ge?Ge.getAttribute('css-build')||'':''}prepareTemplate(Ye,Ge,qe){if(!Ye._prepared){Ye._prepared=!0,Ye.name=Ge,Ye.extends=qe,Se[Ge]=Ye;let We=this._getCssBuild(Ye),ze=this._gatherStyles(Ye),$e={is:Ge,extends:qe,__cssBuild:We};this.nativeShadow||fe.dom(Ye.content,Ge);let Qe=De.detectMixin(ze),Ze=e(ze);Qe&&this.nativeCss&&!this.nativeCssApply&&De.transformRules(Ze,Ge),Ye._styleAst=Ze;let Je=[];if(this.nativeCss||(Je=Ne.decorateStyles(Ye._styleAst,$e)),!Je.length||this.nativeCss){let et=this.nativeShadow?Ye.content:null,tt=ve[Ge],st=this._generateStaticStyle($e,Ye._styleAst,et,tt);Ye._style=st}Ye._ownPropertyNames=Je}}_generateStaticStyle(Ye,Ge,qe,We){let ze=fe.elementStyles(Ye,Ge);if(ze.length)return I(ze,Ye.is,qe,We)}_prepareHost(Ye){let qe,Ge=Ye.getAttribute('is')||Ye.localName;Ge!==Ye.localName&&(qe=Ye.localName);let $e,Qe,Ze,We=ve[Ge],ze=Se[Ge];return ze&&($e=ze._styleAst,Qe=ze._ownPropertyNames,Ze=ze._cssBuild),ge.set(Ye,new ge($e,We,Qe,Ge,qe,Ze))}applyStyle(Ye,Ge){let qe=Ye.getAttribute('is')||Ye.localName,We=ge.get(Ye),ze=!!We;if(We||(We=this._prepareHost(Ye)),this._isRootOwner(Ye)||(this._elementsHaveApplied=!0),window.CustomStyle){let $e=window.CustomStyle;if($e._documentDirty){if($e.findStyles(),this.nativeCss?!this.nativeCssApply&&$e._revalidateApplyShim():this._updateProperties(this._documentOwner,this._documentOwnerStyleInfo),$e.applyStyles(),!this._elementsHaveApplied)return;if(!this.nativeCss&&(this.updateStyles(),ze))return}}if(Ge&&(We.overrideStyleProperties=We.overrideStyleProperties||{},Object.assign(We.overrideStyleProperties,Ge)),this.nativeCss){We.overrideStyleProperties&&this._updateNativeProperties(Ye,We.overrideStyleProperties);let $e=Se[qe];if(!$e&&!this._isRootOwner(Ye))return;if($e&&$e._applyShimInvalid&&$e._style){if($e._validating||(De.transformRules($e._styleAst,qe),$e._style.textContent=fe.elementStyles(Ye,We.styleRules),ge.startValidating(qe)),this.nativeShadow){let Qe=Ye.shadowRoot;if(Qe){let Ze=Qe.querySelector('style');Ze.textContent=fe.elementStyles(Ye,We.styleRules)}}We.styleRules=$e._styleAst}}else this._updateProperties(Ye,We),We.ownStylePropertyNames&&We.ownStylePropertyNames.length&&this._applyStyleProperties(Ye,We);if(ze){let $e=this._isRootOwner(Ye)?Ye:Ye.shadowRoot;$e&&this._applyToDescendants($e)}}_applyToDescendants(Ye){let Ge=Ye.children;for(let We,qe=0;qe<Ge.length;qe++)We=Ge[qe],We.shadowRoot&&this.applyStyle(We),this._applyToDescendants(We)}_styleOwnerForNode(Ye){let Ge=Ye.getRootNode(),qe=Ge.host;return qe?ge.get(qe)?qe:this._styleOwnerForNode(qe):this._documentOwner}_isRootOwner(Ye){return Ye===this._documentOwner}_applyStyleProperties(Ye,Ge){let qe=Ye.getAttribute('is')||Ye.localName,We=ke.fetch(qe,Ge.styleProperties,Ge.ownStylePropertyNames),ze=We&&We.scopeSelector,$e=We?We.styleElement:null,Qe=Ge.scopeSelector;Ge.scopeSelector=ze||this._generateScopeSelector(qe);let Ze=Ne.applyElementStyle(Ye,Ge.styleProperties,Ge.scopeSelector,$e);return this.nativeShadow||Ne.applyElementScopeSelector(Ye,Ge.scopeSelector,Qe),We||ke.store(qe,Ge.styleProperties,Ze,Ge.scopeSelector),Ze}_updateProperties(Ye,Ge){let qe=this._styleOwnerForNode(Ye),We=ge.get(qe),ze=We.styleProperties,$e=Object.create(ze||null),Qe=Ne.hostAndRootPropertiesForScope(Ye,Ge.styleRules),Ze=Ne.propertyDataFromStyles(We.styleRules,Ye),Je=Ze.properties;Object.assign($e,Qe.hostProps,Je,Qe.rootProps),this._mixinOverrideStyles($e,Ge.overrideStyleProperties),Ne.reify($e),Ge.styleProperties=$e}_mixinOverrideStyles(Ye,Ge){for(let qe in Ge){let We=Ge[qe];(We||0===We)&&(Ye[qe]=We)}}_updateNativeProperties(Ye,Ge){for(let qe in Ge)null===qe?Ye.style.removeProperty(qe):Ye.style.setProperty(qe,Ge[qe])}updateStyles(Ye){this.applyStyle(this._documentOwner,Ye)}_transformCustomStyleForDocument(Ye){let Ge=N(Ye);P(Ge,qe=>{G?fe.normalizeRootSelector(qe):fe.documentRule(qe),this.nativeCss&&!this.nativeCssApply&&De.transformRule(qe)}),this.nativeCss?Ye.textContent=T(Ge):this._documentOwnerStyleInfo.styleRules.rules.push(Ge)}_revalidateApplyShim(Ye){if(this.nativeCss&&!this.nativeCssApply){let Ge=N(Ye);De.transformRules(Ge),Ye.textContent=T(Ge)}}_applyCustomStyleToDocument(Ye){this.nativeCss||Ne.applyCustomStyle(Ye,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(Ye,Ge){let qe;if(!this.nativeCss){let We=ge.get(Ye)||ge.get(this._styleOwnerForNode(Ye));qe=We.styleProperties[Ge]}return qe=qe||window.getComputedStyle(Ye).getPropertyValue(Ge),qe.trim()}setElementClass(Ye,Ge){let qe=Ye.getRootNode(),We=Ge?Ge.split(/\s/):[],ze=qe.host&&qe.host.localName;if(!ze){var $e=Ye.getAttribute('class');if($e){let Qe=$e.split(/\s/);for(let Ze=0;Ze<Qe.length;Ze++)if(Qe[Ze]===fe.SCOPE_NAME){ze=Qe[Ze+1];break}}}if(ze&&We.push(fe.SCOPE_NAME,ze),!this.nativeCss){let Qe=ge.get(Ye);Qe&&Qe.scopeSelector&&We.push(Ne.XSCOPE_NAME,Qe.scopeSelector)}H(Ye,We.join(' '))}_styleInfoForNode(Ye){return ge.get(Ye)}}window.ShadyCSS=new Ue;let Ke=window.ShadyCSS,Xe=!1,Be=[],je=null;class Ve extends HTMLElement{static get _customStyles(){return Be}static get processHook(){return je}static set processHook(Ye){je=Ye}static get _documentDirty(){return Xe}static findStyles(){for(let Ge,Ye=0;Ye<Be.length;Ye++)if(Ge=Be[Ye],!Ge._style){let qe=Ge.querySelector('style');if(!qe)continue;if(qe.__appliedElement)for(let ze,We=0;We<qe.attributes.length;We++)ze=qe.attributes[We],qe.__appliedElement.setAttribute(ze.name,ze.value);Ge._style=qe.__appliedElement||qe,je&&je(Ge._style),Ke._transformCustomStyleForDocument(Ge._style)}}static _revalidateApplyShim(){for(let Ge,Ye=0;Ye<Be.length;Ye++)Ge=Be[Ye],Ge._style&&Ke._revalidateApplyShim(Ge._style)}static applyStyles(){for(let Ge,Ye=0;Ye<Be.length;Ye++)Ge=Be[Ye],Ge._style&&Ke._applyCustomStyleToDocument(Ge._style);Xe=!1}constructor(){super(),Be.push(this),F()}}window.CustomStyle=Ve,window.customElements.define('custom-style',Ve),function(){var Ge=document.createElement('style');Ge.textContent='body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n';var qe=document.querySelector('head');qe.insertBefore(Ge,qe.firstChild)}(window.WebComponents)})();
|
|
//# sourceMappingURL=webcomponents-none.js.map
|