@prosopo/client-bundle-example 2.5.5 → 2.7.0

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.
Files changed (105) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/assets/ProcaptchaWidget-3gKvjeiH.js +636 -0
  3. package/dist/assets/ProcaptchaWidget-D6-M7iAv.js +360 -0
  4. package/dist/assets/Signer-DP9drQ55.js +23 -0
  5. package/dist/assets/_commonjsHelpers-DaMA6jEr.js +8 -0
  6. package/dist/assets/asU8a-DCECA0Qe.js +9 -0
  7. package/dist/assets/bip39-BQoZog_M.js +365 -0
  8. package/dist/assets/browser-ponyfill-Dy1JBTMg.js +339 -0
  9. package/dist/assets/captchaComponentProvider-BW2eXmc3.js +1242 -0
  10. package/dist/assets/captchaRenderer-B_MgGzr9.js +70 -0
  11. package/dist/assets/components.d.ts +5 -0
  12. package/dist/assets/components.d.ts.map +1 -0
  13. package/dist/assets/emotion-element-5486c51c.browser.esm-CCAJ8JId.js +1805 -0
  14. package/dist/assets/fp.esm-DYWeNGcH.js +1654 -0
  15. package/dist/assets/frictionless-ZgzyuneX.js +1 -0
  16. package/dist/assets/hash-BR0YLxPF.js +1268 -0
  17. package/dist/assets/i18nFrontend-CsPT71ro.js +2273 -0
  18. package/dist/assets/index-2or4-1WF.js +596 -0
  19. package/dist/assets/index-BCjHZ8o6.js +5416 -0
  20. package/dist/assets/index-BYUYvvuq.js +81 -0
  21. package/dist/assets/index-BjRdPnnE.js +1198 -0
  22. package/dist/assets/index-QVME9Prx.js +32 -0
  23. package/dist/assets/index-WqEmiYQ_.js +4386 -0
  24. package/dist/assets/index.d.ts +16 -0
  25. package/dist/assets/index.d.ts.map +1 -0
  26. package/dist/assets/locales/ar/translation.json +56 -0
  27. package/dist/assets/locales/az/translation.json +56 -0
  28. package/dist/assets/locales/cs/translation.json +56 -0
  29. package/dist/assets/locales/de/translation.json +56 -0
  30. package/dist/assets/locales/el/translation.json +56 -0
  31. package/dist/assets/locales/en/translation.json +56 -0
  32. package/dist/assets/locales/es/translation.json +56 -0
  33. package/dist/assets/locales/fi/translation.json +56 -0
  34. package/dist/assets/locales/fr/translation.json +56 -0
  35. package/dist/assets/locales/hi/translation.json +56 -0
  36. package/dist/assets/locales/hu/translation.json +56 -0
  37. package/dist/assets/locales/id/translation.json +56 -0
  38. package/dist/assets/locales/it/translation.json +56 -0
  39. package/dist/assets/locales/ja/translation.json +56 -0
  40. package/dist/assets/locales/jv/translation.json +56 -0
  41. package/dist/assets/locales/ko/translation.json +56 -0
  42. package/dist/assets/locales/ml/translation.json +56 -0
  43. package/dist/assets/locales/ms/translation.json +56 -0
  44. package/dist/assets/locales/nl/translation.json +56 -0
  45. package/dist/assets/locales/no/translation.json +56 -0
  46. package/dist/assets/locales/pl/translation.json +56 -0
  47. package/dist/assets/locales/pt/translation.json +56 -0
  48. package/dist/assets/locales/pt-br/translation.json +56 -0
  49. package/dist/assets/locales/ro/translation.json +56 -0
  50. package/dist/assets/locales/ru/translation.json +56 -0
  51. package/dist/assets/locales/sr/translation.json +56 -0
  52. package/dist/assets/locales/sv/translation.json +56 -0
  53. package/dist/assets/locales/th/translation.json +56 -0
  54. package/dist/assets/locales/tr/translation.json +56 -0
  55. package/dist/assets/locales/uk/translation.json +56 -0
  56. package/dist/assets/locales/vi/translation.json +56 -0
  57. package/dist/assets/locales/zh-cn/translation.json +56 -0
  58. package/dist/assets/pow-BW3QYcgP.js +1 -0
  59. package/dist/assets/procaptcha.bundle.js +7 -0
  60. package/dist/assets/spread-DEmVz7RJ.js +15 -0
  61. package/dist/assets/tests/util/captchaType.test.d.ts +2 -0
  62. package/dist/assets/tests/util/captchaType.test.d.ts.map +1 -0
  63. package/dist/assets/tests/util/config.test.d.ts +2 -0
  64. package/dist/assets/tests/util/config.test.d.ts.map +1 -0
  65. package/dist/assets/tests/util/renderLogic.test.d.ts +2 -0
  66. package/dist/assets/tests/util/renderLogic.test.d.ts.map +1 -0
  67. package/dist/assets/toU8a-C68WUzs_.js +24 -0
  68. package/dist/assets/translations-DEL070wJ.js +2918 -0
  69. package/dist/assets/useTranslation-BPbGzrhj.js +158 -0
  70. package/dist/assets/util/captcha/captchaComponentProvider.d.ts +8 -0
  71. package/dist/assets/util/captcha/captchaComponentProvider.d.ts.map +1 -0
  72. package/dist/assets/util/captcha/captchaComponentsList.d.ts +6 -0
  73. package/dist/assets/util/captcha/captchaComponentsList.d.ts.map +1 -0
  74. package/dist/assets/util/captcha/captchaProps.d.ts +9 -0
  75. package/dist/assets/util/captcha/captchaProps.d.ts.map +1 -0
  76. package/dist/assets/util/captcha/captchaRenderer.d.ts +24 -0
  77. package/dist/assets/util/captcha/captchaRenderer.d.ts.map +1 -0
  78. package/dist/assets/util/captcha/captchaType.d.ts +2 -0
  79. package/dist/assets/util/captcha/captchaType.d.ts.map +1 -0
  80. package/dist/assets/util/captcha/components/frictionlessCaptcha.d.ts +4 -0
  81. package/dist/assets/util/captcha/components/frictionlessCaptcha.d.ts.map +1 -0
  82. package/dist/assets/util/captcha/components/imageCaptcha.d.ts +4 -0
  83. package/dist/assets/util/captcha/components/imageCaptcha.d.ts.map +1 -0
  84. package/dist/assets/util/captcha/components/powCaptcha.d.ts +4 -0
  85. package/dist/assets/util/captcha/components/powCaptcha.d.ts.map +1 -0
  86. package/dist/assets/util/config.d.ts +6 -0
  87. package/dist/assets/util/config.d.ts.map +1 -0
  88. package/dist/assets/util/configCreator.d.ts +5 -0
  89. package/dist/assets/util/configCreator.d.ts.map +1 -0
  90. package/dist/assets/util/language.d.ts +3 -0
  91. package/dist/assets/util/language.d.ts.map +1 -0
  92. package/dist/assets/util/timeout.d.ts +3 -0
  93. package/dist/assets/util/timeout.d.ts.map +1 -0
  94. package/dist/assets/util/widgetFactory.d.ts +18 -0
  95. package/dist/assets/util/widgetFactory.d.ts.map +1 -0
  96. package/dist/assets/util/widgetThemeResolver.d.ts +9 -0
  97. package/dist/assets/util/widgetThemeResolver.d.ts.map +1 -0
  98. package/dist/frictionless.html +1 -2
  99. package/dist/index.html +1 -1
  100. package/dist/plugins/navigation-injector.ts +1 -1
  101. package/dist/pow.html +1 -2
  102. package/package.json +7 -2
  103. package/dist/assets/captchaType-CYBmmAZe.js +0 -1
  104. package/dist/assets/frictionless-BVSPLzWe.js +0 -1
  105. package/dist/assets/pow-O0V5Dqo9.js +0 -1
