@utk09/ui-observability 0.3.0 → 0.4.0

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/index.js CHANGED
@@ -1,45 +1,52 @@
1
- import { $ as e, $t as t, A as n, At as r, B as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as p, Gt as m, H as h, It as g, J as ee, Jt as te, K as ne, Kt as re, L as _, Lt as ie, M as ae, Mt as oe, N as se, Nt as ce, O as le, Ot as ue, Pt as de, Qt as fe, R as pe, S as me, St as he, T as ge, Tt as _e, Ut as ve, V as ye, Vt as v, W as be, Wt as xe, Xt as Se, Yt as Ce, Zt as we, _ as Te, _t as Ee, a as y, an as De, at as Oe, b as ke, bt as Ae, c as je, ct as Me, d as Ne, dt as Pe, en as Fe, et as Ie, ft as Le, g as Re, gt as ze, h as Be, ht as Ve, i as He, in as Ue, it as We, j as Ge, jt as Ke, k as qe, kt as Je, l as b, lt as Ye, m as Xe, mt as Ze, n as x, nn as Qe, nt as $e, o as et, on as tt, ot as nt, p as rt, pt as it, q as at, r as ot, rn as st, rt as S, s as ct, st as lt, t as ut, tn as dt, tt as C, u as ft, ut as pt, v as mt, wt as ht, x as gt, xt as _t, yt as vt, zt as yt } from "./constants-CQr0wwbQ.js";
1
+ import { $t as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Dt as s, E as c, Et as l, F as u, Ft as d, G as f, Gt as p, H as m, Ht as h, I as g, It as _, J as ee, K as te, Kt as ne, Lt as re, M as ie, Mt as ae, N as oe, Nt as se, O as ce, Ot as le, Pt as ue, Qt as de, R as v, Rt as fe, S as pe, St as me, T as y, Tt as he, U as ge, V as _e, Wt as ve, Xt as ye, Y as be, Yt as xe, Zt as Se, _ as Ce, _t as we, a as b, an as Te, at as Ee, b as De, bt as Oe, c as ke, cn as Ae, ct as je, d as Me, dt as Ne, en as Pe, et as Fe, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, in as He, it as x, j as Ue, jt as We, k as Ge, kt as Ke, l as S, lt as qe, m as Je, mt as Ye, n as C, nn as Xe, nt as w, o as Ze, on as Qe, ot as $e, p as et, pt as tt, q as nt, qt as rt, r as it, rn as at, rt as ot, s as st, sn as ct, st as lt, t as ut, tn as dt, tt as ft, u as pt, ut as mt, v as ht, vt as gt, wt as _t, x as vt, xt as yt, z as bt } from "./constants-CrU3IUyy.js";
2
2
  //#region src/utils/timer.ts
