@utk09/ui-observability 0.11.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (557) hide show
  1. package/CHANGELOG.md +481 -0
  2. package/README.md +73 -669
  3. package/bin/uiobs.mjs +1 -1
  4. package/dist/{batch-CL9uWYY3.js → batch-CXmPmTse.js} +3 -3
  5. package/dist/batch-CXmPmTse.js.map +1 -0
  6. package/dist/{batch-C8OcWR2L.cjs → batch-mmPigCpi.cjs} +2 -2
  7. package/dist/batch-mmPigCpi.cjs.map +1 -0
  8. package/dist/bus/bus.d.cts +331 -0
  9. package/dist/bus/bus.d.ts +108 -57
  10. package/dist/bus/links.d.cts +132 -0
  11. package/dist/bus/links.d.ts +22 -7
  12. package/dist/bus/validation.d.cts +16 -0
  13. package/dist/bus/validation.d.ts +11 -2
  14. package/dist/bus-C39wspFV.js +775 -0
  15. package/dist/bus-C39wspFV.js.map +1 -0
  16. package/dist/bus-_EaOVPGq.cjs +2 -0
  17. package/dist/bus-_EaOVPGq.cjs.map +1 -0
  18. package/dist/capture/console.d.cts +37 -0
  19. package/dist/capture/console.d.ts +11 -11
  20. package/dist/capture/errors.d.cts +32 -0
  21. package/dist/capture/errors.d.ts +7 -7
  22. package/dist/capture/interactions.d.cts +48 -0
  23. package/dist/capture/interactions.d.ts +15 -15
  24. package/dist/capture/lifecycle.d.cts +20 -0
  25. package/dist/capture/lifecycle.d.ts +4 -4
  26. package/dist/capture/long-frames.d.cts +31 -0
  27. package/dist/capture/long-frames.d.ts +7 -7
  28. package/dist/capture/network.d.cts +57 -0
  29. package/dist/capture/network.d.ts +18 -18
  30. package/dist/capture/profiler-frames.d.cts +44 -0
  31. package/dist/capture/profiler-frames.d.ts +44 -0
  32. package/dist/capture/replay-buffer.d.cts +45 -0
  33. package/dist/capture/replay-buffer.d.ts +45 -0
  34. package/dist/capture/replay-upload.d.cts +79 -0
  35. package/dist/capture/replay-upload.d.ts +79 -0
  36. package/dist/capture/replay.d.cts +114 -0
  37. package/dist/capture/replay.d.ts +114 -0
  38. package/dist/capture/reports.d.cts +17 -0
  39. package/dist/capture/reports.d.ts +3 -3
  40. package/dist/capture/resource-timing.d.cts +14 -0
  41. package/dist/capture/resource-timing.d.ts +2 -2
  42. package/dist/capture/server-timing.d.cts +19 -0
  43. package/dist/capture/server-timing.d.ts +3 -3
  44. package/dist/capture/storm.d.cts +13 -0
  45. package/dist/capture/storm.d.ts +7 -7
  46. package/dist/capture/types.d.cts +128 -0
  47. package/dist/capture/types.d.ts +54 -41
  48. package/dist/capture/unclean-exit.d.cts +31 -0
  49. package/dist/capture/unclean-exit.d.ts +9 -9
  50. package/dist/capture/user-timing.d.cts +22 -0
  51. package/dist/capture/user-timing.d.ts +4 -4
  52. package/dist/capture/web-socket.d.cts +40 -0
  53. package/dist/capture/web-socket.d.ts +14 -14
  54. package/dist/capture/web-vitals.d.cts +40 -0
  55. package/dist/capture/web-vitals.d.ts +21 -8
  56. package/dist/compression-CvED_Jel.cjs +2 -0
  57. package/dist/compression-CvED_Jel.cjs.map +1 -0
  58. package/dist/compression-tVtXwVjX.js +11 -0
  59. package/dist/compression-tVtXwVjX.js.map +1 -0
  60. package/dist/config-DUs7uHHt.cjs +2 -0
  61. package/dist/config-DUs7uHHt.cjs.map +1 -0
  62. package/dist/config-SgQcCP1_.js +560 -0
  63. package/dist/config-SgQcCP1_.js.map +1 -0
  64. package/dist/console-BGgGnjSi.js +81 -0
  65. package/dist/console-BGgGnjSi.js.map +1 -0
  66. package/dist/console-CSZ5_Vx5.cjs +2 -0
  67. package/dist/console-CSZ5_Vx5.cjs.map +1 -0
  68. package/dist/constants-CUyd9cTZ.js +357 -0
  69. package/dist/constants-CUyd9cTZ.js.map +1 -0
  70. package/dist/constants-CqdJhTxH.cjs +2 -0
  71. package/dist/constants-CqdJhTxH.cjs.map +1 -0
  72. package/dist/constants.d.cts +751 -0
  73. package/dist/constants.d.ts +231 -116
  74. package/dist/core/breadcrumbs.d.cts +54 -0
  75. package/dist/core/breadcrumbs.d.ts +21 -15
  76. package/dist/core/config.d.cts +45 -0
  77. package/dist/core/config.d.ts +33 -5
  78. package/dist/core/context.d.cts +24 -0
  79. package/dist/core/context.d.ts +8 -13
  80. package/dist/core/debug-buffer.d.cts +34 -0
  81. package/dist/core/debug-buffer.d.ts +13 -13
  82. package/dist/core/debug-bundle.d.cts +12 -0
  83. package/dist/core/debug-bundle.d.ts +6 -6
  84. package/dist/core/deferred.d.cts +7 -0
  85. package/dist/core/deferred.d.ts +4 -4
  86. package/dist/core/diagnostics.d.cts +86 -0
  87. package/dist/core/diagnostics.d.ts +25 -22
  88. package/dist/core/drops.d.cts +39 -0
  89. package/dist/core/drops.d.ts +22 -12
  90. package/dist/core/hold-buffer.d.cts +36 -0
  91. package/dist/core/hold-buffer.d.ts +16 -7
  92. package/dist/core/journey.d.cts +148 -0
  93. package/dist/core/journey.d.ts +28 -29
  94. package/dist/core/logger.d.cts +141 -0
  95. package/dist/core/logger.d.ts +45 -51
  96. package/dist/core/measure.d.cts +30 -0
  97. package/dist/core/measure.d.ts +21 -10
  98. package/dist/core/meter.d.cts +78 -0
  99. package/dist/core/meter.d.ts +38 -28
  100. package/dist/core/pipeline.d.cts +227 -0
  101. package/dist/core/pipeline.d.ts +114 -50
  102. package/dist/core/profile-buckets.d.cts +31 -0
  103. package/dist/core/profile-buckets.d.ts +31 -0
  104. package/dist/core/profiler.d.cts +218 -0
  105. package/dist/core/profiler.d.ts +218 -0
  106. package/dist/core/record.d.cts +190 -0
  107. package/dist/core/record.d.ts +67 -35
  108. package/dist/core/remote-rules.d.cts +17 -0
  109. package/dist/core/remote-rules.d.ts +7 -7
  110. package/dist/core/remote-sampling.d.cts +74 -0
  111. package/dist/core/remote-sampling.d.ts +24 -23
  112. package/dist/core/rotation.d.cts +75 -0
  113. package/dist/core/rotation.d.ts +75 -0
  114. package/dist/core/runtime.d.cts +765 -0
  115. package/dist/core/runtime.d.ts +430 -186
  116. package/dist/core/sampling.d.cts +86 -0
  117. package/dist/core/sampling.d.ts +22 -22
  118. package/dist/core/sender.d.cts +161 -0
  119. package/dist/core/sender.d.ts +80 -34
  120. package/dist/core/spans.d.cts +39 -0
  121. package/dist/core/spans.d.ts +6 -6
  122. package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
  123. package/dist/deadline-C4ccAuk5.js.map +1 -0
  124. package/dist/deadline-CUGbto-y.cjs +2 -0
  125. package/dist/deadline-CUGbto-y.cjs.map +1 -0
  126. package/dist/debug-bundle-BXIlwDKM.cjs +2 -0
  127. package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
  128. package/dist/debug-bundle-CRpYV_ui.js +35 -0
  129. package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
  130. package/dist/defineProperty-X1c4tIPD.cjs +1 -0
  131. package/dist/defineProperty-s2S8BXUc.js +35 -0
  132. package/dist/doctor.cjs +1 -1
  133. package/dist/doctor.cjs.map +1 -1
  134. package/dist/doctor.d.cts +36 -0
  135. package/dist/doctor.d.ts +19 -6
  136. package/dist/doctor.js +180 -53
  137. package/dist/doctor.js.map +1 -1
  138. package/dist/error-like-B11pB4aL.js.map +1 -1
  139. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  140. package/dist/errors-BE_EZV7Q.js +86 -0
  141. package/dist/errors-BE_EZV7Q.js.map +1 -0
  142. package/dist/errors-CNPbesMs.cjs +3 -0
  143. package/dist/errors-CNPbesMs.cjs.map +1 -0
  144. package/dist/factory-CTi0Is3F.js +404 -0
  145. package/dist/factory-CTi0Is3F.js.map +1 -0
  146. package/dist/factory-hRrH32v5.cjs +2 -0
  147. package/dist/factory-hRrH32v5.cjs.map +1 -0
  148. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  149. package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
  150. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  151. package/dist/global-scope-D9I8s-oN.js.map +1 -1
  152. package/dist/guards-BlYGRK4l.js +10 -0
  153. package/dist/guards-BlYGRK4l.js.map +1 -0
  154. package/dist/guards-EjG3ahFp.cjs +2 -0
  155. package/dist/guards-EjG3ahFp.cjs.map +1 -0
  156. package/dist/{identity-DT5VmvXy.js → identity-DdhKgrpk.js} +11 -15
  157. package/dist/identity-DdhKgrpk.js.map +1 -0
  158. package/dist/identity-DlWRIuwy.cjs +2 -0
  159. package/dist/identity-DlWRIuwy.cjs.map +1 -0
  160. package/dist/index.cjs +1 -1
  161. package/dist/index.cjs.map +1 -1
  162. package/dist/index.d.cts +300 -0
  163. package/dist/index.d.ts +165 -141
  164. package/dist/index.js +1283 -1468
  165. package/dist/index.js.map +1 -1
  166. package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
  167. package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
  168. package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-GHdl0t8A.js} +51 -47
  169. package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
  170. package/dist/interactions-CUkzK8sR.cjs +2 -0
  171. package/dist/interactions-CUkzK8sR.cjs.map +1 -0
  172. package/dist/{interactions-DTgKy_6K.js → interactions-DiFvCosX.js} +41 -49
  173. package/dist/interactions-DiFvCosX.js.map +1 -0
  174. package/dist/journey-B4Adltjm.cjs +2 -0
  175. package/dist/journey-B4Adltjm.cjs.map +1 -0
  176. package/dist/{journey-CuJrHzEg.js → journey-D2_sia57.js} +51 -53
  177. package/dist/journey-D2_sia57.js.map +1 -0
  178. package/dist/{library-console-C1m6g1BR.js → library-console-Btrzt814.js} +2 -2
  179. package/dist/library-console-Btrzt814.js.map +1 -0
  180. package/dist/{library-console-D2GY9Or6.cjs → library-console-CPW6bvZH.cjs} +2 -2
  181. package/dist/library-console-CPW6bvZH.cjs.map +1 -0
  182. package/dist/{library-request-BQBT9N9Q.js → library-request-BJ9PLRaD.js} +2 -2
  183. package/dist/library-request-BJ9PLRaD.js.map +1 -0
  184. package/dist/{library-request-1BX_UlaX.cjs → library-request-D7OvTxZV.cjs} +2 -2
  185. package/dist/library-request-D7OvTxZV.cjs.map +1 -0
  186. package/dist/{lifecycle-BaKx_-32.js → lifecycle-22CUCrc9.js} +21 -29
  187. package/dist/lifecycle-22CUCrc9.js.map +1 -0
  188. package/dist/lifecycle-IaAm1mOC.cjs +2 -0
  189. package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
  190. package/dist/{log-record-CAoGBBf3.js → log-record-BNiLfqtL.js} +8 -7
  191. package/dist/log-record-BNiLfqtL.js.map +1 -0
  192. package/dist/log-record-CkivuiEl.cjs +2 -0
  193. package/dist/log-record-CkivuiEl.cjs.map +1 -0
  194. package/dist/long-frames-BUUbXd-B.cjs +2 -0
  195. package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
  196. package/dist/long-frames-DNFaRnC3.js +62 -0
  197. package/dist/long-frames-DNFaRnC3.js.map +1 -0
  198. package/dist/models/batch.d.cts +57 -0
  199. package/dist/models/batch.d.ts +16 -17
  200. package/dist/models/bus.d.cts +158 -0
  201. package/dist/models/bus.d.ts +46 -26
  202. package/dist/models/config.d.cts +1540 -0
  203. package/dist/models/config.d.ts +692 -405
  204. package/dist/models/drop.d.cts +54 -0
  205. package/dist/models/drop.d.ts +29 -14
  206. package/dist/models/health.d.cts +148 -0
  207. package/dist/models/health.d.ts +119 -23
  208. package/dist/models/log-record.d.cts +61 -0
  209. package/dist/models/log-record.d.ts +13 -14
  210. package/dist/models/metric.d.cts +139 -0
  211. package/dist/models/metric.d.ts +94 -18
  212. package/dist/models/plugin.d.cts +47 -0
  213. package/dist/models/plugin.d.ts +16 -16
  214. package/dist/models/replay.d.cts +60 -0
  215. package/dist/models/replay.d.ts +60 -0
  216. package/dist/models/serializer.d.cts +23 -0
  217. package/dist/models/serializer.d.ts +3 -4
  218. package/dist/models/storage.d.cts +95 -0
  219. package/dist/models/storage.d.ts +17 -14
  220. package/dist/network-CGMLQ-mA.cjs +2 -0
  221. package/dist/network-CGMLQ-mA.cjs.map +1 -0
  222. package/dist/{network-DBNwApoF.js → network-on2zZT6H.js} +57 -57
  223. package/dist/network-on2zZT6H.js.map +1 -0
  224. package/dist/openfin-Bxelt0yg.js.map +1 -1
  225. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  226. package/dist/otlp-BENHf3g9.cjs +2 -0
  227. package/dist/otlp-BENHf3g9.cjs.map +1 -0
  228. package/dist/{otlp-BTJdIa6F.js → otlp-DimfrRor.js} +22 -29
  229. package/dist/otlp-DimfrRor.js.map +1 -0
  230. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  231. package/dist/patch-UdPz1ea8.js.map +1 -1
  232. package/dist/{platform-DkcuXwe-.js → platform-BaaFIPCU.js} +8 -8
  233. package/dist/platform-BaaFIPCU.js.map +1 -0
  234. package/dist/{platform-C2Ez5kDc.cjs → platform-CfA3-7sJ.cjs} +2 -2
  235. package/dist/platform-CfA3-7sJ.cjs.map +1 -0
  236. package/dist/profiler-BAZoh7A4.js +292 -0
  237. package/dist/profiler-BAZoh7A4.js.map +1 -0
  238. package/dist/profiler-D4tJpDRc.cjs +2 -0
  239. package/dist/profiler-D4tJpDRc.cjs.map +1 -0
  240. package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
  241. package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
  242. package/dist/profiler-frames-cJMx9wNM.js +78 -0
  243. package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
  244. package/dist/remote-rules-Dz9MRAsB.js +95 -0
  245. package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
  246. package/dist/remote-rules-_tY0zj5o.cjs +2 -0
  247. package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
  248. package/dist/replay-B3gFXIZd.cjs +2 -0
  249. package/dist/replay-B3gFXIZd.cjs.map +1 -0
  250. package/dist/replay-Ds-ANH34.js +310 -0
  251. package/dist/replay-Ds-ANH34.js.map +1 -0
  252. package/dist/reports-BDSe4dFH.cjs +2 -0
  253. package/dist/reports-BDSe4dFH.cjs.map +1 -0
  254. package/dist/{reports-TA-zInnq.js → reports-C-thq-bk.js} +25 -30
  255. package/dist/reports-C-thq-bk.js.map +1 -0
  256. package/dist/resource-timing-C576gFIQ.cjs +2 -0
  257. package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
  258. package/dist/{resource-timing-BLv3EA2A.js → resource-timing-eUl2dNgC.js} +20 -23
  259. package/dist/resource-timing-eUl2dNgC.js.map +1 -0
  260. package/dist/response-body-YdNl-HkR.cjs +3 -0
  261. package/dist/response-body-YdNl-HkR.cjs.map +1 -0
  262. package/dist/response-body-eoSQpLiH.js +331 -0
  263. package/dist/response-body-eoSQpLiH.js.map +1 -0
  264. package/dist/rotation-Cwct4ckk.js +94 -0
  265. package/dist/rotation-Cwct4ckk.js.map +1 -0
  266. package/dist/rotation-D4qUAHAu.cjs +2 -0
  267. package/dist/rotation-D4qUAHAu.cjs.map +1 -0
  268. package/dist/sampling-BlrI8jor.js +63 -0
  269. package/dist/sampling-BlrI8jor.js.map +1 -0
  270. package/dist/sampling-mXt4dstx.cjs +2 -0
  271. package/dist/sampling-mXt4dstx.cjs.map +1 -0
  272. package/dist/{sanitize-6ymPlVvP.js → sanitize-Ba0KqU06.js} +2 -2
  273. package/dist/sanitize-Ba0KqU06.js.map +1 -0
  274. package/dist/{sanitize-BAWzkZt0.cjs → sanitize-DQyiI_KY.cjs} +2 -2
  275. package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
  276. package/dist/sender-BdRuNVhF.cjs +2 -0
  277. package/dist/sender-BdRuNVhF.cjs.map +1 -0
  278. package/dist/sender-Dv8rAmpV.js +979 -0
  279. package/dist/sender-Dv8rAmpV.js.map +1 -0
  280. package/dist/storage/context-storage.d.cts +90 -0
  281. package/dist/storage/context-storage.d.ts +38 -37
  282. package/dist/storage/emergency-queue.d.cts +27 -0
  283. package/dist/storage/emergency-queue.d.ts +13 -13
  284. package/dist/storage/eviction.d.cts +40 -0
  285. package/dist/storage/eviction.d.ts +13 -13
  286. package/dist/storage/factory.d.cts +21 -0
  287. package/dist/storage/factory.d.ts +11 -10
  288. package/dist/storage/gap.d.cts +20 -0
  289. package/dist/storage/gap.d.ts +9 -9
  290. package/dist/storage/idb-driver.d.cts +93 -0
  291. package/dist/storage/idb-driver.d.ts +32 -33
  292. package/dist/storage/indexeddb-storage.d.cts +97 -0
  293. package/dist/storage/indexeddb-storage.d.ts +38 -31
  294. package/dist/storage/keys.d.cts +17 -0
  295. package/dist/storage/keys.d.ts +9 -9
  296. package/dist/storage/local-storage.d.cts +139 -0
  297. package/dist/storage/local-storage.d.ts +49 -42
  298. package/dist/storage/memory-storage.d.cts +73 -0
  299. package/dist/storage/memory-storage.d.ts +25 -25
  300. package/dist/storage/persistence.d.cts +8 -0
  301. package/dist/storage/persistence.d.ts +3 -3
  302. package/dist/storage/stored-context.d.cts +34 -0
  303. package/dist/storage/stored-context.d.ts +34 -0
  304. package/dist/stored-context-B2EzVuYm.js +51 -0
  305. package/dist/stored-context-B2EzVuYm.js.map +1 -0
  306. package/dist/stored-context-CXt7eHZL.cjs +2 -0
  307. package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
  308. package/dist/storm-C-zYSdDX.cjs +2 -0
  309. package/dist/storm-C-zYSdDX.cjs.map +1 -0
  310. package/dist/storm-DjKetLKZ.js +9 -0
  311. package/dist/storm-DjKetLKZ.js.map +1 -0
  312. package/dist/transport/compression.d.cts +7 -0
  313. package/dist/transport/compression.d.ts +2 -2
  314. package/dist/transport/custom-transport.d.cts +22 -0
  315. package/dist/transport/custom-transport.d.ts +6 -5
  316. package/dist/transport/errors.d.cts +31 -0
  317. package/dist/transport/errors.d.ts +7 -7
  318. package/dist/transport/exit-flush.d.cts +135 -0
  319. package/dist/transport/exit-flush.d.ts +62 -45
  320. package/dist/transport/headers.d.cts +8 -0
  321. package/dist/transport/headers.d.ts +4 -4
  322. package/dist/transport/http-transport.d.cts +116 -0
  323. package/dist/transport/http-transport.d.ts +48 -35
  324. package/dist/transport/memory-transport.d.cts +30 -0
  325. package/dist/transport/memory-transport.d.ts +8 -8
  326. package/dist/transport/response-body.d.cts +49 -0
  327. package/dist/transport/response-body.d.ts +49 -0
  328. package/dist/transport/retry-engine.d.cts +129 -0
  329. package/dist/transport/retry-engine.d.ts +62 -43
  330. package/dist/transport/serializers/ecs.d.cts +3 -0
  331. package/dist/transport/serializers/ecs.d.ts +2 -2
  332. package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
  333. package/dist/transport/serializers/otlp-metrics.d.ts +2 -2
  334. package/dist/transport/serializers/otlp-traces.d.cts +3 -0
  335. package/dist/transport/serializers/otlp-traces.d.ts +2 -2
  336. package/dist/transport/serializers/otlp.d.cts +47 -0
  337. package/dist/transport/serializers/otlp.d.ts +18 -18
  338. package/dist/transport/serializers/select.d.cts +38 -0
  339. package/dist/transport/serializers/select.d.ts +11 -11
  340. package/dist/transport/status-transport.d.cts +129 -0
  341. package/dist/transport/status-transport.d.ts +45 -28
  342. package/dist/transport/worker-client.d.cts +23 -0
  343. package/dist/transport/worker-client.d.ts +12 -3
  344. package/dist/transport/worker-entry.d.cts +5 -0
  345. package/dist/transport/worker-entry.d.ts +1 -1
  346. package/dist/transport/worker-protocol.d.cts +38 -0
  347. package/dist/transport/worker-protocol.d.ts +7 -5
  348. package/dist/transport/worker-server.d.cts +3 -0
  349. package/dist/transport/worker-server.d.ts +1 -1
  350. package/dist/transport/worker-transport.d.cts +10 -0
  351. package/dist/transport/worker-transport.d.ts +5 -4
  352. package/dist/types-BAerHgCq.js.map +1 -1
  353. package/dist/types-C7WNpnG1.cjs.map +1 -1
  354. package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-DQD1cT7c.js} +23 -30
  355. package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
  356. package/dist/unclean-exit-py99ApzT.cjs +2 -0
  357. package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
  358. package/dist/unref-CU9Nyz_9.cjs +2 -0
  359. package/dist/unref-CU9Nyz_9.cjs.map +1 -0
  360. package/dist/unref-DgHPQeWv.js +7 -0
  361. package/dist/unref-DgHPQeWv.js.map +1 -0
  362. package/dist/{user-timing-_jZIhDKI.js → user-timing-BePqb1uN.js} +18 -18
  363. package/dist/user-timing-BePqb1uN.js.map +1 -0
  364. package/dist/user-timing-D6XTmpuM.cjs +2 -0
  365. package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
  366. package/dist/utils/console.d.cts +36 -0
  367. package/dist/utils/console.d.ts +6 -6
  368. package/dist/utils/deadline.d.cts +14 -0
  369. package/dist/utils/deadline.d.ts +4 -4
  370. package/dist/utils/error-like.d.cts +25 -0
  371. package/dist/utils/error-like.d.ts +7 -7
  372. package/dist/utils/fixed-window.d.cts +25 -0
  373. package/dist/utils/fixed-window.d.ts +9 -8
  374. package/dist/utils/global-scope.d.cts +20 -0
  375. package/dist/utils/global-scope.d.ts +8 -8
  376. package/dist/utils/guards.d.cts +14 -0
  377. package/dist/utils/guards.d.ts +10 -2
  378. package/dist/utils/identity.d.cts +109 -0
  379. package/dist/utils/identity.d.ts +20 -21
  380. package/dist/utils/library-console.d.cts +11 -0
  381. package/dist/utils/library-console.d.ts +4 -4
  382. package/dist/utils/library-request.d.cts +24 -0
  383. package/dist/utils/library-request.d.ts +10 -10
  384. package/dist/utils/lock.d.cts +24 -0
  385. package/dist/utils/lock.d.ts +11 -10
  386. package/dist/utils/openfin.d.cts +48 -0
  387. package/dist/utils/openfin.d.ts +5 -5
  388. package/dist/utils/patch.d.cts +9 -0
  389. package/dist/utils/patch.d.ts +6 -6
  390. package/dist/utils/platform.d.cts +62 -0
  391. package/dist/utils/platform.d.ts +15 -13
  392. package/dist/utils/sanitize.d.cts +52 -0
  393. package/dist/utils/sanitize.d.ts +5 -5
  394. package/dist/utils/sequence.d.cts +10 -0
  395. package/dist/utils/tracing.d.cts +158 -0
  396. package/dist/utils/tracing.d.ts +49 -42
  397. package/dist/utils/unref.d.cts +9 -0
  398. package/dist/utils/unref.d.ts +3 -3
  399. package/dist/web-socket-CoIUBM3C.cjs +2 -0
  400. package/dist/web-socket-CoIUBM3C.cjs.map +1 -0
  401. package/dist/{web-socket-CV7yIMnm.js → web-socket-DSHgDiZ6.js} +23 -28
  402. package/dist/web-socket-DSHgDiZ6.js.map +1 -0
  403. package/dist/web-vitals-4pWACwaR.js +71 -0
  404. package/dist/web-vitals-4pWACwaR.js.map +1 -0
  405. package/dist/web-vitals-__X7t4pj.cjs +2 -0
  406. package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
  407. package/dist/worker-protocol-QbvqNazn.cjs +2 -0
  408. package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
  409. package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-x074Rpet.js} +14 -11
  410. package/dist/worker-protocol-x074Rpet.js.map +1 -0
  411. package/dist/worker-server-CFe4nvos.cjs +2 -0
  412. package/dist/worker-server-CFe4nvos.cjs.map +1 -0
  413. package/dist/worker-server-iUVSjH8L.js +94 -0
  414. package/dist/worker-server-iUVSjH8L.js.map +1 -0
  415. package/dist/worker-transport-CRAX-09c.cjs +2 -0
  416. package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
  417. package/dist/worker-transport-Dy1KMA7t.js +190 -0
  418. package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
  419. package/llms.txt +397 -0
  420. package/package.json +55 -41
  421. package/dist/batch-C8OcWR2L.cjs.map +0 -1
  422. package/dist/batch-CL9uWYY3.js.map +0 -1
  423. package/dist/bus-BZ0GldpT.js +0 -660
  424. package/dist/bus-BZ0GldpT.js.map +0 -1
  425. package/dist/bus-VWlmM5xs.cjs +0 -2
  426. package/dist/bus-VWlmM5xs.cjs.map +0 -1
  427. package/dist/console-BPZCuSLc.cjs +0 -2
  428. package/dist/console-BPZCuSLc.cjs.map +0 -1
  429. package/dist/console-BeCF7n59.js +0 -82
  430. package/dist/console-BeCF7n59.js.map +0 -1
  431. package/dist/constants-DqKJH_MP.cjs +0 -2
  432. package/dist/constants-DqKJH_MP.cjs.map +0 -1
  433. package/dist/constants-zyrqveN4.js +0 -304
  434. package/dist/constants-zyrqveN4.js.map +0 -1
  435. package/dist/context-storage-BjzeBSxH.cjs +0 -2
  436. package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
  437. package/dist/context-storage-BzkoHzkQ.js +0 -51
  438. package/dist/context-storage-BzkoHzkQ.js.map +0 -1
  439. package/dist/deadline-BOjOxNHj.js.map +0 -1
  440. package/dist/deadline-XSnm95pg.cjs +0 -2
  441. package/dist/deadline-XSnm95pg.cjs.map +0 -1
  442. package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
  443. package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
  444. package/dist/debug-bundle-C7UkHZ-q.js +0 -25
  445. package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
  446. package/dist/emergency-queue-CNTRui5t.cjs +0 -2
  447. package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
  448. package/dist/emergency-queue-Zy6lNafo.js +0 -67
  449. package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
  450. package/dist/errors-Dh7kef0i.js +0 -92
  451. package/dist/errors-Dh7kef0i.js.map +0 -1
  452. package/dist/errors-tfEr48bS.cjs +0 -3
  453. package/dist/errors-tfEr48bS.cjs.map +0 -1
  454. package/dist/factory-BonqI3NL.js +0 -276
  455. package/dist/factory-BonqI3NL.js.map +0 -1
  456. package/dist/factory-CJXVYp0R.cjs +0 -2
  457. package/dist/factory-CJXVYp0R.cjs.map +0 -1
  458. package/dist/guards-Cidk71ME.js +0 -7
  459. package/dist/guards-Cidk71ME.js.map +0 -1
  460. package/dist/guards-nJ70syPt.cjs +0 -2
  461. package/dist/guards-nJ70syPt.cjs.map +0 -1
  462. package/dist/identity-Cxgj6pZX.cjs +0 -2
  463. package/dist/identity-Cxgj6pZX.cjs.map +0 -1
  464. package/dist/identity-DT5VmvXy.js.map +0 -1
  465. package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
  466. package/dist/indexeddb-storage-CIoW21Xd.cjs +0 -2
  467. package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
  468. package/dist/interactions-DTgKy_6K.js.map +0 -1
  469. package/dist/interactions-fEN6FbVo.cjs +0 -2
  470. package/dist/interactions-fEN6FbVo.cjs.map +0 -1
  471. package/dist/journey-CuJrHzEg.js.map +0 -1
  472. package/dist/journey-pffMVMfa.cjs +0 -2
  473. package/dist/journey-pffMVMfa.cjs.map +0 -1
  474. package/dist/keys-BHhw_0Wh.cjs +0 -2
  475. package/dist/keys-BHhw_0Wh.cjs.map +0 -1
  476. package/dist/keys-BU9j5YqW.js +0 -16
  477. package/dist/keys-BU9j5YqW.js.map +0 -1
  478. package/dist/library-console-C1m6g1BR.js.map +0 -1
  479. package/dist/library-console-D2GY9Or6.cjs.map +0 -1
  480. package/dist/library-request-1BX_UlaX.cjs.map +0 -1
  481. package/dist/library-request-BQBT9N9Q.js.map +0 -1
  482. package/dist/lifecycle-2EtUaRpo.cjs +0 -2
  483. package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
  484. package/dist/lifecycle-BaKx_-32.js.map +0 -1
  485. package/dist/log-record-CAoGBBf3.js.map +0 -1
  486. package/dist/log-record-i9zOTkpQ.cjs +0 -2
  487. package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
  488. package/dist/long-frames-BVg4i5SC.cjs +0 -2
  489. package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
  490. package/dist/long-frames-Czk7IupC.js +0 -64
  491. package/dist/long-frames-Czk7IupC.js.map +0 -1
  492. package/dist/models/stats.d.ts +0 -11
  493. package/dist/network-DBNwApoF.js.map +0 -1
  494. package/dist/network-xbbuvG_6.cjs +0 -2
  495. package/dist/network-xbbuvG_6.cjs.map +0 -1
  496. package/dist/otlp-BDvFrLnc.cjs +0 -2
  497. package/dist/otlp-BDvFrLnc.cjs.map +0 -1
  498. package/dist/otlp-BTJdIa6F.js.map +0 -1
  499. package/dist/platform-C2Ez5kDc.cjs.map +0 -1
  500. package/dist/platform-DkcuXwe-.js.map +0 -1
  501. package/dist/remote-rules-Cfb4K-Nl.js +0 -98
  502. package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
  503. package/dist/remote-rules-vzvk7aKf.cjs +0 -2
  504. package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
  505. package/dist/reports-Dk2YhKIh.cjs +0 -2
  506. package/dist/reports-Dk2YhKIh.cjs.map +0 -1
  507. package/dist/reports-TA-zInnq.js.map +0 -1
  508. package/dist/resource-timing-BLv3EA2A.js.map +0 -1
  509. package/dist/resource-timing-Cysw1S1f.cjs +0 -2
  510. package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
  511. package/dist/sampling-C4VV-1MS.js +0 -60
  512. package/dist/sampling-C4VV-1MS.js.map +0 -1
  513. package/dist/sampling-Ckh2yW9k.cjs +0 -2
  514. package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
  515. package/dist/sanitize-6ymPlVvP.js.map +0 -1
  516. package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
  517. package/dist/select-ZF4by-lF.cjs +0 -3
  518. package/dist/select-ZF4by-lF.cjs.map +0 -1
  519. package/dist/select-xtQaenIi.js +0 -270
  520. package/dist/select-xtQaenIi.js.map +0 -1
  521. package/dist/sender-CiMHC9YG.js +0 -856
  522. package/dist/sender-CiMHC9YG.js.map +0 -1
  523. package/dist/sender-D5wBoXA8.cjs +0 -2
  524. package/dist/sender-D5wBoXA8.cjs.map +0 -1
  525. package/dist/storage-BA9RqRO-.cjs +0 -2
  526. package/dist/storage-BA9RqRO-.cjs.map +0 -1
  527. package/dist/storage-DZwed89z.js +0 -16
  528. package/dist/storage-DZwed89z.js.map +0 -1
  529. package/dist/storm-CYi9Swpx.cjs +0 -2
  530. package/dist/storm-CYi9Swpx.cjs.map +0 -1
  531. package/dist/storm-VR024_QN.js +0 -9
  532. package/dist/storm-VR024_QN.js.map +0 -1
  533. package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
  534. package/dist/unclean-exit-DFUN57wY.cjs +0 -2
  535. package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
  536. package/dist/user-timing-C9kfRq3J.cjs +0 -2
  537. package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
  538. package/dist/user-timing-_jZIhDKI.js.map +0 -1
  539. package/dist/utils/timer.d.ts +0 -19
  540. package/dist/web-socket-BWUoqBh8.cjs +0 -2
  541. package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
  542. package/dist/web-socket-CV7yIMnm.js.map +0 -1
  543. package/dist/web-vitals-Bq4WFHQo.js +0 -52
  544. package/dist/web-vitals-Bq4WFHQo.js.map +0 -1
  545. package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
  546. package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
  547. package/dist/worker-protocol-Bai7GAIA.cjs +0 -2
  548. package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
  549. package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
  550. package/dist/worker-server-BrIYkfoa.cjs +0 -2
  551. package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
  552. package/dist/worker-server-Dp5HYm4b.js +0 -83
  553. package/dist/worker-server-Dp5HYm4b.js.map +0 -1
  554. package/dist/worker-transport-Bwej4N2e.cjs +0 -2
  555. package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
  556. package/dist/worker-transport-D6jtgpqN.js +0 -199
  557. package/dist/worker-transport-D6jtgpqN.js.map +0 -1
