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

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.
@@ -403,7 +403,7 @@ var _a$1;
403
403
  var __defProp$1 = Object.defineProperty;
404
404
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
405
405
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
406
- var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
406
+ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
407
407
  NodeType2[NodeType2["Document"] = 0] = "Document";
408
408
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
409
409
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -411,7 +411,7 @@ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
411
411
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
412
412
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
413
413
  return NodeType2;
414
- })(NodeType$2 || {});
414
+ })(NodeType$3 || {});
415
415
  function isElement(n2) {
416
416
  return n2.nodeType === n2.ELEMENT_NODE;
417
417
  }
@@ -478,13 +478,13 @@ function toLowerCase(str) {
478
478
  }
479
479
  function isNodeMetaEqual(a2, b) {
480
480
  if (!a2 || !b || a2.type !== b.type) return false;
481
- if (a2.type === NodeType$2.Document)
481
+ if (a2.type === NodeType$3.Document)
482
482
  return a2.compatMode === b.compatMode;
483
- else if (a2.type === NodeType$2.DocumentType)
483
+ else if (a2.type === NodeType$3.DocumentType)
484
484
  return a2.name === b.name && a2.publicId === b.publicId && a2.systemId === b.systemId;
485
- else if (a2.type === NodeType$2.Comment || a2.type === NodeType$2.Text || a2.type === NodeType$2.CDATA)
485
+ else if (a2.type === NodeType$3.Comment || a2.type === NodeType$3.Text || a2.type === NodeType$3.CDATA)
486
486
  return a2.textContent === b.textContent;
487
- else if (a2.type === NodeType$2.Element)
487
+ else if (a2.type === NodeType$3.Element)
488
488
  return a2.tagName === b.tagName && JSON.stringify(a2.attributes) === JSON.stringify(b.attributes) && a2.isSVG === b.isSVG && a2.needBlock === b.needBlock;
489
489
  return false;
490
490
  }
@@ -514,41 +514,8 @@ const pseudoClassPlugin = {
514
514
  }
515
515
  fixed.push(rule2);
516
516
  rule2.selectors.forEach(function(selector) {
517
- if (!selector.includes(":")) {
518
- return;
519
- }
520
- const selectorParts = selector.replace(/\n/g, " ").split(" ");
521
- const pseudoedSelectorParts = [];
522
- selectorParts.forEach(function(selectorPart) {
523
- const pseudos = selectorPart.match(/::?([^:]+)/g);
524
- if (!pseudos) {
525
- pseudoedSelectorParts.push(selectorPart);
526
- return;
527
- }
528
- const baseSelector = selectorPart.substr(
529
- 0,
530
- selectorPart.length - pseudos.join("").length
531
- );
532
- const classPseudos = pseudos.map(function(pseudo) {
533
- const pseudoToCheck = pseudo.replace(/\(.*/g, "");
534
- if (pseudoToCheck !== ":hover") {
535
- return pseudo;
536
- }
537
- if (pseudo.match(/^::/)) {
538
- return pseudo;
539
- }
540
- pseudo = pseudo.substr(1);
541
- pseudo = pseudo.replace(/\(/g, "\\(");
542
- pseudo = pseudo.replace(/\)/g, "\\)");
543
- return ".\\:" + pseudo;
544
- });
545
- pseudoedSelectorParts.push(baseSelector + classPseudos.join(""));
546
- });
547
- addSelector(pseudoedSelectorParts.join(" "));
548
- function addSelector(newSelector) {
549
- if (newSelector && newSelector !== selector) {
550
- rule2.selector += ",\n" + newSelector;
551
- }
517
+ if (selector.includes(":hover")) {
518
+ rule2.selector += ",\n" + selector.replace(/:hover/g, ".\\:hover");
552
519
  }
553
520
  });
554
521
  }
@@ -4173,19 +4140,49 @@ function createCache() {
4173
4140
  stylesWithHoverClass
4174
4141
  };
4175
4142
  }
