@incodetech/core 2.4.1-agentic.11 → 2.4.1-agentic.12

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 (216) hide show
  1. package/dist/{CameraCompositor-ppyMYVoY.esm.js → CameraCompositor-C7N1N61V.esm.js} +55 -1
  2. package/dist/{FaceDetectionProvider-2NzWDbV8.esm.js → FaceDetectionProvider-WtuJ6QBK.esm.js} +16 -11
  3. package/dist/{IWasmUtilCapability-BRn0wz8v.d.ts → IWasmUtilCapability-XcOtT1TP.d.ts} +5 -4
  4. package/dist/{MultipartRecordingProvider-CduV32Qa.esm.js → MultipartRecordingProvider-BtMQZEbg.esm.js} +1 -1
  5. package/dist/{StreamCanvasCapture-ixfy84ys.d.ts → StreamCanvasCapture-BnBfA6fb.d.ts} +24 -2
  6. package/dist/{StreamCanvasCapture-C9jtgBdT.esm.js → StreamCanvasCapture-CXd87trH.esm.js} +18 -3
  7. package/dist/{WasmUtilProvider-DdhAHHw4.esm.js → WasmUtilProvider-D5RMElzw.esm.js} +7 -0
  8. package/dist/{WorkerEncoderRecordingProvider-CsDED9UU.esm.js → WorkerEncoderRecordingProvider-BO7urYwT.esm.js} +1 -1
  9. package/dist/{addressSearch-Rxm1K67A.esm.js → addressSearch-BzAy6lhp.esm.js} +2 -4
  10. package/dist/ae-signature.esm.js +1 -1
  11. package/dist/antifraud.esm.js +2 -2
  12. package/dist/{antifraudManager-DKNOi9-z.esm.js → antifraudManager-Bw5nw5fh.esm.js} +3 -3
  13. package/dist/{antifraudStateMachine-BJ6PmCsw.esm.js → antifraudStateMachine-kOfsaAuT.esm.js} +2 -4
  14. package/dist/{api-CZpuJuZl.esm.js → api-DSZSaaWr.esm.js} +2 -0
  15. package/dist/{apiError-BamZ815u.esm.js → apiError-BDuL1wTs.esm.js} +1 -1
  16. package/dist/{attemptCarry-BecGGZK8.esm.js → attemptCarry-QFQkA3na.esm.js} +1 -1
  17. package/dist/authentication.d.ts +3 -3
  18. package/dist/authentication.esm.js +2 -2
  19. package/dist/{authenticationManager-yBVGiIf_.esm.js → authenticationManager-B0SioAdd.esm.js} +6 -6
  20. package/dist/{authenticationManager-DRaugLgH.d.ts → authenticationManager-eYcurNiS.d.ts} +1 -1
  21. package/dist/{authenticationStateMachine-DPqTOJPp.esm.js → authenticationStateMachine-n1OrhPTv.esm.js} +3 -3
  22. package/dist/{backCameraStream-DS1oDiUq.esm.js → backCameraStream-6qVHvj76.esm.js} +2 -2
  23. package/dist/{browser-pQZA35G2-DxIBykpe.esm.js → browser-pQZA35G2-CG3C-xGt.esm.js} +1 -1
  24. package/dist/calendarDate-DcqGuEht.esm.js +35 -0
  25. package/dist/camera-9yYDUOsO.d.ts +5 -0
  26. package/dist/{camera-E_Kcre4O.esm.js → camera-CJKApt0x.esm.js} +10 -3
  27. package/dist/camera.d.ts +2 -2
  28. package/dist/camera.esm.js +1 -1
  29. package/dist/certificate-issuance.esm.js +2 -2
  30. package/dist/{certificateIssuanceManager-Dxl9UwR0.esm.js → certificateIssuanceManager-DPT8E9zV.esm.js} +3 -3
  31. package/dist/{certificateIssuanceStateMachine-CM4q71h1.esm.js → certificateIssuanceStateMachine-BwDb3ezx.esm.js} +1 -1
  32. package/dist/consent.d.ts +1 -1
  33. package/dist/consent.esm.js +2 -2
  34. package/dist/{consentManager-B2F_VeAo.d.ts → consentManager-B0YKqYtZ.d.ts} +9 -9
  35. package/dist/{consentManager-BPocwpm2.esm.js → consentManager-DRMJ3O4r.esm.js} +3 -3
  36. package/dist/{consentStateMachine-DgiIcT9q.esm.js → consentStateMachine-Br0JbW7k.esm.js} +4 -7
  37. package/dist/cross-document-data-match.esm.js +1 -1
  38. package/dist/{crossDocumentDataMatchManager-BfA29Aji.esm.js → crossDocumentDataMatchManager-BIQ-SYcR.esm.js} +3 -4
  39. package/dist/curp-validation.d.ts +1 -1
  40. package/dist/curp-validation.esm.js +2 -2
  41. package/dist/{curpValidationManager-CbvBDoE1.esm.js → curpValidationManager-BKUDQ55W.esm.js} +3 -3
  42. package/dist/{curpValidationManager-Ci2iVuog.d.ts → curpValidationManager-DgUZySoq.d.ts} +1 -1
  43. package/dist/{curpValidationStateMachine-BQ8XK2Y3.esm.js → curpValidationStateMachine-BwUBkyyi.esm.js} +13 -14
  44. package/dist/custom-fields.esm.js +1 -1
  45. package/dist/custom-watchlist.esm.js +2 -2
  46. package/dist/{customFieldsManager-BRqSCR9R.esm.js → customFieldsManager-CPhONu5i.esm.js} +12 -16
  47. package/dist/{customWatchlistManager-Bd1ooIDB.esm.js → customWatchlistManager-cN57usIW.esm.js} +3 -3
  48. package/dist/{customWatchlistStateMachine-r8nGhyo1.esm.js → customWatchlistStateMachine-C1Xq1ugl.esm.js} +2 -4
  49. package/dist/{deepsightLoader-CEY2mSPM.esm.js → deepsightLoader-ClCQCdeL.esm.js} +5 -5
  50. package/dist/{desktopCameraElection-enVPfRsQ.esm.js → desktopCameraElection-btFONYx6.esm.js} +22 -10
  51. package/dist/device.d.ts +3 -3
  52. package/dist/device.esm.js +15 -15
  53. package/dist/document-capture.d.ts +2 -2
  54. package/dist/document-capture.esm.js +2 -2
  55. package/dist/document-signature.d.ts +123 -0
  56. package/dist/document-signature.esm.js +149 -0
  57. package/dist/{documentCaptureManager-C11k5BO-.esm.js → documentCaptureManager-5I3lKDVW.esm.js} +3 -3
  58. package/dist/{documentCaptureManager-BZBmcOKI.d.ts → documentCaptureManager-BkaPpoKy.d.ts} +1 -1
  59. package/dist/{documentCaptureStateMachine-g0gfL0_1.esm.js → documentCaptureStateMachine-jtQHasPA.esm.js} +7 -10
  60. package/dist/documentSignatureStateMachine-DKtU0H-F.esm.js +218 -0
  61. package/dist/dynamic-forms.esm.js +2 -2
  62. package/dist/{dynamicFormsManager-BmfCZ2zV.esm.js → dynamicFormsManager-B6Bv32wU.esm.js} +3 -3
  63. package/dist/{dynamicFormsStateMachine-B-eYytau.esm.js → dynamicFormsStateMachine-Kauq2oB-.esm.js} +10 -11
  64. package/dist/ekyb.d.ts +1 -1
  65. package/dist/ekyb.esm.js +2 -2
  66. package/dist/{ekybManager-BPaMfbgw.esm.js → ekybManager-wi135kG-.esm.js} +3 -3
  67. package/dist/{ekybStateMachine-C_lEw4I7.esm.js → ekybStateMachine-Vjb6_mFt.esm.js} +4 -6
  68. package/dist/ekyc-prefill.d.ts +1 -1
  69. package/dist/ekyc-prefill.esm.js +2 -2
  70. package/dist/ekyc.esm.js +3 -3
  71. package/dist/{ekycManager-nRT0rxei.esm.js → ekycManager-DWCL912J.esm.js} +3 -3
  72. package/dist/{ekycPrefillManager-DOTl3Y2w.d.ts → ekycPrefillManager-BcLhkpp8.d.ts} +4 -4
  73. package/dist/{ekycPrefillManager-CCtbmrFd.esm.js → ekycPrefillManager-C27Cu6rn.esm.js} +1 -1
  74. package/dist/{ekycPrefillStateMachine-XpxgCAoC.esm.js → ekycPrefillStateMachine-DqXvupSw.esm.js} +4 -6
  75. package/dist/{ekycRules-DXP2hqVw.esm.js → ekycRules-1hyjJ6bw.esm.js} +7 -4
  76. package/dist/{ekycStateMachine-nwJRel2s.esm.js → ekycStateMachine-DjiGyQtm.esm.js} +149 -13
  77. package/dist/{ekycUtils-FcqA6oU4.esm.js → ekycUtils-D9ui9Ztp.esm.js} +5 -0
  78. package/dist/electronic-signature.esm.js +1 -1
  79. package/dist/{electronicSignatureManager-M2O2VDks.esm.js → electronicSignatureManager-BHnxFx7u.esm.js} +8 -16
  80. package/dist/email.esm.js +2 -2
  81. package/dist/{emailManager-Co4jarT1.esm.js → emailManager-CfvR6pQN.esm.js} +3 -3
  82. package/dist/{emailStateMachine-CTEaYncs.esm.js → emailStateMachine-C4FouMzc.esm.js} +3 -5
  83. package/dist/{events-CP3yOzAl.esm.js → events-CsPmTidH.esm.js} +2 -2
  84. package/dist/events.d.ts +1 -0
  85. package/dist/events.esm.js +2 -2
  86. package/dist/extensibility.d.ts +14 -14
  87. package/dist/extensibility.esm.js +36 -36
  88. package/dist/face-match.esm.js +2 -2
  89. package/dist/{faceCaptureManagerFactory-3Or5qfbA.esm.js → faceCaptureManagerFactory-BjVIUTMM.esm.js} +5 -5
  90. package/dist/{faceCaptureManagerFactory-CRGajjZ4.d.ts → faceCaptureManagerFactory-DhDPxxp-.d.ts} +12 -6
  91. package/dist/{faceCaptureSetup-Cf87i0rT.esm.js → faceCaptureSetup-q33e6ah9.esm.js} +26 -15
  92. package/dist/{faceMatchManager-CGmNGbov.esm.js → faceMatchManager-CsPFaja4.esm.js} +3 -3
  93. package/dist/{faceMatchStateMachine-BuHt7kec.esm.js → faceMatchStateMachine-Co2S7iN8.esm.js} +8 -19
  94. package/dist/{feature-management-DG016L6E.esm.js → feature-management-BhRKAG--.esm.js} +3 -2
  95. package/dist/feature-management.esm.js +1 -1
  96. package/dist/field-comparison.esm.js +1 -1
  97. package/dist/{fieldComparisonManager-VgCU4X96.esm.js → fieldComparisonManager-Chn80m_n.esm.js} +4 -6
  98. package/dist/fiscal-qr.esm.js +1 -1
  99. package/dist/{fiscalQrManager-DOLq45ph.esm.js → fiscalQrManager-CpX6MOy_.esm.js} +6 -7
  100. package/dist/flow-events.d.ts +1 -1
  101. package/dist/flow.d.ts +6 -6
  102. package/dist/flow.esm.js +5 -5
  103. package/dist/{flowCompletionService-BpeAbbXc.esm.js → flowCompletionService-E_6ChYsV.esm.js} +2 -2
  104. package/dist/{flowServices-rDg1bAMs.esm.js → flowServices-C23o7MqO.esm.js} +10 -9
  105. package/dist/geolocation.esm.js +2 -2
  106. package/dist/{geolocationManager-T8m4lqvF.esm.js → geolocationManager-dgMVi0ed.esm.js} +3 -3
  107. package/dist/{geolocationStateMachine-NWmA1Dtn.esm.js → geolocationStateMachine-CCVd9xGh.esm.js} +6 -8
  108. package/dist/{getDeviceClass-DoIWuKI8.esm.js → getDeviceClass-Dcy9erbl.esm.js} +1 -1
  109. package/dist/government-validation.esm.js +2 -2
  110. package/dist/{governmentValidationManager-6JQQkzha.esm.js → governmentValidationManager-D2KGYDws.esm.js} +3 -3
  111. package/dist/{governmentValidationStateMachine-wBunpfQ9.esm.js → governmentValidationStateMachine-DRG-5jwQ.esm.js} +2 -4
  112. package/dist/home.d.ts +1 -1
  113. package/dist/home.esm.js +2 -2
  114. package/dist/http.esm.js +1 -1
  115. package/dist/id-ocr.d.ts +1 -1
  116. package/dist/id-ocr.esm.js +2 -2
  117. package/dist/id-selfie-flow.d.ts +2 -2
  118. package/dist/id-selfie-flow.esm.js +10 -10
  119. package/dist/id-verification.esm.js +2 -2
  120. package/dist/id.d.ts +3 -3
  121. package/dist/id.esm.js +3 -3
  122. package/dist/{idCaptureDefaults-Cjesf5i9.esm.js → idCaptureDefaults-BivjtJka.esm.js} +1 -1
  123. package/dist/{idCaptureManager-5-ReVgbB.esm.js → idCaptureManager-B_deOVCC.esm.js} +12 -14
  124. package/dist/{idCaptureManager-Cqx2y_fC.d.ts → idCaptureManager-DzAMWmRO.d.ts} +12 -5
  125. package/dist/{idCaptureServices-exB6I9lV.esm.js → idCaptureServices-BFCsusKB.esm.js} +17 -25
  126. package/dist/{idCaptureStateMachine-DQ14d3GR.esm.js → idCaptureStateMachine--CMATkG9.esm.js} +49 -56
  127. package/dist/{idOcrManager-im7VfJQi.esm.js → idOcrManager-C-_bzBSX.esm.js} +3 -3
  128. package/dist/{idOcrManager-C0C7lFGd.d.ts → idOcrManager-DflRx-_u.d.ts} +1 -1
  129. package/dist/{idOcrStateMachine-B832arAl.esm.js → idOcrStateMachine-BNtBkAXC.esm.js} +10 -7
  130. package/dist/{idVerificationManager-PMGM4hXY.esm.js → idVerificationManager-CdvGdtg2.esm.js} +3 -3
  131. package/dist/{idVerificationStateMachine-DeeugC00.esm.js → idVerificationStateMachine-mozw0CIg.esm.js} +2 -4
  132. package/dist/identity-reuse.esm.js +2 -2
  133. package/dist/identity-search.esm.js +3 -4
  134. package/dist/{identityReuseManager-CjFZ7WRa.esm.js → identityReuseManager-Z1Re4UGd.esm.js} +3 -3
  135. package/dist/{identityReuseStateMachine-CLFjPp13.esm.js → identityReuseStateMachine-C_3fSFCw.esm.js} +3 -7
  136. package/dist/{index-DxYNO94y.d.ts → index-C0WIMlJE.d.ts} +1 -1
  137. package/dist/{index-DM43R87x.d.ts → index-CNck5TLp.d.ts} +1 -1
  138. package/dist/index.d.ts +1 -1
  139. package/dist/index.esm.js +1 -1
  140. package/dist/{invokeOnCaptureCallback-lXP41N7b.esm.js → invokeOnCaptureCallback-DNQX9k5e.esm.js} +1 -1
  141. package/dist/kyb-checks.esm.js +2 -2
  142. package/dist/{kybChecksManager-CZfdCkLC.esm.js → kybChecksManager-D-mVF14T.esm.js} +1 -1
  143. package/dist/{kybChecksStateMachine-DkWxSU4L.esm.js → kybChecksStateMachine-BARZh9GN.esm.js} +5 -9
  144. package/dist/mandatory-consent.d.ts +2 -2
  145. package/dist/mandatory-consent.esm.js +2 -2
  146. package/dist/{mandatoryConsentManager-Dh3pBhOe.esm.js → mandatoryConsentManager-CKzzbbRe.esm.js} +3 -3
  147. package/dist/{mandatoryConsentManager-Bh1asNJh.d.ts → mandatoryConsentManager-D6tBmPDy.d.ts} +8 -8
  148. package/dist/{mandatoryConsentStateMachine-BjuI72HZ.esm.js → mandatoryConsentStateMachine-DpK7fg3E.esm.js} +4 -7
  149. package/dist/{mediaRecorderOptions-g1TwTlhd.esm.js → mediaRecorderOptions-Di_V9TnZ.esm.js} +1 -1
  150. package/dist/{multipartRecordingService-WgK8ieRI.esm.js → multipartRecordingService-CEtaAPz4.esm.js} +2 -2
  151. package/dist/{permissionGuards-D-4_VU7-.esm.js → permissionGuards-BJIaHxvI.esm.js} +1 -1
  152. package/dist/{permissionServices-DpccEnzE.esm.js → permissionServices-6Mdq1hDk.esm.js} +8 -5
  153. package/dist/phone.esm.js +2 -2
  154. package/dist/{phoneManager-rA7updqF.esm.js → phoneManager-D8-l6-0y.esm.js} +3 -3
  155. package/dist/{phoneServices-CFXcwCFr.esm.js → phoneServices-C9lFIuCM.esm.js} +3 -7
  156. package/dist/{phoneStateMachine-DKdY2Scx.esm.js → phoneStateMachine-CGLBgJJR.esm.js} +2 -2
  157. package/dist/{platform-aPh7gTWh.esm.js → platform-GIg4uPWe.esm.js} +1 -4
  158. package/dist/{processFaceMatch-B_DkDTE5.esm.js → processFaceMatch-B1Mhqkep.esm.js} +1 -1
  159. package/dist/qe-signature.esm.js +1 -1
  160. package/dist/{recordingService-DxiwS8TV.esm.js → recordingService-CLGnDCDl.esm.js} +7 -6
  161. package/dist/redirect-to-mobile.esm.js +2 -2
  162. package/dist/{redirectToMobileManager-DTB_pWuS.esm.js → redirectToMobileManager-Djb_daci.esm.js} +3 -3
  163. package/dist/{redirectToMobileStateMachine-nP9DM01_.esm.js → redirectToMobileStateMachine-BCyQFlpn.esm.js} +7 -17
  164. package/dist/{runChildModule-CXLcOcXN.esm.js → runChildModule-DF2c6TxC.esm.js} +2 -2
  165. package/dist/{sdkVersion-fqxsdqFZ.esm.js → sdkVersion-B5_kVegT.esm.js} +1 -1
  166. package/dist/selfie.d.ts +5 -5
  167. package/dist/selfie.esm.js +11 -11
  168. package/dist/{selfieErrorUtils-MOfYdGPz.esm.js → selfieErrorUtils-BVuv5qO7.esm.js} +1 -1
  169. package/dist/{selfieManager-DihwheJ6.d.ts → selfieManager-C5a6Fw6W.d.ts} +1 -1
  170. package/dist/{selfieManager-Dq8tIqGd.esm.js → selfieManager-Dnb5h3qV.esm.js} +6 -6
  171. package/dist/{selfieStateMachine-BZVDQB8R.esm.js → selfieStateMachine-BT69FLFb.esm.js} +3 -3
  172. package/dist/{session-C7x_iJ-p.esm.js → session-OCc4b-Iv.esm.js} +4 -4
  173. package/dist/session.d.ts +1 -1
  174. package/dist/session.esm.js +5 -5
  175. package/dist/{sessionInitializer-k-hKIBg8.esm.js → sessionInitializer-BUUpdBy6.esm.js} +11 -13
  176. package/dist/{setup-CpXbdA1X.d.ts → setup-BpD7lYSf.d.ts} +5 -4
  177. package/dist/{setup-BRbhjHiU.esm.js → setup-CJMohzTE.esm.js} +10 -10
  178. package/dist/signature.esm.js +2 -2
  179. package/dist/{signatureManager-BgAja97K.esm.js → signatureManager-B6dRieBV.esm.js} +3 -3
  180. package/dist/{signatureStateMachine-CVPmvU2p.esm.js → signatureStateMachine-DSW5-ZO0.esm.js} +3 -5
  181. package/dist/{stats-DoByUnTa.esm.js → stats-VqHbD5rn.esm.js} +1 -1
  182. package/dist/stats.esm.js +1 -1
  183. package/dist/{tri-CI2exudk.esm.js → tri-B5Yh5glk.esm.js} +2 -2
  184. package/dist/tri.d.ts +1 -1
  185. package/dist/tri.esm-DYdFtcDH.esm.js +3105 -0
  186. package/dist/tri.esm.js +1 -1
  187. package/dist/{trueSightService-DhW2O8mB.esm.js → trueSightService-D9D2IdEj.esm.js} +6 -7
  188. package/dist/trust-graph.esm.js +2 -2
  189. package/dist/{types-Ddc4Tr_f.d.ts → types-B2DGXHe6.d.ts} +2 -0
  190. package/dist/{types-Cpdum4vi.d.ts → types-BBHnkH6S.d.ts} +4 -4
  191. package/dist/types-BNkzXOXE.d.ts +45 -0
  192. package/dist/{types-DJPU3W2M.d.ts → types-BkWUNheX.d.ts} +1 -1
  193. package/dist/types-C2uJrJrS.d.ts +6 -0
  194. package/dist/{types-DYYMdAGv.esm.js → types-CBQN04Rh.esm.js} +2 -1
  195. package/dist/{types-CyNndVAT.d.ts → types-CaVUb1DL.d.ts} +1 -1
  196. package/dist/{types-DFP7eSle.d.ts → types-Crg7oL-l.d.ts} +1 -1
  197. package/dist/{types-9wlf1-GE.d.ts → types-x5MQKskR.d.ts} +4 -2
  198. package/dist/video-selfie.d.ts +2 -2
  199. package/dist/video-selfie.esm.js +9 -9
  200. package/dist/{videoSelfieCameraWarmer-YwO_uP-b.esm.js → videoSelfieCameraWarmer-CYEHPKK6.esm.js} +9 -9
  201. package/dist/{videoSelfieStepDetector-DRrh4P0A.d.ts → videoSelfieStepDetector-DGXi_TXk.d.ts} +18 -8
  202. package/dist/wasm.d.ts +1 -1
  203. package/dist/wasm.esm.js +1 -1
  204. package/dist/{wasmDsFlagSync-D_6e8W62.esm.js → wasmDsFlagSync-BNttW5Sm.esm.js} +1 -1
  205. package/dist/watchlist-for-business.esm.js +2 -2
  206. package/dist/watchlist.esm.js +2 -2
  207. package/dist/{watchlistForBusinessManager-BH6M4kqA.esm.js → watchlistForBusinessManager-CfLnsL8p.esm.js} +3 -3
  208. package/dist/{watchlistForBusinessStateMachine-BMWm5mcP.esm.js → watchlistForBusinessStateMachine-EzlC_4I4.esm.js} +9 -6
  209. package/dist/{watchlistManager-BDaVjzLW.esm.js → watchlistManager-CGXbemnp.esm.js} +3 -3
  210. package/dist/{watchlistStateMachine-Cx-6QAvu.esm.js → watchlistStateMachine-CsNEmiXL.esm.js} +2 -4
  211. package/dist/workflow.d.ts +1 -1
  212. package/dist/workflow.esm.js +40 -38
  213. package/package.json +6 -1
  214. package/dist/camera-9wWD-pwg.d.ts +0 -4
  215. package/dist/tri.esm-CxLWmTZk.esm.js +0 -2287
  216. package/dist/types-CE1jkHw3.d.ts +0 -6
