@utk09/ui-observability 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +108 -33
  3. package/dist/batch-C4oF6XZT.cjs +2 -0
  4. package/dist/batch-C4oF6XZT.cjs.map +1 -0
  5. package/dist/{batch-4xKzzSCj.js → batch-D-4xl7op.js} +8 -5
  6. package/dist/batch-D-4xl7op.js.map +1 -0
  7. package/dist/bus/bus.d.ts +0 -4
  8. package/dist/{bus-DrixwdiX.js → bus-Cyvq-Ngx.js} +59 -62
  9. package/dist/bus-Cyvq-Ngx.js.map +1 -0
  10. package/dist/bus-rOhVuRee.cjs +2 -0
  11. package/dist/bus-rOhVuRee.cjs.map +1 -0
  12. package/dist/capture/network.d.ts +1 -0
  13. package/dist/capture/storm.d.ts +2 -7
  14. package/dist/capture/types.d.ts +3 -0
  15. package/dist/capture/web-socket.d.ts +40 -0
  16. package/dist/{console-B3vGRW5p.js → console-BT7mcgU6.js} +3 -3
  17. package/dist/{console-B3vGRW5p.js.map → console-BT7mcgU6.js.map} +1 -1
  18. package/dist/{console-ChfuJlf9.cjs → console-Boqa7new.cjs} +2 -2
  19. package/dist/{console-ChfuJlf9.cjs.map → console-Boqa7new.cjs.map} +1 -1
  20. package/dist/constants-BgRS6MB0.cjs +2 -0
  21. package/dist/constants-BgRS6MB0.cjs.map +1 -0
  22. package/dist/constants-L_d5YvvQ.js +160 -0
  23. package/dist/constants-L_d5YvvQ.js.map +1 -0
  24. package/dist/constants.d.ts +36 -5
  25. package/dist/core/breadcrumbs.d.ts +4 -4
  26. package/dist/core/context.d.ts +0 -8
  27. package/dist/core/diagnostics.d.ts +1 -3
  28. package/dist/core/journey.d.ts +7 -0
  29. package/dist/core/meter.d.ts +19 -1
  30. package/dist/core/pipeline.d.ts +12 -4
  31. package/dist/core/record.d.ts +40 -8
  32. package/dist/core/remote-sampling.d.ts +7 -3
  33. package/dist/core/runtime.d.ts +62 -3
  34. package/dist/core/sampling.d.ts +33 -4
  35. package/dist/core/sender.d.ts +8 -0
  36. package/dist/core/spans.d.ts +34 -0
  37. package/dist/{errors-BGs5NOrw.js → errors-BDI96zKc.js} +6 -6
  38. package/dist/errors-BDI96zKc.js.map +1 -0
  39. package/dist/errors-_xEsCVXn.cjs +3 -0
  40. package/dist/errors-_xEsCVXn.cjs.map +1 -0
  41. package/dist/fixed-window-BR0bu32Y.cjs +2 -0
  42. package/dist/fixed-window-BR0bu32Y.cjs.map +1 -0
  43. package/dist/fixed-window-Re7jIRJH.js +9 -0
  44. package/dist/fixed-window-Re7jIRJH.js.map +1 -0
  45. package/dist/identity-Bwku7zzN.cjs +2 -0
  46. package/dist/identity-Bwku7zzN.cjs.map +1 -0
  47. package/dist/{identity-rpEyjvVg.js → identity-Dtv917nz.js} +33 -23
  48. package/dist/identity-Dtv917nz.js.map +1 -0
  49. package/dist/index.cjs +1 -1
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.d.ts +23 -1
  52. package/dist/index.js +804 -537
  53. package/dist/index.js.map +1 -1
  54. package/dist/indexeddb-storage-Cvavrf-y.cjs +2 -0
  55. package/dist/indexeddb-storage-Cvavrf-y.cjs.map +1 -0
  56. package/dist/{indexeddb-storage-Q9fDYlyn.js → indexeddb-storage-HgkQUTyS.js} +57 -68
  57. package/dist/indexeddb-storage-HgkQUTyS.js.map +1 -0
  58. package/dist/{interactions-BAGRmtrv.cjs → interactions-Bhe1ft8P.cjs} +2 -2
  59. package/dist/interactions-Bhe1ft8P.cjs.map +1 -0
  60. package/dist/{interactions-B8zjCjga.js → interactions-Ck01cEij.js} +3 -3
  61. package/dist/interactions-Ck01cEij.js.map +1 -0
  62. package/dist/journey-Co9OlzrW.cjs +2 -0
  63. package/dist/journey-Co9OlzrW.cjs.map +1 -0
  64. package/dist/{journey-_dQQ1eMP.js → journey-DRK0A8u_.js} +37 -33
  65. package/dist/journey-DRK0A8u_.js.map +1 -0
  66. package/dist/{library-request-DX6ev9oG.js → library-request-ChCar5F8.js} +3 -3
  67. package/dist/{library-request-DX6ev9oG.js.map → library-request-ChCar5F8.js.map} +1 -1
  68. package/dist/{library-request-BIG3Xpx3.cjs → library-request-gMFOCNcn.cjs} +2 -2
  69. package/dist/{library-request-BIG3Xpx3.cjs.map → library-request-gMFOCNcn.cjs.map} +1 -1
  70. package/dist/log-record-cwFiLyPY.js +17 -0
  71. package/dist/log-record-cwFiLyPY.js.map +1 -0
  72. package/dist/log-record-jX9eWUP8.cjs +2 -0
  73. package/dist/log-record-jX9eWUP8.cjs.map +1 -0
  74. package/dist/{long-frames-Cq2LgNnp.cjs → long-frames-Bky6nZDF.cjs} +2 -2
  75. package/dist/long-frames-Bky6nZDF.cjs.map +1 -0
  76. package/dist/{long-frames-B0tKuChx.js → long-frames-DDumopji.js} +4 -4
  77. package/dist/long-frames-DDumopji.js.map +1 -0
  78. package/dist/models/batch.d.ts +6 -0
  79. package/dist/models/config.d.ts +56 -5
  80. package/dist/models/log-record.d.ts +1 -1
  81. package/dist/models/plugin.d.ts +47 -0
  82. package/dist/models/stats.d.ts +11 -0
  83. package/dist/{network-CMnEvGJB.js → network-BsBZ6_-Q.js} +43 -29
  84. package/dist/network-BsBZ6_-Q.js.map +1 -0
  85. package/dist/network-_4csBGBM.cjs +2 -0
  86. package/dist/network-_4csBGBM.cjs.map +1 -0
  87. package/dist/openfin-BwEN0uj4.js +8 -0
  88. package/dist/openfin-BwEN0uj4.js.map +1 -0
  89. package/dist/openfin-DtH2f7zX.cjs +2 -0
  90. package/dist/openfin-DtH2f7zX.cjs.map +1 -0
  91. package/dist/platform-4yYjMD-B.js +57 -0
  92. package/dist/platform-4yYjMD-B.js.map +1 -0
  93. package/dist/platform-o7r1ocOu.cjs +2 -0
  94. package/dist/platform-o7r1ocOu.cjs.map +1 -0
  95. package/dist/remote-rules-1KqfVBIu.js +91 -0
  96. package/dist/remote-rules-1KqfVBIu.js.map +1 -0
  97. package/dist/remote-rules-BHgEGlYi.cjs +2 -0
  98. package/dist/remote-rules-BHgEGlYi.cjs.map +1 -0
  99. package/dist/sampling-C4my-ma0.cjs +2 -0
  100. package/dist/sampling-C4my-ma0.cjs.map +1 -0
  101. package/dist/sampling-nYIWP_vP.js +86 -0
  102. package/dist/sampling-nYIWP_vP.js.map +1 -0
  103. package/dist/{sanitize-BNwgPj_B.js → sanitize-BiUKCUG6.js} +2 -2
  104. package/dist/{sanitize-BNwgPj_B.js.map → sanitize-BiUKCUG6.js.map} +1 -1
  105. package/dist/{sanitize-BqzPc4Jg.cjs → sanitize-BxuPSXOk.cjs} +2 -2
  106. package/dist/{sanitize-BqzPc4Jg.cjs.map → sanitize-BxuPSXOk.cjs.map} +1 -1
  107. package/dist/sender-6vrT9fFL.cjs +3 -0
  108. package/dist/sender-6vrT9fFL.cjs.map +1 -0
  109. package/dist/{sender--0_VzPbN.js → sender-DFQMF39P.js} +380 -278
  110. package/dist/sender-DFQMF39P.js.map +1 -0
  111. package/dist/storage/gap.d.ts +20 -0
  112. package/dist/storage/indexeddb-storage.d.ts +1 -7
  113. package/dist/storage/keys.d.ts +9 -0
  114. package/dist/storage/local-storage.d.ts +0 -6
  115. package/dist/storage/memory-storage.d.ts +1 -1
  116. package/dist/storm-6YYbXzT_.cjs +2 -0
  117. package/dist/storm-6YYbXzT_.cjs.map +1 -0
  118. package/dist/storm-CfO0Sam2.js +10 -0
  119. package/dist/storm-CfO0Sam2.js.map +1 -0
  120. package/dist/transport/exit-flush.d.ts +6 -0
  121. package/dist/transport/http-transport.d.ts +2 -1
  122. package/dist/transport/serializers/otlp-traces.d.ts +3 -0
  123. package/dist/transport/serializers/select.d.ts +8 -5
  124. package/dist/transport/status-transport.d.ts +7 -0
  125. package/dist/types-BR9t_w28.js +8 -0
  126. package/dist/types-BR9t_w28.js.map +1 -0
  127. package/dist/types-C7WNpnG1.cjs +2 -0
  128. package/dist/types-C7WNpnG1.cjs.map +1 -0
  129. package/dist/utils/fixed-window.d.ts +15 -0
  130. package/dist/utils/guards.d.ts +6 -0
  131. package/dist/utils/identity.d.ts +11 -0
  132. package/dist/utils/openfin.d.ts +48 -0
  133. package/dist/utils/platform.d.ts +13 -0
  134. package/dist/utils/tracing.d.ts +82 -4
  135. package/dist/web-socket-Ar4cZxmd.js +102 -0
  136. package/dist/web-socket-Ar4cZxmd.js.map +1 -0
  137. package/dist/web-socket-BwJdwSHl.cjs +2 -0
  138. package/dist/web-socket-BwJdwSHl.cjs.map +1 -0
  139. package/package.json +2 -3
  140. package/dist/batch-4xKzzSCj.js.map +0 -1
  141. package/dist/batch-cys7e53Q.cjs +0 -2
  142. package/dist/batch-cys7e53Q.cjs.map +0 -1
  143. package/dist/bus-B6vzPmQM.cjs +0 -2
  144. package/dist/bus-B6vzPmQM.cjs.map +0 -1
  145. package/dist/bus-DrixwdiX.js.map +0 -1
  146. package/dist/constants-Be83LICb.cjs +0 -2
  147. package/dist/constants-Be83LICb.cjs.map +0 -1
  148. package/dist/constants-CQ_D7jIW.js +0 -144
  149. package/dist/constants-CQ_D7jIW.js.map +0 -1
  150. package/dist/deadline-5_PecIl5.js +0 -26
  151. package/dist/deadline-5_PecIl5.js.map +0 -1
  152. package/dist/deadline-XSnm95pg.cjs +0 -2
  153. package/dist/deadline-XSnm95pg.cjs.map +0 -1
  154. package/dist/errors-BGs5NOrw.js.map +0 -1
  155. package/dist/errors-BMJm7KZZ.cjs +0 -3
  156. package/dist/errors-BMJm7KZZ.cjs.map +0 -1
  157. package/dist/identity-DXyV86o-.cjs +0 -2
  158. package/dist/identity-DXyV86o-.cjs.map +0 -1
  159. package/dist/identity-rpEyjvVg.js.map +0 -1
  160. package/dist/indexeddb-storage-BXaPVPyG.cjs +0 -2
  161. package/dist/indexeddb-storage-BXaPVPyG.cjs.map +0 -1
  162. package/dist/indexeddb-storage-Q9fDYlyn.js.map +0 -1
  163. package/dist/interactions-B8zjCjga.js.map +0 -1
  164. package/dist/interactions-BAGRmtrv.cjs.map +0 -1
  165. package/dist/journey-BGSyy8Es.cjs +0 -2
  166. package/dist/journey-BGSyy8Es.cjs.map +0 -1
  167. package/dist/journey-_dQQ1eMP.js.map +0 -1
  168. package/dist/long-frames-B0tKuChx.js.map +0 -1
  169. package/dist/long-frames-Cq2LgNnp.cjs.map +0 -1
  170. package/dist/network-C6kJbW6K.cjs +0 -2
  171. package/dist/network-C6kJbW6K.cjs.map +0 -1
  172. package/dist/network-CMnEvGJB.js.map +0 -1
  173. package/dist/platform-DNOJjpOm.cjs +0 -2
  174. package/dist/platform-DNOJjpOm.cjs.map +0 -1
  175. package/dist/platform-j0uMPwHi.js +0 -48
  176. package/dist/platform-j0uMPwHi.js.map +0 -1
  177. package/dist/remote-rules-DgoBJxZL.cjs +0 -2
  178. package/dist/remote-rules-DgoBJxZL.cjs.map +0 -1
  179. package/dist/remote-rules-UggoZqfP.js +0 -86
  180. package/dist/remote-rules-UggoZqfP.js.map +0 -1
  181. package/dist/sampling-BLMD8EGM.js +0 -64
  182. package/dist/sampling-BLMD8EGM.js.map +0 -1
  183. package/dist/sampling-MthcVXXU.cjs +0 -2
  184. package/dist/sampling-MthcVXXU.cjs.map +0 -1
  185. package/dist/sender--0_VzPbN.js.map +0 -1
  186. package/dist/sender-SPGMqZjD.cjs +0 -3
  187. package/dist/sender-SPGMqZjD.cjs.map +0 -1
  188. package/dist/storm-CTy1dfvs.cjs +0 -2
  189. package/dist/storm-CTy1dfvs.cjs.map +0 -1
  190. package/dist/storm-knaj4GUH.js +0 -10
  191. package/dist/storm-knaj4GUH.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,55 +1,55 @@
