@amplitude/rrweb-player 2.0.0-alpha.26 → 2.0.0-alpha.27

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.
@@ -435,7 +435,7 @@ var _a$1;
435
435
  var __defProp$1 = Object.defineProperty;
436
436
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
437
437
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
438
- var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
438
+ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
439
439
  NodeType2[NodeType2["Document"] = 0] = "Document";
440
440
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
441
441
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -443,7 +443,7 @@ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
443
443
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
444
444
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
445
445
  return NodeType2;
446
- })(NodeType$2 || {});
446
+ })(NodeType$3 || {});
447
447
  function isElement(n2) {
448
448
  return n2.nodeType === n2.ELEMENT_NODE;
449
449
  }
@@ -510,13 +510,13 @@ function toLowerCase(str) {
510
510
  }
511
511
  function isNodeMetaEqual(a2, b) {
512
512
  if (!a2 || !b || a2.type !== b.type) return false;
513
- if (a2.type === NodeType$2.Document)
513
+ if (a2.type === NodeType$3.Document)
514
514
  return a2.compatMode === b.compatMode;
515
- else if (a2.type === NodeType$2.DocumentType)
515
+ else if (a2.type === NodeType$3.DocumentType)
516
516
  return a2.name === b.name && a2.publicId === b.publicId && a2.systemId === b.systemId;
517
- else if (a2.type === NodeType$2.Comment || a2.type === NodeType$2.Text || a2.type === NodeType$2.CDATA)
517
+ else if (a2.type === NodeType$3.Comment || a2.type === NodeType$3.Text || a2.type === NodeType$3.CDATA)
518
518
  return a2.textContent === b.textContent;
519
- else if (a2.type === NodeType$2.Element)
519
+ else if (a2.type === NodeType$3.Element)
520
520
  return a2.tagName === b.tagName && JSON.stringify(a2.attributes) === JSON.stringify(b.attributes) && a2.isSVG === b.isSVG && a2.needBlock === b.needBlock;
521
521
  return false;
522
522
  }
@@ -546,41 +546,8 @@ const pseudoClassPlugin = {
546
546
  }
547
547
  fixed.push(rule2);
548
548
  rule2.selectors.forEach(function(selector) {
549
- if (!selector.includes(":")) {
550
- return;
551
- }
552
- const selectorParts = selector.replace(/\n/g, " ").split(" ");
553
- const pseudoedSelectorParts = [];
554
- selectorParts.forEach(function(selectorPart) {
555
- const pseudos = selectorPart.match(/::?([^:]+)/g);
556
- if (!pseudos) {
557
- pseudoedSelectorParts.push(selectorPart);
558
- return;
559
- }
560
- const baseSelector = selectorPart.substr(
561
- 0,
562
- selectorPart.length - pseudos.join("").length
563
- );
564
- const classPseudos = pseudos.map(function(pseudo) {
565
- const pseudoToCheck = pseudo.replace(/\(.*/g, "");
566
- if (pseudoToCheck !== ":hover") {
567
- return pseudo;
568
- }
569
- if (pseudo.match(/^::/)) {
570
- return pseudo;
571
- }
572
- pseudo = pseudo.substr(1);
573
- pseudo = pseudo.replace(/\(/g, "\\(");
574
- pseudo = pseudo.replace(/\)/g, "\\)");
575
- return ".\\:" + pseudo;
576
- });
577
- pseudoedSelectorParts.push(baseSelector + classPseudos.join(""));
578
- });
579
- addSelector(pseudoedSelectorParts.join(" "));
580
- function addSelector(newSelector) {
581
- if (newSelector && newSelector !== selector) {
582
- rule2.selector += ",\n" + newSelector;
583
- }
549
+ if (selector.includes(":hover")) {
550
+ rule2.selector += ",\n" + selector.replace(/:hover/g, ".\\:hover");
584
551
  }
585
552
  });
586
553
  }
@@ -4209,19 +4176,49 @@ function createCache() {
4209
4176
  stylesWithHoverClass
4210
4177
  };
4211
4178
  }