@@ -0,0 +1,596 @@
1
+ function k(e, t, o) {
2
+ if (e.length === 0)
3
+ throw new Error("Array is empty");
4
+ if (!Number.isFinite(t))
5
+ throw new Error(`Index ${t} is not a finite number`);
6
+ if (t > 0 ? t = t % e.length : t = Math.ceil(Math.abs(t) / e.length) * e.length + t, t >= e.length)
7
+ throw new Error(`Index ${t} larger than array length ${e.length}`);
8
+ if (t < 0)
9
+ throw new Error(`Index ${t} smaller than 0`);
10
+ return e[t];
11
+ }
12
+ var p;
13
+ (function(e) {
14
+ e.datasetId = "datasetId", e.user = "user", e.dapp = "dapp", e.provider = "provider", e.blockNumber = "blockNumber", e.requestHash = "requestHash", e.captchas = "captchas", e.commitmentId = "commitmentId", e.proof = "proof", e.dappSignature = "dappSignature", e.dappUserSignature = "dappUserSignature", e.providerUrl = "providerUrl", e.procaptchaResponse = "procaptcha-response", e.verifiedTimeout = "verifiedTimeout", e.maxVerifiedTime = "maxVerifiedTime", e.verified = "verified", e.status = "status", e.challenge = "challenge", e.difficulty = "difficulty", e.nonce = "nonce", e.timeouts = "timeouts", e.token = "token", e.secret = "secret", e.timestamp = "timestamp", e.signature = "signature", e.error = "error", e.siteKey = "siteKey", e.captchaType = "captchaType", e.sessionId = "sessionId", e.settings = "settings", e.domains = "domains", e.frictionlessThreshold = "frictionlessThreshold", e.powDifficulty = "powDifficulty", e.score = "score", e.tier = "tier", e.detectorKey = "detectorKey";
15
+ })(p || (p = {}));
16
+ var g;
17
+ (function(e) {
18
+ e.image = "image", e.pow = "pow", e.frictionless = "frictionless";
19
+ })(g || (g = {}));
20
+ let C;
21
+ async function M(e) {
22
+ return new Promise((t, o) => {
23
+ try {
24
+ import("./i18nFrontend-CsPT71ro.js").then((n) => n.b).then(({ default: n }) => {
25
+ C || (C = n()), t(C);
26
+ });
27
+ } catch (n) {
28
+ o(n);
29
+ }
30
+ });
31
+ }
32
+ function H(e) {
33
+ const t = e.getRootNode();
34
+ return (t instanceof ShadowRoot ? t.host : e).closest("form");
35
+ }
36
+ const r = () => {
37
+ Array.from(document.getElementsByName(p.procaptchaResponse)).map((t) => t.remove());
38
+ }, m = (e) => {
39
+ const t = window[e.replace("window.", "")];
40
+ if (typeof t != "function")
41
+ throw new Error(`Callback ${e} is not defined on the window object`);
42
+ return t;
43
+ }, U = (e) => ({
44
+ onHuman: (t) => $(t, e),
45
+ onChallengeExpired: () => {
46
+ r();
47
+ },
48
+ onExtensionNotFound: () => {
49
+ console.error("Extension not found");
50
+ },
51
+ onExpired: () => {
52
+ r();
53
+ },
54
+ onError: (t) => {
55
+ r(), console.error(t);
56
+ },
57
+ onClose: () => {
58
+ },
59
+ onOpen: () => {
60
+ },
61
+ onFailed: () => {
62
+ alert("Captcha challenge failed. Please try again");
63
+ },
64
+ onReset: () => {
65
+ r();
66
+ },
67
+ onReload: () => {
68
+ }
69
+ }), s = (e, t, o) => {
70
+ const n = t.getAttribute(`data-${e}`);
71
+ if (n) {
72
+ const a = m(n);
73
+ if (a)
74
+ return a;
75
+ }
76
+ if (typeof o == "function")
77
+ return o;
78
+ if (typeof o == "string")
79
+ return m(o);
80
+ };
81
+ function F(e, t, o) {
82
+ const n = s("callback", o, e == null ? void 0 : e.callback);
83
+ n && (t.onHuman = (u) => {
84
+ $(u, o), n(u);
85
+ });
86
+ const a = s("chalexpired-callback", o, e == null ? void 0 : e["chalexpired-callback"]);
87
+ a && (t.onChallengeExpired = () => {
88
+ r(), a();
89
+ });
90
+ const c = s("expired-callback", o, e == null ? void 0 : e["expired-callback"]);
91
+ c && (t.onExpired = () => {
92
+ r(), c();
93
+ });
94
+ const i = s("error-callback", o, e == null ? void 0 : e["error-callback"]);
95
+ i && (t.onError = (u) => {
96
+ r(), i(u);
97
+ });
98
+ const l = s("close-callback", o, e == null ? void 0 : e["close-callback"]);
99
+ l && (t.onClose = () => {
100
+ l();
101
+ });
102
+ const x = s("open-callback", o, e == null ? void 0 : e["open-callback"]);
103
+ x && (t.onOpen = () => {
104
+ x();
105
+ });
106
+ const v = s("failed-callback", o, e == null ? void 0 : e["failed-callback"]);
107
+ v && (t.onFailed = () => {
108
+ v();
109
+ });
110
+ const h = s("reset-callback", o, e == null ? void 0 : e["reset-callback"]);
111
+ h && (t.onReset = () => {
112
+ r(), h();
113
+ });
114
+ }
115
+ const $ = (e, t) => {
116
+ if (r(), t) {
117
+ const o = H(t);
118
+ if (!o) {
119
+ console.error("Parent form not found for the element:", t);
120
+ return;
121
+ }
122
+ const n = document.createElement("input");
123
+ n.type = "hidden", n.name = p.procaptchaResponse, n.value = e, o.appendChild(n);
124
+ }
125
+ }, G = "https://prosopo.io", I = "Visit prosopo.io to learn more about the service and its accessibility options.", j = 74, _ = 80, z = "80px", T = "302px", B = "8px", K = "2px", q = "1px solid", S = "checkbox__loading-spinner";
126
+ function A(e) {
127
+ const t = document.createElement("div");
128
+ return t.className = "checkbox", t.innerHTML = Y(e) + X, t;
129
+ }
130
+ const V = (e) => (e.shadowRoot || e).querySelector(".checkbox__content"), X = `
131
+ <div class="checkbox__outer">
132
+ <div class="checkbox__wrapper">
133
+ <div class="checkbox__inner">
134
+ <div class="checkbox__content">
135
+ <div class="${S}" aria-label="Loading spinner"></div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </div>
140
+ `, Y = (e) => `
141
+ <style>
142
+ .checkbox {
143
+ display: flex;
144
+ flex-direction: column;
145
+ }
146
+
147
+ .checkbox__outer {
148
+ align-items: center;
149
+ flex: 1;
150
+ }
151
+
152
+ .checkbox__wrapper {
153
+ display: flex;
154
+ align-items: center;
155
+ justify-content: center;
156
+ flex-direction: column;
157
+ vertical-align: middle;
158
+ }
159
+
160
+ .checkbox__inner {
161
+ display: flex;
162
+ }
163
+
164
+ .checkbox__content {
165
+ display: inline-flex;
166
+ }
167
+
168
+ .${S} {
169
+ margin-top: 0;
170
+ margin-left: 15px;
171
+ margin-right: 15px;
172
+ width: 2em;
173
+ height: 2em;
174
+ border: 4px solid ${e.palette.background.contrastText};
175
+ border-bottom-color: transparent;
176
+ border-radius: 50%;
177
+ display: inherit;
178
+ box-sizing: border-box;
179
+ animation: checkbox__loading-spinner-rotation 1s linear infinite;
180
+ will-change: transform;
181
+ }
182
+
183
+ @keyframes ${S}-rotation {
184
+ 0% {
185
+ transform: rotate(0deg);
186
+ }
187
+ 100% {
188
+ transform: rotate(360deg);
189
+ }
190
+ }
191
+ </style>
192
+ `;
193
+ function Z(e) {
194
+ const t = document.createElement("div");
195
+ return t.className = "logo", t.innerHTML = J + Q(e), t;
196
+ }
197
+ const J = `
198
+ <style>
199
+ .logo {
200
+ display: inline-flex;
201
+ flex-direction: column;
202
+ }
203
+
204
+ .prosopo-logo {
205
+ display: inline-flex;
206
+ flex-direction: column; /* ✅ Stack vertically */
207
+ align-items: center; /* ✅ Center horizontally */
208
+ justify-content: center; /* ✅ Optional: center vertically if needed */
209
+ padding: 8px;
210
+ height: auto;
211
+ min-width: max-content;
212
+ gap: 2px; /* ✅ Space between SVG and text */
213
+ }
214
+
215
+ .prosopo-logo-text {
216
+ all: unset;
217
+ font-size: 9px !important;
218
+ font-weight: bold !important;
219
+ font-family: Helvetica Neue, Helvetica, Arial, sans-serif !important;
220
+ line-height: 1 !important;
221
+ text-align: center;
222
+ }
223
+
224
+ #logo {
225
+ width: 28px;
226
+ height: 28px;
227
+ }
228
+
229
+ </style>
230
+ `;
231
+ function Q(e) {
232
+ return `
233
+ <a href="${G}?utm_campaign=widget" tabindex="0" target="_blank" role="button"
234
+ aria-label="${I}"
235
+ style="text-decoration: none;">
236
+ <div class="prosopo-logo">
237
+ <svg id="logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 49.010001 49.009997" style="fill: ${e.palette.logoFill};"
238
+ aria-label="Prosopo Logo With Text">
239
+ <title>${I}</title>
240
+ <g transform="matrix(0.11319331,0,0,0.11319331,6.504999,-2.2052113e-4)">
241
+ <g>
242
+ <path d="m 119.79,50.5 a 147.75,147.75 0 0 1 147.75,147.75 h 50.5 C 318.04,88.76 229.28,0 119.79,0 Z"></path>
243
+ <path d="m 53.6,116.7 a 147.74,147.74 0 0 1 147.74,147.74 h 50.5 C 251.84,154.95 163.09,66.2 53.6,66.2 Z"></path>
244
+ <path d="M 198.24,382.48 A 147.75,147.75 0 0 1 50.5,234.74 H 0 c 0,109.49 88.75,198.24 198.24,198.24 z"></path>
245
+ <path d="M 264.41,316.31 A 147.74,147.74 0 0 1 116.67,168.56 H 66.16 c 0,109.49 88.76,198.25 198.25,198.25 z"></path>
246
+ </g>
247
+ </g>
248
+ </svg>
249
+ <span class="prosopo-logo-text" id="logo-text" style="color: ${e.palette.logoFill};">
250
+ Prosopo
251
+ </span>
252
+ </div>
253
+ </a>
254
+ `;
255
+ }
256
+ function P(e) {
257
+ var a, c;
258
+ const t = document.createElement("div");
259
+ t.className = "widget";
260
+ const o = A(e), n = Z(e);
261
+ return t.innerHTML = ee(e) + O(oe()), (a = t.querySelector(".widget__checkbox")) == null || a.replaceWith(o), (c = t.querySelector(".widget__logo")) == null || c.replaceWith(n), t;
262
+ }
263
+ function O(e) {
264
+ return `
265
+ <div class="widget__outer">
266
+ <div class="widget__wrapper">
267
+ <div class="widget__inner">
268
+ <div class="widget__dimensions" ${e ? 'data-cy="captcha-checkbox"' : ""}>
269
+ <div class="widget__content">
270
+ <div class="widget__checkbox"></div>
271
+ <div class="widget__logo"></div>
272
+ </div>
273
+ </div>
274
+ </div>
275
+ </div>
276
+ </div>
277
+ `;
278
+ }
279
+ function ee(e) {
280
+ return `
281
+ <style>
282
+ .widget {
283
+ width: 100%;
284
+ min-height: ${z}
285
+ }
286
+
287
+ .widget__outer {
288
+ max-width: ${T};
289
+ min-height: 100%;
290
+ overflow-x: auto;
291
+ width: 100%;
292
+ font-family: ${e.font.fontFamily};
293
+ color: ${e.font.color};
294
+ }
295
+
296
+ .widget__wrapper {
297
+ container-type: size;
298
+ container-name: widget;
299
+ display: flex;
300
+ flex-direction: column;
301
+ height: ${_}px;
302
+ min-width: 220px;
303
+ }
304
+
305
+ .widget__inner {
306
+ max-height: 100%;
307
+ min-width: 100%;
308
+ overflow: hidden;
309
+ height: ${_}px;
310
+ width: 100%;
311
+ display: grid;
312
+ }
313
+
314
+ .widget__dimensions {
315
+ max-width: ${T};
316
+ min-height: ${_}px;
317
+ }
318
+
319
+ .widget__content {
320
+ padding: ${K};
321
+ border: ${q};
322
+ background-color: ${e.palette.background.default};
323
+ border-color: ${e.palette.grey[300]};
324
+ border-radius: ${B};
325
+ display: flex;
326
+ align-items: center;
327
+ flex-wrap: wrap;
328
+ justify-content: space-between;
329
+ min-height: ${j}px;
330
+ overflow: hidden;
331
+ }
332
+ </style>
333
+ `;
334
+ }
335
+ function te() {
336
+ var t;
337
+ return typeof process < "u" ? "production" : (t = import.meta.env) == null ? void 0 : t.MODE;
338
+ }
339
+ const oe = () => te() !== "production", ne = 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
340
+ function ae(e, t = "") {
341
+ const o = document.createElement(e);
342
+ ie(o);
343
+ const n = o.attachShadow({ mode: "open" });
344
+ return n.innerHTML = ce(t), o;
345
+ }
346
+ const ce = (e) => `
347
+ <style>
348
+ *{font-family: ${ne};}
349
+ </style>
350
+
351
+ <style>
352
+ ${e}
353
+ </style>
354
+ `, ie = (e) => {
355
+ e.style.display = "flex", e.style.flexDirection = "column", e.style.width = "100%", e.style.maxWidth = T;
356
+ };
357
+ function re(e, t, o) {
358
+ const n = P(t), a = ae(o);
359
+ le(a).appendChild(n), e.innerHTML = "", e.appendChild(a);
360
+ const i = V(a);
361
+ if (!(i instanceof HTMLElement))
362
+ throw new Error("Fail to initialize widget: interactive area is not found");
363
+ return i;
364
+ }
365
+ const le = (e) => e.shadowRoot || e, b = {
366
+ 0: "#fff",
367
+ 100: "#f5f5f5",
368
+ 200: "#eeeeee",
369
+ 300: "#e0e0e0",
370
+ 400: "#bdbdbd",
371
+ 500: "#9e9e9e",
372
+ 600: "#757575",
373
+ 700: "#616161",
374
+ 800: "#424242",
375
+ 900: "#212121"
376
+ }, y = 10, se = {
377
+ palette: {
378
+ mode: "light",
379
+ primary: {
380
+ main: "#487DFA",
381
+ contrastText: "#fff"
382
+ },
383
+ background: {
384
+ default: "#fff",
385
+ contrastText: "#000"
386
+ },
387
+ border: b[400],
388
+ error: {
389
+ main: "#f44336"
390
+ },
391
+ logoFill: "#1d1d1b",
392
+ grey: b
393
+ },
394
+ spacing: {
395
+ unit: y,
396
+ half: Math.floor(y / 2)
397
+ },
398
+ font: {
399
+ fontFamily: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
400
+ color: "#000"
401
+ }
402
+ }, de = {
403
+ palette: {
404
+ mode: "dark",
405
+ primary: {
406
+ main: "#487DFA",
407
+ contrastText: "#fff"
408
+ },
409
+ background: {
410
+ default: "#303030",
411
+ contrastText: "#fff"
412
+ },
413
+ border: b[300],
414
+ error: {
415
+ main: "#f44336"
416
+ },
417
+ logoFill: "#fff",
418
+ grey: b
419
+ },
420
+ spacing: {
421
+ unit: y,
422
+ half: Math.floor(y / 2)
423
+ },
424
+ font: {
425
+ fontFamily: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
426
+ color: "#fff"
427
+ }
428
+ };
429
+ function W(e) {
430
+ return Object.values(g).find((n) => n === k(e, 0).getAttribute("data-captcha-type")) || "frictionless";
431
+ }
432
+ const R = (e) => document.querySelector('script[src*="'.concat(e, '"]')), he = (e) => {
433
+ const t = R(e);
434
+ if (t && t.src.indexOf("".concat(e)) !== -1) {
435
+ const o = new URLSearchParams(t.src.split("?")[1]);
436
+ return {
437
+ onloadUrlCallback: o.get("onload") || void 0,
438
+ renderExplicit: o.get("render") || void 0
439
+ };
440
+ }
441
+ return { onloadUrlCallback: void 0, renderExplicit: void 0 };
442
+ };
443
+ class fe {
444
+ constructor(t) {
445
+ this.widgetThemeResolver = t, this.captchaRenderer = null, this._i18n = null;
446
+ }
447
+ get i18n() {
448
+ if (this._i18n === null)
449
+ throw new Error("I18n is not initialized");
450
+ return this._i18n;
451
+ }
452
+ async createWidgets(t, o, n = !0, a = !1) {
453
+ return Promise.all(t.map((c) => {
454
+ const i = U(c);
455
+ return F(o, i, c), this.createWidget(c, o, i, n, a);
456
+ }));
457
+ }
458
+ async createWidget(t, o, n, a = !0, c = !1) {
459
+ o.theme = this.widgetThemeResolver.resolveWidgetTheme(t, o);
460
+ const i = o.theme === "light" ? se : de;
461
+ let l;
462
+ if (c) {
463
+ const h = document.createElement("div");
464
+ t.appendChild(h), l = h;
465
+ } else
466
+ l = re(t, i, "prosopo-procaptcha");
467
+ return (await this.getCaptchaRenderer()).renderCaptcha({
468
+ identifierPrefix: "procaptcha-",
469
+ emotionCacheKey: "procaptcha",
470
+ webComponentTag: "prosopo-procaptcha",
471
+ defaultCaptchaType: g.frictionless
472
+ }, l, o, n, a, this.i18n, c);
473
+ }
474
+ async getCaptchaRenderer() {
475
+ return this._i18n === null && (this._i18n = await M()), this.captchaRenderer === null && (this.captchaRenderer = await this.createCaptchaRenderer()), this.captchaRenderer;
476
+ }
477
+ async createCaptchaRenderer() {
478
+ const t = (await import("./captchaRenderer-B_MgGzr9.js")).CaptchaRenderer, o = (await import("./captchaComponentProvider-BW2eXmc3.js").then((n) => n.h)).CaptchaComponentProvider;
479
+ return new t(new o());
480
+ }
481
+ }
482
+ class ue {
483
+ constructor() {
484
+ this.themesSet = /* @__PURE__ */ new Set(["light", "dark"]), this.defaultTheme = "light";
485
+ }
486
+ resolveWidgetTheme(t, o) {
487
+ const n = o.theme || t.getAttribute("data-theme") || this.defaultTheme;
488
+ return this.validateTheme(n);
489
+ }
490
+ validateTheme(t) {
491
+ return this.themesSet.has(t) ? t : this.defaultTheme;
492
+ }
493
+ }
494
+ const E = "procaptcha.bundle.js";
495
+ let d = [];
496
+ const w = new fe(new ue()), pe = "procaptcha:execute", D = async () => {
497
+ const e = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() !== "button");
498
+ if (e.length) {
499
+ const o = k(e, 0).getAttribute("data-sitekey"), n = k(e, 0).getAttribute("data-web3");
500
+ if (!o) {
501
+ console.error("No siteKey found");
502
+ return;
503
+ }
504
+ const a = W(e), c = await w.createWidgets(e, {
505
+ captchaType: a,
506
+ siteKey: o
507
+ }, n !== "true");
508
+ d.push(...c);
509
+ }
510
+ const t = Array.from(document.getElementsByClassName("procaptcha")).filter((o) => o.tagName.toLowerCase() === "button");
511
+ if (t.length)
512
+ for (const o of t) {
513
+ const n = o.getAttribute("data-sitekey") || "", a = o.getAttribute("data-callback") || "", c = W([o]), i = await w.createWidgets([o], {
514
+ captchaType: c,
515
+ siteKey: n,
516
+ callback: a
517
+ }, !0, !0);
518
+ d.push(...i), o.addEventListener("click", async (l) => {
519
+ l.preventDefault(), L();
520
+ });
521
+ }
522
+ }, ge = async (e, t) => {
523
+ if (Object.prototype.hasOwnProperty.call(t, "size") && t.size === "invisible" || e.tagName.toLowerCase() === "button") {
524
+ const a = await w.createWidgets([e], t, !0, !0);
525
+ d.push(...a);
526
+ return;
527
+ }
528
+ const n = await w.createWidgets([e], t);
529
+ d.push(...n);
530
+ };
531
+ function f(e) {
532
+ document && document.readyState !== "loading" ? e() : document.addEventListener("DOMContentLoaded", () => {
533
+ e();
534
+ });
535
+ }
536
+ const L = () => {
537
+ var e;
538
+ const t = me();
539
+ if (t.length === 0) {
540
+ console.error("No Procaptcha containers found for execution");
541
+ return;
542
+ }
543
+ const o = new CustomEvent(pe, {
544
+ detail: {
545
+ containerId: ((e = t[0]) == null ? void 0 : e.id) || "procaptcha-container",
546
+ containerCount: t.length,
547
+ timestamp: Date.now()
548
+ },
549
+ bubbles: !0,
550
+ cancelable: !0
551
+ });
552
+ document.dispatchEvent(o);
553
+ };
554
+ function me() {
555
+ const e = [], t = Array.from(document.querySelectorAll('[data-size="invisible"]'));
556
+ e.push(...t);
557
+ const o = Array.from(document.querySelectorAll('#procaptcha-container, [id$="-procaptcha-container"]')), n = Array.from(document.getElementsByClassName("p-procaptcha"));
558
+ e.push(...n);
559
+ for (const a of o)
560
+ e.includes(a) || e.push(a);
561
+ return e;
562
+ }
563
+ const N = () => {
564
+ var e, t;
565
+ const { onloadUrlCallback: o, renderExplicit: n } = he(E);
566
+ let a = !1;
567
+ if (n !== "explicit" && ((e = R(E)) == null || e.addEventListener("load", () => {
568
+ f(D), a = !0;
569
+ }), document.readyState === "complete" && !a && f(D)), o && ((t = R(E)) == null || t.addEventListener("load", () => {
570
+ const c = m(o);
571
+ f(c);
572
+ }), document.readyState === "complete" && !a)) {
573
+ const c = m(o);
574
+ f(c);
575
+ }
576
+ }, be = () => {
577
+ for (const e of d)
578
+ e.unmount();
579
+ d = [], N();
580
+ };
581
+ window.procaptcha = { ready: f, render: ge, reset: be, execute: L };
582
+ N();
583
+ export {
584
+ p as A,
585
+ g as C,
586
+ S as W,
587
+ k as a,
588
+ se as b,
589
+ f as c,
590
+ de as d,
591
+ L as e,
592
+ be as f,
593
+ U as g,
594
+ M as l,
595
+ ge as r
596
+ };