3
- function bt(e) {
4
- return Math.round((performance.now() - e) * d) / d;
3
+ function xt(e) {
4
+ return Math.round((performance.now() - e) * u) / u;
5
5
  }
6
- function xt(e, t, n, r, i) {
7
- e.logMetric(`${t}.duration`, bt(n), "ms", "histogram", {
6
+ function St(e, t, n, r, i) {
7
+ e.logMetric(`${t}.duration`, xt(n), "ms", "histogram", {
8
8
  status: r,
9
9
  ...i
10
10
  });
11
11
  }
12
- function St(e, t, n, r, i) {
12
+ function Ct(e, t, n, r, i) {
13
13
  e.error(`${t} failed`, r, {
14
- "action.duration_ms": bt(n),
14
+ "action.duration_ms": xt(n),
15
15
  status: "FAILURE",
16
16
  ...i
17
17
  });
18
18
  }
19
- function Ct(e, t, n, r) {
19
+ function wt(e, t, n, r) {
20
20
  let i = performance.now();
21
21
  try {
22
22
  let a = n();
23
- return xt(e, t, i, "SUCCESS", r), a;
23
+ return St(e, t, i, "SUCCESS", r), a;
24
24
  } catch (n) {
25
- throw St(e, t, i, n, r), n;
25
+ throw Ct(e, t, i, n, r), n;
26
26
  }
27
27
  }
28
- async function wt(e, t, n, r) {
28
+ async function Tt(e, t, n, r) {
29
29
  let i = performance.now();
30
30
  try {
31
31
  let a = await n();
32
- return xt(e, t, i, "SUCCESS", r), a;
32
+ return St(e, t, i, "SUCCESS", r), a;
33
33
  } catch (n) {
34
- throw St(e, t, i, n, r), n;
34
+ throw Ct(e, t, i, n, r), n;
35
35
  }
36
36
  }
37
37
  //#endregion
38
38
  //#region src/core/logger.ts
39
- function Tt(e) {
40
- return e instanceof Error ? e : Error(String(e));
39
+ function Et(e, t) {
40
+ if (e instanceof Error) return e;
41
+ let n = t.guard("record.sanitize_failed", "describing an error reason", () => String(e));
42
+ return Error(n ?? typeof e);
41
43
  }
42
- var w = class e {
44
+ function Dt(e) {
45
+ if (typeof e != "object" || !e || Array.isArray(e) || e instanceof Error) return !1;
46
+ let t = Object.getPrototypeOf(e);
47
+ return t === null || Object.getPrototypeOf(t) === null;
48
+ }
49
+ var T = class e {
43
50
  runtime;
44
51
  namespace;
45
52
  options;
@@ -76,7 +83,7 @@ var w = class e {
76
83
  logEvent = (e, t) => {
77
84
  this.write("INFO", "event", e, t);
78
85
  };
79
- logMetric = (e, t, n = ae, r = "gauge", i) => {
86
+ logMetric = (e, t, n = ie, r = "gauge", i) => {
80
87
  this.write("INFO", "metric", e, {
81
88
  "metric.name": e,
82
89
  "metric.value": t,
@@ -85,11 +92,11 @@ var w = class e {
85
92
  ...i
86
93
  });
87
94
  };
88
- timeSync = (e, t, n) => Ct(this, e, t, n);
89
- timeAsync = (e, t, n) => wt(this, e, t, n);
95
+ timeSync = (e, t, n) => wt(this, e, t, n);
96
+ timeAsync = (e, t, n) => Tt(this, e, t, n);
90
97
  write(e, t, n, r) {
91
98
  if (!this.runtime.builder.isEnabled(e)) return;
92
- let i = this.runtime.builder.build({
99
+ let { record: i, dropped: a } = this.runtime.builder.build({
93
100
  level: e,
94
101
  type: t,
95
102
  body: n,
@@ -97,7 +104,7 @@ var w = class e {
97
104
  scoped: this.options.scopedContext,
98
105
  payload: r
99
106
  });
100
- i && t !== "metric" && this.runtime.breadcrumbs.push({
107
+ t !== "metric" && a !== "redact" && this.runtime.breadcrumbs.push({
101
108
  t: Date.now(),
102
109
  category: t === "action" ? "action" : t === "event" ? "event" : "log",
103
110
  message: n
@@ -105,39 +112,39 @@ var w = class e {
105
112
  }
106
113
  writeError(e, t, n, r) {
107
114
  if (!this.runtime.builder.isEnabled(e)) return;
108
- let i = n === void 0 ? void 0 : Tt(n), a = this.runtime.builder.build({
115
+ let i = r === void 0 && Dt(n), a = i ? n : r, o = i || n === void 0 ? void 0 : Et(n, this.runtime.diagnostics), { record: s } = this.runtime.builder.build({
109
116
  level: e,
110
117
  type: "system",
111
118
  body: t,
112
119
  namespace: this.namespace,
113
120
  scoped: this.options.scopedContext,
114
121
  payload: {
115
- ...r,
116
- ...i ? {
117
- "error.type": i.name,
118
- "error.message": i.message,
119
- "error.stack_trace": i.stack
122
+ ...a,
123
+ ...o ? {
124
+ "error.type": o.name,
125
+ "error.message": o.message,
126
+ "error.stack_trace": o.stack
120
127
  } : {},
121
128
  breadcrumbs: this.runtime.breadcrumbs.snapshot()
122
129
  }
123
130
  });
124
- this.runtime.console.write(e, t, i ?? a?.attributes), this.runtime.emit(a);
131
+ this.runtime.console.write(e, t, o ?? s?.attributes), this.runtime.emit(s);
125
132
  }
126
133
  };
127
134
  //#endregion
128
135
  //#region src/utils/unref.ts
129
- function T(e) {
136
+ function E(e) {
130
137
  typeof e != "number" && e.unref?.();
131
138
  }
132
139
  //#endregion
133
140
  //#region src/models/bus.ts
134
- function E(e) {
141
+ function D(e) {
135
142
  return {
136
- p: me,
143
+ p: pe,
137
144
  m: e
138
145
  };
139
146
  }
140
- function D(e) {
147
+ function O(e) {
141
148
  if (typeof e != "object" || !e) return null;
142
149
  let t = e;
143
150
  if (t.p !== "ui-observability/1" || typeof t.m != "object" || t.m === null) return null;
@@ -146,12 +153,12 @@ function D(e) {
146
153
  }
147
154
  //#endregion
148
155
  //#region src/bus/links.ts
149
- var Et = Symbol.for(ie);
150
- function Dt(e, t) {
156
+ var Ot = Symbol.for(fe);
157
+ function kt(e, t) {
151
158
  if (typeof window > "u" || window.parent === window) return null;
152
159
  let n;
153
160
  try {
154
- n = window.parent[Et];
161
+ n = window.parent[Ot];
155
162
  } catch {
156
163
  return null;
157
164
  }
@@ -169,10 +176,10 @@ function Dt(e, t) {
169
176
  }
170
177
  };
171
178
  }
172
- function Ot(e, t) {
179
+ function At(e, t) {
173
180
  if (typeof window > "u" || window.parent === window) return null;
174
181
  let n = (t) => {
175
- let n = D(t.data);
182
+ let n = O(t.data);
176
183
  n && t.source === window.parent && e(n, {
177
184
  link: "parent",
178
185
  origin: t.origin
@@ -182,7 +189,7 @@ function Ot(e, t) {
182
189
  kind: "parent",
183
190
  post(e) {
184
191
  t.guard("bus.send_failed", "postMessage to parent", () => {
185
- window.parent.postMessage(E(e), "*");
192
+ window.parent.postMessage(D(e), "*");
186
193
  });
187
194
  },
188
195
  close() {
@@ -190,10 +197,10 @@ function Ot(e, t) {
190
197
  }
191
198
  };
192
199
  }
193
- function kt(e, t, n) {
200
+ function jt(e, t, n) {
194
201
  if (typeof window > "u") return null;
195
202
  let r = /* @__PURE__ */ new Set([window.location.origin, ...t]), i = /* @__PURE__ */ new Map(), a = (t) => {
196
- let a = D(t.data);
203
+ let a = O(t.data);
197
204
  if (a) {
198
205
  if (!r.has(t.origin)) {
199
206
  n.report("bus.untrusted_origin", `ignored a bus message from ${t.origin}. Add it to bus.trustedOrigins if it is yours.`, {
@@ -218,7 +225,7 @@ function kt(e, t, n) {
218
225
  continue;
219
226
  }
220
227
  n.guard("bus.send_failed", "postMessage to child", () => {
221
- a.postMessage(E(e), r);
228
+ a.postMessage(D(e), r);
222
229
  });
223
230
  }
224
231
  },
@@ -227,12 +234,12 @@ function kt(e, t, n) {
227
234
  }
228
235
  };
229
236
  }
230
- function At(e, t, n) {
237
+ function Mt(e, t, n) {
231
238
  let r = globalThis.BroadcastChannel;
232
239
  if (r === void 0) return null;
233
240
  let i = n.guard("bus.send_failed", "opening BroadcastChannel", () => new r(e));
234
241
  return i ? (i.onmessage = (e) => {
235
- let n = D(e.data);
242
+ let n = O(e.data);
236
243
  n && t(n, {
237
244
  link: "broadcast",
238
245
  origin: "same-origin"
@@ -241,7 +248,7 @@ function At(e, t, n) {
241
248
  kind: "broadcast",
242
249
  post(e) {
243
250
  n.guard("bus.send_failed", "BroadcastChannel.postMessage", () => {
244
- i.postMessage(E(e));
251
+ i.postMessage(D(e));
245
252
  });
246
253
  },
247
254
  close() {
@@ -251,26 +258,29 @@ function At(e, t, n) {
251
258
  }
252
259
  }) : null;
253
260
  }
254
- function jt(e, t, n) {
255
- let r = globalThis.fin?.InterApplicationBus;
256
- return r ? (n.guardAsync("bus.send_failed", "InterApplicationBus.subscribe", () => r.subscribe({ uuid: "*" }, e, (e) => {
257
- let n = D(e);
258
- n && t(n, {
261
+ function Nt(e, t, n, r) {
262
+ let i = globalThis.fin?.InterApplicationBus;
263
+ if (!i) return null;
264
+ if (!t) return r.report("openfin.unavailable", "no OpenFin application uuid, so the InterApplicationBus link stays closed"), null;
265
+ let a = `${e}.${t}`;
266
+ return r.guardAsync("bus.send_failed", "InterApplicationBus.subscribe", () => i.subscribe({ uuid: t }, a, (e) => {
267
+ let t = O(e);
268
+ t && n(t, {
259
269
  link: "openfin",
260
270
  origin: "openfin"
261
271
  });
262
272
  })), {
263
273
  kind: "openfin",
264
- post(t) {
265
- n.guardAsync("bus.send_failed", "InterApplicationBus.publish", () => r.publish(e, E(t)));
274
+ post(e) {
275
+ r.guardAsync("bus.send_failed", "InterApplicationBus.publish", () => i.publish(a, D(e)));
266
276
  },
267
277
  close() {}
268
- }) : null;
278
+ };
269
279
  }
270
- function Mt(e, t) {
280
+ function Pt(e, t) {
271
281
  let n = globalThis, r = n.postMessage;
272
282
  return n.WorkerGlobalScope === void 0 || !r ? null : (n.addEventListener?.("message", (t) => {
273
- let n = D(t.data);
283
+ let n = O(t.data);
274
284
  n && e(n, {
275
285
  link: "owner",
276
286
  origin: "same-origin"
@@ -279,15 +289,15 @@ function Mt(e, t) {
279
289
  kind: "owner",
280
290
  post(e) {
281
291
  t.guard("bus.send_failed", "worker postMessage", () => {
282
- r(E(e));
292
+ r(D(e));
283
293
  });
284
294
  },
285
295
  close() {}
286
296
  });
287
297
  }
288
- function Nt(e, t, n) {
298
+ function Ft(e, t, n) {
289
299
  let r = (e) => {
290
- let n = D(e.data);
300
+ let n = O(e.data);
291
301
  n && t(n, {
292
302
  link: "worker",
293
303
  origin: "same-origin"
@@ -297,7 +307,7 @@ function Nt(e, t, n) {
297
307
  kind: "worker",
298
308
  post(t) {
299
309
  n.guard("bus.send_failed", "postMessage to a worker", () => {
300
- e.postMessage(E(t));
310
+ e.postMessage(D(t));
301
311
  });
302
312
  },
303
313
  close() {
@@ -307,14 +317,14 @@ function Nt(e, t, n) {
307
317
  }
308
318
  //#endregion
309
319
  //#region src/bus/bus.ts
310
- var Pt = {
311
- timeoutMs: gt,
320
+ var It = {
321
+ timeoutMs: vt,
312
322
  maxAttempts: 3
313
- }, Ft = [
323
+ }, Lt = [
314
324
  "children",
315
325
  "direct",
316
326
  "worker"
317
- ], It = class {
327
+ ], Rt = class {
318
328
  config;
319
329
  diagnostics;
320
330
  platform;
@@ -329,7 +339,7 @@ var Pt = {
329
339
  isOpenFinProvider = !1;
330
340
  resolved = !1;
331
341
  awaitingWelcome = null;
332
- constructor(e, t, n, r, i, a, o = Pt) {
342
+ constructor(e, t, n, r, i, a, o = It) {
333
343
  this.config = e, this.diagnostics = t, this.platform = n, this.contextId = r, this.tabId = i, this.handlers = a, this.handshakeOptions = o;
334
344
  }
335
345
  getRole() {
@@ -343,7 +353,7 @@ var Pt = {
343
353
  if (e.mode === "off") return this.role = "sender", this.resolved = !0, this.role;
344
354
  if (this.isOpenFinProvider = this.resolveOpenFinProvider(), e.mode === "sender" || e.mode === "forwarder") return this.role = e.mode, this.openControlLinks(), this.role === "forwarder" && (this.upstream = this.candidateUpstream(), this.upstream || this.diagnostics.report("bus.no_owner", "bus.mode is \"forwarder\" but there is no owner to forward to. Records will be dropped.")), this.resolved = !0, this.announce(), this.role;
345
355
  this.openControlLinks();
346
- let t = Dt(this.receive, this.diagnostics);
356
+ let t = kt(this.receive, this.diagnostics);
347
357
  if (t) return this.role = "forwarder", this.upstream = t, this.resolved = !0, this.diagnostics.report("bus.role_resolved", "attached directly to the same-origin parent runtime", {
348
358
  role: "forwarder",
349
359
  via: "direct"
@@ -394,7 +404,7 @@ var Pt = {
394
404
  this.receive(e, n);
395
405
  }
396
406
  attachWorker(e) {
397
- this.links.push(Nt(e, this.receive, this.diagnostics));
407
+ this.links.push(Ft(e, this.receive, this.diagnostics));
398
408
  }
399
409
  broadcastJourney(e) {
400
410
  this.post({
@@ -449,7 +459,7 @@ var Pt = {
449
459
  }
450
460
  };
451
461
  canOwn(e) {
452
- return this.role === "sender" ? e === "openfin" ? this.isOpenFinProvider : Ft.includes(e) : !1;
462
+ return this.role === "sender" ? e === "openfin" ? this.isOpenFinProvider : Lt.includes(e) : !1;
453
463
  }
454
464
  resolveOpenFinProvider() {
455
465
  let e = this.config.bus.openFinRole;
@@ -464,22 +474,22 @@ var Pt = {
464
474
  isCrossOriginFrame() {
465
475
  if (typeof window > "u" || window.parent === window) return !1;
466
476
  try {
467
- return window.parent.location, !1;
477
+ return Reflect.get(window.parent, "location"), !1;
468
478
  } catch {
469
479
  return !0;
470
480
  }
471
481
  }
472
482
  candidateUpstream() {
473
- return this.platform.isWorker ? Mt(this.receive, this.diagnostics) : this.platform.isTopLevelDocument ? this.platform.platform === "openfin" && !this.isOpenFinProvider ? this.ensureOpenFinLink() : null : Ot(this.receive, this.diagnostics);
483
+ return this.platform.isWorker ? Pt(this.receive, this.diagnostics) : this.platform.isTopLevelDocument ? this.platform.platform === "openfin" && !this.isOpenFinProvider ? this.ensureOpenFinLink() : null : At(this.receive, this.diagnostics);
474
484
  }
475
485
  openControlLinks() {
476
486
  let e = (e) => {
477
487
  e && this.links.push(e);
478
488
  };
479
- this.platform.isTopLevelDocument && (e(kt(this.receive, this.config.bus.trustedOrigins, this.diagnostics)), e(At(ke, this.receive, this.diagnostics))), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
489
+ this.platform.isTopLevelDocument && (e(jt(this.receive, this.config.bus.trustedOrigins, this.diagnostics)), e(Mt(De, this.receive, this.diagnostics))), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
480
490
  }
481
491
  ensureOpenFinLink() {
482
- return this.openFinLink ??= jt(ke, this.receive, this.diagnostics), this.openFinLink;
492
+ return this.openFinLink ??= Nt(De, this.platform.openfinUuid, this.receive, this.diagnostics), this.openFinLink;
483
493
  }
484
494
  handshake(e) {
485
495
  return new Promise((t) => {
@@ -493,7 +503,7 @@ var Pt = {
493
503
  let i = setTimeout(() => {
494
504
  r(!1);
495
505
  }, this.handshakeOptions.timeoutMs);
496
- T(i), e.post({
506
+ E(i), e.post({
497
507
  t: "hello",
498
508
  from: this.contextId,
499
509
  tabId: this.tabId
@@ -510,30 +520,30 @@ var Pt = {
510
520
  from: this.contextId
511
521
  });
512
522
  }
513
- }, O = null;
514
- function k(e, t) {
523
+ }, k = null;
524
+ function A(e, t) {
515
525
  let n = e[t];
516
526
  return n !== void 0 && e instanceof n;
517
527
  }
518
- function Lt(e) {
519
- if (O) return O;
528
+ function zt(e) {
529
+ if (k) return k;
520
530
  let t = globalThis, n = t.navigator?.userAgent ?? "", r = "browser", i, a, o = !1, s = t.fin?.me;
521
- return k(t, "ServiceWorkerGlobalScope") ? (r = "service_worker", o = !0) : k(t, "SharedWorkerGlobalScope") ? (r = "shared_worker", o = !0) : k(t, "WorkerGlobalScope") ? (r = "web_worker", o = !0) : s === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? r = "ionic" : t.cordova !== void 0 || Rt(n) ? r = "mobile_webview" : typeof document > "u" && typeof process < "u" && (r = "node") : (r = Ve.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "reading fin.me.identity", () => {
531
+ return A(t, "ServiceWorkerGlobalScope") ? (r = "service_worker", o = !0) : A(t, "SharedWorkerGlobalScope") ? (r = "shared_worker", o = !0) : A(t, "WorkerGlobalScope") ? (r = "web_worker", o = !0) : s === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? r = "ionic" : t.cordova !== void 0 || Bt(n) ? r = "mobile_webview" : typeof document > "u" && typeof process < "u" && (r = "node") : (r = Re.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "reading fin.me.identity", () => {
522
532
  let e = s.identity;
523
533
  i = e?.uuid, a = e?.name;
524
- })), O = {
534
+ })), k = {
525
535
  platform: r,
526
536
  openfinUuid: i,
527
537
  openfinName: a,
528
538
  userAgent: n,
529
539
  isWorker: o,
530
- isTopLevelDocument: zt()
531
- }, O;
540
+ isTopLevelDocument: Vt()
541
+ }, k;
532
542
  }
533
- function Rt(t) {
534
- return ut.test(t) ? !0 : (e.test(t) || lt.test(t) && pt.test(t)) && t.includes("AppleWebKit") && !t.includes("Safari/");
543
+ function Bt(e) {
544
+ return ut.test(e) ? !0 : (Fe.test(e) || je.test(e) && Ne.test(e)) && e.includes("AppleWebKit") && !e.includes("Safari/");
535
545
  }
536
- function zt() {
546
+ function Vt() {
537
547
  if (typeof window > "u") return !1;
538
548
  try {
539
549
  return window.self === window.top;
@@ -541,20 +551,20 @@ function zt() {
541
551
  return !1;
542
552
  }
543
553
  }
544
- function Bt() {
554
+ function Ht() {
545
555
  try {
546
556
  return typeof location < "u" ? location.href : "";
547
557
  } catch {
548
558
  return "";
549
559
  }
550
560
  }
551
- function A(e) {
561
+ function j(e) {
552
562
  let t = e.search(/[?#]/);
553
563
  return t === -1 ? e : e.slice(0, t);
554
564
  }
555
565
  //#endregion
556
566
  //#region src/capture/errors.ts
557
- var Vt = class {
567
+ var Ut = class {
558
568
  ctx;
559
569
  name = "errors";
560
570
  installed = !1;
@@ -574,7 +584,7 @@ var Vt = class {
574
584
  let t = e.target, n = t?.src ?? t?.href ?? "";
575
585
  if (t !== null && t !== globalThis && n !== "") {
576
586
  if (!this.ctx.config.capture.resourceErrors) return;
577
- let e = this.ctx.config.capture.fullUrls ? n : A(n);
587
+ let e = this.ctx.config.capture.fullUrls ? n : j(n);
578
588
  this.ctx.breadcrumbs.push({
579
589
  t: Date.now(),
580
590
  category: "http",
@@ -600,32 +610,32 @@ var Vt = class {
600
610
  report(e, t, n) {
601
611
  let r = Date.now();
602
612
  if (r - this.windowStart > 1e4 && (this.windowStart = r, this.windowCount = 0), this.windowCount++, this.windowCount > 20) {
603
- this.ctx.diagnostics.report("capture.rate_limited", `more than 20 errors in ${String(i)}ms, suppressing the rest of this window`);
613
+ this.ctx.diagnostics.report("capture.rate_limited", `more than 20 errors in ${String(_e)}ms, suppressing the rest of this window`);
604
614
  return;
605
615
  }
606
- let a = t instanceof Error ? t : Error(String(t)), o = (a.stack ?? "").split("\n")[1] ?? "", s = `${a.name}|${a.message}|${o}`, c = this.seen.get(s);
607
- if (c && r - c.at < 5e3) {
608
- c.count++, c.at = r;
616
+ let i = t instanceof Error ? t : Error(String(t)), a = (i.stack ?? "").split("\n")[1] ?? "", o = `${i.name}|${i.message}|${a}`, s = this.seen.get(o);
617
+ if (s && r - s.at < 5e3) {
618
+ s.count++, s.at = r;
609
619
  return;
610
620
  }
611
- let l = c ? c.count - 1 : 0;
612
- if (this.seen.delete(s), this.seen.set(s, {
621
+ let c = s ? s.count - 1 : 0;
622
+ if (this.seen.delete(o), this.seen.set(o, {
613
623
  at: r,
614
624
  count: 1
615
625
  }), this.seen.size > 200) {
616
626
  let [e] = this.seen.keys();
617
627
  this.seen.delete(e);
618
628
  }
619
- this.ctx.logger.error(a.message === "" ? e : a.message, a, {
629
+ this.ctx.logger.error(i.message === "" ? e : i.message, i, {
620
630
  ...n,
621
631
  "error.captured_by": e,
622
- "error.suppressed_count": l
632
+ "error.suppressed_count": c
623
633
  });
624
634
  }
625
635
  };
626
636
  //#endregion
627
637
  //#region src/capture/interactions.ts
628
- function Ht(e) {
638
+ function Wt(e) {
629
639
  if (e === null) return "unknown";
630
640
  let t = e.tagName.toLowerCase(), n = e.getAttribute("data-testid") ?? e.getAttribute("data-test-id");
631
641
  if (n !== null) return `[data-testid="${n}"]`;
@@ -635,10 +645,10 @@ function Ht(e) {
635
645
  let i = e.getAttribute("class")?.trim() ?? "";
636
646
  return i === "" ? t : `${t}.${i.split(/\s+/).slice(0, 2).join(".")}`;
637
647
  }
638
- function j() {
648
+ function M() {
639
649
  return history;
640
650
  }
641
- var Ut = class {
651
+ var Gt = class {
642
652
  ctx;
643
653
  name = "interactions";
644
654
  installed = !1;
@@ -652,10 +662,10 @@ var Ut = class {
652
662
  this.installed || typeof document > "u" || (this.installed = !0, this.lastUrl = location.href, this.ctx.config.capture.interactions && addEventListener("click", this.onClick, !0), this.ctx.config.capture.navigation && (this.installHistory(), addEventListener("popstate", this.onNavigate), addEventListener("hashchange", this.onNavigate)));
653
663
  }
654
664
  uninstall() {
655
- this.installed && (this.installed = !1, removeEventListener("click", this.onClick, !0), removeEventListener("popstate", this.onNavigate), removeEventListener("hashchange", this.onNavigate), this.originalPushState && (j().pushState = this.originalPushState), this.originalReplaceState && (j().replaceState = this.originalReplaceState), this.originalPushState = null, this.originalReplaceState = null);
665
+ this.installed && (this.installed = !1, removeEventListener("click", this.onClick, !0), removeEventListener("popstate", this.onNavigate), removeEventListener("hashchange", this.onNavigate), this.originalPushState && (M().pushState = this.originalPushState), this.originalReplaceState && (M().replaceState = this.originalReplaceState), this.originalPushState = null, this.originalReplaceState = null);
656
666
  }
657
667
  onClick = (e) => {
658
- let t = e.target, n = Ht(t instanceof Element ? t : null), r = t instanceof HTMLElement ? t.innerText.trim().slice(0, 50) : "";
668
+ let t = e.target, n = Wt(t instanceof Element ? t : null), r = t instanceof HTMLElement ? t.innerText.trim().slice(0, 50) : "";
659
669
  this.ctx.tracing.rotate("interaction"), this.ctx.breadcrumbs.push({
660
670
  t: Date.now(),
661
671
  category: "click",
@@ -667,7 +677,7 @@ var Ut = class {
667
677
  let e = this.lastUrl, t = location.href;
668
678
  if (e === t) return;
669
679
  this.lastUrl = t;
670
- let n = this.ctx.config.capture.fullUrls, r = n ? e : A(e), i = n ? t : A(t);
680
+ let n = this.ctx.config.capture.fullUrls, r = n ? e : j(e), i = n ? t : j(t);
671
681
  this.ctx.tracing.rotate("navigation"), this.ctx.breadcrumbs.push({
672
682
  t: Date.now(),
673
683
  category: "navigation",
@@ -676,7 +686,7 @@ var Ut = class {
676
686
  };
677
687
  installHistory() {
678
688
  if (typeof history > "u" || this.originalPushState) return;
679
- let e = j(), t = e.pushState, n = e.replaceState;
689
+ let e = M(), t = e.pushState, n = e.replaceState;
680
690
  this.originalPushState = t, this.originalReplaceState = n;
681
691
  let r = this.onNavigate;
682
692
  e.pushState = function(...e) {
@@ -688,15 +698,15 @@ var Ut = class {
688
698
  };
689
699
  //#endregion
690
700
  //#region src/capture/types.ts
691
- function Wt(e, t) {
701
+ function Kt(e, t) {
692
702
  return t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e));
693
703
  }
694
704
  //#endregion
695
705
  //#region src/capture/network.ts
696
- function M() {
706
+ function N() {
697
707
  return XMLHttpRequest.prototype;
698
708
  }
699
- var Gt = class {
709
+ var qt = class {
700
710
  ctx;
701
711
  name = "network";
702
712
  originalFetch = null;
@@ -709,10 +719,10 @@ var Gt = class {
709
719
  this.ctx.config.capture.fetch && this.installFetch(), this.ctx.config.capture.xhr && this.installXhr();
710
720
  }
711
721
  uninstall() {
712
- this.originalFetch &&= (globalThis.fetch = this.originalFetch, null), this.originalOpen &&= (M().open = this.originalOpen, null), this.originalSend &&= (M().send = this.originalSend, null);
722
+ this.originalFetch &&= (globalThis.fetch = this.originalFetch, null), this.originalOpen &&= (N().open = this.originalOpen, null), this.originalSend &&= (N().send = this.originalSend, null);
713
723
  }
714
724
  ignored(e) {
715
- return Wt(e, this.ctx.config.capture.ignoreUrls);
725
+ return Kt(e, this.ctx.config.capture.ignoreUrls);
716
726
  }
717
727
  installFetch() {
718
728
  if (typeof globalThis.fetch != "function" || this.originalFetch) return;
@@ -725,7 +735,7 @@ var Gt = class {
725
735
  let o = typeof i == "string" ? i : i instanceof URL ? i.href : i.url, s = (a?.method ?? (i instanceof Request ? i.method : "GET")).toUpperCase();
726
736
  if (n(o)) return e(i, a);
727
737
  let c = i, l = a;
728
- if (Wt(o, t.config.capture.propagateTraceHeaderTo)) try {
738
+ if (Kt(o, t.config.capture.propagateTraceHeaderTo)) try {
729
739
  let e = Object.entries(t.tracing.headers());
730
740
  if (i instanceof Request) {
731
741
  let t = new Headers(i.headers);
@@ -755,7 +765,7 @@ var Gt = class {
755
765
  if (typeof XMLHttpRequest > "u" || this.originalOpen) return;
756
766
  let e = (e) => this.ignored(e), t = (e, t, n, r) => {
757
767
  this.record(e, t, n, r, void 0);
758
- }, n = M(), r = n.open, i = n.send;
768
+ }, n = N(), r = n.open, i = n.send;
759
769
  this.originalOpen = r, this.originalSend = i, n.open = function(e, t, ...n) {
760
770
  this.__uiobs = {
761
771
  method: e.toUpperCase(),
@@ -774,7 +784,7 @@ var Gt = class {
774
784
  };
775
785
  }
776
786
  record(e, t, n, r, i) {
777
- let a = this.ctx.config.capture.fullUrls ? t : A(t);
787
+ let a = this.ctx.config.capture.fullUrls ? t : j(t);
778
788
  this.ctx.diagnostics.guard("capture.record_failed", `recording ${e} ${a}`, () => {
779
789
  let t = Math.round(r);
780
790
  this.ctx.breadcrumbs.push({
@@ -803,13 +813,13 @@ var Gt = class {
803
813
  };
804
814
  //#endregion
805
815
  //#region src/capture/web-vitals.ts
806
- function Kt() {
816
+ function Jt() {
807
817
  return import(
808
818
  /* @vite-ignore */
809
819
  "web-vitals"
810
820
  );
811
821
  }
812
- var qt = class {
822
+ var Yt = class {
813
823
  ctx;
814
824
  name = "web-vitals";
815
825
  installed = !1;
@@ -823,7 +833,7 @@ var qt = class {
823
833
  this.installed = !1;
824
834
  }
825
835
  async loadWebVitals() {
826
- let e = this.ctx.config.capture.webVitalsLoader ?? Kt, t = await this.ctx.diagnostics.guardAsync("capture.install_failed", "loading web-vitals", e);
836
+ let e = this.ctx.config.capture.webVitalsLoader ?? Jt, t = await this.ctx.diagnostics.guardAsync("capture.install_failed", "loading web-vitals", e);
827
837
  if (!t) {
828
838
  this.ctx.diagnostics.report("capture.install_failed", "web-vitals is not available, so LCP, CLS and INP are unavailable. Navigation timing still works.");
829
839
  return;
@@ -855,78 +865,84 @@ var qt = class {
855
865
  };
856
866
  //#endregion
857
867
  //#region src/models/log-record.ts
858
- function Jt() {
868
+ function Xt() {
859
869
  return `${String(Date.now())}000000`;
860
870
  }
861
- function Yt(e) {
871
+ function Zt(e) {
862
872
  if (typeof e != "object" || !e) return !1;
863
873
  let t = e;
864
874
  return typeof t.body == "string" && typeof t.severityText == "string" && typeof t.timeUnixNano == "string" && typeof t.attributes == "object" && t.attributes !== null && typeof t.resource == "object" && t.resource !== null;
865
875
  }
866
876
  //#endregion
867
877
  //#region src/utils/identity.ts
868
- function N(e) {
878
+ function P(e) {
869
879
  let t = new Uint8Array(e);
870
880
  if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") crypto.getRandomValues(t);
871
881
  else for (let n = 0; n < e; n++) t[n] = Math.floor(Math.random() * 256);
872
882
  return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
873
883
  }
874
- function P() {
884
+ function F() {
875
885
  try {
876
886
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return crypto.randomUUID();
877
887
  } catch {}
878
- return N(16);
888
+ return P(16);
879
889
  }
880
- function Xt(e, t, n) {
890
+ function Qt(e, t, n) {
881
891
  return n.guard("storage.unavailable", `reading ${e}Storage`, () => (e === "local" ? localStorage : sessionStorage).getItem(t)) ?? null;
882
892
  }
883
- function F(e, t, n, r) {
893
+ function I(e, t, n, r) {
884
894
  r.guard("storage.unavailable", `writing ${e}Storage`, () => {
885
895
  (e === "local" ? localStorage : sessionStorage).setItem(t, n);
886
896
  });
887
897
  }
888
- function Zt(e) {
889
- let t = P(), n = Date.now(), r = P(), i = Xt("local", v, e);
890
- if (i) try {
891
- let e = JSON.parse(i);
892
- e.id && n - (e.lastSeenAt ?? 0) < 18e5 && (r = e.id);
898
+ function $t(t) {
899
+ let n = F(), r = Date.now(), i = F(), a = Qt("local", h, t);
900
+ if (a) try {
901
+ let e = JSON.parse(a);
902
+ e.id && r - (e.lastSeenAt ?? 0) < 18e5 && (i = e.id);
893
903
  } catch {
894
- e.report("storage.degraded", "session record was not JSON, starting a new session");
904
+ t.report("storage.degraded", "session record was not JSON, starting a new session");
895
905
  }
896
- let a = JSON.stringify({
897
- id: r,
898
- lastSeenAt: n
906
+ let o = JSON.stringify({
907
+ id: i,
908
+ lastSeenAt: r
899
909
  });
900
- F("local", v, a, e);
901
- let o = Xt("session", "ui-observability.tab", e) ?? "";
902
- return o || (o = P(), F("session", fe, o, e)), {
903
- sessionId: r,
904
- tabId: o,
905
- contextId: t
910
+ I("local", h, o, t);
911
+ let s = Qt("session", "ui-observability.tab", t) ?? "";
912
+ return s || (s = F(), I("session", e, s, t)), {
913
+ sessionId: i,
914
+ tabId: s,
915
+ contextId: n
906
916
  };
907
917
  }
908
- var Qt = 0;
909
- function $t(e, t) {
910
- let n = Date.now();
911
- if (n - Qt < 6e4) return;
912
- Qt = n;
913
- let r = JSON.stringify({
914
- id: e,
915
- lastSeenAt: n
916
- });
917
- F("local", v, r, t);
918
- }
918
+ var en = class {
919
+ diagnostics;
920
+ lastTouchAt = 0;
921
+ constructor(e) {
922
+ this.diagnostics = e;
923
+ }
924
+ touch(e) {
925
+ let t = Date.now();
926
+ if (t - this.lastTouchAt < 6e4) return;
927
+ this.lastTouchAt = t;
928
+ let n = JSON.stringify({
929
+ id: e,
930
+ lastSeenAt: t
931
+ });
932
+ I("local", h, n, this.diagnostics);
933
+ }
934
+ };
919
935
  //#endregion
920
936
  //#region src/models/batch.ts
921
- function en(e) {
937
+ function tn(e) {
922
938
  if (typeof e != "object" || !e) return !1;
923
939
  let t = Reflect.get(e, "id"), n = Reflect.get(e, "createdAt"), r = Reflect.get(e, "attempts"), i = Reflect.get(e, "records");
924
940
  return typeof t == "string" && typeof n == "number" && typeof r == "number" && Array.isArray(i);
925
941
  }
926
- function tn(e) {
942
+ function nn(e) {
927
943
  if (e.records.length < 2) return null;
928
944
  let t = Math.floor(e.records.length / 2), n = (t) => ({
929
- id: P(),
945
+ id: F(),
930
946
  records: t,
931
947
  createdAt: e.createdAt,
932
948
  attempts: e.attempts
@@ -935,13 +951,13 @@ function tn(e) {
935
951
  }
936
952
  //#endregion
937
953
  //#region src/utils/lock.ts
938
- function nn(e, t, n, { skipIfBusy: r = !0 } = {}) {
954
+ function rn(e, t, n, { skipIfBusy: r = !0 } = {}) {
939
955
  let i = globalThis.navigator?.locks;
940
956
  return i?.request ? t.guardAsync("storage.degraded", `acquiring lock ${e}`, () => i.request(e, { ifAvailable: r }, (e) => e ? n() : Promise.resolve(void 0))) : n();
941
957
  }
942
958
  //#endregion
943
959
  //#region src/storage/keys.ts
944
- function I(e, t) {
960
+ function L(e, t) {
945
961
  let n = [];
946
962
  return t.guard("storage.unavailable", "enumerating localStorage", () => {
947
963
  for (let t = 0; t < localStorage.length; t++) {
@@ -952,23 +968,23 @@ function I(e, t) {
952
968
  }
953
969
  //#endregion
954
970
  //#region src/storage/emergency-queue.ts
955
- function rn(e) {
971
+ function an(e) {
956
972
  let t = String(e.createdAt).padStart(14, "0");
957
- return `${_}${t}.${e.id}`;
973
+ return `${v}${t}.${e.id}`;
958
974
  }
959
- function an(e, t) {
975
+ function on(e, t) {
960
976
  let n = t.guard("storage.degraded", "an emergency entry was not JSON and was dropped", () => JSON.parse(e));
961
- return n === void 0 ? null : en(n) ? n : (t.report("storage.degraded", "an emergency entry was not a batch and was dropped"), null);
977
+ return n === void 0 ? null : tn(n) ? n : (t.report("storage.degraded", "an emergency entry was not a batch and was dropped"), null);
962
978
  }
963
- async function on(e, t) {
979
+ async function sn(e, t) {
964
980
  let n = 0;
965
- for (let r of I(_, t)) {
981
+ for (let r of L(v, t)) {
966
982
  let i = t.guard("storage.unavailable", "reading the emergency queue", () => {
967
983
  let e = localStorage.getItem(r);
968
984
  return localStorage.removeItem(r), e;
969
985
  });
970
986
  if (!i) continue;
971
- let a = an(i, t);
987
+ let a = on(i, t);
972
988
  if (a !== null) try {
973
989
  await e.save(a), n++;
974
990
  } catch (e) {
@@ -977,38 +993,41 @@ async function on(e, t) {
977
993
  }
978
994
  return n;
979
995
  }
980
- function sn(e, t) {
996
+ function cn(e, t) {
981
997
  let n = `writing the emergency queue, ${String(e.records.length)} records`;
982
998
  t.guard("storage.quota_exceeded", n, () => {
983
- let n = I(_, t);
999
+ let n = L(v, t);
984
1000
  for (let e of n.slice(0, Math.max(0, n.length - 20 + 1))) localStorage.removeItem(e);
985
- localStorage.setItem(rn(e), JSON.stringify(e));
1001
+ localStorage.setItem(an(e), JSON.stringify(e));
986
1002
  });
987
1003
  }
988
- async function cn(e, t) {
989
- return await nn("ui-observability.emergency", t, () => on(e, t), { skipIfBusy: !1 }) ?? 0;
1004
+ async function ln(e, t) {
1005
+ return await rn("ui-observability.emergency", t, () => sn(e, t), { skipIfBusy: !1 }) ?? 0;
990
1006
  }
991
1007
  //#endregion
992
1008
  //#region src/storage/local-storage.ts
993
- function ln(e) {
1009
+ function un(e) {
994
1010
  let t = String(e.createdAt).padStart(14, "0");
995
- return `${mt}${t}.${e.id}`;
1011
+ return `${ht}${t}.${e.id}`;
996
1012
  }
997
- var un = class {
1013
+ var dn = class {
998
1014
  limits;
999
1015
  diagnostics;
1000
1016
  onGap;
1001
- name = te;
1017
+ name = xe;
1002
1018
  constructor(e, t, n) {
1003
1019
  this.limits = e, this.diagnostics = t, this.onGap = n;
1004
1020
  }
1005
1021
  async save(e) {
1006
- if (this.diagnostics.guard("storage.quota_exceeded", "localStorage refused a batch, evicting the oldest", () => (localStorage.setItem(ln(e), JSON.stringify(e)), !0)) !== !0) {
1007
- let e = this.keys();
1008
- this.evict(e.slice(0, Math.ceil(e.length / 4)));
1022
+ if (this.write(e, "localStorage refused a batch, evicting the oldest")) {
1023
+ await this.prune();
1009
1024
  return;
1010
1025
  }
1011
- await this.prune();
1026
+ this.evictForQuota(), this.write(e, "localStorage refused a batch even after evicting") || this.reportGap({
1027
+ batches: 1,
1028
+ records: e.records.length,
1029
+ reason: "quota"
1030
+ });
1012
1031
  }
1013
1032
  take(e) {
1014
1033
  let t = [];
@@ -1062,7 +1081,7 @@ var un = class {
1062
1081
  t.reason = "over_capacity";
1063
1082
  for (let e of r.slice(0, i)) n(e.key, e.records);
1064
1083
  }
1065
- return t.batches > 0 && (this.diagnostics.report("storage.evicted", `dropped ${String(t.batches)} stored batches (${String(t.records)} records)`, { ...t }), this.onGap?.(t)), Promise.resolve(t);
1084
+ return this.reportGap(t), Promise.resolve(t);
1066
1085
  }
1067
1086
  count() {
1068
1087
  return Promise.resolve(this.keys().length);
@@ -1073,11 +1092,29 @@ var un = class {
1073
1092
  close() {
1074
1093
  return Promise.resolve();
1075
1094
  }
1095
+ write(e, t) {
1096
+ return this.diagnostics.guard("storage.quota_exceeded", t, () => (localStorage.setItem(un(e), JSON.stringify(e)), !0)) === !0;
1097
+ }
1098
+ evictForQuota() {
1099
+ let e = this.keys(), t = {
1100
+ batches: 0,
1101
+ records: 0,
1102
+ reason: "quota"
1103
+ };
1104
+ for (let n of e.slice(0, Math.ceil(e.length / 4))) {
1105
+ let e = this.read(n);
1106
+ this.removeKey(n), t.batches++, t.records += e?.records.length ?? 0;
1107
+ }
1108
+ this.reportGap(t);
1109
+ }
1110
+ reportGap(e) {
1111
+ e.batches !== 0 && (this.diagnostics.report("storage.evicted", `dropped ${String(e.batches)} stored batches (${String(e.records)} records)`, { ...e }), this.onGap?.(e));
1112
+ }
1076
1113
  read(e) {
1077
1114
  let t = this.diagnostics.guard("storage.unavailable", "reading a stored batch", () => localStorage.getItem(e));
1078
1115
  if (!t) return null;
1079
1116
  let n = this.diagnostics.guard("storage.degraded", "a stored batch was corrupt and was removed", () => JSON.parse(t));
1080
- return n === void 0 ? null : en(n) ? n : (this.diagnostics.report("storage.degraded", "a stored entry was not a batch and was dropped"), null);
1117
+ return n === void 0 ? null : tn(n) ? n : (this.diagnostics.report("storage.degraded", "a stored entry was not a batch and was dropped"), null);
1081
1118
  }
1082
1119
  keyOf(e) {
1083
1120
  return this.keys().find((t) => t.endsWith(`.${e}`)) ?? null;
@@ -1091,18 +1128,18 @@ var un = class {
1091
1128
  });
1092
1129
  }
1093
1130
  keys() {
1094
- return I(mt, this.diagnostics);
1131
+ return L(ht, this.diagnostics);
1095
1132
  }
1096
1133
  };
1097
1134
  //#endregion
1098
1135
  //#region src/storage/memory-storage.ts
1099
- function dn(e) {
1136
+ function fn(e) {
1100
1137
  return e.reduce((e, t) => e + t.records.length, 0);
1101
1138
  }
1102
- var L = class {
1139
+ var R = class {
1103
1140
  limits;
1104
1141
  onGap;
1105
- name = Ce;
1142
+ name = ye;
1106
1143
  batches = [];
1107
1144
  constructor(e, t) {
1108
1145
  this.limits = e, this.onGap = t;
@@ -1126,12 +1163,12 @@ var L = class {
1126
1163
  records: 0,
1127
1164
  reason: "expired"
1128
1165
  }, n = this.batches.filter((t) => t.createdAt < e);
1129
- this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records += dn(n);
1166
+ this.batches = this.batches.filter((t) => t.createdAt >= e), t.batches += n.length, t.records += fn(n);
1130
1167
  let r = this.batches.length - this.limits.maxBatches;
1131
1168
  if (r > 0) {
1132
1169
  t.reason = "over_capacity";
1133
1170
  let e = this.batches.slice(0, r);
1134
- this.batches = this.batches.slice(r), t.batches += e.length, t.records += dn(e);
1171
+ this.batches = this.batches.slice(r), t.batches += e.length, t.records += fn(e);
1135
1172
  }
1136
1173
  return t.batches > 0 && this.onGap?.(t), Promise.resolve(t);
1137
1174
  }
@@ -1144,7 +1181,7 @@ var L = class {
1144
1181
  close() {
1145
1182
  return this.batches = [], Promise.resolve();
1146
1183
  }
1147
- }, fn = {
1184
+ }, pn = {
1148
1185
  name: Se,
1149
1186
  save: () => Promise.resolve(),
1150
1187
  take: () => Promise.resolve([]),
@@ -1159,112 +1196,116 @@ var L = class {
1159
1196
  clear: () => Promise.resolve(),
1160
1197
  close: () => Promise.resolve()
1161
1198
  };
1162
- function pn(e) {
1199
+ function mn(e) {
1163
1200
  return e.guard("storage.unavailable", "reading indexedDB", () => globalThis.indexedDB != null) === !0;
1164
1201
  }
1165
- function mn(e) {
1166
- return e.guard("storage.unavailable", "probing localStorage", () => (localStorage.setItem(we, "1"), localStorage.removeItem(we), !0)) === !0;
1202
+ function hn(e) {
1203
+ return e.guard("storage.unavailable", "probing localStorage", () => (localStorage.setItem(de, "1"), localStorage.removeItem(de), !0)) === !0;
1167
1204
  }
1168
- async function hn(e, t, n, r, i) {
1169
- if (e === "none") return fn;
1170
- if (e === "memory") return new L(n, i);
1205
+ async function gn(e, t, n, r, i) {
1206
+ if (e === "none") return pn;
1207
+ if (e === "memory") return new R(n, i);
1171
1208
  if (e === "indexeddb" || e === "auto") {
1172
- if (pn(r)) {
1209
+ if (mn(r)) {
1173
1210
  let e = await r.guardAsync("storage.unavailable", "opening IndexedDB", async () => {
1174
- let { IndexedDbStorage: e } = await import("./indexeddb-storage-bibcl7ZS.js");
1211
+ let { IndexedDbStorage: e } = await import("./indexeddb-storage-CSaDuHGk.js");
1175
1212
  return new e(t, n, r, i);
1176
1213
  });
1177
1214
  if (e) return e;
1178
1215
  }
1179
- if (e === "indexeddb") return r.report("storage.degraded", "IndexedDB was asked for by name and is unavailable, using memory"), new L(n, i);
1216
+ if (e === "indexeddb") return r.report("storage.degraded", "IndexedDB was asked for by name and is unavailable, using memory"), new R(n, i);
1180
1217
  }
1181
- return mn(r) ? new un(n, r, i) : (r.report("storage.degraded", "no persistent storage available, offline logs are memory only"), new L(n, i));
1218
+ return hn(r) ? new dn(n, r, i) : (r.report("storage.degraded", "no persistent storage available, offline logs are memory only"), new R(n, i));
1182
1219
  }
1183
1220
  //#endregion
1184
1221
  //#region src/utils/sanitize.ts
1185
- function R(e, t) {
1222
+ function z(e, t) {
1186
1223
  if (e.length <= t) return e;
1187
- let n = gn(e.charCodeAt(t - 1)) ? t - 1 : t;
1224
+ let n = _n(e.charCodeAt(t - 1)) ? t - 1 : t;
1188
1225
  return `${e.slice(0, n)}… [truncated ${String(e.length - n)} chars]`;
1189
1226
  }
1190
- function gn(e) {
1227
+ function _n(e) {
1191
1228
  return e >= 55296 && e <= 56319;
1192
1229
  }
1193
- function _n(e) {
1230
+ function vn(e) {
1194
1231
  return `[Element ${(e.nodeName ?? "NODE").toLowerCase()}${e.id ? `#${e.id}` : ""}${typeof e.className == "string" && e.className ? `.${e.className.trim().split(/\s+/).slice(0, 3).join(".")}` : ""}]`;
1195
1232
  }
1196
- function z(e, t) {
1197
- let n = { bytes: 0 };
1233
+ function B(e, t) {
1234
+ let n = {
1235
+ bytes: 0,
1236
+ nodes: 0
1237
+ };
1198
1238
  return {
1199
- value: V(e, t, /* @__PURE__ */ new WeakSet(), 0, n),
1239
+ value: H(e, t, /* @__PURE__ */ new WeakSet(), 0, n),
1200
1240
  bytes: n.bytes
1201
1241
  };
1202
1242
  }
1203
- function B(e, t) {
1204
- return t.bytes += H(e) + 2, e;
1243
+ function V(e, t) {
1244
+ return t.bytes += U(e) + 2, e;
1205
1245
  }
1206
- function V(e, t, n, r, i) {
1246
+ function H(e, t, n, r, i) {
1247
+ if (i.nodes++, i.nodes > t.maxNodes) return V("[MaxNodes]", i);
1207
1248
  if (e == null) return i.bytes += 4, e;
1208
- if (typeof e == "string") return B(R(e, t.maxAttributeChars), i);
1249
+ if (typeof e == "string") return V(z(e, t.maxAttributeChars), i);
1209
1250
  if (typeof e == "number") return i.bytes += 8, Number.isFinite(e) ? e : String(e);
1210
1251
  if (typeof e == "boolean") return i.bytes += 5, e;
1211
- if (typeof e == "bigint") return B(`${e.toString()}n`, i);
1212
- if (typeof e == "symbol") return B(e.toString(), i);
1213
- if (typeof e == "function") return B(`[Function ${e.name === "" ? "anonymous" : e.name}]`, i);
1214
- if (r >= t.maxDepth) return B("[MaxDepth]", i);
1215
- if (n.has(e)) return B("[Circular]", i);
1252
+ if (typeof e == "bigint") return V(`${e.toString()}n`, i);
1253
+ if (typeof e == "symbol") return V(e.toString(), i);
1254
+ if (typeof e == "function") return V(`[Function ${e.name === "" ? "anonymous" : e.name}]`, i);
1255
+ if (r >= t.maxDepth) return V("[MaxDepth]", i);
1256
+ if (n.has(e)) return V("[Circular]", i);
1216
1257
  n.add(e), i.bytes += 2;
1217
1258
  try {
1218
1259
  if (e instanceof Error) return {
1219
- name: B(e.name, i),
1220
- message: B(R(e.message, t.maxAttributeChars), i),
1221
- stack: e.stack ? B(R(e.stack, t.maxStackChars), i) : void 0,
1222
- cause: e.cause ? V(e.cause, t, n, r + 1, i) : void 0
1260
+ name: V(e.name, i),
1261
+ message: V(z(e.message, t.maxAttributeChars), i),
1262
+ stack: e.stack ? V(z(e.stack, t.maxStackChars), i) : void 0,
1263
+ cause: e.cause ? H(e.cause, t, n, r + 1, i) : void 0
1223
1264
  };
1224
- if (e instanceof Date) return B(e.toISOString(), i);
1225
- if (e instanceof RegExp) return B(e.toString(), i);
1265
+ if (e instanceof Date) return V(e.toISOString(), i);
1266
+ if (e instanceof RegExp) return V(e.toString(), i);
1226
1267
  if (e instanceof Map) {
1227
1268
  let a = e, o = {}, s = 0;
1228
1269
  for (let [e, c] of a) {
1229
1270
  if (s >= t.maxArrayLength) {
1230
- o["…"] = B(`[${String(a.size - t.maxArrayLength)} more entries]`, i);
1271
+ o["…"] = V(`[${String(a.size - t.maxArrayLength)} more entries]`, i);
1231
1272
  break;
1232
1273
  }
1233
1274
  s++;
1234
1275
  let l = String(e);
1235
- i.bytes += H(l) + 4, o[l] = V(c, t, n, r + 1, i);
1276
+ i.bytes += U(l) + 4, o[l] = H(c, t, n, r + 1, i);
1236
1277
  }
1237
1278
  return o;
1238
1279
  }
1239
- if (e instanceof Set) return V([...e].slice(0, t.maxArrayLength), t, n, r, i);
1280
+ if (e instanceof Set) return H([...e].slice(0, t.maxArrayLength), t, n, r, i);
1240
1281
  if (ArrayBuffer.isView(e)) {
1241
1282
  let t = e.length ?? 0;
1242
- return B(`[${e.constructor.name}(${String(t)})]`, i);
1283
+ return V(`[${e.constructor.name}(${String(t)})]`, i);
1243
1284
  }
1244
- if (e instanceof Promise) return B("[Promise]", i);
1245
- if (typeof Node < "u" && e instanceof Node) return B(_n(e), i);
1285
+ if (e instanceof Promise) return V("[Promise]", i);
1286
+ if (typeof Node < "u" && e instanceof Node) return V(vn(e), i);
1246
1287
  if (Array.isArray(e)) {
1247
- let a = e, o = a.slice(0, t.maxArrayLength).map((e) => V(e, t, n, r + 1, i));
1248
- return a.length > t.maxArrayLength && o.push(B(`[${String(a.length - t.maxArrayLength)} more items]`, i)), o;
1288
+ let a = e, o = a.slice(0, t.maxArrayLength).map((e) => H(e, t, n, r + 1, i));
1289
+ return a.length > t.maxArrayLength && o.push(V(`[${String(a.length - t.maxArrayLength)} more items]`, i)), o;
1249
1290
  }
1250
1291
  let a = e.toJSON;
1251
- if (typeof a == "function") return V(a.call(e), t, n, r + 1, i);
1292
+ if (typeof a == "function") return H(a.call(e), t, n, r + 1, i);
1252
1293
  let o = e, s = Object.keys(o), c = {}, l = 0;
1253
1294
  for (let e of s) {
1254
1295
  if (l >= t.maxAttributeCount) {
1255
- c["…"] = B(`[${String(s.length - l)} more keys]`, i);
1296
+ c["…"] = V(`[${String(s.length - l)} more keys]`, i);
1256
1297
  break;
1257
1298
  }
1258
- l++, i.bytes += H(e) + 4, c[e] = V(o[e], t, n, r + 1, i);
1299
+ l++, i.bytes += U(e) + 4, c[e] = H(o[e], t, n, r + 1, i);
1259
1300
  }
1260
1301
  return c;
1261
1302
  } catch (e) {
1262
- return B(`[Unserializable: ${e instanceof Error ? e.name : "error"}]`, i);
1303
+ return V(`[Unserializable: ${e instanceof Error ? e.name : "error"}]`, i);
1263
1304
  } finally {
1264
1305
  n.delete(e);
1265
1306
  }
1266
1307
  }
1267
- function H(e) {
1308
+ function U(e) {
1268
1309
  let t = 0;
1269
1310
  for (let n = 0; n < e.length; n++) {
1270
1311
  let r = e.charCodeAt(n);
@@ -1274,7 +1315,7 @@ function H(e) {
1274
1315
  }
1275
1316
  //#endregion
1276
1317
  //#region src/transport/exit-flush.ts
1277
- var vn = class {
1318
+ var yn = class {
1278
1319
  deps;
1279
1320
  installed = !1;
1280
1321
  onVisibility = () => {
@@ -1315,11 +1356,11 @@ var vn = class {
1315
1356
  if (!r || r.records.length === 0) return;
1316
1357
  let i = t.guard("transport.serialize_failed", `the ${e} exit flush could not serialize its batch`, () => this.deps.config.serializer.serialize(r.records));
1317
1358
  if (!i) return;
1318
- if (H(i.body) > 6e4) {
1319
- sn(r, t);
1359
+ if (U(i.body) > 6e4) {
1360
+ cn(r, t);
1320
1361
  return;
1321
1362
  }
1322
- n.searchParams.set(ze, r.id), n.searchParams.set(Ee, e);
1363
+ n.searchParams.set(we, r.id), n.searchParams.set(gt, e);
1323
1364
  let a = n.toString();
1324
1365
  this.beacon(a, i.body) || this.keepaliveFetch(a, i.body, e);
1325
1366
  }
@@ -1327,19 +1368,19 @@ var vn = class {
1327
1368
  let { endpoint: e } = this.deps.config;
1328
1369
  return e ? this.deps.diagnostics.guard("config.invalid", `the exit flush cannot use endpoint ${e}`, () => new URL(e)) ?? null : null;
1329
1370
  }
1330
- beacon(e, t) {
1371
+ beacon(e, n) {
1331
1372
  return this.deps.diagnostics.guard("transport.http_error", "sendBeacon", () => {
1332
1373
  let r = globalThis.navigator;
1333
- return r?.sendBeacon ? r.sendBeacon(e, new Blob([t], { type: n })) : !1;
1374
+ return r?.sendBeacon ? r.sendBeacon(e, new Blob([n], { type: t })) : !1;
1334
1375
  }) === !0;
1335
1376
  }
1336
- keepaliveFetch(e, t, r) {
1377
+ keepaliveFetch(e, n, r) {
1337
1378
  let { config: i, diagnostics: a } = this.deps;
1338
1379
  a.guard("transport.http_error", "the keepalive fetch fallback", () => {
1339
1380
  fetch(e, {
1340
1381
  method: "POST",
1341
- body: t,
1342
- headers: { [at]: n },
1382
+ body: n,
1383
+ headers: { [ee]: t },
1343
1384
  credentials: i.credentials,
1344
1385
  keepalive: !0
1345
1386
  }).catch((e) => {
@@ -1350,15 +1391,15 @@ var vn = class {
1350
1391
  };
1351
1392
  //#endregion
1352
1393
  //#region src/transport/compression.ts
1353
- async function yn(e) {
1394
+ async function bn(e) {
1354
1395
  let t = globalThis.CompressionStream;
1355
1396
  if (t === void 0) return null;
1356
- let n = new Blob([e]).stream().pipeThrough(new t(pe)), r = await new Response(n).arrayBuffer();
1397
+ let n = new Blob([e]).stream().pipeThrough(new t(bt)), r = await new Response(n).arrayBuffer();
1357
1398
  return new Uint8Array(r);
1358
1399
  }
1359
1400
  //#endregion
1360
1401
  //#region src/transport/errors.ts
1361
- var U = class extends Error {
1402
+ var W = class extends Error {
1362
1403
  kind;
1363
1404
  status;
1364
1405
  retryAfterMs;
@@ -1367,16 +1408,16 @@ var U = class extends Error {
1367
1408
  super(t), this.kind = e, this.status = n, this.retryAfterMs = r, this.maxBytes = i, this.name = "TransportError";
1368
1409
  }
1369
1410
  };
1370
- function bn(e) {
1411
+ function xn(e) {
1371
1412
  if (!e) return;
1372
1413
  let t = Number(e);
1373
- if (Number.isFinite(t)) return Math.max(0, t * Ye);
1414
+ if (Number.isFinite(t)) return Math.max(0, t * mt);
1374
1415
  let n = Date.parse(e);
1375
1416
  return Number.isNaN(n) ? void 0 : Math.max(0, n - Date.now());
1376
1417
  }
1377
1418
  //#endregion
1378
1419
  //#region src/transport/http-transport.ts
1379
- var xn = class {
1420
+ var Sn = class {
1380
1421
  config;
1381
1422
  diagnostics;
1382
1423
  throttledUntil = 0;
@@ -1398,9 +1439,9 @@ var xn = class {
1398
1439
  return;
1399
1440
  }
1400
1441
  let r = new Headers(await this.resolveHeaders());
1401
- r.set(at, n.contentType), r.set(p, e.id), r.set(be, String(e.attempts));
1442
+ r.set(ee, n.contentType), r.set(te, e.id), r.set(f, String(e.attempts));
1402
1443
  let i = await this.encodeBody(n.body);
1403
- typeof i != "string" && r.set(ne, pe);
1444
+ typeof i != "string" && r.set(nt, bt);
1404
1445
  let a = await this.dispatch(r, i);
1405
1446
  if (a.ok) {
1406
1447
  this.throttledUntil = 0;
@@ -1410,13 +1451,13 @@ var xn = class {
1410
1451
  }
1411
1452
  async encodeBody(e) {
1412
1453
  let { config: t } = this;
1413
- return t.compression !== "gzip" || H(e) < 1024 ? e : await this.diagnostics.guardAsync("transport.http_error", "gzipping the payload", () => yn(e)) ?? e;
1454
+ return t.compression !== "gzip" || U(e) < 1024 ? e : await this.diagnostics.guardAsync("transport.http_error", "gzipping the payload", () => bn(e)) ?? e;
1414
1455
  }
1415
1456
  async dispatch(e, t) {
1416
1457
  let { config: n } = this, r = new AbortController(), i = setTimeout(() => {
1417
1458
  r.abort();
1418
- }, Ae);
1419
- T(i);
1459
+ }, yt);
1460
+ E(i);
1420
1461
  try {
1421
1462
  return await fetch(n.endpoint, {
1422
1463
  method: "POST",
@@ -1427,28 +1468,28 @@ var xn = class {
1427
1468
  cache: "no-store"
1428
1469
  });
1429
1470
  } catch {
1430
- if (r.signal.aborted) throw new U("timeout", `request exceeded ${String(Ae)}ms`);
1471
+ if (r.signal.aborted) throw new W("timeout", `request exceeded ${String(yt)}ms`);
1431
1472
  let e = globalThis.navigator?.onLine;
1432
- throw new U(e === !1 ? "offline" : "transient", "network error");
1473
+ throw new W(e === !1 ? "offline" : "transient", "network error");
1433
1474
  } finally {
1434
1475
  clearTimeout(i);
1435
1476
  }
1436
1477
  }
1437
1478
  async classify(e, t) {
1438
- let n = e.status, r = bn(e.headers.get(ee));
1479
+ let n = e.status, r = xn(e.headers.get(be));
1439
1480
  if (n === 401 || n === 403) return this.diagnostics.report("transport.rejected_credentials", `server returned ${String(n)}. In a cross-origin iframe the session cookie is a third-party cookie and is very likely blocked. Forward to the platform document instead of promoting to sender, or issue the cookie with the Partitioned attribute.`, {
1440
1481
  status: n,
1441
1482
  endpoint: this.config.endpoint
1442
- }), new U("permanent", `rejected with ${String(n)}`, n);
1443
- if (n === 413) return new U("too_large", "payload too large", n, void 0, await this.readMaxBytes(e));
1483
+ }), new W("permanent", `rejected with ${String(n)}`, n);
1484
+ if (n === 413) return new W("too_large", "payload too large", n, void 0, await this.readMaxBytes(e));
1444
1485
  if (n === 429 || n === 503) {
1445
1486
  let e = n === 429;
1446
- return this.throttledUntil = Date.now() + (r ?? 2e3), e && this.diagnostics.report("transport.throttled", "server throttled us", { retryAfterMs: r }), new U("throttled", e ? "throttled" : "service unavailable", n, r);
1487
+ return this.throttledUntil = Date.now() + (r ?? 2e3), e && this.diagnostics.report("transport.throttled", "server throttled us", { retryAfterMs: r }), new W("throttled", e ? "throttled" : "service unavailable", n, r);
1447
1488
  }
1448
- return n === 408 || n >= 500 ? new U("transient", `server error ${String(n)}`, n) : (this.diagnostics.report("transport.dropped_permanent", `server rejected the batch with ${String(n)}, dropping it`, {
1489
+ return n === 408 || n >= 500 ? new W("transient", `server error ${String(n)}`, n) : (this.diagnostics.report("transport.dropped_permanent", `server rejected the batch with ${String(n)}, dropping it`, {
1449
1490
  batchId: t,
1450
1491
  status: n
1451
- }), new U("permanent", `rejected with ${String(n)}`, n));
1492
+ }), new W("permanent", `rejected with ${String(n)}`, n));
1452
1493
  }
1453
1494
  async readMaxBytes(e) {
1454
1495
  return this.diagnostics.guardAsync("transport.http_error", "reading the 413 body", async () => {
@@ -1460,7 +1501,7 @@ var xn = class {
1460
1501
  let { headers: e } = this.config;
1461
1502
  return e ? typeof e == "function" ? await this.diagnostics.guardAsync("transport.http_error", "headers() threw", () => Promise.resolve(e())) ?? {} : e : {};
1462
1503
  }
1463
- }, Sn = class {
1504
+ }, Cn = class {
1464
1505
  storage;
1465
1506
  transport;
1466
1507
  diagnostics;
@@ -1477,10 +1518,10 @@ var xn = class {
1477
1518
  this.storage = e, this.transport = t, this.diagnostics = n, this.config = r, this.batchesPerDrain = i;
1478
1519
  }
1479
1520
  start() {
1480
- this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(f);
1521
+ this.stopped = !1, typeof addEventListener < "u" && addEventListener("online", this.onOnline), this.schedule(_);
1481
1522
  }
1482
1523
  nudge() {
1483
- this.draining || this.schedule(de);
1524
+ this.draining || this.schedule(d);
1484
1525
  }
1485
1526
  stop() {
1486
1527
  this.stopped = !0, typeof removeEventListener < "u" && removeEventListener("online", this.onOnline), this.clearTimer();
@@ -1491,20 +1532,20 @@ var xn = class {
1491
1532
  let t = setTimeout(() => {
1492
1533
  this.drain();
1493
1534
  }, e);
1494
- this.timer = t, T(t);
1535
+ this.timer = t, E(t);
1495
1536
  }
1496
1537
  clearTimer() {
1497
1538
  this.timer !== null && (clearTimeout(this.timer), this.timer = null);
1498
1539
  }
1499
1540
  backoffMs() {
1500
- let e = Math.min(de * 2 ** this.attempt, g);
1541
+ let e = Math.min(d * 2 ** this.attempt, re);
1501
1542
  return Math.random() * e;
1502
1543
  }
1503
1544
  async drain() {
1504
1545
  if (!this.draining) {
1505
1546
  this.draining = !0;
1506
1547
  try {
1507
- await nn("ui-observability.drain", this.diagnostics, () => this.drainLocked()) !== !0 && this.schedule(f);
1548
+ await rn("ui-observability.drain", this.diagnostics, () => this.drainLocked()) !== !0 && this.schedule(_);
1508
1549
  } finally {
1509
1550
  this.draining = !1;
1510
1551
  }
@@ -1512,29 +1553,29 @@ var xn = class {
1512
1553
  }
1513
1554
  async drainLocked() {
1514
1555
  try {
1515
- if (globalThis.navigator?.onLine === !1) return this.schedule(f), !0;
1556
+ if (globalThis.navigator?.onLine === !1) return this.schedule(_), !0;
1516
1557
  let e = await this.storage.take(this.batchesPerDrain);
1517
- if (e.length === 0) return this.schedule(f), !0;
1558
+ if (e.length === 0) return this.schedule(_), !0;
1518
1559
  for (let t of e) if (this.stopped || !await this.deliver(t)) return !0;
1519
- return this.schedule(e.length === this.batchesPerDrain ? 0 : f), !0;
1560
+ return this.schedule(e.length === this.batchesPerDrain ? 0 : _), !0;
1520
1561
  } catch (e) {
1521
1562
  return this.diagnostics.report("storage.degraded", "the drain loop threw", void 0, e), this.attempt++, this.schedule(this.backoffMs()), !0;
1522
1563
  }
1523
1564
  }
1524
1565
  async deliver(e) {
1525
- if (e.attempts >= m.maxAttempts) return this.diagnostics.report("storage.dead_lettered", `giving up on a batch after ${e.attempts.toString()} attempts`, {
1566
+ if (e.attempts >= ne.maxAttempts) return this.diagnostics.report("storage.dead_lettered", `giving up on a batch after ${e.attempts.toString()} attempts`, {
1526
1567
  batchId: e.id,
1527
1568
  records: e.records.length
1528
1569
  }), await this.storage.remove(e.id), !0;
1529
1570
  try {
1530
1571
  return await this.transport.send(e), await this.storage.remove(e.id), this.attempt = 0, !0;
1531
1572
  } catch (t) {
1532
- let n = t instanceof U ? t : void 0;
1533
- return n?.kind === "permanent" ? (await this.storage.remove(e.id), !0) : n?.kind === "too_large" ? (await this.splitStored(e, n.maxBytes), !0) : n?.kind === "offline" ? (this.schedule(f), !1) : (await this.storage.bumpAttempts(e.id, e.attempts + 1), this.attempt++, this.schedule(n?.retryAfterMs ?? this.backoffMs()), !1);
1573
+ let n = t instanceof W ? t : void 0;
1574
+ return n?.kind === "permanent" ? (await this.storage.remove(e.id), !0) : n?.kind === "too_large" ? (await this.splitStored(e, n.maxBytes), !0) : n?.kind === "offline" ? (this.schedule(_), !1) : (await this.storage.bumpAttempts(e.id, e.attempts + 1), this.attempt++, this.schedule(n?.retryAfterMs ?? this.backoffMs()), !1);
1534
1575
  }
1535
1576
  }
1536
1577
  async splitStored(e, t) {
1537
- let n = tn(e);
1578
+ let n = nn(e);
1538
1579
  if (await this.storage.remove(e.id), !n) {
1539
1580
  this.diagnostics.report("transport.dropped_permanent", "a single record exceeds the server limit and was dropped", {
1540
1581
  batchId: e.id,
@@ -1549,31 +1590,34 @@ var xn = class {
1549
1590
  });
1550
1591
  for (let e of n) await this.storage.save(e);
1551
1592
  }
1552
- }, Cn = {
1593
+ }, wn = {
1553
1594
  TRACE: "debug",
1554
1595
  DEBUG: "debug",
1555
1596
  INFO: "info",
1556
1597
  WARN: "warn",
1557
1598
  ERROR: "error",
1558
1599
  FATAL: "error"
1559
- }, wn = class {
1600
+ }, Tn = class {
1560
1601
  minLevel;
1561
- constructor(e) {
1562
- this.minLevel = e;
1602
+ diagnostics;
1603
+ constructor(e, t) {
1604
+ this.minLevel = e, this.diagnostics = t;
1563
1605
  }
1564
1606
  update(e) {
1565
1607
  this.minLevel = e;
1566
1608
  }
1567
1609
  write(e, t, n) {
1568
- if (this.minLevel === null || S[e] < S[this.minLevel] || typeof console > "u") return;
1569
- let r = `%c${We}%c ${e}`;
1570
- if (n === void 0) {
1571
- console[Cn[e]](r, s, "", t);
1572
- return;
1573
- }
1574
- console[Cn[e]](r, s, "", t, n);
1610
+ if (this.minLevel === null || x[e] < x[this.minLevel] || typeof console > "u") return;
1611
+ let r = `%c${Ee}%c ${e}`, i = wn[e];
1612
+ this.diagnostics.guard("handler.threw", `mirroring to console.${i}`, () => {
1613
+ if (n === void 0) {
1614
+ console[i](r, o, "", t);
1615
+ return;
1616
+ }
1617
+ console[i](r, o, "", t, n);
1618
+ });
1575
1619
  }
1576
- }, Tn = class {
1620
+ }, En = class {
1577
1621
  value = 0;
1578
1622
  next() {
1579
1623
  return ++this.value;
@@ -1581,44 +1625,44 @@ var xn = class {
1581
1625
  reset() {
1582
1626
  this.value = 0;
1583
1627
  }
1584
- }, En = /^[0-9a-f]{32}$/, Dn = /^[0-9a-f]{16}$/, On = /[1-9a-f]/;
1585
- function kn() {
1628
+ }, Dn = /^[0-9a-f]{32}$/, On = /^[0-9a-f]{16}$/, kn = /[1-9a-f]/;
1629
+ function An() {
1586
1630
  return import(
1587
1631
  /* @vite-ignore */
1588
1632
  "@opentelemetry/api"
1589
1633
  );
1590
1634
  }
1591
- function An(e) {
1592
- return En.test(e.traceId) && On.test(e.traceId) && Dn.test(e.spanId) && On.test(e.spanId);
1593
- }
1594
- function jn() {
1595
- return N(16);
1635
+ function jn(e) {
1636
+ return Dn.test(e.traceId) && kn.test(e.traceId) && On.test(e.spanId) && kn.test(e.spanId);
1596
1637
  }
1597
1638
  function Mn() {
1598
- return N(8);
1639
+ return P(16);
1599
1640
  }
1600
1641
  function Nn() {
1642
+ return P(8);
1643
+ }
1644
+ function Pn() {
1601
1645
  return {
1602
- traceId: jn(),
1603
- spanId: Mn(),
1646
+ traceId: Mn(),
1647
+ spanId: Nn(),
1604
1648
  traceFlags: 1,
1605
1649
  startedAt: Date.now()
1606
1650
  };
1607
1651
  }
1608
- function Pn(e) {
1652
+ function Fn(e) {
1609
1653
  return {
1610
1654
  traceId: e.traceId,
1611
1655
  spanId: e.spanId,
1612
1656
  traceFlags: e.traceFlags
1613
1657
  };
1614
1658
  }
1615
- var Fn = class {
1659
+ var In = class {
1616
1660
  diagnostics;
1617
1661
  maxAgeMs;
1618
1662
  load;
1619
- ambient = Nn();
1663
+ ambient = Pn();
1620
1664
  otel;
1621
- constructor(e, t = st, n = kn) {
1665
+ constructor(e, t = He, n = An) {
1622
1666
  this.diagnostics = e, this.maxAgeMs = t, this.load = n;
1623
1667
  }
1624
1668
  async loadOtel() {
@@ -1630,7 +1674,7 @@ var Fn = class {
1630
1674
  }
1631
1675
  resolve() {
1632
1676
  let e = this.activeSpanContext();
1633
- return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Pn(this.ambient)) : e;
1677
+ return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Fn(this.ambient)) : e;
1634
1678
  }
1635
1679
  activeSpanContext() {
1636
1680
  let e = this.otel;
@@ -1638,7 +1682,7 @@ var Fn = class {
1638
1682
  let t = e.trace.getActiveSpan();
1639
1683
  if (t === void 0) return;
1640
1684
  let n = t.spanContext();
1641
- if (An(n)) return {
1685
+ if (jn(n)) return {
1642
1686
  traceId: n.traceId,
1643
1687
  spanId: n.spanId,
1644
1688
  traceFlags: n.traceFlags
@@ -1646,7 +1690,7 @@ var Fn = class {
1646
1690
  });
1647
1691
  }
1648
1692
  rotate(e) {
1649
- return this.ambient = Nn(), Pn(this.ambient);
1693
+ return this.ambient = Pn(), Fn(this.ambient);
1650
1694
  }
1651
1695
  headers() {
1652
1696
  let e = {}, t = this.otel;
@@ -1654,11 +1698,11 @@ var Fn = class {
1654
1698
  t.propagation.inject(t.context.active(), e);
1655
1699
  }), !e.traceparent) {
1656
1700
  let t = this.resolve(), n = (t.traceFlags & 255).toString(16).padStart(2, "0");
1657
- e[Qe] = `00-${t.traceId}-${t.spanId}-${n}`;
1701
+ e[at] = `00-${t.traceId}-${t.spanId}-${n}`;
1658
1702
  }
1659
1703
  return e;
1660
1704
  }
1661
- }, In = class {
1705
+ }, Ln = class {
1662
1706
  buffer;
1663
1707
  pointer = 0;
1664
1708
  filled = !1;
@@ -1678,47 +1722,79 @@ var Fn = class {
1678
1722
  };
1679
1723
  //#endregion
1680
1724
  //#region src/transport/serializers/ecs.ts
1681
- function Ln(e) {
1682
- return Pe.test(e) ? Number(BigInt(e) / Le) : Date.now();
1725
+ function Rn(e) {
1726
+ return Ie.test(e) ? Number(BigInt(e) / tt) : Date.now();
1727
+ }
1728
+ function zn(e) {
1729
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : typeof e == "bigint" ? e.toString() : null;
1730
+ }
1731
+ function Bn(e, t, n) {
1732
+ let r = e[t];
1733
+ if (r === void 0) {
1734
+ e[t] = n;
1735
+ return;
1736
+ }
1737
+ if (Array.isArray(r)) {
1738
+ r.push(n);
1739
+ return;
1740
+ }
1741
+ e[t] = [r, n];
1742
+ }
1743
+ function G(e, t, n, r) {
1744
+ let i = zn(n);
1745
+ if (i !== null) {
1746
+ Bn(e, t, i);
1747
+ return;
1748
+ }
1749
+ if (!(typeof n != "object" || !n || r.has(n))) {
1750
+ if (r.add(n), Array.isArray(n)) for (let i of n) G(e, t, i, r);
1751
+ else for (let [i, a] of Object.entries(n)) G(e, `${t}.${i}`, a, r);
1752
+ r.delete(n);
1753
+ }
1683
1754
  }
1684
- var Rn = {
1755
+ function Vn(e) {
1756
+ let t = Object.create(null), n = /* @__PURE__ */ new WeakSet();
1757
+ for (let [r, i] of Object.entries(e)) G(t, r, i, n);
1758
+ return t;
1759
+ }
1760
+ var Hn = {
1685
1761
  name: "ecs",
1686
1762
  serialize(e) {
1687
1763
  return {
1688
1764
  body: `${e.map((e) => {
1689
- let t = Ln(e.timeUnixNano);
1765
+ let t = Rn(e.timeUnixNano);
1690
1766
  return JSON.stringify({
1691
1767
  "@timestamp": new Date(t).toISOString(),
1692
1768
  message: e.body,
1693
- log: { level: e.severityText.toLowerCase() },
1769
+ log: { level: g[e.severityText] ?? e.severityText.toLowerCase() },
1694
1770
  trace: { id: e.traceId },
1695
1771
  span: { id: e.spanId },
1696
1772
  service: {
1697
- name: e.resource[c],
1698
- version: e.resource[ue],
1699
- environment: e.resource[o]
1773
+ name: e.resource[le],
1774
+ version: e.resource[Ke],
1775
+ environment: e.resource[_t]
1700
1776
  },
1701
- user_agent: { original: e.resource[_t] },
1777
+ user_agent: { original: e.resource[me] },
1702
1778
  url: { full: e.attributes["url.full"] ?? e.attributes["page.url"] },
1703
1779
  labels: {
1704
- ...e.resource,
1705
- ...e.attributes
1780
+ ...Vn(e.resource),
1781
+ ...Vn(e.attributes)
1706
1782
  }
1707
1783
  });
1708
1784
  }).join("\n")}\n`,
1709
- contentType: qe
1785
+ contentType: Ge
1710
1786
  };
1711
1787
  }
1712
1788
  };
1713
1789
  //#endregion
1714
1790
  //#region src/transport/serializers/otlp.ts
1715
- function zn(e) {
1716
- return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(zn).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: W(e) } } : null;
1791
+ function Un(e) {
1792
+ return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(Un).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: K(e) } } : null;
1717
1793
  }
1718
- function W(e) {
1794
+ function K(e) {
1719
1795
  let t = [];
1720
1796
  for (let [n, r] of Object.entries(e)) {
1721
- let e = zn(r);
1797
+ let e = Un(r);
1722
1798
  e && t.push({
1723
1799
  key: n,
1724
1800
  value: e
@@ -1726,19 +1802,19 @@ function W(e) {
1726
1802
  }
1727
1803
  return t;
1728
1804
  }
1729
- var Bn = /* @__PURE__ */ new WeakMap();
1730
- function Vn(e) {
1731
- let t = Bn.get(e);
1805
+ var Wn = /* @__PURE__ */ new WeakMap();
1806
+ function Gn(e) {
1807
+ let t = Wn.get(e);
1732
1808
  if (t !== void 0) return t;
1733
1809
  let n = JSON.stringify(e);
1734
- return Bn.set(e, n), n;
1810
+ return Wn.set(e, n), n;
1735
1811
  }
1736
- var G = {
1737
- name: yt,
1812
+ var q = {
1813
+ name: r,
1738
1814
  serialize(e) {
1739
1815
  let t = /* @__PURE__ */ new Map();
1740
1816
  for (let n of e) {
1741
- let e = Vn(n.resource), r = t.get(e);
1817
+ let e = Gn(n.resource), r = t.get(e);
1742
1818
  if (r) {
1743
1819
  r.records.push(n);
1744
1820
  continue;
@@ -1749,11 +1825,11 @@ var G = {
1749
1825
  });
1750
1826
  }
1751
1827
  let n = [...t.values()].map((e) => ({
1752
- resource: { attributes: W(e.resource) },
1828
+ resource: { attributes: K(e.resource) },
1753
1829
  scopeLogs: [{
1754
1830
  scope: {
1755
- name: Fe,
1756
- version: dt
1831
+ name: dt,
1832
+ version: Xe
1757
1833
  },
1758
1834
  logRecords: e.records.map((e) => ({
1759
1835
  timeUnixNano: e.timeUnixNano,
@@ -1764,33 +1840,33 @@ var G = {
1764
1840
  traceId: e.traceId,
1765
1841
  spanId: e.spanId,
1766
1842
  flags: e.traceFlags,
1767
- attributes: W(e.attributes)
1843
+ attributes: K(e.attributes)
1768
1844
  }))
1769
1845
  }]
1770
1846
  }));
1771
1847
  return {
1772
1848
  body: JSON.stringify({ resourceLogs: n }),
1773
- contentType: le
1849
+ contentType: ce
1774
1850
  };
1775
1851
  }
1776
1852
  };
1777
1853
  //#endregion
1778
1854
  //#region src/core/config.ts
1779
- function Hn(e) {
1855
+ function Kn(e) {
1780
1856
  return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
1781
1857
  }
1782
- function Un(e, t, n) {
1783
- return e === void 0 ? t ?? G : e === "otlp" ? G : e === "ecs" ? Rn : Hn(e) ? e : (n.report("config.invalid", `serializer must be "${yt}", "ecs" or an implementation`), G);
1858
+ function qn(e, t, n) {
1859
+ return e === void 0 ? t ?? q : e === "otlp" ? q : e === "ecs" ? Hn : Kn(e) ? e : (n.report("config.invalid", `serializer must be "${r}", "ecs" or an implementation`), q);
1784
1860
  }
1785
- function Wn(e, t) {
1786
- return e === void 0 ? t : e === !1 ? null : e === !0 ? l : e;
1861
+ function Jn(e, t) {
1862
+ return e === void 0 ? t : e === !1 ? null : e === !0 ? c : e;
1787
1863
  }
1788
- function Gn(e, t, n) {
1789
- let r = n ?? Ge, i = {
1864
+ function Yn(e, t, n) {
1865
+ let r = n ?? Ue, i = {
1790
1866
  ...r,
1791
1867
  ...e,
1792
- serializer: Un(e.serializer, n?.serializer, t),
1793
- console: Wn(e.console, r.console),
1868
+ serializer: qn(e.serializer, n?.serializer, t),
1869
+ console: Jn(e.console, r.console),
1794
1870
  sampling: {
1795
1871
  ...r.sampling,
1796
1872
  ...e.sampling,
@@ -1814,23 +1890,30 @@ function Gn(e, t, n) {
1814
1890
  } catch (e) {
1815
1891
  t.report("config.invalid", `endpoint is not a valid absolute URL: ${i.endpoint}`, void 0, e);
1816
1892
  }
1817
- i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record will report service.name as '${tt}'.`), tt);
1893
+ i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record will report service.name as '${Ae}'.`), Ae);
1818
1894
  let a = i.sampling.defaultRate;
1819
1895
  (typeof a != "number" || a < 0 || a > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1, got ${String(a)}`), i.sampling.defaultRate = 1);
1820
1896
  let o = Object.entries(i.sampling.rates);
1821
1897
  for (let [e, n] of o) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1, got ${String(n)}`), i.sampling.rates[e] = 1);
1822
- i.capture.ignoreUrls = i.capture.ignoreUrls.filter((e) => e !== n?.endpoint), i.endpoint && !i.capture.ignoreUrls.includes(i.endpoint) && (i.capture.ignoreUrls = [...i.capture.ignoreUrls, i.endpoint]);
1823
- let s = /* @__PURE__ */ new Set([...Object.keys(Ge), ...De]);
1824
- for (let n of Object.keys(e)) s.has(n) || t.report("config.invalid", `unknown config key "${n}", ignored. Typo?`);
1825
- return i;
1898
+ return i.capture.ignoreUrls = i.capture.ignoreUrls.filter((e) => e !== n?.endpoint), i.endpoint && !i.capture.ignoreUrls.includes(i.endpoint) && (i.capture.ignoreUrls = [...i.capture.ignoreUrls, i.endpoint]), Xn(e, t), i;
1899
+ }
1900
+ function Xn(e, t) {
1901
+ let n = /* @__PURE__ */ new Set([...Object.keys(Ue), ...Qe]);
1902
+ for (let r of Object.keys(e)) n.has(r) || t.report("config.invalid", `unknown config key "${r}", ignored. Typo?`);
1903
+ for (let n of y) {
1904
+ let r = e[n];
1905
+ if (typeof r != "object" || !r) continue;
1906
+ let i = /* @__PURE__ */ new Set([...Object.keys(Ue[n]), ...ct[n]]);
1907
+ for (let e of Object.keys(r)) i.has(e) || t.report("config.invalid", `unknown config key "${n}.${e}", ignored. Typo?`);
1908
+ }
1826
1909
  }
1827
- function Kn(e, t) {
1828
- for (let n of Object.keys(t)) ge.includes(n) || Object.assign(e, { [n]: t[n] });
1829
- for (let n of ge) Object.assign(e[n], t[n]);
1910
+ function Zn(e, t) {
1911
+ for (let n of Object.keys(t)) y.includes(n) || Object.assign(e, { [n]: t[n] });
1912
+ for (let n of y) Object.assign(e[n], t[n]);
1830
1913
  }
1831
1914
  //#endregion
1832
1915
  //#region src/core/context.ts
1833
- var qn = class {
1916
+ var Qn = class {
1834
1917
  map = /* @__PURE__ */ new Map();
1835
1918
  set(e, t) {
1836
1919
  this.map.set(e, t);
@@ -1850,12 +1933,12 @@ var qn = class {
1850
1933
  getAll() {
1851
1934
  return Object.fromEntries(this.map);
1852
1935
  }
1853
- }, Jn = class {
1936
+ }, $n = class {
1854
1937
  handler;
1855
1938
  throttleMs;
1856
1939
  counters = /* @__PURE__ */ new Map();
1857
1940
  lastEmitted = /* @__PURE__ */ new Map();
1858
- constructor(e, t = se) {
1941
+ constructor(e, t = oe) {
1859
1942
  this.handler = e, this.throttleMs = t;
1860
1943
  }
1861
1944
  setHandler(e) {
@@ -1880,7 +1963,7 @@ var qn = class {
1880
1963
  if (this.handler) try {
1881
1964
  this.handler(o);
1882
1965
  } catch (e) {
1883
- this.count("handler.threw"), typeof console < "u" && console.warn(`${We} onDiagnostic handler threw`, e);
1966
+ this.count("handler.threw"), typeof console < "u" && console.warn(`${Ee} onDiagnostic handler threw`, e);
1884
1967
  }
1885
1968
  }
1886
1969
  guard(e, t, n) {
@@ -1905,59 +1988,59 @@ var qn = class {
1905
1988
  reset() {
1906
1989
  this.counters.clear(), this.lastEmitted.clear();
1907
1990
  }
1908
- }, Yn = {
1909
- maxAgeMs: Ie,
1991
+ }, er = {
1992
+ maxAgeMs: ft,
1910
1993
  endOnOwnerClose: !1,
1911
- urlParam: $e
1994
+ urlParam: ot
1912
1995
  };
1913
- function K(e, t) {
1996
+ function J(e, t) {
1914
1997
  let n = Reflect.get(e, t);
1915
1998
  return typeof n == "string" && n !== "" ? n : void 0;
1916
1999
  }
1917
- function Xn(e, t) {
2000
+ function tr(e, t) {
1918
2001
  let n = Reflect.get(e, t);
1919
2002
  return typeof n == "number" && Number.isFinite(n) ? n : void 0;
1920
2003
  }
1921
- function Zn(e) {
2004
+ function nr(e) {
1922
2005
  if (typeof e != "object" || !e) return null;
1923
- let t = K(e, "id"), n = K(e, "name"), r = Xn(e, "startedAt");
2006
+ let t = J(e, "id"), n = J(e, "name"), r = tr(e, "startedAt");
1924
2007
  return t === void 0 || n === void 0 || r === void 0 ? null : {
1925
2008
  id: t,
1926
2009
  name: n,
1927
2010
  startedAt: r,
1928
- parentId: K(e, "parentId"),
1929
- ownerContextId: K(e, "ownerContextId") ?? ""
2011
+ parentId: J(e, "parentId"),
2012
+ ownerContextId: J(e, "ownerContextId") ?? ""
1930
2013
  };
1931
2014
  }
1932
- function Qn(e) {
2015
+ function rr(e) {
1933
2016
  if (typeof e != "object" || !e) return null;
1934
- let t = K(e, "i"), n = K(e, "n");
2017
+ let t = J(e, "i"), n = J(e, "n");
1935
2018
  return t === void 0 || n === void 0 ? null : {
1936
2019
  id: t,
1937
2020
  name: n,
1938
- startedAt: Xn(e, "s") ?? Date.now(),
2021
+ startedAt: tr(e, "s") ?? Date.now(),
1939
2022
  parentId: void 0,
1940
2023
  ownerContextId: ""
1941
2024
  };
1942
2025
  }
1943
- function $n(e) {
2026
+ function ir(e) {
1944
2027
  let t = JSON.stringify({
1945
2028
  i: e.id,
1946
2029
  n: e.name.slice(0, 64),
1947
2030
  s: e.startedAt
1948
2031
  }), n = new TextEncoder().encode(t), r = "";
1949
2032
  for (let e of n) r += String.fromCharCode(e);
1950
- return btoa(r).replace(Re, "-").replace(Te, "_").replace(Be, "");
2033
+ return btoa(r).replace(Le, "-").replace(Ce, "_").replace(ze, "");
1951
2034
  }
1952
- function er(e, t) {
2035
+ function ar(e, t) {
1953
2036
  let n = new Promise((e, n) => {
1954
- T(setTimeout(() => {
2037
+ E(setTimeout(() => {
1955
2038
  n(/* @__PURE__ */ Error(`timed out after ${String(t)}ms`));
1956
2039
  }, t));
1957
2040
  });
1958
2041
  return Promise.race([e, n]);
1959
2042
  }
1960
- var tr = class {
2043
+ var or = class {
1961
2044
  options;
1962
2045
  diagnostics;
1963
2046
  contextId;
@@ -1973,14 +2056,14 @@ var tr = class {
1973
2056
  async bootstrap() {
1974
2057
  let e = this.readUrlToken();
1975
2058
  if (e && this.adopt(e, "url")) return;
1976
- let t = this.diagnostics.guard("storage.unavailable", "reading the persisted journey", () => sessionStorage.getItem(C));
2059
+ let t = this.diagnostics.guard("storage.unavailable", "reading the persisted journey", () => sessionStorage.getItem(w));
1977
2060
  if (t && this.restore(t)) return;
1978
2061
  let n = await this.readOpenFinToken();
1979
2062
  n !== null && this.adopt(n, "openfin.customData");
1980
2063
  }
1981
2064
  start(e, t = {}) {
1982
2065
  let n = {
1983
- id: t.id ?? P(),
2066
+ id: t.id ?? F(),
1984
2067
  name: e,
1985
2068
  startedAt: Date.now(),
1986
2069
  parentId: t.parent ? this.journey?.id : void 0,
@@ -1998,7 +2081,7 @@ var tr = class {
1998
2081
  getToken() {
1999
2082
  let e = this.journey;
2000
2083
  if (e === null) return;
2001
- let t = $n(e);
2084
+ let t = ir(e);
2002
2085
  if (t.length > 256) {
2003
2086
  this.diagnostics.report("journey.token_too_large", "journey token exceeded the size cap and was not issued", { length: t.length });
2004
2087
  return;
@@ -2022,7 +2105,7 @@ var tr = class {
2022
2105
  this.clearTimer();
2023
2106
  }
2024
2107
  restore(e) {
2025
- let t = Zn(this.diagnostics.guard("storage.degraded", "parsing the persisted journey", () => JSON.parse(e)));
2108
+ let t = nr(this.diagnostics.guard("storage.degraded", "parsing the persisted journey", () => JSON.parse(e)));
2026
2109
  return t === null ? !1 : Date.now() - t.startedAt > this.options.maxAgeMs ? (this.diagnostics.report("journey.expired", "discarded a persisted journey older than maxAgeMs", { name: t.name }), this.clearStored(), !1) : (this.setJourney(t), this.diagnostics.report("journey.adopted", `resumed journey "${t.name}"`, {
2027
2110
  source: "sessionStorage",
2028
2111
  journeyId: t.id
@@ -2030,22 +2113,22 @@ var tr = class {
2030
2113
  }
2031
2114
  decodeToken(e) {
2032
2115
  return this.diagnostics.guard("config.invalid", "decoding a seeded journey token", () => {
2033
- let t = e.replace(rt, "+").replace(Xe, "/"), n = (4 - t.length % 4) % 4, r = "=".repeat(n), i = Uint8Array.from(atob(t + r), (e) => e.charCodeAt(0));
2034
- return Qn(JSON.parse(new TextDecoder().decode(i)));
2116
+ let t = e.replace(et, "+").replace(Je, "/"), n = (4 - t.length % 4) % 4, r = "=".repeat(n), i = Uint8Array.from(atob(t + r), (e) => e.charCodeAt(0));
2117
+ return rr(JSON.parse(new TextDecoder().decode(i)));
2035
2118
  }) ?? null;
2036
2119
  }
2037
2120
  setJourney(e) {
2038
2121
  if (this.journey = e, this.clearTimer(), this.diagnostics.guard("storage.unavailable", "persisting the journey", () => {
2039
- e === null ? sessionStorage.removeItem(C) : sessionStorage.setItem(C, JSON.stringify(e));
2122
+ e === null ? sessionStorage.removeItem(w) : sessionStorage.setItem(w, JSON.stringify(e));
2040
2123
  }), e === null) return;
2041
2124
  let t = Math.max(this.options.maxAgeMs - (Date.now() - e.startedAt), 0), n = setTimeout(() => {
2042
2125
  this.diagnostics.report("journey.expired", `journey "${e.name}" hit maxAgeMs and was ended automatically`, { journeyId: e.id }), this.journey = null, this.expiryTimer = null, this.clearStored();
2043
2126
  }, t);
2044
- this.expiryTimer = n, T(n);
2127
+ this.expiryTimer = n, E(n);
2045
2128
  }
2046
2129
  clearStored() {
2047
2130
  this.diagnostics.guard("storage.unavailable", "clearing the persisted journey", () => {
2048
- sessionStorage.removeItem(C);
2131
+ sessionStorage.removeItem(w);
2049
2132
  });
2050
2133
  }
2051
2134
  clearTimer() {
@@ -2057,41 +2140,41 @@ var tr = class {
2057
2140
  async readOpenFinToken() {
2058
2141
  let e = globalThis.fin?.me, t = e?.getOptions;
2059
2142
  if (t === void 0) return null;
2060
- let n = (await this.diagnostics.guardAsync("openfin.unavailable", "reading fin.me.getOptions()", () => er(t.call(e), Ze)))?.customData?.[it];
2143
+ let n = (await this.diagnostics.guardAsync("openfin.unavailable", "reading fin.me.getOptions()", () => ar(t.call(e), Be)))?.customData?.[Ye];
2061
2144
  return typeof n == "string" ? n : null;
2062
2145
  }
2063
2146
  };
2064
2147
  //#endregion
2065
2148
  //#region src/core/sampling.ts
2066
- function nr(e) {
2067
- let t = ye;
2068
- for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, h);
2149
+ function sr(e) {
2150
+ let t = m;
2151
+ for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, ge);
2069
2152
  return t >>> 0;
2070
2153
  }
2071
- function q(e, t) {
2154
+ function cr(e, t) {
2072
2155
  let n = e.attributes[t];
2073
2156
  return typeof n == "string" ? n : "";
2074
2157
  }
2075
- function rr(e, t) {
2158
+ function lr(e, t) {
2076
2159
  let { rates: n, defaultRate: r } = t.sampling, i, a = -1;
2077
2160
  for (let [t, r] of Object.entries(n)) (e === t || e.startsWith(`${t}.`)) && t.length > a && (i = r, a = t.length);
2078
2161
  return i ?? r;
2079
2162
  }
2080
- function ir(e, t) {
2163
+ function ur(e, t) {
2081
2164
  if (e.level === "ERROR" || e.level === "FATAL" || t.sampling.alwaysSampleTypes.includes(e.type)) return !0;
2082
- let n = rr(e.namespace, t);
2083
- return n >= 1 ? !0 : n <= 0 ? !1 : nr(e.journeyId || e.traceId) / Ue < n;
2165
+ let n = lr(e.namespace, t);
2166
+ return n >= 1 ? !0 : n <= 0 ? !1 : sr(e.journeyId || e.traceId) / Te < n;
2084
2167
  }
2085
- function ar(e, t) {
2086
- return ir({
2168
+ function dr(e, t) {
2169
+ return ur({
2087
2170
  level: e.severityText,
2088
- type: q(e, b),
2089
- namespace: q(e, x),
2090
- journeyId: q(e, y),
2171
+ type: cr(e, S),
2172
+ namespace: cr(e, C),
2173
+ journeyId: cr(e, b),
2091
2174
  traceId: e.traceId
2092
2175
  }, t);
2093
2176
  }
2094
- var or = class {
2177
+ var fr = class {
2095
2178
  windowStart = 0;
2096
2179
  count = 0;
2097
2180
  allow(e) {
@@ -2102,19 +2185,19 @@ var or = class {
2102
2185
  };
2103
2186
  //#endregion
2104
2187
  //#region src/core/pipeline.ts
2105
- function sr(e) {
2106
- return e.attributes[b] === nt;
2188
+ function pr(e) {
2189
+ return e.attributes[S] === lt;
2107
2190
  }
2108
- var cr = {
2191
+ var mr = {
2109
2192
  logs: {
2110
- flushIntervalMs: Oe,
2193
+ flushIntervalMs: $e,
2111
2194
  batchSize: 100
2112
2195
  },
2113
2196
  metrics: {
2114
- flushIntervalMs: Me,
2197
+ flushIntervalMs: qe,
2115
2198
  batchSize: 500
2116
2199
  }
2117
- }, lr = class {
2200
+ }, hr = class {
2118
2201
  options;
2119
2202
  onFlush;
2120
2203
  pending = [];
@@ -2142,12 +2225,12 @@ var cr = {
2142
2225
  let e = setTimeout(() => {
2143
2226
  this.timer = null, this.onFlush(this);
2144
2227
  }, this.options.flushIntervalMs);
2145
- this.timer = e, T(e);
2228
+ this.timer = e, E(e);
2146
2229
  }
2147
2230
  clearTimer() {
2148
2231
  this.timer !== null && (clearTimeout(this.timer), this.timer = null);
2149
2232
  }
2150
- }, ur = class {
2233
+ }, gr = class {
2151
2234
  transport;
2152
2235
  storage;
2153
2236
  retry;
@@ -2155,22 +2238,22 @@ var cr = {
2155
2238
  streams;
2156
2239
  unconfirmed = /* @__PURE__ */ new Map();
2157
2240
  queue = [];
2158
- ceiling = new or();
2241
+ ceiling = new fr();
2159
2242
  inFlight = 0;
2160
2243
  pumpScheduled = !1;
2161
2244
  stopped = !1;
2162
- constructor(e, t, n, r, i = cr) {
2245
+ constructor(e, t, n, r, i = mr) {
2163
2246
  this.transport = e, this.storage = t, this.retry = n, this.diagnostics = r;
2164
2247
  let a = (e) => {
2165
2248
  this.claim(e);
2166
2249
  };
2167
2250
  this.streams = {
2168
- logs: new lr(i.logs, a),
2169
- metrics: new lr(i.metrics, a)
2251
+ logs: new hr(i.logs, a),
2252
+ metrics: new hr(i.metrics, a)
2170
2253
  };
2171
2254
  }
2172
2255
  push(e) {
2173
- this.stopped || (e.observedTimeUnixNano = Jt(), this.route(e));
2256
+ this.stopped || (e.observedTimeUnixNano = Xt(), this.route(e));
2174
2257
  }
2175
2258
  drainPending() {
2176
2259
  return this.toBatch([...this.streams.metrics.take(), ...this.streams.logs.take()]);
@@ -2188,7 +2271,7 @@ var cr = {
2188
2271
  }
2189
2272
  toBatch(e) {
2190
2273
  return e.length === 0 ? null : {
2191
- id: P(),
2274
+ id: F(),
2192
2275
  records: e,
2193
2276
  createdAt: Date.now(),
2194
2277
  attempts: 0
@@ -2196,7 +2279,7 @@ var cr = {
2196
2279
  }
2197
2280
  route(e) {
2198
2281
  try {
2199
- let t = sr(e) ? this.streams.metrics : this.streams.logs;
2282
+ let t = pr(e) ? this.streams.metrics : this.streams.logs;
2200
2283
  if (!this.ceiling.allow(e)) {
2201
2284
  this.diagnostics.count("record.dropped_by_ceiling");
2202
2285
  return;
@@ -2208,7 +2291,7 @@ var cr = {
2208
2291
  }
2209
2292
  claim(e) {
2210
2293
  let t = e.take(), n = {
2211
- id: P(),
2294
+ id: F(),
2212
2295
  records: t,
2213
2296
  createdAt: Date.now(),
2214
2297
  attempts: 0
@@ -2270,10 +2353,10 @@ var cr = {
2270
2353
  };
2271
2354
  //#endregion
2272
2355
  //#region src/core/record.ts
2273
- function J(e) {
2356
+ function Y(e) {
2274
2357
  return e;
2275
2358
  }
2276
- var dr = class {
2359
+ var _r = class {
2277
2360
  deps;
2278
2361
  resourceCache = null;
2279
2362
  constructor(e) {
@@ -2284,35 +2367,41 @@ var dr = class {
2284
2367
  }
2285
2368
  isEnabled(e) {
2286
2369
  let { config: t } = this.deps;
2287
- return t.enabled ? S[e] >= S[t.minLevel] : !1;
2370
+ return t.enabled ? x[e] >= x[t.minLevel] : !1;
2288
2371
  }
2289
2372
  build(e) {
2290
2373
  let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a, limits: o } = this.deps;
2291
- if (!this.isEnabled(e.level)) return n.count("record.dropped_by_level"), null;
2374
+ if (!this.isEnabled(e.level)) return n.count("record.dropped_by_level"), {
2375
+ record: null,
2376
+ dropped: "level"
2377
+ };
2292
2378
  let s = r.resolve(), c = i.current();
2293
- if (!ir({
2379
+ if (!ur({
2294
2380
  level: e.level,
2295
2381
  type: e.type,
2296
2382
  namespace: e.namespace,
2297
2383
  journeyId: c?.id ?? "",
2298
2384
  traceId: s.traceId
2299
- }, t)) return n.count("record.dropped_by_sampling"), null;
2300
- let l = a.next(), u = Bt(), d = t.capture.fullUrls ? u : A(u), f, p = 0;
2385
+ }, t)) return n.count("record.dropped_by_sampling"), {
2386
+ record: null,
2387
+ dropped: "sampling"
2388
+ };
2389
+ let l = a.next(), u = Ht(), d = t.capture.fullUrls ? u : j(u), f, p = 0;
2301
2390
  try {
2302
- let t = z(this.deps.context.getAll(), o), n = z(e.scoped ?? {}, o), r = z(e.payload ?? {}, o);
2391
+ let t = B(this.deps.context.getAll(), o), n = B(e.scoped ?? {}, o), r = B(e.payload ?? {}, o);
2303
2392
  p = t.bytes + n.bytes + r.bytes, f = {
2304
- ...J(t.value),
2305
- ...J(n.value),
2306
- ...J(r.value)
2393
+ ...Y(t.value),
2394
+ ...Y(n.value),
2395
+ ...Y(r.value)
2307
2396
  };
2308
2397
  } catch (e) {
2309
- n.report("record.sanitize_failed", "attributes could not be sanitized", void 0, e), f = { [Ne]: !0 };
2398
+ n.report("record.sanitize_failed", "attributes could not be sanitized", void 0, e), f = { [Me]: !0 };
2310
2399
  }
2311
- f[b] = e.type, f[je] = l, f[x] = e.namespace, f[ft] = d, c && (f[y] = c.id, f[et] = c.name, c.parentId !== void 0 && (f[ct] = c.parentId));
2312
- let m = R(e.body, o.maxBodyChars);
2400
+ f[S] = e.type, f[ke] = l, f[C] = e.namespace, f[pt] = d, c && (f[b] = c.id, f[Ze] = c.name, c.parentId !== void 0 && (f[st] = c.parentId));
2401
+ let m = z(e.body, o.maxBodyChars);
2313
2402
  m !== e.body && n.count("record.truncated");
2314
2403
  let h = {
2315
- timeUnixNano: Jt(),
2404
+ timeUnixNano: Xt(),
2316
2405
  traceId: s.traceId,
2317
2406
  spanId: s.spanId,
2318
2407
  traceFlags: s.traceFlags,
@@ -2324,13 +2413,16 @@ var dr = class {
2324
2413
  }, g = t.redact;
2325
2414
  if (g) {
2326
2415
  let e = n.guard("record.sanitize_failed", "redact hook threw", () => g(h));
2327
- if (e === null) return n.count("record.dropped_by_redact"), null;
2416
+ if (e === null) return n.count("record.dropped_by_redact"), {
2417
+ record: null,
2418
+ dropped: "redact"
2419
+ };
2328
2420
  if (e !== void 0 && e !== h) {
2329
- if (Yt(e)) {
2330
- let t = z(e.attributes, o);
2421
+ if (Zt(e)) {
2422
+ let t = B(e.attributes, o);
2331
2423
  h = {
2332
2424
  ...e,
2333
- attributes: J(t.value)
2425
+ attributes: Y(t.value)
2334
2426
  }, p = t.bytes;
2335
2427
  } else n.report("record.sanitize_failed", "redact hook returned something that is not a record, keeping the original");
2336
2428
  }
@@ -2341,50 +2433,52 @@ var dr = class {
2341
2433
  body: h.body
2342
2434
  });
2343
2435
  let t = {
2344
- [b]: e.type,
2345
- [je]: l,
2346
- [x]: e.namespace,
2347
- [ft]: d,
2348
- [He]: !0,
2349
- [ot]: p
2436
+ [S]: e.type,
2437
+ [ke]: l,
2438
+ [C]: e.namespace,
2439
+ [pt]: d,
2440
+ [Ve]: !0,
2441
+ [it]: p
2350
2442
  };
2351
- c && (t[y] = c.id, t[et] = c.name), h.attributes = t;
2443
+ c && (t[b] = c.id, t[Ze] = c.name), h.attributes = t;
2352
2444
  }
2353
- return h;
2445
+ return { record: h };
2354
2446
  }
2355
2447
  resource() {
2356
2448
  if (this.resourceCache) return this.resourceCache;
2357
- let { config: e, identity: n, platform: i } = this.deps;
2449
+ let { config: e, identity: t, platform: r } = this.deps;
2358
2450
  return this.resourceCache = {
2359
- [c]: e.serviceName,
2360
- [ue]: e.serviceVersion,
2361
- [o]: e.environment,
2362
- [oe]: Fe,
2363
- [ce]: dt,
2364
- [Ke]: t,
2365
- [ht]: i.platform,
2366
- [Je]: n.sessionId,
2367
- [r]: n.tabId,
2368
- [he]: n.contextId,
2369
- [_t]: i.userAgent,
2370
- ...i.openfinUuid === void 0 ? {} : { [u]: i.openfinUuid },
2371
- ...i.openfinName === void 0 ? {} : { [_e]: i.openfinName }
2451
+ [le]: e.serviceName,
2452
+ [Ke]: e.serviceVersion,
2453
+ [_t]: e.environment,
2454
+ [se]: dt,
2455
+ [ue]: Xe,
2456
+ [ae]: Pe,
2457
+ [he]: r.platform,
2458
+ [n]: t.sessionId,
2459
+ [We]: t.tabId,
2460
+ [a]: t.contextId,
2461
+ [me]: r.userAgent,
2462
+ ...r.openfinUuid === void 0 ? {} : { [s]: r.openfinUuid },
2463
+ ...r.openfinName === void 0 ? {} : { [l]: r.openfinName }
2372
2464
  }, this.resourceCache;
2373
2465
  }
2374
- }, Y = Symbol.for(ie), X = class e {
2466
+ }, vr = Symbol.for(fe), X = class t {
2375
2467
  diagnostics;
2376
2468
  config;
2377
2469
  platform;
2378
2470
  identity;
2379
- context = new qn();
2471
+ sessionTouch;
2472
+ context = new Qn();
2380
2473
  breadcrumbs;
2381
2474
  tracing;
2382
- sequence = new Tn();
2475
+ sequence = new En();
2383
2476
  journey;
2384
2477
  builder;
2385
2478
  console;
2386
2479
  bus;
2387
2480
  storage;
2481
+ storageBuiltAs;
2388
2482
  transport;
2389
2483
  retry;
2390
2484
  pipeline;
@@ -2397,11 +2491,11 @@ var dr = class {
2397
2491
  destroyed = !1;
2398
2492
  lastGapAt = 0;
2399
2493
  constructor(e) {
2400
- this.diagnostics = new Jn(e.onDiagnostic), this.platform = Lt(this.diagnostics), this.config = Gn(e, this.diagnostics), this.identity = Zt(this.diagnostics), this.breadcrumbs = new In(50), this.tracing = new Fn(this.diagnostics, void 0, this.config.otelLoader), this.tracing.loadOtel(), this.console = new wn(this.config.console), this.journey = new tr(Yn, this.diagnostics, this.identity.contextId, (e) => {
2494
+ this.diagnostics = new $n(e.onDiagnostic), this.platform = zt(this.diagnostics), this.config = Yn(e, this.diagnostics), this.identity = $t(this.diagnostics), this.sessionTouch = new en(this.diagnostics), this.breadcrumbs = new Ln(50), this.tracing = new In(this.diagnostics, void 0, this.config.otelLoader), this.tracing.loadOtel(), this.console = new Tn(this.config.console, this.diagnostics), this.journey = new or(er, this.diagnostics, this.identity.contextId, (e) => {
2401
2495
  this.bus.broadcastJourney(e);
2402
- }), this.builder = new dr({
2496
+ }), this.builder = new _r({
2403
2497
  config: this.config,
2404
- limits: vt,
2498
+ limits: Oe,
2405
2499
  diagnostics: this.diagnostics,
2406
2500
  context: this.context,
2407
2501
  journey: this.journey,
@@ -2409,7 +2503,7 @@ var dr = class {
2409
2503
  sequence: this.sequence,
2410
2504
  identity: this.identity,
2411
2505
  platform: this.platform
2412
- }), this.bus = new It(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
2506
+ }), this.bus = new Rt(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
2413
2507
  onRecords: (e) => {
2414
2508
  this.ingestForwarded(e);
2415
2509
  },
@@ -2428,16 +2522,20 @@ var dr = class {
2428
2522
  });
2429
2523
  };
2430
2524
  static current() {
2431
- return globalThis[Y] ?? null;
2525
+ return globalThis[vr] ?? null;
2432
2526
  }
2433
- static configure(t) {
2434
- let n = e.current();
2435
- if (n && !n.destroyed) return n.reconfigure(t), n;
2436
- let r = new e(t);
2437
- return globalThis[Y] = r, r.init(), r;
2527
+ static configure(e) {
2528
+ let n = t.current();
2529
+ if (n && !n.destroyed) return n.reconfigure(e), n;
2530
+ let r = new t(e);
2531
+ return globalThis[vr] = r, r.init(), r;
2438
2532
  }
2439
2533
  reconfigure(e) {
2440
- Kn(this.config, Gn(e, this.diagnostics, this.config)), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.ready && this.reinstallCaptures(), this.diagnostics.report("config.reconfigured", "configure() was called again, the existing runtime was updated");
2534
+ Zn(this.config, Yn(e, this.diagnostics, this.config)), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.ready && this.reinstallCaptures(), this.diagnostics.report("config.reconfigured", "configure() was called again, the existing runtime was updated");
2535
+ }
2536
+ keepBuiltStorage() {
2537
+ let e = this.storageBuiltAs;
2538
+ e !== void 0 && this.config.storage !== e && (this.diagnostics.report("config.invalid", `storage cannot change after startup, still ${e}`, { requested: this.config.storage }), this.config.storage = e);
2441
2539
  }
2442
2540
  async init() {
2443
2541
  try {
@@ -2450,11 +2548,11 @@ var dr = class {
2450
2548
  }
2451
2549
  }
2452
2550
  async becomeSender() {
2453
- this.storage = await hn(this.config.storage, xe, m, this.diagnostics, this.reportGap), this.transport = new xn(this.config, this.diagnostics), this.retry = new Sn(this.storage, this.transport, this.diagnostics, this.config), this.pipeline = new ur(this.transport, this.storage, this.retry, this.diagnostics), this.exitFlush = new vn({
2551
+ this.storageBuiltAs = this.config.storage, this.storage = await gn(this.config.storage, p, ne, this.diagnostics, this.reportGap), this.transport = new Sn(this.config, this.diagnostics), this.retry = new Cn(this.storage, this.transport, this.diagnostics, this.config), this.pipeline = new gr(this.transport, this.storage, this.retry, this.diagnostics), this.exitFlush = new yn({
2454
2552
  config: this.config,
2455
2553
  diagnostics: this.diagnostics,
2456
2554
  drainForExit: () => this.pipeline?.drainForExit() ?? null
2457
- }), await cn(this.storage, this.diagnostics), this.retry.start(), this.exitFlush.install();
2555
+ }), await ln(this.storage, this.diagnostics), this.retry.start(), this.exitFlush.install();
2458
2556
  }
2459
2557
  installCaptures() {
2460
2558
  let e = {
@@ -2462,9 +2560,9 @@ var dr = class {
2462
2560
  diagnostics: this.diagnostics,
2463
2561
  breadcrumbs: this.breadcrumbs,
2464
2562
  tracing: this.tracing,
2465
- logger: new w(this, a)
2563
+ logger: new T(this, i)
2466
2564
  }, t = this.config.capture;
2467
- (t.errors || t.rejections || t.resourceErrors) && this.captures.push(new Vt(e)), (t.fetch || t.xhr) && this.captures.push(new Gt(e)), (t.interactions || t.navigation) && this.captures.push(new Ut(e)), t.webVitals && this.captures.push(new qt(e));
2565
+ (t.errors || t.rejections || t.resourceErrors) && this.captures.push(new Ut(e)), (t.fetch || t.xhr) && this.captures.push(new qt(e)), (t.interactions || t.navigation) && this.captures.push(new Gt(e)), t.webVitals && this.captures.push(new Yt(e));
2468
2566
  for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `installing ${e.name}`, () => {
2469
2567
  e.install();
2470
2568
  });
@@ -2484,12 +2582,12 @@ var dr = class {
2484
2582
  if (!this.destroyed) {
2485
2583
  this.destroyed = !0;
2486
2584
  for (let e of this.captures) e.uninstall();
2487
- this.captures.length = 0, this.exitFlush?.flush("shutdown"), this.exitFlush?.uninstall(), this.retry?.stop(), this.pipeline?.destroy(), this.journey.destroy(), this.bus.destroy(), this.forwardBuffer = [], await this.storage?.close(), e.current() === this && Reflect.deleteProperty(globalThis, Y);
2585
+ this.captures.length = 0, this.exitFlush?.flush("shutdown"), this.exitFlush?.uninstall(), this.retry?.stop(), this.pipeline?.destroy(), this.journey.destroy(), this.bus.destroy(), this.forwardBuffer = [], await this.storage?.close(), t.current() === this && Reflect.deleteProperty(globalThis, vr);
2488
2586
  }
2489
2587
  }
2490
2588
  emit(e) {
2491
2589
  if (!(!e || this.destroyed)) {
2492
- if ($t(this.identity.sessionId, this.diagnostics), !this.ready) {
2590
+ if (this.sessionTouch.touch(this.identity.sessionId), !this.ready) {
2493
2591
  this.bootBuffer.length >= 500 && (this.bootBuffer.shift(), this.diagnostics.count("record.dropped_boot_buffer_full")), this.bootBuffer.push(e);
2494
2592
  return;
2495
2593
  }
@@ -2516,11 +2614,11 @@ var dr = class {
2516
2614
  return;
2517
2615
  }
2518
2616
  for (let t of e) {
2519
- if (!Yt(t)) {
2617
+ if (!Zt(t)) {
2520
2618
  this.diagnostics.count("record.dropped_malformed");
2521
2619
  continue;
2522
2620
  }
2523
- if (!ar(t, this.config)) {
2621
+ if (!dr(t, this.config)) {
2524
2622
  this.diagnostics.count("record.dropped_by_sampling");
2525
2623
  continue;
2526
2624
  }
@@ -2535,19 +2633,19 @@ var dr = class {
2535
2633
  }
2536
2634
  reportGap = (e) => {
2537
2635
  let t = Date.now();
2538
- t - this.lastGapAt < 6e4 || (this.lastGapAt = t, new w(this, re).warn("stored records were dropped before delivery", {
2636
+ t - this.lastGapAt < 6e4 || (this.lastGapAt = t, new T(this, rt).warn("stored records were dropped before delivery", {
2539
2637
  "gap.batches": e.batches,
2540
2638
  "gap.records": e.records,
2541
2639
  "gap.reason": e.reason
2542
2640
  }));
2543
2641
  };
2544
2642
  regenerateTabId() {
2545
- let e = P();
2643
+ let t = F();
2546
2644
  this.diagnostics.report("bus.role_resolved", "another context claimed this tab id, most likely a duplicated tab. Regenerating.", {
2547
2645
  was: this.identity.tabId,
2548
- now: e
2549
- }), this.identity.tabId = e, this.diagnostics.guard("storage.unavailable", "persisting the new tab id", () => {
2550
- sessionStorage.setItem(fe, e);
2646
+ now: t
2647
+ }), this.identity.tabId = t, this.diagnostics.guard("storage.unavailable", "persisting the new tab id", () => {
2648
+ sessionStorage.setItem(e, t);
2551
2649
  }), this.builder.invalidateResource();
2552
2650
  }
2553
2651
  async queueDepth() {
@@ -2578,94 +2676,94 @@ var dr = class {
2578
2676
  function Q() {
2579
2677
  return X.current() || X.configure({});
2580
2678
  }
2581
- function fr(e) {
2679
+ function yr(e) {
2582
2680
  X.configure(e), Z.clear();
2583
2681
  }
2584
- function pr(e, t) {
2585
- if (t) return new w(Q(), e, t);
2682
+ function br(e, t) {
2683
+ if (t) return new T(Q(), e, t);
2586
2684
  let n = Z.get(e);
2587
- return n || (n = new w(Q(), e), Z.set(e, n)), n;
2685
+ return n || (n = new T(Q(), e), Z.set(e, n)), n;
2588
2686
  }
2589
2687
  function $() {
2590
- return pr("app");
2688
+ return br("app");
2591
2689
  }
2592
- function mr(e, t) {
2690
+ function xr(e, t) {
2593
2691
  $().trace(e, t);
2594
2692
  }
2595
- function hr(e, t) {
2693
+ function Sr(e, t) {
2596
2694
  $().debug(e, t);
2597
2695
  }
2598
- function gr(e, t) {
2696
+ function Cr(e, t) {
2599
2697
  $().info(e, t);
2600
2698
  }
2601
- function _r(e, t) {
2699
+ function wr(e, t) {
2602
2700
  $().warn(e, t);
2603
2701
  }
2604
- function vr(e, t, n) {
2702
+ function Tr(e, t, n) {
2605
2703
  $().error(e, t, n);
2606
2704
  }
2607
- function yr(e, t) {
2705
+ function Er(e, t) {
2608
2706
  $().logAction(e, t);
2609
2707
  }
2610
- function br(e, t) {
2708
+ function Dr(e, t) {
2611
2709
  $().logEvent(e, t);
2612
2710
  }
2613
- function xr(e, t, n, r, i) {
2711
+ function Or(e, t, n, r, i) {
2614
2712
  $().logMetric(e, t, n, r, i);
2615
2713
  }
2616
- function Sr(e, t, n) {
2714
+ function kr(e, t, n) {
2617
2715
  return $().timeSync(e, t, n);
2618
2716
  }
2619
- function Cr(e, t, n) {
2717
+ function Ar(e, t, n) {
2620
2718
  return $().timeAsync(e, t, n);
2621
2719
  }
2622
- function wr(e, t) {
2720
+ function jr(e, t) {
2623
2721
  Q().context.set(e, t);
2624
2722
  }
2625
- function Tr(e) {
2723
+ function Mr(e) {
2626
2724
  Q().context.setMany(e);
2627
2725
  }
2628
- function Er(e) {
2726
+ function Nr(e) {
2629
2727
  Q().context.remove(e);
2630
2728
  }
2631
- function Dr(e, t) {
2729
+ function Pr(e, t) {
2632
2730
  return Q().journey.start(e, t);
2633
2731
  }
2634
- function Or() {
2732
+ function Fr() {
2635
2733
  Q().journey.end();
2636
2734
  }
2637
- function kr() {
2735
+ function Ir() {
2638
2736
  return Q().journey.current();
2639
2737
  }
2640
- function Ar() {
2738
+ function Lr() {
2641
2739
  return Q().journey.getToken();
2642
2740
  }
2643
- function jr(e) {
2741
+ function Rr(e) {
2644
2742
  return Q().journey.adopt(e, "manual", !0);
2645
2743
  }
2646
- function Mr(e) {
2744
+ function zr(e) {
2647
2745
  Q().registerWorker(e);
2648
2746
  }
2649
- function Nr() {
2747
+ function Br() {
2650
2748
  Q().tracing.rotate("explicit");
2651
2749
  }
2652
- function Pr() {
2750
+ function Vr() {
2653
2751
  return Q().tracing.headers();
2654
2752
  }
2655
- function Fr() {
2753
+ function Hr() {
2656
2754
  return Q().flush();
2657
2755
  }
2658
- function Ir() {
2756
+ function Ur() {
2659
2757
  return Q().queueDepth();
2660
2758
  }
2661
- function Lr() {
2759
+ function Wr() {
2662
2760
  return Q().diagnostics.snapshot();
2663
2761
  }
2664
- async function Rr() {
2762
+ async function Gr() {
2665
2763
  let e = X.current();
2666
2764
  Z.clear(), await e?.destroy();
2667
2765
  }
2668
2766
  //#endregion
2669
- export { w as OneLogger, jr as adoptJourney, fr as configure, kr as currentJourney, hr as debug, Or as endJourney, vr as error, Fr as flush, Lr as getDiagnosticCounters, Ar as getJourneyToken, pr as getLogger, Ir as getQueueDepth, Pr as getTraceHeaders, gr as info, yr as logAction, br as logEvent, xr as logMetric, Mr as registerWorker, Er as removeContext, wr as setContext, Tr as setContextMap, Rr as shutdown, Dr as startJourney, Nr as startTrace, Cr as timeAsync, Sr as timeSync, mr as trace, _r as warn };
2767
+ export { T as OneLogger, Rr as adoptJourney, yr as configure, Ir as currentJourney, Sr as debug, Fr as endJourney, Tr as error, Hr as flush, Wr as getDiagnosticCounters, Lr as getJourneyToken, br as getLogger, Ur as getQueueDepth, Vr as getTraceHeaders, Cr as info, Er as logAction, Dr as logEvent, Or as logMetric, zr as registerWorker, Nr as removeContext, jr as setContext, Mr as setContextMap, Gr as shutdown, Pr as startJourney, Br as startTrace, Ar as timeAsync, kr as timeSync, xr as trace, wr as warn };
2670
2768
 
2671
2769
  //# sourceMappingURL=index.js.map