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