@utk09/ui-observability 1.0.0 → 1.1.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 (221) hide show
  1. package/CHANGELOG.md +69 -219
  2. package/README.md +24 -26
  3. package/dist/{batch-CXmPmTse.js → batch-D3NHhF9L.js} +3 -3
  4. package/dist/{batch-CXmPmTse.js.map → batch-D3NHhF9L.js.map} +1 -1
  5. package/dist/{batch-mmPigCpi.cjs → batch-DnYRJqhU.cjs} +2 -2
  6. package/dist/{batch-mmPigCpi.cjs.map → batch-DnYRJqhU.cjs.map} +1 -1
  7. package/dist/bus/bus.d.cts +26 -2
  8. package/dist/bus/bus.d.ts +26 -2
  9. package/dist/bus-B__467mL.cjs +2 -0
  10. package/dist/bus-B__467mL.cjs.map +1 -0
  11. package/dist/{bus-C39wspFV.js → bus-dw7T92sO.js} +37 -24
  12. package/dist/bus-dw7T92sO.js.map +1 -0
  13. package/dist/capture/interactions.d.cts +35 -3
  14. package/dist/capture/interactions.d.ts +35 -3
  15. package/dist/capture/observed-windows.d.cts +51 -0
  16. package/dist/capture/observed-windows.d.ts +51 -0
  17. package/dist/{compression-CvED_Jel.cjs → compression-C0hUHKR-.cjs} +2 -2
  18. package/dist/{compression-CvED_Jel.cjs.map → compression-C0hUHKR-.cjs.map} +1 -1
  19. package/dist/{compression-tVtXwVjX.js → compression-SHPAvS4U.js} +2 -2
  20. package/dist/{compression-tVtXwVjX.js.map → compression-SHPAvS4U.js.map} +1 -1
  21. package/dist/{config-SgQcCP1_.js → config-CSNcS7OZ.js} +194 -196
  22. package/dist/config-CSNcS7OZ.js.map +1 -0
  23. package/dist/config-CybPP5VM.cjs +2 -0
  24. package/dist/config-CybPP5VM.cjs.map +1 -0
  25. package/dist/{console-BGgGnjSi.js → console-BsM-fSCQ.js} +4 -4
  26. package/dist/{console-BGgGnjSi.js.map → console-BsM-fSCQ.js.map} +1 -1
  27. package/dist/{console-CSZ5_Vx5.cjs → console-Dkxs6IVQ.cjs} +2 -2
  28. package/dist/{console-CSZ5_Vx5.cjs.map → console-Dkxs6IVQ.cjs.map} +1 -1
  29. package/dist/{constants-CUyd9cTZ.js → constants-BwJDXzj6.js} +23 -23
  30. package/dist/constants-BwJDXzj6.js.map +1 -0
  31. package/dist/constants-CtF52hIV.cjs +2 -0
  32. package/dist/constants-CtF52hIV.cjs.map +1 -0
  33. package/dist/constants.d.cts +12 -0
  34. package/dist/constants.d.ts +12 -0
  35. package/dist/core/diagnostics.d.cts +1 -1
  36. package/dist/core/diagnostics.d.ts +1 -1
  37. package/dist/core/rotation.d.cts +26 -2
  38. package/dist/core/rotation.d.ts +26 -2
  39. package/dist/core/runtime.d.cts +9 -0
  40. package/dist/core/runtime.d.ts +9 -0
  41. package/dist/{debug-bundle-BXIlwDKM.cjs → debug-bundle-B2v6Cym-.cjs} +2 -2
  42. package/dist/{debug-bundle-BXIlwDKM.cjs.map → debug-bundle-B2v6Cym-.cjs.map} +1 -1
  43. package/dist/{debug-bundle-CRpYV_ui.js → debug-bundle-Cs_YWzTa.js} +4 -4
  44. package/dist/{debug-bundle-CRpYV_ui.js.map → debug-bundle-Cs_YWzTa.js.map} +1 -1
  45. package/dist/doctor.cjs +1 -1
  46. package/dist/doctor.js +31 -31
  47. package/dist/doctor.js.map +1 -1
  48. package/dist/{errors-CNPbesMs.cjs → errors-DP2RUm4V.cjs} +2 -2
  49. package/dist/{errors-CNPbesMs.cjs.map → errors-DP2RUm4V.cjs.map} +1 -1
  50. package/dist/{errors-BE_EZV7Q.js → errors-Q3Ng1ciC.js} +3 -3
  51. package/dist/{errors-BE_EZV7Q.js.map → errors-Q3Ng1ciC.js.map} +1 -1
  52. package/dist/{factory-CTi0Is3F.js → factory-DV17sm2p.js} +22 -22
  53. package/dist/{factory-CTi0Is3F.js.map → factory-DV17sm2p.js.map} +1 -1
  54. package/dist/{factory-hRrH32v5.cjs → factory-K8O6gpux.cjs} +2 -2
  55. package/dist/{factory-hRrH32v5.cjs.map → factory-K8O6gpux.cjs.map} +1 -1
  56. package/dist/{identity-DdhKgrpk.js → identity-BgtHyY4u.js} +38 -27
  57. package/dist/identity-BgtHyY4u.js.map +1 -0
  58. package/dist/identity-CvuyqZk7.cjs +2 -0
  59. package/dist/identity-CvuyqZk7.cjs.map +1 -0
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +1 -0
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.js +600 -569
  65. package/dist/index.js.map +1 -1
  66. package/dist/{indexeddb-storage-CL9uqBCy.cjs → indexeddb-storage-D4KVcqdD.cjs} +2 -2
  67. package/dist/{indexeddb-storage-CL9uqBCy.cjs.map → indexeddb-storage-D4KVcqdD.cjs.map} +1 -1
  68. package/dist/{indexeddb-storage-GHdl0t8A.js → indexeddb-storage-e-13ZLWm.js} +17 -17
  69. package/dist/{indexeddb-storage-GHdl0t8A.js.map → indexeddb-storage-e-13ZLWm.js.map} +1 -1
  70. package/dist/interactions-Byxf1C82.js +207 -0
  71. package/dist/interactions-Byxf1C82.js.map +1 -0
  72. package/dist/interactions-OK85T-Dk.cjs +2 -0
  73. package/dist/interactions-OK85T-Dk.cjs.map +1 -0
  74. package/dist/{journey-D2_sia57.js → journey-C93FTYcs.js} +14 -14
  75. package/dist/{journey-D2_sia57.js.map → journey-C93FTYcs.js.map} +1 -1
  76. package/dist/{journey-B4Adltjm.cjs → journey-nMbob3OB.cjs} +2 -2
  77. package/dist/{journey-B4Adltjm.cjs.map → journey-nMbob3OB.cjs.map} +1 -1
  78. package/dist/{library-console-CPW6bvZH.cjs → library-console-DJUQzcgM.cjs} +2 -2
  79. package/dist/{library-console-CPW6bvZH.cjs.map → library-console-DJUQzcgM.cjs.map} +1 -1
  80. package/dist/{library-console-Btrzt814.js → library-console-DklSmucS.js} +2 -2
  81. package/dist/{library-console-Btrzt814.js.map → library-console-DklSmucS.js.map} +1 -1
  82. package/dist/{library-request-BJ9PLRaD.js → library-request-UGEwOHpf.js} +2 -2
  83. package/dist/{library-request-BJ9PLRaD.js.map → library-request-UGEwOHpf.js.map} +1 -1
  84. package/dist/{library-request-D7OvTxZV.cjs → library-request-kY9iTpIF.cjs} +2 -2
  85. package/dist/{library-request-D7OvTxZV.cjs.map → library-request-kY9iTpIF.cjs.map} +1 -1
  86. package/dist/{lifecycle-22CUCrc9.js → lifecycle-B2PlIuQu.js} +2 -2
  87. package/dist/{lifecycle-22CUCrc9.js.map → lifecycle-B2PlIuQu.js.map} +1 -1
  88. package/dist/{lifecycle-IaAm1mOC.cjs → lifecycle-DaMdH_X7.cjs} +2 -2
  89. package/dist/{lifecycle-IaAm1mOC.cjs.map → lifecycle-DaMdH_X7.cjs.map} +1 -1
  90. package/dist/{log-record-CkivuiEl.cjs → log-record-Bmx6etMh.cjs} +2 -2
  91. package/dist/{log-record-CkivuiEl.cjs.map → log-record-Bmx6etMh.cjs.map} +1 -1
  92. package/dist/{log-record-BNiLfqtL.js → log-record-DSt2P-Sr.js} +2 -2
  93. package/dist/{log-record-BNiLfqtL.js.map → log-record-DSt2P-Sr.js.map} +1 -1
  94. package/dist/{long-frames-DNFaRnC3.js → long-frames-Bamjs1WV.js} +3 -3
  95. package/dist/{long-frames-DNFaRnC3.js.map → long-frames-Bamjs1WV.js.map} +1 -1
  96. package/dist/{long-frames-BUUbXd-B.cjs → long-frames-lhtONgGt.cjs} +2 -2
  97. package/dist/{long-frames-BUUbXd-B.cjs.map → long-frames-lhtONgGt.cjs.map} +1 -1
  98. package/dist/models/bus.d.cts +6 -1
  99. package/dist/models/bus.d.ts +6 -1
  100. package/dist/models/config.d.cts +23 -8
  101. package/dist/models/config.d.ts +23 -8
  102. package/dist/models/serializer.d.cts +3 -1
  103. package/dist/models/serializer.d.ts +3 -1
  104. package/dist/{network-CGMLQ-mA.cjs → network-BCn8Gn47.cjs} +2 -2
  105. package/dist/{network-CGMLQ-mA.cjs.map → network-BCn8Gn47.cjs.map} +1 -1
  106. package/dist/{network-on2zZT6H.js → network-Cg1L2w2r.js} +12 -12
  107. package/dist/{network-on2zZT6H.js.map → network-Cg1L2w2r.js.map} +1 -1
  108. package/dist/observed-windows-B3gJkdql.cjs +2 -0
  109. package/dist/observed-windows-B3gJkdql.cjs.map +1 -0
  110. package/dist/observed-windows-BrwaJNlj.js +64 -0
  111. package/dist/observed-windows-BrwaJNlj.js.map +1 -0
  112. package/dist/{otlp-BENHf3g9.cjs → otlp-CrAWkQdO.cjs} +2 -2
  113. package/dist/{otlp-BENHf3g9.cjs.map → otlp-CrAWkQdO.cjs.map} +1 -1
  114. package/dist/{otlp-DimfrRor.js → otlp-D6dRZyB8.js} +6 -6
  115. package/dist/{otlp-DimfrRor.js.map → otlp-D6dRZyB8.js.map} +1 -1
  116. package/dist/{platform-BaaFIPCU.js → platform-8DLhjddo.js} +7 -7
  117. package/dist/{platform-BaaFIPCU.js.map → platform-8DLhjddo.js.map} +1 -1
  118. package/dist/{platform-CfA3-7sJ.cjs → platform-BqRc-7RO.cjs} +2 -2
  119. package/dist/{platform-CfA3-7sJ.cjs.map → platform-BqRc-7RO.cjs.map} +1 -1
  120. package/dist/{profiler-BAZoh7A4.js → profiler-BaXSqCfz.js} +59 -59
  121. package/dist/{profiler-BAZoh7A4.js.map → profiler-BaXSqCfz.js.map} +1 -1
  122. package/dist/{profiler-D4tJpDRc.cjs → profiler-BvWW2kNM.cjs} +2 -2
  123. package/dist/{profiler-D4tJpDRc.cjs.map → profiler-BvWW2kNM.cjs.map} +1 -1
  124. package/dist/{profiler-frames-cJMx9wNM.js → profiler-frames-C4ySHN0X.js} +16 -16
  125. package/dist/{profiler-frames-cJMx9wNM.js.map → profiler-frames-C4ySHN0X.js.map} +1 -1
  126. package/dist/{profiler-frames-C4xr7KfH.cjs → profiler-frames-DeaBiB-5.cjs} +2 -2
  127. package/dist/{profiler-frames-C4xr7KfH.cjs.map → profiler-frames-DeaBiB-5.cjs.map} +1 -1
  128. package/dist/{remote-rules-_tY0zj5o.cjs → remote-rules-D7L6D_D2.cjs} +2 -2
  129. package/dist/{remote-rules-_tY0zj5o.cjs.map → remote-rules-D7L6D_D2.cjs.map} +1 -1
  130. package/dist/{remote-rules-Dz9MRAsB.js → remote-rules-Dq9xe7Qn.js} +22 -22
  131. package/dist/{remote-rules-Dz9MRAsB.js.map → remote-rules-Dq9xe7Qn.js.map} +1 -1
  132. package/dist/{replay-Ds-ANH34.js → replay-B0M8kWz_.js} +24 -24
  133. package/dist/{replay-Ds-ANH34.js.map → replay-B0M8kWz_.js.map} +1 -1
  134. package/dist/{replay-B3gFXIZd.cjs → replay-QOFBpAXh.cjs} +2 -2
  135. package/dist/{replay-B3gFXIZd.cjs.map → replay-QOFBpAXh.cjs.map} +1 -1
  136. package/dist/{reports-C-thq-bk.js → reports--8APRLa-.js} +3 -3
  137. package/dist/{reports-C-thq-bk.js.map → reports--8APRLa-.js.map} +1 -1
  138. package/dist/{reports-BDSe4dFH.cjs → reports-ojuMKGO7.cjs} +2 -2
  139. package/dist/{reports-BDSe4dFH.cjs.map → reports-ojuMKGO7.cjs.map} +1 -1
  140. package/dist/{resource-timing-eUl2dNgC.js → resource-timing-BzR05rE-.js} +4 -4
  141. package/dist/{resource-timing-eUl2dNgC.js.map → resource-timing-BzR05rE-.js.map} +1 -1
  142. package/dist/{resource-timing-C576gFIQ.cjs → resource-timing-pAG3ZhB5.cjs} +2 -2
  143. package/dist/{resource-timing-C576gFIQ.cjs.map → resource-timing-pAG3ZhB5.cjs.map} +1 -1
  144. package/dist/{response-body-eoSQpLiH.js → response-body-BWvwKQ2p.js} +106 -106
  145. package/dist/{response-body-eoSQpLiH.js.map → response-body-BWvwKQ2p.js.map} +1 -1
  146. package/dist/{response-body-YdNl-HkR.cjs → response-body-CKEJ5itk.cjs} +3 -3
  147. package/dist/{response-body-YdNl-HkR.cjs.map → response-body-CKEJ5itk.cjs.map} +1 -1
  148. package/dist/{rotation-Cwct4ckk.js → rotation-BylN1B9e.js} +10 -11
  149. package/dist/rotation-BylN1B9e.js.map +1 -0
  150. package/dist/rotation-E2eKClIs.cjs +2 -0
  151. package/dist/rotation-E2eKClIs.cjs.map +1 -0
  152. package/dist/{sampling-mXt4dstx.cjs → sampling-B46LW0cy.cjs} +2 -2
  153. package/dist/{sampling-mXt4dstx.cjs.map → sampling-B46LW0cy.cjs.map} +1 -1
  154. package/dist/{sampling-BlrI8jor.js → sampling-zXA6r-Nw.js} +16 -16
  155. package/dist/{sampling-BlrI8jor.js.map → sampling-zXA6r-Nw.js.map} +1 -1
  156. package/dist/{sanitize-Ba0KqU06.js → sanitize-DjnR6RXR.js} +2 -2
  157. package/dist/{sanitize-Ba0KqU06.js.map → sanitize-DjnR6RXR.js.map} +1 -1
  158. package/dist/{sanitize-DQyiI_KY.cjs → sanitize-Qj6LuZqp.cjs} +2 -2
  159. package/dist/{sanitize-DQyiI_KY.cjs.map → sanitize-Qj6LuZqp.cjs.map} +1 -1
  160. package/dist/{sender-Dv8rAmpV.js → sender-Bdp-TAS4.js} +71 -71
  161. package/dist/{sender-Dv8rAmpV.js.map → sender-Bdp-TAS4.js.map} +1 -1
  162. package/dist/{sender-BdRuNVhF.cjs → sender-DR7ZycZY.cjs} +2 -2
  163. package/dist/{sender-BdRuNVhF.cjs.map → sender-DR7ZycZY.cjs.map} +1 -1
  164. package/dist/{stored-context-CXt7eHZL.cjs → stored-context-BOu54M8Y.cjs} +2 -2
  165. package/dist/{stored-context-CXt7eHZL.cjs.map → stored-context-BOu54M8Y.cjs.map} +1 -1
  166. package/dist/{stored-context-B2EzVuYm.js → stored-context-CSttrAsw.js} +6 -6
  167. package/dist/{stored-context-B2EzVuYm.js.map → stored-context-CSttrAsw.js.map} +1 -1
  168. package/dist/{storm-C-zYSdDX.cjs → storm-BHgI12iS.cjs} +2 -2
  169. package/dist/{storm-C-zYSdDX.cjs.map → storm-BHgI12iS.cjs.map} +1 -1
  170. package/dist/{storm-DjKetLKZ.js → storm-DKlpv0FL.js} +2 -2
  171. package/dist/{storm-DjKetLKZ.js.map → storm-DKlpv0FL.js.map} +1 -1
  172. package/dist/{unclean-exit-py99ApzT.cjs → unclean-exit-BYPYYkQ5.cjs} +2 -2
  173. package/dist/{unclean-exit-py99ApzT.cjs.map → unclean-exit-BYPYYkQ5.cjs.map} +1 -1
  174. package/dist/{unclean-exit-DQD1cT7c.js → unclean-exit-BcOB8A2e.js} +2 -2
  175. package/dist/{unclean-exit-DQD1cT7c.js.map → unclean-exit-BcOB8A2e.js.map} +1 -1
  176. package/dist/{user-timing-BePqb1uN.js → user-timing-4KIJ74Vi.js} +2 -2
  177. package/dist/{user-timing-BePqb1uN.js.map → user-timing-4KIJ74Vi.js.map} +1 -1
  178. package/dist/{user-timing-D6XTmpuM.cjs → user-timing-BsU2wQKE.cjs} +2 -2
  179. package/dist/{user-timing-D6XTmpuM.cjs.map → user-timing-BsU2wQKE.cjs.map} +1 -1
  180. package/dist/utils/identity.d.cts +5 -0
  181. package/dist/utils/identity.d.ts +5 -0
  182. package/dist/{web-socket-CoIUBM3C.cjs → web-socket-Cs1ZbmmN.cjs} +2 -2
  183. package/dist/{web-socket-CoIUBM3C.cjs.map → web-socket-Cs1ZbmmN.cjs.map} +1 -1
  184. package/dist/{web-socket-DSHgDiZ6.js → web-socket-Zg0hj1LB.js} +4 -4
  185. package/dist/{web-socket-DSHgDiZ6.js.map → web-socket-Zg0hj1LB.js.map} +1 -1
  186. package/dist/{worker-protocol-x074Rpet.js → worker-protocol-CYpAbrVl.js} +4 -4
  187. package/dist/{worker-protocol-x074Rpet.js.map → worker-protocol-CYpAbrVl.js.map} +1 -1
  188. package/dist/{worker-protocol-QbvqNazn.cjs → worker-protocol-DFYXIFus.cjs} +2 -2
  189. package/dist/{worker-protocol-QbvqNazn.cjs.map → worker-protocol-DFYXIFus.cjs.map} +1 -1
  190. package/dist/{worker-server-CFe4nvos.cjs → worker-server--yGTadTA.cjs} +2 -2
  191. package/dist/{worker-server-CFe4nvos.cjs.map → worker-server--yGTadTA.cjs.map} +1 -1
  192. package/dist/{worker-server-iUVSjH8L.js → worker-server-BokySIII.js} +25 -25
  193. package/dist/{worker-server-iUVSjH8L.js.map → worker-server-BokySIII.js.map} +1 -1
  194. package/dist/worker-transport-BdEvh_-a.cjs +2 -0
  195. package/dist/worker-transport-BdEvh_-a.cjs.map +1 -0
  196. package/dist/{worker-transport-Dy1KMA7t.js → worker-transport-JK-Fby9J.js} +23 -19
  197. package/dist/worker-transport-JK-Fby9J.js.map +1 -0
  198. package/llms.txt +13 -10
  199. package/package.json +13 -5
  200. package/dist/bus-C39wspFV.js.map +0 -1
  201. package/dist/bus-_EaOVPGq.cjs +0 -2
  202. package/dist/bus-_EaOVPGq.cjs.map +0 -1
  203. package/dist/config-DUs7uHHt.cjs +0 -2
  204. package/dist/config-DUs7uHHt.cjs.map +0 -1
  205. package/dist/config-SgQcCP1_.js.map +0 -1
  206. package/dist/constants-CUyd9cTZ.js.map +0 -1
  207. package/dist/constants-CqdJhTxH.cjs +0 -2
  208. package/dist/constants-CqdJhTxH.cjs.map +0 -1
  209. package/dist/identity-DdhKgrpk.js.map +0 -1
  210. package/dist/identity-DlWRIuwy.cjs +0 -2
  211. package/dist/identity-DlWRIuwy.cjs.map +0 -1
  212. package/dist/interactions-CUkzK8sR.cjs +0 -2
  213. package/dist/interactions-CUkzK8sR.cjs.map +0 -1
  214. package/dist/interactions-DiFvCosX.js +0 -111
  215. package/dist/interactions-DiFvCosX.js.map +0 -1
  216. package/dist/rotation-Cwct4ckk.js.map +0 -1
  217. package/dist/rotation-D4qUAHAu.cjs +0 -2
  218. package/dist/rotation-D4qUAHAu.cjs.map +0 -1
  219. package/dist/worker-transport-CRAX-09c.cjs +0 -2
  220. package/dist/worker-transport-CRAX-09c.cjs.map +0 -1
  221. package/dist/worker-transport-Dy1KMA7t.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Mt as e, ir as t } from "./constants-CUyd9cTZ.js";
