@appsurify-testmap/rrweb 2.0.0-alpha.23 → 2.0.0-alpha.25

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.
package/dist/rrweb.cjs CHANGED
@@ -7,6 +7,46 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  var __defProp$1 = Object.defineProperty;
8
8
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
9
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
10
+ var InteractiveEvent = /* @__PURE__ */ ((InteractiveEvent2) => {
11
+ InteractiveEvent2[InteractiveEvent2["Change"] = 0] = "Change";
12
+ InteractiveEvent2[InteractiveEvent2["Submit"] = 1] = "Submit";
13
+ InteractiveEvent2[InteractiveEvent2["DragStart"] = 2] = "DragStart";
14
+ InteractiveEvent2[InteractiveEvent2["Drop"] = 3] = "Drop";
15
+ InteractiveEvent2[InteractiveEvent2["PointerDown"] = 4] = "PointerDown";
16
+ InteractiveEvent2[InteractiveEvent2["PointerUp"] = 5] = "PointerUp";
17
+ InteractiveEvent2[InteractiveEvent2["Input"] = 6] = "Input";
18
+ InteractiveEvent2[InteractiveEvent2["KeyDown"] = 7] = "KeyDown";
19
+ InteractiveEvent2[InteractiveEvent2["KeyUp"] = 8] = "KeyUp";
20
+ InteractiveEvent2[InteractiveEvent2["KeyPress"] = 9] = "KeyPress";
21
+ InteractiveEvent2[InteractiveEvent2["MouseEnter"] = 10] = "MouseEnter";
22
+ InteractiveEvent2[InteractiveEvent2["MouseLeave"] = 11] = "MouseLeave";
23
+ InteractiveEvent2[InteractiveEvent2["MouseUp"] = 12] = "MouseUp";
24
+ InteractiveEvent2[InteractiveEvent2["MouseDown"] = 13] = "MouseDown";
25
+ InteractiveEvent2[InteractiveEvent2["Click"] = 14] = "Click";
26
+ InteractiveEvent2[InteractiveEvent2["ContextMenu"] = 15] = "ContextMenu";
27
+ InteractiveEvent2[InteractiveEvent2["DblClick"] = 16] = "DblClick";
28
+ InteractiveEvent2[InteractiveEvent2["Focus"] = 17] = "Focus";
29
+ InteractiveEvent2[InteractiveEvent2["Blur"] = 18] = "Blur";
30
+ InteractiveEvent2[InteractiveEvent2["TouchStart"] = 19] = "TouchStart";
31
+ InteractiveEvent2[InteractiveEvent2["TouchMove"] = 20] = "TouchMove";
32
+ InteractiveEvent2[InteractiveEvent2["TouchEnd"] = 21] = "TouchEnd";
33
+ InteractiveEvent2[InteractiveEvent2["TouchCancel"] = 22] = "TouchCancel";
34
+ return InteractiveEvent2;
35
+ })(InteractiveEvent || {});
36
+ var interactiveTag = /* @__PURE__ */ ((interactiveTag2) => {
37
+ interactiveTag2[interactiveTag2["Input"] = 0] = "Input";
38
+ interactiveTag2[interactiveTag2["Button"] = 1] = "Button";
39
+ interactiveTag2[interactiveTag2["A"] = 2] = "A";
40
+ interactiveTag2[interactiveTag2["Select"] = 3] = "Select";
41
+ interactiveTag2[interactiveTag2["Textarea"] = 4] = "Textarea";
42
+ interactiveTag2[interactiveTag2["Label"] = 5] = "Label";
43
+ interactiveTag2[interactiveTag2["Details"] = 6] = "Details";
44
+ interactiveTag2[interactiveTag2["Summary"] = 7] = "Summary";
45
+ interactiveTag2[interactiveTag2["Dialog"] = 8] = "Dialog";
46
+ interactiveTag2[interactiveTag2["Video"] = 9] = "Video";
47
+ interactiveTag2[interactiveTag2["Audio"] = 10] = "Audio";
48
+ return interactiveTag2;
49
+ })(interactiveTag || {});
10
50
  var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
11
51
  NodeType2[NodeType2["Document"] = 0] = "Document";
