@utk09/ui-observability 0.9.4 → 0.9.5

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 (208) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +122 -94
  3. package/dist/batch-BQFtb3i5.cjs +2 -0
  4. package/dist/batch-BQFtb3i5.cjs.map +1 -0
  5. package/dist/{batch-D-4xl7op.js → batch-BUJh-1jZ.js} +7 -5
  6. package/dist/batch-BUJh-1jZ.js.map +1 -0
  7. package/dist/bus/bus.d.ts +76 -2
  8. package/dist/bus/links.d.ts +9 -2
  9. package/dist/bus/validation.d.ts +7 -0
  10. package/dist/bus-BW6N-pY8.cjs +2 -0
  11. package/dist/bus-BW6N-pY8.cjs.map +1 -0
  12. package/dist/bus-DeOPHWaD.js +647 -0
  13. package/dist/bus-DeOPHWaD.js.map +1 -0
  14. package/dist/capture/storm.d.ts +2 -1
  15. package/dist/capture/types.d.ts +2 -0
  16. package/dist/{console-Boqa7new.cjs → console-Ce6heqZZ.cjs} +2 -2
  17. package/dist/console-Ce6heqZZ.cjs.map +1 -0
  18. package/dist/{console-BT7mcgU6.js → console-DbAZYJuy.js} +4 -4
  19. package/dist/console-DbAZYJuy.js.map +1 -0
  20. package/dist/constants-CN7GE1Lt.js +246 -0
  21. package/dist/constants-CN7GE1Lt.js.map +1 -0
  22. package/dist/constants-CW-MlHdY.cjs +2 -0
  23. package/dist/constants-CW-MlHdY.cjs.map +1 -0
  24. package/dist/constants.d.ts +29 -9
  25. package/dist/context-storage-BjzeBSxH.cjs +2 -0
  26. package/dist/context-storage-BjzeBSxH.cjs.map +1 -0
  27. package/dist/context-storage-DxZf4Gfh.js +52 -0
  28. package/dist/context-storage-DxZf4Gfh.js.map +1 -0
  29. package/dist/core/breadcrumbs.d.ts +7 -2
  30. package/dist/core/context.d.ts +2 -0
  31. package/dist/core/diagnostics.d.ts +11 -3
  32. package/dist/core/meter.d.ts +6 -1
  33. package/dist/core/pipeline.d.ts +29 -2
  34. package/dist/core/record.d.ts +2 -1
  35. package/dist/core/runtime.d.ts +91 -3
  36. package/dist/core/sampling.d.ts +3 -1
  37. package/dist/core/sender.d.ts +35 -1
  38. package/dist/deadline-5_PecIl5.js +26 -0
  39. package/dist/deadline-5_PecIl5.js.map +1 -0
  40. package/dist/deadline-XSnm95pg.cjs +2 -0
  41. package/dist/deadline-XSnm95pg.cjs.map +1 -0
  42. package/dist/emergency-queue-BYUyDHGD.js +69 -0
  43. package/dist/emergency-queue-BYUyDHGD.js.map +1 -0
  44. package/dist/emergency-queue-Cs1hrjsC.cjs +2 -0
  45. package/dist/emergency-queue-Cs1hrjsC.cjs.map +1 -0
  46. package/dist/{errors-BDI96zKc.js → errors-BhC7HTSt.js} +8 -9
  47. package/dist/errors-BhC7HTSt.js.map +1 -0
  48. package/dist/errors-CgY633cG.cjs +3 -0
  49. package/dist/errors-CgY633cG.cjs.map +1 -0
  50. package/dist/factory-C5TujXlU.js +280 -0
  51. package/dist/factory-C5TujXlU.js.map +1 -0
  52. package/dist/factory-CNj4DH3n.cjs +2 -0
  53. package/dist/factory-CNj4DH3n.cjs.map +1 -0
  54. package/dist/fixed-window-CtaFHanJ.js +12 -0
  55. package/dist/fixed-window-CtaFHanJ.js.map +1 -0
  56. package/dist/fixed-window-CvESpFYV.cjs +2 -0
  57. package/dist/fixed-window-CvESpFYV.cjs.map +1 -0
  58. package/dist/identity-8vKkyAWm.js +103 -0
  59. package/dist/identity-8vKkyAWm.js.map +1 -0
  60. package/dist/identity-Da9TkuKd.cjs +2 -0
  61. package/dist/identity-Da9TkuKd.cjs.map +1 -0
  62. package/dist/index.cjs +1 -1
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.d.ts +45 -7
  65. package/dist/index.js +908 -529
  66. package/dist/index.js.map +1 -1
  67. package/dist/indexeddb-storage-BTfIFRHF.cjs +2 -0
  68. package/dist/indexeddb-storage-BTfIFRHF.cjs.map +1 -0
  69. package/dist/{indexeddb-storage-HgkQUTyS.js → indexeddb-storage-CCA1LvtO.js} +33 -18
  70. package/dist/indexeddb-storage-CCA1LvtO.js.map +1 -0
  71. package/dist/{interactions-Ck01cEij.js → interactions-BUDLxbv1.js} +16 -12
  72. package/dist/interactions-BUDLxbv1.js.map +1 -0
  73. package/dist/interactions-NHbLKrqe.cjs +2 -0
  74. package/dist/interactions-NHbLKrqe.cjs.map +1 -0
  75. package/dist/{journey-DRK0A8u_.js → journey-BUJ4WJxP.js} +12 -12
  76. package/dist/{journey-DRK0A8u_.js.map → journey-BUJ4WJxP.js.map} +1 -1
  77. package/dist/{journey-Co9OlzrW.cjs → journey-B_tTnvac.cjs} +2 -2
  78. package/dist/{journey-Co9OlzrW.cjs.map → journey-B_tTnvac.cjs.map} +1 -1
  79. package/dist/keys-BHhw_0Wh.cjs +2 -0
  80. package/dist/keys-BHhw_0Wh.cjs.map +1 -0
  81. package/dist/keys-D5r_GH9q.js +17 -0
  82. package/dist/keys-D5r_GH9q.js.map +1 -0
  83. package/dist/{library-request-ChCar5F8.js → library-request-BKOcaKtQ.js} +2 -2
  84. package/dist/{library-request-ChCar5F8.js.map → library-request-BKOcaKtQ.js.map} +1 -1
  85. package/dist/{library-request-gMFOCNcn.cjs → library-request-BaZOi4eg.cjs} +2 -2
  86. package/dist/{library-request-gMFOCNcn.cjs.map → library-request-BaZOi4eg.cjs.map} +1 -1
  87. package/dist/{long-frames-Bky6nZDF.cjs → long-frames-CF3qiSAX.cjs} +2 -2
  88. package/dist/long-frames-CF3qiSAX.cjs.map +1 -0
  89. package/dist/{long-frames-DDumopji.js → long-frames-DI5ypfAF.js} +5 -5
  90. package/dist/long-frames-DI5ypfAF.js.map +1 -0
  91. package/dist/models/batch.d.ts +4 -0
  92. package/dist/models/bus.d.ts +32 -9
  93. package/dist/models/config.d.ts +347 -9
  94. package/dist/models/drop.d.ts +1 -1
  95. package/dist/models/health.d.ts +27 -0
  96. package/dist/models/storage.d.ts +13 -0
  97. package/dist/network-CF8UO5PK.cjs +2 -0
  98. package/dist/network-CF8UO5PK.cjs.map +1 -0
  99. package/dist/{network-BsBZ6_-Q.js → network-DdzXDI3J.js} +18 -16
  100. package/dist/network-DdzXDI3J.js.map +1 -0
  101. package/dist/openfin-BwEN0uj4.js.map +1 -1
  102. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  103. package/dist/{platform-4yYjMD-B.js → platform-Bw1btWCT.js} +16 -10
  104. package/dist/platform-Bw1btWCT.js.map +1 -0
  105. package/dist/platform-DBSKTvFn.cjs +2 -0
  106. package/dist/platform-DBSKTvFn.cjs.map +1 -0
  107. package/dist/{remote-rules-1KqfVBIu.js → remote-rules-DIcC5vVC.js} +3 -3
  108. package/dist/{remote-rules-1KqfVBIu.js.map → remote-rules-DIcC5vVC.js.map} +1 -1
  109. package/dist/{remote-rules-BHgEGlYi.cjs → remote-rules-DpFmOef2.cjs} +2 -2
  110. package/dist/{remote-rules-BHgEGlYi.cjs.map → remote-rules-DpFmOef2.cjs.map} +1 -1
  111. package/dist/sampling-BVjspJWu.cjs +2 -0
  112. package/dist/sampling-BVjspJWu.cjs.map +1 -0
  113. package/dist/{sampling-nYIWP_vP.js → sampling-Cm3WhI0a.js} +26 -36
  114. package/dist/sampling-Cm3WhI0a.js.map +1 -0
  115. package/dist/{sanitize-BiUKCUG6.js → sanitize-C-ahCFsG.js} +2 -2
  116. package/dist/{sanitize-BiUKCUG6.js.map → sanitize-C-ahCFsG.js.map} +1 -1
  117. package/dist/{sanitize-BxuPSXOk.cjs → sanitize-DHucKGdi.cjs} +2 -2
  118. package/dist/{sanitize-BxuPSXOk.cjs.map → sanitize-DHucKGdi.cjs.map} +1 -1
  119. package/dist/sender-D3fRCR8d.cjs +3 -0
  120. package/dist/sender-D3fRCR8d.cjs.map +1 -0
  121. package/dist/sender-DUUmSglb.js +1163 -0
  122. package/dist/sender-DUUmSglb.js.map +1 -0
  123. package/dist/storage/context-storage.d.ts +89 -0
  124. package/dist/storage/emergency-queue.d.ts +9 -1
  125. package/dist/storage/factory.d.ts +7 -1
  126. package/dist/storage/idb-driver.d.ts +13 -0
  127. package/dist/storage/indexeddb-storage.d.ts +13 -0
  128. package/dist/storage/local-storage.d.ts +21 -1
  129. package/dist/storage/memory-storage.d.ts +13 -0
  130. package/dist/storage-BA9RqRO-.cjs +2 -0
  131. package/dist/storage-BA9RqRO-.cjs.map +1 -0
  132. package/dist/storage-w7Tslvlq.js +17 -0
  133. package/dist/storage-w7Tslvlq.js.map +1 -0
  134. package/dist/storm-CNZjsw4T.cjs +2 -0
  135. package/dist/storm-CNZjsw4T.cjs.map +1 -0
  136. package/dist/storm-Daq2jGHU.js +10 -0
  137. package/dist/storm-Daq2jGHU.js.map +1 -0
  138. package/dist/transport/retry-engine.d.ts +7 -2
  139. package/dist/transport/status-transport.d.ts +17 -0
  140. package/dist/types-BR9t_w28.js.map +1 -1
  141. package/dist/types-C7WNpnG1.cjs.map +1 -1
  142. package/dist/utils/fixed-window.d.ts +9 -0
  143. package/dist/utils/identity.d.ts +9 -2
  144. package/dist/utils/lock.d.ts +8 -0
  145. package/dist/utils/openfin.d.ts +1 -1
  146. package/dist/utils/platform.d.ts +3 -1
  147. package/dist/web-socket-BacvKOvD.cjs +2 -0
  148. package/dist/web-socket-BacvKOvD.cjs.map +1 -0
  149. package/dist/web-socket-CpsD8WAa.js +105 -0
  150. package/dist/web-socket-CpsD8WAa.js.map +1 -0
  151. package/package.json +1 -1
  152. package/dist/batch-C4oF6XZT.cjs +0 -2
  153. package/dist/batch-C4oF6XZT.cjs.map +0 -1
  154. package/dist/batch-D-4xl7op.js.map +0 -1
  155. package/dist/bus-Cyvq-Ngx.js +0 -478
  156. package/dist/bus-Cyvq-Ngx.js.map +0 -1
  157. package/dist/bus-rOhVuRee.cjs +0 -2
  158. package/dist/bus-rOhVuRee.cjs.map +0 -1
  159. package/dist/console-BT7mcgU6.js.map +0 -1
  160. package/dist/console-Boqa7new.cjs.map +0 -1
  161. package/dist/constants-BgRS6MB0.cjs +0 -2
  162. package/dist/constants-BgRS6MB0.cjs.map +0 -1
  163. package/dist/constants-L_d5YvvQ.js +0 -160
  164. package/dist/constants-L_d5YvvQ.js.map +0 -1
  165. package/dist/errors-BDI96zKc.js.map +0 -1
  166. package/dist/errors-_xEsCVXn.cjs +0 -3
  167. package/dist/errors-_xEsCVXn.cjs.map +0 -1
  168. package/dist/fixed-window-BR0bu32Y.cjs +0 -2
  169. package/dist/fixed-window-BR0bu32Y.cjs.map +0 -1
  170. package/dist/fixed-window-Re7jIRJH.js +0 -9
  171. package/dist/fixed-window-Re7jIRJH.js.map +0 -1
  172. package/dist/identity-Bwku7zzN.cjs +0 -2
  173. package/dist/identity-Bwku7zzN.cjs.map +0 -1
  174. package/dist/identity-Dtv917nz.js +0 -98
  175. package/dist/identity-Dtv917nz.js.map +0 -1
  176. package/dist/indexeddb-storage-Cvavrf-y.cjs +0 -2
  177. package/dist/indexeddb-storage-Cvavrf-y.cjs.map +0 -1
  178. package/dist/indexeddb-storage-HgkQUTyS.js.map +0 -1
  179. package/dist/interactions-Bhe1ft8P.cjs +0 -2
  180. package/dist/interactions-Bhe1ft8P.cjs.map +0 -1
  181. package/dist/interactions-Ck01cEij.js.map +0 -1
  182. package/dist/log-record-cwFiLyPY.js +0 -17
  183. package/dist/log-record-cwFiLyPY.js.map +0 -1
  184. package/dist/log-record-jX9eWUP8.cjs +0 -2
  185. package/dist/log-record-jX9eWUP8.cjs.map +0 -1
  186. package/dist/long-frames-Bky6nZDF.cjs.map +0 -1
  187. package/dist/long-frames-DDumopji.js.map +0 -1
  188. package/dist/network-BsBZ6_-Q.js.map +0 -1
  189. package/dist/network-_4csBGBM.cjs +0 -2
  190. package/dist/network-_4csBGBM.cjs.map +0 -1
  191. package/dist/platform-4yYjMD-B.js.map +0 -1
  192. package/dist/platform-o7r1ocOu.cjs +0 -2
  193. package/dist/platform-o7r1ocOu.cjs.map +0 -1
  194. package/dist/sampling-C4my-ma0.cjs +0 -2
  195. package/dist/sampling-C4my-ma0.cjs.map +0 -1
  196. package/dist/sampling-nYIWP_vP.js.map +0 -1
  197. package/dist/sender-6vrT9fFL.cjs +0 -3
  198. package/dist/sender-6vrT9fFL.cjs.map +0 -1
  199. package/dist/sender-DFQMF39P.js +0 -1351
  200. package/dist/sender-DFQMF39P.js.map +0 -1
  201. package/dist/storm-6YYbXzT_.cjs +0 -2
  202. package/dist/storm-6YYbXzT_.cjs.map +0 -1
  203. package/dist/storm-CfO0Sam2.js +0 -10
  204. package/dist/storm-CfO0Sam2.js.map +0 -1
  205. package/dist/web-socket-Ar4cZxmd.js +0 -102
  206. package/dist/web-socket-Ar4cZxmd.js.map +0 -1
  207. package/dist/web-socket-BwJdwSHl.cjs +0 -2
  208. package/dist/web-socket-BwJdwSHl.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,55 +1,55 @@
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";
1
+ import { $t as e, Bt as t, C as n, Ct as r, En as i, Ft as a, Gt as o, Ht as s, Jt as c, Kt as l, L as u, M as d, N as f, Qt as p, R as m, St as h, Tn as g, Ut as _, V as v, Vt as y, Wt as ee, Xt as te, Yt as ne, Zt as re, _n as ie, a as ae, an as oe, bn as se, c as b, d as x, f as ce, gn as le, gt as ue, h as de, i as fe, j as pe, k as me, l as he, ln as ge, m as _e, mt as S, o as C, on as w, p as ve, pt as ye, qt as be, r as T, s as xe, tn as E, u as Se, vn as D, wn as Ce, wt as we, xn as Te, yn as Ee, z as De, zt as Oe } from "./constants-CN7GE1Lt.js";
2
+ import { n as ke, r as Ae, t as je } from "./error-like-Ywo5uRHo.js";
3
+ import { a as Me, c as Ne, i as Pe, l as Fe, n as Ie, o as Le, s as Re, u as O } from "./sampling-Cm3WhI0a.js";
4
+ import { r as ze } from "./deadline-5_PecIl5.js";
5
+ import { a as Be, i as Ve, n as He, o as k, r as A } from "./sanitize-C-ahCFsG.js";
6
+ import { a as Ue, i as j, n as We, o as Ge, r as Ke, s as qe, t as Je } from "./identity-8vKkyAWm.js";
7
+ import { r as Ye } from "./library-request-BKOcaKtQ.js";
8
+ import { i as Xe, n as Ze, t as Qe } from "./platform-Bw1btWCT.js";
9
+ import { r as $e, t as et } from "./batch-BUJh-1jZ.js";
10
+ import { n as tt, t as nt } from "./journey-BUJ4WJxP.js";
11
11
  //#region src/utils/timer.ts