1
+ import { Nt as e, sr as t } from "./constants-BwJDXzj6.js";
2
2
  import { t as n } from "./global-scope-D9I8s-oN.js";
3
3
  // src/utils/library-request.ts
4
4
  var r = n(e), i = Symbol.for(t), a = globalThis, o = () => a[i] ?? 0;
@@ -21,4 +21,4 @@ function u() {
21
21
  }
22
22
  export { l as i, u as n, s as r, c as t };
23
23
 
24
- //# sourceMappingURL=library-request-BJ9PLRaD.js.map
24
+ //# sourceMappingURL=library-request-UGEwOHpf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"library-request-BJ9PLRaD.js","names":["LIBRARY_REQUEST_KEY","TRANSPORT_CALL_KEY","globalScope","scope","calls","store","pending","runAsLibraryRequest","fn","isLibraryRequest","trackTransportCall","isTransportPending"],"sources":["../src/utils/library-request.ts"],"sourcesContent":["// src/utils/library-request.ts\n//\n// Marks the requests that the library starts itself, so network capture can skip them. A\n// captured library request would log a record, the library would send that record with\n// another request, and the loop would never stop.\n\nimport { LIBRARY_REQUEST_KEY, TRANSPORT_CALL_KEY } from \"../constants\";\nimport { globalScope } from \"./global-scope\";\n\n/** The scope for the library's own requests. */\nconst scope = globalScope(LIBRARY_REQUEST_KEY);\n\n/** Global count of custom transport calls that are still waiting for an answer. */\nconst calls = Symbol.for(TRANSPORT_CALL_KEY);\nconst store = globalThis as unknown as Record<symbol, number | undefined>;\nconst pending = (): number => store[calls] ?? 0;\n\n/**\n * Runs a function inside the library request scope. Only the synchronous part of the function\n * is covered, so a request that starts after an await is outside the scope.\n * @param fn The function that starts the request.\n * @returns The function's return value.\n */\nexport function runAsLibraryRequest<T>(fn: () => T): T {\n return scope.run(fn);\n}\n\n/**\n * Checks whether a library request scope is open.\n * @returns True while the library is starting a request.\n */\nexport function isLibraryRequest(): boolean {\n return scope.open();\n}\n\n/**\n * Runs a custom transport call and counts it until it settles. The count includes the time after\n * each await, which the library request scope does not cover.\n * @param fn The function that calls the custom transport.\n * @returns A promise that settles with the call's result.\n */\nexport async function trackTransportCall<T>(fn: () => T | PromiseLike<T>): Promise<T> {\n store[calls] = pending() + 1;\n\n try {\n return await fn();\n } finally {\n store[calls] = pending() - 1;\n }\n}\n\n/**\n * Checks whether a custom transport call is still waiting for an answer.\n * @returns True while a call hasn't settled.\n */\nexport function isTransportPending(): boolean {\n return pending() > 0;\n}\n"],"mappings":";;;AAUA,IAAMG,IAAQD,EAAYF,CAAmB,GAGvCI,IAAQ,OAAO,IAAIH,CAAkB,GACrCI,IAAQ,YACRC,UAAwBD,EAAMD,MAAU;AAQ9C,SAAgBG,EAAuB,GAAgB;CACrD,OAAOJ,EAAM,IAAIK,CAAE;AACrB;AAMA,SAAgBC,IAA4B;CAC1C,OAAON,EAAM,KAAK;AACpB;AAQA,eAAsBO,EAAsB,GAA0C;CACpF,EAAMN,KAASE,EAAQ,IAAI;CAE3B,IAAI;EACF,OAAO,MAAME,EAAG;CAClB,UAAU;EACR,EAAMJ,KAASE,EAAQ,IAAI;CAC7B;AACF;AAMA,SAAgBK,IAA8B;CAC5C,OAAOL,EAAQ,IAAI;AACrB"}
1
+ {"version":3,"file":"library-request-UGEwOHpf.js","names":["LIBRARY_REQUEST_KEY","TRANSPORT_CALL_KEY","globalScope","scope","calls","store","pending","runAsLibraryRequest","fn","isLibraryRequest","trackTransportCall","isTransportPending"],"sources":["../src/utils/library-request.ts"],"sourcesContent":["// src/utils/library-request.ts\n//\n// Marks the requests that the library starts itself, so network capture can skip them. A\n// captured library request would log a record, the library would send that record with\n// another request, and the loop would never stop.\n\nimport { LIBRARY_REQUEST_KEY, TRANSPORT_CALL_KEY } from \"../constants\";\nimport { globalScope } from \"./global-scope\";\n\n/** The scope for the library's own requests. */\nconst scope = globalScope(LIBRARY_REQUEST_KEY);\n\n/** Global count of custom transport calls that are still waiting for an answer. */\nconst calls = Symbol.for(TRANSPORT_CALL_KEY);\nconst store = globalThis as unknown as Record<symbol, number | undefined>;\nconst pending = (): number => store[calls] ?? 0;\n\n/**\n * Runs a function inside the library request scope. Only the synchronous part of the function\n * is covered, so a request that starts after an await is outside the scope.\n * @param fn The function that starts the request.\n * @returns The function's return value.\n */\nexport function runAsLibraryRequest<T>(fn: () => T): T {\n return scope.run(fn);\n}\n\n/**\n * Checks whether a library request scope is open.\n * @returns True while the library is starting a request.\n */\nexport function isLibraryRequest(): boolean {\n return scope.open();\n}\n\n/**\n * Runs a custom transport call and counts it until it settles. The count includes the time after\n * each await, which the library request scope does not cover.\n * @param fn The function that calls the custom transport.\n * @returns A promise that settles with the call's result.\n */\nexport async function trackTransportCall<T>(fn: () => T | PromiseLike<T>): Promise<T> {\n store[calls] = pending() + 1;\n\n try {\n return await fn();\n } finally {\n store[calls] = pending() - 1;\n }\n}\n\n/**\n * Checks whether a custom transport call is still waiting for an answer.\n * @returns True while a call hasn't settled.\n */\nexport function isTransportPending(): boolean {\n return pending() > 0;\n}\n"],"mappings":";;;AAUA,IAAMG,IAAQD,EAAYF,CAAmB,GAGvCI,IAAQ,OAAO,IAAIH,CAAkB,GACrCI,IAAQ,YACRC,UAAwBD,EAAMD,MAAU;AAQ9C,SAAgBG,EAAuB,GAAgB;CACrD,OAAOJ,EAAM,IAAIK,CAAE;AACrB;AAMA,SAAgBC,IAA4B;CAC1C,OAAON,EAAM,KAAK;AACpB;AAQA,eAAsBO,EAAsB,GAA0C;CACpF,EAAMN,KAASE,EAAQ,IAAI;CAE3B,IAAI;EACF,OAAO,MAAME,EAAG;CAClB,UAAU;EACR,EAAMJ,KAASE,EAAQ,IAAI;CAC7B;AACF;AAMA,SAAgBK,IAA8B;CAC5C,OAAOL,EAAQ,IAAI;AACrB"}
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CqdJhTxH.cjs");var t=require("./global-scope-BN-Io_yv.cjs").t(e.Mt),n=Symbol.for(e.ir),r=globalThis,i=()=>r[n]??0;function a(e){return t.run(e)}function o(){return t.open()}async function s(e){r[n]=i()+1;try{return await e()}finally{r[n]=i()-1}}function c(){return i()>0}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
2
- //# sourceMappingURL=library-request-D7OvTxZV.cjs.map
1
+ const e=require("./constants-CtF52hIV.cjs");var t=require("./global-scope-BN-Io_yv.cjs").t(e.Nt),n=Symbol.for(e.sr),r=globalThis,i=()=>r[n]??0;function a(e){return t.run(e)}function o(){return t.open()}async function s(e){r[n]=i()+1;try{return await e()}finally{r[n]=i()-1}}function c(){return i()>0}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
2
+ //# sourceMappingURL=library-request-kY9iTpIF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"library-request-D7OvTxZV.cjs","names":["globalScope","LIBRARY_REQUEST_KEY","TRANSPORT_CALL_KEY","require_constants","scope","calls","store","pending","runAsLibraryRequest","fn","isLibraryRequest","trackTransportCall","isTransportPending"],"sources":["../src/utils/library-request.ts"],"sourcesContent":["// src/utils/library-request.ts\n//\n// Marks the requests that the library starts itself, so network capture can skip them. A\n// captured library request would log a record, the library would send that record with\n// another request, and the loop would never stop.\n\nimport { LIBRARY_REQUEST_KEY, TRANSPORT_CALL_KEY } from \"../constants\";\nimport { globalScope } from \"./global-scope\";\n\n/** The scope for the library's own requests. */\nconst scope = globalScope(LIBRARY_REQUEST_KEY);\n\n/** Global count of custom transport calls that are still waiting for an answer. */\nconst calls = Symbol.for(TRANSPORT_CALL_KEY);\nconst store = globalThis as unknown as Record<symbol, number | undefined>;\nconst pending = (): number => store[calls] ?? 0;\n\n/**\n * Runs a function inside the library request scope. Only the synchronous part of the function\n * is covered, so a request that starts after an await is outside the scope.\n * @param fn The function that starts the request.\n * @returns The function's return value.\n */\nexport function runAsLibraryRequest<T>(fn: () => T): T {\n return scope.run(fn);\n}\n\n/**\n * Checks whether a library request scope is open.\n * @returns True while the library is starting a request.\n */\nexport function isLibraryRequest(): boolean {\n return scope.open();\n}\n\n/**\n * Runs a custom transport call and counts it until it settles. The count includes the time after\n * each await, which the library request scope does not cover.\n * @param fn The function that calls the custom transport.\n * @returns A promise that settles with the call's result.\n */\nexport async function trackTransportCall<T>(fn: () => T | PromiseLike<T>): Promise<T> {\n store[calls] = pending() + 1;\n\n try {\n return await fn();\n } finally {\n store[calls] = pending() - 1;\n }\n}\n\n/**\n * Checks whether a custom transport call is still waiting for an answer.\n * @returns True while a call hasn't settled.\n */\nexport function isTransportPending(): boolean {\n return pending() > 0;\n}\n"],"mappings":"A,4CAUA,IAAMI,E,qCAAQJ,CAAAA,CAAAA,EAAYC,EAAAA,EAAmB,EAGvCI,EAAQ,OAAO,IAAIH,EAAAA,EAAkB,EACrCI,EAAQ,WACRC,MAAwBD,EAAMD,IAAU,EAQ9C,SAAgBG,EAAuB,EAAgB,CACrD,OAAOJ,EAAM,IAAIK,CAAE,CACrB,CAMA,SAAgBC,GAA4B,CAC1C,OAAON,EAAM,KAAK,CACpB,CAQA,eAAsBO,EAAsB,EAA0C,CACpF,EAAMN,GAASE,EAAQ,EAAI,EAE3B,GAAI,CACF,OAAO,MAAME,EAAG,CAClB,QAAU,CACR,EAAMJ,GAASE,EAAQ,EAAI,CAC7B,CACF,CAMA,SAAgBK,GAA8B,CAC5C,OAAOL,EAAQ,EAAI,CACrB,C"}
1
+ {"version":3,"file":"library-request-kY9iTpIF.cjs","names":["globalScope","LIBRARY_REQUEST_KEY","TRANSPORT_CALL_KEY","require_constants","scope","calls","store","pending","runAsLibraryRequest","fn","isLibraryRequest","trackTransportCall","isTransportPending"],"sources":["../src/utils/library-request.ts"],"sourcesContent":["// src/utils/library-request.ts\n//\n// Marks the requests that the library starts itself, so network capture can skip them. A\n// captured library request would log a record, the library would send that record with\n// another request, and the loop would never stop.\n\nimport { LIBRARY_REQUEST_KEY, TRANSPORT_CALL_KEY } from \"../constants\";\nimport { globalScope } from \"./global-scope\";\n\n/** The scope for the library's own requests. */\nconst scope = globalScope(LIBRARY_REQUEST_KEY);\n\n/** Global count of custom transport calls that are still waiting for an answer. */\nconst calls = Symbol.for(TRANSPORT_CALL_KEY);\nconst store = globalThis as unknown as Record<symbol, number | undefined>;\nconst pending = (): number => store[calls] ?? 0;\n\n/**\n * Runs a function inside the library request scope. Only the synchronous part of the function\n * is covered, so a request that starts after an await is outside the scope.\n * @param fn The function that starts the request.\n * @returns The function's return value.\n */\nexport function runAsLibraryRequest<T>(fn: () => T): T {\n return scope.run(fn);\n}\n\n/**\n * Checks whether a library request scope is open.\n * @returns True while the library is starting a request.\n */\nexport function isLibraryRequest(): boolean {\n return scope.open();\n}\n\n/**\n * Runs a custom transport call and counts it until it settles. The count includes the time after\n * each await, which the library request scope does not cover.\n * @param fn The function that calls the custom transport.\n * @returns A promise that settles with the call's result.\n */\nexport async function trackTransportCall<T>(fn: () => T | PromiseLike<T>): Promise<T> {\n store[calls] = pending() + 1;\n\n try {\n return await fn();\n } finally {\n store[calls] = pending() - 1;\n }\n}\n\n/**\n * Checks whether a custom transport call is still waiting for an answer.\n * @returns True while a call hasn't settled.\n */\nexport function isTransportPending(): boolean {\n return pending() > 0;\n}\n"],"mappings":"A,4CAUA,IAAMI,E,qCAAQJ,CAAAA,CAAAA,EAAYC,EAAAA,EAAmB,EAGvCI,EAAQ,OAAO,IAAIH,EAAAA,EAAkB,EACrCI,EAAQ,WACRC,MAAwBD,EAAMD,IAAU,EAQ9C,SAAgBG,EAAuB,EAAgB,CACrD,OAAOJ,EAAM,IAAIK,CAAE,CACrB,CAMA,SAAgBC,GAA4B,CAC1C,OAAON,EAAM,KAAK,CACpB,CAQA,eAAsBO,EAAsB,EAA0C,CACpF,EAAMN,GAASE,EAAQ,EAAI,EAE3B,GAAI,CACF,OAAO,MAAME,EAAG,CAClB,QAAU,CACR,EAAMJ,GAASE,EAAQ,EAAI,CAC7B,CACF,CAMA,SAAgBK,GAA8B,CAC5C,OAAOL,EAAQ,EAAI,CACrB,C"}
@@ -1,4 +1,4 @@
1
- import { t as e } from "./storm-DjKetLKZ.js";
1
+ import { t as e } from "./storm-DKlpv0FL.js";
2
2
  import { t } from "./defineProperty-s2S8BXUc.js";
