@prosopo/procaptcha-bundle 0.3.3 → 0.3.4

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.
@@ -1,19 +1,19 @@
1
- import { r as f, l as J, d as Q, j as d, a as v, b as g, A as $, h as ce, P as Ee, R as Ie, C as Ne, W as Te, c as Se, e as Pe, L as Oe, f as ke, g as Le, i as He } from "./index-BoRQHVyP.js";
2
- import { _ as De, a as _e, b as Re, I as Me, R as Ue, g as We, c as je, d as Ge, i as Fe, P as z, o as ze, E as $e, e as S, f as re, h as A, j as K, k as ie, s as Be, l as Ke, w as le, t as te, m as Ve, n as Ye, p as qe, r as Xe, q as Je, u as Qe, v as Ze, A as et, W as tt, K as nt, x as rt, C as ot, y as at, z as st } from "./utils-CIX8CwBe.js";
3
- function ct() {
1
+ import { r as f, l as Q, d as Z, j as d, a as E, b as g, A as $, h as ce, P as Ie, R as Te, C as Ne, W as Se, c as Pe, e as Oe, f as De, g as _e, i as ke, L as Le, k as He, m as Re, n as Ue } from "./index-DNBOJlnJ.js";
2
+ import { _ as Me, a as We, b as je, I as Ge, R as Fe, g as ze, c as Be, d as $e, i as Ke, P as z, o as Ve, E as Ye, e as S, f as oe, h as v, j as V, k as le, s as Xe, l as qe, w as de, t as ne, m as Je, n as Qe, p as Ze, r as et, q as tt, u as nt, v as rt, A as ot, W as at, K as st, x as it, C as ct, y as lt, z as dt } from "./utils-wnaO-SHm.js";
3
+ function ut() {
4
4
  if (console && console.warn) {
5
5
  for (var t, e = arguments.length, n = new Array(e), r = 0; r < e; r++)
6
6
  n[r] = arguments[r];
7
7
  typeof n[0] == "string" && (n[0] = "react-i18next:: ".concat(n[0])), (t = console).warn.apply(t, n);
8
8
  }
9
9
  }
10
- var de = {};
11
- function oe() {
10
+ var ue = {};
11
+ function ae() {
12
12
  for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
13
13
  e[n] = arguments[n];
14
- typeof e[0] == "string" && de[e[0]] || (typeof e[0] == "string" && (de[e[0]] = /* @__PURE__ */ new Date()), ct.apply(void 0, e));
14
+ typeof e[0] == "string" && ue[e[0]] || (typeof e[0] == "string" && (ue[e[0]] = /* @__PURE__ */ new Date()), ut.apply(void 0, e));
15
15
  }
16
- function ue(t, e, n) {
16
+ function pe(t, e, n) {
17
17
  t.loadNamespaces(e, function() {
18
18
  if (t.isInitialized)
19
19
  n();
@@ -27,45 +27,45 @@ function ue(t, e, n) {
27
27
  }
28
28
  });
29
29
  }
30
- function it(t, e) {
30
+ function pt(t, e) {
31
31
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = e.languages[0], a = e.options ? e.options.fallbackLng : !1, s = e.languages[e.languages.length - 1];
32
32
  if (r.toLowerCase() === "cimode")
33
33
  return !0;
34
- var o = function(i, p) {
35
- var w = e.services.backendConnector.state["".concat(i, "|").concat(p)];
34
+ var o = function(l, p) {
35
+ var w = e.services.backendConnector.state["".concat(l, "|").concat(p)];
36
36
  return w === -1 || w === 2;
37
37
  };
38
38
  return n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && e.services.backendConnector.backend && e.isLanguageChangingTo && !o(e.isLanguageChangingTo, t) ? !1 : !!(e.hasResourceBundle(r, t) || !e.services.backendConnector.backend || e.options.resources && !e.options.partialBundledLanguages || o(r, t) && (!a || o(s, t)));
39
39
  }
40
- function lt(t, e) {
40
+ function ht(t, e) {
41
41
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
42
42
  if (!e.languages || !e.languages.length)
43
- return oe("i18n.languages were undefined or empty", e.languages), !0;
43
+ return ae("i18n.languages were undefined or empty", e.languages), !0;
44
44
  var r = e.options.ignoreJSONStructure !== void 0;
45
45
  return r ? e.hasLoadedNamespace(t, {
46
46
  precheck: function(s, o) {
47
47
  if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && s.services.backendConnector.backend && s.isLanguageChangingTo && !o(s.isLanguageChangingTo, t))
48
48
  return !1;
49
49
  }
50
- }) : it(t, e, n);
50
+ }) : pt(t, e, n);
51
51
  }
52
- function dt(t, e) {
52
+ function ft(t, e) {
53
53
  var n = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
54
54
  if (n != null) {
55
- var r, a, s, o, c = [], i = !0, p = !1;
55
+ var r, a, s, o, c = [], l = !0, p = !1;
56
56
  try {
57
57
  if (s = (n = n.call(t)).next, e === 0) {
58
58
  if (Object(n) !== n)
59
59
  return;
60
- i = !1;
60
+ l = !1;
61
61
  } else
62
- for (; !(i = (r = s.call(n)).done) && (c.push(r.value), c.length !== e); i = !0)
62
+ for (; !(l = (r = s.call(n)).done) && (c.push(r.value), c.length !== e); l = !0)
63
63
  ;
64
64
  } catch (w) {
65
65
  p = !0, a = w;
66
66
  } finally {
67
67
  try {
68
- if (!i && n.return != null && (o = n.return(), Object(o) !== o))
68
+ if (!l && n.return != null && (o = n.return(), Object(o) !== o))
69
69
  return;
70
70
  } finally {
71
71
  if (p)
@@ -75,10 +75,10 @@ function dt(t, e) {
75
75
  return c;
76
76
  }
77
77
  }
78
- function ut(t, e) {
79
- return De(t) || dt(t, e) || _e(t, e) || Re();
78
+ function gt(t, e) {
79
+ return Me(t) || ft(t, e) || We(t, e) || je();
80
80
  }
81
- function pe(t, e) {
81
+ function he(t, e) {
82
82
  var n = Object.keys(t);
83
83
  if (Object.getOwnPropertySymbols) {
84
84
  var r = Object.getOwnPropertySymbols(t);
@@ -88,80 +88,80 @@ function pe(t, e) {
88
88
  }
89
89
  return n;
90
90
  }
91
- function ne(t) {
91
+ function re(t) {
92
92
  for (var e = 1; e < arguments.length; e++) {
93
93
  var n = arguments[e] != null ? arguments[e] : {};
94
- e % 2 ? pe(Object(n), !0).forEach(function(r) {
95
- je(t, r, n[r]);
96
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : pe(Object(n)).forEach(function(r) {
94
+ e % 2 ? he(Object(n), !0).forEach(function(r) {
95
+ Be(t, r, n[r]);
96
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : he(Object(n)).forEach(function(r) {
97
97
  Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
98
98
  });
99
99
  }
100
100
  return t;
101
101
  }
102
- var pt = function(e, n) {
102
+ var mt = function(e, n) {
103
103
  var r = f.useRef();
104
104
  return f.useEffect(function() {
105
105
  r.current = n ? r.current : e;
106
106
  }, [e, n]), r.current;
107
107
  };
108
- function ht(t) {
109
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, r = f.useContext(Me) || {}, a = r.i18n, s = r.defaultNS, o = n || a || Ge();
110
- if (o && !o.reportNamespaces && (o.reportNamespaces = new Ue()), !o) {
111
- oe("You will need to pass in an i18next instance by using initReactI18next");
112
- var c = function(N) {
113
- return Array.isArray(N) ? N[N.length - 1] : N;
114
- }, i = [c, {}, !1];
115
- return i.t = c, i.i18n = {}, i.ready = !1, i;
108
+ function wt(t) {
109
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, r = f.useContext(Ge) || {}, a = r.i18n, s = r.defaultNS, o = n || a || $e();
110
+ if (o && !o.reportNamespaces && (o.reportNamespaces = new Fe()), !o) {
111
+ ae("You will need to pass in an i18next instance by using initReactI18next");
112
+ var c = function(x) {
113
+ return Array.isArray(x) ? x[x.length - 1] : x;
114
+ }, l = [c, {}, !1];
115
+ return l.t = c, l.i18n = {}, l.ready = !1, l;
116
116
  }
117
- o.options.react && o.options.react.wait !== void 0 && oe("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
118
- var p = ne(ne(ne({}, We()), o.options.react), e), w = p.useSuspense, E = p.keyPrefix, m = t || s || o.options && o.options.defaultNS;
117
+ o.options.react && o.options.react.wait !== void 0 && ae("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
118
+ var p = re(re(re({}, ze()), o.options.react), e), w = p.useSuspense, I = p.keyPrefix, m = t || s || o.options && o.options.defaultNS;
119
119
  m = typeof m == "string" ? [m] : m || ["translation"], o.reportNamespaces.addUsedNamespaces && o.reportNamespaces.addUsedNamespaces(m);
120
- var k = (o.isInitialized || o.initializedStoreOnce) && m.every(function(x) {
121
- return lt(x, o, p);
120
+ var D = (o.isInitialized || o.initializedStoreOnce) && m.every(function(A) {
121
+ return ht(A, o, p);
122
122
  });
123
- function H() {
124
- return o.getFixedT(null, p.nsMode === "fallback" ? m : m[0], E);
123
+ function k() {
124
+ return o.getFixedT(null, p.nsMode === "fallback" ? m : m[0], I);
125
125
  }
126
- var M = f.useState(H), U = ut(M, 2), W = U[0], D = U[1], j = m.join(), V = pt(j), b = f.useRef(!0);
126
+ var U = f.useState(k), M = gt(U, 2), W = M[0], L = M[1], j = m.join(), Y = mt(j), b = f.useRef(!0);
127
127
  f.useEffect(function() {
128
- var x = p.bindI18n, N = p.bindI18nStore;
129
- b.current = !0, !k && !w && ue(o, m, function() {
130
- b.current && D(H);
131
- }), k && V && V !== j && b.current && D(H);
132
- function l() {
133
- b.current && D(H);
128
+ var A = p.bindI18n, x = p.bindI18nStore;
129
+ b.current = !0, !D && !w && pe(o, m, function() {
130
+ b.current && L(k);
131
+ }), D && Y && Y !== j && b.current && L(k);
132
+ function B() {
133
+ b.current && L(k);
134
134
  }
135
- return x && o && o.on(x, l), N && o && o.store.on(N, l), function() {
136
- b.current = !1, x && o && x.split(" ").forEach(function(u) {
137
- return o.off(u, l);
138
- }), N && o && N.split(" ").forEach(function(u) {
139
- return o.store.off(u, l);
135
+ return A && o && o.on(A, B), x && o && o.store.on(x, B), function() {
136
+ b.current = !1, A && o && A.split(" ").forEach(function(i) {
137
+ return o.off(i, B);
138
+ }), x && o && x.split(" ").forEach(function(i) {
139
+ return o.store.off(i, B);
140
140
  });
141
141
  };
142
142
  }, [o, j]);
143
- var I = f.useRef(!0);
143
+ var T = f.useRef(!0);
144
144
  f.useEffect(function() {
145
- b.current && !I.current && D(H), I.current = !1;
146
- }, [o, E]);
147
- var _ = [W, o, k];
148
- if (_.t = W, _.i18n = o, _.ready = k, k || !k && !w)
149
- return _;
150
- throw new Promise(function(x) {
151
- ue(o, m, function() {
152
- x();
145
+ b.current && !T.current && L(k), T.current = !1;
146
+ }, [o, I]);
147
+ var H = [W, o, D];
148
+ if (H.t = W, H.i18n = o, H.ready = D, D || !D && !w)
149
+ return H;
150
+ throw new Promise(function(A) {
151
+ pe(o, m, function() {
152
+ A();
153
153
  });
154
154
  });
155
155
  }
156
- function ft(t) {
157
- return ht("translation", { i18n: Fe, ...t });
156
+ function yt(t) {
157
+ return wt("translation", { i18n: Ke, ...t });
158
158
  }
159
- const gt = (t) => {
159
+ const bt = (t) => {
160
160
  if (!t.hash)
161
161
  throw new z("CAPTCHA.MISSING_ITEM_HASH", { context: { item: t } });
162
162
  return t.hash;
163
- }, mt = ({ challenge: t, solution: e, onClick: n, themeColor: r }) => {
164
- const a = t.captcha.items, s = f.useMemo(() => r === "light" ? J : Q, [r]), o = "ontouchstart" in window;
163
+ }, Ct = ({ challenge: t, solution: e, onClick: n, themeColor: r }) => {
164
+ const a = t.captcha.items, s = f.useMemo(() => r === "light" ? Q : Z, [r]), o = "ontouchstart" in window;
165
165
  return d("div", { style: {
166
166
  paddingRight: 0.5,
167
167
  paddingBottom: 0.5,
@@ -170,15 +170,15 @@ const gt = (t) => {
170
170
  display: "flex",
171
171
  flexDirection: "row",
172
172
  flexWrap: "wrap"
173
- }, children: a.map((c, i) => {
174
- const p = gt(c);
173
+ }, children: a.map((c, l) => {
174
+ const p = bt(c);
175
175
  return d("div", { style: {
176
176
  paddingTop: "4px",
177
177
  paddingLeft: "4px",
178
178
  flexGrow: 1,
179
179
  flexBasis: "33.3333%",
180
180
  boxSizing: "border-box"
181
- }, children: v("div", { style: { cursor: "pointer", height: "100%", width: "100%" }, onClick: o ? void 0 : () => n(p), onTouchStart: o ? () => n(p) : void 0, children: [d("div", { style: { border: 1, borderColor: s.palette.grey[300] }, children: d("img", { style: {
181
+ }, children: E("div", { style: { cursor: "pointer", height: "100%", width: "100%" }, onClick: o ? void 0 : () => n(p), onTouchStart: o ? () => n(p) : void 0, children: [d("div", { style: { border: 1, borderColor: s.palette.grey[300] }, children: d("img", { style: {
182
182
  width: "100%",
183
183
  backgroundColor: s.palette.grey[300],
184
184
  opacity: e.includes(p) && o ? "50%" : "100%",
@@ -186,7 +186,7 @@ const gt = (t) => {
186
186
  objectFit: "contain",
187
187
  aspectRatio: "1/1",
188
188
  height: "auto"
189
- }, src: c.data, alt: `Captcha image ${i + 1}` }) }), d("div", { style: {
189
+ }, src: c.data, alt: `Captcha image ${l + 1}` }) }), d("div", { style: {
190
190
  position: "relative",
191
191
  width: "100%",
192
192
  height: "100%",
@@ -214,18 +214,18 @@ const gt = (t) => {
214
214
  transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
215
215
  userSelect: "none",
216
216
  fill: "currentcolor"
217
- }, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", children: d("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) }) })] }) }, i);
217
+ }, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", children: d("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) }) })] }) }, l);
218
218
  }) });
219
219
  };
220
- function wt(t = {}) {
220
+ function xt(t = {}) {
221
221
  return Object.keys(t).reduce((e, n) => ({ ...e, [`data-${n}`]: t[n] }), {});
222
222
  }
223
- function ae({ general: t, dev: e }) {
223
+ function se({ general: t, dev: e }) {
224
224
  return {
225
- ...wt(t)
225
+ ...xt(t)
226
226
  };
227
227
  }
228
- const yt = {
228
+ const vt = {
229
229
  display: "inline-flex",
230
230
  alignItems: "center",
231
231
  justifyContent: "center",
@@ -251,25 +251,25 @@ const yt = {
251
251
  color: "rgb(0, 0, 0)",
252
252
  backgroundColor: "#ffffff",
253
253
  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"
254
- }, bt = ({ themeColor: t, buttonType: e, text: n, onClick: r }) => {
255
- const a = f.useMemo(() => t === "light" ? J : Q, [t]), [s, o] = f.useState(!1), c = f.useMemo(() => {
256
- const i = {
257
- ...yt,
254
+ }, At = ({ themeColor: t, buttonType: e, text: n, onClick: r }) => {
255
+ const a = f.useMemo(() => t === "light" ? Q : Z, [t]), [s, o] = f.useState(!1), c = f.useMemo(() => {
256
+ const l = {
257
+ ...vt,
258
258
  color: s ? a.palette.primary.contrastText : a.palette.background.contrastText
259
259
  };
260
260
  return e === "cancel" ? {
261
- ...i,
261
+ ...l,
262
262
  backgroundColor: s ? a.palette.grey[600] : "transparent"
263
263
  } : {
264
- ...i,
264
+ ...l,
265
265
  backgroundColor: s ? a.palette.primary.main : a.palette.background.default
266
266
  };
267
267
  }, [e, s, a]);
268
- return d("button", { ...ae({ dev: { cy: `button-${e}` } }), onMouseEnter: () => o(!0), onMouseLeave: () => o(!1), style: c, onClick: (i) => {
269
- i.preventDefault(), r();
268
+ return d("button", { ...se({ dev: { cy: `button-${e}` } }), onMouseEnter: () => o(!0), onMouseLeave: () => o(!1), style: c, onClick: (l) => {
269
+ l.preventDefault(), r();
270
270
  }, children: n });
271
- }, he = bt, Ct = ({ challenge: t, index: e, solutions: n, onSubmit: r, onCancel: a, onClick: s, onNext: o, themeColor: c }) => {
272
- const { t: i } = ft(), p = t.captchas ? g(t.captchas, e) : null, w = n ? g(n, e) : [], E = f.useMemo(() => c === "light" ? J : Q, [c]);
271
+ }, fe = At, Et = ({ challenge: t, index: e, solutions: n, onSubmit: r, onCancel: a, onClick: s, onNext: o, themeColor: c }) => {
272
+ const { t: l } = yt(), p = t.captchas ? g(t.captchas, e) : null, w = n ? g(n, e) : [], I = f.useMemo(() => c === "light" ? Q : Z, [c]);
273
273
  return d(f.Suspense, { fallback: d("div", { children: "Loading..." }), children: d("div", { style: {
274
274
  overflowX: "auto",
275
275
  overflowY: "auto",
@@ -278,80 +278,80 @@ const yt = {
278
278
  maxHeight: "100%",
279
279
  display: "flex",
280
280
  flexDirection: "column"
281
- }, children: v("div", { style: {
282
- backgroundColor: E.palette.background.default,
281
+ }, children: E("div", { style: {
282
+ backgroundColor: I.palette.background.default,
283
283
  display: "flex",
284
284
  flexDirection: "column",
285
285
  minWidth: "300px"
286
- }, children: [v("div", { style: {
286
+ }, children: [E("div", { style: {
287
287
  display: "flex",
288
288
  alignItems: "center",
289
289
  width: "100%",
290
- backgroundColor: E.palette.primary.main,
290
+ backgroundColor: I.palette.primary.main,
291
291
  padding: "24px 16px"
292
- }, children: [v("p", { style: {
292
+ }, children: [E("p", { style: {
293
293
  color: "#ffffff",
294
294
  fontWeight: 700,
295
295
  lineHeight: 1.5
296
- }, children: [i("WIDGET.SELECT_ALL"), ": "] }), d("p", { style: {
296
+ }, children: [l("WIDGET.SELECT_ALL"), ": "] }), d("p", { style: {
297
297
  color: "#ffffff",
298
298
  fontWeight: 700,
299
299
  textTransform: "capitalize",
300
300
  lineHeight: 1.5
301
- }, children: `${g(t.captchas, e).captcha.target}` })] }), d("div", { ...ae({ dev: { cy: "captcha-" + e } }), children: p && d(mt, { challenge: p, solution: w, onClick: s, themeColor: c }) }), d("div", { style: {
301
+ }, children: `${g(t.captchas, e).captcha.target}` })] }), d("div", { ...se({ dev: { cy: "captcha-" + e } }), children: p && d(Ct, { challenge: p, solution: w, onClick: s, themeColor: c }) }), d("div", { style: {
302
302
  display: "flex",
303
303
  alignItems: "center",
304
304
  justifyContent: "center",
305
305
  width: "100%"
306
- }, ...ae({ dev: { cy: "dots-captcha" } }) }), d("div", { style: {
306
+ }, ...se({ dev: { cy: "dots-captcha" } }) }), d("div", { style: {
307
307
  padding: "8px 16px",
308
308
  display: "flex",
309
309
  width: "100%"
310
- } }), v("div", { style: {
310
+ } }), E("div", { style: {
311
311
  padding: "0 16px 16px",
312
312
  display: "flex",
313
313
  alignItems: "center",
314
314
  justifyContent: "space-between",
315
315
  lineHeight: 1.75
316
- }, children: [d(he, { themeColor: c, buttonType: "cancel", onClick: a, text: i("WIDGET.CANCEL") }), d(he, { themeColor: c, buttonType: "next", text: e < t.captchas.length - 1 ? i("WIDGET.NEXT") : i("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? o : r })] })] }) }) });
317
- }, xt = Ct;
318
- function vt(t) {
316
+ }, children: [d(fe, { themeColor: c, buttonType: "cancel", onClick: a, text: l("WIDGET.CANCEL") }), d(fe, { themeColor: c, buttonType: "next", text: e < t.captchas.length - 1 ? l("WIDGET.NEXT") : l("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? o : r })] })] }) }) });
317
+ }, It = Et;
318
+ function Tt(t) {
319
319
  return new Promise((e) => {
320
320
  document.readyState === "complete" ? e(t()) : window.addEventListener("load", () => e(t()));
321
321
  });
322
322
  }
323
- const X = window;
324
- X.injectedWeb3 = X.injectedWeb3 || {};
325
- ye();
326
- let fe = null;
327
- function ye() {
328
- return Object.values(X.injectedWeb3).filter(({ connect: t, enable: e }) => !!(t || e)).length !== 0;
323
+ const J = window;
324
+ J.injectedWeb3 = J.injectedWeb3 || {};
325
+ be();
326
+ let ge = null;
327
+ function be() {
328
+ return Object.values(J.injectedWeb3).filter(({ connect: t, enable: e }) => !!(t || e)).length !== 0;
329
329
  }
330
- function At(t) {
331
- return Promise.all(Object.entries(X.injectedWeb3).map(([e, { connect: n, enable: r, version: a }]) => Promise.resolve().then(() => n ? n(t) : r ? r(t).then((s) => ze({ name: e, version: a || "unknown" }, s)) : Promise.reject(new Error("No connect(..) or enable(...) hook found"))).catch(({ message: s }) => {
330
+ function Nt(t) {
331
+ return Promise.all(Object.entries(J.injectedWeb3).map(([e, { connect: n, enable: r, version: a }]) => Promise.resolve().then(() => n ? n(t) : r ? r(t).then((s) => Ve({ name: e, version: a || "unknown" }, s)) : Promise.reject(new Error("No connect(..) or enable(...) hook found"))).catch(({ message: s }) => {
332
332
  console.error(`Error initializing ${e}: ${s}`);
333
333
  }))).then((e) => e.filter((n) => !!n));
334
334
  }
335
- function Et(t, e = []) {
335
+ function St(t, e = []) {
336
336
  if (!t)
337
337
  throw new Error("You must pass a name for your app to the web3Enable function");
338
338
  const n = e.length ? Promise.all(e.map((r) => r().catch(() => !1))) : Promise.resolve([!0]);
339
- return fe = vt(() => n.then(() => At(t).then((r) => r.map((a) => (a.accounts.subscribe || (a.accounts.subscribe = (s) => (a.accounts.get().then(s).catch(console.error), () => {
339
+ return ge = Tt(() => n.then(() => Nt(t).then((r) => r.map((a) => (a.accounts.subscribe || (a.accounts.subscribe = (s) => (a.accounts.get().then(s).catch(console.error), () => {
340
340
  })), a))).catch(() => []).then((r) => {
341
341
  const a = r.map(({ name: s, version: o }) => `${s}/${o}`);
342
- return ye(), console.info(`web3Enable: Enabled ${r.length} extension${r.length !== 1 ? "s" : ""}: ${a.join(", ")}`), r;
343
- }))), fe;
342
+ return be(), console.info(`web3Enable: Enabled ${r.length} extension${r.length !== 1 ? "s" : ""}: ${a.join(", ")}`), r;
343
+ }))), ge;
344
344
  }
345
- class It extends $e {
345
+ class Pt extends Ye {
346
346
  async getAccount(e) {
347
347
  const { dappName: n, userAccountAddress: r } = e;
348
348
  if (!r)
349
349
  throw new S("WIDGET.NO_ACCOUNTS_FOUND", { context: { error: "No account address provided" } });
350
- const a = await Et(n);
350
+ const a = await St(n);
351
351
  if (a.length === 0)
352
352
  throw new S("WIDGET.NO_EXTENSION_FOUND");
353
353
  for (const s of a) {
354
- const c = (await s.accounts.get()).find((i) => i.address === r);
354
+ const c = (await s.accounts.get()).find((l) => l.address === r);
355
355
  if (c)
356
356
  return { account: c, extension: s };
357
357
  }
@@ -360,35 +360,35 @@ class It extends $e {
360
360
  });
361
361
  }
362
362
  }
363
- async function Nt(t) {
363
+ async function Ot(t) {
364
364
  try {
365
365
  const e = await fetch(t);
366
366
  if (!e.ok)
367
- throw new re("API.BAD_REQUEST", {
367
+ throw new oe("API.BAD_REQUEST", {
368
368
  context: { error: `Network response was not ok, status: ${e.status}`, url: t }
369
369
  });
370
370
  const n = await e.arrayBuffer();
371
371
  return new Uint8Array(n);
372
372
  } catch (e) {
373
- throw new A("DATABASE.IMAGE_GET_FAILED", { context: { error: e } });
373
+ throw new v("DATABASE.IMAGE_GET_FAILED", { context: { error: e } });
374
374
  }
375
375
  }
376
- const Tt = "NO_SOLUTION";
377
- function be(t, e = !1, n = !1, r) {
376
+ const Dt = "NO_SOLUTION";
377
+ function Ce(t, e = !1, n = !1, r) {
378
378
  try {
379
379
  const a = t.items.map((s, o) => {
380
380
  if (s.hash)
381
381
  return s.hash;
382
382
  throw new z("CAPTCHA.MISSING_ITEM_HASH", {
383
383
  context: {
384
- computeCaptchaHashName: be.name,
384
+ computeCaptchaHashName: Ce.name,
385
385
  index: o
386
386
  }
387
387
  });
388
388
  });
389
- return K([
389
+ return V([
390
390
  t.target,
391
- ...e ? St(t.solution) : [],
391
+ ...e ? _t(t.solution) : [],
392
392
  n ? t.salt : "",
393
393
  r ? a.sort() : a
394
394
  ]);
@@ -396,25 +396,25 @@ function be(t, e = !1, n = !1, r) {
396
396
  throw new z("DATASET.HASH_ERROR", { context: { error: a } });
397
397
  }
398
398
  }
399
- function St(t) {
400
- return t !== void 0 ? t.sort() : [Tt];
399
+ function _t(t) {
400
+ return t !== void 0 ? t.sort() : [Dt];
401
401
  }
402
- async function Pt(t) {
402
+ async function kt(t) {
403
403
  if (t.type === "text")
404
- return { ...t, hash: ie(t.data) };
404
+ return { ...t, hash: le(t.data) };
405
405
  if (t.type === "image")
406
- return { ...t, hash: ie(await Nt(t.data)) };
406
+ return { ...t, hash: le(await Ot(t.data)) };
407
407
  throw new z("CAPTCHA.INVALID_ITEM_FORMAT");
408
408
  }
409
- function Ot(t) {
410
- return K([t.captchaId, t.captchaContentId, [...t.solution].sort(), t.salt]);
409
+ function Lt(t) {
410
+ return V([t.captchaId, t.captchaContentId, [...t.solution].sort(), t.salt]);
411
411
  }
412
- class ge {
412
+ class me {
413
413
  constructor(e) {
414
414
  this.hash = e, this.parent = null;
415
415
  }
416
416
  }
417
- class kt {
417
+ class Ht {
418
418
  constructor() {
419
419
  this.leaves = [], this.layers = [];
420
420
  }
@@ -422,7 +422,7 @@ class kt {
422
422
  this.layers.length && (this.layers = []);
423
423
  const n = [];
424
424
  for (const r of e) {
425
- const a = new ge(r);
425
+ const a = new me(r);
426
426
  this.leaves.push(a), n.push(a.hash);
427
427
  }
428
428
  this.layers.push(n), this.root = this.buildMerkleTree(this.leaves)[0];
@@ -438,13 +438,13 @@ class kt {
438
438
  const o = e[a];
439
439
  if (o === void 0)
440
440
  throw new S("DEVELOPER.GENERAL", { context: { error: "leftChild undefined" } });
441
- const c = a + 1 < n ? g(e, a + 1) : o, i = this.createParent(o, c);
442
- s.push(i.hash), r.push(i), a += 2;
441
+ const c = a + 1 < n ? g(e, a + 1) : o, l = this.createParent(o, c);
442
+ s.push(l.hash), r.push(l), a += 2;
443
443
  }
444
444
  return this.layers.push(s), this.buildMerkleTree(r);
445
445
  }
446
446
  createParent(e, n) {
447
- const r = new ge(K([e.hash, n.hash]));
447
+ const r = new me(V([e.hash, n.hash]));
448
448
  return e.parent = r.hash, n.parent = r.hash, r;
449
449
  }
450
450
  proof(e) {
@@ -459,19 +459,19 @@ class kt {
459
459
  const o = s.indexOf(e);
460
460
  let c = o % 2 && o > 0 ? o - 1 : o + 1;
461
461
  c > s.length - 1 && (c = o);
462
- const i = [e], p = g(s, c);
463
- c > o ? i.push(p) : i.unshift(p), n.push([g(i, 0), g(i, 1)]), r += 1, e = K(i);
462
+ const l = [e], p = g(s, c);
463
+ c > o ? l.push(p) : l.unshift(p), n.push([g(l, 0), g(l, 1)]), r += 1, e = V(l);
464
464
  }
465
465
  const a = g(this.layers, this.layers.length - 1);
466
466
  return [...n, [g(a, 0)]];
467
467
  }
468
468
  }
469
- function Lt(t, e) {
469
+ function Rt(t, e) {
470
470
  try {
471
471
  if (g(e, 0).indexOf(t) === -1)
472
472
  return !1;
473
473
  for (const [n, r] of e.entries()) {
474
- if (t = K(r), g(e, n + 1).indexOf(t) === -1)
474
+ if (t = V(r), g(e, n + 1).indexOf(t) === -1)
475
475
  return !1;
476
476
  const a = g(e, e.length - 1);
477
477
  if (t === g(a, 0))
@@ -482,7 +482,7 @@ function Lt(t, e) {
482
482
  return !1;
483
483
  }
484
484
  }
485
- class Ht {
485
+ class Ut {
486
486
  constructor(e, n, r, a, s, o) {
487
487
  this.userAccount = e, this.contract = n, this.provider = r, this.providerApi = a, this._web2 = s, this.dappAccount = o;
488
488
  }
@@ -498,71 +498,71 @@ class Ht {
498
498
  });
499
499
  }), e;
500
500
  } catch (e) {
501
- throw new A("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", { context: { error: e } });
501
+ throw new v("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", { context: { error: e } });
502
502
  }
503
503
  }
504
504
  verifyCaptchaChallengeContent(e, n) {
505
505
  const r = g(n.captchas, 0), a = r.proof.length, s = g(r.proof, a - 1);
506
506
  if (e.provider.datasetIdContent.toString() !== g(s, 0))
507
- throw new A("CAPTCHA.INVALID_DATASET_CONTENT_ID");
507
+ throw new v("CAPTCHA.INVALID_DATASET_CONTENT_ID");
508
508
  for (const o of n.captchas) {
509
- if (!Dt(o))
510
- throw new A("CAPTCHA.INVALID_CAPTCHA_CHALLENGE");
511
- if (!Lt(o.captcha.captchaContentId, o.proof))
512
- throw new A("CAPTCHA.INVALID_CAPTCHA_CHALLENGE");
509
+ if (!Mt(o))
510
+ throw new v("CAPTCHA.INVALID_CAPTCHA_CHALLENGE");
511
+ if (!Rt(o.captcha.captchaContentId, o.proof))
512
+ throw new v("CAPTCHA.INVALID_CAPTCHA_CHALLENGE");
513
513
  }
514
514
  }
515
515
  async submitCaptchaSolution(e, n, r, a, s) {
516
- const o = new kt(), c = a.map((m) => Ot(m));
516
+ const o = new Ht(), c = a.map((m) => Lt(m));
517
517
  o.build(c);
518
- const i = o.root.hash, p = void 0;
518
+ const l = o.root.hash, p = void 0;
519
519
  let w;
520
520
  if (this.web2) {
521
521
  if (!e || !e.signRaw)
522
- throw new A("GENERAL.CANT_FIND_KEYRINGPAIR", {
522
+ throw new v("GENERAL.CANT_FIND_KEYRINGPAIR", {
523
523
  context: { error: "Signer is not defined, cannot sign message to prove account ownership" }
524
524
  });
525
525
  w = (await e.signRaw({
526
526
  address: this.userAccount,
527
- data: Be(n),
527
+ data: Xe(n),
528
528
  type: "bytes"
529
529
  })).signature;
530
530
  }
531
- let E;
531
+ let I;
532
532
  try {
533
- E = await this.providerApi.submitCaptchaSolution(a, n, this.contract.pair.address, s, w);
533
+ I = await this.providerApi.submitCaptchaSolution(a, n, this.contract.pair.address, s, w);
534
534
  } catch (m) {
535
535
  throw new z("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", { context: { error: m } });
536
536
  }
537
- return [E, i, p];
537
+ return [I, l, p];
538
538
  }
539
539
  }
540
- async function Dt(t) {
540
+ async function Mt(t) {
541
541
  const e = t.captcha, n = t.proof;
542
- if (!(await Promise.all(e.items.map(async (a) => (await Pt(a)).hash === a.hash))).every((a) => a === !0))
542
+ if (!(await Promise.all(e.items.map(async (a) => (await kt(a)).hash === a.hash))).every((a) => a === !0))
543
543
  return !1;
544
- const r = be(e, !1, !1, !1);
544
+ const r = Ce(e, !1, !1, !1);
545
545
  return r !== e.captchaContentId ? !1 : g(n, 0).indexOf(r) !== -1;
546
546
  }
547
- const _t = Ht, Ce = "@prosopo/current_account", xe = "@prosopo/provider";
548
- function Rt(t) {
549
- localStorage.setItem(Ce, t);
550
- }
551
- function Mt() {
552
- return localStorage.getItem(Ce);
553
- }
554
- function Ut(t) {
547
+ const Wt = Ut, xe = "@prosopo/current_account", ve = "@prosopo/provider";
548
+ function jt(t) {
555
549
  localStorage.setItem(xe, t);
556
550
  }
557
- function Wt() {
551
+ function Gt() {
558
552
  return localStorage.getItem(xe);
559
553
  }
560
- const B = {
561
- setAccount: Rt,
562
- getAccount: Mt,
563
- setProviderUrl: Ut,
564
- getProviderUrl: Wt
565
- }, jt = () => ({
554
+ function Ft(t) {
555
+ localStorage.setItem(ve, t);
556
+ }
557
+ function zt() {
558
+ return localStorage.getItem(ve);
559
+ }
560
+ const K = {
561
+ setAccount: jt,
562
+ getAccount: Gt,
563
+ setProviderUrl: Ft,
564
+ getProviderUrl: zt
565
+ }, Bt = () => ({
566
566
  showModal: !1,
567
567
  loading: !1,
568
568
  index: 0,
@@ -571,66 +571,66 @@ const B = {
571
571
  isHuman: !1,
572
572
  captchaApi: void 0,
573
573
  account: void 0
574
- }), me = (t) => {
574
+ }), we = (t) => {
575
575
  const e = t.networks[t.defaultNetwork];
576
576
  if (!e)
577
- throw new A("DEVELOPER.NETWORK_NOT_FOUND", {
577
+ throw new v("DEVELOPER.NETWORK_NOT_FOUND", {
578
578
  context: { error: `No network found for environment ${t.defaultEnvironment}` }
579
579
  });
580
580
  return e;
581
581
  };
582
- function Gt(t, e, n, r) {
583
- const a = Ke(n, e, r), s = (l) => {
584
- const u = l instanceof Error ? l : new Error(String(l));
582
+ function $t(t, e, n, r) {
583
+ const a = qe(n, e, r), s = (i) => {
584
+ const u = i instanceof Error ? i : new Error(String(i));
585
585
  a.onError(u);
586
- }, o = Ve(e, n), c = () => {
587
- const l = {
586
+ }, o = Je(e, n), c = () => {
587
+ const i = {
588
588
  userAccountAddress: "",
589
589
  ...t
590
590
  };
591
- return e.account && (l.userAccountAddress = e.account.account.address), Ee.parse(l);
592
- }, i = async (l) => {
591
+ return e.account && (i.userAccountAddress = e.account.account.address), Ie.parse(i);
592
+ }, l = async (i) => {
593
593
  try {
594
- await l();
594
+ await i();
595
595
  } catch (u) {
596
596
  console.error(u), s(u), o({ isHuman: !1, showModal: !1, loading: !1 });
597
597
  }
598
598
  }, p = async () => {
599
- a.onOpen(), await i(async () => {
599
+ a.onOpen(), await l(async () => {
600
600
  if (e.loading || e.isHuman)
601
601
  return;
602
- D(), o({ loading: !0 });
603
- const l = c();
604
- o({ dappAccount: l.account.address }), await Ye(100);
605
- const u = await V(), h = await x();
602
+ L(), o({ loading: !0 });
603
+ const i = c();
604
+ o({ dappAccount: i.account.address }), await Qe(100);
605
+ const u = await Y(), h = await x();
606
606
  let y = !1;
607
607
  try {
608
- y = (await h.query.dappOperatorIsHumanUser(u.account.address, l.solutionThreshold)).value.unwrap().unwrap();
609
- } catch (T) {
608
+ y = (await h.query.dappOperatorIsHumanUser(u.account.address, i.solutionThreshold)).value.unwrap().unwrap();
609
+ } catch (N) {
610
610
  }
611
611
  if (y) {
612
612
  o({ isHuman: !0, loading: !1 }), a.onHuman({
613
613
  user: u.account.address,
614
- dapp: I()
614
+ dapp: T()
615
615
  }), W();
616
616
  return;
617
617
  }
618
- const C = B.getProviderUrl();
618
+ const C = K.getProviderUrl();
619
619
  let P;
620
620
  if (C) {
621
- P = await M(C);
621
+ P = await U(C);
622
622
  try {
623
- const T = await P.verifyDappUser(I(), u.account.address, void 0, t.challengeValidLength);
624
- if (T.verified) {
623
+ const N = await P.verifyDappUser(T(), u.account.address, void 0, t.challengeValidLength);
624
+ if (N.verified) {
625
625
  o({ isHuman: !0, loading: !1 });
626
- const ee = {
626
+ const te = {
627
627
  [$.providerUrl]: C,
628
628
  [$.user]: u.account.address,
629
- [$.dapp]: I(),
630
- [$.commitmentId]: ce(T.commitmentId),
631
- [$.blockNumber]: T.blockNumber
629
+ [$.dapp]: T(),
630
+ [$.commitmentId]: ce(N.commitmentId),
631
+ [$.blockNumber]: N.blockNumber
632
632
  };
633
- a.onHuman(ee), W();
633
+ a.onHuman(te), W();
634
634
  return;
635
635
  }
636
636
  } catch {
@@ -639,66 +639,66 @@ function Gt(t, e, n, r) {
639
639
  }
640
640
  const O = {
641
641
  address: u.account.address,
642
- data: qe("message"),
642
+ data: Ze("message"),
643
643
  type: "bytes"
644
644
  };
645
645
  await u.extension.signer.signRaw(O);
646
- const L = await le(h.query.getRandomActiveProvider, h.query)(u.account.address, I()), R = parseInt(L.blockNumber.toString()), Y = te(L.provider.url.toString());
647
- P = await M(Y);
648
- const F = await (await H(h, L, P)).getCaptchaChallenge();
646
+ const _ = await de(h.query.getRandomActiveProvider, h.query)(u.account.address, T()), R = parseInt(_.blockNumber.toString()), X = ne(_.provider.url.toString());
647
+ P = await U(X);
648
+ const F = await (await k(h, _, P)).getCaptchaChallenge();
649
649
  if (F.captchas.length <= 0)
650
- throw new re("DEVELOPER.PROVIDER_NO_CAPTCHA");
651
- const Z = F.captchas.map((T) => T.captcha.timeLimitMs || 30 * 1e3).reduce((T, ee) => T + ee), Ae = setTimeout(() => {
650
+ throw new oe("DEVELOPER.PROVIDER_NO_CAPTCHA");
651
+ const ee = F.captchas.map((N) => N.captcha.timeLimitMs || 30 * 1e3).reduce((N, te) => N + te), Ee = setTimeout(() => {
652
652
  a.onChallengeExpired(), o({ isHuman: !1, showModal: !1, loading: !1 });
653
- }, Z);
653
+ }, ee);
654
654
  o({
655
655
  index: 0,
656
656
  solutions: F.captchas.map(() => []),
657
657
  challenge: F,
658
658
  showModal: !0,
659
- timeout: Ae,
659
+ timeout: Ee,
660
660
  blockNumber: R
661
661
  });
662
662
  });
663
663
  }, w = async () => {
664
- await i(async () => {
665
- if (U(), !e.challenge)
664
+ await l(async () => {
665
+ if (M(), !e.challenge)
666
666
  throw new S("CAPTCHA.NO_CAPTCHA", {
667
667
  context: { error: "Cannot submit, no Captcha found in state" }
668
668
  });
669
669
  o({ showModal: !1 });
670
- const l = e.challenge, u = Xe(), h = e.challenge.captchas.map((G, F) => {
671
- const Z = g(e.solutions, F);
670
+ const i = e.challenge, u = et(), h = e.challenge.captchas.map((G, F) => {
671
+ const ee = g(e.solutions, F);
672
672
  return {
673
673
  captchaId: G.captcha.captchaId,
674
674
  captchaContentId: G.captcha.captchaContentId,
675
675
  salt: u,
676
- solution: Z
676
+ solution: ee
677
677
  };
678
- }), y = b(), C = _(), P = y.extension.signer, O = g(l.captchas, 0);
678
+ }), y = b(), C = H(), P = A(y).signer, O = g(i.captchas, 0);
679
679
  if (!O.captcha.datasetId)
680
680
  throw new z("CAPTCHA.INVALID_CAPTCHA_ID", {
681
681
  context: { error: "No datasetId set for challenge" }
682
682
  });
683
- const L = j(), R = await L.submitCaptchaSolution(P, l.requestHash, O.captcha.datasetId, h, u), Y = R[0].verified;
684
- if (Y || a.onFailed(), o({
683
+ const _ = j(), R = await _.submitCaptchaSolution(P, i.requestHash, O.captcha.datasetId, h, u), X = R[0].verified;
684
+ if (X || a.onFailed(), o({
685
685
  submission: R,
686
- isHuman: Y,
686
+ isHuman: X,
687
687
  loading: !1
688
688
  }), e.isHuman) {
689
- const G = te(L.provider.provider.url.toString());
690
- B.setProviderUrl(G), a.onHuman({
689
+ const G = ne(_.provider.provider.url.toString());
690
+ K.setProviderUrl(G), a.onHuman({
691
691
  providerUrl: G,
692
692
  user: y.account.address,
693
- dapp: I(),
693
+ dapp: T(),
694
694
  commitmentId: ce(R[1]),
695
695
  blockNumber: C
696
696
  }), W();
697
697
  }
698
698
  });
699
- }, E = async () => {
700
- U(), D(), a.onClose();
701
- }, m = (l) => {
699
+ }, I = async () => {
700
+ M(), L(), a.onClose();
701
+ }, m = (i) => {
702
702
  if (!e.challenge)
703
703
  throw new S("CAPTCHA.NO_CAPTCHA", {
704
704
  context: { error: "Cannot select, no Captcha found in state" }
@@ -708,8 +708,8 @@ function Gt(t, e, n, r) {
708
708
  context: { error: "Cannot select, index is out of range for this Captcha" }
709
709
  });
710
710
  const u = e.index, h = e.solutions, y = g(h, u);
711
- y.includes(l) ? y.splice(y.indexOf(l), 1) : y.push(l), o({ solutions: h });
712
- }, k = () => {
711
+ y.includes(i) ? y.splice(y.indexOf(i), 1) : y.push(i), o({ solutions: h });
712
+ }, D = () => {
713
713
  if (!e.challenge)
714
714
  throw new S("CAPTCHA.NO_CAPTCHA", {
715
715
  context: { error: "Cannot select, no Captcha found in state" }
@@ -719,68 +719,72 @@ function Gt(t, e, n, r) {
719
719
  context: { error: "Cannot select, index is out of range for this Captcha" }
720
720
  });
721
721
  o({ index: e.index + 1 });
722
- }, H = async (l, u, h) => {
723
- const y = c(), C = new _t(b().account.address, l, u, h, y.web2, I());
722
+ }, k = async (i, u, h) => {
723
+ const y = c(), C = new Wt(b().account.address, i, u, h, y.web2, T());
724
724
  return o({ captchaApi: C }), j();
725
- }, M = async (l) => {
726
- const u = c(), h = me(u);
725
+ }, U = async (i) => {
726
+ const u = c(), h = we(u);
727
727
  if (!u.account.address)
728
- throw new A("GENERAL.SITE_KEY_MISSING");
729
- return new Je(h, l, u.account.address);
730
- }, U = () => {
728
+ throw new v("GENERAL.SITE_KEY_MISSING");
729
+ return new tt(h, i, u.account.address);
730
+ }, M = () => {
731
731
  window.clearTimeout(e.timeout), o({ timeout: void 0 });
732
732
  }, W = () => {
733
- const l = t.challengeValidLength || 12e4, u = setTimeout(() => {
733
+ const i = t.challengeValidLength || 12e4, u = setTimeout(() => {
734
734
  o({ isHuman: !1 }), a.onExpired();
735
- }, l);
735
+ }, i);
736
736
  o({ successfullChallengeTimeout: u });
737
- }, D = () => {
738
- U(), o(jt());
737
+ }, L = () => {
738
+ M(), o(Bt());
739
739
  }, j = () => {
740
740
  if (!e.captchaApi)
741
- throw new re("API.UNKNOWN", { context: { error: "Captcha api not set", state: e } });
741
+ throw new oe("API.UNKNOWN", { context: { error: "Captcha api not set", state: e } });
742
742
  return e.captchaApi;
743
- }, V = async () => {
744
- const l = c();
745
- if (!l.web2 && !l.userAccountAddress)
746
- throw new A("GENERAL.ACCOUNT_NOT_FOUND", {
743
+ }, Y = async () => {
744
+ const i = c();
745
+ if (!i.web2 && !i.userAccountAddress)
746
+ throw new v("GENERAL.ACCOUNT_NOT_FOUND", {
747
747
  context: { error: "Account address has not been set for web3 mode" }
748
748
  });
749
- const h = await (l.web2 ? new Qe() : new It()).getAccount(l);
750
- return B.setAccount(h.account.address), o({ account: h }), b();
749
+ const h = await (i.web2 ? new nt() : new Pt()).getAccount(i);
750
+ return K.setAccount(h.account.address), o({ account: h }), b();
751
751
  }, b = () => {
752
752
  if (!e.account)
753
- throw new A("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
753
+ throw new v("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
754
754
  return e.account;
755
- }, I = () => {
755
+ }, T = () => {
756
756
  if (!e.dappAccount)
757
- throw new A("GENERAL.SITE_KEY_MISSING");
757
+ throw new v("GENERAL.SITE_KEY_MISSING");
758
758
  return e.dappAccount;
759
- }, _ = () => {
759
+ }, H = () => {
760
760
  if (!e.blockNumber)
761
- throw new Ze("CAPTCHA.INVALID_BLOCK_NO", { context: { error: "Block number not found" } });
761
+ throw new rt("CAPTCHA.INVALID_BLOCK_NO", { context: { error: "Block number not found" } });
762
762
  return e.blockNumber;
763
+ }, A = (i) => {
764
+ if (i = i || b(), !i.extension)
765
+ throw new v("ACCOUNT.NO_POLKADOT_EXTENSION", { context: { error: "Extension not loaded" } });
766
+ return i.extension;
763
767
  }, x = async () => {
764
- const l = c(), u = me(l), h = await et.create({ provider: new tt(u.endpoint), initWasm: !1 }), y = "sr25519", C = new nt({ type: y, ss58Format: h.registry.chainSS58 });
765
- return new rt(h, JSON.parse(ot), u.contract.address, "prosopo", 0, C.addFromAddress(b().account.address));
768
+ const i = c(), u = we(i), h = await ot.create({ provider: new at(u.endpoint), initWasm: !1 }), y = "sr25519", C = new st({ type: y, ss58Format: h.registry.chainSS58 });
769
+ return new it(h, JSON.parse(ct), u.contract.address, "prosopo", 0, C.addFromAddress(b().account.address));
766
770
  };
767
771
  return {
768
772
  start: p,
769
- cancel: E,
773
+ cancel: I,
770
774
  submit: w,
771
775
  select: m,
772
- nextRound: k,
773
- exportData: async (l) => {
776
+ nextRound: D,
777
+ exportData: async (i) => {
774
778
  var P;
775
- const u = B.getProviderUrl();
779
+ const u = K.getProviderUrl();
776
780
  let h;
777
781
  if (u)
778
- h = await M(u);
782
+ h = await U(u);
779
783
  else {
780
- const O = await x(), L = await le(O.query.getRandomActiveProvider, O.query)(b().account.address, I()), R = te(L.provider.url.toString());
781
- h = await M(R);
784
+ const O = await x(), _ = await de(O.query.getRandomActiveProvider, O.query)(b().account.address, T()), R = ne(_.provider.url.toString());
785
+ h = await U(R);
782
786
  }
783
- if (!(B.getProviderUrl() || ((P = e.captchaApi) == null ? void 0 : P.provider.provider.url.toString())))
787
+ if (!(K.getProviderUrl() || ((P = e.captchaApi) == null ? void 0 : P.provider.provider.url.toString())))
784
788
  return;
785
789
  let C = "";
786
790
  try {
@@ -788,40 +792,40 @@ function Gt(t, e, n, r) {
788
792
  } catch (O) {
789
793
  console.error(O);
790
794
  }
791
- await h.submitUserEvents(l, C);
795
+ await h.submitUserEvents(i, C);
792
796
  }
793
797
  };
794
798
  }
795
- const Ft = 1e4, se = (t, e) => {
799
+ const Kt = 1e4, ie = (t, e) => {
796
800
  e((n) => {
797
801
  let r = [...n, t];
798
- return r.length > Ft && (r = r.slice(1)), r;
802
+ return r.length > Kt && (r = r.slice(1)), r;
799
803
  });
800
- }, zt = (t, e) => {
804
+ }, Vt = (t, e) => {
801
805
  const n = {
802
806
  x: t.x,
803
807
  y: t.y,
804
808
  timestamp: t.timeStamp
805
809
  };
806
- se(n, e);
807
- }, we = (t, e) => {
810
+ ie(n, e);
811
+ }, ye = (t, e) => {
808
812
  const n = {
809
813
  key: t.key,
810
814
  timestamp: t.timeStamp,
811
815
  isShiftKey: t.shiftKey,
812
816
  isCtrlKey: t.ctrlKey
813
817
  };
814
- se(n, e);
818
+ ie(n, e);
815
819
  }, q = (t, e) => {
816
820
  for (const n of Array.from(t.touches))
817
- se({ x: n.clientX, y: n.clientY, timestamp: t.timeStamp }, e);
818
- }, $t = (t, e, n, r) => {
819
- const a = ve(r);
820
- a && (a.addEventListener("mousemove", (s) => zt(s, t)), a.addEventListener("keydown", (s) => we(s, n)), a.addEventListener("keyup", (s) => we(s, n)), a.addEventListener("touchstart", (s) => q(s, e)), a.addEventListener("touchend", (s) => q(s, e)), a.addEventListener("touchcancel", (s) => q(s, e)), a.addEventListener("touchmove", (s) => q(s, e)));
821
- }, ve = (t) => t.tagName === "FORM" ? t : t.parentElement ? ve(t.parentElement) : null, Bt = ({ onProcessData: t, sendData: e, account: n }) => {
822
- const [r, a] = f.useState([]), [s, o] = f.useState([]), [c, i] = f.useState([]), p = f.useRef(null);
821
+ ie({ x: n.clientX, y: n.clientY, timestamp: t.timeStamp }, e);
822
+ }, Yt = (t, e, n, r) => {
823
+ const a = Ae(r);
824
+ a && (a.addEventListener("mousemove", (s) => Vt(s, t)), a.addEventListener("keydown", (s) => ye(s, n)), a.addEventListener("keyup", (s) => ye(s, n)), a.addEventListener("touchstart", (s) => q(s, e)), a.addEventListener("touchend", (s) => q(s, e)), a.addEventListener("touchcancel", (s) => q(s, e)), a.addEventListener("touchmove", (s) => q(s, e)));
825
+ }, Ae = (t) => t.tagName === "FORM" ? t : t.parentElement ? Ae(t.parentElement) : null, Xt = ({ onProcessData: t, sendData: e, account: n }) => {
826
+ const [r, a] = f.useState([]), [s, o] = f.useState([]), [c, l] = f.useState([]), p = f.useRef(null);
823
827
  return f.useEffect(() => {
824
- p && p.current && $t(a, o, i, p.current);
828
+ p && p.current && Yt(a, o, l, p.current);
825
829
  }, []), f.useEffect(() => {
826
830
  n && t({
827
831
  mouseEvents: r,
@@ -829,7 +833,7 @@ const Ft = 1e4, se = (t, e) => {
829
833
  keyboardEvents: c
830
834
  });
831
835
  }, [e, n]), d("div", { ref: p });
832
- }, Kt = Bt, Vt = Ie.memo((t, e) => {
836
+ }, qt = Xt, Jt = Te.memo((t, e) => {
833
837
  const { show: n, children: r } = t, s = {
834
838
  position: "fixed",
835
839
  zIndex: 2147483646,
@@ -856,25 +860,25 @@ const Ft = 1e4, se = (t, e) => {
856
860
  border: "none",
857
861
  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,"
858
862
  };
859
- return v("div", { className: "modalOuter", style: s, children: [d("div", { className: "modalBackground", style: o }), d("div", { className: "modalInner", style: c, children: r })] });
860
- }), Yt = Vt, Jt = (t) => {
861
- const e = t.config, n = t.callbacks || {}, [r, a] = at(f.useState, f.useRef), s = Gt(e, r, a, n), o = t.config.theme === "light" ? "light" : "dark", c = t.config.theme === "light" ? J : Q;
862
- return d("div", { children: v("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: [d(Yt, { show: r.showModal, children: r.challenge ? d(xt, { challenge: r.challenge, index: r.index, solutions: r.solutions, onSubmit: s.submit, onCancel: s.cancel, onClick: s.select, onNext: s.nextRound, themeColor: e.theme ?? "light" }) : d("div", { children: "No challenge set." }) }), v(Ne, { children: [d(Te, { children: v("div", { style: Se, "data-cy": "button-human", children: [" ", v("div", { style: {
863
- padding: "2px",
864
- border: "1px solid",
863
+ return E("div", { className: "modalOuter", style: s, children: [d("div", { className: "modalBackground", style: o }), d("div", { className: "modalInner", style: c, children: r })] });
864
+ }), Qt = Jt, tn = (t) => {
865
+ const e = t.config, n = t.callbacks || {}, [r, a] = lt(f.useState, f.useRef), s = $t(e, r, a, n), o = t.config.theme === "light" ? "light" : "dark", c = t.config.theme === "light" ? Q : Z;
866
+ return d("div", { children: E("div", { style: { maxWidth: "100%", maxHeight: "100%", overflowX: "auto" }, children: [d(Qt, { show: r.showModal, children: r.challenge ? d(It, { challenge: r.challenge, index: r.index, solutions: r.solutions, onSubmit: s.submit, onCancel: s.cancel, onClick: s.select, onNext: s.nextRound, themeColor: e.theme ?? "light" }) : d("div", { children: "No challenge set." }) }), E(Ne, { children: [d(Se, { children: E("div", { style: Pe, "data-cy": "button-human", children: [" ", E("div", { style: {
867
+ padding: Oe,
868
+ border: De,
865
869
  backgroundColor: c.palette.background.default,
866
870
  borderColor: c.palette.grey[300],
867
- borderRadius: "8px",
871
+ borderRadius: _e,
868
872
  display: "flex",
869
873
  alignItems: "center",
870
874
  flexWrap: "wrap",
871
875
  justifyContent: "space-between",
872
- minHeight: `${Pe}px`,
876
+ minHeight: `${ke}px`,
873
877
  overflow: "hidden"
874
878
  }, children: [d("div", { style: { display: "inline-flex", flexDirection: "column" }, children: d("div", { style: {
875
879
  alignItems: "center",
876
880
  flex: 1
877
- }, children: v("div", { style: {
881
+ }, children: E("div", { style: {
878
882
  display: "flex",
879
883
  alignItems: "center",
880
884
  justifyContent: "center",
@@ -882,10 +886,10 @@ const Ft = 1e4, se = (t, e) => {
882
886
  verticalAlign: "middle"
883
887
  }, children: [d("div", { style: {
884
888
  display: r.loading ? "none" : "flex"
885
- }, children: d(st, { themeColor: o, onChange: s.start, checked: r.isHuman, labelText: "I am human" }) }), d("div", { style: {
889
+ }, children: d(dt, { themeColor: o, onChange: s.start, checked: r.isHuman, labelText: "I am human" }) }), d("div", { style: {
886
890
  display: r.loading ? "flex" : "none"
887
- }, children: d("div", { style: { display: "inline-flex" }, children: d(Oe, { themeColor: o }) }) })] }) }) }), d("div", { style: { display: "inline-flex", flexDirection: "column" }, children: d("a", { href: ke, target: "_blank", "aria-label": Le, children: d("div", { style: { flex: 1 }, children: d(He, { themeColor: o }) }) }) })] })] }) }), e.devOnlyWatchEvents && d(Kt, { onProcessData: s.exportData, sendData: r.sendData, account: r.account })] })] }) });
891
+ }, children: d("div", { style: { display: "inline-flex" }, children: d(Le, { themeColor: o }) }) })] }) }) }), d("div", { style: { display: "inline-flex", flexDirection: "column" }, children: d("a", { href: He, target: "_blank", "aria-label": Re, children: d("div", { style: { flex: 1 }, children: d(Ue, { themeColor: o }) }) }) })] })] }) }), e.devOnlyWatchEvents && d(qt, { onProcessData: s.exportData, sendData: r.sendData, account: r.account })] })] }) });
888
892
  };
889
893
  export {
890
- Jt as default
894
+ tn as default
891
895
  };