12
- function P(e) {
13
- return Math.round((performance.now() - e) * Te) / Te;
12
+ function M(e) {
13
+ return Math.round((performance.now() - e) * v) / v;
14
14
  }
15
- function F(e, t, n, r, i) {
15
+ function N(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 tt(e, t, n, r, i) {
22
- let a = P(n);
21
+ function rt(e, t, n, r, i) {
22
+ let a = M(n);
23
23
  e.error(`${t} failed`, r, {
24
24
  "action.duration_ms": a,
25
25
  status: "FAILURE",
26
26
  ...i
27
- }), F(e, t, a, "FAILURE", i);
27
+ }), N(e, t, a, "FAILURE", i);
28
28
  }
29
- function nt(e, t, n, r) {
29
+ function it(e, t, n, r) {
30
30
  let i = performance.now();
31
31
  try {
32
32
  let a = n();
33
- return F(e, t, P(i), "SUCCESS", r), a;
33
+ return N(e, t, M(i), "SUCCESS", r), a;
34
34
  } catch (n) {
35
- throw tt(e, t, i, n, r), n;
35
+ throw rt(e, t, i, n, r), n;
36
36
  }
37
37
  }
38
- async function rt(e, t, n, r) {
38
+ async function at(e, t, n, r) {
39
39
  let i = performance.now();
40
40
  try {
41
41
  let a = await n();
42
- return F(e, t, P(i), "SUCCESS", r), a;
42
+ return N(e, t, M(i), "SUCCESS", r), a;
43
43
  } catch (n) {
44
- throw tt(e, t, i, n, r), n;
44
+ throw rt(e, t, i, n, r), n;
45
45
  }
46
46
  }
47
47
  //#endregion
48
48
  //#region src/core/logger.ts
49
- var it = [i, le];
50
- function at(e, t) {
49
+ var ot = [me, ge];
50
+ function st(e, t) {
51
51
  let n = t.guard("record.sanitize_failed", "The library could not read the error reason.", () => {
52
- if (!(e instanceof Error) && !Oe(e)) return;
52
+ if (!(e instanceof Error) && !Ae(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 at(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 ot(e, t, n) {
60
+ function ct(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 st(e, t) {
63
+ function lt(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 = Oe(e), r = {}, i = 0;
66
+ let t = e, n = Ae(e), r = {}, i = 0;
67
67
  for (let e of Object.keys(t)) {
68
68
  let a = t[e];
69
- (!n || !ke.has(e)) && De(a) && (r[e] = a, i++);
69
+ (!n || !je.has(e)) && ke(a) && (r[e] = a, i++);
70
70
  }
71
71
  return i === 0 ? void 0 : r;
72
72
  });
73
73
  }
74
- function ct(e) {
75
- if (!A(e) || e instanceof Error) return !1;
74
+ function ut(e) {
75
+ if (!O(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 lt(e) {
80
- return it.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
79
+ function dt(e) {
80
+ return ot.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
81
81
  }
82
- function I(e, t) {
82
+ function P(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 L = class e {
85
+ var F = 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 = lt(t);
91
+ this.bind = e, this.namespace = t, this.options = n, this.levelType = dt(t);
92
92
  }
93
93
  child(t, n = {}) {
94
94
  return new e(this.bind, `${this.namespace}.${t}`, { scopedContext: {
@@ -120,124 +120,156 @@ var L = class e {
120
120
  logEvent = (e, t) => {
121
121
  this.write("INFO", "event", e, t);
122
122
  };
123
- logMetric = (e, t, n = l, r = "gauge", i) => {
123
+ logMetric = (e, t, n = m, i = "gauge", a) => {
124
124
  if (!Number.isFinite(t)) {
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 = I(i, this.bind().diagnostics), o = {
129
- ...a,
128
+ let o = P(a, this.bind().diagnostics), s = {
129
+ ...o,
130
130
  "metric.name": e,
131
131
  "metric.value": t,
132
132
  "metric.unit": n,
133
- "metric.type": r,
134
- [_.attributeKeys]: Object.keys(a)
133
+ "metric.type": i,
134
+ [r.attributeKeys]: Object.keys(o)
135
135
  };
136
- this.write("INFO", "metric", e, o, !0);
136
+ this.write("INFO", "metric", e, s, !0);
137
137
  };
138
- timeSync = (e, t, n) => nt(this, e, t, n);
139
- timeAsync = (e, t, n) => rt(this, e, t, n);
138
+ timeSync = (e, t, n) => it(this, e, t, n);
139
+ timeAsync = (e, t, n) => at(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.isRotating()) {
144
+ a.diagnostics.count("record.dropped_during_rotation");
145
+ return;
146
+ }
143
147
  if (!a.builder.isEnabled(e, this.namespace, t)) {
144
148
  this.mirrors(a, e) && this.print(a, e, n, r, void 0, null);
145
149
  return;
146
150
  }
147
- let { record: o, dropped: s } = a.builder.build({
151
+ let o = {
148
152
  level: e,
149
153
  type: t,
150
154
  body: n,
151
155
  namespace: this.namespace,
152
156
  scoped: this.options.scopedContext,
153
- payload: i ? r : I(r, a.diagnostics)
154
- }), c = o ? o.body : s === "sampling" ? n : void 0;
155
- t !== "metric" && c !== void 0 && a.breadcrumbs.push({
157
+ payload: i ? r : P(r, a.diagnostics)
158
+ }, { record: s, dropped: c } = a.builder.build(o), l = !!a.config.redact || a.config.processors.length > 0, u = t !== "metric" && a.config.capturePolicy.breadcrumbs > 0, d = c === "sampling" && l && u ? a.builder.build(o, !0) : void 0, f = s ?? d?.record ?? null, p = f ? f.body : c === "sampling" && !l ? n : void 0;
159
+ u && p !== void 0 && a.breadcrumbs.push({
156
160
  t: Date.now(),
157
161
  category: t === "action" ? "action" : t === "event" ? "event" : "log",
158
- message: c
159
- }), this.print(a, e, n, r, void 0, o, s), a.emit(o);
162
+ message: p
163
+ }), this.print(a, e, n, r, void 0, f, d?.dropped ?? c), a.emit(s);
160
164
  }
161
165
  writeError(e, t, n, r) {
162
166
  let i = this.bind();
163
167
  if (i.isDestroyed()) return;
168
+ if (i.isRotating()) {
169
+ i.diagnostics.count("record.dropped_during_rotation");
170
+ return;
171
+ }
164
172
  let a = i.builder.isEnabled(e, this.namespace);
165
173
  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.", () => 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);
174
+ let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => ut(n)) ?? !1), s = o ? n : r, c = o ? void 0 : n, l = c === void 0 ? void 0 : st(c, i.diagnostics), u = l === void 0 ? void 0 : ct(c, l, i.diagnostics);
167
175
  if (!a) {
168
176
  this.print(i, e, t, s, u, null);
169
177
  return;
170
178
  }
171
- let d = l ? st(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
179
+ let d = l ? lt(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
172
180
  level: e,
173
181
  type: this.levelType,
174
182
  body: t,
175
183
  namespace: this.namespace,
176
184
  scoped: this.options.scopedContext,
177
185
  payload: {
178
- ...I(s, i.diagnostics),
186
+ ...P(s, i.diagnostics),
179
187
  ...l ? {
180
188
  "error.type": l.name,
181
189
  "error.message": l.message,
182
190
  "error.stack_trace": l.stack
183
191
  } : {},
184
- ...d === void 0 ? {} : { [ve]: d },
185
- [v]: i.breadcrumbs.snapshot()
192
+ ...d === void 0 ? {} : { [xe]: d },
193
+ [C]: i.breadcrumbs.snapshot()
186
194
  }
187
195
  });
188
196
  this.print(i, e, t, s, u, f, p), i.emit(f);
189
197
  }
190
198
  print(e, t, n, r, i, a, o) {
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);
199
+ if (!e.config.redact && e.config.processors.length === 0) {
200
+ e.console.write(this.namespace, t, n, r, i);
201
+ return;
202
+ }
203
+ if (a) {
204
+ e.console.write(this.namespace, t, a.body, a.attributes);
205
+ return;
206
+ }
207
+ if (o === "processor" || o === "redact" || o === "malformed" || !e.config.enabled || !e.console.accepts(t)) return;
208
+ let s = e.builder.build({
209
+ level: t,
210
+ type: this.levelType,
211
+ body: n,
212
+ namespace: this.namespace,
213
+ scoped: this.options.scopedContext,
214
+ payload: {
215
+ ...P(r, e.diagnostics),
216
+ ...i ? {
217
+ "error.type": i.name,
218
+ "error.message": i.message,
219
+ "error.stack_trace": i.stack
220
+ } : {}
221
+ }
222
+ }, !0).record;
223
+ s && e.console.write(this.namespace, t, s.body, s.attributes);
192
224
  }
193
225
  mirrors(e, t) {
194
226
  return e.config.enabled && e.console.accepts(t);
195
227
  }
196
- }, ut = "overflow", dt = /* @__PURE__ */ new Set([
197
- b,
198
- O,
199
- w,
228
+ }, ft = "overflow", pt = /* @__PURE__ */ new Set([
229
+ ce,
230
+ x,
200
231
  T,
201
- D,
202
- y,
203
- he
232
+ _e,
233
+ b,
234
+ he,
235
+ Se
204
236
  ]);
205
- function ft(e = {}) {
237
+ function mt(e = {}) {
206
238
  let t = {};
207
239
  for (let n of Object.keys(e).sort()) {
208
- if (n.startsWith("metric.") || dt.has(n)) continue;
240
+ if (n.startsWith("metric.") || pt.has(n)) continue;
209
241
  let r = e[n];
210
242
  (typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (t[n] = r);
211
243
  }
212
244
  return t;
213
245
  }
214
- function pt(e) {
246
+ function ht(e, t) {
215
247
  if (!Array.isArray(e)) return null;
216
- let t = Math.min(e.length, 51);
217
- return Array.from({ length: t }, (t, n) => e[n]);
248
+ let n = t === 0 ? e.length : Math.min(e.length, t + 1);
249
+ return Array.from({ length: n }, (t, n) => e[n]);
218
250
  }
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]));
251
+ function gt(e, t) {
252
+ return Array.isArray(e) && (t === 0 || e.length <= t) && e.every((t, n) => typeof t == "number" && Number.isFinite(t) && (n === 0 || t > e[n - 1]));
221
253
  }
222
- function ht(e, t, n) {
223
- let r = {
254
+ function _t(e, t, n) {
255
+ let i = {
224
256
  "metric.name": e.name,
225
257
  "metric.unit": e.unit,
226
258
  "metric.type": e.kind,
227
- [_.start]: n,
228
- [_.attributeKeys]: Object.keys(t.attributes)
259
+ [r.start]: n,
260
+ [r.attributeKeys]: Object.keys(t.attributes)
229
261
  };
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
262
+ return e.kind === "counter" ? (i["metric.value"] = t.sum, i) : {
263
+ ...i,
264
+ [r.count]: t.count,
265
+ [r.sum]: t.sum,
266
+ [r.min]: t.min,
267
+ [r.max]: t.max,
268
+ [r.bounds]: e.boundaries,
269
+ [r.buckets]: t.buckets
238
270
  };
239
271
  }
240
- function gt(e, t, n) {
272
+ function vt(e, t, n) {
241
273
  let r = {
242
274
  name: e,
243
275
  kind: "counter",
@@ -248,48 +280,54 @@ function gt(e, t, n) {
248
280
  n(r, e, t);
249
281
  } };
250
282
  }
251
- function _t(e, t, n) {
283
+ function yt(e, t, n) {
252
284
  let r = {
253
285
  name: e,
254
286
  kind: "histogram",
255
287
  unit: t.unit ?? "count",
256
- boundaries: t.boundaries ?? Ce
288
+ boundaries: t.boundaries ?? h
257
289
  };
258
290
  return { record: (e, t) => {
259
291
  n(r, e, t);
260
292
  } };
261
293
  }
262
- var vt = class {
294
+ var bt = class {
263
295
  intervalMs;
264
296
  emit;
265
297
  diagnostics;
298
+ policy;
266
299
  instruments = /* @__PURE__ */ new Map();
267
300
  timer = null;
268
301
  startedAt = 0;
269
- constructor(e, t, n) {
270
- this.intervalMs = e, this.emit = t, this.diagnostics = n;
302
+ constructor(e, t, n, r = {
303
+ maxSeries: 100,
304
+ maxInstruments: 1e3,
305
+ maxHistogramBoundaries: 50
306
+ }) {
307
+ this.intervalMs = e, this.emit = t, this.diagnostics = n, this.policy = r;
271
308
  }
272
309
  record(e, t, n) {
273
310
  !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
311
  let r = this.instrumentOf(e);
275
- r && (this.add(r, t, ft(n)), this.arm());
312
+ r && (this.add(r, t, mt(n)), this.arm());
276
313
  });
277
314
  }
278
315
  collect() {
279
316
  this.timer !== null && (clearTimeout(this.timer), this.timer = null);
280
317
  let e = `${String(this.startedAt)}000000`, t = [...this.instruments.values()];
281
318
  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));
319
+ for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, _t(n, t, e));
283
320
  }
284
321
  instrumentOf(e) {
285
322
  let t = this.instruments.get(e.name);
286
323
  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.`);
324
+ if (this.policy.maxInstruments && this.instruments.size >= this.policy.maxInstruments) return this.diagnostics.count("record.dropped_by_ceiling"), null;
325
+ let n = ht(e.boundaries, this.policy.maxHistogramBoundaries), r = gt(n, this.policy.maxHistogramBoundaries);
326
+ e.kind === "histogram" && !r && this.diagnostics.report("config.invalid", `The boundaries of the metric ${e.name} must meet metrics.maxHistogramBoundaries and contain finite numbers in ascending order. The library uses the default boundaries.`);
289
327
  let i = {
290
328
  def: {
291
329
  ...e,
292
- boundaries: r ? n : [...Ce]
330
+ boundaries: r ? n : [...h]
293
331
  },
294
332
  series: /* @__PURE__ */ new Map()
295
333
  };
@@ -297,7 +335,7 @@ var vt = class {
297
335
  }
298
336
  add(e, t, n) {
299
337
  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) {
338
+ if (!i && this.policy.maxSeries > 0 && e.series.size >= this.policy.maxSeries && (r = ft, i = e.series.get(r), a = { [ve]: !0 }), !i) {
301
339
  let n = e.def.kind === "histogram" ? e.def.boundaries.length + 1 : 0, o = Array(n).fill(0);
302
340
  i = {
303
341
  attributes: a,
@@ -316,82 +354,82 @@ var vt = class {
316
354
  arm() {
317
355
  this.timer === null && (this.startedAt = Date.now(), this.timer = setTimeout(() => {
318
356
  this.collect();
319
- }, this.intervalMs()), Me(this.timer));
357
+ }, this.intervalMs()), ze(this.timer));
320
358
  }
321
- }, yt = {
359
+ }, xt = {
322
360
  TRACE: "debug",
323
361
  DEBUG: "debug",
324
362
  INFO: "info",
325
363
  WARN: "warn",
326
364
  ERROR: "error",
327
365
  FATAL: "error"
328
- }, bt = class {
366
+ }, St = class {
329
367
  settings;
330
368
  diagnostics;
331
369
  limits;
332
- constructor(e, t, n = m) {
370
+ constructor(e, t, n = a) {
333
371
  this.settings = e, this.diagnostics = t, this.limits = n;
334
372
  }
335
373
  update(e) {
336
374
  this.settings = e;
337
375
  }
338
376
  accepts(e) {
339
- return this.settings.level === null || !Object.hasOwn(E, this.settings.level) ? !1 : E[e] >= E[this.settings.level];
377
+ return this.settings.level === null || !Object.hasOwn(S, this.settings.level) ? !1 : S[e] >= S[this.settings.level];
340
378
  }
341
379
  write(e, t, n, r, i) {
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];
380
+ if (!this.accepts(t) || typeof console > "u" || Be()) return;
381
+ let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = xt[t];
344
382
  this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
345
383
  let c = [];
346
- i !== void 0 && c.push(i), r !== void 0 && c.push(Be(r, this.limits, this.diagnostics)), j(() => {
384
+ i !== void 0 && c.push(i), r !== void 0 && c.push(He(r, this.limits, this.diagnostics)), k(() => {
347
385
  console[s](a, o.namespace, e, o[t], "", n, ...c);
348
386
  });
349
387
  });
350
388
  }
351
- }, xt = class {
389
+ }, Ct = class {
352
390
  value = 0;
353
391
  next() {
354
392
  return ++this.value;
355
393
  }
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);
394
+ }, wt = /^[0-9a-f]{32}$/, Tt = /^[0-9a-f]{16}$/, Et = /[1-9a-f]/;
395
+ function Dt(e) {
396
+ return wt.test(e.traceId) && Et.test(e.traceId) && Tt.test(e.spanId) && Et.test(e.spanId);
359
397
  }
360
- function Et() {
361
- return We(16);
398
+ function Ot() {
399
+ return Ge(16);
362
400
  }
363
- function Dt() {
364
- return We(8);
401
+ function kt() {
402
+ return Ge(8);
365
403
  }
366
- function Ot(e) {
404
+ function At(e) {
367
405
  return {
368
- traceId: Et(),
369
- spanId: Dt(),
406
+ traceId: Ot(),
407
+ spanId: kt(),
370
408
  traceFlags: 1,
371
409
  startedAt: Date.now(),
372
410
  reason: e,
373
411
  ended: !1
374
412
  };
375
413
  }
376
- function kt(e, t, n) {
414
+ function jt(e, t, n) {
377
415
  return `00-${e}-${t}-${(n & 255).toString(16).padStart(2, "0")}`;
378
416
  }
379
- function At(e) {
417
+ function Mt(e) {
380
418
  return {
381
419
  traceId: e.traceId,
382
420
  spanId: e.spanId,
383
421
  traceFlags: e.traceFlags
384
422
  };
385
423
  }
386
- var jt = class {
424
+ var Nt = class {
387
425
  diagnostics;
388
426
  maxAgeMs;
389
427
  load;
390
428
  spans;
391
- ambient = Ot("start");
429
+ ambient = At("start");
392
430
  otel;
393
- constructor(e, t = n, r, i) {
394
- this.diagnostics = e, this.maxAgeMs = t, this.load = r, this.spans = i;
431
+ constructor(e, t = se, n, r) {
432
+ this.diagnostics = e, this.maxAgeMs = t, this.load = n, this.spans = r;
395
433
  }
396
434
  async loadOtel() {
397
435
  if (this.load) try {
@@ -404,7 +442,7 @@ var jt = class {
404
442
  return this.activeSpanContext() ?? this.ambientContext();
405
443
  }
406
444
  ambientContext() {
407
- return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), At(this.ambient);
445
+ return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Mt(this.ambient);
408
446
  }
409
447
  activeSpanContext() {
410
448
  let e = this.otel;
@@ -412,7 +450,7 @@ var jt = class {
412
450
  let t = e.trace.getActiveSpan();
413
451
  if (t === void 0) return;
414
452
  let n = t.spanContext();
415
- if (Tt(n)) return {
453
+ if (Dt(n)) return {
416
454
  traceId: n.traceId,
417
455
  spanId: n.spanId,
418
456
  traceFlags: n.traceFlags
@@ -421,8 +459,8 @@ var jt = class {
421
459
  }
422
460
  rotate(e) {
423
461
  let t = this.ambient;
424
- this.ambient = Ot(e);
425
- let n = At(this.ambient);
462
+ this.ambient = At(e);
463
+ let n = Mt(this.ambient);
426
464
  return this.finish(t), n;
427
465
  }
428
466
  end() {
@@ -449,9 +487,9 @@ var jt = class {
449
487
  n.propagation.inject(n.context.active(), t);
450
488
  }), t.traceparent) return { headers: t };
451
489
  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 } : {
490
+ if (!a?.enabled()) return t[Ee] = jt(i.traceId, i.spanId, i.traceFlags), { headers: t };
491
+ let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ? kt() : i.spanId;
492
+ return t[Ee] = jt(i.traceId, c, s), !e || !o ? { headers: t } : {
455
493
  headers: t,
456
494
  span: {
457
495
  traceId: i.traceId,
@@ -460,16 +498,20 @@ var jt = class {
460
498
  }
461
499
  };
462
500
  }
463
- }, Mt = class {
501
+ }, Pt = class {
464
502
  buffer;
465
503
  pointer = 0;
466
504
  filled = !1;
467
505
  capacity;
468
506
  constructor(e) {
469
- this.capacity = Math.max(e, 1), this.buffer = Array(this.capacity);
507
+ this.capacity = e === 0 ? 0 : Math.max(e, 1), this.buffer = Array(this.capacity);
508
+ }
509
+ resize(e) {
510
+ let t = this.snapshot().slice(-e);
511
+ if (this.capacity = e, this.buffer = Array(e), this.pointer = 0, this.filled = !1, e) for (let e of t) this.push(e);
470
512
  }
471
513
  push(e) {
472
- this.buffer[this.pointer] = e, this.pointer = (this.pointer + 1) % this.capacity, this.pointer === 0 && (this.filled = !0);
514
+ this.capacity !== 0 && (this.buffer[this.pointer] = e, this.pointer = (this.pointer + 1) % this.capacity, this.pointer === 0 && (this.filled = !0));
473
515
  }
474
516
  clear() {
475
517
  this.buffer.fill(void 0), this.pointer = 0, this.filled = !1;
@@ -477,45 +519,45 @@ var jt = class {
477
519
  snapshot() {
478
520
  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);
479
521
  }
480
- }, Nt = Object.keys(E), Pt = ["gzip", "none"], Ft = [
522
+ }, Ft = Object.keys(S), It = ["gzip", "none"], Lt = [
481
523
  "omit",
482
524
  "same-origin",
483
525
  "include"
484
- ], It = [
526
+ ], Rt = [
485
527
  "auto",
486
528
  "indexeddb",
487
529
  "localstorage",
488
530
  "memory",
489
531
  "none"
490
- ], Lt = ["storage", "memory"], Rt = [
532
+ ], zt = ["storage", "memory"], Bt = [
491
533
  "auto",
492
534
  "sender",
493
535
  "forwarder",
494
536
  "off"
495
- ], zt = [
537
+ ], Vt = [
496
538
  "auto",
497
539
  "provider",
498
540
  "client"
499
- ], Bt = [
541
+ ], Ht = [
500
542
  "auto",
501
543
  "context",
502
544
  "tab",
503
545
  "origin"
504
- ], Vt = [
546
+ ], Ut = [
505
547
  "error",
506
548
  "warn",
507
549
  "info",
508
550
  "log"
509
- ], Ht = ["limited", "until-delivered"], Ut = {
551
+ ], Wt = ["limited", "until-delivered"], Gt = {
510
552
  logFlushIntervalMs: [100, 6e4],
511
553
  logBatchSize: [1, 1e3],
512
554
  metricFlushIntervalMs: [100, 6e4],
513
555
  metricBatchSize: [1, 1e3]
514
- }, Wt = {
556
+ }, Kt = {
515
557
  maxBatches: [1, 5e3],
516
558
  maxAgeMs: [6e4, 6048e5],
517
559
  maxAttempts: [1, 20]
518
- }, Gt = {
560
+ }, qt = {
519
561
  maxBodyChars: [256, 65536],
520
562
  maxAttributeChars: [256, 65536],
521
563
  maxAttributeCount: [1, 1024],
@@ -523,30 +565,73 @@ var jt = class {
523
565
  maxDepth: [1, 16],
524
566
  maxArrayLength: [1, 1e4],
525
567
  maxNodes: [100, 1e5],
526
- maxRecordBytes: [1024, h]
527
- }, Kt = [6e4, 864e5], qt = [
568
+ maxRecordBytes: [1024, n]
569
+ }, Jt = [6e4, 864e5], I = [0, 2147483647], L = [0, 2 ** 53 - 1], Yt = [1, 2 ** 53 - 1], Xt = {
570
+ capturePolicy: { ranges: {
571
+ breadcrumbs: [0, 1e6],
572
+ errorDedupeMs: I,
573
+ maxErrorSignatures: L,
574
+ errorsPerWindow: L,
575
+ consolePerWindow: L,
576
+ longFramesPerWindow: L,
577
+ webSocketPerWindow: L,
578
+ windowMs: I,
579
+ errorCeiling: L
580
+ } },
581
+ metadata: { ranges: {} },
582
+ persistence: { ranges: {} },
583
+ diagnostics: { ranges: { throttleMs: I } },
584
+ correlation: { ranges: {
585
+ sessionIdleMs: I,
586
+ sessionTouchMs: I,
587
+ traceMaxAgeMs: I
588
+ } },
589
+ metrics: { ranges: {
590
+ maxSeries: L,
591
+ maxInstruments: L,
592
+ maxHistogramBoundaries: L
593
+ } },
594
+ buffering: {
595
+ ranges: {
596
+ maxPendingRecords: L,
597
+ maxPendingBytes: L
598
+ },
599
+ choices: { overflow: [
600
+ "drop-oldest",
601
+ "drop-newest",
602
+ "persist"
603
+ ] }
604
+ },
605
+ delivery: { ranges: {
606
+ requestTimeoutMs: [1, I[1]],
607
+ maxConcurrentRequests: Yt,
608
+ retryBaseDelayMs: I,
609
+ retryMaxDelayMs: I,
610
+ retryIdleDelayMs: I,
611
+ batchesPerDrain: Yt
612
+ } }
613
+ }, Zt = [
528
614
  "errors",
529
615
  "rejections",
530
616
  "resourceErrors",
531
617
  "fetch",
532
618
  "xhr",
533
619
  "httpMetrics",
534
- "interactions",
535
620
  "navigation",
536
621
  "webVitals",
537
622
  "longFrames",
538
623
  "fullUrls",
539
624
  "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";
625
+ ], Qt = "null", R = `a level name: ${z(Ft)}`, $t = `true, false or a list of ${z(Ut)}`, en = "a list of strings and RegExp patterns", tn = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", nn = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", rn = "a list of strings";
541
626
  function z(e) {
542
627
  let t = e.map((e) => `"${e}"`);
543
628
  return `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
544
629
  }
545
- function en(e) {
630
+ function an(e) {
546
631
  return typeof e == "string" ? `"${e}"` : typeof e == "function" ? "a function" : typeof e == "object" && e ? "an object" : String(e);
547
632
  }
548
633
  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}.`);
634
+ e.report("config.invalid", `${t} must be ${n}. The value is ${an(r)}. The library keeps ${i}.`);
550
635
  }
551
636
  function V(e, t, n, r, i) {
552
637
  if (t === void 0) return r;
@@ -556,31 +641,34 @@ function V(e, t, n, r, i) {
556
641
  function H(e, t, n, r) {
557
642
  return t === void 0 ? n : typeof t == "boolean" ? t : (B(r, e, "true or false", t, String(n)), n);
558
643
  }
559
- function tn(e, t, n, r) {
644
+ function on(e, t, n, r) {
560
645
  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);
561
646
  }
562
- function nn(e, t, n, r, i) {
647
+ function U(e, t, n, r, i) {
563
648
  if (t === void 0) return r;
564
649
  let [a, o] = n;
565
650
  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);
566
651
  }
567
- function U(e, t, n, r, i) {
652
+ function sn(e, t, n) {
653
+ return e === void 0 ? t : e === null ? null : typeof e == "number" && Number.isSafeInteger(e) && e >= 0 ? e : (B(n, "loggerCache.maxEntries", "a nonnegative safe integer or null", e, String(t)), t);
654
+ }
655
+ function cn(e, t, n, r, i) {
568
656
  let a = t ?? {}, o = Object.keys(r);
569
- return Object.fromEntries(o.map((t) => [t, nn(`${e}.${t}`, a[t], r[t], n[t], i)]));
657
+ return Object.fromEntries(o.map((t) => [t, U(`${e}.${t}`, a[t], r[t], n[t], i)]));
570
658
  }
571
659
  function W(e) {
572
660
  if (typeof e != "string") return;
573
661
  let t = e.toUpperCase();
574
- return Nt.find((e) => e === t);
662
+ return Ft.find((e) => e === t);
575
663
  }
576
- function rn(e, t, n, r) {
664
+ function ln(e, t, n, r) {
577
665
  if (t === void 0) return n;
578
666
  let i = W(t);
579
667
  return i === void 0 ? (B(r, e, R, t, `"${n}"`), n) : i;
580
668
  }
581
- function an(e, t, n) {
669
+ function un(e, t, n) {
582
670
  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;
671
+ if (!O(e)) return B(n, "minLevels", "an object of level names", e, "the value in force"), t;
584
672
  let r = [];
585
673
  for (let [t, i] of Object.entries(e)) {
586
674
  let e = W(i);
@@ -594,85 +682,85 @@ function G(e, t, n, r, i, a) {
594
682
  let o = [], s = t;
595
683
  for (let t of s) {
596
684
  let n = i(t);
597
- n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${en(t)}. ${e} must be ${r}.`) : o.push(n);
685
+ n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${an(t)}. ${e} must be ${r}.`) : o.push(n);
598
686
  }
599
687
  return o;
600
688
  }
601
- function on(e) {
689
+ function dn(e) {
602
690
  return typeof e == "function" ? e : void 0;
603
691
  }
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;
692
+ function fn(e) {
693
+ return O(e) && typeof e.name == "string" && e.name !== "" && typeof e.install == "function" && typeof e.uninstall == "function" ? e : void 0;
606
694
  }
607
- function cn(e) {
695
+ function pn(e) {
608
696
  return typeof e == "string" ? e : void 0;
609
697
  }
610
- function ln(e) {
698
+ function mn(e) {
611
699
  return typeof e == "string" || e instanceof RegExp ? e : void 0;
612
700
  }
613
- function un(e) {
614
- return Vt.find((t) => t === e);
701
+ function hn(e) {
702
+ return Ut.find((t) => t === e);
615
703
  }
616
- function dn(e) {
704
+ function gn(e) {
617
705
  if (typeof e == "string") try {
618
706
  let { origin: t } = new URL(e);
619
- return t === Jt ? void 0 : t;
707
+ return t === Qt ? void 0 : t;
620
708
  } catch {
621
709
  return;
622
710
  }
623
711
  }
624
- function fn(e) {
625
- return e instanceof RegExp ? e : dn(e);
712
+ function _n(e) {
713
+ return e instanceof RegExp ? e : gn(e);
626
714
  }
627
- function pn(e) {
628
- return A(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
715
+ function vn(e) {
716
+ return O(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
629
717
  }
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);
718
+ function yn(e, t, n) {
719
+ if (e !== void 0) return typeof e == "function" || vn(e) ? e : (B(n, "headers", "an object of strings or a function", e, "the headers in force"), t);
632
720
  }
633
- function hn(e) {
721
+ function bn(e) {
634
722
  return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
635
723
  }
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);
724
+ function xn(e, t, n) {
725
+ return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || bn(e) ? e : (n.report("config.invalid", `serializer must be "${E}", "ecs" or an implementation. The library uses "${E}".`), E);
638
726
  }
639
- var _n = new Set(Object.keys(pe));
640
- function vn(e, t) {
727
+ var Sn = new Set(Object.keys(f));
728
+ function Cn(e, t) {
641
729
  let n = {}, r = Object.entries(e ?? {});
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.`);
730
+ for (let [e, i] of r) Sn.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.`);
643
731
  return n;
644
732
  }
645
- function yn(e, t, n) {
733
+ function wn(e, t, n) {
646
734
  if (e === void 0) return t ?? "DEBUG";
647
735
  let r = W(e);
648
736
  return r === void 0 ? (B(n, "console.level", R, e, "the console level in force"), t) : r;
649
737
  }
650
- function bn(t, n, r) {
651
- if (t === void 0) return n;
652
- if (t === !1) return {
738
+ function Tn(e, t, n) {
739
+ if (e === void 0) return t;
740
+ if (e === !1) return {
653
741
  level: null,
654
- styles: n.styles
742
+ styles: t.styles
655
743
  };
656
- if (t === !0) return {
657
- level: e,
658
- styles: n.styles
744
+ if (e === !0) return {
745
+ level: d,
746
+ styles: t.styles
659
747
  };
660
- if (typeof t == "string") {
661
- let e = W(t);
662
- return e === void 0 ? (B(r, "console", R, t, "the console level in force"), n) : {
663
- level: e,
664
- styles: n.styles
748
+ if (typeof e == "string") {
749
+ let r = W(e);
750
+ return r === void 0 ? (B(n, "console", R, e, "the console level in force"), t) : {
751
+ level: r,
752
+ styles: t.styles
665
753
  };
666
754
  }
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) : {
668
- level: yn(t.level, n.level, r),
755
+ return typeof e != "object" || !e ? (n.report("config.invalid", "console must be a boolean, a level or an object. The console settings in force stay."), t) : {
756
+ level: wn(e.level, t.level, n),
669
757
  styles: {
670
- ...n.styles,
671
- ...vn(t.styles, r)
758
+ ...t.styles,
759
+ ...Cn(e.styles, n)
672
760
  }
673
761
  };
674
762
  }
675
- function xn(e, t, n) {
763
+ function En(e, t, n) {
676
764
  let r = e ?? {};
677
765
  return {
678
766
  ...t,
@@ -681,53 +769,80 @@ function xn(e, t, n) {
681
769
  ...t.rates,
682
770
  ...r.rates
683
771
  },
684
- alwaysSampleTypes: G("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, $t, cn, n),
772
+ alwaysSampleTypes: G("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, rn, pn, n),
685
773
  remote: H("sampling.remote", r.remote, t.remote, n)
686
774
  };
687
775
  }
688
- function Sn(e, t, n) {
776
+ function Dn(e, t, n) {
689
777
  let r = e ?? {};
690
778
  return {
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)
779
+ maxTrackedSources: U("bus.maxTrackedSources", r.maxTrackedSources, [0, 2 ** 53 - 1], t.maxTrackedSources, n),
780
+ sourcePolicy: V("bus.sourcePolicy", r.sourcePolicy, ["registered", "trusted-origin"], t.sourcePolicy, n),
781
+ validation: V("bus.validation", r.validation, ["strict", "envelope"], t.validation, n),
782
+ maxMessageBytes: U("bus.maxMessageBytes", r.maxMessageBytes, [0, 2 ** 53 - 1], t.maxMessageBytes, n),
783
+ maxRecordsPerMessage: U("bus.maxRecordsPerMessage", r.maxRecordsPerMessage, [0, 2 ** 53 - 1], t.maxRecordsPerMessage, n),
784
+ maxMessagesPerSecond: U("bus.maxMessagesPerSecond", r.maxMessagesPerSecond, [0, 2 ** 53 - 1], t.maxMessagesPerSecond, n),
785
+ mode: V("bus.mode", r.mode, Bt, t.mode, n),
786
+ trustedOrigins: G("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, nn, gn, n),
787
+ openFinRole: V("bus.openFinRole", r.openFinRole, Vt, t.openFinRole, n)
694
788
  };
695
789
  }
696
- function Cn(e, t, n) {
790
+ function On(e, t, n) {
697
791
  let r = e ?? {};
698
792
  return {
699
- scope: V("journey.scope", r.scope, Bt, t.scope, n),
700
- maxAgeMs: nn("journey.maxAgeMs", r.maxAgeMs, Kt, t.maxAgeMs, n)
793
+ scope: V("journey.scope", r.scope, Ht, t.scope, n),
794
+ maxAgeMs: U("journey.maxAgeMs", r.maxAgeMs, Jt, t.maxAgeMs, n)
701
795
  };
702
796
  }
703
- function wn(e, t, n) {
797
+ function kn(e, t, n) {
704
798
  let r = e ?? {};
705
799
  return {
706
- mode: V("retention.mode", r.mode, Ht, t.mode, n),
707
- ...U("retention", r, t, Wt, n)
800
+ mode: V("retention.mode", r.mode, Wt, t.mode, n),
801
+ ...cn("retention", r, t, Kt, n)
708
802
  };
709
803
  }
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);
804
+ function An(e, t, n) {
805
+ return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? G("capture.console", e, [], $t, hn, n) : (B(n, "capture.console", $t, e, "the value in force"), t);
712
806
  }
713
- function En(e, t, n) {
807
+ function jn(e, t, n) {
714
808
  let r = e ?? {}, i = {
715
809
  ...t,
716
810
  ...r,
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)
811
+ interactions: Mn(r.interactions, t.interactions, n),
812
+ console: An(r.console, t.console, n),
813
+ longFrameThresholdMs: on("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
814
+ ignoreUrls: G("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, en, mn, n),
815
+ propagateTraceHeaderTo: G("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, tn, _n, n),
816
+ plugins: G("capture.plugins", r.plugins, t.plugins, "a list of objects with a name, install() and uninstall()", fn, n)
722
817
  };
723
- for (let e of qt) i[e] = H(`capture.${e}`, r[e], t[e], n);
818
+ for (let e of Zt) i[e] = H(`capture.${e}`, r[e], t[e], n);
724
819
  return i;
725
820
  }
726
- var Dn = {
821
+ function Mn(e, t, n) {
822
+ if (e === void 0) return t;
823
+ if (typeof e == "boolean") return e;
824
+ if (!O(e)) return n.report("config.invalid", "capture.interactions must be a boolean or an options object."), t;
825
+ let r = typeof t == "object" ? t : {}, i = e.ignoreSelector, a = i === void 0 ? r.ignoreSelector : i;
826
+ if (a != null) try {
827
+ if (typeof a != "string") throw Error("Invalid selector");
828
+ typeof document < "u" && document.createElement("div").matches(a);
829
+ } catch {
830
+ n.report("config.invalid", "capture.interactions.ignoreSelector must be a valid CSS selector or null."), a = r.ignoreSelector;
831
+ }
832
+ let o = r.actionAttribute ?? "data-observability-action";
833
+ return e.actionAttribute !== void 0 && (typeof e.actionAttribute == "string" && /^[a-z][\w-]*$/i.test(e.actionAttribute) ? o = e.actionAttribute : B(n, "capture.interactions.actionAttribute", "an attribute name of letters, digits, hyphens and underscores", e.actionAttribute, `"${o}"`)), {
834
+ actionAttribute: o,
835
+ text: H("capture.interactions.text", e.text, r.text ?? !1, n),
836
+ selector: H("capture.interactions.selector", e.selector, r.selector ?? !1, n),
837
+ ignoreSelector: typeof a == "string" || a === null ? a : void 0,
838
+ maxTextChars: U("capture.interactions.maxTextChars", e.maxTextChars, [0, 2 ** 53 - 1], r.maxTextChars ?? 50, n)
839
+ };
840
+ }
841
+ var Nn = {
727
842
  metricsEndpoint: "The library sends metric records as log records.",
728
843
  tracesEndpoint: "The library sends no span."
729
844
  };
730
- function On(e, t, n, r, i) {
845
+ function Pn(e, t, n, r, i) {
731
846
  let a = n;
732
847
  if (typeof t == "string" && t !== "") try {
733
848
  new URL(t), a = t;
@@ -735,72 +850,87 @@ function On(e, t, n, r, i) {
735
850
  i.report("config.invalid", `${e} is not a valid absolute URL: ${t}. The library keeps the value in force.`, void 0, n);
736
851
  }
737
852
  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;
853
+ return a !== "" && r !== "otlp" ? (i.report("config.invalid", `${e} needs serializer "${E}". ${Nn[e]}`), "") : a;
739
854
  }
740
- function kn(e, t, n) {
741
- let r = n ?? o, i = {
855
+ function Fn(e, t, n, r, i) {
856
+ let a = { ...n };
857
+ for (let o of Object.keys(n)) {
858
+ let s = t?.[o], c = n[o], l = r.ranges[o], u = r.choices?.[o], d = c;
859
+ typeof c == "number" && l ? d = U(`${e}.${o}`, s, l, c, i) : typeof c == "boolean" ? d = H(`${e}.${o}`, s, c, i) : u ? d = V(`${e}.${o}`, s, u, String(c), i) : s === void 0 || typeof s == "string" ? d = s ?? c : B(i, `${e}.${o}`, "a string", s, String(c)), Object.assign(a, { [o]: d });
860
+ }
861
+ return a;
862
+ }
863
+ function K(e, t, n) {
864
+ let r = n ?? u, a = Object.fromEntries(Object.keys(Xt).map((n) => [n, Fn(n, e[n], r[n], Xt[n], t)])), o = {
742
865
  ...r,
743
866
  ...e,
867
+ ...a,
868
+ lockConfiguration: H("lockConfiguration", e.lockConfiguration, r.lockConfiguration, t),
869
+ loggerCache: { maxEntries: sn(e.loggerCache?.maxEntries, r.loggerCache.maxEntries, t) },
870
+ securityContext: {
871
+ id: typeof e.securityContext?.id == "string" && e.securityContext.id || r.securityContext.id,
872
+ isolation: H("securityContext.isolation", e.securityContext?.isolation, r.securityContext.isolation, t)
873
+ },
744
874
  endpoint: e.endpoint === void 0 ? r.endpoint : e.endpoint,
745
875
  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)
876
+ minLevel: ln("minLevel", e.minLevel, r.minLevel, t),
877
+ minLevels: un(e.minLevels, r.minLevels, t),
878
+ processors: G("processors", e.processors, r.processors, "a list of functions", dn, t),
879
+ compression: V("compression", e.compression, It, r.compression, t),
880
+ credentials: V("credentials", e.credentials, Lt, r.credentials, t),
881
+ headers: "headers" in e ? yn(e.headers, r.headers, t) : r.headers,
882
+ storage: V("storage", e.storage, Rt, r.storage, t),
883
+ identity: V("identity", e.identity, zt, r.identity, t),
884
+ serializer: xn(e.serializer, n?.serializer, t),
885
+ console: Tn(e.console, r.console, t),
886
+ sampling: En(e.sampling, r.sampling, t),
887
+ bus: Dn(e.bus, r.bus, t),
888
+ batching: cn("batching", e.batching, r.batching, Gt, t),
889
+ retention: kn(e.retention, r.retention, t),
890
+ limits: cn("limits", e.limits, r.limits, qt, t),
891
+ journey: On(e.journey, r.journey, t),
892
+ capture: jn(e.capture, r.capture, t)
763
893
  };
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);
894
+ for (let n of ["metricsEndpoint", "tracesEndpoint"]) o[n] = Pn(n, e[n], r[n], o.serializer, t);
895
+ if (o.transport !== void 0 && typeof o.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), o.transport = r.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 = r.onDrop), o.contextProvider !== void 0 && typeof o.contextProvider != "function" && (t.report("config.invalid", "contextProvider must be a function. The library ignores the value."), o.contextProvider = r.contextProvider), o.transportOnExit !== void 0 && typeof o.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), o.transportOnExit = r.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.");
896
+ else if (o.endpoint !== null) try {
897
+ new URL(o.endpoint);
768
898
  } catch (e) {
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);
899
+ t.report("config.invalid", `endpoint is not a valid absolute URL: ${o.endpoint}.`, void 0, e);
900
+ }
901
+ for (let e of ["metricsEndpoint", "tracesEndpoint"]) o[e] !== "" && o.endpoint === null && !o.transport && t.report("config.invalid", `${e} needs endpoint or transport. The library sends nothing to ${e}.`);
902
+ o.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${i}'.`), i);
903
+ let s = o.sampling.defaultRate;
904
+ (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);
905
+ let c = o.sampling.remoteMaxRate;
906
+ (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);
907
+ let l = Object.entries(o.sampling.rates);
908
+ 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);
909
+ o.capture.ignoreUrls = o.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint && e !== n?.tracesEndpoint);
780
910
  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]);
911
+ o.endpoint,
912
+ o.metricsEndpoint,
913
+ o.tracesEndpoint
914
+ ]) e && !o.capture.ignoreUrls.includes(e) && (o.capture.ignoreUrls = [...o.capture.ignoreUrls, e]);
915
+ return o.delivery.retryMaxDelayMs < o.delivery.retryBaseDelayMs && (t.report("config.invalid", "delivery.retryMaxDelayMs must be at least retryBaseDelayMs."), o.delivery.retryBaseDelayMs = r.delivery.retryBaseDelayMs, o.delivery.retryMaxDelayMs = r.delivery.retryMaxDelayMs), o.capture.urlTransform !== void 0 && typeof o.capture.urlTransform != "function" && (t.report("config.invalid", "capture.urlTransform must be a function."), o.capture.urlTransform = r.capture.urlTransform), In(e, t), o;
916
+ }
917
+ function In(e, t) {
918
+ let n = /* @__PURE__ */ new Set([...Object.keys(u), ...Ce]);
789
919
  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.`);
790
- for (let n of S) {
920
+ for (let n of pe) {
791
921
  let r = e[n];
792
922
  if (typeof r != "object" || !r) continue;
793
- let i = /* @__PURE__ */ new Set([...Object.keys(o[n]), ...p[n]]);
923
+ let i = /* @__PURE__ */ new Set([...Object.keys(u[n]), ...g[n]]);
794
924
  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.`);
795
925
  }
796
926
  }
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]);
927
+ function Ln(e, t) {
928
+ for (let n of Object.keys(t)) pe.includes(n) || Object.assign(e, { [n]: t[n] });
929
+ for (let n of pe) Object.assign(e[n], t[n]);
800
930
  }
801
931
  //#endregion
802
932
  //#region src/core/context.ts
803
- var Mn = class {
933
+ var Rn = class {
804
934
  map = /* @__PURE__ */ new Map();
805
935
  set(e, t) {
806
936
  this.map.set(e, t);
@@ -811,16 +941,23 @@ var Mn = class {
811
941
  remove(e) {
812
942
  this.map.delete(e);
813
943
  }
944
+ clear() {
945
+ this.map.clear();
946
+ }
814
947
  getAll() {
815
948
  return Object.fromEntries(this.map);
816
949
  }
817
- }, Nn = class {
950
+ }, zn = class {
818
951
  handler;
819
952
  throttleMs;
953
+ consoleFallback;
820
954
  counters = /* @__PURE__ */ new Map();
821
955
  lastEmitted = /* @__PURE__ */ new Map();
822
- constructor(e, t = f) {
823
- this.handler = e, this.throttleMs = t;
956
+ constructor(e, t = De, n = !1) {
957
+ this.handler = e, this.throttleMs = t, this.consoleFallback = n;
958
+ }
959
+ setPolicy(e, t) {
960
+ this.throttleMs = e, this.consoleFallback = t;
824
961
  }
825
962
  setHandler(e) {
826
963
  this.handler = e;
@@ -842,12 +979,12 @@ var Mn = class {
842
979
  count: i
843
980
  }, { handler: s } = this;
844
981
  if (s) try {
845
- j(() => {
982
+ k(() => {
846
983
  s(o);
847
984
  });
848
- } catch (e) {
849
- this.count("handler.threw"), typeof console < "u" && j(() => {
850
- console.warn(`${de} The onDiagnostic handler threw an error.`, e);
985
+ } catch {
986
+ this.count("handler.threw"), this.consoleFallback && typeof console < "u" && k(() => {
987
+ console.warn(`${ue} The onDiagnostic handler threw an error.`);
851
988
  });
852
989
  }
853
990
  }
@@ -873,10 +1010,10 @@ var Mn = class {
873
1010
  };
874
1011
  //#endregion
875
1012
  //#region src/core/drops.ts
876
- function K(e, t) {
1013
+ function Bn(e, t) {
877
1014
  e.length < 20 && !e.includes(t) && e.push(t);
878
1015
  }
879
- var Pn = class {
1016
+ var Vn = class {
880
1017
  config;
881
1018
  diagnostics;
882
1019
  pending = /* @__PURE__ */ new Map();
@@ -895,12 +1032,12 @@ var Pn = class {
895
1032
  journeyIds: [],
896
1033
  actions: []
897
1034
  }, this.pending.set(e, r)), r.records += t.length;
898
- for (let e of n) K(r.batchIds, e);
1035
+ for (let e of n) Bn(r.batchIds, e);
899
1036
  for (let e of t) {
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);
1037
+ let t = et(e, b);
1038
+ typeof t == "string" && Bn(r.journeyIds, t);
1039
+ let n = $e(e) ? e.body : void 0;
1040
+ typeof n == "string" && Bn(r.actions, n);
904
1041
  }
905
1042
  this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
906
1043
  this.flush();
@@ -914,8 +1051,8 @@ var Pn = class {
914
1051
  if (t) {
915
1052
  this.reporting = !0;
916
1053
  for (let n of e) this.diagnostics.guard("handler.threw", "The onDrop hook threw an error.", () => {
917
- Je(() => {
918
- j(() => {
1054
+ Ye(() => {
1055
+ k(() => {
919
1056
  t(n);
920
1057
  });
921
1058
  });
@@ -923,7 +1060,7 @@ var Pn = class {
923
1060
  this.reporting = !1;
924
1061
  }
925
1062
  }
926
- }, Fn = class {
1063
+ }, Hn = class {
927
1064
  onDrop;
928
1065
  held = [];
929
1066
  actions = 0;
@@ -937,10 +1074,10 @@ var Pn = class {
937
1074
  return this.held.length;
938
1075
  }
939
1076
  push(e) {
940
- let t = N(e);
1077
+ let t = $e(e);
941
1078
  if ((t ? this.actions : this.held.length - this.actions) < (t ? 2e3 : 500)) this.actions += +!!t;
942
1079
  else {
943
- let e = this.held.findIndex((e) => N(e) === t), [n] = this.held.splice(e, 1);
1080
+ let e = this.held.findIndex((e) => $e(e) === t), [n] = this.held.splice(e, 1);
944
1081
  this.onDrop(n);
945
1082
  }
946
1083
  this.held.push(e);
@@ -949,11 +1086,11 @@ var Pn = class {
949
1086
  let e = this.held;
950
1087
  return this.held = [], this.actions = 0, e;
951
1088
  }
952
- }, In = "error.", Ln = [
953
- T,
954
- D,
955
- y
956
- ], Rn = {
1089
+ }, Un = "error.", Wn = [
1090
+ _e,
1091
+ b,
1092
+ he
1093
+ ], Gn = {
957
1094
  processor: {
958
1095
  label: "A processor",
959
1096
  code: "record.dropped_by_processor"
@@ -962,21 +1099,21 @@ var Pn = class {
962
1099
  label: "The redact hook",
963
1100
  code: "record.dropped_by_redact"
964
1101
  }
965
- }, zn = [
1102
+ }, Kn = [
966
1103
  "metric.name",
967
1104
  "metric.unit",
968
1105
  "metric.type",
969
1106
  "metric.value",
970
- ...Object.values(_),
971
- ...Object.values(C)
1107
+ ...Object.values(r),
1108
+ ...Object.values(w)
972
1109
  ];
973
- function Bn(e) {
974
- return Object.fromEntries(zn.filter((t) => t in e).map((t) => [t, e[t]]));
1110
+ function qn(e) {
1111
+ return Object.fromEntries(Kn.filter((t) => t in e).map((t) => [t, e[t]]));
975
1112
  }
976
1113
  function q(e) {
977
1114
  return e;
978
1115
  }
979
- var Vn = class {
1116
+ var Jn = class {
980
1117
  deps;
981
1118
  resourceCache = null;
982
1119
  constructor(e) {
@@ -988,91 +1125,91 @@ var Vn = class {
988
1125
  isEnabled(e, t, n) {
989
1126
  let { config: r } = this.deps;
990
1127
  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];
1128
+ if (n !== void 0 && ye.includes(n)) return !0;
1129
+ let i = this.deps.remote.sampling?.minLevelFor(t) ?? Ie(t, r);
1130
+ return S[e] >= S[i];
994
1131
  }
995
- build(e) {
996
- let { config: t, diagnostics: n, tracing: r, journey: i, sequence: a, limits: o, remote: s } = this.deps;
997
- if (!this.isEnabled(e.level, e.namespace, e.type)) return n.count("record.dropped_by_level"), {
1132
+ build(e, t = !1) {
1133
+ let { config: n, diagnostics: r, tracing: i, journey: a, sequence: o, limits: s, remote: c } = this.deps;
1134
+ if (!t && !this.isEnabled(e.level, e.namespace, e.type)) return r.count("record.dropped_by_level"), {
998
1135
  record: null,
999
1136
  dropped: "level"
1000
1137
  };
1001
- let c = e.trace ?? r.resolve(), l = i.current();
1002
- if (!Pe({
1138
+ let l = e.trace ?? i.resolve(), u = a.current(), d = Le({
1003
1139
  level: e.level,
1004
1140
  type: e.type,
1005
1141
  namespace: e.namespace,
1006
- journeyId: l?.id ?? "",
1007
- traceId: c.traceId,
1142
+ journeyId: u?.id ?? "",
1143
+ traceId: l.traceId,
1008
1144
  aggregated: e.aggregated
1009
- }, t, s.sampling?.current() ?? null)) return n.count("record.dropped_by_sampling"), {
1145
+ }, n, c.sampling?.current() ?? null);
1146
+ if (!t && !d) return r.count("record.dropped_by_sampling"), {
1010
1147
  record: null,
1011
1148
  dropped: "sampling"
1012
1149
  };
1013
- let u = a.next(), d = Ze(n), f = Ye(d, t.capture.fullUrls), p, m = 0;
1150
+ let f = o.next(), p = Qe(r), m = n.metadata.pageUrl ? Xe(p, n.capture.fullUrls, n.capture.urlTransform, r) : "", h, g = 0;
1014
1151
  try {
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 = {
1152
+ let t = A(this.deps.context.getAll(), s, r), n = A(this.provided(), s, r), i = A(e.scoped ?? {}, s, r), a = A(e.payload ?? {}, s, r);
1153
+ g = t.bytes + n.bytes + i.bytes + a.bytes, h = {
1017
1154
  ...q(t.value),
1018
- ...q(r.value),
1155
+ ...q(n.value),
1019
1156
  ...q(i.value),
1020
1157
  ...q(a.value)
1021
1158
  };
1022
1159
  } catch (e) {
1023
- n.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), p = { [ge]: !0 };
1160
+ r.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), h = { [de]: !0 };
1024
1161
  }
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);
1027
- h !== e.body && n.count("record.truncated");
1028
- let g = {
1029
- timeUnixNano: Ie(),
1030
- traceId: c.traceId,
1031
- spanId: c.spanId,
1032
- traceFlags: c.traceFlags,
1033
- severityNumber: se[e.level],
1162
+ Object.assign(h, e.fixed), h[ce] = e.type, h[x] = f, h[T] = e.namespace, h[_e] = m, u && (h[b] = u.id, h[he] = u.name, u.parentId !== void 0 && (h[Se] = u.parentId));
1163
+ let _ = Ve(e.body, s.maxBodyChars);
1164
+ _ !== e.body && r.count("record.truncated");
1165
+ let v = {
1166
+ timeUnixNano: Fe(),
1167
+ traceId: l.traceId,
1168
+ spanId: l.spanId,
1169
+ traceFlags: l.traceFlags,
1170
+ severityNumber: oe[e.level],
1034
1171
  severityText: e.level,
1035
- body: h,
1036
- attributes: p,
1172
+ body: _,
1173
+ attributes: h,
1037
1174
  resource: this.resource()
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);
1175
+ }, y = n.processors.map((e) => [e, "processor"]);
1176
+ if (n.redact && y.push([n.redact, "redact"]), y.length > 0) {
1177
+ let t = this.applyHooks(v, y, e.fixed);
1041
1178
  if (typeof t == "string") return {
1042
1179
  record: null,
1043
1180
  dropped: t
1044
1181
  };
1045
- ({record: g, bytes: m} = t);
1182
+ ({record: v, bytes: g} = t);
1046
1183
  }
1047
- if (m > o.maxRecordBytes) {
1048
- n.report("record.truncated", "The attributes are larger than the size limit. The library dropped the caller attributes.", {
1049
- bytes: m,
1050
- body: g.body
1184
+ if (g > s.maxRecordBytes) {
1185
+ r.report("record.truncated", "The attributes are larger than the size limit. The library dropped the caller attributes.", {
1186
+ bytes: g,
1187
+ body: v.body
1051
1188
  });
1052
1189
  let t = {
1053
- [b]: e.type,
1054
- [O]: u,
1055
- [w]: e.namespace,
1056
- [fe]: !0,
1057
- [be]: m
1190
+ [ce]: e.type,
1191
+ [x]: f,
1192
+ [T]: e.namespace,
1193
+ [ae]: !0,
1194
+ [fe]: g
1058
1195
  };
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);
1063
- let i = g.attributes[v];
1196
+ for (let e of Wn) e in v.attributes && (t[e] = v.attributes[e]);
1197
+ for (let [e, n] of Object.entries(v.attributes)) e.startsWith(Un) && (t[e] = n);
1198
+ let n = A(t, s, r).bytes;
1199
+ n > s.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, xe), n = A(t, s, r).bytes);
1200
+ let i = v.attributes[C];
1064
1201
  if (i !== void 0) {
1065
- let e = M(i, o, n).bytes;
1066
- r + e <= o.maxRecordBytes && (t[v] = i);
1202
+ let e = A(i, s, r).bytes;
1203
+ n + e <= s.maxRecordBytes && (t[C] = i);
1067
1204
  }
1068
- Object.assign(t, e.fixed), g.attributes = t;
1205
+ Object.assign(t, e.fixed), v.attributes = t;
1069
1206
  }
1070
- return { record: g };
1207
+ return { record: v };
1071
1208
  }
1072
1209
  redactForwarded(e) {
1073
1210
  let { redact: t } = this.deps.config;
1074
1211
  if (!t) return e;
1075
- let n = [[t, "redact"]], r = this.applyHooks(e, n, Bn(e.attributes));
1212
+ let n = [[t, "redact"]], r = this.applyHooks(e, n, qn(e.attributes));
1076
1213
  return typeof r == "string" ? null : r.record;
1077
1214
  }
1078
1215
  applyHooks(e, t, n) {
@@ -1082,7 +1219,7 @@ var Vn = class {
1082
1219
  if (typeof t == "string") return t;
1083
1220
  r = t;
1084
1221
  }
1085
- let { diagnostics: i, limits: a } = this.deps, o = M(r.attributes, a, i), s = q(o.value);
1222
+ let { diagnostics: i, limits: a } = this.deps, o = A(r.attributes, a, i), s = q(o.value);
1086
1223
  return Object.assign(s, n), {
1087
1224
  record: {
1088
1225
  ...r,
@@ -1092,7 +1229,7 @@ var Vn = class {
1092
1229
  };
1093
1230
  }
1094
1231
  runHook(e, t, n) {
1095
- let { diagnostics: r } = this.deps, { label: i, code: a } = Rn[t], o;
1232
+ let { diagnostics: r } = this.deps, { label: i, code: a } = Gn[t], o;
1096
1233
  try {
1097
1234
  o = e(n);
1098
1235
  } catch (e) {
@@ -1100,9 +1237,9 @@ var Vn = class {
1100
1237
  }
1101
1238
  if (o === null) return r.count(a), t;
1102
1239
  let s = o ?? n;
1103
- return Fe(s) ? Le(s.severityText) ? {
1240
+ return Ne(s) ? Re(s.severityText) ? {
1104
1241
  ...s,
1105
- severityNumber: se[s.severityText]
1242
+ severityNumber: oe[s.severityText]
1106
1243
  } : (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
1244
  }
1108
1245
  provided() {
@@ -1110,7 +1247,7 @@ var Vn = class {
1110
1247
  if (!e) return {};
1111
1248
  let { diagnostics: t } = this.deps, n = t.guard("handler.threw", "The contextProvider threw an error. The record has no attributes from it.", () => {
1112
1249
  let t = e();
1113
- return t === void 0 ? {} : A(t) && typeof t.then != "function" ? t : null;
1250
+ return t === void 0 ? {} : O(t) && typeof t.then != "function" ? t : null;
1114
1251
  });
1115
1252
  return n === null && t.report("config.invalid", "contextProvider must return an object of attributes. The library ignores the value."), n ?? {};
1116
1253
  }
@@ -1118,34 +1255,34 @@ var Vn = class {
1118
1255
  if (this.resourceCache) return this.resourceCache;
1119
1256
  let { config: e, identity: n, platform: r } = this.deps;
1120
1257
  return this.resourceCache = {
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,
1258
+ [o]: e.serviceName,
1259
+ [l]: e.serviceVersion,
1260
+ [y]: e.environment,
1261
+ [te]: ie,
1262
+ [re]: D,
1263
+ [ne]: le,
1264
+ [s]: r.platform,
1265
+ [be]: n.sessionId,
1266
+ [c]: n.tabId,
1130
1267
  [t]: n.contextId,
1131
- [Ee]: r.userAgent,
1132
- ...r.openfinUuid === void 0 ? {} : { [ne]: r.openfinUuid },
1133
- ...r.openfinName === void 0 ? {} : { [ee]: r.openfinName }
1268
+ ...e.metadata.userAgent ? { [Oe]: r.userAgent } : {},
1269
+ ...!e.metadata.openfin || r.openfinUuid === void 0 ? {} : { [ee]: r.openfinUuid },
1270
+ ...!e.metadata.openfin || r.openfinName === void 0 ? {} : { [_]: r.openfinName }
1134
1271
  }, this.resourceCache;
1135
1272
  }
1136
- }, Hn = 1e3, Un = {
1273
+ }, Yn = 1e3, Xn = {
1137
1274
  start: "ui.start",
1138
1275
  interaction: "ui.interaction",
1139
1276
  navigation: "ui.navigation",
1140
1277
  explicit: "ui.trace",
1141
1278
  maxAge: "ui.trace"
1142
1279
  };
1143
- function Wn(e) {
1144
- return `${String(Math.round(e * Hn))}000`;
1280
+ function Zn(e) {
1281
+ return `${String(Math.round(e * Yn))}000`;
1145
1282
  }
1146
- function Gn(e) {
1283
+ function Qn(e) {
1147
1284
  return {
1148
- name: Un[e.reason],
1285
+ name: Xn[e.reason],
1149
1286
  kind: "internal",
1150
1287
  traceId: e.traceId,
1151
1288
  spanId: e.spanId,
@@ -1156,40 +1293,49 @@ function Gn(e) {
1156
1293
  attributes: {}
1157
1294
  };
1158
1295
  }
1159
- function Kn(e) {
1296
+ function $n(e) {
1160
1297
  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"
1298
+ [w.kind]: e.kind,
1299
+ [w.parentId]: e.parentSpanId,
1300
+ [w.start]: Zn(e.startMs),
1301
+ [w.end]: Zn(e.endMs),
1302
+ [w.status]: e.error ? "error" : "unset"
1166
1303
  };
1167
1304
  }
1168
1305
  //#endregion
1169
1306
  //#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,
1307
+ var er = {
1308
+ errors: async () => (await import("./errors-BhC7HTSt.js")).ErrorCapture,
1309
+ network: async () => (await import("./network-DdzXDI3J.js")).NetworkCapture,
1310
+ interactions: async () => (await import("./interactions-BUDLxbv1.js")).InteractionCapture,
1174
1311
  webVitals: async () => (await import("./web-vitals-Bflr5jSA.js")).WebVitalsCapture,
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) {
1312
+ longFrames: async () => (await import("./long-frames-DI5ypfAF.js")).LongFrameCapture,
1313
+ console: async () => (await import("./console-DbAZYJuy.js")).ConsoleCapture
1314
+ }, tr = /* @__PURE__ */ new WeakMap(), nr = 0;
1315
+ function rr(e) {
1316
+ let t = tr.get(e);
1317
+ return t === void 0 && (t = ++nr, tr.set(e, t)), t;
1318
+ }
1319
+ var ir = Symbol.for(p), ar = Symbol.for(e), or = ["batching", "retention"], sr = {
1320
+ endpoint: null,
1321
+ metricsEndpoint: "",
1322
+ tracesEndpoint: "",
1323
+ headers: void 0,
1324
+ credentials: "omit",
1325
+ transport: void 0,
1326
+ transportOnExit: void 0
1327
+ }, cr = Object.keys(sr);
1328
+ function lr(e) {
1184
1329
  return JSON.stringify({
1185
1330
  ...e,
1331
+ urlTransform: e.urlTransform ? rr(e.urlTransform) : void 0,
1186
1332
  webVitalsLoader: e.webVitalsLoader !== void 0,
1187
1333
  ignoreUrls: e.ignoreUrls.map(String),
1188
1334
  propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String),
1189
- plugins: e.plugins.map(Xn)
1335
+ plugins: e.plugins.map(rr)
1190
1336
  });
1191
1337
  }
1192
- function $n(e) {
1338
+ function ur(e) {
1193
1339
  return {
1194
1340
  ...e,
1195
1341
  endpoint: null,
@@ -1203,15 +1349,29 @@ function $n(e) {
1203
1349
  }
1204
1350
  };
1205
1351
  }
1206
- function er(e) {
1352
+ function dr(e) {
1207
1353
  return !!e.endpoint || !!e.metricsEndpoint || !!e.tracesEndpoint || e.transport !== void 0;
1208
1354
  }
1209
- function X(e) {
1210
- return e.sdkVersion === k;
1355
+ function fr(e) {
1356
+ return e.sdkVersion === D;
1211
1357
  }
1212
- var Z = class e {
1358
+ var J = class e {
1359
+ rotating = !1;
1360
+ closingContext = !1;
1361
+ mismatchVersion = null;
1362
+ contextMismatch = !1;
1363
+ rotation;
1364
+ memoryStorage;
1365
+ explicitSecurityContext;
1366
+ ownerAdopted = !1;
1367
+ isRotating() {
1368
+ return this.rotating;
1369
+ }
1370
+ setConfigurationLocked(e) {
1371
+ typeof e == "boolean" && (this.config.lockConfiguration = e);
1372
+ }
1213
1373
  static local = null;
1214
- sdkVersion = k;
1374
+ sdkVersion = D;
1215
1375
  diagnostics;
1216
1376
  config;
1217
1377
  platform;
@@ -1219,10 +1379,10 @@ var Z = class e {
1219
1379
  stores;
1220
1380
  identityBuiltAs;
1221
1381
  sessionTouch;
1222
- context = new Mn();
1382
+ context = new Rn();
1223
1383
  breadcrumbs;
1224
1384
  tracing;
1225
- sequence = new xt();
1385
+ sequence = new Ct();
1226
1386
  journey;
1227
1387
  builder;
1228
1388
  remote = { sampling: null };
@@ -1235,7 +1395,7 @@ var Z = class e {
1235
1395
  storageBuiltAs;
1236
1396
  sender;
1237
1397
  senderLoad;
1238
- pendingRecords = new Fn((e) => {
1398
+ pendingRecords = new Hn((e) => {
1239
1399
  this.dropHeld(e);
1240
1400
  });
1241
1401
  captures = [];
@@ -1245,7 +1405,7 @@ var Z = class e {
1245
1405
  navigationTiming: !1,
1246
1406
  longFrames: !1
1247
1407
  };
1248
- bootBuffer = new Fn((e) => {
1408
+ bootBuffer = new Hn((e) => {
1249
1409
  this.dropHeld(e);
1250
1410
  });
1251
1411
  forwardBuffer = [];
@@ -1264,20 +1424,20 @@ var Z = class e {
1264
1424
  this.role() === "forwarder" && (this.tracing.end(), this.sendForwarded());
1265
1425
  };
1266
1426
  constructor(e, t = !1) {
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, {
1427
+ this.diagnostics = new zn(e.onDiagnostic), this.platform = Ze(this.diagnostics), this.degraded = t || this.onServer(), this.config = K(this.allowed(e), this.diagnostics), this.explicitSecurityContext = !!e.securityContext?.id, this.config.securityContext.id ||= j(this.diagnostics), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.identityBuiltAs = this.config.identity, this.stores = this.identityBuiltAs === "memory" || this.onServer() ? Ke() : Je, this.identity = qe(this.diagnostics, this.stores, this.config.correlation.sessionIdleMs), this.sessionTouch = new We(this.diagnostics, this.stores, this.config.correlation.sessionTouchMs, this.config.correlation.sessionIdleMs), this.breadcrumbs = new Pt(this.config.capturePolicy.breadcrumbs);
1428
+ let n = (e) => Pe(e, this.config.sampling.defaultRate);
1429
+ this.tracing = new Nt(this.diagnostics, this.config.correlation.traceMaxAgeMs || Infinity, this.config.otelLoader, {
1270
1430
  enabled: () => this.config.tracesEndpoint !== "",
1271
1431
  keeps: n,
1272
1432
  onEnd: (e) => {
1273
- n(e.traceId) && this.recordSpan(Gn(e));
1433
+ n(e.traceId) && this.recordSpan(Qn(e));
1274
1434
  }
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,
1435
+ }), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new St(this.config.console, this.diagnostics, this.limits), this.drops = new Vn(this.config, this.diagnostics), this.journeyOptions = {
1436
+ ...nt,
1277
1437
  maxAgeMs: this.config.journey.maxAgeMs
1278
- }, this.journey = new $e(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
1438
+ }, this.journey = new tt(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
1279
1439
  this.bus?.broadcastJourney(e);
1280
- }, this.stores), this.builder = new Vn({
1440
+ }, this.stores), this.builder = new Jn({
1281
1441
  remote: this.remote,
1282
1442
  config: this.config,
1283
1443
  limits: this.limits,
@@ -1288,26 +1448,26 @@ var Z = class e {
1288
1448
  sequence: this.sequence,
1289
1449
  identity: this.identity,
1290
1450
  platform: this.platform
1291
- }), this.meter = new vt(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
1451
+ }), this.meter = new bt(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
1292
1452
  this.emitPoint(e, t, n);
1293
- }, this.diagnostics);
1453
+ }, this.diagnostics, this.config.metrics);
1294
1454
  }
1295
1455
  addBreadcrumb(e, t) {
1296
- this.diagnostics.guard("record.sanitize_failed", "The library could not add the breadcrumb.", () => {
1456
+ this.rotating || this.destroyed || this.diagnostics.guard("record.sanitize_failed", "The library could not add the breadcrumb.", () => {
1297
1457
  let n = {
1298
1458
  t: Date.now(),
1299
1459
  category: "custom",
1300
- message: ze(String(e), this.limits.maxBodyChars)
1460
+ message: Ve(String(e), this.limits.maxBodyChars)
1301
1461
  };
1302
1462
  if (t !== void 0) {
1303
- let e = Be(t, this.limits, this.diagnostics);
1304
- n.data = A(e) ? e : { value: e };
1463
+ let e = He(t, this.limits, this.diagnostics);
1464
+ n.data = O(e) ? e : { value: e };
1305
1465
  }
1306
1466
  this.breadcrumbs.push(n);
1307
1467
  });
1308
1468
  }
1309
1469
  recordMetric(e, t, n) {
1310
- this.destroyed || this.meter.record(e, t, n);
1470
+ !this.destroyed && !this.rotating && this.meter.record(e, t, n);
1311
1471
  }
1312
1472
  recordSpan(e) {
1313
1473
  if (this.config.tracesEndpoint === "") return;
@@ -1315,9 +1475,9 @@ var Z = class e {
1315
1475
  level: "INFO",
1316
1476
  type: "span",
1317
1477
  body: e.name,
1318
- namespace: Se,
1478
+ namespace: Te,
1319
1479
  payload: e.attributes,
1320
- fixed: Kn(e),
1480
+ fixed: $n(e),
1321
1481
  trace: {
1322
1482
  traceId: e.traceId,
1323
1483
  spanId: e.spanId,
@@ -1327,38 +1487,39 @@ var Z = class e {
1327
1487
  this.emit(t);
1328
1488
  }
1329
1489
  emitPoint(e, t, n) {
1330
- let { record: i } = this.builder.build({
1490
+ let { record: r } = this.builder.build({
1331
1491
  level: "INFO",
1332
1492
  type: "metric",
1333
1493
  body: e,
1334
- namespace: r,
1494
+ namespace: we,
1335
1495
  payload: t,
1336
1496
  fixed: n,
1337
1497
  aggregated: !0
1338
1498
  });
1339
- this.emit(i);
1499
+ this.emit(r);
1340
1500
  }
1341
- busAccept = (e, t) => {
1342
- this.destroyed || this.ensureBus().then((n) => {
1343
- n && !this.destroyed && this.diagnostics.guard("bus.send_failed", "The bus could not accept a direct message from a child frame.", () => {
1344
- n.acceptDirect(e, t);
1501
+ busCanAccept = (e, t) => this.bus?.isRegistered(e, t) ?? !1;
1502
+ busAccept = (e, t, n) => {
1503
+ this.destroyed || this.ensureBus().then((r) => {
1504
+ r && !this.destroyed && this.diagnostics.guard("bus.send_failed", "The bus could not accept a direct message from a child frame.", () => {
1505
+ r.acceptDirect(e, t, n);
1345
1506
  });
1346
1507
  });
1347
1508
  };
1348
1509
  static pinned() {
1349
- return globalThis[J] ?? null;
1510
+ return globalThis[ir] ?? null;
1350
1511
  }
1351
1512
  static current() {
1352
1513
  let t = e.local;
1353
1514
  if (t) return t.destroyed ? null : t;
1354
1515
  let n = e.pinned();
1355
- return n && X(n) ? n : null;
1516
+ return n && fr(n) ? n : null;
1356
1517
  }
1357
1518
  static stopped() {
1358
1519
  let t = e.local;
1359
1520
  if (t?.destroyed) return t;
1360
- let n = globalThis[Y];
1361
- return n && X(n) ? n : null;
1521
+ let n = globalThis[ar];
1522
+ return n && fr(n) ? n : null;
1362
1523
  }
1363
1524
  isDestroyed() {
1364
1525
  return this.destroyed;
@@ -1369,33 +1530,60 @@ var Z = class e {
1369
1530
  e.local = null;
1370
1531
  let i = e.pinned();
1371
1532
  if (i) {
1372
- if (!X(i)) return e.startDegraded(t, i.sdkVersion);
1533
+ if (!fr(i)) return e.startDegraded(t, i.sdkVersion);
1373
1534
  if (!i.destroyed) return i.reconfigure(t), i;
1374
1535
  }
1375
1536
  let a = new e(t);
1376
- return a.tunablesLocked = !n, globalThis[J] = a, Reflect.deleteProperty(globalThis, Y), a.init(), a;
1537
+ return a.tunablesLocked = !n, globalThis[ir] = a, Reflect.deleteProperty(globalThis, ar), a.init(), a;
1377
1538
  }
1378
1539
  static startDegraded(t, n) {
1379
1540
  let r = new e(t, !0);
1380
1541
  e.local = r;
1381
1542
  let i = typeof n == "string" ? n : "before 0.9.0";
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.`, {
1543
+ return r.mismatchVersion = i, r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${D}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
1383
1544
  found: i,
1384
- own: k
1545
+ own: D
1385
1546
  }), r.init(), r;
1386
1547
  }
1387
1548
  reconfigure(e) {
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.");
1549
+ if (this.rotating) {
1550
+ this.diagnostics.report("config.locked", "Configuration cannot change during security-context rotation.");
1551
+ return;
1552
+ }
1553
+ if (this.config.lockConfiguration) {
1554
+ let t = K(e, this.diagnostics, this.config);
1555
+ Y(this.config, t) || this.diagnostics.report("config.locked", "Runtime configuration is locked. Use setConfigurationLocked(false) to unlock it explicitly.");
1556
+ return;
1557
+ }
1558
+ let t = this.keepDestination(this.keepRouting(this.allowed(e)));
1559
+ !this.tunablesLocked && t.securityContext?.id && (this.explicitSecurityContext = !0);
1560
+ for (let e of ["correlation", "persistence"]) (e !== "persistence" || this.tunablesLocked || this.senderLoad !== void 0) && t[e] && !Y({
1561
+ ...this.config[e],
1562
+ ...t[e]
1563
+ }, this.config[e]) && (this.diagnostics.report("config.invalid", `${e} cannot change after startup.`), Object.assign(t, { [e]: this.config[e] }));
1564
+ let n = lr(this.config.capture), r = K(t, this.diagnostics, this.config);
1565
+ this.keepStartupTunables(r), Ln(this.config, r), this.breadcrumbs.resize(this.config.capturePolicy.breadcrumbs), this.diagnostics.setHandler(this.config.onDiagnostic), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), lr(this.config.capture) !== n && this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
1390
1566
  }
1391
1567
  onServer() {
1392
1568
  return this.platform.platform === "node";
1393
1569
  }
1394
1570
  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;
1571
+ return this.degraded ? (this.onServer() && !this.serverReported && dr(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.")), ur(e)) : e;
1572
+ }
1573
+ keepRouting(e) {
1574
+ if (!this.tunablesLocked || this.degraded || !this.config.securityContext.isolation) return e;
1575
+ let t = K(e, new zn(), this.config), n = cr.filter((e) => !Y(t[e], this.config[e]));
1576
+ if (t.securityContext.id !== this.config.securityContext.id && n.push("securityContext.id"), n.length === 0) return e;
1577
+ let r = { ...e };
1578
+ for (let e of cr) n.includes(e) && Reflect.deleteProperty(r, e);
1579
+ if (n.includes("securityContext.id")) {
1580
+ let t = { ...e.securityContext };
1581
+ Reflect.deleteProperty(t, "id"), r.securityContext = t;
1582
+ }
1583
+ return this.diagnostics.report("config.invalid", `Isolation refuses changes to ${n.join(", ")}. Use rotateSecurityContext() for these changes. To permit them, set securityContext.isolation: false in a separate configure() call. The other settings apply.`), r;
1396
1584
  }
1397
1585
  keepStartupTunables(e) {
1398
- if (this.senderLoad !== void 0 && this.keepSections(e, Zn), !this.tunablesLocked) {
1586
+ if (this.senderLoad !== void 0 && this.keepSections(e, or), !this.tunablesLocked) {
1399
1587
  this.tunablesLocked = !0, Object.assign(this.limits, e.limits), this.journeyOptions.maxAgeMs = e.journey.maxAgeMs;
1400
1588
  return;
1401
1589
  }
@@ -1404,7 +1592,7 @@ var Z = class e {
1404
1592
  e.journey.maxAgeMs !== t && (this.diagnostics.report("config.invalid", `journey.maxAgeMs cannot change after startup. It stays ${String(t)}.`, { requested: e.journey.maxAgeMs }), e.journey.maxAgeMs = t);
1405
1593
  }
1406
1594
  keepSections(e, t) {
1407
- for (let n of t) JSON.stringify(e[n]) !== JSON.stringify(this.config[n]) && (this.diagnostics.report("config.invalid", `${n} cannot change after startup. The values in force stay.`, { requested: e[n] }), Object.assign(e, { [n]: this.config[n] }));
1595
+ for (let n of t) Y(e[n], this.config[n]) || (this.diagnostics.report("config.invalid", `${n} cannot change after startup. The values in force stay.`, { requested: e[n] }), Object.assign(e, { [n]: this.config[n] }));
1408
1596
  }
1409
1597
  keepBuiltStorage() {
1410
1598
  let e = this.storageBuiltAs;
@@ -1454,9 +1642,27 @@ var Z = class e {
1454
1642
  }
1455
1643
  async buildBus() {
1456
1644
  try {
1457
- let { Bus: e } = await import("./bus-Cyvq-Ngx.js");
1645
+ let { Bus: e } = await import("./bus-DeOPHWaD.js");
1458
1646
  if (this.destroyed) return null;
1459
1647
  let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
1648
+ onSecurityContext: (e) => {
1649
+ if (this.explicitSecurityContext && this.config.securityContext.id !== e) return this.contextMismatch = !0, this.diagnostics.report("security.context_mismatch", "The configured security context differs from the upstream owner."), !1;
1650
+ if (this.contextMismatch = !1, this.config.securityContext.id !== e) {
1651
+ if (this.ownerAdopted) {
1652
+ this.drops.add("security_context", [
1653
+ ...this.bootBuffer.take(),
1654
+ ...this.pendingRecords.take(),
1655
+ ...this.forwardBuffer
1656
+ ]), this.forwardBuffer = [], this.context.clear(), this.breadcrumbs.clear();
1657
+ let e = this.rotating;
1658
+ this.rotating = !0, this.meter.collect();
1659
+ let t = this.sessionTouch.stored();
1660
+ this.resetSession(t !== void 0 && t !== this.identity.sessionId ? t : j(this.diagnostics)), this.rotating = e;
1661
+ }
1662
+ this.config.securityContext.id = e;
1663
+ }
1664
+ return this.ownerAdopted = !0, !0;
1665
+ },
1460
1666
  onRecords: (e) => {
1461
1667
  this.ingestForwarded(e);
1462
1668
  },
@@ -1489,7 +1695,11 @@ var Z = class e {
1489
1695
  async buildSender() {
1490
1696
  this.storageBuiltAs = this.config.storage;
1491
1697
  try {
1492
- let { Sender: e } = await import("./sender-DFQMF39P.js"), t = this.destroyed ? null : await e.create({
1698
+ let { Sender: e } = await import("./sender-DUUmSglb.js"), t = this.destroyed ? null : await e.create({
1699
+ storage: this.memoryStorage,
1700
+ onStorage: (e) => {
1701
+ e.name === "memory" && (this.memoryStorage = e);
1702
+ },
1493
1703
  config: this.config,
1494
1704
  diagnostics: this.diagnostics,
1495
1705
  onGap: this.reportGap,
@@ -1513,15 +1723,16 @@ var Z = class e {
1513
1723
  if (this.degraded) return;
1514
1724
  let e = ++this.captureGeneration, t = this.config.capture, n = [];
1515
1725
  (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");
1516
- let [r, a] = await Promise.all([Promise.all(n.map((e) => this.loadCapture(e))), t.webSocket ? this.loadWebSocket() : void 0]);
1726
+ let [r, i] = await Promise.all([Promise.all(n.map((e) => this.loadCapture(e))), t.webSocket ? this.loadWebSocket() : void 0]);
1517
1727
  if (e !== this.captureGeneration || this.destroyed) return;
1518
1728
  this.uninstallCaptures();
1519
- let o = {
1729
+ let a = {
1730
+ isActive: () => !this.destroyed && !this.rotating,
1520
1731
  config: this.config,
1521
1732
  diagnostics: this.diagnostics,
1522
1733
  breadcrumbs: this.breadcrumbs,
1523
1734
  tracing: this.tracing,
1524
- logger: new L(() => this, i),
1735
+ logger: new F(() => this, me),
1525
1736
  once: this.captureOnce,
1526
1737
  recordMetric: (e, t, n) => {
1527
1738
  this.recordMetric(e, t, n);
@@ -1530,9 +1741,9 @@ var Z = class e {
1530
1741
  this.recordSpan(e);
1531
1742
  }
1532
1743
  };
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));
1744
+ for (let e of r) e && this.captures.push(new e(a));
1745
+ let o = i ? [...t.plugins, new i(this.diagnostics, this.config)] : t.plugins;
1746
+ for (let e of o) this.captures.push(this.pluginCapture(e));
1536
1747
  for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
1537
1748
  e.install();
1538
1749
  });
@@ -1544,19 +1755,19 @@ var Z = class e {
1544
1755
  this.captures.length = 0;
1545
1756
  }
1546
1757
  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);
1758
+ return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-CpsD8WAa.js")).WebSocketCapture);
1548
1759
  }
1549
1760
  pluginCapture(e) {
1550
1761
  let { name: t } = e, n = (e, t, n) => {
1551
1762
  this.recordMetric(e, t, n);
1552
1763
  }, r = {
1553
- logger: new L(() => this, `${i}.${t}`),
1554
- counter: (e, t = {}) => gt(e, t, n),
1555
- histogram: (e, t = {}) => _t(e, t, n),
1764
+ logger: new F(() => this, `${me}.${t}`),
1765
+ counter: (e, t = {}) => vt(e, t, n),
1766
+ histogram: (e, t = {}) => yt(e, t, n),
1556
1767
  addBreadcrumb: (e, t) => {
1557
1768
  this.addBreadcrumb(e, t);
1558
1769
  },
1559
- ownRequest: Je
1770
+ ownRequest: Ye
1560
1771
  };
1561
1772
  return {
1562
1773
  name: t,
@@ -1569,23 +1780,34 @@ var Z = class e {
1569
1780
  };
1570
1781
  }
1571
1782
  loadCapture(e) {
1572
- return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, qn[e]);
1783
+ return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, er[e]);
1573
1784
  }
1574
- registerWorker(e) {
1575
- this.destroyed || this.constructBus().then((t) => {
1576
- t && !this.destroyed && (this.diagnostics.guard("bus.send_failed", "The library could not register the worker.", () => {
1577
- t.attachWorker(e);
1785
+ registerWorker(e, t = {}) {
1786
+ let n = !1, r;
1787
+ return this.destroyed ? () => void 0 : (this.constructBus().then((i) => {
1788
+ !i || this.destroyed || n || (this.diagnostics.guard("bus.send_failed", "The library could not register the worker.", () => {
1789
+ r = i.attachWorker(e, t);
1578
1790
  }), this.ensureBus());
1791
+ }), () => {
1792
+ n = !0, r?.();
1579
1793
  });
1580
1794
  }
1795
+ registerFrame(e, t) {
1796
+ let n = !1, r;
1797
+ return this.constructBus().then((i) => {
1798
+ !i || this.destroyed || n || (r = this.diagnostics.guard("bus.send_failed", "The frame could not be registered.", () => i.registerFrame(e, t)), this.ensureBus());
1799
+ }), () => {
1800
+ n = !0, r?.();
1801
+ };
1802
+ }
1581
1803
  async destroy() {
1582
1804
  if (this.destroyed) return;
1583
1805
  this.meter.collect(), this.tracing.end(), this.destroyed = !0, this.degraded || removeEventListener("pagehide", this.onPageHide), this.uninstallCaptures();
1584
1806
  let t = this.sender?.destroy();
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);
1807
+ this.journey.destroy(), this.sendForwarded(), this.bus?.destroy(), this.drops.add("load_failed", this.pendingRecords.take()), await t, await this.senderLoad, await this.rotation?.catch(() => void 0), await this.memoryStorage?.close(), e.pinned() === this && (Reflect.deleteProperty(globalThis, ir), globalThis[ar] = this);
1586
1808
  }
1587
1809
  emit(e) {
1588
- e && !this.destroyed && (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.bootBuffer.push(e));
1810
+ !e || this.destroyed || this.rotating && !this.closingContext || (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.bootBuffer.push(e));
1589
1811
  }
1590
1812
  route(e) {
1591
1813
  this.role() === "forwarder" ? this.forward(e) : this.deliver(e);
@@ -1606,19 +1828,26 @@ var Z = class e {
1606
1828
  this.forwardBuffer = [], e.length > 0 && this.bus?.sendRecords(e);
1607
1829
  }
1608
1830
  ingestForwarded(e) {
1609
- if (!Array.isArray(e)) this.diagnostics.count("record.dropped_malformed");
1610
- else for (let t of e) {
1611
- if (!Fe(t)) {
1831
+ if (this.destroyed) return;
1832
+ if (!Array.isArray(e)) {
1833
+ this.diagnostics.count("record.dropped_malformed");
1834
+ return;
1835
+ }
1836
+ let t = [];
1837
+ for (let n of e) {
1838
+ if (!Ne(n)) {
1612
1839
  this.diagnostics.count("record.dropped_malformed");
1613
1840
  continue;
1614
1841
  }
1615
- if (!Ae(t, this.config, this.remote.sampling?.current() ?? null)) {
1842
+ if (!Me(n, this.config, this.remote.sampling?.current() ?? null)) {
1616
1843
  this.diagnostics.count("record.dropped_by_sampling");
1617
1844
  continue;
1618
1845
  }
1619
- let e = this.builder.redactForwarded(t);
1620
- e && this.deliver(e);
1846
+ let e = this.builder.redactForwarded(n);
1847
+ e && t.push(e);
1621
1848
  }
1849
+ if (this.rotating) this.drops.add("security_context", t);
1850
+ else for (let e of t) this.deliver(e);
1622
1851
  }
1623
1852
  releaseBootBuffer() {
1624
1853
  let e = this.bootBuffer.take(), { processors: t, redact: n } = this.config, r = t.length === 0 && n === void 0 ? this.journey.current() : null;
@@ -1630,24 +1859,117 @@ var Z = class e {
1630
1859
  reportGap = (e, t) => {
1631
1860
  this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
1632
1861
  let n = Date.now();
1633
- n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new L(() => this, le).warn("stored records were dropped before delivery", {
1862
+ n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new F(() => this, ge).warn("stored records were dropped before delivery", {
1634
1863
  "gap.batches": e.batches,
1635
1864
  "gap.records": e.records,
1636
1865
  "gap.reason": e.reason
1637
1866
  }));
1638
1867
  };
1639
1868
  regenerateTabId() {
1640
- let e = He(this.diagnostics);
1869
+ let e = j(this.diagnostics);
1641
1870
  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.", {
1642
1871
  was: this.identity.tabId,
1643
1872
  now: e
1644
- }), this.identity.tabId = e, Ve(e, this.diagnostics, this.stores), this.builder.invalidateResource();
1873
+ }), this.identity.tabId = e, Ue(e, this.diagnostics, this.stores), this.builder.invalidateResource();
1645
1874
  }
1646
1875
  newSession() {
1876
+ this.destroyed || this.resetSession(j(this.diagnostics));
1877
+ }
1878
+ resetSession(e) {
1879
+ this.meter.collect(), this.tracing.rotate("explicit"), this.journey.end(), this.breadcrumbs.clear(), this.identity.sessionId = e, this.sessionTouch.restart(e), this.builder.invalidateResource();
1880
+ }
1881
+ rotateSecurityContext(e, t = {}) {
1882
+ if (this.rotation) return Promise.reject(/* @__PURE__ */ Error("A security-context rotation is already running."));
1883
+ let n = t.pending ?? "discard", r = t.timeoutMs ?? 5e3;
1884
+ return !O(e) || !O(e.delivery) || ![
1885
+ "discard",
1886
+ "flush",
1887
+ "retain",
1888
+ "carry"
1889
+ ].includes(n) || !Number.isFinite(r) || r < 0 || e.id !== void 0 && (typeof e.id != "string" || e.id.length === 0) ? Promise.reject(/* @__PURE__ */ Error("Invalid security-context rotation options.")) : this.destroyed ? Promise.reject(/* @__PURE__ */ Error("The runtime has stopped.")) : (this.rotating = !0, this.rotation = this.rotateContext(e, n, r).finally(() => {
1890
+ this.rotating = !1, this.rotation = void 0;
1891
+ }), this.rotation);
1892
+ }
1893
+ async rotateContext(e, t, n) {
1894
+ if (await this.started, this.role() === "forwarder") throw Error("Rotate the security context on the upstream owner, or use bus.mode: sender for an independent identity.");
1895
+ await this.senderLoad;
1896
+ let r = this.config.securityContext.id, i = e.id ?? j(this.diagnostics);
1897
+ if (i === r) throw Error("A rotation requires a different security-context id.");
1898
+ let a = {
1899
+ ...sr,
1900
+ ...e.delivery
1901
+ }, o = this.diagnostics.snapshot()["config.invalid"] ?? 0, s = K(this.allowed({
1902
+ ...a,
1903
+ securityContext: { id: i }
1904
+ }), this.diagnostics, {
1905
+ ...this.config,
1906
+ ...sr
1907
+ });
1908
+ if ((this.diagnostics.snapshot()["config.invalid"] ?? 0) !== o) throw Error("Invalid delivery settings for the next security context.");
1909
+ let c = e.context ? Object.fromEntries(Object.entries(e.context)) : void 0, l = /* @__PURE__ */ new Set([
1910
+ this.config.endpoint,
1911
+ this.config.metricsEndpoint,
1912
+ this.config.tracesEndpoint
1913
+ ]), u = /* @__PURE__ */ new Set([
1914
+ s.endpoint,
1915
+ s.metricsEndpoint,
1916
+ s.tracesEndpoint
1917
+ ]);
1918
+ s.capture.ignoreUrls = s.capture.ignoreUrls.filter((e) => !l.has(e) || u.has(e)), this.closingContext = !0;
1919
+ try {
1920
+ this.meter.collect(), this.tracing.end(), this.journey.end();
1921
+ } finally {
1922
+ this.closingContext = !1;
1923
+ }
1924
+ let d = [
1925
+ ...this.bootBuffer.take(),
1926
+ ...this.pendingRecords.take(),
1927
+ ...this.forwardBuffer
1928
+ ];
1929
+ this.forwardBuffer = [];
1930
+ let f = this.sender;
1931
+ this.sender = void 0, this.senderLoad = void 0;
1932
+ let p = await f?.retire(t, n, r) ?? {
1933
+ buffered: [],
1934
+ stored: []
1935
+ };
1647
1936
  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();
1937
+ let m = [...d, ...p.buffered], h = p.stored.flatMap((e) => e.records);
1938
+ t !== "retain" && t !== "carry" && this.drops.add("security_context", [...m, ...h]), s.lockConfiguration = this.config.lockConfiguration, Ln(this.config, s), this.remote.sampling = null, this.context.clear(), c && this.context.setMany(c), this.breadcrumbs.clear(), this.newSession(), this.builder.invalidateResource(), await this.syncSender(), this.bus?.rotateContext(), t === "carry" && (this.rotating = !1, await this.carry(m, p.stored)), this.diagnostics.report("security.rotated", "The runtime rotated its security context.", { pending: t });
1939
+ }
1940
+ async carry(e, t) {
1941
+ for (let t of e) this.route(t);
1942
+ this.sender && await this.sender.adopt(t, this.config.securityContext.id);
1943
+ }
1944
+ async health() {
1945
+ let e = this.sender?.stats() ?? {
1946
+ pending: 0,
1947
+ inFlight: 0,
1948
+ lastSendAt: null
1949
+ }, t = [];
1950
+ this.mismatchVersion && t.push("runtime.version_mismatch"), this.contextMismatch && t.push("security.context_mismatch"), this.ready && this.hasDestination() && this.role() === "sender" && !this.sender && t.push("sender.unavailable");
1951
+ let { sourcePolicy: n, validation: r, maxMessageBytes: i, maxRecordsPerMessage: a, maxMessagesPerSecond: o, maxTrackedSources: s } = this.config.bus;
1952
+ return {
1953
+ ...e,
1954
+ pending: e.pending + this.bootBuffer.length + this.pendingRecords.length + this.forwardBuffer.length,
1955
+ stored: await this.sender?.queueDepth() ?? 0,
1956
+ sdkVersion: this.sdkVersion,
1957
+ owningSdkVersion: this.mismatchVersion,
1958
+ status: this.destroyed ? "stopped" : this.rotating ? "rotating" : t.length ? "degraded" : this.ready ? "ready" : "starting",
1959
+ mode: this.role() === "forwarder" ? "forwarder" : this.hasDestination() ? "sender" : "console-only",
1960
+ senderReady: this.sender !== void 0 && !this.destroyed && !this.rotating,
1961
+ configurationLocked: this.config.lockConfiguration,
1962
+ issues: t,
1963
+ securityContext: { ...this.config.securityContext },
1964
+ bus: {
1965
+ sourcePolicy: n,
1966
+ validation: r,
1967
+ maxMessageBytes: i,
1968
+ maxRecordsPerMessage: a,
1969
+ maxMessagesPerSecond: o,
1970
+ maxTrackedSources: s
1971
+ }
1972
+ };
1651
1973
  }
1652
1974
  async stats() {
1653
1975
  let e = await this.queueDepth(), t = this.sender?.stats() ?? {
@@ -1661,6 +1983,23 @@ var Z = class e {
1661
1983
  stored: e
1662
1984
  };
1663
1985
  }
1986
+ async clearPersisted(e) {
1987
+ if (await this.senderLoad, this.sender) {
1988
+ await this.sender.clearPersisted(e, this.config.securityContext.id);
1989
+ return;
1990
+ }
1991
+ let [{ createStorage: t, storageName: n }, { ContextStorage: r }, { storageLimits: i }, { clearEmergencyContext: a }] = await Promise.all([
1992
+ import("./factory-C5TujXlU.js"),
1993
+ import("./context-storage-DxZf4Gfh.js"),
1994
+ import("./storage-w7Tslvlq.js"),
1995
+ import("./emergency-queue-BYUyDHGD.js")
1996
+ ]), o = this.config.persistence.namespace, s = this.memoryStorage ?? await t(this.config.storage, n(o), i(this.config.retention), this.diagnostics, void 0, o), c = new r(s, this.config.securityContext, o);
1997
+ try {
1998
+ e === "namespace" ? await c.clearNamespace() : await c.clear(), a(this.config.securityContext.id, this.diagnostics, o, e === "namespace");
1999
+ } finally {
2000
+ s !== this.memoryStorage && await c.close();
2001
+ }
2002
+ }
1664
2003
  async queueDepth() {
1665
2004
  return await this.senderLoad, await this.sender?.queueDepth() ?? 0;
1666
2005
  }
@@ -1668,9 +2007,18 @@ var Z = class e {
1668
2007
  this.meter.collect(), this.ready || await this.started, this.role() === "forwarder" ? this.sendForwarded() : (await this.senderLoad, await this.sender?.flush());
1669
2008
  }
1670
2009
  };
2010
+ function Y(e, t, n = /* @__PURE__ */ new WeakMap()) {
2011
+ if (Object.is(e, t)) return !0;
2012
+ if (e instanceof RegExp && t instanceof RegExp) return String(e) === String(t);
2013
+ if (typeof e != "object" || !e || typeof t != "object" || !t) return !1;
2014
+ if (n.has(e)) return n.get(e) === t;
2015
+ n.set(e, t);
2016
+ let r = Object.keys(e), i = Object.keys(t);
2017
+ return r.length === i.length && r.every((r) => Object.hasOwn(t, r) && Y(Reflect.get(e, r), Reflect.get(t, r), n));
2018
+ }
1671
2019
  //#endregion
1672
2020
  //#region src/transport/memory-transport.ts
1673
- function tr() {
2021
+ function pr() {
1674
2022
  let e = [], t = [], n = { status: 200 };
1675
2023
  return {
1676
2024
  transport: (r) => (e.push(r), n.status >= 200 && n.status < 300 && t.push(r), Promise.resolve({ ...n })),
@@ -1689,119 +2037,150 @@ function tr() {
1689
2037
  }
1690
2038
  //#endregion
1691
2039
  //#region src/index.ts
1692
- var nr = /* @__PURE__ */ new Map();
1693
- function Q() {
1694
- return (Z.current() ?? Z.stopped()) || Z.configure({}, !0);
2040
+ var X = /* @__PURE__ */ new Map();
2041
+ function Z() {
2042
+ return (J.current() ?? J.stopped()) || J.configure({}, !0);
1695
2043
  }
1696
- function rr(e) {
1697
- Z.configure(e);
2044
+ function mr(e = "context") {
2045
+ return ["context", "namespace"].includes(e) ? Z().clearPersisted(e) : Promise.reject(/* @__PURE__ */ Error("Invalid persistence scope."));
2046
+ }
2047
+ function hr(e) {
2048
+ J.configure(e), Q();
2049
+ }
2050
+ function gr(e) {
2051
+ Z().setConfigurationLocked(e);
2052
+ }
2053
+ function _r(e, t) {
2054
+ return Z().rotateSecurityContext(e, t);
2055
+ }
2056
+ async function vr() {
2057
+ let e = Z();
2058
+ return Q(), {
2059
+ ...await e.health(),
2060
+ loggerCache: {
2061
+ ...e.config.loggerCache,
2062
+ size: X.size
2063
+ }
2064
+ };
2065
+ }
2066
+ function Q() {
2067
+ let e = (J.current() ?? J.stopped())?.config.loggerCache.maxEntries, t = e === void 0 ? 256 : e;
2068
+ if (t !== null) for (let e of X.keys()) {
2069
+ if (X.size <= t) break;
2070
+ X.delete(e);
2071
+ }
2072
+ return t;
1698
2073
  }
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;
2074
+ function yr(e, t) {
2075
+ let n = Q();
2076
+ if (t || n === 0) return new F(Z, e, t);
2077
+ let r = X.get(e);
2078
+ return r ??= new F(Z, e), X.delete(e), X.set(e, r), Q(), r;
1703
2079
  }
1704
2080
  function $() {
1705
- return ir("app");
2081
+ return yr("app");
1706
2082
  }
1707
- function ar(e, t) {
2083
+ function br(e, t) {
1708
2084
  $().trace(e, t);
1709
2085
  }
1710
- function or(e, t) {
2086
+ function xr(e, t) {
1711
2087
  $().debug(e, t);
1712
2088
  }
1713
- function sr(e, t) {
2089
+ function Sr(e, t) {
1714
2090
  $().info(e, t);
1715
2091
  }
1716
- function cr(e, t) {
2092
+ function Cr(e, t) {
1717
2093
  $().warn(e, t);
1718
2094
  }
1719
- function lr(e, t, n) {
2095
+ function wr(e, t, n) {
1720
2096
  $().error(e, t, n);
1721
2097
  }
1722
- function ur(e, t, n) {
2098
+ function Tr(e, t, n) {
1723
2099
  $().fatal(e, t, n);
1724
2100
  }
1725
- function dr(e, t) {
2101
+ function Er(e, t) {
1726
2102
  $().logAction(e, t);
1727
2103
  }
1728
- function fr(e, t) {
2104
+ function Dr(e, t) {
1729
2105
  $().logEvent(e, t);
1730
2106
  }
1731
- function pr(e, t, n, r, i) {
2107
+ function Or(e, t, n, r, i) {
1732
2108
  $().logMetric(e, t, n, r, i);
1733
2109
  }
1734
- function mr(e, t = {}) {
1735
- return gt(e, t, (e, t, n) => {
1736
- Q().recordMetric(e, t, n);
2110
+ function kr(e, t = {}) {
2111
+ return vt(e, t, (e, t, n) => {
2112
+ Z().recordMetric(e, t, n);
1737
2113
  });
1738
2114
  }
1739
- function hr(e, t = {}) {
1740
- return _t(e, t, (e, t, n) => {
1741
- Q().recordMetric(e, t, n);
2115
+ function Ar(e, t = {}) {
2116
+ return yt(e, t, (e, t, n) => {
2117
+ Z().recordMetric(e, t, n);
1742
2118
  });
1743
2119
  }
1744
- function gr(e, t, n) {
2120
+ function jr(e, t, n) {
1745
2121
  return $().timeSync(e, t, n);
1746
2122
  }
1747
- function _r(e, t, n) {
2123
+ function Mr(e, t, n) {
1748
2124
  return $().timeAsync(e, t, n);
1749
2125
  }
1750
- function vr(e, t) {
1751
- Q().addBreadcrumb(e, t);
2126
+ function Nr(e, t) {
2127
+ Z().addBreadcrumb(e, t);
1752
2128
  }
1753
- function yr(e, t) {
1754
- Q().context.set(e, t);
2129
+ function Pr(e, t) {
2130
+ Z().context.set(e, t);
1755
2131
  }
1756
- function br(e) {
1757
- Q().context.setMany(e);
2132
+ function Fr(e) {
2133
+ Z().context.setMany(e);
1758
2134
  }
1759
- function xr(e) {
1760
- Q().context.remove(e);
2135
+ function Ir(e) {
2136
+ Z().context.remove(e);
1761
2137
  }
1762
- function Sr(e, t) {
1763
- return Q().journey.start(e, t);
2138
+ function Lr(e, t) {
2139
+ return Z().journey.start(e, t);
2140
+ }
2141
+ function Rr() {
2142
+ Z().journey.end();
1764
2143
  }
1765
- function Cr() {
1766
- Q().journey.end();
2144
+ function zr() {
2145
+ return Z().journey.current();
1767
2146
  }
1768
- function wr() {
1769
- return Q().journey.current();
2147
+ function Br() {
2148
+ return Z().journey.getToken();
1770
2149
  }
1771
- function Tr() {
1772
- return Q().journey.getToken();
2150
+ function Vr(e) {
2151
+ return Z().journey.adopt(e, "manual", !0);
1773
2152
  }
1774
- function Er(e) {
1775
- return Q().journey.adopt(e, "manual", !0);
2153
+ function Hr(e, t) {
2154
+ return Z().registerWorker(e, t);
1776
2155
  }
1777
- function Dr(e) {
1778
- Q().registerWorker(e);
2156
+ function Ur(e, t) {
2157
+ return Z().registerFrame(e, t);
1779
2158
  }
1780
- function Or() {
1781
- Q().tracing.rotate("explicit");
2159
+ function Wr() {
2160
+ Z().tracing.rotate("explicit");
1782
2161
  }
1783
- function kr() {
1784
- return Q().tracing.headers();
2162
+ function Gr() {
2163
+ return Z().tracing.headers();
1785
2164
  }
1786
- function Ar() {
1787
- return Q().flush();
2165
+ function Kr() {
2166
+ return Z().flush();
1788
2167
  }
1789
- function jr() {
1790
- return Q().queueDepth();
2168
+ function qr() {
2169
+ return Z().queueDepth();
1791
2170
  }
1792
- function Mr() {
1793
- return Q().stats();
2171
+ function Jr() {
2172
+ return Z().stats();
1794
2173
  }
1795
- function Nr() {
1796
- Q().newSession();
2174
+ function Yr() {
2175
+ Z().newSession();
1797
2176
  }
1798
- function Pr() {
1799
- return Q().diagnostics.snapshot();
2177
+ function Xr() {
2178
+ return Z().diagnostics.snapshot();
1800
2179
  }
1801
- async function Fr() {
1802
- await Z.current()?.destroy();
2180
+ async function Zr() {
2181
+ await J.current()?.destroy();
1803
2182
  }
1804
2183
  //#endregion
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 };
2184
+ export { F as OneLogger, Nr as addBreadcrumb, Vr as adoptJourney, mr as clearPersistedLogs, hr as configure, kr as counter, pr as createMemoryTransport, zr as currentJourney, xr as debug, Rr as endJourney, wr as error, Tr as fatal, Kr as flush, Xr as getDiagnosticCounters, vr as getHealth, Br as getJourneyToken, yr as getLogger, qr as getQueueDepth, Jr as getStats, Gr as getTraceHeaders, Ar as histogram, Sr as info, Er as logAction, Dr as logEvent, Or as logMetric, Yr as newSession, Ur as registerFrame, Hr as registerWorker, Ir as removeContext, _r as rotateSecurityContext, gr as setConfigurationLocked, Pr as setContext, Fr as setContextMap, Zr as shutdown, Lr as startJourney, Wr as startTrace, Mr as timeAsync, jr as timeSync, br as trace, Cr as warn };
1806
2185
 
1807
2186
  //# sourceMappingURL=index.js.map