1
- import { A as e, At as t, Bt as n, Cn as r, D as i, F as a, Ft as o, Gt as s, Ht as c, I as l, It as u, Kt as d, L as f, Lt as p, Qt as m, Rt as h, S as g, Sn as _, Ut as ee, Vt as te, Wt as ne, Zt as re, _n as ie, _t as ae, a as v, c as y, d as b, en as x, f as oe, ft as se, gn as S, hn as ce, i as le, in as ue, j as de, k as C, l as fe, lt as pe, m as me, mn as he, n as w, o as ge, p as T, qt as _e, r as ve, s as E, sn as ye, u as D, ut as O, vn as be, vt as k, xn as xe, yt as Se, z as Ce, zt as we } from "./constants-CQ_D7jIW.js";
2
- import { n as Te, r as Ee, t as De } from "./error-like-Ywo5uRHo.js";
3
- import { a as Oe, i as ke, n as Ae, o as je, r as Me } from "./sampling-BLMD8EGM.js";
4
- import { a as Ne, i as Pe, n as Fe, o as A, r as j } from "./sanitize-BNwgPj_B.js";
5
- import { a as Ie, i as Le, n as Re, o as ze, r as Be, s as Ve, t as He } from "./identity-rpEyjvVg.js";
6
- import { n as Ue, r as We, t as Ge } from "./platform-j0uMPwHi.js";
7
- import { n as M, t as Ke } from "./batch-4xKzzSCj.js";
8
- import { r as qe } from "./library-request-DX6ev9oG.js";
9
- import { r as Je } from "./deadline-5_PecIl5.js";
10
- import { n as Ye, t as Xe } from "./journey-_dQQ1eMP.js";
1
+ import { A as e, Bt as t, Cn as n, Ct as r, D as i, Dn as a, F as o, Gt as s, Ht as c, I as l, Jt as u, Kt as d, L as f, On as p, Pt as m, S as h, Sn as g, St as _, Ut as ee, Vt as te, Wt as ne, Xt as re, Yt as ie, Zt as ae, a as v, bn as oe, c as y, cn as se, d as b, f as ce, fn as le, ft as ue, ht as de, i as fe, in as x, j as pe, k as S, kn as me, l as he, ln as C, m as ge, n as w, nn as _e, o as ve, p as T, pt as E, qt as ye, r as be, s as D, tn as xe, u as O, wn as Se, xn as k, xt as Ce, yn as we, z as Te, zt as Ee } from "./constants-L_d5YvvQ.js";
2
+ import { n as De, r as Oe, t as ke } from "./error-like-Ywo5uRHo.js";
3
+ import { a as Ae, i as je, l as Me, n as Ne, o as Pe, u as A } from "./sampling-nYIWP_vP.js";
4
+ import { n as Fe, r as Ie, t as Le } from "./log-record-cwFiLyPY.js";
5
+ import { a as Re, i as ze, n as Be, o as j, r as M } from "./sanitize-BiUKCUG6.js";
6
+ import { a as Ve, i as He, n as Ue, o as We, r as Ge, s as Ke, t as qe } from "./identity-Dtv917nz.js";
7
+ import { r as Je } from "./library-request-ChCar5F8.js";
8
+ import { i as Ye, n as Xe, t as Ze } from "./platform-4yYjMD-B.js";
9
+ import { r as N, t as Qe } from "./batch-D-4xl7op.js";
10
+ import { n as $e, t as et } from "./journey-DRK0A8u_.js";
11
11
  //#region src/utils/timer.ts
