@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.
package/dist/rrweb.cjs CHANGED
@@ -16,20 +16,20 @@ var NodeType$1$1 = /* @__PURE__ */ ((NodeType2) => {
16
16
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
17
17
  return NodeType2;
18
18
  })(NodeType$1$1 || {});
19
- const testableAccessors$1 = {
19
+ const testableAccessors$2 = {
20
20
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
21
21
  ShadowRoot: ["host", "styleSheets"],
22
22
  Element: ["shadowRoot", "querySelector", "querySelectorAll"],
23
23
  MutationObserver: []
24
24
  };
25
- const testableMethods$1 = {
25
+ const testableMethods$2 = {
26
26
  Node: ["contains", "getRootNode"],
27
27
  ShadowRoot: ["getSelection"],
28
28
  Element: [],
29
29
  MutationObserver: ["constructor"]
30
30
  };
31
- const untaintedBasePrototype$1 = {};
32
- function angularZoneUnpatchedAlternative$1(key) {
31
+ const untaintedBasePrototype$2 = {};
32
+ function angularZoneUnpatchedAlternative$2(key) {
33
33
  var _a2, _b;
34
34
  const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
35
35
  if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
@@ -38,12 +38,12 @@ function angularZoneUnpatchedAlternative$1(key) {
38
38
  return void 0;
39
39
  }
40
40
  }
41
- function getUntaintedPrototype$1(key) {
42
- if (untaintedBasePrototype$1[key])
43
- return untaintedBasePrototype$1[key];
44
- const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
41
+ function getUntaintedPrototype$2(key) {
42
+ if (untaintedBasePrototype$2[key])
43
+ return untaintedBasePrototype$2[key];
44
+ const candidate = angularZoneUnpatchedAlternative$2(key) || globalThis[key];
45
45
  const defaultPrototype = candidate.prototype;
46
- const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
46
+ const accessorNames = key in testableAccessors$2 ? testableAccessors$2[key] : void 0;
47
47
  const isUntaintedAccessors = Boolean(
48
48
  accessorNames && // @ts-expect-error 2345
49
49
  accessorNames.every(
@@ -55,7 +55,7 @@ function getUntaintedPrototype$1(key) {
55
55
  }
56
56
  )
57
57
  );
58
- const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
58
+ const methodNames = key in testableMethods$2 ? testableMethods$2[key] : void 0;
59
59
  const isUntaintedMethods = Boolean(
60
60
  methodNames && methodNames.every(
61
61
  // @ts-expect-error 2345
@@ -66,7 +66,7 @@ function getUntaintedPrototype$1(key) {
66
66
  )
67
67
  );
68
68
  if (isUntaintedAccessors && isUntaintedMethods) {
69
- untaintedBasePrototype$1[key] = candidate.prototype;
69
+ untaintedBasePrototype$2[key] = candidate.prototype;
70
70
  return candidate.prototype;
71
71
  }
72
72
  try {
@@ -77,80 +77,80 @@ function getUntaintedPrototype$1(key) {
77
77
  const untaintedObject = win[key].prototype;
78
78
  document.body.removeChild(iframeEl);
79
79
  if (!untaintedObject) return defaultPrototype;
80
- return untaintedBasePrototype$1[key] = untaintedObject;
80
+ return untaintedBasePrototype$2[key] = untaintedObject;
81
81
  } catch {
82
82
  return defaultPrototype;
83
83
  }
84
84
  }
85
- const untaintedAccessorCache$1 = {};
86
- function getUntaintedAccessor$1(key, instance, accessor) {
85
+ const untaintedAccessorCache$2 = {};
86
+ function getUntaintedAccessor$2(key, instance, accessor) {
87
87
  var _a2;
88
88
  const cacheKey = `${key}.${String(accessor)}`;
89
- if (untaintedAccessorCache$1[cacheKey])
90
- return untaintedAccessorCache$1[cacheKey].call(
89
+ if (untaintedAccessorCache$2[cacheKey])
90
+ return untaintedAccessorCache$2[cacheKey].call(
91
91
  instance
92
92
  );
93
- const untaintedPrototype = getUntaintedPrototype$1(key);
93
+ const untaintedPrototype = getUntaintedPrototype$2(key);
94
94
  const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
95
95
  untaintedPrototype,
96
96
  accessor
97
97
  )) == null ? void 0 : _a2.get;
98
98
  if (!untaintedAccessor) return instance[accessor];
99
- untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
99
+ untaintedAccessorCache$2[cacheKey] = untaintedAccessor;
100
100
  return untaintedAccessor.call(instance);
101
101
  }
102
- const untaintedMethodCache$1 = {};
103
- function getUntaintedMethod$1(key, instance, method) {
102
+ const untaintedMethodCache$2 = {};
103
+ function getUntaintedMethod$2(key, instance, method) {
104
104
  const cacheKey = `${key}.${String(method)}`;
105
- if (untaintedMethodCache$1[cacheKey])
106
- return untaintedMethodCache$1[cacheKey].bind(
105
+ if (untaintedMethodCache$2[cacheKey])
106
+ return untaintedMethodCache$2[cacheKey].bind(
107
107
  instance
108
108
  );
109
- const untaintedPrototype = getUntaintedPrototype$1(key);
109
+ const untaintedPrototype = getUntaintedPrototype$2(key);
110
110
  const untaintedMethod = untaintedPrototype[method];
111
111
  if (typeof untaintedMethod !== "function") return instance[method];
112
- untaintedMethodCache$1[cacheKey] = untaintedMethod;
112
+ untaintedMethodCache$2[cacheKey] = untaintedMethod;
113
113
  return untaintedMethod.bind(instance);
114
114
  }
115
- function childNodes$1(n2) {
116
- return getUntaintedAccessor$1("Node", n2, "childNodes");
115
+ function childNodes$2(n2) {
116
+ return getUntaintedAccessor$2("Node", n2, "childNodes");
117
117
  }
118
- function parentNode$1(n2) {
119
- return getUntaintedAccessor$1("Node", n2, "parentNode");
118
+ function parentNode$2(n2) {
119
+ return getUntaintedAccessor$2("Node", n2, "parentNode");
120
120
  }
121
- function parentElement$1(n2) {
122
- return getUntaintedAccessor$1("Node", n2, "parentElement");
121
+ function parentElement$2(n2) {
122
+ return getUntaintedAccessor$2("Node", n2, "parentElement");
123
123
  }
124
- function textContent$1(n2) {
125
- return getUntaintedAccessor$1("Node", n2, "textContent");
124
+ function textContent$2(n2) {
125
+ return getUntaintedAccessor$2("Node", n2, "textContent");
126
126
  }
127
- function contains$1(n2, other) {
128
- return getUntaintedMethod$1("Node", n2, "contains")(other);
127
+ function contains$2(n2, other) {
128
+ return getUntaintedMethod$2("Node", n2, "contains")(other);
129
129
  }
130
- function getRootNode$1(n2) {
131
- return getUntaintedMethod$1("Node", n2, "getRootNode")();
130
+ function getRootNode$2(n2) {
131
+ return getUntaintedMethod$2("Node", n2, "getRootNode")();
132
132
  }
133
- function host$1(n2) {
133
+ function host$2(n2) {
134
134
  if (!n2 || !("host" in n2)) return null;
135
- return getUntaintedAccessor$1("ShadowRoot", n2, "host");
135
+ return getUntaintedAccessor$2("ShadowRoot", n2, "host");
136
136
  }
137
- function styleSheets$1(n2) {
137
+ function styleSheets$2(n2) {
138
138
  return n2.styleSheets;
139
139
  }
140
- function shadowRoot$1(n2) {
140
+ function shadowRoot$2(n2) {
141
141
  if (!n2 || !("shadowRoot" in n2)) return null;
142
- return getUntaintedAccessor$1("Element", n2, "shadowRoot");
142
+ return getUntaintedAccessor$2("Element", n2, "shadowRoot");
143
143
  }
144
- function querySelector$1(n2, selectors) {
145
- return getUntaintedAccessor$1("Element", n2, "querySelector")(selectors);
144
+ function querySelector$2(n2, selectors) {
145
+ return getUntaintedAccessor$2("Element", n2, "querySelector")(selectors);
146
146
  }
147
- function querySelectorAll$1(n2, selectors) {
148
- return getUntaintedAccessor$1("Element", n2, "querySelectorAll")(selectors);
147
+ function querySelectorAll$2(n2, selectors) {
148
+ return getUntaintedAccessor$2("Element", n2, "querySelectorAll")(selectors);
149
149
  }
150
- function mutationObserverCtor$1() {
151
- return getUntaintedPrototype$1("MutationObserver").constructor;
150
+ function mutationObserverCtor$2() {
151
+ return getUntaintedPrototype$2("MutationObserver").constructor;
152
152
  }
153
- function patch$1(source, name, replacement) {
153
+ function patch$2(source, name, replacement) {
154
154
  try {
155
155
  if (!(name in source)) {
156
156
  return () => {
@@ -176,32 +176,32 @@ function patch$1(source, name, replacement) {
176
176
  };
177
177
  }
178
178
  }
179
- const index$1 = {
180
- childNodes: childNodes$1,
181
- parentNode: parentNode$1,
182
- parentElement: parentElement$1,
183
- textContent: textContent$1,
184
- contains: contains$1,
185
- getRootNode: getRootNode$1,
186
- host: host$1,
187
- styleSheets: styleSheets$1,
188
- shadowRoot: shadowRoot$1,
189
- querySelector: querySelector$1,
190
- querySelectorAll: querySelectorAll$1,
191
- mutationObserver: mutationObserverCtor$1,
192
- patch: patch$1
179
+ const index$2 = {
180
+ childNodes: childNodes$2,
181
+ parentNode: parentNode$2,
182
+ parentElement: parentElement$2,
183
+ textContent: textContent$2,
184
+ contains: contains$2,
185
+ getRootNode: getRootNode$2,
186
+ host: host$2,
187
+ styleSheets: styleSheets$2,
188
+ shadowRoot: shadowRoot$2,
189
+ querySelector: querySelector$2,
190
+ querySelectorAll: querySelectorAll$2,
191
+ mutationObserver: mutationObserverCtor$2,
192
+ patch: patch$2
193
193
  };
194
- function isElement(n2) {
194
+ function isElement$1(n2) {
195
195
  return n2.nodeType === n2.ELEMENT_NODE;
196
196
  }
197
197
  function isShadowRoot(n2) {
198
198
  const hostEl = (
199
199
  // anchor and textarea elements also have a `host` property
200
200
  // but only shadow roots have a `mode` property
201
- n2 && "host" in n2 && "mode" in n2 && index$1.host(n2) || null
201
+ n2 && "host" in n2 && "mode" in n2 && index$2.host(n2) || null
202
202
  );
203
203
  return Boolean(
204
- hostEl && "shadowRoot" in hostEl && index$1.shadowRoot(hostEl) === n2
204
+ hostEl && "shadowRoot" in hostEl && index$2.shadowRoot(hostEl) === n2
205
205
  );
206
206
  }
207
207
  function isNativeShadowDom(shadowRoot2) {
@@ -322,6 +322,17 @@ class Mirror {
322
322
  (childNode) => this.removeNodeFromMap(childNode)
323
323
  );
324
324
  }
325
+ if (isElement$1(n2)) {
326
+ const shadowRootEl = index$2.shadowRoot(n2);
327
+ if (shadowRootEl) {
328
+ this.removeNodeFromMap(shadowRootEl);
329
+ }
330
+ if (n2.nodeName === "IFRAME" && n2.contentDocument) {
331
+ this.removeNodeFromMap(
332
+ n2.contentDocument
333
+ );
334
+ }
335
+ }
325
336
  }
326
337
  has(id) {
327
338
  return this.idNodeMap.has(id);
@@ -669,7 +680,7 @@ function classMatchesRegex(node2, regex, checkAncestors) {
669
680
  if (!node2) return false;
670
681
  if (node2.nodeType !== node2.ELEMENT_NODE) {
671
682
  if (!checkAncestors) return false;
672
- return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);
683
+ return classMatchesRegex(index$2.parentNode(node2), regex, checkAncestors);
673
684
  }
674
685
  for (let eIndex = node2.classList.length; eIndex--; ) {
675
686
  const className = node2.classList[eIndex];
@@ -678,19 +689,19 @@ function classMatchesRegex(node2, regex, checkAncestors) {
678
689
  }
679
690
  }
680
691
  if (!checkAncestors) return false;
681
- return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);
692
+ return classMatchesRegex(index$2.parentNode(node2), regex, checkAncestors);
682
693
  }
683
694
  function needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {
684
695
  let el;
685
- if (isElement(node2)) {
696
+ if (isElement$1(node2)) {
686
697
  el = node2;
687
- if (!index$1.childNodes(el).length) {
698
+ if (!index$2.childNodes(el).length) {
688
699
  return false;
689
700
  }
690
- } else if (index$1.parentElement(node2) === null) {
701
+ } else if (index$2.parentElement(node2) === null) {
691
702
  return false;
692
703
  } else {
693
- el = index$1.parentElement(node2);
704
+ el = index$2.parentElement(node2);
694
705
  }
695
706
  try {
696
707
  if (typeof maskTextClass === "string") {
@@ -839,7 +850,7 @@ function serializeNode(n2, options) {
839
850
  case n2.COMMENT_NODE:
840
851
  return {
841
852
  type: NodeType$1$1.Comment,
842
- textContent: index$1.textContent(n2) || "",
853
+ textContent: index$2.textContent(n2) || "",
843
854
  rootId
844
855
  };
845
856
  default:
@@ -854,9 +865,9 @@ function getRootId(doc, mirror2) {
854
865
  function serializeTextNode(n2, options) {
855
866
  var _a2;
856
867
  const { needsMask, maskTextFn, rootId } = options;
857
- const parent = index$1.parentNode(n2);
868
+ const parent = index$2.parentNode(n2);
858
869
  const parentTagName = parent && parent.tagName;
859
- let text = index$1.textContent(n2);
870
+ let text = index$2.textContent(n2);
860
871
  const isStyle = parentTagName === "STYLE" ? true : void 0;
861
872
  const isScript = parentTagName === "SCRIPT" ? true : void 0;
862
873
  if (isStyle && text) {
@@ -877,7 +888,7 @@ function serializeTextNode(n2, options) {
877
888
  text = "SCRIPT_PLACEHOLDER";
878
889
  }
879
890
  if (!isStyle && !isScript && text && needsMask) {
880
- text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\S]/g, "*");
891
+ text = maskTextFn ? maskTextFn(text, index$2.parentElement(n2)) : text.replace(/[\S]/g, "*");
881
892
  }
882
893
  return {
883
894
  type: NodeType$1$1.Text,
@@ -947,7 +958,7 @@ function serializeElementNode(n2, options) {
947
958
  }
948
959
  }
949
960
  if (tagName === "style" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
950
- !(n2.innerText || index$1.textContent(n2) || "").trim().length) {
961
+ !(n2.innerText || index$2.textContent(n2) || "").trim().length) {
951
962
  const cssText = stringifyStylesheet(
952
963
  n2.sheet
953
964
  );
@@ -1213,7 +1224,7 @@ function serializeNodeWithId(n2, options) {
1213
1224
  if (serializedNode.type === NodeType$1$1.Element) {
1214
1225
  recordChild = recordChild && !serializedNode.needBlock;
1215
1226
  delete serializedNode.needBlock;
1216
- const shadowRootEl = index$1.shadowRoot(n2);
1227
+ const shadowRootEl = index$2.shadowRoot(n2);
1217
1228
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
1218
1229
  serializedNode.isShadowHost = true;
1219
1230
  }
@@ -1248,7 +1259,7 @@ function serializeNodeWithId(n2, options) {
1248
1259
  };
1249
1260
  if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1250
1261
  else {
1251
- for (const childN of Array.from(index$1.childNodes(n2))) {
1262
+ for (const childN of Array.from(index$2.childNodes(n2))) {
1252
1263
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1253
1264
  if (serializedChildNode) {
1254
1265
  serializedNode.childNodes.push(serializedChildNode);
@@ -1256,8 +1267,8 @@ function serializeNodeWithId(n2, options) {
1256
1267
  }
1257
1268
  }
1258
1269
  let shadowRootEl = null;
1259
- if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {
1260
- for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {
1270
+ if (isElement$1(n2) && (shadowRootEl = index$2.shadowRoot(n2))) {
1271
+ for (const childN of Array.from(index$2.childNodes(shadowRootEl))) {
1261
1272
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1262
1273
  if (serializedChildNode) {
1263
1274
  isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);
@@ -1266,7 +1277,7 @@ function serializeNodeWithId(n2, options) {
1266
1277
  }
1267
1278
  }
1268
1279
  }
1269
- const parent = index$1.parentNode(n2);
1280
+ const parent = index$2.parentNode(n2);
1270
1281
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
1271
1282
  serializedNode.isShadow = true;
1272
1283
  }
@@ -5718,7 +5729,7 @@ function buildNodeWithSN(n2, options) {
5718
5729
  console.warn("Failed to rebuild", childN);
5719
5730
  continue;
5720
5731
  }
5721
- if (childN.isShadow && isElement(node2) && node2.shadowRoot) {
5732
+ if (childN.isShadow && isElement$1(node2) && node2.shadowRoot) {
5722
5733
  node2.shadowRoot.appendChild(childNode);
5723
5734
  } else if (n2.type === NodeType$1$1.Document && childN.type == NodeType$1$1.Element) {
5724
5735
  const htmlElement = childNode;
@@ -5809,6 +5820,184 @@ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "
5809
5820
  var __defProp22 = Object.defineProperty;
5810
5821
  var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5811
5822
  var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
5823
+ const testableAccessors$1 = {
5824
+ Node: ["childNodes", "parentNode", "parentElement", "textContent"],
5825
+ ShadowRoot: ["host", "styleSheets"],
5826
+ Element: ["shadowRoot", "querySelector", "querySelectorAll"],
5827
+ MutationObserver: []
5828
+ };
5829
+ const testableMethods$1 = {
5830
+ Node: ["contains", "getRootNode"],
5831
+ ShadowRoot: ["getSelection"],
5832
+ Element: [],
5833
+ MutationObserver: ["constructor"]
5834
+ };
5835
+ const untaintedBasePrototype$1 = {};
5836
+ function angularZoneUnpatchedAlternative$1(key) {
5837
+ var _a2, _b;
5838
+ const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
5839
+ if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
5840
+ return globalThis[angularUnpatchedVersionSymbol];
5841
+ } else {
5842
+ return void 0;
5843
+ }
5844
+ }
5845
+ function getUntaintedPrototype$1(key) {
5846
+ if (untaintedBasePrototype$1[key])
5847
+ return untaintedBasePrototype$1[key];
5848
+ const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
5849
+ const defaultPrototype = candidate.prototype;
5850
+ const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
5851
+ const isUntaintedAccessors = Boolean(
5852
+ accessorNames && // @ts-expect-error 2345
5853
+ accessorNames.every(
5854
+ (accessor) => {
5855
+ var _a2, _b;
5856
+ return Boolean(
5857
+ (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes("[native code]")
5858
+ );
5859
+ }
5860
+ )
5861
+ );
5862
+ const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
5863
+ const isUntaintedMethods = Boolean(
5864
+ methodNames && methodNames.every(
5865
+ // @ts-expect-error 2345
5866
+ (method) => {
5867
+ var _a2;
5868
+ return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));
5869
+ }
5870
+ )
5871
+ );
5872
+ if (isUntaintedAccessors && isUntaintedMethods) {
5873
+ untaintedBasePrototype$1[key] = candidate.prototype;
5874
+ return candidate.prototype;
5875
+ }
5876
+ try {
5877
+ const iframeEl = document.createElement("iframe");
5878
+ document.body.appendChild(iframeEl);
5879
+ const win = iframeEl.contentWindow;
5880
+ if (!win) return candidate.prototype;
5881
+ const untaintedObject = win[key].prototype;
5882
+ document.body.removeChild(iframeEl);
5883
+ if (!untaintedObject) return defaultPrototype;
5884
+ return untaintedBasePrototype$1[key] = untaintedObject;
5885
+ } catch {
5886
+ return defaultPrototype;
5887
+ }
5888
+ }
5889
+ const untaintedAccessorCache$1 = {};
5890
+ function getUntaintedAccessor$1(key, instance, accessor) {
5891
+ var _a2;
5892
+ const cacheKey = `${key}.${String(accessor)}`;
5893
+ if (untaintedAccessorCache$1[cacheKey])
5894
+ return untaintedAccessorCache$1[cacheKey].call(
5895
+ instance
5896
+ );
5897
+ const untaintedPrototype = getUntaintedPrototype$1(key);
5898
+ const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
5899
+ untaintedPrototype,
5900
+ accessor
5901
+ )) == null ? void 0 : _a2.get;
5902
+ if (!untaintedAccessor) return instance[accessor];
5903
+ untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
5904
+ return untaintedAccessor.call(instance);
5905
+ }
5906
+ const untaintedMethodCache$1 = {};
5907
+ function getUntaintedMethod$1(key, instance, method) {
5908
+ const cacheKey = `${key}.${String(method)}`;
5909
+ if (untaintedMethodCache$1[cacheKey])
5910
+ return untaintedMethodCache$1[cacheKey].bind(
5911
+ instance
5912
+ );
5913
+ const untaintedPrototype = getUntaintedPrototype$1(key);
5914
+ const untaintedMethod = untaintedPrototype[method];
5915
+ if (typeof untaintedMethod !== "function") return instance[method];
5916
+ untaintedMethodCache$1[cacheKey] = untaintedMethod;
5917
+ return untaintedMethod.bind(instance);
5918
+ }
5919
+ function childNodes$1(n2) {
5920
+ return getUntaintedAccessor$1("Node", n2, "childNodes");
5921
+ }
5922
+ function parentNode$1(n2) {
5923
+ return getUntaintedAccessor$1("Node", n2, "parentNode");
5924
+ }
5925
+ function parentElement$1(n2) {
5926
+ return getUntaintedAccessor$1("Node", n2, "parentElement");
5927
+ }
5928
+ function textContent$1(n2) {
5929
+ return getUntaintedAccessor$1("Node", n2, "textContent");
5930
+ }
5931
+ function contains$1(n2, other) {
5932
+ return getUntaintedMethod$1("Node", n2, "contains")(other);
5933
+ }
5934
+ function getRootNode$1(n2) {
5935
+ return getUntaintedMethod$1("Node", n2, "getRootNode")();
5936
+ }
5937
+ function host$1(n2) {
5938
+ if (!n2 || !("host" in n2)) return null;
5939
+ return getUntaintedAccessor$1("ShadowRoot", n2, "host");
5940
+ }
5941
+ function styleSheets$1(n2) {
5942
+ return n2.styleSheets;
5943
+ }
5944
+ function shadowRoot$1(n2) {
5945
+ if (!n2 || !("shadowRoot" in n2)) return null;
5946
+ return getUntaintedAccessor$1("Element", n2, "shadowRoot");
5947
+ }
5948
+ function querySelector$1(n2, selectors) {
5949
+ return getUntaintedAccessor$1("Element", n2, "querySelector")(selectors);
5950
+ }
5951
+ function querySelectorAll$1(n2, selectors) {
5952
+ return getUntaintedAccessor$1("Element", n2, "querySelectorAll")(selectors);
5953
+ }
5954
+ function mutationObserverCtor$1() {
5955
+ return getUntaintedPrototype$1("MutationObserver").constructor;
5956
+ }
5957
+ function patch$1(source, name, replacement) {
5958
+ try {
5959
+ if (!(name in source)) {
5960
+ return () => {
5961
+ };
5962
+ }
5963
+ const original = source[name];
5964
+ const wrapped = replacement(original);
5965
+ if (typeof wrapped === "function") {
5966
+ wrapped.prototype = wrapped.prototype || {};
5967
+ Object.defineProperties(wrapped, {
5968
+ __rrweb_original__: {
5969
+ enumerable: false,
5970
+ value: original
5971
+ }
5972
+ });
5973
+ }
5974
+ source[name] = wrapped;
5975
+ return () => {
5976
+ source[name] = original;
5977
+ };
5978
+ } catch {
5979
+ return () => {
5980
+ };
5981
+ }
5982
+ }
5983
+ const index$1 = {
5984
+ childNodes: childNodes$1,
5985
+ parentNode: parentNode$1,
5986
+ parentElement: parentElement$1,
5987
+ textContent: textContent$1,
5988
+ contains: contains$1,
5989
+ getRootNode: getRootNode$1,
5990
+ host: host$1,
5991
+ styleSheets: styleSheets$1,
5992
+ shadowRoot: shadowRoot$1,
5993
+ querySelector: querySelector$1,
5994
+ querySelectorAll: querySelectorAll$1,
5995
+ mutationObserver: mutationObserverCtor$1,
5996
+ patch: patch$1
5997
+ };
5998
+ function isElement(n2) {
5999
+ return n2.nodeType === n2.ELEMENT_NODE;
6000
+ }
5812
6001
  let Mirror$1 = class Mirror2 {
5813
6002
  constructor() {
5814
6003
  __publicField22(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -5839,6 +6028,17 @@ let Mirror$1 = class Mirror2 {
5839
6028
  (childNode) => this.removeNodeFromMap(childNode)
5840
6029
  );
5841
6030
  }
6031
+ if (isElement(n2)) {
6032
+ const shadowRootEl = index$1.shadowRoot(n2);
6033
+ if (shadowRootEl) {
6034
+ this.removeNodeFromMap(shadowRootEl);
6035
+ }
6036
+ if (n2.nodeName === "IFRAME" && n2.contentDocument) {
6037
+ this.removeNodeFromMap(
6038
+ n2.contentDocument
6039
+ );
6040
+ }
6041
+ }
5842
6042
  }
5843
6043
  has(id) {
5844
6044
  return this.idNodeMap.has(id);
@@ -16748,6 +16948,8 @@ class Replayer {
16748
16948
  (_b = this.speedServiceSubscription) == null ? void 0 : _b.unsubscribe();
16749
16949
  this.serviceSubscription = void 0;
16750
16950
  this.speedServiceSubscription = void 0;
16951
+ this.service.stop();
16952
+ this.speedService.stop();
16751
16953
  this.timeouts.forEach((timeout) => clearTimeout(timeout));
16752
16954
  this.timeouts.clear();
16753
16955
  this.styleSheetLoadListeners.forEach((handler, element) => {