@appsurify-testmap/rrweb 2.0.0-alpha.40 → 2.1.0-alpha.1

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/rrweb.cjs CHANGED
@@ -144,6 +144,32 @@ function querySelectorAll$1(n2, selectors) {
144
144
  function mutationObserverCtor$1() {
145
145
  return getUntaintedPrototype$1("MutationObserver").constructor;
146
146
  }
147
+ function patch$1(source, name, replacement) {
148
+ try {
149
+ if (!(name in source)) {
150
+ return () => {
151
+ };
152
+ }
153
+ const original = source[name];
154
+ const wrapped = replacement(original);
155
+ if (typeof wrapped === "function") {
156
+ wrapped.prototype = wrapped.prototype || {};
157
+ Object.defineProperties(wrapped, {
158
+ __rrweb_original__: {
159
+ enumerable: false,
160
+ value: original
161
+ }
162
+ });
163
+ }
164
+ source[name] = wrapped;
165
+ return () => {
166
+ source[name] = original;
167
+ };
168
+ } catch {
169
+ return () => {
170
+ };
171
+ }
172
+ }
147
173
  const index$1 = {
148
174
  childNodes: childNodes$1,
149
175
  parentNode: parentNode$1,
@@ -156,8 +182,12 @@ const index$1 = {
156
182
  shadowRoot: shadowRoot$1,
157
183
  querySelector: querySelector$1,
158
184
  querySelectorAll: querySelectorAll$1,
159
- mutationObserver: mutationObserverCtor$1
185
+ mutationObserver: mutationObserverCtor$1,
186
+ patch: patch$1
160
187
  };
188
+ function isElement(n2) {
189
+ return n2.nodeType === n2.ELEMENT_NODE;
190
+ }
161
191
  function isShadowRoot(n2) {
162
192
  const hostEl = (
163
193
  // anchor and textarea elements also have a `host` property
@@ -434,19 +464,27 @@ function absolutifyURLs(cssText, href) {
434
464
  }
435
465
  );
436
466
  }
437
- function normalizeCssString(cssText) {
438
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
467
+ function normalizeCssString(cssText, _testNoPxNorm = false) {
468
+ if (_testNoPxNorm) {
469
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
470
+ } else {
471
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
472
+ }
439
473
  }
440
- function splitCssText(cssText, style) {
474
+ function splitCssText(cssText, style, _testNoPxNorm = false) {
441
475
  const childNodes2 = Array.from(style.childNodes);
442
476
  const splits = [];
443
- let iterLimit = 0;
477
+ let iterCount = 0;
444
478
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
445
- let cssTextNorm = normalizeCssString(cssText);
479
+ let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
446
480
  const normFactor = cssTextNorm.length / cssText.length;
447
481
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
448
482
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
449
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
483
+ const textContentNorm = normalizeCssString(
484
+ childNodes2[i2].textContent,
485
+ _testNoPxNorm
486
+ );
487
+ const jLimit = 100;
450
488
  let j = 3;
451
489
  for (; j < textContentNorm.length; j++) {
452
490
  if (
@@ -459,23 +497,49 @@ function splitCssText(cssText, style) {
459
497
  break;
460
498
  }
461
499
  for (; j < textContentNorm.length; j++) {
462
- const bit = textContentNorm.substring(0, j);
463
- const bits = cssTextNorm.split(bit);
500
+ let startSubstring = textContentNorm.substring(0, j);
501
+ let cssNormSplits = cssTextNorm.split(startSubstring);
464
502
  let splitNorm = -1;
465
- if (bits.length === 2) {
466
- splitNorm = cssTextNorm.indexOf(bit);
467
- } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
468
- splitNorm = cssTextNorm.indexOf(bit, 1);
503
+ if (cssNormSplits.length === 2) {
504
+ splitNorm = cssNormSplits[0].length;
505
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
506
+ splitNorm = cssTextNorm.indexOf(startSubstring, 1);
507
+ } else if (cssNormSplits.length === 1) {
508
+ startSubstring = startSubstring.substring(
509
+ 0,
510
+ startSubstring.length - 1
511
+ );
512
+ cssNormSplits = cssTextNorm.split(startSubstring);
513
+ if (cssNormSplits.length <= 1) {
514
+ splits.push(cssText);
515
+ return splits;
516
+ }
517
+ j = jLimit + 1;
518
+ } else if (j === textContentNorm.length - 1) {
519
+ splitNorm = cssTextNorm.indexOf(startSubstring);
520
+ }
521
+ if (cssNormSplits.length >= 2 && j > jLimit) {
522
+ const prevTextContent = childNodes2[i2 - 1].textContent;
523
+ if (prevTextContent && typeof prevTextContent === "string") {
524
+ const prevMinLength = normalizeCssString(prevTextContent).length;
525
+ splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
526
+ }
527
+ if (splitNorm === -1) {
528
+ splitNorm = cssNormSplits[0].length;
529
+ }
469
530
  }
470
531
  if (splitNorm !== -1) {
471
532
  let k = Math.floor(splitNorm / normFactor);
472
533
  for (; k > 0 && k < cssText.length; ) {
473
- iterLimit += 1;
474
- if (iterLimit > 50 * childNodes2.length) {
534
+ iterCount += 1;
535
+ if (iterCount > 50 * childNodes2.length) {
475
536
  splits.push(cssText);
476
537
  return splits;
477
538
  }
478
- const normPart = normalizeCssString(cssText.substring(0, k));
539
+ const normPart = normalizeCssString(
540
+ cssText.substring(0, k),
541
+ _testNoPxNorm
542
+ );
479
543
  if (normPart.length === splitNorm) {
480
544
  splits.push(cssText.substring(0, k));
481
545
  cssText = cssText.substring(k);
@@ -571,9 +635,6 @@ function getXPath(node2) {
571
635
  }
572
636
  return "";
573
637
  }
574
- function isElement(n2) {
575
- return n2.nodeType === n2.ELEMENT_NODE;
576
- }
577
638
  function isTextVisible(n2) {
578
639
  var _a2;
579
640
  const parent = index$1.parentNode(n2);
@@ -594,10 +655,10 @@ function isElementVisible(n2) {
594
655
  const style = win ? win.getComputedStyle(n2) : null;
595
656
  const isStyleVisible = style != null && style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
596
657
  const rect = n2.getBoundingClientRect();
597
- const result2 = isStyleVisible && isRectVisible(rect, win);
658
+ const result2 = isStyleVisible && isRectVisible(rect);
598
659
  return result2;
599
660
  }
600
- function isRectVisible(rect, win) {
661
+ function isRectVisible(rect, win = window) {
601
662
  var _a2, _b, _c, _d;
602
663
  const height = (win == null ? void 0 : win.innerHeight) ?? ((_b = (_a2 = win == null ? void 0 : win.document) == null ? void 0 : _a2.documentElement) == null ? void 0 : _b.clientHeight) ?? 0;
603
664
  const width = (win == null ? void 0 : win.innerWidth) ?? ((_d = (_c = win == null ? void 0 : win.document) == null ? void 0 : _c.documentElement) == null ? void 0 : _d.clientWidth) ?? 0;
@@ -641,7 +702,7 @@ const interactiveTags = [
641
702
  "video",
642
703
  "audio"
643
704
  ];
644
- const inlineEventAttributes = [
705
+ const inlineEventAttributes$1 = [
645
706
  "onclick",
646
707
  "ondblclick",
647
708
  "onmousedown",
@@ -699,33 +760,20 @@ function isElementInteractive(n2) {
699
760
  }
700
761
  return false;
701
762
  }
702
- function inspectInlineEventHandlers(doc) {
703
- if (!doc || typeof doc.querySelectorAll !== "function") return;
704
- const allElements = doc.querySelectorAll("*");
763
+ function inspectInlineEventHandlers$1() {
764
+ const allElements = document.querySelectorAll("*");
705
765
  allElements.forEach((el) => {
706
- inlineEventAttributes.forEach((attr) => {
766
+ inlineEventAttributes$1.forEach((attr) => {
707
767
  if (el.hasAttribute(attr)) {
708
768
  interactiveElementsRegistry$1.add(el);
709
769
  }
710
770
  });
711
771
  });
712
772
  }
713
- function scheduleInlineEventInspection(doc) {
714
- if (!doc || typeof doc.addEventListener !== "function" || typeof doc.querySelectorAll !== "function") {
715
- return;
716
- }
717
- try {
718
- if (doc.readyState === "complete" || doc.readyState === "interactive") {
719
- inspectInlineEventHandlers(doc);
720
- } else {
721
- doc.addEventListener("DOMContentLoaded", () => inspectInlineEventHandlers(doc), {
722
- once: true,
723
- capture: false
724
- });
725
- }
726
- } catch (e2) {
727
- console.warn("[inlineEventInspection] Failed to inspect document:", e2);
728
- }
773
+ if (document.readyState === "complete" || document.readyState === "interactive") {
774
+ inspectInlineEventHandlers$1();
775
+ } else {
776
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
729
777
  }
730
778
  let _id = 1;
731
779
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -1019,6 +1067,7 @@ function serializeNode(n2, options) {
1019
1067
  childNodes: [],
1020
1068
  xPath,
1021
1069
  compatMode: n2.compatMode
1070
+ // probably "BackCompat"
1022
1071
  };
1023
1072
  } else {
1024
1073
  return {
@@ -1313,7 +1362,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1313
1362
  } else if (sn.type === NodeType$3.Element) {
1314
1363
  if (slimDOMOptions.script && // script tag
1315
1364
  (sn.tagName === "script" || // (module)preload link
1316
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
1365
+ sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
1317
1366
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
1318
1367
  return true;
1319
1368
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
@@ -1575,7 +1624,7 @@ function snapshot(n2, options) {
1575
1624
  blockSelector = null,
1576
1625
  maskTextClass = "rr-mask",
1577
1626
  maskTextSelector = null,
1578
- ignoreAttribute = "rr-ignore-attr",
1627
+ ignoreAttribute = "rr-ignore",
1579
1628
  inlineStylesheet = true,
1580
1629
  inlineImages = false,
1581
1630
  recordCanvas = false,
@@ -1592,7 +1641,7 @@ function snapshot(n2, options) {
1592
1641
  stylesheetLoadTimeout,
1593
1642
  keepIframeSrcFn = () => false
1594
1643
  } = options || {};
1595
- scheduleInlineEventInspection(n2);
1644
+ console.debug(`${Date.now()} [rrweb-snapshot] snapshot:options:`, options);
1596
1645
  const maskInputOptions = maskAllInputs === true ? {
1597
1646
  color: true,
1598
1647
  date: true,
@@ -5289,11 +5338,16 @@ function getTagName(n2) {
5289
5338
  function adaptCssForReplay(cssText, cache) {
5290
5339
  const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
5291
5340
  if (cachedStyle) return cachedStyle;
5292
- const ast = postcss$1$1([
5293
- mediaSelectorPlugin,
5294
- pseudoClassPlugin
5295
- ]).process(cssText);
5296
- const result2 = ast.css;
5341
+ let result2 = cssText;
5342
+ try {
5343
+ const ast = postcss$1$1([
5344
+ mediaSelectorPlugin,
5345
+ pseudoClassPlugin
5346
+ ]).process(cssText);
5347
+ result2 = ast.css;
5348
+ } catch (error) {
5349
+ console.warn("Failed to adapt css for replay", error);
5350
+ }
5297
5351
  cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
5298
5352
  return result2;
5299
5353
  }
@@ -5314,11 +5368,39 @@ function applyCssSplits(n2, cssText, hackCss, cache) {
5314
5368
  while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {
5315
5369
  cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(""));
5316
5370
  }
5371
+ let adaptedCss = "";
5372
+ if (hackCss) {
5373
+ adaptedCss = adaptCssForReplay(cssTextSplits.join(""), cache);
5374
+ }
5375
+ let startIndex = 0;
5317
5376
  for (let i2 = 0; i2 < childTextNodes.length; i2++) {
5377
+ if (i2 === cssTextSplits.length) {
5378
+ break;
5379
+ }
5318
5380
  const childTextNode = childTextNodes[i2];
5319
- const cssTextSection = cssTextSplits[i2];
5320
- if (childTextNode && cssTextSection) {
5321
- childTextNode.textContent = hackCss ? adaptCssForReplay(cssTextSection, cache) : cssTextSection;
5381
+ if (!hackCss) {
5382
+ childTextNode.textContent = cssTextSplits[i2];
5383
+ } else if (i2 < cssTextSplits.length - 1) {
5384
+ let endIndex = startIndex;
5385
+ let endSearch = cssTextSplits[i2 + 1].length;
5386
+ endSearch = Math.min(endSearch, 30);
5387
+ let found = false;
5388
+ for (; endSearch > 2; endSearch--) {
5389
+ const searchBit = cssTextSplits[i2 + 1].substring(0, endSearch);
5390
+ const searchIndex = adaptedCss.substring(startIndex).indexOf(searchBit);
5391
+ found = searchIndex !== -1;
5392
+ if (found) {
5393
+ endIndex += searchIndex;
5394
+ break;
5395
+ }
5396
+ }
5397
+ if (!found) {
5398
+ endIndex += cssTextSplits[i2].length;
5399
+ }
5400
+ childTextNode.textContent = adaptedCss.substring(startIndex, endIndex);
5401
+ startIndex = endIndex;
5402
+ } else {
5403
+ childTextNode.textContent = adaptedCss.substring(startIndex);
5322
5404
  }
5323
5405
  }
5324
5406
  }
@@ -5402,8 +5484,8 @@ function buildNode(n2, options) {
5402
5484
  } else if (tagName === "meta" && n2.attributes["http-equiv"] === "Content-Security-Policy" && name === "content") {
5403
5485
  node2.setAttribute("csp-content", value.toString());
5404
5486
  continue;
5405
- } else if (tagName === "link" && (n2.attributes.rel === "preload" || n2.attributes.rel === "modulepreload") && n2.attributes.as === "script") {
5406
- } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && n2.attributes.href.endsWith(".js")) {
5487
+ } else if (tagName === "link" && (n2.attributes.rel === "preload" && n2.attributes.as === "script" || n2.attributes.rel === "modulepreload")) {
5488
+ } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && extractFileExtension(n2.attributes.href) === "js") {
5407
5489
  } else if (tagName === "img" && n2.attributes.srcset && n2.attributes.rr_dataURL) {
5408
5490
  node2.setAttribute(
5409
5491
  "rrweb-original-srcset",
@@ -5712,6 +5794,30 @@ const interactiveEvents = [
5712
5794
  "touchend",
5713
5795
  "touchcancel"
5714
5796
  ];
5797
+ const inlineEventAttributes = [
5798
+ "onclick",
5799
+ "ondblclick",
5800
+ "onmousedown",
5801
+ "onmouseup",
5802
+ "onmouseover",
5803
+ "onmouseout",
5804
+ "onmousemove",
5805
+ "onfocus",
5806
+ "onblur",
5807
+ "onkeydown",
5808
+ "onkeypress",
5809
+ "onkeyup",
5810
+ "onchange",
5811
+ "oninput",
5812
+ "onsubmit",
5813
+ "onreset",
5814
+ "onselect",
5815
+ "oncontextmenu",
5816
+ "ontouchstart",
5817
+ "ontouchmove",
5818
+ "ontouchend",
5819
+ "ontouchcancel"
5820
+ ];
5715
5821
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5716
5822
  const originalAddEventListener = EventTarget.prototype.addEventListener;
5717
5823
  EventTarget.prototype.addEventListener = function(type, listener, options) {
@@ -5727,6 +5833,21 @@ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5727
5833
  EventTarget.prototype.removeEventListener = function(type, listener, options) {
5728
5834
  originalRemoveEventListener.call(this, type, listener, options);
5729
5835
  };
5836
+ function inspectInlineEventHandlers() {
5837
+ const allElements = document.querySelectorAll("*");
5838
+ allElements.forEach((el) => {
5839
+ inlineEventAttributes.forEach((attr) => {
5840
+ if (el.hasAttribute(attr)) {
5841
+ interactiveElementsRegistry.add(el);
5842
+ }
5843
+ });
5844
+ });
5845
+ }
5846
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5847
+ inspectInlineEventHandlers();
5848
+ } else {
5849
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5850
+ }
5730
5851
  function getDefaultExportFromCjs(x2) {
5731
5852
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5732
5853
  }
@@ -10677,6 +10798,32 @@ function querySelectorAll(n2, selectors) {
10677
10798
  function mutationObserverCtor() {
10678
10799
  return getUntaintedPrototype("MutationObserver").constructor;
10679
10800
  }
10801
+ function patch(source, name, replacement) {
10802
+ try {
10803
+ if (!(name in source)) {
10804
+ return () => {
10805
+ };
10806
+ }
10807
+ const original = source[name];
10808
+ const wrapped = replacement(original);
10809
+ if (typeof wrapped === "function") {
10810
+ wrapped.prototype = wrapped.prototype || {};
10811
+ Object.defineProperties(wrapped, {
10812
+ __rrweb_original__: {
10813
+ enumerable: false,
10814
+ value: original
10815
+ }
10816
+ });
10817
+ }
10818
+ source[name] = wrapped;
10819
+ return () => {
10820
+ source[name] = original;
10821
+ };
10822
+ } catch {
10823
+ return () => {
10824
+ };
10825
+ }
10826
+ }
10680
10827
  const index = {
10681
10828
  childNodes,
10682
10829
  parentNode,
@@ -10689,7 +10836,8 @@ const index = {
10689
10836
  shadowRoot,
10690
10837
  querySelector,
10691
10838
  querySelectorAll,
10692
- mutationObserver: mutationObserverCtor
10839
+ mutationObserver: mutationObserverCtor,
10840
+ patch
10693
10841
  };
10694
10842
  function on(type, fn, target = document) {
10695
10843
  const options = { capture: true, passive: true };
@@ -10772,32 +10920,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
10772
10920
  );
10773
10921
  return () => hookSetter(target, key, original || {}, true);
10774
10922
  }
10775
- function patch(source, name, replacement) {
10776
- try {
10777
- if (!(name in source)) {
10778
- return () => {
10779
- };
10780
- }
10781
- const original = source[name];
10782
- const wrapped = replacement(original);
10783
- if (typeof wrapped === "function") {
10784
- wrapped.prototype = wrapped.prototype || {};
10785
- Object.defineProperties(wrapped, {
10786
- __rrweb_original__: {
10787
- enumerable: false,
10788
- value: original
10789
- }
10790
- });
10791
- }
10792
- source[name] = wrapped;
10793
- return () => {
10794
- source[name] = original;
10795
- };
10796
- } catch {
10797
- return () => {
10798
- };
10799
- }
10800
- }
10801
10923
  let nowTimestamp = Date.now;
10802
10924
  if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
10803
10925
  nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
@@ -11085,7 +11207,6 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
11085
11207
  return nowTimestamp;
11086
11208
  },
11087
11209
  on,
11088
- patch,
11089
11210
  polyfill: polyfill$1,
11090
11211
  queueToResolveTrees,
11091
11212
  shadowHostInDom,
@@ -11127,13 +11248,14 @@ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
11127
11248
  MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
11128
11249
  MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
11129
11250
  MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
11130
- MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
11131
- MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
11132
- MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
11133
- MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
11134
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
11135
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
11136
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
11251
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
11252
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
11253
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
11254
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
11255
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
11256
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
11257
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
11258
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
11137
11259
  return MouseInteractions2;
11138
11260
  })(MouseInteractions || {});
11139
11261
  var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
@@ -11530,10 +11652,18 @@ class MutationBuffer {
11530
11652
  this.attributes.push(item);
11531
11653
  this.attributeMap.set(textarea, item);
11532
11654
  }
11533
- item.attributes.value = Array.from(
11655
+ const value = Array.from(
11534
11656
  index.childNodes(textarea),
11535
11657
  (cn) => index.textContent(cn) || ""
11536
11658
  ).join("");
11659
+ item.attributes.value = maskInputValue({
11660
+ element: textarea,
11661
+ maskInputOptions: this.maskInputOptions,
11662
+ tagName: textarea.tagName,
11663
+ type: getInputType(textarea),
11664
+ value,
11665
+ maskInputFn: this.maskInputFn
11666
+ });
11537
11667
  });
11538
11668
  __publicField(this, "processMutation", (m) => {
11539
11669
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -13957,7 +14087,6 @@ try {
13957
14087
  }
13958
14088
  const mirror = createMirror$2();
13959
14089
  function record(options = {}) {
13960
- var _a2;
13961
14090
  const {
13962
14091
  emit,
13963
14092
  checkoutEveryNms,
@@ -13967,7 +14096,7 @@ function record(options = {}) {
13967
14096
  blockSelector = null,
13968
14097
  ignoreClass = "rr-ignore",
13969
14098
  ignoreSelector = null,
13970
- ignoreAttribute = "rr-ignore-attribute",
14099
+ ignoreAttribute = "rr-ignore",
13971
14100
  maskTextClass = "rr-mask",
13972
14101
  maskTextSelector = null,
13973
14102
  inlineStylesheet = true,
@@ -13993,24 +14122,13 @@ function record(options = {}) {
13993
14122
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
13994
14123
  errorHandler: errorHandler2
13995
14124
  } = options;
13996
- const win = options.customWindow || window;
13997
- const doc = options.customDocument || document;
13998
- try {
13999
- if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14000
- const cleanFrame = doc.createElement("iframe");
14001
- doc.body.appendChild(cleanFrame);
14002
- Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
14003
- doc.body.removeChild(cleanFrame);
14004
- }
14005
- } catch (err) {
14006
- console.debug("Unable to override Array.from", err);
14007
- }
14125
+ console.debug(`${Date.now()} [rrweb] record:options:`, options);
14008
14126
  registerErrorHandler(errorHandler2);
14009
- const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14127
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14010
14128
  let passEmitsToParent = false;
14011
14129
  if (!inEmittingFrame) {
14012
14130
  try {
14013
- if (win.parent.document) {
14131
+ if (window.parent.document) {
14014
14132
  passEmitsToParent = false;
14015
14133
  }
14016
14134
  } catch (e2) {
@@ -14077,10 +14195,10 @@ function record(options = {}) {
14077
14195
  return e2;
14078
14196
  };
14079
14197
  wrappedEmit = (r2, isCheckout) => {
14080
- var _a3;
14198
+ var _a2;
14081
14199
  const e2 = r2;
14082
14200
  e2.timestamp = nowTimestamp();
14083
- if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14201
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14084
14202
  mutationBuffers.forEach((buf) => buf.unfreeze());
14085
14203
  }
14086
14204
  if (inEmittingFrame) {
@@ -14089,10 +14207,10 @@ function record(options = {}) {
14089
14207
  const message = {
14090
14208
  type: "rrweb",
14091
14209
  event: eventProcessor(e2),
14092
- origin: win.location.origin,
14210
+ origin: window.location.origin,
14093
14211
  isCheckout
14094
14212
  };
14095
- win.parent.postMessage(message, "*");
14213
+ window.parent.postMessage(message, "*");
14096
14214
  }
14097
14215
  if (e2.type === EventType.FullSnapshot) {
14098
14216
  lastFullSnapshotEvent = e2;
@@ -14163,7 +14281,7 @@ function record(options = {}) {
14163
14281
  canvasManager = new CanvasManager({
14164
14282
  recordCanvas,
14165
14283
  mutationCb: wrappedCanvasMutationEmit,
14166
- win,
14284
+ win: window,
14167
14285
  blockClass,
14168
14286
  blockSelector,
14169
14287
  mirror,
@@ -14204,9 +14322,9 @@ function record(options = {}) {
14204
14322
  {
14205
14323
  type: EventType.Meta,
14206
14324
  data: {
14207
- href: win.location.href,
14208
- width: getWindowWidth(win),
14209
- height: getWindowHeight(win)
14325
+ href: window.location.href,
14326
+ width: getWindowWidth(),
14327
+ height: getWindowHeight()
14210
14328
  }
14211
14329
  },
14212
14330
  isCheckout
@@ -14214,12 +14332,13 @@ function record(options = {}) {
14214
14332
  stylesheetManager.reset();
14215
14333
  shadowDomManager.init();
14216
14334
  mutationBuffers.forEach((buf) => buf.lock());
14217
- const node2 = snapshot(doc, {
14335
+ const node2 = snapshot(document, {
14218
14336
  mirror,
14219
14337
  blockClass,
14220
14338
  blockSelector,
14221
14339
  maskTextClass,
14222
14340
  maskTextSelector,
14341
+ ignoreAttribute,
14223
14342
  inlineStylesheet,
14224
14343
  maskAllInputs: maskInputOptions,
14225
14344
  maskTextFn,
@@ -14236,7 +14355,7 @@ function record(options = {}) {
14236
14355
  stylesheetManager.trackLinkElement(n2);
14237
14356
  }
14238
14357
  if (hasShadowRoot(n2)) {
14239
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), doc);
14358
+ shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
14240
14359
  }
14241
14360
  },
14242
14361
  onIframeLoad: (iframe, childSn) => {
@@ -14256,22 +14375,22 @@ function record(options = {}) {
14256
14375
  type: EventType.FullSnapshot,
14257
14376
  data: {
14258
14377
  node: node2,
14259
- initialOffset: getWindowScroll(win)
14378
+ initialOffset: getWindowScroll(window)
14260
14379
  }
14261
14380
  },
14262
14381
  isCheckout
14263
14382
  );
14264
14383
  mutationBuffers.forEach((buf) => buf.unlock());
14265
- if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14384
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14266
14385
  stylesheetManager.adoptStyleSheets(
14267
- doc.adoptedStyleSheets,
14268
- mirror.getId(doc)
14386
+ document.adoptedStyleSheets,
14387
+ mirror.getId(document)
14269
14388
  );
14270
14389
  };
14271
14390
  try {
14272
14391
  const handlers = [];
14273
- const observe = (doc2) => {
14274
- var _a3;
14392
+ const observe = (doc) => {
14393
+ var _a2;
14275
14394
  return callbackWrapper(initObservers)(
14276
14395
  {
14277
14396
  mutationCb: wrappedMutationEmit,
@@ -14374,7 +14493,7 @@ function record(options = {}) {
14374
14493
  inlineImages,
14375
14494
  userTriggeredOnInput,
14376
14495
  collectFonts,
14377
- doc: doc2,
14496
+ doc,
14378
14497
  maskInputFn,
14379
14498
  maskTextFn,
14380
14499
  keepIframeSrcFn,
@@ -14388,7 +14507,7 @@ function record(options = {}) {
14388
14507
  processedNodeManager,
14389
14508
  canvasManager,
14390
14509
  ignoreCSSAttributes,
14391
- plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14510
+ plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14392
14511
  observer: p.observer,
14393
14512
  options: p.options,
14394
14513
  callback: (payload) => wrappedEmit({
@@ -14412,10 +14531,10 @@ function record(options = {}) {
14412
14531
  });
14413
14532
  const init = () => {
14414
14533
  takeFullSnapshot$1();
14415
- handlers.push(observe(doc));
14534
+ handlers.push(observe(document));
14416
14535
  recording = true;
14417
14536
  };
14418
- if (doc.readyState === "interactive" || doc.readyState === "complete") {
14537
+ if (document.readyState === "interactive" || document.readyState === "complete") {
14419
14538
  init();
14420
14539
  } else {
14421
14540
  handlers.push(
@@ -14437,7 +14556,7 @@ function record(options = {}) {
14437
14556
  });
14438
14557
  if (recordAfter === "load") init();
14439
14558
  },
14440
- win
14559
+ window
14441
14560
  )
14442
14561
  );
14443
14562
  }