3
3
  // src/capture/lifecycle.ts
4
4
  var n = class {
@@ -44,4 +44,4 @@ var n = class {
44
44
  };
45
45
  export { n as LifecycleCapture };
46
46
 
47
- //# sourceMappingURL=lifecycle-22CUCrc9.js.map
47
+ //# sourceMappingURL=lifecycle-B2PlIuQu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle-22CUCrc9.js","names":["allowInWindow","LifecycleCapture","_defineProperty","event","ctx","state","now","previous","duration","captureLimits"],"sources":["../src/capture/lifecycle.ts"],"sourcesContent":["import { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext, CaptureOnce } from \"./types\";\n\n/** Records page state changes, each with how long the previous state lasted. */\nexport class LifecycleCapture implements Capture {\n readonly name = \"lifecycle\";\n\n private installed = false;\n\n private phase: NonNullable<CaptureOnce[\"lifecycle\"]> = { state: \"\", enteredAt: 0 };\n\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Installs the document and back-forward cache listeners. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n this.ctx.once.lifecycle ??= { state: \"\", enteredAt: performance.now() };\n this.phase = this.ctx.once.lifecycle;\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n document.addEventListener(\"freeze\", this.onFreeze);\n document.addEventListener(\"resume\", this.onResume);\n addEventListener(\"pageshow\", this.onPageShow);\n this.onVisibility();\n }\n\n /** Removes all listeners. */\n uninstall(): void {\n this.installed = false;\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n document.removeEventListener(\"freeze\", this.onFreeze);\n document.removeEventListener(\"resume\", this.onResume);\n removeEventListener(\"pageshow\", this.onPageShow);\n }\n\n private readonly onVisibility = (): void => {\n this.transition(document.visibilityState === \"hidden\" ? \"hidden\" : \"visible\");\n };\n\n private readonly onFreeze = (): void => {\n this.transition(\"frozen\");\n };\n\n private readonly onResume = (): void => {\n this.transition(\"resumed\");\n };\n\n private readonly onPageShow = (event: PageTransitionEvent): void => {\n if (event.persisted) {\n this.transition(\"restored\");\n }\n };\n\n /** Updates the state even when the rate limit drops its event. */\n private transition(state: string): void {\n if (!this.installed || state === this.phase.state) {\n return;\n }\n\n const now = performance.now();\n const previous = this.phase.state;\n const duration = Math.max(0, now - this.phase.enteredAt);\n this.phase.state = state;\n this.phase.enteredAt = now;\n\n const { captureLimits } = this.ctx.config;\n if (\n this.ctx.isActive?.() === false ||\n !allowInWindow(\n this.window,\n captureLimits.lifecyclePerWindow,\n this.ctx.diagnostics,\n \"lifecycle events\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a lifecycle event.\",\n () => {\n this.ctx.logger.logEvent(\"ui.lifecycle\", {\n \"lifecycle.state\": state,\n \"lifecycle.previous_state\": previous,\n \"lifecycle.duration_ms\": duration,\n });\n },\n );\n }\n}\n"],"mappings":";;;AAIA,IAAaC,IAAb,MAAiD;CAS/C,YAAY,GAAsC;EAArB,AAAAC,EAAA,MAAA,OAAA,KAAA,CAAA,GAR7BA,EAAA,MAAA,QAAgB,WAAA,GAEhBA,EAAA,MAAA,aAAoB,EAAA,GAEpBA,EAAA,MAAA,SAAuD;GAAE,OAAO;GAAI,WAAW;EAAE,CAAA,GAEjFA,EAAA,MAAA,UAAuC;GAAE,OAAO;GAAG,OAAO;EAAE,CAAA,GA4B5DA,EAAA,MAAA,sBAA4C;GAC1C,KAAK,WAAW,SAAS,oBAAoB,WAAW,WAAW,SAAS;EAC9E,CAAA,GAEAA,EAAA,MAAA,kBAAwC;GACtC,KAAK,WAAW,QAAQ;EAC1B,CAAA,GAEAA,EAAA,MAAA,kBAAwC;GACtC,KAAK,WAAW,SAAS;EAC3B,C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file":"lifecycle-B2PlIuQu.js","names":["allowInWindow","LifecycleCapture","_defineProperty","event","ctx","state","now","previous","duration","captureLimits"],"sources":["../src/capture/lifecycle.ts"],"sourcesContent":["import { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext, CaptureOnce } from \"./types\";\n\n/** Records page state changes, each with how long the previous state lasted. */\nexport class LifecycleCapture implements Capture {\n readonly name = \"lifecycle\";\n\n private installed = false;\n\n private phase: NonNullable<CaptureOnce[\"lifecycle\"]> = { state: \"\", enteredAt: 0 };\n\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Installs the document and back-forward cache listeners. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n this.ctx.once.lifecycle ??= { state: \"\", enteredAt: performance.now() };\n this.phase = this.ctx.once.lifecycle;\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n document.addEventListener(\"freeze\", this.onFreeze);\n document.addEventListener(\"resume\", this.onResume);\n addEventListener(\"pageshow\", this.onPageShow);\n this.onVisibility();\n }\n\n /** Removes all listeners. */\n uninstall(): void {\n this.installed = false;\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n document.removeEventListener(\"freeze\", this.onFreeze);\n document.removeEventListener(\"resume\", this.onResume);\n removeEventListener(\"pageshow\", this.onPageShow);\n }\n\n private readonly onVisibility = (): void => {\n this.transition(document.visibilityState === \"hidden\" ? \"hidden\" : \"visible\");\n };\n\n private readonly onFreeze = (): void => {\n this.transition(\"frozen\");\n };\n\n private readonly onResume = (): void => {\n this.transition(\"resumed\");\n };\n\n private readonly onPageShow = (event: PageTransitionEvent): void => {\n if (event.persisted) {\n this.transition(\"restored\");\n }\n };\n\n /** Updates the state even when the rate limit drops its event. */\n private transition(state: string): void {\n if (!this.installed || state === this.phase.state) {\n return;\n }\n\n const now = performance.now();\n const previous = this.phase.state;\n const duration = Math.max(0, now - this.phase.enteredAt);\n this.phase.state = state;\n this.phase.enteredAt = now;\n\n const { captureLimits } = this.ctx.config;\n if (\n this.ctx.isActive?.() === false ||\n !allowInWindow(\n this.window,\n captureLimits.lifecyclePerWindow,\n this.ctx.diagnostics,\n \"lifecycle events\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a lifecycle event.\",\n () => {\n this.ctx.logger.logEvent(\"ui.lifecycle\", {\n \"lifecycle.state\": state,\n \"lifecycle.previous_state\": previous,\n \"lifecycle.duration_ms\": duration,\n });\n },\n );\n }\n}\n"],"mappings":";;;AAIA,IAAaC,IAAb,MAAiD;CAS/C,YAAY,GAAsC;EAArB,AAAAC,EAAA,MAAA,OAAA,KAAA,CAAA,GAR7BA,EAAA,MAAA,QAAgB,WAAA,GAEhBA,EAAA,MAAA,aAAoB,EAAA,GAEpBA,EAAA,MAAA,SAAuD;GAAE,OAAO;GAAI,WAAW;EAAE,CAAA,GAEjFA,EAAA,MAAA,UAAuC;GAAE,OAAO;GAAG,OAAO;EAAE,CAAA,GA4B5DA,EAAA,MAAA,sBAA4C;GAC1C,KAAK,WAAW,SAAS,oBAAoB,WAAW,WAAW,SAAS;EAC9E,CAAA,GAEAA,EAAA,MAAA,kBAAwC;GACtC,KAAK,WAAW,QAAQ;EAC1B,CAAA,GAEAA,EAAA,MAAA,kBAAwC;GACtC,KAAK,WAAW,SAAS;EAC3B,CAAA,GAEAA,EAAA,MAAA,eAA+B,MAAqC;GAClE,AAAIC,EAAM,aACR,KAAK,WAAW,UAAU;EAE9B,CAAA,GA1C6B,KAAA,MAAAC;CAAsB;CAGnD,UAAgB;EACd,AAAI,KAAK,cAGT,KAAK,YAAY,IACjB,KAAK,IAAI,KAAK,cAAc;GAAE,OAAO;GAAI,WAAW,YAAY,IAAI;EAAE,GACtE,KAAK,QAAQ,KAAK,IAAI,KAAK,WAC3B,SAAS,iBAAiB,oBAAoB,KAAK,YAAY,GAC/D,SAAS,iBAAiB,UAAU,KAAK,QAAQ,GACjD,SAAS,iBAAiB,UAAU,KAAK,QAAQ,GACjD,iBAAiB,YAAY,KAAK,UAAU,GAC5C,KAAK,aAAa;CACpB;CAGA,YAAkB;EAKhB,AAJA,KAAK,YAAY,IACjB,SAAS,oBAAoB,oBAAoB,KAAK,YAAY,GAClE,SAAS,oBAAoB,UAAU,KAAK,QAAQ,GACpD,SAAS,oBAAoB,UAAU,KAAK,QAAQ,GACpD,oBAAoB,YAAY,KAAK,UAAU;CACjD;CAqBA,WAAmB,GAAqB;EACtC,IAAI,CAAC,KAAK,aAAaC,MAAU,KAAK,MAAM,OAC1C;EAGF,IAAMC,IAAM,YAAY,IAAI,GACtBC,IAAW,KAAK,MAAM,OACtBC,IAAW,KAAK,IAAI,GAAGF,IAAM,KAAK,MAAM,SAAS;EAEvD,AADA,KAAK,MAAM,QAAQD,GACnB,KAAK,MAAM,YAAYC;EAEvB,IAAM,EAAE,qBAAkB,KAAK,IAAI;EACnC,AACE,KAAK,IAAI,WAAW,MAAM,MACzBN,EACC,KAAK,QACLS,EAAc,oBACd,KAAK,IAAI,aACT,oBACAA,EAAc,QAChB,KAKF,KAAK,IAAI,YAAY,MACnB,yBACA,yDACM;GACJ,KAAK,IAAI,OAAO,SAAS,gBAAgB;IACvC,mBAAmBJ;IACnB,4BAA4BE;IAC5B,yBAAyBC;GAC3B,CAAC;EACH,CACF;CACF;AACF"}
@@ -1,2 +1,2 @@
1
- const e=require("./storm-C-zYSdDX.cjs"),t=require("./defineProperty-X1c4tIPD.cjs");var n=class{constructor(e){t.t(this,`ctx`,void 0),t.t(this,`name`,`lifecycle`),t.t(this,`installed`,!1),t.t(this,`phase`,{state:``,enteredAt:0}),t.t(this,`window`,{start:0,count:0}),t.t(this,`onVisibility`,()=>{this.transition(document.visibilityState===`hidden`?`hidden`:`visible`)}),t.t(this,`onFreeze`,()=>{this.transition(`frozen`)}),t.t(this,`onResume`,()=>{this.transition(`resumed`)}),t.t(this,`onPageShow`,e=>{e.persisted&&this.transition(`restored`)}),this.ctx=e}install(){this.installed||(this.installed=!0,this.ctx.once.lifecycle??={state:``,enteredAt:performance.now()},this.phase=this.ctx.once.lifecycle,document.addEventListener(`visibilitychange`,this.onVisibility),document.addEventListener(`freeze`,this.onFreeze),document.addEventListener(`resume`,this.onResume),addEventListener(`pageshow`,this.onPageShow),this.onVisibility())}uninstall(){this.installed=!1,document.removeEventListener(`visibilitychange`,this.onVisibility),document.removeEventListener(`freeze`,this.onFreeze),document.removeEventListener(`resume`,this.onResume),removeEventListener(`pageshow`,this.onPageShow)}transition(t){if(!this.installed||t===this.phase.state)return;let n=performance.now(),r=this.phase.state,i=Math.max(0,n-this.phase.enteredAt);this.phase.state=t,this.phase.enteredAt=n;let{captureLimits:a}=this.ctx.config;this.ctx.isActive?.()!==!1&&e.t(this.window,a.lifecyclePerWindow,this.ctx.diagnostics,`lifecycle events`,a.windowMs)&&this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a lifecycle event.`,()=>{this.ctx.logger.logEvent(`ui.lifecycle`,{"lifecycle.state":t,"lifecycle.previous_state":r,"lifecycle.duration_ms":i})})}};exports.LifecycleCapture=n;
2
- //# sourceMappingURL=lifecycle-IaAm1mOC.cjs.map
1
+ const e=require("./storm-BHgI12iS.cjs"),t=require("./defineProperty-X1c4tIPD.cjs");var n=class{constructor(e){t.t(this,`ctx`,void 0),t.t(this,`name`,`lifecycle`),t.t(this,`installed`,!1),t.t(this,`phase`,{state:``,enteredAt:0}),t.t(this,`window`,{start:0,count:0}),t.t(this,`onVisibility`,()=>{this.transition(document.visibilityState===`hidden`?`hidden`:`visible`)}),t.t(this,`onFreeze`,()=>{this.transition(`frozen`)}),t.t(this,`onResume`,()=>{this.transition(`resumed`)}),t.t(this,`onPageShow`,e=>{e.persisted&&this.transition(`restored`)}),this.ctx=e}install(){this.installed||(this.installed=!0,this.ctx.once.lifecycle??={state:``,enteredAt:performance.now()},this.phase=this.ctx.once.lifecycle,document.addEventListener(`visibilitychange`,this.onVisibility),document.addEventListener(`freeze`,this.onFreeze),document.addEventListener(`resume`,this.onResume),addEventListener(`pageshow`,this.onPageShow),this.onVisibility())}uninstall(){this.installed=!1,document.removeEventListener(`visibilitychange`,this.onVisibility),document.removeEventListener(`freeze`,this.onFreeze),document.removeEventListener(`resume`,this.onResume),removeEventListener(`pageshow`,this.onPageShow)}transition(t){if(!this.installed||t===this.phase.state)return;let n=performance.now(),r=this.phase.state,i=Math.max(0,n-this.phase.enteredAt);this.phase.state=t,this.phase.enteredAt=n;let{captureLimits:a}=this.ctx.config;this.ctx.isActive?.()!==!1&&e.t(this.window,a.lifecyclePerWindow,this.ctx.diagnostics,`lifecycle events`,a.windowMs)&&this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a lifecycle event.`,()=>{this.ctx.logger.logEvent(`ui.lifecycle`,{"lifecycle.state":t,"lifecycle.previous_state":r,"lifecycle.duration_ms":i})})}};exports.LifecycleCapture=n;
2
+ //# sourceMappingURL=lifecycle-DaMdH_X7.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle-IaAm1mOC.cjs","names":["allowInWindow","require_storm","require_defineProperty","LifecycleCapture","event","ctx","state","now","previous","duration","captureLimits"],"sources":["../src/capture/lifecycle.ts"],"sourcesContent":["import { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext, CaptureOnce } from \"./types\";\n\n/** Records page state changes, each with how long the previous state lasted. */\nexport class LifecycleCapture implements Capture {\n readonly name = \"lifecycle\";\n\n private installed = false;\n\n private phase: NonNullable<CaptureOnce[\"lifecycle\"]> = { state: \"\", enteredAt: 0 };\n\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Installs the document and back-forward cache listeners. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n this.ctx.once.lifecycle ??= { state: \"\", enteredAt: performance.now() };\n this.phase = this.ctx.once.lifecycle;\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n document.addEventListener(\"freeze\", this.onFreeze);\n document.addEventListener(\"resume\", this.onResume);\n addEventListener(\"pageshow\", this.onPageShow);\n this.onVisibility();\n }\n\n /** Removes all listeners. */\n uninstall(): void {\n this.installed = false;\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n document.removeEventListener(\"freeze\", this.onFreeze);\n document.removeEventListener(\"resume\", this.onResume);\n removeEventListener(\"pageshow\", this.onPageShow);\n }\n\n private readonly onVisibility = (): void => {\n this.transition(document.visibilityState === \"hidden\" ? \"hidden\" : \"visible\");\n };\n\n private readonly onFreeze = (): void => {\n this.transition(\"frozen\");\n };\n\n private readonly onResume = (): void => {\n this.transition(\"resumed\");\n };\n\n private readonly onPageShow = (event: PageTransitionEvent): void => {\n if (event.persisted) {\n this.transition(\"restored\");\n }\n };\n\n /** Updates the state even when the rate limit drops its event. */\n private transition(state: string): void {\n if (!this.installed || state === this.phase.state) {\n return;\n }\n\n const now = performance.now();\n const previous = this.phase.state;\n const duration = Math.max(0, now - this.phase.enteredAt);\n this.phase.state = state;\n this.phase.enteredAt = now;\n\n const { captureLimits } = this.ctx.config;\n if (\n this.ctx.isActive?.() === false ||\n !allowInWindow(\n this.window,\n captureLimits.lifecyclePerWindow,\n this.ctx.diagnostics,\n \"lifecycle events\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a lifecycle event.\",\n () => {\n this.ctx.logger.logEvent(\"ui.lifecycle\", {\n \"lifecycle.state\": state,\n \"lifecycle.previous_state\": previous,\n \"lifecycle.duration_ms\": duration,\n });\n },\n );\n }\n}\n"],"mappings":"A,mFAIA,IAAaG,EAAb,KAAiD,CAS/C,YAAY,EAAsC,CAArBD,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAR7BA,EAAA,EAAA,KAAA,OAAgB,WAAA,EAEhBA,EAAA,EAAA,KAAA,YAAoB,EAAA,EAEpBA,EAAA,EAAA,KAAA,QAAuD,CAAE,MAAO,GAA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AE,iBAAkB,KAAK,IAAI,OAEjC,KAAK,IAAI,WAAW,IAAM,IACzBP,EAAAA,EACC,KAAK,OACLU,EAAc,mBACd,KAAK,IAAI,YACT,mBACAA,EAAc,QAChB,GAKF,KAAK,IAAI,YAAY,MACnB,wBACA,sDACM,CACJ,KAAK,IAAI,OAAO,SAAS,eAAgB,CACvC,kBAAmBJ,EACnB,2BAA4BE,EAC5B,wBAAyBC,CAC3B,CAAC,CACH,CACF,CACF,CACF,E"}
1
+ {"version":3,"file":"lifecycle-DaMdH_X7.cjs","names":["allowInWindow","require_storm","require_defineProperty","LifecycleCapture","event","ctx","state","now","previous","duration","captureLimits"],"sources":["../src/capture/lifecycle.ts"],"sourcesContent":["import { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext, CaptureOnce } from \"./types\";\n\n/** Records page state changes, each with how long the previous state lasted. */\nexport class LifecycleCapture implements Capture {\n readonly name = \"lifecycle\";\n\n private installed = false;\n\n private phase: NonNullable<CaptureOnce[\"lifecycle\"]> = { state: \"\", enteredAt: 0 };\n\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Installs the document and back-forward cache listeners. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n this.ctx.once.lifecycle ??= { state: \"\", enteredAt: performance.now() };\n this.phase = this.ctx.once.lifecycle;\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n document.addEventListener(\"freeze\", this.onFreeze);\n document.addEventListener(\"resume\", this.onResume);\n addEventListener(\"pageshow\", this.onPageShow);\n this.onVisibility();\n }\n\n /** Removes all listeners. */\n uninstall(): void {\n this.installed = false;\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n document.removeEventListener(\"freeze\", this.onFreeze);\n document.removeEventListener(\"resume\", this.onResume);\n removeEventListener(\"pageshow\", this.onPageShow);\n }\n\n private readonly onVisibility = (): void => {\n this.transition(document.visibilityState === \"hidden\" ? \"hidden\" : \"visible\");\n };\n\n private readonly onFreeze = (): void => {\n this.transition(\"frozen\");\n };\n\n private readonly onResume = (): void => {\n this.transition(\"resumed\");\n };\n\n private readonly onPageShow = (event: PageTransitionEvent): void => {\n if (event.persisted) {\n this.transition(\"restored\");\n }\n };\n\n /** Updates the state even when the rate limit drops its event. */\n private transition(state: string): void {\n if (!this.installed || state === this.phase.state) {\n return;\n }\n\n const now = performance.now();\n const previous = this.phase.state;\n const duration = Math.max(0, now - this.phase.enteredAt);\n this.phase.state = state;\n this.phase.enteredAt = now;\n\n const { captureLimits } = this.ctx.config;\n if (\n this.ctx.isActive?.() === false ||\n !allowInWindow(\n this.window,\n captureLimits.lifecyclePerWindow,\n this.ctx.diagnostics,\n \"lifecycle events\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a lifecycle event.\",\n () => {\n this.ctx.logger.logEvent(\"ui.lifecycle\", {\n \"lifecycle.state\": state,\n \"lifecycle.previous_state\": previous,\n \"lifecycle.duration_ms\": duration,\n });\n },\n );\n }\n}\n"],"mappings":"A,mFAIA,IAAaG,EAAb,KAAiD,CAS/C,YAAY,EAAsC,CAArBD,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAR7BA,EAAA,EAAA,KAAA,OAAgB,WAAA,EAEhBA,EAAA,EAAA,KAAA,YAAoB,EAAA,EAEpBA,EAAA,EAAA,KAAA,QAAuD,CAAE,MAAO,GAAI,UAAW,CAAE,CAAA,EAEjFA,EAAA,EAAA,KAAA,SAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,CAAA,EA4B5DA,EAAA,EAAA,KAAA,mBAA4C,CAC1C,KAAK,WAAW,SAAS,kBAAoB,SAAW,SAAW,SAAS,CAC9E,CAAA,EAEAA,EAAA,EAAA,KAAA,eAAwC,CACtC,KAAK,WAAW,QAAQ,CAC1B,CAAA,EAEAA,EAAA,EAAA,KAAA,eAAwC,CACtC,KAAK,WAAW,SAAS,CAC3B,C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require("./constants-CqdJhTxH.cjs"),t=require("./guards-EjG3ahFp.cjs");function n(){return`${String(Date.now())}000000`}function r(n){return typeof n==`string`&&t.t(e.kt,n)}function i(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.body==`string`&&typeof t.severityText==`string`&&typeof t.timeUnixNano==`string`&&typeof t.attributes==`object`&&t.attributes!==null&&typeof t.resource==`object`&&t.resource!==null}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
2
- //# sourceMappingURL=log-record-CkivuiEl.cjs.map
1
+ const e=require("./constants-CtF52hIV.cjs"),t=require("./guards-EjG3ahFp.cjs");function n(){return`${String(Date.now())}000000`}function r(n){return typeof n==`string`&&t.t(e.At,n)}function i(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.body==`string`&&typeof t.severityText==`string`&&typeof t.timeUnixNano==`string`&&typeof t.attributes==`object`&&t.attributes!==null&&typeof t.resource==`object`&&t.resource!==null}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
2
+ //# sourceMappingURL=log-record-Bmx6etMh.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-record-CkivuiEl.cjs","names":["hasOwn","LEVEL_ORDER","require_constants","require_guards","nowUnixNano","isLogLevel","value","isLogRecord","record"],"sources":["../src/models/log-record.ts"],"sourcesContent":["// src/models/log-record.ts\n//\n// Shape of one log record, plus helpers for building and validating it.\n//\n// The severity tables live in `src/constants.ts`.\n\nimport { LEVEL_ORDER } from \"../constants\";\nimport { hasOwn } from \"../utils/guards\";\n\n/** OpenTelemetry severity levels, in ascending order. */\nexport type LogLevel = \"TRACE\" | \"DEBUG\" | \"INFO\" | \"WARN\" | \"ERROR\" | \"FATAL\";\n\n/**\n * What a record is about. `action` is something a person did, `event` is something the\n * application did, and `metric` is a measurement. `log` is an application log call,\n * `system` is this library's own output and `span` is one span of a trace.\n */\nexport type LogType = \"action\" | \"event\" | \"metric\" | \"log\" | \"system\" | \"span\";\n\n/** Metric value type: level, running total, or distribution. */\nexport type MetricType = \"gauge\" | \"counter\" | \"histogram\";\n\n/** Internal record shape. A serializer converts it to the payload format. */\nexport interface LogRecord {\n /**\n * Event time, nanoseconds since epoch, as a decimal string.\n * @see {@link nowUnixNano}\n */\n timeUnixNano: string;\n /**\n * When this library received the event, if that differs from `timeUnixNano`. A forwarded\n * record, for example, can have a different time.\n */\n observedTimeUnixNano?: string;\n /** Distributed trace id. */\n traceId: string;\n /** Span id within the trace. */\n spanId: string;\n /** OpenTelemetry trace flags. The library uses only the sampled bit. */\n traceFlags: number;\n /** OpenTelemetry severity number for `severityText`. */\n severityNumber: number;\n /** Log level. */\n severityText: LogLevel;\n /** Log message. */\n body: string;\n /** Structured attributes, sanitized and size-capped. */\n attributes: Record<string, unknown>;\n /** Resource attributes, shared by every record from one context. */\n resource: Record<string, unknown>;\n}\n\n/**\n * Returns the current time as a Unix nanosecond timestamp. Appends zeros instead of\n * multiplying, because `Date.now() * 1e6` exceeds `Number.MAX_SAFE_INTEGER` and corrupts\n * digits without an error. The trailing zeros mean unknown precision, not measured digits.\n * @returns Epoch timestamp in nanoseconds, as a decimal string.\n */\nexport function nowUnixNano(): string {\n return `${String(Date.now())}000000`;\n}\n\n/**\n * Checks whether a value is a known log level. The own-key check rejects \"toString\".\n * @param value The value to check.\n * @returns True if `value` is a key of the severity table.\n */\nexport function isLogLevel(value: unknown): value is LogLevel {\n return typeof value === \"string\" && hasOwn(LEVEL_ORDER, value);\n}\n\n/**\n * Checks whether a value has the shape `LogRecord` requires. Use it to validate records from\n * another realm, because a malformed record throws during serialization. Any string is\n * accepted as `severityText`, not only a known level, so an unknown level from a newer\n * version still passes.\n * @param value The value to check.\n * @returns True if `value` has the shape `LogRecord` requires.\n */\nexport function isLogRecord(value: unknown): value is LogRecord {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n // Cast to `Record<string, unknown>`, not `Partial<LogRecord>`. With the partial type the\n // compiler treats these fields as never null, so the checks below would look unnecessary.\n const record = value as Record<string, unknown>;\n return (\n typeof record.body === \"string\" &&\n typeof record.severityText === \"string\" &&\n typeof record.timeUnixNano === \"string\" &&\n typeof record.attributes === \"object\" &&\n record.attributes !== null &&\n typeof record.resource === \"object\" &&\n record.resource !== null\n );\n}\n"],"mappings":"A,+EA0DA,SAAgBI,GAAsB,CACpC,MAAO,GAAG,OAAO,KAAK,IAAI,CAAC,EAAE,OAC/B,CAOA,SAAgBC,EAAW,EAAmC,CAC5D,OAAO,OAAOC,GAAU,UAAYN,EAAAA,EAAOC,EAAAA,GAAaK,CAAK,CAC/D,CAUA,SAAgBC,EAAY,EAAoC,CAC9D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,MAAO,GAIT,IAAME,EAASF,EACf,OACE,OAAOE,EAAO,MAAS,UACvB,OAAOA,EAAO,cAAiB,UAC/B,OAAOA,EAAO,cAAiB,UAC/B,OAAOA,EAAO,YAAe,UAC7BA,EAAO,aAAe,MACtB,OAAOA,EAAO,UAAa,UAC3BA,EAAO,WAAa,IAExB,C"}
1
+ {"version":3,"file":"log-record-Bmx6etMh.cjs","names":["hasOwn","LEVEL_ORDER","require_constants","require_guards","nowUnixNano","isLogLevel","value","isLogRecord","record"],"sources":["../src/models/log-record.ts"],"sourcesContent":["// src/models/log-record.ts\n//\n// Shape of one log record, plus helpers for building and validating it.\n//\n// The severity tables live in `src/constants.ts`.\n\nimport { LEVEL_ORDER } from \"../constants\";\nimport { hasOwn } from \"../utils/guards\";\n\n/** OpenTelemetry severity levels, in ascending order. */\nexport type LogLevel = \"TRACE\" | \"DEBUG\" | \"INFO\" | \"WARN\" | \"ERROR\" | \"FATAL\";\n\n/**\n * What a record is about. `action` is something a person did, `event` is something the\n * application did, and `metric` is a measurement. `log` is an application log call,\n * `system` is this library's own output and `span` is one span of a trace.\n */\nexport type LogType = \"action\" | \"event\" | \"metric\" | \"log\" | \"system\" | \"span\";\n\n/** Metric value type: level, running total, or distribution. */\nexport type MetricType = \"gauge\" | \"counter\" | \"histogram\";\n\n/** Internal record shape. A serializer converts it to the payload format. */\nexport interface LogRecord {\n /**\n * Event time, nanoseconds since epoch, as a decimal string.\n * @see {@link nowUnixNano}\n */\n timeUnixNano: string;\n /**\n * When this library received the event, if that differs from `timeUnixNano`. A forwarded\n * record, for example, can have a different time.\n */\n observedTimeUnixNano?: string;\n /** Distributed trace id. */\n traceId: string;\n /** Span id within the trace. */\n spanId: string;\n /** OpenTelemetry trace flags. The library uses only the sampled bit. */\n traceFlags: number;\n /** OpenTelemetry severity number for `severityText`. */\n severityNumber: number;\n /** Log level. */\n severityText: LogLevel;\n /** Log message. */\n body: string;\n /** Structured attributes, sanitized and size-capped. */\n attributes: Record<string, unknown>;\n /** Resource attributes, shared by every record from one context. */\n resource: Record<string, unknown>;\n}\n\n/**\n * Returns the current time as a Unix nanosecond timestamp. Appends zeros instead of\n * multiplying, because `Date.now() * 1e6` exceeds `Number.MAX_SAFE_INTEGER` and corrupts\n * digits without an error. The trailing zeros mean unknown precision, not measured digits.\n * @returns Epoch timestamp in nanoseconds, as a decimal string.\n */\nexport function nowUnixNano(): string {\n return `${String(Date.now())}000000`;\n}\n\n/**\n * Checks whether a value is a known log level. The own-key check rejects \"toString\".\n * @param value The value to check.\n * @returns True if `value` is a key of the severity table.\n */\nexport function isLogLevel(value: unknown): value is LogLevel {\n return typeof value === \"string\" && hasOwn(LEVEL_ORDER, value);\n}\n\n/**\n * Checks whether a value has the shape `LogRecord` requires. Use it to validate records from\n * another realm, because a malformed record throws during serialization. Any string is\n * accepted as `severityText`, not only a known level, so an unknown level from a newer\n * version still passes.\n * @param value The value to check.\n * @returns True if `value` has the shape `LogRecord` requires.\n */\nexport function isLogRecord(value: unknown): value is LogRecord {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n // Cast to `Record<string, unknown>`, not `Partial<LogRecord>`. With the partial type the\n // compiler treats these fields as never null, so the checks below would look unnecessary.\n const record = value as Record<string, unknown>;\n return (\n typeof record.body === \"string\" &&\n typeof record.severityText === \"string\" &&\n typeof record.timeUnixNano === \"string\" &&\n typeof record.attributes === \"object\" &&\n record.attributes !== null &&\n typeof record.resource === \"object\" &&\n record.resource !== null\n );\n}\n"],"mappings":"A,+EA0DA,SAAgBI,GAAsB,CACpC,MAAO,GAAG,OAAO,KAAK,IAAI,CAAC,EAAE,OAC/B,CAOA,SAAgBC,EAAW,EAAmC,CAC5D,OAAO,OAAOC,GAAU,UAAYN,EAAAA,EAAOC,EAAAA,GAAaK,CAAK,CAC/D,CAUA,SAAgBC,EAAY,EAAoC,CAC9D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,MAAO,GAIT,IAAME,EAASF,EACf,OACE,OAAOE,EAAO,MAAS,UACvB,OAAOA,EAAO,cAAiB,UAC/B,OAAOA,EAAO,cAAiB,UAC/B,OAAOA,EAAO,YAAe,UAC7BA,EAAO,aAAe,MACtB,OAAOA,EAAO,UAAa,UAC3BA,EAAO,WAAa,IAExB,C"}
@@ -1,4 +1,4 @@
1
- import { kt as e } from "./constants-CUyd9cTZ.js";
1
+ import { At as e } from "./constants-BwJDXzj6.js";
2
2
  import { t } from "./guards-BlYGRK4l.js";
3
3
  // src/models/log-record.ts
4
4
  function n() {
@@ -14,4 +14,4 @@ function i(e) {
14
14
  }
15
15
  export { i as n, n as r, r as t };
16
16
 
17
- //# sourceMappingURL=log-record-BNiLfqtL.js.map
17
+ //# sourceMappingURL=log-record-DSt2P-Sr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-record-BNiLfqtL.js","names":["LEVEL_ORDER","nowUnixNano","isLogLevel","value","hasOwn","isLogRecord","record"],"sources":["../src/models/log-record.ts"],"sourcesContent":["// src/models/log-record.ts\n//\n// Shape of one log record, plus helpers for building and validating it.\n//\n// The severity tables live in `src/constants.ts`.\n\nimport { LEVEL_ORDER } from \"../constants\";\nimport { hasOwn } from \"../utils/guards\";\n\n/** OpenTelemetry severity levels, in ascending order. */\nexport type LogLevel = \"TRACE\" | \"DEBUG\" | \"INFO\" | \"WARN\" | \"ERROR\" | \"FATAL\";\n\n/**\n * What a record is about. `action` is something a person did, `event` is something the\n * application did, and `metric` is a measurement. `log` is an application log call,\n * `system` is this library's own output and `span` is one span of a trace.\n */\nexport type LogType = \"action\" | \"event\" | \"metric\" | \"log\" | \"system\" | \"span\";\n\n/** Metric value type: level, running total, or distribution. */\nexport type MetricType = \"gauge\" | \"counter\" | \"histogram\";\n\n/** Internal record shape. A serializer converts it to the payload format. */\nexport interface LogRecord {\n /**\n * Event time, nanoseconds since epoch, as a decimal string.\n * @see {@link nowUnixNano}\n */\n timeUnixNano: string;\n /**\n * When this library received the event, if that differs from `timeUnixNano`. A forwarded\n * record, for example, can have a different time.\n */\n observedTimeUnixNano?: string;\n /** Distributed trace id. */\n traceId: string;\n /** Span id within the trace. */\n spanId: string;\n /** OpenTelemetry trace flags. The library uses only the sampled bit. */\n traceFlags: number;\n /** OpenTelemetry severity number for `severityText`. */\n severityNumber: number;\n /** Log level. */\n severityText: LogLevel;\n /** Log message. */\n body: string;\n /** Structured attributes, sanitized and size-capped. */\n attributes: Record<string, unknown>;\n /** Resource attributes, shared by every record from one context. */\n resource: Record<string, unknown>;\n}\n\n/**\n * Returns the current time as a Unix nanosecond timestamp. Appends zeros instead of\n * multiplying, because `Date.now() * 1e6` exceeds `Number.MAX_SAFE_INTEGER` and corrupts\n * digits without an error. The trailing zeros mean unknown precision, not measured digits.\n * @returns Epoch timestamp in nanoseconds, as a decimal string.\n */\nexport function nowUnixNano(): string {\n return `${String(Date.now())}000000`;\n}\n\n/**\n * Checks whether a value is a known log level. The own-key check rejects \"toString\".\n * @param value The value to check.\n * @returns True if `value` is a key of the severity table.\n */\nexport function isLogLevel(value: unknown): value is LogLevel {\n return typeof value === \"string\" && hasOwn(LEVEL_ORDER, value);\n}\n\n/**\n * Checks whether a value has the shape `LogRecord` requires. Use it to validate records from\n * another realm, because a malformed record throws during serialization. Any string is\n * accepted as `severityText`, not only a known level, so an unknown level from a newer\n * version still passes.\n * @param value The value to check.\n * @returns True if `value` has the shape `LogRecord` requires.\n */\nexport function isLogRecord(value: unknown): value is LogRecord {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n // Cast to `Record<string, unknown>`, not `Partial<LogRecord>`. With the partial type the\n // compiler treats these fields as never null, so the checks below would look unnecessary.\n const record = value as Record<string, unknown>;\n return (\n typeof record.body === \"string\" &&\n typeof record.severityText === \"string\" &&\n typeof record.timeUnixNano === \"string\" &&\n typeof record.attributes === \"object\" &&\n record.attributes !== null &&\n typeof record.resource === \"object\" &&\n record.resource !== null\n );\n}\n"],"mappings":";;;AA0DA,SAAgBC,IAAsB;CACpC,OAAO,GAAG,OAAO,KAAK,IAAI,CAAC,EAAE;AAC/B;AAOA,SAAgBC,EAAW,GAAmC;CAC5D,OAAO,OAAOC,KAAU,YAAYC,EAAOJ,GAAaG,CAAK;AAC/D;AAUA,SAAgBE,EAAY,GAAoC;CAC9D,IAAI,OAAOF,KAAU,aAAYA,GAC/B,OAAO;CAIT,IAAMG,IAASH;CACf,OACE,OAAOG,EAAO,QAAS,YACvB,OAAOA,EAAO,gBAAiB,YAC/B,OAAOA,EAAO,gBAAiB,YAC/B,OAAOA,EAAO,cAAe,YAC7BA,EAAO,eAAe,QACtB,OAAOA,EAAO,YAAa,YAC3BA,EAAO,aAAa;AAExB"}
1
+ {"version":3,"file":"log-record-DSt2P-Sr.js","names":["LEVEL_ORDER","nowUnixNano","isLogLevel","value","hasOwn","isLogRecord","record"],"sources":["../src/models/log-record.ts"],"sourcesContent":["// src/models/log-record.ts\n//\n// Shape of one log record, plus helpers for building and validating it.\n//\n// The severity tables live in `src/constants.ts`.\n\nimport { LEVEL_ORDER } from \"../constants\";\nimport { hasOwn } from \"../utils/guards\";\n\n/** OpenTelemetry severity levels, in ascending order. */\nexport type LogLevel = \"TRACE\" | \"DEBUG\" | \"INFO\" | \"WARN\" | \"ERROR\" | \"FATAL\";\n\n/**\n * What a record is about. `action` is something a person did, `event` is something the\n * application did, and `metric` is a measurement. `log` is an application log call,\n * `system` is this library's own output and `span` is one span of a trace.\n */\nexport type LogType = \"action\" | \"event\" | \"metric\" | \"log\" | \"system\" | \"span\";\n\n/** Metric value type: level, running total, or distribution. */\nexport type MetricType = \"gauge\" | \"counter\" | \"histogram\";\n\n/** Internal record shape. A serializer converts it to the payload format. */\nexport interface LogRecord {\n /**\n * Event time, nanoseconds since epoch, as a decimal string.\n * @see {@link nowUnixNano}\n */\n timeUnixNano: string;\n /**\n * When this library received the event, if that differs from `timeUnixNano`. A forwarded\n * record, for example, can have a different time.\n */\n observedTimeUnixNano?: string;\n /** Distributed trace id. */\n traceId: string;\n /** Span id within the trace. */\n spanId: string;\n /** OpenTelemetry trace flags. The library uses only the sampled bit. */\n traceFlags: number;\n /** OpenTelemetry severity number for `severityText`. */\n severityNumber: number;\n /** Log level. */\n severityText: LogLevel;\n /** Log message. */\n body: string;\n /** Structured attributes, sanitized and size-capped. */\n attributes: Record<string, unknown>;\n /** Resource attributes, shared by every record from one context. */\n resource: Record<string, unknown>;\n}\n\n/**\n * Returns the current time as a Unix nanosecond timestamp. Appends zeros instead of\n * multiplying, because `Date.now() * 1e6` exceeds `Number.MAX_SAFE_INTEGER` and corrupts\n * digits without an error. The trailing zeros mean unknown precision, not measured digits.\n * @returns Epoch timestamp in nanoseconds, as a decimal string.\n */\nexport function nowUnixNano(): string {\n return `${String(Date.now())}000000`;\n}\n\n/**\n * Checks whether a value is a known log level. The own-key check rejects \"toString\".\n * @param value The value to check.\n * @returns True if `value` is a key of the severity table.\n */\nexport function isLogLevel(value: unknown): value is LogLevel {\n return typeof value === \"string\" && hasOwn(LEVEL_ORDER, value);\n}\n\n/**\n * Checks whether a value has the shape `LogRecord` requires. Use it to validate records from\n * another realm, because a malformed record throws during serialization. Any string is\n * accepted as `severityText`, not only a known level, so an unknown level from a newer\n * version still passes.\n * @param value The value to check.\n * @returns True if `value` has the shape `LogRecord` requires.\n */\nexport function isLogRecord(value: unknown): value is LogRecord {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n // Cast to `Record<string, unknown>`, not `Partial<LogRecord>`. With the partial type the\n // compiler treats these fields as never null, so the checks below would look unnecessary.\n const record = value as Record<string, unknown>;\n return (\n typeof record.body === \"string\" &&\n typeof record.severityText === \"string\" &&\n typeof record.timeUnixNano === \"string\" &&\n typeof record.attributes === \"object\" &&\n record.attributes !== null &&\n typeof record.resource === \"object\" &&\n record.resource !== null\n );\n}\n"],"mappings":";;;AA0DA,SAAgBC,IAAsB;CACpC,OAAO,GAAG,OAAO,KAAK,IAAI,CAAC,EAAE;AAC/B;AAOA,SAAgBC,EAAW,GAAmC;CAC5D,OAAO,OAAOC,KAAU,YAAYC,EAAOJ,GAAaG,CAAK;AAC/D;AAUA,SAAgBE,EAAY,GAAoC;CAC9D,IAAI,OAAOF,KAAU,aAAYA,GAC/B,OAAO;CAIT,IAAMG,IAASH;CACf,OACE,OAAOG,EAAO,QAAS,YACvB,OAAOA,EAAO,gBAAiB,YAC/B,OAAOA,EAAO,gBAAiB,YAC/B,OAAOA,EAAO,cAAe,YAC7BA,EAAO,eAAe,QACtB,OAAOA,EAAO,YAAa,YAC3BA,EAAO,aAAa;AAExB"}
@@ -1,5 +1,5 @@
1
- import { i as e } from "./platform-BaaFIPCU.js";
2
- import { t } from "./storm-DjKetLKZ.js";
1
+ import { i as e } from "./platform-8DLhjddo.js";
2
+ import { t } from "./storm-DKlpv0FL.js";
3
3
  import { t as n } from "./defineProperty-s2S8BXUc.js";
4
4
  // src/capture/long-frames.ts
5
5
  var r = ["long-animation-frame", "longtask"];
@@ -59,4 +59,4 @@ var a = class {
59
59
  };
60
60
  export { a as LongFrameCapture };
61
61
 
62
- //# sourceMappingURL=long-frames-DNFaRnC3.js.map
62
+ //# sourceMappingURL=long-frames-Bamjs1WV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"long-frames-DNFaRnC3.js","names":["recordedUrl","_defineProperty","FRAME_TYPES","longestScript","longest","script","scripts","LongFrameCapture","ctx","first","once","supported","type","name","entry","list","value","longFrames","allowInWindow","diagnostics","duration","attrs","url","invoker"],"sources":["../src/capture/long-frames.ts"],"sourcesContent":["// src/capture/long-frames.ts\n//\n// Reports long animation frames. A long frame can freeze the page with no user input involved,\n// for example a grid that re-renders 5,000 rows, and INP never shows that.\n\nimport { LONG_FRAME_THRESHOLD_MS } from \"../constants\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The entry types this capture can observe, best first. */\nconst FRAME_TYPES = [\"long-animation-frame\", \"longtask\"];\n\n/** One script in a long animation frame. Some versions of the DOM types don't declare it. */\ninterface FrameScript {\n /** How long the script ran, in milliseconds. */\n duration: number;\n /** What called the script, for example an event listener or a timer. */\n invoker?: string;\n /** URL of the script's source. */\n sourceURL?: string;\n}\n\n/** A long animation frame or a long task. A long task has no blocking time and no scripts. */\ninterface FrameEntry extends PerformanceEntry {\n /** How long the frame blocked input, in milliseconds. */\n blockingDuration?: number;\n /** Scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/**\n * Finds the script that ran longest in a frame.\n * @param scripts The frame's scripts.\n * @returns The longest script, or undefined if the frame has none.\n */\nfunction longestScript(scripts: FrameScript[] | undefined): FrameScript | undefined {\n let longest: FrameScript | undefined;\n\n for (const script of scripts ?? []) {\n if (!longest || script.duration > longest.duration) {\n longest = script;\n }\n }\n\n return longest;\n}\n\n/** Records every long animation frame as a histogram metric and a breadcrumb. */\nexport class LongFrameCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"long-frames\";\n\n /** Active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** This capture's own rate limit, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /** Minimum frame duration to record, in milliseconds. */\n private threshold = LONG_FRAME_THRESHOLD_MS;\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes the best entry type the browser supports. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Only the first install in a document reads buffered frames or reports missing support,\n // so a reinstall after configure() doesn't repeat either.\n const { once } = this.ctx;\n const first = !once.longFrames;\n once.longFrames = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n const type = FRAME_TYPES.find((name) => supported?.includes(name));\n\n if (type === undefined) {\n if (!first) {\n return;\n }\n\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long frames. The long frame capture is off.\",\n );\n return;\n }\n\n this.threshold = this.readThreshold();\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a long frame.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Buffered frames include the first render, which happens before this chunk loads.\n this.observer.observe({ type, buffered: first });\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Reads the threshold from the configuration and reports a value it can't use.\n * @returns Minimum frame duration to record, in milliseconds.\n */\n private readThreshold(): number {\n const { longFrames } = this.ctx.config.capture;\n const value: unknown =\n typeof longFrames === \"object\" ? longFrames.thresholdMs : LONG_FRAME_THRESHOLD_MS;\n\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n `capture.longFrames.thresholdMs must be a number of 0 or more. The library uses ${String(LONG_FRAME_THRESHOLD_MS)}.`,\n );\n return LONG_FRAME_THRESHOLD_MS;\n }\n\n /**\n * Records one frame at or above the threshold.\n * @param entry Long animation frame or long task entry.\n */\n private record(entry: FrameEntry): void {\n if (entry.duration < this.threshold) {\n return;\n }\n\n const { diagnostics } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.longFramesPerWindow,\n diagnostics,\n \"long frames\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n const duration = Math.round(entry.duration);\n const attrs: Record<string, unknown> = { \"frame.type\": entry.entryType };\n\n if (entry.blockingDuration !== undefined) {\n attrs[\"frame.blocking_ms\"] = Math.round(entry.blockingDuration);\n }\n\n const script = longestScript(entry.scripts);\n\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n const url = (value: string): string =>\n recordedUrl(\n value,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n diagnostics,\n );\n\n if (script?.invoker) {\n // A script entry's invoker is the script URL. Other invokers, for example\n // \"IMG#hero.onload\", contain a \"#\" that isn't a fragment.\n const { invoker } = script;\n attrs[\"frame.script.invoker\"] = invoker.includes(\"://\") ? url(invoker) : invoker;\n }\n\n if (script?.sourceURL) {\n attrs[\"frame.script.source\"] = url(script.sourceURL);\n }\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"frame\",\n message: `long frame ${String(duration)} ms`,\n });\n this.ctx.logger.logMetric(\"ui.long_frame.duration\", duration, \"ms\", \"histogram\", attrs);\n }\n}\n"],"mappings":";;;;AAWA,IAAME,IAAc,CAAC,wBAAwB,UAAU;AAyBvD,SAASC,EAAc,GAA6D;CAClF,IAAIC;CAEJ,KAAK,IAAMC,KAAUC,KAAW,CAAC,GAC/B,CAAI,CAACF,KAAWC,EAAO,WAAWD,EAAQ,cACxC,IAAUC;CAId,OAAOD;AACT;AAGA,IAAaG,IAAb,MAAiD;CAgB/C,YAAY,GAAsC;EAArB,AAAAN,EAAA,MAAA,OAAA,KAAA,CAA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OAAO,cAAc,qBAC9BC,GACA,eACA,KAAK,IAAI,OAAO,cAAc,QAChC,GAEA;EAGF,IAAMC,IAAW,KAAK,MAAMN,EAAM,QAAQ,GACpCO,IAAiC,EAAE,cAAcP,EAAM,UAAU;EAEvE,AAAIA,EAAM,qBAAqB,KAAA,MAC7B,EAAM,uBAAuB,KAAK,MAAMA,EAAM,gBAAgB;EAGhE,IAAMT,IAASF,EAAcW,EAAM,OAAO,GAGpCQ,KAAO,MACXtB,EACEgB,GACA,KAAK,IAAI,OAAO,QAAQ,UACxB,KAAK,IAAI,OAAO,QAAQ,cACxBG,CACF;EAEF,IAAId,GAAQ,SAAS;GAGnB,IAAM,EAAE,eAAYA;GACpB,EAAM,0BAA0BkB,EAAQ,SAAS,KAAK,IAAID,EAAIC,CAAO,IAAIA;EAC3E;EAWA,AATIlB,GAAQ,cACV,EAAM,yBAAyBiB,EAAIjB,EAAO,SAAS,IAGrD,KAAK,IAAI,YAAY,KAAK;GACxB,GAAG,KAAK,IAAI;GACZ,UAAU;GACV,SAAS,cAAc,OAAOe,CAAQ,EAAE;EAC1C,CAAC,GACD,KAAK,IAAI,OAAO,UAAU,0BAA0BA,GAAU,MAAM,aAAaC,CAAK;CACxF;AACF"}
1
+ {"version":3,"file":"long-frames-Bamjs1WV.js","names":["recordedUrl","_defineProperty","FRAME_TYPES","longestScript","longest","script","scripts","LongFrameCapture","ctx","first","once","supported","type","name","entry","list","value","longFrames","allowInWindow","diagnostics","duration","attrs","url","invoker"],"sources":["../src/capture/long-frames.ts"],"sourcesContent":["// src/capture/long-frames.ts\n//\n// Reports long animation frames. A long frame can freeze the page with no user input involved,\n// for example a grid that re-renders 5,000 rows, and INP never shows that.\n\nimport { LONG_FRAME_THRESHOLD_MS } from \"../constants\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The entry types this capture can observe, best first. */\nconst FRAME_TYPES = [\"long-animation-frame\", \"longtask\"];\n\n/** One script in a long animation frame. Some versions of the DOM types don't declare it. */\ninterface FrameScript {\n /** How long the script ran, in milliseconds. */\n duration: number;\n /** What called the script, for example an event listener or a timer. */\n invoker?: string;\n /** URL of the script's source. */\n sourceURL?: string;\n}\n\n/** A long animation frame or a long task. A long task has no blocking time and no scripts. */\ninterface FrameEntry extends PerformanceEntry {\n /** How long the frame blocked input, in milliseconds. */\n blockingDuration?: number;\n /** Scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/**\n * Finds the script that ran longest in a frame.\n * @param scripts The frame's scripts.\n * @returns The longest script, or undefined if the frame has none.\n */\nfunction longestScript(scripts: FrameScript[] | undefined): FrameScript | undefined {\n let longest: FrameScript | undefined;\n\n for (const script of scripts ?? []) {\n if (!longest || script.duration > longest.duration) {\n longest = script;\n }\n }\n\n return longest;\n}\n\n/** Records every long animation frame as a histogram metric and a breadcrumb. */\nexport class LongFrameCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"long-frames\";\n\n /** Active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** This capture's own rate limit, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /** Minimum frame duration to record, in milliseconds. */\n private threshold = LONG_FRAME_THRESHOLD_MS;\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes the best entry type the browser supports. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Only the first install in a document reads buffered frames or reports missing support,\n // so a reinstall after configure() doesn't repeat either.\n const { once } = this.ctx;\n const first = !once.longFrames;\n once.longFrames = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n const type = FRAME_TYPES.find((name) => supported?.includes(name));\n\n if (type === undefined) {\n if (!first) {\n return;\n }\n\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long frames. The long frame capture is off.\",\n );\n return;\n }\n\n this.threshold = this.readThreshold();\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a long frame.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Buffered frames include the first render, which happens before this chunk loads.\n this.observer.observe({ type, buffered: first });\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Reads the threshold from the configuration and reports a value it can't use.\n * @returns Minimum frame duration to record, in milliseconds.\n */\n private readThreshold(): number {\n const { longFrames } = this.ctx.config.capture;\n const value: unknown =\n typeof longFrames === \"object\" ? longFrames.thresholdMs : LONG_FRAME_THRESHOLD_MS;\n\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n `capture.longFrames.thresholdMs must be a number of 0 or more. The library uses ${String(LONG_FRAME_THRESHOLD_MS)}.`,\n );\n return LONG_FRAME_THRESHOLD_MS;\n }\n\n /**\n * Records one frame at or above the threshold.\n * @param entry Long animation frame or long task entry.\n */\n private record(entry: FrameEntry): void {\n if (entry.duration < this.threshold) {\n return;\n }\n\n const { diagnostics } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.longFramesPerWindow,\n diagnostics,\n \"long frames\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n const duration = Math.round(entry.duration);\n const attrs: Record<string, unknown> = { \"frame.type\": entry.entryType };\n\n if (entry.blockingDuration !== undefined) {\n attrs[\"frame.blocking_ms\"] = Math.round(entry.blockingDuration);\n }\n\n const script = longestScript(entry.scripts);\n\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n const url = (value: string): string =>\n recordedUrl(\n value,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n diagnostics,\n );\n\n if (script?.invoker) {\n // A script entry's invoker is the script URL. Other invokers, for example\n // \"IMG#hero.onload\", contain a \"#\" that isn't a fragment.\n const { invoker } = script;\n attrs[\"frame.script.invoker\"] = invoker.includes(\"://\") ? url(invoker) : invoker;\n }\n\n if (script?.sourceURL) {\n attrs[\"frame.script.source\"] = url(script.sourceURL);\n }\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"frame\",\n message: `long frame ${String(duration)} ms`,\n });\n this.ctx.logger.logMetric(\"ui.long_frame.duration\", duration, \"ms\", \"histogram\", attrs);\n }\n}\n"],"mappings":";;;;AAWA,IAAME,IAAc,CAAC,wBAAwB,UAAU;AAyBvD,SAASC,EAAc,GAA6D;CAClF,IAAIC;CAEJ,KAAK,IAAMC,KAAUC,KAAW,CAAC,GAC/B,CAAI,CAACF,KAAWC,EAAO,WAAWD,EAAQ,cACxC,IAAUC;CAId,OAAOD;AACT;AAGA,IAAaG,IAAb,MAAiD;CAgB/C,YAAY,GAAsC;EAArB,AAAAN,EAAA,MAAA,OAAA,KAAA,CAAA,GAd7BA,EAAA,MAAA,QAAgB,aAAA,GAGhBA,EAAA,MAAA,YAAA,KAAA,CAAA,GAGAA,EAAA,MAAA,UAAuC;GAAE,OAAO;GAAG,OAAO;EAAE,CAAA,GAG5DA,EAAA,MAAA,aAAA,GAAA,GAK6B,KAAA,MAAAO;CAAsB;CAGnD,UAAgB;EACd,IAAI,KAAK,UACP;EAKF,IAAM,EAAE,YAAS,KAAK,KAChBC,IAAQ,CAACC,EAAK;EACpB,EAAK,aAAa;EAGlB,IAAMC,IACJ,OAAO,sBAAwB,MAC3B,KAAA,IACA,oBAAoB,qBACpBC,IAAOV,EAAY,MAAM,MAASS,GAAW,SAASE,CAAI,CAAC;EAEjE,IAAID,MAAS,KAAA,GAAW;GACtB,IAAI,CAACH,GACH;GAGF,KAAK,IAAI,YAAY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3E;EAWA,AATIlB,GAAQ,cACV,EAAM,yBAAyBiB,EAAIjB,EAAO,SAAS,IAGrD,KAAK,IAAI,YAAY,KAAK;GACxB,GAAG,KAAK,IAAI;GACZ,UAAU;GACV,SAAS,cAAc,OAAOe,CAAQ,EAAE;EAC1C,CAAC,GACD,KAAK,IAAI,OAAO,UAAU,0BAA0BA,GAAU,MAAM,aAAaC,CAAK;CACxF;AACF"}
@@ -1,2 +1,2 @@
1
- const e=require("./platform-CfA3-7sJ.cjs"),t=require("./storm-C-zYSdDX.cjs"),n=require("./defineProperty-X1c4tIPD.cjs");var r=[`long-animation-frame`,`longtask`];function i(e){let t;for(let n of e??[])(!t||n.duration>t.duration)&&(t=n);return t}var a=class{constructor(e){n.t(this,`ctx`,void 0),n.t(this,`name`,`long-frames`),n.t(this,`observer`,void 0),n.t(this,`window`,{start:0,count:0}),n.t(this,`threshold`,100),this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.longFrames;e.longFrames=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes,i=r.find(e=>n?.includes(e));if(i===void 0){if(!t)return;this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report long frames. The long frame capture is off.`)}else this.threshold=this.readThreshold(),this.observer=new PerformanceObserver(e=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a long frame.`,()=>{for(let t of e.getEntries())this.record(t)})}),this.observer.observe({type:i,buffered:t})}uninstall(){this.observer?.disconnect(),this.observer=void 0}readThreshold(){let{longFrames:e}=this.ctx.config.capture,t=typeof e==`object`?e.thresholdMs:100;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:(this.ctx.diagnostics.report(`config.invalid`,`capture.longFrames.thresholdMs must be a number of 0 or more. The library uses 100.`),100)}record(n){if(n.duration<this.threshold)return;let{diagnostics:r}=this.ctx;if(!t.t(this.window,this.ctx.config.captureLimits.longFramesPerWindow,r,`long frames`,this.ctx.config.captureLimits.windowMs))return;let a=Math.round(n.duration),o={"frame.type":n.entryType};n.blockingDuration!==void 0&&(o[`frame.blocking_ms`]=Math.round(n.blockingDuration));let s=i(n.scripts),c=t=>e.i(t,this.ctx.config.capture.fullUrls,this.ctx.config.capture.urlTransform,r);if(s?.invoker){let{invoker:e}=s;o[`frame.script.invoker`]=e.includes(`://`)?c(e):e}s?.sourceURL&&(o[`frame.script.source`]=c(s.sourceURL)),this.ctx.breadcrumbs.push({t:Date.now(),category:`frame`,message:`long frame ${String(a)} ms`}),this.ctx.logger.logMetric(`ui.long_frame.duration`,a,`ms`,`histogram`,o)}};exports.LongFrameCapture=a;
2
- //# sourceMappingURL=long-frames-BUUbXd-B.cjs.map
1
+ const e=require("./platform-BqRc-7RO.cjs"),t=require("./storm-BHgI12iS.cjs"),n=require("./defineProperty-X1c4tIPD.cjs");var r=[`long-animation-frame`,`longtask`];function i(e){let t;for(let n of e??[])(!t||n.duration>t.duration)&&(t=n);return t}var a=class{constructor(e){n.t(this,`ctx`,void 0),n.t(this,`name`,`long-frames`),n.t(this,`observer`,void 0),n.t(this,`window`,{start:0,count:0}),n.t(this,`threshold`,100),this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.longFrames;e.longFrames=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes,i=r.find(e=>n?.includes(e));if(i===void 0){if(!t)return;this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report long frames. The long frame capture is off.`)}else this.threshold=this.readThreshold(),this.observer=new PerformanceObserver(e=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a long frame.`,()=>{for(let t of e.getEntries())this.record(t)})}),this.observer.observe({type:i,buffered:t})}uninstall(){this.observer?.disconnect(),this.observer=void 0}readThreshold(){let{longFrames:e}=this.ctx.config.capture,t=typeof e==`object`?e.thresholdMs:100;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:(this.ctx.diagnostics.report(`config.invalid`,`capture.longFrames.thresholdMs must be a number of 0 or more. The library uses 100.`),100)}record(n){if(n.duration<this.threshold)return;let{diagnostics:r}=this.ctx;if(!t.t(this.window,this.ctx.config.captureLimits.longFramesPerWindow,r,`long frames`,this.ctx.config.captureLimits.windowMs))return;let a=Math.round(n.duration),o={"frame.type":n.entryType};n.blockingDuration!==void 0&&(o[`frame.blocking_ms`]=Math.round(n.blockingDuration));let s=i(n.scripts),c=t=>e.i(t,this.ctx.config.capture.fullUrls,this.ctx.config.capture.urlTransform,r);if(s?.invoker){let{invoker:e}=s;o[`frame.script.invoker`]=e.includes(`://`)?c(e):e}s?.sourceURL&&(o[`frame.script.source`]=c(s.sourceURL)),this.ctx.breadcrumbs.push({t:Date.now(),category:`frame`,message:`long frame ${String(a)} ms`}),this.ctx.logger.logMetric(`ui.long_frame.duration`,a,`ms`,`histogram`,o)}};exports.LongFrameCapture=a;
2
+ //# sourceMappingURL=long-frames-lhtONgGt.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"long-frames-BUUbXd-B.cjs","names":["allowInWindow","recordedUrl","require_platform","require_storm","require_defineProperty","FRAME_TYPES","longestScript","longest","script","scripts","LongFrameCapture","ctx","first","once","supported","type","name","entry","list","value","longFrames","diagnostics","duration","attrs","url","invoker"],"sources":["../src/capture/long-frames.ts"],"sourcesContent":["// src/capture/long-frames.ts\n//\n// Reports long animation frames. A long frame can freeze the page with no user input involved,\n// for example a grid that re-renders 5,000 rows, and INP never shows that.\n\nimport { LONG_FRAME_THRESHOLD_MS } from \"../constants\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The entry types this capture can observe, best first. */\nconst FRAME_TYPES = [\"long-animation-frame\", \"longtask\"];\n\n/** One script in a long animation frame. Some versions of the DOM types don't declare it. */\ninterface FrameScript {\n /** How long the script ran, in milliseconds. */\n duration: number;\n /** What called the script, for example an event listener or a timer. */\n invoker?: string;\n /** URL of the script's source. */\n sourceURL?: string;\n}\n\n/** A long animation frame or a long task. A long task has no blocking time and no scripts. */\ninterface FrameEntry extends PerformanceEntry {\n /** How long the frame blocked input, in milliseconds. */\n blockingDuration?: number;\n /** Scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/**\n * Finds the script that ran longest in a frame.\n * @param scripts The frame's scripts.\n * @returns The longest script, or undefined if the frame has none.\n */\nfunction longestScript(scripts: FrameScript[] | undefined): FrameScript | undefined {\n let longest: FrameScript | undefined;\n\n for (const script of scripts ?? []) {\n if (!longest || script.duration > longest.duration) {\n longest = script;\n }\n }\n\n return longest;\n}\n\n/** Records every long animation frame as a histogram metric and a breadcrumb. */\nexport class LongFrameCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"long-frames\";\n\n /** Active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** This capture's own rate limit, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /** Minimum frame duration to record, in milliseconds. */\n private threshold = LONG_FRAME_THRESHOLD_MS;\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes the best entry type the browser supports. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Only the first install in a document reads buffered frames or reports missing support,\n // so a reinstall after configure() doesn't repeat either.\n const { once } = this.ctx;\n const first = !once.longFrames;\n once.longFrames = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n const type = FRAME_TYPES.find((name) => supported?.includes(name));\n\n if (type === undefined) {\n if (!first) {\n return;\n }\n\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long frames. The long frame capture is off.\",\n );\n return;\n }\n\n this.threshold = this.readThreshold();\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a long frame.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Buffered frames include the first render, which happens before this chunk loads.\n this.observer.observe({ type, buffered: first });\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Reads the threshold from the configuration and reports a value it can't use.\n * @returns Minimum frame duration to record, in milliseconds.\n */\n private readThreshold(): number {\n const { longFrames } = this.ctx.config.capture;\n const value: unknown =\n typeof longFrames === \"object\" ? longFrames.thresholdMs : LONG_FRAME_THRESHOLD_MS;\n\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n `capture.longFrames.thresholdMs must be a number of 0 or more. The library uses ${String(LONG_FRAME_THRESHOLD_MS)}.`,\n );\n return LONG_FRAME_THRESHOLD_MS;\n }\n\n /**\n * Records one frame at or above the threshold.\n * @param entry Long animation frame or long task entry.\n */\n private record(entry: FrameEntry): void {\n if (entry.duration < this.threshold) {\n return;\n }\n\n const { diagnostics } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.longFramesPerWindow,\n diagnostics,\n \"long frames\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n const duration = Math.round(entry.duration);\n const attrs: Record<string, unknown> = { \"frame.type\": entry.entryType };\n\n if (entry.blockingDuration !== undefined) {\n attrs[\"frame.blocking_ms\"] = Math.round(entry.blockingDuration);\n }\n\n const script = longestScript(entry.scripts);\n\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n const url = (value: string): string =>\n recordedUrl(\n value,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n diagnostics,\n );\n\n if (script?.invoker) {\n // A script entry's invoker is the script URL. Other invokers, for example\n // \"IMG#hero.onload\", contain a \"#\" that isn't a fragment.\n const { invoker } = script;\n attrs[\"frame.script.invoker\"] = invoker.includes(\"://\") ? url(invoker) : invoker;\n }\n\n if (script?.sourceURL) {\n attrs[\"frame.script.source\"] = url(script.sourceURL);\n }\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"frame\",\n message: `long frame ${String(duration)} ms`,\n });\n this.ctx.logger.logMetric(\"ui.long_frame.duration\", duration, \"ms\", \"histogram\", attrs);\n }\n}\n"],"mappings":"A,wHAWA,IAAMK,EAAc,CAAC,uBAAwB,UAAU,EAyBvD,SAASC,EAAc,EAA6D,CAClF,IAAIC,EAEJ,IAAK,IAAMC,KAAUC,GAAW,CAAC,GAC3B,CAACF,GAAWC,EAAO,SAAWD,EAAQ,YACxC,EAAUC,GAId,OAAOD,CACT,CAGA,IAAaG,EAAb,KAAiD,CAgB/C,YAAY,EAAsC,CAArBN,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAd7BA,EAAA,EAAA,KAAA,OAAgB,aAAA,EAGhBA,EAAA,EAAA,KAAA,WAAA,IAAA,EAAA,EAGAA,EAAA,EAAA,KAAA,SAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,CAAA,EAG5DA,EAAA,EAAA,KAAA,YAAA,GAAA,EAK6B,KAAA,IAAAO,CAAsB,CAGnD,SAAgB,CACd,GAAI,KAAK,SACP,OAKF,GAAM,CAAE,QAAS,KAAK,IAChBC,EAAQ,CAACC,EAAK,WACpB,EAAK,WAAa,GAGlB,IAAMC,EACJ,OAAO,oBAAwB,IAC3B,IAAA,GACA,oBAAoB,oBACpBC,EAAOV,EAAY,KAAM,GAASS,GAAW,SAASE,CAAI,CAAC,EAEjE,GAAID,IAAS,IAAA,GAAW,CACtB,GAAI,CAACH,EACH,OAGF,KAAK,IAAI,YAAY,OACnB,yBACA,yEACF,CAEF,KAEA,MAAK,UAAY,KAAK,cAAc,EACpC,KAAK,SAAW,IAAI,oBAAqB,GAAS,CAEhD,KAAK,IAAI,YAAY,MACnB,wBACA,iDACM,CACJ,IAAK,IAAM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AAE,IAC1C,CAAC,EACD,KAAK,IAAI,OAAO,UAAU,yBAA0BA,EAAU,KAAM,YAAaC,CAAK,CACxF,CACF,E"}
1
+ {"version":3,"file":"long-frames-lhtONgGt.cjs","names":["allowInWindow","recordedUrl","require_platform","require_storm","require_defineProperty","FRAME_TYPES","longestScript","longest","script","scripts","LongFrameCapture","ctx","first","once","supported","type","name","entry","list","value","longFrames","diagnostics","duration","attrs","url","invoker"],"sources":["../src/capture/long-frames.ts"],"sourcesContent":["// src/capture/long-frames.ts\n//\n// Reports long animation frames. A long frame can freeze the page with no user input involved,\n// for example a grid that re-renders 5,000 rows, and INP never shows that.\n\nimport { LONG_FRAME_THRESHOLD_MS } from \"../constants\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The entry types this capture can observe, best first. */\nconst FRAME_TYPES = [\"long-animation-frame\", \"longtask\"];\n\n/** One script in a long animation frame. Some versions of the DOM types don't declare it. */\ninterface FrameScript {\n /** How long the script ran, in milliseconds. */\n duration: number;\n /** What called the script, for example an event listener or a timer. */\n invoker?: string;\n /** URL of the script's source. */\n sourceURL?: string;\n}\n\n/** A long animation frame or a long task. A long task has no blocking time and no scripts. */\ninterface FrameEntry extends PerformanceEntry {\n /** How long the frame blocked input, in milliseconds. */\n blockingDuration?: number;\n /** Scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/**\n * Finds the script that ran longest in a frame.\n * @param scripts The frame's scripts.\n * @returns The longest script, or undefined if the frame has none.\n */\nfunction longestScript(scripts: FrameScript[] | undefined): FrameScript | undefined {\n let longest: FrameScript | undefined;\n\n for (const script of scripts ?? []) {\n if (!longest || script.duration > longest.duration) {\n longest = script;\n }\n }\n\n return longest;\n}\n\n/** Records every long animation frame as a histogram metric and a breadcrumb. */\nexport class LongFrameCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"long-frames\";\n\n /** Active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** This capture's own rate limit, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /** Minimum frame duration to record, in milliseconds. */\n private threshold = LONG_FRAME_THRESHOLD_MS;\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes the best entry type the browser supports. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Only the first install in a document reads buffered frames or reports missing support,\n // so a reinstall after configure() doesn't repeat either.\n const { once } = this.ctx;\n const first = !once.longFrames;\n once.longFrames = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n const type = FRAME_TYPES.find((name) => supported?.includes(name));\n\n if (type === undefined) {\n if (!first) {\n return;\n }\n\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long frames. The long frame capture is off.\",\n );\n return;\n }\n\n this.threshold = this.readThreshold();\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a long frame.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Buffered frames include the first render, which happens before this chunk loads.\n this.observer.observe({ type, buffered: first });\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Reads the threshold from the configuration and reports a value it can't use.\n * @returns Minimum frame duration to record, in milliseconds.\n */\n private readThreshold(): number {\n const { longFrames } = this.ctx.config.capture;\n const value: unknown =\n typeof longFrames === \"object\" ? longFrames.thresholdMs : LONG_FRAME_THRESHOLD_MS;\n\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n `capture.longFrames.thresholdMs must be a number of 0 or more. The library uses ${String(LONG_FRAME_THRESHOLD_MS)}.`,\n );\n return LONG_FRAME_THRESHOLD_MS;\n }\n\n /**\n * Records one frame at or above the threshold.\n * @param entry Long animation frame or long task entry.\n */\n private record(entry: FrameEntry): void {\n if (entry.duration < this.threshold) {\n return;\n }\n\n const { diagnostics } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.longFramesPerWindow,\n diagnostics,\n \"long frames\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n const duration = Math.round(entry.duration);\n const attrs: Record<string, unknown> = { \"frame.type\": entry.entryType };\n\n if (entry.blockingDuration !== undefined) {\n attrs[\"frame.blocking_ms\"] = Math.round(entry.blockingDuration);\n }\n\n const script = longestScript(entry.scripts);\n\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n const url = (value: string): string =>\n recordedUrl(\n value,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n diagnostics,\n );\n\n if (script?.invoker) {\n // A script entry's invoker is the script URL. Other invokers, for example\n // \"IMG#hero.onload\", contain a \"#\" that isn't a fragment.\n const { invoker } = script;\n attrs[\"frame.script.invoker\"] = invoker.includes(\"://\") ? url(invoker) : invoker;\n }\n\n if (script?.sourceURL) {\n attrs[\"frame.script.source\"] = url(script.sourceURL);\n }\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"frame\",\n message: `long frame ${String(duration)} ms`,\n });\n this.ctx.logger.logMetric(\"ui.long_frame.duration\", duration, \"ms\", \"histogram\", attrs);\n }\n}\n"],"mappings":"A,wHAWA,IAAMK,EAAc,CAAC,uBAAwB,UAAU,EAyBvD,SAASC,EAAc,EAA6D,CAClF,IAAIC,EAEJ,IAAK,IAAMC,KAAUC,GAAW,CAAC,GAC3B,CAACF,GAAWC,EAAO,SAAWD,EAAQ,YACxC,EAAUC,GAId,OAAOD,CACT,CAGA,IAAaG,EAAb,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OAGF,GAAM,CAAE,eAAgB,KAAK,IAE7B,GACE,CAACjB,EAAAA,EACC,KAAK,OACL,KAAK,IAAI,OAAO,cAAc,oBAC9BqB,EACA,cACA,KAAK,IAAI,OAAO,cAAc,QAChC,EAEA,OAGF,IAAMC,EAAW,KAAK,MAAML,EAAM,QAAQ,EACpCM,EAAiC,CAAE,aAAcN,EAAM,SAAU,EAEnEA,EAAM,mBAAqB,IAAA,KAC7B,EAAM,qBAAuB,KAAK,MAAMA,EAAM,gBAAgB,GAGhE,IAAMT,EAASF,EAAcW,EAAM,OAAO,EAGpCO,EAAO,GACXvB,EAAAA,EACEkB,EACA,KAAK,IAAI,OAAO,QAAQ,SACxB,KAAK,IAAI,OAAO,QAAQ,aACxBE,CACF,EAEF,GAAIb,GAAQ,QAAS,CAGnB,GAAM,CAAE,WAAYA,EACpB,EAAM,wBAA0BiB,EAAQ,SAAS,KAAK,EAAID,EAAIC,CAAO,EAAIA,CAC3E,CAEIjB,GAAQ,YACV,EAAM,uBAAyBgB,EAAIhB,EAAO,SAAS,GAGrD,KAAK,IAAI,YAAY,KAAK,CACxB,EAAG,KAAK,IAAI,EACZ,SAAU,QACV,QAAS,cAAc,OAAOc,CAAQ,EAAE,IAC1C,CAAC,EACD,KAAK,IAAI,OAAO,UAAU,yBAA0BA,EAAU,KAAM,YAAaC,CAAK,CACxF,CACF,E"}
@@ -92,11 +92,16 @@ export type BusMessage =
92
92
  t: typeof BUS_TYPE.journeyRequest;
