@nathanclaire/edge-telemetry-sdk 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/README.md +831 -186
  2. package/dist/appLifecycle-CECgRVu_.cjs +2 -0
  3. package/dist/appLifecycle-CECgRVu_.cjs.map +1 -0
  4. package/dist/appLifecycle-DQErzJIR.js +22 -0
  5. package/dist/appLifecycle-DQErzJIR.js.map +1 -0
  6. package/dist/batch-CwoO7noL.js +56 -0
  7. package/dist/batch-CwoO7noL.js.map +1 -0
  8. package/dist/batch-DNu8Xr9T.cjs +2 -0
  9. package/dist/batch-DNu8Xr9T.cjs.map +1 -0
  10. package/dist/crashCapture-BOJ8nSAZ.cjs +4 -0
  11. package/dist/crashCapture-BOJ8nSAZ.cjs.map +1 -0
  12. package/dist/crashCapture-BW8WuyaU.js +70 -0
  13. package/dist/crashCapture-BW8WuyaU.js.map +1 -0
  14. package/dist/crashHandler.web-8F_k2veo.js +29 -0
  15. package/dist/crashHandler.web-8F_k2veo.js.map +1 -0
  16. package/dist/crashHandler.web-CWmF56mJ.cjs +2 -0
  17. package/dist/crashHandler.web-CWmF56mJ.cjs.map +1 -0
  18. package/dist/crashHandlerNative.native-C2kSikDt.cjs +2 -0
  19. package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +1 -0
  20. package/dist/crashHandlerNative.native-FupMnr1U.js +39 -0
  21. package/dist/crashHandlerNative.native-FupMnr1U.js.map +1 -0
  22. package/dist/deviceInfo.native-BJ-3Jj1T.js +53 -0
  23. package/dist/deviceInfo.native-BJ-3Jj1T.js.map +1 -0
  24. package/dist/deviceInfo.native-BoeTZcD6.cjs +2 -0
  25. package/dist/deviceInfo.native-BoeTZcD6.cjs.map +1 -0
  26. package/dist/deviceInfo.web-3L3IDQQA.cjs +2 -0
  27. package/dist/deviceInfo.web-3L3IDQQA.cjs.map +1 -0
  28. package/dist/deviceInfo.web-BFB1-pcA.js +41 -0
  29. package/dist/deviceInfo.web-BFB1-pcA.js.map +1 -0
  30. package/dist/frameTracker-CHG6sIx9.cjs +2 -0
  31. package/dist/frameTracker-CHG6sIx9.cjs.map +1 -0
  32. package/dist/frameTracker-DdB8W_kC.js +54 -0
  33. package/dist/frameTracker-DdB8W_kC.js.map +1 -0
  34. package/dist/httpAttributes-BrrtM8zh.js +70 -0
  35. package/dist/httpAttributes-BrrtM8zh.js.map +1 -0
  36. package/dist/httpAttributes-D0m6UID7.cjs +2 -0
  37. package/dist/httpAttributes-D0m6UID7.cjs.map +1 -0
  38. package/dist/index-BtLlV1HA.js +57 -0
  39. package/dist/index-BtLlV1HA.js.map +1 -0
  40. package/dist/{deviceInfo.native-D2k0LDhI.js → index-C2XQ-EYw.js} +362 -411
  41. package/dist/index-C2XQ-EYw.js.map +1 -0
  42. package/dist/index-CXsVZY35.cjs +2 -0
  43. package/dist/index-CXsVZY35.cjs.map +1 -0
  44. package/dist/index-DLquF88M.cjs +2 -0
  45. package/dist/index-DLquF88M.cjs.map +1 -0
  46. package/dist/index.native.cjs +1 -1
  47. package/dist/index.native.cjs.map +1 -1
  48. package/dist/index.native.js +94 -59
  49. package/dist/index.native.js.map +1 -1
  50. package/dist/index.web.cjs +1 -1
  51. package/dist/index.web.cjs.map +1 -1
  52. package/dist/index.web.js +88 -33
  53. package/dist/index.web.js.map +1 -1
  54. package/dist/interactionWeb.web-Bl_cZlgh.cjs +2 -0
  55. package/dist/interactionWeb.web-Bl_cZlgh.cjs.map +1 -0
  56. package/dist/interactionWeb.web-CJAviVQ7.js +109 -0
  57. package/dist/interactionWeb.web-CJAviVQ7.js.map +1 -0
  58. package/dist/interceptFetchWeb.web-T88kO-bE.cjs +2 -0
  59. package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +1 -0
  60. package/dist/interceptFetchWeb.web-UXC2Lb6X.js +61 -0
  61. package/dist/interceptFetchWeb.web-UXC2Lb6X.js.map +1 -0
  62. package/dist/interceptHttpNative.native-BVpFuoNB.cjs +2 -0
  63. package/dist/interceptHttpNative.native-BVpFuoNB.cjs.map +1 -0
  64. package/dist/interceptHttpNative.native-rX-lPNST.js +18 -0
  65. package/dist/interceptHttpNative.native-rX-lPNST.js.map +1 -0
  66. package/dist/loadingTime-Bhomd9qq.cjs +2 -0
  67. package/dist/loadingTime-Bhomd9qq.cjs.map +1 -0
  68. package/dist/loadingTime-ZkYvFijA.js +70 -0
  69. package/dist/loadingTime-ZkYvFijA.js.map +1 -0
  70. package/dist/memoryNative.native-C42h9SjK.js +54 -0
  71. package/dist/memoryNative.native-C42h9SjK.js.map +1 -0
  72. package/dist/memoryNative.native-CA-7w9w1.cjs +2 -0
  73. package/dist/memoryNative.native-CA-7w9w1.cjs.map +1 -0
  74. package/dist/memoryStore-BIGZmmfD.cjs +2 -0
  75. package/dist/memoryStore-BIGZmmfD.cjs.map +1 -0
  76. package/dist/memoryStore-F5I-GQKM.js +193 -0
  77. package/dist/memoryStore-F5I-GQKM.js.map +1 -0
  78. package/dist/nativeSender-CfQaRuDK.cjs +2 -0
  79. package/dist/nativeSender-CfQaRuDK.cjs.map +1 -0
  80. package/dist/nativeSender-pgVSIv-X.js +59 -0
  81. package/dist/nativeSender-pgVSIv-X.js.map +1 -0
  82. package/dist/navigationRef-BzYbs8cm.js +28 -0
  83. package/dist/navigationRef-BzYbs8cm.js.map +1 -0
  84. package/dist/navigationRef-C-_qhb43.cjs +2 -0
  85. package/dist/navigationRef-C-_qhb43.cjs.map +1 -0
  86. package/dist/{navigationTracker-Cts68dgG.js → navigationTracker-BmywA_Bg.js} +4 -4
  87. package/dist/navigationTracker-BmywA_Bg.js.map +1 -0
  88. package/dist/navigationTracker-HkwVyywz.cjs +2 -0
  89. package/dist/navigationTracker-HkwVyywz.cjs.map +1 -0
  90. package/dist/navigationWeb.web-CW_z7Ca4.cjs +2 -0
  91. package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +1 -0
  92. package/dist/navigationWeb.web-CcwgKuIZ.js +55 -0
  93. package/dist/navigationWeb.web-CcwgKuIZ.js.map +1 -0
  94. package/dist/{networkInfo.native-BK5fpAOL.js → networkInfo.native-CGrx9cnH.js} +15 -15
  95. package/dist/{networkInfo.native-BK5fpAOL.js.map → networkInfo.native-CGrx9cnH.js.map} +1 -1
  96. package/dist/{networkInfo.native-cxuw93Uy.cjs → networkInfo.native-YVySdv3S.cjs} +2 -2
  97. package/dist/{networkInfo.native-cxuw93Uy.cjs.map → networkInfo.native-YVySdv3S.cjs.map} +1 -1
  98. package/dist/{networkInfo.web-twcNn_hc.js → networkInfo.web-B2YlLNsI.js} +3 -3
  99. package/dist/networkInfo.web-B2YlLNsI.js.map +1 -0
  100. package/dist/networkInfo.web-PltJTHsy.cjs +2 -0
  101. package/dist/networkInfo.web-PltJTHsy.cjs.map +1 -0
  102. package/dist/runtimeReady.native-Bh7EcYmK.js +14 -0
  103. package/dist/runtimeReady.native-Bh7EcYmK.js.map +1 -0
  104. package/dist/runtimeReady.native-jUmuE1lV.cjs +2 -0
  105. package/dist/runtimeReady.native-jUmuE1lV.cjs.map +1 -0
  106. package/dist/runtimeReady.web-C8fdIbVR.js +25 -0
  107. package/dist/runtimeReady.web-C8fdIbVR.js.map +1 -0
  108. package/dist/runtimeReady.web-DHW682RN.cjs +2 -0
  109. package/dist/runtimeReady.web-DHW682RN.cjs.map +1 -0
  110. package/dist/seedRuntimeReady-BKwkBEAF.cjs +2 -0
  111. package/dist/seedRuntimeReady-BKwkBEAF.cjs.map +1 -0
  112. package/dist/seedRuntimeReady-Cz8nOKoo.js +10 -0
  113. package/dist/seedRuntimeReady-Cz8nOKoo.js.map +1 -0
  114. package/dist/src/adapters/appLifecycle.d.ts +8 -1
  115. package/dist/src/adapters/batch.d.ts +2 -0
  116. package/dist/src/adapters/crashCapture.d.ts +38 -9
  117. package/dist/src/adapters/failedEvents.d.ts +43 -0
  118. package/dist/src/adapters/frameAggregate.d.ts +8 -3
  119. package/dist/src/adapters/frameTracker.d.ts +30 -0
  120. package/dist/src/adapters/httpAttributes.d.ts +18 -0
  121. package/dist/src/adapters/loadingTime.d.ts +67 -0
  122. package/dist/src/adapters/native/interceptHttpNative.native.d.ts +18 -0
  123. package/dist/src/adapters/native/memoryNative.native.d.ts +15 -11
  124. package/dist/src/adapters/native/runtimeReady.native.d.ts +1 -0
  125. package/dist/src/adapters/native/store.native.d.ts +10 -0
  126. package/dist/src/adapters/nativeSender.d.ts +2 -2
  127. package/dist/src/adapters/navigationRef.d.ts +21 -0
  128. package/dist/src/adapters/navigationTracker.d.ts +1 -1
  129. package/dist/src/adapters/screenTiming.d.ts +8 -2
  130. package/dist/src/adapters/seedRuntimeReady.d.ts +8 -0
  131. package/dist/src/adapters/traceHeader.d.ts +33 -0
  132. package/dist/src/adapters/traceManager.d.ts +131 -0
  133. package/dist/src/adapters/uiInteraction.d.ts +111 -0
  134. package/dist/src/adapters/viewManager.d.ts +161 -0
  135. package/dist/src/adapters/viewport.d.ts +15 -0
  136. package/dist/src/adapters/web/interactionWeb.web.d.ts +36 -0
  137. package/dist/src/adapters/web/interceptFetchWeb.web.d.ts +3 -11
  138. package/dist/src/adapters/web/navigationWeb.web.d.ts +10 -0
  139. package/dist/src/adapters/web/runtimeReady.web.d.ts +5 -0
  140. package/dist/src/adapters/web/store.web.d.ts +12 -0
  141. package/dist/src/adapters/web/webVitals.web.d.ts +49 -0
  142. package/dist/src/adapters/webSender.d.ts +2 -2
  143. package/dist/src/adapters/webVitals.d.ts +25 -0
  144. package/dist/src/adapters/xhrIntercept.d.ts +53 -0
  145. package/dist/src/core/beforeSend.d.ts +20 -0
  146. package/dist/src/core/debug.d.ts +7 -0
  147. package/dist/src/core/memoryStore.d.ts +23 -0
  148. package/dist/src/core/store.d.ts +41 -0
  149. package/dist/src/core/telemetry.d.ts +305 -35
  150. package/dist/src/core/userProfile.d.ts +12 -0
  151. package/dist/src/core/utils/json.d.ts +7 -0
  152. package/dist/src/core/utils/uuid.d.ts +10 -1
  153. package/dist/src/createTelemetry.native.d.ts +7 -0
  154. package/dist/src/createTelemetry.web.d.ts +7 -0
  155. package/dist/src/index.base.d.ts +17 -1
  156. package/dist/src/index.native.d.ts +46 -9
  157. package/dist/src/index.web.d.ts +33 -2
  158. package/dist/store.native-BYBJcy6o.js +32 -0
  159. package/dist/store.native-BYBJcy6o.js.map +1 -0
  160. package/dist/store.native-TPqXngmF.cjs +2 -0
  161. package/dist/store.native-TPqXngmF.cjs.map +1 -0
  162. package/dist/store.web-CvqqN-_Z.cjs +2 -0
  163. package/dist/store.web-CvqqN-_Z.cjs.map +1 -0
  164. package/dist/store.web-DJAlN0nc.js +31 -0
  165. package/dist/store.web-DJAlN0nc.js.map +1 -0
  166. package/dist/telemetry-ByDJIz_9.js +1280 -0
  167. package/dist/telemetry-ByDJIz_9.js.map +1 -0
  168. package/dist/telemetry-CrU7i1Jc.cjs +2 -0
  169. package/dist/telemetry-CrU7i1Jc.cjs.map +1 -0
  170. package/dist/uiInteraction-CdzvEI1p.cjs +2 -0
  171. package/dist/uiInteraction-CdzvEI1p.cjs.map +1 -0
  172. package/dist/uiInteraction-DAqxxz0q.js +104 -0
  173. package/dist/uiInteraction-DAqxxz0q.js.map +1 -0
  174. package/dist/viewport-Dd85GUNO.cjs +2 -0
  175. package/dist/viewport-Dd85GUNO.cjs.map +1 -0
  176. package/dist/viewport-Dzmt5QwK.js +15 -0
  177. package/dist/viewport-Dzmt5QwK.js.map +1 -0
  178. package/dist/web-vitals.attribution-CVCPiX-h.cjs +2 -0
  179. package/dist/web-vitals.attribution-CVCPiX-h.cjs.map +1 -0
  180. package/dist/web-vitals.attribution-xw9N5MKQ.js +488 -0
  181. package/dist/web-vitals.attribution-xw9N5MKQ.js.map +1 -0
  182. package/dist/webSender-BIwslfpT.js +63 -0
  183. package/dist/webSender-BIwslfpT.js.map +1 -0
  184. package/dist/webSender-CVtE4sOF.cjs +2 -0
  185. package/dist/webSender-CVtE4sOF.cjs.map +1 -0
  186. package/dist/webVitals.web-CNIpsKlA.js +85 -0
  187. package/dist/webVitals.web-CNIpsKlA.js.map +1 -0
  188. package/dist/webVitals.web-DpWJ-iYp.cjs +2 -0
  189. package/dist/webVitals.web-DpWJ-iYp.cjs.map +1 -0
  190. package/dist/xhrIntercept-BADex6Cq.cjs +2 -0
  191. package/dist/xhrIntercept-BADex6Cq.cjs.map +1 -0
  192. package/dist/xhrIntercept-BNiA41Mj.js +53 -0
  193. package/dist/xhrIntercept-BNiA41Mj.js.map +1 -0
  194. package/docs/migration-v4.md +190 -0
  195. package/package.json +12 -4
  196. package/dist/appLifecycle-Cynw0kAv.js +0 -14
  197. package/dist/appLifecycle-Cynw0kAv.js.map +0 -1
  198. package/dist/appLifecycle-DvJIt7ym.cjs +0 -2
  199. package/dist/appLifecycle-DvJIt7ym.cjs.map +0 -1
  200. package/dist/batch-CLBFgYPC.cjs +0 -2
  201. package/dist/batch-CLBFgYPC.cjs.map +0 -1
  202. package/dist/batch-DLG_gtOm.js +0 -12
  203. package/dist/batch-DLG_gtOm.js.map +0 -1
  204. package/dist/crashCapture-BYTM4FLC.cjs +0 -2
  205. package/dist/crashCapture-BYTM4FLC.cjs.map +0 -1
  206. package/dist/crashCapture-D_rkkBVa.js +0 -31
  207. package/dist/crashCapture-D_rkkBVa.js.map +0 -1
  208. package/dist/crashHandler.web-BSxDpFTo.cjs +0 -2
  209. package/dist/crashHandler.web-BSxDpFTo.cjs.map +0 -1
  210. package/dist/crashHandler.web-D59bmhg9.js +0 -32
  211. package/dist/crashHandler.web-D59bmhg9.js.map +0 -1
  212. package/dist/crashHandlerNative.native-DeAFze4E.cjs +0 -2
  213. package/dist/crashHandlerNative.native-DeAFze4E.cjs.map +0 -1
  214. package/dist/crashHandlerNative.native-d7qJkzA6.js +0 -41
  215. package/dist/crashHandlerNative.native-d7qJkzA6.js.map +0 -1
  216. package/dist/debug-DsvQ9y3W.js +0 -68
  217. package/dist/debug-DsvQ9y3W.js.map +0 -1
  218. package/dist/debug-rnOOxFpN.cjs +0 -2
  219. package/dist/debug-rnOOxFpN.cjs.map +0 -1
  220. package/dist/deviceInfo.native-7hbRYixR.cjs +0 -2
  221. package/dist/deviceInfo.native-7hbRYixR.cjs.map +0 -1
  222. package/dist/deviceInfo.native-D2k0LDhI.js.map +0 -1
  223. package/dist/deviceInfo.web-ByNAlEJh.cjs +0 -2
  224. package/dist/deviceInfo.web-ByNAlEJh.cjs.map +0 -1
  225. package/dist/deviceInfo.web-DzQyEku6.js +0 -40
  226. package/dist/deviceInfo.web-DzQyEku6.js.map +0 -1
  227. package/dist/frameAggregate-C_HoVFcK.cjs +0 -2
  228. package/dist/frameAggregate-C_HoVFcK.cjs.map +0 -1
  229. package/dist/frameAggregate-Cwh1juw1.js +0 -17
  230. package/dist/frameAggregate-Cwh1juw1.js.map +0 -1
  231. package/dist/frameDropsNative.native-CP7zrXDf.js +0 -23
  232. package/dist/frameDropsNative.native-CP7zrXDf.js.map +0 -1
  233. package/dist/frameDropsNative.native-DKqEDqip.cjs +0 -2
  234. package/dist/frameDropsNative.native-DKqEDqip.cjs.map +0 -1
  235. package/dist/frameDropsWeb.web-C9Lt3Fuj.js +0 -22
  236. package/dist/frameDropsWeb.web-C9Lt3Fuj.js.map +0 -1
  237. package/dist/frameDropsWeb.web-azpwQCUz.cjs +0 -2
  238. package/dist/frameDropsWeb.web-azpwQCUz.cjs.map +0 -1
  239. package/dist/httpAttributes-BV50UKQU.js +0 -19
  240. package/dist/httpAttributes-BV50UKQU.js.map +0 -1
  241. package/dist/httpAttributes-xXOD9trQ.cjs +0 -2
  242. package/dist/httpAttributes-xXOD9trQ.cjs.map +0 -1
  243. package/dist/interaction-CH8yoY5-.js +0 -23
  244. package/dist/interaction-CH8yoY5-.js.map +0 -1
  245. package/dist/interaction-DcNFBW7a.cjs +0 -2
  246. package/dist/interaction-DcNFBW7a.cjs.map +0 -1
  247. package/dist/interceptFetchNative.native-VlhtMG-U.js +0 -49
  248. package/dist/interceptFetchNative.native-VlhtMG-U.js.map +0 -1
  249. package/dist/interceptFetchNative.native-jEAldH14.cjs +0 -2
  250. package/dist/interceptFetchNative.native-jEAldH14.cjs.map +0 -1
  251. package/dist/interceptFetchWeb.web-DFzZliik.cjs +0 -2
  252. package/dist/interceptFetchWeb.web-DFzZliik.cjs.map +0 -1
  253. package/dist/interceptFetchWeb.web-DfsMfoRP.js +0 -77
  254. package/dist/interceptFetchWeb.web-DfsMfoRP.js.map +0 -1
  255. package/dist/memoryNative.native-BWLh2S9L.js +0 -48
  256. package/dist/memoryNative.native-BWLh2S9L.js.map +0 -1
  257. package/dist/memoryNative.native-DCXSOd4Q.cjs +0 -2
  258. package/dist/memoryNative.native-DCXSOd4Q.cjs.map +0 -1
  259. package/dist/memoryWeb.web-B3YuV-cB.js +0 -48
  260. package/dist/memoryWeb.web-B3YuV-cB.js.map +0 -1
  261. package/dist/memoryWeb.web-CheXAcJn.cjs +0 -2
  262. package/dist/memoryWeb.web-CheXAcJn.cjs.map +0 -1
  263. package/dist/nativeSender-BE_mzw_S.js +0 -70
  264. package/dist/nativeSender-BE_mzw_S.js.map +0 -1
  265. package/dist/nativeSender-DyAUGY7c.cjs +0 -2
  266. package/dist/nativeSender-DyAUGY7c.cjs.map +0 -1
  267. package/dist/navigationNative.native-3tO5JxSd.cjs +0 -2
  268. package/dist/navigationNative.native-3tO5JxSd.cjs.map +0 -1
  269. package/dist/navigationNative.native-BUCGPQX2.js +0 -25
  270. package/dist/navigationNative.native-BUCGPQX2.js.map +0 -1
  271. package/dist/navigationTracker-B2GMwyKk.cjs +0 -2
  272. package/dist/navigationTracker-B2GMwyKk.cjs.map +0 -1
  273. package/dist/navigationTracker-Cts68dgG.js.map +0 -1
  274. package/dist/navigationWeb.web-B0necr5j.cjs +0 -2
  275. package/dist/navigationWeb.web-B0necr5j.cjs.map +0 -1
  276. package/dist/navigationWeb.web-CORzE_Id.js +0 -46
  277. package/dist/navigationWeb.web-CORzE_Id.js.map +0 -1
  278. package/dist/networkInfo.web-DJmw1sNK.cjs +0 -2
  279. package/dist/networkInfo.web-DJmw1sNK.cjs.map +0 -1
  280. package/dist/networkInfo.web-twcNn_hc.js.map +0 -1
  281. package/dist/src/adapters/interaction.d.ts +0 -17
  282. package/dist/src/adapters/native/frameDropsNative.native.d.ts +0 -16
  283. package/dist/src/adapters/native/interceptFetchNative.native.d.ts +0 -23
  284. package/dist/src/adapters/native/navigationNative.native.d.ts +0 -12
  285. package/dist/src/adapters/web/frameDropsWeb.web.d.ts +0 -16
  286. package/dist/src/adapters/web/memoryWeb.web.d.ts +0 -26
  287. package/dist/telemetry-Co4MYdwa.cjs +0 -2
  288. package/dist/telemetry-Co4MYdwa.cjs.map +0 -1
  289. package/dist/telemetry-KI0x4gzC.js +0 -389
  290. package/dist/telemetry-KI0x4gzC.js.map +0 -1
  291. package/dist/v4-BysszJq8.js +0 -31
  292. package/dist/v4-BysszJq8.js.map +0 -1
  293. package/dist/v4-CqdK_b8Y.cjs +0 -2
  294. package/dist/v4-CqdK_b8Y.cjs.map +0 -1
  295. package/dist/webSender-B27tmT1w.js +0 -42
  296. package/dist/webSender-B27tmT1w.js.map +0 -1
  297. package/dist/webSender-BWi4x1df.cjs +0 -2
  298. package/dist/webSender-BWi4x1df.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-vitals.attribution-xw9N5MKQ.js","sources":["../node_modules/web-vitals/dist/web-vitals.attribution.js"],"sourcesContent":["class t{t;o=0;i=[];l(t){if(t.hadRecentInput)return;const n=this.i[0],e=this.i.at(-1);this.o&&n&&e&&t.startTime-e.startTime<1e3&&t.startTime-n.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}}const n=()=>{const t=performance.getEntriesByType(\"navigation\")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},e=t=>{if(\"loading\"===document.readyState)return\"loading\";const e=n();if(e){if(t<e.domInteractive)return\"loading\";if(0===e.domContentLoadedEventStart||t<e.domContentLoadedEventStart)return\"dom-interactive\";if(0===e.domComplete||t<e.domComplete)return\"dom-content-loaded\"}return\"complete\"},o=t=>{const n=t.nodeName;return 1===t.nodeType?n.toLowerCase():n.toUpperCase().replace(/^#/,\"\")},i=t=>{let n=\"\";try{for(;9!==t?.nodeType;){const e=t,i=e.id?\"#\"+e.id:[o(e),...Array.from(e.classList??[]).sort()].join(\".\");if(n.length+i.length>99)return n||i;if(n=n?i+\">\"+n:i,e.id)break;t=e.parentNode}}catch{}return n},a=new WeakMap;function r(t,n){let e=a.get(n);return e||(e=new WeakMap,a.set(n,e)),e.get(t)||e.set(t,new n),e.get(t)}let s=-1;const c=()=>s,f=t=>{addEventListener(\"pageshow\",n=>{n.persisted&&(s=n.timeStamp,t(n))},!0)},l=(t,n,e,o)=>{let i,a;return r=>{n.value>=0&&(r||o)&&(a=n.value-(i??0),(a||void 0===i)&&(i=n.value,n.delta=a,n.rating=((t,n)=>t>n[1]?\"poor\":t>n[0]?\"needs-improvement\":\"good\")(n.value,e),t(n)))}},u=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},d=()=>n()?.activationStart??0;let h=-1;const g=new Set,v=()=>\"hidden\"!==document.visibilityState||document.prerendering?1/0:0,p=t=>{if(\"hidden\"===document.visibilityState){if(\"visibilitychange\"===t.type)for(const t of g)t();isFinite(h)||(h=\"visibilitychange\"===t.type?t.timeStamp:0,removeEventListener(\"prerenderingchange\",p,!0))}},m=(t=!1)=>{if(t&&(h=1/0),h<0){const t=d(),n=document.prerendering?void 0:globalThis.performance.getEntriesByType(\"visibility-state\").find(n=>\"hidden\"===n.name&&n.startTime>=t)?.startTime;h=n??v(),addEventListener(\"visibilitychange\",p,!0),addEventListener(\"prerenderingchange\",p,!0),f(()=>{setTimeout(()=>{h=v()})})}return{get firstHiddenTime(){return h},onHidden(t){g.add(t)}}},y=(t,e=-1,o,i=0,a,r,s)=>{const f=n(),l=f?.navigationId||0;let u=\"navigate\";o?u=o:c()>=0?u=\"back-forward-cache\":f&&(document.prerendering||d()>0?u=\"prerender\":document.wasDiscarded?u=\"restore\":f.type&&(u=f.type.replace(/_/g,\"-\")));return{name:t,value:e,rating:\"good\",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:i||l,navigationInteractionId:a,navigationURL:r||f?.name,navigationStartTime:s||0}},b=(t,n,e={})=>{try{const o=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(o.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const e=t.getEntries();o.length>1&&e.sort((t,n)=>t.startTime+t.duration-(n.startTime+n.duration)),n(e)})});for(const n of o)t.observe({type:n,buffered:!0,...e});return t}}catch{}},M=t=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes(\"soft-navigation\")&&\"function\"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&t&&t.reportSoftNavs,T=(t,n)=>{if(t.set(n.navigationId,n),t.size>2){const n=t.keys().next().value;void 0!==n&&t.delete(n)}},E=t=>{let n=!1;return()=>{n||(t(),n=!0)}};class D{u}const w=t=>{document.prerendering?addEventListener(\"prerenderingchange\",t,!0):t()},S=[1800,3e3],k=(t,n={})=>{const e=M(n);w(()=>{const o=r(n,D),i=m();let a,s=y(\"FCP\");const h=b([\"paint\"],t=>{for(const n of t)\"first-contentful-paint\"===n.name&&(h.disconnect(),n.startTime<i.firstHiddenTime&&(s.value=Math.max(n.startTime-d(),0),s.entries.push(n),s.navigationId=n.navigationId||s.navigationId,a(!0)))});if(h&&(a=l(t,s,S,n.reportAllChanges),f(e=>{s=y(\"FCP\",-1,\"back-forward-cache\",s.navigationId,s.navigationInteractionId,s.navigationURL,c()),a=l(t,s,S,n.reportAllChanges),u(()=>{s.value=performance.now()-e.timeStamp,a(!0)})})),e){b([\"soft-navigation\"],e=>{e.forEach(e=>{o.u&&e.navigationId&&T(o.u,e);const i=Math.max((e.presentationTime||e.paintTime||0)-e.startTime,0);s=y(\"FCP\",i,\"soft-navigation\",e.navigationId,e.interactionId,e.name,e.startTime),a=l(t,s,S,n.reportAllChanges),a(!0)})},n)}})},L=[.1,.25],P=t=>t.find(t=>1===t.node?.nodeType)||t[0],F=(n,o={})=>{const a=r(o=Object.assign({},o),t),s=new WeakMap;a.t=t=>{if(t?.sources?.length){const n=P(t.sources),e=n?.node;if(e){const t=o.generateTarget?.(e)??i(e);s.set(n,t)}}};((n,e={})=>{const o=m();k(E(()=>{let i,a=y(\"CLS\",0);const s=r(e,t),d=(t,o,r,c,f)=>{a=y(\"CLS\",0,t,o,r,c,f),s.o=0,i=l(n,a,L,e.reportAllChanges)},h=(t=!1)=>{s.o>a.value&&(a.value=s.o,a.entries=s.i),i(t)},g=t=>{h(!0),d(\"soft-navigation\",t.navigationId,t.interactionId,t.name,t.startTime)},v=t=>{for(const n of t)\"soft-navigation\"!==n.entryType?s.l(n):g(n);h()},p=[\"layout-shift\"];M(e)&&p.push(\"soft-navigation\");const m=b(p,v);m&&(i=l(n,a,L,e.reportAllChanges),o.onHidden(()=>{v(m.takeRecords()),i(!0)}),f(()=>{d(\"back-forward-cache\",a.navigationId,a.navigationInteractionId,a.navigationURL,c()),u(i)}),setTimeout(i))}))})(t=>{n((t=>{let n={};if(t.entries.length){const o=t.entries.reduce((t,n)=>t.value>n.value?t:n);if(o?.sources?.length){const t=P(o.sources);t&&(n={largestShiftTarget:s.get(t),largestShiftTime:o.startTime,largestShiftValue:o.value,largestShiftSource:t,largestShiftEntry:o,loadState:e(o.startTime)})}}return Object.assign(t,{attribution:n})})(t))},o)},_=(t,o={})=>{const i=r(o=Object.assign({},o),D);M(o)&&(i.u=new Map);k(o=>{t((t=>{let o={timeToFirstByte:0,firstByteToFCP:t.value,loadState:e(c())};if(\"soft-navigation\"!==t.navigationType){if(t.entries.length){const i=n(),a=t.entries.at(-1);if(i){const n=i.responseStart,r=i.activationStart||0,s=Math.max(0,n-r);o={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:e(t.entries[0].startTime),navigationEntry:i,fcpEntry:a}}}}else{const n=i.u?.get(t.navigationId);n&&(o={timeToFirstByte:0,firstByteToFCP:t.value,loadState:\"complete\",navigationEntry:n})}return Object.assign(t,{attribution:o})})(o))},o)};let C=0,I=1/0,B=0;const O=t=>{for(const n of t)n.interactionId&&(I=Math.min(I,n.interactionId),B=Math.max(B,n.interactionId),C=B?(B-I)/7+1:0)};let j;const A=()=>j?C:performance.interactionCount??0,N=()=>{\"interactionCount\"in performance||j||(j=b([\"event\"],O,{durationThreshold:0}))};class q{h=0;v=[];p=new Map;m;M;T(){return A()-this.h}D(){this.h=A(),this.v.length=0,this.p.clear()}S(t){const n=this.T(),e=Math.min(this.v.length-1,Math.floor(n/50));return!n||-1!==e||\"soft-navigation\"!==t&&\"back-forward-cache\"!==t?this.v[e]:{k:8,id:-1,entries:[]}}l(t){if(this.m?.(t),!t.interactionId)return;const n=this.v.at(-1);let e=this.p.get(t.interactionId);if(e||this.v.length<10||t.duration>n.k){if(e?t.duration>e.k?(e.entries=[t],e.k=t.duration):t.duration===e.k&&t.startTime===e.entries[0].startTime&&e.entries.push(t):(e={id:t.interactionId,entries:[t],k:t.duration},this.p.set(e.id,e),this.v.push(e)),this.v.sort((t,n)=>n.k-t.k),this.v.length>10){const t=this.v.splice(10);for(const n of t)this.p.delete(n.id)}this.M?.(e)}}}const W=t=>{const n=\"requestIdleCallback\"in globalThis?1e3:0,e=globalThis.requestIdleCallback||setTimeout,o=globalThis.cancelIdleCallback||clearTimeout;if(\"hidden\"===document.visibilityState)t();else{const i=E(t);let a=-1;const r=()=>{o(a),i()};addEventListener(\"visibilitychange\",r,{once:!0,capture:!0}),a=e(()=>{removeEventListener(\"visibilitychange\",r,{capture:!0}),i()},{timeout:n})}},x=[200,500],R=(t,n={})=>{const o=r(n=Object.assign({},n),q);let a=[],s=[],u=0;const d=new WeakMap,h=new WeakMap;let g=!1;const v=()=>{g||(W(p),g=!0)},p=()=>{const t=new Set(o.v.map(t=>d.get(t.entries[0]))),n=s.length-10;s=s.filter((e,o)=>o>=n||t.has(e));const e=new Set;for(const t of s){const n=T(t.startTime,t.processingEnd);for(const t of n)e.add(t)}a=a.filter(t=>t.startTime>u||e.has(t)),g=!1};o.m=t=>{const e=t.startTime+t.duration;let o;u=Math.max(u,t.processingEnd);for(let i=s.length-1;i>=0;i--){const a=s[i];if(Math.abs(e-a.renderTime)<=8){o=a,o.startTime=Math.min(t.startTime,o.startTime),o.processingStart=Math.min(t.processingStart,o.processingStart),o.processingEnd=Math.max(t.processingEnd,o.processingEnd),n.includeProcessedEventEntries&&o.entries.push(t);break}}o||(o={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:e,entries:n.includeProcessedEventEntries?[t]:[]},s.push(o)),t.interactionId&&d.set(t,o),v()},o.M=t=>{if(!h.get(t)){const e=t.entries.find(t=>t.target)?.target;if(e){const o=n.generateTarget?.(e)??i(e);h.set(t,o)}else{const n=t.entries.find(t=>t.targetSelector)?.targetSelector;n&&h.set(t,n)}}};const T=(t,n)=>{const e=[];for(const o of a)if(!(o.startTime+o.duration<t)){if(o.startTime>n)break;e.push(o)}return e},E=t=>{if(0===t.entries.length){const n=t.navigationStartTime||0,o={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:e(n)};return Object.assign(t,{attribution:o})}const n=t.entries[0],i=d.get(n),a=Math.max(i.processingStart,n.startTime),r=Math.max(n.startTime+n.duration,a),s=Math.min(i.processingEnd,r),c=i.entries.sort((t,n)=>t.processingStart-n.processingStart),f=T(n.startTime,s),l=o.p.get(n.interactionId),u={interactionTarget:h.get(l),interactionType:n.name.startsWith(\"key\")?\"keyboard\":\"pointer\",interactionTime:n.startTime,nextPaintTime:r,processedEventEntries:c,longAnimationFrameEntries:f,inputDelay:a-n.startTime,processingDuration:s-a,presentationDelay:r-s,loadState:e(n.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{const n=t.interactionTime,e=t.nextPaintTime;if(!t.longAnimationFrameEntries?.length||!n||!e)return;const o=t.inputDelay,i=t.processingDuration;let a,r,s=0,c=0,f=0,l=0;for(const e of t.longAnimationFrameEntries){c=c+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(e<n)continue;const f=e-Math.max(n,t.startTime),u=t.duration?f/t.duration*t.forcedStyleAndLayoutDuration:0;s+=f-u,c+=u,f>l&&(r=t.startTime<n+o?\"input-delay\":t.startTime>=n+o+i?\"presentation-delay\":\"processing-duration\",a=t,l=f)}}const u=t.longAnimationFrameEntries.at(-1),d=u?u.startTime+u.duration:0;d>=n+o+i&&(f=e-d),a&&r&&(t.longestScript={entry:a,subpart:r,intersectingDuration:l}),t.totalScriptDuration=s,t.totalStyleAndLayoutDuration=c,t.totalPaintDuration=f,t.totalUnattributedDuration=e-n-s-c-f})(u),Object.assign(t,{attribution:u})};b([\"long-animation-frame\"],t=>{a=a.concat(t),v()},n),((t,n={})=>{if(!globalThis.PerformanceEventTiming||!(\"interactionId\"in PerformanceEventTiming.prototype))return;const e=m();w(()=>{N();let o,i=y(\"INP\");const a=r(n,q),s=(e,r,s,c,f)=>{a.D(),i=y(\"INP\",-1,e,r,s,c,f),o=l(t,i,x,n.reportAllChanges)},u=()=>{const t=a.S(i.navigationType);t&&t.k!==i.value&&(i.value=t.k,i.entries=t.entries,o())},d=t=>{u(),o(!0),s(\"soft-navigation\",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,n=!1)=>{W(()=>{for(const n of t)\"soft-navigation\"!==n.entryType?a.l(n):d(n);u(),n&&o(!0)})},g=[\"event\",\"first-input\"];M(n)&&g.push(\"soft-navigation\");const v=b(g,h,{...n,durationThreshold:n.durationThreshold??40});o=l(t,i,x,n.reportAllChanges),v&&(e.onHidden(()=>{h(v.takeRecords(),!0)}),f(()=>{s(\"back-forward-cache\",i.navigationId,i.navigationInteractionId,i.navigationURL,c())}))})})(n=>{t(E(n))},n)};class U{m;u;l(t){this.m?.(t)}}const $=[2500,4e3];let H=50;const V=[];b([\"resource\"],t=>{for(const n of t)V.push(n),V.length>H&&V.shift()});const z=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(H=e.resourceBufferSize);const o=r(e,U),a=new WeakMap;M(e)&&(o.u=new Map),o.m=t=>{const n=t.element;if(n){const o=e.generateTarget?.(n)??i(n);a.set(t,o)}else t.id&&a.set(t,`#${t.id}`)};((t,n={})=>{let e=!1;const o=M(n);w(()=>{let i,a=m(),s=y(\"LCP\");const h=r(n,U),g=(o,r,c,f,u)=>{s=y(\"LCP\",-1,o,r,c,f,u),i=l(t,s,$,n.reportAllChanges),e=!1,\"soft-navigation\"===o&&(a=m(!0))},v=t=>{h.u&&t.navigationId&&T(h.u,t),e||i(!0),g(\"soft-navigation\",t.navigationId,t.interactionId,t.name,t.startTime);const n=t.getLargestInteractionContentfulPaint?.();n&&p([n])},p=t=>{n.reportAllChanges||o||(t=t.slice(-1));for(const n of t){if(!n)continue;if(\"soft-navigation\"===n.entryType){v(n);continue}let t=0,e=[],o=n.startTime;if(\"largest-contentful-paint\"===n.entryType)t=Math.max(n.startTime-d(),0),h.l(n),e=[n];else if(\"interaction-contentful-paint\"===n.entryType){const i=n;if(!s.navigationId)continue;if(\"interactionId\"in i&&i.interactionId!=s.navigationInteractionId)continue;o=i.largestContentfulPaint?.renderTime||0,t=Math.max(o-n.startTime,0),i.largestContentfulPaint&&(h.l(i.largestContentfulPaint),e=[i.largestContentfulPaint])}o<a.firstHiddenTime&&(s.value=t,s.entries=e,i())}},M=[\"largest-contentful-paint\"];o&&M.push(\"interaction-contentful-paint\",\"soft-navigation\");const E=b(M,p);if(E){i=l(t,s,$,n.reportAllChanges);const a=[\"keydown\",\"click\",\"visibilitychange\"],r=t=>{if(t.isTrusted&&!e){const t=s.id;W(()=>{if(!e){if(!o){E.disconnect();for(const t of a)removeEventListener(t,r,{capture:!0})}t===s.id&&(e=!0,i(!0))}})}};for(const t of a)addEventListener(t,r,{capture:!0});f(o=>{g(\"back-forward-cache\",s.navigationId,s.navigationInteractionId,s.navigationURL,c()),i=l(t,s,$,n.reportAllChanges),u(()=>{s.value=performance.now()-o.timeStamp,e=!0,i(!0)})})}})})(e=>{t((t=>{let e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){const i=t.entries.at(-1),r=i.url&&(V.findLast(t=>t.name===i.url)||performance.getEntriesByType(\"resource\").findLast(t=>t.name===i.url));let s;e.target=a.get(i),e.lcpEntry=i,i.url&&(e.url=i.url),r&&(e.lcpResourceEntry=r);let c=0,f=0;if(\"soft-navigation\"!==t.navigationType?(s=n(),c=s?.activationStart??0,f=s?.responseStart??0):(c=t.navigationStartTime||0,s=o.u?.get(t.navigationId)),s){const n=Math.max(0,f-c),o=Math.max(n,r?(r.requestStart||r.startTime)-c:0),i=Math.min(t.value,Math.max(o,r?r.responseEnd-c:0));e={...e,timeToFirstByte:n,resourceLoadDelay:o-n,resourceLoadDuration:i-o,elementRenderDelay:t.value-i,navigationEntry:s}}}return Object.assign(t,{attribution:e})})(e))},e)},G=[800,1800],J=t=>{document.prerendering?w(()=>J(t)):\"complete\"!==document.readyState?addEventListener(\"load\",()=>J(t),!0):setTimeout(t)},K=(t,e={})=>{((t,e={})=>{const o=M(e);let i=y(\"TTFB\"),a=l(t,i,G,e.reportAllChanges);J(()=>{const r=n();if(r){const n=r.responseStart;i.value=Math.max(n-d(),0),i.entries=[r],a(!0),f(()=>{i=y(\"TTFB\",0,\"back-forward-cache\",i.navigationId,i.navigationInteractionId,i.navigationURL,c()),a=l(t,i,G,e.reportAllChanges),a(!0)}),o&&b([\"soft-navigation\"],n=>{n.forEach(n=>{n.navigationId&&(i=y(\"TTFB\",0,\"soft-navigation\",n.navigationId,n.interactionId,n.name,n.startTime),i.entries=[n],a=l(t,i,G,e.reportAllChanges),a(!0))})},e)}})})(n=>{t((t=>{const n=t.entries[0];let e={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0,navigationEntry:n};if(t.entries.length&&n instanceof PerformanceNavigationTiming){const o=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart||0)-o,0),a=Math.max(n.domainLookupStart-o,0),r=Math.max(n.connectStart-o,0),s=Math.max(n.connectEnd-o,0);e={waitingDuration:i,cacheDuration:a-i,dnsDuration:r-a,connectionDuration:s-r,requestDuration:t.value-s,navigationEntry:n}}return Object.assign(t,{attribution:e})})(n))},e)};export{L as CLSThresholds,S as FCPThresholds,x as INPThresholds,$ as LCPThresholds,G as TTFBThresholds,F as onCLS,_ as onFCP,R as onINP,z as onLCP,K as onTTFB};\n//# sourceMappingURL=web-vitals.attribution.js.map\n"],"names":["t","n","e","o","i","a","r","s","c","f","l","u","d","h","g","v","p","m","y","b","M","T","E","D","w","S","k","L","P","F","_","C","I","B","O","j","A","N","q","W","x","R","U","$","H","V","z","G","J","K"],"mappings":"AAAA,MAAMA,GAAC;AAAA,EAAC;AAAA,EAAE,IAAE;AAAA,EAAE,IAAE;EAAG,EAAE,GAAE;AAAC,QAAG,EAAE,eAAe;AAAO,UAAMC,IAAE,KAAK,EAAE,CAAC,GAAEC,IAAE,KAAK,EAAE,GAAG,EAAE;AAAE,SAAK,KAAGD,KAAGC,KAAG,EAAE,YAAUA,EAAE,YAAU,OAAK,EAAE,YAAUD,EAAE,YAAU,OAAK,KAAK,KAAG,EAAE,OAAM,KAAK,EAAE,KAAK,CAAC,MAAI,KAAK,IAAE,EAAE,OAAM,KAAK,IAAE,CAAC,CAAC,IAAG,KAAK,IAAI,CAAC;AAAA,EAAC;AAAC;AAAC,MAAMA,IAAE,MAAI;AAAC,QAAMD,IAAE,YAAY,iBAAiB,YAAY,EAAE,CAAC;AAAE,MAAGA,KAAGA,EAAE,gBAAc,KAAGA,EAAE,gBAAc,YAAY,IAAG,EAAG,QAAOA;AAAC,GAAEE,IAAE,CAAAF,MAAG;AA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AAIE,IAAE,EAAC,iBAAgB,GAAE,eAAc,GAAE,aAAY,GAAE,oBAAmB,GAAE,iBAAgB,GAAE,iBAAgBD,EAAC;AAAE,UAAGD,EAAE,QAAQ,UAAQC,aAAa,6BAA4B;AAAC,cAAME,IAAEF,EAAE,mBAAiB,GAAEG,IAAE,KAAK,KAAKH,EAAE,eAAaA,EAAE,cAAY,KAAGE,GAAE,CAAC,GAAEE,IAAE,KAAK,IAAIJ,EAAE,oBAAkBE,GAAE,CAAC,GAAEG,IAAE,KAAK,IAAIL,EAAE,eAAaE,GAAE,CAAC,GAAEI,IAAE,KAAK,IAAIN,EAAE,aAAWE,GAAE,CAAC;AAAE,QAAAD,IAAE,EAAC,iBAAgBE,GAAE,eAAcC,IAAED,GAAE,aAAYE,IAAED,GAAE,oBAAmBE,IAAED,GAAE,iBAAgBN,EAAE,QAAMO,GAAE,iBAAgBN,EAAC;AAAA,MAAC;AAAC,aAAO,OAAO,OAAOD,GAAE,EAAC,aAAYE,EAAC,CAAC;AAAA,IAAC,GAAGD,CAAC,CAAC;AAAA,EAAC,GAAEC,CAAC;AAAC;","x_google_ignoreList":[0]}
