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