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