4179
+ function applyCssSplits(n2, cssText, hackCss, cache) {
4180
+ const childTextNodes = [];
4181
+ for (const scn of n2.childNodes) {
4182
+ if (scn.type === NodeType$3.Text) {
4183
+ childTextNodes.push(scn);
4184
+ }
4185
+ }
4186
+ const cssTextSplits = cssText.split("/* rr_split */");
4187
+ while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {
4188
+ cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(""));
4189
+ }
4190
+ for (let i2 = 0; i2 < childTextNodes.length; i2++) {
4191
+ const childTextNode = childTextNodes[i2];
4192
+ const cssTextSection = cssTextSplits[i2];
4193
+ if (childTextNode && cssTextSection) {
4194
+ childTextNode.textContent = hackCss ? adaptCssForReplay(cssTextSection, cache) : cssTextSection;
4195
+ }
4196
+ }
4197
+ }
4198
+ function buildStyleNode(n2, styleEl, cssText, options) {
4199
+ const { doc, hackCss, cache } = options;
4200
+ if (n2.childNodes.length) {
4201
+ applyCssSplits(n2, cssText, hackCss, cache);
4202
+ } else {
4203
+ if (hackCss) {
4204
+ cssText = adaptCssForReplay(cssText, cache);
4205
+ }
4206
+ styleEl.appendChild(doc.createTextNode(cssText));
4207
+ }
4208
+ }
4212
4209
  function buildNode(n2, options) {
4213
4210
  var _a2;
4214
4211
  const { doc, hackCss, cache } = options;
4215
4212
  switch (n2.type) {
4216
- case NodeType$2.Document:
4213
+ case NodeType$3.Document:
4217
4214
  return doc.implementation.createDocument(null, "", null);
4218
- case NodeType$2.DocumentType:
4215
+ case NodeType$3.DocumentType:
4219
4216
  return doc.implementation.createDocumentType(
4220
4217
  n2.name || "html",
4221
4218
  n2.publicId,
4222
4219
  n2.systemId
4223
4220
  );
4224
- case NodeType$2.Element: {
4221
+ case NodeType$3.Element: {
4225
4222
  const tagName = getTagName(n2);
4226
4223
  let node2;
4227
4224
  if (n2.isSVG) {
@@ -4257,12 +4254,11 @@ function buildNode(n2, options) {
4257
4254
  specialAttributes[name] = value;
4258
4255
  continue;
4259
4256
  }
4260
- const isTextarea = tagName === "textarea" && name === "value";
4261
- const isRemoteOrDynamicCss = tagName === "style" && name === "_cssText";
4262
- if (isRemoteOrDynamicCss && hackCss && typeof value === "string") {
4263
- value = adaptCssForReplay(value, cache);
4264
- }
4265
- if ((isTextarea || isRemoteOrDynamicCss) && typeof value === "string") {
4257
+ if (typeof value !== "string") ;
4258
+ else if (tagName === "style" && name === "_cssText") {
4259
+ buildStyleNode(n2, node2, value, options);
4260
+ continue;
4261
+ } else if (tagName === "textarea" && name === "value") {
4266
4262
  node2.appendChild(doc.createTextNode(value));
4267
4263
  n2.childNodes = [];
4268
4264
  continue;
@@ -4316,9 +4312,9 @@ function buildNode(n2, options) {
4316
4312
  }
4317
4313
  }
4318
4314
  if (name === "rr_width") {
4319
- node2.style.width = value.toString();
4315
+ node2.style.setProperty("width", value.toString());
4320
4316
  } else if (name === "rr_height") {
4321
- node2.style.height = value.toString();
4317
+ node2.style.setProperty("height", value.toString());
4322
4318
  } else if (name === "rr_mediaCurrentTime" && typeof value === "number") {
4323
4319
  node2.currentTime = value;
4324
4320
  } else if (name === "rr_mediaState") {
@@ -4356,13 +4352,14 @@ function buildNode(n2, options) {
4356
4352
  }
4357
4353
  return node2;
4358
4354
  }
4359
- case NodeType$2.Text:
4360
- return doc.createTextNode(
4361
- n2.isStyle && hackCss ? adaptCssForReplay(n2.textContent, cache) : n2.textContent
4362
- );
4363
- case NodeType$2.CDATA:
4355
+ case NodeType$3.Text:
4356
+ if (n2.isStyle && hackCss) {
4357
+ return doc.createTextNode(adaptCssForReplay(n2.textContent, cache));
4358
+ }
4359
+ return doc.createTextNode(n2.textContent);
4360
+ case NodeType$3.CDATA:
4364
4361
  return doc.createCDATASection(n2.textContent);
4365
- case NodeType$2.Comment:
4362
+ case NodeType$3.Comment:
4366
4363
  return doc.createComment(n2.textContent);
4367
4364
  default:
4368
4365
  return null;
@@ -4389,11 +4386,11 @@ function buildNodeWithSN(n2, options) {
4389
4386
  if (n2.rootId && mirror2.getNode(n2.rootId) !== doc) {
4390
4387
  mirror2.replace(n2.rootId, doc);
4391
4388
  }
4392
- if (n2.type === NodeType$2.Document) {
4389
+ if (n2.type === NodeType$3.Document) {
4393
4390
  doc.close();
4394
4391
  doc.open();
4395
- if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$2.DocumentType) {
4396
- 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") {
4392
+ if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType) {
4393
+ 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") {
4397
4394
  doc.write(
4398
4395
  '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
4399
4396
  );
@@ -4406,7 +4403,7 @@ function buildNodeWithSN(n2, options) {
4406
4403
  node2 = doc;
4407
4404
  }
4408
4405
  mirror2.add(node2, n2);
4409
- if ((n2.type === NodeType$2.Document || n2.type === NodeType$2.Element) && !skipChild) {
4406
+ if ((n2.type === NodeType$3.Document || n2.type === NodeType$3.Element) && !skipChild) {
4410
4407
  for (const childN of n2.childNodes) {
4411
4408
  const childNode = buildNodeWithSN(childN, {
4412
4409
  doc,
@@ -4422,7 +4419,7 @@ function buildNodeWithSN(n2, options) {
4422
4419
  }
4423
4420
  if (childN.isShadow && isElement(node2) && node2.shadowRoot) {
4424
4421
  node2.shadowRoot.appendChild(childNode);
4425
- } else if (n2.type === NodeType$2.Document && childN.type == NodeType$2.Element) {
4422
+ } else if (n2.type === NodeType$3.Document && childN.type == NodeType$3.Element) {
4426
4423
  const htmlElement = childNode;
4427
4424
  let body = null;
4428
4425
  htmlElement.childNodes.forEach((child) => {
@@ -4457,7 +4454,7 @@ function visit(mirror2, onVisit) {
4457
4454
  }
4458
4455
  function handleScroll(node2, mirror2) {
4459
4456
  const n2 = mirror2.getMeta(node2);
4460
- if ((n2 == null ? void 0 : n2.type) !== NodeType$2.Element) {
4457
+ if ((n2 == null ? void 0 : n2.type) !== NodeType$3.Element) {
4461
4458
  return;
4462
4459
  }
4463
4460
  const el = node2;
@@ -4505,15 +4502,6 @@ var __publicField22 = (obj, key, value) => __defNormalProp222(obj, typeof key !=
4505
4502
  var __defProp2222 = Object.defineProperty;
4506
4503
  var __defNormalProp2222 = (obj, key, value) => key in obj ? __defProp2222(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4507
4504
  var __publicField222 = (obj, key, value) => __defNormalProp2222(obj, typeof key !== "symbol" ? key + "" : key, value);
4508
- var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
4509
- NodeType2[NodeType2["Document"] = 0] = "Document";
4510
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
4511
- NodeType2[NodeType2["Element"] = 2] = "Element";
4512
- NodeType2[NodeType2["Text"] = 3] = "Text";
4513
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
4514
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
4515
- return NodeType2;
4516
- })(NodeType$1 || {});
4517
4505
  let Mirror$1 = class Mirror2 {
4518
4506
  constructor() {
4519
4507
  __publicField222(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -8125,6 +8113,15 @@ postcss$1.Input;
8125
8113
  postcss$1.Rule;
8126
8114
  postcss$1.Root;
8127
8115
  postcss$1.Node;
8116
+ var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
8117
+ NodeType2[NodeType2["Document"] = 0] = "Document";
8118
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
8119
+ NodeType2[NodeType2["Element"] = 2] = "Element";
8120
+ NodeType2[NodeType2["Text"] = 3] = "Text";
8121
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
8122
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
8123
+ return NodeType2;
8124
+ })(NodeType$1 || {});
8128
8125
  function parseCSSText(cssText) {
8129
8126
  const res = {};
8130
8127
  const listDelimiter = /;(?![^(]*\))/g;
@@ -8634,7 +8631,7 @@ function removeChild(parent, child) {
8634
8631
  child.parentNode = null;
8635
8632
  return child;
8636
8633
  }
8637
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
8634
+ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
8638
8635
  NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
8639
8636
  NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
8640
8637
  NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
@@ -8648,7 +8645,7 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
8648
8645
  NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
8649
8646
  NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
8650
8647
  return NodeType2;
8651
- })(NodeType || {});
8648
+ })(NodeType$2 || {});
8652
8649
  const NAMESPACES = {
8653
8650
  svg: "http://www.w3.org/2000/svg",
8654
8651
  "xlink:href": "http://www.w3.org/1999/xlink",
@@ -8880,7 +8877,13 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
8880
8877
  }
8881
8878
  };
8882
8879
  } else if (newTree.tagName === "IFRAME" && name === "srcdoc") continue;
8883
- else oldTree.setAttribute(name, newValue);
8880
+ else {
8881
+ try {
8882
+ oldTree.setAttribute(name, newValue);
8883
+ } catch (err) {
8884
+ console.warn(err);
8885
+ }
8886
+ }
8884
8887
  }
8885
8888
  for (const { name } of Array.from(oldAttributes))
8886
8889
  if (!(name in newAttributes)) oldTree.removeAttribute(name);
@@ -9201,7 +9204,7 @@ function getValidTagName(element2) {
9201
9204
  function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9202
9205
  let rrNode;
9203
9206
  switch (node2.nodeType) {
9204
- case NodeType.DOCUMENT_NODE:
9207
+ case NodeType$2.DOCUMENT_NODE:
9205
9208
  if (parentRRNode && parentRRNode.nodeName === "IFRAME")
9206
9209
  rrNode = parentRRNode.contentDocument;
9207
9210
  else {
@@ -9209,7 +9212,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9209
9212
  rrNode.compatMode = node2.compatMode;
9210
9213
  }
9211
9214
  break;
9212
- case NodeType.DOCUMENT_TYPE_NODE: {
9215
+ case NodeType$2.DOCUMENT_TYPE_NODE: {
9213
9216
  const documentType = node2;
9214
9217
  rrNode = rrdom.createDocumentType(
9215
9218
  documentType.name,
@@ -9218,7 +9221,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9218
9221
  );
9219
9222
  break;
9220
9223
  }
9221
- case NodeType.ELEMENT_NODE: {
9224
+ case NodeType$2.ELEMENT_NODE: {
9222
9225
  const elementNode = node2;
9223
9226
  const tagName = getValidTagName(elementNode);
9224
9227
  rrNode = rrdom.createElement(tagName);
@@ -9230,16 +9233,16 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9230
9233
  elementNode.scrollTop && (rrElement.scrollTop = elementNode.scrollTop);
9231
9234
  break;
9232
9235
  }
9233
- case NodeType.TEXT_NODE:
9236
+ case NodeType$2.TEXT_NODE:
9234
9237
  rrNode = rrdom.createTextNode(node2.textContent || "");
9235
9238
  break;
9236
- case NodeType.CDATA_SECTION_NODE:
9239
+ case NodeType$2.CDATA_SECTION_NODE:
9237
9240
  rrNode = rrdom.createCDATASection(node2.data);
9238
9241
  break;
9239
- case NodeType.COMMENT_NODE:
9242
+ case NodeType$2.COMMENT_NODE:
9240
9243
  rrNode = rrdom.createComment(node2.textContent || "");
9241
9244
  break;
9242
- case NodeType.DOCUMENT_FRAGMENT_NODE:
9245
+ case NodeType$2.DOCUMENT_FRAGMENT_NODE:
9243
9246
  rrNode = parentRRNode.attachShadow({ mode: "open" });
9244
9247
  break;
9245
9248
  default:
@@ -9262,7 +9265,7 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
9262
9265
  if (
9263
9266
  // if the parentRRNode isn't a RRIFrameElement
9264
9267
  (parentRRNode == null ? void 0 : parentRRNode.nodeName) !== "IFRAME" && // if node isn't a shadow root
9265
- node2.nodeType !== NodeType.DOCUMENT_FRAGMENT_NODE
9268
+ node2.nodeType !== NodeType$2.DOCUMENT_FRAGMENT_NODE
9266
9269
  ) {
9267
9270
  parentRRNode == null ? void 0 : parentRRNode.appendChild(rrNode);
9268
9271
  rrNode.parentNode = parentRRNode;
@@ -9271,8 +9274,8 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
9271
9274
  if (node2.nodeName === "IFRAME") {
9272
9275
  const iframeDoc = node2.contentDocument;
9273
9276
  iframeDoc && walk2(iframeDoc, rrNode);
9274
- } else if (node2.nodeType === NodeType.DOCUMENT_NODE || node2.nodeType === NodeType.ELEMENT_NODE || node2.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {
9275
- if (node2.nodeType === NodeType.ELEMENT_NODE && node2.shadowRoot)
9277
+ } else if (node2.nodeType === NodeType$2.DOCUMENT_NODE || node2.nodeType === NodeType$2.ELEMENT_NODE || node2.nodeType === NodeType$2.DOCUMENT_FRAGMENT_NODE) {
9278
+ if (node2.nodeType === NodeType$2.ELEMENT_NODE && node2.shadowRoot)
9276
9279
  walk2(node2.shadowRoot, rrNode);
9277
9280
  node2.childNodes.forEach((childNode) => walk2(childNode, rrNode));
9278
9281
  }
@@ -9396,6 +9399,9 @@ const testableMethods = {
9396
9399
  MutationObserver: ["constructor"]
9397
9400
  };
9398
9401
  const untaintedBasePrototype = {};
9402
+ const isAngularZonePresent = () => {
9403
+ return !!globalThis.Zone;
9404
+ };
9399
9405
  function getUntaintedPrototype(key) {
9400
9406
  if (untaintedBasePrototype[key])
9401
9407
  return untaintedBasePrototype[key];
@@ -9423,7 +9429,7 @@ function getUntaintedPrototype(key) {
9423
9429
  }
9424
9430
  )
9425
9431
  );
9426
- if (isUntaintedAccessors && isUntaintedMethods) {
9432
+ if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
9427
9433
  untaintedBasePrototype[key] = defaultObj.prototype;
9428
9434
  return defaultObj.prototype;
9429
9435
  }
@@ -9782,6 +9788,15 @@ var ReplayerEvents = /* @__PURE__ */ ((ReplayerEvents2) => {
9782
9788
  ReplayerEvents2["Destroy"] = "destroy";
9783
9789
  return ReplayerEvents2;
9784
9790
  })(ReplayerEvents || {});
9791
+ var NodeType = /* @__PURE__ */ ((NodeType2) => {
9792
+ NodeType2[NodeType2["Document"] = 0] = "Document";
9793
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
9794
+ NodeType2[NodeType2["Element"] = 2] = "Element";
9795
+ NodeType2[NodeType2["Text"] = 3] = "Text";
9796
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
9797
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
9798
+ return NodeType2;
9799
+ })(NodeType || {});
9785
9800
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
9786
9801
  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
9787
9802
  for (var i$1 = 0; i$1 < chars.length; i$1++) {
@@ -11588,6 +11603,9 @@ class Replayer {
11588
11603
  "html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"
11589
11604
  );
11590
11605
  }
11606
+ if (!injectStylesRules.length) {
11607
+ return;
11608
+ }
11591
11609
  if (this.usingVirtualDom) {
11592
11610
  const styleEl = this.virtualDom.createElement("style");
11593
11611
  this.virtualDom.mirror.add(
@@ -11622,7 +11640,7 @@ class Replayer {
11622
11640
  collectedDialogs.add(builtNode);
11623
11641
  this.collectIframeAndAttachDocument(collectedIframes, builtNode);
11624
11642
  const sn = mirror2.getMeta(builtNode);
11625
- if ((sn == null ? void 0 : sn.type) === NodeType$2.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
11643
+ if ((sn == null ? void 0 : sn.type) === NodeType.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
11626
11644
  const { documentElement, head } = iframeEl.contentDocument;
11627
11645
  this.insertStyleRules(
11628
11646
  documentElement,
@@ -12096,7 +12114,7 @@ class Replayer {
12096
12114
  mutation.parentId
12097
12115
  );
12098
12116
  if (!parent) {
12099
- if (mutation.node.type === NodeType$2.Document) {
12117
+ if (mutation.node.type === NodeType.Document) {
12100
12118
  return this.newDocumentQueue.push(mutation);
12101
12119
  }
12102
12120
  return queue.push(mutation);
@@ -12158,7 +12176,7 @@ class Replayer {
12158
12176
  return;
12159
12177
  }
12160
12178
  const parentSn = mirror2.getMeta(parent);
12161
- if (parentSn && parentSn.type === NodeType$2.Element && mutation.node.type === NodeType$2.Text) {
12179
+ if (parentSn && parentSn.type === NodeType.Element && mutation.node.type === NodeType.Text) {
12162
12180
  const prospectiveSiblings = Array.isArray(parent.childNodes) ? parent.childNodes : Array.from(parent.childNodes);
12163
12181
  if (parentSn.tagName === "textarea") {
12164
12182
  for (const c2 of prospectiveSiblings) {
@@ -12174,9 +12192,9 @@ class Replayer {
12174
12192
  }
12175
12193
  }
12176
12194
  }
12177
- } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType$2.Document) {
12195
+ } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType.Document) {
12178
12196
  const parentDoc = parent;
12179
- if (mutation.node.type === NodeType$2.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
12197
+ if (mutation.node.type === NodeType.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
12180
12198
  parentDoc.removeChild(parentDoc.childNodes[0]);
12181
12199
  if (target.nodeName === "HTML" && parentDoc.documentElement)
12182
12200
  parentDoc.removeChild(
@@ -12260,7 +12278,12 @@ class Replayer {
12260
12278
  }
12261
12279
  return this.warnNodeNotFound(d, mutation.id);
12262
12280
  }
12263
- target.textContent = mutation.value;
12281
+ const parentEl = target.parentElement;
12282
+ if (mutation.value && parentEl && parentEl.tagName === "STYLE") {
12283
+ target.textContent = adaptCssForReplay(mutation.value, this.cache);
12284
+ } else {
12285
+ target.textContent = mutation.value;
12286
+ }
12264
12287
  if (this.usingVirtualDom) {
12265
12288
  const parent = target.parentNode;
12266
12289
  if (((_a2 = parent == null ? void 0 : parent.rules) == null ? void 0 : _a2.length) > 0) parent.rules = [];
@@ -12377,7 +12400,7 @@ class Replayer {
12377
12400
  left: d.x,
12378
12401
  behavior: isSync ? "auto" : "smooth"
12379
12402
  });
12380
- } else if ((sn == null ? void 0 : sn.type) === NodeType$2.Document) {
12403
+ } else if ((sn == null ? void 0 : sn.type) === NodeType.Document) {
12381
12404
  (_b2 = target.defaultView) == null ? void 0 : _b2.scrollTo({
12382
12405
  top: d.y,
12383
12406
  left: d.x,