@appsurify-testmap/rrweb-record 3.1.1-alpha.2 → 3.2.0-alpha.1

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.
@@ -927,7 +927,14 @@ const U$1 = {
927
927
  source: "dom-dsl"
928
928
  };
929
929
  function P$1(r2) {
930
- return !!(/^[a-z]+-\d+$/i.test(r2) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(r2) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(r2) || /^\d+$/.test(r2) || /^:[a-z0-9]+:$/i.test(r2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r2) || /^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2) && (/\d/.test(r2) || /[A-Z]/.test(r2)) || /^radix-/.test(r2) || /^mui-\d+$/.test(r2));
930
+ if (/^[a-z]+-\d+$/i.test(r2) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(r2) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(r2) || /^\d+$/.test(r2) || /^:[a-z0-9]+:$/i.test(r2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r2))
931
+ return true;
932
+ if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2)) {
933
+ const t2 = /\d/.test(r2), e2 = /[A-Z]/.test(r2), s2 = r2.length >= 20;
934
+ if (t2 && e2 || s2)
935
+ return true;
936
+ }
937
+ return !!(/^radix-/.test(r2) || /^mui-\d+$/.test(r2));
931
938
  }
932
939
  const Q$1 = /* @__PURE__ */ new Set([
933
940
  "aria-labelledby",
@@ -1124,6 +1131,11 @@ const At$1 = [
1124
1131
  /^(rtl|ltr):/,
1125
1132
  // === FIX 4: Group and peer variants ===
1126
1133
  /^(group|peer)(-hover|-focus|-active)?:/,
1134
+ // === Arbitrary pseudo-class/modifier variants (catch-all) ===
1135
+ // Matches any lowercase/hyphenated prefix followed by colon
1136
+ // e.g., file:bg-transparent, placeholder:text-gray, invalid:border-red, accept:text-primary
1137
+ // Must come AFTER semantic pattern checks to avoid false positives
1138
+ /^[a-z][a-z-]*:/,
1127
1139
  // === FIX 4: Tailwind utilities with fraction values ===
1128
1140
  /\/([\d.]+|full|auto|screen)$/,
1129
1141
  // /50, /100, /full, /auto, /screen
@@ -11332,7 +11344,14 @@ const U = {
11332
11344
  source: "dom-dsl"
11333
11345
  };
11334
11346
  function P(r2) {
11335
- return !!(/^[a-z]+-\d+$/i.test(r2) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(r2) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(r2) || /^\d+$/.test(r2) || /^:[a-z0-9]+:$/i.test(r2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r2) || /^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2) && (/\d/.test(r2) || /[A-Z]/.test(r2)) || /^radix-/.test(r2) || /^mui-\d+$/.test(r2));
11347
+ if (/^[a-z]+-\d+$/i.test(r2) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(r2) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(r2) || /^\d+$/.test(r2) || /^:[a-z0-9]+:$/i.test(r2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r2))
11348
+ return true;
11349
+ if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2)) {
11350
+ const t2 = /\d/.test(r2), e2 = /[A-Z]/.test(r2), s2 = r2.length >= 20;
11351
+ if (t2 && e2 || s2)
11352
+ return true;
11353
+ }
11354
+ return !!(/^radix-/.test(r2) || /^mui-\d+$/.test(r2));
11336
11355
  }
