@prosopo/procaptcha-bundle 3.2.2 → 3.2.3

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 (252) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.json +11 -11
  3. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts +0 -5
  4. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts.map +0 -1
  5. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/components.js +0 -5
  6. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/components.js.map +0 -1
  7. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +0 -16
  8. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +0 -1
  9. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js +0 -144
  10. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +0 -1
  11. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/procaptchaReady.unit.test.d.ts +0 -2
  12. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/procaptchaReady.unit.test.d.ts.map +0 -1
  13. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/procaptchaReady.unit.test.js +0 -32
  14. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/procaptchaReady.unit.test.js.map +0 -1
  15. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
  16. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  17. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js +0 -36
  18. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js.map +0 -1
  19. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts +0 -2
  20. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  21. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js +0 -69
  22. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js.map +0 -1
  23. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
  24. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  25. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +0 -136
  26. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +0 -1
  27. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
  28. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  29. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +0 -15
  30. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +0 -1
  31. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
  32. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  33. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js +0 -11
  34. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js.map +0 -1
  35. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
  36. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  37. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js +0 -2
  38. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js.map +0 -1
  39. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
  40. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  41. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +0 -49
  42. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +0 -1
  43. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts +0 -3
  44. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  45. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js +0 -8
  46. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js.map +0 -1
  47. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  48. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  49. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +0 -14
  50. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +0 -1
  51. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
  52. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  53. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js +0 -9
  54. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js.map +0 -1
  55. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
  56. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  57. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js +0 -9
  58. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js.map +0 -1
  59. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +0 -6
  60. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +0 -1
  61. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +0 -13
  62. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +0 -1
  63. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +0 -5
  64. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +0 -1
  65. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +0 -23
  66. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +0 -1
  67. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts +0 -3
  68. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts.map +0 -1
  69. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js +0 -17
  70. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +0 -1
  71. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts +0 -3
  72. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts.map +0 -1
  73. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js +0 -9
  74. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js.map +0 -1
  75. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +0 -18
  76. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  77. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +0 -66
  78. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +0 -1
  79. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
  80. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  81. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js +0 -19
  82. package/.rollup.cache/home/chris/dev/prosopo/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js.map +0 -1
  83. package/coverage/base.css +0 -224
  84. package/coverage/block-navigation.js +0 -87
  85. package/coverage/clover.xml +0 -599
  86. package/coverage/coverage-final.json +0 -17
  87. package/coverage/favicon.png +0 -0
  88. package/coverage/index.html +0 -161
  89. package/coverage/prettify.css +0 -1
  90. package/coverage/prettify.js +0 -2
  91. package/coverage/sort-arrow-sprite.png +0 -0
  92. package/coverage/sorter.js +0 -210
  93. package/coverage/src/components.ts.html +0 -139
  94. package/coverage/src/index.html +0 -131
  95. package/coverage/src/index.ts.html +0 -844
  96. package/coverage/src/util/captcha/captchaComponentProvider.tsx.html +0 -214
  97. package/coverage/src/util/captcha/captchaComponentsList.ts.html +0 -178
  98. package/coverage/src/util/captcha/captchaProps.ts.html +0 -166
  99. package/coverage/src/util/captcha/captchaRenderer.tsx.html +0 -481
  100. package/coverage/src/util/captcha/captchaType.ts.html +0 -181
  101. package/coverage/src/util/captcha/components/frictionlessCaptcha.tsx.html +0 -205
  102. package/coverage/src/util/captcha/components/imageCaptcha.tsx.html +0 -178
  103. package/coverage/src/util/captcha/components/index.html +0 -146
  104. package/coverage/src/util/captcha/components/powCaptcha.tsx.html +0 -178
  105. package/coverage/src/util/captcha/index.html +0 -176
  106. package/coverage/src/util/config.ts.html +0 -172
  107. package/coverage/src/util/configCreator.ts.html +0 -241
  108. package/coverage/src/util/index.html +0 -191
  109. package/coverage/src/util/language.ts.html +0 -244
  110. package/coverage/src/util/timeout.ts.html +0 -214
  111. package/coverage/src/util/widgetFactory.ts.html +0 -532
  112. package/coverage/src/util/widgetThemeResolver.ts.html +0 -205
  113. package/dist/bundle/ProcaptchaWidget-CuMH13Bh.js +0 -1012
  114. package/dist/bundle/ProcaptchaWidget-DsflBBn_.js +0 -187
  115. package/dist/bundle/Signer-DP9drQ55.js +0 -23
  116. package/dist/bundle/bnChunk-DRlDxTFg.js +0 -1137
  117. package/dist/bundle/browser-ponyfill-DXriyH6D.js +0 -339
  118. package/dist/bundle/builder-ByZ5z580.js +0 -46
  119. package/dist/bundle/captchaComponentProvider-D02Su4nd.js +0 -1013
  120. package/dist/bundle/captchaRenderer-BV-WgbEA.js +0 -70
  121. package/dist/bundle/commonChunk-PB26mndo.js +0 -183
  122. package/dist/bundle/components.d.ts.map +0 -1
  123. package/dist/bundle/emotion-element-c39617d8.browser.esm-DG1XhEZ1.js +0 -916
  124. package/dist/bundle/fp.esm-DYWeNGcH.js +0 -1654
  125. package/dist/bundle/index-B9KeZfID.js +0 -5416
  126. package/dist/bundle/index-Calnfnac.js +0 -609
  127. package/dist/bundle/index-DU371vQ0.js +0 -1634
  128. package/dist/bundle/index.d.ts.map +0 -1
  129. package/dist/bundle/locales/ar/translation.json +0 -57
  130. package/dist/bundle/locales/az/translation.json +0 -57
  131. package/dist/bundle/locales/cs/translation.json +0 -57
  132. package/dist/bundle/locales/de/translation.json +0 -57
  133. package/dist/bundle/locales/el/translation.json +0 -57
  134. package/dist/bundle/locales/en/translation.json +0 -57
  135. package/dist/bundle/locales/es/translation.json +0 -57
  136. package/dist/bundle/locales/fi/translation.json +0 -57
  137. package/dist/bundle/locales/fr/translation.json +0 -57
  138. package/dist/bundle/locales/hi/translation.json +0 -57
  139. package/dist/bundle/locales/hu/translation.json +0 -57
  140. package/dist/bundle/locales/id/translation.json +0 -57
  141. package/dist/bundle/locales/it/translation.json +0 -57
  142. package/dist/bundle/locales/ja/translation.json +0 -57
  143. package/dist/bundle/locales/jv/translation.json +0 -57
  144. package/dist/bundle/locales/ko/translation.json +0 -57
  145. package/dist/bundle/locales/ml/translation.json +0 -57
  146. package/dist/bundle/locales/ms/translation.json +0 -57
  147. package/dist/bundle/locales/nl/translation.json +0 -57
  148. package/dist/bundle/locales/no/translation.json +0 -57
  149. package/dist/bundle/locales/pl/translation.json +0 -57
  150. package/dist/bundle/locales/pt/translation.json +0 -57
  151. package/dist/bundle/locales/pt-BR/translation.json +0 -57
  152. package/dist/bundle/locales/ro/translation.json +0 -57
  153. package/dist/bundle/locales/ru/translation.json +0 -57
  154. package/dist/bundle/locales/sr/translation.json +0 -57
  155. package/dist/bundle/locales/sv/translation.json +0 -57
  156. package/dist/bundle/locales/th/translation.json +0 -57
  157. package/dist/bundle/locales/tr/translation.json +0 -57
  158. package/dist/bundle/locales/uk/translation.json +0 -57
  159. package/dist/bundle/locales/vi/translation.json +0 -57
  160. package/dist/bundle/locales/zh-CN/translation.json +0 -57
  161. package/dist/bundle/nobleChunk-Bbltwf44.js +0 -2728
  162. package/dist/bundle/procaptcha.bundle.js +0 -8
  163. package/dist/bundle/tests/procaptchaReady.unit.test.d.ts.map +0 -1
  164. package/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  165. package/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  166. package/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  167. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  168. package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  169. package/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  170. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  171. package/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  172. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  173. package/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  174. package/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  175. package/dist/bundle/util/config.d.ts.map +0 -1
  176. package/dist/bundle/util/configCreator.d.ts.map +0 -1
  177. package/dist/bundle/util/language.d.ts.map +0 -1
  178. package/dist/bundle/util/timeout.d.ts.map +0 -1
  179. package/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  180. package/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  181. package/dist/bundle/utilChunk-WRTGKXbU.js +0 -324
  182. package/dist/bundle/utilCryptoChunk-B4ZdOwus.js +0 -1236
  183. package/dist/bundle/web2Chunk-BGN6Hv-C.js +0 -3972
  184. package/dist/bundle/web3Chunk-BIX2T9Eo.js +0 -525
  185. package/dist/bundle/zodChunk-CaINhWMQ.js +0 -2882
  186. package/dist/components.d.ts +0 -5
  187. package/dist/components.d.ts.map +0 -1
  188. package/dist/components.js +0 -5
  189. package/dist/components.js.map +0 -1
  190. package/dist/index.d.ts +0 -16
  191. package/dist/index.d.ts.map +0 -1
  192. package/dist/index.js.map +0 -1
  193. package/dist/tests/procaptchaReady.unit.test.d.ts +0 -2
  194. package/dist/tests/procaptchaReady.unit.test.d.ts.map +0 -1
  195. package/dist/tests/procaptchaReady.unit.test.js +0 -32
  196. package/dist/tests/procaptchaReady.unit.test.js.map +0 -1
  197. package/dist/tests/util/captchaType.test.d.ts +0 -2
  198. package/dist/tests/util/captchaType.test.d.ts.map +0 -1
  199. package/dist/tests/util/captchaType.test.js +0 -36
  200. package/dist/tests/util/captchaType.test.js.map +0 -1
  201. package/dist/tests/util/config.test.d.ts +0 -2
  202. package/dist/tests/util/config.test.d.ts.map +0 -1
  203. package/dist/tests/util/config.test.js +0 -69
  204. package/dist/tests/util/config.test.js.map +0 -1
  205. package/dist/tests/util/renderLogic.test.d.ts +0 -2
  206. package/dist/tests/util/renderLogic.test.d.ts.map +0 -1
  207. package/dist/tests/util/renderLogic.test.js +0 -136
  208. package/dist/tests/util/renderLogic.test.js.map +0 -1
  209. package/dist/util/captcha/captchaComponentProvider.d.ts +0 -8
  210. package/dist/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  211. package/dist/util/captcha/captchaComponentProvider.js.map +0 -1
  212. package/dist/util/captcha/captchaComponentsList.d.ts +0 -6
  213. package/dist/util/captcha/captchaComponentsList.d.ts.map +0 -1
  214. package/dist/util/captcha/captchaComponentsList.js.map +0 -1
  215. package/dist/util/captcha/captchaProps.d.ts +0 -10
  216. package/dist/util/captcha/captchaProps.d.ts.map +0 -1
  217. package/dist/util/captcha/captchaProps.js +0 -2
  218. package/dist/util/captcha/captchaProps.js.map +0 -1
  219. package/dist/util/captcha/captchaRenderer.d.ts +0 -24
  220. package/dist/util/captcha/captchaRenderer.d.ts.map +0 -1
  221. package/dist/util/captcha/captchaRenderer.js.map +0 -1
  222. package/dist/util/captcha/captchaType.d.ts +0 -3
  223. package/dist/util/captcha/captchaType.d.ts.map +0 -1
  224. package/dist/util/captcha/captchaType.js.map +0 -1
  225. package/dist/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  226. package/dist/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  227. package/dist/util/captcha/components/frictionlessCaptcha.js.map +0 -1
  228. package/dist/util/captcha/components/imageCaptcha.d.ts +0 -4
  229. package/dist/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  230. package/dist/util/captcha/components/imageCaptcha.js.map +0 -1
  231. package/dist/util/captcha/components/powCaptcha.d.ts +0 -4
  232. package/dist/util/captcha/components/powCaptcha.d.ts.map +0 -1
  233. package/dist/util/captcha/components/powCaptcha.js.map +0 -1
  234. package/dist/util/config.d.ts +0 -6
  235. package/dist/util/config.d.ts.map +0 -1
  236. package/dist/util/config.js.map +0 -1
  237. package/dist/util/configCreator.d.ts +0 -5
  238. package/dist/util/configCreator.d.ts.map +0 -1
  239. package/dist/util/configCreator.js.map +0 -1
  240. package/dist/util/language.d.ts +0 -3
  241. package/dist/util/language.d.ts.map +0 -1
  242. package/dist/util/language.js.map +0 -1
  243. package/dist/util/timeout.d.ts +0 -3
  244. package/dist/util/timeout.d.ts.map +0 -1
  245. package/dist/util/timeout.js.map +0 -1
  246. package/dist/util/widgetFactory.d.ts +0 -18
  247. package/dist/util/widgetFactory.d.ts.map +0 -1
  248. package/dist/util/widgetFactory.js.map +0 -1
  249. package/dist/util/widgetThemeResolver.d.ts +0 -9
  250. package/dist/util/widgetThemeResolver.d.ts.map +0 -1
  251. package/dist/util/widgetThemeResolver.js.map +0 -1
  252. package/stats.html +0 -4949
