@sylphx/sdk 0.15.3 → 0.15.4

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.
@@ -4872,12 +4872,12 @@ function MembersListInner({
4872
4872
  setPendingAction(userId);
4873
4873
  setEditingMember(null);
4874
4874
  setIsPending(true);
4875
- const snapshot2 = [...members];
4875
+ const snapshot = [...members];
4876
4876
  setMembers((prev) => prev.map((m2) => m2.userId === userId ? { ...m2, role: newRole } : m2));
4877
4877
  try {
4878
4878
  await updateMemberRole(userId, newRole);
4879
4879
  } catch (err) {
4880
- setMembers(snapshot2);
4880
+ setMembers(snapshot);
4881
4881
  const message = err instanceof Error ? err.message : "Failed to update role";
4882
4882
  setError(message);
4883
4883
  } finally {
@@ -4895,12 +4895,12 @@ function MembersListInner({
4895
4895
  setPendingAction(userId);
4896
4896
  setConfirmingRemove(null);
4897
4897
  setIsPending(true);
4898
- const snapshot2 = [...members];
4898
+ const snapshot = [...members];
4899
4899
  setMembers((prev) => prev.filter((m2) => m2.userId !== userId));
4900
4900
  try {
4901
4901
  await removeMember(userId);
4902
4902
  } catch (err) {
4903
- setMembers(snapshot2);
4903
+ setMembers(snapshot);
4904
4904
  const message = err instanceof Error ? err.message : "Failed to remove member";
4905
4905
  setError(message);
4906
4906
  } finally {
@@ -27955,8 +27955,8 @@ function extractUrl(input) {
27955
27955
  return input.url;
27956
27956
  }
27957
27957
  function notify(set, event) {
27958
- const snapshot2 = Array.from(set);
27959
- for (const listener of snapshot2) {
27958
+ const snapshot = Array.from(set);
27959
+ for (const listener of snapshot) {
27960
27960
  try {
27961
27961
  listener(event);
27962
27962
  } catch {
@@ -29435,3275 +29435,16 @@ var ScrollThrashingDetector = class {
29435
29435
  }
29436
29436
  };
29437
29437
 
29438
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js
29439
- var __assign = function() {
29440
- __assign = Object.assign || function __assign2(t2) {
29441
- for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
29442
- s2 = arguments[i2];
29443
- for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2];
29444
- }
29445
- return t2;
29446
- };
29447
- return __assign.apply(this, arguments);
29448
- };
29449
- function __rest(s2, e2) {
29450
- var t2 = {};
29451
- for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
29452
- t2[p2] = s2[p2];
29453
- if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
29454
- for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
29455
- if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
29456
- t2[p2[i2]] = s2[p2[i2]];
29457
- }
29458
- return t2;
29459
- }
29460
- function __values(o2) {
29461
- var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
29462
- if (m2) return m2.call(o2);
29463
- if (o2 && typeof o2.length === "number") return {
29464
- next: function() {
29465
- if (o2 && i2 >= o2.length) o2 = void 0;
29466
- return { value: o2 && o2[i2++], done: !o2 };
29467
- }
29468
- };
29469
- throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
29470
- }
29471
- function __read(o2, n2) {
29472
- var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
29473
- if (!m2) return o2;
29474
- var i2 = m2.call(o2), r2, ar = [], e2;
29475
- try {
29476
- while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done) ar.push(r2.value);
29477
- } catch (error) {
29478
- e2 = { error };
29479
- } finally {
29480
- try {
29481
- if (r2 && !r2.done && (m2 = i2["return"])) m2.call(i2);
29482
- } finally {
29483
- if (e2) throw e2.error;
29484
- }
29485
- }
29486
- return ar;
29487
- }
29488
- function __spreadArray(to, from, pack) {
29489
- if (pack || arguments.length === 2) for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) {
29490
- if (ar || !(i2 in from)) {
29491
- if (!ar) ar = Array.prototype.slice.call(from, 0, i2);
29492
- ar[i2] = from[i2];
29493
- }
29494
- }
29495
- return to.concat(ar || Array.prototype.slice.call(from));
29496
- }
29497
-
29498
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
29499
- var NodeType;
29500
- (function(NodeType2) {
29501
- NodeType2[NodeType2["Document"] = 0] = "Document";
29502
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
29503
- NodeType2[NodeType2["Element"] = 2] = "Element";
29504
- NodeType2[NodeType2["Text"] = 3] = "Text";
29505
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
29506
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
29507
- })(NodeType || (NodeType = {}));
29508
- function isElement(n2) {
29509
- return n2.nodeType === n2.ELEMENT_NODE;
29510
- }
29511
- function isShadowRoot(n2) {
29512
- var _a;
29513
- var host = (_a = n2) === null || _a === void 0 ? void 0 : _a.host;
29514
- return Boolean(host && host.shadowRoot && host.shadowRoot === n2);
29515
- }
29516
- function maskInputValue(_a) {
29517
- var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;
29518
- var text = value || "";
29519
- if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {
29520
- if (maskInputFn) {
29521
- text = maskInputFn(text);
29522
- } else {
29523
- text = "*".repeat(text.length);
29524
- }
29525
- }
29526
- return text;
29527
- }
29528
- var ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
29529
- function is2DCanvasBlank(canvas) {
29530
- var ctx = canvas.getContext("2d");
29531
- if (!ctx)
29532
- return true;
29533
- var chunkSize = 50;
29534
- for (var x2 = 0; x2 < canvas.width; x2 += chunkSize) {
29535
- for (var y2 = 0; y2 < canvas.height; y2 += chunkSize) {
29536
- var getImageData = ctx.getImageData;
29537
- var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
29538
- var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas.width - x2), Math.min(chunkSize, canvas.height - y2)).data.buffer);
29539
- if (pixelBuffer.some(function(pixel) {
29540
- return pixel !== 0;
29541
- }))
29542
- return false;
29543
- }
29544
- }
29545
- return true;
29546
- }
29547
- var _id = 1;
29548
- var tagNameRegex = new RegExp("[^a-z0-9-_:]");
29549
- var IGNORED_NODE = -2;
29550
- function genId() {
29551
- return _id++;
29552
- }
29553
- function getValidTagName(element) {
29554
- if (element instanceof HTMLFormElement) {
29555
- return "form";
29556
- }
29557
- var processedTagName = element.tagName.toLowerCase().trim();
29558
- if (tagNameRegex.test(processedTagName)) {
29559
- return "div";
29560
- }
29561
- return processedTagName;
29562
- }
29563
- function getCssRulesString(s2) {
29564
- try {
29565
- var rules = s2.rules || s2.cssRules;
29566
- return rules ? Array.from(rules).map(getCssRuleString).join("") : null;
29567
- } catch (error) {
29568
- return null;
29569
- }
29570
- }
29571
- function getCssRuleString(rule) {
29572
- var cssStringified = rule.cssText;
29573
- if (isCSSImportRule(rule)) {
29574
- try {
29575
- cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
29576
- } catch (_a) {
29577
- }
29578
- }
29579
- return cssStringified;
29580
- }
29581
- function isCSSImportRule(rule) {
29582
- return "styleSheet" in rule;
29583
- }
29584
- function stringifyStyleSheet(sheet) {
29585
- return sheet.cssRules ? Array.from(sheet.cssRules).map(function(rule) {
29586
- return rule.cssText || "";
29587
- }).join("") : "";
29588
- }
29589
- function extractOrigin(url) {
29590
- var origin = "";
29591
- if (url.indexOf("//") > -1) {
29592
- origin = url.split("/").slice(0, 3).join("/");
29593
- } else {
29594
- origin = url.split("/")[0];
29595
- }
29596
- origin = origin.split("?")[0];
29597
- return origin;
29598
- }
29599
- var canvasService;
29600
- var canvasCtx;
29601
- var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
29602
- var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
29603
- var DATA_URI = /^(data:)([^,]*),(.*)/i;
29604
- function absoluteToStylesheet(cssText, href) {
29605
- return (cssText || "").replace(URL_IN_CSS_REF, function(origin, quote1, path1, quote2, path2, path3) {
29606
- var filePath = path1 || path2 || path3;
29607
- var maybeQuote = quote1 || quote2 || "";
29608
- if (!filePath) {
29609
- return origin;
29610
- }
29611
- if (!RELATIVE_PATH.test(filePath)) {
29612
- return "url(" + maybeQuote + filePath + maybeQuote + ")";
29613
- }
29614
- if (DATA_URI.test(filePath)) {
29615
- return "url(" + maybeQuote + filePath + maybeQuote + ")";
29616
- }
29617
- if (filePath[0] === "/") {
29618
- return "url(" + maybeQuote + (extractOrigin(href) + filePath) + maybeQuote + ")";
29619
- }
29620
- var stack = href.split("/");
29621
- var parts = filePath.split("/");
29622
- stack.pop();
29623
- for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
29624
- var part = parts_1[_i];
29625
- if (part === ".") {
29626
- continue;
29627
- } else if (part === "..") {
29628
- stack.pop();
29629
- } else {
29630
- stack.push(part);
29631
- }
29632
- }
29633
- return "url(" + maybeQuote + stack.join("/") + maybeQuote + ")";
29634
- });
29635
- }
29636
- var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
29637
- var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
29638
- function getAbsoluteSrcsetString(doc, attributeValue) {
29639
- if (attributeValue.trim() === "") {
29640
- return attributeValue;
29641
- }
29642
- var pos = 0;
29643
- function collectCharacters(regEx) {
29644
- var chars2;
29645
- var match = regEx.exec(attributeValue.substring(pos));
29646
- if (match) {
29647
- chars2 = match[0];
29648
- pos += chars2.length;
29649
- return chars2;
29650
- }
29651
- return "";
29652
- }
29653
- var output = [];
29654
- while (true) {
29655
- collectCharacters(SRCSET_COMMAS_OR_SPACES);
29656
- if (pos >= attributeValue.length) {
29657
- break;
29658
- }
29659
- var url = collectCharacters(SRCSET_NOT_SPACES);
29660
- if (url.slice(-1) === ",") {
29661
- url = absoluteToDoc(doc, url.substring(0, url.length - 1));
29662
- output.push(url);
29663
- } else {
29664
- var descriptorsStr = "";
29665
- url = absoluteToDoc(doc, url);
29666
- var inParens = false;
29667
- while (true) {
29668
- var c2 = attributeValue.charAt(pos);
29669
- if (c2 === "") {
29670
- output.push((url + descriptorsStr).trim());
29671
- break;
29672
- } else if (!inParens) {
29673
- if (c2 === ",") {
29674
- pos += 1;
29675
- output.push((url + descriptorsStr).trim());
29676
- break;
29677
- } else if (c2 === "(") {
29678
- inParens = true;
29679
- }
29680
- } else {
29681
- if (c2 === ")") {
29682
- inParens = false;
29683
- }
29684
- }
29685
- descriptorsStr += c2;
29686
- pos += 1;
29687
- }
29688
- }
29689
- }
29690
- return output.join(", ");
29691
- }
29692
- function absoluteToDoc(doc, attributeValue) {
29693
- if (!attributeValue || attributeValue.trim() === "") {
29694
- return attributeValue;
29695
- }
29696
- var a2 = doc.createElement("a");
29697
- a2.href = attributeValue;
29698
- return a2.href;
29699
- }
29700
- function isSVGElement(el) {
29701
- return Boolean(el.tagName === "svg" || el.ownerSVGElement);
29702
- }
29703
- function getHref() {
29704
- var a2 = document.createElement("a");
29705
- a2.href = "";
29706
- return a2.href;
29707
- }
29708
- function transformAttribute(doc, tagName, name, value) {
29709
- if (name === "src" || name === "href" && value) {
29710
- return absoluteToDoc(doc, value);
29711
- } else if (name === "xlink:href" && value && value[0] !== "#") {
29712
- return absoluteToDoc(doc, value);
29713
- } else if (name === "background" && value && (tagName === "table" || tagName === "td" || tagName === "th")) {
29714
- return absoluteToDoc(doc, value);
29715
- } else if (name === "srcset" && value) {
29716
- return getAbsoluteSrcsetString(doc, value);
29717
- } else if (name === "style" && value) {
29718
- return absoluteToStylesheet(value, getHref());
29719
- } else if (tagName === "object" && name === "data" && value) {
29720
- return absoluteToDoc(doc, value);
29721
- } else {
29722
- return value;
29723
- }
29724
- }
29725
- function _isBlockedElement(element, blockClass, blockSelector) {
29726
- if (typeof blockClass === "string") {
29727
- if (element.classList.contains(blockClass)) {
29728
- return true;
29729
- }
29730
- } else {
29731
- for (var eIndex = 0; eIndex < element.classList.length; eIndex++) {
29732
- var className = element.classList[eIndex];
29733
- if (blockClass.test(className)) {
29734
- return true;
29735
- }
29736
- }
29737
- }
29738
- if (blockSelector) {
29739
- return element.matches(blockSelector);
29740
- }
29741
- return false;
29742
- }
29743
- function needMaskingText(node, maskTextClass, maskTextSelector) {
29744
- if (!node) {
29745
- return false;
29746
- }
29747
- if (node.nodeType === node.ELEMENT_NODE) {
29748
- if (typeof maskTextClass === "string") {
29749
- if (node.classList.contains(maskTextClass)) {
29750
- return true;
29751
- }
29752
- } else {
29753
- for (var eIndex = 0; eIndex < node.classList.length; eIndex++) {
29754
- var className = node.classList[eIndex];
29755
- if (maskTextClass.test(className)) {
29756
- return true;
29757
- }
29758
- }
29759
- }
29760
- if (maskTextSelector) {
29761
- if (node.matches(maskTextSelector)) {
29762
- return true;
29763
- }
29764
- }
29765
- return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
29766
- }
29767
- if (node.nodeType === node.TEXT_NODE) {
29768
- return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
29769
- }
29770
- return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
29771
- }
29772
- function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
29773
- var win = iframeEl.contentWindow;
29774
- if (!win) {
29775
- return;
29776
- }
29777
- var fired = false;
29778
- var readyState;
29779
- try {
29780
- readyState = win.document.readyState;
29781
- } catch (error) {
29782
- return;
29783
- }
29784
- if (readyState !== "complete") {
29785
- var timer_1 = setTimeout(function() {
29786
- if (!fired) {
29787
- listener();
29788
- fired = true;
29789
- }
29790
- }, iframeLoadTimeout);
29791
- iframeEl.addEventListener("load", function() {
29792
- clearTimeout(timer_1);
29793
- fired = true;
29794
- listener();
29795
- });
29796
- return;
29797
- }
29798
- var blankUrl = "about:blank";
29799
- if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
29800
- setTimeout(listener, 0);
29801
- return;
29802
- }
29803
- iframeEl.addEventListener("load", listener);
29804
- }
29805
- function serializeNode(n2, options) {
29806
- var _a;
29807
- var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn;
29808
- var rootId;
29809
- if (doc.__sn) {
29810
- var docId = doc.__sn.id;
29811
- rootId = docId === 1 ? void 0 : docId;
29812
- }
29813
- switch (n2.nodeType) {
29814
- case n2.DOCUMENT_NODE:
29815
- if (n2.compatMode !== "CSS1Compat") {
29816
- return {
29817
- type: NodeType.Document,
29818
- childNodes: [],
29819
- compatMode: n2.compatMode,
29820
- rootId
29821
- };
29822
- } else {
29823
- return {
29824
- type: NodeType.Document,
29825
- childNodes: [],
29826
- rootId
29827
- };
29828
- }
29829
- case n2.DOCUMENT_TYPE_NODE:
29830
- return {
29831
- type: NodeType.DocumentType,
29832
- name: n2.name,
29833
- publicId: n2.publicId,
29834
- systemId: n2.systemId,
29835
- rootId
29836
- };
29837
- case n2.ELEMENT_NODE:
29838
- var needBlock = _isBlockedElement(n2, blockClass, blockSelector);
29839
- var tagName = getValidTagName(n2);
29840
- var attributes_1 = {};
29841
- for (var _i = 0, _d = Array.from(n2.attributes); _i < _d.length; _i++) {
29842
- var _e = _d[_i], name_1 = _e.name, value = _e.value;
29843
- attributes_1[name_1] = transformAttribute(doc, tagName, name_1, value);
29844
- }
29845
- if (tagName === "link" && inlineStylesheet) {
29846
- var stylesheet = Array.from(doc.styleSheets).find(function(s2) {
29847
- return s2.href === n2.href;
29848
- });
29849
- var cssText = null;
29850
- if (stylesheet) {
29851
- cssText = getCssRulesString(stylesheet);
29852
- }
29853
- if (cssText) {
29854
- delete attributes_1.rel;
29855
- delete attributes_1.href;
29856
- attributes_1._cssText = absoluteToStylesheet(cssText, stylesheet.href);
29857
- }
29858
- }
29859
- if (tagName === "style" && n2.sheet && !(n2.innerText || n2.textContent || "").trim().length) {
29860
- var cssText = getCssRulesString(n2.sheet);
29861
- if (cssText) {
29862
- attributes_1._cssText = absoluteToStylesheet(cssText, getHref());
29863
- }
29864
- }
29865
- if (tagName === "input" || tagName === "textarea" || tagName === "select") {
29866
- var value = n2.value;
29867
- if (attributes_1.type !== "radio" && attributes_1.type !== "checkbox" && attributes_1.type !== "submit" && attributes_1.type !== "button" && value) {
29868
- attributes_1.value = maskInputValue({
29869
- type: attributes_1.type,
29870
- tagName,
29871
- value,
29872
- maskInputOptions,
29873
- maskInputFn
29874
- });
29875
- } else if (n2.checked) {
29876
- attributes_1.checked = n2.checked;
29877
- }
29878
- }
29879
- if (tagName === "option") {
29880
- if (n2.selected && !maskInputOptions["select"]) {
29881
- attributes_1.selected = true;
29882
- } else {
29883
- delete attributes_1.selected;
29884
- }
29885
- }
29886
- if (tagName === "canvas" && recordCanvas) {
29887
- if (n2.__context === "2d") {
29888
- if (!is2DCanvasBlank(n2)) {
29889
- attributes_1.rr_dataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality);
29890
- }
29891
- } else if (!("__context" in n2)) {
29892
- var canvasDataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality);
29893
- var blankCanvas = document.createElement("canvas");
29894
- blankCanvas.width = n2.width;
29895
- blankCanvas.height = n2.height;
29896
- var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
29897
- if (canvasDataURL !== blankCanvasDataURL) {
29898
- attributes_1.rr_dataURL = canvasDataURL;
29899
- }
29900
- }
29901
- }
29902
- if (tagName === "img" && inlineImages) {
29903
- if (!canvasService) {
29904
- canvasService = doc.createElement("canvas");
29905
- canvasCtx = canvasService.getContext("2d");
29906
- }
29907
- var image_1 = n2;
29908
- var oldValue_1 = image_1.crossOrigin;
29909
- image_1.crossOrigin = "anonymous";
29910
- var recordInlineImage = function() {
29911
- try {
29912
- canvasService.width = image_1.naturalWidth;
29913
- canvasService.height = image_1.naturalHeight;
29914
- canvasCtx.drawImage(image_1, 0, 0);
29915
- attributes_1.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
29916
- } catch (err) {
29917
- console.warn("Cannot inline img src=" + image_1.currentSrc + "! Error: " + err);
29918
- }
29919
- oldValue_1 ? attributes_1.crossOrigin = oldValue_1 : delete attributes_1.crossOrigin;
29920
- };
29921
- if (image_1.complete && image_1.naturalWidth !== 0)
29922
- recordInlineImage();
29923
- else
29924
- image_1.onload = recordInlineImage;
29925
- }
29926
- if (tagName === "audio" || tagName === "video") {
29927
- attributes_1.rr_mediaState = n2.paused ? "paused" : "played";
29928
- attributes_1.rr_mediaCurrentTime = n2.currentTime;
29929
- }
29930
- if (n2.scrollLeft) {
29931
- attributes_1.rr_scrollLeft = n2.scrollLeft;
29932
- }
29933
- if (n2.scrollTop) {
29934
- attributes_1.rr_scrollTop = n2.scrollTop;
29935
- }
29936
- if (needBlock) {
29937
- var _f = n2.getBoundingClientRect(), width = _f.width, height = _f.height;
29938
- attributes_1 = {
29939
- "class": attributes_1["class"],
29940
- rr_width: width + "px",
29941
- rr_height: height + "px"
29942
- };
29943
- }
29944
- if (tagName === "iframe" && !keepIframeSrcFn(attributes_1.src)) {
29945
- if (!n2.contentDocument) {
29946
- attributes_1.rr_src = attributes_1.src;
29947
- }
29948
- delete attributes_1.src;
29949
- }
29950
- return {
29951
- type: NodeType.Element,
29952
- tagName,
29953
- attributes: attributes_1,
29954
- childNodes: [],
29955
- isSVG: isSVGElement(n2) || void 0,
29956
- needBlock,
29957
- rootId
29958
- };
29959
- case n2.TEXT_NODE:
29960
- var parentTagName = n2.parentNode && n2.parentNode.tagName;
29961
- var textContent = n2.textContent;
29962
- var isStyle = parentTagName === "STYLE" ? true : void 0;
29963
- var isScript = parentTagName === "SCRIPT" ? true : void 0;
29964
- if (isStyle && textContent) {
29965
- try {
29966
- if (n2.nextSibling || n2.previousSibling) {
29967
- } else if ((_a = n2.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
29968
- textContent = stringifyStyleSheet(n2.parentNode.sheet);
29969
- }
29970
- } catch (err) {
29971
- console.warn("Cannot get CSS styles from text's parentNode. Error: " + err, n2);
29972
- }
29973
- textContent = absoluteToStylesheet(textContent, getHref());
29974
- }
29975
- if (isScript) {
29976
- textContent = "SCRIPT_PLACEHOLDER";
29977
- }
29978
- if (!isStyle && !isScript && needMaskingText(n2, maskTextClass, maskTextSelector) && textContent) {
29979
- textContent = maskTextFn ? maskTextFn(textContent) : textContent.replace(/[\S]/g, "*");
29980
- }
29981
- return {
29982
- type: NodeType.Text,
29983
- textContent: textContent || "",
29984
- isStyle,
29985
- rootId
29986
- };
29987
- case n2.CDATA_SECTION_NODE:
29988
- return {
29989
- type: NodeType.CDATA,
29990
- textContent: "",
29991
- rootId
29992
- };
29993
- case n2.COMMENT_NODE:
29994
- return {
29995
- type: NodeType.Comment,
29996
- textContent: n2.textContent || "",
29997
- rootId
29998
- };
29999
- default:
30000
- return false;
30001
- }
30002
- }
30003
- function lowerIfExists(maybeAttr) {
30004
- if (maybeAttr === void 0) {
30005
- return "";
30006
- } else {
30007
- return maybeAttr.toLowerCase();
30008
- }
30009
- }
30010
- function slimDOMExcluded(sn, slimDOMOptions) {
30011
- if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
30012
- return true;
30013
- } else if (sn.type === NodeType.Element) {
30014
- if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && sn.attributes.href.endsWith(".js"))) {
30015
- return true;
30016
- } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
30017
- return true;
30018
- } else if (sn.tagName === "meta") {
30019
- if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
30020
- return true;
30021
- } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
30022
- return true;
30023
- } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
30024
- return true;
30025
- } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
30026
- return true;
30027
- } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
30028
- return true;
30029
- } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) {
30030
- return true;
30031
- }
30032
- }
30033
- }
30034
- return false;
30035
- }
30036
- function serializeNodeWithId(n2, options) {
30037
- var doc = options.doc, map = options.map, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5e3 : _g, _h = options.keepIframeSrcFn, keepIframeSrcFn = _h === void 0 ? function() {
30038
- return false;
30039
- } : _h;
30040
- var _j = options.preserveWhiteSpace, preserveWhiteSpace = _j === void 0 ? true : _j;
30041
- var _serializedNode = serializeNode(n2, {
30042
- doc,
30043
- blockClass,
30044
- blockSelector,
30045
- maskTextClass,
30046
- maskTextSelector,
30047
- inlineStylesheet,
30048
- maskInputOptions,
30049
- maskTextFn,
30050
- maskInputFn,
30051
- dataURLOptions,
30052
- inlineImages,
30053
- recordCanvas,
30054
- keepIframeSrcFn
30055
- });
30056
- if (!_serializedNode) {
30057
- console.warn(n2, "not serialized");
30058
- return null;
30059
- }
30060
- var id;
30061
- if ("__sn" in n2) {
30062
- id = n2.__sn.id;
30063
- } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
30064
- id = IGNORED_NODE;
30065
- } else {
30066
- id = genId();
30067
- }
30068
- var serializedNode = Object.assign(_serializedNode, { id });
30069
- n2.__sn = serializedNode;
30070
- if (id === IGNORED_NODE) {
30071
- return null;
30072
- }
30073
- map[id] = n2;
30074
- if (onSerialize) {
30075
- onSerialize(n2);
30076
- }
30077
- var recordChild = !skipChild;
30078
- if (serializedNode.type === NodeType.Element) {
30079
- recordChild = recordChild && !serializedNode.needBlock;
30080
- delete serializedNode.needBlock;
30081
- if (n2.shadowRoot)
30082
- serializedNode.isShadowHost = true;
30083
- }
30084
- if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {
30085
- if (slimDOMOptions.headWhitespace && _serializedNode.type === NodeType.Element && _serializedNode.tagName === "head") {
30086
- preserveWhiteSpace = false;
30087
- }
30088
- var bypassOptions = {
30089
- doc,
30090
- map,
30091
- blockClass,
30092
- blockSelector,
30093
- maskTextClass,
30094
- maskTextSelector,
30095
- skipChild,
30096
- inlineStylesheet,
30097
- maskInputOptions,
30098
- maskTextFn,
30099
- maskInputFn,
30100
- slimDOMOptions,
30101
- dataURLOptions,
30102
- inlineImages,
30103
- recordCanvas,
30104
- preserveWhiteSpace,
30105
- onSerialize,
30106
- onIframeLoad,
30107
- iframeLoadTimeout,
30108
- keepIframeSrcFn
30109
- };
30110
- for (var _i = 0, _k = Array.from(n2.childNodes); _i < _k.length; _i++) {
30111
- var childN = _k[_i];
30112
- var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
30113
- if (serializedChildNode) {
30114
- serializedNode.childNodes.push(serializedChildNode);
30115
- }
30116
- }
30117
- if (isElement(n2) && n2.shadowRoot) {
30118
- for (var _l = 0, _m = Array.from(n2.shadowRoot.childNodes); _l < _m.length; _l++) {
30119
- var childN = _m[_l];
30120
- var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
30121
- if (serializedChildNode) {
30122
- serializedChildNode.isShadow = true;
30123
- serializedNode.childNodes.push(serializedChildNode);
30124
- }
30125
- }
30126
- }
30127
- }
30128
- if (n2.parentNode && isShadowRoot(n2.parentNode)) {
30129
- serializedNode.isShadow = true;
30130
- }
30131
- if (serializedNode.type === NodeType.Element && serializedNode.tagName === "iframe") {
30132
- onceIframeLoaded(n2, function() {
30133
- var iframeDoc = n2.contentDocument;
30134
- if (iframeDoc && onIframeLoad) {
30135
- var serializedIframeNode = serializeNodeWithId(iframeDoc, {
30136
- doc: iframeDoc,
30137
- map,
30138
- blockClass,
30139
- blockSelector,
30140
- maskTextClass,
30141
- maskTextSelector,
30142
- skipChild: false,
30143
- inlineStylesheet,
30144
- maskInputOptions,
30145
- maskTextFn,
30146
- maskInputFn,
30147
- slimDOMOptions,
30148
- dataURLOptions,
30149
- inlineImages,
30150
- recordCanvas,
30151
- preserveWhiteSpace,
30152
- onSerialize,
30153
- onIframeLoad,
30154
- iframeLoadTimeout,
30155
- keepIframeSrcFn
30156
- });
30157
- if (serializedIframeNode) {
30158
- onIframeLoad(n2, serializedIframeNode);
30159
- }
30160
- }
30161
- }, iframeLoadTimeout);
30162
- }
30163
- return serializedNode;
30164
- }
30165
- function snapshot(n2, options) {
30166
- var _a = options || {}, _b = _a.blockClass, blockClass = _b === void 0 ? "rr-block" : _b, _c = _a.blockSelector, blockSelector = _c === void 0 ? null : _c, _d = _a.maskTextClass, maskTextClass = _d === void 0 ? "rr-mask" : _d, _e = _a.maskTextSelector, maskTextSelector = _e === void 0 ? null : _e, _f = _a.inlineStylesheet, inlineStylesheet = _f === void 0 ? true : _f, _g = _a.inlineImages, inlineImages = _g === void 0 ? false : _g, _h = _a.recordCanvas, recordCanvas = _h === void 0 ? false : _h, _j = _a.maskAllInputs, maskAllInputs = _j === void 0 ? false : _j, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _k = _a.slimDOM, slimDOM = _k === void 0 ? false : _k, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, _l = _a.keepIframeSrcFn, keepIframeSrcFn = _l === void 0 ? function() {
30167
- return false;
30168
- } : _l;
30169
- var idNodeMap = {};
30170
- var maskInputOptions = maskAllInputs === true ? {
30171
- color: true,
30172
- date: true,
30173
- "datetime-local": true,
30174
- email: true,
30175
- month: true,
30176
- number: true,
30177
- range: true,
30178
- search: true,
30179
- tel: true,
30180
- text: true,
30181
- time: true,
30182
- url: true,
30183
- week: true,
30184
- textarea: true,
30185
- select: true,
30186
- password: true
30187
- } : maskAllInputs === false ? {
30188
- password: true
30189
- } : maskAllInputs;
30190
- var slimDOMOptions = slimDOM === true || slimDOM === "all" ? {
30191
- script: true,
30192
- comment: true,
30193
- headFavicon: true,
30194
- headWhitespace: true,
30195
- headMetaDescKeywords: slimDOM === "all",
30196
- headMetaSocial: true,
30197
- headMetaRobots: true,
30198
- headMetaHttpEquiv: true,
30199
- headMetaAuthorship: true,
30200
- headMetaVerification: true
30201
- } : slimDOM === false ? {} : slimDOM;
30202
- return [
30203
- serializeNodeWithId(n2, {
30204
- doc: n2,
30205
- map: idNodeMap,
30206
- blockClass,
30207
- blockSelector,
30208
- maskTextClass,
30209
- maskTextSelector,
30210
- skipChild: false,
30211
- inlineStylesheet,
30212
- maskInputOptions,
30213
- maskTextFn,
30214
- maskInputFn,
30215
- slimDOMOptions,
30216
- dataURLOptions,
30217
- inlineImages,
30218
- recordCanvas,
30219
- preserveWhiteSpace,
30220
- onSerialize,
30221
- onIframeLoad,
30222
- iframeLoadTimeout,
30223
- keepIframeSrcFn
30224
- }),
30225
- idNodeMap
30226
- ];
30227
- }
30228
- var HOVER_SELECTOR = /([^\\]):hover/;
30229
- var HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, "g");
30230
-
30231
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/types.js
30232
- var EventType;
30233
- (function(EventType2) {
30234
- EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
30235
- EventType2[EventType2["Load"] = 1] = "Load";
30236
- EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
30237
- EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
30238
- EventType2[EventType2["Meta"] = 4] = "Meta";
30239
- EventType2[EventType2["Custom"] = 5] = "Custom";
30240
- EventType2[EventType2["Plugin"] = 6] = "Plugin";
30241
- })(EventType || (EventType = {}));
30242
- var IncrementalSource;
30243
- (function(IncrementalSource2) {
30244
- IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
30245
- IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
30246
- IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
30247
- IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
30248
- IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
30249
- IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
30250
- IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
30251
- IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
30252
- IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
30253
- IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
30254
- IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
30255
- IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
30256
- IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
30257
- IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
30258
- })(IncrementalSource || (IncrementalSource = {}));
30259
- var MouseInteractions;
30260
- (function(MouseInteractions2) {
30261
- MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
30262
- MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
30263
- MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
30264
- MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
30265
- MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
30266
- MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
30267
- MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
30268
- MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
30269
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
30270
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
30271
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
30272
- })(MouseInteractions || (MouseInteractions = {}));
30273
- var CanvasContext;
30274
- (function(CanvasContext2) {
30275
- CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
30276
- CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
30277
- CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
30278
- })(CanvasContext || (CanvasContext = {}));
30279
- var MediaInteractions;
30280
- (function(MediaInteractions2) {
30281
- MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";
30282
- MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";
30283
- MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";
30284
- MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";
30285
- })(MediaInteractions || (MediaInteractions = {}));
30286
- var ReplayerEvents;
30287
- (function(ReplayerEvents2) {
30288
- ReplayerEvents2["Start"] = "start";
30289
- ReplayerEvents2["Pause"] = "pause";
30290
- ReplayerEvents2["Resume"] = "resume";
30291
- ReplayerEvents2["Resize"] = "resize";
30292
- ReplayerEvents2["Finish"] = "finish";
30293
- ReplayerEvents2["FullsnapshotRebuilded"] = "fullsnapshot-rebuilded";
30294
- ReplayerEvents2["LoadStylesheetStart"] = "load-stylesheet-start";
30295
- ReplayerEvents2["LoadStylesheetEnd"] = "load-stylesheet-end";
30296
- ReplayerEvents2["SkipStart"] = "skip-start";
30297
- ReplayerEvents2["SkipEnd"] = "skip-end";
30298
- ReplayerEvents2["MouseInteraction"] = "mouse-interaction";
30299
- ReplayerEvents2["EventCast"] = "event-cast";
30300
- ReplayerEvents2["CustomEvent"] = "custom-event";
30301
- ReplayerEvents2["Flush"] = "flush";
30302
- ReplayerEvents2["StateChange"] = "state-change";
30303
- ReplayerEvents2["PlayBack"] = "play-back";
30304
- })(ReplayerEvents || (ReplayerEvents = {}));
30305
-
30306
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/utils.js
30307
- function on(type, fn, target) {
30308
- if (target === void 0) {
30309
- target = document;
30310
- }
30311
- var options = { capture: true, passive: true };
30312
- target.addEventListener(type, fn, options);
30313
- return function() {
30314
- return target.removeEventListener(type, fn, options);
30315
- };
30316
- }
30317
- function createMirror() {
30318
- return {
30319
- map: {},
30320
- getId: function(n2) {
30321
- if (!n2 || !n2.__sn) {
30322
- return -1;
30323
- }
30324
- return n2.__sn.id;
30325
- },
30326
- getNode: function(id) {
30327
- return this.map[id] || null;
30328
- },
30329
- removeNodeFromMap: function(n2) {
30330
- var _this = this;
30331
- var id = n2.__sn && n2.__sn.id;
30332
- delete this.map[id];
30333
- if (n2.childNodes) {
30334
- n2.childNodes.forEach(function(child) {
30335
- return _this.removeNodeFromMap(child);
30336
- });
30337
- }
30338
- },
30339
- has: function(id) {
30340
- return this.map.hasOwnProperty(id);
30341
- },
30342
- reset: function() {
30343
- this.map = {};
30344
- }
30345
- };
30346
- }
30347
- var DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";
30348
- var _mirror = {
30349
- map: {},
30350
- getId: function() {
30351
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
30352
- return -1;
30353
- },
30354
- getNode: function() {
30355
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
30356
- return null;
30357
- },
30358
- removeNodeFromMap: function() {
30359
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
30360
- },
30361
- has: function() {
30362
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
30363
- return false;
30364
- },
30365
- reset: function() {
30366
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
30367
- }
30368
- };
30369
- if (typeof window !== "undefined" && window.Proxy && window.Reflect) {
30370
- _mirror = new Proxy(_mirror, {
30371
- get: function(target, prop, receiver) {
30372
- if (prop === "map") {
30373
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
30374
- }
30375
- return Reflect.get(target, prop, receiver);
30376
- }
30377
- });
30378
- }
30379
- function throttle(func, wait2, options) {
30380
- if (options === void 0) {
30381
- options = {};
30382
- }
30383
- var timeout = null;
30384
- var previous = 0;
30385
- return function(arg) {
30386
- var now = Date.now();
30387
- if (!previous && options.leading === false) {
30388
- previous = now;
30389
- }
30390
- var remaining = wait2 - (now - previous);
30391
- var context = this;
30392
- var args = arguments;
30393
- if (remaining <= 0 || remaining > wait2) {
30394
- if (timeout) {
30395
- clearTimeout(timeout);
30396
- timeout = null;
30397
- }
30398
- previous = now;
30399
- func.apply(context, args);
30400
- } else if (!timeout && options.trailing !== false) {
30401
- timeout = setTimeout(function() {
30402
- previous = options.leading === false ? 0 : Date.now();
30403
- timeout = null;
30404
- func.apply(context, args);
30405
- }, remaining);
30406
- }
30407
- };
30408
- }
30409
- function hookSetter(target, key, d2, isRevoked, win) {
30410
- if (win === void 0) {
30411
- win = window;
30412
- }
30413
- var original = win.Object.getOwnPropertyDescriptor(target, key);
30414
- win.Object.defineProperty(target, key, isRevoked ? d2 : {
30415
- set: function(value) {
30416
- var _this = this;
30417
- setTimeout(function() {
30418
- d2.set.call(_this, value);
30419
- }, 0);
30420
- if (original && original.set) {
30421
- original.set.call(this, value);
30422
- }
30423
- }
30424
- });
30425
- return function() {
30426
- return hookSetter(target, key, original || {}, true);
30427
- };
30428
- }
30429
- function patch(source, name, replacement) {
30430
- try {
30431
- if (!(name in source)) {
30432
- return function() {
30433
- };
30434
- }
30435
- var original_1 = source[name];
30436
- var wrapped = replacement(original_1);
30437
- if (typeof wrapped === "function") {
30438
- wrapped.prototype = wrapped.prototype || {};
30439
- Object.defineProperties(wrapped, {
30440
- __rrweb_original__: {
30441
- enumerable: false,
30442
- value: original_1
30443
- }
30444
- });
30445
- }
30446
- source[name] = wrapped;
30447
- return function() {
30448
- source[name] = original_1;
30449
- };
30450
- } catch (_a) {
30451
- return function() {
30452
- };
30453
- }
30454
- }
30455
- function getWindowHeight() {
30456
- return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;
30457
- }
30458
- function getWindowWidth() {
30459
- return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;
30460
- }
30461
- function isBlocked(node, blockClass) {
30462
- if (!node) {
30463
- return false;
30464
- }
30465
- if (node.nodeType === node.ELEMENT_NODE) {
30466
- var needBlock_1 = false;
30467
- if (typeof blockClass === "string") {
30468
- if (node.closest !== void 0) {
30469
- return node.closest("." + blockClass) !== null;
30470
- } else {
30471
- needBlock_1 = node.classList.contains(blockClass);
30472
- }
30473
- } else {
30474
- node.classList.forEach(function(className) {
30475
- if (blockClass.test(className)) {
30476
- needBlock_1 = true;
30477
- }
30478
- });
30479
- }
30480
- return needBlock_1 || isBlocked(node.parentNode, blockClass);
30481
- }
30482
- if (node.nodeType === node.TEXT_NODE) {
30483
- return isBlocked(node.parentNode, blockClass);
30484
- }
30485
- return isBlocked(node.parentNode, blockClass);
30486
- }
30487
- function isIgnored(n2) {
30488
- if ("__sn" in n2) {
30489
- return n2.__sn.id === IGNORED_NODE;
30490
- }
30491
- return false;
30492
- }
30493
- function isAncestorRemoved(target, mirror2) {
30494
- if (isShadowRoot(target)) {
30495
- return false;
30496
- }
30497
- var id = mirror2.getId(target);
30498
- if (!mirror2.has(id)) {
30499
- return true;
30500
- }
30501
- if (target.parentNode && target.parentNode.nodeType === target.DOCUMENT_NODE) {
30502
- return false;
30503
- }
30504
- if (!target.parentNode) {
30505
- return true;
30506
- }
30507
- return isAncestorRemoved(target.parentNode, mirror2);
30508
- }
30509
- function isTouchEvent(event) {
30510
- return Boolean(event.changedTouches);
30511
- }
30512
- function polyfill(win) {
30513
- if (win === void 0) {
30514
- win = window;
30515
- }
30516
- if ("NodeList" in win && !win.NodeList.prototype.forEach) {
30517
- win.NodeList.prototype.forEach = Array.prototype.forEach;
30518
- }
30519
- if ("DOMTokenList" in win && !win.DOMTokenList.prototype.forEach) {
30520
- win.DOMTokenList.prototype.forEach = Array.prototype.forEach;
30521
- }
30522
- if (!Node.prototype.contains) {
30523
- Node.prototype.contains = function contains2(node) {
30524
- if (!(0 in arguments)) {
30525
- throw new TypeError("1 argument is required");
30526
- }
30527
- do {
30528
- if (this === node) {
30529
- return true;
30530
- }
30531
- } while (node = node && node.parentNode);
30532
- return false;
30533
- };
30534
- }
30535
- }
30536
- var TreeIndex = (function() {
30537
- function TreeIndex2() {
30538
- this.reset();
30539
- }
30540
- TreeIndex2.prototype.add = function(mutation) {
30541
- var parentTreeNode = this.indexes.get(mutation.parentId);
30542
- var treeNode = {
30543
- id: mutation.node.id,
30544
- mutation,
30545
- children: [],
30546
- texts: [],
30547
- attributes: []
30548
- };
30549
- if (!parentTreeNode) {
30550
- this.tree[treeNode.id] = treeNode;
30551
- } else {
30552
- treeNode.parent = parentTreeNode;
30553
- parentTreeNode.children[treeNode.id] = treeNode;
30554
- }
30555
- this.indexes.set(treeNode.id, treeNode);
30556
- };
30557
- TreeIndex2.prototype.remove = function(mutation, mirror2) {
30558
- var _this = this;
30559
- var parentTreeNode = this.indexes.get(mutation.parentId);
30560
- var treeNode = this.indexes.get(mutation.id);
30561
- var deepRemoveFromMirror = function(id) {
30562
- _this.removeIdSet.add(id);
30563
- var node = mirror2.getNode(id);
30564
- node === null || node === void 0 ? void 0 : node.childNodes.forEach(function(childNode) {
30565
- if ("__sn" in childNode) {
30566
- deepRemoveFromMirror(childNode.__sn.id);
30567
- }
30568
- });
30569
- };
30570
- var deepRemoveFromTreeIndex = function(node) {
30571
- _this.removeIdSet.add(node.id);
30572
- Object.values(node.children).forEach(function(n2) {
30573
- return deepRemoveFromTreeIndex(n2);
30574
- });
30575
- var _treeNode = _this.indexes.get(node.id);
30576
- if (_treeNode) {
30577
- var _parentTreeNode = _treeNode.parent;
30578
- if (_parentTreeNode) {
30579
- delete _treeNode.parent;
30580
- delete _parentTreeNode.children[_treeNode.id];
30581
- _this.indexes.delete(mutation.id);
30582
- }
30583
- }
30584
- };
30585
- if (!treeNode) {
30586
- this.removeNodeMutations.push(mutation);
30587
- deepRemoveFromMirror(mutation.id);
30588
- } else if (!parentTreeNode) {
30589
- delete this.tree[treeNode.id];
30590
- this.indexes.delete(treeNode.id);
30591
- deepRemoveFromTreeIndex(treeNode);
30592
- } else {
30593
- delete treeNode.parent;
30594
- delete parentTreeNode.children[treeNode.id];
30595
- this.indexes.delete(mutation.id);
30596
- deepRemoveFromTreeIndex(treeNode);
30597
- }
30598
- };
30599
- TreeIndex2.prototype.text = function(mutation) {
30600
- var treeNode = this.indexes.get(mutation.id);
30601
- if (treeNode) {
30602
- treeNode.texts.push(mutation);
30603
- } else {
30604
- this.textMutations.push(mutation);
30605
- }
30606
- };
30607
- TreeIndex2.prototype.attribute = function(mutation) {
30608
- var treeNode = this.indexes.get(mutation.id);
30609
- if (treeNode) {
30610
- treeNode.attributes.push(mutation);
30611
- } else {
30612
- this.attributeMutations.push(mutation);
30613
- }
30614
- };
30615
- TreeIndex2.prototype.scroll = function(d2) {
30616
- this.scrollMap.set(d2.id, d2);
30617
- };
30618
- TreeIndex2.prototype.input = function(d2) {
30619
- this.inputMap.set(d2.id, d2);
30620
- };
30621
- TreeIndex2.prototype.flush = function() {
30622
- var e_1, _a, e_2, _b;
30623
- var _this = this;
30624
- var _c = this, tree = _c.tree, removeNodeMutations = _c.removeNodeMutations, textMutations = _c.textMutations, attributeMutations = _c.attributeMutations;
30625
- var batchMutationData = {
30626
- source: IncrementalSource.Mutation,
30627
- removes: removeNodeMutations,
30628
- texts: textMutations,
30629
- attributes: attributeMutations,
30630
- adds: []
30631
- };
30632
- var walk = function(treeNode, removed) {
30633
- if (removed) {
30634
- _this.removeIdSet.add(treeNode.id);
30635
- }
30636
- batchMutationData.texts = batchMutationData.texts.concat(removed ? [] : treeNode.texts).filter(function(m2) {
30637
- return !_this.removeIdSet.has(m2.id);
30638
- });
30639
- batchMutationData.attributes = batchMutationData.attributes.concat(removed ? [] : treeNode.attributes).filter(function(m2) {
30640
- return !_this.removeIdSet.has(m2.id);
30641
- });
30642
- if (!_this.removeIdSet.has(treeNode.id) && !_this.removeIdSet.has(treeNode.mutation.parentId) && !removed) {
30643
- batchMutationData.adds.push(treeNode.mutation);
30644
- if (treeNode.children) {
30645
- Object.values(treeNode.children).forEach(function(n2) {
30646
- return walk(n2, false);
30647
- });
30648
- }
30649
- } else {
30650
- Object.values(treeNode.children).forEach(function(n2) {
30651
- return walk(n2, true);
30652
- });
30653
- }
30654
- };
30655
- Object.values(tree).forEach(function(n2) {
30656
- return walk(n2, false);
30657
- });
30658
- try {
30659
- for (var _d = __values(this.scrollMap.keys()), _e = _d.next(); !_e.done; _e = _d.next()) {
30660
- var id = _e.value;
30661
- if (this.removeIdSet.has(id)) {
30662
- this.scrollMap.delete(id);
30663
- }
30664
- }
30665
- } catch (e_1_1) {
30666
- e_1 = { error: e_1_1 };
30667
- } finally {
30668
- try {
30669
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
30670
- } finally {
30671
- if (e_1) throw e_1.error;
30672
- }
30673
- }
30674
- try {
30675
- for (var _f = __values(this.inputMap.keys()), _g = _f.next(); !_g.done; _g = _f.next()) {
30676
- var id = _g.value;
30677
- if (this.removeIdSet.has(id)) {
30678
- this.inputMap.delete(id);
30679
- }
30680
- }
30681
- } catch (e_2_1) {
30682
- e_2 = { error: e_2_1 };
30683
- } finally {
30684
- try {
30685
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
30686
- } finally {
30687
- if (e_2) throw e_2.error;
30688
- }
30689
- }
30690
- var scrollMap = new Map(this.scrollMap);
30691
- var inputMap = new Map(this.inputMap);
30692
- this.reset();
30693
- return {
30694
- mutationData: batchMutationData,
30695
- scrollMap,
30696
- inputMap
30697
- };
30698
- };
30699
- TreeIndex2.prototype.reset = function() {
30700
- this.tree = [];
30701
- this.indexes = /* @__PURE__ */ new Map();
30702
- this.removeNodeMutations = [];
30703
- this.textMutations = [];
30704
- this.attributeMutations = [];
30705
- this.removeIdSet = /* @__PURE__ */ new Set();
30706
- this.scrollMap = /* @__PURE__ */ new Map();
30707
- this.inputMap = /* @__PURE__ */ new Map();
30708
- };
30709
- TreeIndex2.prototype.idRemoved = function(id) {
30710
- return this.removeIdSet.has(id);
30711
- };
30712
- return TreeIndex2;
30713
- })();
30714
- function isIframeINode(node) {
30715
- if ("__sn" in node) {
30716
- return node.__sn.type === NodeType.Element && node.__sn.tagName === "iframe";
30717
- }
30718
- return false;
30719
- }
30720
- function hasShadowRoot(n2) {
30721
- return Boolean(n2 === null || n2 === void 0 ? void 0 : n2.shadowRoot);
30722
- }
30723
-
30724
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/mutation.js
30725
- function isNodeInLinkedList(n2) {
30726
- return "__ln" in n2;
30727
- }
30728
- var DoubleLinkedList = (function() {
30729
- function DoubleLinkedList2() {
30730
- this.length = 0;
30731
- this.head = null;
30732
- }
30733
- DoubleLinkedList2.prototype.get = function(position) {
30734
- if (position >= this.length) {
30735
- throw new Error("Position outside of list range");
30736
- }
30737
- var current = this.head;
30738
- for (var index = 0; index < position; index++) {
30739
- current = (current === null || current === void 0 ? void 0 : current.next) || null;
30740
- }
30741
- return current;
30742
- };
30743
- DoubleLinkedList2.prototype.addNode = function(n2) {
30744
- var node = {
30745
- value: n2,
30746
- previous: null,
30747
- next: null
30748
- };
30749
- n2.__ln = node;
30750
- if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {
30751
- var current = n2.previousSibling.__ln.next;
30752
- node.next = current;
30753
- node.previous = n2.previousSibling.__ln;
30754
- n2.previousSibling.__ln.next = node;
30755
- if (current) {
30756
- current.previous = node;
30757
- }
30758
- } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {
30759
- var current = n2.nextSibling.__ln.previous;
30760
- node.previous = current;
30761
- node.next = n2.nextSibling.__ln;
30762
- n2.nextSibling.__ln.previous = node;
30763
- if (current) {
30764
- current.next = node;
30765
- }
30766
- } else {
30767
- if (this.head) {
30768
- this.head.previous = node;
30769
- }
30770
- node.next = this.head;
30771
- this.head = node;
30772
- }
30773
- this.length++;
30774
- };
30775
- DoubleLinkedList2.prototype.removeNode = function(n2) {
30776
- var current = n2.__ln;
30777
- if (!this.head) {
30778
- return;
30779
- }
30780
- if (!current.previous) {
30781
- this.head = current.next;
30782
- if (this.head) {
30783
- this.head.previous = null;
30784
- }
30785
- } else {
30786
- current.previous.next = current.next;
30787
- if (current.next) {
30788
- current.next.previous = current.previous;
30789
- }
30790
- }
30791
- if (n2.__ln) {
30792
- delete n2.__ln;
30793
- }
30794
- this.length--;
30795
- };
30796
- return DoubleLinkedList2;
30797
- })();
30798
- var moveKey = function(id, parentId) {
30799
- return "".concat(id, "@").concat(parentId);
30800
- };
30801
- function isINode(n2) {
30802
- return "__sn" in n2;
30803
- }
30804
- var MutationBuffer = (function() {
30805
- function MutationBuffer2() {
30806
- var _this = this;
30807
- this.frozen = false;
30808
- this.locked = false;
30809
- this.texts = [];
30810
- this.attributes = [];
30811
- this.removes = [];
30812
- this.mapRemoves = [];
30813
- this.movedMap = {};
30814
- this.addedSet = /* @__PURE__ */ new Set();
30815
- this.movedSet = /* @__PURE__ */ new Set();
30816
- this.droppedSet = /* @__PURE__ */ new Set();
30817
- this.processMutations = function(mutations) {
30818
- mutations.forEach(_this.processMutation);
30819
- _this.emit();
30820
- };
30821
- this.emit = function() {
30822
- var e_1, _a, e_2, _b;
30823
- if (_this.frozen || _this.locked) {
30824
- return;
30825
- }
30826
- var adds = [];
30827
- var addList = new DoubleLinkedList();
30828
- var getNextId = function(n3) {
30829
- var ns = n3;
30830
- var nextId2 = IGNORED_NODE;
30831
- while (nextId2 === IGNORED_NODE) {
30832
- ns = ns && ns.nextSibling;
30833
- nextId2 = ns && _this.mirror.getId(ns);
30834
- }
30835
- return nextId2;
30836
- };
30837
- var pushAdd = function(n3) {
30838
- var _a2, _b2, _c2, _d2, _e2;
30839
- var shadowHost = n3.getRootNode ? (_a2 = n3.getRootNode()) === null || _a2 === void 0 ? void 0 : _a2.host : null;
30840
- var rootShadowHost = shadowHost;
30841
- while ((_c2 = (_b2 = rootShadowHost === null || rootShadowHost === void 0 ? void 0 : rootShadowHost.getRootNode) === null || _b2 === void 0 ? void 0 : _b2.call(rootShadowHost)) === null || _c2 === void 0 ? void 0 : _c2.host)
30842
- rootShadowHost = ((_e2 = (_d2 = rootShadowHost === null || rootShadowHost === void 0 ? void 0 : rootShadowHost.getRootNode) === null || _d2 === void 0 ? void 0 : _d2.call(rootShadowHost)) === null || _e2 === void 0 ? void 0 : _e2.host) || null;
30843
- var notInDoc = !_this.doc.contains(n3) && (rootShadowHost === null || !_this.doc.contains(rootShadowHost));
30844
- if (!n3.parentNode || notInDoc) {
30845
- return;
30846
- }
30847
- var parentId2 = isShadowRoot(n3.parentNode) ? _this.mirror.getId(shadowHost) : _this.mirror.getId(n3.parentNode);
30848
- var nextId2 = getNextId(n3);
30849
- if (parentId2 === -1 || nextId2 === -1) {
30850
- return addList.addNode(n3);
30851
- }
30852
- var sn = serializeNodeWithId(n3, {
30853
- doc: _this.doc,
30854
- map: _this.mirror.map,
30855
- blockClass: _this.blockClass,
30856
- blockSelector: _this.blockSelector,
30857
- maskTextClass: _this.maskTextClass,
30858
- maskTextSelector: _this.maskTextSelector,
30859
- skipChild: true,
30860
- inlineStylesheet: _this.inlineStylesheet,
30861
- maskInputOptions: _this.maskInputOptions,
30862
- maskTextFn: _this.maskTextFn,
30863
- maskInputFn: _this.maskInputFn,
30864
- slimDOMOptions: _this.slimDOMOptions,
30865
- recordCanvas: _this.recordCanvas,
30866
- inlineImages: _this.inlineImages,
30867
- onSerialize: function(currentN) {
30868
- if (isIframeINode(currentN)) {
30869
- _this.iframeManager.addIframe(currentN);
30870
- }
30871
- if (hasShadowRoot(n3)) {
30872
- _this.shadowDomManager.addShadowRoot(n3.shadowRoot, document);
30873
- }
30874
- },
30875
- onIframeLoad: function(iframe, childSn) {
30876
- _this.iframeManager.attachIframe(iframe, childSn);
30877
- _this.shadowDomManager.observeAttachShadow(iframe);
30878
- }
30879
- });
30880
- if (sn) {
30881
- adds.push({
30882
- parentId: parentId2,
30883
- nextId: nextId2,
30884
- node: sn
30885
- });
30886
- }
30887
- };
30888
- while (_this.mapRemoves.length) {
30889
- _this.mirror.removeNodeFromMap(_this.mapRemoves.shift());
30890
- }
30891
- try {
30892
- for (var _c = __values(_this.movedSet), _d = _c.next(); !_d.done; _d = _c.next()) {
30893
- var n2 = _d.value;
30894
- if (isParentRemoved(_this.removes, n2, _this.mirror) && !_this.movedSet.has(n2.parentNode)) {
30895
- continue;
30896
- }
30897
- pushAdd(n2);
30898
- }
30899
- } catch (e_1_1) {
30900
- e_1 = { error: e_1_1 };
30901
- } finally {
30902
- try {
30903
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
30904
- } finally {
30905
- if (e_1) throw e_1.error;
30906
- }
30907
- }
30908
- try {
30909
- for (var _e = __values(_this.addedSet), _f = _e.next(); !_f.done; _f = _e.next()) {
30910
- var n2 = _f.value;
30911
- if (!isAncestorInSet(_this.droppedSet, n2) && !isParentRemoved(_this.removes, n2, _this.mirror)) {
30912
- pushAdd(n2);
30913
- } else if (isAncestorInSet(_this.movedSet, n2)) {
30914
- pushAdd(n2);
30915
- } else {
30916
- _this.droppedSet.add(n2);
30917
- }
30918
- }
30919
- } catch (e_2_1) {
30920
- e_2 = { error: e_2_1 };
30921
- } finally {
30922
- try {
30923
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
30924
- } finally {
30925
- if (e_2) throw e_2.error;
30926
- }
30927
- }
30928
- var candidate = null;
30929
- while (addList.length) {
30930
- var node = null;
30931
- if (candidate) {
30932
- var parentId = _this.mirror.getId(candidate.value.parentNode);
30933
- var nextId = getNextId(candidate.value);
30934
- if (parentId !== -1 && nextId !== -1) {
30935
- node = candidate;
30936
- }
30937
- }
30938
- if (!node) {
30939
- for (var index = addList.length - 1; index >= 0; index--) {
30940
- var _node = addList.get(index);
30941
- if (_node) {
30942
- var parentId = _this.mirror.getId(_node.value.parentNode);
30943
- var nextId = getNextId(_node.value);
30944
- if (parentId !== -1 && nextId !== -1) {
30945
- node = _node;
30946
- break;
30947
- }
30948
- }
30949
- }
30950
- }
30951
- if (!node) {
30952
- while (addList.head) {
30953
- addList.removeNode(addList.head.value);
30954
- }
30955
- break;
30956
- }
30957
- candidate = node.previous;
30958
- addList.removeNode(node.value);
30959
- pushAdd(node.value);
30960
- }
30961
- var payload = {
30962
- texts: _this.texts.map(function(text) {
30963
- return {
30964
- id: _this.mirror.getId(text.node),
30965
- value: text.value
30966
- };
30967
- }).filter(function(text) {
30968
- return _this.mirror.has(text.id);
30969
- }),
30970
- attributes: _this.attributes.map(function(attribute) {
30971
- return {
30972
- id: _this.mirror.getId(attribute.node),
30973
- attributes: attribute.attributes
30974
- };
30975
- }).filter(function(attribute) {
30976
- return _this.mirror.has(attribute.id);
30977
- }),
30978
- removes: _this.removes,
30979
- adds
30980
- };
30981
- if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {
30982
- return;
30983
- }
30984
- _this.texts = [];
30985
- _this.attributes = [];
30986
- _this.removes = [];
30987
- _this.addedSet = /* @__PURE__ */ new Set();
30988
- _this.movedSet = /* @__PURE__ */ new Set();
30989
- _this.droppedSet = /* @__PURE__ */ new Set();
30990
- _this.movedMap = {};
30991
- _this.mutationCb(payload);
30992
- };
30993
- this.processMutation = function(m2) {
30994
- var e_3, _a, e_4, _b;
30995
- if (isIgnored(m2.target)) {
30996
- return;
30997
- }
30998
- switch (m2.type) {
30999
- case "characterData": {
31000
- var value = m2.target.textContent;
31001
- if (!isBlocked(m2.target, _this.blockClass) && value !== m2.oldValue) {
31002
- _this.texts.push({
31003
- value: needMaskingText(m2.target, _this.maskTextClass, _this.maskTextSelector) && value ? _this.maskTextFn ? _this.maskTextFn(value) : value.replace(/[\S]/g, "*") : value,
31004
- node: m2.target
31005
- });
31006
- }
31007
- break;
31008
- }
31009
- case "attributes": {
31010
- var target = m2.target;
31011
- var value = m2.target.getAttribute(m2.attributeName);
31012
- if (m2.attributeName === "value") {
31013
- value = maskInputValue({
31014
- maskInputOptions: _this.maskInputOptions,
31015
- tagName: m2.target.tagName,
31016
- type: m2.target.getAttribute("type"),
31017
- value,
31018
- maskInputFn: _this.maskInputFn
31019
- });
31020
- }
31021
- if (isBlocked(m2.target, _this.blockClass) || value === m2.oldValue) {
31022
- return;
31023
- }
31024
- var item = _this.attributes.find(function(a2) {
31025
- return a2.node === m2.target;
31026
- });
31027
- if (!item) {
31028
- item = {
31029
- node: m2.target,
31030
- attributes: {}
31031
- };
31032
- _this.attributes.push(item);
31033
- }
31034
- if (m2.attributeName === "style") {
31035
- var old = _this.doc.createElement("span");
31036
- if (m2.oldValue) {
31037
- old.setAttribute("style", m2.oldValue);
31038
- }
31039
- if (item.attributes.style === void 0 || item.attributes.style === null) {
31040
- item.attributes.style = {};
31041
- }
31042
- var styleObj = item.attributes.style;
31043
- try {
31044
- for (var _c = __values(Array.from(target.style)), _d = _c.next(); !_d.done; _d = _c.next()) {
31045
- var pname = _d.value;
31046
- var newValue = target.style.getPropertyValue(pname);
31047
- var newPriority = target.style.getPropertyPriority(pname);
31048
- if (newValue !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) {
31049
- if (newPriority === "") {
31050
- styleObj[pname] = newValue;
31051
- } else {
31052
- styleObj[pname] = [newValue, newPriority];
31053
- }
31054
- }
31055
- }
31056
- } catch (e_3_1) {
31057
- e_3 = { error: e_3_1 };
31058
- } finally {
31059
- try {
31060
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
31061
- } finally {
31062
- if (e_3) throw e_3.error;
31063
- }
31064
- }
31065
- try {
31066
- for (var _e = __values(Array.from(old.style)), _f = _e.next(); !_f.done; _f = _e.next()) {
31067
- var pname = _f.value;
31068
- if (target.style.getPropertyValue(pname) === "") {
31069
- styleObj[pname] = false;
31070
- }
31071
- }
31072
- } catch (e_4_1) {
31073
- e_4 = { error: e_4_1 };
31074
- } finally {
31075
- try {
31076
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
31077
- } finally {
31078
- if (e_4) throw e_4.error;
31079
- }
31080
- }
31081
- } else {
31082
- item.attributes[m2.attributeName] = transformAttribute(_this.doc, m2.target.tagName, m2.attributeName, value);
31083
- }
31084
- break;
31085
- }
31086
- case "childList": {
31087
- m2.addedNodes.forEach(function(n2) {
31088
- return _this.genAdds(n2, m2.target);
31089
- });
31090
- m2.removedNodes.forEach(function(n2) {
31091
- var nodeId = _this.mirror.getId(n2);
31092
- var parentId = isShadowRoot(m2.target) ? _this.mirror.getId(m2.target.host) : _this.mirror.getId(m2.target);
31093
- if (isBlocked(m2.target, _this.blockClass) || isIgnored(n2)) {
31094
- return;
31095
- }
31096
- if (_this.addedSet.has(n2)) {
31097
- deepDelete(_this.addedSet, n2);
31098
- _this.droppedSet.add(n2);
31099
- } else if (_this.addedSet.has(m2.target) && nodeId === -1) ;
31100
- else if (isAncestorRemoved(m2.target, _this.mirror)) ;
31101
- else if (_this.movedSet.has(n2) && _this.movedMap[moveKey(nodeId, parentId)]) {
31102
- deepDelete(_this.movedSet, n2);
31103
- } else {
31104
- _this.removes.push({
31105
- parentId,
31106
- id: nodeId,
31107
- isShadow: isShadowRoot(m2.target) ? true : void 0
31108
- });
31109
- }
31110
- _this.mapRemoves.push(n2);
31111
- });
31112
- break;
31113
- }
31114
- }
31115
- };
31116
- this.genAdds = function(n2, target) {
31117
- if (target && isBlocked(target, _this.blockClass)) {
31118
- return;
31119
- }
31120
- if (isINode(n2)) {
31121
- if (isIgnored(n2)) {
31122
- return;
31123
- }
31124
- _this.movedSet.add(n2);
31125
- var targetId = null;
31126
- if (target && isINode(target)) {
31127
- targetId = target.__sn.id;
31128
- }
31129
- if (targetId) {
31130
- _this.movedMap[moveKey(n2.__sn.id, targetId)] = true;
31131
- }
31132
- } else {
31133
- _this.addedSet.add(n2);
31134
- _this.droppedSet.delete(n2);
31135
- }
31136
- if (!isBlocked(n2, _this.blockClass))
31137
- n2.childNodes.forEach(function(childN) {
31138
- return _this.genAdds(childN);
31139
- });
31140
- };
31141
- }
31142
- MutationBuffer2.prototype.init = function(options) {
31143
- var _this = this;
31144
- [
31145
- "mutationCb",
31146
- "blockClass",
31147
- "blockSelector",
31148
- "maskTextClass",
31149
- "maskTextSelector",
31150
- "inlineStylesheet",
31151
- "maskInputOptions",
31152
- "maskTextFn",
31153
- "maskInputFn",
31154
- "recordCanvas",
31155
- "inlineImages",
31156
- "slimDOMOptions",
31157
- "doc",
31158
- "mirror",
31159
- "iframeManager",
31160
- "shadowDomManager",
31161
- "canvasManager"
31162
- ].forEach(function(key) {
31163
- _this[key] = options[key];
31164
- });
31165
- };
31166
- MutationBuffer2.prototype.freeze = function() {
31167
- this.frozen = true;
31168
- this.canvasManager.freeze();
31169
- };
31170
- MutationBuffer2.prototype.unfreeze = function() {
31171
- this.frozen = false;
31172
- this.canvasManager.unfreeze();
31173
- this.emit();
31174
- };
31175
- MutationBuffer2.prototype.isFrozen = function() {
31176
- return this.frozen;
31177
- };
31178
- MutationBuffer2.prototype.lock = function() {
31179
- this.locked = true;
31180
- this.canvasManager.lock();
31181
- };
31182
- MutationBuffer2.prototype.unlock = function() {
31183
- this.locked = false;
31184
- this.canvasManager.unlock();
31185
- this.emit();
31186
- };
31187
- MutationBuffer2.prototype.reset = function() {
31188
- this.shadowDomManager.reset();
31189
- this.canvasManager.reset();
31190
- };
31191
- return MutationBuffer2;
31192
- })();
31193
- function deepDelete(addsSet, n2) {
31194
- addsSet.delete(n2);
31195
- n2.childNodes.forEach(function(childN) {
31196
- return deepDelete(addsSet, childN);
31197
- });
31198
- }
31199
- function isParentRemoved(removes, n2, mirror2) {
31200
- var parentNode = n2.parentNode;
31201
- if (!parentNode) {
31202
- return false;
31203
- }
31204
- var parentId = mirror2.getId(parentNode);
31205
- if (removes.some(function(r2) {
31206
- return r2.id === parentId;
31207
- })) {
31208
- return true;
31209
- }
31210
- return isParentRemoved(removes, parentNode, mirror2);
31211
- }
31212
- function isAncestorInSet(set, n2) {
31213
- var parentNode = n2.parentNode;
31214
- if (!parentNode) {
31215
- return false;
31216
- }
31217
- if (set.has(parentNode)) {
31218
- return true;
31219
- }
31220
- return isAncestorInSet(set, parentNode);
31221
- }
31222
- var mutation_default = MutationBuffer;
31223
-
31224
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observer.js
31225
- var mutationBuffers = [];
31226
- var isCSSGroupingRuleSupported = typeof CSSGroupingRule !== "undefined";
31227
- var isCSSMediaRuleSupported = typeof CSSMediaRule !== "undefined";
31228
- var isCSSSupportsRuleSupported = typeof CSSSupportsRule !== "undefined";
31229
- var isCSSConditionRuleSupported = typeof CSSConditionRule !== "undefined";
31230
- function getEventTarget(event) {
31231
- try {
31232
- if ("composedPath" in event) {
31233
- var path = event.composedPath();
31234
- if (path.length) {
31235
- return path[0];
31236
- }
31237
- } else if ("path" in event && event.path.length) {
31238
- return event.path[0];
31239
- }
31240
- return event.target;
31241
- } catch (_a) {
31242
- return event.target;
31243
- }
31244
- }
31245
- function initMutationObserver(options, rootEl) {
31246
- var _a, _b;
31247
- var mutationBuffer = new mutation_default();
31248
- mutationBuffers.push(mutationBuffer);
31249
- mutationBuffer.init(options);
31250
- var mutationObserverCtor = window.MutationObserver || window.__rrMutationObserver;
31251
- var angularZoneSymbol = (_b = (_a = window === null || window === void 0 ? void 0 : window.Zone) === null || _a === void 0 ? void 0 : _a.__symbol__) === null || _b === void 0 ? void 0 : _b.call(_a, "MutationObserver");
31252
- if (angularZoneSymbol && window[angularZoneSymbol]) {
31253
- mutationObserverCtor = window[angularZoneSymbol];
31254
- }
31255
- var observer = new mutationObserverCtor(mutationBuffer.processMutations.bind(mutationBuffer));
31256
- observer.observe(rootEl, {
31257
- attributes: true,
31258
- attributeOldValue: true,
31259
- characterData: true,
31260
- characterDataOldValue: true,
31261
- childList: true,
31262
- subtree: true
31263
- });
31264
- return observer;
31265
- }
31266
- function initMoveObserver(_a) {
31267
- var mousemoveCb = _a.mousemoveCb, sampling = _a.sampling, doc = _a.doc, mirror2 = _a.mirror;
31268
- if (sampling.mousemove === false) {
31269
- return function() {
31270
- };
31271
- }
31272
- var threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50;
31273
- var callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500;
31274
- var positions = [];
31275
- var timeBaseline;
31276
- var wrappedCb = throttle(function(source) {
31277
- var totalOffset = Date.now() - timeBaseline;
31278
- mousemoveCb(positions.map(function(p2) {
31279
- p2.timeOffset -= totalOffset;
31280
- return p2;
31281
- }), source);
31282
- positions = [];
31283
- timeBaseline = null;
31284
- }, callbackThreshold);
31285
- var updatePosition = throttle(function(evt) {
31286
- var target = getEventTarget(evt);
31287
- var _a2 = isTouchEvent(evt) ? evt.changedTouches[0] : evt, clientX = _a2.clientX, clientY = _a2.clientY;
31288
- if (!timeBaseline) {
31289
- timeBaseline = Date.now();
31290
- }
31291
- positions.push({
31292
- x: clientX,
31293
- y: clientY,
31294
- id: mirror2.getId(target),
31295
- timeOffset: Date.now() - timeBaseline
31296
- });
31297
- wrappedCb(typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove);
31298
- }, threshold, {
31299
- trailing: false
31300
- });
31301
- var handlers2 = [
31302
- on("mousemove", updatePosition, doc),
31303
- on("touchmove", updatePosition, doc),
31304
- on("drag", updatePosition, doc)
31305
- ];
31306
- return function() {
31307
- handlers2.forEach(function(h2) {
31308
- return h2();
31309
- });
31310
- };
31311
- }
31312
- function initMouseInteractionObserver(_a) {
31313
- var mouseInteractionCb = _a.mouseInteractionCb, doc = _a.doc, mirror2 = _a.mirror, blockClass = _a.blockClass, sampling = _a.sampling;
31314
- if (sampling.mouseInteraction === false) {
31315
- return function() {
31316
- };
31317
- }
31318
- var disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;
31319
- var handlers2 = [];
31320
- var getHandler = function(eventKey) {
31321
- return function(event) {
31322
- var target = getEventTarget(event);
31323
- if (isBlocked(target, blockClass)) {
31324
- return;
31325
- }
31326
- var e2 = isTouchEvent(event) ? event.changedTouches[0] : event;
31327
- if (!e2) {
31328
- return;
31329
- }
31330
- var id = mirror2.getId(target);
31331
- var clientX = e2.clientX, clientY = e2.clientY;
31332
- mouseInteractionCb({
31333
- type: MouseInteractions[eventKey],
31334
- id,
31335
- x: clientX,
31336
- y: clientY
31337
- });
31338
- };
31339
- };
31340
- Object.keys(MouseInteractions).filter(function(key) {
31341
- return Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false;
31342
- }).forEach(function(eventKey) {
31343
- var eventName = eventKey.toLowerCase();
31344
- var handler = getHandler(eventKey);
31345
- handlers2.push(on(eventName, handler, doc));
31346
- });
31347
- return function() {
31348
- handlers2.forEach(function(h2) {
31349
- return h2();
31350
- });
31351
- };
31352
- }
31353
- function initScrollObserver(_a) {
31354
- var scrollCb = _a.scrollCb, doc = _a.doc, mirror2 = _a.mirror, blockClass = _a.blockClass, sampling = _a.sampling;
31355
- var updatePosition = throttle(function(evt) {
31356
- var target = getEventTarget(evt);
31357
- if (!target || isBlocked(target, blockClass)) {
31358
- return;
31359
- }
31360
- var id = mirror2.getId(target);
31361
- if (target === doc) {
31362
- var scrollEl = doc.scrollingElement || doc.documentElement;
31363
- scrollCb({
31364
- id,
31365
- x: scrollEl.scrollLeft,
31366
- y: scrollEl.scrollTop
31367
- });
31368
- } else {
31369
- scrollCb({
31370
- id,
31371
- x: target.scrollLeft,
31372
- y: target.scrollTop
31373
- });
31374
- }
31375
- }, sampling.scroll || 100);
31376
- return on("scroll", updatePosition, doc);
31377
- }
31378
- function initViewportResizeObserver(_a) {
31379
- var viewportResizeCb = _a.viewportResizeCb;
31380
- var lastH = -1;
31381
- var lastW = -1;
31382
- var updateDimension = throttle(function() {
31383
- var height = getWindowHeight();
31384
- var width = getWindowWidth();
31385
- if (lastH !== height || lastW !== width) {
31386
- viewportResizeCb({
31387
- width: Number(width),
31388
- height: Number(height)
31389
- });
31390
- lastH = height;
31391
- lastW = width;
31392
- }
31393
- }, 200);
31394
- return on("resize", updateDimension, window);
31395
- }
31396
- function wrapEventWithUserTriggeredFlag(v2, enable) {
31397
- var value = __assign({}, v2);
31398
- if (!enable)
31399
- delete value.userTriggered;
31400
- return value;
31401
- }
31402
- var INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
31403
- var lastInputValueMap = /* @__PURE__ */ new WeakMap();
31404
- function initInputObserver(_a) {
31405
- var inputCb = _a.inputCb, doc = _a.doc, mirror2 = _a.mirror, blockClass = _a.blockClass, ignoreClass = _a.ignoreClass, maskInputOptions = _a.maskInputOptions, maskInputFn = _a.maskInputFn, sampling = _a.sampling, userTriggeredOnInput = _a.userTriggeredOnInput;
31406
- function eventHandler(event) {
31407
- var target = getEventTarget(event);
31408
- var userTriggered = event.isTrusted;
31409
- if (target && target.tagName === "OPTION")
31410
- target = target.parentElement;
31411
- if (!target || !target.tagName || INPUT_TAGS.indexOf(target.tagName) < 0 || isBlocked(target, blockClass)) {
31412
- return;
31413
- }
31414
- var type = target.type;
31415
- if (target.classList.contains(ignoreClass)) {
31416
- return;
31417
- }
31418
- var text = target.value;
31419
- var isChecked = false;
31420
- if (type === "radio" || type === "checkbox") {
31421
- isChecked = target.checked;
31422
- } else if (maskInputOptions[target.tagName.toLowerCase()] || maskInputOptions[type]) {
31423
- text = maskInputValue({
31424
- maskInputOptions,
31425
- tagName: target.tagName,
31426
- type,
31427
- value: text,
31428
- maskInputFn
31429
- });
31430
- }
31431
- cbWithDedup(target, wrapEventWithUserTriggeredFlag({ text, isChecked, userTriggered }, userTriggeredOnInput));
31432
- var name = target.name;
31433
- if (type === "radio" && name && isChecked) {
31434
- doc.querySelectorAll('input[type="radio"][name="'.concat(name, '"]')).forEach(function(el) {
31435
- if (el !== target) {
31436
- cbWithDedup(el, wrapEventWithUserTriggeredFlag({
31437
- text: el.value,
31438
- isChecked: !isChecked,
31439
- userTriggered: false
31440
- }, userTriggeredOnInput));
31441
- }
31442
- });
31443
- }
31444
- }
31445
- function cbWithDedup(target, v2) {
31446
- var lastInputValue = lastInputValueMap.get(target);
31447
- if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
31448
- lastInputValueMap.set(target, v2);
31449
- var id = mirror2.getId(target);
31450
- inputCb(__assign(__assign({}, v2), { id }));
31451
- }
31452
- }
31453
- var events = sampling.input === "last" ? ["change"] : ["input", "change"];
31454
- var handlers2 = events.map(function(eventName) {
31455
- return on(eventName, eventHandler, doc);
31456
- });
31457
- var propertyDescriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value");
31458
- var hookProperties = [
31459
- [HTMLInputElement.prototype, "value"],
31460
- [HTMLInputElement.prototype, "checked"],
31461
- [HTMLSelectElement.prototype, "value"],
31462
- [HTMLTextAreaElement.prototype, "value"],
31463
- [HTMLSelectElement.prototype, "selectedIndex"],
31464
- [HTMLOptionElement.prototype, "selected"]
31465
- ];
31466
- if (propertyDescriptor && propertyDescriptor.set) {
31467
- handlers2.push.apply(handlers2, __spreadArray([], __read(hookProperties.map(function(p2) {
31468
- return hookSetter(p2[0], p2[1], {
31469
- set: function() {
31470
- eventHandler({ target: this });
31471
- }
31472
- });
31473
- })), false));
31474
- }
31475
- return function() {
31476
- handlers2.forEach(function(h2) {
31477
- return h2();
31478
- });
31479
- };
31480
- }
31481
- function getNestedCSSRulePositions(rule) {
31482
- var positions = [];
31483
- function recurse(childRule, pos) {
31484
- if (isCSSGroupingRuleSupported && childRule.parentRule instanceof CSSGroupingRule || isCSSMediaRuleSupported && childRule.parentRule instanceof CSSMediaRule || isCSSSupportsRuleSupported && childRule.parentRule instanceof CSSSupportsRule || isCSSConditionRuleSupported && childRule.parentRule instanceof CSSConditionRule) {
31485
- var rules = Array.from(childRule.parentRule.cssRules);
31486
- var index = rules.indexOf(childRule);
31487
- pos.unshift(index);
31488
- } else {
31489
- var rules = Array.from(childRule.parentStyleSheet.cssRules);
31490
- var index = rules.indexOf(childRule);
31491
- pos.unshift(index);
31492
- }
31493
- return pos;
31494
- }
31495
- return recurse(rule, positions);
31496
- }
31497
- function initStyleSheetObserver(_a, _b) {
31498
- var styleSheetRuleCb = _a.styleSheetRuleCb, mirror2 = _a.mirror;
31499
- var win = _b.win;
31500
- var insertRule = win.CSSStyleSheet.prototype.insertRule;
31501
- win.CSSStyleSheet.prototype.insertRule = function(rule, index) {
31502
- var id = mirror2.getId(this.ownerNode);
31503
- if (id !== -1) {
31504
- styleSheetRuleCb({
31505
- id,
31506
- adds: [{ rule, index }]
31507
- });
31508
- }
31509
- return insertRule.apply(this, arguments);
31510
- };
31511
- var deleteRule = win.CSSStyleSheet.prototype.deleteRule;
31512
- win.CSSStyleSheet.prototype.deleteRule = function(index) {
31513
- var id = mirror2.getId(this.ownerNode);
31514
- if (id !== -1) {
31515
- styleSheetRuleCb({
31516
- id,
31517
- removes: [{ index }]
31518
- });
31519
- }
31520
- return deleteRule.apply(this, arguments);
31521
- };
31522
- var supportedNestedCSSRuleTypes = {};
31523
- if (isCSSGroupingRuleSupported) {
31524
- supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;
31525
- } else {
31526
- if (isCSSMediaRuleSupported) {
31527
- supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;
31528
- }
31529
- if (isCSSConditionRuleSupported) {
31530
- supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;
31531
- }
31532
- if (isCSSSupportsRuleSupported) {
31533
- supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;
31534
- }
31535
- }
31536
- var unmodifiedFunctions = {};
31537
- Object.entries(supportedNestedCSSRuleTypes).forEach(function(_a2) {
31538
- var _b2 = __read(_a2, 2), typeKey = _b2[0], type = _b2[1];
31539
- unmodifiedFunctions[typeKey] = {
31540
- insertRule: type.prototype.insertRule,
31541
- deleteRule: type.prototype.deleteRule
31542
- };
31543
- type.prototype.insertRule = function(rule, index) {
31544
- var id = mirror2.getId(this.parentStyleSheet.ownerNode);
31545
- if (id !== -1) {
31546
- styleSheetRuleCb({
31547
- id,
31548
- adds: [
31549
- {
31550
- rule,
31551
- index: __spreadArray(__spreadArray([], __read(getNestedCSSRulePositions(this)), false), [
31552
- index || 0
31553
- ], false)
31554
- }
31555
- ]
31556
- });
31557
- }
31558
- return unmodifiedFunctions[typeKey].insertRule.apply(this, arguments);
31559
- };
31560
- type.prototype.deleteRule = function(index) {
31561
- var id = mirror2.getId(this.parentStyleSheet.ownerNode);
31562
- if (id !== -1) {
31563
- styleSheetRuleCb({
31564
- id,
31565
- removes: [{ index: __spreadArray(__spreadArray([], __read(getNestedCSSRulePositions(this)), false), [index], false) }]
31566
- });
31567
- }
31568
- return unmodifiedFunctions[typeKey].deleteRule.apply(this, arguments);
31569
- };
31570
- });
31571
- return function() {
31572
- win.CSSStyleSheet.prototype.insertRule = insertRule;
31573
- win.CSSStyleSheet.prototype.deleteRule = deleteRule;
31574
- Object.entries(supportedNestedCSSRuleTypes).forEach(function(_a2) {
31575
- var _b2 = __read(_a2, 2), typeKey = _b2[0], type = _b2[1];
31576
- type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;
31577
- type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;
31578
- });
31579
- };
31580
- }
31581
- function initStyleDeclarationObserver(_a, _b) {
31582
- var styleDeclarationCb = _a.styleDeclarationCb, mirror2 = _a.mirror;
31583
- var win = _b.win;
31584
- var setProperty = win.CSSStyleDeclaration.prototype.setProperty;
31585
- win.CSSStyleDeclaration.prototype.setProperty = function(property, value, priority) {
31586
- var _a2, _b2;
31587
- var id = mirror2.getId((_b2 = (_a2 = this.parentRule) === null || _a2 === void 0 ? void 0 : _a2.parentStyleSheet) === null || _b2 === void 0 ? void 0 : _b2.ownerNode);
31588
- if (id !== -1) {
31589
- styleDeclarationCb({
31590
- id,
31591
- set: {
31592
- property,
31593
- value,
31594
- priority
31595
- },
31596
- index: getNestedCSSRulePositions(this.parentRule)
31597
- });
31598
- }
31599
- return setProperty.apply(this, arguments);
31600
- };
31601
- var removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
31602
- win.CSSStyleDeclaration.prototype.removeProperty = function(property) {
31603
- var _a2, _b2;
31604
- var id = mirror2.getId((_b2 = (_a2 = this.parentRule) === null || _a2 === void 0 ? void 0 : _a2.parentStyleSheet) === null || _b2 === void 0 ? void 0 : _b2.ownerNode);
31605
- if (id !== -1) {
31606
- styleDeclarationCb({
31607
- id,
31608
- remove: {
31609
- property
31610
- },
31611
- index: getNestedCSSRulePositions(this.parentRule)
31612
- });
31613
- }
31614
- return removeProperty.apply(this, arguments);
31615
- };
31616
- return function() {
31617
- win.CSSStyleDeclaration.prototype.setProperty = setProperty;
31618
- win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;
31619
- };
31620
- }
31621
- function initMediaInteractionObserver(_a) {
31622
- var mediaInteractionCb = _a.mediaInteractionCb, blockClass = _a.blockClass, mirror2 = _a.mirror, sampling = _a.sampling;
31623
- var handler = function(type) {
31624
- return throttle(function(event) {
31625
- var target = getEventTarget(event);
31626
- if (!target || isBlocked(target, blockClass)) {
31627
- return;
31628
- }
31629
- var _a2 = target, currentTime = _a2.currentTime, volume = _a2.volume, muted = _a2.muted;
31630
- mediaInteractionCb({
31631
- type,
31632
- id: mirror2.getId(target),
31633
- currentTime,
31634
- volume,
31635
- muted
31636
- });
31637
- }, sampling.media || 500);
31638
- };
31639
- var handlers2 = [
31640
- on("play", handler(0)),
31641
- on("pause", handler(1)),
31642
- on("seeked", handler(2)),
31643
- on("volumechange", handler(3))
31644
- ];
31645
- return function() {
31646
- handlers2.forEach(function(h2) {
31647
- return h2();
31648
- });
31649
- };
31650
- }
31651
- function initFontObserver(_a) {
31652
- var fontCb = _a.fontCb, doc = _a.doc;
31653
- var win = doc.defaultView;
31654
- if (!win) {
31655
- return function() {
31656
- };
31657
- }
31658
- var handlers2 = [];
31659
- var fontMap = /* @__PURE__ */ new WeakMap();
31660
- var originalFontFace = win.FontFace;
31661
- win.FontFace = function FontFace(family, source, descriptors) {
31662
- var fontFace = new originalFontFace(family, source, descriptors);
31663
- fontMap.set(fontFace, {
31664
- family,
31665
- buffer: typeof source !== "string",
31666
- descriptors,
31667
- fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source)))
31668
- });
31669
- return fontFace;
31670
- };
31671
- var restoreHandler = patch(doc.fonts, "add", function(original) {
31672
- return function(fontFace) {
31673
- setTimeout(function() {
31674
- var p2 = fontMap.get(fontFace);
31675
- if (p2) {
31676
- fontCb(p2);
31677
- fontMap.delete(fontFace);
31678
- }
31679
- }, 0);
31680
- return original.apply(this, [fontFace]);
31681
- };
31682
- });
31683
- handlers2.push(function() {
31684
- win.FontFace = originalFontFace;
31685
- });
31686
- handlers2.push(restoreHandler);
31687
- return function() {
31688
- handlers2.forEach(function(h2) {
31689
- return h2();
31690
- });
31691
- };
31692
- }
31693
- function mergeHooks(o2, hooks) {
31694
- var mutationCb = o2.mutationCb, mousemoveCb = o2.mousemoveCb, mouseInteractionCb = o2.mouseInteractionCb, scrollCb = o2.scrollCb, viewportResizeCb = o2.viewportResizeCb, inputCb = o2.inputCb, mediaInteractionCb = o2.mediaInteractionCb, styleSheetRuleCb = o2.styleSheetRuleCb, styleDeclarationCb = o2.styleDeclarationCb, canvasMutationCb = o2.canvasMutationCb, fontCb = o2.fontCb;
31695
- o2.mutationCb = function() {
31696
- var p2 = [];
31697
- for (var _i = 0; _i < arguments.length; _i++) {
31698
- p2[_i] = arguments[_i];
31699
- }
31700
- if (hooks.mutation) {
31701
- hooks.mutation.apply(hooks, __spreadArray([], __read(p2), false));
31702
- }
31703
- mutationCb.apply(void 0, __spreadArray([], __read(p2), false));
31704
- };
31705
- o2.mousemoveCb = function() {
31706
- var p2 = [];
31707
- for (var _i = 0; _i < arguments.length; _i++) {
31708
- p2[_i] = arguments[_i];
31709
- }
31710
- if (hooks.mousemove) {
31711
- hooks.mousemove.apply(hooks, __spreadArray([], __read(p2), false));
31712
- }
31713
- mousemoveCb.apply(void 0, __spreadArray([], __read(p2), false));
31714
- };
31715
- o2.mouseInteractionCb = function() {
31716
- var p2 = [];
31717
- for (var _i = 0; _i < arguments.length; _i++) {
31718
- p2[_i] = arguments[_i];
31719
- }
31720
- if (hooks.mouseInteraction) {
31721
- hooks.mouseInteraction.apply(hooks, __spreadArray([], __read(p2), false));
31722
- }
31723
- mouseInteractionCb.apply(void 0, __spreadArray([], __read(p2), false));
31724
- };
31725
- o2.scrollCb = function() {
31726
- var p2 = [];
31727
- for (var _i = 0; _i < arguments.length; _i++) {
31728
- p2[_i] = arguments[_i];
31729
- }
31730
- if (hooks.scroll) {
31731
- hooks.scroll.apply(hooks, __spreadArray([], __read(p2), false));
31732
- }
31733
- scrollCb.apply(void 0, __spreadArray([], __read(p2), false));
31734
- };
31735
- o2.viewportResizeCb = function() {
31736
- var p2 = [];
31737
- for (var _i = 0; _i < arguments.length; _i++) {
31738
- p2[_i] = arguments[_i];
31739
- }
31740
- if (hooks.viewportResize) {
31741
- hooks.viewportResize.apply(hooks, __spreadArray([], __read(p2), false));
31742
- }
31743
- viewportResizeCb.apply(void 0, __spreadArray([], __read(p2), false));
31744
- };
31745
- o2.inputCb = function() {
31746
- var p2 = [];
31747
- for (var _i = 0; _i < arguments.length; _i++) {
31748
- p2[_i] = arguments[_i];
31749
- }
31750
- if (hooks.input) {
31751
- hooks.input.apply(hooks, __spreadArray([], __read(p2), false));
31752
- }
31753
- inputCb.apply(void 0, __spreadArray([], __read(p2), false));
31754
- };
31755
- o2.mediaInteractionCb = function() {
31756
- var p2 = [];
31757
- for (var _i = 0; _i < arguments.length; _i++) {
31758
- p2[_i] = arguments[_i];
31759
- }
31760
- if (hooks.mediaInteaction) {
31761
- hooks.mediaInteaction.apply(hooks, __spreadArray([], __read(p2), false));
31762
- }
31763
- mediaInteractionCb.apply(void 0, __spreadArray([], __read(p2), false));
31764
- };
31765
- o2.styleSheetRuleCb = function() {
31766
- var p2 = [];
31767
- for (var _i = 0; _i < arguments.length; _i++) {
31768
- p2[_i] = arguments[_i];
31769
- }
31770
- if (hooks.styleSheetRule) {
31771
- hooks.styleSheetRule.apply(hooks, __spreadArray([], __read(p2), false));
31772
- }
31773
- styleSheetRuleCb.apply(void 0, __spreadArray([], __read(p2), false));
31774
- };
31775
- o2.styleDeclarationCb = function() {
31776
- var p2 = [];
31777
- for (var _i = 0; _i < arguments.length; _i++) {
31778
- p2[_i] = arguments[_i];
31779
- }
31780
- if (hooks.styleDeclaration) {
31781
- hooks.styleDeclaration.apply(hooks, __spreadArray([], __read(p2), false));
31782
- }
31783
- styleDeclarationCb.apply(void 0, __spreadArray([], __read(p2), false));
31784
- };
31785
- o2.canvasMutationCb = function() {
31786
- var p2 = [];
31787
- for (var _i = 0; _i < arguments.length; _i++) {
31788
- p2[_i] = arguments[_i];
31789
- }
31790
- if (hooks.canvasMutation) {
31791
- hooks.canvasMutation.apply(hooks, __spreadArray([], __read(p2), false));
31792
- }
31793
- canvasMutationCb.apply(void 0, __spreadArray([], __read(p2), false));
31794
- };
31795
- o2.fontCb = function() {
31796
- var p2 = [];
31797
- for (var _i = 0; _i < arguments.length; _i++) {
31798
- p2[_i] = arguments[_i];
31799
- }
31800
- if (hooks.font) {
31801
- hooks.font.apply(hooks, __spreadArray([], __read(p2), false));
31802
- }
31803
- fontCb.apply(void 0, __spreadArray([], __read(p2), false));
31804
- };
31805
- }
31806
- function initObservers(o2, hooks) {
31807
- var e_1, _a;
31808
- if (hooks === void 0) {
31809
- hooks = {};
31810
- }
31811
- var currentWindow = o2.doc.defaultView;
31812
- if (!currentWindow) {
31813
- return function() {
31814
- };
31815
- }
31816
- mergeHooks(o2, hooks);
31817
- var mutationObserver = initMutationObserver(o2, o2.doc);
31818
- var mousemoveHandler = initMoveObserver(o2);
31819
- var mouseInteractionHandler = initMouseInteractionObserver(o2);
31820
- var scrollHandler = initScrollObserver(o2);
31821
- var viewportResizeHandler = initViewportResizeObserver(o2);
31822
- var inputHandler = initInputObserver(o2);
31823
- var mediaInteractionHandler = initMediaInteractionObserver(o2);
31824
- var styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow });
31825
- var styleDeclarationObserver = initStyleDeclarationObserver(o2, {
31826
- win: currentWindow
31827
- });
31828
- var fontObserver = o2.collectFonts ? initFontObserver(o2) : function() {
31829
- };
31830
- var pluginHandlers = [];
31831
- try {
31832
- for (var _b = __values(o2.plugins), _c = _b.next(); !_c.done; _c = _b.next()) {
31833
- var plugin = _c.value;
31834
- pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
31835
- }
31836
- } catch (e_1_1) {
31837
- e_1 = { error: e_1_1 };
31838
- } finally {
31839
- try {
31840
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
31841
- } finally {
31842
- if (e_1) throw e_1.error;
31843
- }
31844
- }
31845
- return function() {
31846
- mutationBuffers.forEach(function(b2) {
31847
- return b2.reset();
31848
- });
31849
- mutationObserver.disconnect();
31850
- mousemoveHandler();
31851
- mouseInteractionHandler();
31852
- scrollHandler();
31853
- viewportResizeHandler();
31854
- inputHandler();
31855
- mediaInteractionHandler();
31856
- styleSheetObserver();
31857
- styleDeclarationObserver();
31858
- fontObserver();
31859
- pluginHandlers.forEach(function(h2) {
31860
- return h2();
31861
- });
31862
- };
31863
- }
31864
-
31865
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/iframe-manager.js
31866
- var IframeManager = (function() {
31867
- function IframeManager2(options) {
31868
- this.iframes = /* @__PURE__ */ new WeakMap();
31869
- this.mutationCb = options.mutationCb;
31870
- }
31871
- IframeManager2.prototype.addIframe = function(iframeEl) {
31872
- this.iframes.set(iframeEl, true);
31873
- };
31874
- IframeManager2.prototype.addLoadListener = function(cb) {
31875
- this.loadListener = cb;
31876
- };
31877
- IframeManager2.prototype.attachIframe = function(iframeEl, childSn) {
31878
- var _a;
31879
- this.mutationCb({
31880
- adds: [
31881
- {
31882
- parentId: iframeEl.__sn.id,
31883
- nextId: null,
31884
- node: childSn
31885
- }
31886
- ],
31887
- removes: [],
31888
- texts: [],
31889
- attributes: [],
31890
- isAttachIframe: true
31891
- });
31892
- (_a = this.loadListener) === null || _a === void 0 ? void 0 : _a.call(this, iframeEl);
31893
- };
31894
- return IframeManager2;
31895
- })();
31896
-
31897
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js
31898
- var ShadowDomManager = (function() {
31899
- function ShadowDomManager2(options) {
31900
- this.restorePatches = [];
31901
- this.mutationCb = options.mutationCb;
31902
- this.scrollCb = options.scrollCb;
31903
- this.bypassOptions = options.bypassOptions;
31904
- this.mirror = options.mirror;
31905
- var manager = this;
31906
- this.restorePatches.push(patch(HTMLElement.prototype, "attachShadow", function(original) {
31907
- return function() {
31908
- var shadowRoot = original.apply(this, arguments);
31909
- if (this.shadowRoot)
31910
- manager.addShadowRoot(this.shadowRoot, this.ownerDocument);
31911
- return shadowRoot;
31912
- };
31913
- }));
31914
- }
31915
- ShadowDomManager2.prototype.addShadowRoot = function(shadowRoot, doc) {
31916
- initMutationObserver(__assign(__assign({}, this.bypassOptions), { doc, mutationCb: this.mutationCb, mirror: this.mirror, shadowDomManager: this }), shadowRoot);
31917
- initScrollObserver(__assign(__assign({}, this.bypassOptions), { scrollCb: this.scrollCb, doc: shadowRoot, mirror: this.mirror }));
31918
- };
31919
- ShadowDomManager2.prototype.observeAttachShadow = function(iframeElement) {
31920
- if (iframeElement.contentWindow) {
31921
- var manager_1 = this;
31922
- this.restorePatches.push(patch(iframeElement.contentWindow.HTMLElement.prototype, "attachShadow", function(original) {
31923
- return function() {
31924
- var shadowRoot = original.apply(this, arguments);
31925
- if (this.shadowRoot)
31926
- manager_1.addShadowRoot(this.shadowRoot, iframeElement.contentDocument);
31927
- return shadowRoot;
31928
- };
31929
- }));
31930
- }
31931
- };
31932
- ShadowDomManager2.prototype.reset = function() {
31933
- this.restorePatches.forEach(function(restorePatch) {
31934
- return restorePatch();
31935
- });
31936
- };
31937
- return ShadowDomManager2;
31938
- })();
31939
-
31940
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js
31941
- function initCanvas2DMutationObserver(cb, win, blockClass, mirror2) {
31942
- var e_1, _a;
31943
- var handlers2 = [];
31944
- var props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);
31945
- var _loop_1 = function(prop2) {
31946
- try {
31947
- if (typeof win.CanvasRenderingContext2D.prototype[prop2] !== "function") {
31948
- return "continue";
31949
- }
31950
- var restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop2, function(original) {
31951
- return function() {
31952
- var _this = this;
31953
- var args = [];
31954
- for (var _i = 0; _i < arguments.length; _i++) {
31955
- args[_i] = arguments[_i];
31956
- }
31957
- if (!isBlocked(this.canvas, blockClass)) {
31958
- setTimeout(function() {
31959
- var recordArgs = __spreadArray([], __read(args), false);
31960
- if (prop2 === "drawImage") {
31961
- if (recordArgs[0] && recordArgs[0] instanceof HTMLCanvasElement) {
31962
- var canvas = recordArgs[0];
31963
- var ctx = canvas.getContext("2d");
31964
- var imgd = ctx === null || ctx === void 0 ? void 0 : ctx.getImageData(0, 0, canvas.width, canvas.height);
31965
- var pix = imgd === null || imgd === void 0 ? void 0 : imgd.data;
31966
- recordArgs[0] = JSON.stringify(pix);
31967
- }
31968
- }
31969
- cb(_this.canvas, {
31970
- type: CanvasContext["2D"],
31971
- property: prop2,
31972
- args: recordArgs
31973
- });
31974
- }, 0);
31975
- }
31976
- return original.apply(this, args);
31977
- };
31978
- });
31979
- handlers2.push(restoreHandler);
31980
- } catch (_b) {
31981
- var hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop2, {
31982
- set: function(v2) {
31983
- cb(this.canvas, {
31984
- type: CanvasContext["2D"],
31985
- property: prop2,
31986
- args: [v2],
31987
- setter: true
31988
- });
31989
- }
31990
- });
31991
- handlers2.push(hookHandler);
31992
- }
31993
- };
31994
- try {
31995
- for (var props2D_1 = __values(props2D), props2D_1_1 = props2D_1.next(); !props2D_1_1.done; props2D_1_1 = props2D_1.next()) {
31996
- var prop = props2D_1_1.value;
31997
- _loop_1(prop);
31998
- }
31999
- } catch (e_1_1) {
32000
- e_1 = { error: e_1_1 };
32001
- } finally {
32002
- try {
32003
- if (props2D_1_1 && !props2D_1_1.done && (_a = props2D_1.return)) _a.call(props2D_1);
32004
- } finally {
32005
- if (e_1) throw e_1.error;
32006
- }
32007
- }
32008
- return function() {
32009
- handlers2.forEach(function(h2) {
32010
- return h2();
32011
- });
32012
- };
32013
- }
32014
- var d_default = initCanvas2DMutationObserver;
32015
-
32016
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js
32017
- function initCanvasContextObserver(win, blockClass) {
32018
- var handlers2 = [];
32019
- try {
32020
- var restoreHandler = patch(win.HTMLCanvasElement.prototype, "getContext", function(original) {
32021
- return function(contextType) {
32022
- var args = [];
32023
- for (var _i = 1; _i < arguments.length; _i++) {
32024
- args[_i - 1] = arguments[_i];
32025
- }
32026
- if (!isBlocked(this, blockClass)) {
32027
- if (!("__context" in this))
32028
- this.__context = contextType;
32029
- }
32030
- return original.apply(this, __spreadArray([contextType], __read(args), false));
32031
- };
32032
- });
32033
- handlers2.push(restoreHandler);
32034
- } catch (_a) {
32035
- console.error("failed to patch HTMLCanvasElement.prototype.getContext");
32036
- }
32037
- return function() {
32038
- handlers2.forEach(function(h2) {
32039
- return h2();
32040
- });
32041
- };
32042
- }
32043
- var canvas_default = initCanvasContextObserver;
32044
-
32045
- // ../../node_modules/rrweb/es/rrweb/ext/base64-arraybuffer/dist/base64-arraybuffer.es5.js
32046
- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
32047
- var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
32048
- for (i2 = 0; i2 < chars.length; i2++) {
32049
- lookup[chars.charCodeAt(i2)] = i2;
32050
- }
32051
- var i2;
32052
- var encode = function(arraybuffer) {
32053
- var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
32054
- for (i2 = 0; i2 < len; i2 += 3) {
32055
- base64 += chars[bytes[i2] >> 2];
32056
- base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
32057
- base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
32058
- base64 += chars[bytes[i2 + 2] & 63];
32059
- }
32060
- if (len % 3 === 2) {
32061
- base64 = base64.substring(0, base64.length - 1) + "=";
32062
- } else if (len % 3 === 1) {
32063
- base64 = base64.substring(0, base64.length - 2) + "==";
32064
- }
32065
- return base64;
32066
- };
32067
-
32068
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js
32069
- var webGLVarMap = /* @__PURE__ */ new Map();
32070
- function variableListFor(ctx, ctor) {
32071
- var contextMap = webGLVarMap.get(ctx);
32072
- if (!contextMap) {
32073
- contextMap = /* @__PURE__ */ new Map();
32074
- webGLVarMap.set(ctx, contextMap);
32075
- }
32076
- if (!contextMap.has(ctor)) {
32077
- contextMap.set(ctor, []);
32078
- }
32079
- return contextMap.get(ctor);
32080
- }
32081
- var saveWebGLVar = function(value, win, ctx) {
32082
- if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === "object"))
32083
- return;
32084
- var name = value.constructor.name;
32085
- var list = variableListFor(ctx, name);
32086
- var index = list.indexOf(value);
32087
- if (index === -1) {
32088
- index = list.length;
32089
- list.push(value);
32090
- }
32091
- return index;
32092
- };
32093
- function serializeArg(value, win, ctx) {
32094
- if (value instanceof Array) {
32095
- return value.map(function(arg) {
32096
- return serializeArg(arg, win, ctx);
32097
- });
32098
- } else if (value === null) {
32099
- return value;
32100
- } else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {
32101
- var name_1 = value.constructor.name;
32102
- return {
32103
- rr_type: name_1,
32104
- args: [Object.values(value)]
32105
- };
32106
- } else if (value instanceof ArrayBuffer) {
32107
- var name_2 = value.constructor.name;
32108
- var base64 = encode(value);
32109
- return {
32110
- rr_type: name_2,
32111
- base64
32112
- };
32113
- } else if (value instanceof DataView) {
32114
- var name_3 = value.constructor.name;
32115
- return {
32116
- rr_type: name_3,
32117
- args: [
32118
- serializeArg(value.buffer, win, ctx),
32119
- value.byteOffset,
32120
- value.byteLength
32121
- ]
32122
- };
32123
- } else if (value instanceof HTMLImageElement) {
32124
- var name_4 = value.constructor.name;
32125
- var src = value.src;
32126
- return {
32127
- rr_type: name_4,
32128
- src
32129
- };
32130
- } else if (value instanceof ImageData) {
32131
- var name_5 = value.constructor.name;
32132
- return {
32133
- rr_type: name_5,
32134
- args: [serializeArg(value.data, win, ctx), value.width, value.height]
32135
- };
32136
- } else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {
32137
- var name_6 = value.constructor.name;
32138
- var index = saveWebGLVar(value, win, ctx);
32139
- return {
32140
- rr_type: name_6,
32141
- index
32142
- };
32143
- }
32144
- return value;
32145
- }
32146
- var serializeArgs = function(args, win, ctx) {
32147
- return __spreadArray([], __read(args), false).map(function(arg) {
32148
- return serializeArg(arg, win, ctx);
32149
- });
32150
- };
32151
- var isInstanceOfWebGLObject = function(value, win) {
32152
- var webGLConstructorNames = [
32153
- "WebGLActiveInfo",
32154
- "WebGLBuffer",
32155
- "WebGLFramebuffer",
32156
- "WebGLProgram",
32157
- "WebGLRenderbuffer",
32158
- "WebGLShader",
32159
- "WebGLShaderPrecisionFormat",
32160
- "WebGLTexture",
32161
- "WebGLUniformLocation",
32162
- "WebGLVertexArrayObject",
32163
- "WebGLVertexArrayObjectOES"
32164
- ];
32165
- var supportedWebGLConstructorNames = webGLConstructorNames.filter(function(name) {
32166
- return typeof win[name] === "function";
32167
- });
32168
- return Boolean(supportedWebGLConstructorNames.find(function(name) {
32169
- return value instanceof win[name];
32170
- }));
32171
- };
32172
-
32173
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js
32174
- function patchGLPrototype(prototype, type, cb, blockClass, mirror2, win) {
32175
- var e_1, _a;
32176
- var handlers2 = [];
32177
- var props = Object.getOwnPropertyNames(prototype);
32178
- var _loop_1 = function(prop2) {
32179
- try {
32180
- if (typeof prototype[prop2] !== "function") {
32181
- return "continue";
32182
- }
32183
- var restoreHandler = patch(prototype, prop2, function(original) {
32184
- return function() {
32185
- var args = [];
32186
- for (var _i = 0; _i < arguments.length; _i++) {
32187
- args[_i] = arguments[_i];
32188
- }
32189
- var result = original.apply(this, args);
32190
- saveWebGLVar(result, win, prototype);
32191
- if (!isBlocked(this.canvas, blockClass)) {
32192
- var id = mirror2.getId(this.canvas);
32193
- var recordArgs = serializeArgs(__spreadArray([], __read(args), false), win, prototype);
32194
- var mutation = {
32195
- type,
32196
- property: prop2,
32197
- args: recordArgs
32198
- };
32199
- cb(this.canvas, mutation);
32200
- }
32201
- return result;
32202
- };
32203
- });
32204
- handlers2.push(restoreHandler);
32205
- } catch (_b) {
32206
- var hookHandler = hookSetter(prototype, prop2, {
32207
- set: function(v2) {
32208
- cb(this.canvas, {
32209
- type,
32210
- property: prop2,
32211
- args: [v2],
32212
- setter: true
32213
- });
32214
- }
32215
- });
32216
- handlers2.push(hookHandler);
32217
- }
32218
- };
32219
- try {
32220
- for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
32221
- var prop = props_1_1.value;
32222
- _loop_1(prop);
32223
- }
32224
- } catch (e_1_1) {
32225
- e_1 = { error: e_1_1 };
32226
- } finally {
32227
- try {
32228
- if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
32229
- } finally {
32230
- if (e_1) throw e_1.error;
32231
- }
32232
- }
32233
- return handlers2;
32234
- }
32235
- function initCanvasWebGLMutationObserver(cb, win, blockClass, mirror2) {
32236
- var handlers2 = [];
32237
- handlers2.push.apply(handlers2, __spreadArray([], __read(patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, mirror2, win)), false));
32238
- if (typeof win.WebGL2RenderingContext !== "undefined") {
32239
- handlers2.push.apply(handlers2, __spreadArray([], __read(patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, mirror2, win)), false));
32240
- }
32241
- return function() {
32242
- handlers2.forEach(function(h2) {
32243
- return h2();
32244
- });
32245
- };
32246
- }
32247
- var webgl_default = initCanvasWebGLMutationObserver;
32248
-
32249
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js
32250
- var CanvasManager = (function() {
32251
- function CanvasManager2(options) {
32252
- this.pendingCanvasMutations = /* @__PURE__ */ new Map();
32253
- this.rafStamps = { latestId: 0, invokeId: null };
32254
- this.frozen = false;
32255
- this.locked = false;
32256
- this.processMutation = function(target, mutation) {
32257
- var newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;
32258
- if (newFrame || !this.rafStamps.invokeId)
32259
- this.rafStamps.invokeId = this.rafStamps.latestId;
32260
- if (!this.pendingCanvasMutations.has(target)) {
32261
- this.pendingCanvasMutations.set(target, []);
32262
- }
32263
- this.pendingCanvasMutations.get(target).push(mutation);
32264
- };
32265
- this.mutationCb = options.mutationCb;
32266
- this.mirror = options.mirror;
32267
- if (options.recordCanvas === true)
32268
- this.initCanvasMutationObserver(options.win, options.blockClass);
32269
- }
32270
- CanvasManager2.prototype.reset = function() {
32271
- this.pendingCanvasMutations.clear();
32272
- this.resetObservers && this.resetObservers();
32273
- };
32274
- CanvasManager2.prototype.freeze = function() {
32275
- this.frozen = true;
32276
- };
32277
- CanvasManager2.prototype.unfreeze = function() {
32278
- this.frozen = false;
32279
- };
32280
- CanvasManager2.prototype.lock = function() {
32281
- this.locked = true;
32282
- };
32283
- CanvasManager2.prototype.unlock = function() {
32284
- this.locked = false;
32285
- };
32286
- CanvasManager2.prototype.initCanvasMutationObserver = function(win, blockClass) {
32287
- this.startRAFTimestamping();
32288
- this.startPendingCanvasMutationFlusher();
32289
- var canvasContextReset = canvas_default(win, blockClass);
32290
- var canvas2DReset = d_default(this.processMutation.bind(this), win, blockClass, this.mirror);
32291
- var canvasWebGL1and2Reset = webgl_default(this.processMutation.bind(this), win, blockClass, this.mirror);
32292
- this.resetObservers = function() {
32293
- canvasContextReset();
32294
- canvas2DReset();
32295
- canvasWebGL1and2Reset();
32296
- };
32297
- };
32298
- CanvasManager2.prototype.startPendingCanvasMutationFlusher = function() {
32299
- var _this = this;
32300
- requestAnimationFrame(function() {
32301
- return _this.flushPendingCanvasMutations();
32302
- });
32303
- };
32304
- CanvasManager2.prototype.startRAFTimestamping = function() {
32305
- var _this = this;
32306
- var setLatestRAFTimestamp = function(timestamp) {
32307
- _this.rafStamps.latestId = timestamp;
32308
- requestAnimationFrame(setLatestRAFTimestamp);
32309
- };
32310
- requestAnimationFrame(setLatestRAFTimestamp);
32311
- };
32312
- CanvasManager2.prototype.flushPendingCanvasMutations = function() {
32313
- var _this = this;
32314
- this.pendingCanvasMutations.forEach(function(values, canvas) {
32315
- var id = _this.mirror.getId(canvas);
32316
- _this.flushPendingCanvasMutationFor(canvas, id);
32317
- });
32318
- requestAnimationFrame(function() {
32319
- return _this.flushPendingCanvasMutations();
32320
- });
32321
- };
32322
- CanvasManager2.prototype.flushPendingCanvasMutationFor = function(canvas, id) {
32323
- if (this.frozen || this.locked) {
32324
- return;
32325
- }
32326
- var valuesWithType = this.pendingCanvasMutations.get(canvas);
32327
- if (!valuesWithType || id === -1)
32328
- return;
32329
- var values = valuesWithType.map(function(value) {
32330
- value.type;
32331
- var rest = __rest(value, ["type"]);
32332
- return rest;
32333
- });
32334
- var type = valuesWithType[0].type;
32335
- this.mutationCb({ id, type, commands: values });
32336
- this.pendingCanvasMutations.delete(canvas);
32337
- };
32338
- return CanvasManager2;
32339
- })();
32340
-
32341
- // ../../node_modules/rrweb/es/rrweb/packages/rrweb/src/record/index.js
32342
- function wrapEvent(e2) {
32343
- return __assign(__assign({}, e2), { timestamp: Date.now() });
32344
- }
32345
- var wrappedEmit;
32346
- var takeFullSnapshot;
32347
- var mirror = createMirror();
32348
- function record(options) {
32349
- if (options === void 0) {
32350
- options = {};
32351
- }
32352
- var emit = options.emit, checkoutEveryNms = options.checkoutEveryNms, checkoutEveryNth = options.checkoutEveryNth, _a = options.blockClass, blockClass = _a === void 0 ? "rr-block" : _a, _b = options.blockSelector, blockSelector = _b === void 0 ? null : _b, _c = options.ignoreClass, ignoreClass = _c === void 0 ? "rr-ignore" : _c, _d = options.maskTextClass, maskTextClass = _d === void 0 ? "rr-mask" : _d, _e = options.maskTextSelector, maskTextSelector = _e === void 0 ? null : _e, _f = options.inlineStylesheet, inlineStylesheet = _f === void 0 ? true : _f, maskAllInputs = options.maskAllInputs, _maskInputOptions = options.maskInputOptions, _slimDOMOptions = options.slimDOMOptions, maskInputFn = options.maskInputFn, maskTextFn = options.maskTextFn, hooks = options.hooks, packFn = options.packFn, _g = options.sampling, sampling = _g === void 0 ? {} : _g, mousemoveWait = options.mousemoveWait, _h = options.recordCanvas, recordCanvas = _h === void 0 ? false : _h, _j = options.userTriggeredOnInput, userTriggeredOnInput = _j === void 0 ? false : _j, _k = options.collectFonts, collectFonts = _k === void 0 ? false : _k, _l = options.inlineImages, inlineImages = _l === void 0 ? false : _l, plugins = options.plugins, _m = options.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function() {
32353
- return false;
32354
- } : _m;
32355
- if (!emit) {
32356
- throw new Error("emit function is required");
32357
- }
32358
- if (mousemoveWait !== void 0 && sampling.mousemove === void 0) {
32359
- sampling.mousemove = mousemoveWait;
32360
- }
32361
- var maskInputOptions = maskAllInputs === true ? {
32362
- color: true,
32363
- date: true,
32364
- "datetime-local": true,
32365
- email: true,
32366
- month: true,
32367
- number: true,
32368
- range: true,
32369
- search: true,
32370
- tel: true,
32371
- text: true,
32372
- time: true,
32373
- url: true,
32374
- week: true,
32375
- textarea: true,
32376
- select: true,
32377
- password: true
32378
- } : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };
32379
- var slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? {
32380
- script: true,
32381
- comment: true,
32382
- headFavicon: true,
32383
- headWhitespace: true,
32384
- headMetaSocial: true,
32385
- headMetaRobots: true,
32386
- headMetaHttpEquiv: true,
32387
- headMetaVerification: true,
32388
- headMetaAuthorship: _slimDOMOptions === "all",
32389
- headMetaDescKeywords: _slimDOMOptions === "all"
32390
- } : _slimDOMOptions ? _slimDOMOptions : {};
32391
- polyfill();
32392
- var lastFullSnapshotEvent;
32393
- var incrementalSnapshotCount = 0;
32394
- var eventProcessor = function(e2) {
32395
- var e_1, _a2;
32396
- try {
32397
- for (var _b2 = __values(plugins || []), _c2 = _b2.next(); !_c2.done; _c2 = _b2.next()) {
32398
- var plugin = _c2.value;
32399
- if (plugin.eventProcessor) {
32400
- e2 = plugin.eventProcessor(e2);
32401
- }
32402
- }
32403
- } catch (e_1_1) {
32404
- e_1 = { error: e_1_1 };
32405
- } finally {
32406
- try {
32407
- if (_c2 && !_c2.done && (_a2 = _b2.return)) _a2.call(_b2);
32408
- } finally {
32409
- if (e_1) throw e_1.error;
32410
- }
32411
- }
32412
- if (packFn) {
32413
- e2 = packFn(e2);
32414
- }
32415
- return e2;
32416
- };
32417
- wrappedEmit = function(e2, isCheckout) {
32418
- var _a2;
32419
- if (((_a2 = mutationBuffers[0]) === null || _a2 === void 0 ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
32420
- mutationBuffers.forEach(function(buf) {
32421
- return buf.unfreeze();
32422
- });
32423
- }
32424
- emit(eventProcessor(e2), isCheckout);
32425
- if (e2.type === EventType.FullSnapshot) {
32426
- lastFullSnapshotEvent = e2;
32427
- incrementalSnapshotCount = 0;
32428
- } else if (e2.type === EventType.IncrementalSnapshot) {
32429
- if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) {
32430
- return;
32431
- }
32432
- incrementalSnapshotCount++;
32433
- var exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
32434
- var exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
32435
- if (exceedCount || exceedTime) {
32436
- takeFullSnapshot(true);
32437
- }
32438
- }
32439
- };
32440
- var wrappedMutationEmit = function(m2) {
32441
- wrappedEmit(wrapEvent({
32442
- type: EventType.IncrementalSnapshot,
32443
- data: __assign({ source: IncrementalSource.Mutation }, m2)
32444
- }));
32445
- };
32446
- var wrappedScrollEmit = function(p2) {
32447
- return wrappedEmit(wrapEvent({
32448
- type: EventType.IncrementalSnapshot,
32449
- data: __assign({ source: IncrementalSource.Scroll }, p2)
32450
- }));
32451
- };
32452
- var wrappedCanvasMutationEmit = function(p2) {
32453
- return wrappedEmit(wrapEvent({
32454
- type: EventType.IncrementalSnapshot,
32455
- data: __assign({ source: IncrementalSource.CanvasMutation }, p2)
32456
- }));
32457
- };
32458
- var iframeManager = new IframeManager({
32459
- mutationCb: wrappedMutationEmit
32460
- });
32461
- var canvasManager = new CanvasManager({
32462
- recordCanvas,
32463
- mutationCb: wrappedCanvasMutationEmit,
32464
- win: window,
32465
- blockClass,
32466
- mirror
32467
- });
32468
- var shadowDomManager = new ShadowDomManager({
32469
- mutationCb: wrappedMutationEmit,
32470
- scrollCb: wrappedScrollEmit,
32471
- bypassOptions: {
32472
- blockClass,
32473
- blockSelector,
32474
- maskTextClass,
32475
- maskTextSelector,
32476
- inlineStylesheet,
32477
- maskInputOptions,
32478
- maskTextFn,
32479
- maskInputFn,
32480
- recordCanvas,
32481
- inlineImages,
32482
- sampling,
32483
- slimDOMOptions,
32484
- iframeManager,
32485
- canvasManager
32486
- },
32487
- mirror
32488
- });
32489
- takeFullSnapshot = function(isCheckout) {
32490
- var _a2, _b2, _c2, _d2;
32491
- if (isCheckout === void 0) {
32492
- isCheckout = false;
32493
- }
32494
- wrappedEmit(wrapEvent({
32495
- type: EventType.Meta,
32496
- data: {
32497
- href: window.location.href,
32498
- width: getWindowWidth(),
32499
- height: getWindowHeight()
32500
- }
32501
- }), isCheckout);
32502
- mutationBuffers.forEach(function(buf) {
32503
- return buf.lock();
32504
- });
32505
- var _e2 = __read(snapshot(document, {
32506
- blockClass,
32507
- blockSelector,
32508
- maskTextClass,
32509
- maskTextSelector,
32510
- inlineStylesheet,
32511
- maskAllInputs: maskInputOptions,
32512
- maskTextFn,
32513
- slimDOM: slimDOMOptions,
32514
- recordCanvas,
32515
- inlineImages,
32516
- onSerialize: function(n2) {
32517
- if (isIframeINode(n2)) {
32518
- iframeManager.addIframe(n2);
32519
- }
32520
- if (hasShadowRoot(n2)) {
32521
- shadowDomManager.addShadowRoot(n2.shadowRoot, document);
32522
- }
32523
- },
32524
- onIframeLoad: function(iframe, childSn) {
32525
- iframeManager.attachIframe(iframe, childSn);
32526
- shadowDomManager.observeAttachShadow(iframe);
32527
- },
32528
- keepIframeSrcFn
32529
- }), 2), node = _e2[0], idNodeMap = _e2[1];
32530
- if (!node) {
32531
- return console.warn("Failed to snapshot the document");
32532
- }
32533
- mirror.map = idNodeMap;
32534
- wrappedEmit(wrapEvent({
32535
- type: EventType.FullSnapshot,
32536
- data: {
32537
- node,
32538
- initialOffset: {
32539
- left: window.pageXOffset !== void 0 ? window.pageXOffset : (document === null || document === void 0 ? void 0 : document.documentElement.scrollLeft) || ((_b2 = (_a2 = document === null || document === void 0 ? void 0 : document.body) === null || _a2 === void 0 ? void 0 : _a2.parentElement) === null || _b2 === void 0 ? void 0 : _b2.scrollLeft) || (document === null || document === void 0 ? void 0 : document.body.scrollLeft) || 0,
32540
- top: window.pageYOffset !== void 0 ? window.pageYOffset : (document === null || document === void 0 ? void 0 : document.documentElement.scrollTop) || ((_d2 = (_c2 = document === null || document === void 0 ? void 0 : document.body) === null || _c2 === void 0 ? void 0 : _c2.parentElement) === null || _d2 === void 0 ? void 0 : _d2.scrollTop) || (document === null || document === void 0 ? void 0 : document.body.scrollTop) || 0
32541
- }
32542
- }
32543
- }));
32544
- mutationBuffers.forEach(function(buf) {
32545
- return buf.unlock();
32546
- });
32547
- };
32548
- try {
32549
- var handlers_1 = [];
32550
- handlers_1.push(on("DOMContentLoaded", function() {
32551
- wrappedEmit(wrapEvent({
32552
- type: EventType.DomContentLoaded,
32553
- data: {}
32554
- }));
32555
- }));
32556
- var observe_1 = function(doc) {
32557
- var _a2;
32558
- return initObservers({
32559
- mutationCb: wrappedMutationEmit,
32560
- mousemoveCb: function(positions, source) {
32561
- return wrappedEmit(wrapEvent({
32562
- type: EventType.IncrementalSnapshot,
32563
- data: {
32564
- source,
32565
- positions
32566
- }
32567
- }));
32568
- },
32569
- mouseInteractionCb: function(d2) {
32570
- return wrappedEmit(wrapEvent({
32571
- type: EventType.IncrementalSnapshot,
32572
- data: __assign({ source: IncrementalSource.MouseInteraction }, d2)
32573
- }));
32574
- },
32575
- scrollCb: wrappedScrollEmit,
32576
- viewportResizeCb: function(d2) {
32577
- return wrappedEmit(wrapEvent({
32578
- type: EventType.IncrementalSnapshot,
32579
- data: __assign({ source: IncrementalSource.ViewportResize }, d2)
32580
- }));
32581
- },
32582
- inputCb: function(v2) {
32583
- return wrappedEmit(wrapEvent({
32584
- type: EventType.IncrementalSnapshot,
32585
- data: __assign({ source: IncrementalSource.Input }, v2)
32586
- }));
32587
- },
32588
- mediaInteractionCb: function(p2) {
32589
- return wrappedEmit(wrapEvent({
32590
- type: EventType.IncrementalSnapshot,
32591
- data: __assign({ source: IncrementalSource.MediaInteraction }, p2)
32592
- }));
32593
- },
32594
- styleSheetRuleCb: function(r2) {
32595
- return wrappedEmit(wrapEvent({
32596
- type: EventType.IncrementalSnapshot,
32597
- data: __assign({ source: IncrementalSource.StyleSheetRule }, r2)
32598
- }));
32599
- },
32600
- styleDeclarationCb: function(r2) {
32601
- return wrappedEmit(wrapEvent({
32602
- type: EventType.IncrementalSnapshot,
32603
- data: __assign({ source: IncrementalSource.StyleDeclaration }, r2)
32604
- }));
32605
- },
32606
- canvasMutationCb: wrappedCanvasMutationEmit,
32607
- fontCb: function(p2) {
32608
- return wrappedEmit(wrapEvent({
32609
- type: EventType.IncrementalSnapshot,
32610
- data: __assign({ source: IncrementalSource.Font }, p2)
32611
- }));
32612
- },
32613
- blockClass,
32614
- ignoreClass,
32615
- maskTextClass,
32616
- maskTextSelector,
32617
- maskInputOptions,
32618
- inlineStylesheet,
32619
- sampling,
32620
- recordCanvas,
32621
- inlineImages,
32622
- userTriggeredOnInput,
32623
- collectFonts,
32624
- doc,
32625
- maskInputFn,
32626
- maskTextFn,
32627
- blockSelector,
32628
- slimDOMOptions,
32629
- mirror,
32630
- iframeManager,
32631
- shadowDomManager,
32632
- canvasManager,
32633
- plugins: ((_a2 = plugins === null || plugins === void 0 ? void 0 : plugins.filter(function(p2) {
32634
- return p2.observer;
32635
- })) === null || _a2 === void 0 ? void 0 : _a2.map(function(p2) {
32636
- return {
32637
- observer: p2.observer,
32638
- options: p2.options,
32639
- callback: function(payload) {
32640
- return wrappedEmit(wrapEvent({
32641
- type: EventType.Plugin,
32642
- data: {
32643
- plugin: p2.name,
32644
- payload
32645
- }
32646
- }));
32647
- }
32648
- };
32649
- })) || []
32650
- }, hooks);
32651
- };
32652
- iframeManager.addLoadListener(function(iframeEl) {
32653
- handlers_1.push(observe_1(iframeEl.contentDocument));
32654
- });
32655
- var init_1 = function() {
32656
- takeFullSnapshot();
32657
- handlers_1.push(observe_1(document));
32658
- };
32659
- if (document.readyState === "interactive" || document.readyState === "complete") {
32660
- init_1();
32661
- } else {
32662
- handlers_1.push(on("load", function() {
32663
- wrappedEmit(wrapEvent({
32664
- type: EventType.Load,
32665
- data: {}
32666
- }));
32667
- init_1();
32668
- }, window));
32669
- }
32670
- return function() {
32671
- handlers_1.forEach(function(h2) {
32672
- return h2();
32673
- });
32674
- };
32675
- } catch (error) {
32676
- console.warn(error);
32677
- }
32678
- }
32679
- record.addCustomEvent = function(tag, payload) {
32680
- if (!wrappedEmit) {
32681
- throw new Error("please add custom event after start recording");
32682
- }
32683
- wrappedEmit(wrapEvent({
32684
- type: EventType.Custom,
32685
- data: {
32686
- tag,
32687
- payload
32688
- }
32689
- }));
32690
- };
32691
- record.freezePage = function() {
32692
- mutationBuffers.forEach(function(buf) {
32693
- return buf.freeze();
32694
- });
32695
- };
32696
- record.takeFullSnapshot = function(isCheckout) {
32697
- if (!takeFullSnapshot) {
32698
- throw new Error("please take full snapshot after start recording");
32699
- }
32700
- takeFullSnapshot(isCheckout);
32701
- };
32702
- record.mirror = mirror;
32703
- var record_default = record;
32704
-
32705
29438
  // src/lib/monitoring/session-replay/recorder.ts
