@glimt/record 0.0.46 → 0.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/record.cjs CHANGED
@@ -443,7 +443,7 @@ function isShadowRoot(n2) {
443
443
  function isNativeShadowDom(shadowRoot2) {
444
444
  return Object.prototype.toString.call(shadowRoot2) === "[object ShadowRoot]";
445
445
  }
446
- function fixBrowserCompatibilityIssuesInCSS$1(cssText) {
446
+ function fixBrowserCompatibilityIssuesInCSS(cssText) {
447
447
  if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
448
448
  cssText = cssText.replace(
449
449
  /\sbackground-clip:\s*text;/g,
@@ -452,7 +452,7 @@ function fixBrowserCompatibilityIssuesInCSS$1(cssText) {
452
452
  }
453
453
  return cssText;
454
454
  }
455
- function escapeImportStatement$1(rule2) {
455
+ function escapeImportStatement(rule2) {
456
456
  const { cssText } = rule2;
457
457
  if (cssText.split('"').length < 3) return cssText;
458
458
  const statement = ["@import", `url(${JSON.stringify(rule2.href)})`];
@@ -469,7 +469,7 @@ function escapeImportStatement$1(rule2) {
469
469
  }
470
470
  return statement.join(" ") + ";";
471
471
  }
472
- function stringifyStylesheet$1(s2) {
472
+ function stringifyStylesheet(s2) {
473
473
  try {
474
474
  const rules2 = s2.rules || s2.cssRules;
475
475
  if (!rules2) {
@@ -481,48 +481,47 @@ function stringifyStylesheet$1(s2) {
481
481
  }
482
482
  const stringifiedRules = Array.from(
483
483
  rules2,
484
- (rule2) => stringifyRule$1(rule2, sheetHref)
484
+ (rule2) => stringifyRule(rule2, sheetHref)
485
485
  ).join("");
486
- return fixBrowserCompatibilityIssuesInCSS$1(stringifiedRules);
486
+ return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
487
487
  } catch (error) {
488
- console.log("stringifyStylesheet error:", error);
489
488
  return null;
490
489
  }
491
490
  }
492
- function stringifyRule$1(rule2, sheetHref) {
493
- if (isCSSImportRule$1(rule2)) {
491
+ function stringifyRule(rule2, sheetHref) {
492
+ if (isCSSImportRule(rule2)) {
494
493
  let importStringified;
495
494
  try {
496
495
  importStringified = // for same-origin stylesheets,
497
496
  // we can access the imported stylesheet rules directly
498
- stringifyStylesheet$1(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
499
- escapeImportStatement$1(rule2);
497
+ stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
498
+ escapeImportStatement(rule2);
500
499
  } catch (error) {
501
500
  importStringified = rule2.cssText;
502
501
  }
503
502
  if (rule2.styleSheet.href) {
504
- return absolutifyURLs$1(importStringified, rule2.styleSheet.href);
503
+ return absolutifyURLs(importStringified, rule2.styleSheet.href);
505
504
  }
506
505
  return importStringified;
507
506
  } else {
508
507
  let ruleStringified = rule2.cssText;
509
- if (isCSSStyleRule$1(rule2) && rule2.selectorText.includes(":")) {
510
- ruleStringified = fixSafariColons$1(ruleStringified);
508
+ if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
509
+ ruleStringified = fixSafariColons(ruleStringified);
511
510
  }
512
511
  if (sheetHref) {
513
- return absolutifyURLs$1(ruleStringified, sheetHref);
512
+ return absolutifyURLs(ruleStringified, sheetHref);
514
513
  }
515
514
  return ruleStringified;
516
515
  }
517
516
  }
518
- function fixSafariColons$1(cssStringified) {
517
+ function fixSafariColons(cssStringified) {
519
518
  const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
520
519
  return cssStringified.replace(regex, "$1\\$2");
521
520
  }
522
- function isCSSImportRule$1(rule2) {
521
+ function isCSSImportRule(rule2) {
523
522
  return "styleSheet" in rule2;
524
523
  }
525
- function isCSSStyleRule$1(rule2) {
524
+ function isCSSStyleRule(rule2) {
526
525
  return "selectorText" in rule2;
527
526
  }
528
527
  class Mirror {
@@ -659,7 +658,7 @@ function extractFileExtension(path, baseURL) {
659
658
  const match = url.pathname.match(regex);
660
659
  return (match == null ? void 0 : match[1]) ?? null;
661
660
  }
662
- function extractOrigin$1(url) {
661
+ function extractOrigin(url) {
663
662
  let origin = "";
664
663
  if (url.indexOf("//") > -1) {
665
664
  origin = url.split("/").slice(0, 3).join("/");
@@ -669,27 +668,27 @@ function extractOrigin$1(url) {
669
668
  origin = origin.split("?")[0];
670
669
  return origin;
671
670
  }
672
- const URL_IN_CSS_REF$1 = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
673
- const URL_PROTOCOL_MATCH$1 = /^(?:[a-z+]+:)?\/\//i;
674
- const URL_WWW_MATCH$1 = /^www\..*/i;
675
- const DATA_URI$1 = /^(data:)([^,]*),(.*)/i;
676
- function absolutifyURLs$1(cssText, href) {
671
+ const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
672
+ const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
673
+ const URL_WWW_MATCH = /^www\..*/i;
674
+ const DATA_URI = /^(data:)([^,]*),(.*)/i;
675
+ function absolutifyURLs(cssText, href) {
677
676
  return (cssText || "").replace(
678
- URL_IN_CSS_REF$1,
677
+ URL_IN_CSS_REF,
679
678
  (origin, quote1, path1, quote2, path2, path3) => {
680
679
  const filePath = path1 || path2 || path3;
681
680
  const maybeQuote = quote1 || quote2 || "";
682
681
  if (!filePath) {
683
682
  return origin;
684
683
  }
685
- if (URL_PROTOCOL_MATCH$1.test(filePath) || URL_WWW_MATCH$1.test(filePath)) {
684
+ if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
686
685
  return `url(${maybeQuote}${filePath}${maybeQuote})`;
687
686
  }
688
- if (DATA_URI$1.test(filePath)) {
687
+ if (DATA_URI.test(filePath)) {
689
688
  return `url(${maybeQuote}${filePath}${maybeQuote})`;
690
689
  }
691
690
  if (filePath[0] === "/") {
692
- return `url(${maybeQuote}${extractOrigin$1(href) + filePath}${maybeQuote})`;
691
+ return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;
693
692
  }
694
693
  const stack = href.split("/");
695
694
  const parts = filePath.split("/");
@@ -812,189 +811,6 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
812
811
  function markCssSplits(cssText, style) {
813
812
  return splitCssText(cssText, style).join("/* rr_split */");
814
813
  }
815
- const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 30;
816
- const DATA_ATTRIBUTE_CLONED_NAME$1 = "data-rrweb-link-cloned";
817
- const DISALLOWED_EXTENSIONS$1 = [
818
- // Fonts
819
- "woff",
820
- "woff2",
821
- "ttf",
822
- "otf",
823
- // Embedded OpenType font
824
- "eot",
825
- // Images
826
- "png",
827
- "jpg",
828
- "jpeg",
829
- "gif",
830
- "svg",
831
- "webp",
832
- "ico",
833
- // Scripts
834
- "js",
835
- "mjs",
836
- "ts",
837
- "jsx",
838
- "tsx",
839
- // Data files
840
- "json",
841
- "map",
842
- // Media
843
- "mp4",
844
- "webm",
845
- "ogg",
846
- "mp3",
847
- "wav",
848
- // Archives
849
- "zip",
850
- "rar",
851
- "7z",
852
- "tar",
853
- "gz",
854
- // Documents
855
- "pdf",
856
- "doc",
857
- "docx",
858
- "xls",
859
- "xlsx"
860
- ];
861
- const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
862
- constructor() {
863
- __publicField$1(this, "currentHref", null);
864
- __publicField$1(this, "clones", {});
865
- __publicField$1(this, "cleanTimeout", null);
866
- if (_AsyncStylesheetManager.instance) return _AsyncStylesheetManager.instance;
867
- _AsyncStylesheetManager.instance = this;
868
- }
869
- removeCloneNode(href) {
870
- var _a2;
871
- if (!(href in this.clones) || this.clones[href] === void 0) return;
872
- const clone = document.querySelector(
873
- `link[${DATA_ATTRIBUTE_CLONED_NAME$1}="${this.clones[href].cloneNodeAttrId}"]`
874
- );
875
- if (!clone) return;
876
- (_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
877
- }
878
- onLoad(href) {
879
- if (!(href in this.clones) || this.clones[href] === void 0) return;
880
- const styleSheets2 = Array.from(document.styleSheets);
881
- let clonedStyleSheet = null;
882
- for (let i2 = styleSheets2.length - 1; i2 >= 0; i2--) {
883
- if (styleSheets2[i2].href === href) {
884
- clonedStyleSheet = styleSheets2[i2];
885
- break;
886
- }
887
- }
888
- if (!clonedStyleSheet) return this.removeCloneNode(href);
889
- const newCssText = stringifyStylesheet$1(clonedStyleSheet);
890
- this.removeCloneNode(href);
891
- if (!newCssText) return;
892
- this.clones[href].cssText = newCssText;
893
- this.clones[href].loaded = true;
894
- const original = document.querySelector(
895
- `link[${DATA_ATTRIBUTE_CLONED_NAME$1}="source-${this.clones[href].cloneNodeAttrId}"]`
896
- );
897
- if (original) {
898
- original.setAttribute("data-rrweb-mutation", Date.now().toString());
899
- original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME$1);
900
- } else {
901
- this.clones[href].original.setAttribute(
902
- "data-rrweb-mutation",
903
- Date.now().toString()
904
- );
905
- this.clones[href].original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME$1);
906
- }
907
- window.dispatchEvent(
908
- new CustomEvent("__rrweb_custom_event__", {
909
- detail: {
910
- type: 5,
911
- timestamp: Date.now(),
912
- data: {
913
- tag: "async-css-resolution",
914
- requestCssId: this.clones[href].requestCssId,
915
- cssText: this.clones[href].cssText
916
- }
917
- }
918
- })
919
- );
920
- }
921
- onLoadError(href) {
922
- if (!(href in this.clones) || this.clones[href] === void 0) return;
923
- this.removeCloneNode(href);
924
- }
925
- removeAllCloneElements() {
926
- for (const href of Object.keys(this.clones)) {
927
- this.removeCloneNode(href);
928
- }
929
- }
930
- onCleanTimeout() {
931
- asyncStylesheetManager$1.cleanTimeout = null;
932
- asyncStylesheetManager$1.removeAllCloneElements();
933
- }
934
- blowCache() {
935
- this.removeAllCloneElements();
936
- this.clones = {};
937
- }
938
- requestClone({
939
- forElement,
940
- requestCssId
941
- }) {
942
- if (this.currentHref != null && document.location.href !== this.currentHref)
943
- this.blowCache();
944
- this.currentHref = document.location.href;
945
- const href = forElement.href;
946
- if (!href) return;
947
- if (href in this.clones && this.clones[href] !== void 0) return;
948
- if (forElement.getAttribute("crossorigin") === "anonymous") return;
949
- if (forElement.rel !== "stylesheet") {
950
- const last = href.split("/").pop();
951
- if (last && last.includes(".")) {
952
- const [filename] = last.split("?");
953
- const ext = filename.split(".").pop();
954
- if (ext) {
955
- if (DISALLOWED_EXTENSIONS$1.includes(ext.trim().toLowerCase())) return;
956
- }
957
- }
958
- }
959
- const clone = forElement.cloneNode();
960
- const cloneNodeAttrId = Math.random().toString(36).slice(2);
961
- clone.setAttribute("crossorigin", "anonymous");
962
- clone.setAttribute(DATA_ATTRIBUTE_CLONED_NAME$1, cloneNodeAttrId);
963
- forElement.setAttribute(
964
- DATA_ATTRIBUTE_CLONED_NAME$1,
965
- `source-${cloneNodeAttrId}`
966
- );
967
- document.head.appendChild(clone);
968
- this.clones[href] = {
969
- original: forElement,
970
- clone,
971
- loaded: false,
972
- cssText: null,
973
- cloneNodeAttrId,
974
- requestCssId
975
- };
976
- clone.onload = () => {
977
- this.onLoad(href);
978
- };
979
- clone.onerror = () => {
980
- this.onLoadError(href);
981
- };
982
- if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
983
- this.cleanTimeout = setTimeout(
984
- asyncStylesheetManager$1.onCleanTimeout,
985
- CLEANUP_DEBOUNCE_TIME$1
986
- );
987
- }
988
- getClonedCssTextIfAvailable(href) {
989
- if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
990
- return this.clones[href].cssText;
991
- }
992
- return null;
993
- }
994
- };
995
- __publicField$1(_AsyncStylesheetManager$1, "instance");
996
- let AsyncStylesheetManager$1 = _AsyncStylesheetManager$1;
997
- const asyncStylesheetManager$1 = new AsyncStylesheetManager$1();
998
814
  let _id = 1;
999
815
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
1000
816
  const IGNORED_NODE = -2;
@@ -1106,7 +922,7 @@ function transformAttribute(doc, tagName, name, value) {
1106
922
  } else if (name === "srcset") {
1107
923
  return getAbsoluteSrcsetString(doc, value);
1108
924
  } else if (name === "style") {
1109
- return absolutifyURLs$1(value, getHref(doc));
925
+ return absolutifyURLs(value, getHref(doc));
1110
926
  } else if (tagName === "object" && name === "data") {
1111
927
  return absoluteToDoc(doc, value);
1112
928
  }
@@ -1343,7 +1159,7 @@ function serializeTextNode(n2, options) {
1343
1159
  } else if (!cssCaptured) {
1344
1160
  textContent2 = index.textContent(n2);
1345
1161
  if (isStyle && textContent2) {
1346
- textContent2 = absolutifyURLs$1(textContent2, getHref(options.doc));
1162
+ textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
1347
1163
  }
1348
1164
  }
1349
1165
  if (!isStyle && !isScript && textContent2 && needsMask) {
@@ -1386,38 +1202,21 @@ function serializeElementNode(n2, options) {
1386
1202
  }
1387
1203
  }
1388
1204
  if (tagName === "link" && inlineStylesheet) {
1389
- const styleSheets2 = Array.from(doc.styleSheets);
1390
- let stylesheet = null;
1391
- for (let i2 = 0; i2 < styleSheets2.length; i2++) {
1392
- if (styleSheets2[i2].href === n2.href) {
1393
- stylesheet = styleSheets2[i2];
1394
- break;
1395
- }
1396
- }
1205
+ const stylesheet = Array.from(doc.styleSheets).find((s2) => {
1206
+ return s2.href === n2.href;
1207
+ });
1397
1208
  let cssText = null;
1398
1209
  if (stylesheet) {
1399
- cssText = stringifyStylesheet$1(stylesheet);
1400
- }
1401
- if (!cssText) {
1402
- cssText = asyncStylesheetManager$1.getClonedCssTextIfAvailable(
1403
- n2.href
1404
- );
1210
+ cssText = stringifyStylesheet(stylesheet);
1405
1211
  }
1406
1212
  if (cssText) {
1407
1213
  delete attributes.rel;
1408
1214
  delete attributes.href;
1409
1215
  attributes._cssText = cssText;
1410
- } else {
1411
- const requestCssId = `css-request-${Math.random().toString(36).slice(2)}`;
1412
- asyncStylesheetManager$1.requestClone({
1413
- forElement: n2,
1414
- requestCssId
1415
- });
1416
- attributes._requestCssId = requestCssId;
1417
1216
  }
1418
1217
  }
1419
1218
  if (tagName === "style" && n2.sheet) {
1420
- let cssText = stringifyStylesheet$1(
1219
+ let cssText = stringifyStylesheet(
1421
1220
  n2.sheet
1422
1221
  );
1423
1222
  if (cssText) {
@@ -1490,17 +1289,18 @@ function serializeElementNode(n2, options) {
1490
1289
  canvasService = doc.createElement("canvas");
1491
1290
  canvasCtx = canvasService.getContext("2d");
1492
1291
  }
1493
- let image = n2.cloneNode(true);
1292
+ let image = n2;
1494
1293
  const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
1294
+ const imageHeight = image.naturalHeight;
1295
+ const imageWidth = image.naturalWidth;
1495
1296
  const inlineImageCleanup = () => {
1496
1297
  image = null;
1497
1298
  };
1498
1299
  const recordInlineImage = () => {
1499
- image.removeEventListener("load", recordInlineImage);
1500
1300
  image.removeEventListener("error", onImageLoadError);
1501
1301
  try {
1502
- canvasService.width = image.naturalWidth;
1503
- canvasService.height = image.naturalHeight;
1302
+ canvasService.width = imageWidth;
1303
+ canvasService.height = imageHeight;
1504
1304
  canvasCtx.drawImage(image, 0, 0);
1505
1305
  attributes.rr_dataURL = canvasService.toDataURL(
1506
1306
  dataURLOptions.type,
@@ -1508,12 +1308,16 @@ function serializeElementNode(n2, options) {
1508
1308
  );
1509
1309
  } catch (err) {
1510
1310
  if (image.crossOrigin !== "anonymous") {
1311
+ image = new Image();
1312
+ image.src = imageSrc;
1511
1313
  image.crossOrigin = "anonymous";
1512
- if (image.complete && image.naturalWidth !== 0)
1314
+ image.height = imageHeight;
1315
+ image.width = imageWidth;
1316
+ if (image.complete && image.naturalWidth !== 0) {
1513
1317
  recordInlineImage();
1514
- else {
1515
- image.addEventListener("load", recordInlineImage);
1516
- image.addEventListener("error", onImageLoadError);
1318
+ } else {
1319
+ image.addEventListener("load", recordInlineImage, { once: true });
1320
+ image.addEventListener("error", onImageLoadError, { once: true });
1517
1321
  }
1518
1322
  return;
1519
1323
  } else {
@@ -1526,13 +1330,12 @@ function serializeElementNode(n2, options) {
1526
1330
  };
1527
1331
  const onImageLoadError = () => {
1528
1332
  image.removeEventListener("load", recordInlineImage);
1529
- image.removeEventListener("error", onImageLoadError);
1530
1333
  inlineImageCleanup();
1531
1334
  };
1532
1335
  if (image.complete && image.naturalWidth !== 0) recordInlineImage();
1533
1336
  else {
1534
- image.addEventListener("load", recordInlineImage);
1535
- image.addEventListener("error", onImageLoadError);
1337
+ image.addEventListener("load", recordInlineImage, { once: true });
1338
+ image.addEventListener("error", onImageLoadError, { once: true });
1536
1339
  }
1537
1340
  }
1538
1341
  if (tagName === "audio" || tagName === "video") {
@@ -2545,7 +2348,7 @@ let Node$4$1 = class Node2 {
2545
2348
  let index2 = this.parent.index(this);
2546
2349
  return this.parent.nodes[index2 + 1];
2547
2350
  }
2548
- positionBy(opts = {}) {
2351
+ positionBy(opts) {
2549
2352
  let pos = this.source.start;
2550
2353
  if (opts.index) {
2551
2354
  pos = this.positionInside(opts.index);
@@ -2574,38 +2377,27 @@ let Node$4$1 = class Node2 {
2574
2377
  column += 1;
2575
2378
  }
2576
2379
  }
2577
- return { column, line, offset: end };
2380
+ return { column, line };
2578
2381
  }
2579
2382
  prev() {
2580
2383
  if (!this.parent) return void 0;
2581
2384
  let index2 = this.parent.index(this);
2582
2385
  return this.parent.nodes[index2 - 1];
2583
2386
  }
2584
- rangeBy(opts = {}) {
2585
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2387
+ rangeBy(opts) {
2586
2388
  let start = {
2587
2389
  column: this.source.start.column,
2588
- line: this.source.start.line,
2589
- offset: sourceOffset$1(inputString, this.source.start)
2390
+ line: this.source.start.line
2590
2391
  };
2591
2392
  let end = this.source.end ? {
2592
2393
  column: this.source.end.column + 1,
2593
- line: this.source.end.line,
2594
- offset: typeof this.source.end.offset === "number" ? (
2595
- // `source.end.offset` is exclusive, so we don't need to add 1
2596
- this.source.end.offset
2597
- ) : (
2598
- // Since line/column in this.source.end is inclusive,
2599
- // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
2600
- // So, we add 1 to convert it to exclusive.
2601
- sourceOffset$1(inputString, this.source.end) + 1
2602
- )
2394
+ line: this.source.end.line
2603
2395
  } : {
2604
2396
  column: start.column + 1,
2605
- line: start.line,
2606
- offset: start.offset + 1
2397
+ line: start.line
2607
2398
  };
2608
2399
  if (opts.word) {
2400
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2609
2401
  let stringRepresentation = inputString.slice(
2610
2402
  sourceOffset$1(inputString, this.source.start),
2611
2403
  sourceOffset$1(inputString, this.source.end)
@@ -2613,14 +2405,15 @@ let Node$4$1 = class Node2 {
2613
2405
  let index2 = stringRepresentation.indexOf(opts.word);
2614
2406
  if (index2 !== -1) {
2615
2407
  start = this.positionInside(index2);
2616
- end = this.positionInside(index2 + opts.word.length);
2408
+ end = this.positionInside(
2409
+ index2 + opts.word.length
2410
+ );
2617
2411
  }
2618
2412
  } else {
2619
2413
  if (opts.start) {
2620
2414
  start = {
2621
2415
  column: opts.start.column,
2622
- line: opts.start.line,
2623
- offset: sourceOffset$1(inputString, opts.start)
2416
+ line: opts.start.line
2624
2417
  };
2625
2418
  } else if (opts.index) {
2626
2419
  start = this.positionInside(opts.index);
@@ -2628,8 +2421,7 @@ let Node$4$1 = class Node2 {
2628
2421
  if (opts.end) {
2629
2422
  end = {
2630
2423
  column: opts.end.column,
2631
- line: opts.end.line,
2632
- offset: sourceOffset$1(inputString, opts.end)
2424
+ line: opts.end.line
2633
2425
  };
2634
2426
  } else if (typeof opts.endIndex === "number") {
2635
2427
  end = this.positionInside(opts.endIndex);
@@ -2638,11 +2430,7 @@ let Node$4$1 = class Node2 {
2638
2430
  }
2639
2431
  }
2640
2432
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
2641
- end = {
2642
- column: start.column + 1,
2643
- line: start.line,
2644
- offset: start.offset + 1
2645
- };
2433
+ end = { column: start.column + 1, line: start.line };
2646
2434
  }
2647
2435
  return { end, start };
2648
2436
  }
@@ -2706,7 +2494,6 @@ let Node$4$1 = class Node2 {
2706
2494
  } else if (typeof value === "object" && value.toJSON) {
2707
2495
  fixed[name] = value.toJSON(null, inputs);
2708
2496
  } else if (name === "source") {
2709
- if (value == null) continue;
2710
2497
  let inputId = inputs.get(value.input);
2711
2498
  if (inputId == null) {
2712
2499
  inputId = inputsNextIndex;
@@ -2741,7 +2528,7 @@ let Node$4$1 = class Node2 {
2741
2528
  });
2742
2529
  return result2;
2743
2530
  }
2744
- warn(result2, text, opts = {}) {
2531
+ warn(result2, text, opts) {
2745
2532
  let data = { node: this };
2746
2533
  for (let i2 in opts) data[i2] = opts[i2];
2747
2534
  return result2.warn(text, data);
@@ -3318,21 +3105,9 @@ let { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1$1 } = requi
3318
3105
  let CssSyntaxError$1$1 = cssSyntaxError$1;
3319
3106
  let PreviousMap$1$1 = previousMap$1;
3320
3107
  let terminalHighlight$2 = require$$2$1;
3321
- let lineToIndexCache$1 = Symbol("lineToIndexCache");
3108
+ let fromOffsetCache$1 = Symbol("fromOffsetCache");
3322
3109
  let sourceMapAvailable$1$1 = Boolean(SourceMapConsumer$1$1 && SourceMapGenerator$1$1);
3323
3110
  let pathAvailable$1$1 = Boolean(resolve$1$1 && isAbsolute$1);
3324
- function getLineToIndex$1(input2) {
3325
- if (input2[lineToIndexCache$1]) return input2[lineToIndexCache$1];
3326
- let lines = input2.css.split("\n");
3327
- let lineToIndex = new Array(lines.length);
3328
- let prevIndex = 0;
3329
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
3330
- lineToIndex[i2] = prevIndex;
3331
- prevIndex += lines[i2].length + 1;
3332
- }
3333
- input2[lineToIndexCache$1] = lineToIndex;
3334
- return lineToIndex;
3335
- }
3336
3111
  let Input$4$1 = class Input {
3337
3112
  get from() {
3338
3113
  return this.file || this.id;
@@ -3371,37 +3146,30 @@ let Input$4$1 = class Input {
3371
3146
  if (this.map) this.map.file = this.from;
3372
3147
  }
3373
3148
  error(message, line, column, opts = {}) {
3374
- let endColumn, endLine, endOffset, offset, result2;
3149
+ let endColumn, endLine, result2;
3375
3150
  if (line && typeof line === "object") {
3376
3151
  let start = line;
3377
3152
  let end = column;
3378
3153
  if (typeof start.offset === "number") {
3379
- offset = start.offset;
3380
- let pos = this.fromOffset(offset);
3154
+ let pos = this.fromOffset(start.offset);
3381
3155
  line = pos.line;
3382
3156
  column = pos.col;
3383
3157
  } else {
3384
3158
  line = start.line;
3385
3159
  column = start.column;
3386
- offset = this.fromLineAndColumn(line, column);
3387
3160
  }
3388
3161
  if (typeof end.offset === "number") {
3389
- endOffset = end.offset;
3390
- let pos = this.fromOffset(endOffset);
3162
+ let pos = this.fromOffset(end.offset);
3391
3163
  endLine = pos.line;
3392
3164
  endColumn = pos.col;
3393
3165
  } else {
3394
3166
  endLine = end.line;
3395
3167
  endColumn = end.column;
3396
- endOffset = this.fromLineAndColumn(end.line, end.column);
3397
3168
  }
3398
3169
  } else if (!column) {
3399
- offset = line;
3400
- let pos = this.fromOffset(offset);
3170
+ let pos = this.fromOffset(line);
3401
3171
  line = pos.line;
3402
3172
  column = pos.col;
3403
- } else {
3404
- offset = this.fromLineAndColumn(line, column);
3405
3173
  }
3406
3174
  let origin = this.origin(line, column, endLine, endColumn);
3407
3175
  if (origin) {
@@ -3423,7 +3191,7 @@ let Input$4$1 = class Input {
3423
3191
  opts.plugin
3424
3192
  );
3425
3193
  }
3426
- result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
3194
+ result2.input = { column, endColumn, endLine, line, source: this.css };
3427
3195
  if (this.file) {
3428
3196
  if (pathToFileURL$1$1) {
3429
3197
  result2.input.url = pathToFileURL$1$1(this.file).toString();
@@ -3432,14 +3200,21 @@ let Input$4$1 = class Input {
3432
3200
  }
3433
3201
  return result2;
3434
3202
  }
3435
- fromLineAndColumn(line, column) {
3436
- let lineToIndex = getLineToIndex$1(this);
3437
- let index2 = lineToIndex[line - 1];
3438
- return index2 + column - 1;
3439
- }
3440
3203
  fromOffset(offset) {
3441
- let lineToIndex = getLineToIndex$1(this);
3442
- let lastLine = lineToIndex[lineToIndex.length - 1];
3204
+ let lastLine, lineToIndex;
3205
+ if (!this[fromOffsetCache$1]) {
3206
+ let lines = this.css.split("\n");
3207
+ lineToIndex = new Array(lines.length);
3208
+ let prevIndex = 0;
3209
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
3210
+ lineToIndex[i2] = prevIndex;
3211
+ prevIndex += lines[i2].length + 1;
3212
+ }
3213
+ this[fromOffsetCache$1] = lineToIndex;
3214
+ } else {
3215
+ lineToIndex = this[fromOffsetCache$1];
3216
+ }
3217
+ lastLine = lineToIndex[lineToIndex.length - 1];
3443
3218
  let min = 0;
3444
3219
  if (offset >= lastLine) {
3445
3220
  min = lineToIndex.length - 1;
@@ -4801,7 +4576,7 @@ let Result$3$1 = class Result {
4801
4576
  this.messages = [];
4802
4577
  this.root = root2;
4803
4578
  this.opts = opts;
4804
- this.css = "";
4579
+ this.css = void 0;
4805
4580
  this.map = void 0;
4806
4581
  }
4807
4582
  toString() {
@@ -5413,7 +5188,7 @@ let NoWorkResult2$1 = noWorkResult$1;
5413
5188
  let Root$1$1 = root$1;
5414
5189
  let Processor$1$1 = class Processor {
5415
5190
  constructor(plugins = []) {
5416
- this.version = "8.5.4";
5191
+ this.version = "8.5.3";
5417
5192
  this.plugins = this.normalize(plugins);
5418
5193
  }
5419
5194
  normalize(plugins) {
@@ -5567,322 +5342,6 @@ postcss$1$1.Node;
5567
5342
  var __defProp2 = Object.defineProperty;
5568
5343
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5569
5344
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
5570
- var __defProp22 = Object.defineProperty;
5571
- var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5572
- var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
5573
- function fixBrowserCompatibilityIssuesInCSS(cssText) {
5574
- if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
5575
- cssText = cssText.replace(
5576
- /\sbackground-clip:\s*text;/g,
5577
- " -webkit-background-clip: text; background-clip: text;"
5578
- );
5579
- }
5580
- return cssText;
5581
- }
5582
- function escapeImportStatement(rule2) {
5583
- const { cssText } = rule2;
5584
- if (cssText.split('"').length < 3) return cssText;
5585
- const statement = ["@import", `url(${JSON.stringify(rule2.href)})`];
5586
- if (rule2.layerName === "") {
5587
- statement.push(`layer`);
5588
- } else if (rule2.layerName) {
5589
- statement.push(`layer(${rule2.layerName})`);
5590
- }
5591
- if (rule2.supportsText) {
5592
- statement.push(`supports(${rule2.supportsText})`);
5593
- }
5594
- if (rule2.media.length) {
5595
- statement.push(rule2.media.mediaText);
5596
- }
5597
- return statement.join(" ") + ";";
5598
- }
5599
- function stringifyStylesheet(s2) {
5600
- try {
5601
- const rules2 = s2.rules || s2.cssRules;
5602
- if (!rules2) {
5603
- return null;
5604
- }
5605
- let sheetHref = s2.href;
5606
- if (!sheetHref && s2.ownerNode && s2.ownerNode.ownerDocument) {
5607
- sheetHref = s2.ownerNode.ownerDocument.location.href;
5608
- }
5609
- const stringifiedRules = Array.from(
5610
- rules2,
5611
- (rule2) => stringifyRule(rule2, sheetHref)
5612
- ).join("");
5613
- return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
5614
- } catch (error) {
5615
- console.log("stringifyStylesheet error:", error);
5616
- return null;
5617
- }
5618
- }
5619
- function stringifyRule(rule2, sheetHref) {
5620
- if (isCSSImportRule(rule2)) {
5621
- let importStringified;
5622
- try {
5623
- importStringified = // for same-origin stylesheets,
5624
- // we can access the imported stylesheet rules directly
5625
- stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
5626
- escapeImportStatement(rule2);
5627
- } catch (error) {
5628
- importStringified = rule2.cssText;
5629
- }
5630
- if (rule2.styleSheet.href) {
5631
- return absolutifyURLs(importStringified, rule2.styleSheet.href);
5632
- }
5633
- return importStringified;
5634
- } else {
5635
- let ruleStringified = rule2.cssText;
5636
- if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
5637
- ruleStringified = fixSafariColons(ruleStringified);
5638
- }
5639
- if (sheetHref) {
5640
- return absolutifyURLs(ruleStringified, sheetHref);
5641
- }
5642
- return ruleStringified;
5643
- }
5644
- }
5645
- function fixSafariColons(cssStringified) {
5646
- const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
5647
- return cssStringified.replace(regex, "$1\\$2");
5648
- }
5649
- function isCSSImportRule(rule2) {
5650
- return "styleSheet" in rule2;
5651
- }
5652
- function isCSSStyleRule(rule2) {
5653
- return "selectorText" in rule2;
5654
- }
5655
- function extractOrigin(url) {
5656
- let origin = "";
5657
- if (url.indexOf("//") > -1) {
5658
- origin = url.split("/").slice(0, 3).join("/");
5659
- } else {
5660
- origin = url.split("/")[0];
5661
- }
5662
- origin = origin.split("?")[0];
5663
- return origin;
5664
- }
5665
- const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
5666
- const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
5667
- const URL_WWW_MATCH = /^www\..*/i;
5668
- const DATA_URI = /^(data:)([^,]*),(.*)/i;
5669
- function absolutifyURLs(cssText, href) {
5670
- return (cssText || "").replace(
5671
- URL_IN_CSS_REF,
5672
- (origin, quote1, path1, quote2, path2, path3) => {
5673
- const filePath = path1 || path2 || path3;
5674
- const maybeQuote = quote1 || quote2 || "";
5675
- if (!filePath) {
5676
- return origin;
5677
- }
5678
- if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
5679
- return `url(${maybeQuote}${filePath}${maybeQuote})`;
5680
- }
5681
- if (DATA_URI.test(filePath)) {
5682
- return `url(${maybeQuote}${filePath}${maybeQuote})`;
5683
- }
5684
- if (filePath[0] === "/") {
5685
- return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;
5686
- }
5687
- const stack = href.split("/");
5688
- const parts = filePath.split("/");
5689
- stack.pop();
5690
- for (const part of parts) {
5691
- if (part === ".") {
5692
- continue;
5693
- } else if (part === "..") {
5694
- stack.pop();
5695
- } else {
5696
- stack.push(part);
5697
- }
5698
- }
5699
- return `url(${maybeQuote}${stack.join("/")}${maybeQuote})`;
5700
- }
5701
- );
5702
- }
5703
- const CLEANUP_DEBOUNCE_TIME = 1e3 * 30;
5704
- const DATA_ATTRIBUTE_CLONED_NAME = "data-rrweb-link-cloned";
5705
- const DISALLOWED_EXTENSIONS = [
5706
- // Fonts
5707
- "woff",
5708
- "woff2",
5709
- "ttf",
5710
- "otf",
5711
- // Embedded OpenType font
5712
- "eot",
5713
- // Images
5714
- "png",
5715
- "jpg",
5716
- "jpeg",
5717
- "gif",
5718
- "svg",
5719
- "webp",
5720
- "ico",
5721
- // Scripts
5722
- "js",
5723
- "mjs",
5724
- "ts",
5725
- "jsx",
5726
- "tsx",
5727
- // Data files
5728
- "json",
5729
- "map",
5730
- // Media
5731
- "mp4",
5732
- "webm",
5733
- "ogg",
5734
- "mp3",
5735
- "wav",
5736
- // Archives
5737
- "zip",
5738
- "rar",
5739
- "7z",
5740
- "tar",
5741
- "gz",
5742
- // Documents
5743
- "pdf",
5744
- "doc",
5745
- "docx",
5746
- "xls",
5747
- "xlsx"
5748
- ];
5749
- const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
5750
- constructor() {
5751
- __publicField22(this, "currentHref", null);
5752
- __publicField22(this, "clones", {});
5753
- __publicField22(this, "cleanTimeout", null);
5754
- if (_AsyncStylesheetManager22.instance) return _AsyncStylesheetManager22.instance;
5755
- _AsyncStylesheetManager22.instance = this;
5756
- }
5757
- removeCloneNode(href) {
5758
- var _a2;
5759
- if (!(href in this.clones) || this.clones[href] === void 0) return;
5760
- const clone = document.querySelector(
5761
- `link[${DATA_ATTRIBUTE_CLONED_NAME}="${this.clones[href].cloneNodeAttrId}"]`
5762
- );
5763
- if (!clone) return;
5764
- (_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
5765
- }
5766
- onLoad(href) {
5767
- if (!(href in this.clones) || this.clones[href] === void 0) return;
5768
- const styleSheets2 = Array.from(document.styleSheets);
5769
- let clonedStyleSheet = null;
5770
- for (let i2 = styleSheets2.length - 1; i2 >= 0; i2--) {
5771
- if (styleSheets2[i2].href === href) {
5772
- clonedStyleSheet = styleSheets2[i2];
5773
- break;
5774
- }
5775
- }
5776
- if (!clonedStyleSheet) return this.removeCloneNode(href);
5777
- const newCssText = stringifyStylesheet(clonedStyleSheet);
5778
- this.removeCloneNode(href);
5779
- if (!newCssText) return;
5780
- this.clones[href].cssText = newCssText;
5781
- this.clones[href].loaded = true;
5782
- const original = document.querySelector(
5783
- `link[${DATA_ATTRIBUTE_CLONED_NAME}="source-${this.clones[href].cloneNodeAttrId}"]`
5784
- );
5785
- if (original) {
5786
- original.setAttribute("data-rrweb-mutation", Date.now().toString());
5787
- original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME);
5788
- } else {
5789
- this.clones[href].original.setAttribute(
5790
- "data-rrweb-mutation",
5791
- Date.now().toString()
5792
- );
5793
- this.clones[href].original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME);
5794
- }
5795
- window.dispatchEvent(
5796
- new CustomEvent("__rrweb_custom_event__", {
5797
- detail: {
5798
- type: 5,
5799
- timestamp: Date.now(),
5800
- data: {
5801
- tag: "async-css-resolution",
5802
- requestCssId: this.clones[href].requestCssId,
5803
- cssText: this.clones[href].cssText
5804
- }
5805
- }
5806
- })
5807
- );
5808
- }
5809
- onLoadError(href) {
5810
- if (!(href in this.clones) || this.clones[href] === void 0) return;
5811
- this.removeCloneNode(href);
5812
- }
5813
- removeAllCloneElements() {
5814
- for (const href of Object.keys(this.clones)) {
5815
- this.removeCloneNode(href);
5816
- }
5817
- }
5818
- onCleanTimeout() {
5819
- asyncStylesheetManager.cleanTimeout = null;
5820
- asyncStylesheetManager.removeAllCloneElements();
5821
- }
5822
- blowCache() {
5823
- this.removeAllCloneElements();
5824
- this.clones = {};
5825
- }
5826
- requestClone({
5827
- forElement,
5828
- requestCssId
5829
- }) {
5830
- if (this.currentHref != null && document.location.href !== this.currentHref)
5831
- this.blowCache();
5832
- this.currentHref = document.location.href;
5833
- const href = forElement.href;
5834
- if (!href) return;
5835
- if (href in this.clones && this.clones[href] !== void 0) return;
5836
- if (forElement.getAttribute("crossorigin") === "anonymous") return;
5837
- if (forElement.rel !== "stylesheet") {
5838
- const last = href.split("/").pop();
5839
- if (last && last.includes(".")) {
5840
- const [filename] = last.split("?");
5841
- const ext = filename.split(".").pop();
5842
- if (ext) {
5843
- if (DISALLOWED_EXTENSIONS.includes(ext.trim().toLowerCase())) return;
5844
- }
5845
- }
5846
- }
5847
- const clone = forElement.cloneNode();
5848
- const cloneNodeAttrId = Math.random().toString(36).slice(2);
5849
- clone.setAttribute("crossorigin", "anonymous");
5850
- clone.setAttribute(DATA_ATTRIBUTE_CLONED_NAME, cloneNodeAttrId);
5851
- forElement.setAttribute(
5852
- DATA_ATTRIBUTE_CLONED_NAME,
5853
- `source-${cloneNodeAttrId}`
5854
- );
5855
- document.head.appendChild(clone);
5856
- this.clones[href] = {
5857
- original: forElement,
5858
- clone,
5859
- loaded: false,
5860
- cssText: null,
5861
- cloneNodeAttrId,
5862
- requestCssId
5863
- };
5864
- clone.onload = () => {
5865
- this.onLoad(href);
5866
- };
5867
- clone.onerror = () => {
5868
- this.onLoadError(href);
5869
- };
5870
- if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
5871
- this.cleanTimeout = setTimeout(
5872
- asyncStylesheetManager.onCleanTimeout,
5873
- CLEANUP_DEBOUNCE_TIME
5874
- );
5875
- }
5876
- getClonedCssTextIfAvailable(href) {
5877
- if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
5878
- return this.clones[href].cssText;
5879
- }
5880
- return null;
5881
- }
5882
- };
5883
- __publicField22(_AsyncStylesheetManager2, "instance");
5884
- let AsyncStylesheetManager = _AsyncStylesheetManager2;
5885
- const asyncStylesheetManager = new AsyncStylesheetManager();
5886
5345
  function getDefaultExportFromCjs(x2) {
5887
5346
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5888
5347
  }
@@ -6490,7 +5949,7 @@ let Node$4 = class Node3 {
6490
5949
  let index2 = this.parent.index(this);
6491
5950
  return this.parent.nodes[index2 + 1];
6492
5951
  }
6493
- positionBy(opts = {}) {
5952
+ positionBy(opts) {
6494
5953
  let pos = this.source.start;
6495
5954
  if (opts.index) {
6496
5955
  pos = this.positionInside(opts.index);
@@ -6519,38 +5978,27 @@ let Node$4 = class Node3 {
6519
5978
  column += 1;
6520
5979
  }
6521
5980
  }
6522
- return { column, line, offset: end };
5981
+ return { column, line };
6523
5982
  }
6524
5983
  prev() {
6525
5984
  if (!this.parent) return void 0;
6526
5985
  let index2 = this.parent.index(this);
6527
5986
  return this.parent.nodes[index2 - 1];
6528
5987
  }
6529
- rangeBy(opts = {}) {
6530
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
5988
+ rangeBy(opts) {
6531
5989
  let start = {
6532
5990
  column: this.source.start.column,
6533
- line: this.source.start.line,
6534
- offset: sourceOffset(inputString, this.source.start)
5991
+ line: this.source.start.line
6535
5992
  };
6536
5993
  let end = this.source.end ? {
6537
5994
  column: this.source.end.column + 1,
6538
- line: this.source.end.line,
6539
- offset: typeof this.source.end.offset === "number" ? (
6540
- // `source.end.offset` is exclusive, so we don't need to add 1
6541
- this.source.end.offset
6542
- ) : (
6543
- // Since line/column in this.source.end is inclusive,
6544
- // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
6545
- // So, we add 1 to convert it to exclusive.
6546
- sourceOffset(inputString, this.source.end) + 1
6547
- )
5995
+ line: this.source.end.line
6548
5996
  } : {
6549
5997
  column: start.column + 1,
6550
- line: start.line,
6551
- offset: start.offset + 1
5998
+ line: start.line
6552
5999
  };
6553
6000
  if (opts.word) {
6001
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6554
6002
  let stringRepresentation = inputString.slice(
6555
6003
  sourceOffset(inputString, this.source.start),
6556
6004
  sourceOffset(inputString, this.source.end)
@@ -6558,14 +6006,15 @@ let Node$4 = class Node3 {
6558
6006
  let index2 = stringRepresentation.indexOf(opts.word);
6559
6007
  if (index2 !== -1) {
6560
6008
  start = this.positionInside(index2);
6561
- end = this.positionInside(index2 + opts.word.length);
6009
+ end = this.positionInside(
6010
+ index2 + opts.word.length
6011
+ );
6562
6012
  }
6563
6013
  } else {
6564
6014
  if (opts.start) {
6565
6015
  start = {
6566
6016
  column: opts.start.column,
6567
- line: opts.start.line,
6568
- offset: sourceOffset(inputString, opts.start)
6017
+ line: opts.start.line
6569
6018
  };
6570
6019
  } else if (opts.index) {
6571
6020
  start = this.positionInside(opts.index);
@@ -6573,8 +6022,7 @@ let Node$4 = class Node3 {
6573
6022
  if (opts.end) {
6574
6023
  end = {
6575
6024
  column: opts.end.column,
6576
- line: opts.end.line,
6577
- offset: sourceOffset(inputString, opts.end)
6025
+ line: opts.end.line
6578
6026
  };
6579
6027
  } else if (typeof opts.endIndex === "number") {
6580
6028
  end = this.positionInside(opts.endIndex);
@@ -6583,11 +6031,7 @@ let Node$4 = class Node3 {
6583
6031
  }
6584
6032
  }
6585
6033
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
6586
- end = {
6587
- column: start.column + 1,
6588
- line: start.line,
6589
- offset: start.offset + 1
6590
- };
6034
+ end = { column: start.column + 1, line: start.line };
6591
6035
  }
6592
6036
  return { end, start };
6593
6037
  }
@@ -6651,7 +6095,6 @@ let Node$4 = class Node3 {
6651
6095
  } else if (typeof value === "object" && value.toJSON) {
6652
6096
  fixed[name] = value.toJSON(null, inputs);
6653
6097
  } else if (name === "source") {
6654
- if (value == null) continue;
6655
6098
  let inputId = inputs.get(value.input);
6656
6099
  if (inputId == null) {
6657
6100
  inputId = inputsNextIndex;
@@ -6686,7 +6129,7 @@ let Node$4 = class Node3 {
6686
6129
  });
6687
6130
  return result2;
6688
6131
  }
6689
- warn(result2, text, opts = {}) {
6132
+ warn(result2, text, opts) {
6690
6133
  let data = { node: this };
6691
6134
  for (let i2 in opts) data[i2] = opts[i2];
6692
6135
  return result2.warn(text, data);
@@ -7263,21 +6706,9 @@ let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
7263
6706
  let CssSyntaxError$1 = cssSyntaxError;
7264
6707
  let PreviousMap$1 = previousMap;
7265
6708
  let terminalHighlight = require$$2;
7266
- let lineToIndexCache = Symbol("lineToIndexCache");
6709
+ let fromOffsetCache = Symbol("fromOffsetCache");
7267
6710
  let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
7268
6711
  let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
7269
- function getLineToIndex(input2) {
7270
- if (input2[lineToIndexCache]) return input2[lineToIndexCache];
7271
- let lines = input2.css.split("\n");
7272
- let lineToIndex = new Array(lines.length);
7273
- let prevIndex = 0;
7274
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
7275
- lineToIndex[i2] = prevIndex;
7276
- prevIndex += lines[i2].length + 1;
7277
- }
7278
- input2[lineToIndexCache] = lineToIndex;
7279
- return lineToIndex;
7280
- }
7281
6712
  let Input$4 = class Input2 {
7282
6713
  get from() {
7283
6714
  return this.file || this.id;
@@ -7316,37 +6747,30 @@ let Input$4 = class Input2 {
7316
6747
  if (this.map) this.map.file = this.from;
7317
6748
  }
7318
6749
  error(message, line, column, opts = {}) {
7319
- let endColumn, endLine, endOffset, offset, result2;
6750
+ let endColumn, endLine, result2;
7320
6751
  if (line && typeof line === "object") {
7321
6752
  let start = line;
7322
6753
  let end = column;
7323
6754
  if (typeof start.offset === "number") {
7324
- offset = start.offset;
7325
- let pos = this.fromOffset(offset);
6755
+ let pos = this.fromOffset(start.offset);
7326
6756
  line = pos.line;
7327
6757
  column = pos.col;
7328
6758
  } else {
7329
6759
  line = start.line;
7330
6760
  column = start.column;
7331
- offset = this.fromLineAndColumn(line, column);
7332
6761
  }
7333
6762
  if (typeof end.offset === "number") {
7334
- endOffset = end.offset;
7335
- let pos = this.fromOffset(endOffset);
6763
+ let pos = this.fromOffset(end.offset);
7336
6764
  endLine = pos.line;
7337
6765
  endColumn = pos.col;
7338
6766
  } else {
7339
6767
  endLine = end.line;
7340
6768
  endColumn = end.column;
7341
- endOffset = this.fromLineAndColumn(end.line, end.column);
7342
6769
  }
7343
6770
  } else if (!column) {
7344
- offset = line;
7345
- let pos = this.fromOffset(offset);
6771
+ let pos = this.fromOffset(line);
7346
6772
  line = pos.line;
7347
6773
  column = pos.col;
7348
- } else {
7349
- offset = this.fromLineAndColumn(line, column);
7350
6774
  }
7351
6775
  let origin = this.origin(line, column, endLine, endColumn);
7352
6776
  if (origin) {
@@ -7368,7 +6792,7 @@ let Input$4 = class Input2 {
7368
6792
  opts.plugin
7369
6793
  );
7370
6794
  }
7371
- result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
6795
+ result2.input = { column, endColumn, endLine, line, source: this.css };
7372
6796
  if (this.file) {
7373
6797
  if (pathToFileURL$1) {
7374
6798
  result2.input.url = pathToFileURL$1(this.file).toString();
@@ -7377,14 +6801,21 @@ let Input$4 = class Input2 {
7377
6801
  }
7378
6802
  return result2;
7379
6803
  }
7380
- fromLineAndColumn(line, column) {
7381
- let lineToIndex = getLineToIndex(this);
7382
- let index2 = lineToIndex[line - 1];
7383
- return index2 + column - 1;
7384
- }
7385
6804
  fromOffset(offset) {
7386
- let lineToIndex = getLineToIndex(this);
7387
- let lastLine = lineToIndex[lineToIndex.length - 1];
6805
+ let lastLine, lineToIndex;
6806
+ if (!this[fromOffsetCache]) {
6807
+ let lines = this.css.split("\n");
6808
+ lineToIndex = new Array(lines.length);
6809
+ let prevIndex = 0;
6810
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6811
+ lineToIndex[i2] = prevIndex;
6812
+ prevIndex += lines[i2].length + 1;
6813
+ }
6814
+ this[fromOffsetCache] = lineToIndex;
6815
+ } else {
6816
+ lineToIndex = this[fromOffsetCache];
6817
+ }
6818
+ lastLine = lineToIndex[lineToIndex.length - 1];
7388
6819
  let min = 0;
7389
6820
  if (offset >= lastLine) {
7390
6821
  min = lineToIndex.length - 1;
@@ -8746,7 +8177,7 @@ let Result$3 = class Result2 {
8746
8177
  this.messages = [];
8747
8178
  this.root = root2;
8748
8179
  this.opts = opts;
8749
- this.css = "";
8180
+ this.css = void 0;
8750
8181
  this.map = void 0;
8751
8182
  }
8752
8183
  toString() {
@@ -9358,7 +8789,7 @@ let NoWorkResult22 = noWorkResult;
9358
8789
  let Root$1 = root;
9359
8790
  let Processor$1 = class Processor2 {
9360
8791
  constructor(plugins = []) {
9361
- this.version = "8.5.4";
8792
+ this.version = "8.5.3";
9362
8793
  this.plugins = this.normalize(plugins);
9363
8794
  }
9364
8795
  normalize(plugins) {
@@ -12637,7 +12068,7 @@ class StylesheetManager {
12637
12068
  styles.push({
12638
12069
  styleId,
12639
12070
  rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({
12640
- rule: stringifyRule$1(r2, sheet.href),
12071
+ rule: stringifyRule(r2, sheet.href),
12641
12072
  index: index2
12642
12073
  }))
12643
12074
  });
@@ -13097,26 +12528,12 @@ function record(options = {}) {
13097
12528
  console.warn(error);
13098
12529
  }
13099
12530
  });
13100
- let initedAt = null;
13101
12531
  const init = () => {
13102
- initedAt = Date.now();
13103
12532
  takeFullSnapshot$1();
13104
12533
  handlers.push(observe(document));
13105
12534
  recording = true;
13106
12535
  };
13107
- const customOnLoad = () => {
13108
- window.removeEventListener("load", customOnLoad);
13109
- if (!recording || initedAt == null) return;
13110
- if (Date.now() - initedAt <= 10) {
13111
- return;
13112
- }
13113
- takeFullSnapshot$1();
13114
- };
13115
- window.addEventListener("load", customOnLoad);
13116
12536
  if (document.readyState === "interactive" || document.readyState === "complete") {
13117
- if (document.readyState === "complete") {
13118
- window.removeEventListener("load", customOnLoad);
13119
- }
13120
12537
  init();
13121
12538
  } else {
13122
12539
  handlers.push(
@@ -13125,9 +12542,7 @@ function record(options = {}) {
13125
12542
  type: EventType.DomContentLoaded,
13126
12543
  data: {}
13127
12544
  });
13128
- if (recordAfter === "DOMContentLoaded") {
13129
- init();
13130
- }
12545
+ if (recordAfter === "DOMContentLoaded") init();
13131
12546
  })
13132
12547
  );
13133
12548
  handlers.push(
@@ -13138,9 +12553,7 @@ function record(options = {}) {
13138
12553
  type: EventType.Load,
13139
12554
  data: {}
13140
12555
  });
13141
- if (recordAfter === "load") {
13142
- init();
13143
- }
12556
+ if (recordAfter === "load") init();
13144
12557
  },
13145
12558
  window
13146
12559
  )