@incodetech/core 2.4.1-agentic.5 → 2.4.1-agentic.6

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 (199) hide show
  1. package/dist/DateFormattingProvider-DPq9zco-.esm.js +25 -0
  2. package/dist/{FaceDetectionProvider-ZiDiL_hY.esm.js → FaceDetectionProvider-DjXSD4uI.esm.js} +7 -7
  3. package/dist/addressSearch-D6cKPWmk.esm.js +72 -0
  4. package/dist/ae-signature.esm.js +1 -1
  5. package/dist/antifraud.esm.js +2 -2
  6. package/dist/{antifraudManager-BObuHBjn.esm.js → antifraudManager-CbIwM35x.esm.js} +2 -2
  7. package/dist/{antifraudStateMachine-Dfrd2-26.esm.js → antifraudStateMachine-qNNXrlsP.esm.js} +1 -1
  8. package/dist/{api-CpP4PS4S.esm.js → api-C_P9YXbL.esm.js} +1 -0
  9. package/dist/{apiError-CeyLcwt3.esm.js → apiError-DzZ5OriE.esm.js} +1 -1
  10. package/dist/{attemptCarry-WOkfvFMw.esm.js → attemptCarry-BaAXPR_w.esm.js} +1 -1
  11. package/dist/authentication.d.ts +3 -3
  12. package/dist/authentication.esm.js +2 -2
  13. package/dist/{authenticationManager-ffZXiENz.esm.js → authenticationManager-B-l8_8tH.esm.js} +4 -4
  14. package/dist/{authenticationManager-CWmh7aSY.d.ts → authenticationManager-DKLRA91K.d.ts} +1 -1
  15. package/dist/{authenticationStateMachine-ebqsPLXI.esm.js → authenticationStateMachine-Cg00UH7p.esm.js} +3 -3
  16. package/dist/{browser-pQZA35G2-Bu4in9gN.esm.js → browser-pQZA35G2-DJEJnmCd.esm.js} +1 -1
  17. package/dist/certificate-issuance.esm.js +2 -2
  18. package/dist/{certificateIssuanceManager-IRO_1Ug6.esm.js → certificateIssuanceManager-CrF3wjCH.esm.js} +2 -2
  19. package/dist/{certificateIssuanceStateMachine-CjxTBZuH.esm.js → certificateIssuanceStateMachine-uSD9IkcV.esm.js} +1 -1
  20. package/dist/consent.esm.js +2 -2
  21. package/dist/{consentManager-DMlSL6Ax.esm.js → consentManager-BD7wwgat.esm.js} +2 -2
  22. package/dist/{consentStateMachine-DIYSMxKQ.esm.js → consentStateMachine-BAiLDE3D.esm.js} +1 -1
  23. package/dist/{cpf-uAZTPUBy.esm.js → cpf-BIADjddF.esm.js} +1 -25
  24. package/dist/cross-document-data-match.esm.js +1 -1
  25. package/dist/{crossDocumentDataMatchManager-BFTdiEDB.esm.js → crossDocumentDataMatchManager-CUc1uACE.esm.js} +2 -2
  26. package/dist/curp-validation.d.ts +1 -1
  27. package/dist/curp-validation.esm.js +2 -2
  28. package/dist/{curpValidationManager-z8428oCM.d.ts → curpValidationManager-Crz3bnCo.d.ts} +1 -1
  29. package/dist/{curpValidationManager-DNpC3wyf.esm.js → curpValidationManager-DBfZSQbu.esm.js} +2 -2
  30. package/dist/{curpValidationStateMachine-B3iVsDyt.esm.js → curpValidationStateMachine-DyAEyScb.esm.js} +2 -2
  31. package/dist/custom-fields.esm.js +1 -1
  32. package/dist/custom-watchlist.esm.js +2 -2
  33. package/dist/{customFieldsManager-CvI-pDT3.esm.js → customFieldsManager-BZhIPyaY.esm.js} +2 -2
  34. package/dist/{customWatchlistManager-BuHtUb0y.esm.js → customWatchlistManager-B4cmxi__.esm.js} +2 -2
  35. package/dist/{customWatchlistStateMachine-CiVD9wyF.esm.js → customWatchlistStateMachine-ZZoDGRAZ.esm.js} +1 -1
  36. package/dist/{deepsightLoader-CJbBiTpq.esm.js → deepsightLoader-S0ktD2dZ.esm.js} +3 -3
  37. package/dist/{addressSearch-DzbE9Ogt.esm.js → definitionSource-1vPLtuXE.esm.js} +1 -72
  38. package/dist/{desktopCameraElection-BGMtYwk3.esm.js → desktopCameraElection-m2dAj6Zu.esm.js} +1 -1
  39. package/dist/document-capture.d.ts +1 -1
  40. package/dist/document-capture.esm.js +2 -2
  41. package/dist/{documentCaptureManager-CD5iQiUI.d.ts → documentCaptureManager-DDfviFg0.d.ts} +1 -1
  42. package/dist/{documentCaptureManager-DLPqruXJ.esm.js → documentCaptureManager-v57klTso.esm.js} +2 -2
  43. package/dist/{documentCaptureStateMachine-DCvWQhFG.esm.js → documentCaptureStateMachine-CgCtimSa.esm.js} +2 -2
  44. package/dist/dynamic-forms.esm.js +2 -2
  45. package/dist/{dynamicFormsManager-C1pBbCWs.esm.js → dynamicFormsManager-BKAlol5I.esm.js} +2 -2
  46. package/dist/{dynamicFormsStateMachine-iVdrXC1r.esm.js → dynamicFormsStateMachine-DTyEVRIb.esm.js} +2 -2
  47. package/dist/ekyb.d.ts +1 -1
  48. package/dist/ekyb.esm.js +2 -2
  49. package/dist/{ekybManager-OZ0SeXvq.esm.js → ekybManager-BYFWVBTW.esm.js} +2 -2
  50. package/dist/{ekybStateMachine-BDh-yJkS.esm.js → ekybStateMachine-CxSx0HNz.esm.js} +6 -4
  51. package/dist/ekyc-prefill.d.ts +17 -0
  52. package/dist/ekyc-prefill.esm.js +3 -0
  53. package/dist/ekyc.d.ts +2 -2
  54. package/dist/ekyc.esm.js +3 -3
  55. package/dist/{ekycManager-DymCvmVB.esm.js → ekycManager-Bwv-qYAZ.esm.js} +2 -2
  56. package/dist/{ekycManager-DlGIn9wA.d.ts → ekycManager-CERRvIfg.d.ts} +1 -1
  57. package/dist/ekycPrefillManager-CbI1rTKP.esm.js +102 -0
  58. package/dist/ekycPrefillManager-DHfC1T9s.d.ts +565 -0
  59. package/dist/ekycPrefillStateMachine-ClGEAsOy.esm.js +686 -0
  60. package/dist/ekycRules-B7vXnbdg.esm.js +319 -0
  61. package/dist/{ekycStateMachine-CoFCUJ2z.esm.js → ekycStateMachine-DlN1RCob.esm.js} +418 -533
  62. package/dist/{ekycUtils-GRuMELYr.esm.js → ekycUtils-K6VJXnOg.esm.js} +18 -6
  63. package/dist/electronic-signature.esm.js +1 -1
  64. package/dist/{electronicSignatureManager-CHe4KM2h.esm.js → electronicSignatureManager-Co_sso4-.esm.js} +3 -3
  65. package/dist/email.esm.js +2 -2
  66. package/dist/{emailManager-CGoE3CUe.esm.js → emailManager-BSaGg1Gl.esm.js} +2 -2
  67. package/dist/{emailStateMachine-KgHfDNvM.esm.js → emailStateMachine-CaoPZtZN.esm.js} +2 -2
  68. package/dist/{events-ggpBBaZ8.esm.js → events-kU5WJU4B.esm.js} +1 -1
  69. package/dist/events.esm.js +1 -1
  70. package/dist/extensibility.d.ts +14 -13
  71. package/dist/extensibility.esm.js +36 -35
  72. package/dist/face-match.esm.js +2 -2
  73. package/dist/{faceCaptureManagerFactory-GmZMp6TR.esm.js → faceCaptureManagerFactory-ErFltb83.esm.js} +2 -2
  74. package/dist/{faceCaptureManagerFactory-DV2ULUYS.d.ts → faceCaptureManagerFactory-ZudYP6Qp.d.ts} +3 -3
  75. package/dist/{faceCaptureSetup--MEv7wIJ.esm.js → faceCaptureSetup-D9VsC504.esm.js} +9 -9
  76. package/dist/{faceMatchManager-D2xKPjjQ.esm.js → faceMatchManager-qPJsa5Ac.esm.js} +2 -2
  77. package/dist/{faceMatchStateMachine-CUvwiQi9.esm.js → faceMatchStateMachine-D90ZHY1r.esm.js} +2 -2
  78. package/dist/{feature-management-hZhfjdAu.esm.js → feature-management-TNTHwnkm.esm.js} +1 -1
  79. package/dist/feature-management.esm.js +1 -1
  80. package/dist/field-comparison.esm.js +1 -1
  81. package/dist/{fieldComparisonManager-DgDbEeFZ.esm.js → fieldComparisonManager-BLLj_Ey1.esm.js} +2 -2
  82. package/dist/fiscal-qr.esm.js +1 -1
  83. package/dist/{fiscalQrManager-BZeklojR.esm.js → fiscalQrManager-Bh3rxb7Y.esm.js} +2 -2
  84. package/dist/flow-events.d.ts +1 -1
  85. package/dist/flow.d.ts +9 -8
  86. package/dist/flow.esm.js +46 -10
  87. package/dist/{flowCompletionService-E8ipjpAG.esm.js → flowCompletionService-BvoiqVJA.esm.js} +2 -2
  88. package/dist/{flowServices-Co77kn9L.esm.js → flowServices-BkrZ4ZU5.esm.js} +8 -8
  89. package/dist/geolocation.esm.js +2 -2
  90. package/dist/{geolocationManager-C8DY8c1D.esm.js → geolocationManager-hU9kxsr8.esm.js} +2 -2
  91. package/dist/{geolocationStateMachine-BluJR9Ew.esm.js → geolocationStateMachine-DyYMzzIb.esm.js} +3 -3
  92. package/dist/government-validation.esm.js +2 -2
  93. package/dist/{governmentValidationManager-CjChjZ3C.esm.js → governmentValidationManager-D5HkBqfr.esm.js} +2 -2
  94. package/dist/{governmentValidationStateMachine-AEbn3Afi.esm.js → governmentValidationStateMachine-BwMClTqC.esm.js} +1 -1
  95. package/dist/home.d.ts +1 -1
  96. package/dist/home.esm.js +1 -1
  97. package/dist/http.esm.js +1 -1
  98. package/dist/id-ocr.d.ts +2 -2
  99. package/dist/id-ocr.esm.js +3 -19
  100. package/dist/id-selfie-flow.d.ts +1 -1
  101. package/dist/id-selfie-flow.esm.js +6 -6
  102. package/dist/id-verification.esm.js +2 -2
  103. package/dist/id.d.ts +2 -2
  104. package/dist/id.esm.js +3 -3
  105. package/dist/{idCaptureManager-CCA2D1Ah.d.ts → idCaptureManager-NRGuCVv2.d.ts} +2 -2
  106. package/dist/{idCaptureManager-6amWi8Ko.esm.js → idCaptureManager-Xxlpem7N.esm.js} +6 -6
  107. package/dist/{idCaptureServices-Bpa4MmVC.esm.js → idCaptureServices-199UFURA.esm.js} +4 -4
  108. package/dist/{idCaptureStateMachine-BzBA2B4_.esm.js → idCaptureStateMachine-Bv-dhwgK.esm.js} +42 -14
  109. package/dist/idOcrCpfUtils-Nfln1Psb.esm.js +18 -0
  110. package/dist/{idOcrManager-BTdHlJ9D.d.ts → idOcrManager-B5xeI2lg.d.ts} +2 -2
  111. package/dist/{idOcrManager-xyEZNOBa.esm.js → idOcrManager-BMK2oou0.esm.js} +2 -2
  112. package/dist/{idOcrStateMachine-DNKXh4Rn.esm.js → idOcrStateMachine-RjNycN07.esm.js} +8 -7
  113. package/dist/{idVerificationManager-DdnvYfgN.esm.js → idVerificationManager-4wY-Ee4j.esm.js} +2 -2
  114. package/dist/{idVerificationStateMachine-DtIBCa32.esm.js → idVerificationStateMachine-Bj00uWvh.esm.js} +1 -1
  115. package/dist/identity-reuse.d.ts +1 -1
  116. package/dist/identity-reuse.esm.js +2 -2
  117. package/dist/{identityReuseManager-CcpovlfD.esm.js → identityReuseManager-CCZ-ES2E.esm.js} +2 -2
  118. package/dist/{identityReuseManager-B1birg5X.d.ts → identityReuseManager-ooAbp6Kc.d.ts} +4 -4
  119. package/dist/{identityReuseStateMachine-DxZFWy47.esm.js → identityReuseStateMachine-BtpkGpYZ.esm.js} +1 -1
  120. package/dist/{index-DC0P2Vzw.d.ts → index-BGnYn_4J.d.ts} +1 -1
  121. package/dist/{index-bD4-zpjs.d.ts → index-DlVDVTcf.d.ts} +31 -16
  122. package/dist/index.d.ts +1 -1
  123. package/dist/index.esm.js +1 -1
  124. package/dist/{invokeOnCaptureCallback-BJ0GVHGr.esm.js → invokeOnCaptureCallback-BkvXSZfa.esm.js} +1 -1
  125. package/dist/kyb-checks.esm.js +2 -2
  126. package/dist/{kybChecksManager-CbqLrEox.esm.js → kybChecksManager-CEEih5pC.esm.js} +1 -1
  127. package/dist/{kybChecksStateMachine-B_GS-KmL.esm.js → kybChecksStateMachine-DOE71Lv7.esm.js} +5 -4
  128. package/dist/mandatory-consent.d.ts +2 -2
  129. package/dist/mandatory-consent.esm.js +2 -2
  130. package/dist/{mandatoryConsentManager-B4vCYslr.esm.js → mandatoryConsentManager-BBeOo3Sz.esm.js} +2 -2
  131. package/dist/{mandatoryConsentManager-CEn59Ytw.d.ts → mandatoryConsentManager-MhZYQg10.d.ts} +1 -1
  132. package/dist/{mandatoryConsentStateMachine-DWslYPA3.esm.js → mandatoryConsentStateMachine-BJEyS63E.esm.js} +1 -1
  133. package/dist/{multipartRecordingService-BTqkHGG9.esm.js → multipartRecordingService-2iVLb-2Y.esm.js} +1 -1
  134. package/dist/phone.esm.js +2 -2
  135. package/dist/{phoneFormat-JJNaWthV.esm.js → phoneFormat-DEpESpz2.esm.js} +13 -1
  136. package/dist/{phoneManager-Dy5tODCU.esm.js → phoneManager-BylOWecM.esm.js} +2 -2
  137. package/dist/{phoneServices-DJgyOzU2.esm.js → phoneServices-Crge7uSV.esm.js} +1 -1
  138. package/dist/{phoneStateMachine-DnlPhnw7.esm.js → phoneStateMachine-CHnhCS-4.esm.js} +2 -2
  139. package/dist/{processFaceMatch-Bst83HaS.esm.js → processFaceMatch-BveUAHts.esm.js} +1 -1
  140. package/dist/qe-signature.esm.js +1 -1
  141. package/dist/{recordingService-CTko6Cjn.esm.js → recordingService-DKXaaOHO.esm.js} +2 -2
  142. package/dist/redirect-to-mobile.esm.js +2 -2
  143. package/dist/{redirectToMobileManager-CCSNyi19.esm.js → redirectToMobileManager-DUpLyXsq.esm.js} +2 -2
  144. package/dist/{redirectToMobileStateMachine-BKyOdAUe.esm.js → redirectToMobileStateMachine-D0DW4y-f.esm.js} +1 -1
  145. package/dist/{resolveForm-O7-r79VA.esm.js → resolveForm-f9PhUo9j.esm.js} +1 -209
  146. package/dist/{runChildModule-DHDczcGZ.esm.js → runChildModule-CDixuH1W.esm.js} +2 -2
  147. package/dist/{sdkVersion-CxaRTa9r.esm.js → sdkVersion-BNA7_9wn.esm.js} +1 -1
  148. package/dist/selfie.d.ts +3 -3
  149. package/dist/selfie.esm.js +9 -9
  150. package/dist/{selfieErrorUtils-Dk0ofKio.esm.js → selfieErrorUtils-Geee35WF.esm.js} +1 -1
  151. package/dist/{selfieManager-DmZFzs1-.d.ts → selfieManager-BPOlD-UN.d.ts} +1 -1
  152. package/dist/{selfieManager-EgnSX_Hu.esm.js → selfieManager-DVWFz5tv.esm.js} +4 -4
  153. package/dist/{selfieStateMachine-B8pBvum8.esm.js → selfieStateMachine-D9KQUtMs.esm.js} +3 -3
  154. package/dist/{session-CaliXPVw.esm.js → session-DoFzV1FT.esm.js} +4 -4
  155. package/dist/session.d.ts +1 -1
  156. package/dist/session.esm.js +5 -5
  157. package/dist/{sessionInitializer-Tr_ZkaSs.esm.js → sessionInitializer-DOZzSzqm.esm.js} +7 -7
  158. package/dist/{setup-Bz4l-E3R.esm.js → setup-B6WhRfCS.esm.js} +10 -13
  159. package/dist/{setup-Dyv1tJFj.d.ts → setup-prV5HQCQ.d.ts} +1 -1
  160. package/dist/signature.esm.js +2 -2
  161. package/dist/{signatureManager-CwqjcxPg.esm.js → signatureManager-QlegdTo3.esm.js} +2 -2
  162. package/dist/{signatureStateMachine-DBVDd1Eu.esm.js → signatureStateMachine-DFbbbFwg.esm.js} +1 -1
  163. package/dist/{stats-CatA2dea.esm.js → stats-Bv5PiWvo.esm.js} +1 -1
  164. package/dist/stats.esm.js +1 -1
  165. package/dist/step-up.d.ts +3 -5
  166. package/dist/step-up.esm.js +5 -11
  167. package/dist/{tri-CKUbuky5.esm.js → tri-B9aoyV2Z.esm.js} +3 -32
  168. package/dist/tri.d.ts +1 -1
  169. package/dist/tri.esm-DgtAka_v.esm.js +2145 -0
  170. package/dist/tri.esm.js +1 -1
  171. package/dist/{trueSightService-DDdJ8TrY.esm.js → trueSightService-nGcZHLsZ.esm.js} +3 -3
  172. package/dist/trust-graph.esm.js +1 -1
  173. package/dist/{types-Csh8vzPo.d.ts → types-0Rr7etmf.d.ts} +1 -1
  174. package/dist/types-B2M1IPZn.d.ts +6 -0
  175. package/dist/{types-BEVHQbbC.d.ts → types-BD9sV5oG.d.ts} +1 -1
  176. package/dist/{types-CuMJ2M7D.d.ts → types-BaDx6utW.d.ts} +4 -1
  177. package/dist/{types-BPm1JSu7.d.ts → types-BpJ21a4T.d.ts} +1 -1
  178. package/dist/{types-CJ7Yl9K-.d.ts → types-Bpo97EOh.d.ts} +4 -2
  179. package/dist/{types-CRaFu6wS.d.ts → types-CquDWYfv.d.ts} +6 -2
  180. package/dist/types-D9vIGFbl.d.ts +115 -0
  181. package/dist/{types-Cd0J0F9D.d.ts → types-NMBsvLIN.d.ts} +1 -1
  182. package/dist/usStates-CwOQ2kAx.esm.js +209 -0
  183. package/dist/video-selfie.d.ts +1 -1
  184. package/dist/video-selfie.esm.js +6 -6
  185. package/dist/{videoSelfieCameraWarmer-Dsk8JQNy.esm.js → videoSelfieCameraWarmer-BH8HH2Yo.esm.js} +4 -4
  186. package/dist/{videoSelfieStepDetector-Dv3Mgws-.d.ts → videoSelfieStepDetector-B78BE_x9.d.ts} +2 -2
  187. package/dist/wasm.d.ts +1 -1
  188. package/dist/wasm.esm.js +1 -1
  189. package/dist/watchlist-for-business.esm.js +2 -2
  190. package/dist/watchlist.esm.js +2 -2
  191. package/dist/{watchlistForBusinessManager-DqUpAEj_.esm.js → watchlistForBusinessManager-DOYmIiaj.esm.js} +2 -2
  192. package/dist/{watchlistForBusinessStateMachine-DdaPl2PS.esm.js → watchlistForBusinessStateMachine-D8qIyL8w.esm.js} +1 -1
  193. package/dist/{watchlistManager-CdpXzT4B.esm.js → watchlistManager-BJGLRv-x.esm.js} +2 -2
  194. package/dist/{watchlistStateMachine-ofHW_lPk.esm.js → watchlistStateMachine-DeLfuGSl.esm.js} +1 -1
  195. package/dist/workflow.d.ts +1 -1
  196. package/dist/workflow.esm.js +42 -36
  197. package/package.json +6 -1
  198. package/dist/tri.esm-DvgaFxHR.esm.js +0 -3838
  199. package/dist/types-J6g6iKe_.d.ts +0 -6