@@ -0,0 +1,63 @@
1
+ import { d as c } from "./memoryStore-F5I-GQKM.js";
2
+ import { webStore as w } from "./store.web-DJAlN0nc.js";
3
+ import { D as h, F as o, d as u, b as m, a as p, e as b } from "./batch-CwoO7noL.js";
4
+ function d(t, a) {
5
+ const r = u(t.get(o)), { json: n, dropped: e } = b(r, a);
6
+ return t.set(o, n).status === "unavailable" && c.warn("Telemetry could not persist failed events: storage unavailable"), e;
7
+ }
8
+ function g(t) {
9
+ const a = t.get(o);
10
+ return a.status === "hit" && t.remove(o), u(a);
11
+ }
12
+ async function l(t, a, r, n = 3) {
13
+ let e = 0, i;
14
+ for (; e < n; )
15
+ try {
16
+ const s = await fetch(t, {
17
+ method: "POST",
18
+ headers: p(a),
19
+ body: m(r),
20
+ keepalive: !0
21
+ });
22
+ if (!s.ok)
23
+ throw new Error(`Telemetry send failed: ${s.status}`);
24
+ return;
25
+ } catch (s) {
26
+ i = s, e++, e < n && await new Promise((f) => setTimeout(f, e * 500));
27
+ }
28
+ throw i;
29
+ }
30
+ function T(t = h, a, r = w(), n = 3) {
31
+ return {
32
+ async send(e) {
33
+ await l(t, a, e, n);
34
+ },
35
+ async onFailure(e) {
36
+ return d(r, e);
37
+ },
38
+ // Web had no replay hook at all and no caller for its standalone twin, so the
39
+ // queue only ever grew (#113). Same single path as native now: core calls this
40
+ // once per launch from its constructor.
41
+ //
42
+ // No `guardedDrain()` here, unlike native, and the store's SYNC guarantee is
43
+ // exactly why: `takeFailed()` has cleared the key before this function first
44
+ // yields, so a second concurrent caller reads a miss and returns. The race the
45
+ // guard exists for cannot be constructed on a `SyncStore` — and a guard whose
46
+ // bucket is permanently empty is eventually read as one that is working.
47
+ async replayFailed() {
48
+ const e = g(r);
49
+ if (e.length !== 0) {
50
+ c.log("Replaying failed events, count:", e.length);
51
+ try {
52
+ await l(t, a, e, n);
53
+ } catch (i) {
54
+ throw d(r, e), i;
55
+ }
56
+ }
57
+ }
58
+ };
59
+ }
60
+ export {
61
+ T as webSender
62
+ };
63
+ //# sourceMappingURL=webSender-BIwslfpT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webSender-BIwslfpT.js","sources":["../src/adapters/webSender.ts"],"sourcesContent":["import { debug } from \"../core/debug\";\nimport type { TelemetryEvent, Sender } from \"../core/telemetry\";\nimport type { SyncStore } from \"../core/store\";\nimport { webStore } from \"./web/store.web\";\nimport { decodeFailed, encodeFailed, FAILED_EVENTS_KEY } from \"./failedEvents\";\nimport { buildBatch, buildHeaders, DEFAULT_ENDPOINT } from \"./batch\";\n\n// The offline queue goes through the Store port (#89), and on web it stays SYNCHRONOUS\n// on purpose. onFailure() runs on the unload path; a synchronous set() has landed before\n// the function returns, which is what closes the crash-loss window here rather than\n// merely narrowing it. Do not make these helpers async.\n// Returns how many rows the §9.4 cap evicted, for core's `sdk.events_dropped`.\nfunction persistFailed(store: SyncStore, events: TelemetryEvent[]): number {\n const existing = decodeFailed(store.get(FAILED_EVENTS_KEY));\n const { json, dropped } = encodeFailed(existing, events);\n const written = store.set(FAILED_EVENTS_KEY, json);\n // Storage refusing (incognito, quota, partitioned iframe) is an outcome, not an error:\n // the batch is already lost, and throwing here would only lose the next one too.\n if (written.status === \"unavailable\") {\n debug.warn(\"Telemetry could not persist failed events: storage unavailable\");\n }\n return dropped;\n}\n\n// Read the queue and clear it in one step, so a replay that fails again re-persists\n// rather than double-sending on the next launch.\nfunction takeFailed(store: SyncStore): TelemetryEvent[] {\n const read = store.get(FAILED_EVENTS_KEY);\n // Clear on any hit, including a payload that decoded to nothing: a half-written queue\n // is unreplayable, and keying the removal off the decoded length would make it\n // permanent as well — re-read and re-dropped on every launch, forever.\n if (read.status === \"hit\") store.remove(FAILED_EVENTS_KEY);\n return decodeFailed(read);\n}\n\n// Try sending a batch with retries + backoff.\n// v3 uses fetch({ keepalive: true }) rather than navigator.sendBeacon: the beacon\n// API cannot set the required credential headers. keepalive preserves the\n// survives-page-unload property we relied on sendBeacon for.\nasync function sendWithRetry(endpoint: string, apiKey: string | undefined, events: TelemetryEvent[], retryCount: number = 3) {\n let attempts = 0;\n let lastError: any;\n\n while (attempts < retryCount) {\n try {\n const res = await fetch(endpoint, {\n method: \"POST\",\n headers: buildHeaders(apiKey),\n body: buildBatch(events),\n keepalive: true,\n });\n\n if (!res.ok) {\n throw new Error(`Telemetry send failed: ${res.status}`);\n }\n\n return; // ✅ success\n } catch (err) {\n lastError = err;\n attempts++;\n if (attempts < retryCount) {\n await new Promise(res => setTimeout(res, attempts * 500)); // backoff\n }\n }\n }\n\n // ❌ after retries still failed\n throw lastError;\n}\n\nexport function webSender(\n endpoint: string = DEFAULT_ENDPOINT,\n apiKey?: string,\n store: SyncStore = webStore(),\n retryCount: number = 3,\n): Sender {\n return {\n async send(events: TelemetryEvent[]) {\n // Retry + backoff here; persistence on final failure is the core flush()'s\n // job via onFailure() — kept single, so a failed batch isn't persisted twice.\n await sendWithRetry(endpoint, apiKey, events, retryCount);\n },\n async onFailure(events: TelemetryEvent[]) {\n return persistFailed(store, events);\n },\n // Web had no replay hook at all and no caller for its standalone twin, so the\n // queue only ever grew (#113). Same single path as native now: core calls this\n // once per launch from its constructor.\n //\n // No `guardedDrain()` here, unlike native, and the store's SYNC guarantee is\n // exactly why: `takeFailed()` has cleared the key before this function first\n // yields, so a second concurrent caller reads a miss and returns. The race the\n // guard exists for cannot be constructed on a `SyncStore` — and a guard whose\n // bucket is permanently empty is eventually read as one that is working.\n async replayFailed() {\n const stored = takeFailed(store);\n if (stored.length === 0) return;\n debug.log(\"Replaying failed events, count:\", stored.length);\n try {\n await sendWithRetry(endpoint, apiKey, stored, retryCount);\n } catch (err) {\n // If replay fails again, re-persist. Exactly one copy: this path never\n // goes through core's flush(), so onFailure() does not also persist it.\n persistFailed(store, stored);\n throw err;\n }\n },\n };\n}\n"],"names":["persistFailed","store","events","existing","decodeFailed","FAILED_EVENTS_KEY","json","dropped","encodeFailed","debug","takeFailed","read","sendWithRetry","endpoint","apiKey","retryCount","attempts","lastError","res","buildHeaders","buildBatch","err","webSender","DEFAULT_ENDPOINT","webStore","stored"],"mappings":";;;AAYA,SAASA,EAAcC,GAAkBC,GAAkC;AACvE,QAAMC,IAAWC,EAAaH,EAAM,IAAII,CAAiB,CAAC,GACpD,EAAE,MAAAC,GAAM,SAAAC,EAAA,IAAYC,EAAaL,GAAUD,CAAM;AAIvD,SAHgBD,EAAM,IAAII,GAAmBC,CAAI,EAGrC,WAAW,iBACnBG,EAAM,KAAK,gEAAgE,GAExEF;AACX;AAIA,SAASG,EAAWT,GAAoC;AACpD,QAAMU,IAAOV,EAAM,IAAII,CAAiB;AAIxC,SAAIM,EAAK,WAAW,SAAOV,EAAM,OAAOI,CAAiB,GAClDD,EAAaO,CAAI;AAC5B;AAMA,eAAeC,EAAcC,GAAkBC,GAA4BZ,GAA0Ba,IAAqB,GAAG;AACzH,MAAIC,IAAW,GACXC;AAEJ,SAAOD,IAAWD;AACd,QAAI;AACA,YAAMG,IAAM,MAAM,MAAML,GAAU;AAAA,QAC9B,QAAQ;AAAA,QACR,SAASM,EAAaL,CAAM;AAAA,QAC5B,MAAMM,EAAWlB,CAAM;AAAA,QACvB,WAAW;AAAA,MAAA,CACd;AAED,UAAI,CAACgB,EAAI;AACL,cAAM,IAAI,MAAM,0BAA0BA,EAAI,MAAM,EAAE;AAG1D;AAAA,IACJ,SAASG,GAAK;AACV,MAAAJ,IAAYI,GACZL,KACIA,IAAWD,KACX,MAAM,IAAI,QAAQ,CAAAG,MAAO,WAAWA,GAAKF,IAAW,GAAG,CAAC;AAAA,IAEhE;AAIJ,QAAMC;AACV;AAEO,SAASK,EACZT,IAAmBU,GACnBT,GACAb,IAAmBuB,EAAA,GACnBT,IAAqB,GACf;AACN,SAAO;AAAA,IACH,MAAM,KAAKb,GAA0B;AAGjC,YAAMU,EAAcC,GAAUC,GAAQZ,GAAQa,CAAU;AAAA,IAC5D;AAAA,IACA,MAAM,UAAUb,GAA0B;AACtC,aAAOF,EAAcC,GAAOC,CAAM;AAAA,IACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUA,MAAM,eAAe;AACjB,YAAMuB,IAASf,EAAWT,CAAK;AAC/B,UAAIwB,EAAO,WAAW,GACtB;AAAA,QAAAhB,EAAM,IAAI,mCAAmCgB,EAAO,MAAM;AAC1D,YAAI;AACA,gBAAMb,EAAcC,GAAUC,GAAQW,GAAQV,CAAU;AAAA,QAC5D,SAASM,GAAK;AAGV,gBAAArB,EAAcC,GAAOwB,CAAM,GACrBJ;AAAA,QACV;AAAA;AAAA,IACJ;AAAA,EAAA;AAER;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./memoryStore-BIGZmmfD.cjs"),E=require("./store.web-CvqqN-_Z.cjs"),r=require("./batch-DNu8Xr9T.cjs");function d(t,n){const a=r.decodeFailed(t.get(r.FAILED_EVENTS_KEY)),{json:i,dropped:e}=r.encodeFailed(a,n);return t.set(r.FAILED_EVENTS_KEY,i).status==="unavailable"&&c.debug.warn("Telemetry could not persist failed events: storage unavailable"),e}function w(t){const n=t.get(r.FAILED_EVENTS_KEY);return n.status==="hit"&&t.remove(r.FAILED_EVENTS_KEY),r.decodeFailed(n)}async function l(t,n,a,i=3){let e=0,s;for(;e<i;)try{const o=await fetch(t,{method:"POST",headers:r.buildHeaders(n),body:r.buildBatch(a),keepalive:!0});if(!o.ok)throw new Error(`Telemetry send failed: ${o.status}`);return}catch(o){s=o,e++,e<i&&await new Promise(u=>setTimeout(u,e*500))}throw s}function h(t=r.DEFAULT_ENDPOINT,n,a=E.webStore(),i=3){return{async send(e){await l(t,n,e,i)},async onFailure(e){return d(a,e)},async replayFailed(){const e=w(a);if(e.length!==0){c.debug.log("Replaying failed events, count:",e.length);try{await l(t,n,e,i)}catch(s){throw d(a,e),s}}}}}exports.webSender=h;
2
+ //# sourceMappingURL=webSender-CVtE4sOF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webSender-CVtE4sOF.cjs","sources":["../src/adapters/webSender.ts"],"sourcesContent":["import { debug } from \"../core/debug\";\nimport type { TelemetryEvent, Sender } from \"../core/telemetry\";\nimport type { SyncStore } from \"../core/store\";\nimport { webStore } from \"./web/store.web\";\nimport { decodeFailed, encodeFailed, FAILED_EVENTS_KEY } from \"./failedEvents\";\nimport { buildBatch, buildHeaders, DEFAULT_ENDPOINT } from \"./batch\";\n\n// The offline queue goes through the Store port (#89), and on web it stays SYNCHRONOUS\n// on purpose. onFailure() runs on the unload path; a synchronous set() has landed before\n// the function returns, which is what closes the crash-loss window here rather than\n// merely narrowing it. Do not make these helpers async.\n// Returns how many rows the §9.4 cap evicted, for core's `sdk.events_dropped`.\nfunction persistFailed(store: SyncStore, events: TelemetryEvent[]): number {\n const existing = decodeFailed(store.get(FAILED_EVENTS_KEY));\n const { json, dropped } = encodeFailed(existing, events);\n const written = store.set(FAILED_EVENTS_KEY, json);\n // Storage refusing (incognito, quota, partitioned iframe) is an outcome, not an error:\n // the batch is already lost, and throwing here would only lose the next one too.\n if (written.status === \"unavailable\") {\n debug.warn(\"Telemetry could not persist failed events: storage unavailable\");\n }\n return dropped;\n}\n\n// Read the queue and clear it in one step, so a replay that fails again re-persists\n// rather than double-sending on the next launch.\nfunction takeFailed(store: SyncStore): TelemetryEvent[] {\n const read = store.get(FAILED_EVENTS_KEY);\n // Clear on any hit, including a payload that decoded to nothing: a half-written queue\n // is unreplayable, and keying the removal off the decoded length would make it\n // permanent as well — re-read and re-dropped on every launch, forever.\n if (read.status === \"hit\") store.remove(FAILED_EVENTS_KEY);\n return decodeFailed(read);\n}\n\n// Try sending a batch with retries + backoff.\n// v3 uses fetch({ keepalive: true }) rather than navigator.sendBeacon: the beacon\n// API cannot set the required credential headers. keepalive preserves the\n// survives-page-unload property we relied on sendBeacon for.\nasync function sendWithRetry(endpoint: string, apiKey: string | undefined, events: TelemetryEvent[], retryCount: number = 3) {\n let attempts = 0;\n let lastError: any;\n\n while (attempts < retryCount) {\n try {\n const res = await fetch(endpoint, {\n method: \"POST\",\n headers: buildHeaders(apiKey),\n body: buildBatch(events),\n keepalive: true,\n });\n\n if (!res.ok) {\n throw new Error(`Telemetry send failed: ${res.status}`);\n }\n\n return; // ✅ success\n } catch (err) {\n lastError = err;\n attempts++;\n if (attempts < retryCount) {\n await new Promise(res => setTimeout(res, attempts * 500)); // backoff\n }\n }\n }\n\n // ❌ after retries still failed\n throw lastError;\n}\n\nexport function webSender(\n endpoint: string = DEFAULT_ENDPOINT,\n apiKey?: string,\n store: SyncStore = webStore(),\n retryCount: number = 3,\n): Sender {\n return {\n async send(events: TelemetryEvent[]) {\n // Retry + backoff here; persistence on final failure is the core flush()'s\n // job via onFailure() — kept single, so a failed batch isn't persisted twice.\n await sendWithRetry(endpoint, apiKey, events, retryCount);\n },\n async onFailure(events: TelemetryEvent[]) {\n return persistFailed(store, events);\n },\n // Web had no replay hook at all and no caller for its standalone twin, so the\n // queue only ever grew (#113). Same single path as native now: core calls this\n // once per launch from its constructor.\n //\n // No `guardedDrain()` here, unlike native, and the store's SYNC guarantee is\n // exactly why: `takeFailed()` has cleared the key before this function first\n // yields, so a second concurrent caller reads a miss and returns. The race the\n // guard exists for cannot be constructed on a `SyncStore` — and a guard whose\n // bucket is permanently empty is eventually read as one that is working.\n async replayFailed() {\n const stored = takeFailed(store);\n if (stored.length === 0) return;\n debug.log(\"Replaying failed events, count:\", stored.length);\n try {\n await sendWithRetry(endpoint, apiKey, stored, retryCount);\n } catch (err) {\n // If replay fails again, re-persist. Exactly one copy: this path never\n // goes through core's flush(), so onFailure() does not also persist it.\n persistFailed(store, stored);\n throw err;\n }\n },\n };\n}\n"],"names":["persistFailed","store","events","existing","decodeFailed","FAILED_EVENTS_KEY","json","dropped","encodeFailed","debug","takeFailed","read","sendWithRetry","endpoint","apiKey","retryCount","attempts","lastError","res","buildHeaders","buildBatch","err","webSender","DEFAULT_ENDPOINT","webStore","stored"],"mappings":"sMAYA,SAASA,EAAcC,EAAkBC,EAAkC,CACvE,MAAMC,EAAWC,EAAAA,aAAaH,EAAM,IAAII,EAAAA,iBAAiB,CAAC,EACpD,CAAE,KAAAC,EAAM,QAAAC,CAAA,EAAYC,EAAAA,aAAaL,EAAUD,CAAM,EAIvD,OAHgBD,EAAM,IAAII,EAAAA,kBAAmBC,CAAI,EAGrC,SAAW,eACnBG,EAAAA,MAAM,KAAK,gEAAgE,EAExEF,CACX,CAIA,SAASG,EAAWT,EAAoC,CACpD,MAAMU,EAAOV,EAAM,IAAII,mBAAiB,EAIxC,OAAIM,EAAK,SAAW,OAAOV,EAAM,OAAOI,EAAAA,iBAAiB,EAClDD,EAAAA,aAAaO,CAAI,CAC5B,CAMA,eAAeC,EAAcC,EAAkBC,EAA4BZ,EAA0Ba,EAAqB,EAAG,CACzH,IAAIC,EAAW,EACXC,EAEJ,KAAOD,EAAWD,GACd,GAAI,CACA,MAAMG,EAAM,MAAM,MAAML,EAAU,CAC9B,OAAQ,OACR,QAASM,EAAAA,aAAaL,CAAM,EAC5B,KAAMM,EAAAA,WAAWlB,CAAM,EACvB,UAAW,EAAA,CACd,EAED,GAAI,CAACgB,EAAI,GACL,MAAM,IAAI,MAAM,0BAA0BA,EAAI,MAAM,EAAE,EAG1D,MACJ,OAASG,EAAK,CACVJ,EAAYI,EACZL,IACIA,EAAWD,GACX,MAAM,IAAI,QAAQG,GAAO,WAAWA,EAAKF,EAAW,GAAG,CAAC,CAEhE,CAIJ,MAAMC,CACV,CAEO,SAASK,EACZT,EAAmBU,EAAAA,iBACnBT,EACAb,EAAmBuB,WAAA,EACnBT,EAAqB,EACf,CACN,MAAO,CACH,MAAM,KAAKb,EAA0B,CAGjC,MAAMU,EAAcC,EAAUC,EAAQZ,EAAQa,CAAU,CAC5D,EACA,MAAM,UAAUb,EAA0B,CACtC,OAAOF,EAAcC,EAAOC,CAAM,CACtC,EAUA,MAAM,cAAe,CACjB,MAAMuB,EAASf,EAAWT,CAAK,EAC/B,GAAIwB,EAAO,SAAW,EACtBhB,CAAAA,EAAAA,MAAM,IAAI,kCAAmCgB,EAAO,MAAM,EAC1D,GAAI,CACA,MAAMb,EAAcC,EAAUC,EAAQW,EAAQV,CAAU,CAC5D,OAASM,EAAK,CAGV,MAAArB,EAAcC,EAAOwB,CAAM,EACrBJ,CACV,EACJ,CAAA,CAER"}
@@ -0,0 +1,85 @@
1
+ const n = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, o = (e) => typeof e == "string" && e !== "" ? e : void 0;
2
+ function d(e) {
3
+ return o(e.target) ?? o(e.largestShiftTarget) ?? o(e.interactionTarget);
4
+ }
5
+ function u(e) {
6
+ return e === void 0 ? void 0 : e.split("?")[0];
7
+ }
8
+ function p(e) {
9
+ const t = e.attribution ?? {}, a = {
10
+ "vital.rating": e.rating,
11
+ // ⚠ Load-bearing, not decoration: a `back-forward-cache` LCP is ~0 ms and will
12
+ // silently drag a p75 down if the population is not separable.
13
+ "vital.navigation_type": e.navigationType
14
+ }, s = d(t);
15
+ s !== void 0 && (a["vital.target"] = s);
16
+ const l = o(t.loadState);
17
+ l !== void 0 && (a["vital.load_state"] = l);
18
+ const r = (c, i) => {
19
+ i !== void 0 && (a[c] = i);
20
+ };
21
+ switch (e.name) {
22
+ case "LCP":
23
+ r("lcp.time_to_first_byte", n(t.timeToFirstByte)), r("lcp.resource_load_delay", n(t.resourceLoadDelay)), r("lcp.resource_load_duration", n(t.resourceLoadDuration)), r("lcp.element_render_delay", n(t.elementRenderDelay)), r("lcp.url", u(o(t.url)));
24
+ break;
25
+ case "INP":
26
+ r("inp.input_delay", n(t.inputDelay)), r("inp.processing_duration", n(t.processingDuration)), r("inp.presentation_delay", n(t.presentationDelay)), r("inp.interaction_type", o(t.interactionType));
27
+ break;
28
+ case "CLS":
29
+ r("cls.largest_shift_value", n(t.largestShiftValue));
30
+ break;
31
+ }
32
+ return a;
33
+ }
34
+ class h {
35
+ constructor(t) {
36
+ this.telemetry = t, this.held = /* @__PURE__ */ new Map(), this.emitted = /* @__PURE__ */ new Map(), this.started = !1;
37
+ }
38
+ /**
39
+ * Idempotent: a second call must not double-subscribe and double every vital row.
40
+ *
41
+ * LCP, FCP and TTFB fire once on the initial load, so they emit straight from the callback.
42
+ *
43
+ * ⚠ **CLS and INP subscribe with `reportAllChanges: true` as a running-value subscription,
44
+ * not an emission trigger.** The latest value is held in memory and shipped at the
45
+ * `ViewManager`'s background boundary — the library's default page-hide report loses both
46
+ * on a closed tab, because that report races the document's own teardown.
47
+ *
48
+ * ⚠ **All five are page-load-scoped, not view-scoped.** `LCP`, `FCP` and `TTFB` physically
49
+ * cannot recur on a soft navigation, so `view.id` on a vital row is always the *initial*
50
+ * view's. It is a real join key, it is just not "the view this happened in" for CLS and INP:
51
+ * `GROUP BY view.name` over vitals reads **"by entry point"**. Documented, not engineered
52
+ * around — view-scoping would need the Chrome-only Soft Navigations API.
53
+ */
54
+ async start() {
55
+ if (this.started) return;
56
+ this.started = !0;
57
+ const { onLCP: t, onFCP: a, onTTFB: s, onCLS: l, onINP: r } = await import("./web-vitals.attribution-xw9N5MKQ.js");
58
+ t((i) => void this.emit(i)), a((i) => void this.emit(i)), s((i) => void this.emit(i));
59
+ const c = (i) => {
60
+ this.held.set(i.name, i);
61
+ };
62
+ l(c, { reportAllChanges: !0 }), r(c, { reportAllChanges: !0 }), this.telemetry.views.onBoundary((i) => i === "resume" ? this.drain() : void 0);
63
+ }
64
+ /**
65
+ * Awaited inside `beginView` while the departing view is still current, so the rows carry
66
+ * the view they were accumulated under. A name whose running value has not moved since its
67
+ * last row is skipped — a tab hidden twice with no shifts in between is not two CLS
68
+ * samples, and the library's own report has the same no-delta-no-report property.
69
+ *
70
+ * Keying on `value` alone is exact for both held vitals, not a shortcut: CLS is cumulative,
71
+ * so *any* shift moves it, and INP only changes when a worse interaction happens. An
72
+ * unchanged value therefore means the attribution is unchanged too.
73
+ */
74
+ async drain() {
75
+ for (const [t, a] of this.held)
76
+ this.emitted.get(t) !== a.value && (this.emitted.set(t, a.value), await this.emit(a));
77
+ }
78
+ emit(t) {
79
+ return this.telemetry.logMetric(t.name, t.value, p(t));
80
+ }
81
+ }
82
+ export {
83
+ h as WebVitalsTracker
84
+ };
85
+ //# sourceMappingURL=webVitals.web-CNIpsKlA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webVitals.web-CNIpsKlA.js","sources":["../src/adapters/webVitals.ts","../src/adapters/web/webVitals.web.ts"],"sourcesContent":["// §5.3's attribute shaping for the five Core Web Vitals — the pure half, so the rules are\n// unit-tested against plain objects and the `.web.ts` half is left with nothing but the\n// library subscription. Shared-file, but web-only in practice: `TelemetryNative` never\n// imports it, which is what keeps `web-vitals` out of the native bundle entirely.\n\n/** The five names. All are already on `ALLOWED_NAMES`, and all ride the **metric** path. */\nexport type VitalName = \"LCP\" | \"FCP\" | \"CLS\" | \"INP\" | \"TTFB\";\n\n/**\n * Structurally typed against `web-vitals/attribution`'s metric, so this module compiles and\n * tests without the library and cannot pull it into a shared import graph.\n */\nexport type VitalMetric = {\n name: string;\n value: number;\n rating: string;\n navigationType: string;\n // `any`, not `unknown`: `web-vitals`' concrete `LCPAttribution` &c. have no index\n // signature, so a `Record<string, unknown>` here rejects every one of them at the\n // subscription. Everything downstream of this field is read through `num`/`str`.\n attribution?: Record<string, any>;\n};\n\nconst num = (v: unknown): number | undefined =>\n typeof v === \"number\" && Number.isFinite(v) ? v : undefined;\n\nconst str = (v: unknown): string | undefined =>\n typeof v === \"string\" && v !== \"\" ? v : undefined;\n\n/**\n * `vital.target` is the raw CSS selector the library derived — LCP's `target`, CLS's\n * `largestShiftTarget`, INP's `interactionTarget`; **absent on FCP and TTFB**, which have no\n * element.\n *\n * ⚠ §4.6's action-name ladder was rejected for it on the record: the role gate blanks `<img>`,\n * `<h1>` and banners, which is most vital targets, and un-gating the ladder would rebuild the\n * `textContent` hole the gate exists to close. A selector is developer-authored structure —\n * tags, ids, classes — never user content. It is still **the least sanitized key on the wire**,\n * which is the reason `beforeSend` covers metrics at all.\n */\nfunction target(a: Record<string, unknown>): string | undefined {\n return str(a.target) ?? str(a.largestShiftTarget) ?? str(a.interactionTarget);\n}\n\n/**\n * §5.3: `lcp.url` is **query-stripped**, and query-stripped only — the contract is the authority\n * on every wire key's value discipline, and a fragment never leaves the browser anyway.\n */\nfunction stripQuery(url?: string): string | undefined {\n return url === undefined ? undefined : url.split(\"?\")[0];\n}\n\n/**\n * Build a vital row's attribute bag: four shared keys plus the per-vital ones (§5.3).\n *\n * ⚠ **LCP's four phases sum exactly to `value`** — that is the library's own guarantee and a\n * testable claim, which is why `lcp.time_to_first_byte` deliberately duplicates the `TTFB` row\n * rather than forcing a cross-row join to decompose one number.\n *\n * Everything the library did not produce is **omitted**, never nulled: `vital.target` and\n * `vital.load_state` are absent on the vitals that have no element and no load state, and the\n * SDK's absent-means-nothing discipline is what tells that apart from a zero.\n */\nexport function vitalAttributes(m: VitalMetric): Record<string, any> {\n const a: Record<string, unknown> = m.attribution ?? {};\n const out: Record<string, any> = {\n \"vital.rating\": m.rating,\n // ⚠ Load-bearing, not decoration: a `back-forward-cache` LCP is ~0 ms and will\n // silently drag a p75 down if the population is not separable.\n \"vital.navigation_type\": m.navigationType,\n };\n const t = target(a);\n if (t !== undefined) out[\"vital.target\"] = t;\n const load = str(a.loadState);\n if (load !== undefined) out[\"vital.load_state\"] = load;\n\n const put = (key: string, v: number | string | undefined) => {\n if (v !== undefined) out[key] = v;\n };\n\n switch (m.name) {\n case \"LCP\":\n put(\"lcp.time_to_first_byte\", num(a.timeToFirstByte));\n put(\"lcp.resource_load_delay\", num(a.resourceLoadDelay));\n put(\"lcp.resource_load_duration\", num(a.resourceLoadDuration));\n put(\"lcp.element_render_delay\", num(a.elementRenderDelay));\n put(\"lcp.url\", stripQuery(str(a.url)));\n break;\n case \"INP\":\n put(\"inp.input_delay\", num(a.inputDelay));\n put(\"inp.processing_duration\", num(a.processingDuration));\n put(\"inp.presentation_delay\", num(a.presentationDelay));\n put(\"inp.interaction_type\", str(a.interactionType));\n break;\n case \"CLS\":\n put(\"cls.largest_shift_value\", num(a.largestShiftValue));\n break;\n // TTFB and FCP carry no per-vital keys (§5.3).\n }\n return out;\n}\n","// §5.3 / #106 — the five Core Web Vitals, **web only**, on the **metric** path. An event named\n// `LCP` would land its name in the performance-events table and lose its number; the metric\n// path promotes `value` and `unit` for free.\n//\n// `web-vitals/attribution` is a bundled web-only dependency, imported from this `.web.ts` file\n// and nowhere else — that is what keeps it out of `index.native` entirely and means consumers\n// install nothing. Hand-rolling was rejected on session-windowed CLS (the naive sum is wrong\n// *and plausible*) and percentile INP.\n\nimport { vitalAttributes, type VitalMetric } from \"../webVitals\";\nimport type { ViewLoadType } from \"../viewManager\";\n\n/**\n * All this tracker needs of core. Structural, so it is testable without a `Telemetry`.\n */\ntype VitalsEmitter = {\n logMetric(name: string, value: number, data?: Record<string, any>): unknown;\n views: { onBoundary(fn: (successorLoadType: ViewLoadType) => unknown): () => void };\n};\n\nexport class WebVitalsTracker {\n /** The running values, held rather than emitted — see `start()`. */\n private held = new Map<string, VitalMetric>();\n /** What each held name last shipped, so an unchanged value does not re-ship at every hide. */\n private emitted = new Map<string, number>();\n private started = false;\n\n constructor(private telemetry: VitalsEmitter) { }\n\n /**\n * Idempotent: a second call must not double-subscribe and double every vital row.\n *\n * LCP, FCP and TTFB fire once on the initial load, so they emit straight from the callback.\n *\n * ⚠ **CLS and INP subscribe with `reportAllChanges: true` as a running-value subscription,\n * not an emission trigger.** The latest value is held in memory and shipped at the\n * `ViewManager`'s background boundary — the library's default page-hide report loses both\n * on a closed tab, because that report races the document's own teardown.\n *\n * ⚠ **All five are page-load-scoped, not view-scoped.** `LCP`, `FCP` and `TTFB` physically\n * cannot recur on a soft navigation, so `view.id` on a vital row is always the *initial*\n * view's. It is a real join key, it is just not \"the view this happened in\" for CLS and INP:\n * `GROUP BY view.name` over vitals reads **\"by entry point\"**. Documented, not engineered\n * around — view-scoping would need the Chrome-only Soft Navigations API.\n */\n async start(): Promise<void> {\n if (this.started) return;\n this.started = true;\n\n const { onLCP, onFCP, onTTFB, onCLS, onINP } = await import(\"web-vitals/attribution\");\n\n onLCP(m => void this.emit(m));\n onFCP(m => void this.emit(m));\n onTTFB(m => void this.emit(m));\n\n const hold = (m: VitalMetric) => { this.held.set(m.name, m); };\n onCLS(hold, { reportAllChanges: true });\n onINP(hold, { reportAllChanges: true });\n\n // `\"resume\"` is the background boundary's successor load type. A route change fires\n // here too and is deliberately ignored: these are page-load-scoped values.\n this.telemetry.views.onBoundary(lt => (lt === \"resume\" ? this.drain() : undefined));\n }\n\n /**\n * Awaited inside `beginView` while the departing view is still current, so the rows carry\n * the view they were accumulated under. A name whose running value has not moved since its\n * last row is skipped — a tab hidden twice with no shifts in between is not two CLS\n * samples, and the library's own report has the same no-delta-no-report property.\n *\n * Keying on `value` alone is exact for both held vitals, not a shortcut: CLS is cumulative,\n * so *any* shift moves it, and INP only changes when a worse interaction happens. An\n * unchanged value therefore means the attribution is unchanged too.\n */\n private async drain(): Promise<void> {\n for (const [name, m] of this.held) {\n if (this.emitted.get(name) === m.value) continue;\n this.emitted.set(name, m.value);\n await this.emit(m);\n }\n }\n\n private emit(m: VitalMetric): unknown {\n // `metric.unit` is stamped by core's METRIC_UNIT map — `ms` for four of them and\n // **`score` for CLS**, without which a 0.08 renders as a flat zero line beside an\n // LCP of 4000 in the same `value` column.\n return this.telemetry.logMetric(m.name, m.value, vitalAttributes(m));\n }\n}\n"],"names":["num","v","str","target","a","stripQuery","url","vitalAttributes","m","out","t","load","put","key","WebVitalsTracker","telemetry","onLCP","onFCP","onTTFB","onCLS","onINP","hold","lt","name"],"mappings":"AAuBA,MAAMA,IAAM,CAACC,MACT,OAAOA,KAAM,YAAY,OAAO,SAASA,CAAC,IAAIA,IAAI,QAEhDC,IAAM,CAACD,MACT,OAAOA,KAAM,YAAYA,MAAM,KAAKA,IAAI;AAa5C,SAASE,EAAOC,GAAgD;AAC5D,SAAOF,EAAIE,EAAE,MAAM,KAAKF,EAAIE,EAAE,kBAAkB,KAAKF,EAAIE,EAAE,iBAAiB;AAChF;AAMA,SAASC,EAAWC,GAAkC;AAClD,SAAOA,MAAQ,SAAY,SAAYA,EAAI,MAAM,GAAG,EAAE,CAAC;AAC3D;AAaO,SAASC,EAAgBC,GAAqC;AACjE,QAAMJ,IAA6BI,EAAE,eAAe,CAAA,GAC9CC,IAA2B;AAAA,IAC7B,gBAAgBD,EAAE;AAAA;AAAA;AAAA,IAGlB,yBAAyBA,EAAE;AAAA,EAAA,GAEzBE,IAAIP,EAAOC,CAAC;AAClB,EAAIM,MAAM,WAAWD,EAAI,cAAc,IAAIC;AAC3C,QAAMC,IAAOT,EAAIE,EAAE,SAAS;AAC5B,EAAIO,MAAS,WAAWF,EAAI,kBAAkB,IAAIE;AAElD,QAAMC,IAAM,CAACC,GAAaZ,MA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,EAAM,CAAAT,MAAK,KAAK,KAAK,KAAKA,CAAC,CAAC,GAC5BU,EAAO,CAAAV,MAAK,KAAK,KAAK,KAAKA,CAAC,CAAC;AAE7B,UAAMa,IAAO,CAACb,MAAmB;AAAE,WAAK,KAAK,IAAIA,EAAE,MAAMA,CAAC;AAAA,IAAG;AAC7D,IAAAW,EAAME,GAAM,EAAE,kBAAkB,GAAA,CAAM,GACtCD,EAAMC,GAAM,EAAE,kBAAkB,GAAA,CAAM,GAItC,KAAK,UAAU,MAAM,WAAW,CAAAC,MAAOA,MAAO,WAAW,KAAK,MAAA,IAAU,MAAU;AAAA,EACtF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAc,QAAuB;AACjC,eAAW,CAACC,GAAMf,CAAC,KAAK,KAAK;AACzB,MAAI,KAAK,QAAQ,IAAIe,CAAI,MAAMf,EAAE,UACjC,KAAK,QAAQ,IAAIe,GAAMf,EAAE,KAAK,GAC9B,MAAM,KAAK,KAAKA,CAAC;AAAA,EAEzB;AAAA,EAEQ,KAAKA,GAAyB;AAIlC,WAAO,KAAK,UAAU,UAAUA,EAAE,MAAMA,EAAE,OAAOD,EAAgBC,CAAC,CAAC;AAAA,EACvE;AACJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,s=e=>typeof e=="string"&&e!==""?e:void 0;function u(e){return s(e.target)??s(e.largestShiftTarget)??s(e.interactionTarget)}function d(e){return e===void 0?void 0:e.split("?")[0]}function p(e){const t=e.attribution??{},a={"vital.rating":e.rating,"vital.navigation_type":e.navigationType},o=u(t);o!==void 0&&(a["vital.target"]=o);const l=s(t.loadState);l!==void 0&&(a["vital.load_state"]=l);const r=(c,i)=>{i!==void 0&&(a[c]=i)};switch(e.name){case"LCP":r("lcp.time_to_first_byte",n(t.timeToFirstByte)),r("lcp.resource_load_delay",n(t.resourceLoadDelay)),r("lcp.resource_load_duration",n(t.resourceLoadDuration)),r("lcp.element_render_delay",n(t.elementRenderDelay)),r("lcp.url",d(s(t.url)));break;case"INP":r("inp.input_delay",n(t.inputDelay)),r("inp.processing_duration",n(t.processingDuration)),r("inp.presentation_delay",n(t.presentationDelay)),r("inp.interaction_type",s(t.interactionType));break;case"CLS":r("cls.largest_shift_value",n(t.largestShiftValue));break}return a}class h{constructor(t){this.telemetry=t,this.held=new Map,this.emitted=new Map,this.started=!1}async start(){if(this.started)return;this.started=!0;const{onLCP:t,onFCP:a,onTTFB:o,onCLS:l,onINP:r}=await Promise.resolve().then(()=>require("./web-vitals.attribution-CVCPiX-h.cjs"));t(i=>void this.emit(i)),a(i=>void this.emit(i)),o(i=>void this.emit(i));const c=i=>{this.held.set(i.name,i)};l(c,{reportAllChanges:!0}),r(c,{reportAllChanges:!0}),this.telemetry.views.onBoundary(i=>i==="resume"?this.drain():void 0)}async drain(){for(const[t,a]of this.held)this.emitted.get(t)!==a.value&&(this.emitted.set(t,a.value),await this.emit(a))}emit(t){return this.telemetry.logMetric(t.name,t.value,p(t))}}exports.WebVitalsTracker=h;
2
+ //# sourceMappingURL=webVitals.web-DpWJ-iYp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webVitals.web-DpWJ-iYp.cjs","sources":["../src/adapters/webVitals.ts","../src/adapters/web/webVitals.web.ts"],"sourcesContent":["// §5.3's attribute shaping for the five Core Web Vitals — the pure half, so the rules are\n// unit-tested against plain objects and the `.web.ts` half is left with nothing but the\n// library subscription. Shared-file, but web-only in practice: `TelemetryNative` never\n// imports it, which is what keeps `web-vitals` out of the native bundle entirely.\n\n/** The five names. All are already on `ALLOWED_NAMES`, and all ride the **metric** path. */\nexport type VitalName = \"LCP\" | \"FCP\" | \"CLS\" | \"INP\" | \"TTFB\";\n\n/**\n * Structurally typed against `web-vitals/attribution`'s metric, so this module compiles and\n * tests without the library and cannot pull it into a shared import graph.\n */\nexport type VitalMetric = {\n name: string;\n value: number;\n rating: string;\n navigationType: string;\n // `any`, not `unknown`: `web-vitals`' concrete `LCPAttribution` &c. have no index\n // signature, so a `Record<string, unknown>` here rejects every one of them at the\n // subscription. Everything downstream of this field is read through `num`/`str`.\n attribution?: Record<string, any>;\n};\n\nconst num = (v: unknown): number | undefined =>\n typeof v === \"number\" && Number.isFinite(v) ? v : undefined;\n\nconst str = (v: unknown): string | undefined =>\n typeof v === \"string\" && v !== \"\" ? v : undefined;\n\n/**\n * `vital.target` is the raw CSS selector the library derived — LCP's `target`, CLS's\n * `largestShiftTarget`, INP's `interactionTarget`; **absent on FCP and TTFB**, which have no\n * element.\n *\n * ⚠ §4.6's action-name ladder was rejected for it on the record: the role gate blanks `<img>`,\n * `<h1>` and banners, which is most vital targets, and un-gating the ladder would rebuild the\n * `textContent` hole the gate exists to close. A selector is developer-authored structure —\n * tags, ids, classes — never user content. It is still **the least sanitized key on the wire**,\n * which is the reason `beforeSend` covers metrics at all.\n */\nfunction target(a: Record<string, unknown>): string | undefined {\n return str(a.target) ?? str(a.largestShiftTarget) ?? str(a.interactionTarget);\n}\n\n/**\n * §5.3: `lcp.url` is **query-stripped**, and query-stripped only — the contract is the authority\n * on every wire key's value discipline, and a fragment never leaves the browser anyway.\n */\nfunction stripQuery(url?: string): string | undefined {\n return url === undefined ? undefined : url.split(\"?\")[0];\n}\n\n/**\n * Build a vital row's attribute bag: four shared keys plus the per-vital ones (§5.3).\n *\n * ⚠ **LCP's four phases sum exactly to `value`** — that is the library's own guarantee and a\n * testable claim, which is why `lcp.time_to_first_byte` deliberately duplicates the `TTFB` row\n * rather than forcing a cross-row join to decompose one number.\n *\n * Everything the library did not produce is **omitted**, never nulled: `vital.target` and\n * `vital.load_state` are absent on the vitals that have no element and no load state, and the\n * SDK's absent-means-nothing discipline is what tells that apart from a zero.\n */\nexport function vitalAttributes(m: VitalMetric): Record<string, any> {\n const a: Record<string, unknown> = m.attribution ?? {};\n const out: Record<string, any> = {\n \"vital.rating\": m.rating,\n // ⚠ Load-bearing, not decoration: a `back-forward-cache` LCP is ~0 ms and will\n // silently drag a p75 down if the population is not separable.\n \"vital.navigation_type\": m.navigationType,\n };\n const t = target(a);\n if (t !== undefined) out[\"vital.target\"] = t;\n const load = str(a.loadState);\n if (load !== undefined) out[\"vital.load_state\"] = load;\n\n const put = (key: string, v: number | string | undefined) => {\n if (v !== undefined) out[key] = v;\n };\n\n switch (m.name) {\n case \"LCP\":\n put(\"lcp.time_to_first_byte\", num(a.timeToFirstByte));\n put(\"lcp.resource_load_delay\", num(a.resourceLoadDelay));\n put(\"lcp.resource_load_duration\", num(a.resourceLoadDuration));\n put(\"lcp.element_render_delay\", num(a.elementRenderDelay));\n put(\"lcp.url\", stripQuery(str(a.url)));\n break;\n case \"INP\":\n put(\"inp.input_delay\", num(a.inputDelay));\n put(\"inp.processing_duration\", num(a.processingDuration));\n put(\"inp.presentation_delay\", num(a.presentationDelay));\n put(\"inp.interaction_type\", str(a.interactionType));\n break;\n case \"CLS\":\n put(\"cls.largest_shift_value\", num(a.largestShiftValue));\n break;\n // TTFB and FCP carry no per-vital keys (§5.3).\n }\n return out;\n}\n","// §5.3 / #106 — the five Core Web Vitals, **web only**, on the **metric** path. An event named\n// `LCP` would land its name in the performance-events table and lose its number; the metric\n// path promotes `value` and `unit` for free.\n//\n// `web-vitals/attribution` is a bundled web-only dependency, imported from this `.web.ts` file\n// and nowhere else — that is what keeps it out of `index.native` entirely and means consumers\n// install nothing. Hand-rolling was rejected on session-windowed CLS (the naive sum is wrong\n// *and plausible*) and percentile INP.\n\nimport { vitalAttributes, type VitalMetric } from \"../webVitals\";\nimport type { ViewLoadType } from \"../viewManager\";\n\n/**\n * All this tracker needs of core. Structural, so it is testable without a `Telemetry`.\n */\ntype VitalsEmitter = {\n logMetric(name: string, value: number, data?: Record<string, any>): unknown;\n views: { onBoundary(fn: (successorLoadType: ViewLoadType) => unknown): () => void };\n};\n\nexport class WebVitalsTracker {\n /** The running values, held rather than emitted — see `start()`. */\n private held = new Map<string, VitalMetric>();\n /** What each held name last shipped, so an unchanged value does not re-ship at every hide. */\n private emitted = new Map<string, number>();\n private started = false;\n\n constructor(private telemetry: VitalsEmitter) { }\n\n /**\n * Idempotent: a second call must not double-subscribe and double every vital row.\n *\n * LCP, FCP and TTFB fire once on the initial load, so they emit straight from the callback.\n *\n * ⚠ **CLS and INP subscribe with `reportAllChanges: true` as a running-value subscription,\n * not an emission trigger.** The latest value is held in memory and shipped at the\n * `ViewManager`'s background boundary — the library's default page-hide report loses both\n * on a closed tab, because that report races the document's own teardown.\n *\n * ⚠ **All five are page-load-scoped, not view-scoped.** `LCP`, `FCP` and `TTFB` physically\n * cannot recur on a soft navigation, so `view.id` on a vital row is always the *initial*\n * view's. It is a real join key, it is just not \"the view this happened in\" for CLS and INP:\n * `GROUP BY view.name` over vitals reads **\"by entry point\"**. Documented, not engineered\n * around — view-scoping would need the Chrome-only Soft Navigations API.\n */\n async start(): Promise<void> {\n if (this.started) return;\n this.started = true;\n\n const { onLCP, onFCP, onTTFB, onCLS, onINP } = await import(\"web-vitals/attribution\");\n\n onLCP(m => void this.emit(m));\n onFCP(m => void this.emit(m));\n onTTFB(m => void this.emit(m));\n\n const hold = (m: VitalMetric) => { this.held.set(m.name, m); };\n onCLS(hold, { reportAllChanges: true });\n onINP(hold, { reportAllChanges: true });\n\n // `\"resume\"` is the background boundary's successor load type. A route change fires\n // here too and is deliberately ignored: these are page-load-scoped values.\n this.telemetry.views.onBoundary(lt => (lt === \"resume\" ? this.drain() : undefined));\n }\n\n /**\n * Awaited inside `beginView` while the departing view is still current, so the rows carry\n * the view they were accumulated under. A name whose running value has not moved since its\n * last row is skipped — a tab hidden twice with no shifts in between is not two CLS\n * samples, and the library's own report has the same no-delta-no-report property.\n *\n * Keying on `value` alone is exact for both held vitals, not a shortcut: CLS is cumulative,\n * so *any* shift moves it, and INP only changes when a worse interaction happens. An\n * unchanged value therefore means the attribution is unchanged too.\n */\n private async drain(): Promise<void> {\n for (const [name, m] of this.held) {\n if (this.emitted.get(name) === m.value) continue;\n this.emitted.set(name, m.value);\n await this.emit(m);\n }\n }\n\n private emit(m: VitalMetric): unknown {\n // `metric.unit` is stamped by core's METRIC_UNIT map — `ms` for four of them and\n // **`score` for CLS**, without which a 0.08 renders as a flat zero line beside an\n // LCP of 4000 in the same `value` column.\n return this.telemetry.logMetric(m.name, m.value, vitalAttributes(m));\n }\n}\n"],"names":["num","v","str","target","a","stripQuery","url","vitalAttributes","m","out","t","load","put","key","WebVitalsTracker","telemetry","onLCP","onFCP","onTTFB","onCLS","onINP","hold","lt","name"],"mappings":"gFAuBA,MAAMA,EAAOC,GACT,OAAOA,GAAM,UAAY,OAAO,SAASA,CAAC,EAAIA,EAAI,OAEhDC,EAAOD,GACT,OAAOA,GAAM,UAAYA,IAAM,GAAKA,EAAI,OAa5C,SAASE,EAAOC,EAAgD,CAC5D,OAAOF,EAAIE,EAAE,MAAM,GAAKF,EAAIE,EAAE,kBAAkB,GAAKF,EAAIE,EAAE,iBAAiB,CAChF,CAMA,SAASC,EAAWC,EAAkC,CAClD,OAAOA,IAAQ,OAAY,OAAYA,EAAI,MAAM,GAAG,EAAE,CAAC,CAC3D,CAaO,SAASC,EAAgBC,EAAqC,CACjE,MAAMJ,EAA6BI,EAAE,aAAe,CAAA,EAC9CC,EAA2B,CAC7B,eAAgBD,EAAE,OAGlB,wBAAyBA,EAAE,cAAA,EAEzBE,EAAIP,EAAOC,CAAC,EACdM,IAAM,SAAWD,EAAI,cAAc,EAAIC,GAC3C,MAAMC,EAAOT,EAAIE,EAAE,SAAS,EACxBO,IAAS,SAAWF,EAAI,kBAAkB,EAAIE,GAElD,MAAMC,EAAM,CAACC,EAAaZ,IAAmC,CACrDA,IAAM,SAAWQ,EAAII,CAAG,EAAIZ,EACpC,EAEA,OAAQO,EAAE,KAAA,CACN,IAAK,MACDI,EAAI,yBAA0BZ,EAAII,EAAE,eAAe,CAAC,EACpDQ,EAAI,0BAA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O,SAAW,KAAK,MAAA,EAAU,MAAU,CACtF,CAYA,MAAc,OAAuB,CACjC,SAAW,CAACC,EAAMf,CAAC,IAAK,KAAK,KACrB,KAAK,QAAQ,IAAIe,CAAI,IAAMf,EAAE,QACjC,KAAK,QAAQ,IAAIe,EAAMf,EAAE,KAAK,EAC9B,MAAM,KAAK,KAAKA,CAAC,EAEzB,CAEQ,KAAKA,EAAyB,CAIlC,OAAO,KAAK,UAAU,UAAUA,EAAE,KAAMA,EAAE,MAAOD,EAAgBC,CAAC,CAAC,CACvE,CACJ"}
@@ -0,0 +1,2 @@
1
+ "use strict";const i=require("./httpAttributes-D0m6UID7.cjs"),l=require("./memoryStore-BIGZmmfD.cjs"),a="__edgeTelemetryXhrPatched";function c(s,r){if(r[a])return()=>{};const p=r.prototype.open,u=r.prototype.send,n=r.prototype.setRequestHeader;return r.prototype.open=function(o,t){return this._telemetryRequest?.settled?.(),this._telemetryRequest={method:o,url:String(t),start:0},p.apply(this,arguments)},n&&(r.prototype.setRequestHeader=function(o,t){return this._telemetryRequest&&String(o).toLowerCase()===l.TRACEPARENT&&(this._telemetryRequest.consumerTraceparent=t),n.apply(this,arguments)}),r.prototype.send=function(o){const t=this._telemetryRequest;if(!t)return u.apply(this,arguments);if(t.start=Date.now(),t.body=o,!i.isCollectorUrl(t.url,s.getEndpoint?.())){t.settled=s.views.requestStarted(t.start),t.snap=s.snapshot();const e=s.trace.requestTrace(t.start,{url:t.url,sampled:s.isSampled(),consumerTraceparent:t.consumerTraceparent});t.span=e.finish,e.header&&n&&n.call(this,l.TRACEPARENT,e.header)}this._telemetryListening||(this._telemetryListening=!0,this.addEventListener("loadend",()=>{const e=this._telemetryRequest;if(!e||(e.settled?.(),i.isCollectorUrl(e.url,s.getEndpoint?.())))return;const d=Date.now();s.log("http.request",{...i.buildHttpAttributes({url:e.url,method:e.method,statusCode:this.status,durationMs:d-e.start,error:this.status===0?"Network error":null,requestBody:e.body,responseSize:i.contentLengthSize(this.getResponseHeader?.("content-length"))}),...e.span?.(d)},e.snap)}));try{return u.apply(this,arguments)}catch(e){throw t.settled?.(),e}},r[a]=!0,()=>{r.prototype.open=p,r.prototype.send=u,n&&(r.prototype.setRequestHeader=n),delete r[a]}}exports.patchXHR=c;
2
+ //# sourceMappingURL=xhrIntercept-BADex6Cq.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xhrIntercept-BADex6Cq.cjs","sources":["../src/adapters/xhrIntercept.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\nimport type { LogSnapshot } from \"../core/telemetry\";\nimport { buildHttpAttributes, contentLengthSize, isCollectorUrl } from \"./httpAttributes\";\nimport type { TraceAttributes } from \"./traceManager\";\nimport { TRACEPARENT } from \"./traceHeader\";\n\n// Double-patching is the exact defect #95 exists to kill: two patches mean two `loadend`\n// listeners and two `http.request` events per call. `trackNetworkRequests()` is public and the\n// entry ctors already call it once, so a second call must be a no-op. The flag rides the\n// constructor, not the prototype, so it never leaks onto an instance.\nconst PATCHED = \"__edgeTelemetryXhrPatched\";\n\ninterface PendingRequest {\n method: string;\n url: string;\n start: number;\n body?: unknown;\n /**\n * Closes this request's contribution to §4.5.2's network settle. Bound at `send()` to the\n * view that was live *then*, so a response landing after a route change belongs to the view\n * it started in and does not hold the arriving one open.\n */\n settled?: (endedAt?: number) => void;\n /**\n * §6.3's Tier 1 keys, captured at `send()` so the parent is the root live *then* and\n * `span.start_time` is the send. Called at `loadend` to stamp `span.duration_ms` off\n * the same pair of timestamps `http.duration_ms` uses.\n */\n span?: (endedAt: number) => TraceAttributes;\n /**\n * §6.4's ownership flag: the consumer's own `traceparent`, recorded **at their write\n * time** in the `setRequestHeader` patch. Never inferred from the value's shape — an\n * SDK-minted and a consumer-minted header are byte-identical by construction — and reset\n * by `open()`, which per spec clears the author request headers anyway.\n */\n consumerTraceparent?: string;\n /**\n * §3.1's attribution freeze: `session.id`, `session.start_time` and `view.id` as they\n * were at `send()`. The 4-hour cap can rotate a session *while this request is in\n * flight*, which would otherwise put S1's trace on an S2 row. No `at` — the row still\n * reports its completion timestamp (§4.4).\n */\n snap?: LogSnapshot;\n}\n\ninterface PatchedXhr extends XMLHttpRequest {\n _telemetryRequest?: PendingRequest;\n _telemetryListening?: boolean;\n}\n\ntype XhrCtor = { prototype: PatchedXhr; [PATCHED]?: boolean };\n\n/**\n * Patches an `XMLHttpRequest` prototype so every completed request emits one `http.request`.\n * Shared because the native build is XHR-*only* (§4.4: RN's `global.fetch` is XHR underneath,\n * so patching both emits two events per call) while the web build patches XHR alongside its\n * own `fetch` patch — same emit rules, two different sets of callers.\n *\n * @returns the unpatch, so `stop()` can restore the prototype.\n */\nexport function patchXHR(telemetry: Telemetry, xhr: XhrCtor): () => void {\n if (xhr[PATCHED]) return () => { };\n\n const origOpen = xhr.prototype.open;\n const origSend = xhr.prototype.send;\n // May legitimately be absent on a minimal XHR polyfill; when it is, there is no way to\n // observe a consumer header and no way to write ours, so tracing simply stays dark.\n const origSetRequestHeader = xhr.prototype.setRequestHeader;\n\n // `arguments` is forwarded verbatim on both hooks: the SDK reports on the request, it never\n // reshapes the one it passes on. That is the only reason for the two casts in this file.\n xhr.prototype.open = function (this: PatchedXhr, method: string, url: string | URL) {\n // An XHR may be legally re-opened before the previous request finished — and the old\n // PendingRequest is about to be dropped. Release its settle hold first, or the view it\n // started in can never go quiet and reports `abandoned` for the rest of its life.\n this._telemetryRequest?.settled?.();\n this._telemetryRequest = { method, url: String(url), start: 0 };\n return origOpen.apply(this, arguments as any);\n };\n\n if (origSetRequestHeader) {\n xhr.prototype.setRequestHeader = function (this: PatchedXhr, name: string, value: string) {\n // Read-scope (§6.4): **exactly one header name, for exactly one purpose** — a\n // presence check. Names are compared case-insensitively; no other header is\n // inspected, logged or forwarded, and this one is passed straight through.\n if (this._telemetryRequest && String(name).toLowerCase() === TRACEPARENT) {\n this._telemetryRequest.consumerTraceparent = value;\n }\n return origSetRequestHeader.apply(this, arguments as any);\n };\n }\n\n xhr.prototype.send = function (this: PatchedXhr, body?: Document | XMLHttpRequestBodyInit | null) {\n const req = this._telemetryRequest;\n if (!req) return origSend.apply(this, arguments as any); // send() without open() — let it throw its own way\n req.start = Date.now();\n req.body = body;\n // The collector's own POST is out of scope for settle exactly as it is for\n // `http.request` — checked here as well as at loadend, because the view must not be\n // held open by the SDK's own traffic (§4.5.2).\n if (!isCollectorUrl(req.url, telemetry.getEndpoint?.())) {\n req.settled = telemetry.views.requestStarted(req.start);\n req.snap = telemetry.snapshot();\n // Mints a `request` root when nothing is live, and extends the live one otherwise\n // (§6.2), and resolves §6.5's outcome ladder. Same gate as settle: the SDK's own\n // POST neither holds a view open, starts an action, nor carries an outcome.\n // No `noCors` — `mode` is a fetch concept XHR cannot express, so `skipped_no_cors`\n // needs no platform branch to stay fetch-only.\n const trace = telemetry.trace.requestTrace(req.start, {\n url: req.url,\n sampled: telemetry.isSampled(),\n consumerTraceparent: req.consumerTraceparent,\n });\n req.span = trace.finish;\n // Written through the *original*, so our own write can never be misread as the\n // consumer's on a later inspection — and only ever when their flag is unset, so\n // there is no SDK-owned header for never-strip to have to protect.\n if (trace.header && origSetRequestHeader) {\n origSetRequestHeader.call(this, TRACEPARENT, trace.header);\n }\n }\n\n // One listener per *instance*, not per send: an XHR may be legally reused, and adding\n // a listener on every send() would emit N events on the Nth one. The handler reads\n // `_telemetryRequest` at fire time, so one listener serves every reuse.\n if (!this._telemetryListening) {\n this._telemetryListening = true;\n this.addEventListener(\"loadend\", () => {\n const done = this._telemetryRequest;\n if (!done) return;\n done.settled?.();\n // Invariant: an http.request never describes the SDK's own collector POST.\n if (isCollectorUrl(done.url, telemetry.getEndpoint?.())) return;\n\n const end = Date.now();\n telemetry.log(\"http.request\", {\n ...buildHttpAttributes({\n url: done.url,\n method: done.method,\n statusCode: this.status,\n durationMs: end - done.start,\n error: this.status === 0 ? \"Network error\" : null,\n requestBody: done.body,\n responseSize: contentLengthSize(this.getResponseHeader?.(\"content-length\")),\n }),\n ...done.span?.(end),\n }, done.snap);\n });\n }\n\n try {\n return origSend.apply(this, arguments as any);\n } catch (err) {\n // A send() that throws never reaches `loadend`, so nothing else would ever close\n // this hold. The fetch half gets this from its `finally`; XHR needs it spelled out.\n req.settled?.();\n throw err;\n }\n };\n\n xhr[PATCHED] = true;\n return () => {\n xhr.prototype.open = origOpen;\n xhr.prototype.send = origSend;\n if (origSetRequestHeader) xhr.prototype.setRequestHeader = origSetRequestHeader;\n delete xhr[PATCHED];\n };\n}\n"],"names":["PATCHED","patchXHR","telemetry","xhr","origOpen","origSend","origSetRequestHeader","method","url","name","value","TRACEPARENT","body","req","isCollectorUrl","trace","done","end","buildHttpAttributes","contentLengthSize","err"],"mappings":"sGAUMA,EAAU,4BAkDT,SAASC,EAASC,EAAsBC,EAA0B,CACrE,GAAIA,EAAIH,CAAO,EAAG,MAAO,IAAM,CAAE,EAEjC,MAAMI,EAAWD,EAAI,UAAU,KACzBE,EAAWF,EAAI,UAAU,KAGzBG,EAAuBH,EAAI,UAAU,iBAI3C,OAAAA,EAAI,UAAU,KAAO,SAA4BI,EAAgBC,EAAmB,CAIhF,YAAK,mBAAmB,UAAA,EACxB,KAAK,kBAAoB,CAAE,OAAAD,EAAQ,IAAK,OAAOC,CAAG,EAAG,MAAO,CAAA,EACrDJ,EAAS,MAAM,KAAM,SAAgB,CAChD,EAEIE,IACAH,EAAI,UAAU,iBAAmB,SAA4BM,EAAcC,EAAe,CAItF,OAAI,KAAK,mBAAqB,OAAOD,CAAI,EAAE,YAAA,IAAkBE,gBACzD,KAAK,kBAAkB,oBAAsBD,GAE1CJ,EAAqB,MAAM,KAAM,SAAgB,CAC5D,GAGJH,EAAI,UAAU,KAAO,SAA4BS,EAAiD,CAC9F,MAAMC,EAAM,KAAK,kBACjB,GAAI,CAACA,EAAK,OAAOR,EAAS,MAAM,KAAM,SAAgB,EAMtD,GALAQ,EAAI,MAAQ,KAAK,IAAA,EACjBA,EAAI,KAAOD,EAIP,CAACE,EAAAA,eAAeD,EAAI,IAAKX,E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tM8zh.js";
2
+ import { a as l } from "./memoryStore-F5I-GQKM.js";
3
+ const i = "__edgeTelemetryXhrPatched";
4
+ function m(r, s) {
5
+ if (s[i]) return () => {
6
+ };
7
+ const p = s.prototype.open, a = s.prototype.send, n = s.prototype.setRequestHeader;
8
+ return s.prototype.open = function(o, t) {
9
+ return this._telemetryRequest?.settled?.(), this._telemetryRequest = { method: o, url: String(t), start: 0 }, p.apply(this, arguments);
10
+ }, n && (s.prototype.setRequestHeader = function(o, t) {
11
+ return this._telemetryRequest && String(o).toLowerCase() === l && (this._telemetryRequest.consumerTraceparent = t), n.apply(this, arguments);
12
+ }), s.prototype.send = function(o) {
13
+ const t = this._telemetryRequest;
14
+ if (!t) return a.apply(this, arguments);
15
+ if (t.start = Date.now(), t.body = o, !d(t.url, r.getEndpoint?.())) {
16
+ t.settled = r.views.requestStarted(t.start), t.snap = r.snapshot();
17
+ const e = r.trace.requestTrace(t.start, {
18
+ url: t.url,
19
+ sampled: r.isSampled(),
20
+ consumerTraceparent: t.consumerTraceparent
21
+ });
22
+ t.span = e.finish, e.header && n && n.call(this, l, e.header);
23
+ }
24
+ this._telemetryListening || (this._telemetryListening = !0, this.addEventListener("loadend", () => {
25
+ const e = this._telemetryRequest;
26
+ if (!e || (e.settled?.(), d(e.url, r.getEndpoint?.()))) return;
27
+ const u = Date.now();
28
+ r.log("http.request", {
29
+ ...c({
30
+ url: e.url,
31
+ method: e.method,
32
+ statusCode: this.status,
33
+ durationMs: u - e.start,
34
+ error: this.status === 0 ? "Network error" : null,
35
+ requestBody: e.body,
36
+ responseSize: h(this.getResponseHeader?.("content-length"))
37
+ }),
38
+ ...e.span?.(u)
39
+ }, e.snap);
40
+ }));
41
+ try {
42
+ return a.apply(this, arguments);
43
+ } catch (e) {
44
+ throw t.settled?.(), e;
45
+ }
46
+ }, s[i] = !0, () => {
47
+ s.prototype.open = p, s.prototype.send = a, n && (s.prototype.setRequestHeader = n), delete s[i];
48
+ };
49
+ }
50
+ export {
51
+ m as p
52
+ };
53
+ //# sourceMappingURL=xhrIntercept-BNiA41Mj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xhrIntercept-BNiA41Mj.js","sources":["../src/adapters/xhrIntercept.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\nimport type { LogSnapshot } from \"../core/telemetry\";\nimport { buildHttpAttributes, contentLengthSize, isCollectorUrl } from \"./httpAttributes\";\nimport type { TraceAttributes } from \"./traceManager\";\nimport { TRACEPARENT } from \"./traceHeader\";\n\n// Double-patching is the exact defect #95 exists to kill: two patches mean two `loadend`\n// listeners and two `http.request` events per call. `trackNetworkRequests()` is public and the\n// entry ctors already call it once, so a second call must be a no-op. The flag rides the\n// constructor, not the prototype, so it never leaks onto an instance.\nconst PATCHED = \"__edgeTelemetryXhrPatched\";\n\ninterface PendingRequest {\n method: string;\n url: string;\n start: number;\n body?: unknown;\n /**\n * Closes this request's contribution to §4.5.2's network settle. Bound at `send()` to the\n * view that was live *then*, so a response landing after a route change belongs to the view\n * it started in and does not hold the arriving one open.\n */\n settled?: (endedAt?: number) => void;\n /**\n * §6.3's Tier 1 keys, captured at `send()` so the parent is the root live *then* and\n * `span.start_time` is the send. Called at `loadend` to stamp `span.duration_ms` off\n * the same pair of timestamps `http.duration_ms` uses.\n */\n span?: (endedAt: number) => TraceAttributes;\n /**\n * §6.4's ownership flag: the consumer's own `traceparent`, recorded **at their write\n * time** in the `setRequestHeader` patch. Never inferred from the value's shape — an\n * SDK-minted and a consumer-minted header are byte-identical by construction — and reset\n * by `open()`, which per spec clears the author request headers anyway.\n */\n consumerTraceparent?: string;\n /**\n * §3.1's attribution freeze: `session.id`, `session.start_time` and `view.id` as they\n * were at `send()`. The 4-hour cap can rotate a session *while this request is in\n * flight*, which would otherwise put S1's trace on an S2 row. No `at` — the row still\n * reports its completion timestamp (§4.4).\n */\n snap?: LogSnapshot;\n}\n\ninterface PatchedXhr extends XMLHttpRequest {\n _telemetryRequest?: PendingRequest;\n _telemetryListening?: boolean;\n}\n\ntype XhrCtor = { prototype: PatchedXhr; [PATCHED]?: boolean };\n\n/**\n * Patches an `XMLHttpRequest` prototype so every completed request emits one `http.request`.\n * Shared because the native build is XHR-*only* (§4.4: RN's `global.fetch` is XHR underneath,\n * so patching both emits two events per call) while the web build patches XHR alongside its\n * own `fetch` patch — same emit rules, two different sets of callers.\n *\n * @returns the unpatch, so `stop()` can restore the prototype.\n */\nexport function patchXHR(telemetry: Telemetry, xhr: XhrCtor): () => void {\n if (xhr[PATCHED]) return () => { };\n\n const origOpen = xhr.prototype.open;\n const origSend = xhr.prototype.send;\n // May legitimately be absent on a minimal XHR polyfill; when it is, there is no way to\n // observe a consumer header and no way to write ours, so tracing simply stays dark.\n const origSetRequestHeader = xhr.prototype.setRequestHeader;\n\n // `arguments` is forwarded verbatim on both hooks: the SDK reports on the request, it never\n // reshapes the one it passes on. That is the only reason for the two casts in this file.\n xhr.prototype.open = function (this: PatchedXhr, method: string, url: string | URL) {\n // An XHR may be legally re-opened before the previous request finished — and the old\n // PendingRequest is about to be dropped. Release its settle hold first, or the view it\n // started in can never go quiet and reports `abandoned` for the rest of its life.\n this._telemetryRequest?.settled?.();\n this._telemetryRequest = { method, url: String(url), start: 0 };\n return origOpen.apply(this, arguments as any);\n };\n\n if (origSetRequestHeader) {\n xhr.prototype.setRequestHeader = function (this: PatchedXhr, name: string, value: string) {\n // Read-scope (§6.4): **exactly one header name, for exactly one purpose** — a\n // presence check. Names are compared case-insensitively; no other header is\n // inspected, logged or forwarded, and this one is passed straight through.\n if (this._telemetryRequest && String(name).toLowerCase() === TRACEPARENT) {\n this._telemetryRequest.consumerTraceparent = value;\n }\n return origSetRequestHeader.apply(this, arguments as any);\n };\n }\n\n xhr.prototype.send = function (this: PatchedXhr, body?: Document | XMLHttpRequestBodyInit | null) {\n const req = this._telemetryRequest;\n if (!req) return origSend.apply(this, arguments as any); // send() without open() — let it throw its own way\n req.start = Date.now();\n req.body = body;\n // The collector's own POST is out of scope for settle exactly as it is for\n // `http.request` — checked here as well as at loadend, because the view must not be\n // held open by the SDK's own traffic (§4.5.2).\n if (!isCollectorUrl(req.url, telemetry.getEndpoint?.())) {\n req.settled = telemetry.views.requestStarted(req.start);\n req.snap = telemetry.snapshot();\n // Mints a `request` root when nothing is live, and extends the live one otherwise\n // (§6.2), and resolves §6.5's outcome ladder. Same gate as settle: the SDK's own\n // POST neither holds a view open, starts an action, nor carries an outcome.\n // No `noCors` — `mode` is a fetch concept XHR cannot express, so `skipped_no_cors`\n // needs no platform branch to stay fetch-only.\n const trace = telemetry.trace.requestTrace(req.start, {\n url: req.url,\n sampled: telemetry.isSampled(),\n consumerTraceparent: req.consumerTraceparent,\n });\n req.span = trace.finish;\n // Written through the *original*, so our own write can never be misread as the\n // consumer's on a later inspection — and only ever when their flag is unset, so\n // there is no SDK-owned header for never-strip to have to protect.\n if (trace.header && origSetRequestHeader) {\n origSetRequestHeader.call(this, TRACEPARENT, trace.header);\n }\n }\n\n // One listener per *instance*, not per send: an XHR may be legally reused, and adding\n // a listener on every send() would emit N events on the Nth one. The handler reads\n // `_telemetryRequest` at fire time, so one listener serves every reuse.\n if (!this._telemetryListening) {\n this._telemetryListening = true;\n this.addEventListener(\"loadend\", () => {\n const done = this._telemetryRequest;\n if (!done) return;\n done.settled?.();\n // Invariant: an http.request never describes the SDK's own collector POST.\n if (isCollectorUrl(done.url, telemetry.getEndpoint?.())) return;\n\n const end = Date.now();\n telemetry.log(\"http.request\", {\n ...buildHttpAttributes({\n url: done.url,\n method: done.method,\n statusCode: this.status,\n durationMs: end - done.start,\n error: this.status === 0 ? \"Network error\" : null,\n requestBody: done.body,\n responseSize: contentLengthSize(this.getResponseHeader?.(\"content-length\")),\n }),\n ...done.span?.(end),\n }, done.snap);\n });\n }\n\n try {\n return origSend.apply(this, arguments as any);\n } catch (err) {\n // A send() that throws never reaches `loadend`, so nothing else would ever close\n // this hold. The fetch half gets this from its `finally`; XHR needs it spelled out.\n req.settled?.();\n throw err;\n }\n };\n\n xhr[PATCHED] = true;\n return () => {\n xhr.prototype.open = origOpen;\n xhr.prototype.send = origSend;\n if (origSetRequestHeader) xhr.prototype.setRequestHeader = origSetRequestHeader;\n delete xhr[PATCHED];\n };\n}\n"],"names":["PATCHED","patchXHR","telemetry","xhr","origOpen","origSend","origSetRequestHeader","method","url","name","value","TRACEPARENT","body","req","isCollectorUrl","trace","done","end","buildHttpAttributes","contentLengthSize","err"],"mappings":";;AAUA,MAAMA,IAAU;AAkDT,SAASC,EAASC,GAAsBC,GAA0B;AACrE,MAAIA,EAAIH,CAAO,EAAG,QAAO,MAAM;AAAA,EAAE;AAEjC,QAAMI,IAAWD,EAAI,UAAU,MACzBE,IAAWF,EAAI,UAAU,MAGzBG,IAAuBH,EAAI,UAAU;AAI3C,SAAAA,EAAI,UAAU,OAAO,SAA4BI,GAAgBC,GAAmB;AAIhF,gBAAK,mBAAmB,UAAA,GACxB,KAAK,oBAAoB,EAAE,QAAAD,GAAQ,KAAK,OAAOC,CAAG,GAAG,OAAO,EAAA,GACrDJ,EAAS,MAAM,MAAM,SAAgB;AAAA,EAChD,GAEIE,MACAH,EAAI,UAAU,mBAAmB,SAA4BM,GAAcC,GAAe;AAItF,WAAI,KAAK,qBAAqB,OAAOD,CAAI,EAAE,YAAA,MAAkBE,MACzD,KAAK,kBAAkB,sBAAsBD,IAE1CJ,EAAqB,MAAM,MAAM,SAAgB;AAAA,EAC5D,IAGJH,EAAI,UAAU,OAAO,SAA4BS,GAAiD;AAC9F,UAAMC,IAAM,KAAK;AACjB,QAAI,CAACA,EAAK,QAAOR,EAAS,MAAM,MAAM,SAAgB;AAMtD,QALAQ,EAAI,QAAQ,KAAK,IAAA,GACjBA,EAAI,OAAOD,GAIP,CAACE,EAAeD,EAAI,KAAKX,EAAU,cAAA,CAAe,GAAG;AACrD,MAAAW,EAAI,UAAUX,EAAU,MAAM,eAAeW,EAAI,KAAK,GACtDA,EAAI,OAAOX,EAAU,SAAA;AAMrB,YAAMa,IAAQb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