93
93
  from: string;
94
94
  }
95
- /** Tab identifier claim broadcast to detect collisions across windows. */
95
+ /**
96
+ * Tab identifier claim broadcast to detect collisions across windows. `since` is the
97
+ * document's `performance.timeOrigin`, so the older document keeps the id. An older library
98
+ * sends none.
99
+ */
96
100
  | {
97
101
  t: typeof BUS_TYPE.tab;
98
102
  from: string;
99
103
  tabId: string;
104
+ since?: number;
100
105
  }
101
106
  /** A forwarder's request for the current remote sampling rules. */
102
107
  | {
@@ -92,11 +92,16 @@ export type BusMessage =
92
92
  t: typeof BUS_TYPE.journeyRequest;
93
93
  from: string;
94
94
  }
95
- /** Tab identifier claim broadcast to detect collisions across windows. */
95
+ /**
96
+ * Tab identifier claim broadcast to detect collisions across windows. `since` is the
97
+ * document's `performance.timeOrigin`, so the older document keeps the id. An older library
98
+ * sends none.
99
+ */
96
100
  | {
97
101
  t: typeof BUS_TYPE.tab;
98
102
  from: string;
99
103
  tabId: string;
104
+ since?: number;
100
105
  }
101
106
  /** A forwarder's request for the current remote sampling rules. */
