@tracelog/lib 2.8.2 → 2.8.3-rc.103.6

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.
@@ -1,7 +1,7 @@
1
- const dr = 9e5;
2
- const ur = 120, hr = 49152, fr = 100, mr = 500, gr = 200;
3
- const Er = 1e3, pr = 500, Sr = 1e3;
4
- const b = "data-tlog", At = [
1
+ const ur = 9e5;
2
+ const hr = 120, fr = 49152, mr = 100, gr = 500, Er = 200;
3
+ const pr = 1e3, Sr = 500, Tr = 1e3;
4
+ const b = "data-tlog", bt = [
5
5
  "button",
6
6
  "a",
7
7
  'input[type="button"]',
@@ -33,7 +33,7 @@ const b = "data-tlog", At = [
33
33
  ".menu-item",
34
34
  "[data-testid]",
35
35
  '[tabindex="0"]'
36
- ], Lt = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], Mt = [
36
+ ], Lt = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], At = [
37
37
  "token",
38
38
  "auth",
39
39
  "key",
@@ -72,15 +72,15 @@ const E = {
72
72
  INVALID_VIEWPORT_COOLDOWN_PERIOD: "Viewport cooldownPeriod must be a non-negative number",
73
73
  INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS: "Viewport maxTrackedElements must be a positive number",
74
74
  INVALID_SEND_INTERVAL: "Send interval must be between 1000ms (1 second) and 60000ms (60 seconds)"
75
- }, Ct = [
75
+ }, Mt = [
76
76
  /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
77
77
  /javascript:/gi,
78
78
  /on\w+\s*=/gi,
79
79
  /<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
80
80
  /<embed\b[^>]*>/gi,
81
81
  /<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
82
- ], I = "tlog", X = `${I}:qa_mode`, Te = `${I}:uid`, nt = "tlog_mode", He = "qa", Fe = "qa_off", Rt = (r) => r ? `${I}:${r}:queue` : `${I}:queue`, Nt = (r) => r ? `${I}:${r}:session` : `${I}:session`, Ot = (r) => r ? `${I}:${r}:broadcast` : `${I}:broadcast`, xe = (r, e) => `${I}:${r}:session_counts:${e}`, $e = 10080 * 60 * 1e3, Be = `${I}:session_counts_last_cleanup`, We = 3600 * 1e3, fe = (r) => r ? `${I}:${r}:identity` : `${I}:identity`, U = `${I}:pending_identity`;
83
- var $ = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))($ || {}), L = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(L || {}), se = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(se || {});
82
+ ], S = "tlog", X = `${S}:qa_mode`, Te = `${S}:uid`, rt = "tlog_mode", Ue = "qa", Fe = "qa_off", Ct = (r) => r ? `${S}:${r}:queue` : `${S}:queue`, Rt = (r) => r ? `${S}:${r}:rate_limit` : `${S}:rate_limit`, Nt = (r) => r ? `${S}:${r}:session` : `${S}:session`, Ot = (r) => r ? `${S}:${r}:broadcast` : `${S}:broadcast`, He = (r, e) => `${S}:${r}:session_counts:${e}`, xe = 10080 * 60 * 1e3, $e = `${S}:session_counts_last_cleanup`, Be = 3600 * 1e3, fe = (r) => r ? `${S}:${r}:identity` : `${S}:identity`, U = `${S}:pending_identity`;
83
+ var $ = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))($ || {}), A = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(A || {}), se = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(se || {});
84
84
  class O extends Error {
85
85
  constructor(e, t) {
86
86
  super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, O);
@@ -92,13 +92,13 @@ class re extends Error {
92
92
  super(e), this.name = "RateLimitError", Error.captureStackTrace && Error.captureStackTrace(this, re);
93
93
  }
94
94
  }
95
- class ne extends Error {
95
+ class ie extends Error {
96
96
  constructor(e) {
97
- super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this, ne);
97
+ super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this, ie);
98
98
  }
99
99
  }
