@webcomponents/shadycss
Advanced tools
Comparing version 1.3.5 to 1.4.0
@@ -0,1 +1,3 @@ | ||
/** @externs */ | ||
/** @typedef {{ | ||
@@ -28,2 +30,2 @@ * styleElement: function(!HTMLElement), | ||
/** @type {(ShadyCSSInterface | ShadyCSSOptions | undefined)} */ | ||
window.ShadyCSS; | ||
window.ShadyCSS; |
{ | ||
"name": "@webcomponents/shadycss", | ||
"version": "1.3.5", | ||
"version": "1.4.0", | ||
"description": "Styling helpers for ShadyDOM", | ||
@@ -30,2 +30,3 @@ "main": "shadycss.min.js", | ||
"build": "gulp", | ||
"build:debug": "gulp debug", | ||
"lint": "eslint src test entrypoints", | ||
@@ -47,5 +48,5 @@ "test": "npm run lint && gulp && wct", | ||
"devDependencies": { | ||
"@webcomponents/custom-elements": "^1.1.2", | ||
"@webcomponents/custom-elements": "^1.1.3", | ||
"@webcomponents/html-imports": "^1.2.0", | ||
"@webcomponents/shadydom": "^1.0.14", | ||
"@webcomponents/shadydom": "^1.1.2", | ||
"@webcomponents/template": "^1.3.1", | ||
@@ -56,6 +57,6 @@ "@webcomponents/webcomponents-platform": "^1.0.0", | ||
"eslint": "^4.19.1", | ||
"eslint-plugin-html": "^4.0.3", | ||
"eslint-plugin-html": "^4.0.5", | ||
"google-closure-compiler": "^20180506.0.0", | ||
"gulp": "^3.8.8", | ||
"gulp-rename": "^1.3.0", | ||
"gulp-rename": "^1.4.0", | ||
"gulp-size": "^2.1.0", | ||
@@ -68,3 +69,3 @@ "gulp-sourcemaps": "^2.6.4", | ||
"wct-browser-legacy": "^1.0.1", | ||
"web-component-tester": "^6.6.0" | ||
"web-component-tester": "^6.7.1" | ||
}, | ||
@@ -71,0 +72,0 @@ "publishConfig": { |
@@ -11,44 +11,45 @@ (function(){/* | ||
'use strict';var l,aa="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function m(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""} | ||
function n(a){a=a.replace(ba,"").replace(ca,"");var b=da,c=a,e=new m;e.start=0;e.end=c.length;for(var d=e,f=0,h=c.length;f<h;f++)if("{"===c[f]){d.rules||(d.rules=[]);var g=d,k=g.rules[g.rules.length-1]||null;d=new m;d.start=f+1;d.parent=g;d.previous=k;g.rules.push(d)}else"}"===c[f]&&(d.end=f+1,d=d.parent||e);return b(e,a)} | ||
function n(a){a=a.replace(ba,"").replace(ca,"");var b=da,c=a,e=new m;e.start=0;e.end=c.length;for(var d=e,f=0,g=c.length;f<g;f++)if("{"===c[f]){d.rules||(d.rules=[]);var h=d,k=h.rules[h.rules.length-1]||null;d=new m;d.start=f+1;d.parent=h;d.previous=k;h.rules.push(d)}else"}"===c[f]&&(d.end=f+1,d=d.parent||e);return b(e,a)} | ||
function da(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=ea(c),c=c.replace(fa," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=ha:c.match(ia)&&(a.type=p,a.keyframesName=a.selector.split(fa).pop()):a.type=0===c.indexOf("--")?ja:ka);if(c=a.rules)for(var e=0,d=c.length,f;e<d&&(f=c[e]);e++)da(f,b); | ||
return a}function ea(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})} | ||
function la(a,b,c){c=void 0===c?"":c;var e="";if(a.cssText||a.rules){var d=a.rules,f;if(f=d)f=d[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var h=d.length,g;f<h&&(g=d[f]);f++)e=la(g,b,e)}else b?b=a.cssText:(b=a.cssText,b=b.replace(ma,"").replace(na,""),b=b.replace(oa,"").replace(pa,"")),(e=b.trim())&&(e=" "+e+"\n")}e&&(a.selector&&(c+=a.selector+" {\n"),c+=e,a.selector&&(c+="}\n\n"));return c} | ||
var ka=1,p=7,ha=4,ja=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,ma=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,na=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,oa=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,pa=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ia=/^@[^\s]*keyframes/,fa=/\s+/g;var q=!(window.ShadyDOM&&window.ShadyDOM.inUse),r;function qa(a){r=a&&a.shimcssproperties?!1:q||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?r=window.ShadyCSS.nativeCss:window.ShadyCSS?(qa(window.ShadyCSS),window.ShadyCSS=void 0):qa(window.WebComponents&&window.WebComponents.flags);var u=r;var v=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,w=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,ra=/(--[\w-]+)\s*([:,;)]|$)/gi,sa=/(animation\s*:)|(animation-name\s*:)/,ta=/@media\s(.*)/,ua=/\{[^}]*\}/g;var va=new Set;function y(a,b){if(!a)return"";"string"===typeof a&&(a=n(a));b&&z(a,b);return la(a,u)}function A(a){!a.__cssRules&&a.textContent&&(a.__cssRules=n(a.textContent));return a.__cssRules||null}function wa(a){return!!a.parent&&a.parent.type===p}function z(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===ha){var h=a.selector.match(ta);h&&(window.matchMedia(h[1]).matches||(d=!0))}f===ka?b(a):c&&f===p?c(a):f===ja&&(d=!0);if((a=a.rules)&&!d){d=0;f=a.length;for(var g;d<f&&(g=a[d]);d++)z(g,b,c,e)}}} | ||
function B(a,b,c,e){var d=document.createElement("style");b&&d.setAttribute("scope",b);d.textContent=a;xa(d,c,e);return d}var C=null;function xa(a,b,c){b=b||document.head;b.insertBefore(a,c&&c.nextSibling||b.firstChild);C?a.compareDocumentPosition(C)===Node.DOCUMENT_POSITION_PRECEDING&&(C=a):C=a} | ||
function ya(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");a:{var e=0;var d=c+3;for(var f=a.length;d<f;d++)if("("===a[d])e++;else if(")"===a[d]&&0===--e)break a;d=-1}e=a.substring(c+4,d);c=a.substring(0,c);a=ya(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)}function D(a,b){q?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)} | ||
function E(a){var b=a.localName,c="";b?-1<b.indexOf("-")||(c=b,b=a.getAttribute&&a.getAttribute("is")||""):(b=a.is,c=a.extends);return{is:b,u:c}};function F(){}function za(a,b){var c=G;a.__styleScoped?a.__styleScoped=null:H(c,a,function(a){I(a,b||"")})}function H(a,b,c){b.nodeType===Node.ELEMENT_NODE&&c(b);if(b="template"===b.localName?(b.content||b.w||b).childNodes:b.children||b.childNodes)for(var e=0;e<b.length;e++)H(a,b[e],c)} | ||
function I(a,b,c){if(b)if(a.classList)c?(a.classList.remove("style-scope"),a.classList.remove(b)):(a.classList.add("style-scope"),a.classList.add(b));else if(a.getAttribute){var e=a.getAttribute(Aa);c?e&&(b=e.replace("style-scope","").replace(b,""),D(a,b)):D(a,(e?e+" ":"")+"style-scope "+b)}}function Ba(a,b,c){var e=G;a.__styleScoped?a.__styleScoped=null:H(e,a,function(a){I(a,b,!0);I(a,c)})}function Ca(a,b){var c=G;a.__styleScoped?a.__styleScoped=null:H(c,a,function(a){I(a,b||"",!0)})} | ||
function J(a,b,c){var e=G,d=a.__cssBuild;q||"shady"===d?b=y(b,c):(a=E(a),b=Da(e,b,a.is,a.u,c)+"\n\n");return b.trim()}function Da(a,b,c,e,d){var f=K(c,e);c=c?Ea+c:"";return y(b,function(b){b.c||(b.selector=b.g=L(a,b,a.b,c,f),b.c=!0);d&&d(b,c,f)})}function K(a,b){return b?"[is="+a+"]":a}function L(a,b,c,e,d){var f=b.selector.split(Fa);if(!wa(b)){b=0;for(var h=f.length,g;b<h&&(g=f[b]);b++)f[b]=c.call(a,g,e,d)}return f.join(Fa)} | ||
function Ga(a){return a.replace(M,function(a,c,e){-1<e.indexOf("+")?e=e.replace(/\+/g,"___"):-1<e.indexOf("___")&&(e=e.replace(/___/g,"+"));return":"+c+"("+e+")"})}F.prototype.b=function(a,b,c){var e=!1;a=a.trim();var d=M.test(a);d&&(a=a.replace(M,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"}),a=Ga(a));a=a.replace(Ha,O+" $1");a=a.replace(Ia,function(a,d,g){e||(a=Ja(g,d,b,c),e=e||a.stop,d=a.F,g=a.value);return d+g});d&&(a=Ga(a));return a}; | ||
function Ja(a,b,c,e){var d=a.indexOf(Ka);0<=a.indexOf(O)?a=La(a,e):0!==d&&(a=c?Ma(a,c):a);c=!1;0<=d&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Na,function(a,b){return" > "+b}))}a=a.replace(Oa,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,F:b,stop:f}}function Ma(a,b){a=a.split(Pa);a[0]+=b;return a.join(Pa)} | ||
function La(a,b){var c=a.match(Qa);return(c=c&&c[2].trim()||"")?c[0].match(Ra)?a.replace(Qa,function(a,c,f){return b+f}):c.split(Ra)[0]===b?c:Sa:a.replace(O,b)}function Ta(a){a.selector===Ua&&(a.selector="html")}F.prototype.c=function(a){return a.match(Ka)?this.b(a,Va):Ma(a.trim(),Va)};aa.Object.defineProperties(F.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}}); | ||
var M=/:(nth[-\w]+)\(([^)]+)\)/,Va=":not(.style-scope)",Fa=",",Ia=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Ra=/[[.:#*]/,O=":host",Ua=":root",Ka="::slotted",Ha=new RegExp("^("+Ka+")"),Qa=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Na=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Oa=/(.*):dir\((?:(ltr|rtl))\)/,Ea=".",Pa=":",Aa="class",Sa="should_not_match",G=new F;function P(a,b,c,e){this.j=a||null;this.b=b||null;this.A=c||[];this.o=null;this.u=e||"";this.a=this.h=this.m=null}function Q(a){return a?a.__styleInfo:null}function Wa(a,b){return a.__styleInfo=b}P.prototype.c=function(){return this.j};P.prototype._getStyleRules=P.prototype.c;function Xa(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var Ya=navigator.userAgent.match("Trident");function Za(){}function $a(a){var b={},c=[],e=0;z(a,function(a){R(a);a.index=e++;a=a.f.cssText;for(var c;c=ra.exec(a);){var d=c[1];":"!==c[2]&&(b[d]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var d in b)a.push(d);return a} | ||
function R(a){if(!a.f){var b={},c={};S(a,c)&&(b.i=c,a.rules=null);b.cssText=a.parsedCssText.replace(ua,"").replace(v,"");a.f=b}}function S(a,b){var c=a.f;if(c){if(c.i)return Object.assign(b,c.i),!0}else{c=a.parsedCssText;for(var e;a=v.exec(c);){e=(a[2]||a[3]).trim();if("inherit"!==e||"unset"!==e)b[a[1].trim()]=e;e=!0}return e}} | ||
function T(a,b,c){b&&(b=0<=b.indexOf(";")?ab(a,b,c):ya(b,function(b,d,f,h){if(!d)return b+h;(d=T(a,c[d],c))&&"initial"!==d?"apply-shim-inherit"===d&&(d="inherit"):d=T(a,c[f]||f,c)||f;return b+(d||"")+h}));return b&&b.trim()||""} | ||
function ab(a,b,c){b=b.split(";");for(var e=0,d,f;e<b.length;e++)if(d=b[e]){w.lastIndex=0;if(f=w.exec(d))d=T(a,c[f[1]],c);else if(f=d.indexOf(":"),-1!==f){var h=d.substring(f);h=h.trim();h=T(a,h,c)||h;d=d.substring(0,f)+h}b[e]=d&&d.lastIndexOf(";")===d.length-1?d.slice(0,-1):d||""}return b.join(";")} | ||
function bb(a,b){var c={},e=[];z(a,function(a){a.f||R(a);var d=a.g||a.parsedSelector;b&&a.f.i&&d&&Xa.call(b,d)&&(S(a,c),a=a.index,d=parseInt(a/32,10),e[d]=(e[d]||0)|1<<a%32)},null,!0);return{i:c,key:e}} | ||
function cb(a,b,c,e){b.f||R(b);if(b.f.i){var d=E(a);a=d.is;d=d.u;d=a?K(a,d):"html";var f=b.parsedSelector,h=":host > *"===f||"html"===f,g=0===f.indexOf(":host")&&!h;"shady"===c&&(h=f===d+" > *."+d||-1!==f.indexOf("html"),g=!h&&0===f.indexOf(d));"shadow"===c&&(h=":host > *"===f||"html"===f,g=g&&!h);if(h||g)c=d,g&&(b.g||(b.g=L(G,b,G.b,a?Ea+a:"",d)),c=b.g||d),e({K:c,I:g,P:h})}} | ||
function db(a,b){var c={},e={},d=b&&b.__cssBuild;z(b,function(b){cb(a,b,d,function(d){Xa.call(a.R||a,d.K)&&(d.I?S(b,c):S(b,e))})},null,!0);return{J:e,H:c}} | ||
function eb(a,b,c,e){var d=E(b),f=K(d.is,d.u),h=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])");d=Q(b).j;var g=fb(d,e);return J(b,d,function(b){var d="";b.f||R(b);b.f.cssText&&(d=ab(a,b.f.cssText,c));b.cssText=d;if(!q&&!wa(b)&&b.cssText){var k=d=b.cssText;null==b.B&&(b.B=sa.test(d));if(b.B)if(null==b.v){b.v=[];for(var t in g)k=g[t],k=k(d),d!==k&&(d=k,b.v.push(t))}else{for(t=0;t<b.v.length;++t)k=g[b.v[t]],d=k(d);k=d}b.cssText=k;b.g=b.g||b.selector;d="."+e;t=b.g.split(","); | ||
k=0;for(var tb=t.length,N;k<tb&&(N=t[k]);k++)t[k]=N.match(h)?N.replace(f,d):d+" "+N;b.selector=t.join(",")}})}function fb(a,b){a=a.b;var c={};if(!q&&a)for(var e=0,d=a[e];e<a.length;d=a[++e]){var f=d,h=b;f.l=new RegExp("\\b"+f.keyframesName+"(?!\\B|-)","g");f.a=f.keyframesName+"-"+h;f.g=f.g||f.selector;f.selector=f.g.replace(f.keyframesName,f.a);c[d.keyframesName]=gb(d)}return c}function gb(a){return function(b){return b.replace(a.l,a.a)}} | ||
function hb(a,b){var c=U,e=A(a);a.textContent=y(e,function(a){var d=a.cssText=a.parsedCssText;a.f&&a.f.cssText&&(d=d.replace(ma,"").replace(na,""),a.cssText=ab(c,d,b))})}aa.Object.defineProperties(Za.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var U=new Za;var ib={},V=window.customElements;if(V&&!q){var jb=V.define;V.define=function(a,b,c){var e=document.createComment(" Shady DOM styles for "+a+" "),d=document.head;d.insertBefore(e,(C?C.nextSibling:null)||d.firstChild);C=e;ib[a]=e;jb.call(V,a,b,c)}};function kb(){this.cache={}}kb.prototype.store=function(a,b,c,e){var d=this.cache[a]||[];d.push({i:b,styleElement:c,h:e});100<d.length&&d.shift();this.cache[a]=d};function lb(){} | ||
function mb(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var e=0;e<c.addedNodes.length;e++){var d=c.addedNodes[e];if(d.nodeType===Node.ELEMENT_NODE){var f=d.getRootNode();var h=d;var g=[];h.classList?g=Array.from(h.classList):h instanceof window.SVGElement&&h.hasAttribute("class")&&(g=h.getAttribute("class").split(/\s+/));h=g;g=h.indexOf(G.a);if((h=-1<g?h[g+1]:"")&&f===d.ownerDocument)Ca(d,h);else if(f.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(f= | ||
f.host))for(f=E(f).is,f!==h&&Ba(d,h,f),d=window.ShadyDOM.nativeMethods.querySelectorAll.call(d,":not(."+G.a+")"),f=0;f<d.length;f++)if(h=d[f],g=h.getRootNode().host)g=E(g).is,I(h,g)}}}} | ||
if(!q){var nb=new MutationObserver(mb),ob=function(a){nb.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)ob(document);else{var pb=function(){ob(document.body)};window.HTMLImports?window.HTMLImports.whenReady(pb):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){pb();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",a)}else pb()})}lb=function(){mb(nb.takeRecords())}} | ||
var qb=lb;var W={};var rb=Promise.resolve();function sb(a){if(a=W[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function ub(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function vb(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.b||(a.b=!0,rb.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a.b=!1}))};var wb=new kb;function X(){this.w={};this.c=document.documentElement;var a=new m;a.rules=[];this.l=Wa(this.c,new P(a));this.s=!1;this.b=this.a=null}l=X.prototype;l.flush=function(){qb()};l.G=function(a){return A(a)};l.M=function(a){return y(a)};l.prepareTemplate=function(a,b,c){this.prepareTemplateDom(a,b);this.prepareTemplateStyles(a,b,c)}; | ||
l.prepareTemplateStyles=function(a,b,c){if(!a.s){a.s=!0;a.name=b;a.extends=c;W[b]=a;var e=(e=a.content.querySelector("style"))?e.getAttribute("css-build")||"":"";var d=[];for(var f=a.content.querySelectorAll("style"),h=0;h<f.length;h++){var g=f[h];if(g.hasAttribute("shady-unscoped")){if(!q){var k=g.textContent;va.has(k)||(va.add(k),k=g.cloneNode(!0),document.head.appendChild(k));g.parentNode.removeChild(g)}}else d.push(g.textContent),g.parentNode.removeChild(g)}d=d.join("").trim();c={is:b,extends:c, | ||
N:e};Y(this);f=w.test(d)||v.test(d);w.lastIndex=0;v.lastIndex=0;d=n(d);f&&u&&this.a&&this.a.transformRules(d,b);a._styleAst=d;a.O=e;e=[];u||(e=$a(a._styleAst));if(!e.length||u)d=q?a.content:null,b=ib[b],f=J(c,a._styleAst),b=f.length?B(f,c.is,d,b):void 0,a.a=b;a.l=e}};l.prepareTemplateDom=function(a,b){q||a.c||(a.c=!0,za(a.content,b))}; | ||
function xb(a){!a.b&&window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface&&(a.b=window.ShadyCSS.CustomStyleInterface,a.b.transformCallback=function(b){a.C(b)},a.b.validateCallback=function(){requestAnimationFrame(function(){(a.b.enqueued||a.s)&&a.flushCustomStyles()})})}function Y(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=sb);xb(a)} | ||
l.flushCustomStyles=function(){Y(this);if(this.b){var a=this.b.processStyles();if(this.b.enqueued){if(u)for(var b=0;b<a.length;b++){var c=this.b.getStyleForCustomStyle(a[b]);if(c&&u&&this.a){var e=A(c);Y(this);this.a.transformRules(e);c.textContent=y(e)}}else for(yb(this,this.c,this.l),b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&hb(c,this.l.m);this.b.enqueued=!1;this.s&&!u&&this.styleDocument()}}}; | ||
l.styleElement=function(a,b){var c=E(a).is,e=Q(a);if(!e){var d=E(a);e=d.is;d=d.u;var f=ib[e];e=W[e];if(e){var h=e._styleAst;var g=e.l}e=Wa(a,new P(h,f,g,d))}a!==this.c&&(this.s=!0);b&&(e.o=e.o||{},Object.assign(e.o,b));if(u){if(e.o){b=e.o;for(var k in b)null===k?a.style.removeProperty(k):a.style.setProperty(k,b[k])}if(((k=W[c])||a===this.c)&&k&&k.a&&!ub(k)){if(ub(k)||k._applyShimValidatingVersion!==k._applyShimNextVersion)Y(this),this.a&&this.a.transformRules(k._styleAst,c),k.a.textContent=J(a,e.j), | ||
vb(k);q&&(c=a.shadowRoot)&&(c.querySelector("style").textContent=J(a,e.j));e.j=k._styleAst}}else if(this.flush(),yb(this,a,e),e.A&&e.A.length){c=e;k=E(a).is;a:{if(b=wb.cache[k])for(h=b.length-1;0<=h;h--){g=b[h];b:{e=c.A;for(d=0;d<e.length;d++)if(f=e[d],g.i[f]!==c.m[f]){e=!1;break b}e=!0}if(e){b=g;break a}}b=void 0}e=b?b.styleElement:null;h=c.h;(g=b&&b.h)||(g=this.w[k]=(this.w[k]||0)+1,g=k+"-"+g);c.h=g;g=c.h;d=U;d=e?e.textContent||"":eb(d,a,c.m,g);f=Q(a);var x=f.a;x&&!q&&x!==e&&(x._useCount--,0>=x._useCount&& | ||
x.parentNode&&x.parentNode.removeChild(x));q?f.a?(f.a.textContent=d,e=f.a):d&&(e=B(d,g,a.shadowRoot,f.b)):e?e.parentNode||(Ya&&-1<d.indexOf("@media")&&(e.textContent=d),xa(e,null,f.b)):d&&(e=B(d,g,null,f.b));e&&(e._useCount=e._useCount||0,f.a!=e&&e._useCount++,f.a=e);g=e;q||(e=c.h,f=d=a.getAttribute("class")||"",h&&(f=d.replace(new RegExp("\\s*x-scope\\s*"+h+"\\s*","g")," ")),f+=(f?" ":"")+"x-scope "+e,d!==f&&D(a,f));b||wb.store(k,c.m,g,c.h)}}; | ||
function zb(a,b){return(b=b.getRootNode().host)?Q(b)?b:zb(a,b):a.c}function yb(a,b,c){a=zb(a,b);var e=Q(a);a=Object.create(e.m||null);var d=db(b,c.j);b=bb(e.j,b).i;Object.assign(a,d.H,b,d.J);b=c.o;for(var f in b)if((d=b[f])||0===d)a[f]=d;f=U;b=Object.getOwnPropertyNames(a);for(d=0;d<b.length;d++)e=b[d],a[e]=T(f,a[e],a);c.m=a}l.styleDocument=function(a){this.styleSubtree(this.c,a)}; | ||
l.styleSubtree=function(a,b){var c=a.shadowRoot;(c||a===this.c)&&this.styleElement(a,b);if(b=c&&(c.children||c.childNodes))for(a=0;a<b.length;a++)this.styleSubtree(b[a]);else if(a=a.children||a.childNodes)for(b=0;b<a.length;b++)this.styleSubtree(a[b])};l.C=function(a){var b=this,c=A(a);z(c,function(a){if(q)Ta(a);else{var c=G;a.selector=a.parsedSelector;Ta(a);a.selector=a.g=L(c,a,c.c,void 0,void 0)}u&&(Y(b),b.a&&b.a.transformRule(a))});u?a.textContent=y(c):this.l.j.rules.push(c)}; | ||
l.getComputedStyleValue=function(a,b){var c;u||(c=(Q(a)||Q(zb(this,a))).m[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};l.L=function(a,b){var c=a.getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var e=a.getAttribute("class");if(e){e=e.split(/\s/);for(var d=0;d<e.length;d++)if(e[d]===G.a){c=e[d+1];break}}}c&&b.push(G.a,c);u||(c=Q(a))&&c.h&&b.push(U.a,c.h);D(a,b.join(" "))};l.D=function(a){return Q(a)};X.prototype.flush=X.prototype.flush; | ||
X.prototype.prepareTemplate=X.prototype.prepareTemplate;X.prototype.styleElement=X.prototype.styleElement;X.prototype.styleDocument=X.prototype.styleDocument;X.prototype.styleSubtree=X.prototype.styleSubtree;X.prototype.getComputedStyleValue=X.prototype.getComputedStyleValue;X.prototype.setElementClass=X.prototype.L;X.prototype._styleInfoForNode=X.prototype.D;X.prototype.transformCustomStyleForDocument=X.prototype.C;X.prototype.getStyleAst=X.prototype.G;X.prototype.styleAstToString=X.prototype.M; | ||
X.prototype.flushCustomStyles=X.prototype.flushCustomStyles;Object.defineProperties(X.prototype,{nativeShadow:{get:function(){return q}},nativeCss:{get:function(){return u}}});var Z=new X,Ab,Bb;window.ShadyCSS&&(Ab=window.ShadyCSS.ApplyShim,Bb=window.ShadyCSS.CustomStyleInterface); | ||
function la(a,b,c){c=void 0===c?"":c;var e="";if(a.cssText||a.rules){var d=a.rules,f;if(f=d)f=d[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=d.length,h;f<g&&(h=d[f]);f++)e=la(h,b,e)}else b?b=a.cssText:(b=a.cssText,b=b.replace(ma,"").replace(na,""),b=b.replace(oa,"").replace(pa,"")),(e=b.trim())&&(e=" "+e+"\n")}e&&(a.selector&&(c+=a.selector+" {\n"),c+=e,a.selector&&(c+="}\n\n"));return c} | ||
var ka=1,p=7,ha=4,ja=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,ma=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,na=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,oa=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,pa=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ia=/^@[^\s]*keyframes/,fa=/\s+/g;var q=!(window.ShadyDOM&&window.ShadyDOM.inUse),r;function qa(a){r=a&&a.shimcssproperties?!1:q||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?r=window.ShadyCSS.nativeCss:window.ShadyCSS?(qa(window.ShadyCSS),window.ShadyCSS=void 0):qa(window.WebComponents&&window.WebComponents.flags);var u=r;var v=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,w=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,ra=/(--[\w-]+)\s*([:,;)]|$)/gi,sa=/(animation\s*:)|(animation-name\s*:)/,ta=/@media\s(.*)/,ua=/\{[^}]*\}/g;var va=new Set;function y(a,b){if(!a)return"";"string"===typeof a&&(a=n(a));b&&z(a,b);return la(a,u)}function A(a){!a.__cssRules&&a.textContent&&(a.__cssRules=n(a.textContent));return a.__cssRules||null}function wa(a){return!!a.parent&&a.parent.type===p}function z(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===ha){var g=a.selector.match(ta);g&&(window.matchMedia(g[1]).matches||(d=!0))}f===ka?b(a):c&&f===p?c(a):f===ja&&(d=!0);if((a=a.rules)&&!d){d=0;f=a.length;for(var h;d<f&&(h=a[d]);d++)z(h,b,c,e)}}} | ||
function B(a,b,c,e){var d=document.createElement("style");b&&d.setAttribute("scope",b);d.textContent=a;xa(d,c,e);return d}var C=null;function ya(a){a=document.createComment(" Shady DOM styles for "+a+" ");var b=document.head;b.insertBefore(a,(C?C.nextSibling:null)||b.firstChild);return C=a}function xa(a,b,c){b=b||document.head;b.insertBefore(a,c&&c.nextSibling||b.firstChild);C?a.compareDocumentPosition(C)===Node.DOCUMENT_POSITION_PRECEDING&&(C=a):C=a} | ||
function D(a,b){for(var c=0,e=a.length;b<e;b++)if("("===a[b])c++;else if(")"===a[b]&&0===--c)return b;return-1}function za(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");var e=D(a,c+3),d=a.substring(c+4,e);c=a.substring(0,c);a=za(a.substring(e+1),b);e=d.indexOf(",");return-1===e?b(c,d.trim(),"",a):b(c,d.substring(0,e).trim(),d.substring(e+1).trim(),a)}function E(a,b){q?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)} | ||
function F(a){var b=a.localName,c="";b?-1<b.indexOf("-")||(c=b,b=a.getAttribute&&a.getAttribute("is")||""):(b=a.is,c=a.extends);return{is:b,u:c}}function Aa(a){for(var b=[],c="",e=0;0<=e&&e<a.length;e++)if("("===a[e]){var d=D(a,e);c+=a.slice(e,d+1);e=d}else","===a[e]?(b.push(c),c=""):c+=a[e];c&&b.push(c);return b};function G(){}function Ba(a,b){var c=H;a.__styleScoped?a.__styleScoped=null:I(c,a,function(a){J(a,b||"")})}function I(a,b,c){b.nodeType===Node.ELEMENT_NODE&&c(b);if(b="template"===b.localName?(b.content||b.w||b).childNodes:b.children||b.childNodes)for(var e=0;e<b.length;e++)I(a,b[e],c)} | ||
function J(a,b,c){if(b)if(a.classList)c?(a.classList.remove("style-scope"),a.classList.remove(b)):(a.classList.add("style-scope"),a.classList.add(b));else if(a.getAttribute){var e=a.getAttribute(Ca);c?e&&(b=e.replace("style-scope","").replace(b,""),E(a,b)):E(a,(e?e+" ":"")+"style-scope "+b)}}function Da(a,b,c){var e=H;a.__styleScoped?a.__styleScoped=null:I(e,a,function(a){J(a,b,!0);J(a,c)})}function Ea(a,b){var c=H;a.__styleScoped?a.__styleScoped=null:I(c,a,function(a){J(a,b||"",!0)})} | ||
function K(a,b,c){var e=H,d=a.__cssBuild;q||"shady"===d?b=y(b,c):(a=F(a),b=Fa(e,b,a.is,a.u,c)+"\n\n");return b.trim()}function Fa(a,b,c,e,d){var f=L(c,e);c=c?Ga+c:"";return y(b,function(b){b.c||(b.selector=b.g=Ha(a,b,a.b,c,f),b.c=!0);d&&d(b,c,f)})}function L(a,b){return b?"[is="+a+"]":a}function Ha(a,b,c,e,d){var f=Aa(b.selector);if(!wa(b)){b=0;for(var g=f.length,h;b<g&&(h=f[b]);b++)f[b]=c.call(a,h,e,d)}return f.filter(function(a){return!!a}).join(Ia)} | ||
function Ja(a){return a.replace(Ka,function(a,c,e){-1<e.indexOf("+")?e=e.replace(/\+/g,"___"):-1<e.indexOf("___")&&(e=e.replace(/___/g,"+"));return":"+c+"("+e+")"})}function La(a){for(var b=[],c;c=a.match(Ma);){var e=c.index,d=D(a,e);if(-1===d)throw Error(c.input+" selector missing ')'");c=a.slice(e,d+1);a=a.replace(c,"\ue000");b.push(c)}return{B:a,matches:b}}function Na(a,b){var c=a.split("\ue000");return b.reduce(function(a,b,f){return a+b+c[f+1]},c[0])} | ||
G.prototype.b=function(a,b,c){var e=!1;a=a.trim();var d=Ka.test(a);d&&(a=a.replace(Ka,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"}),a=Ja(a));var f=Ma.test(a);if(f){var g=La(a);a=g.B;g=g.matches}a=a.replace(Oa,M+" $1");a=a.replace(Pa,function(a,d,f){e||(a=Qa(f,d,b,c),e=e||a.stop,d=a.G,f=a.value);return d+f});f&&(a=Na(a,g));d&&(a=Ja(a));return a}; | ||
function Qa(a,b,c,e){var d=a.indexOf(Ra);0<=a.indexOf(M)?a=Sa(a,e):0!==d&&(a=c?Ta(a,c):a);c=!1;0<=d&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Ua,function(a,b){return" > "+b}))}a=a.replace(Va,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,G:b,stop:f}}function Ta(a,b){a=a.split(Wa);a[0]+=b;return a.join(Wa)} | ||
function Sa(a,b){var c=a.match(Xa);return(c=c&&c[2].trim()||"")?c[0].match(Ya)?a.replace(Xa,function(a,c,f){return b+f}):c.split(Ya)[0]===b?c:Za:a.replace(M,b)}function $a(a){a.selector===ab&&(a.selector="html")}G.prototype.c=function(a){return a.match(M)?"":a.match(Ra)?this.b(a,bb):Ta(a.trim(),bb)};aa.Object.defineProperties(G.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}}); | ||
var Ka=/:(nth[-\w]+)\(([^)]+)\)/,bb=":not(.style-scope)",Ia=",",Pa=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Ya=/[[.:#*]/,M=":host",ab=":root",Ra="::slotted",Oa=new RegExp("^("+Ra+")"),Xa=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Ua=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Va=/(.*):dir\((?:(ltr|rtl))\)/,Ga=".",Wa=":",Ca="class",Za="should_not_match",Ma=/:(?:matches|any|-(?:webkit|moz)-any)/,H=new G;function N(a,b,c,e){this.j=a||null;this.b=b||null;this.A=c||[];this.o=null;this.u=e||"";this.a=this.h=this.m=null}function O(a){return a?a.__styleInfo:null}function cb(a,b){return a.__styleInfo=b}N.prototype.c=function(){return this.j};N.prototype._getStyleRules=N.prototype.c;function db(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var eb=navigator.userAgent.match("Trident");function fb(){}function gb(a){var b={},c=[],e=0;z(a,function(a){Q(a);a.index=e++;a=a.f.cssText;for(var c;c=ra.exec(a);){var d=c[1];":"!==c[2]&&(b[d]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var d in b)a.push(d);return a} | ||
function Q(a){if(!a.f){var b={},c={};R(a,c)&&(b.i=c,a.rules=null);b.cssText=a.parsedCssText.replace(ua,"").replace(v,"");a.f=b}}function R(a,b){var c=a.f;if(c){if(c.i)return Object.assign(b,c.i),!0}else{c=a.parsedCssText;for(var e;a=v.exec(c);){e=(a[2]||a[3]).trim();if("inherit"!==e||"unset"!==e)b[a[1].trim()]=e;e=!0}return e}} | ||
function S(a,b,c){b&&(b=0<=b.indexOf(";")?hb(a,b,c):za(b,function(b,d,f,g){if(!d)return b+g;(d=S(a,c[d],c))&&"initial"!==d?"apply-shim-inherit"===d&&(d="inherit"):d=S(a,c[f]||f,c)||f;return b+(d||"")+g}));return b&&b.trim()||""} | ||
function hb(a,b,c){b=b.split(";");for(var e=0,d,f;e<b.length;e++)if(d=b[e]){w.lastIndex=0;if(f=w.exec(d))d=S(a,c[f[1]],c);else if(f=d.indexOf(":"),-1!==f){var g=d.substring(f);g=g.trim();g=S(a,g,c)||g;d=d.substring(0,f)+g}b[e]=d&&d.lastIndexOf(";")===d.length-1?d.slice(0,-1):d||""}return b.join(";")} | ||
function ib(a,b){var c={},e=[];z(a,function(a){a.f||Q(a);var d=a.g||a.parsedSelector;b&&a.f.i&&d&&db.call(b,d)&&(R(a,c),a=a.index,d=parseInt(a/32,10),e[d]=(e[d]||0)|1<<a%32)},null,!0);return{i:c,key:e}} | ||
function jb(a,b,c,e){b.f||Q(b);if(b.f.i){var d=F(a);a=d.is;d=d.u;d=a?L(a,d):"html";var f=b.parsedSelector,g=":host > *"===f||"html"===f,h=0===f.indexOf(":host")&&!g;"shady"===c&&(g=f===d+" > *."+d||-1!==f.indexOf("html"),h=!g&&0===f.indexOf(d));"shadow"===c&&(g=":host > *"===f||"html"===f,h=h&&!g);if(g||h)c=d,h&&(b.g||(b.g=Ha(H,b,H.b,a?Ga+a:"",d)),c=b.g||d),e({B:c,J:h,P:g})}} | ||
function kb(a,b){var c={},e={},d=b&&b.__cssBuild;z(b,function(b){jb(a,b,d,function(d){db.call(a.R||a,d.B)&&(d.J?R(b,c):R(b,e))})},null,!0);return{K:e,I:c}} | ||
function lb(a,b,c,e){var d=F(b),f=L(d.is,d.u),g=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])");d=O(b).j;var h=mb(d,e);return K(b,d,function(b){var d="";b.f||Q(b);b.f.cssText&&(d=hb(a,b.f.cssText,c));b.cssText=d;if(!q&&!wa(b)&&b.cssText){var k=d=b.cssText;null==b.C&&(b.C=sa.test(d));if(b.C)if(null==b.v){b.v=[];for(var t in h)k=h[t],k=k(d),d!==k&&(d=k,b.v.push(t))}else{for(t=0;t<b.v.length;++t)k=h[b.v[t]],d=k(d);k=d}b.cssText=k;b.g=b.g||b.selector;d="."+e;t=Aa(b.g); | ||
k=0;for(var zb=t.length,P;k<zb&&(P=t[k]);k++)t[k]=P.match(g)?P.replace(f,d):d+" "+P;b.selector=t.join(",")}})}function mb(a,b){a=a.b;var c={};if(!q&&a)for(var e=0,d=a[e];e<a.length;d=a[++e]){var f=d,g=b;f.l=new RegExp("\\b"+f.keyframesName+"(?!\\B|-)","g");f.a=f.keyframesName+"-"+g;f.g=f.g||f.selector;f.selector=f.g.replace(f.keyframesName,f.a);c[d.keyframesName]=nb(d)}return c}function nb(a){return function(b){return b.replace(a.l,a.a)}} | ||
function ob(a,b){var c=T,e=A(a);a.textContent=y(e,function(a){var d=a.cssText=a.parsedCssText;a.f&&a.f.cssText&&(d=d.replace(ma,"").replace(na,""),a.cssText=hb(c,d,b))})}aa.Object.defineProperties(fb.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var T=new fb;var U={},V=window.customElements;if(V&&!q){var pb=V.define;V.define=function(a,b,c){U[a]||(U[a]=ya(a));pb.call(V,a,b,c)}};function qb(){this.cache={}}qb.prototype.store=function(a,b,c,e){var d=this.cache[a]||[];d.push({i:b,styleElement:c,h:e});100<d.length&&d.shift();this.cache[a]=d};function rb(){} | ||
function sb(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var e=0;e<c.addedNodes.length;e++){var d=c.addedNodes[e];if(d.nodeType===Node.ELEMENT_NODE){var f=d.getRootNode();var g=d;var h=[];g.classList?h=Array.from(g.classList):g instanceof window.SVGElement&&g.hasAttribute("class")&&(h=g.getAttribute("class").split(/\s+/));g=h;h=g.indexOf(H.a);if((g=-1<h?g[h+1]:"")&&f===d.ownerDocument)Ea(d,g);else if(f.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(f= | ||
f.host))for(f=F(f).is,f!==g&&Da(d,g,f),d=window.ShadyDOM.nativeMethods.querySelectorAll.call(d,":not(."+H.a+")"),f=0;f<d.length;f++)if(g=d[f],h=g.getRootNode().host)h=F(h).is,J(g,h)}}}} | ||
if(!q){var tb=new MutationObserver(sb),ub=function(a){tb.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)ub(document);else{var vb=function(){ub(document.body)};window.HTMLImports?window.HTMLImports.whenReady(vb):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){vb();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",a)}else vb()})}rb=function(){sb(tb.takeRecords())}} | ||
var wb=rb;var W={};var xb=Promise.resolve();function yb(a){if(a=W[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function Ab(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function Bb(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.b||(a.b=!0,xb.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a.b=!1}))};var Cb=new qb;function X(){this.w={};this.c=document.documentElement;var a=new m;a.rules=[];this.l=cb(this.c,new N(a));this.s=!1;this.b=this.a=null}l=X.prototype;l.flush=function(){wb()};l.H=function(a){return A(a)};l.M=function(a){return y(a)};l.prepareTemplate=function(a,b,c){this.prepareTemplateDom(a,b);this.prepareTemplateStyles(a,b,c)}; | ||
l.prepareTemplateStyles=function(a,b,c){if(!a.s){q||U[b]||(U[b]=ya(b));a.s=!0;a.name=b;a.extends=c;W[b]=a;var e=(e=a.content.querySelector("style"))?e.getAttribute("css-build")||"":"";var d=[];for(var f=a.content.querySelectorAll("style"),g=0;g<f.length;g++){var h=f[g];if(h.hasAttribute("shady-unscoped")){if(!q){var k=h.textContent;va.has(k)||(va.add(k),k=h.cloneNode(!0),document.head.appendChild(k));h.parentNode.removeChild(h)}}else d.push(h.textContent),h.parentNode.removeChild(h)}d=d.join("").trim(); | ||
c={is:b,extends:c,N:e};Y(this);f=w.test(d)||v.test(d);w.lastIndex=0;v.lastIndex=0;d=n(d);f&&u&&this.a&&this.a.transformRules(d,b);a._styleAst=d;a.O=e;e=[];u||(e=gb(a._styleAst));if(!e.length||u)d=q?a.content:null,b=U[b]||null,f=K(c,a._styleAst),b=f.length?B(f,c.is,d,b):void 0,a.a=b;a.l=e}};l.prepareTemplateDom=function(a,b){q||a.c||(a.c=!0,Ba(a.content,b))}; | ||
function Db(a){!a.b&&window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface&&(a.b=window.ShadyCSS.CustomStyleInterface,a.b.transformCallback=function(b){a.D(b)},a.b.validateCallback=function(){requestAnimationFrame(function(){(a.b.enqueued||a.s)&&a.flushCustomStyles()})})}function Y(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=yb);Db(a)} | ||
l.flushCustomStyles=function(){Y(this);if(this.b){var a=this.b.processStyles();if(this.b.enqueued){if(u)for(var b=0;b<a.length;b++){var c=this.b.getStyleForCustomStyle(a[b]);if(c&&u&&this.a){var e=A(c);Y(this);this.a.transformRules(e);c.textContent=y(e)}}else for(Eb(this,this.c,this.l),b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&ob(c,this.l.m);this.b.enqueued=!1;this.s&&!u&&this.styleDocument()}}}; | ||
l.styleElement=function(a,b){var c=F(a).is,e=O(a);if(!e){var d=F(a);e=d.is;d=d.u;var f=U[e]||null;e=W[e];if(e){var g=e._styleAst;var h=e.l}g=new N(g,f,h,d);e&&cb(a,g);e=g}a!==this.c&&(this.s=!0);b&&(e.o=e.o||{},Object.assign(e.o,b));if(u){if(e.o){b=e.o;for(var k in b)null===k?a.style.removeProperty(k):a.style.setProperty(k,b[k])}if(((k=W[c])||a===this.c)&&k&&k.a&&!Ab(k)){if(Ab(k)||k._applyShimValidatingVersion!==k._applyShimNextVersion)Y(this),this.a&&this.a.transformRules(k._styleAst,c),k.a.textContent= | ||
K(a,e.j),Bb(k);q&&(c=a.shadowRoot)&&(c.querySelector("style").textContent=K(a,e.j));e.j=k._styleAst}}else if(this.flush(),Eb(this,a,e),e.A&&e.A.length){c=e;k=F(a).is;a:{if(b=Cb.cache[k])for(g=b.length-1;0<=g;g--){h=b[g];b:{e=c.A;for(d=0;d<e.length;d++)if(f=e[d],h.i[f]!==c.m[f]){e=!1;break b}e=!0}if(e){b=h;break a}}b=void 0}e=b?b.styleElement:null;g=c.h;(h=b&&b.h)||(h=this.w[k]=(this.w[k]||0)+1,h=k+"-"+h);c.h=h;h=c.h;d=T;d=e?e.textContent||"":lb(d,a,c.m,h);f=O(a);var x=f.a;x&&!q&&x!==e&&(x._useCount--, | ||
0>=x._useCount&&x.parentNode&&x.parentNode.removeChild(x));q?f.a?(f.a.textContent=d,e=f.a):d&&(e=B(d,h,a.shadowRoot,f.b)):e?e.parentNode||(eb&&-1<d.indexOf("@media")&&(e.textContent=d),xa(e,null,f.b)):d&&(e=B(d,h,null,f.b));e&&(e._useCount=e._useCount||0,f.a!=e&&e._useCount++,f.a=e);h=e;q||(e=c.h,f=d=a.getAttribute("class")||"",g&&(f=d.replace(new RegExp("\\s*x-scope\\s*"+g+"\\s*","g")," ")),f+=(f?" ":"")+"x-scope "+e,d!==f&&E(a,f));b||Cb.store(k,c.m,h,c.h)}}; | ||
function Fb(a,b){return(b=b.getRootNode().host)?O(b)?b:Fb(a,b):a.c}function Eb(a,b,c){a=Fb(a,b);var e=O(a);a=Object.create(e.m||null);var d=kb(b,c.j);b=ib(e.j,b).i;Object.assign(a,d.I,b,d.K);b=c.o;for(var f in b)if((d=b[f])||0===d)a[f]=d;f=T;b=Object.getOwnPropertyNames(a);for(d=0;d<b.length;d++)e=b[d],a[e]=S(f,a[e],a);c.m=a}l.styleDocument=function(a){this.styleSubtree(this.c,a)}; | ||
l.styleSubtree=function(a,b){var c=a.shadowRoot;(c||a===this.c)&&this.styleElement(a,b);if(b=c&&(c.children||c.childNodes))for(a=0;a<b.length;a++)this.styleSubtree(b[a]);else if(a=a.children||a.childNodes)for(b=0;b<a.length;b++)this.styleSubtree(a[b])};l.D=function(a){var b=this,c=A(a);z(c,function(a){if(q)$a(a);else{var c=H;a.selector=a.parsedSelector;$a(a);a.selector=a.g=Ha(c,a,c.c,void 0,void 0)}u&&(Y(b),b.a&&b.a.transformRule(a))});u?a.textContent=y(c):this.l.j.rules.push(c)}; | ||
l.getComputedStyleValue=function(a,b){var c;u||(c=(O(a)||O(Fb(this,a))).m[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};l.L=function(a,b){var c=a.getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var e=a.getAttribute("class");if(e){e=e.split(/\s/);for(var d=0;d<e.length;d++)if(e[d]===H.a){c=e[d+1];break}}}c&&b.push(H.a,c);u||(c=O(a))&&c.h&&b.push(T.a,c.h);E(a,b.join(" "))};l.F=function(a){return O(a)};X.prototype.flush=X.prototype.flush; | ||
X.prototype.prepareTemplate=X.prototype.prepareTemplate;X.prototype.styleElement=X.prototype.styleElement;X.prototype.styleDocument=X.prototype.styleDocument;X.prototype.styleSubtree=X.prototype.styleSubtree;X.prototype.getComputedStyleValue=X.prototype.getComputedStyleValue;X.prototype.setElementClass=X.prototype.L;X.prototype._styleInfoForNode=X.prototype.F;X.prototype.transformCustomStyleForDocument=X.prototype.D;X.prototype.getStyleAst=X.prototype.H;X.prototype.styleAstToString=X.prototype.M; | ||
X.prototype.flushCustomStyles=X.prototype.flushCustomStyles;Object.defineProperties(X.prototype,{nativeShadow:{get:function(){return q}},nativeCss:{get:function(){return u}}});var Z=new X,Gb,Hb;window.ShadyCSS&&(Gb=window.ShadyCSS.ApplyShim,Hb=window.ShadyCSS.CustomStyleInterface); | ||
window.ShadyCSS={ScopingShim:Z,prepareTemplate:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplate(a,b,c)},prepareTemplateDom:function(a,b){Z.prepareTemplateDom(a,b)},prepareTemplateStyles:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplateStyles(a,b,c)},styleSubtree:function(a,b){Z.flushCustomStyles();Z.styleSubtree(a,b)},styleElement:function(a){Z.flushCustomStyles();Z.styleElement(a)},styleDocument:function(a){Z.flushCustomStyles();Z.styleDocument(a)},flushCustomStyles:function(){Z.flushCustomStyles()}, | ||
getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:u,nativeShadow:q};Ab&&(window.ShadyCSS.ApplyShim=Ab);Bb&&(window.ShadyCSS.CustomStyleInterface=Bb);}).call(this); | ||
getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:u,nativeShadow:q};Gb&&(window.ShadyCSS.ApplyShim=Gb);Hb&&(window.ShadyCSS.CustomStyleInterface=Hb);}).call(this); | ||
//# sourceMappingURL=scoping-shim.min.js.map |
@@ -18,3 +18,3 @@ /** | ||
import StyleProperties from './style-properties.js'; | ||
import placeholderMap from './style-placeholder.js'; | ||
import {ensureStylePlaceholder, getStylePlaceholder} from './style-placeholder.js'; | ||
import StyleInfo from './style-info.js'; | ||
@@ -36,3 +36,3 @@ import StyleCache from './style-cache.js'; | ||
this._scopeCounter = {}; | ||
this._documentOwner = document.documentElement; | ||
this._documentOwner = /** @type {!HTMLElement} */(document.documentElement); | ||
let ast = new StyleNode(); | ||
@@ -90,2 +90,6 @@ ast['rules'] = []; | ||
} | ||
// style placeholders are only used when ShadyDOM is active | ||
if (!nativeShadow) { | ||
ensureStylePlaceholder(elementName); | ||
} | ||
template._prepared = true; | ||
@@ -119,3 +123,3 @@ template.name = elementName; | ||
let root = nativeShadow ? template.content : null; | ||
let placeholder = placeholderMap[elementName]; | ||
let placeholder = getStylePlaceholder(elementName); | ||
let style = this._generateStaticStyle(info, template['_styleAst'], root, placeholder); | ||
@@ -145,3 +149,3 @@ template._style = style; | ||
let {is, typeExtension} = StyleUtil.getIsExtends(host); | ||
let placeholder = placeholderMap[is]; | ||
let placeholder = getStylePlaceholder(is) | ||
let template = templateMap[is]; | ||
@@ -156,12 +160,15 @@ let ast; | ||
} | ||
return StyleInfo.set(host, | ||
new StyleInfo( | ||
ast, | ||
placeholder, | ||
ownStylePropertyNames, | ||
is, | ||
typeExtension, | ||
cssBuild | ||
) | ||
const styleInfo = new StyleInfo( | ||
ast, | ||
placeholder, | ||
ownStylePropertyNames, | ||
is, | ||
typeExtension, | ||
cssBuild | ||
); | ||
// only set the style info after this element has registered its template | ||
if (template) { | ||
StyleInfo.set(host, styleInfo); | ||
} | ||
return styleInfo; | ||
} | ||
@@ -168,0 +175,0 @@ _ensureApplyShim() { |
@@ -16,6 +16,23 @@ /** | ||
/** @type {Object<string, !Node>} */ | ||
let placeholderMap = {}; | ||
/** @type {!Object<string, !Node>} */ | ||
const placeholderMap = {}; | ||
/** | ||
* @param {string} elementName | ||
* @return {Node} | ||
*/ | ||
export function getStylePlaceholder(elementName) { | ||
return placeholderMap[elementName] || null; | ||
} | ||
/** | ||
* @param {string} elementName | ||
*/ | ||
export function ensureStylePlaceholder(elementName) { | ||
if (!placeholderMap[elementName]) { | ||
placeholderMap[elementName] = applyStylePlaceHolder(elementName); | ||
} | ||
} | ||
/** | ||
* @const {CustomElementRegistry} | ||
@@ -35,8 +52,6 @@ */ | ||
const wrappedDefine = (name, clazz, options) => { | ||
placeholderMap[name] = applyStylePlaceHolder(name); | ||
ensureStylePlaceholder(name); | ||
origDefine.call(/** @type {!CustomElementRegistry} */(ce), name, clazz, options); | ||
}; | ||
ce['define'] = wrappedDefine; | ||
} | ||
export default placeholderMap; | ||
} |
@@ -484,3 +484,3 @@ /** | ||
let scope = '.' + scopeId; | ||
let parts = selector.split(','); | ||
let parts = StyleUtil.splitSelectorList(selector); | ||
for (let i=0, l=parts.length, p; (i<l) && (p=parts[i]); i++) { | ||
@@ -487,0 +487,0 @@ parts[i] = p.match(hostRx) ? |
@@ -250,3 +250,3 @@ /** | ||
_transformRuleCss(rule, transformer, scope, hostScope) { | ||
let p$ = rule['selector'].split(COMPLEX_SELECTOR_SEP); | ||
let p$ = StyleUtil.splitSelectorList(rule['selector']); | ||
// we want to skip transformation of rules that appear in keyframes, | ||
@@ -259,3 +259,3 @@ // because they are keyframe selectors, not element selectors. | ||
} | ||
return p$.join(COMPLEX_SELECTOR_SEP); | ||
return p$.filter((part) => Boolean(part)).join(COMPLEX_SELECTOR_SEP); | ||
} | ||
@@ -278,2 +278,40 @@ | ||
/** | ||
* Preserve `:matches()` selectors by replacing them with MATCHES_REPLACMENT | ||
* and returning an array of `:matches()` selectors. | ||
* Use `_replacesMatchesPseudo` to replace the `:matches()` parts | ||
* | ||
* @param {string} selector | ||
* @return {{selector: string, matches: !Array<string>}} | ||
*/ | ||
_preserveMatchesPseudo(selector) { | ||
/** @type {!Array<string>} */ | ||
const matches = []; | ||
let match; | ||
while ((match = selector.match(MATCHES))) { | ||
const start = match.index; | ||
const end = StyleUtil.findMatchingParen(selector, start); | ||
if (end === -1) { | ||
throw new Error(`${match.input} selector missing ')'`) | ||
} | ||
const part = selector.slice(start, end + 1); | ||
selector = selector.replace(part, MATCHES_REPLACEMENT); | ||
matches.push(part); | ||
} | ||
return {selector, matches}; | ||
} | ||
/** | ||
* Replace MATCHES_REPLACMENT character with the given set of `:matches()` | ||
* selectors. | ||
* | ||
* @param {string} selector | ||
* @param {!Array<string>} matches | ||
* @return {string} | ||
*/ | ||
_replaceMatchesPseudo(selector, matches) { | ||
const parts = selector.split(MATCHES_REPLACEMENT); | ||
return matches.reduce((acc, cur, idx) => acc + cur + parts[idx + 1], parts[0]); | ||
} | ||
/** | ||
@@ -293,2 +331,10 @@ * @param {string} selector | ||
} | ||
// Preserve selectors like `:-webkit-any` so that SIMPLE_SELECTOR_SEP does | ||
// not get confused by spaces inside the pseudo selector | ||
const isMatches = MATCHES.test(selector); | ||
/** @type {!Array<string>} */ | ||
let matches; | ||
if (isMatches) { | ||
({selector, matches} = this._preserveMatchesPseudo(selector)); | ||
} | ||
selector = selector.replace(SLOTTED_START, `${HOST} $1`); | ||
@@ -304,2 +350,6 @@ selector = selector.replace(SIMPLE_SELECTOR_SEP, (m, c, s) => { | ||
}); | ||
// replace `:matches()` selectors | ||
if (isMatches) { | ||
selector = this._replaceMatchesPseudo(selector, matches); | ||
} | ||
if (isNth) { | ||
@@ -404,5 +454,10 @@ selector = this._twiddleNthPlus(selector); | ||
_transformDocumentSelector(selector) { | ||
return selector.match(SLOTTED) ? | ||
this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) : | ||
this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR); | ||
if (selector.match(HOST)) { | ||
// remove ':host' type selectors in document rules | ||
return ''; | ||
} else if (selector.match(SLOTTED)) { | ||
return this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) | ||
} else { | ||
return this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR); | ||
} | ||
} | ||
@@ -431,3 +486,5 @@ } | ||
let SELECTOR_NO_MATCH = 'should_not_match'; | ||
const MATCHES = /:(?:matches|any|-(?:webkit|moz)-any)/; | ||
const MATCHES_REPLACEMENT = '\u{e000}'; | ||
export default new StyleTransformer() |
@@ -192,3 +192,3 @@ /** | ||
*/ | ||
function findMatchingParen(text, start) { | ||
export function findMatchingParen(text, start) { | ||
let level = 0; | ||
@@ -295,2 +295,33 @@ for (let i=start, l=text.length; i < l; i++) { | ||
return styleTextParts.join('').trim(); | ||
} | ||
/** | ||
* Split a selector separated by commas into an array in a smart way | ||
* @param {string} selector | ||
* @return {!Array<string>} | ||
*/ | ||
export function splitSelectorList(selector) { | ||
const parts = []; | ||
let part = ''; | ||
for (let i = 0; i >= 0 && i < selector.length; i++) { | ||
// A selector with parentheses will be one complete part | ||
if (selector[i] === '(') { | ||
// find the matching paren | ||
const end = findMatchingParen(selector, i); | ||
// push the paren block into the part | ||
part += selector.slice(i, end + 1); | ||
// move the index to after the paren block | ||
i = end; | ||
} else if (selector[i] === ',') { | ||
parts.push(part); | ||
part = ''; | ||
} else { | ||
part += selector[i]; | ||
} | ||
} | ||
// catch any pieces after the last comma | ||
if (part) { | ||
parts.push(part); | ||
} | ||
return parts; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
420202
3857