@prosopo/procaptcha-bundle 2.6.12 → 3.0.6
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 +3 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +4 -0
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +2 -2
- package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +1 -1
- package/CHANGELOG.md +141 -0
- package/dist/bundle/ProcaptchaWidget-BpzncYOb.js +612 -0
- package/dist/bundle/ProcaptchaWidget-D961oZ27.js +148 -0
- package/dist/bundle/bnChunk-DRlDxTFg.js +1137 -0
- package/dist/bundle/{browser-ponyfill-Bctlk3uB.js → browser-ponyfill-CvzSbL_o.js} +31 -30
- package/dist/bundle/builder-CQlqPNRd.js +37 -0
- package/dist/bundle/captchaComponentProvider-Dw6ydLe3.js +802 -0
- package/dist/bundle/{captchaRenderer-BAMErqQN.js → captchaRenderer-CY8KuZK-.js} +22 -22
- package/dist/bundle/commonChunk-24zMb_mF.js +189 -0
- package/dist/bundle/emotion-element-5486c51c.browser.esm-PRDDgd_k.js +918 -0
- package/dist/bundle/{fp.esm-DYWeNGcH.js → fp.esm-BADUiinQ.js} +548 -648
- package/dist/bundle/index-BRg_gWPo.js +1328 -0
- package/dist/bundle/{index-ByKGlSkE.js → index-BzOMq-ud.js} +2 -2
- package/dist/bundle/{index-1qH2dz7u.js → index-DqwVRCwA.js} +166 -199
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/locales/ar/translation.json +4 -3
- package/dist/bundle/locales/az/translation.json +4 -3
- package/dist/bundle/locales/cs/translation.json +4 -3
- package/dist/bundle/locales/de/translation.json +4 -3
- package/dist/bundle/locales/el/translation.json +4 -3
- package/dist/bundle/locales/en/translation.json +4 -3
- package/dist/bundle/locales/es/translation.json +4 -3
- package/dist/bundle/locales/fi/translation.json +4 -3
- package/dist/bundle/locales/fr/translation.json +4 -3
- package/dist/bundle/locales/hi/translation.json +4 -3
- package/dist/bundle/locales/hu/translation.json +4 -3
- package/dist/bundle/locales/id/translation.json +4 -3
- package/dist/bundle/locales/it/translation.json +4 -3
- package/dist/bundle/locales/ja/translation.json +4 -3
- package/dist/bundle/locales/jv/translation.json +4 -3
- package/dist/bundle/locales/ko/translation.json +4 -3
- package/dist/bundle/locales/ml/translation.json +4 -3
- package/dist/bundle/locales/ms/translation.json +4 -3
- package/dist/bundle/locales/nl/translation.json +4 -3
- package/dist/bundle/locales/no/translation.json +4 -3
- package/dist/bundle/locales/pl/translation.json +4 -3
- package/dist/bundle/locales/pt/translation.json +4 -3
- package/dist/bundle/locales/{pt-br → pt-BR}/translation.json +4 -3
- package/dist/bundle/locales/ro/translation.json +4 -3
- package/dist/bundle/locales/ru/translation.json +4 -3
- package/dist/bundle/locales/sr/translation.json +4 -3
- package/dist/bundle/locales/sv/translation.json +4 -3
- package/dist/bundle/locales/th/translation.json +4 -3
- package/dist/bundle/locales/tr/translation.json +4 -3
- package/dist/bundle/locales/uk/translation.json +4 -3
- package/dist/bundle/locales/vi/translation.json +4 -3
- package/dist/bundle/locales/{zh-cn → zh-CN}/translation.json +4 -3
- package/dist/bundle/nobleChunk-Xl5XLrx3.js +3635 -0
- package/dist/bundle/procaptcha.bundle.js +6 -5
- package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +1 -1
- package/dist/bundle/util/captcha/captchaComponentsList.d.ts +1 -1
- package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +1 -1
- package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/dist/bundle/util/configCreator.d.ts +1 -1
- package/dist/bundle/util/configCreator.d.ts.map +1 -1
- package/dist/bundle/utilChunk-sqstc6C5.js +317 -0
- package/dist/bundle/utilCryptoChunk-CIPUtfoO.js +1256 -0
- package/dist/bundle/web2Chunk-7Vd8yt2r.js +3711 -0
- package/dist/bundle/{hash-CrwduMDb.js → web3Chunk-DrUvbVNW.js} +257 -695
- package/dist/bundle/{translations-DEL070wJ.js → zodChunk-wTu9ZHzV.js} +46 -82
- package/dist/cjs/index.cjs +8 -2
- package/dist/cjs/util/captcha/captchaComponentProvider.cjs +4 -0
- package/dist/cjs/util/captcha/captchaRenderer.cjs +2 -1
- package/dist/cjs/util/configCreator.cjs +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/util/captcha/captchaComponentProvider.d.ts +1 -1
- package/dist/util/captcha/captchaComponentProvider.d.ts.map +1 -1
- package/dist/util/captcha/captchaComponentProvider.js +4 -0
- package/dist/util/captcha/captchaComponentProvider.js.map +1 -1
- package/dist/util/captcha/captchaComponentsList.d.ts +1 -1
- package/dist/util/captcha/captchaComponentsList.d.ts.map +1 -1
- package/dist/util/captcha/captchaRenderer.d.ts.map +1 -1
- package/dist/util/captcha/captchaRenderer.js +1 -1
- package/dist/util/captcha/captchaRenderer.js.map +1 -1
- package/dist/util/configCreator.d.ts +1 -1
- package/dist/util/configCreator.d.ts.map +1 -1
- package/dist/util/configCreator.js +2 -2
- package/dist/util/configCreator.js.map +1 -1
- package/package.json +21 -14
- package/stats.html +1 -1
- package/vite.config.ts +47 -4
- package/vite.serve.config.ts +2 -0
- package/vite.test.config.ts +1 -1
- package/webpack.config.cjs +5 -0
- package/dist/bundle/ProcaptchaWidget-DPyDGPiI.js +0 -156
- package/dist/bundle/ProcaptchaWidget-DoqUlwHS.js +0 -636
- package/dist/bundle/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/dist/bundle/asU8a-BixKX-w0.js +0 -9
- package/dist/bundle/bip39-D7YSihxf.js +0 -260
- package/dist/bundle/captchaComponentProvider-BL18T1UE.js +0 -1242
- package/dist/bundle/emotion-element-5486c51c.browser.esm-Bjt1gs1F.js +0 -1807
- package/dist/bundle/i18nFrontend-DCv3P9jv.js +0 -2273
- package/dist/bundle/index-BeN3et18.js +0 -4844
- package/dist/bundle/index-BjRdPnnE.js +0 -1198
- package/dist/bundle/index-CBquknc2.js +0 -81
- package/dist/bundle/index-QVME9Prx.js +0 -32
- package/dist/bundle/sha256-CGE_4eEY.js +0 -171
- package/dist/bundle/spread-DEmVz7RJ.js +0 -15
- package/dist/bundle/toU8a-CPMbkkSw.js +0 -109
- package/dist/bundle/useTranslation-BJsfZyOx.js +0 -158
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
import { j as l, a as H, g as ne, p as U, b as oe, P as ae, E as re, c as se, C as ie } from "./captchaComponentProvider-Dw6ydLe3.js";
|
|
2
|
+
import { r as m, u as V, a as b, A as w, f as ce, h as le, s as de, P as X, g as ue, l as he } from "./web2Chunk-7Vd8yt2r.js";
|
|
3
|
+
import { l as M, d as D } from "./index-DqwVRCwA.js";
|
|
4
|
+
import { b as _, c as W, P as v, a as N } from "./commonChunk-24zMb_mF.js";
|
|
5
|
+
import { r as pe } from "./index-BzOMq-ud.js";
|
|
6
|
+
import { v as ge } from "./utilCryptoChunk-CIPUtfoO.js";
|
|
7
|
+
import { w as fe } from "./utilChunk-sqstc6C5.js";
|
|
8
|
+
import { b as me, u as xe } from "./builder-CQlqPNRd.js";
|
|
9
|
+
const Ce = {
|
|
10
|
+
border: "none",
|
|
11
|
+
paddingTop: "6px",
|
|
12
|
+
paddingBottom: "6px",
|
|
13
|
+
cursor: "pointer",
|
|
14
|
+
height: "39px",
|
|
15
|
+
width: "39px",
|
|
16
|
+
borderRadius: "50%",
|
|
17
|
+
display: "flex"
|
|
18
|
+
}, we = ({ themeColor: r, onReload: e }) => {
|
|
19
|
+
const n = m.useMemo(() => r === "light" ? M : D, [r]), [o, t] = m.useState(!1), i = m.useMemo(() => ({
|
|
20
|
+
...{
|
|
21
|
+
...Ce,
|
|
22
|
+
backgroundColor: n.palette.background.default,
|
|
23
|
+
color: o ? n.palette.primary.contrastText : n.palette.background.contrastText,
|
|
24
|
+
border: `1px solid ${n.palette.grey[500]}`,
|
|
25
|
+
borderRadius: "50%",
|
|
26
|
+
transition: "background-color 0.3s",
|
|
27
|
+
boxShadow: `0px 1px 3px 0px ${n.palette.grey[500]}`,
|
|
28
|
+
justifyContent: "center",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
margin: "0 auto"
|
|
31
|
+
},
|
|
32
|
+
backgroundColor: o ? n.palette.grey[700] : n.palette.background.default
|
|
33
|
+
}), [o, n]);
|
|
34
|
+
return l("button", { className: "reload-button", "aria-label": "Reload", type: "button", style: i, onMouseEnter: () => t(!0), onMouseLeave: () => t(!1), onClick: (a) => {
|
|
35
|
+
a.preventDefault(), e();
|
|
36
|
+
}, children: H("svg", { width: "16px", height: "16px", viewBox: "0 0 16 16", version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", style: { display: "flex" }, children: [l("title", { children: "reload" }), l("path", { shapeRendering: "optimizeQuality", fill: o ? n.palette.primary.contrastText : n.palette.grey[700], transform: "scale(0.0416)", 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" })] }) });
|
|
37
|
+
}, be = (r) => {
|
|
38
|
+
if (!r.hash)
|
|
39
|
+
throw new _("CAPTCHA.MISSING_ITEM_HASH", {
|
|
40
|
+
context: { item: r }
|
|
41
|
+
});
|
|
42
|
+
return r.hash;
|
|
43
|
+
}, Ae = ({ challenge: r, solution: e, onClick: n, themeColor: o }) => {
|
|
44
|
+
const t = r.items, i = m.useMemo(() => o === "light" ? M : D, [o]), a = `${i.spacing.unit}px`;
|
|
45
|
+
return l("div", { style: {
|
|
46
|
+
width: "100%",
|
|
47
|
+
height: "100%",
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexDirection: "row",
|
|
50
|
+
flexWrap: "wrap",
|
|
51
|
+
justifyContent: "space-between",
|
|
52
|
+
paddingBottom: a,
|
|
53
|
+
paddingTop: a,
|
|
54
|
+
gap: "10px"
|
|
55
|
+
}, children: t.map((s, d) => {
|
|
56
|
+
const u = be(s);
|
|
57
|
+
return l("div", { style: {
|
|
58
|
+
flexGrow: 1,
|
|
59
|
+
flexBasis: "calc(33.333% - 10px)",
|
|
60
|
+
boxSizing: "border-box"
|
|
61
|
+
}, children: H("div", { style: {
|
|
62
|
+
position: "relative",
|
|
63
|
+
cursor: "pointer",
|
|
64
|
+
height: "100%",
|
|
65
|
+
width: "100%",
|
|
66
|
+
padding: 0,
|
|
67
|
+
margin: 0
|
|
68
|
+
}, onClick: () => n(u), children: [l("img", { style: {
|
|
69
|
+
width: "100%",
|
|
70
|
+
display: "block",
|
|
71
|
+
objectFit: "cover",
|
|
72
|
+
aspectRatio: "1/1",
|
|
73
|
+
height: "auto",
|
|
74
|
+
overflow: "hidden",
|
|
75
|
+
borderStyle: "solid",
|
|
76
|
+
borderWidth: "1px",
|
|
77
|
+
borderColor: i.palette.grey[300]
|
|
78
|
+
}, src: s.data, alt: `Captcha image ${d + 1}` }), l("div", { style: {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
top: 0,
|
|
81
|
+
left: 0,
|
|
82
|
+
bottom: 0,
|
|
83
|
+
right: 0,
|
|
84
|
+
height: "100%",
|
|
85
|
+
width: "100%",
|
|
86
|
+
display: "flex",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
90
|
+
visibility: e.includes(u) ? "visible" : "hidden"
|
|
91
|
+
}, children: l("svg", { style: {
|
|
92
|
+
backgroundColor: "transparent",
|
|
93
|
+
display: "block",
|
|
94
|
+
width: "35%",
|
|
95
|
+
height: "35%",
|
|
96
|
+
transition: "fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
97
|
+
userSelect: "none",
|
|
98
|
+
fill: "currentcolor"
|
|
99
|
+
}, 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" }) }) })] }) }, s.hash);
|
|
100
|
+
}) });
|
|
101
|
+
};
|
|
102
|
+
function ye(r = {}) {
|
|
103
|
+
return Object.keys(r).reduce((e, n) => ({ ...e, [`data-${n}`]: r[n] }), {});
|
|
104
|
+
}
|
|
105
|
+
function q({ general: r, dev: e }) {
|
|
106
|
+
return {
|
|
107
|
+
...ye(r)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const ve = {
|
|
111
|
+
display: "inline-flex",
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
justifyContent: "center",
|
|
114
|
+
position: "relative",
|
|
115
|
+
boxSizing: "border-box",
|
|
116
|
+
outline: "0px",
|
|
117
|
+
margin: "0px",
|
|
118
|
+
cursor: "pointer",
|
|
119
|
+
userSelect: "none",
|
|
120
|
+
verticalAlign: "middle",
|
|
121
|
+
appearance: void 0,
|
|
122
|
+
textDecoration: "none",
|
|
123
|
+
fontWeight: "500",
|
|
124
|
+
fontSize: "0.875rem",
|
|
125
|
+
lineHeight: "1.75",
|
|
126
|
+
letterSpacing: "0.02857em",
|
|
127
|
+
textTransform: "uppercase",
|
|
128
|
+
minWidth: "64px",
|
|
129
|
+
padding: "6px 16px",
|
|
130
|
+
borderRadius: "4px",
|
|
131
|
+
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",
|
|
132
|
+
backgroundColor: "#ffffff"
|
|
133
|
+
}, B = ({ themeColor: r, buttonType: e, text: n, onClick: o }) => {
|
|
134
|
+
const t = m.useMemo(() => r === "light" ? M : D, [r]), [i, a] = m.useState(!1), s = m.useMemo(() => {
|
|
135
|
+
const d = {
|
|
136
|
+
...ve,
|
|
137
|
+
border: `1px solid ${t.palette.grey[500]}`,
|
|
138
|
+
boxShadow: `0px 1px 3px 0px ${t.palette.grey[500]}`,
|
|
139
|
+
fontFamily: t.font.fontFamily,
|
|
140
|
+
width: "100%",
|
|
141
|
+
color: i ? t.palette.primary.contrastText : t.palette.background.contrastText
|
|
142
|
+
};
|
|
143
|
+
return e === "cancel" ? {
|
|
144
|
+
...d,
|
|
145
|
+
backgroundColor: i ? t.palette.grey[600] : "transparent"
|
|
146
|
+
} : {
|
|
147
|
+
...d,
|
|
148
|
+
backgroundColor: i ? t.palette.primary.main : t.palette.background.default
|
|
149
|
+
};
|
|
150
|
+
}, [e, i, t]);
|
|
151
|
+
return l("button", { ...q({ dev: {} }), onMouseEnter: () => a(!0), onMouseLeave: () => a(!1), style: s, onClick: (d) => {
|
|
152
|
+
d.preventDefault(), o();
|
|
153
|
+
}, "aria-label": n, children: n });
|
|
154
|
+
}, $ = ({ challenge: r, index: e, solutions: n, onSubmit: o, onCancel: t, onClick: i, onNext: a, onReload: s, themeColor: d }) => {
|
|
155
|
+
const { t: u } = V(), C = r.captchas ? b(r.captchas, e) : null, p = n ? b(n, e) : [], A = m.useMemo(() => d === "light" ? M : D, [d]), k = `${A.spacing.unit * 2}px`, g = `${A.spacing.unit}px`;
|
|
156
|
+
return l(m.Suspense, { fallback: l("div", { children: "Loading..." }), children: l("div", { style: {
|
|
157
|
+
overflowX: "auto",
|
|
158
|
+
overflowY: "auto",
|
|
159
|
+
maxWidth: "500px",
|
|
160
|
+
maxHeight: "100%",
|
|
161
|
+
display: "flex",
|
|
162
|
+
flexDirection: "column",
|
|
163
|
+
border: "1px solid #dddddd",
|
|
164
|
+
boxShadow: "rgba(255, 255, 255, 0.2) 0px 0px 4px",
|
|
165
|
+
borderRadius: "4px",
|
|
166
|
+
backgroundColor: A.palette.background.default,
|
|
167
|
+
userSelect: "none",
|
|
168
|
+
touchAction: "none",
|
|
169
|
+
overscrollBehavior: "none"
|
|
170
|
+
}, children: H("div", { style: {
|
|
171
|
+
backgroundColor: A.palette.background.default,
|
|
172
|
+
display: "flex",
|
|
173
|
+
flexDirection: "column",
|
|
174
|
+
minWidth: "300px",
|
|
175
|
+
marginLeft: g,
|
|
176
|
+
marginRight: g,
|
|
177
|
+
justifyContent: "center"
|
|
178
|
+
}, children: [l("div", { style: {
|
|
179
|
+
display: "flex",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
width: "100%"
|
|
182
|
+
}, children: l("div", { style: {
|
|
183
|
+
backgroundColor: A.palette.primary.main,
|
|
184
|
+
width: "100%",
|
|
185
|
+
marginTop: g
|
|
186
|
+
}, children: H("div", { style: {
|
|
187
|
+
padding: `${A.spacing.half}px`,
|
|
188
|
+
fontFamily: A.font.fontFamily
|
|
189
|
+
}, children: [H("p", { style: {
|
|
190
|
+
color: "#ffffff",
|
|
191
|
+
fontWeight: 700,
|
|
192
|
+
lineHeight: 1.5
|
|
193
|
+
}, children: [u("WIDGET.SELECT_ALL"), ":", " ", l("span", { children: `${b(r.captchas, e).target} ` })] }), l("p", { style: {
|
|
194
|
+
color: "#ffffff",
|
|
195
|
+
fontWeight: 500,
|
|
196
|
+
lineHeight: 0.8,
|
|
197
|
+
fontSize: "0.8rem"
|
|
198
|
+
}, children: u("WIDGET.IF_NONE_CLICK_NEXT") })] }) }) }), l("div", { ...q({ dev: {} }), style: { overflow: "hidden" }, children: C && l(Ae, { challenge: C, solution: p, onClick: i, themeColor: d }) }), l("div", { style: {
|
|
199
|
+
display: "flex",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
justifyContent: "space-between",
|
|
202
|
+
lineHeight: 1.75,
|
|
203
|
+
padding: `${g} 0 ${k} 0`
|
|
204
|
+
}, children: H("div", { style: {
|
|
205
|
+
width: "100%",
|
|
206
|
+
height: "100%",
|
|
207
|
+
display: "flex",
|
|
208
|
+
flexDirection: "row",
|
|
209
|
+
flexWrap: "wrap",
|
|
210
|
+
justifyContent: "space-between",
|
|
211
|
+
gap: "10px"
|
|
212
|
+
}, children: [l("div", { style: {
|
|
213
|
+
position: "relative",
|
|
214
|
+
flexGrow: 1,
|
|
215
|
+
flexBasis: "calc(33.333% - 10px)"
|
|
216
|
+
}, children: l(B, { themeColor: d, buttonType: "cancel", onClick: t, text: u("WIDGET.CANCEL"), "aria-label": u("WIDGET.CANCEL") }) }), l("div", { style: {
|
|
217
|
+
position: "relative",
|
|
218
|
+
flexGrow: 1,
|
|
219
|
+
flexBasis: "calc(33.333% - 10px)"
|
|
220
|
+
}, children: l(we, { themeColor: d, onReload: s }) }), l("div", { style: {
|
|
221
|
+
position: "relative",
|
|
222
|
+
flexGrow: 1,
|
|
223
|
+
flexBasis: "calc(33.333% - 10px)"
|
|
224
|
+
}, children: l(B, { themeColor: d, buttonType: "next", text: e < r.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"), onClick: e < r.captchas.length - 1 ? a : o, "aria-label": e < r.captchas.length - 1 ? u("WIDGET.NEXT") : u("WIDGET.SUBMIT"), "data-cy": "button-next" }) })] }) })] }) }) });
|
|
225
|
+
};
|
|
226
|
+
function Ee(r) {
|
|
227
|
+
return W([
|
|
228
|
+
r.captchaId,
|
|
229
|
+
r.captchaContentId,
|
|
230
|
+
[...r.solution].sort(),
|
|
231
|
+
r.salt
|
|
232
|
+
]);
|
|
233
|
+
}
|
|
234
|
+
class z {
|
|
235
|
+
constructor(e) {
|
|
236
|
+
this.hash = e, this.parent = null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
class Te {
|
|
240
|
+
constructor() {
|
|
241
|
+
this.leaves = [], this.layers = [];
|
|
242
|
+
}
|
|
243
|
+
getRoot() {
|
|
244
|
+
if (this.root === void 0)
|
|
245
|
+
throw new v("DATASET.MERKLE_ERROR", {
|
|
246
|
+
context: {
|
|
247
|
+
error: "root undefined",
|
|
248
|
+
failedFuncName: this.getRoot.name
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return this.root;
|
|
252
|
+
}
|
|
253
|
+
build(e) {
|
|
254
|
+
this.layers.length && (this.layers = []);
|
|
255
|
+
const n = [];
|
|
256
|
+
for (const o of e) {
|
|
257
|
+
const t = new z(o);
|
|
258
|
+
this.leaves.push(t), n.push(t.hash);
|
|
259
|
+
}
|
|
260
|
+
this.layers.push(n), this.root = this.buildMerkleTree(this.leaves)[0];
|
|
261
|
+
}
|
|
262
|
+
buildMerkleTree(e) {
|
|
263
|
+
const n = e.length;
|
|
264
|
+
if (n === 1)
|
|
265
|
+
return e;
|
|
266
|
+
const o = [];
|
|
267
|
+
let t = 0;
|
|
268
|
+
const i = [];
|
|
269
|
+
for (; t < n; ) {
|
|
270
|
+
const a = e[t];
|
|
271
|
+
if (a === void 0)
|
|
272
|
+
throw new v("DEVELOPER.GENERAL", {
|
|
273
|
+
context: { error: "leftChild undefined" }
|
|
274
|
+
});
|
|
275
|
+
const s = t + 1 < n ? b(e, t + 1) : a, d = this.createParent(a, s);
|
|
276
|
+
i.push(d.hash), o.push(d), t += 2;
|
|
277
|
+
}
|
|
278
|
+
return this.layers.push(i), this.buildMerkleTree(o);
|
|
279
|
+
}
|
|
280
|
+
createParent(e, n) {
|
|
281
|
+
const o = new z(W([e.hash, n.hash]));
|
|
282
|
+
return e.parent = o.hash, n.parent = o.hash, o;
|
|
283
|
+
}
|
|
284
|
+
proof(e) {
|
|
285
|
+
const n = [];
|
|
286
|
+
let o = 0;
|
|
287
|
+
for (; o < this.layers.length - 1; ) {
|
|
288
|
+
const i = this.layers[o];
|
|
289
|
+
if (i === void 0)
|
|
290
|
+
throw new v("DATASET.MERKLE_ERROR", {
|
|
291
|
+
context: {
|
|
292
|
+
error: "layer undefined",
|
|
293
|
+
failedFuncName: this.proof.name,
|
|
294
|
+
layerNum: o
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const a = i.indexOf(e);
|
|
298
|
+
let s = a % 2 && a > 0 ? a - 1 : a + 1;
|
|
299
|
+
s > i.length - 1 && (s = a);
|
|
300
|
+
const d = [e], u = b(i, s);
|
|
301
|
+
s > a ? d.push(u) : d.unshift(u), n.push([b(d, 0), b(d, 1)]), o += 1, e = W(d);
|
|
302
|
+
}
|
|
303
|
+
const t = b(this.layers, this.layers.length - 1);
|
|
304
|
+
return [...n, [b(t, 0)]];
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
class F {
|
|
308
|
+
constructor(e, n, o, t, i) {
|
|
309
|
+
this.userAccount = e, this.provider = n, this.providerApi = o, this._web2 = t, this.dappAccount = i;
|
|
310
|
+
}
|
|
311
|
+
get web2() {
|
|
312
|
+
return this._web2;
|
|
313
|
+
}
|
|
314
|
+
async getCaptchaChallenge(e) {
|
|
315
|
+
try {
|
|
316
|
+
const n = await this.providerApi.getCaptchaChallenge(this.userAccount, this.provider, e);
|
|
317
|
+
if (n[w.error])
|
|
318
|
+
return n;
|
|
319
|
+
for (const o of n.captchas)
|
|
320
|
+
for (const t of o.items)
|
|
321
|
+
t.data && (t.data = `https://${t.data.replace(/^http(s)*:\/\//, "")}`);
|
|
322
|
+
return n;
|
|
323
|
+
} catch (n) {
|
|
324
|
+
throw new N("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
325
|
+
context: { error: n }
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
async submitCaptchaSolution(e, n, o, t, i) {
|
|
330
|
+
const a = new Te(), s = o.map((C) => Ee(C));
|
|
331
|
+
if (a.build(s), !a.root)
|
|
332
|
+
throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
333
|
+
context: { error: "Merkle tree root is undefined" }
|
|
334
|
+
});
|
|
335
|
+
const d = a.root.hash;
|
|
336
|
+
let u;
|
|
337
|
+
try {
|
|
338
|
+
u = await this.providerApi.submitCaptchaSolution(o, n, this.userAccount, t, i, e);
|
|
339
|
+
} catch (C) {
|
|
340
|
+
throw new _("CAPTCHA.INVALID_CAPTCHA_CHALLENGE", {
|
|
341
|
+
context: { error: C }
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
return [u, d];
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const Ie = () => ({
|
|
348
|
+
showModal: !1,
|
|
349
|
+
loading: !1,
|
|
350
|
+
index: 0,
|
|
351
|
+
challenge: void 0,
|
|
352
|
+
solutions: void 0,
|
|
353
|
+
isHuman: !1,
|
|
354
|
+
captchaApi: void 0,
|
|
355
|
+
account: void 0
|
|
356
|
+
});
|
|
357
|
+
function Ne(r, e, n, o, t) {
|
|
358
|
+
const i = ne(o), a = me(e, n), s = () => {
|
|
359
|
+
const c = {
|
|
360
|
+
userAccountAddress: "",
|
|
361
|
+
...r
|
|
362
|
+
};
|
|
363
|
+
return e.account && (c.userAccountAddress = e.account.account.address), X.parse(c);
|
|
364
|
+
}, d = async () => {
|
|
365
|
+
i.onOpen(), await U(async () => {
|
|
366
|
+
var R;
|
|
367
|
+
if (e.loading || e.isHuman)
|
|
368
|
+
return;
|
|
369
|
+
a({ loading: !0 }), a({
|
|
370
|
+
attemptCount: e.attemptCount ? e.attemptCount + 1 : 1
|
|
371
|
+
}), a({
|
|
372
|
+
sessionId: t == null ? void 0 : t.sessionId
|
|
373
|
+
});
|
|
374
|
+
const c = s();
|
|
375
|
+
a({ dappAccount: c.account.address }), await de(100);
|
|
376
|
+
const f = await Y();
|
|
377
|
+
let x = e.captchaApi;
|
|
378
|
+
if (t != null && t.provider) {
|
|
379
|
+
const I = t.provider.provider.url, y = await g(I);
|
|
380
|
+
x = new F(f.account.address, t.provider, y, c.web2, c.account.address || ""), a({ captchaApi: x });
|
|
381
|
+
} else {
|
|
382
|
+
const I = await oe(s()), y = I.provider.url, E = await g(y);
|
|
383
|
+
x = new F(f.account.address, I, E, c.web2, c.account.address || ""), a({ captchaApi: x });
|
|
384
|
+
}
|
|
385
|
+
const h = await (x == null ? void 0 : x.getCaptchaChallenge(e.sessionId));
|
|
386
|
+
if (h.error)
|
|
387
|
+
a({
|
|
388
|
+
loading: !1,
|
|
389
|
+
error: {
|
|
390
|
+
message: h.error.message,
|
|
391
|
+
key: h.error.key || "API.UNKNOWN_ERROR"
|
|
392
|
+
}
|
|
393
|
+
}), i.onError(new Error((R = h.error) == null ? void 0 : R.message));
|
|
394
|
+
else {
|
|
395
|
+
if (h.captchas.length <= 0)
|
|
396
|
+
throw new _("DEVELOPER.PROVIDER_NO_CAPTCHA");
|
|
397
|
+
const I = h.captchas.map((E) => E.timeLimitMs || c.captchas.image.challengeTimeout).reduce((E, L) => E + L), y = setTimeout(() => {
|
|
398
|
+
i.onChallengeExpired(), a({ isHuman: !1, showModal: !1, loading: !1 });
|
|
399
|
+
}, I);
|
|
400
|
+
a({
|
|
401
|
+
index: 0,
|
|
402
|
+
solutions: h.captchas.map(() => []),
|
|
403
|
+
challenge: h,
|
|
404
|
+
showModal: !0,
|
|
405
|
+
timeout: y,
|
|
406
|
+
loading: !1
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}, d, P, e.attemptCount, 10);
|
|
410
|
+
}, u = async () => {
|
|
411
|
+
await U(async () => {
|
|
412
|
+
if (T(), !e.challenge)
|
|
413
|
+
throw new v("CAPTCHA.NO_CAPTCHA", {
|
|
414
|
+
context: { error: "Cannot submit, no Captcha found in state" }
|
|
415
|
+
});
|
|
416
|
+
a({ showModal: !1 });
|
|
417
|
+
const c = e.challenge, f = ge(), x = e.challenge.captchas.map((O, ee) => {
|
|
418
|
+
const te = b(e.solutions, ee);
|
|
419
|
+
return {
|
|
420
|
+
captchaId: O.captchaId,
|
|
421
|
+
captchaContentId: O.captchaContentId,
|
|
422
|
+
salt: f,
|
|
423
|
+
solution: te
|
|
424
|
+
};
|
|
425
|
+
}), h = G(), R = Q(h).signer;
|
|
426
|
+
if (!b(c.captchas, 0).datasetId)
|
|
427
|
+
throw new _("CAPTCHA.INVALID_CAPTCHA_ID", {
|
|
428
|
+
context: { error: "No datasetId set for challenge" }
|
|
429
|
+
});
|
|
430
|
+
const y = e.captchaApi;
|
|
431
|
+
if (!y)
|
|
432
|
+
throw new v("CAPTCHA.INVALID_TOKEN", {
|
|
433
|
+
context: { error: "No Captcha API found in state" }
|
|
434
|
+
});
|
|
435
|
+
if (!R || !R.signRaw)
|
|
436
|
+
throw new N("GENERAL.CANT_FIND_KEYRINGPAIR", {
|
|
437
|
+
context: {
|
|
438
|
+
error: "Signer is not defined, cannot sign message to prove account ownership"
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
const E = await R.signRaw({
|
|
442
|
+
address: h.account.address,
|
|
443
|
+
data: fe(c[w.timestamp]),
|
|
444
|
+
type: "bytes"
|
|
445
|
+
}), L = await y.submitCaptchaSolution(E.signature, c.requestHash, x, c.timestamp, c.signature.provider.requestHash), J = L[0].verified;
|
|
446
|
+
if (a({
|
|
447
|
+
submission: L,
|
|
448
|
+
isHuman: J,
|
|
449
|
+
loading: !1
|
|
450
|
+
}), e.isHuman) {
|
|
451
|
+
const O = y.provider.provider.url;
|
|
452
|
+
i.onHuman(ce({
|
|
453
|
+
[w.providerUrl]: O,
|
|
454
|
+
[w.user]: h.account.address,
|
|
455
|
+
[w.dapp]: Z(),
|
|
456
|
+
[w.commitmentId]: le(L[1]),
|
|
457
|
+
[w.timestamp]: c.timestamp,
|
|
458
|
+
[w.signature]: {
|
|
459
|
+
[w.provider]: {
|
|
460
|
+
[w.requestHash]: c.signature.provider.requestHash
|
|
461
|
+
},
|
|
462
|
+
[w.user]: {
|
|
463
|
+
[w.timestamp]: E.signature
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
})), S();
|
|
467
|
+
} else
|
|
468
|
+
i.onFailed(), P(t == null ? void 0 : t.restart);
|
|
469
|
+
}, d, P, e.attemptCount, 10);
|
|
470
|
+
}, C = async () => {
|
|
471
|
+
T(), P(t == null ? void 0 : t.restart), i.onClose();
|
|
472
|
+
}, p = async () => {
|
|
473
|
+
T(), i.onReload(), P(t == null ? void 0 : t.restart), t != null && t.restart || await d();
|
|
474
|
+
}, A = (c) => {
|
|
475
|
+
if (!e.challenge)
|
|
476
|
+
throw new v("CAPTCHA.NO_CAPTCHA", {
|
|
477
|
+
context: { error: "Cannot select, no Captcha found in state" }
|
|
478
|
+
});
|
|
479
|
+
if (e.index >= e.challenge.captchas.length || e.index < 0)
|
|
480
|
+
throw new v("CAPTCHA.NO_CAPTCHA", {
|
|
481
|
+
context: {
|
|
482
|
+
error: "Cannot select, index is out of range for this Captcha"
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
const f = e.index, x = e.solutions, h = b(x, f);
|
|
486
|
+
h.includes(c) ? h.splice(h.indexOf(c), 1) : h.push(c), a({ solutions: x });
|
|
487
|
+
}, k = () => {
|
|
488
|
+
if (!e.challenge)
|
|
489
|
+
throw new v("CAPTCHA.NO_CAPTCHA", {
|
|
490
|
+
context: { error: "Cannot select, no Captcha found in state" }
|
|
491
|
+
});
|
|
492
|
+
if (e.index + 1 >= e.challenge.captchas.length)
|
|
493
|
+
throw new v("CAPTCHA.NO_CAPTCHA", {
|
|
494
|
+
context: {
|
|
495
|
+
error: "Cannot select, index is out of range for this Captcha"
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
a({ index: e.index + 1 });
|
|
499
|
+
}, g = async (c) => {
|
|
500
|
+
const f = s();
|
|
501
|
+
if (!f.account.address)
|
|
502
|
+
throw new N("GENERAL.SITE_KEY_MISSING");
|
|
503
|
+
return new ae(c, f.account.address);
|
|
504
|
+
}, T = () => {
|
|
505
|
+
window.clearTimeout(Number(e.timeout)), a({ timeout: void 0 });
|
|
506
|
+
}, S = () => {
|
|
507
|
+
const c = r.captchas.image.solutionTimeout, f = setTimeout(() => {
|
|
508
|
+
a({ isHuman: !1 }), i.onExpired();
|
|
509
|
+
}, c);
|
|
510
|
+
a({ successfullChallengeTimeout: f });
|
|
511
|
+
}, P = (c) => {
|
|
512
|
+
T(), a(Ie()), i.onReset(), c && c();
|
|
513
|
+
}, Y = async () => {
|
|
514
|
+
const c = s();
|
|
515
|
+
if (!c.web2 && !c.userAccountAddress)
|
|
516
|
+
throw new N("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
517
|
+
context: { error: "Account address has not been set for web3 mode" }
|
|
518
|
+
});
|
|
519
|
+
const x = await (async () => {
|
|
520
|
+
const h = new (await re(c.web2))();
|
|
521
|
+
return t ? t.userAccount : await h.getAccount(c);
|
|
522
|
+
})();
|
|
523
|
+
return a({ account: x }), G();
|
|
524
|
+
}, G = () => {
|
|
525
|
+
if (!e.account)
|
|
526
|
+
throw new N("GENERAL.ACCOUNT_NOT_FOUND", {
|
|
527
|
+
context: { error: "Account not loaded" }
|
|
528
|
+
});
|
|
529
|
+
return e.account;
|
|
530
|
+
}, Z = () => {
|
|
531
|
+
if (!e.dappAccount)
|
|
532
|
+
throw new N("GENERAL.SITE_KEY_MISSING");
|
|
533
|
+
return e.dappAccount;
|
|
534
|
+
}, Q = (c) => {
|
|
535
|
+
const f = c || G();
|
|
536
|
+
if (!f.extension)
|
|
537
|
+
throw new N("ACCOUNT.NO_POLKADOT_EXTENSION", {
|
|
538
|
+
context: { error: "Extension not loaded" }
|
|
539
|
+
});
|
|
540
|
+
return f.extension;
|
|
541
|
+
};
|
|
542
|
+
return {
|
|
543
|
+
start: d,
|
|
544
|
+
cancel: C,
|
|
545
|
+
submit: u,
|
|
546
|
+
select: A,
|
|
547
|
+
nextRound: k,
|
|
548
|
+
reload: p
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
const He = se`
|
|
552
|
+
position: absolute;
|
|
553
|
+
top: 50%;
|
|
554
|
+
left: 50%;
|
|
555
|
+
transform: translate(-50%, -50%);
|
|
556
|
+
max-width: 500px;
|
|
557
|
+
background-color: transparent;
|
|
558
|
+
border: none;
|
|
559
|
+
border-radius: 4px;
|
|
560
|
+
z-index: 2147483647;
|
|
561
|
+
align-self: center;
|
|
562
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px,
|
|
563
|
+
rgba(0, 0, 0, 0.14) 0px 24px 38px 3px,
|
|
564
|
+
rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;
|
|
565
|
+
box-sizing: border-box; /* Ensures border is part of width */
|
|
566
|
+
/* iOS only */
|
|
567
|
+
@supports (-webkit-touch-callout: none) {
|
|
568
|
+
transform: translate(-50%, -100%);
|
|
569
|
+
}
|
|
570
|
+
`, j = ue.memo((r) => {
|
|
571
|
+
const { show: e, children: n } = r, t = {
|
|
572
|
+
position: "fixed",
|
|
573
|
+
zIndex: 2147483646,
|
|
574
|
+
inset: 0,
|
|
575
|
+
display: e ? "flex" : "none",
|
|
576
|
+
alignItems: "center",
|
|
577
|
+
justifyContent: "center",
|
|
578
|
+
minHeight: "100vh"
|
|
579
|
+
};
|
|
580
|
+
return pe.createPortal(l("div", { className: "prosopo-modalOuter", style: t, children: l("div", { className: "prosopo-modalInner", css: He, children: n }) }), document.body);
|
|
581
|
+
}), K = "procaptcha:execute", Se = (r) => {
|
|
582
|
+
var k;
|
|
583
|
+
const { t: e, ready: n } = V(), o = X.parse(r.config), t = r.frictionlessState, i = r.i18n, a = r.callbacks || {}, [s, d] = xe(m.useState, m.useRef), [u, C] = m.useState(!1), p = Ne(o, s, d, a, t), A = r.config.theme === "light" ? M : D;
|
|
584
|
+
return m.useEffect(() => {
|
|
585
|
+
o.language && (i ? i.language !== o.language && i.changeLanguage(o.language).then((g) => g) : he().then((g) => {
|
|
586
|
+
g.language !== o.language && g.changeLanguage(o.language).then((T) => T);
|
|
587
|
+
}));
|
|
588
|
+
}, [i, o.language]), m.useEffect(() => {
|
|
589
|
+
s.error && (C(!1), s.error.key === "CAPTCHA.NO_SESSION_FOUND" && t && setTimeout(() => {
|
|
590
|
+
t.restart();
|
|
591
|
+
}, 3e3));
|
|
592
|
+
}, [s.error, t]), m.useEffect(() => {
|
|
593
|
+
const g = (T) => {
|
|
594
|
+
if (d({
|
|
595
|
+
showModal: !0
|
|
596
|
+
}), !s.challenge && p.start)
|
|
597
|
+
try {
|
|
598
|
+
p.start();
|
|
599
|
+
} catch (S) {
|
|
600
|
+
console.error("Error starting verification:", S);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
return document.addEventListener(K, g), () => {
|
|
604
|
+
document.removeEventListener(K, g);
|
|
605
|
+
};
|
|
606
|
+
}, [p, s.challenge, d]), o.mode === "invisible" ? l(j, { show: s.showModal, children: s.challenge ? l($, { challenge: s.challenge, index: s.index, solutions: s.solutions, onSubmit: p.submit, onCancel: p.cancel, onClick: p.select, onNext: p.nextRound, onReload: p.reload, themeColor: o.theme ?? "light" }) : null }) : H("div", { className: "image-captcha", children: [l(j, { show: s.showModal, children: s.challenge ? l($, { challenge: s.challenge, index: s.index, solutions: s.solutions, onSubmit: p.submit, onCancel: p.cancel, onClick: p.select, onNext: p.nextRound, onReload: p.reload, themeColor: o.theme ?? "light" }) : l("div", { children: "No challenge set." }) }), l(ie, { theme: A, onChange: async () => {
|
|
607
|
+
u || (C(!0), await p.start(), C(!1));
|
|
608
|
+
}, checked: s.isHuman, labelText: n ? e("WIDGET.I_AM_HUMAN") : "", error: (k = s.error) == null ? void 0 : k.message, "aria-label": "human checkbox", loading: u })] });
|
|
609
|
+
};
|
|
610
|
+
export {
|
|
611
|
+
Se as default
|
|
612
|
+
};
|