100
- var u = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r.VIEWPORT_VISIBLE = "viewport_visible", r))(u || {}), Z = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(Z || {}), B = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(B || {}), ie = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(ie || {});
101
- const Tr = (r) => r.type === u.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !0, Ir = (r) => r.type === u.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !1;
100
+ var u = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r.VIEWPORT_VISIBLE = "viewport_visible", r))(u || {}), Z = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(Z || {}), B = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(B || {}), ne = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(ne || {});
101
+ const Ir = (r) => r.type === u.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !0, vr = (r) => r.type === u.SCROLL && "scroll_data" in r && r.scroll_data.is_primary === !1;
102
102
  class j extends Error {
103
103
  constructor(e, t, s) {
104
104
  super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
@@ -116,7 +116,7 @@ class Pt extends j {
116
116
  super(e, "SESSION_TIMEOUT_INVALID", t);
117
117
  }
118
118
  }
119
- class Xe extends j {
119
+ class We extends j {
120
120
  constructor(e, t = "config") {
121
121
  super(e, "SAMPLING_RATE_INVALID", t);
122
122
  }
@@ -126,13 +126,13 @@ class N extends j {
126
126
  super(e, "INTEGRATION_INVALID", t);
127
127
  }
128
128
  }
129
- class vr extends j {
129
+ class _r extends j {
130
130
  constructor(e, t, s = "runtime") {
131
131
  super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
132
132
  }
133
133
  timeoutMs;
134
134
  }
135
- const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", ot = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Dt = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", kt = (r, e) => {
135
+ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", nt = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Dt = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", kt = (r, e) => {
136
136
  if (e) {
137
137
  if (e instanceof Error) {
138
138
  const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
@@ -160,31 +160,31 @@ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
160
160
  return !1;
161
161
  }
162
162
  }, a = (r, e, t) => {
163
- const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ? kt(e, s) : `[TraceLog] ${e}`, d = r === "error" ? "error" : r === "warn" ? "warn" : "log";
164
- if (!Ut(l, i))
163
+ const { error: s, data: i, showToClient: n = !1, style: o, visibility: l } = t ?? {}, c = s ? kt(e, s) : `[TraceLog] ${e}`, d = r === "error" ? "error" : r === "warn" ? "warn" : "log";
164
+ if (!Ut(l, n))
165
165
  return;
166
- const g = Ht(l, o), T = n !== void 0 ? Ie(n) : void 0;
167
- Ft(d, c, g, T);
168
- }, Ut = (r, e) => r === "critical" ? !0 : r === "qa" || e ? Vt() : !1, Ht = (r, e) => e !== void 0 && e !== "" ? e : r === "critical" ? Dt : "", Ft = (r, e, t, s) => {
169
- const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
170
- s !== void 0 ? n ? console[r](i, t, s) : console[r](i, s) : n ? console[r](i, t) : console[r](i);
166
+ const g = Ft(l, o), I = i !== void 0 ? Ie(i) : void 0;
167
+ Ht(d, c, g, I);
168
+ }, Ut = (r, e) => r === "critical" ? !0 : r === "qa" || e ? Vt() : !1, Ft = (r, e) => e !== void 0 && e !== "" ? e : r === "critical" ? Dt : "", Ht = (r, e, t, s) => {
169
+ const i = t !== void 0 && t !== "", n = i ? `%c${e}` : e;
170
+ s !== void 0 ? i ? console[r](n, t, s) : console[r](n, s) : i ? console[r](n, t) : console[r](n);
171
171
  }, Ie = (r) => {
172
172
  const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
173
- for (const [s, n] of Object.entries(r)) {
174
- const i = s.toLowerCase();
175
- if (t.some((o) => i.includes(o))) {
173
+ for (const [s, i] of Object.entries(r)) {
174
+ const n = s.toLowerCase();
175
+ if (t.some((o) => n.includes(o))) {
176
176
  e[s] = "[REDACTED]";
177
177
  continue;
178
178
  }
179
- n !== null && typeof n == "object" && !Array.isArray(n) ? e[s] = Ie(n) : Array.isArray(n) ? e[s] = n.map(
179
+ i !== null && typeof i == "object" && !Array.isArray(i) ? e[s] = Ie(i) : Array.isArray(i) ? e[s] = i.map(
180
180
  (o) => o !== null && typeof o == "object" && !Array.isArray(o) ? Ie(o) : o
181
- ) : e[s] = n;
181
+ ) : e[s] = i;
182
182
  }
183
183
  return e;
184
184
  };
185
- let ve, at;
185
+ let ve, ot;
186
186
  const xt = () => {
187
- typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"), at = window.matchMedia("(hover: none)"));
187
+ typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"), ot = window.matchMedia("(hover: none)"));
188
188
  }, oe = "Unknown", $t = (r) => {
189
189
  const e = r.userAgentData?.platform;
190
190
  if (e != null && e !== "") {
@@ -200,10 +200,10 @@ const xt = () => {
200
200
  }, Bt = (r) => {
201
201
  const e = r.userAgentData?.brands;
202
202
  if (e != null && e.length > 0) {
203
- const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
204
- if (n != null) {
205
- const i = n.brand;
206
- return /google chrome/i.test(i) ? "Chrome" : /microsoft edge/i.test(i) ? "Edge" : /opera/i.test(i) ? "Opera" : i;
203
+ const i = e.filter((n) => !/not.?a.?brand|chromium/i.test(n.brand))[0];
204
+ if (i != null) {
205
+ const n = i.brand;
206
+ return /google chrome/i.test(n) ? "Chrome" : /microsoft edge/i.test(n) ? "Edge" : /opera/i.test(n) ? "Opera" : n;
207
207
  }
208
208
  }
209
209
  const t = navigator.userAgent;
@@ -213,13 +213,13 @@ const xt = () => {
213
213
  const r = navigator;
214
214
  if (r.userAgentData != null && typeof r.userAgentData.mobile == "boolean") {
215
215
  const c = r.userAgentData.platform;
216
- return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : r.userAgentData.mobile ? L.Mobile : L.Desktop;
216
+ return c != null && c !== "" && /ipad|tablet/i.test(c) ? A.Tablet : r.userAgentData.mobile ? A.Mobile : A.Desktop;
217
217
  }
218
218
  xt();
219
- const e = window.innerWidth, t = ve?.matches ?? !1, s = at?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
220
- return e <= 767 || o && n ? L.Mobile : e >= 768 && e <= 1024 || l || t && s && n ? L.Tablet : L.Desktop;
219
+ const e = window.innerWidth, t = ve?.matches ?? !1, s = ot?.matches ?? !1, i = "ontouchstart" in window || navigator.maxTouchPoints > 0, n = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(n), l = /tablet|ipad|android(?!.*mobile)/.test(n);
220
+ return e <= 767 || o && i ? A.Mobile : e >= 768 && e <= 1024 || l || t && s && i ? A.Tablet : A.Desktop;
221
221
  } catch (r) {
222
- return a("debug", "Device detection failed, defaulting to desktop", { error: r }), L.Desktop;
222
+ return a("debug", "Device detection failed, defaulting to desktop", { error: r }), A.Desktop;
223
223
  }
224
224
  }, Xt = () => {
225
225
  try {
@@ -231,12 +231,12 @@ const xt = () => {
231
231
  };
232
232
  } catch (r) {
233
233
  return a("debug", "Device info detection failed, using defaults", { error: r }), {
234
- type: L.Desktop,
234
+ type: A.Desktop,
235
235
  os: oe,
236
236
  browser: oe
237
237
  };
238
238
  }
239
- }, lt = [
239
+ }, at = [
240
240
  // Email addresses
241
241
  /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
242
242
  // US Phone numbers (various formats)
@@ -253,7 +253,7 @@ const xt = () => {
253
253
  /:\/\/[^:/]+:([^@]+)@/gi,
254
254
  // Sensitive URL query parameters (token=, password=, auth=, secret=, api_key=, etc.)
255
255
  /[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
256
- ], Ge = 500, je = 2e3, ze = 5e3, ee = 50, Gt = ee * 2, ct = 1, jt = 1e3, zt = 10, Qe = 5e3, Qt = 6e4, _r = {
256
+ ], Xe = 500, Ge = 2e3, je = 5e3, ee = 50, Gt = ee * 2, lt = 1, jt = 1e3, zt = 10, ze = 5e3, Kt = 6e4, yr = {
257
257
  LCP: 2500,
258
258
  // Good: ≤ 2.5s
259
259
  FCP: 1800,
@@ -277,7 +277,7 @@ const xt = () => {
277
277
  TTFB: 800,
278
278
  // Needs improvement: > 800ms
279
279
  LONG_TASK: 50
280
- }, Kt = {
280
+ }, Qt = {
281
281
  LCP: 4e3,
282
282
  // Poor: > 4s
283
283
  FCP: 3e3,
@@ -289,7 +289,7 @@ const xt = () => {
289
289
  TTFB: 1800,
290
290
  // Poor: > 1800ms
291
291
  LONG_TASK: 50
292
- }, _e = "needs-improvement", Ye = (r = _e) => {
292
+ }, _e = "needs-improvement", Qe = (r = _e) => {
293
293
  switch (r) {
294
294
  case "all":
295
295
  return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
@@ -297,40 +297,40 @@ const xt = () => {
297
297
  case "needs-improvement":
298
298
  return Ke;
299
299
  case "poor":
300
- return Kt;
300
+ return Qt;
301
301
  default:
302
302
  return Ke;
303
303
  }
304
- }, Yt = 1e3, qt = 50, Jt = "2.8.1", Zt = Jt, dt = () => typeof window < "u" && typeof sessionStorage < "u", es = () => {
304
+ }, Yt = 1e3, qt = 50, Jt = "2.8.3", Zt = Jt, ct = () => typeof window < "u" && typeof sessionStorage < "u", es = () => {
305
305
  try {
306
306
  const r = new URLSearchParams(window.location.search);
307
- r.delete(nt);
307
+ r.delete(rt);
308
308
  const e = r.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
309
309
  window.history.replaceState({}, "", t);
310
310
  } catch {
311
311
  }
312
312
  }, ts = () => {
313
- if (!dt())
313
+ if (!ct())
314
314
  return !1;
315
315
  try {
316
- const e = new URLSearchParams(window.location.search).get(nt), t = sessionStorage.getItem(X);
316
+ const e = new URLSearchParams(window.location.search).get(rt), t = sessionStorage.getItem(X);
317
317
  let s = null;
318
- return e === He ? (s = !0, sessionStorage.setItem(X, "true"), a("info", "QA Mode ACTIVE", {
318
+ return e === Ue ? (s = !0, sessionStorage.setItem(X, "true"), a("info", "QA Mode ACTIVE", {
319
319
  visibility: "qa",
320
320
  style: it
321
321
  })) : e === Fe && (s = !1, sessionStorage.setItem(X, "false"), a("info", "QA Mode DISABLED", {
322
322
  visibility: "qa",
323
- style: ot
324
- })), (e === He || e === Fe) && es(), s ?? t === "true";
323
+ style: nt
324
+ })), (e === Ue || e === Fe) && es(), s ?? t === "true";
325
325
  } catch {
326
326
  return !1;
327
327
  }
328
328
  }, ss = (r) => {
329
- if (dt())
329
+ if (ct())
330
330
  try {
331
331
  sessionStorage.setItem(X, r ? "true" : "false"), a("info", r ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
332
332
  visibility: "qa",
333
- style: r ? it : ot
333
+ style: r ? it : nt
334
334
  });
335
335
  } catch {
336
336
  a("debug", "Cannot set QA mode: sessionStorage unavailable");
@@ -347,37 +347,37 @@ const xt = () => {
347
347
  "co.in",
348
348
  "com.cn",
349
349
  "co.za"
350
- ], qe = (r) => {
350
+ ], Ye = (r) => {
351
351
  const e = r.toLowerCase().split(".");
352
352
  if (e.length <= 2)
353
353
  return r.toLowerCase();
354
354
  const t = e.slice(-2).join(".");
355
355
  return rs.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
356
- }, ns = (r, e) => r === e ? !0 : qe(r) === qe(e), me = () => {
356
+ }, is = (r, e) => r === e ? !0 : Ye(r) === Ye(e), me = () => {
357
357
  const r = document.referrer;
358
358
  if (!r)
359
359
  return "Direct";
360
360
  try {
361
361
  const e = new URL(r).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
362
- return ns(e, t) ? "Direct" : r;
362
+ return is(e, t) ? "Direct" : r;
363
363
  } catch (e) {
364
364
  return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: r } }), r;
365
365
  }
366
366
  }, ge = () => {
367
367
  const r = new URLSearchParams(window.location.search), e = {};
368
368
  return Lt.forEach((s) => {
369
- const n = r.get(s);
370
- if (n) {
371
- const i = s.split("utm_")[1];
372
- e[i] = n;
369
+ const i = r.get(s);
370
+ if (i) {
371
+ const n = s.split("utm_")[1];
372
+ e[n] = i;
373
373
  }
374
374
  }), Object.keys(e).length ? e : void 0;
375
- }, ut = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
375
+ }, dt = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
376
376
  const e = Math.random() * 16 | 0;
377
377
  return (r === "x" ? e : e & 3 | 8).toString(16);
378
378
  });
379
379
  let Y = 0, q = 0;
380
- const ye = () => {
380
+ const ns = () => {
381
381
  let r = Date.now();
382
382
  r < q && (r = q), r === q ? Y = (Y + 1) % 1e3 : Y = 0, q = r;
383
383
  const e = Y.toString().padStart(3, "0");
@@ -385,19 +385,19 @@ const ye = () => {
385
385
  try {
386
386
  if (typeof crypto < "u" && crypto.getRandomValues) {
387
387
  const s = crypto.getRandomValues(new Uint8Array(3));
388
- s && (t = Array.from(s, (n) => n.toString(16).padStart(2, "0")).join(""));
388
+ s && (t = Array.from(s, (i) => i.toString(16).padStart(2, "0")).join(""));
389
389
  }
390
390
  } catch {
391
391
  }
392
392
  return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${r}-${e}-${t}`;
393
- }, ht = (r, e = !1) => {
393
+ }, ut = (r, e = !1) => {
394
394
  try {
395
- const t = new URL(r), s = t.protocol === "https:", n = t.protocol === "http:";
396
- return s || e && n;
395
+ const t = new URL(r), s = t.protocol === "https:", i = t.protocol === "http:";
396
+ return s || e && i;
397
397
  } catch {
398
398
  return !1;
399
399
  }
400
- }, is = (r) => {
400
+ }, os = (r) => {
401
401
  try {
402
402
  const t = new URL(window.location.href).hostname;
403
403
  if (!t || typeof t != "string")
@@ -411,49 +411,49 @@ const ye = () => {
411
411
  throw new Error("Invalid hostname structure");
412
412
  if (s.length === 1)
413
413
  throw new Error("Single-part domain not supported for SaaS integration");
414
- let n;
415
- if (s.length === 2 ? n = s.join(".") : n = s.slice(-2).join("."), !n || n.split(".").length < 2)
414
+ let i;
415
+ if (s.length === 2 ? i = s.join(".") : i = s.slice(-2).join("."), !i || i.split(".").length < 2)
416
416
  throw new Error("Invalid domain structure for SaaS");
417
- const i = `https://${r}.${n}/collect`;
418
- if (!ht(i))
417
+ const n = `https://${r}.${i}/collect`;
418
+ if (!ut(n))
419
419
  throw new Error("Generated URL failed validation");
420
- return i;
420
+ return n;
421
421
  } catch (e) {
422
422
  throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
423
423
  }
424
- }, os = (r) => {
424
+ }, as = (r) => {
425
425
  const e = {};
426
- r.integrations?.tracelog?.projectId && (e.saas = is(r.integrations.tracelog.projectId));
426
+ r.integrations?.tracelog?.projectId && (e.saas = os(r.integrations.tracelog.projectId));
427
427
  const t = r.integrations?.custom?.collectApiUrl;
428
428
  if (t) {
429
429
  const s = r.integrations?.custom?.allowHttp ?? !1;
430
- if (!ht(t, s))
430
+ if (!ut(t, s))
431
431
  throw new Error("Invalid custom API URL");
432
432
  e.custom = t;
433
433
  }
434
434
  return e;
435
- }, we = (r, e = []) => {
435
+ }, ye = (r, e = []) => {
436
436
  if (!r || typeof r != "string")
437
437
  return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof r } }), r || "";
438
438
  try {
439
- const t = new URL(r), s = t.searchParams, n = [.../* @__PURE__ */ new Set([...Mt, ...e])];
440
- let i = !1;
439
+ const t = new URL(r), s = t.searchParams, i = [.../* @__PURE__ */ new Set([...At, ...e])];
440
+ let n = !1;
441
441
  const o = [];
442
- return n.forEach((c) => {
443
- s.has(c) && (s.delete(c), i = !0, o.push(c));
444
- }), !i && r.includes("?") ? r : (t.search = s.toString(), t.toString());
442
+ return i.forEach((c) => {
443
+ s.has(c) && (s.delete(c), n = !0, o.push(c));
444
+ }), !n && r.includes("?") ? r : (t.search = s.toString(), t.toString());
445
445
  } catch (t) {
446
446
  return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: r?.length } }), r;
447
447
  }
448
- }, Je = (r) => {
448
+ }, qe = (r) => {
449
449
  if (!r || typeof r != "string" || r.trim().length === 0)
450
450
  return "";
451
451
  let e = r;
452
452
  r.length > 1e3 && (e = r.slice(0, Math.max(0, 1e3)));
453
453
  let t = 0;
454
- for (const n of Ct) {
455
- const i = e;
456
- e = e.replace(n, ""), i !== e && t++;
454
+ for (const i of Mt) {
455
+ const n = e;
456
+ e = e.replace(i, ""), n !== e && t++;
457
457
  }
458
458
  return t > 0 && a("warn", "XSS patterns detected and removed", {
459
459
  data: {
@@ -461,11 +461,11 @@ const ye = () => {
461
461
  valueLength: r.length
462
462
  }
463
463
  }), e.trim();
464
- }, be = (r, e = 0) => {
464
+ }, we = (r, e = 0) => {
465
465
  if (r == null)
466
466
  return null;
467
467
  if (typeof r == "string")
468
- return Je(r);
468
+ return qe(r);
469
469
  if (typeof r == "number")
470
470
  return !Number.isFinite(r) || r < -Number.MAX_SAFE_INTEGER || r > Number.MAX_SAFE_INTEGER ? 0 : r;
471
471
  if (typeof r == "boolean")
@@ -473,30 +473,30 @@ const ye = () => {
473
473
  if (e > 10)
474
474
  return null;
475
475
  if (Array.isArray(r))
476
- return r.slice(0, 1e3).map((n) => be(n, e + 1)).filter((n) => n !== null);
476
+ return r.slice(0, 1e3).map((i) => we(i, e + 1)).filter((i) => i !== null);
477
477
  if (typeof r == "object") {
478
- const t = {}, n = Object.entries(r).slice(0, 200);
479
- for (const [i, o] of n) {
480
- const l = Je(i);
478
+ const t = {}, i = Object.entries(r).slice(0, 200);
479
+ for (const [n, o] of i) {
480
+ const l = qe(n);
481
481
  if (l) {
482
- const c = be(o, e + 1);
482
+ const c = we(o, e + 1);
483
483
  c !== null && (t[l] = c);
484
484
  }
485
485
  }
486
486
  return t;
487
487
  }
488
488
  return null;
489
- }, as = (r) => {
489
+ }, ls = (r) => {
490
490
  if (typeof r != "object" || r === null)
491
491
  return {};
492
492
  try {
493
- const e = be(r);
493
+ const e = we(r);
494
494
  return typeof e == "object" && e !== null ? e : {};
495
495
  } catch (e) {
496
496
  const t = e instanceof Error ? e.message : String(e);
497
497
  throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
498
498
  }
499
- }, ls = (r) => {
499
+ }, cs = (r) => {
500
500
  if (r !== void 0 && (r === null || typeof r != "object"))
501
501
  throw new m("Configuration must be an object", "config");
502
502
  if (r) {
@@ -504,7 +504,7 @@ const ye = () => {
504
504
  throw new Pt(E.INVALID_SESSION_TIMEOUT, "config");
505
505
  if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
506
506
  throw new m(E.INVALID_GLOBAL_METADATA, "config");
507
- if (r.integrations && ds(r.integrations), r.sensitiveQueryParams !== void 0) {
507
+ if (r.integrations && us(r.integrations), r.sensitiveQueryParams !== void 0) {
508
508
  if (!Array.isArray(r.sensitiveQueryParams))
509
509
  throw new m(E.INVALID_SENSITIVE_QUERY_PARAMS, "config");
510
510
  for (const e of r.sensitiveQueryParams)
@@ -512,9 +512,9 @@ const ye = () => {
512
512
  throw new m("All sensitive query params must be strings", "config");
513
513
  }
514
514
  if (r.errorSampling !== void 0 && (typeof r.errorSampling != "number" || r.errorSampling < 0 || r.errorSampling > 1))
515
- throw new Xe(E.INVALID_ERROR_SAMPLING_RATE, "config");
515
+ throw new We(E.INVALID_ERROR_SAMPLING_RATE, "config");
516
516
  if (r.samplingRate !== void 0 && (typeof r.samplingRate != "number" || r.samplingRate < 0 || r.samplingRate > 1))
517
- throw new Xe(E.INVALID_SAMPLING_RATE, "config");
517
+ throw new We(E.INVALID_SAMPLING_RATE, "config");
518
518
  if (r.primaryScrollSelector !== void 0) {
519
519
  if (typeof r.primaryScrollSelector != "string" || !r.primaryScrollSelector.trim())
520
520
  throw new m(E.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
@@ -536,7 +536,7 @@ const ye = () => {
536
536
  throw new m(E.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
537
537
  if (r.sendIntervalMs !== void 0 && (!Number.isFinite(r.sendIntervalMs) || r.sendIntervalMs < 1e3 || r.sendIntervalMs > 6e4))
538
538
  throw new m(E.INVALID_SEND_INTERVAL, "config");
539
- if (r.viewport !== void 0 && cs(r.viewport), r.webVitalsMode !== void 0) {
539
+ if (r.viewport !== void 0 && ds(r.viewport), r.webVitalsMode !== void 0) {
540
540
  if (typeof r.webVitalsMode != "string")
541
541
  throw new m(
542
542
  `Invalid webVitalsMode type: ${typeof r.webVitalsMode}. Must be a string`,
@@ -567,7 +567,7 @@ const ye = () => {
567
567
  }
568
568
  }
569
569
  }
570
- }, cs = (r) => {
570
+ }, ds = (r) => {
571
571
  if (typeof r != "object" || r === null)
572
572
  throw new m(E.INVALID_VIEWPORT_CONFIG, "config");
573
573
  if (!r.elements || !Array.isArray(r.elements))
@@ -597,7 +597,7 @@ const ye = () => {
597
597
  throw new m(E.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
598
598
  if (r.maxTrackedElements !== void 0 && (typeof r.maxTrackedElements != "number" || r.maxTrackedElements <= 0))
599
599
  throw new m(E.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
600
- }, ds = (r) => {
600
+ }, us = (r) => {
601
601
  if (r) {
602
602
  if (r.tracelog && (!r.tracelog.projectId || typeof r.tracelog.projectId != "string" || r.tracelog.projectId.trim() === ""))
603
603
  throw new N(E.INVALID_TRACELOG_PROJECT_ID, "config");
@@ -620,14 +620,14 @@ const ye = () => {
620
620
  if (r.tracelog?.shopify !== void 0 && typeof r.tracelog.shopify != "boolean")
621
621
  throw new N("tracelog.shopify must be a boolean", "config");
622
622
  }
623
- }, us = (r) => {
624
- ls(r);
623
+ }, hs = (r) => {
624
+ cs(r);
625
625
  const e = {
626
626
  ...r ?? {},
627
627
  sessionTimeout: r?.sessionTimeout ?? 9e5,
628
628
  globalMetadata: r?.globalMetadata ?? {},
629
629
  sensitiveQueryParams: r?.sensitiveQueryParams ?? [],
630
- errorSampling: r?.errorSampling ?? ct,
630
+ errorSampling: r?.errorSampling ?? lt,
631
631
  samplingRate: r?.samplingRate ?? 1,
632
632
  pageViewThrottleMs: r?.pageViewThrottleMs ?? 1e3,
633
633
  clickThrottleMs: r?.clickThrottleMs ?? 300,
@@ -644,18 +644,18 @@ const ye = () => {
644
644
  cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
645
645
  maxTrackedElements: e.viewport.maxTrackedElements ?? 100
646
646
  }), e;
647
- }, Ae = (r, e = /* @__PURE__ */ new Set()) => {
647
+ }, be = (r, e = /* @__PURE__ */ new Set()) => {
648
648
  if (r == null)
649
649
  return !0;
650
650
  const t = typeof r;
651
- return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(r) ? !1 : (e.add(r), Array.isArray(r) ? r.every((s) => Ae(s, e)) : t === "object" ? Object.values(r).every((s) => Ae(s, e)) : !1);
652
- }, hs = (r) => typeof r != "object" || r === null ? !1 : Ae(r), ft = (r) => {
651
+ return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(r) ? !1 : (e.add(r), Array.isArray(r) ? r.every((s) => be(s, e)) : t === "object" ? Object.values(r).every((s) => be(s, e)) : !1);
652
+ }, fs = (r) => typeof r != "object" || r === null ? !1 : be(r), ht = (r) => {
653
653
  if (typeof r != "object" || r === null || Array.isArray(r)) return;
654
654
  const e = {};
655
655
  for (const [t, s] of Object.entries(r))
656
656
  typeof s == "string" && (e[t] = s);
657
657
  return Object.keys(e).length > 0 ? e : void 0;
658
- }, fs = (r) => typeof r != "string" ? {
658
+ }, ms = (r) => typeof r != "string" ? {
659
659
  valid: !1,
660
660
  error: "Event name must be a string"
661
661
  } : r.length === 0 ? {
@@ -670,71 +670,71 @@ const ye = () => {
670
670
  } : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(r.toLowerCase()) ? {
671
671
  valid: !1,
672
672
  error: "Event name cannot be a reserved word"
673
- } : { valid: !0 }, Ze = (r, e, t) => {
674
- const s = as(e), n = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
675
- if (!hs(s))
673
+ } : { valid: !0 }, Je = (r, e, t) => {
674
+ const s = ls(e), i = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
675
+ if (!fs(s))
676
676
  return {
677
677
  valid: !1,
678
- error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
678
+ error: `${i}: object has invalid types. Valid types are string, number, boolean or string arrays.`
679
679
  };
680
- let i;
680
+ let n;
681
681
  try {
682
- i = JSON.stringify(s);
682
+ n = JSON.stringify(s);
683
683
  } catch {
684
684
  return {
685
685
  valid: !1,
686
- error: `${n}: object contains circular references or cannot be serialized.`
686
+ error: `${i}: object contains circular references or cannot be serialized.`
687
687
  };
688
688
  }
689
- if (new TextEncoder().encode(i).byteLength > 49152)
689
+ if (new TextEncoder().encode(n).byteLength > 49152)
690
690
  return {
691
691
  valid: !1,
692
- error: `${n}: object is too large (max ${49152 / 1024} KB).`
692
+ error: `${i}: object is too large (max ${49152 / 1024} KB).`
693
693
  };
694
694
  if (Object.keys(s).length > 100)
695
695
  return {
696
696
  valid: !1,
697
- error: `${n}: object has too many keys (max 100 keys).`
697
+ error: `${i}: object has too many keys (max 100 keys).`
698
698
  };
699
699
  for (const [c, d] of Object.entries(s)) {
700
700
  if (Array.isArray(d)) {
701
701
  if (d.length > 500)
702
702
  return {
703
703
  valid: !1,
704
- error: `${n}: array property "${c}" is too large (max 500 items).`
704
+ error: `${i}: array property "${c}" is too large (max 500 items).`
705
705
  };
706
706
  for (const f of d)
707
707
  if (typeof f == "string" && f.length > 500)
708
708
  return {
709
709
  valid: !1,
710
- error: `${n}: array property "${c}" contains strings that are too long (max 500 characters).`
710
+ error: `${i}: array property "${c}" contains strings that are too long (max 500 characters).`
711
711
  };
712
712
  }
713
713
  if (typeof d == "string" && d.length > 1e3)
714
714
  return {
715
715
  valid: !1,
716
- error: `${n}: property "${c}" is too long (max 1000 characters).`
716
+ error: `${i}: property "${c}" is too long (max 1000 characters).`
717
717
  };
718
718
  }
719
719
  return {
720
720
  valid: !0,
721
721
  sanitizedMetadata: s
722
722
  };
723
- }, mt = (r, e, t) => {
723
+ }, ft = (r, e, t) => {
724
724
  if (Array.isArray(e)) {
725
- const s = [], n = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
726
- for (let i = 0; i < e.length; i++) {
727
- const o = e[i];
725
+ const s = [], i = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
726
+ for (let n = 0; n < e.length; n++) {
727
+ const o = e[n];
728
728
  if (typeof o != "object" || o === null || Array.isArray(o))
729
729
  return {
730
730
  valid: !1,
731
- error: `${n}: array item at index ${i} must be an object.`
731
+ error: `${i}: array item at index ${n} must be an object.`
732
732
  };
733
- const l = Ze(r, o, t);
733
+ const l = Je(r, o, t);
734
734
  if (!l.valid)
735
735
  return {
736
736
  valid: !1,
737
- error: `${n}: array item at index ${i} is invalid: ${l.error}`
737
+ error: `${i}: array item at index ${n} is invalid: ${l.error}`
738
738
  };
739
739
  l.sanitizedMetadata && s.push(l.sanitizedMetadata);
740
740
  }
@@ -743,16 +743,16 @@ const ye = () => {
743
743
  sanitizedMetadata: s
744
744
  };
745
745
  }
746
- return Ze(r, e, t);
747
- }, ms = (r, e) => {
748
- const t = fs(r);
746
+ return Je(r, e, t);
747
+ }, gs = (r, e) => {
748
+ const t = ms(r);
749
749
  if (!t.valid)
750
750
  return a("error", "Event name validation failed", {
751
751
  data: { eventName: r, error: t.error }
752
752
  }), t;
753
753
  if (!e)
754
754
  return { valid: !0 };
755
- const s = mt(r, e, "customEvent");
755
+ const s = ft(r, e, "customEvent");
756
756
  return s.valid || a("error", "Event metadata validation failed", {
757
757
  data: {
758
758
  eventName: r,
@@ -760,7 +760,7 @@ const ye = () => {
760
760
  }
761
761
  }), s;
762
762
  };
763
- class gs {
763
+ class Es {
764
764
  listeners = /* @__PURE__ */ new Map();
765
765
  /**
766
766
  * Subscribes to an event channel
@@ -813,8 +813,8 @@ class gs {
813
813
  off(e, t) {
814
814
  const s = this.listeners.get(e);
815
815
  if (s) {
816
- const n = s.indexOf(t);
817
- n > -1 && s.splice(n, 1);
816
+ const i = s.indexOf(t);
817
+ i > -1 && s.splice(i, 1);
818
818
  }
819
819
  }
820
820
  /**
@@ -847,8 +847,8 @@ class gs {
847
847
  */
848
848
  emit(e, t) {
849
849
  const s = this.listeners.get(e);
850
- s && s.forEach((n) => {
851
- n(t);
850
+ s && s.forEach((i) => {
851
+ i(t);
852
852
  });
853
853
  }
854
854
  /**
@@ -877,7 +877,7 @@ class gs {
877
877
  this.listeners.clear();
878
878
  }
879
879
  }
880
- function gt(r, e, t) {
880
+ function mt(r, e, t) {
881
881
  try {
882
882
  const s = e(r);
883
883
  return s === null ? null : typeof s == "object" && s !== null && "type" in s ? s : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), r);
@@ -888,10 +888,10 @@ function gt(r, e, t) {
888
888
  }), r;
889
889
  }
890
890
  }
891
- function Es(r, e, t) {
892
- return r.map((s) => gt(s, e, t)).filter((s) => s !== null);
891
+ function ps(r, e, t) {
892
+ return r.map((s) => mt(s, e, t)).filter((s) => s !== null);
893
893
  }
894
- function Et(r, e, t) {
894
+ function gt(r, e, t) {
895
895
  try {
896
896
  const s = e(r);
897
897
  return s === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
@@ -966,7 +966,7 @@ class _ {
966
966
  return { ...Ee };
967
967
  }
968
968
  }
969
- class et extends _ {
969
+ class Ze extends _ {
970
970
  storeManager;
971
971
  integrationId;
972
972
  apiUrl;
@@ -987,6 +987,20 @@ class et extends _ {
987
987
  */
988
988
  consecutiveNetworkFailures = 0;
989
989
  circuitOpenedAt = 0;
990
+ /**
991
+ * Timestamp (epoch ms) before which `send()` must skip fetch() calls due to
992
+ * a prior 429 response. Mirrored to `localStorage` (keyed by userId) so the
993
+ * cooldown survives page navigations on traditional server-rendered sites
994
+ * and is discoverable by other tabs on the same origin.
995
+ */
996
+ rateLimitedUntil = 0;
997
+ /**
998
+ * Storage key used when the current in-memory cooldown was armed. Captured
999
+ * at arm time so `resetIdentity()` (which changes `userId` mid-cooldown)
1000
+ * can't make persist/clear operations target the wrong key or leave the
1001
+ * old user's cooldown orphaned in storage.
1002
+ */
1003
+ rateLimitStorageKeyAtArm = null;
990
1004
  /**
991
1005
  * Creates a SenderManager instance.
992
1006
  *
@@ -1001,10 +1015,10 @@ class et extends _ {
1001
1015
  * @param customHeadersProvider - Optional callback for dynamic headers
1002
1016
  * @throws Error if integrationId and apiUrl are not both provided or both undefined
1003
1017
  */
1004
- constructor(e, t, s, n = {}, i = {}, o, l = "include") {
1018
+ constructor(e, t, s, i = {}, n = {}, o, l = "include") {
1005
1019
  if (super(), t && !s || !t && s)
1006
1020
  throw new Error("SenderManager: integrationId and apiUrl must either both be provided or both be undefined");
1007
- this.storeManager = e, this.integrationId = t, this.apiUrl = s, this.transformers = n, this.staticHeaders = i, this.customHeadersProvider = o, this.fetchCredentials = l;
1021
+ this.storeManager = e, this.integrationId = t, this.apiUrl = s, this.transformers = i, this.staticHeaders = n, this.customHeadersProvider = o, this.fetchCredentials = l, this.rateLimitedUntil = this.loadRateLimitCooldown();
1008
1022
  }
1009
1023
  /**
1010
1024
  * Get the integration ID for this sender
@@ -1051,9 +1065,67 @@ class et extends _ {
1051
1065
  return { ...this.staticHeaders, ...e };
1052
1066
  }
1053
1067
  getQueueStorageKey() {
1068
+ const e = this.get("userId") || "anonymous", t = Ct(e);
1069
+ return this.integrationId ? `${t}:${this.integrationId}` : t;
1070
+ }
1071
+ getRateLimitStorageKey() {
1054
1072
  const e = this.get("userId") || "anonymous", t = Rt(e);
1055
1073
  return this.integrationId ? `${t}:${this.integrationId}` : t;
1056
1074
  }
1075
+ /**
1076
+ * Returns the storage key bound to the *current* in-memory cooldown. Falls
1077
+ * back to the current-userId key when no cooldown is armed (first read) so
1078
+ * discovery-from-storage paths can still resolve a key.
1079
+ */
1080
+ getActiveRateLimitKey() {
1081
+ return this.rateLimitStorageKeyAtArm ?? this.getRateLimitStorageKey();
1082
+ }
1083
+ armRateLimitCooldown(e) {
1084
+ this.rateLimitedUntil = e, this.rateLimitStorageKeyAtArm = this.getRateLimitStorageKey(), this.persistRateLimitCooldown(e);
1085
+ }
1086
+ loadRateLimitCooldown() {
1087
+ const e = this.getRateLimitStorageKey();
1088
+ try {
1089
+ const t = this.storeManager.getItem(e);
1090
+ if (!t) return 0;
1091
+ const s = Number(t);
1092
+ return !Number.isFinite(s) || s <= Date.now() ? (this.storeManager.removeItem(e), 0) : (this.rateLimitStorageKeyAtArm = e, s);
1093
+ } catch {
1094
+ return 0;
1095
+ }
1096
+ }
1097
+ persistRateLimitCooldown(e) {
1098
+ const t = this.getActiveRateLimitKey();
1099
+ try {
1100
+ const s = this.storeManager.getItem(t);
1101
+ if (s) {
1102
+ const i = Number(s);
1103
+ if (Number.isFinite(i) && i >= e)
1104
+ return;
1105
+ }
1106
+ this.storeManager.setItem(t, String(e));
1107
+ } catch {
1108
+ }
1109
+ }
1110
+ clearRateLimitCooldown() {
1111
+ const e = this.getActiveRateLimitKey();
1112
+ try {
1113
+ const t = this.storeManager.getItem(e);
1114
+ if (t) {
1115
+ const s = Number(t);
1116
+ if (Number.isFinite(s) && s > Date.now()) {
1117
+ this.rateLimitedUntil = s;
1118
+ return;
1119
+ }
1120
+ }
1121
+ this.storeManager.removeItem(e);
1122
+ } catch {
1123
+ }
1124
+ this.rateLimitedUntil = 0, this.rateLimitStorageKeyAtArm = null;
1125
+ }
1126
+ isRateLimited() {
1127
+ return this.rateLimitedUntil === 0 && (this.rateLimitedUntil = this.loadRateLimitCooldown()), !(this.rateLimitedUntil === 0 || Date.now() >= this.rateLimitedUntil && (this.clearRateLimitCooldown(), this.rateLimitedUntil === 0));
1128
+ }
1057
1129
  /**
1058
1130
  * Sends events synchronously using `navigator.sendBeacon()`.
1059
1131
  *
@@ -1072,7 +1144,8 @@ class et extends _ {
1072
1144
  *
1073
1145
  * **Return Values**:
1074
1146
  * - `true`: Send succeeded OR skipped (standalone mode)
1075
- * - `false`: Send failed (network error, browser rejected beacon)
1147
+ * - `false`: Send failed (network error, browser rejected beacon) OR skipped
1148
+ * due to active rate-limit cooldown (events persisted for later recovery)
1076
1149
  *
1077
1150
  * **Important**: No retry mechanism. Failed events are persisted to localStorage for
1078
1151
  * recovery on next page load via `recoverPersistedEvents()`.
@@ -1094,7 +1167,23 @@ class et extends _ {
1094
1167
  * @see src/managers/README.md (lines 82-139) for send details
1095
1168
  */
1096
1169
  sendEventsQueueSync(e) {
1097
- return this.shouldSkipSend() ? !0 : this.apiUrl?.includes($.Fail) ? (a(
1170
+ if (this.shouldSkipSend())
1171
+ return !0;
1172
+ if (this.isRateLimited()) {
1173
+ a(
1174
+ "debug",
1175
+ `Rate-limit cooldown active, skipping sync send${this.integrationId ? ` [${this.integrationId}]` : ""}`,
1176
+ {
1177
+ data: {
1178
+ cooldownRemainingMs: this.rateLimitedUntil - Date.now(),
1179
+ events: e.events.length
1180
+ }
1181
+ }
1182
+ );
1183
+ const t = this.ensureBatchMetadata(e), s = this.getPersistedData(), i = typeof s?.recoveryFailures == "number" && Number.isFinite(s.recoveryFailures) ? s.recoveryFailures : 0;
1184
+ return this.persistEventsWithFailureCount(t, i, !0), !1;
1185
+ }
1186
+ return this.apiUrl?.includes($.Fail) ? (a(
1098
1187
  "warn",
1099
1188
  `Fail mode: simulating network failure (sync)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
1100
1189
  {
@@ -1156,10 +1245,10 @@ class et extends _ {
1156
1245
  async sendEventsQueue(e, t) {
1157
1246
  const s = this.ensureBatchMetadata(e);
1158
1247
  try {
1159
- const n = await this.send(s);
1160
- return n ? (this.clearPersistedEvents(), t?.onSuccess?.(s.events.length, s.events, s)) : (this.persistEvents(s), t?.onFailure?.()), n;
1161
- } catch (n) {
1162
- return n instanceof O ? (this.logPermanentError("Permanent error, not retrying", n), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(s), t?.onFailure?.(), !1);
1248
+ const i = await this.send(s);
1249
+ return i ? (this.clearPersistedEvents(), t?.onSuccess?.(s.events.length, s.events, s)) : (this.persistEvents(s), t?.onFailure?.()), i;
1250
+ } catch (i) {
1251
+ return i instanceof O ? (this.logPermanentError("Permanent error, not retrying", i), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(s), t?.onFailure?.(), !1);
1163
1252
  }
1164
1253
  }
1165
1254
  /**
@@ -1219,26 +1308,36 @@ class et extends _ {
1219
1308
  this.recoveryInProgress = !0;
1220
1309
  let t = null, s = 0;
1221
1310
  try {
1222
- const n = this.getPersistedData();
1223
- if (!n || !this.isDataRecent(n) || n.events.length === 0) {
1311
+ const i = this.getPersistedData();
1312
+ if (!i || !this.isDataRecent(i) || i.events.length === 0) {
1224
1313
  this.clearPersistedEvents();
1225
1314
  return;
1226
1315
  }
1227
- const i = n.recoveryFailures;
1228
- if (s = typeof i == "number" && Number.isFinite(i) && i >= 0 ? i : 0, s >= 3) {
1316
+ const n = i.recoveryFailures;
1317
+ if (s = typeof n == "number" && Number.isFinite(n) && n >= 0 ? n : 0, s >= 3) {
1229
1318
  a(
1230
1319
  "debug",
1231
1320
  `Discarding persisted events after ${s} failed recovery attempts${this.integrationId ? ` [${this.integrationId}]` : ""}`
1232
1321
  ), this.clearPersistedEvents(), e?.onFailure?.();
1233
1322
  return;
1234
1323
  }
1235
- t = this.ensureBatchMetadata(this.createRecoveryBody(n)), await this.send(t) ? (this.clearPersistedEvents(), e?.onSuccess?.(n.events.length, n.events, t)) : (this.persistEventsWithFailureCount(t, s + 1, !0), e?.onFailure?.());
1236
- } catch (n) {
1237
- if (n instanceof O) {
1238
- this.logPermanentError("Permanent error during recovery, clearing persisted events", n), this.clearPersistedEvents(), e?.onFailure?.();
1324
+ if (this.isRateLimited()) {
1325
+ a(
1326
+ "debug",
1327
+ `Rate-limit cooldown active, deferring recovery${this.integrationId ? ` [${this.integrationId}]` : ""}`,
1328
+ {
1329
+ data: { cooldownRemainingMs: this.rateLimitedUntil - Date.now() }
1330
+ }
1331
+ ), e?.onFailure?.();
1332
+ return;
1333
+ }
1334
+ t = this.ensureBatchMetadata(this.createRecoveryBody(i)), await this.send(t) ? (this.clearPersistedEvents(), e?.onSuccess?.(i.events.length, i.events, t)) : (this.persistEventsWithFailureCount(t, s + 1, !0), e?.onFailure?.());
1335
+ } catch (i) {
1336
+ if (i instanceof O) {
1337
+ this.logPermanentError("Permanent error during recovery, clearing persisted events", i), this.clearPersistedEvents(), e?.onFailure?.();
1239
1338
  return;
1240
1339
  }
1241
- a("error", "Failed to recover persisted events", { error: n }), t && this.persistEventsWithFailureCount(t, s + 1, !0), e?.onFailure?.();
1340
+ a("error", "Failed to recover persisted events", { error: i }), t && this.persistEventsWithFailureCount(t, s + 1, !0), e?.onFailure?.();
1242
1341
  } finally {
1243
1342
  this.recoveryInProgress = !1;
1244
1343
  }
@@ -1288,7 +1387,7 @@ class et extends _ {
1288
1387
  const t = this.transformers.beforeSend;
1289
1388
  if (!t)
1290
1389
  return e;
1291
- const s = Es(
1390
+ const s = ps(
1292
1391
  e.events,
1293
1392
  t,
1294
1393
  this.integrationId || "SenderManager"
@@ -1333,7 +1432,7 @@ class et extends _ {
1333
1432
  if (this.integrationId === "saas")
1334
1433
  return e;
1335
1434
  const t = this.transformers.beforeBatch;
1336
- return t ? Et(e, t, this.integrationId || "SenderManager") : e;
1435
+ return t ? gt(e, t, this.integrationId || "SenderManager") : e;
1337
1436
  }
1338
1437
  /**
1339
1438
  * Calculates exponential backoff delay with jitter for retry attempts.
@@ -1355,8 +1454,8 @@ class et extends _ {
1355
1454
  * @returns Promise that resolves after calculated delay
1356
1455
  */
1357
1456
  async backoffDelay(e) {
1358
- const t = 100 * Math.pow(2, e), s = Math.random() * 100, n = t + s;
1359
- return new Promise((i) => setTimeout(i, n));
1457
+ const t = 100 * Math.pow(2, e), s = Math.random() * 100, i = t + s;
1458
+ return new Promise((n) => setTimeout(n, i));
1360
1459
  }
1361
1460
  /**
1362
1461
  * Sends event queue with automatic retry logic for transient failures.
@@ -1401,15 +1500,22 @@ class et extends _ {
1401
1500
  const s = this.applyBeforeBatchTransformer(t);
1402
1501
  if (!s)
1403
1502
  return !0;
1404
- const n = this.ensureBatchMetadata(s, e._metadata?.idempotency_token);
1503
+ const i = this.ensureBatchMetadata(s, e._metadata?.idempotency_token);
1405
1504
  if (this.apiUrl?.includes($.Fail))
1406
1505
  return a("debug", `Fail mode: simulating network failure${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1407
- data: { events: n.events.length }
1506
+ data: { events: i.events.length }
1408
1507
  }), !1;
1409
1508
  if (this.apiUrl?.includes($.Localhost))
1410
1509
  return a("debug", `Success mode: simulating successful send${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1411
- data: { events: n.events.length }
1510
+ data: { events: i.events.length }
1412
1511
  }), !0;
1512
+ if (this.isRateLimited())
1513
+ return a("debug", `Rate-limit cooldown active, skipping send${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1514
+ data: {
1515
+ cooldownRemainingMs: this.rateLimitedUntil - Date.now(),
1516
+ events: i.events.length
1517
+ }
1518
+ }), !1;
1413
1519
  if (this.consecutiveNetworkFailures >= 3) {
1414
1520
  const d = Date.now() - this.circuitOpenedAt;
1415
1521
  if (d < 12e4)
@@ -1420,15 +1526,15 @@ class et extends _ {
1420
1526
  }
1421
1527
  }), !1;
1422
1528
  }
1423
- const { url: i, payload: o } = this.prepareRequest(n);
1529
+ const { url: n, payload: o } = this.prepareRequest(i);
1424
1530
  let l = !0, c = !1;
1425
1531
  for (let d = 1; d <= 3; d++)
1426
1532
  try {
1427
- return (await this.sendWithTimeout(i, o)).ok ? (d > 1 && a(
1533
+ return (await this.sendWithTimeout(n, o)).ok ? (d > 1 && a(
1428
1534
  "info",
1429
1535
  `Send succeeded after ${d - 1} retry attempt(s)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
1430
1536
  {
1431
- data: { events: n.events.length, attempt: d }
1537
+ data: { events: i.events.length, attempt: d }
1432
1538
  }
1433
1539
  ), this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, !0) : !1;
1434
1540
  } catch (f) {
@@ -1436,19 +1542,19 @@ class et extends _ {
1436
1542
  if (f instanceof O)
1437
1543
  throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, f;
1438
1544
  if (f instanceof re) {
1439
- this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, l = !1, c = !0, a("warn", `Rate limited, skipping retries${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1440
- data: { events: e.events.length, attempt: d }
1545
+ this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, l = !1, c = !0, this.armRateLimitCooldown(Date.now() + 6e4), a("warn", `Rate limited, skipping retries${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1546
+ data: { events: e.events.length, attempt: d, cooldownMs: 6e4 }
1441
1547
  });
1442
1548
  break;
1443
1549
  }
1444
- if (f instanceof ne || (l = !1), f instanceof TypeError || (c = !0), a(
1550
+ if (f instanceof ie || (l = !1), f instanceof TypeError || (c = !0), a(
1445
1551
  g ? "error" : "warn",
1446
1552
  `Send attempt ${d} failed${this.integrationId ? ` [${this.integrationId}]` : ""}${g ? " (all retries exhausted)" : ", will retry"}`,
1447
1553
  {
1448
1554
  error: f,
1449
1555
  data: {
1450
1556
  events: e.events.length,
1451
- url: i.replace(/\/\/[^/]+/, "//[DOMAIN]"),
1557
+ url: n.replace(/\/\/[^/]+/, "//[DOMAIN]"),
1452
1558
  attempt: d,
1453
1559
  maxAttempts: 3
1454
1560
  }
@@ -1461,7 +1567,7 @@ class et extends _ {
1461
1567
  "debug",
1462
1568
  `All retry attempts timed out, preserving batch for retry${this.integrationId ? ` [${this.integrationId}]` : ""}`,
1463
1569
  {
1464
- data: { events: n.events.length }
1570
+ data: { events: i.events.length }
1465
1571
  }
1466
1572
  ), !1) : (c ? (this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0) : (this.consecutiveNetworkFailures = Math.min(
1467
1573
  this.consecutiveNetworkFailures + 1,
@@ -1496,9 +1602,9 @@ class et extends _ {
1496
1602
  async sendWithTimeout(e, t) {
1497
1603
  const s = new AbortController();
1498
1604
  this.pendingControllers.add(s);
1499
- let n = !1;
1500
- const i = setTimeout(() => {
1501
- n = !0, s.abort();
1605
+ let i = !1;
1606
+ const n = setTimeout(() => {
1607
+ i = !0, s.abort();
1502
1608
  }, 15e3);
1503
1609
  try {
1504
1610
  const o = this.getCustomHeaders(), l = await fetch(e, {
@@ -1516,9 +1622,9 @@ class et extends _ {
1516
1622
  throw l.status >= 400 && l.status < 500 && l.status !== 408 && l.status !== 429 ? new O(`HTTP ${l.status}: ${l.statusText}`, l.status) : l.status === 429 ? new re(`HTTP 429: ${l.statusText}`) : new Error(`HTTP ${l.status}: ${l.statusText}`);
1517
1623
  return l;
1518
1624
  } catch (o) {
1519
- throw o instanceof O ? o : n ? new ne("Request timed out") : o;
1625
+ throw o instanceof O ? o : i ? new ie("Request timed out") : o;
1520
1626
  } finally {
1521
- clearTimeout(i), this.pendingControllers.delete(s);
1627
+ clearTimeout(n), this.pendingControllers.delete(s);
1522
1628
  }
1523
1629
  }
1524
1630
  /**
@@ -1545,10 +1651,10 @@ class et extends _ {
1545
1651
  const t = this.ensureBatchMetadata(e), s = this.applyBeforeSendTransformer(t);
1546
1652
  if (!s)
1547
1653
  return !0;
1548
- const n = this.applyBeforeBatchTransformer(s);
1549
- if (!n)
1654
+ const i = this.applyBeforeBatchTransformer(s);
1655
+ if (!i)
1550
1656
  return !0;
1551
- const i = this.ensureBatchMetadata(n, t._metadata?.idempotency_token), { url: o, payload: l } = this.prepareRequest(i);
1657
+ const n = this.ensureBatchMetadata(i, t._metadata?.idempotency_token), { url: o, payload: l } = this.prepareRequest(n);
1552
1658
  if (l.length > 65536)
1553
1659
  return a(
1554
1660
  "warn",
@@ -1557,7 +1663,7 @@ class et extends _ {
1557
1663
  data: {
1558
1664
  size: l.length,
1559
1665
  limit: 65536,
1560
- events: i.events.length
1666
+ events: n.events.length
1561
1667
  }
1562
1668
  }
1563
1669
  ), this.persistEvents(t), !1;
@@ -1584,7 +1690,7 @@ class et extends _ {
1584
1690
  *
1585
1691
  * **Idempotency Token**:
1586
1692
  * - Set upstream by ensureBatchMetadata() before this method is called
1587
- * - Fallback generateEventId() is defensive only (should not trigger in normal flow)
1693
+ * - Fallback computeContentToken() is defensive only (should not trigger in normal flow)
1588
1694
  * - Same token persists across all retry attempts of the same batch
1589
1695
  * - Backend uses this to deduplicate retries
1590
1696
  *
@@ -1599,7 +1705,7 @@ class et extends _ {
1599
1705
  ...e,
1600
1706
  _metadata: {
1601
1707
  ...e._metadata,
1602
- idempotency_token: e._metadata?.idempotency_token ?? ye(),
1708
+ idempotency_token: e._metadata?.idempotency_token ?? this.computeContentToken(e),
1603
1709
  referer: typeof window < "u" ? window.location.href : void 0,
1604
1710
  timestamp: t,
1605
1711
  client_version: Zt
@@ -1611,7 +1717,7 @@ class et extends _ {
1611
1717
  };
1612
1718
  }
1613
1719
  ensureBatchMetadata(e, t) {
1614
- const s = e._metadata?.idempotency_token ?? t ?? ye();
1720
+ const s = e._metadata?.idempotency_token ?? t ?? this.computeContentToken(e);
1615
1721
  return e._metadata?.idempotency_token === s ? e : {
1616
1722
  ...e,
1617
1723
  _metadata: {
@@ -1620,6 +1726,31 @@ class et extends _ {
1620
1726
  }
1621
1727
  };
1622
1728
  }
1729
+ /**
1730
+ * Deterministic 32-bit FNV-1a hash of sorted event IDs, salted with
1731
+ * `user_id` and `session_id`.
1732
+ *
1733
+ * **Purpose**: Produces the same idempotency token for the same set of events
1734
+ * across retries, so the backend's success cache catches in-session retries
1735
+ * before any MongoDB work. Replaces a random token that caused the API to
1736
+ * treat retried batches as new and emit `high_duplicate_rate` warnings.
1737
+ *
1738
+ * **Salting**: Scoping the hash by `user_id` + `session_id` ensures that
1739
+ * batches from different users/sessions cannot share a token even if their
1740
+ * event IDs hypothetically collided, eliminating cross-scope dedup risk
1741
+ * regardless of how the backend keys its success cache.
1742
+ *
1743
+ * @param body - Event queue whose events determine the token
1744
+ * @returns 8-char hex string
1745
+ * @private
1746
+ */
1747
+ computeContentToken(e) {
1748
+ const t = e.events.map((n) => n.id).sort().join(","), s = `${e.user_id}|${e.session_id}|${t}`;
1749
+ let i = 2166136261;
1750
+ for (let n = 0; n < s.length; n++)
1751
+ i ^= s.charCodeAt(n), i = Math.imul(i, 16777619) >>> 0;
1752
+ return i.toString(16).padStart(8, "0");
1753
+ }
1623
1754
  /**
1624
1755
  * Retrieves persisted events from localStorage with error recovery.
1625
1756
  *
@@ -1668,8 +1799,8 @@ class et extends _ {
1668
1799
  * @private
1669
1800
  */
1670
1801
  createRecoveryBody(e) {
1671
- const { timestamp: t, recoveryFailures: s, ...n } = e;
1672
- return n;
1802
+ const { timestamp: t, recoveryFailures: s, ...i } = e;
1803
+ return i;
1673
1804
  }
1674
1805
  /**
1675
1806
  * Persists failed events to localStorage for next-page-load recovery.
@@ -1689,7 +1820,8 @@ class et extends _ {
1689
1820
  * @private
1690
1821
  */
1691
1822
  persistEvents(e) {
1692
- return this.persistEventsWithFailureCount(e, 0);
1823
+ const t = this.getPersistedData(), s = typeof t?.recoveryFailures == "number" && Number.isFinite(t.recoveryFailures) ? t.recoveryFailures : 0;
1824
+ return this.persistEventsWithFailureCount(e, s);
1693
1825
  }
1694
1826
  /**
1695
1827
  * Persists failed events to localStorage, recording how many consecutive
@@ -1707,9 +1839,9 @@ class et extends _ {
1707
1839
  */
1708
1840
  persistEventsWithFailureCount(e, t, s = !1) {
1709
1841
  try {
1710
- const n = this.getPersistedData();
1711
- if (!s && n && n.timestamp) {
1712
- const l = Date.now() - n.timestamp;
1842
+ const i = this.getPersistedData();
1843
+ if (!s && i && i.timestamp) {
1844
+ const l = Date.now() - i.timestamp;
1713
1845
  if (l < 1e3)
1714
1846
  return a(
1715
1847
  "debug",
@@ -1719,14 +1851,14 @@ class et extends _ {
1719
1851
  }
1720
1852
  ), !0;
1721
1853
  }
1722
- const i = {
1854
+ const n = {
1723
1855
  ...e,
1724
1856
  timestamp: Date.now(),
1725
1857
  ...t > 0 && { recoveryFailures: t }
1726
1858
  }, o = this.getQueueStorageKey();
1727
- return this.storeManager.setItem(o, JSON.stringify(i)), !!this.storeManager.getItem(o);
1728
- } catch (n) {
1729
- return a("debug", `Failed to persist events${this.integrationId ? ` [${this.integrationId}]` : ""}`, { error: n }), !1;
1859
+ return this.storeManager.setItem(o, JSON.stringify(n)), !!this.storeManager.getItem(o);
1860
+ } catch (i) {
1861
+ return a("debug", `Failed to persist events${this.integrationId ? ` [${this.integrationId}]` : ""}`, { error: i }), !1;
1730
1862
  }
1731
1863
  }
1732
1864
  clearPersistedEvents() {
@@ -1751,12 +1883,12 @@ class et extends _ {
1751
1883
  }
1752
1884
  logPermanentError(e, t) {
1753
1885
  const s = Date.now();
1754
- (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= Qt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1886
+ (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= Kt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1755
1887
  data: { status: t.statusCode, message: t.message }
1756
1888
  }), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: s });
1757
1889
  }
1758
1890
  }
1759
- class ps extends _ {
1891
+ class Ss extends _ {
1760
1892
  bootTime;
1761
1893
  bootTimestamp;
1762
1894
  hasPerformanceNow;
@@ -1883,10 +2015,10 @@ class ps extends _ {
1883
2015
  * ```
1884
2016
  */
1885
2017
  validateTimestamp(e) {
1886
- const s = this.now(), n = e - s;
1887
- return n > 12e4 ? {
2018
+ const s = this.now(), i = e - s;
2019
+ return i > 12e4 ? {
1888
2020
  valid: !1,
1889
- error: `Timestamp is ${(n / 1e3 / 60).toFixed(2)} minutes in the future (max allowed: 2 minutes)`
2021
+ error: `Timestamp is ${(i / 1e3 / 60).toFixed(2)} minutes in the future (max allowed: 2 minutes)`
1890
2022
  } : { valid: !0 };
1891
2023
  }
1892
2024
  /**
@@ -1905,8 +2037,8 @@ class ps extends _ {
1905
2037
  };
1906
2038
  }
1907
2039
  }
1908
- const Ss = new Set(Object.values(u));
1909
- class Ts extends _ {
2040
+ const Ts = new Set(Object.values(u));
2041
+ class Is extends _ {
1910
2042
  dataSenders;
1911
2043
  emitter;
1912
2044
  transformers;
@@ -1944,17 +2076,17 @@ class Ts extends _ {
1944
2076
  * @param customHeadersProvider - Optional callback for dynamic headers
1945
2077
  * @param fetchCredentials - Fetch credentials mode for custom backend. @default 'include'
1946
2078
  */
1947
- constructor(e, t = null, s = {}, n = {}, i, o = "include") {
1948
- super(), this.emitter = t, this.transformers = s, this.timeManager = new ps(), this.dataSenders = [];
2079
+ constructor(e, t = null, s = {}, i = {}, n, o = "include") {
2080
+ super(), this.emitter = t, this.transformers = s, this.timeManager = new Ss(), this.dataSenders = [];
1949
2081
  const l = this.get("collectApiUrls");
1950
- l?.saas && this.dataSenders.push(new et(e, "saas", l.saas, s)), l?.custom && this.dataSenders.push(
1951
- new et(
2082
+ l?.saas && this.dataSenders.push(new Ze(e, "saas", l.saas, s)), l?.custom && this.dataSenders.push(
2083
+ new Ze(
1952
2084
  e,
1953
2085
  "custom",
1954
2086
  l.custom,
1955
2087
  s,
1956
- n,
1957
2088
  i,
2089
+ n,
1958
2090
  o
1959
2091
  )
1960
2092
  ), this.saveSessionCountsDebounced = this.debounce((c) => {
@@ -1988,10 +2120,10 @@ class Ts extends _ {
1988
2120
  async recoverPersistedEvents() {
1989
2121
  const e = this.dataSenders.map(
1990
2122
  async (t) => t.recoverPersistedEvents({
1991
- onSuccess: (s, n, i) => {
1992
- if (n && n.length > 0) {
1993
- const o = n.map((l) => l.id);
1994
- this.removeProcessedEvents(o), i && this.emitEventsQueue(i);
2123
+ onSuccess: (s, i, n) => {
2124
+ if (i && i.length > 0) {
2125
+ const o = i.map((l) => l.id);
2126
+ this.removeProcessedEvents(o), n && this.emitEventsQueue(n);
1995
2127
  }
1996
2128
  },
1997
2129
  onFailure: () => {
@@ -2064,8 +2196,8 @@ class Ts extends _ {
2064
2196
  type: e,
2065
2197
  page_url: t,
2066
2198
  from_page_url: s,
2067
- scroll_data: n,
2068
- click_data: i,
2199
+ scroll_data: i,
2200
+ click_data: n,
2069
2201
  custom_event: o,
2070
2202
  web_vitals: l,
2071
2203
  error_data: c,
@@ -2076,7 +2208,7 @@ class Ts extends _ {
2076
2208
  a("error", "Event type is required - event will be ignored");
2077
2209
  return;
2078
2210
  }
2079
- if (!Ss.has(e)) {
2211
+ if (!Ts.has(e)) {
2080
2212
  a("error", "Invalid event type - event will be ignored", {
2081
2213
  data: { type: e }
2082
2214
  });
@@ -2090,8 +2222,8 @@ class Ts extends _ {
2090
2222
  type: e,
2091
2223
  page_url: t,
2092
2224
  from_page_url: s,
2093
- scroll_data: n,
2094
- click_data: i,
2225
+ scroll_data: i,
2226
+ click_data: n,
2095
2227
  custom_event: o,
2096
2228
  web_vitals: l,
2097
2229
  error_data: c,
@@ -2101,13 +2233,13 @@ class Ts extends _ {
2101
2233
  return;
2102
2234
  }
2103
2235
  this.lastSessionId !== g && (this.lastSessionId = g, this.sessionEventCounts = this.loadSessionCounts(g));
2104
- const T = e === u.SESSION_START;
2105
- if (T && a("debug", "Processing SESSION_START event", {
2236
+ const I = e === u.SESSION_START;
2237
+ if (I && a("debug", "Processing SESSION_START event", {
2106
2238
  data: { sessionId: g }
2107
- }), !T && !this.checkRateLimit())
2239
+ }), !I && !this.checkRateLimit())
2108
2240
  return;
2109
2241
  const p = e;
2110
- if (!T) {
2242
+ if (!I) {
2111
2243
  if (this.sessionEventCounts.total >= 1e3) {
2112
2244
  a("warn", "Session event limit reached", {
2113
2245
  data: {
@@ -2138,20 +2270,20 @@ class Ts extends _ {
2138
2270
  if (!this.checkPerEventRateLimit(o.name, v))
2139
2271
  return;
2140
2272
  }
2141
- const Ue = p === u.SESSION_START, K = t || this.get("pageUrl"), x = this.buildEventPayload({
2273
+ const Ve = p === u.SESSION_START, Q = t || this.get("pageUrl"), x = this.buildEventPayload({
2142
2274
  type: p,
2143
- page_url: K,
2275
+ page_url: Q,
2144
2276
  from_page_url: s,
2145
- scroll_data: n,
2146
- click_data: i,
2277
+ scroll_data: i,
2278
+ click_data: n,
2147
2279
  custom_event: o,
2148
2280
  web_vitals: l,
2149
2281
  error_data: c,
2150
2282
  viewport_data: d,
2151
2283
  page_view: f
2152
2284
  });
2153
- if (x && !(!T && !this.shouldSample())) {
2154
- if (Ue) {
2285
+ if (x && !(!I && !this.shouldSample())) {
2286
+ if (Ve) {
2155
2287
  const v = this.get("sessionId");
2156
2288
  if (!v) {
2157
2289
  a("error", "Session start event requires sessionId - event will be ignored");
@@ -2166,7 +2298,7 @@ class Ts extends _ {
2166
2298
  this.set("hasStartSession", !0);
2167
2299
  }
2168
2300
  if (!this.isDuplicateEvent(x)) {
2169
- if (this.get("mode") === ie.QA) {
2301
+ if (this.get("mode") === ne.QA) {
2170
2302
  if (p === u.CUSTOM && o) {
2171
2303
  a("info", `Custom Event: ${o.name}`, {
2172
2304
  visibility: "qa",
@@ -2192,7 +2324,7 @@ class Ts extends _ {
2192
2324
  return;
2193
2325
  }
2194
2326
  }
2195
- if (this.addToQueue(x), !T) {
2327
+ if (this.addToQueue(x), !I) {
2196
2328
  this.sessionEventCounts.total++, this.sessionEventCounts[p] !== void 0 && this.sessionEventCounts[p]++;
2197
2329
  const v = this.get("sessionId");
2198
2330
  v && this.saveSessionCountsDebounced && this.saveSessionCountsDebounced(v);
@@ -2459,23 +2591,23 @@ class Ts extends _ {
2459
2591
  return e ? !0 : Promise.resolve(!0);
2460
2592
  if (!e && this.sendInProgress)
2461
2593
  return a("debug", "Async flush skipped: send already in progress"), Promise.resolve(!1);
2462
- const t = this.buildEventsPayload(), s = [...this.eventsQueue], n = s.map((i) => i.id);
2594
+ const t = this.buildEventsPayload(), s = [...this.eventsQueue], i = s.map((n) => n.id);
2463
2595
  if (this.dataSenders.length === 0)
2464
- return this.removeProcessedEvents(n), this.clearSendTimeout(), this.emitEventsQueue(t), e ? !0 : Promise.resolve(!0);
2596
+ return this.removeProcessedEvents(i), this.clearSendTimeout(), this.emitEventsQueue(t), e ? !0 : Promise.resolve(!0);
2465
2597
  if (e && this.sendInProgress) {
2466
- for (const i of this.dataSenders)
2467
- i.persistForRecovery(t);
2598
+ for (const n of this.dataSenders)
2599
+ n.persistForRecovery(t);
2468
2600
  return a("debug", "Sync flush deferred: async send in progress, events persisted for recovery", {
2469
- data: { eventCount: n.length }
2601
+ data: { eventCount: i.length }
2470
2602
  }), !0;
2471
2603
  }
2472
2604
  if (e) {
2473
2605
  const o = this.dataSenders.map((l) => l.sendEventsQueueSync(t)).some((l) => l);
2474
- return o ? (this.removeProcessedEvents(n), this.clearSendTimeout(), this.emitEventsQueue(t)) : (this.clearSendTimeout(), a("debug", "Sync flush complete failure, events kept in queue for retry", {
2475
- data: { eventCount: n.length }
2606
+ return o ? (this.removeProcessedEvents(i), this.clearSendTimeout(), this.emitEventsQueue(t)) : (this.clearSendTimeout(), a("debug", "Sync flush complete failure, events kept in queue for retry", {
2607
+ data: { eventCount: i.length }
2476
2608
  })), o;
2477
2609
  } else {
2478
- const i = this.dataSenders.map(
2610
+ const n = this.dataSenders.map(
2479
2611
  async (o) => o.sendEventsQueue(t, {
2480
2612
  onSuccess: () => {
2481
2613
  },
@@ -2483,9 +2615,9 @@ class Ts extends _ {
2483
2615
  }
2484
2616
  })
2485
2617
  );
2486
- return Promise.allSettled(i).then((o) => {
2618
+ return Promise.allSettled(n).then((o) => {
2487
2619
  const l = o.some((c) => this.isSuccessfulResult(c));
2488
- return l ? (this.removeProcessedEvents(n), this.clearSendTimeout(), this.emitEventsQueue(t)) : a("debug", "Async flush complete failure, events kept in queue for retry", {
2620
+ return l ? (this.removeProcessedEvents(i), this.clearSendTimeout(), this.emitEventsQueue(t)) : a("debug", "Async flush complete failure, events kept in queue for retry", {
2489
2621
  data: { eventCount: s.length }
2490
2622
  }), l;
2491
2623
  });
@@ -2500,17 +2632,17 @@ class Ts extends _ {
2500
2632
  this.emitEventsQueue(e);
2501
2633
  return;
2502
2634
  }
2503
- const t = [...this.eventsQueue], s = t.map((l) => l.id), n = this.dataSenders.map(
2635
+ const t = [...this.eventsQueue], s = t.map((l) => l.id), i = this.dataSenders.map(
2504
2636
  async (l) => l.sendEventsQueue(e, {
2505
2637
  onSuccess: () => {
2506
2638
  },
2507
2639
  onFailure: () => {
2508
2640
  }
2509
2641
  })
2510
- ), i = await Promise.allSettled(n);
2511
- if (i.some((l) => this.isSuccessfulResult(l))) {
2642
+ ), n = await Promise.allSettled(i);
2643
+ if (n.some((l) => this.isSuccessfulResult(l))) {
2512
2644
  this.consecutiveSendFailures = 0, this.removeProcessedEvents(s), this.emitEventsQueue(e);
2513
- const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
2645
+ const l = n.filter((c) => !this.isSuccessfulResult(c)).length;
2514
2646
  l > 0 && a("debug", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
2515
2647
  data: { eventCount: t.length, failedCount: l }
2516
2648
  });
@@ -2531,7 +2663,7 @@ class Ts extends _ {
2531
2663
  e.has(d) || t.push(d), e.set(d, c);
2532
2664
  }
2533
2665
  const s = t.map((c) => e.get(c)).filter((c) => !!c).sort((c, d) => c.type === u.SESSION_START && d.type !== u.SESSION_START ? -1 : d.type === u.SESSION_START && c.type !== u.SESSION_START ? 1 : c.timestamp - d.timestamp);
2534
- let n = {
2666
+ let i = {
2535
2667
  user_id: this.get("userId"),
2536
2668
  session_id: this.get("sessionId"),
2537
2669
  device: this.get("device"),
@@ -2539,25 +2671,25 @@ class Ts extends _ {
2539
2671
  ...this.get("config")?.globalMetadata && { global_metadata: this.get("config")?.globalMetadata },
2540
2672
  ...this.get("identity") && { identify: this.get("identity") }
2541
2673
  };
2542
- const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
2674
+ const n = this.get("collectApiUrls"), o = !!(n?.custom || n?.saas), l = this.transformers.beforeBatch;
2543
2675
  if (!o && l) {
2544
- const c = Et(n, l, "EventManager");
2545
- c !== null && (n = c);
2676
+ const c = gt(i, l, "EventManager");
2677
+ c !== null && (i = c);
2546
2678
  }
2547
- return n;
2679
+ return i;
2548
2680
  }
2549
2681
  buildEventPayload(e) {
2550
- const t = e.page_url ?? this.get("pageUrl"), s = this.timeManager.now(), n = this.timeManager.validateTimestamp(s);
2551
- n.valid || a("warn", "Event timestamp validation failed", {
2552
- data: { type: e.type, error: n.error }
2682
+ const t = e.page_url ?? this.get("pageUrl"), s = this.timeManager.now(), i = this.timeManager.validateTimestamp(s);
2683
+ i.valid || a("warn", "Event timestamp validation failed", {
2684
+ data: { type: e.type, error: i.error }
2553
2685
  });
2554
- const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
2686
+ const n = this.get("sessionReferrer"), o = this.get("sessionUtm");
2555
2687
  let l = {
2556
- id: ye(),
2688
+ id: ns(),
2557
2689
  type: e.type,
2558
2690
  page_url: t,
2559
2691
  timestamp: s,
2560
- ...i && { referrer: i },
2692
+ ...n && { referrer: n },
2561
2693
  ...e.from_page_url && { from_page_url: e.from_page_url },
2562
2694
  ...e.scroll_data && { scroll_data: e.scroll_data },
2563
2695
  ...e.click_data && { click_data: e.click_data },
@@ -2568,25 +2700,25 @@ class Ts extends _ {
2568
2700
  ...e.page_view && { page_view: e.page_view },
2569
2701
  ...o && { utm: o }
2570
2702
  };
2571
- const c = this.get("collectApiUrls"), d = !!c?.custom, f = !!c?.saas, g = d || f, T = d && f, p = this.transformers.beforeSend;
2572
- if (p && (!g || d && !T)) {
2573
- const K = gt(l, p, "EventManager");
2574
- if (K === null)
2703
+ const c = this.get("collectApiUrls"), d = !!c?.custom, f = !!c?.saas, g = d || f, I = d && f, p = this.transformers.beforeSend;
2704
+ if (p && (!g || d && !I)) {
2705
+ const Q = mt(l, p, "EventManager");
2706
+ if (Q === null)
2575
2707
  return null;
2576
- l = K;
2708
+ l = Q;
2577
2709
  }
2578
2710
  return l;
2579
2711
  }
2580
2712
  isDuplicateEvent(e) {
2581
- const t = Date.now(), s = this.createEventFingerprint(e), n = this.recentEventFingerprints.get(s);
2582
- return n && t - n < 1e3 ? (this.recentEventFingerprints.set(s, t), !0) : (this.recentEventFingerprints.set(s, t), this.recentEventFingerprints.size > 1500 && this.pruneOldFingerprints(), this.recentEventFingerprints.size > 3e3 && (this.recentEventFingerprints.clear(), this.recentEventFingerprints.set(s, t), a("debug", "Event fingerprint cache exceeded hard limit, cleared", {
2713
+ const t = Date.now(), s = this.createEventFingerprint(e), i = this.recentEventFingerprints.get(s);
2714
+ return i && t - i < 1e3 ? (this.recentEventFingerprints.set(s, t), !0) : (this.recentEventFingerprints.set(s, t), this.recentEventFingerprints.size > 1500 && this.pruneOldFingerprints(), this.recentEventFingerprints.size > 3e3 && (this.recentEventFingerprints.clear(), this.recentEventFingerprints.set(s, t), a("debug", "Event fingerprint cache exceeded hard limit, cleared", {
2583
2715
  data: { hardLimit: 3e3 }
2584
2716
  })), !1);
2585
2717
  }
2586
2718
  pruneOldFingerprints() {
2587
2719
  const e = Date.now(), t = 1e3 * 10;
2588
- for (const [s, n] of this.recentEventFingerprints.entries())
2589
- e - n > t && this.recentEventFingerprints.delete(s);
2720
+ for (const [s, i] of this.recentEventFingerprints.entries())
2721
+ e - i > t && this.recentEventFingerprints.delete(s);
2590
2722
  a("debug", "Pruned old event fingerprints", {
2591
2723
  data: {
2592
2724
  remaining: this.recentEventFingerprints.size,
@@ -2597,8 +2729,8 @@ class Ts extends _ {
2597
2729
  createEventFingerprint(e) {
2598
2730
  let t = `${e.type}_${e.page_url}`;
2599
2731
  if (e.click_data) {
2600
- const s = Math.round((e.click_data.x || 0) / 10) * 10, n = Math.round((e.click_data.y || 0) / 10) * 10;
2601
- t += `_click_${s}_${n}`;
2732
+ const s = Math.round((e.click_data.x || 0) / 10) * 10, i = Math.round((e.click_data.y || 0) / 10) * 10;
2733
+ t += `_click_${s}_${i}`;
2602
2734
  }
2603
2735
  return e.scroll_data && (t += `_scroll_${e.scroll_data.depth}_${e.scroll_data.direction}`), e.custom_event && (t += `_custom_${e.custom_event.name}`, e.custom_event.metadata && (t += `_${this.stableStringify(e.custom_event.metadata)}`)), e.web_vitals && (t += `_vitals_${e.web_vitals.type}`), e.error_data && (t += `_error_${e.error_data.type}_${e.error_data.message}`), t;
2604
2736
  }
@@ -2607,11 +2739,11 @@ class Ts extends _ {
2607
2739
  }
2608
2740
  /** Deterministic JSON string with sorted keys to ensure consistent fingerprints regardless of property insertion order */
2609
2741
  stableStringify(e) {
2610
- return JSON.stringify(e, (t, s) => s && typeof s == "object" && !Array.isArray(s) ? Object.keys(s).sort().reduce((n, i) => (n[i] = s[i], n), {}) : s);
2742
+ return JSON.stringify(e, (t, s) => s && typeof s == "object" && !Array.isArray(s) ? Object.keys(s).sort().reduce((i, n) => (i[n] = s[n], i), {}) : s);
2611
2743
  }
2612
2744
  addToQueue(e) {
2613
2745
  if (this.emitEvent(e), this.eventsQueue.push(e), this.eventsQueue.length > 100) {
2614
- const t = this.eventsQueue.findIndex((n) => n.type !== u.SESSION_START), s = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
2746
+ const t = this.eventsQueue.findIndex((i) => i.type !== u.SESSION_START), s = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
2615
2747
  a("warn", "Event queue overflow, oldest non-critical event removed", {
2616
2748
  data: {
2617
2749
  maxLength: 100,
@@ -2645,14 +2777,14 @@ class Ts extends _ {
2645
2777
  return e - this.rateLimitWindowStart > 1e3 && (this.rateLimitCounter = 0, this.rateLimitWindowStart = e), this.rateLimitCounter >= 50 ? !1 : (this.rateLimitCounter++, !0);
2646
2778
  }
2647
2779
  checkPerEventRateLimit(e, t) {
2648
- const s = Date.now(), i = (this.perEventRateLimits.get(e) ?? []).filter((o) => s - o < 6e4);
2649
- return i.length >= t ? (a("warn", "Per-event rate limit exceeded for custom event", {
2780
+ const s = Date.now(), n = (this.perEventRateLimits.get(e) ?? []).filter((o) => s - o < 6e4);
2781
+ return n.length >= t ? (a("warn", "Per-event rate limit exceeded for custom event", {
2650
2782
  data: {
2651
2783
  eventName: e,
2652
2784
  limit: t,
2653
2785
  window: `${6e4 / 1e3}s`
2654
2786
  }
2655
- }), !1) : (i.push(s), this.perEventRateLimits.set(e, i), !0);
2787
+ }), !1) : (n.push(s), this.perEventRateLimits.set(e, n), !0);
2656
2788
  }
2657
2789
  getTypeLimitForEvent(e) {
2658
2790
  return {
@@ -2695,9 +2827,9 @@ class Ts extends _ {
2695
2827
  */
2696
2828
  debounce(e, t) {
2697
2829
  let s = null;
2698
- return ((...n) => {
2830
+ return ((...i) => {
2699
2831
  s !== null && clearTimeout(s), s = setTimeout(() => {
2700
- e(...n), s = null;
2832
+ e(...i), s = null;
2701
2833
  }, t);
2702
2834
  });
2703
2835
  }
@@ -2747,29 +2879,29 @@ class Ts extends _ {
2747
2879
  loadSessionCounts(e) {
2748
2880
  if (typeof window > "u" || typeof localStorage > "u")
2749
2881
  return this.getInitialCounts();
2750
- const t = this.get("userId") || "anonymous", s = xe(t, e);
2882
+ const t = this.get("userId") || "anonymous", s = He(t, e);
2751
2883
  try {
2752
- const n = localStorage.getItem(s);
2753
- if (!n)
2884
+ const i = localStorage.getItem(s);
2885
+ if (!i)
2754
2886
  return this.getInitialCounts();
2755
- const i = JSON.parse(n);
2756
- return i._timestamp && Date.now() - i._timestamp > $e ? (a("debug", "Session counts expired, clearing", {
2757
- data: { sessionId: e, age: Date.now() - i._timestamp }
2758
- }), localStorage.removeItem(s), this.getInitialCounts()) : typeof i.total == "number" && typeof i[u.CLICK] == "number" && typeof i[u.PAGE_VIEW] == "number" && typeof i[u.CUSTOM] == "number" && typeof i[u.VIEWPORT_VISIBLE] == "number" && typeof i[u.SCROLL] == "number" ? {
2759
- total: i.total,
2760
- [u.CLICK]: i[u.CLICK],
2761
- [u.PAGE_VIEW]: i[u.PAGE_VIEW],
2762
- [u.CUSTOM]: i[u.CUSTOM],
2763
- [u.VIEWPORT_VISIBLE]: i[u.VIEWPORT_VISIBLE],
2764
- [u.SCROLL]: i[u.SCROLL]
2887
+ const n = JSON.parse(i);
2888
+ return n._timestamp && Date.now() - n._timestamp > xe ? (a("debug", "Session counts expired, clearing", {
2889
+ data: { sessionId: e, age: Date.now() - n._timestamp }
2890
+ }), localStorage.removeItem(s), this.getInitialCounts()) : typeof n.total == "number" && typeof n[u.CLICK] == "number" && typeof n[u.PAGE_VIEW] == "number" && typeof n[u.CUSTOM] == "number" && typeof n[u.VIEWPORT_VISIBLE] == "number" && typeof n[u.SCROLL] == "number" ? {
2891
+ total: n.total,
2892
+ [u.CLICK]: n[u.CLICK],
2893
+ [u.PAGE_VIEW]: n[u.PAGE_VIEW],
2894
+ [u.CUSTOM]: n[u.CUSTOM],
2895
+ [u.VIEWPORT_VISIBLE]: n[u.VIEWPORT_VISIBLE],
2896
+ [u.SCROLL]: n[u.SCROLL]
2765
2897
  } : (a("warn", "Invalid session counts structure in localStorage, resetting", {
2766
- data: { sessionId: e, parsed: i }
2898
+ data: { sessionId: e, parsed: n }
2767
2899
  }), localStorage.removeItem(s), a("debug", "Session counts removed due to invalid/corrupted data", {
2768
- data: { sessionId: e, parsed: i }
2900
+ data: { sessionId: e, parsed: n }
2769
2901
  }), this.getInitialCounts());
2770
- } catch (n) {
2902
+ } catch (i) {
2771
2903
  return a("warn", "Failed to load session counts from localStorage", {
2772
- error: n,
2904
+ error: i,
2773
2905
  data: { sessionId: e }
2774
2906
  }), this.getInitialCounts();
2775
2907
  }
@@ -2798,32 +2930,32 @@ class Ts extends _ {
2798
2930
  cleanupExpiredSessionCounts() {
2799
2931
  if (!(typeof window > "u" || typeof localStorage > "u"))
2800
2932
  try {
2801
- const e = localStorage.getItem(Be);
2933
+ const e = localStorage.getItem($e);
2802
2934
  if (e) {
2803
- const i = Date.now() - parseInt(e, 10);
2804
- if (i < We) {
2935
+ const n = Date.now() - parseInt(e, 10);
2936
+ if (n < Be) {
2805
2937
  a("debug", "Skipping session counts cleanup (throttled)", {
2806
- data: { timeSinceLastCleanup: i, throttleMs: We }
2938
+ data: { timeSinceLastCleanup: n, throttleMs: Be }
2807
2939
  });
2808
2940
  return;
2809
2941
  }
2810
2942
  }
2811
- const t = this.get("userId") || "anonymous", s = `${I}:${t}:session_counts:`, n = [];
2812
- for (let i = 0; i < localStorage.length; i++) {
2813
- const o = localStorage.key(i);
2943
+ const t = this.get("userId") || "anonymous", s = `${S}:${t}:session_counts:`, i = [];
2944
+ for (let n = 0; n < localStorage.length; n++) {
2945
+ const o = localStorage.key(n);
2814
2946
  if (o?.startsWith(s))
2815
2947
  try {
2816
2948
  const l = localStorage.getItem(o);
2817
2949
  if (l) {
2818
2950
  const c = JSON.parse(l);
2819
- c._timestamp && Date.now() - c._timestamp > $e && n.push(o);
2951
+ c._timestamp && Date.now() - c._timestamp > xe && i.push(o);
2820
2952
  }
2821
2953
  } catch {
2822
2954
  }
2823
2955
  }
2824
- n.forEach((i) => {
2825
- localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
2826
- }), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(Be, Date.now().toString());
2956
+ i.forEach((n) => {
2957
+ localStorage.removeItem(n), a("debug", "Cleaned up expired session counts", { data: { key: n } });
2958
+ }), i.length > 0 && a("info", `Cleaned up ${i.length} expired session counts entries`), localStorage.setItem($e, Date.now().toString());
2827
2959
  } catch (e) {
2828
2960
  a("warn", "Failed to cleanup expired session counts", { error: e });
2829
2961
  }
@@ -2857,23 +2989,23 @@ class Ts extends _ {
2857
2989
  * @internal
2858
2990
  */
2859
2991
  saveSessionCounts(e) {
2860
- const t = this.get("userId") || "anonymous", s = xe(t, e);
2992
+ const t = this.get("userId") || "anonymous", s = He(t, e);
2861
2993
  try {
2862
- const n = {
2994
+ const i = {
2863
2995
  ...this.sessionEventCounts,
2864
2996
  _timestamp: Date.now(),
2865
2997
  _version: 1
2866
2998
  };
2867
- localStorage.setItem(s, JSON.stringify(n));
2868
- } catch (n) {
2999
+ localStorage.setItem(s, JSON.stringify(i));
3000
+ } catch (i) {
2869
3001
  a("warn", "Failed to persist session counts to localStorage", {
2870
- error: n,
3002
+ error: i,
2871
3003
  data: { sessionId: e }
2872
3004
  });
2873
3005
  }
2874
3006
  }
2875
3007
  }
2876
- class Is {
3008
+ class vs {
2877
3009
  /**
2878
3010
  * Gets or creates a unique user ID.
2879
3011
  *
@@ -2894,12 +3026,12 @@ class Is {
2894
3026
  const t = e.getItem(Te);
2895
3027
  if (t)
2896
3028
  return t;
2897
- const s = ut();
3029
+ const s = dt();
2898
3030
  return e.setItem(Te, s), s;
2899
3031
  }
2900
3032
  }
2901
- const vs = /^\d{13}-[a-z0-9]{9}$/;
2902
- class _s extends _ {
3033
+ const _s = /^\d{13}-[a-z0-9]{9}$/;
3034
+ class ys extends _ {
2903
3035
  storageManager;
2904
3036
  eventManager;
2905
3037
  projectId;
@@ -2926,8 +3058,8 @@ class _s extends _ {
2926
3058
  }
2927
3059
  const e = this.getProjectId();
2928
3060
  this.broadcastChannel = new BroadcastChannel(Ot(e)), this.broadcastChannel.onmessage = (t) => {
2929
- const { action: s, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
2930
- o === e && (s === "session_start" && n && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", n), this.persistSession(n, i), this.isTracking && this.setupSessionTimeout()) : s && s !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: s } }));
3061
+ const { action: s, sessionId: i, timestamp: n, projectId: o } = t.data ?? {};
3062
+ o === e && (s === "session_start" && i && typeof n == "number" && n > Date.now() - 5e3 ? (this.set("sessionId", i), this.persistSession(i, n), this.isTracking && this.setupSessionTimeout()) : s && s !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: s } }));
2931
3063
  };
2932
3064
  }
2933
3065
  shareSession(e) {
@@ -2945,19 +3077,19 @@ class _s extends _ {
2945
3077
  const e = this.loadStoredSession();
2946
3078
  if (!e)
2947
3079
  return null;
2948
- if (!vs.test(e.id))
3080
+ if (!_s.test(e.id))
2949
3081
  return a("warn", "Invalid session ID format recovered from storage, clearing", {
2950
3082
  data: { sessionId: e.id }
2951
3083
  }), this.clearStoredSession(), null;
2952
3084
  const t = this.get("config")?.sessionTimeout ?? 9e5;
2953
3085
  return Date.now() - e.lastActivity > t ? (this.clearStoredSession(), null) : e.id;
2954
3086
  }
2955
- persistSession(e, t = Date.now(), s, n) {
3087
+ persistSession(e, t = Date.now(), s, i) {
2956
3088
  this.saveStoredSession({
2957
3089
  id: e,
2958
3090
  lastActivity: t,
2959
3091
  ...s && { referrer: s },
2960
- ...n && { utm: n }
3092
+ ...i && { utm: i }
2961
3093
  });
2962
3094
  }
2963
3095
  clearStoredSession() {
@@ -2968,18 +3100,18 @@ class _s extends _ {
2968
3100
  const e = this.getSessionStorageKey(), t = this.storageManager.getItem(e);
2969
3101
  if (t !== null)
2970
3102
  try {
2971
- const n = JSON.parse(t);
2972
- if (n.id && typeof n.lastActivity == "number")
2973
- return n;
3103
+ const i = JSON.parse(t);
3104
+ if (i.id && typeof i.lastActivity == "number")
3105
+ return i;
2974
3106
  } catch {
2975
3107
  this.storageManager.removeItem(e);
2976
3108
  }
2977
3109
  const s = this.storageManager.getSessionItem(e);
2978
3110
  if (s !== null)
2979
3111
  try {
2980
- const n = JSON.parse(s);
2981
- if (n.id && typeof n.lastActivity == "number")
2982
- return n;
3112
+ const i = JSON.parse(s);
3113
+ if (i.id && typeof i.lastActivity == "number")
3114
+ return i;
2983
3115
  } catch {
2984
3116
  this.storageManager.removeSessionItem(e);
2985
3117
  }
@@ -3053,31 +3185,31 @@ class _s extends _ {
3053
3185
  return;
3054
3186
  }
3055
3187
  const e = this.recoverSession(), t = e ?? this.generateSessionId();
3056
- let s, n;
3188
+ let s, i;
3057
3189
  if (e) {
3058
- const i = this.loadStoredSession();
3059
- s = i?.referrer ?? me(), n = i?.utm ?? ge();
3190
+ const n = this.loadStoredSession();
3191
+ s = n?.referrer ?? me(), i = n?.utm ?? ge();
3060
3192
  } else
3061
- s = me(), n = ge();
3193
+ s = me(), i = ge();
3062
3194
  a("debug", "Session tracking initialized", {
3063
3195
  data: {
3064
3196
  sessionId: t,
3065
3197
  wasRecovered: !!e,
3066
3198
  willEmitSessionStart: !e,
3067
3199
  sessionReferrer: s,
3068
- hasUtm: !!n
3200
+ hasUtm: !!i
3069
3201
  }
3070
3202
  }), this.isTracking = !0;
3071
3203
  try {
3072
- this.set("sessionId", t), this.set("sessionReferrer", s), this.set("sessionUtm", n), this.persistSession(t, Date.now(), s, n), this.initCrossTabSync(), this.shareSession(t), e ? a("debug", "Session recovered, skipping SESSION_START", {
3204
+ this.set("sessionId", t), this.set("sessionReferrer", s), this.set("sessionUtm", i), this.persistSession(t, Date.now(), s, i), this.initCrossTabSync(), this.shareSession(t), e ? a("debug", "Session recovered, skipping SESSION_START", {
3073
3205
  data: { sessionId: t }
3074
3206
  }) : (a("debug", "Emitting SESSION_START event", {
3075
3207
  data: { sessionId: t }
3076
3208
  }), this.eventManager.track({
3077
3209
  type: u.SESSION_START
3078
3210
  })), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
3079
- } catch (i) {
3080
- throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null), i;
3211
+ } catch (n) {
3212
+ throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null), n;
3081
3213
  }
3082
3214
  }
3083
3215
  generateSessionId() {
@@ -3230,7 +3362,7 @@ class _s extends _ {
3230
3362
  this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
3231
3363
  }
3232
3364
  }
3233
- class ys extends _ {
3365
+ class ws extends _ {
3234
3366
  eventManager;
3235
3367
  storageManager;
3236
3368
  sessionManager = null;
@@ -3265,7 +3397,7 @@ class ys extends _ {
3265
3397
  }
3266
3398
  const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
3267
3399
  try {
3268
- this.sessionManager = new _s(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
3400
+ this.sessionManager = new ys(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
3269
3401
  } catch (s) {
3270
3402
  if (this.sessionManager) {
3271
3403
  try {
@@ -3318,7 +3450,7 @@ class ys extends _ {
3318
3450
  this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
3319
3451
  }
3320
3452
  }
3321
- class ws extends _ {
3453
+ class bs extends _ {
3322
3454
  eventManager;
3323
3455
  onTrack;
3324
3456
  originalPushState;
@@ -3358,25 +3490,25 @@ class ws extends _ {
3358
3490
  };
3359
3491
  }
3360
3492
  trackCurrentPage = () => {
3361
- const e = window.location.href, t = we(e, this.get("config").sensitiveQueryParams);
3493
+ const e = window.location.href, t = ye(e, this.get("config").sensitiveQueryParams);
3362
3494
  if (this.get("pageUrl") === t)
3363
3495
  return;
3364
- const s = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
3365
- if (s - this.lastPageViewTime < n)
3496
+ const s = Date.now(), i = this.get("config").pageViewThrottleMs ?? 1e3;
3497
+ if (s - this.lastPageViewTime < i)
3366
3498
  return;
3367
3499
  this.lastPageViewTime = s, this.onTrack();
3368
- const i = this.get("pageUrl");
3500
+ const n = this.get("pageUrl");
3369
3501
  this.set("pageUrl", t);
3370
3502
  const o = this.extractPageViewData();
3371
3503
  this.eventManager.track({
3372
3504
  type: u.PAGE_VIEW,
3373
3505
  page_url: this.get("pageUrl"),
3374
- from_page_url: i,
3506
+ from_page_url: n,
3375
3507
  ...o && { page_view: o }
3376
3508
  });
3377
3509
  };
3378
3510
  trackInitialPageView() {
3379
- const e = we(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
3511
+ const e = ye(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
3380
3512
  this.lastPageViewTime = Date.now(), this.eventManager.track({
3381
3513
  type: u.PAGE_VIEW,
3382
3514
  page_url: e,
@@ -3384,17 +3516,17 @@ class ws extends _ {
3384
3516
  }), this.onTrack();
3385
3517
  }
3386
3518
  extractPageViewData() {
3387
- const { pathname: e, search: t, hash: s } = window.location, { referrer: n } = document, { title: i } = document;
3388
- return !n && !i && !e && !t && !s ? void 0 : {
3389
- ...n && { referrer: n },
3390
- ...i && { title: i },
3519
+ const { pathname: e, search: t, hash: s } = window.location, { referrer: i } = document, { title: n } = document;
3520
+ return !i && !n && !e && !t && !s ? void 0 : {
3521
+ ...i && { referrer: i },
3522
+ ...n && { title: n },
3391
3523
  ...e && { pathname: e },
3392
3524
  ...t && { search: t },
3393
3525
  ...s && { hash: s }
3394
3526
  };
3395
3527
  }
3396
3528
  }
3397
- class bs extends _ {
3529
+ class Ls extends _ {
3398
3530
  eventManager;
3399
3531
  lastClickTimes = /* @__PURE__ */ new Map();
3400
3532
  clickHandler;
@@ -3417,17 +3549,17 @@ class bs extends _ {
3417
3549
  */
3418
3550
  startTracking() {
3419
3551
  this.clickHandler || (this.clickHandler = (e) => {
3420
- const t = e, s = t.target, n = typeof HTMLElement < "u" && s instanceof HTMLElement ? s : typeof HTMLElement < "u" && s instanceof Node && s.parentElement instanceof HTMLElement ? s.parentElement : null;
3421
- if (!n) {
3552
+ const t = e, s = t.target, i = typeof HTMLElement < "u" && s instanceof HTMLElement ? s : typeof HTMLElement < "u" && s instanceof Node && s.parentElement instanceof HTMLElement ? s.parentElement : null;
3553
+ if (!i) {
3422
3554
  a("debug", "Click target not found or not an element");
3423
3555
  return;
3424
3556
  }
3425
- if (this.shouldIgnoreElement(n))
3557
+ if (this.shouldIgnoreElement(i))
3426
3558
  return;
3427
- const i = this.get("config")?.clickThrottleMs ?? 300;
3428
- if (i > 0 && !this.checkClickThrottle(n, i))
3559
+ const n = this.get("config")?.clickThrottleMs ?? 300;
3560
+ if (n > 0 && !this.checkClickThrottle(i, n))
3429
3561
  return;
3430
- const o = this.findTrackingElement(n), l = this.getRelevantClickElement(n), c = this.calculateClickCoordinates(t, n);
3562
+ const o = this.findTrackingElement(i), l = this.getRelevantClickElement(i), c = this.calculateClickCoordinates(t, i);
3431
3563
  if (o) {
3432
3564
  const f = this.extractTrackingData(o);
3433
3565
  if (f) {
@@ -3441,7 +3573,7 @@ class bs extends _ {
3441
3573
  });
3442
3574
  }
3443
3575
  }
3444
- const d = this.generateClickData(n, l, c);
3576
+ const d = this.generateClickData(i, l, c);
3445
3577
  this.eventManager.track({
3446
3578
  type: u.CLICK,
3447
3579
  click_data: d
@@ -3465,15 +3597,15 @@ class bs extends _ {
3465
3597
  * Returns true if the click should be tracked, false if throttled
3466
3598
  */
3467
3599
  checkClickThrottle(e, t) {
3468
- const s = this.getElementSignature(e), n = Date.now();
3469
- this.pruneThrottleCache(n);
3470
- const i = this.lastClickTimes.get(s);
3471
- return i !== void 0 && n - i < t ? (a("debug", "ClickHandler: Click suppressed by throttle", {
3600
+ const s = this.getElementSignature(e), i = Date.now();
3601
+ this.pruneThrottleCache(i);
3602
+ const n = this.lastClickTimes.get(s);
3603
+ return n !== void 0 && i - n < t ? (a("debug", "ClickHandler: Click suppressed by throttle", {
3472
3604
  data: {
3473
3605
  signature: s,
3474
- throttleRemaining: t - (n - i)
3606
+ throttleRemaining: t - (i - n)
3475
3607
  }
3476
- }), !1) : (this.lastClickTimes.set(s, n), !0);
3608
+ }), !1) : (this.lastClickTimes.set(s, i), !0);
3477
3609
  }
3478
3610
  /**
3479
3611
  * Prunes stale entries from the throttle cache to prevent memory leaks
@@ -3485,15 +3617,15 @@ class bs extends _ {
3485
3617
  return;
3486
3618
  this.lastPruneTime = e;
3487
3619
  const t = e - 3e5;
3488
- for (const [s, n] of this.lastClickTimes.entries())
3489
- n < t && this.lastClickTimes.delete(s);
3620
+ for (const [s, i] of this.lastClickTimes.entries())
3621
+ i < t && this.lastClickTimes.delete(s);
3490
3622
  if (this.lastClickTimes.size > 1e3) {
3491
- const s = Array.from(this.lastClickTimes.entries()).sort((o, l) => o[1] - l[1]), n = this.lastClickTimes.size - 1e3, i = s.slice(0, n);
3492
- for (const [o] of i)
3623
+ const s = Array.from(this.lastClickTimes.entries()).sort((o, l) => o[1] - l[1]), i = this.lastClickTimes.size - 1e3, n = s.slice(0, i);
3624
+ for (const [o] of n)
3493
3625
  this.lastClickTimes.delete(o);
3494
3626
  a("debug", "ClickHandler: Pruned throttle cache", {
3495
3627
  data: {
3496
- removed: i.length,
3628
+ removed: n.length,
3497
3629
  remaining: this.lastClickTimes.size
3498
3630
  }
3499
3631
  });
@@ -3519,12 +3651,12 @@ class bs extends _ {
3519
3651
  const t = [];
3520
3652
  let s = e;
3521
3653
  for (; s && s !== document.body; ) {
3522
- let n = s.tagName.toLowerCase();
3654
+ let i = s.tagName.toLowerCase();
3523
3655
  if (s.className) {
3524
- const i = s.className.split(" ")[0];
3525
- i && (n += `.${i}`);
3656
+ const n = s.className.split(" ")[0];
3657
+ n && (i += `.${n}`);
3526
3658
  }
3527
- t.unshift(n), s = s.parentElement;
3659
+ t.unshift(i), s = s.parentElement;
3528
3660
  }
3529
3661
  return t.join(">") || "unknown";
3530
3662
  }
@@ -3532,7 +3664,7 @@ class bs extends _ {
3532
3664
  return e.hasAttribute(`${b}-name`) ? e : e.closest(`[${b}-name]`);
3533
3665
  }
3534
3666
  getRelevantClickElement(e) {
3535
- for (const t of At)
3667
+ for (const t of bt)
3536
3668
  try {
3537
3669
  if (e.matches(t))
3538
3670
  return e;
@@ -3560,8 +3692,8 @@ class bs extends _ {
3560
3692
  return Math.max(0, Math.min(1, Number(e.toFixed(3))));
3561
3693
  }
3562
3694
  calculateClickCoordinates(e, t) {
3563
- const s = t.getBoundingClientRect(), n = e.clientX, i = e.clientY, o = s.width > 0 ? this.clamp((n - s.left) / s.width) : 0, l = s.height > 0 ? this.clamp((i - s.top) / s.height) : 0;
3564
- return { x: n, y: i, relativeX: o, relativeY: l };
3695
+ const s = t.getBoundingClientRect(), i = e.clientX, n = e.clientY, o = s.width > 0 ? this.clamp((i - s.left) / s.width) : 0, l = s.height > 0 ? this.clamp((n - s.top) / s.height) : 0;
3696
+ return { x: i, y: n, relativeX: o, relativeY: l };
3565
3697
  }
3566
3698
  extractTrackingData(e) {
3567
3699
  const t = e.getAttribute(`${b}-name`), s = e.getAttribute(`${b}-value`);
@@ -3573,10 +3705,10 @@ class bs extends _ {
3573
3705
  };
3574
3706
  }
3575
3707
  generateClickData(e, t, s) {
3576
- const { x: n, y: i, relativeX: o, relativeY: l } = s, c = this.getRelevantText(e, t), d = this.extractElementAttributes(t);
3708
+ const { x: i, y: n, relativeX: o, relativeY: l } = s, c = this.getRelevantText(e, t), d = this.extractElementAttributes(t);
3577
3709
  return {
3578
- x: n,
3579
- y: i,
3710
+ x: i,
3711
+ y: n,
3580
3712
  relativeX: o,
3581
3713
  relativeY: l,
3582
3714
  tag: t.tagName.toLowerCase(),
@@ -3612,18 +3744,18 @@ class bs extends _ {
3612
3744
  */
3613
3745
  sanitizeText(e) {
3614
3746
  let t = e;
3615
- for (const s of lt) {
3616
- const n = new RegExp(s.source, s.flags);
3617
- t = t.replace(n, "[REDACTED]");
3747
+ for (const s of at) {
3748
+ const i = new RegExp(s.source, s.flags);
3749
+ t = t.replace(i, "[REDACTED]");
3618
3750
  }
3619
3751
  return t;
3620
3752
  }
3621
3753
  getRelevantText(e, t) {
3622
- const s = e.textContent?.trim() ?? "", n = t.textContent?.trim() ?? "";
3623
- if (!s && !n)
3754
+ const s = e.textContent?.trim() ?? "", i = t.textContent?.trim() ?? "";
3755
+ if (!s && !i)
3624
3756
  return "";
3625
- let i = "";
3626
- return s && s.length <= 255 ? i = s : n.length <= 255 ? i = n : i = n.slice(0, 252) + "...", this.sanitizeText(i);
3757
+ let n = "";
3758
+ return s && s.length <= 255 ? n = s : i.length <= 255 ? n = i : n = i.slice(0, 252) + "...", this.sanitizeText(n);
3627
3759
  }
3628
3760
  extractElementAttributes(e) {
3629
3761
  const t = [
@@ -3638,9 +3770,9 @@ class bs extends _ {
3638
3770
  "alt",
3639
3771
  "role"
3640
3772
  ], s = {};
3641
- for (const n of t) {
3642
- const i = e.getAttribute(n);
3643
- i && (s[n] = i);
3773
+ for (const i of t) {
3774
+ const n = e.getAttribute(i);
3775
+ n && (s[i] = n);
3644
3776
  }
3645
3777
  return s;
3646
3778
  }
@@ -3698,8 +3830,8 @@ class As extends _ {
3698
3830
  const t = this.findScrollableElements();
3699
3831
  if (this.isWindowScrollable() && this.setupScrollContainer(window, "window"), t.length > 0) {
3700
3832
  for (const s of t) {
3701
- const n = this.getElementSelector(s);
3702
- this.setupScrollContainer(s, n);
3833
+ const i = this.getElementSelector(s);
3834
+ this.setupScrollContainer(s, i);
3703
3835
  }
3704
3836
  this.applyPrimaryScrollSelectorIfConfigured();
3705
3837
  return;
@@ -3720,18 +3852,18 @@ class As extends _ {
3720
3852
  if (!document.body)
3721
3853
  return [];
3722
3854
  const e = [], t = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, {
3723
- acceptNode: (n) => {
3724
- const i = n;
3725
- if (!i.isConnected || !i.offsetParent)
3855
+ acceptNode: (i) => {
3856
+ const n = i;
3857
+ if (!n.isConnected || !n.offsetParent)
3726
3858
  return NodeFilter.FILTER_SKIP;
3727
- const o = getComputedStyle(i);
3859
+ const o = getComputedStyle(n);
3728
3860
  return o.overflowY === "auto" || o.overflowY === "scroll" || o.overflow === "auto" || o.overflow === "scroll" ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
3729
3861
  }
3730
3862
  });
3731
3863
  let s;
3732
3864
  for (; (s = t.nextNode()) && e.length < 10; ) {
3733
- const n = s;
3734
- this.isElementScrollable(n) && e.push(n);
3865
+ const i = s;
3866
+ this.isElementScrollable(i) && e.push(i);
3735
3867
  }
3736
3868
  return e;
3737
3869
  }
@@ -3742,7 +3874,7 @@ class As extends _ {
3742
3874
  if (t.id)
3743
3875
  return `#${t.id}`;
3744
3876
  if (t.className && typeof t.className == "string") {
3745
- const s = t.className.split(" ").filter((n) => n.trim())[0];
3877
+ const s = t.className.split(" ").filter((i) => i.trim())[0];
3746
3878
  if (s)
3747
3879
  return `.${s}`;
3748
3880
  }
@@ -3754,20 +3886,20 @@ class As extends _ {
3754
3886
  setupScrollContainer(e, t) {
3755
3887
  if (this.containers.some((d) => d.element === e) || e !== window && !this.isElementScrollable(e))
3756
3888
  return;
3757
- const n = this.getScrollTop(e), i = this.calculateScrollDepth(
3758
- n,
3889
+ const i = this.getScrollTop(e), n = this.calculateScrollDepth(
3890
+ i,
3759
3891
  this.getScrollHeight(e),
3760
3892
  this.getViewportHeight(e)
3761
3893
  ), o = this.determineIfPrimary(e), l = {
3762
3894
  element: e,
3763
3895
  selector: t,
3764
3896
  isPrimary: o,
3765
- lastScrollPos: n,
3766
- lastDepth: i,
3897
+ lastScrollPos: i,
3898
+ lastDepth: n,
3767
3899
  lastDirection: Z.DOWN,
3768
3900
  lastEventTime: 0,
3769
3901
  firstScrollEventTime: null,
3770
- maxDepthReached: i,
3902
+ maxDepthReached: n,
3771
3903
  debounceTimer: null,
3772
3904
  listener: null
3773
3905
  }, c = () => {
@@ -3786,8 +3918,8 @@ class As extends _ {
3786
3918
  if (!this.shouldEmitScrollEvent(e, t, s))
3787
3919
  return;
3788
3920
  e.lastEventTime = s, e.lastDepth = t.depth, e.lastDirection = t.direction;
3789
- const n = this.get("scrollEventCount") ?? 0;
3790
- this.set("scrollEventCount", n + 1), this.eventManager.track({
3921
+ const i = this.get("scrollEventCount") ?? 0;
3922
+ this.set("scrollEventCount", i + 1), this.eventManager.track({
3791
3923
  type: u.SCROLL,
3792
3924
  scroll_data: {
3793
3925
  ...t,
@@ -3828,18 +3960,18 @@ class As extends _ {
3828
3960
  calculateScrollDepth(e, t, s) {
3829
3961
  if (t <= s)
3830
3962
  return 0;
3831
- const n = t - s;
3832
- return Math.min(100, Math.max(0, Math.floor(e / n * 100)));
3963
+ const i = t - s;
3964
+ return Math.min(100, Math.max(0, Math.floor(e / i * 100)));
3833
3965
  }
3834
3966
  calculateScrollData(e) {
3835
- const { element: t, lastScrollPos: s, lastEventTime: n } = e, i = this.getScrollTop(t), o = Date.now(), l = Math.abs(i - s);
3967
+ const { element: t, lastScrollPos: s, lastEventTime: i } = e, n = this.getScrollTop(t), o = Date.now(), l = Math.abs(n - s);
3836
3968
  if (l < 10 || t === window && !this.isWindowScrollable())
3837
3969
  return null;
3838
- const c = this.getViewportHeight(t), d = this.getScrollHeight(t), f = this.getScrollDirection(i, s), g = this.calculateScrollDepth(i, d, c);
3839
- let T;
3840
- n > 0 ? T = o - n : e.firstScrollEventTime !== null ? T = o - e.firstScrollEventTime : T = 250;
3841
- const p = Math.round(l / T * 1e3);
3842
- return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = i, {
3970
+ const c = this.getViewportHeight(t), d = this.getScrollHeight(t), f = this.getScrollDirection(n, s), g = this.calculateScrollDepth(n, d, c);
3971
+ let I;
3972
+ i > 0 ? I = o - i : e.firstScrollEventTime !== null ? I = o - e.firstScrollEventTime : I = 250;
3973
+ const p = Math.round(l / I * 1e3);
3974
+ return g > e.maxDepthReached && (e.maxDepthReached = g), e.lastScrollPos = n, {
3843
3975
  depth: g,
3844
3976
  direction: f,
3845
3977
  velocity: p,
@@ -3856,30 +3988,30 @@ class As extends _ {
3856
3988
  return e === window ? document.documentElement.scrollHeight : e.scrollHeight;
3857
3989
  }
3858
3990
  isElementScrollable(e) {
3859
- const t = getComputedStyle(e), s = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflow === "auto" || t.overflow === "scroll", n = e.scrollHeight > e.clientHeight;
3860
- return s && n;
3991
+ const t = getComputedStyle(e), s = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflow === "auto" || t.overflow === "scroll", i = e.scrollHeight > e.clientHeight;
3992
+ return s && i;
3861
3993
  }
3862
3994
  applyPrimaryScrollSelector(e) {
3863
3995
  let t;
3864
3996
  if (e === "window")
3865
3997
  t = window;
3866
3998
  else {
3867
- const n = document.querySelector(e);
3868
- if (!(n instanceof HTMLElement)) {
3999
+ const i = document.querySelector(e);
4000
+ if (!(i instanceof HTMLElement)) {
3869
4001
  a("debug", `Selector "${e}" did not match an HTMLElement`);
3870
4002
  return;
3871
4003
  }
3872
- t = n;
4004
+ t = i;
3873
4005
  }
3874
- this.containers.forEach((n) => {
3875
- this.updateContainerPrimary(n, n.element === t);
3876
- }), !this.containers.some((n) => n.element === t) && t instanceof HTMLElement && this.isElementScrollable(t) && this.setupScrollContainer(t, e);
4006
+ this.containers.forEach((i) => {
4007
+ this.updateContainerPrimary(i, i.element === t);
4008
+ }), !this.containers.some((i) => i.element === t) && t instanceof HTMLElement && this.isElementScrollable(t) && this.setupScrollContainer(t, e);
3877
4009
  }
3878
4010
  updateContainerPrimary(e, t) {
3879
4011
  e.isPrimary = t;
3880
4012
  }
3881
4013
  }
3882
- class Ls extends _ {
4014
+ class Ms extends _ {
3883
4015
  eventManager;
3884
4016
  trackedElements = /* @__PURE__ */ new Map();
3885
4017
  observer = null;
@@ -3931,8 +4063,8 @@ class Ls extends _ {
3931
4063
  let t = this.trackedElements.size;
3932
4064
  for (const s of this.config.elements)
3933
4065
  try {
3934
- const n = document.querySelectorAll(s.selector);
3935
- for (const i of Array.from(n)) {
4066
+ const i = document.querySelectorAll(s.selector);
4067
+ for (const n of Array.from(i)) {
3936
4068
  if (t >= e) {
3937
4069
  a("debug", "ViewportHandler: Maximum tracked elements reached", {
3938
4070
  data: {
@@ -3943,18 +4075,18 @@ class Ls extends _ {
3943
4075
  });
3944
4076
  return;
3945
4077
  }
3946
- i.hasAttribute(`${b}-ignore`) || this.trackedElements.has(i) || (this.trackedElements.set(i, {
3947
- element: i,
4078
+ n.hasAttribute(`${b}-ignore`) || this.trackedElements.has(n) || (this.trackedElements.set(n, {
4079
+ element: n,
3948
4080
  selector: s.selector,
3949
4081
  id: s.id,
3950
4082
  name: s.name,
3951
4083
  startTime: null,
3952
4084
  timeoutId: null,
3953
4085
  lastFiredTime: null
3954
- }), this.observer?.observe(i), t++);
4086
+ }), this.observer?.observe(n), t++);
3955
4087
  }
3956
- } catch (n) {
3957
- a("debug", `ViewportHandler: Invalid selector "${s.selector}"`, { error: n });
4088
+ } catch (i) {
4089
+ a("debug", `ViewportHandler: Invalid selector "${s.selector}"`, { error: i });
3958
4090
  }
3959
4091
  a("debug", "ViewportHandler: Elements tracked", {
3960
4092
  data: { count: t, limit: e }
@@ -3967,11 +4099,11 @@ class Ls extends _ {
3967
4099
  if (!this.config) return;
3968
4100
  const t = this.config.minDwellTime ?? 1e3;
3969
4101
  for (const s of e) {
3970
- const n = this.trackedElements.get(s.target);
3971
- n && (s.isIntersecting ? n.startTime === null && (n.startTime = performance.now(), n.timeoutId = window.setTimeout(() => {
3972
- const i = Math.round(s.intersectionRatio * 100) / 100;
3973
- this.fireViewportEvent(n, i);
3974
- }, t)) : n.startTime !== null && (n.timeoutId !== null && (window.clearTimeout(n.timeoutId), n.timeoutId = null), n.startTime = null));
4102
+ const i = this.trackedElements.get(s.target);
4103
+ i && (s.isIntersecting ? i.startTime === null && (i.startTime = performance.now(), i.timeoutId = window.setTimeout(() => {
4104
+ const n = Math.round(s.intersectionRatio * 100) / 100;
4105
+ this.fireViewportEvent(i, n);
4106
+ }, t)) : i.startTime !== null && (i.timeoutId !== null && (window.clearTimeout(i.timeoutId), i.timeoutId = null), i.startTime = null));
3975
4107
  }
3976
4108
  };
3977
4109
  /**
@@ -3982,12 +4114,12 @@ class Ls extends _ {
3982
4114
  const s = Math.round(performance.now() - e.startTime);
3983
4115
  if (e.element.hasAttribute(`${b}-ignore`))
3984
4116
  return;
3985
- const n = this.config?.cooldownPeriod ?? 6e4, i = Date.now();
3986
- if (e.lastFiredTime !== null && i - e.lastFiredTime < n) {
4117
+ const i = this.config?.cooldownPeriod ?? 6e4, n = Date.now();
4118
+ if (e.lastFiredTime !== null && n - e.lastFiredTime < i) {
3987
4119
  a("debug", "ViewportHandler: Event suppressed by cooldown period", {
3988
4120
  data: {
3989
4121
  selector: e.selector,
3990
- cooldownRemaining: n - (i - e.lastFiredTime)
4122
+ cooldownRemaining: i - (n - e.lastFiredTime)
3991
4123
  }
3992
4124
  }), e.startTime = null, e.timeoutId = null;
3993
4125
  return;
@@ -4002,7 +4134,7 @@ class Ls extends _ {
4002
4134
  this.eventManager.track({
4003
4135
  type: u.VIEWPORT_VISIBLE,
4004
4136
  viewport_data: o
4005
- }), e.startTime = null, e.timeoutId = null, e.lastFiredTime = i;
4137
+ }), e.startTime = null, e.timeoutId = null, e.lastFiredTime = n;
4006
4138
  }
4007
4139
  /**
4008
4140
  * Sets up MutationObserver to detect dynamically added elements
@@ -4032,16 +4164,16 @@ class Ls extends _ {
4032
4164
  cleanupRemovedNodes(e) {
4033
4165
  e.forEach((t) => {
4034
4166
  if (t.nodeType !== 1) return;
4035
- const s = t, n = this.trackedElements.get(s);
4036
- n && (n.timeoutId !== null && window.clearTimeout(n.timeoutId), this.observer?.unobserve(s), this.trackedElements.delete(s)), Array.from(this.trackedElements.keys()).filter((o) => s.contains(o)).forEach((o) => {
4167
+ const s = t, i = this.trackedElements.get(s);
4168
+ i && (i.timeoutId !== null && window.clearTimeout(i.timeoutId), this.observer?.unobserve(s), this.trackedElements.delete(s)), Array.from(this.trackedElements.keys()).filter((o) => s.contains(o)).forEach((o) => {
4037
4169
  const l = this.trackedElements.get(o);
4038
4170
  l && l.timeoutId !== null && window.clearTimeout(l.timeoutId), this.observer?.unobserve(o), this.trackedElements.delete(o);
4039
4171
  });
4040
4172
  });
4041
4173
  }
4042
4174
  }
4043
- const Ms = "tracelog_session_id";
4044
- class Cs extends _ {
4175
+ const Cs = "tracelog_session_id";
4176
+ class Rs extends _ {
4045
4177
  visibilityHandler = null;
4046
4178
  lastSyncedSessionId = null;
4047
4179
  activate() {
@@ -4063,7 +4195,7 @@ class Cs extends _ {
4063
4195
  fetch("/cart/update.js", {
4064
4196
  method: "POST",
4065
4197
  headers: { "Content-Type": "application/json" },
4066
- body: JSON.stringify({ attributes: { [Ms]: e } }),
4198
+ body: JSON.stringify({ attributes: { [Cs]: e } }),
4067
4199
  credentials: "same-origin"
4068
4200
  }).then((t) => {
4069
4201
  t.ok || (this.lastSyncedSessionId = null, a("debug", "Shopify cart attribute update failed", { data: { status: t.status } }));
@@ -4083,7 +4215,7 @@ class Cs extends _ {
4083
4215
  this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null);
4084
4216
  }
4085
4217
  }
4086
- class Rs {
4218
+ class Ns {
4087
4219
  storage;
4088
4220
  sessionStorageRef;
4089
4221
  fallbackStorage = /* @__PURE__ */ new Map();
@@ -4252,19 +4384,19 @@ class Rs {
4252
4384
  return !1;
4253
4385
  try {
4254
4386
  const e = [], t = [];
4255
- for (let i = 0; i < this.storage.length; i++) {
4256
- const o = this.storage.key(i);
4387
+ for (let n = 0; n < this.storage.length; n++) {
4388
+ const o = this.storage.key(n);
4257
4389
  o?.startsWith("tracelog_") && (e.push(o), o.startsWith("tracelog_persisted_events_") && t.push(o));
4258
4390
  }
4259
4391
  if (t.length > 0)
4260
- return t.forEach((i) => {
4392
+ return t.forEach((n) => {
4261
4393
  try {
4262
- this.storage.removeItem(i);
4394
+ this.storage.removeItem(n);
4263
4395
  } catch {
4264
4396
  }
4265
4397
  }), !0;
4266
- const s = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], n = e.filter((i) => !s.some((o) => i.startsWith(o)));
4267
- return n.length > 0 ? (n.slice(0, 5).forEach((o) => {
4398
+ const s = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], i = e.filter((n) => !s.some((o) => n.startsWith(o)));
4399
+ return i.length > 0 ? (i.slice(0, 5).forEach((o) => {
4268
4400
  try {
4269
4401
  this.storage.removeItem(o);
4270
4402
  } catch {
@@ -4366,7 +4498,7 @@ class Rs {
4366
4498
  this.fallbackSessionStorage.delete(e);
4367
4499
  }
4368
4500
  }
4369
- class Ns extends _ {
4501
+ class Os extends _ {
4370
4502
  eventManager;
4371
4503
  reportedByNav = /* @__PURE__ */ new Map();
4372
4504
  navigationHistory = [];
@@ -4377,7 +4509,7 @@ class Ns extends _ {
4377
4509
  navigationCounter = 0;
4378
4510
  // Counter for handling simultaneous navigations edge case
4379
4511
  constructor(e) {
4380
- super(), this.eventManager = e, this.vitalThresholds = Ye(_e);
4512
+ super(), this.eventManager = e, this.vitalThresholds = Qe(_e);
4381
4513
  }
4382
4514
  /**
4383
4515
  * Starts tracking Web Vitals and performance metrics.
@@ -4395,7 +4527,7 @@ class Ns extends _ {
4395
4527
  */
4396
4528
  async startTracking() {
4397
4529
  const e = this.get("config"), t = e?.webVitalsMode ?? _e;
4398
- this.vitalThresholds = Ye(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
4530
+ this.vitalThresholds = Qe(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
4399
4531
  }
4400
4532
  /**
4401
4533
  * Stops tracking Web Vitals and cleans up resources.
@@ -4419,8 +4551,8 @@ class Ns extends _ {
4419
4551
  this.reportTTFB(), this.safeObserve(
4420
4552
  "largest-contentful-paint",
4421
4553
  (s) => {
4422
- const n = s.getEntries(), i = n[n.length - 1];
4423
- i && this.sendVital({ type: "LCP", value: Number(i.startTime.toFixed(2)) });
4554
+ const i = s.getEntries(), n = i[i.length - 1];
4555
+ n && this.sendVital({ type: "LCP", value: Number(n.startTime.toFixed(2)) });
4424
4556
  },
4425
4557
  { type: "largest-contentful-paint", buffered: !0 },
4426
4558
  !0
@@ -4429,10 +4561,10 @@ class Ns extends _ {
4429
4561
  this.safeObserve(
4430
4562
  "layout-shift",
4431
4563
  (s) => {
4432
- const n = this.getNavigationId();
4433
- n !== t && (e = 0, t = n);
4434
- const i = s.getEntries();
4435
- for (const o of i) {
4564
+ const i = this.getNavigationId();
4565
+ i !== t && (e = 0, t = i);
4566
+ const n = s.getEntries();
4567
+ for (const o of n) {
4436
4568
  if (o.hadRecentInput === !0)
4437
4569
  continue;
4438
4570
  const l = typeof o.value == "number" ? o.value : 0;
@@ -4444,32 +4576,32 @@ class Ns extends _ {
4444
4576
  ), this.safeObserve(
4445
4577
  "paint",
4446
4578
  (s) => {
4447
- for (const n of s.getEntries())
4448
- n.name === "first-contentful-paint" && this.sendVital({ type: "FCP", value: Number(n.startTime.toFixed(2)) });
4579
+ for (const i of s.getEntries())
4580
+ i.name === "first-contentful-paint" && this.sendVital({ type: "FCP", value: Number(i.startTime.toFixed(2)) });
4449
4581
  },
4450
4582
  { type: "paint", buffered: !0 },
4451
4583
  !0
4452
4584
  ), this.safeObserve(
4453
4585
  "event",
4454
4586
  (s) => {
4455
- let n = 0;
4456
- const i = s.getEntries();
4457
- for (const o of i) {
4587
+ let i = 0;
4588
+ const n = s.getEntries();
4589
+ for (const o of n) {
4458
4590
  const l = (o.processingEnd ?? 0) - (o.startTime ?? 0);
4459
- n = Math.max(n, l);
4591
+ i = Math.max(i, l);
4460
4592
  }
4461
- n > 0 && this.sendVital({ type: "INP", value: Number(n.toFixed(2)) });
4593
+ i > 0 && this.sendVital({ type: "INP", value: Number(i.toFixed(2)) });
4462
4594
  },
4463
4595
  { type: "event", buffered: !0 }
4464
4596
  );
4465
4597
  }
4466
4598
  async initWebVitals() {
4467
4599
  try {
4468
- const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() => cr), o = (l) => (c) => {
4600
+ const { onLCP: e, onCLS: t, onFCP: s, onTTFB: i, onINP: n } = await Promise.resolve().then(() => dr), o = (l) => (c) => {
4469
4601
  const d = Number(c.value.toFixed(2));
4470
4602
  this.sendVital({ type: l, value: d });
4471
4603
  };
4472
- e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), s(o("FCP"), { reportAllChanges: !1 }), n(o("TTFB"), { reportAllChanges: !1 }), i(o("INP"), { reportAllChanges: !1 });
4604
+ e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), s(o("FCP"), { reportAllChanges: !1 }), i(o("TTFB"), { reportAllChanges: !1 }), n(o("INP"), { reportAllChanges: !1 });
4473
4605
  } catch (e) {
4474
4606
  a("debug", "Failed to load web-vitals library, using fallback", { error: e }), this.observeWebVitalsFallback();
4475
4607
  }
@@ -4491,8 +4623,8 @@ class Ns extends _ {
4491
4623
  (e) => {
4492
4624
  const t = e.getEntries();
4493
4625
  for (const s of t) {
4494
- const n = Number(s.duration.toFixed(2)), i = Date.now();
4495
- i - this.lastLongTaskSentAt >= Yt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
4626
+ const i = Number(s.duration.toFixed(2)), n = Date.now();
4627
+ n - this.lastLongTaskSentAt >= Yt && (this.shouldSendVital("LONG_TASK", i) && this.trackWebVital("LONG_TASK", i), this.lastLongTaskSentAt = n);
4496
4628
  }
4497
4629
  },
4498
4630
  { type: "longtask", buffered: !0 }
@@ -4509,8 +4641,8 @@ class Ns extends _ {
4509
4641
  if (s)
4510
4642
  s.add(e.type);
4511
4643
  else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > qt) {
4512
- const i = this.navigationHistory.shift();
4513
- i && this.reportedByNav.delete(i);
4644
+ const n = this.navigationHistory.shift();
4645
+ n && this.reportedByNav.delete(n);
4514
4646
  }
4515
4647
  }
4516
4648
  this.trackWebVital(e.type, e.value);
@@ -4554,8 +4686,8 @@ class Ns extends _ {
4554
4686
  const e = performance.getEntriesByType("navigation")[0];
4555
4687
  if (!e)
4556
4688
  return null;
4557
- const t = e.startTime || performance.now(), s = ++this.navigationCounter, n = `${t.toFixed(2)}_${window.location.pathname}`;
4558
- return s > 1 ? `${n}_${s}` : n;
4689
+ const t = e.startTime || performance.now(), s = ++this.navigationCounter, i = `${t.toFixed(2)}_${window.location.pathname}`;
4690
+ return s > 1 ? `${i}_${s}` : i;
4559
4691
  } catch (e) {
4560
4692
  return a("debug", "Failed to get navigation ID", { error: e }), null;
4561
4693
  }
@@ -4565,11 +4697,11 @@ class Ns extends _ {
4565
4697
  const t = PerformanceObserver.supportedEntryTypes;
4566
4698
  return !t || t.includes(e);
4567
4699
  }
4568
- safeObserve(e, t, s, n = !1) {
4700
+ safeObserve(e, t, s, i = !1) {
4569
4701
  try {
4570
4702
  if (!this.isObserverSupported(e))
4571
4703
  return !1;
4572
- const i = new PerformanceObserver((o, l) => {
4704
+ const n = new PerformanceObserver((o, l) => {
4573
4705
  try {
4574
4706
  t(o, l);
4575
4707
  } catch (c) {
@@ -4578,16 +4710,16 @@ class Ns extends _ {
4578
4710
  data: { type: e }
4579
4711
  });
4580
4712
  }
4581
- if (n)
4713
+ if (i)
4582
4714
  try {
4583
4715
  l.disconnect();
4584
4716
  } catch {
4585
4717
  }
4586
4718
  });
4587
- return i.observe(s ?? { type: e, buffered: !0 }), n || this.observers.push(i), !0;
4588
- } catch (i) {
4719
+ return n.observe(s ?? { type: e, buffered: !0 }), i || this.observers.push(n), !0;
4720
+ } catch (n) {
4589
4721
  return a("debug", "Failed to create performance observer", {
4590
- error: i,
4722
+ error: n,
4591
4723
  data: { type: e }
4592
4724
  }), !1;
4593
4725
  }
@@ -4636,13 +4768,13 @@ class ae extends _ {
4636
4768
  if (e < this.burstBackoffUntil)
4637
4769
  return !1;
4638
4770
  if (e - this.burstWindowStart > jt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > zt)
4639
- return this.burstBackoffUntil = e + Qe, a("debug", "Error burst detected - entering cooldown", {
4771
+ return this.burstBackoffUntil = e + ze, a("debug", "Error burst detected - entering cooldown", {
4640
4772
  data: {
4641
4773
  errorsInWindow: this.errorBurstCounter,
4642
- cooldownMs: Qe
4774
+ cooldownMs: ze
4643
4775
  }
4644
4776
  }), !1;
4645
- const s = this.get("config").errorSampling ?? ct;
4777
+ const s = this.get("config").errorSampling ?? lt;
4646
4778
  return Math.random() < s;
4647
4779
  }
4648
4780
  handleError = (e) => {
@@ -4670,13 +4802,13 @@ class ae extends _ {
4670
4802
  const t = this.extractRejectionMessage(e.reason), s = this.sanitize(t);
4671
4803
  if (this.shouldSuppressError(B.PROMISE_REJECTION, s))
4672
4804
  return;
4673
- const n = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0;
4805
+ const i = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0;
4674
4806
  this.eventManager.track({
4675
4807
  type: u.ERROR,
4676
4808
  error_data: {
4677
4809
  type: B.PROMISE_REJECTION,
4678
4810
  message: s,
4679
- ...n !== void 0 && { stack: n }
4811
+ ...i !== void 0 && { stack: i }
4680
4812
  }
4681
4813
  });
4682
4814
  };
@@ -4694,46 +4826,46 @@ class ae extends _ {
4694
4826
  }
4695
4827
  }
4696
4828
  sanitize(e) {
4697
- const t = e.length > Ge ? e.slice(0, Ge) + "..." : e;
4829
+ const t = e.length > Xe ? e.slice(0, Xe) + "..." : e;
4698
4830
  return this.sanitizePii(t);
4699
4831
  }
4700
4832
  sanitizePii(e) {
4701
4833
  let t = e;
4702
- for (const s of lt) {
4703
- const n = new RegExp(s.source, s.flags);
4704
- t = t.replace(n, "[REDACTED]");
4834
+ for (const s of at) {
4835
+ const i = new RegExp(s.source, s.flags);
4836
+ t = t.replace(i, "[REDACTED]");
4705
4837
  }
4706
4838
  return t;
4707
4839
  }
4708
4840
  shouldSuppressError(e, t) {
4709
- const s = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
4710
- return i !== void 0 && s - i < ze ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > Gt ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > ee && this.pruneOldErrors(), !1));
4841
+ const s = Date.now(), i = `${e}:${t}`, n = this.recentErrors.get(i);
4842
+ return n !== void 0 && s - n < je ? (this.recentErrors.set(i, s), !0) : (this.recentErrors.set(i, s), this.recentErrors.size > Gt ? (this.recentErrors.clear(), this.recentErrors.set(i, s), !1) : (this.recentErrors.size > ee && this.pruneOldErrors(), !1));
4711
4843
  }
4712
4844
  static TRUNCATION_SUFFIX = `
4713
4845
  ...truncated`;
4714
4846
  truncateStack(e) {
4715
- if (e.length <= je) return this.sanitizePii(e);
4716
- const t = je - ae.TRUNCATION_SUFFIX.length, s = e.slice(0, t) + ae.TRUNCATION_SUFFIX;
4847
+ if (e.length <= Ge) return this.sanitizePii(e);
4848
+ const t = Ge - ae.TRUNCATION_SUFFIX.length, s = e.slice(0, t) + ae.TRUNCATION_SUFFIX;
4717
4849
  return this.sanitizePii(s);
4718
4850
  }
4719
4851
  pruneOldErrors() {
4720
4852
  const e = Date.now();
4721
- for (const [n, i] of this.recentErrors.entries())
4722
- e - i > ze && this.recentErrors.delete(n);
4853
+ for (const [i, n] of this.recentErrors.entries())
4854
+ e - n > je && this.recentErrors.delete(i);
4723
4855
  if (this.recentErrors.size <= ee)
4724
4856
  return;
4725
- const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), s = this.recentErrors.size - ee;
4726
- for (let n = 0; n < s; n += 1) {
4727
- const i = t[n];
4728
- i && this.recentErrors.delete(i[0]);
4857
+ const t = Array.from(this.recentErrors.entries()).sort((i, n) => i[1] - n[1]), s = this.recentErrors.size - ee;
4858
+ for (let i = 0; i < s; i += 1) {
4859
+ const n = t[i];
4860
+ n && this.recentErrors.delete(n[0]);
4729
4861
  }
4730
4862
  }
4731
4863
  }
4732
- class Os extends _ {
4864
+ class Ps extends _ {
4733
4865
  isInitialized = !1;
4734
4866
  suppressNextScrollTimer = null;
4735
4867
  pageUnloadHandler = null;
4736
- emitter = new gs();
4868
+ emitter = new Es();
4737
4869
  transformers = {};
4738
4870
  customHeadersProvider;
4739
4871
  managers = {};
@@ -4752,19 +4884,19 @@ class Os extends _ {
4752
4884
  async init(e = {}) {
4753
4885
  if (this.isInitialized)
4754
4886
  return { sessionId: this.get("sessionId") ?? "" };
4755
- this.managers.storage = new Rs();
4887
+ this.managers.storage = new Ns();
4756
4888
  try {
4757
4889
  this.setupState(e);
4758
4890
  const t = e.integrations?.custom?.headers ?? {}, s = e.integrations?.custom?.fetchCredentials ?? "include";
4759
- return this.managers.event = new Ts(
4891
+ return this.managers.event = new Is(
4760
4892
  this.managers.storage,
4761
4893
  this.emitter,
4762
4894
  this.transformers,
4763
4895
  t,
4764
4896
  this.customHeadersProvider,
4765
4897
  s
4766
- ), this.loadPersistedIdentity(), this.initializeHandlers(), this.setupPageLifecycleListeners(), await this.managers.event.recoverPersistedEvents().catch((n) => {
4767
- a("warn", "Failed to recover persisted events", { error: n });
4898
+ ), this.loadPersistedIdentity(), this.initializeHandlers(), this.setupPageLifecycleListeners(), await this.managers.event.recoverPersistedEvents().catch((i) => {
4899
+ a("warn", "Failed to recover persisted events", { error: i });
4768
4900
  }), this.isInitialized = !0, { sessionId: this.get("sessionId") ?? "" };
4769
4901
  } catch (t) {
4770
4902
  this.destroy(!0);
@@ -4786,11 +4918,11 @@ class Os extends _ {
4786
4918
  }
4787
4919
  let s = t;
4788
4920
  t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (s = Object.assign({}, t));
4789
- const { valid: n, error: i, sanitizedMetadata: o } = ms(e, s);
4790
- if (!n) {
4791
- if (this.get("mode") === ie.QA)
4792
- throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
4793
- a("warn", `Custom event "${e}" dropped: ${i}`);
4921
+ const { valid: i, error: n, sanitizedMetadata: o } = gs(e, s);
4922
+ if (!i) {
4923
+ if (this.get("mode") === ne.QA)
4924
+ throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${n}`);
4925
+ a("warn", `Custom event "${e}" dropped: ${n}`);
4794
4926
  return;
4795
4927
  }
4796
4928
  this.managers.event.track({
@@ -4856,14 +4988,14 @@ class Os extends _ {
4856
4988
  }
4857
4989
  setupState(e = {}) {
4858
4990
  this.set("config", e);
4859
- const t = Is.getId(this.managers.storage);
4991
+ const t = vs.getId(this.managers.storage);
4860
4992
  this.set("userId", t);
4861
- const s = os(e);
4993
+ const s = as(e);
4862
4994
  this.set("collectApiUrls", s);
4863
- const n = Xt();
4864
- this.set("device", n);
4865
- const i = we(window.location.href, e.sensitiveQueryParams);
4866
- this.set("pageUrl", i), ts() && this.set("mode", ie.QA);
4995
+ const i = Xt();
4996
+ this.set("device", i);
4997
+ const n = ye(window.location.href, e.sensitiveQueryParams);
4998
+ this.set("pageUrl", n), ts() && this.set("mode", ne.QA);
4867
4999
  }
4868
5000
  /**
4869
5001
  * Returns the current configuration object.
@@ -4914,7 +5046,7 @@ class Os extends _ {
4914
5046
  valid: !1,
4915
5047
  error: "Global metadata must be a plain object"
4916
5048
  };
4917
- const t = mt("Global", e, "globalMetadata");
5049
+ const t = ft("Global", e, "globalMetadata");
4918
5050
  return t.valid ? { valid: !0 } : {
4919
5051
  valid: !1,
4920
5052
  error: t.error
@@ -4931,11 +5063,11 @@ class Os extends _ {
4931
5063
  const t = this.validateGlobalMetadata(e);
4932
5064
  if (!t.valid)
4933
5065
  throw new Error(`[TraceLog] Invalid global metadata: ${t.error}`);
4934
- const n = {
5066
+ const i = {
4935
5067
  ...this.get("config"),
4936
5068
  globalMetadata: e
4937
5069
  };
4938
- this.set("config", n), a("debug", "Global metadata updated (replaced)", { data: { keys: Object.keys(e) } });
5070
+ this.set("config", i), a("debug", "Global metadata updated (replaced)", { data: { keys: Object.keys(e) } });
4939
5071
  }
4940
5072
  /**
4941
5073
  * Merges new metadata with existing global metadata.
@@ -4948,12 +5080,12 @@ class Os extends _ {
4948
5080
  const t = this.validateGlobalMetadata(e);
4949
5081
  if (!t.valid)
4950
5082
  throw new Error(`[TraceLog] Invalid global metadata: ${t.error}`);
4951
- const s = this.get("config"), i = {
5083
+ const s = this.get("config"), n = {
4952
5084
  ...s.globalMetadata ?? {},
4953
5085
  ...e
4954
5086
  }, o = {
4955
5087
  ...s,
4956
- globalMetadata: i
5088
+ globalMetadata: n
4957
5089
  };
4958
5090
  this.set("config", o), a("debug", "Global metadata updated (merged)", { data: { keys: Object.keys(e) } });
4959
5091
  }
@@ -4981,12 +5113,12 @@ class Os extends _ {
4981
5113
  a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
4982
5114
  return;
4983
5115
  }
4984
- const s = e.trim(), n = ft(t), i = {
5116
+ const s = e.trim(), i = ht(t), n = {
4985
5117
  userId: s,
4986
- ...n ? { traits: n } : {}
5118
+ ...i ? { traits: i } : {}
4987
5119
  };
4988
- this.set("identity", i), this.persistIdentity(i), a("debug", "Visitor identified", {
4989
- data: { userIdLength: s.length, traitKeys: n ? Object.keys(n) : [] }
5120
+ this.set("identity", n), this.persistIdentity(n), a("debug", "Visitor identified", {
5121
+ data: { userIdLength: s.length, traitKeys: i ? Object.keys(i) : [] }
4990
5122
  });
4991
5123
  }
4992
5124
  /**
@@ -5000,7 +5132,7 @@ class Os extends _ {
5000
5132
  */
5001
5133
  async resetIdentity() {
5002
5134
  await this.managers.event?.flushImmediately(), this.set("identity", void 0), this.clearPersistedIdentity();
5003
- const e = ut();
5135
+ const e = dt();
5004
5136
  this.managers.storage.setItem(Te, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
5005
5137
  }
5006
5138
  /**
@@ -5028,14 +5160,14 @@ class Os extends _ {
5028
5160
  loadPersistedIdentity() {
5029
5161
  const e = this.managers.storage, t = this.getProjectId(), s = fe(t);
5030
5162
  try {
5031
- const n = e.getItem(U);
5032
- if (n) {
5033
- const i = JSON.parse(n);
5034
- if (e.removeItem(U), !this.isValidIdentityData(i)) {
5163
+ const i = e.getItem(U);
5164
+ if (i) {
5165
+ const n = JSON.parse(i);
5166
+ if (e.removeItem(U), !this.isValidIdentityData(n)) {
5035
5167
  a("debug", "Invalid pending identity in localStorage, discarded");
5036
5168
  return;
5037
5169
  }
5038
- const o = { ...i, userId: i.userId.trim() };
5170
+ const o = { ...n, userId: n.userId.trim() };
5039
5171
  e.setItem(s, JSON.stringify(o)), this.set("identity", o), a("debug", "Migrated pending identity to project-scoped key");
5040
5172
  return;
5041
5173
  }
@@ -5043,14 +5175,14 @@ class Os extends _ {
5043
5175
  e.removeItem(U);
5044
5176
  }
5045
5177
  try {
5046
- const n = e.getItem(s);
5047
- if (n) {
5048
- const i = JSON.parse(n);
5049
- if (!this.isValidIdentityData(i)) {
5178
+ const i = e.getItem(s);
5179
+ if (i) {
5180
+ const n = JSON.parse(i);
5181
+ if (!this.isValidIdentityData(n)) {
5050
5182
  e.removeItem(s), a("debug", "Invalid persisted identity in localStorage, discarded");
5051
5183
  return;
5052
5184
  }
5053
- const o = { ...i, userId: i.userId.trim() };
5185
+ const o = { ...n, userId: n.userId.trim() };
5054
5186
  this.set("identity", o), a("debug", "Loaded persisted identity");
5055
5187
  }
5056
5188
  } catch {
@@ -5067,8 +5199,8 @@ class Os extends _ {
5067
5199
  if (typeof t != "string" || t.trim().length === 0 || t.trim().length > 256) return !1;
5068
5200
  if (s !== void 0) {
5069
5201
  if (typeof s != "object" || s === null || Array.isArray(s)) return !1;
5070
- for (const n of Object.values(s))
5071
- if (typeof n != "string") return !1;
5202
+ for (const i of Object.values(s))
5203
+ if (typeof i != "string") return !1;
5072
5204
  }
5073
5205
  return !0;
5074
5206
  }
@@ -5090,7 +5222,7 @@ class Os extends _ {
5090
5222
  }
5091
5223
  initializeHandlers() {
5092
5224
  const e = this.get("config");
5093
- this.handlers.session = new ys(
5225
+ this.handlers.session = new ws(
5094
5226
  this.managers.storage,
5095
5227
  this.managers.event
5096
5228
  ), this.handlers.session.startTracking();
@@ -5099,38 +5231,38 @@ class Os extends _ {
5099
5231
  this.set("suppressNextScroll", !1);
5100
5232
  }, 500);
5101
5233
  };
5102
- if (this.handlers.pageView = new ws(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new bs(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new As(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new Ns(this.managers.event), this.handlers.performance.startTracking().catch((s) => {
5234
+ if (this.handlers.pageView = new bs(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new Ls(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new As(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new Os(this.managers.event), this.handlers.performance.startTracking().catch((s) => {
5103
5235
  a("warn", "Failed to start performance tracking", { error: s });
5104
- }), this.handlers.error = new ae(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new Ls(this.managers.event), this.handlers.viewport.startTracking()), e.integrations?.tracelog?.shopify) {
5105
- const s = new Cs();
5106
- s.activate(), this.integrationInstances.shopifyCartLinker = s, this.emitter.on(se.EVENT, (n) => {
5107
- n.type === u.SESSION_START && s.onSessionChange();
5236
+ }), this.handlers.error = new ae(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new Ms(this.managers.event), this.handlers.viewport.startTracking()), e.integrations?.tracelog?.shopify) {
5237
+ const s = new Rs();
5238
+ s.activate(), this.integrationInstances.shopifyCartLinker = s, this.emitter.on(se.EVENT, (i) => {
5239
+ i.type === u.SESSION_START && s.onSessionChange();
5108
5240
  });
5109
5241
  }
5110
5242
  }
5111
5243
  }
5112
5244
  const k = [], M = [];
5113
- let D = null, h = null, R = !1, S = !1, P = null;
5114
- const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (S = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : h ? { sessionId: h.getSessionId() ?? "" } : (R && P || (R = !0, P = (async () => {
5245
+ let D = null, h = null, R = !1, T = !1, P = null;
5246
+ const Ds = async (r) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (T = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : h ? { sessionId: h.getSessionId() ?? "" } : (R && P || (R = !0, P = (async () => {
5115
5247
  try {
5116
- const e = us(r ?? {}), t = new Os();
5248
+ const e = hs(r ?? {}), t = new Ps();
5117
5249
  try {
5118
5250
  k.forEach(({ event: o, callback: l }) => {
5119
5251
  t.on(o, l);
5120
5252
  }), k.length = 0, M.forEach(({ hook: o, fn: l }) => {
5121
5253
  o === "beforeSend" ? t.setTransformer("beforeSend", l) : t.setTransformer("beforeBatch", l);
5122
5254
  }), M.length = 0, D && (t.setCustomHeaders(D), D = null);
5123
- const s = t.init(e), n = new Promise((o, l) => {
5255
+ const s = t.init(e), i = new Promise((o, l) => {
5124
5256
  setTimeout(() => {
5125
5257
  l(new Error("[TraceLog] Initialization timeout after 10000ms"));
5126
5258
  }, 1e4);
5127
- }), i = await Promise.race([s, n]);
5128
- return h = t, i;
5259
+ }), n = await Promise.race([s, i]);
5260
+ return h = t, n;
5129
5261
  } catch (s) {
5130
5262
  try {
5131
5263
  t.destroy(!0);
5132
- } catch (n) {
5133
- a("error", "Failed to cleanup partially initialized app", { error: n });
5264
+ } catch (i) {
5265
+ a("error", "Failed to cleanup partially initialized app", { error: i });
5134
5266
  }
5135
5267
  throw s;
5136
5268
  }
@@ -5139,15 +5271,15 @@ const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { session
5139
5271
  } finally {
5140
5272
  R = !1, P = null;
5141
5273
  }
5142
- })()), P)), Ds = (r, e) => {
5274
+ })()), P)), ks = (r, e) => {
5143
5275
  if (!(typeof window > "u" || typeof document > "u")) {
5144
5276
  if (!h)
5145
5277
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
5146
- if (S)
5278
+ if (T)
5147
5279
  throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
5148
5280
  h.sendCustomEvent(r, e);
5149
5281
  }
5150
- }, ks = (r, e) => {
5282
+ }, Vs = (r, e) => {
5151
5283
  if (!(typeof window > "u" || typeof document > "u")) {
5152
5284
  if (!h || R) {
5153
5285
  k.push({ event: r, callback: e });
@@ -5155,7 +5287,7 @@ const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { session
5155
5287
  }
5156
5288
  h.on(r, e);
5157
5289
  }
5158
- }, Vs = (r, e) => {
5290
+ }, Us = (r, e) => {
5159
5291
  if (!(typeof window > "u" || typeof document > "u")) {
5160
5292
  if (!h) {
5161
5293
  const t = k.findIndex((s) => s.event === r && s.callback === e);
@@ -5165,7 +5297,7 @@ const Ps = async (r) => typeof window > "u" || typeof document > "u" ? { session
5165
5297
  h.off(r, e);
5166
5298
  }
5167
5299
  };
5168
- function Us(r, e) {
5300
+ function Fs(r, e) {
5169
5301
  if (!(typeof window > "u" || typeof document > "u")) {
5170
5302
  if (typeof e != "function")
5171
5303
  throw new Error(`[TraceLog] Transformer must be a function, received: ${typeof e}`);
@@ -5174,7 +5306,7 @@ function Us(r, e) {
5174
5306
  t !== -1 && M.splice(t, 1), M.push({ hook: r, fn: e });
5175
5307
  return;
5176
5308
  }
5177
- if (S)
5309
+ if (T)
5178
5310
  throw new Error("[TraceLog] Cannot set transformers while TraceLog is being destroyed");
5179
5311
  r === "beforeSend" ? h.setTransformer("beforeSend", e) : h.setTransformer("beforeBatch", e);
5180
5312
  }
@@ -5186,11 +5318,11 @@ const Hs = (r) => {
5186
5318
  e !== -1 && M.splice(e, 1);
5187
5319
  return;
5188
5320
  }
5189
- if (S)
5321
+ if (T)
5190
5322
  throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
5191
5323
  h.removeTransformer(r);
5192
5324
  }
5193
- }, Fs = (r) => {
5325
+ }, xs = (r) => {
5194
5326
  if (!(typeof window > "u" || typeof document > "u")) {
5195
5327
  if (typeof r != "function")
5196
5328
  throw new Error(`[TraceLog] Custom headers provider must be a function, received: ${typeof r}`);
@@ -5198,54 +5330,54 @@ const Hs = (r) => {
5198
5330
  D = r;
5199
5331
  return;
5200
5332
  }
5201
- if (S)
5333
+ if (T)
5202
5334
  throw new Error("[TraceLog] Cannot set custom headers while TraceLog is being destroyed");
5203
5335
  h.setCustomHeaders(r);
5204
5336
  }
5205
- }, xs = () => {
5337
+ }, $s = () => {
5206
5338
  if (!(typeof window > "u" || typeof document > "u")) {
5207
5339
  if (!h) {
5208
5340
  D = null;
5209
5341
  return;
5210
5342
  }
5211
- if (S)
5343
+ if (T)
5212
5344
  throw new Error("[TraceLog] Cannot remove custom headers while TraceLog is being destroyed");
5213
5345
  h.removeCustomHeaders();
5214
5346
  }
5215
- }, $s = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, Bs = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), Ws = () => {
5347
+ }, Bs = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, Ws = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), Xs = () => {
5216
5348
  if (!(typeof window > "u" || typeof document > "u")) {
5217
- if (S)
5349
+ if (T)
5218
5350
  throw new Error("[TraceLog] Destroy operation already in progress");
5219
5351
  if (!h) {
5220
- S = !1;
5352
+ T = !1;
5221
5353
  return;
5222
5354
  }
5223
- S = !0;
5355
+ T = !0;
5224
5356
  try {
5225
- h.destroy(), h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, S = !1;
5357
+ h.destroy(), h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, T = !1;
5226
5358
  } catch (r) {
5227
- h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, S = !1, a("warn", "Error during destroy, forced cleanup completed", { error: r });
5359
+ h = null, R = !1, P = null, k.length = 0, M.length = 0, D = null, T = !1, a("warn", "Error during destroy, forced cleanup completed", { error: r });
5228
5360
  }
5229
5361
  }
5230
- }, Xs = (r) => {
5231
- typeof window > "u" || typeof document > "u" || ss(r);
5232
5362
  }, Gs = (r) => {
5363
+ typeof window > "u" || typeof document > "u" || ss(r);
5364
+ }, js = (r) => {
5233
5365
  if (!(typeof window > "u" || typeof document > "u")) {
5234
5366
  if (!h)
5235
5367
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
5236
- if (S)
5368
+ if (T)
5237
5369
  throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
5238
5370
  h.updateGlobalMetadata(r);
5239
5371
  }
5240
- }, js = (r) => {
5372
+ }, zs = (r) => {
5241
5373
  if (!(typeof window > "u" || typeof document > "u")) {
5242
5374
  if (!h)
5243
5375
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
5244
- if (S)
5376
+ if (T)
5245
5377
  throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
5246
5378
  h.mergeGlobalMetadata(r);
5247
5379
  }
5248
- }, zs = (r, e) => {
5380
+ }, Ks = (r, e) => {
5249
5381
  if (!(typeof window > "u" || typeof document > "u")) {
5250
5382
  if (!r || typeof r != "string" || r.trim().length === 0) {
5251
5383
  a("warn", "identify() called with invalid userId");
@@ -5255,7 +5387,7 @@ const Hs = (r) => {
5255
5387
  a("warn", "identify() userId exceeds 256 characters");
5256
5388
  return;
5257
5389
  }
5258
- if (S) {
5390
+ if (T) {
5259
5391
  a("warn", "Cannot identify while TraceLog is being destroyed");
5260
5392
  return;
5261
5393
  }
@@ -5264,7 +5396,7 @@ const Hs = (r) => {
5264
5396
  return;
5265
5397
  }
5266
5398
  try {
5267
- const t = ft(e), s = {
5399
+ const t = ht(e), s = {
5268
5400
  userId: r.trim(),
5269
5401
  ...t ? { traits: t } : {}
5270
5402
  };
@@ -5282,47 +5414,47 @@ const Hs = (r) => {
5282
5414
  }
5283
5415
  return;
5284
5416
  }
5285
- if (S)
5417
+ if (T)
5286
5418
  throw new Error("[TraceLog] Cannot reset identity while TraceLog is being destroyed");
5287
5419
  await h.resetIdentity();
5288
5420
  }
5289
- }, yr = {
5290
- init: Ps,
5291
- event: Ds,
5292
- on: ks,
5293
- off: Vs,
5294
- setTransformer: Us,
5421
+ }, wr = {
5422
+ init: Ds,
5423
+ event: ks,
5424
+ on: Vs,
5425
+ off: Us,
5426
+ setTransformer: Fs,
5295
5427
  removeTransformer: Hs,
5296
- setCustomHeaders: Fs,
5297
- removeCustomHeaders: xs,
5298
- isInitialized: $s,
5299
- getSessionId: Bs,
5300
- destroy: Ws,
5301
- setQaMode: Xs,
5302
- updateGlobalMetadata: Gs,
5303
- mergeGlobalMetadata: js,
5304
- identify: zs,
5428
+ setCustomHeaders: xs,
5429
+ removeCustomHeaders: $s,
5430
+ isInitialized: Bs,
5431
+ getSessionId: Ws,
5432
+ destroy: Xs,
5433
+ setQaMode: Gs,
5434
+ updateGlobalMetadata: js,
5435
+ mergeGlobalMetadata: zs,
5436
+ identify: Ks,
5305
5437
  resetIdentity: Qs
5306
5438
  };
5307
- var Le, C, G, pt, le, St = -1, V = function(r) {
5439
+ var Le, C, G, Et, le, pt = -1, V = function(r) {
5308
5440
  addEventListener("pageshow", (function(e) {
5309
- e.persisted && (St = e.timeStamp, r(e));
5441
+ e.persisted && (pt = e.timeStamp, r(e));
5310
5442
  }), !0);
5311
- }, De = function() {
5443
+ }, Pe = function() {
5312
5444
  var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
5313
5445
  if (r && r.responseStart > 0 && r.responseStart < performance.now()) return r;
5314
5446
  }, de = function() {
5315
- var r = De();
5447
+ var r = Pe();
5316
5448
  return r && r.activationStart || 0;
5317
5449
  }, y = function(r, e) {
5318
- var t = De(), s = "navigate";
5319
- return St >= 0 ? s = "back-forward-cache" : t && (document.prerendering || de() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
5320
- }, F = function(r, e, t) {
5450
+ var t = Pe(), s = "navigate";
5451
+ return pt >= 0 ? s = "back-forward-cache" : t && (document.prerendering || de() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
5452
+ }, H = function(r, e, t) {
5321
5453
  try {
5322
5454
  if (PerformanceObserver.supportedEntryTypes.includes(r)) {
5323
- var s = new PerformanceObserver((function(n) {
5455
+ var s = new PerformanceObserver((function(i) {
5324
5456
  Promise.resolve().then((function() {
5325
- e(n.getEntries());
5457
+ e(i.getEntries());
5326
5458
  }));
5327
5459
  }));
5328
5460
  return s.observe(Object.assign({ type: r, buffered: !0 }, t || {})), s;
@@ -5330,13 +5462,13 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
5330
5462
  } catch {
5331
5463
  }
5332
5464
  }, w = function(r, e, t, s) {
5333
- var n, i;
5465
+ var i, n;
5334
5466
  return function(o) {
5335
- e.value >= 0 && (o || s) && ((i = e.value - (n || 0)) || n === void 0) && (n = e.value, e.delta = i, e.rating = (function(l, c) {
5467
+ e.value >= 0 && (o || s) && ((n = e.value - (i || 0)) || i === void 0) && (i = e.value, e.delta = n, e.rating = (function(l, c) {
5336
5468
  return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
5337
5469
  })(e.value, t), r(e));
5338
5470
  };
5339
- }, ke = function(r) {
5471
+ }, De = function(r) {
5340
5472
  requestAnimationFrame((function() {
5341
5473
  return requestAnimationFrame((function() {
5342
5474
  return r();
@@ -5351,234 +5483,234 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
5351
5483
  return function() {
5352
5484
  e || (r(), e = !0);
5353
5485
  };
5354
- }, H = -1, tt = function() {
5486
+ }, F = -1, et = function() {
5355
5487
  return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
5356
5488
  }, ce = function(r) {
5357
- document.visibilityState === "hidden" && H > -1 && (H = r.type === "visibilitychange" ? r.timeStamp : 0, Ks());
5358
- }, st = function() {
5489
+ document.visibilityState === "hidden" && F > -1 && (F = r.type === "visibilitychange" ? r.timeStamp : 0, Ys());
5490
+ }, tt = function() {
5359
5491
  addEventListener("visibilitychange", ce, !0), addEventListener("prerenderingchange", ce, !0);
5360
- }, Ks = function() {
5492
+ }, Ys = function() {
5361
5493
  removeEventListener("visibilitychange", ce, !0), removeEventListener("prerenderingchange", ce, !0);
5362
- }, Ve = function() {
5363
- return H < 0 && (H = tt(), st(), V((function() {
5494
+ }, ke = function() {
5495
+ return F < 0 && (F = et(), tt(), V((function() {
5364
5496
  setTimeout((function() {
5365
- H = tt(), st();
5497
+ F = et(), tt();
5366
5498
  }), 0);
5367
5499
  }))), { get firstHiddenTime() {
5368
- return H;
5500
+ return F;
5369
5501
  } };
5370
- }, Q = function(r) {
5502
+ }, K = function(r) {
5371
5503
  document.prerendering ? addEventListener("prerenderingchange", (function() {
5372
5504
  return r();
5373
5505
  }), !0) : r();
5374
- }, Me = [1800, 3e3], Tt = function(r, e) {
5375
- e = e || {}, Q((function() {
5376
- var t, s = Ve(), n = y("FCP"), i = F("paint", (function(o) {
5506
+ }, Ae = [1800, 3e3], St = function(r, e) {
5507
+ e = e || {}, K((function() {
5508
+ var t, s = ke(), i = y("FCP"), n = H("paint", (function(o) {
5377
5509
  o.forEach((function(l) {
5378
- l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - de(), 0), n.entries.push(l), t(!0)));
5510
+ l.name === "first-contentful-paint" && (n.disconnect(), l.startTime < s.firstHiddenTime && (i.value = Math.max(l.startTime - de(), 0), i.entries.push(l), t(!0)));
5379
5511
  }));
5380
5512
  }));
5381
- i && (t = w(r, n, Me, e.reportAllChanges), V((function(o) {
5382
- n = y("FCP"), t = w(r, n, Me, e.reportAllChanges), ke((function() {
5383
- n.value = performance.now() - o.timeStamp, t(!0);
5513
+ n && (t = w(r, i, Ae, e.reportAllChanges), V((function(o) {
5514
+ i = y("FCP"), t = w(r, i, Ae, e.reportAllChanges), De((function() {
5515
+ i.value = performance.now() - o.timeStamp, t(!0);
5384
5516
  }));
5385
5517
  })));
5386
5518
  }));
5387
- }, Ce = [0.1, 0.25], Ys = function(r, e) {
5388
- e = e || {}, Tt(ue((function() {
5389
- var t, s = y("CLS", 0), n = 0, i = [], o = function(c) {
5519
+ }, Me = [0.1, 0.25], qs = function(r, e) {
5520
+ e = e || {}, St(ue((function() {
5521
+ var t, s = y("CLS", 0), i = 0, n = [], o = function(c) {
5390
5522
  c.forEach((function(d) {
5391
5523
  if (!d.hadRecentInput) {
5392
- var f = i[0], g = i[i.length - 1];
5393
- n && d.startTime - g.startTime < 1e3 && d.startTime - f.startTime < 5e3 ? (n += d.value, i.push(d)) : (n = d.value, i = [d]);
5524
+ var f = n[0], g = n[n.length - 1];
5525
+ i && d.startTime - g.startTime < 1e3 && d.startTime - f.startTime < 5e3 ? (i += d.value, n.push(d)) : (i = d.value, n = [d]);
5394
5526
  }
5395
- })), n > s.value && (s.value = n, s.entries = i, t());
5396
- }, l = F("layout-shift", o);
5397
- l && (t = w(r, s, Ce, e.reportAllChanges), z((function() {
5527
+ })), i > s.value && (s.value = i, s.entries = n, t());
5528
+ }, l = H("layout-shift", o);
5529
+ l && (t = w(r, s, Me, e.reportAllChanges), z((function() {
5398
5530
  o(l.takeRecords()), t(!0);
5399
5531
  })), V((function() {
5400
- n = 0, s = y("CLS", 0), t = w(r, s, Ce, e.reportAllChanges), ke((function() {
5532
+ i = 0, s = y("CLS", 0), t = w(r, s, Me, e.reportAllChanges), De((function() {
5401
5533
  return t();
5402
5534
  }));
5403
5535
  })), setTimeout(t, 0));
5404
5536
  })));
5405
- }, It = 0, pe = 1 / 0, J = 0, qs = function(r) {
5537
+ }, Tt = 0, pe = 1 / 0, J = 0, Js = function(r) {
5406
5538
  r.forEach((function(e) {
5407
- e.interactionId && (pe = Math.min(pe, e.interactionId), J = Math.max(J, e.interactionId), It = J ? (J - pe) / 7 + 1 : 0);
5539
+ e.interactionId && (pe = Math.min(pe, e.interactionId), J = Math.max(J, e.interactionId), Tt = J ? (J - pe) / 7 + 1 : 0);
5408
5540
  }));
5409
- }, vt = function() {
5410
- return Le ? It : performance.interactionCount || 0;
5411
- }, Js = function() {
5412
- "interactionCount" in performance || Le || (Le = F("event", qs, { type: "event", buffered: !0, durationThreshold: 0 }));
5413
- }, A = [], te = /* @__PURE__ */ new Map(), _t = 0, Zs = function() {
5414
- var r = Math.min(A.length - 1, Math.floor((vt() - _t) / 50));
5415
- return A[r];
5416
- }, er = [], tr = function(r) {
5417
- if (er.forEach((function(n) {
5418
- return n(r);
5541
+ }, It = function() {
5542
+ return Le ? Tt : performance.interactionCount || 0;
5543
+ }, Zs = function() {
5544
+ "interactionCount" in performance || Le || (Le = H("event", Js, { type: "event", buffered: !0, durationThreshold: 0 }));
5545
+ }, L = [], te = /* @__PURE__ */ new Map(), vt = 0, er = function() {
5546
+ var r = Math.min(L.length - 1, Math.floor((It() - vt) / 50));
5547
+ return L[r];
5548
+ }, tr = [], sr = function(r) {
5549
+ if (tr.forEach((function(i) {
5550
+ return i(r);
5419
5551
  })), r.interactionId || r.entryType === "first-input") {
5420
- var e = A[A.length - 1], t = te.get(r.interactionId);
5421
- if (t || A.length < 10 || r.duration > e.latency) {
5552
+ var e = L[L.length - 1], t = te.get(r.interactionId);
5553
+ if (t || L.length < 10 || r.duration > e.latency) {
5422
5554
  if (t) r.duration > t.latency ? (t.entries = [r], t.latency = r.duration) : r.duration === t.latency && r.startTime === t.entries[0].startTime && t.entries.push(r);
5423
5555
  else {
5424
5556
  var s = { id: r.interactionId, latency: r.duration, entries: [r] };
5425
- te.set(s.id, s), A.push(s);
5557
+ te.set(s.id, s), L.push(s);
5426
5558
  }
5427
- A.sort((function(n, i) {
5428
- return i.latency - n.latency;
5429
- })), A.length > 10 && A.splice(10).forEach((function(n) {
5430
- return te.delete(n.id);
5559
+ L.sort((function(i, n) {
5560
+ return n.latency - i.latency;
5561
+ })), L.length > 10 && L.splice(10).forEach((function(i) {
5562
+ return te.delete(i.id);
5431
5563
  }));
5432
5564
  }
5433
5565
  }
5434
- }, yt = function(r) {
5566
+ }, _t = function(r) {
5435
5567
  var e = self.requestIdleCallback || self.setTimeout, t = -1;
5436
5568
  return r = ue(r), document.visibilityState === "hidden" ? r() : (t = e(r), z(r)), t;
5437
- }, Re = [200, 500], sr = function(r, e) {
5438
- "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, Q((function() {
5569
+ }, Ce = [200, 500], rr = function(r, e) {
5570
+ "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, K((function() {
5439
5571
  var t;
5440
- Js();
5441
- var s, n = y("INP"), i = function(l) {
5442
- yt((function() {
5443
- l.forEach(tr);
5444
- var c = Zs();
5445
- c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, s());
5572
+ Zs();
5573
+ var s, i = y("INP"), n = function(l) {
5574
+ _t((function() {
5575
+ l.forEach(sr);
5576
+ var c = er();
5577
+ c && c.latency !== i.value && (i.value = c.latency, i.entries = c.entries, s());
5446
5578
  }));
5447
- }, o = F("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
5448
- s = w(r, n, Re, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), z((function() {
5449
- i(o.takeRecords()), s(!0);
5579
+ }, o = H("event", n, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
5580
+ s = w(r, i, Ce, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), z((function() {
5581
+ n(o.takeRecords()), s(!0);
5450
5582
  })), V((function() {
5451
- _t = vt(), A.length = 0, te.clear(), n = y("INP"), s = w(r, n, Re, e.reportAllChanges);
5583
+ vt = It(), L.length = 0, te.clear(), i = y("INP"), s = w(r, i, Ce, e.reportAllChanges);
5452
5584
  })));
5453
5585
  })));
5454
- }, Ne = [2500, 4e3], Se = {}, rr = function(r, e) {
5455
- e = e || {}, Q((function() {
5456
- var t, s = Ve(), n = y("LCP"), i = function(c) {
5586
+ }, Re = [2500, 4e3], Se = {}, ir = function(r, e) {
5587
+ e = e || {}, K((function() {
5588
+ var t, s = ke(), i = y("LCP"), n = function(c) {
5457
5589
  e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(d) {
5458
- d.startTime < s.firstHiddenTime && (n.value = Math.max(d.startTime - de(), 0), n.entries = [d], t());
5590
+ d.startTime < s.firstHiddenTime && (i.value = Math.max(d.startTime - de(), 0), i.entries = [d], t());
5459
5591
  }));
5460
- }, o = F("largest-contentful-paint", i);
5592
+ }, o = H("largest-contentful-paint", n);
5461
5593
  if (o) {
5462
- t = w(r, n, Ne, e.reportAllChanges);
5594
+ t = w(r, i, Re, e.reportAllChanges);
5463
5595
  var l = ue((function() {
5464
- Se[n.id] || (i(o.takeRecords()), o.disconnect(), Se[n.id] = !0, t(!0));
5596
+ Se[i.id] || (n(o.takeRecords()), o.disconnect(), Se[i.id] = !0, t(!0));
5465
5597
  }));
5466
5598
  ["keydown", "click"].forEach((function(c) {
5467
5599
  addEventListener(c, (function() {
5468
- return yt(l);
5600
+ return _t(l);
5469
5601
  }), { once: !0, capture: !0 });
5470
5602
  })), z(l), V((function(c) {
5471
- n = y("LCP"), t = w(r, n, Ne, e.reportAllChanges), ke((function() {
5472
- n.value = performance.now() - c.timeStamp, Se[n.id] = !0, t(!0);
5603
+ i = y("LCP"), t = w(r, i, Re, e.reportAllChanges), De((function() {
5604
+ i.value = performance.now() - c.timeStamp, Se[i.id] = !0, t(!0);
5473
5605
  }));
5474
5606
  }));
5475
5607
  }
5476
5608
  }));
5477
- }, Oe = [800, 1800], nr = function r(e) {
5478
- document.prerendering ? Q((function() {
5609
+ }, Ne = [800, 1800], nr = function r(e) {
5610
+ document.prerendering ? K((function() {
5479
5611
  return r(e);
5480
5612
  })) : document.readyState !== "complete" ? addEventListener("load", (function() {
5481
5613
  return r(e);
5482
5614
  }), !0) : setTimeout(e, 0);
5483
- }, ir = function(r, e) {
5615
+ }, or = function(r, e) {
5484
5616
  e = e || {};
5485
- var t = y("TTFB"), s = w(r, t, Oe, e.reportAllChanges);
5617
+ var t = y("TTFB"), s = w(r, t, Ne, e.reportAllChanges);
5486
5618
  nr((function() {
5487
- var n = De();
5488
- n && (t.value = Math.max(n.responseStart - de(), 0), t.entries = [n], s(!0), V((function() {
5489
- t = y("TTFB", 0), (s = w(r, t, Oe, e.reportAllChanges))(!0);
5619
+ var i = Pe();
5620
+ i && (t.value = Math.max(i.responseStart - de(), 0), t.entries = [i], s(!0), V((function() {
5621
+ t = y("TTFB", 0), (s = w(r, t, Ne, e.reportAllChanges))(!0);
5490
5622
  })));
5491
5623
  }));
5492
- }, W = { passive: !0, capture: !0 }, or = /* @__PURE__ */ new Date(), rt = function(r, e) {
5493
- C || (C = e, G = r, pt = /* @__PURE__ */ new Date(), bt(removeEventListener), wt());
5494
- }, wt = function() {
5495
- if (G >= 0 && G < pt - or) {
5624
+ }, W = { passive: !0, capture: !0 }, ar = /* @__PURE__ */ new Date(), st = function(r, e) {
5625
+ C || (C = e, G = r, Et = /* @__PURE__ */ new Date(), wt(removeEventListener), yt());
5626
+ }, yt = function() {
5627
+ if (G >= 0 && G < Et - ar) {
5496
5628
  var r = { entryType: "first-input", name: C.type, target: C.target, cancelable: C.cancelable, startTime: C.timeStamp, processingStart: C.timeStamp + G };
5497
5629
  le.forEach((function(e) {
5498
5630
  e(r);
5499
5631
  })), le = [];
5500
5632
  }
5501
- }, ar = function(r) {
5633
+ }, lr = function(r) {
5502
5634
  if (r.cancelable) {
5503
5635
  var e = (r.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - r.timeStamp;
5504
5636
  r.type == "pointerdown" ? (function(t, s) {
5505
- var n = function() {
5506
- rt(t, s), o();
5507
- }, i = function() {
5637
+ var i = function() {
5638
+ st(t, s), o();
5639
+ }, n = function() {
5508
5640
  o();
5509
5641
  }, o = function() {
5510
- removeEventListener("pointerup", n, W), removeEventListener("pointercancel", i, W);
5642
+ removeEventListener("pointerup", i, W), removeEventListener("pointercancel", n, W);
5511
5643
  };
5512
- addEventListener("pointerup", n, W), addEventListener("pointercancel", i, W);
5513
- })(e, r) : rt(e, r);
5644
+ addEventListener("pointerup", i, W), addEventListener("pointercancel", n, W);
5645
+ })(e, r) : st(e, r);
5514
5646
  }
5515
- }, bt = function(r) {
5647
+ }, wt = function(r) {
5516
5648
  ["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
5517
- return r(e, ar, W);
5649
+ return r(e, lr, W);
5518
5650
  }));
5519
- }, Pe = [100, 300], lr = function(r, e) {
5520
- e = e || {}, Q((function() {
5521
- var t, s = Ve(), n = y("FID"), i = function(c) {
5522
- c.startTime < s.firstHiddenTime && (n.value = c.processingStart - c.startTime, n.entries.push(c), t(!0));
5651
+ }, Oe = [100, 300], cr = function(r, e) {
5652
+ e = e || {}, K((function() {
5653
+ var t, s = ke(), i = y("FID"), n = function(c) {
5654
+ c.startTime < s.firstHiddenTime && (i.value = c.processingStart - c.startTime, i.entries.push(c), t(!0));
5523
5655
  }, o = function(c) {
5524
- c.forEach(i);
5525
- }, l = F("first-input", o);
5526
- t = w(r, n, Pe, e.reportAllChanges), l && (z(ue((function() {
5656
+ c.forEach(n);
5657
+ }, l = H("first-input", o);
5658
+ t = w(r, i, Oe, e.reportAllChanges), l && (z(ue((function() {
5527
5659
  o(l.takeRecords()), l.disconnect();
5528
5660
  }))), V((function() {
5529
5661
  var c;
5530
- n = y("FID"), t = w(r, n, Pe, e.reportAllChanges), le = [], G = -1, C = null, bt(addEventListener), c = i, le.push(c), wt();
5662
+ i = y("FID"), t = w(r, i, Oe, e.reportAllChanges), le = [], G = -1, C = null, wt(addEventListener), c = n, le.push(c), yt();
5531
5663
  })));
5532
5664
  }));
5533
5665
  };
5534
- const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5666
+ const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5535
5667
  __proto__: null,
5536
- CLSThresholds: Ce,
5537
- FCPThresholds: Me,
5538
- FIDThresholds: Pe,
5539
- INPThresholds: Re,
5540
- LCPThresholds: Ne,
5541
- TTFBThresholds: Oe,
5542
- onCLS: Ys,
5543
- onFCP: Tt,
5544
- onFID: lr,
5545
- onINP: sr,
5546
- onLCP: rr,
5547
- onTTFB: ir
5668
+ CLSThresholds: Me,
5669
+ FCPThresholds: Ae,
5670
+ FIDThresholds: Oe,
5671
+ INPThresholds: Ce,
5672
+ LCPThresholds: Re,
5673
+ TTFBThresholds: Ne,
5674
+ onCLS: qs,
5675
+ onFCP: St,
5676
+ onFID: cr,
5677
+ onINP: rr,
5678
+ onLCP: ir,
5679
+ onTTFB: or
5548
5680
  }, Symbol.toStringTag, { value: "Module" }));
5549
5681
  export {
5550
5682
  m as AppConfigValidationError,
5551
- dr as DEFAULT_SESSION_TIMEOUT,
5683
+ ur as DEFAULT_SESSION_TIMEOUT,
5552
5684
  _e as DEFAULT_WEB_VITALS_MODE,
5553
- L as DeviceType,
5685
+ A as DeviceType,
5554
5686
  se as EmitterEvent,
5555
5687
  B as ErrorType,
5556
5688
  u as EventType,
5557
- vr as InitializationTimeoutError,
5689
+ _r as InitializationTimeoutError,
5558
5690
  N as IntegrationValidationError,
5559
- Sr as MAX_ARRAY_LENGTH,
5560
- mr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
5561
- fr as MAX_CUSTOM_EVENT_KEYS,
5562
- ur as MAX_CUSTOM_EVENT_NAME_LENGTH,
5563
- hr as MAX_CUSTOM_EVENT_STRING_SIZE,
5564
- gr as MAX_NESTED_OBJECT_KEYS,
5565
- Er as MAX_STRING_LENGTH,
5566
- pr as MAX_STRING_LENGTH_IN_ARRAY,
5567
- ie as Mode,
5568
- lt as PII_PATTERNS,
5691
+ Tr as MAX_ARRAY_LENGTH,
5692
+ gr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
5693
+ mr as MAX_CUSTOM_EVENT_KEYS,
5694
+ hr as MAX_CUSTOM_EVENT_NAME_LENGTH,
5695
+ fr as MAX_CUSTOM_EVENT_STRING_SIZE,
5696
+ Er as MAX_NESTED_OBJECT_KEYS,
5697
+ pr as MAX_STRING_LENGTH,
5698
+ Sr as MAX_STRING_LENGTH_IN_ARRAY,
5699
+ ne as Mode,
5700
+ at as PII_PATTERNS,
5569
5701
  O as PermanentError,
5570
5702
  re as RateLimitError,
5571
- Xe as SamplingRateValidationError,
5703
+ We as SamplingRateValidationError,
5572
5704
  Z as ScrollDirection,
5573
5705
  Pt as SessionTimeoutValidationError,
5574
5706
  $ as SpecialApiUrl,
5575
- ne as TimeoutError,
5707
+ ie as TimeoutError,
5576
5708
  j as TraceLogValidationError,
5577
- _r as WEB_VITALS_GOOD_THRESHOLDS,
5709
+ yr as WEB_VITALS_GOOD_THRESHOLDS,
5578
5710
  Ke as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
5579
- Kt as WEB_VITALS_POOR_THRESHOLDS,
5580
- Ye as getWebVitalsThresholds,
5581
- Tr as isPrimaryScrollEvent,
5582
- Ir as isSecondaryScrollEvent,
5583
- yr as tracelog
5711
+ Qt as WEB_VITALS_POOR_THRESHOLDS,
5712
+ Qe as getWebVitalsThresholds,
5713
+ Ir as isPrimaryScrollEvent,
5714
+ vr as isSecondaryScrollEvent,
5715
+ wr as tracelog
5584
5716
  };