@appsurify-testmap/rrweb 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.
package/dist/rrweb.cjs CHANGED
@@ -939,7 +939,14 @@ const U$1 = {
939
939
  source: "dom-dsl"
940
940
  };
941
941
  function P$1(r2) {
942
- 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));
942
+ 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))
943
+ return true;
944
+ if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2)) {
945
+ const t2 = /\d/.test(r2), e2 = /[A-Z]/.test(r2), s2 = r2.length >= 20;
946
+ if (t2 && e2 || s2)
947
+ return true;
948
+ }
949
+ return !!(/^radix-/.test(r2) || /^mui-\d+$/.test(r2));
943
950
  }
944
951
  const Q$1 = /* @__PURE__ */ new Set([
945
952
  "aria-labelledby",
@@ -1136,6 +1143,11 @@ const At$1 = [
1136
1143
  /^(rtl|ltr):/,
1137
1144
  // === FIX 4: Group and peer variants ===
1138
1145
  /^(group|peer)(-hover|-focus|-active)?:/,
1146
+ // === Arbitrary pseudo-class/modifier variants (catch-all) ===
1147
+ // Matches any lowercase/hyphenated prefix followed by colon
1148
+ // e.g., file:bg-transparent, placeholder:text-gray, invalid:border-red, accept:text-primary
1149
+ // Must come AFTER semantic pattern checks to avoid false positives
1150
+ /^[a-z][a-z-]*:/,
1139
1151
  // === FIX 4: Tailwind utilities with fraction values ===
1140
1152
  /\/([\d.]+|full|auto|screen)$/,
1141
1153
  // /50, /100, /full, /auto, /screen
@@ -13331,7 +13343,14 @@ const U = {
13331
13343
  source: "dom-dsl"
13332
13344
  };
13333
13345
  function P(r2) {
13334
- 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));
13346
+ 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))
13347
+ return true;
13348
+ if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r2)) {
13349
+ const t2 = /\d/.test(r2), e2 = /[A-Z]/.test(r2), s2 = r2.length >= 20;
13350
+ if (t2 && e2 || s2)
13351
+ return true;
13352
+ }
13353
+ return !!(/^radix-/.test(r2) || /^mui-\d+$/.test(r2));
13335
13354
  }
