@pendo/agent 2.344.0 → 2.345.0

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.
@@ -4129,8 +4129,8 @@ let SERVER = '';
4129
4129
  let ASSET_HOST = '';
4130
4130
  let ASSET_PATH = '';
4131
4131
  let DESIGNER_SERVER = '';
4132
- let VERSION = '2.344.0_';
4133
- let PACKAGE_VERSION = '2.344.0';
4132
+ let VERSION = '2.345.0_';
4133
+ let PACKAGE_VERSION = '2.345.0';
4134
4134
  let LOADER = 'xhr';
4135
4135
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
4136
4136
  /**
@@ -10113,6 +10113,16 @@ function getFontBaseUrl() {
10113
10113
  return `${FONT_HOST}/fonts`;
10114
10114
  }
10115
10115
 
10116
+ // Despite the name, this is a behavioral gate rather than an identity check: it is true whenever
10117
+ // the agent is in a parent-child sub relationship where another subscription owns this agent's
10118
+ // content and event attribution. That covers traditional Adopt training partners and, as a subtype,
10119
+ // partner-analytics-forwarding subs. Call sites rely on that meaning - the acc/oemAccountId event
10120
+ // attribution, the trusted-origin bypass, and skipping the contentHost rewrite - not on the sub
10121
+ // literally being an Adopt partner.
10122
+ // This assumes those subs only ever serve the partner's own content. If Pendo sub analytics is ever
10123
+ // turned on with guides - so a forwarding sub delivers Pendo-origin guide content - the call sites
10124
+ // that treat "partner" as "another sub owns all content" (the contentHost skip in particular) will
10125
+ // need to be revisited, likely as a per-url decision rather than this all-or-nothing gate.
10116
10126
  function treatAsAdoptPartner() {
10117
10127
  // allowPartnerAnalyticsForwarding is set on the snippet in Adopt UI to block based on the environment of the app.
10118
10128
  // adoptAnalyticsForwarding is set in pendoConfig, based on the app flag.
@@ -12592,10 +12602,10 @@ var getDesignerWindow = function () {
12592
12602
  // directly to the top window.
12593
12603
  return isPendo.test(location.href) ? window.parent : window.top;
12594
12604
  };
12595
- var announceAgentLoaded = function () {
12605
+ var announceAgentLoaded = function (url) {
12596
12606
  if (detectMaster()) {
12597
12607
  var win = getDesignerWindow();
12598
- tellMaster(win, { type: 'load', url: location.toString() }, '*');
12608
+ tellMaster(win, { type: 'load', url: url || location.toString() }, '*');
12599
12609
  }
12600
12610
  };
12601
12611
  var addSafeWindowMessageListener = function (cb) {
@@ -13930,7 +13940,7 @@ var pageLoad = makeSafe(function (url) {
13930
13940
  pageLoad.lastUrl = url;
13931
13941
  var loadTime = -1;
13932
13942
  if (!restrictP1Access()) {
13933
- announceAgentLoaded();
13943
+ announceAgentLoaded(url);
13934
13944
  }
13935
13945
  log.debug('sending load event for url ' + url);
13936
13946
  if (typeof performance !== 'undefined' &&
@@ -14557,6 +14567,14 @@ function getPendoCdnHost() {
14557
14567
  // A contentHost set up as a CNAME in app settings is delivered in the hosted config, while a
14558
14568
  // snippet value is the customer's own override of it. Same precedence getDataHost uses.
14559
14569
  function getConfiguredContentHost() {
14570
+ // Partner/OEM guide content lives in the partner's own storage buckets, so we
14571
+ // must not rewrite those urls away from the partner. This is an all-or-nothing skip that
14572
+ // assumes a partner sub never serves Pendo-origin guide content that a contentHost should
14573
+ // apply to - true while only the partner's own guides are delivered. If guides are ever
14574
+ // enabled for partner-analytics subs with content on a Pendo host, this needs to become a
14575
+ // per-url decision (skip partner-bucket urls, still rewrite Pendo-origin ones) instead.
14576
+ if (treatAsAdoptPartner())
14577
+ return undefined;
14560
14578
  return ConfigReader.getLocalConfig('contentHost') || ConfigReader.getHostedConfig('contentHost');
14561
14579
  }
14562
14580
  function replaceWithContentHost(str) {
@@ -26344,10 +26362,14 @@ function isPortValid(port) {
26344
26362
  // (APP-168708). frames and its indexed children are readable across origins, so
26345
26363
  // this holds where an origin check can't: no ancestorOrigins needed, and sandboxed
26346
26364
  // frames (origin "null") are still found.
26365
+ //
26366
+ // frames skips iframes whose element lives in a shadow root, so a web-component
26367
+ // modal's frame never turns up in the walk. top is also readable across origins
26368
+ // and can't be spoofed by a popup, so it covers those frames (APP-171528).
26347
26369
  function isFrameBelowUs(source, window) {
26348
26370
  if (!source)
26349
26371
  return false;
26350
- if (source === window)
26372
+ if (source === window || source.top === window)
26351
26373
  return true;
26352
26374
  var pending = [window];
26353
26375
  while (pending.length) {
@@ -36353,6 +36375,12 @@ const DebuggerModule = (() => {
36353
36375
  identity: { type: SYNC_TYPES.BOTTOM_UP, defaultValue: {} },
36354
36376
  location: { type: SYNC_TYPES.BOTTOM_UP, defaultValue: {} }
36355
36377
  };
36378
+ // frameId comes off the cross-frame channel and keys state.frames, so a key like
36379
+ // __proto__ would resolve to Object.prototype and the sync would write onto it
36380
+ const UNSAFE_FRAME_IDS = ['__proto__', 'constructor', 'prototype'];
36381
+ function isSafeFrameId(frameId) {
36382
+ return _.isString(frameId) && !_.contains(UNSAFE_FRAME_IDS, frameId);
36383
+ }
36356
36384
  const actions = {
36357
36385
  init: (context, buffer) => {
36358
36386
  context.commit('setFrameId', EventTracer.getFrameId());
@@ -36716,6 +36744,8 @@ const DebuggerModule = (() => {
36716
36744
  });
36717
36745
  setter = mutations[`_sync_${fieldName}`] || setter;
36718
36746
  mutations[`_sync_${fieldName}`] = (state, { value, frameId }) => {
36747
+ if (!isSafeFrameId(frameId))
36748
+ return;
36719
36749
  if (!state.frames[frameId]) {
36720
36750
  state.frames[frameId] = {};
36721
36751
  }
@@ -41978,11 +42008,20 @@ class DOMPrompt {
41978
42008
  }
41979
42009
  return tmp;
41980
42010
  }
42011
+ isPasswordInput(elem) {
42012
+ return !!elem && !!elem.tagName && elem.tagName.toLowerCase() === 'input' && elem.type === 'password';
42013
+ }
42014
+ getInputText(inputEl) {
42015
+ if (this.isPasswordInput(inputEl.get())) {
42016
+ return '';
42017
+ }
42018
+ return inputEl.getText();
42019
+ }
41981
42020
  getPromptValue() {
41982
42021
  const elementWithValue = this._.find(this.inputEls, (el) => {
41983
42022
  if (el) {
41984
42023
  try {
41985
- const value = el.getText();
42024
+ const value = this.getInputText(el);
41986
42025
  return value && value.trim();
41987
42026
  }
41988
42027
  catch (err) {
@@ -41993,7 +42032,7 @@ class DOMPrompt {
41993
42032
  });
41994
42033
  if (elementWithValue) {
41995
42034
  try {
41996
- const value = elementWithValue.getText();
42035
+ const value = this.getInputText(elementWithValue);
41997
42036
  return value.trim();
41998
42037
  }
41999
42038
  catch (err) { }
@@ -43073,11 +43112,28 @@ function lookupGuideButtons(domJson, buttons = []) {
43073
43112
  }
43074
43113
  return buttons;
43075
43114
  }
43115
+ function replaceFirstInTextNodes(node, textToReplace, replacementText) {
43116
+ for (let i = 0; i < node.childNodes.length; i++) {
43117
+ const child = node.childNodes[i];
43118
+ if (child.nodeType === 3) {
43119
+ const replaced = child.nodeValue.replace(textToReplace, replacementText);
43120
+ if (replaced !== child.nodeValue) {
43121
+ child.nodeValue = replaced;
43122
+ return true;
43123
+ }
43124
+ }
43125
+ else if (replaceFirstInTextNodes(child, textToReplace, replacementText)) {
43126
+ return true;
43127
+ }
43128
+ }
43129
+ return false;
43130
+ }
43076
43131
  function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
43077
- var _a;
43078
43132
  if (pendo.dom(element).hasClass('_pendo-nps-open-text-poll-question')) {
43079
- // This prevents us from removing the message for the conditionally rendered elements
43080
- element.innerHTML = (_a = element.innerHTML) === null || _a === void 0 ? void 0 : _a.replace(textToReplace, replacementText);
43133
+ // Edit text nodes in place rather than round-tripping innerHTML: re-parsing serialized
43134
+ // guide markup can mutate it into live elements (mXSS). This also keeps child elements intact.
43135
+ element.normalize();
43136
+ replaceFirstInTextNodes(element, textToReplace, replacementText);
43081
43137
  }
43082
43138
  if (element.localName === 'button' ||
43083
43139
  element.localName === 'label' ||
@@ -46404,10 +46460,72 @@ function record() { var __defProp = Object.defineProperty;
46404
46460
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46405
46461
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
46406
46462
  var _a;
46407
- var __defProp$1 = Object.defineProperty;
46408
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46409
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
46410
- var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
46463
+ var EventType = /* @__PURE__ */ ((EventType2) => {
46464
+ EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
46465
+ EventType2[EventType2["Load"] = 1] = "Load";
46466
+ EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
46467
+ EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
46468
+ EventType2[EventType2["Meta"] = 4] = "Meta";
46469
+ EventType2[EventType2["Custom"] = 5] = "Custom";
46470
+ EventType2[EventType2["Plugin"] = 6] = "Plugin";
46471
+ EventType2[EventType2["Asset"] = 7] = "Asset";
46472
+ return EventType2;
46473
+ })(EventType || {});
46474
+ var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
46475
+ IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
46476
+ IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
46477
+ IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
46478
+ IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
46479
+ IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
46480
+ IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
46481
+ IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
46482
+ IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
46483
+ IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
46484
+ IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
46485
+ IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
46486
+ IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
46487
+ IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
46488
+ IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
46489
+ IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
46490
+ IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
46491
+ IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
46492
+ return IncrementalSource2;
46493
+ })(IncrementalSource || {});
46494
+ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
46495
+ MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
46496
+ MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
46497
+ MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
46498
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
46499
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
46500
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
46501
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
46502
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
46503
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
46504
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
46505
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
46506
+ return MouseInteractions2;
46507
+ })(MouseInteractions || {});
46508
+ var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
46509
+ PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse";
46510
+ PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen";
46511
+ PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";
46512
+ return PointerTypes2;
46513
+ })(PointerTypes || {});
46514
+ var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
46515
+ CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
46516
+ CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
46517
+ CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
46518
+ return CanvasContext2;
46519
+ })(CanvasContext || {});
46520
+ var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
46521
+ MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";
46522
+ MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";
46523
+ MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";
46524
+ MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";
46525
+ MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
46526
+ return MediaInteractions2;
46527
+ })(MediaInteractions || {});
46528
+ var NodeType = /* @__PURE__ */ ((NodeType2) => {
46411
46529
  NodeType2[NodeType2["Document"] = 0] = "Document";
46412
46530
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
46413
46531
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -46415,23 +46533,34 @@ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
46415
46533
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
46416
46534
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
46417
46535
  return NodeType2;
46418
- })(NodeType$3 || {});
46419
- const testableAccessors$1 = {
46420
- Node: ["childNodes", "parentNode", "parentElement", "textContent"],
46536
+ })(NodeType || {});
46537
+ const testableAccessors = {
46538
+ Node: [
46539
+ "childNodes",
46540
+ "parentNode",
46541
+ "parentElement",
46542
+ "textContent",
46543
+ "ownerDocument",
46544
+ "firstChild",
46545
+ "lastChild",
46546
+ "nextSibling",
46547
+ "previousSibling"
46548
+ ],
46421
46549
  ShadowRoot: ["host", "styleSheets"],
46422
46550
  Element: ["shadowRoot"],
46423
46551
  MutationObserver: [],
46424
46552
  EventTarget: []
46425
46553
  };