12
52
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
@@ -158,99 +198,6 @@ const index$1 = {
158
198
  querySelectorAll: querySelectorAll$1,
159
199
  mutationObserver: mutationObserverCtor$1
160
200
  };
161
- function getXPath(node2) {
162
- if (node2.nodeType === Node.DOCUMENT_NODE) {
163
- return "/";
164
- }
165
- if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
166
- return "/html/doctype";
167
- }
168
- if (node2.nodeType === Node.ELEMENT_NODE) {
169
- const element = node2;
170
- if (element.id) {
171
- return `//*[@id="${element.id}"]`;
172
- }
173
- if (element.tagName && element.tagName.toLowerCase() === "html") {
174
- return "/html";
175
- }
176
- if (element === document.head) {
177
- return "/html/head";
178
- }
179
- if (element === document.body) {
180
- return "/html/body";
181
- }
182
- const parentNode2 = element.parentNode;
183
- if (!parentNode2 || !(parentNode2 instanceof Element)) {
184
- return "";
185
- }
186
- const siblings = Array.from(parentNode2.children).filter(
187
- (sibling) => sibling.tagName === element.tagName
188
- );
189
- const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
190
- return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
191
- }
192
- if (node2.nodeType === Node.TEXT_NODE) {
193
- const parent = node2.parentNode;
194
- if (!parent) {
195
- return "";
196
- }
197
- const textSiblings = Array.from(parent.childNodes).filter(
198
- (sibling) => sibling.nodeType === Node.TEXT_NODE
199
- );
200
- const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
201
- return `${getXPath(parent)}/text()${index2}`;
202
- }
203
- if (node2.nodeType === Node.CDATA_SECTION_NODE) {
204
- const parent = node2.parentNode;
205
- if (!parent) {
206
- return "";
207
- }
208
- const cdataSiblings = Array.from(parent.childNodes).filter(
209
- (sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
210
- );
211
- const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
212
- return `${getXPath(parent)}/text()${index2}`;
213
- }
214
- if (node2.nodeType === Node.COMMENT_NODE) {
215
- const parent = node2.parentNode;
216
- if (!parent) {
217
- return "";
218
- }
219
- const commentSiblings = Array.from(parent.childNodes).filter(
220
- (sibling) => sibling.nodeType === Node.COMMENT_NODE
221
- );
222
- const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
223
- return `${getXPath(parent)}/comment()${index2}`;
224
- }
225
- return "";
226
- }
227
- function isElement(n2) {
228
- return n2.nodeType === n2.ELEMENT_NODE;
229
- }
230
- function isTextVisible(n2) {
231
- var _a2;
232
- const parent = index$1.parentNode(n2);
233
- const parentElement2 = parent && parent;
234
- if (!parentElement2) {
235
- return false;
236
- }
237
- const isParentVisible = isElementVisible(parentElement2);
238
- if (!isParentVisible) {
239
- return false;
240
- }
241
- const textContent2 = (_a2 = n2.textContent) == null ? void 0 : _a2.trim();
242
- return textContent2 !== "";
243
- }
244
- function isElementVisible(n2) {
245
- return isStyleVisible(n2) && isRectVisible(n2.getBoundingClientRect());
246
- }
247
- function isStyleVisible(n2) {
248
- const style = window.getComputedStyle(n2);
249
- return style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
250
- }
251
- function isRectVisible(rect) {
252
- return rect.width > 0 && rect.height > 0 && rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
253
- }
254
201
  function isShadowRoot(n2) {
255
202
  const hostEl = (
256
203
  // anchor and textarea elements also have a `host` property
@@ -598,6 +545,140 @@ function splitCssText(cssText, style) {
598
545
  function markCssSplits(cssText, style) {
599
546
  return splitCssText(cssText, style).join("/* rr_split */");
600
547
  }
548
+ function getXPath(node2) {
549
+ if (node2.nodeType === Node.DOCUMENT_NODE) {
550
+ return "/";
551
+ }
552
+ if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
553
+ return "/html/doctype";
554
+ }
555
+ if (node2.nodeType === Node.ELEMENT_NODE) {
556
+ const element = node2;
557
+ if (element.id) {
558
+ return `//*[@id="${element.id}"]`;
559
+ }
560
+ if (element.tagName && element.tagName.toLowerCase() === "html") {
561
+ return "/html";
562
+ }
563
+ if (element === document.head) {
564
+ return "/html/head";
565
+ }
566
+ if (element === document.body) {
567
+ return "/html/body";
568
+ }
569
+ const parentNode2 = element.parentNode;
570
+ if (!parentNode2 || !(parentNode2 instanceof Element)) {
571
+ return "";
572
+ }
573
+ const siblings = Array.from(parentNode2.children).filter(
574
+ (sibling) => sibling.tagName === element.tagName
575
+ );
576
+ const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
577
+ return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
578
+ }
579
+ if (node2.nodeType === Node.TEXT_NODE) {
580
+ const parent = node2.parentNode;
581
+ if (!parent) {
582
+ return "";
583
+ }
584
+ const textSiblings = Array.from(parent.childNodes).filter(
585
+ (sibling) => sibling.nodeType === Node.TEXT_NODE
586
+ );
587
+ const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
588
+ return `${getXPath(parent)}/text()${index2}`;
589
+ }
590
+ if (node2.nodeType === Node.CDATA_SECTION_NODE) {
591
+ const parent = node2.parentNode;
592
+ if (!parent) {
593
+ return "";
594
+ }
595
+ const cdataSiblings = Array.from(parent.childNodes).filter(
596
+ (sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
597
+ );
598
+ const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
599
+ return `${getXPath(parent)}/text()${index2}`;
600
+ }
601
+ if (node2.nodeType === Node.COMMENT_NODE) {
602
+ const parent = node2.parentNode;
603
+ if (!parent) {
604
+ return "";
605
+ }
606
+ const commentSiblings = Array.from(parent.childNodes).filter(
607
+ (sibling) => sibling.nodeType === Node.COMMENT_NODE
608
+ );
609
+ const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
610
+ return `${getXPath(parent)}/comment()${index2}`;
611
+ }
612
+ return "";
613
+ }
614
+ function isElement(n2) {
615
+ return n2.nodeType === n2.ELEMENT_NODE;
616
+ }
617
+ function isTextVisible(n2) {
618
+ var _a2;
619
+ const parent = index$1.parentNode(n2);
620
+ const parentElement2 = parent && parent;
621
+ if (!parentElement2) {
622
+ return false;
623
+ }
624
+ const isParentVisible = isElementVisible(parentElement2);
625
+ if (!isParentVisible) {
626
+ return false;
627
+ }
628
+ const textContent2 = (_a2 = n2.textContent) == null ? void 0 : _a2.trim();
629
+ return textContent2 !== "";
630
+ }
631
+ function isElementVisible(n2) {
632
+ return isStyleVisible(n2) && isRectVisible(n2.getBoundingClientRect());
633
+ }
634
+ function isStyleVisible(n2) {
635
+ const style = window.getComputedStyle(n2);
636
+ return style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
637
+ }
638
+ function isRectVisible(rect) {
639
+ return rect.width > 0 && rect.height > 0 && rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
640
+ }
641
+ function getInteractiveEvents() {
642
+ return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
643
+ }
644
+ function getInteractiveTags() {
645
+ return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
646
+ }
647
+ function hasEventListeners(n2) {
648
+ return getInteractiveEvents().some((eventType) => {
649
+ let hasListener = false;
650
+ const testListener = () => {
651
+ hasListener = true;
652
+ };
653
+ n2.addEventListener(eventType, testListener);
654
+ n2.dispatchEvent(new Event(eventType));
655
+ n2.removeEventListener(eventType, testListener);
656
+ return hasListener;
657
+ });
658
+ }
659
+ function isElementInteractive(n2) {
660
+ var _a2;
661
+ const allowedTags = getInteractiveTags();
662
+ if (n2.nodeType === Node.ELEMENT_NODE) {
663
+ const element = n2;
664
+ const tagName = element.tagName.toLowerCase();
665
+ if (!allowedTags.includes(tagName)) {
666
+ return false;
667
+ }
668
+ const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
669
+ const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
670
+ element.getAttribute("role") || ""
671
+ );
672
+ const result2 = hasEventListeners(element) || hasTabIndex || hasRoleInteractive || element instanceof HTMLAnchorElement && element.hasAttribute("href") || element instanceof HTMLButtonElement && !element.disabled;
673
+ return result2;
674
+ }
675
+ if (n2.nodeType === Node.TEXT_NODE) {
676
+ const textNode = n2;
677
+ const parentElement2 = textNode.parentElement;
678
+ return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
679
+ }
680
+ return false;
681
+ }
601
682
  let _id = 1;
602
683
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
603
684
  const IGNORED_NODE = -2;
@@ -953,11 +1034,13 @@ function serializeTextNode(n2, options) {
953
1034
  textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
954
1035
  }
955
1036
  const isVisible = isTextVisible(n2);
1037
+ const isInteractive = isElementInteractive(n2);
956
1038
  return {
957
1039
  type: NodeType$3.Text,
958
1040
  textContent: textContent2 || "",
959
1041
  rootId,
960
1042
  isVisible,
1043
+ isInteractive,
961
1044
  xPath
962
1045
  };
963
1046
  }
@@ -1143,6 +1226,7 @@ function serializeElementNode(n2, options) {
1143
1226
  } catch (e2) {
1144
1227
  }
1145
1228
  const isVisible = isElementVisible(n2);
1229
+ const isInteractive = isElementInteractive(n2);
1146
1230
  return {
1147
1231
  type: NodeType$3.Element,
1148
1232
  tagName,
@@ -1153,6 +1237,7 @@ function serializeElementNode(n2, options) {
1153
1237
  rootId,
1154
1238
  isCustom: isCustomElement,
1155
1239
  isVisible,
1240
+ isInteractive,
1156
1241
  xPath
1157
1242
  };
1158
1243
  }
@@ -10926,20 +11011,20 @@ var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
10926
11011
  IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
10927
11012
  IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
10928
11013
  IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
11014
+ IncrementalSource2[IncrementalSource2["VisibilityChange"] = 17] = "VisibilityChange";
10929
11015
  return IncrementalSource2;
10930
11016
  })(IncrementalSource || {});
