@prosopo/procaptcha-bundle 2.2.3 → 2.3.2

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 (36) hide show
  1. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +1 -1
  2. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js +2 -1
  3. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
  4. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +1 -1
  5. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +1 -1
  6. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +2 -1
  7. package/.rollup.cache/home/runner/work/captcha-private/captcha-private/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +1 -1
  8. package/dist/bundle/{Checkbox-DM6n1-r-.js → Checkbox-gp52EwUq.js} +140 -187
  9. package/dist/bundle/{ProcaptchaWidget-DZb9vegH.js → ProcaptchaWidget-BvScmKhX.js} +211 -208
  10. package/dist/bundle/{ProcaptchaWidget-CrcxpJLK.js → ProcaptchaWidget-D2i13eeY.js} +50 -47
  11. package/dist/bundle/Signer-DP9drQ55.js +23 -0
  12. package/dist/bundle/asU8a-BcA17eDA.js +9 -0
  13. package/dist/bundle/bip39-_F7Z5vIE.js +259 -0
  14. package/dist/bundle/fp.esm-C0kLYOiJ.js +1637 -0
  15. package/dist/bundle/hash-C7-gVTqE.js +1083 -0
  16. package/dist/bundle/index-BH5dKH-o.js +79 -0
  17. package/dist/bundle/index-BYd5PSRY.js +17233 -0
  18. package/dist/bundle/index-BdsUZjbH.js +6520 -0
  19. package/dist/bundle/index-DlBTo0Xd.js +1190 -0
  20. package/dist/bundle/index-QVME9Prx.js +32 -0
  21. package/dist/bundle/index.d.ts.map +1 -1
  22. package/dist/bundle/procaptcha.bundle.js +2 -2
  23. package/dist/bundle/sha256-Bcj1GDss.js +171 -0
  24. package/dist/bundle/spread-DEmVz7RJ.js +15 -0
  25. package/dist/bundle/util/config.d.ts +1 -1
  26. package/dist/bundle/util/config.d.ts.map +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/util/config.d.ts +1 -1
  31. package/dist/util/config.d.ts.map +1 -1
  32. package/dist/util/config.js +2 -1
  33. package/dist/util/config.js.map +1 -1
  34. package/package.json +9 -9
  35. package/stats.html +1 -1
  36. package/dist/bundle/index-B27PXNfK.js +0 -28199
@@ -1,6 +1,8 @@
1
- import { u as ce, h as le, z as O, r as f, l as _, d as L, j as s, a as b, P as k, b as g, c as $, e as y, A as p, f as S, p as F, g as de, i as ue, k as he, m as pe, n as ge, o as X, E as fe, R as me, q as xe, W as Ce, C as be, s as Ae, t as ye, v as we, w as Te, x as Ee, y as Se, L as Ie, B as ve, D as Ne, F as De } from "./index-B27PXNfK.js";
2
- import { u as q, s as Y, g as He, b as Re, a as ke, E as _e, c as Le, C as Pe } from "./Checkbox-DM6n1-r-.js";
3
- const Me = (t) => Array.isArray(t) && t !== null, G = new Array(256), J = new Array(256 * 256);
1
+ import { N as W, r as m, s as L, t as P, j as i, d as C, O as _, Q as f, R as A, A as g, P as I, p as F, g as ce, e as le, a as de, b as X, S as ue, i as he, W as pe, C as ge, c as fe, f as me, h as xe, k as Ce, l as be, m as ye, L as Ae, n as we, o as Te, q as Ee } from "./index-BYd5PSRY.js";
2
+ import { u as q, a as Y, g as Se, b as Ie, s as ve, c as Ne, C as He } from "./Checkbox-gp52EwUq.js";
3
+ import { v as ke, x as De, y as $ } from "./hash-C7-gVTqE.js";
4
+ import { a as Re } from "./asU8a-BcA17eDA.js";
5
+ const _e = (t) => Array.isArray(t) && t !== null, G = new Array(256), J = new Array(256 * 256);
4
6
  for (let t = 0; t < 256; t++)
5
7
  G[t] = t.toString(16).padStart(2, "0");
