@screeb/rrweb 1.0.6 → 1.0.8

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.
@@ -51,7 +51,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
51
51
  var __defProp$1 = Object.defineProperty;
52
52
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
53
53
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
54
- var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
54
+ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
55
55
  NodeType2[NodeType2["Document"] = 0] = "Document";
56
56
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
57
57
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -59,7 +59,7 @@ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
59
59
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
60
60
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
61
61
  return NodeType2;
62
- })(NodeType$2 || {});
62
+ })(NodeType$3 || {});
63
63
  const testableAccessors$1 = {
64
64
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
65
65
  ShadowRoot: ["host", "styleSheets"],
@@ -73,6 +73,9 @@ const testableMethods$1 = {
73
73
  MutationObserver: ["constructor"]
74
74
  };
75
75
  const untaintedBasePrototype$1 = {};
76
+ const isAngularZonePresent$1 = () => {
77
+ return !!globalThis.Zone;
78
+ };
76
79
  function getUntaintedPrototype$1(key) {
77
80
  if (untaintedBasePrototype$1[key])
78
81
  return untaintedBasePrototype$1[key];
@@ -100,7 +103,7 @@ function getUntaintedPrototype$1(key) {
100
103
  }
101
104
  )
102
105
  );
103
- if (isUntaintedAccessors && isUntaintedMethods) {
106
+ if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent$1()) {
104
107
  untaintedBasePrototype$1[key] = defaultObj.prototype;
105
108
  return defaultObj.prototype;
106
109
  }
@@ -402,13 +405,13 @@ function is2DCanvasBlank(canvas) {
402
405
  }
403
406
  function isNodeMetaEqual(a2, b) {
404
407
  if (!a2 || !b || a2.type !== b.type) return false;
405
- if (a2.type === NodeType$2.Document)
408
+ if (a2.type === NodeType$3.Document)
406
409
  return a2.compatMode === b.compatMode;
407
- else if (a2.type === NodeType$2.DocumentType)
410
+ else if (a2.type === NodeType$3.DocumentType)
408
411
  return a2.name === b.name && a2.publicId === b.publicId && a2.systemId === b.systemId;
409
- else if (a2.type === NodeType$2.Comment || a2.type === NodeType$2.Text || a2.type === NodeType$2.CDATA)
412
+ else if (a2.type === NodeType$3.Comment || a2.type === NodeType$3.Text || a2.type === NodeType$3.CDATA)
410
413
  return a2.textContent === b.textContent;
411
- else if (a2.type === NodeType$2.Element)
414
+ else if (a2.type === NodeType$3.Element)
412
415
  return a2.tagName === b.tagName && JSON.stringify(a2.attributes) === JSON.stringify(b.attributes) && a2.isSVG === b.isSVG && a2.needBlock === b.needBlock;
413
416
  return false;
414
417
  }
