7 lines
22 KiB
JavaScript
7 lines
22 KiB
JavaScript
|
|
/*!
|
||
|
|
* css-vars-ponyfill
|
||
|
|
* v2.3.2
|
||
|
|
* https://jhildenbiddle.github.io/css-vars-ponyfill/
|
||
|
|
* (c) 2018-2020 John Hildenbiddle <http://hildenbiddle.com>
|
||
|
|
* MIT license
|
||
|
|
*/!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a=a||self).cssVars=b()}(this,function(){"use strict";function q(){return(q=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a}).apply(this,arguments)}function z(a){return function(a){if(Array.isArray(a))return B(a)}(a)||function(a){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a))return Array.from(a)}(a)||function(a,b){if(a){if("string"==typeof a)return B(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?B(a,b):void 0}}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function F(b){function d(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",b="<"===a.trim().charAt(0);return!b}function a(a,b){f.onError(a,g[b],b)}function e(b,c){var d=f.onSuccess(b,g[c],c);b=!1===d?"":d||b,h[c]=b,-1===h.indexOf(null)&&f.onComplete(h)}var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},f={mimeType:c.mimeType||null,onBeforeSend:c.onBeforeSend||Function.prototype,onSuccess:c.onSuccess||Function.prototype,onError:c.onError||Function.prototype,onComplete:c.onComplete||Function.prototype},g=Array.isArray(b)?b:[b],h=Array.apply(null,Array(g.length)).map(function(a){return null}),j=document.createElement("a");g.forEach(function(b,c){if(!(j.setAttribute("href",b),j.href=j.href+"",!(!document.all||window.atob)&&j.host.split(":")[0]!==location.host.split(":")[0])){var g=new XMLHttpRequest;g.open("GET",b),f.mimeType&&g.overrideMimeType&&g.overrideMimeType(f.mimeType),f.onBeforeSend(g,b,c),g.onreadystatechange=function(){4===g.readyState&&(200===g.status&&d(g.responseText)?e(g.responseText,c):a(g,c))},g.send()}else if(j.protocol===location.protocol){var h=new XDomainRequest;h.open("GET",b),h.timeout=0,h.onprogress=Function.prototype,h.ontimeout=Function.prototype,h.onload=function(){d(h.responseText)?e(h.responseText,c):a(h,c)},h.onerror=function(b){a(h,c)},setTimeout(function(){h.send()},0)}else console.warn("Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (".concat(b,")")),a(null,c)})}function n(a){function b(){if(-1===k.indexOf(null)){var a=k.join("");j.onComplete(a,k,i)}}function d(c,d,g,h){var a=j.onSuccess(c,g,h);(function h(b,d,g,a){var e=4<arguments.length&&void 0!==arguments[4]?arguments[4]:[],c=5<arguments.length&&void 0!==arguments[5]?arguments[5]:[],i=f(b,g,c);i.rules.length?F(i.absoluteUrls,{onBeforeSend:function(a,b,c){j.onBeforeSend(a,d,b)},onSuccess:function(b,g,h){var i=j.onSuccess(b,d,g),a=f(b=!1===i?"":i||b,g,c);return a.rules.forEach(function(c,d){b=b.replace(c,a.absoluteRules[d])}),b},onError:function(f,j,k){e.push({xhr:f,url:j}),c.push(i.rules[k]),h(b,d,g,a,e,c)},onComplete:function(f){f.forEach(function(a,c){b=b.replace(i.rules[c],a)}),h(b,d,g,a,e,c)}}):a(b,e)})(c=void 0!==a&&!1===!!a?"":a||c,g,h,function(a,c){null===k[d]&&(c.forEach(function(a){return j.onError(a.xhr,g,a.url)}),k[d]=!j.filter||j.filter.test(a)?a:"",b())})}function f(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],d={};return d.rules=(a.replace(g,"").match(h)||[]).filter(function(a){return-1===c.indexOf(a)}),d.urls=d.rules.map(function(a){return a.replace(h,"$1")}),d.absoluteUrls=d.urls.map(function(a){return G(a,b)}),d.absoluteRules=d.rules.map(function(a,c){var e=d.urls[c],f=G(d.absoluteUrls[c],b);return a.replace(e,f)}),d}var g=/\/\*[\s\S]+?\*\//g,h=/(?:@import\s*)(?:url\(\s*)?(?:['"])([^'"]*)(?:['"])(?:\s*\))?(?:[^;]*;)/g,j={rootElement:a.rootElement||document,include:a.include||"style,link[rel=\"stylesheet\"]",exclude:a.exclude||null,filter:
|