6
8
  for (let t = 0; t < 256; t++) {
@@ -8,32 +10,32 @@ for (let t = 0; t < 256; t++) {
8
10
  for (let n = 0; n < 256; n++)
9
11
  J[e | n] = G[t] + G[n];
10
12
  }
11
- function U(t, e) {
13
+ function B(t, e) {
12
14
  const n = t.length % 2 | 0, r = t.length - n | 0;
13
15
  for (let a = 0; a < r; a += 2)
14
16
  e += J[t[a] << 8 | t[a + 1]];
15
17
  return n && (e += G[t[r] | 0]), e;
16
18
  }
17
- function Oe(t, e = -1, n = !0) {
19
+ function Le(t, e = -1, n = !0) {
18
20
  const r = n ? "0x" : "";
19
21
  if (!(t != null && t.length))
20
22
  return r;
21
23
  if (e > 0) {
22
24
  const a = Math.ceil(e / 8);
23
25
  if (t.length > a)
24
- return `${U(t.subarray(0, a / 2), r)}…${U(t.subarray(t.length - a / 2), "")}`;
26
+ return `${B(t.subarray(0, a / 2), r)}…${B(t.subarray(t.length - a / 2), "")}`;
25
27
  }
26
- return U(t, r);
28
+ return B(t, r);
27
29
  }
28
- const Ge = (t) => Me(t) ? Oe(new Uint8Array(t)) : t.toString();
29
- function We(t) {
30
- return ce(le(t));
30
+ const Pe = (t) => _e(t) ? Le(new Uint8Array(t)) : t.toString();
31
+ function Me(t) {
32
+ return ke(De(t));
31
33
  }
32
- const Z = O.object({
33
- account: O.string().optional(),
34
- blockNumber: O.number().optional(),
35
- providerUrl: O.string().optional()
36
- }), Be = {
34
+ const Z = W.object({
35
+ account: W.string().optional(),
36
+ blockNumber: W.number().optional(),
37
+ providerUrl: W.string().optional()
38
+ }), Oe = {
37
39
  border: "none",
38
40
  paddingTop: "6px",
39
41
  paddingBottom: "6px",
@@ -41,27 +43,27 @@ const Z = O.object({
41
43
  height: "39px",
42
44
  width: "39px",
43
45
  borderRadius: "50%"
44
- }, Ue = ({ themeColor: t, onReload: e }) => {
45
- const n = f.useMemo(() => t === "light" ? _ : L, [t]), [r, a] = f.useState(!1), i = f.useMemo(() => ({
46
+ }, We = ({ themeColor: t, onReload: e }) => {
47
+ const n = m.useMemo(() => t === "light" ? L : P, [t]), [r, a] = m.useState(!1), s = m.useMemo(() => ({
46
48
  ...{
47
- ...Be,
49
+ ...Oe,
48
50
  backgroundColor: n.palette.background.default,
49
51
  color: r ? n.palette.primary.contrastText : n.palette.background.contrastText
50
52
  },
51
53
  backgroundColor: r ? n.palette.grey[700] : n.palette.background.default
52
54
  }), [r, n]);
53
- return s("button", { className: "reload-button", "aria-label": "Reload", type: "button", style: i, onMouseEnter: () => a(!0), onMouseLeave: () => a(!1), onClick: (o) => {
55
+ return i("button", { className: "reload-button", "aria-label": "Reload", type: "button", style: s, onMouseEnter: () => a(!0), onMouseLeave: () => a(!1), onClick: (o) => {
54
56
  o.preventDefault(), e();
55
- }, children: b("svg", { width: "27px", height: "27px", viewBox: "0 0 27 27", version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", children: [s("title", { children: "reload" }), s("path", { fill: i.color, transform: "scale(0.0703125)", 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" })] }) });
56
- }, je = (t) => {
57
+ }, children: C("svg", { width: "27px", height: "27px", viewBox: "0 0 27 27", version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", children: [i("title", { children: "reload" }), i("path", { fill: s.color, transform: "scale(0.0703125)", 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" })] }) });
58
+ }, Ge = (t) => {
57
59
  if (!t.hash)
58
- throw new k("CAPTCHA.MISSING_ITEM_HASH", {
60
+ throw new _("CAPTCHA.MISSING_ITEM_HASH", {
59
61
  context: { item: t }
60
62
  });
61
63
  return t.hash;
62
- }, $e = ({ challenge: t, solution: e, onClick: n, themeColor: r }) => {
63
- const a = t.items, i = f.useMemo(() => r === "light" ? _ : L, [r]), o = `${i.spacing.half}px`;
64
- return s("div", { style: {
64
+ }, Ue = ({ challenge: t, solution: e, onClick: n, themeColor: r }) => {
65
+ const a = t.items, s = m.useMemo(() => r === "light" ? L : P, [r]), o = `${s.spacing.half}px`;
66
+ return i("div", { style: {
65
67
  width: "100%",
66
68
  height: "100%",
67
69
  display: "flex",
@@ -71,14 +73,14 @@ const Z = O.object({
71
73
  paddingBottom: o,
72
74
  paddingRight: o
73
75
  }, children: a.map((d, c) => {
74
- const u = je(d);
75
- return s("div", { style: {
76
+ const u = Ge(d);
77
+ return i("div", { style: {
76
78
  flexGrow: 1,
77
79
  flexBasis: "33.3333%",
78
80
  boxSizing: "border-box",
79
81
  paddingLeft: o,
80
82
  paddingTop: o
81
- }, children: b("div", { style: {
83
+ }, children: C("div", { style: {
82
84
  position: "relative",
83
85
  cursor: "pointer",
84
86
  height: "100%",
@@ -87,15 +89,15 @@ const Z = O.object({
87
89
  padding: 0,
88
90
  margin: 0,
89
91
  borderStyle: "solid",
90
- borderColor: i.palette.grey[300]
91
- }, onClick: () => n(u), children: [s("img", { style: {
92
+ borderColor: s.palette.grey[300]
93
+ }, onClick: () => n(u), children: [i("img", { style: {
92
94
  width: "100%",
93
- backgroundColor: i.palette.grey[300],
95
+ backgroundColor: s.palette.grey[300],
94
96
  display: "block",
95
97
  objectFit: "contain",
96
98
  aspectRatio: "1/1",
97
99
  height: "auto"
98
- }, src: d.data, alt: `Captcha image ${c + 1}` }), s("div", { style: {
100
+ }, src: d.data, alt: `Captcha image ${c + 1}` }), i("div", { style: {
99
101
  position: "absolute",
100
102
  top: 0,
101
103
  left: 0,
@@ -108,7 +110,7 @@ const Z = O.object({
108
110
  justifyContent: "center",
109
111
  backgroundColor: "rgba(0,0,0,0.5)",
110
112
  visibility: e.includes(u) ? "visible" : "hidden"
111
- }, children: s("svg", { style: {
113
+ }, children: i("svg", { style: {
112
114
  backgroundColor: "transparent",
113
115
  display: "block",
114
116
  width: "35%",
@@ -116,18 +118,18 @@ const Z = O.object({
116
118
  transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
117
119
  userSelect: "none",
118
120
  fill: "currentcolor"
119
- }, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", "aria-label": "Check icon", children: s("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) })] }) }, d.hash);
121
+ }, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", "aria-label": "Check icon", children: i("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) })] }) }, d.hash);
120
122
  }) });
121
123
  };
122
- function ze(t = {}) {
124
+ function Be(t = {}) {
123
125
  return Object.keys(t).reduce((e, n) => ({ ...e, [`data-${n}`]: t[n] }), {});
124
126
  }
125
127
  function Q({ general: t, dev: e }) {
126
128
  return {
127
- ...ze(t)
129
+ ...Be(t)
128
130
  };
129
131
  }
130
- const Fe = {
132
+ const je = {
131
133
  display: "inline-flex",
132
134
  alignItems: "center",
133
135
  justifyContent: "center",
@@ -154,25 +156,25 @@ const Fe = {
154
156
  backgroundColor: "#ffffff",
155
157
  boxShadow: "rgba(0, 0, 0, 0.2) 0px 3px 1px -2px, rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px"
156
158
  }, K = ({ themeColor: t, buttonType: e, text: n, onClick: r }) => {
157
- const a = f.useMemo(() => t === "light" ? _ : L, [t]), [i, o] = f.useState(!1), d = f.useMemo(() => {
159
+ const a = m.useMemo(() => t === "light" ? L : P, [t]), [s, o] = m.useState(!1), d = m.useMemo(() => {
158
160
  const c = {
159
- ...Fe,
160
- color: i ? a.palette.primary.contrastText : a.palette.background.contrastText
161
+ ...je,
162
+ color: s ? a.palette.primary.contrastText : a.palette.background.contrastText
161
163
  };
162
164
  return e === "cancel" ? {
163
165
  ...c,
164
- backgroundColor: i ? a.palette.grey[600] : "transparent"
166
+ backgroundColor: s ? a.palette.grey[600] : "transparent"
165
167
  } : {
166
168
  ...c,
167
- backgroundColor: i ? a.palette.primary.main : a.palette.background.default
169
+ backgroundColor: s ? a.palette.primary.main : a.palette.background.default
168
170
  };
169
- }, [e, i, a]);
170
- return s("button", { ...Q({ dev: { cy: `button-${e}` } }), onMouseEnter: () => o(!0), onMouseLeave: () => o(!1), style: d, onClick: (c) => {
171
+ }, [e, s, a]);
172
+ return i("button", { ...Q({ dev: { cy: `button-${e}` } }), onMouseEnter: () => o(!0), onMouseLeave: () => o(!1), style: d, onClick: (c) => {
171
173
  c.preventDefault(), r();
172
174
  }, "aria-label": n, children: n });
173
- }, Ke = ({ challenge: t, index: e, solutions: n, onSubmit: r, onCancel: a, onClick: i, onNext: o, onReload: d, themeColor: c }) => {
174
- const { t: u } = q(), w = t.captchas ? g(t.captchas, e) : null, T = n ? g(n, e) : [], A = f.useMemo(() => c === "light" ? _ : L, [c]), I = `${A.spacing.unit}px`, v = `${A.spacing.half}px`;
175
- return s(f.Suspense, { fallback: s("div", { children: "Loading..." }), children: s("div", { style: {
175
+ }, $e = ({ challenge: t, index: e, solutions: n, onSubmit: r, onCancel: a, onClick: s, onNext: o, onReload: d, themeColor: c }) => {
176
+ const { t: u } = q(), w = t.captchas ? f(t.captchas, e) : null, E = n ? f(n, e) : [], b = m.useMemo(() => c === "light" ? L : P, [c]), v = `${b.spacing.unit}px`, N = `${b.spacing.half}px`;
177
+ return i(m.Suspense, { fallback: i("div", { children: "Loading..." }), children: i("div", { style: {
176
178
  overflowX: "auto",
177
179
  overflowY: "auto",
178
180
  width: "100%",
@@ -183,56 +185,56 @@ const Fe = {
183
185
  border: "1px solid #dddddd",
184
186
  boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
185
187
  borderRadius: "4px",
186
- backgroundColor: A.palette.background.default,
188
+ backgroundColor: b.palette.background.default,
187
189
  userSelect: "none",
188
190
  touchAction: "none",
189
191
  overscrollBehavior: "none"
190
- }, children: b("div", { style: {
191
- backgroundColor: A.palette.background.default,
192
+ }, children: C("div", { style: {
193
+ backgroundColor: b.palette.background.default,
192
194
  display: "flex",
193
195
  flexDirection: "column",
194
196
  minWidth: "300px"
195
- }, children: [s("div", { style: {
197
+ }, children: [i("div", { style: {
196
198
  display: "flex",
197
199
  alignItems: "center",
198
200
  width: "100%"
199
- }, children: s("div", { style: {
200
- backgroundColor: A.palette.primary.main,
201
+ }, children: i("div", { style: {
202
+ backgroundColor: b.palette.primary.main,
201
203
  width: "100%",
202
- marginTop: I,
203
- marginLeft: I,
204
- marginRight: I
205
- }, children: b("div", { style: {
206
- paddingLeft: `${A.spacing.half}px`,
207
- paddingRight: `${A.spacing.half}px`
208
- }, children: [b("p", { style: {
204
+ marginTop: v,
205
+ marginLeft: v,
206
+ marginRight: v
207
+ }, children: C("div", { style: {
208
+ paddingLeft: `${b.spacing.half}px`,
209
+ paddingRight: `${b.spacing.half}px`
210
+ }, children: [C("p", { style: {
209
211
  color: "#ffffff",
210
212
  fontWeight: 700,
211
213
  lineHeight: 1.5
212
- }, children: [u("WIDGET.SELECT_ALL"), ":", " ", s("span", { children: `${u(g(t.captchas, e).target)} ` })] }), s("p", { style: {
214
+ }, children: [u("WIDGET.SELECT_ALL"), ":", " ", i("span", { children: `${u(f(t.captchas, e).target)} ` })] }), i("p", { style: {
213
215
  color: "#ffffff",
214
216
  fontWeight: 500,
215
217
  lineHeight: 0.8,
216
218
  fontSize: "0.8rem"
217
- }, children: u("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }), s("div", { ...Q({ dev: { cy: `captcha-${e}` } }), style: {
218
- paddingRight: v,
219
- paddingLeft: v
220
- }, children: w && s($e, { challenge: w, solution: T, onClick: i, themeColor: c }) }), s("div", { style: {
219
+ }, children: u("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }), i("div", { ...Q({ dev: { cy: `captcha-${e}` } }), style: {
220
+ paddingRight: N,
221
+ paddingLeft: N
222
+ }, children: w && i(Ue, { challenge: w, solution: E, onClick: s, themeColor: c }) }), i("div", { style: {
221
223
  display: "flex",
222
224
  alignItems: "center",
223
225
  justifyContent: "space-between",
224
226
  lineHeight: 1.75,
225
- padding: I,
226
- paddingBottom: v,
227
- paddingTop: v
228
- }, children: b("div", { style: {
227
+ padding: v,
228
+ paddingBottom: N,
229
+ paddingTop: N
230
+ }, children: C("div", { style: {
229
231
  display: "grid",
230
232
  gridAutoFlow: "column",
231
233
  gridTemplateColumns: "repeat(3, minmax(0, 1fr)",
232
234
  width: "100%"
233
- }, children: [s("div", { style: { justifySelf: "left" }, children: s(K, { themeColor: c, buttonType: "cancel", onClick: a, text: u("WIDGET.CANCEL"), "aria-label": u("WIDGET.CANCEL") }) }), s("div", { style: { justifySelf: "center" }, children: s(Ue, { themeColor: c, onReload: d }) }), s("div", { style: { justifySelf: "right" }, children: s(K, { themeColor: c, buttonType: "next", text: e < t.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? o : r, "aria-label": e < t.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"), "data-cy": "button-next" }) })] }) })] }) }) });
235
+ }, children: [i("div", { style: { justifySelf: "left" }, children: i(K, { themeColor: c, buttonType: "cancel", onClick: a, text: u("WIDGET.CANCEL"), "aria-label": u("WIDGET.CANCEL") }) }), i("div", { style: { justifySelf: "center" }, children: i(We, { themeColor: c, onReload: d }) }), i("div", { style: { justifySelf: "right" }, children: i(K, { themeColor: c, buttonType: "next", text: e < t.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? o : r, "aria-label": e < t.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"), "data-cy": "button-next" }) })] }) })] }) }) });
234
236
  };
235
- function Ve(t) {
237
+ function ze(t) {
236
238
  return $([
237
239
  t.captchaId,
238
240
  t.captchaContentId,
@@ -245,13 +247,13 @@ class V {
245
247
  this.hash = e, this.parent = null;
246
248
  }
247
249
  }
248
- class Xe {
250
+ class Fe {
249
251
  constructor() {
250
252
  this.leaves = [], this.layers = [];
251
253
  }
252
254
  getRoot() {
253
255
  if (this.root === void 0)
254
- throw new y("DATASET.MERKLE_ERROR", {
256
+ throw new A("DATASET.MERKLE_ERROR", {
255
257
  context: {
256
258
  error: "root undefined",
257
259
  failedFuncName: this.getRoot.name
@@ -274,17 +276,17 @@ class Xe {
274
276
  return e;
275
277
  const r = [];
276
278
  let a = 0;
277
- const i = [];
279
+ const s = [];
278
280
  for (; a < n; ) {
279
281
  const o = e[a];
280
282
  if (o === void 0)
281
- throw new y("DEVELOPER.GENERAL", {
283
+ throw new A("DEVELOPER.GENERAL", {
282
284
  context: { error: "leftChild undefined" }
283
285
  });
284
- const d = a + 1 < n ? g(e, a + 1) : o, c = this.createParent(o, d);
285
- i.push(c.hash), r.push(c), a += 2;
286
+ const d = a + 1 < n ? f(e, a + 1) : o, c = this.createParent(o, d);
287
+ s.push(c.hash), r.push(c), a += 2;
286
288
  }
287
- return this.layers.push(i), this.buildMerkleTree(r);
289
+ return this.layers.push(s), this.buildMerkleTree(r);
288
290
  }
289
291
  createParent(e, n) {
290
292
  const r = new V($([e.hash, n.hash]));
@@ -294,28 +296,28 @@ class Xe {
294
296
  const n = [];
295
297
  let r = 0;
296
298
  for (; r < this.layers.length - 1; ) {
297
- const i = this.layers[r];
298
- if (i === void 0)
299
- throw new y("DATASET.MERKLE_ERROR", {
299
+ const s = this.layers[r];
300
+ if (s === void 0)
301
+ throw new A("DATASET.MERKLE_ERROR", {
300
302
  context: {
301
303
  error: "layer undefined",
302
304
  failedFuncName: this.proof.name,
303
305
  layerNum: r
304
306
  }
305
307
  });
306
- const o = i.indexOf(e);
308
+ const o = s.indexOf(e);
307
309
  let d = o % 2 && o > 0 ? o - 1 : o + 1;
308
- d > i.length - 1 && (d = o);
309
- const c = [e], u = g(i, d);
310
- d > o ? c.push(u) : c.unshift(u), n.push([g(c, 0), g(c, 1)]), r += 1, e = $(c);
310
+ d > s.length - 1 && (d = o);
311
+ const c = [e], u = f(s, d);
312
+ d > o ? c.push(u) : c.unshift(u), n.push([f(c, 0), f(c, 1)]), r += 1, e = $(c);
311
313
  }
312
- const a = g(this.layers, this.layers.length - 1);
313
- return [...n, [g(a, 0)]];
314
+ const a = f(this.layers, this.layers.length - 1);
315
+ return [...n, [f(a, 0)]];
314
316
  }
315
317
  }
316
- class qe {
317
- constructor(e, n, r, a, i) {
318
- this.userAccount = e, this.provider = n, this.providerApi = r, this._web2 = a, this.dappAccount = i;
318
+ class Ke {
319
+ constructor(e, n, r, a, s) {
320
+ this.userAccount = e, this.provider = n, this.providerApi = r, this._web2 = a, this.dappAccount = s;
319
321
  }
320
322
  get web2() {
321
323
  return this._web2;
@@ -323,7 +325,7 @@ class qe {
323
325
  async getCaptchaChallenge() {
324
326
  try {
325
327
  const e = await this.providerApi.getCaptchaChallenge(this.userAccount, this.provider);
326
- if (e[p.error])
328
+ if (e[g.error])
327
329
  return e;
328
330
  if (window.location.protocol === "https:" || window.location.protocol === "http:")
329
331
  for (const n of e.captchas)
@@ -331,24 +333,24 @@ class qe {
331
333
  r.data && (r.data = r.data.replace(/^http(s)*:\/\//, "//"));
332
334
  return e;
333
335
  } catch (e) {
334
- throw new S("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
336
+ throw new I("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
335
337
  context: { error: e }
336
338
  });
337
339
  }
338
340
  }
339
- async submitCaptchaSolution(e, n, r, a, i) {
340
- const o = new Xe(), d = r.map((T) => Ve(T));
341
+ async submitCaptchaSolution(e, n, r, a, s) {
342
+ const o = new Fe(), d = r.map((E) => ze(E));
341
343
  if (o.build(d), !o.root)
342
- throw new k("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
344
+ throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
343
345
  context: { error: "Merkle tree root is undefined" }
344
346
  });
345
347
  const c = o.root.hash, u = void 0;
346
348
  let w;
347
349
  try {
348
- w = await this.providerApi.submitCaptchaSolution(r, n, this.userAccount, a, i, e);
349
- } catch (T) {
350
- throw new k("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
351
- context: { error: T }
350
+ w = await this.providerApi.submitCaptchaSolution(r, n, this.userAccount, a, s, e);
351
+ } catch (E) {
352
+ throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
353
+ context: { error: E }
352
354
  });
353
355
  }
354
356
  return [w, c, u];
@@ -356,23 +358,23 @@ class qe {
356
358
  }
357
359
  const ee = "@prosopo/procaptcha";
358
360
  function z() {
359
- return Z.parse(JSON.parse(We(localStorage.getItem(ee) || "0x7b7d")));
361
+ return Z.parse(JSON.parse(Me(localStorage.getItem(ee) || "0x7b7d")));
360
362
  }
361
363
  function te(t) {
362
364
  localStorage.setItem(ee, Y(JSON.stringify(Z.parse(t))));
363
365
  }
364
- function Ye(t) {
366
+ function Ve(t) {
365
367
  te({ ...z(), account: t });
366
368
  }
367
- function Je() {
369
+ function Xe() {
368
370
  return z().account || null;
369
371
  }
370
372
  const j = {
371
- setAccount: Ye,
372
- getAccount: Je,
373
+ setAccount: Ve,
374
+ getAccount: Xe,
373
375
  setProcaptchaStorage: te,
374
376
  getProcaptchaStorage: z
375
- }, Ze = () => ({
377
+ }, qe = () => ({
376
378
  showModal: !1,
377
379
  loading: !1,
378
380
  index: 0,
@@ -382,173 +384,173 @@ const j = {
382
384
  captchaApi: void 0,
383
385
  account: void 0
384
386
  });
385
- function Qe(t, e, n, r, a) {
386
- const i = He(n, e, r), o = Re(e, n), d = () => {
387
+ function Ye(t, e, n, r, a) {
388
+ const s = Se(n, e, r), o = Ie(e, n), d = () => {
387
389
  const l = {
388
390
  userAccountAddress: "",
389
391
  ...t
390
392
  };
391
393
  return e.account && (l.userAccountAddress = e.account.account.address), X.parse(l);
392
394
  }, c = async () => {
393
- i.onOpen(), await F(async () => {
395
+ s.onOpen(), await F(async () => {
394
396
  if (e.loading || e.isHuman)
395
397
  return;
396
- await de(), N(), o({ loading: !0 }), o({
398
+ H(), o({ loading: !0 }), o({
397
399
  attemptCount: e.attemptCount ? e.attemptCount + 1 : 1
398
400
  });
399
401
  const l = d();
400
- o({ dappAccount: l.account.address }), await ke(100);
401
- const h = await oe(), x = await ue(d()), m = x.provider.url, D = await v(m), B = new qe(h.account.address, x, D, l.web2, l.account.address || "");
402
- o({ captchaApi: B });
403
- const C = await B.getCaptchaChallenge();
404
- if (C.error)
402
+ o({ dappAccount: l.account.address }), await ve(100);
403
+ const h = await oe(), y = await ce(d()), p = y.provider.url, T = await N(p), k = new Ke(h.account.address, y, T, l.web2, l.account.address || "");
404
+ o({ captchaApi: k });
405
+ const x = await k.getCaptchaChallenge();
406
+ if (x.error)
405
407
  o({
406
408
  loading: !1,
407
- error: C.error.message
409
+ error: x.error.message
408
410
  });
409
411
  else {
410
- if (C.captchas.length <= 0)
411
- throw new k("DEVELOPER.PROVIDER_NO_CAPTCHA");
412
- const M = C.captchas.map((R) => R.timeLimitMs || l.captchas.image.challengeTimeout).reduce((R, E) => R + E), H = setTimeout(() => {
413
- i.onChallengeExpired(), o({ isHuman: !1, showModal: !1, loading: !1 });
414
- }, M);
412
+ if (x.captchas.length <= 0)
413
+ throw new _("DEVELOPER.PROVIDER_NO_CAPTCHA");
414
+ const O = x.captchas.map((R) => R.timeLimitMs || l.captchas.image.challengeTimeout).reduce((R, S) => R + S), D = setTimeout(() => {
415
+ s.onChallengeExpired(), o({ isHuman: !1, showModal: !1, loading: !1 });
416
+ }, O);
415
417
  o({
416
418
  index: 0,
417
- solutions: C.captchas.map(() => []),
418
- challenge: C,
419
+ solutions: x.captchas.map(() => []),
420
+ challenge: x,
419
421
  showModal: !0,
420
- timeout: H
422
+ timeout: D
421
423
  });
422
424
  }
423
- }, c, N, e.attemptCount, 10);
425
+ }, c, H, e.attemptCount, 10);
424
426
  }, u = async () => {
425
427
  await F(async () => {
426
- if (P(), !e.challenge)
427
- throw new y("CAPTCHA.NO_CAPTCHA", {
428
+ if (M(), !e.challenge)
429
+ throw new A("CAPTCHA.NO_CAPTCHA", {
428
430
  context: { error: "Cannot submit, no Captcha found in state" }
429
431
  });
430
432
  o({ showModal: !1 });
431
- const l = e.challenge, h = he(), x = e.challenge.captchas.map((E, se) => {
432
- const ie = g(e.solutions, se);
433
+ const l = e.challenge, h = Re(), y = e.challenge.captchas.map((S, ie) => {
434
+ const se = f(e.solutions, ie);
433
435
  return {
434
- captchaId: E.captchaId,
435
- captchaContentId: E.captchaContentId,
436
+ captchaId: S.captchaId,
437
+ captchaContentId: S.captchaContentId,
436
438
  salt: h,
437
- solution: ie
439
+ solution: se
438
440
  };
439
- }), m = W(), D = re(m).signer;
440
- if (!g(l.captchas, 0).datasetId)
441
- throw new k("CAPTCHA.INVALID_CAPTCHA_ID", {
441
+ }), p = U(), T = re(p).signer;
442
+ if (!f(l.captchas, 0).datasetId)
443
+ throw new _("CAPTCHA.INVALID_CAPTCHA_ID", {
442
444
  context: { error: "No datasetId set for challenge" }
443
445
  });
444
- const C = e.captchaApi;
445
- if (!C)
446
- throw new y("CAPTCHA.INVALID_TOKEN", {
446
+ const x = e.captchaApi;
447
+ if (!x)
448
+ throw new A("CAPTCHA.INVALID_TOKEN", {
447
449
  context: { error: "No Captcha API found in state" }
448
450
  });
449
- if (!D || !D.signRaw)
450
- throw new S("GENERAL.CANT_FIND_KEYRINGPAIR", {
451
+ if (!T || !T.signRaw)
452
+ throw new I("GENERAL.CANT_FIND_KEYRINGPAIR", {
451
453
  context: {
452
454
  error: "Signer is not defined, cannot sign message to prove account ownership"
453
455
  }
454
456
  });
455
- const M = await D.signRaw({
456
- address: m.account.address,
457
- data: Y(l[p.timestamp]),
457
+ const O = await T.signRaw({
458
+ address: p.account.address,
459
+ data: Y(l[g.timestamp]),
458
460
  type: "bytes"
459
- }), H = await C.submitCaptchaSolution(M.signature, l.requestHash, x, l.timestamp, l.signature.provider.requestHash), R = H[0].verified;
461
+ }), D = await x.submitCaptchaSolution(O.signature, l.requestHash, y, l.timestamp, l.signature.provider.requestHash), R = D[0].verified;
460
462
  if (o({
461
- submission: H,
463
+ submission: D,
462
464
  isHuman: R,
463
465
  loading: !1
464
466
  }), e.isHuman) {
465
- const E = C.provider.provider.url;
467
+ const S = x.provider.provider.url;
466
468
  j.setProcaptchaStorage({
467
469
  ...j.getProcaptchaStorage(),
468
- providerUrl: E
469
- }), i.onHuman(pe({
470
- [p.providerUrl]: E,
471
- [p.user]: m.account.address,
472
- [p.dapp]: ae(),
473
- [p.commitmentId]: Ge(H[1]),
474
- [p.timestamp]: l.timestamp,
475
- [p.signature]: {
476
- [p.provider]: {
477
- [p.requestHash]: l.signature.provider.requestHash
470
+ providerUrl: S
471
+ }), s.onHuman(le({
472
+ [g.providerUrl]: S,
473
+ [g.user]: p.account.address,
474
+ [g.dapp]: ae(),
475
+ [g.commitmentId]: Pe(D[1]),
476
+ [g.timestamp]: l.timestamp,
477
+ [g.signature]: {
478
+ [g.provider]: {
479
+ [g.requestHash]: l.signature.provider.requestHash
478
480
  },
479
- [p.user]: {
480
- [p.timestamp]: M.signature
481
+ [g.user]: {
482
+ [g.timestamp]: O.signature
481
483
  }
482
484
  }
483
485
  })), ne();
484
486
  } else
485
- i.onFailed();
486
- }, c, N, e.attemptCount, 10);
487
+ s.onFailed();
488
+ }, c, H, e.attemptCount, 10);
487
489
  }, w = async () => {
488
- P(), N(), i.onClose();
489
- }, T = async () => {
490
- P(), N(), i.onClose(), await c();
491
- }, A = (l) => {
490
+ M(), H(), s.onClose();
491
+ }, E = async () => {
492
+ M(), H(), s.onClose(), await c();
493
+ }, b = (l) => {
492
494
  if (!e.challenge)
493
- throw new y("CAPTCHA.NO_CAPTCHA", {
495
+ throw new A("CAPTCHA.NO_CAPTCHA", {
494
496
  context: { error: "Cannot select, no Captcha found in state" }
495
497
  });
496
498
  if (e.index >= e.challenge.captchas.length || e.index < 0)
497
- throw new y("CAPTCHA.NO_CAPTCHA", {
499
+ throw new A("CAPTCHA.NO_CAPTCHA", {
498
500
  context: {
499
501
  error: "Cannot select, index is out of range for this Captcha"
500
502
  }
501
503
  });
502
- const h = e.index, x = e.solutions, m = g(x, h);
503
- m.includes(l) ? m.splice(m.indexOf(l), 1) : m.push(l), o({ solutions: x });
504
- }, I = () => {
504
+ const h = e.index, y = e.solutions, p = f(y, h);
505
+ p.includes(l) ? p.splice(p.indexOf(l), 1) : p.push(l), o({ solutions: y });
506
+ }, v = () => {
505
507
  if (!e.challenge)
506
- throw new y("CAPTCHA.NO_CAPTCHA", {
508
+ throw new A("CAPTCHA.NO_CAPTCHA", {
507
509
  context: { error: "Cannot select, no Captcha found in state" }
508
510
  });
509
511
  if (e.index + 1 >= e.challenge.captchas.length)
510
- throw new y("CAPTCHA.NO_CAPTCHA", {
512
+ throw new A("CAPTCHA.NO_CAPTCHA", {
511
513
  context: {
512
514
  error: "Cannot select, index is out of range for this Captcha"
513
515
  }
514
516
  });
515
517
  o({ index: e.index + 1 });
516
- }, v = async (l) => {
518
+ }, N = async (l) => {
517
519
  const h = d();
518
520
  if (!h.account.address)
519
- throw new S("GENERAL.SITE_KEY_MISSING");
520
- return new ge(l, h.account.address);
521
- }, P = () => {
521
+ throw new I("GENERAL.SITE_KEY_MISSING");
522
+ return new de(l, h.account.address);
523
+ }, M = () => {
522
524
  window.clearTimeout(Number(e.timeout)), o({ timeout: void 0 });
523
525
  }, ne = () => {
524
526
  const l = t.captchas.image.solutionTimeout, h = setTimeout(() => {
525
- o({ isHuman: !1 }), i.onExpired();
527
+ o({ isHuman: !1 }), s.onExpired();
526
528
  }, l);
527
529
  o({ successfullChallengeTimeout: h });
528
- }, N = () => {
529
- P(), o(Ze()), i.onReset();
530
+ }, H = () => {
531
+ M(), o(qe()), s.onReset();
530
532
  }, oe = async () => {
531
533
  const l = d();
532
534
  if (!l.web2 && !l.userAccountAddress)
533
- throw new S("GENERAL.ACCOUNT_NOT_FOUND", {
535
+ throw new I("GENERAL.ACCOUNT_NOT_FOUND", {
534
536
  context: { error: "Account address has not been set for web3 mode" }
535
537
  });
536
- const x = await (async () => await (l.web2 ? new fe() : new _e()).getAccount(l))();
537
- return j.setAccount(x.account.address), o({ account: x }), W();
538
- }, W = () => {
538
+ const h = async (k) => await new (await k())().getAccount(l), y = async () => (await import("./index-BH5dKH-o.js")).ExtensionWeb3, p = async () => (await import("./index-BH5dKH-o.js")).ExtensionWeb2, T = await h(l.web2 ? p : y);
539
+ return j.setAccount(T.account.address), o({ account: T }), U();
540
+ }, U = () => {
539
541
  if (!e.account)
540
- throw new S("GENERAL.ACCOUNT_NOT_FOUND", {
542
+ throw new I("GENERAL.ACCOUNT_NOT_FOUND", {
541
543
  context: { error: "Account not loaded" }
542
544
  });
543
545
  return e.account;
544
546
  }, ae = () => {
545
547
  if (!e.dappAccount)
546
- throw new S("GENERAL.SITE_KEY_MISSING");
548
+ throw new I("GENERAL.SITE_KEY_MISSING");
547
549
  return e.dappAccount;
548
550
  }, re = (l) => {
549
- const h = l || W();
551
+ const h = l || U();
550
552
  if (!h.extension)
551
- throw new S("ACCOUNT.NO_POLKADOT_EXTENSION", {
553
+ throw new I("ACCOUNT.NO_POLKADOT_EXTENSION", {
552
554
  context: { error: "Extension not loaded" }
553
555
  });
554
556
  return h.extension;
@@ -557,13 +559,13 @@ function Qe(t, e, n, r, a) {
557
559
  start: c,
558
560
  cancel: w,
559
561
  submit: u,
560
- select: A,
561
- nextRound: I,
562
- reload: T
562
+ select: b,
563
+ nextRound: v,
564
+ reload: E
563
565
  };
564
566
  }
565
- const et = me.memo((t, e) => {
566
- const { show: n, children: r } = t, i = {
567
+ const Je = ue.memo((t, e) => {
568
+ const { show: n, children: r } = t, s = {
567
569
  position: "fixed",
568
570
  zIndex: 2147483646,
569
571
  inset: 0,
@@ -589,40 +591,41 @@ const et = me.memo((t, e) => {
589
591
  border: "none",
590
592
  boxShadow: "rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px,"
591
593
  };
592
- return b("div", { className: "prosopo-modalOuter", style: i, children: [s("div", { className: "prosopo-modalBackground", style: o }), s("div", { className: "prosopo-modalInner", style: d, children: r })] });
593
- }), ot = (t) => {
594
- const { t: e } = q(), n = X.parse(t.config), r = t.callbacks || {}, [a, i] = Le(f.useState, f.useRef), o = Qe(n, a, i, r), d = t.config.theme === "light" ? "light" : "dark", c = t.config.theme === "light" ? _ : L;
595
- return f.useEffect(() => {
596
- n.language && xe.changeLanguage(n.language);
597
- }, [n.language]), s("div", { children: b("div", { style: {
598
- maxWidth: Ce,
594
+ return C("div", { className: "prosopo-modalOuter", style: s, children: [i("div", { className: "prosopo-modalBackground", style: o }), i("div", { className: "prosopo-modalInner", style: d, children: r })] });
595
+ }), nt = (t) => {
596
+ const { t: e } = q(), n = X.parse(t.config), r = t.callbacks || {}, [a, s] = Ne(m.useState, m.useRef), o = Ye(n, a, s, r), d = t.config.theme === "light" ? "light" : "dark", c = t.config.theme === "light" ? L : P;
597
+ return m.useEffect(() => {
598
+ n.language && he.changeLanguage(n.language);
599
+ }, [n.language]), i("div", { children: C("div", { style: {
600
+ maxWidth: pe,
599
601
  maxHeight: "100%",
600
- overflowX: "auto"
601
- }, children: [s(et, { show: a.showModal, children: a.challenge ? s(Ke, { challenge: a.challenge, index: a.index, solutions: a.solutions, onSubmit: o.submit, onCancel: o.cancel, onClick: o.select, onNext: o.nextRound, onReload: o.reload, themeColor: n.theme ?? "light" }) : s("div", { children: "No challenge set." }) }), s(be, { children: s(Ae, { children: b("div", { style: ye, "data-cy": "button-human", children: [" ", b("div", { style: {
602
- padding: we,
603
- border: Te,
602
+ overflowX: "auto",
603
+ ...c.font
604
+ }, children: [i(Je, { show: a.showModal, children: a.challenge ? i($e, { challenge: a.challenge, index: a.index, solutions: a.solutions, onSubmit: o.submit, onCancel: o.cancel, onClick: o.select, onNext: o.nextRound, onReload: o.reload, themeColor: n.theme ?? "light" }) : i("div", { children: "No challenge set." }) }), i(ge, { children: i(fe, { children: C("div", { style: me, "data-cy": "button-human", children: [" ", C("div", { style: {
605
+ padding: xe,
606
+ border: Ce,
604
607
  backgroundColor: c.palette.background.default,
605
608
  borderColor: c.palette.grey[300],
606
- borderRadius: Ee,
609
+ borderRadius: be,
607
610
  display: "flex",
608
611
  alignItems: "center",
609
612
  flexWrap: "wrap",
610
613
  justifyContent: "space-between",
611
- minHeight: `${Se}px`,
614
+ minHeight: `${ye}px`,
612
615
  overflow: "hidden"
613
- }, children: [s("div", { style: { display: "inline-flex", flexDirection: "column" }, children: s("div", { style: {
616
+ }, children: [i("div", { style: { display: "inline-flex", flexDirection: "column" }, children: i("div", { style: {
614
617
  alignItems: "center",
615
618
  flex: 1
616
- }, children: s("div", { style: {
619
+ }, children: i("div", { style: {
617
620
  display: "flex",
618
621
  alignItems: "center",
619
622
  justifyContent: "center",
620
623
  flexDirection: "column",
621
624
  verticalAlign: "middle"
622
- }, children: s("div", { style: {
625
+ }, children: i("div", { style: {
623
626
  display: "flex"
624
- }, children: a.loading ? s(Ie, { themeColor: d, "aria-label": "Loading spinner" }) : s(Pe, { themeColor: d, onChange: o.start, checked: a.isHuman, labelText: e("WIDGET.I_AM_HUMAN"), error: a.error, "aria-label": "human checkbox" }) }) }) }) }), s("div", { style: { display: "inline-flex", flexDirection: "column" }, children: s("a", { href: ve, target: "_blank", "aria-label": Ne, children: s("div", { style: { flex: 1 }, children: s(De, { themeColor: d, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) })] }) });
627
+ }, children: a.loading ? i(Ae, { themeColor: d, "aria-label": "Loading spinner" }) : i(He, { themeColor: d, onChange: o.start, checked: a.isHuman, labelText: e("WIDGET.I_AM_HUMAN"), error: a.error, "aria-label": "human checkbox" }) }) }) }) }), i("div", { style: { display: "inline-flex", flexDirection: "column" }, children: i("a", { href: we, target: "_blank", "aria-label": Te, children: i("div", { style: { flex: 1 }, children: i(Ee, { themeColor: d, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) })] }) });
625
628
  };
626
629
  export {
627
- ot as default
630
+ nt as default
628
631
  };