@@ -1,3972 +0,0 @@
1
- var $t = (n) => {
2
- throw TypeError(n);
3
- };
4
- var Nt = (n, e, t) => e.has(n) || $t("Cannot " + t);
5
- var j = (n, e, t) => (Nt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), me = (n, e, t) => e.has(n) ? $t("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ye = (n, e, t, r) => (Nt(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t);
6
- import { g as Hr } from "./bnChunk-DRlDxTFg.js";
7
- import { j as Vr } from "./nobleChunk-Bbltwf44.js";
8
- import { z as L, n as ke, o as y, b as Y, a as w, c as q, s as p, d as Br, u as _e, e as jt, f as Dt, g as Je, r as En, l as Ut } from "./zodChunk-CaINhWMQ.js";
9
- import { j as Kr, s as qr, n as zr, a as Wr, b as Jr, c as Xr, d as Yr, e as Gr, f as Qr, g as Zr, k as ei, h as On, i as Tn, l as je, m as ti, o as ni, p as ri, q as ii, r as oi } from "./utilCryptoChunk-B4ZdOwus.js";
10
- import { r as nt, b as ft, o as Ln, u as dt, a as Ft, t as si, i as ai, c as De, k as rt, s as Cn } from "./utilChunk-WRTGKXbU.js";
11
- function ui(n, e) {
12
- for (var t = 0; t < e.length; t++) {
13
- const r = e[t];
14
- if (typeof r != "string" && !Array.isArray(r)) {
15
- for (const i in r)
16
- if (i !== "default" && !(i in n)) {
17
- const o = Object.getOwnPropertyDescriptor(r, i);
18
- o && Object.defineProperty(n, i, o.get ? o : {
19
- enumerable: !0,
20
- get: () => r[i]
21
- });
22
- }
23
- }
24
- }
25
- return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
26
- }
27
- var h = /* @__PURE__ */ ((n) => (n.datasetId = "datasetId", n.user = "user", n.dapp = "dapp", n.provider = "provider", n.blockNumber = "blockNumber", n.requestHash = "requestHash", n.captchas = "captchas", n.commitmentId = "commitmentId", n.proof = "proof", n.dappSignature = "dappSignature", n.dappUserSignature = "dappUserSignature", n.providerUrl = "providerUrl", n.procaptchaResponse = "procaptcha-response", n.verifiedTimeout = "verifiedTimeout", n.maxVerifiedTime = "maxVerifiedTime", n.verified = "verified", n.status = "status", n.challenge = "challenge", n.difficulty = "difficulty", n.nonce = "nonce", n.timeouts = "timeouts", n.token = "token", n.secret = "secret", n.timestamp = "timestamp", n.signature = "signature", n.error = "error", n.siteKey = "siteKey", n.captchaType = "captchaType", n.sessionId = "sessionId", n.settings = "settings", n.domains = "domains", n.frictionlessThreshold = "frictionlessThreshold", n.powDifficulty = "powDifficulty", n.score = "score", n.tier = "tier", n.detectorKey = "detectorKey", n.ip = "ip", n.expirationInSeconds = "expirationInSeconds", n.enabled = "enabled", n.headHash = "headHash", n))(h || {}), St = /* @__PURE__ */ ((n) => (n.Free = "free", n.Professional = "professional", n.Enterprise = "enterprise", n))(St || {});
28
- L.nativeEnum(St);
29
- var Xe = /* @__PURE__ */ ((n) => (n.image = "image", n.pow = "pow", n.frictionless = "frictionless", n.invisible = "invisible", n))(Xe || {});
30
- L.nativeEnum(Xe);
31
- const li = ke(Xe), ci = Xe.frictionless, fi = [], di = 0.5, pi = 4, hi = 0.8;
32
- var Pn = /* @__PURE__ */ ((n) => (n.Allow = "allow", n.Reject = "reject", n.Flag = "flag", n))(Pn || {});
33
- const B = L.nativeEnum(Pn), gi = "allow", mi = "allow", yi = "allow", vi = 1e3, wi = 5e-3, bi = "reject", Si = "reject", xi = !1, Ei = y({
34
- actions: y({
35
- countryChangeAction: B.optional(),
36
- cityChangeAction: B.optional(),
37
- ispChangeAction: B.optional(),
38
- distanceExceedAction: B.optional(),
39
- abuseScoreExceedAction: B.optional()
40
- }).partial(),
41
- // all optional, so you can just override what you need
42
- distanceThresholdKm: w().positive().optional(),
43
- abuseScoreThreshold: w().positive().optional(),
44
- requireAllConditions: Y().optional()
45
- }), Oi = y({
46
- actions: y({
47
- countryChangeAction: B.optional().default(
48
- gi
49
- ),
50
- cityChangeAction: B.optional().default(
51
- mi
52
- ),
53
- ispChangeAction: B.optional().default(
54
- yi
55
- ),
56
- distanceExceedAction: B.optional().default(
57
- bi
58
- ),
59
- abuseScoreExceedAction: B.optional().default(
60
- Si
61
- )
62
- }),
63
- distanceThresholdKm: w().positive().optional().default(vi),
64
- abuseScoreThreshold: w().positive().optional().default(wi),
65
- requireAllConditions: L.boolean().optional().default(xi),
66
- // overrides are now lightweight, not recursive
67
- countryOverrides: L.record(p(), Ei).optional(),
68
- forceConsistentIp: Y().optional().default(!1)
69
- }), Ti = y({
70
- captchaType: li.optional().default(ci),
71
- domains: q(p()).optional().default([...fi]),
72
- frictionlessThreshold: w().optional().default(di),
73
- powDifficulty: w().optional().default(pi),
74
- imageThreshold: w().optional().default(hi),
75
- ipValidationRules: Oi.optional(),
76
- disallowWebView: Y().optional().default(!1)
77
- });
78
- let it;
79
- async function Ia(n) {
80
- return new Promise((e, t) => {
81
- try {
82
- Promise.resolve().then(() => ls).then(({ default: r }) => {
83
- it ? e(it) : it = r(e);
84
- });
85
- } catch (r) {
86
- t(r);
87
- }
88
- });
89
- }
90
- const kn = {
91
- arabic: "ar",
92
- azerbaijani: "az",
93
- czech: "cs",
94
- german: "de",
95
- greek: "el",
96
- english: "en",
97
- spanish: "es",
98
- finnish: "fi",
99
- french: "fr",
100
- hindi: "hi",
101
- hungarian: "hu",
102
- indonesian: "id",
103
- italian: "it",
104
- japanese: "ja",
105
- javanese: "jv",
106
- korean: "ko",
107
- malayalam: "ml",
108
- malay: "ms",
109
- dutch: "nl",
110
- norwegian: "no",
111
- polish: "pl",
112
- portugeseBrazil: "pt-BR",
113
- portuguese: "pt",
114
- romanian: "ro",
115
- russian: "ru",
116
- serbian: "sr",
117
- swedish: "sv",
118
- thai: "th",
119
- turkish: "tr",
120
- ukrainian: "uk",
121
- vietnamese: "vi",
122
- chinese: "zh-CN"
123
- }, In = L.enum(
124
- Object.values(kn)
125
- );
126
- var Rn = { exports: {} }, x = {};
127
- var Ie = Symbol.for("react.element"), Li = Symbol.for("react.portal"), Ci = Symbol.for("react.fragment"), Pi = Symbol.for("react.strict_mode"), ki = Symbol.for("react.profiler"), Ii = Symbol.for("react.provider"), Ri = Symbol.for("react.context"), Ai = Symbol.for("react.forward_ref"), $i = Symbol.for("react.suspense"), Ni = Symbol.for("react.memo"), ji = Symbol.for("react.lazy"), _t = Symbol.iterator;
128
- function Di(n) {
129
- return n === null || typeof n != "object" ? null : (n = _t && n[_t] || n["@@iterator"], typeof n == "function" ? n : null);
130
- }
131
- var An = { isMounted: function() {
132
- return !1;
133
- }, enqueueForceUpdate: function() {
134
- }, enqueueReplaceState: function() {
135
- }, enqueueSetState: function() {
136
- } }, $n = Object.assign, Nn = {};
137
- function pe(n, e, t) {
138
- this.props = n, this.context = e, this.refs = Nn, this.updater = t || An;
139
- }
140
- pe.prototype.isReactComponent = {};
141
- pe.prototype.setState = function(n, e) {
142
- if (typeof n != "object" && typeof n != "function" && n != null) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
143
- this.updater.enqueueSetState(this, n, e, "setState");
144
- };
145
- pe.prototype.forceUpdate = function(n) {
146
- this.updater.enqueueForceUpdate(this, n, "forceUpdate");
147
- };
148
- function jn() {
149
- }
150
- jn.prototype = pe.prototype;
151
- function xt(n, e, t) {
152
- this.props = n, this.context = e, this.refs = Nn, this.updater = t || An;
153
- }
154
- var Et = xt.prototype = new jn();
155
- Et.constructor = xt;
156
- $n(Et, pe.prototype);
157
- Et.isPureReactComponent = !0;
158
- var Mt = Array.isArray, Dn = Object.prototype.hasOwnProperty, Ot = { current: null }, Un = { key: !0, ref: !0, __self: !0, __source: !0 };
159
- function Fn(n, e, t) {
160
- var r, i = {}, o = null, s = null;
161
- if (e != null) for (r in e.ref !== void 0 && (s = e.ref), e.key !== void 0 && (o = "" + e.key), e) Dn.call(e, r) && !Un.hasOwnProperty(r) && (i[r] = e[r]);
162
- var a = arguments.length - 2;
163
- if (a === 1) i.children = t;
164
- else if (1 < a) {
165
- for (var u = Array(a), c = 0; c < a; c++) u[c] = arguments[c + 2];
166
- i.children = u;
167
- }
168
- if (n && n.defaultProps) for (r in a = n.defaultProps, a) i[r] === void 0 && (i[r] = a[r]);
169
- return { $$typeof: Ie, type: n, key: o, ref: s, props: i, _owner: Ot.current };
170
- }
171
- function Ui(n, e) {
172
- return { $$typeof: Ie, type: n.type, key: e, ref: n.ref, props: n.props, _owner: n._owner };
173
- }
174
- function Tt(n) {
175
- return typeof n == "object" && n !== null && n.$$typeof === Ie;
176
- }
177
- function Fi(n) {
178
- var e = { "=": "=0", ":": "=2" };
179
- return "$" + n.replace(/[=:]/g, function(t) {
180
- return e[t];
181
- });
182
- }
183
- var Ht = /\/+/g;
184
- function ot(n, e) {
185
- return typeof n == "object" && n !== null && n.key != null ? Fi("" + n.key) : e.toString(36);
186
- }
187
- function Ue(n, e, t, r, i) {
188
- var o = typeof n;
189
- (o === "undefined" || o === "boolean") && (n = null);
190
- var s = !1;
191
- if (n === null) s = !0;
192
- else switch (o) {
193
- case "string":
194
- case "number":
195
- s = !0;
196
- break;
197
- case "object":
198
- switch (n.$$typeof) {
199
- case Ie:
200
- case Li:
201
- s = !0;
202
- }
203
- }
204
- if (s) return s = n, i = i(s), n = r === "" ? "." + ot(s, 0) : r, Mt(i) ? (t = "", n != null && (t = n.replace(Ht, "$&/") + "/"), Ue(i, e, t, "", function(c) {
205
- return c;
206
- })) : i != null && (Tt(i) && (i = Ui(i, t + (!i.key || s && s.key === i.key ? "" : ("" + i.key).replace(Ht, "$&/") + "/") + n)), e.push(i)), 1;
207
- if (s = 0, r = r === "" ? "." : r + ":", Mt(n)) for (var a = 0; a < n.length; a++) {
208
- o = n[a];
209
- var u = r + ot(o, a);
210
- s += Ue(o, e, t, u, i);
211
- }
212
- else if (u = Di(n), typeof u == "function") for (n = u.call(n), a = 0; !(o = n.next()).done; ) o = o.value, u = r + ot(o, a++), s += Ue(o, e, t, u, i);
213
- else if (o === "object") throw e = String(n), Error("Objects are not valid as a React child (found: " + (e === "[object Object]" ? "object with keys {" + Object.keys(n).join(", ") + "}" : e) + "). If you meant to render a collection of children, use an array instead.");
214
- return s;
215
- }
216
- function $e(n, e, t) {
217
- if (n == null) return n;
218
- var r = [], i = 0;
219
- return Ue(n, r, "", "", function(o) {
220
- return e.call(t, o, i++);
221
- }), r;
222
- }
223
- function _i(n) {
224
- if (n._status === -1) {
225
- var e = n._result;
226
- e = e(), e.then(function(t) {
227
- (n._status === 0 || n._status === -1) && (n._status = 1, n._result = t);
228
- }, function(t) {
229
- (n._status === 0 || n._status === -1) && (n._status = 2, n._result = t);
230
- }), n._status === -1 && (n._status = 0, n._result = e);
231
- }
232
- if (n._status === 1) return n._result.default;
233
- throw n._result;
234
- }
235
- var A = { current: null }, Fe = { transition: null }, Mi = { ReactCurrentDispatcher: A, ReactCurrentBatchConfig: Fe, ReactCurrentOwner: Ot };
236
- function _n() {
237
- throw Error("act(...) is not supported in production builds of React.");
238
- }
239
- x.Children = { map: $e, forEach: function(n, e, t) {
240
- $e(n, function() {
241
- e.apply(this, arguments);
242
- }, t);
243
- }, count: function(n) {
244
- var e = 0;
245
- return $e(n, function() {
246
- e++;
247
- }), e;
248
- }, toArray: function(n) {
249
- return $e(n, function(e) {
250
- return e;
251
- }) || [];
252
- }, only: function(n) {
253
- if (!Tt(n)) throw Error("React.Children.only expected to receive a single React element child.");
254
- return n;
255
- } };
256
- x.Component = pe;
257
- x.Fragment = Ci;
258
- x.Profiler = ki;
259
- x.PureComponent = xt;
260
- x.StrictMode = Pi;
261
- x.Suspense = $i;
262
- x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Mi;
263
- x.act = _n;
264
- x.cloneElement = function(n, e, t) {
265
- if (n == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + n + ".");
266
- var r = $n({}, n.props), i = n.key, o = n.ref, s = n._owner;
267
- if (e != null) {
268
- if (e.ref !== void 0 && (o = e.ref, s = Ot.current), e.key !== void 0 && (i = "" + e.key), n.type && n.type.defaultProps) var a = n.type.defaultProps;
269
- for (u in e) Dn.call(e, u) && !Un.hasOwnProperty(u) && (r[u] = e[u] === void 0 && a !== void 0 ? a[u] : e[u]);
270
- }
271
- var u = arguments.length - 2;
272
- if (u === 1) r.children = t;
273
- else if (1 < u) {
274
- a = Array(u);
275
- for (var c = 0; c < u; c++) a[c] = arguments[c + 2];
276
- r.children = a;
277
- }
278
- return { $$typeof: Ie, type: n.type, key: i, ref: o, props: r, _owner: s };
279
- };
280
- x.createContext = function(n) {
281
- return n = { $$typeof: Ri, _currentValue: n, _currentValue2: n, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, n.Provider = { $$typeof: Ii, _context: n }, n.Consumer = n;
282
- };
283
- x.createElement = Fn;
284
- x.createFactory = function(n) {
285
- var e = Fn.bind(null, n);
286
- return e.type = n, e;
287
- };
288
- x.createRef = function() {
289
- return { current: null };
290
- };
291
- x.forwardRef = function(n) {
292
- return { $$typeof: Ai, render: n };
293
- };
294
- x.isValidElement = Tt;
295
- x.lazy = function(n) {
296
- return { $$typeof: ji, _payload: { _status: -1, _result: n }, _init: _i };
297
- };
298
- x.memo = function(n, e) {
299
- return { $$typeof: Ni, type: n, compare: e === void 0 ? null : e };
300
- };
301
- x.startTransition = function(n) {
302
- var e = Fe.transition;
303
- Fe.transition = {};
304
- try {
305
- n();
306
- } finally {
307
- Fe.transition = e;
308
- }
309
- };
310
- x.unstable_act = _n;
311
- x.useCallback = function(n, e) {
312
- return A.current.useCallback(n, e);
313
- };
314
- x.useContext = function(n) {
315
- return A.current.useContext(n);
316
- };
317
- x.useDebugValue = function() {
318
- };
319
- x.useDeferredValue = function(n) {
320
- return A.current.useDeferredValue(n);
321
- };
322
- x.useEffect = function(n, e) {
323
- return A.current.useEffect(n, e);
324
- };
325
- x.useId = function() {
326
- return A.current.useId();
327
- };
328
- x.useImperativeHandle = function(n, e, t) {
329
- return A.current.useImperativeHandle(n, e, t);
330
- };
331
- x.useInsertionEffect = function(n, e) {
332
- return A.current.useInsertionEffect(n, e);
333
- };
334
- x.useLayoutEffect = function(n, e) {
335
- return A.current.useLayoutEffect(n, e);
336
- };
337
- x.useMemo = function(n, e) {
338
- return A.current.useMemo(n, e);
339
- };
340
- x.useReducer = function(n, e, t) {
341
- return A.current.useReducer(n, e, t);
342
- };
343
- x.useRef = function(n) {
344
- return A.current.useRef(n);
345
- };
346
- x.useState = function(n) {
347
- return A.current.useState(n);
348
- };
349
- x.useSyncExternalStore = function(n, e, t) {
350
- return A.current.useSyncExternalStore(n, e, t);
351
- };
352
- x.useTransition = function() {
353
- return A.current.useTransition();
354
- };
355
- x.version = "18.3.1";
356
- Rn.exports = x;
357
- var F = Rn.exports;
358
- const Hi = /* @__PURE__ */ Hr(F), Ra = /* @__PURE__ */ ui({
359
- __proto__: null,
360
- default: Hi
361
- }, [F]), Vi = (n, e, t, r) => {
362
- var o, s, a, u;
363
- const i = [t, {
364
- code: e,
365
- ...r || {}
366
- }];
367
- if ((s = (o = n == null ? void 0 : n.services) == null ? void 0 : o.logger) != null && s.forward)
368
- return n.services.logger.forward(i, "warn", "react-i18next::", !0);
369
- te(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), (u = (a = n == null ? void 0 : n.services) == null ? void 0 : a.logger) != null && u.warn ? n.services.logger.warn(...i) : console != null && console.warn && [...i];
370
- }, Vt = {}, pt = (n, e, t, r) => {
371
- te(t) && Vt[t] || (te(t) && (Vt[t] = /* @__PURE__ */ new Date()), Vi(n, e, t, r));
372
- }, Mn = (n, e) => () => {
373
- if (n.isInitialized)
374
- e();
375
- else {
376
- const t = () => {
377
- setTimeout(() => {
378
- n.off("initialized", t);
379
- }, 0), e();
380
- };
381
- n.on("initialized", t);
382
- }
383
- }, ht = (n, e, t) => {
384
- n.loadNamespaces(e, Mn(n, t));
385
- }, Bt = (n, e, t, r) => {
386
- if (te(t) && (t = [t]), n.options.preload && n.options.preload.indexOf(e) > -1) return ht(n, t, r);
387
- t.forEach((i) => {
388
- n.options.ns.indexOf(i) < 0 && n.options.ns.push(i);
389
- }), n.loadLanguages(e, Mn(n, r));
390
- }, Bi = (n, e, t = {}) => !e.languages || !e.languages.length ? (pt(e, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
391
- languages: e.languages
392
- }), !0) : e.hasLoadedNamespace(n, {
393
- lng: t.lng,
394
- precheck: (r, i) => {
395
- var o;
396
- if (((o = t.bindI18n) == null ? void 0 : o.indexOf("languageChanging")) > -1 && r.services.backendConnector.backend && r.isLanguageChangingTo && !i(r.isLanguageChangingTo, n)) return !1;
397
- }
398
- }), te = (n) => typeof n == "string", Ki = (n) => typeof n == "object" && n !== null, qi = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, zi = {
399
- "&amp;": "&",
400
- "&#38;": "&",
401
- "&lt;": "<",
402
- "&#60;": "<",
403
- "&gt;": ">",
404
- "&#62;": ">",
405
- "&apos;": "'",
406
- "&#39;": "'",
407
- "&quot;": '"',
408
- "&#34;": '"',
409
- "&nbsp;": " ",
410
- "&#160;": " ",
411
- "&copy;": "©",
412
- "&#169;": "©",
413
- "&reg;": "®",
414
- "&#174;": "®",
415
- "&hellip;": "…",
416
- "&#8230;": "…",
417
- "&#x2F;": "/",
418
- "&#47;": "/"
419
- }, Wi = (n) => zi[n], Ji = (n) => n.replace(qi, Wi);
420
- let gt = {
421
- bindI18n: "languageChanged",
422
- bindI18nStore: "",
423
- transEmptyNodeValue: "",
424
- transSupportBasicHtmlNodes: !0,
425
- transWrapTextNodes: "",
426
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
427
- useSuspense: !0,
428
- unescape: Ji
429
- };
430
- const Xi = (n = {}) => {
431
- gt = {
432
- ...gt,
433
- ...n
434
- };
435
- }, Yi = () => gt;
436
- let Hn;
437
- const Gi = (n) => {
438
- Hn = n;
439
- }, Qi = () => Hn, Zi = {
440
- type: "3rdParty",
441
- init(n) {
442
- Xi(n.options.react), Gi(n);
443
- }
444
- }, eo = F.createContext();
445
- class to {
446
- constructor() {
447
- this.usedNamespaces = {};
448
- }
449
- addUsedNamespaces(e) {
450
- e.forEach((t) => {
451
- this.usedNamespaces[t] || (this.usedNamespaces[t] = !0);
452
- });
453
- }
454
- getUsedNamespaces() {
455
- return Object.keys(this.usedNamespaces);
456
- }
457
- }
458
- const no = (n, e) => {
459
- const t = F.useRef();
460
- return F.useEffect(() => {
461
- t.current = n;
462
- }, [n, e]), t.current;
463
- }, Vn = (n, e, t, r) => n.getFixedT(e, t, r), ro = (n, e, t, r) => F.useCallback(Vn(n, e, t, r), [n, e, t, r]), io = (n, e = {}) => {
464
- var $, J, X, k;
465
- const {
466
- i18n: t
467
- } = e, {
468
- i18n: r,
469
- defaultNS: i
470
- } = F.useContext(eo) || {}, o = t || r || Qi();
471
- if (o && !o.reportNamespaces && (o.reportNamespaces = new to()), !o) {
472
- pt(o, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
473
- const E = (R, T) => te(T) ? T : Ki(T) && te(T.defaultValue) ? T.defaultValue : Array.isArray(R) ? R[R.length - 1] : R, I = [E, {}, !1];
474
- return I.t = E, I.i18n = {}, I.ready = !1, I;
475
- }
476
- ($ = o.options.react) != null && $.wait && pt(o, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
477
- const s = {
478
- ...Yi(),
479
- ...o.options.react,
480
- ...e
481
- }, {
482
- useSuspense: a,
483
- keyPrefix: u
484
- } = s;
485
- let c = n || i || ((J = o.options) == null ? void 0 : J.defaultNS);
486
- c = te(c) ? [c] : c || ["translation"], (k = (X = o.reportNamespaces).addUsedNamespaces) == null || k.call(X, c);
487
- const l = (o.isInitialized || o.initializedStoreOnce) && c.every((E) => Bi(E, o, s)), f = ro(o, e.lng || null, s.nsMode === "fallback" ? c : c[0], u), d = () => f, g = () => Vn(o, e.lng || null, s.nsMode === "fallback" ? c : c[0], u), [m, v] = F.useState(d);
488
- let b = c.join();
489
- e.lng && (b = `${e.lng}${b}`);
490
- const P = no(b), O = F.useRef(!0);
491
- F.useEffect(() => {
492
- const {
493
- bindI18n: E,
494
- bindI18nStore: I
495
- } = s;
496
- O.current = !0, !l && !a && (e.lng ? Bt(o, e.lng, c, () => {
497
- O.current && v(g);
498
- }) : ht(o, c, () => {
499
- O.current && v(g);
500
- })), l && P && P !== b && O.current && v(g);
501
- const R = () => {
502
- O.current && v(g);
503
- };
504
- return E && (o == null || o.on(E, R)), I && (o == null || o.store.on(I, R)), () => {
505
- O.current = !1, o && (E == null || E.split(" ").forEach((T) => o.off(T, R))), I && o && I.split(" ").forEach((T) => o.store.off(T, R));
506
- };
507
- }, [o, b]), F.useEffect(() => {
508
- O.current && l && v(d);
509
- }, [o, u, l]);
510
- const C = [m, o, l];
511
- if (C.t = m, C.i18n = o, C.ready = l, l || !l && !a) return C;
512
- throw new Promise((E) => {
513
- e.lng ? Bt(o, e.lng, c, () => E()) : ht(o, c, () => E());
514
- });
515
- }, S = (n) => typeof n == "string", ve = () => {
516
- let n, e;
517
- const t = new Promise((r, i) => {
518
- n = r, e = i;
519
- });
520
- return t.resolve = n, t.reject = e, t;
521
- }, Kt = (n) => n == null ? "" : "" + n, oo = (n, e, t) => {
522
- n.forEach((r) => {
523
- e[r] && (t[r] = e[r]);
524
- });
525
- }, so = /###/g, qt = (n) => n && n.indexOf("###") > -1 ? n.replace(so, ".") : n, zt = (n) => !n || S(n), Ee = (n, e, t) => {
526
- const r = S(e) ? e.split(".") : e;
527
- let i = 0;
528
- for (; i < r.length - 1; ) {
529
- if (zt(n)) return {};
530
- const o = qt(r[i]);
531
- !n[o] && t && (n[o] = new t()), Object.prototype.hasOwnProperty.call(n, o) ? n = n[o] : n = {}, ++i;
532
- }
533
- return zt(n) ? {} : {
534
- obj: n,
535
- k: qt(r[i])
536
- };
537
- }, Wt = (n, e, t) => {
538
- const {
539
- obj: r,
540
- k: i
541
- } = Ee(n, e, Object);
542
- if (r !== void 0 || e.length === 1) {
543
- r[i] = t;
544
- return;
545
- }
546
- let o = e[e.length - 1], s = e.slice(0, e.length - 1), a = Ee(n, s, Object);
547
- for (; a.obj === void 0 && s.length; )
548
- o = `${s[s.length - 1]}.${o}`, s = s.slice(0, s.length - 1), a = Ee(n, s, Object), a != null && a.obj && typeof a.obj[`${a.k}.${o}`] < "u" && (a.obj = void 0);
549
- a.obj[`${a.k}.${o}`] = t;
550
- }, ao = (n, e, t, r) => {
551
- const {
552
- obj: i,
553
- k: o
554
- } = Ee(n, e, Object);
555
- i[o] = i[o] || [], i[o].push(t);
556
- }, Me = (n, e) => {
557
- const {
558
- obj: t,
559
- k: r
560
- } = Ee(n, e);
561
- if (t && Object.prototype.hasOwnProperty.call(t, r))
562
- return t[r];
563
- }, uo = (n, e, t) => {
564
- const r = Me(n, t);
565
- return r !== void 0 ? r : Me(e, t);
566
- }, Bn = (n, e, t) => {
567
- for (const r in e)
568
- r !== "__proto__" && r !== "constructor" && (r in n ? S(n[r]) || n[r] instanceof String || S(e[r]) || e[r] instanceof String ? t && (n[r] = e[r]) : Bn(n[r], e[r], t) : n[r] = e[r]);
569
- return n;
570
- }, ie = (n) => n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
571
- var lo = {
572
- "&": "&amp;",
573
- "<": "&lt;",
574
- ">": "&gt;",
575
- '"': "&quot;",
576
- "'": "&#39;",
577
- "/": "&#x2F;"
578
- };
579
- const co = (n) => S(n) ? n.replace(/[&<>"'\/]/g, (e) => lo[e]) : n;
580
- class fo {
581
- constructor(e) {
582
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
583
- }
584
- getRegExp(e) {
585
- const t = this.regExpMap.get(e);
586
- if (t !== void 0)
587
- return t;
588
- const r = new RegExp(e);
589
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, r), this.regExpQueue.push(e), r;
590
- }
591
- }
592
- const po = [" ", ",", "?", "!", ";"], ho = new fo(20), go = (n, e, t) => {
593
- e = e || "", t = t || "";
594
- const r = po.filter((s) => e.indexOf(s) < 0 && t.indexOf(s) < 0);
595
- if (r.length === 0) return !0;
596
- const i = ho.getRegExp(`(${r.map((s) => s === "?" ? "\\?" : s).join("|")})`);
597
- let o = !i.test(n);
598
- if (!o) {
599
- const s = n.indexOf(t);
600
- s > 0 && !i.test(n.substring(0, s)) && (o = !0);
601
- }
602
- return o;
603
- }, mt = function(n, e) {
604
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
605
- if (!n) return;
606
- if (n[e])
607
- return Object.prototype.hasOwnProperty.call(n, e) ? n[e] : void 0;
608
- const r = e.split(t);
609
- let i = n;
610
- for (let o = 0; o < r.length; ) {
611
- if (!i || typeof i != "object")
612
- return;
613
- let s, a = "";
614
- for (let u = o; u < r.length; ++u)
615
- if (u !== o && (a += t), a += r[u], s = i[a], s !== void 0) {
616
- if (["string", "number", "boolean"].indexOf(typeof s) > -1 && u < r.length - 1)
617
- continue;
618
- o += u - o + 1;
619
- break;
620
- }
621
- i = s;
622
- }
623
- return i;
624
- }, He = (n) => n == null ? void 0 : n.replace("_", "-"), mo = {
625
- type: "logger",
626
- log(n) {
627
- this.output("log", n);
628
- },
629
- warn(n) {
630
- this.output("warn", n);
631
- },
632
- error(n) {
633
- this.output("error", n);
634
- },
635
- output(n, e) {
636
- var t, r;
637
- (r = (t = console == null ? void 0 : console[n]) == null ? void 0 : t.apply) == null || r.call(t, console, e);
638
- }
639
- };
640
- class Ve {
641
- constructor(e) {
642
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
643
- this.init(e, t);
644
- }
645
- init(e) {
646
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
647
- this.prefix = t.prefix || "i18next:", this.logger = e || mo, this.options = t, this.debug = t.debug;
648
- }
649
- log() {
650
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
651
- t[r] = arguments[r];
652
- return this.forward(t, "log", "", !0);
653
- }
654
- warn() {
655
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
656
- t[r] = arguments[r];
657
- return this.forward(t, "warn", "", !0);
658
- }
659
- error() {
660
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
661
- t[r] = arguments[r];
662
- return this.forward(t, "error", "");
663
- }
664
- deprecate() {
665
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
666
- t[r] = arguments[r];
667
- return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
668
- }
669
- forward(e, t, r, i) {
670
- return i && !this.debug ? null : (S(e[0]) && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[t](e));
671
- }
672
- create(e) {
673
- return new Ve(this.logger, {
674
- prefix: `${this.prefix}:${e}:`,
675
- ...this.options
676
- });
677
- }
678
- clone(e) {
679
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new Ve(this.logger, e);
680
- }
681
- }
682
- var K = new Ve();
683
- class Ye {
684
- constructor() {
685
- this.observers = {};
686
- }
687
- on(e, t) {
688
- return e.split(" ").forEach((r) => {
689
- this.observers[r] || (this.observers[r] = /* @__PURE__ */ new Map());
690
- const i = this.observers[r].get(t) || 0;
691
- this.observers[r].set(t, i + 1);
692
- }), this;
693
- }
694
- off(e, t) {
695
- if (this.observers[e]) {
696
- if (!t) {
697
- delete this.observers[e];
698
- return;
699
- }
700
- this.observers[e].delete(t);
701
- }
702
- }
703
- emit(e) {
704
- for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
705
- r[i - 1] = arguments[i];
706
- this.observers[e] && Array.from(this.observers[e].entries()).forEach((s) => {
707
- let [a, u] = s;
708
- for (let c = 0; c < u; c++)
709
- a(...r);
710
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((s) => {
711
- let [a, u] = s;
712
- for (let c = 0; c < u; c++)
713
- a.apply(a, [e, ...r]);
714
- });
715
- }
716
- }
717
- class Jt extends Ye {
718
- constructor(e) {
719
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
720
- ns: ["translation"],
721
- defaultNS: "translation"
722
- };
723
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
724
- }
725
- addNamespaces(e) {
726
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
727
- }
728
- removeNamespaces(e) {
729
- const t = this.options.ns.indexOf(e);
730
- t > -1 && this.options.ns.splice(t, 1);
731
- }
732
- getResource(e, t, r) {
733
- var c, l;
734
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
735
- const o = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, s = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
736
- let a;
737
- e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], r && (Array.isArray(r) ? a.push(...r) : S(r) && o ? a.push(...r.split(o)) : a.push(r)));
738
- const u = Me(this.data, a);
739
- return !u && !t && !r && e.indexOf(".") > -1 && (e = a[0], t = a[1], r = a.slice(2).join(".")), u || !s || !S(r) ? u : mt((l = (c = this.data) == null ? void 0 : c[e]) == null ? void 0 : l[t], r, o);
740
- }
741
- addResource(e, t, r, i) {
742
- let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
743
- silent: !1
744
- };
745
- const s = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator;
746
- let a = [e, t];
747
- r && (a = a.concat(s ? r.split(s) : r)), e.indexOf(".") > -1 && (a = e.split("."), i = t, t = a[1]), this.addNamespaces(t), Wt(this.data, a, i), o.silent || this.emit("added", e, t, r, i);
748
- }
749
- addResources(e, t, r) {
750
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
751
- silent: !1
752
- };
753
- for (const o in r)
754
- (S(r[o]) || Array.isArray(r[o])) && this.addResource(e, t, o, r[o], {
755
- silent: !0
756
- });
757
- i.silent || this.emit("added", e, t, r);
758
- }
759
- addResourceBundle(e, t, r, i, o) {
760
- let s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
761
- silent: !1,
762
- skipCopy: !1
763
- }, a = [e, t];
764
- e.indexOf(".") > -1 && (a = e.split("."), i = r, r = t, t = a[1]), this.addNamespaces(t);
765
- let u = Me(this.data, a) || {};
766
- s.skipCopy || (r = JSON.parse(JSON.stringify(r))), i ? Bn(u, r, o) : u = {
767
- ...u,
768
- ...r
769
- }, Wt(this.data, a, u), s.silent || this.emit("added", e, t, r);
770
- }
771
- removeResourceBundle(e, t) {
772
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
773
- }
774
- hasResourceBundle(e, t) {
775
- return this.getResource(e, t) !== void 0;
776
- }
777
- getResourceBundle(e, t) {
778
- return t || (t = this.options.defaultNS), this.getResource(e, t);
779
- }
780
- getDataByLanguage(e) {
781
- return this.data[e];
782
- }
783
- hasLanguageSomeTranslations(e) {
784
- const t = this.getDataByLanguage(e);
785
- return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
786
- }
787
- toJSON() {
788
- return this.data;
789
- }
790
- }
791
- var Kn = {
792
- processors: {},
793
- addPostProcessor(n) {
794
- this.processors[n.name] = n;
795
- },
796
- handle(n, e, t, r, i) {
797
- return n.forEach((o) => {
798
- var s;
799
- e = ((s = this.processors[o]) == null ? void 0 : s.process(e, t, r, i)) ?? e;
800
- }), e;
801
- }
802
- };
803
- const Xt = {}, Yt = (n) => !S(n) && typeof n != "boolean" && typeof n != "number";
804
- class Be extends Ye {
805
- constructor(e) {
806
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
807
- super(), oo(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = K.create("translator");
808
- }
809
- changeLanguage(e) {
810
- e && (this.language = e);
811
- }
812
- exists(e) {
813
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
814
- interpolation: {}
815
- };
816
- if (e == null)
817
- return !1;
818
- const r = this.resolve(e, t);
819
- return (r == null ? void 0 : r.res) !== void 0;
820
- }
821
- extractFromKey(e, t) {
822
- let r = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
823
- r === void 0 && (r = ":");
824
- const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
825
- let o = t.ns || this.options.defaultNS || [];
826
- const s = r && e.indexOf(r) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !go(e, r, i);
827
- if (s && !a) {
828
- const u = e.match(this.interpolator.nestingRegexp);
829
- if (u && u.length > 0)
830
- return {
831
- key: e,
832
- namespaces: S(o) ? [o] : o
833
- };
834
- const c = e.split(r);
835
- (r !== i || r === i && this.options.ns.indexOf(c[0]) > -1) && (o = c.shift()), e = c.join(i);
836
- }
837
- return {
838
- key: e,
839
- namespaces: S(o) ? [o] : o
840
- };
841
- }
842
- translate(e, t, r) {
843
- if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
844
- ...t
845
- }), t || (t = {}), e == null) return "";
846
- Array.isArray(e) || (e = [String(e)]);
847
- const i = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, o = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
848
- key: s,
849
- namespaces: a
850
- } = this.extractFromKey(e[e.length - 1], t), u = a[a.length - 1], c = t.lng || this.language, l = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
851
- if ((c == null ? void 0 : c.toLowerCase()) === "cimode") {
852
- if (l) {
853
- const T = t.nsSeparator || this.options.nsSeparator;
854
- return i ? {
855
- res: `${u}${T}${s}`,
856
- usedKey: s,
857
- exactUsedKey: s,
858
- usedLng: c,
859
- usedNS: u,
860
- usedParams: this.getUsedParamsDetails(t)
861
- } : `${u}${T}${s}`;
862
- }
863
- return i ? {
864
- res: s,
865
- usedKey: s,
866
- exactUsedKey: s,
867
- usedLng: c,
868
- usedNS: u,
869
- usedParams: this.getUsedParamsDetails(t)
870
- } : s;
871
- }
872
- const f = this.resolve(e, t);
873
- let d = f == null ? void 0 : f.res;
874
- const g = (f == null ? void 0 : f.usedKey) || s, m = (f == null ? void 0 : f.exactUsedKey) || s, v = ["[object Number]", "[object Function]", "[object RegExp]"], b = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, P = !this.i18nFormat || this.i18nFormat.handleAsObject, O = t.count !== void 0 && !S(t.count), C = Be.hasDefaultValue(t), $ = O ? this.pluralResolver.getSuffix(c, t.count, t) : "", J = t.ordinal && O ? this.pluralResolver.getSuffix(c, t.count, {
875
- ordinal: !1
876
- }) : "", X = O && !t.ordinal && t.count === 0, k = X && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${$}`] || t[`defaultValue${J}`] || t.defaultValue;
877
- let E = d;
878
- P && !d && C && (E = k);
879
- const I = Yt(E), R = Object.prototype.toString.apply(E);
880
- if (P && E && I && v.indexOf(R) < 0 && !(S(b) && Array.isArray(E))) {
881
- if (!t.returnObjects && !this.options.returnObjects) {
882
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
883
- const T = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, E, {
884
- ...t,
885
- ns: a
886
- }) : `key '${s} (${this.language})' returned an object instead of string.`;
887
- return i ? (f.res = T, f.usedParams = this.getUsedParamsDetails(t), f) : T;
888
- }
889
- if (o) {
890
- const T = Array.isArray(E), U = T ? [] : {}, kt = T ? m : g;
891
- for (const _ in E)
892
- if (Object.prototype.hasOwnProperty.call(E, _)) {
893
- const z = `${kt}${o}${_}`;
894
- C && !d ? U[_] = this.translate(z, {
895
- ...t,
896
- defaultValue: Yt(k) ? k[_] : void 0,
897
- joinArrays: !1,
898
- ns: a
899
- }) : U[_] = this.translate(z, {
900
- ...t,
901
- joinArrays: !1,
902
- ns: a
903
- }), U[_] === z && (U[_] = E[_]);
904
- }
905
- d = U;
906
- }
907
- } else if (P && S(b) && Array.isArray(d))
908
- d = d.join(b), d && (d = this.extendTranslation(d, e, t, r));
909
- else {
910
- let T = !1, U = !1;
911
- !this.isValidLookup(d) && C && (T = !0, d = k), this.isValidLookup(d) || (U = !0, d = s);
912
- const _ = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && U ? void 0 : d, z = C && k !== d && this.options.updateMissing;
913
- if (U || T || z) {
914
- if (this.logger.log(z ? "updateKey" : "missingKey", c, u, s, z ? k : d), o) {
915
- const N = this.resolve(s, {
916
- ...t,
917
- keySeparator: !1
918
- });
919
- N && N.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.");
920
- }
921
- let he = [];
922
- const Ae = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
923
- if (this.options.saveMissingTo === "fallback" && Ae && Ae[0])
924
- for (let N = 0; N < Ae.length; N++)
925
- he.push(Ae[N]);
926
- else this.options.saveMissingTo === "all" ? he = this.languageUtils.toResolveHierarchy(t.lng || this.language) : he.push(t.lng || this.language);
927
- const It = (N, Z, ge) => {
928
- var At;
929
- const Rt = C && ge !== d ? ge : _;
930
- this.options.missingKeyHandler ? this.options.missingKeyHandler(N, u, Z, Rt, z, t) : (At = this.backendConnector) != null && At.saveMissing && this.backendConnector.saveMissing(N, u, Z, Rt, z, t), this.emit("missingKey", N, u, Z, d);
931
- };
932
- this.options.saveMissing && (this.options.saveMissingPlurals && O ? he.forEach((N) => {
933
- const Z = this.pluralResolver.getSuffixes(N, t);
934
- X && t[`defaultValue${this.options.pluralSeparator}zero`] && Z.indexOf(`${this.options.pluralSeparator}zero`) < 0 && Z.push(`${this.options.pluralSeparator}zero`), Z.forEach((ge) => {
935
- It([N], s + ge, t[`defaultValue${ge}`] || k);
936
- });
937
- }) : It(he, s, k));
938
- }
939
- d = this.extendTranslation(d, e, t, f, r), U && d === s && this.options.appendNamespaceToMissingKey && (d = `${u}:${s}`), (U || T) && this.options.parseMissingKeyHandler && (d = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}:${s}` : s, T ? d : void 0));
940
- }
941
- return i ? (f.res = d, f.usedParams = this.getUsedParamsDetails(t), f) : d;
942
- }
943
- extendTranslation(e, t, r, i, o) {
944
- var c, l;
945
- var s = this;
946
- if ((c = this.i18nFormat) != null && c.parse)
947
- e = this.i18nFormat.parse(e, {
948
- ...this.options.interpolation.defaultVariables,
949
- ...r
950
- }, r.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
951
- resolved: i
952
- });
953
- else if (!r.skipInterpolation) {
954
- r.interpolation && this.interpolator.init({
955
- ...r,
956
- interpolation: {
957
- ...this.options.interpolation,
958
- ...r.interpolation
959
- }
960
- });
961
- const f = S(e) && (((l = r == null ? void 0 : r.interpolation) == null ? void 0 : l.skipOnVariables) !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
962
- let d;
963
- if (f) {
964
- const m = e.match(this.interpolator.nestingRegexp);
965
- d = m && m.length;
966
- }
967
- let g = r.replace && !S(r.replace) ? r.replace : r;
968
- if (this.options.interpolation.defaultVariables && (g = {
969
- ...this.options.interpolation.defaultVariables,
970
- ...g
971
- }), e = this.interpolator.interpolate(e, g, r.lng || this.language || i.usedLng, r), f) {
972
- const m = e.match(this.interpolator.nestingRegexp), v = m && m.length;
973
- d < v && (r.nest = !1);
974
- }
975
- !r.lng && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, function() {
976
- for (var m = arguments.length, v = new Array(m), b = 0; b < m; b++)
977
- v[b] = arguments[b];
978
- return (o == null ? void 0 : o[0]) === v[0] && !r.context ? (s.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${t[0]}`), null) : s.translate(...v, t);
979
- }, r)), r.interpolation && this.interpolator.reset();
980
- }
981
- const a = r.postProcess || this.options.postProcess, u = S(a) ? [a] : a;
982
- return e != null && (u != null && u.length) && r.applyPostProcessor !== !1 && (e = Kn.handle(u, e, t, this.options && this.options.postProcessPassResolved ? {
983
- i18nResolved: {
984
- ...i,
985
- usedParams: this.getUsedParamsDetails(r)
986
- },
987
- ...r
988
- } : r, this)), e;
989
- }
990
- resolve(e) {
991
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r, i, o, s, a;
992
- return S(e) && (e = [e]), e.forEach((u) => {
993
- if (this.isValidLookup(r)) return;
994
- const c = this.extractFromKey(u, t), l = c.key;
995
- i = l;
996
- let f = c.namespaces;
997
- this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
998
- const d = t.count !== void 0 && !S(t.count), g = d && !t.ordinal && t.count === 0, m = t.context !== void 0 && (S(t.context) || typeof t.context == "number") && t.context !== "", v = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
999
- f.forEach((b) => {
1000
- var P, O;
1001
- this.isValidLookup(r) || (a = b, !Xt[`${v[0]}-${b}`] && ((P = this.utils) != null && P.hasLoadedNamespace) && !((O = this.utils) != null && O.hasLoadedNamespace(a)) && (Xt[`${v[0]}-${b}`] = !0, this.logger.warn(`key "${i}" for languages "${v.join(", ")}" won't get resolved as namespace "${a}" 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!!!")), v.forEach((C) => {
1002
- var X;
1003
- if (this.isValidLookup(r)) return;
1004
- s = C;
1005
- const $ = [l];
1006
- if ((X = this.i18nFormat) != null && X.addLookupKeys)
1007
- this.i18nFormat.addLookupKeys($, l, C, b, t);
1008
- else {
1009
- let k;
1010
- d && (k = this.pluralResolver.getSuffix(C, t.count, t));
1011
- const E = `${this.options.pluralSeparator}zero`, I = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
1012
- if (d && ($.push(l + k), t.ordinal && k.indexOf(I) === 0 && $.push(l + k.replace(I, this.options.pluralSeparator)), g && $.push(l + E)), m) {
1013
- const R = `${l}${this.options.contextSeparator}${t.context}`;
1014
- $.push(R), d && ($.push(R + k), t.ordinal && k.indexOf(I) === 0 && $.push(R + k.replace(I, this.options.pluralSeparator)), g && $.push(R + E));
1015
- }
1016
- }
1017
- let J;
1018
- for (; J = $.pop(); )
1019
- this.isValidLookup(r) || (o = J, r = this.getResource(C, b, J, t));
1020
- }));
1021
- });
1022
- }), {
1023
- res: r,
1024
- usedKey: i,
1025
- exactUsedKey: o,
1026
- usedLng: s,
1027
- usedNS: a
1028
- };
1029
- }
1030
- isValidLookup(e) {
1031
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
1032
- }
1033
- getResource(e, t, r) {
1034
- var o;
1035
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1036
- return (o = this.i18nFormat) != null && o.getResource ? this.i18nFormat.getResource(e, t, r, i) : this.resourceStore.getResource(e, t, r, i);
1037
- }
1038
- getUsedParamsDetails() {
1039
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1040
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = e.replace && !S(e.replace);
1041
- let i = r ? e.replace : e;
1042
- if (r && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
1043
- ...this.options.interpolation.defaultVariables,
1044
- ...i
1045
- }), !r) {
1046
- i = {
1047
- ...i
1048
- };
1049
- for (const o of t)
1050
- delete i[o];
1051
- }
1052
- return i;
1053
- }
1054
- static hasDefaultValue(e) {
1055
- const t = "defaultValue";
1056
- for (const r in e)
1057
- if (Object.prototype.hasOwnProperty.call(e, r) && t === r.substring(0, t.length) && e[r] !== void 0)
1058
- return !0;
1059
- return !1;
1060
- }
1061
- }
1062
- class Gt {
1063
- constructor(e) {
1064
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = K.create("languageUtils");
1065
- }
1066
- getScriptPartFromCode(e) {
1067
- if (e = He(e), !e || e.indexOf("-") < 0) return null;
1068
- const t = e.split("-");
1069
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
1070
- }
1071
- getLanguagePartFromCode(e) {
1072
- if (e = He(e), !e || e.indexOf("-") < 0) return e;
1073
- const t = e.split("-");
1074
- return this.formatLanguageCode(t[0]);
1075
- }
1076
- formatLanguageCode(e) {
1077
- if (S(e) && e.indexOf("-") > -1) {
1078
- let t;
1079
- try {
1080
- t = Intl.getCanonicalLocales(e)[0];
1081
- } catch {
1082
- }
1083
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
1084
- }
1085
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
1086
- }
1087
- isSupportedCode(e) {
1088
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
1089
- }
1090
- getBestMatchFromCodes(e) {
1091
- if (!e) return null;
1092
- let t;
1093
- return e.forEach((r) => {
1094
- if (t) return;
1095
- const i = this.formatLanguageCode(r);
1096
- (!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
1097
- }), !t && this.options.supportedLngs && e.forEach((r) => {
1098
- if (t) return;
1099
- const i = this.getLanguagePartFromCode(r);
1100
- if (this.isSupportedCode(i)) return t = i;
1101
- t = this.options.supportedLngs.find((o) => {
1102
- if (o === i) return o;
1103
- if (!(o.indexOf("-") < 0 && i.indexOf("-") < 0) && (o.indexOf("-") > 0 && i.indexOf("-") < 0 && o.substring(0, o.indexOf("-")) === i || o.indexOf(i) === 0 && i.length > 1))
1104
- return o;
1105
- });
1106
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
1107
- }
1108
- getFallbackCodes(e, t) {
1109
- if (!e) return [];
1110
- if (typeof e == "function" && (e = e(t)), S(e) && (e = [e]), Array.isArray(e)) return e;
1111
- if (!t) return e.default || [];
1112
- let r = e[t];
1113
- return r || (r = e[this.getScriptPartFromCode(t)]), r || (r = e[this.formatLanguageCode(t)]), r || (r = e[this.getLanguagePartFromCode(t)]), r || (r = e.default), r || [];
1114
- }
1115
- toResolveHierarchy(e, t) {
1116
- const r = this.getFallbackCodes(t || this.options.fallbackLng || [], e), i = [], o = (s) => {
1117
- s && (this.isSupportedCode(s) ? i.push(s) : this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`));
1118
- };
1119
- return S(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && o(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && o(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && o(this.getLanguagePartFromCode(e))) : S(e) && o(this.formatLanguageCode(e)), r.forEach((s) => {
1120
- i.indexOf(s) < 0 && o(this.formatLanguageCode(s));
1121
- }), i;
1122
- }
1123
- }
1124
- const Qt = {
1125
- zero: 0,
1126
- one: 1,
1127
- two: 2,
1128
- few: 3,
1129
- many: 4,
1130
- other: 5
1131
- }, Zt = {
1132
- select: (n) => n === 1 ? "one" : "other",
1133
- resolvedOptions: () => ({
1134
- pluralCategories: ["one", "other"]
1135
- })
1136
- };
1137
- class yo {
1138
- constructor(e) {
1139
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1140
- this.languageUtils = e, this.options = t, this.logger = K.create("pluralResolver"), this.pluralRulesCache = {};
1141
- }
1142
- addRule(e, t) {
1143
- this.rules[e] = t;
1144
- }
1145
- clearCache() {
1146
- this.pluralRulesCache = {};
1147
- }
1148
- getRule(e) {
1149
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1150
- const r = He(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", o = JSON.stringify({
1151
- cleanedCode: r,
1152
- type: i
1153
- });
1154
- if (o in this.pluralRulesCache)
1155
- return this.pluralRulesCache[o];
1156
- let s;
1157
- try {
1158
- s = new Intl.PluralRules(r, {
1159
- type: i
1160
- });
1161
- } catch {
1162
- if (!Intl)
1163
- return this.logger.error("No Intl support, please use an Intl polyfill!"), Zt;
1164
- if (!e.match(/-|_/)) return Zt;
1165
- const u = this.languageUtils.getLanguagePartFromCode(e);
1166
- s = this.getRule(u, t);
1167
- }
1168
- return this.pluralRulesCache[o] = s, s;
1169
- }
1170
- needsPlural(e) {
1171
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = this.getRule(e, t);
1172
- return r || (r = this.getRule("dev", t)), (r == null ? void 0 : r.resolvedOptions().pluralCategories.length) > 1;
1173
- }
1174
- getPluralFormsOfKey(e, t) {
1175
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1176
- return this.getSuffixes(e, r).map((i) => `${t}${i}`);
1177
- }
1178
- getSuffixes(e) {
1179
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = this.getRule(e, t);
1180
- return r || (r = this.getRule("dev", t)), r ? r.resolvedOptions().pluralCategories.sort((i, o) => Qt[i] - Qt[o]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
1181
- }
1182
- getSuffix(e, t) {
1183
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1184
- const i = this.getRule(e, r);
1185
- return i ? `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, r));
1186
- }
1187
- }
1188
- const en = function(n, e, t) {
1189
- let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, o = uo(n, e, t);
1190
- return !o && i && S(t) && (o = mt(n, t, r), o === void 0 && (o = mt(e, t, r))), o;
1191
- }, st = (n) => n.replace(/\$/g, "$$$$");
1192
- class vo {
1193
- constructor() {
1194
- var t;
1195
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1196
- this.logger = K.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((r) => r), this.init(e);
1197
- }
1198
- init() {
1199
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1200
- e.interpolation || (e.interpolation = {
1201
- escapeValue: !0
1202
- });
1203
- const {
1204
- escape: t,
1205
- escapeValue: r,
1206
- useRawValueToEscape: i,
1207
- prefix: o,
1208
- prefixEscaped: s,
1209
- suffix: a,
1210
- suffixEscaped: u,
1211
- formatSeparator: c,
1212
- unescapeSuffix: l,
1213
- unescapePrefix: f,
1214
- nestingPrefix: d,
1215
- nestingPrefixEscaped: g,
1216
- nestingSuffix: m,
1217
- nestingSuffixEscaped: v,
1218
- nestingOptionsSeparator: b,
1219
- maxReplaces: P,
1220
- alwaysFormat: O
1221
- } = e.interpolation;
1222
- this.escape = t !== void 0 ? t : co, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = o ? ie(o) : s || "{{", this.suffix = a ? ie(a) : u || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? ie(d) : g || ie("$t("), this.nestingSuffix = m ? ie(m) : v || ie(")"), this.nestingOptionsSeparator = b || ",", this.maxReplaces = P || 1e3, this.alwaysFormat = O !== void 0 ? O : !1, this.resetRegExp();
1223
- }
1224
- reset() {
1225
- this.options && this.init(this.options);
1226
- }
1227
- resetRegExp() {
1228
- const e = (t, r) => (t == null ? void 0 : t.source) === r ? (t.lastIndex = 0, t) : new RegExp(r, "g");
1229
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
1230
- }
1231
- interpolate(e, t, r, i) {
1232
- var g;
1233
- let o, s, a;
1234
- const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (m) => {
1235
- if (m.indexOf(this.formatSeparator) < 0) {
1236
- const O = en(t, u, m, this.options.keySeparator, this.options.ignoreJSONStructure);
1237
- return this.alwaysFormat ? this.format(O, void 0, r, {
1238
- ...i,
1239
- ...t,
1240
- interpolationkey: m
1241
- }) : O;
1242
- }
1243
- const v = m.split(this.formatSeparator), b = v.shift().trim(), P = v.join(this.formatSeparator).trim();
1244
- return this.format(en(t, u, b, this.options.keySeparator, this.options.ignoreJSONStructure), P, r, {
1245
- ...i,
1246
- ...t,
1247
- interpolationkey: b
1248
- });
1249
- };
1250
- this.resetRegExp();
1251
- const l = (i == null ? void 0 : i.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((g = i == null ? void 0 : i.interpolation) == null ? void 0 : g.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1252
- return [{
1253
- regex: this.regexpUnescape,
1254
- safeValue: (m) => st(m)
1255
- }, {
1256
- regex: this.regexp,
1257
- safeValue: (m) => this.escapeValue ? st(this.escape(m)) : st(m)
1258
- }].forEach((m) => {
1259
- for (a = 0; o = m.regex.exec(e); ) {
1260
- const v = o[1].trim();
1261
- if (s = c(v), s === void 0)
1262
- if (typeof l == "function") {
1263
- const P = l(e, o, i);
1264
- s = S(P) ? P : "";
1265
- } else if (i && Object.prototype.hasOwnProperty.call(i, v))
1266
- s = "";
1267
- else if (f) {
1268
- s = o[0];
1269
- continue;
1270
- } else
1271
- this.logger.warn(`missed to pass in variable ${v} for interpolating ${e}`), s = "";
1272
- else !S(s) && !this.useRawValueToEscape && (s = Kt(s));
1273
- const b = m.safeValue(s);
1274
- if (e = e.replace(o[0], b), f ? (m.regex.lastIndex += s.length, m.regex.lastIndex -= o[0].length) : m.regex.lastIndex = 0, a++, a >= this.maxReplaces)
1275
- break;
1276
- }
1277
- }), e;
1278
- }
1279
- nest(e, t) {
1280
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, o, s;
1281
- const a = (u, c) => {
1282
- const l = this.nestingOptionsSeparator;
1283
- if (u.indexOf(l) < 0) return u;
1284
- const f = u.split(new RegExp(`${l}[ ]*{`));
1285
- let d = `{${f[1]}`;
1286
- u = f[0], d = this.interpolate(d, s);
1287
- const g = d.match(/'/g), m = d.match(/"/g);
1288
- (((g == null ? void 0 : g.length) ?? 0) % 2 === 0 && !m || m.length % 2 !== 0) && (d = d.replace(/'/g, '"'));
1289
- try {
1290
- s = JSON.parse(d), c && (s = {
1291
- ...c,
1292
- ...s
1293
- });
1294
- } catch (v) {
1295
- return this.logger.warn(`failed parsing options string in nesting for key ${u}`, v), `${u}${l}${d}`;
1296
- }
1297
- return s.defaultValue && s.defaultValue.indexOf(this.prefix) > -1 && delete s.defaultValue, u;
1298
- };
1299
- for (; i = this.nestingRegexp.exec(e); ) {
1300
- let u = [];
1301
- s = {
1302
- ...r
1303
- }, s = s.replace && !S(s.replace) ? s.replace : s, s.applyPostProcessor = !1, delete s.defaultValue;
1304
- let c = !1;
1305
- if (i[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(i[1])) {
1306
- const l = i[1].split(this.formatSeparator).map((f) => f.trim());
1307
- i[1] = l.shift(), u = l, c = !0;
1308
- }
1309
- if (o = t(a.call(this, i[1].trim(), s), s), o && i[0] === e && !S(o)) return o;
1310
- S(o) || (o = Kt(o)), o || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), o = ""), c && (o = u.reduce((l, f) => this.format(l, f, r.lng, {
1311
- ...r,
1312
- interpolationkey: i[1].trim()
1313
- }), o.trim())), e = e.replace(i[0], o), this.regexp.lastIndex = 0;
1314
- }
1315
- return e;
1316
- }
1317
- }
1318
- const wo = (n) => {
1319
- let e = n.toLowerCase().trim();
1320
- const t = {};
1321
- if (n.indexOf("(") > -1) {
1322
- const r = n.split("(");
1323
- e = r[0].toLowerCase().trim();
1324
- const i = r[1].substring(0, r[1].length - 1);
1325
- e === "currency" && i.indexOf(":") < 0 ? t.currency || (t.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? t.range || (t.range = i.trim()) : i.split(";").forEach((s) => {
1326
- if (s) {
1327
- const [a, ...u] = s.split(":"), c = u.join(":").trim().replace(/^'+|'+$/g, ""), l = a.trim();
1328
- t[l] || (t[l] = c), c === "false" && (t[l] = !1), c === "true" && (t[l] = !0), isNaN(c) || (t[l] = parseInt(c, 10));
1329
- }
1330
- });
1331
- }
1332
- return {
1333
- formatName: e,
1334
- formatOptions: t
1335
- };
1336
- }, oe = (n) => {
1337
- const e = {};
1338
- return (t, r, i) => {
1339
- let o = i;
1340
- i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (o = {
1341
- ...o,
1342
- [i.interpolationkey]: void 0
1343
- });
1344
- const s = r + JSON.stringify(o);
1345
- let a = e[s];
1346
- return a || (a = n(He(r), i), e[s] = a), a(t);
1347
- };
1348
- };
1349
- class bo {
1350
- constructor() {
1351
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1352
- this.logger = K.create("formatter"), this.options = e, this.formats = {
1353
- number: oe((t, r) => {
1354
- const i = new Intl.NumberFormat(t, {
1355
- ...r
1356
- });
1357
- return (o) => i.format(o);
1358
- }),
1359
- currency: oe((t, r) => {
1360
- const i = new Intl.NumberFormat(t, {
1361
- ...r,
1362
- style: "currency"
1363
- });
1364
- return (o) => i.format(o);
1365
- }),
1366
- datetime: oe((t, r) => {
1367
- const i = new Intl.DateTimeFormat(t, {
1368
- ...r
1369
- });
1370
- return (o) => i.format(o);
1371
- }),
1372
- relativetime: oe((t, r) => {
1373
- const i = new Intl.RelativeTimeFormat(t, {
1374
- ...r
1375
- });
1376
- return (o) => i.format(o, r.range || "day");
1377
- }),
1378
- list: oe((t, r) => {
1379
- const i = new Intl.ListFormat(t, {
1380
- ...r
1381
- });
1382
- return (o) => i.format(o);
1383
- })
1384
- }, this.init(e);
1385
- }
1386
- init(e) {
1387
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
1388
- interpolation: {}
1389
- };
1390
- this.formatSeparator = t.interpolation.formatSeparator || ",";
1391
- }
1392
- add(e, t) {
1393
- this.formats[e.toLowerCase().trim()] = t;
1394
- }
1395
- addCached(e, t) {
1396
- this.formats[e.toLowerCase().trim()] = oe(t);
1397
- }
1398
- format(e, t, r) {
1399
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1400
- const o = t.split(this.formatSeparator);
1401
- if (o.length > 1 && o[0].indexOf("(") > 1 && o[0].indexOf(")") < 0 && o.find((a) => a.indexOf(")") > -1)) {
1402
- const a = o.findIndex((u) => u.indexOf(")") > -1);
1403
- o[0] = [o[0], ...o.splice(1, a)].join(this.formatSeparator);
1404
- }
1405
- return o.reduce((a, u) => {
1406
- var f;
1407
- const {
1408
- formatName: c,
1409
- formatOptions: l
1410
- } = wo(u);
1411
- if (this.formats[c]) {
1412
- let d = a;
1413
- try {
1414
- const g = ((f = i == null ? void 0 : i.formatParams) == null ? void 0 : f[i.interpolationkey]) || {}, m = g.locale || g.lng || i.locale || i.lng || r;
1415
- d = this.formats[c](a, m, {
1416
- ...l,
1417
- ...i,
1418
- ...g
1419
- });
1420
- } catch (g) {
1421
- this.logger.warn(g);
1422
- }
1423
- return d;
1424
- } else
1425
- this.logger.warn(`there was no format function for ${c}`);
1426
- return a;
1427
- }, e);
1428
- }
1429
- }
1430
- const So = (n, e) => {
1431
- n.pending[e] !== void 0 && (delete n.pending[e], n.pendingCount--);
1432
- };
1433
- class xo extends Ye {
1434
- constructor(e, t, r) {
1435
- var o, s;
1436
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1437
- super(), this.backend = e, this.store = t, this.services = r, this.languageUtils = r.languageUtils, this.options = i, this.logger = K.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], (s = (o = this.backend) == null ? void 0 : o.init) == null || s.call(o, r, i.backend, i);
1438
- }
1439
- queueLoad(e, t, r, i) {
1440
- const o = {}, s = {}, a = {}, u = {};
1441
- return e.forEach((c) => {
1442
- let l = !0;
1443
- t.forEach((f) => {
1444
- const d = `${c}|${f}`;
1445
- !r.reload && this.store.hasResourceBundle(c, f) ? this.state[d] = 2 : this.state[d] < 0 || (this.state[d] === 1 ? s[d] === void 0 && (s[d] = !0) : (this.state[d] = 1, l = !1, s[d] === void 0 && (s[d] = !0), o[d] === void 0 && (o[d] = !0), u[f] === void 0 && (u[f] = !0)));
1446
- }), l || (a[c] = !0);
1447
- }), (Object.keys(o).length || Object.keys(s).length) && this.queue.push({
1448
- pending: s,
1449
- pendingCount: Object.keys(s).length,
1450
- loaded: {},
1451
- errors: [],
1452
- callback: i
1453
- }), {
1454
- toLoad: Object.keys(o),
1455
- pending: Object.keys(s),
1456
- toLoadLanguages: Object.keys(a),
1457
- toLoadNamespaces: Object.keys(u)
1458
- };
1459
- }
1460
- loaded(e, t, r) {
1461
- const i = e.split("|"), o = i[0], s = i[1];
1462
- t && this.emit("failedLoading", o, s, t), !t && r && this.store.addResourceBundle(o, s, r, void 0, void 0, {
1463
- skipCopy: !0
1464
- }), this.state[e] = t ? -1 : 2, t && r && (this.state[e] = 0);
1465
- const a = {};
1466
- this.queue.forEach((u) => {
1467
- ao(u.loaded, [o], s), So(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((c) => {
1468
- a[c] || (a[c] = {});
1469
- const l = u.loaded[c];
1470
- l.length && l.forEach((f) => {
1471
- a[c][f] === void 0 && (a[c][f] = !0);
1472
- });
1473
- }), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
1474
- }), this.emit("loaded", a), this.queue = this.queue.filter((u) => !u.done);
1475
- }
1476
- read(e, t, r) {
1477
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, s = arguments.length > 5 ? arguments[5] : void 0;
1478
- if (!e.length) return s(null, {});
1479
- if (this.readingCalls >= this.maxParallelReads) {
1480
- this.waitingReads.push({
1481
- lng: e,
1482
- ns: t,
1483
- fcName: r,
1484
- tried: i,
1485
- wait: o,
1486
- callback: s
1487
- });
1488
- return;
1489
- }
1490
- this.readingCalls++;
1491
- const a = (c, l) => {
1492
- if (this.readingCalls--, this.waitingReads.length > 0) {
1493
- const f = this.waitingReads.shift();
1494
- this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
1495
- }
1496
- if (c && l && i < this.maxRetries) {
1497
- setTimeout(() => {
1498
- this.read.call(this, e, t, r, i + 1, o * 2, s);
1499
- }, o);
1500
- return;
1501
- }
1502
- s(c, l);
1503
- }, u = this.backend[r].bind(this.backend);
1504
- if (u.length === 2) {
1505
- try {
1506
- const c = u(e, t);
1507
- c && typeof c.then == "function" ? c.then((l) => a(null, l)).catch(a) : a(null, c);
1508
- } catch (c) {
1509
- a(c);
1510
- }
1511
- return;
1512
- }
1513
- return u(e, t, a);
1514
- }
1515
- prepareLoading(e, t) {
1516
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 ? arguments[3] : void 0;
1517
- if (!this.backend)
1518
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
1519
- S(e) && (e = this.languageUtils.toResolveHierarchy(e)), S(t) && (t = [t]);
1520
- const o = this.queueLoad(e, t, r, i);
1521
- if (!o.toLoad.length)
1522
- return o.pending.length || i(), null;
1523
- o.toLoad.forEach((s) => {
1524
- this.loadOne(s);
1525
- });
1526
- }
1527
- load(e, t, r) {
1528
- this.prepareLoading(e, t, {}, r);
1529
- }
1530
- reload(e, t, r) {
1531
- this.prepareLoading(e, t, {
1532
- reload: !0
1533
- }, r);
1534
- }
1535
- loadOne(e) {
1536
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1537
- const r = e.split("|"), i = r[0], o = r[1];
1538
- this.read(i, o, "read", void 0, void 0, (s, a) => {
1539
- s && this.logger.warn(`${t}loading namespace ${o} for language ${i} failed`, s), !s && a && this.logger.log(`${t}loaded namespace ${o} for language ${i}`, a), this.loaded(e, s, a);
1540
- });
1541
- }
1542
- saveMissing(e, t, r, i, o) {
1543
- var u, c, l, f, d;
1544
- let s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1545
- };
1546
- if ((c = (u = this.services) == null ? void 0 : u.utils) != null && c.hasLoadedNamespace && !((f = (l = this.services) == null ? void 0 : l.utils) != null && f.hasLoadedNamespace(t))) {
1547
- this.logger.warn(`did not save key "${r}" as the namespace "${t}" 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!!!");
1548
- return;
1549
- }
1550
- if (!(r == null || r === "")) {
1551
- if ((d = this.backend) != null && d.create) {
1552
- const g = {
1553
- ...s,
1554
- isUpdate: o
1555
- }, m = this.backend.create.bind(this.backend);
1556
- if (m.length < 6)
1557
- try {
1558
- let v;
1559
- m.length === 5 ? v = m(e, t, r, i, g) : v = m(e, t, r, i), v && typeof v.then == "function" ? v.then((b) => a(null, b)).catch(a) : a(null, v);
1560
- } catch (v) {
1561
- a(v);
1562
- }
1563
- else
1564
- m(e, t, r, i, a, g);
1565
- }
1566
- !e || !e[0] || this.store.addResource(e[0], t, r, i);
1567
- }
1568
- }
1569
- }
1570
- const tn = () => ({
1571
- debug: !1,
1572
- initAsync: !0,
1573
- ns: ["translation"],
1574
- defaultNS: ["translation"],
1575
- fallbackLng: ["dev"],
1576
- fallbackNS: !1,
1577
- supportedLngs: !1,
1578
- nonExplicitSupportedLngs: !1,
1579
- load: "all",
1580
- preload: !1,
1581
- simplifyPluralSuffix: !0,
1582
- keySeparator: ".",
1583
- nsSeparator: ":",
1584
- pluralSeparator: "_",
1585
- contextSeparator: "_",
1586
- partialBundledLanguages: !1,
1587
- saveMissing: !1,
1588
- updateMissing: !1,
1589
- saveMissingTo: "fallback",
1590
- saveMissingPlurals: !0,
1591
- missingKeyHandler: !1,
1592
- missingInterpolationHandler: !1,
1593
- postProcess: !1,
1594
- postProcessPassResolved: !1,
1595
- returnNull: !1,
1596
- returnEmptyString: !0,
1597
- returnObjects: !1,
1598
- joinArrays: !1,
1599
- returnedObjectHandler: !1,
1600
- parseMissingKeyHandler: !1,
1601
- appendNamespaceToMissingKey: !1,
1602
- appendNamespaceToCIMode: !1,
1603
- overloadTranslationOptionHandler: (n) => {
1604
- let e = {};
1605
- if (typeof n[1] == "object" && (e = n[1]), S(n[1]) && (e.defaultValue = n[1]), S(n[2]) && (e.tDescription = n[2]), typeof n[2] == "object" || typeof n[3] == "object") {
1606
- const t = n[3] || n[2];
1607
- Object.keys(t).forEach((r) => {
1608
- e[r] = t[r];
1609
- });
1610
- }
1611
- return e;
1612
- },
1613
- interpolation: {
1614
- escapeValue: !0,
1615
- format: (n) => n,
1616
- prefix: "{{",
1617
- suffix: "}}",
1618
- formatSeparator: ",",
1619
- unescapePrefix: "-",
1620
- nestingPrefix: "$t(",
1621
- nestingSuffix: ")",
1622
- nestingOptionsSeparator: ",",
1623
- maxReplaces: 1e3,
1624
- skipOnVariables: !0
1625
- }
1626
- }), nn = (n) => {
1627
- var e, t;
1628
- return S(n.ns) && (n.ns = [n.ns]), S(n.fallbackLng) && (n.fallbackLng = [n.fallbackLng]), S(n.fallbackNS) && (n.fallbackNS = [n.fallbackNS]), ((t = (e = n.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (n.supportedLngs = n.supportedLngs.concat(["cimode"])), typeof n.initImmediate == "boolean" && (n.initAsync = n.initImmediate), n;
1629
- }, Ne = () => {
1630
- }, Eo = (n) => {
1631
- Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((t) => {
1632
- typeof n[t] == "function" && (n[t] = n[t].bind(n));
1633
- });
1634
- };
1635
- class Oe extends Ye {
1636
- constructor() {
1637
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1638
- if (super(), this.options = nn(e), this.services = {}, this.logger = K, this.modules = {
1639
- external: []
1640
- }, Eo(this), t && !this.isInitialized && !e.isClone) {
1641
- if (!this.options.initAsync)
1642
- return this.init(e, t), this;
1643
- setTimeout(() => {
1644
- this.init(e, t);
1645
- }, 0);
1646
- }
1647
- }
1648
- init() {
1649
- var e = this;
1650
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 ? arguments[1] : void 0;
1651
- this.isInitializing = !0, typeof t == "function" && (r = t, t = {}), t.defaultNS == null && t.ns && (S(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
1652
- const i = tn();
1653
- this.options = {
1654
- ...i,
1655
- ...this.options,
1656
- ...nn(t)
1657
- }, this.options.interpolation = {
1658
- ...i.interpolation,
1659
- ...this.options.interpolation
1660
- }, t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
1661
- const o = (l) => l ? typeof l == "function" ? new l() : l : null;
1662
- if (!this.options.isClone) {
1663
- this.modules.logger ? K.init(o(this.modules.logger), this.options) : K.init(null, this.options);
1664
- let l;
1665
- this.modules.formatter ? l = this.modules.formatter : l = bo;
1666
- const f = new Gt(this.options);
1667
- this.store = new Jt(this.options.resources, this.options);
1668
- const d = this.services;
1669
- d.logger = K, d.resourceStore = this.store, d.languageUtils = f, d.pluralResolver = new yo(f, {
1670
- prepend: this.options.pluralSeparator,
1671
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1672
- }), l && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (d.formatter = o(l), d.formatter.init(d, this.options), this.options.interpolation.format = d.formatter.format.bind(d.formatter)), d.interpolator = new vo(this.options), d.utils = {
1673
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1674
- }, d.backendConnector = new xo(o(this.modules.backend), d.resourceStore, d, this.options), d.backendConnector.on("*", function(g) {
1675
- for (var m = arguments.length, v = new Array(m > 1 ? m - 1 : 0), b = 1; b < m; b++)
1676
- v[b - 1] = arguments[b];
1677
- e.emit(g, ...v);
1678
- }), this.modules.languageDetector && (d.languageDetector = o(this.modules.languageDetector), d.languageDetector.init && d.languageDetector.init(d, this.options.detection, this.options)), this.modules.i18nFormat && (d.i18nFormat = o(this.modules.i18nFormat), d.i18nFormat.init && d.i18nFormat.init(this)), this.translator = new Be(this.services, this.options), this.translator.on("*", function(g) {
1679
- for (var m = arguments.length, v = new Array(m > 1 ? m - 1 : 0), b = 1; b < m; b++)
1680
- v[b - 1] = arguments[b];
1681
- e.emit(g, ...v);
1682
- }), this.modules.external.forEach((g) => {
1683
- g.init && g.init(this);
1684
- });
1685
- }
1686
- if (this.format = this.options.interpolation.format, r || (r = Ne), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1687
- const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1688
- l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
1689
- }
1690
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((l) => {
1691
- this[l] = function() {
1692
- return e.store[l](...arguments);
1693
- };
1694
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((l) => {
1695
- this[l] = function() {
1696
- return e.store[l](...arguments), e;
1697
- };
1698
- });
1699
- const u = ve(), c = () => {
1700
- const l = (f, d) => {
1701
- this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), u.resolve(d), r(f, d);
1702
- };
1703
- if (this.languages && !this.isInitialized) return l(null, this.t.bind(this));
1704
- this.changeLanguage(this.options.lng, l);
1705
- };
1706
- return this.options.resources || !this.options.initAsync ? c() : setTimeout(c, 0), u;
1707
- }
1708
- loadResources(e) {
1709
- var o, s;
1710
- let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Ne;
1711
- const i = S(e) ? e : this.language;
1712
- if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) {
1713
- if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r();
1714
- const a = [], u = (c) => {
1715
- if (!c || c === "cimode") return;
1716
- this.services.languageUtils.toResolveHierarchy(c).forEach((f) => {
1717
- f !== "cimode" && a.indexOf(f) < 0 && a.push(f);
1718
- });
1719
- };
1720
- i ? u(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => u(l)), (s = (o = this.options.preload) == null ? void 0 : o.forEach) == null || s.call(o, (c) => u(c)), this.services.backendConnector.load(a, this.options.ns, (c) => {
1721
- !c && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), r(c);
1722
- });
1723
- } else
1724
- r(null);
1725
- }
1726
- reloadResources(e, t, r) {
1727
- const i = ve();
1728
- return typeof e == "function" && (r = e, e = void 0), typeof t == "function" && (r = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), r || (r = Ne), this.services.backendConnector.reload(e, t, (o) => {
1729
- i.resolve(), r(o);
1730
- }), i;
1731
- }
1732
- use(e) {
1733
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1734
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1735
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && Kn.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1736
- }
1737
- setResolvedLanguage(e) {
1738
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
1739
- for (let t = 0; t < this.languages.length; t++) {
1740
- const r = this.languages[t];
1741
- if (!(["cimode", "dev"].indexOf(r) > -1) && this.store.hasLanguageSomeTranslations(r)) {
1742
- this.resolvedLanguage = r;
1743
- break;
1744
- }
1745
- }
1746
- }
1747
- changeLanguage(e, t) {
1748
- var r = this;
1749
- this.isLanguageChangingTo = e;
1750
- const i = ve();
1751
- this.emit("languageChanging", e);
1752
- const o = (u) => {
1753
- this.language = u, this.languages = this.services.languageUtils.toResolveHierarchy(u), this.resolvedLanguage = void 0, this.setResolvedLanguage(u);
1754
- }, s = (u, c) => {
1755
- c ? (o(c), this.translator.changeLanguage(c), this.isLanguageChangingTo = void 0, this.emit("languageChanged", c), this.logger.log("languageChanged", c)) : this.isLanguageChangingTo = void 0, i.resolve(function() {
1756
- return r.t(...arguments);
1757
- }), t && t(u, function() {
1758
- return r.t(...arguments);
1759
- });
1760
- }, a = (u) => {
1761
- var l, f;
1762
- !e && !u && this.services.languageDetector && (u = []);
1763
- const c = S(u) ? u : this.services.languageUtils.getBestMatchFromCodes(u);
1764
- c && (this.language || o(c), this.translator.language || this.translator.changeLanguage(c), (f = (l = this.services.languageDetector) == null ? void 0 : l.cacheUserLanguage) == null || f.call(l, c)), this.loadResources(c, (d) => {
1765
- s(d, c);
1766
- });
1767
- };
1768
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), i;
1769
- }
1770
- getFixedT(e, t, r) {
1771
- var i = this;
1772
- const o = function(s, a) {
1773
- let u;
1774
- if (typeof a != "object") {
1775
- for (var c = arguments.length, l = new Array(c > 2 ? c - 2 : 0), f = 2; f < c; f++)
1776
- l[f - 2] = arguments[f];
1777
- u = i.options.overloadTranslationOptionHandler([s, a].concat(l));
1778
- } else
1779
- u = {
1780
- ...a
1781
- };
1782
- u.lng = u.lng || o.lng, u.lngs = u.lngs || o.lngs, u.ns = u.ns || o.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || r || o.keyPrefix);
1783
- const d = i.options.keySeparator || ".";
1784
- let g;
1785
- return u.keyPrefix && Array.isArray(s) ? g = s.map((m) => `${u.keyPrefix}${d}${m}`) : g = u.keyPrefix ? `${u.keyPrefix}${d}${s}` : s, i.t(g, u);
1786
- };
1787
- return S(e) ? o.lng = e : o.lngs = e, o.ns = t, o.keyPrefix = r, o;
1788
- }
1789
- t() {
1790
- var i;
1791
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
1792
- t[r] = arguments[r];
1793
- return (i = this.translator) == null ? void 0 : i.translate(...t);
1794
- }
1795
- exists() {
1796
- var i;
1797
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
1798
- t[r] = arguments[r];
1799
- return (i = this.translator) == null ? void 0 : i.exists(...t);
1800
- }
1801
- setDefaultNamespace(e) {
1802
- this.options.defaultNS = e;
1803
- }
1804
- hasLoadedNamespace(e) {
1805
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1806
- if (!this.isInitialized)
1807
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1808
- if (!this.languages || !this.languages.length)
1809
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1810
- const r = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, o = this.languages[this.languages.length - 1];
1811
- if (r.toLowerCase() === "cimode") return !0;
1812
- const s = (a, u) => {
1813
- const c = this.services.backendConnector.state[`${a}|${u}`];
1814
- return c === -1 || c === 0 || c === 2;
1815
- };
1816
- if (t.precheck) {
1817
- const a = t.precheck(this, s);
1818
- if (a !== void 0) return a;
1819
- }
1820
- return !!(this.hasResourceBundle(r, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || s(r, e) && (!i || s(o, e)));
1821
- }
1822
- loadNamespaces(e, t) {
1823
- const r = ve();
1824
- return this.options.ns ? (S(e) && (e = [e]), e.forEach((i) => {
1825
- this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
1826
- }), this.loadResources((i) => {
1827
- r.resolve(), t && t(i);
1828
- }), r) : (t && t(), Promise.resolve());
1829
- }
1830
- loadLanguages(e, t) {
1831
- const r = ve();
1832
- S(e) && (e = [e]);
1833
- const i = this.options.preload || [], o = e.filter((s) => i.indexOf(s) < 0 && this.services.languageUtils.isSupportedCode(s));
1834
- return o.length ? (this.options.preload = i.concat(o), this.loadResources((s) => {
1835
- r.resolve(), t && t(s);
1836
- }), r) : (t && t(), Promise.resolve());
1837
- }
1838
- dir(e) {
1839
- var i, o;
1840
- if (e || (e = this.resolvedLanguage || (((i = this.languages) == null ? void 0 : i.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1841
- const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], r = ((o = this.services) == null ? void 0 : o.languageUtils) || new Gt(tn());
1842
- return t.indexOf(r.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1843
- }
1844
- static createInstance() {
1845
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1846
- return new Oe(e, t);
1847
- }
1848
- cloneInstance() {
1849
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Ne;
1850
- const r = e.forkResourceStore;
1851
- r && delete e.forkResourceStore;
1852
- const i = {
1853
- ...this.options,
1854
- ...e,
1855
- isClone: !0
1856
- }, o = new Oe(i);
1857
- if ((e.debug !== void 0 || e.prefix !== void 0) && (o.logger = o.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
1858
- o[a] = this[a];
1859
- }), o.services = {
1860
- ...this.services
1861
- }, o.services.utils = {
1862
- hasLoadedNamespace: o.hasLoadedNamespace.bind(o)
1863
- }, r) {
1864
- const a = Object.keys(this.store.data).reduce((u, c) => (u[c] = {
1865
- ...this.store.data[c]
1866
- }, Object.keys(u[c]).reduce((l, f) => (l[f] = {
1867
- ...u[c][f]
1868
- }, l), {})), {});
1869
- o.store = new Jt(a, i), o.services.resourceStore = o.store;
1870
- }
1871
- return o.translator = new Be(o.services, i), o.translator.on("*", function(a) {
1872
- for (var u = arguments.length, c = new Array(u > 1 ? u - 1 : 0), l = 1; l < u; l++)
1873
- c[l - 1] = arguments[l];
1874
- o.emit(a, ...c);
1875
- }), o.init(i, t), o.translator.options = i, o.translator.backendConnector.services.utils = {
1876
- hasLoadedNamespace: o.hasLoadedNamespace.bind(o)
1877
- }, o;
1878
- }
1879
- toJSON() {
1880
- return {
1881
- options: this.options,
1882
- store: this.store,
1883
- language: this.language,
1884
- languages: this.languages,
1885
- resolvedLanguage: this.resolvedLanguage
1886
- };
1887
- }
1888
- }
1889
- const se = Oe.createInstance();
1890
- se.createInstance = Oe.createInstance;
1891
- const {
1892
- slice: Oo,
1893
- forEach: To
1894
- } = [];
1895
- function Lo(n) {
1896
- return To.call(Oo.call(arguments, 1), (e) => {
1897
- if (e)
1898
- for (const t in e)
1899
- n[t] === void 0 && (n[t] = e[t]);
1900
- }), n;
1901
- }
1902
- const rn = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Co = function(n, e) {
1903
- const r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
1904
- path: "/"
1905
- }, i = encodeURIComponent(e);
1906
- let o = `${n}=${i}`;
1907
- if (r.maxAge > 0) {
1908
- const s = r.maxAge - 0;
1909
- if (Number.isNaN(s)) throw new Error("maxAge should be a Number");
1910
- o += `; Max-Age=${Math.floor(s)}`;
1911
- }
1912
- if (r.domain) {
1913
- if (!rn.test(r.domain))
1914
- throw new TypeError("option domain is invalid");
1915
- o += `; Domain=${r.domain}`;
1916
- }
1917
- if (r.path) {
1918
- if (!rn.test(r.path))
1919
- throw new TypeError("option path is invalid");
1920
- o += `; Path=${r.path}`;
1921
- }
1922
- if (r.expires) {
1923
- if (typeof r.expires.toUTCString != "function")
1924
- throw new TypeError("option expires is invalid");
1925
- o += `; Expires=${r.expires.toUTCString()}`;
1926
- }
1927
- if (r.httpOnly && (o += "; HttpOnly"), r.secure && (o += "; Secure"), r.sameSite)
1928
- switch (typeof r.sameSite == "string" ? r.sameSite.toLowerCase() : r.sameSite) {
1929
- case !0:
1930
- o += "; SameSite=Strict";
1931
- break;
1932
- case "lax":
1933
- o += "; SameSite=Lax";
1934
- break;
1935
- case "strict":
1936
- o += "; SameSite=Strict";
1937
- break;
1938
- case "none":
1939
- o += "; SameSite=None";
1940
- break;
1941
- default:
1942
- throw new TypeError("option sameSite is invalid");
1943
- }
1944
- return o;
1945
- }, on = {
1946
- create(n, e, t, r) {
1947
- let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
1948
- path: "/",
1949
- sameSite: "strict"
1950
- };
1951
- t && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + t * 60 * 1e3)), r && (i.domain = r), document.cookie = Co(n, encodeURIComponent(e), i);
1952
- },
1953
- read(n) {
1954
- const e = `${n}=`, t = document.cookie.split(";");
1955
- for (let r = 0; r < t.length; r++) {
1956
- let i = t[r];
1957
- for (; i.charAt(0) === " "; ) i = i.substring(1, i.length);
1958
- if (i.indexOf(e) === 0) return i.substring(e.length, i.length);
1959
- }
1960
- return null;
1961
- },
1962
- remove(n) {
1963
- this.create(n, "", -1);
1964
- }
1965
- };
1966
- var Po = {
1967
- name: "cookie",
1968
- // Deconstruct the options object and extract the lookupCookie property
1969
- lookup(n) {
1970
- let {
1971
- lookupCookie: e
1972
- } = n;
1973
- if (e && typeof document < "u")
1974
- return on.read(e) || void 0;
1975
- },
1976
- // Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties
1977
- cacheUserLanguage(n, e) {
1978
- let {
1979
- lookupCookie: t,
1980
- cookieMinutes: r,
1981
- cookieDomain: i,
1982
- cookieOptions: o
1983
- } = e;
1984
- t && typeof document < "u" && on.create(t, n, r, i, o);
1985
- }
1986
- }, ko = {
1987
- name: "querystring",
1988
- // Deconstruct the options object and extract the lookupQuerystring property
1989
- lookup(n) {
1990
- var r;
1991
- let {
1992
- lookupQuerystring: e
1993
- } = n, t;
1994
- if (typeof window < "u") {
1995
- let {
1996
- search: i
1997
- } = window.location;
1998
- !window.location.search && ((r = window.location.hash) == null ? void 0 : r.indexOf("?")) > -1 && (i = window.location.hash.substring(window.location.hash.indexOf("?")));
1999
- const s = i.substring(1).split("&");
2000
- for (let a = 0; a < s.length; a++) {
2001
- const u = s[a].indexOf("=");
2002
- u > 0 && s[a].substring(0, u) === e && (t = s[a].substring(u + 1));
2003
- }
2004
- }
2005
- return t;
2006
- }
2007
- };
2008
- let we = null;
2009
- const sn = () => {
2010
- if (we !== null) return we;
2011
- try {
2012
- we = window !== "undefined" && window.localStorage !== null;
2013
- const n = "i18next.translate.boo";
2014
- window.localStorage.setItem(n, "foo"), window.localStorage.removeItem(n);
2015
- } catch {
2016
- we = !1;
2017
- }
2018
- return we;
2019
- };
2020
- var Io = {
2021
- name: "localStorage",
2022
- // Deconstruct the options object and extract the lookupLocalStorage property
2023
- lookup(n) {
2024
- let {
2025
- lookupLocalStorage: e
2026
- } = n;
2027
- if (e && sn())
2028
- return window.localStorage.getItem(e) || void 0;
2029
- },
2030
- // Deconstruct the options object and extract the lookupLocalStorage property
2031
- cacheUserLanguage(n, e) {
2032
- let {
2033
- lookupLocalStorage: t
2034
- } = e;
2035
- t && sn() && window.localStorage.setItem(t, n);
2036
- }
2037
- };
2038
- let be = null;
2039
- const an = () => {
2040
- if (be !== null) return be;
2041
- try {
2042
- be = window !== "undefined" && window.sessionStorage !== null;
2043
- const n = "i18next.translate.boo";
2044
- window.sessionStorage.setItem(n, "foo"), window.sessionStorage.removeItem(n);
2045
- } catch {
2046
- be = !1;
2047
- }
2048
- return be;
2049
- };
2050
- var Ro = {
2051
- name: "sessionStorage",
2052
- lookup(n) {
2053
- let {
2054
- lookupSessionStorage: e
2055
- } = n;
2056
- if (e && an())
2057
- return window.sessionStorage.getItem(e) || void 0;
2058
- },
2059
- cacheUserLanguage(n, e) {
2060
- let {
2061
- lookupSessionStorage: t
2062
- } = e;
2063
- t && an() && window.sessionStorage.setItem(t, n);
2064
- }
2065
- }, Ao = {
2066
- name: "navigator",
2067
- lookup(n) {
2068
- const e = [];
2069
- if (typeof navigator < "u") {
2070
- const {
2071
- languages: t,
2072
- userLanguage: r,
2073
- language: i
2074
- } = navigator;
2075
- if (t)
2076
- for (let o = 0; o < t.length; o++)
2077
- e.push(t[o]);
2078
- r && e.push(r), i && e.push(i);
2079
- }
2080
- return e.length > 0 ? e : void 0;
2081
- }
2082
- }, $o = {
2083
- name: "htmlTag",
2084
- // Deconstruct the options object and extract the htmlTag property
2085
- lookup(n) {
2086
- let {
2087
- htmlTag: e
2088
- } = n, t;
2089
- const r = e || (typeof document < "u" ? document.documentElement : null);
2090
- return r && typeof r.getAttribute == "function" && (t = r.getAttribute("lang")), t;
2091
- }
2092
- }, No = {
2093
- name: "path",
2094
- // Deconstruct the options object and extract the lookupFromPathIndex property
2095
- lookup(n) {
2096
- var i;
2097
- let {
2098
- lookupFromPathIndex: e
2099
- } = n;
2100
- if (typeof window > "u") return;
2101
- const t = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
2102
- return Array.isArray(t) ? (i = t[typeof e == "number" ? e : 0]) == null ? void 0 : i.replace("/", "") : void 0;
2103
- }
2104
- }, jo = {
2105
- name: "subdomain",
2106
- lookup(n) {
2107
- var i, o;
2108
- let {
2109
- lookupFromSubdomainIndex: e
2110
- } = n;
2111
- const t = typeof e == "number" ? e + 1 : 1, r = typeof window < "u" && ((o = (i = window.location) == null ? void 0 : i.hostname) == null ? void 0 : o.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));
2112
- if (r)
2113
- return r[t];
2114
- }
2115
- };
2116
- let qn = !1;
2117
- try {
2118
- qn = !0;
2119
- } catch {
2120
- }
2121
- const zn = ["querystring", "cookie", "localStorage", "sessionStorage", "navigator", "htmlTag"];
2122
- qn || zn.splice(1, 1);
2123
- const Do = () => ({
2124
- order: zn,
2125
- lookupQuerystring: "lng",
2126
- lookupCookie: "i18next",
2127
- lookupLocalStorage: "i18nextLng",
2128
- lookupSessionStorage: "i18nextLng",
2129
- // cache user language
2130
- caches: ["localStorage"],
2131
- excludeCacheFor: ["cimode"],
2132
- // cookieMinutes: 10,
2133
- // cookieDomain: 'myDomain'
2134
- convertDetectedLanguage: (n) => n
2135
- });
2136
- class Wn {
2137
- constructor(e) {
2138
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2139
- this.type = "languageDetector", this.detectors = {}, this.init(e, t);
2140
- }
2141
- init() {
2142
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
2143
- languageUtils: {}
2144
- }, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2145
- this.services = e, this.options = Lo(t, this.options || {}, Do()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (i) => i.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = r, this.addDetector(Po), this.addDetector(ko), this.addDetector(Io), this.addDetector(Ro), this.addDetector(Ao), this.addDetector($o), this.addDetector(No), this.addDetector(jo);
2146
- }
2147
- addDetector(e) {
2148
- return this.detectors[e.name] = e, this;
2149
- }
2150
- detect() {
2151
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.order, t = [];
2152
- return e.forEach((r) => {
2153
- if (this.detectors[r]) {
2154
- let i = this.detectors[r].lookup(this.options);
2155
- i && typeof i == "string" && (i = [i]), i && (t = t.concat(i));
2156
- }
2157
- }), t = t.map((r) => this.options.convertDetectedLanguage(r)), this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes ? t : t.length > 0 ? t[0] : null;
2158
- }
2159
- cacheUserLanguage(e) {
2160
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.caches;
2161
- t && (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(e) > -1 || t.forEach((r) => {
2162
- this.detectors[r] && this.detectors[r].cacheUserLanguage(e, this.options);
2163
- }));
2164
- }
2165
- }
2166
- Wn.type = "languageDetector";
2167
- function Uo(n, e) {
2168
- if (!(n instanceof e)) throw new TypeError("Cannot call a class as a function");
2169
- }
2170
- function Te(n) {
2171
- "@babel/helpers - typeof";
2172
- return Te = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2173
- return typeof e;
2174
- } : function(e) {
2175
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2176
- }, Te(n);
2177
- }
2178
- function Fo(n, e) {
2179
- if (Te(n) != "object" || !n) return n;
2180
- var t = n[Symbol.toPrimitive];
2181
- if (t !== void 0) {
2182
- var r = t.call(n, e);
2183
- if (Te(r) != "object") return r;
2184
- throw new TypeError("@@toPrimitive must return a primitive value.");
2185
- }
2186
- return String(n);
2187
- }
2188
- function _o(n) {
2189
- var e = Fo(n, "string");
2190
- return Te(e) == "symbol" ? e : e + "";
2191
- }
2192
- function Mo(n, e) {
2193
- for (var t = 0; t < e.length; t++) {
2194
- var r = e[t];
2195
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(n, _o(r.key), r);
2196
- }
2197
- }
2198
- function Ho(n, e, t) {
2199
- return e && Mo(n.prototype, e), Object.defineProperty(n, "prototype", {
2200
- writable: !1
2201
- }), n;
2202
- }
2203
- var Jn = [], Vo = Jn.forEach, Bo = Jn.slice;
2204
- function Ko(n) {
2205
- return Vo.call(Bo.call(arguments, 1), function(e) {
2206
- if (e)
2207
- for (var t in e)
2208
- n[t] === void 0 && (n[t] = e[t]);
2209
- }), n;
2210
- }
2211
- function qo(n) {
2212
- return n ? typeof n == "function" ? new n() : n : null;
2213
- }
2214
- function zo() {
2215
- return {
2216
- handleEmptyResourcesAsFailed: !0,
2217
- cacheHitMode: "none"
2218
- // reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000
2219
- // refreshExpirationTime: 60 * 60 * 1000
2220
- };
2221
- }
2222
- function un(n, e, t, r) {
2223
- var i = n.read.bind(n);
2224
- if (i.length === 2) {
2225
- try {
2226
- var o = i(e, t);
2227
- o && typeof o.then == "function" ? o.then(function(s) {
2228
- return r(null, s);
2229
- }).catch(r) : r(null, o);
2230
- } catch (s) {
2231
- r(s);
2232
- }
2233
- return;
2234
- }
2235
- i(e, t, r);
2236
- }
2237
- var Xn = /* @__PURE__ */ (function() {
2238
- function n(e) {
2239
- var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2240
- Uo(this, n), this.backends = [], this.type = "backend", this.allOptions = r, this.init(e, t);
2241
- }
2242
- return Ho(n, [{
2243
- key: "init",
2244
- value: function(t) {
2245
- var r = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2246
- this.services = t, this.options = Ko(i, this.options || {}, zo()), this.allOptions = o, this.options.backends && this.options.backends.forEach(function(s, a) {
2247
- r.backends[a] = r.backends[a] || qo(s), r.backends[a].init(t, r.options.backendOptions && r.options.backendOptions[a] || {}, o);
2248
- }), this.services && this.options.reloadInterval && setInterval(function() {
2249
- return r.reload();
2250
- }, this.options.reloadInterval);
2251
- }
2252
- }, {
2253
- key: "read",
2254
- value: function(t, r, i) {
2255
- var o = this, s = this.backends.length, a = function c(l) {
2256
- if (l >= s) return i(new Error("non of the backend loaded data", !0));
2257
- var f = l === s - 1, d = o.options.handleEmptyResourcesAsFailed && !f ? 0 : -1, g = o.backends[l];
2258
- g.read ? un(g, t, r, function(m, v, b) {
2259
- if (!m && v && Object.keys(v).length > d) {
2260
- if (i(null, v, l), u(l - 1, v), g.save && o.options.cacheHitMode && ["refresh", "refreshAndUpdateStore"].indexOf(o.options.cacheHitMode) > -1) {
2261
- if (b && o.options.refreshExpirationTime && b + o.options.refreshExpirationTime > Date.now()) return;
2262
- var P = o.backends[l + 1];
2263
- P && P.read && un(P, t, r, function(O, C) {
2264
- O || C && (Object.keys(C).length <= d || (u(l, C), o.options.cacheHitMode === "refreshAndUpdateStore" && o.services && o.services.resourceStore && o.services.resourceStore.addResourceBundle(t, r, C)));
2265
- });
2266
- }
2267
- } else
2268
- c(l + 1);
2269
- }) : c(l + 1);
2270
- }, u = function c(l, f) {
2271
- if (!(l < 0)) {
2272
- var d = o.backends[l];
2273
- d.save && d.save(t, r, f), c(l - 1, f);
2274
- }
2275
- };
2276
- a(0);
2277
- }
2278
- }, {
2279
- key: "create",
2280
- value: function(t, r, i, o) {
2281
- var s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : function() {
2282
- }, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
2283
- this.backends.forEach(function(u) {
2284
- if (u.create) {
2285
- var c = u.create.bind(u);
2286
- if (c.length < 6) {
2287
- try {
2288
- var l;
2289
- c.length === 5 ? l = c(t, r, i, o, a) : l = c(t, r, i, o), l && typeof l.then == "function" ? l.then(function(f) {
2290
- return s(null, f);
2291
- }).catch(s) : s(null, l);
2292
- } catch (f) {
2293
- s(f);
2294
- }
2295
- return;
2296
- }
2297
- c(t, r, i, o, s, a);
2298
- }
2299
- });
2300
- }
2301
- }, {
2302
- key: "reload",
2303
- value: function() {
2304
- var t = this, r = this.services, i = r.backendConnector, o = r.languageUtils, s = r.logger, a = i.language;
2305
- if (!(a && a.toLowerCase() === "cimode")) {
2306
- var u = [], c = function(f) {
2307
- var d = o.toResolveHierarchy(f);
2308
- d.forEach(function(g) {
2309
- u.indexOf(g) < 0 && u.push(g);
2310
- });
2311
- };
2312
- c(a), this.allOptions.preload && this.allOptions.preload.forEach(function(l) {
2313
- return c(l);
2314
- }), u.forEach(function(l) {
2315
- t.allOptions.ns.forEach(function(f) {
2316
- i.read(l, f, "read", null, null, function(d, g) {
2317
- d && s.warn("loading namespace ".concat(f, " for language ").concat(l, " failed"), d), !d && g && s.log("loaded namespace ".concat(f, " for language ").concat(l), g), i.loaded("".concat(l, "|").concat(f), d, g);
2318
- });
2319
- });
2320
- });
2321
- }
2322
- }
2323
- }]), n;
2324
- })();
2325
- Xn.type = "backend";
2326
- function yt(n) {
2327
- "@babel/helpers - typeof";
2328
- return yt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2329
- return typeof e;
2330
- } : function(e) {
2331
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2332
- }, yt(n);
2333
- }
2334
- function Yn() {
2335
- return typeof XMLHttpRequest == "function" || (typeof XMLHttpRequest > "u" ? "undefined" : yt(XMLHttpRequest)) === "object";
2336
- }
2337
- function Wo(n) {
2338
- return !!n && typeof n.then == "function";
2339
- }
2340
- function Jo(n) {
2341
- return Wo(n) ? n : Promise.resolve(n);
2342
- }
2343
- function ln(n, e) {
2344
- var t = Object.keys(n);
2345
- if (Object.getOwnPropertySymbols) {
2346
- var r = Object.getOwnPropertySymbols(n);
2347
- e && (r = r.filter(function(i) {
2348
- return Object.getOwnPropertyDescriptor(n, i).enumerable;
2349
- })), t.push.apply(t, r);
2350
- }
2351
- return t;
2352
- }
2353
- function cn(n) {
2354
- for (var e = 1; e < arguments.length; e++) {
2355
- var t = arguments[e] != null ? arguments[e] : {};
2356
- e % 2 ? ln(Object(t), !0).forEach(function(r) {
2357
- Xo(n, r, t[r]);
2358
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : ln(Object(t)).forEach(function(r) {
2359
- Object.defineProperty(n, r, Object.getOwnPropertyDescriptor(t, r));
2360
- });
2361
- }
2362
- return n;
2363
- }
2364
- function Xo(n, e, t) {
2365
- return (e = Yo(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
2366
- }
2367
- function Yo(n) {
2368
- var e = Go(n, "string");
2369
- return ne(e) == "symbol" ? e : e + "";
2370
- }
2371
- function Go(n, e) {
2372
- if (ne(n) != "object" || !n) return n;
2373
- var t = n[Symbol.toPrimitive];
2374
- if (t !== void 0) {
2375
- var r = t.call(n, e);
2376
- if (ne(r) != "object") return r;
2377
- throw new TypeError("@@toPrimitive must return a primitive value.");
2378
- }
2379
- return (e === "string" ? String : Number)(n);
2380
- }
2381
- function ne(n) {
2382
- "@babel/helpers - typeof";
2383
- return ne = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2384
- return typeof e;
2385
- } : function(e) {
2386
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2387
- }, ne(n);
2388
- }
2389
- var G = typeof fetch == "function" ? fetch : void 0;
2390
- typeof global < "u" && global.fetch ? G = global.fetch : typeof window < "u" && window.fetch && (G = window.fetch);
2391
- var Le;
2392
- Yn() && (typeof global < "u" && global.XMLHttpRequest ? Le = global.XMLHttpRequest : typeof window < "u" && window.XMLHttpRequest && (Le = window.XMLHttpRequest));
2393
- var Ke;
2394
- typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObject ? Ke = global.ActiveXObject : typeof window < "u" && window.ActiveXObject && (Ke = window.ActiveXObject));
2395
- typeof G != "function" && (G = void 0);
2396
- if (!G && !Le && !Ke)
2397
- try {
2398
- import("./browser-ponyfill-DXriyH6D.js").then((n) => n.b).then(function(n) {
2399
- G = n.default;
2400
- }).catch(function() {
2401
- });
2402
- } catch {
2403
- }
2404
- var vt = function(e, t) {
2405
- if (t && ne(t) === "object") {
2406
- var r = "";
2407
- for (var i in t)
2408
- r += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(t[i]);
2409
- if (!r) return e;
2410
- e = e + (e.indexOf("?") !== -1 ? "&" : "?") + r.slice(1);
2411
- }
2412
- return e;
2413
- }, fn = function(e, t, r, i) {
2414
- var o = function(u) {
2415
- if (!u.ok) return r(u.statusText || "Error", {
2416
- status: u.status
2417
- });
2418
- u.text().then(function(c) {
2419
- r(null, {
2420
- status: u.status,
2421
- data: c
2422
- });
2423
- }).catch(r);
2424
- };
2425
- if (i) {
2426
- var s = i(e, t);
2427
- if (s instanceof Promise) {
2428
- s.then(o).catch(r);
2429
- return;
2430
- }
2431
- }
2432
- typeof fetch == "function" ? fetch(e, t).then(o).catch(r) : G(e, t).then(o).catch(r);
2433
- }, dn = !1, Qo = function(e, t, r, i) {
2434
- e.queryStringParams && (t = vt(t, e.queryStringParams));
2435
- var o = cn({}, typeof e.customHeaders == "function" ? e.customHeaders() : e.customHeaders);
2436
- typeof window > "u" && typeof global < "u" && typeof global.process < "u" && global.process.versions && global.process.versions.node && (o["User-Agent"] = "i18next-http-backend (node/".concat(global.process.version, "; ").concat(global.process.platform, " ").concat(global.process.arch, ")")), r && (o["Content-Type"] = "application/json");
2437
- var s = typeof e.requestOptions == "function" ? e.requestOptions(r) : e.requestOptions, a = cn({
2438
- method: r ? "POST" : "GET",
2439
- body: r ? e.stringify(r) : void 0,
2440
- headers: o
2441
- }, dn ? {} : s), u = typeof e.alternateFetch == "function" && e.alternateFetch.length >= 1 ? e.alternateFetch : void 0;
2442
- try {
2443
- fn(t, a, i, u);
2444
- } catch (c) {
2445
- if (!s || Object.keys(s).length === 0 || !c.message || c.message.indexOf("not implemented") < 0)
2446
- return i(c);
2447
- try {
2448
- Object.keys(s).forEach(function(l) {
2449
- delete a[l];
2450
- }), fn(t, a, i, u), dn = !0;
2451
- } catch (l) {
2452
- i(l);
2453
- }
2454
- }
2455
- }, Zo = function(e, t, r, i) {
2456
- r && ne(r) === "object" && (r = vt("", r).slice(1)), e.queryStringParams && (t = vt(t, e.queryStringParams));
2457
- try {
2458
- var o = Le ? new Le() : new Ke("MSXML2.XMLHTTP.3.0");
2459
- o.open(r ? "POST" : "GET", t, 1), e.crossDomain || o.setRequestHeader("X-Requested-With", "XMLHttpRequest"), o.withCredentials = !!e.withCredentials, r && o.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), o.overrideMimeType && o.overrideMimeType("application/json");
2460
- var s = e.customHeaders;
2461
- if (s = typeof s == "function" ? s() : s, s)
2462
- for (var a in s)
2463
- o.setRequestHeader(a, s[a]);
2464
- o.onreadystatechange = function() {
2465
- o.readyState > 3 && i(o.status >= 400 ? o.statusText : null, {
2466
- status: o.status,
2467
- data: o.responseText
2468
- });
2469
- }, o.send(r);
2470
- } catch (u) {
2471
- }
2472
- }, es = function(e, t, r, i) {
2473
- if (typeof r == "function" && (i = r, r = void 0), i = i || function() {
2474
- }, G && t.indexOf("file:") !== 0)
2475
- return Qo(e, t, r, i);
2476
- if (Yn() || typeof ActiveXObject == "function")
2477
- return Zo(e, t, r, i);
2478
- i(new Error("No fetch and no xhr implementation found!"));
2479
- };
2480
- function fe(n) {
2481
- "@babel/helpers - typeof";
2482
- return fe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2483
- return typeof e;
2484
- } : function(e) {
2485
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2486
- }, fe(n);
2487
- }
2488
- function pn(n, e) {
2489
- var t = Object.keys(n);
2490
- if (Object.getOwnPropertySymbols) {
2491
- var r = Object.getOwnPropertySymbols(n);
2492
- e && (r = r.filter(function(i) {
2493
- return Object.getOwnPropertyDescriptor(n, i).enumerable;
2494
- })), t.push.apply(t, r);
2495
- }
2496
- return t;
2497
- }
2498
- function at(n) {
2499
- for (var e = 1; e < arguments.length; e++) {
2500
- var t = arguments[e] != null ? arguments[e] : {};
2501
- e % 2 ? pn(Object(t), !0).forEach(function(r) {
2502
- Gn(n, r, t[r]);
2503
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : pn(Object(t)).forEach(function(r) {
2504
- Object.defineProperty(n, r, Object.getOwnPropertyDescriptor(t, r));
2505
- });
2506
- }
2507
- return n;
2508
- }
2509
- function ts(n, e) {
2510
- if (!(n instanceof e)) throw new TypeError("Cannot call a class as a function");
2511
- }
2512
- function ns(n, e) {
2513
- for (var t = 0; t < e.length; t++) {
2514
- var r = e[t];
2515
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(n, Qn(r.key), r);
2516
- }
2517
- }
2518
- function rs(n, e, t) {
2519
- return e && ns(n.prototype, e), Object.defineProperty(n, "prototype", { writable: !1 }), n;
2520
- }
2521
- function Gn(n, e, t) {
2522
- return (e = Qn(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
2523
- }
2524
- function Qn(n) {
2525
- var e = is(n, "string");
2526
- return fe(e) == "symbol" ? e : e + "";
2527
- }
2528
- function is(n, e) {
2529
- if (fe(n) != "object" || !n) return n;
2530
- var t = n[Symbol.toPrimitive];
2531
- if (t !== void 0) {
2532
- var r = t.call(n, e);
2533
- if (fe(r) != "object") return r;
2534
- throw new TypeError("@@toPrimitive must return a primitive value.");
2535
- }
2536
- return String(n);
2537
- }
2538
- var os = function() {
2539
- return {
2540
- loadPath: "/locales/{{lng}}/{{ns}}.json",
2541
- addPath: "/locales/add/{{lng}}/{{ns}}",
2542
- parse: function(t) {
2543
- return JSON.parse(t);
2544
- },
2545
- stringify: JSON.stringify,
2546
- parsePayload: function(t, r, i) {
2547
- return Gn({}, r, i || "");
2548
- },
2549
- parseLoadPayload: function(t, r) {
2550
- },
2551
- request: es,
2552
- reloadInterval: typeof window < "u" ? !1 : 3600 * 1e3,
2553
- customHeaders: {},
2554
- queryStringParams: {},
2555
- crossDomain: !1,
2556
- withCredentials: !1,
2557
- overrideMimeType: !1,
2558
- requestOptions: {
2559
- mode: "cors",
2560
- credentials: "same-origin",
2561
- cache: "default"
2562
- }
2563
- };
2564
- }, Zn = (function() {
2565
- function n(e) {
2566
- var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2567
- ts(this, n), this.services = e, this.options = t, this.allOptions = r, this.type = "backend", this.init(e, t, r);
2568
- }
2569
- return rs(n, [{
2570
- key: "init",
2571
- value: function(t) {
2572
- var r = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2573
- if (this.services = t, this.options = at(at(at({}, os()), this.options || {}), i), this.allOptions = o, this.services && this.options.reloadInterval) {
2574
- var s = setInterval(function() {
2575
- return r.reload();
2576
- }, this.options.reloadInterval);
2577
- fe(s) === "object" && typeof s.unref == "function" && s.unref();
2578
- }
2579
- }
2580
- }, {
2581
- key: "readMulti",
2582
- value: function(t, r, i) {
2583
- this._readAny(t, t, r, r, i);
2584
- }
2585
- }, {
2586
- key: "read",
2587
- value: function(t, r, i) {
2588
- this._readAny([t], t, [r], r, i);
2589
- }
2590
- }, {
2591
- key: "_readAny",
2592
- value: function(t, r, i, o, s) {
2593
- var a = this, u = this.options.loadPath;
2594
- typeof this.options.loadPath == "function" && (u = this.options.loadPath(t, i)), u = Jo(u), u.then(function(c) {
2595
- if (!c) return s(null, {});
2596
- var l = a.services.interpolator.interpolate(c, {
2597
- lng: t.join("+"),
2598
- ns: i.join("+")
2599
- });
2600
- a.loadUrl(l, s, r, o);
2601
- });
2602
- }
2603
- }, {
2604
- key: "loadUrl",
2605
- value: function(t, r, i, o) {
2606
- var s = this, a = typeof i == "string" ? [i] : i, u = typeof o == "string" ? [o] : o, c = this.options.parseLoadPayload(a, u);
2607
- this.options.request(this.options, t, c, function(l, f) {
2608
- if (f && (f.status >= 500 && f.status < 600 || !f.status)) return r("failed loading " + t + "; status code: " + f.status, !0);
2609
- if (f && f.status >= 400 && f.status < 500) return r("failed loading " + t + "; status code: " + f.status, !1);
2610
- if (!f && l && l.message) {
2611
- var d = l.message.toLowerCase(), g = ["failed", "fetch", "network", "load"].find(function(b) {
2612
- return d.indexOf(b) > -1;
2613
- });
2614
- if (g)
2615
- return r("failed loading " + t + ": " + l.message, !0);
2616
- }
2617
- if (l) return r(l, !1);
2618
- var m, v;
2619
- try {
2620
- typeof f.data == "string" ? m = s.options.parse(f.data, i, o) : m = f.data;
2621
- } catch {
2622
- v = "failed parsing " + t + " to json";
2623
- }
2624
- if (v) return r(v, !1);
2625
- r(null, m);
2626
- });
2627
- }
2628
- }, {
2629
- key: "create",
2630
- value: function(t, r, i, o, s) {
2631
- var a = this;
2632
- if (this.options.addPath) {
2633
- typeof t == "string" && (t = [t]);
2634
- var u = this.options.parsePayload(r, i, o), c = 0, l = [], f = [];
2635
- t.forEach(function(d) {
2636
- var g = a.options.addPath;
2637
- typeof a.options.addPath == "function" && (g = a.options.addPath(d, r));
2638
- var m = a.services.interpolator.interpolate(g, {
2639
- lng: d,
2640
- ns: r
2641
- });
2642
- a.options.request(a.options, m, u, function(v, b) {
2643
- c += 1, l.push(v), f.push(b), c === t.length && typeof s == "function" && s(l, f);
2644
- });
2645
- });
2646
- }
2647
- }
2648
- }, {
2649
- key: "reload",
2650
- value: function() {
2651
- var t = this, r = this.services, i = r.backendConnector, o = r.languageUtils, s = r.logger, a = i.language;
2652
- if (!(a && a.toLowerCase() === "cimode")) {
2653
- var u = [], c = function(f) {
2654
- var d = o.toResolveHierarchy(f);
2655
- d.forEach(function(g) {
2656
- u.indexOf(g) < 0 && u.push(g);
2657
- });
2658
- };
2659
- c(a), this.allOptions.preload && this.allOptions.preload.forEach(function(l) {
2660
- return c(l);
2661
- }), u.forEach(function(l) {
2662
- t.allOptions.ns.forEach(function(f) {
2663
- i.read(l, f, "read", null, null, function(d, g) {
2664
- d && s.warn("loading namespace ".concat(f, " for language ").concat(l, " failed"), d), !d && g && s.log("loaded namespace ".concat(f, " for language ").concat(l), g), i.loaded("".concat(l, "|").concat(f), d, g);
2665
- });
2666
- });
2667
- });
2668
- }
2669
- }
2670
- }]);
2671
- })();
2672
- Zn.type = "backend";
2673
- var ss = function(e) {
2674
- return {
2675
- type: "backend",
2676
- init: function(r, i, o) {
2677
- },
2678
- read: function(r, i, o) {
2679
- if (typeof e == "function") {
2680
- if (e.length < 3) {
2681
- try {
2682
- var s = e(r, i);
2683
- s && typeof s.then == "function" ? s.then(function(a) {
2684
- return o(null, a && a.default || a);
2685
- }).catch(o) : o(null, s);
2686
- } catch (a) {
2687
- o(a);
2688
- }
2689
- return;
2690
- }
2691
- e(r, i, o);
2692
- return;
2693
- }
2694
- o(null, e && e[r] && e[r][i]);
2695
- }
2696
- };
2697
- };
2698
- const as = {
2699
- debug: !1,
2700
- fallbackLng: In.enum.en,
2701
- namespace: "translation",
2702
- supportedLngs: Object.values(kn),
2703
- nonExplicitSupportedLngs: !1
2704
- }, us = {
2705
- react: {
2706
- useSuspense: !0
2707
- },
2708
- detection: {
2709
- order: ["navigator", "htmlTag", "path", "subdomain"],
2710
- caches: ["localStorage", "cookie"]
2711
- }
2712
- }, hn = (n, e) => {
2713
- const t = import.meta.url.split("/").pop();
2714
- return `${import.meta.url.replace(`/${t}`, "")}/locales/${n}/${e}.json`;
2715
- };
2716
- function wt(n) {
2717
- return se.isInitialized || (se.use(Xn).use(
2718
- new Wn(null, {
2719
- order: ["cookie", "localStorage", "navigator"],
2720
- lookupQuerystring: "lng",
2721
- lookupCookie: "i18next",
2722
- lookupLocalStorage: "i18nextLng",
2723
- caches: ["localStorage", "cookie"]
2724
- })
2725
- ).use(Zi).init({
2726
- ...as,
2727
- backend: {
2728
- backends: [
2729
- Zn,
2730
- // if a namespace can't be loaded via normal http-backend loadPath, then the inMemoryLocalBackend will try to return the correct resources
2731
- // with dynamic import, you have to use the "default" key of the module ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#importing_defaults )
2732
- ss(
2733
- (e, t) => import(hn(e, t))
2734
- )
2735
- ],
2736
- backendOptions: [
2737
- {
2738
- loadPath: hn("{{lng}}", "{{ns}}")
2739
- }
2740
- ]
2741
- },
2742
- ...us
2743
- }), se.on("loaded", () => {
2744
- n == null || n(se);
2745
- })), se;
2746
- }
2747
- const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2748
- __proto__: null,
2749
- default: wt,
2750
- initializeI18n: wt
2751
- }, Symbol.toStringTag, { value: "Module" }));
2752
- function Aa(n) {
2753
- const e = wt();
2754
- return io("translation", { i18n: e, ...n });
2755
- }
2756
- const Lt = 60 * 1e3, Re = Lt, er = Re * 2, tr = Re * 3, Ct = Re * 15, Ge = Lt, Qe = Ge * 2, nr = Ge * 3, rr = Lt * 15;
2757
- var ir = /* @__PURE__ */ ((n) => (n.SelectAll = "SelectAll", n))(ir || {}), or = /* @__PURE__ */ ((n) => (n.Text = "text", n.Image = "image", n))(or || {});
2758
- w();
2759
- const cs = "___", fs = Br((n) => {
2760
- const e = n.split(cs);
2761
- try {
2762
- return e.length === 4;
2763
- } catch {
2764
- return !1;
2765
- }
2766
- }), ds = y({
2767
- captchaId: _e([p(), jt()]),
2768
- captchaContentId: _e([p(), jt()]),
2769
- salt: p().min(34),
2770
- solution: w().array().optional(),
2771
- unlabelled: w().array().optional(),
2772
- timeLimit: w().optional()
2773
- }), sr = y({
2774
- hash: p(),
2775
- data: p(),
2776
- type: ke(or)
2777
- }), ar = sr.extend({
2778
- hash: p()
2779
- }), ps = ar.extend({
2780
- label: p()
2781
- }), hs = ar.extend({
2782
- label: p().optional()
2783
- }), ur = ds.extend({
2784
- items: q(sr),
2785
- target: p()
2786
- }), gs = ur.extend({
2787
- solution: p().array().optional(),
2788
- unlabelled: p().array().optional()
2789
- }), ms = gs.extend({
2790
- solution: w().array().optional(),
2791
- unlabelled: w().array().optional()
2792
- }), ys = q(ur);
2793
- q(
2794
- ms
2795
- );
2796
- const lr = y({
2797
- captchaId: p(),
2798
- captchaContentId: p(),
2799
- solution: p().array(),
2800
- salt: p()
2801
- });
2802
- q(lr);
2803
- y({
2804
- items: q(hs)
2805
- });
2806
- y({
2807
- items: q(ps)
2808
- });
2809
- y({
2810
- captchas: ys,
2811
- format: ke(ir)
2812
- });
2813
- y({
2814
- labels: q(p())
2815
- });
2816
- const $a = (n) => new Promise((e) => setTimeout(e, n)), Na = (n, e) => {
2817
- let t = 0;
2818
- const r = "0".repeat(e);
2819
- for (; ; ) {
2820
- const i = new TextEncoder().encode(t + n);
2821
- if (vs(Vr(i)).startsWith(r))
2822
- return t;
2823
- t += 1;
2824
- }
2825
- }, vs = (n) => Array.from(n).map((e) => e.toString(16).padStart(2, "0")).join("");
2826
- function W(n, e, t) {
2827
- if (n.length === 0)
2828
- throw new Error("Array is empty");
2829
- if (!Number.isFinite(e))
2830
- throw new Error(`Index ${e} is not a finite number`);
2831
- if (e > 0 ? e = e % n.length : e = Math.ceil(Math.abs(e) / n.length) * n.length + e, e >= n.length)
2832
- throw new Error(`Index ${e} larger than array length ${n.length}`);
2833
- if (e < 0)
2834
- throw new Error(`Index ${e} smaller than 0`);
2835
- return n[e];
2836
- }
2837
- const ws = (n) => Array.isArray(n) && n !== null, bs = "2.5.5", qe = new Array(256), cr = new Array(256 * 256);
2838
- for (let n = 0; n < 256; n++)
2839
- qe[n] = n.toString(16).padStart(2, "0");
2840
- for (let n = 0; n < 256; n++) {
2841
- const e = n << 8;
2842
- for (let t = 0; t < 256; t++)
2843
- cr[e | t] = qe[n] + qe[t];
2844
- }
2845
- function ut(n, e) {
2846
- const t = n.length % 2 | 0, r = n.length - t | 0;
2847
- for (let i = 0; i < r; i += 2)
2848
- e += cr[n[i] << 8 | n[i + 1]];
2849
- return t && (e += qe[n[r] | 0]), e;
2850
- }
2851
- function Ze(n, e = -1, t = !0) {
2852
- const r = t ? "0x" : "";
2853
- if (!(n != null && n.length))
2854
- return r;
2855
- if (e > 0) {
2856
- const i = Math.ceil(e / 8);
2857
- if (n.length > i)
2858
- return `${ut(n.subarray(0, i / 2), r)}…${ut(n.subarray(n.length - i / 2), "")}`;
2859
- }
2860
- return ut(n, r);
2861
- }
2862
- const ja = (n) => ws(n) ? Ze(new Uint8Array(n)) : n.toString(), Da = (n, e) => {
2863
- const t = n.replace(/^0x/, "").split("");
2864
- let r = 0, i = t.length - 1;
2865
- const o = e.length.toString(16).padStart(2, "0");
2866
- t[r++] = W(o, 0), t[r++] = W(o, 1);
2867
- const s = [], a = [];
2868
- let u = 0;
2869
- for (const c of e) {
2870
- const l = c.toString(16), f = l.length;
2871
- u += f;
2872
- const d = i - f + 1;
2873
- s.push(d), a.push(f);
2874
- for (let g = 0; g < f; g++)
2875
- t[d + g] = W(l, g);
2876
- i -= f;
2877
- }
2878
- if (u > n.length)
2879
- throw new Error(
2880
- `Hex data length ${u} exceeds length of hex string ${t.length}`
2881
- );
2882
- for (let c = 0; c < e.length; c++) {
2883
- const l = W(s, c).toString(16).padStart(2, "0");
2884
- u += l.length;
2885
- const f = W(a, c).toString(16).padStart(2, "0");
2886
- if (u += f.length, u > n.length)
2887
- throw new Error(
2888
- `Hex data length ${u} exceeds length of hex string ${t.length}`
2889
- );
2890
- t[r++] = W(l, 0), t[r++] = W(l, 1), t[r++] = W(f, 0), t[r++] = W(f, 1);
2891
- }
2892
- return `0x${t.join("")}`;
2893
- };
2894
- var Ss = Object.defineProperty, xs = (n, e, t) => e in n ? Ss(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, gn = (n, e, t) => (xs(n, typeof e != "symbol" ? e + "" : e, t), t), lt = {
2895
- 0: 0,
2896
- 1: 1,
2897
- 2: 2,
2898
- 3: 3,
2899
- 4: 4,
2900
- 5: 5,
2901
- 6: 6,
2902
- 7: 7,
2903
- 8: 8,
2904
- 9: 9,
2905
- a: 10,
2906
- b: 11,
2907
- c: 12,
2908
- d: 13,
2909
- e: 14,
2910
- f: 15,
2911
- A: 10,
2912
- B: 11,
2913
- C: 12,
2914
- D: 13,
2915
- E: 14,
2916
- F: 15
2917
- };
2918
- function Es(n) {
2919
- const e = n.length % 2, t = (n[1] === "x" ? 2 : 0) + e, r = (n.length - t) / 2 + e, i = new Uint8Array(r);
2920
- e && (i[0] = 0 | lt[n[2]]);
2921
- for (let o = 0; o < r; ) {
2922
- const s = t + o * 2, a = lt[n[s]], u = lt[n[s + 1]];
2923
- i[e + o++] = a << 4 | u;
2924
- }
2925
- return i;
2926
- }
2927
- var mn = class extends Uint8Array {
2928
- constructor(n) {
2929
- super(n), gn(this, "i", 0), gn(this, "v"), this.v = new DataView(n);
2930
- }
2931
- }, re = (n) => (e) => n(e instanceof mn ? e : new mn(e instanceof Uint8Array ? e.buffer : typeof e == "string" ? Es(e).buffer : e)), et = (n) => {
2932
- const e = n.length;
2933
- let t = 0;
2934
- for (let i = 0; i < e; i++)
2935
- t += n[i].length;
2936
- const r = new Uint8Array(t);
2937
- for (let i = 0, o = 0; i < e; i++) {
2938
- const s = n[i];
2939
- r.set(s, o), o += s.byteLength;
2940
- }
2941
- return r;
2942
- };
2943
- function yn(n, e) {
2944
- const t = Object.keys(n), r = t.length, i = {};
2945
- for (let o = 0; o < r; o++) {
2946
- const s = t[o];
2947
- i[s] = e(n[s], s);
2948
- }
2949
- return i;
2950
- }
2951
- var D = (n, e) => {
2952
- const t = [n, e];
2953
- return t.enc = n, t.dec = e, t;
2954
- }, fr = (n, e) => (t) => n(e(t)), dr = (n, e) => (t) => e(n(t)), Os = ([n, e], t, r) => D(fr(n, t), dr(e, r));
2955
- function Ts(n, e) {
2956
- return re((t) => {
2957
- const r = t.v[e](t.i, !0);
2958
- return t.i += n, r;
2959
- });
2960
- }
2961
- function Ls(n, e) {
2962
- return (t) => {
2963
- const r = new Uint8Array(n);
2964
- return new DataView(r.buffer)[e](0, t, !0), r;
2965
- };
2966
- }
2967
- function Q(n, e, t) {
2968
- return D(Ls(n, t), Ts(n, e));
2969
- }
2970
- var de = Q(1, "getUint8", "setUint8"), ze = Q(2, "getUint16", "setUint16"), Ce = Q(4, "getUint32", "setUint32"), pr = Q(8, "getBigUint64", "setBigUint64");
2971
- Q(1, "getInt8", "setInt8");
2972
- Q(2, "getInt16", "setInt16");
2973
- Q(4, "getInt32", "setInt32");
2974
- Q(8, "getBigInt64", "setBigInt64");
2975
- var hr = (n) => {
2976
- const e = new Uint8Array(16), t = new DataView(e.buffer);
2977
- return t.setBigInt64(0, n, !0), t.setBigInt64(8, n >> 64n, !0), e;
2978
- }, gr = (n) => re((e) => {
2979
- const { v: t, i: r } = e, i = t.getBigUint64(r, !0), o = t[n](r + 8, !0);
2980
- return e.i += 16, o << 64n | i;
2981
- });
2982
- D(hr, gr("getBigUint64"));
2983
- D(hr, gr("getBigInt64"));
2984
- var mr = (n) => {
2985
- const e = new Uint8Array(32), t = new DataView(e.buffer);
2986
- return t.setBigInt64(0, n, !0), t.setBigInt64(8, n >> 64n, !0), t.setBigInt64(16, n >> 128n, !0), t.setBigInt64(24, n >> 192n, !0), e;
2987
- }, yr = (n) => re((e) => {
2988
- let t = e.v.getBigUint64(e.i, !0);
2989
- return e.i += 8, t |= e.v.getBigUint64(e.i, !0) << 64n, e.i += 8, t |= e.v.getBigUint64(e.i, !0) << 128n, e.i += 8, t |= e.v[n](e.i, !0) << 192n, e.i += 8, t;
2990
- });
2991
- D(mr, yr("getBigUint64"));
2992
- D(mr, yr("getBigInt64"));
2993
- Os(de, (n) => n ? 1 : 0, Boolean);
2994
- var Cs = [de[1], ze[1], Ce[1]], Ps = re((n) => {
2995
- const e = n[n.i], t = e & 3;
2996
- if (t < 3)
2997
- return Cs[t](n) >>> 2;
2998
- const r = (e >>> 2) + 4;
2999
- n.i++;
3000
- let i = 0n;
3001
- const o = r / 8 | 0;
3002
- let s = 0n;
3003
- for (let u = 0; u < o; u++)
3004
- i = pr[1](n) << s | i, s += 64n;
3005
- let a = r % 8;
3006
- return a > 3 && (i = BigInt(Ce[1](n)) << s | i, s += 32n, a -= 4), a > 1 && (i = BigInt(ze[1](n)) << s | i, s += 16n, a -= 2), a && (i = BigInt(de[1](n)) << s | i), i;
3007
- }), ks = 1n << 56n, Is = 1 << 24, Rs = 256, As = 4294967295n, $s = 64, Ns = 16384, js = 1 << 30, Ds = (n) => {
3008
- if (n < 0)
3009
- throw new Error(`Wrong compact input (${n})`);
3010
- const e = Number(n) << 2;
3011
- if (n < $s)
3012
- return de[0](e);
3013
- if (n < Ns)
3014
- return ze[0](e | 1);
3015
- if (n < js)
3016
- return Ce[0](e | 2);
3017
- let t = [new Uint8Array(1)], r = BigInt(n);
3018
- for (; r >= ks; )
3019
- t.push(pr[0](r)), r >>= 64n;
3020
- r >= Is && (t.push(Ce[0](Number(r & As))), r >>= 32n);
3021
- let i = Number(r);
3022
- i >= Rs && (t.push(ze[0](i)), i >>= 16), i && t.push(de[0](i));
3023
- const o = et(t);
3024
- return o[0] = o.length - 5 << 2 | 3, o;
3025
- }, vr = D(Ds, Ps), Us = new TextEncoder(), Fs = (n) => {
3026
- const e = Us.encode(n);
3027
- return et([vr.enc(e.length), e]);
3028
- }, _s = new TextDecoder(), Ms = re((n) => {
3029
- let e = vr.dec(n);
3030
- const t = new DataView(n.buffer, n.i, e);
3031
- return n.i += e, _s.decode(t);
3032
- }), M = D(Fs, Ms), Hs = () => {
3033
- }, Vs = new Uint8Array(0);
3034
- D(() => Vs, Hs);
3035
- var wr = (n) => re((e) => de[1](e) > 0 ? n(e) : void 0), br = (n) => (e) => {
3036
- const t = new Uint8Array(1);
3037
- return e === void 0 ? t : (t[0] = 1, et([t, n(e)]));
3038
- }, H = (n) => D(br(n[0]), wr(n[1]));
3039
- H.enc = br;
3040
- H.dec = wr;
3041
- var Sr = (...n) => re((e) => n.map((t) => t(e))), xr = (...n) => (e) => et(n.map((t, r) => t(e[r]))), tt = (...n) => D(xr(...n.map(([e]) => e)), Sr(...n.map(([, e]) => e)));
3042
- tt.enc = xr;
3043
- tt.dec = Sr;
3044
- var Er = (n) => {
3045
- const e = Object.keys(n);
3046
- return fr(tt.enc(...Object.values(n)), (t) => e.map((r) => t[r]));
3047
- }, Or = (n) => {
3048
- const e = Object.keys(n);
3049
- return dr(tt.dec(...Object.values(n)), (t) => Object.fromEntries(t.map((r, i) => [e[i], r])));
3050
- }, le = (n) => D(Er(yn(n, (e) => e[0])), Or(yn(n, (e) => e[1])));
3051
- le.enc = Er;
3052
- le.dec = Or;
3053
- const Bs = y({
3054
- [h.requestHash]: p()
3055
- });
3056
- y({
3057
- [h.challenge]: p()
3058
- });
3059
- const Ks = y({
3060
- [h.timestamp]: p()
3061
- }), vn = y({
3062
- [h.challenge]: p().optional(),
3063
- [h.requestHash]: p().optional(),
3064
- [h.timestamp]: p().optional()
3065
- });
3066
- y({
3067
- [h.commitmentId]: p().optional(),
3068
- [h.providerUrl]: p().optional(),
3069
- [h.dapp]: p(),
3070
- [h.user]: p(),
3071
- [h.challenge]: p().optional(),
3072
- [h.nonce]: w().optional(),
3073
- [h.timestamp]: p(),
3074
- [h.signature]: y({
3075
- [h.provider]: vn,
3076
- [h.user]: vn
3077
- })
3078
- });
3079
- const qs = le({
3080
- [h.commitmentId]: H(M),
3081
- [h.providerUrl]: H(M),
3082
- [h.dapp]: M,
3083
- [h.user]: M,
3084
- [h.challenge]: H(M),
3085
- [h.nonce]: H(Ce),
3086
- [h.timestamp]: M,
3087
- [h.signature]: le({
3088
- [h.provider]: le({
3089
- [h.challenge]: H(M),
3090
- [h.requestHash]: H(M)
3091
- }),
3092
- [h.user]: le({
3093
- [h.timestamp]: H(M),
3094
- [h.requestHash]: H(M)
3095
- })
3096
- })
3097
- }), Tr = p().startsWith("0x"), Ua = (n) => {
3098
- var e, t, r, i;
3099
- return Ze(
3100
- qs.enc({
3101
- [h.commitmentId]: void 0,
3102
- [h.providerUrl]: void 0,
3103
- [h.challenge]: void 0,
3104
- [h.nonce]: void 0,
3105
- // override any optional fields by spreading the procaptchaOutput
3106
- ...n,
3107
- signature: {
3108
- provider: {
3109
- challenge: ((e = n.signature.provider) == null ? void 0 : e.challenge) || void 0,
3110
- requestHash: ((t = n.signature.provider) == null ? void 0 : t.requestHash) || void 0
3111
- },
3112
- user: {
3113
- timestamp: ((r = n.signature.user) == null ? void 0 : r.timestamp) || void 0,
3114
- requestHash: ((i = n.signature.user) == null ? void 0 : i.requestHash) || void 0
3115
- }
3116
- }
3117
- })
3118
- );
3119
- }, Lr = 2, Cr = 0;
3120
- var zs = /* @__PURE__ */ ((n) => (n.GetImageCaptchaChallenge = "/v1/prosopo/provider/client/captcha/image", n.GetPowCaptchaChallenge = "/v1/prosopo/provider/client/captcha/pow", n.GetFrictionlessCaptchaChallenge = "/v1/prosopo/provider/client/captcha/frictionless", n.SubmitImageCaptchaSolution = "/v1/prosopo/provider/client/solution", n.SubmitPowCaptchaSolution = "/v1/prosopo/provider/client/pow/solution", n.VerifyPowCaptchaSolution = "/v1/prosopo/provider/client/pow/verify", n.VerifyImageCaptchaSolutionDapp = "/v1/prosopo/provider/client/image/dapp/verify", n.GetProviderStatus = "/v1/prosopo/provider/client/status", n.SubmitUserEvents = "/v1/prosopo/provider/client/events", n))(zs || {}), Ws = /* @__PURE__ */ ((n) => (n.Healthz = "/healthz", n.GetProviderDetails = "/v1/prosopo/provider/public/details", n))(Ws || {});
3121
- y({
3122
- version: p(),
3123
- message: p(),
3124
- redis: y({
3125
- actor: p(),
3126
- isReady: Y(),
3127
- awaitingTimeSeconds: w()
3128
- }).array()
3129
- });
3130
- var Js = /* @__PURE__ */ ((n) => (n.SiteKeyRegister = "/v1/prosopo/provider/admin/sitekey/register", n.UpdateDetectorKey = "/v1/prosopo/provider/admin/detector/update", n.RemoveDetectorKey = "/v1/prosopo/provider/admin/detector/remove", n.ToggleMaintenanceMode = "/v1/prosopo/provider/admin/maintenance/toggle", n))(Js || {});
3131
- const Pr = {
3132
- "/v1/prosopo/provider/client/captcha/image": { windowMs: 6e4, limit: 30 },
3133
- "/v1/prosopo/provider/client/captcha/pow": { windowMs: 6e4, limit: 60 },
3134
- "/v1/prosopo/provider/client/solution": { windowMs: 6e4, limit: 60 },
3135
- "/v1/prosopo/provider/client/captcha/frictionless": {
3136
- windowMs: 6e4,
3137
- limit: 60
3138
- },
3139
- "/v1/prosopo/provider/client/pow/solution": { windowMs: 6e4, limit: 60 },
3140
- "/v1/prosopo/provider/client/pow/verify": { windowMs: 6e4, limit: 60 },
3141
- "/v1/prosopo/provider/client/image/dapp/verify": {
3142
- windowMs: 6e4,
3143
- limit: 60
3144
- },
3145
- "/v1/prosopo/provider/client/status": { windowMs: 6e4, limit: 60 },
3146
- "/v1/prosopo/provider/public/details": { windowMs: 6e4, limit: 60 },
3147
- "/v1/prosopo/provider/client/events": { windowMs: 6e4, limit: 60 },
3148
- "/v1/prosopo/provider/admin/sitekey/register": { windowMs: 6e4, limit: 5 },
3149
- "/v1/prosopo/provider/admin/detector/update": { windowMs: 6e4, limit: 5 },
3150
- "/v1/prosopo/provider/admin/detector/remove": { windowMs: 6e4, limit: 5 },
3151
- "/v1/prosopo/provider/admin/maintenance/toggle": { windowMs: 6e4, limit: 5 }
3152
- }, Xs = (n) => y(
3153
- Object.entries(n).reduce(
3154
- (e, [t, r]) => {
3155
- const i = t;
3156
- return e[i] = y({
3157
- windowMs: Dt.number().optional().default(r.windowMs),
3158
- limit: Dt.number().optional().default(r.limit)
3159
- }), e;
3160
- },
3161
- {}
3162
- )
3163
- ), Ys = Xs(
3164
- Pr
3165
- );
3166
- y({
3167
- [h.user]: p(),
3168
- [h.dapp]: p(),
3169
- [h.datasetId]: _e([p(), q(w())]),
3170
- [h.sessionId]: p().optional()
3171
- });
3172
- y({
3173
- [h.user]: p(),
3174
- [h.dapp]: p(),
3175
- [h.captchas]: q(lr),
3176
- [h.requestHash]: p(),
3177
- [h.timestamp]: p(),
3178
- [h.signature]: y({
3179
- [h.user]: Ks,
3180
- [h.provider]: Bs
3181
- })
3182
- });
3183
- y({
3184
- [h.token]: Tr,
3185
- [h.dappSignature]: p(),
3186
- [h.maxVerifiedTime]: w().optional().default(Ct),
3187
- [h.ip]: p().optional()
3188
- });
3189
- y({
3190
- [h.token]: Tr,
3191
- [h.dappSignature]: p(),
3192
- [h.verifiedTimeout]: w().optional().default(Qe),
3193
- [h.ip]: p().optional()
3194
- });
3195
- y({
3196
- [h.user]: p(),
3197
- [h.dapp]: p(),
3198
- [h.sessionId]: p().optional()
3199
- });
3200
- const Fa = y({
3201
- [h.challenge]: fs,
3202
- [h.difficulty]: w(),
3203
- [h.signature]: y({
3204
- [h.user]: y({
3205
- [h.timestamp]: p()
3206
- }),
3207
- [h.provider]: y({
3208
- [h.challenge]: p()
3209
- })
3210
- }),
3211
- [h.user]: p(),
3212
- [h.dapp]: p(),
3213
- [h.nonce]: w(),
3214
- [h.verifiedTimeout]: w().optional().default(Qe)
3215
- });
3216
- y({
3217
- [h.dapp]: p(),
3218
- [h.token]: p(),
3219
- [h.user]: p(),
3220
- [h.headHash]: p()
3221
- });
3222
- y({
3223
- [h.siteKey]: p()
3224
- });
3225
- y({
3226
- [h.siteKey]: p(),
3227
- [h.tier]: ke(St),
3228
- [h.settings]: Ti.optional()
3229
- });
3230
- const _a = y({
3231
- [h.detectorKey]: p()
3232
- }), Ma = y({
3233
- [h.detectorKey]: p(),
3234
- [h.expirationInSeconds]: w().positive().optional()
3235
- }), Ha = y({
3236
- [h.enabled]: Y()
3237
- }), kr = y({
3238
- solved: y({
3239
- count: w().positive()
3240
- }).optional().default({ count: Lr }),
3241
- unsolved: y({
3242
- count: w().nonnegative()
3243
- }).optional().default({ count: Cr })
3244
- });
3245
- var Ir = /* @__PURE__ */ ((n) => (n.ipAddress = "ipAddress", n.userAccount = "userAccount", n))(Ir || {});
3246
- const Gs = ke(Ir);
3247
- y({
3248
- global: Y(),
3249
- hardBlock: Y(),
3250
- type: Gs,
3251
- dappAccount: p().optional(),
3252
- captchaConfig: kr.optional()
3253
- });
3254
- y({
3255
- [h.dapp]: p()
3256
- });
3257
- const Rr = 0.2, Ar = 0.5, $r = 0.2, Nr = 0.1, Qs = y({
3258
- PENALTY_OLD_TIMESTAMP: w().positive().optional().default(Rr),
3259
- PENALTY_ACCESS_RULE: w().positive().optional().default(Ar),
3260
- PENALTY_UNVERIFIED_HOST: w().positive().optional().default($r),
3261
- PENALTY_WEBVIEW: w().positive().optional().default(Nr)
3262
- }), wn = Je([
3263
- "trace",
3264
- "debug",
3265
- "info",
3266
- "warn",
3267
- "error",
3268
- "fatal",
3269
- "log"
3270
- ]);
3271
- Je([
3272
- "mongo",
3273
- "mongoMemory",
3274
- "provider",
3275
- "client",
3276
- "captcha"
3277
- ]);
3278
- const bt = Je([
3279
- "development",
3280
- "staging",
3281
- "production"
3282
- ]), Zs = En(
3283
- bt,
3284
- y({
3285
- type: p(),
3286
- endpoint: p(),
3287
- dbname: p().default("prosopo"),
3288
- authSource: p().default("admin")
3289
- })
3290
- ), ea = y({
3291
- logLevel: wn.optional().default(wn.enum.info),
3292
- defaultEnvironment: bt.default(
3293
- bt.Values.production
3294
- ),
3295
- // The account with which to query the contract.merge sign transactions
3296
- account: y({
3297
- address: p().optional(),
3298
- secret: p().optional(),
3299
- password: p().optional()
3300
- })
3301
- });
3302
- L.object({
3303
- encoded: L.string(),
3304
- encoding: L.object({
3305
- content: L.array(L.string()),
3306
- type: L.array(L.string()),
3307
- version: L.string()
3308
- }),
3309
- address: L.string(),
3310
- meta: L.object({
3311
- genesisHash: L.string(),
3312
- name: L.string(),
3313
- whenCreated: L.number()
3314
- })
3315
- });
3316
- const jr = ea.merge(
3317
- y({
3318
- database: Zs.optional()
3319
- })
3320
- ), ta = y({
3321
- baseURL: p().url(),
3322
- port: w().optional().default(9229)
3323
- }).default({
3324
- baseURL: "http://localhost",
3325
- port: 9229
3326
- });
3327
- y({
3328
- requiredNumberOfSolutions: w().positive().min(2),
3329
- solutionWinningPercentage: w().positive().max(100),
3330
- captchaBlockRecency: w().positive().min(2)
3331
- });
3332
- const Dr = jr.merge(
3333
- y({
3334
- userAccountAddress: p().optional(),
3335
- web2: Y().optional().default(!0),
3336
- solutionThreshold: w().positive().max(100).optional().default(80),
3337
- dappName: p().optional().default("ProsopoClientDapp"),
3338
- serverUrl: p().optional()
3339
- })
3340
- ), Ur = {
3341
- challengeTimeout: Re,
3342
- solutionTimeout: er,
3343
- verifiedTimeout: tr,
3344
- cachedTimeout: Ct
3345
- }, Fr = {
3346
- challengeTimeout: Qe,
3347
- solutionTimeout: Ge,
3348
- cachedTimeout: nr
3349
- }, _r = {
3350
- maxVerifiedTime: rr
3351
- }, Pt = {
3352
- image: Ur,
3353
- pow: Fr,
3354
- contract: _r
3355
- }, Mr = y({
3356
- image: y({
3357
- // Set this to a default value for the frontend
3358
- challengeTimeout: w().positive().optional().default(Re),
3359
- // Set this to a default value for the frontend
3360
- solutionTimeout: w().positive().optional().default(er),
3361
- verifiedTimeout: w().positive().optional().default(tr),
3362
- cachedTimeout: w().positive().optional().default(Ct)
3363
- }).default(Ur),
3364
- pow: y({
3365
- verifiedTimeout: w().positive().optional().default(Qe),
3366
- solutionTimeout: w().positive().optional().default(Ge),
3367
- cachedTimeout: w().positive().optional().default(nr)
3368
- }).default(Fr),
3369
- contract: y({
3370
- maxVerifiedTime: w().positive().optional().default(rr)
3371
- }).default(_r)
3372
- }).default(Pt);
3373
- Dr.merge(
3374
- y({
3375
- serverUrl: p().url().optional(),
3376
- timeouts: Mr.optional().default(Pt)
3377
- })
3378
- );
3379
- y({
3380
- area: y({
3381
- width: w().positive(),
3382
- height: w().positive()
3383
- }),
3384
- offsetParameter: w().positive(),
3385
- multiplier: w().positive(),
3386
- fontSizeFactor: w().positive(),
3387
- maxShadowBlur: w().positive(),
3388
- numberOfRounds: w().positive(),
3389
- seed: w().positive()
3390
- });
3391
- const na = _e([Ut("light"), Ut("dark")]);
3392
- var ra = /* @__PURE__ */ ((n) => (n.visible = "visible", n.invisible = "invisible", n))(ra || {});
3393
- const ia = Je([
3394
- "visible",
3395
- "invisible"
3396
- /* invisible */
3397
- ]).optional(), Va = Dr.and(
3398
- y({
3399
- theme: na.optional().default("light"),
3400
- captchas: Mr.optional().default(Pt),
3401
- language: In.optional(),
3402
- mode: ia.optional().default(
3403
- "visible"
3404
- /* visible */
3405
- )
3406
- })
3407
- ), oa = L.object({
3408
- apiKey: L.string(),
3409
- baseUrl: L.string().url()
3410
- });
3411
- jr.merge(
3412
- y({
3413
- host: p(),
3414
- captchas: kr.optional().default({
3415
- solved: { count: Lr },
3416
- unsolved: { count: Cr }
3417
- }),
3418
- penalties: Qs.optional().default({
3419
- PENALTY_OLD_TIMESTAMP: Rr,
3420
- PENALTY_ACCESS_RULE: Ar,
3421
- PENALTY_UNVERIFIED_HOST: $r,
3422
- PENALTY_WEBVIEW: Nr
3423
- }),
3424
- scheduledTasks: y({
3425
- captchaScheduler: y({
3426
- schedule: p().optional()
3427
- }).optional(),
3428
- clientListScheduler: y({
3429
- schedule: p().optional()
3430
- }).optional()
3431
- }).optional(),
3432
- server: ta.optional(),
3433
- mongoEventsUri: p().optional(),
3434
- mongoCaptchaUri: p().optional(),
3435
- mongoClientUri: p().optional(),
3436
- ipApi: oa,
3437
- redisConnection: y({
3438
- url: p(),
3439
- password: p(),
3440
- indexName: p().optional()
3441
- }).default({
3442
- url: "redis://localhost:6379",
3443
- password: "root"
3444
- }),
3445
- rateLimits: Ys.default(Pr),
3446
- proxyCount: w().optional().default(0),
3447
- lRules: En(p(), w()).optional(),
3448
- authAccount: y({
3449
- address: p().optional(),
3450
- secret: p().optional(),
3451
- password: p().optional()
3452
- })
3453
- })
3454
- );
3455
- const sa = async () => (await import("./fp.esm-DYWeNGcH.js")).default, aa = async () => (await (await (await sa()).load()).get()).visitorId, ae = new Uint8Array([161, 35, 3, 33, 0]), We = new Uint8Array([
3456
- 48,
3457
- 83,
3458
- 2,
3459
- 1,
3460
- 1,
3461
- 48,
3462
- 5,
3463
- 6,
3464
- 3,
3465
- 43,
3466
- 101,
3467
- 112,
3468
- 4,
3469
- 34,
3470
- 4,
3471
- 32
3472
- ]), ua = 32, bn = 64, la = 32, Se = We.length;
3473
- function ca(n, e, t) {
3474
- const r = Array.isArray(t) || t === void 0 ? t : [t], i = Kr(e, n, r), o = i.subarray(0, We.length);
3475
- if (!nt(o, We))
3476
- throw new Error("Invalid encoding header found in body");
3477
- let s = i.subarray(Se, Se + bn), a = Se + bn, u = i.subarray(a, a + ae.length);
3478
- if (!nt(u, ae) && (a = Se + la, s = i.subarray(Se, a), u = i.subarray(a, a + ae.length), !nt(u, ae)))
3479
- throw new Error("Invalid encoding divider found in body");
3480
- const c = a + ae.length;
3481
- return {
3482
- publicKey: i.subarray(c, c + ua),
3483
- secretKey: s
3484
- };
3485
- }
3486
- function fa({ publicKey: n, secretKey: e }, t) {
3487
- if (!e)
3488
- throw new Error("Expected a valid secretKey to be passed to encode");
3489
- const r = ft(We, e, ae, n);
3490
- if (!t)
3491
- return r;
3492
- const { params: i, password: o, salt: s } = qr(t), { encrypted: a, nonce: u } = zr(r, o.subarray(0, 32));
3493
- return ft(Wr(s, i), u, a);
3494
- }
3495
- function da(n, { address: e, meta: t }, r, i) {
3496
- return Ln(
3497
- Jr(r, ["pkcs8", n], i),
3498
- {
3499
- address: e,
3500
- meta: t
3501
- }
3502
- );
3503
- }
3504
- const pa = new Uint8Array([]), ha = {
3505
- sr25519: Tn,
3506
- ed25519: () => {
3507
- throw new Error("Not Implemented");
3508
- },
3509
- ecdsa: () => {
3510
- throw new Error("Not Implemented");
3511
- },
3512
- ethereum: () => {
3513
- throw new Error("Not Implemented");
3514
- }
3515
- }, ga = {
3516
- ecdsa: new Uint8Array([2]),
3517
- ed25519: new Uint8Array([0]),
3518
- ethereum: new Uint8Array([2]),
3519
- sr25519: new Uint8Array([1])
3520
- }, ma = {
3521
- sr25519: Zr,
3522
- ed25519: () => {
3523
- throw new Error("Not Implemented");
3524
- },
3525
- ecdsa: () => {
3526
- throw new Error("Not Implemented");
3527
- },
3528
- ethereum: () => {
3529
- throw new Error("Not Implemented");
3530
- }
3531
- }, ct = {
3532
- sr25519: (n) => n,
3533
- ed25519: () => {
3534
- throw new Error("Not Implemented");
3535
- },
3536
- ecdsa: () => {
3537
- throw new Error("Not Implemented");
3538
- },
3539
- ethereum: () => {
3540
- throw new Error("Not Implemented");
3541
- }
3542
- };
3543
- function xe(n) {
3544
- return !n || si(n);
3545
- }
3546
- function ue({ toSS58: n, type: e }, { publicKey: t, secretKey: r }, i = {}, o = null, s) {
3547
- const a = (l, f) => {
3548
- const d = ca(l, f || o, s);
3549
- if (d.secretKey.length === 64)
3550
- t = d.publicKey, r = d.secretKey;
3551
- else {
3552
- const g = ha[e](d.secretKey);
3553
- t = g.publicKey, r = g.secretKey;
3554
- }
3555
- }, u = (l) => (xe(r) && o && a(l, o), o = fa({ publicKey: t, secretKey: r }, l), s = void 0, o), c = () => {
3556
- const l = ct[e](t);
3557
- return n(l);
3558
- };
3559
- return {
3560
- get address() {
3561
- return c();
3562
- },
3563
- get addressRaw() {
3564
- return ct[e](t);
3565
- },
3566
- get isLocked() {
3567
- return xe(r);
3568
- },
3569
- get meta() {
3570
- return i;
3571
- },
3572
- get publicKey() {
3573
- return t;
3574
- },
3575
- get type() {
3576
- return e;
3577
- },
3578
- // eslint-disable-next-line sort-keys
3579
- decodePkcs8: a,
3580
- derive: (l, f) => {
3581
- if (xe(r))
3582
- throw new Error("Cannot derive on a locked keypair");
3583
- const { path: d } = ei(l), g = On({ publicKey: t, secretKey: r }, d, e);
3584
- return ue({ toSS58: n, type: e }, g, f, null);
3585
- },
3586
- encodePkcs8: (l) => u(l),
3587
- lock: () => {
3588
- r = new Uint8Array([]);
3589
- },
3590
- setMeta: (l) => {
3591
- i = Ln({}, i, l);
3592
- },
3593
- sign: (l, f = {}) => {
3594
- if (xe(r))
3595
- throw new Error("Cannot sign with a locked key pair");
3596
- return ft(
3597
- f.withType ? ga[e] : pa,
3598
- ma[e](dt(l), { publicKey: t, secretKey: r })
3599
- );
3600
- },
3601
- toJson: (l) => {
3602
- const f = ["ecdsa", "ethereum"].includes(e) ? t.length === 20 ? Ft(t) : Ft(Qr(t)) : c();
3603
- return da(
3604
- e,
3605
- { address: f, meta: i },
3606
- u(l),
3607
- !!l
3608
- );
3609
- },
3610
- unlock: (l) => {
3611
- a(l);
3612
- },
3613
- verify: (l, f, d) => Gr(
3614
- l,
3615
- f,
3616
- ct[e](dt(d))
3617
- ).isValid,
3618
- vrfSign: (l, f, d) => {
3619
- if (xe(r))
3620
- throw new Error("Cannot sign with a locked key pair");
3621
- return Yr(l, { secretKey: r }, f, d);
3622
- },
3623
- vrfVerify: (l, f, d, g, m) => Xr(l, f, t, g, m)
3624
- };
3625
- }
3626
- var ee;
3627
- class ya {
3628
- constructor() {
3629
- me(this, ee, {});
3630
- }
3631
- add(e) {
3632
- return j(this, ee)[je(e.address).toString()] = e, e;
3633
- }
3634
- all() {
3635
- return Object.values(j(this, ee));
3636
- }
3637
- get(e) {
3638
- const t = j(this, ee)[je(e).toString()];
3639
- if (!t)
3640
- throw new Error(
3641
- `Unable to retrieve keypair '${ai(e) || De(e) ? Ze(dt(e)) : e}'`
3642
- );
3643
- return t;
3644
- }
3645
- remove(e) {
3646
- delete j(this, ee)[je(e).toString()];
3647
- }
3648
- }
3649
- ee = new WeakMap();
3650
- const va = "bottom drive obey lake curtain smoke basket hold race lonely fit walk", Sn = {
3651
- sr25519: (n) => Tn(n),
3652
- ed25519: () => {
3653
- throw new Error("Not Implemented");
3654
- },
3655
- ecdsa: () => {
3656
- throw new Error("Not Implemented");
3657
- },
3658
- ethereum: () => {
3659
- throw new Error("Not Implemented");
3660
- }
3661
- };
3662
- function wa({ publicKey: n }) {
3663
- return n;
3664
- }
3665
- var V, Pe, ce;
3666
- class ba {
3667
- constructor(e = {}) {
3668
- me(this, V);
3669
- me(this, Pe);
3670
- me(this, ce);
3671
- if (this.decodeAddress = je, this.encodeAddress = (t, r) => ti(t, r ?? j(this, ce)), e.type = e.type || "sr25519", !["sr25519"].includes(e.type || "undefined"))
3672
- throw new Error(
3673
- `Expected a keyring type of either 'sr25519', found '${e.type || "unknown"}`
3674
- );
3675
- ye(this, V, new ya()), ye(this, ce, e.ss58Format), ye(this, Pe, e.type);
3676
- }
3677
- /**
3678
- * @description retrieve the pairs (alias for getPairs)
3679
- */
3680
- get pairs() {
3681
- return this.getPairs();
3682
- }
3683
- /**
3684
- * @description retrieve the publicKeys (alias for getPublicKeys)
3685
- */
3686
- get publicKeys() {
3687
- return this.getPublicKeys();
3688
- }
3689
- /**
3690
- * @description Returns the type of the keyring, ed25519, sr25519 or ecdsa
3691
- */
3692
- get type() {
3693
- return j(this, Pe);
3694
- }
3695
- /**
3696
- * @name addPair
3697
- * @summary Stores an account, given a keyring pair, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3698
- */
3699
- addPair(e) {
3700
- return j(this, V).add(e);
3701
- }
3702
- /**
3703
- * @name addFromAddress
3704
- * @summary Stores an account, given an account address, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3705
- * @description Allows user to explicitly provide separate inputs including account address or public key, and optionally
3706
- * the associated account metadata, and the default encoded value as arguments (that may be obtained from the json file
3707
- * of an account backup), and then generates a keyring pair from them that it passes to
3708
- * `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3709
- */
3710
- addFromAddress(e, t = {}, r = null, i = this.type, o, s) {
3711
- const a = this.decodeAddress(e, o);
3712
- return this.addPair(
3713
- ue(
3714
- { toSS58: this.encodeAddress, type: i },
3715
- { publicKey: a, secretKey: new Uint8Array() },
3716
- t,
3717
- r,
3718
- s
3719
- )
3720
- );
3721
- }
3722
- /**
3723
- * @name addFromJson
3724
- * @summary Stores an account, given JSON data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3725
- * @description Allows user to provide a json object argument that contains account information (that may be obtained from the json file
3726
- * of an account backup), and then generates a keyring pair from it that it passes to
3727
- * `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3728
- */
3729
- addFromJson(e, t) {
3730
- return this.addPair(this.createFromJson(e, t));
3731
- }
3732
- /**
3733
- * @name addFromMnemonic
3734
- * @summary Stores an account, given a mnemonic, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3735
- * @description Allows user to provide a mnemonic (seed phrase that is provided when account is originally created)
3736
- * argument and a metadata argument that contains account information (that may be obtained from the json file
3737
- * of an account backup), and then generates a keyring pair from it that it passes to
3738
- * `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3739
- */
3740
- addFromMnemonic(e, t = {}, r = this.type) {
3741
- return this.addFromUri(e, t, r);
3742
- }
3743
- /**
3744
- * @name addFromPair
3745
- * @summary Stores an account created from an explicit publicKey/secreteKey combination
3746
- */
3747
- addFromPair(e, t = {}, r = this.type) {
3748
- return this.addPair(this.createFromPair(e, t, r));
3749
- }
3750
- /**
3751
- * @name addFromSeed
3752
- * @summary Stores an account, given seed data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3753
- * @description Stores in a keyring pair dictionary the public key of the pair as a key and the pair as the associated value.
3754
- * Allows user to provide the account seed as an argument, and then generates a keyring pair from it that it passes to
3755
- * `addPair` to store in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3756
- */
3757
- addFromSeed(e, t = {}, r = this.type) {
3758
- return this.addPair(
3759
- ue(
3760
- { toSS58: this.encodeAddress, type: r },
3761
- Sn[r](e),
3762
- t,
3763
- null
3764
- )
3765
- );
3766
- }
3767
- /**
3768
- * @name addFromUri
3769
- * @summary Creates an account via an suri
3770
- * @description Extracts the phrase, path and password from a SURI format for specifying secret keys `<secret>/<soft-key>//<hard-key>///<password>` (the `///password` may be omitted, and `/<soft-key>` and `//<hard-key>` maybe repeated and mixed). The secret can be a hex string, mnemonic phrase or a string (to be padded)
3771
- */
3772
- addFromUri(e, t = {}, r = this.type) {
3773
- return this.addPair(this.createFromUri(e, t, r));
3774
- }
3775
- /**
3776
- * @name createFromJson
3777
- * @description Creates a pair from a JSON keyfile
3778
- */
3779
- createFromJson({
3780
- address: e,
3781
- encoded: t,
3782
- encoding: { content: r, type: i, version: o },
3783
- meta: s
3784
- }, a) {
3785
- if (o === "3" && r[0] !== "pkcs8")
3786
- throw new Error(
3787
- `Unable to decode non-pkcs8 type, [${r.join(",")}] found}`
3788
- );
3789
- const u = o === "0" || !Array.isArray(r) ? this.type : r[1];
3790
- if (!u)
3791
- throw new Error("cryptoType is undefined");
3792
- const c = Array.isArray(i) ? i : [i];
3793
- if (!["sr25519"].includes(u))
3794
- throw new Error(`Unknown crypto type ${u}`);
3795
- const l = De(e) ? rt(e) : this.decodeAddress(e, a), f = De(t) ? rt(t) : ni(t);
3796
- return ue(
3797
- { toSS58: this.encodeAddress, type: u },
3798
- { publicKey: l, secretKey: new Uint8Array() },
3799
- s,
3800
- f,
3801
- c
3802
- );
3803
- }
3804
- /**
3805
- * @name createFromPair
3806
- * @summary Creates a pair from an explicit publicKey/secreteKey combination
3807
- */
3808
- createFromPair(e, t = {}, r = this.type) {
3809
- return ue({ toSS58: this.encodeAddress, type: r }, e, t, null);
3810
- }
3811
- /**
3812
- * @name createFromUri
3813
- * @summary Creates a Keypair from an suri
3814
- * @description This creates a pair from the suri, but does not add it to the keyring
3815
- */
3816
- createFromUri(e, t = {}, r = this.type) {
3817
- const i = e.startsWith("//") ? `${va}${e}` : e, { password: o, path: s, phrase: a } = ri(i);
3818
- let u;
3819
- if (De(a, 256))
3820
- u = rt(a);
3821
- else {
3822
- const f = a.split(" ");
3823
- if ([12, 15, 18, 21, 24].includes(f.length))
3824
- u = r === "ethereum" ? (() => {
3825
- throw new Error(
3826
- "Not implemented - Prosopo Keyring supports sr25519 only"
3827
- );
3828
- })() : ii(a, o);
3829
- else {
3830
- if (a.length > 32)
3831
- throw new Error(
3832
- "specified phrase is not a valid mnemonic and is invalid as a raw seed at > 32 bytes"
3833
- );
3834
- u = Cn(a.padEnd(32));
3835
- }
3836
- }
3837
- const l = On(Sn[r](u), s, r);
3838
- return ue(
3839
- { toSS58: this.encodeAddress, type: r },
3840
- l,
3841
- t,
3842
- null
3843
- );
3844
- }
3845
- /**
3846
- * @name getPair
3847
- * @summary Retrieves an account keyring pair from the Keyring Pair Dictionary, given an account address
3848
- * @description Returns a keyring pair value from the keyring pair dictionary by performing
3849
- * a key lookup using the provided account address or public key (after decoding it).
3850
- */
3851
- getPair(e) {
3852
- return j(this, V).get(e);
3853
- }
3854
- /**
3855
- * @name getPairs
3856
- * @summary Retrieves all account keyring pairs from the Keyring Pair Dictionary
3857
- * @description Returns an array list of all the keyring pair values that are stored in the keyring pair dictionary.
3858
- */
3859
- getPairs() {
3860
- return j(this, V).all();
3861
- }
3862
- /**
3863
- * @name getPublicKeys
3864
- * @summary Retrieves Public Keys of all Keyring Pairs stored in the Keyring Pair Dictionary
3865
- * @description Returns an array list of all the public keys associated with each of the keyring pair values that are stored in the keyring pair dictionary.
3866
- */
3867
- getPublicKeys() {
3868
- return j(this, V).all().map(wa);
3869
- }
3870
- /**
3871
- * @name removePair
3872
- * @description Deletes the provided input address or public key from the stored Keyring Pair Dictionary.
3873
- */
3874
- removePair(e) {
3875
- j(this, V).remove(e);
3876
- }
3877
- /**
3878
- * @name setSS58Format;
3879
- * @description Sets the ss58 format for the keyring
3880
- */
3881
- setSS58Format(e) {
3882
- ye(this, ce, e);
3883
- }
3884
- /**
3885
- * @name toJson
3886
- * @summary Returns a JSON object associated with the input argument that contains metadata assocated with an account
3887
- * @description Returns a JSON object containing the metadata associated with an account
3888
- * when valid address or public key and when the account passphrase is provided if the account secret
3889
- * is not already unlocked and available in memory. Note that in [Polkadot-JS Apps](https://github.com/polkadot-js/apps) the user
3890
- * may backup their account to a JSON file that contains this information.
3891
- */
3892
- toJson(e, t) {
3893
- return j(this, V).get(e).toJson(t);
3894
- }
3895
- }
3896
- V = new WeakMap(), Pe = new WeakMap(), ce = new WeakMap();
3897
- class Sa {
3898
- }
3899
- const xa = async () => (await import("./Signer-DP9drQ55.js")).default, Ea = async () => (await import("./utilCryptoChunk-B4ZdOwus.js").then((n) => n.w)).entropyToMnemonic;
3900
- class xn extends Sa {
3901
- async getAccount(e) {
3902
- const t = await this.createAccount(e), r = await this.createExtension(t);
3903
- return {
3904
- account: t,
3905
- extension: r
3906
- };
3907
- }
3908
- async createExtension(e) {
3909
- const t = await xa(), r = new t(async () => {
3910
- });
3911
- return r.signRaw = async (i) => {
3912
- const o = e.keypair.sign(i.data);
3913
- return {
3914
- id: 1,
3915
- // the id of the request to sign. This should be incremented each time and adjust the signature, but we're hacking around this. Hence the signature will always be the same given the same payload.
3916
- signature: Ze(o)
3917
- };
3918
- }, {
3919
- accounts: {
3920
- get: async () => [e],
3921
- subscribe: () => () => {
3922
- }
3923
- },
3924
- name: "procaptcha-web2",
3925
- version: bs,
3926
- signer: r
3927
- };
3928
- }
3929
- async createAccount(e) {
3930
- const t = await aa(), r = oi(t, 128).slice(2), i = Cn(r), s = (await Ea())(i), a = "sr25519", c = new ba({
3931
- type: a
3932
- }).addFromMnemonic(s), l = c.address;
3933
- return {
3934
- address: l,
3935
- name: l,
3936
- keypair: c
3937
- };
3938
- }
3939
- }
3940
- const Ba = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3941
- __proto__: null,
3942
- ExtensionWeb2: xn,
3943
- default: xn
3944
- }, Symbol.toStringTag, { value: "Module" }));
3945
- export {
3946
- h as A,
3947
- Xe as C,
3948
- Sa as E,
3949
- In as L,
3950
- ra as M,
3951
- Va as P,
3952
- Ma as R,
3953
- Fa as S,
3954
- Ha as T,
3955
- _a as U,
3956
- W as a,
3957
- bt as b,
3958
- zs as c,
3959
- Ws as d,
3960
- Js as e,
3961
- Ra as f,
3962
- Da as g,
3963
- Ua as h,
3964
- ja as i,
3965
- Hi as j,
3966
- Na as k,
3967
- Ia as l,
3968
- Ba as m,
3969
- F as r,
3970
- $a as s,
3971
- Aa as u
3972
- };