@tracelog/lib 2.3.0 → 2.3.1-rc.84.3

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 Fr = 9e5;
2
- const $r = 120, Br = 8192, Wr = 10, Gr = 10, Xr = 20;
3
- const Qr = 1e3, jr = 500, zr = 100;
4
- const w = "data-tlog", at = [
1
+ const Br = 9e5;
2
+ const Wr = 120, Gr = 8192, Xr = 10, Qr = 10, jr = 20;
3
+ const zr = 1e3, Kr = 500, Yr = 100;
4
+ const w = "data-tlog", lt = [
5
5
  "button",
6
6
  "a",
7
7
  'input[type="button"]',
@@ -33,7 +33,7 @@ const w = "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"], ct = [
36
+ ], ct = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], ut = [
37
37
  "token",
38
38
  "auth",
39
39
  "key",
@@ -71,53 +71,53 @@ const m = {
71
71
  INVALID_VIEWPORT_MIN_DWELL_TIME: "Viewport minDwellTime must be a non-negative number",
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
- }, ut = [
74
+ }, dt = [
75
75
  /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
76
76
  /javascript:/gi,
77
77
  /on\w+\s*=/gi,
78
78
  /<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
79
79
  /<embed\b[^>]*>/gi,
80
80
  /<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
81
- ], _ = "tlog", x = `${_}:qa_mode`, ye = `${_}:uid`, We = "tlog_mode", be = "qa", Le = "qa_off", dt = (s) => s ? `${_}:${s}:queue` : `${_}:queue`, ht = (s) => s ? `${_}:${s}:session` : `${_}:session`, ft = (s) => s ? `${_}:${s}:broadcast` : `${_}:broadcast`, Ae = (s, e) => `${_}:${s}:session_counts:${e}`, Me = 10080 * 60 * 1e3, Ce = `${_}:session_counts_last_cleanup`, Re = 3600 * 1e3;
82
- var U = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(U || {}), A = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(A || {}), ae = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(ae || {});
83
- class O extends Error {
81
+ ], I = "tlog", F = `${I}:qa_mode`, be = `${I}:uid`, Ge = "tlog_mode", Le = "qa", Ae = "qa_off", ht = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, ft = (s) => s ? `${I}:${s}:session` : `${I}:session`, mt = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, Me = (s, e) => `${I}:${s}:session_counts:${e}`, Ce = 10080 * 60 * 1e3, Re = `${I}:session_counts_last_cleanup`, Ne = 3600 * 1e3;
82
+ var H = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(H || {}), A = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(A || {}), le = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(le || {});
83
+ class P extends Error {
84
84
  constructor(e, t) {
85
- super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, O);
85
+ super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, P);
86
86
  }
87
87
  }
88
- var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), Q = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(Q || {}), H = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(H || {}), K = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(K || {});
89
- const Kr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !0, Yr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !1;
90
- class F extends Error {
88
+ var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s.VIEWPORT_VISIBLE = "viewport_visible", s))(d || {}), j = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(j || {}), x = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(x || {}), Y = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(Y || {});
89
+ const qr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !0, Jr = (s) => s.type === d.SCROLL && "scroll_data" in s && s.scroll_data.is_primary === !1;
90
+ class $ extends Error {
91
91
  constructor(e, t, r) {
92
92
  super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
93
93
  }
94
94
  }
95
- class f extends F {
95
+ class f extends $ {
96
96
  constructor(e, t = "config") {
97
97
  super(e, "APP_CONFIG_INVALID", t);
98
98
  }
99
99
  }
100
- class mt extends F {
100
+ class gt extends $ {
101
101
  constructor(e, t = "config") {
102
102
  super(e, "SESSION_TIMEOUT_INVALID", t);
103
103
  }
104
104
  }
105
- class Ne extends F {
105
+ class Oe extends $ {
106
106
  constructor(e, t = "config") {
107
107
  super(e, "SAMPLING_RATE_INVALID", t);
108
108
  }
109
109
  }
110
- class V extends F {
110
+ class U extends $ {
111
111
  constructor(e, t = "config") {
112
112
  super(e, "INTEGRATION_INVALID", t);
113
113
  }
114
114
  }
115
- class qr extends F {
115
+ class Zr extends $ {
116
116
  constructor(e, t, r = "runtime") {
117
117
  super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
118
118
  }
119
119
  }
120
- const Ge = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Xe = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", gt = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Et = (s, e) => {
120
+ const Xe = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Qe = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Et = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", St = (s, e) => {
121
121
  if (e) {
122
122
  if (e instanceof Error) {
123
123
  const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
@@ -136,24 +136,24 @@ const Ge = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
136
136
  return `[TraceLog] ${s}: ${String(e)}`;
137
137
  }
138
138
  return `[TraceLog] ${s}`;
139
- }, St = () => {
139
+ }, pt = () => {
140
140
  if (typeof window > "u" || typeof sessionStorage > "u")
141
141
  return !1;
142
142
  try {
143
- return sessionStorage.getItem(x) === "true";
143
+ return sessionStorage.getItem(F) === "true";
144
144
  } catch {
145
145
  return !1;
146
146
  }
147
147
  }, a = (s, e, t) => {
148
- const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ? Et(e, r) : `[TraceLog] ${e}`, u = s === "error" ? "error" : s === "warn" ? "warn" : "log";
149
- if (!pt(l, i))
148
+ const { error: r, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = r ? St(e, r) : `[TraceLog] ${e}`, u = s === "error" ? "error" : s === "warn" ? "warn" : "log";
149
+ if (!Tt(l, i))
150
150
  return;
151
- const g = Tt(l, o), p = n !== void 0 ? le(n) : void 0;
152
- vt(u, c, g, p);
153
- }, pt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? St() : !1, Tt = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? gt : "", vt = (s, e, t, r) => {
151
+ const g = vt(l, o), p = n !== void 0 ? ce(n) : void 0;
152
+ _t(u, c, g, p);
153
+ }, Tt = (s, e) => s === "critical" ? !0 : s === "qa" || e ? pt() : !1, vt = (s, e) => e !== void 0 && e !== "" ? e : s === "critical" ? Et : "", _t = (s, e, t, r) => {
154
154
  const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
155
155
  r !== void 0 ? n ? console[s](i, t, r) : console[s](i, r) : n ? console[s](i, t) : console[s](i);
156
- }, le = (s) => {
156
+ }, ce = (s) => {
157
157
  const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
158
158
  for (const [r, n] of Object.entries(s)) {
159
159
  const i = r.toLowerCase();
@@ -161,16 +161,16 @@ const Ge = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
161
161
  e[r] = "[REDACTED]";
162
162
  continue;
163
163
  }
164
- n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] = le(n) : Array.isArray(n) ? e[r] = n.map(
165
- (o) => o !== null && typeof o == "object" && !Array.isArray(o) ? le(o) : o
164
+ n !== null && typeof n == "object" && !Array.isArray(n) ? e[r] = ce(n) : Array.isArray(n) ? e[r] = n.map(
165
+ (o) => o !== null && typeof o == "object" && !Array.isArray(o) ? ce(o) : o
166
166
  ) : e[r] = n;
167
167
  }
168
168
  return e;
169
169
  };
170
- let ce, Qe;
170
+ let ue, je;
171
171
  const It = () => {
172
- typeof window < "u" && !ce && (ce = window.matchMedia("(pointer: coarse)"), Qe = window.matchMedia("(hover: none)"));
173
- }, Y = "Unknown", _t = (s) => {
172
+ typeof window < "u" && !ue && (ue = window.matchMedia("(pointer: coarse)"), je = window.matchMedia("(hover: none)"));
173
+ }, q = "Unknown", wt = (s) => {
174
174
  const e = s.userAgentData?.platform;
175
175
  if (e != null && e !== "") {
176
176
  if (/windows/i.test(e)) return "Windows";
@@ -181,8 +181,8 @@ const It = () => {
181
181
  if (/ios/i.test(e)) return "iOS";
182
182
  }
183
183
  const t = navigator.userAgent;
184
- return /Windows/i.test(t) ? "Windows" : /iPhone|iPad|iPod/i.test(t) ? "iOS" : /Mac OS X|Macintosh/i.test(t) ? "macOS" : /Android/i.test(t) ? "Android" : /CrOS/i.test(t) ? "ChromeOS" : /Linux/i.test(t) ? "Linux" : Y;
185
- }, wt = (s) => {
184
+ return /Windows/i.test(t) ? "Windows" : /iPhone|iPad|iPod/i.test(t) ? "iOS" : /Mac OS X|Macintosh/i.test(t) ? "macOS" : /Android/i.test(t) ? "Android" : /CrOS/i.test(t) ? "ChromeOS" : /Linux/i.test(t) ? "Linux" : q;
185
+ }, yt = (s) => {
186
186
  const e = s.userAgentData?.brands;
187
187
  if (e != null && e.length > 0) {
188
188
  const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
@@ -192,8 +192,8 @@ const It = () => {
192
192
  }
193
193
  }
194
194
  const t = navigator.userAgent;
195
- return /Edg\//i.test(t) ? "Edge" : /OPR\//i.test(t) ? "Opera" : /Chrome/i.test(t) ? "Chrome" : /Firefox/i.test(t) ? "Firefox" : /Safari/i.test(t) && !/Chrome/i.test(t) ? "Safari" : Y;
196
- }, yt = () => {
195
+ return /Edg\//i.test(t) ? "Edge" : /OPR\//i.test(t) ? "Opera" : /Chrome/i.test(t) ? "Chrome" : /Firefox/i.test(t) ? "Firefox" : /Safari/i.test(t) && !/Chrome/i.test(t) ? "Safari" : q;
196
+ }, bt = () => {
197
197
  try {
198
198
  const s = navigator;
199
199
  if (s.userAgentData != null && typeof s.userAgentData.mobile == "boolean") {
@@ -201,27 +201,27 @@ const It = () => {
201
201
  return c != null && c !== "" && /ipad|tablet/i.test(c) ? A.Tablet : s.userAgentData.mobile ? A.Mobile : A.Desktop;
202
202
  }
203
203
  It();
204
- const e = window.innerWidth, t = ce?.matches ?? !1, r = Qe?.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);
204
+ const e = window.innerWidth, t = ue?.matches ?? !1, r = je?.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);
205
205
  return e <= 767 || o && n ? A.Mobile : e >= 768 && e <= 1024 || l || t && r && n ? A.Tablet : A.Desktop;
206
206
  } catch (s) {
207
207
  return a("debug", "Device detection failed, defaulting to desktop", { error: s }), A.Desktop;
208
208
  }
209
- }, bt = () => {
209
+ }, Lt = () => {
210
210
  try {
211
211
  const s = navigator;
212
212
  return {
213
- type: yt(),
214
- os: _t(s),
215
- browser: wt(s)
213
+ type: bt(),
214
+ os: wt(s),
215
+ browser: yt(s)
216
216
  };
217
217
  } catch (s) {
218
218
  return a("debug", "Device info detection failed, using defaults", { error: s }), {
219
219
  type: A.Desktop,
220
- os: Y,
221
- browser: Y
220
+ os: q,
221
+ browser: q
222
222
  };
223
223
  }
224
- }, je = [
224
+ }, ze = [
225
225
  // Email addresses
226
226
  /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
227
227
  // US Phone numbers (various formats)
@@ -236,7 +236,7 @@ const It = () => {
236
236
  /Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
237
237
  // Passwords in connection strings (protocol://user:password@host)
238
238
  /:\/\/[^:/]+:([^@]+)@/gi
239
- ], Oe = 500, Pe = 5e3, j = 50, Lt = j * 2, ze = 1, At = 1e3, Mt = 10, De = 5e3, Ct = 6e4, Jr = {
239
+ ], Pe = 500, De = 5e3, z = 50, At = z * 2, Ke = 1, Mt = 1e3, Ct = 10, Ve = 5e3, Rt = 6e4, es = {
240
240
  LCP: 2500,
241
241
  // Good: ≤ 2.5s
242
242
  FCP: 1800,
@@ -260,7 +260,7 @@ const It = () => {
260
260
  TTFB: 800,
261
261
  // Needs improvement: > 800ms
262
262
  LONG_TASK: 50
263
- }, Rt = {
263
+ }, Nt = {
264
264
  LCP: 4e3,
265
265
  // Poor: > 4s
266
266
  FCP: 3e3,
@@ -272,7 +272,7 @@ const It = () => {
272
272
  TTFB: 1800,
273
273
  // Poor: > 1800ms
274
274
  LONG_TASK: 50
275
- }, ue = "needs-improvement", Ve = (s = ue) => {
275
+ }, de = "needs-improvement", Ue = (s = de) => {
276
276
  switch (s) {
277
277
  case "all":
278
278
  return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
@@ -280,45 +280,45 @@ const It = () => {
280
280
  case "needs-improvement":
281
281
  return ke;
282
282
  case "poor":
283
- return Rt;
283
+ return Nt;
284
284
  default:
285
285
  return ke;
286
286
  }
287
- }, Nt = 1e3, Ot = 50, Pt = "2.2.1", Dt = Pt, Ke = () => typeof window < "u" && typeof sessionStorage < "u", kt = () => {
287
+ }, Ot = 1e3, Pt = 50, Dt = "2.3.1", Vt = Dt, Ye = () => typeof window < "u" && typeof sessionStorage < "u", kt = () => {
288
288
  try {
289
289
  const s = new URLSearchParams(window.location.search);
290
- s.delete(We);
290
+ s.delete(Ge);
291
291
  const e = s.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
292
292
  window.history.replaceState({}, "", t);
293
293
  } catch {
294
294
  }
295
- }, Vt = () => {
296
- if (!Ke())
295
+ }, Ut = () => {
296
+ if (!Ye())
297
297
  return !1;
298
298
  try {
299
- const e = new URLSearchParams(window.location.search).get(We), t = sessionStorage.getItem(x);
299
+ const e = new URLSearchParams(window.location.search).get(Ge), t = sessionStorage.getItem(F);
300
300
  let r = null;
301
- return e === be ? (r = !0, sessionStorage.setItem(x, "true"), a("info", "QA Mode ACTIVE", {
302
- visibility: "qa",
303
- style: Ge
304
- })) : e === Le && (r = !1, sessionStorage.setItem(x, "false"), a("info", "QA Mode DISABLED", {
301
+ return e === Le ? (r = !0, sessionStorage.setItem(F, "true"), a("info", "QA Mode ACTIVE", {
305
302
  visibility: "qa",
306
303
  style: Xe
307
- })), (e === be || e === Le) && kt(), r ?? t === "true";
304
+ })) : e === Ae && (r = !1, sessionStorage.setItem(F, "false"), a("info", "QA Mode DISABLED", {
305
+ visibility: "qa",
306
+ style: Qe
307
+ })), (e === Le || e === Ae) && kt(), r ?? t === "true";
308
308
  } catch {
309
309
  return !1;
310
310
  }
311
- }, Ut = (s) => {
312
- if (Ke())
311
+ }, Ht = (s) => {
312
+ if (Ye())
313
313
  try {
314
- sessionStorage.setItem(x, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
314
+ sessionStorage.setItem(F, s ? "true" : "false"), a("info", s ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
315
315
  visibility: "qa",
316
- style: s ? Ge : Xe
316
+ style: s ? Xe : Qe
317
317
  });
318
318
  } catch {
319
319
  a("debug", "Cannot set QA mode: sessionStorage unavailable");
320
320
  }
321
- }, Ht = [
321
+ }, xt = [
322
322
  "co.uk",
323
323
  "org.uk",
324
324
  "com.au",
@@ -330,40 +330,40 @@ const It = () => {
330
330
  "co.in",
331
331
  "com.cn",
332
332
  "co.za"
333
- ], Ue = (s) => {
333
+ ], He = (s) => {
334
334
  const e = s.toLowerCase().split(".");
335
335
  if (e.length <= 2)
336
336
  return s.toLowerCase();
337
337
  const t = e.slice(-2).join(".");
338
- return Ht.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
339
- }, xt = (s, e) => s === e ? !0 : Ue(s) === Ue(e), re = () => {
338
+ return xt.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
339
+ }, Ft = (s, e) => s === e ? !0 : He(s) === He(e), se = () => {
340
340
  const s = document.referrer;
341
341
  if (!s)
342
342
  return "Direct";
343
343
  try {
344
344
  const e = new URL(s).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
345
- return xt(e, t) ? "Direct" : s;
345
+ return Ft(e, t) ? "Direct" : s;
346
346
  } catch (e) {
347
347
  return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: s } }), s;
348
348
  }
349
- }, se = () => {
349
+ }, ne = () => {
350
350
  const s = new URLSearchParams(window.location.search), e = {};
351
- return lt.forEach((r) => {
351
+ return ct.forEach((r) => {
352
352
  const n = s.get(r);
353
353
  if (n) {
354
354
  const i = r.split("utm_")[1];
355
355
  e[i] = n;
356
356
  }
357
357
  }), Object.keys(e).length ? e : void 0;
358
- }, Ft = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
358
+ }, $t = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
359
359
  const e = Math.random() * 16 | 0;
360
360
  return (s === "x" ? e : e & 3 | 8).toString(16);
361
361
  });
362
- let W = 0, G = 0;
363
- const $t = () => {
362
+ let G = 0, X = 0;
363
+ const Bt = () => {
364
364
  let s = Date.now();
365
- s < G && (s = G), s === G ? W = (W + 1) % 1e3 : W = 0, G = s;
366
- const e = W.toString().padStart(3, "0");
365
+ s < X && (s = X), s === X ? G = (G + 1) % 1e3 : G = 0, X = s;
366
+ const e = G.toString().padStart(3, "0");
367
367
  let t = "";
368
368
  try {
369
369
  if (typeof crypto < "u" && crypto.getRandomValues) {
@@ -373,14 +373,14 @@ const $t = () => {
373
373
  } catch {
374
374
  }
375
375
  return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${s}-${e}-${t}`;
376
- }, Ye = (s, e = !1) => {
376
+ }, qe = (s, e = !1) => {
377
377
  try {
378
378
  const t = new URL(s), r = t.protocol === "https:", n = t.protocol === "http:";
379
379
  return r || e && n;
380
380
  } catch {
381
381
  return !1;
382
382
  }
383
- }, Bt = (s) => {
383
+ }, Wt = (s) => {
384
384
  try {
385
385
  const t = new URL(window.location.href).hostname;
386
386
  if (!t || typeof t != "string")
@@ -398,28 +398,28 @@ const $t = () => {
398
398
  if (r.length === 2 ? n = r.join(".") : n = r.slice(-2).join("."), !n || n.split(".").length < 2)
399
399
  throw new Error("Invalid domain structure for SaaS");
400
400
  const i = `https://${s}.${n}/collect`;
401
- if (!Ye(i))
401
+ if (!qe(i))
402
402
  throw new Error("Generated URL failed validation");
403
403
  return i;
404
404
  } catch (e) {
405
405
  throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
406
406
  }
407
- }, Wt = (s) => {
407
+ }, Gt = (s) => {
408
408
  const e = {};
409
- s.integrations?.tracelog?.projectId && (e.saas = Bt(s.integrations.tracelog.projectId));
409
+ s.integrations?.tracelog?.projectId && (e.saas = Wt(s.integrations.tracelog.projectId));
410
410
  const t = s.integrations?.custom?.collectApiUrl;
411
411
  if (t) {
412
412
  const r = s.integrations?.custom?.allowHttp ?? !1;
413
- if (!Ye(t, r))
413
+ if (!qe(t, r))
414
414
  throw new Error("Invalid custom API URL");
415
415
  e.custom = t;
416
416
  }
417
417
  return e;
418
- }, de = (s, e = []) => {
418
+ }, he = (s, e = []) => {
419
419
  if (!s || typeof s != "string")
420
420
  return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof s } }), s || "";
421
421
  try {
422
- const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...ct, ...e])];
422
+ const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...ut, ...e])];
423
423
  let i = !1;
424
424
  const o = [];
425
425
  return n.forEach((c) => {
@@ -428,13 +428,13 @@ const $t = () => {
428
428
  } catch (t) {
429
429
  return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: s?.length } }), s;
430
430
  }
