/*! * css-vars-ponyfill * v1.16.1 * https://github.com/jhildenbiddle/css-vars-ponyfill * (c) 2018 John Hildenbiddle * MIT license */ (function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.cssVars = factory(); })(typeof self !== "undefined" ? self : this, function() { "use strict"; function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } } function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } /*! * get-css-data * v1.6.1 * https://github.com/jhildenbiddle/get-css-data * (c) 2018 John Hildenbiddle * MIT license */ function getUrls(urls) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var settings = { mimeType: options.mimeType || null, onBeforeSend: options.onBeforeSend || Function.prototype, onSuccess: options.onSuccess || Function.prototype, onError: options.onError || Function.prototype, onComplete: options.onComplete || Function.prototype }; var urlArray = Array.isArray(urls) ? urls : [ urls ]; var urlQueue = Array.apply(null, Array(urlArray.length)).map(function(x) { return null; }); function isValidCss() { var cssText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; var isHTML = cssText.trim().charAt(0) === "<"; return !isHTML; } function onError(xhr, urlIndex) { settings.onError(xhr, urlArray[urlIndex], urlIndex); } function onSuccess(responseText, urlIndex) { var returnVal = settings.onSuccess(responseText, urlArray[urlIndex], urlIndex); responseText = returnVal === false ? "" : returnVal || responseText; urlQueue[urlIndex] = responseText; if (urlQueue.indexOf(null) === -1) { settings.onComplete(urlQueue); } } urlArray.forEach(function(url, i) { var parser = document.createElement("a"); parser.setAttribute("href", url); parser.href = String(parser.href); var isCrossDomain = parser.host !== location.host; var isIElte9 = document.all && !window.atob; var isSameProtocol = parser.protocol === location.protocol; if (isCrossDomain && isIElte9) { if (isSameProtocol) { var xdr = new XDomainRequest(); xdr.open("GET", url); xdr.timeout = 0; xdr.onprogress = Function.prototype; xdr.ontimeout = Function.prototype; xdr.onload = function() { if (isValidCss(xdr.responseText)) { onSuccess(xdr.responseText, i); } else { onError(xdr, i); } }; xdr.onerror = function(err) { onError(xdr, i); }; setTimeout(function() { xdr.send(); }, 0); } else { console.log("Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol"); onError(null, i); } } else { var xhr = new XMLHttpRequest(); xhr.open("GET", url); if (settings.mimeType && xhr.overrideMimeType) { xhr.overrideMimeType(settings.mimeType); } settings.onBeforeSend(xhr, url, i); xhr.onreadystatechange = function() { if (xhr.readyState === 4) { if (xhr.status === 200 && isValidCss(xhr.responseText)) { onSuccess(xhr.responseText, i); } else { onError(xhr, i); } } }; xhr.send(); } }); } /** * Gets CSS data from