12
- function N(e) {
13
- return Math.round((performance.now() - e) * Ce) / Ce;
12
+ function P(e) {
13
+ return Math.round((performance.now() - e) * Te) / Te;
14
14
  }
15
- function P(e, t, n, r, i) {
15
+ function F(e, t, n, r, i) {
16
16
  e.logMetric(`${t}.duration`, n, "ms", "histogram", {
17
17
  status: r,
18
18
  ...i
19
19
  });
20
20
  }
21
- function Ze(e, t, n, r, i) {
22
- let a = N(n);
21
+ function tt(e, t, n, r, i) {
22
+ let a = P(n);
23
23
  e.error(`${t} failed`, r, {
24
24
  "action.duration_ms": a,
25
25
  status: "FAILURE",
26
26
  ...i
27
- }), P(e, t, a, "FAILURE", i);
27
+ }), F(e, t, a, "FAILURE", i);
28
28
  }
29
- function Qe(e, t, n, r) {
29
+ function nt(e, t, n, r) {
30
30
  let i = performance.now();
31
31
  try {
32
32
  let a = n();
33
- return P(e, t, N(i), "SUCCESS", r), a;
33
+ return F(e, t, P(i), "SUCCESS", r), a;
34
34
  } catch (n) {
35
- throw Ze(e, t, i, n, r), n;
35
+ throw tt(e, t, i, n, r), n;
36
36
  }
37
37
  }
38
- async function $e(e, t, n, r) {
38
+ async function rt(e, t, n, r) {
39
39
  let i = performance.now();
40
40
  try {
41
41
  let a = await n();
42
- return P(e, t, N(i), "SUCCESS", r), a;
42
+ return F(e, t, P(i), "SUCCESS", r), a;
43
43
  } catch (n) {
44
- throw Ze(e, t, i, n, r), n;
44
+ throw tt(e, t, i, n, r), n;
45
45
  }
46
46
  }
47
47
  //#endregion
48
48
  //#region src/core/logger.ts
49
- var et = [i, ye];
50
- function tt(e, t) {
49
+ var it = [i, le];
50
+ function at(e, t) {
51
51
  let n = t.guard("record.sanitize_failed", "The library could not read the error reason.", () => {
52
- if (!(e instanceof Error) && !Ee(e)) return;
52
+ if (!(e instanceof Error) && !Oe(e)) return;
53
53
  let t = Error(e.message);
54
54
  return t.name = e.name, t.stack = e.stack, t;
55
55
  });
@@ -57,38 +57,38 @@ function tt(e, t) {
57
57
  let r = t.guard("record.sanitize_failed", "The library could not convert the error reason to text.", () => String(e));
58
58
  return Error(r ?? typeof e);
59
59
  }
60
- function nt(e, t, n) {
60
+ function ot(e, t, n) {
61
61
  return n.guard("record.sanitize_failed", "The library could not read the error reason.", () => e instanceof Error ? e : t) ?? t;
62
62
  }
63
- function rt(e, t) {
63
+ function st(e, t) {
64
64
  if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e == "symbol") return e;
65
65
  if (typeof e == "object" && e) return t.guard("record.sanitize_failed", "The library could not read the properties of the error reason.", () => {
66
- let t = e, n = Ee(e), r = {}, i = 0;
66
+ let t = e, n = Oe(e), r = {}, i = 0;
67
67
  for (let e of Object.keys(t)) {
68
68
  let a = t[e];
69
- (!n || !De.has(e)) && Te(a) && (r[e] = a, i++);
69
+ (!n || !ke.has(e)) && De(a) && (r[e] = a, i++);
70
70
  }
71
71
  return i === 0 ? void 0 : r;
72
72
  });
73
73
  }
74
- function it(e) {
75
- if (typeof e != "object" || !e || Array.isArray(e) || e instanceof Error) return !1;
74
+ function ct(e) {
75
+ if (!A(e) || e instanceof Error) return !1;
76
76
  let t = Object.getPrototypeOf(e);
77
77
  return t === null || Object.getPrototypeOf(t) === null;
78
78
  }
79
- function at(e) {
80
- return et.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
79
+ function lt(e) {
80
+ return it.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
81
81
  }
82
- function F(e, t) {
82
+ function I(e, t) {
83
83
  return e === void 0 ? {} : t.guard("record.sanitize_failed", "The library could not read the payload.", () => ({ ...e })) ?? { "uiobs.sanitize_failed": !0 };
84
84
  }
85
- var I = class e {
85
+ var L = class e {
86
86
  bind;
87
87
  namespace;
88
88
  options;
89
89
  levelType;
90
90
  constructor(e, t, n = {}) {
91
- this.bind = e, this.namespace = t, this.options = n, this.levelType = at(t);
91
+ this.bind = e, this.namespace = t, this.options = n, this.levelType = lt(t);
92
92
  }
93
93
  child(t, n = {}) {
94
94
  return new e(this.bind, `${this.namespace}.${t}`, { scopedContext: {
@@ -125,22 +125,22 @@ var I = class e {
125
125
  this.bind().diagnostics.report("record.dropped_malformed", "The metric value is not a finite number. The library dropped the metric.", { "metric.name": e });
126
126
  return;
127
127
  }
128
- let a = F(i, this.bind().diagnostics), o = {
128
+ let a = I(i, this.bind().diagnostics), o = {
129
129
  ...a,
130
130
  "metric.name": e,
131
131
  "metric.value": t,
132
132
  "metric.unit": n,
133
133
  "metric.type": r,
134
- [k.attributeKeys]: Object.keys(a)
134
+ [_.attributeKeys]: Object.keys(a)
135
135
  };
136
136
  this.write("INFO", "metric", e, o, !0);
137
137
  };
138
- timeSync = (e, t, n) => Qe(this, e, t, n);
139
- timeAsync = (e, t, n) => $e(this, e, t, n);
138
+ timeSync = (e, t, n) => nt(this, e, t, n);
139
+ timeAsync = (e, t, n) => rt(this, e, t, n);
140
140
  write(e, t, n, r, i = !1) {
141
141
  let a = this.bind();
142
142
  if (a.isDestroyed()) return;
143
- if (!a.builder.isEnabled(e, t)) {
143
+ if (!a.builder.isEnabled(e, this.namespace, t)) {
144
144
  this.mirrors(a, e) && this.print(a, e, n, r, void 0, null);
145
145
  return;
146
146
  }
@@ -150,7 +150,7 @@ var I = class e {
150
150
  body: n,
151
151
  namespace: this.namespace,
152
152
  scoped: this.options.scopedContext,
153
- payload: i ? r : F(r, a.diagnostics)
153
+ payload: i ? r : I(r, a.diagnostics)
154
154
  }), c = o ? o.body : s === "sampling" ? n : void 0;
155
155
  t !== "metric" && c !== void 0 && a.breadcrumbs.push({
156
156
  t: Date.now(),
@@ -161,106 +161,237 @@ var I = class e {
161
161
  writeError(e, t, n, r) {
162
162
  let i = this.bind();
163
163
  if (i.isDestroyed()) return;
164
- let a = i.builder.isEnabled(e);
164
+ let a = i.builder.isEnabled(e, this.namespace);
165
165
  if (!a && !this.mirrors(i, e)) return;
166
- let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => it(n)) ?? !1), s = o ? n : r, c = o ? void 0 : n, l = c === void 0 ? void 0 : tt(c, i.diagnostics), u = l === void 0 ? void 0 : nt(c, l, i.diagnostics);
166
+ let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => ct(n)) ?? !1), s = o ? n : r, c = o ? void 0 : n, l = c === void 0 ? void 0 : at(c, i.diagnostics), u = l === void 0 ? void 0 : ot(c, l, i.diagnostics);
167
167
  if (!a) {
168
168
  this.print(i, e, t, s, u, null);
169
169
  return;
170
170
  }
171
- let d = l ? rt(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
171
+ let d = l ? st(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
172
172
  level: e,
173
173
  type: this.levelType,
174
174
  body: t,
175
175
  namespace: this.namespace,
176
176
  scoped: this.options.scopedContext,
177
177
  payload: {
178
- ...F(s, i.diagnostics),
178
+ ...I(s, i.diagnostics),
179
179
  ...l ? {
180
180
  "error.type": l.name,
181
181
  "error.message": l.message,
182
182
  "error.stack_trace": l.stack
183
183
  } : {},
184
- ...d === void 0 ? {} : { [ge]: d },
184
+ ...d === void 0 ? {} : { [ve]: d },
185
185
  [v]: i.breadcrumbs.snapshot()
186
186
  }
187
187
  });
188
188
  this.print(i, e, t, s, u, f, p), i.emit(f);
189
189
  }
190
190
  print(e, t, n, r, i, a, o) {
191
- e.config.redact ? a ? e.console.write(this.namespace, t, a.body, a.attributes) : o !== "redact" && o !== "malformed" && e.console.write(this.namespace, t, n, void 0, i) : e.console.write(this.namespace, t, n, r, i);
191
+ e.config.redact ? a ? e.console.write(this.namespace, t, a.body, a.attributes) : o !== "processor" && o !== "redact" && o !== "malformed" && e.console.write(this.namespace, t, n, void 0, i) : e.console.write(this.namespace, t, n, r, i);
192
192
  }
193
193
  mirrors(e, t) {
194
194
  return e.config.enabled && e.console.accepts(t);
195
195
  }
196
- }, ot = {
196
+ }, ut = "overflow", dt = /* @__PURE__ */ new Set([
197
+ b,
198
+ O,
199
+ w,
200
+ T,
201
+ D,
202
+ y,
203
+ he
204
+ ]);
205
+ function ft(e = {}) {
206
+ let t = {};
207
+ for (let n of Object.keys(e).sort()) {
208
+ if (n.startsWith("metric.") || dt.has(n)) continue;
209
+ let r = e[n];
210
+ (typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (t[n] = r);
211
+ }
212
+ return t;
213
+ }
214
+ function pt(e) {
215
+ if (!Array.isArray(e)) return null;
216
+ let t = Math.min(e.length, 51);
217
+ return Array.from({ length: t }, (t, n) => e[n]);
218
+ }
219
+ function mt(e) {
220
+ return Array.isArray(e) && e.length <= 50 && e.every((t, n) => typeof t == "number" && Number.isFinite(t) && (n === 0 || t > e[n - 1]));
221
+ }
222
+ function ht(e, t, n) {
223
+ let r = {
224
+ "metric.name": e.name,
225
+ "metric.unit": e.unit,
226
+ "metric.type": e.kind,
227
+ [_.start]: n,
228
+ [_.attributeKeys]: Object.keys(t.attributes)
229
+ };
230
+ return e.kind === "counter" ? (r["metric.value"] = t.sum, r) : {
231
+ ...r,
232
+ [_.count]: t.count,
233
+ [_.sum]: t.sum,
234
+ [_.min]: t.min,
235
+ [_.max]: t.max,
236
+ [_.bounds]: e.boundaries,
237
+ [_.buckets]: t.buckets
238
+ };
239
+ }
240
+ function gt(e, t, n) {
241
+ let r = {
242
+ name: e,
243
+ kind: "counter",
244
+ unit: t.unit ?? "count",
245
+ boundaries: []
246
+ };
247
+ return { add: (e, t) => {
248
+ n(r, e, t);
249
+ } };
250
+ }
251
+ function _t(e, t, n) {
252
+ let r = {
253
+ name: e,
254
+ kind: "histogram",
255
+ unit: t.unit ?? "count",
256
+ boundaries: t.boundaries ?? Ce
257
+ };
258
+ return { record: (e, t) => {
259
+ n(r, e, t);
260
+ } };
261
+ }
262
+ var vt = class {
263
+ intervalMs;
264
+ emit;
265
+ diagnostics;
266
+ instruments = /* @__PURE__ */ new Map();
267
+ timer = null;
268
+ startedAt = 0;
269
+ constructor(e, t, n) {
270
+ this.intervalMs = e, this.emit = t, this.diagnostics = n;
271
+ }
272
+ record(e, t, n) {
273
+ !Number.isFinite(t) || e.kind === "counter" && t < 0 ? this.diagnostics.report("record.dropped_malformed", `The value of the metric ${e.name} is not valid. The library dropped it.`, { "metric.name": e.name }) : this.diagnostics.guard("record.sanitize_failed", `The library could not read the attributes of the metric ${e.name}.`, () => {
274
+ let r = this.instrumentOf(e);
275
+ r && (this.add(r, t, ft(n)), this.arm());
276
+ });
277
+ }
278
+ collect() {
279
+ this.timer !== null && (clearTimeout(this.timer), this.timer = null);
280
+ let e = `${String(this.startedAt)}000000`, t = [...this.instruments.values()];
281
+ this.instruments.clear();
282
+ for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, ht(n, t, e));
283
+ }
284
+ instrumentOf(e) {
285
+ let t = this.instruments.get(e.name);
286
+ if (t) return t.def.kind === e.kind ? t : (this.diagnostics.report("record.dropped_malformed", `The metric ${e.name} is a counter and a histogram. The library dropped the value.`, { "metric.name": e.name }), null);
287
+ let n = pt(e.boundaries), r = mt(n);
288
+ e.kind === "histogram" && !r && this.diagnostics.report("config.invalid", `The boundaries of the metric ${e.name} must be at most 50 finite numbers in ascending order. The library uses the default boundaries.`);
289
+ let i = {
290
+ def: {
291
+ ...e,
292
+ boundaries: r ? n : [...Ce]
293
+ },
294
+ series: /* @__PURE__ */ new Map()
295
+ };
296
+ return this.instruments.set(e.name, i), i;
297
+ }
298
+ add(e, t, n) {
299
+ let r = JSON.stringify(n), i = e.series.get(r), a = n;
300
+ if (!i && e.series.size >= 100 && (r = ut, i = e.series.get(r), a = { [ce]: !0 }), !i) {
301
+ let n = e.def.kind === "histogram" ? e.def.boundaries.length + 1 : 0, o = Array(n).fill(0);
302
+ i = {
303
+ attributes: a,
304
+ count: 0,
305
+ sum: 0,
306
+ min: t,
307
+ max: t,
308
+ buckets: o
309
+ }, e.series.set(r, i);
310
+ }
311
+ if (i.count += 1, i.sum += t, i.min = Math.min(i.min, t), i.max = Math.max(i.max, t), i.buckets.length > 0) {
312
+ let n = e.def.boundaries.findIndex((e) => t <= e);
313
+ i.buckets[n === -1 ? i.buckets.length - 1 : n] += 1;
314
+ }
315
+ }
316
+ arm() {
317
+ this.timer === null && (this.startedAt = Date.now(), this.timer = setTimeout(() => {
318
+ this.collect();
319
+ }, this.intervalMs()), Me(this.timer));
320
+ }
321
+ }, yt = {
197
322
  TRACE: "debug",
198
323
  DEBUG: "debug",
199
324
  INFO: "info",
200
325
  WARN: "warn",
201
326
  ERROR: "error",
202
327
  FATAL: "error"
203
- }, st = class {
328
+ }, bt = class {
204
329
  settings;
205
330
  diagnostics;
206
331
  limits;
207
- constructor(e, n, r = t) {
208
- this.settings = e, this.diagnostics = n, this.limits = r;
332
+ constructor(e, t, n = m) {
333
+ this.settings = e, this.diagnostics = t, this.limits = n;
209
334
  }
210
335
  update(e) {
211
336
  this.settings = e;
212
337
  }
213
338
  accepts(e) {
214
- return this.settings.level === null || !Object.hasOwn(O, this.settings.level) ? !1 : O[e] >= O[this.settings.level];
339
+ return this.settings.level === null || !Object.hasOwn(E, this.settings.level) ? !1 : E[e] >= E[this.settings.level];
215
340
  }
216
341
  write(e, t, n, r, i) {
217
- if (!this.accepts(t) || typeof console > "u" || Ne()) return;
218
- let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = ot[t];
342
+ if (!this.accepts(t) || typeof console > "u" || Re()) return;
343
+ let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = yt[t];
219
344
  this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
220
345
  let c = [];
221
- i !== void 0 && c.push(i), r !== void 0 && c.push(Fe(r, this.limits, this.diagnostics)), A(() => {
346
+ i !== void 0 && c.push(i), r !== void 0 && c.push(Be(r, this.limits, this.diagnostics)), j(() => {
222
347
  console[s](a, o.namespace, e, o[t], "", n, ...c);
223
348
  });
224
349
  });
225
350
  }
226
- }, ct = class {
351
+ }, xt = class {
227
352
  value = 0;
228
353
  next() {
229
354
  return ++this.value;
230
355
  }
231
- }, lt = /^[0-9a-f]{32}$/, ut = /^[0-9a-f]{16}$/, dt = /[1-9a-f]/;
232
- function ft(e) {
233
- return lt.test(e.traceId) && dt.test(e.traceId) && ut.test(e.spanId) && dt.test(e.spanId);
356
+ }, St = /^[0-9a-f]{32}$/, Ct = /^[0-9a-f]{16}$/, wt = /[1-9a-f]/;
357
+ function Tt(e) {
358
+ return St.test(e.traceId) && wt.test(e.traceId) && Ct.test(e.spanId) && wt.test(e.spanId);
234
359
  }
235
- function pt() {
236
- return ze(16);
360
+ function Et() {
361
+ return We(16);
237
362
  }
238
- function mt() {
239
- return ze(8);
363
+ function Dt() {
364
+ return We(8);
240
365
  }
241
- function ht() {
366
+ function Ot(e) {
242
367
  return {
243
- traceId: pt(),
244
- spanId: mt(),
368
+ traceId: Et(),
369
+ spanId: Dt(),
245
370
  traceFlags: 1,
246
- startedAt: Date.now()
371
+ startedAt: Date.now(),
372
+ reason: e,
373
+ ended: !1
247
374
  };
248
375
  }
249
- function gt(e) {
376
+ function kt(e, t, n) {
377
+ return `00-${e}-${t}-${(n & 255).toString(16).padStart(2, "0")}`;
378
+ }
379
+ function At(e) {
250
380
  return {
251
381
  traceId: e.traceId,
252
382
  spanId: e.spanId,
253
383
  traceFlags: e.traceFlags
254
384
  };
255
385
  }
256
- var _t = class {
386
+ var jt = class {
257
387
  diagnostics;
258
388
  maxAgeMs;
259
389
  load;
260
- ambient = ht();
390
+ spans;
391
+ ambient = Ot("start");
261
392
  otel;
262
- constructor(e, t = be, n) {
263
- this.diagnostics = e, this.maxAgeMs = t, this.load = n;
393
+ constructor(e, t = n, r, i) {
394
+ this.diagnostics = e, this.maxAgeMs = t, this.load = r, this.spans = i;
264
395
  }
265
396
  async loadOtel() {
266
397
  if (this.load) try {
@@ -270,8 +401,10 @@ var _t = class {
270
401
  }
271
402
  }
272
403
  resolve() {
273
- let e = this.activeSpanContext();
274
- return e === void 0 ? (Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), gt(this.ambient)) : e;
404
+ return this.activeSpanContext() ?? this.ambientContext();
405
+ }
406
+ ambientContext() {
407
+ return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), At(this.ambient);
275
408
  }
276
409
  activeSpanContext() {
277
410
  let e = this.otel;
@@ -279,7 +412,7 @@ var _t = class {
279
412
  let t = e.trace.getActiveSpan();
280
413
  if (t === void 0) return;
281
414
  let n = t.spanContext();
282
- if (ft(n)) return {
415
+ if (Tt(n)) return {
283
416
  traceId: n.traceId,
284
417
  spanId: n.spanId,
285
418
  traceFlags: n.traceFlags
@@ -287,19 +420,47 @@ var _t = class {
287
420
  });
288
421
  }
289
422
  rotate(e) {
290
- return this.ambient = ht(), gt(this.ambient);
423
+ let t = this.ambient;
424
+ this.ambient = Ot(e);
425
+ let n = At(this.ambient);
426
+ return this.finish(t), n;
427
+ }
428
+ end() {
429
+ this.finish(this.ambient);
430
+ }
431
+ finish(e) {
432
+ e.ended || (e.ended = !0, this.spans?.onEnd({
433
+ traceId: e.traceId,
434
+ spanId: e.spanId,
435
+ reason: e.reason,
436
+ startedAt: e.startedAt,
437
+ endedAt: Date.now()
438
+ }));
291
439
  }
292
440
  headers() {
293
- let e = {}, t = this.otel;
294
- if (t && this.diagnostics.guard("trace.otel_failed", "The library could not add the OpenTelemetry headers.", () => {
295
- t.propagation.inject(t.context.active(), e);
296
- }), !e.traceparent) {
297
- let t = this.resolve(), n = (t.traceFlags & 255).toString(16).padStart(2, "0");
298
- e[ie] = `00-${t.traceId}-${t.spanId}-${n}`;
299
- }
300
- return e;
441
+ return this.trace(!1).headers;
442
+ }
443
+ request() {
444
+ return this.trace(!0);
445
+ }
446
+ trace(e) {
447
+ let t = {}, n = this.otel;
448
+ if (n && this.diagnostics.guard("trace.otel_failed", "The library could not add the OpenTelemetry headers.", () => {
449
+ n.propagation.inject(n.context.active(), t);
450
+ }), t.traceparent) return { headers: t };
451
+ let r = this.activeSpanContext(), i = r ?? this.ambientContext(), a = r ? void 0 : this.spans;
452
+ if (!a?.enabled()) return t[g] = kt(i.traceId, i.spanId, i.traceFlags), { headers: t };
453
+ let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ? Dt() : i.spanId;
454
+ return t[g] = kt(i.traceId, c, s), !e || !o ? { headers: t } : {
455
+ headers: t,
456
+ span: {
457
+ traceId: i.traceId,
458
+ spanId: c,
459
+ parentSpanId: i.spanId
460
+ }
461
+ };
301
462
  }
302
- }, vt = class {
463
+ }, Mt = class {
303
464
  buffer;
304
465
  pointer = 0;
305
466
  filled = !1;
@@ -310,51 +471,51 @@ var _t = class {
310
471
  push(e) {
311
472
  this.buffer[this.pointer] = e, this.pointer = (this.pointer + 1) % this.capacity, this.pointer === 0 && (this.filled = !0);
312
473
  }
474
+ clear() {
475
+ this.buffer.fill(void 0), this.pointer = 0, this.filled = !1;
476
+ }
313
477
  snapshot() {
314
478
  return (this.filled ? [...this.buffer.slice(this.pointer), ...this.buffer.slice(0, this.pointer)] : this.buffer.slice(0, this.pointer)).filter((e) => e !== void 0);
315
479
  }
316
- clear() {
317
- this.buffer = Array(this.capacity), this.pointer = 0, this.filled = !1;
318
- }
319
- }, yt = Object.keys(O), bt = ["gzip", "none"], xt = [
480
+ }, Nt = Object.keys(E), Pt = ["gzip", "none"], Ft = [
320
481
  "omit",
321
482
  "same-origin",
322
483
  "include"
323
- ], St = [
484
+ ], It = [
324
485
  "auto",
325
486
  "indexeddb",
326
487
  "localstorage",
327
488
  "memory",
328
489
  "none"
329
- ], Ct = ["storage", "memory"], wt = [
490
+ ], Lt = ["storage", "memory"], Rt = [
330
491
  "auto",
331
492
  "sender",
332
493
  "forwarder",
333
494
  "off"
334
- ], Tt = [
495
+ ], zt = [
335
496
  "auto",
336
497
  "provider",
337
498
  "client"
338
- ], Et = [
499
+ ], Bt = [
339
500
  "auto",
340
501
  "context",
341
502
  "tab",
342
503
  "origin"
343
- ], Dt = [
504
+ ], Vt = [
344
505
  "error",
345
506
  "warn",
346
507
  "info",
347
508
  "log"
348
- ], Ot = ["limited", "until-delivered"], kt = {
509
+ ], Ht = ["limited", "until-delivered"], Ut = {
349
510
  logFlushIntervalMs: [100, 6e4],
350
511
  logBatchSize: [1, 1e3],
351
512
  metricFlushIntervalMs: [100, 6e4],
352
513
  metricBatchSize: [1, 1e3]
353
- }, At = {
514
+ }, Wt = {
354
515
  maxBatches: [1, 5e3],
355
516
  maxAgeMs: [6e4, 6048e5],
356
517
  maxAttempts: [1, 20]
357
- }, jt = {
518
+ }, Gt = {
358
519
  maxBodyChars: [256, 65536],
359
520
  maxAttributeChars: [256, 65536],
360
521
  maxAttributeCount: [1, 1024],
@@ -362,8 +523,8 @@ var _t = class {
362
523
  maxDepth: [1, 16],
363
524
  maxArrayLength: [1, 1e4],
364
525
  maxNodes: [100, 1e5],
365
- maxRecordBytes: [1024, g]
366
- }, Mt = [6e4, 864e5], Nt = [
526
+ maxRecordBytes: [1024, h]
527
+ }, Kt = [6e4, 864e5], qt = [
367
528
  "errors",
368
529
  "rejections",
369
530
  "resourceErrors",
@@ -374,102 +535,119 @@ var _t = class {
374
535
  "navigation",
375
536
  "webVitals",
376
537
  "longFrames",
377
- "fullUrls"
378
- ], Pt = "null", L = `a level name: ${R(yt)}`, Ft = `true, false or a list of ${R(Dt)}`, It = "a list of strings and RegExp patterns", Lt = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", Rt = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", zt = "a list of strings";
379
- function R(e) {
538
+ "fullUrls",
539
+ "webSocket"
540
+ ], Jt = "null", R = `a level name: ${z(Nt)}`, Yt = `true, false or a list of ${z(Vt)}`, Xt = "a list of strings and RegExp patterns", Zt = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", Qt = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", $t = "a list of strings";
541
+ function z(e) {
380
542
  let t = e.map((e) => `"${e}"`);
381
543
  return `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
382
544
  }
383
- function Bt(e) {
545
+ function en(e) {
384
546
  return typeof e == "string" ? `"${e}"` : typeof e == "function" ? "a function" : typeof e == "object" && e ? "an object" : String(e);
385
547
  }
386
- function z(e, t, n, r, i) {
387
- e.report("config.invalid", `${t} must be ${n}. The value is ${Bt(r)}. The library keeps ${i}.`);
388
- }
389
548
  function B(e, t, n, r, i) {
549
+ e.report("config.invalid", `${t} must be ${n}. The value is ${en(r)}. The library keeps ${i}.`);
550
+ }
551
+ function V(e, t, n, r, i) {
390
552
  if (t === void 0) return r;
391
553
  let a = n.find((e) => e === t);
392
- return a === void 0 ? (z(i, e, R(n), t, `"${r}"`), r) : a;
554
+ return a === void 0 ? (B(i, e, z(n), t, `"${r}"`), r) : a;
393
555
  }
394
- function V(e, t, n, r) {
395
- return t === void 0 ? n : typeof t == "boolean" ? t : (z(r, e, "true or false", t, String(n)), n);
556
+ function H(e, t, n, r) {
557
+ return t === void 0 ? n : typeof t == "boolean" ? t : (B(r, e, "true or false", t, String(n)), n);
396
558
  }
397
- function Vt(e, t, n, r) {
398
- return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (z(r, e, "a finite number of 0 or more", t, String(n)), n);
559
+ function tn(e, t, n, r) {
560
+ return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (B(r, e, "a finite number of 0 or more", t, String(n)), n);
399
561
  }
400
- function Ht(e, t, n, r, i) {
562
+ function nn(e, t, n, r, i) {
401
563
  if (t === void 0) return r;
402
564
  let [a, o] = n;
403
- return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (z(i, e, `an integer from ${String(a)} to ${String(o)}`, t, String(r)), r);
565
+ return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (B(i, e, `an integer from ${String(a)} to ${String(o)}`, t, String(r)), r);
404
566
  }
405
- function H(e, t, n, r, i) {
567
+ function U(e, t, n, r, i) {
406
568
  let a = t ?? {}, o = Object.keys(r);
407
- return Object.fromEntries(o.map((t) => [t, Ht(`${e}.${t}`, a[t], r[t], n[t], i)]));
569
+ return Object.fromEntries(o.map((t) => [t, nn(`${e}.${t}`, a[t], r[t], n[t], i)]));
408
570
  }
409
- function U(e) {
571
+ function W(e) {
410
572
  if (typeof e != "string") return;
411
573
  let t = e.toUpperCase();
412
- return yt.find((e) => e === t);
574
+ return Nt.find((e) => e === t);
413
575
  }
414
- function Ut(e, t, n, r) {
576
+ function rn(e, t, n, r) {
415
577
  if (t === void 0) return n;
416
- let i = U(t);
417
- return i === void 0 ? (z(r, e, L, t, `"${n}"`), n) : i;
578
+ let i = W(t);
579
+ return i === void 0 ? (B(r, e, R, t, `"${n}"`), n) : i;
418
580
  }
419
- function W(e, t, n, r, i, a) {
581
+ function an(e, t, n) {
582
+ if (e === void 0) return t;
583
+ if (!A(e)) return B(n, "minLevels", "an object of level names", e, "the value in force"), t;
584
+ let r = [];
585
+ for (let [t, i] of Object.entries(e)) {
586
+ let e = W(i);
587
+ t !== "" && e !== void 0 ? r.push([t, e]) : B(n, `minLevels["${t}"]`, R, i, "minLevel for it");
588
+ }
589
+ return Object.fromEntries(r);
590
+ }
591
+ function G(e, t, n, r, i, a) {
420
592
  if (t === void 0) return n;
421
- if (!Array.isArray(t)) return z(a, e, r, t, "the list in force"), n;
593
+ if (!Array.isArray(t)) return B(a, e, r, t, "the list in force"), n;
422
594
  let o = [], s = t;
423
595
  for (let t of s) {
424
596
  let n = i(t);
425
- n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${Bt(t)}. ${e} must be ${r}.`) : o.push(n);
597
+ n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${en(t)}. ${e} must be ${r}.`) : o.push(n);
426
598
  }
427
599
  return o;
428
600
  }
429
- function Wt(e) {
601
+ function on(e) {
602
+ return typeof e == "function" ? e : void 0;
603
+ }
604
+ function sn(e) {
605
+ return A(e) && typeof e.name == "string" && e.name !== "" && typeof e.install == "function" && typeof e.uninstall == "function" ? e : void 0;
606
+ }
607
+ function cn(e) {
430
608
  return typeof e == "string" ? e : void 0;
431
609
  }
432
- function Gt(e) {
610
+ function ln(e) {
433
611
  return typeof e == "string" || e instanceof RegExp ? e : void 0;
434
612
  }
435
- function Kt(e) {
436
- return Dt.find((t) => t === e);
613
+ function un(e) {
614
+ return Vt.find((t) => t === e);
437
615
  }
438
- function qt(e) {
616
+ function dn(e) {
439
617
  if (typeof e == "string") try {
440
618
  let { origin: t } = new URL(e);
441
- return t === Pt ? void 0 : t;
619
+ return t === Jt ? void 0 : t;
442
620
  } catch {
443
621
  return;
444
622
  }
445
623
  }
446
- function Jt(e) {
447
- return e instanceof RegExp ? e : qt(e);
624
+ function fn(e) {
625
+ return e instanceof RegExp ? e : dn(e);
448
626
  }
449
- function Yt(e) {
450
- return typeof e != "object" || !e || Array.isArray(e) ? !1 : Object.values(e).every((e) => typeof e == "string");
627
+ function pn(e) {
628
+ return A(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
451
629
  }
452
- function Xt(e, t, n) {
453
- if (e !== void 0) return typeof e == "function" || Yt(e) ? e : (z(n, "headers", "an object of strings or a function", e, "the headers in force"), t);
630
+ function mn(e, t, n) {
631
+ if (e !== void 0) return typeof e == "function" || pn(e) ? e : (B(n, "headers", "an object of strings or a function", e, "the headers in force"), t);
454
632
  }
455
- function Zt(e) {
633
+ function hn(e) {
456
634
  return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
457
635
  }
458
- function Qt(e, t, n) {
459
- return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || Zt(e) ? e : (n.report("config.invalid", `serializer must be "${x}", "ecs" or an implementation. The library uses "${x}".`), x);
636
+ function gn(e, t, n) {
637
+ return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || hn(e) ? e : (n.report("config.invalid", `serializer must be "${x}", "ecs" or an implementation. The library uses "${x}".`), x);
460
638
  }
461
- var $t = new Set(Object.keys(de));
462
- function en(e, t) {
639
+ var _n = new Set(Object.keys(pe));
640
+ function vn(e, t) {
463
641
  let n = {}, r = Object.entries(e ?? {});
464
- for (let [e, i] of r) $t.has(e) ? typeof i == "string" ? n[e] = i : t.report("config.invalid", `console.styles.${e} must be a string. The library keeps the style in force.`) : t.report("config.invalid", `The library ignores the unknown console.styles key "${e}". Check the spelling.`);
642
+ for (let [e, i] of r) _n.has(e) ? typeof i == "string" ? n[e] = i : t.report("config.invalid", `console.styles.${e} must be a string. The library keeps the style in force.`) : t.report("config.invalid", `The library ignores the unknown console.styles key "${e}". Check the spelling.`);
465
643
  return n;
466
644
  }
467
- function tn(e, t, n) {
645
+ function yn(e, t, n) {
468
646
  if (e === void 0) return t ?? "DEBUG";
469
- let r = U(e);
470
- return r === void 0 ? (z(n, "console.level", L, e, "the console level in force"), t) : r;
647
+ let r = W(e);
648
+ return r === void 0 ? (B(n, "console.level", R, e, "the console level in force"), t) : r;
471
649
  }
472
- function nn(t, n, r) {
650
+ function bn(t, n, r) {
473
651
  if (t === void 0) return n;
474
652
  if (t === !1) return {
475
653
  level: null,
@@ -480,21 +658,21 @@ function nn(t, n, r) {
480
658
  styles: n.styles
481
659
  };
482
660
  if (typeof t == "string") {
483
- let e = U(t);
484
- return e === void 0 ? (z(r, "console", L, t, "the console level in force"), n) : {
661
+ let e = W(t);
662
+ return e === void 0 ? (B(r, "console", R, t, "the console level in force"), n) : {
485
663
  level: e,
486
664
  styles: n.styles
487
665
  };
488
666
  }
489
667
  return typeof t != "object" || !t ? (r.report("config.invalid", "console must be a boolean, a level or an object. The console settings in force stay."), n) : {
490
- level: tn(t.level, n.level, r),
668
+ level: yn(t.level, n.level, r),
491
669
  styles: {
492
670
  ...n.styles,
493
- ...en(t.styles, r)
671
+ ...vn(t.styles, r)
494
672
  }
495
673
  };
496
674
  }
497
- function rn(e, t, n) {
675
+ function xn(e, t, n) {
498
676
  let r = e ?? {};
499
677
  return {
500
678
  ...t,
@@ -503,113 +681,126 @@ function rn(e, t, n) {
503
681
  ...t.rates,
504
682
  ...r.rates
505
683
  },
506
- alwaysSampleTypes: W("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, zt, Wt, n),
507
- remote: V("sampling.remote", r.remote, t.remote, n)
684
+ alwaysSampleTypes: G("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, $t, cn, n),
685
+ remote: H("sampling.remote", r.remote, t.remote, n)
508
686
  };
509
687
  }
510
- function an(e, t, n) {
688
+ function Sn(e, t, n) {
511
689
  let r = e ?? {};
512
690
  return {
513
- mode: B("bus.mode", r.mode, wt, t.mode, n),
514
- trustedOrigins: W("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, Rt, qt, n),
515
- openFinRole: B("bus.openFinRole", r.openFinRole, Tt, t.openFinRole, n)
691
+ mode: V("bus.mode", r.mode, Rt, t.mode, n),
692
+ trustedOrigins: G("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, Qt, dn, n),
693
+ openFinRole: V("bus.openFinRole", r.openFinRole, zt, t.openFinRole, n)
516
694
  };
517
695
  }
518
- function on(e, t, n) {
696
+ function Cn(e, t, n) {
519
697
  let r = e ?? {};
520
698
  return {
521
- scope: B("journey.scope", r.scope, Et, t.scope, n),
522
- maxAgeMs: Ht("journey.maxAgeMs", r.maxAgeMs, Mt, t.maxAgeMs, n)
699
+ scope: V("journey.scope", r.scope, Bt, t.scope, n),
700
+ maxAgeMs: nn("journey.maxAgeMs", r.maxAgeMs, Kt, t.maxAgeMs, n)
523
701
  };
524
702
  }
525
- function sn(e, t, n) {
703
+ function wn(e, t, n) {
526
704
  let r = e ?? {};
527
705
  return {
528
- mode: B("retention.mode", r.mode, Ot, t.mode, n),
529
- ...H("retention", r, t, At, n)
706
+ mode: V("retention.mode", r.mode, Ht, t.mode, n),
707
+ ...U("retention", r, t, Wt, n)
530
708
  };
531
709
  }
532
- function cn(e, t, n) {
533
- return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? W("capture.console", e, [], Ft, Kt, n) : (z(n, "capture.console", Ft, e, "the value in force"), t);
710
+ function Tn(e, t, n) {
711
+ return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? G("capture.console", e, [], Yt, un, n) : (B(n, "capture.console", Yt, e, "the value in force"), t);
534
712
  }
535
- function ln(e, t, n) {
713
+ function En(e, t, n) {
536
714
  let r = e ?? {}, i = {
537
715
  ...t,
538
716
  ...r,
539
- console: cn(r.console, t.console, n),
540
- longFrameThresholdMs: Vt("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
541
- ignoreUrls: W("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, It, Gt, n),
542
- propagateTraceHeaderTo: W("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, Lt, Jt, n)
717
+ console: Tn(r.console, t.console, n),
718
+ longFrameThresholdMs: tn("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
719
+ ignoreUrls: G("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, Xt, ln, n),
720
+ propagateTraceHeaderTo: G("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, Zt, fn, n),
721
+ plugins: G("capture.plugins", r.plugins, t.plugins, "a list of objects with a name, install() and uninstall()", sn, n)
543
722
  };
544
- for (let e of Nt) i[e] = V(`capture.${e}`, r[e], t[e], n);
723
+ for (let e of qt) i[e] = H(`capture.${e}`, r[e], t[e], n);
545
724
  return i;
546
725
  }
547
- function un(e, t, n, r) {
548
- let i = t;
549
- if (typeof e == "string" && e !== "") try {
550
- new URL(e), i = e;
551
- } catch (t) {
552
- r.report("config.invalid", `metricsEndpoint is not a valid absolute URL: ${e}. The library keeps the value in force.`, void 0, t);
726
+ var Dn = {
727
+ metricsEndpoint: "The library sends metric records as log records.",
728
+ tracesEndpoint: "The library sends no span."
729
+ };
730
+ function On(e, t, n, r, i) {
731
+ let a = n;
732
+ if (typeof t == "string" && t !== "") try {
733
+ new URL(t), a = t;
734
+ } catch (n) {
735
+ i.report("config.invalid", `${e} is not a valid absolute URL: ${t}. The library keeps the value in force.`, void 0, n);
553
736
  }
554
- else e === "" ? i = "" : e !== void 0 && z(r, "metricsEndpoint", "a URL string", e, "the value in force");
555
- return i !== "" && n !== "otlp" ? (r.report("config.invalid", `metricsEndpoint needs serializer "${x}". The library sends metric records as log records.`), "") : i;
737
+ else t === "" ? a = "" : t !== void 0 && B(i, e, "a URL string", t, "the value in force");
738
+ return a !== "" && r !== "otlp" ? (i.report("config.invalid", `${e} needs serializer "${x}". ${Dn[e]}`), "") : a;
556
739
  }
557
- function dn(e, t, n) {
558
- let i = n ?? a, o = {
559
- ...i,
740
+ function kn(e, t, n) {
741
+ let r = n ?? o, i = {
742
+ ...r,
560
743
  ...e,
561
- endpoint: e.endpoint === void 0 ? i.endpoint : e.endpoint,
562
- enabled: V("enabled", e.enabled, i.enabled, t),
563
- minLevel: Ut("minLevel", e.minLevel, i.minLevel, t),
564
- compression: B("compression", e.compression, bt, i.compression, t),
565
- credentials: B("credentials", e.credentials, xt, i.credentials, t),
566
- headers: "headers" in e ? Xt(e.headers, i.headers, t) : i.headers,
567
- storage: B("storage", e.storage, St, i.storage, t),
568
- identity: B("identity", e.identity, Ct, i.identity, t),
569
- serializer: Qt(e.serializer, n?.serializer, t),
570
- console: nn(e.console, i.console, t),
571
- sampling: rn(e.sampling, i.sampling, t),
572
- bus: an(e.bus, i.bus, t),
573
- batching: H("batching", e.batching, i.batching, kt, t),
574
- retention: sn(e.retention, i.retention, t),
575
- limits: H("limits", e.limits, i.limits, jt, t),
576
- journey: on(e.journey, i.journey, t),
577
- capture: ln(e.capture, i.capture, t)
744
+ endpoint: e.endpoint === void 0 ? r.endpoint : e.endpoint,
745
+ enabled: H("enabled", e.enabled, r.enabled, t),
746
+ minLevel: rn("minLevel", e.minLevel, r.minLevel, t),
747
+ minLevels: an(e.minLevels, r.minLevels, t),
748
+ processors: G("processors", e.processors, r.processors, "a list of functions", on, t),
749
+ compression: V("compression", e.compression, Pt, r.compression, t),
750
+ credentials: V("credentials", e.credentials, Ft, r.credentials, t),
751
+ headers: "headers" in e ? mn(e.headers, r.headers, t) : r.headers,
752
+ storage: V("storage", e.storage, It, r.storage, t),
753
+ identity: V("identity", e.identity, Lt, r.identity, t),
754
+ serializer: gn(e.serializer, n?.serializer, t),
755
+ console: bn(e.console, r.console, t),
756
+ sampling: xn(e.sampling, r.sampling, t),
757
+ bus: Sn(e.bus, r.bus, t),
758
+ batching: U("batching", e.batching, r.batching, Ut, t),
759
+ retention: wn(e.retention, r.retention, t),
760
+ limits: U("limits", e.limits, r.limits, Gt, t),
761
+ journey: Cn(e.journey, r.journey, t),
762
+ capture: En(e.capture, r.capture, t)
578
763
  };
579
- if (o.metricsEndpoint = un(e.metricsEndpoint, i.metricsEndpoint, o.serializer, t), o.transport !== void 0 && typeof o.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), o.transport = i.transport), o.onDrop !== void 0 && typeof o.onDrop != "function" && (t.report("config.invalid", "onDrop must be a function. The library ignores the value."), o.onDrop = i.onDrop), o.transportOnExit !== void 0 && typeof o.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), o.transportOnExit = i.transportOnExit), o.endpoint === "") o.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
580
- else if (o.endpoint !== null) try {
581
- new URL(o.endpoint);
764
+ for (let n of ["metricsEndpoint", "tracesEndpoint"]) i[n] = On(n, e[n], r[n], i.serializer, t);
765
+ if (i.transport !== void 0 && typeof i.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), i.transport = r.transport), i.onDrop !== void 0 && typeof i.onDrop != "function" && (t.report("config.invalid", "onDrop must be a function. The library ignores the value."), i.onDrop = r.onDrop), i.contextProvider !== void 0 && typeof i.contextProvider != "function" && (t.report("config.invalid", "contextProvider must be a function. The library ignores the value."), i.contextProvider = r.contextProvider), i.transportOnExit !== void 0 && typeof i.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), i.transportOnExit = r.transportOnExit), i.endpoint === "") i.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
766
+ else if (i.endpoint !== null) try {
767
+ new URL(i.endpoint);
582
768
  } catch (e) {
583
- t.report("config.invalid", `endpoint is not a valid absolute URL: ${o.endpoint}.`, void 0, e);
584
- }
585
- o.metricsEndpoint !== "" && o.endpoint === null && !o.transport && t.report("config.invalid", "metricsEndpoint needs endpoint or transport. The library sends nothing to metricsEndpoint."), o.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${r}'.`), r);
586
- let s = o.sampling.defaultRate;
587
- (typeof s != "number" || s < 0 || s > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1. The value is ${String(s)}. The library uses 1.`), o.sampling.defaultRate = 1);
588
- let c = o.sampling.remoteMaxRate;
589
- (typeof c != "number" || !(c >= 0 && c <= 1)) && (t.report("config.invalid", `sampling.remoteMaxRate must be 0..1. The value is ${String(c)}. The library uses 1.`), o.sampling.remoteMaxRate = 1);
590
- let l = Object.entries(o.sampling.rates);
591
- for (let [e, n] of l) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1. The value is ${String(n)}. The library uses 1.`), o.sampling.rates[e] = 1);
592
- o.capture.ignoreUrls = o.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint);
593
- for (let e of [o.endpoint, o.metricsEndpoint]) e && !o.capture.ignoreUrls.includes(e) && (o.capture.ignoreUrls = [...o.capture.ignoreUrls, e]);
594
- return fn(e, t), o;
595
- }
596
- function fn(e, t) {
597
- let n = /* @__PURE__ */ new Set([...Object.keys(a), ...xe]);
769
+ t.report("config.invalid", `endpoint is not a valid absolute URL: ${i.endpoint}.`, void 0, e);
770
+ }
771
+ for (let e of ["metricsEndpoint", "tracesEndpoint"]) i[e] !== "" && i.endpoint === null && !i.transport && t.report("config.invalid", `${e} needs endpoint or transport. The library sends nothing to ${e}.`);
772
+ i.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${me}'.`), me);
773
+ let a = i.sampling.defaultRate;
774
+ (typeof a != "number" || a < 0 || a > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1. The value is ${String(a)}. The library uses 1.`), i.sampling.defaultRate = 1);
775
+ let s = i.sampling.remoteMaxRate;
776
+ (typeof s != "number" || !(s >= 0 && s <= 1)) && (t.report("config.invalid", `sampling.remoteMaxRate must be 0..1. The value is ${String(s)}. The library uses 1.`), i.sampling.remoteMaxRate = 1);
777
+ let c = Object.entries(i.sampling.rates);
778
+ for (let [e, n] of c) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1. The value is ${String(n)}. The library uses 1.`), i.sampling.rates[e] = 1);
779
+ i.capture.ignoreUrls = i.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint && e !== n?.tracesEndpoint);
780
+ for (let e of [
781
+ i.endpoint,
782
+ i.metricsEndpoint,
783
+ i.tracesEndpoint
784
+ ]) e && !i.capture.ignoreUrls.includes(e) && (i.capture.ignoreUrls = [...i.capture.ignoreUrls, e]);
785
+ return An(e, t), i;
786
+ }
787
+ function An(e, t) {
788
+ let n = /* @__PURE__ */ new Set([...Object.keys(o), ...a]);
598
789
  for (let r of Object.keys(e)) n.has(r) || t.report("config.invalid", `The library ignores the unknown config key "${r}". Check the spelling.`);
599
- for (let n of C) {
790
+ for (let n of S) {
600
791
  let r = e[n];
601
792
  if (typeof r != "object" || !r) continue;
602
- let i = /* @__PURE__ */ new Set([...Object.keys(a[n]), ..._[n]]);
793
+ let i = /* @__PURE__ */ new Set([...Object.keys(o[n]), ...p[n]]);
603
794
  for (let e of Object.keys(r)) i.has(e) || t.report("config.invalid", `The library ignores the unknown config key "${n}.${e}". Check the spelling.`);
604
795
  }
605
796
  }
606
- function pn(e, t) {
607
- for (let n of Object.keys(t)) C.includes(n) || Object.assign(e, { [n]: t[n] });
608
- for (let n of C) Object.assign(e[n], t[n]);
797
+ function jn(e, t) {
798
+ for (let n of Object.keys(t)) S.includes(n) || Object.assign(e, { [n]: t[n] });
799
+ for (let n of S) Object.assign(e[n], t[n]);
609
800
  }
610
801
  //#endregion
611
802
  //#region src/core/context.ts
612
- var mn = class {
803
+ var Mn = class {
613
804
  map = /* @__PURE__ */ new Map();
614
805
  set(e, t) {
615
806
  this.map.set(e, t);
@@ -617,19 +808,13 @@ var mn = class {
617
808
  setMany(e) {
618
809
  for (let [t, n] of Object.entries(e)) this.map.set(t, n);
619
810
  }
620
- get(e) {
621
- return this.map.get(e);
622
- }
623
811
  remove(e) {
624
812
  this.map.delete(e);
625
813
  }
626
- clear() {
627
- this.map.clear();
628
- }
629
814
  getAll() {
630
815
  return Object.fromEntries(this.map);
631
816
  }
632
- }, hn = class {
817
+ }, Nn = class {
633
818
  handler;
634
819
  throttleMs;
635
820
  counters = /* @__PURE__ */ new Map();
@@ -657,12 +842,12 @@ var mn = class {
657
842
  count: i
658
843
  }, { handler: s } = this;
659
844
  if (s) try {
660
- A(() => {
845
+ j(() => {
661
846
  s(o);
662
847
  });
663
848
  } catch (e) {
664
- this.count("handler.threw"), typeof console < "u" && A(() => {
665
- console.warn(`${se} The onDiagnostic handler threw an error.`, e);
849
+ this.count("handler.threw"), typeof console < "u" && j(() => {
850
+ console.warn(`${de} The onDiagnostic handler threw an error.`, e);
666
851
  });
667
852
  }
668
853
  }
@@ -685,16 +870,13 @@ var mn = class {
685
870
  snapshot() {
686
871
  return Object.fromEntries(this.counters);
687
872
  }
688
- reset() {
689
- this.counters.clear(), this.lastEmitted.clear();
690
- }
691
873
  };
692
874
  //#endregion
693
875
  //#region src/core/drops.ts
694
- function G(e, t) {
876
+ function K(e, t) {
695
877
  e.length < 20 && !e.includes(t) && e.push(t);
696
878
  }
697
- var gn = class {
879
+ var Pn = class {
698
880
  config;
699
881
  diagnostics;
700
882
  pending = /* @__PURE__ */ new Map();
@@ -713,12 +895,12 @@ var gn = class {
713
895
  journeyIds: [],
714
896
  actions: []
715
897
  }, this.pending.set(e, r)), r.records += t.length;
716
- for (let e of n) G(r.batchIds, e);
898
+ for (let e of n) K(r.batchIds, e);
717
899
  for (let e of t) {
718
- let t = Ke(e, E);
719
- typeof t == "string" && G(r.journeyIds, t);
720
- let n = M(e) ? e.body : void 0;
721
- typeof n == "string" && G(r.actions, n);
900
+ let t = Qe(e, D);
901
+ typeof t == "string" && K(r.journeyIds, t);
902
+ let n = N(e) ? e.body : void 0;
903
+ typeof n == "string" && K(r.actions, n);
722
904
  }
723
905
  this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
724
906
  this.flush();
@@ -732,8 +914,8 @@ var gn = class {
732
914
  if (t) {
733
915
  this.reporting = !0;
734
916
  for (let n of e) this.diagnostics.guard("handler.threw", "The onDrop hook threw an error.", () => {
735
- qe(() => {
736
- A(() => {
917
+ Je(() => {
918
+ j(() => {
737
919
  t(n);
738
920
  });
739
921
  });
@@ -741,7 +923,7 @@ var gn = class {
741
923
  this.reporting = !1;
742
924
  }
743
925
  }
744
- }, _n = class {
926
+ }, Fn = class {
745
927
  onDrop;
746
928
  held = [];
747
929
  actions = 0;
@@ -755,10 +937,10 @@ var gn = class {
755
937
  return this.held.length;
756
938
  }
757
939
  push(e) {
758
- let t = M(e);
940
+ let t = N(e);
759
941
  if ((t ? this.actions : this.held.length - this.actions) < (t ? 2e3 : 500)) this.actions += +!!t;
760
942
  else {
761
- let e = this.held.findIndex((e) => M(e) === t), [n] = this.held.splice(e, 1);
943
+ let e = this.held.findIndex((e) => N(e) === t), [n] = this.held.splice(e, 1);
762
944
  this.onDrop(n);
763
945
  }
764
946
  this.held.push(e);
@@ -767,118 +949,34 @@ var gn = class {
767
949
  let e = this.held;
768
950
  return this.held = [], this.actions = 0, e;
769
951
  }
770
- }, vn = "overflow", yn = /* @__PURE__ */ new Set([
771
- b,
772
- D,
773
- w,
774
- T,
775
- E,
776
- y,
777
- fe
778
- ]);
779
- function bn(e = {}) {
780
- let t = {};
781
- for (let n of Object.keys(e).sort()) {
782
- if (n.startsWith("metric.") || yn.has(n)) continue;
783
- let r = e[n];
784
- (typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (t[n] = r);
785
- }
786
- return t;
787
- }
788
- function xn(e) {
789
- if (!Array.isArray(e)) return null;
790
- let t = Math.min(e.length, 51);
791
- return Array.from({ length: t }, (t, n) => e[n]);
792
- }
793
- function Sn(e) {
794
- return Array.isArray(e) && e.length <= 50 && e.every((t, n) => typeof t == "number" && Number.isFinite(t) && (n === 0 || t > e[n - 1]));
795
- }
796
- function Cn(e, t, n) {
797
- let r = {
798
- "metric.name": e.name,
799
- "metric.unit": e.unit,
800
- "metric.type": e.kind,
801
- [k.start]: n,
802
- [k.attributeKeys]: Object.keys(t.attributes)
803
- };
804
- return e.kind === "counter" ? (r["metric.value"] = t.sum, r) : {
805
- ...r,
806
- [k.count]: t.count,
807
- [k.sum]: t.sum,
808
- [k.min]: t.min,
809
- [k.max]: t.max,
810
- [k.bounds]: e.boundaries,
811
- [k.buckets]: t.buckets
812
- };
813
- }
814
- var wn = class {
815
- intervalMs;
816
- emit;
817
- diagnostics;
818
- instruments = /* @__PURE__ */ new Map();
819
- timer = null;
820
- startedAt = 0;
821
- constructor(e, t, n) {
822
- this.intervalMs = e, this.emit = t, this.diagnostics = n;
823
- }
824
- record(e, t, n) {
825
- !Number.isFinite(t) || e.kind === "counter" && t < 0 ? this.diagnostics.report("record.dropped_malformed", `The value of the metric ${e.name} is not valid. The library dropped it.`, { "metric.name": e.name }) : this.diagnostics.guard("record.sanitize_failed", `The library could not read the attributes of the metric ${e.name}.`, () => {
826
- let r = this.instrumentOf(e);
827
- r && (this.add(r, t, bn(n)), this.arm());
828
- });
829
- }
830
- collect() {
831
- this.timer !== null && (clearTimeout(this.timer), this.timer = null);
832
- let e = `${String(this.startedAt)}000000`, t = [...this.instruments.values()];
833
- this.instruments.clear();
834
- for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, Cn(n, t, e));
835
- }
836
- instrumentOf(e) {
837
- let t = this.instruments.get(e.name);
838
- if (t) return t.def.kind === e.kind ? t : (this.diagnostics.report("record.dropped_malformed", `The metric ${e.name} is a counter and a histogram. The library dropped the value.`, { "metric.name": e.name }), null);
839
- let n = xn(e.boundaries), r = Sn(n);
840
- e.kind === "histogram" && !r && this.diagnostics.report("config.invalid", `The boundaries of the metric ${e.name} must be at most 50 finite numbers in ascending order. The library uses the default boundaries.`);
841
- let i = {
842
- def: {
843
- ...e,
844
- boundaries: r ? n : [...ae]
845
- },
846
- series: /* @__PURE__ */ new Map()
847
- };
848
- return this.instruments.set(e.name, i), i;
849
- }
850
- add(e, t, n) {
851
- let r = JSON.stringify(n), i = e.series.get(r), a = n;
852
- if (!i && e.series.size >= 100 && (r = vn, i = e.series.get(r), a = { [oe]: !0 }), !i) {
853
- let n = e.def.kind === "histogram" ? e.def.boundaries.length + 1 : 0, o = Array(n).fill(0);
854
- i = {
855
- attributes: a,
856
- count: 0,
857
- sum: 0,
858
- min: t,
859
- max: t,
860
- buckets: o
861
- }, e.series.set(r, i);
862
- }
863
- if (i.count += 1, i.sum += t, i.min = Math.min(i.min, t), i.max = Math.max(i.max, t), i.buckets.length > 0) {
864
- let n = e.def.boundaries.findIndex((e) => t <= e);
865
- i.buckets[n === -1 ? i.buckets.length - 1 : n] += 1;
866
- }
867
- }
868
- arm() {
869
- this.timer === null && (this.startedAt = Date.now(), this.timer = setTimeout(() => {
870
- this.collect();
871
- }, this.intervalMs()), Je(this.timer));
872
- }
873
- }, Tn = "error.", En = [
952
+ }, In = "error.", Ln = [
874
953
  T,
875
- E,
954
+ D,
876
955
  y
956
+ ], Rn = {
957
+ processor: {
958
+ label: "A processor",
959
+ code: "record.dropped_by_processor"
960
+ },
961
+ redact: {
962
+ label: "The redact hook",
963
+ code: "record.dropped_by_redact"
964
+ }
965
+ }, zn = [
966
+ "metric.name",
967
+ "metric.unit",
968
+ "metric.type",
969
+ "metric.value",
970
+ ...Object.values(_),
971
+ ...Object.values(C)
877
972
  ];
878
- function K(e) {
973
+ function Bn(e) {
974
+ return Object.fromEntries(zn.filter((t) => t in e).map((t) => [t, e[t]]));
975
+ }
976
+ function q(e) {
879
977
  return e;
880
978
  }
881
- var Dn = class {
979
+ var Vn = class {
882
980
  deps;
883
981
  resourceCache = null;
884
982
  constructor(e) {
@@ -887,21 +985,21 @@ var Dn = class {
887
985
  invalidateResource() {
888
986
  this.resourceCache = null;
889
987
  }
890
- isEnabled(e, t) {
891
- let { config: n } = this.deps;
892
- if (!n.enabled) return !1;
893
- if (t !== void 0 && pe.includes(t)) return !0;
894
- let r = this.deps.remote.sampling?.minLevel() ?? n.minLevel;
895
- return O[e] >= O[r];
988
+ isEnabled(e, t, n) {
989
+ let { config: r } = this.deps;
990
+ if (!r.enabled) return !1;
991
+ if (n !== void 0 && ue.includes(n)) return !0;
992
+ let i = this.deps.remote.sampling?.minLevelFor(t) ?? Ne(t, r);
993
+ return E[e] >= E[i];
896
994
  }
897
995
  build(e) {
898
996
  let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a, limits: o, remote: s } = this.deps;
899
- if (!this.isEnabled(e.level, e.type)) return n.count("record.dropped_by_level"), {
997
+ if (!this.isEnabled(e.level, e.namespace, e.type)) return n.count("record.dropped_by_level"), {
900
998
  record: null,
901
999
  dropped: "level"
902
1000
  };
903
- let c = r.resolve(), l = i.current();
904
- if (!Me({
1001
+ let c = e.trace ?? r.resolve(), l = i.current();
1002
+ if (!Pe({
905
1003
  level: e.level,
906
1004
  type: e.type,
907
1005
  namespace: e.namespace,
@@ -912,66 +1010,39 @@ var Dn = class {
912
1010
  record: null,
913
1011
  dropped: "sampling"
914
1012
  };
915
- let u = a.next(), d = Ge(n), f = t.capture.fullUrls ? d : We(d), p, m = 0;
1013
+ let u = a.next(), d = Ze(n), f = Ye(d, t.capture.fullUrls), p, m = 0;
916
1014
  try {
917
- let t = j(this.deps.context.getAll(), o, n), r = j(e.scoped ?? {}, o, n), i = j(e.payload ?? {}, o, n);
918
- m = t.bytes + r.bytes + i.bytes, p = {
919
- ...K(t.value),
920
- ...K(r.value),
921
- ...K(i.value)
1015
+ let t = M(this.deps.context.getAll(), o, n), r = M(this.provided(), o, n), i = M(e.scoped ?? {}, o, n), a = M(e.payload ?? {}, o, n);
1016
+ m = t.bytes + r.bytes + i.bytes + a.bytes, p = {
1017
+ ...q(t.value),
1018
+ ...q(r.value),
1019
+ ...q(i.value),
1020
+ ...q(a.value)
922
1021
  };
923
1022
  } catch (e) {
924
- n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [me]: !0 };
1023
+ n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [ge]: !0 };
925
1024
  }
926
- Object.assign(p, e.fixed), p[b] = e.type, p[D] = u, p[w] = e.namespace, p[T] = f, l && (p[E] = l.id, p[y] = l.name, l.parentId !== void 0 && (p[fe] = l.parentId));
927
- let h = Pe(e.body, o.maxBodyChars);
1025
+ Object.assign(p, e.fixed), p[b] = e.type, p[O] = u, p[w] = e.namespace, p[T] = f, l && (p[D] = l.id, p[y] = l.name, l.parentId !== void 0 && (p[he] = l.parentId));
1026
+ let h = ze(e.body, o.maxBodyChars);
928
1027
  h !== e.body && n.count("record.truncated");
929
1028
  let g = {
930
- timeUnixNano: je(),
1029
+ timeUnixNano: Ie(),
931
1030
  traceId: c.traceId,
932
1031
  spanId: c.spanId,
933
1032
  traceFlags: c.traceFlags,
934
- severityNumber: ue[e.level],
1033
+ severityNumber: se[e.level],
935
1034
  severityText: e.level,
936
1035
  body: h,
937
1036
  attributes: p,
938
1037
  resource: this.resource()
939
- }, _ = t.redact;
940
- if (_) {
941
- let t;
942
- try {
943
- t = _(g);
944
- } catch (e) {
945
- return n.report("record.dropped_by_redact", "The redact hook threw an error. The library dropped the record.", void 0, e), {
946
- record: null,
947
- dropped: "redact"
948
- };
949
- }
950
- if (t === null) return n.count("record.dropped_by_redact"), {
1038
+ }, _ = t.processors.map((e) => [e, "processor"]);
1039
+ if (t.redact && _.push([t.redact, "redact"]), _.length > 0) {
1040
+ let t = this.applyHooks(g, _, e.fixed);
1041
+ if (typeof t == "string") return {
951
1042
  record: null,
952
- dropped: "redact"
953
- };
954
- let r = t ?? g;
955
- if (!Oe(r)) return r === g ? (n.report("record.dropped_malformed", "The redact hook changed the record to a shape that is not a record. The library dropped it."), {
956
- record: null,
957
- dropped: "malformed"
958
- }) : (n.report("record.dropped_by_redact", "The redact hook returned a value that is not a record. The library dropped the record."), {
959
- record: null,
960
- dropped: "redact"
961
- });
962
- if (ke(r.severityText)) {
963
- if (r !== g) {
964
- let t = j(r.attributes, o, n);
965
- g = {
966
- ...r,
967
- attributes: K(t.value)
968
- }, m = t.bytes, Object.assign(g.attributes, e.fixed);
969
- }
970
- g.severityNumber = ue[g.severityText];
971
- } else return n.report("record.dropped_malformed", "The redact hook set a severityText that is not a log level. The library dropped the record."), {
972
- record: null,
973
- dropped: "malformed"
1043
+ dropped: t
974
1044
  };
1045
+ ({record: g, bytes: m} = t);
975
1046
  }
976
1047
  if (m > o.maxRecordBytes) {
977
1048
  n.report("record.truncated", "The attributes are larger than the size limit. The library dropped the caller attributes.", {
@@ -980,63 +1051,150 @@ var Dn = class {
980
1051
  });
981
1052
  let t = {
982
1053
  [b]: e.type,
983
- [D]: u,
1054
+ [O]: u,
984
1055
  [w]: e.namespace,
985
- [le]: !0,
986
- [ve]: m
1056
+ [fe]: !0,
1057
+ [be]: m
987
1058
  };
988
- for (let e of En) e in g.attributes && (t[e] = g.attributes[e]);
989
- for (let [e, n] of Object.entries(g.attributes)) e.startsWith(Tn) && (t[e] = n);
990
- let r = j(t, o, n).bytes;
991
- r > o.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, ge), r = j(t, o, n).bytes);
1059
+ for (let e of Ln) e in g.attributes && (t[e] = g.attributes[e]);
1060
+ for (let [e, n] of Object.entries(g.attributes)) e.startsWith(In) && (t[e] = n);
1061
+ let r = M(t, o, n).bytes;
1062
+ r > o.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, ve), r = M(t, o, n).bytes);
992
1063
  let i = g.attributes[v];
993
1064
  if (i !== void 0) {
994
- let e = j(i, o, n).bytes;
1065
+ let e = M(i, o, n).bytes;
995
1066
  r + e <= o.maxRecordBytes && (t[v] = i);
996
1067
  }
997
1068
  Object.assign(t, e.fixed), g.attributes = t;
998
1069
  }
999
1070
  return { record: g };
1000
1071
  }
1072
+ redactForwarded(e) {
1073
+ let { redact: t } = this.deps.config;
1074
+ if (!t) return e;
1075
+ let n = [[t, "redact"]], r = this.applyHooks(e, n, Bn(e.attributes));
1076
+ return typeof r == "string" ? null : r.record;
1077
+ }
1078
+ applyHooks(e, t, n) {
1079
+ let r = e;
1080
+ for (let [e, n] of t) {
1081
+ let t = this.runHook(e, n, r);
1082
+ if (typeof t == "string") return t;
1083
+ r = t;
1084
+ }
1085
+ let { diagnostics: i, limits: a } = this.deps, o = M(r.attributes, a, i), s = q(o.value);
1086
+ return Object.assign(s, n), {
1087
+ record: {
1088
+ ...r,
1089
+ attributes: s
1090
+ },
1091
+ bytes: o.bytes
1092
+ };
1093
+ }
1094
+ runHook(e, t, n) {
1095
+ let { diagnostics: r } = this.deps, { label: i, code: a } = Rn[t], o;
1096
+ try {
1097
+ o = e(n);
1098
+ } catch (e) {
1099
+ return r.report(a, `${i} threw an error. The library dropped the record.`, void 0, e), t;
1100
+ }
1101
+ if (o === null) return r.count(a), t;
1102
+ let s = o ?? n;
1103
+ return Fe(s) ? Le(s.severityText) ? {
1104
+ ...s,
1105
+ severityNumber: se[s.severityText]
1106
+ } : (r.report("record.dropped_malformed", `${i} set a severityText that is not a log level. The library dropped the record.`), "malformed") : s === n ? (r.report("record.dropped_malformed", `${i} changed the record to a shape that is not a record. The library dropped it.`), "malformed") : (r.report(a, `${i} returned a value that is not a record. The library dropped the record.`), t);
1107
+ }
1108
+ provided() {
1109
+ let e = this.deps.config.contextProvider;
1110
+ if (!e) return {};
1111
+ let { diagnostics: t } = this.deps, n = t.guard("handler.threw", "The contextProvider threw an error. The record has no attributes from it.", () => {
1112
+ let t = e();
1113
+ return t === void 0 ? {} : A(t) && typeof t.then != "function" ? t : null;
1114
+ });
1115
+ return n === null && t.report("config.invalid", "contextProvider must return an object of attributes. The library ignores the value."), n ?? {};
1116
+ }
1001
1117
  resource() {
1002
1118
  if (this.resourceCache) return this.resourceCache;
1003
- let { config: e, identity: t, platform: r } = this.deps;
1119
+ let { config: e, identity: n, platform: r } = this.deps;
1004
1120
  return this.resourceCache = {
1005
- [te]: e.serviceName,
1006
- [c]: e.serviceVersion,
1007
- [p]: e.environment,
1008
- [d]: ce,
1009
- [_e]: S,
1010
- [s]: he,
1011
- [h]: r.platform,
1012
- [ee]: t.sessionId,
1013
- [ne]: t.tabId,
1014
- [u]: t.contextId,
1015
- [o]: r.userAgent,
1016
- ...r.openfinUuid === void 0 ? {} : { [n]: r.openfinUuid },
1017
- ...r.openfinName === void 0 ? {} : { [we]: r.openfinName }
1121
+ [s]: e.serviceName,
1122
+ [d]: e.serviceVersion,
1123
+ [te]: e.environment,
1124
+ [re]: oe,
1125
+ [ae]: k,
1126
+ [ie]: we,
1127
+ [c]: r.platform,
1128
+ [ye]: n.sessionId,
1129
+ [u]: n.tabId,
1130
+ [t]: n.contextId,
1131
+ [Ee]: r.userAgent,
1132
+ ...r.openfinUuid === void 0 ? {} : { [ne]: r.openfinUuid },
1133
+ ...r.openfinName === void 0 ? {} : { [ee]: r.openfinName }
1018
1134
  }, this.resourceCache;
1019
1135
  }
1020
- }, On = {
1021
- errors: async () => (await import("./errors-BGs5NOrw.js")).ErrorCapture,
1022
- network: async () => (await import("./network-CMnEvGJB.js")).NetworkCapture,
1023
- interactions: async () => (await import("./interactions-B8zjCjga.js")).InteractionCapture,
1136
+ }, Hn = 1e3, Un = {
1137
+ start: "ui.start",
1138
+ interaction: "ui.interaction",
1139
+ navigation: "ui.navigation",
1140
+ explicit: "ui.trace",
1141
+ maxAge: "ui.trace"
1142
+ };
1143
+ function Wn(e) {
1144
+ return `${String(Math.round(e * Hn))}000`;
1145
+ }
1146
+ function Gn(e) {
1147
+ return {
1148
+ name: Un[e.reason],
1149
+ kind: "internal",
1150
+ traceId: e.traceId,
1151
+ spanId: e.spanId,
1152
+ parentSpanId: "",
1153
+ startMs: e.startedAt,
1154
+ endMs: e.endedAt,
1155
+ error: !1,
1156
+ attributes: {}
1157
+ };
1158
+ }
1159
+ function Kn(e) {
1160
+ return {
1161
+ [C.kind]: e.kind,
1162
+ [C.parentId]: e.parentSpanId,
1163
+ [C.start]: Wn(e.startMs),
1164
+ [C.end]: Wn(e.endMs),
1165
+ [C.status]: e.error ? "error" : "unset"
1166
+ };
1167
+ }
1168
+ //#endregion
1169
+ //#region src/core/runtime.ts
1170
+ var qn = {
1171
+ errors: async () => (await import("./errors-BDI96zKc.js")).ErrorCapture,
1172
+ network: async () => (await import("./network-BsBZ6_-Q.js")).NetworkCapture,
1173
+ interactions: async () => (await import("./interactions-Ck01cEij.js")).InteractionCapture,
1024
1174
  webVitals: async () => (await import("./web-vitals-Bflr5jSA.js")).WebVitalsCapture,
1025
- longFrames: async () => (await import("./long-frames-B0tKuChx.js")).LongFrameCapture,
1026
- console: async () => (await import("./console-B3vGRW5p.js")).ConsoleCapture
1027
- }, q = Symbol.for(re), J = Symbol.for(m), kn = ["batching", "retention"];
1028
- function An(e) {
1175
+ longFrames: async () => (await import("./long-frames-DDumopji.js")).LongFrameCapture,
1176
+ console: async () => (await import("./console-BT7mcgU6.js")).ConsoleCapture
1177
+ }, Jn = /* @__PURE__ */ new WeakMap(), Yn = 0;
1178
+ function Xn(e) {
1179
+ let t = Jn.get(e);
1180
+ return t === void 0 && (t = ++Yn, Jn.set(e, t)), t;
1181
+ }
1182
+ var J = Symbol.for(xe), Y = Symbol.for(_e), Zn = ["batching", "retention"];
1183
+ function Qn(e) {
1029
1184
  return JSON.stringify({
1030
1185
  ...e,
1031
1186
  webVitalsLoader: e.webVitalsLoader !== void 0,
1032
1187
  ignoreUrls: e.ignoreUrls.map(String),
1033
- propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String)
1188
+ propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String),
1189
+ plugins: e.plugins.map(Xn)
1034
1190
  });
1035
1191
  }
1036
- function Y(e) {
1192
+ function $n(e) {
1037
1193
  return {
1038
1194
  ...e,
1039
1195
  endpoint: null,
1196
+ metricsEndpoint: "",
1197
+ tracesEndpoint: "",
1040
1198
  transport: void 0,
1041
1199
  transportOnExit: void 0,
1042
1200
  bus: {
@@ -1045,13 +1203,15 @@ function Y(e) {
1045
1203
  }
1046
1204
  };
1047
1205
  }
1206
+ function er(e) {
1207
+ return !!e.endpoint || !!e.metricsEndpoint || !!e.tracesEndpoint || e.transport !== void 0;
1208
+ }
1048
1209
  function X(e) {
1049
- return e.sdkVersion === S;
1210
+ return e.sdkVersion === k;
1050
1211
  }
1051
1212
  var Z = class e {
1052
- degraded;
1053
1213
  static local = null;
1054
- sdkVersion = S;
1214
+ sdkVersion = k;
1055
1215
  diagnostics;
1056
1216
  config;
1057
1217
  platform;
@@ -1059,10 +1219,10 @@ var Z = class e {
1059
1219
  stores;
1060
1220
  identityBuiltAs;
1061
1221
  sessionTouch;
1062
- context = new mn();
1222
+ context = new Mn();
1063
1223
  breadcrumbs;
1064
1224
  tracing;
1065
- sequence = new ct();
1225
+ sequence = new xt();
1066
1226
  journey;
1067
1227
  builder;
1068
1228
  remote = { sampling: null };
@@ -1075,7 +1235,7 @@ var Z = class e {
1075
1235
  storageBuiltAs;
1076
1236
  sender;
1077
1237
  senderLoad;
1078
- pendingRecords = new _n((e) => {
1238
+ pendingRecords = new Fn((e) => {
1079
1239
  this.dropHeld(e);
1080
1240
  });
1081
1241
  captures = [];
@@ -1085,7 +1245,7 @@ var Z = class e {
1085
1245
  navigationTiming: !1,
1086
1246
  longFrames: !1
1087
1247
  };
1088
- bootBuffer = new _n((e) => {
1248
+ bootBuffer = new Fn((e) => {
1089
1249
  this.dropHeld(e);
1090
1250
  });
1091
1251
  forwardBuffer = [];
@@ -1098,13 +1258,26 @@ var Z = class e {
1098
1258
  limits;
1099
1259
  journeyOptions;
1100
1260
  tunablesLocked = !0;
1261
+ degraded;
1262
+ serverReported = !1;
1263
+ onPageHide = () => {
1264
+ this.role() === "forwarder" && (this.tracing.end(), this.sendForwarded());
1265
+ };
1101
1266
  constructor(e, t = !1) {
1102
- this.degraded = t, this.diagnostics = new hn(e.onDiagnostic), this.platform = Ue(this.diagnostics), this.config = dn(e, this.diagnostics), this.identityBuiltAs = this.config.identity, this.stores = this.identityBuiltAs === "memory" ? Be() : He, this.identity = Ve(this.diagnostics, this.stores), this.sessionTouch = new Re(this.diagnostics, this.stores), this.breadcrumbs = new vt(50), this.tracing = new _t(this.diagnostics, void 0, this.config.otelLoader), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new st(this.config.console, this.diagnostics, this.limits), this.drops = new gn(this.config, this.diagnostics), this.journeyOptions = {
1103
- ...Xe,
1267
+ this.diagnostics = new Nn(e.onDiagnostic), this.platform = Xe(this.diagnostics), this.degraded = t || this.onServer(), this.config = kn(this.allowed(e), this.diagnostics), this.identityBuiltAs = this.config.identity, this.stores = this.identityBuiltAs === "memory" || this.onServer() ? Ge() : qe, this.identity = Ke(this.diagnostics, this.stores), this.sessionTouch = new Ue(this.diagnostics, this.stores), this.breadcrumbs = new Mt(50);
1268
+ let n = (e) => je(e, this.config.sampling.defaultRate);
1269
+ this.tracing = new jt(this.diagnostics, void 0, this.config.otelLoader, {
1270
+ enabled: () => this.config.tracesEndpoint !== "",
1271
+ keeps: n,
1272
+ onEnd: (e) => {
1273
+ n(e.traceId) && this.recordSpan(Gn(e));
1274
+ }
1275
+ }), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new bt(this.config.console, this.diagnostics, this.limits), this.drops = new Pn(this.config, this.diagnostics), this.journeyOptions = {
1276
+ ...et,
1104
1277
  maxAgeMs: this.config.journey.maxAgeMs
1105
- }, this.journey = new Ye(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
1278
+ }, this.journey = new $e(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
1106
1279
  this.bus?.broadcastJourney(e);
1107
- }, this.stores), this.builder = new Dn({
1280
+ }, this.stores), this.builder = new Vn({
1108
1281
  remote: this.remote,
1109
1282
  config: this.config,
1110
1283
  limits: this.limits,
@@ -1115,24 +1288,55 @@ var Z = class e {
1115
1288
  sequence: this.sequence,
1116
1289
  identity: this.identity,
1117
1290
  platform: this.platform
1118
- }), this.meter = new wn(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
1291
+ }), this.meter = new vt(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
1119
1292
  this.emitPoint(e, t, n);
1120
1293
  }, this.diagnostics);
1121
1294
  }
1295
+ addBreadcrumb(e, t) {
1296
+ this.diagnostics.guard("record.sanitize_failed", "The library could not add the breadcrumb.", () => {
1297
+ let n = {
1298
+ t: Date.now(),
1299
+ category: "custom",
1300
+ message: ze(String(e), this.limits.maxBodyChars)
1301
+ };
1302
+ if (t !== void 0) {
1303
+ let e = Be(t, this.limits, this.diagnostics);
1304
+ n.data = A(e) ? e : { value: e };
1305
+ }
1306
+ this.breadcrumbs.push(n);
1307
+ });
1308
+ }
1122
1309
  recordMetric(e, t, n) {
1123
1310
  this.destroyed || this.meter.record(e, t, n);
1124
1311
  }
1312
+ recordSpan(e) {
1313
+ if (this.config.tracesEndpoint === "") return;
1314
+ let { record: t } = this.builder.build({
1315
+ level: "INFO",
1316
+ type: "span",
1317
+ body: e.name,
1318
+ namespace: Se,
1319
+ payload: e.attributes,
1320
+ fixed: Kn(e),
1321
+ trace: {
1322
+ traceId: e.traceId,
1323
+ spanId: e.spanId,
1324
+ traceFlags: 1
1325
+ }
1326
+ });
1327
+ this.emit(t);
1328
+ }
1125
1329
  emitPoint(e, t, n) {
1126
- let { record: r } = this.builder.build({
1330
+ let { record: i } = this.builder.build({
1127
1331
  level: "INFO",
1128
1332
  type: "metric",
1129
1333
  body: e,
1130
- namespace: Se,
1334
+ namespace: r,
1131
1335
  payload: t,
1132
1336
  fixed: n,
1133
1337
  aggregated: !0
1134
1338
  });
1135
- this.emit(r);
1339
+ this.emit(i);
1136
1340
  }
1137
1341
  busAccept = (e, t) => {
1138
1342
  this.destroyed || this.ensureBus().then((n) => {
@@ -1142,7 +1346,7 @@ var Z = class e {
1142
1346
  });
1143
1347
  };
1144
1348
  static pinned() {
1145
- return globalThis[q] ?? null;
1349
+ return globalThis[J] ?? null;
1146
1350
  }
1147
1351
  static current() {
1148
1352
  let t = e.local;
@@ -1153,7 +1357,7 @@ var Z = class e {
1153
1357
  static stopped() {
1154
1358
  let t = e.local;
1155
1359
  if (t?.destroyed) return t;
1156
- let n = globalThis[J];
1360
+ let n = globalThis[Y];
1157
1361
  return n && X(n) ? n : null;
1158
1362
  }
1159
1363
  isDestroyed() {
@@ -1161,7 +1365,7 @@ var Z = class e {
1161
1365
  }
1162
1366
  static configure(t, n = !1) {
1163
1367
  let r = e.local;
1164
- if (r && !r.destroyed) return r.reconfigure(Y(t)), r;
1368
+ if (r && !r.destroyed) return r.reconfigure(t), r;
1165
1369
  e.local = null;
1166
1370
  let i = e.pinned();
1167
1371
  if (i) {
@@ -1169,23 +1373,29 @@ var Z = class e {
1169
1373
  if (!i.destroyed) return i.reconfigure(t), i;
1170
1374
  }
1171
1375
  let a = new e(t);
1172
- return a.tunablesLocked = !n, globalThis[q] = a, Reflect.deleteProperty(globalThis, J), a.init(), a;
1376
+ return a.tunablesLocked = !n, globalThis[J] = a, Reflect.deleteProperty(globalThis, Y), a.init(), a;
1173
1377
  }
1174
1378
  static startDegraded(t, n) {
1175
- let r = new e(Y(t), !0);
1379
+ let r = new e(t, !0);
1176
1380
  e.local = r;
1177
1381
  let i = typeof n == "string" ? n : "before 0.9.0";
1178
- return r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${S}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
1382
+ return r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${k}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
1179
1383
  found: i,
1180
- own: S
1384
+ own: k
1181
1385
  }), r.init(), r;
1182
1386
  }
1183
1387
  reconfigure(e) {
1184
- let t = this.keepDestination(e), n = An(this.config.capture), r = dn(t, this.diagnostics, this.config);
1185
- this.keepStartupTunables(r), pn(this.config, r), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), An(this.config.capture) !== n && this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
1388
+ let t = this.keepDestination(this.allowed(e)), n = Qn(this.config.capture), r = kn(t, this.diagnostics, this.config);
1389
+ this.keepStartupTunables(r), jn(this.config, r), this.diagnostics.setHandler(this.config.onDiagnostic), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), Qn(this.config.capture) !== n && this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
1390
+ }
1391
+ onServer() {
1392
+ return this.platform.platform === "node";
1393
+ }
1394
+ allowed(e) {
1395
+ return this.degraded ? (this.onServer() && !this.serverReported && er(e) && (this.serverReported = !0, this.diagnostics.report("config.invalid", "The library runs console-only on Node. It sends no record and installs no capture. It ignores endpoint, metricsEndpoint, tracesEndpoint and transport.")), $n(e)) : e;
1186
1396
  }
1187
1397
  keepStartupTunables(e) {
1188
- if (this.senderLoad !== void 0 && this.keepSections(e, kn), !this.tunablesLocked) {
1398
+ if (this.senderLoad !== void 0 && this.keepSections(e, Zn), !this.tunablesLocked) {
1189
1399
  this.tunablesLocked = !0, Object.assign(this.limits, e.limits), this.journeyOptions.maxAgeMs = e.journey.maxAgeMs;
1190
1400
  return;
1191
1401
  }
@@ -1213,6 +1423,7 @@ var Z = class e {
1213
1423
  this.config.identity !== e && (this.diagnostics.report("config.invalid", `identity cannot change after startup. It stays ${e}.`, { requested: this.config.identity }), this.config.identity = e);
1214
1424
  }
1215
1425
  async init() {
1426
+ this.degraded || addEventListener("pagehide", this.onPageHide);
1216
1427
  let e = this.installCaptures();
1217
1428
  this.started = this.boot(), await this.started, await e;
1218
1429
  }
@@ -1243,7 +1454,7 @@ var Z = class e {
1243
1454
  }
1244
1455
  async buildBus() {
1245
1456
  try {
1246
- let { Bus: e } = await import("./bus-DrixwdiX.js");
1457
+ let { Bus: e } = await import("./bus-Cyvq-Ngx.js");
1247
1458
  if (this.destroyed) return null;
1248
1459
  let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
1249
1460
  onRecords: (e) => {
@@ -1278,14 +1489,14 @@ var Z = class e {
1278
1489
  async buildSender() {
1279
1490
  this.storageBuiltAs = this.config.storage;
1280
1491
  try {
1281
- let { Sender: e } = await import("./sender--0_VzPbN.js"), t = this.destroyed ? null : await e.create({
1492
+ let { Sender: e } = await import("./sender-DFQMF39P.js"), t = this.destroyed ? null : await e.create({
1282
1493
  config: this.config,
1283
1494
  diagnostics: this.diagnostics,
1284
1495
  onGap: this.reportGap,
1285
1496
  onLoss: this.reportLoss,
1286
1497
  remote: this.remote,
1287
1498
  beforeExit: () => {
1288
- this.meter.collect();
1499
+ this.meter.collect(), this.tracing.end();
1289
1500
  }
1290
1501
  });
1291
1502
  if (!t || this.destroyed) {
@@ -1302,21 +1513,26 @@ var Z = class e {
1302
1513
  if (this.degraded) return;
1303
1514
  let e = ++this.captureGeneration, t = this.config.capture, n = [];
1304
1515
  (t.errors || t.rejections || t.resourceErrors) && n.push("errors"), (t.fetch || t.xhr) && n.push("network"), (t.interactions || t.navigation) && n.push("interactions"), t.webVitals && n.push("webVitals"), t.longFrames && n.push("longFrames"), (Array.isArray(t.console) ? t.console.length > 0 : t.console) && n.push("console");
1305
- let r = await Promise.all(n.map((e) => this.loadCapture(e)));
1516
+ let [r, a] = await Promise.all([Promise.all(n.map((e) => this.loadCapture(e))), t.webSocket ? this.loadWebSocket() : void 0]);
1306
1517
  if (e !== this.captureGeneration || this.destroyed) return;
1307
1518
  this.uninstallCaptures();
1308
- let a = {
1519
+ let o = {
1309
1520
  config: this.config,
1310
1521
  diagnostics: this.diagnostics,
1311
1522
  breadcrumbs: this.breadcrumbs,
1312
1523
  tracing: this.tracing,
1313
- logger: new I(() => this, i),
1524
+ logger: new L(() => this, i),
1314
1525
  once: this.captureOnce,
1315
1526
  recordMetric: (e, t, n) => {
1316
1527
  this.recordMetric(e, t, n);
1528
+ },
1529
+ recordSpan: (e) => {
1530
+ this.recordSpan(e);
1317
1531
  }
1318
1532
  };
1319
- for (let e of r) e && this.captures.push(new e(a));
1533
+ for (let e of r) e && this.captures.push(new e(o));
1534
+ let s = a ? [...t.plugins, new a(this.diagnostics, this.config)] : t.plugins;
1535
+ for (let e of s) this.captures.push(this.pluginCapture(e));
1320
1536
  for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
1321
1537
  e.install();
1322
1538
  });
@@ -1327,8 +1543,33 @@ var Z = class e {
1327
1543
  });
1328
1544
  this.captures.length = 0;
1329
1545
  }
1546
+ loadWebSocket() {
1547
+ return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-Ar4cZxmd.js")).WebSocketCapture);
1548
+ }
1549
+ pluginCapture(e) {
1550
+ let { name: t } = e, n = (e, t, n) => {
1551
+ this.recordMetric(e, t, n);
1552
+ }, r = {
1553
+ logger: new L(() => this, `${i}.${t}`),
1554
+ counter: (e, t = {}) => gt(e, t, n),
1555
+ histogram: (e, t = {}) => _t(e, t, n),
1556
+ addBreadcrumb: (e, t) => {
1557
+ this.addBreadcrumb(e, t);
1558
+ },
1559
+ ownRequest: Je
1560
+ };
1561
+ return {
1562
+ name: t,
1563
+ install: () => {
1564
+ e.install(r);
1565
+ },
1566
+ uninstall: () => {
1567
+ e.uninstall();
1568
+ }
1569
+ };
1570
+ }
1330
1571
  loadCapture(e) {
1331
- return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, On[e]);
1572
+ return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, qn[e]);
1332
1573
  }
1333
1574
  registerWorker(e) {
1334
1575
  this.destroyed || this.constructBus().then((t) => {
@@ -1339,9 +1580,9 @@ var Z = class e {
1339
1580
  }
1340
1581
  async destroy() {
1341
1582
  if (this.destroyed) return;
1342
- this.meter.collect(), this.destroyed = !0, this.uninstallCaptures();
1583
+ this.meter.collect(), this.tracing.end(), this.destroyed = !0, this.degraded || removeEventListener("pagehide", this.onPageHide), this.uninstallCaptures();
1343
1584
  let t = this.sender?.destroy();
1344
- this.journey.destroy(), this.sendForwarded(), this.bus?.destroy(), this.drops.add("load_failed", this.pendingRecords.take()), await t, await this.senderLoad, e.pinned() === this && (Reflect.deleteProperty(globalThis, q), globalThis[J] = this);
1585
+ this.journey.destroy(), this.sendForwarded(), this.bus?.destroy(), this.drops.add("load_failed", this.pendingRecords.take()), await t, await this.senderLoad, e.pinned() === this && (Reflect.deleteProperty(globalThis, J), globalThis[Y] = this);
1345
1586
  }
1346
1587
  emit(e) {
1347
1588
  e && !this.destroyed && (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.bootBuffer.push(e));
@@ -1366,11 +1607,22 @@ var Z = class e {
1366
1607
  }
1367
1608
  ingestForwarded(e) {
1368
1609
  if (!Array.isArray(e)) this.diagnostics.count("record.dropped_malformed");
1369
- else for (let t of e) Oe(t) ? Ae(t, this.config, this.remote.sampling?.current() ?? null) ? this.deliver(t) : this.diagnostics.count("record.dropped_by_sampling") : this.diagnostics.count("record.dropped_malformed");
1610
+ else for (let t of e) {
1611
+ if (!Fe(t)) {
1612
+ this.diagnostics.count("record.dropped_malformed");
1613
+ continue;
1614
+ }
1615
+ if (!Ae(t, this.config, this.remote.sampling?.current() ?? null)) {
1616
+ this.diagnostics.count("record.dropped_by_sampling");
1617
+ continue;
1618
+ }
1619
+ let e = this.builder.redactForwarded(t);
1620
+ e && this.deliver(e);
1621
+ }
1370
1622
  }
1371
1623
  releaseBootBuffer() {
1372
- let e = this.bootBuffer.take(), t = this.journey.current();
1373
- for (let n of e) t && !n.attributes["journey.id"] && (n.attributes["journey.id"] = t.id, n.attributes["journey.name"] = t.name), this.route(n);
1624
+ let e = this.bootBuffer.take(), { processors: t, redact: n } = this.config, r = t.length === 0 && n === void 0 ? this.journey.current() : null;
1625
+ for (let t of e) r && !t.attributes["journey.id"] && (t.attributes["journey.id"] = r.id, t.attributes["journey.name"] = r.name), this.route(t);
1374
1626
  }
1375
1627
  reportLoss = (e, t, n) => {
1376
1628
  this.drops.add(e, t, n);
@@ -1378,18 +1630,36 @@ var Z = class e {
1378
1630
  reportGap = (e, t) => {
1379
1631
  this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
1380
1632
  let n = Date.now();
1381
- n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new I(() => this, ye).warn("stored records were dropped before delivery", {
1633
+ n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new L(() => this, le).warn("stored records were dropped before delivery", {
1382
1634
  "gap.batches": e.batches,
1383
1635
  "gap.records": e.records,
1384
1636
  "gap.reason": e.reason
1385
1637
  }));
1386
1638
  };
1387
1639
  regenerateTabId() {
1388
- let e = Le(this.diagnostics);
1640
+ let e = He(this.diagnostics);
1389
1641
  this.diagnostics.report("bus.role_resolved", "Another context uses this tab id. A duplicated tab is the usual cause. The library makes a new tab id.", {
1390
1642
  was: this.identity.tabId,
1391
1643
  now: e
1392
- }), this.identity.tabId = e, Ie(e, this.diagnostics, this.stores), this.builder.invalidateResource();
1644
+ }), this.identity.tabId = e, Ve(e, this.diagnostics, this.stores), this.builder.invalidateResource();
1645
+ }
1646
+ newSession() {
1647
+ if (this.destroyed) return;
1648
+ this.meter.collect(), this.tracing.rotate("explicit"), this.journey.end(), this.breadcrumbs.clear();
1649
+ let e = He(this.diagnostics);
1650
+ this.identity.sessionId = e, this.sessionTouch.restart(e), this.builder.invalidateResource();
1651
+ }
1652
+ async stats() {
1653
+ let e = await this.queueDepth(), t = this.sender?.stats() ?? {
1654
+ pending: 0,
1655
+ inFlight: 0,
1656
+ lastSendAt: null
1657
+ }, n = this.bootBuffer.length + this.pendingRecords.length + this.forwardBuffer.length;
1658
+ return {
1659
+ ...t,
1660
+ pending: t.pending + n,
1661
+ stored: e
1662
+ };
1393
1663
  }
1394
1664
  async queueDepth() {
1395
1665
  return await this.senderLoad, await this.sender?.queueDepth() ?? 0;
@@ -1400,7 +1670,7 @@ var Z = class e {
1400
1670
  };
1401
1671
  //#endregion
1402
1672
  //#region src/transport/memory-transport.ts
1403
- function jn() {
1673
+ function tr() {
1404
1674
  let e = [], t = [], n = { status: 200 };
1405
1675
  return {
1406
1676
  transport: (r) => (e.push(r), n.status >= 200 && n.status < 300 && t.push(r), Promise.resolve({ ...n })),
@@ -1419,122 +1689,119 @@ function jn() {
1419
1689
  }
1420
1690
  //#endregion
1421
1691
  //#region src/index.ts
1422
- var Mn = /* @__PURE__ */ new Map();
1692
+ var nr = /* @__PURE__ */ new Map();
1423
1693
  function Q() {
1424
1694
  return (Z.current() ?? Z.stopped()) || Z.configure({}, !0);
1425
1695
  }
1426
- function Nn(e) {
1696
+ function rr(e) {
1427
1697
  Z.configure(e);
1428
1698
  }
1429
- function Pn(e, t) {
1430
- if (t) return new I(Q, e, t);
1431
- let n = Mn.get(e);
1432
- return n || (n = new I(Q, e), Mn.set(e, n)), n;
1699
+ function ir(e, t) {
1700
+ if (t) return new L(Q, e, t);
1701
+ let n = nr.get(e);
1702
+ return n || (n = new L(Q, e), nr.set(e, n)), n;
1433
1703
  }
1434
1704
  function $() {
1435
- return Pn("app");
1705
+ return ir("app");
1436
1706
  }
1437
- function Fn(e, t) {
1707
+ function ar(e, t) {
1438
1708
  $().trace(e, t);
1439
1709
  }
1440
- function In(e, t) {
1710
+ function or(e, t) {
1441
1711
  $().debug(e, t);
1442
1712
  }
1443
- function Ln(e, t) {
1713
+ function sr(e, t) {
1444
1714
  $().info(e, t);
1445
1715
  }
1446
- function Rn(e, t) {
1716
+ function cr(e, t) {
1447
1717
  $().warn(e, t);
1448
1718
  }
1449
- function zn(e, t, n) {
1719
+ function lr(e, t, n) {
1450
1720
  $().error(e, t, n);
1451
1721
  }
1452
- function Bn(e, t, n) {
1722
+ function ur(e, t, n) {
1453
1723
  $().fatal(e, t, n);
1454
1724
  }
1455
- function Vn(e, t) {
1725
+ function dr(e, t) {
1456
1726
  $().logAction(e, t);
1457
1727
  }
1458
- function Hn(e, t) {
1728
+ function fr(e, t) {
1459
1729
  $().logEvent(e, t);
1460
1730
  }
1461
- function Un(e, t, n, r, i) {
1731
+ function pr(e, t, n, r, i) {
1462
1732
  $().logMetric(e, t, n, r, i);
1463
1733
  }
1464
- function Wn(e, t = {}) {
1465
- let n = {
1466
- name: e,
1467
- kind: "counter",
1468
- unit: t.unit ?? "count",
1469
- boundaries: []
1470
- };
1471
- return { add: (e, t) => {
1472
- Q().recordMetric(n, e, t);
1473
- } };
1734
+ function mr(e, t = {}) {
1735
+ return gt(e, t, (e, t, n) => {
1736
+ Q().recordMetric(e, t, n);
1737
+ });
1474
1738
  }
1475
- function Gn(e, t = {}) {
1476
- let n = {
1477
- name: e,
1478
- kind: "histogram",
1479
- unit: t.unit ?? "count",
1480
- boundaries: t.boundaries ?? ae
1481
- };
1482
- return { record: (e, t) => {
1483
- Q().recordMetric(n, e, t);
1484
- } };
1739
+ function hr(e, t = {}) {
1740
+ return _t(e, t, (e, t, n) => {
1741
+ Q().recordMetric(e, t, n);
1742
+ });
1485
1743
  }
1486
- function Kn(e, t, n) {
1744
+ function gr(e, t, n) {
1487
1745
  return $().timeSync(e, t, n);
1488
1746
  }
1489
- function qn(e, t, n) {
1747
+ function _r(e, t, n) {
1490
1748
  return $().timeAsync(e, t, n);
1491
1749
  }
1492
- function Jn(e, t) {
1750
+ function vr(e, t) {
1751
+ Q().addBreadcrumb(e, t);
1752
+ }
1753
+ function yr(e, t) {
1493
1754
  Q().context.set(e, t);
1494
1755
  }
1495
- function Yn(e) {
1756
+ function br(e) {
1496
1757
  Q().context.setMany(e);
1497
1758
  }
1498
- function Xn(e) {
1759
+ function xr(e) {
1499
1760
  Q().context.remove(e);
1500
1761
  }
1501
- function Zn(e, t) {
1762
+ function Sr(e, t) {
1502
1763
  return Q().journey.start(e, t);
1503
1764
  }
1504
- function Qn() {
1765
+ function Cr() {
1505
1766
  Q().journey.end();
1506
1767
  }
1507
- function $n() {
1768
+ function wr() {
1508
1769
  return Q().journey.current();
1509
1770
  }
1510
- function er() {
1771
+ function Tr() {
1511
1772
  return Q().journey.getToken();
1512
1773
  }
1513
- function tr(e) {
1774
+ function Er(e) {
1514
1775
  return Q().journey.adopt(e, "manual", !0);
1515
1776
  }
1516
- function nr(e) {
1777
+ function Dr(e) {
1517
1778
  Q().registerWorker(e);
1518
1779
  }
1519
- function rr() {
1780
+ function Or() {
1520
1781
  Q().tracing.rotate("explicit");
1521
1782
  }
1522
- function ir() {
1783
+ function kr() {
1523
1784
  return Q().tracing.headers();
1524
1785
  }
1525
- function ar() {
1786
+ function Ar() {
1526
1787
  return Q().flush();
1527
1788
  }
1528
- function or() {
1789
+ function jr() {
1529
1790
  return Q().queueDepth();
1530
1791
  }
1531
- function sr() {
1792
+ function Mr() {
1793
+ return Q().stats();
1794
+ }
1795
+ function Nr() {
1796
+ Q().newSession();
1797
+ }
1798
+ function Pr() {
1532
1799
  return Q().diagnostics.snapshot();
1533
1800
  }
1534
- async function cr() {
1801
+ async function Fr() {
1535
1802
  await Z.current()?.destroy();
1536
1803
  }
1537
1804
  //#endregion
1538
- export { I as OneLogger, tr as adoptJourney, Nn as configure, Wn as counter, jn as createMemoryTransport, $n as currentJourney, In as debug, Qn as endJourney, zn as error, Bn as fatal, ar as flush, sr as getDiagnosticCounters, er as getJourneyToken, Pn as getLogger, or as getQueueDepth, ir as getTraceHeaders, Gn as histogram, Ln as info, Vn as logAction, Hn as logEvent, Un as logMetric, nr as registerWorker, Xn as removeContext, Jn as setContext, Yn as setContextMap, cr as shutdown, Zn as startJourney, rr as startTrace, qn as timeAsync, Kn as timeSync, Fn as trace, Rn as warn };
1805
+ export { L as OneLogger, vr as addBreadcrumb, Er as adoptJourney, rr as configure, mr as counter, tr as createMemoryTransport, wr as currentJourney, or as debug, Cr as endJourney, lr as error, ur as fatal, Ar as flush, Pr as getDiagnosticCounters, Tr as getJourneyToken, ir as getLogger, jr as getQueueDepth, Mr as getStats, kr as getTraceHeaders, hr as histogram, sr as info, dr as logAction, fr as logEvent, pr as logMetric, Nr as newSession, Dr as registerWorker, xr as removeContext, yr as setContext, br as setContextMap, Fr as shutdown, Sr as startJourney, Or as startTrace, _r as timeAsync, gr as timeSync, ar as trace, cr as warn };
1539
1806
 
1540
1807
  //# sourceMappingURL=index.js.map