@incodetech/web 2.4.1 → 2.5.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/THIRD_PARTY_NOTICES.txt +1 -4
  2. package/dist/{GeolocationPermissionDenied-GbB9B3J0.js → GeolocationPermissionDenied-DRRBxdLP.js} +23 -8
  3. package/dist/Password-CY3Tv_5W.js +212 -0
  4. package/dist/RadioGroup-CnxMGtas.js +123 -0
  5. package/dist/RequiredLegend-CLQ0HX7d.js +16 -0
  6. package/dist/RequiredMarker-CAqxArxr.js +16 -0
  7. package/dist/TextField-MsdsbAbT.js +166 -0
  8. package/dist/ae-signature/ae-signature.es.js +4 -4
  9. package/dist/{af-ZA-Dm5i-KRC.js → af-ZA-CtJyXRHO.js} +129 -881
  10. package/dist/{ageVerification-n-1fouaD.js → ageVerification-C6fgHkhK.js} +10 -8
  11. package/dist/{am-UBTEdpJv.js → am-BvQDMy8e.js} +129 -881
  12. package/dist/antifraud/antifraud.es.js +5 -4
  13. package/dist/applyStudioConfig-DO18I6Cf.js +126 -0
  14. package/dist/{ar-AE--KjG2EAr.js → ar-AE-CmS-eCPq.js} +129 -881
  15. package/dist/{ar-RFuhholc.js → ar-Bpe0wGYL.js} +129 -881
  16. package/dist/{ar-EG-y8SWJjy1.js → ar-EG-DaxpzWwx.js} +129 -881
  17. package/dist/assertClassBrand-F6pL6aIr.js +17 -0
  18. package/dist/authentication/authentication.es.js +9 -6
  19. package/dist/autoFocusTitle-D_vDhPqZ.js +19 -0
  20. package/dist/{az-4Z0ZZq7T.js → az-zSRFEU_F.js} +129 -881
  21. package/dist/{back-horizontal-hint-BztyPanp.js → back-horizontal-hint-Bci98ivl.js} +1 -1
  22. package/dist/{back-vertical-hint-BSzA4QbJ.js → back-vertical-hint-DyPCItxn.js} +1 -1
  23. package/dist/base.css +1 -1
  24. package/dist/{baseTutorial-BixkM88z.js → baseTutorial-Bktx_Yrr.js} +9 -7
  25. package/dist/{bn-CNhjOqja.js → bn-BrITyCOh.js} +129 -881
  26. package/dist/{bottomSheet-B4REej8W.js → bottomSheet-CzU1QNua.js} +3 -3
  27. package/dist/{bs-Culcuxab.js → bs-rdaEnpNo.js} +128 -880
  28. package/dist/{ca-h1xwo6CW.js → ca-BEtpN_ag.js} +128 -880
  29. package/dist/cameraOverlay-D6NPWfIT.js +2 -0
  30. package/dist/{cameraOverlayHeader-D4Bjr6Fw.js → cameraOverlayHeader-DZHCfN1x.js} +9 -8
  31. package/dist/{cameraView-BpdAdfIK.js → cameraView-CYd-_y_r.js} +13 -14
  32. package/dist/capture-BBQJgktJ.js +2 -0
  33. package/dist/{tutorial-HfSD-QZ3.js → capture-BstPDTgL.js} +226 -82
  34. package/dist/capture-CkvbPbJK.js +754 -0
  35. package/dist/capture-DiJGnu9z.js +3 -0
  36. package/dist/captureButtonIcon-DhTUlcGq.js +1 -0
  37. package/dist/captureFocusContext-FsGun4Yd.js +718 -0
  38. package/dist/captureFooter-BLJ1Qvov.js +47 -0
  39. package/dist/{ceb-pTDH3h1x.js → ceb-D5rPC9mY.js} +129 -881
  40. package/dist/certificate-issuance/certificate-issuance.es.js +68 -41
  41. package/dist/certificate-issuance/styles.css +1 -1
  42. package/dist/certificate-issuance/styles.css.js +1 -1
  43. package/dist/{checkbox-CALR7EFM.js → checkbox-HfnbGBMk.js} +4 -4
  44. package/dist/chooser-Dm0wohHb.js +1517 -0
  45. package/dist/connectionError-BFVvBEMq.js +100 -0
  46. package/dist/consent/consent.es.js +19 -14
  47. package/dist/consent/styles.css +1 -1
  48. package/dist/consent/styles.css.js +1 -1
  49. package/dist/{countryDefinitions-BO9OSKQO.js → countryDefinitions-UXJ0maPk.js} +6 -0
  50. package/dist/{countryFlag-2Vj85OIZ.js → countryFlag-CjuXF_8C.js} +1 -1
  51. package/dist/{countrySelector-DKvvYxP6.js → countrySelector-CEJAgeRY.js} +6 -5
  52. package/dist/cross-document-data-match/cross-document-data-match.es.js +5 -4
  53. package/dist/{cs-CZ-CiATe8nW.js → cs-CZ-BEprNqLt.js} +128 -880
  54. package/dist/{cs-CrQuSSOI.js → cs-D_U436l9.js} +128 -880
  55. package/dist/curp-validation/curp-validation.es.js +97 -96
  56. package/dist/curp-validation/styles.css +1 -1
  57. package/dist/curp-validation/styles.css.js +1 -1
  58. package/dist/{customFields-DRwjotY-.js → customFields-DqebmaL5.js} +33 -20
  59. package/dist/{customWatchlist-DmROVUfp.js → customWatchlist-DVSMbzw5.js} +11 -9
  60. package/dist/{da-DK-CgrU79mp.js → da-DK-dMikXCNn.js} +128 -880
  61. package/dist/dashboardTheme-CB91NoiD.js +388 -0
  62. package/dist/{dateInputComposed-Bu7vM-M4.js → dateInputComposed-CVJ4LSep.js} +4 -5
  63. package/dist/dateInputComposed-DF0Dx86l.js +1 -0
  64. package/dist/{de-D0xnkswj.js → de-C3c7Bo-M.js} +128 -880
  65. package/dist/denied-BR9pZqKi.js +272 -0
  66. package/dist/devWarn-CXWsIkak.js +1034 -0
  67. package/dist/deviceWallet-DDHk7jBw.js +37 -0
  68. package/dist/{digitalIdRedirect-Dpv37Mbi.js → digitalIdRedirect-DKJgITR_.js} +4 -4
  69. package/dist/{digitalIdUpload-DKXe-_GE.js → digitalIdUpload-BgG6svjJ.js} +37 -15
  70. package/dist/document-capture/document-capture.es.js +1 -1
  71. package/dist/document-capture/styles.css +1 -1
  72. package/dist/document-capture/styles.css.js +1 -1
  73. package/dist/{documentCapture-DlBMtLvL.js → documentCapture-Cu3F_ka7.js} +136 -72
  74. package/dist/documentCapture-owKpu8oI.js +2 -0
  75. package/dist/{dropdownComposed-B-qTBcja.js → dropdownComposed-BJCNWDGU.js} +8 -6
  76. package/dist/dropdownComposed-zidm_XVK.js +1 -0
  77. package/dist/dynamic-forms/dynamic-forms.es.js +62 -35
  78. package/dist/ekyb/ekyb.es.js +1 -1
  79. package/dist/ekyb/styles.css +1 -1
  80. package/dist/ekyb/styles.css.js +1 -1
  81. package/dist/ekybModule-Qc_5cB3W.js +2 -0
  82. package/dist/{ekybModule-qkUiNFdJ.js → ekybModule-tV6tUWe_.js} +109 -89
  83. package/dist/ekyc/ekyc.es.js +1 -1
  84. package/dist/ekyc/styles.css +1 -1
  85. package/dist/ekyc/styles.css.js +1 -1
  86. package/dist/ekyc-prefill/ekyc-prefill.es.js +2 -0
  87. package/dist/ekyc-prefill/styles.css +2 -0
  88. package/dist/ekyc-prefill/styles.css.js +1 -0
  89. package/dist/ekycModule-BgB_xu54.js +789 -0
  90. package/dist/ekycModule-DZ7yboJO.js +2 -0
  91. package/dist/ekycPrefillModule-B0cJJiuu.js +2 -0
  92. package/dist/ekycPrefillModule-B1xn0veW.js +233 -0
  93. package/dist/{el-GR-DPUvlcvr.js → el-GR-eG5AImZr.js} +128 -880
  94. package/dist/{el-B5gLXHxC.js → el-LOaoXfUU.js} +129 -881
  95. package/dist/electronic-signature/electronic-signature.es.js +1 -1
  96. package/dist/{electronic-signature-Jx8qWrW-.js → electronic-signature-BleJ65-Y.js} +55 -36
  97. package/dist/email/email.es.js +21 -16
  98. package/dist/{emailInput-ClX3Lu8X.js → emailInput-BVx96bJy.js} +23 -12
  99. package/dist/{en-DNuMvR7-.js → en-B_-7--AN.js} +129 -881
  100. package/dist/{en-DG-DOwBuCCl.js → en-DG-BDnlBAUl.js} +129 -881
  101. package/dist/{errorContent-B_pH1MX7.js → errorContent-x8IajOaE.js} +21 -20
  102. package/dist/errorParams-B68-Euu2.js +37 -0
  103. package/dist/es-419-DS4mN2d_.js +5 -0
  104. package/dist/{es-ES-BF9vl0Um.js → es-ES-BMafdM90.js} +128 -880
  105. package/dist/{es-MX-Brp4FXN8.js → es-MX-DqhG7Zy7.js} +128 -880
  106. package/dist/{es-DNl7ceDm.js → es-T4K5G5zB.js} +129 -881
  107. package/dist/{et-D5pPP4r0.js → et-fBoHBc5h.js} +129 -881
  108. package/dist/expiredId-Q5ITzZU-.js +67 -0
  109. package/dist/extensibility.es.js +382 -55
  110. package/dist/{fa-IR-BoyK-lax.js → fa-IR--PnMtKvC.js} +129 -881
  111. package/dist/face-match/face-match.es.js +1 -1
  112. package/dist/face-match/styles.css +1 -1
  113. package/dist/face-match/styles.css.js +1 -1
  114. package/dist/{faceMatch-Dp1AGBtg.js → faceMatch-D-ehWIdN.js} +54 -71
  115. package/dist/faceMatch-RxP2VPBm.js +2 -0
  116. package/dist/{fi-FI-mYdAUbtG.js → fi-FI-D-T9bf67.js} +128 -880
  117. package/dist/field-comparison/field-comparison.es.js +1 -1
  118. package/dist/fieldComparison-BhYiGx0t.js +2 -0
  119. package/dist/fieldComparison-c3xT3K4C.js +126 -0
  120. package/dist/{fieldLabelHint-CxjArYkQ.js → fieldLabelHint-yMZjXK6p.js} +3 -3
  121. package/dist/{finalSuccessScreen-BgPVGAr4.js → finalSuccessScreen-CDr8bsI6.js} +31 -22
  122. package/dist/fiscal-qr/fiscal-qr.es.js +32 -26
  123. package/dist/flipAnimation-C95PZFAJ.js +46 -0
  124. package/dist/flipCapturedCardEligibility-CcB0uVfH.js +210 -0
  125. package/dist/flow/flow.es.js +315 -287
  126. package/dist/flow/shell/styles.css +1 -1
  127. package/dist/flow/shell/styles.css.js +1 -1
  128. package/dist/flow/styles.css +1 -1
  129. package/dist/formField-Ba8BQ_l8.js +49 -0
  130. package/dist/{fr-B4R5fgnm.js → fr-BlNTqS4_.js} +128 -880
  131. package/dist/{fr-CA-DJSwRuWt.js → fr-CA-DBO_1sfd.js} +128 -880
  132. package/dist/{front-horizontal-hint-DEHmtcdg.js → front-horizontal-hint-LxyNVfjy.js} +1 -1
  133. package/dist/{front-vertical-hint-Cb1NO-xT.js → front-vertical-hint-BKEg_DRs.js} +1 -1
  134. package/dist/geolocation/geolocation.es.js +15 -12
  135. package/dist/government-validation/government-validation.es.js +7 -6
  136. package/dist/{he-D2RDlnbd.js → he-C-PnifVg.js} +129 -881
  137. package/dist/helpButtonConfig-BFragC_J.js +24 -0
  138. package/dist/{hi-DFXhGN9O.js → hi-mETIwcDe.js} +129 -881
  139. package/dist/{hmn-BlNbfL-D.js → hmn-BZabGetu.js} +129 -881
  140. package/dist/{homeScreen-DjzxBrYL.js → homeScreen-CcRzcWya.js} +26 -14
  141. package/dist/{incodeComponent-B-lwJJCV.js → hooks-nmwpawA2.js} +256 -280
  142. package/dist/{hr-DArr3n62.js → hr-DzkTH3cj.js} +128 -880
  143. package/dist/{ht-CAd-Hmi1.js → ht-D5zV7ROu.js} +129 -881
  144. package/dist/{hu-CulT8eq_.js → hu-CeHrYR4q.js} +130 -882
  145. package/dist/{icons-C2LgNjXy.js → icons-DLZTxOV2.js} +153 -80
  146. package/dist/id/id.es.js +167 -197
  147. package/dist/id/styles.css +1 -1
  148. package/dist/id/styles.css.js +1 -1
  149. package/dist/{id-D2VZL6b-.js → id-B_qFrh_W.js} +129 -881
  150. package/dist/{id-back-of-card-C7Au2tqk.js → id-back-of-card-BhF5T4fC.js} +1 -1
  151. package/dist/{id-back-of-card-vertical-CtQBFw8w.js → id-back-of-card-vertical-BudLiGPR.js} +1 -1
  152. package/dist/{id-front-of-card-BmHL_keG.js → id-front-of-card-CiGcJhVW.js} +1 -1
  153. package/dist/{id-front-of-card-vertical-DkNUn2Vx.js → id-front-of-card-vertical-C_GyecLf.js} +1 -1
  154. package/dist/id-selfie-flow/id-selfie-flow.es.js +13 -11
  155. package/dist/id-selfie-flow/styles.css +1 -1
  156. package/dist/id-verification/id-verification.es.js +12 -6
  157. package/dist/idFlipTransition-DuwSIp-D.js +154 -0
  158. package/dist/{idOcr-BWG3vj8j.js → idOcr-DatcQrFh.js} +64 -37
  159. package/dist/identity-reuse/identity-reuse.es.js +38 -25
  160. package/dist/identity-reuse/styles.css.js +1 -0
  161. package/dist/incodeComponent-DFue7FgD.js +235 -0
  162. package/dist/incodeModule-BWSWx6zz.js +41 -0
  163. package/dist/index.es.js +4 -3
  164. package/dist/{inputComposed-B35soRFg.js → inputComposed-6M3lOVUo.js} +4 -4
  165. package/dist/{it-fs9OkGbv.js → it-CwzQoTtJ.js} +130 -882
  166. package/dist/{ja-JP-C5-gDGuX.js → ja-JP-Cg6pV7OS.js} +130 -882
  167. package/dist/{ja-BvKVI6Oo.js → ja-eNtdzeB5.js} +129 -881
  168. package/dist/{jv-CyId7aPo.js → jv-BANHtRb4.js} +128 -880
  169. package/dist/{ka-pqIPc2el.js → ka-DWhlum5Q.js} +129 -881
  170. package/dist/{kk-DK7mWl6k.js → kk-CAsKyYR9.js} +128 -880
  171. package/dist/{km-BaJYdDrm.js → km-DJHdr0lO.js} +137 -889
  172. package/dist/{ko-CdYIGTH_.js → ko-BAPbgx_r.js} +129 -881
  173. package/dist/{ko-KP-Q3GGdDp3.js → ko-KP-BRD8crfV.js} +129 -881
  174. package/dist/{ky-Bc7ZXIXy.js → ky-0IKHwWw_.js} +128 -880
  175. package/dist/kyb-checks/kyb-checks.es.js +2 -0
  176. package/dist/kyb-checks/styles.css +2 -0
  177. package/dist/kyb-checks/styles.css.js +1 -0
  178. package/dist/kybChecksModule-CWFpU32e.js +345 -0
  179. package/dist/kybChecksModule-D3u3hdUP.js +2 -0
  180. package/dist/{lo-0jgAavCe.js → lo-DkBffqOP.js} +129 -881
  181. package/dist/{lt-DDEjR6RD.js → lt-Btf5JQPU.js} +129 -881
  182. package/dist/{lv-Ddzb_N3H.js → lv-DMnPY0bZ.js} +129 -881
  183. package/dist/{mandatoryConsent-C21a2d2-.js → mandatoryConsent-Ci6fJR2F.js} +23 -16
  184. package/dist/{manualCaptureButton-1KC7N_B-.js → manualCaptureButton-DrdeVhq8.js} +8 -7
  185. package/dist/{manualCaptureButton-C5VMDamt.js → manualCaptureButton-ZxWHf5Sa.js} +16 -12
  186. package/dist/{mk-SJwou4aX.js → mk-CQIDbtM2.js} +129 -881
  187. package/dist/{mn-7B86xjpb.js → mn-Cc1HnwyR.js} +128 -880
  188. package/dist/{ms-Bb-SlQCF.js → ms-CORA9eaw.js} +128 -880
  189. package/dist/{my-3ci4RJZY.js → my-CNDvlF-Z.js} +129 -881
  190. package/dist/{nb-NO-DpZAni0R.js → nb-NO-BwZ27fuH.js} +128 -880
  191. package/dist/{ne-Dncyvxqt.js → ne-D7rkhft1.js} +129 -881
  192. package/dist/{nl-C1mnzCBH.js → nl-DsxNMb79.js} +129 -881
  193. package/dist/{optionAccessibleLabel-DG8Lks9f.js → optionAccessibleLabel-Cz2x8Q7x.js} +27 -11
  194. package/dist/otpInput-B2fLiJsF.js +245 -0
  195. package/dist/{page-DINsqGIw.js → page-B0CjRMtF.js} +102 -79
  196. package/dist/{incode-logo-B1bl2S0z.js → pageUiConfig-mKn_YhhU.js} +88 -14
  197. package/dist/{passport-horizontal-hint-DgNc6F0-.js → passport-horizontal-hint-Bn18pckF.js} +1 -1
  198. package/dist/{passport-vertical-hint-B-toVsfT.js → passport-vertical-hint-D_bvTNZY.js} +1 -1
  199. package/dist/passwordRequirements-13qw_WSJ.js +49 -0
  200. package/dist/{pdf-BKHLi5Ac.js → pdf-DO_HvE8T.js} +2 -17
  201. package/dist/pdfViewer-CCHNUl5h.js +2 -0
  202. package/dist/{pdfViewer-C8xHykz1.js → pdfViewer-pgBIY_Q7.js} +11 -14
  203. package/dist/permissionInstructionList-DPDqNKFJ.js +43 -0
  204. package/dist/{permissions-B7-lHrFm.js → permissions-CKjgrM7q.js} +84 -53
  205. package/dist/phone/phone.es.js +16 -12
  206. package/dist/{phoneInputComposed-Di4acsc0.js → phoneInputComposed-BbZuW8Q8.js} +49 -12
  207. package/dist/{pl-CWr2fVBg.js → pl-DOgi6huc.js} +128 -880
  208. package/dist/preloadableLazy-KWGuHoqn.js +43 -0
  209. package/dist/{processing-z5wuXrKw.js → processing-v4EkL9-U.js} +2 -2
  210. package/dist/{progressBar-BcKFaXZR.js → progressBar-D-kfX8X1.js} +2 -2
  211. package/dist/{pt-BR-CMvTsOqE.js → pt-BR-x__xGSN_.js} +129 -881
  212. package/dist/{pt-AGz2XGAK.js → pt-CX0ngiGh.js} +129 -881
  213. package/dist/{pt-PT-KzIM0vpf.js → pt-PT-BKwyOX-W.js} +129 -881
  214. package/dist/qe-signature/qe-signature.es.js +4 -4
  215. package/dist/realtimeFeedbackConfig-DeZksjlR.js +16 -0
  216. package/dist/redirect-to-mobile/redirect-to-mobile.es.js +66 -62
  217. package/dist/redirect-to-mobile/styles.css +1 -1
  218. package/dist/redirect-to-mobile/styles.css.js +1 -1
  219. package/dist/{registerIncodeElement-D_cn4dSI.js → registerIncodeElement-FoirFu19.js} +1 -1
  220. package/dist/{resendTimer-On_zrMLS.js → resendTimer-DHgQUcAi.js} +2 -2
  221. package/dist/richText-DlHC_sMB.js +1761 -0
  222. package/dist/{ro-DYdJJDKn.js → ro-DGB5aI9B.js} +129 -881
  223. package/dist/{ru-C1cguVi2.js → ru-Dnl6YnE6.js} +129 -881
  224. package/dist/{ru-RU-18JeDfwz.js → ru-RU-BM5Leyxp.js} +128 -880
  225. package/dist/{sanitizeSvg-BC-qLUgS.js → sanitizeSvg-IfqLuP1N.js} +1 -1
  226. package/dist/selfie/selfie.es.js +37 -14
  227. package/dist/selfie/styles.css +1 -1
  228. package/dist/selfie/styles.css.js +1 -1
  229. package/dist/signature/signature.es.js +18 -13
  230. package/dist/{sk-CtIcnYOo.js → sk-B4HQZzV6.js} +131 -883
  231. package/dist/{sl-DS_Gc0Wc.js → sl-ClgVmZ1h.js} +129 -881
  232. package/dist/{smsTabContent-vE0WyKtg.js → smsTabContent-D9Eb005G.js} +40 -27
  233. package/dist/{so-dqMTkg5E.js → so-BLFIV5-m.js} +129 -881
  234. package/dist/spacer-D5j2phXI.js +1100 -0
  235. package/dist/spinner-BeYdZjPC.js +69 -0
  236. package/dist/{sr-DgHGiiWM.js → sr-CkSmwRiY.js} +128 -880
  237. package/dist/{sr-Latn-Du7_x_Tr.js → sr-Latn-BdLB-I3Z.js} +136 -888
  238. package/dist/sr-YU-DJ3geBJs.js +5 -0
  239. package/dist/{sv-SE-Dw61hRjx.js → sv-SE-DEfqYDzZ.js} +128 -880
  240. package/dist/{sw-De-Jo8XY.js → sw-16U52YpC.js} +129 -881
  241. package/dist/{th-BJixOgsM.js → th-Cg0hYujg.js} +129 -881
  242. package/dist/{th-TH-VyhljC5U.js → th-TH-BBPg926O.js} +129 -881
  243. package/dist/themes/dark.css +1 -1
  244. package/dist/themes/light.css +1 -1
  245. package/dist/{tl-PH-D2S2Irx7.js → tl-PH-DSHq83jb.js} +129 -881
  246. package/dist/{tl-DhjdqhA4.js → tl-SL2bqb6j.js} +129 -881
  247. package/dist/{tr-BJAuvOwN.js → tr-DclJKp5i.js} +130 -882
  248. package/dist/{transitionSpinner-BZO916B1.js → transitionSpinner-b8SMrhfd.js} +7 -7
  249. package/dist/tutorial-0IhGg6rb.js +28 -0
  250. package/dist/types/ae-signature.d.ts +17 -4
  251. package/dist/types/antifraud.d.ts +17 -4
  252. package/dist/types/authentication.d.ts +17 -4
  253. package/dist/types/certificate-issuance.d.ts +17 -4
  254. package/dist/types/consent.d.ts +17 -4
  255. package/dist/types/cross-document-data-match.d.ts +17 -4
  256. package/dist/types/curp-validation.d.ts +17 -4
  257. package/dist/types/document-capture.d.ts +17 -4
  258. package/dist/types/dynamic-forms.d.ts +17 -4
  259. package/dist/types/ekyb.d.ts +17 -4
  260. package/dist/types/ekyc-prefill.d.ts +213 -0
  261. package/dist/types/ekyc.d.ts +17 -4
  262. package/dist/types/electronic-signature.d.ts +17 -4
  263. package/dist/types/email.d.ts +17 -4
  264. package/dist/types/extensibility.d.ts +204 -37
  265. package/dist/types/face-match.d.ts +17 -4
  266. package/dist/types/field-comparison.d.ts +17 -4
  267. package/dist/types/fiscal-qr.d.ts +17 -4
  268. package/dist/types/flow.d.ts +38 -5
  269. package/dist/types/geolocation.d.ts +17 -4
  270. package/dist/types/government-validation.d.ts +17 -4
  271. package/dist/types/id-selfie-flow.d.ts +17 -4
  272. package/dist/types/id-verification.d.ts +17 -4
  273. package/dist/types/id.d.ts +17 -4
  274. package/dist/types/identity-reuse.d.ts +18 -5
  275. package/dist/types/index.d.ts +92 -10
  276. package/dist/types/kyb-checks.d.ts +213 -0
  277. package/dist/types/phone.d.ts +17 -4
  278. package/dist/types/qe-signature.d.ts +17 -4
  279. package/dist/types/redirect-to-mobile.d.ts +1 -1
  280. package/dist/types/selfie.d.ts +17 -4
  281. package/dist/types/signature.d.ts +17 -4
  282. package/dist/types/video-selfie.d.ts +1 -1
  283. package/dist/types/watchlist.d.ts +17 -4
  284. package/dist/types/workflow.d.ts +17 -4
  285. package/dist/{typography-8iwtPQbj.js → typography-D3swFCxZ.js} +3 -11
  286. package/dist/{uk-CcU91ee-.js → uk-CfFK_Tnk.js} +128 -880
  287. package/dist/{uk-UA-BZR90qDZ.js → uk-UA-vkh8X4bX.js} +129 -881
  288. package/dist/{ur-CIXtUYHK.js → ur-32a-9tt8.js} +129 -881
  289. package/dist/useCameraPreview-hNLhri73.js +93 -0
  290. package/dist/useCaptureHelpButton-BJQvSkuJ.js +43 -0
  291. package/dist/useIsDarkTheme-DoOFy9TN.js +27 -0
  292. package/dist/{useModuleLoader-BdIp6TNQ.js → useModuleLoader-BCYS1xLP.js} +31 -18
  293. package/dist/{uz-CeLVgwAD.js → uz-BEx-De8I.js} +129 -881
  294. package/dist/{vendor-preact-C0jX1Cbq.js → vendor-preact-CjnloSla.js} +147 -5
  295. package/dist/{verificationResult-C2gxbmAo.js → verificationResult-tHoFvrGZ.js} +30 -27
  296. package/dist/{vi-CgfGVVLY.js → vi-CMQXfqfw.js} +129 -881
  297. package/dist/video-selfie/styles.css +1 -1
  298. package/dist/video-selfie/styles.css.js +1 -1
  299. package/dist/video-selfie/video-selfie.es.js +120 -77
  300. package/dist/watchlist/watchlist.es.js +12 -9
  301. package/dist/{watchlistForBusiness-eOPtmu7z.js → watchlistForBusiness-CbRaBYoJ.js} +63 -22
  302. package/dist/{withEndScreenTexts-aFUEeBgM.js → withEndScreenTexts-10ck20tq.js} +253 -55
  303. package/dist/workflow/styles.css +1 -1
  304. package/dist/workflow/workflow.es.js +36 -28
  305. package/dist/{zh-CN-BOxod1_T.js → zh-CN-BelxA_Rf.js} +128 -880
  306. package/dist/{zh-HANT-zAahQ8nP.js → zh-HANT-DsztptZA.js} +129 -881
  307. package/dist/{zh-TW-B0v7GYYG.js → zh-TW-DKQC3FXd.js} +129 -881
  308. package/dist/{zh-B-kjeCig.js → zh-v3x4XYal.js} +128 -880
  309. package/package.json +48 -12
  310. package/dist/autoFocusTitle-Cy0J3lvr.js +0 -32
  311. package/dist/browser-ponyfill-DT11p-Ob.js +0 -441
  312. package/dist/cameraOverlay-DQEG24io.js +0 -2
  313. package/dist/check-icon-BpjpKqhJ.js +0 -48
  314. package/dist/connectionError-Cf6iGFyx.js +0 -45
  315. package/dist/dashboardTheme-CkyISqIs.js +0 -247
  316. package/dist/dateInputComposed-cgZGBSiu.js +0 -1
  317. package/dist/denied-ByGDWkTW.js +0 -1871
  318. package/dist/deviceWallet-C4UT05wN.js +0 -66
  319. package/dist/documentCapture-Dh1ftzGG.js +0 -2
  320. package/dist/dropdownComposed-DmT4s8VM.js +0 -1
  321. package/dist/ekybModule-BHInfPHS.js +0 -2
  322. package/dist/ekycModule-B2cfT3zi.js +0 -2
  323. package/dist/ekycModule-BQPl1KQT.js +0 -300
  324. package/dist/es-419-BU7r2Fvh.js +0 -3193
  325. package/dist/esm-15CISqPe.js +0 -430
  326. package/dist/expiredId-GIHjGAuY.js +0 -80
  327. package/dist/faceMatch-bXhejzhf.js +0 -2
  328. package/dist/fieldComparison-BirXQb7f.js +0 -2
  329. package/dist/fieldComparison-D8PL0eR1.js +0 -109
  330. package/dist/flipAnimation-BgMPQ8Ma.js +0 -3048
  331. package/dist/formField-0k8wVfXl.js +0 -60
  332. package/dist/incodeModule-DiVtqekm.js +0 -68
  333. package/dist/inputComposed-CKujYUSB.js +0 -1
  334. package/dist/numberedStep-CvbL3ht2.js +0 -13
  335. package/dist/otpInput-_B7xEZUU.js +0 -157
  336. package/dist/passwordInputComposed-B3WKjODU.js +0 -74
  337. package/dist/pdfViewer-DcB41xr7.js +0 -2
  338. package/dist/radioGroupComposed-CIbHjX4v.js +0 -160
  339. package/dist/radioGroupComposed-eXNWg1ez.js +0 -1
  340. package/dist/reload-icon-elAFo9-k.js +0 -70
  341. package/dist/richText-aCnLd3j2.js +0 -1549
  342. package/dist/spacer-lcnhSC-5.js +0 -741
  343. package/dist/spinner-B8BswhBb.js +0 -88
  344. package/dist/sr-YU-YuZu7wdb.js +0 -3197
  345. package/dist/statusPage-WIsGgf_m.js +0 -36
  346. package/dist/uiConfig-CwGL3QjP.js +0 -2589
  347. package/dist/useCaptureHelpButton-BTUZs3Ev.js +0 -86
  348. package/dist/useCoverMedia-VLw3OYN_.js +0 -149
  349. /package/dist/{aligndevicelottie-BARt-rhe.js → aligndevicelottie-BEKzL4SB.js} +0 -0
  350. /package/dist/{back-tutorial-CZrMmj1_.js → back-tutorial-B9W63fa-.js} +0 -0
  351. /package/dist/{backdevicelottie-CIM3ekd8.js → backdevicelottie-DsN8QBV3.js} +0 -0
  352. /package/dist/{blurdevicelottie-BRyXfLB6.js → blurdevicelottie-DkV7Kwo4.js} +0 -0
  353. /package/dist/{defineProperty-CjeJoXkx.js → defineProperty-B4FQTz14.js} +0 -0
  354. /package/dist/{flip-animation-BU5LNKYx.js → flip-animation-DJVnWWL5.js} +0 -0
  355. /package/dist/{frontdevicelottie-arpyu_Fz.js → frontdevicelottie-DiW1Wmya.js} +0 -0
  356. /package/dist/{glaredevicelottie-TwTFxe7h.js → glaredevicelottie-CK-fnX_s.js} +0 -0
  357. /package/dist/{id-laser-h-Dr-hBxrq.js → id-laser-h-6Am_cjM8.js} +0 -0
  358. /package/dist/{id-laser-v-D_r0QNY8.js → id-laser-v-DXoF3flH.js} +0 -0
  359. /package/dist/{id-tutorial-DM9Pkfs-.js → id-tutorial-DkKH3eTE.js} +0 -0
  360. /package/dist/{lottie_light-aMg9Q9iO.js → lottie_light-Bam05Bc9.js} +0 -0
  361. /package/dist/{passport-tutorial-CKZZuDf_.js → passport-tutorial-D3Fpk-Tj.js} +0 -0
  362. /package/dist/{pdf.worker.min-BM1b2w9V.js → pdf.worker.min-D0hm-8jN.js} +0 -0
  363. /package/dist/{policyUrls-B3M8nLRh.js → policyUrls-B3TEaluh.js} +0 -0
  364. /package/dist/{purify.es-0fCPkEV1.js → purify.es-DhY3JLdI.js} +0 -0
  365. /package/dist/{selfieTutorial-Dz6lDFMn.js → selfieTutorial-DnsRD1Z9.js} +0 -0
