aboutsummaryrefslogtreecommitdiff
path: root/catapult/third_party/polymer/components/shadycss/scoping-shim.min.js
blob: 61794b41c32bb7789ae2172600c5de0f4c17a8e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(function(){/*

Copyright (c) 2017 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
*/
'use strict';var k,aa="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function n(){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 p(a){a=a.replace(ba,"").replace(ca,"");var b=da,c=a,e=new n;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,l=h.rules[h.rules.length-1]||null;d=new n;d.start=f+1;d.parent=h;d.previous=l;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=q,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=void 0;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 g=d.length,h=void 0;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,q=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 r=!(window.ShadyDOM&&window.ShadyDOM.inUse),t;function qa(a){t=a&&a.shimcssproperties?!1:r||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var ra;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(ra=window.ShadyCSS.cssBuild);window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?t=window.ShadyCSS.nativeCss:window.ShadyCSS?(qa(window.ShadyCSS),window.ShadyCSS=void 0):qa(window.WebComponents&&window.WebComponents.flags);
var u=t,v=ra;var w=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,x=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,sa=/(--[\w-]+)\s*([:,;)]|$)/gi,ta=/(animation\s*:)|(animation-name\s*:)/,ua=/@media\s(.*)/,va=/\{[^}]*\}/g;var wa=new Set;function y(a,b){if(!a)return"";"string"===typeof a&&(a=p(a));b&&z(a,b);return la(a,u)}function A(a){!a.__cssRules&&a.textContent&&(a.__cssRules=p(a.textContent));return a.__cssRules||null}function xa(a){return!!a.parent&&a.parent.type===q}function z(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===ha){var g=a.selector.match(ua);g&&(window.matchMedia(g[1]).matches||(d=!0))}f===ka?b(a):c&&f===q?c(a):f===ja&&(d=!0);if((a=a.rules)&&!d)for(d=0,f=a.length,g=void 0;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;ya(d,c,e);return d}var C=null;function za(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 ya(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 Aa(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=Aa(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){r?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)}
var F=window.ShadyDOM&&window.ShadyDOM.wrap||function(a){return a};function G(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,s:c}}function Ba(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 H(a){if(void 0!==v)return v;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""}
function Ca(a){a=void 0===a?"":a;return""!==a&&u?r?"shadow"===a:"shady"===a:!1};function I(){}function Da(a,b){J(K,a,function(a){L(a,b||"")})}function J(a,b,c){b.nodeType===Node.ELEMENT_NODE&&c(b);var e;"template"===b.localName?e=(b.content||b._content||b).childNodes:e=b.children||b.childNodes;if(e)for(b=0;b<e.length;b++)J(a,e[b],c)}
function L(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("class");c?e&&(b=e.replace("style-scope","").replace(b,""),E(a,b)):E(a,(e?e+" ":"")+"style-scope "+b)}}function Ea(a,b,c){J(K,a,function(a){L(a,b,!0);L(a,c)})}function Fa(a,b){J(K,a,function(a){L(a,b||"",!0)})}
function M(a,b,c,e,d){var f=K;d=void 0===d?"":d;""===d&&(r||"shady"===(void 0===e?"":e)?d=y(b,c):(a=G(a),d=Ga(f,b,a.is,a.s,c)+"\n\n"));return d.trim()}function Ga(a,b,c,e,d){var f=Ha(c,e);c=c?"."+c:"";return y(b,function(b){b.c||(b.selector=b.g=Ia(a,b,a.b,c,f),b.c=!0);d&&d(b,c,f)})}function Ha(a,b){return b?"[is="+a+"]":a}function Ia(a,b,c,e,d){var f=Ba(b.selector);if(!xa(b)){b=0;for(var g=f.length,h=void 0;b<g&&(h=f[b]);b++)f[b]=c.call(a,h,e,d)}return f.filter(function(a){return!!a}).join(",")}
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{A: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])}
I.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.A;g=g.matches}a=a.replace(Oa,":host $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("::slotted");0<=a.indexOf(":host")?a=Ra(a,e):0!==d&&(a=c?Sa(a,c):a);c=!1;0<=d&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Ta,function(a,b){return" > "+b}))}a=a.replace(Ua,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,G:b,stop:f}}function Sa(a,b){a=a.split(/(\[.+?\])/);for(var c=[],e=0;e<a.length;e++)if(1===e%2)c.push(a[e]);else{var d=a[e];if(""!==d||e!==a.length-1)d=d.split(":"),d[0]+=b,c.push(d.join(":"))}return c.join("")}
function Ra(a,b){var c=a.match(Va);return(c=c&&c[2].trim()||"")?c[0].match(Wa)?a.replace(Va,function(a,c,f){return b+f}):c.split(Wa)[0]===b?c:"should_not_match":a.replace(":host",b)}function Xa(a){":root"===a.selector&&(a.selector="html")}I.prototype.c=function(a){return a.match(":host")?"":a.match("::slotted")?this.b(a,":not(.style-scope)"):Sa(a.trim(),":not(.style-scope)")};aa.Object.defineProperties(I.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}});
var Ka=/:(nth[-\w]+)\(([^)]+)\)/,Pa=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Wa=/[[.:#*]/,Oa=/^(::slotted)/,Va=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Ta=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Ua=/(.*):dir\((?:(ltr|rtl))\)/,Ma=/:(?:matches|any|-(?:webkit|moz)-any)/,K=new I;function N(a,b,c,e,d){this.m=a||null;this.b=b||null;this.w=c||[];this.o=null;this.cssBuild=d||"";this.s=e||"";this.a=this.i=this.l=null}function P(a){return a?a.__styleInfo:null}function Ya(a,b){return a.__styleInfo=b}N.prototype.c=function(){return this.m};N.prototype._getStyleRules=N.prototype.c;function Za(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var $a=navigator.userAgent.match("Trident");function ab(){}function bb(a){var b={},c=[],e=0;z(a,function(a){Q(a);a.index=e++;a=a.f.cssText;for(var c;c=sa.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.j=c,a.rules=null);b.cssText=a.parsedCssText.replace(va,"").replace(w,"");a.f=b}}function R(a,b){var c=a.f;if(c){if(c.j)return Object.assign(b,c.j),!0}else{c=a.parsedCssText;for(var e;a=w.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(";")?cb(a,b,c):Aa(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 cb(a,b,c){b=b.split(";");for(var e=0,d,f;e<b.length;e++)if(d=b[e]){x.lastIndex=0;if(f=x.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 db(a,b){var c={},e=[];z(a,function(a){a.f||Q(a);var d=a.g||a.parsedSelector;b&&a.f.j&&d&&Za.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{j:c,key:e}}
function eb(a,b,c,e){b.f||Q(b);if(b.f.j){var d=G(a);a=d.is;d=d.s;d=a?Ha(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));if(g||h)c=d,h&&(b.g||(b.g=Ia(K,b,K.b,a?"."+a:"",d)),c=b.g||d),e({A:c,K:h,S:g})}}function fb(a,b,c){var e={},d={};z(b,function(b){eb(a,b,c,function(c){Za.call(a._element||a,c.A)&&(c.K?R(b,e):R(b,d))})},null,!0);return{L:d,J:e}}
function gb(a,b,c,e){var d=G(b),f=Ha(d.is,d.s),g=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])"),h=P(b);d=h.m;h=h.cssBuild;var l=hb(d,e);return M(b,d,function(b){var d="";b.f||Q(b);b.f.cssText&&(d=cb(a,b.f.cssText,c));b.cssText=d;if(!r&&!xa(b)&&b.cssText){var h=d=b.cssText;null==b.C&&(b.C=ta.test(d));if(b.C)if(null==b.u){b.u=[];for(var m in l)h=l[m],h=h(d),d!==h&&(d=h,b.u.push(m))}else{for(m=0;m<b.u.length;++m)h=l[b.u[m]],d=h(d);h=d}b.cssText=h;b.g=b.g||b.selector;
d="."+e;m=Ba(b.g);h=0;for(var xb=m.length,O=void 0;h<xb&&(O=m[h]);h++)m[h]=O.match(g)?O.replace(f,d):d+" "+O;b.selector=m.join(",")}},h)}function hb(a,b){a=a.b;var c={};if(!r&&a)for(var e=0,d=a[e];e<a.length;d=a[++e]){var f=d,g=b;f.h=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]=ib(d)}return c}function ib(a){return function(b){return b.replace(a.h,a.a)}}
function jb(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=cb(c,d,b))})}aa.Object.defineProperties(ab.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var T=new ab;var U={},V=window.customElements;if(V&&!r){var kb=V.define;V.define=function(a,b,c){U[a]||(U[a]=za(a));kb.call(V,a,b,c)}};function lb(){this.cache={}}lb.prototype.store=function(a,b,c,e){var d=this.cache[a]||[];d.push({j:b,styleElement:c,i:e});100<d.length&&d.shift();this.cache[a]=d};function mb(){}var nb=new RegExp(K.a+"\\s*([^\\s]*)");function ob(a){return(a=(a.classList&&a.classList.value?a.classList.value:a.getAttribute("class")||"").match(nb))?a[1]:""}function pb(a){var b=F(a).getRootNode();return b===a||b===a.ownerDocument?"":(a=b.host)?G(a).is:""}
function qb(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(),g=ob(d);if(g&&f===d.ownerDocument&&("style"!==d.localName&&"template"!==d.localName||""===H(d)))Fa(d,g);else if(f instanceof ShadowRoot)for(f=pb(d),f!==g&&Ea(d,g,f),d=window.ShadyDOM.nativeMethods.querySelectorAll.call(d,":not(."+K.a+")"),g=0;g<d.length;g++){f=d[g];
var h=pb(f);h&&L(f,h)}}}}}
if(!(r||window.ShadyDOM&&window.ShadyDOM.handlesDynamicScoping)){var rb=new MutationObserver(qb),sb=function(a){rb.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)sb(document);else{var tb=function(){sb(document.body)};window.HTMLImports?window.HTMLImports.whenReady(tb):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){tb();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",
a)}else tb()})}mb=function(){qb(rb.takeRecords())}}var ub=mb;var W={};var vb=Promise.resolve();function wb(a){if(a=W[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function yb(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function zb(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,vb.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var Ab=new lb;function X(){this.B={};this.c=document.documentElement;var a=new n;a.rules=[];this.h=Ya(this.c,new N(a));this.v=!1;this.b=this.a=null}k=X.prototype;k.flush=function(){ub()};k.I=function(a){return A(a)};k.P=function(a){return y(a)};k.prepareTemplate=function(a,b,c){this.prepareTemplateDom(a,b);this.prepareTemplateStyles(a,b,c)};
k.prepareTemplateStyles=function(a,b,c){if(!a._prepared){r||U[b]||(U[b]=za(b));a._prepared=!0;a.name=b;a.extends=c;W[b]=a;var e=H(a),d=Ca(e);c={is:b,extends:c};var f=[];for(var g=a.content.querySelectorAll("style"),h=0;h<g.length;h++){var l=g[h];if(l.hasAttribute("shady-unscoped")){if(!r){var m=l.textContent;wa.has(m)||(wa.add(m),m=l.cloneNode(!0),document.head.appendChild(m));l.parentNode.removeChild(l)}}else f.push(l.textContent),l.parentNode.removeChild(l)}f=f.join("").trim();Y(this);if(!d){if(g=
!e)g=x.test(f)||w.test(f),x.lastIndex=0,w.lastIndex=0;h=p(f);g&&u&&this.a&&this.a.transformRules(h,b);a._styleAst=h}g=[];u||(g=bb(a._styleAst));if(!g.length||u)h=r?a.content:null,b=U[b]||null,e=M(c,a._styleAst,null,e,d?f:""),e=e.length?B(e,c.is,h,b):null,a._style=e;a.a=g}};k.prepareTemplateDom=function(a,b){var c=H(a);r||"shady"===c||a._domPrepared||(a._domPrepared=!0,Da(a.content,b))};
function Bb(a){var b=G(a),c=b.is;b=b.s;var e=U[c]||null,d=W[c];if(d){c=d._styleAst;var f=d.a;d=H(d);b=new N(c,e,f,b,d);Ya(a,b);return b}}function Cb(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.v)&&a.flushCustomStyles()})})}
function Y(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=wb);Cb(a)}
k.flushCustomStyles=function(){Y(this);if(this.b){var a=this.b.processStyles();if(this.b.enqueued&&!Ca(this.h.cssBuild)){if(u){if(!this.h.cssBuild)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{Db(this,this.c,this.h);for(b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&jb(c,this.h.l);this.v&&this.styleDocument()}this.b.enqueued=!1}}};
k.styleElement=function(a,b){var c=P(a)||Bb(a);if(c)if(a!==this.c&&(this.v=!0),b&&(c.o=c.o||{},Object.assign(c.o,b)),u){b=G(a).is;if(c.o){var e=c.o,d;for(d in e)null===d?a.style.removeProperty(d):a.style.setProperty(d,e[d])}if(!(!(d=W[b])&&a!==this.c||d&&""!==H(d))&&d&&d._style&&!yb(d)){if(yb(d)||d._applyShimValidatingVersion!==d._applyShimNextVersion)Y(this),this.a&&this.a.transformRules(d._styleAst,b),d._style.textContent=M(a,c.m),zb(d);r&&(b=a.shadowRoot)&&(b=b.querySelector("style"))&&(b.textContent=
M(a,c.m));c.m=d._styleAst}}else if(this.flush(),Db(this,a,c),c.w&&c.w.length){b=G(a).is;a:{if(d=Ab.cache[b])for(e=d.length-1;0<=e;e--){var f=d[e];b:{var g=c.w;for(var h=0;h<g.length;h++){var l=g[h];if(f.j[l]!==c.l[l]){g=!1;break b}}g=!0}if(g){d=f;break a}}d=void 0}g=d?d.styleElement:null;e=c.i;(f=d&&d.i)||(f=this.B[b]=(this.B[b]||0)+1,f=b+"-"+f);c.i=f;f=c.i;h=T;h=g?g.textContent||"":gb(h,a,c.l,f);l=P(a);var m=l.a;m&&!r&&m!==g&&(m._useCount--,0>=m._useCount&&m.parentNode&&m.parentNode.removeChild(m));
r?l.a?(l.a.textContent=h,g=l.a):h&&(g=B(h,f,a.shadowRoot,l.b)):g?g.parentNode||($a&&-1<h.indexOf("@media")&&(g.textContent=h),ya(g,null,l.b)):h&&(g=B(h,f,null,l.b));g&&(g._useCount=g._useCount||0,l.a!=g&&g._useCount++,l.a=g);f=g;r||(g=c.i,l=h=a.getAttribute("class")||"",e&&(l=h.replace(new RegExp("\\s*x-scope\\s*"+e+"\\s*","g")," ")),l+=(l?" ":"")+"x-scope "+g,h!==l&&E(a,l));d||Ab.store(b,c.l,f,c.i)}};function Eb(a,b){return(b=F(b).getRootNode().host)?P(b)||Bb(b)?b:Eb(a,b):a.c}
function Db(a,b,c){var e=Eb(a,b),d=P(e),f=d.l;e===a.c||f||(Db(a,e,d),f=d.l);a=Object.create(f||null);e=fb(b,c.m,c.cssBuild);b=db(d.m,b).j;Object.assign(a,e.J,b,e.L);b=c.o;for(var g in b)if((d=b[g])||0===d)a[g]=d;g=T;b=Object.getOwnPropertyNames(a);for(d=0;d<b.length;d++)e=b[d],a[e]=S(g,a[e],a);c.l=a}k.styleDocument=function(a){this.styleSubtree(this.c,a)};
k.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])};
k.D=function(a){var b=this,c=H(a);c!==this.h.cssBuild&&(this.h.cssBuild=c);if(!Ca(c)){var e=A(a);z(e,function(a){if(r)Xa(a);else{var d=K;a.selector=a.parsedSelector;Xa(a);a.selector=a.g=Ia(d,a,d.c,void 0,void 0)}u&&""===c&&(Y(b),b.a&&b.a.transformRule(a))});u?a.textContent=y(e):this.h.m.rules.push(e)}};k.getComputedStyleValue=function(a,b){var c;u||(c=(P(a)||P(Eb(this,a))).l[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};
k.O=function(a,b){var c=F(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]===K.a){c=e[d+1];break}}}c&&b.push(K.a,c);u||(c=P(a))&&c.i&&b.push(T.a,c.i);E(a,b.join(" "))};k.F=function(a){return P(a)};k.N=function(a,b){L(a,b)};k.R=function(a,b){L(a,b,!0)};k.M=function(a){return pb(a)};k.H=function(a){return ob(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.O;X.prototype._styleInfoForNode=X.prototype.F;X.prototype.transformCustomStyleForDocument=X.prototype.D;X.prototype.getStyleAst=X.prototype.I;X.prototype.styleAstToString=X.prototype.P;X.prototype.flushCustomStyles=X.prototype.flushCustomStyles;
X.prototype.scopeNode=X.prototype.N;X.prototype.unscopeNode=X.prototype.R;X.prototype.scopeForNode=X.prototype.M;X.prototype.currentScopeForNode=X.prototype.H;Object.defineProperties(X.prototype,{nativeShadow:{get:function(){return r}},nativeCss:{get:function(){return u}}});var Z=new X,Fb,Gb;window.ShadyCSS&&(Fb=window.ShadyCSS.ApplyShim,Gb=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:r,cssBuild:v};Fb&&(window.ShadyCSS.ApplyShim=Fb);Gb&&(window.ShadyCSS.CustomStyleInterface=Gb);}).call(this);

//# sourceMappingURL=scoping-shim.min.js.map