@posthog/rrweb 0.0.37 → 0.0.39

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.
@@ -48,20 +48,20 @@ var NodeType$1$1 = /* @__PURE__ */ ((NodeType2) => {
48
48
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
49
49
  return NodeType2;
50
50
  })(NodeType$1$1 || {});
51
- const testableAccessors$1 = {
51
+ const testableAccessors$2 = {
52
52
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
53
53
  ShadowRoot: ["host", "styleSheets"],
54
54
  Element: ["shadowRoot", "querySelector", "querySelectorAll"],
55
55
  MutationObserver: []
56
56
  };
57
- const testableMethods$1 = {
57
+ const testableMethods$2 = {
58
58
  Node: ["contains", "getRootNode"],
59
59
  ShadowRoot: ["getSelection"],
60
60
  Element: [],
61
61
  MutationObserver: ["constructor"]
62
62
  };
63
- const untaintedBasePrototype$1 = {};
64
- function angularZoneUnpatchedAlternative$1(key) {
63
+ const untaintedBasePrototype$2 = {};
64
+ function angularZoneUnpatchedAlternative$2(key) {
65
65
  var _a2, _b;
66
66
  const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
67
67
  if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
@@ -70,12 +70,12 @@ function angularZoneUnpatchedAlternative$1(key) {
70
70
  return void 0;
71
71
  }
72
72
  }
73
- function getUntaintedPrototype$1(key) {
74
- if (untaintedBasePrototype$1[key])
75
- return untaintedBasePrototype$1[key];
76
- const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
73
+ function getUntaintedPrototype$2(key) {
74
+ if (untaintedBasePrototype$2[key])
75
+ return untaintedBasePrototype$2[key];
76
+ const candidate = angularZoneUnpatchedAlternative$2(key) || globalThis[key];
77
77
  const defaultPrototype = candidate.prototype;
78
- const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
78
+ const accessorNames = key in testableAccessors$2 ? testableAccessors$2[key] : void 0;
79
79
  const isUntaintedAccessors = Boolean(
80
80
  accessorNames && // @ts-expect-error 2345
81
81
  accessorNames.every(
@@ -87,7 +87,7 @@ function getUntaintedPrototype$1(key) {
87
87
  }
88
88
  )
89
89
  );
90
- const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
90
+ const methodNames = key in testableMethods$2 ? testableMethods$2[key] : void 0;
91
91
  const isUntaintedMethods = Boolean(
92
92
  methodNames && methodNames.every(
93
93
  // @ts-expect-error 2345
@@ -98,7 +98,7 @@ function getUntaintedPrototype$1(key) {
98
98
  )
99
99
  );
100
100
  if (isUntaintedAccessors && isUntaintedMethods) {
101
- untaintedBasePrototype$1[key] = candidate.prototype;
101
+ untaintedBasePrototype$2[key] = candidate.prototype;
102
102
  return candidate.prototype;
103
103
  }
104
104
  try {
@@ -109,80 +109,80 @@ function getUntaintedPrototype$1(key) {
109
109
  const untaintedObject = win[key].prototype;
110
110
  document.body.removeChild(iframeEl);
111
111
  if (!untaintedObject) return defaultPrototype;
112
- return untaintedBasePrototype$1[key] = untaintedObject;
112
+ return untaintedBasePrototype$2[key] = untaintedObject;
113
113
  } catch (e2) {
114
114
  return defaultPrototype;
115
115
  }
116
116
  }
117
- const untaintedAccessorCache$1 = {};
118
- function getUntaintedAccessor$1(key, instance, accessor) {
117
+ const untaintedAccessorCache$2 = {};
118
+ function getUntaintedAccessor$2(key, instance, accessor) {
119
119
  var _a2;
120
120
  const cacheKey = `${key}.${String(accessor)}`;
121
- if (untaintedAccessorCache$1[cacheKey])
122
- return untaintedAccessorCache$1[cacheKey].call(
121
+ if (untaintedAccessorCache$2[cacheKey])
122
+ return untaintedAccessorCache$2[cacheKey].call(
123
123
  instance
124
124
  );
125
- const untaintedPrototype = getUntaintedPrototype$1(key);
125
+ const untaintedPrototype = getUntaintedPrototype$2(key);
126
126
  const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
127
127
  untaintedPrototype,
128
128
  accessor
129
129
  )) == null ? void 0 : _a2.get;
130
130
  if (!untaintedAccessor) return instance[accessor];
131
- untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
131
+ untaintedAccessorCache$2[cacheKey] = untaintedAccessor;
132
132
  return untaintedAccessor.call(instance);
133
133
  }
134
- const untaintedMethodCache$1 = {};
135
- function getUntaintedMethod$1(key, instance, method) {
134
+ const untaintedMethodCache$2 = {};
135
+ function getUntaintedMethod$2(key, instance, method) {
136
136
  const cacheKey = `${key}.${String(method)}`;
137
- if (untaintedMethodCache$1[cacheKey])
138
- return untaintedMethodCache$1[cacheKey].bind(
137
+ if (untaintedMethodCache$2[cacheKey])
138
+ return untaintedMethodCache$2[cacheKey].bind(
139
139
  instance
140
140
  );
141
- const untaintedPrototype = getUntaintedPrototype$1(key);
141
+ const untaintedPrototype = getUntaintedPrototype$2(key);
142
142
  const untaintedMethod = untaintedPrototype[method];
143
143
  if (typeof untaintedMethod !== "function") return instance[method];
144
- untaintedMethodCache$1[cacheKey] = untaintedMethod;
144
+ untaintedMethodCache$2[cacheKey] = untaintedMethod;
145
145
  return untaintedMethod.bind(instance);
146
146
  }
147
- function childNodes$1(n2) {
148
- return getUntaintedAccessor$1("Node", n2, "childNodes");
147
+ function childNodes$2(n2) {
148
+ return getUntaintedAccessor$2("Node", n2, "childNodes");
149
149
  }
150
- function parentNode$1(n2) {
151
- return getUntaintedAccessor$1("Node", n2, "parentNode");
150
+ function parentNode$2(n2) {
151
+ return getUntaintedAccessor$2("Node", n2, "parentNode");
152
152
  }
153
- function parentElement$1(n2) {
154
- return getUntaintedAccessor$1("Node", n2, "parentElement");
153
+ function parentElement$2(n2) {
154
+ return getUntaintedAccessor$2("Node", n2, "parentElement");
155
155
  }
156
- function textContent$1(n2) {
157
- return getUntaintedAccessor$1("Node", n2, "textContent");
156
+ function textContent$2(n2) {
157
+ return getUntaintedAccessor$2("Node", n2, "textContent");
158
158
  }
159
- function contains$1(n2, other) {
160
- return getUntaintedMethod$1("Node", n2, "contains")(other);
159
+ function contains$2(n2, other) {
160
+ return getUntaintedMethod$2("Node", n2, "contains")(other);
161
161
  }
162
- function getRootNode$1(n2) {
163
- return getUntaintedMethod$1("Node", n2, "getRootNode")();
162
+ function getRootNode$2(n2) {
163
+ return getUntaintedMethod$2("Node", n2, "getRootNode")();
164
164
  }
165
- function host$1(n2) {
165
+ function host$2(n2) {
166
166
  if (!n2 || !("host" in n2)) return null;
167
- return getUntaintedAccessor$1("ShadowRoot", n2, "host");
167
+ return getUntaintedAccessor$2("ShadowRoot", n2, "host");
168
168
  }
169
- function styleSheets$1(n2) {
169
+ function styleSheets$2(n2) {
170
170
  return n2.styleSheets;
171
171
  }
172
- function shadowRoot$1(n2) {
172
+ function shadowRoot$2(n2) {
173
173
  if (!n2 || !("shadowRoot" in n2)) return null;
174
- return getUntaintedAccessor$1("Element", n2, "shadowRoot");
174
+ return getUntaintedAccessor$2("Element", n2, "shadowRoot");
175
175
  }
176
- function querySelector$1(n2, selectors) {
177
- return getUntaintedAccessor$1("Element", n2, "querySelector")(selectors);
176
+ function querySelector$2(n2, selectors) {
177
+ return getUntaintedAccessor$2("Element", n2, "querySelector")(selectors);
178
178
  }
179
- function querySelectorAll$1(n2, selectors) {
180
- return getUntaintedAccessor$1("Element", n2, "querySelectorAll")(selectors);
179
+ function querySelectorAll$2(n2, selectors) {
180
+ return getUntaintedAccessor$2("Element", n2, "querySelectorAll")(selectors);
181
181
  }
182
- function mutationObserverCtor$1() {
183
- return getUntaintedPrototype$1("MutationObserver").constructor;
182
+ function mutationObserverCtor$2() {
183
+ return getUntaintedPrototype$2("MutationObserver").constructor;
184
184
  }
185
- function patch$1(source, name, replacement) {
185
+ function patch$2(source, name, replacement) {
186
186
  try {
187
187
  if (!(name in source)) {
188
188
  return () => {
@@ -208,32 +208,32 @@ function patch$1(source, name, replacement) {
208
208
  };
209
209
  }
210
210
  }
211
- const index$1 = {
212
- childNodes: childNodes$1,
213
- parentNode: parentNode$1,
214
- parentElement: parentElement$1,
215
- textContent: textContent$1,
216
- contains: contains$1,
217
- getRootNode: getRootNode$1,
218
- host: host$1,
219
- styleSheets: styleSheets$1,
220
- shadowRoot: shadowRoot$1,
221
- querySelector: querySelector$1,
222
- querySelectorAll: querySelectorAll$1,
223
- mutationObserver: mutationObserverCtor$1,
224
- patch: patch$1
211
+ const index$2 = {
212
+ childNodes: childNodes$2,
213
+ parentNode: parentNode$2,
214
+ parentElement: parentElement$2,
215
+ textContent: textContent$2,
216
+ contains: contains$2,
217
+ getRootNode: getRootNode$2,
218
+ host: host$2,
219
+ styleSheets: styleSheets$2,
220
+ shadowRoot: shadowRoot$2,
221
+ querySelector: querySelector$2,
222
+ querySelectorAll: querySelectorAll$2,
223
+ mutationObserver: mutationObserverCtor$2,
224
+ patch: patch$2
225
225
  };
226
- function isElement(n2) {
226
+ function isElement$1(n2) {
227
227
  return n2.nodeType === n2.ELEMENT_NODE;
228
228
  }
229
229
  function isShadowRoot(n2) {
230
230
  const hostEl = (
231
231
  // anchor and textarea elements also have a `host` property
232
232
  // but only shadow roots have a `mode` property
233
- n2 && "host" in n2 && "mode" in n2 && index$1.host(n2) || null
233
+ n2 && "host" in n2 && "mode" in n2 && index$2.host(n2) || null
234
234
  );
235
235
  return Boolean(
236
- hostEl && "shadowRoot" in hostEl && index$1.shadowRoot(hostEl) === n2
236
+ hostEl && "shadowRoot" in hostEl && index$2.shadowRoot(hostEl) === n2
237
237
  );
238
238
  }
239
239
  function isNativeShadowDom(shadowRoot2) {
@@ -354,6 +354,17 @@ class Mirror {
354
354
  (childNode) => this.removeNodeFromMap(childNode)
355
355
  );
356
356
  }
357
+ if (isElement$1(n2)) {
358
+ const shadowRootEl = index$2.shadowRoot(n2);
359
+ if (shadowRootEl) {
360
+ this.removeNodeFromMap(shadowRootEl);
361
+ }
362
+ if (n2.nodeName === "IFRAME" && n2.contentDocument) {
363
+ this.removeNodeFromMap(
364
+ n2.contentDocument
365
+ );
366
+ }
367
+ }
357
368
  }
358
369
  has(id) {
359
370
  return this.idNodeMap.has(id);
@@ -702,7 +713,7 @@ function classMatchesRegex(node2, regex, checkAncestors) {
702
713
  if (!node2) return false;
703
714
  if (node2.nodeType !== node2.ELEMENT_NODE) {
704
715
  if (!checkAncestors) return false;
705
- return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);
716
+ return classMatchesRegex(index$2.parentNode(node2), regex, checkAncestors);
706
717
  }
707
718
  for (let eIndex = node2.classList.length; eIndex--; ) {
708
719
  const className = node2.classList[eIndex];
@@ -711,19 +722,19 @@ function classMatchesRegex(node2, regex, checkAncestors) {
711
722
  }
712
723
  }
713
724
  if (!checkAncestors) return false;
714
- return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);
725
+ return classMatchesRegex(index$2.parentNode(node2), regex, checkAncestors);
715
726
  }
716
727
  function needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {
717
728
  let el;
718
- if (isElement(node2)) {
729
+ if (isElement$1(node2)) {
719
730
  el = node2;
720
- if (!index$1.childNodes(el).length) {
731
+ if (!index$2.childNodes(el).length) {
721
732
  return false;
722
733
  }
723
- } else if (index$1.parentElement(node2) === null) {
734
+ } else if (index$2.parentElement(node2) === null) {
724
735
  return false;
725
736
  } else {
726
- el = index$1.parentElement(node2);
737
+ el = index$2.parentElement(node2);
727
738
  }
728
739
  try {
729
740
  if (typeof maskTextClass === "string") {
@@ -872,7 +883,7 @@ function serializeNode(n2, options) {
872
883
  case n2.COMMENT_NODE:
873
884
  return {
874
885
  type: NodeType$1$1.Comment,
875
- textContent: index$1.textContent(n2) || "",
886
+ textContent: index$2.textContent(n2) || "",
876
887
  rootId
877
888
  };
878
889
  default:
@@ -887,9 +898,9 @@ function getRootId(doc, mirror2) {
887
898
  function serializeTextNode(n2, options) {
888
899
  var _a2;
889
900
  const { needsMask, maskTextFn, rootId } = options;
890
- const parent = index$1.parentNode(n2);
901
+ const parent = index$2.parentNode(n2);
891
902
  const parentTagName = parent && parent.tagName;
892
- let text = index$1.textContent(n2);
903
+ let text = index$2.textContent(n2);
893
904
  const isStyle = parentTagName === "STYLE" ? true : void 0;
894
905
  const isScript = parentTagName === "SCRIPT" ? true : void 0;
895
906
  if (isStyle && text) {
@@ -910,7 +921,7 @@ function serializeTextNode(n2, options) {
910
921
  text = "SCRIPT_PLACEHOLDER";
911
922
  }
912
923
  if (!isStyle && !isScript && text && needsMask) {
913
- text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\S]/g, "*");
924
+ text = maskTextFn ? maskTextFn(text, index$2.parentElement(n2)) : text.replace(/[\S]/g, "*");
914
925
  }
915
926
  return {
916
927
  type: NodeType$1$1.Text,
@@ -980,7 +991,7 @@ function serializeElementNode(n2, options) {
980
991
  }
981
992
  }
982
993
  if (tagName === "style" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
983
- !(n2.innerText || index$1.textContent(n2) || "").trim().length) {
994
+ !(n2.innerText || index$2.textContent(n2) || "").trim().length) {
984
995
  const cssText = stringifyStylesheet(
985
996
  n2.sheet
986
997
  );
@@ -1246,7 +1257,7 @@ function serializeNodeWithId(n2, options) {
1246
1257
  if (serializedNode.type === NodeType$1$1.Element) {
1247
1258
  recordChild = recordChild && !serializedNode.needBlock;
1248
1259
  delete serializedNode.needBlock;
1249
- const shadowRootEl = index$1.shadowRoot(n2);
1260
+ const shadowRootEl = index$2.shadowRoot(n2);
1250
1261
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
1251
1262
  serializedNode.isShadowHost = true;
1252
1263
  }
@@ -1281,7 +1292,7 @@ function serializeNodeWithId(n2, options) {
1281
1292
  };
1282
1293
  if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1283
1294
  else {
1284
- for (const childN of Array.from(index$1.childNodes(n2))) {
1295
+ for (const childN of Array.from(index$2.childNodes(n2))) {
1285
1296
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1286
1297
  if (serializedChildNode) {
1287
1298
  serializedNode.childNodes.push(serializedChildNode);
@@ -1289,8 +1300,8 @@ function serializeNodeWithId(n2, options) {
1289
1300
  }
1290
1301
  }
1291
1302
  let shadowRootEl = null;
1292
- if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {
1293
- for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {
1303
+ if (isElement$1(n2) && (shadowRootEl = index$2.shadowRoot(n2))) {
1304
+ for (const childN of Array.from(index$2.childNodes(shadowRootEl))) {
1294
1305
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1295
1306
  if (serializedChildNode) {
1296
1307
  isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);
@@ -1299,7 +1310,7 @@ function serializeNodeWithId(n2, options) {
1299
1310
  }
1300
1311
  }
1301
1312
  }
1302
- const parent = index$1.parentNode(n2);
1313
+ const parent = index$2.parentNode(n2);
1303
1314
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
1304
1315
  serializedNode.isShadow = true;
1305
1316
  }
@@ -5750,7 +5761,7 @@ function buildNodeWithSN(n2, options) {
5750
5761
  console.warn("Failed to rebuild", childN);
5751
5762
  continue;
5752
5763
  }
5753
- if (childN.isShadow && isElement(node2) && node2.shadowRoot) {
5764
+ if (childN.isShadow && isElement$1(node2) && node2.shadowRoot) {
5754
5765
  node2.shadowRoot.appendChild(childNode);
5755
5766
  } else if (n2.type === NodeType$1$1.Document && childN.type == NodeType$1$1.Element) {
5756
5767
  const htmlElement = childNode;
@@ -5841,6 +5852,184 @@ var __publicField2 = (obj, key, value) => __defNormalProp22(obj, typeof key !==
5841
5852
  var __defProp222 = Object.defineProperty;
5842
5853
  var __defNormalProp222 = (obj, key, value) => key in obj ? __defProp222(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5843
5854
  var __publicField22 = (obj, key, value) => __defNormalProp222(obj, typeof key !== "symbol" ? key + "" : key, value);
5855
+ const testableAccessors$1 = {
5856
+ Node: ["childNodes", "parentNode", "parentElement", "textContent"],
5857
+ ShadowRoot: ["host", "styleSheets"],
5858
+ Element: ["shadowRoot", "querySelector", "querySelectorAll"],
5859
+ MutationObserver: []
5860
+ };
5861
+ const testableMethods$1 = {
5862
+ Node: ["contains", "getRootNode"],
5863
+ ShadowRoot: ["getSelection"],
5864
+ Element: [],
5865
+ MutationObserver: ["constructor"]
5866
+ };
5867
+ const untaintedBasePrototype$1 = {};
5868
+ function angularZoneUnpatchedAlternative$1(key) {
5869
+ var _a2, _b;
5870
+ const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
5871
+ if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
5872
+ return globalThis[angularUnpatchedVersionSymbol];
5873
+ } else {
5874
+ return void 0;
5875
+ }
5876
+ }
5877
+ function getUntaintedPrototype$1(key) {
5878
+ if (untaintedBasePrototype$1[key])
5879
+ return untaintedBasePrototype$1[key];
5880
+ const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
5881
+ const defaultPrototype = candidate.prototype;
5882
+ const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
5883
+ const isUntaintedAccessors = Boolean(
5884
+ accessorNames && // @ts-expect-error 2345
5885
+ accessorNames.every(
5886
+ (accessor) => {
5887
+ var _a2, _b;
5888
+ return Boolean(
5889
+ (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes("[native code]")
5890
+ );
5891
+ }
5892
+ )
5893
+ );
5894
+ const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
5895
+ const isUntaintedMethods = Boolean(
5896
+ methodNames && methodNames.every(
5897
+ // @ts-expect-error 2345
5898
+ (method) => {
5899
+ var _a2;
5900
+ return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));
5901
+ }
5902
+ )
5903
+ );
5904
+ if (isUntaintedAccessors && isUntaintedMethods) {
5905
+ untaintedBasePrototype$1[key] = candidate.prototype;
5906
+ return candidate.prototype;
5907
+ }
5908
+ try {
5909
+ const iframeEl = document.createElement("iframe");
5910
+ document.body.appendChild(iframeEl);
5911
+ const win = iframeEl.contentWindow;
5912
+ if (!win) return candidate.prototype;
5913
+ const untaintedObject = win[key].prototype;
5914
+ document.body.removeChild(iframeEl);
5915
+ if (!untaintedObject) return defaultPrototype;
5916
+ return untaintedBasePrototype$1[key] = untaintedObject;
5917
+ } catch (e2) {
5918
+ return defaultPrototype;
5919
+ }
5920
+ }
5921
+ const untaintedAccessorCache$1 = {};
5922
+ function getUntaintedAccessor$1(key, instance, accessor) {
5923
+ var _a2;
5924
+ const cacheKey = `${key}.${String(accessor)}`;
5925
+ if (untaintedAccessorCache$1[cacheKey])
5926
+ return untaintedAccessorCache$1[cacheKey].call(
5927
+ instance
5928
+ );
5929
+ const untaintedPrototype = getUntaintedPrototype$1(key);
5930
+ const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
5931
+ untaintedPrototype,
5932
+ accessor
5933
+ )) == null ? void 0 : _a2.get;
5934
+ if (!untaintedAccessor) return instance[accessor];
5935
+ untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
5936
+ return untaintedAccessor.call(instance);
5937
+ }
5938
+ const untaintedMethodCache$1 = {};
5939
+ function getUntaintedMethod$1(key, instance, method) {
5940
+ const cacheKey = `${key}.${String(method)}`;
5941
+ if (untaintedMethodCache$1[cacheKey])
5942
+ return untaintedMethodCache$1[cacheKey].bind(
5943
+ instance
5944
+ );
5945
+ const untaintedPrototype = getUntaintedPrototype$1(key);
5946
+ const untaintedMethod = untaintedPrototype[method];
5947
+ if (typeof untaintedMethod !== "function") return instance[method];
5948
+ untaintedMethodCache$1[cacheKey] = untaintedMethod;
5949
+ return untaintedMethod.bind(instance);
5950
+ }
5951
+ function childNodes$1(n2) {
5952
+ return getUntaintedAccessor$1("Node", n2, "childNodes");
5953
+ }
5954
+ function parentNode$1(n2) {
5955
+ return getUntaintedAccessor$1("Node", n2, "parentNode");
5956
+ }
5957
+ function parentElement$1(n2) {
5958
+ return getUntaintedAccessor$1("Node", n2, "parentElement");
5959
+ }
5960
+ function textContent$1(n2) {
5961
+ return getUntaintedAccessor$1("Node", n2, "textContent");
5962
+ }
5963
+ function contains$1(n2, other) {
5964
+ return getUntaintedMethod$1("Node", n2, "contains")(other);
5965
+ }
5966
+ function getRootNode$1(n2) {
5967
+ return getUntaintedMethod$1("Node", n2, "getRootNode")();
5968
+ }
5969
+ function host$1(n2) {
5970
+ if (!n2 || !("host" in n2)) return null;
5971
+ return getUntaintedAccessor$1("ShadowRoot", n2, "host");
5972
+ }
5973
+ function styleSheets$1(n2) {
5974
+ return n2.styleSheets;
5975
+ }
5976
+ function shadowRoot$1(n2) {
5977
+ if (!n2 || !("shadowRoot" in n2)) return null;
5978
+ return getUntaintedAccessor$1("Element", n2, "shadowRoot");
5979
+ }
5980
+ function querySelector$1(n2, selectors) {
5981
+ return getUntaintedAccessor$1("Element", n2, "querySelector")(selectors);
5982
+ }
5983
+ function querySelectorAll$1(n2, selectors) {
5984
+ return getUntaintedAccessor$1("Element", n2, "querySelectorAll")(selectors);
5985
+ }
5986
+ function mutationObserverCtor$1() {
5987
+ return getUntaintedPrototype$1("MutationObserver").constructor;
5988
+ }
5989
+ function patch$1(source, name, replacement) {
5990
+ try {
5991
+ if (!(name in source)) {
5992
+ return () => {
5993
+ };
5994
+ }
5995
+ const original = source[name];
5996
+ const wrapped = replacement(original);
5997
+ if (typeof wrapped === "function") {
5998
+ wrapped.prototype = wrapped.prototype || {};
5999
+ Object.defineProperties(wrapped, {
6000
+ __rrweb_original__: {
6001
+ enumerable: false,
6002
+ value: original
6003
+ }
6004
+ });
6005
+ }
6006
+ source[name] = wrapped;
6007
+ return () => {
6008
+ source[name] = original;
6009
+ };
6010
+ } catch (e2) {
6011
+ return () => {
6012
+ };
6013
+ }
6014
+ }
6015
+ const index$1 = {
6016
+ childNodes: childNodes$1,
6017
+ parentNode: parentNode$1,
6018
+ parentElement: parentElement$1,
6019
+ textContent: textContent$1,
6020
+ contains: contains$1,
6021
+ getRootNode: getRootNode$1,
6022
+ host: host$1,
6023
+ styleSheets: styleSheets$1,
6024
+ shadowRoot: shadowRoot$1,
6025
+ querySelector: querySelector$1,
6026
+ querySelectorAll: querySelectorAll$1,
6027
+ mutationObserver: mutationObserverCtor$1,
6028
+ patch: patch$1
6029
+ };
6030
+ function isElement(n2) {
6031
+ return n2.nodeType === n2.ELEMENT_NODE;
6032
+ }
5844
6033
  let Mirror$1 = class Mirror2 {
5845
6034
  constructor() {
5846
6035
  __publicField22(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -5871,6 +6060,17 @@ let Mirror$1 = class Mirror2 {
5871
6060
  (childNode) => this.removeNodeFromMap(childNode)
5872
6061
  );
5873
6062
  }
6063
+ if (isElement(n2)) {
6064
+ const shadowRootEl = index$1.shadowRoot(n2);
6065
+ if (shadowRootEl) {
6066
+ this.removeNodeFromMap(shadowRootEl);
6067
+ }
6068
+ if (n2.nodeName === "IFRAME" && n2.contentDocument) {
6069
+ this.removeNodeFromMap(
6070
+ n2.contentDocument
6071
+ );
6072
+ }
6073
+ }
5874
6074
  }
5875
6075
  has(id) {
5876
6076
  return this.idNodeMap.has(id);
@@ -16729,6 +16929,8 @@ class Replayer {
16729
16929
  (_b = this.speedServiceSubscription) == null ? void 0 : _b.unsubscribe();
16730
16930
  this.serviceSubscription = void 0;
16731
16931
  this.speedServiceSubscription = void 0;
16932
+ this.service.stop();
16933
+ this.speedService.stop();
16732
16934
  this.timeouts.forEach((timeout) => clearTimeout(timeout));
16733
16935
  this.timeouts.clear();
16734
16936
  this.styleSheetLoadListeners.forEach((handler, element) => {