-
Notifications
You must be signed in to change notification settings - Fork 0
/
polyfills-css-shim.f5de126bedfc07064c1d.js
1 lines (1 loc) · 8.06 KB
/
polyfills-css-shim.f5de126bedfc07064c1d.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{"9qUq":function(t,e){var r=function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var s in e=arguments[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},n=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""},s=1,o=7,i=4,a=1e3,u=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,c=/@import[^;]*;/gim,l=/^@[^\s]*keyframes/,p=/\s+/g;function f(t,e,r){t.lastIndex=0;var n=e.substring(r).match(t);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var h=/\bvar\(/,d=/\B--[\w-]+\s*:/,v=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,m=/^[\t ]+\n/gm;function g(t,e,r){var n=function(t,e){var r=f(h,t,e);if(!r)return null;var n=function(t,e){for(var r=0,n=e;n<t.length;n++){var s=t[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}(t,r.start),s=t.substring(r.end,n-1).split(","),o=s[0],i=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:i.length>0?i.join(",").trim():void 0}}(t,r);if(!n)return e.push(t.substring(r,t.length)),t.length;var s=n.propName,o=null!=n.fallback?S(n.fallback):void 0;return e.push(t.substring(r,n.start),(function(t){return function(t,e,r){return t[e]?t[e]:r?y(r,t):""}(t,s,o)})),n.end}function y(t,e){for(var r="",n=0;n<t.length;n++){var s=t[n];r+="string"==typeof s?s:s(e)}return r}function b(t,e){for(var r=!1,n=!1,s=e;s<t.length;s++){var o=t[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function S(t){var e=0;t=function(t){for(var e="",r=0;;){var n=f(d,t,r),s=n?n.start:t.length;if(e+=t.substring(r,s),!n)break;r=b(t,s)}return e}(t=t.replace(v,"")).replace(m,"");for(var r=[];e<t.length;)e=g(t,r,e);return r}function w(t){var e={};t.forEach((function(t){t.declarations.forEach((function(t){e[t.prop]=t.value}))}));for(var r={},n=Object.entries(e),s=function(t){var e=!1;if(n.forEach((function(t){var n=t[0],s=y(t[1],r);s!==r[n]&&(r[n]=s,e=!0)})),!e)return"break"},o=0;o<10&&"break"!==s();o++);return r}function x(t,e){if(void 0===e&&(e=0),!t.rules)return[];var r=[];return t.rules.filter((function(t){return t.type===s})).forEach((function(t){var n=function(t){for(var e,r=[];e=E.exec(t.trim());){var n=C(e[2]),s=n.value,o=n.important;r.push({prop:e[1].trim(),value:S(s),important:o})}return r}(t.cssText);n.length>0&&t.parsedSelector.split(",").forEach((function(t){t=t.trim(),r.push({selector:t,declarations:n,specificity:1,nu:e})})),e++})),r}var M="!important",E=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function C(t){var e=(t=t.replace(/\s+/gim," ").trim()).endsWith(M);return e&&(t=t.substr(0,t.length-M.length).trim()),{value:t,important:e}}function k(t){var e=[];return t.forEach((function(t){e.push.apply(e,t.selectors)})),e}function I(t){var e=function(t){return function t(e,r){var n=r.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=n.trim(),e.parent){n=(n=(n=function(t){return t.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var t=arguments[1],e=6-t.length;e--;)t="0"+t;return"\\"+t}))}(n=r.substring(e.previous?e.previous.end:e.parent.start,e.start-1))).replace(p," ")).substring(n.lastIndexOf(";")+1);var u=e.parsedSelector=e.selector=n.trim();e.atRule=0===u.indexOf("@"),e.atRule?0===u.indexOf("@media")?e.type=i:u.match(l)&&(e.type=o,e.keyframesName=e.selector.split(p).pop()):e.type=0===u.indexOf("--")?a:s}var c=e.rules;if(c)for(var f=0,h=c.length,d=void 0;f<h&&(d=c[f]);f++)t(d,r);return e}(function(t){var e=new n;e.start=0,e.end=t.length;for(var r=e,s=0,o=t.length;s<o;s++)if("{"===t[s]){r.rules||(r.rules=[]);var i=r,a=i.rules[i.rules.length-1]||null;(r=new n).start=s+1,r.parent=i,r.previous=a,i.rules.push(r)}else"}"===t[s]&&(r.end=s+1,r=r.parent||e);return e}(t=function(t){return t.replace(u,"").replace(c,"")}(t)),t)}(t),r=S(t);return{original:t,template:r,selectors:x(e),usesCssVars:r.length>1}}function O(t,e){if(t.some((function(t){return t.styleEl===e})))return!1;var r=I(e.textContent);return r.styleEl=e,t.push(r),!0}function A(t){var e=w(k(t));t.forEach((function(t){t.usesCssVars&&(t.styleEl.textContent=y(t.template,e))}))}function T(t,e,r){return function(t,e,r){return t.replace(new RegExp(e,"g"),r)}(t,"\\."+e,"."+r)}function q(t,e){return Array.from(t.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(t){return O(e,t)})).some(Boolean)}function N(t,e,r){var n=r.href;return fetch(n).then((function(t){return t.text()})).then((function(s){if(function(t){return t.indexOf("var(")>-1||H.test(t)}(s)&&r.parentNode){(function(t){return V.lastIndex=0,V.test(t)})(s)&&(s=function(t,e){var r=e.replace(/[^/]*$/,"");return t.replace(V,(function(t,e){return t.replace(e,r+e)}))}(s,n));var o=t.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,O(e,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(t){console.error(t)}))}var G,H=/[\s;{]--[-a-zA-Z0-9]+\s*:/m,V=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim,j=function(){function t(t,e){this.win=t,this.doc=e,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return t.prototype.i=function(){var t=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(e){t.win.requestAnimationFrame((function(){(function(t,e){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){q(t,e)&&A(e)})).observe(document.head,{childList:!0})})(t.doc,t.globalScopes),function(t,e){return q(t,e),function(t,e){for(var r=[],n=t.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(N(t,e,n[s]));return Promise.all(r)}(t,e).then((function(){A(e)}))}(t.doc,t.globalScopes).then((function(){return e()}))}))})))},t.prototype.addLink=function(t){var e=this;return N(this.doc,this.globalScopes,t).then((function(){e.updateGlobal()}))},t.prototype.addGlobalStyle=function(t){O(this.globalScopes,t)&&this.updateGlobal()},t.prototype.createHostStyle=function(t,e,n,s){if(this.hostScopeMap.has(t))throw new Error("host style already created");var o=this.registerHostTemplate(n,e,s),i=this.doc.createElement("style");return i.setAttribute("data-no-shim",""),o.usesCssVars?s?(i["s-sc"]=e=o.scopeId+"-"+this.count,i.textContent="/*needs update*/",this.hostStyleMap.set(t,i),this.hostScopeMap.set(t,function(t,e){var n=t.template.map((function(r){return"string"==typeof r?T(r,t.scopeId,e):r})),s=t.selectors.map((function(n){return r(r({},n),{selector:T(n.selector,t.scopeId,e)})}));return r(r({},t),{template:n,selectors:s,scopeId:e})}(o,e)),this.count++):(o.styleEl=i,o.usesCssVars||(i.textContent=y(o.template,{})),this.globalScopes.push(o),this.updateGlobal(),this.hostScopeMap.set(t,o)):i.textContent=n,i},t.prototype.removeHost=function(t){var e=this.hostStyleMap.get(t);e&&e.remove(),this.hostStyleMap.delete(t),this.hostScopeMap.delete(t)},t.prototype.updateHost=function(t){var e=this.hostScopeMap.get(t);if(e&&e.usesCssVars&&e.isScoped){var r=this.hostStyleMap.get(t);if(r){var n=w(function(t,e,r){var n=[],s=function(t,e){for(var r=[];e;){var n=t.get(e);n&&r.push(n),e=e.parentElement}return r}(e,t);return r.forEach((function(t){return n.push(t)})),s.forEach((function(t){return n.push(t)})),function(t){return t.sort((function(t,e){return t.specificity===e.specificity?t.nu-e.nu:t.specificity-e.specificity})),t}(k(n).filter((function(e){return function(t,e){return":root"===e||"html"===e||t.matches(e)}(t,e.selector)})))}(t,this.hostScopeMap,this.globalScopes));r.textContent=y(e.template,n)}}},t.prototype.updateGlobal=function(){A(this.globalScopes)},t.prototype.registerHostTemplate=function(t,e,r){var n=this.scopesMap.get(e);return n||((n=I(t)).scopeId=e,n.isScoped=r,this.scopesMap.set(e,n)),n},t}();!(G="undefined"!=typeof window&&window)||G.__cssshim||G.CSS&&G.CSS.supports&&G.CSS.supports("color","var(--c)")||(G.__cssshim=new j(G,G.document))}}]);