@@ -485,20 +488,57 @@ function normalizeCssString(cssText) {
485
488
  function splitCssText(cssText, style) {
486
489
  const childNodes2 = Array.from(style.childNodes);
487
490
  const splits = [];
491
+ let iterLimit = 0;
488
492
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
489
- const cssTextNorm = normalizeCssString(cssText);
493
+ let cssTextNorm = normalizeCssString(cssText);
494
+ const normFactor = cssTextNorm.length / cssText.length;
490
495
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
491
496
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
492
497
  const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
493
- for (let j = 3; j < textContentNorm.length; j++) {
498
+ let j = 3;
499
+ for (; j < textContentNorm.length; j++) {
500
+ if (
501
+ // keep consuming css identifiers (to get a decent chunk more quickly)
502
+ textContentNorm[j].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section
503
+ textContentNorm.indexOf(textContentNorm.substring(0, j), 1) !== -1
504
+ ) {
505
+ continue;
506
+ }
507
+ break;
508
+ }
509
+ for (; j < textContentNorm.length; j++) {
494
510
  const bit = textContentNorm.substring(0, j);
495
- if (cssTextNorm.split(bit).length === 2) {
496
- const splitNorm = cssTextNorm.indexOf(bit);
497
- for (let k = splitNorm; k < cssText.length; k++) {
498
- if (normalizeCssString(cssText.substring(0, k)).length === splitNorm) {
511
+ const bits = cssTextNorm.split(bit);
512
+ let splitNorm = -1;
513
+ if (bits.length === 2) {
514
+ splitNorm = cssTextNorm.indexOf(bit);
515
+ } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
516
+ splitNorm = cssTextNorm.indexOf(bit, 1);
517
+ }
518
+ if (splitNorm !== -1) {
519
+ let k = Math.floor(splitNorm / normFactor);
520
+ for (; k > 0 && k < cssText.length; ) {
521
+ iterLimit += 1;
522
+ if (iterLimit > 50 * childNodes2.length) {
523
+ splits.push(cssText);
524
+ return splits;
525
+ }
526
+ const normPart = normalizeCssString(cssText.substring(0, k));
527
+ if (normPart.length === splitNorm) {
499
528
  splits.push(cssText.substring(0, k));
500
529
  cssText = cssText.substring(k);
530
+ cssTextNorm = cssTextNorm.substring(splitNorm);
501
531
  break;
532
+ } else if (normPart.length < splitNorm) {
533
+ k += Math.max(
534
+ 1,
535
+ Math.floor((splitNorm - normPart.length) / normFactor)
536
+ );
537
+ } else {
538
+ k -= Math.max(
539
+ 1,
540
+ Math.floor((normPart.length - splitNorm) * normFactor)
541
+ );
502
542
  }
503
543
  }
504
544
  break;
@@ -794,20 +834,20 @@ function serializeNode(n2, options) {
794
834
  case n2.DOCUMENT_NODE:
795
835
  if (n2.compatMode !== "CSS1Compat") {
796
836
  return {
797
- type: NodeType$2.Document,
837
+ type: NodeType$3.Document,
798
838
  childNodes: [],
799
839
  compatMode: n2.compatMode
800
840
  // probably "BackCompat"
801
841
  };
802
842
  } else {
803
843
  return {
804
- type: NodeType$2.Document,
844
+ type: NodeType$3.Document,
805
845
  childNodes: []
806
846
  };
807
847
  }
808
848
  case n2.DOCUMENT_TYPE_NODE:
809
849
  return {
810
- type: NodeType$2.DocumentType,
850
+ type: NodeType$3.DocumentType,
811
851
  name: n2.name,
812
852
  publicId: n2.publicId,
813
853
  systemId: n2.systemId,
@@ -838,13 +878,13 @@ function serializeNode(n2, options) {
838
878
  });
839
879
  case n2.CDATA_SECTION_NODE:
840
880
  return {
841
- type: NodeType$2.CDATA,
881
+ type: NodeType$3.CDATA,
842
882
  textContent: "",
843
883
  rootId
844
884
  };
845
885
  case n2.COMMENT_NODE:
846
886
  return {
847
- type: NodeType$2.Comment,
887
+ type: NodeType$3.Comment,
848
888
  textContent: index$1.textContent(n2) || "",
849
889
  rootId
850
890
  };
@@ -876,7 +916,7 @@ function serializeTextNode(n2, options) {
876
916
  textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
877
917
  }
878
918
  return {
879
- type: NodeType$2.Text,
919
+ type: NodeType$3.Text,
880
920
  textContent: textContent2 || "",
881
921
  rootId
882
922
  };
@@ -1062,7 +1102,7 @@ function serializeElementNode(n2, options) {
1062
1102
  } catch (e2) {
1063
1103
  }
1064
1104
  return {
1065
- type: NodeType$2.Element,
1105
+ type: NodeType$3.Element,
1066
1106
  tagName,
1067
1107
  attributes,
1068
1108
  childNodes: [],
@@ -1080,9 +1120,9 @@ function lowerIfExists(maybeAttr) {
1080
1120
  }
1081
1121
  }
1082
1122
  function slimDOMExcluded(sn, slimDOMOptions) {
1083
- if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {
1123
+ if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) {
1084
1124
  return true;
1085
- } else if (sn.type === NodeType$2.Element) {
1125
+ } else if (sn.type === NodeType$3.Element) {
1086
1126
  if (slimDOMOptions.script && // script tag
1087
1127
  (sn.tagName === "script" || // (module)preload link
1088
1128
  sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
@@ -1172,7 +1212,7 @@ function serializeNodeWithId(n2, options) {
1172
1212
  let id;
1173
1213
  if (mirror2.hasNode(n2)) {
1174
1214
  id = mirror2.getId(n2);
1175
- } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1215
+ } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1176
1216
  id = IGNORED_NODE;
1177
1217
  } else {
1178
1218
  id = genId();
@@ -1186,15 +1226,15 @@ function serializeNodeWithId(n2, options) {
1186
1226
  onSerialize(n2);
1187
1227
  }
1188
1228
  let recordChild = !skipChild;
1189
- if (serializedNode.type === NodeType$2.Element) {
1229
+ if (serializedNode.type === NodeType$3.Element) {
1190
1230
  recordChild = recordChild && !serializedNode.needBlock;
1191
1231
  delete serializedNode.needBlock;
1192
1232
  const shadowRootEl = index$1.shadowRoot(n2);
1193
1233
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
1194
1234
  serializedNode.isShadowHost = true;
1195
1235
  }
1196
- if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {
1197
- if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === "head") {
1236
+ if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) {
1237
+ if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") {
1198
1238
  preserveWhiteSpace = false;
1199
1239
  }
1200
1240
  const bypassOptions = {
@@ -1223,9 +1263,9 @@ function serializeNodeWithId(n2, options) {
1223
1263
  keepIframeSrcFn,
1224
1264
  cssCaptured: false
1225
1265
  };
1226
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1266
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1227
1267
  else {
1228
- if (serializedNode.type === NodeType$2.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
1268
+ if (serializedNode.type === NodeType$3.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
1229
1269
  bypassOptions.cssCaptured = true;
1230
1270
  }
1231
1271
  for (const childN of Array.from(index$1.childNodes(n2))) {
@@ -1250,7 +1290,7 @@ function serializeNodeWithId(n2, options) {
1250
1290
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
1251
1291
  serializedNode.isShadow = true;
1252
1292
  }
1253
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "iframe") {
1293
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
1254
1294
  onceIframeLoaded(
1255
1295
  n2,
1256
1296
  () => {
@@ -1292,7 +1332,7 @@ function serializeNodeWithId(n2, options) {
1292
1332
  iframeLoadTimeout
1293
1333
  );
1294
1334
  }
1295
- if (serializedNode.type === NodeType$2.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")) {
1335
+ 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")) {
1296
1336
  onceStylesheetLoaded(
1297
1337
  n2,
1298
1338
  () => {
@@ -5074,7 +5114,7 @@ function createCache() {
5074
5114
  function applyCssSplits(n2, cssText, hackCss, cache) {
5075
5115
  const childTextNodes = [];
5076
5116
  for (const scn of n2.childNodes) {
5077
- if (scn.type === NodeType$2.Text) {
5117
+ if (scn.type === NodeType$3.Text) {
5078
5118
  childTextNodes.push(scn);
5079
5119
  }
5080
5120
  }
@@ -5105,15 +5145,15 @@ function buildNode(n2, options) {
5105
5145
  var _a2;
5106
5146
  const { doc, hackCss, cache } = options;
5107
5147
  switch (n2.type) {
5108
- case NodeType$2.Document:
5148
+ case NodeType$3.Document:
5109
5149
  return doc.implementation.createDocument(null, "", null);
5110
- case NodeType$2.DocumentType:
5150
+ case NodeType$3.DocumentType:
5111
5151
  return doc.implementation.createDocumentType(
5112
5152
  n2.name || "html",
5113
5153
  n2.publicId,
5114
5154
  n2.systemId
5115
5155
  );
5116
- case NodeType$2.Element: {
5156
+ case NodeType$3.Element: {
5117
5157
  const tagName = getTagName(n2);
5118
5158
  let node2;
5119
5159
  if (n2.isSVG) {
@@ -5247,14 +5287,14 @@ function buildNode(n2, options) {
5247
5287
  }
5248
5288
  return node2;
5249
5289
  }
5250
- case NodeType$2.Text:
5290
+ case NodeType$3.Text:
5251
5291
  if (n2.isStyle && hackCss) {
5252
5292
  return doc.createTextNode(adaptCssForReplay(n2.textContent, cache));
5253
5293
  }
5254
5294
  return doc.createTextNode(n2.textContent);
5255
- case NodeType$2.CDATA:
5295
+ case NodeType$3.CDATA:
5256
5296
  return doc.createCDATASection(n2.textContent);
5257
- case NodeType$2.Comment:
5297
+ case NodeType$3.Comment:
5258
5298
  return doc.createComment(n2.textContent);
5259
5299
  default:
5260
5300
  return null;
@@ -5281,11 +5321,11 @@ function buildNodeWithSN(n2, options) {
5281
5321
  if (n2.rootId && mirror2.getNode(n2.rootId) !== doc) {
5282
5322
  mirror2.replace(n2.rootId, doc);
5283
5323
  }
5284
- if (n2.type === NodeType$2.Document) {
5324
+ if (n2.type === NodeType$3.Document) {
5285
5325
  doc.close();
5286
5326
  doc.open();
5287
- if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$2.DocumentType) {
5288
- if (n2.childNodes[0].type === NodeType$2.Element && "xmlns" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === "http://www.w3.org/1999/xhtml") {
5327
+ if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType) {
5328
+ if (n2.childNodes[0].type === NodeType$3.Element && "xmlns" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === "http://www.w3.org/1999/xhtml") {
5289
5329
  doc.write(
5290
5330
  '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5291
5331
  );
@@ -5298,7 +5338,7 @@ function buildNodeWithSN(n2, options) {
5298
5338
  node2 = doc;
5299
5339
  }
5300
5340
  mirror2.add(node2, n2);
5301
- if ((n2.type === NodeType$2.Document || n2.type === NodeType$2.Element) && !skipChild) {
5341
+ if ((n2.type === NodeType$3.Document || n2.type === NodeType$3.Element) && !skipChild) {
5302
5342
  for (const childN of n2.childNodes) {
5303
5343
  const childNode = buildNodeWithSN(childN, {
5304
5344
  doc,
@@ -5314,7 +5354,7 @@ function buildNodeWithSN(n2, options) {
5314
5354
  }
5315
5355
  if (childN.isShadow && isElement(node2) && node2.shadowRoot) {
5316
5356
  node2.shadowRoot.appendChild(childNode);
5317
- } else if (n2.type === NodeType$2.Document && childN.type == NodeType$2.Element) {
5357
+ } else if (n2.type === NodeType$3.Document && childN.type == NodeType$3.Element) {
5318
5358
  const htmlElement = childNode;
5319
5359
  let body = null;
5320
5360
  htmlElement.childNodes.forEach((child) => {
@@ -5349,7 +5389,7 @@ function visit(mirror2, onVisit) {
5349
5389
  }
5350
5390
  function handleScroll(node2, mirror2) {
5351
5391
  const n2 = mirror2.getMeta(node2);
5352
- if ((n2 == null ? void 0 : n2.type) !== NodeType$2.Element) {
5392
+ if ((n2 == null ? void 0 : n2.type) !== NodeType$3.Element) {
5353
5393
  return;
5354
5394
  }
5355
5395
  const el = node2;
@@ -5397,15 +5437,6 @@ var __publicField2 = (obj, key, value) => __defNormalProp22(obj, typeof key !==
5397
5437
  var __defProp222 = Object.defineProperty;
5398
5438
  var __defNormalProp222 = (obj, key, value) => key in obj ? __defProp222(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5399
5439
  var __publicField22 = (obj, key, value) => __defNormalProp222(obj, typeof key !== "symbol" ? key + "" : key, value);
5400
- var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
5401
- NodeType2[NodeType2["Document"] = 0] = "Document";
5402
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
5403
- NodeType2[NodeType2["Element"] = 2] = "Element";
5404
- NodeType2[NodeType2["Text"] = 3] = "Text";
5405
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
5406
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
5407
- return NodeType2;
5408
- })(NodeType$1 || {});
5409
5440
  let Mirror$1 = class Mirror2 {
5410
5441
  constructor() {
5411
5442
  __publicField22(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -9017,6 +9048,15 @@ postcss$1.Input;
9017
9048
  postcss$1.Rule;
9018
9049
  postcss$1.Root;
9019
9050
  postcss$1.Node;
9051
+ var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
9052
+ NodeType2[NodeType2["Document"] = 0] = "Document";
9053
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
9054
+ NodeType2[NodeType2["Element"] = 2] = "Element";
9055
+ NodeType2[NodeType2["Text"] = 3] = "Text";
9056
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
9057
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
9058
+ return NodeType2;
9059
+ })(NodeType$1 || {});
9020
9060
  function parseCSSText(cssText) {
9021
9061
  const res = {};
9022
9062
  const listDelimiter = /;(?![^(]*\))/g;
@@ -9526,7 +9566,7 @@ function removeChild(parent, child) {
9526
9566
  child.parentNode = null;
9527
9567
  return child;
9528
9568
  }
9529
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
9569
+ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
9530
9570
  NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
9531
9571
  NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
9532
9572
  NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
@@ -9540,7 +9580,7 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
9540
9580
  NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
9541
9581
  NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
9542
9582
  return NodeType2;
9543
- })(NodeType || {});
9583
+ })(NodeType$2 || {});
9544
9584
  const NAMESPACES = {
9545
9585
  svg: "http://www.w3.org/2000/svg",
9546
9586
  "xlink:href": "http://www.w3.org/1999/xlink",
@@ -10099,7 +10139,7 @@ function getValidTagName(element) {
10099
10139
  function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10100
10140
  let rrNode;
10101
10141
  switch (node2.nodeType) {
10102
- case NodeType.DOCUMENT_NODE:
10142
+ case NodeType$2.DOCUMENT_NODE:
10103
10143
  if (parentRRNode && parentRRNode.nodeName === "IFRAME")
10104
10144
  rrNode = parentRRNode.contentDocument;
10105
10145
  else {
@@ -10107,7 +10147,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10107
10147
  rrNode.compatMode = node2.compatMode;
10108
10148
  }
10109
10149
  break;
10110
- case NodeType.DOCUMENT_TYPE_NODE: {
10150
+ case NodeType$2.DOCUMENT_TYPE_NODE: {
10111
10151
  const documentType = node2;
10112
10152
  rrNode = rrdom.createDocumentType(
10113
10153
  documentType.name,
@@ -10116,7 +10156,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10116
10156
  );
10117
10157
  break;
10118
10158
  }
10119
- case NodeType.ELEMENT_NODE: {
10159
+ case NodeType$2.ELEMENT_NODE: {
10120
10160
  const elementNode = node2;
10121
10161
  const tagName = getValidTagName(elementNode);
10122
10162
  rrNode = rrdom.createElement(tagName);
@@ -10128,16 +10168,16 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10128
10168
  elementNode.scrollTop && (rrElement.scrollTop = elementNode.scrollTop);
10129
10169
  break;
10130
10170
  }
10131
- case NodeType.TEXT_NODE:
10171
+ case NodeType$2.TEXT_NODE:
10132
10172
  rrNode = rrdom.createTextNode(node2.textContent || "");
10133
10173
  break;
10134
- case NodeType.CDATA_SECTION_NODE:
10174
+ case NodeType$2.CDATA_SECTION_NODE:
10135
10175
  rrNode = rrdom.createCDATASection(node2.data);
10136
10176
  break;
10137
- case NodeType.COMMENT_NODE:
10177
+ case NodeType$2.COMMENT_NODE:
10138
10178
  rrNode = rrdom.createComment(node2.textContent || "");
10139
10179
  break;
10140
- case NodeType.DOCUMENT_FRAGMENT_NODE:
10180
+ case NodeType$2.DOCUMENT_FRAGMENT_NODE:
10141
10181
  rrNode = parentRRNode.attachShadow({ mode: "open" });
10142
10182
  break;
10143
10183
  default:
@@ -10160,7 +10200,7 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
10160
10200
  if (
10161
10201
  // if the parentRRNode isn't a RRIFrameElement
10162
10202
  (parentRRNode == null ? void 0 : parentRRNode.nodeName) !== "IFRAME" && // if node isn't a shadow root
10163
- node2.nodeType !== NodeType.DOCUMENT_FRAGMENT_NODE
10203
+ node2.nodeType !== NodeType$2.DOCUMENT_FRAGMENT_NODE
10164
10204
  ) {
10165
10205
  parentRRNode == null ? void 0 : parentRRNode.appendChild(rrNode);
10166
10206
  rrNode.parentNode = parentRRNode;
@@ -10169,8 +10209,8 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
10169
10209
  if (node2.nodeName === "IFRAME") {
10170
10210
  const iframeDoc = node2.contentDocument;
10171
10211
  iframeDoc && walk2(iframeDoc, rrNode);
10172
- } else if (node2.nodeType === NodeType.DOCUMENT_NODE || node2.nodeType === NodeType.ELEMENT_NODE || node2.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {
10173
- if (node2.nodeType === NodeType.ELEMENT_NODE && node2.shadowRoot)
10212
+ } else if (node2.nodeType === NodeType$2.DOCUMENT_NODE || node2.nodeType === NodeType$2.ELEMENT_NODE || node2.nodeType === NodeType$2.DOCUMENT_FRAGMENT_NODE) {
10213
+ if (node2.nodeType === NodeType$2.ELEMENT_NODE && node2.shadowRoot)
10174
10214
  walk2(node2.shadowRoot, rrNode);
10175
10215
  node2.childNodes.forEach((childNode) => walk2(childNode, rrNode));
10176
10216
  }
@@ -10294,6 +10334,9 @@ const testableMethods = {
10294
10334
  MutationObserver: ["constructor"]
10295
10335
  };
10296
10336
  const untaintedBasePrototype = {};
10337
+ const isAngularZonePresent = () => {
10338
+ return !!globalThis.Zone;
10339
+ };
10297
10340
  function getUntaintedPrototype(key) {
10298
10341
  if (untaintedBasePrototype[key])
10299
10342
  return untaintedBasePrototype[key];
@@ -10321,7 +10364,7 @@ function getUntaintedPrototype(key) {
10321
10364
  }
10322
10365
  )
10323
10366
  );
10324
- if (isUntaintedAccessors && isUntaintedMethods) {
10367
+ if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
10325
10368
  untaintedBasePrototype[key] = defaultObj.prototype;
10326
10369
  return defaultObj.prototype;
10327
10370
  }
@@ -10904,6 +10947,15 @@ var ReplayerEvents = /* @__PURE__ */ ((ReplayerEvents2) => {
10904
10947
  ReplayerEvents2["Destroy"] = "destroy";
10905
10948
  return ReplayerEvents2;
10906
10949
  })(ReplayerEvents || {});
10950
+ var NodeType = /* @__PURE__ */ ((NodeType2) => {
10951
+ NodeType2[NodeType2["Document"] = 0] = "Document";
10952
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
10953
+ NodeType2[NodeType2["Element"] = 2] = "Element";
10954
+ NodeType2[NodeType2["Text"] = 3] = "Text";
10955
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
10956
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
10957
+ return NodeType2;
10958
+ })(NodeType || {});
10907
10959
  function isNodeInLinkedList(n2) {
10908
10960
  return "__ln" in n2;
10909
10961
  }
@@ -12818,7 +12870,7 @@ class IframeManager {
12818
12870
  }
12819
12871
  }
12820
12872
  patchRootIdOnNode(node2, rootId) {
12821
- if (node2.type !== NodeType$2.Document && !node2.rootId) node2.rootId = rootId;
12873
+ if (node2.type !== NodeType.Document && !node2.rootId) node2.rootId = rootId;
12822
12874
  if ("childNodes" in node2) {
12823
12875
  node2.childNodes.forEach((child) => {
12824
12876
  this.patchRootIdOnNode(child, rootId);
@@ -15881,7 +15933,7 @@ class Replayer {
15881
15933
  collectedDialogs.add(builtNode);
15882
15934
  this.collectIframeAndAttachDocument(collectedIframes, builtNode);
15883
15935
  const sn = mirror2.getMeta(builtNode);
15884
- if ((sn == null ? void 0 : sn.type) === NodeType$2.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
15936
+ if ((sn == null ? void 0 : sn.type) === NodeType.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
15885
15937
  const { documentElement, head } = iframeEl.contentDocument;
15886
15938
  this.insertStyleRules(
15887
15939
  documentElement,
@@ -16355,7 +16407,7 @@ class Replayer {
16355
16407
  mutation.parentId
16356
16408
  );
16357
16409
  if (!parent) {
16358
- if (mutation.node.type === NodeType$2.Document) {
16410
+ if (mutation.node.type === NodeType.Document) {
16359
16411
  return this.newDocumentQueue.push(mutation);
16360
16412
  }
16361
16413
  return queue.push(mutation);
@@ -16417,7 +16469,7 @@ class Replayer {
16417
16469
  return;
16418
16470
  }
16419
16471
  const parentSn = mirror2.getMeta(parent);
16420
- if (parentSn && parentSn.type === NodeType$2.Element && mutation.node.type === NodeType$2.Text) {
16472
+ if (parentSn && parentSn.type === NodeType.Element && mutation.node.type === NodeType.Text) {
16421
16473
  const prospectiveSiblings = Array.isArray(parent.childNodes) ? parent.childNodes : Array.from(parent.childNodes);
16422
16474
  if (parentSn.tagName === "textarea") {
16423
16475
  for (const c2 of prospectiveSiblings) {
@@ -16433,9 +16485,9 @@ class Replayer {
16433
16485
  }
16434
16486
  }
16435
16487
  }
16436
- } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType$2.Document) {
16488
+ } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType.Document) {
16437
16489
  const parentDoc = parent;
16438
- if (mutation.node.type === NodeType$2.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
16490
+ if (mutation.node.type === NodeType.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
16439
16491
  parentDoc.removeChild(parentDoc.childNodes[0]);
16440
16492
  if (target.nodeName === "HTML" && parentDoc.documentElement)
16441
16493
  parentDoc.removeChild(
@@ -16641,7 +16693,7 @@ class Replayer {
16641
16693
  left: d.x,
16642
16694
  behavior: isSync ? "auto" : "smooth"
16643
16695
  });
16644
- } else if ((sn == null ? void 0 : sn.type) === NodeType$2.Document) {
16696
+ } else if ((sn == null ? void 0 : sn.type) === NodeType.Document) {
16645
16697
  (_b = target.defaultView) == null ? void 0 : _b.scrollTo({
16646
16698
  top: d.y,
16647
16699
  left: d.x,