4143
+ function applyCssSplits(n2, cssText, hackCss, cache) {
4144
+ const childTextNodes = [];
4145
+ for (const scn of n2.childNodes) {
4146
+ if (scn.type === NodeType$3.Text) {
4147
+ childTextNodes.push(scn);
4148
+ }
4149
+ }
4150
+ const cssTextSplits = cssText.split("/* rr_split */");
4151
+ while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {
4152
+ cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(""));
4153
+ }
4154
+ for (let i2 = 0; i2 < childTextNodes.length; i2++) {
4155
+ const childTextNode = childTextNodes[i2];
4156
+ const cssTextSection = cssTextSplits[i2];
4157
+ if (childTextNode && cssTextSection) {
4158
+ childTextNode.textContent = hackCss ? adaptCssForReplay(cssTextSection, cache) : cssTextSection;
4159
+ }
4160
+ }
4161
+ }
4162
+ function buildStyleNode(n2, styleEl, cssText, options) {
4163
+ const { doc, hackCss, cache } = options;
4164
+ if (n2.childNodes.length) {
4165
+ applyCssSplits(n2, cssText, hackCss, cache);
4166
+ } else {
4167
+ if (hackCss) {
4168
+ cssText = adaptCssForReplay(cssText, cache);
4169
+ }
4170
+ styleEl.appendChild(doc.createTextNode(cssText));
4171
+ }
4172
+ }
4176
4173
  function buildNode(n2, options) {
4177
4174
  var _a2;
4178
4175
  const { doc, hackCss, cache } = options;
4179
4176
  switch (n2.type) {
4180
- case NodeType$2.Document:
4177
+ case NodeType$3.Document:
4181
4178
  return doc.implementation.createDocument(null, "", null);
4182
- case NodeType$2.DocumentType:
4179
+ case NodeType$3.DocumentType:
4183
4180
  return doc.implementation.createDocumentType(
4184
4181
  n2.name || "html",
4185
4182
  n2.publicId,
4186
4183
  n2.systemId
4187
4184
  );
4188
- case NodeType$2.Element: {
4185
+ case NodeType$3.Element: {
4189
4186
  const tagName = getTagName(n2);
4190
4187
  let node2;
4191
4188
  if (n2.isSVG) {
@@ -4221,12 +4218,11 @@ function buildNode(n2, options) {
4221
4218
  specialAttributes[name] = value;
4222
4219
  continue;
4223
4220
  }
4224
- const isTextarea = tagName === "textarea" && name === "value";
4225
- const isRemoteOrDynamicCss = tagName === "style" && name === "_cssText";
4226
- if (isRemoteOrDynamicCss && hackCss && typeof value === "string") {
4227
- value = adaptCssForReplay(value, cache);
4228
- }
4229
- if ((isTextarea || isRemoteOrDynamicCss) && typeof value === "string") {
4221
+ if (typeof value !== "string") ;
4222
+ else if (tagName === "style" && name === "_cssText") {
4223
+ buildStyleNode(n2, node2, value, options);
4224
+ continue;
4225
+ } else if (tagName === "textarea" && name === "value") {
4230
4226
  node2.appendChild(doc.createTextNode(value));
4231
4227
  n2.childNodes = [];
4232
4228
  continue;
@@ -4280,9 +4276,9 @@ function buildNode(n2, options) {
4280
4276
  }
4281
4277
  }
4282
4278
  if (name === "rr_width") {
4283
- node2.style.width = value.toString();
4279
+ node2.style.setProperty("width", value.toString());
4284
4280
  } else if (name === "rr_height") {
4285
- node2.style.height = value.toString();
4281
+ node2.style.setProperty("height", value.toString());
4286
4282
  } else if (name === "rr_mediaCurrentTime" && typeof value === "number") {
4287
4283
  node2.currentTime = value;
4288
4284
  } else if (name === "rr_mediaState") {
@@ -4320,13 +4316,14 @@ function buildNode(n2, options) {
4320
4316
  }
4321
4317
  return node2;
4322
4318
  }
4323
- case NodeType$2.Text:
4324
- return doc.createTextNode(
4325
- n2.isStyle && hackCss ? adaptCssForReplay(n2.textContent, cache) : n2.textContent
4326
- );
4327
- case NodeType$2.CDATA:
4319
+ case NodeType$3.Text:
4320
+ if (n2.isStyle && hackCss) {
4321
+ return doc.createTextNode(adaptCssForReplay(n2.textContent, cache));
4322
+ }
4323
+ return doc.createTextNode(n2.textContent);
4324
+ case NodeType$3.CDATA:
4328
4325
  return doc.createCDATASection(n2.textContent);
4329
- case NodeType$2.Comment:
4326
+ case NodeType$3.Comment:
4330
4327
  return doc.createComment(n2.textContent);
4331
4328
  default:
4332
4329
  return null;
@@ -4353,11 +4350,11 @@ function buildNodeWithSN(n2, options) {
4353
4350
  if (n2.rootId && mirror2.getNode(n2.rootId) !== doc) {
4354
4351
  mirror2.replace(n2.rootId, doc);
4355
4352
  }
4356
- if (n2.type === NodeType$2.Document) {
4353
+ if (n2.type === NodeType$3.Document) {
4357
4354
  doc.close();
4358
4355
  doc.open();
4359
- if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$2.DocumentType) {
4360
- 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") {
4356
+ if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType) {
4357
+ 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") {
4361
4358
  doc.write(
4362
4359
  '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
4363
4360
  );
@@ -4370,7 +4367,7 @@ function buildNodeWithSN(n2, options) {
4370
4367
  node2 = doc;
4371
4368
  }
4372
4369
  mirror2.add(node2, n2);
4373
- if ((n2.type === NodeType$2.Document || n2.type === NodeType$2.Element) && !skipChild) {
4370
+ if ((n2.type === NodeType$3.Document || n2.type === NodeType$3.Element) && !skipChild) {
4374
4371
  for (const childN of n2.childNodes) {
4375
4372
  const childNode = buildNodeWithSN(childN, {
4376
4373
  doc,
@@ -4386,7 +4383,7 @@ function buildNodeWithSN(n2, options) {
4386
4383
  }
4387
4384
  if (childN.isShadow && isElement(node2) && node2.shadowRoot) {
4388
4385
  node2.shadowRoot.appendChild(childNode);
4389
- } else if (n2.type === NodeType$2.Document && childN.type == NodeType$2.Element) {
4386
+ } else if (n2.type === NodeType$3.Document && childN.type == NodeType$3.Element) {
4390
4387
  const htmlElement = childNode;
4391
4388
  let body = null;
4392
4389
  htmlElement.childNodes.forEach((child) => {
@@ -4421,7 +4418,7 @@ function visit(mirror2, onVisit) {
4421
4418
  }
4422
4419
  function handleScroll(node2, mirror2) {
4423
4420
  const n2 = mirror2.getMeta(node2);
4424
- if ((n2 == null ? void 0 : n2.type) !== NodeType$2.Element) {
4421
+ if ((n2 == null ? void 0 : n2.type) !== NodeType$3.Element) {
4425
4422
  return;
4426
4423
  }
4427
4424
  const el = node2;
@@ -4469,15 +4466,6 @@ var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !==
4469
4466
  var __defProp222 = Object.defineProperty;
4470
4467
  var __defNormalProp222 = (obj, key, value) => key in obj ? __defProp222(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4471
4468
  var __publicField222 = (obj, key, value) => __defNormalProp222(obj, typeof key !== "symbol" ? key + "" : key, value);
4472
- var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
4473
- NodeType2[NodeType2["Document"] = 0] = "Document";
4474
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
4475
- NodeType2[NodeType2["Element"] = 2] = "Element";
4476
- NodeType2[NodeType2["Text"] = 3] = "Text";
4477
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
4478
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
4479
- return NodeType2;
4480
- })(NodeType$1 || {});
4481
4469
  let Mirror$1 = class Mirror2 {
4482
4470
  constructor() {
4483
4471
  __publicField222(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -8085,6 +8073,15 @@ postcss$1.Input;
8085
8073
  postcss$1.Rule;
8086
8074
  postcss$1.Root;
8087
8075
  postcss$1.Node;
8076
+ var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
8077
+ NodeType2[NodeType2["Document"] = 0] = "Document";
8078
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
8079
+ NodeType2[NodeType2["Element"] = 2] = "Element";
8080
+ NodeType2[NodeType2["Text"] = 3] = "Text";
8081
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
8082
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
8083
+ return NodeType2;
8084
+ })(NodeType$1 || {});
8088
8085
  function parseCSSText(cssText) {
8089
8086
  const res = {};
8090
8087
  const listDelimiter = /;(?![^(]*\))/g;
@@ -8594,7 +8591,7 @@ function removeChild(parent, child) {
8594
8591
  child.parentNode = null;
8595
8592
  return child;
8596
8593
  }
8597
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
8594
+ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
8598
8595
  NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
8599
8596
  NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
8600
8597
  NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
@@ -8608,7 +8605,7 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
8608
8605
  NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
8609
8606
  NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
8610
8607
  return NodeType2;
8611
- })(NodeType || {});
8608
+ })(NodeType$2 || {});
8612
8609
  const NAMESPACES = {
8613
8610
  svg: "http://www.w3.org/2000/svg",
8614
8611
  "xlink:href": "http://www.w3.org/1999/xlink",
@@ -8840,7 +8837,13 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
8840
8837
  }
8841
8838
  };
8842
8839
  } else if (newTree.tagName === "IFRAME" && name === "srcdoc") continue;
8843
- else oldTree.setAttribute(name, newValue);
8840
+ else {
8841
+ try {
8842
+ oldTree.setAttribute(name, newValue);
8843
+ } catch (err) {
8844
+ console.warn(err);
8845
+ }
8846
+ }
8844
8847
  }
8845
8848
  for (const { name } of Array.from(oldAttributes))
8846
8849
  if (!(name in newAttributes)) oldTree.removeAttribute(name);
@@ -9161,7 +9164,7 @@ function getValidTagName(element2) {
9161
9164
  function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9162
9165
  let rrNode;
9163
9166
  switch (node2.nodeType) {
9164
- case NodeType.DOCUMENT_NODE:
9167
+ case NodeType$2.DOCUMENT_NODE:
9165
9168
  if (parentRRNode && parentRRNode.nodeName === "IFRAME")
9166
9169
  rrNode = parentRRNode.contentDocument;
9167
9170
  else {
@@ -9169,7 +9172,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9169
9172
  rrNode.compatMode = node2.compatMode;
9170
9173
  }
9171
9174
  break;
9172
- case NodeType.DOCUMENT_TYPE_NODE: {
9175
+ case NodeType$2.DOCUMENT_TYPE_NODE: {
9173
9176
  const documentType = node2;
9174
9177
  rrNode = rrdom.createDocumentType(
9175
9178
  documentType.name,
@@ -9178,7 +9181,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9178
9181
  );
9179
9182
  break;
9180
9183
  }
9181
- case NodeType.ELEMENT_NODE: {
9184
+ case NodeType$2.ELEMENT_NODE: {
9182
9185
  const elementNode = node2;
9183
9186
  const tagName = getValidTagName(elementNode);
9184
9187
  rrNode = rrdom.createElement(tagName);
@@ -9190,16 +9193,16 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
9190
9193
  elementNode.scrollTop && (rrElement.scrollTop = elementNode.scrollTop);
9191
9194
  break;
9192
9195
  }
9193
- case NodeType.TEXT_NODE:
9196
+ case NodeType$2.TEXT_NODE:
9194
9197
  rrNode = rrdom.createTextNode(node2.textContent || "");
9195
9198
  break;
9196
- case NodeType.CDATA_SECTION_NODE:
9199
+ case NodeType$2.CDATA_SECTION_NODE:
9197
9200
  rrNode = rrdom.createCDATASection(node2.data);
9198
9201
  break;
9199
- case NodeType.COMMENT_NODE:
9202
+ case NodeType$2.COMMENT_NODE:
9200
9203
  rrNode = rrdom.createComment(node2.textContent || "");
9201
9204
  break;
9202
- case NodeType.DOCUMENT_FRAGMENT_NODE:
9205
+ case NodeType$2.DOCUMENT_FRAGMENT_NODE:
9203
9206
  rrNode = parentRRNode.attachShadow({ mode: "open" });
9204
9207
  break;
9205
9208
  default:
@@ -9222,7 +9225,7 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
9222
9225
  if (
9223
9226
  // if the parentRRNode isn't a RRIFrameElement
9224
9227
  (parentRRNode == null ? void 0 : parentRRNode.nodeName) !== "IFRAME" && // if node isn't a shadow root
9225
- node2.nodeType !== NodeType.DOCUMENT_FRAGMENT_NODE
9228
+ node2.nodeType !== NodeType$2.DOCUMENT_FRAGMENT_NODE
9226
9229
  ) {
9227
9230
  parentRRNode == null ? void 0 : parentRRNode.appendChild(rrNode);
9228
9231
  rrNode.parentNode = parentRRNode;
@@ -9231,8 +9234,8 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
9231
9234
  if (node2.nodeName === "IFRAME") {
9232
9235
  const iframeDoc = node2.contentDocument;
9233
9236
  iframeDoc && walk2(iframeDoc, rrNode);
9234
- } else if (node2.nodeType === NodeType.DOCUMENT_NODE || node2.nodeType === NodeType.ELEMENT_NODE || node2.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {
9235
- if (node2.nodeType === NodeType.ELEMENT_NODE && node2.shadowRoot)
9237
+ } else if (node2.nodeType === NodeType$2.DOCUMENT_NODE || node2.nodeType === NodeType$2.ELEMENT_NODE || node2.nodeType === NodeType$2.DOCUMENT_FRAGMENT_NODE) {
9238
+ if (node2.nodeType === NodeType$2.ELEMENT_NODE && node2.shadowRoot)
9236
9239
  walk2(node2.shadowRoot, rrNode);
9237
9240
  node2.childNodes.forEach((childNode) => walk2(childNode, rrNode));
9238
9241
  }
@@ -9356,6 +9359,9 @@ const testableMethods = {
9356
9359
  MutationObserver: ["constructor"]
9357
9360
  };
9358
9361
  const untaintedBasePrototype = {};
9362
+ const isAngularZonePresent = () => {
9363
+ return !!globalThis.Zone;
9364
+ };
9359
9365
  function getUntaintedPrototype(key) {
9360
9366
  if (untaintedBasePrototype[key])
9361
9367
  return untaintedBasePrototype[key];
@@ -9383,7 +9389,7 @@ function getUntaintedPrototype(key) {
9383
9389
  }
9384
9390
  )
9385
9391
  );
9386
- if (isUntaintedAccessors && isUntaintedMethods) {
9392
+ if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
9387
9393
  untaintedBasePrototype[key] = defaultObj.prototype;
9388
9394
  return defaultObj.prototype;
9389
9395
  }
@@ -9741,6 +9747,15 @@ var ReplayerEvents = /* @__PURE__ */ ((ReplayerEvents2) => {
9741
9747
  ReplayerEvents2["Destroy"] = "destroy";
9742
9748
  return ReplayerEvents2;
9743
9749
  })(ReplayerEvents || {});
9750
+ var NodeType = /* @__PURE__ */ ((NodeType2) => {
9751
+ NodeType2[NodeType2["Document"] = 0] = "Document";
9752
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
9753
+ NodeType2[NodeType2["Element"] = 2] = "Element";
9754
+ NodeType2[NodeType2["Text"] = 3] = "Text";
9755
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
9756
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
9757
+ return NodeType2;
9758
+ })(NodeType || {});
9744
9759
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
9745
9760
  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
9746
9761
  for (var i$1 = 0; i$1 < chars.length; i$1++) {
@@ -11548,6 +11563,9 @@ class Replayer {
11548
11563
  "html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"
11549
11564
  );
11550
11565
  }
11566
+ if (!injectStylesRules.length) {
11567
+ return;
11568
+ }
11551
11569
  if (this.usingVirtualDom) {
11552
11570
  const styleEl = this.virtualDom.createElement("style");
11553
11571
  this.virtualDom.mirror.add(
@@ -11582,7 +11600,7 @@ class Replayer {
11582
11600
  collectedDialogs.add(builtNode);
11583
11601
  this.collectIframeAndAttachDocument(collectedIframes, builtNode);
11584
11602
  const sn = mirror2.getMeta(builtNode);
11585
- if ((sn == null ? void 0 : sn.type) === NodeType$2.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
11603
+ if ((sn == null ? void 0 : sn.type) === NodeType.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
11586
11604
  const { documentElement, head } = iframeEl.contentDocument;
11587
11605
  this.insertStyleRules(
11588
11606
  documentElement,
@@ -12058,7 +12076,7 @@ class Replayer {
12058
12076
  mutation.parentId
12059
12077
  );
12060
12078
  if (!parent) {
12061
- if (mutation.node.type === NodeType$2.Document) {
12079
+ if (mutation.node.type === NodeType.Document) {
12062
12080
  return this.newDocumentQueue.push(mutation);
12063
12081
  }
12064
12082
  return queue.push(mutation);
@@ -12120,7 +12138,7 @@ class Replayer {
12120
12138
  return;
12121
12139
  }
12122
12140
  const parentSn = mirror2.getMeta(parent);
12123
- if (parentSn && parentSn.type === NodeType$2.Element && mutation.node.type === NodeType$2.Text) {
12141
+ if (parentSn && parentSn.type === NodeType.Element && mutation.node.type === NodeType.Text) {
12124
12142
  const prospectiveSiblings = Array.isArray(parent.childNodes) ? parent.childNodes : Array.from(parent.childNodes);
12125
12143
  if (parentSn.tagName === "textarea") {
12126
12144
  for (const c2 of prospectiveSiblings) {
@@ -12136,9 +12154,9 @@ class Replayer {
12136
12154
  }
12137
12155
  }
12138
12156
  }
12139
- } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType$2.Document) {
12157
+ } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType.Document) {
12140
12158
  const parentDoc = parent;
12141
- if (mutation.node.type === NodeType$2.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
12159
+ if (mutation.node.type === NodeType.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
12142
12160
  parentDoc.removeChild(parentDoc.childNodes[0]);
12143
12161
  if (target.nodeName === "HTML" && parentDoc.documentElement)
12144
12162
  parentDoc.removeChild(
@@ -12222,7 +12240,12 @@ class Replayer {
12222
12240
  }
12223
12241
  return this.warnNodeNotFound(d, mutation.id);
12224
12242
  }
12225
- target.textContent = mutation.value;
12243
+ const parentEl = target.parentElement;
12244
+ if (mutation.value && parentEl && parentEl.tagName === "STYLE") {
12245
+ target.textContent = adaptCssForReplay(mutation.value, this.cache);
12246
+ } else {
12247
+ target.textContent = mutation.value;
12248
+ }
12226
12249
  if (this.usingVirtualDom) {
12227
12250
  const parent = target.parentNode;
12228
12251
  if (((_a2 = parent == null ? void 0 : parent.rules) == null ? void 0 : _a2.length) > 0) parent.rules = [];
@@ -12339,7 +12362,7 @@ class Replayer {
12339
12362
  left: d.x,
12340
12363
  behavior: isSync ? "auto" : "smooth"
12341
12364
  });
12342
- } else if ((sn == null ? void 0 : sn.type) === NodeType$2.Document) {
12365
+ } else if ((sn == null ? void 0 : sn.type) === NodeType.Document) {
12343
12366
  (_b2 = target.defaultView) == null ? void 0 : _b2.scrollTo({
12344
12367
  top: d.y,
12345
12368
  left: d.x,