@appsurify-testmap/rrweb 2.0.0-alpha.41 → 2.1.0-alpha.2

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.
@@ -188,6 +188,32 @@ function querySelectorAll$1(n2, selectors) {
188
188
  function mutationObserverCtor$1() {
189
189
  return getUntaintedPrototype$1("MutationObserver").constructor;
190
190
  }
191
+ function patch$1(source, name, replacement) {
192
+ try {
193
+ if (!(name in source)) {
194
+ return () => {
195
+ };
196
+ }
197
+ const original = source[name];
198
+ const wrapped = replacement(original);
199
+ if (typeof wrapped === "function") {
200
+ wrapped.prototype = wrapped.prototype || {};
201
+ Object.defineProperties(wrapped, {
202
+ __rrweb_original__: {
203
+ enumerable: false,
204
+ value: original
205
+ }
206
+ });
207
+ }
208
+ source[name] = wrapped;
209
+ return () => {
210
+ source[name] = original;
211
+ };
212
+ } catch (e2) {
213
+ return () => {
214
+ };
215
+ }
216
+ }
191
217
  const index$1 = {
192
218
  childNodes: childNodes$1,
193
219
  parentNode: parentNode$1,
@@ -200,8 +226,12 @@ const index$1 = {
200
226
  shadowRoot: shadowRoot$1,
201
227
  querySelector: querySelector$1,
202
228
  querySelectorAll: querySelectorAll$1,
203
- mutationObserver: mutationObserverCtor$1
229
+ mutationObserver: mutationObserverCtor$1,
230
+ patch: patch$1
204
231
  };
232
+ function isElement(n2) {
233
+ return n2.nodeType === n2.ELEMENT_NODE;
234
+ }
205
235
  function isShadowRoot(n2) {
206
236
  const hostEl = (
207
237
  // anchor and textarea elements also have a `host` property
@@ -479,19 +509,27 @@ function absolutifyURLs(cssText, href) {
479
509
  }
480
510
  );
481
511
  }
482
- function normalizeCssString(cssText) {
483
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
512
+ function normalizeCssString(cssText, _testNoPxNorm = false) {
513
+ if (_testNoPxNorm) {
514
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
515
+ } else {
516
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
517
+ }
484
518
  }
485
- function splitCssText(cssText, style) {
519
+ function splitCssText(cssText, style, _testNoPxNorm = false) {
486
520
  const childNodes2 = Array.from(style.childNodes);
487
521
  const splits = [];
488
- let iterLimit = 0;
522
+ let iterCount = 0;
489
523
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
490
- let cssTextNorm = normalizeCssString(cssText);
524
+ let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
491
525
  const normFactor = cssTextNorm.length / cssText.length;
492
526
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
493
527
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
494
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
528
+ const textContentNorm = normalizeCssString(
529
+ childNodes2[i2].textContent,
530
+ _testNoPxNorm
531
+ );
532
+ const jLimit = 100;
495
533
  let j = 3;
496
534
  for (; j < textContentNorm.length; j++) {
497
535
  if (
@@ -504,23 +542,49 @@ function splitCssText(cssText, style) {
504
542
  break;
505
543
  }
506
544
  for (; j < textContentNorm.length; j++) {
507
- const bit = textContentNorm.substring(0, j);
508
- const bits = cssTextNorm.split(bit);
545
+ let startSubstring = textContentNorm.substring(0, j);
546
+ let cssNormSplits = cssTextNorm.split(startSubstring);
509
547
  let splitNorm = -1;
510
- if (bits.length === 2) {
511
- splitNorm = cssTextNorm.indexOf(bit);
512
- } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
513
- splitNorm = cssTextNorm.indexOf(bit, 1);
548
+ if (cssNormSplits.length === 2) {
549
+ splitNorm = cssNormSplits[0].length;
550
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
551
+ splitNorm = cssTextNorm.indexOf(startSubstring, 1);
552
+ } else if (cssNormSplits.length === 1) {
553
+ startSubstring = startSubstring.substring(
554
+ 0,
555
+ startSubstring.length - 1
556
+ );
557
+ cssNormSplits = cssTextNorm.split(startSubstring);
558
+ if (cssNormSplits.length <= 1) {
559
+ splits.push(cssText);
560
+ return splits;
561
+ }
562
+ j = jLimit + 1;
563
+ } else if (j === textContentNorm.length - 1) {
564
+ splitNorm = cssTextNorm.indexOf(startSubstring);
565
+ }
566
+ if (cssNormSplits.length >= 2 && j > jLimit) {
567
+ const prevTextContent = childNodes2[i2 - 1].textContent;
568
+ if (prevTextContent && typeof prevTextContent === "string") {
569
+ const prevMinLength = normalizeCssString(prevTextContent).length;
570
+ splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
571
+ }
572
+ if (splitNorm === -1) {
573
+ splitNorm = cssNormSplits[0].length;
574
+ }
514
575
  }
515
576
  if (splitNorm !== -1) {
516
577
  let k = Math.floor(splitNorm / normFactor);
517
578
  for (; k > 0 && k < cssText.length; ) {
518
- iterLimit += 1;
519
- if (iterLimit > 50 * childNodes2.length) {
579
+ iterCount += 1;
580
+ if (iterCount > 50 * childNodes2.length) {
520
581
  splits.push(cssText);
521
582
  return splits;
522
583
  }
523
- const normPart = normalizeCssString(cssText.substring(0, k));
584
+ const normPart = normalizeCssString(
585
+ cssText.substring(0, k),
586
+ _testNoPxNorm
587
+ );
524
588
  if (normPart.length === splitNorm) {
525
589
  splits.push(cssText.substring(0, k));
526
590
  cssText = cssText.substring(k);
@@ -616,9 +680,6 @@ function getXPath(node2) {
616
680
  }
617
681
  return "";
618
682
  }
619
- function isElement(n2) {
620
- return n2.nodeType === n2.ELEMENT_NODE;
621
- }
622
683
  function isTextVisible(n2) {
623
684
  var _a2;
624
685
  const parent = index$1.parentNode(n2);
@@ -640,10 +701,10 @@ function isElementVisible(n2) {
640
701
  const style = win ? win.getComputedStyle(n2) : null;
641
702
  const isStyleVisible = style != null && style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
642
703
  const rect = n2.getBoundingClientRect();
643
- const result2 = isStyleVisible && isRectVisible(rect, win);
704
+ const result2 = isStyleVisible && isRectVisible(rect);
644
705
  return result2;
645
706
  }
646
- function isRectVisible(rect, win) {
707
+ function isRectVisible(rect, win = window) {
647
708
  var _a3, _b2, _c2, _d2;
648
709
  var _a2, _b, _c, _d;
649
710
  const height = (_b2 = (_a3 = win == null ? void 0 : win.innerHeight) != null ? _a3 : (_b = (_a2 = win == null ? void 0 : win.document) == null ? void 0 : _a2.documentElement) == null ? void 0 : _b.clientHeight) != null ? _b2 : 0;
@@ -688,7 +749,7 @@ const interactiveTags = [
688
749
  "video",
689
750
  "audio"
690
751
  ];
691
- const inlineEventAttributes = [
752
+ const inlineEventAttributes$1 = [
692
753
  "onclick",
693
754
  "ondblclick",
694
755
  "onmousedown",
@@ -713,27 +774,20 @@ const inlineEventAttributes = [
713
774
  "ontouchcancel"
714
775
  ];
715
776
  const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
716
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
717
- const originalAddEventListener = EventTarget.prototype.addEventListener;
718
- EventTarget.prototype.addEventListener = function(type, listener, options) {
719
- originalAddEventListener.call(this, type, listener, options);
720
- if (this instanceof Element) {
721
- const eventType = type.toLowerCase();
722
- if (interactiveEvents$1.includes(eventType)) {
723
- interactiveElementsRegistry$1.add(this);
724
- }
777
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
778
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
779
+ originalAddEventListener$1.call(this, type, listener, options);
780
+ if (this instanceof Element) {
781
+ const eventType = type.toLowerCase();
782
+ if (interactiveEvents$1.includes(eventType)) {
783
+ interactiveElementsRegistry$1.add(this);
725
784
  }
726
- };
727
- }
728
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
729
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
730
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
731
- originalRemoveEventListener.call(this, type, listener, options);
732
- if (this instanceof Element) {
733
- type.toLowerCase();
734
- }
735
- };
736
- }
785
+ }
786
+ };
787
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
788
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
789
+ originalRemoveEventListener$1.call(this, type, listener, options);
790
+ };
737
791
  function hasEventListeners(n2) {
738
792
  return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
739
793
  }
@@ -753,33 +807,20 @@ function isElementInteractive(n2) {
753
807
  }
754
808
  return false;
755
809
  }
756
- function inspectInlineEventHandlers(doc) {
757
- if (!doc || typeof doc.querySelectorAll !== "function") return;
758
- const allElements = doc.querySelectorAll("*");
810
+ function inspectInlineEventHandlers$1() {
811
+ const allElements = document.querySelectorAll("*");
759
812
  allElements.forEach((el) => {
760
- inlineEventAttributes.forEach((attr) => {
813
+ inlineEventAttributes$1.forEach((attr) => {
761
814
  if (el.hasAttribute(attr)) {
762
815
  interactiveElementsRegistry$1.add(el);
763
816
  }
764
817
  });
765
818
  });
766
819
  }
767
- function scheduleInlineEventInspection(doc) {
768
- if (!doc || typeof doc.addEventListener !== "function" || typeof doc.querySelectorAll !== "function") {
769
- return;
770
- }
771
- try {
772
- if (doc.readyState === "complete" || doc.readyState === "interactive") {
773
- inspectInlineEventHandlers(doc);
774
- } else {
775
- doc.addEventListener("DOMContentLoaded", () => inspectInlineEventHandlers(doc), {
776
- once: true,
777
- capture: false
778
- });
779
- }
780
- } catch (e2) {
781
- console.warn("[inlineEventInspection] Failed to inspect document:", e2);
782
- }
820
+ if (document.readyState === "complete" || document.readyState === "interactive") {
821
+ inspectInlineEventHandlers$1();
822
+ } else {
823
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
783
824
  }
784
825
  let _id = 1;
785
826
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -1073,6 +1114,7 @@ function serializeNode(n2, options) {
1073
1114
  childNodes: [],
1074
1115
  xPath,
1075
1116
  compatMode: n2.compatMode
1117
+ // probably "BackCompat"
1076
1118
  };
1077
1119
  } else {
1078
1120
  return {
@@ -1367,7 +1409,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1367
1409
  } else if (sn.type === NodeType$3.Element) {
1368
1410
  if (slimDOMOptions.script && // script tag
1369
1411
  (sn.tagName === "script" || // (module)preload link
1370
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
1412
+ sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
1371
1413
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
1372
1414
  return true;
1373
1415
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
@@ -1629,7 +1671,7 @@ function snapshot(n2, options) {
1629
1671
  blockSelector = null,
1630
1672
  maskTextClass = "rr-mask",
1631
1673
  maskTextSelector = null,
1632
- ignoreAttribute = "rr-ignore-attr",
1674
+ ignoreAttribute = "rr-ignore",
1633
1675
  inlineStylesheet = true,
1634
1676
  inlineImages = false,
1635
1677
  recordCanvas = false,
@@ -1646,7 +1688,6 @@ function snapshot(n2, options) {
1646
1688
  stylesheetLoadTimeout,
1647
1689
  keepIframeSrcFn = () => false
1648
1690
  } = options || {};
1649
- scheduleInlineEventInspection(n2);
1650
1691
  const maskInputOptions = maskAllInputs === true ? {
1651
1692
  color: true,
1652
1693
  date: true,
@@ -5347,11 +5388,16 @@ function getTagName(n2) {
5347
5388
  function adaptCssForReplay(cssText, cache) {
5348
5389
  const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
5349
5390
  if (cachedStyle) return cachedStyle;
5350
- const ast = postcss$1$1([
5351
- mediaSelectorPlugin,
5352
- pseudoClassPlugin
5353
- ]).process(cssText);
5354
- const result2 = ast.css;
5391
+ let result2 = cssText;
5392
+ try {
5393
+ const ast = postcss$1$1([
5394
+ mediaSelectorPlugin,
5395
+ pseudoClassPlugin
5396
+ ]).process(cssText);
5397
+ result2 = ast.css;
5398
+ } catch (error) {
5399
+ console.warn("Failed to adapt css for replay", error);
5400
+ }
5355
5401
  cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
5356
5402
  return result2;
5357
5403
  }
@@ -5372,11 +5418,39 @@ function applyCssSplits(n2, cssText, hackCss, cache) {
5372
5418
  while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {
5373
5419
  cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(""));
5374
5420
  }
5421
+ let adaptedCss = "";
5422
+ if (hackCss) {
5423
+ adaptedCss = adaptCssForReplay(cssTextSplits.join(""), cache);
5424
+ }
5425
+ let startIndex = 0;
5375
5426
  for (let i2 = 0; i2 < childTextNodes.length; i2++) {
5427
+ if (i2 === cssTextSplits.length) {
5428
+ break;
5429
+ }
5376
5430
  const childTextNode = childTextNodes[i2];
5377
- const cssTextSection = cssTextSplits[i2];
5378
- if (childTextNode && cssTextSection) {
5379
- childTextNode.textContent = hackCss ? adaptCssForReplay(cssTextSection, cache) : cssTextSection;
5431
+ if (!hackCss) {
5432
+ childTextNode.textContent = cssTextSplits[i2];
5433
+ } else if (i2 < cssTextSplits.length - 1) {
5434
+ let endIndex = startIndex;
5435
+ let endSearch = cssTextSplits[i2 + 1].length;
5436
+ endSearch = Math.min(endSearch, 30);
5437
+ let found = false;
5438
+ for (; endSearch > 2; endSearch--) {
5439
+ const searchBit = cssTextSplits[i2 + 1].substring(0, endSearch);
5440
+ const searchIndex = adaptedCss.substring(startIndex).indexOf(searchBit);
5441
+ found = searchIndex !== -1;
5442
+ if (found) {
5443
+ endIndex += searchIndex;
5444
+ break;
5445
+ }
5446
+ }
5447
+ if (!found) {
5448
+ endIndex += cssTextSplits[i2].length;
5449
+ }
5450
+ childTextNode.textContent = adaptedCss.substring(startIndex, endIndex);
5451
+ startIndex = endIndex;
5452
+ } else {
5453
+ childTextNode.textContent = adaptedCss.substring(startIndex);
5380
5454
  }
5381
5455
  }
5382
5456
  }
@@ -5460,8 +5534,8 @@ function buildNode(n2, options) {
5460
5534
  } else if (tagName === "meta" && n2.attributes["http-equiv"] === "Content-Security-Policy" && name === "content") {
5461
5535
  node2.setAttribute("csp-content", value.toString());
5462
5536
  continue;
5463
- } else if (tagName === "link" && (n2.attributes.rel === "preload" || n2.attributes.rel === "modulepreload") && n2.attributes.as === "script") {
5464
- } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && n2.attributes.href.endsWith(".js")) {
5537
+ } else if (tagName === "link" && (n2.attributes.rel === "preload" && n2.attributes.as === "script" || n2.attributes.rel === "modulepreload")) {
5538
+ } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && extractFileExtension(n2.attributes.href) === "js") {
5465
5539
  } else if (tagName === "img" && n2.attributes.srcset && n2.attributes.rr_dataURL) {
5466
5540
  node2.setAttribute(
5467
5541
  "rrweb-original-srcset",
@@ -5770,27 +5844,59 @@ const interactiveEvents = [
5770
5844
  "touchend",
5771
5845
  "touchcancel"
5772
5846
  ];
5847
+ const inlineEventAttributes = [
5848
+ "onclick",
5849
+ "ondblclick",
5850
+ "onmousedown",
5851
+ "onmouseup",
5852
+ "onmouseover",
5853
+ "onmouseout",
5854
+ "onmousemove",
5855
+ "onfocus",
5856
+ "onblur",
5857
+ "onkeydown",
5858
+ "onkeypress",
5859
+ "onkeyup",
5860
+ "onchange",
5861
+ "oninput",
5862
+ "onsubmit",
5863
+ "onreset",
5864
+ "onselect",
5865
+ "oncontextmenu",
5866
+ "ontouchstart",
5867
+ "ontouchmove",
5868
+ "ontouchend",
5869
+ "ontouchcancel"
5870
+ ];
5773
5871
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5774
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5775
- const originalAddEventListener = EventTarget.prototype.addEventListener;
5776
- EventTarget.prototype.addEventListener = function(type, listener, options) {
5777
- originalAddEventListener.call(this, type, listener, options);
5778
- if (this instanceof Element) {
5779
- const eventType = type.toLowerCase();
5780
- if (interactiveEvents.includes(eventType)) {
5781
- interactiveElementsRegistry.add(this);
5782
- }
5872
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5873
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5874
+ originalAddEventListener.call(this, type, listener, options);
5875
+ if (this instanceof Element) {
5876
+ const eventType = type.toLowerCase();
5877
+ if (interactiveEvents.includes(eventType)) {
5878
+ interactiveElementsRegistry.add(this);
5783
5879
  }
5784
- };
5880
+ }
5881
+ };
5882
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5883
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5884
+ originalRemoveEventListener.call(this, type, listener, options);
5885
+ };
5886
+ function inspectInlineEventHandlers() {
5887
+ const allElements = document.querySelectorAll("*");
5888
+ allElements.forEach((el) => {
5889
+ inlineEventAttributes.forEach((attr) => {
5890
+ if (el.hasAttribute(attr)) {
5891
+ interactiveElementsRegistry.add(el);
5892
+ }
5893
+ });
5894
+ });
5785
5895
  }
5786
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5787
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5788
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
5789
- originalRemoveEventListener.call(this, type, listener, options);
5790
- if (this instanceof Element) {
5791
- type.toLowerCase();
5792
- }
5793
- };
5896
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5897
+ inspectInlineEventHandlers();
5898
+ } else {
5899
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5794
5900
  }
5795
5901
  function getDefaultExportFromCjs(x2) {
5796
5902
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -10746,6 +10852,32 @@ function querySelectorAll(n2, selectors) {
10746
10852
  function mutationObserverCtor() {
10747
10853
  return getUntaintedPrototype("MutationObserver").constructor;
10748
10854
  }
10855
+ function patch(source, name, replacement) {
10856
+ try {
10857
+ if (!(name in source)) {
10858
+ return () => {
10859
+ };
10860
+ }
10861
+ const original = source[name];
10862
+ const wrapped = replacement(original);
10863
+ if (typeof wrapped === "function") {
10864
+ wrapped.prototype = wrapped.prototype || {};
10865
+ Object.defineProperties(wrapped, {
10866
+ __rrweb_original__: {
10867
+ enumerable: false,
10868
+ value: original
10869
+ }
10870
+ });
10871
+ }
10872
+ source[name] = wrapped;
10873
+ return () => {
10874
+ source[name] = original;
10875
+ };
10876
+ } catch (e2) {
10877
+ return () => {
10878
+ };
10879
+ }
10880
+ }
10749
10881
  const index = {
10750
10882
  childNodes,
10751
10883
  parentNode,
@@ -10758,7 +10890,8 @@ const index = {
10758
10890
  shadowRoot,
10759
10891
  querySelector,
10760
10892
  querySelectorAll,
10761
- mutationObserver: mutationObserverCtor
10893
+ mutationObserver: mutationObserverCtor,
10894
+ patch
10762
10895
  };
10763
10896
  function on(type, fn, target = document) {
10764
10897
  const options = { capture: true, passive: true };
@@ -10841,32 +10974,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
10841
10974
  );
10842
10975
  return () => hookSetter(target, key, original || {}, true);
10843
10976
  }
10844
- function patch(source, name, replacement) {
10845
- try {
10846
- if (!(name in source)) {
10847
- return () => {
10848
- };
10849
- }
10850
- const original = source[name];
10851
- const wrapped = replacement(original);
10852
- if (typeof wrapped === "function") {
10853
- wrapped.prototype = wrapped.prototype || {};
10854
- Object.defineProperties(wrapped, {
10855
- __rrweb_original__: {
10856
- enumerable: false,
10857
- value: original
10858
- }
10859
- });
10860
- }
10861
- source[name] = wrapped;
10862
- return () => {
10863
- source[name] = original;
10864
- };
10865
- } catch (e2) {
10866
- return () => {
10867
- };
10868
- }
10869
- }
10870
10977
  let nowTimestamp = Date.now;
10871
10978
  if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
10872
10979
  nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
@@ -11155,7 +11262,6 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
11155
11262
  return nowTimestamp;
11156
11263
  },
11157
11264
  on,
11158
- patch,
11159
11265
  polyfill: polyfill$1,
11160
11266
  queueToResolveTrees,
11161
11267
  shadowHostInDom,
@@ -11197,13 +11303,14 @@ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
11197
11303
  MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
11198
11304
  MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
11199
11305
  MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
11200
- MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
11201
- MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
11202
- MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
11203
- MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
11204
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
11205
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
11206
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
11306
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
11307
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
11308
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
11309
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
11310
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
11311
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
11312
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
11313
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
11207
11314
  return MouseInteractions2;
11208
11315
  })(MouseInteractions || {});
11209
11316
  var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
@@ -11583,10 +11690,18 @@ class MutationBuffer {
11583
11690
  this.attributes.push(item);
11584
11691
  this.attributeMap.set(textarea, item);
11585
11692
  }
11586
- item.attributes.value = Array.from(
11693
+ const value = Array.from(
11587
11694
  index.childNodes(textarea),
11588
11695
  (cn) => index.textContent(cn) || ""
11589
11696
  ).join("");
11697
+ item.attributes.value = maskInputValue({
11698
+ element: textarea,
11699
+ maskInputOptions: this.maskInputOptions,
11700
+ tagName: textarea.tagName,
11701
+ type: getInputType(textarea),
11702
+ value,
11703
+ maskInputFn: this.maskInputFn
11704
+ });
11590
11705
  });
11591
11706
  __publicField(this, "processMutation", (m) => {
11592
11707
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -14003,7 +14118,6 @@ try {
14003
14118
  }
14004
14119
  const mirror = createMirror$2();
14005
14120
  function record(options = {}) {
14006
- var _a2;
14007
14121
  const {
14008
14122
  emit,
14009
14123
  checkoutEveryNms,
@@ -14013,7 +14127,7 @@ function record(options = {}) {
14013
14127
  blockSelector = null,
14014
14128
  ignoreClass = "rr-ignore",
14015
14129
  ignoreSelector = null,
14016
- ignoreAttribute = "rr-ignore-attribute",
14130
+ ignoreAttribute = "rr-ignore",
14017
14131
  maskTextClass = "rr-mask",
14018
14132
  maskTextSelector = null,
14019
14133
  inlineStylesheet = true,
@@ -14039,24 +14153,12 @@ function record(options = {}) {
14039
14153
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
14040
14154
  errorHandler: errorHandler2
14041
14155
  } = options;
14042
- const win = options.customWindow || window;
14043
- const doc = options.customDocument || document;
14044
- try {
14045
- if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14046
- const cleanFrame = doc.createElement("iframe");
14047
- doc.body.appendChild(cleanFrame);
14048
- Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
14049
- doc.body.removeChild(cleanFrame);
14050
- }
14051
- } catch (err) {
14052
- console.debug("Unable to override Array.from", err);
14053
- }
14054
14156
  registerErrorHandler(errorHandler2);
14055
- const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14157
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14056
14158
  let passEmitsToParent = false;
14057
14159
  if (!inEmittingFrame) {
14058
14160
  try {
14059
- if (win.parent.document) {
14161
+ if (window.parent.document) {
14060
14162
  passEmitsToParent = false;
14061
14163
  }
14062
14164
  } catch (e2) {
@@ -14123,10 +14225,10 @@ function record(options = {}) {
14123
14225
  return e2;
14124
14226
  };
14125
14227
  wrappedEmit = (r2, isCheckout) => {
14126
- var _a3;
14228
+ var _a2;
14127
14229
  const e2 = r2;
14128
14230
  e2.timestamp = nowTimestamp();
14129
- if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14231
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14130
14232
  mutationBuffers.forEach((buf) => buf.unfreeze());
14131
14233
  }
14132
14234
  if (inEmittingFrame) {
@@ -14135,10 +14237,10 @@ function record(options = {}) {
14135
14237
  const message = {
14136
14238
  type: "rrweb",
14137
14239
  event: eventProcessor(e2),
14138
- origin: win.location.origin,
14240
+ origin: window.location.origin,
14139
14241
  isCheckout
14140
14242
  };
14141
- win.parent.postMessage(message, "*");
14243
+ window.parent.postMessage(message, "*");
14142
14244
  }
14143
14245
  if (e2.type === EventType.FullSnapshot) {
14144
14246
  lastFullSnapshotEvent = e2;
@@ -14205,7 +14307,7 @@ function record(options = {}) {
14205
14307
  canvasManager = new CanvasManager({
14206
14308
  recordCanvas,
14207
14309
  mutationCb: wrappedCanvasMutationEmit,
14208
- win,
14310
+ win: window,
14209
14311
  blockClass,
14210
14312
  blockSelector,
14211
14313
  mirror,
@@ -14246,9 +14348,9 @@ function record(options = {}) {
14246
14348
  {
14247
14349
  type: EventType.Meta,
14248
14350
  data: {
14249
- href: win.location.href,
14250
- width: getWindowWidth(win),
14251
- height: getWindowHeight(win)
14351
+ href: window.location.href,
14352
+ width: getWindowWidth(),
14353
+ height: getWindowHeight()
14252
14354
  }
14253
14355
  },
14254
14356
  isCheckout
@@ -14256,12 +14358,13 @@ function record(options = {}) {
14256
14358
  stylesheetManager.reset();
14257
14359
  shadowDomManager.init();
14258
14360
  mutationBuffers.forEach((buf) => buf.lock());
14259
- const node2 = snapshot(doc, {
14361
+ const node2 = snapshot(document, {
14260
14362
  mirror,
14261
14363
  blockClass,
14262
14364
  blockSelector,
14263
14365
  maskTextClass,
14264
14366
  maskTextSelector,
14367
+ ignoreAttribute,
14265
14368
  inlineStylesheet,
14266
14369
  maskAllInputs: maskInputOptions,
14267
14370
  maskTextFn,
@@ -14278,7 +14381,7 @@ function record(options = {}) {
14278
14381
  stylesheetManager.trackLinkElement(n2);
14279
14382
  }
14280
14383
  if (hasShadowRoot(n2)) {
14281
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), doc);
14384
+ shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
14282
14385
  }
14283
14386
  },
14284
14387
  onIframeLoad: (iframe, childSn) => {
@@ -14298,22 +14401,22 @@ function record(options = {}) {
14298
14401
  type: EventType.FullSnapshot,
14299
14402
  data: {
14300
14403
  node: node2,
14301
- initialOffset: getWindowScroll(win)
14404
+ initialOffset: getWindowScroll(window)
14302
14405
  }
14303
14406
  },
14304
14407
  isCheckout
14305
14408
  );
14306
14409
  mutationBuffers.forEach((buf) => buf.unlock());
14307
- if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14410
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14308
14411
  stylesheetManager.adoptStyleSheets(
14309
- doc.adoptedStyleSheets,
14310
- mirror.getId(doc)
14412
+ document.adoptedStyleSheets,
14413
+ mirror.getId(document)
14311
14414
  );
14312
14415
  };
14313
14416
  try {
14314
14417
  const handlers = [];
14315
- const observe = (doc2) => {
14316
- var _a3;
14418
+ const observe = (doc) => {
14419
+ var _a2;
14317
14420
  return callbackWrapper(initObservers)(
14318
14421
  {
14319
14422
  mutationCb: wrappedMutationEmit,
@@ -14406,7 +14509,7 @@ function record(options = {}) {
14406
14509
  inlineImages,
14407
14510
  userTriggeredOnInput,
14408
14511
  collectFonts,
14409
- doc: doc2,
14512
+ doc,
14410
14513
  maskInputFn,
14411
14514
  maskTextFn,
14412
14515
  keepIframeSrcFn,
@@ -14420,7 +14523,7 @@ function record(options = {}) {
14420
14523
  processedNodeManager,
14421
14524
  canvasManager,
14422
14525
  ignoreCSSAttributes,
14423
- plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14526
+ plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14424
14527
  observer: p.observer,
14425
14528
  options: p.options,
14426
14529
  callback: (payload) => wrappedEmit({
@@ -14444,10 +14547,10 @@ function record(options = {}) {
14444
14547
  });
14445
14548
  const init = () => {
14446
14549
  takeFullSnapshot$1();
14447
- handlers.push(observe(doc));
14550
+ handlers.push(observe(document));
14448
14551
  recording = true;
14449
14552
  };
14450
- if (doc.readyState === "interactive" || doc.readyState === "complete") {
14553
+ if (document.readyState === "interactive" || document.readyState === "complete") {
14451
14554
  init();
14452
14555
  } else {
14453
14556
  handlers.push(
@@ -14469,7 +14572,7 @@ function record(options = {}) {
14469
14572
  });
14470
14573
  if (recordAfter === "load") init();
14471
14574
  },
14472
- win
14575
+ window
14473
14576
  )
14474
14577
  );
14475
14578
  }