PageSourceSearch

https://dartfirststate.com/CLF4/agency/js/css-vars-ponyfill.js

js dartfirststate.com collected 2026-10-01 11:57:09 UTC 65,113 bytes, 1,421 lines download raw bytes

1/*!
2 * css-vars-ponyfill
3 * v2.0.2
4 * https://jhildenbiddle.github.io/css-vars-ponyfill/
5 * (c) 2018-2019 John Hildenbiddle <http://hildenbiddle.com>
6 * MIT license
7 */
8(function(global, factory) {
9    typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = global || self, 
10    global.cssVars = factory());
11})(this, function() {
12    "use strict";
13    function _extends() {
14        _extends = Object.assign || function(target) {
15            for (var i = 1; i < arguments.length; i++) {
16                var source = arguments[i];
17                for (var key in source) {
18                    if (Object.prototype.hasOwnProperty.call(source, key)) {
19                        target[key] = source[key];
20                    }
21                }
22            }
23            return target;
24        };
25        return _extends.apply(this, arguments);
26    }
27    function _toConsumableArray(arr) {
28        return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
29    }
30    function _arrayWithoutHoles(arr) {
31        if (Array.isArray(arr)) {
32            for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
33            return arr2;
34        }
35    }
36    function _iterableToArray(iter) {
37        if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
38    }
39    function _nonIterableSpread() {
40        throw new TypeError("Invalid attempt to spread non-iterable instance");
41    }
42    /*!
43   * get-css-data
44   * v1.6.3
45   * https://github.com/jhildenbiddle/get-css-data
46   * (c) 2018-2019 John Hildenbiddle <http://hildenbiddle.com>
47   * MIT license
48   */    function getUrls(urls) {
49        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
50        var settings = {
51            mimeType: options.mimeType || null,
52            onBeforeSend: options.onBeforeSend || Function.prototype,
53            onSuccess: options.onSuccess || Function.prototype,
54            onError: options.onError || Function.prototype,
55            onComplete: options.onComplete || Function.prototype
56        };
57        var urlArray = Array.isArray(urls) ? urls : [ urls ];
58        var urlQueue = Array.apply(null, Array(urlArray.length)).map(function(x) {
59            return null;
60        });
61        function isValidCss() {
62            var cssText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
63            var isHTML = cssText.trim().charAt(0) === "<";
64            return !isHTML;
65        }
66        function onError(xhr, urlIndex) {
67            settings.onError(xhr, urlArray[urlIndex], urlIndex);
68        }
69        function onSuccess(responseText, urlIndex) {
70            var returnVal = settings.onSuccess(responseText, urlArray[urlIndex], urlIndex);
71            responseText = returnVal === false ? "" : returnVal || responseText;
72            urlQueue[urlIndex] = responseText;
73            if (urlQueue.indexOf(null) === -1) {
74                settings.onComplete(urlQueue);
75            }
76        }
77        var parser = document.createElement("a");
78        urlArray.forEach(function(url, i) {
79            parser.setAttribute("href", url);
80            parser.href = String(parser.href);
81            var isIElte9 = Boolean(document.all && !window.atob);
82            var isIElte9CORS = isIElte9 && parser.host.split(":")[0] !== location.host.split(":")[0];
83            if (isIElte9CORS) {
84                var isSameProtocol = parser.protocol === location.protocol;
85                if (isSameProtocol) {
86                    var xdr = new XDomainRequest();
87                    xdr.open("GET", url);
88                    xdr.timeout = 0;
89                    xdr.onprogress = Function.prototype;
90                    xdr.ontimeout = Function.prototype;
91                    xdr.onload = function() {
92                        if (isValidCss(xdr.responseText)) {
93                            onSuccess(xdr.responseText, i);
94                        } else {
95                            onError(xdr, i);
96                        }
97                    };
98                    xdr.onerror = function(err) {
99                        onError(xdr, i);
100                    };
101                    setTimeout(function() {
102                        xdr.send();
103                    }, 0);
104                } else {
105                    console.warn("Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (".concat(url, ")"));
106                    onError(null, i);
107                }
108            } else {
109                var xhr = new XMLHttpRequest();
110                xhr.open("GET", url);
111                if (settings.mimeType && xhr.overrideMimeType) {
112                    xhr.overrideMimeType(settings.mimeType);
113                }
114                settings.onBeforeSend(xhr, url, i);
115                xhr.onreadystatechange = function() {
116                    if (xhr.readyState === 4) {
117                        if (xhr.status === 200 && isValidCss(xhr.responseText)) {
118                            onSuccess(xhr.responseText, i);
119                        } else {
120                            onError(xhr, i);
121                        }
122                    }
123                };
124                xhr.send();
125            }
126        });
127    }
128    /**
129   * Gets CSS data from <style> and <link> nodes (including @imports), then
130   * returns data in order processed by DOM. Allows specifying nodes to
131   * include/exclude and filtering CSS data using RegEx.
132   *
133   * @preserve
134   * @param {object}   [options] The options object
135   * @param {object}   [options.rootElement=document] Root element to traverse for
136   *                   <link> and <style> nodes.
137   * @param {string}   [options.include] CSS selector matching <link> and <style>
138   *                   nodes to include
139   * @param {string}   [options.exclude] CSS selector matching <link> and <style>
140   *                   nodes to exclude
141   * @param {object}   [options.filter] Regular expression used to filter node CSS
142   *                   data. Each block of CSS data is tested against the filter,
143   *                   and only matching data is included.
144   * @param {object}   [options.useCSSOM=false] Determines if CSS data will be
145   *                   collected from a stylesheet's runtime values instead of its
146   *                   text content. This is required to get accurate CSS data
147   *                   when a stylesheet has been modified using the deleteRule()
148   *                   or insertRule() methods because these modifications will
149   *                   not be reflected in the stylesheet's text content.
150   * @param {function} [options.onBeforeSend] Callback before XHR is sent. Passes
151   *                   1) the XHR object, 2) source node reference, and 3) the
152   *                   source URL as arguments.
153   * @param {function} [options.onSuccess] Callback on each CSS node read. Passes
154   *                   1) CSS text, 2) source node reference, and 3) the source
155   *                   URL as arguments.
156   * @param {function} [options.onError] Callback on each error. Passes 1) the XHR
157   *                   object for inspection, 2) soure node reference, and 3) the
158   *                   source URL that failed (either a <link> href or an @import)
159   *                   as arguments
160   * @param {function} [options.onComplete] Callback after all nodes have been
161   *                   processed. Passes 1) concatenated CSS text, 2) an array of
162   *                   CSS text in DOM order, and 3) an array of nodes in DOM
163   *                   order as arguments.
164   *
165   * @example
166   *
167   *   getCssData({
168   *     rootElement: document,
169   *     include    : 'style,link[rel="stylesheet"]',
170   *     exclude    : '[href="skip.css"]',
171   *     filter     : /red/,
172   *     useCSSOM   : false,
173   *     onBeforeSend(xhr, node, url) {
174   *       // ...
175   *     }
176   *     onSuccess(cssText, node, url) {
177   *       // ...
178   *     }
179   *     onError(xhr, node, url) {
180   *       // ...
181   *     },
182   *     onComplete(cssText, cssArray, nodeArray) {
183   *       // ...
184   *     }
185   *   });
186   */    function getCssData(options) {
187        var regex = {
188            cssComments: /\/\*[\s\S]+?\*\//g,
189            cssImports: /(?:@import\s*)(?:url\(\s*)?(?:['"])([^'"]*)(?:['"])(?:\s*\))?(?:[^;]*;)/g
190        };
191        var settings = {
192            rootElement: options.rootElement || document,
193            include: options.include || 'style,link[rel="stylesheet"]',
194            exclude: options.exclude || null,
195            filter: options.filter || null,
196            useCSSOM: options.useCSSOM || false,
197            onBeforeSend: options.onBeforeSend || Function.prototype,
198            onSuccess: options.onSuccess || Function.prototype,
199            onError: options.onError || Function.prototype,
200            onComplete: options.onComplete || Function.prototype
201        };
202        var sourceNodes = Array.apply(null, settings.rootElement.querySelectorAll(settings.include)).filter(function(node) {
203            return !matchesSelector(node, settings.exclude);
204        });
205        var cssArray = Array.apply(null, Array(sourceNodes.length)).map(function(x) {
206            return null;
207        });
208        function handleComplete() {
209            var isComplete = cssArray.indexOf(null) === -1;
210            if (isComplete) {
211                var cssText = cssArray.join("");
212                settings.onComplete(cssText, cssArray, sourceNodes);
213            }
214        }
215        function handleSuccess(cssText, cssIndex, node, sourceUrl) {
216            var returnVal = settings.onSuccess(cssText, node, sourceUrl);
217            cssText = returnVal !== undefined && Boolean(returnVal) === false ? "" : returnVal || cssText;
218            resolveImports(cssText, node, sourceUrl, function(resolvedCssText, errorData) {
219                if (cssArray[cssIndex] === null) {
220                    errorData.forEach(function(data) {
221                        return settings.onError(data.xhr, node, data.url);
222                    });
223                    if (!settings.filter || settings.filter.test(resolvedCssText)) {
224                        cssArray[cssIndex] = resolvedCssText;
225                    } else {
226                        cssArray[cssIndex] = "";
227                    }
228                    handleComplete();
229                }
230            });
231        }
232        function parseImportData(cssText, baseUrl) {
233            var ignoreRules = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
234            var importData = {};
235            importData.rules = (cssText.replace(regex.cssComments, "").match(regex.cssImports) || []).filter(function(rule) {
236                return ignoreRules.indexOf(rule) === -1;
237            });
238            importData.urls = importData.rules.map(function(rule) {
239                return rule.replace(regex.cssImports, "$1");
240            });
241            importData.absoluteUrls = importData.urls.map(function(url) {
242                return getFullUrl(url, baseUrl);
243            });
244            importData.absoluteRules = importData.rules.map(function(rule, i) {
245                var oldUrl = importData.urls[i];
246                var newUrl = getFullUrl(importData.absoluteUrls[i], baseUrl);
247                return rule.replace(oldUrl, newUrl);
248            });
249            return importData;
250        }
251        function resolveImports(cssText, node, baseUrl, callbackFn) {
252            var __errorData = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
253            var __errorRules = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
254            var importData = parseImportData(cssText, baseUrl, __errorRules);
255            if (importData.rules.length) {
256                getUrls(importData.absoluteUrls, {
257                    onBeforeSend: function onBeforeSend(xhr, url, urlIndex) {
258                        settings.onBeforeSend(xhr, node, url);
259                    },
260                    onSuccess: function onSuccess(cssText, url, urlIndex) {
261                        var returnVal = settings.onSuccess(cssText, node, url);
262                        cssText = returnVal === false ? "" : returnVal || cssText;
263                        var responseImportData = parseImportData(cssText, url, __errorRules);
264                        responseImportData.rules.forEach(function(rule, i) {
265                            cssText = cssText.replace(rule, responseImportData.absoluteRules[i]);
266                        });
267                        return cssText;
268                    },
269                    onError: function onError(xhr, url, urlIndex) {
270                        __errorData.push({
271                            xhr: xhr,
272                            url: url
273                        });
274                        __errorRules.push(importData.rules[urlIndex]);
275                        resolveImports(cssText, node, baseUrl, callbackFn, __errorData, __errorRules);
276                    },
277                    onComplete: function onComplete(responseArray) {
278                        responseArray.forEach(function(importText, i) {
279                            cssText = cssText.replace(importData.rules[i], importText);
280                        });
281                        resolveImports(cssText, node, baseUrl, callbackFn, __errorData, __errorRules);
282                    }
283                });
284            } else {
285                callbackFn(cssText, __errorData);
286            }
287        }
288        if (sourceNodes.length) {
289            sourceNodes.forEach(function(node, i) {
290                var linkHref = node.getAttribute("href");
291                var linkRel = node.getAttribute("rel");
292                var isLink = node.nodeName === "LINK" && linkHref && linkRel && linkRel.toLowerCase() === "stylesheet";
293                var isStyle = node.nodeName === "STYLE";
294                if (isLink) {
295                    getUrls(linkHref, {
296                        mimeType: "text/css",
297                        onBeforeSend: function onBeforeSend(xhr, url, urlIndex) {
298                            settings.onBeforeSend(xhr, node, url);
299                        },
300                        onSuccess: function onSuccess(cssText, url, urlIndex) {
301                            var sourceUrl = getFullUrl(linkHref, location.href);
302                            handleSuccess(cssText, i, node, sourceUrl);
303                        },
304                        onError: function onError(xhr, url, urlIndex) {
305                            cssArray[i] = "";
306                            settings.onError(xhr, node, url);
307                            handleComplete();
308                        }
309                    });
310                } else if (isStyle) {
311                    var cssText = node.textContent;
312                    if (settings.useCSSOM) {
313                        cssText = Array.apply(null, node.sheet.cssRules).map(function(rule) {
314                            return rule.cssText;
315                        }).join("");
316                    }
317                    handleSuccess(cssText, i, node, location.href);
318                } else {
319                    cssArray[i] = "";
320                    handleComplete();
321                }
322            });
323        } else {
324            settings.onComplete("", []);
325        }
326    }
327    function getFullUrl(url) {
328        var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.href;
329        var d = document.implementation.createHTMLDocument("");
330        var b = d.createElement("base");
331        var a = d.createElement("a");
332        d.head.appendChild(b);
333        d.body.appendChild(a);
334        b.href = base;
335        a.href = url;
336        return a.href;
337    }
338    function matchesSelector(elm, selector) {
339        var matches = elm.matches || elm.matchesSelector || elm.webkitMatchesSelector || elm.mozMatchesSelector || elm.msMatchesSelector || elm.oMatchesSelector;
340        return matches.call(elm, selector);
341    }
342    var balancedMatch = balanced;
343    function balanced(a, b, str) {
344        if (a instanceof RegExp) a = maybeMatch(a, str);
345        if (b instanceof RegExp) b = maybeMatch(b, str);
346        var r = range(a, b, str);
347        return r && {
348            start: r[0],
349            end: r[1],
350            pre: str.slice(0, r[0]),
351            body: str.slice(r[0] + a.length, r[1]),
352            post: str.slice(r[1] + b.length)
353        };
354    }
355    function maybeMatch(reg, str) {
356        var m = str.match(reg);
357        return m ? m[0] : null;
358    }
359    balanced.range = range;
360    function range(a, b, str) {
361        var begs, beg, left, right, result;
362        var ai = str.indexOf(a);
363        var bi = str.indexOf(b, ai + 1);
364        var i = ai;
365        if (ai >= 0 && bi > 0) {
366            begs = [];
367            left = str.length;
368            while (i >= 0 && !result) {
369                if (i == ai) {
370                    begs.push(i);
371                    ai = str.indexOf(a, i + 1);
372                } else if (begs.length == 1) {
373                    result = [ begs.pop(), bi ];
374                } else {
375                    beg = begs.pop();
376                    if (beg < left) {
377                        left = beg;
378                        right = bi;
379                    }
380                    bi = str.indexOf(b, i + 1);
381                }
382                i = ai < bi && ai >= 0 ? ai : bi;
383            }
384            if (begs.length) {
385                result = [ left, right ];
386            }
387        }
388        return result;
389    }
390    function parseCss(css) {
391        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
392        var defaults = {
393            preserveStatic: true,
394            removeComments: false
395        };
396        var settings = _extends({}, defaults, options);
397        var errors = [];
398        function error(msg) {
399            throw new Error("CSS parse error: ".concat(msg));
400        }
401        function match(re) {
402            var m = re.exec(css);
403            if (m) {
404                css = css.slice(m[0].length);
405                return m;
406            }
407        }
408        function open() {
409            return match(/^{\s*/);
410        }
411        function close() {
412            return match(/^}/);
413        }
414        function whitespace() {
415            match(/^\s*/);
416        }
417        function comment() {
418            whitespace();
419            if (css[0] !== "/" || css[1] !== "*") {
420                return;
421            }
422            var i = 2;
423            while (css[i] && (css[i] !== "*" || css[i + 1] !== "/")) {
424                i++;
425            }
426            if (!css[i]) {
427                return error("end of comment is missing");
428            }
429            var str = css.slice(2, i);
430            css = css.slice(i + 2);
431            return {
432                type: "comment",
433                comment: str
434            };
435        }
436        function comments() {
437            var cmnts = [];
438            var c;
439            while (c = comment()) {
440                cmnts.push(c);
441            }
442            return settings.removeComments ? [] : cmnts;
443        }
444        function selector() {
445            whitespace();
446            while (css[0] === "}") {
447                error("extra closing bracket");
448            }
449            var m = match(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);
450            if (m) {
451                return m[0].trim().replace(/\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*\/+/g, "").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function(m) {
452                    return m.replace(/,/g, "‌");
453                }).split(/\s*(?![^(]*\)),\s*/).map(function(s) {
454                    return s.replace(/\u200C/g, ",");
455                });
456            }
457        }
458        function declaration() {
459            match(/^([;\s]*)+/);
460            var comment_regexp = /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//g;
461            var prop = match(/^(\*?[-#\/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
462            if (!prop) {
463                return;
464            }
465            prop = prop[0].trim();
466            if (!match(/^:\s*/)) {
467                return error("property missing ':'");
468            }
469            var val = match(/^((?:\/\*.*?\*\/|'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((\s*'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^)]*?)\s*\)|[^};])+)/);
470            var ret = {
471                type: "declaration",
472                property: prop.replace(comment_regexp, ""),
473                value: val ? val[0].replace(comment_regexp, "").trim() : ""
474            };
475            match(/^[;
vendor: 1,056 bytes, lines 475-510
475\s]*/);
476            return ret;
477        }
478        function declarations() {
479            if (!open()) {
480                return error("missing '{'");
481            }
482            var d;
483            var decls = comments();
484            while (d = declaration()) {
485                decls.push(d);
486                decls = decls.concat(comments());
487            }
488            if (!close()) {
489                return error("missing '}'");
490            }
491            return decls;
492        }
493        function keyframe() {
494            whitespace();
495            var vals = [];
496            var m;
497            while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
498                vals.push(m[1]);
499                match(/^,\s*/);
500            }
501            if (vals.length) {
502                return {
503                    type: "keyframe",
504                    values: vals,
505                    declarations: declarations()
506                };
507            }
508        }
509        function at_keyframes() {
510            var m = match(/^@([-\w]+)?ke
510yframes\s*/);
511            if (!m) {
512                return;
513            }
514            var vendor = m[1];
515            m = match(/^([-\w]+)\s*/);
516            if (!m) {
517                return error("@keyframes missing name");
518            }
519            var name = m[1];
520            if (!open()) {
521                return error("@keyframes missing '{'");
522            }
523            var frame;
524            var frames = comments();
525            while (frame = keyframe()) {
526                frames.push(frame);
527                frames = frames.concat(comments());
528            }
529            if (!close()) {
530                return error("@keyframes missing '}'");
531            }
532            return {
533                type: "keyframes",
534                name: name,
535                vendor: vendor,
536                keyframes: frames
537            };
538        }
539        function at_page() {
540            var m = match(/^@page */);
541            if (m) {
542                var sel = selector() || [];
543                return {
544                    type: "page",
545                    selectors: sel,
546                    declarations: declarations()
547                };
548            }
549        }
550        function at_fontface() {
551            var m = match(/^@font-face\s*/);
552            if (m) {
553                return {
554                    type: "font-face",
555                    declarations: declarations()
556                };
557            }
558        }
559        function at_supports() {
560            var m = match(/^@supports *([^{]+)/);
561            if (m) {
562                return {
563                    type: "supports",
564                    supports: m[1].trim(),
565                    rules: rules()
566                };
567            }
568        }
569        function at_host() {
570            var m = match(/^@host\s*/);
571            if (m) {
572                return {
573                    type: "host",
574                    rules: rules()
575                };
576            }
577        }
578        function at_media() {
579            var m = match(/^@media *([^{]+)/);
580            if (m) {
581                return {
582                    type: "media",
583                    media: m[1].trim(),
584                    rules: rules()
585                };
586            }
587        }
588        function at_custom_m() {
589            var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
590            if (m) {
591                return {
592                    type: "custom-media",
593                    name: m[1].trim(),
594                    media: m[2].trim()
595                };
596            }
597        }
598        function at_document() {
599            var m = match(/^@([-\w]+)?document *([^{]+)/);
600            if (m) {
601                return {
602                    type: "document",
603                    document: m[2].trim(),
604                    vendor: m[1] ? m[1].trim() : null,
605                    rules: rules()
606                };
607            }
608        }
609        function at_x() {
610            var m = match(/^@(import|charset|namespace)\s*([^;]+);/);
611            if (m) {
612                return {
613                    type: m[1],
614                    name: m[2].trim()
615                };
616            }
617        }
618        function at_rule() {
619            whitespace();
620            if (css[0] === "@") {
621                var ret = at_keyframes() || at_supports() || at_host() || at_media() || at_custom_m() || at_page() || at_document() || at_fontface() || at_x();
622                if (ret && !settings.preserveStatic) {
623                    var hasVarFunc = false;
624                    if (ret.declarations) {
625                        hasVarFunc = ret.declarations.some(function(decl) {
626                            return /var\(/.test(decl.value);
627                        });
628                    } else {
629                        var arr = ret.keyframes || ret.rules || [];
630                        hasVarFunc = arr.some(function(obj) {
631                            return (obj.declarations || []).some(function(decl) {
632                                return /var\(/.test(decl.value);
633                            });
634                        });
635                    }
636                    return hasVarFunc ? ret : {};
637                }
638                return ret;
639            }
640        }
641        function rule() {
642            if (!settings.preserveStatic) {
643                var balancedMatch$1 = balancedMatch("{", "}", css);
644                if (balancedMatch$1) {
645                    var hasVarDecl = balancedMatch$1.pre.indexOf(":root") !== -1 && /--\S*\s*:/.test(balancedMatch$1.body);
646                    var hasVarFunc = /var\(/.test(balancedMatch$1.body);
647                    if (!hasVarDecl && !hasVarFunc) {
648                        css = css.slice(balancedMatch$1.end + 1);
649                        return {};
650                    }
651                }
652            }
653            var sel = selector() || [];
654            var decls = settings.preserveStatic ? declarations() : declarations().filter(function(decl) {
655                var hasVarDecl = sel.some(function(s) {
656                    return s.indexOf(":root") !== -1;
657                }) && /^--\S/.test(decl.property);
658                var hasVarFunc = /var\(/.test(decl.value);
659                return hasVarDecl || hasVarFunc;
660            });
661            if (!sel.length) {
662                error("selector missing");
663            }
664            return {
665                type: "rule",
666                selectors: sel,
667                declarations: decls
668            };
669        }
670        function rules(core) {
671            if (!core && !open()) {
672                return error("missing '{'");
673            }
674            var node;
675            var rules = comments();
676            while (css.length && (core || css[0] !== "}") && (node = at_rule() || rule())) {
677                if (node.type) {
678                    rules.push(node);
679                }
680                rules = rules.concat(comments());
681            }
682            if (!core && !close()) {
683                return error("missing '}'");
684            }
685            return rules;
686        }
687        return {
688            type: "stylesheet",
689            stylesheet: {
690                rules: rules(true),
691                errors: errors
692            }
693        };
694    }
695    function parseVars(cssData) {
696        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
697        var defaults = {
698            store: {},
699            onWarning: function onWarning() {}
700        };
701        var settings = _extends({}, defaults, options);
702        if (typeof cssData === "string") {
703            cssData = parseCss(cssData, settings);
704        }
705        cssData.stylesheet.rules.forEach(function(rule) {
706            if (rule.type !== "rule") {
707                return;
708            }
709            if (rule.selectors.length !== 1 || rule.selectors[0] !== ":root") {
710                return;
711            }
712            rule.declarations.forEach(function(decl, i) {
713                var prop = decl.property;
714                var value = decl.value;
715                if (prop && prop.indexOf("--") === 0) {
716                    settings.store[prop] = value;
717                }
718            });
719        });
720        return settings.store;
721    }
722    function stringifyCss(tree) {
723        var delim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
724        var cb = arguments.length > 2 ? arguments[2] : undefined;
725        var renderMethods = {
726            charset: function charset(node) {
727                return "@charset " + node.name + ";";
728            },
729            comment: function comment(node) {
730                return node.comment.indexOf("__CSSVARSPONYFILL") === 0 ? "/*" + node.comment + "*/" : "";
731            },
732            "custom-media": function customMedia(node) {
733                return "@custom-media " + node.name + " " + node.media + ";";
734            },
735            declaration: function declaration(node) {
736                return node.property + ":" + node.value + ";";
737            },
738            document: function document(node) {
739                return "@" + (node.vendor || "") + "document " + node.document + "{" + visit(node.rules) + "}";
740            },
741            "font-face": function fontFace(node) {
742                return "@font-face" + "{" + visit(node.declarations) + "}";
743            },
744            host: function host(node) {
745                return "@host" + "{" + visit(node.rules) + "}";
746            },
747            import: function _import(node) {
748                return "@import " + node.name + ";";
749            },
750            keyframe: function keyframe(node) {
751                return node.values.join(",") + "{" + visit(node.declarations) + "}";
752            },
753            keyframes: function keyframes(node) {
754                return "@" + (node.vendor || "") + "keyframes " + node.name + "{" + visit(node.keyframes) + "}";
755            },
756            media: function media(node) {
757                return "@media " + node.media + "{" + visit(node.rules) + "}";
758            },
759            namespace: function namespace(node) {
760                return "@namespace " + node.name + ";";
761            },
762            page: function page(node) {
763                return "@page " + (node.selectors.length ? node.selectors.join(", ") : "") + "{" + visit(node.declarations) + "}";
764            },
765            rule: function rule(node) {
766                var decls = node.declarations;
767                if (decls.length) {
768                    return node.selectors.join(",") + "{" + visit(decls) + "}";
769                }
770            },
771            supports: function supports(node) {
772                return "@supports " + node.supports + "{" + visit(node.rules) + "}";
773            }
774        };
775        function visit(nodes) {
776            var buf = "";
777            for (var i = 0; i < nodes.length; i++) {
778                var n = nodes[i];
779                if (cb) {
780                    cb(n);
781                }
782                var txt = renderMethods[n.type](n);
783                if (txt) {
784                    buf += txt;
785                    if (txt.length && n.selectors) {
786                        buf += delim;
787                    }
788                }
789            }
790            return buf;
791        }
792        return visit(tree.stylesheet.rules);
793    }
794    function walkCss(node, fn) {
vendor: 10,615 bytes, lines 795-1012
795        node.rules.forEach(function(rule) {
796            if (rule.rules) {
797                walkCss(rule, fn);
798                return;
799            }
800            if (rule.keyframes) {
801                rule.keyframes.forEach(function(keyframe) {
802                    if (keyframe.type === "keyframe") {
803                        fn(keyframe.declarations, rule);
804                    }
805                });
806                return;
807            }
808            if (!rule.declarations) {
809                return;
810            }
811            fn(rule.declarations, node);
812        });
813    }
814    var VAR_PROP_IDENTIFIER = "--";
815    var VAR_FUNC_IDENTIFIER = "var";
816    function transformCss(cssData) {
817        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
818        var defaults = {
819            preserveStatic: true,
820            preserveVars: false,
821            variables: {},
822            onWarning: function onWarning() {}
823        };
824        var settings = _extends({}, defaults, options);
825        if (typeof cssData === "string") {
826            cssData = parseCss(cssData, settings);
827        }
828        walkCss(cssData.stylesheet, function(declarations, node) {
829            for (var i = 0; i < declarations.length; i++) {
830                var decl = declarations[i];
831                var type = decl.type;
832                var prop = decl.property;
833                var value = decl.value;
834                if (type !== "declaration") {
835                    continue;
836                }
837                if (!settings.preserveVars && prop && prop.indexOf(VAR_PROP_IDENTIFIER) === 0) {
838                    declarations.splice(i, 1);
839                    i--;
840                    continue;
841                }
842                if (value.indexOf(VAR_FUNC_IDENTIFIER + "(") !== -1) {
843                    var resolvedValue = resolveValue(value, settings);
844                    if (resolvedValue !== decl.value) {
845                        resolvedValue = fixNestedCalc(resolvedValue);
846                        if (!settings.preserveVars) {
847                            decl.value = resolvedValue;
848                        } else {
849                            declarations.splice(i, 0, {
850                                type: type,
851                                property: prop,
852                                value: resolvedValue
853                            });
854                            i++;
855                        }
856                    }
857                }
858            }
859        });
860        return stringifyCss(cssData);
861    }
862    function fixNestedCalc(value) {
863        var reCalcVal = /calc\(([^)]+)\)/g;
864        (value.match(reCalcVal) || []).forEach(function(match) {
865            var newVal = "calc".concat(match.split("calc").join(""));
866            value = value.replace(match, newVal);
867        });
868        return value;
869    }
870    function resolveValue(value) {
871        var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
872        var __recursiveFallback = arguments.length > 2 ? arguments[2] : undefined;
873        if (value.indexOf("var(") === -1) {
874            return value;
875        }
876        var valueData = balancedMatch("(", ")", value);
877        function resolveFunc(value) {
878            var name = value.split(",")[0].replace(/[\s\n\t]/g, "");
879            var fallback = (value.match(/(?:\s*,\s*){1}(.*)?/) || [])[1];
880            var match = settings.variables.hasOwnProperty(name) ? String(settings.variables[name]) : undefined;
881            var replacement = match || (fallback ? String(fallback) : undefined);
882            var unresolvedFallback = __recursiveFallback || value;
883            if (!match) {
884                settings.onWarning('variable "'.concat(name, '" is undefined'));
885            }
886            if (replacement && replacement !== "undefined" && replacement.length > 0) {
887                return resolveValue(replacement, settings, unresolvedFallback);
888            } else {
889                return "var(".concat(unresolvedFallback, ")");
890            }
891        }
892        if (!valueData) {
893            if (value.indexOf("var(") !== -1) {
894                settings.onWarning('missing closing ")" in the value "'.concat(value, '"'));
895            }
896            return value;
897        } else if (valueData.pre.slice(-3) === "var") {
898            var isEmptyVarFunc = valueData.body.trim().length === 0;
899            if (isEmptyVarFunc) {
900                settings.onWarning("var() must contain a non-whitespace string");
901                return value;
902            } else {
903                return valueData.pre.slice(0, -3) + resolveFunc(valueData.body) + resolveValue(valueData.post, settings);
904            }
905        } else {
906            return valueData.pre + "(".concat(resolveValue(valueData.body, settings), ")") + resolveValue(valueData.post, settings);
907        }
908    }
909    var isBrowser = typeof window !== "undefined";
910    var isNativeSupport = isBrowser && window.CSS && window.CSS.supports && window.CSS.supports("(--a: 0)");
911    var counters = {
912        group: 0,
913        job: 0
914    };
915    var defaults = {
916        rootElement: isBrowser ? document : null,
917        shadowDOM: false,
918        include: "style,link[rel=stylesheet]",
919        exclude: "",
920        variables: {},
921        onlyLegacy: true,
922        preserveStatic: true,
923        preserveVars: false,
924        silent: false,
925        updateDOM: true,
926        updateURLs: true,
927        watch: null,
928        onBeforeSend: function onBeforeSend() {},
929        onWarning: function onWarning() {},
930        onError: function onError() {},
931        onSuccess: function onSuccess() {},
932        onComplete: function onComplete() {}
933    };
934    var regex = {
935        cssComments: /\/\*[\s\S]+?\*\//g,
936        cssKeyframes: /@(?:-\w*-)?keyframes/,
937        cssMediaQueries: /@media[^{]+\{([\s\S]+?})\s*}/g,
938        cssRootRules: /(?::root\s*{\s*[^}]*})/g,
939        cssUrls: /url\((?!['"]?(?:data|http|\/\/):)['"]?([^'")]*)['"]?\)/g,
940        cssVarDecls: /(?:[\s;]*)(-{2}\w[\w-]*)(?:\s*:\s*)([^;]*);/g,
941        cssVarFunc: /var\(\s*--[\w-]/,
942        cssVars: /(?:(?::root\s*{\s*[^;]*;*\s*)|(?:var\(\s*))(--[^:)]+)(?:\s*[:)])/
943    };
944    var variableStore = {
945        dom: {},
946        job: {},
947        user: {}
948    };
949    var cssVarsIsRunning = false;
950    var cssVarsObserver = null;
951    var cssVarsSrcNodeCount = 0;
952    var debounceTimer = null;
953    var isShadowDOMReady = false;
954    /**
955   * Fetches, parses, and transforms CSS custom properties from specified
956   * <style> and <link> elements into static values, then appends a new <style>
957   * element with static values to the DOM to provide CSS custom property
958   * compatibility for legacy browsers. Also provides a single interface for
959   * live updates of runtime values in both modern and legacy browsers.
960   *
961   * @preserve
962   * @param {object}   [options] Options object
963   * @param {object}   [options.rootElement=document] Root element to traverse for
964   *                   <link> and <style> nodes
965   * @param {boolean}  [options.shadowDOM=false] Determines if shadow DOM <link>
966   *                   and <style> nodes will be processed.
967   * @param {string}   [options.include="style,link[rel=stylesheet]"] CSS selector
968   *                   matching <link re="stylesheet"> and <style> nodes to
969   *                   process
970   * @param {string}   [options.exclude] CSS selector matching <link
971   *                   rel="stylehseet"> and <style> nodes to exclude from those
972   *                   matches by options.include
973   * @param {object}   [options.variables] A map of custom property name/value
974   *                   pairs. Property names can omit or include the leading
975   *                   double-hyphen (—), and values specified will override
976   *                   previous values
977   * @param {boolean}  [options.onlyLegacy=true] Determines if the ponyfill will
978   *                   only generate legacy-compatible CSS in browsers that lack
979   *                   native support (i.e., legacy browsers)
980   * @param {boolean}  [options.preserveStatic=true] Determines if CSS
981   *                   declarations that do not reference a custom property will
982   *                   be preserved in the transformed CSS
983   * @param {boolean}  [options.preserveVars=false] Determines if CSS custom
984   *                   property declarations will be preserved in the transformed
985   *                   CSS
986   * @param {boolean}  [options.silent=false] Determines if warning and error
987   *                   messages will be displayed on the console
988   * @param {boolean}  [options.updateDOM=true] Determines if the ponyfill will
989   *                   update the DOM after processing CSS custom properties
990   * @param {boolean}  [options.updateURLs=true] Determines if the ponyfill will
991   *                   convert relative url() paths to absolute urls
992   * @param {boolean}  [options.watch=false] Determines if a MutationObserver will
993   *                   be created that will execute the ponyfill when a <link> or
994   *                   <style> DOM mutation is observed
995   * @param {function} [options.onBeforeSend] Callback before XHR is sent. Passes
996   *                   1) the XHR object, 2) source node reference, and 3) the
997   *                   source URL as arguments
998   * @param {function} [options.onWarning] Callback after each CSS parsing warning
999   *                   has occurred. Passes 1) a warning message as an argument.
1000   * @param {function} [options.onError] Callback after a CSS parsing error has
1001   *                   occurred or an XHR request has failed. Passes 1) an error
1002   *                   message, and 2) source node reference, 3) xhr, and 4 url as
1003   *                   arguments.
1004   * @param {function} [options.onSuccess] Callback after CSS data has been
1005   *                   collected from each node and before CSS custom properties
1006   *                   have been transformed. Allows modifying the CSS data before
1007   *                   it is transformed by returning any string value (or false
1008   *                   to skip). Passes 1) CSS text, 2) source node reference, and
1009   *                   3) the source URL as arguments.
1010   * @param {function} [options.onComplete] Callback after all CSS has been
1011   *                   processed, legacy-compatible CSS has been generated, and
1012   *                   (optionally) the DOM has been updated. Passes 1) a CSS
1013   *                   string with CSS variable values resolved, 2) an array of
1014   *                   output <style> node references that have been appended to
1015   *                   the DOM, 3) an object containing all custom properies names
1016   *                   and values, and 4) the ponyfill execution time in
1017   *                   milliseconds.
1018   *
1019   * @example
1020   *
1021   *   cssVars({
1022   *     rootElement   : document,
1023   *     shadowDOM     : false,
1024   *     include       : 'style,link[rel="stylesheet"]',
1025   *     exclude       : '',
1026   *     variables     : {},
1027   *     onlyLegacy    : true,
1028   *     preserveStatic: true,
1029   *     preserveVars  : false,
1030   *     silent        : false,
1031   *     updateDOM     : true,
1032   *     updateURLs    : true,
1033   *     watch         : false,
1034   *     onBeforeSend(xhr, node, url) {},
1035   *     onWarning(message) {},
1036   *     onError(message, node, xhr, url) {},
1037   *     onSuccess(cssText, node, url) {},
1038   *     onComplete(cssText, styleNode, cssVariables, benchmark) {}
1039   *   });
1040   */    function cssVars() {
1041        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1042        var msgPrefix = "cssVars(): ";
1043        var settings = _extends({}, defaults, options);
1044        function handleError(message, sourceNode, xhr, url) {
1045            if (!settings.silent && window.console) {
1046                console.error("".concat(msgPrefix).concat(message, "\n"), sourceNode);
1047            }
1048            settings.onError(message, sourceNode, xhr, url);
1049        }
1050        function handleWarning(message) {
1051            if (!settings.silent && window.console) {
1052                console.warn("".concat(msgPrefix).concat(message));
1053            }
1054            settings.onWarning(message);
1055        }
1056        if (!isBrowser) {
1057            return;
1058        }
1059        if (settings.watch) {
1060            settings.watch = defaults.watch;
1061            addMutationObserver(settings);
1062            cssVars(settings);
1063            return;
1064        } else if (settings.watch === false && cssVarsObserver) {
1065            cssVarsObserver.disconnect();
1066            cssVarsObserver = null;
1067        }
1068        if (!settings.__benchmark) {
1069            if (cssVarsIsRunning === settings.rootElement) {
1070                cssVarsDebounced(options);
1071                return;
1072            }
1073            settings.__benchmark = getTimeStamp();
1074            settings.exclude = [ cssVarsObserver ? '[data-cssvars]:not([data-cssvars=""])' : '[data-cssvars="out"]', settings.exclude ].filter(function(selector) {
1075                return selector;
1076            }).join(",");
1077            settings.variables = fixVarNames(settings.variables);
1078            if (!cssVarsObserver) {
1079                var outNodes = Array.apply(null, settings.rootElement.querySelectorAll('[data-cssvars="out"]'));
1080                outNodes.forEach(function(outNode) {
1081                    var dataGroup = outNode.getAttribute("data-cssvars-group");
1082                    var srcNode = dataGroup ? settings.rootElement.querySelector('[data-cssvars="src"][data-cssvars-group="'.concat(dataGroup, '"]')) : null;
1083                    if (!srcNode) {
1084                        outNode.parentNode.removeChild(outNode);
1085                    }
1086                });
1087                if (cssVarsSrcNodeCount) {
1088                    var srcNodes = settings.rootElement.querySelectorAll('[data-cssvars]:not([data-cssvars="out"])');
1089                    if (srcNodes.length < cssVarsSrcNodeCount) {
1090                        cssVarsSrcNodeCount = srcNodes.length;
1091                        variableStore.dom = {};
1092                    }
1093                }
1094            }
1095        }
1096        if (document.readyState !== "loading") {
1097            var isShadowElm = settings.shadowDOM || settings.rootElement.shadowRoot || settings.rootElement.host;
1098            if (isNativeSupport && settings.onlyLegacy) {
1099                if (settings.updateDOM) {
1100                    var targetElm = settings.rootElement.host || (settings.rootElement === document ? document.documentElement : settings.rootElement);
1101                    Object.keys(settings.variables).forEach(function(key) {
1102                        targetElm.style.setProperty(key, settings.variables[key]);
1103                    });
1104                }
1105            } else if (isShadowElm && !isShadowDOMReady) {
1106                getCssData({
1107                    rootElement: defaults.rootElement,
1108                    include: defaults.include,
1109                    exclude: settings.exclude,
1110                    onSuccess: function onSuccess(cssText, node, url) {
1111                        cssText = cssText.replace(regex.cssComments, "").replace(regex.cssMediaQueries, "");
1112                        cssText = (cssText.match(regex.cssRootRules) || []).join("");
1113                        return cssText || false;
1114                    },
1115                    onComplete: function onComplete(cssText, cssArray, nodeArray) {
1116                        parseVars(cssText, {
1117                            store: variableStore.dom,
1118                            onWarning: handleWarning
1119                        });
1120                        isShadowDOMReady = true;
1121                        cssVars(settings);
1122                    }
1123                });
1124            } else {
1125                cssVarsIsRunning = settings.rootElement;
1126                getCssData({
1127                    rootElement: settings.rootElement,
1128                    include: settings.include,
1129                    exclude: settings.exclude,
1130                    onBeforeSend: settings.onBeforeSend,
1131                    onError: function onError(xhr, node, url) {
1132                        var responseUrl = xhr.responseURL || getFullUrl$1(url, location.href);
1133                        var statusText = xhr.statusText ? "(".concat(xhr.statusText, ")") : "Unspecified Error" + (xhr.status === 0 ? " (possibly CORS related)" : "");
1134                        var errorMsg = "CSS XHR Error: ".concat(responseUrl, " ").concat(xhr.status, " ").concat(statusText);
1135                        handleError(errorMsg, node, xhr, responseUrl);
1136                    },
1137                    onSuccess: function onSuccess(cssText, node, url) {
1138                        var returnVal = settings.onSuccess(cssText, node, url);
1139                        cssText = returnVal !== undefined && Boolean(returnVal) === false ? "" : returnVal || cssText;
1140                        if (settings.updateURLs) {
1141                            cssText = fixRelativeCssUrls(cssText, url);
1142                        }
1143                        return cssText;
1144                    },
1145                    onComplete: function onComplete(cssText, cssArray) {
1146                        var nodeArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1147                        var jobVars = {};
1148                        var varStore = settings.updateDOM ? variableStore.dom : Object.keys(variableStore.job).length ? variableStore.job : variableStore.job = JSON.parse(JSON.stringify(variableStore.dom));
1149                        var hasVarChange = false;
1150                        nodeArray.forEach(function(node, i) {
1151                            if (regex.cssVars.test(cssArray[i])) {
1152                                try {
1153                                    var cssTree = parseCss(cssArray[i], {
1154                                        preserveStatic: settings.preserveStatic,
1155                                        removeComments: true
1156                                    });
1157                                    parseVars(cssTree, {
1158                                        store: jobVars,
1159                                        onWarning: handleWarning
1160                                    });
1161                                    node.__cssVars = {
1162                                        tree: cssTree
1163                                    };
1164                                } catch (err) {
1165                                    handleError(err.message, node);
1166                                }
1167                            }
1168                        });
1169                        if (settings.updateDOM) {
1170                            _extends(variableStore.user, settings.variables);
1171                        }
1172                        _extends(jobVars, settings.variables);
1173                        hasVarChange = Boolean((document.querySelector("[data-cssvars]") || Object.keys(variableStore.dom).length) && Object.keys(jobVars).some(function(name) {
1174                            return jobVars[name] !== varStore[name];
1175                        }));
1176                        _extends(varStore, variableStore.user, jobVars);
1177                        if (hasVarChange) {
1178                            resetCssNodes(settings.rootElement);
1179                            cssVars(settings);
1180                        } else {
1181                            var outCssArray = [];
1182                            var outNodeArray = [];
1183                            var hasKeyframesWithVars = false;
1184                            variableStore.job = {};
1185                            if (settings.updateDOM) {
1186                                counters.job++;
1187                            }
1188                            nodeArray.forEach(function(node) {
1189                                var isSkip = !node.__cssVars;
1190                                if (node.__cssVars) {
1191                                    try {
1192                                        transformCss(node.__cssVars.tree, _extends({}, settings, {
1193                                            variables: varStore,
1194                                            onWarning: handleWarning
1195                                        }));
1196                                        var outCss = stringifyCss(node.__cssVars.tree);
1197                                        if (settings.updateDOM) {
1198                                            if (!node.getAttribute("data-cssvars")) {
1199                                                node.setAttribute("data-cssvars", "src");
1200                                            }
1201                                            if (outCss.length) {
1202                                                var dataGroup = node.getAttribute("data-cssvars-group") || ++counters.group;
1203                                                var outCssNoSpaces = outCss.replace(/\s/g, "");
1204                                                var outNode = settings.rootElement.querySelector('[data-cssvars="out"][data-cssvars-group="'.concat(dataGroup, '"]')) || document.createElement("style");
1205                                                hasKeyframesWithVars = hasKeyframesWithVars || regex.cssKeyframes.test(outCss);
1206                                                if (!outNode.hasAttribute("data-cssvars")) {
1207                                                    outNode.setAttribute("data-cssvars", "out");
1208                                                }
1209                                                if (outCssNoSpaces === node.textContent.replace(/\s/g, "")) {
1210                                                    isSkip = true;
1211                                                    if (outNode && outNode.parentNode) {
1212                                                        node.removeAttribute("data-cssvars-group");
1213                                                        outNode.parentNode.removeChild(outNode);
1214                                                    }
1215                                                } else if (outCssNoSpaces !== outNode.textContent.replace(/\s/g, "")) {
1216                                                    [ node, outNode ].forEach(function(n) {
1217                                                        n.setAttribute("data-cssvars-job", counters.job);
1218                                                        n.setAttribute("data-cssvars-group", dataGroup);
1219                                                    });
1220                                                    outNode.textContent = outCss;
1221                                                    outCssArray.push(outCss);
1222                                                    outNodeArray.push(outNode);
1223                                                    if (!outNode.parentNode) {
1224                                                        node.parentNode.insertBefore(outNode, node.nextSibling);
1225                                                    }
1226                                                }
1227                                            }
1228                                        } else {
1229                                            if (node.textContent.replace(/\s/g, "") !== outCss) {
1230                                                outCssArray.push(outCss);
1231                                            }
1232                                        }
1233                                    } catch (err) {
1234                                        handleError(err.message, node);
1235                                    }
1236                                }
1237                                if (isSkip) {
1238                                    node.setAttribute("data-cssvars", "skip");
1239                                }
1240                                if (!node.hasAttribute("data-cssvars-job")) {
1241                                    node.setAttribute("data-cssvars-job", counters.job);
1242                                }
1243                            });
1244                            cssVarsSrcNodeCount = settings.rootElement.querySelectorAll('[data-cssvars]:not([data-cssvars="out"])').length;
1245                            if (settings.shadowDOM) {
1246                                var elms = [ settings.rootElement ].concat(_toConsumableArray(settings.rootElement.querySelectorAll("*")));
1247                                for (var i = 0, elm; elm = elms[i]; ++i) {
1248                                    if (elm.shadowRoot && elm.shadowRoot.querySelector("style")) {
1249                                        var shadowSettings = _extends({}, settings, {
1250                                            rootElement: elm.shadowRoot,
1251                                            variables: variableStore.dom
1252                                        });
1253                                        cssVars(shadowSettings);
1254                                    }
1255                                }
1256                            }
1257                            if (settings.updateDOM && hasKeyframesWithVars) {
1258                                fixKeyframes(settings.rootElement);
1259                            }
1260                            cssVarsIsRunning = false;
1261                            settings.onComplete(outCssArray.join(""), outNodeArray, JSON.parse(JSON.stringify(varStore)), getTimeStamp() - settings.__benchmark);
1262                        }
1263                    }
1264                });
1265            }
1266        } else {
1267            document.addEventListener("DOMContentLoaded", function init(evt) {
1268                cssVars(options);
1269                document.removeEventListener("DOMContentLoaded", init);
1270            });
1271        }
1272    }
1273    cssVars.reset = function() {
1274        cssVarsIsRunning = false;
1275        if (cssVarsObserver) {
1276            cssVarsObserver.disconnect();
1277            cssVarsObserver = null;
1278        }
1279        cssVarsSrcNodeCount = 0;
1280        debounceTimer = null;
1281        isShadowDOMReady = false;
1282        for (var prop in variableStore) {
1283            variableStore[prop] = {};
1284        }
1285    };
1286    function addMutationObserver(settings) {
1287        function isLink(node) {
1288            var isStylesheet = node.tagName === "LINK" && (node.getAttribute("rel") || "").indexOf("stylesheet") !== -1;
1289            return isStylesheet && !node.disabled;
1290        }
1291        function isStyle(node) {
1292            return node.tagName === "STYLE" && !node.disabled;
1293        }
1294        function isValidAddMutation(mutationNodes) {
1295            return Array.apply(null, mutationNodes).some(function(node) {
1296                var isElm = node.nodeType === 1;
1297                var hasAttr = isElm && node.hasAttribute("data-cssvars");
1298                var isStyleWithVars = isStyle(node) && regex.cssVars.test(node.textContent);
1299                var isValid = !hasAttr && (isLink(node) || isStyleWithVars);
1300                return isValid;
1301            });
1302        }
1303        function isValidRemoveMutation(mutationNodes) {
1304            return Array.apply(null, mutationNodes).some(function(node) {
1305                var isElm = node.nodeType === 1;
1306                var isOutNode = isElm && node.getAttribute("data-cssvars") === "out";
1307                var isSrcNode = isElm && node.getAttribute("data-cssvars") === "src";
1308                var isValid = isSrcNode;
1309                if (isSrcNode || isOutNode) {
1310                    var dataGroup = node.getAttribute("data-cssvars-group");
1311                    var orphanNode = settings.rootElement.querySelector('[data-cssvars-group="'.concat(dataGroup, '"]'));
1312                    if (isSrcNode) {
1313                        resetCssNodes(settings.rootElement);
1314                        variableStore.dom = {};
1315                    }
1316                    if (orphanNode) {
1317                        orphanNode.parentNode.removeChild(orphanNode);
1318                    }
1319                }
1320                return isValid;
1321            });
1322        }
1323        if (!window.MutationObserver) {
1324            return;
1325        }
1326        if (cssVarsObserver) {
1327            cssVarsObserver.disconnect();
1328            cssVarsObserver = null;
1329        }
1330        cssVarsObserver = new MutationObserver(function(mutations) {
1331            var hasValidMutation = mutations.some(function(mutation) {
1332                var isValid = false;
1333                if (mutation.type === "attributes") {
1334                    isValid = isLink(mutation.target);
1335                } else if (mutation.type === "childList") {
1336                    isValid = isValidAddMutation(mutation.addedNodes) || isValidRemoveMutation(mutation.removedNodes);
1337                }
1338                return isValid;
1339            });
1340            if (hasValidMutation) {
1341                cssVars(settings);
1342            }
1343        });
1344        cssVarsObserver.observe(document.documentElement, {
1345            attributes: true,
1346            attributeFilter: [ "disabled", "href" ],
1347            childList: true,
1348            subtree: true
1349        });
1350    }
1351    function cssVarsDebounced(settings) {
1352        var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
1353        clearTimeout(debounceTimer);
1354        debounceTimer = setTimeout(function() {
1355            settings.__benchmark = null;
1356            cssVars(settings);
1357        }, delay);
1358    }
1359    function fixKeyframes(rootElement) {
1360        var animationNameProp = [ "animation-name", "-moz-animation-name", "-webkit-animation-name" ].filter(function(prop) {
1361            return getComputedStyle(document.body)[prop];
1362        })[0];
1363        if (animationNameProp) {
1364            var allNodes = rootElement.getElementsByTagName("*");
1365            var keyframeNodes = [];
1366            var nameMarker = "__CSSVARSPONYFILL-KEYFRAMES__";
1367            for (var i = 0, len = allNodes.length; i < len; i++) {
1368                var node = allNodes[i];
1369                var animationName = getComputedStyle(node)[animationNameProp];
1370                if (animationName !== "none") {
1371                    node.style[animationNameProp] += nameMarker;
1372                    keyframeNodes.push(node);
1373                }
1374            }
1375            void document.body.offsetHeight;
1376            for (var _i = 0, _len = keyframeNodes.length; _i < _len; _i++) {
1377                var nodeStyle = keyframeNodes[_i].style;
1378                nodeStyle[animationNameProp] = nodeStyle[animationNameProp].replace(nameMarker, "");
1379            }
1380        }
1381    }
1382    function fixRelativeCssUrls(cssText, baseUrl) {
1383        var cssUrls = cssText.replace(regex.cssComments, "").match(regex.cssUrls) || [];
1384        cssUrls.forEach(function(cssUrl) {
1385            var oldUrl = cssUrl.replace(regex.cssUrls, "$1");
1386            var newUrl = getFullUrl$1(oldUrl, baseUrl);
1387            cssText = cssText.replace(cssUrl, cssUrl.replace(oldUrl, newUrl));
1388        });
1389        return cssText;
1390    }
1391    function fixVarNames() {
1392        var varObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1393        var reLeadingHyphens = /^-{2}/;
1394        return Object.keys(varObj).reduce(function(obj, value) {
1395            var key = reLeadingHyphens.test(value) ? value : "--".concat(value.replace(/^-+/, ""));
1396            obj[key] = varObj[value];
1397            return obj;
1398        }, {});
1399    }
1400    function getFullUrl$1(url) {
1401        var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.href;
1402        var d = document.implementation.createHTMLDocument("");
1403        var b = d.createElement("base");
1404        var a = d.createElement("a");
1405        d.head.appendChild(b);
1406        d.body.appendChild(a);
1407        b.href = base;
1408        a.href = url;
1409        return a.href;
1410    }
1411    function getTimeStamp() {
1412        return isBrowser && (window.performance || {}).now ? window.performance.now() : new Date().getTime();
1413    }
1414    function resetCssNodes(rootElement) {
1415        var resetNodes = Array.apply(null, rootElement.querySelectorAll('[data-cssvars="skip"],[data-cssvars="src"]'));
1416        resetNodes.forEach(function(node) {
1417            return node.setAttribute("data-cssvars", "");
1418        });
1419    }
1420    return cssVars;
1421});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.