@prosopo/procaptcha-bundle 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1 -4
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
- package/dist/bundle/{ProcaptchaWidget-Bk0Iiawd.js → ProcaptchaWidget-BzBkw8-_.js} +285 -297
- package/dist/bundle/ProcaptchaWidget-nO3NsM0R.js +155 -0
- package/dist/bundle/{index-DvT5XLGE.js → index-DsnIPyZG.js} +3222 -3273
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/procaptcha.bundle.js +1 -1
- package/dist/bundle/{utils-nH-g73b2.js → utils-Cpz4o_0n.js} +4290 -3878
- package/dist/cjs/index.cjs +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/package.json +59 -59
- package/stats.html +1 -1
- package/vite.config.ts +26 -24
- package/dist/bundle/ProcaptchaWidget-CtdNKhRb.js +0 -166
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { r as m, z, a as
|
|
2
|
-
import { u as
|
|
3
|
-
function
|
|
4
|
-
return
|
|
1
|
+
import { r as m, z as j, a as b, e as ue, A as w, P as oe, l as B, d as U, j as l, b as A, R as pe, W as he, C as fe, c as ge, f as me, g as xe, h as be, i as ye, k as Ce, L as we, m as Ae, n as ve, o as Te } from "./index-DsnIPyZG.js";
|
|
2
|
+
import { u as Ie, h as Ee, _ as Se, a as Ne, b as Pe, I as De, R as Oe, g as He, c as Re, d as Le, i as _e, e as q, P as T, f as P, j as k, s as re, k as ke, l as Me, m as We, n as Ge, r as je, o as ze, p as Be, E as Ue, q as $e, t as Fe, C as Ke } from "./utils-Cpz4o_0n.js";
|
|
3
|
+
function Ve(t) {
|
|
4
|
+
return Ie(Ee(t));
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function qe() {
|
|
7
7
|
if (console && console.warn) {
|
|
8
8
|
for (var t, e = arguments.length, n = new Array(e), o = 0; o < e; o++)
|
|
9
9
|
n[o] = arguments[o];
|
|
10
10
|
typeof n[0] == "string" && (n[0] = "react-i18next:: ".concat(n[0])), (t = console).warn.apply(t, n);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
function
|
|
13
|
+
var Z = {};
|
|
14
|
+
function X() {
|
|
15
15
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
16
16
|
e[n] = arguments[n];
|
|
17
|
-
typeof e[0] == "string" &&
|
|
17
|
+
typeof e[0] == "string" && Z[e[0]] || (typeof e[0] == "string" && (Z[e[0]] = /* @__PURE__ */ new Date()), qe.apply(void 0, e));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Q(t, e, n) {
|
|
20
20
|
t.loadNamespaces(e, function() {
|
|
21
21
|
if (t.isInitialized)
|
|
22
22
|
n();
|
|
@@ -30,48 +30,48 @@ function ne(t, e, n) {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Xe(t, e) {
|
|
34
34
|
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o = e.languages[0], a = e.options ? e.options.fallbackLng : !1, r = e.languages[e.languages.length - 1];
|
|
35
35
|
if (o.toLowerCase() === "cimode") return !0;
|
|
36
|
-
var i = function(s,
|
|
37
|
-
var
|
|
38
|
-
return
|
|
36
|
+
var i = function(s, f) {
|
|
37
|
+
var g = e.services.backendConnector.state["".concat(s, "|").concat(f)];
|
|
38
|
+
return g === -1 || g === 2;
|
|
39
39
|
};
|
|
40
40
|
return n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && e.services.backendConnector.backend && e.isLanguageChangingTo && !i(e.isLanguageChangingTo, t) ? !1 : !!(e.hasResourceBundle(o, t) || !e.services.backendConnector.backend || e.options.resources && !e.options.partialBundledLanguages || i(o, t) && (!a || i(r, t)));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Ye(t, e) {
|
|
43
43
|
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
44
44
|
if (!e.languages || !e.languages.length)
|
|
45
|
-
return
|
|
45
|
+
return X("i18n.languages were undefined or empty", e.languages), !0;
|
|
46
46
|
var o = e.options.ignoreJSONStructure !== void 0;
|
|
47
47
|
return o ? e.hasLoadedNamespace(t, {
|
|
48
48
|
precheck: function(r, i) {
|
|
49
49
|
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && r.services.backendConnector.backend && r.isLanguageChangingTo && !i(r.isLanguageChangingTo, t)) return !1;
|
|
50
50
|
}
|
|
51
|
-
}) :
|
|
51
|
+
}) : Xe(t, e, n);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Je(t, e) {
|
|
54
54
|
var n = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
55
55
|
if (n != null) {
|
|
56
|
-
var o, a, r, i,
|
|
56
|
+
var o, a, r, i, d = [], s = !0, f = !1;
|
|
57
57
|
try {
|
|
58
|
-
if (r = (n = n.call(t)).next, e !== 0) for (; !(s = (o = r.call(n)).done) && (
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
58
|
+
if (r = (n = n.call(t)).next, e !== 0) for (; !(s = (o = r.call(n)).done) && (d.push(o.value), d.length !== e); s = !0) ;
|
|
59
|
+
} catch (g) {
|
|
60
|
+
f = !0, a = g;
|
|
61
61
|
} finally {
|
|
62
62
|
try {
|
|
63
63
|
if (!s && n.return != null && (i = n.return(), Object(i) !== i)) return;
|
|
64
64
|
} finally {
|
|
65
|
-
if (
|
|
65
|
+
if (f) throw a;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return d;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
return
|
|
71
|
+
function Ze(t, e) {
|
|
72
|
+
return Se(t) || Je(t, e) || Ne(t, e) || Pe();
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function ee(t, e) {
|
|
75
75
|
var n = Object.keys(t);
|
|
76
76
|
if (Object.getOwnPropertySymbols) {
|
|
77
77
|
var o = Object.getOwnPropertySymbols(t);
|
|
@@ -81,117 +81,117 @@ function oe(t, e) {
|
|
|
81
81
|
}
|
|
82
82
|
return n;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function F(t) {
|
|
85
85
|
for (var e = 1; e < arguments.length; e++) {
|
|
86
86
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
87
|
-
e % 2 ?
|
|
88
|
-
|
|
89
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) :
|
|
87
|
+
e % 2 ? ee(Object(n), !0).forEach(function(o) {
|
|
88
|
+
Re(t, o, n[o]);
|
|
89
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ee(Object(n)).forEach(function(o) {
|
|
90
90
|
Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
return t;
|
|
94
94
|
}
|
|
95
|
-
var
|
|
95
|
+
var Qe = function(e, n) {
|
|
96
96
|
var o = m.useRef();
|
|
97
97
|
return m.useEffect(function() {
|
|
98
98
|
o.current = e;
|
|
99
99
|
}, [e, n]), o.current;
|
|
100
100
|
};
|
|
101
|
-
function
|
|
102
|
-
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, o = m.useContext(De) || {}, a = o.i18n, r = n || a ||
|
|
103
|
-
if (r && !r.reportNamespaces && (r.reportNamespaces = new
|
|
104
|
-
|
|
105
|
-
var i = function(
|
|
106
|
-
return Array.isArray(
|
|
107
|
-
},
|
|
108
|
-
return
|
|
101
|
+
function et(t) {
|
|
102
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = e.i18n, o = m.useContext(De) || {}, a = o.i18n, r = n || a || Le();
|
|
103
|
+
if (r && !r.reportNamespaces && (r.reportNamespaces = new Oe()), !r) {
|
|
104
|
+
X("You will need to pass in an i18next instance by using initReactI18next");
|
|
105
|
+
var i = function(h) {
|
|
106
|
+
return Array.isArray(h) ? h[h.length - 1] : h;
|
|
107
|
+
}, d = [i, {}, !1];
|
|
108
|
+
return d.t = i, d.i18n = {}, d.ready = !1, d;
|
|
109
109
|
}
|
|
110
|
-
r.options.react && r.options.react.wait !== void 0 &&
|
|
111
|
-
var s =
|
|
112
|
-
|
|
113
|
-
var
|
|
114
|
-
return
|
|
110
|
+
r.options.react && r.options.react.wait !== void 0 && X("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
111
|
+
var s = F(F(F({}, He()), r.options.react), e), f = s.useSuspense, g = s.keyPrefix, u = t;
|
|
112
|
+
u = typeof u == "string" ? [u] : u || ["translation"], r.reportNamespaces.addUsedNamespaces && r.reportNamespaces.addUsedNamespaces(u);
|
|
113
|
+
var y = (r.isInitialized || r.initializedStoreOnce) && u.every(function(p) {
|
|
114
|
+
return Ye(p, r, s);
|
|
115
115
|
});
|
|
116
|
-
function
|
|
117
|
-
return r.getFixedT(null, s.nsMode === "fallback" ?
|
|
116
|
+
function C() {
|
|
117
|
+
return r.getFixedT(null, s.nsMode === "fallback" ? u : u[0], g);
|
|
118
118
|
}
|
|
119
|
-
var
|
|
119
|
+
var R = m.useState(C), D = Ze(R, 2), M = D[0], S = D[1], L = u.join(), O = Qe(L), I = m.useRef(!0);
|
|
120
120
|
m.useEffect(function() {
|
|
121
|
-
var
|
|
122
|
-
I.current = !0, !
|
|
123
|
-
I.current &&
|
|
124
|
-
}),
|
|
125
|
-
function
|
|
126
|
-
I.current &&
|
|
121
|
+
var p = s.bindI18n, h = s.bindI18nStore;
|
|
122
|
+
I.current = !0, !y && !f && Q(r, u, function() {
|
|
123
|
+
I.current && S(C);
|
|
124
|
+
}), y && O && O !== L && I.current && S(C);
|
|
125
|
+
function x() {
|
|
126
|
+
I.current && S(C);
|
|
127
127
|
}
|
|
128
|
-
return
|
|
129
|
-
I.current = !1,
|
|
130
|
-
return r.off(
|
|
131
|
-
}),
|
|
132
|
-
return r.store.off(
|
|
128
|
+
return p && r && r.on(p, x), h && r && r.store.on(h, x), function() {
|
|
129
|
+
I.current = !1, p && r && p.split(" ").forEach(function(v) {
|
|
130
|
+
return r.off(v, x);
|
|
131
|
+
}), h && r && h.split(" ").forEach(function(v) {
|
|
132
|
+
return r.store.off(v, x);
|
|
133
133
|
});
|
|
134
134
|
};
|
|
135
135
|
}, [r, L]);
|
|
136
136
|
var W = m.useRef(!0);
|
|
137
137
|
m.useEffect(function() {
|
|
138
|
-
I.current && !W.current &&
|
|
139
|
-
}, [r,
|
|
140
|
-
var
|
|
141
|
-
if (
|
|
142
|
-
throw new Promise(function(
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
I.current && !W.current && S(C), W.current = !1;
|
|
139
|
+
}, [r, g]);
|
|
140
|
+
var c = [M, r, y];
|
|
141
|
+
if (c.t = M, c.i18n = r, c.ready = y, y || !y && !f) return c;
|
|
142
|
+
throw new Promise(function(p) {
|
|
143
|
+
Q(r, u, function() {
|
|
144
|
+
p();
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
148
|
+
function tt(t) {
|
|
149
|
+
return et("translation", { i18n: _e, ...t });
|
|
150
150
|
}
|
|
151
|
-
const
|
|
151
|
+
const nt = (t) => Array.isArray(t) && t !== null, z = new Array(256), ae = new Array(256 * 256);
|
|
152
152
|
for (let t = 0; t < 256; t++)
|
|
153
|
-
|
|
153
|
+
z[t] = t.toString(16).padStart(2, "0");
|
|
154
154
|
for (let t = 0; t < 256; t++) {
|
|
155
155
|
const e = t << 8;
|
|
156
156
|
for (let n = 0; n < 256; n++)
|
|
157
|
-
|
|
157
|
+
ae[e | n] = z[t] + z[n];
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function K(t, e) {
|
|
160
160
|
const n = t.length % 2 | 0, o = t.length - n | 0;
|
|
161
161
|
for (let a = 0; a < o; a += 2)
|
|
162
|
-
e +=
|
|
163
|
-
return n && (e +=
|
|
162
|
+
e += ae[t[a] << 8 | t[a + 1]];
|
|
163
|
+
return n && (e += z[t[o] | 0]), e;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function ot(t, e = -1, n = !0) {
|
|
166
166
|
const o = n ? "0x" : "";
|
|
167
167
|
if (!(t != null && t.length))
|
|
168
168
|
return o;
|
|
169
169
|
if (e > 0) {
|
|
170
170
|
const a = Math.ceil(e / 8);
|
|
171
171
|
if (t.length > a)
|
|
172
|
-
return `${
|
|
172
|
+
return `${K(t.subarray(0, a / 2), o)}…${K(t.subarray(t.length - a / 2), "")}`;
|
|
173
173
|
}
|
|
174
|
-
return
|
|
174
|
+
return K(t, o);
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
account:
|
|
178
|
-
blockNumber:
|
|
179
|
-
providerUrl:
|
|
176
|
+
const rt = (t) => nt(t) ? ot(new Uint8Array(t)) : t.toString(), ie = j.object({
|
|
177
|
+
account: j.string().optional(),
|
|
178
|
+
blockNumber: j.number().optional(),
|
|
179
|
+
providerUrl: j.string().optional()
|
|
180
180
|
});
|
|
181
|
-
function
|
|
182
|
-
return
|
|
181
|
+
function at(t) {
|
|
182
|
+
return q([
|
|
183
183
|
t.captchaId,
|
|
184
184
|
t.captchaContentId,
|
|
185
185
|
[...t.solution].sort(),
|
|
186
186
|
t.salt
|
|
187
187
|
]);
|
|
188
188
|
}
|
|
189
|
-
class
|
|
189
|
+
class te {
|
|
190
190
|
constructor(e) {
|
|
191
191
|
this.hash = e, this.parent = null;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class it {
|
|
195
195
|
constructor() {
|
|
196
196
|
this.leaves = [], this.layers = [];
|
|
197
197
|
}
|
|
@@ -209,7 +209,7 @@ class ct {
|
|
|
209
209
|
this.layers.length && (this.layers = []);
|
|
210
210
|
const n = [];
|
|
211
211
|
for (const o of e) {
|
|
212
|
-
const a = new
|
|
212
|
+
const a = new te(o);
|
|
213
213
|
this.leaves.push(a), n.push(a.hash);
|
|
214
214
|
}
|
|
215
215
|
this.layers.push(n), this.root = this.buildMerkleTree(this.leaves)[0];
|
|
@@ -227,13 +227,13 @@ class ct {
|
|
|
227
227
|
throw new T("DEVELOPER.GENERAL", {
|
|
228
228
|
context: { error: "leftChild undefined" }
|
|
229
229
|
});
|
|
230
|
-
const
|
|
230
|
+
const d = a + 1 < n ? b(e, a + 1) : i, s = this.createParent(i, d);
|
|
231
231
|
r.push(s.hash), o.push(s), a += 2;
|
|
232
232
|
}
|
|
233
233
|
return this.layers.push(r), this.buildMerkleTree(o);
|
|
234
234
|
}
|
|
235
235
|
createParent(e, n) {
|
|
236
|
-
const o = new
|
|
236
|
+
const o = new te(q([e.hash, n.hash]));
|
|
237
237
|
return e.parent = o.hash, n.parent = o.hash, o;
|
|
238
238
|
}
|
|
239
239
|
proof(e) {
|
|
@@ -250,18 +250,18 @@ class ct {
|
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
const i = r.indexOf(e);
|
|
253
|
-
let
|
|
254
|
-
|
|
255
|
-
const s = [e],
|
|
256
|
-
|
|
253
|
+
let d = i % 2 && i > 0 ? i - 1 : i + 1;
|
|
254
|
+
d > r.length - 1 && (d = i);
|
|
255
|
+
const s = [e], f = b(r, d);
|
|
256
|
+
d > i ? s.push(f) : s.unshift(f), n.push([b(s, 0), b(s, 1)]), o += 1, e = q(s);
|
|
257
257
|
}
|
|
258
|
-
const a =
|
|
259
|
-
return [...n, [
|
|
258
|
+
const a = b(this.layers, this.layers.length - 1);
|
|
259
|
+
return [...n, [b(a, 0)]];
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
class
|
|
263
|
-
constructor(e, n, o, a, r
|
|
264
|
-
this.userAccount = e, this.
|
|
262
|
+
class st {
|
|
263
|
+
constructor(e, n, o, a, r) {
|
|
264
|
+
this.userAccount = e, this.provider = n, this.providerApi = o, this._web2 = a, this.dappAccount = r;
|
|
265
265
|
}
|
|
266
266
|
get web2() {
|
|
267
267
|
return this._web2;
|
|
@@ -274,60 +274,48 @@ class lt {
|
|
|
274
274
|
o.data && (o.data = o.data.replace(/^http(s)*:\/\//, "//"));
|
|
275
275
|
return e;
|
|
276
276
|
} catch (e) {
|
|
277
|
-
throw new
|
|
277
|
+
throw new P("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
278
278
|
context: { error: e }
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
async submitCaptchaSolution(e, n, o, a, r
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
285
|
-
throw new
|
|
282
|
+
async submitCaptchaSolution(e, n, o, a, r) {
|
|
283
|
+
const i = new it(), d = o.map((u) => at(u));
|
|
284
|
+
if (i.build(d), !i.root)
|
|
285
|
+
throw new k("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
286
286
|
context: { error: "Merkle tree root is undefined" }
|
|
287
287
|
});
|
|
288
|
-
const
|
|
289
|
-
let
|
|
290
|
-
if (!e || !e.signRaw)
|
|
291
|
-
throw new S("GENERAL.CANT_FIND_KEYRINGPAIR", {
|
|
292
|
-
context: {
|
|
293
|
-
error: "Signer is not defined, cannot sign message to prove account ownership"
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
let f;
|
|
297
|
-
p = (await e.signRaw({
|
|
298
|
-
address: this.userAccount,
|
|
299
|
-
data: ce(n),
|
|
300
|
-
type: "bytes"
|
|
301
|
-
})).signature;
|
|
288
|
+
const s = i.root.hash, f = void 0;
|
|
289
|
+
let g;
|
|
302
290
|
try {
|
|
303
|
-
|
|
304
|
-
} catch (
|
|
305
|
-
throw new
|
|
306
|
-
context: { error:
|
|
291
|
+
g = await this.providerApi.submitCaptchaSolution(o, n, this.userAccount, a, r, e);
|
|
292
|
+
} catch (u) {
|
|
293
|
+
throw new k("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
294
|
+
context: { error: u }
|
|
307
295
|
});
|
|
308
296
|
}
|
|
309
|
-
return [
|
|
297
|
+
return [g, s, f];
|
|
310
298
|
}
|
|
311
299
|
}
|
|
312
|
-
const
|
|
313
|
-
function
|
|
314
|
-
return
|
|
300
|
+
const se = "@prosopo/procaptcha";
|
|
301
|
+
function J() {
|
|
302
|
+
return ie.parse(JSON.parse(Ve(localStorage.getItem(se) || "0x7b7d")));
|
|
315
303
|
}
|
|
316
|
-
function
|
|
317
|
-
localStorage.setItem(
|
|
304
|
+
function ce(t) {
|
|
305
|
+
localStorage.setItem(se, re(JSON.stringify(ie.parse(t))));
|
|
318
306
|
}
|
|
319
|
-
function
|
|
320
|
-
|
|
307
|
+
function ct(t) {
|
|
308
|
+
ce({ ...J(), account: t });
|
|
321
309
|
}
|
|
322
|
-
function
|
|
323
|
-
return
|
|
310
|
+
function lt() {
|
|
311
|
+
return J().account || null;
|
|
324
312
|
}
|
|
325
|
-
const
|
|
326
|
-
setAccount:
|
|
327
|
-
getAccount:
|
|
328
|
-
setProcaptchaStorage:
|
|
329
|
-
getProcaptchaStorage:
|
|
330
|
-
},
|
|
313
|
+
const V = {
|
|
314
|
+
setAccount: ct,
|
|
315
|
+
getAccount: lt,
|
|
316
|
+
setProcaptchaStorage: ce,
|
|
317
|
+
getProcaptchaStorage: J
|
|
318
|
+
}, dt = () => ({
|
|
331
319
|
showModal: !1,
|
|
332
320
|
loading: !1,
|
|
333
321
|
index: 0,
|
|
@@ -336,121 +324,121 @@ const Y = {
|
|
|
336
324
|
isHuman: !1,
|
|
337
325
|
captchaApi: void 0,
|
|
338
326
|
account: void 0
|
|
339
|
-
}),
|
|
340
|
-
const e =
|
|
341
|
-
if (!e)
|
|
342
|
-
throw new S("DEVELOPER.NETWORK_NOT_FOUND", {
|
|
343
|
-
context: {
|
|
344
|
-
error: `No network found for environment ${t.defaultEnvironment}`
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
return e;
|
|
348
|
-
}, ht = (t) => {
|
|
349
|
-
const e = (a, r) => Math.floor(Math.random() * (r - a + 1) + a), n = Ke(t.defaultEnvironment), o = C(n, e(0, n.length - 1));
|
|
327
|
+
}), ut = (t) => {
|
|
328
|
+
const e = (a, r) => Math.floor(Math.random() * (r - a + 1) + a), n = Be(t.defaultEnvironment), o = b(n, e(0, n.length - 1));
|
|
350
329
|
return {
|
|
351
330
|
providerAccount: o.address,
|
|
352
331
|
provider: {
|
|
353
332
|
url: o.url,
|
|
354
333
|
datasetId: o.datasetId,
|
|
355
334
|
datasetIdContent: o.datasetIdContent
|
|
356
|
-
}
|
|
357
|
-
blockNumber: 0
|
|
335
|
+
}
|
|
358
336
|
};
|
|
359
337
|
};
|
|
360
|
-
function
|
|
361
|
-
const a =
|
|
362
|
-
const
|
|
363
|
-
a.onError(
|
|
364
|
-
}, i =
|
|
338
|
+
function pt(t, e, n, o) {
|
|
339
|
+
const a = ke(n, e, o), r = (c) => {
|
|
340
|
+
const p = c instanceof Error ? c : new Error(String(c));
|
|
341
|
+
a.onError(p);
|
|
342
|
+
}, i = Me(e, n), d = () => {
|
|
365
343
|
const c = {
|
|
366
344
|
userAccountAddress: "",
|
|
367
345
|
...t
|
|
368
346
|
};
|
|
369
|
-
return e.account && (c.userAccountAddress = e.account.account.address),
|
|
347
|
+
return e.account && (c.userAccountAddress = e.account.account.address), oe.parse(c);
|
|
370
348
|
}, s = async (c) => {
|
|
371
349
|
try {
|
|
372
350
|
await c();
|
|
373
|
-
} catch (
|
|
374
|
-
console.error(
|
|
351
|
+
} catch (p) {
|
|
352
|
+
console.error(p), r(p), i({ isHuman: !1, showModal: !1, loading: !1 });
|
|
375
353
|
}
|
|
376
|
-
},
|
|
354
|
+
}, f = async () => {
|
|
377
355
|
a.onOpen(), await s(async () => {
|
|
378
356
|
if (e.loading || e.isHuman)
|
|
379
357
|
return;
|
|
380
|
-
await
|
|
381
|
-
const c =
|
|
382
|
-
i({ dappAccount: c.account.address }), await
|
|
383
|
-
const
|
|
384
|
-
i({ captchaApi:
|
|
385
|
-
const E = await
|
|
358
|
+
await We(), S(), i({ loading: !0 });
|
|
359
|
+
const c = d();
|
|
360
|
+
i({ dappAccount: c.account.address }), await Ge(100);
|
|
361
|
+
const p = await L(), h = ut(d()), x = h.provider.url, v = await R(x), $ = new st(p.account.address, h, v, c.web2, c.account.address || "");
|
|
362
|
+
i({ captchaApi: $ });
|
|
363
|
+
const E = await $.getCaptchaChallenge();
|
|
386
364
|
if (E.captchas.length <= 0)
|
|
387
|
-
throw new
|
|
388
|
-
const
|
|
365
|
+
throw new k("DEVELOPER.PROVIDER_NO_CAPTCHA");
|
|
366
|
+
const G = E.captchas.map((H) => H.timeLimitMs || c.captchas.image.challengeTimeout).reduce((H, N) => H + N), _ = setTimeout(() => {
|
|
389
367
|
a.onChallengeExpired(), i({ isHuman: !1, showModal: !1, loading: !1 });
|
|
390
|
-
},
|
|
368
|
+
}, G);
|
|
391
369
|
i({
|
|
392
370
|
index: 0,
|
|
393
371
|
solutions: E.captchas.map(() => []),
|
|
394
372
|
challenge: E,
|
|
395
373
|
showModal: !0,
|
|
396
|
-
timeout:
|
|
397
|
-
blockNumber: G
|
|
374
|
+
timeout: _
|
|
398
375
|
});
|
|
399
376
|
});
|
|
400
|
-
},
|
|
377
|
+
}, g = async () => {
|
|
401
378
|
await s(async () => {
|
|
402
|
-
if (
|
|
379
|
+
if (D(), !e.challenge)
|
|
403
380
|
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
404
381
|
context: { error: "Cannot submit, no Captcha found in state" }
|
|
405
382
|
});
|
|
406
383
|
i({ showModal: !1 });
|
|
407
|
-
const c = e.challenge,
|
|
408
|
-
const
|
|
384
|
+
const c = e.challenge, p = je(), h = e.challenge.captchas.map((N, le) => {
|
|
385
|
+
const de = b(e.solutions, le);
|
|
409
386
|
return {
|
|
410
|
-
captchaId:
|
|
411
|
-
captchaContentId:
|
|
412
|
-
salt:
|
|
413
|
-
solution:
|
|
387
|
+
captchaId: N.captchaId,
|
|
388
|
+
captchaContentId: N.captchaContentId,
|
|
389
|
+
salt: p,
|
|
390
|
+
solution: de
|
|
414
391
|
};
|
|
415
|
-
}), x =
|
|
416
|
-
if (!
|
|
417
|
-
throw new
|
|
392
|
+
}), x = O(), v = W(x).signer;
|
|
393
|
+
if (!b(c.captchas, 0).datasetId)
|
|
394
|
+
throw new k("CAPTCHA.INVALID_CAPTCHA_ID", {
|
|
418
395
|
context: { error: "No datasetId set for challenge" }
|
|
419
396
|
});
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
397
|
+
const E = e.captchaApi;
|
|
398
|
+
if (!E)
|
|
422
399
|
throw new T("CAPTCHA.INVALID_TOKEN", {
|
|
423
400
|
context: { error: "No Captcha API found in state" }
|
|
424
401
|
});
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
402
|
+
if (!v || !v.signRaw)
|
|
403
|
+
throw new P("GENERAL.CANT_FIND_KEYRINGPAIR", {
|
|
404
|
+
context: {
|
|
405
|
+
error: "Signer is not defined, cannot sign message to prove account ownership"
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
const G = await v.signRaw({
|
|
409
|
+
address: x.account.address,
|
|
410
|
+
data: re(c.requestHash),
|
|
411
|
+
type: "bytes"
|
|
412
|
+
}), _ = await E.submitCaptchaSolution(G.signature, c.requestHash, h, c.timestamp, c.signature.provider.requestHash), H = _[0].verified;
|
|
413
|
+
if (H || a.onFailed(), i({
|
|
414
|
+
submission: _,
|
|
415
|
+
isHuman: H,
|
|
429
416
|
loading: !1
|
|
430
417
|
}), e.isHuman) {
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
...
|
|
434
|
-
providerUrl:
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
[
|
|
438
|
-
[
|
|
439
|
-
[
|
|
440
|
-
[
|
|
441
|
-
[
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
418
|
+
const N = E.provider.provider.url;
|
|
419
|
+
V.setProcaptchaStorage({
|
|
420
|
+
...V.getProcaptchaStorage(),
|
|
421
|
+
providerUrl: N
|
|
422
|
+
}), a.onHuman(ue({
|
|
423
|
+
[w.providerUrl]: N,
|
|
424
|
+
[w.user]: x.account.address,
|
|
425
|
+
[w.dapp]: I(),
|
|
426
|
+
[w.commitmentId]: rt(_[1]),
|
|
427
|
+
[w.timestamp]: c.timestamp,
|
|
428
|
+
[w.signature]: {
|
|
429
|
+
[w.provider]: {
|
|
430
|
+
[w.requestHash]: c.signature.provider.requestHash
|
|
431
|
+
},
|
|
432
|
+
[w.user]: {
|
|
433
|
+
[w.requestHash]: G.signature
|
|
446
434
|
}
|
|
447
435
|
}
|
|
448
436
|
})), M();
|
|
449
437
|
}
|
|
450
438
|
});
|
|
451
|
-
},
|
|
452
|
-
|
|
453
|
-
},
|
|
439
|
+
}, u = async () => {
|
|
440
|
+
D(), S(), a.onClose();
|
|
441
|
+
}, y = (c) => {
|
|
454
442
|
if (!e.challenge)
|
|
455
443
|
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
456
444
|
context: { error: "Cannot select, no Captcha found in state" }
|
|
@@ -461,9 +449,9 @@ function ft(t, e, n, o) {
|
|
|
461
449
|
error: "Cannot select, index is out of range for this Captcha"
|
|
462
450
|
}
|
|
463
451
|
});
|
|
464
|
-
const
|
|
465
|
-
x.includes(c) ? x.splice(x.indexOf(c), 1) : x.push(c), i({ solutions:
|
|
466
|
-
},
|
|
452
|
+
const p = e.index, h = e.solutions, x = b(h, p);
|
|
453
|
+
x.includes(c) ? x.splice(x.indexOf(c), 1) : x.push(c), i({ solutions: h });
|
|
454
|
+
}, C = () => {
|
|
467
455
|
if (!e.challenge)
|
|
468
456
|
throw new T("CAPTCHA.NO_CAPTCHA", {
|
|
469
457
|
context: { error: "Cannot select, no Captcha found in state" }
|
|
@@ -475,62 +463,62 @@ function ft(t, e, n, o) {
|
|
|
475
463
|
}
|
|
476
464
|
});
|
|
477
465
|
i({ index: e.index + 1 });
|
|
478
|
-
},
|
|
479
|
-
const
|
|
480
|
-
if (!
|
|
481
|
-
throw new
|
|
482
|
-
return new
|
|
483
|
-
},
|
|
466
|
+
}, R = async (c) => {
|
|
467
|
+
const p = d();
|
|
468
|
+
if (!p.account.address)
|
|
469
|
+
throw new P("GENERAL.SITE_KEY_MISSING");
|
|
470
|
+
return new ze(c, p.account.address);
|
|
471
|
+
}, D = () => {
|
|
484
472
|
window.clearTimeout(e.timeout), i({ timeout: void 0 });
|
|
485
473
|
}, M = () => {
|
|
486
|
-
const c = t.captchas.image.solutionTimeout,
|
|
474
|
+
const c = t.captchas.image.solutionTimeout, p = setTimeout(() => {
|
|
487
475
|
i({ isHuman: !1 }), a.onExpired();
|
|
488
476
|
}, c);
|
|
489
|
-
i({ successfullChallengeTimeout:
|
|
490
|
-
},
|
|
491
|
-
|
|
477
|
+
i({ successfullChallengeTimeout: p });
|
|
478
|
+
}, S = () => {
|
|
479
|
+
D(), i(dt());
|
|
492
480
|
}, L = async () => {
|
|
493
|
-
const c =
|
|
481
|
+
const c = d();
|
|
494
482
|
if (!c.web2 && !c.userAccountAddress)
|
|
495
|
-
throw new
|
|
483
|
+
throw new P("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
496
484
|
context: { error: "Account address has not been set for web3 mode" }
|
|
497
485
|
});
|
|
498
|
-
const
|
|
499
|
-
return
|
|
500
|
-
},
|
|
486
|
+
const h = await (c.web2 ? new Ue() : new $e()).getAccount(c);
|
|
487
|
+
return V.setAccount(h.account.address), i({ account: h }), O();
|
|
488
|
+
}, O = () => {
|
|
501
489
|
if (!e.account)
|
|
502
|
-
throw new
|
|
490
|
+
throw new P("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
503
491
|
context: { error: "Account not loaded" }
|
|
504
492
|
});
|
|
505
493
|
return e.account;
|
|
506
494
|
}, I = () => {
|
|
507
495
|
if (!e.dappAccount)
|
|
508
|
-
throw new
|
|
496
|
+
throw new P("GENERAL.SITE_KEY_MISSING");
|
|
509
497
|
return e.dappAccount;
|
|
510
|
-
}, W = (
|
|
511
|
-
const
|
|
512
|
-
if (!
|
|
513
|
-
throw new
|
|
498
|
+
}, W = (c) => {
|
|
499
|
+
const p = c || O();
|
|
500
|
+
if (!p.extension)
|
|
501
|
+
throw new P("ACCOUNT.NO_POLKADOT_EXTENSION", {
|
|
514
502
|
context: { error: "Extension not loaded" }
|
|
515
503
|
});
|
|
516
|
-
return
|
|
504
|
+
return p.extension;
|
|
517
505
|
};
|
|
518
506
|
return {
|
|
519
|
-
start:
|
|
520
|
-
cancel:
|
|
521
|
-
submit:
|
|
522
|
-
select:
|
|
523
|
-
nextRound:
|
|
507
|
+
start: f,
|
|
508
|
+
cancel: u,
|
|
509
|
+
submit: g,
|
|
510
|
+
select: y,
|
|
511
|
+
nextRound: C
|
|
524
512
|
};
|
|
525
513
|
}
|
|
526
|
-
const
|
|
514
|
+
const ht = (t) => {
|
|
527
515
|
if (!t.hash)
|
|
528
|
-
throw new
|
|
516
|
+
throw new k("CAPTCHA.MISSING_ITEM_HASH", {
|
|
529
517
|
context: { item: t }
|
|
530
518
|
});
|
|
531
519
|
return t.hash;
|
|
532
|
-
},
|
|
533
|
-
const a = t.items, r = m.useMemo(() => o === "light" ?
|
|
520
|
+
}, ft = ({ challenge: t, solution: e, onClick: n, themeColor: o }) => {
|
|
521
|
+
const a = t.items, r = m.useMemo(() => o === "light" ? B : U, [o]), i = "ontouchstart" in window, d = `${r.spacing.unit}px`, s = `${r.spacing.half}px`, f = {
|
|
534
522
|
0: {
|
|
535
523
|
paddingLeft: 0,
|
|
536
524
|
paddingRight: s,
|
|
@@ -549,11 +537,11 @@ const gt = (t) => {
|
|
|
549
537
|
paddingTop: s,
|
|
550
538
|
paddingBottom: s
|
|
551
539
|
}
|
|
552
|
-
},
|
|
553
|
-
0: { paddingTop:
|
|
554
|
-
2: { paddingBottom:
|
|
540
|
+
}, g = {
|
|
541
|
+
0: { paddingTop: d },
|
|
542
|
+
2: { paddingBottom: d }
|
|
555
543
|
};
|
|
556
|
-
return
|
|
544
|
+
return l("div", { style: {
|
|
557
545
|
paddingRight: 0.5,
|
|
558
546
|
paddingBottom: 0.5,
|
|
559
547
|
width: "100%",
|
|
@@ -561,38 +549,38 @@ const gt = (t) => {
|
|
|
561
549
|
display: "flex",
|
|
562
550
|
flexDirection: "row",
|
|
563
551
|
flexWrap: "wrap"
|
|
564
|
-
}, children: a.map((
|
|
565
|
-
const
|
|
566
|
-
...
|
|
567
|
-
...
|
|
552
|
+
}, children: a.map((u, y) => {
|
|
553
|
+
const C = ht(u), R = {
|
|
554
|
+
...f[y % 3],
|
|
555
|
+
...g[Math.floor(y / 3)],
|
|
568
556
|
flexGrow: 1,
|
|
569
557
|
flexBasis: "33.3333%",
|
|
570
558
|
boxSizing: "border-box"
|
|
571
559
|
};
|
|
572
|
-
return
|
|
560
|
+
return l("div", { style: R, children: A("div", { style: {
|
|
573
561
|
cursor: "pointer",
|
|
574
562
|
height: "100%",
|
|
575
563
|
width: "100%",
|
|
576
564
|
border: 1,
|
|
577
565
|
borderStyle: "solid",
|
|
578
566
|
borderColor: r.palette.grey[300]
|
|
579
|
-
}, onClick: i ? void 0 : () => n(
|
|
567
|
+
}, onClick: i ? void 0 : () => n(C), onTouchStart: i ? () => n(C) : void 0, children: [l("div", { children: l("img", { style: {
|
|
580
568
|
width: "100%",
|
|
581
569
|
backgroundColor: r.palette.grey[300],
|
|
582
|
-
opacity: e.includes(
|
|
570
|
+
opacity: e.includes(C) && i ? "50%" : "100%",
|
|
583
571
|
display: "block",
|
|
584
572
|
objectFit: "contain",
|
|
585
573
|
aspectRatio: "1/1",
|
|
586
574
|
height: "auto"
|
|
587
|
-
}, src:
|
|
575
|
+
}, src: u.data, alt: `Captcha image ${y + 1}` }) }), l("div", { style: {
|
|
588
576
|
position: "relative",
|
|
589
577
|
width: "100%",
|
|
590
578
|
height: "100%",
|
|
591
579
|
top: "-100%",
|
|
592
|
-
visibility: e.includes(
|
|
580
|
+
visibility: e.includes(C) ? "visible" : "hidden",
|
|
593
581
|
transition: "opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
594
582
|
opacity: 1
|
|
595
|
-
}, children:
|
|
583
|
+
}, children: l("div", { style: {
|
|
596
584
|
position: "absolute",
|
|
597
585
|
top: 0,
|
|
598
586
|
left: 0,
|
|
@@ -604,7 +592,7 @@ const gt = (t) => {
|
|
|
604
592
|
alignItems: "center",
|
|
605
593
|
justifyContent: "center",
|
|
606
594
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
607
|
-
}, children:
|
|
595
|
+
}, children: l("svg", { style: {
|
|
608
596
|
backgroundColor: "transparent",
|
|
609
597
|
display: "block",
|
|
610
598
|
width: "35%",
|
|
@@ -612,18 +600,18 @@ const gt = (t) => {
|
|
|
612
600
|
transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
613
601
|
userSelect: "none",
|
|
614
602
|
fill: "currentcolor"
|
|
615
|
-
}, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", "aria-label": "Check icon", children:
|
|
603
|
+
}, focusable: "false", color: "#fff", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CheckIcon", "aria-label": "Check icon", children: l("path", { d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) }) }) })] }) }, u.hash);
|
|
616
604
|
}) });
|
|
617
605
|
};
|
|
618
|
-
function
|
|
606
|
+
function gt(t = {}) {
|
|
619
607
|
return Object.keys(t).reduce((e, n) => ({ ...e, [`data-${n}`]: t[n] }), {});
|
|
620
608
|
}
|
|
621
|
-
function
|
|
609
|
+
function Y({ general: t, dev: e }) {
|
|
622
610
|
return {
|
|
623
|
-
...
|
|
611
|
+
...gt(t)
|
|
624
612
|
};
|
|
625
613
|
}
|
|
626
|
-
const
|
|
614
|
+
const mt = {
|
|
627
615
|
display: "inline-flex",
|
|
628
616
|
alignItems: "center",
|
|
629
617
|
justifyContent: "center",
|
|
@@ -649,10 +637,10 @@ const xt = {
|
|
|
649
637
|
color: "rgb(0, 0, 0)",
|
|
650
638
|
backgroundColor: "#ffffff",
|
|
651
639
|
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"
|
|
652
|
-
},
|
|
653
|
-
const a = m.useMemo(() => t === "light" ?
|
|
640
|
+
}, ne = ({ themeColor: t, buttonType: e, text: n, onClick: o }) => {
|
|
641
|
+
const a = m.useMemo(() => t === "light" ? B : U, [t]), [r, i] = m.useState(!1), d = m.useMemo(() => {
|
|
654
642
|
const s = {
|
|
655
|
-
...
|
|
643
|
+
...mt,
|
|
656
644
|
color: r ? a.palette.primary.contrastText : a.palette.background.contrastText
|
|
657
645
|
};
|
|
658
646
|
return e === "cancel" ? {
|
|
@@ -663,12 +651,12 @@ const xt = {
|
|
|
663
651
|
backgroundColor: r ? a.palette.primary.main : a.palette.background.default
|
|
664
652
|
};
|
|
665
653
|
}, [e, r, a]);
|
|
666
|
-
return
|
|
654
|
+
return l("button", { ...Y({ dev: { cy: `button-${e}` } }), onMouseEnter: () => i(!0), onMouseLeave: () => i(!1), style: d, onClick: (s) => {
|
|
667
655
|
s.preventDefault(), o();
|
|
668
656
|
}, "aria-label": n, children: n });
|
|
669
|
-
},
|
|
670
|
-
const { t: s } =
|
|
671
|
-
return
|
|
657
|
+
}, xt = ({ challenge: t, index: e, solutions: n, onSubmit: o, onCancel: a, onClick: r, onNext: i, themeColor: d }) => {
|
|
658
|
+
const { t: s } = tt(), f = t.captchas ? b(t.captchas, e) : null, g = n ? b(n, e) : [], u = m.useMemo(() => d === "light" ? B : U, [d]);
|
|
659
|
+
return l(m.Suspense, { fallback: l("div", { children: "Loading..." }), children: l("div", { style: {
|
|
672
660
|
overflowX: "auto",
|
|
673
661
|
overflowY: "auto",
|
|
674
662
|
width: "100%",
|
|
@@ -679,49 +667,49 @@ const xt = {
|
|
|
679
667
|
border: "1px solid #dddddd",
|
|
680
668
|
boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
|
|
681
669
|
borderRadius: "4px",
|
|
682
|
-
padding: `${
|
|
683
|
-
backgroundColor:
|
|
670
|
+
padding: `${u.spacing.unit}px`,
|
|
671
|
+
backgroundColor: u.palette.background.default
|
|
684
672
|
}, children: A("div", { style: {
|
|
685
|
-
backgroundColor:
|
|
673
|
+
backgroundColor: u.palette.background.default,
|
|
686
674
|
display: "flex",
|
|
687
675
|
flexDirection: "column",
|
|
688
676
|
minWidth: "300px"
|
|
689
|
-
}, children: [
|
|
677
|
+
}, children: [l("div", { style: {
|
|
690
678
|
display: "flex",
|
|
691
679
|
alignItems: "center",
|
|
692
680
|
width: "100%"
|
|
693
|
-
}, children:
|
|
694
|
-
backgroundColor:
|
|
681
|
+
}, children: l("div", { style: {
|
|
682
|
+
backgroundColor: u.palette.primary.main,
|
|
695
683
|
width: "100%"
|
|
696
684
|
}, children: A("div", { style: {
|
|
697
|
-
paddingLeft: `${
|
|
698
|
-
paddingRight: `${
|
|
685
|
+
paddingLeft: `${u.spacing.half}px`,
|
|
686
|
+
paddingRight: `${u.spacing.half}px`
|
|
699
687
|
}, children: [A("p", { style: {
|
|
700
688
|
color: "#ffffff",
|
|
701
689
|
fontWeight: 700,
|
|
702
690
|
lineHeight: 1.5
|
|
703
|
-
}, children: [s("WIDGET.SELECT_ALL"), ":", " ",
|
|
691
|
+
}, children: [s("WIDGET.SELECT_ALL"), ":", " ", l("span", { style: { textTransform: "capitalize" }, children: `${b(t.captchas, e).target}` })] }), l("p", { style: {
|
|
704
692
|
color: "#ffffff",
|
|
705
693
|
fontWeight: 500,
|
|
706
694
|
lineHeight: 0.8,
|
|
707
695
|
fontSize: "0.8rem"
|
|
708
|
-
}, children: s("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }),
|
|
696
|
+
}, children: s("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }), l("div", { ...Y({ dev: { cy: `captcha-${e}` } }), children: f && l(ft, { challenge: f, solution: g, onClick: r, themeColor: d }) }), l("div", { style: {
|
|
709
697
|
display: "flex",
|
|
710
698
|
alignItems: "center",
|
|
711
699
|
justifyContent: "center",
|
|
712
700
|
width: "100%"
|
|
713
|
-
}, ...
|
|
714
|
-
padding: `0 ${
|
|
701
|
+
}, ...Y({ dev: { cy: "dots-captcha" } }) }), l("div", { style: {
|
|
702
|
+
padding: `0 ${u.spacing}px`,
|
|
715
703
|
display: "flex",
|
|
716
704
|
width: "100%"
|
|
717
705
|
} }), A("div", { style: {
|
|
718
|
-
padding: `0 ${
|
|
706
|
+
padding: `0 ${u.spacing}px`,
|
|
719
707
|
display: "flex",
|
|
720
708
|
alignItems: "center",
|
|
721
709
|
justifyContent: "space-between",
|
|
722
710
|
lineHeight: 1.75
|
|
723
|
-
}, children: [
|
|
724
|
-
},
|
|
711
|
+
}, children: [l(ne, { themeColor: d, buttonType: "cancel", onClick: a, text: s("WIDGET.CANCEL"), "aria-label": s("WIDGET.CANCEL") }), l(ne, { themeColor: d, buttonType: "next", text: e < t.captchas.length - 1 ? s("WIDGET.NEXT") : s("WIDGET.SUBMIT"), onClick: e < t.captchas.length - 1 ? i : o, "aria-label": e < t.captchas.length - 1 ? s("WIDGET.NEXT") : s("WIDGET.SUBMIT"), "data-cy": "button-next" })] })] }) }) });
|
|
712
|
+
}, bt = pe.memo((t, e) => {
|
|
725
713
|
const { show: n, children: o } = t, r = {
|
|
726
714
|
position: "fixed",
|
|
727
715
|
zIndex: 2147483646,
|
|
@@ -738,7 +726,7 @@ const xt = {
|
|
|
738
726
|
left: 0,
|
|
739
727
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
740
728
|
zIndex: -1
|
|
741
|
-
},
|
|
729
|
+
}, d = {
|
|
742
730
|
position: "absolute",
|
|
743
731
|
top: "50%",
|
|
744
732
|
left: "50%",
|
|
@@ -748,26 +736,26 @@ const xt = {
|
|
|
748
736
|
border: "none",
|
|
749
737
|
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,"
|
|
750
738
|
};
|
|
751
|
-
return A("div", { className: "modalOuter", style: r, children: [
|
|
752
|
-
}),
|
|
753
|
-
const e =
|
|
754
|
-
return
|
|
755
|
-
maxWidth:
|
|
739
|
+
return A("div", { className: "modalOuter", style: r, children: [l("div", { className: "modalBackground", style: i }), l("div", { className: "modalInner", style: d, children: o })] });
|
|
740
|
+
}), wt = (t) => {
|
|
741
|
+
const e = oe.parse(t.config), n = t.callbacks || {}, [o, a] = Fe(m.useState, m.useRef), r = pt(e, o, a, n), i = t.config.theme === "light" ? "light" : "dark", d = t.config.theme === "light" ? B : U;
|
|
742
|
+
return l("div", { children: A("div", { style: {
|
|
743
|
+
maxWidth: he,
|
|
756
744
|
maxHeight: "100%",
|
|
757
745
|
overflowX: "auto"
|
|
758
|
-
}, children: [
|
|
759
|
-
padding:
|
|
760
|
-
border:
|
|
761
|
-
backgroundColor:
|
|
762
|
-
borderColor:
|
|
763
|
-
borderRadius:
|
|
746
|
+
}, children: [l(bt, { show: o.showModal, children: o.challenge ? l(xt, { challenge: o.challenge, index: o.index, solutions: o.solutions, onSubmit: r.submit, onCancel: r.cancel, onClick: r.select, onNext: r.nextRound, themeColor: e.theme ?? "light" }) : l("div", { children: "No challenge set." }) }), l(fe, { children: l(ge, { children: A("div", { style: me, "data-cy": "button-human", children: [" ", A("div", { style: {
|
|
747
|
+
padding: xe,
|
|
748
|
+
border: be,
|
|
749
|
+
backgroundColor: d.palette.background.default,
|
|
750
|
+
borderColor: d.palette.grey[300],
|
|
751
|
+
borderRadius: ye,
|
|
764
752
|
display: "flex",
|
|
765
753
|
alignItems: "center",
|
|
766
754
|
flexWrap: "wrap",
|
|
767
755
|
justifyContent: "space-between",
|
|
768
|
-
minHeight: `${
|
|
756
|
+
minHeight: `${Ce}px`,
|
|
769
757
|
overflow: "hidden"
|
|
770
|
-
}, children: [
|
|
758
|
+
}, children: [l("div", { style: { display: "inline-flex", flexDirection: "column" }, children: l("div", { style: {
|
|
771
759
|
alignItems: "center",
|
|
772
760
|
flex: 1
|
|
773
761
|
}, children: A("div", { style: {
|
|
@@ -776,12 +764,12 @@ const xt = {
|
|
|
776
764
|
justifyContent: "center",
|
|
777
765
|
flexDirection: "column",
|
|
778
766
|
verticalAlign: "middle"
|
|
779
|
-
}, children: [
|
|
767
|
+
}, children: [l("div", { style: {
|
|
780
768
|
display: o.loading ? "none" : "flex"
|
|
781
|
-
}, children:
|
|
769
|
+
}, children: l(Ke, { themeColor: i, onChange: r.start, checked: o.isHuman, labelText: "I am human", "aria-label": "human checkbox" }) }), l("div", { style: {
|
|
782
770
|
display: o.loading ? "flex" : "none"
|
|
783
|
-
}, children:
|
|
771
|
+
}, children: l("div", { style: { display: "inline-flex" }, children: l(we, { themeColor: i, "aria-label": "Loading spinner" }) }) })] }) }) }), l("div", { style: { display: "inline-flex", flexDirection: "column" }, children: l("a", { href: Ae, target: "_blank", "aria-label": ve, rel: "noreferrer", children: l("div", { style: { flex: 1 }, children: l(Te, { themeColor: i, "aria-label": "Prosopo logo" }) }) }) })] })] }) }) })] }) });
|
|
784
772
|
};
|
|
785
773
|
export {
|
|
786
|
-
|
|
774
|
+
wt as default
|
|
787
775
|
};
|