11337
11356
  const Q = /* @__PURE__ */ new Set([
11338
11357
  "aria-labelledby",
@@ -11529,6 +11548,11 @@ const At = [
11529
11548
  /^(rtl|ltr):/,
11530
11549
  // === FIX 4: Group and peer variants ===
11531
11550
  /^(group|peer)(-hover|-focus|-active)?:/,
11551
+ // === Arbitrary pseudo-class/modifier variants (catch-all) ===
11552
+ // Matches any lowercase/hyphenated prefix followed by colon
11553
+ // e.g., file:bg-transparent, placeholder:text-gray, invalid:border-red, accept:text-primary
11554
+ // Must come AFTER semantic pattern checks to avoid false positives
11555
+ /^[a-z][a-z-]*:/,
11532
11556
  // === FIX 4: Tailwind utilities with fraction values ===
11533
11557
  /\/([\d.]+|full|auto|screen)$/,
11534
11558
  // /50, /100, /full, /auto, /screen
@@ -13447,6 +13471,30 @@ class MutationBuffer {
13447
13471
  this.shadowDomManager.reset();
13448
13472
  this.canvasManager.reset();
13449
13473
  }
13474
+ /**
13475
+ * Clear all accumulated mutation data without emitting.
13476
+ * Used after freeze+debounce checkout — FullSnapshot already captured the state.
13477
+ */
13478
+ resetBuffers() {
13479
+ this.addedSet = /* @__PURE__ */ new Set();
13480
+ this.movedSet = /* @__PURE__ */ new Set();
13481
+ this.droppedSet = /* @__PURE__ */ new Set();
13482
+ this.removesSubTreeCache = /* @__PURE__ */ new Set();
13483
+ this.mapRemoves = [];
13484
+ this.movedMap = {};
13485
+ this.attributes = [];
13486
+ this.texts = [];
13487
+ this.attributeMap = /* @__PURE__ */ new WeakMap();
13488
+ this.removes = [];
13489
+ }
13490
+ /**
13491
+ * Clear frozen flag without triggering emit.
13492
+ * Used after freeze+debounce checkout — buffers already cleared by resetBuffers().
13493
+ */
13494
+ unsetFrozen() {
13495
+ this.frozen = false;
13496
+ this.canvasManager.unfreeze();
13497
+ }
13450
13498
  }
13451
13499
  function deepDelete(addsSet, n2) {
13452
13500
  addsSet.delete(n2);
@@ -15837,10 +15885,13 @@ class VisibilityManager {
15837
15885
  }
15838
15886
  flushBuffer() {
15839
15887
  var _a2;
15888
+ if (this.frozen || this.locked) return;
15840
15889
  if (this.buffer.size === 0) return;
15841
- (_a2 = this.notifyActivity) == null ? void 0 : _a2.call(this, this.buffer.size);
15842
- this.mutationCb({ mutations: Array.from(this.buffer.values()) });
15890
+ const mutations = Array.from(this.buffer.values());
15891
+ const count = mutations.length;
15843
15892
  this.buffer.clear();
15893
+ this.mutationCb({ mutations });
15894
+ (_a2 = this.notifyActivity) == null ? void 0 : _a2.call(this, count);
15844
15895
  }
15845
15896
  observe(el) {
15846
15897
  if (this.disabled) return;
@@ -15854,6 +15905,10 @@ class VisibilityManager {
15854
15905
  }
15855
15906
  freeze() {
15856
15907
  this.frozen = true;
15908
+ if (this.debounceTimer) {
15909
+ clearTimeout(this.debounceTimer);
15910
+ this.debounceTimer = null;
15911
+ }
15857
15912
  }
15858
15913
  unfreeze() {
15859
15914
  this.frozen = false;
@@ -15861,9 +15916,33 @@ class VisibilityManager {
15861
15916
  }
15862
15917
  lock() {
15863
15918
  this.locked = true;
15919
+ if (this.debounceTimer) {
15920
+ clearTimeout(this.debounceTimer);
15921
+ this.debounceTimer = null;
15922
+ }
15864
15923
  }
15865
15924
  unlock() {
15866
15925
  this.locked = false;
15926
+ this.buffer.clear();
15927
+ if (this.debounceTimer) {
15928
+ clearTimeout(this.debounceTimer);
15929
+ this.debounceTimer = null;
15930
+ }
15931
+ if (!this.disabled && this.elements.size > 0) {
15932
+ this.previousState = computeVisibility(this.elements, /* @__PURE__ */ new Map(), {
15933
+ root: this.root,
15934
+ threshold: this.threshold,
15935
+ sensitivity: this.sensitivity,
15936
+ rootMargin: this.rootMargin
15937
+ });
15938
+ }
15939
+ }
15940
+ /**
15941
+ * Clear frozen flag without triggering flush.
15942
+ * Used after freeze+debounce checkout — buffer already cleared by unlock().
15943
+ */
15944
+ unsetFrozen() {
15945
+ this.frozen = false;
15867
15946
  }
15868
15947
  reset() {
15869
15948
  this.elements.clear();
@@ -15962,7 +16041,7 @@ class ProcessedNodeManager {
15962
16041
  destroy() {
15963
16042
  }
15964
16043
  }
15965
- const version$1 = "3.1.1-alpha.2";
16044
+ const version$1 = "3.1.1-alpha.3";
15966
16045
  let wrappedEmit;
15967
16046
  let takeFullSnapshot$1;
15968
16047
  let canvasManager;
@@ -16016,6 +16095,7 @@ function record(options = {}) {
16016
16095
  checkoutEveryNms,
16017
16096
  checkoutEveryNth,
16018
16097
  checkoutEveryNvm,
16098
+ checkoutDebounce,
16019
16099
  blockClass = "rr-block",
16020
16100
  blockSelector = null,
16021
16101
  ignoreClass = "rr-ignore",
@@ -16110,6 +16190,10 @@ function record(options = {}) {
16110
16190
  let lastFullSnapshotEvent;
16111
16191
  let incrementalSnapshotCount = 0;
16112
16192
  let visibilityMutationCount = 0;
16193
+ let checkoutId = 0;
16194
+ let checkoutPending = false;
16195
+ let checkoutDebounceTimer = null;
16196
+ let checkoutFreezeTimestamp = null;
16113
16197
  const eventProcessor = (e2) => {
16114
16198
  for (const plugin3 of plugins || []) {
16115
16199
  if (plugin3.eventProcessor) {
@@ -16122,11 +16206,25 @@ function record(options = {}) {
16122
16206
  }
16123
16207
  return e2;
16124
16208
  };
16209
+ const executeCheckout = () => {
16210
+ checkoutDebounceTimer = null;
16211
+ checkoutPending = false;
16212
+ checkoutFreezeTimestamp = null;
16213
+ takeFullSnapshot$1(true);
16214
+ mutationBuffers.forEach((buf) => {
16215
+ buf.resetBuffers();
16216
+ buf.unsetFrozen();
16217
+ });
16218
+ if (visibilityManager) {
16219
+ visibilityManager.unsetFrozen();
16220
+ }
16221
+ };
16125
16222
  wrappedEmit = (r2, isCheckout) => {
16126
16223
  var _a2;
16127
16224
  const e2 = r2;
16128
16225
  e2.timestamp = nowTimestamp();
16129
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
16226
+ e2.checkoutId = checkoutId;
16227
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
16130
16228
  mutationBuffers.forEach((buf) => buf.unfreeze());
16131
16229
  visibilityManager == null ? void 0 : visibilityManager.unfreeze();
16132
16230
  }
@@ -16153,7 +16251,29 @@ function record(options = {}) {
16153
16251
  const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
16154
16252
  const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
16155
16253
  if (exceedCount || exceedTime) {
16156
- takeFullSnapshot$1(true);
16254
+ if (checkoutDebounce) {
16255
+ if (!checkoutPending) {
16256
+ checkoutPending = true;
16257
+ checkoutFreezeTimestamp = nowTimestamp();
16258
+ mutationBuffers.forEach((buf) => buf.freeze());
16259
+ visibilityManager == null ? void 0 : visibilityManager.freeze();
16260
+ }
16261
+ if (checkoutDebounceTimer) {
16262
+ clearTimeout(checkoutDebounceTimer);
16263
+ }
16264
+ const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
16265
+ const maxFreeze = checkoutDebounce * 3;
16266
+ if (frozenDuration >= maxFreeze) {
16267
+ executeCheckout();
16268
+ } else {
16269
+ checkoutDebounceTimer = setTimeout(
16270
+ () => executeCheckout(),
16271
+ checkoutDebounce
16272
+ );
16273
+ }
16274
+ } else {
16275
+ takeFullSnapshot$1(true);
16276
+ }
16157
16277
  }
16158
16278
  }
16159
16279
  }
@@ -16268,8 +16388,30 @@ function record(options = {}) {
16268
16388
  notifyActivity: checkoutEveryNvm != null ? (count) => {
16269
16389
  visibilityMutationCount += count;
16270
16390
  if (visibilityMutationCount >= checkoutEveryNvm) {
16271
- takeFullSnapshot$1(true);
16272
16391
  visibilityMutationCount = 0;
16392
+ if (checkoutDebounce) {
16393
+ if (!checkoutPending) {
16394
+ checkoutPending = true;
16395
+ checkoutFreezeTimestamp = nowTimestamp();
16396
+ mutationBuffers.forEach((buf) => buf.freeze());
16397
+ visibilityManager == null ? void 0 : visibilityManager.freeze();
16398
+ }
16399
+ if (checkoutDebounceTimer) {
16400
+ clearTimeout(checkoutDebounceTimer);
16401
+ }
16402
+ const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
16403
+ const maxFreeze = checkoutDebounce * 3;
16404
+ if (frozenDuration >= maxFreeze) {
16405
+ executeCheckout();
16406
+ } else {
16407
+ checkoutDebounceTimer = setTimeout(
16408
+ () => executeCheckout(),
16409
+ checkoutDebounce
16410
+ );
16411
+ }
16412
+ } else {
16413
+ takeFullSnapshot$1(true);
16414
+ }
16273
16415
  }
16274
16416
  } : void 0
16275
16417
  });
@@ -16278,6 +16420,7 @@ function record(options = {}) {
16278
16420
  if (!recordDOM) {
16279
16421
  return;
16280
16422
  }
16423
+ checkoutId++;
16281
16424
  wrappedEmit(
16282
16425
  {
16283
16426
  type: EventType.Meta,
@@ -16556,6 +16699,10 @@ function record(options = {}) {
16556
16699
  );
16557
16700
  }
16558
16701
  return () => {
16702
+ if (checkoutDebounceTimer) {
16703
+ clearTimeout(checkoutDebounceTimer);
16704
+ checkoutDebounceTimer = null;
16705
+ }
16559
16706
  flushCustomEventQueue$1();
16560
16707
  handlers.forEach((h) => h());
16561
16708
  processedNodeManager.destroy();