@@ -0,0 +1,775 @@
1
+ import { A as e, M as t, Mn as n, N as r, O as i, Vn as a, it as o, k as s, un as c } from "./constants-CUyd9cTZ.js";
2
+ import { r as l } from "./journey-D2_sia57.js";
3
+ import { n as u, t as d } from "./remote-rules-Dz9MRAsB.js";
4
+ import { n as f, t as p } from "./log-record-BNiLfqtL.js";
5
+ import { n as m } from "./guards-BlYGRK4l.js";
6
+ import { i as h } from "./identity-DdhKgrpk.js";
7
+ import { t as g } from "./openfin-Bxelt0yg.js";
8
+ import { n as _, t as v } from "./fixed-window-Dq3MLUUv.js";
9
+ import { t as y } from "./unref-DgHPQeWv.js";
10
+ import { t as b } from "./defineProperty-s2S8BXUc.js";
11
+ // src/bus/validation.ts
12
+ var x = [
13
+ "complete",
14
+ "timeout",
15
+ "inactive"
16
+ ];
17
+ function S(e) {
18
+ if (typeof e != "object" || !e) return !1;
19
+ let t = e;
20
+ if (typeof t.from != "string" || !t.from || typeof t.t != "string") return !1;
21
+ let n = (e) => typeof t[e] == "string";
22
+ switch (t.t) {
23
+ case r.hello:
24
+ case r.tab: return n("tabId");
25
+ case r.welcome: return n("to") && n("tabId") && (t.routingContextId === void 0 || n("routingContextId"));
26
+ case r.journeyRequest:
27
+ case r.samplingRequest: return !0;
28
+ case r.securityContext: return n("id") && t.id !== "";
29
+ case r.journey: return (t.to === void 0 || n("to")) && "journey" in t;
30
+ case r.sampling: return n("to") && "rules" in t;
31
+ case r.flushRequest: return n("id") && typeof t.timeoutMs == "number";
32
+ case r.flushResult: return n("id") && "result" in t;
33
+ case r.records: return Array.isArray(t.records) && (t.routingContextId === void 0 || n("routingContextId")) && t.records.every((e) => !f(e) || !p(e.severityText) ? !1 : !Array.isArray(e.attributes) && !Array.isArray(e.resource) && /^\d+$/.test(e.timeUnixNano) && (e.observedTimeUnixNano === void 0 || /^\d+$/.test(e.observedTimeUnixNano)) && typeof e.traceId == "string" && /^(?:[a-f\d]{32})?$/.test(e.traceId) && typeof e.spanId == "string" && /^(?:[a-f\d]{16})?$/.test(e.spanId) && Number.isInteger(e.traceFlags) && e.traceFlags >= 0 && e.traceFlags <= 255 && e.severityNumber === a[e.severityText]);
34
+ default: return !1;
35
+ }
36
+ }
37
+ function C(e) {
38
+ if (!m(e)) return null;
39
+ let { status: t, accepted: n, stored: r, dropped: i, forwarded: a, pending: o } = e;
40
+ return ![
41
+ n,
42
+ r,
43
+ i,
44
+ a,
45
+ o
46
+ ].every((e) => Number.isSafeInteger(e) && e >= 0) || !x.includes(t) || t === "complete" && o !== 0 ? null : {
47
+ status: t,
48
+ accepted: n,
49
+ stored: r,
50
+ dropped: i,
51
+ forwarded: a,
52
+ pending: o
53
+ };
54
+ }
55
+ // src/models/bus.ts
56
+ function w(e) {
57
+ return {
58
+ p: t,
59
+ m: e
60
+ };
61
+ }
62
+ function T(e) {
63
+ if (typeof e != "object" || !e) return null;
64
+ let t = e;
65
+ if (t.p !== "ui-observability/2" || typeof t.m != "object" || t.m === null) return null;
66
+ let n = t.m;
67
+ return typeof n.t == "string" ? n : null;
68
+ }
69
+ // src/bus/links.ts
70
+ var E = Symbol.for(n), D = "null", O = "ui-observability/2";
71
+ function k(e, t) {
72
+ return e === D ? `The bus ignored ${t} from a sandboxed frame. The frame has an opaque origin. Set bus.mode: "sender" in the frame. Add allow-same-origin to the sandbox attribute only for content that you trust.` : `The bus ignored ${t} from ${e}. If you own this origin, add it to bus.trustedOrigins.`;
73
+ }
74
+ function A(e) {
75
+ let t = location.ancestorOrigins;
76
+ return t && t.length > 0 ? t.item(0) : j() ?? M(e);
77
+ }
78
+ function j() {
79
+ let e = document.referrer;
80
+ if (e === "") return null;
81
+ try {
82
+ return new URL(e).origin;
83
+ } catch {
84
+ return null;
85
+ }
86
+ }
87
+ function M(e) {
88
+ let t;
89
+ try {
90
+ t = window.parent.origin;
91
+ } catch {
92
+ return e.count("platform.api_blocked"), null;
93
+ }
94
+ return typeof t != "string" || t === D ? null : t;
95
+ }
96
+ function N() {
97
+ if (location.origin !== D) return location.origin;
98
+ let e = globalThis.origin;
99
+ return typeof e == "string" ? e : D;
100
+ }
101
+ function P(e, n) {
102
+ if (typeof window > "u" || window.parent === window) return null;
103
+ let r;
104
+ try {
105
+ r = window.parent[E];
106
+ } catch {
107
+ return null;
108
+ }
109
+ if (typeof r?.busAccept != "function") return null;
110
+ let i = r.protocol, a = r.busCanAccept, o = typeof a == "function", s = i === void 0 && o ? O : i;
111
+ if (s !== "ui-observability/2") {
112
+ let e = typeof s == "string" ? s.slice(0, 48) : "none";
113
+ return n.report("bus.protocol_mismatch", "The same-origin parent runtime uses another bus protocol. This context tries a message link instead of a direct call.", {
114
+ found: e,
115
+ own: t
116
+ }), null;
117
+ }
118
+ let c = N();
119
+ if (o && !a.call(r, window, c)) return null;
120
+ let l = r, u = !0;
121
+ return {
122
+ kind: "direct",
123
+ post(t) {
124
+ u && n.guard("bus.send_failed", "The direct call into the parent runtime failed.", () => {
125
+ l.busAccept(t, e, window);
126
+ });
127
+ },
128
+ close() {
129
+ u = !1;
130
+ }
131
+ };
132
+ }
133
+ function F(e, t, n) {
134
+ if (typeof window > "u" || window.parent === window) return null;
135
+ let r = N();
136
+ if (r === D) return n.report("bus.untrusted_origin", "This frame reports the origin \"null\". No parent can trust that origin. This context sends its own records. A frame that is sandboxed without allow-same-origin has this origin. Set bus.mode: \"sender\" in the frame. Add allow-same-origin to the sandbox attribute only for content that you trust.", {
137
+ origin: r,
138
+ type: "parent"
139
+ }), null;
140
+ let i = /* @__PURE__ */ new Set([r, ...t]), a = A(n);
141
+ if (a === null || !i.has(a)) return n.report("bus.untrusted_origin", a === null ? "The origin of the parent frame is unknown. This context sends its own records." : `The parent frame is on ${a}. This origin is not in bus.trustedOrigins. This context sends its own records.`, {
142
+ origin: a ?? "",
143
+ type: "parent"
144
+ }), null;
145
+ let o = /* @__PURE__ */ new Set(), s = (t) => {
146
+ let r = T(t.data);
147
+ r && t.source === window.parent && (i.has(t.origin) ? e(r, {
148
+ link: "parent",
149
+ origin: t.origin,
150
+ peer: t.source
151
+ }) : o.has(t.origin) || (o.add(t.origin), n.report("bus.untrusted_origin", k(t.origin, "a message"), {
152
+ origin: t.origin,
153
+ type: r.t.slice(0, 48)
154
+ })));
155
+ };
156
+ return addEventListener("message", s), {
157
+ kind: "parent",
158
+ post(e) {
159
+ n.guard("bus.send_failed", "The postMessage call to the parent failed.", () => {
160
+ window.parent.postMessage(w(e), a);
161
+ });
162
+ },
163
+ close() {
164
+ removeEventListener("message", s);
165
+ }
166
+ };
167
+ }
168
+ function I(e, t, n, r, i) {
169
+ if (typeof window > "u") return null;
170
+ let a = /* @__PURE__ */ new Set([location.origin, ...t]);
171
+ a.delete(D);
172
+ let o = /* @__PURE__ */ new Map(), s = (e, t, a) => {
173
+ if (r && !r(e, t)) {
174
+ o.delete(e);
175
+ return;
176
+ }
177
+ if (i && !i(a, e)) return;
178
+ let s = e;
179
+ s.closed ? o.delete(e) : n.guard("bus.send_failed", "The postMessage call to a child frame failed.", () => {
180
+ s.postMessage(w(a), t);
181
+ });
182
+ }, c = (t) => {
183
+ let i = T(t.data);
184
+ if (!i || window.parent !== window && t.source === window.parent) return;
185
+ if (!r && !a.has(t.origin)) {
186
+ n.report("bus.untrusted_origin", k(t.origin, "a message"), {
187
+ origin: t.origin,
188
+ type: i.t.slice(0, 48)
189
+ });
190
+ return;
191
+ }
192
+ if (r && !r(t.source, t.origin)) return;
193
+ let { source: c, origin: l } = t;
194
+ c && o.set(c, l), e(i, {
195
+ link: "children",
196
+ origin: l,
197
+ peer: c ?? void 0,
198
+ reply: c ? (e) => {
199
+ s(c, l, e);
200
+ } : void 0
201
+ });
202
+ };
203
+ return addEventListener("message", c), {
204
+ kind: "children",
205
+ post(e) {
206
+ for (let [t, n] of o) s(t, n, e);
207
+ },
208
+ close() {
209
+ removeEventListener("message", c), o.clear();
210
+ }
211
+ };
212
+ }
213
+ function L(e, t, n) {
214
+ let r = globalThis.BroadcastChannel;
215
+ if (r === void 0) return null;
216
+ let i = n.guard("bus.send_failed", "The library could not open the BroadcastChannel.", () => new r(e));
217
+ return i ? (i.onmessage = (e) => {
218
+ let n = T(e.data);
219
+ n && t(n, {
220
+ link: "broadcast",
221
+ origin: "same-origin"
222
+ });
223
+ }, {
224
+ kind: "broadcast",
225
+ post(e) {
226
+ n.guard("bus.send_failed", "The BroadcastChannel.postMessage call failed.", () => {
227
+ i.postMessage(w(e));
228
+ });
229
+ },
230
+ close() {
231
+ n.guard("bus.send_failed", "The library could not close the BroadcastChannel.", () => {
232
+ i.close();
233
+ });
234
+ }
235
+ }) : null;
236
+ }
237
+ function R(e, t, n, r) {
238
+ let i = g()?.InterApplicationBus;
239
+ if (!i) return null;
240
+ if (!t) return r.report("openfin.unavailable", "OpenFin gives no application uuid. The InterApplicationBus link stays closed."), null;
241
+ let a = `${e}.${t}`;
242
+ return r.guardAsync("bus.send_failed", "The InterApplicationBus.subscribe call failed.", () => i.subscribe({ uuid: t }, a, (e, t, r) => {
243
+ let i = T(e);
244
+ i && n(i, {
245
+ link: "openfin",
246
+ origin: "openfin",
247
+ peer: t && r ? `${t}:${r}` : void 0
248
+ });
249
+ })), {
250
+ kind: "openfin",
251
+ post(e) {
252
+ r.guardAsync("bus.send_failed", "The InterApplicationBus.publish call failed.", () => i.publish(a, w(e)));
253
+ },
254
+ close() {}
255
+ };
256
+ }
257
+ function z(e, t) {
258
+ let n = globalThis, r = n.postMessage;
259
+ return n.WorkerGlobalScope === void 0 || !r ? null : (n.addEventListener?.("message", (t) => {
260
+ let n = T(t.data);
261
+ n && e(n, {
262
+ link: "owner",
263
+ origin: "same-origin"
264
+ });
265
+ }), {
266
+ kind: "owner",
267
+ post(e) {
268
+ t.guard("bus.send_failed", "The postMessage call of the worker failed.", () => {
269
+ r(w(e));
270
+ });
271
+ },
272
+ close() {}
273
+ });
274
+ }
275
+ function B(e, t, n) {
276
+ let r = (n) => {
277
+ let r = T(n.data);
278
+ r && t(r, {
279
+ link: "worker",
280
+ origin: "same-origin",
281
+ peer: e
282
+ });
283
+ };
284
+ return e.addEventListener("message", r), e.start?.(), {
285
+ kind: "worker",
286
+ post(t) {
287
+ n.guard("bus.send_failed", "The postMessage call to a worker failed.", () => {
288
+ e.postMessage(w(t));
289
+ });
290
+ },
291
+ close() {
292
+ e.removeEventListener("message", r);
293
+ }
294
+ };
295
+ }
296
+ // src/bus/bus.ts
297
+ var V = {
298
+ timeoutMs: e,
299
+ maxAttempts: 3
300
+ }, H = [
301
+ "children",
302
+ "direct",
303
+ "worker"
304
+ ], U = class {
305
+ mayPost(e, t) {
306
+ let n = this.sources.get(t)?.permissions;
307
+ return n ? e.t === r.journey ? n.includes("journey:read") : e.t === r.journeyRequest ? n.includes("journey:write") : e.t !== r.sampling || n.includes("sampling:read") : this.config.bus.sourcePolicy === "trusted-origin";
308
+ }
309
+ registerFrame(e, t) {
310
+ let n = typeof HTMLIFrameElement > "u" ? void 0 : HTMLIFrameElement, r = n && e instanceof n ? e.contentWindow : e;
311
+ if (!r || new URL(t.origin).origin !== t.origin || t.origin === "null") throw Error("A frame registration requires a window and an exact origin.");
312
+ let i = {
313
+ ...t,
314
+ permissions: [...t.permissions ?? ["records"]]
315
+ };
316
+ return this.sources.set(r, i), this.ensureChildrenLink(), () => {
317
+ this.sources.get(r) === i && this.sources.delete(r);
318
+ };
319
+ }
320
+ isRegistered(e, t) {
321
+ if (!e) return !1;
322
+ let n = this.sources.get(e);
323
+ return n ? n.origin === t : this.config.bus.sourcePolicy !== "registered" && t !== "null" && (t === N() || this.config.bus.trustedOrigins.includes(t));
324
+ }
325
+ rotateContext() {
326
+ this.passContext(this.role === "sender");
327
+ }
328
+ passContext(e) {
329
+ let t = {
330
+ t: r.securityContext,
331
+ from: this.contextId,
332
+ id: this.config.securityContext.id
333
+ };
334
+ this.postOver("children", t), this.postOver("worker", t), this.postToDirectChildren(t), e && this.postOver("openfin", t);
335
+ }
336
+ postToDirectChildren(e) {
337
+ let t = N();
338
+ for (let [n, r] of this.directReplies) {
339
+ let i = r.deref();
340
+ !i || n.closed || !this.isRegistered(n, t) ? this.directReplies.delete(n) : this.diagnostics.guard("bus.send_failed", "The reply to a direct child failed.", () => {
341
+ i(e, {
342
+ link: "direct",
343
+ origin: "same-origin",
344
+ peer: n
345
+ });
346
+ });
347
+ }
348
+ }
349
+ keepDirectReply(e, t) {
350
+ for (let e of this.directReplies.keys()) e.closed && this.directReplies.delete(e);
351
+ this.directReplies.set(e, new WeakRef(t));
352
+ }
353
+ constructor(e, t, n, r, i, a, o = V) {
354
+ b(this, "config", void 0), b(this, "diagnostics", void 0), b(this, "platform", void 0), b(this, "contextId", void 0), b(this, "tabId", void 0), b(this, "handlers", void 0), b(this, "handshakeOptions", void 0), b(this, "sources", /* @__PURE__ */ new Map()), b(this, "rates", /* @__PURE__ */ new WeakMap()), b(this, "channelRates", /* @__PURE__ */ new Map()), b(this, "directReplies", /* @__PURE__ */ new Map()), b(this, "role", "sender"), b(this, "upstream", null), b(this, "links", []), b(this, "openFinLink", null), b(this, "isOpenFinProvider", !1), b(this, "rulesPoll", void 0), b(this, "destroyed", !1), b(this, "ownerId", null), b(this, "ownerPeer", void 0), b(this, "awaitingWelcome", null), b(this, "flushAnswers", /* @__PURE__ */ new Map()), b(this, "flushQueue", []), b(this, "flushing", !1), b(this, "flushedAt", 0), b(this, "receive", (e, t) => {
355
+ let n = t.link === "children" || t.link === "worker";
356
+ this.acceptsMessage(e, t, n) && this.routeMessage(e, t);
357
+ }), this.config = e, this.diagnostics = t, this.platform = n, this.contextId = r, this.tabId = i, this.handlers = a, this.handshakeOptions = o;
358
+ }
359
+ getRole() {
360
+ return this.role;
361
+ }
362
+ async start() {
363
+ let { bus: e } = this.config;
364
+ if (e.mode === "off") return this.role = "sender", this.role;
365
+ if (this.isOpenFinProvider = this.resolveOpenFinProvider(), e.mode === "sender" || e.mode === "forwarder") return this.role = e.mode, this.openControlLinks(), this.role === "forwarder" && (this.upstream = this.candidateUpstream(), this.upstream || this.diagnostics.report("bus.no_owner", "bus.mode is \"forwarder\". No owner exists. The library drops the records of this context.")), this.announce(), this.role;
366
+ this.openControlLinks();
367
+ let t = P(this.receive, this.diagnostics);
368
+ if (t) return this.role = "forwarder", this.upstream = t, await this.handshake(t), this.diagnostics.report("bus.role_resolved", "This context attached directly to the runtime of its same-origin parent.", {
369
+ role: "forwarder",
370
+ via: "direct"
371
+ }), this.announce(), this.role;
372
+ let n = this.candidateUpstream();
373
+ if (!n) return this.role = "sender", this.diagnostics.report("bus.role_resolved", "No owner exists. This context sends its own records.", { role: "sender" }), this.announce(), this.role;
374
+ let r = this.orphanPolicy() === "retry" ? this.handshakeOptions.maxAttempts : 1, i = !1;
375
+ for (let e = 0; e < r && !i; e++) i = await this.handshake(n);
376
+ return this.role = i ? "forwarder" : "sender", this.upstream = i ? n : null, i || (n !== this.openFinLink && n.close(), this.diagnostics.report("bus.handshake_timeout", `No owner answered after ${String(r)} attempt(s) of ${String(this.handshakeOptions.timeoutMs)} ms. This context becomes the sender.`, {
377
+ via: n.kind,
378
+ crossOrigin: this.isCrossOriginFrame()
379
+ })), this.diagnostics.report("bus.role_resolved", `The bus role is ${this.role}.`, {
380
+ role: this.role,
381
+ via: i ? n.kind : "none"
382
+ }), this.announce(), this.role;
383
+ }
384
+ sendRecords(e) {
385
+ let { maxRecordsPerMessage: t, maxMessageBytes: n } = this.config.bus, i = new TextEncoder(), a = (e) => n === null ? 0 : i.encode(JSON.stringify(e)).length, o = (e) => ({
386
+ t: r.records,
387
+ from: this.contextId,
388
+ records: e,
389
+ routingContextId: this.config.securityContext.id || void 0
390
+ }), s = a(o([])), c = [], l = s, u = 0;
391
+ for (let r of e) {
392
+ let e = a(r);
393
+ if (n !== null && s + e > n) {
394
+ this.diagnostics.count("bus.rejected_message"), u++;
395
+ continue;
396
+ }
397
+ let i = +(c.length > 0);
398
+ (t !== null && c.length >= t || n !== null && l + i + e > n) && (this.upstream?.post(o(c)), c = [], l = s), l += +(c.length > 0) + e, c.push(r);
399
+ }
400
+ return c.length > 0 && this.upstream?.post(o(c)), this.upstream ? e.length - u : 0;
401
+ }
402
+ async requestFlush(e, t) {
403
+ let { upstream: n } = this;
404
+ if (!n) return null;
405
+ let i = h(this.diagnostics), a, o = new Promise((e) => {
406
+ a = e;
407
+ });
408
+ this.flushAnswers.set(i, a), n.post({
409
+ t: r.flushRequest,
410
+ from: this.contextId,
411
+ id: i,
412
+ timeoutMs: e
413
+ });
414
+ try {
415
+ return await Promise.race([o, t.then(() => null)]);
416
+ } finally {
417
+ this.flushAnswers.delete(i);
418
+ }
419
+ }
420
+ acceptDirect(e, t, n) {
421
+ let i = {
422
+ link: "direct",
423
+ origin: "same-origin",
424
+ peer: n
425
+ }, a = {
426
+ ...i,
427
+ reply: (e) => {
428
+ t(e, i);
429
+ }
430
+ };
431
+ this.acceptsMessage(e, a, !0) && e.from !== this.contextId && (n && this.keepDirectReply(n, t), e.t === r.samplingRequest ? t(this.rulesAnswer(e.from), i) : (e.t === r.records && !this.awaitingWelcome && e.routingContextId !== this.config.securityContext.id && t({
432
+ t: r.securityContext,
433
+ from: this.contextId,
434
+ id: this.config.securityContext.id
435
+ }, i), this.routeMessage(e, a)));
436
+ }
437
+ attachWorker(e, t = {}) {
438
+ let n = {
439
+ ...t,
440
+ permissions: [...t.permissions ?? ["records"]]
441
+ };
442
+ this.sources.set(e, n);
443
+ let r = B(e, (e, t) => {
444
+ this.receive(e, {
445
+ ...t,
446
+ reply: (e) => {
447
+ i.post(e);
448
+ }
449
+ });
450
+ }, this.diagnostics), i = {
451
+ ...r,
452
+ post: (t) => {
453
+ this.mayPost(t, e) && r.post(t);
454
+ }
455
+ };
456
+ return this.links.push(i), () => {
457
+ i.close();
458
+ let t = this.links.indexOf(i);
459
+ t >= 0 && this.links.splice(t, 1), this.sources.get(e) === n && this.sources.delete(e);
460
+ };
461
+ }
462
+ broadcastJourney(e) {
463
+ this.postJourney({
464
+ t: r.journey,
465
+ from: this.contextId,
466
+ journey: e
467
+ });
468
+ }
469
+ destroy() {
470
+ this.sources.clear(), this.directReplies.clear(), this.flushQueue = [], this.destroyed = !0, clearInterval(this.rulesPoll), this.rulesPoll = void 0;
471
+ for (let e of this.allLinks()) e.close();
472
+ this.links.length = 0, this.upstream = null, this.ownerId = null, this.openFinLink = null;
473
+ }
474
+ allLinks() {
475
+ return !this.upstream || this.links.includes(this.upstream) ? this.links : [...this.links, this.upstream];
476
+ }
477
+ postOver(e, t) {
478
+ for (let n of this.allLinks()) n.kind === e && n.post(t);
479
+ }
480
+ postJourney(e) {
481
+ for (let t of this.allLinks()) this.journeyLink(t.kind) && t.post(e);
482
+ }
483
+ acceptsMessage(e, t, n) {
484
+ if (this.destroyed) return !1;
485
+ let r;
486
+ try {
487
+ r = this.passesChecks(e, t, n);
488
+ } catch {
489
+ r = !1;
490
+ }
491
+ return r || this.diagnostics.count("bus.rejected_message"), r;
492
+ }
493
+ passesChecks(e, t, n) {
494
+ let { bus: i } = this.config, a = typeof t.peer == "object" ? this.sources.get(t.peer) : void 0;
495
+ if (n && i.sourcePolicy === "registered" && !a) return !1;
496
+ let o = typeof t.peer == "object" ? t.peer : void 0, s = typeof t.peer == "string" ? t.peer : t.link, c = Date.now(), l = (o ? this.rates.get(o) : this.channelRates.get(s)) ?? {
497
+ start: c,
498
+ count: 0
499
+ };
500
+ if (o) this.rates.set(o, l);
501
+ else {
502
+ for (let [e, t] of this.channelRates) _(t, 1e3, c) && this.channelRates.delete(e);
503
+ if (this.channelRates.size >= 256 && !this.channelRates.has(s)) return !1;
504
+ this.channelRates.set(s, l);
505
+ }
506
+ if (!v(l, i.maxMessagesPerSecond ?? Infinity, 1e3)) return !1;
507
+ let u = JSON.stringify(e, (e, t) => {
508
+ if (typeof t == "number" && !Number.isFinite(t)) throw Error("Non-finite value");
509
+ return t;
510
+ });
511
+ if (i.maxMessageBytes !== null && new TextEncoder().encode(u).length > i.maxMessageBytes || !S(e) || e.t === r.records && i.maxRecordsPerMessage !== null && e.records.length > i.maxRecordsPerMessage) return !1;
512
+ if (a) {
513
+ let t = e.t === r.records || e.t === r.flushRequest ? "records" : e.t === r.journey ? "journey:write" : e.t === r.journeyRequest ? "journey:read" : e.t === r.samplingRequest ? "sampling:read" : void 0;
514
+ if (t && !a.permissions?.includes(t)) return !1;
515
+ }
516
+ return n && (e.t === r.sampling || e.t === r.securityContext || e.t === r.flushResult) || t.link === "broadcast" && e.t === r.flushRequest ? !1 : i.sourcePolicy !== "registered" || t.link !== "broadcast" || e.t !== r.records;
517
+ }
518
+ routeMessage(e, t) {
519
+ if (e.from !== this.contextId) switch (e.t) {
520
+ case r.hello:
521
+ this.canOwn(t.link) && this.answer(t, {
522
+ t: r.welcome,
523
+ from: this.contextId,
524
+ to: e.from,
525
+ tabId: this.tabId,
526
+ routingContextId: this.awaitingWelcome ? void 0 : this.config.securityContext.id || void 0
527
+ });
528
+ break;
529
+ case r.welcome:
530
+ if (e.to !== this.contextId) break;
531
+ if (this.awaitingWelcome?.link === t.link || this.upstream?.kind === t.link && this.ownerId === null) {
532
+ this.ownerId = e.from, this.ownerPeer = t.peer;
533
+ let n = this.config.securityContext.id;
534
+ if (e.routingContextId && this.handlers.onSecurityContext?.(e.routingContextId) === !1) break;
535
+ this.config.securityContext.id !== n && this.passContext(!1), this.awaitingWelcome?.settle(!0);
536
+ }
537
+ break;
538
+ case r.records:
539
+ if (this.config.securityContext.isolation && this.config.securityContext.id && e.routingContextId !== this.config.securityContext.id) {
540
+ this.diagnostics.count("security.context_mismatch");
541
+ break;
542
+ }
543
+ this.role === "sender" || this.handlers.paused?.() && this.canRelay(t.link) ? this.handlers.onRecords(e.records) : this.upstream && this.canRelay(t.link) && this.upstream.post(e);
544
+ break;
545
+ case r.securityContext:
546
+ t.link === this.upstream?.kind && this.ownerId === e.from && this.ownerPeer === t.peer && this.handlers.onSecurityContext?.(e.id) !== !1 && this.rotateContext();
547
+ break;
548
+ case r.journey:
549
+ this.acceptsJourney(e, t) && this.applyJourney(e.journey);
550
+ break;
551
+ case r.journeyRequest: {
552
+ let n = this.handlers.onJourneyRequest();
553
+ n && this.journeyLink(t.link) && this.answer(t, {
554
+ t: r.journey,
555
+ from: this.contextId,
556
+ to: e.from,
557
+ journey: n
558
+ });
559
+ break;
560
+ }
561
+ case r.samplingRequest:
562
+ (this.role === "forwarder" ? t.link !== this.upstream?.kind : this.canOwn(t.link)) && this.answer(t, this.rulesAnswer(e.from));
563
+ break;
564
+ case r.sampling:
565
+ this.acceptsRules(e.to, t) && this.applyRules(e.rules);
566
+ break;
567
+ case r.flushRequest:
568
+ (this.role === "sender" || this.canRelay(t.link)) && this.queueFlush(e, t);
569
+ break;
570
+ case r.flushResult:
571
+ this.settleFlush(e, t);
572
+ break;
573
+ case r.tab: t.link === "broadcast" && e.tabId === this.tabId && this.contextId > e.from && this.handlers.onTabConflict();
574
+ }
575
+ }
576
+ queueFlush(e, t) {
577
+ let n = t.peer ?? t.link, i = this.flushQueue.filter((e) => e.source === n).length;
578
+ if (this.flushQueue.length >= 100 || i >= 4) {
579
+ this.diagnostics.count("bus.rejected_message");
580
+ return;
581
+ }
582
+ let a = Math.min(Math.max(e.timeoutMs, 0), o);
583
+ this.flushQueue.push({
584
+ source: n,
585
+ ends: Date.now() + a,
586
+ answer: (n) => {
587
+ this.answer(t, {
588
+ t: r.flushResult,
589
+ from: this.contextId,
590
+ id: e.id,
591
+ result: n
592
+ });
593
+ }
594
+ }), this.flushing || this.runFlushes();
595
+ }
596
+ async runFlushes() {
597
+ this.flushing = !0;
598
+ try {
599
+ for (; this.flushQueue.length > 0;) {
600
+ let e = this.flushedAt + s - Date.now();
601
+ if (e > 0 && await new Promise((t) => {
602
+ y(setTimeout(t, e));
603
+ }), this.flushQueue.length === 0) return;
604
+ this.flushedAt = Date.now();
605
+ let t = this.flushQueue;
606
+ this.flushQueue = [];
607
+ let n = Math.max(...t.map((e) => e.ends)), r = await this.diagnostics.guardAsync("pipeline.crashed", "The flush that a child context asked for failed. The child gets no answer.", async () => this.handlers.onFlush?.(Math.max(0, n - Date.now())));
608
+ if (r && !this.destroyed) for (let e of t) this.diagnostics.guard("bus.send_failed", "The answer to a flush request failed.", () => {
609
+ e.answer(r);
610
+ });
611
+ }
612
+ } finally {
613
+ this.flushing = !1;
614
+ }
615
+ }
616
+ settleFlush(e, t) {
617
+ let n = this.flushAnswers.get(e.id), r = this.ownerPeer === void 0 ? t.link !== "openfin" : this.ownerPeer === t.peer;
618
+ if (!n || !r || !this.fromOwner(e.from, t.link)) return;
619
+ let i;
620
+ try {
621
+ i = C(e.result);
622
+ } catch {
623
+ i = null;
624
+ }
625
+ i ? n(i) : this.diagnostics.count("bus.rejected_message");
626
+ }
627
+ answer(e, t) {
628
+ e.reply ? e.reply(t) : this.postOver(e.link, t);
629
+ }
630
+ canRelay(e) {
631
+ return e === "direct" || e !== this.upstream?.kind;
632
+ }
633
+ canOwn(e) {
634
+ return this.role !== "sender" && this.ownerId === null ? !1 : e === "openfin" ? this.role === "sender" && this.isOpenFinProvider : H.includes(e);
635
+ }
636
+ resolveOpenFinProvider() {
637
+ let e = this.config.bus.openFinRole;
638
+ if (e !== "auto") return e === "provider";
639
+ if (this.platform.platform !== "openfin" && this.platform.platform !== "openfin_web") return !1;
640
+ let t = g()?.me;
641
+ return !t?.identity || t.isView ? !1 : !!(t.identity.name && t.identity.name === t.identity.uuid);
642
+ }
643
+ orphanPolicy() {
644
+ return this.isCrossOriginFrame() ? "retry" : "promote";
645
+ }
646
+ isCrossOriginFrame() {
647
+ if (typeof window > "u" || window.parent === window) return !1;
648
+ try {
649
+ return Reflect.get(window.parent, "location"), !1;
650
+ } catch {
651
+ return !0;
652
+ }
653
+ }
654
+ candidateUpstream() {
655
+ return this.platform.isWorker ? z(this.receive, this.diagnostics) : this.platform.isTopLevelDocument ? this.platform.platform === "openfin" && !this.isOpenFinProvider ? this.ensureOpenFinLink() : null : F(this.receive, this.config.bus.trustedOrigins, this.diagnostics);
656
+ }
657
+ openControlLinks() {
658
+ let e = (e) => {
659
+ e && this.links.push(e);
660
+ };
661
+ this.platform.isWorker || this.ensureChildrenLink(), this.platform.isTopLevelDocument && e(L(i, this.receive, this.diagnostics)), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
662
+ }
663
+ ensureChildrenLink() {
664
+ if (this.links.some((e) => e.kind === "children")) return;
665
+ let e = I(this.receive, this.config.bus.trustedOrigins, this.diagnostics, (e, t) => {
666
+ let n = this.isRegistered(e, t);
667
+ if (!n) {
668
+ this.diagnostics.count("bus.rejected_message");
669
+ let n = e !== null && this.sources.has(e), r = t === N() || this.config.bus.trustedOrigins.includes(t);
670
+ (n || !r) && this.diagnostics.report("bus.untrusted_origin", "The bus rejected a message from an untrusted origin.");
671
+ }
672
+ return n;
673
+ }, (e, t) => this.mayPost(e, t));
674
+ e && this.links.push(e);
675
+ }
676
+ ensureOpenFinLink() {
677
+ return this.openFinLink ??= R(i, this.platform.openfinUuid, this.receive, this.diagnostics), this.openFinLink;
678
+ }
679
+ handshake(e) {
680
+ return new Promise((t) => {
681
+ let n = !1, i = (e) => {
682
+ n || (n = !0, this.awaitingWelcome = null, clearTimeout(a), t(e));
683
+ };
684
+ this.awaitingWelcome = {
685
+ link: e.kind,
686
+ settle: i
687
+ };
688
+ let a = setTimeout(() => {
689
+ i(!1);
690
+ }, this.handshakeOptions.timeoutMs);
691
+ y(a), e.post({
692
+ t: r.hello,
693
+ from: this.contextId,
694
+ tabId: this.tabId
695
+ });
696
+ });
697
+ }
698
+ announce() {
699
+ this.postOver("broadcast", {
700
+ t: r.tab,
701
+ from: this.contextId,
702
+ tabId: this.tabId
703
+ }), this.upstream && this.ownerId === null && this.upstream.post({
704
+ t: r.hello,
705
+ from: this.contextId,
706
+ tabId: this.tabId
707
+ }), this.postJourney({
708
+ t: r.journeyRequest,
709
+ from: this.contextId
710
+ }), this.pollRules(), this.passContext(!1);
711
+ }
712
+ journeyScope() {
713
+ let { scope: e } = this.config.journey;
714
+ if (e !== "auto") return e;
715
+ let { platform: t } = this.platform;
716
+ return t === "openfin" || t === "openfin_web" ? "origin" : "tab";
717
+ }
718
+ journeyLink(e) {
719
+ let t = this.journeyScope();
720
+ return t === "context" ? !1 : t === "origin" || e !== "broadcast";
721
+ }
722
+ acceptsJourney(e, t) {
723
+ return !this.journeyLink(t.link) || e.to !== void 0 && e.to !== this.contextId ? !1 : this.journeyScope() === "origin" || this.fromOwner(e.from, t.link) && (this.ownerPeer === void 0 || this.ownerPeer === t.peer);
724
+ }
725
+ fromOwner(e, t) {
726
+ return this.role !== "forwarder" || t !== this.upstream?.kind ? !1 : this.ownerId === null || e === this.ownerId;
727
+ }
728
+ applyJourney(e) {
729
+ if (e === null) {
730
+ this.handlers.onJourney(null);
731
+ return;
732
+ }
733
+ let t = l(e);
734
+ t === null ? this.diagnostics.report("record.dropped_malformed", "The bus dropped a journey message. Its payload is not a journey.", { type: "journey" }) : this.handlers.onJourney(t);
735
+ }
736
+ rulesAnswer(e) {
737
+ let t = this.handlers.remote.sampling?.wire() ?? null;
738
+ return {
739
+ t: r.sampling,
740
+ from: this.contextId,
741
+ to: e,
742
+ rules: t
743
+ };
744
+ }
745
+ acceptsRules(e, t) {
746
+ if (this.role !== "forwarder" || e !== this.contextId || t.link !== this.upstream?.kind) return !1;
747
+ let { origin: n } = t;
748
+ return t.link === "parent" && n !== N() && !this.config.bus.trustedOrigins.includes(n) ? (this.diagnostics.report("bus.untrusted_origin", `The bus ignored sampling rules from ${n}. If you own this origin, add it to bus.trustedOrigins.`, {
749
+ origin: n,
750
+ type: "sampling"
751
+ }), !1) : this.ownerPeer === void 0 || this.ownerPeer === t.peer;
752
+ }
753
+ applyRules(e) {
754
+ if (e === null) {
755
+ d(this.handlers.remote, this.config, null);
756
+ return;
757
+ }
758
+ let t = u(e, this.diagnostics);
759
+ t && d(this.handlers.remote, this.config, t);
760
+ }
761
+ pollRules() {
762
+ let { upstream: e } = this;
763
+ if (this.destroyed || this.role !== "forwarder" || !e) return;
764
+ let t = () => {
765
+ this.config.sampling.remote && e.post({
766
+ t: r.samplingRequest,
767
+ from: this.contextId
768
+ });
769
+ };
770
+ t(), this.rulesPoll = setInterval(t, c), y(this.rulesPoll);
771
+ }
772
+ };
773
+ export { U as Bus };
774
+
775
+ //# sourceMappingURL=bus-C39wspFV.js.map