@prosopo/procaptcha-bundle 3.1.6 → 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 (174) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/dist/cjs/index.cjs +10 -1
  3. package/dist/cjs/util/configCreator.cjs +0 -1
  4. package/dist/index.js +10 -1
  5. package/dist/util/configCreator.js +0 -1
  6. package/package.json +16 -16
  7. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts +0 -5
  8. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts.map +0 -1
  9. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js +0 -5
  10. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js.map +0 -1
  11. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +0 -16
  12. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +0 -1
  13. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +0 -135
  14. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +0 -1
  15. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
  16. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  17. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js +0 -36
  18. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js.map +0 -1
  19. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts +0 -2
  20. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  21. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js +0 -69
  22. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js.map +0 -1
  23. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
  24. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  25. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +0 -136
  26. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +0 -1
  27. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
  28. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  29. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +0 -15
  30. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +0 -1
  31. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
  32. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  33. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js +0 -11
  34. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js.map +0 -1
  35. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
  36. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  37. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js +0 -2
  38. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js.map +0 -1
  39. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
  40. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  41. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +0 -49
  42. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +0 -1
  43. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts +0 -3
  44. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  45. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js +0 -8
  46. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js.map +0 -1
  47. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  48. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  49. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +0 -14
  50. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +0 -1
  51. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
  52. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  53. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js +0 -9
  54. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js.map +0 -1
  55. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
  56. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  57. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js +0 -9
  58. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js.map +0 -1
  59. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +0 -6
  60. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +0 -1
  61. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +0 -13
  62. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +0 -1
  63. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +0 -5
  64. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +0 -1
  65. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +0 -24
  66. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +0 -1
  67. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts +0 -3
  68. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts.map +0 -1
  69. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js +0 -17
  70. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +0 -1
  71. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts +0 -3
  72. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts.map +0 -1
  73. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js +0 -9
  74. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js.map +0 -1
  75. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +0 -18
  76. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  77. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +0 -66
  78. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +0 -1
  79. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
  80. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  81. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js +0 -19
  82. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js.map +0 -1
  83. package/dist/bundle/ProcaptchaWidget-CJ-4hVS1.js +0 -187
  84. package/dist/bundle/ProcaptchaWidget-Cw3s7cGX.js +0 -1014
  85. package/dist/bundle/Signer-DP9drQ55.js +0 -23
  86. package/dist/bundle/bnChunk-DRlDxTFg.js +0 -1137
  87. package/dist/bundle/browser-ponyfill-CvzSbL_o.js +0 -339
  88. package/dist/bundle/builder-ByZ5z580.js +0 -46
  89. package/dist/bundle/captchaComponentProvider-Cn75EmSH.js +0 -1002
  90. package/dist/bundle/captchaRenderer-s4QuLEen.js +0 -71
  91. package/dist/bundle/commonChunk-BjvuHlB1.js +0 -180
  92. package/dist/bundle/components.d.ts +0 -5
  93. package/dist/bundle/components.d.ts.map +0 -1
  94. package/dist/bundle/emotion-element-c39617d8.browser.esm-BNNnmykm.js +0 -916
  95. package/dist/bundle/fp.esm-DYWeNGcH.js +0 -1654
  96. package/dist/bundle/index-BuQg3Zno.js +0 -1884
  97. package/dist/bundle/index-DIdd2cUz.js +0 -5416
  98. package/dist/bundle/index-IgqrmVIs.js +0 -601
  99. package/dist/bundle/index.d.ts +0 -16
  100. package/dist/bundle/index.d.ts.map +0 -1
  101. package/dist/bundle/locales/ar/translation.json +0 -57
  102. package/dist/bundle/locales/az/translation.json +0 -57
  103. package/dist/bundle/locales/cs/translation.json +0 -57
  104. package/dist/bundle/locales/de/translation.json +0 -57
  105. package/dist/bundle/locales/el/translation.json +0 -57
  106. package/dist/bundle/locales/en/translation.json +0 -57
  107. package/dist/bundle/locales/es/translation.json +0 -57
  108. package/dist/bundle/locales/fi/translation.json +0 -57
  109. package/dist/bundle/locales/fr/translation.json +0 -57
  110. package/dist/bundle/locales/hi/translation.json +0 -57
  111. package/dist/bundle/locales/hu/translation.json +0 -57
  112. package/dist/bundle/locales/id/translation.json +0 -57
  113. package/dist/bundle/locales/it/translation.json +0 -57
  114. package/dist/bundle/locales/ja/translation.json +0 -57
  115. package/dist/bundle/locales/jv/translation.json +0 -57
  116. package/dist/bundle/locales/ko/translation.json +0 -57
  117. package/dist/bundle/locales/ml/translation.json +0 -57
  118. package/dist/bundle/locales/ms/translation.json +0 -57
  119. package/dist/bundle/locales/nl/translation.json +0 -57
  120. package/dist/bundle/locales/no/translation.json +0 -57
  121. package/dist/bundle/locales/pl/translation.json +0 -57
  122. package/dist/bundle/locales/pt/translation.json +0 -57
  123. package/dist/bundle/locales/pt-BR/translation.json +0 -57
  124. package/dist/bundle/locales/ro/translation.json +0 -57
  125. package/dist/bundle/locales/ru/translation.json +0 -57
  126. package/dist/bundle/locales/sr/translation.json +0 -57
  127. package/dist/bundle/locales/sv/translation.json +0 -57
  128. package/dist/bundle/locales/th/translation.json +0 -57
  129. package/dist/bundle/locales/tr/translation.json +0 -57
  130. package/dist/bundle/locales/uk/translation.json +0 -57
  131. package/dist/bundle/locales/vi/translation.json +0 -57
  132. package/dist/bundle/locales/zh-CN/translation.json +0 -57
  133. package/dist/bundle/nobleChunk-Bbltwf44.js +0 -2728
  134. package/dist/bundle/procaptcha.bundle.js +0 -8
  135. package/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
  136. package/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  137. package/dist/bundle/tests/util/config.test.d.ts +0 -2
  138. package/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  139. package/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
  140. package/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  141. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
  142. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  143. package/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
  144. package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  145. package/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
  146. package/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  147. package/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
  148. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  149. package/dist/bundle/util/captcha/captchaType.d.ts +0 -3
  150. package/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  151. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  152. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  153. package/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
  154. package/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  155. package/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
  156. package/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  157. package/dist/bundle/util/config.d.ts +0 -6
  158. package/dist/bundle/util/config.d.ts.map +0 -1
  159. package/dist/bundle/util/configCreator.d.ts +0 -5
  160. package/dist/bundle/util/configCreator.d.ts.map +0 -1
  161. package/dist/bundle/util/language.d.ts +0 -3
  162. package/dist/bundle/util/language.d.ts.map +0 -1
  163. package/dist/bundle/util/timeout.d.ts +0 -3
  164. package/dist/bundle/util/timeout.d.ts.map +0 -1
  165. package/dist/bundle/util/widgetFactory.d.ts +0 -18
  166. package/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  167. package/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
  168. package/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  169. package/dist/bundle/utilChunk-DPr6oTOj.js +0 -317
  170. package/dist/bundle/utilCryptoChunk-D6ZLkbFV.js +0 -1236
  171. package/dist/bundle/web2Chunk-CNoojUDK.js +0 -3967
  172. package/dist/bundle/web3Chunk-BlYvY4Ea.js +0 -525
  173. package/dist/bundle/zodChunk-aEfPZzrp.js +0 -2882
  174. package/stats.html +0 -4842