@@ -1,2589 +0,0 @@
1
- import { S as k, _ as y, f as d, h as q, r as C, u as T, v as u, y as K } from "./vendor-preact-C0jX1Cbq.js";
2
- //#region ../../node_modules/.pnpm/i18next@25.7.1_typescript@5.9.3/node_modules/i18next/dist/esm/i18next.js
3
- var isString = (obj) => typeof obj === "string";
4
- var defer = () => {
5
- let res;
6
- let rej;
7
- const promise = new Promise((resolve, reject) => {
8
- res = resolve;
9
- rej = reject;
10
- });
11
- promise.resolve = res;
12
- promise.reject = rej;
13
- return promise;
14
- };
15
- var makeString = (object) => {
16
- if (object == null) return "";
17
- return "" + object;
18
- };
19
- var copy = (a, s, t) => {
20
- a.forEach((m) => {
21
- if (s[m]) t[m] = s[m];
22
- });
23
- };
24
- var lastOfPathSeparatorRegExp = /###/g;
25
- var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
26
- var canNotTraverseDeeper = (object) => !object || isString(object);
27
- var getLastOfPath = (object, path, Empty) => {
28
- const stack = !isString(path) ? path : path.split(".");
29
- let stackIndex = 0;
30
- while (stackIndex < stack.length - 1) {
31
- if (canNotTraverseDeeper(object)) return {};
32
- const key = cleanKey(stack[stackIndex]);
33
- if (!object[key] && Empty) object[key] = new Empty();
34
- if (Object.prototype.hasOwnProperty.call(object, key)) object = object[key];
35
- else object = {};
36
- ++stackIndex;
37
- }
38
- if (canNotTraverseDeeper(object)) return {};
39
- return {
40
- obj: object,
41
- k: cleanKey(stack[stackIndex])
42
- };
43
- };
44
- var setPath = (object, path, newValue) => {
45
- const { obj, k } = getLastOfPath(object, path, Object);
46
- if (obj !== void 0 || path.length === 1) {
47
- obj[k] = newValue;
48
- return;
49
- }
50
- let e = path[path.length - 1];
51
- let p = path.slice(0, path.length - 1);
52
- let last = getLastOfPath(object, p, Object);
53
- while (last.obj === void 0 && p.length) {
54
- e = `${p[p.length - 1]}.${e}`;
55
- p = p.slice(0, p.length - 1);
56
- last = getLastOfPath(object, p, Object);
57
- if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== "undefined") last.obj = void 0;
58
- }
59
- last.obj[`${last.k}.${e}`] = newValue;
60
- };
61
- var pushPath = (object, path, newValue, concat) => {
62
- const { obj, k } = getLastOfPath(object, path, Object);
63
- obj[k] = obj[k] || [];
64
- obj[k].push(newValue);
65
- };
66
- var getPath = (object, path) => {
67
- const { obj, k } = getLastOfPath(object, path);
68
- if (!obj) return void 0;
69
- if (!Object.prototype.hasOwnProperty.call(obj, k)) return void 0;
70
- return obj[k];
71
- };
72
- var getPathWithDefaults = (data, defaultData, key) => {
73
- const value = getPath(data, key);
74
- if (value !== void 0) return value;
75
- return getPath(defaultData, key);
76
- };
77
- var deepExtend = (target, source, overwrite) => {
78
- for (const prop in source) if (prop !== "__proto__" && prop !== "constructor") if (prop in target) if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
79
- if (overwrite) target[prop] = source[prop];
80
- } else deepExtend(target[prop], source[prop], overwrite);
81
- else target[prop] = source[prop];
82
- return target;
83
- };
84
- var regexEscape = (str) => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
85
- var _entityMap = {
86
- "&": "&amp;",
87
- "<": "&lt;",
88
- ">": "&gt;",
89
- "\"": "&quot;",
90
- "'": "&#39;",
91
- "/": "&#x2F;"
92
- };
93
- var escape = (data) => {
94
- if (isString(data)) return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
95
- return data;
96
- };
97
- var RegExpCache = class {
98
- constructor(capacity) {
99
- this.capacity = capacity;
100
- this.regExpMap = /* @__PURE__ */ new Map();
101
- this.regExpQueue = [];
102
- }
103
- getRegExp(pattern) {
104
- const regExpFromCache = this.regExpMap.get(pattern);
105
- if (regExpFromCache !== void 0) return regExpFromCache;
106
- const regExpNew = new RegExp(pattern);
107
- if (this.regExpQueue.length === this.capacity) this.regExpMap.delete(this.regExpQueue.shift());
108
- this.regExpMap.set(pattern, regExpNew);
109
- this.regExpQueue.push(pattern);
110
- return regExpNew;
111
- }
112
- };
113
- var chars = [
114
- " ",
115
- ",",
116
- "?",
117
- "!",
118
- ";"
119
- ];
120
- var looksLikeObjectPathRegExpCache = new RegExpCache(20);
121
- var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
122
- nsSeparator = nsSeparator || "";
123
- keySeparator = keySeparator || "";
124
- const possibleChars = chars.filter((c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
125
- if (possibleChars.length === 0) return true;
126
- const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c) => c === "?" ? "\\?" : c).join("|")})`);
127
- let matched = !r.test(key);
128
- if (!matched) {
129
- const ki = key.indexOf(keySeparator);
130
- if (ki > 0 && !r.test(key.substring(0, ki))) matched = true;
131
- }
132
- return matched;
133
- };
134
- var deepFind = (obj, path, keySeparator = ".") => {
135
- if (!obj) return void 0;
136
- if (obj[path]) {
137
- if (!Object.prototype.hasOwnProperty.call(obj, path)) return void 0;
138
- return obj[path];
139
- }
140
- const tokens = path.split(keySeparator);
141
- let current = obj;
142
- for (let i = 0; i < tokens.length;) {
143
- if (!current || typeof current !== "object") return;
144
- let next;
145
- let nextPath = "";
146
- for (let j = i; j < tokens.length; ++j) {
147
- if (j !== i) nextPath += keySeparator;
148
- nextPath += tokens[j];
149
- next = current[nextPath];
150
- if (next !== void 0) {
151
- if ([
152
- "string",
153
- "number",
154
- "boolean"
155
- ].indexOf(typeof next) > -1 && j < tokens.length - 1) continue;
156
- i += j - i + 1;
157
- break;
158
- }
159
- }
160
- current = next;
161
- }
162
- return current;
163
- };
164
- var getCleanedCode = (code) => code?.replace("_", "-");
165
- var consoleLogger = {
166
- type: "logger",
167
- log(args) {
168
- this.output("log", args);
169
- },
170
- warn(args) {
171
- this.output("warn", args);
172
- },
173
- error(args) {
174
- this.output("error", args);
175
- },
176
- output(type, args) {
177
- console?.[type]?.apply?.(console, args);
178
- }
179
- };
180
- var baseLogger = new class Logger {
181
- constructor(concreteLogger, options = {}) {
182
- this.init(concreteLogger, options);
183
- }
184
- init(concreteLogger, options = {}) {
185
- this.prefix = options.prefix || "i18next:";
186
- this.logger = concreteLogger || consoleLogger;
187
- this.options = options;
188
- this.debug = options.debug;
189
- }
190
- log(...args) {
191
- return this.forward(args, "log", "", true);
192
- }
193
- warn(...args) {
194
- return this.forward(args, "warn", "", true);
195
- }
196
- error(...args) {
197
- return this.forward(args, "error", "");
198
- }
199
- deprecate(...args) {
200
- return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
201
- }
202
- forward(args, lvl, prefix, debugOnly) {
203
- if (debugOnly && !this.debug) return null;
204
- if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
205
- return this.logger[lvl](args);
206
- }
207
- create(moduleName) {
208
- return new Logger(this.logger, {
209
- prefix: `${this.prefix}:${moduleName}:`,
210
- ...this.options
211
- });
212
- }
213
- clone(options) {
214
- options = options || this.options;
215
- options.prefix = options.prefix || this.prefix;
216
- return new Logger(this.logger, options);
217
- }
218
- }();
219
- var EventEmitter = class {
220
- constructor() {
221
- this.observers = {};
222
- }
223
- on(events, listener) {
224
- events.split(" ").forEach((event) => {
225
- if (!this.observers[event]) this.observers[event] = /* @__PURE__ */ new Map();
226
- const numListeners = this.observers[event].get(listener) || 0;
227
- this.observers[event].set(listener, numListeners + 1);
228
- });
229
- return this;
230
- }
231
- off(event, listener) {
232
- if (!this.observers[event]) return;
233
- if (!listener) {
234
- delete this.observers[event];
235
- return;
236
- }
237
- this.observers[event].delete(listener);
238
- }
239
- emit(event, ...args) {
240
- if (this.observers[event]) Array.from(this.observers[event].entries()).forEach(([observer, numTimesAdded]) => {
241
- for (let i = 0; i < numTimesAdded; i++) observer(...args);
242
- });
243
- if (this.observers["*"]) Array.from(this.observers["*"].entries()).forEach(([observer, numTimesAdded]) => {
244
- for (let i = 0; i < numTimesAdded; i++) observer.apply(observer, [event, ...args]);
245
- });
246
- }
247
- };
248
- var ResourceStore = class extends EventEmitter {
249
- constructor(data, options = {
250
- ns: ["translation"],
251
- defaultNS: "translation"
252
- }) {
253
- super();
254
- this.data = data || {};
255
- this.options = options;
256
- if (this.options.keySeparator === void 0) this.options.keySeparator = ".";
257
- if (this.options.ignoreJSONStructure === void 0) this.options.ignoreJSONStructure = true;
258
- }
259
- addNamespaces(ns) {
260
- if (this.options.ns.indexOf(ns) < 0) this.options.ns.push(ns);
261
- }
262
- removeNamespaces(ns) {
263
- const index = this.options.ns.indexOf(ns);
264
- if (index > -1) this.options.ns.splice(index, 1);
265
- }
266
- getResource(lng, ns, key, options = {}) {
267
- const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
268
- const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
269
- let path;
270
- if (lng.indexOf(".") > -1) path = lng.split(".");
271
- else {
272
- path = [lng, ns];
273
- if (key) if (Array.isArray(key)) path.push(...key);
274
- else if (isString(key) && keySeparator) path.push(...key.split(keySeparator));
275
- else path.push(key);
276
- }
277
- const result = getPath(this.data, path);
278
- if (!result && !ns && !key && lng.indexOf(".") > -1) {
279
- lng = path[0];
280
- ns = path[1];
281
- key = path.slice(2).join(".");
282
- }
283
- if (result || !ignoreJSONStructure || !isString(key)) return result;
284
- return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
285
- }
286
- addResource(lng, ns, key, value, options = { silent: false }) {
287
- const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
288
- let path = [lng, ns];
289
- if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
290
- if (lng.indexOf(".") > -1) {
291
- path = lng.split(".");
292
- value = ns;
293
- ns = path[1];
294
- }
295
- this.addNamespaces(ns);
296
- setPath(this.data, path, value);
297
- if (!options.silent) this.emit("added", lng, ns, key, value);
298
- }
299
- addResources(lng, ns, resources, options = { silent: false }) {
300
- for (const m in resources) if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], { silent: true });
301
- if (!options.silent) this.emit("added", lng, ns, resources);
302
- }
303
- addResourceBundle(lng, ns, resources, deep, overwrite, options = {
304
- silent: false,
305
- skipCopy: false
306
- }) {
307
- let path = [lng, ns];
308
- if (lng.indexOf(".") > -1) {
309
- path = lng.split(".");
310
- deep = resources;
311
- resources = ns;
312
- ns = path[1];
313
- }
314
- this.addNamespaces(ns);
315
- let pack = getPath(this.data, path) || {};
316
- if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
317
- if (deep) deepExtend(pack, resources, overwrite);
318
- else pack = {
319
- ...pack,
320
- ...resources
321
- };
322
- setPath(this.data, path, pack);
323
- if (!options.silent) this.emit("added", lng, ns, resources);
324
- }
325
- removeResourceBundle(lng, ns) {
326
- if (this.hasResourceBundle(lng, ns)) delete this.data[lng][ns];
327
- this.removeNamespaces(ns);
328
- this.emit("removed", lng, ns);
329
- }
330
- hasResourceBundle(lng, ns) {
331
- return this.getResource(lng, ns) !== void 0;
332
- }
333
- getResourceBundle(lng, ns) {
334
- if (!ns) ns = this.options.defaultNS;
335
- return this.getResource(lng, ns);
336
- }
337
- getDataByLanguage(lng) {
338
- return this.data[lng];
339
- }
340
- hasLanguageSomeTranslations(lng) {
341
- const data = this.getDataByLanguage(lng);
342
- return !!(data && Object.keys(data) || []).find((v) => data[v] && Object.keys(data[v]).length > 0);
343
- }
344
- toJSON() {
345
- return this.data;
346
- }
347
- };
348
- var postProcessor = {
349
- processors: {},
350
- addPostProcessor(module) {
351
- this.processors[module.name] = module;
352
- },
353
- handle(processors, value, key, options, translator) {
354
- processors.forEach((processor) => {
355
- value = this.processors[processor]?.process(value, key, options, translator) ?? value;
356
- });
357
- return value;
358
- }
359
- };
360
- var PATH_KEY = Symbol("i18next/PATH_KEY");
361
- function createProxy() {
362
- const state = [];
363
- const handler = Object.create(null);
364
- let proxy;
365
- handler.get = (target, key) => {
366
- proxy?.revoke?.();
367
- if (key === PATH_KEY) return state;
368
- state.push(key);
369
- proxy = Proxy.revocable(target, handler);
370
- return proxy.proxy;
371
- };
372
- return Proxy.revocable(Object.create(null), handler).proxy;
373
- }
374
- function keysFromSelector(selector, opts) {
375
- const { [PATH_KEY]: path } = selector(createProxy());
376
- return path.join(opts?.keySeparator ?? ".");
377
- }
378
- var checkedLoadedFor = {};
379
- var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
380
- var Translator = class Translator extends EventEmitter {
381
- constructor(services, options = {}) {
382
- super();
383
- copy([
384
- "resourceStore",
385
- "languageUtils",
386
- "pluralResolver",
387
- "interpolator",
388
- "backendConnector",
389
- "i18nFormat",
390
- "utils"
391
- ], services, this);
392
- this.options = options;
393
- if (this.options.keySeparator === void 0) this.options.keySeparator = ".";
394
- this.logger = baseLogger.create("translator");
395
- }
396
- changeLanguage(lng) {
397
- if (lng) this.language = lng;
398
- }
399
- exists(key, o = { interpolation: {} }) {
400
- const opt = { ...o };
401
- if (key == null) return false;
402
- const resolved = this.resolve(key, opt);
403
- if (resolved?.res === void 0) return false;
404
- const isObject = shouldHandleAsObject(resolved.res);
405
- if (opt.returnObjects === false && isObject) return false;
406
- return true;
407
- }
408
- extractFromKey(key, opt) {
409
- let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
410
- if (nsSeparator === void 0) nsSeparator = ":";
411
- const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
412
- let namespaces = opt.ns || this.options.defaultNS || [];
413
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
414
- const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
415
- if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
416
- const m = key.match(this.interpolator.nestingRegexp);
417
- if (m && m.length > 0) return {
418
- key,
419
- namespaces: isString(namespaces) ? [namespaces] : namespaces
420
- };
421
- const parts = key.split(nsSeparator);
422
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
423
- key = parts.join(keySeparator);
424
- }
425
- return {
426
- key,
427
- namespaces: isString(namespaces) ? [namespaces] : namespaces
428
- };
429
- }
430
- translate(keys, o, lastKey) {
431
- let opt = typeof o === "object" ? { ...o } : o;
432
- if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) opt = this.options.overloadTranslationOptionHandler(arguments);
433
- if (typeof opt === "object") opt = { ...opt };
434
- if (!opt) opt = {};
435
- if (keys == null) return "";
436
- if (typeof keys === "function") keys = keysFromSelector(keys, {
437
- ...this.options,
438
- ...opt
439
- });
440
- if (!Array.isArray(keys)) keys = [String(keys)];
441
- const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
442
- const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
443
- const { key, namespaces } = this.extractFromKey(keys[keys.length - 1], opt);
444
- const namespace = namespaces[namespaces.length - 1];
445
- let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
446
- if (nsSeparator === void 0) nsSeparator = ":";
447
- const lng = opt.lng || this.language;
448
- const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
449
- if (lng?.toLowerCase() === "cimode") {
450
- if (appendNamespaceToCIMode) {
451
- if (returnDetails) return {
452
- res: `${namespace}${nsSeparator}${key}`,
453
- usedKey: key,
454
- exactUsedKey: key,
455
- usedLng: lng,
456
- usedNS: namespace,
457
- usedParams: this.getUsedParamsDetails(opt)
458
- };
459
- return `${namespace}${nsSeparator}${key}`;
460
- }
461
- if (returnDetails) return {
462
- res: key,
463
- usedKey: key,
464
- exactUsedKey: key,
465
- usedLng: lng,
466
- usedNS: namespace,
467
- usedParams: this.getUsedParamsDetails(opt)
468
- };
469
- return key;
470
- }
471
- const resolved = this.resolve(keys, opt);
472
- let res = resolved?.res;
473
- const resUsedKey = resolved?.usedKey || key;
474
- const resExactUsedKey = resolved?.exactUsedKey || key;
475
- const noObject = [
476
- "[object Number]",
477
- "[object Function]",
478
- "[object RegExp]"
479
- ];
480
- const joinArrays = opt.joinArrays !== void 0 ? opt.joinArrays : this.options.joinArrays;
481
- const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
482
- const needsPluralHandling = opt.count !== void 0 && !isString(opt.count);
483
- const hasDefaultValue = Translator.hasDefaultValue(opt);
484
- const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : "";
485
- const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, { ordinal: false }) : "";
486
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
487
- const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
488
- let resForObjHndl = res;
489
- if (handleAsObjectInI18nFormat && !res && hasDefaultValue) resForObjHndl = defaultValue;
490
- const handleAsObject = shouldHandleAsObject(resForObjHndl);
491
- const resType = Object.prototype.toString.apply(resForObjHndl);
492
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
493
- if (!opt.returnObjects && !this.options.returnObjects) {
494
- if (!this.options.returnedObjectHandler) this.logger.warn("accessing an object - but returnObjects options is not enabled!");
495
- const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
496
- ...opt,
497
- ns: namespaces
498
- }) : `key '${key} (${this.language})' returned an object instead of string.`;
499
- if (returnDetails) {
500
- resolved.res = r;
501
- resolved.usedParams = this.getUsedParamsDetails(opt);
502
- return resolved;
503
- }
504
- return r;
505
- }
506
- if (keySeparator) {
507
- const resTypeIsArray = Array.isArray(resForObjHndl);
508
- const copy = resTypeIsArray ? [] : {};
509
- const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
510
- for (const m in resForObjHndl) if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
511
- const deepKey = `${newKeyToUse}${keySeparator}${m}`;
512
- if (hasDefaultValue && !res) copy[m] = this.translate(deepKey, {
513
- ...opt,
514
- defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : void 0,
515
- joinArrays: false,
516
- ns: namespaces
517
- });
518
- else copy[m] = this.translate(deepKey, {
519
- ...opt,
520
- joinArrays: false,
521
- ns: namespaces
522
- });
523
- if (copy[m] === deepKey) copy[m] = resForObjHndl[m];
524
- }
525
- res = copy;
526
- }
527
- } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
528
- res = res.join(joinArrays);
529
- if (res) res = this.extendTranslation(res, keys, opt, lastKey);
530
- } else {
531
- let usedDefault = false;
532
- let usedKey = false;
533
- if (!this.isValidLookup(res) && hasDefaultValue) {
534
- usedDefault = true;
535
- res = defaultValue;
536
- }
537
- if (!this.isValidLookup(res)) {
538
- usedKey = true;
539
- res = key;
540
- }
541
- const resForMissing = (opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && usedKey ? void 0 : res;
542
- const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
543
- if (usedKey || usedDefault || updateMissing) {
544
- this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue : res);
545
- if (keySeparator) {
546
- const fk = this.resolve(key, {
547
- ...opt,
548
- keySeparator: false
549
- });
550
- if (fk && fk.res) this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
551
- }
552
- let lngs = [];
553
- const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
554
- if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) for (let i = 0; i < fallbackLngs.length; i++) lngs.push(fallbackLngs[i]);
555
- else if (this.options.saveMissingTo === "all") lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
556
- else lngs.push(opt.lng || this.language);
557
- const send = (l, k, specificDefaultValue) => {
558
- const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
559
- if (this.options.missingKeyHandler) this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
560
- else if (this.backendConnector?.saveMissing) this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
561
- this.emit("missingKey", l, namespace, k, res);
562
- };
563
- if (this.options.saveMissing) if (this.options.saveMissingPlurals && needsPluralHandling) lngs.forEach((language) => {
564
- const suffixes = this.pluralResolver.getSuffixes(language, opt);
565
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) suffixes.push(`${this.options.pluralSeparator}zero`);
566
- suffixes.forEach((suffix) => {
567
- send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
568
- });
569
- });
570
- else send(lngs, key, defaultValue);
571
- }
572
- res = this.extendTranslation(res, keys, opt, resolved, lastKey);
573
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}${nsSeparator}${key}`;
574
- if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : void 0, opt);
575
- }
576
- if (returnDetails) {
577
- resolved.res = res;
578
- resolved.usedParams = this.getUsedParamsDetails(opt);
579
- return resolved;
580
- }
581
- return res;
582
- }
583
- extendTranslation(res, key, opt, resolved, lastKey) {
584
- if (this.i18nFormat?.parse) res = this.i18nFormat.parse(res, {
585
- ...this.options.interpolation.defaultVariables,
586
- ...opt
587
- }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, { resolved });
588
- else if (!opt.skipInterpolation) {
589
- if (opt.interpolation) this.interpolator.init({
590
- ...opt,
591
- interpolation: {
592
- ...this.options.interpolation,
593
- ...opt.interpolation
594
- }
595
- });
596
- const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
597
- let nestBef;
598
- if (skipOnVariables) {
599
- const nb = res.match(this.interpolator.nestingRegexp);
600
- nestBef = nb && nb.length;
601
- }
602
- let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
603
- if (this.options.interpolation.defaultVariables) data = {
604
- ...this.options.interpolation.defaultVariables,
605
- ...data
606
- };
607
- res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
608
- if (skipOnVariables) {
609
- const na = res.match(this.interpolator.nestingRegexp);
610
- const nestAft = na && na.length;
611
- if (nestBef < nestAft) opt.nest = false;
612
- }
613
- if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
614
- if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
615
- if (lastKey?.[0] === args[0] && !opt.context) {
616
- this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
617
- return null;
618
- }
619
- return this.translate(...args, key);
620
- }, opt);
621
- if (opt.interpolation) this.interpolator.reset();
622
- }
623
- const postProcess = opt.postProcess || this.options.postProcess;
624
- const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
625
- if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
626
- i18nResolved: {
627
- ...resolved,
628
- usedParams: this.getUsedParamsDetails(opt)
629
- },
630
- ...opt
631
- } : opt, this);
632
- return res;
633
- }
634
- resolve(keys, opt = {}) {
635
- let found;
636
- let usedKey;
637
- let exactUsedKey;
638
- let usedLng;
639
- let usedNS;
640
- if (isString(keys)) keys = [keys];
641
- keys.forEach((k) => {
642
- if (this.isValidLookup(found)) return;
643
- const extracted = this.extractFromKey(k, opt);
644
- const key = extracted.key;
645
- usedKey = key;
646
- let namespaces = extracted.namespaces;
647
- if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
648
- const needsPluralHandling = opt.count !== void 0 && !isString(opt.count);
649
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
650
- const needsContextHandling = opt.context !== void 0 && (isString(opt.context) || typeof opt.context === "number") && opt.context !== "";
651
- const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
652
- namespaces.forEach((ns) => {
653
- if (this.isValidLookup(found)) return;
654
- usedNS = ns;
655
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
656
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
657
- this.logger.warn(`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
658
- }
659
- codes.forEach((code) => {
660
- if (this.isValidLookup(found)) return;
661
- usedLng = code;
662
- const finalKeys = [key];
663
- if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
664
- else {
665
- let pluralSuffix;
666
- if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
667
- const zeroSuffix = `${this.options.pluralSeparator}zero`;
668
- const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
669
- if (needsPluralHandling) {
670
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
671
- finalKeys.push(key + pluralSuffix);
672
- if (needsZeroSuffixLookup) finalKeys.push(key + zeroSuffix);
673
- }
674
- if (needsContextHandling) {
675
- const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
676
- finalKeys.push(contextKey);
677
- if (needsPluralHandling) {
678
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
679
- finalKeys.push(contextKey + pluralSuffix);
680
- if (needsZeroSuffixLookup) finalKeys.push(contextKey + zeroSuffix);
681
- }
682
- }
683
- }
684
- let possibleKey;
685
- while (possibleKey = finalKeys.pop()) if (!this.isValidLookup(found)) {
686
- exactUsedKey = possibleKey;
687
- found = this.getResource(code, ns, possibleKey, opt);
688
- }
689
- });
690
- });
691
- });
692
- return {
693
- res: found,
694
- usedKey,
695
- exactUsedKey,
696
- usedLng,
697
- usedNS
698
- };
699
- }
700
- isValidLookup(res) {
701
- return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
702
- }
703
- getResource(code, ns, key, options = {}) {
704
- if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
705
- return this.resourceStore.getResource(code, ns, key, options);
706
- }
707
- getUsedParamsDetails(options = {}) {
708
- const optionsKeys = [
709
- "defaultValue",
710
- "ordinal",
711
- "context",
712
- "replace",
713
- "lng",
714
- "lngs",
715
- "fallbackLng",
716
- "ns",
717
- "keySeparator",
718
- "nsSeparator",
719
- "returnObjects",
720
- "returnDetails",
721
- "joinArrays",
722
- "postProcess",
723
- "interpolation"
724
- ];
725
- const useOptionsReplaceForData = options.replace && !isString(options.replace);
726
- let data = useOptionsReplaceForData ? options.replace : options;
727
- if (useOptionsReplaceForData && typeof options.count !== "undefined") data.count = options.count;
728
- if (this.options.interpolation.defaultVariables) data = {
729
- ...this.options.interpolation.defaultVariables,
730
- ...data
731
- };
732
- if (!useOptionsReplaceForData) {
733
- data = { ...data };
734
- for (const key of optionsKeys) delete data[key];
735
- }
736
- return data;
737
- }
738
- static hasDefaultValue(options) {
739
- const prefix = "defaultValue";
740
- for (const option in options) if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, 12) && void 0 !== options[option]) return true;
741
- return false;
742
- }
743
- };
744
- var LanguageUtil = class {
745
- constructor(options) {
746
- this.options = options;
747
- this.supportedLngs = this.options.supportedLngs || false;
748
- this.logger = baseLogger.create("languageUtils");
749
- }
750
- getScriptPartFromCode(code) {
751
- code = getCleanedCode(code);
752
- if (!code || code.indexOf("-") < 0) return null;
753
- const p = code.split("-");
754
- if (p.length === 2) return null;
755
- p.pop();
756
- if (p[p.length - 1].toLowerCase() === "x") return null;
757
- return this.formatLanguageCode(p.join("-"));
758
- }
759
- getLanguagePartFromCode(code) {
760
- code = getCleanedCode(code);
761
- if (!code || code.indexOf("-") < 0) return code;
762
- const p = code.split("-");
763
- return this.formatLanguageCode(p[0]);
764
- }
765
- formatLanguageCode(code) {
766
- if (isString(code) && code.indexOf("-") > -1) {
767
- let formattedCode;
768
- try {
769
- formattedCode = Intl.getCanonicalLocales(code)[0];
770
- } catch (e) {}
771
- if (formattedCode && this.options.lowerCaseLng) formattedCode = formattedCode.toLowerCase();
772
- if (formattedCode) return formattedCode;
773
- if (this.options.lowerCaseLng) return code.toLowerCase();
774
- return code;
775
- }
776
- return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
777
- }
778
- isSupportedCode(code) {
779
- if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) code = this.getLanguagePartFromCode(code);
780
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
781
- }
782
- getBestMatchFromCodes(codes) {
783
- if (!codes) return null;
784
- let found;
785
- codes.forEach((code) => {
786
- if (found) return;
787
- const cleanedLng = this.formatLanguageCode(code);
788
- if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
789
- });
790
- if (!found && this.options.supportedLngs) codes.forEach((code) => {
791
- if (found) return;
792
- const lngScOnly = this.getScriptPartFromCode(code);
793
- if (this.isSupportedCode(lngScOnly)) return found = lngScOnly;
794
- const lngOnly = this.getLanguagePartFromCode(code);
795
- if (this.isSupportedCode(lngOnly)) return found = lngOnly;
796
- found = this.options.supportedLngs.find((supportedLng) => {
797
- if (supportedLng === lngOnly) return supportedLng;
798
- if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0) return;
799
- if (supportedLng.indexOf("-") > 0 && lngOnly.indexOf("-") < 0 && supportedLng.substring(0, supportedLng.indexOf("-")) === lngOnly) return supportedLng;
800
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
801
- });
802
- });
803
- if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
804
- return found;
805
- }
806
- getFallbackCodes(fallbacks, code) {
807
- if (!fallbacks) return [];
808
- if (typeof fallbacks === "function") fallbacks = fallbacks(code);
809
- if (isString(fallbacks)) fallbacks = [fallbacks];
810
- if (Array.isArray(fallbacks)) return fallbacks;
811
- if (!code) return fallbacks.default || [];
812
- let found = fallbacks[code];
813
- if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
814
- if (!found) found = fallbacks[this.formatLanguageCode(code)];
815
- if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
816
- if (!found) found = fallbacks.default;
817
- return found || [];
818
- }
819
- toResolveHierarchy(code, fallbackCode) {
820
- const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
821
- const codes = [];
822
- const addCode = (c) => {
823
- if (!c) return;
824
- if (this.isSupportedCode(c)) codes.push(c);
825
- else this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
826
- };
827
- if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
828
- if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
829
- if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
830
- if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
831
- } else if (isString(code)) addCode(this.formatLanguageCode(code));
832
- fallbackCodes.forEach((fc) => {
833
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
834
- });
835
- return codes;
836
- }
837
- };
838
- var suffixesOrder = {
839
- zero: 0,
840
- one: 1,
841
- two: 2,
842
- few: 3,
843
- many: 4,
844
- other: 5
845
- };
846
- var dummyRule = {
847
- select: (count) => count === 1 ? "one" : "other",
848
- resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
849
- };
850
- var PluralResolver = class {
851
- constructor(languageUtils, options = {}) {
852
- this.languageUtils = languageUtils;
853
- this.options = options;
854
- this.logger = baseLogger.create("pluralResolver");
855
- this.pluralRulesCache = {};
856
- }
857
- addRule(lng, obj) {
858
- this.rules[lng] = obj;
859
- }
860
- clearCache() {
861
- this.pluralRulesCache = {};
862
- }
863
- getRule(code, options = {}) {
864
- const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
865
- const type = options.ordinal ? "ordinal" : "cardinal";
866
- const cacheKey = JSON.stringify({
867
- cleanedCode,
868
- type
869
- });
870
- if (cacheKey in this.pluralRulesCache) return this.pluralRulesCache[cacheKey];
871
- let rule;
872
- try {
873
- rule = new Intl.PluralRules(cleanedCode, { type });
874
- } catch (err) {
875
- if (!Intl) {
876
- this.logger.error("No Intl support, please use an Intl polyfill!");
877
- return dummyRule;
878
- }
879
- if (!code.match(/-|_/)) return dummyRule;
880
- const lngPart = this.languageUtils.getLanguagePartFromCode(code);
881
- rule = this.getRule(lngPart, options);
882
- }
883
- this.pluralRulesCache[cacheKey] = rule;
884
- return rule;
885
- }
886
- needsPlural(code, options = {}) {
887
- let rule = this.getRule(code, options);
888
- if (!rule) rule = this.getRule("dev", options);
889
- return rule?.resolvedOptions().pluralCategories.length > 1;
890
- }
891
- getPluralFormsOfKey(code, key, options = {}) {
892
- return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
893
- }
894
- getSuffixes(code, options = {}) {
895
- let rule = this.getRule(code, options);
896
- if (!rule) rule = this.getRule("dev", options);
897
- if (!rule) return [];
898
- return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
899
- }
900
- getSuffix(code, count, options = {}) {
901
- const rule = this.getRule(code, options);
902
- if (rule) return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
903
- this.logger.warn(`no plural rule found for: ${code}`);
904
- return this.getSuffix("dev", count, options);
905
- }
906
- };
907
- var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
908
- let path = getPathWithDefaults(data, defaultData, key);
909
- if (!path && ignoreJSONStructure && isString(key)) {
910
- path = deepFind(data, key, keySeparator);
911
- if (path === void 0) path = deepFind(defaultData, key, keySeparator);
912
- }
913
- return path;
914
- };
915
- var regexSafe = (val) => val.replace(/\$/g, "$$$$");
916
- var Interpolator = class {
917
- constructor(options = {}) {
918
- this.logger = baseLogger.create("interpolator");
919
- this.options = options;
920
- this.format = options?.interpolation?.format || ((value) => value);
921
- this.init(options);
922
- }
923
- init(options = {}) {
924
- if (!options.interpolation) options.interpolation = { escapeValue: true };
925
- const { escape: escape$1, escapeValue, useRawValueToEscape, prefix, prefixEscaped, suffix, suffixEscaped, formatSeparator, unescapeSuffix, unescapePrefix, nestingPrefix, nestingPrefixEscaped, nestingSuffix, nestingSuffixEscaped, nestingOptionsSeparator, maxReplaces, alwaysFormat } = options.interpolation;
926
- this.escape = escape$1 !== void 0 ? escape$1 : escape;
927
- this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
928
- this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
929
- this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || "{{";
930
- this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || "}}";
931
- this.formatSeparator = formatSeparator || ",";
932
- this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix || "-";
933
- this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix || "";
934
- this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape("$t(");
935
- this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(")");
936
- this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
937
- this.maxReplaces = maxReplaces || 1e3;
938
- this.alwaysFormat = alwaysFormat !== void 0 ? alwaysFormat : false;
939
- this.resetRegExp();
940
- }
941
- reset() {
942
- if (this.options) this.init(this.options);
943
- }
944
- resetRegExp() {
945
- const getOrResetRegExp = (existingRegExp, pattern) => {
946
- if (existingRegExp?.source === pattern) {
947
- existingRegExp.lastIndex = 0;
948
- return existingRegExp;
949
- }
950
- return new RegExp(pattern, "g");
951
- };
952
- this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
953
- this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
954
- this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
955
- }
956
- interpolate(str, data, lng, options) {
957
- let match;
958
- let value;
959
- let replaces;
960
- const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
961
- const handleFormat = (key) => {
962
- if (key.indexOf(this.formatSeparator) < 0) {
963
- const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
964
- return this.alwaysFormat ? this.format(path, void 0, lng, {
965
- ...options,
966
- ...data,
967
- interpolationkey: key
968
- }) : path;
969
- }
970
- const p = key.split(this.formatSeparator);
971
- const k = p.shift().trim();
972
- const f = p.join(this.formatSeparator).trim();
973
- return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
974
- ...options,
975
- ...data,
976
- interpolationkey: k
977
- });
978
- };
979
- this.resetRegExp();
980
- const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
981
- const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
982
- [{
983
- regex: this.regexpUnescape,
984
- safeValue: (val) => regexSafe(val)
985
- }, {
986
- regex: this.regexp,
987
- safeValue: (val) => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
988
- }].forEach((todo) => {
989
- replaces = 0;
990
- while (match = todo.regex.exec(str)) {
991
- const matchedVar = match[1].trim();
992
- value = handleFormat(matchedVar);
993
- if (value === void 0) if (typeof missingInterpolationHandler === "function") {
994
- const temp = missingInterpolationHandler(str, match, options);
995
- value = isString(temp) ? temp : "";
996
- } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) value = "";
997
- else if (skipOnVariables) {
998
- value = match[0];
999
- continue;
1000
- } else {
1001
- this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
1002
- value = "";
1003
- }
1004
- else if (!isString(value) && !this.useRawValueToEscape) value = makeString(value);
1005
- const safeValue = todo.safeValue(value);
1006
- str = str.replace(match[0], safeValue);
1007
- if (skipOnVariables) {
1008
- todo.regex.lastIndex += value.length;
1009
- todo.regex.lastIndex -= match[0].length;
1010
- } else todo.regex.lastIndex = 0;
1011
- replaces++;
1012
- if (replaces >= this.maxReplaces) break;
1013
- }
1014
- });
1015
- return str;
1016
- }
1017
- nest(str, fc, options = {}) {
1018
- let match;
1019
- let value;
1020
- let clonedOptions;
1021
- const handleHasOptions = (key, inheritedOptions) => {
1022
- const sep = this.nestingOptionsSeparator;
1023
- if (key.indexOf(sep) < 0) return key;
1024
- const c = key.split(new RegExp(`${sep}[ ]*{`));
1025
- let optionsString = `{${c[1]}`;
1026
- key = c[0];
1027
- optionsString = this.interpolate(optionsString, clonedOptions);
1028
- const matchedSingleQuotes = optionsString.match(/'/g);
1029
- const matchedDoubleQuotes = optionsString.match(/"/g);
1030
- if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) optionsString = optionsString.replace(/'/g, "\"");
1031
- try {
1032
- clonedOptions = JSON.parse(optionsString);
1033
- if (inheritedOptions) clonedOptions = {
1034
- ...inheritedOptions,
1035
- ...clonedOptions
1036
- };
1037
- } catch (e) {
1038
- this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
1039
- return `${key}${sep}${optionsString}`;
1040
- }
1041
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
1042
- return key;
1043
- };
1044
- while (match = this.nestingRegexp.exec(str)) {
1045
- let formatters = [];
1046
- clonedOptions = { ...options };
1047
- clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
1048
- clonedOptions.applyPostProcessor = false;
1049
- delete clonedOptions.defaultValue;
1050
- const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf("}") + 1 : match[1].indexOf(this.formatSeparator);
1051
- if (keyEndIndex !== -1) {
1052
- formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
1053
- match[1] = match[1].slice(0, keyEndIndex);
1054
- }
1055
- value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1056
- if (value && match[0] === str && !isString(value)) return value;
1057
- if (!isString(value)) value = makeString(value);
1058
- if (!value) {
1059
- this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
1060
- value = "";
1061
- }
1062
- if (formatters.length) value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
1063
- ...options,
1064
- interpolationkey: match[1].trim()
1065
- }), value.trim());
1066
- str = str.replace(match[0], value);
1067
- this.regexp.lastIndex = 0;
1068
- }
1069
- return str;
1070
- }
1071
- };
1072
- var parseFormatStr = (formatStr) => {
1073
- let formatName = formatStr.toLowerCase().trim();
1074
- const formatOptions = {};
1075
- if (formatStr.indexOf("(") > -1) {
1076
- const p = formatStr.split("(");
1077
- formatName = p[0].toLowerCase().trim();
1078
- const optStr = p[1].substring(0, p[1].length - 1);
1079
- if (formatName === "currency" && optStr.indexOf(":") < 0) {
1080
- if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1081
- } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
1082
- if (!formatOptions.range) formatOptions.range = optStr.trim();
1083
- } else optStr.split(";").forEach((opt) => {
1084
- if (opt) {
1085
- const [key, ...rest] = opt.split(":");
1086
- const val = rest.join(":").trim().replace(/^'+|'+$/g, "");
1087
- const trimmedKey = key.trim();
1088
- if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;
1089
- if (val === "false") formatOptions[trimmedKey] = false;
1090
- if (val === "true") formatOptions[trimmedKey] = true;
1091
- if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);
1092
- }
1093
- });
1094
- }
1095
- return {
1096
- formatName,
1097
- formatOptions
1098
- };
1099
- };
1100
- var createCachedFormatter = (fn) => {
1101
- const cache = {};
1102
- return (v, l, o) => {
1103
- let optForCache = o;
1104
- if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) optForCache = {
1105
- ...optForCache,
1106
- [o.interpolationkey]: void 0
1107
- };
1108
- const key = l + JSON.stringify(optForCache);
1109
- let frm = cache[key];
1110
- if (!frm) {
1111
- frm = fn(getCleanedCode(l), o);
1112
- cache[key] = frm;
1113
- }
1114
- return frm(v);
1115
- };
1116
- };
1117
- var createNonCachedFormatter = (fn) => (v, l, o) => fn(getCleanedCode(l), o)(v);
1118
- var Formatter = class {
1119
- constructor(options = {}) {
1120
- this.logger = baseLogger.create("formatter");
1121
- this.options = options;
1122
- this.init(options);
1123
- }
1124
- init(services, options = { interpolation: {} }) {
1125
- this.formatSeparator = options.interpolation.formatSeparator || ",";
1126
- const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
1127
- this.formats = {
1128
- number: cf((lng, opt) => {
1129
- const formatter = new Intl.NumberFormat(lng, { ...opt });
1130
- return (val) => formatter.format(val);
1131
- }),
1132
- currency: cf((lng, opt) => {
1133
- const formatter = new Intl.NumberFormat(lng, {
1134
- ...opt,
1135
- style: "currency"
1136
- });
1137
- return (val) => formatter.format(val);
1138
- }),
1139
- datetime: cf((lng, opt) => {
1140
- const formatter = new Intl.DateTimeFormat(lng, { ...opt });
1141
- return (val) => formatter.format(val);
1142
- }),
1143
- relativetime: cf((lng, opt) => {
1144
- const formatter = new Intl.RelativeTimeFormat(lng, { ...opt });
1145
- return (val) => formatter.format(val, opt.range || "day");
1146
- }),
1147
- list: cf((lng, opt) => {
1148
- const formatter = new Intl.ListFormat(lng, { ...opt });
1149
- return (val) => formatter.format(val);
1150
- })
1151
- };
1152
- }
1153
- add(name, fc) {
1154
- this.formats[name.toLowerCase().trim()] = fc;
1155
- }
1156
- addCached(name, fc) {
1157
- this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1158
- }
1159
- format(value, format, lng, options = {}) {
1160
- const formats = format.split(this.formatSeparator);
1161
- if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f) => f.indexOf(")") > -1)) {
1162
- const lastIndex = formats.findIndex((f) => f.indexOf(")") > -1);
1163
- formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
1164
- }
1165
- return formats.reduce((mem, f) => {
1166
- const { formatName, formatOptions } = parseFormatStr(f);
1167
- if (this.formats[formatName]) {
1168
- let formatted = mem;
1169
- try {
1170
- const valOptions = options?.formatParams?.[options.interpolationkey] || {};
1171
- const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1172
- formatted = this.formats[formatName](mem, l, {
1173
- ...formatOptions,
1174
- ...options,
1175
- ...valOptions
1176
- });
1177
- } catch (error) {
1178
- this.logger.warn(error);
1179
- }
1180
- return formatted;
1181
- } else this.logger.warn(`there was no format function for ${formatName}`);
1182
- return mem;
1183
- }, value);
1184
- }
1185
- };
1186
- var removePending = (q, name) => {
1187
- if (q.pending[name] !== void 0) {
1188
- delete q.pending[name];
1189
- q.pendingCount--;
1190
- }
1191
- };
1192
- var Connector = class extends EventEmitter {
1193
- constructor(backend, store, services, options = {}) {
1194
- super();
1195
- this.backend = backend;
1196
- this.store = store;
1197
- this.services = services;
1198
- this.languageUtils = services.languageUtils;
1199
- this.options = options;
1200
- this.logger = baseLogger.create("backendConnector");
1201
- this.waitingReads = [];
1202
- this.maxParallelReads = options.maxParallelReads || 10;
1203
- this.readingCalls = 0;
1204
- this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
1205
- this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1206
- this.state = {};
1207
- this.queue = [];
1208
- this.backend?.init?.(services, options.backend, options);
1209
- }
1210
- queueLoad(languages, namespaces, options, callback) {
1211
- const toLoad = {};
1212
- const pending = {};
1213
- const toLoadLanguages = {};
1214
- const toLoadNamespaces = {};
1215
- languages.forEach((lng) => {
1216
- let hasAllNamespaces = true;
1217
- namespaces.forEach((ns) => {
1218
- const name = `${lng}|${ns}`;
1219
- if (!options.reload && this.store.hasResourceBundle(lng, ns)) this.state[name] = 2;
1220
- else if (this.state[name] < 0);
1221
- else if (this.state[name] === 1) {
1222
- if (pending[name] === void 0) pending[name] = true;
1223
- } else {
1224
- this.state[name] = 1;
1225
- hasAllNamespaces = false;
1226
- if (pending[name] === void 0) pending[name] = true;
1227
- if (toLoad[name] === void 0) toLoad[name] = true;
1228
- if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true;
1229
- }
1230
- });
1231
- if (!hasAllNamespaces) toLoadLanguages[lng] = true;
1232
- });
1233
- if (Object.keys(toLoad).length || Object.keys(pending).length) this.queue.push({
1234
- pending,
1235
- pendingCount: Object.keys(pending).length,
1236
- loaded: {},
1237
- errors: [],
1238
- callback
1239
- });
1240
- return {
1241
- toLoad: Object.keys(toLoad),
1242
- pending: Object.keys(pending),
1243
- toLoadLanguages: Object.keys(toLoadLanguages),
1244
- toLoadNamespaces: Object.keys(toLoadNamespaces)
1245
- };
1246
- }
1247
- loaded(name, err, data) {
1248
- const s = name.split("|");
1249
- const lng = s[0];
1250
- const ns = s[1];
1251
- if (err) this.emit("failedLoading", lng, ns, err);
1252
- if (!err && data) this.store.addResourceBundle(lng, ns, data, void 0, void 0, { skipCopy: true });
1253
- this.state[name] = err ? -1 : 2;
1254
- if (err && data) this.state[name] = 0;
1255
- const loaded = {};
1256
- this.queue.forEach((q) => {
1257
- pushPath(q.loaded, [lng], ns);
1258
- removePending(q, name);
1259
- if (err) q.errors.push(err);
1260
- if (q.pendingCount === 0 && !q.done) {
1261
- Object.keys(q.loaded).forEach((l) => {
1262
- if (!loaded[l]) loaded[l] = {};
1263
- const loadedKeys = q.loaded[l];
1264
- if (loadedKeys.length) loadedKeys.forEach((n) => {
1265
- if (loaded[l][n] === void 0) loaded[l][n] = true;
1266
- });
1267
- });
1268
- q.done = true;
1269
- if (q.errors.length) q.callback(q.errors);
1270
- else q.callback();
1271
- }
1272
- });
1273
- this.emit("loaded", loaded);
1274
- this.queue = this.queue.filter((q) => !q.done);
1275
- }
1276
- read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
1277
- if (!lng.length) return callback(null, {});
1278
- if (this.readingCalls >= this.maxParallelReads) {
1279
- this.waitingReads.push({
1280
- lng,
1281
- ns,
1282
- fcName,
1283
- tried,
1284
- wait,
1285
- callback
1286
- });
1287
- return;
1288
- }
1289
- this.readingCalls++;
1290
- const resolver = (err, data) => {
1291
- this.readingCalls--;
1292
- if (this.waitingReads.length > 0) {
1293
- const next = this.waitingReads.shift();
1294
- this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
1295
- }
1296
- if (err && data && tried < this.maxRetries) {
1297
- setTimeout(() => {
1298
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
1299
- }, wait);
1300
- return;
1301
- }
1302
- callback(err, data);
1303
- };
1304
- const fc = this.backend[fcName].bind(this.backend);
1305
- if (fc.length === 2) {
1306
- try {
1307
- const r = fc(lng, ns);
1308
- if (r && typeof r.then === "function") r.then((data) => resolver(null, data)).catch(resolver);
1309
- else resolver(null, r);
1310
- } catch (err) {
1311
- resolver(err);
1312
- }
1313
- return;
1314
- }
1315
- return fc(lng, ns, resolver);
1316
- }
1317
- prepareLoading(languages, namespaces, options = {}, callback) {
1318
- if (!this.backend) {
1319
- this.logger.warn("No backend was added via i18next.use. Will not load resources.");
1320
- return callback && callback();
1321
- }
1322
- if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
1323
- if (isString(namespaces)) namespaces = [namespaces];
1324
- const toLoad = this.queueLoad(languages, namespaces, options, callback);
1325
- if (!toLoad.toLoad.length) {
1326
- if (!toLoad.pending.length) callback();
1327
- return null;
1328
- }
1329
- toLoad.toLoad.forEach((name) => {
1330
- this.loadOne(name);
1331
- });
1332
- }
1333
- load(languages, namespaces, callback) {
1334
- this.prepareLoading(languages, namespaces, {}, callback);
1335
- }
1336
- reload(languages, namespaces, callback) {
1337
- this.prepareLoading(languages, namespaces, { reload: true }, callback);
1338
- }
1339
- loadOne(name, prefix = "") {
1340
- const s = name.split("|");
1341
- const lng = s[0];
1342
- const ns = s[1];
1343
- this.read(lng, ns, "read", void 0, void 0, (err, data) => {
1344
- if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
1345
- if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
1346
- this.loaded(name, err, data);
1347
- });
1348
- }
1349
- saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
1350
- if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
1351
- this.logger.warn(`did not save key "${key}" as the namespace "${namespace}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1352
- return;
1353
- }
1354
- if (key === void 0 || key === null || key === "") return;
1355
- if (this.backend?.create) {
1356
- const opts = {
1357
- ...options,
1358
- isUpdate
1359
- };
1360
- const fc = this.backend.create.bind(this.backend);
1361
- if (fc.length < 6) try {
1362
- let r;
1363
- if (fc.length === 5) r = fc(languages, namespace, key, fallbackValue, opts);
1364
- else r = fc(languages, namespace, key, fallbackValue);
1365
- if (r && typeof r.then === "function") r.then((data) => clb(null, data)).catch(clb);
1366
- else clb(null, r);
1367
- } catch (err) {
1368
- clb(err);
1369
- }
1370
- else fc(languages, namespace, key, fallbackValue, clb, opts);
1371
- }
1372
- if (!languages || !languages[0]) return;
1373
- this.store.addResource(languages[0], namespace, key, fallbackValue);
1374
- }
1375
- };
1376
- var get = () => ({
1377
- debug: false,
1378
- initAsync: true,
1379
- ns: ["translation"],
1380
- defaultNS: ["translation"],
1381
- fallbackLng: ["dev"],
1382
- fallbackNS: false,
1383
- supportedLngs: false,
1384
- nonExplicitSupportedLngs: false,
1385
- load: "all",
1386
- preload: false,
1387
- simplifyPluralSuffix: true,
1388
- keySeparator: ".",
1389
- nsSeparator: ":",
1390
- pluralSeparator: "_",
1391
- contextSeparator: "_",
1392
- partialBundledLanguages: false,
1393
- saveMissing: false,
1394
- updateMissing: false,
1395
- saveMissingTo: "fallback",
1396
- saveMissingPlurals: true,
1397
- missingKeyHandler: false,
1398
- missingInterpolationHandler: false,
1399
- postProcess: false,
1400
- postProcessPassResolved: false,
1401
- returnNull: false,
1402
- returnEmptyString: true,
1403
- returnObjects: false,
1404
- joinArrays: false,
1405
- returnedObjectHandler: false,
1406
- parseMissingKeyHandler: false,
1407
- appendNamespaceToMissingKey: false,
1408
- appendNamespaceToCIMode: false,
1409
- overloadTranslationOptionHandler: (args) => {
1410
- let ret = {};
1411
- if (typeof args[1] === "object") ret = args[1];
1412
- if (isString(args[1])) ret.defaultValue = args[1];
1413
- if (isString(args[2])) ret.tDescription = args[2];
1414
- if (typeof args[2] === "object" || typeof args[3] === "object") {
1415
- const options = args[3] || args[2];
1416
- Object.keys(options).forEach((key) => {
1417
- ret[key] = options[key];
1418
- });
1419
- }
1420
- return ret;
1421
- },
1422
- interpolation: {
1423
- escapeValue: true,
1424
- format: (value) => value,
1425
- prefix: "{{",
1426
- suffix: "}}",
1427
- formatSeparator: ",",
1428
- unescapePrefix: "-",
1429
- nestingPrefix: "$t(",
1430
- nestingSuffix: ")",
1431
- nestingOptionsSeparator: ",",
1432
- maxReplaces: 1e3,
1433
- skipOnVariables: true
1434
- },
1435
- cacheInBuiltFormats: true
1436
- });
1437
- var transformOptions = (options) => {
1438
- if (isString(options.ns)) options.ns = [options.ns];
1439
- if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
1440
- if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
1441
- if (options.supportedLngs?.indexOf?.("cimode") < 0) options.supportedLngs = options.supportedLngs.concat(["cimode"]);
1442
- if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
1443
- return options;
1444
- };
1445
- var noop = () => {};
1446
- var bindMemberFunctions = (inst) => {
1447
- Object.getOwnPropertyNames(Object.getPrototypeOf(inst)).forEach((mem) => {
1448
- if (typeof inst[mem] === "function") inst[mem] = inst[mem].bind(inst);
1449
- });
1450
- };
1451
- var instance = class I18n extends EventEmitter {
1452
- constructor(options = {}, callback) {
1453
- super();
1454
- this.options = transformOptions(options);
1455
- this.services = {};
1456
- this.logger = baseLogger;
1457
- this.modules = { external: [] };
1458
- bindMemberFunctions(this);
1459
- if (callback && !this.isInitialized && !options.isClone) {
1460
- if (!this.options.initAsync) {
1461
- this.init(options, callback);
1462
- return this;
1463
- }
1464
- setTimeout(() => {
1465
- this.init(options, callback);
1466
- }, 0);
1467
- }
1468
- }
1469
- init(options = {}, callback) {
1470
- this.isInitializing = true;
1471
- if (typeof options === "function") {
1472
- callback = options;
1473
- options = {};
1474
- }
1475
- if (options.defaultNS == null && options.ns) {
1476
- if (isString(options.ns)) options.defaultNS = options.ns;
1477
- else if (options.ns.indexOf("translation") < 0) options.defaultNS = options.ns[0];
1478
- }
1479
- const defOpts = get();
1480
- this.options = {
1481
- ...defOpts,
1482
- ...this.options,
1483
- ...transformOptions(options)
1484
- };
1485
- this.options.interpolation = {
1486
- ...defOpts.interpolation,
1487
- ...this.options.interpolation
1488
- };
1489
- if (options.keySeparator !== void 0) this.options.userDefinedKeySeparator = options.keySeparator;
1490
- if (options.nsSeparator !== void 0) this.options.userDefinedNsSeparator = options.nsSeparator;
1491
- const createClassOnDemand = (ClassOrObject) => {
1492
- if (!ClassOrObject) return null;
1493
- if (typeof ClassOrObject === "function") return new ClassOrObject();
1494
- return ClassOrObject;
1495
- };
1496
- if (!this.options.isClone) {
1497
- if (this.modules.logger) baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
1498
- else baseLogger.init(null, this.options);
1499
- let formatter;
1500
- if (this.modules.formatter) formatter = this.modules.formatter;
1501
- else formatter = Formatter;
1502
- const lu = new LanguageUtil(this.options);
1503
- this.store = new ResourceStore(this.options.resources, this.options);
1504
- const s = this.services;
1505
- s.logger = baseLogger;
1506
- s.resourceStore = this.store;
1507
- s.languageUtils = lu;
1508
- s.pluralResolver = new PluralResolver(lu, {
1509
- prepend: this.options.pluralSeparator,
1510
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1511
- });
1512
- if (this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format) this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
1513
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
1514
- s.formatter = createClassOnDemand(formatter);
1515
- if (s.formatter.init) s.formatter.init(s, this.options);
1516
- this.options.interpolation.format = s.formatter.format.bind(s.formatter);
1517
- }
1518
- s.interpolator = new Interpolator(this.options);
1519
- s.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) };
1520
- s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
1521
- s.backendConnector.on("*", (event, ...args) => {
1522
- this.emit(event, ...args);
1523
- });
1524
- if (this.modules.languageDetector) {
1525
- s.languageDetector = createClassOnDemand(this.modules.languageDetector);
1526
- if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
1527
- }
1528
- if (this.modules.i18nFormat) {
1529
- s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
1530
- if (s.i18nFormat.init) s.i18nFormat.init(this);
1531
- }
1532
- this.translator = new Translator(this.services, this.options);
1533
- this.translator.on("*", (event, ...args) => {
1534
- this.emit(event, ...args);
1535
- });
1536
- this.modules.external.forEach((m) => {
1537
- if (m.init) m.init(this);
1538
- });
1539
- }
1540
- this.format = this.options.interpolation.format;
1541
- if (!callback) callback = noop;
1542
- if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1543
- const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1544
- if (codes.length > 0 && codes[0] !== "dev") this.options.lng = codes[0];
1545
- }
1546
- if (!this.services.languageDetector && !this.options.lng) this.logger.warn("init: no languageDetector is used and no lng is defined");
1547
- [
1548
- "getResource",
1549
- "hasResourceBundle",
1550
- "getResourceBundle",
1551
- "getDataByLanguage"
1552
- ].forEach((fcName) => {
1553
- this[fcName] = (...args) => this.store[fcName](...args);
1554
- });
1555
- [
1556
- "addResource",
1557
- "addResources",
1558
- "addResourceBundle",
1559
- "removeResourceBundle"
1560
- ].forEach((fcName) => {
1561
- this[fcName] = (...args) => {
1562
- this.store[fcName](...args);
1563
- return this;
1564
- };
1565
- });
1566
- const deferred = defer();
1567
- const load = () => {
1568
- const finish = (err, t) => {
1569
- this.isInitializing = false;
1570
- if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
1571
- this.isInitialized = true;
1572
- if (!this.options.isClone) this.logger.log("initialized", this.options);
1573
- this.emit("initialized", this.options);
1574
- deferred.resolve(t);
1575
- callback(err, t);
1576
- };
1577
- if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
1578
- this.changeLanguage(this.options.lng, finish);
1579
- };
1580
- if (this.options.resources || !this.options.initAsync) load();
1581
- else setTimeout(load, 0);
1582
- return deferred;
1583
- }
1584
- loadResources(language, callback = noop) {
1585
- let usedCallback = callback;
1586
- const usedLng = isString(language) ? language : this.language;
1587
- if (typeof language === "function") usedCallback = language;
1588
- if (!this.options.resources || this.options.partialBundledLanguages) {
1589
- if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
1590
- const toLoad = [];
1591
- const append = (lng) => {
1592
- if (!lng) return;
1593
- if (lng === "cimode") return;
1594
- this.services.languageUtils.toResolveHierarchy(lng).forEach((l) => {
1595
- if (l === "cimode") return;
1596
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
1597
- });
1598
- };
1599
- if (!usedLng) this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => append(l));
1600
- else append(usedLng);
1601
- this.options.preload?.forEach?.((l) => append(l));
1602
- this.services.backendConnector.load(toLoad, this.options.ns, (e) => {
1603
- if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
1604
- usedCallback(e);
1605
- });
1606
- } else usedCallback(null);
1607
- }
1608
- reloadResources(lngs, ns, callback) {
1609
- const deferred = defer();
1610
- if (typeof lngs === "function") {
1611
- callback = lngs;
1612
- lngs = void 0;
1613
- }
1614
- if (typeof ns === "function") {
1615
- callback = ns;
1616
- ns = void 0;
1617
- }
1618
- if (!lngs) lngs = this.languages;
1619
- if (!ns) ns = this.options.ns;
1620
- if (!callback) callback = noop;
1621
- this.services.backendConnector.reload(lngs, ns, (err) => {
1622
- deferred.resolve();
1623
- callback(err);
1624
- });
1625
- return deferred;
1626
- }
1627
- use(module) {
1628
- if (!module) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1629
- if (!module.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1630
- if (module.type === "backend") this.modules.backend = module;
1631
- if (module.type === "logger" || module.log && module.warn && module.error) this.modules.logger = module;
1632
- if (module.type === "languageDetector") this.modules.languageDetector = module;
1633
- if (module.type === "i18nFormat") this.modules.i18nFormat = module;
1634
- if (module.type === "postProcessor") postProcessor.addPostProcessor(module);
1635
- if (module.type === "formatter") this.modules.formatter = module;
1636
- if (module.type === "3rdParty") this.modules.external.push(module);
1637
- return this;
1638
- }
1639
- setResolvedLanguage(l) {
1640
- if (!l || !this.languages) return;
1641
- if (["cimode", "dev"].indexOf(l) > -1) return;
1642
- for (let li = 0; li < this.languages.length; li++) {
1643
- const lngInLngs = this.languages[li];
1644
- if (["cimode", "dev"].indexOf(lngInLngs) > -1) continue;
1645
- if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
1646
- this.resolvedLanguage = lngInLngs;
1647
- break;
1648
- }
1649
- }
1650
- if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
1651
- this.resolvedLanguage = l;
1652
- this.languages.unshift(l);
1653
- }
1654
- }
1655
- changeLanguage(lng, callback) {
1656
- this.isLanguageChangingTo = lng;
1657
- const deferred = defer();
1658
- this.emit("languageChanging", lng);
1659
- const setLngProps = (l) => {
1660
- this.language = l;
1661
- this.languages = this.services.languageUtils.toResolveHierarchy(l);
1662
- this.resolvedLanguage = void 0;
1663
- this.setResolvedLanguage(l);
1664
- };
1665
- const done = (err, l) => {
1666
- if (l) {
1667
- if (this.isLanguageChangingTo === lng) {
1668
- setLngProps(l);
1669
- this.translator.changeLanguage(l);
1670
- this.isLanguageChangingTo = void 0;
1671
- this.emit("languageChanged", l);
1672
- this.logger.log("languageChanged", l);
1673
- }
1674
- } else this.isLanguageChangingTo = void 0;
1675
- deferred.resolve((...args) => this.t(...args));
1676
- if (callback) callback(err, (...args) => this.t(...args));
1677
- };
1678
- const setLng = (lngs) => {
1679
- if (!lng && !lngs && this.services.languageDetector) lngs = [];
1680
- const fl = isString(lngs) ? lngs : lngs && lngs[0];
1681
- const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
1682
- if (l) {
1683
- if (!this.language) setLngProps(l);
1684
- if (!this.translator.language) this.translator.changeLanguage(l);
1685
- this.services.languageDetector?.cacheUserLanguage?.(l);
1686
- }
1687
- this.loadResources(l, (err) => {
1688
- done(err, l);
1689
- });
1690
- };
1691
- if (!lng && this.services.languageDetector && !this.services.languageDetector.async) setLng(this.services.languageDetector.detect());
1692
- else if (!lng && this.services.languageDetector && this.services.languageDetector.async) if (this.services.languageDetector.detect.length === 0) this.services.languageDetector.detect().then(setLng);
1693
- else this.services.languageDetector.detect(setLng);
1694
- else setLng(lng);
1695
- return deferred;
1696
- }
1697
- getFixedT(lng, ns, keyPrefix) {
1698
- const fixedT = (key, opts, ...rest) => {
1699
- let o;
1700
- if (typeof opts !== "object") o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
1701
- else o = { ...opts };
1702
- o.lng = o.lng || fixedT.lng;
1703
- o.lngs = o.lngs || fixedT.lngs;
1704
- o.ns = o.ns || fixedT.ns;
1705
- if (o.keyPrefix !== "") o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
1706
- const keySeparator = this.options.keySeparator || ".";
1707
- let resultKey;
1708
- if (o.keyPrefix && Array.isArray(key)) resultKey = key.map((k) => {
1709
- if (typeof k === "function") k = keysFromSelector(k, {
1710
- ...this.options,
1711
- ...opts
1712
- });
1713
- return `${o.keyPrefix}${keySeparator}${k}`;
1714
- });
1715
- else {
1716
- if (typeof key === "function") key = keysFromSelector(key, {
1717
- ...this.options,
1718
- ...opts
1719
- });
1720
- resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
1721
- }
1722
- return this.t(resultKey, o);
1723
- };
1724
- if (isString(lng)) fixedT.lng = lng;
1725
- else fixedT.lngs = lng;
1726
- fixedT.ns = ns;
1727
- fixedT.keyPrefix = keyPrefix;
1728
- return fixedT;
1729
- }
1730
- t(...args) {
1731
- return this.translator?.translate(...args);
1732
- }
1733
- exists(...args) {
1734
- return this.translator?.exists(...args);
1735
- }
1736
- setDefaultNamespace(ns) {
1737
- this.options.defaultNS = ns;
1738
- }
1739
- hasLoadedNamespace(ns, options = {}) {
1740
- if (!this.isInitialized) {
1741
- this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
1742
- return false;
1743
- }
1744
- if (!this.languages || !this.languages.length) {
1745
- this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
1746
- return false;
1747
- }
1748
- const lng = options.lng || this.resolvedLanguage || this.languages[0];
1749
- const fallbackLng = this.options ? this.options.fallbackLng : false;
1750
- const lastLng = this.languages[this.languages.length - 1];
1751
- if (lng.toLowerCase() === "cimode") return true;
1752
- const loadNotPending = (l, n) => {
1753
- const loadState = this.services.backendConnector.state[`${l}|${n}`];
1754
- return loadState === -1 || loadState === 0 || loadState === 2;
1755
- };
1756
- if (options.precheck) {
1757
- const preResult = options.precheck(this, loadNotPending);
1758
- if (preResult !== void 0) return preResult;
1759
- }
1760
- if (this.hasResourceBundle(lng, ns)) return true;
1761
- if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
1762
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
1763
- return false;
1764
- }
1765
- loadNamespaces(ns, callback) {
1766
- const deferred = defer();
1767
- if (!this.options.ns) {
1768
- if (callback) callback();
1769
- return Promise.resolve();
1770
- }
1771
- if (isString(ns)) ns = [ns];
1772
- ns.forEach((n) => {
1773
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
1774
- });
1775
- this.loadResources((err) => {
1776
- deferred.resolve();
1777
- if (callback) callback(err);
1778
- });
1779
- return deferred;
1780
- }
1781
- loadLanguages(lngs, callback) {
1782
- const deferred = defer();
1783
- if (isString(lngs)) lngs = [lngs];
1784
- const preloaded = this.options.preload || [];
1785
- const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
1786
- if (!newLngs.length) {
1787
- if (callback) callback();
1788
- return Promise.resolve();
1789
- }
1790
- this.options.preload = preloaded.concat(newLngs);
1791
- this.loadResources((err) => {
1792
- deferred.resolve();
1793
- if (callback) callback(err);
1794
- });
1795
- return deferred;
1796
- }
1797
- dir(lng) {
1798
- if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
1799
- if (!lng) return "rtl";
1800
- try {
1801
- const l = new Intl.Locale(lng);
1802
- if (l && l.getTextInfo) {
1803
- const ti = l.getTextInfo();
1804
- if (ti && ti.direction) return ti.direction;
1805
- }
1806
- } catch (e) {}
1807
- const rtlLngs = [
1808
- "ar",
1809
- "shu",
1810
- "sqr",
1811
- "ssh",
1812
- "xaa",
1813
- "yhd",
1814
- "yud",
1815
- "aao",
1816
- "abh",
1817
- "abv",
1818
- "acm",
1819
- "acq",
1820
- "acw",
1821
- "acx",
1822
- "acy",
1823
- "adf",
1824
- "ads",
1825
- "aeb",
1826
- "aec",
1827
- "afb",
1828
- "ajp",
1829
- "apc",
1830
- "apd",
1831
- "arb",
1832
- "arq",
1833
- "ars",
1834
- "ary",
1835
- "arz",
1836
- "auz",
1837
- "avl",
1838
- "ayh",
1839
- "ayl",
1840
- "ayn",
1841
- "ayp",
1842
- "bbz",
1843
- "pga",
1844
- "he",
1845
- "iw",
1846
- "ps",
1847
- "pbt",
1848
- "pbu",
1849
- "pst",
1850
- "prp",
1851
- "prd",
1852
- "ug",
1853
- "ur",
1854
- "ydd",
1855
- "yds",
1856
- "yih",
1857
- "ji",
1858
- "yi",
1859
- "hbo",
1860
- "men",
1861
- "xmn",
1862
- "fa",
1863
- "jpr",
1864
- "peo",
1865
- "pes",
1866
- "prs",
1867
- "dv",
1868
- "sam",
1869
- "ckb"
1870
- ];
1871
- const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
1872
- if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
1873
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1874
- }
1875
- static createInstance(options = {}, callback) {
1876
- const instance = new I18n(options, callback);
1877
- instance.createInstance = I18n.createInstance;
1878
- return instance;
1879
- }
1880
- cloneInstance(options = {}, callback = noop) {
1881
- const forkResourceStore = options.forkResourceStore;
1882
- if (forkResourceStore) delete options.forkResourceStore;
1883
- const mergedOptions = {
1884
- ...this.options,
1885
- ...options,
1886
- isClone: true
1887
- };
1888
- const clone = new I18n(mergedOptions);
1889
- if (options.debug !== void 0 || options.prefix !== void 0) clone.logger = clone.logger.clone(options);
1890
- [
1891
- "store",
1892
- "services",
1893
- "language"
1894
- ].forEach((m) => {
1895
- clone[m] = this[m];
1896
- });
1897
- clone.services = { ...this.services };
1898
- clone.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) };
1899
- if (forkResourceStore) {
1900
- clone.store = new ResourceStore(Object.keys(this.store.data).reduce((prev, l) => {
1901
- prev[l] = { ...this.store.data[l] };
1902
- prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
1903
- acc[n] = { ...prev[l][n] };
1904
- return acc;
1905
- }, prev[l]);
1906
- return prev;
1907
- }, {}), mergedOptions);
1908
- clone.services.resourceStore = clone.store;
1909
- }
1910
- if (options.interpolation) clone.services.interpolator = new Interpolator(mergedOptions);
1911
- clone.translator = new Translator(clone.services, mergedOptions);
1912
- clone.translator.on("*", (event, ...args) => {
1913
- clone.emit(event, ...args);
1914
- });
1915
- clone.init(mergedOptions, callback);
1916
- clone.translator.options = mergedOptions;
1917
- clone.translator.backendConnector.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) };
1918
- return clone;
1919
- }
1920
- toJSON() {
1921
- return {
1922
- options: this.options,
1923
- store: this.store,
1924
- language: this.language,
1925
- languages: this.languages,
1926
- resolvedLanguage: this.resolvedLanguage
1927
- };
1928
- }
1929
- }.createInstance();
1930
- instance.createInstance;
1931
- instance.dir;
1932
- instance.init;
1933
- instance.loadResources;
1934
- instance.reloadResources;
1935
- instance.use;
1936
- instance.changeLanguage;
1937
- instance.getFixedT;
1938
- instance.t;
1939
- instance.exists;
1940
- instance.setDefaultNamespace;
1941
- instance.hasLoadedNamespace;
1942
- instance.loadNamespaces;
1943
- instance.loadLanguages;
1944
- //#endregion
1945
- //#region src/i18n/bundledTranslationLoaders.ts
1946
- var bundledTranslationLoaders = {
1947
- "en": () => import("./en-DNuMvR7-.js"),
1948
- "en-DG": () => import("./en-DG-DOwBuCCl.js"),
1949
- "es": () => import("./es-DNl7ceDm.js"),
1950
- "es-ES": () => import("./es-ES-BF9vl0Um.js"),
1951
- "sr": () => import("./sr-DgHGiiWM.js"),
1952
- "sr-Latn": () => import("./sr-Latn-Du7_x_Tr.js"),
1953
- "fr": () => import("./fr-B4R5fgnm.js"),
1954
- "pt-BR": () => import("./pt-BR-CMvTsOqE.js"),
1955
- "pt": () => import("./pt-AGz2XGAK.js"),
1956
- "bn": () => import("./bn-CNhjOqja.js"),
1957
- "zh": () => import("./zh-B-kjeCig.js"),
1958
- "hi": () => import("./hi-DFXhGN9O.js"),
1959
- "id": () => import("./id-D2VZL6b-.js"),
1960
- "ms": () => import("./ms-Bb-SlQCF.js"),
1961
- "tr": () => import("./tr-BJAuvOwN.js"),
1962
- "vi": () => import("./vi-CgfGVVLY.js"),
1963
- "ht": () => import("./ht-CAd-Hmi1.js"),
1964
- "it": () => import("./it-fs9OkGbv.js"),
1965
- "de": () => import("./de-D0xnkswj.js"),
1966
- "nl": () => import("./nl-C1mnzCBH.js"),
1967
- "tl-PH": () => import("./tl-PH-D2S2Irx7.js"),
1968
- "pl": () => import("./pl-CWr2fVBg.js"),
1969
- "hu": () => import("./hu-CulT8eq_.js"),
1970
- "ro": () => import("./ro-DYdJJDKn.js"),
1971
- "hmn": () => import("./hmn-BlNbfL-D.js"),
1972
- "so": () => import("./so-dqMTkg5E.js"),
1973
- "ca": () => import("./ca-h1xwo6CW.js"),
1974
- "af-ZA": () => import("./af-ZA-Dm5i-KRC.js"),
1975
- "ar": () => import("./ar-RFuhholc.js"),
1976
- "ar-EG": () => import("./ar-EG-y8SWJjy1.js"),
1977
- "ar-AE": () => import("./ar-AE--KjG2EAr.js"),
1978
- "zh-CN": () => import("./zh-CN-BOxod1_T.js"),
1979
- "zh-TW": () => import("./zh-TW-B0v7GYYG.js"),
1980
- "zh-HANT": () => import("./zh-HANT-zAahQ8nP.js"),
1981
- "cs-CZ": () => import("./cs-CZ-CiATe8nW.js"),
1982
- "da-DK": () => import("./da-DK-CgrU79mp.js"),
1983
- "fi-FI": () => import("./fi-FI-mYdAUbtG.js"),
1984
- "fr-CA": () => import("./fr-CA-DJSwRuWt.js"),
1985
- "el-GR": () => import("./el-GR-DPUvlcvr.js"),
1986
- "he": () => import("./he-D2RDlnbd.js"),
1987
- "ja": () => import("./ja-BvKVI6Oo.js"),
1988
- "ja-JP": () => import("./ja-JP-C5-gDGuX.js"),
1989
- "ko-KP": () => import("./ko-KP-Q3GGdDp3.js"),
1990
- "nb-NO": () => import("./nb-NO-DpZAni0R.js"),
1991
- "fa-IR": () => import("./fa-IR-BoyK-lax.js"),
1992
- "pt-PT": () => import("./pt-PT-KzIM0vpf.js"),
1993
- "ru-RU": () => import("./ru-RU-18JeDfwz.js"),
1994
- "sr-YU": () => import("./sr-YU-YuZu7wdb.js"),
1995
- "es-419": () => import("./es-419-BU7r2Fvh.js"),
1996
- "es-MX": () => import("./es-MX-Brp4FXN8.js"),
1997
- "sv-SE": () => import("./sv-SE-Dw61hRjx.js"),
1998
- "th-TH": () => import("./th-TH-VyhljC5U.js"),
1999
- "uk-UA": () => import("./uk-UA-BZR90qDZ.js"),
2000
- "am": () => import("./am-UBTEdpJv.js"),
2001
- "az": () => import("./az-4Z0ZZq7T.js"),
2002
- "bs": () => import("./bs-Culcuxab.js"),
2003
- "my": () => import("./my-3ci4RJZY.js"),
2004
- "ceb": () => import("./ceb-pTDH3h1x.js"),
2005
- "cs": () => import("./cs-CrQuSSOI.js"),
2006
- "et": () => import("./et-D5pPP4r0.js"),
2007
- "ka": () => import("./ka-pqIPc2el.js"),
2008
- "el": () => import("./el-B5gLXHxC.js"),
2009
- "jv": () => import("./jv-CyId7aPo.js"),
2010
- "kk": () => import("./kk-DK7mWl6k.js"),
2011
- "km": () => import("./km-BaJYdDrm.js"),
2012
- "ko": () => import("./ko-CdYIGTH_.js"),
2013
- "ky": () => import("./ky-Bc7ZXIXy.js"),
2014
- "lo": () => import("./lo-0jgAavCe.js"),
2015
- "lv": () => import("./lv-Ddzb_N3H.js"),
2016
- "lt": () => import("./lt-DDEjR6RD.js"),
2017
- "mk": () => import("./mk-SJwou4aX.js"),
2018
- "mn": () => import("./mn-7B86xjpb.js"),
2019
- "ne": () => import("./ne-Dncyvxqt.js"),
2020
- "ru": () => import("./ru-C1cguVi2.js"),
2021
- "sk": () => import("./sk-CtIcnYOo.js"),
2022
- "sl": () => import("./sl-DS_Gc0Wc.js"),
2023
- "sw": () => import("./sw-De-Jo8XY.js"),
2024
- "tl": () => import("./tl-DhjdqhA4.js"),
2025
- "th": () => import("./th-BJixOgsM.js"),
2026
- "uk": () => import("./uk-CcU91ee-.js"),
2027
- "ur": () => import("./ur-CIXtUYHK.js"),
2028
- "uz": () => import("./uz-CeLVgwAD.js"),
2029
- "hr": () => import("./hr-DArr3n62.js")
2030
- };
2031
- //#endregion
2032
- //#region src/i18n/bundledTranslationsBackend.ts
2033
- function asError(error) {
2034
- return error instanceof Error ? error : /* @__PURE__ */ new Error("Could not load bundled translations");
2035
- }
2036
- var bundledTranslationsBackend = {
2037
- type: "backend",
2038
- init() {},
2039
- read(language, _namespace, callback) {
2040
- const load = bundledTranslationLoaders[language];
2041
- if (!load) {
2042
- callback(/* @__PURE__ */ new Error(`Unsupported bundled language: ${language}`), false);
2043
- return;
2044
- }
2045
- load().then(({ default: translations }) => callback(null, translations), (error) => callback(asError(error), false));
2046
- }
2047
- };
2048
- var supportedLanguages = [
2049
- "en",
2050
- "en-DG",
2051
- "es",
2052
- "es-ES",
2053
- "sr",
2054
- "sr-Latn",
2055
- "fr",
2056
- "pt-BR",
2057
- "pt",
2058
- "bn",
2059
- "zh",
2060
- "hi",
2061
- "id",
2062
- "ms",
2063
- "tr",
2064
- "vi",
2065
- "ht",
2066
- "it",
2067
- "de",
2068
- "nl",
2069
- "tl-PH",
2070
- "pl",
2071
- "hu",
2072
- "ro",
2073
- "hmn",
2074
- "so",
2075
- "ca",
2076
- "af-ZA",
2077
- "ar",
2078
- "ar-EG",
2079
- "ar-AE",
2080
- "zh-CN",
2081
- "zh-TW",
2082
- "zh-HANT",
2083
- "cs-CZ",
2084
- "da-DK",
2085
- "fi-FI",
2086
- "fr-CA",
2087
- "el-GR",
2088
- "he",
2089
- "ja",
2090
- "ja-JP",
2091
- "ko-KP",
2092
- "nb-NO",
2093
- "fa-IR",
2094
- "pt-PT",
2095
- "ru-RU",
2096
- "sr-YU",
2097
- "es-419",
2098
- "es-MX",
2099
- "sv-SE",
2100
- "th-TH",
2101
- "uk-UA",
2102
- "am",
2103
- "az",
2104
- "bs",
2105
- "my",
2106
- "ceb",
2107
- "cs",
2108
- "et",
2109
- "ka",
2110
- "el",
2111
- "jv",
2112
- "kk",
2113
- "km",
2114
- "ko",
2115
- "ky",
2116
- "lo",
2117
- "lv",
2118
- "lt",
2119
- "mk",
2120
- "mn",
2121
- "ne",
2122
- "ru",
2123
- "sk",
2124
- "sl",
2125
- "sw",
2126
- "tl",
2127
- "th",
2128
- "uk",
2129
- "ur",
2130
- "uz",
2131
- "hr"
2132
- ];
2133
- var languageMetadata = {
2134
- en: { emoji: "🇺🇸" },
2135
- "en-DG": { emoji: "🇬🇧" },
2136
- es: { emoji: "🇪🇸" },
2137
- "es-ES": { emoji: "🇪🇸" },
2138
- sr: { emoji: "🇷🇸" },
2139
- "sr-Latn": { emoji: "🇷🇸" },
2140
- fr: { emoji: "🇫🇷" },
2141
- "pt-BR": { emoji: "🇧🇷" },
2142
- pt: { emoji: "🇵🇹" },
2143
- bn: { emoji: "🇧🇩" },
2144
- zh: { emoji: "🇨🇳" },
2145
- hi: { emoji: "🇮🇳" },
2146
- id: { emoji: "🇮🇩" },
2147
- ms: { emoji: "🇲🇾" },
2148
- tr: { emoji: "🇹🇷" },
2149
- vi: { emoji: "🇻🇳" },
2150
- ht: { emoji: "🇭🇹" },
2151
- it: { emoji: "🇮🇹" },
2152
- de: { emoji: "🇩🇪" },
2153
- nl: { emoji: "🇳🇱" },
2154
- "tl-PH": { emoji: "🇵🇭" },
2155
- pl: { emoji: "🇵🇱" },
2156
- hu: { emoji: "🇭🇺" },
2157
- ro: { emoji: "🇷🇴" },
2158
- hmn: { emoji: "🌐" },
2159
- so: { emoji: "🇸🇴" },
2160
- ca: { emoji: "🇪🇸" },
2161
- "af-ZA": { emoji: "🇿🇦" },
2162
- ar: { emoji: "🇸🇦" },
2163
- "ar-EG": { emoji: "🇪🇬" },
2164
- "ar-AE": { emoji: "🇦🇪" },
2165
- "zh-CN": { emoji: "🇨🇳" },
2166
- "zh-TW": { emoji: "🇹🇼" },
2167
- "zh-HANT": { emoji: "🇹🇼" },
2168
- "cs-CZ": { emoji: "🇨🇿" },
2169
- "da-DK": { emoji: "🇩🇰" },
2170
- "fi-FI": { emoji: "🇫🇮" },
2171
- "fr-CA": { emoji: "🇨🇦" },
2172
- "el-GR": { emoji: "🇬🇷" },
2173
- he: { emoji: "🇮🇱" },
2174
- ja: { emoji: "🇯🇵" },
2175
- "ja-JP": { emoji: "🇯🇵" },
2176
- "ko-KP": { emoji: "🇰🇵" },
2177
- "nb-NO": { emoji: "🇳🇴" },
2178
- "fa-IR": { emoji: "🇮🇷" },
2179
- "pt-PT": { emoji: "🇵🇹" },
2180
- "ru-RU": { emoji: "🇷🇺" },
2181
- "sr-YU": { emoji: "🇷🇸" },
2182
- "es-419": { emoji: "🌎" },
2183
- "es-MX": { emoji: "🇲🇽" },
2184
- "sv-SE": { emoji: "🇸🇪" },
2185
- "th-TH": { emoji: "🇹🇭" },
2186
- "uk-UA": { emoji: "🇺🇦" },
2187
- am: { emoji: "🇪🇹" },
2188
- az: { emoji: "🇦🇿" },
2189
- bs: { emoji: "🇧🇦" },
2190
- my: { emoji: "🇲🇲" },
2191
- ceb: { emoji: "🇵🇭" },
2192
- cs: { emoji: "🇨🇿" },
2193
- et: { emoji: "🇪🇪" },
2194
- ka: { emoji: "🇬🇪" },
2195
- el: { emoji: "🇬🇷" },
2196
- jv: { emoji: "🇮🇩" },
2197
- kk: { emoji: "🇰🇿" },
2198
- km: { emoji: "🇰🇭" },
2199
- ko: { emoji: "🇰🇷" },
2200
- ky: { emoji: "🇰🇬" },
2201
- lo: { emoji: "🇱🇦" },
2202
- lv: { emoji: "🇱🇻" },
2203
- lt: { emoji: "🇱🇹" },
2204
- mk: { emoji: "🇲🇰" },
2205
- mn: { emoji: "🇲🇳" },
2206
- ne: { emoji: "🇳🇵" },
2207
- ru: { emoji: "🇷🇺" },
2208
- sk: { emoji: "🇸🇰" },
2209
- sl: { emoji: "🇸🇮" },
2210
- sw: { emoji: "🇹🇿" },
2211
- tl: { emoji: "🇵🇭" },
2212
- th: { emoji: "🇹🇭" },
2213
- uk: { emoji: "🇺🇦" },
2214
- ur: { emoji: "🇵🇰" },
2215
- uz: { emoji: "🇺🇿" },
2216
- hr: { emoji: "🇭🇷" }
2217
- };
2218
- function getLanguageEmoji(language) {
2219
- const directMatch = languageMetadata[language];
2220
- if (directMatch) return directMatch.emoji;
2221
- return languageMetadata[language.split("-")[0] || language]?.emoji ?? "🌐";
2222
- }
2223
- //#endregion
2224
- //#region src/i18n/lazyHttpBackend.ts
2225
- var _LazyHttpBackend;
2226
- /**
2227
- * Loads i18next-http-backend on the first read, so sessions that use the
2228
- * bundled catalogs do not download it. i18next creates one instance of this
2229
- * class for each i18n instance.
2230
- */
2231
- var LazyHttpBackend = class {
2232
- constructor() {
2233
- this.type = "backend";
2234
- }
2235
- init(services, backendOptions, i18nextOptions) {
2236
- this.initArgs = [
2237
- services,
2238
- backendOptions,
2239
- i18nextOptions
2240
- ];
2241
- }
2242
- read(language, namespace, callback) {
2243
- this.backend ??= import("./esm-15CISqPe.js").then(({ default: RealHttpBackend }) => {
2244
- const backend = new RealHttpBackend();
2245
- backend.init(...this.initArgs);
2246
- return backend;
2247
- });
2248
- this.backend.then((backend) => {
2249
- try {
2250
- backend.read(language, namespace, callback);
2251
- } catch (error) {
2252
- callback(error, false);
2253
- }
2254
- }, (error) => {
2255
- this.backend = void 0;
2256
- callback(error, false);
2257
- });
2258
- }
2259
- };
2260
- _LazyHttpBackend = LazyHttpBackend;
2261
- _LazyHttpBackend.type = "backend";
2262
- //#endregion
2263
- //#region src/i18n/setup.ts
2264
- var LANGUAGE_STORAGE_KEY = "incode:i18n:language";
2265
- var camelToStartCase = (text) => {
2266
- const result = text.replace(/([A-Z])/g, " $1");
2267
- return result.charAt(0).toUpperCase() + result.slice(1);
2268
- };
2269
- var keyToStartCase = (key, defaultValue) => {
2270
- if (defaultValue) return defaultValue;
2271
- const splitKey = key.split(".");
2272
- const missingKey = splitKey[splitKey.length - 1];
2273
- return camelToStartCase(missingKey || "missing key");
2274
- };
2275
- function readNavigatorLanguage() {
2276
- if (typeof navigator === "undefined") return "en";
2277
- const languageFromBrowser = navigator.language;
2278
- if (!languageFromBrowser) return null;
2279
- if (supportedLanguages.includes(languageFromBrowser)) return languageFromBrowser;
2280
- return languageFromBrowser.split("-")[0];
2281
- }
2282
- function readHtmlLanguage() {
2283
- if (typeof document === "undefined") return null;
2284
- return document.documentElement?.getAttribute("lang") ?? null;
2285
- }
2286
- function createLanguageDetector(skipInitialLanguageCache) {
2287
- let skipNextCache = skipInitialLanguageCache;
2288
- return {
2289
- type: "languageDetector",
2290
- detect: () => [
2291
- readQueryLanguage(),
2292
- readStoredLanguage(),
2293
- readStorageLanguage(() => sessionStorage),
2294
- readNavigatorLanguage(),
2295
- readHtmlLanguage()
2296
- ].filter((language) => !!language),
2297
- cacheUserLanguage(language) {
2298
- if (skipNextCache) {
2299
- skipNextCache = false;
2300
- return;
2301
- }
2302
- if (language === "cimode") return;
2303
- try {
2304
- localStorage.setItem(LANGUAGE_STORAGE_KEY, language);
2305
- } catch {}
2306
- }
2307
- };
2308
- }
2309
- function applyOverrides(i18nInstance, translations) {
2310
- for (const [langCode, value] of Object.entries(translations)) if (value) i18nInstance.addResourceBundle(langCode, "default", value, true, true);
2311
- }
2312
- function readStorageLanguage(getStorage) {
2313
- try {
2314
- return getStorage().getItem(LANGUAGE_STORAGE_KEY);
2315
- } catch {
2316
- return null;
2317
- }
2318
- }
2319
- function readStoredLanguage() {
2320
- return readStorageLanguage(() => localStorage);
2321
- }
2322
- function readQueryLanguage() {
2323
- if (typeof window === "undefined") return null;
2324
- return new URLSearchParams(window.location.search).get("lang") || null;
2325
- }
2326
- function createI18n(options = {}) {
2327
- const { lang, loadPath, skipRemoteLoad, translations } = options;
2328
- const i18nInstance = instance.createInstance();
2329
- const queryLang = readQueryLanguage();
2330
- const languageDetector = createLanguageDetector(queryLang !== null);
2331
- const storedLang = readStoredLanguage();
2332
- const resolvedLoadPath = loadPath ?? void 0;
2333
- const remoteLoadEnabled = skipRemoteLoad !== true && resolvedLoadPath !== void 0;
2334
- if (remoteLoadEnabled) i18nInstance.use(LazyHttpBackend);
2335
- else i18nInstance.use(bundledTranslationsBackend);
2336
- i18nInstance.use(languageDetector).init({
2337
- lng: queryLang ?? storedLang ?? lang,
2338
- fallbackLng: "en",
2339
- load: remoteLoadEnabled ? "all" : "currentOnly",
2340
- supportedLngs: supportedLanguages,
2341
- ns: ["default"],
2342
- defaultNS: "default",
2343
- partialBundledLanguages: true,
2344
- keySeparator: ".",
2345
- interpolation: { escapeValue: false },
2346
- backend: remoteLoadEnabled ? { loadPath: resolvedLoadPath } : void 0,
2347
- initImmediate: false,
2348
- parseMissingKeyHandler: keyToStartCase
2349
- });
2350
- if (translations) {
2351
- applyOverrides(i18nInstance, translations);
2352
- i18nInstance.on("loaded", () => {
2353
- applyOverrides(i18nInstance, translations);
2354
- });
2355
- }
2356
- return i18nInstance;
2357
- }
2358
- //#endregion
2359
- //#region src/i18n/instance.ts
2360
- var TRANSLATION_EVENTS = [
2361
- "languageChanged",
2362
- "initialized",
2363
- "loaded"
2364
- ];
2365
- var i18nInstance = null;
2366
- var version = 0;
2367
- var listeners$1 = /* @__PURE__ */ new Set();
2368
- function notify() {
2369
- version += 1;
2370
- for (const listener of listeners$1) listener();
2371
- }
2372
- function bindTranslationEvents(instance) {
2373
- for (const event of TRANSLATION_EVENTS) instance.on(event, notify);
2374
- }
2375
- function unbindTranslationEvents(instance) {
2376
- for (const event of TRANSLATION_EVENTS) instance.off(event, notify);
2377
- }
2378
- function setI18nInstance(instance) {
2379
- if (i18nInstance === instance) return;
2380
- if (i18nInstance) unbindTranslationEvents(i18nInstance);
2381
- i18nInstance = instance;
2382
- bindTranslationEvents(instance);
2383
- notify();
2384
- }
2385
- function hasI18nInstance() {
2386
- return i18nInstance !== null;
2387
- }
2388
- function getI18nInstance() {
2389
- if (!i18nInstance) {
2390
- i18nInstance = createI18n();
2391
- bindTranslationEvents(i18nInstance);
2392
- }
2393
- return i18nInstance;
2394
- }
2395
- function getI18nVersion() {
2396
- return version;
2397
- }
2398
- function subscribeToI18n(listener) {
2399
- listeners$1.add(listener);
2400
- return () => {
2401
- listeners$1.delete(listener);
2402
- };
2403
- }
2404
- //#endregion
2405
- //#region src/shared/icons/arrowIcon.tsx
2406
- var ArrowIcon = ({ class: className }) => /* @__PURE__ */ u("svg", {
2407
- width: "13",
2408
- height: "14",
2409
- viewBox: "0 0 13 14",
2410
- fill: "none",
2411
- xmlns: "http://www.w3.org/2000/svg",
2412
- "aria-hidden": "true",
2413
- class: className,
2414
- children: /* @__PURE__ */ u("path", {
2415
- d: "M0 8.08V5.92h9.198l-4.5-4.05L6.228.34 12.6 6.28v1.422L6.228 13.66l-1.53-1.53 4.5-4.05z",
2416
- fill: "currentColor"
2417
- })
2418
- });
2419
- //#endregion
2420
- //#region src/i18n/useTranslation.ts
2421
- function useTranslation() {
2422
- const i18nInstance = getI18nInstance();
2423
- const [, forceUpdate] = d(0);
2424
- const [ready, setReady] = d(i18nInstance.isInitialized);
2425
- y(() => {
2426
- const handleLanguageChanged = () => {
2427
- forceUpdate((n) => n + 1);
2428
- };
2429
- const handleInitialized = () => {
2430
- setReady(true);
2431
- forceUpdate((n) => n + 1);
2432
- };
2433
- i18nInstance.on("languageChanged", handleLanguageChanged);
2434
- i18nInstance.on("initialized", handleInitialized);
2435
- i18nInstance.on("loaded", handleLanguageChanged);
2436
- return () => {
2437
- i18nInstance.off("languageChanged", handleLanguageChanged);
2438
- i18nInstance.off("initialized", handleInitialized);
2439
- i18nInstance.off("loaded", handleLanguageChanged);
2440
- };
2441
- }, [i18nInstance]);
2442
- return {
2443
- t: T(() => i18nInstance.t.bind(i18nInstance), [i18nInstance]),
2444
- ready,
2445
- i18n: i18nInstance
2446
- };
2447
- }
2448
- //#endregion
2449
- //#region src/i18n/Trans.tsx
2450
- var Trans = ({ i18nKey, boldClass = "IncodeTransBold", arrowClass = "IncodeTransArrow", components, defaultValue }) => {
2451
- const { t } = useTranslation();
2452
- const text = defaultValue ? t(i18nKey, { defaultValue }) : t(i18nKey);
2453
- const builtInPattern = "<strong>|<\\/strong>|<br\\s*\\/?>|<arrow\\s*\\/>";
2454
- const componentPattern = components ? Object.keys(components).map((name) => `<${name}>|<\\/${name}>`).join("|") : "";
2455
- const fullPattern = componentPattern ? `${builtInPattern}|${componentPattern}` : builtInPattern;
2456
- const parts = text.split(new RegExp(`(${fullPattern})`, "g"));
2457
- let isBold = false;
2458
- let activeComponent = null;
2459
- return /* @__PURE__ */ u(k, { children: parts.map((part, index) => {
2460
- if (part === "<strong>") {
2461
- isBold = true;
2462
- return null;
2463
- }
2464
- if (part === "</strong>") {
2465
- isBold = false;
2466
- return null;
2467
- }
2468
- if (/^<br\s*\/?>$/.test(part)) return /* @__PURE__ */ u("br", {}, index);
2469
- if (/^<arrow\s*\/>$/.test(part)) return /* @__PURE__ */ u(ArrowIcon, { class: arrowClass }, index);
2470
- if (components) {
2471
- const openMatch = part.match(/^<(\w+)>$/);
2472
- if (openMatch && components[openMatch[1]]) {
2473
- activeComponent = openMatch[1];
2474
- return null;
2475
- }
2476
- const closeMatch = part.match(/^<\/(\w+)>$/);
2477
- if (closeMatch && components[closeMatch[1]]) {
2478
- activeComponent = null;
2479
- return null;
2480
- }
2481
- }
2482
- if (!part) return null;
2483
- if (activeComponent && components) return K(components[activeComponent], { key: index }, part);
2484
- return isBold ? /* @__PURE__ */ u("span", {
2485
- class: boldClass,
2486
- children: part
2487
- }, index) : /* @__PURE__ */ u(k, { children: part }, index);
2488
- }) });
2489
- };
2490
- //#endregion
2491
- //#region src/i18n/fallbackTranslations.ts
2492
- /**
2493
- * Last-resort English copy for keys a screen may read before the translation
2494
- * bundle loads (see `useTranslationWithFallback`). One fallback per key,
2495
- * defined once.
2496
- */
2497
- var I18N_LOCAL = {
2498
- "unsupportedBrowser.title": "Unsupported browser",
2499
- "unsupportedBrowser.betterExperience": "For a better experience, open this link in",
2500
- "unsupportedBrowser.or": "or",
2501
- "unsupportedBrowser.copyLink": "Copy link",
2502
- "unsupportedBrowser.continueAnyways": "Continue anyway",
2503
- "unsupportedBrowser.linkCopied": "Link copied"
2504
- };
2505
- //#endregion
2506
- //#region src/i18n/useTranslationWithFallback.ts
2507
- /**
2508
- * `useTranslation()`, but a bare `t(key)` picks up its `I18N_LOCAL` fallback
2509
- * automatically. Any explicit second argument is forwarded untouched. Use
2510
- * this only on screens that can render before the bundle loads — see
2511
- * `BrowserNotSupported`.
2512
- */
2513
- function useTranslationWithFallback() {
2514
- const { t, ready, i18n } = useTranslation();
2515
- C(subscribeToI18n, getI18nVersion);
2516
- return {
2517
- t: q((key, defaultValueOrOptions, options) => {
2518
- if (typeof defaultValueOrOptions === "string") return options === void 0 ? t(key, defaultValueOrOptions) : t(key, defaultValueOrOptions, options);
2519
- if (defaultValueOrOptions !== void 0) return t(key, defaultValueOrOptions);
2520
- if (typeof key !== "string") return t(key);
2521
- const fallback = I18N_LOCAL[key];
2522
- return fallback ? t(key, { defaultValue: fallback }) : t(key);
2523
- }, [t]),
2524
- ready,
2525
- i18n
2526
- };
2527
- }
2528
- //#endregion
2529
- //#region src/shared/uiConfig/uiConfig.ts
2530
- /** Tier 1: set by the host via `setup({ uiConfig })` / `setUiConfig`. Wins. */
2531
- var hostUiConfig = {};
2532
- /** Tier 2: derived from the tenant's dashboard theme. Fills the gaps. */
2533
- var themeUiConfig = {};
2534
- /**
2535
- * Cached composition of the two tiers. `useSyncExternalStore` requires
2536
- * `getSnapshot` to return a referentially stable value — composing on every
2537
- * call would hand Preact a new object each time and loop forever — so the
2538
- * merge happens once per write instead.
2539
- */
2540
- var snapshot = {};
2541
- var listeners = /* @__PURE__ */ new Set();
2542
- function withoutUndefined(value) {
2543
- const defined = {};
2544
- for (const key of Object.keys(value)) if (value[key] !== void 0) defined[key] = value[key];
2545
- return defined;
2546
- }
2547
- /**
2548
- * Host fields win over theme fields; a host field left `undefined` counts as
2549
- * "not specified" and lets the theme through, rather than blanking it.
2550
- */
2551
- function publish() {
2552
- snapshot = {
2553
- ...themeUiConfig,
2554
- ...withoutUndefined(hostUiConfig)
2555
- };
2556
- for (const listener of listeners) listener();
2557
- }
2558
- function subscribe(listener) {
2559
- listeners.add(listener);
2560
- return () => {
2561
- listeners.delete(listener);
2562
- };
2563
- }
2564
- function getSnapshot() {
2565
- return snapshot;
2566
- }
2567
- /**
2568
- * Sets global UI configuration defaults for `@incodetech/ui`.
2569
- *
2570
- * Replaces (does not merge with) the previous host-supplied config, so omitting
2571
- * a field clears it. The dashboard theme is held separately and is unaffected.
2572
- */
2573
- function setUiConfig(next) {
2574
- hostUiConfig = next;
2575
- publish();
2576
- }
2577
- /**
2578
- * Internal: publishes the branding fields derived from the tenant's dashboard
2579
- * theme. Not exported from the package — hosts use {@link setUiConfig}.
2580
- */
2581
- function setThemeUiConfig(next) {
2582
- themeUiConfig = next;
2583
- publish();
2584
- }
2585
- function useUiConfig() {
2586
- return C(subscribe, getSnapshot);
2587
- }
2588
- //#endregion
2589
- export { Trans as a, setI18nInstance as c, getLanguageEmoji as d, supportedLanguages as f, useTranslationWithFallback as i, createI18n as l, setUiConfig as n, useTranslation as o, useUiConfig as r, hasI18nInstance as s, setThemeUiConfig as t, readStoredLanguage as u };