46426
- const testableMethods$1 = {
46554
+ const testableMethods = {
46427
46555
  Node: ["contains", "getRootNode"],
46428
46556
  ShadowRoot: ["getSelection"],
46429
46557
  Element: ["querySelector", "querySelectorAll"],
46430
46558
  MutationObserver: ["constructor"],
46431
46559
  EventTarget: ["addEventListener", "removeEventListener"]
46432
46560
  };
46433
- const untaintedBasePrototype$1 = {};
46434
- function angularZoneUnpatchedAlternative$1(key) {
46561
+ const untaintedBasePrototype = {};
46562
+ const untaintedBaseIframeCleanup = {};
46563
+ function angularZoneUnpatchedAlternative(key) {
46435
46564
  var _a2, _b;
46436
46565
  const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
46437
46566
  if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
@@ -46440,12 +46569,12 @@ function angularZoneUnpatchedAlternative$1(key) {
46440
46569
  return void 0;
46441
46570
  }
46442
46571
  }
46443
- function getUntaintedPrototype$1(key) {
46444
- if (untaintedBasePrototype$1[key])
46445
- return untaintedBasePrototype$1[key];
46446
- const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
46572
+ function getUntaintedPrototype(key) {
46573
+ if (untaintedBasePrototype[key])
46574
+ return untaintedBasePrototype[key];
46575
+ const candidate = angularZoneUnpatchedAlternative(key) || globalThis[key];
46447
46576
  const defaultPrototype = candidate.prototype;
46448
- const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
46577
+ const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;
46449
46578
  const isUntaintedAccessors = Boolean(
46450
46579
  accessorNames && // @ts-expect-error 2345
46451
46580
  accessorNames.every(
@@ -46457,7 +46586,7 @@ function getUntaintedPrototype$1(key) {
46457
46586
  }
46458
46587
  )
46459
46588
  );
46460
- const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
46589
+ const methodNames = key in testableMethods ? testableMethods[key] : void 0;
46461
46590
  const isUntaintedMethods = Boolean(
46462
46591
  methodNames && methodNames.every(
46463
46592
  // @ts-expect-error 2345
@@ -46468,45 +46597,53 @@ function getUntaintedPrototype$1(key) {
46468
46597
  )
46469
46598
  );
46470
46599
  if (isUntaintedAccessors && isUntaintedMethods) {
46471
- untaintedBasePrototype$1[key] = candidate.prototype;
46600
+ untaintedBasePrototype[key] = candidate.prototype;
46472
46601
  return candidate.prototype;
46473
46602
  }
46474
46603
  try {
46475
46604
  const iframeEl = document.createElement("iframe");
46605
+ iframeEl.style.display = "none";
46476
46606
  document.body.appendChild(iframeEl);
46477
46607
  const win = iframeEl.contentWindow;
46478
46608
  if (!win) return candidate.prototype;
46479
46609
  const untaintedObject = win[key].prototype;
46480
- document.body.removeChild(iframeEl);
46481
- if (!untaintedObject) return defaultPrototype;
46482
- return untaintedBasePrototype$1[key] = untaintedObject;
46610
+ if (!untaintedObject) {
46611
+ iframeEl.remove();
46612
+ return defaultPrototype;
46613
+ }
46614
+ const ua = navigator.userAgent;
46615
+ if (ua.includes("Safari") && !ua.includes("Chrome")) {
46616
+ iframeEl.classList.add("rr-block");
46617
+ iframeEl.setAttribute("__rrwebUntaintedMutationObserver", "");
46618
+ untaintedBaseIframeCleanup[key] = () => iframeEl.remove();
46619
+ } else {
46620
+ iframeEl.remove();
46621
+ }
46622
+ return untaintedBasePrototype[key] = untaintedObject;
46483
46623
  } catch {
46484
46624
  return defaultPrototype;
46485
46625
  }
46486
46626
  }
46487
- const untaintedAccessorCache$1 = {};
46488
- function getUntaintedAccessor$1(key, instance, accessor) {
46489
- var _a2;
46490
- const cacheKey = `${key}.${String(accessor)}`;
46491
- if (untaintedAccessorCache$1[cacheKey])
46492
- return untaintedAccessorCache$1[cacheKey].call(
46493
- instance
46494
- );
46495
- const untaintedPrototype = getUntaintedPrototype$1(key);
46496
- const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
46627
+ const untaintedAccessorCache = {};
46628
+ function getUntaintedAccessor(key, instance, accessor) {
46629
+ var _a2, _b;
46630
+ const cached = (_a2 = untaintedAccessorCache[key]) == null ? void 0 : _a2[accessor];
46631
+ if (cached) return cached.call(instance);
46632
+ const untaintedPrototype = getUntaintedPrototype(key);
46633
+ const untaintedAccessor = (_b = Object.getOwnPropertyDescriptor(
46497
46634
  untaintedPrototype,
46498
46635
  accessor
46499
- )) == null ? void 0 : _a2.get;
46636
+ )) == null ? void 0 : _b.get;
46500
46637
  if (!untaintedAccessor) return instance[accessor];
46501
- untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
46638
+ (untaintedAccessorCache[key] || (untaintedAccessorCache[key] = {}))[accessor] = untaintedAccessor;
46502
46639
  return untaintedAccessor.call(instance);
46503
46640
  }
46504
- const untaintedMethodCache$1 = {};
46505
- function getUntaintedMethod$1(key, instance, method) {
46641
+ const untaintedMethodCache = {};
46642
+ function getUntaintedMethod(key, instance, method) {
46506
46643
  var _a2, _b, _c;
46507
46644
  const cacheKey = `${key}.${String(method)}`;
46508
- if (untaintedMethodCache$1[cacheKey])
46509
- return untaintedMethodCache$1[cacheKey].bind(
46645
+ if (untaintedMethodCache[cacheKey])
46646
+ return untaintedMethodCache[cacheKey].bind(
46510
46647
  instance
46511
46648
  );
46512
46649
  const zoneSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(
@@ -46517,67 +46654,106 @@ function getUntaintedMethod$1(key, instance, method) {
46517
46654
  const classProto = (_c = globalThis[key]) == null ? void 0 : _c.prototype;
46518
46655
  const nativeFromZone = globalThis[zoneSymbol] ?? (classProto == null ? void 0 : classProto[zoneSymbol]);
46519
46656
  if (typeof nativeFromZone === "function") {
46520
- untaintedMethodCache$1[cacheKey] = nativeFromZone;
46657
+ untaintedMethodCache[cacheKey] = nativeFromZone;
46521
46658
  return nativeFromZone.bind(
46522
46659
  instance
46523
46660
  );
46524
46661
  }
46525
46662
  }
46526
- const untaintedPrototype = getUntaintedPrototype$1(key);
46663
+ const untaintedPrototype = getUntaintedPrototype(key);
46527
46664
  const untaintedMethod = untaintedPrototype[method];
46528
46665
  if (typeof untaintedMethod !== "function") return instance[method];
46529
- untaintedMethodCache$1[cacheKey] = untaintedMethod;
46666
+ untaintedMethodCache[cacheKey] = untaintedMethod;
46530
46667
  return untaintedMethod.bind(instance);
46531
46668
  }
46532
- function childNodes$1(n2) {
46533
- return getUntaintedAccessor$1("Node", n2, "childNodes");
46669
+ function ownerDocument(n) {
46670
+ return getUntaintedAccessor("Node", n, "ownerDocument");
46534
46671
  }
46535
- function parentNode$1(n2) {
46536
- return getUntaintedAccessor$1("Node", n2, "parentNode");
46672
+ function childNodes(n) {
46673
+ return getUntaintedAccessor("Node", n, "childNodes");
46537
46674
  }
46538
- function parentElement$1(n2) {
46539
- return getUntaintedAccessor$1("Node", n2, "parentElement");
46675
+ function parentNode(n) {
46676
+ return getUntaintedAccessor("Node", n, "parentNode");
46540
46677
  }
46541
- function textContent$1(n2) {
46542
- return getUntaintedAccessor$1("Node", n2, "textContent");
46678
+ function parentElement(n) {
46679
+ return getUntaintedAccessor("Node", n, "parentElement");
46543
46680
  }
46544
- function contains$1(n2, other) {
46545
- return getUntaintedMethod$1("Node", n2, "contains")(other);
46681
+ function textContent(n) {
46682
+ return getUntaintedAccessor("Node", n, "textContent");
46546
46683
  }
46547
- function getRootNode$1(n2) {
46548
- return getUntaintedMethod$1("Node", n2, "getRootNode")();
46684
+ function firstChild(n) {
46685
+ return getUntaintedAccessor("Node", n, "firstChild");
46549
46686
  }
46550
- function host$1(n2) {
46551
- if (!n2 || !("host" in n2)) return null;
46552
- return getUntaintedAccessor$1("ShadowRoot", n2, "host");
46687
+ function lastChild(n) {
46688
+ return getUntaintedAccessor("Node", n, "lastChild");
46553
46689
  }
46554
- function styleSheets$1(n2) {
46555
- return n2.styleSheets;
46690
+ function nextSibling(n) {
46691
+ return getUntaintedAccessor("Node", n, "nextSibling");
46556
46692
  }
46557
- function shadowRoot$1(n2) {
46558
- if (!n2 || !("shadowRoot" in n2)) return null;
46559
- return getUntaintedAccessor$1("Element", n2, "shadowRoot");
46693
+ function previousSibling(n) {
46694
+ return getUntaintedAccessor("Node", n, "previousSibling");
46560
46695
  }
46561
- function querySelector$1(n2, selectors) {
46562
- return getUntaintedMethod$1("Element", n2, "querySelector")(selectors);
46696
+ function contains(n, other) {
46697
+ return getUntaintedMethod("Node", n, "contains")(other);
46563
46698
  }
46564
- function querySelectorAll$1(n2, selectors) {
46565
- return getUntaintedMethod$1("Element", n2, "querySelectorAll")(selectors);
46699
+ function getRootNode(n) {
46700
+ return getUntaintedMethod("Node", n, "getRootNode")();
46566
46701
  }
46567
- function addEventListener$1(n2, type, listener, options) {
46568
- getUntaintedMethod$1("EventTarget", n2, "addEventListener")(type, listener, options);
46702
+ function host(n) {
46703
+ if (!n || !("host" in n)) return null;
46704
+ return getUntaintedAccessor("ShadowRoot", n, "host");
46569
46705
  }
46570
- function removeEventListener$1(n2, type, listener, options) {
46571
- getUntaintedMethod$1("EventTarget", n2, "removeEventListener")(
46706
+ function styleSheets(n) {
46707
+ return n.styleSheets;
46708
+ }
46709
+ function shadowRoot(n) {
46710
+ if (!n || !("shadowRoot" in n)) return null;
46711
+ return getUntaintedAccessor("Element", n, "shadowRoot");
46712
+ }
46713
+ function querySelector(n, selectors) {
46714
+ return getUntaintedMethod("Element", n, "querySelector")(selectors);
46715
+ }
46716
+ function querySelectorAll(n, selectors) {
46717
+ return getUntaintedMethod("Element", n, "querySelectorAll")(selectors);
46718
+ }
46719
+ function addEventListener(n, type, listener, options) {
46720
+ getUntaintedMethod("EventTarget", n, "addEventListener")(type, listener, options);
46721
+ }
46722
+ function removeEventListener(n, type, listener, options) {
46723
+ getUntaintedMethod("EventTarget", n, "removeEventListener")(
46572
46724
  type,
46573
46725
  listener,
46574
46726
  options
46575
46727
  );
46576
46728
  }
46577
- function mutationObserverCtor$1() {
46578
- return getUntaintedPrototype$1("MutationObserver").constructor;
46729
+ function mutationObserverCtor() {
46730
+ return [
46731
+ getUntaintedPrototype("MutationObserver").constructor,
46732
+ untaintedBaseIframeCleanup["MutationObserver"] ?? (() => {
46733
+ })
46734
+ ];
46579
46735
  }
46580
- function patch$1(source, name, replacement) {
46736
+ function getUntaintedProxy() {
46737
+ var _a2, _b;
46738
+ let Proxy3 = window.Proxy;
46739
+ try {
46740
+ if (typeof window.Proxy !== "function" || !((_a2 = window.Proxy) == null ? void 0 : _a2.toString().includes("[native code]"))) {
46741
+ const cleanFrame = document.createElement("iframe");
46742
+ cleanFrame.style.display = "none";
46743
+ document.documentElement.appendChild(cleanFrame);
46744
+ Proxy3 = ((_b = cleanFrame.contentWindow) == null ? void 0 : _b.Proxy) || window.Proxy;
46745
+ document.documentElement.removeChild(cleanFrame);
46746
+ }
46747
+ } catch (err) {
46748
+ console.debug("Unable to get untainted Proxy from iframe", err);
46749
+ }
46750
+ return Proxy3;
46751
+ }
46752
+ let nowTimestamp = Date.now;
46753
+ if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
46754
+ nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
46755
+ }
46756
+ function patch(source, name, replacement) {
46581
46757
  try {
46582
46758
  if (!(name in source)) {
46583
46759
  return () => {
@@ -46603,40 +46779,46 @@ function patch$1(source, name, replacement) {
46603
46779
  };
46604
46780
  }
46605
46781
  }
46606
- const index$1 = {
46607
- childNodes: childNodes$1,
46608
- parentNode: parentNode$1,
46609
- parentElement: parentElement$1,
46610
- textContent: textContent$1,
46611
- contains: contains$1,
46612
- getRootNode: getRootNode$1,
46613
- host: host$1,
46614
- styleSheets: styleSheets$1,
46615
- shadowRoot: shadowRoot$1,
46616
- querySelector: querySelector$1,
46617
- querySelectorAll: querySelectorAll$1,
46618
- addEventListener: addEventListener$1,
46619
- removeEventListener: removeEventListener$1,
46620
- mutationObserver: mutationObserverCtor$1,
46621
- patch: patch$1
46622
- };
46623
- function isElement(n2) {
46624
- return n2.nodeType === n2.ELEMENT_NODE;
46625
- }
46626
- function isShadowRoot(n2) {
46782
+ const index = {
46783
+ ownerDocument,
46784
+ childNodes,
46785
+ parentNode,
46786
+ parentElement,
46787
+ textContent,
46788
+ firstChild,
46789
+ lastChild,
46790
+ nextSibling,
46791
+ previousSibling,
46792
+ contains,
46793
+ getRootNode,
46794
+ host,
46795
+ styleSheets,
46796
+ shadowRoot,
46797
+ querySelector,
46798
+ querySelectorAll,
46799
+ addEventListener,
46800
+ removeEventListener,
46801
+ nowTimestamp,
46802
+ mutationObserverCtor,
46803
+ patch
46804
+ };
46805
+ function isElement(n) {
46806
+ return n.nodeType === n.ELEMENT_NODE;
46807
+ }
46808
+ function isShadowRoot(n) {
46627
46809
  const hostEl = (
46628
46810
  // anchor and textarea elements also have a `host` property
46629
46811
  // but only shadow roots have a `mode` property
46630
- n2 && "host" in n2 && "mode" in n2 && index$1.host(n2) || null
46812
+ n && "host" in n && "mode" in n && index.host(n) || null
46631
46813
  );
46632
46814
  return Boolean(
46633
- hostEl && "shadowRoot" in hostEl && index$1.shadowRoot(hostEl) === n2
46815
+ hostEl && "shadowRoot" in hostEl && index.shadowRoot(hostEl) === n
46634
46816
  );
46635
46817
  }
46636
46818
  function isNativeShadowDom(shadowRoot2) {
46637
46819
  return Object.prototype.toString.call(shadowRoot2) === "[object ShadowRoot]";
46638
46820
  }
46639
- function getNative$1(symbolName, windowObj = window) {
46821
+ function getNative(symbolName, windowObj = window) {
46640
46822
  var _a2, _b;
46641
46823
  const windowWithZone = windowObj;
46642
46824
  const angularZoneSymbol = (_b = (_a2 = windowWithZone == null ? void 0 : windowWithZone.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, symbolName);
@@ -46648,7 +46830,7 @@ function getNative$1(symbolName, windowObj = window) {
46648
46830
  }
46649
46831
  return windowWithZone[symbolName];
46650
46832
  }
46651
- const nativeSetTimeout = typeof window !== "undefined" ? getNative$1("setTimeout").bind(window) : global.setTimeout;
46833
+ const nativeSetTimeout = typeof window !== "undefined" ? getNative("setTimeout").bind(window) : global.setTimeout;
46652
46834
  function fixBrowserCompatibilityIssuesInCSS(cssText) {
46653
46835
  if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
46654
46836
  cssText = cssText.replace(
@@ -46675,18 +46857,18 @@ function escapeImportStatement(rule) {
46675
46857
  }
46676
46858
  return statement.join(" ") + ";";
46677
46859
  }
46678
- function stringifyStylesheet(s2) {
46860
+ function stringifyStylesheet(s) {
46679
46861
  try {
46680
- const rules2 = s2.rules || s2.cssRules;
46681
- if (!rules2) {
46862
+ const rules = s.rules || s.cssRules;
46863
+ if (!rules) {
46682
46864
  return null;
46683
46865
  }
46684
- let sheetHref = s2.href;
46685
- if (!sheetHref && s2.ownerNode) {
46686
- sheetHref = s2.ownerNode.baseURI;
46866
+ let sheetHref = s.href;
46867
+ if (!sheetHref && s.ownerNode) {
46868
+ sheetHref = s.ownerNode.baseURI;
46687
46869
  }
46688
46870
  const stringifiedRules = Array.from(
46689
- rules2,
46871
+ rules,
46690
46872
  (rule) => stringifyRule(rule, sheetHref)
46691
46873
  ).join("");
46692
46874
  return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
@@ -46732,8 +46914,8 @@ function replaceChromeGridTemplateAreas(rule) {
46732
46914
  );
46733
46915
  if (hasGridTemplateInCSSText && hasGridTemplateAreaInStyleRules && !hasGridTemplateAreaInCSSText) {
46734
46916
  const styleDeclarations = [];
46735
- for (let i2 = 0; i2 < rule.style.length; i2++) {
46736
- const styleName = rule.style[i2];
46917
+ for (let i = 0; i < rule.style.length; i++) {
46918
+ const styleName = rule.style[i];
46737
46919
  const styleValue = rule.style.getPropertyValue(styleName);
46738
46920
  styleDeclarations.push(`${styleName}: ${styleValue}`);
46739
46921
  }
@@ -46753,13 +46935,13 @@ function isCSSStyleRule(rule) {
46753
46935
  }
46754
46936
  class Mirror {
46755
46937
  constructor() {
46756
- __publicField$1(this, "idNodeMap", /* @__PURE__ */ new Map());
46757
- __publicField$1(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
46938
+ __publicField(this, "idNodeMap", /* @__PURE__ */ new Map());
46939
+ __publicField(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
46758
46940
  }
46759
- getId(n2) {
46941
+ getId(n) {
46760
46942
  var _a2;
46761
- if (!n2) return -1;
46762
- const id = (_a2 = this.getMeta(n2)) == null ? void 0 : _a2.id;
46943
+ if (!n) return -1;
46944
+ const id = (_a2 = this.getMeta(n)) == null ? void 0 : _a2.id;
46763
46945
  return id ?? -1;
46764
46946
  }
46765
46947
  getNode(id) {
@@ -46768,16 +46950,16 @@ class Mirror {
46768
46950
  getIds() {
46769
46951
  return Array.from(this.idNodeMap.keys());
46770
46952
  }
46771
- getMeta(n2) {
46772
- return this.nodeMetaMap.get(n2) || null;
46953
+ getMeta(n) {
46954
+ return this.nodeMetaMap.get(n) || null;
46773
46955
  }
46774
46956
  // removes the node from idNodeMap
46775
46957
  // doesn't remove the node from nodeMetaMap
46776
- removeNodeFromMap(n2) {
46777
- const id = this.getId(n2);
46958
+ removeNodeFromMap(n) {
46959
+ const id = this.getId(n);
46778
46960
  this.idNodeMap.delete(id);
46779
- if (n2.childNodes) {
46780
- n2.childNodes.forEach(
46961
+ if (n.childNodes) {
46962
+ n.childNodes.forEach(
46781
46963
  (childNode) => this.removeNodeFromMap(childNode)
46782
46964
  );
46783
46965
  }
@@ -46788,25 +46970,25 @@ class Mirror {
46788
46970
  hasNode(node) {
46789
46971
  return this.nodeMetaMap.has(node);
46790
46972
  }
46791
- add(n2, meta) {
46973
+ add(n, meta) {
46792
46974
  const id = meta.id;
46793
- this.idNodeMap.set(id, n2);
46794
- this.nodeMetaMap.set(n2, meta);
46975
+ this.idNodeMap.set(id, n);
46976
+ this.nodeMetaMap.set(n, meta);
46795
46977
  }
46796
- replace(id, n2) {
46978
+ replace(id, n) {
46797
46979
  const oldNode = this.getNode(id);
46798
46980
  if (oldNode) {
46799
46981
  const meta = this.nodeMetaMap.get(oldNode);
46800
- if (meta) this.nodeMetaMap.set(n2, meta);
46982
+ if (meta) this.nodeMetaMap.set(n, meta);
46801
46983
  }
46802
- this.idNodeMap.set(id, n2);
46984
+ this.idNodeMap.set(id, n);
46803
46985
  }
46804
46986
  reset() {
46805
46987
  this.idNodeMap = /* @__PURE__ */ new Map();
46806
46988
  this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
46807
46989
  }
46808
46990
  }
46809
- function createMirror$2() {
46991
+ function createMirror() {
46810
46992
  return new Mirror();
46811
46993
  }
46812
46994
  function maskInputValue({
@@ -46906,8 +47088,10 @@ function absolutifyURLs(cssText, href) {
46906
47088
  if (filePath[0] === "/") {
46907
47089
  return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;
46908
47090
  }
46909
- const stack = href.split("/");
46910
- const parts = filePath.split("/");
47091
+ const filePathNoHash = filePath.split("#")[0];
47092
+ const maybeHash = filePath.substring(filePathNoHash.length);
47093
+ const stack = href.split("#")[0].split("/");
47094
+ const parts = filePathNoHash.split("/");
46911
47095
  stack.pop();
46912
47096
  for (const part of parts) {
46913
47097
  if (part === ".") {
@@ -46918,7 +47102,7 @@ function absolutifyURLs(cssText, href) {
46918
47102
  stack.push(part);
46919
47103
  }
46920
47104
  }
46921
- return `url(${maybeQuote}${stack.join("/")}${maybeQuote})`;
47105
+ return `url(${maybeQuote}${stack.join("/")}${maybeHash}${maybeQuote})`;
46922
47106
  }
46923
47107
  );
46924
47108
  }
@@ -46936,10 +47120,10 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
46936
47120
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
46937
47121
  let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
46938
47122
  const normFactor = cssTextNorm.length / cssText.length;
46939
- for (let i2 = 1; i2 < childNodes2.length; i2++) {
46940
- if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
47123
+ for (let i = 1; i < childNodes2.length; i++) {
47124
+ if (childNodes2[i].textContent && typeof childNodes2[i].textContent === "string") {
46941
47125
  const textContentNorm = normalizeCssString(
46942
- childNodes2[i2].textContent,
47126
+ childNodes2[i].textContent,
46943
47127
  _testNoPxNorm
46944
47128
  );
46945
47129
  const jLimit = 100;
@@ -46960,7 +47144,7 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
46960
47144
  let splitNorm = -1;
46961
47145
  if (cssNormSplits.length === 2) {
46962
47146
  splitNorm = cssNormSplits[0].length;
46963
- } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
47147
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i - 1].textContent !== "") {
46964
47148
  splitNorm = cssTextNorm.indexOf(startSubstring, 1);
46965
47149
  } else if (cssNormSplits.length === 1) {
46966
47150
  startSubstring = startSubstring.substring(
@@ -46977,7 +47161,7 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
46977
47161
  splitNorm = cssTextNorm.indexOf(startSubstring);
46978
47162
  }
46979
47163
  if (cssNormSplits.length >= 2 && j > jLimit) {
46980
- const prevTextContent = childNodes2[i2 - 1].textContent;
47164
+ const prevTextContent = childNodes2[i - 1].textContent;
46981
47165
  if (prevTextContent && typeof prevTextContent === "string") {
46982
47166
  const prevMinLength = normalizeCssString(prevTextContent).length;
46983
47167
  splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
@@ -47033,7 +47217,7 @@ const IGNORED_NODE = -2;
47033
47217
  function genId() {
47034
47218
  return _id++;
47035
47219
  }
47036
- function getValidTagName$1(element) {
47220
+ function getValidTagName(element) {
47037
47221
  if (element instanceof HTMLFormElement) {
47038
47222
  return "form";
47039
47223
  }
@@ -47077,24 +47261,24 @@ function getAbsoluteSrcsetString(doc, attributeValue) {
47077
47261
  url = absoluteToDoc(doc, url);
47078
47262
  let inParens = false;
47079
47263
  while (true) {
47080
- const c2 = attributeValue.charAt(pos);
47081
- if (c2 === "") {
47264
+ const c = attributeValue.charAt(pos);
47265
+ if (c === "") {
47082
47266
  output.push((url + descriptorsStr).trim());
47083
47267
  break;
47084
47268
  } else if (!inParens) {
47085
- if (c2 === ",") {
47269
+ if (c === ",") {
47086
47270
  pos += 1;
47087
47271
  output.push((url + descriptorsStr).trim());
47088
47272
  break;
47089
- } else if (c2 === "(") {
47273
+ } else if (c === "(") {
47090
47274
  inParens = true;
47091
47275
  }
47092
47276
  } else {
47093
- if (c2 === ")") {
47277
+ if (c === ")") {
47094
47278
  inParens = false;
47095
47279
  }
47096
47280
  }
47097
- descriptorsStr += c2;
47281
+ descriptorsStr += c;
47098
47282
  pos += 1;
47099
47283
  }
47100
47284
  }
@@ -47112,18 +47296,18 @@ function isSVGElement(el) {
47112
47296
  return Boolean(el.tagName === "svg" || el.ownerSVGElement);
47113
47297
  }
47114
47298
  function getHref(doc, customHref) {
47115
- let a2 = cachedDocument.get(doc);
47116
- if (!a2) {
47117
- a2 = doc.createElement("a");
47118
- cachedDocument.set(doc, a2);
47299
+ let a = cachedDocument.get(doc);
47300
+ if (!a) {
47301
+ a = doc.createElement("a");
47302
+ cachedDocument.set(doc, a);
47119
47303
  }
47120
47304
  if (!customHref) {
47121
47305
  customHref = "";
47122
47306
  } else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) {
47123
47307
  return customHref;
47124
47308
  }
47125
- a2.setAttribute("href", customHref);
47126
- return a2.href;
47309
+ a.setAttribute("href", customHref);
47310
+ return a.href;
47127
47311
  }
47128
47312
  function transformAttribute(doc, tagName, name, value) {
47129
47313
  if (!value) {
@@ -47133,7 +47317,7 @@ function transformAttribute(doc, tagName, name, value) {
47133
47317
  return absoluteToDoc(doc, value);
47134
47318
  } else if (name === "xlink:href" && value[0] !== "#") {
47135
47319
  return absoluteToDoc(doc, value);
47136
- } else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {
47320
+ } else if (name === "background" && ["table", "td", "th"].includes(tagName)) {
47137
47321
  return absoluteToDoc(doc, value);
47138
47322
  } else if (name === "srcset") {
47139
47323
  return getAbsoluteSrcsetString(doc, value);
@@ -47145,7 +47329,7 @@ function transformAttribute(doc, tagName, name, value) {
47145
47329
  return value;
47146
47330
  }
47147
47331
  function ignoreAttribute(tagName, name, _value) {
47148
- return (tagName === "video" || tagName === "audio") && name === "autoplay";
47332
+ return ["video", "audio"].includes(tagName) && toLowerCase(name) === "autoplay";
47149
47333
  }
47150
47334
  function _isBlockedElement(element, blockClass, blockSelector) {
47151
47335
  try {
@@ -47164,7 +47348,7 @@ function _isBlockedElement(element, blockClass, blockSelector) {
47164
47348
  if (blockSelector) {
47165
47349
  return element.matches(blockSelector);
47166
47350
  }
47167
- } catch (e2) {
47351
+ } catch (e) {
47168
47352
  }
47169
47353
  return false;
47170
47354
  }
@@ -47173,7 +47357,7 @@ function classMatchesRegex(node, regex, checkAncestors) {
47173
47357
  if (!regex) return false;
47174
47358
  if (node.nodeType !== node.ELEMENT_NODE) {
47175
47359
  if (!checkAncestors) return false;
47176
- return classMatchesRegex(index$1.parentNode(node), regex, checkAncestors);
47360
+ return classMatchesRegex(index.parentNode(node), regex, checkAncestors);
47177
47361
  }
47178
47362
  for (let eIndex = node.classList.length; eIndex--; ) {
47179
47363
  const className = node.classList[eIndex];
@@ -47182,20 +47366,20 @@ function classMatchesRegex(node, regex, checkAncestors) {
47182
47366
  }
47183
47367
  }
47184
47368
  if (!checkAncestors) return false;
47185
- return classMatchesRegex(index$1.parentNode(node), regex, checkAncestors);
47369
+ return classMatchesRegex(index.parentNode(node), regex, checkAncestors);
47186
47370
  }
47187
47371
  function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
47188
47372
  let el;
47189
47373
  if (isElement(node)) {
47190
47374
  el = node;
47191
47375
  if (maskTextSelector === "*") return true;
47192
- if (!index$1.childNodes(el).length) {
47376
+ if (!index.childNodes(el).length) {
47193
47377
  return false;
47194
47378
  }
47195
- } else if (index$1.parentElement(node) === null) {
47379
+ } else if (index.parentElement(node) === null) {
47196
47380
  return false;
47197
47381
  } else {
47198
- el = index$1.parentElement(node);
47382
+ el = index.parentElement(node);
47199
47383
  }
47200
47384
  try {
47201
47385
  if (typeof maskTextClass === "string") {
@@ -47214,7 +47398,7 @@ function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors)
47214
47398
  if (el.matches(maskTextSelector)) return true;
47215
47399
  }
47216
47400
  }
47217
- } catch (e2) {
47401
+ } catch (e) {
47218
47402
  }
47219
47403
  return false;
47220
47404
  }
@@ -47272,7 +47456,7 @@ function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
47272
47456
  listener();
47273
47457
  });
47274
47458
  }
47275
- function serializeNode(n2, options) {
47459
+ function serializeNode(n, options) {
47276
47460
  const {
47277
47461
  doc,
47278
47462
  mirror: mirror2,
@@ -47292,31 +47476,31 @@ function serializeNode(n2, options) {
47292
47476
  cssCaptured = false
47293
47477
  } = options;
47294
47478
  const rootId = getRootId(doc, mirror2);
47295
- switch (n2.nodeType) {
47296
- case n2.DOCUMENT_NODE:
47297
- if (n2.compatMode !== "CSS1Compat") {
47479
+ switch (n.nodeType) {
47480
+ case n.DOCUMENT_NODE:
47481
+ if (n.compatMode !== "CSS1Compat") {
47298
47482
  return {
47299
- type: NodeType$3.Document,
47483
+ type: NodeType.Document,
47300
47484
  childNodes: [],
47301
- compatMode: n2.compatMode
47485
+ compatMode: n.compatMode
47302
47486
  // probably "BackCompat"
47303
47487
  };
47304
47488
  } else {
47305
47489
  return {
47306
- type: NodeType$3.Document,
47490
+ type: NodeType.Document,
47307
47491
  childNodes: []
47308
47492
  };
47309
47493
  }
47310
- case n2.DOCUMENT_TYPE_NODE:
47494
+ case n.DOCUMENT_TYPE_NODE:
47311
47495
  return {
47312
- type: NodeType$3.DocumentType,
47313
- name: n2.name,
47314
- publicId: n2.publicId,
47315
- systemId: n2.systemId,
47496
+ type: NodeType.DocumentType,
47497
+ name: n.name,
47498
+ publicId: n.publicId,
47499
+ systemId: n.systemId,
47316
47500
  rootId
47317
47501
  };
47318
- case n2.ELEMENT_NODE:
47319
- return serializeElementNode(n2, {
47502
+ case n.ELEMENT_NODE:
47503
+ return serializeElementNode(n, {
47320
47504
  doc,
47321
47505
  blockClass,
47322
47506
  blockSelector,
@@ -47332,8 +47516,8 @@ function serializeNode(n2, options) {
47332
47516
  rootId,
47333
47517
  needsMask
47334
47518
  });
47335
- case n2.TEXT_NODE:
47336
- return serializeTextNode(n2, {
47519
+ case n.TEXT_NODE:
47520
+ return serializeTextNode(n, {
47337
47521
  doc,
47338
47522
  needsMask,
47339
47523
  maskTextFn,
@@ -47342,16 +47526,16 @@ function serializeNode(n2, options) {
47342
47526
  rootId,
47343
47527
  cssCaptured
47344
47528
  });
47345
- case n2.CDATA_SECTION_NODE:
47529
+ case n.CDATA_SECTION_NODE:
47346
47530
  return {
47347
- type: NodeType$3.CDATA,
47531
+ type: NodeType.CDATA,
47348
47532
  textContent: "",
47349
47533
  rootId
47350
47534
  };
47351
- case n2.COMMENT_NODE:
47535
+ case n.COMMENT_NODE:
47352
47536
  return {
47353
- type: NodeType$3.Comment,
47354
- textContent: index$1.textContent(n2) || "",
47537
+ type: NodeType.Comment,
47538
+ textContent: index.textContent(n) || "",
47355
47539
  rootId
47356
47540
  };
47357
47541
  default:
@@ -47363,7 +47547,7 @@ function getRootId(doc, mirror2) {
47363
47547
  const docId = mirror2.getId(doc);
47364
47548
  return docId === 1 ? void 0 : docId;
47365
47549
  }
47366
- function serializeTextNode(n2, options) {
47550
+ function serializeTextNode(n, options) {
47367
47551
  var _a2;
47368
47552
  const {
47369
47553
  needsMask,
@@ -47373,23 +47557,23 @@ function serializeTextNode(n2, options) {
47373
47557
  rootId,
47374
47558
  cssCaptured
47375
47559
  } = options;
47376
- const parentTagName = n2.parentNode && n2.parentNode.tagName;
47560
+ const parentTagName = n.parentNode && n.parentNode.tagName;
47377
47561
  let textContent2 = "";
47378
47562
  const isStyle = parentTagName === "STYLE" ? true : void 0;
47379
47563
  const isScript = parentTagName === "SCRIPT" ? true : void 0;
47380
47564
  const isTextarea = parentTagName === "TEXTAREA" ? true : void 0;
47381
47565
  if (isStyle && textContent2) {
47382
47566
  try {
47383
- if (n2.nextSibling || n2.previousSibling) {
47384
- } else if ((_a2 = n2.parentNode.sheet) == null ? void 0 : _a2.cssRules) {
47567
+ if (n.nextSibling || n.previousSibling) {
47568
+ } else if ((_a2 = n.parentNode.sheet) == null ? void 0 : _a2.cssRules) {
47385
47569
  textContent2 = stringifyStylesheet(
47386
- n2.parentNode.sheet
47570
+ n.parentNode.sheet
47387
47571
  );
47388
47572
  }
47389
47573
  } catch (err) {
47390
47574
  console.warn(
47391
47575
  `Cannot get CSS styles from text's parentNode. Error: ${err}`,
47392
- n2
47576
+ n
47393
47577
  );
47394
47578
  }
47395
47579
  textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
@@ -47397,24 +47581,24 @@ function serializeTextNode(n2, options) {
47397
47581
  if (isScript) {
47398
47582
  textContent2 = "SCRIPT_PLACEHOLDER";
47399
47583
  } else if (!cssCaptured) {
47400
- textContent2 = index$1.textContent(n2);
47584
+ textContent2 = index.textContent(n);
47401
47585
  if (isStyle && textContent2) {
47402
47586
  textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
47403
47587
  }
47404
47588
  }
47405
47589
  if (!isStyle && !isScript && textContent2 && needsMask) {
47406
- textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
47590
+ textContent2 = maskTextFn ? maskTextFn(textContent2, index.parentElement(n)) : textContent2.replace(/[\S]/g, "*");
47407
47591
  }
47408
47592
  if (isTextarea && textContent2 && maskInputOptions.textarea) {
47409
- textContent2 = maskInputFn ? maskInputFn(textContent2, n2.parentNode) : textContent2.replace(/[\S]/g, "*");
47593
+ textContent2 = maskInputFn ? maskInputFn(textContent2, n.parentNode) : textContent2.replace(/[\S]/g, "*");
47410
47594
  }
47411
47595
  return {
47412
- type: NodeType$3.Text,
47596
+ type: NodeType.Text,
47413
47597
  textContent: textContent2 || "",
47414
47598
  rootId
47415
47599
  };
47416
47600
  }
47417
- function serializeElementNode(n2, options) {
47601
+ function serializeElementNode(n, options) {
47418
47602
  const {
47419
47603
  doc,
47420
47604
  blockClass,
@@ -47431,13 +47615,13 @@ function serializeElementNode(n2, options) {
47431
47615
  rootId,
47432
47616
  needsMask
47433
47617
  } = options;
47434
- const needBlock = _isBlockedElement(n2, blockClass, blockSelector);
47435
- const needHide = needBlock && hideSelector ? _isBlockedElement(n2, "", hideSelector) : false;
47436
- const tagName = getValidTagName$1(n2);
47618
+ const needBlock = _isBlockedElement(n, blockClass, blockSelector);
47619
+ const needHide = needBlock && hideSelector ? _isBlockedElement(n, "", hideSelector) : false;
47620
+ const tagName = getValidTagName(n);
47437
47621
  let attributes = {};
47438
- const len = n2.attributes.length;
47439
- for (let i2 = 0; i2 < len; i2++) {
47440
- const attr = n2.attributes[i2];
47622
+ const len = n.attributes.length;
47623
+ for (let i = 0; i < len; i++) {
47624
+ const attr = n.attributes[i];
47441
47625
  if (!ignoreAttribute(tagName, attr.name, attr.value)) {
47442
47626
  attributes[attr.name] = transformAttribute(
47443
47627
  doc,
@@ -47448,8 +47632,8 @@ function serializeElementNode(n2, options) {
47448
47632
  }
47449
47633
  }
47450
47634
  if (tagName === "link" && inlineStylesheet) {
47451
- const stylesheet = Array.from(doc.styleSheets).find((s2) => {
47452
- return s2.href === n2.href;
47635
+ const stylesheet = Array.from(doc.styleSheets).find((s) => {
47636
+ return s.href === n.href;
47453
47637
  });
47454
47638
  let cssText = null;
47455
47639
  if (stylesheet) {
@@ -47461,24 +47645,24 @@ function serializeElementNode(n2, options) {
47461
47645
  attributes._cssText = cssText;
47462
47646
  }
47463
47647
  }
47464
- if (tagName === "style" && n2.sheet) {
47648
+ if (tagName === "style" && n.sheet) {
47465
47649
  let cssText = stringifyStylesheet(
47466
- n2.sheet
47650
+ n.sheet
47467
47651
  );
47468
47652
  if (cssText) {
47469
- if (n2.childNodes.length > 1) {
47470
- cssText = markCssSplits(cssText, n2);
47653
+ if (n.childNodes.length > 1) {
47654
+ cssText = markCssSplits(cssText, n);
47471
47655
  }
47472
47656
  attributes._cssText = cssText;
47473
47657
  }
47474
47658
  }
47475
- if (tagName === "input" || tagName === "textarea" || tagName === "select") {
47476
- const value = n2.value;
47477
- const checked = n2.checked;
47659
+ if (["input", "textarea", "select"].includes(tagName)) {
47660
+ const value = n.value;
47661
+ const checked = n.checked;
47478
47662
  if (attributes.type !== "radio" && attributes.type !== "checkbox" && attributes.type !== "submit" && attributes.type !== "button" && value) {
47479
47663
  attributes.value = maskInputValue({
47480
- element: n2,
47481
- type: getInputType(n2),
47664
+ element: n,
47665
+ type: getInputType(n),
47482
47666
  tagName,
47483
47667
  value,
47484
47668
  maskInputOptions,
@@ -47490,31 +47674,31 @@ function serializeElementNode(n2, options) {
47490
47674
  }
47491
47675
  }
47492
47676
  if (tagName === "option") {
47493
- if (n2.selected && !maskInputOptions["select"]) {
47677
+ if (n.selected && !maskInputOptions["select"]) {
47494
47678
  attributes.selected = true;
47495
47679
  } else {
47496
47680
  delete attributes.selected;
47497
47681
  }
47498
47682
  }
47499
- if (tagName === "dialog" && n2.open) {
47500
- attributes.rr_open_mode = n2.matches("dialog:modal") ? "modal" : "non-modal";
47683
+ if (tagName === "dialog" && n.open) {
47684
+ attributes.rr_open_mode = n.matches("dialog:modal") ? "modal" : "non-modal";
47501
47685
  }
47502
47686
  if (tagName === "canvas" && recordCanvas) {
47503
- if (n2.__context === "2d") {
47504
- if (!is2DCanvasBlank(n2)) {
47505
- attributes.rr_dataURL = n2.toDataURL(
47687
+ if (n.__context === "2d") {
47688
+ if (!is2DCanvasBlank(n)) {
47689
+ attributes.rr_dataURL = n.toDataURL(
47506
47690
  dataURLOptions.type,
47507
47691
  dataURLOptions.quality
47508
47692
  );
47509
47693
  }
47510
- } else if (!("__context" in n2)) {
47511
- const canvasDataURL = n2.toDataURL(
47694
+ } else if (!("__context" in n)) {
47695
+ const canvasDataURL = n.toDataURL(
47512
47696
  dataURLOptions.type,
47513
47697
  dataURLOptions.quality
47514
47698
  );
47515
47699
  const blankCanvas = doc.createElement("canvas");
47516
- blankCanvas.width = n2.width;
47517
- blankCanvas.height = n2.height;
47700
+ blankCanvas.width = n.width;
47701
+ blankCanvas.height = n.height;
47518
47702
  const blankCanvasDataURL = blankCanvas.toDataURL(
47519
47703
  dataURLOptions.type,
47520
47704
  dataURLOptions.quality
@@ -47529,7 +47713,7 @@ function serializeElementNode(n2, options) {
47529
47713
  canvasService = doc.createElement("canvas");
47530
47714
  canvasCtx = canvasService.getContext("2d");
47531
47715
  }
47532
- const image = n2;
47716
+ const image = n;
47533
47717
  const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
47534
47718
  const priorCrossOrigin = image.crossOrigin;
47535
47719
  const recordInlineImage = () => {
@@ -47562,21 +47746,21 @@ function serializeElementNode(n2, options) {
47562
47746
  if (image.complete && image.naturalWidth !== 0) recordInlineImage();
47563
47747
  else image.addEventListener("load", recordInlineImage);
47564
47748
  }
47565
- if (tagName === "audio" || tagName === "video") {
47749
+ if (["audio", "video"].includes(tagName)) {
47566
47750
  const mediaAttributes = attributes;
47567
- mediaAttributes.rr_mediaState = n2.paused ? "paused" : "played";
47568
- mediaAttributes.rr_mediaCurrentTime = n2.currentTime;
47569
- mediaAttributes.rr_mediaPlaybackRate = n2.playbackRate;
47570
- mediaAttributes.rr_mediaMuted = n2.muted;
47571
- mediaAttributes.rr_mediaLoop = n2.loop;
47572
- mediaAttributes.rr_mediaVolume = n2.volume;
47751
+ mediaAttributes.rr_mediaState = n.paused ? "paused" : "played";
47752
+ mediaAttributes.rr_mediaCurrentTime = n.currentTime;
47753
+ mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;
47754
+ mediaAttributes.rr_mediaMuted = n.muted;
47755
+ mediaAttributes.rr_mediaLoop = n.loop;
47756
+ mediaAttributes.rr_mediaVolume = n.volume;
47573
47757
  }
47574
47758
  if (!newlyAddedElement) {
47575
- if (n2.scrollLeft) {
47576
- attributes.rr_scrollLeft = n2.scrollLeft;
47759
+ if (n.scrollLeft) {
47760
+ attributes.rr_scrollLeft = n.scrollLeft;
47577
47761
  }
47578
- if (n2.scrollTop) {
47579
- attributes.rr_scrollTop = n2.scrollTop;
47762
+ if (n.scrollTop) {
47763
+ attributes.rr_scrollTop = n.scrollTop;
47580
47764
  }
47581
47765
  }
47582
47766
  if (needHide) {
@@ -47585,7 +47769,7 @@ function serializeElementNode(n2, options) {
47585
47769
  rr_display: "none"
47586
47770
  };
47587
47771
  } else if (needBlock) {
47588
- const { width, height } = n2.getBoundingClientRect();
47772
+ const { width, height } = n.getBoundingClientRect();
47589
47773
  attributes = {
47590
47774
  class: attributes.class,
47591
47775
  rr_width: `${width}px`,
@@ -47593,7 +47777,7 @@ function serializeElementNode(n2, options) {
47593
47777
  };
47594
47778
  }
47595
47779
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
47596
- if (!n2.contentDocument) {
47780
+ if (!n.contentDocument) {
47597
47781
  attributes.rr_src = attributes.src;
47598
47782
  }
47599
47783
  delete attributes.src;
@@ -47601,14 +47785,14 @@ function serializeElementNode(n2, options) {
47601
47785
  let isCustomElement;
47602
47786
  try {
47603
47787
  if (customElements.get(tagName)) isCustomElement = true;
47604
- } catch (e2) {
47788
+ } catch (e) {
47605
47789
  }
47606
47790
  return {
47607
- type: NodeType$3.Element,
47791
+ type: NodeType.Element,
47608
47792
  tagName,
47609
47793
  attributes,
47610
47794
  childNodes: [],
47611
- isSVG: isSVGElement(n2) || void 0,
47795
+ isSVG: isSVGElement(n) || void 0,
47612
47796
  needBlock,
47613
47797
  rootId,
47614
47798
  isCustom: isCustomElement
@@ -47621,10 +47805,32 @@ function lowerIfExists(maybeAttr) {
47621
47805
  return maybeAttr.toLowerCase();
47622
47806
  }
47623
47807
  }
47808
+ function slimDOMDefaults(_slimDOMOptions) {
47809
+ if (_slimDOMOptions === true || _slimDOMOptions === "all") {
47810
+ return {
47811
+ script: true,
47812
+ comment: true,
47813
+ headFavicon: true,
47814
+ headWhitespace: true,
47815
+ headMetaSocial: true,
47816
+ headMetaRobots: true,
47817
+ headMetaHttpEquiv: true,
47818
+ headMetaVerification: true,
47819
+ // the following are off for slimDOMOptions === true,
47820
+ // as they destroy some (hidden) info:
47821
+ headMetaAuthorship: _slimDOMOptions === "all",
47822
+ headMetaDescKeywords: _slimDOMOptions === "all",
47823
+ headTitleMutations: _slimDOMOptions === "all"
47824
+ };
47825
+ } else if (_slimDOMOptions) {
47826
+ return _slimDOMOptions;
47827
+ }
47828
+ return {};
47829
+ }
47624
47830
  function slimDOMExcluded(sn, slimDOMOptions) {
47625
- if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) {
47831
+ if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
47626
47832
  return true;
47627
- } else if (sn.type === NodeType$3.Element) {
47833
+ } else if (sn.type === NodeType.Element) {
47628
47834
  if (slimDOMOptions.script && // script tag
47629
47835
  (sn.tagName === "script" || // (module)preload link
47630
47836
  sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
@@ -47653,7 +47859,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
47653
47859
  }
47654
47860
  return false;
47655
47861
  }
47656
- function serializeNodeWithId(n2, options) {
47862
+ function serializeNodeWithId(n, options) {
47657
47863
  const {
47658
47864
  doc,
47659
47865
  mirror: mirror2,
@@ -47685,13 +47891,13 @@ function serializeNodeWithId(n2, options) {
47685
47891
  if (!needsMask) {
47686
47892
  const checkAncestors = needsMask === void 0;
47687
47893
  needsMask = needMaskingText(
47688
- n2,
47894
+ n,
47689
47895
  maskTextClass,
47690
47896
  maskTextSelector,
47691
47897
  checkAncestors
47692
47898
  );
47693
47899
  }
47694
- const _serializedNode = serializeNode(n2, {
47900
+ const _serializedNode = serializeNode(n, {
47695
47901
  doc,
47696
47902
  mirror: mirror2,
47697
47903
  blockClass,
@@ -47710,35 +47916,35 @@ function serializeNodeWithId(n2, options) {
47710
47916
  cssCaptured
47711
47917
  });
47712
47918
  if (!_serializedNode) {
47713
- console.warn(n2, "not serialized");
47919
+ console.warn(n, "not serialized");
47714
47920
  return null;
47715
47921
  }
47716
47922
  let id;
47717
- if (mirror2.hasNode(n2)) {
47718
- id = mirror2.getId(n2);
47719
- } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
47923
+ if (mirror2.hasNode(n)) {
47924
+ id = mirror2.getId(n);
47925
+ } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
47720
47926
  id = IGNORED_NODE;
47721
47927
  } else {
47722
47928
  id = genId();
47723
47929
  }
47724
47930
  const serializedNode = Object.assign(_serializedNode, { id });
47725
- mirror2.add(n2, serializedNode);
47931
+ mirror2.add(n, serializedNode);
47726
47932
  if (id === IGNORED_NODE) {
47727
47933
  return null;
47728
47934
  }
47729
47935
  if (onSerialize) {
47730
- onSerialize(n2);
47936
+ onSerialize(n);
47731
47937
  }
47732
47938
  let recordChild = !skipChild;
47733
- if (serializedNode.type === NodeType$3.Element) {
47939
+ if (serializedNode.type === NodeType.Element) {
47734
47940
  recordChild = recordChild && !serializedNode.needBlock;
47735
47941
  delete serializedNode.needBlock;
47736
- const shadowRootEl = index$1.shadowRoot(n2);
47942
+ const shadowRootEl = index.shadowRoot(n);
47737
47943
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
47738
47944
  serializedNode.isShadowHost = true;
47739
47945
  }
47740
- if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) {
47741
- if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") {
47946
+ if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {
47947
+ if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType.Element && serializedNode.tagName === "head") {
47742
47948
  preserveWhiteSpace = false;
47743
47949
  }
47744
47950
  const bypassOptions = {
@@ -47768,12 +47974,12 @@ function serializeNodeWithId(n2, options) {
47768
47974
  keepIframeSrcFn,
47769
47975
  cssCaptured: false
47770
47976
  };
47771
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
47977
+ if (serializedNode.type === NodeType.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
47772
47978
  else {
47773
- if (serializedNode.type === NodeType$3.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
47979
+ if (serializedNode.type === NodeType.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
47774
47980
  bypassOptions.cssCaptured = true;
47775
47981
  }
47776
- for (const childN of Array.from(index$1.childNodes(n2))) {
47982
+ for (const childN of Array.from(index.childNodes(n))) {
47777
47983
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
47778
47984
  if (serializedChildNode) {
47779
47985
  serializedNode.childNodes.push(serializedChildNode);
@@ -47781,8 +47987,8 @@ function serializeNodeWithId(n2, options) {
47781
47987
  }
47782
47988
  }
47783
47989
  let shadowRootEl = null;
47784
- if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {
47785
- for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {
47990
+ if (isElement(n) && (shadowRootEl = index.shadowRoot(n))) {
47991
+ for (const childN of Array.from(index.childNodes(shadowRootEl))) {
47786
47992
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
47787
47993
  if (serializedChildNode) {
47788
47994
  isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);
@@ -47791,15 +47997,15 @@ function serializeNodeWithId(n2, options) {
47791
47997
  }
47792
47998
  }
47793
47999
  }
47794
- const parent = index$1.parentNode(n2);
48000
+ const parent = index.parentNode(n);
47795
48001
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
47796
48002
  serializedNode.isShadow = true;
47797
48003
  }
47798
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
48004
+ if (serializedNode.type === NodeType.Element && serializedNode.tagName === "iframe") {
47799
48005
  onceIframeLoaded(
47800
- n2,
48006
+ n,
47801
48007
  () => {
47802
- const iframeDoc = n2.contentDocument;
48008
+ const iframeDoc = n.contentDocument;
47803
48009
  if (iframeDoc && onIframeLoad) {
47804
48010
  const serializedIframeNode = serializeNodeWithId(iframeDoc, {
47805
48011
  doc: iframeDoc,
@@ -47829,7 +48035,7 @@ function serializeNodeWithId(n2, options) {
47829
48035
  });
47830
48036
  if (serializedIframeNode) {
47831
48037
  onIframeLoad(
47832
- n2,
48038
+ n,
47833
48039
  serializedIframeNode
47834
48040
  );
47835
48041
  }
@@ -47838,12 +48044,12 @@ function serializeNodeWithId(n2, options) {
47838
48044
  iframeLoadTimeout
47839
48045
  );
47840
48046
  }
47841
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
48047
+ if (serializedNode.type === NodeType.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
47842
48048
  onceStylesheetLoaded(
47843
- n2,
48049
+ n,
47844
48050
  () => {
47845
48051
  if (onStylesheetLoad) {
47846
- const serializedLinkNode = serializeNodeWithId(n2, {
48052
+ const serializedLinkNode = serializeNodeWithId(n, {
47847
48053
  doc,
47848
48054
  mirror: mirror2,
47849
48055
  blockClass,
@@ -47871,7 +48077,7 @@ function serializeNodeWithId(n2, options) {
47871
48077
  });
47872
48078
  if (serializedLinkNode) {
47873
48079
  onStylesheetLoad(
47874
- n2,
48080
+ n,
47875
48081
  serializedLinkNode
47876
48082
  );
47877
48083
  }
@@ -47882,7 +48088,7 @@ function serializeNodeWithId(n2, options) {
47882
48088
  }
47883
48089
  return serializedNode;
47884
48090
  }
47885
- function snapshot(n2, options) {
48091
+ function snapshot(n, options) {
47886
48092
  const {
47887
48093
  mirror: mirror2 = new Mirror(),
47888
48094
  blockClass = "rr-block",
@@ -47905,7 +48111,7 @@ function snapshot(n2, options) {
47905
48111
  onStylesheetLoad,
47906
48112
  stylesheetLoadTimeout,
47907
48113
  keepIframeSrcFn = () => false
47908
- } = options || {};
48114
+ } = options;
47909
48115
  const maskInputOptions = maskAllInputs === true ? {
47910
48116
  color: true,
47911
48117
  date: true,
@@ -47926,24 +48132,9 @@ function snapshot(n2, options) {
47926
48132
  } : maskAllInputs === false ? {
47927
48133
  password: true
47928
48134
  } : maskAllInputs;
47929
- const slimDOMOptions = slimDOM === true || slimDOM === "all" ? (
47930
- // if true: set of sensible options that should not throw away any information
47931
- {
47932
- script: true,
47933
- comment: true,
47934
- headFavicon: true,
47935
- headWhitespace: true,
47936
- headMetaDescKeywords: slimDOM === "all",
47937
- // destructive
47938
- headMetaSocial: true,
47939
- headMetaRobots: true,
47940
- headMetaHttpEquiv: true,
47941
- headMetaAuthorship: true,
47942
- headMetaVerification: true
47943
- }
47944
- ) : slimDOM === false ? {} : slimDOM;
47945
- return serializeNodeWithId(n2, {
47946
- doc: n2,
48135
+ const slimDOMOptions = slimDOMDefaults(slimDOM);
48136
+ return serializeNodeWithId(n, {
48137
+ doc: n,
47947
48138
  mirror: mirror2,
47948
48139
  blockClass,
47949
48140
  blockSelector,
@@ -47969,37 +48160,22 @@ function snapshot(n2, options) {
47969
48160
  newlyAddedElement: false
47970
48161
  });
47971
48162
  }
47972
- var __defProp2 = Object.defineProperty;
47973
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47974
- var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
47975
- function getNative(symbolName, windowObj = window) {
47976
- var _a2, _b;
47977
- const windowWithZone = windowObj;
47978
- const angularZoneSymbol = (_b = (_a2 = windowWithZone == null ? void 0 : windowWithZone.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, symbolName);
47979
- if (angularZoneSymbol) {
47980
- const zonelessImpl = windowWithZone[angularZoneSymbol];
47981
- if (zonelessImpl) {
47982
- return zonelessImpl;
47983
- }
47984
- }
47985
- return windowWithZone[symbolName];
47986
- }
47987
- typeof window !== "undefined" ? getNative("setTimeout").bind(window) : global.setTimeout;
47988
48163
  class BaseRRNode {
47989
48164
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
47990
48165
  constructor(..._args) {
47991
- __publicField2(this, "parentElement", null);
47992
- __publicField2(this, "parentNode", null);
47993
- __publicField2(this, "ownerDocument");
47994
- __publicField2(this, "firstChild", null);
47995
- __publicField2(this, "lastChild", null);
47996
- __publicField2(this, "previousSibling", null);
47997
- __publicField2(this, "nextSibling", null);
47998
- __publicField2(this, "ELEMENT_NODE", 1);
47999
- __publicField2(this, "TEXT_NODE", 3);
48000
- __publicField2(this, "nodeType");
48001
- __publicField2(this, "nodeName");
48002
- __publicField2(this, "RRNodeType");
48166
+ __publicField(this, "parentElement", null);
48167
+ __publicField(this, "parentNode", null);
48168
+ __publicField(this, "ownerDocument");
48169
+ __publicField(this, "firstChild", null);
48170
+ __publicField(this, "lastChild", null);
48171
+ __publicField(this, "previousSibling", null);
48172
+ __publicField(this, "nextSibling", null);
48173
+ __publicField(this, "ELEMENT_NODE", 1);
48174
+ __publicField(this, "TEXT_NODE", 3);
48175
+ // corresponding nodeType value of standard HTML Node
48176
+ __publicField(this, "nodeType");
48177
+ __publicField(this, "nodeName");
48178
+ __publicField(this, "RRNodeType");
48003
48179
  }
48004
48180
  get childNodes() {
48005
48181
  const childNodes2 = [];
@@ -48042,226 +48218,6 @@ class BaseRRNode {
48042
48218
  return "RRNode";
48043
48219
  }
48044
48220
  }
48045
- const testableAccessors = {
48046
- Node: ["childNodes", "parentNode", "parentElement", "textContent"],
48047
- ShadowRoot: ["host", "styleSheets"],
48048
- Element: ["shadowRoot"],
48049
- MutationObserver: [],
48050
- EventTarget: []
48051
- };
48052
- const testableMethods = {
48053
- Node: ["contains", "getRootNode"],
48054
- ShadowRoot: ["getSelection"],
48055
- Element: ["querySelector", "querySelectorAll"],
48056
- MutationObserver: ["constructor"],
48057
- EventTarget: ["addEventListener", "removeEventListener"]
48058
- };
48059
- const untaintedBasePrototype = {};
48060
- function angularZoneUnpatchedAlternative(key) {
48061
- var _a2, _b;
48062
- const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
48063
- if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
48064
- return globalThis[angularUnpatchedVersionSymbol];
48065
- } else {
48066
- return void 0;
48067
- }
48068
- }
48069
- function getUntaintedPrototype(key) {
48070
- if (untaintedBasePrototype[key])
48071
- return untaintedBasePrototype[key];
48072
- const candidate = angularZoneUnpatchedAlternative(key) || globalThis[key];
48073
- const defaultPrototype = candidate.prototype;
48074
- const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;
48075
- const isUntaintedAccessors = Boolean(
48076
- accessorNames && // @ts-expect-error 2345
48077
- accessorNames.every(
48078
- (accessor) => {
48079
- var _a2, _b;
48080
- return Boolean(
48081
- (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes("[native code]")
48082
- );
48083
- }
48084
- )
48085
- );
48086
- const methodNames = key in testableMethods ? testableMethods[key] : void 0;
48087
- const isUntaintedMethods = Boolean(
48088
- methodNames && methodNames.every(
48089
- // @ts-expect-error 2345
48090
- (method) => {
48091
- var _a2;
48092
- return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));
48093
- }
48094
- )
48095
- );
48096
- if (isUntaintedAccessors && isUntaintedMethods) {
48097
- untaintedBasePrototype[key] = candidate.prototype;
48098
- return candidate.prototype;
48099
- }
48100
- try {
48101
- const iframeEl = document.createElement("iframe");
48102
- document.body.appendChild(iframeEl);
48103
- const win = iframeEl.contentWindow;
48104
- if (!win) return candidate.prototype;
48105
- const untaintedObject = win[key].prototype;
48106
- document.body.removeChild(iframeEl);
48107
- if (!untaintedObject) return defaultPrototype;
48108
- return untaintedBasePrototype[key] = untaintedObject;
48109
- } catch {
48110
- return defaultPrototype;
48111
- }
48112
- }
48113
- const untaintedAccessorCache = {};
48114
- function getUntaintedAccessor(key, instance, accessor) {
48115
- var _a2;
48116
- const cacheKey = `${key}.${String(accessor)}`;
48117
- if (untaintedAccessorCache[cacheKey])
48118
- return untaintedAccessorCache[cacheKey].call(
48119
- instance
48120
- );
48121
- const untaintedPrototype = getUntaintedPrototype(key);
48122
- const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
48123
- untaintedPrototype,
48124
- accessor
48125
- )) == null ? void 0 : _a2.get;
48126
- if (!untaintedAccessor) return instance[accessor];
48127
- untaintedAccessorCache[cacheKey] = untaintedAccessor;
48128
- return untaintedAccessor.call(instance);
48129
- }
48130
- const untaintedMethodCache = {};
48131
- function getUntaintedMethod(key, instance, method) {
48132
- var _a2, _b, _c;
48133
- const cacheKey = `${key}.${String(method)}`;
48134
- if (untaintedMethodCache[cacheKey])
48135
- return untaintedMethodCache[cacheKey].bind(
48136
- instance
48137
- );
48138
- const zoneSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(
48139
- _a2,
48140
- String(method)
48141
- );
48142
- if (zoneSymbol) {
48143
- const classProto = (_c = globalThis[key]) == null ? void 0 : _c.prototype;
48144
- const nativeFromZone = globalThis[zoneSymbol] ?? (classProto == null ? void 0 : classProto[zoneSymbol]);
48145
- if (typeof nativeFromZone === "function") {
48146
- untaintedMethodCache[cacheKey] = nativeFromZone;
48147
- return nativeFromZone.bind(
48148
- instance
48149
- );
48150
- }
48151
- }
48152
- const untaintedPrototype = getUntaintedPrototype(key);
48153
- const untaintedMethod = untaintedPrototype[method];
48154
- if (typeof untaintedMethod !== "function") return instance[method];
48155
- untaintedMethodCache[cacheKey] = untaintedMethod;
48156
- return untaintedMethod.bind(instance);
48157
- }
48158
- function childNodes(n2) {
48159
- return getUntaintedAccessor("Node", n2, "childNodes");
48160
- }
48161
- function parentNode(n2) {
48162
- return getUntaintedAccessor("Node", n2, "parentNode");
48163
- }
48164
- function parentElement(n2) {
48165
- return getUntaintedAccessor("Node", n2, "parentElement");
48166
- }
48167
- function textContent(n2) {
48168
- return getUntaintedAccessor("Node", n2, "textContent");
48169
- }
48170
- function contains(n2, other) {
48171
- return getUntaintedMethod("Node", n2, "contains")(other);
48172
- }
48173
- function getRootNode(n2) {
48174
- return getUntaintedMethod("Node", n2, "getRootNode")();
48175
- }
48176
- function host(n2) {
48177
- if (!n2 || !("host" in n2)) return null;
48178
- return getUntaintedAccessor("ShadowRoot", n2, "host");
48179
- }
48180
- function styleSheets(n2) {
48181
- return n2.styleSheets;
48182
- }
48183
- function shadowRoot(n2) {
48184
- if (!n2 || !("shadowRoot" in n2)) return null;
48185
- return getUntaintedAccessor("Element", n2, "shadowRoot");
48186
- }
48187
- function querySelector(n2, selectors) {
48188
- return getUntaintedMethod("Element", n2, "querySelector")(selectors);
48189
- }
48190
- function querySelectorAll(n2, selectors) {
48191
- return getUntaintedMethod("Element", n2, "querySelectorAll")(selectors);
48192
- }
48193
- function addEventListener(n2, type, listener, options) {
48194
- getUntaintedMethod("EventTarget", n2, "addEventListener")(type, listener, options);
48195
- }
48196
- function removeEventListener(n2, type, listener, options) {
48197
- getUntaintedMethod("EventTarget", n2, "removeEventListener")(
48198
- type,
48199
- listener,
48200
- options
48201
- );
48202
- }
48203
- function mutationObserverCtor() {
48204
- return getUntaintedPrototype("MutationObserver").constructor;
48205
- }
48206
- function getUntaintedProxy() {
48207
- var _a2, _b;
48208
- let Proxy3 = window.Proxy;
48209
- try {
48210
- if (typeof window.Proxy !== "function" || !((_a2 = window.Proxy) == null ? void 0 : _a2.toString().includes("[native code]"))) {
48211
- const cleanFrame = document.createElement("iframe");
48212
- cleanFrame.style.display = "none";
48213
- document.documentElement.appendChild(cleanFrame);
48214
- Proxy3 = ((_b = cleanFrame.contentWindow) == null ? void 0 : _b.Proxy) || window.Proxy;
48215
- document.documentElement.removeChild(cleanFrame);
48216
- }
48217
- } catch (err) {
48218
- console.debug("Unable to get untainted Proxy from iframe", err);
48219
- }
48220
- return Proxy3;
48221
- }
48222
- function patch(source, name, replacement) {
48223
- try {
48224
- if (!(name in source)) {
48225
- return () => {
48226
- };
48227
- }
48228
- const original = source[name];
48229
- const wrapped = replacement(original);
48230
- if (typeof wrapped === "function") {
48231
- wrapped.prototype = wrapped.prototype || {};
48232
- Object.defineProperties(wrapped, {
48233
- __rrweb_original__: {
48234
- enumerable: false,
48235
- value: original
48236
- }
48237
- });
48238
- }
48239
- source[name] = wrapped;
48240
- return () => {
48241
- source[name] = original;
48242
- };
48243
- } catch {
48244
- return () => {
48245
- };
48246
- }
48247
- }
48248
- const index = {
48249
- childNodes,
48250
- parentNode,
48251
- parentElement,
48252
- textContent,
48253
- contains,
48254
- getRootNode,
48255
- host,
48256
- styleSheets,
48257
- shadowRoot,
48258
- querySelector,
48259
- querySelectorAll,
48260
- addEventListener,
48261
- removeEventListener,
48262
- mutationObserver: mutationObserverCtor,
48263
- patch
48264
- };
48265
48221
  function on(type, fn, target = document) {
48266
48222
  const options = { capture: true, passive: true };
48267
48223
  index.addEventListener(target, type, fn, options);
@@ -48344,10 +48300,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
48344
48300
  );
48345
48301
  return () => hookSetter(target, key, original || {}, true);
48346
48302
  }
48347
- let nowTimestamp = Date.now;
48348
- if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
48349
- nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
48350
- }
48351
48303
  function getWindowScroll(win) {
48352
48304
  var _a2, _b, _c, _d;
48353
48305
  const doc = win.document;
@@ -48384,7 +48336,7 @@ function isBlocked(node, blockClass, blockSelector, checkAncestors) {
48384
48336
  } else {
48385
48337
  if (classMatchesRegex(el, blockClass, checkAncestors)) return true;
48386
48338
  }
48387
- } catch (e2) {
48339
+ } catch (e) {
48388
48340
  }
48389
48341
  if (blockSelector) {
48390
48342
  if (el.matches(blockSelector)) return true;
@@ -48392,14 +48344,14 @@ function isBlocked(node, blockClass, blockSelector, checkAncestors) {
48392
48344
  }
48393
48345
  return false;
48394
48346
  }
48395
- function isSerialized(n2, mirror2) {
48396
- return mirror2.getId(n2) !== -1;
48347
+ function isSerialized(n, mirror2) {
48348
+ return mirror2.getId(n) !== -1;
48397
48349
  }
48398
- function isIgnored(n2, mirror2, slimDOMOptions) {
48399
- if (n2.tagName === "TITLE" && slimDOMOptions.headTitleMutations) {
48350
+ function isIgnored(n, mirror2, slimDOMOptions) {
48351
+ if (n.tagName === "TITLE" && slimDOMOptions.headTitleMutations) {
48400
48352
  return true;
48401
48353
  }
48402
- return mirror2.getId(n2) === IGNORED_NODE;
48354
+ return mirror2.getId(n) === IGNORED_NODE;
48403
48355
  }
48404
48356
  function isAncestorRemoved(target, mirror2) {
48405
48357
  if (isShadowRoot(target)) {
@@ -48421,7 +48373,7 @@ function isAncestorRemoved(target, mirror2) {
48421
48373
  function legacy_isTouchEvent(event) {
48422
48374
  return Boolean(event.changedTouches);
48423
48375
  }
48424
- function polyfill$1(win = window) {
48376
+ function polyfill(win = window) {
48425
48377
  if ("NodeList" in win && !win.NodeList.prototype.forEach) {
48426
48378
  win.NodeList.prototype.forEach = Array.prototype.forEach;
48427
48379
  }
@@ -48429,20 +48381,20 @@ function polyfill$1(win = window) {
48429
48381
  win.DOMTokenList.prototype.forEach = Array.prototype.forEach;
48430
48382
  }
48431
48383
  }
48432
- function isSerializedIframe(n2, mirror2) {
48433
- return Boolean(n2.nodeName === "IFRAME" && mirror2.getMeta(n2));
48384
+ function isSerializedIframe(n, mirror2) {
48385
+ return Boolean(n.nodeName === "IFRAME" && mirror2.getMeta(n));
48434
48386
  }
48435
- function isSerializedStylesheet(n2, mirror2) {
48387
+ function isSerializedStylesheet(n, mirror2) {
48436
48388
  return Boolean(
48437
- n2.nodeName === "LINK" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute("rel") === "stylesheet" && mirror2.getMeta(n2)
48389
+ n.nodeName === "LINK" && n.nodeType === n.ELEMENT_NODE && n.getAttribute && n.getAttribute("rel") === "stylesheet" && mirror2.getMeta(n)
48438
48390
  );
48439
48391
  }
48440
- function hasShadowRoot(n2) {
48441
- if (!n2) return false;
48442
- if (n2 instanceof BaseRRNode && "shadowRoot" in n2) {
48443
- return Boolean(n2.shadowRoot);
48392
+ function hasShadowRoot(n) {
48393
+ if (!n) return false;
48394
+ if (n instanceof BaseRRNode && "shadowRoot" in n) {
48395
+ return Boolean(n.shadowRoot);
48444
48396
  }
48445
- return Boolean(index.shadowRoot(n2));
48397
+ return Boolean(index.shadowRoot(n));
48446
48398
  }
48447
48399
  class StyleSheetMirror {
48448
48400
  constructor() {
@@ -48481,206 +48433,30 @@ class StyleSheetMirror {
48481
48433
  return this.id++;
48482
48434
  }
48483
48435
  }
48484
- function getShadowHost(n2) {
48436
+ function getShadowHost(n) {
48485
48437
  var _a2;
48486
48438
  let shadowHost = null;
48487
- if ("getRootNode" in n2 && ((_a2 = index.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n2)))
48488
- shadowHost = index.host(index.getRootNode(n2));
48439
+ if ("getRootNode" in n && ((_a2 = index.getRootNode(n)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n)))
48440
+ shadowHost = index.host(index.getRootNode(n));
48489
48441
  return shadowHost;
48490
48442
  }
48491
- function getRootShadowHost(n2) {
48492
- let rootShadowHost = n2;
48443
+ function getRootShadowHost(n) {
48444
+ let rootShadowHost = n;
48493
48445
  let shadowHost;
48494
48446
  while (shadowHost = getShadowHost(rootShadowHost))
48495
48447
  rootShadowHost = shadowHost;
48496
48448
  return rootShadowHost;
48497
48449
  }
48498
- function shadowHostInDom(n2) {
48499
- const doc = n2.ownerDocument;
48450
+ function shadowHostInDom(n) {
48451
+ const doc = index.ownerDocument(n);
48500
48452
  if (!doc) return false;
48501
- const shadowHost = getRootShadowHost(n2);
48453
+ const shadowHost = getRootShadowHost(n);
48502
48454
  return index.contains(doc, shadowHost);
48503
48455
  }
48504
- function inDom(n2) {
48505
- const doc = n2.ownerDocument;
48456
+ function inDom(n) {
48457
+ const doc = index.ownerDocument(n);
48506
48458
  if (!doc) return false;
48507
- return index.contains(doc, n2) || shadowHostInDom(n2);
48508
- }
48509
- var EventType = /* @__PURE__ */ ((EventType2) => {
48510
- EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
48511
- EventType2[EventType2["Load"] = 1] = "Load";
48512
- EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
48513
- EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
48514
- EventType2[EventType2["Meta"] = 4] = "Meta";
48515
- EventType2[EventType2["Custom"] = 5] = "Custom";
48516
- EventType2[EventType2["Plugin"] = 6] = "Plugin";
48517
- return EventType2;
48518
- })(EventType || {});
48519
- var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
48520
- IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
48521
- IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
48522
- IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
48523
- IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
48524
- IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
48525
- IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
48526
- IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
48527
- IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
48528
- IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
48529
- IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
48530
- IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
48531
- IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
48532
- IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
48533
- IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
48534
- IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
48535
- IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
48536
- IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
48537
- return IncrementalSource2;
48538
- })(IncrementalSource || {});
48539
- var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
48540
- MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
48541
- MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
48542
- MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
48543
- MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
48544
- MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
48545
- MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
48546
- MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
48547
- MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
48548
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
48549
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
48550
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
48551
- return MouseInteractions2;
48552
- })(MouseInteractions || {});
48553
- var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
48554
- PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse";
48555
- PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen";
48556
- PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";
48557
- return PointerTypes2;
48558
- })(PointerTypes || {});
48559
- var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
48560
- CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
48561
- CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
48562
- CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
48563
- return CanvasContext2;
48564
- })(CanvasContext || {});
48565
- var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
48566
- MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";
48567
- MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";
48568
- MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";
48569
- MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";
48570
- MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
48571
- return MediaInteractions2;
48572
- })(MediaInteractions || {});
48573
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
48574
- NodeType2[NodeType2["Document"] = 0] = "Document";
48575
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
48576
- NodeType2[NodeType2["Element"] = 2] = "Element";
48577
- NodeType2[NodeType2["Text"] = 3] = "Text";
48578
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
48579
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
48580
- return NodeType2;
48581
- })(NodeType || {});
48582
- function isNodeInLinkedList(n2) {
48583
- return "__ln" in n2;
48584
- }
48585
- class DoubleLinkedList {
48586
- constructor() {
48587
- __publicField(this, "length", 0);
48588
- __publicField(this, "head", null);
48589
- __publicField(this, "tail", null);
48590
- __publicField(this, "reordered", false);
48591
- }
48592
- get(position) {
48593
- if (position >= this.length) {
48594
- throw new Error("Position outside of list range");
48595
- }
48596
- let current = this.head;
48597
- for (let index2 = 0; index2 < position; index2++) {
48598
- current = (current == null ? void 0 : current.next) || null;
48599
- }
48600
- return current;
48601
- }
48602
- addNode(n2) {
48603
- const node = {
48604
- value: n2,
48605
- previous: null,
48606
- next: null
48607
- };
48608
- n2.__ln = node;
48609
- if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {
48610
- const current = n2.previousSibling.__ln.next;
48611
- node.next = current;
48612
- node.previous = n2.previousSibling.__ln;
48613
- n2.previousSibling.__ln.next = node;
48614
- if (current) {
48615
- current.previous = node;
48616
- }
48617
- } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {
48618
- const current = n2.nextSibling.__ln.previous;
48619
- node.previous = current;
48620
- node.next = n2.nextSibling.__ln;
48621
- n2.nextSibling.__ln.previous = node;
48622
- if (current) {
48623
- current.next = node;
48624
- }
48625
- } else {
48626
- if (this.head) {
48627
- this.head.previous = node;
48628
- }
48629
- node.next = this.head;
48630
- this.head = node;
48631
- }
48632
- if (node.next === null) {
48633
- this.tail = node;
48634
- }
48635
- this.length++;
48636
- }
48637
- removeNode(n2) {
48638
- const current = n2.__ln;
48639
- if (!this.head) {
48640
- return;
48641
- }
48642
- if (!current.previous) {
48643
- this.head = current.next;
48644
- if (this.head) {
48645
- this.head.previous = null;
48646
- } else {
48647
- this.tail = null;
48648
- }
48649
- } else {
48650
- current.previous.next = current.next;
48651
- if (current.next) {
48652
- current.next.previous = current.previous;
48653
- } else {
48654
- this.tail = current.previous;
48655
- }
48656
- }
48657
- if (n2.__ln) {
48658
- delete n2.__ln;
48659
- }
48660
- this.length--;
48661
- }
48662
- needsReorder(_node) {
48663
- if (!this.reordered && _node.value.previousSibling && isNodeInLinkedList(_node.value.previousSibling) && _node.previous && _node.previous.value !== _node.value.previousSibling) {
48664
- return true;
48665
- }
48666
- return false;
48667
- }
48668
- reorder() {
48669
- if (this.reordered) return false;
48670
- let current = this.tail;
48671
- const head = this.head;
48672
- while (current) {
48673
- const prev = current.previous;
48674
- this.removeNode(current.value);
48675
- this.addNode(current.value);
48676
- if (current === head) {
48677
- break;
48678
- }
48679
- current = prev;
48680
- }
48681
- this.reordered = true;
48682
- return true;
48683
- }
48459
+ return index.contains(doc, n) || shadowHostInDom(n);
48684
48460
  }
48685
48461
  const moveKey = (id, parentId) => `${id}@${parentId}`;
48686
48462
  class MutationBuffer {
@@ -48693,6 +48469,23 @@ class MutationBuffer {
48693
48469
  __publicField(this, "removes", []);
48694
48470
  __publicField(this, "mapRemoves", []);
48695
48471
  __publicField(this, "movedMap", {});
48472
+ /**
48473
+ * the browser MutationObserver emits multiple mutations after
48474
+ * a delay for performance reasons, making tracing added nodes hard
48475
+ * in our `processMutations` callback function.
48476
+ * For example, if we append an element el_1 into body, and then append
48477
+ * another element el_2 into el_1, these two mutations may be passed to the
48478
+ * callback function together when the two operations were done.
48479
+ * Generally we need to trace child nodes of newly added nodes, but in this
48480
+ * case if we count el_2 as el_1's child node in the first mutation record,
48481
+ * then we will count el_2 again in the second mutation record which was
48482
+ * duplicated.
48483
+ * To avoid of duplicate counting added nodes, we use a Set to store
48484
+ * added nodes and its child nodes during iterate mutation records. Then
48485
+ * collect added nodes from the Set which have no duplicate copy. But
48486
+ * this also causes newly added nodes will not be serialized with id ASAP,
48487
+ * which means all the id related calculation should be lazy too.
48488
+ */
48696
48489
  __publicField(this, "addedSet", /* @__PURE__ */ new Set());
48697
48490
  __publicField(this, "movedSet", /* @__PURE__ */ new Set());
48698
48491
  __publicField(this, "droppedSet", /* @__PURE__ */ new Set());
@@ -48730,36 +48523,103 @@ class MutationBuffer {
48730
48523
  }
48731
48524
  const adds = [];
48732
48525
  const addedIds = /* @__PURE__ */ new Set();
48733
- const addList = new DoubleLinkedList();
48734
- const getNextId = (n2) => {
48735
- let ns = n2;
48736
- let nextId = IGNORED_NODE;
48737
- while (nextId === IGNORED_NODE) {
48738
- ns = ns && ns.nextSibling;
48739
- nextId = ns && this.mirror.getId(ns);
48526
+ while (this.mapRemoves.length) {
48527
+ this.mirror.removeNodeFromMap(this.mapRemoves.shift());
48528
+ }
48529
+ for (const n2 of this.movedSet) {
48530
+ const parentNode22 = index.parentNode(n2);
48531
+ if (this.removesSubTreeCache.has(parentNode22) && !this.movedSet.has(parentNode22)) {
48532
+ continue;
48740
48533
  }
48741
- return nextId;
48742
- };
48743
- const pushAdd = (n2) => {
48744
- const parent = index.parentNode(n2);
48745
- if (!parent || !inDom(n2)) {
48746
- return;
48534
+ this.addedSet.add(n2);
48535
+ }
48536
+ let n = null;
48537
+ let parentNode2 = null;
48538
+ let parentId = -1;
48539
+ let nextSibling2 = null;
48540
+ let ancestorBad = false;
48541
+ const missingParents = /* @__PURE__ */ new Set();
48542
+ const iter = this.addedSet.values();
48543
+ let curr = iter.next();
48544
+ while (this.addedSet.size) {
48545
+ if (n !== null && this.addedSet.has(index.previousSibling(n))) {
48546
+ nextSibling2 = n;
48547
+ n = index.previousSibling(n);
48548
+ } else {
48549
+ if (!this.addedSet.has(curr.value)) {
48550
+ curr = iter.next();
48551
+ }
48552
+ n = curr.value;
48553
+ while (true) {
48554
+ parentNode2 = index.parentNode(n);
48555
+ if (this.addedSet.has(parentNode2)) {
48556
+ n = parentNode2;
48557
+ continue;
48558
+ }
48559
+ break;
48560
+ }
48561
+ if (missingParents.has(parentNode2)) {
48562
+ parentNode2 = null;
48563
+ } else if (parentNode2) {
48564
+ if (!inDom(parentNode2)) {
48565
+ ancestorBad = true;
48566
+ } else {
48567
+ ancestorBad = isSelfOrAncestorInSet(this.droppedSet, parentNode2) || this.removesSubTreeCache.has(parentNode2);
48568
+ if (ancestorBad && isSelfOrAncestorInSet(this.movedSet, n)) {
48569
+ ancestorBad = false;
48570
+ }
48571
+ }
48572
+ if (this.addedSet.has(index.lastChild(parentNode2))) {
48573
+ n = index.lastChild(parentNode2);
48574
+ nextSibling2 = null;
48575
+ } else {
48576
+ while (true) {
48577
+ nextSibling2 = index.nextSibling(n);
48578
+ if (this.addedSet.has(nextSibling2)) {
48579
+ n = nextSibling2;
48580
+ continue;
48581
+ }
48582
+ break;
48583
+ }
48584
+ }
48585
+ parentId = isShadowRoot(parentNode2) ? this.mirror.getId(getShadowHost(n)) : this.mirror.getId(parentNode2);
48586
+ if (parentId === -1 && parentNode2.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
48587
+ const shadowHost = index.host(parentNode2);
48588
+ parentId = this.mirror.getId(shadowHost);
48589
+ }
48590
+ }
48591
+ }
48592
+ this.addedSet.delete(n);
48593
+ if (!parentNode2 || parentId === -1) {
48594
+ missingParents.add(n);
48595
+ continue;
48596
+ } else if (ancestorBad) {
48597
+ this.droppedSet.add(n);
48598
+ continue;
48747
48599
  }
48748
48600
  let cssCaptured = false;
48749
- if (n2.nodeType === Node.TEXT_NODE) {
48750
- const parentTag = parent.tagName;
48601
+ if (n.nodeType === Node.TEXT_NODE) {
48602
+ const parentTag = parentNode2.tagName;
48751
48603
  if (parentTag === "TEXTAREA") {
48752
- return;
48753
- } else if (parentTag === "STYLE" && this.addedSet.has(parent)) {
48604
+ continue;
48605
+ } else if (parentTag === "STYLE" && addedIds.has(parentId)) {
48754
48606
  cssCaptured = true;
48755
48607
  }
48756
48608
  }
48757
- const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);
48758
- const nextId = getNextId(n2);
48759
- if (parentId === -1 || nextId === -1) {
48760
- return addList.addNode(n2);
48609
+ let nextId = nextSibling2 ? this.mirror.getId(nextSibling2) : null;
48610
+ while (nextId === IGNORED_NODE) {
48611
+ nextSibling2 = nextSibling2 && index.nextSibling(nextSibling2);
48612
+ nextId = nextSibling2 && this.mirror.getId(nextSibling2);
48761
48613
  }
48762
- const sn = serializeNodeWithId(n2, {
48614
+ if (nextId === -1) {
48615
+ console.warn(
48616
+ "Couldn't record new node. Couldn't find mirror id for nextSibling:",
48617
+ nextSibling2
48618
+ );
48619
+ n = null;
48620
+ continue;
48621
+ }
48622
+ const sn = serializeNodeWithId(n, {
48763
48623
  doc: this.doc,
48764
48624
  mirror: this.mirror,
48765
48625
  blockClass: this.blockClass,
@@ -48786,8 +48646,11 @@ class MutationBuffer {
48786
48646
  currentN
48787
48647
  );
48788
48648
  }
48789
- if (hasShadowRoot(n2)) {
48790
- this.shadowDomManager.addShadowRoot(index.shadowRoot(n2), this.doc);
48649
+ if (hasShadowRoot(n)) {
48650
+ this.shadowDomManager.addShadowRoot(
48651
+ index.shadowRoot(n),
48652
+ this.doc
48653
+ );
48791
48654
  }
48792
48655
  },
48793
48656
  onIframeLoad: (iframe, childSn) => {
@@ -48807,76 +48670,6 @@ class MutationBuffer {
48807
48670
  });
48808
48671
  addedIds.add(sn.id);
48809
48672
  }
48810
- };
48811
- while (this.mapRemoves.length) {
48812
- this.mirror.removeNodeFromMap(this.mapRemoves.shift());
48813
- }
48814
- for (const n2 of this.movedSet) {
48815
- const parentNode2 = index.parentNode(n2);
48816
- if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(parentNode2) && !this.addedSet.has(parentNode2)) {
48817
- continue;
48818
- }
48819
- pushAdd(n2);
48820
- }
48821
- for (const n2 of this.addedSet) {
48822
- if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {
48823
- pushAdd(n2);
48824
- } else if (isAncestorInSet(this.movedSet, n2)) {
48825
- pushAdd(n2);
48826
- } else {
48827
- this.droppedSet.add(n2);
48828
- }
48829
- }
48830
- let candidate = null;
48831
- while (addList.length) {
48832
- let node = null;
48833
- if (candidate) {
48834
- const parentId = this.mirror.getId(index.parentNode(candidate.value));
48835
- const nextId = getNextId(candidate.value);
48836
- if (parentId !== -1 && nextId !== -1) {
48837
- node = candidate;
48838
- }
48839
- }
48840
- if (!node) {
48841
- let tailNode = addList.tail;
48842
- while (tailNode) {
48843
- const _node = tailNode;
48844
- tailNode = tailNode.previous;
48845
- if (_node) {
48846
- const parentId = this.mirror.getId(index.parentNode(_node.value));
48847
- const nextId = getNextId(_node.value);
48848
- if (nextId === -1) {
48849
- if (addList.needsReorder(_node) && addList.reorder()) {
48850
- tailNode = addList.tail;
48851
- }
48852
- continue;
48853
- } else if (parentId !== -1) {
48854
- node = _node;
48855
- break;
48856
- } else {
48857
- const unhandledNode = _node.value;
48858
- const parent = index.parentNode(unhandledNode);
48859
- if (parent && parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
48860
- const shadowHost = index.host(parent);
48861
- const parentId2 = this.mirror.getId(shadowHost);
48862
- if (parentId2 !== -1) {
48863
- node = _node;
48864
- break;
48865
- }
48866
- }
48867
- }
48868
- }
48869
- }
48870
- }
48871
- if (!node) {
48872
- while (addList.head) {
48873
- addList.removeNode(addList.head.value);
48874
- }
48875
- break;
48876
- }
48877
- candidate = node.previous;
48878
- addList.removeNode(node.value);
48879
- pushAdd(node.value);
48880
48673
  }
48881
48674
  const payload = {
48882
48675
  texts: this.texts.map((text) => {
@@ -48981,6 +48774,7 @@ class MutationBuffer {
48981
48774
  }
48982
48775
  case "attributes": {
48983
48776
  const target = m.target;
48777
+ const tagNameLower = toLowerCase(target.tagName);
48984
48778
  let attributeName = m.attributeName;
48985
48779
  let value = m.target.getAttribute(attributeName);
48986
48780
  if (attributeName === "value") {
@@ -49005,7 +48799,7 @@ class MutationBuffer {
49005
48799
  return;
49006
48800
  }
49007
48801
  let item = this.attributeMap.get(m.target);
49008
- if (target.tagName === "IFRAME" && attributeName === "src" && !this.keepIframeSrcFn(value)) {
48802
+ if (tagNameLower === "iframe" && attributeName === "src" && !this.keepIframeSrcFn(value)) {
49009
48803
  if (!target.contentDocument) {
49010
48804
  attributeName = "rr_src";
49011
48805
  } else {
@@ -49022,13 +48816,13 @@ class MutationBuffer {
49022
48816
  this.attributes.push(item);
49023
48817
  this.attributeMap.set(m.target, item);
49024
48818
  }
49025
- if (attributeName === "type" && target.tagName === "INPUT" && (m.oldValue || "").toLowerCase() === "password") {
48819
+ if (attributeName === "type" && tagNameLower === "input" && (m.oldValue || "").toLowerCase() === "password") {
49026
48820
  target.setAttribute("data-rr-is-password", "true");
49027
48821
  }
49028
- if (!ignoreAttribute(target.tagName, attributeName)) {
48822
+ if (!ignoreAttribute(tagNameLower, attributeName)) {
49029
48823
  item.attributes[attributeName] = transformAttribute(
49030
48824
  this.doc,
49031
- toLowerCase(target.tagName),
48825
+ tagNameLower,
49032
48826
  toLowerCase(attributeName),
49033
48827
  value
49034
48828
  );
@@ -49036,7 +48830,7 @@ class MutationBuffer {
49036
48830
  if (!this.unattachedDoc) {
49037
48831
  try {
49038
48832
  this.unattachedDoc = document.implementation.createHTMLDocument();
49039
- } catch (e2) {
48833
+ } catch (e) {
49040
48834
  this.unattachedDoc = this.doc;
49041
48835
  }
49042
48836
  }
@@ -49079,59 +48873,62 @@ class MutationBuffer {
49079
48873
  this.genTextAreaValueMutation(m.target);
49080
48874
  return;
49081
48875
  }
49082
- m.addedNodes.forEach((n2) => this.genAdds(n2, m.target));
49083
- m.removedNodes.forEach((n2) => {
49084
- const nodeId = this.mirror.getId(n2);
48876
+ m.addedNodes.forEach((n) => this.genAdds(n, m.target));
48877
+ m.removedNodes.forEach((n) => {
48878
+ const nodeId = this.mirror.getId(n);
49085
48879
  const parentId = isShadowRoot(m.target) ? this.mirror.getId(index.host(m.target)) : this.mirror.getId(m.target);
49086
- if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || isIgnored(n2, this.mirror, this.slimDOMOptions) || !isSerialized(n2, this.mirror)) {
48880
+ if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || isIgnored(n, this.mirror, this.slimDOMOptions) || !isSerialized(n, this.mirror)) {
49087
48881
  return;
49088
48882
  }
49089
- if (this.addedSet.has(n2)) {
49090
- deepDelete(this.addedSet, n2);
49091
- this.droppedSet.add(n2);
48883
+ if (this.addedSet.has(n)) {
48884
+ deepDelete(this.addedSet, n);
48885
+ this.droppedSet.add(n);
49092
48886
  } else if (this.addedSet.has(m.target) && nodeId === -1) ;
49093
48887
  else if (isAncestorRemoved(m.target, this.mirror)) ;
49094
- else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) {
49095
- deepDelete(this.movedSet, n2);
48888
+ else if (this.movedSet.has(n) && this.movedMap[moveKey(nodeId, parentId)]) {
48889
+ deepDelete(this.movedSet, n);
49096
48890
  } else {
49097
48891
  this.removes.push({
49098
48892
  parentId,
49099
48893
  id: nodeId,
49100
48894
  isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0
49101
48895
  });
49102
- processRemoves(n2, this.removesSubTreeCache);
48896
+ processRemoves(n, this.removesSubTreeCache);
49103
48897
  }
49104
- this.mapRemoves.push(n2);
48898
+ this.mapRemoves.push(n);
49105
48899
  });
49106
48900
  break;
49107
48901
  }
49108
48902
  }
49109
48903
  });
49110
- __publicField(this, "genAdds", (n2, target) => {
49111
- if (this.processedNodeManager.inOtherBuffer(n2, this)) return;
49112
- if (this.addedSet.has(n2) || this.movedSet.has(n2)) return;
49113
- if (this.mirror.hasNode(n2)) {
49114
- if (isIgnored(n2, this.mirror, this.slimDOMOptions)) {
48904
+ /**
48905
+ * Make sure you check if `n`'s parent is blocked before calling this function
48906
+ * */
48907
+ __publicField(this, "genAdds", (n, target) => {
48908
+ if (this.processedNodeManager.inOtherBuffer(n, this)) return;
48909
+ if (this.addedSet.has(n) || this.movedSet.has(n)) return;
48910
+ if (this.mirror.hasNode(n)) {
48911
+ if (isIgnored(n, this.mirror, this.slimDOMOptions)) {
49115
48912
  return;
49116
48913
  }
49117
- this.movedSet.add(n2);
48914
+ this.movedSet.add(n);
49118
48915
  let targetId = null;
49119
48916
  if (target && this.mirror.hasNode(target)) {
49120
48917
  targetId = this.mirror.getId(target);
49121
48918
  }
49122
48919
  if (targetId && targetId !== -1) {
49123
- this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true;
48920
+ this.movedMap[moveKey(this.mirror.getId(n), targetId)] = true;
49124
48921
  }
49125
48922
  } else {
49126
- this.addedSet.add(n2);
49127
- this.droppedSet.delete(n2);
48923
+ this.addedSet.add(n);
48924
+ this.droppedSet.delete(n);
49128
48925
  }
49129
- if (!isBlocked(n2, this.blockClass, this.blockSelector, false)) {
49130
- index.childNodes(n2).forEach((childN) => this.genAdds(childN));
49131
- if (hasShadowRoot(n2)) {
49132
- index.childNodes(index.shadowRoot(n2)).forEach((childN) => {
48926
+ if (!isBlocked(n, this.blockClass, this.blockSelector, false)) {
48927
+ index.childNodes(n).forEach((childN) => this.genAdds(childN));
48928
+ if (hasShadowRoot(n)) {
48929
+ index.childNodes(index.shadowRoot(n)).forEach((childN) => {
49133
48930
  this.processedNodeManager.add(childN, this);
49134
- this.genAdds(childN, n2);
48931
+ this.genAdds(childN, n);
49135
48932
  });
49136
48933
  }
49137
48934
  }
@@ -49191,42 +48988,33 @@ class MutationBuffer {
49191
48988
  this.canvasManager.reset();
49192
48989
  }
49193
48990
  }
49194
- function deepDelete(addsSet, n2) {
49195
- addsSet.delete(n2);
49196
- index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));
48991
+ function deepDelete(addsSet, n) {
48992
+ addsSet.delete(n);
48993
+ index.childNodes(n).forEach((childN) => deepDelete(addsSet, childN));
49197
48994
  }
49198
- function processRemoves(n2, cache) {
49199
- const queue = [n2];
48995
+ function processRemoves(n, cache) {
48996
+ const queue = [n];
49200
48997
  while (queue.length) {
49201
48998
  const next = queue.pop();
49202
48999
  if (cache.has(next)) continue;
49203
49000
  cache.add(next);
49204
- index.childNodes(next).forEach((n22) => queue.push(n22));
49001
+ index.childNodes(next).forEach((n2) => queue.push(n2));
49205
49002
  }
49206
49003
  return;
49207
49004
  }
49208
- function isParentRemoved(removes, n2, mirror2) {
49209
- if (removes.size === 0) return false;
49210
- return _isParentRemoved(removes, n2);
49211
- }
49212
- function _isParentRemoved(removes, n2, _mirror2) {
49213
- const node = index.parentNode(n2);
49214
- if (!node) return false;
49215
- return removes.has(node);
49216
- }
49217
- function isAncestorInSet(set, n2) {
49005
+ function isSelfOrAncestorInSet(set, n) {
49218
49006
  if (set.size === 0) return false;
49219
- return _isAncestorInSet(set, n2);
49007
+ return _isSelfOrAncestorInSet(set, n);
49220
49008
  }
49221
- function _isAncestorInSet(set, n2) {
49222
- const parent = index.parentNode(n2);
49009
+ function _isSelfOrAncestorInSet(set, n) {
49010
+ if (set.has(n)) {
49011
+ return true;
49012
+ }
49013
+ const parent = index.parentNode(n);
49223
49014
  if (!parent) {
49224
49015
  return false;
49225
49016
  }
49226
- if (set.has(parent)) {
49227
- return true;
49228
- }
49229
- return _isAncestorInSet(set, parent);
49017
+ return _isSelfOrAncestorInSet(set, parent);
49230
49018
  }
49231
49019
  let errorHandler;
49232
49020
  function registerErrorHandler(handler) {
@@ -49271,7 +49059,8 @@ function initMutationObserver(options, rootEl) {
49271
49059
  const mutationBuffer = new MutationBuffer();
49272
49060
  mutationBuffers.push(mutationBuffer);
49273
49061
  mutationBuffer.init(options);
49274
- const observer = new (mutationObserverCtor())(
49062
+ const [ObserverCtor, iframeCleanup] = mutationObserverCtor();
49063
+ const observer = new ObserverCtor(
49275
49064
  callbackWrapper(mutationBuffer.processMutations.bind(mutationBuffer))
49276
49065
  );
49277
49066
  observer.observe(rootEl, {
@@ -49282,7 +49071,7 @@ function initMutationObserver(options, rootEl) {
49282
49071
  childList: true,
49283
49072
  subtree: true
49284
49073
  });
49285
- return observer;
49074
+ return [observer, iframeCleanup];
49286
49075
  }
49287
49076
  function initMoveObserver({
49288
49077
  mousemoveCb,
@@ -49402,12 +49191,12 @@ function initMouseInteractionObserver({
49402
49191
  pointerType = currentPointerType;
49403
49192
  currentPointerType = null;
49404
49193
  }
49405
- const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;
49406
- if (!e2) {
49194
+ const e = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;
49195
+ if (!e) {
49407
49196
  return;
49408
49197
  }
49409
49198
  const id = mirror2.getId(target);
49410
- const { clientX, clientY } = e2;
49199
+ const { clientX, clientY } = e;
49411
49200
  callbackWrapper(mouseInteractionCb)({
49412
49201
  type: MouseInteractions[thisEventKey],
49413
49202
  id,
@@ -49501,11 +49290,11 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
49501
49290
  return on("resize", updateDimension, win);
49502
49291
  }
49503
49292
  function findAndRemoveIframeBuffer(iframeEl) {
49504
- for (let i2 = mutationBuffers.length - 1; i2 >= 0; i2--) {
49505
- const buf = mutationBuffers[i2];
49293
+ for (let i = mutationBuffers.length - 1; i >= 0; i--) {
49294
+ const buf = mutationBuffers[i];
49506
49295
  if (buf.bufferBelongsToIframe(iframeEl)) {
49507
49296
  buf.reset();
49508
- mutationBuffers.splice(i2, 1);
49297
+ mutationBuffers.splice(i, 1);
49509
49298
  }
49510
49299
  }
49511
49300
  }
@@ -49578,13 +49367,13 @@ function initInputObserver({
49578
49367
  });
49579
49368
  }
49580
49369
  }
49581
- function cbWithDedup(target, v2) {
49370
+ function cbWithDedup(target, v) {
49582
49371
  const lastInputValue = lastInputValueMap.get(target);
49583
- if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
49584
- lastInputValueMap.set(target, v2);
49372
+ if (!lastInputValue || lastInputValue.text !== v.text || lastInputValue.isChecked !== v.isChecked) {
49373
+ lastInputValueMap.set(target, v);
49585
49374
  const id = mirror2.getId(target);
49586
49375
  callbackWrapper(inputCb)({
49587
- ...v2,
49376
+ ...v,
49588
49377
  id
49589
49378
  });
49590
49379
  }
@@ -49641,15 +49430,15 @@ function getNestedCSSRulePositions(rule) {
49641
49430
  const positions = [];
49642
49431
  function recurse(childRule, pos) {
49643
49432
  if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) {
49644
- const rules2 = Array.from(
49433
+ const rules = Array.from(
49645
49434
  childRule.parentRule.cssRules
49646
49435
  );
49647
- const index2 = rules2.indexOf(childRule);
49436
+ const index2 = rules.indexOf(childRule);
49648
49437
  pos.unshift(index2);
49649
49438
  return recurse(childRule.parentRule, pos);
49650
49439
  } else if (childRule.parentStyleSheet) {
49651
- const rules2 = Array.from(childRule.parentStyleSheet.cssRules);
49652
- const index2 = rules2.indexOf(childRule);
49440
+ const rules = Array.from(childRule.parentStyleSheet.cssRules);
49441
+ const index2 = rules.indexOf(childRule);
49653
49442
  pos.unshift(index2);
49654
49443
  }
49655
49444
  return pos;
@@ -49888,7 +49677,7 @@ function initAdoptedStyleSheetObserver({
49888
49677
  if (hostId !== null && hostId !== -1) {
49889
49678
  try {
49890
49679
  stylesheetManager.adoptStyleSheets(sheets, hostId);
49891
- } catch (e2) {
49680
+ } catch (e) {
49892
49681
  }
49893
49682
  }
49894
49683
  return result;
@@ -50025,7 +49814,7 @@ function initFontObserver({ fontCb, doc }) {
50025
49814
  const handlers = [];
50026
49815
  const fontMap = /* @__PURE__ */ new WeakMap();
50027
49816
  const originalFontFace = win.FontFace;
50028
- win.FontFace = function FontFace2(family, source, descriptors) {
49817
+ win.FontFace = function FontFace(family, source, descriptors) {
50029
49818
  const fontFace = new originalFontFace(family, source, descriptors);
50030
49819
  fontMap.set(fontFace, {
50031
49820
  family,
@@ -50071,8 +49860,8 @@ function initSelectionObserver(param) {
50071
49860
  collapsed = selection.isCollapsed || false;
50072
49861
  const ranges = [];
50073
49862
  const count = selection.rangeCount || 0;
50074
- for (let i2 = 0; i2 < count; i2++) {
50075
- const range = selection.getRangeAt(i2);
49863
+ for (let i = 0; i < count; i++) {
49864
+ const range = selection.getRangeAt(i);
50076
49865
  const { startContainer, startOffset, endContainer, endOffset } = range;
50077
49866
  const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);
50078
49867
  if (blocked) continue;
@@ -50106,7 +49895,7 @@ function initCustomElementObserver({
50106
49895
  name
50107
49896
  }
50108
49897
  });
50109
- } catch (e2) {
49898
+ } catch (e) {
50110
49899
  console.warn(`Custom element callback failed for ${name}`);
50111
49900
  }
50112
49901
  return original.apply(this, [name, constructor, options]);
@@ -50115,7 +49904,7 @@ function initCustomElementObserver({
50115
49904
  );
50116
49905
  return restoreHandler;
50117
49906
  }
50118
- function mergeHooks(o2, hooks) {
49907
+ function mergeHooks(o, hooks) {
50119
49908
  const {
50120
49909
  mutationCb,
50121
49910
  mousemoveCb,
@@ -50130,105 +49919,107 @@ function mergeHooks(o2, hooks) {
50130
49919
  fontCb,
50131
49920
  selectionCb,
50132
49921
  customElementCb
50133
- } = o2;
50134
- o2.mutationCb = (...p) => {
49922
+ } = o;
49923
+ o.mutationCb = (...p) => {
50135
49924
  if (hooks.mutation) {
50136
49925
  hooks.mutation(...p);
50137
49926
  }
50138
49927
  mutationCb(...p);
50139
49928
  };
50140
- o2.mousemoveCb = (...p) => {
49929
+ o.mousemoveCb = (...p) => {
50141
49930
  if (hooks.mousemove) {
50142
49931
  hooks.mousemove(...p);
50143
49932
  }
50144
49933
  mousemoveCb(...p);
50145
49934
  };
50146
- o2.mouseInteractionCb = (...p) => {
49935
+ o.mouseInteractionCb = (...p) => {
50147
49936
  if (hooks.mouseInteraction) {
50148
49937
  hooks.mouseInteraction(...p);
50149
49938
  }
50150
49939
  mouseInteractionCb(...p);
50151
49940
  };
50152
- o2.scrollCb = (...p) => {
49941
+ o.scrollCb = (...p) => {
50153
49942
  if (hooks.scroll) {
50154
49943
  hooks.scroll(...p);
50155
49944
  }
50156
49945
  scrollCb(...p);
50157
49946
  };
50158
- o2.viewportResizeCb = (...p) => {
49947
+ o.viewportResizeCb = (...p) => {
50159
49948
  if (hooks.viewportResize) {
50160
49949
  hooks.viewportResize(...p);
50161
49950
  }
50162
49951
  viewportResizeCb(...p);
50163
49952
  };
50164
- o2.inputCb = (...p) => {
49953
+ o.inputCb = (...p) => {
50165
49954
  if (hooks.input) {
50166
49955
  hooks.input(...p);
50167
49956
  }
50168
49957
  inputCb(...p);
50169
49958
  };
50170
- o2.mediaInteractionCb = (...p) => {
49959
+ o.mediaInteractionCb = (...p) => {
50171
49960
  if (hooks.mediaInteaction) {
50172
49961
  hooks.mediaInteaction(...p);
50173
49962
  }
50174
49963
  mediaInteractionCb(...p);
50175
49964
  };
50176
- o2.styleSheetRuleCb = (...p) => {
49965
+ o.styleSheetRuleCb = (...p) => {
50177
49966
  if (hooks.styleSheetRule) {
50178
49967
  hooks.styleSheetRule(...p);
50179
49968
  }
50180
49969
  styleSheetRuleCb(...p);
50181
49970
  };
50182
- o2.styleDeclarationCb = (...p) => {
49971
+ o.styleDeclarationCb = (...p) => {
50183
49972
  if (hooks.styleDeclaration) {
50184
49973
  hooks.styleDeclaration(...p);
50185
49974
  }
50186
49975
  styleDeclarationCb(...p);
50187
49976
  };
50188
- o2.canvasMutationCb = (...p) => {
49977
+ o.canvasMutationCb = (...p) => {
50189
49978
  if (hooks.canvasMutation) {
50190
49979
  hooks.canvasMutation(...p);
50191
49980
  }
50192
49981
  canvasMutationCb(...p);
50193
49982
  };
50194
- o2.fontCb = (...p) => {
49983
+ o.fontCb = (...p) => {
50195
49984
  if (hooks.font) {
50196
49985
  hooks.font(...p);
50197
49986
  }
50198
49987
  fontCb(...p);
50199
49988
  };
50200
- o2.selectionCb = (...p) => {
49989
+ o.selectionCb = (...p) => {
50201
49990
  if (hooks.selection) {
50202
49991
  hooks.selection(...p);
50203
49992
  }
50204
49993
  selectionCb(...p);
50205
49994
  };
50206
- o2.customElementCb = (...c2) => {
49995
+ o.customElementCb = (...c) => {
50207
49996
  if (hooks.customElement) {
50208
- hooks.customElement(...c2);
49997
+ hooks.customElement(...c);
50209
49998
  }
50210
- customElementCb(...c2);
49999
+ customElementCb(...c);
50211
50000
  };
50212
50001
  }
50213
- function initObservers(o2, hooks = {}) {
50214
- const currentWindow = o2.doc.defaultView;
50002
+ function initObservers(o, hooks = {}) {
50003
+ const currentWindow = o.doc.defaultView;
50215
50004
  if (!currentWindow) {
50216
50005
  return () => {
50217
50006
  };
50218
50007
  }
50219
- mergeHooks(o2, hooks);
50008
+ mergeHooks(o, hooks);
50220
50009
  let mutationObserver;
50221
- if (o2.recordDOM) {
50222
- mutationObserver = initMutationObserver(o2, o2.doc);
50010
+ let cleanupMutationIframe = () => {
50011
+ };
50012
+ if (o.recordDOM) {
50013
+ [mutationObserver, cleanupMutationIframe] = initMutationObserver(o, o.doc);
50223
50014
  }
50224
- const mousemoveHandler = initMoveObserver(o2);
50225
- const mouseInteractionHandler = initMouseInteractionObserver(o2);
50226
- const scrollHandler = initScrollObserver(o2);
50227
- const viewportResizeHandler = initViewportResizeObserver(o2, {
50015
+ const mousemoveHandler = initMoveObserver(o);
50016
+ const mouseInteractionHandler = initMouseInteractionObserver(o);
50017
+ const scrollHandler = initScrollObserver(o);
50018
+ const viewportResizeHandler = initViewportResizeObserver(o, {
50228
50019
  win: currentWindow
50229
50020
  });
50230
- const inputHandler = initInputObserver(o2);
50231
- const mediaInteractionHandler = initMediaInteractionObserver(o2);
50021
+ const inputHandler = initInputObserver(o);
50022
+ const mediaInteractionHandler = initMediaInteractionObserver(o);
50232
50023
  let styleSheetObserver = () => {
50233
50024
  };
50234
50025
  let adoptedStyleSheetObserver = () => {
@@ -50237,20 +50028,20 @@ function initObservers(o2, hooks = {}) {
50237
50028
  };
50238
50029
  let fontObserver = () => {
50239
50030
  };
50240
- if (o2.recordDOM) {
50241
- styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow });
50242
- adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc);
50243
- styleDeclarationObserver = initStyleDeclarationObserver(o2, {
50031
+ if (o.recordDOM) {
50032
+ styleSheetObserver = initStyleSheetObserver(o, { win: currentWindow });
50033
+ adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o, o.doc);
50034
+ styleDeclarationObserver = initStyleDeclarationObserver(o, {
50244
50035
  win: currentWindow
50245
50036
  });
50246
- if (o2.collectFonts) {
50247
- fontObserver = initFontObserver(o2);
50037
+ if (o.collectFonts) {
50038
+ fontObserver = initFontObserver(o);
50248
50039
  }
50249
50040
  }
50250
- const selectionObserver = initSelectionObserver(o2);
50251
- const customElementObserver = initCustomElementObserver(o2);
50041
+ const selectionObserver = initSelectionObserver(o);
50042
+ const customElementObserver = initCustomElementObserver(o);
50252
50043
  const pluginHandlers = [];
50253
- for (const plugin of o2.plugins) {
50044
+ for (const plugin of o.plugins) {
50254
50045
  pluginHandlers.push(
50255
50046
  plugin.observer(plugin.callback, currentWindow, plugin.options)
50256
50047
  );
@@ -50258,6 +50049,7 @@ function initObservers(o2, hooks = {}) {
50258
50049
  return callbackWrapper(() => {
50259
50050
  mutationBuffers.forEach((b) => b.reset());
50260
50051
  mutationObserver == null ? void 0 : mutationObserver.disconnect();
50052
+ cleanupMutationIframe();
50261
50053
  mousemoveHandler();
50262
50054
  mouseInteractionHandler();
50263
50055
  scrollHandler();
@@ -50381,7 +50173,7 @@ class IframeManager {
50381
50173
  this.iframes.set(iframeEl, true);
50382
50174
  if (iframeEl.contentWindow)
50383
50175
  this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);
50384
- if (!iframeEl.contentDocument && iframeEl.contentWindow)
50176
+ if (this.recordCrossOriginIframes && !iframeEl.contentDocument && iframeEl.contentWindow)
50385
50177
  iframeEl.contentWindow.postMessage(
50386
50178
  {
50387
50179
  type: "rrweb",
@@ -50454,18 +50246,18 @@ class IframeManager {
50454
50246
  crossOriginMessageEvent.data.isCheckout
50455
50247
  );
50456
50248
  }
50457
- transformCrossOriginEvent(iframeEl, e2) {
50249
+ transformCrossOriginEvent(iframeEl, e) {
50458
50250
  var _a2;
50459
- switch (e2.type) {
50251
+ switch (e.type) {
50460
50252
  case EventType.FullSnapshot: {
50461
50253
  this.crossOriginIframeMirror.reset(iframeEl);
50462
50254
  this.crossOriginIframeStyleMirror.reset(iframeEl);
50463
- this.replaceIdOnNode(e2.data.node, iframeEl);
50464
- const rootId = e2.data.node.id;
50255
+ this.replaceIdOnNode(e.data.node, iframeEl);
50256
+ const rootId = e.data.node.id;
50465
50257
  this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
50466
- this.patchRootIdOnNode(e2.data.node, rootId);
50258
+ this.patchRootIdOnNode(e.data.node, rootId);
50467
50259
  return {
50468
- timestamp: e2.timestamp,
50260
+ timestamp: e.timestamp,
50469
50261
  type: EventType.IncrementalSnapshot,
50470
50262
  data: {
50471
50263
  source: IncrementalSource.Mutation,
@@ -50473,7 +50265,7 @@ class IframeManager {
50473
50265
  {
50474
50266
  parentId: this.mirror.getId(iframeEl),
50475
50267
  nextId: null,
50476
- node: e2.data.node
50268
+ node: e.data.node
50477
50269
  }
50478
50270
  ],
50479
50271
  removes: [],
@@ -50489,47 +50281,47 @@ class IframeManager {
50489
50281
  return false;
50490
50282
  }
50491
50283
  case EventType.Plugin: {
50492
- return e2;
50284
+ return e;
50493
50285
  }
50494
50286
  case EventType.Custom: {
50495
50287
  this.replaceIds(
50496
- e2.data.payload,
50288
+ e.data.payload,
50497
50289
  iframeEl,
50498
50290
  ["id", "parentId", "previousId", "nextId"]
50499
50291
  );
50500
- return e2;
50292
+ return e;
50501
50293
  }
50502
50294
  case EventType.IncrementalSnapshot: {
50503
- switch (e2.data.source) {
50295
+ switch (e.data.source) {
50504
50296
  case IncrementalSource.Mutation: {
50505
- e2.data.adds.forEach((n2) => {
50506
- this.replaceIds(n2, iframeEl, [
50297
+ e.data.adds.forEach((n) => {
50298
+ this.replaceIds(n, iframeEl, [
50507
50299
  "parentId",
50508
50300
  "nextId",
50509
50301
  "previousId"
50510
50302
  ]);
50511
- this.replaceIdOnNode(n2.node, iframeEl);
50303
+ this.replaceIdOnNode(n.node, iframeEl);
50512
50304
  const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);
50513
- rootId && this.patchRootIdOnNode(n2.node, rootId);
50305
+ rootId && this.patchRootIdOnNode(n.node, rootId);
50514
50306
  });
50515
- e2.data.removes.forEach((n2) => {
50516
- this.replaceIds(n2, iframeEl, ["parentId", "id"]);
50307
+ e.data.removes.forEach((n) => {
50308
+ this.replaceIds(n, iframeEl, ["parentId", "id"]);
50517
50309
  });
50518
- e2.data.attributes.forEach((n2) => {
50519
- this.replaceIds(n2, iframeEl, ["id"]);
50310
+ e.data.attributes.forEach((n) => {
50311
+ this.replaceIds(n, iframeEl, ["id"]);
50520
50312
  });
50521
- e2.data.texts.forEach((n2) => {
50522
- this.replaceIds(n2, iframeEl, ["id"]);
50313
+ e.data.texts.forEach((n) => {
50314
+ this.replaceIds(n, iframeEl, ["id"]);
50523
50315
  });
50524
- return e2;
50316
+ return e;
50525
50317
  }
50526
50318
  case IncrementalSource.Drag:
50527
50319
  case IncrementalSource.TouchMove:
50528
50320
  case IncrementalSource.MouseMove: {
50529
- e2.data.positions.forEach((p) => {
50321
+ e.data.positions.forEach((p) => {
50530
50322
  this.replaceIds(p, iframeEl, ["id"]);
50531
50323
  });
50532
- return e2;
50324
+ return e;
50533
50325
  }
50534
50326
  case IncrementalSource.ViewportResize: {
50535
50327
  return false;
@@ -50539,31 +50331,31 @@ class IframeManager {
50539
50331
  case IncrementalSource.Scroll:
50540
50332
  case IncrementalSource.CanvasMutation:
50541
50333
  case IncrementalSource.Input: {
50542
- this.replaceIds(e2.data, iframeEl, ["id"]);
50543
- return e2;
50334
+ this.replaceIds(e.data, iframeEl, ["id"]);
50335
+ return e;
50544
50336
  }
50545
50337
  case IncrementalSource.StyleSheetRule:
50546
50338
  case IncrementalSource.StyleDeclaration: {
50547
- this.replaceIds(e2.data, iframeEl, ["id"]);
50548
- this.replaceStyleIds(e2.data, iframeEl, ["styleId"]);
50549
- return e2;
50339
+ this.replaceIds(e.data, iframeEl, ["id"]);
50340
+ this.replaceStyleIds(e.data, iframeEl, ["styleId"]);
50341
+ return e;
50550
50342
  }
50551
50343
  case IncrementalSource.Font: {
50552
- return e2;
50344
+ return e;
50553
50345
  }
50554
50346
  case IncrementalSource.Selection: {
50555
- e2.data.ranges.forEach((range) => {
50347
+ e.data.ranges.forEach((range) => {
50556
50348
  this.replaceIds(range, iframeEl, ["start", "end"]);
50557
50349
  });
50558
- return e2;
50350
+ return e;
50559
50351
  }
50560
50352
  case IncrementalSource.AdoptedStyleSheet: {
50561
- this.replaceIds(e2.data, iframeEl, ["id"]);
50562
- this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]);
50563
- (_a2 = e2.data.styles) == null ? void 0 : _a2.forEach((style) => {
50353
+ this.replaceIds(e.data, iframeEl, ["id"]);
50354
+ this.replaceStyleIds(e.data, iframeEl, ["styleIds"]);
50355
+ (_a2 = e.data.styles) == null ? void 0 : _a2.forEach((style) => {
50564
50356
  this.replaceStyleIds(style, iframeEl, ["styleId"]);
50565
50357
  });
50566
- return e2;
50358
+ return e;
50567
50359
  }
50568
50360
  }
50569
50361
  }
@@ -50629,7 +50421,7 @@ class ShadowDomManager {
50629
50421
  if (!isNativeShadowDom(shadowRoot2)) return;
50630
50422
  if (this.shadowDoms.has(shadowRoot2)) return;
50631
50423
  this.shadowDoms.add(shadowRoot2);
50632
- const observer = initMutationObserver(
50424
+ const [observer] = initMutationObserver(
50633
50425
  {
50634
50426
  ...this.bypassOptions,
50635
50427
  doc,
@@ -50702,7 +50494,7 @@ class ShadowDomManager {
50702
50494
  this.restoreHandlers.forEach((handler) => {
50703
50495
  try {
50704
50496
  handler();
50705
- } catch (e2) {
50497
+ } catch (e) {
50706
50498
  }
50707
50499
  });
50708
50500
  this.restoreHandlers = [];
@@ -50711,16 +50503,16 @@ class ShadowDomManager {
50711
50503
  }
50712
50504
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
50713
50505
  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
50714
- for (var i$1 = 0; i$1 < chars.length; i$1++) {
50715
- lookup[chars.charCodeAt(i$1)] = i$1;
50506
+ for (var i = 0; i < chars.length; i++) {
50507
+ lookup[chars.charCodeAt(i)] = i;
50716
50508
  }
50717
50509
  var encode = function(arraybuffer) {
50718
- var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
50719
- for (i2 = 0; i2 < len; i2 += 3) {
50720
- base64 += chars[bytes[i2] >> 2];
50721
- base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
50722
- base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
50723
- base64 += chars[bytes[i2 + 2] & 63];
50510
+ var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";
50511
+ for (i = 0; i < len; i += 3) {
50512
+ base64 += chars[bytes[i] >> 2];
50513
+ base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];
50514
+ base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];
50515
+ base64 += chars[bytes[i + 2] & 63];
50724
50516
  }
50725
50517
  if (len % 3 === 2) {
50726
50518
  base64 = base64.substring(0, base64.length - 1) + "=";
@@ -50730,7 +50522,7 @@ var encode = function(arraybuffer) {
50730
50522
  return base64;
50731
50523
  };
50732
50524
  const canvasVarMap = /* @__PURE__ */ new Map();
50733
- function variableListFor$1(ctx, ctor) {
50525
+ function variableListFor(ctx, ctor) {
50734
50526
  let contextMap = canvasVarMap.get(ctx);
50735
50527
  if (!contextMap) {
50736
50528
  contextMap = /* @__PURE__ */ new Map();
@@ -50745,7 +50537,7 @@ const saveWebGLVar = (value, win, ctx) => {
50745
50537
  if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === "object"))
50746
50538
  return;
50747
50539
  const name = value.constructor.name;
50748
- const list = variableListFor$1(ctx, name);
50540
+ const list = variableListFor(ctx, name);
50749
50541
  let index2 = list.indexOf(value);
50750
50542
  if (index2 === -1) {
50751
50543
  index2 = list.length;
@@ -50878,11 +50670,11 @@ function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
50878
50670
  win.CanvasRenderingContext2D.prototype,
50879
50671
  prop,
50880
50672
  {
50881
- set(v2) {
50673
+ set(v) {
50882
50674
  cb(this.canvas, {
50883
50675
  type: CanvasContext["2D"],
50884
50676
  property: prop,
50885
- args: [v2],
50677
+ args: [v],
50886
50678
  setter: true
50887
50679
  });
50888
50680
  }
@@ -50976,11 +50768,11 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
50976
50768
  handlers.push(restoreHandler);
50977
50769
  } catch {
50978
50770
  const hookHandler = hookSetter(prototype, prop, {
50979
- set(v2) {
50771
+ set(v) {
50980
50772
  cb(this.canvas, {
50981
50773
  type,
50982
50774
  property: prop,
50983
- args: [v2],
50775
+ args: [v],
50984
50776
  setter: true
50985
50777
  });
50986
50778
  }
@@ -50992,16 +50784,18 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
50992
50784
  }
50993
50785
  function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
50994
50786
  const handlers = [];
50995
- handlers.push(
50996
- ...patchGLPrototype(
50997
- win.WebGLRenderingContext.prototype,
50998
- CanvasContext.WebGL,
50999
- cb,
51000
- blockClass,
51001
- blockSelector,
51002
- win
51003
- )
51004
- );
50787
+ if (typeof win.WebGLRenderingContext !== "undefined") {
50788
+ handlers.push(
50789
+ ...patchGLPrototype(
50790
+ win.WebGLRenderingContext.prototype,
50791
+ CanvasContext.WebGL,
50792
+ cb,
50793
+ blockClass,
50794
+ blockSelector,
50795
+ win
50796
+ )
50797
+ );
50798
+ }
51005
50799
  if (typeof win.WebGL2RenderingContext !== "undefined") {
51006
50800
  handlers.push(
51007
50801
  ...patchGLPrototype(
@@ -51083,11 +50877,11 @@ class CanvasManager {
51083
50877
  );
51084
50878
  const snapshotInProgressMap = /* @__PURE__ */ new Map();
51085
50879
  const worker = new WorkerWrapper();
51086
- worker.onmessage = (e2) => {
51087
- const { id } = e2.data;
50880
+ worker.onmessage = (e) => {
50881
+ const { id } = e.data;
51088
50882
  snapshotInProgressMap.set(id, false);
51089
- if (!("base64" in e2.data)) return;
51090
- const { base64, type, width, height } = e2.data;
50883
+ if (!("base64" in e.data)) return;
50884
+ const { base64, type, width, height } = e.data;
51091
50885
  this.mutationCb({
51092
50886
  id,
51093
50887
  type: CanvasContext["2D"],
@@ -51269,17 +51063,17 @@ class StylesheetManager {
51269
51063
  let styleId;
51270
51064
  if (!this.styleMirror.has(sheet)) {
51271
51065
  styleId = this.styleMirror.add(sheet);
51272
- const rules2 = [];
51273
- for (let i2 = 0; i2 < sheet.rules.length; ++i2) {
51274
- rules2.push({
51275
- rule: stringifyRule(sheet.rules[i2], sheet.href),
51276
- index: i2
51066
+ const rules = [];
51067
+ for (let i = 0; i < sheet.rules.length; ++i) {
51068
+ rules.push({
51069
+ rule: stringifyRule(sheet.rules[i], sheet.href),
51070
+ index: i
51277
51071
  });
51278
51072
  }
51279
51073
  styles.push({
51280
51074
  styleId,
51281
- rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({
51282
- rule: stringifyRule(r2, sheet.href),
51075
+ rules: Array.from(sheet.rules || CSSRule, (r, index2) => ({
51076
+ rule: stringifyRule(r, sheet.href),
51283
51077
  index: index2
51284
51078
  }))
51285
51079
  });
@@ -51320,7 +51114,7 @@ class ProcessedNodeManager {
51320
51114
  }
51321
51115
  }
51322
51116
  let wrappedEmit;
51323
- let takeFullSnapshot$1 = () => {
51117
+ let takeFullSnapshot = () => {
51324
51118
  };
51325
51119
  let canvasManager;
51326
51120
  let recording = false;
@@ -51334,7 +51128,7 @@ try {
51334
51128
  } catch (err) {
51335
51129
  console.debug("Unable to override Array.from", err);
51336
51130
  }
51337
- const mirror = createMirror$2();
51131
+ const mirror = createMirror();
51338
51132
  function record(options = {}) {
51339
51133
  const {
51340
51134
  emit,
@@ -51379,7 +51173,7 @@ function record(options = {}) {
51379
51173
  if (window.parent.document) {
51380
51174
  passEmitsToParent = false;
51381
51175
  }
51382
- } catch (e2) {
51176
+ } catch (e) {
51383
51177
  passEmitsToParent = true;
51384
51178
  }
51385
51179
  }
@@ -51412,66 +51206,52 @@ function record(options = {}) {
51412
51206
  select: true,
51413
51207
  password: true
51414
51208
  } : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };
51415
- const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? {
51416
- script: true,
51417
- comment: true,
51418
- headFavicon: true,
51419
- headWhitespace: true,
51420
- headMetaSocial: true,
51421
- headMetaRobots: true,
51422
- headMetaHttpEquiv: true,
51423
- headMetaVerification: true,
51424
- // the following are off for slimDOMOptions === true,
51425
- // as they destroy some (hidden) info:
51426
- headMetaAuthorship: _slimDOMOptions === "all",
51427
- headMetaDescKeywords: _slimDOMOptions === "all",
51428
- headTitleMutations: _slimDOMOptions === "all"
51429
- } : _slimDOMOptions ? _slimDOMOptions : {};
51430
- polyfill$1();
51209
+ const slimDOMOptions = slimDOMDefaults(_slimDOMOptions);
51210
+ polyfill();
51431
51211
  let lastFullSnapshotEvent;
51432
51212
  let incrementalSnapshotCount = 0;
51433
- const eventProcessor = (e2) => {
51213
+ const eventProcessor = (e) => {
51434
51214
  for (const plugin of plugins || []) {
51435
51215
  if (plugin.eventProcessor) {
51436
- e2 = plugin.eventProcessor(e2);
51216
+ e = plugin.eventProcessor(e);
51437
51217
  }
51438
51218
  }
51439
51219
  if (packFn && // Disable packing events which will be emitted to parent frames.
51440
51220
  !passEmitsToParent) {
51441
- e2 = packFn(e2);
51221
+ e = packFn(e);
51442
51222
  }
51443
- return e2;
51223
+ return e;
51444
51224
  };
51445
- wrappedEmit = (r2, isCheckout) => {
51225
+ wrappedEmit = (r, isCheckout) => {
51446
51226
  var _a2;
51447
- const e2 = r2;
51448
- e2.timestamp = nowTimestamp();
51449
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
51227
+ const e = r;
51228
+ e.timestamp = nowTimestamp();
51229
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e.type !== EventType.FullSnapshot && !(e.type === EventType.IncrementalSnapshot && e.data.source === IncrementalSource.Mutation)) {
51450
51230
  mutationBuffers.forEach((buf) => buf.unfreeze());
51451
51231
  }
51452
51232
  if (inEmittingFrame) {
51453
- emit == null ? void 0 : emit(eventProcessor(e2), isCheckout);
51233
+ emit == null ? void 0 : emit(eventProcessor(e), isCheckout);
51454
51234
  } else if (passEmitsToParent) {
51455
51235
  const message = {
51456
51236
  type: "rrweb",
51457
- event: eventProcessor(e2),
51237
+ event: eventProcessor(e),
51458
51238
  origin: window.location.origin,
51459
51239
  isCheckout
51460
51240
  };
51461
51241
  window.parent.postMessage(message, "*");
51462
51242
  }
51463
- if (e2.type === EventType.FullSnapshot) {
51464
- lastFullSnapshotEvent = e2;
51243
+ if (e.type === EventType.FullSnapshot) {
51244
+ lastFullSnapshotEvent = e;
51465
51245
  incrementalSnapshotCount = 0;
51466
- } else if (e2.type === EventType.IncrementalSnapshot) {
51467
- if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) {
51246
+ } else if (e.type === EventType.IncrementalSnapshot) {
51247
+ if (e.data.source === IncrementalSource.Mutation && e.data.isAttachIframe) {
51468
51248
  return;
51469
51249
  }
51470
51250
  incrementalSnapshotCount++;
51471
51251
  const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
51472
- const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
51252
+ const exceedTime = checkoutEveryNms && e.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
51473
51253
  if (exceedCount || exceedTime) {
51474
- takeFullSnapshot$1(true);
51254
+ takeFullSnapshot(true);
51475
51255
  }
51476
51256
  }
51477
51257
  };
@@ -51498,11 +51278,11 @@ function record(options = {}) {
51498
51278
  ...p
51499
51279
  }
51500
51280
  });
51501
- const wrappedAdoptedStyleSheetEmit = (a2) => wrappedEmit({
51281
+ const wrappedAdoptedStyleSheetEmit = (a) => wrappedEmit({
51502
51282
  type: EventType.IncrementalSnapshot,
51503
51283
  data: {
51504
51284
  source: IncrementalSource.AdoptedStyleSheet,
51505
- ...a2
51285
+ ...a
51506
51286
  }
51507
51287
  });
51508
51288
  const stylesheetManager = new StylesheetManager({
@@ -51515,7 +51295,7 @@ function record(options = {}) {
51515
51295
  stylesheetManager,
51516
51296
  recordCrossOriginIframes,
51517
51297
  wrappedEmit,
51518
- takeFullSnapshot: takeFullSnapshot$1
51298
+ takeFullSnapshot
51519
51299
  });
51520
51300
  for (const plugin of plugins || []) {
51521
51301
  if (plugin.getMirror)
@@ -51562,7 +51342,7 @@ function record(options = {}) {
51562
51342
  },
51563
51343
  mirror
51564
51344
  });
51565
- takeFullSnapshot$1 = (isCheckout = false) => {
51345
+ takeFullSnapshot = (isCheckout = false) => {
51566
51346
  if (!recordDOM) {
51567
51347
  return;
51568
51348
  }
@@ -51595,15 +51375,15 @@ function record(options = {}) {
51595
51375
  dataURLOptions,
51596
51376
  recordCanvas,
51597
51377
  inlineImages,
51598
- onSerialize: (n2) => {
51599
- if (isSerializedIframe(n2, mirror)) {
51600
- iframeManager.addIframe(n2);
51378
+ onSerialize: (n) => {
51379
+ if (isSerializedIframe(n, mirror)) {
51380
+ iframeManager.addIframe(n);
51601
51381
  }
51602
- if (isSerializedStylesheet(n2, mirror)) {
51603
- stylesheetManager.trackLinkElement(n2);
51382
+ if (isSerializedStylesheet(n, mirror)) {
51383
+ stylesheetManager.trackLinkElement(n);
51604
51384
  }
51605
- if (hasShadowRoot(n2)) {
51606
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
51385
+ if (hasShadowRoot(n)) {
51386
+ shadowDomManager.addShadowRoot(index.shadowRoot(n), document);
51607
51387
  }
51608
51388
  },
51609
51389
  onIframeLoad: (iframe, childSn) => {
@@ -51635,7 +51415,7 @@ function record(options = {}) {
51635
51415
  mirror.getId(document)
51636
51416
  );
51637
51417
  };
51638
- iframeManager.setTakeFullSnapshot(takeFullSnapshot$1);
51418
+ iframeManager.setTakeFullSnapshot(takeFullSnapshot);
51639
51419
  try {
51640
51420
  const handlers = [];
51641
51421
  const iframeHandlersMap = /* @__PURE__ */ new Map();
@@ -51666,11 +51446,11 @@ function record(options = {}) {
51666
51446
  ...d
51667
51447
  }
51668
51448
  }),
51669
- inputCb: (v2) => wrappedEmit({
51449
+ inputCb: (v) => wrappedEmit({
51670
51450
  type: EventType.IncrementalSnapshot,
51671
51451
  data: {
51672
51452
  source: IncrementalSource.Input,
51673
- ...v2
51453
+ ...v
51674
51454
  }
51675
51455
  }),
51676
51456
  mediaInteractionCb: (p) => wrappedEmit({
@@ -51680,18 +51460,18 @@ function record(options = {}) {
51680
51460
  ...p
51681
51461
  }
51682
51462
  }),
51683
- styleSheetRuleCb: (r2) => wrappedEmit({
51463
+ styleSheetRuleCb: (r) => wrappedEmit({
51684
51464
  type: EventType.IncrementalSnapshot,
51685
51465
  data: {
51686
51466
  source: IncrementalSource.StyleSheetRule,
51687
- ...r2
51467
+ ...r
51688
51468
  }
51689
51469
  }),
51690
- styleDeclarationCb: (r2) => wrappedEmit({
51470
+ styleDeclarationCb: (r) => wrappedEmit({
51691
51471
  type: EventType.IncrementalSnapshot,
51692
51472
  data: {
51693
51473
  source: IncrementalSource.StyleDeclaration,
51694
- ...r2
51474
+ ...r
51695
51475
  }
51696
51476
  }),
51697
51477
  canvasMutationCb: wrappedCanvasMutationEmit,
@@ -51711,12 +51491,12 @@ function record(options = {}) {
51711
51491
  }
51712
51492
  });
51713
51493
  },
51714
- customElementCb: (c2) => {
51494
+ customElementCb: (c) => {
51715
51495
  wrappedEmit({
51716
51496
  type: EventType.IncrementalSnapshot,
51717
51497
  data: {
51718
51498
  source: IncrementalSource.CustomElement,
51719
- ...c2
51499
+ ...c
51720
51500
  }
51721
51501
  });
51722
51502
  },
@@ -51779,11 +51559,11 @@ function record(options = {}) {
51779
51559
  findAndRemoveIframeBuffer(iframeEl);
51780
51560
  });
51781
51561
  const init = () => {
51782
- takeFullSnapshot$1();
51562
+ takeFullSnapshot();
51783
51563
  handlers.push(observe(document));
51784
51564
  recording = true;
51785
51565
  };
51786
- if (document.readyState === "interactive" || document.readyState === "complete") {
51566
+ if (["interactive", "complete"].includes(document.readyState)) {
51787
51567
  init();
51788
51568
  } else {
51789
51569
  handlers.push(
@@ -51810,7 +51590,16 @@ function record(options = {}) {
51810
51590
  );
51811
51591
  }
51812
51592
  return () => {
51813
- handlers.forEach((h) => h());
51593
+ handlers.forEach((handler) => {
51594
+ try {
51595
+ handler();
51596
+ } catch (error) {
51597
+ const msg = String(error).toLowerCase();
51598
+ if (!msg.includes("cross-origin")) {
51599
+ console.warn(error);
51600
+ }
51601
+ }
51602
+ });
51814
51603
  iframeHandlersMap.forEach((h) => h());
51815
51604
  processedNodeManager.destroy();
51816
51605
  recording = false;
@@ -51839,13 +51628,9 @@ record.takeFullSnapshot = (isCheckout) => {
51839
51628
  if (!recording) {
51840
51629
  throw new Error("please take full snapshot after start recording");
51841
51630
  }
51842
- takeFullSnapshot$1(isCheckout);
51631
+ takeFullSnapshot(isCheckout);
51843
51632
  };
51844
51633
  record.mirror = mirror;
51845
- var n;
51846
- !function(t2) {
51847
- t2[t2.NotStarted = 0] = "NotStarted", t2[t2.Running = 1] = "Running", t2[t2.Stopped = 2] = "Stopped";
51848
- }(n || (n = {}));
51849
51634
  return record; }
51850
51635
 
51851
51636
  class SessionRecorderBuffer {
@@ -52613,7 +52398,7 @@ class SessionRecorder {
52613
52398
  this.stop();
52614
52399
  }
52615
52400
  if (visitorConfig && visitorConfig.enable && this.isRecording()) {
52616
- this.liveReplayClient.onLiveFlag(visitorConfig.live, this.visitorId, () => this.snapshot());
52401
+ this.liveReplayClient.onLiveFlag(visitorConfig.live, this.visitorId, () => this._snapshotForLiveReplay());
52617
52402
  if (continuationCallback) {
52618
52403
  continuationCallback.call(this);
52619
52404
  }
@@ -52635,6 +52420,11 @@ class SessionRecorder {
52635
52420
  this.send();
52636
52421
  this.record.takeFullSnapshot();
52637
52422
  }
52423
+ _snapshotForLiveReplay() {
52424
+ if (!this._recordsInThisFrame())
52425
+ return;
52426
+ this.snapshot();
52427
+ }
52638
52428
  isRecording() {
52639
52429
  return this.interval != null;
52640
52430
  }
@@ -52671,7 +52461,7 @@ class SessionRecorder {
52671
52461
  blockSelector: blockedSelectors.concat(hiddenSelectors).join(','),
52672
52462
  hideSelector: hiddenSelectors.join(','),
52673
52463
  recordCrossOriginIframes: recordCrossOriginIframes != null ? recordCrossOriginIframes : true,
52674
- emitFromIframe: !!this.api.ConfigReader.get(RECORDING_CONFIG_TREAT_IFRAME_AS_ROOT)
52464
+ emitFromIframe: this._treatIframeAsRoot()
52675
52465
  };
52676
52466
  return config;
52677
52467
  }
@@ -52775,7 +52565,7 @@ class SessionRecorder {
52775
52565
  errorHandler: this.errorHandler
52776
52566
  }, config));
52777
52567
  this._refreshIds();
52778
- this.liveReplayClient.onLiveFlag(visitorConfig.live, this.visitorId, () => this.snapshot());
52568
+ this.liveReplayClient.onLiveFlag(visitorConfig.live, this.visitorId, () => this._snapshotForLiveReplay());
52779
52569
  this.onRecordingStart();
52780
52570
  }
52781
52571
  catch (e) {
@@ -52793,6 +52583,21 @@ class SessionRecorder {
52793
52583
  topId: this.api.store.state.frames.topId
52794
52584
  });
52795
52585
  }
52586
+ _recordsInThisFrame() {
52587
+ if (window == window.top || this._treatIframeAsRoot())
52588
+ return true;
52589
+ if (!this.recordingConfig(this.visitorConfig).recordCrossOriginIframes)
52590
+ return true;
52591
+ try {
52592
+ return !window.parent.document;
52593
+ }
52594
+ catch (e) {
52595
+ return true;
52596
+ }
52597
+ }
52598
+ _treatIframeAsRoot() {
52599
+ return !!this.api.ConfigReader.get(RECORDING_CONFIG_TREAT_IFRAME_AS_ROOT);
52600
+ }
52796
52601
  _refreshIds() {
52797
52602
  if (window == window.top)
52798
52603
  return;
@@ -53045,7 +52850,7 @@ class SessionRecorder {
53045
52850
  // ignore stale responses from a since-changed identity
53046
52851
  if (messageData.visitorId !== this.visitorId)
53047
52852
  break;
53048
- this.liveReplayClient.onLiveFlag(messageData.live, this.visitorId, () => this.snapshot());
52853
+ this.liveReplayClient.onLiveFlag(messageData.live, this.visitorId, () => this._snapshotForLiveReplay());
53049
52854
  break;
53050
52855
  }
53051
52856
  }