@@ -1,1014 +0,0 @@
1
- import { j as d, a as P, g as ie, p as z, b as ce, P as le, E as de, c as ue, C as he } from "./captchaComponentProvider-Cn75EmSH.js";
2
- import { r as C, u as Z, a as v, A, g as pe, h as ge, i as fe, s as me, P as Q, j as xe, l as Ce } from "./web2Chunk-CNoojUDK.js";
3
- import { b as _, P as T, a as H } from "./commonChunk-BjvuHlB1.js";
4
- import { b as we, u as be } from "./builder-ByZ5z580.js";
5
- import { u as U, v as ye } from "./utilCryptoChunk-D6ZLkbFV.js";
6
- import { w as Ae } from "./utilChunk-DPr6oTOj.js";
7
- import { l as M, d as D } from "./index-IgqrmVIs.js";
8
- import { r as ve } from "./index-DIdd2cUz.js";
9
- const Ee = {
10
- border: "none",
11
- paddingTop: "6px",
12
- paddingBottom: "6px",
13
- cursor: "pointer",
14
- height: "39px",
15
- width: "39px",
16
- borderRadius: "50%",
17
- display: "flex"
18
- }, Te = ({
19
- themeColor: r,
20
- onReload: e
21
- }) => {
22
- const o = C.useMemo(
23
- () => r === "light" ? M : D,
24
- [r]
25
- ), [n, t] = C.useState(!1), i = C.useMemo(() => ({
26
- ...{
27
- ...Ee,
28
- backgroundColor: o.palette.background.default,
29
- color: n ? o.palette.primary.contrastText : o.palette.background.contrastText,
30
- border: `1px solid ${o.palette.grey[500]}`,
31
- borderRadius: "50%",
32
- transition: "background-color 0.3s",
33
- boxShadow: `0px 1px 3px 0px ${o.palette.grey[500]}`,
34
- justifyContent: "center",
35
- alignItems: "center",
36
- margin: "0 auto"
37
- },
38
- backgroundColor: n ? o.palette.grey[700] : o.palette.background.default
39
- }), [n, o]);
40
- return /* @__PURE__ */ d(
41
- "button",
42
- {
43
- className: "reload-button",
44
- "aria-label": "Reload",
45
- type: "button",
46
- style: i,
47
- onMouseEnter: () => t(!0),
48
- onMouseLeave: () => t(!1),
49
- onClick: (a) => {
50
- a.preventDefault(), e();
51
- },
52
- children: /* @__PURE__ */ P(
53
- "svg",
54
- {
55
- width: "16px",
56
- height: "16px",
57
- viewBox: "0 0 16 16",
58
- version: "1.1",
59
- xmlns: "http://www.w3.org/2000/svg",
60
- xmlnsXlink: "http://www.w3.org/1999/xlink",
61
- style: { display: "flex" },
62
- children: [
63
- /* @__PURE__ */ d("title", { children: "reload" }),
64
- /* @__PURE__ */ d(
65
- "path",
66
- {
67
- shapeRendering: "optimizeQuality",
68
- fill: n ? o.palette.primary.contrastText : o.palette.grey[700],
69
- transform: "scale(0.0416)",
70
- d: "M234.666667,149.333333 L234.666667,106.666667 L314.564847,106.664112 C287.579138,67.9778918 242.745446,42.6666667 192,42.6666667 C109.525477,42.6666667 42.6666667,109.525477 42.6666667,192 C42.6666667,274.474523 109.525477,341.333333 192,341.333333 C268.201293,341.333333 331.072074,284.258623 340.195444,210.526102 L382.537159,215.817985 C370.807686,310.617565 289.973536,384 192,384 C85.961328,384 1.42108547e-14,298.038672 1.42108547e-14,192 C1.42108547e-14,85.961328 85.961328,1.42108547e-14 192,1.42108547e-14 C252.316171,1.42108547e-14 306.136355,27.8126321 341.335366,71.3127128 L341.333333,1.42108547e-14 L384,1.42108547e-14 L384,149.333333 L234.666667,149.333333 Z"
71
- }
72
- )
73
- ]
74
- }
75
- )
76
- }
77
- );
78
- }, Ie = (r) => {
79
- if (!r.hash)
80
- throw new _("CAPTCHA.MISSING_ITEM_HASH", {
81
- context: { item: r }
82
- });
83
- return r.hash;
84
- }, Ne = ({
85
- challenge: r,
86
- solution: e,
87
- onClick: o,
88
- themeColor: n
89
- }) => {
90
- const t = r.items, i = C.useMemo(
91
- () => n === "light" ? M : D,
92
- [n]
93
- ), a = `${i.spacing.unit}px`;
94
- return /* @__PURE__ */ d(
95
- "div",
96
- {
97
- style: {
98
- // expand to full height / width of parent
99
- width: "100%",
100
- height: "100%",
101
- // display children in flex, spreading them evenly and wrapping when row length exceeded
102
- display: "flex",
103
- flexDirection: "row",
104
- flexWrap: "wrap",
105
- justifyContent: "space-between",
106
- paddingBottom: a,
107
- paddingTop: a,
108
- gap: "10px"
109
- },
110
- children: t.map((s, l) => {
111
- const h = Ie(s);
112
- return /* @__PURE__ */ d("div", { style: {
113
- // enable the items in the grid to grow in width to use up excess space
114
- flexGrow: 1,
115
- // make the width of each item 1/3rd of the width overall, i.e. 3 columns
116
- flexBasis: "calc(33.333% - 10px)",
117
- // include the padding / margin / border in the width
118
- boxSizing: "border-box"
119
- }, children: /* @__PURE__ */ P(
120
- "div",
121
- {
122
- style: {
123
- position: "relative",
124
- cursor: "pointer",
125
- height: "100%",
126
- width: "100%",
127
- padding: 0,
128
- margin: 0
129
- },
130
- onClick: (u) => {
131
- if (u.isTrusted) {
132
- if ("touches" in u && u.touches.length > 0 && u.touches[0]) {
133
- o(h, u.touches[0].clientX, u.touches[0].clientY);
134
- return;
135
- }
136
- if ("clientX" in u && "clientY" in u) {
137
- o(h, u.clientX, u.clientY);
138
- return;
139
- }
140
- o(h, 0, 0);
141
- }
142
- },
143
- children: [
144
- /* @__PURE__ */ d(
145
- "img",
146
- {
147
- style: {
148
- width: "100%",
149
- // image should be full width / height of the item
150
- display: "block",
151
- // removes whitespace below imgs
152
- objectFit: "cover",
153
- // contain the entire image in the img tag
154
- aspectRatio: "1/1",
155
- // force AR to be 1, letterboxing images with different aspect ratios
156
- height: "auto",
157
- // make the img tag responsive to its container
158
- overflow: "hidden",
159
- borderStyle: "solid",
160
- borderWidth: "1px",
161
- borderColor: i.palette.grey[300]
162
- },
163
- src: s.data,
164
- alt: `Captcha image ${l + 1}`,
165
- onError: (u) => {
166
- const f = u.currentTarget;
167
- f._retryCount = (f._retryCount || 0) + 1, f._retryCount <= 3 && (f.src = `${s.data}?retry=${Date.now()}`);
168
- }
169
- }
170
- ),
171
- /* @__PURE__ */ d(
172
- "div",
173
- {
174
- style: {
175
- position: "absolute",
176
- top: 0,
177
- left: 0,
178
- bottom: 0,
179
- right: 0,
180
- height: "100%",
181
- width: "100%",
182
- // display overlays in center
183
- display: "flex",
184
- alignItems: "center",
185
- justifyContent: "center",
186
- // make bg half opacity, i.e. shadowing the item's img
187
- backgroundColor: "rgba(0,0,0,0.5)",
188
- visibility: e.some((u) => u[0] === h) ? "visible" : "hidden"
189
- },
190
- children: /* @__PURE__ */ d(
191
- "svg",
192
- {
193
- style: {
194
- backgroundColor: "transparent",
195
- // img must be displayed as block otherwise gets a bottom whitespace border
196
- display: "block",
197
- // how big the overlay icon is
198
- width: "35%",
199
- height: "35%",
200
- transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
201
- userSelect: "none",
202
- fill: "currentcolor"
203
- },
204
- focusable: "false",
205
- color: "#fff",
206
- "aria-hidden": "true",
207
- viewBox: "0 0 24 24",
208
- "data-testid": "CheckIcon",
209
- "aria-label": "Check icon",
210
- children: /* @__PURE__ */ d("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })
211
- }
212
- )
213
- }
214
- )
215
- ]
216
- }
217
- ) }, s.hash);
218
- })
219
- }
220
- );
221
- };
222
- function He(r = {}) {
223
- return Object.keys(r).reduce(
224
- // biome-ignore lint/performance/noAccumulatingSpread: TODO fix
225
- (e, o) => ({ ...e, [`data-${o}`]: r[o] }),
226
- {}
227
- );
228
- }
229
- function J({
230
- general: r,
231
- dev: e
232
- }) {
233
- return {
234
- ...He(r)
235
- };
236
- }
237
- const Pe = {
238
- display: "inline-flex",
239
- alignItems: "center",
240
- justifyContent: "center",
241
- position: "relative",
242
- boxSizing: "border-box",
243
- outline: "0px",
244
- margin: "0px",
245
- cursor: "pointer",
246
- userSelect: "none",
247
- verticalAlign: "middle",
248
- appearance: void 0,
249
- textDecoration: "none",
250
- fontWeight: "500",
251
- fontSize: "0.875rem",
252
- lineHeight: "1.75",
253
- letterSpacing: "0.02857em",
254
- textTransform: "uppercase",
255
- minWidth: "64px",
256
- padding: "6px 16px",
257
- borderRadius: "4px",
258
- transition: "background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
259
- backgroundColor: "#ffffff"
260
- }, F = ({
261
- themeColor: r,
262
- buttonType: e,
263
- text: o,
264
- onClick: n
265
- }) => {
266
- const t = C.useMemo(
267
- () => r === "light" ? M : D,
268
- [r]
269
- ), [i, a] = C.useState(!1), s = C.useMemo(() => {
270
- const l = {
271
- ...Pe,
272
- border: `1px solid ${t.palette.grey[500]}`,
273
- boxShadow: `0px 1px 3px 0px ${t.palette.grey[500]}`,
274
- fontFamily: t.font.fontFamily,
275
- width: "100%",
276
- color: i ? t.palette.primary.contrastText : t.palette.background.contrastText
277
- };
278
- return e === "cancel" ? {
279
- ...l,
280
- backgroundColor: i ? t.palette.grey[600] : "transparent"
281
- } : {
282
- ...l,
283
- backgroundColor: i ? t.palette.primary.main : t.palette.background.default
284
- };
285
- }, [e, i, t]);
286
- return /* @__PURE__ */ d(
287
- "button",
288
- {
289
- ...J({ dev: {} }),
290
- onMouseEnter: () => a(!0),
291
- onMouseLeave: () => a(!1),
292
- style: s,
293
- onClick: (l) => {
294
- l.isTrusted && (l.preventDefault(), n());
295
- },
296
- "aria-label": o,
297
- children: o
298
- }
299
- );
300
- }, K = ({
301
- challenge: r,
302
- index: e,
303
- solutions: o,
304
- onSubmit: n,
305
- onCancel: t,
306
- onClick: i,
307
- onNext: a,
308
- onReload: s,
309
- themeColor: l
310
- }) => {
311
- const { t: h } = Z(), b = r.captchas ? v(r.captchas, e) : null, u = o ? v(o, e) : [], f = C.useMemo(
312
- () => l === "light" ? M : D,
313
- [l]
314
- ), R = `${f.spacing.unit * 2}px`, g = `${f.spacing.unit}px`;
315
- return /* @__PURE__ */ d(C.Suspense, { fallback: /* @__PURE__ */ d("div", { children: "Loading..." }), children: /* @__PURE__ */ d(
316
- "div",
317
- {
318
- style: {
319
- // introduce scroll bars when screen < minWidth of children
320
- overflowX: "auto",
321
- overflowY: "auto",
322
- maxWidth: "500px",
323
- maxHeight: "100%",
324
- display: "flex",
325
- flexDirection: "column",
326
- border: "1px solid #dddddd",
327
- boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
328
- borderRadius: "4px",
329
- backgroundColor: f.palette.background.default,
330
- userSelect: "none",
331
- touchAction: "none",
332
- overscrollBehavior: "none"
333
- },
334
- children: /* @__PURE__ */ P(
335
- "div",
336
- {
337
- style: {
338
- backgroundColor: f.palette.background.default,
339
- display: "flex",
340
- flexDirection: "column",
341
- minWidth: "300px",
342
- marginLeft: g,
343
- marginRight: g,
344
- justifyContent: "center"
345
- },
346
- children: [
347
- /* @__PURE__ */ d(
348
- "div",
349
- {
350
- style: {
351
- display: "flex",
352
- alignItems: "center",
353
- width: "100%"
354
- },
355
- children: /* @__PURE__ */ d(
356
- "div",
357
- {
358
- style: {
359
- backgroundColor: f.palette.primary.main,
360
- width: "100%",
361
- marginTop: g
362
- },
363
- children: /* @__PURE__ */ P(
364
- "div",
365
- {
366
- style: {
367
- padding: `${f.spacing.half}px`,
368
- fontFamily: f.font.fontFamily
369
- },
370
- children: [
371
- /* @__PURE__ */ P(
372
- "p",
373
- {
374
- style: {
375
- color: "#ffffff",
376
- fontWeight: 700,
377
- lineHeight: 1.5
378
- },
379
- children: [
380
- h("WIDGET.SELECT_ALL"),
381
- ":",
382
- " ",
383
- /* @__PURE__ */ d("span", { children: `${v(r.captchas, e).target} ` })
384
- ]
385
- }
386
- ),
387
- /* @__PURE__ */ d(
388
- "p",
389
- {
390
- style: {
391
- color: "#ffffff",
392
- fontWeight: 500,
393
- lineHeight: 0.8,
394
- fontSize: "0.8rem"
395
- },
396
- children: h("WIDGET.IF_NONE_CLICK_NEXT")
397
- }
398
- )
399
- ]
400
- }
401
- )
402
- }
403
- )
404
- }
405
- ),
406
- /* @__PURE__ */ d(
407
- "div",
408
- {
409
- ...J({ dev: {} }),
410
- style: { overflow: "hidden" },
411
- children: b && /* @__PURE__ */ d(
412
- Ne,
413
- {
414
- challenge: b,
415
- solution: u,
416
- onClick: i,
417
- themeColor: l
418
- }
419
- )
420
- }
421
- ),
422
- /* @__PURE__ */ d(
423
- "div",
424
- {
425
- style: {
426
- display: "flex",
427
- alignItems: "center",
428
- justifyContent: "space-between",
429
- lineHeight: 1.75,
430
- padding: `${g} 0 ${R} 0`
431
- },
432
- children: /* @__PURE__ */ P(
433
- "div",
434
- {
435
- style: {
436
- // expand to full height / width of parent
437
- width: "100%",
438
- height: "100%",
439
- // display children in flex, spreading them evenly
440
- display: "flex",
441
- flexDirection: "row",
442
- justifyContent: "space-between",
443
- gap: "10px"
444
- },
445
- children: [
446
- /* @__PURE__ */ d(
447
- "div",
448
- {
449
- style: {
450
- position: "relative",
451
- flexGrow: 1,
452
- // make the width of each item 1/3rd of the width overall, i.e. 3 columns
453
- flexBasis: "calc(33.333% - 10px)"
454
- },
455
- children: /* @__PURE__ */ d(
456
- F,
457
- {
458
- themeColor: l,
459
- buttonType: "cancel",
460
- onClick: t,
461
- text: h("WIDGET.CANCEL"),
462
- "aria-label": h("WIDGET.CANCEL")
463
- }
464
- )
465
- }
466
- ),
467
- /* @__PURE__ */ d(
468
- "div",
469
- {
470
- style: {
471
- position: "relative",
472
- flexGrow: 1,
473
- // make the width of each item 1/3rd of the width overall, i.e. 3 columns
474
- flexBasis: "calc(33.333% - 10px)"
475
- },
476
- children: /* @__PURE__ */ d(Te, { themeColor: l, onReload: s })
477
- }
478
- ),
479
- /* @__PURE__ */ d(
480
- "div",
481
- {
482
- style: {
483
- position: "relative",
484
- flexGrow: 1,
485
- // make the width of each item 1/3rd of the width overall, i.e. 3 columns
486
- flexBasis: "calc(33.333% - 10px)"
487
- },
488
- children: /* @__PURE__ */ d(
489
- F,
490
- {
491
- themeColor: l,
492
- buttonType: "next",
493
- text: e < r.captchas.length - 1 ? h("WIDGET.NEXT") : h("WIDGET.SUBMIT"),
494
- onClick: e < r.captchas.length - 1 ? a : n,
495
- "aria-label": e < r.captchas.length - 1 ? h("WIDGET.NEXT") : h("WIDGET.SUBMIT"),
496
- "data-cy": "button-next"
497
- }
498
- )
499
- }
500
- )
501
- ]
502
- }
503
- )
504
- }
505
- )
506
- ]
507
- }
508
- )
509
- }
510
- ) });
511
- };
512
- function Re(r) {
513
- return U([
514
- r.captchaId,
515
- r.captchaContentId,
516
- [...r.solution].sort(),
517
- r.salt
518
- ]);
519
- }
520
- class V {
521
- constructor(e) {
522
- this.hash = e, this.parent = null;
523
- }
524
- }
525
- class ke {
526
- constructor() {
527
- this.leaves = [], this.layers = [];
528
- }
529
- getRoot() {
530
- if (this.root === void 0)
531
- throw new T("DATASET.MERKLE_ERROR", {
532
- context: {
533
- error: "root undefined",
534
- failedFuncName: this.getRoot.name
535
- }
536
- });
537
- return this.root;
538
- }
539
- build(e) {
540
- this.layers.length && (this.layers = []);
541
- const o = [];
542
- for (const n of e) {
543
- const t = new V(n);
544
- this.leaves.push(t), o.push(t.hash);
545
- }
546
- this.layers.push(o), this.root = this.buildMerkleTree(this.leaves)[0];
547
- }
548
- buildMerkleTree(e) {
549
- const o = e.length;
550
- if (o === 1)
551
- return e;
552
- const n = [];
553
- let t = 0;
554
- const i = [];
555
- for (; t < o; ) {
556
- const a = e[t];
557
- if (a === void 0)
558
- throw new T("DEVELOPER.GENERAL", {
559
- context: { error: "leftChild undefined" }
560
- });
561
- const s = t + 1 < o ? v(e, t + 1) : a, l = this.createParent(a, s);
562
- i.push(l.hash), n.push(l), t += 2;
563
- }
564
- return this.layers.push(i), this.buildMerkleTree(n);
565
- }
566
- createParent(e, o) {
567
- const n = new V(
568
- U([e.hash, o.hash])
569
- );
570
- return e.parent = n.hash, o.parent = n.hash, n;
571
- }
572
- proof(e) {
573
- const o = [];
574
- let n = 0;
575
- for (; n < this.layers.length - 1; ) {
576
- const i = this.layers[n];
577
- if (i === void 0)
578
- throw new T("DATASET.MERKLE_ERROR", {
579
- context: {
580
- error: "layer undefined",
581
- failedFuncName: this.proof.name,
582
- layerNum: n
583
- }
584
- });
585
- const a = i.indexOf(e);
586
- let s = a % 2 && a > 0 ? a - 1 : a + 1;
587
- s > i.length - 1 && (s = a);
588
- const l = [e], h = v(i, s);
589
- s > a ? l.push(h) : l.unshift(h), o.push([v(l, 0), v(l, 1)]), n += 1, e = U(l);
590
- }
591
- const t = v(this.layers, this.layers.length - 1);
592
- return [...o, [v(t, 0)]];
593
- }
594
- }
595
- class X {
596
- constructor(e, o, n, t, i) {
597
- this.userAccount = e, this.provider = o, this.providerApi = n, this._web2 = t, this.dappAccount = i;
598
- }
599
- get web2() {
600
- return this._web2;
601
- }
602
- async getCaptchaChallenge(e) {
603
- try {
604
- const o = await this.providerApi.getCaptchaChallenge(
605
- this.userAccount,
606
- this.provider,
607
- e
608
- );
609
- if (o[A.error])
610
- return o;
611
- for (const n of o.captchas)
612
- for (const t of n.items)
613
- t.data && (t.data = `https://${t.data.replace(/^http(s)*:\/\//, "")}`);
614
- return o;
615
- } catch (o) {
616
- throw new H("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
617
- context: { error: o }
618
- });
619
- }
620
- }
621
- async submitCaptchaSolution(e, o, n, t, i) {
622
- const a = new ke(), s = n.map(
623
- (b) => Re(b)
624
- );
625
- if (a.build(s), !a.root)
626
- throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
627
- context: { error: "Merkle tree root is undefined" }
628
- });
629
- const l = a.root.hash;
630
- let h;
631
- try {
632
- h = await this.providerApi.submitCaptchaSolution(
633
- n,
634
- o,
635
- this.userAccount,
636
- t,
637
- i,
638
- e
639
- );
640
- } catch (b) {
641
- throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
642
- context: { error: b }
643
- });
644
- }
645
- return [h, l];
646
- }
647
- }
648
- const Le = () => ({
649
- // note order matters! see buildUpdateState. These fields are set in order, so disable modal first, then set loading to false, etc.
650
- showModal: !1,
651
- loading: !1,
652
- index: 0,
653
- challenge: void 0,
654
- solutions: void 0,
655
- isHuman: !1,
656
- captchaApi: void 0,
657
- account: void 0
658
- // don't handle timeout here, this should be handled by the state management
659
- });
660
- function _e(r, e, o, n, t) {
661
- const i = ie(n), a = we(e, o), s = () => {
662
- const c = {
663
- userAccountAddress: "",
664
- ...r
665
- };
666
- return e.account && (c.userAccountAddress = e.account.account.address), Q.parse(c);
667
- }, l = async () => {
668
- i.onOpen(), await z(
669
- async () => {
670
- var I;
671
- if (e.loading || e.isHuman)
672
- return;
673
- a({ loading: !0 }), a({
674
- attemptCount: e.attemptCount ? e.attemptCount + 1 : 1
675
- }), a({
676
- sessionId: t == null ? void 0 : t.sessionId
677
- });
678
- const c = s();
679
- a({ dappAccount: c.account.address }), await me(100);
680
- const m = await ee();
681
- let x = e.captchaApi;
682
- if (t != null && t.provider) {
683
- const w = t.provider.provider.url, y = await g(w);
684
- x = new X(
685
- m.account.address,
686
- t.provider,
687
- y,
688
- c.web2,
689
- c.account.address || ""
690
- ), a({ captchaApi: x });
691
- } else {
692
- const w = await ce(
693
- s().defaultEnvironment
694
- ), y = w.provider.url, E = await g(y);
695
- x = new X(
696
- m.account.address,
697
- w,
698
- E,
699
- c.web2,
700
- c.account.address || ""
701
- ), a({ captchaApi: x });
702
- }
703
- const p = await (x == null ? void 0 : x.getCaptchaChallenge(
704
- e.sessionId
705
- ));
706
- if (p.error)
707
- a({
708
- loading: !1,
709
- error: {
710
- message: p.error.message,
711
- key: p.error.key || "API.UNKNOWN_ERROR"
712
- }
713
- }), i.onError(new Error((I = p.error) == null ? void 0 : I.message));
714
- else {
715
- if (p.captchas.length <= 0)
716
- throw new _("DEVELOPER.PROVIDER_NO_CAPTCHA");
717
- const w = p.captchas.map(
718
- (E) => E.timeLimitMs || c.captchas.image.challengeTimeout
719
- ).reduce((E, W) => E + W), y = setTimeout(() => {
720
- i.onChallengeExpired(), a({ isHuman: !1, showModal: !1, loading: !1 });
721
- }, w);
722
- a({
723
- index: 0,
724
- solutions: p.captchas.map(() => []),
725
- challenge: p,
726
- showModal: !0,
727
- timeout: y,
728
- loading: !1
729
- });
730
- }
731
- },
732
- l,
733
- L,
734
- e.attemptCount,
735
- 10
736
- );
737
- }, h = async () => {
738
- await z(
739
- async () => {
740
- if (N(), !e.challenge)
741
- throw new T("CAPTCHA.NO_CAPTCHA", {
742
- context: { error: "Cannot submit, no Captcha found in state" }
743
- });
744
- a({ showModal: !1 });
745
- const c = e.challenge, m = e.challenge.captchas.map(
746
- (O, ne) => {
747
- const B = v(e.solutions, ne), j = B.flatMap(([k, $, se]) => [$, se]), ae = ye(
748
- j.map((k) => k.toString(16).length + 4).reduce((k, $) => k + $, 0)
749
- ), re = pe(ae, j);
750
- return {
751
- captchaId: O.captchaId,
752
- captchaContentId: O.captchaContentId,
753
- salt: re,
754
- solution: B.flatMap((k) => k[0])
755
- };
756
- }
757
- ), x = G(), p = oe(x).signer;
758
- if (!v(c.captchas, 0).datasetId)
759
- throw new _("CAPTCHA.INVALID_CAPTCHA_ID", {
760
- context: { error: "No datasetId set for challenge" }
761
- });
762
- const w = e.captchaApi;
763
- if (!w)
764
- throw new T("CAPTCHA.INVALID_TOKEN", {
765
- context: { error: "No Captcha API found in state" }
766
- });
767
- if (!p || !p.signRaw)
768
- throw new H("GENERAL.CANT_FIND_KEYRINGPAIR", {
769
- context: {
770
- error: "Signer is not defined, cannot sign message to prove account ownership"
771
- }
772
- });
773
- const y = await p.signRaw({
774
- address: x.account.address,
775
- data: Ae(c[A.timestamp]),
776
- type: "bytes"
777
- }), E = await w.submitCaptchaSolution(
778
- y.signature,
779
- c.requestHash,
780
- m,
781
- c.timestamp,
782
- c.signature.provider.requestHash
783
- ), W = E[0].verified;
784
- if (a({
785
- submission: E,
786
- isHuman: W,
787
- loading: !1
788
- }), e.isHuman) {
789
- const O = w.provider.provider.url;
790
- i.onHuman(
791
- ge({
792
- [A.providerUrl]: O,
793
- [A.user]: x.account.address,
794
- [A.dapp]: te(),
795
- [A.commitmentId]: fe(E[1]),
796
- [A.timestamp]: c.timestamp,
797
- [A.signature]: {
798
- [A.provider]: {
799
- [A.requestHash]: c.signature.provider.requestHash
800
- },
801
- [A.user]: {
802
- [A.timestamp]: y.signature
803
- }
804
- }
805
- })
806
- ), S();
807
- } else
808
- i.onFailed(), L(t == null ? void 0 : t.restart);
809
- },
810
- l,
811
- L,
812
- e.attemptCount,
813
- 10
814
- );
815
- }, b = async () => {
816
- N(), L(t == null ? void 0 : t.restart), i.onClose();
817
- }, u = async () => {
818
- N(), i.onReload(), L(t == null ? void 0 : t.restart), t != null && t.restart || await l();
819
- }, f = (c, m, x) => {
820
- if (!e.challenge)
821
- throw new T("CAPTCHA.NO_CAPTCHA", {
822
- context: { error: "Cannot select, no Captcha found in state" }
823
- });
824
- if (e.index >= e.challenge.captchas.length || e.index < 0)
825
- throw new T("CAPTCHA.NO_CAPTCHA", {
826
- context: {
827
- error: "Cannot select, index is out of range for this Captcha"
828
- }
829
- });
830
- const p = e.index, I = e.solutions, w = v(I, p);
831
- if (w.some((y) => y[0] === c)) {
832
- const y = w.filter((E) => E[0] !== c);
833
- I[p] = y;
834
- } else
835
- I[p] = [...w, [c, m || 0, x || 0]];
836
- a({ solutions: I });
837
- }, R = () => {
838
- if (!e.challenge)
839
- throw new T("CAPTCHA.NO_CAPTCHA", {
840
- context: { error: "Cannot select, no Captcha found in state" }
841
- });
842
- if (e.index + 1 >= e.challenge.captchas.length)
843
- throw new T("CAPTCHA.NO_CAPTCHA", {
844
- context: {
845
- error: "Cannot select, index is out of range for this Captcha"
846
- }
847
- });
848
- a({ index: e.index + 1 });
849
- }, g = async (c) => {
850
- const m = s();
851
- if (!m.account.address)
852
- throw new H("GENERAL.SITE_KEY_MISSING");
853
- return new le(c, m.account.address);
854
- }, N = () => {
855
- window.clearTimeout(Number(e.timeout)), a({ timeout: void 0 });
856
- }, S = () => {
857
- const c = r.captchas.image.solutionTimeout, m = setTimeout(() => {
858
- a({ isHuman: !1 }), i.onExpired();
859
- }, c);
860
- a({ successfullChallengeTimeout: m });
861
- }, L = (c) => {
862
- N(), a(Le()), i.onReset(), c && c();
863
- }, ee = async () => {
864
- const c = s();
865
- if (!c.web2 && !c.userAccountAddress)
866
- throw new H("GENERAL.ACCOUNT_NOT_FOUND", {
867
- context: { error: "Account address has not been set for web3 mode" }
868
- });
869
- const x = await (async () => {
870
- const p = new (await de(c.web2))();
871
- return t ? t.userAccount : await p.getAccount(c);
872
- })();
873
- return a({ account: x }), G();
874
- }, G = () => {
875
- if (!e.account)
876
- throw new H("GENERAL.ACCOUNT_NOT_FOUND", {
877
- context: { error: "Account not loaded" }
878
- });
879
- return e.account;
880
- }, te = () => {
881
- if (!e.dappAccount)
882
- throw new H("GENERAL.SITE_KEY_MISSING");
883
- return e.dappAccount;
884
- }, oe = (c) => {
885
- const m = c || G();
886
- if (!m.extension)
887
- throw new H("ACCOUNT.NO_POLKADOT_EXTENSION", {
888
- context: { error: "Extension not loaded" }
889
- });
890
- return m.extension;
891
- };
892
- return {
893
- start: l,
894
- cancel: b,
895
- submit: h,
896
- select: f,
897
- nextRound: R,
898
- reload: u
899
- };
900
- }
901
- const Me = ue`
902
- position: absolute;
903
- top: 50%;
904
- left: 50%;
905
- transform: translate(-50%, -50%);
906
- max-width: 500px;
907
- background-color: transparent;
908
- border: none;
909
- border-radius: 4px;
910
- z-index: 2147483647;
911
- align-self: center;
912
- box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px,
913
- rgba(0, 0, 0, 0.14) 0px 24px 38px 3px,
914
- rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
915
- box-sizing: border-box; /* Ensures border is part of width */
916
- /* iOS only */
917
- @supports (-webkit-touch-callout: none) {
918
- transform: translate(-50%, -100%);
919
- }
920
- `, Y = xe.memo((r) => {
921
- const { show: e, children: o } = r, t = {
922
- position: "fixed",
923
- zIndex: 2147483646,
924
- inset: 0,
925
- display: e ? "flex" : "none",
926
- alignItems: "center",
927
- justifyContent: "center",
928
- minHeight: "100vh"
929
- };
930
- return ve.createPortal(
931
- /* @__PURE__ */ d("div", { className: "prosopo-modalOuter", style: t, children: /* @__PURE__ */ d("div", { className: "prosopo-modalInner", css: Me, children: o }) }),
932
- document.body
933
- );
934
- }), q = "procaptcha:execute", je = (r) => {
935
- var R;
936
- const { t: e, ready: o } = Z(), n = Q.parse(r.config), t = r.frictionlessState, i = r.i18n, a = r.callbacks || {}, [s, l] = be(C.useState, C.useRef), [h, b] = C.useState(!1), u = _e(
937
- n,
938
- s,
939
- l,
940
- a,
941
- t
942
- ), f = r.config.theme === "light" ? M : D;
943
- return C.useEffect(() => {
944
- n.language && (i ? i.language !== n.language && i.changeLanguage(n.language).then((g) => g) : Ce().then((g) => {
945
- g.language !== n.language && g.changeLanguage(n.language).then((N) => N);
946
- }));
947
- }, [i, n.language]), C.useEffect(() => {
948
- s.error && (b(!1), s.error.key === "CAPTCHA.NO_SESSION_FOUND" && t && setTimeout(() => {
949
- t.restart();
950
- }, 3e3));
951
- }, [s.error, t]), C.useEffect(() => {
952
- const g = (N) => {
953
- if (l({
954
- showModal: !0
955
- }), !s.challenge && u.start)
956
- try {
957
- u.start();
958
- } catch (S) {
959
- console.error("Error starting verification:", S);
960
- }
961
- };
962
- return document.addEventListener(q, g), () => {
963
- document.removeEventListener(
964
- q,
965
- g
966
- );
967
- };
968
- }, [u, s.challenge, l]), n.mode === "invisible" ? /* @__PURE__ */ d(Y, { show: s.showModal, children: s.challenge ? /* @__PURE__ */ d(
969
- K,
970
- {
971
- challenge: s.challenge,
972
- index: s.index,
973
- solutions: s.solutions,
974
- onSubmit: u.submit,
975
- onCancel: u.cancel,
976
- onClick: u.select,
977
- onNext: u.nextRound,
978
- onReload: u.reload,
979
- themeColor: n.theme ?? "light"
980
- }
981
- ) : null }) : /* @__PURE__ */ P("div", { className: "image-captcha", children: [
982
- /* @__PURE__ */ d(Y, { show: s.showModal, children: s.challenge ? /* @__PURE__ */ d(
983
- K,
984
- {
985
- challenge: s.challenge,
986
- index: s.index,
987
- solutions: s.solutions,
988
- onSubmit: u.submit,
989
- onCancel: u.cancel,
990
- onClick: u.select,
991
- onNext: u.nextRound,
992
- onReload: u.reload,
993
- themeColor: n.theme ?? "light"
994
- }
995
- ) : /* @__PURE__ */ d("div", { children: "No challenge set." }) }),
996
- /* @__PURE__ */ d(
997
- he,
998
- {
999
- theme: f,
1000
- onChange: async (g) => {
1001
- g.isTrusted && (h || (b(!0), await u.start(), b(!1)));
1002
- },
1003
- checked: s.isHuman,
1004
- labelText: o ? e("WIDGET.I_AM_HUMAN") : "",
1005
- error: (R = s.error) == null ? void 0 : R.message,
1006
- "aria-label": "human checkbox",
1007
- loading: h
1008
- }
1009
- )
1010
- ] });
1011
- };
1012
- export {
1013
- je as default
1014
- };