32706
29439
  init_constants();
29440
+ var cachedRecord = null;
29441
+ var rrwebRecordLoader = async () => (await import("rrweb")).record;
29442
+ async function loadRrwebRecord() {
29443
+ if (!cachedRecord) {
29444
+ cachedRecord = await rrwebRecordLoader();
29445
+ }
29446
+ return cachedRecord;
29447
+ }
32707
29448
  var SessionRecorder = class {
32708
29449
  config;
32709
29450
  state = "idle";
@@ -32718,6 +29459,7 @@ var SessionRecorder = class {
32718
29459
  consoleLogs = [];
32719
29460
  // rrweb handles
32720
29461
  stopFn = null;
29462
+ rrwebRecordingEpoch = 0;
32721
29463
  // Detectors
32722
29464
  rageClickDetector = null;
32723
29465
  deadClickDetector = null;
@@ -32783,7 +29525,9 @@ var SessionRecorder = class {
32783
29525
  this.networkRequests = [];
32784
29526
  this.consoleLogs = [];
32785
29527
  this.bytesRecorded = 0;
32786
- this.startRrwebRecording();
29528
+ void this.startRrwebRecording().catch((error) => {
29529
+ this.errorCallback?.(error instanceof Error ? error : new Error(String(error)));
29530
+ });
32787
29531
  this.setupDetectors();
32788
29532
  if (this.config.networkCapture) {
32789
29533
  this.setupNetworkCapture();
@@ -32803,6 +29547,7 @@ var SessionRecorder = class {
32803
29547
  pause() {
32804
29548
  if (this.state !== "recording") return;
32805
29549
  this.state = "paused";
29550
+ this.rrwebRecordingEpoch += 1;
32806
29551
  if (this.stopFn) {
32807
29552
  this.stopFn();
32808
29553
  this.stopFn = null;
@@ -32814,7 +29559,9 @@ var SessionRecorder = class {
32814
29559
  resume() {
32815
29560
  if (this.state !== "paused") return;
32816
29561
  this.state = "recording";
32817
- this.startRrwebRecording();
29562
+ void this.startRrwebRecording().catch((error) => {
29563
+ this.errorCallback?.(error instanceof Error ? error : new Error(String(error)));
29564
+ });
32818
29565
  }
32819
29566
  /**
32820
29567
  * Stop recording and upload final batch
@@ -32822,6 +29569,7 @@ var SessionRecorder = class {
32822
29569
  async stop() {
32823
29570
  if (this.state === "stopped" || this.state === "idle") return;
32824
29571
  this.state = "stopped";
29572
+ this.rrwebRecordingEpoch += 1;
32825
29573
  if (this.stopFn) {
32826
29574
  this.stopFn();
32827
29575
  this.stopFn = null;
@@ -32929,7 +29677,10 @@ var SessionRecorder = class {
32929
29677
  generateSessionId() {
32930
29678
  return `sr_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
32931
29679
  }
32932
- startRrwebRecording() {
29680
+ async startRrwebRecording() {
29681
+ const epoch = ++this.rrwebRecordingEpoch;
29682
+ const record = await loadRrwebRecord();
29683
+ if (this.state !== "recording" || epoch !== this.rrwebRecordingEpoch) return;
32933
29684
  const privacyOptions = getPrivacyOptions(this.config.privacyMode, this.config.maskSelectors);
32934
29685
  const options = {
32935
29686
  emit: (event) => {
@@ -32950,10 +29701,14 @@ var SessionRecorder = class {
32950
29701
  inlineStylesheet: true,
32951
29702
  plugins: []
32952
29703
  };
32953
- const stopFn = record_default(options);
29704
+ const stopFn = record(options);
32954
29705
  if (!stopFn) {
32955
29706
  throw new Error("Failed to start rrweb recording");
32956
29707
  }
29708
+ if (this.state !== "recording" || epoch !== this.rrwebRecordingEpoch) {
29709
+ stopFn();
29710
+ return;
29711
+ }
32957
29712
  this.stopFn = stopFn;
32958
29713
  }
32959
29714
  handleEvent(event) {
@@ -40225,22 +36980,4 @@ export {
40225
36980
  withSessionReplay,
40226
36981
  withTimeout
40227
36982
  };
40228
- /*! Bundled license information:
40229
-
40230
- rrweb/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js:
40231
- (*! *****************************************************************************
40232
- Copyright (c) Microsoft Corporation.
40233
-
40234
- Permission to use, copy, modify, and/or distribute this software for any
40235
- purpose with or without fee is hereby granted.
40236
-
40237
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
40238
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40239
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40240
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40241
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40242
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
40243
- PERFORMANCE OF THIS SOFTWARE.
40244
- ***************************************************************************** *)
40245
- */
40246
36983
  //# sourceMappingURL=index.mjs.map