@@ -0,0 +1,2145 @@
1
+ const e = class t {
2
+ constructor() {
3
+ this.t = !1;
4
+ }
5
+ static get instance() {
6
+ return t.i || (t.i = new t()), t.i;
7
+ }
8
+ get DEBUG() {
9
+ return this.t;
10
+ }
11
+ set DEBUG(t) {
12
+ this.t = t;
13
+ }
14
+ warn(t, e, ...n) {
15
+ this.t && this.o("warn", t, e, ...n);
16
+ }
17
+ error(t, e, ...n) {
18
+ this.t && this.o("error", t, e, ...n);
19
+ }
20
+ info(t, e, ...n) {
21
+ this.t && this.o("info", t, e, ...n);
22
+ }
23
+ fatal(t, e, n, ...i) {
24
+ this.o(t, e, n, ...i);
25
+ }
26
+ o(t, e, n, ...i) {
27
+ const r = e ? `[${e}]` : "", s = console?.[t];
28
+ s && s(`[IncodeTRI]${r} ${n}`, ...i);
29
+ }
30
+ }.instance;
31
+ const i = {
32
+ "fpSignalsLib.js": "1f626062235d1ff29a29b7bb884cd10ef94e8e02b9f23437bcea950632cfa5ea",
33
+ "fpSignalsLib.wasm": "e4c4a6b85995f38df0b11b459a670786e2786cc4e7e41535aa6977d81eb9fad7",
34
+ "fpSignalsLibSimd.js": "4b7ae308c1354368e9e48a719923806b70d1ed2c97dd05a6214f991039099c0e",
35
+ "fpSignalsLibSimd.wasm": "0d93b31577808d232ed2494825c09c071d0b5f0278c8070c3fc9dfe91af025f7"
36
+ };
37
+ var r = class extends Error {
38
+ constructor(t, e) {
39
+ super(e), this.name = "FpSignalsLoadError", this.reason = t;
40
+ }
41
+ };
42
+ async function s(t) {
43
+ const e = new URL(t).pathname.split("/").pop() ?? "", n = i[e];
44
+ if (!n) throw new r("integrity-mismatch", `fpSignals: no digest for ${e}`);
45
+ const s = globalThis.crypto?.subtle;
46
+ if (!s) throw new r("no-crypto-subtle", "fpSignals: crypto.subtle is unavailable, so the files cannot be verified. Serve the page over HTTPS.");
47
+ const o = await async function(t, e) {
48
+ try {
49
+ const e = await fetch(t);
50
+ if (!e.ok) throw new Error(`HTTP ${e.status}`);
51
+ return new Uint8Array(await e.arrayBuffer());
52
+ } catch (t) {
53
+ throw new r("network-or-csp", `fpSignals: ${e} could not be fetched: ${String(t)}`);
54
+ }
55
+ }(t, e);
56
+ if (function(t) {
57
+ let e = "";
58
+ for (const n of new Uint8Array(t)) e += n.toString(16).padStart(2, "0");
59
+ return e;
60
+ }(await s.digest("SHA-256", o)) !== n) throw new r("integrity-mismatch", `fpSignals: ${e} does not match the pinned build`);
61
+ return o;
62
+ }
63
+ var o;
64
+ async function a(t) {
65
+ const e = t.replace(/\.wasm($|\?)/, ".js$1"), n = await async function(t) {
66
+ const e = await s(t), n = URL.createObjectURL(new Blob([e], { type: "text/javascript" }));
67
+ try {
68
+ return await import(
69
+ /* @vite-ignore */
70
+ /* webpackIgnore: true */
71
+ n
72
+ );
73
+ } catch (t) {
74
+ throw new r("network-or-csp", `fpSignals: the verified glue could not be imported: ${String(t)}`);
75
+ } finally {
76
+ URL.revokeObjectURL(n);
77
+ }
78
+ }(e), i = n.Module ?? n.default;
79
+ if (!i) throw new Error(`Failed to import Module from ${e}`);
80
+ const o = await s(t), a = window.wasmArrayBuffer;
81
+ window.wasmArrayBuffer = o;
82
+ try {
83
+ return await i({ wasmBinary: o });
84
+ } finally {
85
+ window.wasmArrayBuffer = a;
86
+ }
87
+ }
88
+ (function(t) {
89
+ t[t.Device = 1] = "Device", t[t.Behaviour = 2] = "Behaviour", t[t.PID = 3] = "PID";
90
+ })(o || (o = {}));
91
+ var c = class {
92
+ constructor() {
93
+ this.wasmModule = null, this.signalsApi = null, this.usedSimd_ = !1;
94
+ }
95
+ async initialize(t, n, i = !0) {
96
+ if (this.signalsApi) return;
97
+ const r = i && !!n;
98
+ try {
99
+ this.wasmModule = await a(r ? n : t), this.usedSimd_ = r;
100
+ } catch (n) {
101
+ if (!r) throw n;
102
+ e.warn("FpSignals", "SIMD init error:", n), this.wasmModule = await a(t), this.usedSimd_ = !1;
103
+ }
104
+ this.signalsApi = new this.wasmModule.FpSignals();
105
+ }
106
+ get usedSimd() {
107
+ return this.usedSimd_;
108
+ }
109
+ isReady() {
110
+ return null !== this.signalsApi;
111
+ }
112
+ setHostInfo(t, e) {
113
+ this.api().shi(t, e);
114
+ }
115
+ async collect() {
116
+ const t = this.api();
117
+ for (; !t.ppf();) await new Promise((t) => setTimeout(t, 0));
118
+ }
119
+ setBehaviourCollectionEnabled(t) {
120
+ this.api().sbc(t);
121
+ }
122
+ getSignals(t) {
123
+ return this.api().gsd(t);
124
+ }
125
+ hasMethod(t) {
126
+ return "function" == typeof this.signalsApi?.[t];
127
+ }
128
+ getSignalsWithReason(t, e) {
129
+ const n = this.api();
130
+ return "function" == typeof n.gsr ? n.gsr(t, e) : n.gsd(t);
131
+ }
132
+ getBufferFill() {
133
+ const t = this.api();
134
+ if ("function" != typeof t.gbf) return null;
135
+ const e = t.gbf();
136
+ return "number" == typeof e && Number.isFinite(e) ? e : null;
137
+ }
138
+ setNextSequence(t) {
139
+ const e = this.api();
140
+ return "function" == typeof e.ssq && (e.ssq(t), !0);
141
+ }
142
+ setTabId(t) {
143
+ const e = this.api();
144
+ return "function" == typeof e.sti && (e.sti(t), !0);
145
+ }
146
+ setCapturePolicy(t) {
147
+ const e = this.api();
148
+ return "function" == typeof e.scp && (e.scp(JSON.stringify(t)), !0);
149
+ }
150
+ setUrlSanitizer(t) {
151
+ const e = this.api();
152
+ return "function" == typeof e.sus && (e.sus(t), !0);
153
+ }
154
+ addCustomEvent(t, e) {
155
+ const n = this.api();
156
+ return "function" == typeof n.ace && (n.ace(t, e), !0);
157
+ }
158
+ freeResources() {
159
+ this.signalsApi && (this.signalsApi.delete(), this.signalsApi = null), this.wasmModule = null;
160
+ }
161
+ api() {
162
+ if (!this.signalsApi) throw new Error("FpSignals has not been initialized");
163
+ return this.signalsApi;
164
+ }
165
+ };
166
+ function l(t, e) {
167
+ return !t || (t[e]?.enabled ?? !1);
168
+ }
169
+ function u(t, e, n) {
170
+ let i = t, r = e;
171
+ if ("devicepixelratiochange" === e) {
172
+ const t = window.devicePixelRatio;
173
+ i = window.matchMedia(`(resolution: ${t}dppx)`), r = "change";
174
+ }
175
+ i.addEventListener(r, n, {
176
+ capture: !0,
177
+ passive: !0
178
+ });
179
+ }
180
+ function h(t, e, n) {
181
+ let i = t, r = e;
182
+ if ("devicepixelratiochange" === e) {
183
+ const t = window.devicePixelRatio;
184
+ i = window.matchMedia(`(resolution: ${t}dppx)`), r = "change";
185
+ }
186
+ i.removeEventListener(r, n, { capture: !0 });
187
+ }
188
+ const f = globalThis.setTimeout.bind(globalThis);
189
+ const d = globalThis.clearTimeout.bind(globalThis);
190
+ function p(t, n) {
191
+ try {
192
+ return t();
193
+ } catch (t) {
194
+ e.warn("utils", "safeSync swallowed error:", t);
195
+ }
196
+ }
197
+ async function y(t) {
198
+ try {
199
+ return await t();
200
+ } catch (t) {
201
+ e.warn("utils", "safeAsync swallowed error:", t);
202
+ }
203
+ }
204
+ function v(t) {
205
+ return (e) => p(() => t(e));
206
+ }
207
+ function w(t) {
208
+ return (...n) => {
209
+ try {
210
+ t(...n);
211
+ } catch (t) {
212
+ e.warn("utils", "safeTimer swallowed error:", t);
213
+ }
214
+ };
215
+ }
216
+ function g(t, e) {
217
+ return f(w(t), e);
218
+ }
219
+ function m(t) {
220
+ if (null !== t) try {
221
+ d(t);
222
+ } catch (t) {
223
+ e.warn("utils", "safeClearTimeout swallowed error:", t);
224
+ }
225
+ }
226
+ const b = {
227
+ pointer: { events: {
228
+ pointer: ["pointerButtons"],
229
+ click: ["clicks"],
230
+ dblclick: ["dblclicks"],
231
+ contextmenu: ["contextmenus"]
232
+ } },
233
+ pointermove: { all: ["pointerMoves"] },
234
+ hover: { all: ["hover"] },
235
+ focus: { all: ["focus"] },
236
+ input: { all: ["input"] },
237
+ keystroke: { all: ["keys"] },
238
+ clipboard: { events: {
239
+ paste: ["paste"],
240
+ cut: ["cut"],
241
+ copy: ["copy"]
242
+ } },
243
+ form: { events: {
244
+ submit: ["submit"],
245
+ invalid: ["invalid"],
246
+ snapshot: ["snapshots"]
247
+ } },
248
+ change: { all: ["change"] },
249
+ selection: { all: ["selection"] },
250
+ scroll: { all: ["scroll"] },
251
+ wheel: { all: ["wheel"] },
252
+ viewportresize: { all: ["resize"] },
253
+ viewport: { events: {
254
+ orientationchange: ["screenOrientation"],
255
+ devicepixelratiochange: ["devicePixelRatio"]
256
+ } },
257
+ sensors: { events: {
258
+ motion: ["deviceMotion"],
259
+ orientation: ["deviceOrientation"],
260
+ light: ["ambientLight"]
261
+ } },
262
+ visibility: { all: ["visibility"] },
263
+ screen: { all: ["screenChanges"] },
264
+ networkconnection: { all: ["online"] }
265
+ };
266
+ const k = ["pointerButtons", "pointerMoves"];
267
+ function S(t, e) {
268
+ return !0 === t[e]?.enabled;
269
+ }
270
+ function T(t, e, n) {
271
+ const i = t[e];
272
+ if (!i || !i.enabled) return !1;
273
+ return ("events" in i ? i.events : void 0)?.[n]?.enabled ?? !0;
274
+ }
275
+ function _(t) {
276
+ const e = [];
277
+ for (const n of Object.keys(b)) {
278
+ const i = b[n];
279
+ if ("all" in i) S(t, n) || e.push(...i.all);
280
+ else for (const r of Object.keys(i.events)) T(t, n, r) || e.push(...i.events[r]);
281
+ }
282
+ let n = !0;
283
+ for (const t of k) e.includes(t) || (n = !1);
284
+ return n && e.push("touch"), e;
285
+ }
286
+ let I = null;
287
+ const E = /* @__PURE__ */ new Set([
288
+ "xmlhttprequest",
289
+ "fetch",
290
+ "beacon",
291
+ "navigation",
292
+ "script",
293
+ "link",
294
+ "css",
295
+ "img",
296
+ "iframe",
297
+ "video",
298
+ "audio"
299
+ ]);
300
+ const A = /* @__PURE__ */ new Set([
301
+ "xmlhttprequest",
302
+ "fetch",
303
+ "beacon"
304
+ ]);
305
+ function C(t, e) {
306
+ return e ? t : null;
307
+ }
308
+ function R(t, e) {
309
+ const n = t.responseStart > 0, i = n ? t.transferSize : null, r = n ? t.encodedBodySize : null, s = n ? t.decodedBodySize : null, o = n && t.nextHopProtocol || null, a = n && void 0 !== t.deliveryType ? t.deliveryType : null, c = t.responseStatus, l = void 0 !== c && 0 !== c ? c : null, u = {
310
+ name: "network_request",
311
+ timestamp: Date.now(),
312
+ performanceTime: t.startTime + t.duration,
313
+ url: e(t.name),
314
+ initiatorType: (h = t.initiatorType, E.has(h) ? h : "other"),
315
+ startTime: t.startTime,
316
+ durationMs: t.duration,
317
+ fetchStart: t.fetchStart,
318
+ domainLookupStart: C(t.domainLookupStart, n),
319
+ domainLookupEnd: C(t.domainLookupEnd, n),
320
+ connectStart: C(t.connectStart, n),
321
+ connectEnd: C(t.connectEnd, n),
322
+ secureConnectionStart: C(t.secureConnectionStart, n),
323
+ requestStart: C(t.requestStart, n),
324
+ responseStart: C(t.responseStart, n),
325
+ responseEnd: t.responseEnd,
326
+ transferSize: i,
327
+ encodedBodySize: r,
328
+ decodedBodySize: s,
329
+ nextHopProtocol: o,
330
+ deliveryType: a,
331
+ responseStatus: l
332
+ };
333
+ var h;
334
+ return Object.assign(u, function(t, e) {
335
+ return {
336
+ dnsLookupMs: C(t.domainLookupEnd - t.domainLookupStart, e),
337
+ tcpConnectMs: C(t.connectEnd - t.connectStart, e),
338
+ tlsHandshakeMs: C(t.connectEnd > 0 && t.secureConnectionStart > 0 ? t.connectEnd - t.secureConnectionStart : 0, e),
339
+ ttfbMs: C(t.responseStart - t.requestStart, e),
340
+ responseDownloadMs: C(t.responseEnd - t.responseStart, e)
341
+ };
342
+ }(t, n)), u;
343
+ }
344
+ function M() {}
345
+ function $(t, e, n, i, r) {
346
+ return {
347
+ name: "navigation",
348
+ timestamp: Date.now(),
349
+ ts: performance.now(),
350
+ phase: t,
351
+ type: e,
352
+ from: n.from,
353
+ to: n.to,
354
+ timeOrigin: i,
355
+ timing: r
356
+ };
357
+ }
358
+ function P(t, e) {
359
+ if (t.firstElementChild) return t.firstElementChild;
360
+ let n = t;
361
+ for (; null !== n && n !== e;) {
362
+ if (n.nextElementSibling) return n.nextElementSibling;
363
+ n = n.parentElement;
364
+ }
365
+ return null;
366
+ }
367
+ function x(t, e) {
368
+ switch (t) {
369
+ case "FORM":
370
+ e.formCount++;
371
+ break;
372
+ case "INPUT":
373
+ e.inputCount++;
374
+ break;
375
+ case "BUTTON":
376
+ e.buttonCount++;
377
+ break;
378
+ case "A":
379
+ e.linkCount++;
380
+ break;
381
+ case "SELECT":
382
+ e.selectCount++;
383
+ break;
384
+ case "TEXTAREA":
385
+ e.textareaCount++;
386
+ break;
387
+ case "IFRAME":
388
+ e.iframeCount++;
389
+ break;
390
+ case "SCRIPT":
391
+ e.scriptCount++;
392
+ break;
393
+ case "IMG": e.imageCount++;
394
+ }
395
+ }
396
+ function z(t) {
397
+ let e = null, n = null, i = null;
398
+ function r() {
399
+ if (m(e), e = null, m(i), i = null, null !== n) {
400
+ const t = n;
401
+ n = null, p(() => window.cancelIdleCallback?.(t));
402
+ }
403
+ }
404
+ return {
405
+ schedule: function(s, o, a) {
406
+ r();
407
+ const c = function(t) {
408
+ if (!t) return null;
409
+ try {
410
+ return new URL(t, location.href).pathname;
411
+ } catch {
412
+ return null;
413
+ }
414
+ }(a);
415
+ e = g(() => {
416
+ e = null, function(t) {
417
+ const e = window;
418
+ "function" != typeof e.requestIdleCallback ? i = g(() => {
419
+ i = null, t();
420
+ }, 0) : n = e.requestIdleCallback(w(() => {
421
+ n = null, t();
422
+ }), { timeout: 2e3 });
423
+ }(() => function(e, n, i) {
424
+ const r = function(t = 2e4) {
425
+ const e = {
426
+ textLength: 0,
427
+ interactiveCount: 0,
428
+ scrollHeight: 0,
429
+ innerHeight: 0,
430
+ nodeCount: 0,
431
+ formCount: 0,
432
+ inputCount: 0,
433
+ buttonCount: 0,
434
+ linkCount: 0,
435
+ selectCount: 0,
436
+ textareaCount: 0,
437
+ iframeCount: 0,
438
+ scriptCount: 0,
439
+ imageCount: 0,
440
+ truncated: !1
441
+ }, n = document.documentElement;
442
+ let i = n;
443
+ for (; null !== i;) {
444
+ if (e.nodeCount >= t) {
445
+ e.truncated = !0;
446
+ break;
447
+ }
448
+ e.nodeCount++, x(i.tagName, e), i = P(i, n);
449
+ }
450
+ return e.textLength = document.body?.textContent?.length ?? 0, e.interactiveCount = document.querySelectorAll("input,button,a,select,textarea").length, e.scrollHeight = document.documentElement?.scrollHeight ?? 0, e.innerHeight = window.innerHeight, e;
451
+ }(), s = {
452
+ name: "page_complexity",
453
+ timestamp: Date.now(),
454
+ ts: performance.now(),
455
+ phase: e,
456
+ type: n,
457
+ path: i,
458
+ ...r
459
+ };
460
+ t.push(s);
461
+ }(s, o, c));
462
+ }, "load" === s ? 1500 : 500);
463
+ },
464
+ dispose: r
465
+ };
466
+ }
467
+ function B() {
468
+ return function() {};
469
+ }
470
+ const L = {
471
+ pointer: {
472
+ create: B,
473
+ layer: "behavioral",
474
+ events: [
475
+ "pointer",
476
+ "click",
477
+ "dblclick",
478
+ "contextmenu"
479
+ ]
480
+ },
481
+ pointermove: {
482
+ create: B,
483
+ layer: "behavioral"
484
+ },
485
+ focus: {
486
+ create: B,
487
+ layer: "behavioral"
488
+ },
489
+ input: {
490
+ create: B,
491
+ layer: "behavioral"
492
+ },
493
+ keystroke: {
494
+ create: B,
495
+ layer: "behavioral"
496
+ },
497
+ clipboard: {
498
+ create: B,
499
+ layer: "behavioral",
500
+ events: [
501
+ "paste",
502
+ "cut",
503
+ "copy"
504
+ ]
505
+ },
506
+ form: {
507
+ create: B,
508
+ layer: "behavioral",
509
+ events: [
510
+ "submit",
511
+ "invalid",
512
+ "snapshot"
513
+ ]
514
+ },
515
+ change: {
516
+ create: B,
517
+ layer: "behavioral"
518
+ },
519
+ selection: {
520
+ create: B,
521
+ layer: "behavioral"
522
+ },
523
+ tab: {
524
+ create: B,
525
+ layer: "session",
526
+ events: ["state", "count"]
527
+ },
528
+ visibility: {
529
+ create: B,
530
+ layer: "session"
531
+ },
532
+ navigation: {
533
+ create: function(t) {
534
+ let e = t.sanitizeUrl(document.referrer || "");
535
+ const n = z(t);
536
+ function i(i) {
537
+ t.push(i), e = i.to ?? "", n && "hide" !== i.phase && n.schedule(i.phase, i.type, i.to);
538
+ }
539
+ const r = v(() => {
540
+ const [e] = performance.getEntriesByType("navigation");
541
+ var n;
542
+ i($("load", e?.type ?? "navigate", {
543
+ from: document.referrer ? t.sanitizeUrl(document.referrer) : null,
544
+ to: t.sanitizeUrl(location.href)
545
+ }, performance.timeOrigin, e ? {
546
+ fetchStart: (n = e).fetchStart,
547
+ domainLookupStart: n.domainLookupStart,
548
+ domainLookupEnd: n.domainLookupEnd,
549
+ connectStart: n.connectStart,
550
+ connectEnd: n.connectEnd,
551
+ requestStart: n.requestStart,
552
+ responseStart: n.responseStart,
553
+ responseEnd: n.responseEnd,
554
+ domInteractive: n.domInteractive,
555
+ domContentLoadedEventStart: n.domContentLoadedEventStart,
556
+ domContentLoadedEventEnd: n.domContentLoadedEventEnd,
557
+ domComplete: n.domComplete,
558
+ loadEventStart: n.loadEventStart,
559
+ loadEventEnd: n.loadEventEnd,
560
+ redirectCount: n.redirectCount,
561
+ transferSize: n.transferSize,
562
+ encodedBodySize: n.encodedBodySize,
563
+ decodedBodySize: n.decodedBodySize
564
+ } : void 0));
565
+ }), s = v((n) => {
566
+ const r = n;
567
+ if (null === r.navigationType) return;
568
+ const s = t.sanitizeUrl(location.href);
569
+ s !== e && i($("change", r.navigationType, {
570
+ from: e,
571
+ to: s
572
+ }, performance.timeOrigin));
573
+ }), o = v(() => c("traverse")), a = v(() => c("hashchange"));
574
+ function c(n) {
575
+ const r = t.sanitizeUrl(location.href);
576
+ "hashchange" === n && r === e || i($("change", n, {
577
+ from: e,
578
+ to: r
579
+ }, performance.timeOrigin));
580
+ }
581
+ const l = history.pushState, f = history.replaceState, d = function(...t) {
582
+ const e = l.apply(this, t);
583
+ return p(() => c("push")), e;
584
+ }, y = function(...t) {
585
+ const e = f.apply(this, t);
586
+ return p(() => c("replace")), e;
587
+ };
588
+ return window.navigation ? u(window.navigation, "currententrychange", s) : (history.pushState = d, history.replaceState = y, u(window, "popstate", o), u(window, "hashchange", a)), "complete" === document.readyState ? r(new Event("load")) : u(window, "load", r), () => {
589
+ n?.dispose(), window.navigation ? h(window.navigation, "currententrychange", s) : (history.pushState === d && (history.pushState = l), history.replaceState === y && (history.replaceState = f), h(window, "popstate", o), h(window, "hashchange", a)), h(window, "load", r);
590
+ };
591
+ },
592
+ layer: "session"
593
+ },
594
+ networkconnection: {
595
+ create: B,
596
+ layer: "session"
597
+ },
598
+ scroll: {
599
+ create: B,
600
+ layer: "behavioral"
601
+ },
602
+ viewportresize: {
603
+ create: B,
604
+ layer: "behavioral"
605
+ },
606
+ viewport: {
607
+ create: B,
608
+ layer: "behavioral",
609
+ events: ["orientationchange", "devicepixelratiochange"]
610
+ },
611
+ sensors: {
612
+ create: B,
613
+ layer: "behavioral",
614
+ events: [
615
+ "motion",
616
+ "orientation",
617
+ "light"
618
+ ]
619
+ },
620
+ "network-request": {
621
+ create: function(t) {
622
+ var n;
623
+ const i = function(t, n, i, r = A) {
624
+ if ("undefined" == typeof PerformanceObserver) return M;
625
+ let s = null;
626
+ try {
627
+ s = new PerformanceObserver((e) => {
628
+ for (const s of e.getEntries()) {
629
+ const e = s;
630
+ r.has(e.initiatorType) && (n(e.name) || t(R(e, i)));
631
+ }
632
+ }), s.observe({
633
+ type: "resource",
634
+ buffered: !0
635
+ });
636
+ } catch {
637
+ return e.warn("network-request", "PerformanceObserver failed to start"), M;
638
+ }
639
+ return function() {
640
+ s?.disconnect(), s = null;
641
+ };
642
+ }(function(e) {
643
+ p(() => t.push(e));
644
+ }, (n = t.ignoredOrigins, function(t) {
645
+ try {
646
+ return n.has(new URL(t).origin);
647
+ } catch {
648
+ return !1;
649
+ }
650
+ }), t.sanitizeUrl);
651
+ return function() {
652
+ i();
653
+ };
654
+ },
655
+ layer: "session"
656
+ },
657
+ screen: {
658
+ create: B,
659
+ layer: "session"
660
+ },
661
+ wheel: {
662
+ create: B,
663
+ layer: "behavioral"
664
+ },
665
+ hover: {
666
+ create: B,
667
+ layer: "behavioral"
668
+ },
669
+ fpsignals: {
670
+ create: function(t, i = "off", s) {
671
+ const a = l(s, "device"), f = l(s, "pid"), d = l(s, "behaviour"), g = performance.now(), m = new c();
672
+ let b, k = !1, S = !1, T = null, E = null, A = null, C = null, R = null, M = !1, $ = !1, P = null;
673
+ const x = new Promise(function(t) {
674
+ b = t;
675
+ });
676
+ function z() {
677
+ const e = t.getTabId();
678
+ e && e !== P && m.setTabId(e) && (P = e);
679
+ }
680
+ function B(e, n) {
681
+ if (!S || !m.isReady()) return null;
682
+ z();
683
+ const i = t.peekNextSequence(), r = m.setNextSequence(i), s = [];
684
+ let o = !1;
685
+ try {
686
+ const s = n ? m.getSignalsWithReason(e, n) : m.getSignals(e);
687
+ return o = function(e, n, i) {
688
+ if (!e) return !1;
689
+ const r = {
690
+ name: "fp_signals",
691
+ timestamp: Date.now(),
692
+ signals: e
693
+ };
694
+ return n && (r.reason = n), void 0 !== i && (r.seq = i), t.push(r), !0;
695
+ }(s, n, r ? i : void 0), o ? s : null;
696
+ } finally {
697
+ !o && s.length > 0 && p(() => {});
698
+ }
699
+ }
700
+ function L(t) {
701
+ return !!d && null !== B(o.Behaviour, t);
702
+ }
703
+ function q(t) {
704
+ return p(() => B(t)) ?? null;
705
+ }
706
+ function D() {
707
+ null !== A && clearInterval(A), null !== C && clearTimeout(C), A = null, C = null;
708
+ }
709
+ function O(t = "partial") {
710
+ return !(!a || M || $ || !S || !m.isReady() || !m.hasMethod("gsr") || null === B(o.Device, t) || (M = !0, D(), 0));
711
+ }
712
+ function F() {
713
+ a && m.hasMethod("gsr") && (A = setInterval(w(function() {
714
+ O();
715
+ }), 250), C = setTimeout(w(D), 5e3));
716
+ }
717
+ function j() {
718
+ if (!S || !m.isReady()) return;
719
+ const t = m.getBufferFill();
720
+ null !== t && t >= .5 && L("fill");
721
+ }
722
+ function U() {}
723
+ function N() {
724
+ m.setUrlSanitizer(null);
725
+ }
726
+ I = x;
727
+ const H = v((e) => {
728
+ ("click" !== e.type || e.target instanceof Element && e.target.closest("[data-tri-flush]")) && (L("click" === e.type ? "flush-click" : "submit"), t.flush());
729
+ }), J = t.registerBehaviourReader ? t.registerBehaviourReader(function(t) {
730
+ const e = p(() => O("partial-now")) ?? !1, n = p(() => L(t)) ?? !1;
731
+ return e || n;
732
+ }) : null;
733
+ return y(async () => {
734
+ const s = await ("object" != typeof WebAssembly || null === WebAssembly ? Promise.resolve("no-webassembly") : new Promise(function(t) {
735
+ let i = !1;
736
+ R = function() {
737
+ i || (i = !0, clearTimeout(s), t("timeout"));
738
+ };
739
+ const s = setTimeout(w(function() {
740
+ i || (i = !0, t("timeout"));
741
+ }), 3e4);
742
+ function o(e) {
743
+ i ? null === e && p(() => m.freeResources()) : (i = !0, clearTimeout(s), t(e));
744
+ }
745
+ m.initialize("https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals9/fpSignals/fpSignalsLib.wasm", "https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals9/fpSignals/fpSignalsLibSimd.wasm").then(function() {
746
+ o(null);
747
+ }, function(t) {
748
+ e.warn("fpSignals", "module failed to load:", t), o(function(t) {
749
+ return t instanceof r ? t.reason : "instantiate-failed";
750
+ }(t));
751
+ });
752
+ }));
753
+ if (k || p(() => function(e) {
754
+ const n = null === e, i = {
755
+ name: "fp_signals_load",
756
+ timestamp: Date.now(),
757
+ loadMs: Math.max(0, performance.now() - g),
758
+ simd: n && m.usedSimd,
759
+ ok: n
760
+ };
761
+ null !== e && (i.reason = e), t.push(i);
762
+ }(s)), null !== s) return;
763
+ if (k) return void m.freeResources();
764
+ if (S = !0, p(() => m.setHostInfo(t.host.platform, t.host.version)), p(z), p(() => m.setUrlSanitizer(function(e) {
765
+ return t.sanitizeUrl(e);
766
+ })), p(() => {
767
+ return m.setCapturePolicy({
768
+ v: 2,
769
+ element: t.captureElementLevel,
770
+ content: i,
771
+ ignore: ["[data-tri-ignore]"],
772
+ redact: ["[data-tri-redact]"],
773
+ redactAttrsAttribute: "data-tri-redact-attrs",
774
+ interactive: ["[data-tri-interactive]"],
775
+ off: (e = t.collectorSelection) ? _(e) : []
776
+ });
777
+ var e;
778
+ }), p(U), d && (p(() => m.setBehaviourCollectionEnabled(!0)), T = setInterval(w(function() {
779
+ L("interval");
780
+ }), 2e3), m.hasMethod("gbf") && (E = setInterval(w(j), 1e3)), u(document, "submit", H), u(document, "click", H)), !a && !f) return;
781
+ if (p(F), await m.collect(), $ = !0, D(), k) return;
782
+ const c = a ? q(o.Device) : null, l = f ? q(o.PID) : null;
783
+ b({
784
+ pid: l,
785
+ device: c
786
+ });
787
+ }).then(function() {
788
+ b(null);
789
+ }), function() {
790
+ k = !0, R?.(), b(null), I === x && (I = null), null !== T && clearInterval(T), null !== E && clearInterval(E), D(), h(document, "submit", H), h(document, "click", H), J?.(), p(() => {}), p(() => {
791
+ L("stop");
792
+ }), p(() => {}), S && p(N), p(() => m.freeResources());
793
+ };
794
+ },
795
+ layer: "device-fingerprinting",
796
+ events: [
797
+ "device",
798
+ "pid",
799
+ "behaviour"
800
+ ]
801
+ }
802
+ };
803
+ const q = Object.keys(L);
804
+ const D = [
805
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
806
+ /^0b[01]+$/i,
807
+ /^0o[0-7]+$/i,
808
+ /^0x[0-9a-f]+$/i,
809
+ /^[a-z][a-z0-9]{1,12}:[A-Za-z0-9+/=_-]{6,}$/i,
810
+ /^[a-z]{2,8}_(?=.*\d)[A-Za-z0-9]{3,}$/,
811
+ /^\d{4,}$/,
812
+ /@/,
813
+ /^[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{10,}$/,
814
+ /^[A-Za-z0-9_-]{20,}={0,2}$/,
815
+ /^[0-9a-f]{7,}$/i
816
+ ];
817
+ function O(t) {
818
+ try {
819
+ const e = new URL(t, location.href);
820
+ e.username = "", e.password = "", e.hash = "";
821
+ const n = [...e.searchParams.keys()], i = n.length > 0 ? "?" + n.map((t) => `${encodeURIComponent(t)}=<redacted>`).join("&") : "";
822
+ e.search = "", e.pathname = e.pathname.split("/").map((t) => "" !== t && function(t) {
823
+ for (const e of D) if (e.test(t)) return !0;
824
+ return !1;
825
+ }(t) ? ":param" : t).join("/");
826
+ const r = e.origin + e.pathname + i;
827
+ return r.length > 2048 ? r.slice(0, 2048) : r;
828
+ } catch {
829
+ return "";
830
+ }
831
+ }
832
+ const F = "idle";
833
+ const j = "ready";
834
+ const U = "started";
835
+ const N = "collection-disabled";
836
+ const H = "init-failed";
837
+ const J = {
838
+ flush: {
839
+ intervalMs: 2e3,
840
+ maxIntervalMs: 3e4,
841
+ size: 50,
842
+ backoffFailureThreshold: 2
843
+ },
844
+ queue: { size: 100 }
845
+ };
846
+ const K = "redact";
847
+ function V() {
848
+ const t = {};
849
+ for (const e of q) t[e] = W(e, void 0, !0);
850
+ return t;
851
+ }
852
+ function Z(t) {
853
+ const e = {};
854
+ for (const n of q) e[n] = W(n, void 0, t[L[n].layer] ?? !1);
855
+ return e;
856
+ }
857
+ function G(t) {
858
+ for (const n of Object.keys(t)) -1 === q.indexOf(n) && e.fatal("warn", "SDK", `collectors has an unknown key '${n}' — ignored. Known collectors: ${q.join(", ")}.`);
859
+ const n = {};
860
+ for (const e of q) {
861
+ const i = t[e];
862
+ n[e] = W(e, i, i?.enabled ?? !1);
863
+ }
864
+ return n;
865
+ }
866
+ function W(t, e, n) {
867
+ const i = L[t]?.events ?? [];
868
+ if (0 === i.length) return { enabled: n };
869
+ const r = e?.events, s = {};
870
+ for (const t of i) s[t] = { enabled: r?.[t] ?? !0 };
871
+ return {
872
+ enabled: n,
873
+ events: s
874
+ };
875
+ }
876
+ function X(t) {
877
+ if (!t) return null;
878
+ const e = t.split(".")[1], n = atob(e.replace(/-/g, "+").replace(/_/g, "/"));
879
+ return JSON.parse(n);
880
+ }
881
+ const Q = function(t, e = 30) {
882
+ if (!t) return !0;
883
+ const n = X(t);
884
+ return !n || "number" != typeof n.exp || 1e3 * n.exp <= Date.now() + 1e3 * e;
885
+ };
886
+ async function Y(t, e) {
887
+ return globalThis.navigator && "locks" in globalThis.navigator && "request" in globalThis.navigator.locks && "query" in globalThis.navigator.locks ? navigator.locks.request(t, { mode: "exclusive" }, async () => y(e)) : y(e);
888
+ }
889
+ function tt(t) {
890
+ function e() {
891
+ return globalThis.window && globalThis.window[t] && void 0 !== globalThis.window[t];
892
+ }
893
+ return {
894
+ get: function(n) {
895
+ if (!e()) return null;
896
+ try {
897
+ const e = window[t].getItem(n) ?? "null";
898
+ return "null" === e ? null : JSON.parse(e);
899
+ } catch {
900
+ return null;
901
+ }
902
+ },
903
+ set: function(n, i) {
904
+ e() && p(() => window[t].setItem(n, JSON.stringify(i)));
905
+ },
906
+ remove: function(n) {
907
+ e() && p(() => window[t].removeItem(n));
908
+ },
909
+ key: function(n) {
910
+ return e() ? window[t].key(n) : null;
911
+ },
912
+ get length() {
913
+ return e() ? window[t].length : 0;
914
+ }
915
+ };
916
+ }
917
+ const et = tt("localStorage");
918
+ const nt = tt("sessionStorage");
919
+ const it = "__tri";
920
+ const rt = `${it}_activity_token`;
921
+ const st = `${it}_activity_id`;
922
+ const ot = `${it}_activity_status`;
923
+ const at = "__tri_activity_lock";
924
+ var ct = class {
925
+ constructor(t) {
926
+ this.context = t, this.l = null, this.u = null, this.h = null, this.p = null, this.m = null, this.k = !1;
927
+ }
928
+ getToken() {
929
+ return this.l;
930
+ }
931
+ getActivityId() {
932
+ return this.u ?? "";
933
+ }
934
+ isActive() {
935
+ return "ACTIVE" === this.h && null !== this.l;
936
+ }
937
+ async start() {
938
+ return this.k = !0, this.p || (this.p = this.S()), this.p;
939
+ }
940
+ async stop() {
941
+ const t = this.T();
942
+ this.m = t;
943
+ try {
944
+ await t;
945
+ } finally {
946
+ this.m === t && (this.m = null);
947
+ }
948
+ }
949
+ async T() {
950
+ this.k = !1, this.h = "INACTIVE", this._(null), this.p = null, this.l && await this.context.stopActivity(), this.I(null);
951
+ }
952
+ async refresh() {
953
+ if (!this.k) return;
954
+ const t = this.l;
955
+ await Y(at, async () => {
956
+ if (this.l && this.l !== t && !Q(this.l) && "ACTIVE" === this.h) return;
957
+ const e = this.A();
958
+ e && e.token !== t && !Q(e.token) && "ACTIVE" === e.activityStatus ? this.I(e) : (this.C(), await this.R());
959
+ });
960
+ }
961
+ async S() {
962
+ try {
963
+ if (this.m && await this.m, this.l && !Q(this.l)) return;
964
+ await Y(at, async () => {
965
+ await this.R();
966
+ });
967
+ } finally {
968
+ this.p = null;
969
+ }
970
+ }
971
+ async R() {
972
+ const t = this.A();
973
+ if (t && !Q(t.token) && "ACTIVE" === t.activityStatus) return void this.I(t);
974
+ t && this.C();
975
+ const e = await this.context.startActivity();
976
+ if (!e.ok) return;
977
+ if (!e.data.token) return;
978
+ const n = e.data;
979
+ this.I(n), this.M(n);
980
+ }
981
+ A() {
982
+ const [t, e, n] = [
983
+ et.get(rt),
984
+ et.get(st),
985
+ et.get(ot)
986
+ ];
987
+ return t && e && n ? {
988
+ token: t,
989
+ activityId: e,
990
+ activityStatus: n
991
+ } : ((t || e || n) && this.C(), null);
992
+ }
993
+ M(t) {
994
+ et.set(rt, t.token), et.set(st, t.activityId), et.set(ot, t.activityStatus);
995
+ }
996
+ C() {
997
+ this._(null), this.I(null);
998
+ }
999
+ _(t) {
1000
+ if (!t) return et.remove(rt), et.remove(st), void et.remove(ot);
1001
+ et.set(rt, t.token), et.set(st, t.activityId), et.set(ot, t.activityStatus);
1002
+ }
1003
+ I(t) {
1004
+ if (!t) return this.l = null, this.u = null, void (this.h = null);
1005
+ this.l = t.token, this.u = t.activityId, this.h = t.activityStatus;
1006
+ }
1007
+ };
1008
+ const lt = [
1009
+ 401,
1010
+ 403,
1011
+ 409
1012
+ ];
1013
+ const ut = Object.freeze({
1014
+ tab: 80,
1015
+ navigation: 80,
1016
+ page_complexity: 80,
1017
+ fp_signals: 80,
1018
+ fp_signals_load: 80,
1019
+ network_request: 60
1020
+ });
1021
+ function ht(t) {
1022
+ return ut[t.name];
1023
+ }
1024
+ const ft = Object.freeze({
1025
+ tri: "/events/capture",
1026
+ "fp-signals": "/events/capture/fp-signals"
1027
+ });
1028
+ const dt = /* @__PURE__ */ new Map([["fp_signals", "fp-signals"]]);
1029
+ function pt(t) {
1030
+ return dt.get(t.name) ?? "tri";
1031
+ }
1032
+ const yt = new Array(256);
1033
+ for (let t = 0; t < 256; t++) yt[t] = (t + 256).toString(16).slice(1);
1034
+ const vt = /* @__PURE__ */ new Uint8Array(16);
1035
+ function wt(t) {
1036
+ return yt[t[0]] + yt[t[1]] + yt[t[2]] + yt[t[3]] + "-" + yt[t[4]] + yt[t[5]] + "-" + yt[t[6]] + yt[t[7]] + "-" + yt[t[8]] + yt[t[9]] + "-" + yt[t[10]] + yt[t[11]] + yt[t[12]] + yt[t[13]] + yt[t[14]] + yt[t[15]];
1037
+ }
1038
+ function gt() {
1039
+ return crypto.randomUUID();
1040
+ }
1041
+ function mt() {
1042
+ return crypto.getRandomValues(vt), vt[6] = 15 & vt[6] | 64, vt[8] = 63 & vt[8] | 128, wt(vt);
1043
+ }
1044
+ function bt() {
1045
+ for (let t = 0; t < 16; t++) vt[t] = 256 * Math.random() | 0;
1046
+ return vt[6] = 15 & vt[6] | 64, vt[8] = 63 & vt[8] | 128, wt(vt);
1047
+ }
1048
+ const kt = function() {
1049
+ if ("undefined" != typeof crypto) {
1050
+ if ("function" == typeof crypto.randomUUID) return gt;
1051
+ if ("function" == typeof crypto.getRandomValues) return mt;
1052
+ }
1053
+ return bt;
1054
+ }();
1055
+ function St() {
1056
+ return kt();
1057
+ }
1058
+ var Tt = class {
1059
+ constructor(t, e) {
1060
+ this.$ = t, this.P = e, this.B = [], this.L = null, this.q = [], this.D = null, this.k = !1, this.O = !0, this.F = 0, this.j = 0, this.U = 0, this.N = function(t = 0) {
1061
+ let e = t;
1062
+ return {
1063
+ peek: function() {
1064
+ return e;
1065
+ },
1066
+ next: function() {
1067
+ return e++;
1068
+ },
1069
+ claim: function(t) {
1070
+ return !(!Number.isInteger(t) || t < e || (e = t + 1, 0));
1071
+ }
1072
+ };
1073
+ }(), this.H = null, this.J = !1, this.K = t.flush.intervalMs;
1074
+ }
1075
+ peekNextSequence() {
1076
+ return this.N.peek();
1077
+ }
1078
+ push(t) {
1079
+ this.k ? (this.V(t), this.H && this.Z(this.H, t) || (this.G(t), this.W())) : e.warn("Transport", "push() called before start() — event dropped");
1080
+ }
1081
+ setEventRouter(t) {
1082
+ this.H = t;
1083
+ }
1084
+ getEventRouter() {
1085
+ return this.H;
1086
+ }
1087
+ requeue(t) {
1088
+ if (0 !== t.length) if (this.k) {
1089
+ for (const e of t) this.G(e);
1090
+ this.W();
1091
+ } else e.warn("Transport", "requeue() called before start() — events dropped", t.length);
1092
+ }
1093
+ Z(t, n) {
1094
+ try {
1095
+ return !0 === t.route(n);
1096
+ } catch (t) {
1097
+ return e.warn("Transport", "event router threw — event queued:", t), !1;
1098
+ }
1099
+ }
1100
+ G(t) {
1101
+ this.B.length < this.X() ? this.B.push(t) : this.Y(t);
1102
+ }
1103
+ holdCapacityFlush(t) {
1104
+ const e = this.J;
1105
+ this.J = !0;
1106
+ try {
1107
+ t();
1108
+ } finally {
1109
+ this.J = e;
1110
+ }
1111
+ }
1112
+ W() {
1113
+ if (this.O) return this.B.length >= this.$.flush.size && !this.J ? (m(this.L), this.L = null, void this.flush("capacity")) : void this.tt();
1114
+ }
1115
+ flush(t) {
1116
+ if (this.k && this.P.isActivityActive()) try {
1117
+ if ("lifecycle" === t) return void this.et();
1118
+ if (0 === this.B.length) return;
1119
+ if ("submit" === t && !this.O) return;
1120
+ const n = "submit" === t;
1121
+ for (const i of this.nt(!1, n)) {
1122
+ const r = this.it(i, t, n ? this.rt() : void 0);
1123
+ r && (n ? this.st(r) : this.P.ingest(r, !1)).then((t) => this.ot(t, r)).catch(() => {
1124
+ e.warn("Transport", "ingest threw unexpectedly — batch dropped");
1125
+ });
1126
+ }
1127
+ this.B.length > 0 && this.tt();
1128
+ } catch (t) {
1129
+ e.warn("Transport", "flush() threw unexpectedly:", t);
1130
+ }
1131
+ }
1132
+ start() {
1133
+ this.k || (this.k = !0, this.O = "undefined" == typeof navigator || navigator.onLine);
1134
+ }
1135
+ stop() {
1136
+ if (!this.k) return Promise.resolve();
1137
+ m(this.L), this.L = null, m(this.D), this.D = null;
1138
+ const t = this.et();
1139
+ return this.k = !1, this.q = [], t;
1140
+ }
1141
+ onConnectionChange() {
1142
+ const t = "undefined" == typeof navigator || navigator.onLine;
1143
+ if (t !== this.O) {
1144
+ if (this.O = t, !this.O) return m(this.L), this.L = null, m(this.D), void (this.D = null);
1145
+ this.B.length > 0 && this.tt(), this.q.length > 0 && this.ct();
1146
+ }
1147
+ }
1148
+ tt() {
1149
+ this.k && this.O && null === this.L && (this.L = g(() => {
1150
+ this.L = null, this.flush("interval");
1151
+ }, this.K));
1152
+ }
1153
+ ct() {
1154
+ this.k && this.O && null === this.D && (this.D = g(() => {
1155
+ this.D = null, this.lt();
1156
+ }, this.K));
1157
+ }
1158
+ lt() {
1159
+ if (!this.k || !this.O || 0 === this.q.length || !this.P.isActivityActive()) return;
1160
+ const t = this.q.shift();
1161
+ this.P.ingest(t.batch, !1).then((e) => this.ut(e, t)).catch(() => {
1162
+ e.warn("Transport", "retry drain ingest threw unexpectedly — batch dropped"), this.q.length > 0 && this.ct();
1163
+ });
1164
+ }
1165
+ ht(t, n) {
1166
+ this.q.length >= 5 && (this.q.shift(), e.warn("Transport", "retry queue full — oldest batch evicted")), this.q.push({
1167
+ batch: t,
1168
+ attempts: n
1169
+ }), this.ct();
1170
+ }
1171
+ ot(t, e) {
1172
+ this.k && this.P.isActivityActive() && (t.ok ? this.ft() : this.dt(t) && this.ht(e, 1));
1173
+ }
1174
+ ut(t, n) {
1175
+ if (this.k && this.P.isActivityActive()) {
1176
+ if (t.ok) return this.ft(), void (this.q.length > 0 && this.ct());
1177
+ if (this.dt(t)) {
1178
+ if (n.attempts >= 3) return this.yt(), e.warn("Transport", "batch dropped after MAX_RETRY_ATTEMPTS", n.batch.batchId), void (this.q.length > 0 && this.ct());
1179
+ this.yt(), this.ht(n.batch, n.attempts + 1);
1180
+ } else this.q.length > 0 && this.ct();
1181
+ }
1182
+ }
1183
+ yt() {
1184
+ this.F++, this.F % this.$.flush.backoffFailureThreshold === 0 && (this.K = Math.min(2 * this.K, this.$.flush.maxIntervalMs));
1185
+ }
1186
+ ft() {
1187
+ this.F = 0, this.K = this.$.flush.intervalMs;
1188
+ }
1189
+ X() {
1190
+ return this.$.queue.size * (this.O ? 1 : 2);
1191
+ }
1192
+ async et() {
1193
+ if (!this.P.isActivityActive()) return Promise.resolve();
1194
+ if (this.H) {
1195
+ let t = [];
1196
+ try {
1197
+ t = this.H.release();
1198
+ } catch (t) {
1199
+ e.warn("Transport", "event router release threw:", t);
1200
+ }
1201
+ for (const e of t) this.G(e);
1202
+ }
1203
+ if (!this.O) return;
1204
+ const t = [];
1205
+ let n = this.rt();
1206
+ for (const i of this.nt(!0, !0)) {
1207
+ const r = this.it(i, "lifecycle", n);
1208
+ r && (n -= _t(r.events), t.push(this.st(r).then((t) => this.ot(t, r)).catch(() => {
1209
+ e.warn("Transport", "lifecycle ingest threw — batch dropped");
1210
+ })));
1211
+ }
1212
+ const i = [];
1213
+ for (const r of this.q) {
1214
+ const s = _t(r.batch.events);
1215
+ s > n ? i.push(r) : (n -= s, t.push(this.st(r.batch).then((t) => this.ut(t, r)).catch(() => {
1216
+ e.warn("Transport", "lifecycle retry ingest threw — batch dropped");
1217
+ })));
1218
+ }
1219
+ return this.q = i, Promise.allSettled(t).then(() => {});
1220
+ }
1221
+ rt() {
1222
+ return Math.max(0, 49152 - this.U);
1223
+ }
1224
+ st(t) {
1225
+ const e = _t(t.events);
1226
+ return this.U += e, this.P.ingest(t, !0).finally(() => {
1227
+ this.U -= e;
1228
+ });
1229
+ }
1230
+ V(t) {
1231
+ void 0 !== t.seq && this.N.claim(t.seq) || (void 0 !== t.seq && e.warn("Transport", "event carried a seq that was already used — restamped", t.seq), t.seq = this.N.next());
1232
+ }
1233
+ Y(t) {
1234
+ const e = ht(t);
1235
+ for (let n = 0; n < this.B.length; n++) if (ht(this.B[n]) < e) {
1236
+ for (let t = n; t < this.B.length - 1; t++) this.B[t] = this.B[t + 1];
1237
+ this.B.length -= 1, this.B.push(t);
1238
+ return;
1239
+ }
1240
+ }
1241
+ it(t, e, n) {
1242
+ const i = "lifecycle" === e, r = this.vt(t, i, i ? 200 : this.$.flush.size, n);
1243
+ return 0 === r.length ? null : {
1244
+ activityId: "",
1245
+ batchId: St(),
1246
+ batchSequence: this.j++,
1247
+ clientTimestamp: Date.now(),
1248
+ schemaVersion: "0.1.0",
1249
+ sdkVersion: "0.5.1",
1250
+ sdkPlatform: "web",
1251
+ tabId: this.P.getTabId(),
1252
+ events: r
1253
+ };
1254
+ }
1255
+ vt(t, e, n, i) {
1256
+ const r = /* @__PURE__ */ new Set();
1257
+ let s = 0;
1258
+ for (let o = 0; o < this.B.length && r.size < n; o++) {
1259
+ const n = e ? this.B.length - 1 - o : o, a = this.B[n];
1260
+ if (pt(a) === t) {
1261
+ if (void 0 !== i) {
1262
+ const t = It(a);
1263
+ if (s + t > i) continue;
1264
+ s += t;
1265
+ }
1266
+ r.add(n);
1267
+ }
1268
+ }
1269
+ if (0 === r.size) return [];
1270
+ const o = [], a = [];
1271
+ for (let t = 0; t < this.B.length; t++) r.has(t) ? o.push(this.B[t]) : a.push(this.B[t]);
1272
+ return this.B = a, o;
1273
+ }
1274
+ nt(t, e = !1) {
1275
+ const n = [];
1276
+ for (let e = 0; e < this.B.length; e++) {
1277
+ const i = pt(this.B[t ? this.B.length - 1 - e : e]);
1278
+ n.includes(i) || n.push(i);
1279
+ }
1280
+ if (e) {
1281
+ const t = n.indexOf("fp-signals");
1282
+ t > 0 && (n.splice(t, 1), n.unshift("fp-signals"));
1283
+ }
1284
+ return n;
1285
+ }
1286
+ dt(t) {
1287
+ if (t.ok) return !1;
1288
+ switch (t.kind) {
1289
+ case "timeout":
1290
+ case "server":
1291
+ case "rate_limited":
1292
+ case "network": return !0;
1293
+ default: return !1;
1294
+ }
1295
+ }
1296
+ };
1297
+ function _t(t) {
1298
+ let e = 0;
1299
+ for (let n = 0; n < t.length; n++) e += It(t[n]);
1300
+ return e;
1301
+ }
1302
+ function It(t) {
1303
+ try {
1304
+ return JSON.stringify(t).length + 1;
1305
+ } catch {
1306
+ return 0;
1307
+ }
1308
+ }
1309
+ const Et = "tri:bcast:";
1310
+ const At = "function" == typeof BroadcastChannel ? BroadcastChannel : function() {
1311
+ if ("undefined" == typeof Storage || "undefined" == typeof window) return !1;
1312
+ try {
1313
+ const t = "__tri_bcast_probe__";
1314
+ localStorage.setItem(t, "1");
1315
+ const e = "1" === localStorage.getItem(t);
1316
+ return localStorage.removeItem(t), e;
1317
+ } catch {
1318
+ return !1;
1319
+ }
1320
+ }() ? class {
1321
+ constructor(t) {
1322
+ this.seq = 0, this.closed = !1, this.listeners = /* @__PURE__ */ new Set(), this.onStorageEvent = (t) => {
1323
+ if (this.closed) return;
1324
+ if (!t.key || !t.key.startsWith(`${Et}${this.channelName}:`)) return;
1325
+ if (null === t.newValue) return;
1326
+ let e;
1327
+ p(() => et.remove(t.key));
1328
+ try {
1329
+ e = JSON.parse(t.newValue);
1330
+ } catch {
1331
+ return;
1332
+ }
1333
+ const n = { data: e };
1334
+ for (const t of this.listeners) p(() => t(n));
1335
+ }, this.channelName = t, this.senderId = St(), window.addEventListener("storage", this.onStorageEvent);
1336
+ }
1337
+ postMessage(t) {
1338
+ if (this.closed) return;
1339
+ const e = `${Et}${this.channelName}:${this.senderId}:${this.seq++}`;
1340
+ p(() => {
1341
+ et.set(e, t), et.remove(e);
1342
+ });
1343
+ }
1344
+ addEventListener(t, e) {
1345
+ this.listeners.add(e);
1346
+ }
1347
+ removeEventListener(t, e) {
1348
+ this.listeners.delete(e);
1349
+ }
1350
+ close() {
1351
+ this.closed || (this.closed = !0, window.removeEventListener("storage", this.onStorageEvent), this.listeners.clear());
1352
+ }
1353
+ } : class {
1354
+ constructor(t) {
1355
+ e.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.");
1356
+ }
1357
+ postMessage(t) {}
1358
+ addEventListener(t, e) {}
1359
+ removeEventListener(t, e) {}
1360
+ close() {}
1361
+ };
1362
+ const Ct = "__tri_tabId";
1363
+ var Rt = class {
1364
+ constructor(t) {
1365
+ this.context = t, this.wt = "", this.k = !1, this.gt = null, this.bt = null, this.kt = null, this.St = /* @__PURE__ */ new Map(), this.Tt = -1, this._t = null;
1366
+ }
1367
+ async start() {
1368
+ this.k || (this.k = !0, this.wt = this.It(), this.Et(), this.At({
1369
+ type: "hello",
1370
+ tabId: this.wt,
1371
+ ts: Date.now()
1372
+ }), this.Ct(), this.Rt("active"), this.Mt());
1373
+ }
1374
+ stop() {
1375
+ this.k && (this.k = !1, this.Rt("inactive"), this.At({
1376
+ type: "bye",
1377
+ tabId: this.wt,
1378
+ ts: Date.now()
1379
+ }), this.$t(this.Pt()), this.xt(), this.zt(), this.Bt());
1380
+ }
1381
+ getTabId() {
1382
+ return this.wt;
1383
+ }
1384
+ queryTabsNumber() {
1385
+ return this.St.size + 1;
1386
+ }
1387
+ Et() {
1388
+ try {
1389
+ this.gt = new At("__tri_tab_channel"), this._t = this.Lt.bind(this), this.gt.addEventListener("message", this._t);
1390
+ } catch (t) {
1391
+ e.warn("TabManager", "failed to open broadcast channel:", t);
1392
+ }
1393
+ }
1394
+ Bt() {
1395
+ try {
1396
+ if (!this.gt) return;
1397
+ this._t && this.gt.removeEventListener("message", this._t), this.gt.close();
1398
+ } catch {} finally {
1399
+ this.gt = null, this._t = null;
1400
+ }
1401
+ }
1402
+ Ct() {
1403
+ this.bt = setInterval(() => {
1404
+ const t = Date.now();
1405
+ this.At({
1406
+ type: "heartbeat",
1407
+ tabId: this.wt,
1408
+ ts: t
1409
+ });
1410
+ }, 1e3);
1411
+ }
1412
+ xt() {
1413
+ null != this.bt && (clearInterval(this.bt), this.bt = null);
1414
+ }
1415
+ Mt() {
1416
+ null != this.kt && clearTimeout(this.kt), this.kt = setTimeout(() => {
1417
+ this.kt = null;
1418
+ const t = this.Pt() + 1;
1419
+ t !== this.Tt && (this.Tt = t, this.$t(t));
1420
+ }, 1e3);
1421
+ }
1422
+ zt() {
1423
+ null != this.kt && (clearTimeout(this.kt), this.kt = null);
1424
+ }
1425
+ At(t) {
1426
+ try {
1427
+ if (!this.gt) return;
1428
+ this.gt.postMessage(t);
1429
+ } catch {
1430
+ e.warn("TabManager", "failed to broadcast message:", t);
1431
+ }
1432
+ }
1433
+ Lt(t) {
1434
+ const { type: e, tabId: n } = t.data;
1435
+ if (n === this.wt) return;
1436
+ const i = Date.now();
1437
+ "hello" === e ? (this.At({
1438
+ type: "ack",
1439
+ tabId: this.wt,
1440
+ ts: i,
1441
+ to: n
1442
+ }), this.St.set(n, i)) : "heartbeat" === e || "ack" === e ? this.St.set(n, i) : "bye" === e && this.St.delete(n);
1443
+ }
1444
+ $t(t) {
1445
+ this.context.events.count && this.context.push({
1446
+ name: "tab",
1447
+ type: "count",
1448
+ tabId: this.wt,
1449
+ timestamp: Date.now(),
1450
+ ts: performance.now(),
1451
+ value: t
1452
+ });
1453
+ }
1454
+ Rt(t) {
1455
+ this.context.events.state && this.context.push({
1456
+ name: "tab",
1457
+ type: "state",
1458
+ tabId: this.wt,
1459
+ timestamp: Date.now(),
1460
+ ts: performance.now(),
1461
+ value: t
1462
+ });
1463
+ }
1464
+ It() {
1465
+ const t = nt.get(Ct);
1466
+ if (t) return t;
1467
+ const e = St();
1468
+ return nt.set(Ct, e), e;
1469
+ }
1470
+ Pt(t = Date.now()) {
1471
+ let e = 0;
1472
+ for (const [n, i] of this.St.entries()) t - i >= 3e3 ? this.St.delete(n) : e++;
1473
+ return e;
1474
+ }
1475
+ };
1476
+ const Mt = globalThis.CompressionStream;
1477
+ const $t = globalThis.Response;
1478
+ const Pt = globalThis.Blob;
1479
+ const xt = new TextEncoder();
1480
+ let zt = null;
1481
+ async function Bt(t) {
1482
+ const n = await async function(t) {
1483
+ if ("function" != typeof Mt) return null;
1484
+ try {
1485
+ const e = xt.encode(t), n = new Pt([e]).stream().pipeThrough(new Mt("gzip"));
1486
+ return await new $t(n).arrayBuffer();
1487
+ } catch (t) {
1488
+ return e.warn("compression", "Native gzip failed:", t), null;
1489
+ }
1490
+ }(t);
1491
+ return null !== n ? n : async function(t) {
1492
+ try {
1493
+ const n = await function() {
1494
+ if (null === zt) {
1495
+ const t = function(t, n = 1e4) {
1496
+ let i = null;
1497
+ const r = new Promise((t) => {
1498
+ i = g(() => {
1499
+ e.warn("import", `Import timed out after ${n}ms`), t(null);
1500
+ }, n);
1501
+ }), s = Promise.resolve().then(t).catch((t) => (e.warn("import", "Import failed:", t), null));
1502
+ return Promise.race([s, r]).finally(() => {
1503
+ m(i);
1504
+ });
1505
+ }(() => import("./browser-pQZA35G2-DJEJnmCd.esm.js"), 1e4);
1506
+ zt = t, t.then((e) => {
1507
+ null === e && g(() => {
1508
+ zt === t && (zt = null);
1509
+ }, 1e4);
1510
+ });
1511
+ }
1512
+ return zt;
1513
+ }();
1514
+ if (null === n) return null;
1515
+ const { gzipSync: i } = n, r = i(xt.encode(t));
1516
+ return r.buffer.slice(r.byteOffset, r.byteOffset + r.byteLength);
1517
+ } catch (t) {
1518
+ return e.warn("compression", "fflate gzip failed:", t), null;
1519
+ }
1520
+ }(t);
1521
+ }
1522
+ function Lt(t, e) {
1523
+ const n = [JSON.stringify(t)];
1524
+ for (let t = 0; t < e.length; t++) try {
1525
+ n.push(JSON.stringify(e[t]));
1526
+ } catch {}
1527
+ return n.join("\n");
1528
+ }
1529
+ function qt(t) {
1530
+ const e = { Accept: "application/json" };
1531
+ return t?.hasBody && ("json" === t.contentType ? e["Content-Type"] = "application/json" : "ndjson" === t.contentType && (e["Content-Type"] = "application/x-ndjson"), "gzip" === t.contentEncoding && (e["Content-Encoding"] = "gzip")), t?.token && (e.Authorization = `Bearer ${t.token}`), t?.profileId && (e["x-profile-id"] = t.profileId), t?.api?.version && (e["x-api-version"] = t.api.version), t?.customHeaders && Object.entries(t.customHeaders).forEach(([t, n]) => {
1532
+ e[t] = n;
1533
+ }), e;
1534
+ }
1535
+ const Dt = "function" == typeof globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0;
1536
+ function Ot(t) {
1537
+ "undefined" != typeof document && "function" == typeof globalThis.fetch || e.warn("FalconService", "createFalconServiceManager called in a non-browser environment — all requests will resolve with { ok: false, kind: 'network' }.");
1538
+ const n = function(t) {
1539
+ const e = t?.timeout, n = t?.baseUrl ?? "", i = t?.api;
1540
+ async function r(t, r, s) {
1541
+ if (void 0 === Dt) return {
1542
+ ok: !1,
1543
+ kind: "network"
1544
+ };
1545
+ const o = n ? `${n}${r}` : r, a = new AbortController();
1546
+ let c = null, l = !1;
1547
+ c = g(() => {
1548
+ l = !0, a.abort();
1549
+ }, e);
1550
+ const u = s?.signal;
1551
+ let h, f = () => {};
1552
+ if (u) if (u.aborted) a.abort();
1553
+ else {
1554
+ const t = () => a.abort();
1555
+ u.addEventListener("abort", t, { once: !0 }), f = () => u.removeEventListener("abort", t);
1556
+ }
1557
+ if (null != s && "body" in s && null != s.body) {
1558
+ const t = function(t) {
1559
+ if (null == t) return {
1560
+ ok: !0,
1561
+ body: void 0
1562
+ };
1563
+ if ("string" == typeof t || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || t instanceof Blob || t instanceof FormData || t instanceof URLSearchParams || t instanceof ReadableStream) return {
1564
+ ok: !0,
1565
+ body: t
1566
+ };
1567
+ try {
1568
+ return {
1569
+ ok: !0,
1570
+ body: JSON.stringify(t)
1571
+ };
1572
+ } catch {
1573
+ return { ok: !1 };
1574
+ }
1575
+ }(s.body);
1576
+ if (!t.ok) return m(c), f(), {
1577
+ ok: !1,
1578
+ kind: "serialize"
1579
+ };
1580
+ h = t.body;
1581
+ }
1582
+ try {
1583
+ const e = await Dt(o, {
1584
+ method: t,
1585
+ headers: qt({
1586
+ token: s?.token,
1587
+ profileId: s?.profileId,
1588
+ contentType: s?.contentType,
1589
+ contentEncoding: s?.contentEncoding,
1590
+ api: i,
1591
+ hasBody: void 0 !== h,
1592
+ customHeaders: s?.customHeaders
1593
+ }),
1594
+ body: h,
1595
+ signal: a.signal,
1596
+ keepalive: s?.keepalive
1597
+ });
1598
+ if (!e.ok) return 429 === (d = e.status) ? {
1599
+ ok: !1,
1600
+ kind: "rate_limited",
1601
+ status: d
1602
+ } : d >= 400 && d < 500 ? {
1603
+ ok: !1,
1604
+ kind: "client",
1605
+ status: d
1606
+ } : {
1607
+ ok: !1,
1608
+ kind: "server",
1609
+ status: d
1610
+ };
1611
+ if (204 === e.status) return {
1612
+ ok: !0,
1613
+ data: void 0,
1614
+ status: 204
1615
+ };
1616
+ try {
1617
+ return {
1618
+ ok: !0,
1619
+ data: await e.json(),
1620
+ status: e.status
1621
+ };
1622
+ } catch {
1623
+ return a.signal.aborted ? l ? {
1624
+ ok: !1,
1625
+ kind: "timeout"
1626
+ } : {
1627
+ ok: !1,
1628
+ kind: "abort"
1629
+ } : {
1630
+ ok: !1,
1631
+ kind: "parse",
1632
+ status: e.status
1633
+ };
1634
+ }
1635
+ } catch {
1636
+ return l ? {
1637
+ ok: !1,
1638
+ kind: "timeout"
1639
+ } : a.signal.aborted ? {
1640
+ ok: !1,
1641
+ kind: "abort"
1642
+ } : {
1643
+ ok: !1,
1644
+ kind: "network"
1645
+ };
1646
+ } finally {
1647
+ m(c), f();
1648
+ }
1649
+ var d;
1650
+ }
1651
+ return {
1652
+ post: async function(t, e) {
1653
+ return r("POST", t, e);
1654
+ },
1655
+ get: async function(t, e) {
1656
+ return r("GET", t, e);
1657
+ }
1658
+ };
1659
+ }({
1660
+ baseUrl: `${t.api.url}/api/v1`,
1661
+ timeout: 1e4,
1662
+ api: { version: t.api.version }
1663
+ }), i = function(t) {
1664
+ const { getToken: n, refresh: i } = t;
1665
+ let r = null;
1666
+ return { withAuth: async function(t, s) {
1667
+ if (r) {
1668
+ const e = await r;
1669
+ if (e) return t(e);
1670
+ }
1671
+ const o = n() ?? "", a = await t(o);
1672
+ if ((c = a).ok || !("rejected" === c.kind || "client" === c.kind && lt.includes(c.status)) || !1 === s?.refreshable) return a;
1673
+ var c;
1674
+ const l = await (r || (r = async function() {
1675
+ try {
1676
+ return await i(), n();
1677
+ } catch (t) {
1678
+ return e.warn("AuthMiddleware", "auth refresh failed", t), null;
1679
+ }
1680
+ }().finally(() => {
1681
+ r = null;
1682
+ }), r));
1683
+ return l && l !== o ? t(l) : a;
1684
+ } };
1685
+ }(t), r = () => ({ profileId: t.getProfileId() ?? void 0 });
1686
+ return { api: {
1687
+ ingest: async function(e, s) {
1688
+ return i.withAuth(async (i) => {
1689
+ const { events: o, ...a } = e, c = {
1690
+ ...a,
1691
+ activityId: t.getActivityId()
1692
+ };
1693
+ let l, u = !1;
1694
+ try {
1695
+ if (s) l = Lt(c, o);
1696
+ else {
1697
+ const t = await async function(t, e) {
1698
+ const n = Lt(t, e), i = await Bt(n);
1699
+ return i ? {
1700
+ type: "gzip",
1701
+ body: i
1702
+ } : {
1703
+ type: "ndjson",
1704
+ body: n
1705
+ };
1706
+ }(c, o);
1707
+ l = t.body, u = "gzip" === t.type;
1708
+ }
1709
+ } catch {
1710
+ return {
1711
+ ok: !1,
1712
+ kind: "serialize"
1713
+ };
1714
+ }
1715
+ const h = await n.post(function(t) {
1716
+ return t.length > 0 ? ft[pt(t[0])] : ft.tri;
1717
+ }(o), {
1718
+ body: l,
1719
+ token: i,
1720
+ keepalive: s,
1721
+ contentType: "ndjson",
1722
+ contentEncoding: u ? "gzip" : void 0,
1723
+ ...r()
1724
+ });
1725
+ return function(t) {
1726
+ return t.ok && !0 === t.data?.malformedBatch;
1727
+ }(h) ? {
1728
+ ok: !1,
1729
+ kind: "rejected",
1730
+ status: h.status
1731
+ } : h;
1732
+ }, { refreshable: !s });
1733
+ },
1734
+ reportEvent: async function(t) {
1735
+ return i.withAuth((e) => n.post("/events/report-event", {
1736
+ body: t,
1737
+ token: e,
1738
+ contentType: "json",
1739
+ ...r()
1740
+ }));
1741
+ },
1742
+ startActivity: async function() {
1743
+ return n.post("/events/start-activity", {
1744
+ token: t.getSdkToken(),
1745
+ ...r()
1746
+ });
1747
+ },
1748
+ stopActivity: async function() {
1749
+ return i.withAuth((t) => n.post("/events/end-activity", {
1750
+ token: t,
1751
+ keepalive: !0,
1752
+ ...r()
1753
+ }), { refreshable: !1 });
1754
+ },
1755
+ collectionStatus: async function() {
1756
+ return n.get("/sdk/collection-status", {
1757
+ token: t.getSdkToken(),
1758
+ ...r()
1759
+ });
1760
+ },
1761
+ linkInterview: async function(e) {
1762
+ const s = t.getToken();
1763
+ return s && !Q(s) || await t.refresh(), i.withAuth((t) => n.post("/events/link-interview", {
1764
+ token: t,
1765
+ contentType: "json",
1766
+ ...r(),
1767
+ customHeaders: { "X-Incode-Hardware-Id": e }
1768
+ }), { refreshable: !1 });
1769
+ }
1770
+ } };
1771
+ }
1772
+ var Ft = class {
1773
+ constructor(t) {
1774
+ this.context = t;
1775
+ }
1776
+ stop() {}
1777
+ async report(t, n) {
1778
+ const i = {
1779
+ name: t,
1780
+ metadata: n,
1781
+ timestamp: Date.now(),
1782
+ activityId: this.context.getActivityId() ?? ""
1783
+ };
1784
+ try {
1785
+ const r = await this.context.reportEvent(i);
1786
+ if (r.ok) return r;
1787
+ e.warn("EventReport", "Failed to report event:", t, n, "with result:", r);
1788
+ } catch (i) {
1789
+ e.warn("EventReport", "Failed to report event:", t, n, "with error:", i);
1790
+ }
1791
+ }
1792
+ };
1793
+ async function jt(t, n) {
1794
+ const { collectors: i, sdk: r } = t;
1795
+ let s = null, o = null, a = null, c = null;
1796
+ try {
1797
+ s = Ot({
1798
+ api: {
1799
+ version: r.api.version,
1800
+ url: r.api.url
1801
+ },
1802
+ getSdkToken: () => r.token,
1803
+ getProfileId: () => n.getProfileId(),
1804
+ getToken: () => o?.getToken() ?? null,
1805
+ refresh: async () => o?.refresh() ?? Promise.resolve(),
1806
+ getActivityId: () => o?.getActivityId() ?? ""
1807
+ });
1808
+ const t = await s.api.collectionStatus();
1809
+ if (!t.ok || !0 !== t.data.eventsCollectionEnabled) return { status: "collection-disabled" };
1810
+ o = new ct({
1811
+ startActivity: () => s.api.startActivity(),
1812
+ stopActivity: () => s.api.stopActivity()
1813
+ }), a = new Tt(J, {
1814
+ ingest: (t, e) => s.api.ingest(t, e),
1815
+ getTabId: () => c?.getTabId() ?? "unknown",
1816
+ isActivityActive: () => o?.isActive() ?? !1
1817
+ });
1818
+ const l = i.tab;
1819
+ c = new Rt({
1820
+ push: (t) => a?.push(t),
1821
+ events: {
1822
+ state: l.enabled && l.events.state.enabled,
1823
+ count: l.enabled && l.events.count.enabled
1824
+ }
1825
+ });
1826
+ const f = /* @__PURE__ */ new Set();
1827
+ try {
1828
+ f.add(new URL(r.api.url).origin);
1829
+ } catch {}
1830
+ const d = function(t, e, n = "off") {
1831
+ const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), s = {
1832
+ ...t,
1833
+ registerBehaviourReader: function(t) {
1834
+ return r.add(t), function() {
1835
+ r.delete(t);
1836
+ };
1837
+ },
1838
+ collectorSelection: e
1839
+ };
1840
+ function o(t) {
1841
+ if (i.has(t)) return;
1842
+ const r = L[t];
1843
+ if (!r || !function(t, e) {
1844
+ return e[t]?.enabled ?? !1;
1845
+ }(t, e)) return;
1846
+ const o = e[t], a = r.create(s, n, o && "events" in o ? o.events : void 0);
1847
+ i.set(t, a);
1848
+ }
1849
+ return {
1850
+ start: o,
1851
+ stopCollector: function(t) {
1852
+ const e = i.get(t);
1853
+ e && (e(), i.delete(t));
1854
+ },
1855
+ stop: function() {
1856
+ for (const [, t] of i) t();
1857
+ i.clear();
1858
+ },
1859
+ isRunning: function(t) {
1860
+ return i.has(t);
1861
+ },
1862
+ autocapture: function() {
1863
+ for (const t of q) o(t);
1864
+ },
1865
+ readBehaviour: function(t) {
1866
+ let e = !1;
1867
+ for (const n of r) p(() => n(t)) && (e = !0);
1868
+ return e;
1869
+ }
1870
+ };
1871
+ }({
1872
+ push: (t) => a?.push(t),
1873
+ flush: () => a?.flush("submit"),
1874
+ sanitizeUrl: r.sanitizeUrl,
1875
+ ignoredOrigins: f,
1876
+ host: r.host,
1877
+ getTabId: () => c?.getTabId() ?? "",
1878
+ captureElementLevel: r.capture?.element ?? K,
1879
+ peekNextSequence: () => a?.peekNextSequence() ?? 0,
1880
+ registerEventRouter: (t) => (a?.setEventRouter(t), function() {
1881
+ a?.getEventRouter() === t && a.setEventRouter(null);
1882
+ }),
1883
+ requeueEvents: (t) => a?.requeue(t)
1884
+ }, i, r.capture?.content), y = function(t) {
1885
+ let e = !1;
1886
+ function n(e) {
1887
+ p(() => t.isActivityActive()) && (p(() => t.holdCapacityFlush(function() {
1888
+ p(() => t.readBehaviour(e)), "pagehide" === e && p(() => t.stopTab());
1889
+ })), p(() => t.flush()), "pagehide" === e && (t.getShouldSkipStopActivity() || t.stopActivity()));
1890
+ }
1891
+ const i = v((t) => {
1892
+ "hidden" === document.visibilityState && n("hidden");
1893
+ }), r = v((t) => {
1894
+ n("pagehide");
1895
+ }), s = v((t) => {
1896
+ n("beforeunload");
1897
+ }), o = v((e) => {
1898
+ e.persisted && t.resume();
1899
+ }), a = v(() => t.onConnectionChange());
1900
+ return {
1901
+ start: function() {
1902
+ u(document, "visibilitychange", i), u(window, "pagehide", r), function() {
1903
+ if ("undefined" == typeof navigator) return !1;
1904
+ const t = navigator.userAgentData;
1905
+ return t && "boolean" == typeof t.mobile ? !t.mobile : !/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent ?? "");
1906
+ }() && !/Firefox\//.test(navigator.userAgent ?? "") && (u(window, "beforeunload", s), e = !0), u(window, "pageshow", o), u(window, "online", a), u(window, "offline", a);
1907
+ },
1908
+ stop: function() {
1909
+ h(document, "visibilitychange", i), h(window, "pagehide", r), e && (h(window, "beforeunload", s), e = !1), h(window, "pageshow", o), h(window, "online", a), h(window, "offline", a);
1910
+ },
1911
+ onHide: n
1912
+ };
1913
+ }({
1914
+ readBehaviour: (t) => d.readBehaviour(t),
1915
+ isActivityActive: () => o?.isActive() ?? !1,
1916
+ holdCapacityFlush: (t) => {
1917
+ a ? a.holdCapacityFlush(t) : t();
1918
+ },
1919
+ flush: () => a?.flush("lifecycle"),
1920
+ stopActivity: async () => o?.stop(),
1921
+ stopTab: () => c?.stop(),
1922
+ getShouldSkipStopActivity: () => (c?.queryTabsNumber() ?? 0) > 1,
1923
+ onConnectionChange: () => a?.onConnectionChange(),
1924
+ resume: async () => {
1925
+ try {
1926
+ await o?.start(), await c?.start();
1927
+ } catch (t) {
1928
+ e.warn("IncodeTRI", "resume after bfcache restore failed:", t);
1929
+ }
1930
+ }
1931
+ }), w = new Ft({
1932
+ getActivityId: () => o?.getActivityId() ?? "",
1933
+ reportEvent: (t) => s.api.reportEvent(t)
1934
+ });
1935
+ return {
1936
+ status: "ready",
1937
+ managers: {
1938
+ falconServiceManager: s,
1939
+ activityManager: o,
1940
+ transportManager: a,
1941
+ tabManager: c,
1942
+ lifecycleManager: y,
1943
+ collectorManager: d,
1944
+ eventReportManager: w
1945
+ }
1946
+ };
1947
+ } catch (t) {
1948
+ return e.warn("IncodeTRI", "setup() failed during construction:", t), { status: "init-failed" };
1949
+ }
1950
+ }
1951
+ let Ut = class t {
1952
+ constructor() {
1953
+ this.qt = 0, this.Dt = null, this.Ot = F;
1954
+ }
1955
+ static get instance() {
1956
+ return t.i || (t.i = new t()), t.i;
1957
+ }
1958
+ async setup(t) {
1959
+ if (this.Ot !== F) return e.fatal("error", "setup()", `cannot set up from state '${this.Ot}' — call reset() (or reload) first. Ignoring.`), H;
1960
+ try {
1961
+ const n = function(t) {
1962
+ if ("undefined" == typeof document) return e.fatal("error", "IncodeTRI", "TRI is not available in a non-browser environment."), null;
1963
+ if (!t?.token) return e.fatal("error", "SDK", "token is required."), null;
1964
+ if (!t.apiURL) return e.fatal("error", "SDK", "Couldn't initialise SDK — apiURL isn't provided."), null;
1965
+ const { element: n, content: i } = t.capture ?? {}, r = {
1966
+ token: t.token,
1967
+ capture: {
1968
+ element: n ?? K,
1969
+ content: i ?? "off"
1970
+ },
1971
+ api: {
1972
+ version: t.apiVersion ?? "1.0",
1973
+ url: t.apiURL
1974
+ },
1975
+ sanitizeUrl: (o = t.sanitizeUrl, o ? function(t) {
1976
+ return p(() => o(t, O)) ?? O(t);
1977
+ } : O),
1978
+ host: (s = t.host, "string" == typeof s?.platform && "" !== s.platform && "string" == typeof s.version && "" !== s.version ? {
1979
+ platform: s.platform,
1980
+ version: s.version
1981
+ } : (void 0 !== s && e.warn("SDK", "host needs a non-empty platform and version — reporting TRI itself."), {
1982
+ platform: "tri-web",
1983
+ version: "0.5.1"
1984
+ })),
1985
+ DEBUG: t.DEBUG ?? !1
1986
+ };
1987
+ var s, o;
1988
+ return void 0 === t.collectors && void 0 === t.layers ? {
1989
+ sdk: r,
1990
+ collectors: V()
1991
+ } : void 0 !== t.collectors ? {
1992
+ sdk: r,
1993
+ collectors: G(t.collectors)
1994
+ } : {
1995
+ sdk: r,
1996
+ collectors: Z(t.layers)
1997
+ };
1998
+ }(t);
1999
+ if (!n) return this.Ot = H, H;
2000
+ e.DEBUG = n.sdk.DEBUG;
2001
+ const i = await jt(n, { getProfileId: () => null });
2002
+ return "collection-disabled" === i.status ? (e.fatal("warn", "setup()", "Collection is disabled for the provided API Key."), this.Ot = N, N) : "init-failed" === i.status ? (this.Ot = H, H) : (this.Dt = i.managers, this.Ot = j, !1 !== t.autostart ? this.start() : j);
2003
+ } catch (t) {
2004
+ return e.warn("setup()", "failed:", t), this.Ot = H, H;
2005
+ }
2006
+ }
2007
+ async start() {
2008
+ if (this.Ot === F) return e.warn("start()", "start() requires a prior successful setup() — ignoring."), this.Ot;
2009
+ if (this.Ot !== j) return e.fatal("warn", "start()", "TRI is either already started or isn't ready — ignoring."), this.Ot;
2010
+ this.Ot = "starting";
2011
+ const t = ++this.qt;
2012
+ return await this.S(t), this.Ot;
2013
+ }
2014
+ async stop() {
2015
+ e.warn("stop()", "called");
2016
+ const t = this.Dt;
2017
+ return t ? (++this.qt, t.lifecycleManager.stop(), t.collectorManager.stop(), t.tabManager.stop(), t.eventReportManager.stop(), this.Ot = j, this.Ft(t)) : Promise.resolve(this.Ot);
2018
+ }
2019
+ async reset() {
2020
+ const t = this.stop();
2021
+ return this.Ot = F, this.Dt = null, t.then(() => this.Ot);
2022
+ }
2023
+ async Ft(t) {
2024
+ return await function(t) {
2025
+ let e = null;
2026
+ const n = new Promise((t) => {
2027
+ e = g(t, 2e3);
2028
+ });
2029
+ return Promise.race([t.finally(() => m(e)), n]);
2030
+ }(Promise.resolve(t.transportManager.stop())), await t.activityManager.stop(), this.Ot;
2031
+ }
2032
+ async S(t) {
2033
+ const n = this.Dt;
2034
+ if (n) {
2035
+ try {
2036
+ if (await n.activityManager.start(), t !== this.qt) return;
2037
+ if (n.transportManager.start(), await n.tabManager.start(), t !== this.qt) return;
2038
+ n.lifecycleManager.start(), n.collectorManager.autocapture();
2039
+ } catch (n) {
2040
+ e.warn("start()", "failed during monitoring start:", n), t === this.qt && (this.Ot = j);
2041
+ return;
2042
+ }
2043
+ t === this.qt && (this.Ot = U);
2044
+ }
2045
+ }
2046
+ async linkInterview(t) {
2047
+ if (this.Ot !== U || !this.Dt) return e.warn("linkInterview()", "linkInterview() called before start() completed — ignoring."), !1;
2048
+ if (!t) return e.warn("linkInterview()", "linkInterview() called without sessionToken — ignoring."), !1;
2049
+ try {
2050
+ return (await this.Dt.falconServiceManager.api.linkInterview(t)).ok;
2051
+ } catch (t) {
2052
+ return e.warn("linkInterview()", "failed:", t), !1;
2053
+ }
2054
+ }
2055
+ async getFpSignals() {
2056
+ if (this.Ot !== U) return e.warn("getFpSignals()", "getFpSignals() called before start() completed — ignoring."), null;
2057
+ try {
2058
+ return await (I ?? Promise.resolve(null));
2059
+ } catch (t) {
2060
+ return e.warn("getFpSignals()", "failed:", t), null;
2061
+ }
2062
+ }
2063
+ addFpSignals(t) {
2064
+ const n = this.Dt;
2065
+ if (this.Ot !== U || !n) return e.warn("addFpSignals()", "addFpSignals() called before start() completed — ignoring."), !1;
2066
+ if (n.collectorManager.isRunning("fpsignals")) return e.warn("addFpSignals()", "the fpsignals collector is on and sends its own results — ignoring."), !1;
2067
+ if ("string" != typeof t || !t) return e.warn("addFpSignals()", "signals is empty — ignoring."), !1;
2068
+ try {
2069
+ return n.transportManager.push({
2070
+ name: "fp_signals",
2071
+ timestamp: Date.now(),
2072
+ signals: t
2073
+ }), !0;
2074
+ } catch (t) {
2075
+ return e.warn("addFpSignals()", "failed:", t), !1;
2076
+ }
2077
+ }
2078
+ getActivityId() {
2079
+ const t = this.Dt;
2080
+ if (this.Ot !== U || !t) return e.warn("getActivityId()", "getActivityId() called before start() completed — returning null."), null;
2081
+ try {
2082
+ const { activityManager: e } = t;
2083
+ return e.isActive() && e.getActivityId() || null;
2084
+ } catch (t) {
2085
+ return e.warn("getActivityId()", "failed:", t), null;
2086
+ }
2087
+ }
2088
+ };
2089
+ async function Nt(t, e) {
2090
+ const n = e?.apiURL ?? "https://falcon-ingest-k8s.stage.incodetest.com", i = e?.timeout ?? 1e4, r = new AbortController();
2091
+ let s = null, o = !1, a = () => {};
2092
+ i && (s = g(() => {
2093
+ o = !0, r.abort();
2094
+ }, i));
2095
+ const c = e?.signal;
2096
+ if (c) if (c.aborted) r.abort();
2097
+ else {
2098
+ const t = () => r.abort();
2099
+ c.addEventListener("abort", t, { once: !0 }), a = () => c.removeEventListener("abort", t);
2100
+ }
2101
+ try {
2102
+ const e = await fetch(`${n}/api/v1/sdk/init`, {
2103
+ method: "POST",
2104
+ headers: {
2105
+ "content-type": "application/json",
2106
+ "x-api-key": t,
2107
+ "x-api-version": "1.0"
2108
+ },
2109
+ signal: r.signal
2110
+ });
2111
+ if (!e.ok) {
2112
+ let t = e.statusText;
2113
+ try {
2114
+ const n = await e.json();
2115
+ n.errorMessage && (t = n.errorMessage);
2116
+ } catch {}
2117
+ return {
2118
+ token: null,
2119
+ expiresAt: null,
2120
+ tokenType: null,
2121
+ eventsCollectionEnabled: !1,
2122
+ error: {
2123
+ status: e.status,
2124
+ message: t
2125
+ }
2126
+ };
2127
+ }
2128
+ const i = await e.json();
2129
+ return {
2130
+ token: i.token,
2131
+ expiresAt: i.expiresAt,
2132
+ tokenType: i.tokenType,
2133
+ eventsCollectionEnabled: !0,
2134
+ error: null
2135
+ };
2136
+ } catch (t) {
2137
+ throw new Error((o ? "[TRI] createSession timed out" : "[TRI] Failed to create session:") + " " + t.message);
2138
+ } finally {
2139
+ m(s), a();
2140
+ }
2141
+ }
2142
+ Ut.i = null;
2143
+ const Ht = Ut.instance;
2144
+ //#endregion
2145
+ export { Nt as createSession, Ht as default };