13336
13355
  const Q = /* @__PURE__ */ new Set([
13337
13356
  "aria-labelledby",
@@ -13528,6 +13547,11 @@ const At = [
13528
13547
  /^(rtl|ltr):/,
13529
13548
  // === FIX 4: Group and peer variants ===
13530
13549
  /^(group|peer)(-hover|-focus|-active)?:/,
13550
+ // === Arbitrary pseudo-class/modifier variants (catch-all) ===
13551
+ // Matches any lowercase/hyphenated prefix followed by colon
13552
+ // e.g., file:bg-transparent, placeholder:text-gray, invalid:border-red, accept:text-primary
13553
+ // Must come AFTER semantic pattern checks to avoid false positives
13554
+ /^[a-z][a-z-]*:/,
13531
13555
  // === FIX 4: Tailwind utilities with fraction values ===
13532
13556
  /\/([\d.]+|full|auto|screen)$/,
13533
13557
  // /50, /100, /full, /auto, /screen
@@ -15466,6 +15490,30 @@ class MutationBuffer {
15466
15490
  this.shadowDomManager.reset();
15467
15491
  this.canvasManager.reset();
15468
15492
  }
15493
+ /**
15494
+ * Clear all accumulated mutation data without emitting.
15495
+ * Used after freeze+debounce checkout — FullSnapshot already captured the state.
15496
+ */
15497
+ resetBuffers() {
15498
+ this.addedSet = /* @__PURE__ */ new Set();
15499
+ this.movedSet = /* @__PURE__ */ new Set();
15500
+ this.droppedSet = /* @__PURE__ */ new Set();
15501
+ this.removesSubTreeCache = /* @__PURE__ */ new Set();
15502
+ this.mapRemoves = [];
15503
+ this.movedMap = {};
15504
+ this.attributes = [];
15505
+ this.texts = [];
15506
+ this.attributeMap = /* @__PURE__ */ new WeakMap();
15507
+ this.removes = [];
15508
+ }
15509
+ /**
15510
+ * Clear frozen flag without triggering emit.
15511
+ * Used after freeze+debounce checkout — buffers already cleared by resetBuffers().
15512
+ */
15513
+ unsetFrozen() {
15514
+ this.frozen = false;
15515
+ this.canvasManager.unfreeze();
15516
+ }
15469
15517
  }
15470
15518
  function deepDelete(addsSet, n2) {
15471
15519
  addsSet.delete(n2);
@@ -17876,10 +17924,13 @@ class VisibilityManager {
17876
17924
  }
17877
17925
  flushBuffer() {
17878
17926
  var _a2;
17927
+ if (this.frozen || this.locked) return;
17879
17928
  if (this.buffer.size === 0) return;
17880
- (_a2 = this.notifyActivity) == null ? void 0 : _a2.call(this, this.buffer.size);
17881
- this.mutationCb({ mutations: Array.from(this.buffer.values()) });
17929
+ const mutations = Array.from(this.buffer.values());
17930
+ const count = mutations.length;
17882
17931
  this.buffer.clear();
17932
+ this.mutationCb({ mutations });
17933
+ (_a2 = this.notifyActivity) == null ? void 0 : _a2.call(this, count);
17883
17934
  }
17884
17935
  observe(el) {
17885
17936
  if (this.disabled) return;
@@ -17893,6 +17944,10 @@ class VisibilityManager {
17893
17944
  }
17894
17945
  freeze() {
17895
17946
  this.frozen = true;
17947
+ if (this.debounceTimer) {
17948
+ clearTimeout(this.debounceTimer);
17949
+ this.debounceTimer = null;
17950
+ }
17896
17951
  }
17897
17952
  unfreeze() {
17898
17953
  this.frozen = false;
@@ -17900,9 +17955,33 @@ class VisibilityManager {
17900
17955
  }
17901
17956
  lock() {
17902
17957
  this.locked = true;
17958
+ if (this.debounceTimer) {
17959
+ clearTimeout(this.debounceTimer);
17960
+ this.debounceTimer = null;
17961
+ }
17903
17962
  }
17904
17963
  unlock() {
17905
17964
  this.locked = false;
17965
+ this.buffer.clear();
17966
+ if (this.debounceTimer) {
17967
+ clearTimeout(this.debounceTimer);
17968
+ this.debounceTimer = null;
17969
+ }
17970
+ if (!this.disabled && this.elements.size > 0) {
17971
+ this.previousState = computeVisibility(this.elements, /* @__PURE__ */ new Map(), {
17972
+ root: this.root,
17973
+ threshold: this.threshold,
17974
+ sensitivity: this.sensitivity,
17975
+ rootMargin: this.rootMargin
17976
+ });
17977
+ }
17978
+ }
17979
+ /**
17980
+ * Clear frozen flag without triggering flush.
17981
+ * Used after freeze+debounce checkout — buffer already cleared by unlock().
17982
+ */
17983
+ unsetFrozen() {
17984
+ this.frozen = false;
17906
17985
  }
17907
17986
  reset() {
17908
17987
  this.elements.clear();
@@ -18001,7 +18080,7 @@ class ProcessedNodeManager {
18001
18080
  destroy() {
18002
18081
  }
18003
18082
  }
18004
- const version$1 = "3.1.1-alpha.2";
18083
+ const version$1 = "3.2.0-alpha.1";
18005
18084
  let wrappedEmit;
18006
18085
  let takeFullSnapshot$1;
18007
18086
  let canvasManager;
@@ -18055,6 +18134,7 @@ function record(options = {}) {
18055
18134
  checkoutEveryNms,
18056
18135
  checkoutEveryNth,
18057
18136
  checkoutEveryNvm,
18137
+ checkoutDebounce,
18058
18138
  blockClass = "rr-block",
18059
18139
  blockSelector = null,
18060
18140
  ignoreClass = "rr-ignore",
@@ -18149,6 +18229,10 @@ function record(options = {}) {
18149
18229
  let lastFullSnapshotEvent;
18150
18230
  let incrementalSnapshotCount = 0;
18151
18231
  let visibilityMutationCount = 0;
18232
+ let checkoutId = 0;
18233
+ let checkoutPending = false;
18234
+ let checkoutDebounceTimer = null;
18235
+ let checkoutFreezeTimestamp = null;
18152
18236
  const eventProcessor = (e2) => {
18153
18237
  for (const plugin3 of plugins || []) {
18154
18238
  if (plugin3.eventProcessor) {
@@ -18161,11 +18245,25 @@ function record(options = {}) {
18161
18245
  }
18162
18246
  return e2;
18163
18247
  };
18248
+ const executeCheckout = () => {
18249
+ checkoutDebounceTimer = null;
18250
+ checkoutPending = false;
18251
+ checkoutFreezeTimestamp = null;
18252
+ takeFullSnapshot$1(true);
18253
+ mutationBuffers.forEach((buf) => {
18254
+ buf.resetBuffers();
18255
+ buf.unsetFrozen();
18256
+ });
18257
+ if (visibilityManager) {
18258
+ visibilityManager.unsetFrozen();
18259
+ }
18260
+ };
18164
18261
  wrappedEmit = (r2, isCheckout) => {
18165
18262
  var _a2;
18166
18263
  const e2 = r2;
18167
18264
  e2.timestamp = nowTimestamp();
18168
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
18265
+ e2.checkoutId = checkoutId;
18266
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && !checkoutPending && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
18169
18267
  mutationBuffers.forEach((buf) => buf.unfreeze());
18170
18268
  visibilityManager == null ? void 0 : visibilityManager.unfreeze();
18171
18269
  }
@@ -18192,7 +18290,29 @@ function record(options = {}) {
18192
18290
  const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
18193
18291
  const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
18194
18292
  if (exceedCount || exceedTime) {
18195
- takeFullSnapshot$1(true);
18293
+ if (checkoutDebounce) {
18294
+ if (!checkoutPending) {
18295
+ checkoutPending = true;
18296
+ checkoutFreezeTimestamp = nowTimestamp();
18297
+ mutationBuffers.forEach((buf) => buf.freeze());
18298
+ visibilityManager == null ? void 0 : visibilityManager.freeze();
18299
+ }
18300
+ if (checkoutDebounceTimer) {
18301
+ clearTimeout(checkoutDebounceTimer);
18302
+ }
18303
+ const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
18304
+ const maxFreeze = checkoutDebounce * 3;
18305
+ if (frozenDuration >= maxFreeze) {
18306
+ executeCheckout();
18307
+ } else {
18308
+ checkoutDebounceTimer = setTimeout(
18309
+ () => executeCheckout(),
18310
+ checkoutDebounce
18311
+ );
18312
+ }
18313
+ } else {
18314
+ takeFullSnapshot$1(true);
18315
+ }
18196
18316
  }
18197
18317
  }
18198
18318
  }
@@ -18307,8 +18427,30 @@ function record(options = {}) {
18307
18427
  notifyActivity: checkoutEveryNvm != null ? (count) => {
18308
18428
  visibilityMutationCount += count;
18309
18429
  if (visibilityMutationCount >= checkoutEveryNvm) {
18310
- takeFullSnapshot$1(true);
18311
18430
  visibilityMutationCount = 0;
18431
+ if (checkoutDebounce) {
18432
+ if (!checkoutPending) {
18433
+ checkoutPending = true;
18434
+ checkoutFreezeTimestamp = nowTimestamp();
18435
+ mutationBuffers.forEach((buf) => buf.freeze());
18436
+ visibilityManager == null ? void 0 : visibilityManager.freeze();
18437
+ }
18438
+ if (checkoutDebounceTimer) {
18439
+ clearTimeout(checkoutDebounceTimer);
18440
+ }
18441
+ const frozenDuration = nowTimestamp() - checkoutFreezeTimestamp;
18442
+ const maxFreeze = checkoutDebounce * 3;
18443
+ if (frozenDuration >= maxFreeze) {
18444
+ executeCheckout();
18445
+ } else {
18446
+ checkoutDebounceTimer = setTimeout(
18447
+ () => executeCheckout(),
18448
+ checkoutDebounce
18449
+ );
18450
+ }
18451
+ } else {
18452
+ takeFullSnapshot$1(true);
18453
+ }
18312
18454
  }
18313
18455
  } : void 0
18314
18456
  });
@@ -18317,6 +18459,7 @@ function record(options = {}) {
18317
18459
  if (!recordDOM) {
18318
18460
  return;
18319
18461
  }
18462
+ checkoutId++;
18320
18463
  wrappedEmit(
18321
18464
  {
18322
18465
  type: EventType.Meta,
@@ -18595,6 +18738,10 @@ function record(options = {}) {
18595
18738
  );
18596
18739
  }
18597
18740
  return () => {
18741
+ if (checkoutDebounceTimer) {
18742
+ clearTimeout(checkoutDebounceTimer);
18743
+ checkoutDebounceTimer = null;
18744
+ }
18598
18745
  flushCustomEventQueue$1();
18599
18746
  handlers.forEach((h) => h());
18600
18747
  processedNodeManager.destroy();
@@ -20332,10 +20479,8 @@ class Replayer {
20332
20479
  this.wrapper.appendChild(this.mouseTail);
20333
20480
  }
20334
20481
  this.iframe = document.createElement("iframe");
20335
- const attributes = ["allow-same-origin"];
20336
- if (this.config.UNSAFE_replayCanvas) {
20337
- attributes.push("allow-scripts");
20338
- }
20482
+ const attributes = ["allow-same-origin", "allow-scripts"];
20483
+ if (this.config.UNSAFE_replayCanvas) ;
20339
20484
  this.iframe.style.display = "none";
20340
20485
  this.iframe.setAttribute("sandbox", attributes.join(" "));
20341
20486
  this.disableInteract();
@@ -21531,7 +21676,7 @@ class Replayer {
21531
21676
  this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
21532
21677
  }
21533
21678
  }
21534
- const version = "3.1.1-alpha.2";
21679
+ const version = "3.2.0-alpha.1";
21535
21680
  const { getVersion } = record;
21536
21681
  const { isRecording } = record;
21537
21682
  const { flushCustomEventQueue } = record;