@appsurify-testmap/rrweb-record 2.0.0-alpha.41 → 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.
@@ -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 (e) {
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
@@ -467,19 +497,27 @@ function absolutifyURLs(cssText, href) {
467
497
  }
468
498
  );
469
499
  }
470
- function normalizeCssString(cssText) {
471
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
500
+ function normalizeCssString(cssText, _testNoPxNorm = false) {
501
+ if (_testNoPxNorm) {
502
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
503
+ } else {
504
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
505
+ }
472
506
  }
473
- function splitCssText(cssText, style) {
507
+ function splitCssText(cssText, style, _testNoPxNorm = false) {
474
508
  const childNodes2 = Array.from(style.childNodes);
475
509
  const splits = [];
476
- let iterLimit = 0;
510
+ let iterCount = 0;
477
511
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
478
- let cssTextNorm = normalizeCssString(cssText);
512
+ let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
479
513
  const normFactor = cssTextNorm.length / cssText.length;
480
514
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
481
515
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
482
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
516
+ const textContentNorm = normalizeCssString(
517
+ childNodes2[i2].textContent,
518
+ _testNoPxNorm
519
+ );
520
+ const jLimit = 100;
483
521
  let j = 3;
484
522
  for (; j < textContentNorm.length; j++) {
485
523
  if (
@@ -492,23 +530,49 @@ function splitCssText(cssText, style) {
492
530
  break;
493
531
  }
494
532
  for (; j < textContentNorm.length; j++) {
495
- const bit = textContentNorm.substring(0, j);
496
- const bits = cssTextNorm.split(bit);
533
+ let startSubstring = textContentNorm.substring(0, j);
534
+ let cssNormSplits = cssTextNorm.split(startSubstring);
497
535
  let splitNorm = -1;
498
- if (bits.length === 2) {
499
- splitNorm = cssTextNorm.indexOf(bit);
500
- } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
501
- splitNorm = cssTextNorm.indexOf(bit, 1);
536
+ if (cssNormSplits.length === 2) {
537
+ splitNorm = cssNormSplits[0].length;
538
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
539
+ splitNorm = cssTextNorm.indexOf(startSubstring, 1);
540
+ } else if (cssNormSplits.length === 1) {
541
+ startSubstring = startSubstring.substring(
542
+ 0,
543
+ startSubstring.length - 1
544
+ );
545
+ cssNormSplits = cssTextNorm.split(startSubstring);
546
+ if (cssNormSplits.length <= 1) {
547
+ splits.push(cssText);
548
+ return splits;
549
+ }
550
+ j = jLimit + 1;
551
+ } else if (j === textContentNorm.length - 1) {
552
+ splitNorm = cssTextNorm.indexOf(startSubstring);
553
+ }
554
+ if (cssNormSplits.length >= 2 && j > jLimit) {
555
+ const prevTextContent = childNodes2[i2 - 1].textContent;
556
+ if (prevTextContent && typeof prevTextContent === "string") {
557
+ const prevMinLength = normalizeCssString(prevTextContent).length;
558
+ splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
559
+ }
560
+ if (splitNorm === -1) {
561
+ splitNorm = cssNormSplits[0].length;
562
+ }
502
563
  }
503
564
  if (splitNorm !== -1) {
504
565
  let k = Math.floor(splitNorm / normFactor);
505
566
  for (; k > 0 && k < cssText.length; ) {
506
- iterLimit += 1;
507
- if (iterLimit > 50 * childNodes2.length) {
567
+ iterCount += 1;
568
+ if (iterCount > 50 * childNodes2.length) {
508
569
  splits.push(cssText);
509
570
  return splits;
510
571
  }
511
- const normPart = normalizeCssString(cssText.substring(0, k));
572
+ const normPart = normalizeCssString(
573
+ cssText.substring(0, k),
574
+ _testNoPxNorm
575
+ );
512
576
  if (normPart.length === splitNorm) {
513
577
  splits.push(cssText.substring(0, k));
514
578
  cssText = cssText.substring(k);
@@ -604,9 +668,6 @@ function getXPath(node2) {
604
668
  }
605
669
  return "";
606
670
  }
607
- function isElement(n2) {
608
- return n2.nodeType === n2.ELEMENT_NODE;
609
- }
610
671
  function isTextVisible(n2) {
611
672
  var _a2;
612
673
  const parent = index$1.parentNode(n2);
@@ -628,10 +689,10 @@ function isElementVisible(n2) {
628
689
  const style = win ? win.getComputedStyle(n2) : null;
629
690
  const isStyleVisible = style != null && style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
630
691
  const rect = n2.getBoundingClientRect();
631
- const result2 = isStyleVisible && isRectVisible(rect, win);
692
+ const result2 = isStyleVisible && isRectVisible(rect);
632
693
  return result2;
633
694
  }
634
- function isRectVisible(rect, win) {
695
+ function isRectVisible(rect, win = window) {
635
696
  var _a3, _b2, _c2, _d2;
636
697
  var _a2, _b, _c, _d;
637
698
  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;
@@ -676,7 +737,7 @@ const interactiveTags = [
676
737
  "video",
677
738
  "audio"
678
739
  ];
679
- const inlineEventAttributes = [
740
+ const inlineEventAttributes$1 = [
680
741
  "onclick",
681
742
  "ondblclick",
682
743
  "onmousedown",
@@ -701,27 +762,20 @@ const inlineEventAttributes = [
701
762
  "ontouchcancel"
702
763
  ];
703
764
  const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
704
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
705
- const originalAddEventListener = EventTarget.prototype.addEventListener;
706
- EventTarget.prototype.addEventListener = function(type, listener, options) {
707
- originalAddEventListener.call(this, type, listener, options);
708
- if (this instanceof Element) {
709
- const eventType = type.toLowerCase();
710
- if (interactiveEvents$1.includes(eventType)) {
711
- interactiveElementsRegistry$1.add(this);
712
- }
713
- }
714
- };
715
- }
716
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
717
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
718
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
719
- originalRemoveEventListener.call(this, type, listener, options);
720
- if (this instanceof Element) {
721
- type.toLowerCase();
765
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
766
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
767
+ originalAddEventListener$1.call(this, type, listener, options);
768
+ if (this instanceof Element) {
769
+ const eventType = type.toLowerCase();
770
+ if (interactiveEvents$1.includes(eventType)) {
771
+ interactiveElementsRegistry$1.add(this);
722
772
  }
723
- };
724
- }
773
+ }
774
+ };
775
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
776
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
777
+ originalRemoveEventListener$1.call(this, type, listener, options);
778
+ };
725
779
  function hasEventListeners(n2) {
726
780
  return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
727
781
  }
@@ -741,33 +795,20 @@ function isElementInteractive(n2) {
741
795
  }
742
796
  return false;
743
797
  }
744
- function inspectInlineEventHandlers(doc) {
745
- if (!doc || typeof doc.querySelectorAll !== "function") return;
746
- const allElements = doc.querySelectorAll("*");
798
+ function inspectInlineEventHandlers$1() {
799
+ const allElements = document.querySelectorAll("*");
747
800
  allElements.forEach((el) => {
748
- inlineEventAttributes.forEach((attr) => {
801
+ inlineEventAttributes$1.forEach((attr) => {
749
802
  if (el.hasAttribute(attr)) {
750
803
  interactiveElementsRegistry$1.add(el);
751
804
  }
752
805
  });
753
806
  });
754
807
  }
755
- function scheduleInlineEventInspection(doc) {
756
- if (!doc || typeof doc.addEventListener !== "function" || typeof doc.querySelectorAll !== "function") {
757
- return;
758
- }
759
- try {
760
- if (doc.readyState === "complete" || doc.readyState === "interactive") {
761
- inspectInlineEventHandlers(doc);
762
- } else {
763
- doc.addEventListener("DOMContentLoaded", () => inspectInlineEventHandlers(doc), {
764
- once: true,
765
- capture: false
766
- });
767
- }
768
- } catch (e2) {
769
- console.warn("[inlineEventInspection] Failed to inspect document:", e2);
770
- }
808
+ if (document.readyState === "complete" || document.readyState === "interactive") {
809
+ inspectInlineEventHandlers$1();
810
+ } else {
811
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
771
812
  }
772
813
  let _id = 1;
773
814
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -1061,6 +1102,7 @@ function serializeNode(n2, options) {
1061
1102
  childNodes: [],
1062
1103
  xPath,
1063
1104
  compatMode: n2.compatMode
1105
+ // probably "BackCompat"
1064
1106
  };
1065
1107
  } else {
1066
1108
  return {
@@ -1355,7 +1397,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1355
1397
  } else if (sn.type === NodeType$3.Element) {
1356
1398
  if (slimDOMOptions.script && // script tag
1357
1399
  (sn.tagName === "script" || // (module)preload link
1358
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
1400
+ sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
1359
1401
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
1360
1402
  return true;
1361
1403
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
@@ -1617,7 +1659,7 @@ function snapshot(n2, options) {
1617
1659
  blockSelector = null,
1618
1660
  maskTextClass = "rr-mask",
1619
1661
  maskTextSelector = null,
1620
- ignoreAttribute = "rr-ignore-attr",
1662
+ ignoreAttribute = "rr-ignore",
1621
1663
  inlineStylesheet = true,
1622
1664
  inlineImages = false,
1623
1665
  recordCanvas = false,
@@ -1634,7 +1676,7 @@ function snapshot(n2, options) {
1634
1676
  stylesheetLoadTimeout,
1635
1677
  keepIframeSrcFn = () => false
1636
1678
  } = options || {};
1637
- scheduleInlineEventInspection(n2);
1679
+ console.debug(`${Date.now()} [rrweb-snapshot] snapshot:options:`, options);
1638
1680
  const maskInputOptions = maskAllInputs === true ? {
1639
1681
  color: true,
1640
1682
  date: true,
@@ -5279,27 +5321,59 @@ const interactiveEvents = [
5279
5321
  "touchend",
5280
5322
  "touchcancel"
5281
5323
  ];
5324
+ const inlineEventAttributes = [
5325
+ "onclick",
5326
+ "ondblclick",
5327
+ "onmousedown",
5328
+ "onmouseup",
5329
+ "onmouseover",
5330
+ "onmouseout",
5331
+ "onmousemove",
5332
+ "onfocus",
5333
+ "onblur",
5334
+ "onkeydown",
5335
+ "onkeypress",
5336
+ "onkeyup",
5337
+ "onchange",
5338
+ "oninput",
5339
+ "onsubmit",
5340
+ "onreset",
5341
+ "onselect",
5342
+ "oncontextmenu",
5343
+ "ontouchstart",
5344
+ "ontouchmove",
5345
+ "ontouchend",
5346
+ "ontouchcancel"
5347
+ ];
5282
5348
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5283
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5284
- const originalAddEventListener = EventTarget.prototype.addEventListener;
5285
- EventTarget.prototype.addEventListener = function(type, listener, options) {
5286
- originalAddEventListener.call(this, type, listener, options);
5287
- if (this instanceof Element) {
5288
- const eventType = type.toLowerCase();
5289
- if (interactiveEvents.includes(eventType)) {
5290
- interactiveElementsRegistry.add(this);
5291
- }
5349
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5350
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5351
+ originalAddEventListener.call(this, type, listener, options);
5352
+ if (this instanceof Element) {
5353
+ const eventType = type.toLowerCase();
5354
+ if (interactiveEvents.includes(eventType)) {
5355
+ interactiveElementsRegistry.add(this);
5292
5356
  }
5293
- };
5357
+ }
5358
+ };
5359
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5360
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5361
+ originalRemoveEventListener.call(this, type, listener, options);
5362
+ };
5363
+ function inspectInlineEventHandlers() {
5364
+ const allElements = document.querySelectorAll("*");
5365
+ allElements.forEach((el) => {
5366
+ inlineEventAttributes.forEach((attr) => {
5367
+ if (el.hasAttribute(attr)) {
5368
+ interactiveElementsRegistry.add(el);
5369
+ }
5370
+ });
5371
+ });
5294
5372
  }
5295
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5296
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5297
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
5298
- originalRemoveEventListener.call(this, type, listener, options);
5299
- if (this instanceof Element) {
5300
- type.toLowerCase();
5301
- }
5302
- };
5373
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5374
+ inspectInlineEventHandlers();
5375
+ } else {
5376
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5303
5377
  }
5304
5378
  function getDefaultExportFromCjs(x2) {
5305
5379
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -9039,6 +9113,32 @@ function querySelectorAll(n2, selectors) {
9039
9113
  function mutationObserverCtor() {
9040
9114
  return getUntaintedPrototype("MutationObserver").constructor;
9041
9115
  }
9116
+ function patch(source, name, replacement) {
9117
+ try {
9118
+ if (!(name in source)) {
9119
+ return () => {
9120
+ };
9121
+ }
9122
+ const original = source[name];
9123
+ const wrapped = replacement(original);
9124
+ if (typeof wrapped === "function") {
9125
+ wrapped.prototype = wrapped.prototype || {};
9126
+ Object.defineProperties(wrapped, {
9127
+ __rrweb_original__: {
9128
+ enumerable: false,
9129
+ value: original
9130
+ }
9131
+ });
9132
+ }
9133
+ source[name] = wrapped;
9134
+ return () => {
9135
+ source[name] = original;
9136
+ };
9137
+ } catch (e) {
9138
+ return () => {
9139
+ };
9140
+ }
9141
+ }
9042
9142
  const index = {
9043
9143
  childNodes,
9044
9144
  parentNode,
@@ -9051,7 +9151,8 @@ const index = {
9051
9151
  shadowRoot,
9052
9152
  querySelector,
9053
9153
  querySelectorAll,
9054
- mutationObserver: mutationObserverCtor
9154
+ mutationObserver: mutationObserverCtor,
9155
+ patch
9055
9156
  };
9056
9157
  function on(type, fn, target = document) {
9057
9158
  const options = { capture: true, passive: true };
@@ -9134,32 +9235,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
9134
9235
  );
9135
9236
  return () => hookSetter(target, key, original || {}, true);
9136
9237
  }
9137
- function patch(source, name, replacement) {
9138
- try {
9139
- if (!(name in source)) {
9140
- return () => {
9141
- };
9142
- }
9143
- const original = source[name];
9144
- const wrapped = replacement(original);
9145
- if (typeof wrapped === "function") {
9146
- wrapped.prototype = wrapped.prototype || {};
9147
- Object.defineProperties(wrapped, {
9148
- __rrweb_original__: {
9149
- enumerable: false,
9150
- value: original
9151
- }
9152
- });
9153
- }
9154
- source[name] = wrapped;
9155
- return () => {
9156
- source[name] = original;
9157
- };
9158
- } catch (e) {
9159
- return () => {
9160
- };
9161
- }
9162
- }
9163
9238
  let nowTimestamp = Date.now;
9164
9239
  if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
9165
9240
  nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
@@ -9360,13 +9435,14 @@ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
9360
9435
  MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
9361
9436
  MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
9362
9437
  MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
9363
- MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
9364
- MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
9365
- MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
9366
- MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
9367
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
9368
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
9369
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
9438
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
9439
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
9440
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
9441
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
9442
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
9443
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
9444
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
9445
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
9370
9446
  return MouseInteractions2;
9371
9447
  })(MouseInteractions || {});
9372
9448
  var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
@@ -9726,10 +9802,18 @@ class MutationBuffer {
9726
9802
  this.attributes.push(item);
9727
9803
  this.attributeMap.set(textarea, item);
9728
9804
  }
9729
- item.attributes.value = Array.from(
9805
+ const value = Array.from(
9730
9806
  index.childNodes(textarea),
9731
9807
  (cn) => index.textContent(cn) || ""
9732
9808
  ).join("");
9809
+ item.attributes.value = maskInputValue({
9810
+ element: textarea,
9811
+ maskInputOptions: this.maskInputOptions,
9812
+ tagName: textarea.tagName,
9813
+ type: getInputType(textarea),
9814
+ value,
9815
+ maskInputFn: this.maskInputFn
9816
+ });
9733
9817
  });
9734
9818
  __publicField(this, "processMutation", (m) => {
9735
9819
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -12126,7 +12210,6 @@ try {
12126
12210
  }
12127
12211
  const mirror = createMirror$2();
12128
12212
  function record(options = {}) {
12129
- var _a2;
12130
12213
  const {
12131
12214
  emit,
12132
12215
  checkoutEveryNms,
@@ -12136,7 +12219,7 @@ function record(options = {}) {
12136
12219
  blockSelector = null,
12137
12220
  ignoreClass = "rr-ignore",
12138
12221
  ignoreSelector = null,
12139
- ignoreAttribute = "rr-ignore-attribute",
12222
+ ignoreAttribute = "rr-ignore",
12140
12223
  maskTextClass = "rr-mask",
12141
12224
  maskTextSelector = null,
12142
12225
  inlineStylesheet = true,
@@ -12162,24 +12245,13 @@ function record(options = {}) {
12162
12245
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
12163
12246
  errorHandler: errorHandler2
12164
12247
  } = options;
12165
- const win = options.customWindow || window;
12166
- const doc = options.customDocument || document;
12167
- try {
12168
- if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
12169
- const cleanFrame = doc.createElement("iframe");
12170
- doc.body.appendChild(cleanFrame);
12171
- Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
12172
- doc.body.removeChild(cleanFrame);
12173
- }
12174
- } catch (err) {
12175
- console.debug("Unable to override Array.from", err);
12176
- }
12248
+ console.debug(`${Date.now()} [rrweb] record:options:`, options);
12177
12249
  registerErrorHandler(errorHandler2);
12178
- const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
12250
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
12179
12251
  let passEmitsToParent = false;
12180
12252
  if (!inEmittingFrame) {
12181
12253
  try {
12182
- if (win.parent.document) {
12254
+ if (window.parent.document) {
12183
12255
  passEmitsToParent = false;
12184
12256
  }
12185
12257
  } catch (e2) {
@@ -12246,10 +12318,10 @@ function record(options = {}) {
12246
12318
  return e2;
12247
12319
  };
12248
12320
  wrappedEmit = (r2, isCheckout) => {
12249
- var _a3;
12321
+ var _a2;
12250
12322
  const e2 = r2;
12251
12323
  e2.timestamp = nowTimestamp();
12252
- if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12324
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12253
12325
  mutationBuffers.forEach((buf) => buf.unfreeze());
12254
12326
  }
12255
12327
  if (inEmittingFrame) {
@@ -12258,10 +12330,10 @@ function record(options = {}) {
12258
12330
  const message = {
12259
12331
  type: "rrweb",
12260
12332
  event: eventProcessor(e2),
12261
- origin: win.location.origin,
12333
+ origin: window.location.origin,
12262
12334
  isCheckout
12263
12335
  };
12264
- win.parent.postMessage(message, "*");
12336
+ window.parent.postMessage(message, "*");
12265
12337
  }
12266
12338
  if (e2.type === EventType.FullSnapshot) {
12267
12339
  lastFullSnapshotEvent = e2;
@@ -12328,7 +12400,7 @@ function record(options = {}) {
12328
12400
  canvasManager = new CanvasManager({
12329
12401
  recordCanvas,
12330
12402
  mutationCb: wrappedCanvasMutationEmit,
12331
- win,
12403
+ win: window,
12332
12404
  blockClass,
12333
12405
  blockSelector,
12334
12406
  mirror,
@@ -12369,9 +12441,9 @@ function record(options = {}) {
12369
12441
  {
12370
12442
  type: EventType.Meta,
12371
12443
  data: {
12372
- href: win.location.href,
12373
- width: getWindowWidth(win),
12374
- height: getWindowHeight(win)
12444
+ href: window.location.href,
12445
+ width: getWindowWidth(),
12446
+ height: getWindowHeight()
12375
12447
  }
12376
12448
  },
12377
12449
  isCheckout
@@ -12379,12 +12451,13 @@ function record(options = {}) {
12379
12451
  stylesheetManager.reset();
12380
12452
  shadowDomManager.init();
12381
12453
  mutationBuffers.forEach((buf) => buf.lock());
12382
- const node2 = snapshot(doc, {
12454
+ const node2 = snapshot(document, {
12383
12455
  mirror,
12384
12456
  blockClass,
12385
12457
  blockSelector,
12386
12458
  maskTextClass,
12387
12459
  maskTextSelector,
12460
+ ignoreAttribute,
12388
12461
  inlineStylesheet,
12389
12462
  maskAllInputs: maskInputOptions,
12390
12463
  maskTextFn,
@@ -12401,7 +12474,7 @@ function record(options = {}) {
12401
12474
  stylesheetManager.trackLinkElement(n2);
12402
12475
  }
12403
12476
  if (hasShadowRoot(n2)) {
12404
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), doc);
12477
+ shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
12405
12478
  }
12406
12479
  },
12407
12480
  onIframeLoad: (iframe, childSn) => {
@@ -12421,22 +12494,22 @@ function record(options = {}) {
12421
12494
  type: EventType.FullSnapshot,
12422
12495
  data: {
12423
12496
  node: node2,
12424
- initialOffset: getWindowScroll(win)
12497
+ initialOffset: getWindowScroll(window)
12425
12498
  }
12426
12499
  },
12427
12500
  isCheckout
12428
12501
  );
12429
12502
  mutationBuffers.forEach((buf) => buf.unlock());
12430
- if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
12503
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
12431
12504
  stylesheetManager.adoptStyleSheets(
12432
- doc.adoptedStyleSheets,
12433
- mirror.getId(doc)
12505
+ document.adoptedStyleSheets,
12506
+ mirror.getId(document)
12434
12507
  );
12435
12508
  };
12436
12509
  try {
12437
12510
  const handlers = [];
12438
- const observe = (doc2) => {
12439
- var _a3;
12511
+ const observe = (doc) => {
12512
+ var _a2;
12440
12513
  return callbackWrapper(initObservers)(
12441
12514
  {
12442
12515
  mutationCb: wrappedMutationEmit,
@@ -12529,7 +12602,7 @@ function record(options = {}) {
12529
12602
  inlineImages,
12530
12603
  userTriggeredOnInput,
12531
12604
  collectFonts,
12532
- doc: doc2,
12605
+ doc,
12533
12606
  maskInputFn,
12534
12607
  maskTextFn,
12535
12608
  keepIframeSrcFn,
@@ -12543,7 +12616,7 @@ function record(options = {}) {
12543
12616
  processedNodeManager,
12544
12617
  canvasManager,
12545
12618
  ignoreCSSAttributes,
12546
- plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
12619
+ plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
12547
12620
  observer: p.observer,
12548
12621
  options: p.options,
12549
12622
  callback: (payload) => wrappedEmit({
@@ -12567,10 +12640,10 @@ function record(options = {}) {
12567
12640
  });
12568
12641
  const init = () => {
12569
12642
  takeFullSnapshot$1();
12570
- handlers.push(observe(doc));
12643
+ handlers.push(observe(document));
12571
12644
  recording = true;
12572
12645
  };
12573
- if (doc.readyState === "interactive" || doc.readyState === "complete") {
12646
+ if (document.readyState === "interactive" || document.readyState === "complete") {
12574
12647
  init();
12575
12648
  } else {
12576
12649
  handlers.push(
@@ -12592,7 +12665,7 @@ function record(options = {}) {
12592
12665
  });
12593
12666
  if (recordAfter === "load") init();
12594
12667
  },
12595
- win
12668
+ window
12596
12669
  )
12597
12670
  );
12598
12671
  }