102
107
  | {
@@ -427,6 +427,17 @@ export interface InteractionOptions {
427
427
  * @default 1000
428
428
  */
429
429
  deadClickMs?: number;
430
+ /**
431
+ * CSS selector for regions that change on their own, for example a live price cell. A DOM
432
+ * change or a scroll inside a matching element isn't a response, so it doesn't stop a dead
433
+ * click. Mark the element that changes, not a panel that also holds the controls. Set "" to
434
+ * turn the live-region filter off. Whatever this value is, a write that keeps the same value
435
+ * isn't a response, and neither is a batch that sets `name` or `type` and then puts the old
436
+ * value back. For any other attribute, each write with a new value is a response, because a
437
+ * class or style change can restart an animation.
438
+ * @default "[data-observability-live]"
439
+ */
440
+ deadClickIgnoreSelector?: string;
430
441
  }
431
442
  /** Cache settings. A logger the app still holds keeps working after it leaves the cache. */
432
443
  export interface LoggerCacheOptions {
@@ -1196,16 +1207,17 @@ export interface ObservabilityConfig {
1196
1207
  /**
1197
1208
  * Ingest endpoint URL. Set `null` for console-only mode, where the library sends nothing
1198
1209
  * and writes records to the console only if you set `consoleOutput`. If the key is missing or
1199
- * `""`, the library reports `config.invalid`. A relative URL resolves against the page, and a
1200
- * URL with a user name or a password is refused.
1210
+ * `""`, the library reports `config.invalid`. A relative URL resolves against the page and
1211
+ * works, but it still reports `config.invalid` with the origin it sends to, so you can check
1212
+ * where the records go. A URL with a user name or a password is refused.
1201
1213
  */
1202
1214
  endpoint?: string | null;
1203
1215
  /**
1204
1216
  * OTLP metrics endpoint URL, for example `"https://ingest.example/v1/metrics"`. When set,
1205
1217
  * the library sends every batch of metric records there as an OTLP
1206
1218
  * `ExportMetricsServiceRequest`. Without it, metric records are log records on `endpoint`.
1207
- * Needs `serializer: "otlp"`. Set null to turn it off. A blank string also turns it off, and
1208
- * reports `config.invalid`.
1219
+ * Works with any `serializer`, because these batches always go out as OTLP. Set null to turn it
1220
+ * off. A blank string also turns it off, and reports `config.invalid`.
1209
1221
  * @default null
1210
1222
  */
1211
1223
  metricsEndpoint?: string | null;
@@ -1213,9 +1225,9 @@ export interface ObservabilityConfig {
1213
1225
  * OTLP traces endpoint URL, for example `"https://ingest.example/v1/traces"`. When set, the
1214
1226
  * library records one root span for every trace it creates and one CLIENT span for every
1215
1227
  * request that gets `traceparent`, and sends them there as an OTLP
1216
- * `ExportTraceServiceRequest`. Without it, the library sends no spans. Needs
1217
- * `serializer: "otlp"`. Set null to turn it off. A blank string also turns it off, and reports
1218
- * `config.invalid`.
1228
+ * `ExportTraceServiceRequest`. Without it, the library sends no spans. Works with any
1229
+ * `serializer`, because span batches always go out as OTLP. Set null to turn it off. A blank
1230
+ * string also turns it off, and reports `config.invalid`.
1219
1231
  * @default null
1220
1232
  */
1221
1233
  tracesEndpoint?: string | null;
@@ -1275,7 +1287,10 @@ export interface ObservabilityConfig {
1275
1287
  */
1276
1288
  compression?: "gzip" | "none";
1277
1289
  /**
1278
- * Payload format, either a name or a custom implementation.
1290
+ * Payload format of the log batches, either a name or a custom implementation. Batches for
1291
+ * `metricsEndpoint` and `tracesEndpoint` always go out as OTLP. The library drops a batch
1292
+ * that the server refuses with a 400, so a custom serializer must keep every record within
1293
+ * the server's limits, or one bad record loses the whole batch.
1279
1294
  * @default "otlp"
1280
1295
  */
1281
1296
  serializer?: SerializerChoice;
@@ -427,6 +427,17 @@ export interface InteractionOptions {
427
427
  * @default 1000
428
428
  */
429
429
  deadClickMs?: number;
430
+ /**
431
+ * CSS selector for regions that change on their own, for example a live price cell. A DOM
432
+ * change or a scroll inside a matching element isn't a response, so it doesn't stop a dead
433
+ * click. Mark the element that changes, not a panel that also holds the controls. Set "" to
434
+ * turn the live-region filter off. Whatever this value is, a write that keeps the same value
435
+ * isn't a response, and neither is a batch that sets `name` or `type` and then puts the old
436
+ * value back. For any other attribute, each write with a new value is a response, because a
437
+ * class or style change can restart an animation.
438
+ * @default "[data-observability-live]"
439
+ */
440
+ deadClickIgnoreSelector?: string;
430
441
  }
431
442
  /** Cache settings. A logger the app still holds keeps working after it leaves the cache. */
432
443
  export interface LoggerCacheOptions {
@@ -1196,16 +1207,17 @@ export interface ObservabilityConfig {
1196
1207
  /**
1197
1208
  * Ingest endpoint URL. Set `null` for console-only mode, where the library sends nothing
1198
1209
  * and writes records to the console only if you set `consoleOutput`. If the key is missing or
1199
- * `""`, the library reports `config.invalid`. A relative URL resolves against the page, and a
1200
- * URL with a user name or a password is refused.
1210
+ * `""`, the library reports `config.invalid`. A relative URL resolves against the page and
1211
+ * works, but it still reports `config.invalid` with the origin it sends to, so you can check
1212
+ * where the records go. A URL with a user name or a password is refused.
1201
1213
  */
1202
1214
  endpoint?: string | null;
1203
1215
  /**
1204
1216
  * OTLP metrics endpoint URL, for example `"https://ingest.example/v1/metrics"`. When set,
1205
1217
  * the library sends every batch of metric records there as an OTLP
1206
1218
  * `ExportMetricsServiceRequest`. Without it, metric records are log records on `endpoint`.
1207
- * Needs `serializer: "otlp"`. Set null to turn it off. A blank string also turns it off, and
1208
- * reports `config.invalid`.
1219
+ * Works with any `serializer`, because these batches always go out as OTLP. Set null to turn it
1220
+ * off. A blank string also turns it off, and reports `config.invalid`.
1209
1221
  * @default null
1210
1222
  */
1211
1223
  metricsEndpoint?: string | null;
@@ -1213,9 +1225,9 @@ export interface ObservabilityConfig {
1213
1225
  * OTLP traces endpoint URL, for example `"https://ingest.example/v1/traces"`. When set, the
1214
1226
  * library records one root span for every trace it creates and one CLIENT span for every
1215
1227
  * request that gets `traceparent`, and sends them there as an OTLP
1216
- * `ExportTraceServiceRequest`. Without it, the library sends no spans. Needs
1217
- * `serializer: "otlp"`. Set null to turn it off. A blank string also turns it off, and reports
1218
- * `config.invalid`.
1228
+ * `ExportTraceServiceRequest`. Without it, the library sends no spans. Works with any
1229
+ * `serializer`, because span batches always go out as OTLP. Set null to turn it off. A blank
1230
+ * string also turns it off, and reports `config.invalid`.
1219
1231
  * @default null
1220
1232
  */
1221
1233
  tracesEndpoint?: string | null;
@@ -1275,7 +1287,10 @@ export interface ObservabilityConfig {
1275
1287
  */
1276
1288
  compression?: "gzip" | "none";
1277
1289
  /**
1278
- * Payload format, either a name or a custom implementation.
1290
+ * Payload format of the log batches, either a name or a custom implementation. Batches for
1291
+ * `metricsEndpoint` and `tracesEndpoint` always go out as OTLP. The library drops a batch
1292
+ * that the server refuses with a 400, so a custom serializer must keep every record within
1293
+ * the server's limits, or one bad record loses the whole batch.
1279
1294
  * @default "otlp"
1280
1295
  */
1281
1296
  serializer?: SerializerChoice;
@@ -15,7 +15,9 @@ export interface LogSerializer {
15
15
  name: string;
16
16
  /**
17
17
  * Serializes a batch of records to payload bytes. The transport calls it once per delivery
18
- * attempt, not once per batch, so every retry encodes the records again.
18
+ * attempt, not once per batch, so every retry encodes the records again. Make every record
19
+ * valid for your server, for example by cutting fields to its limits, because the library
20
+ * drops a batch that the server refuses with a 400.
19
21
  * @param records Batch records, in log order.
20
22
  * @returns Serialized batch ready for transport.
21
23
  */
@@ -15,7 +15,9 @@ export interface LogSerializer {
15
15
  name: string;
16
16
  /**
17
17
  * Serializes a batch of records to payload bytes. The transport calls it once per delivery
18
- * attempt, not once per batch, so every retry encodes the records again.
18
+ * attempt, not once per batch, so every retry encodes the records again. Make every record
19
+ * valid for your server, for example by cutting fields to its limits, because the library
20
+ * drops a batch that the server refuses with a 400.
19
21
  * @param records Batch records, in log order.
20
22
  * @returns Serialized batch ready for transport.
21
23
  */
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CqdJhTxH.cjs"),t=require("./error-like-gGRx2s36.cjs"),n=require("./library-request-D7OvTxZV.cjs"),r=require("./patch-BX8KrPCT.cjs"),i=require("./platform-CfA3-7sJ.cjs"),a=require("./types-C7WNpnG1.cjs"),o=require("./defineProperty-X1c4tIPD.cjs");function s(e,t){let n=[],r=0,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];a?a=!1:i&&s===`\\`?a=!0:s===`"`?i=!i:!i&&s===t&&(n.push(e.slice(r,o)),r=o+1)}return n.push(e.slice(r)),n}function c(e){return/^server-timing:(.*)$/im.exec(e)?.[1]??null}function l(t){let n={entries:[]};if(!t)return n;for(let r of s(t.slice(0,e.Ln),`,`).slice(0,32)){let[e,...t]=s(r,`;`),i=e.trim();if(!/^[!#$%&'*+.^_`|~\da-z-]+$/i.test(i))continue;let a={name:i,duration:0,description:``},o=new Set;for(let e of t){let t=e.indexOf(`=`);if(t<0)continue;let n=e.slice(0,t).trim().toLowerCase();if(o.has(n))continue;o.add(n);let r=e.slice(t+1).trim();if(r.startsWith(`"`)&&r.endsWith(`"`)&&(r=r.slice(1,-1).replace(/\\(.)/g,`$1`)),n===`dur`){let e=Number(r);Number.isFinite(e)&&e>=0&&(a.duration=e)}else n===`desc`&&(a.description=r)}if(n.entries.push(a),i.toLowerCase()===`traceparent`){let e=/^00-([\da-f]{32})-([\da-f]{16})-[\da-f]{2}$/.exec(a.description);e&&/[1-9a-f]/.test(e[1])&&/[1-9a-f]/.test(e[2])&&(n.link={traceId:e[1],spanId:e[2]})}}return n}var u=1e3,d={name:`http.client.request.duration`,kind:`histogram`,unit:`s`,boundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]};function f(e,n,r,i){let a=typeof location<`u`?location.href:void 0,o={"http.request.method":e,"server.address":new URL(n,a).hostname};if(r===0){let e=t.r(i)?i.name:``;return o[`error.type`]=e===``?`_OTHER`:e,o}return o[`http.response.status_code`]=r,r>=400&&(o[`error.type`]=String(r)),o}function p(){return XMLHttpRequest.prototype}function m(e){if(typeof e==`string`)return e;if(e instanceof URL)return e.href;if(typeof e==`object`&&e){let{url:t}=e;if(typeof t==`string`)return t}return String(e)}function h(e,t){let n=t?.method;return n===void 0&&typeof e==`object`&&e&&(n=e.method),v(n??`GET`)}function g(e){return typeof e==`object`&&!(e instanceof URL)&&!(e instanceof Request)}function _(e){return e===void 0||Object.values(e).every(e=>e===void 0)}function v(e){return typeof e==`string`?e.toUpperCase():String(e)}var y=class{constructor(e){o.t(this,`ctx`,void 0),o.t(this,`name`,`network`),o.t(this,`installed`,!1),o.t(this,`restores`,[]),o.t(this,`warnedTransport`,!1),this.ctx=e}install(){this.installed||(this.installed=!0,this.ctx.config.capture.fetch&&this.installFetch(),this.ctx.config.capture.xhr&&this.installXhr())}uninstall(){if(this.installed){this.installed=!1;for(let e of this.restores.splice(0))e()}}ignored(e){return n.t()||a.t(e,this.ctx.config.capture.ignoreUrls)}propagates(e){let t=this.ctx.config.capture.propagateTraceHeaderTo;if(t.length===0)return!1;let n=this.ctx.diagnostics.guard(`capture.header_failed`,`The library could not read the origin of a request URL. Only a RegExp target can match it.`,()=>new URL(e,location.href).origin);return t.some(t=>typeof t==`string`?t===n:t.test(e))}installFetch(){if(typeof globalThis.fetch!=`function`)return;let t=!0,n=(e,t)=>this.prepareFetch(e,t),i=(e,t,n,r,i)=>{this.record(e.method,e.url,t,n,r,e.span,e.routingContextId,i)},a=r.t(globalThis,`fetch`,r=>{let a=r.bind(globalThis);return async function(r,o){let s=t?n(r,o):void 0;if(!s)return a(r,o);let c=performance.now();try{let t=await a(s.input,s.init);return i(s,t.status,performance.now()-c,void 0,()=>t.headers.get(e.In)),t}catch(e){throw i(s,0,performance.now()-c,e),e}}});this.restores.push(()=>{t=!1,a()})}prepareFetch(e,t){let n=this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not read a fetch request. It sends the request unchanged.`,()=>{let n=m(e);if(!this.ignored(n))return{method:h(e,t),url:n,propagate:this.propagates(n)}});if(!n)return;let{method:r,url:i}=n,a={method:r,url:i,input:e,init:t,routingContextId:this.ctx.config.securityContext.id};if(!n.propagate||g(e))return a;try{let n=e instanceof Request?e.headers:void 0,r=new Headers(t?.headers??n);if(r.has(`traceparent`))return this.ctx.diagnostics.report(`capture.trace_header_kept`,`The request already has a traceparent header. The library keeps it and records no client span.`,{url:i}),a;let o=this.ctx.tracing.request();for(let[e,t]of Object.entries(o.headers))r.set(e,t);if(e instanceof Request){let n={...t,headers:r};_(t)&&(n.referrer=e.referrer,n.referrerPolicy=e.referrerPolicy),a.input=new Request(e,n),a.init=void 0}else a.init={...t,headers:r};a.span=o.span}catch(n){a.input=e,a.init=t,this.ctx.diagnostics.report(`capture.header_failed`,`The library could not add the traceparent header. It sends the request unchanged.`,{url:i},n)}return a}installXhr(){if(typeof XMLHttpRequest>`u`)return;let e=!0,t=this.ctx,n=e=>this.ignored(e),i=e=>this.propagates(e),a=(e,t,n,r)=>{this.record(e.method,e.url,t,n,void 0,e.span,e.routingContextId,r)},o=p(),s=r.t(o,`open`,n=>function(r,i,...a){e&&t.diagnostics.guard(`capture.record_failed`,`The library could not read an XMLHttpRequest. It does not record the request.`,()=>{this.__uiobs={method:v(r),url:m(i),startedAt:0}}),n.apply(this,[r,i,...a])}),l=r.t(o,`send`,r=>function(...o){let s=e?this.__uiobs:void 0;s&&t.diagnostics.guard(`capture.record_failed`,`The library could not record ${s.method} ${s.url}.`,()=>{n(s.url)||(s.startedAt=performance.now(),s.routingContextId=t.config.securityContext.id,this.addEventListener(`loadend`,()=>{a(s,this.status,performance.now()-s.startedAt,()=>c(this.getAllResponseHeaders()))},{once:!0}),i(s.url)&&(s.span=b(this,s.url,t)))}),r.apply(this,o)});this.restores.push(()=>{e=!1,s(),l()})}record(e,t,r,a,o,s,c,p){if(this.ctx.isActive?.()===!1||this.ctx.config.securityContext.isolation&&c!==void 0&&c!==this.ctx.config.securityContext.id)return;let m=this.ctx.config.capture.serverTiming&&p?this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not read the Server-Timing response header.`,()=>l(p())):void 0,h=i.i(t,this.ctx.config.capture.fullUrls,this.ctx.config.capture.urlTransform,this.ctx.diagnostics);!this.warnedTransport&&n.n()&&(this.warnedTransport=!0,this.ctx.diagnostics.report(`capture.transport_request`,`Network capture saw ${e} ${h} during a custom transport call. If the transport sends this request, add its URL to capture.ignoreUrls.`)),this.ctx.config.capture.httpMetrics&&this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record the duration of ${e} ${h}.`,()=>{let n=f(e,t,r,o);this.ctx.recordMetric(d,a/u,n)}),s&&this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record the span of ${e} ${h}.`,()=>{let n=Date.now();this.ctx.recordSpan({...s,link:m?.link,name:e,kind:`client`,startMs:n-a,endMs:n,error:r===0||r>=400,attributes:{...f(e,t,r,o),"url.full":h}})}),this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record ${e} ${h}.`,()=>{let t=Math.round(a);this.ctx.breadcrumbs.push({t:Date.now(),category:`http`,message:`${e} ${h} ${r===0?`failed`:String(r)}`,data:{durationMs:t}});let n={"http.request.method":e,"url.full":h,"http.response.status_code":r,"http.duration_ms":t,...m&&m.entries.length>0?{"server.timing":m.entries}:{}};r===0?this.ctx.logger.error(`${e} ${h} failed`,o,n):r>=400?this.ctx.logger.warn(`${e} ${h} returned ${String(r)}`,n):this.ctx.logger.debug(`${e} ${h}`,n)})}};function b(e,t,n){try{let t=n.tracing.request();for(let[n,r]of Object.entries(t.headers))e.setRequestHeader(n,r);return t.span}catch(e){n.diagnostics.report(`capture.header_failed`,`The library could not add the traceparent header. It sends the request unchanged.`,{url:t},e);return}}exports.NetworkCapture=y;
2
- //# sourceMappingURL=network-CGMLQ-mA.cjs.map
1
+ const e=require("./constants-CtF52hIV.cjs"),t=require("./error-like-gGRx2s36.cjs"),n=require("./library-request-kY9iTpIF.cjs"),r=require("./patch-BX8KrPCT.cjs"),i=require("./platform-BqRc-7RO.cjs"),a=require("./types-C7WNpnG1.cjs"),o=require("./defineProperty-X1c4tIPD.cjs");function s(e,t){let n=[],r=0,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];a?a=!1:i&&s===`\\`?a=!0:s===`"`?i=!i:!i&&s===t&&(n.push(e.slice(r,o)),r=o+1)}return n.push(e.slice(r)),n}function c(e){return/^server-timing:(.*)$/im.exec(e)?.[1]??null}function l(t){let n={entries:[]};if(!t)return n;for(let r of s(t.slice(0,e.Bn),`,`).slice(0,32)){let[e,...t]=s(r,`;`),i=e.trim();if(!/^[!#$%&'*+.^_`|~\da-z-]+$/i.test(i))continue;let a={name:i,duration:0,description:``},o=new Set;for(let e of t){let t=e.indexOf(`=`);if(t<0)continue;let n=e.slice(0,t).trim().toLowerCase();if(o.has(n))continue;o.add(n);let r=e.slice(t+1).trim();if(r.startsWith(`"`)&&r.endsWith(`"`)&&(r=r.slice(1,-1).replace(/\\(.)/g,`$1`)),n===`dur`){let e=Number(r);Number.isFinite(e)&&e>=0&&(a.duration=e)}else n===`desc`&&(a.description=r)}if(n.entries.push(a),i.toLowerCase()===`traceparent`){let e=/^00-([\da-f]{32})-([\da-f]{16})-[\da-f]{2}$/.exec(a.description);e&&/[1-9a-f]/.test(e[1])&&/[1-9a-f]/.test(e[2])&&(n.link={traceId:e[1],spanId:e[2]})}}return n}var u=1e3,d={name:`http.client.request.duration`,kind:`histogram`,unit:`s`,boundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]};function f(e,n,r,i){let a=typeof location<`u`?location.href:void 0,o={"http.request.method":e,"server.address":new URL(n,a).hostname};if(r===0){let e=t.r(i)?i.name:``;return o[`error.type`]=e===``?`_OTHER`:e,o}return o[`http.response.status_code`]=r,r>=400&&(o[`error.type`]=String(r)),o}function p(){return XMLHttpRequest.prototype}function m(e){if(typeof e==`string`)return e;if(e instanceof URL)return e.href;if(typeof e==`object`&&e){let{url:t}=e;if(typeof t==`string`)return t}return String(e)}function h(e,t){let n=t?.method;return n===void 0&&typeof e==`object`&&e&&(n=e.method),v(n??`GET`)}function g(e){return typeof e==`object`&&!(e instanceof URL)&&!(e instanceof Request)}function _(e){return e===void 0||Object.values(e).every(e=>e===void 0)}function v(e){return typeof e==`string`?e.toUpperCase():String(e)}var y=class{constructor(e){o.t(this,`ctx`,void 0),o.t(this,`name`,`network`),o.t(this,`installed`,!1),o.t(this,`restores`,[]),o.t(this,`warnedTransport`,!1),this.ctx=e}install(){this.installed||(this.installed=!0,this.ctx.config.capture.fetch&&this.installFetch(),this.ctx.config.capture.xhr&&this.installXhr())}uninstall(){if(this.installed){this.installed=!1;for(let e of this.restores.splice(0))e()}}ignored(e){return n.t()||a.t(e,this.ctx.config.capture.ignoreUrls)}propagates(e){let t=this.ctx.config.capture.propagateTraceHeaderTo;if(t.length===0)return!1;let n=this.ctx.diagnostics.guard(`capture.header_failed`,`The library could not read the origin of a request URL. Only a RegExp target can match it.`,()=>new URL(e,location.href).origin);return t.some(t=>typeof t==`string`?t===n:t.test(e))}installFetch(){if(typeof globalThis.fetch!=`function`)return;let t=!0,n=(e,t)=>this.prepareFetch(e,t),i=(e,t,n,r,i)=>{this.record(e.method,e.url,t,n,r,e.span,e.routingContextId,i)},a=r.t(globalThis,`fetch`,r=>{let a=r.bind(globalThis);return async function(r,o){let s=t?n(r,o):void 0;if(!s)return a(r,o);let c=performance.now();try{let t=await a(s.input,s.init);return i(s,t.status,performance.now()-c,void 0,()=>t.headers.get(e.zn)),t}catch(e){throw i(s,0,performance.now()-c,e),e}}});this.restores.push(()=>{t=!1,a()})}prepareFetch(e,t){let n=this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not read a fetch request. It sends the request unchanged.`,()=>{let n=m(e);if(!this.ignored(n))return{method:h(e,t),url:n,propagate:this.propagates(n)}});if(!n)return;let{method:r,url:i}=n,a={method:r,url:i,input:e,init:t,routingContextId:this.ctx.config.securityContext.id};if(!n.propagate||g(e))return a;try{let n=e instanceof Request?e.headers:void 0,r=new Headers(t?.headers??n);if(r.has(`traceparent`))return this.ctx.diagnostics.report(`capture.trace_header_kept`,`The request already has a traceparent header. The library keeps it and records no client span.`,{url:i}),a;let o=this.ctx.tracing.request();for(let[e,t]of Object.entries(o.headers))r.set(e,t);if(e instanceof Request){let n={...t,headers:r};_(t)&&(n.referrer=e.referrer,n.referrerPolicy=e.referrerPolicy),a.input=new Request(e,n),a.init=void 0}else a.init={...t,headers:r};a.span=o.span}catch(n){a.input=e,a.init=t,this.ctx.diagnostics.report(`capture.header_failed`,`The library could not add the traceparent header. It sends the request unchanged.`,{url:i},n)}return a}installXhr(){if(typeof XMLHttpRequest>`u`)return;let e=!0,t=this.ctx,n=e=>this.ignored(e),i=e=>this.propagates(e),a=(e,t,n,r)=>{this.record(e.method,e.url,t,n,void 0,e.span,e.routingContextId,r)},o=p(),s=r.t(o,`open`,n=>function(r,i,...a){e&&t.diagnostics.guard(`capture.record_failed`,`The library could not read an XMLHttpRequest. It does not record the request.`,()=>{this.__uiobs={method:v(r),url:m(i),startedAt:0}}),n.apply(this,[r,i,...a])}),l=r.t(o,`send`,r=>function(...o){let s=e?this.__uiobs:void 0;s&&t.diagnostics.guard(`capture.record_failed`,`The library could not record ${s.method} ${s.url}.`,()=>{n(s.url)||(s.startedAt=performance.now(),s.routingContextId=t.config.securityContext.id,this.addEventListener(`loadend`,()=>{a(s,this.status,performance.now()-s.startedAt,()=>c(this.getAllResponseHeaders()))},{once:!0}),i(s.url)&&(s.span=b(this,s.url,t)))}),r.apply(this,o)});this.restores.push(()=>{e=!1,s(),l()})}record(e,t,r,a,o,s,c,p){if(this.ctx.isActive?.()===!1||this.ctx.config.securityContext.isolation&&c!==void 0&&c!==this.ctx.config.securityContext.id)return;let m=this.ctx.config.capture.serverTiming&&p?this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not read the Server-Timing response header.`,()=>l(p())):void 0,h=i.i(t,this.ctx.config.capture.fullUrls,this.ctx.config.capture.urlTransform,this.ctx.diagnostics);!this.warnedTransport&&n.n()&&(this.warnedTransport=!0,this.ctx.diagnostics.report(`capture.transport_request`,`Network capture saw ${e} ${h} during a custom transport call. If the transport sends this request, add its URL to capture.ignoreUrls.`)),this.ctx.config.capture.httpMetrics&&this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record the duration of ${e} ${h}.`,()=>{let n=f(e,t,r,o);this.ctx.recordMetric(d,a/u,n)}),s&&this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record the span of ${e} ${h}.`,()=>{let n=Date.now();this.ctx.recordSpan({...s,link:m?.link,name:e,kind:`client`,startMs:n-a,endMs:n,error:r===0||r>=400,attributes:{...f(e,t,r,o),"url.full":h}})}),this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record ${e} ${h}.`,()=>{let t=Math.round(a);this.ctx.breadcrumbs.push({t:Date.now(),category:`http`,message:`${e} ${h} ${r===0?`failed`:String(r)}`,data:{durationMs:t}});let n={"http.request.method":e,"url.full":h,"http.response.status_code":r,"http.duration_ms":t,...m&&m.entries.length>0?{"server.timing":m.entries}:{}};r===0?this.ctx.logger.error(`${e} ${h} failed`,o,n):r>=400?this.ctx.logger.warn(`${e} ${h} returned ${String(r)}`,n):this.ctx.logger.debug(`${e} ${h}`,n)})}};function b(e,t,n){try{let t=n.tracing.request();for(let[n,r]of Object.entries(t.headers))e.setRequestHeader(n,r);return t.span}catch(e){n.diagnostics.report(`capture.header_failed`,`The library could not add the traceparent header. It sends the request unchanged.`,{url:t},e);return}}exports.NetworkCapture=y;
2
+ //# sourceMappingURL=network-BCn8Gn47.cjs.map