10931
11017
  var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
10932
11018
  MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
10933
11019
  MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
10934
11020
  MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
10935
- MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
10936
- MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
10937
- MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
10938
- MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
10939
- MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
10940
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
10941
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
10942
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
11021
+ MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
11022
+ MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
11023
+ MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
11024
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
11025
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
11026
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
11027
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
10943
11028
  return MouseInteractions2;
10944
11029
  })(MouseInteractions || {});
10945
11030
  var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
@@ -11659,6 +11744,60 @@ function initMutationObserver(options, rootEl) {
11659
11744
  });
11660
11745
  return observer;
11661
11746
  }
11747
+ function initVisibilityObserver({
11748
+ visibilityChangeCb,
11749
+ doc,
11750
+ mirror: mirror2,
11751
+ sampling
11752
+ }) {
11753
+ if (!visibilityChangeCb) {
11754
+ return () => {
11755
+ };
11756
+ }
11757
+ const observedElements = /* @__PURE__ */ new WeakMap();
11758
+ const debounceThreshold = typeof sampling.visibility === "number" ? sampling.visibility : 50;
11759
+ const throttledCb = throttle(
11760
+ callbackWrapper((entry) => {
11761
+ const target = entry.target;
11762
+ const id = mirror2.getId(target);
11763
+ const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
11764
+ if (id !== -1) {
11765
+ visibilityChangeCb({
11766
+ id,
11767
+ isVisible,
11768
+ visibilityRatio: entry.intersectionRatio
11769
+ });
11770
+ }
11771
+ }),
11772
+ debounceThreshold,
11773
+ { leading: sampling.visibility !== false, trailing: true }
11774
+ );
11775
+ const observer = new IntersectionObserver((entries) => {
11776
+ entries.forEach((entry) => {
11777
+ const target = entry.target;
11778
+ if (observedElements.has(target)) {
11779
+ throttledCb(entry);
11780
+ } else {
11781
+ observedElements.set(target, true);
11782
+ }
11783
+ });
11784
+ }, { root: null, threshold: [0.1, 0.9] });
11785
+ doc.querySelectorAll("*").forEach((el) => observer.observe(el));
11786
+ const mutationObserver = new MutationObserver((mutations) => {
11787
+ mutations.forEach((mutation) => {
11788
+ mutation.addedNodes.forEach((node2) => {
11789
+ if (node2 instanceof Element) {
11790
+ observer.observe(node2);
11791
+ }
11792
+ });
11793
+ });
11794
+ });
11795
+ mutationObserver.observe(doc, { childList: true, subtree: true });
11796
+ return () => {
11797
+ observer.disconnect();
11798
+ mutationObserver.disconnect();
11799
+ };
11800
+ }
11662
11801
  function initMoveObserver({
11663
11802
  mousemoveCb,
11664
11803
  sampling,
@@ -12474,6 +12613,7 @@ function initCustomElementObserver({
12474
12613
  function mergeHooks(o2, hooks) {
12475
12614
  const {
12476
12615
  mutationCb,
12616
+ visibilityChangeCb,
12477
12617
  mousemoveCb,
12478
12618
  mouseInteractionCb,
12479
12619
  scrollCb,
@@ -12493,6 +12633,12 @@ function mergeHooks(o2, hooks) {
12493
12633
  }
12494
12634
  mutationCb(...p);
12495
12635
  };
12636
+ o2.visibilityChangeCb = (...p) => {
12637
+ if (hooks.visibilityChange) {
12638
+ hooks.visibilityChange(...p);
12639
+ }
12640
+ visibilityChangeCb(...p);
12641
+ };
12496
12642
  o2.mousemoveCb = (...p) => {
12497
12643
  if (hooks.mousemove) {
12498
12644
  hooks.mousemove(...p);
@@ -12585,6 +12731,7 @@ function initObservers(o2, hooks = {}) {
12585
12731
  });
12586
12732
  const inputHandler = initInputObserver(o2);
12587
12733
  const mediaInteractionHandler = initMediaInteractionObserver(o2);
12734
+ const visibleHandler = initVisibilityObserver(o2);
12588
12735
  let styleSheetObserver = () => {
12589
12736
  };
12590
12737
  let adoptedStyleSheetObserver = () => {
@@ -12614,6 +12761,7 @@ function initObservers(o2, hooks = {}) {
12614
12761
  return callbackWrapper(() => {
12615
12762
  mutationBuffers.forEach((b) => b.reset());
12616
12763
  mutationObserver == null ? void 0 : mutationObserver.disconnect();
12764
+ visibleHandler();
12617
12765
  mousemoveHandler();
12618
12766
  mouseInteractionHandler();
12619
12767
  scrollHandler();
@@ -13700,6 +13848,7 @@ function record(options = {}) {
13700
13848
  emit,
13701
13849
  checkoutEveryNms,
13702
13850
  checkoutEveryNth,
13851
+ checkoutEveryEvc,
13703
13852
  blockClass = "rr-block",
13704
13853
  blockSelector = null,
13705
13854
  ignoreClass = "rr-ignore",
@@ -13828,7 +13977,8 @@ function record(options = {}) {
13828
13977
  incrementalSnapshotCount++;
13829
13978
  const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
13830
13979
  const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
13831
- if (exceedCount || exceedTime) {
13980
+ const isVisibilityChanged = checkoutEveryEvc && e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.VisibilityChange;
13981
+ if (exceedCount || exceedTime || isVisibilityChanged) {
13832
13982
  takeFullSnapshot$1(true);
13833
13983
  }
13834
13984
  }
@@ -13997,6 +14147,15 @@ function record(options = {}) {
13997
14147
  return callbackWrapper(initObservers)(
13998
14148
  {
13999
14149
  mutationCb: wrappedMutationEmit,
14150
+ visibilityChangeCb: (v2) => {
14151
+ wrappedEmit({
14152
+ type: EventType.IncrementalSnapshot,
14153
+ data: {
14154
+ source: IncrementalSource.VisibilityChange,
14155
+ ...v2
14156
+ }
14157
+ });
14158
+ },
14000
14159
  mousemoveCb: (positions, source) => wrappedEmit({
14001
14160
  type: EventType.IncrementalSnapshot,
14002
14161
  data: {