@appsurify-testmap/rrweb-all 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.
@@ -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 bits2 = cssTextNorm.split(bit);
500
+ let startSubstring = textContentNorm.substring(0, j);
501
+ let cssNormSplits = cssTextNorm.split(startSubstring);
464
502
  let splitNorm = -1;
465
- if (bits2.length === 2) {
466
- splitNorm = cssTextNorm.indexOf(bit);
467
- } else if (bits2.length > 2 && bits2[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, _b2, _c, _d;
602
663
  const height = (win == null ? void 0 : win.innerHeight) ?? ((_b2 = (_a2 = win == null ? void 0 : win.document) == null ? void 0 : _a2.documentElement) == null ? void 0 : _b2.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) => {
@@ -11513,10 +11635,18 @@ class MutationBuffer {
11513
11635
  this.attributes.push(item);
11514
11636
  this.attributeMap.set(textarea, item);
11515
11637
  }
11516
- item.attributes.value = Array.from(
11638
+ const value = Array.from(
11517
11639
  index.childNodes(textarea),
11518
11640
  (cn) => index.textContent(cn) || ""
11519
11641
  ).join("");
11642
+ item.attributes.value = maskInputValue({
11643
+ element: textarea,
11644
+ maskInputOptions: this.maskInputOptions,
11645
+ tagName: textarea.tagName,
11646
+ type: getInputType(textarea),
11647
+ value,
11648
+ maskInputFn: this.maskInputFn
11649
+ });
11520
11650
  });
11521
11651
  __publicField(this, "processMutation", (m) => {
11522
11652
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -13937,7 +14067,6 @@ try {
13937
14067
  }
13938
14068
  const mirror = createMirror$2();
13939
14069
  function record(options = {}) {
13940
- var _a2;
13941
14070
  const {
13942
14071
  emit,
13943
14072
  checkoutEveryNms,
@@ -13947,7 +14076,7 @@ function record(options = {}) {
13947
14076
  blockSelector = null,
13948
14077
  ignoreClass = "rr-ignore",
13949
14078
  ignoreSelector = null,
13950
- ignoreAttribute = "rr-ignore-attribute",
14079
+ ignoreAttribute = "rr-ignore",
13951
14080
  maskTextClass = "rr-mask",
13952
14081
  maskTextSelector = null,
13953
14082
  inlineStylesheet = true,
@@ -13973,24 +14102,13 @@ function record(options = {}) {
13973
14102
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
13974
14103
  errorHandler: errorHandler2
13975
14104
  } = options;
13976
- const win = options.customWindow || window;
13977
- const doc = options.customDocument || document;
13978
- try {
13979
- if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
13980
- const cleanFrame = doc.createElement("iframe");
13981
- doc.body.appendChild(cleanFrame);
13982
- Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
13983
- doc.body.removeChild(cleanFrame);
13984
- }
13985
- } catch (err) {
13986
- console.debug("Unable to override Array.from", err);
13987
- }
14105
+ console.debug(`${Date.now()} [rrweb] record:options:`, options);
13988
14106
  registerErrorHandler(errorHandler2);
13989
- const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14107
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
13990
14108
  let passEmitsToParent = false;
13991
14109
  if (!inEmittingFrame) {
13992
14110
  try {
13993
- if (win.parent.document) {
14111
+ if (window.parent.document) {
13994
14112
  passEmitsToParent = false;
13995
14113
  }
13996
14114
  } catch (e2) {
@@ -14057,10 +14175,10 @@ function record(options = {}) {
14057
14175
  return e2;
14058
14176
  };
14059
14177
  wrappedEmit = (r2, isCheckout) => {
14060
- var _a3;
14178
+ var _a2;
14061
14179
  const e2 = r2;
14062
14180
  e2.timestamp = nowTimestamp();
14063
- if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14181
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14064
14182
  mutationBuffers.forEach((buf) => buf.unfreeze());
14065
14183
  }
14066
14184
  if (inEmittingFrame) {
@@ -14069,10 +14187,10 @@ function record(options = {}) {
14069
14187
  const message = {
14070
14188
  type: "rrweb",
14071
14189
  event: eventProcessor(e2),
14072
- origin: win.location.origin,
14190
+ origin: window.location.origin,
14073
14191
  isCheckout
14074
14192
  };
14075
- win.parent.postMessage(message, "*");
14193
+ window.parent.postMessage(message, "*");
14076
14194
  }
14077
14195
  if (e2.type === EventType.FullSnapshot) {
14078
14196
  lastFullSnapshotEvent = e2;
@@ -14143,7 +14261,7 @@ function record(options = {}) {
14143
14261
  canvasManager = new CanvasManager({
14144
14262
  recordCanvas,
14145
14263
  mutationCb: wrappedCanvasMutationEmit,
14146
- win,
14264
+ win: window,
14147
14265
  blockClass,
14148
14266
  blockSelector,
14149
14267
  mirror,
@@ -14184,9 +14302,9 @@ function record(options = {}) {
14184
14302
  {
14185
14303
  type: EventType.Meta,
14186
14304
  data: {
14187
- href: win.location.href,
14188
- width: getWindowWidth(win),
14189
- height: getWindowHeight(win)
14305
+ href: window.location.href,
14306
+ width: getWindowWidth(),
14307
+ height: getWindowHeight()
14190
14308
  }
14191
14309
  },
14192
14310
  isCheckout
@@ -14194,12 +14312,13 @@ function record(options = {}) {
14194
14312
  stylesheetManager.reset();
14195
14313
  shadowDomManager.init();
14196
14314
  mutationBuffers.forEach((buf) => buf.lock());
14197
- const node2 = snapshot(doc, {
14315
+ const node2 = snapshot(document, {
14198
14316
  mirror,
14199
14317
  blockClass,
14200
14318
  blockSelector,
14201
14319
  maskTextClass,
14202
14320
  maskTextSelector,
14321
+ ignoreAttribute,
14203
14322
  inlineStylesheet,
14204
14323
  maskAllInputs: maskInputOptions,
14205
14324
  maskTextFn,
@@ -14216,7 +14335,7 @@ function record(options = {}) {
14216
14335
  stylesheetManager.trackLinkElement(n2);
14217
14336
  }
14218
14337
  if (hasShadowRoot(n2)) {
14219
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), doc);
14338
+ shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
14220
14339
  }
14221
14340
  },
14222
14341
  onIframeLoad: (iframe, childSn) => {
@@ -14236,22 +14355,22 @@ function record(options = {}) {
14236
14355
  type: EventType.FullSnapshot,
14237
14356
  data: {
14238
14357
  node: node2,
14239
- initialOffset: getWindowScroll(win)
14358
+ initialOffset: getWindowScroll(window)
14240
14359
  }
14241
14360
  },
14242
14361
  isCheckout
14243
14362
  );
14244
14363
  mutationBuffers.forEach((buf) => buf.unlock());
14245
- if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14364
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14246
14365
  stylesheetManager.adoptStyleSheets(
14247
- doc.adoptedStyleSheets,
14248
- mirror.getId(doc)
14366
+ document.adoptedStyleSheets,
14367
+ mirror.getId(document)
14249
14368
  );
14250
14369
  };
14251
14370
  try {
14252
14371
  const handlers = [];
14253
- const observe = (doc2) => {
14254
- var _a3;
14372
+ const observe = (doc) => {
14373
+ var _a2;
14255
14374
  return callbackWrapper(initObservers)(
14256
14375
  {
14257
14376
  mutationCb: wrappedMutationEmit,
@@ -14354,7 +14473,7 @@ function record(options = {}) {
14354
14473
  inlineImages,
14355
14474
  userTriggeredOnInput,
14356
14475
  collectFonts,
14357
- doc: doc2,
14476
+ doc,
14358
14477
  maskInputFn,
14359
14478
  maskTextFn,
14360
14479
  keepIframeSrcFn,
@@ -14368,7 +14487,7 @@ function record(options = {}) {
14368
14487
  processedNodeManager,
14369
14488
  canvasManager,
14370
14489
  ignoreCSSAttributes,
14371
- plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14490
+ plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14372
14491
  observer: p.observer,
14373
14492
  options: p.options,
14374
14493
  callback: (payload) => wrappedEmit({
@@ -14392,10 +14511,10 @@ function record(options = {}) {
14392
14511
  });
14393
14512
  const init = () => {
14394
14513
  takeFullSnapshot$1();
14395
- handlers.push(observe(doc));
14514
+ handlers.push(observe(document));
14396
14515
  recording = true;
14397
14516
  };
14398
- if (doc.readyState === "interactive" || doc.readyState === "complete") {
14517
+ if (document.readyState === "interactive" || document.readyState === "complete") {
14399
14518
  init();
14400
14519
  } else {
14401
14520
  handlers.push(
@@ -14417,7 +14536,7 @@ function record(options = {}) {
14417
14536
  });
14418
14537
  if (recordAfter === "load") init();
14419
14538
  },
14420
- win
14539
+ window
14421
14540
  )
14422
14541
  );
14423
14542
  }