altcha 0.4.3 → 0.5.1

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/dist/altcha.js CHANGED
@@ -1,208 +1,227 @@
1
- var nt = Object.defineProperty;
2
- var it = (r, e, t) => e in r ? nt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var T = (r, e, t) => (it(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- function q() {
1
+ var ot = Object.defineProperty;
2
+ var lt = (t, e, r) => e in t ? ot(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var T = (t, e, r) => lt(t, typeof e != "symbol" ? e + "" : e, r);
4
+ const Ge = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK", st = (t) => Uint8Array.from(atob(t), (e) => e.charCodeAt(0)), ze = typeof window < "u" && window.Blob && new Blob([st(Ge)], { type: "text/javascript;charset=utf-8" });
5
+ function ct(t) {
6
+ let e;
7
+ try {
8
+ if (e = ze && (window.URL || window.webkitURL).createObjectURL(ze), !e) throw "";
9
+ const r = new Worker(e, {
10
+ name: t == null ? void 0 : t.name
11
+ });
12
+ return r.addEventListener("error", () => {
13
+ (window.URL || window.webkitURL).revokeObjectURL(e);
14
+ }), r;
15
+ } catch {
16
+ return new Worker(
17
+ "data:text/javascript;base64," + Ge,
18
+ {
19
+ name: t == null ? void 0 : t.name
20
+ }
21
+ );
22
+ } finally {
23
+ e && (window.URL || window.webkitURL).revokeObjectURL(e);
24
+ }
25
+ }
26
+ function ee() {
5
27
  }
6
- function Ve(r) {
7
- return r();
28
+ function De(t) {
29
+ return t();
8
30
  }
9
- function Ie() {
31
+ function Ne() {
10
32
  return /* @__PURE__ */ Object.create(null);
11
33
  }
12
- function re(r) {
13
- r.forEach(Ve);
34
+ function re(t) {
35
+ t.forEach(De);
14
36
  }
15
- function Ue(r) {
16
- return typeof r == "function";
37
+ function Xe(t) {
38
+ return typeof t == "function";
17
39
  }
18
- function ot(r, e) {
19
- return r != r ? e == e : r !== e || r && typeof r == "object" || typeof r == "function";
40
+ function at(t, e) {
41
+ return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
20
42
  }
21
- function lt(r) {
22
- return Object.keys(r).length === 0;
43
+ function ft(t) {
44
+ return Object.keys(t).length === 0;
23
45
  }
24
- function v(r, e) {
25
- r.appendChild(e);
46
+ function v(t, e) {
47
+ t.appendChild(e);
26
48
  }
27
- function st(r, e, t) {
28
- const i = ct(r);
49
+ function ut(t, e, r) {
50
+ const i = ht(t);
29
51
  if (!i.getElementById(e)) {
30
52
  const o = R("style");
31
- o.id = e, o.textContent = t, at(i, o);
53
+ o.id = e, o.textContent = r, dt(i, o);
32
54
  }
33
55
  }
34
- function ct(r) {
35
- if (!r)
36
- return document;
37
- const e = r.getRootNode ? r.getRootNode() : r.ownerDocument;
56
+ function ht(t) {
57
+ if (!t) return document;
58
+ const e = t.getRootNode ? t.getRootNode() : t.ownerDocument;
38
59
  return e && /** @type {ShadowRoot} */
39
60
  e.host ? (
40
61
  /** @type {ShadowRoot} */
41
62
  e
42
- ) : r.ownerDocument;
63
+ ) : t.ownerDocument;
43
64
  }
44
- function at(r, e) {
65
+ function dt(t, e) {
45
66
  return v(
46
67
  /** @type {Document} */
47
- r.head || r,
68
+ t.head || t,
48
69
  e
49
70
  ), e.sheet;
50
71
  }
51
- function j(r, e, t) {
52
- r.insertBefore(e, t || null);
72
+ function S(t, e, r) {
73
+ t.insertBefore(e, r || null);
53
74
  }
54
- function N(r) {
55
- r.parentNode && r.parentNode.removeChild(r);
75
+ function N(t) {
76
+ t.parentNode && t.parentNode.removeChild(t);
56
77
  }
57
- function R(r) {
58
- return document.createElement(r);
78
+ function R(t) {
79
+ return document.createElement(t);
59
80
  }
60
- function O(r) {
61
- return document.createElementNS("http://www.w3.org/2000/svg", r);
81
+ function O(t) {
82
+ return document.createElementNS("http://www.w3.org/2000/svg", t);
62
83
  }
63
- function ft(r) {
64
- return document.createTextNode(r);
84
+ function mt(t) {
85
+ return document.createTextNode(t);
65
86
  }
66
87
  function B() {
67
- return ft(" ");
88
+ return mt(" ");
68
89
  }
69
- function ae(r, e, t, i) {
70
- return r.addEventListener(e, t, i), () => r.removeEventListener(e, t, i);
90
+ function fe(t, e, r, i) {
91
+ return t.addEventListener(e, r, i), () => t.removeEventListener(e, r, i);
71
92
  }
72
- function c(r, e, t) {
73
- t == null ? r.removeAttribute(e) : r.getAttribute(e) !== t && r.setAttribute(e, t);
93
+ function c(t, e, r) {
94
+ r == null ? t.removeAttribute(e) : t.getAttribute(e) !== r && t.setAttribute(e, r);
74
95
  }
75
- function ut(r) {
76
- return Array.from(r.childNodes);
96
+ function gt(t) {
97
+ return Array.from(t.childNodes);
77
98
  }
78
- function ze(r, e, t) {
79
- r.classList.toggle(e, !!t);
99
+ function Ae(t, e, r) {
100
+ t.classList.toggle(e, !!r);
80
101
  }
81
- function ht(r, e, { bubbles: t = !1, cancelable: i = !1 } = {}) {
82
- return new CustomEvent(r, { detail: e, bubbles: t, cancelable: i });
102
+ function bt(t, e, { bubbles: r = !1, cancelable: i = !1 } = {}) {
103
+ return new CustomEvent(t, { detail: e, bubbles: r, cancelable: i });
83
104
  }
84
- function dt(r) {
105
+ function yt(t) {
85
106
  const e = {};
86
- return r.childNodes.forEach(
107
+ return t.childNodes.forEach(
87
108
  /** @param {Element} node */
88
- (t) => {
89
- e[t.slot || "default"] = !0;
109
+ (r) => {
110
+ e[r.slot || "default"] = !0;
90
111
  }
91
112
  ), e;
92
113
  }
93
114
  let te;
94
- function ee(r) {
95
- te = r;
115
+ function q(t) {
116
+ te = t;
96
117
  }
97
- function me() {
98
- if (!te)
99
- throw new Error("Function called outside component initialization");
118
+ function ge() {
119
+ if (!te) throw new Error("Function called outside component initialization");
100
120
  return te;
101
121
  }
102
- function mt(r) {
103
- me().$$.on_mount.push(r);
122
+ function vt(t) {
123
+ ge().$$.on_mount.push(t);
104
124
  }
105
- function gt(r) {
106
- me().$$.on_destroy.push(r);
125
+ function wt(t) {
126
+ ge().$$.on_destroy.push(t);
107
127
  }
108
- function bt() {
109
- const r = me();
110
- return (e, t, { cancelable: i = !1 } = {}) => {
111
- const o = r.$$.callbacks[e];
128
+ function _t() {
129
+ const t = ge();
130
+ return (e, r, { cancelable: i = !1 } = {}) => {
131
+ const o = t.$$.callbacks[e];
112
132
  if (o) {
113
- const l = ht(
133
+ const l = bt(
114
134
  /** @type {string} */
115
135
  e,
116
- t,
136
+ r,
117
137
  { cancelable: i }
118
138
  );
119
139
  return o.slice().forEach((s) => {
120
- s.call(r, l);
140
+ s.call(t, l);
121
141
  }), !l.defaultPrevented;
122
142
  }
123
143
  return !0;
124
144
  };
125
145
  }
126
- const J = [], ue = [];
146
+ const J = [], he = [];
127
147
  let Q = [];
128
- const Ne = [], Ge = /* @__PURE__ */ Promise.resolve();
129
- let he = !1;
130
- function De() {
131
- he || (he = !0, Ge.then($));
148
+ const Se = [], Oe = /* @__PURE__ */ Promise.resolve();
149
+ let de = !1;
150
+ function Fe() {
151
+ de || (de = !0, Oe.then(_));
132
152
  }
133
- function yt() {
134
- return De(), Ge;
153
+ function pt() {
154
+ return Fe(), Oe;
135
155
  }
136
- function de(r) {
137
- Q.push(r);
156
+ function me(t) {
157
+ Q.push(t);
138
158
  }
139
- const fe = /* @__PURE__ */ new Set();
159
+ const ue = /* @__PURE__ */ new Set();
140
160
  let K = 0;
141
- function $() {
161
+ function _() {
142
162
  if (K !== 0)
143
163
  return;
144
- const r = te;
164
+ const t = te;
145
165
  do {
146
166
  try {
147
167
  for (; K < J.length; ) {
148
168
  const e = J[K];
149
- K++, ee(e), vt(e.$$);
169
+ K++, q(e), kt(e.$$);
150
170
  }
151
171
  } catch (e) {
152
172
  throw J.length = 0, K = 0, e;
153
173
  }
154
- for (ee(null), J.length = 0, K = 0; ue.length; )
155
- ue.pop()();
174
+ for (q(null), J.length = 0, K = 0; he.length; ) he.pop()();
156
175
  for (let e = 0; e < Q.length; e += 1) {
157
- const t = Q[e];
158
- fe.has(t) || (fe.add(t), t());
176
+ const r = Q[e];
177
+ ue.has(r) || (ue.add(r), r());
159
178
  }
160
179
  Q.length = 0;
161
180
  } while (J.length);
162
- for (; Ne.length; )
163
- Ne.pop()();
164
- he = !1, fe.clear(), ee(r);
181
+ for (; Se.length; )
182
+ Se.pop()();
183
+ de = !1, ue.clear(), q(t);
165
184
  }
166
- function vt(r) {
167
- if (r.fragment !== null) {
168
- r.update(), re(r.before_update);
169
- const e = r.dirty;
170
- r.dirty = [-1], r.fragment && r.fragment.p(r.ctx, e), r.after_update.forEach(de);
185
+ function kt(t) {
186
+ if (t.fragment !== null) {
187
+ t.update(), re(t.before_update);
188
+ const e = t.dirty;
189
+ t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(me);
171
190
  }
172
191
  }
173
- function wt(r) {
174
- const e = [], t = [];
175
- Q.forEach((i) => r.indexOf(i) === -1 ? e.push(i) : t.push(i)), t.forEach((i) => i()), Q = e;
192
+ function xt(t) {
193
+ const e = [], r = [];
194
+ Q.forEach((i) => t.indexOf(i) === -1 ? e.push(i) : r.push(i)), r.forEach((i) => i()), Q = e;
176
195
  }
177
- const pt = /* @__PURE__ */ new Set();
178
- function _t(r, e) {
179
- r && r.i && (pt.delete(r), r.i(e));
196
+ const Et = /* @__PURE__ */ new Set();
197
+ function $t(t, e) {
198
+ t && t.i && (Et.delete(t), t.i(e));
180
199
  }
181
- function kt(r, e, t) {
182
- const { fragment: i, after_update: o } = r.$$;
183
- i && i.m(e, t), de(() => {
184
- const l = r.$$.on_mount.map(Ve).filter(Ue);
185
- r.$$.on_destroy ? r.$$.on_destroy.push(...l) : re(l), r.$$.on_mount = [];
186
- }), o.forEach(de);
200
+ function Ct(t, e, r) {
201
+ const { fragment: i, after_update: o } = t.$$;
202
+ i && i.m(e, r), me(() => {
203
+ const l = t.$$.on_mount.map(De).filter(Xe);
204
+ t.$$.on_destroy ? t.$$.on_destroy.push(...l) : re(l), t.$$.on_mount = [];
205
+ }), o.forEach(me);
187
206
  }
188
- function xt(r, e) {
189
- const t = r.$$;
190
- t.fragment !== null && (wt(t.after_update), re(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
207
+ function Lt(t, e) {
208
+ const r = t.$$;
209
+ r.fragment !== null && (xt(r.after_update), re(r.on_destroy), r.fragment && r.fragment.d(e), r.on_destroy = r.fragment = null, r.ctx = []);
191
210
  }
192
- function Et(r, e) {
193
- r.$$.dirty[0] === -1 && (J.push(r), De(), r.$$.dirty.fill(0)), r.$$.dirty[e / 31 | 0] |= 1 << e % 31;
211
+ function Rt(t, e) {
212
+ t.$$.dirty[0] === -1 && (J.push(t), Fe(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
194
213
  }
195
- function $t(r, e, t, i, o, l, s = null, f = [-1]) {
214
+ function It(t, e, r, i, o, l, s = null, f = [-1]) {
196
215
  const a = te;
197
- ee(r);
198
- const h = r.$$ = {
216
+ q(t);
217
+ const u = t.$$ = {
199
218
  fragment: null,
200
219
  ctx: [],
201
220
  // state
202
221
  props: l,
203
- update: q,
222
+ update: ee,
204
223
  not_equal: o,
205
- bound: Ie(),
224
+ bound: Ne(),
206
225
  // lifecycle
207
226
  on_mount: [],
208
227
  on_destroy: [],
@@ -211,29 +230,29 @@ function $t(r, e, t, i, o, l, s = null, f = [-1]) {
211
230
  after_update: [],
212
231
  context: new Map(e.context || (a ? a.$$.context : [])),
213
232
  // everything else
214
- callbacks: Ie(),
233
+ callbacks: Ne(),
215
234
  dirty: f,
216
235
  skip_bound: !1,
217
236
  root: e.target || a.$$.root
218
237
  };
219
- s && s(h.root);
220
- let Z = !1;
221
- if (h.ctx = t ? t(r, e.props || {}, (C, M, ...V) => {
238
+ s && s(u.root);
239
+ let j = !1;
240
+ if (u.ctx = r ? r(t, e.props || {}, (C, M, ...V) => {
222
241
  const D = V.length ? V[0] : M;
223
- return h.ctx && o(h.ctx[C], h.ctx[C] = D) && (!h.skip_bound && h.bound[C] && h.bound[C](D), Z && Et(r, C)), M;
224
- }) : [], h.update(), Z = !0, re(h.before_update), h.fragment = i ? i(h.ctx) : !1, e.target) {
242
+ return u.ctx && o(u.ctx[C], u.ctx[C] = D) && (!u.skip_bound && u.bound[C] && u.bound[C](D), j && Rt(t, C)), M;
243
+ }) : [], u.update(), j = !0, re(u.before_update), u.fragment = i ? i(u.ctx) : !1, e.target) {
225
244
  if (e.hydrate) {
226
- const C = ut(e.target);
227
- h.fragment && h.fragment.l(C), C.forEach(N);
245
+ const C = gt(e.target);
246
+ u.fragment && u.fragment.l(C), C.forEach(N);
228
247
  } else
229
- h.fragment && h.fragment.c();
230
- e.intro && _t(r.$$.fragment), kt(r, e.target, e.anchor), $();
248
+ u.fragment && u.fragment.c();
249
+ e.intro && $t(t.$$.fragment), Ct(t, e.target, e.anchor), _();
231
250
  }
232
- ee(a);
251
+ q(a);
233
252
  }
234
- let Xe;
235
- typeof HTMLElement == "function" && (Xe = class extends HTMLElement {
236
- constructor(e, t, i) {
253
+ let He;
254
+ typeof HTMLElement == "function" && (He = class extends HTMLElement {
255
+ constructor(e, r, i) {
237
256
  super();
238
257
  /** The Svelte component constructor */
239
258
  T(this, "$$ctor");
@@ -253,19 +272,19 @@ typeof HTMLElement == "function" && (Xe = class extends HTMLElement {
253
272
  T(this, "$$l", {});
254
273
  /** @type {Map<Function, Function>} Event listener unsubscribe functions */
255
274
  T(this, "$$l_u", /* @__PURE__ */ new Map());
256
- this.$$ctor = e, this.$$s = t, i && this.attachShadow({ mode: "open" });
275
+ this.$$ctor = e, this.$$s = r, i && this.attachShadow({ mode: "open" });
257
276
  }
258
- addEventListener(e, t, i) {
259
- if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
260
- const o = this.$$c.$on(e, t);
261
- this.$$l_u.set(t, o);
277
+ addEventListener(e, r, i) {
278
+ if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(r), this.$$c) {
279
+ const o = this.$$c.$on(e, r);
280
+ this.$$l_u.set(r, o);
262
281
  }
263
- super.addEventListener(e, t, i);
282
+ super.addEventListener(e, r, i);
264
283
  }
265
- removeEventListener(e, t, i) {
266
- if (super.removeEventListener(e, t, i), this.$$c) {
267
- const o = this.$$l_u.get(t);
268
- o && (o(), this.$$l_u.delete(t));
284
+ removeEventListener(e, r, i) {
285
+ if (super.removeEventListener(e, r, i), this.$$c) {
286
+ const o = this.$$l_u.get(r);
287
+ o && (o(), this.$$l_u.delete(r));
269
288
  }
270
289
  }
271
290
  async connectedCallback() {
@@ -281,20 +300,20 @@ typeof HTMLElement == "function" && (Xe = class extends HTMLElement {
281
300
  * @param {HTMLElement} target
282
301
  * @param {HTMLElement} [anchor]
283
302
  */
284
- m: function(h, Z) {
285
- j(h, s, Z);
303
+ m: function(u, j) {
304
+ S(u, s, j);
286
305
  },
287
- d: function(h) {
288
- h && N(s);
306
+ d: function(u) {
307
+ u && N(s);
289
308
  }
290
309
  };
291
310
  };
292
311
  };
293
312
  if (await Promise.resolve(), !this.$$cn || this.$$c)
294
313
  return;
295
- const t = {}, i = dt(this);
314
+ const r = {}, i = yt(this);
296
315
  for (const l of this.$$s)
297
- l in i && (t[l] = [e(l)]);
316
+ l in i && (r[l] = [e(l)]);
298
317
  for (const l of this.attributes) {
299
318
  const s = this.$$g_p(l.name);
300
319
  s in this.$$d || (this.$$d[s] = se(s, l.value, this.$$p_d, "toProp"));
@@ -305,7 +324,7 @@ typeof HTMLElement == "function" && (Xe = class extends HTMLElement {
305
324
  target: this.shadowRoot || this,
306
325
  props: {
307
326
  ...this.$$d,
308
- $$slots: t,
327
+ $$slots: r,
309
328
  $$scope: {
310
329
  ctx: []
311
330
  }
@@ -336,7 +355,7 @@ typeof HTMLElement == "function" && (Xe = class extends HTMLElement {
336
355
  }
337
356
  // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
338
357
  // and setting attributes through setAttribute etc, this is helpful
339
- attributeChangedCallback(e, t, i) {
358
+ attributeChangedCallback(e, r, i) {
340
359
  var o;
341
360
  this.$$r || (e = this.$$g_p(e), this.$$d[e] = se(e, i, this.$$p_d, "toProp"), (o = this.$$c) == null || o.$set({ [e]: this.$$d[e] }));
342
361
  }
@@ -347,14 +366,14 @@ typeof HTMLElement == "function" && (Xe = class extends HTMLElement {
347
366
  }
348
367
  $$g_p(e) {
349
368
  return Object.keys(this.$$p_d).find(
350
- (t) => this.$$p_d[t].attribute === e || !this.$$p_d[t].attribute && t.toLowerCase() === e
369
+ (r) => this.$$p_d[r].attribute === e || !this.$$p_d[r].attribute && r.toLowerCase() === e
351
370
  ) || e;
352
371
  }
353
372
  });
354
- function se(r, e, t, i) {
373
+ function se(t, e, r, i) {
355
374
  var l;
356
- const o = (l = t[r]) == null ? void 0 : l.type;
357
- if (e = o === "Boolean" && typeof e != "boolean" ? e != null : e, !i || !t[r])
375
+ const o = (l = r[t]) == null ? void 0 : l.type;
376
+ if (e = o === "Boolean" && typeof e != "boolean" ? e != null : e, !i || !r[t])
358
377
  return e;
359
378
  if (i === "toAttribute")
360
379
  switch (o) {
@@ -381,10 +400,10 @@ function se(r, e, t, i) {
381
400
  return e;
382
401
  }
383
402
  }
384
- function Ct(r, e, t, i, o, l) {
385
- let s = class extends Xe {
403
+ function zt(t, e, r, i, o, l) {
404
+ let s = class extends He {
386
405
  constructor() {
387
- super(r, t, o), this.$$p_d = e;
406
+ super(t, r, o), this.$$p_d = e;
388
407
  }
389
408
  static get observedAttributes() {
390
409
  return Object.keys(e).map(
@@ -398,8 +417,8 @@ function Ct(r, e, t, i, o, l) {
398
417
  return this.$$c && f in this.$$c ? this.$$c[f] : this.$$d[f];
399
418
  },
400
419
  set(a) {
401
- var h;
402
- a = se(f, a, e), this.$$d[f] = a, (h = this.$$c) == null || h.$set({ [f]: a });
420
+ var u;
421
+ a = se(f, a, e), this.$$d[f] = a, (u = this.$$c) == null || u.$set({ [f]: a });
403
422
  }
404
423
  });
405
424
  }), i.forEach((f) => {
@@ -409,10 +428,10 @@ function Ct(r, e, t, i, o, l) {
409
428
  return (a = this.$$c) == null ? void 0 : a[f];
410
429
  }
411
430
  });
412
- }), l && (s = l(s)), r.element = /** @type {any} */
431
+ }), l && (s = l(s)), t.element = /** @type {any} */
413
432
  s, s;
414
433
  }
415
- class Lt {
434
+ class Nt {
416
435
  constructor() {
417
436
  /**
418
437
  * ### PRIVATE API
@@ -433,7 +452,7 @@ class Lt {
433
452
  }
434
453
  /** @returns {void} */
435
454
  $destroy() {
436
- xt(this, 1), this.$destroy = q;
455
+ Lt(this, 1), this.$destroy = ee;
437
456
  }
438
457
  /**
439
458
  * @template {Extract<keyof Events, string>} K
@@ -441,12 +460,12 @@ class Lt {
441
460
  * @param {((e: Events[K]) => void) | null | undefined} callback
442
461
  * @returns {() => void}
443
462
  */
444
- $on(e, t) {
445
- if (!Ue(t))
446
- return q;
463
+ $on(e, r) {
464
+ if (!Xe(r))
465
+ return ee;
447
466
  const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
448
- return i.push(t), () => {
449
- const o = i.indexOf(t);
467
+ return i.push(r), () => {
468
+ const o = i.indexOf(r);
450
469
  o !== -1 && i.splice(o, 1);
451
470
  };
452
471
  }
@@ -455,42 +474,19 @@ class Lt {
455
474
  * @returns {void}
456
475
  */
457
476
  $set(e) {
458
- this.$$set && !lt(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
459
- }
460
- }
461
- const Rt = "4";
462
- typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Rt);
463
- const Oe = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IGY9bmV3IFRleHRFbmNvZGVyO2Z1bmN0aW9uIGQoZSl7cmV0dXJuWy4uLm5ldyBVaW50OEFycmF5KGUpXS5tYXAodD0+dC50b1N0cmluZygxNikucGFkU3RhcnQoMiwiMCIpKS5qb2luKCIiKX1hc3luYyBmdW5jdGlvbiBwKGUsdCxvKXtyZXR1cm4gZChhd2FpdCBjcnlwdG8uc3VidGxlLmRpZ2VzdChvLnRvVXBwZXJDYXNlKCksZi5lbmNvZGUoZSt0KSkpfWZ1bmN0aW9uIGcoZSx0LG89IlNIQS0yNTYiLGw9MWU2LGM9MCl7Y29uc3QgYT1uZXcgQWJvcnRDb250cm9sbGVyLGk9RGF0ZS5ub3coKTtyZXR1cm57cHJvbWlzZTooYXN5bmMoKT0+e2ZvcihsZXQgbj1jO248PWw7bis9MSl7aWYoYS5zaWduYWwuYWJvcnRlZClyZXR1cm4gbnVsbDtpZihhd2FpdCBwKHQsbixvKT09PWUpcmV0dXJue251bWJlcjpuLHRvb2s6RGF0ZS5ub3coKS1pfX1yZXR1cm4gbnVsbH0pKCksY29udHJvbGxlcjphfX1sZXQgcjtvbm1lc3NhZ2U9YXN5bmMgZT0+e2NvbnN0e3R5cGU6dCxwYXlsb2FkOm99PWUuZGF0YTtpZih0PT09ImFib3J0IilyPT1udWxsfHxyLmFib3J0KCkscj12b2lkIDA7ZWxzZSBpZih0PT09IndvcmsiKXtjb25zdHthbGc6bCxjaGFsbGVuZ2U6YyxtYXg6YSxzYWx0Omksc3RhcnQ6dX09b3x8e30sbj1nKGMsaSxsLGEsdSk7cj1uLmNvbnRyb2xsZXIsbi5wcm9taXNlLnRoZW4ocz0+e3NlbGYucG9zdE1lc3NhZ2UocyYmey4uLnMsd29ya2VyOiEwfSl9KX19fSkoKTsK", It = (r) => Uint8Array.from(atob(r), (e) => e.charCodeAt(0)), Se = typeof window < "u" && window.Blob && new Blob([It(Oe)], { type: "text/javascript;charset=utf-8" });
464
- function zt(r) {
465
- let e;
466
- try {
467
- if (e = Se && (window.URL || window.webkitURL).createObjectURL(Se), !e)
468
- throw "";
469
- const t = new Worker(e, {
470
- name: r == null ? void 0 : r.name
471
- });
472
- return t.addEventListener("error", () => {
473
- (window.URL || window.webkitURL).revokeObjectURL(e);
474
- }), t;
475
- } catch {
476
- return new Worker(
477
- "data:text/javascript;base64," + Oe,
478
- {
479
- name: r == null ? void 0 : r.name
480
- }
481
- );
482
- } finally {
483
- e && (window.URL || window.webkitURL).revokeObjectURL(e);
477
+ this.$$set && !ft(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
484
478
  }
485
479
  }
486
- const Nt = new TextEncoder();
487
- function St(r) {
488
- return [...new Uint8Array(r)].map((e) => e.toString(16).padStart(2, "0")).join("");
480
+ const At = "4";
481
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(At);
482
+ const St = new TextEncoder();
483
+ function jt(t) {
484
+ return [...new Uint8Array(t)].map((e) => e.toString(16).padStart(2, "0")).join("");
489
485
  }
490
- async function jt(r, e = "SHA-256", t = 1e5) {
486
+ async function Zt(t, e = "SHA-256", r = 1e5) {
491
487
  const i = Date.now().toString(16);
492
- r || (r = Math.round(Math.random() * t));
493
- const o = await Fe(i, r, e);
488
+ t || (t = Math.round(Math.random() * r));
489
+ const o = await We(i, t, e);
494
490
  return {
495
491
  algorithm: e,
496
492
  challenge: o,
@@ -498,22 +494,22 @@ async function jt(r, e = "SHA-256", t = 1e5) {
498
494
  signature: ""
499
495
  };
500
496
  }
501
- async function Fe(r, e, t) {
502
- return St(
497
+ async function We(t, e, r) {
498
+ return jt(
503
499
  await crypto.subtle.digest(
504
- t.toUpperCase(),
505
- Nt.encode(r + e)
500
+ r.toUpperCase(),
501
+ St.encode(t + e)
506
502
  )
507
503
  );
508
504
  }
509
- function Zt(r, e, t = "SHA-256", i = 1e6, o = 0) {
505
+ function Tt(t, e, r = "SHA-256", i = 1e6, o = 0) {
510
506
  const l = new AbortController(), s = Date.now();
511
507
  return {
512
508
  promise: (async () => {
513
509
  for (let a = o; a <= i; a += 1) {
514
510
  if (l.signal.aborted)
515
511
  return null;
516
- if (await Fe(e, a, t) === r)
512
+ if (await We(e, a, r) === t)
517
513
  return {
518
514
  number: a,
519
515
  took: Date.now() - s
@@ -524,41 +520,41 @@ function Zt(r, e, t = "SHA-256", i = 1e6, o = 0) {
524
520
  controller: l
525
521
  };
526
522
  }
527
- var b = /* @__PURE__ */ ((r) => (r.ERROR = "error", r.VERIFIED = "verified", r.VERIFYING = "verifying", r.UNVERIFIED = "unverified", r.EXPIRED = "expired", r))(b || {});
528
- function At(r) {
529
- st(r, "svelte-15co9zy", ".altcha.svelte-15co9zy.svelte-15co9zy{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-15co9zy.svelte-15co9zy:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-15co9zy.svelte-15co9zy{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-15co9zy.svelte-15co9zy{flex-grow:1}.altcha-label.svelte-15co9zy label.svelte-15co9zy{cursor:pointer}.altcha-logo.svelte-15co9zy.svelte-15co9zy{color:currentColor;opacity:0.3}.altcha-logo.svelte-15co9zy.svelte-15co9zy:hover{opacity:1}.altcha-error.svelte-15co9zy.svelte-15co9zy{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-15co9zy.svelte-15co9zy{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-15co9zy.svelte-15co9zy:hover{opacity:1}.altcha-footer.svelte-15co9zy>.svelte-15co9zy:first-child{flex-grow:1}.altcha-footer.svelte-15co9zy a{color:currentColor}.altcha-checkbox.svelte-15co9zy.svelte-15co9zy{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-15co9zy input.svelte-15co9zy{width:18px;height:18px;margin:0}.altcha-hidden.svelte-15co9zy.svelte-15co9zy{display:none}.altcha-spinner.svelte-15co9zy.svelte-15co9zy{animation:svelte-15co9zy-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-15co9zy-altcha-spinner{100%{transform:rotate(360deg)}}");
523
+ var b = /* @__PURE__ */ ((t) => (t.ERROR = "error", t.VERIFIED = "verified", t.VERIFYING = "verifying", t.UNVERIFIED = "unverified", t.EXPIRED = "expired", t))(b || {});
524
+ function Mt(t) {
525
+ ut(t, "svelte-15co9zy", ".altcha.svelte-15co9zy.svelte-15co9zy{background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);overflow:hidden;position:relative;text-align:left}.altcha.svelte-15co9zy.svelte-15co9zy:focus-within{border-color:var(--altcha-color-border-focus, currentColor)}.altcha-main.svelte-15co9zy.svelte-15co9zy{align-items:center;display:flex;gap:0.4rem;padding:0.7rem}.altcha-label.svelte-15co9zy.svelte-15co9zy{flex-grow:1}.altcha-label.svelte-15co9zy label.svelte-15co9zy{cursor:pointer}.altcha-logo.svelte-15co9zy.svelte-15co9zy{color:currentColor;opacity:0.3}.altcha-logo.svelte-15co9zy.svelte-15co9zy:hover{opacity:1}.altcha-error.svelte-15co9zy.svelte-15co9zy{color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem}.altcha-footer.svelte-15co9zy.svelte-15co9zy{align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right}.altcha-footer.svelte-15co9zy.svelte-15co9zy:hover{opacity:1}.altcha-footer.svelte-15co9zy>.svelte-15co9zy:first-child{flex-grow:1}.altcha-footer.svelte-15co9zy a{color:currentColor}.altcha-checkbox.svelte-15co9zy.svelte-15co9zy{display:flex;align-items:center;height:24px;width:24px}.altcha-checkbox.svelte-15co9zy input.svelte-15co9zy{width:18px;height:18px;margin:0}.altcha-hidden.svelte-15co9zy.svelte-15co9zy{display:none}.altcha-spinner.svelte-15co9zy.svelte-15co9zy{animation:svelte-15co9zy-altcha-spinner 0.75s infinite linear;transform-origin:center}@keyframes svelte-15co9zy-altcha-spinner{100%{transform:rotate(360deg)}}");
530
526
  }
531
- function je(r) {
532
- let e, t, i;
527
+ function je(t) {
528
+ let e, r, i;
533
529
  return {
534
530
  c() {
535
- e = O("svg"), t = O("path"), i = O("path"), c(t, "d", "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"), c(t, "fill", "currentColor"), c(t, "opacity", ".25"), c(i, "d", "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"), c(i, "fill", "currentColor"), c(i, "class", "altcha-spinner svelte-15co9zy"), c(e, "width", "24"), c(e, "height", "24"), c(e, "viewBox", "0 0 24 24"), c(e, "xmlns", "http://www.w3.org/2000/svg");
531
+ e = O("svg"), r = O("path"), i = O("path"), c(r, "d", "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"), c(r, "fill", "currentColor"), c(r, "opacity", ".25"), c(i, "d", "M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"), c(i, "fill", "currentColor"), c(i, "class", "altcha-spinner svelte-15co9zy"), c(e, "width", "24"), c(e, "height", "24"), c(e, "viewBox", "0 0 24 24"), c(e, "xmlns", "http://www.w3.org/2000/svg");
536
532
  },
537
533
  m(o, l) {
538
- j(o, e, l), v(e, t), v(e, i);
534
+ S(o, e, l), v(e, r), v(e, i);
539
535
  },
540
536
  d(o) {
541
537
  o && N(e);
542
538
  }
543
539
  };
544
540
  }
545
- function Tt(r) {
546
- let e, t = (
541
+ function Vt(t) {
542
+ let e, r = (
547
543
  /*_strings*/
548
- r[9].label + ""
544
+ t[9].label + ""
549
545
  ), i;
550
546
  return {
551
547
  c() {
552
548
  e = R("label"), c(e, "for", i = /*name*/
553
- r[3] + "_checkbox"), c(e, "class", "svelte-15co9zy");
549
+ t[3] + "_checkbox"), c(e, "class", "svelte-15co9zy");
554
550
  },
555
551
  m(o, l) {
556
- j(o, e, l), e.innerHTML = t;
552
+ S(o, e, l), e.innerHTML = r;
557
553
  },
558
554
  p(o, l) {
559
555
  l[0] & /*_strings*/
560
- 512 && t !== (t = /*_strings*/
561
- o[9].label + "") && (e.innerHTML = t), l[0] & /*name*/
556
+ 512 && r !== (r = /*_strings*/
557
+ o[9].label + "") && (e.innerHTML = r), l[0] & /*name*/
562
558
  8 && i !== (i = /*name*/
563
559
  o[3] + "_checkbox") && c(e, "for", i);
564
560
  },
@@ -567,32 +563,32 @@ function Tt(r) {
567
563
  }
568
564
  };
569
565
  }
570
- function Mt(r) {
571
- let e, t = (
566
+ function Ut(t) {
567
+ let e, r = (
572
568
  /*_strings*/
573
- r[9].verifying + ""
569
+ t[9].verifying + ""
574
570
  );
575
571
  return {
576
572
  c() {
577
573
  e = R("span");
578
574
  },
579
575
  m(i, o) {
580
- j(i, e, o), e.innerHTML = t;
576
+ S(i, e, o), e.innerHTML = r;
581
577
  },
582
578
  p(i, o) {
583
579
  o[0] & /*_strings*/
584
- 512 && t !== (t = /*_strings*/
585
- i[9].verifying + "") && (e.innerHTML = t);
580
+ 512 && r !== (r = /*_strings*/
581
+ i[9].verifying + "") && (e.innerHTML = r);
586
582
  },
587
583
  d(i) {
588
584
  i && N(e);
589
585
  }
590
586
  };
591
587
  }
592
- function Vt(r) {
593
- let e, t = (
588
+ function Gt(t) {
589
+ let e, r = (
594
590
  /*_strings*/
595
- r[9].verified + ""
591
+ t[9].verified + ""
596
592
  ), i, o;
597
593
  return {
598
594
  c() {
@@ -600,17 +596,17 @@ function Vt(r) {
600
596
  o,
601
597
  "name",
602
598
  /*name*/
603
- r[3]
599
+ t[3]
604
600
  ), o.value = /*payload*/
605
- r[4];
601
+ t[4];
606
602
  },
607
603
  m(l, s) {
608
- j(l, e, s), e.innerHTML = t, j(l, i, s), j(l, o, s);
604
+ S(l, e, s), e.innerHTML = r, S(l, i, s), S(l, o, s);
609
605
  },
610
606
  p(l, s) {
611
607
  s[0] & /*_strings*/
612
- 512 && t !== (t = /*_strings*/
613
- l[9].verified + "") && (e.innerHTML = t), s[0] & /*name*/
608
+ 512 && r !== (r = /*_strings*/
609
+ l[9].verified + "") && (e.innerHTML = r), s[0] & /*name*/
614
610
  8 && c(
615
611
  o,
616
612
  "name",
@@ -625,49 +621,54 @@ function Vt(r) {
625
621
  }
626
622
  };
627
623
  }
628
- function Ze(r) {
629
- let e, t, i, o, l, s;
624
+ function Ze(t) {
625
+ let e, r, i, o, l, s, f;
630
626
  return {
631
627
  c() {
632
- e = R("div"), t = R("a"), i = O("svg"), o = O("path"), l = O("path"), s = O("path"), c(o, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), c(o, "fill", "currentColor"), c(l, "d", "M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"), c(l, "fill", "currentColor"), c(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), c(s, "fill", "currentColor"), c(i, "width", "22"), c(i, "height", "22"), c(i, "viewBox", "0 0 20 20"), c(i, "fill", "none"), c(i, "xmlns", "http://www.w3.org/2000/svg"), c(t, "href", He), c(t, "target", "_blank"), c(t, "class", "altcha-logo svelte-15co9zy");
628
+ e = R("div"), r = R("a"), i = O("svg"), o = O("path"), l = O("path"), s = O("path"), c(o, "d", "M2.33955 16.4279C5.88954 20.6586 12.1971 21.2105 16.4279 17.6604C18.4699 15.947 19.6548 13.5911 19.9352 11.1365L17.9886 10.4279C17.8738 12.5624 16.909 14.6459 15.1423 16.1284C11.7577 18.9684 6.71167 18.5269 3.87164 15.1423C1.03163 11.7577 1.4731 6.71166 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577C16.9767 5.86872 17.5322 7.02798 17.804 8.2324L19.9522 9.01429C19.7622 7.07737 19.0059 5.17558 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956C-0.658625 5.88958 -1.21046 12.1971 2.33955 16.4279Z"), c(o, "fill", "currentColor"), c(l, "d", "M3.57212 2.33956C1.65755 3.94607 0.496389 6.11731 0.12782 8.40523L2.04639 9.13961C2.26047 7.15832 3.21057 5.25375 4.8577 3.87164C8.24231 1.03162 13.2883 1.4731 16.1284 4.8577L13.8302 6.78606L19.9633 9.13364C19.7929 7.15555 19.0335 5.20847 17.6604 3.57212C14.1104 -0.658624 7.80283 -1.21043 3.57212 2.33956Z"), c(l, "fill", "currentColor"), c(s, "d", "M7 10H5C5 12.7614 7.23858 15 10 15C12.7614 15 15 12.7614 15 10H13C13 11.6569 11.6569 13 10 13C8.3431 13 7 11.6569 7 10Z"), c(s, "fill", "currentColor"), c(i, "width", "22"), c(i, "height", "22"), c(i, "viewBox", "0 0 20 20"), c(i, "fill", "none"), c(i, "xmlns", "http://www.w3.org/2000/svg"), c(r, "href", Ye), c(r, "target", "_blank"), c(r, "class", "altcha-logo svelte-15co9zy"), c(r, "aria-label", f = /*_strings*/
629
+ t[9].ariaLinkLabel);
630
+ },
631
+ m(a, u) {
632
+ S(a, e, u), v(e, r), v(r, i), v(i, o), v(i, l), v(i, s);
633
633
  },
634
- m(f, a) {
635
- j(f, e, a), v(e, t), v(t, i), v(i, o), v(i, l), v(i, s);
634
+ p(a, u) {
635
+ u[0] & /*_strings*/
636
+ 512 && f !== (f = /*_strings*/
637
+ a[9].ariaLinkLabel) && c(r, "aria-label", f);
636
638
  },
637
- p: q,
638
- d(f) {
639
- f && N(e);
639
+ d(a) {
640
+ a && N(e);
640
641
  }
641
642
  };
642
643
  }
643
- function Ae(r) {
644
- let e, t, i, o;
645
- function l(a, h) {
644
+ function Te(t) {
645
+ let e, r, i, o;
646
+ function l(a, u) {
646
647
  return (
647
648
  /*state*/
648
- a[5] === b.EXPIRED ? Gt : Ut
649
+ a[5] === b.EXPIRED ? Xt : Dt
649
650
  );
650
651
  }
651
- let s = l(r), f = s(r);
652
+ let s = l(t), f = s(t);
652
653
  return {
653
654
  c() {
654
- e = R("div"), t = O("svg"), i = O("path"), o = B(), f.c(), c(i, "stroke-linecap", "round"), c(i, "stroke-linejoin", "round"), c(i, "d", "M6 18L18 6M6 6l12 12"), c(t, "width", "14"), c(t, "height", "14"), c(t, "xmlns", "http://www.w3.org/2000/svg"), c(t, "fill", "none"), c(t, "viewBox", "0 0 24 24"), c(t, "stroke-width", "1.5"), c(t, "stroke", "currentColor"), c(e, "class", "altcha-error svelte-15co9zy");
655
+ e = R("div"), r = O("svg"), i = O("path"), o = B(), f.c(), c(i, "stroke-linecap", "round"), c(i, "stroke-linejoin", "round"), c(i, "d", "M6 18L18 6M6 6l12 12"), c(r, "width", "14"), c(r, "height", "14"), c(r, "xmlns", "http://www.w3.org/2000/svg"), c(r, "fill", "none"), c(r, "viewBox", "0 0 24 24"), c(r, "stroke-width", "1.5"), c(r, "stroke", "currentColor"), c(e, "class", "altcha-error svelte-15co9zy");
655
656
  },
656
- m(a, h) {
657
- j(a, e, h), v(e, t), v(t, i), v(e, o), f.m(e, null);
657
+ m(a, u) {
658
+ S(a, e, u), v(e, r), v(r, i), v(e, o), f.m(e, null);
658
659
  },
659
- p(a, h) {
660
- s === (s = l(a)) && f ? f.p(a, h) : (f.d(1), f = s(a), f && (f.c(), f.m(e, null)));
660
+ p(a, u) {
661
+ s === (s = l(a)) && f ? f.p(a, u) : (f.d(1), f = s(a), f && (f.c(), f.m(e, null)));
661
662
  },
662
663
  d(a) {
663
664
  a && N(e), f.d();
664
665
  }
665
666
  };
666
667
  }
667
- function Ut(r) {
668
- let e, t = (
668
+ function Dt(t) {
669
+ let e, r = (
669
670
  /*_strings*/
670
- r[9].error + ""
671
+ t[9].error + ""
671
672
  );
672
673
  return {
673
674
  c() {
@@ -675,16 +676,16 @@ function Ut(r) {
675
676
  e,
676
677
  "title",
677
678
  /*error*/
678
- r[8]
679
+ t[8]
679
680
  );
680
681
  },
681
682
  m(i, o) {
682
- j(i, e, o), e.innerHTML = t;
683
+ S(i, e, o), e.innerHTML = r;
683
684
  },
684
685
  p(i, o) {
685
686
  o[0] & /*_strings*/
686
- 512 && t !== (t = /*_strings*/
687
- i[9].error + "") && (e.innerHTML = t), o[0] & /*error*/
687
+ 512 && r !== (r = /*_strings*/
688
+ i[9].error + "") && (e.innerHTML = r), o[0] & /*error*/
688
689
  256 && c(
689
690
  e,
690
691
  "title",
@@ -697,10 +698,10 @@ function Ut(r) {
697
698
  }
698
699
  };
699
700
  }
700
- function Gt(r) {
701
- let e, t = (
701
+ function Xt(t) {
702
+ let e, r = (
702
703
  /*_strings*/
703
- r[9].expired + ""
704
+ t[9].expired + ""
704
705
  );
705
706
  return {
706
707
  c() {
@@ -708,16 +709,16 @@ function Gt(r) {
708
709
  e,
709
710
  "title",
710
711
  /*error*/
711
- r[8]
712
+ t[8]
712
713
  );
713
714
  },
714
715
  m(i, o) {
715
- j(i, e, o), e.innerHTML = t;
716
+ S(i, e, o), e.innerHTML = r;
716
717
  },
717
718
  p(i, o) {
718
719
  o[0] & /*_strings*/
719
- 512 && t !== (t = /*_strings*/
720
- i[9].expired + "") && (e.innerHTML = t), o[0] & /*error*/
720
+ 512 && r !== (r = /*_strings*/
721
+ i[9].expired + "") && (e.innerHTML = r), o[0] & /*error*/
721
722
  256 && c(
722
723
  e,
723
724
  "title",
@@ -730,113 +731,113 @@ function Gt(r) {
730
731
  }
731
732
  };
732
733
  }
733
- function Te(r) {
734
- let e, t, i = (
734
+ function Me(t) {
735
+ let e, r, i = (
735
736
  /*_strings*/
736
- r[9].footer + ""
737
+ t[9].footer + ""
737
738
  );
738
739
  return {
739
740
  c() {
740
- e = R("div"), t = R("div"), c(t, "class", "svelte-15co9zy"), c(e, "class", "altcha-footer svelte-15co9zy");
741
+ e = R("div"), r = R("div"), c(r, "class", "svelte-15co9zy"), c(e, "class", "altcha-footer svelte-15co9zy");
741
742
  },
742
743
  m(o, l) {
743
- j(o, e, l), v(e, t), t.innerHTML = i;
744
+ S(o, e, l), v(e, r), r.innerHTML = i;
744
745
  },
745
746
  p(o, l) {
746
747
  l[0] & /*_strings*/
747
748
  512 && i !== (i = /*_strings*/
748
- o[9].footer + "") && (t.innerHTML = i);
749
+ o[9].footer + "") && (r.innerHTML = i);
749
750
  },
750
751
  d(o) {
751
752
  o && N(e);
752
753
  }
753
754
  };
754
755
  }
755
- function Dt(r) {
756
- let e, t, i, o, l, s, f, a, h, Z, C, M, V, D, p = (
756
+ function Ot(t) {
757
+ let e, r, i, o, l, s, f, a, u, j, C, M, V, D, p = (
757
758
  /*state*/
758
- r[5] === b.VERIFYING && je()
759
+ t[5] === b.VERIFYING && je()
759
760
  );
760
761
  function H(d, I) {
761
762
  return (
762
763
  /*state*/
763
- d[5] === b.VERIFIED ? Vt : (
764
+ d[5] === b.VERIFIED ? Gt : (
764
765
  /*state*/
765
- d[5] === b.VERIFYING ? Mt : Tt
766
+ d[5] === b.VERIFYING ? Ut : Vt
766
767
  )
767
768
  );
768
769
  }
769
- let X = H(r), _ = X(r), k = (
770
+ let X = H(t), k = X(t), x = (
770
771
  /*hidelogo*/
771
- r[2] !== !0 && Ze()
772
+ t[2] !== !0 && Ze(t)
772
773
  ), m = (
773
774
  /*error*/
774
- (r[8] || /*state*/
775
- r[5] === b.EXPIRED) && Ae(r)
775
+ (t[8] || /*state*/
776
+ t[5] === b.EXPIRED) && Te(t)
776
777
  ), y = (
777
778
  /*_strings*/
778
- r[9].footer && /*hidefooter*/
779
- r[1] !== !0 && Te(r)
779
+ t[9].footer && /*hidefooter*/
780
+ t[1] !== !0 && Me(t)
780
781
  );
781
782
  return {
782
783
  c() {
783
- e = R("div"), t = R("div"), p && p.c(), i = B(), o = R("div"), l = R("input"), a = B(), h = R("div"), _.c(), Z = B(), k && k.c(), C = B(), m && m.c(), M = B(), y && y.c(), c(l, "type", "checkbox"), c(l, "id", s = /*name*/
784
- r[3] + "_checkbox"), l.required = f = /*auto*/
785
- r[0] !== "onsubmit", c(l, "class", "svelte-15co9zy"), c(o, "class", "altcha-checkbox svelte-15co9zy"), ze(
784
+ e = R("div"), r = R("div"), p && p.c(), i = B(), o = R("div"), l = R("input"), a = B(), u = R("div"), k.c(), j = B(), x && x.c(), C = B(), m && m.c(), M = B(), y && y.c(), c(l, "type", "checkbox"), c(l, "id", s = /*name*/
785
+ t[3] + "_checkbox"), l.required = f = /*auto*/
786
+ t[0] !== "onsubmit", c(l, "class", "svelte-15co9zy"), c(o, "class", "altcha-checkbox svelte-15co9zy"), Ae(
786
787
  o,
787
788
  "altcha-hidden",
788
789
  /*state*/
789
- r[5] === b.VERIFYING
790
- ), c(h, "class", "altcha-label svelte-15co9zy"), c(t, "class", "altcha-main svelte-15co9zy"), c(e, "class", "altcha svelte-15co9zy"), c(
790
+ t[5] === b.VERIFYING
791
+ ), c(u, "class", "altcha-label svelte-15co9zy"), c(r, "class", "altcha-main svelte-15co9zy"), c(e, "class", "altcha svelte-15co9zy"), c(
791
792
  e,
792
793
  "data-state",
793
794
  /*state*/
794
- r[5]
795
+ t[5]
795
796
  );
796
797
  },
797
798
  m(d, I) {
798
- j(d, e, I), v(e, t), p && p.m(t, null), v(t, i), v(t, o), v(o, l), l.checked = /*checked*/
799
- r[6], v(t, a), v(t, h), _.m(h, null), v(t, Z), k && k.m(t, null), v(e, C), m && m.m(e, null), v(e, M), y && y.m(e, null), r[30](e), V || (D = [
800
- ae(
799
+ S(d, e, I), v(e, r), p && p.m(r, null), v(r, i), v(r, o), v(o, l), l.checked = /*checked*/
800
+ t[6], v(r, a), v(r, u), k.m(u, null), v(r, j), x && x.m(r, null), v(e, C), m && m.m(e, null), v(e, M), y && y.m(e, null), t[31](e), V || (D = [
801
+ fe(
801
802
  l,
802
803
  "change",
803
804
  /*input_change_handler*/
804
- r[29]
805
+ t[30]
805
806
  ),
806
- ae(
807
+ fe(
807
808
  l,
808
809
  "change",
809
810
  /*onCheckedChange*/
810
- r[10]
811
+ t[10]
811
812
  ),
812
- ae(
813
+ fe(
813
814
  l,
814
815
  "invalid",
815
816
  /*onInvalid*/
816
- r[11]
817
+ t[11]
817
818
  )
818
819
  ], V = !0);
819
820
  },
820
821
  p(d, I) {
821
822
  /*state*/
822
- d[5] === b.VERIFYING ? p || (p = je(), p.c(), p.m(t, i)) : p && (p.d(1), p = null), I[0] & /*name*/
823
+ d[5] === b.VERIFYING ? p || (p = je(), p.c(), p.m(r, i)) : p && (p.d(1), p = null), I[0] & /*name*/
823
824
  8 && s !== (s = /*name*/
824
825
  d[3] + "_checkbox") && c(l, "id", s), I[0] & /*auto*/
825
826
  1 && f !== (f = /*auto*/
826
827
  d[0] !== "onsubmit") && (l.required = f), I[0] & /*checked*/
827
828
  64 && (l.checked = /*checked*/
828
829
  d[6]), I[0] & /*state*/
829
- 32 && ze(
830
+ 32 && Ae(
830
831
  o,
831
832
  "altcha-hidden",
832
833
  /*state*/
833
834
  d[5] === b.VERIFYING
834
- ), X === (X = H(d)) && _ ? _.p(d, I) : (_.d(1), _ = X(d), _ && (_.c(), _.m(h, null))), /*hidelogo*/
835
- d[2] !== !0 ? k ? k.p(d, I) : (k = Ze(), k.c(), k.m(t, null)) : k && (k.d(1), k = null), /*error*/
835
+ ), X === (X = H(d)) && k ? k.p(d, I) : (k.d(1), k = X(d), k && (k.c(), k.m(u, null))), /*hidelogo*/
836
+ d[2] !== !0 ? x ? x.p(d, I) : (x = Ze(d), x.c(), x.m(r, null)) : x && (x.d(1), x = null), /*error*/
836
837
  d[8] || /*state*/
837
- d[5] === b.EXPIRED ? m ? m.p(d, I) : (m = Ae(d), m.c(), m.m(e, M)) : m && (m.d(1), m = null), /*_strings*/
838
+ d[5] === b.EXPIRED ? m ? m.p(d, I) : (m = Te(d), m.c(), m.m(e, M)) : m && (m.d(1), m = null), /*_strings*/
838
839
  d[9].footer && /*hidefooter*/
839
- d[1] !== !0 ? y ? y.p(d, I) : (y = Te(d), y.c(), y.m(e, null)) : y && (y.d(1), y = null), I[0] & /*state*/
840
+ d[1] !== !0 ? y ? y.p(d, I) : (y = Me(d), y.c(), y.m(e, null)) : y && (y.d(1), y = null), I[0] & /*state*/
840
841
  32 && c(
841
842
  e,
842
843
  "data-state",
@@ -844,194 +845,194 @@ function Dt(r) {
844
845
  d[5]
845
846
  );
846
847
  },
847
- i: q,
848
- o: q,
848
+ i: ee,
849
+ o: ee,
849
850
  d(d) {
850
- d && N(e), p && p.d(), _.d(), k && k.d(), m && m.d(), y && y.d(), r[30](null), V = !1, re(D);
851
+ d && N(e), p && p.d(), k.d(), x && x.d(), m && m.d(), y && y.d(), t[31](null), V = !1, re(D);
851
852
  }
852
853
  };
853
854
  }
854
- const He = "https://altcha.org/";
855
- function Me(r) {
856
- return JSON.parse(r);
855
+ const Ve = "Visit Altcha.org", Ye = "https://altcha.org/";
856
+ function Ue(t) {
857
+ return JSON.parse(t);
857
858
  }
858
- function Xt() {
859
+ function Ft() {
859
860
  try {
860
861
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
861
862
  } catch {
862
863
  }
863
864
  }
864
- function Ot(r, e, t) {
865
- var Ee, $e;
866
- let i, o, l, { auto: s = void 0 } = e, { blockspam: f = void 0 } = e, { challengeurl: a = void 0 } = e, { challengejson: h = void 0 } = e, { debug: Z = !1 } = e, { expire: C = void 0 } = e, { hidefooter: M = !1 } = e, { hidelogo: V = !1 } = e, { name: D = "altcha" } = e, { maxnumber: p = 1e6 } = e, { mockerror: H = !1 } = e, { refetchonexpire: X = !0 } = e, { spamfilter: _ = !1 } = e, { strings: k = void 0 } = e, { test: m = !1 } = e, { verifyurl: y = void 0 } = e, { workers: d = Math.min(16, navigator.hardwareConcurrency || 8) } = e;
867
- const I = bt(), ge = ["SHA-256", "SHA-384", "SHA-512"], be = ($e = (Ee = document.documentElement.lang) == null ? void 0 : Ee.split("-")) == null ? void 0 : $e[0];
868
- let F = !1, ne, g = null, ce = null, Y = null, U = b.UNVERIFIED, G = null;
869
- gt(() => {
870
- g && (g.removeEventListener("submit", ve), g.removeEventListener("reset", we), g.removeEventListener("focusin", ye), g = null), G && (clearTimeout(G), G = null);
871
- }), mt(() => {
872
- L("mounted", "0.4.3"), L("workers", d), m && L("using test mode"), C && ie(C), s !== void 0 && L("auto", s), g = ne.closest("form"), g && (g.addEventListener("submit", ve), g.addEventListener("reset", we), s === "onfocus" && g.addEventListener("focusin", ye)), s === "onload" && P();
865
+ function Ht(t, e, r) {
866
+ var $e, Ce;
867
+ let i, o, l, { auto: s = void 0 } = e, { blockspam: f = void 0 } = e, { challengeurl: a = void 0 } = e, { challengejson: u = void 0 } = e, { debug: j = !1 } = e, { expire: C = void 0 } = e, { hidefooter: M = !1 } = e, { hidelogo: V = !1 } = e, { name: D = "altcha" } = e, { maxnumber: p = 1e6 } = e, { mockerror: H = !1 } = e, { refetchonexpire: X = !0 } = e, { spamfilter: k = !1 } = e, { strings: x = void 0 } = e, { test: m = !1 } = e, { verifyurl: y = void 0 } = e, { workers: d = Math.min(16, navigator.hardwareConcurrency || 8) } = e, { workerurl: I = void 0 } = e;
868
+ const ce = _t(), be = ["SHA-256", "SHA-384", "SHA-512"], ye = (Ce = ($e = document.documentElement.lang) == null ? void 0 : $e.split("-")) == null ? void 0 : Ce[0];
869
+ let F = !1, ne, g = null, ae = null, W = null, U = b.UNVERIFIED, G = null;
870
+ wt(() => {
871
+ g && (g.removeEventListener("submit", we), g.removeEventListener("reset", _e), g.removeEventListener("focusin", ve), g = null), G && (clearTimeout(G), G = null);
872
+ }), vt(() => {
873
+ L("mounted", "0.5.1"), L("workers", d), m && L("using test mode"), C && ie(C), s !== void 0 && L("auto", s), g = ne.closest("form"), g && (g.addEventListener("submit", we), g.addEventListener("reset", _e), s === "onfocus" && g.addEventListener("focusin", ve)), s === "onload" && Y();
873
874
  });
874
875
  function L(...n) {
875
- (Z || n.some((u) => u instanceof Error)) && console[n[0] instanceof Error ? "error" : "log"]("ALTCHA", ...n);
876
- }
877
- function ye(n) {
878
- U === b.UNVERIFIED && P();
876
+ (j || n.some((h) => h instanceof Error)) && console[n[0] instanceof Error ? "error" : "log"]("ALTCHA", ...n);
879
877
  }
880
878
  function ve(n) {
881
- g && s === "onsubmit" && U === b.UNVERIFIED && (n.preventDefault(), n.stopPropagation(), P().then(() => {
879
+ U === b.UNVERIFIED && Y();
880
+ }
881
+ function we(n) {
882
+ g && s === "onsubmit" && U === b.UNVERIFIED && (n.preventDefault(), n.stopPropagation(), Y().then(() => {
882
883
  g == null || g.requestSubmit();
883
884
  }));
884
885
  }
885
- function we() {
886
+ function _e() {
886
887
  oe();
887
888
  }
888
- function pe(n, u) {
889
+ function pe(n, h) {
889
890
  return btoa(JSON.stringify({
890
891
  algorithm: n.algorithm,
891
892
  challenge: n.challenge,
892
- number: u.number,
893
+ number: h.number,
893
894
  salt: n.salt,
894
895
  signature: n.signature,
895
896
  test: m ? !0 : void 0,
896
- took: u.took
897
+ took: h.took
897
898
  }));
898
899
  }
899
- function _e(n) {
900
+ function ke(n) {
900
901
  if (!n.algorithm)
901
902
  throw new Error("Invalid challenge. Property algorithm is missing.");
902
903
  if (n.signature === void 0)
903
904
  throw new Error("Invalid challenge. Property signature is missing.");
904
- if (!ge.includes(n.algorithm.toUpperCase()))
905
- throw new Error(`Unknown algorithm value. Allowed values: ${ge.join(", ")}`);
905
+ if (!be.includes(n.algorithm.toUpperCase()))
906
+ throw new Error(`Unknown algorithm value. Allowed values: ${be.join(", ")}`);
906
907
  if (!n.challenge || n.challenge.length < 40)
907
908
  throw new Error("Challenge is too short. Min. 40 chars.");
908
909
  if (!n.salt || n.salt.length < 10)
909
910
  throw new Error("Salt is too short. Min. 10 chars.");
910
911
  }
911
- async function Ye() {
912
+ async function Pe() {
912
913
  var n;
913
914
  if (H)
914
915
  throw L("mocking error"), new Error("Mocked error.");
915
916
  if (i)
916
917
  return L("using provided json data"), i;
917
918
  if (m)
918
- return L("generating test challenge", { test: m }), jt(typeof m != "boolean" ? +m : void 0);
919
+ return L("generating test challenge", { test: m }), Zt(typeof m != "boolean" ? +m : void 0);
919
920
  {
920
921
  if (!a)
921
922
  throw new Error("Attribute challengeurl not set.");
922
923
  L("fetching challenge from", a);
923
- const u = await fetch(a, {
924
+ const h = await fetch(a, {
924
925
  headers: {
925
- "x-altcha-spam-filter": _ ? "1" : "0"
926
+ "x-altcha-spam-filter": k ? "1" : "0"
926
927
  }
927
928
  });
928
- if (u.status !== 200)
929
- throw new Error(`Server responded with ${u.status}.`);
930
- const w = u.headers.get("Expires"), z = u.headers.get("X-Altcha-Config"), S = await u.json(), A = new URLSearchParams((n = S.salt.split("?")) == null ? void 0 : n[1]), W = A.get("expires") || A.get("expire");
931
- if (W) {
932
- const x = new Date(+W * 1e3), E = isNaN(x.getTime()) ? 0 : x.getTime() - Date.now();
933
- E > 0 && ie(E);
929
+ if (h.status !== 200)
930
+ throw new Error(`Server responded with ${h.status}.`);
931
+ const w = h.headers.get("Expires"), z = h.headers.get("X-Altcha-Config"), A = await h.json(), Z = new URLSearchParams((n = A.salt.split("?")) == null ? void 0 : n[1]), P = Z.get("expires") || Z.get("expire");
932
+ if (P) {
933
+ const E = new Date(+P * 1e3), $ = isNaN(E.getTime()) ? 0 : E.getTime() - Date.now();
934
+ $ > 0 && ie($);
934
935
  }
935
936
  if (z)
936
937
  try {
937
- const x = JSON.parse(z);
938
- x && typeof x == "object" && (x.verifyurl && (x.verifyurl = new URL(x.verifyurl, new URL(a)).toString()), xe(x));
939
- } catch (x) {
940
- L("unable to configure from X-Altcha-Config", x);
938
+ const E = JSON.parse(z);
939
+ E && typeof E == "object" && (E.verifyurl && (E.verifyurl = new URL(E.verifyurl, new URL(a)).toString()), Ee(E));
940
+ } catch (E) {
941
+ L("unable to configure from X-Altcha-Config", E);
941
942
  }
942
943
  if (!C && (w != null && w.length)) {
943
- const x = Date.parse(w);
944
- if (x) {
945
- const E = x - Date.now();
946
- E > 0 && ie(E);
944
+ const E = Date.parse(w);
945
+ if (E) {
946
+ const $ = E - Date.now();
947
+ $ > 0 && ie($);
947
948
  }
948
949
  }
949
- return S;
950
+ return A;
950
951
  }
951
952
  }
952
- function ke() {
953
- a && X && U === b.VERIFIED ? P() : oe(b.EXPIRED, l.expired);
953
+ function xe() {
954
+ a && X && U === b.VERIFIED ? Y() : oe(b.EXPIRED, l.expired);
954
955
  }
955
- async function Pe(n) {
956
- let u = null;
956
+ async function Be(n) {
957
+ let h = null;
957
958
  if ("Worker" in window) {
958
959
  try {
959
- u = await We(n.challenge, n.salt, n.algorithm, n.maxnumber);
960
+ h = await Ke(n.challenge, n.salt, n.algorithm, n.maxnumber);
960
961
  } catch (w) {
961
962
  L(w);
962
963
  }
963
- if ((u == null ? void 0 : u.number) !== void 0)
964
- return { data: n, solution: u };
964
+ if ((h == null ? void 0 : h.number) !== void 0)
965
+ return { data: n, solution: h };
965
966
  }
966
967
  return {
967
968
  data: n,
968
- solution: await Zt(n.challenge, n.salt, n.algorithm, n.maxnumber || p).promise
969
+ solution: await Tt(n.challenge, n.salt, n.algorithm, n.maxnumber || p).promise
969
970
  };
970
971
  }
971
- async function We(n, u, w, z = typeof m == "number" ? m : p, S = Math.ceil(d)) {
972
- const A = [];
973
- if (S < 1)
972
+ async function Ke(n, h, w, z = typeof m == "number" ? m : p, A = Math.ceil(d)) {
973
+ const Z = [];
974
+ if (A < 1)
974
975
  throw new Error("Wrong number of workers configured.");
975
- if (S > 16)
976
+ if (A > 16)
976
977
  throw new Error("Too many workers. Max. 16 allowed workers.");
977
- for (let E = 0; E < S; E++)
978
- A.push(new zt());
979
- const W = Math.ceil(z / S), x = await Promise.all(A.map((E, le) => {
980
- const Ce = le * W;
981
- return new Promise((rt) => {
982
- E.addEventListener("message", (Le) => {
983
- if (Le.data)
984
- for (const Re of A)
985
- Re !== E && Re.postMessage({ type: "abort" });
986
- rt(Le.data);
987
- }), E.postMessage({
978
+ for (let $ = 0; $ < A; $++)
979
+ Z.push(createAltchaWorker(I));
980
+ const P = Math.ceil(z / A), E = await Promise.all(Z.map(($, le) => {
981
+ const Le = le * P;
982
+ return new Promise((it) => {
983
+ $.addEventListener("message", (Re) => {
984
+ if (Re.data)
985
+ for (const Ie of Z)
986
+ Ie !== $ && Ie.postMessage({ type: "abort" });
987
+ it(Re.data);
988
+ }), $.postMessage({
988
989
  payload: {
989
990
  alg: w,
990
991
  challenge: n,
991
- max: Ce + W,
992
- salt: u,
993
- start: Ce
992
+ max: Le + P,
993
+ salt: h,
994
+ start: Le
994
995
  },
995
996
  type: "work"
996
997
  });
997
998
  });
998
999
  }));
999
- for (const E of A)
1000
- E.terminate();
1001
- return x.find((E) => !!E) || null;
1000
+ for (const $ of Z)
1001
+ $.terminate();
1002
+ return E.find(($) => !!$) || null;
1002
1003
  }
1003
- function Be() {
1004
- [b.UNVERIFIED, b.ERROR, b.EXPIRED].includes(U) ? _ && (g == null ? void 0 : g.reportValidity()) === !1 ? t(6, F = !1) : P() : t(6, F = !0);
1004
+ function Je() {
1005
+ [b.UNVERIFIED, b.ERROR, b.EXPIRED].includes(U) ? k && (g == null ? void 0 : g.reportValidity()) === !1 ? r(6, F = !1) : Y() : r(6, F = !0);
1005
1006
  }
1006
- function Ke() {
1007
+ function Qe() {
1007
1008
  U === b.VERIFYING && alert(l.waitAlert);
1008
1009
  }
1009
1010
  function ie(n) {
1010
- L("expire", n), G && (clearTimeout(G), G = null), n < 1 ? ke() : G = setTimeout(ke, n);
1011
+ L("expire", n), G && (clearTimeout(G), G = null), n < 1 ? xe() : G = setTimeout(xe, n);
1011
1012
  }
1012
- function Je(n) {
1013
+ function qe(n) {
1013
1014
  var w;
1014
- const u = g == null ? void 0 : g.querySelector(typeof n == "string" ? `input[name="${n}"]` : 'input[type="email"]:not([data-no-spamfilter])');
1015
- return ((w = u == null ? void 0 : u.value) == null ? void 0 : w.slice(u.value.indexOf("@"))) || void 0;
1015
+ const h = g == null ? void 0 : g.querySelector(typeof n == "string" ? `input[name="${n}"]` : 'input[type="email"]:not([data-no-spamfilter])');
1016
+ return ((w = h == null ? void 0 : h.value) == null ? void 0 : w.slice(h.value.indexOf("@"))) || void 0;
1016
1017
  }
1017
- function Qe(n) {
1018
+ function et(n) {
1018
1019
  return [
1019
1020
  ...(g == null ? void 0 : g.querySelectorAll(n != null && n.length ? n.map((w) => `input[name="${w}"]`).join(", ") : 'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])')) || []
1020
1021
  ].reduce(
1021
1022
  (w, z) => {
1022
- const S = z.name, A = z.value.trim();
1023
- return S && A && (w[S] = A), w;
1023
+ const A = z.name, Z = z.value.trim();
1024
+ return A && Z && (w[A] = Z), w;
1024
1025
  },
1025
1026
  {}
1026
1027
  );
1027
1028
  }
1028
- async function qe(n) {
1029
+ async function tt(n) {
1029
1030
  if (!y)
1030
1031
  throw new Error("Attribute verifyurl not set.");
1031
1032
  L("requesting server verification from", y);
1032
- const u = { payload: n };
1033
- if (_) {
1034
- const { email: S, expectedLanguages: A, expectedCountries: W, fields: x, ipAddress: E, timeZone: le } = typeof _ == "object" ? _ : {
1033
+ const h = { payload: n };
1034
+ if (k) {
1035
+ const { email: A, expectedLanguages: Z, expectedCountries: P, fields: E, ipAddress: $, timeZone: le } = typeof k == "object" ? k : {
1035
1036
  email: void 0,
1036
1037
  expectedCountries: void 0,
1037
1038
  expectedLanguages: void 0,
@@ -1039,108 +1040,110 @@ function Ot(r, e, t) {
1039
1040
  ipAddress: void 0,
1040
1041
  timeZone: void 0
1041
1042
  };
1042
- u.ipAddress = E === !1 ? void 0 : E || "auto", u.email = S === !1 ? void 0 : Je(S), u.fields = x === !1 ? void 0 : Qe(x), u.timeZone = le === !1 ? void 0 : le || Xt(), u.expectedCountries = W, u.expectedLanguages = A || (be ? [be] : void 0);
1043
+ h.ipAddress = $ === !1 ? void 0 : $ || "auto", h.email = A === !1 ? void 0 : qe(A), h.fields = E === !1 ? void 0 : et(E), h.timeZone = le === !1 ? void 0 : le || Ft(), h.expectedCountries = P, h.expectedLanguages = Z || (ye ? [ye] : void 0);
1043
1044
  }
1044
1045
  const w = await fetch(y, {
1045
- body: JSON.stringify(u),
1046
+ body: JSON.stringify(h),
1046
1047
  headers: { "content-type": "application/json" },
1047
1048
  method: "POST"
1048
1049
  });
1049
1050
  if (w.status !== 200)
1050
1051
  throw new Error(`Server responded with ${w.status}.`);
1051
1052
  const z = await w.json();
1052
- if (z != null && z.payload && t(4, Y = z.payload), I("serververification", z), f && z.classification === "BAD")
1053
+ if (z != null && z.payload && r(4, W = z.payload), ce("serververification", z), f && z.classification === "BAD")
1053
1054
  throw new Error("SpamFilter returned negative classification.");
1054
1055
  }
1055
- function xe(n) {
1056
- n.auto !== void 0 && (t(0, s = n.auto), s === "onload" && P()), n.expire !== void 0 && (ie(n.expire), t(14, C = n.expire)), n.challenge && (_e(n.challenge), i = n.challenge), n.challengeurl !== void 0 && t(12, a = n.challengeurl), n.debug !== void 0 && t(13, Z = !!n.debug), n.hidefooter !== void 0 && t(1, M = !!n.hidefooter), n.hidelogo !== void 0 && t(2, V = !!n.hidelogo), n.maxnumber !== void 0 && t(15, p = +n.maxnumber), n.mockerror !== void 0 && t(16, H = !!n.mockerror), n.name !== void 0 && t(3, D = n.name), n.refetchonexpire !== void 0 && t(17, X = !!n.refetchonexpire), n.spamfilter !== void 0 && t(18, _ = typeof n.spamfilter == "object" ? n.spamfilter : !!n.spamfilter), n.strings && t(28, o = n.strings), n.test !== void 0 && t(19, m = typeof n.test == "number" ? n.test : !!n.test), n.verifyurl !== void 0 && t(20, y = n.verifyurl), n.workers !== void 0 && t(21, d = +n.workers);
1056
+ function Ee(n) {
1057
+ n.auto !== void 0 && (r(0, s = n.auto), s === "onload" && Y()), n.expire !== void 0 && (ie(n.expire), r(14, C = n.expire)), n.challenge && (ke(n.challenge), i = n.challenge), n.challengeurl !== void 0 && r(12, a = n.challengeurl), n.debug !== void 0 && r(13, j = !!n.debug), n.hidefooter !== void 0 && r(1, M = !!n.hidefooter), n.hidelogo !== void 0 && r(2, V = !!n.hidelogo), n.maxnumber !== void 0 && r(15, p = +n.maxnumber), n.mockerror !== void 0 && r(16, H = !!n.mockerror), n.name !== void 0 && r(3, D = n.name), n.refetchonexpire !== void 0 && r(17, X = !!n.refetchonexpire), n.spamfilter !== void 0 && r(18, k = typeof n.spamfilter == "object" ? n.spamfilter : !!n.spamfilter), n.strings && r(29, o = n.strings), n.test !== void 0 && r(19, m = typeof n.test == "number" ? n.test : !!n.test), n.verifyurl !== void 0 && r(20, y = n.verifyurl), n.workers !== void 0 && r(21, d = +n.workers);
1057
1058
  }
1058
- function oe(n = b.UNVERIFIED, u = null) {
1059
- G && (clearTimeout(G), G = null), t(6, F = !1), t(8, ce = u), t(4, Y = null), t(5, U = n);
1059
+ function oe(n = b.UNVERIFIED, h = null) {
1060
+ G && (clearTimeout(G), G = null), r(6, F = !1), r(8, ae = h), r(4, W = null), r(5, U = n);
1060
1061
  }
1061
- async function P() {
1062
- return oe(b.VERIFYING), Ye().then((n) => (_e(n), L("challenge", n), Pe(n))).then(({ data: n, solution: u }) => {
1063
- if (L("solution", u), (u == null ? void 0 : u.number) !== void 0) {
1062
+ async function Y() {
1063
+ return oe(b.VERIFYING), Pe().then((n) => (ke(n), L("challenge", n), Be(n))).then(({ data: n, solution: h }) => {
1064
+ if (L("solution", h), (h == null ? void 0 : h.number) !== void 0) {
1064
1065
  if (y)
1065
- return qe(pe(n, u));
1066
- t(4, Y = pe(n, u)), L("payload", Y);
1066
+ return tt(pe(n, h));
1067
+ r(4, W = pe(n, h)), L("payload", W);
1067
1068
  } else
1068
1069
  throw L("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."), new Error("Unexpected result returned.");
1069
1070
  }).then(() => {
1070
- yt().then(() => {
1071
- t(5, U = b.VERIFIED), t(6, F = !0), L("verified"), I("verified", { payload: Y });
1071
+ pt().then(() => {
1072
+ r(5, U = b.VERIFIED), r(6, F = !0), L("verified"), ce("verified", { payload: W });
1072
1073
  });
1073
1074
  }).catch((n) => {
1074
- L(n), t(5, U = b.ERROR), t(6, F = !1), t(8, ce = n.message);
1075
+ L(n), r(5, U = b.ERROR), r(6, F = !1), r(8, ae = n.message);
1075
1076
  });
1076
1077
  }
1077
- function et() {
1078
- F = this.checked, t(6, F);
1078
+ function rt() {
1079
+ F = this.checked, r(6, F);
1079
1080
  }
1080
- function tt(n) {
1081
- ue[n ? "unshift" : "push"](() => {
1082
- ne = n, t(7, ne);
1081
+ function nt(n) {
1082
+ he[n ? "unshift" : "push"](() => {
1083
+ ne = n, r(7, ne);
1083
1084
  });
1084
1085
  }
1085
- return r.$$set = (n) => {
1086
- "auto" in n && t(0, s = n.auto), "blockspam" in n && t(22, f = n.blockspam), "challengeurl" in n && t(12, a = n.challengeurl), "challengejson" in n && t(23, h = n.challengejson), "debug" in n && t(13, Z = n.debug), "expire" in n && t(14, C = n.expire), "hidefooter" in n && t(1, M = n.hidefooter), "hidelogo" in n && t(2, V = n.hidelogo), "name" in n && t(3, D = n.name), "maxnumber" in n && t(15, p = n.maxnumber), "mockerror" in n && t(16, H = n.mockerror), "refetchonexpire" in n && t(17, X = n.refetchonexpire), "spamfilter" in n && t(18, _ = n.spamfilter), "strings" in n && t(24, k = n.strings), "test" in n && t(19, m = n.test), "verifyurl" in n && t(20, y = n.verifyurl), "workers" in n && t(21, d = n.workers);
1087
- }, r.$$.update = () => {
1088
- r.$$.dirty[0] & /*challengejson*/
1089
- 8388608 && (i = h ? Me(h) : void 0), r.$$.dirty[0] & /*strings*/
1090
- 16777216 && t(28, o = k ? Me(k) : {}), r.$$.dirty[0] & /*parsedStrings*/
1091
- 268435456 && t(9, l = {
1086
+ return t.$$set = (n) => {
1087
+ "auto" in n && r(0, s = n.auto), "blockspam" in n && r(22, f = n.blockspam), "challengeurl" in n && r(12, a = n.challengeurl), "challengejson" in n && r(23, u = n.challengejson), "debug" in n && r(13, j = n.debug), "expire" in n && r(14, C = n.expire), "hidefooter" in n && r(1, M = n.hidefooter), "hidelogo" in n && r(2, V = n.hidelogo), "name" in n && r(3, D = n.name), "maxnumber" in n && r(15, p = n.maxnumber), "mockerror" in n && r(16, H = n.mockerror), "refetchonexpire" in n && r(17, X = n.refetchonexpire), "spamfilter" in n && r(18, k = n.spamfilter), "strings" in n && r(24, x = n.strings), "test" in n && r(19, m = n.test), "verifyurl" in n && r(20, y = n.verifyurl), "workers" in n && r(21, d = n.workers), "workerurl" in n && r(25, I = n.workerurl);
1088
+ }, t.$$.update = () => {
1089
+ t.$$.dirty[0] & /*challengejson*/
1090
+ 8388608 && (i = u ? Ue(u) : void 0), t.$$.dirty[0] & /*strings*/
1091
+ 16777216 && r(29, o = x ? Ue(x) : {}), t.$$.dirty[0] & /*parsedStrings*/
1092
+ 536870912 && r(9, l = {
1093
+ ariaLinkLabel: Ve,
1092
1094
  error: "Verification failed. Try again later.",
1093
1095
  expired: "Verification expired. Try again.",
1094
- footer: `Protected by <a href="${He}" target="_blank">ALTCHA</a>`,
1096
+ footer: `Protected by <a href="${Ye}" target="_blank" aria-label="${o.ariaLinkLabel || Ve}">ALTCHA</a>`,
1095
1097
  label: "I'm not a robot",
1096
1098
  verified: "Verified",
1097
1099
  verifying: "Verifying...",
1098
1100
  waitAlert: "Verifying... please wait.",
1099
1101
  ...o
1100
- }), r.$$.dirty[0] & /*payload, state*/
1101
- 48 && I("statechange", { payload: Y, state: U });
1102
+ }), t.$$.dirty[0] & /*payload, state*/
1103
+ 48 && ce("statechange", { payload: W, state: U });
1102
1104
  }, [
1103
1105
  s,
1104
1106
  M,
1105
1107
  V,
1106
1108
  D,
1107
- Y,
1109
+ W,
1108
1110
  U,
1109
1111
  F,
1110
1112
  ne,
1111
- ce,
1113
+ ae,
1112
1114
  l,
1113
- Be,
1114
- Ke,
1115
+ Je,
1116
+ Qe,
1115
1117
  a,
1116
- Z,
1118
+ j,
1117
1119
  C,
1118
1120
  p,
1119
1121
  H,
1120
1122
  X,
1121
- _,
1123
+ k,
1122
1124
  m,
1123
1125
  y,
1124
1126
  d,
1125
1127
  f,
1126
- h,
1127
- k,
1128
- xe,
1128
+ u,
1129
+ x,
1130
+ I,
1131
+ Ee,
1129
1132
  oe,
1130
- P,
1133
+ Y,
1131
1134
  o,
1132
- et,
1133
- tt
1135
+ rt,
1136
+ nt
1134
1137
  ];
1135
1138
  }
1136
- class Ft extends Lt {
1139
+ class Wt extends Nt {
1137
1140
  constructor(e) {
1138
- super(), $t(
1141
+ super(), It(
1139
1142
  this,
1140
1143
  e,
1144
+ Ht,
1141
1145
  Ot,
1142
- Dt,
1143
- ot,
1146
+ at,
1144
1147
  {
1145
1148
  auto: 0,
1146
1149
  blockspam: 22,
@@ -1159,11 +1162,12 @@ class Ft extends Lt {
1159
1162
  test: 19,
1160
1163
  verifyurl: 20,
1161
1164
  workers: 21,
1162
- configure: 25,
1163
- reset: 26,
1164
- verify: 27
1165
+ workerurl: 25,
1166
+ configure: 26,
1167
+ reset: 27,
1168
+ verify: 28
1165
1169
  },
1166
- At,
1170
+ Mt,
1167
1171
  [-1, -1]
1168
1172
  );
1169
1173
  }
@@ -1171,115 +1175,122 @@ class Ft extends Lt {
1171
1175
  return this.$$.ctx[0];
1172
1176
  }
1173
1177
  set auto(e) {
1174
- this.$$set({ auto: e }), $();
1178
+ this.$$set({ auto: e }), _();
1175
1179
  }
1176
1180
  get blockspam() {
1177
1181
  return this.$$.ctx[22];
1178
1182
  }
1179
1183
  set blockspam(e) {
1180
- this.$$set({ blockspam: e }), $();
1184
+ this.$$set({ blockspam: e }), _();
1181
1185
  }
1182
1186
  get challengeurl() {
1183
1187
  return this.$$.ctx[12];
1184
1188
  }
1185
1189
  set challengeurl(e) {
1186
- this.$$set({ challengeurl: e }), $();
1190
+ this.$$set({ challengeurl: e }), _();
1187
1191
  }
1188
1192
  get challengejson() {
1189
1193
  return this.$$.ctx[23];
1190
1194
  }
1191
1195
  set challengejson(e) {
1192
- this.$$set({ challengejson: e }), $();
1196
+ this.$$set({ challengejson: e }), _();
1193
1197
  }
1194
1198
  get debug() {
1195
1199
  return this.$$.ctx[13];
1196
1200
  }
1197
1201
  set debug(e) {
1198
- this.$$set({ debug: e }), $();
1202
+ this.$$set({ debug: e }), _();
1199
1203
  }
1200
1204
  get expire() {
1201
1205
  return this.$$.ctx[14];
1202
1206
  }
1203
1207
  set expire(e) {
1204
- this.$$set({ expire: e }), $();
1208
+ this.$$set({ expire: e }), _();
1205
1209
  }
1206
1210
  get hidefooter() {
1207
1211
  return this.$$.ctx[1];
1208
1212
  }
1209
1213
  set hidefooter(e) {
1210
- this.$$set({ hidefooter: e }), $();
1214
+ this.$$set({ hidefooter: e }), _();
1211
1215
  }
1212
1216
  get hidelogo() {
1213
1217
  return this.$$.ctx[2];
1214
1218
  }
1215
1219
  set hidelogo(e) {
1216
- this.$$set({ hidelogo: e }), $();
1220
+ this.$$set({ hidelogo: e }), _();
1217
1221
  }
1218
1222
  get name() {
1219
1223
  return this.$$.ctx[3];
1220
1224
  }
1221
1225
  set name(e) {
1222
- this.$$set({ name: e }), $();
1226
+ this.$$set({ name: e }), _();
1223
1227
  }
1224
1228
  get maxnumber() {
1225
1229
  return this.$$.ctx[15];
1226
1230
  }
1227
1231
  set maxnumber(e) {
1228
- this.$$set({ maxnumber: e }), $();
1232
+ this.$$set({ maxnumber: e }), _();
1229
1233
  }
1230
1234
  get mockerror() {
1231
1235
  return this.$$.ctx[16];
1232
1236
  }
1233
1237
  set mockerror(e) {
1234
- this.$$set({ mockerror: e }), $();
1238
+ this.$$set({ mockerror: e }), _();
1235
1239
  }
1236
1240
  get refetchonexpire() {
1237
1241
  return this.$$.ctx[17];
1238
1242
  }
1239
1243
  set refetchonexpire(e) {
1240
- this.$$set({ refetchonexpire: e }), $();
1244
+ this.$$set({ refetchonexpire: e }), _();
1241
1245
  }
1242
1246
  get spamfilter() {
1243
1247
  return this.$$.ctx[18];
1244
1248
  }
1245
1249
  set spamfilter(e) {
1246
- this.$$set({ spamfilter: e }), $();
1250
+ this.$$set({ spamfilter: e }), _();
1247
1251
  }
1248
1252
  get strings() {
1249
1253
  return this.$$.ctx[24];
1250
1254
  }
1251
1255
  set strings(e) {
1252
- this.$$set({ strings: e }), $();
1256
+ this.$$set({ strings: e }), _();
1253
1257
  }
1254
1258
  get test() {
1255
1259
  return this.$$.ctx[19];
1256
1260
  }
1257
1261
  set test(e) {
1258
- this.$$set({ test: e }), $();
1262
+ this.$$set({ test: e }), _();
1259
1263
  }
1260
1264
  get verifyurl() {
1261
1265
  return this.$$.ctx[20];
1262
1266
  }
1263
1267
  set verifyurl(e) {
1264
- this.$$set({ verifyurl: e }), $();
1268
+ this.$$set({ verifyurl: e }), _();
1265
1269
  }
1266
1270
  get workers() {
1267
1271
  return this.$$.ctx[21];
1268
1272
  }
1269
1273
  set workers(e) {
1270
- this.$$set({ workers: e }), $();
1274
+ this.$$set({ workers: e }), _();
1271
1275
  }
1272
- get configure() {
1276
+ get workerurl() {
1273
1277
  return this.$$.ctx[25];
1274
1278
  }
1275
- get reset() {
1279
+ set workerurl(e) {
1280
+ this.$$set({ workerurl: e }), _();
1281
+ }
1282
+ get configure() {
1276
1283
  return this.$$.ctx[26];
1277
1284
  }
1278
- get verify() {
1285
+ get reset() {
1279
1286
  return this.$$.ctx[27];
1280
1287
  }
1288
+ get verify() {
1289
+ return this.$$.ctx[28];
1290
+ }
1281
1291
  }
1282
- customElements.define("altcha-widget", Ct(Ft, { auto: {}, blockspam: {}, challengeurl: {}, challengejson: {}, debug: { type: "Boolean" }, expire: {}, hidefooter: { type: "Boolean" }, hidelogo: { type: "Boolean" }, name: {}, maxnumber: {}, mockerror: { type: "Boolean" }, refetchonexpire: { type: "Boolean" }, spamfilter: { type: "Boolean" }, strings: {}, test: { type: "Boolean" }, verifyurl: {}, workers: {} }, [], ["configure", "reset", "verify"], !1));
1292
+ customElements.define("altcha-widget", zt(Wt, { auto: {}, blockspam: {}, challengeurl: {}, challengejson: {}, debug: { type: "Boolean" }, expire: {}, hidefooter: { type: "Boolean" }, hidelogo: { type: "Boolean" }, name: {}, maxnumber: {}, mockerror: { type: "Boolean" }, refetchonexpire: { type: "Boolean" }, spamfilter: { type: "Boolean" }, strings: {}, test: { type: "Boolean" }, verifyurl: {}, workers: {}, workerurl: {} }, [], ["configure", "reset", "verify"], !1));
1293
+ globalThis.createAltchaWorker = (t) => t ? new Worker(new URL(t)) : new ct();
1283
1294
  export {
1284
- Ft as Altcha
1295
+ Wt as Altcha
1285
1296
  };