@@ -0,0 +1,3105 @@
1
+ //#region ../../node_modules/.pnpm/@incodetech+tri-sdk@0.6.0-dev-20261118130106-3b5181d76a540a606e9971dfbe3ea37052d775a9/node_modules/@incodetech/tri-sdk/dist/tri.esm.js
2
+ function t(t, n, e) {
3
+ let i = t, r = n;
4
+ if ("devicepixelratiochange" === n) {
5
+ const t = window.devicePixelRatio;
6
+ i = window.matchMedia(`(resolution: ${t}dppx)`), r = "change";
7
+ }
8
+ i.addEventListener(r, e, {
9
+ capture: !0,
10
+ passive: !0
11
+ });
12
+ }
13
+ function n(t, n, e) {
14
+ let i = t, r = n;
15
+ if ("devicepixelratiochange" === n) {
16
+ const t = window.devicePixelRatio;
17
+ i = window.matchMedia(`(resolution: ${t}dppx)`), r = "change";
18
+ }
19
+ i.removeEventListener(r, e, { capture: !0 });
20
+ }
21
+ const i = class e {
22
+ constructor() {
23
+ this.i = !1;
24
+ }
25
+ static get instance() {
26
+ return e.l || (e.l = new e()), e.l;
27
+ }
28
+ get DEBUG() {
29
+ return this.i;
30
+ }
31
+ set DEBUG(t) {
32
+ this.i = t;
33
+ }
34
+ warn(t, n, ...e) {
35
+ this.i && this.u("warn", t, n, ...e);
36
+ }
37
+ error(t, n, ...e) {
38
+ this.i && this.u("error", t, n, ...e);
39
+ }
40
+ info(t, n, ...e) {
41
+ this.i && this.u("info", t, n, ...e);
42
+ }
43
+ fatal(t, n, e, ...i) {
44
+ this.u(t, n, e, ...i);
45
+ }
46
+ u(t, n, e, ...i) {
47
+ const r = n ? `[${n}]` : "", o = console?.[t];
48
+ o && o(`[IncodeTRI]${r} ${e}`, ...i);
49
+ }
50
+ }.instance;
51
+ const r = globalThis.setTimeout.bind(globalThis);
52
+ const o = globalThis.clearTimeout.bind(globalThis);
53
+ function s(t, n) {
54
+ try {
55
+ return t();
56
+ } catch (t) {
57
+ i.warn("utils", "safeSync swallowed error:", t);
58
+ }
59
+ }
60
+ async function a(t) {
61
+ try {
62
+ return await t();
63
+ } catch (t) {
64
+ i.warn("utils", "safeAsync swallowed error:", t);
65
+ }
66
+ }
67
+ function l(t) {
68
+ return (n) => s(() => t(n));
69
+ }
70
+ function u(t) {
71
+ return (...n) => {
72
+ try {
73
+ t(...n);
74
+ } catch (t) {
75
+ i.warn("utils", "safeTimer swallowed error:", t);
76
+ }
77
+ };
78
+ }
79
+ function c(t, n) {
80
+ return r(u(t), n);
81
+ }
82
+ function f(t) {
83
+ if (null !== t) try {
84
+ o(t);
85
+ } catch (t) {
86
+ i.warn("utils", "safeClearTimeout swallowed error:", t);
87
+ }
88
+ }
89
+ function h(t, n) {
90
+ let e = null;
91
+ const i = new Promise((t) => {
92
+ e = c(t, n);
93
+ });
94
+ return Promise.race([t.finally(() => f(e)), i]);
95
+ }
96
+ function d(t) {
97
+ function n() {
98
+ return globalThis.window && globalThis.window[t] && void 0 !== globalThis.window[t];
99
+ }
100
+ return {
101
+ get: function(e) {
102
+ if (!n()) return null;
103
+ try {
104
+ const n = window[t].getItem(e) ?? "null";
105
+ return "null" === n ? null : JSON.parse(n);
106
+ } catch {
107
+ return null;
108
+ }
109
+ },
110
+ set: function(e, i) {
111
+ n() && s(() => window[t].setItem(e, JSON.stringify(i)));
112
+ },
113
+ remove: function(e) {
114
+ n() && s(() => window[t].removeItem(e));
115
+ },
116
+ key: function(e) {
117
+ return n() ? window[t].key(e) : null;
118
+ },
119
+ get length() {
120
+ return n() ? window[t].length : 0;
121
+ }
122
+ };
123
+ }
124
+ const p = d("localStorage");
125
+ const y = d("sessionStorage");
126
+ const g = "__tri_session";
127
+ function w() {
128
+ const t = s(() => y.get(g)), n = {
129
+ setups: 0,
130
+ resets: 0,
131
+ activities: 0,
132
+ activityId: null,
133
+ previousActivityId: null
134
+ };
135
+ return t && "object" == typeof t ? ("number" == typeof t.setups && (n.setups = t.setups), "number" == typeof t.resets && (n.resets = t.resets), "number" == typeof t.activities && (n.activities = t.activities), "string" == typeof t.activityId && (n.activityId = t.activityId), "string" == typeof t.previousActivityId && (n.previousActivityId = t.previousActivityId), n) : n;
136
+ }
137
+ function v(t) {
138
+ s(() => {
139
+ const n = w();
140
+ t(n), y.set(g, n);
141
+ });
142
+ }
143
+ const b = {
144
+ "fpSignalsLib.js": "5248ca624da2f1551ff2b6264a4494368d16aa0eaba50484dfe03f940acf4611",
145
+ "fpSignalsLib.wasm": "d15c1930d57310356a7ea6cb803f590d98792409d8d8b455c00cecd9af4bf2ea",
146
+ "fpSignalsLibSimd.js": "08abec3f0f04dd816076b493712ae27920769f36e232ea8038a218cac15a3a60",
147
+ "fpSignalsLibSimd.wasm": "08c3faf6d5615dfa1ede01875c9d29305626ab2e85603bae8c4af3a15b933d3a"
148
+ };
149
+ var k = class extends Error {
150
+ constructor(t, n) {
151
+ super(n), this.name = "FpSignalsLoadError", this.reason = t;
152
+ }
153
+ };
154
+ async function S(t) {
155
+ const n = new URL(t).pathname.split("/").pop() ?? "", e = b[n];
156
+ if (!e) throw new k("integrity-mismatch", `fpSignals: no digest for ${n}`);
157
+ const i = globalThis.crypto?.subtle;
158
+ if (!i) throw new k("no-crypto-subtle", "fpSignals: crypto.subtle is unavailable, so the files cannot be verified. Serve the page over HTTPS.");
159
+ const r = await async function(t, n) {
160
+ try {
161
+ const n = await fetch(t);
162
+ if (!n.ok) throw new Error(`HTTP ${n.status}`);
163
+ return new Uint8Array(await n.arrayBuffer());
164
+ } catch (t) {
165
+ throw new k("network-or-csp", `fpSignals: ${n} could not be fetched: ${String(t)}`);
166
+ }
167
+ }(t, n);
168
+ if (T(await i.digest("SHA-256", r)) !== e) throw new k("integrity-mismatch", `fpSignals: ${n} does not match the pinned build`);
169
+ return r;
170
+ }
171
+ function T(t) {
172
+ let n = "";
173
+ for (const e of new Uint8Array(t)) n += e.toString(16).padStart(2, "0");
174
+ return n;
175
+ }
176
+ async function _(t, n, e, i = 0) {
177
+ const r = i > 0 && "function" == typeof AbortController ? new AbortController() : null, o = r ? setTimeout(function() {
178
+ r.abort();
179
+ }, i) : null;
180
+ try {
181
+ const i = globalThis.crypto?.subtle;
182
+ if (!(i && e > 0)) return null;
183
+ const o = await fetch(t, r ? { signal: r.signal } : void 0);
184
+ if (!o.ok) return null;
185
+ const s = await async function(t, n) {
186
+ const e = t.body?.getReader();
187
+ if (!e) {
188
+ const e = await t.arrayBuffer();
189
+ return e.byteLength === n ? new Uint8Array(e) : null;
190
+ }
191
+ const i = new Uint8Array(n);
192
+ let r = 0;
193
+ for (;;) {
194
+ const { done: t, value: o } = await e.read();
195
+ if (t) break;
196
+ if (r + o.byteLength > n) return e.cancel().catch(function() {}), null;
197
+ i.set(o, r), r += o.byteLength;
198
+ }
199
+ return r === n ? i : null;
200
+ }(o, e);
201
+ return s && T(await i.digest("SHA-256", s)) === n.toLowerCase() ? s : null;
202
+ } catch {
203
+ return null;
204
+ } finally {
205
+ null !== o && clearTimeout(o);
206
+ }
207
+ }
208
+ var A;
209
+ async function I(t) {
210
+ const n = t.replace(/\.wasm($|\?)/, ".js$1"), e = await async function(t) {
211
+ const n = await S(t), e = URL.createObjectURL(new Blob([n], { type: "text/javascript" }));
212
+ try {
213
+ return await import(
214
+ /* @vite-ignore */
215
+ /* webpackIgnore: true */
216
+ e
217
+ );
218
+ } catch (t) {
219
+ throw new k("network-or-csp", `fpSignals: the verified glue could not be imported: ${String(t)}`);
220
+ } finally {
221
+ URL.revokeObjectURL(e);
222
+ }
223
+ }(n), i = e.Module ?? e.default;
224
+ if (!i) throw new Error(`Failed to import Module from ${n}`);
225
+ const r = await S(t), o = window.wasmArrayBuffer;
226
+ window.wasmArrayBuffer = r;
227
+ try {
228
+ return await i({ wasmBinary: r });
229
+ } finally {
230
+ window.wasmArrayBuffer = o;
231
+ }
232
+ }
233
+ (function(t) {
234
+ t[t.Device = 1] = "Device", t[t.Behaviour = 2] = "Behaviour", t[t.PID = 3] = "PID", t[t.Network = 4] = "Network", t[t.External = 5] = "External";
235
+ })(A || (A = {}));
236
+ var E = class {
237
+ constructor() {
238
+ this.wasmModule = null, this.signalsApi = null, this.usedSimd_ = !1;
239
+ }
240
+ async initialize(t, n, e = !0, r, o) {
241
+ if (this.signalsApi) return;
242
+ const s = e && !!n;
243
+ try {
244
+ this.wasmModule = await I(s ? n : t), this.usedSimd_ = s;
245
+ } catch (n) {
246
+ if (!s) throw n;
247
+ i.warn("FpSignals", "SIMD init error:", n), this.wasmModule = await I(t), this.usedSimd_ = !1;
248
+ }
249
+ this.signalsApi = function(t, n, e) {
250
+ const r = void 0 === e ? "" : String(e);
251
+ try {
252
+ if (r) return new t.FpSignals(n ?? "", r);
253
+ if (n) return new t.FpSignals(n);
254
+ } catch (t) {
255
+ i.warn("FpSignals", "constructor arguments not supported:", t);
256
+ }
257
+ return new t.FpSignals();
258
+ }(this.wasmModule, r, o);
259
+ }
260
+ get usedSimd() {
261
+ return this.usedSimd_;
262
+ }
263
+ isReady() {
264
+ return null !== this.signalsApi;
265
+ }
266
+ setHostInfo(t, n) {
267
+ this.api().shi(t, n);
268
+ }
269
+ async collect() {
270
+ const t = this.api();
271
+ for (; !t.ppf();) await new Promise((t) => setTimeout(t, 0));
272
+ }
273
+ setBehaviourCollectionEnabled(t) {
274
+ this.api().sbc(t);
275
+ }
276
+ getSignals(t) {
277
+ return this.api().gsd(t);
278
+ }
279
+ hasMethod(t) {
280
+ return "function" == typeof this.signalsApi?.[t];
281
+ }
282
+ getSignalsWithReason(t, n) {
283
+ const e = this.api();
284
+ return "function" == typeof e.gsr ? e.gsr(t, n) : e.gsd(t);
285
+ }
286
+ getBufferFill() {
287
+ const t = this.api();
288
+ if ("function" != typeof t.gbf) return null;
289
+ const n = t.gbf();
290
+ return "number" == typeof n && Number.isFinite(n) ? n : null;
291
+ }
292
+ setCapturePolicy(t) {
293
+ const n = this.api();
294
+ return "function" == typeof n.scp && (n.scp(JSON.stringify(t)), !0);
295
+ }
296
+ setUrlSanitizer(t) {
297
+ const n = this.api();
298
+ return "function" == typeof n.sus && (n.sus(t), !0);
299
+ }
300
+ addSignal(t, n) {
301
+ const e = this.api();
302
+ return "function" == typeof e.as && !0 === e.as(t, n);
303
+ }
304
+ setSessionToken(t) {
305
+ const n = this.api();
306
+ return "function" == typeof n.sst && (n.sst(t), !0);
307
+ }
308
+ freeResources() {
309
+ this.signalsApi && (this.signalsApi.delete(), this.signalsApi = null), this.wasmModule = null;
310
+ }
311
+ api() {
312
+ if (!this.signalsApi) throw new Error("FpSignals has not been initialized");
313
+ return this.signalsApi;
314
+ }
315
+ };
316
+ function R(t, n) {
317
+ return !t || (t[n]?.enabled ?? !1);
318
+ }
319
+ const M = {
320
+ pointer: { events: {
321
+ pointer: ["pointerButtons"],
322
+ click: ["clicks"],
323
+ dblclick: ["dblclicks"],
324
+ contextmenu: ["contextmenus"]
325
+ } },
326
+ pointermove: { all: ["pointerMoves"] },
327
+ hover: { all: ["hover"] },
328
+ focus: { all: ["focus"] },
329
+ input: { all: ["input"] },
330
+ keystroke: { all: ["keys"] },
331
+ clipboard: { events: {
332
+ paste: ["paste"],
333
+ cut: ["cut"],
334
+ copy: ["copy"]
335
+ } },
336
+ form: { events: {
337
+ submit: ["submit"],
338
+ invalid: ["invalid"],
339
+ snapshot: ["snapshots"]
340
+ } },
341
+ change: { all: ["change"] },
342
+ selection: { all: ["selection"] },
343
+ scroll: { all: ["scroll"] },
344
+ wheel: { all: ["wheel"] },
345
+ viewportresize: { all: ["resize"] },
346
+ viewport: { events: {
347
+ orientationchange: ["screenOrientation"],
348
+ devicepixelratiochange: ["devicePixelRatio"]
349
+ } },
350
+ sensors: { events: {
351
+ motion: ["deviceMotion"],
352
+ orientation: ["deviceOrientation"],
353
+ light: ["ambientLight"]
354
+ } },
355
+ visibility: { all: ["visibility"] },
356
+ screen: { all: ["screenChanges"] },
357
+ networkconnection: { all: ["online"] }
358
+ };
359
+ const C = ["pointerButtons", "pointerMoves"];
360
+ function $(t, n) {
361
+ return !0 === t[n]?.enabled;
362
+ }
363
+ function P(t, n, e) {
364
+ const i = t[n];
365
+ if (!i || !i.enabled) return !1;
366
+ return ("events" in i ? i.events : void 0)?.[e]?.enabled ?? !0;
367
+ }
368
+ function x(t) {
369
+ const n = [];
370
+ for (const e of Object.keys(M)) {
371
+ const i = M[e];
372
+ if ("all" in i) $(t, e) || n.push(...i.all);
373
+ else for (const r of Object.keys(i.events)) P(t, e, r) || n.push(...i.events[r]);
374
+ }
375
+ let e = !0;
376
+ for (const t of C) n.includes(t) || (e = !1);
377
+ return e && n.push("touch"), n;
378
+ }
379
+ const U = "idle";
380
+ const B = "ready";
381
+ const O = "started";
382
+ const j = "collection-disabled";
383
+ const z = "init-failed";
384
+ const D = {
385
+ flush: {
386
+ intervalMs: 2e3,
387
+ maxIntervalMs: 3e4,
388
+ size: 50,
389
+ backoffFailureThreshold: 2
390
+ },
391
+ queue: { size: 100 }
392
+ };
393
+ const F = "redact";
394
+ const L = [
395
+ "session",
396
+ "tab",
397
+ "navigation",
398
+ "page_complexity",
399
+ "network_request",
400
+ "fp_signals_load"
401
+ ];
402
+ const N = D.queue.size;
403
+ const q = D.flush.size;
404
+ const H = ["navigation", "network-request"];
405
+ const J = Object.freeze({
406
+ session: 80,
407
+ tab: 80,
408
+ navigation: 80,
409
+ page_complexity: 80,
410
+ fp_signals: 80,
411
+ fp_signals_load: 80,
412
+ network_request: 60
413
+ });
414
+ function V(t) {
415
+ return J[t.name];
416
+ }
417
+ let W = null;
418
+ const G = 524288;
419
+ const K = /* @__PURE__ */ new Set([
420
+ "xmlhttprequest",
421
+ "fetch",
422
+ "beacon",
423
+ "navigation",
424
+ "script",
425
+ "link",
426
+ "css",
427
+ "img",
428
+ "iframe",
429
+ "video",
430
+ "audio"
431
+ ]);
432
+ const Z = /* @__PURE__ */ new Set([
433
+ "xmlhttprequest",
434
+ "fetch",
435
+ "beacon"
436
+ ]);
437
+ function X(t, n) {
438
+ return n ? t : null;
439
+ }
440
+ function Q(t, n) {
441
+ const e = t.responseStart > 0, i = e ? t.transferSize : null, r = e ? t.encodedBodySize : null, o = e ? t.decodedBodySize : null, s = e && t.nextHopProtocol || null, a = e && void 0 !== t.deliveryType ? t.deliveryType : null, l = t.responseStatus, u = void 0 !== l && 0 !== l ? l : null, c = {
442
+ name: "network_request",
443
+ timestamp: Date.now(),
444
+ performanceTime: t.startTime + t.duration,
445
+ url: n(t.name),
446
+ initiatorType: (f = t.initiatorType, K.has(f) ? f : "other"),
447
+ startTime: t.startTime,
448
+ durationMs: t.duration,
449
+ fetchStart: t.fetchStart,
450
+ domainLookupStart: X(t.domainLookupStart, e),
451
+ domainLookupEnd: X(t.domainLookupEnd, e),
452
+ connectStart: X(t.connectStart, e),
453
+ connectEnd: X(t.connectEnd, e),
454
+ secureConnectionStart: X(t.secureConnectionStart, e),
455
+ requestStart: X(t.requestStart, e),
456
+ responseStart: X(t.responseStart, e),
457
+ responseEnd: t.responseEnd,
458
+ transferSize: i,
459
+ encodedBodySize: r,
460
+ decodedBodySize: o,
461
+ nextHopProtocol: s,
462
+ deliveryType: a,
463
+ responseStatus: u
464
+ };
465
+ var f;
466
+ return Object.assign(c, function(t, n) {
467
+ return {
468
+ dnsLookupMs: X(t.domainLookupEnd - t.domainLookupStart, n),
469
+ tcpConnectMs: X(t.connectEnd - t.connectStart, n),
470
+ tlsHandshakeMs: X(t.connectEnd > 0 && t.secureConnectionStart > 0 ? t.connectEnd - t.secureConnectionStart : 0, n),
471
+ ttfbMs: X(t.responseStart - t.requestStart, n),
472
+ responseDownloadMs: X(t.responseEnd - t.responseStart, n)
473
+ };
474
+ }(t, e)), c;
475
+ }
476
+ function Y() {}
477
+ function tt(t, n, e, i, r) {
478
+ return {
479
+ name: "navigation",
480
+ timestamp: Date.now(),
481
+ ts: performance.now(),
482
+ phase: t,
483
+ type: n,
484
+ from: e.from,
485
+ to: e.to,
486
+ timeOrigin: i,
487
+ timing: r
488
+ };
489
+ }
490
+ function nt(t, n) {
491
+ if (t.firstElementChild) return t.firstElementChild;
492
+ let e = t;
493
+ for (; null !== e && e !== n;) {
494
+ if (e.nextElementSibling) return e.nextElementSibling;
495
+ e = e.parentElement;
496
+ }
497
+ return null;
498
+ }
499
+ function et(t, n) {
500
+ switch (t) {
501
+ case "FORM":
502
+ n.formCount++;
503
+ break;
504
+ case "INPUT":
505
+ n.inputCount++;
506
+ break;
507
+ case "BUTTON":
508
+ n.buttonCount++;
509
+ break;
510
+ case "A":
511
+ n.linkCount++;
512
+ break;
513
+ case "SELECT":
514
+ n.selectCount++;
515
+ break;
516
+ case "TEXTAREA":
517
+ n.textareaCount++;
518
+ break;
519
+ case "IFRAME":
520
+ n.iframeCount++;
521
+ break;
522
+ case "SCRIPT":
523
+ n.scriptCount++;
524
+ break;
525
+ case "IMG": n.imageCount++;
526
+ }
527
+ }
528
+ function it(t) {
529
+ let n = null, e = null, i = null;
530
+ function r() {
531
+ if (f(n), n = null, f(i), i = null, null !== e) {
532
+ const t = e;
533
+ e = null, s(() => window.cancelIdleCallback?.(t));
534
+ }
535
+ }
536
+ return {
537
+ schedule: function(o, s, a) {
538
+ r();
539
+ const l = function(t) {
540
+ if (!t) return null;
541
+ try {
542
+ return new URL(t, location.href).pathname;
543
+ } catch {
544
+ return null;
545
+ }
546
+ }(a);
547
+ n = c(() => {
548
+ n = null, function(t) {
549
+ const n = window;
550
+ "function" != typeof n.requestIdleCallback ? i = c(() => {
551
+ i = null, t();
552
+ }, 0) : e = n.requestIdleCallback(u(() => {
553
+ e = null, t();
554
+ }), { timeout: 2e3 });
555
+ }(() => function(n, e, i) {
556
+ const r = function(t = 2e4) {
557
+ const n = {
558
+ textLength: 0,
559
+ interactiveCount: 0,
560
+ scrollHeight: 0,
561
+ innerHeight: 0,
562
+ nodeCount: 0,
563
+ formCount: 0,
564
+ inputCount: 0,
565
+ buttonCount: 0,
566
+ linkCount: 0,
567
+ selectCount: 0,
568
+ textareaCount: 0,
569
+ iframeCount: 0,
570
+ scriptCount: 0,
571
+ imageCount: 0,
572
+ truncated: !1
573
+ }, e = document.documentElement;
574
+ let i = e;
575
+ for (; null !== i;) {
576
+ if (n.nodeCount >= t) {
577
+ n.truncated = !0;
578
+ break;
579
+ }
580
+ n.nodeCount++, et(i.tagName, n), i = nt(i, e);
581
+ }
582
+ return n.textLength = document.body?.textContent?.length ?? 0, n.interactiveCount = document.querySelectorAll("input,button,a,select,textarea").length, n.scrollHeight = document.documentElement?.scrollHeight ?? 0, n.innerHeight = window.innerHeight, n;
583
+ }(), o = {
584
+ name: "page_complexity",
585
+ timestamp: Date.now(),
586
+ ts: performance.now(),
587
+ phase: n,
588
+ type: e,
589
+ path: i,
590
+ ...r
591
+ };
592
+ t.push(o);
593
+ }(o, s, l));
594
+ }, "load" === o ? 1500 : 500);
595
+ },
596
+ dispose: r
597
+ };
598
+ }
599
+ function rt() {
600
+ return function() {};
601
+ }
602
+ const ot = {
603
+ pointer: {
604
+ create: rt,
605
+ layer: "behavioral",
606
+ events: [
607
+ "pointer",
608
+ "click",
609
+ "dblclick",
610
+ "contextmenu"
611
+ ]
612
+ },
613
+ pointermove: {
614
+ create: rt,
615
+ layer: "behavioral"
616
+ },
617
+ focus: {
618
+ create: rt,
619
+ layer: "behavioral"
620
+ },
621
+ input: {
622
+ create: rt,
623
+ layer: "behavioral"
624
+ },
625
+ keystroke: {
626
+ create: rt,
627
+ layer: "behavioral"
628
+ },
629
+ clipboard: {
630
+ create: rt,
631
+ layer: "behavioral",
632
+ events: [
633
+ "paste",
634
+ "cut",
635
+ "copy"
636
+ ]
637
+ },
638
+ form: {
639
+ create: rt,
640
+ layer: "behavioral",
641
+ events: [
642
+ "submit",
643
+ "invalid",
644
+ "snapshot"
645
+ ]
646
+ },
647
+ change: {
648
+ create: rt,
649
+ layer: "behavioral"
650
+ },
651
+ selection: {
652
+ create: rt,
653
+ layer: "behavioral"
654
+ },
655
+ tab: {
656
+ create: rt,
657
+ layer: "session",
658
+ events: ["state", "count"]
659
+ },
660
+ visibility: {
661
+ create: rt,
662
+ layer: "session"
663
+ },
664
+ navigation: {
665
+ create: function(e) {
666
+ let i = e.sanitizeUrl(document.referrer || "");
667
+ const r = it(e);
668
+ function o(t) {
669
+ e.push(t), i = t.to ?? "", r && "hide" !== t.phase && r.schedule(t.phase, t.type, t.to);
670
+ }
671
+ const a = l(() => {
672
+ const [t] = performance.getEntriesByType("navigation");
673
+ var n;
674
+ o(tt("load", t?.type ?? "navigate", {
675
+ from: document.referrer ? e.sanitizeUrl(document.referrer) : null,
676
+ to: e.sanitizeUrl(location.href)
677
+ }, performance.timeOrigin, t ? {
678
+ fetchStart: (n = t).fetchStart,
679
+ domainLookupStart: n.domainLookupStart,
680
+ domainLookupEnd: n.domainLookupEnd,
681
+ connectStart: n.connectStart,
682
+ connectEnd: n.connectEnd,
683
+ requestStart: n.requestStart,
684
+ responseStart: n.responseStart,
685
+ responseEnd: n.responseEnd,
686
+ domInteractive: n.domInteractive,
687
+ domContentLoadedEventStart: n.domContentLoadedEventStart,
688
+ domContentLoadedEventEnd: n.domContentLoadedEventEnd,
689
+ domComplete: n.domComplete,
690
+ loadEventStart: n.loadEventStart,
691
+ loadEventEnd: n.loadEventEnd,
692
+ redirectCount: n.redirectCount,
693
+ transferSize: n.transferSize,
694
+ encodedBodySize: n.encodedBodySize,
695
+ decodedBodySize: n.decodedBodySize
696
+ } : void 0));
697
+ }), u = l((t) => {
698
+ const n = t;
699
+ if (null === n.navigationType) return;
700
+ const r = e.sanitizeUrl(location.href);
701
+ r !== i && o(tt("change", n.navigationType, {
702
+ from: i,
703
+ to: r
704
+ }, performance.timeOrigin));
705
+ }), c = l(() => h("traverse")), f = l(() => h("hashchange"));
706
+ function h(t) {
707
+ const n = e.sanitizeUrl(location.href);
708
+ "hashchange" === t && n === i || o(tt("change", t, {
709
+ from: i,
710
+ to: n
711
+ }, performance.timeOrigin));
712
+ }
713
+ const d = history.pushState, p = history.replaceState, y = function(...t) {
714
+ const n = d.apply(this, t);
715
+ return s(() => h("push")), n;
716
+ }, g = function(...t) {
717
+ const n = p.apply(this, t);
718
+ return s(() => h("replace")), n;
719
+ };
720
+ return window.navigation ? t(window.navigation, "currententrychange", u) : (history.pushState = y, history.replaceState = g, t(window, "popstate", c), t(window, "hashchange", f)), "complete" === document.readyState ? a(new Event("load")) : t(window, "load", a), () => {
721
+ r?.dispose(), window.navigation ? n(window.navigation, "currententrychange", u) : (history.pushState === y && (history.pushState = d), history.replaceState === g && (history.replaceState = p), n(window, "popstate", c), n(window, "hashchange", f)), n(window, "load", a);
722
+ };
723
+ },
724
+ layer: "session"
725
+ },
726
+ networkconnection: {
727
+ create: rt,
728
+ layer: "session"
729
+ },
730
+ scroll: {
731
+ create: rt,
732
+ layer: "behavioral"
733
+ },
734
+ viewportresize: {
735
+ create: rt,
736
+ layer: "behavioral"
737
+ },
738
+ viewport: {
739
+ create: rt,
740
+ layer: "behavioral",
741
+ events: ["orientationchange", "devicepixelratiochange"]
742
+ },
743
+ sensors: {
744
+ create: rt,
745
+ layer: "behavioral",
746
+ events: [
747
+ "motion",
748
+ "orientation",
749
+ "light"
750
+ ]
751
+ },
752
+ "network-request": {
753
+ create: function(t) {
754
+ var n, e;
755
+ const r = function(t, n, e, r = Z) {
756
+ if ("undefined" == typeof PerformanceObserver) return Y;
757
+ let o = null;
758
+ try {
759
+ o = new PerformanceObserver((i) => {
760
+ for (const o of i.getEntries()) {
761
+ const i = o;
762
+ r.has(i.initiatorType) && (n(i.name) || t(Q(i, e)));
763
+ }
764
+ }), o.observe({
765
+ type: "resource",
766
+ buffered: !0
767
+ });
768
+ } catch {
769
+ return i.warn("network-request", "PerformanceObserver failed to start"), Y;
770
+ }
771
+ return function() {
772
+ o?.disconnect(), o = null;
773
+ };
774
+ }(function(n) {
775
+ s(() => t.push(n));
776
+ }, (n = t.ignoredOrigins, e = t.ignoredUrls, function(t) {
777
+ try {
778
+ return !!e?.has(t) || n.has(new URL(t).origin);
779
+ } catch {
780
+ return !1;
781
+ }
782
+ }), t.sanitizeUrl);
783
+ return function() {
784
+ r();
785
+ };
786
+ },
787
+ layer: "session"
788
+ },
789
+ screen: {
790
+ create: rt,
791
+ layer: "session"
792
+ },
793
+ wheel: {
794
+ create: rt,
795
+ layer: "behavioral"
796
+ },
797
+ hover: {
798
+ create: rt,
799
+ layer: "behavioral"
800
+ },
801
+ fpsignals: {
802
+ create: function(e, r = "off", o) {
803
+ const c = R(o, "device"), f = R(o, "pid"), h = R(o, "behaviour"), d = performance.now(), p = new E();
804
+ let y, g = !1, v = !1, b = null, S = null, T = null, _ = null, I = null, M = null, C = null, $ = !1, P = !1, U = 0, B = !1, O = null, j = "", z = null, D = "", F = [], H = 0, J = null;
805
+ const K = new Promise(function(t) {
806
+ y = t;
807
+ });
808
+ function Z(t, n) {
809
+ if (!t) return !1;
810
+ const i = {
811
+ name: "fp_signals",
812
+ timestamp: Date.now(),
813
+ signals: t
814
+ };
815
+ return n && (i.reason = n), e.push(i), !0;
816
+ }
817
+ function X(t, n) {
818
+ if (!0 === s(() => e.pulseGuard?.isOff?.())) return F = [], void (H = 0);
819
+ if (!(t.length > G)) for (F.push({
820
+ text: t,
821
+ reason: n
822
+ }), H += t.length; F.length > 16 || H > G;) {
823
+ const t = F.shift();
824
+ if (!t) break;
825
+ H -= t.text.length;
826
+ }
827
+ }
828
+ function Q() {
829
+ const t = e.getActivityId?.() ?? "";
830
+ t !== O && p.setSessionToken(t) && (O = t);
831
+ }
832
+ function Y() {
833
+ const t = e.getActivityId?.() ?? "";
834
+ t && t !== j && ct();
835
+ }
836
+ function tt(t, n) {
837
+ if (!v || !p.isReady()) return null;
838
+ s(Q), s(Y);
839
+ const i = n ? p.getSignalsWithReason(t, n) : p.getSignals(t), r = i ? s(() => e.pulseGuard?.signDocument(i) ?? null) ?? i : i;
840
+ return Z(r, n) ? (t === A.Device ? (z = {
841
+ text: i,
842
+ reason: n
843
+ }, D = r === i ? "" : s(() => e.pulseGuard?.sessionId?.() ?? "") ?? "") : !e.pulseGuard || r !== i || t !== A.Network && t !== A.External || X(i, n), i) : null;
844
+ }
845
+ function nt(t) {
846
+ return !!h && null !== tt(A.Behaviour, t);
847
+ }
848
+ function et(t) {
849
+ if (!v || !b) return !1;
850
+ U = 0;
851
+ const n = null !== tt(A.Network, t), e = null !== tt(A.External, t);
852
+ return n || e;
853
+ }
854
+ function it(t) {
855
+ s(() => et(function(t) {
856
+ return "interval" === t || "submit" === t ? t : "capacity" === t ? "fill" : void 0;
857
+ }(t)));
858
+ }
859
+ function rt(t) {
860
+ U += t, B || e.requestFlush?.(U >= q);
861
+ }
862
+ function ot(t) {
863
+ return s(() => tt(t)) ?? null;
864
+ }
865
+ function st() {
866
+ null !== I && clearInterval(I), null !== M && clearTimeout(M), I = null, M = null;
867
+ }
868
+ function at(t = "partial") {
869
+ return !(!c || $ || P || !v || !p.isReady() || !p.hasMethod("gsr") || null === tt(A.Device, t) || ($ = !0, st(), 0));
870
+ }
871
+ function lt() {
872
+ c && p.hasMethod("gsr") && (I = setInterval(u(function() {
873
+ at();
874
+ }), 250), M = setTimeout(u(st), 5e3));
875
+ }
876
+ function ut() {
877
+ if (!v || !p.isReady()) return;
878
+ const t = p.getBufferFill();
879
+ null !== t && t >= .5 && (nt("fill"), et("fill"));
880
+ }
881
+ function ct() {
882
+ var t;
883
+ j = e.getActivityId?.() ?? "", e.push((t = e.collectorSelection ?? {}, {
884
+ name: "session",
885
+ timestamp: Date.now(),
886
+ ts: performance.now(),
887
+ ...w(),
888
+ collectors: t
889
+ }));
890
+ }
891
+ function ft() {
892
+ if (b) if (p.hasMethod("as")) {
893
+ B = !0;
894
+ try {
895
+ b.open(function(t, n) {
896
+ return p.addSignal(t, n);
897
+ });
898
+ } finally {
899
+ B = !1;
900
+ }
901
+ U > 0 && et("load") && e.requestFlush?.(!0);
902
+ } else b.close();
903
+ }
904
+ function ht() {
905
+ p.setUrlSanitizer(null);
906
+ }
907
+ W = K;
908
+ const dt = l((t) => {
909
+ ("click" !== t.type || t.target instanceof Element && t.target.closest("[data-tri-flush]")) && (nt("click" === t.type ? "flush-click" : "submit"), e.flush());
910
+ }), pt = e.registerBehaviourReader ? e.registerBehaviourReader(function(t) {
911
+ s(() => J?.());
912
+ const n = s(() => at("partial-now")) ?? !1, e = s(() => nt(t)) ?? !1, i = s(() => et(t)) ?? !1;
913
+ return n || e || i;
914
+ }) : null;
915
+ return s(() => e.pulseGuard?.onSessionInstalled?.(function(t) {
916
+ s(() => function(t) {
917
+ const n = z, i = e.pulseGuard;
918
+ if (g || !n || !i) return;
919
+ if (D === t.session) return;
920
+ if (D && t.linkedFrom === D) return void (D = t.session);
921
+ const r = i.signDocument(n.text);
922
+ r && i.sessionId?.() === t.session && Z(r, n.reason) && (D = t.session);
923
+ }(t)), s(() => function(t) {
924
+ const n = e.pulseGuard;
925
+ if (g || !n || 0 === F.length) return;
926
+ if (n.sessionId?.() !== t.session) return;
927
+ const i = F;
928
+ F = [], H = 0;
929
+ for (const t of i) {
930
+ const e = n.signDocument(t.text);
931
+ e && e !== t.text ? Z(e, t.reason) : X(t.text, t.reason);
932
+ }
933
+ }(t));
934
+ })), s(function() {
935
+ if (!e.registerEventRouter) return;
936
+ const t = function(t = {}) {
937
+ const n = t.maxPending ?? N;
938
+ let e = [], r = null, o = !1;
939
+ function s(t, n) {
940
+ try {
941
+ const { signalsType: e, jsonValue: r } = function(t) {
942
+ if ("network_request" === t.name) {
943
+ const { name: n, ...e } = t;
944
+ return {
945
+ signalsType: A.Network,
946
+ jsonValue: JSON.stringify(e)
947
+ };
948
+ }
949
+ return {
950
+ signalsType: A.External,
951
+ jsonValue: JSON.stringify(t)
952
+ };
953
+ }(n);
954
+ if (t(e, r)) return !0;
955
+ i.warn("fpSignals", "the module refused a TRI event — dropped", n.name);
956
+ } catch (t) {
957
+ i.warn("fpSignals", "as threw — event dropped:", t);
958
+ }
959
+ return !1;
960
+ }
961
+ function a(n) {
962
+ if (0 !== n && t.onHanded) try {
963
+ t.onHanded(n);
964
+ } catch (t) {
965
+ i.warn("fpSignals", "onHanded threw:", t);
966
+ }
967
+ }
968
+ const l = {
969
+ route: function(t) {
970
+ return !(!function(t) {
971
+ return !(!L.includes(t.name) || "fp_signals_load" === t.name && !1 === t.ok);
972
+ }(t) || !o && (r ? (a(s(r, t) ? 1 : 0), 0) : (e.length < n ? e.push(t) : function(t) {
973
+ const n = V(t);
974
+ for (let r = 0; r < e.length; r++) if (V(e[r]) < n) return e.splice(r, 1), e.push(t), void i.warn("fpSignals", "TRI event buffer full — a lower-priority event dropped");
975
+ i.warn("fpSignals", "TRI event buffer full — event dropped", t.name);
976
+ }(t), 0)));
977
+ },
978
+ open: function(t) {
979
+ if (o) return;
980
+ r = t;
981
+ const n = e;
982
+ e = [];
983
+ let i = 0;
984
+ for (let e = 0; e < n.length; e++) s(t, n[e]) && i++;
985
+ a(i);
986
+ },
987
+ close: function() {
988
+ o = !0, r = null, e = [];
989
+ }
990
+ };
991
+ return t.beforeFlush && (l.beforeFlush = t.beforeFlush), l;
992
+ }({
993
+ onHanded: rt,
994
+ beforeFlush: it
995
+ });
996
+ b = t, S = e.registerEventRouter(t), ct();
997
+ }), a(async () => {
998
+ const n = await ("object" != typeof WebAssembly || null === WebAssembly ? Promise.resolve("no-webassembly") : new Promise(function(t) {
999
+ let n = !1;
1000
+ C = function() {
1001
+ n || (n = !0, clearTimeout(r), t("timeout"));
1002
+ };
1003
+ const r = setTimeout(u(function() {
1004
+ n || (n = !0, t("timeout"));
1005
+ }), 3e4);
1006
+ function o(e) {
1007
+ n ? null === e && s(() => p.freeResources()) : (n = !0, clearTimeout(r), t(e));
1008
+ }
1009
+ p.initialize("https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLib.wasm", "https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLibSimd.wasm", !0, s(() => e.getTabId()) || void 0).then(function() {
1010
+ o(null);
1011
+ }, function(t) {
1012
+ i.warn("fpSignals", "module failed to load:", t), o(function(t) {
1013
+ return t instanceof k ? t.reason : "instantiate-failed";
1014
+ }(t));
1015
+ });
1016
+ }));
1017
+ if (null !== n && s(() => b?.close()), g || s(() => function(t) {
1018
+ const n = null === t, i = {
1019
+ name: "fp_signals_load",
1020
+ timestamp: Date.now(),
1021
+ loadMs: Math.max(0, performance.now() - d),
1022
+ simd: n && p.usedSimd,
1023
+ ok: n
1024
+ };
1025
+ null !== t && (i.reason = t);
1026
+ const r = e.pulseGuard;
1027
+ if (!r) return void e.push(i);
1028
+ let o = !1;
1029
+ const a = r.telemetry(d, function(t) {
1030
+ o = !0, J = null, g || (i.pulseguard = t.pulseguard, void 0 !== t.pulseguardMs && (i.pulseguardMs = t.pulseguardMs), s(() => e.push(i)));
1031
+ });
1032
+ o || "function" != typeof a || (J = a);
1033
+ }(n)), null !== n) return;
1034
+ if (g) return void p.freeResources();
1035
+ if (v = !0, s(() => p.setHostInfo(e.host.platform, e.host.version)), s(() => p.setUrlSanitizer(function(t) {
1036
+ return e.sanitizeUrl(t);
1037
+ })), s(() => {
1038
+ return p.setCapturePolicy({
1039
+ v: 2,
1040
+ element: e.captureElementLevel,
1041
+ content: r,
1042
+ ignore: ["[data-tri-ignore]"],
1043
+ redact: ["[data-tri-redact]"],
1044
+ redactAttrsAttribute: "data-tri-redact-attrs",
1045
+ interactive: ["[data-tri-interactive]"],
1046
+ off: (t = e.collectorSelection) ? x(t) : []
1047
+ });
1048
+ var t;
1049
+ }), s(Q), s(ft), h && (s(() => p.setBehaviourCollectionEnabled(!0)), T = setInterval(u(function() {
1050
+ nt("interval");
1051
+ }), 2e3), t(document, "submit", dt), t(document, "click", dt)), p.hasMethod("gbf") && (_ = setInterval(u(ut), 1e3)), !c && !f) return;
1052
+ if (s(lt), await p.collect(), P = !0, st(), g) return;
1053
+ const o = c ? ot(A.Device) : null, a = f ? ot(A.PID) : null;
1054
+ y({
1055
+ pid: a,
1056
+ device: o
1057
+ });
1058
+ }).then(function() {
1059
+ y(null);
1060
+ }), function() {
1061
+ s(() => J?.()), g = !0, s(() => e.pulseGuard?.onSessionInstalled?.(null)), C?.(), y(null), W === K && (W = null), null !== T && clearInterval(T), null !== _ && clearInterval(_), st(), n(document, "submit", dt), n(document, "click", dt), pt?.(), s(() => {
1062
+ nt("stop");
1063
+ }), s(() => {
1064
+ et("stop");
1065
+ }), s(() => b?.close()), s(() => S?.()), v && s(ht), s(() => p.freeResources());
1066
+ };
1067
+ },
1068
+ layer: "device-fingerprinting",
1069
+ events: [
1070
+ "device",
1071
+ "pid",
1072
+ "behaviour"
1073
+ ]
1074
+ }
1075
+ };
1076
+ const st = Object.keys(ot);
1077
+ const at = [
1078
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
1079
+ /^0b[01]+$/i,
1080
+ /^0o[0-7]+$/i,
1081
+ /^0x[0-9a-f]+$/i,
1082
+ /^[a-z][a-z0-9]{1,12}:[A-Za-z0-9+/=_-]{6,}$/i,
1083
+ /^[a-z]{2,8}_(?=.*\d)[A-Za-z0-9]{3,}$/,
1084
+ /^\d{4,}$/,
1085
+ /@/,
1086
+ /^[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{10,}$/,
1087
+ /^[A-Za-z0-9_-]{20,}={0,2}$/,
1088
+ /^[0-9a-f]{7,}$/i
1089
+ ];
1090
+ function lt(t) {
1091
+ try {
1092
+ const n = new URL(t, location.href);
1093
+ n.username = "", n.password = "", n.hash = "";
1094
+ const e = [...n.searchParams.keys()], i = e.length > 0 ? "?" + e.map((t) => `${encodeURIComponent(t)}=<redacted>`).join("&") : "";
1095
+ n.search = "", n.pathname = n.pathname.split("/").map((t) => "" !== t && function(t) {
1096
+ for (const n of at) if (n.test(t)) return !0;
1097
+ return !1;
1098
+ }(t) ? ":param" : t).join("/");
1099
+ const r = n.origin + n.pathname + i;
1100
+ return r.length > 2048 ? r.slice(0, 2048) : r;
1101
+ } catch {
1102
+ return "";
1103
+ }
1104
+ }
1105
+ function ut() {
1106
+ const t = {};
1107
+ for (const n of st) t[n] = ht(n, void 0, !0);
1108
+ return t;
1109
+ }
1110
+ function ct(t) {
1111
+ const n = {};
1112
+ for (const e of st) n[e] = ht(e, void 0, t[ot[e].layer] ?? !1);
1113
+ return n;
1114
+ }
1115
+ function ft(t) {
1116
+ for (const n of Object.keys(t)) -1 === st.indexOf(n) && i.fatal("warn", "SDK", `collectors has an unknown key '${n}' — ignored. Known collectors: ${st.join(", ")}.`);
1117
+ const n = {};
1118
+ for (const e of st) {
1119
+ const i = t[e];
1120
+ n[e] = ht(e, i, i?.enabled ?? !1);
1121
+ }
1122
+ return n;
1123
+ }
1124
+ function ht(t, n, e) {
1125
+ const i = ot[t]?.events ?? [];
1126
+ if (0 === i.length) return { enabled: e };
1127
+ const r = n?.events, o = {};
1128
+ for (const t of i) o[t] = { enabled: r?.[t] ?? !0 };
1129
+ return {
1130
+ enabled: e,
1131
+ events: o
1132
+ };
1133
+ }
1134
+ function dt(t) {
1135
+ if (!t) return null;
1136
+ const n = t.split(".")[1], e = atob(n.replace(/-/g, "+").replace(/_/g, "/"));
1137
+ return JSON.parse(e);
1138
+ }
1139
+ const pt = function(t, n = 30) {
1140
+ if (!t) return !0;
1141
+ const e = dt(t);
1142
+ return !e || "number" != typeof e.exp || 1e3 * e.exp <= Date.now() + 1e3 * n;
1143
+ };
1144
+ async function yt(t, n) {
1145
+ return globalThis.navigator && "locks" in globalThis.navigator && "request" in globalThis.navigator.locks && "query" in globalThis.navigator.locks ? navigator.locks.request(t, { mode: "exclusive" }, async () => a(n)) : a(n);
1146
+ }
1147
+ const gt = "__tri";
1148
+ const wt = `${gt}_activity_token`;
1149
+ const vt = `${gt}_activity_id`;
1150
+ const mt = `${gt}_activity_status`;
1151
+ const bt = "__tri_activity_lock";
1152
+ var kt = class {
1153
+ constructor(t) {
1154
+ this.context = t, this.h = null, this.p = null, this.m = null, this.k = null, this.S = null, this.T = !1;
1155
+ }
1156
+ getToken() {
1157
+ return this.h;
1158
+ }
1159
+ getActivityId() {
1160
+ return this.p ?? "";
1161
+ }
1162
+ isActive() {
1163
+ return "ACTIVE" === this.m && null !== this.h;
1164
+ }
1165
+ async start() {
1166
+ return this.T = !0, this.k || (this.k = this._()), this.k;
1167
+ }
1168
+ async stop() {
1169
+ const t = this.A();
1170
+ this.S = t;
1171
+ try {
1172
+ await t;
1173
+ } finally {
1174
+ this.S === t && (this.S = null);
1175
+ }
1176
+ }
1177
+ async A() {
1178
+ this.T = !1, this.m = "INACTIVE", this.I(null), this.k = null, this.h && await this.context.stopActivity(), this.R(null);
1179
+ }
1180
+ async refresh() {
1181
+ if (!this.T) return;
1182
+ const t = this.h;
1183
+ await yt(bt, async () => {
1184
+ if (this.h && this.h !== t && !pt(this.h) && "ACTIVE" === this.m) return;
1185
+ const n = this.M();
1186
+ if (n && n.token !== t && !pt(n.token) && "ACTIVE" === n.activityStatus) return this.R(n), void this.context.onActivityAdopted?.();
1187
+ this.C(), await this.$();
1188
+ });
1189
+ }
1190
+ async _() {
1191
+ try {
1192
+ if (this.S && await this.S, this.h && !pt(this.h)) return;
1193
+ await yt(bt, async () => {
1194
+ await this.$();
1195
+ });
1196
+ } finally {
1197
+ this.k = null;
1198
+ }
1199
+ }
1200
+ async $() {
1201
+ const t = this.M();
1202
+ if (t && !pt(t.token) && "ACTIVE" === t.activityStatus) return this.R(t), void this.context.onActivityAdopted?.();
1203
+ t && this.C();
1204
+ const n = await this.context.startActivity();
1205
+ if (!n.ok) return void this.context.onActivityStarted?.(null);
1206
+ if (!n.data.token) return void this.context.onActivityStarted?.(null);
1207
+ const e = n.data;
1208
+ this.R(e), this.P(e), this.context.onActivityStarted?.(e.pulseguard);
1209
+ }
1210
+ M() {
1211
+ const [t, n, e] = [
1212
+ p.get(wt),
1213
+ p.get(vt),
1214
+ p.get(mt)
1215
+ ];
1216
+ return t && n && e ? {
1217
+ token: t,
1218
+ activityId: n,
1219
+ activityStatus: e
1220
+ } : ((t || n || e) && this.C(), null);
1221
+ }
1222
+ P(t) {
1223
+ p.set(wt, t.token), p.set(vt, t.activityId), p.set(mt, t.activityStatus);
1224
+ }
1225
+ C() {
1226
+ this.I(null), this.R(null);
1227
+ }
1228
+ I(t) {
1229
+ if (!t) return p.remove(wt), p.remove(vt), void p.remove(mt);
1230
+ p.set(wt, t.token), p.set(vt, t.activityId), p.set(mt, t.activityStatus);
1231
+ }
1232
+ R(t) {
1233
+ if (!t) return this.h = null, this.p = null, void (this.m = null);
1234
+ var n;
1235
+ (n = t.activityId) && v(function(t) {
1236
+ t.activityId !== n && (t.previousActivityId = t.activityId, t.activityId = n, t.activities += 1);
1237
+ }), this.h = t.token, this.p = t.activityId, this.m = t.activityStatus;
1238
+ }
1239
+ };
1240
+ const St = [
1241
+ 401,
1242
+ 403,
1243
+ 409
1244
+ ];
1245
+ const Tt = Object.freeze({ "fp-signals": "/events/capture/fp-signals" });
1246
+ function _t(t) {
1247
+ return "fp_signals" === t.name || "fp_signals_load" === t.name && !1 === t.ok ? "fp-signals" : null;
1248
+ }
1249
+ const At = new Array(256);
1250
+ for (let t = 0; t < 256; t++) At[t] = (t + 256).toString(16).slice(1);
1251
+ const It = /* @__PURE__ */ new Uint8Array(16);
1252
+ function Et(t) {
1253
+ return At[t[0]] + At[t[1]] + At[t[2]] + At[t[3]] + "-" + At[t[4]] + At[t[5]] + "-" + At[t[6]] + At[t[7]] + "-" + At[t[8]] + At[t[9]] + "-" + At[t[10]] + At[t[11]] + At[t[12]] + At[t[13]] + At[t[14]] + At[t[15]];
1254
+ }
1255
+ function Rt() {
1256
+ return crypto.randomUUID();
1257
+ }
1258
+ function Mt() {
1259
+ return crypto.getRandomValues(It), It[6] = 15 & It[6] | 64, It[8] = 63 & It[8] | 128, Et(It);
1260
+ }
1261
+ function Ct() {
1262
+ for (let t = 0; t < 16; t++) It[t] = 256 * Math.random() | 0;
1263
+ return It[6] = 15 & It[6] | 64, It[8] = 63 & It[8] | 128, Et(It);
1264
+ }
1265
+ const $t = function() {
1266
+ if ("undefined" != typeof crypto) {
1267
+ if ("function" == typeof crypto.randomUUID) return Rt;
1268
+ if ("function" == typeof crypto.getRandomValues) return Mt;
1269
+ }
1270
+ return Ct;
1271
+ }();
1272
+ function Pt() {
1273
+ return $t();
1274
+ }
1275
+ function xt() {
1276
+ try {
1277
+ if ("undefined" != typeof crypto && "function" == typeof crypto.getRandomValues) {
1278
+ const t = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
1279
+ let n = "";
1280
+ for (let e = 0; e < 16; e++) n += At[t[e]];
1281
+ return n;
1282
+ }
1283
+ } catch {}
1284
+ return Pt().replace(/-/g, "");
1285
+ }
1286
+ const Ut = 1048576;
1287
+ const Bt = "__tri_pulseguard_prev";
1288
+ const Ot = 524288;
1289
+ var jt = class {
1290
+ constructor(t, n) {
1291
+ this.U = t, this.B = n, this.O = [], this.j = null, this.D = [], this.F = null, this.T = !1, this.L = !0, this.N = 0, this.q = 0, this.H = 0, this.J = null, this.V = !1, this.W = !1, this.G = t.flush.intervalMs;
1292
+ }
1293
+ push(t) {
1294
+ this.T ? this.J && this.K(this.J, t) || (null !== _t(t) ? (this.Z(t), this.X()) : i.warn("Transport", "event has no capture route — dropped", t.name)) : i.warn("Transport", "push() called before start() — event dropped");
1295
+ }
1296
+ setEventRouter(t) {
1297
+ this.J = t;
1298
+ }
1299
+ getEventRouter() {
1300
+ return this.J;
1301
+ }
1302
+ requestFlush(t) {
1303
+ if (this.T && this.L) return t && !this.V && this.B.isActivityActive() ? (f(this.j), this.j = null, void this.flush("capacity")) : void this.Y();
1304
+ }
1305
+ tt(t) {
1306
+ const n = this.J;
1307
+ n?.beforeFlush && this.holdCapacityFlush(() => {
1308
+ try {
1309
+ n.beforeFlush?.(t);
1310
+ } catch (t) {
1311
+ i.warn("Transport", "event router beforeFlush threw:", t);
1312
+ }
1313
+ });
1314
+ }
1315
+ K(t, n) {
1316
+ try {
1317
+ return !0 === t.route(n);
1318
+ } catch (t) {
1319
+ return i.warn("Transport", "event router threw:", t), !1;
1320
+ }
1321
+ }
1322
+ Z(t) {
1323
+ this.O.length < this.nt() ? this.O.push(t) : this.et(t);
1324
+ }
1325
+ holdCapacityFlush(t) {
1326
+ const n = this.V;
1327
+ this.V = !0;
1328
+ try {
1329
+ t();
1330
+ } finally {
1331
+ this.V = n;
1332
+ }
1333
+ }
1334
+ X() {
1335
+ if (this.L) return this.O.length >= this.U.flush.size && !this.V ? (f(this.j), this.j = null, void this.flush("capacity")) : void this.Y();
1336
+ }
1337
+ flush(t) {
1338
+ if (this.T && this.B.isActivityActive()) try {
1339
+ if (this.tt(t ?? "interval"), "lifecycle" === t) return void this.it();
1340
+ if (0 === this.O.length) return;
1341
+ if ("submit" === t && !this.L) return;
1342
+ if ("submit" !== t && this.rt()) return;
1343
+ const n = "submit" === t;
1344
+ for (const e of this.ot(!1, n)) {
1345
+ const r = this.st(e, t, n ? this.lt() : this.ut());
1346
+ r && (n ? this.ct(r) : this.B.ingest(r, !1)).then((t) => this.ft(t, r)).catch(() => {
1347
+ i.warn("Transport", "ingest threw unexpectedly — batch dropped");
1348
+ });
1349
+ }
1350
+ this.O.length > 0 && this.Y();
1351
+ } catch (t) {
1352
+ i.warn("Transport", "flush() threw unexpectedly:", t);
1353
+ }
1354
+ }
1355
+ releaseBindHold() {
1356
+ this.W && (this.W = !1, this.T && this.L && 0 !== this.O.length && (f(this.j), this.j = null, this.flush("interval")));
1357
+ }
1358
+ rt() {
1359
+ const t = this.B.getBindHoldMs?.() ?? 0;
1360
+ return t > 0 ? (this.W = !0, null === this.j && this.L && (this.j = c(() => {
1361
+ this.j = null, this.flush("interval");
1362
+ }, t)), !0) : (this.W = !1, !1);
1363
+ }
1364
+ ut() {
1365
+ return this.B.isBound?.() ? Ut : void 0;
1366
+ }
1367
+ start() {
1368
+ this.T || (this.T = !0, this.L = "undefined" == typeof navigator || navigator.onLine);
1369
+ }
1370
+ stop() {
1371
+ if (!this.T) return Promise.resolve();
1372
+ f(this.j), this.j = null, f(this.F), this.F = null, this.B.isActivityActive() && this.tt("lifecycle");
1373
+ const t = this.it();
1374
+ return this.T = !1, this.D = [], t;
1375
+ }
1376
+ onConnectionChange() {
1377
+ const t = "undefined" == typeof navigator || navigator.onLine;
1378
+ if (t !== this.L) {
1379
+ if (this.L = t, !this.L) return f(this.j), this.j = null, f(this.F), void (this.F = null);
1380
+ (this.O.length > 0 || this.J?.beforeFlush) && this.Y(), this.D.length > 0 && this.ht();
1381
+ }
1382
+ }
1383
+ Y() {
1384
+ this.T && this.L && null === this.j && (this.j = c(() => {
1385
+ this.j = null, this.flush("interval");
1386
+ }, this.G));
1387
+ }
1388
+ ht() {
1389
+ this.T && this.L && null === this.F && (this.F = c(() => {
1390
+ this.F = null, this.dt();
1391
+ }, this.G));
1392
+ }
1393
+ dt() {
1394
+ if (!this.T || !this.L || 0 === this.D.length || !this.B.isActivityActive()) return;
1395
+ const t = this.D.shift();
1396
+ this.B.ingest(t.batch, !1).then((n) => this.yt(n, t)).catch(() => {
1397
+ i.warn("Transport", "retry drain ingest threw unexpectedly — batch dropped"), this.D.length > 0 && this.ht();
1398
+ });
1399
+ }
1400
+ gt(t, n) {
1401
+ this.D.length >= 5 && (this.D.shift(), i.warn("Transport", "retry queue full — oldest batch evicted")), this.D.push({
1402
+ batch: t,
1403
+ attempts: n
1404
+ }), this.ht();
1405
+ }
1406
+ ft(t, n) {
1407
+ this.T && this.B.isActivityActive() && (t.ok ? this.wt() : this.vt(t) && this.gt(n, 1));
1408
+ }
1409
+ yt(t, n) {
1410
+ if (this.T && this.B.isActivityActive()) {
1411
+ if (t.ok) return this.wt(), void (this.D.length > 0 && this.ht());
1412
+ if (this.vt(t)) {
1413
+ if (n.attempts >= 3) return this.bt(), i.warn("Transport", "batch dropped after MAX_RETRY_ATTEMPTS", n.batch.batchId), void (this.D.length > 0 && this.ht());
1414
+ this.bt(), this.gt(n.batch, n.attempts + 1);
1415
+ } else this.D.length > 0 && this.ht();
1416
+ }
1417
+ }
1418
+ bt() {
1419
+ this.N++, this.N % this.U.flush.backoffFailureThreshold === 0 && (this.G = Math.min(2 * this.G, this.U.flush.maxIntervalMs));
1420
+ }
1421
+ wt() {
1422
+ this.N = 0, this.G = this.U.flush.intervalMs;
1423
+ }
1424
+ nt() {
1425
+ return this.U.queue.size * (this.L ? 1 : 2);
1426
+ }
1427
+ async it() {
1428
+ if (!this.B.isActivityActive()) return Promise.resolve();
1429
+ if (!this.L) return;
1430
+ const t = [];
1431
+ let n = this.lt();
1432
+ for (const e of this.ot(!0, !0)) {
1433
+ const r = this.st(e, "lifecycle", n);
1434
+ r && (n -= zt(r.events), t.push(this.ct(r).then((t) => this.ft(t, r)).catch(() => {
1435
+ i.warn("Transport", "lifecycle ingest threw — batch dropped");
1436
+ })));
1437
+ }
1438
+ const e = [];
1439
+ for (const r of this.D) {
1440
+ const o = zt(r.batch.events);
1441
+ o > n ? e.push(r) : (n -= o, t.push(this.ct(r.batch).then((t) => this.yt(t, r)).catch(() => {
1442
+ i.warn("Transport", "lifecycle retry ingest threw — batch dropped");
1443
+ })));
1444
+ }
1445
+ return this.D = e, Promise.allSettled(t).then(() => {});
1446
+ }
1447
+ lt() {
1448
+ return Math.max(0, 49152 - this.H);
1449
+ }
1450
+ ct(t) {
1451
+ const n = zt(t.events);
1452
+ return this.H += n, this.B.ingest(t, !0).finally(() => {
1453
+ this.H -= n;
1454
+ });
1455
+ }
1456
+ et(t) {
1457
+ const n = V(t);
1458
+ for (let e = 0; e < this.O.length; e++) if (V(this.O[e]) < n) {
1459
+ for (let t = e; t < this.O.length - 1; t++) this.O[t] = this.O[t + 1];
1460
+ this.O.length -= 1, this.O.push(t);
1461
+ return;
1462
+ }
1463
+ }
1464
+ st(t, n, e) {
1465
+ const i = "lifecycle" === n, r = this.kt(t, i, i ? 200 : this.U.flush.size, e);
1466
+ return 0 === r.length ? null : {
1467
+ activityId: "",
1468
+ batchId: Pt(),
1469
+ batchSequence: this.q++,
1470
+ clientTimestamp: Date.now(),
1471
+ schemaVersion: "0.1.0",
1472
+ sdkVersion: "0.5.1",
1473
+ sdkPlatform: "web",
1474
+ tabId: this.B.getTabId(),
1475
+ events: r
1476
+ };
1477
+ }
1478
+ kt(t, n, e, i) {
1479
+ const r = /* @__PURE__ */ new Set();
1480
+ let o = 0;
1481
+ for (let s = 0; s < this.O.length && r.size < e; s++) {
1482
+ const e = n ? this.O.length - 1 - s : s, a = this.O[e];
1483
+ if (_t(a) === t) {
1484
+ if (void 0 !== i) {
1485
+ const t = Dt(a);
1486
+ if (o + t > i) continue;
1487
+ o += t;
1488
+ }
1489
+ r.add(e);
1490
+ }
1491
+ }
1492
+ if (0 === r.size) return [];
1493
+ const s = [], a = [];
1494
+ for (let t = 0; t < this.O.length; t++) r.has(t) ? s.push(this.O[t]) : a.push(this.O[t]);
1495
+ return this.O = a, s;
1496
+ }
1497
+ ot(t, n = !1) {
1498
+ const e = [];
1499
+ for (let n = 0; n < this.O.length; n++) {
1500
+ const i = _t(this.O[t ? this.O.length - 1 - n : n]);
1501
+ null === i || e.includes(i) || e.push(i);
1502
+ }
1503
+ if (n) {
1504
+ const t = e.indexOf("fp-signals");
1505
+ t > 0 && (e.splice(t, 1), e.unshift("fp-signals"));
1506
+ }
1507
+ return e;
1508
+ }
1509
+ vt(t) {
1510
+ if (t.ok) return !1;
1511
+ switch (t.kind) {
1512
+ case "timeout":
1513
+ case "server":
1514
+ case "rate_limited":
1515
+ case "network": return !0;
1516
+ default: return !1;
1517
+ }
1518
+ }
1519
+ };
1520
+ function zt(t) {
1521
+ let n = 0;
1522
+ for (let e = 0; e < t.length; e++) n += Dt(t[e]);
1523
+ return n;
1524
+ }
1525
+ function Dt(t) {
1526
+ try {
1527
+ return JSON.stringify(t).length + 1;
1528
+ } catch {
1529
+ return 0;
1530
+ }
1531
+ }
1532
+ const Ft = "tri:bcast:";
1533
+ const Lt = "function" == typeof BroadcastChannel ? BroadcastChannel : function() {
1534
+ if ("undefined" == typeof Storage || "undefined" == typeof window) return !1;
1535
+ try {
1536
+ const t = "__tri_bcast_probe__";
1537
+ localStorage.setItem(t, "1");
1538
+ const n = "1" === localStorage.getItem(t);
1539
+ return localStorage.removeItem(t), n;
1540
+ } catch {
1541
+ return !1;
1542
+ }
1543
+ }() ? class {
1544
+ constructor(t) {
1545
+ this.seq = 0, this.closed = !1, this.listeners = /* @__PURE__ */ new Set(), this.onStorageEvent = (t) => {
1546
+ if (this.closed) return;
1547
+ if (!t.key || !t.key.startsWith(`${Ft}${this.channelName}:`)) return;
1548
+ if (null === t.newValue) return;
1549
+ let n;
1550
+ s(() => p.remove(t.key));
1551
+ try {
1552
+ n = JSON.parse(t.newValue);
1553
+ } catch {
1554
+ return;
1555
+ }
1556
+ const e = { data: n };
1557
+ for (const t of this.listeners) s(() => t(e));
1558
+ }, this.channelName = t, this.senderId = Pt(), window.addEventListener("storage", this.onStorageEvent);
1559
+ }
1560
+ postMessage(t) {
1561
+ if (this.closed) return;
1562
+ const n = `${Ft}${this.channelName}:${this.senderId}:${this.seq++}`;
1563
+ s(() => {
1564
+ p.set(n, t), p.remove(n);
1565
+ });
1566
+ }
1567
+ addEventListener(t, n) {
1568
+ this.listeners.add(n);
1569
+ }
1570
+ removeEventListener(t, n) {
1571
+ this.listeners.delete(n);
1572
+ }
1573
+ close() {
1574
+ this.closed || (this.closed = !0, window.removeEventListener("storage", this.onStorageEvent), this.listeners.clear());
1575
+ }
1576
+ } : class {
1577
+ constructor(t) {
1578
+ i.warn("BroadcastChannel", "BroadcastChannel is unavailable and localStorage is not writable in this context. Cross-tab discovery is disabled; tab count will always be reported as 1.");
1579
+ }
1580
+ postMessage(t) {}
1581
+ addEventListener(t, n) {}
1582
+ removeEventListener(t, n) {}
1583
+ close() {}
1584
+ };
1585
+ const Nt = "__tri_tabId";
1586
+ var qt = class {
1587
+ constructor(t) {
1588
+ this.context = t, this.St = "", this.T = !1, this.Tt = null, this._t = null, this.At = null, this.It = /* @__PURE__ */ new Map(), this.Et = -1, this.Rt = null;
1589
+ }
1590
+ async start() {
1591
+ this.T || (this.T = !0, this.getTabId(), this.Mt(), this.Ct({
1592
+ type: "hello",
1593
+ tabId: this.St,
1594
+ ts: Date.now()
1595
+ }), this.$t(), this.Pt("active"), this.xt());
1596
+ }
1597
+ stop() {
1598
+ this.T && (this.T = !1, this.Pt("inactive"), this.Ct({
1599
+ type: "bye",
1600
+ tabId: this.St,
1601
+ ts: Date.now()
1602
+ }), this.Ut(this.Bt()), this.Ot(), this.jt(), this.zt());
1603
+ }
1604
+ getTabId() {
1605
+ return this.St || (this.St = this.Dt()), this.St;
1606
+ }
1607
+ queryTabsNumber() {
1608
+ return this.It.size + 1;
1609
+ }
1610
+ Mt() {
1611
+ try {
1612
+ this.Tt = new Lt("__tri_tab_channel"), this.Rt = this.Ft.bind(this), this.Tt.addEventListener("message", this.Rt);
1613
+ } catch (t) {
1614
+ i.warn("TabManager", "failed to open broadcast channel:", t);
1615
+ }
1616
+ }
1617
+ zt() {
1618
+ try {
1619
+ if (!this.Tt) return;
1620
+ this.Rt && this.Tt.removeEventListener("message", this.Rt), this.Tt.close();
1621
+ } catch {} finally {
1622
+ this.Tt = null, this.Rt = null;
1623
+ }
1624
+ }
1625
+ $t() {
1626
+ this._t = setInterval(() => {
1627
+ const t = Date.now();
1628
+ this.Ct({
1629
+ type: "heartbeat",
1630
+ tabId: this.St,
1631
+ ts: t
1632
+ });
1633
+ }, 1e3);
1634
+ }
1635
+ Ot() {
1636
+ null != this._t && (clearInterval(this._t), this._t = null);
1637
+ }
1638
+ xt() {
1639
+ null != this.At && clearTimeout(this.At), this.At = setTimeout(() => {
1640
+ this.At = null;
1641
+ const t = this.Bt() + 1;
1642
+ t !== this.Et && (this.Et = t, this.Ut(t));
1643
+ }, 1e3);
1644
+ }
1645
+ jt() {
1646
+ null != this.At && (clearTimeout(this.At), this.At = null);
1647
+ }
1648
+ Ct(t) {
1649
+ try {
1650
+ if (!this.Tt) return;
1651
+ this.Tt.postMessage(t);
1652
+ } catch {
1653
+ i.warn("TabManager", "failed to broadcast message:", t);
1654
+ }
1655
+ }
1656
+ Ft(t) {
1657
+ const { type: n, tabId: e } = t.data;
1658
+ if (e === this.St) return;
1659
+ const i = Date.now();
1660
+ "hello" === n ? (this.Ct({
1661
+ type: "ack",
1662
+ tabId: this.St,
1663
+ ts: i,
1664
+ to: e
1665
+ }), this.It.set(e, i)) : "heartbeat" === n || "ack" === n ? this.It.set(e, i) : "bye" === n && this.It.delete(e);
1666
+ }
1667
+ Ut(t) {
1668
+ this.context.events.count && this.context.push({
1669
+ name: "tab",
1670
+ type: "count",
1671
+ tabId: this.St,
1672
+ timestamp: Date.now(),
1673
+ ts: performance.now(),
1674
+ value: t
1675
+ });
1676
+ }
1677
+ Pt(t) {
1678
+ this.context.events.state && this.context.push({
1679
+ name: "tab",
1680
+ type: "state",
1681
+ tabId: this.St,
1682
+ timestamp: Date.now(),
1683
+ ts: performance.now(),
1684
+ value: t
1685
+ });
1686
+ }
1687
+ Dt() {
1688
+ const t = y.get(Nt);
1689
+ if (t) return t;
1690
+ const n = Pt();
1691
+ return y.set(Nt, n), n;
1692
+ }
1693
+ Bt(t = Date.now()) {
1694
+ let n = 0;
1695
+ for (const [e, i] of this.It.entries()) t - i >= 3e3 ? this.It.delete(e) : n++;
1696
+ return n;
1697
+ }
1698
+ };
1699
+ const Ht = globalThis.CompressionStream;
1700
+ const Jt = globalThis.Response;
1701
+ const Vt = globalThis.Blob;
1702
+ const Wt = new TextEncoder();
1703
+ let Gt = null;
1704
+ async function Kt(t) {
1705
+ if ("function" != typeof Ht) return null;
1706
+ try {
1707
+ const n = "string" == typeof t ? Wt.encode(t) : t, e = new Vt([n]).stream().pipeThrough(new Ht("gzip"));
1708
+ return await new Jt(e).arrayBuffer();
1709
+ } catch (t) {
1710
+ return i.warn("compression", "Native gzip failed:", t), null;
1711
+ }
1712
+ }
1713
+ async function Zt(t) {
1714
+ try {
1715
+ const n = await function() {
1716
+ if (null === Gt) {
1717
+ const t = function(t, n = 1e4) {
1718
+ let e = null;
1719
+ const r = new Promise((t) => {
1720
+ e = c(() => {
1721
+ i.warn("import", `Import timed out after ${n}ms`), t(null);
1722
+ }, n);
1723
+ }), o = Promise.resolve().then(t).catch((t) => (i.warn("import", "Import failed:", t), null));
1724
+ return Promise.race([o, r]).finally(() => {
1725
+ f(e);
1726
+ });
1727
+ }(() => import("./browser-pQZA35G2-CG3C-xGt.esm.js"), 1e4);
1728
+ Gt = t, t.then((n) => {
1729
+ null === n && c(() => {
1730
+ Gt === t && (Gt = null);
1731
+ }, 1e4);
1732
+ });
1733
+ }
1734
+ return Gt;
1735
+ }();
1736
+ if (null === n) return null;
1737
+ const { gzipSync: e } = n, r = e("string" == typeof t ? Wt.encode(t) : t);
1738
+ return r.buffer.slice(r.byteOffset, r.byteOffset + r.byteLength);
1739
+ } catch (t) {
1740
+ return i.warn("compression", "fflate gzip failed:", t), null;
1741
+ }
1742
+ }
1743
+ function Xt(t, n) {
1744
+ const e = [JSON.stringify(t)];
1745
+ for (let t = 0; t < n.length; t++) try {
1746
+ e.push(JSON.stringify(n[t]));
1747
+ } catch {}
1748
+ return e.join("\n");
1749
+ }
1750
+ function Qt(t) {
1751
+ const n = { Accept: "application/json" };
1752
+ return t?.hasBody && ("json" === t.contentType ? n["Content-Type"] = "application/json" : "ndjson" === t.contentType && (n["Content-Type"] = "application/x-ndjson"), "gzip" === t.contentEncoding && (n["Content-Encoding"] = "gzip")), t?.token && (n.Authorization = `Bearer ${t.token}`), t?.profileId && (n["x-profile-id"] = t.profileId), t?.api?.version && (n["x-api-version"] = t.api.version), t?.customHeaders && Object.entries(t.customHeaders).forEach(([t, e]) => {
1753
+ n[t] = e;
1754
+ }), n;
1755
+ }
1756
+ const Yt = "function" == typeof globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0;
1757
+ function tn(t) {
1758
+ "undefined" != typeof document && "function" == typeof globalThis.fetch || i.warn("FalconService", "createFalconServiceManager called in a non-browser environment — all requests will resolve with { ok: false, kind: 'network' }.");
1759
+ const n = function(t) {
1760
+ const n = t?.timeout, e = t?.baseUrl ?? "", i = t?.api;
1761
+ async function r(t, r, o) {
1762
+ if (void 0 === Yt) return {
1763
+ ok: !1,
1764
+ kind: "network"
1765
+ };
1766
+ const s = e ? `${e}${r}` : r, a = new AbortController();
1767
+ let l = null, u = !1;
1768
+ const h = o?.timeoutMs ?? n;
1769
+ h && (l = c(() => {
1770
+ u = !0, a.abort();
1771
+ }, h));
1772
+ const d = o?.signal;
1773
+ let p, y = () => {};
1774
+ if (d) if (d.aborted) a.abort();
1775
+ else {
1776
+ const t = () => a.abort();
1777
+ d.addEventListener("abort", t, { once: !0 }), y = () => d.removeEventListener("abort", t);
1778
+ }
1779
+ if (null != o && "body" in o && null != o.body) {
1780
+ const t = function(t) {
1781
+ if (null == t) return {
1782
+ ok: !0,
1783
+ body: void 0
1784
+ };
1785
+ if ("string" == typeof t || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || t instanceof Blob || t instanceof FormData || t instanceof URLSearchParams || t instanceof ReadableStream) return {
1786
+ ok: !0,
1787
+ body: t
1788
+ };
1789
+ try {
1790
+ return {
1791
+ ok: !0,
1792
+ body: JSON.stringify(t)
1793
+ };
1794
+ } catch {
1795
+ return { ok: !1 };
1796
+ }
1797
+ }(o.body);
1798
+ if (!t.ok) return f(l), y(), {
1799
+ ok: !1,
1800
+ kind: "serialize"
1801
+ };
1802
+ p = t.body;
1803
+ }
1804
+ try {
1805
+ const n = await Yt(s, {
1806
+ method: t,
1807
+ headers: Qt({
1808
+ token: o?.token,
1809
+ profileId: o?.profileId,
1810
+ contentType: o?.contentType,
1811
+ contentEncoding: o?.contentEncoding,
1812
+ api: i,
1813
+ hasBody: void 0 !== p,
1814
+ customHeaders: o?.customHeaders
1815
+ }),
1816
+ body: p,
1817
+ signal: a.signal,
1818
+ keepalive: o?.keepalive
1819
+ });
1820
+ if (!n.ok) return 429 === (g = n.status) ? {
1821
+ ok: !1,
1822
+ kind: "rate_limited",
1823
+ status: g
1824
+ } : g >= 400 && g < 500 ? {
1825
+ ok: !1,
1826
+ kind: "client",
1827
+ status: g
1828
+ } : {
1829
+ ok: !1,
1830
+ kind: "server",
1831
+ status: g
1832
+ };
1833
+ if (204 === n.status) return {
1834
+ ok: !0,
1835
+ data: void 0,
1836
+ status: 204
1837
+ };
1838
+ try {
1839
+ return {
1840
+ ok: !0,
1841
+ data: await n.json(),
1842
+ status: n.status
1843
+ };
1844
+ } catch {
1845
+ return a.signal.aborted ? u ? {
1846
+ ok: !1,
1847
+ kind: "timeout"
1848
+ } : {
1849
+ ok: !1,
1850
+ kind: "abort"
1851
+ } : {
1852
+ ok: !1,
1853
+ kind: "parse",
1854
+ status: n.status
1855
+ };
1856
+ }
1857
+ } catch {
1858
+ return u ? {
1859
+ ok: !1,
1860
+ kind: "timeout"
1861
+ } : a.signal.aborted ? {
1862
+ ok: !1,
1863
+ kind: "abort"
1864
+ } : {
1865
+ ok: !1,
1866
+ kind: "network"
1867
+ };
1868
+ } finally {
1869
+ f(l), y();
1870
+ }
1871
+ var g;
1872
+ }
1873
+ return {
1874
+ post: async function(t, n) {
1875
+ return r("POST", t, n);
1876
+ },
1877
+ get: async function(t, n) {
1878
+ return r("GET", t, n);
1879
+ }
1880
+ };
1881
+ }({
1882
+ baseUrl: `${t.api.url}/api/v1`,
1883
+ timeout: 1e4,
1884
+ api: { version: t.api.version }
1885
+ }), e = function(t) {
1886
+ const { getToken: n, refresh: e } = t;
1887
+ let r = null;
1888
+ return { withAuth: async function(t, o) {
1889
+ if (r) {
1890
+ const n = await r;
1891
+ if (n) return t(n);
1892
+ }
1893
+ const s = n() ?? "", a = await t(s);
1894
+ if ((l = a).ok || !("rejected" === l.kind || "client" === l.kind && St.includes(l.status)) || !1 === o?.refreshable) return a;
1895
+ var l;
1896
+ const u = await (r || (r = async function() {
1897
+ try {
1898
+ return await e(), n();
1899
+ } catch (t) {
1900
+ return i.warn("AuthMiddleware", "auth refresh failed", t), null;
1901
+ }
1902
+ }().finally(() => {
1903
+ r = null;
1904
+ }), r));
1905
+ return u && u !== s ? t(u) : a;
1906
+ } };
1907
+ }(t), r = () => ({ profileId: t.getProfileId() ?? void 0 });
1908
+ return { api: {
1909
+ ingest: async function(i, o) {
1910
+ let s = null;
1911
+ return e.withAuth(async (e) => {
1912
+ const { events: a, ...l } = i, u = {
1913
+ ...l,
1914
+ activityId: t.getActivityId()
1915
+ };
1916
+ let c, f = !1, h = null;
1917
+ const d = t.pulseGuard;
1918
+ try {
1919
+ let t = null;
1920
+ if (d && d.canBind()) {
1921
+ if (!o) {
1922
+ const t = d.settling();
1923
+ t && await t;
1924
+ }
1925
+ null === s && (s = function(t) {
1926
+ const n = [];
1927
+ for (let e = 0; e < t.length; e++) try {
1928
+ n.push(JSON.stringify(t[e]));
1929
+ } catch {}
1930
+ return n.join("\n");
1931
+ }(a)), t = d.bind(u, s);
1932
+ }
1933
+ if (t) if (h = t.sessionId, o) c = t.body;
1934
+ else {
1935
+ const n = await async function(t) {
1936
+ const n = await async function(t) {
1937
+ const n = await Kt(t);
1938
+ return null !== n ? n : Zt(t);
1939
+ }(t);
1940
+ return n ? {
1941
+ type: "gzip",
1942
+ body: n
1943
+ } : {
1944
+ type: "ndjson",
1945
+ body: t
1946
+ };
1947
+ }(t.body);
1948
+ c = n.body, f = "gzip" === n.type;
1949
+ }
1950
+ else if (o) c = Xt(u, a);
1951
+ else {
1952
+ const t = await async function(t, n) {
1953
+ const e = Xt(t, n), i = await async function(t) {
1954
+ const n = await Kt(t);
1955
+ return null !== n ? n : Zt(t);
1956
+ }(e);
1957
+ return i ? {
1958
+ type: "gzip",
1959
+ body: i
1960
+ } : {
1961
+ type: "ndjson",
1962
+ body: e
1963
+ };
1964
+ }(u, a);
1965
+ c = t.body, f = "gzip" === t.type;
1966
+ }
1967
+ } catch {
1968
+ return {
1969
+ ok: !1,
1970
+ kind: "serialize"
1971
+ };
1972
+ }
1973
+ const p = await n.post(function(t) {
1974
+ const n = t.length > 0 ? _t(t[0]) : null;
1975
+ return Tt[n ?? "fp-signals"];
1976
+ }(a), {
1977
+ body: c,
1978
+ token: e,
1979
+ keepalive: o,
1980
+ contentType: "ndjson",
1981
+ contentEncoding: f ? "gzip" : void 0,
1982
+ ...r()
1983
+ });
1984
+ return d && null !== h && p.ok && d.onIngestResponse(p.data?.pulseguard, h), function(t) {
1985
+ return t.ok && !0 === t.data?.malformedBatch;
1986
+ }(p) ? {
1987
+ ok: !1,
1988
+ kind: "rejected",
1989
+ status: p.status
1990
+ } : p;
1991
+ }, { refreshable: !o });
1992
+ },
1993
+ reportEvent: async function(t) {
1994
+ return e.withAuth((e) => n.post("/events/report-event", {
1995
+ body: t,
1996
+ token: e,
1997
+ contentType: "json",
1998
+ ...r()
1999
+ }));
2000
+ },
2001
+ startActivity: async function(e) {
2002
+ return n.post("/events/start-activity", {
2003
+ token: t.getSdkToken(),
2004
+ ...e ? {
2005
+ body: { pulseguard: e },
2006
+ contentType: "json"
2007
+ } : {},
2008
+ ...r()
2009
+ });
2010
+ },
2011
+ stopActivity: async function() {
2012
+ return e.withAuth((t) => n.post("/events/end-activity", {
2013
+ token: t,
2014
+ keepalive: !0,
2015
+ ...r()
2016
+ }), { refreshable: !1 });
2017
+ },
2018
+ pulseguardSession: async function(t) {
2019
+ return e.withAuth((e) => n.post("/pulseguard/session", {
2020
+ body: { pulseguard: t },
2021
+ token: e,
2022
+ contentType: "json",
2023
+ timeoutMs: 3e3,
2024
+ ...r()
2025
+ }), { refreshable: !1 });
2026
+ },
2027
+ collectionStatus: async function() {
2028
+ return n.get("/sdk/collection-status", {
2029
+ token: t.getSdkToken(),
2030
+ ...r()
2031
+ });
2032
+ },
2033
+ linkInterview: async function(i) {
2034
+ const o = t.getToken();
2035
+ return o && !pt(o) || await t.refresh(), e.withAuth((t) => n.post("/events/link-interview", {
2036
+ token: t,
2037
+ contentType: "json",
2038
+ ...r(),
2039
+ customHeaders: { "X-Incode-Hardware-Id": i }
2040
+ }), { refreshable: !1 });
2041
+ }
2042
+ } };
2043
+ }
2044
+ var nn = class {
2045
+ constructor(t) {
2046
+ this.context = t;
2047
+ }
2048
+ stop() {}
2049
+ async report(t, n) {
2050
+ const e = {
2051
+ name: t,
2052
+ metadata: n,
2053
+ timestamp: Date.now(),
2054
+ activityId: this.context.getActivityId() ?? ""
2055
+ };
2056
+ try {
2057
+ const r = await this.context.reportEvent(e);
2058
+ if (r.ok) return r;
2059
+ i.warn("EventReport", "Failed to report event:", t, n, "with result:", r);
2060
+ } catch (e) {
2061
+ i.warn("EventReport", "Failed to report event:", t, n, "with error:", e);
2062
+ }
2063
+ }
2064
+ };
2065
+ const en = "function" == typeof TextEncoder ? new TextEncoder() : null;
2066
+ const rn = "function" == typeof TextDecoder ? new TextDecoder() : null;
2067
+ function on(t, n) {
2068
+ if (!en) return -1;
2069
+ if (t.length > n.length) return -1;
2070
+ const e = en.encodeInto(t, n);
2071
+ return e.read === t.length ? e.written : -1;
2072
+ }
2073
+ function sn(t) {
2074
+ return rn ? rn.decode(t) : "";
2075
+ }
2076
+ function an(t, n) {
2077
+ if ("string" != typeof t) return null;
2078
+ if (t.length !== Math.ceil(4 * n / 3)) return null;
2079
+ const e = new Uint8Array(n);
2080
+ let i = 0, r = 0, o = 0;
2081
+ for (let n = 0; n < t.length; n++) {
2082
+ const s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".indexOf(t[n]);
2083
+ if (s < 0) return null;
2084
+ i = i << 6 | s, r += 6, r >= 8 && (r -= 8, e[o++] = i >> r & 255);
2085
+ }
2086
+ return o === n ? e : null;
2087
+ }
2088
+ const ln = /^function [\w$ ]*\(\) \{\s*\[native code\]\s*\}$/;
2089
+ function un(t) {
2090
+ return t > 0 ? t >= 4294967295 ? 4294967295 : Math.floor(t) : 0;
2091
+ }
2092
+ function cn() {
2093
+ return "undefined" != typeof document && "visible" !== document.visibilityState;
2094
+ }
2095
+ const fn = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
2096
+ const hn = 15;
2097
+ function dn(t) {
2098
+ const n = t.s.startsWith("pulseguard_") ? an(t.s.slice(11), 16) : null;
2099
+ if (!n || 32 !== t.kw.length) return null;
2100
+ const e = /* @__PURE__ */ new Uint8Array(48);
2101
+ return e.set(n, 0), e.set(t.kw, 16), e;
2102
+ }
2103
+ function pn(t, n) {
2104
+ if (!Number.isInteger(t) || t < 0 || t > 4294967295 || 16 !== n.length) return null;
2105
+ const e = /* @__PURE__ */ new Uint8Array(20);
2106
+ return new DataView(e.buffer).setUint32(0, t, !0), e.set(n, 4), e;
2107
+ }
2108
+ async function yn(t) {
2109
+ const n = performance.now();
2110
+ let e;
2111
+ try {
2112
+ const { instance: n } = await WebAssembly.instantiate(t, {});
2113
+ e = n.exports;
2114
+ } catch {
2115
+ return null;
2116
+ }
2117
+ const i = performance.now() - n;
2118
+ let r = 0;
2119
+ function o(t, n) {
2120
+ if (!e || !n) return null;
2121
+ const i = performance.now();
2122
+ try {
2123
+ const i = e.buf() >>> 0;
2124
+ if (new Uint8Array(e.memory.buffer).set(n, i), 1 === t) return 1 === e.init(i, n.length) ? n : null;
2125
+ const r = e.epoch(i, n.length);
2126
+ return 68 === r ? new Uint8Array(e.memory.buffer).slice(i, i + r) : null;
2127
+ } catch {
2128
+ return null;
2129
+ } finally {
2130
+ r = performance.now() - i;
2131
+ }
2132
+ }
2133
+ return {
2134
+ realm: 2,
2135
+ startMs: i,
2136
+ lastRoundTripMs: function() {
2137
+ return r;
2138
+ },
2139
+ init: function(t) {
2140
+ return Promise.resolve(null !== o(1, dn(t)));
2141
+ },
2142
+ advance: function(t, n) {
2143
+ return Promise.resolve(o(2, pn(t, n)));
2144
+ },
2145
+ stalled: function() {
2146
+ return !1;
2147
+ },
2148
+ dispose: function() {
2149
+ e = null;
2150
+ }
2151
+ };
2152
+ }
2153
+ function gn() {
2154
+ return performance.now();
2155
+ }
2156
+ function wn(t, n) {
2157
+ return !!t && "string" == typeof t.url && t.url.length > 0 && "string" == typeof t.sha256 && /^[0-9a-f]{64}$/i.test(t.sha256) && Number.isInteger(t.bytes) && t.bytes > 0 && t.bytes <= n;
2158
+ }
2159
+ async function vn(t) {
2160
+ if (!wn(t, 40960)) return null;
2161
+ const n = await _(t.url, t.sha256, t.bytes, 3e4);
2162
+ if (!n) return null;
2163
+ try {
2164
+ const t = await WebAssembly.compile(n);
2165
+ let i = null;
2166
+ const r = (e = () => i, function(t, n) {
2167
+ try {
2168
+ if (n <= 0 || n > 64) return hn;
2169
+ const i = e();
2170
+ if (!i) return hn;
2171
+ const r = t >>> 0, o = new Uint8Array(i.buffer);
2172
+ return r + n > o.length ? hn : function(t) {
2173
+ if (t.length < 3 || ":" !== t[1]) return hn;
2174
+ const n = t[0];
2175
+ if ("t" !== n && "v" !== n) return hn;
2176
+ const e = t.slice(2).split(".");
2177
+ if (e.length < 1 || e.length > 4) return hn;
2178
+ for (const t of e) if (!fn.test(t)) return hn;
2179
+ try {
2180
+ let t = globalThis;
2181
+ for (const n of e) t = t[n];
2182
+ return "t" === n ? function(t) {
2183
+ if (null === t) return 8;
2184
+ switch (typeof t) {
2185
+ case "undefined": return 0;
2186
+ case "object": return 1;
2187
+ case "function": return 2;
2188
+ case "string": return 3;
2189
+ case "number": return 4;
2190
+ case "boolean": return 5;
2191
+ case "symbol": return 6;
2192
+ case "bigint": return 7;
2193
+ default: return hn;
2194
+ }
2195
+ }(t) : "number" != typeof t ? hn : Number.isInteger(t) && t >= 0 && t <= 13 ? t : 14;
2196
+ } catch {
2197
+ return hn;
2198
+ }
2199
+ }(sn(o.subarray(r, r + n)));
2200
+ } catch {
2201
+ return hn;
2202
+ }
2203
+ }), o = (await WebAssembly.instantiate(t, { env: {
2204
+ now: gn,
2205
+ probe: r
2206
+ } })).exports;
2207
+ return o.memory instanceof WebAssembly.Memory && (i = o.memory), function(t) {
2208
+ if (!(t.memory instanceof WebAssembly.Memory) || "function" != typeof t.buf || "function" != typeof t.scratch || "function" != typeof t.setEpoch || "function" != typeof t.bindBatch || "function" != typeof t.read) return null;
2209
+ const n = t.buf() >>> 0, e = t.scratch() >>> 0;
2210
+ let i = new Uint8Array(t.memory.buffer), r = i.subarray(e, e + Ut), o = 0;
2211
+ function s() {
2212
+ i.buffer !== t.memory.buffer && (o++, i = new Uint8Array(t.memory.buffer), r = i.subarray(e, e + Ut));
2213
+ }
2214
+ function a(t) {
2215
+ return s(), sn(i.subarray(n, n + t));
2216
+ }
2217
+ function l(t, n) {
2218
+ const e = on(t, i.subarray(n + 2, n + 2 + 128));
2219
+ return e < 0 ? -1 : (i[n] = 255 & e, i[n + 1] = e >> 8, n + 2 + e);
2220
+ }
2221
+ function u(t, n) {
2222
+ return i[n] = 255 & t, i[n + 1] = t >>> 8 & 255, i[n + 2] = t >>> 16 & 255, i[n + 3] = t >>> 24 & 255, n + 4;
2223
+ }
2224
+ return {
2225
+ setEpoch: function(n, i) {
2226
+ if (68 !== n.length || 64 !== i.length) return !1;
2227
+ try {
2228
+ return s(), r.set(n, 0), r.set(i, 68), 1 === t.setEpoch(e, 132);
2229
+ } catch {
2230
+ return !1;
2231
+ }
2232
+ },
2233
+ scratch: function() {
2234
+ return s(), r;
2235
+ },
2236
+ bind: function(r, o, c, f, h, d) {
2237
+ try {
2238
+ s();
2239
+ let p = n;
2240
+ if (i[p++] = r, p = l(o, p), p < 0) return null;
2241
+ if (p = u(c >>> 0, p), p = l(f, p), p < 0) return null;
2242
+ const y = h > 0 ? Math.floor(h) : 0;
2243
+ p = u(y % 4294967296, p), u(Math.floor(y / 4294967296), p);
2244
+ const g = t.bindBatch(e, d, n);
2245
+ return g > 0 ? a(g) : null;
2246
+ } catch {
2247
+ return null;
2248
+ }
2249
+ },
2250
+ sign: function(n, i) {
2251
+ if (0 === n.length || n.length > Ot) return null;
2252
+ try {
2253
+ s();
2254
+ const o = on(n, r.subarray(0, Ot));
2255
+ if (o <= 0) return null;
2256
+ const l = t.read(e, o, i >>> 0);
2257
+ return l > 0 ? a(l) : null;
2258
+ } catch {
2259
+ return null;
2260
+ }
2261
+ },
2262
+ memoryGrowths: function() {
2263
+ return o;
2264
+ }
2265
+ };
2266
+ }(o);
2267
+ } catch {
2268
+ return null;
2269
+ }
2270
+ var e;
2271
+ }
2272
+ function mn(t) {
2273
+ const n = bn(t);
2274
+ let e = 2166136261;
2275
+ for (let t = 0; t < n.length; t++) e ^= n.charCodeAt(t), e = Math.imul(e, 16777619);
2276
+ return `fnv1a:${(e >>> 0).toString(16).padStart(8, "0")}`;
2277
+ }
2278
+ function bn(t) {
2279
+ return Array.isArray(t) ? `[${t.map(bn).join(",")}]` : t && "object" == typeof t ? `{${Object.keys(t).sort().map((n) => `${JSON.stringify(n)}:${bn(t[n])}`).join(",")}}` : JSON.stringify(t) ?? "null";
2280
+ }
2281
+ let kn = "";
2282
+ function Sn() {
2283
+ return "object" == typeof WebAssembly && null !== WebAssembly && "function" == typeof TextEncoder && "function" == typeof TextDecoder && !!globalThis.crypto?.subtle;
2284
+ }
2285
+ function Tn(t) {
2286
+ const n = function() {
2287
+ let t = 0, n = cn() ? performance.now() : null;
2288
+ return {
2289
+ noteVisibility: function() {
2290
+ const e = performance.now();
2291
+ cn() ? null === n && (n = e) : null !== n && (t += e - n, n = null);
2292
+ },
2293
+ restart: function() {
2294
+ t = 0, n = cn() ? performance.now() : null;
2295
+ },
2296
+ record: function(e) {
2297
+ const i = /* @__PURE__ */ new Uint8Array(64), r = new DataView(i.buffer), o = "undefined" != typeof window, s = t + (null === n ? 0 : performance.now() - n);
2298
+ return r.setUint32(4, un(e.keyHolderRealm), !0), r.setUint32(8, un(e.keyHolderRoundTripMs), !0), r.setUint32(12, un(e.keyHolderStartMs), !0), r.setUint32(20, function() {
2299
+ const t = Function.prototype.toString, n = [
2300
+ globalThis.fetch,
2301
+ globalThis.EventTarget?.prototype?.addEventListener,
2302
+ globalThis.EventTarget?.prototype?.dispatchEvent,
2303
+ globalThis.performance?.now,
2304
+ Date.now,
2305
+ JSON.stringify,
2306
+ t,
2307
+ globalThis.Worker,
2308
+ globalThis.WebAssembly?.instantiate,
2309
+ globalThis.Document?.prototype?.createElement
2310
+ ];
2311
+ let e = 0;
2312
+ for (let i = 0; i < n.length; i++) {
2313
+ const r = n[i];
2314
+ let o = !1;
2315
+ try {
2316
+ o = "function" == typeof r && ln.test(t.call(r));
2317
+ } catch {
2318
+ o = !1;
2319
+ }
2320
+ o || (e |= 1 << i);
2321
+ }
2322
+ return e >>> 0;
2323
+ }(), !0), r.setUint32(24, "undefined" != typeof navigator && !0 === navigator.webdriver ? 1 : 0, !0), r.setUint32(28, o ? un(window.outerWidth - window.innerWidth) : 0, !0), r.setUint32(32, o ? un(window.outerHeight - window.innerHeight) : 0, !0), r.setUint32(36, un(s), !0), r.setUint32(40, cn() ? 0 : 1, !0), r.setUint32(44, un(e.memoryGrowths), !0), i;
2324
+ }
2325
+ };
2326
+ }(), e = function(t, n) {
2327
+ let e = null, i = null, r = null, o = "", s = "", a = "", u = -1, h = null, d = 0;
2328
+ function p(t) {
2329
+ if ("string" == typeof t && n) try {
2330
+ n(new URL(t, globalThis.location?.href).href);
2331
+ } catch {}
2332
+ }
2333
+ function y(n, e) {
2334
+ return t.record({
2335
+ keyHolderRealm: n.realm,
2336
+ keyHolderRoundTripMs: n.lastRoundTripMs(),
2337
+ keyHolderStartMs: n.startMs,
2338
+ memoryGrowths: e.memoryGrowths()
2339
+ });
2340
+ }
2341
+ function g() {
2342
+ return s ? e : null;
2343
+ }
2344
+ return {
2345
+ install: async function(n) {
2346
+ const g = ++d, w = an(n?.n, 16), v = an(n?.kw, 32), m = n?.artifacts;
2347
+ if (!w || !v || !m || "string" != typeof n.s || !Number.isInteger(n.e) || n.e < 0) return "failed";
2348
+ const b = `${m.core?.sha256}|${m.keyHolder?.sha256}`;
2349
+ let k = e, S = r, T = i;
2350
+ if (!k || !S || b !== o) {
2351
+ p(m.core?.url), p(m.keyHolder?.url);
2352
+ const [t, n] = await Promise.all([vn(m.core), (A = m.keyHolder, wn(A, 24576) ? _(A.url, A.sha256, A.bytes, 3e4) : Promise.resolve(null))]);
2353
+ if (g !== d) return "stale";
2354
+ if (!t || !n) return "failed";
2355
+ k = t, S = n, T = null;
2356
+ }
2357
+ var A;
2358
+ let I = null === T;
2359
+ if (T) a = n.s, u = n.e, h = null;
2360
+ else {
2361
+ if (T = await async function(t) {
2362
+ return await function(t) {
2363
+ return new Promise(function(n) {
2364
+ const e = performance.now();
2365
+ let i, r = "";
2366
+ try {
2367
+ r = URL.createObjectURL(new Blob(["!function(){\"use strict\";const n=self;let t=null;function e(t,e){n.postMessage({generation:t.generation,id:t.id,output:e})}n.onmessage=function(n){try{!function(n){if(0===n.op)return void WebAssembly.instantiate(n.input,{}).then(function(i){t=i.instance.exports,e(n,new ArrayBuffer(0))},function(){e(n,null)});if(!t)return void e(n,null);const i=t.buf()>>>0,r=new Uint8Array(n.input);if(new Uint8Array(t.memory.buffer).set(r,i),1===n.op){const u=1===t.init(i,r.length);return void e(n,u?new ArrayBuffer(0):null)}const u=t.epoch(i,r.length);e(n,0===u?null:t.memory.buffer.slice(i,i+u))}(n.data)}catch{e(n.data,null)}}}();\n"], { type: "text/javascript" })), i = new Worker(r);
2368
+ } catch {
2369
+ p(), n(null);
2370
+ return;
2371
+ }
2372
+ let o = 0, s = 0, a = 0, u = !1, h = !1;
2373
+ const d = /* @__PURE__ */ new Map();
2374
+ function p() {
2375
+ if (r) {
2376
+ try {
2377
+ URL.revokeObjectURL(r);
2378
+ } catch {}
2379
+ r = "";
2380
+ }
2381
+ }
2382
+ function y() {
2383
+ for (const [t, n] of d) d.delete(t), f(n.timer), n.settle(null);
2384
+ }
2385
+ function g() {
2386
+ if (!u) {
2387
+ u = !0, p(), y();
2388
+ try {
2389
+ i.removeEventListener("message", v), i.removeEventListener("error", m), i.terminate();
2390
+ } catch {}
2391
+ }
2392
+ }
2393
+ function w(t, n, e) {
2394
+ return u ? Promise.resolve(null) : new Promise(function(r) {
2395
+ const a = s++, l = c(function() {
2396
+ d.delete(a) && (h = !0, r(null));
2397
+ }, e);
2398
+ d.set(a, {
2399
+ settle: r,
2400
+ timer: l,
2401
+ sentAt: performance.now()
2402
+ });
2403
+ try {
2404
+ i.postMessage({
2405
+ generation: o,
2406
+ id: a,
2407
+ op: t,
2408
+ input: n.buffer
2409
+ });
2410
+ } catch {
2411
+ d.delete(a), f(l), r(null);
2412
+ }
2413
+ });
2414
+ }
2415
+ const v = l((t) => {
2416
+ const n = t.data, e = d.get(n?.id);
2417
+ e && (d.delete(n.id), f(e.timer), h = !1, a = performance.now() - e.sentAt, e.settle(n.generation === o ? n.output : null));
2418
+ }), m = l((t) => {
2419
+ h = !0, y();
2420
+ });
2421
+ i.addEventListener("message", v), i.addEventListener("error", m), w(0, t.slice(), 2e3).then(function(t) {
2422
+ if (p(), !t) return g(), void n(null);
2423
+ n({
2424
+ realm: 1,
2425
+ startMs: performance.now() - e,
2426
+ lastRoundTripMs: function() {
2427
+ return a;
2428
+ },
2429
+ init: async function(t) {
2430
+ const n = dn(t);
2431
+ return !!n && (o++, y(), null !== await w(1, n, 2e3));
2432
+ },
2433
+ advance: async function(t, n) {
2434
+ const e = pn(t, n);
2435
+ if (!e) return null;
2436
+ const i = await w(2, e, 2e3);
2437
+ return i && 68 === i.byteLength ? new Uint8Array(i) : null;
2438
+ },
2439
+ stalled: function() {
2440
+ return h;
2441
+ },
2442
+ dispose: g
2443
+ });
2444
+ });
2445
+ });
2446
+ }(t) || yn(t);
2447
+ }(S), g !== d) return T?.dispose(), "stale";
2448
+ if (!T) return "failed";
2449
+ }
2450
+ let E = await T.init({
2451
+ s: n.s,
2452
+ kw: v
2453
+ }), R = E ? await T.advance(n.e, w) : null;
2454
+ if (g !== d) return I && T.dispose(), "stale";
2455
+ if (!R && 1 === T.realm && T.stalled()) {
2456
+ const t = await yn(S);
2457
+ if (t && (E = await t.init({
2458
+ s: n.s,
2459
+ kw: v
2460
+ }), R = E ? await t.advance(n.e, w) : null), g !== d) return t?.dispose(), I && T.dispose(), "stale";
2461
+ t && (I && T.dispose(), T = t, I = !0);
2462
+ }
2463
+ return t.restart(), R && k.setEpoch(R, y(T, k)) ? (i && i !== T && i.dispose(), e = k, i = T, r = S, o = b, s = n.s, a = n.s, u = n.e, h = null, "ok") : (I && T.dispose(), "failed");
2464
+ },
2465
+ advance: function(t, n, r) {
2466
+ const o = i, s = e;
2467
+ if (!o || !s || t !== a) return;
2468
+ if (!Number.isInteger(n) || n <= u) return;
2469
+ if (h && n <= h.e) return;
2470
+ const l = an(r, 16);
2471
+ if (!l) return;
2472
+ const c = { e: n };
2473
+ h = c, o.advance(n, l).then(function(r) {
2474
+ h === c && (h = null), r && o === i && s === e && (t !== a || n <= u || s.setEpoch(r, y(o, s)) && (u = n));
2475
+ });
2476
+ },
2477
+ boundCore: g,
2478
+ sessionId: function() {
2479
+ return s;
2480
+ },
2481
+ prove: function(t) {
2482
+ const n = g()?.bind(1, "", 0, t, 0, 0);
2483
+ if (!n) return null;
2484
+ try {
2485
+ return JSON.parse(n);
2486
+ } catch {
2487
+ return null;
2488
+ }
2489
+ },
2490
+ stop: function() {
2491
+ i?.dispose(), i = null, d++;
2492
+ }
2493
+ };
2494
+ }(n, t.onArtifactUrl);
2495
+ let i = !1, r = "idle", o = 0, s = null, a = !1, u = null, d = null, p = 0, g = null, w = null, v = !1, m = !1, b = 0, k = 0, S = null, T = !1, A = !1, I = !1, E = [], R = !1, M = null;
2496
+ function C(n) {
2497
+ const e = "pending" === r;
2498
+ if (r = n, "pending" === n) return;
2499
+ const i = E;
2500
+ E = [];
2501
+ for (const t of i) t();
2502
+ e && !I && (I = !0, t.onBindSettled());
2503
+ }
2504
+ function $() {
2505
+ if (P(), !a) return;
2506
+ const t = h(new Promise(function(t) {
2507
+ w = t;
2508
+ }), 1e3).then(function() {
2509
+ g === t && (g = null);
2510
+ });
2511
+ g = t;
2512
+ }
2513
+ function P() {
2514
+ const t = w;
2515
+ w = null, g = null, t?.();
2516
+ }
2517
+ function x() {
2518
+ d && (f(d.timer), d = null);
2519
+ }
2520
+ function U(n) {
2521
+ x(), A = !1;
2522
+ const i = t.ensureTabId(), s = u ? null : e.prove(i), a = u ?? s, l = {
2523
+ v: 1,
2524
+ rid: xt(),
2525
+ tabId: i,
2526
+ release: "ts-1.5.0"
2527
+ };
2528
+ return S && (l.avoid = S, S = null), t.collectorsFingerprint && (l.collectors = t.collectorsFingerprint), a && (l.prev = a), d = {
2529
+ body: l,
2530
+ viaActivity: n,
2531
+ attempt: 0,
2532
+ timer: null,
2533
+ dueAt: 0,
2534
+ ownProof: s ? s.s : ""
2535
+ }, e.boundCore() || "pending" === r || (r = "pending", o = performance.now()), d;
2536
+ }
2537
+ function B(t, n) {
2538
+ if (!0 !== n.enabled) return d = null, u = null, P(), void (e.boundCore() || C("off"));
2539
+ n.session ? (d = null, function(t, n) {
2540
+ const r = Number(t.renewAfterMs), o = r > 0 ? performance.now() + r : 0;
2541
+ v = !0, e.install(t).then(function(r) {
2542
+ if ("stale" !== r) {
2543
+ if (v = !1, P(), "ok" === r) {
2544
+ u = null, m = !1, b = 0, k = 0, p = o, null === s && (s = performance.now()), C("ok");
2545
+ const t = R || !n ? null : n;
2546
+ R = !1;
2547
+ try {
2548
+ M?.({
2549
+ session: e.sessionId(),
2550
+ linkedFrom: t
2551
+ });
2552
+ } catch {}
2553
+ return;
2554
+ }
2555
+ e.boundCore() || C("core-failed"), b++, k = performance.now() + Math.min(1e3 * 2 ** (b - 1), 3e4), !m && i && (m = !0, "string" == typeof t.variant && (S = t.variant), z(), e.boundCore() || C("core-failed"));
2556
+ }
2557
+ });
2558
+ }(n.session, t.ownProof)) : O(t);
2559
+ }
2560
+ function O(t) {
2561
+ if (P(), e.boundCore() || C("session-failed"), !i) return void (d = null);
2562
+ t.attempt++;
2563
+ const n = Math.min(1e3 * 2 ** (t.attempt - 1), 3e4);
2564
+ t.dueAt = performance.now() + n, t.timer = c(function() {
2565
+ t.timer = null, j(t);
2566
+ }, n);
2567
+ }
2568
+ function j(n) {
2569
+ if (d === n) {
2570
+ if (!i || !t.isActivityActive()) return d = null, void P();
2571
+ n.dueAt = 0, t.requestSession(n.body).then(function(t) {
2572
+ if (d !== n) return;
2573
+ const e = t.ok ? t.data : null, i = e && "enabled" in e ? e : e?.pulseguard;
2574
+ i ? B(n, i) : O(n);
2575
+ }).catch(function() {
2576
+ d === n && O(n);
2577
+ });
2578
+ }
2579
+ }
2580
+ function z() {
2581
+ i && Sn() && "off" !== r && (d || v || j(U(!1)));
2582
+ }
2583
+ function D() {
2584
+ const t = performance.now();
2585
+ d ? null !== d.timer && d.dueAt > 0 && t >= d.dueAt && (f(d.timer), d.timer = null, j(d)) : p > 0 && t >= p && (p = 0, z());
2586
+ }
2587
+ function F() {
2588
+ T = !1;
2589
+ const t = y.get(Bt);
2590
+ (function(t) {
2591
+ const n = t;
2592
+ return !!n && "string" == typeof n.s && n.s.startsWith("pulseguard_") && Number.isInteger(n.e) && "string" == typeof n.o && "string" == typeof n.t;
2593
+ })(t) && t.s !== kn && t.s !== e.sessionId() && (u = t), y.remove(Bt);
2594
+ }
2595
+ function L(t) {
2596
+ return e.boundCore() && null !== s ? {
2597
+ pulseguard: "ok",
2598
+ pulseguardMs: Math.max(0, s - t)
2599
+ } : "off" === r || "session-failed" === r || "core-failed" === r ? { pulseguard: r } : { pulseguard: "timeout" };
2600
+ }
2601
+ return {
2602
+ start: function() {
2603
+ i = !0, I = !1, Sn() ? F() : r = "core-failed";
2604
+ },
2605
+ stop: function() {
2606
+ i = !1, x(), P(), v = !1, A = !1, R = !1, e.stop(), "pending" === r && C(null === s ? "idle" : "ok");
2607
+ },
2608
+ beginActivityRequest: function() {
2609
+ if (i && Sn()) return U(!0).body;
2610
+ },
2611
+ onActivityStarted: function(t) {
2612
+ const n = d;
2613
+ if (n && n.viaActivity) {
2614
+ if (null === t) return d = null, P(), void (e.boundCore() || C("session-failed"));
2615
+ "pending" === r && (o = performance.now()), t ? ($(), B(n, t)) : B(n, { enabled: !1 });
2616
+ }
2617
+ },
2618
+ onActivityAdopted: function() {
2619
+ $(), z(), d || v || P();
2620
+ },
2621
+ onRestore: function() {
2622
+ A = !0;
2623
+ },
2624
+ onResumed: function() {
2625
+ A && (A = !1, z());
2626
+ },
2627
+ bindHoldMs: function() {
2628
+ return "pending" !== r || I || e.boundCore() ? 0 : Math.max(0, o + 3e3 - performance.now());
2629
+ },
2630
+ canBind: function() {
2631
+ return null !== e.boundCore();
2632
+ },
2633
+ isOff: function() {
2634
+ return "off" === r || !Sn();
2635
+ },
2636
+ bind: function(t, n) {
2637
+ const i = e.boundCore();
2638
+ if (!i) return null;
2639
+ const r = function(t, n, e) {
2640
+ const i = on(e, t.scratch());
2641
+ if (i < 0) return null;
2642
+ const r = t.bind(0, n.batchId, n.batchSequence, n.tabId, n.clientTimestamp, i);
2643
+ if (!r) return null;
2644
+ let o;
2645
+ try {
2646
+ o = JSON.parse(r);
2647
+ } catch {
2648
+ return null;
2649
+ }
2650
+ const s = (a = JSON.stringify({
2651
+ ...n,
2652
+ pulseguard: o
2653
+ }), en ? en.encode(a) : /* @__PURE__ */ new Uint8Array(0));
2654
+ var a;
2655
+ if (0 === i) return {
2656
+ body: s,
2657
+ sessionId: o.s
2658
+ };
2659
+ const l = new Uint8Array(s.length + 1 + i);
2660
+ return l.set(s, 0), l[s.length] = 10, l.set(t.scratch().subarray(0, i), s.length + 1), {
2661
+ body: l,
2662
+ sessionId: o.s
2663
+ };
2664
+ }(i, t, n);
2665
+ return r ? (a = !0, D(), r) : null;
2666
+ },
2667
+ settling: function() {
2668
+ return g;
2669
+ },
2670
+ onIngestResponse: function(t, n) {
2671
+ T && F(), t && "object" == typeof t && (1 === t.r && n === e.sessionId() && performance.now() >= k && (R = !0, z()), e.advance(n, t.e, t.n));
2672
+ },
2673
+ signDocument: function(t) {
2674
+ return e.boundCore()?.sign(t, 0) ?? null;
2675
+ },
2676
+ sessionId: function() {
2677
+ return e.sessionId();
2678
+ },
2679
+ onSessionInstalled: function(t) {
2680
+ M = t;
2681
+ },
2682
+ telemetry: function(t, n) {
2683
+ const e = t + 3e3 - performance.now();
2684
+ if ("pending" !== r || e <= 0) return n(L(t)), function() {};
2685
+ let i = !1;
2686
+ function o() {
2687
+ i || (i = !0, f(s), n(L(t)));
2688
+ }
2689
+ const s = c(o, e);
2690
+ return E.push(o), o;
2691
+ },
2692
+ storeProof: function() {
2693
+ const n = e.prove(t.ensureTabId());
2694
+ n && (kn = n.s, T = !0, y.set(Bt, n));
2695
+ },
2696
+ settleStoredProof: F,
2697
+ onVisibilityChange: function() {
2698
+ n.noteVisibility(), "undefined" != typeof document && "visible" === document.visibilityState && D();
2699
+ }
2700
+ };
2701
+ }
2702
+ async function _n(e, r) {
2703
+ const { collectors: o, sdk: a } = e;
2704
+ let u = null, c = null, f = null, h = null;
2705
+ try {
2706
+ const e = /* @__PURE__ */ new Set(), d = Tn({
2707
+ onArtifactUrl: (t) => {
2708
+ e.add(t);
2709
+ },
2710
+ requestSession: (t) => u.api.pulseguardSession(t),
2711
+ ensureTabId: () => h?.getTabId() ?? "",
2712
+ isActivityActive: () => c?.isActive() ?? !1,
2713
+ onBindSettled: () => f?.releaseBindHold(),
2714
+ collectorsFingerprint: mn(o)
2715
+ });
2716
+ u = tn({
2717
+ api: {
2718
+ version: a.api.version,
2719
+ url: a.api.url
2720
+ },
2721
+ getSdkToken: () => a.token,
2722
+ getProfileId: () => r.getProfileId(),
2723
+ getToken: () => c?.getToken() ?? null,
2724
+ refresh: async () => c?.refresh() ?? Promise.resolve(),
2725
+ getActivityId: () => c?.getActivityId() ?? "",
2726
+ pulseGuard: d
2727
+ });
2728
+ const p = await u.api.collectionStatus();
2729
+ if (!p.ok || !0 !== p.data.eventsCollectionEnabled) return { status: "collection-disabled" };
2730
+ c = new kt({
2731
+ startActivity: () => u.api.startActivity(d.beginActivityRequest()),
2732
+ stopActivity: () => u.api.stopActivity(),
2733
+ onActivityStarted: (t) => d.onActivityStarted(t),
2734
+ onActivityAdopted: () => d.onActivityAdopted()
2735
+ }), f = new jt(D, {
2736
+ ingest: (t, n) => u.api.ingest(t, n),
2737
+ getTabId: () => h?.getTabId() ?? "unknown",
2738
+ isActivityActive: () => c?.isActive() ?? !1,
2739
+ getBindHoldMs: () => d.bindHoldMs(),
2740
+ isBound: () => d.canBind()
2741
+ });
2742
+ const y = o.tab;
2743
+ h = new qt({
2744
+ push: (t) => f?.push(t),
2745
+ events: {
2746
+ state: y.enabled && y.events.state.enabled,
2747
+ count: y.enabled && y.events.count.enabled
2748
+ }
2749
+ });
2750
+ const g = /* @__PURE__ */ new Set();
2751
+ try {
2752
+ g.add(new URL(a.api.url).origin);
2753
+ } catch {}
2754
+ const w = function(t, n, e = "off") {
2755
+ const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), o = {
2756
+ ...t,
2757
+ registerBehaviourReader: function(t) {
2758
+ return r.add(t), function() {
2759
+ r.delete(t);
2760
+ };
2761
+ },
2762
+ collectorSelection: n
2763
+ };
2764
+ function a(t) {
2765
+ if (i.has(t)) return;
2766
+ const r = ot[t];
2767
+ if (!r || !function(t, n) {
2768
+ return n[t]?.enabled ?? !1;
2769
+ }(t, n)) return;
2770
+ if (H.includes(t) && !function(t) {
2771
+ return !0 === t.fpsignals?.enabled;
2772
+ }(n)) return;
2773
+ const s = n[t], a = r.create(o, e, s && "events" in s ? s.events : void 0);
2774
+ i.set(t, a);
2775
+ }
2776
+ return {
2777
+ start: a,
2778
+ stopCollector: function(t) {
2779
+ const n = i.get(t);
2780
+ n && (n(), i.delete(t));
2781
+ },
2782
+ stop: function() {
2783
+ for (const [, t] of i) t();
2784
+ i.clear();
2785
+ },
2786
+ isRunning: function(t) {
2787
+ return i.has(t);
2788
+ },
2789
+ autocapture: function() {
2790
+ a("fpsignals");
2791
+ for (const t of st) a(t);
2792
+ },
2793
+ readBehaviour: function(t) {
2794
+ let n = !1;
2795
+ for (const e of r) s(() => e(t)) && (n = !0);
2796
+ return n;
2797
+ }
2798
+ };
2799
+ }({
2800
+ push: (t) => f?.push(t),
2801
+ flush: () => f?.flush("submit"),
2802
+ sanitizeUrl: a.sanitizeUrl,
2803
+ ignoredOrigins: g,
2804
+ ignoredUrls: e,
2805
+ host: a.host,
2806
+ getTabId: () => h?.getTabId() ?? "",
2807
+ captureElementLevel: a.capture?.element ?? F,
2808
+ requestFlush: (t) => f?.requestFlush(t),
2809
+ getActivityId: () => c?.getActivityId() ?? "",
2810
+ registerEventRouter: (t) => (f?.setEventRouter(t), function() {
2811
+ f?.getEventRouter() === t && f.setEventRouter(null);
2812
+ }),
2813
+ pulseGuard: {
2814
+ signDocument: (t) => d.signDocument(t),
2815
+ sessionId: () => d.sessionId(),
2816
+ onSessionInstalled: (t) => d.onSessionInstalled(t),
2817
+ isOff: () => d.isOff(),
2818
+ telemetry: (t, n) => d.telemetry(t, n)
2819
+ }
2820
+ }, o, a.capture?.content), v = function(e) {
2821
+ let i = !1;
2822
+ function r(t) {
2823
+ s(() => e.isActivityActive()) && (s(() => e.holdCapacityFlush(function() {
2824
+ "pagehide" === t && s(() => e.stopTab()), s(() => e.readBehaviour(t));
2825
+ })), s(() => e.flush()), s(() => e.storeSessionProof?.()), "pagehide" === t && (e.getShouldSkipStopActivity() || e.stopActivity()));
2826
+ }
2827
+ const o = l((t) => {
2828
+ "visible" === document.visibilityState && s(() => e.settleSessionProof?.()), s(() => e.onVisibilityChange?.()), "hidden" === document.visibilityState && r("hidden");
2829
+ }), a = l((t) => {
2830
+ r("pagehide");
2831
+ }), u = l((t) => {
2832
+ r("beforeunload");
2833
+ }), c = l((t) => {
2834
+ s(() => e.settleSessionProof?.()), t.persisted && e.resume();
2835
+ }), f = l(() => e.onConnectionChange());
2836
+ return {
2837
+ start: function() {
2838
+ t(document, "visibilitychange", o), t(window, "pagehide", a), function() {
2839
+ if ("undefined" == typeof navigator) return !1;
2840
+ const t = navigator.userAgentData;
2841
+ return t && "boolean" == typeof t.mobile ? !t.mobile : !/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent ?? "");
2842
+ }() && !/Firefox\//.test(navigator.userAgent ?? "") && (t(window, "beforeunload", u), i = !0), t(window, "pageshow", c), t(window, "online", f), t(window, "offline", f);
2843
+ },
2844
+ stop: function() {
2845
+ n(document, "visibilitychange", o), n(window, "pagehide", a), i && (n(window, "beforeunload", u), i = !1), n(window, "pageshow", c), n(window, "online", f), n(window, "offline", f);
2846
+ },
2847
+ onHide: r
2848
+ };
2849
+ }({
2850
+ readBehaviour: (t) => w.readBehaviour(t),
2851
+ isActivityActive: () => c?.isActive() ?? !1,
2852
+ holdCapacityFlush: (t) => {
2853
+ f ? f.holdCapacityFlush(t) : t();
2854
+ },
2855
+ flush: () => f?.flush("lifecycle"),
2856
+ stopActivity: async () => c?.stop(),
2857
+ stopTab: () => h?.stop(),
2858
+ getShouldSkipStopActivity: () => (h?.queryTabsNumber() ?? 0) > 1,
2859
+ onConnectionChange: () => f?.onConnectionChange(),
2860
+ storeSessionProof: () => d.storeProof(),
2861
+ settleSessionProof: () => d.settleStoredProof(),
2862
+ onVisibilityChange: () => d.onVisibilityChange(),
2863
+ resume: async () => {
2864
+ try {
2865
+ d.onRestore(), await c?.start(), await h?.start(), d.onResumed();
2866
+ } catch (t) {
2867
+ i.warn("IncodeTRI", "resume after bfcache restore failed:", t);
2868
+ }
2869
+ }
2870
+ }), m = new nn({
2871
+ getActivityId: () => c?.getActivityId() ?? "",
2872
+ reportEvent: (t) => u.api.reportEvent(t)
2873
+ });
2874
+ return {
2875
+ status: "ready",
2876
+ managers: {
2877
+ falconServiceManager: u,
2878
+ activityManager: c,
2879
+ transportManager: f,
2880
+ tabManager: h,
2881
+ lifecycleManager: v,
2882
+ collectorManager: w,
2883
+ eventReportManager: m,
2884
+ pulseGuard: d
2885
+ }
2886
+ };
2887
+ } catch (t) {
2888
+ return i.warn("IncodeTRI", "setup() failed during construction:", t), { status: "init-failed" };
2889
+ }
2890
+ }
2891
+ let An = class t {
2892
+ constructor() {
2893
+ this.Lt = 0, this.Nt = null, this.qt = U;
2894
+ }
2895
+ static get instance() {
2896
+ return t.l || (t.l = new t()), t.l;
2897
+ }
2898
+ async setup(t) {
2899
+ if (this.qt !== U) return i.fatal("error", "setup()", `cannot set up from state '${this.qt}' — call reset() (or reload) first. Ignoring.`), z;
2900
+ try {
2901
+ const n = function(t) {
2902
+ if ("undefined" == typeof document) return i.fatal("error", "IncodeTRI", "TRI is not available in a non-browser environment."), null;
2903
+ if (!t?.token) return i.fatal("error", "SDK", "token is required."), null;
2904
+ if (!t.apiURL) return i.fatal("error", "SDK", "Couldn't initialise SDK — apiURL isn't provided."), null;
2905
+ const { element: n, content: e } = t.capture ?? {}, r = {
2906
+ token: t.token,
2907
+ capture: {
2908
+ element: n ?? F,
2909
+ content: e ?? "off"
2910
+ },
2911
+ api: {
2912
+ version: t.apiVersion ?? "1.0",
2913
+ url: t.apiURL
2914
+ },
2915
+ sanitizeUrl: (a = t.sanitizeUrl, a ? function(t) {
2916
+ return s(() => a(t, lt)) ?? lt(t);
2917
+ } : lt),
2918
+ host: (o = t.host, "string" == typeof o?.platform && "" !== o.platform && "string" == typeof o.version && "" !== o.version ? {
2919
+ platform: o.platform,
2920
+ version: o.version
2921
+ } : (void 0 !== o && i.warn("SDK", "host needs a non-empty platform and version — reporting TRI itself."), {
2922
+ platform: "tri-web",
2923
+ version: "0.5.1"
2924
+ })),
2925
+ DEBUG: t.DEBUG ?? !1
2926
+ };
2927
+ var o, a;
2928
+ return void 0 === t.collectors && void 0 === t.layers ? {
2929
+ sdk: r,
2930
+ collectors: ut()
2931
+ } : void 0 !== t.collectors ? {
2932
+ sdk: r,
2933
+ collectors: ft(t.collectors)
2934
+ } : {
2935
+ sdk: r,
2936
+ collectors: ct(t.layers)
2937
+ };
2938
+ }(t);
2939
+ if (!n) return this.qt = z, z;
2940
+ i.DEBUG = n.sdk.DEBUG;
2941
+ const e = await _n(n, { getProfileId: () => null });
2942
+ return "collection-disabled" === e.status ? (i.fatal("warn", "setup()", "Collection is disabled for the provided API Key."), this.qt = j, j) : "init-failed" === e.status ? (this.qt = z, z) : (this.Nt = e.managers, this.qt = B, v(function(t) {
2943
+ t.setups += 1;
2944
+ }), !1 !== t.autostart ? this.start() : B);
2945
+ } catch (t) {
2946
+ return i.warn("setup()", "failed:", t), this.qt = z, z;
2947
+ }
2948
+ }
2949
+ async start() {
2950
+ if (this.qt === U) return i.warn("start()", "start() requires a prior successful setup() — ignoring."), this.qt;
2951
+ if (this.qt !== B) return i.fatal("warn", "start()", "TRI is either already started or isn't ready — ignoring."), this.qt;
2952
+ this.qt = "starting";
2953
+ const t = ++this.Lt;
2954
+ return await this._(t), this.qt;
2955
+ }
2956
+ async stop() {
2957
+ i.warn("stop()", "called");
2958
+ const t = this.Nt;
2959
+ return t ? (++this.Lt, t.lifecycleManager.stop(), t.tabManager.stop(), t.collectorManager.stop(), t.eventReportManager.stop(), t.pulseGuard.stop(), this.qt = B, this.Ht(t)) : Promise.resolve(this.qt);
2960
+ }
2961
+ async reset() {
2962
+ this.Nt && v(function(t) {
2963
+ t.resets += 1;
2964
+ });
2965
+ const t = this.stop();
2966
+ return this.qt = U, this.Nt = null, t.then(() => this.qt);
2967
+ }
2968
+ async Ht(t) {
2969
+ return await h(Promise.resolve(t.transportManager.stop()), 2e3), await t.activityManager.stop(), this.qt;
2970
+ }
2971
+ async _(t) {
2972
+ const n = this.Nt;
2973
+ if (n) {
2974
+ try {
2975
+ if (n.tabManager.getTabId(), n.pulseGuard.start(), await n.activityManager.start(), t !== this.Lt) return;
2976
+ if (n.transportManager.start(), n.collectorManager.autocapture(), await n.tabManager.start(), t !== this.Lt) return;
2977
+ n.lifecycleManager.start();
2978
+ } catch (n) {
2979
+ i.warn("start()", "failed during monitoring start:", n), t === this.Lt && (this.qt = B);
2980
+ return;
2981
+ }
2982
+ t === this.Lt && (this.qt = O);
2983
+ }
2984
+ }
2985
+ async linkInterview(t) {
2986
+ if (this.qt !== O || !this.Nt) return i.warn("linkInterview()", "linkInterview() called before start() completed — ignoring."), !1;
2987
+ if (!t) return i.warn("linkInterview()", "linkInterview() called without sessionToken — ignoring."), !1;
2988
+ try {
2989
+ return (await this.Nt.falconServiceManager.api.linkInterview(t)).ok;
2990
+ } catch (t) {
2991
+ return i.warn("linkInterview()", "failed:", t), !1;
2992
+ }
2993
+ }
2994
+ async getFpSignals() {
2995
+ if (this.qt !== O) return i.warn("getFpSignals()", "getFpSignals() called before start() completed — ignoring."), null;
2996
+ try {
2997
+ return await (W ?? Promise.resolve(null));
2998
+ } catch (t) {
2999
+ return i.warn("getFpSignals()", "failed:", t), null;
3000
+ }
3001
+ }
3002
+ addFpSignals(t) {
3003
+ const n = this.Nt;
3004
+ if (this.qt !== O || !n) return i.warn("addFpSignals()", "addFpSignals() called before start() completed — ignoring."), !1;
3005
+ if (n.collectorManager.isRunning("fpsignals")) return i.warn("addFpSignals()", "the fpsignals collector is on and sends its own results — ignoring."), !1;
3006
+ if ("string" != typeof t || !t) return i.warn("addFpSignals()", "signals is empty — ignoring."), !1;
3007
+ try {
3008
+ return n.transportManager.push({
3009
+ name: "fp_signals",
3010
+ timestamp: Date.now(),
3011
+ signals: t,
3012
+ src: "host"
3013
+ }), !0;
3014
+ } catch (t) {
3015
+ return i.warn("addFpSignals()", "failed:", t), !1;
3016
+ }
3017
+ }
3018
+ getActivityId() {
3019
+ const t = this.Nt;
3020
+ if (this.qt !== O || !t) return i.warn("getActivityId()", "getActivityId() called before start() completed — returning null."), null;
3021
+ try {
3022
+ const { activityManager: n } = t;
3023
+ return n.isActive() && n.getActivityId() || null;
3024
+ } catch (t) {
3025
+ return i.warn("getActivityId()", "failed:", t), null;
3026
+ }
3027
+ }
3028
+ };
3029
+ async function In(t, n) {
3030
+ const e = function(t) {
3031
+ if ("string" != typeof t) return null;
3032
+ const n = t.trim();
3033
+ try {
3034
+ const { protocol: t } = new URL(n);
3035
+ return "http:" === t || "https:" === t ? n : null;
3036
+ } catch {
3037
+ return null;
3038
+ }
3039
+ }(n?.apiURL);
3040
+ if (!e) return {
3041
+ token: null,
3042
+ expiresAt: null,
3043
+ tokenType: null,
3044
+ eventsCollectionEnabled: !1,
3045
+ error: {
3046
+ status: 0,
3047
+ message: "[TRI] createSession: apiURL must be an absolute http(s) URL."
3048
+ }
3049
+ };
3050
+ const i = n?.timeout ?? 1e4, r = new AbortController();
3051
+ let o = null, s = !1, a = () => {};
3052
+ i && (o = c(() => {
3053
+ s = !0, r.abort();
3054
+ }, i));
3055
+ const l = n?.signal;
3056
+ if (l) if (l.aborted) r.abort();
3057
+ else {
3058
+ const t = () => r.abort();
3059
+ l.addEventListener("abort", t, { once: !0 }), a = () => l.removeEventListener("abort", t);
3060
+ }
3061
+ try {
3062
+ const n = await fetch(`${e}/api/v1/sdk/init`, {
3063
+ method: "POST",
3064
+ headers: {
3065
+ "content-type": "application/json",
3066
+ "x-api-key": t,
3067
+ "x-api-version": "1.0"
3068
+ },
3069
+ signal: r.signal
3070
+ });
3071
+ if (!n.ok) {
3072
+ let t = n.statusText;
3073
+ try {
3074
+ const e = await n.json();
3075
+ e.errorMessage && (t = e.errorMessage);
3076
+ } catch {}
3077
+ return {
3078
+ token: null,
3079
+ expiresAt: null,
3080
+ tokenType: null,
3081
+ eventsCollectionEnabled: !1,
3082
+ error: {
3083
+ status: n.status,
3084
+ message: t
3085
+ }
3086
+ };
3087
+ }
3088
+ const i = await n.json();
3089
+ return {
3090
+ token: i.token,
3091
+ expiresAt: i.expiresAt,
3092
+ tokenType: i.tokenType,
3093
+ eventsCollectionEnabled: !0,
3094
+ error: null
3095
+ };
3096
+ } catch (t) {
3097
+ throw new Error((s ? "[TRI] createSession timed out" : "[TRI] Failed to create session:") + " " + t.message);
3098
+ } finally {
3099
+ f(o), a();
3100
+ }
3101
+ }
3102
+ An.l = null;
3103
+ const En = An.instance;
3104
+ //#endregion
3105
+ export { In as createSession, En as default };