@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.
@@ -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
@@ -422,19 +452,27 @@ function absolutifyURLs(cssText, href) {
422
452
  }
423
453
  );
424
454
  }
425
- function normalizeCssString(cssText) {
426
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
455
+ function normalizeCssString(cssText, _testNoPxNorm = false) {
456
+ if (_testNoPxNorm) {
457
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
458
+ } else {
459
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
460
+ }
427
461
  }
428
- function splitCssText(cssText, style) {
462
+ function splitCssText(cssText, style, _testNoPxNorm = false) {
429
463
  const childNodes2 = Array.from(style.childNodes);
430
464
  const splits = [];
431
- let iterLimit = 0;
465
+ let iterCount = 0;
432
466
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
433
- let cssTextNorm = normalizeCssString(cssText);
467
+ let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
434
468
  const normFactor = cssTextNorm.length / cssText.length;
435
469
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
436
470
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
437
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
471
+ const textContentNorm = normalizeCssString(
472
+ childNodes2[i2].textContent,
473
+ _testNoPxNorm
474
+ );
475
+ const jLimit = 100;
438
476
  let j = 3;
439
477
  for (; j < textContentNorm.length; j++) {
440
478
  if (
@@ -447,23 +485,49 @@ function splitCssText(cssText, style) {
447
485
  break;
448
486
  }
449
487
  for (; j < textContentNorm.length; j++) {
450
- const bit = textContentNorm.substring(0, j);
451
- const bits = cssTextNorm.split(bit);
488
+ let startSubstring = textContentNorm.substring(0, j);
489
+ let cssNormSplits = cssTextNorm.split(startSubstring);
452
490
  let splitNorm = -1;
453
- if (bits.length === 2) {
454
- splitNorm = cssTextNorm.indexOf(bit);
455
- } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
456
- splitNorm = cssTextNorm.indexOf(bit, 1);
491
+ if (cssNormSplits.length === 2) {
492
+ splitNorm = cssNormSplits[0].length;
493
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
494
+ splitNorm = cssTextNorm.indexOf(startSubstring, 1);
495
+ } else if (cssNormSplits.length === 1) {
496
+ startSubstring = startSubstring.substring(
497
+ 0,
498
+ startSubstring.length - 1
499
+ );
500
+ cssNormSplits = cssTextNorm.split(startSubstring);
501
+ if (cssNormSplits.length <= 1) {
502
+ splits.push(cssText);
503
+ return splits;
504
+ }
505
+ j = jLimit + 1;
506
+ } else if (j === textContentNorm.length - 1) {
507
+ splitNorm = cssTextNorm.indexOf(startSubstring);
508
+ }
509
+ if (cssNormSplits.length >= 2 && j > jLimit) {
510
+ const prevTextContent = childNodes2[i2 - 1].textContent;
511
+ if (prevTextContent && typeof prevTextContent === "string") {
512
+ const prevMinLength = normalizeCssString(prevTextContent).length;
513
+ splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
514
+ }
515
+ if (splitNorm === -1) {
516
+ splitNorm = cssNormSplits[0].length;
517
+ }
457
518
  }
458
519
  if (splitNorm !== -1) {
459
520
  let k = Math.floor(splitNorm / normFactor);
460
521
  for (; k > 0 && k < cssText.length; ) {
461
- iterLimit += 1;
462
- if (iterLimit > 50 * childNodes2.length) {
522
+ iterCount += 1;
523
+ if (iterCount > 50 * childNodes2.length) {
463
524
  splits.push(cssText);
464
525
  return splits;
465
526
  }
466
- const normPart = normalizeCssString(cssText.substring(0, k));
527
+ const normPart = normalizeCssString(
528
+ cssText.substring(0, k),
529
+ _testNoPxNorm
530
+ );
467
531
  if (normPart.length === splitNorm) {
468
532
  splits.push(cssText.substring(0, k));
469
533
  cssText = cssText.substring(k);
@@ -559,9 +623,6 @@ function getXPath(node2) {
559
623
  }
560
624
  return "";
561
625
  }
562
- function isElement(n2) {
563
- return n2.nodeType === n2.ELEMENT_NODE;
564
- }
565
626
  function isTextVisible(n2) {
566
627
  var _a2;
567
628
  const parent = index$1.parentNode(n2);
@@ -582,10 +643,10 @@ function isElementVisible(n2) {
582
643
  const style = win ? win.getComputedStyle(n2) : null;
583
644
  const isStyleVisible = style != null && style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
584
645
  const rect = n2.getBoundingClientRect();
585
- const result2 = isStyleVisible && isRectVisible(rect, win);
646
+ const result2 = isStyleVisible && isRectVisible(rect);
586
647
  return result2;
587
648
  }
588
- function isRectVisible(rect, win) {
649
+ function isRectVisible(rect, win = window) {
589
650
  var _a2, _b, _c, _d;
590
651
  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;
591
652
  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;
@@ -629,7 +690,7 @@ const interactiveTags = [
629
690
  "video",
630
691
  "audio"
631
692
  ];
632
- const inlineEventAttributes = [
693
+ const inlineEventAttributes$1 = [
633
694
  "onclick",
634
695
  "ondblclick",
635
696
  "onmousedown",
@@ -654,27 +715,20 @@ const inlineEventAttributes = [
654
715
  "ontouchcancel"
655
716
  ];
656
717
  const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
657
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
658
- const originalAddEventListener = EventTarget.prototype.addEventListener;
659
- EventTarget.prototype.addEventListener = function(type, listener, options) {
660
- originalAddEventListener.call(this, type, listener, options);
661
- if (this instanceof Element) {
662
- const eventType = type.toLowerCase();
663
- if (interactiveEvents$1.includes(eventType)) {
664
- interactiveElementsRegistry$1.add(this);
665
- }
666
- }
667
- };
668
- }
669
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
670
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
671
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
672
- originalRemoveEventListener.call(this, type, listener, options);
673
- if (this instanceof Element) {
674
- type.toLowerCase();
718
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
719
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
720
+ originalAddEventListener$1.call(this, type, listener, options);
721
+ if (this instanceof Element) {
722
+ const eventType = type.toLowerCase();
723
+ if (interactiveEvents$1.includes(eventType)) {
724
+ interactiveElementsRegistry$1.add(this);
675
725
  }
676
- };
677
- }
726
+ }
727
+ };
728
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
729
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
730
+ originalRemoveEventListener$1.call(this, type, listener, options);
731
+ };
678
732
  function hasEventListeners(n2) {
679
733
  return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
680
734
  }
@@ -694,33 +748,20 @@ function isElementInteractive(n2) {
694
748
  }
695
749
  return false;
696
750
  }
697
- function inspectInlineEventHandlers(doc) {
698
- if (!doc || typeof doc.querySelectorAll !== "function") return;
699
- const allElements = doc.querySelectorAll("*");
751
+ function inspectInlineEventHandlers$1() {
752
+ const allElements = document.querySelectorAll("*");
700
753
  allElements.forEach((el) => {
701
- inlineEventAttributes.forEach((attr) => {
754
+ inlineEventAttributes$1.forEach((attr) => {
702
755
  if (el.hasAttribute(attr)) {
703
756
  interactiveElementsRegistry$1.add(el);
704
757
  }
705
758
  });
706
759
  });
707
760
  }
708
- function scheduleInlineEventInspection(doc) {
709
- if (!doc || typeof doc.addEventListener !== "function" || typeof doc.querySelectorAll !== "function") {
710
- return;
711
- }
712
- try {
713
- if (doc.readyState === "complete" || doc.readyState === "interactive") {
714
- inspectInlineEventHandlers(doc);
715
- } else {
716
- doc.addEventListener("DOMContentLoaded", () => inspectInlineEventHandlers(doc), {
717
- once: true,
718
- capture: false
719
- });
720
- }
721
- } catch (e2) {
722
- console.warn("[inlineEventInspection] Failed to inspect document:", e2);
723
- }
761
+ if (document.readyState === "complete" || document.readyState === "interactive") {
762
+ inspectInlineEventHandlers$1();
763
+ } else {
764
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
724
765
  }
725
766
  let _id = 1;
726
767
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -1014,6 +1055,7 @@ function serializeNode(n2, options) {
1014
1055
  childNodes: [],
1015
1056
  xPath,
1016
1057
  compatMode: n2.compatMode
1058
+ // probably "BackCompat"
1017
1059
  };
1018
1060
  } else {
1019
1061
  return {
@@ -1308,7 +1350,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1308
1350
  } else if (sn.type === NodeType$3.Element) {
1309
1351
  if (slimDOMOptions.script && // script tag
1310
1352
  (sn.tagName === "script" || // (module)preload link
1311
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
1353
+ sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
1312
1354
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
1313
1355
  return true;
1314
1356
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
@@ -1570,7 +1612,7 @@ function snapshot(n2, options) {
1570
1612
  blockSelector = null,
1571
1613
  maskTextClass = "rr-mask",
1572
1614
  maskTextSelector = null,
1573
- ignoreAttribute = "rr-ignore-attr",
1615
+ ignoreAttribute = "rr-ignore",
1574
1616
  inlineStylesheet = true,
1575
1617
  inlineImages = false,
1576
1618
  recordCanvas = false,
@@ -1587,7 +1629,7 @@ function snapshot(n2, options) {
1587
1629
  stylesheetLoadTimeout,
1588
1630
  keepIframeSrcFn = () => false
1589
1631
  } = options || {};
1590
- scheduleInlineEventInspection(n2);
1632
+ console.debug(`${Date.now()} [rrweb-snapshot] snapshot:options:`, options);
1591
1633
  const maskInputOptions = maskAllInputs === true ? {
1592
1634
  color: true,
1593
1635
  date: true,
@@ -5228,27 +5270,59 @@ const interactiveEvents = [
5228
5270
  "touchend",
5229
5271
  "touchcancel"
5230
5272
  ];
5273
+ const inlineEventAttributes = [
5274
+ "onclick",
5275
+ "ondblclick",
5276
+ "onmousedown",
5277
+ "onmouseup",
5278
+ "onmouseover",
5279
+ "onmouseout",
5280
+ "onmousemove",
5281
+ "onfocus",
5282
+ "onblur",
5283
+ "onkeydown",
5284
+ "onkeypress",
5285
+ "onkeyup",
5286
+ "onchange",
5287
+ "oninput",
5288
+ "onsubmit",
5289
+ "onreset",
5290
+ "onselect",
5291
+ "oncontextmenu",
5292
+ "ontouchstart",
5293
+ "ontouchmove",
5294
+ "ontouchend",
5295
+ "ontouchcancel"
5296
+ ];
5231
5297
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5232
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5233
- const originalAddEventListener = EventTarget.prototype.addEventListener;
5234
- EventTarget.prototype.addEventListener = function(type, listener, options) {
5235
- originalAddEventListener.call(this, type, listener, options);
5236
- if (this instanceof Element) {
5237
- const eventType = type.toLowerCase();
5238
- if (interactiveEvents.includes(eventType)) {
5239
- interactiveElementsRegistry.add(this);
5240
- }
5298
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5299
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5300
+ originalAddEventListener.call(this, type, listener, options);
5301
+ if (this instanceof Element) {
5302
+ const eventType = type.toLowerCase();
5303
+ if (interactiveEvents.includes(eventType)) {
5304
+ interactiveElementsRegistry.add(this);
5241
5305
  }
5242
- };
5306
+ }
5307
+ };
5308
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5309
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5310
+ originalRemoveEventListener.call(this, type, listener, options);
5311
+ };
5312
+ function inspectInlineEventHandlers() {
5313
+ const allElements = document.querySelectorAll("*");
5314
+ allElements.forEach((el) => {
5315
+ inlineEventAttributes.forEach((attr) => {
5316
+ if (el.hasAttribute(attr)) {
5317
+ interactiveElementsRegistry.add(el);
5318
+ }
5319
+ });
5320
+ });
5243
5321
  }
5244
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5245
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5246
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
5247
- originalRemoveEventListener.call(this, type, listener, options);
5248
- if (this instanceof Element) {
5249
- type.toLowerCase();
5250
- }
5251
- };
5322
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5323
+ inspectInlineEventHandlers();
5324
+ } else {
5325
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5252
5326
  }
5253
5327
  function getDefaultExportFromCjs(x2) {
5254
5328
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -8984,6 +9058,32 @@ function querySelectorAll(n2, selectors) {
8984
9058
  function mutationObserverCtor() {
8985
9059
  return getUntaintedPrototype("MutationObserver").constructor;
8986
9060
  }
9061
+ function patch(source, name, replacement) {
9062
+ try {
9063
+ if (!(name in source)) {
9064
+ return () => {
9065
+ };
9066
+ }
9067
+ const original = source[name];
9068
+ const wrapped = replacement(original);
9069
+ if (typeof wrapped === "function") {
9070
+ wrapped.prototype = wrapped.prototype || {};
9071
+ Object.defineProperties(wrapped, {
9072
+ __rrweb_original__: {
9073
+ enumerable: false,
9074
+ value: original
9075
+ }
9076
+ });
9077
+ }
9078
+ source[name] = wrapped;
9079
+ return () => {
9080
+ source[name] = original;
9081
+ };
9082
+ } catch {
9083
+ return () => {
9084
+ };
9085
+ }
9086
+ }
8987
9087
  const index = {
8988
9088
  childNodes,
8989
9089
  parentNode,
@@ -8996,7 +9096,8 @@ const index = {
8996
9096
  shadowRoot,
8997
9097
  querySelector,
8998
9098
  querySelectorAll,
8999
- mutationObserver: mutationObserverCtor
9099
+ mutationObserver: mutationObserverCtor,
9100
+ patch
9000
9101
  };
9001
9102
  function on(type, fn, target = document) {
9002
9103
  const options = { capture: true, passive: true };
@@ -9079,32 +9180,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
9079
9180
  );
9080
9181
  return () => hookSetter(target, key, original || {}, true);
9081
9182
  }
9082
- function patch(source, name, replacement) {
9083
- try {
9084
- if (!(name in source)) {
9085
- return () => {
9086
- };
9087
- }
9088
- const original = source[name];
9089
- const wrapped = replacement(original);
9090
- if (typeof wrapped === "function") {
9091
- wrapped.prototype = wrapped.prototype || {};
9092
- Object.defineProperties(wrapped, {
9093
- __rrweb_original__: {
9094
- enumerable: false,
9095
- value: original
9096
- }
9097
- });
9098
- }
9099
- source[name] = wrapped;
9100
- return () => {
9101
- source[name] = original;
9102
- };
9103
- } catch {
9104
- return () => {
9105
- };
9106
- }
9107
- }
9108
9183
  let nowTimestamp = Date.now;
9109
9184
  if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
9110
9185
  nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
@@ -9304,13 +9379,14 @@ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
9304
9379
  MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
9305
9380
  MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
9306
9381
  MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
9307
- MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
9308
- MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
9309
- MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
9310
- MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
9311
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
9312
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
9313
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
9382
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
9383
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
9384
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
9385
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
9386
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
9387
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
9388
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
9389
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
9314
9390
  return MouseInteractions2;
9315
9391
  })(MouseInteractions || {});
9316
9392
  var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
@@ -9670,10 +9746,18 @@ class MutationBuffer {
9670
9746
  this.attributes.push(item);
9671
9747
  this.attributeMap.set(textarea, item);
9672
9748
  }
9673
- item.attributes.value = Array.from(
9749
+ const value = Array.from(
9674
9750
  index.childNodes(textarea),
9675
9751
  (cn) => index.textContent(cn) || ""
9676
9752
  ).join("");
9753
+ item.attributes.value = maskInputValue({
9754
+ element: textarea,
9755
+ maskInputOptions: this.maskInputOptions,
9756
+ tagName: textarea.tagName,
9757
+ type: getInputType(textarea),
9758
+ value,
9759
+ maskInputFn: this.maskInputFn
9760
+ });
9677
9761
  });
9678
9762
  __publicField(this, "processMutation", (m) => {
9679
9763
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -12074,7 +12158,6 @@ try {
12074
12158
  }
12075
12159
  const mirror = createMirror$2();
12076
12160
  function record(options = {}) {
12077
- var _a2;
12078
12161
  const {
12079
12162
  emit,
12080
12163
  checkoutEveryNms,
@@ -12084,7 +12167,7 @@ function record(options = {}) {
12084
12167
  blockSelector = null,
12085
12168
  ignoreClass = "rr-ignore",
12086
12169
  ignoreSelector = null,
12087
- ignoreAttribute = "rr-ignore-attribute",
12170
+ ignoreAttribute = "rr-ignore",
12088
12171
  maskTextClass = "rr-mask",
12089
12172
  maskTextSelector = null,
12090
12173
  inlineStylesheet = true,
@@ -12110,24 +12193,13 @@ function record(options = {}) {
12110
12193
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
12111
12194
  errorHandler: errorHandler2
12112
12195
  } = options;
12113
- const win = options.customWindow || window;
12114
- const doc = options.customDocument || document;
12115
- try {
12116
- if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
12117
- const cleanFrame = doc.createElement("iframe");
12118
- doc.body.appendChild(cleanFrame);
12119
- Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
12120
- doc.body.removeChild(cleanFrame);
12121
- }
12122
- } catch (err) {
12123
- console.debug("Unable to override Array.from", err);
12124
- }
12196
+ console.debug(`${Date.now()} [rrweb] record:options:`, options);
12125
12197
  registerErrorHandler(errorHandler2);
12126
- const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
12198
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
12127
12199
  let passEmitsToParent = false;
12128
12200
  if (!inEmittingFrame) {
12129
12201
  try {
12130
- if (win.parent.document) {
12202
+ if (window.parent.document) {
12131
12203
  passEmitsToParent = false;
12132
12204
  }
12133
12205
  } catch (e2) {
@@ -12194,10 +12266,10 @@ function record(options = {}) {
12194
12266
  return e2;
12195
12267
  };
12196
12268
  wrappedEmit = (r2, isCheckout) => {
12197
- var _a3;
12269
+ var _a2;
12198
12270
  const e2 = r2;
12199
12271
  e2.timestamp = nowTimestamp();
12200
- if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12272
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
12201
12273
  mutationBuffers.forEach((buf) => buf.unfreeze());
12202
12274
  }
12203
12275
  if (inEmittingFrame) {
@@ -12206,10 +12278,10 @@ function record(options = {}) {
12206
12278
  const message = {
12207
12279
  type: "rrweb",
12208
12280
  event: eventProcessor(e2),
12209
- origin: win.location.origin,
12281
+ origin: window.location.origin,
12210
12282
  isCheckout
12211
12283
  };
12212
- win.parent.postMessage(message, "*");
12284
+ window.parent.postMessage(message, "*");
12213
12285
  }
12214
12286
  if (e2.type === EventType.FullSnapshot) {
12215
12287
  lastFullSnapshotEvent = e2;
@@ -12280,7 +12352,7 @@ function record(options = {}) {
12280
12352
  canvasManager = new CanvasManager({
12281
12353
  recordCanvas,
12282
12354
  mutationCb: wrappedCanvasMutationEmit,
12283
- win,
12355
+ win: window,
12284
12356
  blockClass,
12285
12357
  blockSelector,
12286
12358
  mirror,
@@ -12321,9 +12393,9 @@ function record(options = {}) {
12321
12393
  {
12322
12394
  type: EventType.Meta,
12323
12395
  data: {
12324
- href: win.location.href,
12325
- width: getWindowWidth(win),
12326
- height: getWindowHeight(win)
12396
+ href: window.location.href,
12397
+ width: getWindowWidth(),
12398
+ height: getWindowHeight()
12327
12399
  }
12328
12400
  },
12329
12401
  isCheckout
@@ -12331,12 +12403,13 @@ function record(options = {}) {
12331
12403
  stylesheetManager.reset();
12332
12404
  shadowDomManager.init();
12333
12405
  mutationBuffers.forEach((buf) => buf.lock());
12334
- const node2 = snapshot(doc, {
12406
+ const node2 = snapshot(document, {
12335
12407
  mirror,
12336
12408
  blockClass,
12337
12409
  blockSelector,
12338
12410
  maskTextClass,
12339
12411
  maskTextSelector,
12412
+ ignoreAttribute,
12340
12413
  inlineStylesheet,
12341
12414
  maskAllInputs: maskInputOptions,
12342
12415
  maskTextFn,
@@ -12353,7 +12426,7 @@ function record(options = {}) {
12353
12426
  stylesheetManager.trackLinkElement(n2);
12354
12427
  }
12355
12428
  if (hasShadowRoot(n2)) {
12356
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), doc);
12429
+ shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
12357
12430
  }
12358
12431
  },
12359
12432
  onIframeLoad: (iframe, childSn) => {
@@ -12373,22 +12446,22 @@ function record(options = {}) {
12373
12446
  type: EventType.FullSnapshot,
12374
12447
  data: {
12375
12448
  node: node2,
12376
- initialOffset: getWindowScroll(win)
12449
+ initialOffset: getWindowScroll(window)
12377
12450
  }
12378
12451
  },
12379
12452
  isCheckout
12380
12453
  );
12381
12454
  mutationBuffers.forEach((buf) => buf.unlock());
12382
- if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
12455
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
12383
12456
  stylesheetManager.adoptStyleSheets(
12384
- doc.adoptedStyleSheets,
12385
- mirror.getId(doc)
12457
+ document.adoptedStyleSheets,
12458
+ mirror.getId(document)
12386
12459
  );
12387
12460
  };
12388
12461
  try {
12389
12462
  const handlers = [];
12390
- const observe = (doc2) => {
12391
- var _a3;
12463
+ const observe = (doc) => {
12464
+ var _a2;
12392
12465
  return callbackWrapper(initObservers)(
12393
12466
  {
12394
12467
  mutationCb: wrappedMutationEmit,
@@ -12491,7 +12564,7 @@ function record(options = {}) {
12491
12564
  inlineImages,
12492
12565
  userTriggeredOnInput,
12493
12566
  collectFonts,
12494
- doc: doc2,
12567
+ doc,
12495
12568
  maskInputFn,
12496
12569
  maskTextFn,
12497
12570
  keepIframeSrcFn,
@@ -12505,7 +12578,7 @@ function record(options = {}) {
12505
12578
  processedNodeManager,
12506
12579
  canvasManager,
12507
12580
  ignoreCSSAttributes,
12508
- plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
12581
+ plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
12509
12582
  observer: p.observer,
12510
12583
  options: p.options,
12511
12584
  callback: (payload) => wrappedEmit({
@@ -12529,10 +12602,10 @@ function record(options = {}) {
12529
12602
  });
12530
12603
  const init = () => {
12531
12604
  takeFullSnapshot$1();
12532
- handlers.push(observe(doc));
12605
+ handlers.push(observe(document));
12533
12606
  recording = true;
12534
12607
  };
12535
- if (doc.readyState === "interactive" || doc.readyState === "complete") {
12608
+ if (document.readyState === "interactive" || document.readyState === "complete") {
12536
12609
  init();
12537
12610
  } else {
12538
12611
  handlers.push(
@@ -12554,7 +12627,7 @@ function record(options = {}) {
12554
12627
  });
12555
12628
  if (recordAfter === "load") init();
12556
12629
  },
12557
- win
12630
+ window
12558
12631
  )
12559
12632
  );
12560
12633
  }