431
- }, He = (s) => {
431
+ }, xe = (s) => {
432
432
  if (!s || typeof s != "string" || s.trim().length === 0)
433
433
  return "";
434
434
  let e = s;
435
435
  s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
436
436
  let t = 0;
437
- for (const n of ut) {
437
+ for (const n of dt) {
438
438
  const i = e;
439
439
  e = e.replace(n, ""), i !== e && t++;
440
440
  }
@@ -444,11 +444,11 @@ const $t = () => {
444
444
  valueLength: s.length
445
445
  }
446
446
  }), e.trim();
447
- }, he = (s, e = 0) => {
447
+ }, fe = (s, e = 0) => {
448
448
  if (s == null)
449
449
  return null;
450
450
  if (typeof s == "string")
451
- return He(s);
451
+ return xe(s);
452
452
  if (typeof s == "number")
453
453
  return !Number.isFinite(s) || s < -Number.MAX_SAFE_INTEGER || s > Number.MAX_SAFE_INTEGER ? 0 : s;
454
454
  if (typeof s == "boolean")
@@ -456,38 +456,38 @@ const $t = () => {
456
456
  if (e > 10)
457
457
  return null;
458
458
  if (Array.isArray(s))
459
- return s.slice(0, 100).map((n) => he(n, e + 1)).filter((n) => n !== null);
459
+ return s.slice(0, 100).map((n) => fe(n, e + 1)).filter((n) => n !== null);
460
460
  if (typeof s == "object") {
461
461
  const t = {}, n = Object.entries(s).slice(0, 20);
462
462
  for (const [i, o] of n) {
463
- const l = He(i);
463
+ const l = xe(i);
464
464
  if (l) {
465
- const c = he(o, e + 1);
465
+ const c = fe(o, e + 1);
466
466
  c !== null && (t[l] = c);
467
467
  }
468
468
  }
469
469
  return t;
470
470
  }
471
471
  return null;
472
- }, Gt = (s) => {
472
+ }, Xt = (s) => {
473
473
  if (typeof s != "object" || s === null)
474
474
  return {};
475
475
  try {
476
- const e = he(s);
476
+ const e = fe(s);
477
477
  return typeof e == "object" && e !== null ? e : {};
478
478
  } catch (e) {
479
479
  const t = e instanceof Error ? e.message : String(e);
480
480
  throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
481
481
  }
482
- }, Xt = (s) => {
482
+ }, Qt = (s) => {
483
483
  if (s !== void 0 && (s === null || typeof s != "object"))
484
484
  throw new f("Configuration must be an object", "config");
485
485
  if (s) {
486
486
  if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
487
- throw new mt(m.INVALID_SESSION_TIMEOUT, "config");
487
+ throw new gt(m.INVALID_SESSION_TIMEOUT, "config");
488
488
  if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
489
489
  throw new f(m.INVALID_GLOBAL_METADATA, "config");
490
- if (s.integrations && jt(s.integrations), s.sensitiveQueryParams !== void 0) {
490
+ if (s.integrations && zt(s.integrations), s.sensitiveQueryParams !== void 0) {
491
491
  if (!Array.isArray(s.sensitiveQueryParams))
492
492
  throw new f(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
493
493
  for (const e of s.sensitiveQueryParams)
@@ -495,9 +495,9 @@ const $t = () => {
495
495
  throw new f("All sensitive query params must be strings", "config");
496
496
  }
497
497
  if (s.errorSampling !== void 0 && (typeof s.errorSampling != "number" || s.errorSampling < 0 || s.errorSampling > 1))
498
- throw new Ne(m.INVALID_ERROR_SAMPLING_RATE, "config");
498
+ throw new Oe(m.INVALID_ERROR_SAMPLING_RATE, "config");
499
499
  if (s.samplingRate !== void 0 && (typeof s.samplingRate != "number" || s.samplingRate < 0 || s.samplingRate > 1))
500
- throw new Ne(m.INVALID_SAMPLING_RATE, "config");
500
+ throw new Oe(m.INVALID_SAMPLING_RATE, "config");
501
501
  if (s.primaryScrollSelector !== void 0) {
502
502
  if (typeof s.primaryScrollSelector != "string" || !s.primaryScrollSelector.trim())
503
503
  throw new f(m.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
@@ -517,7 +517,7 @@ const $t = () => {
517
517
  throw new f(m.INVALID_CLICK_THROTTLE, "config");
518
518
  if (s.maxSameEventPerMinute !== void 0 && (typeof s.maxSameEventPerMinute != "number" || s.maxSameEventPerMinute <= 0))
519
519
  throw new f(m.INVALID_MAX_SAME_EVENT_PER_MINUTE, "config");
520
- if (s.viewport !== void 0 && Qt(s.viewport), s.webVitalsMode !== void 0) {
520
+ if (s.viewport !== void 0 && jt(s.viewport), s.webVitalsMode !== void 0) {
521
521
  if (typeof s.webVitalsMode != "string")
522
522
  throw new f(
523
523
  `Invalid webVitalsMode type: ${typeof s.webVitalsMode}. Must be a string`,
@@ -548,7 +548,7 @@ const $t = () => {
548
548
  }
549
549
  }
550
550
  }
551
- }, Qt = (s) => {
551
+ }, jt = (s) => {
552
552
  if (typeof s != "object" || s === null)
553
553
  throw new f(m.INVALID_VIEWPORT_CONFIG, "config");
554
554
  if (!s.elements || !Array.isArray(s.elements))
@@ -578,33 +578,33 @@ const $t = () => {
578
578
  throw new f(m.INVALID_VIEWPORT_COOLDOWN_PERIOD, "config");
579
579
  if (s.maxTrackedElements !== void 0 && (typeof s.maxTrackedElements != "number" || s.maxTrackedElements <= 0))
580
580
  throw new f(m.INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS, "config");
581
- }, jt = (s) => {
581
+ }, zt = (s) => {
582
582
  if (s) {
583
583
  if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
584
- throw new V(m.INVALID_TRACELOG_PROJECT_ID, "config");
584
+ throw new U(m.INVALID_TRACELOG_PROJECT_ID, "config");
585
585
  if (s.custom) {
586
586
  if (!s.custom.collectApiUrl || typeof s.custom.collectApiUrl != "string" || s.custom.collectApiUrl.trim() === "")
587
- throw new V(m.INVALID_CUSTOM_API_URL, "config");
587
+ throw new U(m.INVALID_CUSTOM_API_URL, "config");
588
588
  if (s.custom.allowHttp !== void 0 && typeof s.custom.allowHttp != "boolean")
589
- throw new V("allowHttp must be a boolean", "config");
589
+ throw new U("allowHttp must be a boolean", "config");
590
590
  const e = s.custom.collectApiUrl.trim();
591
591
  if (!e.startsWith("http://") && !e.startsWith("https://"))
592
- throw new V('Custom API URL must start with "http://" or "https://"', "config");
592
+ throw new U('Custom API URL must start with "http://" or "https://"', "config");
593
593
  if (!(s.custom.allowHttp ?? !1) && e.startsWith("http://"))
594
- throw new V(
594
+ throw new U(
595
595
  "Custom API URL must use HTTPS in production. Set allowHttp: true in integration config to allow HTTP (not recommended)",
596
596
  "config"
597
597
  );
598
598
  }
599
599
  }
600
- }, zt = (s) => {
601
- Xt(s);
600
+ }, Kt = (s) => {
601
+ Qt(s);
602
602
  const e = {
603
603
  ...s ?? {},
604
604
  sessionTimeout: s?.sessionTimeout ?? 9e5,
605
605
  globalMetadata: s?.globalMetadata ?? {},
606
606
  sensitiveQueryParams: s?.sensitiveQueryParams ?? [],
607
- errorSampling: s?.errorSampling ?? ze,
607
+ errorSampling: s?.errorSampling ?? Ke,
608
608
  samplingRate: s?.samplingRate ?? 1,
609
609
  pageViewThrottleMs: s?.pageViewThrottleMs ?? 1e3,
610
610
  clickThrottleMs: s?.clickThrottleMs ?? 300,
@@ -620,12 +620,12 @@ const $t = () => {
620
620
  cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
621
621
  maxTrackedElements: e.viewport.maxTrackedElements ?? 100
622
622
  }), e;
623
- }, fe = (s, e = /* @__PURE__ */ new Set()) => {
623
+ }, me = (s, e = /* @__PURE__ */ new Set()) => {
624
624
  if (s == null)
625
625
  return !0;
626
626
  const t = typeof s;
627
- return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(s) ? !1 : (e.add(s), Array.isArray(s) ? s.every((r) => fe(r, e)) : t === "object" ? Object.values(s).every((r) => fe(r, e)) : !1);
628
- }, Kt = (s) => typeof s != "object" || s === null ? !1 : fe(s), Yt = (s) => typeof s != "string" ? {
627
+ return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(s) ? !1 : (e.add(s), Array.isArray(s) ? s.every((r) => me(r, e)) : t === "object" ? Object.values(s).every((r) => me(r, e)) : !1);
628
+ }, Yt = (s) => typeof s != "object" || s === null ? !1 : me(s), qt = (s) => typeof s != "string" ? {
629
629
  valid: !1,
630
630
  error: "Event name must be a string"
631
631
  } : s.length === 0 ? {
@@ -640,9 +640,9 @@ const $t = () => {
640
640
  } : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(s.toLowerCase()) ? {
641
641
  valid: !1,
642
642
  error: "Event name cannot be a reserved word"
643
- } : { valid: !0 }, xe = (s, e, t) => {
644
- const r = Gt(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
645
- if (!Kt(r))
643
+ } : { valid: !0 }, Fe = (s, e, t) => {
644
+ const r = Xt(e), n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
645
+ if (!Yt(r))
646
646
  return {
647
647
  valid: !1,
648
648
  error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
@@ -690,7 +690,7 @@ const $t = () => {
690
690
  valid: !0,
691
691
  sanitizedMetadata: r
692
692
  };
693
- }, qe = (s, e, t) => {
693
+ }, Je = (s, e, t) => {
694
694
  if (Array.isArray(e)) {
695
695
  const r = [], n = t && t === "customEvent" ? `${t} "${s}" metadata error` : `${s} metadata error`;
696
696
  for (let i = 0; i < e.length; i++) {
@@ -700,7 +700,7 @@ const $t = () => {
700
700
  valid: !1,
701
701
  error: `${n}: array item at index ${i} must be an object.`
702
702
  };
703
- const l = xe(s, o, t);
703
+ const l = Fe(s, o, t);
704
704
  if (!l.valid)
705
705
  return {
706
706
  valid: !1,
@@ -713,16 +713,16 @@ const $t = () => {
713
713
  sanitizedMetadata: r
714
714
  };
715
715
  }
716
- return xe(s, e, t);
717
- }, qt = (s, e) => {
718
- const t = Yt(s);
716
+ return Fe(s, e, t);
717
+ }, Jt = (s, e) => {
718
+ const t = qt(s);
719
719
  if (!t.valid)
720
720
  return a("error", "Event name validation failed", {
721
721
  data: { eventName: s, error: t.error }
722
722
  }), t;
723
723
  if (!e)
724
724
  return { valid: !0 };
725
- const r = qe(s, e, "customEvent");
725
+ const r = Je(s, e, "customEvent");
726
726
  return r.valid || a("error", "Event metadata validation failed", {
727
727
  data: {
728
728
  eventName: s,
@@ -730,7 +730,7 @@ const $t = () => {
730
730
  }
731
731
  }), r;
732
732
  };
733
- class Jt {
733
+ class Zt {
734
734
  listeners = /* @__PURE__ */ new Map();
735
735
  /**
736
736
  * Subscribes to an event channel
@@ -847,7 +847,7 @@ class Jt {
847
847
  this.listeners.clear();
848
848
  }
849
849
  }
850
- function Je(s, e, t) {
850
+ function Ze(s, e, t) {
851
851
  try {
852
852
  const r = e(s);
853
853
  return r === null ? null : typeof r == "object" && r !== null && "type" in r ? r : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), s);
@@ -858,10 +858,10 @@ function Je(s, e, t) {
858
858
  }), s;
859
859
  }
860
860
  }
861
- function Zt(s, e, t) {
862
- return s.map((r) => Je(r, e, t)).filter((r) => r !== null);
861
+ function er(s, e, t) {
862
+ return s.map((r) => Ze(r, e, t)).filter((r) => r !== null);
863
863
  }
864
- function Ze(s, e, t) {
864
+ function et(s, e, t) {
865
865
  try {
866
866
  const r = e(s);
867
867
  return r === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
@@ -877,8 +877,8 @@ function Ze(s, e, t) {
877
877
  }), s;
878
878
  }
879
879
  }
880
- const ne = {};
881
- class I {
880
+ const ie = {};
881
+ class _ {
882
882
  /**
883
883
  * Retrieves a value from global state.
884
884
  *
@@ -896,7 +896,7 @@ class I {
896
896
  * ```
897
897
  */
898
898
  get(e) {
899
- return ne[e];
899
+ return ie[e];
900
900
  }
901
901
  /**
902
902
  * Sets a value in global state.
@@ -916,7 +916,7 @@ class I {
916
916
  * ```
917
917
  */
918
918
  set(e, t) {
919
- ne[e] = t;
919
+ ie[e] = t;
920
920
  }
921
921
  /**
922
922
  * Returns an immutable snapshot of the entire global state.
@@ -933,10 +933,10 @@ class I {
933
933
  * ```
934
934
  */
935
935
  getState() {
936
- return { ...ne };
936
+ return { ...ie };
937
937
  }
938
938
  }
939
- class Fe extends I {
939
+ class $e extends _ {
940
940
  storeManager;
941
941
  integrationId;
942
942
  apiUrl;
@@ -1011,7 +1011,7 @@ class Fe extends I {
1011
1011
  return { ...this.staticHeaders, ...e };
1012
1012
  }
1013
1013
  getQueueStorageKey() {
1014
- const e = this.get("userId") || "anonymous", t = dt(e);
1014
+ const e = this.get("userId") || "anonymous", t = ht(e);
1015
1015
  return this.integrationId ? `${t}:${this.integrationId}` : t;
1016
1016
  }
1017
1017
  /**
@@ -1048,13 +1048,13 @@ class Fe extends I {
1048
1048
  * @see src/managers/README.md (lines 82-139) for send details
1049
1049
  */
1050
1050
  sendEventsQueueSync(e) {
1051
- return this.shouldSkipSend() ? !0 : this.apiUrl?.includes(U.Fail) ? (a(
1051
+ return this.shouldSkipSend() ? !0 : this.apiUrl?.includes(H.Fail) ? (a(
1052
1052
  "warn",
1053
1053
  `Fail mode: simulating network failure (sync)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
1054
1054
  {
1055
1055
  data: { events: e.events.length }
1056
1056
  }
1057
- ), !1) : this.apiUrl?.includes(U.Localhost) ? (a(
1057
+ ), !1) : this.apiUrl?.includes(H.Localhost) ? (a(
1058
1058
  "debug",
1059
1059
  `Success mode: simulating successful send (sync)${this.integrationId ? ` [${this.integrationId}]` : ""}`,
1060
1060
  {
@@ -1096,7 +1096,7 @@ class Fe extends I {
1096
1096
  const r = await this.send(e);
1097
1097
  return r ? (this.clearPersistedEvents(), t?.onSuccess?.(e.events.length, e.events, e)) : (this.persistEvents(e), t?.onFailure?.()), r;
1098
1098
  } catch (r) {
1099
- return r instanceof O ? (this.logPermanentError("Permanent error, not retrying", r), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(e), t?.onFailure?.(), !1);
1099
+ return r instanceof P ? (this.logPermanentError("Permanent error, not retrying", r), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(e), t?.onFailure?.(), !1);
1100
1100
  }
1101
1101
  }
1102
1102
  /**
@@ -1163,7 +1163,7 @@ class Fe extends I {
1163
1163
  const r = this.createRecoveryBody(t);
1164
1164
  await this.send(r) ? (this.clearPersistedEvents(), e?.onSuccess?.(t.events.length, t.events, r)) : e?.onFailure?.();
1165
1165
  } catch (t) {
1166
- if (t instanceof O) {
1166
+ if (t instanceof P) {
1167
1167
  this.logPermanentError("Permanent error during recovery, clearing persisted events", t), this.clearPersistedEvents(), e?.onFailure?.();
1168
1168
  return;
1169
1169
  }
@@ -1217,7 +1217,7 @@ class Fe extends I {
1217
1217
  const t = this.transformers.beforeSend;
1218
1218
  if (!t)
1219
1219
  return e;
1220
- const r = Zt(
1220
+ const r = er(
1221
1221
  e.events,
1222
1222
  t,
1223
1223
  this.integrationId || "SenderManager"
@@ -1262,7 +1262,7 @@ class Fe extends I {
1262
1262
  if (this.integrationId === "saas")
1263
1263
  return e;
1264
1264
  const t = this.transformers.beforeBatch;
1265
- return t ? Ze(e, t, this.integrationId || "SenderManager") : e;
1265
+ return t ? et(e, t, this.integrationId || "SenderManager") : e;
1266
1266
  }
1267
1267
  /**
1268
1268
  * Calculates exponential backoff delay with jitter for retry attempts.
@@ -1330,11 +1330,11 @@ class Fe extends I {
1330
1330
  const r = this.applyBeforeBatchTransformer(t);
1331
1331
  if (!r)
1332
1332
  return !0;
1333
- if (this.apiUrl?.includes(U.Fail))
1333
+ if (this.apiUrl?.includes(H.Fail))
1334
1334
  return a("debug", `Fail mode: simulating network failure${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1335
1335
  data: { events: r.events.length }
1336
1336
  }), !1;
1337
- if (this.apiUrl?.includes(U.Localhost))
1337
+ if (this.apiUrl?.includes(H.Localhost))
1338
1338
  return a("debug", `Success mode: simulating successful send${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1339
1339
  data: { events: r.events.length }
1340
1340
  }), !0;
@@ -1350,7 +1350,7 @@ class Fe extends I {
1350
1350
  ), !0) : !1;
1351
1351
  } catch (l) {
1352
1352
  const c = o === 3;
1353
- if (l instanceof O)
1353
+ if (l instanceof P)
1354
1354
  throw l;
1355
1355
  if (a(
1356
1356
  c ? "error" : "warn",
@@ -1412,7 +1412,7 @@ class Fe extends I {
1412
1412
  }
1413
1413
  });
1414
1414
  if (!o.ok)
1415
- throw o.status >= 400 && o.status < 500 && o.status !== 408 && o.status !== 429 ? new O(`HTTP ${o.status}: ${o.statusText}`, o.status) : new Error(`HTTP ${o.status}: ${o.statusText}`);
1415
+ throw o.status >= 400 && o.status < 500 && o.status !== 408 && o.status !== 429 ? new P(`HTTP ${o.status}: ${o.statusText}`, o.status) : new Error(`HTTP ${o.status}: ${o.statusText}`);
1416
1416
  return o;
1417
1417
  } finally {
1418
1418
  clearTimeout(n), this.pendingControllers.delete(r);
@@ -1496,7 +1496,7 @@ class Fe extends I {
1496
1496
  _metadata: {
1497
1497
  referer: typeof window < "u" ? window.location.href : void 0,
1498
1498
  timestamp: t,
1499
- client_version: Dt
1499
+ client_version: Vt
1500
1500
  }
1501
1501
  };
1502
1502
  return {
@@ -1617,12 +1617,12 @@ class Fe extends I {
1617
1617
  }
1618
1618
  logPermanentError(e, t) {
1619
1619
  const r = Date.now();
1620
- (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= Ct) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1620
+ (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= Rt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
1621
1621
  data: { status: t.statusCode, message: t.message }
1622
1622
  }), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
1623
1623
  }
1624
1624
  }
1625
- class er extends I {
1625
+ class tr extends _ {
1626
1626
  bootTime;
1627
1627
  bootTimestamp;
1628
1628
  hasPerformanceNow;
@@ -1771,7 +1771,8 @@ class er extends I {
1771
1771
  };
1772
1772
  }
1773
1773
  }
1774
- class tr extends I {
1774
+ const rr = new Set(Object.values(d));
1775
+ class sr extends _ {
1775
1776
  dataSenders;
1776
1777
  emitter;
1777
1778
  transformers;
@@ -1781,6 +1782,8 @@ class tr extends I {
1781
1782
  eventsQueue = [];
1782
1783
  pendingEventsBuffer = [];
1783
1784
  sendIntervalId = null;
1785
+ sendInProgress = !1;
1786
+ consecutiveSendFailures = 0;
1784
1787
  rateLimitCounter = 0;
1785
1788
  rateLimitWindowStart = 0;
1786
1789
  lastSessionId = null;
@@ -1807,10 +1810,10 @@ class tr extends I {
1807
1810
  * @param customHeadersProvider - Optional callback for dynamic headers
1808
1811
  */
1809
1812
  constructor(e, t = null, r = {}, n = {}, i) {
1810
- super(), this.emitter = t, this.transformers = r, this.timeManager = new er(), this.dataSenders = [];
1813
+ super(), this.emitter = t, this.transformers = r, this.timeManager = new tr(), this.dataSenders = [];
1811
1814
  const o = this.get("collectApiUrls");
1812
- o?.saas && this.dataSenders.push(new Fe(e, "saas", o.saas, r)), o?.custom && this.dataSenders.push(
1813
- new Fe(
1815
+ o?.saas && this.dataSenders.push(new $e(e, "saas", o.saas, r)), o?.custom && this.dataSenders.push(
1816
+ new $e(
1814
1817
  e,
1815
1818
  "custom",
1816
1819
  o.custom,
@@ -1937,6 +1940,12 @@ class tr extends I {
1937
1940
  a("error", "Event type is required - event will be ignored");
1938
1941
  return;
1939
1942
  }
1943
+ if (!rr.has(e)) {
1944
+ a("error", "Invalid event type - event will be ignored", {
1945
+ data: { type: e }
1946
+ });
1947
+ return;
1948
+ }
1940
1949
  const g = this.get("sessionId");
1941
1950
  if (!g) {
1942
1951
  this.pendingEventsBuffer.length >= 100 && (this.pendingEventsBuffer.shift(), a("debug", "Pending events buffer full - dropping oldest event", {
@@ -1975,12 +1984,12 @@ class tr extends I {
1975
1984
  }
1976
1985
  const T = this.getTypeLimitForEvent(E);
1977
1986
  if (T) {
1978
- const te = this.sessionEventCounts[E];
1979
- if (te !== void 0 && te >= T) {
1987
+ const re = this.sessionEventCounts[E];
1988
+ if (re !== void 0 && re >= T) {
1980
1989
  a("warn", "Session event type limit reached", {
1981
1990
  data: {
1982
1991
  type: E,
1983
- count: te,
1992
+ count: re,
1984
1993
  limit: T
1985
1994
  }
1986
1995
  });
@@ -1993,9 +2002,9 @@ class tr extends I {
1993
2002
  if (!this.checkPerEventRateLimit(o.name, T))
1994
2003
  return;
1995
2004
  }
1996
- const we = E === d.SESSION_START, B = t || this.get("pageUrl"), k = this.buildEventPayload({
2005
+ const ye = E === d.SESSION_START, W = t || this.get("pageUrl"), k = this.buildEventPayload({
1997
2006
  type: E,
1998
- page_url: B,
2007
+ page_url: W,
1999
2008
  from_page_url: r,
2000
2009
  scroll_data: n,
2001
2010
  click_data: i,
@@ -2006,7 +2015,7 @@ class tr extends I {
2006
2015
  page_view: S
2007
2016
  });
2008
2017
  if (k && !(!p && !this.shouldSample())) {
2009
- if (we) {
2018
+ if (ye) {
2010
2019
  const T = this.get("sessionId");
2011
2020
  if (!T) {
2012
2021
  a("error", "Session start event requires sessionId - event will be ignored");
@@ -2021,7 +2030,7 @@ class tr extends I {
2021
2030
  this.set("hasStartSession", !0);
2022
2031
  }
2023
2032
  if (!this.isDuplicateEvent(k)) {
2024
- if (this.get("mode") === K.QA) {
2033
+ if (this.get("mode") === Y.QA) {
2025
2034
  if (E === d.CUSTOM && o) {
2026
2035
  a("info", `Custom Event: ${o.name}`, {
2027
2036
  visibility: "qa",
@@ -2062,7 +2071,7 @@ class tr extends I {
2062
2071
  * and allow subsequent init() → destroy() → init() cycles.
2063
2072
  *
2064
2073
  * **Cleanup Actions**:
2065
- * 1. **Clear send interval**: Stops periodic 10-second queue flush timer
2074
+ * 1. **Clear send timeout**: Cancels pending queue flush timeout and resets backoff state
2066
2075
  * 2. **Clear all queues and buffers**:
2067
2076
  * - `eventsQueue`: Discarded (not sent)
2068
2077
  * - `pendingEventsBuffer`: Discarded (events before session init)
@@ -2072,8 +2081,8 @@ class tr extends I {
2072
2081
  * 6. **Stop SenderManagers**: Calls `stop()` on all SenderManager instances
2073
2082
  *
2074
2083
  * **Important Behavior**:
2075
- * - **No final flush**: Events in queue are NOT sent before stopping
2076
- * - For flush before destroy, call `flushImmediatelySync()` first
2084
+ * - **No final flush**: `stop()` itself does NOT send queued events
2085
+ * - `App.destroy()` calls `flushImmediatelySync()` before `stop()` automatically
2077
2086
  *
2078
2087
  * **Multi-Integration**:
2079
2088
  * - Stops all SenderManager instances (SaaS + Custom)
@@ -2090,7 +2099,7 @@ class tr extends I {
2090
2099
  * @see src/managers/README.md (lines 5-75) for cleanup details
2091
2100
  */
2092
2101
  stop() {
2093
- this.sendIntervalId && (clearInterval(this.sendIntervalId), this.sendIntervalId = null);
2102
+ this.clearSendInterval(), this.sendInProgress = !1, this.consecutiveSendFailures = 0;
2094
2103
  const e = this.get("sessionId");
2095
2104
  e && this.saveSessionCounts(e), this.eventsQueue = [], this.pendingEventsBuffer = [], this.recentEventFingerprints.clear(), this.rateLimitCounter = 0, this.rateLimitWindowStart = 0, this.perEventRateLimits.clear(), this.sessionEventCounts = {
2096
2105
  total: 0,
@@ -2107,7 +2116,7 @@ class tr extends I {
2107
2116
  * Flushes all events in the queue asynchronously.
2108
2117
  *
2109
2118
  * **Purpose**: Force immediate sending of queued events without waiting for
2110
- * the 10-second periodic flush timer.
2119
+ * the scheduled queue flush timeout.
2111
2120
  *
2112
2121
  * **Use Cases**:
2113
2122
  * - Manual flush triggered by user action
@@ -2304,7 +2313,7 @@ class tr extends I {
2304
2313
  });
2305
2314
  }
2306
2315
  clearSendInterval() {
2307
- this.sendIntervalId && (clearInterval(this.sendIntervalId), this.sendIntervalId = null);
2316
+ this.sendIntervalId !== null && (clearTimeout(this.sendIntervalId), this.sendIntervalId = null);
2308
2317
  }
2309
2318
  isSuccessfulResult(e) {
2310
2319
  return e.status === "fulfilled" && e.value === !0;
@@ -2338,32 +2347,37 @@ class tr extends I {
2338
2347
  }
2339
2348
  }
2340
2349
  async sendEventsQueue() {
2341
- if (!this.get("sessionId") || this.eventsQueue.length === 0)
2342
- return;
2343
- const e = this.buildEventsPayload();
2344
- if (this.dataSenders.length === 0) {
2345
- this.emitEventsQueue(e);
2346
- return;
2347
- }
2348
- const t = [...this.eventsQueue], r = t.map((l) => l.id), n = this.dataSenders.map(
2349
- async (l) => l.sendEventsQueue(e, {
2350
- onSuccess: () => {
2351
- },
2352
- onFailure: () => {
2350
+ if (!(!this.get("sessionId") || this.eventsQueue.length === 0 || this.sendInProgress)) {
2351
+ this.sendInProgress = !0;
2352
+ try {
2353
+ const e = this.buildEventsPayload();
2354
+ if (this.dataSenders.length === 0) {
2355
+ this.emitEventsQueue(e);
2356
+ return;
2353
2357
  }
2354
- })
2355
- ), i = await Promise.allSettled(n);
2356
- if (i.some((l) => this.isSuccessfulResult(l))) {
2357
- this.removeProcessedEvents(r), this.emitEventsQueue(e);
2358
- const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
2359
- l > 0 && a("debug", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
2360
- data: { eventCount: t.length, failedCount: l }
2361
- });
2362
- } else
2363
- a("debug", "Periodic send complete failure, events kept in queue for retry", {
2364
- data: { eventCount: t.length }
2365
- });
2366
- this.eventsQueue.length === 0 && this.clearSendInterval();
2358
+ const t = [...this.eventsQueue], r = t.map((l) => l.id), n = this.dataSenders.map(
2359
+ async (l) => l.sendEventsQueue(e, {
2360
+ onSuccess: () => {
2361
+ },
2362
+ onFailure: () => {
2363
+ }
2364
+ })
2365
+ ), i = await Promise.allSettled(n);
2366
+ if (i.some((l) => this.isSuccessfulResult(l))) {
2367
+ this.consecutiveSendFailures = 0, this.removeProcessedEvents(r), this.emitEventsQueue(e);
2368
+ const l = i.filter((c) => !this.isSuccessfulResult(c)).length;
2369
+ l > 0 && a("debug", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
2370
+ data: { eventCount: t.length, failedCount: l }
2371
+ });
2372
+ } else
2373
+ this.consecutiveSendFailures++, a("debug", "Periodic send complete failure, events kept in queue for retry", {
2374
+ data: { eventCount: t.length }
2375
+ });
2376
+ this.eventsQueue.length === 0 ? this.clearSendInterval() : this.scheduleSendTimeout();
2377
+ } finally {
2378
+ this.sendInProgress = !1;
2379
+ }
2380
+ }
2367
2381
  }
2368
2382
  buildEventsPayload() {
2369
2383
  const e = /* @__PURE__ */ new Map(), t = [];
@@ -2381,7 +2395,7 @@ class tr extends I {
2381
2395
  };
2382
2396
  const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
2383
2397
  if (!o && l) {
2384
- const c = Ze(n, l, "EventManager");
2398
+ const c = et(n, l, "EventManager");
2385
2399
  c !== null && (n = c);
2386
2400
  }
2387
2401
  return n;
@@ -2393,7 +2407,7 @@ class tr extends I {
2393
2407
  });
2394
2408
  const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
2395
2409
  let l = {
2396
- id: $t(),
2410
+ id: Bt(),
2397
2411
  type: e.type,
2398
2412
  page_url: t,
2399
2413
  timestamp: r,
@@ -2410,10 +2424,10 @@ class tr extends I {
2410
2424
  };
2411
2425
  const c = this.get("collectApiUrls"), u = !!c?.custom, S = !!c?.saas, g = u || S, p = u && S, E = this.transformers.beforeSend;
2412
2426
  if (E && (!g || u && !p)) {
2413
- const B = Je(l, E, "EventManager");
2414
- if (B === null)
2427
+ const W = Ze(l, E, "EventManager");
2428
+ if (W === null)
2415
2429
  return null;
2416
- l = B;
2430
+ l = W;
2417
2431
  }
2418
2432
  return l;
2419
2433
  }
@@ -2457,12 +2471,19 @@ class tr extends I {
2457
2471
  }
2458
2472
  });
2459
2473
  }
2460
- this.sendIntervalId || this.startSendInterval(), this.eventsQueue.length >= 50 && this.sendEventsQueue();
2474
+ this.consecutiveSendFailures >= 5 && (this.consecutiveSendFailures = 0), this.scheduleSendTimeout(), this.eventsQueue.length >= 50 && this.sendEventsQueue();
2475
+ }
2476
+ scheduleSendTimeout() {
2477
+ if (this.sendIntervalId !== null || this.consecutiveSendFailures >= 5) return;
2478
+ const e = this.calculateSendDelay();
2479
+ this.sendIntervalId = window.setTimeout(() => {
2480
+ this.sendIntervalId = null, this.eventsQueue.length > 0 && this.sendEventsQueue();
2481
+ }, e);
2461
2482
  }
2462
- startSendInterval() {
2463
- this.sendIntervalId = window.setInterval(() => {
2464
- this.eventsQueue.length > 0 && this.sendEventsQueue();
2465
- }, 1e4);
2483
+ calculateSendDelay() {
2484
+ if (this.consecutiveSendFailures === 0) return 1e4;
2485
+ const e = 1e4 * Math.pow(2, this.consecutiveSendFailures);
2486
+ return Math.min(e, 12e4);
2466
2487
  }
2467
2488
  shouldSample() {
2468
2489
  const e = this.get("config")?.samplingRate ?? 1;
@@ -2496,10 +2517,10 @@ class tr extends I {
2496
2517
  this.eventsQueue = this.eventsQueue.filter((r) => !t.has(r.id));
2497
2518
  }
2498
2519
  emitEvent(e) {
2499
- this.emitter && this.emitter.emit(ae.EVENT, e);
2520
+ this.emitter && this.emitter.emit(le.EVENT, e);
2500
2521
  }
2501
2522
  emitEventsQueue(e) {
2502
- this.emitter && this.emitter.emit(ae.QUEUE, e);
2523
+ this.emitter && this.emitter.emit(le.QUEUE, e);
2503
2524
  }
2504
2525
  /**
2505
2526
  * Creates a debounced version of a function that delays execution until after
@@ -2575,13 +2596,13 @@ class tr extends I {
2575
2596
  loadSessionCounts(e) {
2576
2597
  if (typeof window > "u" || typeof localStorage > "u")
2577
2598
  return this.getInitialCounts();
2578
- const t = this.get("userId") || "anonymous", r = Ae(t, e);
2599
+ const t = this.get("userId") || "anonymous", r = Me(t, e);
2579
2600
  try {
2580
2601
  const n = localStorage.getItem(r);
2581
2602
  if (!n)
2582
2603
  return this.getInitialCounts();
2583
2604
  const i = JSON.parse(n);
2584
- return i._timestamp && Date.now() - i._timestamp > Me ? (a("debug", "Session counts expired, clearing", {
2605
+ return i._timestamp && Date.now() - i._timestamp > Ce ? (a("debug", "Session counts expired, clearing", {
2585
2606
  data: { sessionId: e, age: Date.now() - i._timestamp }
2586
2607
  }), localStorage.removeItem(r), this.getInitialCounts()) : typeof i.total == "number" && typeof i[d.CLICK] == "number" && typeof i[d.PAGE_VIEW] == "number" && typeof i[d.CUSTOM] == "number" && typeof i[d.VIEWPORT_VISIBLE] == "number" && typeof i[d.SCROLL] == "number" ? {
2587
2608
  total: i.total,
@@ -2626,17 +2647,17 @@ class tr extends I {
2626
2647
  cleanupExpiredSessionCounts() {
2627
2648
  if (!(typeof window > "u" || typeof localStorage > "u"))
2628
2649
  try {
2629
- const e = localStorage.getItem(Ce);
2650
+ const e = localStorage.getItem(Re);
2630
2651
  if (e) {
2631
2652
  const i = Date.now() - parseInt(e, 10);
2632
- if (i < Re) {
2653
+ if (i < Ne) {
2633
2654
  a("debug", "Skipping session counts cleanup (throttled)", {
2634
- data: { timeSinceLastCleanup: i, throttleMs: Re }
2655
+ data: { timeSinceLastCleanup: i, throttleMs: Ne }
2635
2656
  });
2636
2657
  return;
2637
2658
  }
2638
2659
  }
2639
- const t = this.get("userId") || "anonymous", r = `${_}:${t}:session_counts:`, n = [];
2660
+ const t = this.get("userId") || "anonymous", r = `${I}:${t}:session_counts:`, n = [];
2640
2661
  for (let i = 0; i < localStorage.length; i++) {
2641
2662
  const o = localStorage.key(i);
2642
2663
  if (o?.startsWith(r))
@@ -2644,14 +2665,14 @@ class tr extends I {
2644
2665
  const l = localStorage.getItem(o);
2645
2666
  if (l) {
2646
2667
  const c = JSON.parse(l);
2647
- c._timestamp && Date.now() - c._timestamp > Me && n.push(o);
2668
+ c._timestamp && Date.now() - c._timestamp > Ce && n.push(o);
2648
2669
  }
2649
2670
  } catch {
2650
2671
  }
2651
2672
  }
2652
2673
  n.forEach((i) => {
2653
2674
  localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
2654
- }), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(Ce, Date.now().toString());
2675
+ }), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(Re, Date.now().toString());
2655
2676
  } catch (e) {
2656
2677
  a("warn", "Failed to cleanup expired session counts", { error: e });
2657
2678
  }
@@ -2685,7 +2706,7 @@ class tr extends I {
2685
2706
  * @internal
2686
2707
  */
2687
2708
  saveSessionCounts(e) {
2688
- const t = this.get("userId") || "anonymous", r = Ae(t, e);
2709
+ const t = this.get("userId") || "anonymous", r = Me(t, e);
2689
2710
  try {
2690
2711
  const n = {
2691
2712
  ...this.sessionEventCounts,
@@ -2701,7 +2722,7 @@ class tr extends I {
2701
2722
  }
2702
2723
  }
2703
2724
  }
2704
- class rr {
2725
+ class nr {
2705
2726
  /**
2706
2727
  * Gets or creates a unique user ID.
2707
2728
  *
@@ -2719,15 +2740,15 @@ class rr {
2719
2740
  * @returns Persistent unique user ID (UUID v4 format)
2720
2741
  */
2721
2742
  static getId(e) {
2722
- const t = e.getItem(ye);
2743
+ const t = e.getItem(be);
2723
2744
  if (t)
2724
2745
  return t;
2725
- const r = Ft();
2726
- return e.setItem(ye, r), r;
2746
+ const r = $t();
2747
+ return e.setItem(be, r), r;
2727
2748
  }
2728
2749
  }
2729
- const sr = /^\d{13}-[a-z0-9]{9}$/;
2730
- class nr extends I {
2750
+ const ir = /^\d{13}-[a-z0-9]{9}$/;
2751
+ class or extends _ {
2731
2752
  storageManager;
2732
2753
  eventManager;
2733
2754
  projectId;
@@ -2753,7 +2774,7 @@ class nr extends I {
2753
2774
  return;
2754
2775
  }
2755
2776
  const e = this.getProjectId();
2756
- this.broadcastChannel = new BroadcastChannel(ft(e)), this.broadcastChannel.onmessage = (t) => {
2777
+ this.broadcastChannel = new BroadcastChannel(mt(e)), this.broadcastChannel.onmessage = (t) => {
2757
2778
  const { action: r, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
2758
2779
  o === e && (r === "session_start" && n && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", n), this.persistSession(n, i), this.isTracking && this.setupSessionTimeout()) : r && r !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: r } }));
2759
2780
  };
@@ -2773,7 +2794,7 @@ class nr extends I {
2773
2794
  const e = this.loadStoredSession();
2774
2795
  if (!e)
2775
2796
  return null;
2776
- if (!sr.test(e.id))
2797
+ if (!ir.test(e.id))
2777
2798
  return a("warn", "Invalid session ID format recovered from storage, clearing", {
2778
2799
  data: { sessionId: e.id }
2779
2800
  }), this.clearStoredSession(), null;
@@ -2808,7 +2829,7 @@ class nr extends I {
2808
2829
  this.storageManager.setItem(t, JSON.stringify(e));
2809
2830
  }
2810
2831
  getSessionStorageKey() {
2811
- return ht(this.getProjectId());
2832
+ return ft(this.getProjectId());
2812
2833
  }
2813
2834
  getProjectId() {
2814
2835
  return this.projectId;
@@ -2873,9 +2894,9 @@ class nr extends I {
2873
2894
  let r, n;
2874
2895
  if (e) {
2875
2896
  const i = this.loadStoredSession();
2876
- r = i?.referrer ?? re(), n = i?.utm ?? se();
2897
+ r = i?.referrer ?? se(), n = i?.utm ?? ne();
2877
2898
  } else
2878
- r = re(), n = se();
2899
+ r = se(), n = ne();
2879
2900
  a("debug", "Session tracking initialized", {
2880
2901
  data: {
2881
2902
  sessionId: t,
@@ -2926,7 +2947,7 @@ class nr extends I {
2926
2947
  */
2927
2948
  renewSession() {
2928
2949
  this.needsRenewal = !1;
2929
- const e = this.generateSessionId(), t = re(), r = se();
2950
+ const e = this.generateSessionId(), t = se(), r = ne();
2930
2951
  a("debug", "Renewing session after timeout", {
2931
2952
  data: { newSessionId: e }
2932
2953
  }), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", r), this.persistSession(e, Date.now(), t, r), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
@@ -3047,7 +3068,7 @@ class nr extends I {
3047
3068
  this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
3048
3069
  }
3049
3070
  }
3050
- class ir extends I {
3071
+ class ar extends _ {
3051
3072
  eventManager;
3052
3073
  storageManager;
3053
3074
  sessionManager = null;
@@ -3082,7 +3103,7 @@ class ir extends I {
3082
3103
  }
3083
3104
  const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
3084
3105
  try {
3085
- this.sessionManager = new nr(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
3106
+ this.sessionManager = new or(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
3086
3107
  } catch (r) {
3087
3108
  if (this.sessionManager) {
3088
3109
  try {
@@ -3135,7 +3156,7 @@ class ir extends I {
3135
3156
  this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
3136
3157
  }
3137
3158
  }
3138
- class or extends I {
3159
+ class lr extends _ {
3139
3160
  eventManager;
3140
3161
  onTrack;
3141
3162
  originalPushState;
@@ -3175,7 +3196,7 @@ class or extends I {
3175
3196
  };
3176
3197
  }
3177
3198
  trackCurrentPage = () => {
3178
- const e = window.location.href, t = de(e, this.get("config").sensitiveQueryParams);
3199
+ const e = window.location.href, t = he(e, this.get("config").sensitiveQueryParams);
3179
3200
  if (this.get("pageUrl") === t)
3180
3201
  return;
3181
3202
  const r = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
@@ -3193,7 +3214,7 @@ class or extends I {
3193
3214
  });
3194
3215
  };
3195
3216
  trackInitialPageView() {
3196
- const e = de(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
3217
+ const e = he(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
3197
3218
  this.lastPageViewTime = Date.now(), this.eventManager.track({
3198
3219
  type: d.PAGE_VIEW,
3199
3220
  page_url: e,
@@ -3211,7 +3232,7 @@ class or extends I {
3211
3232
  };
3212
3233
  }
3213
3234
  }
3214
- class ar extends I {
3235
+ class cr extends _ {
3215
3236
  eventManager;
3216
3237
  lastClickTimes = /* @__PURE__ */ new Map();
3217
3238
  clickHandler;
@@ -3349,7 +3370,7 @@ class ar extends I {
3349
3370
  return e.hasAttribute(`${w}-name`) ? e : e.closest(`[${w}-name]`);
3350
3371
  }
3351
3372
  getRelevantClickElement(e) {
3352
- for (const t of at)
3373
+ for (const t of lt)
3353
3374
  try {
3354
3375
  if (e.matches(t))
3355
3376
  return e;
@@ -3429,7 +3450,7 @@ class ar extends I {
3429
3450
  */
3430
3451
  sanitizeText(e) {
3431
3452
  let t = e;
3432
- for (const r of je) {
3453
+ for (const r of ze) {
3433
3454
  const n = new RegExp(r.source, r.flags);
3434
3455
  t = t.replace(n, "[REDACTED]");
3435
3456
  }
@@ -3468,7 +3489,7 @@ class ar extends I {
3468
3489
  };
3469
3490
  }
3470
3491
  }
3471
- class lr extends I {
3492
+ class ur extends _ {
3472
3493
  eventManager;
3473
3494
  containers = [];
3474
3495
  limitWarningLogged = !1;
@@ -3581,7 +3602,7 @@ class lr extends I {
3581
3602
  isPrimary: o,
3582
3603
  lastScrollPos: n,
3583
3604
  lastDepth: i,
3584
- lastDirection: Q.DOWN,
3605
+ lastDirection: j.DOWN,
3585
3606
  lastEventTime: 0,
3586
3607
  firstScrollEventTime: null,
3587
3608
  maxDepthReached: i,
@@ -3640,7 +3661,7 @@ class lr extends I {
3640
3661
  e.debounceTimer !== null && (clearTimeout(e.debounceTimer), e.debounceTimer = null);
3641
3662
  }
3642
3663
  getScrollDirection(e, t) {
3643
- return e > t ? Q.DOWN : Q.UP;
3664
+ return e > t ? j.DOWN : j.UP;
3644
3665
  }
3645
3666
  calculateScrollDepth(e, t, r) {
3646
3667
  if (t <= r)
@@ -3696,7 +3717,7 @@ class lr extends I {
3696
3717
  e.isPrimary = t;
3697
3718
  }
3698
3719
  }
3699
- class cr extends I {
3720
+ class dr extends _ {
3700
3721
  eventManager;
3701
3722
  trackedElements = /* @__PURE__ */ new Map();
3702
3723
  observer = null;
@@ -3857,7 +3878,7 @@ class cr extends I {
3857
3878
  });
3858
3879
  }
3859
3880
  }
3860
- class ur {
3881
+ class hr {
3861
3882
  storage;
3862
3883
  sessionStorageRef;
3863
3884
  fallbackStorage = /* @__PURE__ */ new Map();
@@ -4140,7 +4161,7 @@ class ur {
4140
4161
  this.fallbackSessionStorage.delete(e);
4141
4162
  }
4142
4163
  }
4143
- class dr extends I {
4164
+ class fr extends _ {
4144
4165
  eventManager;
4145
4166
  reportedByNav = /* @__PURE__ */ new Map();
4146
4167
  navigationHistory = [];
@@ -4151,7 +4172,7 @@ class dr extends I {
4151
4172
  navigationCounter = 0;
4152
4173
  // Counter for handling simultaneous navigations edge case
4153
4174
  constructor(e) {
4154
- super(), this.eventManager = e, this.vitalThresholds = Ve(ue);
4175
+ super(), this.eventManager = e, this.vitalThresholds = Ue(de);
4155
4176
  }
4156
4177
  /**
4157
4178
  * Starts tracking Web Vitals and performance metrics.
@@ -4168,8 +4189,8 @@ class dr extends I {
4168
4189
  * @returns Promise that resolves when tracking is initialized
4169
4190
  */
4170
4191
  async startTracking() {
4171
- const e = this.get("config"), t = e?.webVitalsMode ?? ue;
4172
- this.vitalThresholds = Ve(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
4192
+ const e = this.get("config"), t = e?.webVitalsMode ?? de;
4193
+ this.vitalThresholds = Ue(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
4173
4194
  }
4174
4195
  /**
4175
4196
  * Stops tracking Web Vitals and cleans up resources.
@@ -4239,7 +4260,7 @@ class dr extends I {
4239
4260
  }
4240
4261
  async initWebVitals() {
4241
4262
  try {
4242
- const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => xr), o = (l) => (c) => {
4263
+ const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => $r), o = (l) => (c) => {
4243
4264
  const u = Number(c.value.toFixed(2));
4244
4265
  this.sendVital({ type: l, value: u });
4245
4266
  };
@@ -4266,7 +4287,7 @@ class dr extends I {
4266
4287
  const t = e.getEntries();
4267
4288
  for (const r of t) {
4268
4289
  const n = Number(r.duration.toFixed(2)), i = Date.now();
4269
- i - this.lastLongTaskSentAt >= Nt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
4290
+ i - this.lastLongTaskSentAt >= Ot && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
4270
4291
  }
4271
4292
  },
4272
4293
  { type: "longtask", buffered: !0 }
@@ -4282,7 +4303,7 @@ class dr extends I {
4282
4303
  return;
4283
4304
  if (r)
4284
4305
  r.add(e.type);
4285
- else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Ot) {
4306
+ else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Pt) {
4286
4307
  const i = this.navigationHistory.shift();
4287
4308
  i && this.reportedByNav.delete(i);
4288
4309
  }
@@ -4373,7 +4394,7 @@ class dr extends I {
4373
4394
  return !(typeof r == "number" && t <= r);
4374
4395
  }
4375
4396
  }
4376
- class hr extends I {
4397
+ class mr extends _ {
4377
4398
  eventManager;
4378
4399
  recentErrors = /* @__PURE__ */ new Map();
4379
4400
  errorBurstCounter = 0;
@@ -4409,24 +4430,24 @@ class hr extends I {
4409
4430
  const e = Date.now();
4410
4431
  if (e < this.burstBackoffUntil)
4411
4432
  return !1;
4412
- if (e - this.burstWindowStart > At && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Mt)
4413
- return this.burstBackoffUntil = e + De, a("debug", "Error burst detected - entering cooldown", {
4433
+ if (e - this.burstWindowStart > Mt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Ct)
4434
+ return this.burstBackoffUntil = e + Ve, a("debug", "Error burst detected - entering cooldown", {
4414
4435
  data: {
4415
4436
  errorsInWindow: this.errorBurstCounter,
4416
- cooldownMs: De
4437
+ cooldownMs: Ve
4417
4438
  }
4418
4439
  }), !1;
4419
- const r = this.get("config")?.errorSampling ?? ze;
4440
+ const r = this.get("config")?.errorSampling ?? Ke;
4420
4441
  return Math.random() < r;
4421
4442
  }
4422
4443
  handleError = (e) => {
4423
4444
  if (!this.shouldSample())
4424
4445
  return;
4425
4446
  const t = this.sanitize(e.message || "Unknown error");
4426
- this.shouldSuppressError(H.JS_ERROR, t) || this.eventManager.track({
4447
+ this.shouldSuppressError(x.JS_ERROR, t) || this.eventManager.track({
4427
4448
  type: d.ERROR,
4428
4449
  error_data: {
4429
- type: H.JS_ERROR,
4450
+ type: x.JS_ERROR,
4430
4451
  message: t,
4431
4452
  ...e.filename && { filename: e.filename },
4432
4453
  ...e.lineno && { line: e.lineno },
@@ -4438,10 +4459,10 @@ class hr extends I {
4438
4459
  if (!this.shouldSample())
4439
4460
  return;
4440
4461
  const t = this.extractRejectionMessage(e.reason), r = this.sanitize(t);
4441
- this.shouldSuppressError(H.PROMISE_REJECTION, r) || this.eventManager.track({
4462
+ this.shouldSuppressError(x.PROMISE_REJECTION, r) || this.eventManager.track({
4442
4463
  type: d.ERROR,
4443
4464
  error_data: {
4444
- type: H.PROMISE_REJECTION,
4465
+ type: x.PROMISE_REJECTION,
4445
4466
  message: r
4446
4467
  }
4447
4468
  });
@@ -4460,8 +4481,8 @@ class hr extends I {
4460
4481
  }
4461
4482
  }
4462
4483
  sanitize(e) {
4463
- let t = e.length > Oe ? e.slice(0, Oe) + "..." : e;
4464
- for (const r of je) {
4484
+ let t = e.length > Pe ? e.slice(0, Pe) + "..." : e;
4485
+ for (const r of ze) {
4465
4486
  const n = new RegExp(r.source, r.flags);
4466
4487
  t = t.replace(n, "[REDACTED]");
4467
4488
  }
@@ -4469,25 +4490,26 @@ class hr extends I {
4469
4490
  }
4470
4491
  shouldSuppressError(e, t) {
4471
4492
  const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
4472
- return i && r - i < Pe ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > Lt ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > j && this.pruneOldErrors(), !1));
4493
+ return i && r - i < De ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > At ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > z && this.pruneOldErrors(), !1));
4473
4494
  }
4474
4495
  pruneOldErrors() {
4475
4496
  const e = Date.now();
4476
4497
  for (const [n, i] of this.recentErrors.entries())
4477
- e - i > Pe && this.recentErrors.delete(n);
4478
- if (this.recentErrors.size <= j)
4498
+ e - i > De && this.recentErrors.delete(n);
4499
+ if (this.recentErrors.size <= z)
4479
4500
  return;
4480
- const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), r = this.recentErrors.size - j;
4501
+ const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), r = this.recentErrors.size - z;
4481
4502
  for (let n = 0; n < r; n += 1) {
4482
4503
  const i = t[n];
4483
4504
  i && this.recentErrors.delete(i[0]);
4484
4505
  }
4485
4506
  }
4486
4507
  }
4487
- class fr extends I {
4508
+ class gr extends _ {
4488
4509
  isInitialized = !1;
4489
4510
  suppressNextScrollTimer = null;
4490
- emitter = new Jt();
4511
+ pageUnloadHandler = null;
4512
+ emitter = new Zt();
4491
4513
  transformers = {};
4492
4514
  customHeadersProvider;
4493
4515
  managers = {};
@@ -4505,17 +4527,17 @@ class fr extends I {
4505
4527
  async init(e = {}) {
4506
4528
  if (this.isInitialized)
4507
4529
  return { sessionId: this.get("sessionId") ?? "" };
4508
- this.managers.storage = new ur();
4530
+ this.managers.storage = new hr();
4509
4531
  try {
4510
4532
  this.setupState(e);
4511
4533
  const t = e.integrations?.custom?.headers ?? {};
4512
- return this.managers.event = new tr(
4534
+ return this.managers.event = new sr(
4513
4535
  this.managers.storage,
4514
4536
  this.emitter,
4515
4537
  this.transformers,
4516
4538
  t,
4517
4539
  this.customHeadersProvider
4518
- ), this.initializeHandlers(), await this.managers.event.recoverPersistedEvents().catch((r) => {
4540
+ ), this.initializeHandlers(), this.setupPageLifecycleListeners(), await this.managers.event.recoverPersistedEvents().catch((r) => {
4519
4541
  a("warn", "Failed to recover persisted events", { error: r });
4520
4542
  }), this.isInitialized = !0, { sessionId: this.get("sessionId") ?? "" };
4521
4543
  } catch (t) {
@@ -4538,10 +4560,11 @@ class fr extends I {
4538
4560
  }
4539
4561
  let r = t;
4540
4562
  t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
4541
- const { valid: n, error: i, sanitizedMetadata: o } = qt(e, r);
4563
+ const { valid: n, error: i, sanitizedMetadata: o } = Jt(e, r);
4542
4564
  if (!n) {
4543
- if (this.get("mode") === K.QA)
4565
+ if (this.get("mode") === Y.QA)
4544
4566
  throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
4567
+ a("warn", `Custom event "${e}" dropped: ${i}`);
4545
4568
  return;
4546
4569
  }
4547
4570
  this.managers.event.track({
@@ -4603,18 +4626,18 @@ class fr extends I {
4603
4626
  } catch (r) {
4604
4627
  a("warn", "Failed to stop tracking", { error: r });
4605
4628
  }
4606
- }), this.suppressNextScrollTimer && (clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = null), this.managers.event?.stop(), this.emitter.removeAllListeners(), this.transformers.beforeSend = void 0, this.transformers.beforeBatch = void 0, this.customHeadersProvider = void 0, this.set("suppressNextScroll", !1), this.set("sessionId", null), this.isInitialized = !1, this.handlers = {}, this.managers = {});
4629
+ }), this.suppressNextScrollTimer && (clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = null), this.pageUnloadHandler && (window.removeEventListener("pagehide", this.pageUnloadHandler), window.removeEventListener("beforeunload", this.pageUnloadHandler), this.pageUnloadHandler = null), this.managers.event?.flushImmediatelySync(), this.managers.event?.stop(), this.emitter.removeAllListeners(), this.transformers.beforeSend = void 0, this.transformers.beforeBatch = void 0, this.customHeadersProvider = void 0, this.set("suppressNextScroll", !1), this.set("sessionId", null), this.isInitialized = !1, this.handlers = {}, this.managers = {});
4607
4630
  }
4608
4631
  setupState(e = {}) {
4609
4632
  this.set("config", e);
4610
- const t = rr.getId(this.managers.storage);
4633
+ const t = nr.getId(this.managers.storage);
4611
4634
  this.set("userId", t);
4612
- const r = Wt(e);
4635
+ const r = Gt(e);
4613
4636
  this.set("collectApiUrls", r);
4614
- const n = bt();
4637
+ const n = Lt();
4615
4638
  this.set("device", n);
4616
- const i = de(window.location.href, e.sensitiveQueryParams);
4617
- this.set("pageUrl", i), Vt() && this.set("mode", K.QA);
4639
+ const i = he(window.location.href, e.sensitiveQueryParams);
4640
+ this.set("pageUrl", i), Ut() && this.set("mode", Y.QA);
4618
4641
  }
4619
4642
  /**
4620
4643
  * Returns the current configuration object.
@@ -4665,7 +4688,7 @@ class fr extends I {
4665
4688
  valid: !1,
4666
4689
  error: "Global metadata must be a plain object"
4667
4690
  };
4668
- const t = qe("Global", e, "globalMetadata");
4691
+ const t = Je("Global", e, "globalMetadata");
4669
4692
  return t.valid ? { valid: !0 } : {
4670
4693
  valid: !1,
4671
4694
  error: t.error
@@ -4708,9 +4731,14 @@ class fr extends I {
4708
4731
  };
4709
4732
  this.set("config", o), a("debug", "Global metadata updated (merged)", { data: { keys: Object.keys(e) } });
4710
4733
  }
4734
+ setupPageLifecycleListeners() {
4735
+ this.pageUnloadHandler = () => {
4736
+ this.managers.event?.flushImmediatelySync();
4737
+ }, window.addEventListener("pagehide", this.pageUnloadHandler), window.addEventListener("beforeunload", this.pageUnloadHandler);
4738
+ }
4711
4739
  initializeHandlers() {
4712
4740
  const e = this.get("config");
4713
- this.handlers.session = new ir(
4741
+ this.handlers.session = new ar(
4714
4742
  this.managers.storage,
4715
4743
  this.managers.event
4716
4744
  ), this.handlers.session.startTracking();
@@ -4719,31 +4747,22 @@ class fr extends I {
4719
4747
  this.set("suppressNextScroll", !1);
4720
4748
  }, 500);
4721
4749
  };
4722
- this.handlers.pageView = new or(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new ar(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new lr(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new dr(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
4750
+ this.handlers.pageView = new lr(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new cr(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new ur(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new fr(this.managers.event), this.handlers.performance.startTracking().catch((r) => {
4723
4751
  a("warn", "Failed to start performance tracking", { error: r });
4724
- }), this.handlers.error = new hr(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new cr(this.managers.event), this.handlers.viewport.startTracking());
4752
+ }), this.handlers.error = new mr(this.managers.event), this.handlers.error.startTracking(), e.viewport && (this.handlers.viewport = new dr(this.managers.event), this.handlers.viewport.startTracking());
4725
4753
  }
4726
4754
  }
4727
- const N = [], M = [];
4728
- let R = null, h = null, C = !1, v = !1;
4729
- const mr = async (s) => {
4730
- if (typeof window > "u" || typeof document > "u")
4731
- return { sessionId: "" };
4732
- if (v = !1, window.__traceLogDisabled === !0)
4733
- return { sessionId: "" };
4734
- if (h)
4735
- return { sessionId: h.getSessionId() ?? "" };
4736
- if (C)
4737
- return { sessionId: "" };
4738
- C = !0;
4755
+ const O = [], M = [];
4756
+ let N = null, h = null, C = !1, v = !1, R = null;
4757
+ const Er = async (s) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (v = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : h ? { sessionId: h.getSessionId() ?? "" } : (C && R || (C = !0, R = (async () => {
4739
4758
  try {
4740
- const e = zt(s ?? {}), t = new fr();
4759
+ const e = Kt(s ?? {}), t = new gr();
4741
4760
  try {
4742
- N.forEach(({ event: o, callback: l }) => {
4761
+ O.forEach(({ event: o, callback: l }) => {
4743
4762
  t.on(o, l);
4744
- }), N.length = 0, M.forEach(({ hook: o, fn: l }) => {
4763
+ }), O.length = 0, M.forEach(({ hook: o, fn: l }) => {
4745
4764
  o === "beforeSend" ? t.setTransformer("beforeSend", l) : t.setTransformer("beforeBatch", l);
4746
- }), M.length = 0, R && (t.setCustomHeaders(R), R = null);
4765
+ }), M.length = 0, N && (t.setCustomHeaders(N), N = null);
4747
4766
  const r = t.init(e), n = new Promise((o, l) => {
4748
4767
  setTimeout(() => {
4749
4768
  l(new Error("[TraceLog] Initialization timeout after 10000ms"));
@@ -4761,9 +4780,9 @@ const mr = async (s) => {
4761
4780
  } catch (e) {
4762
4781
  throw h = null, e;
4763
4782
  } finally {
4764
- C = !1;
4783
+ C = !1, R = null;
4765
4784
  }
4766
- }, gr = (s, e) => {
4785
+ })()), R)), Sr = (s, e) => {
4767
4786
  if (!(typeof window > "u" || typeof document > "u")) {
4768
4787
  if (!h)
4769
4788
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
@@ -4771,25 +4790,25 @@ const mr = async (s) => {
4771
4790
  throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
4772
4791
  h.sendCustomEvent(s, e);
4773
4792
  }
4774
- }, Er = (s, e) => {
4793
+ }, pr = (s, e) => {
4775
4794
  if (!(typeof window > "u" || typeof document > "u")) {
4776
4795
  if (!h || C) {
4777
- N.push({ event: s, callback: e });
4796
+ O.push({ event: s, callback: e });
4778
4797
  return;
4779
4798
  }
4780
4799
  h.on(s, e);
4781
4800
  }
4782
- }, Sr = (s, e) => {
4801
+ }, Tr = (s, e) => {
4783
4802
  if (!(typeof window > "u" || typeof document > "u")) {
4784
4803
  if (!h) {
4785
- const t = N.findIndex((r) => r.event === s && r.callback === e);
4786
- t !== -1 && N.splice(t, 1);
4804
+ const t = O.findIndex((r) => r.event === s && r.callback === e);
4805
+ t !== -1 && O.splice(t, 1);
4787
4806
  return;
4788
4807
  }
4789
4808
  h.off(s, e);
4790
4809
  }
4791
4810
  };
4792
- function pr(s, e) {
4811
+ function vr(s, e) {
4793
4812
  if (!(typeof window > "u" || typeof document > "u")) {
4794
4813
  if (typeof e != "function")
4795
4814
  throw new Error(`[TraceLog] Transformer must be a function, received: ${typeof e}`);
@@ -4803,7 +4822,7 @@ function pr(s, e) {
4803
4822
  s === "beforeSend" ? h.setTransformer("beforeSend", e) : h.setTransformer("beforeBatch", e);
4804
4823
  }
4805
4824
  }
4806
- const Tr = (s) => {
4825
+ const _r = (s) => {
4807
4826
  if (!(typeof window > "u" || typeof document > "u")) {
4808
4827
  if (!h) {
4809
4828
  const e = M.findIndex((t) => t.hook === s);
@@ -4814,29 +4833,29 @@ const Tr = (s) => {
4814
4833
  throw new Error("[TraceLog] Cannot remove transformers while TraceLog is being destroyed");
4815
4834
  h.removeTransformer(s);
4816
4835
  }
4817
- }, vr = (s) => {
4836
+ }, Ir = (s) => {
4818
4837
  if (!(typeof window > "u" || typeof document > "u")) {
4819
4838
  if (typeof s != "function")
4820
4839
  throw new Error(`[TraceLog] Custom headers provider must be a function, received: ${typeof s}`);
4821
4840
  if (!h || C) {
4822
- R = s;
4841
+ N = s;
4823
4842
  return;
4824
4843
  }
4825
4844
  if (v)
4826
4845
  throw new Error("[TraceLog] Cannot set custom headers while TraceLog is being destroyed");
4827
4846
  h.setCustomHeaders(s);
4828
4847
  }
4829
- }, Ir = () => {
4848
+ }, wr = () => {
4830
4849
  if (!(typeof window > "u" || typeof document > "u")) {
4831
4850
  if (!h) {
4832
- R = null;
4851
+ N = null;
4833
4852
  return;
4834
4853
  }
4835
4854
  if (v)
4836
4855
  throw new Error("[TraceLog] Cannot remove custom headers while TraceLog is being destroyed");
4837
4856
  h.removeCustomHeaders();
4838
4857
  }
4839
- }, _r = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, wr = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), yr = () => {
4858
+ }, yr = () => typeof window > "u" || typeof document > "u" ? !1 : h !== null, br = () => typeof window > "u" || typeof document > "u" || !h ? null : h.getSessionId(), Lr = () => {
4840
4859
  if (!(typeof window > "u" || typeof document > "u")) {
4841
4860
  if (v)
4842
4861
  throw new Error("[TraceLog] Destroy operation already in progress");
@@ -4846,14 +4865,14 @@ const Tr = (s) => {
4846
4865
  }
4847
4866
  v = !0;
4848
4867
  try {
4849
- h.destroy(), h = null, C = !1, N.length = 0, M.length = 0, R = null, v = !1;
4868
+ h.destroy(), h = null, C = !1, R = null, O.length = 0, M.length = 0, N = null, v = !1;
4850
4869
  } catch (s) {
4851
- h = null, C = !1, N.length = 0, M.length = 0, R = null, v = !1, a("warn", "Error during destroy, forced cleanup completed", { error: s });
4870
+ h = null, C = !1, R = null, O.length = 0, M.length = 0, N = null, v = !1, a("warn", "Error during destroy, forced cleanup completed", { error: s });
4852
4871
  }
4853
4872
  }
4854
- }, br = (s) => {
4855
- typeof window > "u" || typeof document > "u" || Ut(s);
4856
- }, Lr = (s) => {
4873
+ }, Ar = (s) => {
4874
+ typeof window > "u" || typeof document > "u" || Ht(s);
4875
+ }, Mr = (s) => {
4857
4876
  if (!(typeof window > "u" || typeof document > "u")) {
4858
4877
  if (!h)
4859
4878
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
@@ -4861,7 +4880,7 @@ const Tr = (s) => {
4861
4880
  throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
4862
4881
  h.updateGlobalMetadata(s);
4863
4882
  }
4864
- }, Ar = (s) => {
4883
+ }, Cr = (s) => {
4865
4884
  if (!(typeof window > "u" || typeof document > "u")) {
4866
4885
  if (!h)
4867
4886
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
@@ -4869,36 +4888,36 @@ const Tr = (s) => {
4869
4888
  throw new Error("[TraceLog] Cannot update metadata while TraceLog is being destroyed");
4870
4889
  h.mergeGlobalMetadata(s);
4871
4890
  }
4872
- }, Zr = {
4873
- init: mr,
4874
- event: gr,
4875
- on: Er,
4876
- off: Sr,
4877
- setTransformer: pr,
4878
- removeTransformer: Tr,
4879
- setCustomHeaders: vr,
4880
- removeCustomHeaders: Ir,
4881
- isInitialized: _r,
4882
- getSessionId: wr,
4883
- destroy: yr,
4884
- setQaMode: br,
4885
- updateGlobalMetadata: Lr,
4886
- mergeGlobalMetadata: Ar
4891
+ }, ts = {
4892
+ init: Er,
4893
+ event: Sr,
4894
+ on: pr,
4895
+ off: Tr,
4896
+ setTransformer: vr,
4897
+ removeTransformer: _r,
4898
+ setCustomHeaders: Ir,
4899
+ removeCustomHeaders: wr,
4900
+ isInitialized: yr,
4901
+ getSessionId: br,
4902
+ destroy: Lr,
4903
+ setQaMode: Ar,
4904
+ updateGlobalMetadata: Mr,
4905
+ mergeGlobalMetadata: Cr
4887
4906
  };
4888
- var me, et = -1, D = function(s) {
4907
+ var ge, tt = -1, V = function(s) {
4889
4908
  addEventListener("pageshow", (function(e) {
4890
- e.persisted && (et = e.timeStamp, s(e));
4909
+ e.persisted && (tt = e.timeStamp, s(e));
4891
4910
  }), !0);
4892
- }, ve = function() {
4911
+ }, _e = function() {
4893
4912
  var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
4894
4913
  if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
4895
- }, J = function() {
4896
- var s = ve();
4914
+ }, Z = function() {
4915
+ var s = _e();
4897
4916
  return s && s.activationStart || 0;
4898
4917
  }, b = function(s, e) {
4899
- var t = ve(), r = "navigate";
4900
- return et >= 0 ? r = "back-forward-cache" : t && (document.prerendering || J() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name: s, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: r };
4901
- }, $ = function(s, e, t) {
4918
+ var t = _e(), r = "navigate";
4919
+ return tt >= 0 ? r = "back-forward-cache" : t && (document.prerendering || Z() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name: s, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: r };
4920
+ }, B = function(s, e, t) {
4902
4921
  try {
4903
4922
  if (PerformanceObserver.supportedEntryTypes.includes(s)) {
4904
4923
  var r = new PerformanceObserver((function(n) {
@@ -4923,50 +4942,50 @@ var me, et = -1, D = function(s) {
4923
4942
  return s();
4924
4943
  }));
4925
4944
  }));
4926
- }, Z = function(s) {
4945
+ }, ee = function(s) {
4927
4946
  document.addEventListener("visibilitychange", (function() {
4928
4947
  document.visibilityState === "hidden" && s();
4929
4948
  }));
4930
- }, _e = function(s) {
4949
+ }, we = function(s) {
4931
4950
  var e = !1;
4932
4951
  return function() {
4933
4952
  e || (s(), e = !0);
4934
4953
  };
4935
- }, P = -1, $e = function() {
4954
+ }, D = -1, Be = function() {
4936
4955
  return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
4937
- }, q = function(s) {
4938
- document.visibilityState === "hidden" && P > -1 && (P = s.type === "visibilitychange" ? s.timeStamp : 0, Mr());
4939
- }, Be = function() {
4940
- addEventListener("visibilitychange", q, !0), addEventListener("prerenderingchange", q, !0);
4941
- }, Mr = function() {
4942
- removeEventListener("visibilitychange", q, !0), removeEventListener("prerenderingchange", q, !0);
4943
- }, tt = function() {
4944
- return P < 0 && (P = $e(), Be(), D((function() {
4956
+ }, J = function(s) {
4957
+ document.visibilityState === "hidden" && D > -1 && (D = s.type === "visibilitychange" ? s.timeStamp : 0, Rr());
4958
+ }, We = function() {
4959
+ addEventListener("visibilitychange", J, !0), addEventListener("prerenderingchange", J, !0);
4960
+ }, Rr = function() {
4961
+ removeEventListener("visibilitychange", J, !0), removeEventListener("prerenderingchange", J, !0);
4962
+ }, rt = function() {
4963
+ return D < 0 && (D = Be(), We(), V((function() {
4945
4964
  setTimeout((function() {
4946
- P = $e(), Be();
4965
+ D = Be(), We();
4947
4966
  }), 0);
4948
4967
  }))), { get firstHiddenTime() {
4949
- return P;
4968
+ return D;
4950
4969
  } };
4951
- }, ee = function(s) {
4970
+ }, te = function(s) {
4952
4971
  document.prerendering ? addEventListener("prerenderingchange", (function() {
4953
4972
  return s();
4954
4973
  }), !0) : s();
4955
- }, ge = [1800, 3e3], rt = function(s, e) {
4956
- e = e || {}, ee((function() {
4957
- var t, r = tt(), n = b("FCP"), i = $("paint", (function(o) {
4974
+ }, Ee = [1800, 3e3], st = function(s, e) {
4975
+ e = e || {}, te((function() {
4976
+ var t, r = rt(), n = b("FCP"), i = B("paint", (function(o) {
4958
4977
  o.forEach((function(l) {
4959
- l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime - J(), 0), n.entries.push(l), t(!0)));
4978
+ l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < r.firstHiddenTime && (n.value = Math.max(l.startTime - Z(), 0), n.entries.push(l), t(!0)));
4960
4979
  }));
4961
4980
  }));
4962
- i && (t = L(s, n, ge, e.reportAllChanges), D((function(o) {
4963
- n = b("FCP"), t = L(s, n, ge, e.reportAllChanges), Ie((function() {
4981
+ i && (t = L(s, n, Ee, e.reportAllChanges), V((function(o) {
4982
+ n = b("FCP"), t = L(s, n, Ee, e.reportAllChanges), Ie((function() {
4964
4983
  n.value = performance.now() - o.timeStamp, t(!0);
4965
4984
  }));
4966
4985
  })));
4967
4986
  }));
4968
- }, Ee = [0.1, 0.25], Cr = function(s, e) {
4969
- e = e || {}, rt(_e((function() {
4987
+ }, Se = [0.1, 0.25], Nr = function(s, e) {
4988
+ e = e || {}, st(we((function() {
4970
4989
  var t, r = b("CLS", 0), n = 0, i = [], o = function(c) {
4971
4990
  c.forEach((function(u) {
4972
4991
  if (!u.hadRecentInput) {
@@ -4974,147 +4993,147 @@ var me, et = -1, D = function(s) {
4974
4993
  n && u.startTime - g.startTime < 1e3 && u.startTime - S.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
4975
4994
  }
4976
4995
  })), n > r.value && (r.value = n, r.entries = i, t());
4977
- }, l = $("layout-shift", o);
4978
- l && (t = L(s, r, Ee, e.reportAllChanges), Z((function() {
4996
+ }, l = B("layout-shift", o);
4997
+ l && (t = L(s, r, Se, e.reportAllChanges), ee((function() {
4979
4998
  o(l.takeRecords()), t(!0);
4980
- })), D((function() {
4981
- n = 0, r = b("CLS", 0), t = L(s, r, Ee, e.reportAllChanges), Ie((function() {
4999
+ })), V((function() {
5000
+ n = 0, r = b("CLS", 0), t = L(s, r, Se, e.reportAllChanges), Ie((function() {
4982
5001
  return t();
4983
5002
  }));
4984
5003
  })), setTimeout(t, 0));
4985
5004
  })));
4986
- }, st = 0, ie = 1 / 0, X = 0, Rr = function(s) {
5005
+ }, nt = 0, oe = 1 / 0, Q = 0, Or = function(s) {
4987
5006
  s.forEach((function(e) {
4988
- e.interactionId && (ie = Math.min(ie, e.interactionId), X = Math.max(X, e.interactionId), st = X ? (X - ie) / 7 + 1 : 0);
5007
+ e.interactionId && (oe = Math.min(oe, e.interactionId), Q = Math.max(Q, e.interactionId), nt = Q ? (Q - oe) / 7 + 1 : 0);
4989
5008
  }));
4990
- }, nt = function() {
4991
- return me ? st : performance.interactionCount || 0;
4992
- }, Nr = function() {
4993
- "interactionCount" in performance || me || (me = $("event", Rr, { type: "event", buffered: !0, durationThreshold: 0 }));
4994
- }, y = [], z = /* @__PURE__ */ new Map(), it = 0, Or = function() {
4995
- var s = Math.min(y.length - 1, Math.floor((nt() - it) / 50));
5009
+ }, it = function() {
5010
+ return ge ? nt : performance.interactionCount || 0;
5011
+ }, Pr = function() {
5012
+ "interactionCount" in performance || ge || (ge = B("event", Or, { type: "event", buffered: !0, durationThreshold: 0 }));
5013
+ }, y = [], K = /* @__PURE__ */ new Map(), ot = 0, Dr = function() {
5014
+ var s = Math.min(y.length - 1, Math.floor((it() - ot) / 50));
4996
5015
  return y[s];
4997
- }, Pr = [], Dr = function(s) {
4998
- if (Pr.forEach((function(n) {
5016
+ }, Vr = [], kr = function(s) {
5017
+ if (Vr.forEach((function(n) {
4999
5018
  return n(s);
5000
5019
  })), s.interactionId || s.entryType === "first-input") {
5001
- var e = y[y.length - 1], t = z.get(s.interactionId);
5020
+ var e = y[y.length - 1], t = K.get(s.interactionId);
5002
5021
  if (t || y.length < 10 || s.duration > e.latency) {
5003
5022
  if (t) s.duration > t.latency ? (t.entries = [s], t.latency = s.duration) : s.duration === t.latency && s.startTime === t.entries[0].startTime && t.entries.push(s);
5004
5023
  else {
5005
5024
  var r = { id: s.interactionId, latency: s.duration, entries: [s] };
5006
- z.set(r.id, r), y.push(r);
5025
+ K.set(r.id, r), y.push(r);
5007
5026
  }
5008
5027
  y.sort((function(n, i) {
5009
5028
  return i.latency - n.latency;
5010
5029
  })), y.length > 10 && y.splice(10).forEach((function(n) {
5011
- return z.delete(n.id);
5030
+ return K.delete(n.id);
5012
5031
  }));
5013
5032
  }
5014
5033
  }
5015
- }, ot = function(s) {
5034
+ }, at = function(s) {
5016
5035
  var e = self.requestIdleCallback || self.setTimeout, t = -1;
5017
- return s = _e(s), document.visibilityState === "hidden" ? s() : (t = e(s), Z(s)), t;
5018
- }, Se = [200, 500], kr = function(s, e) {
5019
- "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, ee((function() {
5036
+ return s = we(s), document.visibilityState === "hidden" ? s() : (t = e(s), ee(s)), t;
5037
+ }, pe = [200, 500], Ur = function(s, e) {
5038
+ "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, te((function() {
5020
5039
  var t;
5021
- Nr();
5040
+ Pr();
5022
5041
  var r, n = b("INP"), i = function(l) {
5023
- ot((function() {
5024
- l.forEach(Dr);
5025
- var c = Or();
5042
+ at((function() {
5043
+ l.forEach(kr);
5044
+ var c = Dr();
5026
5045
  c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
5027
5046
  }));
5028
- }, o = $("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
5029
- r = L(s, n, Se, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), Z((function() {
5047
+ }, o = B("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
5048
+ r = L(s, n, pe, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), ee((function() {
5030
5049
  i(o.takeRecords()), r(!0);
5031
- })), D((function() {
5032
- it = nt(), y.length = 0, z.clear(), n = b("INP"), r = L(s, n, Se, e.reportAllChanges);
5050
+ })), V((function() {
5051
+ ot = it(), y.length = 0, K.clear(), n = b("INP"), r = L(s, n, pe, e.reportAllChanges);
5033
5052
  })));
5034
5053
  })));
5035
- }, pe = [2500, 4e3], oe = {}, Vr = function(s, e) {
5036
- e = e || {}, ee((function() {
5037
- var t, r = tt(), n = b("LCP"), i = function(c) {
5054
+ }, Te = [2500, 4e3], ae = {}, Hr = function(s, e) {
5055
+ e = e || {}, te((function() {
5056
+ var t, r = rt(), n = b("LCP"), i = function(c) {
5038
5057
  e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
5039
- u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - J(), 0), n.entries = [u], t());
5058
+ u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - Z(), 0), n.entries = [u], t());
5040
5059
  }));
5041
- }, o = $("largest-contentful-paint", i);
5060
+ }, o = B("largest-contentful-paint", i);
5042
5061
  if (o) {
5043
- t = L(s, n, pe, e.reportAllChanges);
5044
- var l = _e((function() {
5045
- oe[n.id] || (i(o.takeRecords()), o.disconnect(), oe[n.id] = !0, t(!0));
5062
+ t = L(s, n, Te, e.reportAllChanges);
5063
+ var l = we((function() {
5064
+ ae[n.id] || (i(o.takeRecords()), o.disconnect(), ae[n.id] = !0, t(!0));
5046
5065
  }));
5047
5066
  ["keydown", "click"].forEach((function(c) {
5048
5067
  addEventListener(c, (function() {
5049
- return ot(l);
5068
+ return at(l);
5050
5069
  }), { once: !0, capture: !0 });
5051
- })), Z(l), D((function(c) {
5052
- n = b("LCP"), t = L(s, n, pe, e.reportAllChanges), Ie((function() {
5053
- n.value = performance.now() - c.timeStamp, oe[n.id] = !0, t(!0);
5070
+ })), ee(l), V((function(c) {
5071
+ n = b("LCP"), t = L(s, n, Te, e.reportAllChanges), Ie((function() {
5072
+ n.value = performance.now() - c.timeStamp, ae[n.id] = !0, t(!0);
5054
5073
  }));
5055
5074
  }));
5056
5075
  }
5057
5076
  }));
5058
- }, Te = [800, 1800], Ur = function s(e) {
5059
- document.prerendering ? ee((function() {
5077
+ }, ve = [800, 1800], xr = function s(e) {
5078
+ document.prerendering ? te((function() {
5060
5079
  return s(e);
5061
5080
  })) : document.readyState !== "complete" ? addEventListener("load", (function() {
5062
5081
  return s(e);
5063
5082
  }), !0) : setTimeout(e, 0);
5064
- }, Hr = function(s, e) {
5083
+ }, Fr = function(s, e) {
5065
5084
  e = e || {};
5066
- var t = b("TTFB"), r = L(s, t, Te, e.reportAllChanges);
5067
- Ur((function() {
5068
- var n = ve();
5069
- n && (t.value = Math.max(n.responseStart - J(), 0), t.entries = [n], r(!0), D((function() {
5070
- t = b("TTFB", 0), (r = L(s, t, Te, e.reportAllChanges))(!0);
5085
+ var t = b("TTFB"), r = L(s, t, ve, e.reportAllChanges);
5086
+ xr((function() {
5087
+ var n = _e();
5088
+ n && (t.value = Math.max(n.responseStart - Z(), 0), t.entries = [n], r(!0), V((function() {
5089
+ t = b("TTFB", 0), (r = L(s, t, ve, e.reportAllChanges))(!0);
5071
5090
  })));
5072
5091
  }));
5073
5092
  };
5074
- const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5093
+ const $r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5075
5094
  __proto__: null,
5076
- CLSThresholds: Ee,
5077
- FCPThresholds: ge,
5078
- INPThresholds: Se,
5079
- LCPThresholds: pe,
5080
- TTFBThresholds: Te,
5081
- onCLS: Cr,
5082
- onFCP: rt,
5083
- onINP: kr,
5084
- onLCP: Vr,
5085
- onTTFB: Hr
5095
+ CLSThresholds: Se,
5096
+ FCPThresholds: Ee,
5097
+ INPThresholds: pe,
5098
+ LCPThresholds: Te,
5099
+ TTFBThresholds: ve,
5100
+ onCLS: Nr,
5101
+ onFCP: st,
5102
+ onINP: Ur,
5103
+ onLCP: Hr,
5104
+ onTTFB: Fr
5086
5105
  }, Symbol.toStringTag, { value: "Module" }));
5087
5106
  export {
5088
5107
  f as AppConfigValidationError,
5089
- Fr as DEFAULT_SESSION_TIMEOUT,
5090
- ue as DEFAULT_WEB_VITALS_MODE,
5108
+ Br as DEFAULT_SESSION_TIMEOUT,
5109
+ de as DEFAULT_WEB_VITALS_MODE,
5091
5110
  A as DeviceType,
5092
- ae as EmitterEvent,
5093
- H as ErrorType,
5111
+ le as EmitterEvent,
5112
+ x as ErrorType,
5094
5113
  d as EventType,
5095
- qr as InitializationTimeoutError,
5096
- V as IntegrationValidationError,
5097
- zr as MAX_ARRAY_LENGTH,
5098
- Gr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
5099
- Wr as MAX_CUSTOM_EVENT_KEYS,
5100
- $r as MAX_CUSTOM_EVENT_NAME_LENGTH,
5101
- Br as MAX_CUSTOM_EVENT_STRING_SIZE,
5102
- Xr as MAX_NESTED_OBJECT_KEYS,
5103
- Qr as MAX_STRING_LENGTH,
5104
- jr as MAX_STRING_LENGTH_IN_ARRAY,
5105
- K as Mode,
5106
- je as PII_PATTERNS,
5107
- O as PermanentError,
5108
- Ne as SamplingRateValidationError,
5109
- Q as ScrollDirection,
5110
- mt as SessionTimeoutValidationError,
5111
- U as SpecialApiUrl,
5112
- F as TraceLogValidationError,
5113
- Jr as WEB_VITALS_GOOD_THRESHOLDS,
5114
+ Zr as InitializationTimeoutError,
5115
+ U as IntegrationValidationError,
5116
+ Yr as MAX_ARRAY_LENGTH,
5117
+ Qr as MAX_CUSTOM_EVENT_ARRAY_SIZE,
5118
+ Xr as MAX_CUSTOM_EVENT_KEYS,
5119
+ Wr as MAX_CUSTOM_EVENT_NAME_LENGTH,
5120
+ Gr as MAX_CUSTOM_EVENT_STRING_SIZE,
5121
+ jr as MAX_NESTED_OBJECT_KEYS,
5122
+ zr as MAX_STRING_LENGTH,
5123
+ Kr as MAX_STRING_LENGTH_IN_ARRAY,
5124
+ Y as Mode,
5125
+ ze as PII_PATTERNS,
5126
+ P as PermanentError,
5127
+ Oe as SamplingRateValidationError,
5128
+ j as ScrollDirection,
5129
+ gt as SessionTimeoutValidationError,
5130
+ H as SpecialApiUrl,
5131
+ $ as TraceLogValidationError,
5132
+ es as WEB_VITALS_GOOD_THRESHOLDS,
5114
5133
  ke as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
5115
- Rt as WEB_VITALS_POOR_THRESHOLDS,
5116
- Ve as getWebVitalsThresholds,
5117
- Kr as isPrimaryScrollEvent,
5118
- Yr as isSecondaryScrollEvent,
5119
- Zr as tracelog
5134
+ Nt as WEB_VITALS_POOR_THRESHOLDS,
5135
+ Ue as getWebVitalsThresholds,
5136
+ qr as isPrimaryScrollEvent,
5137
+ Jr as isSecondaryScrollEvent,
5138
+ ts as tracelog
5120
5139
  };