@tracelog/lib 2.8.1-rc.101.3 → 2.8.2-rc.102.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/tracelog.esm.js +218 -199
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -2
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +2 -2
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +8 -0
- package/dist/public-api.d.ts +8 -0
- package/dist/public-api.js +2 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const dr = 9e5;
|
|
2
2
|
const ur = 120, hr = 49152, fr = 100, mr = 500, gr = 200;
|
|
3
3
|
const Er = 1e3, pr = 500, Sr = 1e3;
|
|
4
|
-
const b = "data-tlog",
|
|
4
|
+
const b = "data-tlog", bt = [
|
|
5
5
|
"button",
|
|
6
6
|
"a",
|
|
7
7
|
'input[type="button"]',
|
|
@@ -33,7 +33,7 @@ const b = "data-tlog", At = [
|
|
|
33
33
|
".menu-item",
|
|
34
34
|
"[data-testid]",
|
|
35
35
|
'[tabindex="0"]'
|
|
36
|
-
],
|
|
36
|
+
], At = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], Lt = [
|
|
37
37
|
"token",
|
|
38
38
|
"auth",
|
|
39
39
|
"key",
|
|
@@ -72,14 +72,14 @@ const E = {
|
|
|
72
72
|
INVALID_VIEWPORT_COOLDOWN_PERIOD: "Viewport cooldownPeriod must be a non-negative number",
|
|
73
73
|
INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS: "Viewport maxTrackedElements must be a positive number",
|
|
74
74
|
INVALID_SEND_INTERVAL: "Send interval must be between 1000ms (1 second) and 60000ms (60 seconds)"
|
|
75
|
-
},
|
|
75
|
+
}, Mt = [
|
|
76
76
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
77
77
|
/javascript:/gi,
|
|
78
78
|
/on\w+\s*=/gi,
|
|
79
79
|
/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
|
|
80
80
|
/<embed\b[^>]*>/gi,
|
|
81
81
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
82
|
-
], I = "tlog", X = `${I}:qa_mode`, Te = `${I}:uid`,
|
|
82
|
+
], I = "tlog", X = `${I}:qa_mode`, Te = `${I}:uid`, rt = "tlog_mode", Ue = "qa", He = "qa_off", Ct = (r) => r ? `${I}:${r}:queue` : `${I}:queue`, Rt = (r) => r ? `${I}:${r}:session` : `${I}:session`, Nt = (r) => r ? `${I}:${r}:broadcast` : `${I}:broadcast`, Fe = (r, e) => `${I}:${r}:session_counts:${e}`, xe = 10080 * 60 * 1e3, $e = `${I}:session_counts_last_cleanup`, Be = 3600 * 1e3, fe = (r) => r ? `${I}:${r}:identity` : `${I}:identity`, U = `${I}:pending_identity`;
|
|
83
83
|
var $ = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))($ || {}), L = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(L || {}), se = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(se || {});
|
|
84
84
|
class O extends Error {
|
|
85
85
|
constructor(e, t) {
|
|
@@ -111,12 +111,12 @@ class m extends j {
|
|
|
111
111
|
super(e, "APP_CONFIG_INVALID", t);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
114
|
+
class Ot extends j {
|
|
115
115
|
constructor(e, t = "config") {
|
|
116
116
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
class
|
|
119
|
+
class We extends j {
|
|
120
120
|
constructor(e, t = "config") {
|
|
121
121
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
122
122
|
}
|
|
@@ -132,7 +132,7 @@ class vr extends j {
|
|
|
132
132
|
}
|
|
133
133
|
timeoutMs;
|
|
134
134
|
}
|
|
135
|
-
const
|
|
135
|
+
const nt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", it = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Pt = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Dt = (r, e) => {
|
|
136
136
|
if (e) {
|
|
137
137
|
if (e instanceof Error) {
|
|
138
138
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
|
|
@@ -151,7 +151,7 @@ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
151
151
|
return `[TraceLog] ${r}: ${String(e)}`;
|
|
152
152
|
}
|
|
153
153
|
return `[TraceLog] ${r}`;
|
|
154
|
-
},
|
|
154
|
+
}, kt = () => {
|
|
155
155
|
if (typeof window > "u" || typeof sessionStorage > "u")
|
|
156
156
|
return !1;
|
|
157
157
|
try {
|
|
@@ -160,12 +160,12 @@ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
160
160
|
return !1;
|
|
161
161
|
}
|
|
162
162
|
}, a = (r, e, t) => {
|
|
163
|
-
const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ?
|
|
164
|
-
if (!
|
|
163
|
+
const { error: s, data: n, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ? Dt(e, s) : `[TraceLog] ${e}`, d = r === "error" ? "error" : r === "warn" ? "warn" : "log";
|
|
164
|
+
if (!Vt(l, i))
|
|
165
165
|
return;
|
|
166
|
-
const g =
|
|
167
|
-
|
|
168
|
-
},
|
|
166
|
+
const g = Ut(l, o), T = n !== void 0 ? Ie(n) : void 0;
|
|
167
|
+
Ht(d, c, g, T);
|
|
168
|
+
}, Vt = (r, e) => r === "critical" ? !0 : r === "qa" || e ? kt() : !1, Ut = (r, e) => e !== void 0 && e !== "" ? e : r === "critical" ? Pt : "", Ht = (r, e, t, s) => {
|
|
169
169
|
const n = t !== void 0 && t !== "", i = n ? `%c${e}` : e;
|
|
170
170
|
s !== void 0 ? n ? console[r](i, t, s) : console[r](i, s) : n ? console[r](i, t) : console[r](i);
|
|
171
171
|
}, Ie = (r) => {
|
|
@@ -182,10 +182,10 @@ const it = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
|
|
|
182
182
|
}
|
|
183
183
|
return e;
|
|
184
184
|
};
|
|
185
|
-
let ve,
|
|
186
|
-
const
|
|
187
|
-
typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"),
|
|
188
|
-
}, oe = "Unknown",
|
|
185
|
+
let ve, ot;
|
|
186
|
+
const Ft = () => {
|
|
187
|
+
typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"), ot = window.matchMedia("(hover: none)"));
|
|
188
|
+
}, oe = "Unknown", xt = (r) => {
|
|
189
189
|
const e = r.userAgentData?.platform;
|
|
190
190
|
if (e != null && e !== "") {
|
|
191
191
|
if (/windows/i.test(e)) return "Windows";
|
|
@@ -197,7 +197,7 @@ const xt = () => {
|
|
|
197
197
|
}
|
|
198
198
|
const t = navigator.userAgent;
|
|
199
199
|
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" : oe;
|
|
200
|
-
},
|
|
200
|
+
}, $t = (r) => {
|
|
201
201
|
const e = r.userAgentData?.brands;
|
|
202
202
|
if (e != null && e.length > 0) {
|
|
203
203
|
const n = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
|
|
@@ -208,26 +208,26 @@ const xt = () => {
|
|
|
208
208
|
}
|
|
209
209
|
const t = navigator.userAgent;
|
|
210
210
|
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" : oe;
|
|
211
|
-
},
|
|
211
|
+
}, Bt = () => {
|
|
212
212
|
try {
|
|
213
213
|
const r = navigator;
|
|
214
214
|
if (r.userAgentData != null && typeof r.userAgentData.mobile == "boolean") {
|
|
215
215
|
const c = r.userAgentData.platform;
|
|
216
216
|
return c != null && c !== "" && /ipad|tablet/i.test(c) ? L.Tablet : r.userAgentData.mobile ? L.Mobile : L.Desktop;
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
const e = window.innerWidth, t = ve?.matches ?? !1, s =
|
|
218
|
+
Ft();
|
|
219
|
+
const e = window.innerWidth, t = ve?.matches ?? !1, s = ot?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
|
|
220
220
|
return e <= 767 || o && n ? L.Mobile : e >= 768 && e <= 1024 || l || t && s && n ? L.Tablet : L.Desktop;
|
|
221
221
|
} catch (r) {
|
|
222
222
|
return a("debug", "Device detection failed, defaulting to desktop", { error: r }), L.Desktop;
|
|
223
223
|
}
|
|
224
|
-
},
|
|
224
|
+
}, Wt = () => {
|
|
225
225
|
try {
|
|
226
226
|
const r = navigator;
|
|
227
227
|
return {
|
|
228
|
-
type:
|
|
229
|
-
os:
|
|
230
|
-
browser:
|
|
228
|
+
type: Bt(),
|
|
229
|
+
os: xt(r),
|
|
230
|
+
browser: $t(r)
|
|
231
231
|
};
|
|
232
232
|
} catch (r) {
|
|
233
233
|
return a("debug", "Device info detection failed, using defaults", { error: r }), {
|
|
@@ -236,7 +236,7 @@ const xt = () => {
|
|
|
236
236
|
browser: oe
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
},
|
|
239
|
+
}, at = [
|
|
240
240
|
// Email addresses
|
|
241
241
|
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
|
|
242
242
|
// US Phone numbers (various formats)
|
|
@@ -253,7 +253,7 @@ const xt = () => {
|
|
|
253
253
|
/:\/\/[^:/]+:([^@]+)@/gi,
|
|
254
254
|
// Sensitive URL query parameters (token=, password=, auth=, secret=, api_key=, etc.)
|
|
255
255
|
/[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
|
|
256
|
-
],
|
|
256
|
+
], Xe = 500, Ge = 2e3, je = 5e3, ee = 50, Xt = ee * 2, lt = 1, Gt = 1e3, jt = 10, ze = 5e3, zt = 6e4, _r = {
|
|
257
257
|
LCP: 2500,
|
|
258
258
|
// Good: ≤ 2.5s
|
|
259
259
|
FCP: 1800,
|
|
@@ -265,7 +265,7 @@ const xt = () => {
|
|
|
265
265
|
TTFB: 800,
|
|
266
266
|
// Good: ≤ 800ms
|
|
267
267
|
LONG_TASK: 50
|
|
268
|
-
},
|
|
268
|
+
}, Qe = {
|
|
269
269
|
LCP: 2500,
|
|
270
270
|
// Needs improvement: > 2.5s (same as good boundary)
|
|
271
271
|
FCP: 1800,
|
|
@@ -277,7 +277,7 @@ const xt = () => {
|
|
|
277
277
|
TTFB: 800,
|
|
278
278
|
// Needs improvement: > 800ms
|
|
279
279
|
LONG_TASK: 50
|
|
280
|
-
},
|
|
280
|
+
}, Qt = {
|
|
281
281
|
LCP: 4e3,
|
|
282
282
|
// Poor: > 4s
|
|
283
283
|
FCP: 3e3,
|
|
@@ -289,53 +289,53 @@ const xt = () => {
|
|
|
289
289
|
TTFB: 1800,
|
|
290
290
|
// Poor: > 1800ms
|
|
291
291
|
LONG_TASK: 50
|
|
292
|
-
}, _e = "needs-improvement",
|
|
292
|
+
}, _e = "needs-improvement", Ke = (r = _e) => {
|
|
293
293
|
switch (r) {
|
|
294
294
|
case "all":
|
|
295
295
|
return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0, LONG_TASK: 0 };
|
|
296
296
|
// Track everything
|
|
297
297
|
case "needs-improvement":
|
|
298
|
-
return
|
|
298
|
+
return Qe;
|
|
299
299
|
case "poor":
|
|
300
|
-
return
|
|
300
|
+
return Qt;
|
|
301
301
|
default:
|
|
302
|
-
return
|
|
302
|
+
return Qe;
|
|
303
303
|
}
|
|
304
|
-
},
|
|
304
|
+
}, Kt = 1e3, Yt = 50, qt = "2.8.2", Jt = qt, ct = () => typeof window < "u" && typeof sessionStorage < "u", Zt = () => {
|
|
305
305
|
try {
|
|
306
306
|
const r = new URLSearchParams(window.location.search);
|
|
307
|
-
r.delete(
|
|
307
|
+
r.delete(rt);
|
|
308
308
|
const e = r.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
|
|
309
309
|
window.history.replaceState({}, "", t);
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
|
-
},
|
|
313
|
-
if (!
|
|
312
|
+
}, es = () => {
|
|
313
|
+
if (!ct())
|
|
314
314
|
return !1;
|
|
315
315
|
try {
|
|
316
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
316
|
+
const e = new URLSearchParams(window.location.search).get(rt), t = sessionStorage.getItem(X);
|
|
317
317
|
let s = null;
|
|
318
|
-
return e ===
|
|
318
|
+
return e === Ue ? (s = !0, sessionStorage.setItem(X, "true"), a("info", "QA Mode ACTIVE", {
|
|
319
319
|
visibility: "qa",
|
|
320
|
-
style:
|
|
321
|
-
})) : e ===
|
|
320
|
+
style: nt
|
|
321
|
+
})) : e === He && (s = !1, sessionStorage.setItem(X, "false"), a("info", "QA Mode DISABLED", {
|
|
322
322
|
visibility: "qa",
|
|
323
|
-
style:
|
|
324
|
-
})), (e ===
|
|
323
|
+
style: it
|
|
324
|
+
})), (e === Ue || e === He) && Zt(), s ?? t === "true";
|
|
325
325
|
} catch {
|
|
326
326
|
return !1;
|
|
327
327
|
}
|
|
328
|
-
},
|
|
329
|
-
if (
|
|
328
|
+
}, ts = (r) => {
|
|
329
|
+
if (ct())
|
|
330
330
|
try {
|
|
331
331
|
sessionStorage.setItem(X, r ? "true" : "false"), a("info", r ? "QA Mode ACTIVE" : "QA Mode DISABLED", {
|
|
332
332
|
visibility: "qa",
|
|
333
|
-
style: r ?
|
|
333
|
+
style: r ? nt : it
|
|
334
334
|
});
|
|
335
335
|
} catch {
|
|
336
336
|
a("debug", "Cannot set QA mode: sessionStorage unavailable");
|
|
337
337
|
}
|
|
338
|
-
},
|
|
338
|
+
}, ss = [
|
|
339
339
|
"co.uk",
|
|
340
340
|
"org.uk",
|
|
341
341
|
"com.au",
|
|
@@ -347,37 +347,37 @@ const xt = () => {
|
|
|
347
347
|
"co.in",
|
|
348
348
|
"com.cn",
|
|
349
349
|
"co.za"
|
|
350
|
-
],
|
|
350
|
+
], Ye = (r) => {
|
|
351
351
|
const e = r.toLowerCase().split(".");
|
|
352
352
|
if (e.length <= 2)
|
|
353
353
|
return r.toLowerCase();
|
|
354
354
|
const t = e.slice(-2).join(".");
|
|
355
|
-
return
|
|
356
|
-
},
|
|
355
|
+
return ss.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
|
|
356
|
+
}, rs = (r, e) => r === e ? !0 : Ye(r) === Ye(e), me = () => {
|
|
357
357
|
const r = document.referrer;
|
|
358
358
|
if (!r)
|
|
359
359
|
return "Direct";
|
|
360
360
|
try {
|
|
361
361
|
const e = new URL(r).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
|
|
362
|
-
return
|
|
362
|
+
return rs(e, t) ? "Direct" : r;
|
|
363
363
|
} catch (e) {
|
|
364
364
|
return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: r } }), r;
|
|
365
365
|
}
|
|
366
366
|
}, ge = () => {
|
|
367
367
|
const r = new URLSearchParams(window.location.search), e = {};
|
|
368
|
-
return
|
|
368
|
+
return At.forEach((s) => {
|
|
369
369
|
const n = r.get(s);
|
|
370
370
|
if (n) {
|
|
371
371
|
const i = s.split("utm_")[1];
|
|
372
372
|
e[i] = n;
|
|
373
373
|
}
|
|
374
374
|
}), Object.keys(e).length ? e : void 0;
|
|
375
|
-
},
|
|
375
|
+
}, dt = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
|
|
376
376
|
const e = Math.random() * 16 | 0;
|
|
377
377
|
return (r === "x" ? e : e & 3 | 8).toString(16);
|
|
378
378
|
});
|
|
379
379
|
let Y = 0, q = 0;
|
|
380
|
-
const
|
|
380
|
+
const ns = () => {
|
|
381
381
|
let r = Date.now();
|
|
382
382
|
r < q && (r = q), r === q ? Y = (Y + 1) % 1e3 : Y = 0, q = r;
|
|
383
383
|
const e = Y.toString().padStart(3, "0");
|
|
@@ -390,7 +390,7 @@ const ye = () => {
|
|
|
390
390
|
} catch {
|
|
391
391
|
}
|
|
392
392
|
return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${r}-${e}-${t}`;
|
|
393
|
-
},
|
|
393
|
+
}, ut = (r, e = !1) => {
|
|
394
394
|
try {
|
|
395
395
|
const t = new URL(r), s = t.protocol === "https:", n = t.protocol === "http:";
|
|
396
396
|
return s || e && n;
|
|
@@ -415,7 +415,7 @@ const ye = () => {
|
|
|
415
415
|
if (s.length === 2 ? n = s.join(".") : n = s.slice(-2).join("."), !n || n.split(".").length < 2)
|
|
416
416
|
throw new Error("Invalid domain structure for SaaS");
|
|
417
417
|
const i = `https://${r}.${n}/collect`;
|
|
418
|
-
if (!
|
|
418
|
+
if (!ut(i))
|
|
419
419
|
throw new Error("Generated URL failed validation");
|
|
420
420
|
return i;
|
|
421
421
|
} catch (e) {
|
|
@@ -427,16 +427,16 @@ const ye = () => {
|
|
|
427
427
|
const t = r.integrations?.custom?.collectApiUrl;
|
|
428
428
|
if (t) {
|
|
429
429
|
const s = r.integrations?.custom?.allowHttp ?? !1;
|
|
430
|
-
if (!
|
|
430
|
+
if (!ut(t, s))
|
|
431
431
|
throw new Error("Invalid custom API URL");
|
|
432
432
|
e.custom = t;
|
|
433
433
|
}
|
|
434
434
|
return e;
|
|
435
|
-
},
|
|
435
|
+
}, ye = (r, e = []) => {
|
|
436
436
|
if (!r || typeof r != "string")
|
|
437
437
|
return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof r } }), r || "";
|
|
438
438
|
try {
|
|
439
|
-
const t = new URL(r), s = t.searchParams, n = [.../* @__PURE__ */ new Set([...
|
|
439
|
+
const t = new URL(r), s = t.searchParams, n = [.../* @__PURE__ */ new Set([...Lt, ...e])];
|
|
440
440
|
let i = !1;
|
|
441
441
|
const o = [];
|
|
442
442
|
return n.forEach((c) => {
|
|
@@ -445,13 +445,13 @@ const ye = () => {
|
|
|
445
445
|
} catch (t) {
|
|
446
446
|
return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: r?.length } }), r;
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, qe = (r) => {
|
|
449
449
|
if (!r || typeof r != "string" || r.trim().length === 0)
|
|
450
450
|
return "";
|
|
451
451
|
let e = r;
|
|
452
452
|
r.length > 1e3 && (e = r.slice(0, Math.max(0, 1e3)));
|
|
453
453
|
let t = 0;
|
|
454
|
-
for (const n of
|
|
454
|
+
for (const n of Mt) {
|
|
455
455
|
const i = e;
|
|
456
456
|
e = e.replace(n, ""), i !== e && t++;
|
|
457
457
|
}
|
|
@@ -461,11 +461,11 @@ const ye = () => {
|
|
|
461
461
|
valueLength: r.length
|
|
462
462
|
}
|
|
463
463
|
}), e.trim();
|
|
464
|
-
},
|
|
464
|
+
}, we = (r, e = 0) => {
|
|
465
465
|
if (r == null)
|
|
466
466
|
return null;
|
|
467
467
|
if (typeof r == "string")
|
|
468
|
-
return
|
|
468
|
+
return qe(r);
|
|
469
469
|
if (typeof r == "number")
|
|
470
470
|
return !Number.isFinite(r) || r < -Number.MAX_SAFE_INTEGER || r > Number.MAX_SAFE_INTEGER ? 0 : r;
|
|
471
471
|
if (typeof r == "boolean")
|
|
@@ -473,13 +473,13 @@ const ye = () => {
|
|
|
473
473
|
if (e > 10)
|
|
474
474
|
return null;
|
|
475
475
|
if (Array.isArray(r))
|
|
476
|
-
return r.slice(0, 1e3).map((n) =>
|
|
476
|
+
return r.slice(0, 1e3).map((n) => we(n, e + 1)).filter((n) => n !== null);
|
|
477
477
|
if (typeof r == "object") {
|
|
478
478
|
const t = {}, n = Object.entries(r).slice(0, 200);
|
|
479
479
|
for (const [i, o] of n) {
|
|
480
|
-
const l =
|
|
480
|
+
const l = qe(i);
|
|
481
481
|
if (l) {
|
|
482
|
-
const c =
|
|
482
|
+
const c = we(o, e + 1);
|
|
483
483
|
c !== null && (t[l] = c);
|
|
484
484
|
}
|
|
485
485
|
}
|
|
@@ -490,7 +490,7 @@ const ye = () => {
|
|
|
490
490
|
if (typeof r != "object" || r === null)
|
|
491
491
|
return {};
|
|
492
492
|
try {
|
|
493
|
-
const e =
|
|
493
|
+
const e = we(r);
|
|
494
494
|
return typeof e == "object" && e !== null ? e : {};
|
|
495
495
|
} catch (e) {
|
|
496
496
|
const t = e instanceof Error ? e.message : String(e);
|
|
@@ -501,7 +501,7 @@ const ye = () => {
|
|
|
501
501
|
throw new m("Configuration must be an object", "config");
|
|
502
502
|
if (r) {
|
|
503
503
|
if (r.sessionTimeout !== void 0 && (typeof r.sessionTimeout != "number" || r.sessionTimeout < 3e4 || r.sessionTimeout > 864e5))
|
|
504
|
-
throw new
|
|
504
|
+
throw new Ot(E.INVALID_SESSION_TIMEOUT, "config");
|
|
505
505
|
if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
|
|
506
506
|
throw new m(E.INVALID_GLOBAL_METADATA, "config");
|
|
507
507
|
if (r.integrations && ds(r.integrations), r.sensitiveQueryParams !== void 0) {
|
|
@@ -512,9 +512,9 @@ const ye = () => {
|
|
|
512
512
|
throw new m("All sensitive query params must be strings", "config");
|
|
513
513
|
}
|
|
514
514
|
if (r.errorSampling !== void 0 && (typeof r.errorSampling != "number" || r.errorSampling < 0 || r.errorSampling > 1))
|
|
515
|
-
throw new
|
|
515
|
+
throw new We(E.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
516
516
|
if (r.samplingRate !== void 0 && (typeof r.samplingRate != "number" || r.samplingRate < 0 || r.samplingRate > 1))
|
|
517
|
-
throw new
|
|
517
|
+
throw new We(E.INVALID_SAMPLING_RATE, "config");
|
|
518
518
|
if (r.primaryScrollSelector !== void 0) {
|
|
519
519
|
if (typeof r.primaryScrollSelector != "string" || !r.primaryScrollSelector.trim())
|
|
520
520
|
throw new m(E.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
@@ -627,7 +627,7 @@ const ye = () => {
|
|
|
627
627
|
sessionTimeout: r?.sessionTimeout ?? 9e5,
|
|
628
628
|
globalMetadata: r?.globalMetadata ?? {},
|
|
629
629
|
sensitiveQueryParams: r?.sensitiveQueryParams ?? [],
|
|
630
|
-
errorSampling: r?.errorSampling ??
|
|
630
|
+
errorSampling: r?.errorSampling ?? lt,
|
|
631
631
|
samplingRate: r?.samplingRate ?? 1,
|
|
632
632
|
pageViewThrottleMs: r?.pageViewThrottleMs ?? 1e3,
|
|
633
633
|
clickThrottleMs: r?.clickThrottleMs ?? 300,
|
|
@@ -644,12 +644,12 @@ const ye = () => {
|
|
|
644
644
|
cooldownPeriod: e.viewport.cooldownPeriod ?? 6e4,
|
|
645
645
|
maxTrackedElements: e.viewport.maxTrackedElements ?? 100
|
|
646
646
|
}), e;
|
|
647
|
-
},
|
|
647
|
+
}, be = (r, e = /* @__PURE__ */ new Set()) => {
|
|
648
648
|
if (r == null)
|
|
649
649
|
return !0;
|
|
650
650
|
const t = typeof r;
|
|
651
|
-
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(r) ? !1 : (e.add(r), Array.isArray(r) ? r.every((s) =>
|
|
652
|
-
}, hs = (r) => typeof r != "object" || r === null ? !1 :
|
|
651
|
+
return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(r) ? !1 : (e.add(r), Array.isArray(r) ? r.every((s) => be(s, e)) : t === "object" ? Object.values(r).every((s) => be(s, e)) : !1);
|
|
652
|
+
}, hs = (r) => typeof r != "object" || r === null ? !1 : be(r), ht = (r) => {
|
|
653
653
|
if (typeof r != "object" || r === null || Array.isArray(r)) return;
|
|
654
654
|
const e = {};
|
|
655
655
|
for (const [t, s] of Object.entries(r))
|
|
@@ -670,7 +670,7 @@ const ye = () => {
|
|
|
670
670
|
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(r.toLowerCase()) ? {
|
|
671
671
|
valid: !1,
|
|
672
672
|
error: "Event name cannot be a reserved word"
|
|
673
|
-
} : { valid: !0 },
|
|
673
|
+
} : { valid: !0 }, Je = (r, e, t) => {
|
|
674
674
|
const s = as(e), n = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
|
|
675
675
|
if (!hs(s))
|
|
676
676
|
return {
|
|
@@ -720,7 +720,7 @@ const ye = () => {
|
|
|
720
720
|
valid: !0,
|
|
721
721
|
sanitizedMetadata: s
|
|
722
722
|
};
|
|
723
|
-
},
|
|
723
|
+
}, ft = (r, e, t) => {
|
|
724
724
|
if (Array.isArray(e)) {
|
|
725
725
|
const s = [], n = t && t === "customEvent" ? `${t} "${r}" metadata error` : `${r} metadata error`;
|
|
726
726
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -730,7 +730,7 @@ const ye = () => {
|
|
|
730
730
|
valid: !1,
|
|
731
731
|
error: `${n}: array item at index ${i} must be an object.`
|
|
732
732
|
};
|
|
733
|
-
const l =
|
|
733
|
+
const l = Je(r, o, t);
|
|
734
734
|
if (!l.valid)
|
|
735
735
|
return {
|
|
736
736
|
valid: !1,
|
|
@@ -743,7 +743,7 @@ const ye = () => {
|
|
|
743
743
|
sanitizedMetadata: s
|
|
744
744
|
};
|
|
745
745
|
}
|
|
746
|
-
return
|
|
746
|
+
return Je(r, e, t);
|
|
747
747
|
}, ms = (r, e) => {
|
|
748
748
|
const t = fs(r);
|
|
749
749
|
if (!t.valid)
|
|
@@ -752,7 +752,7 @@ const ye = () => {
|
|
|
752
752
|
}), t;
|
|
753
753
|
if (!e)
|
|
754
754
|
return { valid: !0 };
|
|
755
|
-
const s =
|
|
755
|
+
const s = ft(r, e, "customEvent");
|
|
756
756
|
return s.valid || a("error", "Event metadata validation failed", {
|
|
757
757
|
data: {
|
|
758
758
|
eventName: r,
|
|
@@ -877,7 +877,7 @@ class gs {
|
|
|
877
877
|
this.listeners.clear();
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function mt(r, e, t) {
|
|
881
881
|
try {
|
|
882
882
|
const s = e(r);
|
|
883
883
|
return s === null ? null : typeof s == "object" && s !== null && "type" in s ? s : (a("warn", `beforeSend transformer returned invalid data, using original [${t}]`), r);
|
|
@@ -889,9 +889,9 @@ function gt(r, e, t) {
|
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
891
|
function Es(r, e, t) {
|
|
892
|
-
return r.map((s) =>
|
|
892
|
+
return r.map((s) => mt(s, e, t)).filter((s) => s !== null);
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function gt(r, e, t) {
|
|
895
895
|
try {
|
|
896
896
|
const s = e(r);
|
|
897
897
|
return s === null ? (a("debug", `Batch filtered by beforeBatch transformer [${t}]`, {
|
|
@@ -966,7 +966,7 @@ class _ {
|
|
|
966
966
|
return { ...Ee };
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
|
-
class
|
|
969
|
+
class Ze extends _ {
|
|
970
970
|
storeManager;
|
|
971
971
|
integrationId;
|
|
972
972
|
apiUrl;
|
|
@@ -1051,7 +1051,7 @@ class et extends _ {
|
|
|
1051
1051
|
return { ...this.staticHeaders, ...e };
|
|
1052
1052
|
}
|
|
1053
1053
|
getQueueStorageKey() {
|
|
1054
|
-
const e = this.get("userId") || "anonymous", t =
|
|
1054
|
+
const e = this.get("userId") || "anonymous", t = Ct(e);
|
|
1055
1055
|
return this.integrationId ? `${t}:${this.integrationId}` : t;
|
|
1056
1056
|
}
|
|
1057
1057
|
/**
|
|
@@ -1333,7 +1333,7 @@ class et extends _ {
|
|
|
1333
1333
|
if (this.integrationId === "saas")
|
|
1334
1334
|
return e;
|
|
1335
1335
|
const t = this.transformers.beforeBatch;
|
|
1336
|
-
return t ?
|
|
1336
|
+
return t ? gt(e, t, this.integrationId || "SenderManager") : e;
|
|
1337
1337
|
}
|
|
1338
1338
|
/**
|
|
1339
1339
|
* Calculates exponential backoff delay with jitter for retry attempts.
|
|
@@ -1584,7 +1584,7 @@ class et extends _ {
|
|
|
1584
1584
|
*
|
|
1585
1585
|
* **Idempotency Token**:
|
|
1586
1586
|
* - Set upstream by ensureBatchMetadata() before this method is called
|
|
1587
|
-
* - Fallback
|
|
1587
|
+
* - Fallback computeContentToken() is defensive only (should not trigger in normal flow)
|
|
1588
1588
|
* - Same token persists across all retry attempts of the same batch
|
|
1589
1589
|
* - Backend uses this to deduplicate retries
|
|
1590
1590
|
*
|
|
@@ -1599,10 +1599,10 @@ class et extends _ {
|
|
|
1599
1599
|
...e,
|
|
1600
1600
|
_metadata: {
|
|
1601
1601
|
...e._metadata,
|
|
1602
|
-
idempotency_token: e._metadata?.idempotency_token ??
|
|
1602
|
+
idempotency_token: e._metadata?.idempotency_token ?? this.computeContentToken(e),
|
|
1603
1603
|
referer: typeof window < "u" ? window.location.href : void 0,
|
|
1604
1604
|
timestamp: t,
|
|
1605
|
-
client_version:
|
|
1605
|
+
client_version: Jt
|
|
1606
1606
|
}
|
|
1607
1607
|
};
|
|
1608
1608
|
return {
|
|
@@ -1611,7 +1611,7 @@ class et extends _ {
|
|
|
1611
1611
|
};
|
|
1612
1612
|
}
|
|
1613
1613
|
ensureBatchMetadata(e, t) {
|
|
1614
|
-
const s = e._metadata?.idempotency_token ?? t ??
|
|
1614
|
+
const s = e._metadata?.idempotency_token ?? t ?? this.computeContentToken(e);
|
|
1615
1615
|
return e._metadata?.idempotency_token === s ? e : {
|
|
1616
1616
|
...e,
|
|
1617
1617
|
_metadata: {
|
|
@@ -1620,6 +1620,25 @@ class et extends _ {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
};
|
|
1622
1622
|
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Deterministic 32-bit FNV-1a hash of sorted event IDs.
|
|
1625
|
+
*
|
|
1626
|
+
* **Purpose**: Produces the same idempotency token for the same set of events
|
|
1627
|
+
* across retries, so the backend's success cache catches in-session retries
|
|
1628
|
+
* before any MongoDB work. Replaces a random token that caused the API to
|
|
1629
|
+
* treat retried batches as new and emit `high_duplicate_rate` warnings.
|
|
1630
|
+
*
|
|
1631
|
+
* @param body - Event queue whose events determine the token
|
|
1632
|
+
* @returns 8-char hex string
|
|
1633
|
+
* @private
|
|
1634
|
+
*/
|
|
1635
|
+
computeContentToken(e) {
|
|
1636
|
+
const t = e.events.map((n) => n.id).sort().join(",");
|
|
1637
|
+
let s = 2166136261;
|
|
1638
|
+
for (let n = 0; n < t.length; n++)
|
|
1639
|
+
s ^= t.charCodeAt(n), s = Math.imul(s, 16777619) >>> 0;
|
|
1640
|
+
return s.toString(16).padStart(8, "0");
|
|
1641
|
+
}
|
|
1623
1642
|
/**
|
|
1624
1643
|
* Retrieves persisted events from localStorage with error recovery.
|
|
1625
1644
|
*
|
|
@@ -1751,7 +1770,7 @@ class et extends _ {
|
|
|
1751
1770
|
}
|
|
1752
1771
|
logPermanentError(e, t) {
|
|
1753
1772
|
const s = Date.now();
|
|
1754
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >=
|
|
1773
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= zt) && (a("error", `${e}${this.integrationId ? ` [${this.integrationId}]` : ""}`, {
|
|
1755
1774
|
data: { status: t.statusCode, message: t.message }
|
|
1756
1775
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: s });
|
|
1757
1776
|
}
|
|
@@ -1947,8 +1966,8 @@ class Ts extends _ {
|
|
|
1947
1966
|
constructor(e, t = null, s = {}, n = {}, i, o = "include") {
|
|
1948
1967
|
super(), this.emitter = t, this.transformers = s, this.timeManager = new ps(), this.dataSenders = [];
|
|
1949
1968
|
const l = this.get("collectApiUrls");
|
|
1950
|
-
l?.saas && this.dataSenders.push(new
|
|
1951
|
-
new
|
|
1969
|
+
l?.saas && this.dataSenders.push(new Ze(e, "saas", l.saas, s)), l?.custom && this.dataSenders.push(
|
|
1970
|
+
new Ze(
|
|
1952
1971
|
e,
|
|
1953
1972
|
"custom",
|
|
1954
1973
|
l.custom,
|
|
@@ -2138,7 +2157,7 @@ class Ts extends _ {
|
|
|
2138
2157
|
if (!this.checkPerEventRateLimit(o.name, v))
|
|
2139
2158
|
return;
|
|
2140
2159
|
}
|
|
2141
|
-
const
|
|
2160
|
+
const Ve = p === u.SESSION_START, K = t || this.get("pageUrl"), x = this.buildEventPayload({
|
|
2142
2161
|
type: p,
|
|
2143
2162
|
page_url: K,
|
|
2144
2163
|
from_page_url: s,
|
|
@@ -2151,7 +2170,7 @@ class Ts extends _ {
|
|
|
2151
2170
|
page_view: f
|
|
2152
2171
|
});
|
|
2153
2172
|
if (x && !(!T && !this.shouldSample())) {
|
|
2154
|
-
if (
|
|
2173
|
+
if (Ve) {
|
|
2155
2174
|
const v = this.get("sessionId");
|
|
2156
2175
|
if (!v) {
|
|
2157
2176
|
a("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -2541,7 +2560,7 @@ class Ts extends _ {
|
|
|
2541
2560
|
};
|
|
2542
2561
|
const i = this.get("collectApiUrls"), o = !!(i?.custom || i?.saas), l = this.transformers.beforeBatch;
|
|
2543
2562
|
if (!o && l) {
|
|
2544
|
-
const c =
|
|
2563
|
+
const c = gt(n, l, "EventManager");
|
|
2545
2564
|
c !== null && (n = c);
|
|
2546
2565
|
}
|
|
2547
2566
|
return n;
|
|
@@ -2553,7 +2572,7 @@ class Ts extends _ {
|
|
|
2553
2572
|
});
|
|
2554
2573
|
const i = this.get("sessionReferrer"), o = this.get("sessionUtm");
|
|
2555
2574
|
let l = {
|
|
2556
|
-
id:
|
|
2575
|
+
id: ns(),
|
|
2557
2576
|
type: e.type,
|
|
2558
2577
|
page_url: t,
|
|
2559
2578
|
timestamp: s,
|
|
@@ -2570,7 +2589,7 @@ class Ts extends _ {
|
|
|
2570
2589
|
};
|
|
2571
2590
|
const c = this.get("collectApiUrls"), d = !!c?.custom, f = !!c?.saas, g = d || f, T = d && f, p = this.transformers.beforeSend;
|
|
2572
2591
|
if (p && (!g || d && !T)) {
|
|
2573
|
-
const K =
|
|
2592
|
+
const K = mt(l, p, "EventManager");
|
|
2574
2593
|
if (K === null)
|
|
2575
2594
|
return null;
|
|
2576
2595
|
l = K;
|
|
@@ -2747,13 +2766,13 @@ class Ts extends _ {
|
|
|
2747
2766
|
loadSessionCounts(e) {
|
|
2748
2767
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
2749
2768
|
return this.getInitialCounts();
|
|
2750
|
-
const t = this.get("userId") || "anonymous", s =
|
|
2769
|
+
const t = this.get("userId") || "anonymous", s = Fe(t, e);
|
|
2751
2770
|
try {
|
|
2752
2771
|
const n = localStorage.getItem(s);
|
|
2753
2772
|
if (!n)
|
|
2754
2773
|
return this.getInitialCounts();
|
|
2755
2774
|
const i = JSON.parse(n);
|
|
2756
|
-
return i._timestamp && Date.now() - i._timestamp >
|
|
2775
|
+
return i._timestamp && Date.now() - i._timestamp > xe ? (a("debug", "Session counts expired, clearing", {
|
|
2757
2776
|
data: { sessionId: e, age: Date.now() - i._timestamp }
|
|
2758
2777
|
}), localStorage.removeItem(s), this.getInitialCounts()) : typeof i.total == "number" && typeof i[u.CLICK] == "number" && typeof i[u.PAGE_VIEW] == "number" && typeof i[u.CUSTOM] == "number" && typeof i[u.VIEWPORT_VISIBLE] == "number" && typeof i[u.SCROLL] == "number" ? {
|
|
2759
2778
|
total: i.total,
|
|
@@ -2798,12 +2817,12 @@ class Ts extends _ {
|
|
|
2798
2817
|
cleanupExpiredSessionCounts() {
|
|
2799
2818
|
if (!(typeof window > "u" || typeof localStorage > "u"))
|
|
2800
2819
|
try {
|
|
2801
|
-
const e = localStorage.getItem(
|
|
2820
|
+
const e = localStorage.getItem($e);
|
|
2802
2821
|
if (e) {
|
|
2803
2822
|
const i = Date.now() - parseInt(e, 10);
|
|
2804
|
-
if (i <
|
|
2823
|
+
if (i < Be) {
|
|
2805
2824
|
a("debug", "Skipping session counts cleanup (throttled)", {
|
|
2806
|
-
data: { timeSinceLastCleanup: i, throttleMs:
|
|
2825
|
+
data: { timeSinceLastCleanup: i, throttleMs: Be }
|
|
2807
2826
|
});
|
|
2808
2827
|
return;
|
|
2809
2828
|
}
|
|
@@ -2816,14 +2835,14 @@ class Ts extends _ {
|
|
|
2816
2835
|
const l = localStorage.getItem(o);
|
|
2817
2836
|
if (l) {
|
|
2818
2837
|
const c = JSON.parse(l);
|
|
2819
|
-
c._timestamp && Date.now() - c._timestamp >
|
|
2838
|
+
c._timestamp && Date.now() - c._timestamp > xe && n.push(o);
|
|
2820
2839
|
}
|
|
2821
2840
|
} catch {
|
|
2822
2841
|
}
|
|
2823
2842
|
}
|
|
2824
2843
|
n.forEach((i) => {
|
|
2825
2844
|
localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
|
|
2826
|
-
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem(
|
|
2845
|
+
}), n.length > 0 && a("info", `Cleaned up ${n.length} expired session counts entries`), localStorage.setItem($e, Date.now().toString());
|
|
2827
2846
|
} catch (e) {
|
|
2828
2847
|
a("warn", "Failed to cleanup expired session counts", { error: e });
|
|
2829
2848
|
}
|
|
@@ -2857,7 +2876,7 @@ class Ts extends _ {
|
|
|
2857
2876
|
* @internal
|
|
2858
2877
|
*/
|
|
2859
2878
|
saveSessionCounts(e) {
|
|
2860
|
-
const t = this.get("userId") || "anonymous", s =
|
|
2879
|
+
const t = this.get("userId") || "anonymous", s = Fe(t, e);
|
|
2861
2880
|
try {
|
|
2862
2881
|
const n = {
|
|
2863
2882
|
...this.sessionEventCounts,
|
|
@@ -2894,7 +2913,7 @@ class Is {
|
|
|
2894
2913
|
const t = e.getItem(Te);
|
|
2895
2914
|
if (t)
|
|
2896
2915
|
return t;
|
|
2897
|
-
const s =
|
|
2916
|
+
const s = dt();
|
|
2898
2917
|
return e.setItem(Te, s), s;
|
|
2899
2918
|
}
|
|
2900
2919
|
}
|
|
@@ -2925,7 +2944,7 @@ class _s extends _ {
|
|
|
2925
2944
|
return;
|
|
2926
2945
|
}
|
|
2927
2946
|
const e = this.getProjectId();
|
|
2928
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
2947
|
+
this.broadcastChannel = new BroadcastChannel(Nt(e)), this.broadcastChannel.onmessage = (t) => {
|
|
2929
2948
|
const { action: s, sessionId: n, timestamp: i, projectId: o } = t.data ?? {};
|
|
2930
2949
|
o === e && (s === "session_start" && n && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", n), this.persistSession(n, i), this.isTracking && this.setupSessionTimeout()) : s && s !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: s } }));
|
|
2931
2950
|
};
|
|
@@ -2990,7 +3009,7 @@ class _s extends _ {
|
|
|
2990
3009
|
this.storageManager.setItem(t, s), this.storageManager.setSessionItem(t, s);
|
|
2991
3010
|
}
|
|
2992
3011
|
getSessionStorageKey() {
|
|
2993
|
-
return
|
|
3012
|
+
return Rt(this.getProjectId());
|
|
2994
3013
|
}
|
|
2995
3014
|
getProjectId() {
|
|
2996
3015
|
return this.projectId;
|
|
@@ -3358,7 +3377,7 @@ class ws extends _ {
|
|
|
3358
3377
|
};
|
|
3359
3378
|
}
|
|
3360
3379
|
trackCurrentPage = () => {
|
|
3361
|
-
const e = window.location.href, t =
|
|
3380
|
+
const e = window.location.href, t = ye(e, this.get("config").sensitiveQueryParams);
|
|
3362
3381
|
if (this.get("pageUrl") === t)
|
|
3363
3382
|
return;
|
|
3364
3383
|
const s = Date.now(), n = this.get("config").pageViewThrottleMs ?? 1e3;
|
|
@@ -3376,7 +3395,7 @@ class ws extends _ {
|
|
|
3376
3395
|
});
|
|
3377
3396
|
};
|
|
3378
3397
|
trackInitialPageView() {
|
|
3379
|
-
const e =
|
|
3398
|
+
const e = ye(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
|
|
3380
3399
|
this.lastPageViewTime = Date.now(), this.eventManager.track({
|
|
3381
3400
|
type: u.PAGE_VIEW,
|
|
3382
3401
|
page_url: e,
|
|
@@ -3532,7 +3551,7 @@ class bs extends _ {
|
|
|
3532
3551
|
return e.hasAttribute(`${b}-name`) ? e : e.closest(`[${b}-name]`);
|
|
3533
3552
|
}
|
|
3534
3553
|
getRelevantClickElement(e) {
|
|
3535
|
-
for (const t of
|
|
3554
|
+
for (const t of bt)
|
|
3536
3555
|
try {
|
|
3537
3556
|
if (e.matches(t))
|
|
3538
3557
|
return e;
|
|
@@ -3612,7 +3631,7 @@ class bs extends _ {
|
|
|
3612
3631
|
*/
|
|
3613
3632
|
sanitizeText(e) {
|
|
3614
3633
|
let t = e;
|
|
3615
|
-
for (const s of
|
|
3634
|
+
for (const s of at) {
|
|
3616
3635
|
const n = new RegExp(s.source, s.flags);
|
|
3617
3636
|
t = t.replace(n, "[REDACTED]");
|
|
3618
3637
|
}
|
|
@@ -4377,7 +4396,7 @@ class Ns extends _ {
|
|
|
4377
4396
|
navigationCounter = 0;
|
|
4378
4397
|
// Counter for handling simultaneous navigations edge case
|
|
4379
4398
|
constructor(e) {
|
|
4380
|
-
super(), this.eventManager = e, this.vitalThresholds =
|
|
4399
|
+
super(), this.eventManager = e, this.vitalThresholds = Ke(_e);
|
|
4381
4400
|
}
|
|
4382
4401
|
/**
|
|
4383
4402
|
* Starts tracking Web Vitals and performance metrics.
|
|
@@ -4395,7 +4414,7 @@ class Ns extends _ {
|
|
|
4395
4414
|
*/
|
|
4396
4415
|
async startTracking() {
|
|
4397
4416
|
const e = this.get("config"), t = e?.webVitalsMode ?? _e;
|
|
4398
|
-
this.vitalThresholds =
|
|
4417
|
+
this.vitalThresholds = Ke(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals(), this.observeLongTasks();
|
|
4399
4418
|
}
|
|
4400
4419
|
/**
|
|
4401
4420
|
* Stops tracking Web Vitals and cleans up resources.
|
|
@@ -4492,7 +4511,7 @@ class Ns extends _ {
|
|
|
4492
4511
|
const t = e.getEntries();
|
|
4493
4512
|
for (const s of t) {
|
|
4494
4513
|
const n = Number(s.duration.toFixed(2)), i = Date.now();
|
|
4495
|
-
i - this.lastLongTaskSentAt >=
|
|
4514
|
+
i - this.lastLongTaskSentAt >= Kt && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
4496
4515
|
}
|
|
4497
4516
|
},
|
|
4498
4517
|
{ type: "longtask", buffered: !0 }
|
|
@@ -4508,7 +4527,7 @@ class Ns extends _ {
|
|
|
4508
4527
|
return;
|
|
4509
4528
|
if (s)
|
|
4510
4529
|
s.add(e.type);
|
|
4511
|
-
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length >
|
|
4530
|
+
else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Yt) {
|
|
4512
4531
|
const i = this.navigationHistory.shift();
|
|
4513
4532
|
i && this.reportedByNav.delete(i);
|
|
4514
4533
|
}
|
|
@@ -4635,14 +4654,14 @@ class ae extends _ {
|
|
|
4635
4654
|
const e = Date.now();
|
|
4636
4655
|
if (e < this.burstBackoffUntil)
|
|
4637
4656
|
return !1;
|
|
4638
|
-
if (e - this.burstWindowStart >
|
|
4639
|
-
return this.burstBackoffUntil = e +
|
|
4657
|
+
if (e - this.burstWindowStart > Gt && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > jt)
|
|
4658
|
+
return this.burstBackoffUntil = e + ze, a("debug", "Error burst detected - entering cooldown", {
|
|
4640
4659
|
data: {
|
|
4641
4660
|
errorsInWindow: this.errorBurstCounter,
|
|
4642
|
-
cooldownMs:
|
|
4661
|
+
cooldownMs: ze
|
|
4643
4662
|
}
|
|
4644
4663
|
}), !1;
|
|
4645
|
-
const s = this.get("config").errorSampling ??
|
|
4664
|
+
const s = this.get("config").errorSampling ?? lt;
|
|
4646
4665
|
return Math.random() < s;
|
|
4647
4666
|
}
|
|
4648
4667
|
handleError = (e) => {
|
|
@@ -4694,12 +4713,12 @@ class ae extends _ {
|
|
|
4694
4713
|
}
|
|
4695
4714
|
}
|
|
4696
4715
|
sanitize(e) {
|
|
4697
|
-
const t = e.length >
|
|
4716
|
+
const t = e.length > Xe ? e.slice(0, Xe) + "..." : e;
|
|
4698
4717
|
return this.sanitizePii(t);
|
|
4699
4718
|
}
|
|
4700
4719
|
sanitizePii(e) {
|
|
4701
4720
|
let t = e;
|
|
4702
|
-
for (const s of
|
|
4721
|
+
for (const s of at) {
|
|
4703
4722
|
const n = new RegExp(s.source, s.flags);
|
|
4704
4723
|
t = t.replace(n, "[REDACTED]");
|
|
4705
4724
|
}
|
|
@@ -4707,19 +4726,19 @@ class ae extends _ {
|
|
|
4707
4726
|
}
|
|
4708
4727
|
shouldSuppressError(e, t) {
|
|
4709
4728
|
const s = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
4710
|
-
return i !== void 0 && s - i <
|
|
4729
|
+
return i !== void 0 && s - i < je ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > Xt ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > ee && this.pruneOldErrors(), !1));
|
|
4711
4730
|
}
|
|
4712
4731
|
static TRUNCATION_SUFFIX = `
|
|
4713
4732
|
...truncated`;
|
|
4714
4733
|
truncateStack(e) {
|
|
4715
|
-
if (e.length <=
|
|
4716
|
-
const t =
|
|
4734
|
+
if (e.length <= Ge) return this.sanitizePii(e);
|
|
4735
|
+
const t = Ge - ae.TRUNCATION_SUFFIX.length, s = e.slice(0, t) + ae.TRUNCATION_SUFFIX;
|
|
4717
4736
|
return this.sanitizePii(s);
|
|
4718
4737
|
}
|
|
4719
4738
|
pruneOldErrors() {
|
|
4720
4739
|
const e = Date.now();
|
|
4721
4740
|
for (const [n, i] of this.recentErrors.entries())
|
|
4722
|
-
e - i >
|
|
4741
|
+
e - i > je && this.recentErrors.delete(n);
|
|
4723
4742
|
if (this.recentErrors.size <= ee)
|
|
4724
4743
|
return;
|
|
4725
4744
|
const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), s = this.recentErrors.size - ee;
|
|
@@ -4860,10 +4879,10 @@ class Os extends _ {
|
|
|
4860
4879
|
this.set("userId", t);
|
|
4861
4880
|
const s = os(e);
|
|
4862
4881
|
this.set("collectApiUrls", s);
|
|
4863
|
-
const n =
|
|
4882
|
+
const n = Wt();
|
|
4864
4883
|
this.set("device", n);
|
|
4865
|
-
const i =
|
|
4866
|
-
this.set("pageUrl", i),
|
|
4884
|
+
const i = ye(window.location.href, e.sensitiveQueryParams);
|
|
4885
|
+
this.set("pageUrl", i), es() && this.set("mode", ie.QA);
|
|
4867
4886
|
}
|
|
4868
4887
|
/**
|
|
4869
4888
|
* Returns the current configuration object.
|
|
@@ -4914,7 +4933,7 @@ class Os extends _ {
|
|
|
4914
4933
|
valid: !1,
|
|
4915
4934
|
error: "Global metadata must be a plain object"
|
|
4916
4935
|
};
|
|
4917
|
-
const t =
|
|
4936
|
+
const t = ft("Global", e, "globalMetadata");
|
|
4918
4937
|
return t.valid ? { valid: !0 } : {
|
|
4919
4938
|
valid: !1,
|
|
4920
4939
|
error: t.error
|
|
@@ -4981,7 +5000,7 @@ class Os extends _ {
|
|
|
4981
5000
|
a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
|
|
4982
5001
|
return;
|
|
4983
5002
|
}
|
|
4984
|
-
const s = e.trim(), n =
|
|
5003
|
+
const s = e.trim(), n = ht(t), i = {
|
|
4985
5004
|
userId: s,
|
|
4986
5005
|
...n ? { traits: n } : {}
|
|
4987
5006
|
};
|
|
@@ -5000,7 +5019,7 @@ class Os extends _ {
|
|
|
5000
5019
|
*/
|
|
5001
5020
|
async resetIdentity() {
|
|
5002
5021
|
await this.managers.event?.flushImmediately(), this.set("identity", void 0), this.clearPersistedIdentity();
|
|
5003
|
-
const e =
|
|
5022
|
+
const e = dt();
|
|
5004
5023
|
this.managers.storage.setItem(Te, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
|
|
5005
5024
|
}
|
|
5006
5025
|
/**
|
|
@@ -5228,7 +5247,7 @@ const Hs = (r) => {
|
|
|
5228
5247
|
}
|
|
5229
5248
|
}
|
|
5230
5249
|
}, Xs = (r) => {
|
|
5231
|
-
typeof window > "u" || typeof document > "u" ||
|
|
5250
|
+
typeof window > "u" || typeof document > "u" || ts(r);
|
|
5232
5251
|
}, Gs = (r) => {
|
|
5233
5252
|
if (!(typeof window > "u" || typeof document > "u")) {
|
|
5234
5253
|
if (!h)
|
|
@@ -5264,7 +5283,7 @@ const Hs = (r) => {
|
|
|
5264
5283
|
return;
|
|
5265
5284
|
}
|
|
5266
5285
|
try {
|
|
5267
|
-
const t =
|
|
5286
|
+
const t = ht(e), s = {
|
|
5268
5287
|
userId: r.trim(),
|
|
5269
5288
|
...t ? { traits: t } : {}
|
|
5270
5289
|
};
|
|
@@ -5304,19 +5323,19 @@ const Hs = (r) => {
|
|
|
5304
5323
|
identify: zs,
|
|
5305
5324
|
resetIdentity: Qs
|
|
5306
5325
|
};
|
|
5307
|
-
var
|
|
5326
|
+
var Ae, C, G, Et, le, pt = -1, V = function(r) {
|
|
5308
5327
|
addEventListener("pageshow", (function(e) {
|
|
5309
|
-
e.persisted && (
|
|
5328
|
+
e.persisted && (pt = e.timeStamp, r(e));
|
|
5310
5329
|
}), !0);
|
|
5311
|
-
},
|
|
5330
|
+
}, Pe = function() {
|
|
5312
5331
|
var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
5313
5332
|
if (r && r.responseStart > 0 && r.responseStart < performance.now()) return r;
|
|
5314
5333
|
}, de = function() {
|
|
5315
|
-
var r =
|
|
5334
|
+
var r = Pe();
|
|
5316
5335
|
return r && r.activationStart || 0;
|
|
5317
5336
|
}, y = function(r, e) {
|
|
5318
|
-
var t =
|
|
5319
|
-
return
|
|
5337
|
+
var t = Pe(), s = "navigate";
|
|
5338
|
+
return pt >= 0 ? s = "back-forward-cache" : t && (document.prerendering || de() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
|
|
5320
5339
|
}, F = function(r, e, t) {
|
|
5321
5340
|
try {
|
|
5322
5341
|
if (PerformanceObserver.supportedEntryTypes.includes(r)) {
|
|
@@ -5336,7 +5355,7 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
|
|
|
5336
5355
|
return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
|
|
5337
5356
|
})(e.value, t), r(e));
|
|
5338
5357
|
};
|
|
5339
|
-
},
|
|
5358
|
+
}, De = function(r) {
|
|
5340
5359
|
requestAnimationFrame((function() {
|
|
5341
5360
|
return requestAnimationFrame((function() {
|
|
5342
5361
|
return r();
|
|
@@ -5351,18 +5370,18 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
|
|
|
5351
5370
|
return function() {
|
|
5352
5371
|
e || (r(), e = !0);
|
|
5353
5372
|
};
|
|
5354
|
-
}, H = -1,
|
|
5373
|
+
}, H = -1, et = function() {
|
|
5355
5374
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
5356
5375
|
}, ce = function(r) {
|
|
5357
5376
|
document.visibilityState === "hidden" && H > -1 && (H = r.type === "visibilitychange" ? r.timeStamp : 0, Ks());
|
|
5358
|
-
},
|
|
5377
|
+
}, tt = function() {
|
|
5359
5378
|
addEventListener("visibilitychange", ce, !0), addEventListener("prerenderingchange", ce, !0);
|
|
5360
5379
|
}, Ks = function() {
|
|
5361
5380
|
removeEventListener("visibilitychange", ce, !0), removeEventListener("prerenderingchange", ce, !0);
|
|
5362
|
-
},
|
|
5363
|
-
return H < 0 && (H =
|
|
5381
|
+
}, ke = function() {
|
|
5382
|
+
return H < 0 && (H = et(), tt(), V((function() {
|
|
5364
5383
|
setTimeout((function() {
|
|
5365
|
-
H =
|
|
5384
|
+
H = et(), tt();
|
|
5366
5385
|
}), 0);
|
|
5367
5386
|
}))), { get firstHiddenTime() {
|
|
5368
5387
|
return H;
|
|
@@ -5371,21 +5390,21 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
|
|
|
5371
5390
|
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
5372
5391
|
return r();
|
|
5373
5392
|
}), !0) : r();
|
|
5374
|
-
},
|
|
5393
|
+
}, Le = [1800, 3e3], St = function(r, e) {
|
|
5375
5394
|
e = e || {}, Q((function() {
|
|
5376
|
-
var t, s =
|
|
5395
|
+
var t, s = ke(), n = y("FCP"), i = F("paint", (function(o) {
|
|
5377
5396
|
o.forEach((function(l) {
|
|
5378
5397
|
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - de(), 0), n.entries.push(l), t(!0)));
|
|
5379
5398
|
}));
|
|
5380
5399
|
}));
|
|
5381
|
-
i && (t = w(r, n,
|
|
5382
|
-
n = y("FCP"), t = w(r, n,
|
|
5400
|
+
i && (t = w(r, n, Le, e.reportAllChanges), V((function(o) {
|
|
5401
|
+
n = y("FCP"), t = w(r, n, Le, e.reportAllChanges), De((function() {
|
|
5383
5402
|
n.value = performance.now() - o.timeStamp, t(!0);
|
|
5384
5403
|
}));
|
|
5385
5404
|
})));
|
|
5386
5405
|
}));
|
|
5387
|
-
},
|
|
5388
|
-
e = e || {},
|
|
5406
|
+
}, Me = [0.1, 0.25], Ys = function(r, e) {
|
|
5407
|
+
e = e || {}, St(ue((function() {
|
|
5389
5408
|
var t, s = y("CLS", 0), n = 0, i = [], o = function(c) {
|
|
5390
5409
|
c.forEach((function(d) {
|
|
5391
5410
|
if (!d.hadRecentInput) {
|
|
@@ -5394,24 +5413,24 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
|
|
|
5394
5413
|
}
|
|
5395
5414
|
})), n > s.value && (s.value = n, s.entries = i, t());
|
|
5396
5415
|
}, l = F("layout-shift", o);
|
|
5397
|
-
l && (t = w(r, s,
|
|
5416
|
+
l && (t = w(r, s, Me, e.reportAllChanges), z((function() {
|
|
5398
5417
|
o(l.takeRecords()), t(!0);
|
|
5399
5418
|
})), V((function() {
|
|
5400
|
-
n = 0, s = y("CLS", 0), t = w(r, s,
|
|
5419
|
+
n = 0, s = y("CLS", 0), t = w(r, s, Me, e.reportAllChanges), De((function() {
|
|
5401
5420
|
return t();
|
|
5402
5421
|
}));
|
|
5403
5422
|
})), setTimeout(t, 0));
|
|
5404
5423
|
})));
|
|
5405
|
-
},
|
|
5424
|
+
}, Tt = 0, pe = 1 / 0, J = 0, qs = function(r) {
|
|
5406
5425
|
r.forEach((function(e) {
|
|
5407
|
-
e.interactionId && (pe = Math.min(pe, e.interactionId), J = Math.max(J, e.interactionId),
|
|
5426
|
+
e.interactionId && (pe = Math.min(pe, e.interactionId), J = Math.max(J, e.interactionId), Tt = J ? (J - pe) / 7 + 1 : 0);
|
|
5408
5427
|
}));
|
|
5409
|
-
},
|
|
5410
|
-
return
|
|
5428
|
+
}, It = function() {
|
|
5429
|
+
return Ae ? Tt : performance.interactionCount || 0;
|
|
5411
5430
|
}, Js = function() {
|
|
5412
|
-
"interactionCount" in performance ||
|
|
5413
|
-
}, A = [], te = /* @__PURE__ */ new Map(),
|
|
5414
|
-
var r = Math.min(A.length - 1, Math.floor((
|
|
5431
|
+
"interactionCount" in performance || Ae || (Ae = F("event", qs, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
5432
|
+
}, A = [], te = /* @__PURE__ */ new Map(), vt = 0, Zs = function() {
|
|
5433
|
+
var r = Math.min(A.length - 1, Math.floor((It() - vt) / 50));
|
|
5415
5434
|
return A[r];
|
|
5416
5435
|
}, er = [], tr = function(r) {
|
|
5417
5436
|
if (er.forEach((function(n) {
|
|
@@ -5431,50 +5450,50 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
|
|
|
5431
5450
|
}));
|
|
5432
5451
|
}
|
|
5433
5452
|
}
|
|
5434
|
-
},
|
|
5453
|
+
}, _t = function(r) {
|
|
5435
5454
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
5436
5455
|
return r = ue(r), document.visibilityState === "hidden" ? r() : (t = e(r), z(r)), t;
|
|
5437
|
-
},
|
|
5456
|
+
}, Ce = [200, 500], sr = function(r, e) {
|
|
5438
5457
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, Q((function() {
|
|
5439
5458
|
var t;
|
|
5440
5459
|
Js();
|
|
5441
5460
|
var s, n = y("INP"), i = function(l) {
|
|
5442
|
-
|
|
5461
|
+
_t((function() {
|
|
5443
5462
|
l.forEach(tr);
|
|
5444
5463
|
var c = Zs();
|
|
5445
5464
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, s());
|
|
5446
5465
|
}));
|
|
5447
5466
|
}, o = F("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
5448
|
-
s = w(r, n,
|
|
5467
|
+
s = w(r, n, Ce, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), z((function() {
|
|
5449
5468
|
i(o.takeRecords()), s(!0);
|
|
5450
5469
|
})), V((function() {
|
|
5451
|
-
|
|
5470
|
+
vt = It(), A.length = 0, te.clear(), n = y("INP"), s = w(r, n, Ce, e.reportAllChanges);
|
|
5452
5471
|
})));
|
|
5453
5472
|
})));
|
|
5454
|
-
},
|
|
5473
|
+
}, Re = [2500, 4e3], Se = {}, rr = function(r, e) {
|
|
5455
5474
|
e = e || {}, Q((function() {
|
|
5456
|
-
var t, s =
|
|
5475
|
+
var t, s = ke(), n = y("LCP"), i = function(c) {
|
|
5457
5476
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(d) {
|
|
5458
5477
|
d.startTime < s.firstHiddenTime && (n.value = Math.max(d.startTime - de(), 0), n.entries = [d], t());
|
|
5459
5478
|
}));
|
|
5460
5479
|
}, o = F("largest-contentful-paint", i);
|
|
5461
5480
|
if (o) {
|
|
5462
|
-
t = w(r, n,
|
|
5481
|
+
t = w(r, n, Re, e.reportAllChanges);
|
|
5463
5482
|
var l = ue((function() {
|
|
5464
5483
|
Se[n.id] || (i(o.takeRecords()), o.disconnect(), Se[n.id] = !0, t(!0));
|
|
5465
5484
|
}));
|
|
5466
5485
|
["keydown", "click"].forEach((function(c) {
|
|
5467
5486
|
addEventListener(c, (function() {
|
|
5468
|
-
return
|
|
5487
|
+
return _t(l);
|
|
5469
5488
|
}), { once: !0, capture: !0 });
|
|
5470
5489
|
})), z(l), V((function(c) {
|
|
5471
|
-
n = y("LCP"), t = w(r, n,
|
|
5490
|
+
n = y("LCP"), t = w(r, n, Re, e.reportAllChanges), De((function() {
|
|
5472
5491
|
n.value = performance.now() - c.timeStamp, Se[n.id] = !0, t(!0);
|
|
5473
5492
|
}));
|
|
5474
5493
|
}));
|
|
5475
5494
|
}
|
|
5476
5495
|
}));
|
|
5477
|
-
},
|
|
5496
|
+
}, Ne = [800, 1800], nr = function r(e) {
|
|
5478
5497
|
document.prerendering ? Q((function() {
|
|
5479
5498
|
return r(e);
|
|
5480
5499
|
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
@@ -5482,17 +5501,17 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
|
|
|
5482
5501
|
}), !0) : setTimeout(e, 0);
|
|
5483
5502
|
}, ir = function(r, e) {
|
|
5484
5503
|
e = e || {};
|
|
5485
|
-
var t = y("TTFB"), s = w(r, t,
|
|
5504
|
+
var t = y("TTFB"), s = w(r, t, Ne, e.reportAllChanges);
|
|
5486
5505
|
nr((function() {
|
|
5487
|
-
var n =
|
|
5506
|
+
var n = Pe();
|
|
5488
5507
|
n && (t.value = Math.max(n.responseStart - de(), 0), t.entries = [n], s(!0), V((function() {
|
|
5489
|
-
t = y("TTFB", 0), (s = w(r, t,
|
|
5508
|
+
t = y("TTFB", 0), (s = w(r, t, Ne, e.reportAllChanges))(!0);
|
|
5490
5509
|
})));
|
|
5491
5510
|
}));
|
|
5492
|
-
}, W = { passive: !0, capture: !0 }, or = /* @__PURE__ */ new Date(),
|
|
5493
|
-
C || (C = e, G = r,
|
|
5494
|
-
},
|
|
5495
|
-
if (G >= 0 && G <
|
|
5511
|
+
}, W = { passive: !0, capture: !0 }, or = /* @__PURE__ */ new Date(), st = function(r, e) {
|
|
5512
|
+
C || (C = e, G = r, Et = /* @__PURE__ */ new Date(), wt(removeEventListener), yt());
|
|
5513
|
+
}, yt = function() {
|
|
5514
|
+
if (G >= 0 && G < Et - or) {
|
|
5496
5515
|
var r = { entryType: "first-input", name: C.type, target: C.target, cancelable: C.cancelable, startTime: C.timeStamp, processingStart: C.timeStamp + G };
|
|
5497
5516
|
le.forEach((function(e) {
|
|
5498
5517
|
e(r);
|
|
@@ -5503,44 +5522,44 @@ var Le, C, G, pt, le, St = -1, V = function(r) {
|
|
|
5503
5522
|
var e = (r.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - r.timeStamp;
|
|
5504
5523
|
r.type == "pointerdown" ? (function(t, s) {
|
|
5505
5524
|
var n = function() {
|
|
5506
|
-
|
|
5525
|
+
st(t, s), o();
|
|
5507
5526
|
}, i = function() {
|
|
5508
5527
|
o();
|
|
5509
5528
|
}, o = function() {
|
|
5510
5529
|
removeEventListener("pointerup", n, W), removeEventListener("pointercancel", i, W);
|
|
5511
5530
|
};
|
|
5512
5531
|
addEventListener("pointerup", n, W), addEventListener("pointercancel", i, W);
|
|
5513
|
-
})(e, r) :
|
|
5532
|
+
})(e, r) : st(e, r);
|
|
5514
5533
|
}
|
|
5515
|
-
},
|
|
5534
|
+
}, wt = function(r) {
|
|
5516
5535
|
["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
|
|
5517
5536
|
return r(e, ar, W);
|
|
5518
5537
|
}));
|
|
5519
|
-
},
|
|
5538
|
+
}, Oe = [100, 300], lr = function(r, e) {
|
|
5520
5539
|
e = e || {}, Q((function() {
|
|
5521
|
-
var t, s =
|
|
5540
|
+
var t, s = ke(), n = y("FID"), i = function(c) {
|
|
5522
5541
|
c.startTime < s.firstHiddenTime && (n.value = c.processingStart - c.startTime, n.entries.push(c), t(!0));
|
|
5523
5542
|
}, o = function(c) {
|
|
5524
5543
|
c.forEach(i);
|
|
5525
5544
|
}, l = F("first-input", o);
|
|
5526
|
-
t = w(r, n,
|
|
5545
|
+
t = w(r, n, Oe, e.reportAllChanges), l && (z(ue((function() {
|
|
5527
5546
|
o(l.takeRecords()), l.disconnect();
|
|
5528
5547
|
}))), V((function() {
|
|
5529
5548
|
var c;
|
|
5530
|
-
n = y("FID"), t = w(r, n,
|
|
5549
|
+
n = y("FID"), t = w(r, n, Oe, e.reportAllChanges), le = [], G = -1, C = null, wt(addEventListener), c = i, le.push(c), yt();
|
|
5531
5550
|
})));
|
|
5532
5551
|
}));
|
|
5533
5552
|
};
|
|
5534
5553
|
const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5535
5554
|
__proto__: null,
|
|
5536
|
-
CLSThresholds:
|
|
5537
|
-
FCPThresholds:
|
|
5538
|
-
FIDThresholds:
|
|
5539
|
-
INPThresholds:
|
|
5540
|
-
LCPThresholds:
|
|
5541
|
-
TTFBThresholds:
|
|
5555
|
+
CLSThresholds: Me,
|
|
5556
|
+
FCPThresholds: Le,
|
|
5557
|
+
FIDThresholds: Oe,
|
|
5558
|
+
INPThresholds: Ce,
|
|
5559
|
+
LCPThresholds: Re,
|
|
5560
|
+
TTFBThresholds: Ne,
|
|
5542
5561
|
onCLS: Ys,
|
|
5543
|
-
onFCP:
|
|
5562
|
+
onFCP: St,
|
|
5544
5563
|
onFID: lr,
|
|
5545
5564
|
onINP: sr,
|
|
5546
5565
|
onLCP: rr,
|
|
@@ -5565,19 +5584,19 @@ export {
|
|
|
5565
5584
|
Er as MAX_STRING_LENGTH,
|
|
5566
5585
|
pr as MAX_STRING_LENGTH_IN_ARRAY,
|
|
5567
5586
|
ie as Mode,
|
|
5568
|
-
|
|
5587
|
+
at as PII_PATTERNS,
|
|
5569
5588
|
O as PermanentError,
|
|
5570
5589
|
re as RateLimitError,
|
|
5571
|
-
|
|
5590
|
+
We as SamplingRateValidationError,
|
|
5572
5591
|
Z as ScrollDirection,
|
|
5573
|
-
|
|
5592
|
+
Ot as SessionTimeoutValidationError,
|
|
5574
5593
|
$ as SpecialApiUrl,
|
|
5575
5594
|
ne as TimeoutError,
|
|
5576
5595
|
j as TraceLogValidationError,
|
|
5577
5596
|
_r as WEB_VITALS_GOOD_THRESHOLDS,
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5597
|
+
Qe as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
|
|
5598
|
+
Qt as WEB_VITALS_POOR_THRESHOLDS,
|
|
5599
|
+
Ke as getWebVitalsThresholds,
|
|
5581
5600
|
Tr as isPrimaryScrollEvent,
|
|
5582
5601
|
Ir as isSecondaryScrollEvent,
|
|
5583
5602
|
yr as tracelog
|