@masonitestudios/spartanauth-widgets 0.1.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.
@@ -0,0 +1,2615 @@
1
+ const qt = (e, t) => e === t, Ne = {
2
+ equals: qt
3
+ };
4
+ let gt = At;
5
+ const Ae = 1, ze = 2, mt = {
6
+ owned: null,
7
+ cleanups: null,
8
+ context: null,
9
+ owner: null
10
+ };
11
+ var ne = null;
12
+ let Ke = null, Lt = null, q = null, X = null, me = null, Le = 0;
13
+ function Ut(e, t) {
14
+ const n = q, r = ne, u = e.length === 0, s = t === void 0 ? r : t, a = u ? mt : {
15
+ owned: null,
16
+ cleanups: null,
17
+ context: s ? s.context : null,
18
+ owner: s
19
+ }, i = u ? e : () => e(() => Ue(() => Te(a)));
20
+ ne = a, q = null;
21
+ try {
22
+ return Ie(i, !0);
23
+ } finally {
24
+ q = n, ne = r;
25
+ }
26
+ }
27
+ function w(e, t) {
28
+ t = t ? Object.assign({}, Ne, t) : Ne;
29
+ const n = {
30
+ value: e,
31
+ observers: null,
32
+ observerSlots: null,
33
+ comparator: t.equals || void 0
34
+ }, r = (u) => (typeof u == "function" && (u = u(n.value)), Ct(n, u));
35
+ return [bt.bind(n), r];
36
+ }
37
+ function T(e, t, n) {
38
+ const r = Qe(e, t, !1, Ae);
39
+ Oe(r);
40
+ }
41
+ function Jt(e, t, n) {
42
+ gt = Gt;
43
+ const r = Qe(e, t, !1, Ae);
44
+ r.user = !0, me ? me.push(r) : Oe(r);
45
+ }
46
+ function F(e, t, n) {
47
+ n = n ? Object.assign({}, Ne, n) : Ne;
48
+ const r = Qe(e, t, !0, 0);
49
+ return r.observers = null, r.observerSlots = null, r.comparator = n.equals || void 0, Oe(r), bt.bind(r);
50
+ }
51
+ function Ue(e) {
52
+ if (q === null) return e();
53
+ const t = q;
54
+ q = null;
55
+ try {
56
+ return e();
57
+ } finally {
58
+ q = t;
59
+ }
60
+ }
61
+ function Xe(e) {
62
+ Jt(() => Ue(e));
63
+ }
64
+ function bt() {
65
+ if (this.sources && this.state)
66
+ if (this.state === Ae) Oe(this);
67
+ else {
68
+ const e = X;
69
+ X = null, Ie(() => Re(this), !1), X = e;
70
+ }
71
+ if (q) {
72
+ const e = this.observers ? this.observers.length : 0;
73
+ q.sources ? (q.sources.push(this), q.sourceSlots.push(e)) : (q.sources = [this], q.sourceSlots = [e]), this.observers ? (this.observers.push(q), this.observerSlots.push(q.sources.length - 1)) : (this.observers = [q], this.observerSlots = [q.sources.length - 1]);
74
+ }
75
+ return this.value;
76
+ }
77
+ function Ct(e, t, n) {
78
+ let r = e.value;
79
+ return (!e.comparator || !e.comparator(r, t)) && (e.value = t, e.observers && e.observers.length && Ie(() => {
80
+ for (let u = 0; u < e.observers.length; u += 1) {
81
+ const s = e.observers[u], a = Ke && Ke.running;
82
+ a && Ke.disposed.has(s), (a ? !s.tState : !s.state) && (s.pure ? X.push(s) : me.push(s), s.observers && Ft(s)), a || (s.state = Ae);
83
+ }
84
+ if (X.length > 1e6)
85
+ throw X = [], new Error();
86
+ }, !1)), t;
87
+ }
88
+ function Oe(e) {
89
+ if (!e.fn) return;
90
+ Te(e);
91
+ const t = Le;
92
+ Kt(
93
+ e,
94
+ e.value,
95
+ t
96
+ );
97
+ }
98
+ function Kt(e, t, n) {
99
+ let r;
100
+ const u = ne, s = q;
101
+ q = ne = e;
102
+ try {
103
+ r = e.fn(t);
104
+ } catch (a) {
105
+ return e.pure && (e.state = Ae, e.owned && e.owned.forEach(Te), e.owned = null), e.updatedAt = n + 1, Et(a);
106
+ } finally {
107
+ q = s, ne = u;
108
+ }
109
+ (!e.updatedAt || e.updatedAt <= n) && (e.updatedAt != null && "observers" in e ? Ct(e, r) : e.value = r, e.updatedAt = n);
110
+ }
111
+ function Qe(e, t, n, r = Ae, u) {
112
+ const s = {
113
+ fn: e,
114
+ state: r,
115
+ updatedAt: null,
116
+ owned: null,
117
+ sources: null,
118
+ sourceSlots: null,
119
+ cleanups: null,
120
+ value: t,
121
+ owner: ne,
122
+ context: ne ? ne.context : null,
123
+ pure: n
124
+ };
125
+ return ne === null || ne !== mt && (ne.owned ? ne.owned.push(s) : ne.owned = [s]), s;
126
+ }
127
+ function Me(e) {
128
+ if (e.state === 0) return;
129
+ if (e.state === ze) return Re(e);
130
+ if (e.suspense && Ue(e.suspense.inFallback)) return e.suspense.effects.push(e);
131
+ const t = [e];
132
+ for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < Le); )
133
+ e.state && t.push(e);
134
+ for (let n = t.length - 1; n >= 0; n--)
135
+ if (e = t[n], e.state === Ae)
136
+ Oe(e);
137
+ else if (e.state === ze) {
138
+ const r = X;
139
+ X = null, Ie(() => Re(e, t[0]), !1), X = r;
140
+ }
141
+ }
142
+ function Ie(e, t) {
143
+ if (X) return e();
144
+ let n = !1;
145
+ t || (X = []), me ? n = !0 : me = [], Le++;
146
+ try {
147
+ const r = e();
148
+ return Vt(n), r;
149
+ } catch (r) {
150
+ n || (me = null), X = null, Et(r);
151
+ }
152
+ }
153
+ function Vt(e) {
154
+ if (X && (At(X), X = null), e) return;
155
+ const t = me;
156
+ me = null, t.length && Ie(() => gt(t), !1);
157
+ }
158
+ function At(e) {
159
+ for (let t = 0; t < e.length; t++) Me(e[t]);
160
+ }
161
+ function Gt(e) {
162
+ let t, n = 0;
163
+ for (t = 0; t < e.length; t++) {
164
+ const r = e[t];
165
+ r.user ? e[n++] = r : Me(r);
166
+ }
167
+ for (t = 0; t < n; t++) Me(e[t]);
168
+ }
169
+ function Re(e, t) {
170
+ e.state = 0;
171
+ for (let n = 0; n < e.sources.length; n += 1) {
172
+ const r = e.sources[n];
173
+ if (r.sources) {
174
+ const u = r.state;
175
+ u === Ae ? r !== t && (!r.updatedAt || r.updatedAt < Le) && Me(r) : u === ze && Re(r, t);
176
+ }
177
+ }
178
+ }
179
+ function Ft(e) {
180
+ for (let t = 0; t < e.observers.length; t += 1) {
181
+ const n = e.observers[t];
182
+ n.state || (n.state = ze, n.pure ? X.push(n) : me.push(n), n.observers && Ft(n));
183
+ }
184
+ }
185
+ function Te(e) {
186
+ let t;
187
+ if (e.sources)
188
+ for (; e.sources.length; ) {
189
+ const n = e.sources.pop(), r = e.sourceSlots.pop(), u = n.observers;
190
+ if (u && u.length) {
191
+ const s = u.pop(), a = n.observerSlots.pop();
192
+ r < u.length && (s.sourceSlots[a] = r, u[r] = s, n.observerSlots[r] = a);
193
+ }
194
+ }
195
+ if (e.tOwned) {
196
+ for (t = e.tOwned.length - 1; t >= 0; t--) Te(e.tOwned[t]);
197
+ delete e.tOwned;
198
+ }
199
+ if (e.owned) {
200
+ for (t = e.owned.length - 1; t >= 0; t--) Te(e.owned[t]);
201
+ e.owned = null;
202
+ }
203
+ if (e.cleanups) {
204
+ for (t = e.cleanups.length - 1; t >= 0; t--) e.cleanups[t]();
205
+ e.cleanups = null;
206
+ }
207
+ e.state = 0;
208
+ }
209
+ function Wt(e) {
210
+ return e instanceof Error ? e : new Error(typeof e == "string" ? e : "Unknown error", {
211
+ cause: e
212
+ });
213
+ }
214
+ function Et(e, t = ne) {
215
+ throw Wt(e);
216
+ }
217
+ function Ht(e, t, n) {
218
+ let r = n.length, u = t.length, s = r, a = 0, i = 0, C = t[u - 1].nextSibling, y = null;
219
+ for (; a < u || i < s; ) {
220
+ if (t[a] === n[i]) {
221
+ a++, i++;
222
+ continue;
223
+ }
224
+ for (; t[u - 1] === n[s - 1]; )
225
+ u--, s--;
226
+ if (u === a) {
227
+ const p = s < r ? i ? n[i - 1].nextSibling : n[s - i] : C;
228
+ for (; i < s; ) e.insertBefore(n[i++], p);
229
+ } else if (s === i)
230
+ for (; a < u; )
231
+ (!y || !y.has(t[a])) && t[a].remove(), a++;
232
+ else if (t[a] === n[s - 1] && n[i] === t[u - 1]) {
233
+ const p = t[--u].nextSibling;
234
+ e.insertBefore(n[i++], t[a++].nextSibling), e.insertBefore(n[--s], p), t[u] = n[s];
235
+ } else {
236
+ if (!y) {
237
+ y = /* @__PURE__ */ new Map();
238
+ let S = i;
239
+ for (; S < s; ) y.set(n[S], S++);
240
+ }
241
+ const p = y.get(t[a]);
242
+ if (p != null)
243
+ if (i < p && p < s) {
244
+ let S = a, re = 1, ae;
245
+ for (; ++S < u && S < s && !((ae = y.get(t[S])) == null || ae !== p + re); )
246
+ re++;
247
+ if (re > p - i) {
248
+ const de = t[a];
249
+ for (; i < p; ) e.insertBefore(n[i++], de);
250
+ } else e.replaceChild(n[i++], t[a++]);
251
+ } else a++;
252
+ else t[a++].remove();
253
+ }
254
+ }
255
+ }
256
+ const at = "_$DX_DELEGATE";
257
+ function x(e, t, n, r) {
258
+ let u;
259
+ const s = () => {
260
+ const i = document.createElement("template");
261
+ return i.innerHTML = e, i.content.firstChild;
262
+ }, a = () => (u || (u = s())).cloneNode(!0);
263
+ return a.cloneNode = a, a;
264
+ }
265
+ function et(e, t = window.document) {
266
+ const n = t[at] || (t[at] = /* @__PURE__ */ new Set());
267
+ for (let r = 0, u = e.length; r < u; r++) {
268
+ const s = e[r];
269
+ n.has(s) || (n.add(s), t.addEventListener(s, Zt));
270
+ }
271
+ }
272
+ function ce(e, t, n) {
273
+ n == null ? e.removeAttribute(t) : e.setAttribute(t, n);
274
+ }
275
+ function vt(e, t, n) {
276
+ return Ue(() => e(t, n));
277
+ }
278
+ function c(e, t, n, r) {
279
+ if (n !== void 0 && !r && (r = []), typeof t != "function") return je(e, t, r, n);
280
+ T((u) => je(e, t(), u, n), r);
281
+ }
282
+ function Zt(e) {
283
+ let t = e.target;
284
+ const n = `$$${e.type}`, r = e.target, u = e.currentTarget, s = (C) => Object.defineProperty(e, "target", {
285
+ configurable: !0,
286
+ value: C
287
+ }), a = () => {
288
+ const C = t[n];
289
+ if (C && !t.disabled) {
290
+ const y = t[`${n}Data`];
291
+ if (y !== void 0 ? C.call(t, y, e) : C.call(t, e), e.cancelBubble) return;
292
+ }
293
+ return t.host && typeof t.host != "string" && !t.host._$host && t.contains(e.target) && s(t.host), !0;
294
+ }, i = () => {
295
+ for (; a() && (t = t._$host || t.parentNode || t.host); ) ;
296
+ };
297
+ if (Object.defineProperty(e, "currentTarget", {
298
+ configurable: !0,
299
+ get() {
300
+ return t || document;
301
+ }
302
+ }), e.composedPath) {
303
+ const C = e.composedPath();
304
+ s(C[0]);
305
+ for (let y = 0; y < C.length - 2 && (t = C[y], !!a()); y++) {
306
+ if (t._$host) {
307
+ t = t._$host, i();
308
+ break;
309
+ }
310
+ if (t.parentNode === u)
311
+ break;
312
+ }
313
+ } else i();
314
+ s(r);
315
+ }
316
+ function je(e, t, n, r, u) {
317
+ for (; typeof n == "function"; ) n = n();
318
+ if (t === n) return n;
319
+ const s = typeof t, a = r !== void 0;
320
+ if (e = a && n[0] && n[0].parentNode || e, s === "string" || s === "number") {
321
+ if (s === "number" && (t = t.toString(), t === n))
322
+ return n;
323
+ if (a) {
324
+ let i = n[0];
325
+ i && i.nodeType === 3 ? i.data !== t && (i.data = t) : i = document.createTextNode(t), n = we(e, n, r, i);
326
+ } else
327
+ n !== "" && typeof n == "string" ? n = e.firstChild.data = t : n = e.textContent = t;
328
+ } else if (t == null || s === "boolean")
329
+ n = we(e, n, r);
330
+ else {
331
+ if (s === "function")
332
+ return T(() => {
333
+ let i = t();
334
+ for (; typeof i == "function"; ) i = i();
335
+ n = je(e, i, n, r);
336
+ }), () => n;
337
+ if (Array.isArray(t)) {
338
+ const i = [], C = n && Array.isArray(n);
339
+ if (He(i, t, n, u))
340
+ return T(() => n = je(e, i, n, r, !0)), () => n;
341
+ if (i.length === 0) {
342
+ if (n = we(e, n, r), a) return n;
343
+ } else C ? n.length === 0 ? it(e, i, r) : Ht(e, n, i) : (n && we(e), it(e, i));
344
+ n = i;
345
+ } else if (t.nodeType) {
346
+ if (Array.isArray(n)) {
347
+ if (a) return n = we(e, n, r, t);
348
+ we(e, n, null, t);
349
+ } else n == null || n === "" || !e.firstChild ? e.appendChild(t) : e.replaceChild(t, e.firstChild);
350
+ n = t;
351
+ }
352
+ }
353
+ return n;
354
+ }
355
+ function He(e, t, n, r) {
356
+ let u = !1;
357
+ for (let s = 0, a = t.length; s < a; s++) {
358
+ let i = t[s], C = n && n[e.length], y;
359
+ if (!(i == null || i === !0 || i === !1)) if ((y = typeof i) == "object" && i.nodeType)
360
+ e.push(i);
361
+ else if (Array.isArray(i))
362
+ u = He(e, i, C) || u;
363
+ else if (y === "function")
364
+ if (r) {
365
+ for (; typeof i == "function"; ) i = i();
366
+ u = He(
367
+ e,
368
+ Array.isArray(i) ? i : [i],
369
+ Array.isArray(C) ? C : [C]
370
+ ) || u;
371
+ } else
372
+ e.push(i), u = !0;
373
+ else {
374
+ const p = String(i);
375
+ C && C.nodeType === 3 && C.data === p ? e.push(C) : e.push(document.createTextNode(p));
376
+ }
377
+ }
378
+ return u;
379
+ }
380
+ function it(e, t, n = null) {
381
+ for (let r = 0, u = t.length; r < u; r++) e.insertBefore(t[r], n);
382
+ }
383
+ function we(e, t, n, r) {
384
+ if (n === void 0) return e.textContent = "";
385
+ const u = r || document.createTextNode("");
386
+ if (t.length) {
387
+ let s = !1;
388
+ for (let a = t.length - 1; a >= 0; a--) {
389
+ const i = t[a];
390
+ if (u !== i) {
391
+ const C = i.parentNode === e;
392
+ !s && !a ? C ? e.replaceChild(u, i) : e.insertBefore(u, n) : C && i.remove();
393
+ } else s = !0;
394
+ }
395
+ } else e.insertBefore(u, n);
396
+ return [u];
397
+ }
398
+ function Yt(e) {
399
+ return Object.keys(e).reduce((n, r) => {
400
+ const u = e[r];
401
+ return n[r] = Object.assign({}, u), yt(u.value) && !nn(u.value) && !Array.isArray(u.value) && (n[r].value = Object.assign({}, u.value)), Array.isArray(u.value) && (n[r].value = u.value.slice(0)), n;
402
+ }, {});
403
+ }
404
+ function Xt(e) {
405
+ return e ? Object.keys(e).reduce((n, r) => {
406
+ const u = e[r];
407
+ return n[r] = yt(u) && "value" in u ? u : {
408
+ value: u
409
+ }, n[r].attribute || (n[r].attribute = tn(r)), n[r].parse = "parse" in n[r] ? n[r].parse : typeof n[r].value != "string", n;
410
+ }, {}) : {};
411
+ }
412
+ function Qt(e) {
413
+ return Object.keys(e).reduce((n, r) => (n[r] = e[r].value, n), {});
414
+ }
415
+ function en(e, t) {
416
+ const n = Yt(t);
417
+ return Object.keys(t).forEach((u) => {
418
+ const s = n[u], a = e.getAttribute(s.attribute), i = e[u];
419
+ a != null && (s.value = s.parse ? wt(a) : a), i != null && (s.value = Array.isArray(i) ? i.slice(0) : i), s.reflect && ot(e, s.attribute, s.value, !!s.parse), Object.defineProperty(e, u, {
420
+ get() {
421
+ return s.value;
422
+ },
423
+ set(C) {
424
+ const y = s.value;
425
+ s.value = C, s.reflect && ot(this, s.attribute, s.value, !!s.parse);
426
+ for (let p = 0, S = this.__propertyChangedCallbacks.length; p < S; p++)
427
+ this.__propertyChangedCallbacks[p](u, C, y);
428
+ },
429
+ enumerable: !0,
430
+ configurable: !0
431
+ });
432
+ }), n;
433
+ }
434
+ function wt(e) {
435
+ if (e)
436
+ try {
437
+ return JSON.parse(e);
438
+ } catch {
439
+ return e;
440
+ }
441
+ }
442
+ function ot(e, t, n, r) {
443
+ if (n == null || n === !1) return e.removeAttribute(t);
444
+ let u = r ? JSON.stringify(n) : n;
445
+ e.__updating[t] = !0, u === "true" && (u = ""), e.setAttribute(t, u), Promise.resolve().then(() => delete e.__updating[t]);
446
+ }
447
+ function tn(e) {
448
+ return e.replace(/\.?([A-Z]+)/g, (t, n) => "-" + n.toLowerCase()).replace("_", "-").replace(/^-/, "");
449
+ }
450
+ function yt(e) {
451
+ return e != null && (typeof e == "object" || typeof e == "function");
452
+ }
453
+ function nn(e) {
454
+ return Object.prototype.toString.call(e) === "[object Function]";
455
+ }
456
+ function rn(e) {
457
+ return typeof e == "function" && e.toString().indexOf("class") === 0;
458
+ }
459
+ let Ve;
460
+ function un(e, t) {
461
+ const n = Object.keys(t);
462
+ return class extends e {
463
+ static get observedAttributes() {
464
+ return n.map((u) => t[u].attribute);
465
+ }
466
+ constructor() {
467
+ super(), this.__initialized = !1, this.__released = !1, this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props = {};
468
+ }
469
+ connectedCallback() {
470
+ if (this.__initialized) return;
471
+ this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props = en(this, t);
472
+ const u = Qt(this.props), s = this.Component, a = Ve;
473
+ try {
474
+ Ve = this, this.__initialized = !0, rn(s) ? new s(u, {
475
+ element: this
476
+ }) : s(u, {
477
+ element: this
478
+ });
479
+ } finally {
480
+ Ve = a;
481
+ }
482
+ }
483
+ async disconnectedCallback() {
484
+ if (await Promise.resolve(), this.isConnected) return;
485
+ this.__propertyChangedCallbacks.length = 0;
486
+ let u = null;
487
+ for (; u = this.__releaseCallbacks.pop(); ) u(this);
488
+ delete this.__initialized, this.__released = !0;
489
+ }
490
+ attributeChangedCallback(u, s, a) {
491
+ if (this.__initialized && !this.__updating[u] && (u = this.lookupProp(u), u in t)) {
492
+ if (a == null && !this[u]) return;
493
+ this[u] = t[u].parse ? wt(a) : a;
494
+ }
495
+ }
496
+ lookupProp(u) {
497
+ if (t)
498
+ return n.find((s) => u === s || u === t[s].attribute);
499
+ }
500
+ get renderRoot() {
501
+ return this.shadowRoot || this.attachShadow({
502
+ mode: "open"
503
+ });
504
+ }
505
+ addReleaseCallback(u) {
506
+ this.__releaseCallbacks.push(u);
507
+ }
508
+ addPropertyChangedCallback(u) {
509
+ this.__propertyChangedCallbacks.push(u);
510
+ }
511
+ };
512
+ }
513
+ function sn(e, t = {}, n = {}) {
514
+ const {
515
+ BaseElement: r = HTMLElement,
516
+ extension: u,
517
+ customElements: s = window.customElements
518
+ } = n;
519
+ return (a) => {
520
+ if (!e) throw new Error("tag is required to register a Component");
521
+ let i = s.get(e);
522
+ return i ? (i.prototype.Component = a, i) : (i = un(r, Xt(t)), i.prototype.Component = a, i.prototype.registeredTag = e, s.define(e, i, u), i);
523
+ };
524
+ }
525
+ function an(e) {
526
+ const t = Object.keys(e), n = {};
527
+ for (let r = 0; r < t.length; r++) {
528
+ const [u, s] = w(e[t[r]]);
529
+ Object.defineProperty(n, t[r], {
530
+ get: u,
531
+ set(a) {
532
+ s(() => a);
533
+ }
534
+ });
535
+ }
536
+ return n;
537
+ }
538
+ function on(e) {
539
+ if (e.assignedSlot && e.assignedSlot._$owner) return e.assignedSlot._$owner;
540
+ let t = e.parentNode;
541
+ for (; t && !t._$owner && !(t.assignedSlot && t.assignedSlot._$owner); )
542
+ t = t.parentNode;
543
+ return t && t.assignedSlot ? t.assignedSlot._$owner : e._$owner;
544
+ }
545
+ function ln(e) {
546
+ return (t, n) => {
547
+ const { element: r } = n;
548
+ return Ut((u) => {
549
+ const s = an(t);
550
+ r.addPropertyChangedCallback((i, C) => s[i] = C), r.addReleaseCallback(() => {
551
+ r.renderRoot.textContent = "", u();
552
+ });
553
+ const a = e(s, n);
554
+ return c(r.renderRoot, a);
555
+ }, on(r));
556
+ };
557
+ }
558
+ function tt(e, t, n) {
559
+ return arguments.length === 2 && (n = t, t = {}), sn(e, t)(ln(n));
560
+ }
561
+ var cn = "٠١٢٣٤٥٦٧٨٩", dn = "۰۱۲۳۴۵۶۷۸۹", Dn = "൦൧൨൩൪൫൬൭൮൯", fn = "೦೧೨೩೪೫೬೭೮೯", hn = "໐໑໒໓໔໕໖໗໘໙", pn = "୦୧୨୩୪୫୬୭୮୯", gn = "០១២៣៤៥៦៧៨៩", mn = "߀߁߂߃߄߅߆߇߈߉", bn = "੦੧੨੩੪੫੬੭੮੯", Cn = "૦૧૨૩૪૫૬૭૮૯", An = "०१२३४५६७८९", Fn = "၀၁၂၃၄၅၆၇၈၉", En = "௦௧௨௩௪௫௬௭௮௯", vn = "౦౧౨౩౪౫౬౭౮౯", wn = "๐๑๒๓๔๕๖๗๘๙", yn = "༠༡༢༣༤༥༦༧༨༩", lt = { ar: cn, fa: dn, ml: Dn, kn: fn, lo: hn, or: pn, kh: gn, nqo: mn, pa: bn, gu: Cn, hi: An, my: Fn, ta: En, te: vn, th: wn, bo: yn }, Bn = ["ru"], $n = ["id"], kn = ["id"], xn = ["ady-cyrl"], _n = ["aeb-arab"], Sn = ["sq"], Tn = ["ru"], On = ["zh-hant"], In = ["es"], Pn = ["hi"], Nn = ["es"], zn = ["ar"], Mn = ["ar"], Rn = ["ar"], jn = ["es"], qn = ["fr"], Ln = ["ru"], Un = ["fr", "es", "ru"], Jn = ["hi"], Kn = ["es"], Vn = ["fa"], Gn = ["ru"], Wn = ["id"], Hn = ["de"], Zn = ["bbc-latn"], Yn = ["fa"], Xn = ["fa"], Qn = ["bho"], er = ["en"], tr = ["id"], nr = ["fr"], rr = ["bn"], ur = ["fa"], sr = ["fr"], ar = ["id"], ir = ["id"], or = ["ru"], lr = ["oc"], cr = ["nan", "zh-hant"], dr = ["ru"], Dr = ["it"], fr = ["crh-latn"], hr = ["sk"], pr = ["pl"], gr = ["ru"], mr = ["hsb", "de"], br = ["ms"], Cr = ["ne"], Ar = ["it"], Fr = ["it"], Er = ["es"], vr = ["fr"], wr = ["fi"], yr = ["fr"], Br = ["fr"], $r = ["de"], kr = ["it"], xr = ["tr"], _r = ["gan-hant", "zh-hant", "zh-hans"], Sr = ["fr"], Tr = ["pt"], Or = ["fa"], Ir = ["es"], Pr = ["gom-deva"], Nr = ["id"], zr = ["de"], Mr = ["es"], Rr = ["zh-hant"], jr = ["hif-latn"], qr = ["de"], Lr = ["dsb", "de"], Ur = ["fr"], Jr = ["hy"], Kr = ["zh-cn", "zh-hans"], Vr = ["ru"], Gr = ["eo"], Wr = ["ike-cans"], Hr = ["en"], Zr = ["da"], Yr = ["id"], Xr = ["kk-latn", "kk-cyrl"], Qr = ["fr"], eu = ["kbd-cyrl"], tu = ["fr"], nu = ["ur"], ru = ["tr"], uu = ["my"], su = ["kk-cyrl"], au = ["da"], iu = ["ru"], ou = ["ru"], lu = ["fi"], cu = ["ks-arab"], du = ["de"], Du = ["ku-latn"], fu = ["ru"], hu = ["ru"], pu = ["es"], gu = ["de"], mu = ["ru"], bu = ["ru", "az"], Cu = ["nl"], Au = ["it"], Fu = ["et"], Eu = ["fa"], vu = ["it", "rm", "fur"], wu = ["pms", "eml", "lij", "vec", "it"], yu = ["fr"], Bu = ["fa"], $u = ["lv"], ku = ["fa"], xu = ["zh-hant"], _u = ["tr"], Su = ["id"], Tu = ["hi"], Ou = ["myv", "ru"], Iu = ["fr"], Pu = ["mrj", "ru"], Nu = ["id"], zu = ["my"], Mu = ["ro"], Ru = ["mhr", "ru"], ju = ["pt"], qu = ["mdf", "ru"], Lu = ["fa"], Uu = ["es"], Ju = ["cdo", "zh-hant"], Ku = ["it"], Vu = ["nn"], Gu = ["de"], Wu = ["id"], Hu = ["nb"], Zu = ["fr"], Yu = ["ca", "fr"], Xu = ["fi"], Qu = ["ru"], es = ["fr"], ts = ["de"], ns = ["de"], rs = ["de"], us = ["en"], ss = ["it"], as = ["el"], is = ["pt-br"], os = ["qug", "es"], ls = ["qu", "es"], cs = ["it"], ds = ["ro"], Ds = ["uk", "ru"], fs = ["ro"], hs = ["ruq-latn", "ro"], ps = ["hi"], gs = ["ru"], ms = ["it"], bs = ["en"], Cs = ["it"], As = ["cbk", "fa"], Fs = ["fr"], Es = ["fr"], vs = ["lt"], ws = ["bs", "sr-el", "hr"], ys = ["fr"], Bs = ["shy-latn"], $s = ["cs"], ks = ["skr-arab"], xs = ["de"], _s = ["fi"], Ss = ["sr-ec"], Ts = ["nl"], Os = ["de"], Is = ["ru"], Ps = ["id"], Ns = ["pl"], zs = ["zh-tw", "zh-hant", "zh-hans"], Ms = ["zh-tw", "zh-hant", "zh-hans"], Rs = ["kn"], js = ["pt"], qs = ["tg-cyrl"], Ls = ["zh-tw", "zh-hant", "zh-hans"], Us = ["tt-cyrl", "ru"], Js = ["fr"], Ks = ["ru"], Vs = ["ru"], Gs = ["ug-arab"], Ws = ["it"], Hs = ["et"], Zs = ["nl"], Ys = ["de"], Xs = ["fi"], Qs = ["et"], ea = ["fr"], ta = ["fr"], na = ["zh-hans"], ra = ["ru"], ua = ["ka"], sa = ["he"], aa = ["zh-hans"], ia = ["nl"], oa = ["kab"], la = ["zh-hans"], Bt = { ab: Bn, abs: $n, ace: kn, ady: xn, aeb: _n, "aeb-arab": ["ar"], aln: Sn, alt: Tn, ami: On, an: In, anp: Pn, arn: Nn, arq: zn, ary: Mn, arz: Rn, ast: jn, atj: qn, av: Ln, avk: Un, awa: Jn, ay: Kn, azb: Vn, ba: Gn, ban: Wn, "ban-bali": ["ban"], bar: Hn, bbc: Zn, "bbc-latn": ["id"], bcc: Yn, "be-tarask": ["be"], bgn: Xn, bh: Qn, bi: er, bjn: tr, bm: nr, bpy: rr, bqi: ur, br: sr, btm: ar, bug: ir, bxr: or, ca: lr, "cbk-zam": ["es"], cdo: cr, ce: dr, co: Dr, crh: fr, "crh-cyrl": ["ru"], cs: hr, csb: pr, cv: gr, "de-at": ["de"], "de-ch": ["de"], "de-formal": ["de"], dsb: mr, dtp: br, dty: Cr, egl: Ar, eml: Fr, "en-ca": ["en"], "en-gb": ["en"], "es-419": ["es"], "es-formal": ["es"], ext: Er, ff: vr, fit: wr, frc: yr, frp: Br, frr: $r, fur: kr, gag: xr, gan: _r, "gan-hans": ["zh-hans"], "gan-hant": ["zh-hant", "zh-hans"], gcr: Sr, gl: Tr, glk: Or, gn: Ir, gom: Pr, "gom-deva": ["hi"], gor: Nr, gsw: zr, guc: Mr, hak: Rr, hif: jr, hrx: qr, hsb: Lr, ht: Ur, "hu-formal": ["hu"], hyw: Jr, ii: Kr, inh: Vr, io: Gr, iu: Wr, jam: Hr, jut: Zr, jv: Yr, kaa: Xr, kab: Qr, kbd: eu, kbp: tu, khw: nu, kiu: ru, kjp: uu, kk: su, "kk-arab": ["kk-cyrl"], "kk-cn": ["kk-arab", "kk-cyrl"], "kk-kz": ["kk-cyrl"], "kk-latn": ["kk-cyrl"], "kk-tr": ["kk-latn", "kk-cyrl"], kl: au, "ko-kp": ["ko"], koi: iu, krc: ou, krl: lu, ks: cu, ksh: du, ku: Du, "ku-arab": ["ckb"], kum: fu, kv: hu, lad: pu, lb: gu, lbe: mu, lez: bu, li: Cu, lij: Au, liv: Fu, lki: Eu, lld: vu, lmo: wu, ln: yu, lrc: Bu, ltg: $u, luz: ku, lzh: xu, lzz: _u, mad: Su, mai: Tu, "map-bms": ["jv", "id"], mdf: Ou, mg: Iu, mhr: Pu, min: Nu, mnw: zu, mo: Mu, mrj: Ru, "ms-arab": ["ms"], mwl: ju, myv: qu, mzn: Lu, nah: Uu, nan: Ju, nap: Ku, nb: Vu, nds: Gu, "nds-nl": ["nl"], nia: Wu, "nl-informal": ["nl"], nn: Hu, nrm: Zu, oc: Yu, olo: Xu, os: Qu, pcd: es, pdc: ts, pdt: ns, pfl: rs, pih: us, pms: ss, pnt: as, pt: is, "pt-br": ["pt"], qu: os, qug: ls, rgn: cs, rmy: ds, "roa-tara": ["it"], rue: Ds, rup: fs, ruq: hs, "ruq-cyrl": ["mk"], "ruq-latn": ["ro"], sa: ps, sah: gs, scn: ms, sco: bs, sdc: Cs, sdh: As, ses: Fs, sg: Es, sgs: vs, sh: ws, shi: ys, shy: Bs, "shy-latn": ["fr"], sk: $s, skr: ks, "skr-arab": ["ur", "pnb"], sli: xs, smn: _s, sr: Ss, srn: Ts, stq: Os, sty: Is, su: Ps, szl: Ns, szy: zs, tay: Ms, tcy: Rs, tet: js, tg: qs, trv: Ls, tt: Us, "tt-cyrl": ["ru"], ty: Js, tyv: Ks, udm: Vs, ug: Gs, vec: Ws, vep: Hs, vls: Zs, vmf: Ys, vot: Xs, vro: Qs, wa: ea, wo: ta, wuu: na, xal: ra, xmf: ua, yi: sa, za: aa, zea: ia, zgh: oa, zh: la, "zh-cn": ["zh-hans"], "zh-hant": ["zh-hans"], "zh-hk": ["zh-hant", "zh-hans"], "zh-mo": ["zh-hk", "zh-hant", "zh-hans"], "zh-my": ["zh-sg", "zh-hans"], "zh-sg": ["zh-hans"], "zh-tw": ["zh-hant", "zh-hans"] };
562
+ let se = class {
563
+ constructor(e) {
564
+ this.locale = e;
565
+ }
566
+ convertPlural(e, t) {
567
+ const n = /\d+=/i;
568
+ if (!t || t.length === 0) return "";
569
+ for (let u = 0; u < t.length; u++) {
570
+ const s = t[u];
571
+ if (n.test(s)) {
572
+ if (parseInt(s.slice(0, s.indexOf("=")), 10) === e) return s.slice(s.indexOf("=") + 1);
573
+ t[u] = void 0;
574
+ }
575
+ }
576
+ t = t.filter((u) => !!u);
577
+ let r = this.getPluralForm(e, this.locale);
578
+ return r = Math.min(r, t.length - 1), t[r];
579
+ }
580
+ getPluralForm(e, t) {
581
+ const n = ["zero", "one", "two", "few", "many", "other"], r = new Intl.PluralRules(t), u = r.resolvedOptions().pluralCategories, s = r.select(e);
582
+ return n.filter((a) => u.includes(a)).indexOf(s);
583
+ }
584
+ convertNumber(e, t = !1) {
585
+ let n = this.digitTransformTable(this.locale), r = "";
586
+ if (t) {
587
+ if (parseFloat(e, 10) === e || !n) return e;
588
+ const u = [];
589
+ for (const a in n) u[n[a]] = a;
590
+ n = u;
591
+ const s = String(e);
592
+ for (let a = 0; a < s.length; a++) r += n[s[a]] || s[a];
593
+ return parseFloat(r, 10);
594
+ }
595
+ if (Intl.NumberFormat) {
596
+ let u;
597
+ const s = [...Bt[this.locale] || [], "en"];
598
+ return Intl.NumberFormat.supportedLocalesOf(this.locale).length ? u = [this.locale] : u = s, r = new Intl.NumberFormat(u).format(e), r === "NaN" && (r = e), r;
599
+ }
600
+ }
601
+ convertGrammar(e) {
602
+ return e;
603
+ }
604
+ gender(e, t) {
605
+ if (!t || t.length === 0) return "";
606
+ for (; t.length < 2; ) t.push(t[t.length - 1]);
607
+ return e === "male" ? t[0] : e === "female" ? t[1] : t.length === 3 ? t[2] : t[0];
608
+ }
609
+ digitTransformTable(e) {
610
+ return lt[e] ? lt[e].split("") : !1;
611
+ }
612
+ }, ca = class extends se {
613
+ convertGrammar(e, t) {
614
+ switch (t) {
615
+ case "prefixed":
616
+ case "תחילית":
617
+ e.slice(0, 1) === "ו" && e.slice(0, 2) !== "וו" && (e = "ו" + e), e.slice(0, 1) === "ה" && (e = e.slice(1)), (e.slice(0, 1) < "א" || e.slice(0, 1) > "ת") && (e = "־" + e);
618
+ }
619
+ return e;
620
+ }
621
+ }, da = class extends se {
622
+ convertGrammar(t, n) {
623
+ switch (n) {
624
+ case "instrumental":
625
+ t = "s " + t;
626
+ break;
627
+ case "lokativ":
628
+ t = "o " + t;
629
+ break;
630
+ }
631
+ return t;
632
+ }
633
+ }, Da = class extends se {
634
+ convertGrammar(e, t) {
635
+ switch (t) {
636
+ case "instrumental":
637
+ e = "z " + e;
638
+ break;
639
+ case "lokatiw":
640
+ e = "wo " + e;
641
+ break;
642
+ }
643
+ return e;
644
+ }
645
+ }, fa = class extends se {
646
+ convertGrammar(e, t) {
647
+ switch (t) {
648
+ case "instrumental":
649
+ e = "z " + e;
650
+ break;
651
+ case "lokatiw":
652
+ e = "wo " + e;
653
+ break;
654
+ }
655
+ return e;
656
+ }
657
+ }, ha = class extends se {
658
+ convertGrammar(e, t) {
659
+ let n = e.match(/[aou][^äöy]*$/i);
660
+ const r = e;
661
+ switch (e.match(/wiki$/i) && (n = !1), e.match(/[bcdfghjklmnpqrstvwxz]$/i) && (e += "i"), t) {
662
+ case "genitive":
663
+ e += "n";
664
+ break;
665
+ case "elative":
666
+ e += n ? "sta" : "stä";
667
+ break;
668
+ case "partitive":
669
+ e += n ? "a" : "ä";
670
+ break;
671
+ case "illative":
672
+ e += e.slice(-1) + "n";
673
+ break;
674
+ case "inessive":
675
+ e += n ? "ssa" : "ssä";
676
+ break;
677
+ default:
678
+ e = r;
679
+ break;
680
+ }
681
+ return e;
682
+ }
683
+ }, pa = class extends se {
684
+ convertGrammar(e, t) {
685
+ return t === "genitive" && (e.slice(-1) === "ь" ? e = e.slice(0, -1) + "я" : e.slice(-2) === "ия" ? e = e.slice(0, -2) + "ии" : e.slice(-2) === "ка" ? e = e.slice(0, -2) + "ки" : e.slice(-2) === "ти" ? e = e.slice(0, -2) + "тей" : e.slice(-2) === "ды" ? e = e.slice(0, -2) + "дов" : e.slice(-3) === "ник" && (e = e.slice(0, -3) + "ника")), e;
686
+ }
687
+ };
688
+ class ga extends se {
689
+ convertGrammar(t, n) {
690
+ switch (n) {
691
+ case "mestnik":
692
+ t = "o " + t;
693
+ break;
694
+ case "orodnik":
695
+ t = "z " + t;
696
+ break;
697
+ }
698
+ return t;
699
+ }
700
+ }
701
+ let ma = class extends se {
702
+ convertGrammar(e, t) {
703
+ switch (t) {
704
+ case "genitive":
705
+ e = e.replace(/u[ms]$/i, "i"), e = e.replace(/ommunia$/i, "ommunium"), e = e.replace(/a$/i, "ae"), e = e.replace(/libri$/i, "librorum"), e = e.replace(/nuntii$/i, "nuntiorum"), e = e.replace(/tio$/i, "tionis"), e = e.replace(/ns$/i, "ntis"), e = e.replace(/as$/i, "atis"), e = e.replace(/es$/i, "ei");
706
+ break;
707
+ case "accusative":
708
+ e = e.replace(/u[ms]$/i, "um"), e = e.replace(/ommunia$/i, "am"), e = e.replace(/a$/i, "ommunia"), e = e.replace(/libri$/i, "libros"), e = e.replace(/nuntii$/i, "nuntios"), e = e.replace(/tio$/i, "tionem"), e = e.replace(/ns$/i, "ntem"), e = e.replace(/as$/i, "atem"), e = e.replace(/es$/i, "em");
709
+ break;
710
+ case "ablative":
711
+ e = e.replace(/u[ms]$/i, "o"), e = e.replace(/ommunia$/i, "ommunibus"), e = e.replace(/a$/i, "a"), e = e.replace(/libri$/i, "libris"), e = e.replace(/nuntii$/i, "nuntiis"), e = e.replace(/tio$/i, "tione"), e = e.replace(/ns$/i, "nte"), e = e.replace(/as$/i, "ate"), e = e.replace(/es$/i, "e");
712
+ break;
713
+ }
714
+ return e;
715
+ }
716
+ };
717
+ class ba extends se {
718
+ convertGrammar(t, n) {
719
+ return n === "genitive" && (t.slice(-1) === "ա" ? t = t.slice(0, -1) + "այի" : t.slice(-1) === "ո" ? t = t.slice(0, -1) + "ոյի" : t.slice(-4) === "գիրք" ? t = t.slice(0, -4) + "գրքի" : t = t + "ի"), t;
720
+ }
721
+ }
722
+ let Ca = class extends se {
723
+ convertGrammar(e, t) {
724
+ if (t === "ainmlae") switch (e) {
725
+ case "an Domhnach":
726
+ e = "Dé Domhnaigh";
727
+ break;
728
+ case "an Luan":
729
+ e = "Dé Luain";
730
+ break;
731
+ case "an Mháirt":
732
+ e = "Dé Mháirt";
733
+ break;
734
+ case "an Chéadaoin":
735
+ e = "Dé Chéadaoin";
736
+ break;
737
+ case "an Déardaoin":
738
+ e = "Déardaoin";
739
+ break;
740
+ case "an Aoine":
741
+ e = "Dé hAoine";
742
+ break;
743
+ case "an Satharn":
744
+ e = "Dé Sathairn";
745
+ break;
746
+ }
747
+ return e;
748
+ }
749
+ }, Aa = class extends se {
750
+ convertGrammar(e, t) {
751
+ switch (t) {
752
+ case "rol":
753
+ e += "ról";
754
+ break;
755
+ case "ba":
756
+ e += "ba";
757
+ break;
758
+ case "k":
759
+ e += "k";
760
+ break;
761
+ }
762
+ return e;
763
+ }
764
+ }, Fa = class extends se {
765
+ convertGrammar(e, t) {
766
+ let n, r, u, s;
767
+ switch (n = "мæ", r = "", u = "", s = "", e.match(/тæ$/i) ? (e = e.slice(0, -1), n = "æм") : e.match(/[аæеёиоыэюя]$/i) ? r = "й" : e.match(/у$/i) ? e.slice(-2, -1).match(/[аæеёиоыэюя]$/i) || (r = "й") : e.match(/[бвгджзйклмнопрстфхцчшщьъ]$/i) || (u = "-"), t) {
768
+ case "genitive":
769
+ s = u + r + "ы";
770
+ break;
771
+ case "dative":
772
+ s = u + r + "æн";
773
+ break;
774
+ case "allative":
775
+ s = u + n;
776
+ break;
777
+ case "ablative":
778
+ r === "й" ? s = u + r + "æ" : s = u + r + "æй";
779
+ break;
780
+ case "superessive":
781
+ s = u + r + "ыл";
782
+ break;
783
+ case "equative":
784
+ s = u + r + "ау";
785
+ break;
786
+ case "comitative":
787
+ s = u + "имæ";
788
+ break;
789
+ }
790
+ return e + s;
791
+ }
792
+ };
793
+ class Ea extends se {
794
+ convertGrammar(t, n) {
795
+ switch (n) {
796
+ case "genitive":
797
+ t.slice(-1) === "ь" ? t = t.slice(0, -1) + "я" : t.slice(-2) === "ія" ? t = t.slice(0, -2) + "ії" : t.slice(-2) === "ка" ? t = t.slice(0, -2) + "ки" : t.slice(-2) === "ти" ? t = t.slice(0, -2) + "тей" : t.slice(-2) === "ды" ? t = t.slice(0, -2) + "дов" : t.slice(-3) === "ник" && (t = t.slice(0, -3) + "ника");
798
+ break;
799
+ case "accusative":
800
+ t.slice(-2) === "ія" && (t = t.slice(0, -2) + "ію");
801
+ break;
802
+ }
803
+ return t;
804
+ }
805
+ }
806
+ var ct = { bs: da, default: se, dsb: Da, fi: ha, ga: Ca, he: ca, hsb: fa, hu: Aa, hy: ba, la: ma, os: Fa, ru: pa, sl: ga, uk: Ea };
807
+ const va = new RegExp("(?:([A-Za-zªµºÀ-ÖØ-öø-ʸʻ-ˁːˑˠ-ˤˮͰ-ͳͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-҂Ҋ-ԯԱ-Ֆՙ-՟ա-և։ः-हऻऽ-ीॉ-ौॎ-ॐक़-ॡ।-ঀংঃঅ-ঌএঐও-নপ-রলশ-হঽ-ীেৈোৌৎৗড়ঢ়য়-ৡ০-ৱ৴-৺ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੀਖ਼-ੜਫ਼੦-੯ੲ-ੴઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽ-ીૉોૌૐૠૡ૦-૰ૹଂଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽାୀେୈୋୌୗଡ଼ଢ଼ୟ-ୡ୦-୷ஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹாிுூெ-ைொ-ௌௐௗ௦-௲ఁ-ఃఅ-ఌఎ-ఐఒ-నప-హఽు-ౄౘ-ౚౠౡ౦-౯౿ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊೋೕೖೞೠೡ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ീെ-ൈൊ-ൌൎൗൟ-ൡ൦-൵൹-ൿංඃඅ-ඖක-නඳ-රලව-ෆා-ෑෘ-ෟ෦-෯ෲ-෴ก-ะาำเ-ๆ๏-๛ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆ໐-໙ໜ-ໟༀ-༗༚-༴༶༸༾-ཇཉ-ཬཿ྅ྈ-ྌ྾-࿅࿇-࿌࿎-࿚က-ာေးျြဿ-ၗၚ-ၝၡ-ၰၵ-ႁႃႄႇ-ႌႎ-ႜ႞-ჅჇჍა-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፠-፼ᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙿᚁ-ᚚᚠ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱ᜵᜶ᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳាើ-ៅះៈ។-៚ៜ០-៩᠐-᠙ᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᤣ-ᤦᤩ-ᤫᤰᤱᤳ-ᤸ᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧚ᨀ-ᨖᨙᨚ᨞-ᩕᩗᩡᩣᩤᩭ-ᩲ᪀-᪉᪐-᪙᪠-᪭ᬄ-ᬳᬵᬻᬽ-ᭁᭃ-ᭋ᭐-᭪᭴-᭼ᮂ-ᮡᮦᮧ᮪ᮮ-ᯥᯧᯪ-ᯬᯮ᯲᯳᯼-ᰫᰴᰵ᰻-᱉ᱍ-᱿᳀-᳇᳓᳡ᳩ-ᳬᳮ-ᳳᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‎ⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎ⅏Ⅰ-ↈ⌶-⍺⎕⒜-ⓩ⚬⠀-⣿Ⰰ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵰ⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〮〯〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎ㆐-ㆺㇰ-㈜㈠-㉏㉠-㉻㉿-㊰㋀-㋋㋐-㋾㌀-㍶㍻-㏝㏠-㏾㐀-䶵一-鿕ꀀ-ꒌꓐ-ꘌꘐ-ꘫꙀ-ꙮꚀ-ꚝꚠ-ꛯ꛲-꛷Ꜣ-ꞇ꞉-ꞭꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠤꠧ꠰-꠷ꡀ-ꡳꢀ-ꣃ꣎-꣙ꣲ-ꣽ꤀-ꤥ꤮-ꥆꥒ꥓꥟-ꥼꦃ-ꦲꦴꦵꦺꦻꦽ-꧍ꧏ-꧙꧞-ꧤꧦ-ꧾꨀ-ꨨꨯꨰꨳꨴꩀ-ꩂꩄ-ꩋꩍ꩐-꩙꩜-ꩻꩽ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫫꫮ-ꫵꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭥꭰ-ꯤꯦꯧꯩ-꯬꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ-舘並-龎ff-stﬓ-ﬗA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]|\uD800[\uDC00-\uDC0B]|\uD800[\uDC0D-\uDC26]|\uD800[\uDC28-\uDC3A]|𐀼|𐀽|\uD800[\uDC3F-\uDC4D]|\uD800[\uDC50-\uDC5D]|\uD800[\uDC80-\uDCFA]|𐄀|𐄂|\uD800[\uDD07-\uDD33]|\uD800[\uDD37-\uDD3F]|\uD800[\uDDD0-\uDDFC]|\uD800[\uDE80-\uDE9C]|\uD800[\uDEA0-\uDED0]|\uD800[\uDF00-\uDF23]|\uD800[\uDF30-\uDF4A]|\uD800[\uDF50-\uDF75]|\uD800[\uDF80-\uDF9D]|\uD800[\uDF9F-\uDFC3]|\uD800[\uDFC8-\uDFD5]|\uD801[\uDC00-\uDC9D]|\uD801[\uDCA0-\uDCA9]|\uD801[\uDD00-\uDD27]|\uD801[\uDD30-\uDD63]|𐕯|\uD801[\uDE00-\uDF36]|\uD801[\uDF40-\uDF55]|\uD801[\uDF60-\uDF67]|𑀀|\uD804[\uDC02-\uDC37]|\uD804[\uDC47-\uDC4D]|\uD804[\uDC66-\uDC6F]|\uD804[\uDC82-\uDCB2]|𑂷|𑂸|\uD804[\uDCBB-\uDCC1]|\uD804[\uDCD0-\uDCE8]|\uD804[\uDCF0-\uDCF9]|\uD804[\uDD03-\uDD26]|𑄬|\uD804[\uDD36-\uDD43]|\uD804[\uDD50-\uDD72]|\uD804[\uDD74-\uDD76]|\uD804[\uDD82-\uDDB5]|\uD804[\uDDBF-\uDDC9]|𑇍|\uD804[\uDDD0-\uDDDF]|\uD804[\uDDE1-\uDDF4]|\uD804[\uDE00-\uDE11]|\uD804[\uDE13-\uDE2E]|𑈲|𑈳|𑈵|\uD804[\uDE38-\uDE3D]|\uD804[\uDE80-\uDE86]|𑊈|\uD804[\uDE8A-\uDE8D]|\uD804[\uDE8F-\uDE9D]|\uD804[\uDE9F-\uDEA9]|\uD804[\uDEB0-\uDEDE]|\uD804[\uDEE0-\uDEE2]|\uD804[\uDEF0-\uDEF9]|𑌂|𑌃|\uD804[\uDF05-\uDF0C]|𑌏|𑌐|\uD804[\uDF13-\uDF28]|\uD804[\uDF2A-\uDF30]|𑌲|𑌳|\uD804[\uDF35-\uDF39]|\uD804[\uDF3D-\uDF3F]|\uD804[\uDF41-\uDF44]|𑍇|𑍈|\uD804[\uDF4B-\uDF4D]|𑍐|𑍗|\uD804[\uDF5D-\uDF63]|\uD805[\uDC80-\uDCB2]|𑒹|\uD805[\uDCBB-\uDCBE]|𑓁|\uD805[\uDCC4-\uDCC7]|\uD805[\uDCD0-\uDCD9]|\uD805[\uDD80-\uDDB1]|\uD805[\uDDB8-\uDDBB]|𑖾|\uD805[\uDDC1-\uDDDB]|\uD805[\uDE00-\uDE32]|𑘻|𑘼|𑘾|\uD805[\uDE41-\uDE44]|\uD805[\uDE50-\uDE59]|\uD805[\uDE80-\uDEAA]|𑚬|𑚮|𑚯|𑚶|\uD805[\uDEC0-\uDEC9]|\uD805[\uDF00-\uDF19]|𑜠|𑜡|𑜦|\uD805[\uDF30-\uDF3F]|\uD806[\uDCA0-\uDCF2]|𑣿|\uD806[\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E]|\uD809[\uDC70-\uDC74]|\uD809[\uDC80-\uDD43]|\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38]|\uD81A[\uDE40-\uDE5E]|\uD81A[\uDE60-\uDE69]|𖩮|𖩯|\uD81A[\uDED0-\uDEED]|𖫵|\uD81A[\uDF00-\uDF2F]|\uD81A[\uDF37-\uDF45]|\uD81A[\uDF50-\uDF59]|\uD81A[\uDF5B-\uDF61]|\uD81A[\uDF63-\uDF77]|\uD81A[\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44]|\uD81B[\uDF50-\uDF7E]|\uD81B[\uDF93-\uDF9F]|𛀀|𛀁|\uD82F[\uDC00-\uDC6A]|\uD82F[\uDC70-\uDC7C]|\uD82F[\uDC80-\uDC88]|\uD82F[\uDC90-\uDC99]|𛲜|𛲟|\uD834[\uDC00-\uDCF5]|\uD834[\uDD00-\uDD26]|\uD834[\uDD29-\uDD66]|\uD834[\uDD6A-\uDD72]|𝆃|𝆄|\uD834[\uDD8C-\uDDA9]|\uD834[\uDDAE-\uDDE8]|\uD834[\uDF60-\uDF71]|\uD835[\uDC00-\uDC54]|\uD835[\uDC56-\uDC9C]|𝒞|𝒟|𝒢|𝒥|𝒦|\uD835[\uDCA9-\uDCAC]|\uD835[\uDCAE-\uDCB9]|𝒻|\uD835[\uDCBD-\uDCC3]|\uD835[\uDCC5-\uDD05]|\uD835[\uDD07-\uDD0A]|\uD835[\uDD0D-\uDD14]|\uD835[\uDD16-\uDD1C]|\uD835[\uDD1E-\uDD39]|\uD835[\uDD3B-\uDD3E]|\uD835[\uDD40-\uDD44]|𝕆|\uD835[\uDD4A-\uDD50]|\uD835[\uDD52-\uDEA5]|\uD835[\uDEA8-\uDEDA]|\uD835[\uDEDC-\uDF14]|\uD835[\uDF16-\uDF4E]|\uD835[\uDF50-\uDF88]|\uD835[\uDF8A-\uDFC2]|\uD835[\uDFC4-\uDFCB]|\uD836[\uDC00-\uDDFF]|\uD836[\uDE37-\uDE3A]|\uD836[\uDE6D-\uDE74]|\uD836[\uDE76-\uDE83]|\uD836[\uDE85-\uDE8B]|\uD83C[\uDD10-\uDD2E]|\uD83C[\uDD30-\uDD69]|\uD83C[\uDD70-\uDD9A]|\uD83C[\uDDE6-\uDE02]|\uD83C[\uDE10-\uDE3A]|\uD83C[\uDE40-\uDE48]|🉐|🉑|[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6]|\uD869[\uDF00-\uDFFF]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD86D[\uDC00-\uDF34]|\uD86D[\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD86E[\uDC20-\uDFFF]|[\uD86F-\uD872][\uDC00-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|[\uDB80-\uDBBE][\uDC00-\uDFFF]|\uDBBF[\uDC00-\uDFFD]|[\uDBC0-\uDBFE][\uDC00-\uDFFF]|\uDBFF[\uDC00-\uDFFD])|([֐־׀׃׆׈-׿߀-ߪߴߵߺ-ࠕࠚࠤࠨ࠮-ࡘ࡜-࢟‏יִײַ-ﬨשׁ-ﭏ؈؋؍؛-ي٭-ٯٱ-ەۥۦۮۯۺ-ܐܒ-ܯ݋-ޥޱ-޿ࢠ-࣢ﭐ-ﴽ﵀-﷏ﷰ-﷼﷾﷿ﹰ-﻾]|\uD802[\uDC00-\uDD1E]|\uD802[\uDD20-\uDE00]|𐨄|\uD802[\uDE07-\uDE0B]|\uD802[\uDE10-\uDE37]|\uD802[\uDE3B-\uDE3E]|\uD802[\uDE40-\uDEE4]|\uD802[\uDEE7-\uDF38]|\uD802[\uDF40-\uDFFF]|\uD803[\uDC00-\uDE5F]|\uD803[\uDE7F-\uDFFF]|\uD83A[\uDC00-\uDCCF]|\uD83A[\uDCD7-\uDFFF]|\uD83B[\uDC00-\uDDFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDF00-\uDFFF]|\uD83B[\uDE00-\uDEEF]|\uD83B[\uDEF2-\uDEFF]))");
808
+ let $t = class {
809
+ constructor(e) {
810
+ this.locale = ye(e), this.language = new (ct[this.locale] || ct.default)(this.locale);
811
+ }
812
+ emit(e, t) {
813
+ let n, r, u;
814
+ switch (typeof e) {
815
+ case "string":
816
+ case "number":
817
+ n = e;
818
+ break;
819
+ case "object":
820
+ if (r = e.slice(1).map((s) => this.emit(s, t)), u = e[0].toLowerCase(), typeof this[u] == "function") n = this[u](r, t);
821
+ else throw new Error('unknown operation "' + u + '"');
822
+ break;
823
+ case "undefined":
824
+ n = "";
825
+ break;
826
+ default:
827
+ throw new Error("unexpected type in AST: " + typeof e);
828
+ }
829
+ return n;
830
+ }
831
+ concat(e) {
832
+ let t = "";
833
+ return e.forEach((n) => {
834
+ t += n;
835
+ }), t;
836
+ }
837
+ replace(e, t) {
838
+ const n = parseInt(e[0], 10);
839
+ return n < t.length ? t[n] : "$" + (n + 1);
840
+ }
841
+ plural(e) {
842
+ const t = parseFloat(this.language.convertNumber(e[0], 10)), n = e.slice(1);
843
+ return n.length ? this.language.convertPlural(t, n) : "";
844
+ }
845
+ gender(e) {
846
+ const t = e[0], n = e.slice(1);
847
+ return this.language.gender(t, n);
848
+ }
849
+ grammar(e) {
850
+ const t = e[0], n = e[1];
851
+ return n && t && this.language.convertGrammar(n, t);
852
+ }
853
+ wikilink(e) {
854
+ let t, n = e[0];
855
+ n.charAt(0) === ":" && (n = n.slice(1));
856
+ const r = `./${n}`;
857
+ return e.length === 1 ? t = n : t = e[1], `<a href="${r}" title="${n}">${t}</a>`;
858
+ }
859
+ extlink(e) {
860
+ if (e.length !== 2) throw new Error("Expected two items in the node");
861
+ return `<a href="${e[0]}">${e[1]}</a>`;
862
+ }
863
+ bidi(e) {
864
+ const t = wa(e[0]);
865
+ return t === "ltr" ? "‪" + e[0] + "‬" : t === "rtl" ? "‫" + e[0] + "‬" : e[0];
866
+ }
867
+ formatnum(e) {
868
+ const t = !!e[1] && e[1] === "R", n = e[0];
869
+ return typeof n == "string" || typeof n == "number" ? this.language.convertNumber(n, t) : n;
870
+ }
871
+ htmlattributes(e) {
872
+ const t = {};
873
+ for (let n = 0, r = e.length; n < r; n += 2) t[e[n]] = e[n + 1];
874
+ return t;
875
+ }
876
+ htmlelement(e) {
877
+ const t = e.shift(), n = e.shift();
878
+ let r = e, u = "";
879
+ for (const a in n) u += ` ${a}="${n[a]}"`;
880
+ Array.isArray(r) || (r = [r]);
881
+ const s = r.join("");
882
+ return `<${t}${u}>${s}</${t}>`;
883
+ }
884
+ };
885
+ function ye(e) {
886
+ return typeof e == "string" ? e.toLowerCase() : e;
887
+ }
888
+ function wa(e) {
889
+ const t = e.match(va);
890
+ return t ? t[2] === void 0 ? "ltr" : "rtl" : null;
891
+ }
892
+ function ya(e, { wikilinks: t = !1 } = {}) {
893
+ let n = 0;
894
+ function r(o) {
895
+ return () => {
896
+ for (let g = 0; g < o.length; g++) {
897
+ const $ = o[g]();
898
+ if ($ !== null) return $;
899
+ }
900
+ return null;
901
+ };
902
+ }
903
+ function u(o) {
904
+ const g = n, $ = [];
905
+ for (let V = 0; V < o.length; V++) {
906
+ const Y = o[V]();
907
+ if (Y === null) return n = g, null;
908
+ $.push(Y);
909
+ }
910
+ return $;
911
+ }
912
+ function s(o, g) {
913
+ return () => {
914
+ const $ = n, V = [];
915
+ let Y = g();
916
+ for (; Y !== null; ) V.push(Y), Y = g();
917
+ return V.length < o ? (n = $, null) : V;
918
+ };
919
+ }
920
+ function a(o) {
921
+ const g = o.length;
922
+ return () => {
923
+ let $ = null;
924
+ return e.slice(n, n + g) === o && ($ = o, n += g), $;
925
+ };
926
+ }
927
+ function i(o) {
928
+ return () => {
929
+ const g = e.slice(n).match(o);
930
+ return g === null ? null : (n += g[0].length, g[0]);
931
+ };
932
+ }
933
+ const C = i(/^\s+/), y = a("|"), p = a(":"), S = a("\\"), re = i(/^./), ae = a("$"), de = i(/^\d+/), L = a('"'), G = a("'"), Q = i(t ? /^[^{}[\]$<\\]/ : /^[^{}$<\\]/), ee = i(t ? /^[^{}[\]$\\|]/ : /^[^{}$\\|]/), U = i(t ? /^[^{}[\]$\s]/ : /^[^{}$\s]/);
934
+ function N(o, g) {
935
+ return () => {
936
+ const $ = o();
937
+ return $ === null ? null : g($);
938
+ };
939
+ }
940
+ function W() {
941
+ const o = s(1, J)();
942
+ return o === null ? null : o.join("");
943
+ }
944
+ function ie() {
945
+ const o = s(1, A)();
946
+ return o === null ? null : o.join("");
947
+ }
948
+ const he = r([B, U]);
949
+ function pe() {
950
+ const o = s(1, he)();
951
+ return o === null ? null : o.join("");
952
+ }
953
+ function B() {
954
+ const o = u([S, re]);
955
+ return o === null ? null : o[1];
956
+ }
957
+ const J = r([B, ee]), A = r([B, Q]);
958
+ function ue() {
959
+ const o = u([ae, de]);
960
+ return o === null ? null : ["REPLACE", parseInt(o[1], 10) - 1];
961
+ }
962
+ const m = N(i(/^[ !"$&'()*,./0-9;=?@A-Z^_`a-z~\x80-\xFF+-]+/), function(o) {
963
+ return o.toString();
964
+ });
965
+ function De() {
966
+ const o = u([y, s(0, Z)]);
967
+ if (o === null) return null;
968
+ const g = o[1];
969
+ return g.length > 1 ? ["CONCAT"].concat(g) : g[0];
970
+ }
971
+ function $e() {
972
+ const o = u([m, p, ue]);
973
+ return o === null ? null : [o[0], o[2]];
974
+ }
975
+ function oe() {
976
+ const o = u([m, p, Z]);
977
+ return o === null ? null : [o[0], o[2]];
978
+ }
979
+ function ke() {
980
+ const o = u([m, p]);
981
+ return o === null ? null : [o[0], ""];
982
+ }
983
+ const xe = r([function() {
984
+ const o = u([r([$e, oe, ke]), s(0, De)]);
985
+ return o === null ? null : o[0].concat(o[1]);
986
+ }, function() {
987
+ const o = u([m, s(0, De)]);
988
+ return o === null ? null : [o[0]].concat(o[1]);
989
+ }]), Fe = a("{{"), Ee = a("}}"), be = a("[["), _e = a("]]"), Se = a("["), Ce = a("]");
990
+ function d() {
991
+ const o = u([Fe, xe, Ee]);
992
+ return o === null ? null : o[1];
993
+ }
994
+ function E() {
995
+ const o = u([s(1, Z), y, s(1, K)]);
996
+ return o === null ? null : [["CONCAT"].concat(o[0]), ["CONCAT"].concat(o[2])];
997
+ }
998
+ function D() {
999
+ const o = u([s(1, Z)]);
1000
+ return o === null ? null : [["CONCAT"].concat(o[0])];
1001
+ }
1002
+ const f = r([E, D]);
1003
+ function v() {
1004
+ let o = null;
1005
+ const g = u([be, f, _e]);
1006
+ if (g !== null) {
1007
+ const $ = g[1];
1008
+ o = ["WIKILINK"].concat($);
1009
+ }
1010
+ return o;
1011
+ }
1012
+ function P() {
1013
+ let o = null;
1014
+ const g = u([Se, s(1, H), C, s(1, K), Ce]);
1015
+ return g !== null && (o = ["EXTLINK", g[1].length === 1 ? g[1][0] : ["CONCAT"].concat(g[1]), ["CONCAT"].concat(g[3])]), o;
1016
+ }
1017
+ const O = i(/^[A-Za-z]+/);
1018
+ function h(o, g, $, V = { allowedHtmlElements: ["b", "bdi", "del", "i", "ins", "u", "font", "big", "small", "sub", "sup", "h1", "h2", "h3", "h4", "h5", "h6", "cite", "code", "em", "s", "strike", "strong", "tt", "var", "div", "center", "blockquote", "ol", "ul", "dl", "table", "caption", "pre", "ruby", "rb", "rp", "rt", "rtc", "p", "span", "abbr", "dfn", "kbd", "samp", "data", "time", "mark", "li", "dt", "dd"], allowedHtmlCommonAttributes: ["id", "class", "style", "lang", "dir", "title", "aria-describedby", "aria-flowto", "aria-hidden", "aria-label", "aria-labelledby", "aria-owns", "role", "about", "property", "resource", "datatype", "typeof", "itemid", "itemprop", "itemref", "itemscope", "itemtype"], allowedHtmlAttributesByElement: {} }) {
1019
+ if (o = o.toLowerCase(), g = g.toLowerCase(), o !== g || V.allowedHtmlElements.indexOf(o) === -1) return !1;
1020
+ const Y = /[\000-\010\013\016-\037\177]|expression|filter\s*:|accelerator\s*:|-o-link\s*:|-o-link-source\s*:|-o-replace\s*:|url\s*\(|image\s*\(|image-set\s*\(/i;
1021
+ for (let te = 0, ve = $.length; te < ve; te += 2) {
1022
+ const ge = $[te];
1023
+ if (V.allowedHtmlCommonAttributes.indexOf(ge) === -1 && (V.allowedHtmlAttributesByElement[o] || []).indexOf(ge) === -1 || ge === "style" && $[te + 1].search(Y) !== -1) return !1;
1024
+ }
1025
+ return !0;
1026
+ }
1027
+ function l() {
1028
+ const o = i(/^[^"]*/), g = u([L, o, L]);
1029
+ return g === null ? null : g[1];
1030
+ }
1031
+ function b() {
1032
+ const o = i(/^[^']*/), g = u([G, o, G]);
1033
+ return g === null ? null : g[1];
1034
+ }
1035
+ function k() {
1036
+ const o = i(/^\s*=\s*/), g = u([C, O, o, r([l, b])]);
1037
+ return g === null ? null : [g[1], g[3]];
1038
+ }
1039
+ function j() {
1040
+ const o = s(0, k)();
1041
+ return Array.prototype.concat.apply(["HTMLATTRIBUTES"], o);
1042
+ }
1043
+ function z() {
1044
+ let o = null;
1045
+ const g = n, $ = a("<"), V = i(/^\/?/), Y = i(/^\s*>/), te = u([$, O, j, V, Y]);
1046
+ if (te === null) return null;
1047
+ const ve = n, ge = te[1], Je = s(0, K)(), Pt = n, Nt = a("</"), rt = u([Nt, O, Y]);
1048
+ if (rt === null) return ["CONCAT", e.slice(g, ve)].concat(Je);
1049
+ const zt = n, Mt = rt[1], ut = te[2], Rt = ut.slice(1);
1050
+ if (h(ge, Mt, Rt)) o = ["HTMLELEMENT", ge, ut].concat(Je);
1051
+ else {
1052
+ const st = (jt) => jt.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
1053
+ o = ["CONCAT", st(e.slice(g, ve))].concat(Je, st(e.slice(Pt, zt)));
1054
+ }
1055
+ return o;
1056
+ }
1057
+ const H = r([d, ue, v, P, pe]), K = r([d, ue, v, P, z, ie]), Z = r([d, ue, W]);
1058
+ function R() {
1059
+ const o = s(0, K)();
1060
+ return o === null ? null : ["CONCAT"].concat(o);
1061
+ }
1062
+ const fe = R();
1063
+ if (fe === null || n !== e.length) throw new Error("Parse error at position " + n.toString() + " in input: " + e);
1064
+ return fe;
1065
+ }
1066
+ class dt {
1067
+ constructor(t, { wikilinks: n = !1 } = {}) {
1068
+ this.locale = ye(t), this.wikilinks = n, this.emitter = new $t(this.locale);
1069
+ }
1070
+ parse(t, n) {
1071
+ if (t.includes("{{") || t.includes("<") || this.wikilinks && t.includes("[")) {
1072
+ const r = ya(t, { wikilinks: this.wikilinks });
1073
+ return this.emitter.emit(r, n);
1074
+ } else return this.simpleParse(t, n);
1075
+ }
1076
+ simpleParse(t, n) {
1077
+ return t.replace(/\$(\d+)/g, (r, u) => {
1078
+ const s = parseInt(u, 10) - 1;
1079
+ return n[s] !== void 0 ? n[s] : "$" + u;
1080
+ });
1081
+ }
1082
+ }
1083
+ class Ba {
1084
+ constructor() {
1085
+ this.sourceMap = /* @__PURE__ */ new Map();
1086
+ }
1087
+ load(t, n) {
1088
+ if (typeof t != "object") throw new Error("Invalid message source. Must be an object");
1089
+ if (n = ye(n), n) {
1090
+ if (!/^[a-zA-Z0-9-]+$/.test(n)) throw new Error(`Invalid locale ${n}`);
1091
+ for (const r in t) if (r.indexOf("@") !== 0) {
1092
+ if (typeof t[r] == "object") return this.load(t);
1093
+ if (typeof t[r] != "string") throw new Error(`Invalid message for message ${r} in ${n} locale.`);
1094
+ break;
1095
+ }
1096
+ this.sourceMap.has(n) ? this.sourceMap.set(n, Object.assign(this.sourceMap.get(n), t)) : this.sourceMap.set(n, t);
1097
+ } else for (n in t) this.load(t[n], n);
1098
+ }
1099
+ getMessage(t, n) {
1100
+ const r = this.sourceMap.get(ye(n));
1101
+ return r ? r[t] : null;
1102
+ }
1103
+ hasLocale(t) {
1104
+ return this.sourceMap.has(t);
1105
+ }
1106
+ }
1107
+ class $a {
1108
+ constructor(t, { finalFallback: n = "en", messages: r = void 0, wikilinks: u = !1 } = {}) {
1109
+ this.locale = ye(t), this.parser = new dt(this.locale, { wikilinks: u }), this.messageStore = new Ba(), r && this.load(r, this.locale), this.finalFallback = n, this.wikilinks = u;
1110
+ }
1111
+ load(t, n) {
1112
+ return this.messageStore.load(t, n || this.locale);
1113
+ }
1114
+ i18n(t, ...n) {
1115
+ return this.parser.parse(this.getMessage(t), n);
1116
+ }
1117
+ setLocale(t) {
1118
+ this.locale = ye(t), this.parser = new dt(this.locale, { wikilinks: this.wikilinks });
1119
+ }
1120
+ getFallbackLocales() {
1121
+ return [...Bt[this.locale] || [], this.finalFallback];
1122
+ }
1123
+ getMessage(t) {
1124
+ let n = this.locale, r = 0;
1125
+ const u = this.getFallbackLocales(this.locale);
1126
+ for (; n; ) {
1127
+ const s = n.split("-");
1128
+ let a = s.length;
1129
+ do {
1130
+ const i = s.slice(0, a).join("-"), C = this.messageStore.getMessage(t, i);
1131
+ if (typeof C == "string") return C;
1132
+ a--;
1133
+ } while (a);
1134
+ n = u[r], r++;
1135
+ }
1136
+ return t;
1137
+ }
1138
+ registerParserPlugin(t, n) {
1139
+ $t.prototype[t] = n;
1140
+ }
1141
+ }
1142
+ const kt = {
1143
+ "@metadata": { authors: ["Mason Payne"], "last-updated": "2024-01-08", locale: "en" },
1144
+ "sa-login": "Login",
1145
+ "sa-username": "Username",
1146
+ "sa-password": "Password",
1147
+ "sa-use-password": "Use Password",
1148
+ "sa-code": "Code",
1149
+ "sa-signup": "Sign up",
1150
+ "sa-signup-complete": "Sign up complete",
1151
+ "sa-back": "Back",
1152
+ "sa-error-creating-user": "Error creating user.",
1153
+ "sa-remember": "Remember me",
1154
+ "sa-forgot": "Forgot your password?",
1155
+ "sa-register": "Register",
1156
+ "sa-error.login": "Invalid username or password",
1157
+ "sa-error.register": "Invalid username or password",
1158
+ "sa-error.unknown": "Unknown error",
1159
+ "sa-account-settings": "Account Settings",
1160
+ "sa-webauthn-security-keys": "Your passkeys",
1161
+ "sa-add-security-key": "Add passkey",
1162
+ "webauthn-not-enrolled": "WebAuthn not enrolled",
1163
+ "sa-webauthn-key-name": "Key Name",
1164
+ "sa-cancel": "Cancel",
1165
+ "sa-no-security-keys": "No passkeys",
1166
+ "sa-webauthn-key-actions": "Actions",
1167
+ "sa-remove": "Remove",
1168
+ "not-authenticated": "Not authenticated",
1169
+ "error-otp-registration": "Error registering OTP",
1170
+ "sa-confirm-delete-key": "Are you sure you want to delete this key?",
1171
+ "sa-add-mfa": "Manage MFA",
1172
+ "sa-add-email": "Add Email",
1173
+ "sa-email": "Email",
1174
+ "sa-phone": "Phone",
1175
+ "sa-add-sms": "Add SMS",
1176
+ "sa-mfa": "MFA Registrations",
1177
+ "error-otp-list": "Error listing OTPs",
1178
+ "sa-type": "Type",
1179
+ "sa-mfa-destination": "Destination",
1180
+ "sa-mfa-validated": "Validated",
1181
+ "sa-validate": "Validate",
1182
+ "sa-mfa-action": "Action",
1183
+ "sa-no": "No",
1184
+ "sa-yes": "Yes",
1185
+ "error-otp-remove": "Error removing MFA Registration",
1186
+ "error-webauthn-remove": "Error removing WebAuthn Registration",
1187
+ "sa-register-mfa": "Register MFA",
1188
+ "sa-otp-required": "A one-time code is required.",
1189
+ "sa-otp-choose": "Choose how to receive your code:",
1190
+ "sa-otp-no-registrations": "No MFA methods registered.",
1191
+ "sa-otp-send-code": "Send Code",
1192
+ "sa-otp-verify": "Verify Code",
1193
+ "sa-unknown-challenge": "Unknown challenge type.",
1194
+ "sa-invite-otp": "Verification Code",
1195
+ "sa-invite-otp-hint": "Enter the code from your invite email",
1196
+ "sa-invite-password": "Choose a Password",
1197
+ "sa-invite-password-hint": "Create a secure password for your account",
1198
+ "sa-invite-submit": "Complete Registration",
1199
+ "sa-invite-success": "Registration complete! Redirecting to login...",
1200
+ "sa-invite-error-otp": "Invalid or expired verification code",
1201
+ "sa-invite-error-expired": "This invite has expired. Please contact your administrator.",
1202
+ "sa-invite-error-generic": "Unable to complete registration. Please try again.",
1203
+ "sa-invite-completing": "Completing registration...",
1204
+ "sa-forgot-password": "Forgot your password?",
1205
+ "sa-reset-password": "Reset Password",
1206
+ "sa-reset-email-sent": "If an account exists with that email, a reset code has been sent.",
1207
+ "sa-new-password": "New Password",
1208
+ "sa-reset-code": "Reset Code",
1209
+ "sa-reset-submit": "Reset Password",
1210
+ "sa-reset-success": "Password reset successfully! You can now log in.",
1211
+ "sa-reset-error": "Unable to reset password. Please try again.",
1212
+ "sa-reset-error-code": "Invalid or expired reset code"
1213
+ }, ka = {
1214
+ "@metadata": { authors: ["Mason Payne"], "last-updated": "2022-05-28", locale: "fr" },
1215
+ "sa-login": "Connexion",
1216
+ "sa-username": "Nom d'utilisateur",
1217
+ "sa-password": "Mot de passe",
1218
+ "sa-use-password": "Utiliser le mot de passe",
1219
+ "sa-code": "code à deux facteurs",
1220
+ "sa-remember": "Souviens-toi de moi",
1221
+ "sa-forgot": "Mot de passe oublié?",
1222
+ "sa-register": "S'inscrire",
1223
+ "sa-error.login": "Nom d'utilisateur ou mot de passe invalide",
1224
+ "sa-error.register": "Nom d'utilisateur ou mot de passe invalide",
1225
+ "sa-error.unknown": "Erreur inconnue",
1226
+ "sa-otp-required": "Un code à usage unique est requis.",
1227
+ "sa-otp-choose": "Choisissez comment recevoir votre code :",
1228
+ "sa-otp-no-registrations": "Aucune méthode MFA enregistrée.",
1229
+ "sa-otp-send-code": "Envoyer le code",
1230
+ "sa-otp-verify": "Vérifier le code",
1231
+ "sa-unknown-challenge": "Type de défi inconnu.",
1232
+ "sa-complete-invite": "Complétez votre invitation",
1233
+ "sa-invite-otp": "Code de vérification",
1234
+ "sa-invite-otp-hint": "Entrez le code de votre email d'invitation",
1235
+ "sa-invite-password": "Choisissez un mot de passe",
1236
+ "sa-invite-password-hint": "Créez un mot de passe sécurisé pour votre compte",
1237
+ "sa-invite-submit": "Terminer l'inscription",
1238
+ "sa-invite-success": "Inscription terminée ! Redirection vers la connexion...",
1239
+ "sa-invite-error-otp": "Code de vérification invalide ou expiré",
1240
+ "sa-invite-error-expired": "Cette invitation a expiré. Veuillez contacter votre administrateur.",
1241
+ "sa-invite-error-generic": "Impossible de terminer l'inscription. Veuillez réessayer.",
1242
+ "sa-invite-completing": "Finalisation de l'inscription...",
1243
+ "sa-forgot-password": "Mot de passe oublié ?",
1244
+ "sa-reset-password": "Réinitialiser le mot de passe",
1245
+ "sa-reset-email-sent": "Si un compte existe avec cet e-mail, un code de réinitialisation a été envoyé.",
1246
+ "sa-new-password": "Nouveau mot de passe",
1247
+ "sa-reset-code": "Code de réinitialisation",
1248
+ "sa-reset-submit": "Réinitialiser le mot de passe",
1249
+ "sa-reset-success": "Mot de passe réinitialisé avec succès ! Vous pouvez maintenant vous connecter.",
1250
+ "sa-reset-error": "Impossible de réinitialiser le mot de passe. Veuillez réessayer.",
1251
+ "sa-reset-error-code": "Code de réinitialisation invalide ou expiré"
1252
+ }, xa = {
1253
+ "@metadata": { authors: ["Mason Payne"], "last-updated": "2022-05-28", locale: "es" },
1254
+ "sa-login": "Acceso",
1255
+ "sa-username": "Nombre de usuario",
1256
+ "sa-password": "Clave",
1257
+ "sa-use-password": "Usar contraseña",
1258
+ "sa-code": "Código",
1259
+ "sa-remember": "Acuérdate de mí",
1260
+ "sa-forgot": "¿Olvidaste tu contraseña?",
1261
+ "sa-register": "Registro",
1262
+ "sa-error.login": "Usuario o contraseña invalido",
1263
+ "sa-error.register": "Usuario o contraseña invalido",
1264
+ "sa-error.unknown": "Error desconocido",
1265
+ "sa-otp-required": "Se requiere un código de un solo uso.",
1266
+ "sa-otp-choose": "Elige cómo recibir tu código:",
1267
+ "sa-otp-no-registrations": "No hay métodos MFA registrados.",
1268
+ "sa-unknown-challenge": "Tipo de desafío desconocido.",
1269
+ "sa-complete-invite": "Completa tu invitación",
1270
+ "sa-invite-otp": "Código de verificación",
1271
+ "sa-invite-otp-hint": "Ingresa el código de tu correo de invitación",
1272
+ "sa-invite-password": "Elige una contraseña",
1273
+ "sa-invite-password-hint": "Crea una contraseña segura para tu cuenta",
1274
+ "sa-invite-submit": "Completar registro",
1275
+ "sa-invite-success": "¡Registro completo! Redirigiendo al inicio de sesión...",
1276
+ "sa-invite-error-otp": "Código de verificación inválido o expirado",
1277
+ "sa-invite-error-expired": "Esta invitación ha expirado. Por favor contacta a tu administrador.",
1278
+ "sa-invite-error-generic": "No se pudo completar el registro. Por favor intenta de nuevo.",
1279
+ "sa-invite-completing": "Completando registro...",
1280
+ "sa-forgot-password": "¿Olvidaste tu contraseña?",
1281
+ "sa-reset-password": "Restablecer contraseña",
1282
+ "sa-reset-email-sent": "Si existe una cuenta con ese correo, se ha enviado un código de restablecimiento.",
1283
+ "sa-new-password": "Nueva contraseña",
1284
+ "sa-reset-code": "Código de restablecimiento",
1285
+ "sa-reset-submit": "Restablecer contraseña",
1286
+ "sa-reset-success": "¡Contraseña restablecida con éxito! Ya puedes iniciar sesión.",
1287
+ "sa-reset-error": "No se pudo restablecer la contraseña. Por favor intenta de nuevo.",
1288
+ "sa-reset-error-code": "Código de restablecimiento inválido o expirado"
1289
+ }, _a = {
1290
+ "@metadata": { authors: ["Mason Payne"], "last-updated": "2022-05-28", locale: "ja" },
1291
+ "sa-login": "ログイン",
1292
+ "sa-username": "ユーザー名",
1293
+ "sa-password": "パスワード",
1294
+ "sa-use-password": "パスワードを使用する",
1295
+ "sa-code": "コード",
1296
+ "sa-remember": "私を覚えてますか",
1297
+ "sa-forgot": "パスワードをお忘れですか?",
1298
+ "sa-register": "登録",
1299
+ "sa-error.login": "ユーザー名かパスワードが無効",
1300
+ "sa-error.register": "ユーザー名かパスワードが無効",
1301
+ "sa-error.unknown": "未知のエラー",
1302
+ "sa-otp-required": "ワンタイムコードが必要です。",
1303
+ "sa-otp-choose": "コードの受け取り方法を選択してください:",
1304
+ "sa-otp-no-registrations": "MFA方法が登録されていません。",
1305
+ "sa-otp-send-code": "コードを送信",
1306
+ "sa-otp-verify": "コードを確認",
1307
+ "sa-unknown-challenge": "不明なチャレンジタイプです。",
1308
+ "sa-complete-invite": "招待を完了する",
1309
+ "sa-invite-otp": "確認コード",
1310
+ "sa-invite-otp-hint": "招待メールのコードを入力してください",
1311
+ "sa-invite-password": "パスワードを選択",
1312
+ "sa-invite-password-hint": "アカウント用の安全なパスワードを作成してください",
1313
+ "sa-invite-submit": "登録を完了",
1314
+ "sa-invite-success": "登録完了!ログインページへリダイレクト中...",
1315
+ "sa-invite-error-otp": "無効または期限切れの確認コード",
1316
+ "sa-invite-error-expired": "この招待は期限切れです。管理者にお問い合わせください。",
1317
+ "sa-invite-error-generic": "登録を完了できませんでした。もう一度お試しください。",
1318
+ "sa-invite-completing": "登録を完了しています...",
1319
+ "sa-forgot-password": "パスワードをお忘れですか?",
1320
+ "sa-reset-password": "パスワードをリセット",
1321
+ "sa-reset-email-sent": "そのメールアドレスのアカウントが存在する場合、リセットコードが送信されました。",
1322
+ "sa-new-password": "新しいパスワード",
1323
+ "sa-reset-code": "リセットコード",
1324
+ "sa-reset-submit": "パスワードをリセット",
1325
+ "sa-reset-success": "パスワードが正常にリセットされました!ログインできます。",
1326
+ "sa-reset-error": "パスワードをリセットできませんでした。もう一度お試しください。",
1327
+ "sa-reset-error-code": "無効または期限切れのリセットコード"
1328
+ }, Sa = {
1329
+ en: kt,
1330
+ fr: ka,
1331
+ es: xa,
1332
+ ja: _a
1333
+ };
1334
+ function nt(e) {
1335
+ const t = new $a("en", {
1336
+ messages: kt
1337
+ });
1338
+ return e !== "en" && (t.load(Sa[e], e), t.setLocale(e)), t;
1339
+ }
1340
+ function xt(e) {
1341
+ const t = "==".slice(0, (4 - e.length % 4) % 4), n = e.replace(/-/g, "+").replace(/_/g, "/") + t, r = atob(n), u = new ArrayBuffer(r.length), s = new Uint8Array(u);
1342
+ for (let a = 0; a < r.length; a++)
1343
+ s[a] = r.charCodeAt(a);
1344
+ return u;
1345
+ }
1346
+ function _t(e) {
1347
+ const t = new Uint8Array(e);
1348
+ let n = "";
1349
+ for (const s of t)
1350
+ n += String.fromCharCode(s);
1351
+ return btoa(n).replace(/\+/g, "-").replace(
1352
+ /\//g,
1353
+ "_"
1354
+ ).replace(/=/g, "");
1355
+ }
1356
+ var _ = "copy", le = "convert";
1357
+ function Be(e, t, n) {
1358
+ if (t === _)
1359
+ return n;
1360
+ if (t === le)
1361
+ return e(n);
1362
+ if (t instanceof Array)
1363
+ return n.map((r) => Be(e, t[0], r));
1364
+ if (t instanceof Object) {
1365
+ const r = {};
1366
+ for (const [u, s] of Object.entries(t)) {
1367
+ if (s.derive) {
1368
+ const a = s.derive(n);
1369
+ a !== void 0 && (n[u] = a);
1370
+ }
1371
+ if (!(u in n)) {
1372
+ if (s.required)
1373
+ throw new Error(`Missing key: ${u}`);
1374
+ continue;
1375
+ }
1376
+ if (n[u] == null) {
1377
+ r[u] = null;
1378
+ continue;
1379
+ }
1380
+ r[u] = Be(
1381
+ e,
1382
+ s.schema,
1383
+ n[u]
1384
+ );
1385
+ }
1386
+ return r;
1387
+ }
1388
+ }
1389
+ function Ze(e, t) {
1390
+ return {
1391
+ required: !0,
1392
+ schema: e,
1393
+ derive: t
1394
+ };
1395
+ }
1396
+ function I(e) {
1397
+ return {
1398
+ required: !0,
1399
+ schema: e
1400
+ };
1401
+ }
1402
+ function M(e) {
1403
+ return {
1404
+ required: !1,
1405
+ schema: e
1406
+ };
1407
+ }
1408
+ var St = {
1409
+ type: I(_),
1410
+ id: I(le),
1411
+ transports: M(_)
1412
+ }, Tt = {
1413
+ appid: M(_),
1414
+ appidExclude: M(_),
1415
+ credProps: M(_)
1416
+ }, Ot = {
1417
+ appid: M(_),
1418
+ appidExclude: M(_),
1419
+ credProps: M(_)
1420
+ }, Ta = {
1421
+ publicKey: I({
1422
+ rp: I(_),
1423
+ user: I({
1424
+ id: I(le),
1425
+ name: I(_),
1426
+ displayName: I(_)
1427
+ }),
1428
+ challenge: I(le),
1429
+ pubKeyCredParams: I(_),
1430
+ timeout: M(_),
1431
+ excludeCredentials: M([St]),
1432
+ authenticatorSelection: M(_),
1433
+ attestation: M(_),
1434
+ extensions: M(Tt)
1435
+ }),
1436
+ signal: M(_)
1437
+ }, Oa = {
1438
+ type: I(_),
1439
+ id: I(_),
1440
+ rawId: I(le),
1441
+ authenticatorAttachment: M(_),
1442
+ response: I({
1443
+ clientDataJSON: I(le),
1444
+ attestationObject: I(le),
1445
+ transports: Ze(
1446
+ _,
1447
+ (e) => {
1448
+ var t;
1449
+ return ((t = e.getTransports) == null ? void 0 : t.call(e)) || [];
1450
+ }
1451
+ )
1452
+ }),
1453
+ clientExtensionResults: Ze(
1454
+ Ot,
1455
+ (e) => e.getClientExtensionResults()
1456
+ )
1457
+ }, Ia = {
1458
+ mediation: M(_),
1459
+ publicKey: I({
1460
+ challenge: I(le),
1461
+ timeout: M(_),
1462
+ rpId: M(_),
1463
+ allowCredentials: M([St]),
1464
+ userVerification: M(_),
1465
+ extensions: M(Tt)
1466
+ }),
1467
+ signal: M(_)
1468
+ }, Pa = {
1469
+ type: I(_),
1470
+ id: I(_),
1471
+ rawId: I(le),
1472
+ authenticatorAttachment: M(_),
1473
+ response: I({
1474
+ clientDataJSON: I(le),
1475
+ authenticatorData: I(le),
1476
+ signature: I(le),
1477
+ userHandle: I(le)
1478
+ }),
1479
+ clientExtensionResults: Ze(
1480
+ Ot,
1481
+ (e) => e.getClientExtensionResults()
1482
+ )
1483
+ };
1484
+ function Na(e) {
1485
+ return Be(xt, Ta, e);
1486
+ }
1487
+ function za(e) {
1488
+ return Be(
1489
+ _t,
1490
+ Oa,
1491
+ e
1492
+ );
1493
+ }
1494
+ function Ma(e) {
1495
+ return Be(xt, Ia, e);
1496
+ }
1497
+ function Ra(e) {
1498
+ return Be(
1499
+ _t,
1500
+ Pa,
1501
+ e
1502
+ );
1503
+ }
1504
+ async function ja(e) {
1505
+ const t = await navigator.credentials.create(
1506
+ e
1507
+ );
1508
+ return t.toJSON = () => za(t), t;
1509
+ }
1510
+ async function qa(e) {
1511
+ const t = await navigator.credentials.get(
1512
+ e
1513
+ );
1514
+ return t.toJSON = () => Ra(t), t;
1515
+ }
1516
+ function Ye(e) {
1517
+ this.message = e;
1518
+ }
1519
+ Ye.prototype = new Error(), Ye.prototype.name = "InvalidCharacterError";
1520
+ var Dt = typeof window < "u" && window.atob && window.atob.bind(window) || function(e) {
1521
+ var t = String(e).replace(/=+$/, "");
1522
+ if (t.length % 4 == 1) throw new Ye("'atob' failed: The string to be decoded is not correctly encoded.");
1523
+ for (var n, r, u = 0, s = 0, a = ""; r = t.charAt(s++); ~r && (n = u % 4 ? 64 * n + r : r, u++ % 4) ? a += String.fromCharCode(255 & n >> (-2 * u & 6)) : 0) r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);
1524
+ return a;
1525
+ };
1526
+ function La(e) {
1527
+ var t = e.replace(/-/g, "+").replace(/_/g, "/");
1528
+ switch (t.length % 4) {
1529
+ case 0:
1530
+ break;
1531
+ case 2:
1532
+ t += "==";
1533
+ break;
1534
+ case 3:
1535
+ t += "=";
1536
+ break;
1537
+ default:
1538
+ throw "Illegal base64url string!";
1539
+ }
1540
+ try {
1541
+ return function(n) {
1542
+ return decodeURIComponent(Dt(n).replace(/(.)/g, function(r, u) {
1543
+ var s = u.charCodeAt(0).toString(16).toUpperCase();
1544
+ return s.length < 2 && (s = "0" + s), "%" + s;
1545
+ }));
1546
+ }(t);
1547
+ } catch {
1548
+ return Dt(t);
1549
+ }
1550
+ }
1551
+ function qe(e) {
1552
+ this.message = e;
1553
+ }
1554
+ function Ua(e, t) {
1555
+ if (typeof e != "string") throw new qe("Invalid token specified");
1556
+ var n = (t = t || {}).header === !0 ? 0 : 1;
1557
+ try {
1558
+ return JSON.parse(La(e.split(".")[n]));
1559
+ } catch (r) {
1560
+ throw new qe("Invalid token specified: " + r.message);
1561
+ }
1562
+ }
1563
+ qe.prototype = new Error(), qe.prototype.name = "InvalidTokenError";
1564
+ const Pe = "spartan-token";
1565
+ function It() {
1566
+ const e = localStorage.getItem(Pe);
1567
+ let t = null;
1568
+ if (e)
1569
+ try {
1570
+ if (t = Ua(e), t.exp > Ka())
1571
+ return t;
1572
+ localStorage.removeItem(Pe);
1573
+ } catch (n) {
1574
+ console.error("Error decoding token", n), localStorage.removeItem(Pe);
1575
+ }
1576
+ return null;
1577
+ }
1578
+ function Ja() {
1579
+ const e = localStorage.getItem(Pe);
1580
+ return e || null;
1581
+ }
1582
+ function Ka() {
1583
+ return Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3);
1584
+ }
1585
+ var Va = /* @__PURE__ */ x(`<form class=login-frame><style>.login-frame {
1586
+ display: flex;
1587
+ flex-direction: column;
1588
+ justify-content: center;
1589
+ align-items: stretch;
1590
+ border: 1px solid #ccc;
1591
+ padding: 40px 40px;
1592
+ max-width: 350px;
1593
+ min-width: 290px;
1594
+ background-color: rgba(255,255,255,0.9);
1595
+ }
1596
+
1597
+
1598
+ .login-frame h1 {
1599
+ margin: 0;
1600
+ align-self: start;
1601
+ }
1602
+
1603
+ .login-frame input, .login-frame button, .login-frame select {
1604
+ margin: 20px 0 0 0;
1605
+ padding: 10px;
1606
+ }
1607
+
1608
+ .login-frame .checkbox-wrapper {
1609
+ align-self: start;
1610
+ cursor: pointer;
1611
+ }
1612
+
1613
+ .login-frame button {
1614
+ background-color: #00f0f0;
1615
+ border: 1px solid #ccc;
1616
+ color: #333;
1617
+ border-radius: 10px;
1618
+ }
1619
+
1620
+ .login-frame select {
1621
+ background-color: #ffffff;
1622
+ border: 1px solid #ccc;
1623
+ color: #333;
1624
+ border-radius: 10px;
1625
+ font-size: inherit;
1626
+ font-family: inherit;
1627
+ cursor: pointer;
1628
+ appearance: none;
1629
+ -webkit-appearance: none;
1630
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
1631
+ background-repeat: no-repeat;
1632
+ background-position: right 12px center;
1633
+ padding-right: 32px;
1634
+ width: 100%;
1635
+ box-sizing: border-box;
1636
+ }
1637
+
1638
+ .login-frame select:focus {
1639
+ outline: none;
1640
+ border-color: #00f0f0;
1641
+ }
1642
+
1643
+ .login-frame .error-message {
1644
+ color: red;
1645
+ // margin: 10px 0;
1646
+ }
1647
+ .centered-text {
1648
+ text-align: center;
1649
+ }
1650
+ </style><style></style><h1></h1><input type=text><button type=submit>`), Ga = /* @__PURE__ */ x("<span class=error-message>"), Ge = /* @__PURE__ */ x("<span>"), ft = /* @__PURE__ */ x("<input type=password>"), Wa = /* @__PURE__ */ x("<p>"), Ha = /* @__PURE__ */ x("<select>"), Za = /* @__PURE__ */ x("<option> (<!>)"), Ya = /* @__PURE__ */ x("<input type=text>"), Xa = /* @__PURE__ */ x("<input type=text autocomplete=one-time-code>"), Qa = /* @__PURE__ */ x("<input type=password autocomplete=new-password>"), ei = /* @__PURE__ */ x("<span class=checkbox-wrapper><input type=checkbox><span>&nbsp;"), We = /* @__PURE__ */ x("<a class=centered-text href=#>");
1651
+ const ti = {
1652
+ domain: "http://127.0.0.1:11000",
1653
+ sector: "0ad5c3e5-0186-4557-8b32-4b36f247bf09",
1654
+ // defaults to the admin sector
1655
+ startMode: "password",
1656
+ styles: "",
1657
+ locale: "en",
1658
+ redirect: ""
1659
+ };
1660
+ tt("spartan-login", ti, (e) => {
1661
+ const [t, n] = w(e.startMode), [r, u] = w(""), [s, a] = w(""), [i, C] = w(""), [y, p] = w(""), [S, re] = w(e.redirect), [ae, de] = w(!1), [L, G] = w(!1), [Q, ee] = w(!1), [U, N] = w(""), [W, ie] = w(""), [he, pe] = w([]), [B, J] = w(""), A = nt(e.locale);
1662
+ let ue, m;
1663
+ try {
1664
+ m = e.styles;
1665
+ } catch {
1666
+ m = "";
1667
+ }
1668
+ console.log(m), Xe(async () => {
1669
+ if (It() && e.redirect !== "" && window.location.pathname !== e.redirect) {
1670
+ window.location.href = e.redirect;
1671
+ return;
1672
+ }
1673
+ De();
1674
+ });
1675
+ function De() {
1676
+ fetch(`${e.domain}/api/v1/sectors/${e.sector}/publicsettings`, {
1677
+ method: "GET",
1678
+ mode: "cors",
1679
+ cache: "no-cache",
1680
+ headers: {
1681
+ "Content-Type": "application/json"
1682
+ }
1683
+ }).then((d) => {
1684
+ if (d.ok)
1685
+ return d.json();
1686
+ throw new Error("Network response was not ok.");
1687
+ }).then((d) => {
1688
+ console.log(d), de(d.SelfSignUpAllowed);
1689
+ }).catch((d) => {
1690
+ console.log(d), p(d.message);
1691
+ });
1692
+ }
1693
+ function $e(d) {
1694
+ d.preventDefault(), console.log("login"), p(""), t() === "password" ? xe() : t() === "webauthn" ? ke() : t() === "otp-pick" ? be(B()) : t() === "otp" ? _e() : t() === "reset-email" ? Se() : t() === "reset-code" && Ce();
1695
+ }
1696
+ function oe(d) {
1697
+ d.preventDefault(), console.log("signup"), p(""), G(!1), fetch(`${e.domain}/api/v1/users`, {
1698
+ method: "POST",
1699
+ mode: "cors",
1700
+ cache: "no-cache",
1701
+ body: JSON.stringify({
1702
+ username: r(),
1703
+ password: s(),
1704
+ sectorID: e.sector
1705
+ })
1706
+ }).then((E) => {
1707
+ if (E.ok)
1708
+ return E.json();
1709
+ throw new Error(A.i18n("sa-error-creating-user"));
1710
+ }).then((E) => {
1711
+ console.log(E), G(!0), n(e.startMode);
1712
+ }).catch((E) => {
1713
+ G(!1), p(E.message), console.log(E);
1714
+ });
1715
+ }
1716
+ function ke() {
1717
+ console.log("webauthnLogin"), fetch(`${e.domain}/api/v1/login/webauthn/begin`, {
1718
+ method: "POST",
1719
+ mode: "cors",
1720
+ cache: "no-cache",
1721
+ body: JSON.stringify({
1722
+ username: r(),
1723
+ sectorID: e.sector
1724
+ })
1725
+ }).then((d) => {
1726
+ if (d.ok)
1727
+ return d.json();
1728
+ throw d.status === 401 ? (n("password"), p(A.i18n("webauthn-not-enrolled")), new Error(A.i18n("webauthn-not-enrolled"))) : new Error(`${d.status} ${d.statusText}: Network response was not ok.`);
1729
+ }).then((d) => {
1730
+ console.log(d);
1731
+ const E = Ma(d.CredentialAssertion);
1732
+ return console.log("Parsed WebAuthn request options:", E), qa(E).then((D) => {
1733
+ const f = JSON.stringify(D);
1734
+ let v = JSON.parse(f);
1735
+ return v.transactionID = d.TransactionID, v;
1736
+ });
1737
+ }).then((d) => fetch(`${e.domain}/api/v1/login/webauthn/finish`, {
1738
+ method: "POST",
1739
+ mode: "cors",
1740
+ cache: "no-cache",
1741
+ body: JSON.stringify(d)
1742
+ })).then(Fe).catch((d) => {
1743
+ p(d.message), console.log(d);
1744
+ });
1745
+ }
1746
+ function xe() {
1747
+ console.log("password login"), fetch(e.domain + "/api/v1/login/password", {
1748
+ method: "post",
1749
+ mode: "cors",
1750
+ cache: "no-cache",
1751
+ body: JSON.stringify({
1752
+ username: r(),
1753
+ password: s(),
1754
+ sectorID: e.sector
1755
+ })
1756
+ }).then(Fe);
1757
+ }
1758
+ async function Fe(d) {
1759
+ let E = Promise.resolve(d);
1760
+ return E.then((D) => {
1761
+ if (d.ok)
1762
+ return d.json();
1763
+ throw new Error("Network response was not ok.");
1764
+ }).then((D) => {
1765
+ if (console.log(D), localStorage.setItem("spartan-txid", D.transactionID), !D.token) {
1766
+ D.challengeType.indexOf("otp") !== -1 ? Ee() : D.challengeType.indexOf("webauthn") !== -1 ? (n("webauthn"), p(A.i18n("sa-webauthn-required"))) : p(A.i18n("sa-unknown-challenge"));
1767
+ return;
1768
+ }
1769
+ localStorage.setItem("spartan-token", D.token);
1770
+ const f = new CustomEvent("spartan-login", {
1771
+ bubbles: !0,
1772
+ cancelable: !0,
1773
+ detail: {
1774
+ token: D.token,
1775
+ transactionID: D.transactionID
1776
+ }
1777
+ });
1778
+ ue.getRootNode().host.dispatchEvent(f), S() !== "" && (window.location.href = S());
1779
+ }).catch((D) => {
1780
+ D.json().then((f) => {
1781
+ console.log(f.message), p(f.message);
1782
+ }).catch((f) => {
1783
+ console.log(f);
1784
+ }), console.log(D);
1785
+ }), E;
1786
+ }
1787
+ function Ee() {
1788
+ const d = localStorage.getItem("spartan-txid") || "";
1789
+ fetch(e.domain + `/api/v1/otp/${encodeURIComponent(r())}?transactionID=${encodeURIComponent(d)}&sectorID=${encodeURIComponent(e.sector)}`, {
1790
+ method: "get",
1791
+ mode: "cors",
1792
+ cache: "no-cache"
1793
+ }).then((E) => {
1794
+ if (E.ok)
1795
+ return E.json();
1796
+ throw new Error(A.i18n("error-otp-list"));
1797
+ }).then((E) => {
1798
+ const D = E.registrations || [];
1799
+ if (D.length === 0) {
1800
+ p(A.i18n("sa-otp-no-registrations"));
1801
+ return;
1802
+ }
1803
+ D.length === 1 ? be(D[0].ID || "") : (pe(D), J(D[0].ID || ""), n("otp-pick"), p(""));
1804
+ }).catch((E) => {
1805
+ p(E.message), console.log(E);
1806
+ });
1807
+ }
1808
+ function be(d) {
1809
+ console.log("begin OTP, registrationID:", d), fetch(e.domain + "/api/v1/login/otp/begin", {
1810
+ method: "post",
1811
+ mode: "cors",
1812
+ cache: "no-cache",
1813
+ body: JSON.stringify({
1814
+ username: r(),
1815
+ transactionID: localStorage.getItem("spartan-txid"),
1816
+ registrationID: d,
1817
+ sectorID: e.sector
1818
+ })
1819
+ }).then((E) => {
1820
+ if (E.ok)
1821
+ return E.json();
1822
+ throw new Error(`${E.status} ${E.statusText}`);
1823
+ }).then((E) => {
1824
+ console.log(E), E.transactionID && localStorage.setItem("spartan-txid", E.transactionID), C(""), p(""), n("otp");
1825
+ }).catch((E) => {
1826
+ p(E.message), console.log(E);
1827
+ });
1828
+ }
1829
+ function _e() {
1830
+ console.log("OTP login submit"), fetch(e.domain + "/api/v1/login/otp", {
1831
+ method: "post",
1832
+ mode: "cors",
1833
+ cache: "no-cache",
1834
+ body: JSON.stringify({
1835
+ username: r(),
1836
+ password: i(),
1837
+ transactionID: localStorage.getItem("spartan-txid"),
1838
+ sectorID: e.sector
1839
+ })
1840
+ }).then(Fe);
1841
+ }
1842
+ function Se() {
1843
+ console.log("begin password reset"), p(""), ee(!1), fetch(`${e.domain}/api/v1/password/reset/begin`, {
1844
+ method: "POST",
1845
+ mode: "cors",
1846
+ cache: "no-cache",
1847
+ headers: {
1848
+ "Content-Type": "application/json"
1849
+ },
1850
+ body: JSON.stringify({
1851
+ email: r(),
1852
+ sectorID: e.sector
1853
+ })
1854
+ }).then((d) => {
1855
+ if (d.ok)
1856
+ return d.json();
1857
+ throw new Error(A.i18n("sa-reset-error"));
1858
+ }).then((d) => {
1859
+ console.log(d), p(A.i18n("sa-reset-email-sent")), N(""), ie(""), n("reset-code");
1860
+ }).catch((d) => {
1861
+ p(d.message), console.log(d);
1862
+ });
1863
+ }
1864
+ function Ce() {
1865
+ console.log("complete password reset"), p(""), fetch(`${e.domain}/api/v1/password/reset/complete`, {
1866
+ method: "POST",
1867
+ mode: "cors",
1868
+ cache: "no-cache",
1869
+ headers: {
1870
+ "Content-Type": "application/json"
1871
+ },
1872
+ body: JSON.stringify({
1873
+ email: r(),
1874
+ code: U().toUpperCase().trim(),
1875
+ newPassword: W(),
1876
+ sectorID: e.sector
1877
+ })
1878
+ }).then((d) => {
1879
+ if (d.ok)
1880
+ return d.json();
1881
+ throw d.status === 400 ? new Error(A.i18n("sa-reset-error-code")) : new Error(A.i18n("sa-reset-error"));
1882
+ }).then((d) => {
1883
+ console.log(d), ee(!0), N(""), ie(""), a(""), n(e.startMode);
1884
+ }).catch((d) => {
1885
+ p(d.message), console.log(d);
1886
+ });
1887
+ }
1888
+ return (() => {
1889
+ var d = Va(), E = d.firstChild, D = E.nextSibling, f = D.nextSibling, v = f.nextSibling, P = v.nextSibling, O = ue;
1890
+ return typeof O == "function" ? vt(O, d) : ue = d, d.addEventListener("submit", (h) => {
1891
+ t() === "sign-up" ? oe(h) : $e(h);
1892
+ }), c(D, m), c(f, (() => {
1893
+ var h = F(() => t() === "reset-email" || t() === "reset-code");
1894
+ return () => h() ? A.i18n("sa-reset-password") : A.i18n("sa-login");
1895
+ })()), c(d, y && (() => {
1896
+ var h = Ga();
1897
+ return c(h, y), h;
1898
+ })(), v), c(d, (() => {
1899
+ var h = F(() => !!L());
1900
+ return () => h() && (() => {
1901
+ var l = Ge();
1902
+ return c(l, () => A.i18n("sa-signup-complete")), l;
1903
+ })();
1904
+ })(), v), c(d, (() => {
1905
+ var h = F(() => !!Q());
1906
+ return () => h() && (() => {
1907
+ var l = Ge();
1908
+ return c(l, () => A.i18n("sa-reset-success")), l;
1909
+ })();
1910
+ })(), v), v.$$input = (h) => u(h.currentTarget.value), c(d, (() => {
1911
+ var h = F(() => t() !== "sign-up");
1912
+ return () => h() && [F(() => F(() => t() === "password")() && (() => {
1913
+ var l = ft();
1914
+ return l.$$input = (b) => a(b.currentTarget.value), T(() => ce(l, "placeholder", A.i18n("sa-password"))), T(() => l.value = s()), l;
1915
+ })()), F(() => F(() => t() === "webauthn")() && Ge()), F(() => F(() => t() === "otp-pick")() && [(() => {
1916
+ var l = Wa();
1917
+ return c(l, () => A.i18n("sa-otp-choose")), l;
1918
+ })(), (() => {
1919
+ var l = Ha();
1920
+ return l.addEventListener("change", (b) => J(b.currentTarget.value)), c(l, () => he().map((b) => (() => {
1921
+ var k = Za(), j = k.firstChild, z = j.nextSibling;
1922
+ return z.nextSibling, c(k, () => b.DisplayName || b.ID, j), c(k, () => b.Type, z), T(() => k.value = b.ID), k;
1923
+ })())), T(() => l.value = B()), l;
1924
+ })()]), F(() => F(() => t() === "otp")() && (() => {
1925
+ var l = Ya();
1926
+ return l.$$input = (b) => C(b.currentTarget.value), T(() => ce(l, "placeholder", A.i18n("sa-code"))), T(() => l.value = i()), l;
1927
+ })()), F(() => F(() => t() === "reset-code")() && [(() => {
1928
+ var l = Xa();
1929
+ return l.$$input = (b) => N(b.currentTarget.value), T(() => ce(l, "placeholder", A.i18n("sa-reset-code"))), T(() => l.value = U()), l;
1930
+ })(), (() => {
1931
+ var l = Qa();
1932
+ return l.$$input = (b) => ie(b.currentTarget.value), T(() => ce(l, "placeholder", A.i18n("sa-new-password"))), T(() => l.value = W()), l;
1933
+ })()]), F(() => F(() => t() === "password" || t() === "webauthn")() && (() => {
1934
+ var l = ei(), b = l.firstChild, k = b.nextSibling;
1935
+ return k.firstChild, l.$$click = () => n(t() === "password" ? "webauthn" : "password"), c(k, () => A.i18n("sa-use-password"), null), T(() => b.checked = t() === "password"), l;
1936
+ })())];
1937
+ })(), P), c(d, (() => {
1938
+ var h = F(() => t() === "sign-up");
1939
+ return () => h() && (() => {
1940
+ var l = ft();
1941
+ return l.$$input = (b) => a(b.currentTarget.value), T(() => ce(l, "placeholder", A.i18n("sa-password"))), T(() => l.value = s()), l;
1942
+ })();
1943
+ })(), P), c(P, (() => {
1944
+ var h = F(() => t() === "sign-up");
1945
+ return () => h() ? A.i18n("sa-signup") : F(() => t() === "otp-pick")() ? A.i18n("sa-otp-send-code") : F(() => t() === "otp")() ? A.i18n("sa-otp-verify") : F(() => t() === "reset-email")() ? A.i18n("sa-otp-send-code") : F(() => t() === "reset-code")() ? A.i18n("sa-reset-submit") : A.i18n("sa-login");
1946
+ })()), c(d, (() => {
1947
+ var h = F(() => t() === "password");
1948
+ return () => h() && (() => {
1949
+ var l = We();
1950
+ return l.$$click = () => {
1951
+ p(""), ee(!1), n("reset-email");
1952
+ }, c(l, () => A.i18n("sa-forgot-password")), l;
1953
+ })();
1954
+ })(), null), c(d, (() => {
1955
+ var h = F(() => t() === "reset-email" || t() === "reset-code");
1956
+ return () => h() && (() => {
1957
+ var l = We();
1958
+ return l.$$click = () => {
1959
+ p(""), N(""), ie(""), n(e.startMode);
1960
+ }, c(l, () => A.i18n("sa-back")), l;
1961
+ })();
1962
+ })(), null), c(d, (() => {
1963
+ var h = F(() => !!(ae() && t() !== "reset-email" && t() !== "reset-code"));
1964
+ return () => h() && (() => {
1965
+ var l = We();
1966
+ return l.$$click = () => t() === "sign-up" ? n(e.startMode) : n("sign-up"), c(l, (() => {
1967
+ var b = F(() => t() === "sign-up");
1968
+ return () => b() ? A.i18n("sa-back") : A.i18n("sa-signup");
1969
+ })()), l;
1970
+ })();
1971
+ })(), null), T((h) => {
1972
+ var l = A.i18n("sa-username"), b = t() === "otp" || t() === "otp-pick" || t() === "reset-code";
1973
+ return l !== h.e && ce(v, "placeholder", h.e = l), b !== h.t && (v.disabled = h.t = b), h;
1974
+ }, {
1975
+ e: void 0,
1976
+ t: void 0
1977
+ }), T(() => v.value = r()), d;
1978
+ })();
1979
+ });
1980
+ et(["input", "click"]);
1981
+ var ni = /* @__PURE__ */ x(`<div class=container><style>.container {
1982
+ background-color: #ffffff;
1983
+ border-radius: 10px;
1984
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
1985
+ padding: 20px;
1986
+ width: 400px;
1987
+ }
1988
+
1989
+ .header {
1990
+ text-align: center;
1991
+ font-size: 24px;
1992
+ margin-bottom: 20px;
1993
+ }
1994
+
1995
+ .section {
1996
+ margin-bottom: 20px;
1997
+ }
1998
+
1999
+ .section h2 {
2000
+ font-size: 18px;
2001
+ margin-bottom: 10px;
2002
+ border-bottom: 2px solid #e0e0e0;
2003
+ padding-bottom: 5px;
2004
+ }
2005
+
2006
+ .error-message {
2007
+ color: red;
2008
+ }
2009
+
2010
+ .security-keys, .mfa-manage {
2011
+ display: flex;
2012
+ flex-direction: column;
2013
+ }
2014
+
2015
+ .key-item, .mfa-item, .add-key-item {
2016
+ display: flex;
2017
+ align-items: center;
2018
+ justify-content: space-between;
2019
+ margin-bottom: 10px;
2020
+ }
2021
+
2022
+ .key-item span {
2023
+ flex-grow: 1;
2024
+ }
2025
+
2026
+ .mfa-item label, .add-key-item label {
2027
+ margin-right: 10px;
2028
+ width: 50px;
2029
+ }
2030
+
2031
+ .mfa-item input, .add-key-item input {
2032
+ flex-grow: 1;
2033
+ padding: 5px;
2034
+ margin-right: 10px;
2035
+ }
2036
+
2037
+ .mfa-item button, .add-key-item button {
2038
+ justify-self: start;
2039
+ flex-grow: 1;
2040
+ }
2041
+
2042
+ .btn {
2043
+ padding: 5px 10px;
2044
+ border: none;
2045
+ border-radius: 5px;
2046
+ cursor: pointer;
2047
+ }
2048
+
2049
+ .btn.add {
2050
+ background-color: #007bff;
2051
+ color: #ffffff;
2052
+ }
2053
+
2054
+ .btn.remove {
2055
+ background-color: #999;
2056
+ color: #ffffff;
2057
+ }
2058
+
2059
+ .btn.validate {
2060
+ background-color: #28a745;
2061
+ color: #ffffff;
2062
+ }
2063
+
2064
+ table {
2065
+ width: 100%;
2066
+ border-collapse: collapse;
2067
+ }
2068
+
2069
+ table, th, td {
2070
+ border: 1px solid #e0e0e0;
2071
+ }
2072
+
2073
+ th, td {
2074
+ padding: 10px;
2075
+ text-align: left;
2076
+ max-width: 100px;
2077
+ text-overflow: ellipsis;
2078
+ overflow: hidden;
2079
+ }
2080
+
2081
+ th {
2082
+ background-color: #f9f9f9;
2083
+ }
2084
+
2085
+ .modal {
2086
+ display: flex;
2087
+ position: fixed;
2088
+ z-index: 1;
2089
+ left: 0;
2090
+ top: 0;
2091
+ width: 100%;
2092
+ height: 100%;
2093
+ overflow: auto;
2094
+ background-color: rgba(0, 0, 0, 0.4); /* Black background with opacity */
2095
+ align-items: center;
2096
+ justify-content: center;
2097
+ }
2098
+
2099
+ /* Modal content */
2100
+ .modal-content {
2101
+ background-color: #ffffff;
2102
+ margin: auto;
2103
+ padding: 20px;
2104
+ border: 1px solid #888;
2105
+ width: 300px;
2106
+ border-radius: 10px;
2107
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
2108
+ position: relative;
2109
+ text-align: center;
2110
+ }
2111
+
2112
+ /* Close button */
2113
+ .close {
2114
+ color: #aaa;
2115
+ float: right;
2116
+ font-size: 28px;
2117
+ font-weight: bold;
2118
+ position: absolute;
2119
+ top: 10px;
2120
+ right: 15px;
2121
+ cursor: pointer;
2122
+ }
2123
+
2124
+ .close:hover,
2125
+ .close:focus {
2126
+ color: #000;
2127
+ text-decoration: none;
2128
+ cursor: pointer;
2129
+ }
2130
+
2131
+ /* Input and button styling */
2132
+ .modal-content input {
2133
+ width: calc(100% - 40px);
2134
+ padding: 10px;
2135
+ margin: 10px 0;
2136
+ border: 1px solid #ccc;
2137
+ border-radius: 5px;
2138
+ box-sizing: border-box;
2139
+ }
2140
+
2141
+ .modal-content .btn.verify {
2142
+ background-color: #007bff;
2143
+ color: white;
2144
+ padding: 10px 20px;
2145
+ border: none;
2146
+ border-radius: 5px;
2147
+ cursor: pointer;
2148
+ margin-top: 10px;
2149
+ }
2150
+
2151
+ .modal-content .btn.verify:hover {
2152
+ background-color: #0056b3;
2153
+ }
2154
+ </style><style></style><h1 class=header>`), ht = /* @__PURE__ */ x("<span class=error-message>"), ri = /* @__PURE__ */ x("<div class=section><h2></h2><div class=security-keys>"), ui = /* @__PURE__ */ x('<div class=key-item><span></span><button class="btn remove">'), pt = /* @__PURE__ */ x("<span>"), si = /* @__PURE__ */ x("<div class=section><div class=security-keys>"), ai = /* @__PURE__ */ x('<button class="btn add">+ '), ii = /* @__PURE__ */ x('<div class=add-key-form><div class=add-key-item><label for=keyName style=display:none;></label><input id=keyName type=text><button class="btn remove"></button><button class="btn add">'), oi = /* @__PURE__ */ x("<div class=section><h2></h2><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>"), li = /* @__PURE__ */ x('<tr class=mfa-list-item><td></td><td></td><td><button class="btn remove">'), ci = /* @__PURE__ */ x('<span>&nbsp; <button class="btn validate">'), di = /* @__PURE__ */ x('<div class=section><div class=mfa-manage><button class="btn add">+ '), Di = /* @__PURE__ */ x('<div class=section><h2></h2><div class=mfa-manage><div class=mfa-item><label for=email></label><input id=email type=text><button class="btn add"></button></div><div class=mfa-item><label for=phone></label><input id=phone type=text><button class="btn add"></button></div><div class=mfa-item><button class="btn remove">'), fi = /* @__PURE__ */ x('<div class=modal id=mfaModal><div class=modal-content><span class=close id=closeModal>&times;</span><h2>MFA Verification</h2><p>Please enter the verification code sent to your email or phone:</p><input type=text id=mfaCode placeholder="Enter verification code"><button class="btn verify"id=verifyMfa>Verify');
2155
+ const hi = {
2156
+ domain: "http://127.0.0.1:11000",
2157
+ sector: "0ad5c3e5-0186-4557-8b32-4b36f247bf09",
2158
+ // defaults to the admin sector
2159
+ styles: "",
2160
+ locale: "en",
2161
+ showWebAuthn: !0,
2162
+ redirect: "/",
2163
+ redirectOnUnauthenticated: !0
2164
+ };
2165
+ tt("spartan-account-settings", hi, (e) => {
2166
+ w(""), w("");
2167
+ const [t, n] = w(""), [r, u] = w(""), [s, a] = w(""), [i, C] = w(e.showWebAuthn), [y, p] = w(!1), [S, re] = w(!1), [ae, de] = w(!1), [L, G] = w(!1), [Q, ee] = w([]), [U, N] = w([]), [W, ie] = w(""), [he, pe] = w(""), [B, J] = w(""), [A, ue] = w(""), m = nt(e.locale);
2168
+ let De;
2169
+ try {
2170
+ De = e.styles;
2171
+ } catch {
2172
+ De = "";
2173
+ }
2174
+ Xe(async () => {
2175
+ if (It())
2176
+ re(!0), u("");
2177
+ else {
2178
+ if (e.redirectOnUnauthenticated) {
2179
+ window.location.href = e.redirect;
2180
+ return;
2181
+ }
2182
+ re(!1), u(m.i18n("not-authenticated"));
2183
+ }
2184
+ $e().then((f) => {
2185
+ console.log(f);
2186
+ }), await Ee(), Ce().then((f) => {
2187
+ N(f.registrations);
2188
+ });
2189
+ });
2190
+ async function $e() {
2191
+ return await (await fetch(`${e.domain}/api/v1/users/self`, oe("get"))).json();
2192
+ }
2193
+ function oe(D = "get") {
2194
+ return {
2195
+ method: D,
2196
+ mode: "cors",
2197
+ cache: "no-cache",
2198
+ headers: {
2199
+ "Content-Type": "application",
2200
+ Authorization: `bearer ${Ja()}`
2201
+ }
2202
+ };
2203
+ }
2204
+ function ke() {
2205
+ let D = oe("post");
2206
+ D.body = JSON.stringify({
2207
+ keyName: t(),
2208
+ sectorID: e.sector
2209
+ }), fetch(`${e.domain}/api/v1/webauthn/registration/begin`, D).then((f) => {
2210
+ if (f.status === 200)
2211
+ return f.json();
2212
+ throw f;
2213
+ }).then((f) => (console.log(f), xe(f))).catch((f) => {
2214
+ f.json ? f.json().then((v) => {
2215
+ u(v.message);
2216
+ }) : u(f);
2217
+ });
2218
+ }
2219
+ async function xe(D) {
2220
+ try {
2221
+ const f = Na(D.Options);
2222
+ console.log("Parsed WebAuthn creation options:", f);
2223
+ const v = await ja(f), P = JSON.stringify(v);
2224
+ let O = JSON.parse(P);
2225
+ O.transactionID = D.TransactionID;
2226
+ let h = oe("post");
2227
+ h.body = JSON.stringify(O);
2228
+ const l = await fetch(`${e.domain}/api/v1/webauthn/registration/finish`, h);
2229
+ if (l.status !== 200) {
2230
+ const b = await l.json();
2231
+ u(b.message);
2232
+ return;
2233
+ }
2234
+ p(!1), n(""), Ee();
2235
+ } catch (f) {
2236
+ console.error("WebAuthn registration error:", f), u((f == null ? void 0 : f.message) || String(f));
2237
+ }
2238
+ }
2239
+ async function Fe(D) {
2240
+ let f = oe("delete");
2241
+ f.body = JSON.stringify({
2242
+ ID: D
2243
+ });
2244
+ try {
2245
+ if ((await fetch(`${e.domain}/api/v1/webauthn/${D}`, f)).status !== 200) {
2246
+ u(m.i18n("error-webauthn-remove"));
2247
+ return;
2248
+ }
2249
+ Ee();
2250
+ } catch (v) {
2251
+ console.error(v), u(m.i18n("error-webauthn-remove"));
2252
+ return;
2253
+ }
2254
+ }
2255
+ async function Ee() {
2256
+ let D = oe("get");
2257
+ try {
2258
+ const v = await (await fetch(`${e.domain}/api/v1/webauthn/registration/list`, D)).json();
2259
+ ee(v.registrations || []);
2260
+ } catch (f) {
2261
+ console.error(f), ee([]);
2262
+ }
2263
+ }
2264
+ async function be(D, f) {
2265
+ const v = await _e(D, f);
2266
+ v && (Ce().then((P) => {
2267
+ N(P.registrations);
2268
+ }), ie(v.transactionID), G(!0));
2269
+ }
2270
+ async function _e(D, f) {
2271
+ let v = oe("post");
2272
+ v.body = JSON.stringify({
2273
+ destination: D,
2274
+ OTPType: E(f),
2275
+ sectorID: e.sector
2276
+ });
2277
+ try {
2278
+ const P = await fetch(`${e.domain}/api/v1/otp/begin`, v);
2279
+ if (P.status !== 200) {
2280
+ u(m.i18n("error-otp-verification"));
2281
+ return;
2282
+ }
2283
+ return await P.json();
2284
+ } catch (P) {
2285
+ console.error(P), u(m.i18n("error-otp-registration"));
2286
+ return;
2287
+ }
2288
+ }
2289
+ async function Se(D, f) {
2290
+ let v = oe("post");
2291
+ v.body = JSON.stringify({
2292
+ transactionID: D,
2293
+ password: f
2294
+ });
2295
+ try {
2296
+ const P = await fetch(`${e.domain}/api/v1/otp/finish`, v);
2297
+ if (P.status !== 200) {
2298
+ a(m.i18n("error-otp-verification"));
2299
+ return;
2300
+ }
2301
+ return G(!1), pe(""), de(!1), ue(""), J(""), Ce().then((O) => {
2302
+ N(O.registrations);
2303
+ }), await P.json();
2304
+ } catch (P) {
2305
+ console.error(P), a(m.i18n("error-otp-registration"));
2306
+ return;
2307
+ }
2308
+ }
2309
+ async function Ce() {
2310
+ let D = oe("get");
2311
+ try {
2312
+ return await (await fetch(`${e.domain}/api/v1/otp/list`, D)).json();
2313
+ } catch (f) {
2314
+ console.error(f), u(m.i18n("error-otp-list"));
2315
+ return;
2316
+ }
2317
+ }
2318
+ async function d(D) {
2319
+ let f = oe("delete");
2320
+ f.body = JSON.stringify({
2321
+ ID: D
2322
+ });
2323
+ try {
2324
+ if ((await fetch(`${e.domain}/api/v1/otp/${D}`, f)).status !== 200) {
2325
+ u(m.i18n("error-otp-remove"));
2326
+ return;
2327
+ }
2328
+ Ce().then((P) => {
2329
+ N(P.registrations);
2330
+ });
2331
+ } catch (v) {
2332
+ console.error(v), u(m.i18n("error-otp-remove"));
2333
+ return;
2334
+ }
2335
+ }
2336
+ function E(D) {
2337
+ return D === "EMAIL" ? 2 : 1;
2338
+ }
2339
+ return (() => {
2340
+ var D = ni(), f = D.firstChild, v = f.nextSibling, P = v.nextSibling;
2341
+ return c(v, De), c(P, () => m.i18n("sa-account-settings")), c(D, r && (() => {
2342
+ var O = ht();
2343
+ return c(O, r), O;
2344
+ })(), null), c(D, (() => {
2345
+ var O = F(() => !!(i() && Q().length));
2346
+ return () => O() && (() => {
2347
+ var h = ri(), l = h.firstChild, b = l.nextSibling;
2348
+ return c(l, () => m.i18n("sa-webauthn-security-keys")), c(b, () => Q().map((k) => (() => {
2349
+ var j = ui(), z = j.firstChild, H = z.nextSibling;
2350
+ return c(z, () => k.keyName), H.$$click = () => {
2351
+ confirm(m.i18n("sa-confirm-delete-key")) && Fe(k.keyName);
2352
+ }, c(H, () => m.i18n("sa-remove")), j;
2353
+ })()), null), c(b, (() => {
2354
+ var k = F(() => Q().length <= 0);
2355
+ return () => k() && (() => {
2356
+ var j = pt();
2357
+ return c(j, () => m.i18n("sa-no-security-keys")), j;
2358
+ })();
2359
+ })(), null), h;
2360
+ })();
2361
+ })(), null), c(D, (() => {
2362
+ var O = F(() => !!i());
2363
+ return () => O() && (() => {
2364
+ var h = si(), l = h.firstChild;
2365
+ return c(l, (() => {
2366
+ var b = F(() => !y());
2367
+ return () => b() && (() => {
2368
+ var k = ai();
2369
+ return k.firstChild, k.$$click = () => p(!0), c(k, () => m.i18n("sa-add-security-key"), null), k;
2370
+ })();
2371
+ })(), null), c(l, (() => {
2372
+ var b = F(() => !!y());
2373
+ return () => b() && (() => {
2374
+ var k = ii(), j = k.firstChild, z = j.firstChild, H = z.nextSibling, K = H.nextSibling, Z = K.nextSibling;
2375
+ return c(z, () => m.i18n("sa-webauthn-key-name")), H.$$input = (R) => n(R.currentTarget.value), K.$$click = () => p(!1), c(K, () => m.i18n("sa-cancel")), Z.$$click = () => t() !== "" && ke(), c(Z, () => m.i18n("sa-register")), T((R) => {
2376
+ var fe = m.i18n("sa-webauthn-key-name"), o = t() === "";
2377
+ return fe !== R.e && ce(H, "placeholder", R.e = fe), o !== R.t && (Z.disabled = R.t = o), R;
2378
+ }, {
2379
+ e: void 0,
2380
+ t: void 0
2381
+ }), T(() => H.value = t()), k;
2382
+ })();
2383
+ })(), null), h;
2384
+ })();
2385
+ })(), null), c(D, (() => {
2386
+ var O = F(() => U().length > 0);
2387
+ return () => O() && (() => {
2388
+ var h = oi(), l = h.firstChild, b = l.nextSibling, k = b.firstChild, j = k.firstChild, z = j.firstChild, H = z.nextSibling, K = H.nextSibling, Z = k.nextSibling;
2389
+ return c(l, () => m.i18n("sa-mfa")), c(z, () => m.i18n("sa-mfa-destination")), c(H, () => m.i18n("sa-mfa-validated")), c(K, () => m.i18n("sa-mfa-action")), c(Z, () => U().map((R) => (() => {
2390
+ var fe = li(), o = fe.firstChild, g = o.nextSibling, $ = g.nextSibling, V = $.firstChild;
2391
+ return c(o, () => R.DisplayName), c(g, (() => {
2392
+ var Y = F(() => !!R.Validated);
2393
+ return () => Y() ? (() => {
2394
+ var te = pt();
2395
+ return c(te, () => m.i18n("sa-yes")), te;
2396
+ })() : (() => {
2397
+ var te = ci(), ve = te.firstChild, ge = ve.nextSibling;
2398
+ return c(te, () => m.i18n("sa-no"), ve), ge.$$click = () => {
2399
+ be(R.DisplayName, R.Type === "email" ? "EMAIL" : "SMS");
2400
+ }, c(ge, () => m.i18n("sa-validate")), te;
2401
+ })();
2402
+ })()), V.$$click = () => {
2403
+ confirm(m.i18n("sa-confirm-delete-key")) && d(R.ID);
2404
+ }, c(V, () => m.i18n("sa-remove")), T(() => ce(o, "title", R.DisplayName)), fe;
2405
+ })())), h;
2406
+ })();
2407
+ })(), null), c(D, (() => {
2408
+ var O = F(() => !ae());
2409
+ return () => O() && (() => {
2410
+ var h = di(), l = h.firstChild, b = l.firstChild;
2411
+ return b.firstChild, b.$$click = () => de(!0), c(b, () => m.i18n("sa-register-mfa"), null), h;
2412
+ })();
2413
+ })(), null), c(D, (() => {
2414
+ var O = F(() => !!ae());
2415
+ return () => O() && (() => {
2416
+ var h = Di(), l = h.firstChild, b = l.nextSibling, k = b.firstChild, j = k.firstChild, z = j.nextSibling, H = z.nextSibling, K = k.nextSibling, Z = K.firstChild, R = Z.nextSibling, fe = R.nextSibling, o = K.nextSibling, g = o.firstChild;
2417
+ return c(l, () => m.i18n("sa-add-mfa")), c(j, () => m.i18n("sa-email")), z.$$input = ($) => J($.currentTarget.value), H.$$click = () => be(B(), "EMAIL"), c(H, () => m.i18n("sa-add-email")), c(Z, () => m.i18n("sa-phone")), R.$$input = ($) => ue($.currentTarget.value), fe.$$click = () => be(A(), "SMS"), c(fe, () => m.i18n("sa-add-sms")), g.$$click = () => de(!1), c(g, () => m.i18n("sa-cancel")), T(($) => {
2418
+ var V = m.i18n("sa-email"), Y = m.i18n("sa-phone");
2419
+ return V !== $.e && ce(z, "placeholder", $.e = V), Y !== $.t && ce(R, "placeholder", $.t = Y), $;
2420
+ }, {
2421
+ e: void 0,
2422
+ t: void 0
2423
+ }), T(() => z.value = B()), T(() => R.value = A()), h;
2424
+ })();
2425
+ })(), null), c(D, (() => {
2426
+ var O = F(() => !!L());
2427
+ return () => O() && (() => {
2428
+ var h = fi(), l = h.firstChild, b = l.firstChild, k = b.nextSibling, j = k.nextSibling, z = j.nextSibling, H = z.nextSibling;
2429
+ return h.$$click = () => G(!1), l.$$click = (K) => K.stopPropagation(), b.$$click = () => G(!1), c(l, (() => {
2430
+ var K = F(() => !!s());
2431
+ return () => K() && (() => {
2432
+ var Z = ht();
2433
+ return c(Z, s), Z;
2434
+ })();
2435
+ })(), j), z.$$input = (K) => pe(K.currentTarget.value), H.$$click = () => Se(W(), he()), T(() => z.value = he()), h;
2436
+ })();
2437
+ })(), null), D;
2438
+ })();
2439
+ });
2440
+ et(["click", "input"]);
2441
+ var pi = /* @__PURE__ */ x(`<form class=invite-frame><style>.invite-frame {
2442
+ display: flex;
2443
+ flex-direction: column;
2444
+ justify-content: center;
2445
+ align-items: stretch;
2446
+ border: 1px solid #ccc;
2447
+ padding: 40px 40px;
2448
+ max-width: 350px;
2449
+ min-width: 290px;
2450
+ background-color: rgba(255,255,255,0.9);
2451
+ }
2452
+
2453
+ .invite-frame h1 {
2454
+ margin: 0;
2455
+ align-self: start;
2456
+ font-size: 1.5em;
2457
+ margin-bottom: 10px;
2458
+ }
2459
+
2460
+ .invite-frame input, .invite-frame button {
2461
+ margin: 15px 0 0 0;
2462
+ padding: 10px;
2463
+ }
2464
+
2465
+ .invite-frame button {
2466
+ background-color: #00f0f0;
2467
+ border: 1px solid #ccc;
2468
+ color: #333;
2469
+ border-radius: 10px;
2470
+ cursor: pointer;
2471
+ }
2472
+
2473
+ .invite-frame button:disabled {
2474
+ background-color: #ccc;
2475
+ cursor: not-allowed;
2476
+ }
2477
+
2478
+ .invite-frame .error-message {
2479
+ color: red;
2480
+ margin: 10px 0;
2481
+ }
2482
+
2483
+ .invite-frame .success-message {
2484
+ color: green;
2485
+ margin: 10px 0;
2486
+ }
2487
+
2488
+ .invite-frame .info-message {
2489
+ color: #666;
2490
+ margin: 10px 0;
2491
+ font-size: 0.9em;
2492
+ }
2493
+
2494
+ .invite-frame .hint {
2495
+ color: #666;
2496
+ font-size: 0.85em;
2497
+ margin-top: 5px;
2498
+ margin-bottom: 10px;
2499
+ display: block;
2500
+ }
2501
+ </style><style></style><h1></h1><input type=text autocomplete=one-time-code required><span class=hint></span><input type=password autocomplete=new-password required minlength=8><span class=hint></span><button type=submit>`), gi = /* @__PURE__ */ x("<span class=info-message>"), mi = /* @__PURE__ */ x("<span class=error-message>"), bi = /* @__PURE__ */ x("<span class=success-message>");
2502
+ const Ci = {
2503
+ domain: "http://127.0.0.1:11000",
2504
+ sector: "0ad5c3e5-0186-4557-8b32-4b36f247bf09",
2505
+ // defaults to the admin sector
2506
+ sub: "",
2507
+ // user ID from invite email
2508
+ email: "",
2509
+ // email from invite
2510
+ styles: "",
2511
+ locale: "en",
2512
+ redirect: ""
2513
+ // where to redirect after successful completion
2514
+ };
2515
+ tt("spartan-invite", Ci, (e) => {
2516
+ const [t, n] = w(""), [r, u] = w(""), [s, a] = w(""), [i, C] = w(""), [y, p] = w(!1), S = nt(e.locale);
2517
+ let re, ae;
2518
+ try {
2519
+ ae = e.styles;
2520
+ } catch {
2521
+ ae = "";
2522
+ }
2523
+ Xe(async () => {
2524
+ e.sub || new URLSearchParams(window.location.search).get("sub") || a("Missing invitation information. Please use the link from your invite email.");
2525
+ const G = new URLSearchParams(window.location.hash.replace("#", "")).get("otp");
2526
+ G && n(G);
2527
+ });
2528
+ async function de(L) {
2529
+ var ee, U;
2530
+ if (L.preventDefault(), a(""), C(""), p(!0), !t() || t().trim().length === 0) {
2531
+ a("Please enter your verification code"), p(!1);
2532
+ return;
2533
+ }
2534
+ if (!r() || r().length < 8) {
2535
+ a("Password must be at least 8 characters"), p(!1);
2536
+ return;
2537
+ }
2538
+ const G = new URLSearchParams(window.location.search), Q = e.sub || G.get("sub") || "";
2539
+ if (!Q) {
2540
+ a("Missing invitation information"), p(!1);
2541
+ return;
2542
+ }
2543
+ try {
2544
+ const N = await fetch(`${e.domain}/api/v1/users/invite/complete`, {
2545
+ method: "POST",
2546
+ mode: "cors",
2547
+ cache: "no-cache",
2548
+ headers: {
2549
+ "Content-Type": "application/json"
2550
+ },
2551
+ body: JSON.stringify({
2552
+ sub: Q,
2553
+ otp: t().toUpperCase().trim(),
2554
+ password: r(),
2555
+ sectorID: e.sector
2556
+ })
2557
+ });
2558
+ if (N.ok) {
2559
+ const W = await N.json();
2560
+ C(S.i18n("sa-invite-success"));
2561
+ const ie = new CustomEvent("spartan-invite-complete", {
2562
+ bubbles: !0,
2563
+ cancelable: !0,
2564
+ detail: {
2565
+ sub: Q,
2566
+ success: !0
2567
+ }
2568
+ });
2569
+ re && re.getRootNode().host.dispatchEvent(ie), setTimeout(() => {
2570
+ e.redirect && e.redirect !== "" && (window.location.href = e.redirect);
2571
+ }, 2e3);
2572
+ } else {
2573
+ const W = await N.json().catch(() => ({}));
2574
+ N.status === 400 || (ee = W.message) != null && ee.includes("invalid OTP") ? a(S.i18n("sa-invite-error-otp")) : N.status === 504 || (U = W.message) != null && U.includes("expired") ? a(S.i18n("sa-invite-error-expired")) : a(W.message || S.i18n("sa-invite-error-generic")), p(!1);
2575
+ }
2576
+ } catch (N) {
2577
+ console.error("Error completing invite:", N), a(S.i18n("sa-invite-error-generic")), p(!1);
2578
+ }
2579
+ }
2580
+ return (() => {
2581
+ var L = pi(), G = L.firstChild, Q = G.nextSibling, ee = Q.nextSibling, U = ee.nextSibling, N = U.nextSibling, W = N.nextSibling, ie = W.nextSibling, he = ie.nextSibling, pe = re;
2582
+ return typeof pe == "function" ? vt(pe, L) : re = L, L.addEventListener("submit", de), c(Q, ae), c(ee, () => S.i18n("sa-complete-invite")), c(L, (() => {
2583
+ var B = F(() => !!e.email);
2584
+ return () => B() && (() => {
2585
+ var J = gi();
2586
+ return c(J, () => e.email), J;
2587
+ })();
2588
+ })(), U), c(L, (() => {
2589
+ var B = F(() => !!s());
2590
+ return () => B() && (() => {
2591
+ var J = mi();
2592
+ return c(J, s), J;
2593
+ })();
2594
+ })(), U), c(L, (() => {
2595
+ var B = F(() => !!i());
2596
+ return () => B() && (() => {
2597
+ var J = bi();
2598
+ return c(J, i), J;
2599
+ })();
2600
+ })(), U), U.$$input = (B) => n(B.currentTarget.value), c(N, () => S.i18n("sa-invite-otp-hint")), W.$$input = (B) => u(B.currentTarget.value), c(ie, () => S.i18n("sa-invite-password-hint")), c(he, (() => {
2601
+ var B = F(() => !!y());
2602
+ return () => B() ? S.i18n("sa-invite-completing") : S.i18n("sa-invite-submit");
2603
+ })()), T((B) => {
2604
+ var J = S.i18n("sa-invite-otp"), A = y() || i() !== "", ue = S.i18n("sa-invite-password"), m = y() || i() !== "", De = y() || i() !== "";
2605
+ return J !== B.e && ce(U, "placeholder", B.e = J), A !== B.t && (U.disabled = B.t = A), ue !== B.a && ce(W, "placeholder", B.a = ue), m !== B.o && (W.disabled = B.o = m), De !== B.i && (he.disabled = B.i = De), B;
2606
+ }, {
2607
+ e: void 0,
2608
+ t: void 0,
2609
+ a: void 0,
2610
+ o: void 0,
2611
+ i: void 0
2612
+ }), T(() => U.value = t()), T(() => W.value = r()), L;
2613
+ })();
2614
+ });
2615
+ et(["input"]);