@versini/sassysaint 7.2.1 → 7.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4864 @@
1
+ import { jsx as h, jsxs as X, Fragment as at } from "react/jsx-runtime";
2
+ import Z, { createContext as Vr, useReducer as Wr, useRef as x, useCallback as re, useEffect as se, useContext as Zt, useSyncExternalStore as Hn, useLayoutEffect as Ue, useMemo as Ke, useDebugValue as Kn, useState as Ee, useId as Gr, lazy as Vn, Suspense as Wn } from "react";
3
+ import E from "clsx";
4
+ var Gn = Object.defineProperty, Bn = (e, t, r) => t in e ? Gn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Tt = (e, t, r) => Bn(e, typeof t != "symbol" ? t + "" : t, r);
5
+ /*!
6
+ @versini/auth-provider v7.5.0
7
+ © 2025 gizmette.com
8
+ */
9
+ try {
10
+ window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
11
+ version: "7.5.0",
12
+ buildTime: "02/09/2025 07:44 PM EST",
13
+ homepage: "https://github.com/aversini/auth-client",
14
+ license: "MIT"
15
+ });
16
+ } catch {
17
+ }
18
+ function ce(e) {
19
+ const t = new Uint8Array(e);
20
+ let r = "";
21
+ for (const n of t)
22
+ r += String.fromCharCode(n);
23
+ return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
24
+ }
25
+ function st(e) {
26
+ const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), s = new ArrayBuffer(a.length), o = new Uint8Array(s);
27
+ for (let i = 0; i < a.length; i++)
28
+ o[i] = a.charCodeAt(i);
29
+ return s;
30
+ }
31
+ function er() {
32
+ return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
33
+ }
34
+ function Br(e) {
35
+ const { id: t } = e;
36
+ return {
37
+ ...e,
38
+ id: st(t),
39
+ transports: e.transports
40
+ };
41
+ }
42
+ function Fr(e) {
43
+ return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
44
+ }
45
+ let Y = class extends Error {
46
+ constructor({ message: t, code: r, cause: n, name: a }) {
47
+ super(t, { cause: n }), this.name = a ?? n.name, this.code = r;
48
+ }
49
+ };
50
+ function Fn({ error: e, options: t }) {
51
+ var n, a;
52
+ const { publicKey: r } = t;
53
+ if (!r)
54
+ throw Error("options was missing required publicKey property");
55
+ if (e.name === "AbortError") {
56
+ if (t.signal instanceof AbortSignal)
57
+ return new Y({
58
+ message: "Registration ceremony was sent an abort signal",
59
+ code: "ERROR_CEREMONY_ABORTED",
60
+ cause: e
61
+ });
62
+ } else if (e.name === "ConstraintError") {
63
+ if (((n = r.authenticatorSelection) == null ? void 0 : n.requireResidentKey) === !0)
64
+ return new Y({
65
+ message: "Discoverable credentials were required but no available authenticator supported it",
66
+ code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
67
+ cause: e
68
+ });
69
+ if (((a = r.authenticatorSelection) == null ? void 0 : a.userVerification) === "required")
70
+ return new Y({
71
+ message: "User verification was required but no available authenticator supported it",
72
+ code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
73
+ cause: e
74
+ });
75
+ } else {
76
+ if (e.name === "InvalidStateError")
77
+ return new Y({
78
+ message: "The authenticator was previously registered",
79
+ code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
80
+ cause: e
81
+ });
82
+ if (e.name === "NotAllowedError")
83
+ return new Y({
84
+ message: e.message,
85
+ code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
86
+ cause: e
87
+ });
88
+ if (e.name === "NotSupportedError")
89
+ return r.pubKeyCredParams.filter((s) => s.type === "public-key").length === 0 ? new Y({
90
+ message: 'No entry in pubKeyCredParams was of type "public-key"',
91
+ code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
92
+ cause: e
93
+ }) : new Y({
94
+ message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
95
+ code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
96
+ cause: e
97
+ });
98
+ if (e.name === "SecurityError") {
99
+ const s = window.location.hostname;
100
+ if (Fr(s)) {
101
+ if (r.rp.id !== s)
102
+ return new Y({
103
+ message: `The RP ID "${r.rp.id}" is invalid for this domain`,
104
+ code: "ERROR_INVALID_RP_ID",
105
+ cause: e
106
+ });
107
+ } else return new Y({
108
+ message: `${window.location.hostname} is an invalid domain`,
109
+ code: "ERROR_INVALID_DOMAIN",
110
+ cause: e
111
+ });
112
+ } else if (e.name === "TypeError") {
113
+ if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
114
+ return new Y({
115
+ message: "User ID was not between 1 and 64 characters",
116
+ code: "ERROR_INVALID_USER_ID_LENGTH",
117
+ cause: e
118
+ });
119
+ } else if (e.name === "UnknownError")
120
+ return new Y({
121
+ message: "The authenticator was unable to process the specified options, or could not create a new credential",
122
+ code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
123
+ cause: e
124
+ });
125
+ }
126
+ return e;
127
+ }
128
+ class Jn {
129
+ createNewAbortSignal() {
130
+ if (this.controller) {
131
+ const r = new Error("Cancelling existing WebAuthn API call for new one");
132
+ r.name = "AbortError", this.controller.abort(r);
133
+ }
134
+ const t = new AbortController();
135
+ return this.controller = t, t.signal;
136
+ }
137
+ cancelCeremony() {
138
+ if (this.controller) {
139
+ const t = new Error("Manually cancelling existing WebAuthn API call");
140
+ t.name = "AbortError", this.controller.abort(t), this.controller = void 0;
141
+ }
142
+ }
143
+ }
144
+ const Jr = new Jn(), Yn = ["cross-platform", "platform"];
145
+ function Yr(e) {
146
+ if (e && !(Yn.indexOf(e) < 0))
147
+ return e;
148
+ }
149
+ async function jn(e) {
150
+ var u;
151
+ if (!er())
152
+ throw new Error("WebAuthn is not supported in this browser");
153
+ const t = { publicKey: {
154
+ ...e,
155
+ challenge: st(e.challenge),
156
+ user: {
157
+ ...e.user,
158
+ id: st(e.user.id)
159
+ },
160
+ excludeCredentials: (u = e.excludeCredentials) == null ? void 0 : u.map(Br)
161
+ } };
162
+ t.signal = Jr.createNewAbortSignal();
163
+ let r;
164
+ try {
165
+ r = await navigator.credentials.create(t);
166
+ } catch (l) {
167
+ throw Fn({ error: l, options: t });
168
+ }
169
+ if (!r)
170
+ throw new Error("Registration was not completed");
171
+ const { id: n, rawId: a, response: s, type: o } = r;
172
+ let i;
173
+ typeof s.getTransports == "function" && (i = s.getTransports());
174
+ let c;
175
+ if (typeof s.getPublicKeyAlgorithm == "function")
176
+ try {
177
+ c = s.getPublicKeyAlgorithm();
178
+ } catch (l) {
179
+ _t("getPublicKeyAlgorithm()", l);
180
+ }
181
+ let m;
182
+ if (typeof s.getPublicKey == "function")
183
+ try {
184
+ const l = s.getPublicKey();
185
+ l !== null && (m = ce(l));
186
+ } catch (l) {
187
+ _t("getPublicKey()", l);
188
+ }
189
+ let f;
190
+ if (typeof s.getAuthenticatorData == "function")
191
+ try {
192
+ f = ce(s.getAuthenticatorData());
193
+ } catch (l) {
194
+ _t("getAuthenticatorData()", l);
195
+ }
196
+ return {
197
+ id: n,
198
+ rawId: ce(a),
199
+ response: {
200
+ attestationObject: ce(s.attestationObject),
201
+ clientDataJSON: ce(s.clientDataJSON),
202
+ transports: i,
203
+ publicKeyAlgorithm: c,
204
+ publicKey: m,
205
+ authenticatorData: f
206
+ },
207
+ type: o,
208
+ clientExtensionResults: r.getClientExtensionResults(),
209
+ authenticatorAttachment: Yr(r.authenticatorAttachment)
210
+ };
211
+ }
212
+ function _t(e, t) {
213
+ console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
214
+ `, t);
215
+ }
216
+ function zn() {
217
+ if (!er())
218
+ return new Promise((t) => t(!1));
219
+ const e = window.PublicKeyCredential;
220
+ return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
221
+ }
222
+ function qn({ error: e, options: t }) {
223
+ const { publicKey: r } = t;
224
+ if (!r)
225
+ throw Error("options was missing required publicKey property");
226
+ if (e.name === "AbortError") {
227
+ if (t.signal instanceof AbortSignal)
228
+ return new Y({
229
+ message: "Authentication ceremony was sent an abort signal",
230
+ code: "ERROR_CEREMONY_ABORTED",
231
+ cause: e
232
+ });
233
+ } else {
234
+ if (e.name === "NotAllowedError")
235
+ return new Y({
236
+ message: e.message,
237
+ code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
238
+ cause: e
239
+ });
240
+ if (e.name === "SecurityError") {
241
+ const n = window.location.hostname;
242
+ if (Fr(n)) {
243
+ if (r.rpId !== n)
244
+ return new Y({
245
+ message: `The RP ID "${r.rpId}" is invalid for this domain`,
246
+ code: "ERROR_INVALID_RP_ID",
247
+ cause: e
248
+ });
249
+ } else return new Y({
250
+ message: `${window.location.hostname} is an invalid domain`,
251
+ code: "ERROR_INVALID_DOMAIN",
252
+ cause: e
253
+ });
254
+ } else if (e.name === "UnknownError")
255
+ return new Y({
256
+ message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
257
+ code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
258
+ cause: e
259
+ });
260
+ }
261
+ return e;
262
+ }
263
+ async function Qn(e, t = !1) {
264
+ var u, l;
265
+ if (!er())
266
+ throw new Error("WebAuthn is not supported in this browser");
267
+ let r;
268
+ ((u = e.allowCredentials) == null ? void 0 : u.length) !== 0 && (r = (l = e.allowCredentials) == null ? void 0 : l.map(Br));
269
+ const n = {
270
+ ...e,
271
+ challenge: st(e.challenge),
272
+ allowCredentials: r
273
+ }, a = {};
274
+ if (t) {
275
+ if (!await zn())
276
+ throw Error("Browser does not support WebAuthn autofill");
277
+ if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
278
+ throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
279
+ a.mediation = "conditional", n.allowCredentials = [];
280
+ }
281
+ a.publicKey = n, a.signal = Jr.createNewAbortSignal();
282
+ let s;
283
+ try {
284
+ s = await navigator.credentials.get(a);
285
+ } catch (d) {
286
+ throw qn({ error: d, options: a });
287
+ }
288
+ if (!s)
289
+ throw new Error("Authentication was not completed");
290
+ const { id: o, rawId: i, response: c, type: m } = s;
291
+ let f;
292
+ return c.userHandle && (f = ce(c.userHandle)), {
293
+ id: o,
294
+ rawId: ce(i),
295
+ response: {
296
+ authenticatorData: ce(c.authenticatorData),
297
+ clientDataJSON: ce(c.clientDataJSON),
298
+ signature: ce(c.signature),
299
+ userHandle: f
300
+ },
301
+ type: m,
302
+ clientExtensionResults: s.getClientExtensionResults(),
303
+ authenticatorAttachment: Yr(s.authenticatorAttachment)
304
+ };
305
+ }
306
+ /*!
307
+ @versini/auth-common v4.2.0
308
+ © 2025 gizmette.com
309
+ */
310
+ try {
311
+ window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
312
+ version: "4.2.0",
313
+ buildTime: "02/09/2025 07:44 PM EST",
314
+ homepage: "https://github.com/aversini/auth-client",
315
+ license: "MIT"
316
+ });
317
+ } catch {
318
+ }
319
+ const xe = {
320
+ ID_TOKEN: "id_token",
321
+ ACCESS_TOKEN: "token",
322
+ ID_AND_ACCESS_TOKEN: "id_token token",
323
+ CODE: "code",
324
+ REFRESH_TOKEN: "refresh_token",
325
+ PASSKEY: "passkey"
326
+ }, jr = {
327
+ CLIENT_ID: "X-Auth-ClientId"
328
+ }, F = {
329
+ ALG: "RS256",
330
+ USER_ID_KEY: "sub",
331
+ USERNAME_KEY: "username",
332
+ EMAIL_KEY: "email",
333
+ TOKEN_ID_KEY: "__raw",
334
+ NONCE_KEY: "_nonce",
335
+ AUTH_TYPE_KEY: "auth_type",
336
+ EXPIRES_AT_KEY: "exp",
337
+ CREATED_AT_KEY: "iat",
338
+ SCOPES_KEY: "scopes",
339
+ CLIENT_ID_KEY: "aud",
340
+ ISSUER: "gizmette.com"
341
+ }, Xn = `-----BEGIN PUBLIC KEY-----
342
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
343
+ w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
344
+ i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
345
+ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
346
+ l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
347
+ sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
348
+ awIDAQAB
349
+ -----END PUBLIC KEY-----`, dt = {
350
+ CODE: "code",
351
+ LOGOUT: "logout",
352
+ LOGIN: "login",
353
+ REFRESH: "refresh"
354
+ }, ut = crypto, zr = (e) => e instanceof CryptoKey, Ye = new TextEncoder(), Ve = new TextDecoder();
355
+ function Zn(...e) {
356
+ const t = e.reduce((a, { length: s }) => a + s, 0), r = new Uint8Array(t);
357
+ let n = 0;
358
+ for (const a of e)
359
+ r.set(a, n), n += a.length;
360
+ return r;
361
+ }
362
+ const ea = (e) => {
363
+ const t = atob(e), r = new Uint8Array(t.length);
364
+ for (let n = 0; n < t.length; n++)
365
+ r[n] = t.charCodeAt(n);
366
+ return r;
367
+ }, we = (e) => {
368
+ let t = e;
369
+ t instanceof Uint8Array && (t = Ve.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
370
+ try {
371
+ return ea(t);
372
+ } catch {
373
+ throw new TypeError("The input to be decoded is not correctly encoded.");
374
+ }
375
+ };
376
+ let q = class extends Error {
377
+ constructor(t, r) {
378
+ var n;
379
+ super(t, r), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
380
+ }
381
+ };
382
+ q.code = "ERR_JOSE_GENERIC";
383
+ let ne = class extends q {
384
+ constructor(t, r, n = "unspecified", a = "unspecified") {
385
+ super(t, { cause: { claim: n, reason: a, payload: r } }), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = n, this.reason = a, this.payload = r;
386
+ }
387
+ };
388
+ ne.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
389
+ class Kt extends q {
390
+ constructor(t, r, n = "unspecified", a = "unspecified") {
391
+ super(t, { cause: { claim: n, reason: a, payload: r } }), this.code = "ERR_JWT_EXPIRED", this.claim = n, this.reason = a, this.payload = r;
392
+ }
393
+ }
394
+ Kt.code = "ERR_JWT_EXPIRED";
395
+ class qr extends q {
396
+ constructor() {
397
+ super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
398
+ }
399
+ }
400
+ qr.code = "ERR_JOSE_ALG_NOT_ALLOWED";
401
+ let ae = class extends q {
402
+ constructor() {
403
+ super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
404
+ }
405
+ };
406
+ ae.code = "ERR_JOSE_NOT_SUPPORTED";
407
+ class ta extends q {
408
+ constructor(t = "decryption operation failed", r) {
409
+ super(t, r), this.code = "ERR_JWE_DECRYPTION_FAILED";
410
+ }
411
+ }
412
+ ta.code = "ERR_JWE_DECRYPTION_FAILED";
413
+ class ra extends q {
414
+ constructor() {
415
+ super(...arguments), this.code = "ERR_JWE_INVALID";
416
+ }
417
+ }
418
+ ra.code = "ERR_JWE_INVALID";
419
+ let H = class extends q {
420
+ constructor() {
421
+ super(...arguments), this.code = "ERR_JWS_INVALID";
422
+ }
423
+ };
424
+ H.code = "ERR_JWS_INVALID";
425
+ let ie = class extends q {
426
+ constructor() {
427
+ super(...arguments), this.code = "ERR_JWT_INVALID";
428
+ }
429
+ };
430
+ ie.code = "ERR_JWT_INVALID";
431
+ class na extends q {
432
+ constructor() {
433
+ super(...arguments), this.code = "ERR_JWK_INVALID";
434
+ }
435
+ }
436
+ na.code = "ERR_JWK_INVALID";
437
+ class aa extends q {
438
+ constructor() {
439
+ super(...arguments), this.code = "ERR_JWKS_INVALID";
440
+ }
441
+ }
442
+ aa.code = "ERR_JWKS_INVALID";
443
+ class sa extends q {
444
+ constructor(t = "no applicable key found in the JSON Web Key Set", r) {
445
+ super(t, r), this.code = "ERR_JWKS_NO_MATCHING_KEY";
446
+ }
447
+ }
448
+ sa.code = "ERR_JWKS_NO_MATCHING_KEY";
449
+ class oa extends q {
450
+ constructor(t = "multiple matching keys found in the JSON Web Key Set", r) {
451
+ super(t, r), this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
452
+ }
453
+ }
454
+ oa.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
455
+ class ia extends q {
456
+ constructor(t = "request timed out", r) {
457
+ super(t, r), this.code = "ERR_JWKS_TIMEOUT";
458
+ }
459
+ }
460
+ ia.code = "ERR_JWKS_TIMEOUT";
461
+ class Qr extends q {
462
+ constructor(t = "signature verification failed", r) {
463
+ super(t, r), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
464
+ }
465
+ }
466
+ Qr.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
467
+ function ge(e, t = "algorithm.name") {
468
+ return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
469
+ }
470
+ function je(e, t) {
471
+ return e.name === t;
472
+ }
473
+ function It(e) {
474
+ return parseInt(e.name.slice(4), 10);
475
+ }
476
+ function ca(e) {
477
+ switch (e) {
478
+ case "ES256":
479
+ return "P-256";
480
+ case "ES384":
481
+ return "P-384";
482
+ case "ES512":
483
+ return "P-521";
484
+ default:
485
+ throw new Error("unreachable");
486
+ }
487
+ }
488
+ function la(e, t) {
489
+ if (t.length && !t.some((r) => e.usages.includes(r))) {
490
+ let r = "CryptoKey does not support this operation, its usages must include ";
491
+ if (t.length > 2) {
492
+ const n = t.pop();
493
+ r += `one of ${t.join(", ")}, or ${n}.`;
494
+ } else t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
495
+ throw new TypeError(r);
496
+ }
497
+ }
498
+ function da(e, t, ...r) {
499
+ switch (t) {
500
+ case "HS256":
501
+ case "HS384":
502
+ case "HS512": {
503
+ if (!je(e.algorithm, "HMAC"))
504
+ throw ge("HMAC");
505
+ const n = parseInt(t.slice(2), 10);
506
+ if (It(e.algorithm.hash) !== n)
507
+ throw ge(`SHA-${n}`, "algorithm.hash");
508
+ break;
509
+ }
510
+ case "RS256":
511
+ case "RS384":
512
+ case "RS512": {
513
+ if (!je(e.algorithm, "RSASSA-PKCS1-v1_5"))
514
+ throw ge("RSASSA-PKCS1-v1_5");
515
+ const n = parseInt(t.slice(2), 10);
516
+ if (It(e.algorithm.hash) !== n)
517
+ throw ge(`SHA-${n}`, "algorithm.hash");
518
+ break;
519
+ }
520
+ case "PS256":
521
+ case "PS384":
522
+ case "PS512": {
523
+ if (!je(e.algorithm, "RSA-PSS"))
524
+ throw ge("RSA-PSS");
525
+ const n = parseInt(t.slice(2), 10);
526
+ if (It(e.algorithm.hash) !== n)
527
+ throw ge(`SHA-${n}`, "algorithm.hash");
528
+ break;
529
+ }
530
+ case "EdDSA": {
531
+ if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
532
+ throw ge("Ed25519 or Ed448");
533
+ break;
534
+ }
535
+ case "ES256":
536
+ case "ES384":
537
+ case "ES512": {
538
+ if (!je(e.algorithm, "ECDSA"))
539
+ throw ge("ECDSA");
540
+ const n = ca(t);
541
+ if (e.algorithm.namedCurve !== n)
542
+ throw ge(n, "algorithm.namedCurve");
543
+ break;
544
+ }
545
+ default:
546
+ throw new TypeError("CryptoKey does not support this operation");
547
+ }
548
+ la(e, r);
549
+ }
550
+ function Xr(e, t, ...r) {
551
+ var n;
552
+ if (r = r.filter(Boolean), r.length > 2) {
553
+ const a = r.pop();
554
+ e += `one of type ${r.join(", ")}, or ${a}.`;
555
+ } else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
556
+ return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (n = t.constructor) != null && n.name && (e += ` Received an instance of ${t.constructor.name}`), e;
557
+ }
558
+ const fr = (e, ...t) => Xr("Key must be ", e, ...t);
559
+ function Zr(e, t, ...r) {
560
+ return Xr(`Key for the ${e} algorithm must be `, t, ...r);
561
+ }
562
+ const en = (e) => zr(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", ot = ["CryptoKey"], ua = (...e) => {
563
+ const t = e.filter(Boolean);
564
+ if (t.length === 0 || t.length === 1)
565
+ return !0;
566
+ let r;
567
+ for (const n of t) {
568
+ const a = Object.keys(n);
569
+ if (!r || r.size === 0) {
570
+ r = new Set(a);
571
+ continue;
572
+ }
573
+ for (const s of a) {
574
+ if (r.has(s))
575
+ return !1;
576
+ r.add(s);
577
+ }
578
+ }
579
+ return !0;
580
+ };
581
+ function ha(e) {
582
+ return typeof e == "object" && e !== null;
583
+ }
584
+ function Pe(e) {
585
+ if (!ha(e) || Object.prototype.toString.call(e) !== "[object Object]")
586
+ return !1;
587
+ if (Object.getPrototypeOf(e) === null)
588
+ return !0;
589
+ let t = e;
590
+ for (; Object.getPrototypeOf(t) !== null; )
591
+ t = Object.getPrototypeOf(t);
592
+ return Object.getPrototypeOf(e) === t;
593
+ }
594
+ const fa = (e, t) => {
595
+ if (e.startsWith("RS") || e.startsWith("PS")) {
596
+ const { modulusLength: r } = t.algorithm;
597
+ if (typeof r != "number" || r < 2048)
598
+ throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
599
+ }
600
+ };
601
+ function De(e) {
602
+ return Pe(e) && typeof e.kty == "string";
603
+ }
604
+ function ma(e) {
605
+ return e.kty !== "oct" && typeof e.d == "string";
606
+ }
607
+ function pa(e) {
608
+ return e.kty !== "oct" && typeof e.d > "u";
609
+ }
610
+ function ga(e) {
611
+ return De(e) && e.kty === "oct" && typeof e.k == "string";
612
+ }
613
+ function ya(e) {
614
+ let t, r;
615
+ switch (e.kty) {
616
+ case "RSA": {
617
+ switch (e.alg) {
618
+ case "PS256":
619
+ case "PS384":
620
+ case "PS512":
621
+ t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
622
+ break;
623
+ case "RS256":
624
+ case "RS384":
625
+ case "RS512":
626
+ t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
627
+ break;
628
+ case "RSA-OAEP":
629
+ case "RSA-OAEP-256":
630
+ case "RSA-OAEP-384":
631
+ case "RSA-OAEP-512":
632
+ t = {
633
+ name: "RSA-OAEP",
634
+ hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
635
+ }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
636
+ break;
637
+ default:
638
+ throw new ae('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
639
+ }
640
+ break;
641
+ }
642
+ case "EC": {
643
+ switch (e.alg) {
644
+ case "ES256":
645
+ t = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
646
+ break;
647
+ case "ES384":
648
+ t = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
649
+ break;
650
+ case "ES512":
651
+ t = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
652
+ break;
653
+ case "ECDH-ES":
654
+ case "ECDH-ES+A128KW":
655
+ case "ECDH-ES+A192KW":
656
+ case "ECDH-ES+A256KW":
657
+ t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
658
+ break;
659
+ default:
660
+ throw new ae('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
661
+ }
662
+ break;
663
+ }
664
+ case "OKP": {
665
+ switch (e.alg) {
666
+ case "EdDSA":
667
+ t = { name: e.crv }, r = e.d ? ["sign"] : ["verify"];
668
+ break;
669
+ case "ECDH-ES":
670
+ case "ECDH-ES+A128KW":
671
+ case "ECDH-ES+A192KW":
672
+ case "ECDH-ES+A256KW":
673
+ t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
674
+ break;
675
+ default:
676
+ throw new ae('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
677
+ }
678
+ break;
679
+ }
680
+ default:
681
+ throw new ae('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
682
+ }
683
+ return { algorithm: t, keyUsages: r };
684
+ }
685
+ const tn = async (e) => {
686
+ if (!e.alg)
687
+ throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
688
+ const { algorithm: t, keyUsages: r } = ya(e), n = [
689
+ t,
690
+ e.ext ?? !1,
691
+ e.key_ops ?? r
692
+ ], a = { ...e };
693
+ return delete a.alg, delete a.use, ut.subtle.importKey("jwk", a, ...n);
694
+ }, rn = (e) => we(e);
695
+ let Re, Ae;
696
+ const nn = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", it = async (e, t, r, n, a = !1) => {
697
+ let s = e.get(t);
698
+ if (s != null && s[n])
699
+ return s[n];
700
+ const o = await tn({ ...r, alg: n });
701
+ return a && Object.freeze(t), s ? s[n] = o : e.set(t, { [n]: o }), o;
702
+ }, Ea = (e, t) => {
703
+ if (nn(e)) {
704
+ let r = e.export({ format: "jwk" });
705
+ return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? rn(r.k) : (Ae || (Ae = /* @__PURE__ */ new WeakMap()), it(Ae, e, r, t));
706
+ }
707
+ return De(e) ? e.k ? we(e.k) : (Ae || (Ae = /* @__PURE__ */ new WeakMap()), it(Ae, e, e, t, !0)) : e;
708
+ }, ba = (e, t) => {
709
+ if (nn(e)) {
710
+ let r = e.export({ format: "jwk" });
711
+ return r.k ? rn(r.k) : (Re || (Re = /* @__PURE__ */ new WeakMap()), it(Re, e, r, t));
712
+ }
713
+ return De(e) ? e.k ? we(e.k) : (Re || (Re = /* @__PURE__ */ new WeakMap()), it(Re, e, e, t, !0)) : e;
714
+ }, Sa = { normalizePublicKey: Ea, normalizePrivateKey: ba }, be = (e, t, r = 0) => {
715
+ r === 0 && (t.unshift(t.length), t.unshift(6));
716
+ const n = e.indexOf(t[0], r);
717
+ if (n === -1)
718
+ return !1;
719
+ const a = e.subarray(n, n + t.length);
720
+ return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || be(e, t, n + 1);
721
+ }, mr = (e) => {
722
+ switch (!0) {
723
+ case be(e, [42, 134, 72, 206, 61, 3, 1, 7]):
724
+ return "P-256";
725
+ case be(e, [43, 129, 4, 0, 34]):
726
+ return "P-384";
727
+ case be(e, [43, 129, 4, 0, 35]):
728
+ return "P-521";
729
+ case be(e, [43, 101, 110]):
730
+ return "X25519";
731
+ case be(e, [43, 101, 111]):
732
+ return "X448";
733
+ case be(e, [43, 101, 112]):
734
+ return "Ed25519";
735
+ case be(e, [43, 101, 113]):
736
+ return "Ed448";
737
+ default:
738
+ throw new ae("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
739
+ }
740
+ }, wa = async (e, t, r, n, a) => {
741
+ let s, o;
742
+ const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
743
+ switch (n) {
744
+ case "PS256":
745
+ case "PS384":
746
+ case "PS512":
747
+ s = { name: "RSA-PSS", hash: `SHA-${n.slice(-3)}` }, o = ["verify"];
748
+ break;
749
+ case "RS256":
750
+ case "RS384":
751
+ case "RS512":
752
+ s = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${n.slice(-3)}` }, o = ["verify"];
753
+ break;
754
+ case "RSA-OAEP":
755
+ case "RSA-OAEP-256":
756
+ case "RSA-OAEP-384":
757
+ case "RSA-OAEP-512":
758
+ s = {
759
+ name: "RSA-OAEP",
760
+ hash: `SHA-${parseInt(n.slice(-3), 10) || 1}`
761
+ }, o = ["encrypt", "wrapKey"];
762
+ break;
763
+ case "ES256":
764
+ s = { name: "ECDSA", namedCurve: "P-256" }, o = ["verify"];
765
+ break;
766
+ case "ES384":
767
+ s = { name: "ECDSA", namedCurve: "P-384" }, o = ["verify"];
768
+ break;
769
+ case "ES512":
770
+ s = { name: "ECDSA", namedCurve: "P-521" }, o = ["verify"];
771
+ break;
772
+ case "ECDH-ES":
773
+ case "ECDH-ES+A128KW":
774
+ case "ECDH-ES+A192KW":
775
+ case "ECDH-ES+A256KW": {
776
+ const c = mr(i);
777
+ s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
778
+ break;
779
+ }
780
+ case "EdDSA":
781
+ s = { name: mr(i) }, o = ["verify"];
782
+ break;
783
+ default:
784
+ throw new ae('Invalid or unsupported "alg" (Algorithm) value');
785
+ }
786
+ return ut.subtle.importKey(t, i, s, !1, o);
787
+ }, Ta = (e, t, r) => wa(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
788
+ async function _a(e, t, r) {
789
+ if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
790
+ throw new TypeError('"spki" must be SPKI formatted string');
791
+ return Ta(e, t);
792
+ }
793
+ async function Ia(e, t) {
794
+ if (!Pe(e))
795
+ throw new TypeError("JWK must be an object");
796
+ switch (t || (t = e.alg), e.kty) {
797
+ case "oct":
798
+ if (typeof e.k != "string" || !e.k)
799
+ throw new TypeError('missing "k" (Key Value) Parameter value');
800
+ return we(e.k);
801
+ case "RSA":
802
+ if (e.oth !== void 0)
803
+ throw new ae('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
804
+ case "EC":
805
+ case "OKP":
806
+ return tn({ ...e, alg: t });
807
+ default:
808
+ throw new ae('Unsupported "kty" (Key Type) Parameter value');
809
+ }
810
+ }
811
+ const Ce = (e) => e == null ? void 0 : e[Symbol.toStringTag], Vt = (e, t, r) => {
812
+ var n, a;
813
+ if (t.use !== void 0 && t.use !== "sig")
814
+ throw new TypeError("Invalid key for this operation, when present its use must be sig");
815
+ if (t.key_ops !== void 0 && ((a = (n = t.key_ops).includes) == null ? void 0 : a.call(n, r)) !== !0)
816
+ throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);
817
+ if (t.alg !== void 0 && t.alg !== e)
818
+ throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`);
819
+ return !0;
820
+ }, Ra = (e, t, r, n) => {
821
+ if (!(t instanceof Uint8Array)) {
822
+ if (n && De(t)) {
823
+ if (ga(t) && Vt(e, t, r))
824
+ return;
825
+ throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
826
+ }
827
+ if (!en(t))
828
+ throw new TypeError(Zr(e, t, ...ot, "Uint8Array", n ? "JSON Web Key" : null));
829
+ if (t.type !== "secret")
830
+ throw new TypeError(`${Ce(t)} instances for symmetric algorithms must be of type "secret"`);
831
+ }
832
+ }, Aa = (e, t, r, n) => {
833
+ if (n && De(t))
834
+ switch (r) {
835
+ case "sign":
836
+ if (ma(t) && Vt(e, t, r))
837
+ return;
838
+ throw new TypeError("JSON Web Key for this operation be a private JWK");
839
+ case "verify":
840
+ if (pa(t) && Vt(e, t, r))
841
+ return;
842
+ throw new TypeError("JSON Web Key for this operation be a public JWK");
843
+ }
844
+ if (!en(t))
845
+ throw new TypeError(Zr(e, t, ...ot, n ? "JSON Web Key" : null));
846
+ if (t.type === "secret")
847
+ throw new TypeError(`${Ce(t)} instances for asymmetric algorithms must not be of type "secret"`);
848
+ if (r === "sign" && t.type === "public")
849
+ throw new TypeError(`${Ce(t)} instances for asymmetric algorithm signing must be of type "private"`);
850
+ if (r === "decrypt" && t.type === "public")
851
+ throw new TypeError(`${Ce(t)} instances for asymmetric algorithm decryption must be of type "private"`);
852
+ if (t.algorithm && r === "verify" && t.type === "private")
853
+ throw new TypeError(`${Ce(t)} instances for asymmetric algorithm verifying must be of type "public"`);
854
+ if (t.algorithm && r === "encrypt" && t.type === "private")
855
+ throw new TypeError(`${Ce(t)} instances for asymmetric algorithm encryption must be of type "public"`);
856
+ };
857
+ function an(e, t, r, n) {
858
+ t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ? Ra(t, r, n, e) : Aa(t, r, n, e);
859
+ }
860
+ an.bind(void 0, !1);
861
+ const pr = an.bind(void 0, !0);
862
+ function va(e, t, r, n, a) {
863
+ if (a.crit !== void 0 && (n == null ? void 0 : n.crit) === void 0)
864
+ throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
865
+ if (!n || n.crit === void 0)
866
+ return /* @__PURE__ */ new Set();
867
+ if (!Array.isArray(n.crit) || n.crit.length === 0 || n.crit.some((o) => typeof o != "string" || o.length === 0))
868
+ throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
869
+ let s;
870
+ r !== void 0 ? s = new Map([...Object.entries(r), ...t.entries()]) : s = t;
871
+ for (const o of n.crit) {
872
+ if (!s.has(o))
873
+ throw new ae(`Extension Header Parameter "${o}" is not recognized`);
874
+ if (a[o] === void 0)
875
+ throw new e(`Extension Header Parameter "${o}" is missing`);
876
+ if (s.get(o) && n[o] === void 0)
877
+ throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`);
878
+ }
879
+ return new Set(n.crit);
880
+ }
881
+ const ka = (e, t) => {
882
+ if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
883
+ throw new TypeError(`"${e}" option must be an array of strings`);
884
+ if (t)
885
+ return new Set(t);
886
+ };
887
+ function Na(e, t) {
888
+ const r = `SHA-${e.slice(-3)}`;
889
+ switch (e) {
890
+ case "HS256":
891
+ case "HS384":
892
+ case "HS512":
893
+ return { hash: r, name: "HMAC" };
894
+ case "PS256":
895
+ case "PS384":
896
+ case "PS512":
897
+ return { hash: r, name: "RSA-PSS", saltLength: e.slice(-3) >> 3 };
898
+ case "RS256":
899
+ case "RS384":
900
+ case "RS512":
901
+ return { hash: r, name: "RSASSA-PKCS1-v1_5" };
902
+ case "ES256":
903
+ case "ES384":
904
+ case "ES512":
905
+ return { hash: r, name: "ECDSA", namedCurve: t.namedCurve };
906
+ case "EdDSA":
907
+ return { name: t.name };
908
+ default:
909
+ throw new ae(`alg ${e} is not supported either by JOSE or your javascript runtime`);
910
+ }
911
+ }
912
+ async function Oa(e, t, r) {
913
+ if (t = await Sa.normalizePublicKey(t, e), zr(t))
914
+ return da(t, e, r), t;
915
+ if (t instanceof Uint8Array) {
916
+ if (!e.startsWith("HS"))
917
+ throw new TypeError(fr(t, ...ot));
918
+ return ut.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
919
+ }
920
+ throw new TypeError(fr(t, ...ot, "Uint8Array", "JSON Web Key"));
921
+ }
922
+ const Ca = async (e, t, r, n) => {
923
+ const a = await Oa(e, t, "verify");
924
+ fa(e, a);
925
+ const s = Na(e, a.algorithm);
926
+ try {
927
+ return await ut.subtle.verify(s, a, r, n);
928
+ } catch {
929
+ return !1;
930
+ }
931
+ };
932
+ async function xa(e, t, r) {
933
+ if (!Pe(e))
934
+ throw new H("Flattened JWS must be an object");
935
+ if (e.protected === void 0 && e.header === void 0)
936
+ throw new H('Flattened JWS must have either of the "protected" or "header" members');
937
+ if (e.protected !== void 0 && typeof e.protected != "string")
938
+ throw new H("JWS Protected Header incorrect type");
939
+ if (e.payload === void 0)
940
+ throw new H("JWS Payload missing");
941
+ if (typeof e.signature != "string")
942
+ throw new H("JWS Signature missing or incorrect type");
943
+ if (e.header !== void 0 && !Pe(e.header))
944
+ throw new H("JWS Unprotected Header incorrect type");
945
+ let n = {};
946
+ if (e.protected)
947
+ try {
948
+ const p = we(e.protected);
949
+ n = JSON.parse(Ve.decode(p));
950
+ } catch {
951
+ throw new H("JWS Protected Header is invalid");
952
+ }
953
+ if (!ua(n, e.header))
954
+ throw new H("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
955
+ const a = {
956
+ ...n,
957
+ ...e.header
958
+ }, s = va(H, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, n, a);
959
+ let o = !0;
960
+ if (s.has("b64") && (o = n.b64, typeof o != "boolean"))
961
+ throw new H('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
962
+ const { alg: i } = a;
963
+ if (typeof i != "string" || !i)
964
+ throw new H('JWS "alg" (Algorithm) Header Parameter missing or invalid');
965
+ const c = ka("algorithms", r.algorithms);
966
+ if (c && !c.has(i))
967
+ throw new qr('"alg" (Algorithm) Header Parameter value not allowed');
968
+ if (o) {
969
+ if (typeof e.payload != "string")
970
+ throw new H("JWS Payload must be a string");
971
+ } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
972
+ throw new H("JWS Payload must be a string or an Uint8Array instance");
973
+ let m = !1;
974
+ typeof t == "function" ? (t = await t(n, e), m = !0, pr(i, t, "verify"), De(t) && (t = await Ia(t, i))) : pr(i, t, "verify");
975
+ const f = Zn(Ye.encode(e.protected ?? ""), Ye.encode("."), typeof e.payload == "string" ? Ye.encode(e.payload) : e.payload);
976
+ let u;
977
+ try {
978
+ u = we(e.signature);
979
+ } catch {
980
+ throw new H("Failed to base64url decode the signature");
981
+ }
982
+ if (!await Ca(i, t, u, f))
983
+ throw new Qr();
984
+ let l;
985
+ if (o)
986
+ try {
987
+ l = we(e.payload);
988
+ } catch {
989
+ throw new H("Failed to base64url decode the payload");
990
+ }
991
+ else typeof e.payload == "string" ? l = Ye.encode(e.payload) : l = e.payload;
992
+ const d = { payload: l };
993
+ return e.protected !== void 0 && (d.protectedHeader = n), e.header !== void 0 && (d.unprotectedHeader = e.header), m ? { ...d, key: t } : d;
994
+ }
995
+ async function Pa(e, t, r) {
996
+ if (e instanceof Uint8Array && (e = Ve.decode(e)), typeof e != "string")
997
+ throw new H("Compact JWS must be a string or Uint8Array");
998
+ const { 0: n, 1: a, 2: s, length: o } = e.split(".");
999
+ if (o !== 3)
1000
+ throw new H("Invalid Compact JWS");
1001
+ const i = await xa({ payload: a, protected: n, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
1002
+ return typeof t == "function" ? { ...c, key: i.key } : c;
1003
+ }
1004
+ const Da = (e) => Math.floor(e.getTime() / 1e3), sn = 60, on = sn * 60, tr = on * 24, La = tr * 7, $a = tr * 365.25, Ua = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, gr = (e) => {
1005
+ const t = Ua.exec(e);
1006
+ if (!t || t[4] && t[1])
1007
+ throw new TypeError("Invalid time period format");
1008
+ const r = parseFloat(t[2]), n = t[3].toLowerCase();
1009
+ let a;
1010
+ switch (n) {
1011
+ case "sec":
1012
+ case "secs":
1013
+ case "second":
1014
+ case "seconds":
1015
+ case "s":
1016
+ a = Math.round(r);
1017
+ break;
1018
+ case "minute":
1019
+ case "minutes":
1020
+ case "min":
1021
+ case "mins":
1022
+ case "m":
1023
+ a = Math.round(r * sn);
1024
+ break;
1025
+ case "hour":
1026
+ case "hours":
1027
+ case "hr":
1028
+ case "hrs":
1029
+ case "h":
1030
+ a = Math.round(r * on);
1031
+ break;
1032
+ case "day":
1033
+ case "days":
1034
+ case "d":
1035
+ a = Math.round(r * tr);
1036
+ break;
1037
+ case "week":
1038
+ case "weeks":
1039
+ case "w":
1040
+ a = Math.round(r * La);
1041
+ break;
1042
+ default:
1043
+ a = Math.round(r * $a);
1044
+ break;
1045
+ }
1046
+ return t[1] === "-" || t[4] === "ago" ? -a : a;
1047
+ }, yr = (e) => e.toLowerCase().replace(/^application\//, ""), Ma = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Ha = (e, t, r = {}) => {
1048
+ let n;
1049
+ try {
1050
+ n = JSON.parse(Ve.decode(t));
1051
+ } catch {
1052
+ }
1053
+ if (!Pe(n))
1054
+ throw new ie("JWT Claims Set must be a top-level JSON object");
1055
+ const { typ: a } = r;
1056
+ if (a && (typeof e.typ != "string" || yr(e.typ) !== yr(a)))
1057
+ throw new ne('unexpected "typ" JWT header value', n, "typ", "check_failed");
1058
+ const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: m } = r, f = [...s];
1059
+ m !== void 0 && f.push("iat"), c !== void 0 && f.push("aud"), i !== void 0 && f.push("sub"), o !== void 0 && f.push("iss");
1060
+ for (const p of new Set(f.reverse()))
1061
+ if (!(p in n))
1062
+ throw new ne(`missing required "${p}" claim`, n, p, "missing");
1063
+ if (o && !(Array.isArray(o) ? o : [o]).includes(n.iss))
1064
+ throw new ne('unexpected "iss" claim value', n, "iss", "check_failed");
1065
+ if (i && n.sub !== i)
1066
+ throw new ne('unexpected "sub" claim value', n, "sub", "check_failed");
1067
+ if (c && !Ma(n.aud, typeof c == "string" ? [c] : c))
1068
+ throw new ne('unexpected "aud" claim value', n, "aud", "check_failed");
1069
+ let u;
1070
+ switch (typeof r.clockTolerance) {
1071
+ case "string":
1072
+ u = gr(r.clockTolerance);
1073
+ break;
1074
+ case "number":
1075
+ u = r.clockTolerance;
1076
+ break;
1077
+ case "undefined":
1078
+ u = 0;
1079
+ break;
1080
+ default:
1081
+ throw new TypeError("Invalid clockTolerance option type");
1082
+ }
1083
+ const { currentDate: l } = r, d = Da(l || /* @__PURE__ */ new Date());
1084
+ if ((n.iat !== void 0 || m) && typeof n.iat != "number")
1085
+ throw new ne('"iat" claim must be a number', n, "iat", "invalid");
1086
+ if (n.nbf !== void 0) {
1087
+ if (typeof n.nbf != "number")
1088
+ throw new ne('"nbf" claim must be a number', n, "nbf", "invalid");
1089
+ if (n.nbf > d + u)
1090
+ throw new ne('"nbf" claim timestamp check failed', n, "nbf", "check_failed");
1091
+ }
1092
+ if (n.exp !== void 0) {
1093
+ if (typeof n.exp != "number")
1094
+ throw new ne('"exp" claim must be a number', n, "exp", "invalid");
1095
+ if (n.exp <= d - u)
1096
+ throw new Kt('"exp" claim timestamp check failed', n, "exp", "check_failed");
1097
+ }
1098
+ if (m) {
1099
+ const p = d - n.iat, y = typeof m == "number" ? m : gr(m);
1100
+ if (p - u > y)
1101
+ throw new Kt('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1102
+ if (p < 0 - u)
1103
+ throw new ne('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
1104
+ }
1105
+ return n;
1106
+ };
1107
+ async function Ka(e, t, r) {
1108
+ var n;
1109
+ const a = await Pa(e, t, r);
1110
+ if ((n = a.protectedHeader.crit) != null && n.includes("b64") && a.protectedHeader.b64 === !1)
1111
+ throw new ie("JWTs MUST NOT use unencoded payload");
1112
+ const s = { payload: Ha(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1113
+ return typeof t == "function" ? { ...s, key: a.key } : s;
1114
+ }
1115
+ const Va = we;
1116
+ function Wa(e) {
1117
+ if (typeof e != "string")
1118
+ throw new ie("JWTs must use Compact JWS serialization, JWT must be a string");
1119
+ const { 1: t, length: r } = e.split(".");
1120
+ if (r === 5)
1121
+ throw new ie("Only JWTs using Compact JWS serialization can be decoded");
1122
+ if (r !== 3)
1123
+ throw new ie("Invalid JWT");
1124
+ if (!t)
1125
+ throw new ie("JWTs must contain a payload");
1126
+ let n;
1127
+ try {
1128
+ n = Va(t);
1129
+ } catch {
1130
+ throw new ie("Failed to base64url decode the payload");
1131
+ }
1132
+ let a;
1133
+ try {
1134
+ a = JSON.parse(Ve.decode(n));
1135
+ } catch {
1136
+ throw new ie("Failed to parse the decoded payload as JSON");
1137
+ }
1138
+ if (!Pe(a))
1139
+ throw new ie("Invalid JWT Claims Set");
1140
+ return a;
1141
+ }
1142
+ const Me = async (e) => {
1143
+ try {
1144
+ const t = F.ALG, r = await _a(Xn, t);
1145
+ return await Ka(e, r, {
1146
+ issuer: F.ISSUER
1147
+ });
1148
+ } catch {
1149
+ return;
1150
+ }
1151
+ }, Ga = (e) => {
1152
+ try {
1153
+ return Wa(e);
1154
+ } catch {
1155
+ return;
1156
+ }
1157
+ }, G = [];
1158
+ for (let e = 0; e < 256; ++e)
1159
+ G.push((e + 256).toString(16).slice(1));
1160
+ function Ba(e, t = 0) {
1161
+ return (G[e[t + 0]] + G[e[t + 1]] + G[e[t + 2]] + G[e[t + 3]] + "-" + G[e[t + 4]] + G[e[t + 5]] + "-" + G[e[t + 6]] + G[e[t + 7]] + "-" + G[e[t + 8]] + G[e[t + 9]] + "-" + G[e[t + 10]] + G[e[t + 11]] + G[e[t + 12]] + G[e[t + 13]] + G[e[t + 14]] + G[e[t + 15]]).toLowerCase();
1162
+ }
1163
+ let Rt;
1164
+ const Fa = new Uint8Array(16);
1165
+ function Ja() {
1166
+ if (!Rt) {
1167
+ if (typeof crypto > "u" || !crypto.getRandomValues)
1168
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1169
+ Rt = crypto.getRandomValues.bind(crypto);
1170
+ }
1171
+ return Rt(Fa);
1172
+ }
1173
+ const Ya = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Er = { randomUUID: Ya };
1174
+ function br(e, t, r) {
1175
+ if (Er.randomUUID && !e)
1176
+ return Er.randomUUID();
1177
+ e = e || {};
1178
+ const n = e.random || (e.rng || Ja)();
1179
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Ba(n);
1180
+ }
1181
+ const Sr = globalThis.crypto, ja = (e) => `${br()}${br()}`.slice(0, e), za = (e) => btoa(
1182
+ [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1183
+ );
1184
+ async function qa(e) {
1185
+ if (!Sr.subtle)
1186
+ throw new Error(
1187
+ "crypto.subtle is available only in secure contexts (HTTPS)."
1188
+ );
1189
+ const t = new TextEncoder().encode(e), r = await Sr.subtle.digest("SHA-256", t);
1190
+ return za(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1191
+ }
1192
+ async function Qa(e) {
1193
+ const t = ja(43), r = await qa(t);
1194
+ return {
1195
+ code_verifier: t,
1196
+ code_challenge: r
1197
+ };
1198
+ }
1199
+ function cn(e, t) {
1200
+ window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1201
+ }
1202
+ const wr = (e, t) => {
1203
+ const r = JSON.stringify(
1204
+ typeof t == "function" ? t() : t
1205
+ );
1206
+ window.localStorage.setItem(e, r), cn(e, r);
1207
+ }, Xa = (e) => {
1208
+ window.localStorage.removeItem(e), cn(e, null);
1209
+ }, Tr = (e) => window.localStorage.getItem(e), Za = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1210
+ function ze({
1211
+ key: e,
1212
+ initialValue: t
1213
+ }) {
1214
+ const r = Hn(Za, () => Tr(e)), n = re(
1215
+ (o) => {
1216
+ try {
1217
+ const i = typeof o == "function" ? o(JSON.parse(r)) : o;
1218
+ i == null ? Xa(e) : wr(e, i);
1219
+ } catch (i) {
1220
+ console.warn(i);
1221
+ }
1222
+ },
1223
+ [e, r]
1224
+ ), a = re(() => {
1225
+ n(t);
1226
+ }, [t, n]), s = re(() => {
1227
+ n(null);
1228
+ }, [n]);
1229
+ return se(() => {
1230
+ try {
1231
+ Tr(e) === null && typeof t < "u" && wr(e, t);
1232
+ } catch (o) {
1233
+ console.warn(o);
1234
+ }
1235
+ }, [e, t]), [r ? JSON.parse(r) : null, n, a, s];
1236
+ }
1237
+ const B = [];
1238
+ for (let e = 0; e < 256; ++e)
1239
+ B.push((e + 256).toString(16).slice(1));
1240
+ function es(e, t = 0) {
1241
+ return (B[e[t + 0]] + B[e[t + 1]] + B[e[t + 2]] + B[e[t + 3]] + "-" + B[e[t + 4]] + B[e[t + 5]] + "-" + B[e[t + 6]] + B[e[t + 7]] + "-" + B[e[t + 8]] + B[e[t + 9]] + "-" + B[e[t + 10]] + B[e[t + 11]] + B[e[t + 12]] + B[e[t + 13]] + B[e[t + 14]] + B[e[t + 15]]).toLowerCase();
1242
+ }
1243
+ let At;
1244
+ const ts = new Uint8Array(16);
1245
+ function rs() {
1246
+ if (!At) {
1247
+ if (typeof crypto > "u" || !crypto.getRandomValues)
1248
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1249
+ At = crypto.getRandomValues.bind(crypto);
1250
+ }
1251
+ return At(ts);
1252
+ }
1253
+ const ns = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), _r = { randomUUID: ns };
1254
+ function vt(e, t, r) {
1255
+ if (_r.randomUUID && !e)
1256
+ return _r.randomUUID();
1257
+ e = e || {};
1258
+ const n = e.random || (e.rng || rs)();
1259
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, es(n);
1260
+ }
1261
+ const ve = "Your session has expired. For your security, please log in again to continue.", as = "Your session has been successfully terminated.", kt = "Login failed. Please try again.", ss = "Error getting access token, please re-authenticate.", os = "You forgot to wrap your component in <AuthProvider>.", qe = "@@auth@@", $e = "LOADING", rt = "LOGIN", ln = "LOGOUT", We = "success", ue = "failure", dn = "include", un = "POST", hn = "application/json", Qe = {
1262
+ GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1263
+ $clientId: String!,
1264
+ $username: String!,
1265
+ $id: String!) {
1266
+ getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
1267
+ challenge
1268
+ rp {
1269
+ id
1270
+ name
1271
+ }
1272
+ user {
1273
+ id
1274
+ name
1275
+ displayName
1276
+ }
1277
+ pubKeyCredParams {
1278
+ type
1279
+ alg
1280
+ }
1281
+ timeout
1282
+ attestation
1283
+ }
1284
+ }`,
1285
+ VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
1286
+ $clientId: String!,
1287
+ $username: String!,
1288
+ $id: String!,
1289
+ $registration: RegistrationOptionsInput!) {
1290
+ verifyPasskeyRegistration(
1291
+ clientId: $clientId,
1292
+ username: $username,
1293
+ id: $id,
1294
+ registration: $registration) {
1295
+ status
1296
+ message
1297
+ }
1298
+ }`,
1299
+ GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
1300
+ $id: String!,
1301
+ $clientId: String!,
1302
+ ) {
1303
+ getPasskeyAuthenticationOptions(
1304
+ id: $id,
1305
+ clientId: $clientId) {
1306
+ rpId,
1307
+ challenge,
1308
+ allowCredentials {
1309
+ id,
1310
+ type,
1311
+ transports
1312
+ }
1313
+ timeout,
1314
+ userVerification,
1315
+ }
1316
+ }`,
1317
+ VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
1318
+ $clientId: String!,
1319
+ $id: String!,
1320
+ $authentication: AuthenticationOptionsInput!,
1321
+ $nonce: String!,
1322
+ $domain: String,
1323
+ $sessionExpiration: String,
1324
+ $ua: String) {
1325
+ verifyPasskeyAuthentication(
1326
+ clientId: $clientId,
1327
+ id: $id,
1328
+ authentication: $authentication,
1329
+ nonce: $nonce,
1330
+ domain: $domain,
1331
+ sessionExpiration: $sessionExpiration,
1332
+ ua: $ua) {
1333
+ status,
1334
+ idToken,
1335
+ accessToken,
1336
+ refreshToken,
1337
+ userId,
1338
+ username,
1339
+ email
1340
+ }
1341
+ }`
1342
+ }, ke = {
1343
+ GET_REGISTRATION_OPTIONS: {
1344
+ schema: Qe.GET_REGISTRATION_OPTIONS,
1345
+ method: "getPasskeyRegistrationOptions"
1346
+ },
1347
+ VERIFY_REGISTRATION: {
1348
+ schema: Qe.VERIFY_REGISTRATION,
1349
+ method: "verifyPasskeyRegistration"
1350
+ },
1351
+ GET_AUTHENTICATION_OPTIONS: {
1352
+ schema: Qe.GET_AUTHENTICATION_OPTIONS,
1353
+ method: "getPasskeyAuthenticationOptions"
1354
+ },
1355
+ VERIFY_AUTHENTICATION: {
1356
+ schema: Qe.VERIFY_AUTHENTICATION,
1357
+ method: "verifyPasskeyAuthentication"
1358
+ }
1359
+ }, Ne = async ({
1360
+ accessToken: e,
1361
+ type: t,
1362
+ clientId: r,
1363
+ params: n = {},
1364
+ endpoint: a
1365
+ }) => {
1366
+ try {
1367
+ const s = `Bearer ${e}`, o = await fetch(`${a}/graphql`, {
1368
+ credentials: dn,
1369
+ method: un,
1370
+ headers: {
1371
+ authorization: s,
1372
+ "Content-Type": hn,
1373
+ [jr.CLIENT_ID]: `${r}`
1374
+ },
1375
+ body: JSON.stringify({
1376
+ query: t.schema,
1377
+ variables: n
1378
+ })
1379
+ });
1380
+ if (o.status !== 200)
1381
+ return { status: ue, data: [] };
1382
+ const { data: i } = await o.json();
1383
+ return {
1384
+ status: We,
1385
+ data: i[t.method]
1386
+ };
1387
+ } catch (s) {
1388
+ return console.error(s), { status: ue, data: [] };
1389
+ }
1390
+ }, ht = async ({
1391
+ type: e,
1392
+ clientId: t,
1393
+ params: r = {},
1394
+ endpoint: n
1395
+ }) => {
1396
+ try {
1397
+ const a = await fetch(`${n}/${e}`, {
1398
+ credentials: dn,
1399
+ method: un,
1400
+ headers: {
1401
+ "Content-Type": hn,
1402
+ [jr.CLIENT_ID]: `${t}`
1403
+ },
1404
+ body: JSON.stringify(r)
1405
+ });
1406
+ if (a.status !== 200)
1407
+ return { status: ue, data: [] };
1408
+ const { data: s } = await a.json();
1409
+ return {
1410
+ status: We,
1411
+ data: s || []
1412
+ };
1413
+ } catch (a) {
1414
+ return console.error(a), { status: ue, data: [] };
1415
+ }
1416
+ }, is = process.env.NODE_ENV === "production", cs = !is, fn = {
1417
+ isLoading: !0,
1418
+ isAuthenticated: !1,
1419
+ user: void 0,
1420
+ logoutReason: "",
1421
+ debug: !1,
1422
+ authenticationType: ""
1423
+ }, ls = (e) => {
1424
+ try {
1425
+ const t = Ga(e);
1426
+ return t ? t[F.USER_ID_KEY] : "";
1427
+ } catch {
1428
+ return "";
1429
+ }
1430
+ }, ds = async ({
1431
+ userId: e,
1432
+ clientId: t,
1433
+ domain: r,
1434
+ idToken: n = "",
1435
+ endpoint: a
1436
+ }) => {
1437
+ var s;
1438
+ try {
1439
+ return {
1440
+ status: ((s = await ht({
1441
+ endpoint: a,
1442
+ type: dt.LOGOUT,
1443
+ clientId: t,
1444
+ params: {
1445
+ userId: e,
1446
+ domain: r,
1447
+ idToken: n
1448
+ }
1449
+ })) == null ? void 0 : s.status) || ue
1450
+ };
1451
+ } catch {
1452
+ return {
1453
+ status: ue
1454
+ };
1455
+ }
1456
+ }, us = async ({
1457
+ username: e,
1458
+ password: t,
1459
+ clientId: r,
1460
+ nonce: n,
1461
+ type: a,
1462
+ sessionExpiration: s,
1463
+ code: o,
1464
+ code_verifier: i,
1465
+ domain: c,
1466
+ ua: m,
1467
+ endpoint: f
1468
+ }) => {
1469
+ var u;
1470
+ try {
1471
+ const l = await ht({
1472
+ endpoint: f,
1473
+ type: dt.LOGIN,
1474
+ clientId: r,
1475
+ params: {
1476
+ type: a || xe.ID_AND_ACCESS_TOKEN,
1477
+ username: e,
1478
+ password: t,
1479
+ sessionExpiration: s,
1480
+ nonce: n,
1481
+ code: o,
1482
+ code_verifier: i,
1483
+ domain: c,
1484
+ ua: m
1485
+ }
1486
+ }), d = await Me((u = l == null ? void 0 : l.data) == null ? void 0 : u.idToken);
1487
+ return d && d.payload[F.USER_ID_KEY] !== "" && d.payload[F.NONCE_KEY] === n ? {
1488
+ idToken: l.data.idToken,
1489
+ accessToken: l.data.accessToken,
1490
+ refreshToken: l.data.refreshToken,
1491
+ userId: d.payload[F.USER_ID_KEY],
1492
+ email: d.payload[F.EMAIL_KEY],
1493
+ status: !0
1494
+ } : {
1495
+ status: !1
1496
+ };
1497
+ } catch {
1498
+ return {
1499
+ status: !1
1500
+ };
1501
+ }
1502
+ }, hs = async ({
1503
+ nonce: e,
1504
+ clientId: t,
1505
+ code_challenge: r,
1506
+ endpoint: n
1507
+ }) => {
1508
+ var a;
1509
+ try {
1510
+ const s = await ht({
1511
+ endpoint: n,
1512
+ type: dt.CODE,
1513
+ clientId: t,
1514
+ params: {
1515
+ type: xe.CODE,
1516
+ nonce: e,
1517
+ code_challenge: r
1518
+ }
1519
+ });
1520
+ return (a = s == null ? void 0 : s.data) != null && a.code ? {
1521
+ status: We,
1522
+ data: s.data.code
1523
+ } : {
1524
+ status: ue,
1525
+ data: ""
1526
+ };
1527
+ } catch {
1528
+ return {
1529
+ status: ue,
1530
+ data: ""
1531
+ };
1532
+ }
1533
+ }, fs = async ({
1534
+ clientId: e,
1535
+ userId: t,
1536
+ nonce: r,
1537
+ refreshToken: n,
1538
+ accessToken: a,
1539
+ domain: s,
1540
+ endpoint: o
1541
+ }) => {
1542
+ var i;
1543
+ try {
1544
+ const c = await ht({
1545
+ endpoint: o,
1546
+ type: dt.REFRESH,
1547
+ clientId: e,
1548
+ params: {
1549
+ type: xe.REFRESH_TOKEN,
1550
+ userId: t,
1551
+ nonce: r,
1552
+ refreshToken: n,
1553
+ accessToken: a,
1554
+ domain: s
1555
+ }
1556
+ }), m = await Me((i = c == null ? void 0 : c.data) == null ? void 0 : i.accessToken);
1557
+ return m && m.payload[F.USER_ID_KEY] !== "" && m.payload[F.NONCE_KEY] === r ? {
1558
+ accessToken: c.data.accessToken,
1559
+ refreshToken: c.data.refreshToken,
1560
+ userId: m.payload[F.USER_ID_KEY],
1561
+ status: !0
1562
+ } : {
1563
+ status: !1
1564
+ };
1565
+ } catch {
1566
+ return {
1567
+ status: !1
1568
+ };
1569
+ }
1570
+ };
1571
+ class ms {
1572
+ constructor(t = null, r = null) {
1573
+ Tt(this, "refreshTokenPromise", null), Tt(this, "accessToken"), Tt(this, "refreshToken"), this.accessToken = t || "", this.refreshToken = r || "";
1574
+ }
1575
+ async refreshtoken({
1576
+ clientId: t,
1577
+ userId: r,
1578
+ nonce: n,
1579
+ domain: a,
1580
+ endpoint: s
1581
+ }) {
1582
+ this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
1583
+ endpoint: s,
1584
+ clientId: t,
1585
+ userId: r,
1586
+ nonce: n,
1587
+ domain: a
1588
+ }));
1589
+ try {
1590
+ return await this.refreshTokenPromise;
1591
+ } finally {
1592
+ this.refreshTokenPromise = null;
1593
+ }
1594
+ }
1595
+ async _refreshToken({
1596
+ endpoint: t,
1597
+ clientId: r,
1598
+ userId: n,
1599
+ nonce: a,
1600
+ domain: s
1601
+ }) {
1602
+ const o = await Me(this.refreshToken);
1603
+ if (o && o.payload[F.USER_ID_KEY] !== "") {
1604
+ const i = await fs({
1605
+ endpoint: t,
1606
+ clientId: r,
1607
+ userId: n,
1608
+ nonce: a,
1609
+ refreshToken: this.refreshToken,
1610
+ accessToken: this.accessToken,
1611
+ domain: s
1612
+ });
1613
+ return i.status ? (this.accessToken = i.accessToken, this.refreshToken = i.refreshToken, {
1614
+ status: We,
1615
+ newAccessToken: i.accessToken,
1616
+ newRefreshToken: i.refreshToken
1617
+ }) : {
1618
+ status: ue
1619
+ };
1620
+ } else
1621
+ return {
1622
+ status: ue
1623
+ };
1624
+ }
1625
+ }
1626
+ const ps = (e) => re(
1627
+ (...t) => {
1628
+ e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1629
+ },
1630
+ [e]
1631
+ ), Oe = () => {
1632
+ throw new Error(os);
1633
+ }, mn = Vr({
1634
+ isAuthenticated: !1,
1635
+ isLoading: !1,
1636
+ login: Oe,
1637
+ logout: Oe,
1638
+ getAccessToken: Oe,
1639
+ getIdToken: Oe,
1640
+ registeringForPasskey: Oe,
1641
+ loginWithPasskey: Oe,
1642
+ logoutReason: "",
1643
+ authenticationType: ""
1644
+ }), gs = Z.createContext({
1645
+ state: fn,
1646
+ dispatch: () => {
1647
+ }
1648
+ }), ys = (e, t) => (t == null ? void 0 : t.type) === $e ? {
1649
+ ...e,
1650
+ isLoading: t.payload.isLoading
1651
+ } : (t == null ? void 0 : t.type) === rt ? {
1652
+ ...e,
1653
+ isLoading: !1,
1654
+ isAuthenticated: !0,
1655
+ user: t.payload.user,
1656
+ authenticationType: t.payload.authenticationType,
1657
+ logoutReason: ""
1658
+ } : (t == null ? void 0 : t.type) === ln ? {
1659
+ ...e,
1660
+ isLoading: !1,
1661
+ isAuthenticated: !1,
1662
+ user: void 0,
1663
+ authenticationType: "",
1664
+ logoutReason: t.payload.logoutReason
1665
+ } : e, Ir = ({
1666
+ children: e,
1667
+ sessionExpiration: t,
1668
+ clientId: r,
1669
+ domain: n = "",
1670
+ debug: a = !1,
1671
+ endpoint: s = cs ? "https://auth.gizmette.local.com:3003" : "https://mylogin.gizmette.com/auth"
1672
+ }) => {
1673
+ const [o, i] = Wr(ys, {
1674
+ ...fn,
1675
+ debug: a
1676
+ }), c = ps(a), m = x(!1), [f, u, , l] = ze({
1677
+ key: `${qe}::${r}::@@user@@`
1678
+ }), [d, p, , y] = ze({
1679
+ key: `${qe}::${r}::@@access@@`
1680
+ }), [w, g, , $] = ze(
1681
+ {
1682
+ key: `${qe}::${r}::@@refresh@@`
1683
+ }
1684
+ ), [U, K, , I] = ze({
1685
+ key: `${qe}::${r}::@@nonce@@`
1686
+ }), D = new ms(d, w), M = re(() => {
1687
+ c("removeLocalStorage: removing local storage"), l(), y(), $(), I();
1688
+ }, [
1689
+ y,
1690
+ l,
1691
+ I,
1692
+ $,
1693
+ c
1694
+ ]), S = re(
1695
+ (b) => {
1696
+ c(
1697
+ "removeStateAndLocalStorage: removing state and local storage with reason: ",
1698
+ b
1699
+ ), i({
1700
+ type: ln,
1701
+ payload: {
1702
+ logoutReason: b || ve
1703
+ }
1704
+ }), M(), i({ type: $e, payload: { isLoading: !1 } });
1705
+ },
1706
+ [M, c]
1707
+ ), v = re(
1708
+ async (b) => {
1709
+ c("invalidateAndLogout: invalidating and logging out");
1710
+ const { user: k } = o, T = (k == null ? void 0 : k.userId) || ls(f);
1711
+ T || c(
1712
+ "invalidateAndLogout: user cannot be identified, logging out without userId"
1713
+ ), await ds({
1714
+ userId: T,
1715
+ clientId: r,
1716
+ domain: n,
1717
+ idToken: f,
1718
+ endpoint: s
1719
+ }), S(b || ve);
1720
+ },
1721
+ [
1722
+ f,
1723
+ o,
1724
+ r,
1725
+ n,
1726
+ S,
1727
+ c,
1728
+ s
1729
+ ]
1730
+ );
1731
+ se(() => {
1732
+ if (!m.current)
1733
+ return o.isLoading && f !== null ? (async () => {
1734
+ try {
1735
+ const b = await Me(f);
1736
+ b && b.payload[F.USER_ID_KEY] !== "" ? (c("useEffect: setting the authentication state"), i({
1737
+ type: rt,
1738
+ payload: {
1739
+ authenticationType: b.payload[F.AUTH_TYPE_KEY],
1740
+ user: {
1741
+ userId: b.payload[F.USER_ID_KEY],
1742
+ username: b.payload[F.USERNAME_KEY],
1743
+ email: b.payload[F.EMAIL_KEY]
1744
+ }
1745
+ }
1746
+ })) : (c("useEffect: invalid JWT, invalidating and logging out"), await v(ve));
1747
+ } catch {
1748
+ c(
1749
+ "useEffect: exception validating JWT, invalidating and logging out"
1750
+ ), await v(ve);
1751
+ }
1752
+ })() : (c("useEffect: setting the loading state to false"), i({ type: $e, payload: { isLoading: !1 } })), () => {
1753
+ m.current = !0;
1754
+ };
1755
+ }, [o.isLoading, f, v, c]);
1756
+ const P = async (b, k) => {
1757
+ i({ type: $e, payload: { isLoading: !0 } }), M();
1758
+ const T = vt();
1759
+ K(T), c("login: Logging in with password");
1760
+ const { code_verifier: he, code_challenge: Et } = await Qa(), fe = await hs({
1761
+ endpoint: s,
1762
+ nonce: T,
1763
+ clientId: r,
1764
+ code_challenge: Et
1765
+ });
1766
+ if (fe.status) {
1767
+ const Q = await us({
1768
+ endpoint: s,
1769
+ username: b,
1770
+ password: k,
1771
+ clientId: r,
1772
+ sessionExpiration: t,
1773
+ nonce: T,
1774
+ type: xe.CODE,
1775
+ code: fe.data,
1776
+ code_verifier: he,
1777
+ domain: n,
1778
+ ua: navigator.userAgent
1779
+ });
1780
+ return Q.status ? (u(Q.idToken), p(Q.accessToken), g(Q.refreshToken), i({
1781
+ type: rt,
1782
+ payload: {
1783
+ authenticationType: xe.CODE,
1784
+ user: {
1785
+ userId: Q.userId,
1786
+ username: b,
1787
+ email: Q.email
1788
+ }
1789
+ }
1790
+ }), !0) : (S(kt), !1);
1791
+ }
1792
+ return !1;
1793
+ }, R = async (b) => {
1794
+ b == null || b.preventDefault(), await v(as);
1795
+ }, C = async () => {
1796
+ const { isAuthenticated: b, user: k } = o;
1797
+ try {
1798
+ if (b && k && k.userId) {
1799
+ if (d) {
1800
+ c("getAccessToken");
1801
+ const he = await Me(d);
1802
+ if (he && he.payload[F.USER_ID_KEY] !== "")
1803
+ return d;
1804
+ }
1805
+ c("getAccessToken: invalid access token, trying to refresh it");
1806
+ const T = await D.refreshtoken({
1807
+ endpoint: s,
1808
+ clientId: r,
1809
+ userId: k.userId,
1810
+ nonce: U,
1811
+ domain: n
1812
+ });
1813
+ return T.status && T.status === "success" && T.newAccessToken ? (p(T.newAccessToken), g(T.newRefreshToken), T.newAccessToken) : (c(
1814
+ "getAccessToken: invalid refresh token, need to re-authenticate"
1815
+ ), await v(ve), "");
1816
+ }
1817
+ return c(
1818
+ "getAccessToken: user is not authenticated, cannot get access token"
1819
+ ), await v(ve), "";
1820
+ } catch {
1821
+ return c(
1822
+ "getAccessToken: exception occurred, invalidating and logging out"
1823
+ ), await v(ss), "";
1824
+ }
1825
+ }, A = () => o.isAuthenticated && f ? f : "", V = async () => {
1826
+ const { user: b } = o;
1827
+ let k = await Ne({
1828
+ endpoint: s,
1829
+ accessToken: d,
1830
+ clientId: r,
1831
+ type: ke.GET_REGISTRATION_OPTIONS,
1832
+ params: {
1833
+ clientId: r,
1834
+ id: b == null ? void 0 : b.userId,
1835
+ username: b == null ? void 0 : b.username
1836
+ }
1837
+ });
1838
+ if (k.status)
1839
+ try {
1840
+ const T = await jn(k.data);
1841
+ return k = await Ne({
1842
+ endpoint: s,
1843
+ accessToken: d,
1844
+ clientId: r,
1845
+ type: ke.VERIFY_REGISTRATION,
1846
+ params: {
1847
+ clientId: r,
1848
+ id: b == null ? void 0 : b.userId,
1849
+ username: b == null ? void 0 : b.username,
1850
+ registration: T
1851
+ }
1852
+ }), !!(k.status && k.data.length > 0);
1853
+ } catch {
1854
+ return await Ne({
1855
+ endpoint: s,
1856
+ accessToken: d,
1857
+ clientId: r,
1858
+ type: ke.VERIFY_REGISTRATION,
1859
+ params: {
1860
+ clientId: r,
1861
+ id: b == null ? void 0 : b.userId,
1862
+ username: b == null ? void 0 : b.username,
1863
+ registration: {}
1864
+ }
1865
+ }), !1;
1866
+ }
1867
+ return !1;
1868
+ }, ee = async () => {
1869
+ i({ type: $e, payload: { isLoading: !0 } }), M();
1870
+ const b = vt();
1871
+ K(b), c("loginWithPasskey");
1872
+ const k = vt();
1873
+ let T = await Ne({
1874
+ endpoint: s,
1875
+ accessToken: d,
1876
+ clientId: r,
1877
+ type: ke.GET_AUTHENTICATION_OPTIONS,
1878
+ params: {
1879
+ id: k,
1880
+ clientId: r
1881
+ }
1882
+ });
1883
+ if (T.status)
1884
+ try {
1885
+ const he = await Qn(T.data);
1886
+ return T = await Ne({
1887
+ endpoint: s,
1888
+ accessToken: d,
1889
+ clientId: r,
1890
+ type: ke.VERIFY_AUTHENTICATION,
1891
+ params: {
1892
+ clientId: r,
1893
+ id: k,
1894
+ authentication: he,
1895
+ nonce: b,
1896
+ domain: n,
1897
+ sessionExpiration: t,
1898
+ ua: navigator.userAgent
1899
+ }
1900
+ }), T.data.status === We ? (u(T.data.idToken), p(T.data.accessToken), g(T.data.refreshToken), i({
1901
+ type: rt,
1902
+ payload: {
1903
+ authenticationType: xe.PASSKEY,
1904
+ user: {
1905
+ userId: T.data.userId,
1906
+ username: T.data.username,
1907
+ email: T.data.email
1908
+ }
1909
+ }
1910
+ }), !0) : (S(kt), !1);
1911
+ } catch {
1912
+ return await Ne({
1913
+ endpoint: s,
1914
+ accessToken: d,
1915
+ clientId: r,
1916
+ type: ke.VERIFY_AUTHENTICATION,
1917
+ params: {
1918
+ clientId: r,
1919
+ id: k,
1920
+ authentication: {},
1921
+ nonce: b,
1922
+ domain: n,
1923
+ sessionExpiration: t
1924
+ }
1925
+ }), S(kt), !1;
1926
+ }
1927
+ return !1;
1928
+ };
1929
+ return /* @__PURE__ */ h(gs.Provider, { value: { state: o, dispatch: i }, children: /* @__PURE__ */ h(
1930
+ mn.Provider,
1931
+ {
1932
+ value: {
1933
+ ...o,
1934
+ login: P,
1935
+ logout: R,
1936
+ getAccessToken: C,
1937
+ getIdToken: A,
1938
+ registeringForPasskey: V,
1939
+ loginWithPasskey: ee
1940
+ },
1941
+ children: e
1942
+ }
1943
+ ) });
1944
+ }, pn = (e = mn) => Zt(e), Ci = "user", xi = "assistant", Pi = "system", Di = "internal", Li = "hidden", $i = "I'm having trouble right now. Please try again later.", Ui = "OpenAI", Mi = "OpenAI", Hi = "Anthropic", Ki = "action-search", Vi = "action-sort", Wi = "action-toggle-prompt", Gi = "action-reset-prompt", Bi = "sassy-saint-", Fi = "details", Ji = "search", Yi = "sort", ji = "private-disclosure", zi = "==stats==", qi = "==wait==", Rr = "b44c68f0-e5b3-4a1d-a3e3-df8632b0223b", Qi = 10, Xi = 30, Zi = "av-prompt", ec = "av-prompt-editable", tc = "size-5 sm:size-4", rc = 30, nc = 10, ac = 130;
1945
+ var Xe = { exports: {} }, Nt = {};
1946
+ /**
1947
+ * @license React
1948
+ * use-sync-external-store-shim.production.js
1949
+ *
1950
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1951
+ *
1952
+ * This source code is licensed under the MIT license found in the
1953
+ * LICENSE file in the root directory of this source tree.
1954
+ */
1955
+ var Ar;
1956
+ function Es() {
1957
+ if (Ar) return Nt;
1958
+ Ar = 1;
1959
+ var e = Z;
1960
+ function t(u, l) {
1961
+ return u === l && (u !== 0 || 1 / u === 1 / l) || u !== u && l !== l;
1962
+ }
1963
+ var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, a = e.useEffect, s = e.useLayoutEffect, o = e.useDebugValue;
1964
+ function i(u, l) {
1965
+ var d = l(), p = n({ inst: { value: d, getSnapshot: l } }), y = p[0].inst, w = p[1];
1966
+ return s(
1967
+ function() {
1968
+ y.value = d, y.getSnapshot = l, c(y) && w({ inst: y });
1969
+ },
1970
+ [u, d, l]
1971
+ ), a(
1972
+ function() {
1973
+ return c(y) && w({ inst: y }), u(function() {
1974
+ c(y) && w({ inst: y });
1975
+ });
1976
+ },
1977
+ [u]
1978
+ ), o(d), d;
1979
+ }
1980
+ function c(u) {
1981
+ var l = u.getSnapshot;
1982
+ u = u.value;
1983
+ try {
1984
+ var d = l();
1985
+ return !r(u, d);
1986
+ } catch {
1987
+ return !0;
1988
+ }
1989
+ }
1990
+ function m(u, l) {
1991
+ return l();
1992
+ }
1993
+ var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? m : i;
1994
+ return Nt.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : f, Nt;
1995
+ }
1996
+ var Ot = {};
1997
+ /**
1998
+ * @license React
1999
+ * use-sync-external-store-shim.development.js
2000
+ *
2001
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2002
+ *
2003
+ * This source code is licensed under the MIT license found in the
2004
+ * LICENSE file in the root directory of this source tree.
2005
+ */
2006
+ var vr;
2007
+ function bs() {
2008
+ return vr || (vr = 1, process.env.NODE_ENV !== "production" && function() {
2009
+ function e(d, p) {
2010
+ return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
2011
+ }
2012
+ function t(d, p) {
2013
+ f || a.startTransition === void 0 || (f = !0, console.error(
2014
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
2015
+ ));
2016
+ var y = p();
2017
+ if (!u) {
2018
+ var w = p();
2019
+ s(y, w) || (console.error(
2020
+ "The result of getSnapshot should be cached to avoid an infinite loop"
2021
+ ), u = !0);
2022
+ }
2023
+ w = o({
2024
+ inst: { value: y, getSnapshot: p }
2025
+ });
2026
+ var g = w[0].inst, $ = w[1];
2027
+ return c(
2028
+ function() {
2029
+ g.value = y, g.getSnapshot = p, r(g) && $({ inst: g });
2030
+ },
2031
+ [d, y, p]
2032
+ ), i(
2033
+ function() {
2034
+ return r(g) && $({ inst: g }), d(function() {
2035
+ r(g) && $({ inst: g });
2036
+ });
2037
+ },
2038
+ [d]
2039
+ ), m(y), y;
2040
+ }
2041
+ function r(d) {
2042
+ var p = d.getSnapshot;
2043
+ d = d.value;
2044
+ try {
2045
+ var y = p();
2046
+ return !s(d, y);
2047
+ } catch {
2048
+ return !0;
2049
+ }
2050
+ }
2051
+ function n(d, p) {
2052
+ return p();
2053
+ }
2054
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2055
+ var a = Z, s = typeof Object.is == "function" ? Object.is : e, o = a.useState, i = a.useEffect, c = a.useLayoutEffect, m = a.useDebugValue, f = !1, u = !1, l = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : t;
2056
+ Ot.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2057
+ }()), Ot;
2058
+ }
2059
+ var kr;
2060
+ function Ss() {
2061
+ return kr || (kr = 1, process.env.NODE_ENV === "production" ? Xe.exports = /* @__PURE__ */ Es() : Xe.exports = /* @__PURE__ */ bs()), Xe.exports;
2062
+ }
2063
+ var ws = /* @__PURE__ */ Ss();
2064
+ const gn = 0, yn = 1, En = 2, Nr = 3;
2065
+ var Or = Object.prototype.hasOwnProperty;
2066
+ function Wt(e, t) {
2067
+ var r, n;
2068
+ if (e === t) return !0;
2069
+ if (e && t && (r = e.constructor) === t.constructor) {
2070
+ if (r === Date) return e.getTime() === t.getTime();
2071
+ if (r === RegExp) return e.toString() === t.toString();
2072
+ if (r === Array) {
2073
+ if ((n = e.length) === t.length)
2074
+ for (; n-- && Wt(e[n], t[n]); ) ;
2075
+ return n === -1;
2076
+ }
2077
+ if (!r || typeof e == "object") {
2078
+ n = 0;
2079
+ for (r in e)
2080
+ if (Or.call(e, r) && ++n && !Or.call(t, r) || !(r in t) || !Wt(e[r], t[r])) return !1;
2081
+ return Object.keys(t).length === n;
2082
+ }
2083
+ }
2084
+ return e !== e && t !== t;
2085
+ }
2086
+ const le = /* @__PURE__ */ new WeakMap(), Se = () => {
2087
+ }, z = (
2088
+ /*#__NOINLINE__*/
2089
+ Se()
2090
+ ), Gt = Object, _ = (e) => e === z, de = (e) => typeof e == "function", Te = (e, t) => ({
2091
+ ...e,
2092
+ ...t
2093
+ }), bn = (e) => de(e.then), Ct = {}, Ze = {}, rr = "undefined", Ge = typeof window != rr, Bt = typeof document != rr, Ts = Ge && "Deno" in window, _s = () => Ge && typeof window.requestAnimationFrame != rr, Sn = (e, t) => {
2094
+ const r = le.get(e);
2095
+ return [
2096
+ // Getter
2097
+ () => !_(t) && e.get(t) || Ct,
2098
+ // Setter
2099
+ (n) => {
2100
+ if (!_(t)) {
2101
+ const a = e.get(t);
2102
+ t in Ze || (Ze[t] = a), r[5](t, Te(a, n), a || Ct);
2103
+ }
2104
+ },
2105
+ // Subscriber
2106
+ r[6],
2107
+ // Get server cache snapshot
2108
+ () => !_(t) && t in Ze ? Ze[t] : !_(t) && e.get(t) || Ct
2109
+ ];
2110
+ };
2111
+ let Ft = !0;
2112
+ const Is = () => Ft, [Jt, Yt] = Ge && window.addEventListener ? [
2113
+ window.addEventListener.bind(window),
2114
+ window.removeEventListener.bind(window)
2115
+ ] : [
2116
+ Se,
2117
+ Se
2118
+ ], Rs = () => {
2119
+ const e = Bt && document.visibilityState;
2120
+ return _(e) || e !== "hidden";
2121
+ }, As = (e) => (Bt && document.addEventListener("visibilitychange", e), Jt("focus", e), () => {
2122
+ Bt && document.removeEventListener("visibilitychange", e), Yt("focus", e);
2123
+ }), vs = (e) => {
2124
+ const t = () => {
2125
+ Ft = !0, e();
2126
+ }, r = () => {
2127
+ Ft = !1;
2128
+ };
2129
+ return Jt("online", t), Jt("offline", r), () => {
2130
+ Yt("online", t), Yt("offline", r);
2131
+ };
2132
+ }, ks = {
2133
+ isOnline: Is,
2134
+ isVisible: Rs
2135
+ }, Ns = {
2136
+ initFocus: As,
2137
+ initReconnect: vs
2138
+ }, Cr = !Z.useId, He = !Ge || Ts, Os = (e) => _s() ? window.requestAnimationFrame(e) : setTimeout(e, 1), xt = He ? se : Ue, Pt = typeof navigator < "u" && navigator.connection, xr = !He && Pt && ([
2139
+ "slow-2g",
2140
+ "2g"
2141
+ ].includes(Pt.effectiveType) || Pt.saveData), et = /* @__PURE__ */ new WeakMap(), Dt = (e, t) => Gt.prototype.toString.call(e) === `[object ${t}]`;
2142
+ let Cs = 0;
2143
+ const jt = (e) => {
2144
+ const t = typeof e, r = Dt(e, "Date"), n = Dt(e, "RegExp"), a = Dt(e, "Object");
2145
+ let s, o;
2146
+ if (Gt(e) === e && !r && !n) {
2147
+ if (s = et.get(e), s) return s;
2148
+ if (s = ++Cs + "~", et.set(e, s), Array.isArray(e)) {
2149
+ for (s = "@", o = 0; o < e.length; o++)
2150
+ s += jt(e[o]) + ",";
2151
+ et.set(e, s);
2152
+ }
2153
+ if (a) {
2154
+ s = "#";
2155
+ const i = Gt.keys(e).sort();
2156
+ for (; !_(o = i.pop()); )
2157
+ _(e[o]) || (s += o + ":" + jt(e[o]) + ",");
2158
+ et.set(e, s);
2159
+ }
2160
+ } else
2161
+ s = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
2162
+ return s;
2163
+ }, ft = (e) => {
2164
+ if (de(e))
2165
+ try {
2166
+ e = e();
2167
+ } catch {
2168
+ e = "";
2169
+ }
2170
+ const t = e;
2171
+ return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? jt(e) : "", [
2172
+ e,
2173
+ t
2174
+ ];
2175
+ };
2176
+ let xs = 0;
2177
+ const zt = () => ++xs;
2178
+ async function wn(...e) {
2179
+ const [t, r, n, a] = e, s = Te({
2180
+ populateCache: !0,
2181
+ throwOnError: !0
2182
+ }, typeof a == "boolean" ? {
2183
+ revalidate: a
2184
+ } : a || {});
2185
+ let o = s.populateCache;
2186
+ const i = s.rollbackOnError;
2187
+ let c = s.optimisticData;
2188
+ const m = (l) => typeof i == "function" ? i(l) : i !== !1, f = s.throwOnError;
2189
+ if (de(r)) {
2190
+ const l = r, d = [], p = t.keys();
2191
+ for (const y of p)
2192
+ // Skip the special useSWRInfinite and useSWRSubscription keys.
2193
+ !/^\$(inf|sub)\$/.test(y) && l(t.get(y)._k) && d.push(y);
2194
+ return Promise.all(d.map(u));
2195
+ }
2196
+ return u(r);
2197
+ async function u(l) {
2198
+ const [d] = ft(l);
2199
+ if (!d) return;
2200
+ const [p, y] = Sn(t, d), [w, g, $, U] = le.get(t), K = () => {
2201
+ const A = w[d];
2202
+ return (de(s.revalidate) ? s.revalidate(p().data, l) : s.revalidate !== !1) && (delete $[d], delete U[d], A && A[0]) ? A[0](En).then(() => p().data) : p().data;
2203
+ };
2204
+ if (e.length < 3)
2205
+ return K();
2206
+ let I = n, D;
2207
+ const M = zt();
2208
+ g[d] = [
2209
+ M,
2210
+ 0
2211
+ ];
2212
+ const S = !_(c), v = p(), P = v.data, R = v._c, C = _(R) ? P : R;
2213
+ if (S && (c = de(c) ? c(C, P) : c, y({
2214
+ data: c,
2215
+ _c: C
2216
+ })), de(I))
2217
+ try {
2218
+ I = I(C);
2219
+ } catch (A) {
2220
+ D = A;
2221
+ }
2222
+ if (I && bn(I))
2223
+ if (I = await I.catch((A) => {
2224
+ D = A;
2225
+ }), M !== g[d][0]) {
2226
+ if (D) throw D;
2227
+ return I;
2228
+ } else D && S && m(D) && (o = !0, y({
2229
+ data: C,
2230
+ _c: z
2231
+ }));
2232
+ if (o && !D)
2233
+ if (de(o)) {
2234
+ const A = o(I, C);
2235
+ y({
2236
+ data: A,
2237
+ error: z,
2238
+ _c: z
2239
+ });
2240
+ } else
2241
+ y({
2242
+ data: I,
2243
+ error: z,
2244
+ _c: z
2245
+ });
2246
+ if (g[d][1] = zt(), Promise.resolve(K()).then(() => {
2247
+ y({
2248
+ _c: z
2249
+ });
2250
+ }), D) {
2251
+ if (f) throw D;
2252
+ return;
2253
+ }
2254
+ return I;
2255
+ }
2256
+ }
2257
+ const Pr = (e, t) => {
2258
+ for (const r in e)
2259
+ e[r][0] && e[r][0](t);
2260
+ }, Ps = (e, t) => {
2261
+ if (!le.has(e)) {
2262
+ const r = Te(Ns, t), n = {}, a = wn.bind(z, e);
2263
+ let s = Se;
2264
+ const o = {}, i = (f, u) => {
2265
+ const l = o[f] || [];
2266
+ return o[f] = l, l.push(u), () => l.splice(l.indexOf(u), 1);
2267
+ }, c = (f, u, l) => {
2268
+ e.set(f, u);
2269
+ const d = o[f];
2270
+ if (d)
2271
+ for (const p of d)
2272
+ p(u, l);
2273
+ }, m = () => {
2274
+ if (!le.has(e) && (le.set(e, [
2275
+ n,
2276
+ {},
2277
+ {},
2278
+ {},
2279
+ a,
2280
+ c,
2281
+ i
2282
+ ]), !He)) {
2283
+ const f = r.initFocus(setTimeout.bind(z, Pr.bind(z, n, gn))), u = r.initReconnect(setTimeout.bind(z, Pr.bind(z, n, yn)));
2284
+ s = () => {
2285
+ f && f(), u && u(), le.delete(e);
2286
+ };
2287
+ }
2288
+ };
2289
+ return m(), [
2290
+ e,
2291
+ a,
2292
+ m,
2293
+ s
2294
+ ];
2295
+ }
2296
+ return [
2297
+ e,
2298
+ le.get(e)[4]
2299
+ ];
2300
+ }, Ds = (e, t, r, n, a) => {
2301
+ const s = r.errorRetryCount, o = a.retryCount, i = ~~((Math.random() + 0.5) * (1 << (o < 8 ? o : 8))) * r.errorRetryInterval;
2302
+ !_(s) && o > s || setTimeout(n, i, a);
2303
+ }, Ls = Wt, [nr, $s] = Ps(/* @__PURE__ */ new Map()), Us = Te(
2304
+ {
2305
+ // events
2306
+ onLoadingSlow: Se,
2307
+ onSuccess: Se,
2308
+ onError: Se,
2309
+ onErrorRetry: Ds,
2310
+ onDiscarded: Se,
2311
+ // switches
2312
+ revalidateOnFocus: !0,
2313
+ revalidateOnReconnect: !0,
2314
+ revalidateIfStale: !0,
2315
+ shouldRetryOnError: !0,
2316
+ // timeouts
2317
+ errorRetryInterval: xr ? 1e4 : 5e3,
2318
+ focusThrottleInterval: 5 * 1e3,
2319
+ dedupingInterval: 2 * 1e3,
2320
+ loadingTimeout: xr ? 5e3 : 3e3,
2321
+ // providers
2322
+ compare: Ls,
2323
+ isPaused: () => !1,
2324
+ cache: nr,
2325
+ mutate: $s,
2326
+ fallback: {}
2327
+ },
2328
+ // use web preset by default
2329
+ ks
2330
+ ), Ms = (e, t) => {
2331
+ const r = Te(e, t);
2332
+ if (t) {
2333
+ const { use: n, fallback: a } = e, { use: s, fallback: o } = t;
2334
+ n && s && (r.use = n.concat(s)), a && o && (r.fallback = Te(a, o));
2335
+ }
2336
+ return r;
2337
+ }, Hs = Vr({}), Ks = "$inf$", Tn = Ge && window.__SWR_DEVTOOLS_USE__, Vs = Tn ? window.__SWR_DEVTOOLS_USE__ : [], Ws = () => {
2338
+ Tn && (window.__SWR_DEVTOOLS_REACT__ = Z);
2339
+ }, Gs = (e) => de(e[1]) ? [
2340
+ e[0],
2341
+ e[1],
2342
+ e[2] || {}
2343
+ ] : [
2344
+ e[0],
2345
+ null,
2346
+ (e[1] === null ? e[2] : e[1]) || {}
2347
+ ], Bs = () => Te(Us, Zt(Hs)), _n = (e, t) => {
2348
+ const [r, n] = ft(e), [, , , a] = le.get(nr);
2349
+ if (a[r]) return a[r];
2350
+ const s = t(n);
2351
+ return a[r] = s, s;
2352
+ }, Fs = (e) => (t, r, n) => e(t, r && ((...s) => {
2353
+ const [o] = ft(t), [, , , i] = le.get(nr);
2354
+ if (o.startsWith(Ks))
2355
+ return r(...s);
2356
+ const c = i[o];
2357
+ return _(c) ? r(...s) : (delete i[o], c);
2358
+ }), n), Js = Vs.concat(Fs), Ys = (e) => function(...r) {
2359
+ const n = Bs(), [a, s, o] = Gs(r), i = Ms(n, o);
2360
+ let c = e;
2361
+ const { use: m } = i, f = (m || []).concat(Js);
2362
+ for (let u = f.length; u--; )
2363
+ c = f[u](c);
2364
+ return c(a, s || i.fetcher || null, i);
2365
+ }, js = (e, t, r) => {
2366
+ const n = t[e] || (t[e] = []);
2367
+ return n.push(r), () => {
2368
+ const a = n.indexOf(r);
2369
+ a >= 0 && (n[a] = n[n.length - 1], n.pop());
2370
+ };
2371
+ };
2372
+ Ws();
2373
+ const Lt = Z.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
2374
+ // and emitting an error.
2375
+ // We assume that this is only for the `use(thenable)` case, not `use(context)`.
2376
+ // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
2377
+ ((e) => {
2378
+ switch (e.status) {
2379
+ case "pending":
2380
+ throw e;
2381
+ case "fulfilled":
2382
+ return e.value;
2383
+ case "rejected":
2384
+ throw e.reason;
2385
+ default:
2386
+ throw e.status = "pending", e.then((t) => {
2387
+ e.status = "fulfilled", e.value = t;
2388
+ }, (t) => {
2389
+ e.status = "rejected", e.reason = t;
2390
+ }), e;
2391
+ }
2392
+ }), $t = {
2393
+ dedupe: !0
2394
+ }, zs = (e, t, r) => {
2395
+ const { cache: n, compare: a, suspense: s, fallbackData: o, revalidateOnMount: i, revalidateIfStale: c, refreshInterval: m, refreshWhenHidden: f, refreshWhenOffline: u, keepPreviousData: l } = r, [d, p, y, w] = le.get(n), [g, $] = ft(e), U = x(!1), K = x(!1), I = x(g), D = x(t), M = x(r), S = () => M.current, v = () => S().isVisible() && S().isOnline(), [P, R, C, A] = Sn(n, g), V = x({}).current, ee = _(o) ? _(r.fallback) ? z : r.fallback[g] : o, b = (N, O) => {
2396
+ for (const J in V) {
2397
+ const L = J;
2398
+ if (L === "data") {
2399
+ if (!a(N[L], O[L]) && (!_(N[L]) || !a(Je, O[L])))
2400
+ return !1;
2401
+ } else if (O[L] !== N[L])
2402
+ return !1;
2403
+ }
2404
+ return !0;
2405
+ }, k = Ke(() => {
2406
+ const N = !g || !t ? !1 : _(i) ? S().isPaused() || s ? !1 : c !== !1 : i, O = (j) => {
2407
+ const me = Te(j);
2408
+ return delete me._k, N ? {
2409
+ isValidating: !0,
2410
+ isLoading: !0,
2411
+ ...me
2412
+ } : me;
2413
+ }, J = P(), L = A(), oe = O(J), Ie = J === L ? oe : O(L);
2414
+ let W = oe;
2415
+ return [
2416
+ () => {
2417
+ const j = O(P());
2418
+ return b(j, W) ? (W.data = j.data, W.isLoading = j.isLoading, W.isValidating = j.isValidating, W.error = j.error, W) : (W = j, j);
2419
+ },
2420
+ () => Ie
2421
+ ];
2422
+ }, [
2423
+ n,
2424
+ g
2425
+ ]), T = ws.useSyncExternalStore(re(
2426
+ (N) => C(g, (O, J) => {
2427
+ b(J, O) || N();
2428
+ }),
2429
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2430
+ [
2431
+ n,
2432
+ g
2433
+ ]
2434
+ ), k[0], k[1]), he = !U.current, Et = d[g] && d[g].length > 0, fe = T.data, Q = _(fe) ? ee && bn(ee) ? Lt(ee) : ee : fe, Fe = T.error, bt = x(Q), Je = l ? _(fe) ? _(bt.current) ? Q : bt.current : fe : Q, ir = Et && !_(Fe) ? !1 : he && !_(i) ? i : S().isPaused() ? !1 : s ? _(Q) ? !1 : c : _(Q) || c, cr = !!(g && t && he && ir), $n = _(T.isValidating) ? cr : T.isValidating, Un = _(T.isLoading) ? cr : T.isLoading, Le = re(
2435
+ async (N) => {
2436
+ const O = D.current;
2437
+ if (!g || !O || K.current || S().isPaused())
2438
+ return !1;
2439
+ let J, L, oe = !0;
2440
+ const Ie = N || {}, W = !y[g] || !Ie.dedupe, j = () => Cr ? !K.current && g === I.current && U.current : g === I.current, me = {
2441
+ isValidating: !1,
2442
+ isLoading: !1
2443
+ }, dr = () => {
2444
+ R(me);
2445
+ }, ur = () => {
2446
+ const te = y[g];
2447
+ te && te[1] === L && delete y[g];
2448
+ }, hr = {
2449
+ isValidating: !0
2450
+ };
2451
+ _(P().data) && (hr.isLoading = !0);
2452
+ try {
2453
+ if (W && (R(hr), r.loadingTimeout && _(P().data) && setTimeout(() => {
2454
+ oe && j() && S().onLoadingSlow(g, r);
2455
+ }, r.loadingTimeout), y[g] = [
2456
+ O($),
2457
+ zt()
2458
+ ]), [J, L] = y[g], J = await J, W && setTimeout(ur, r.dedupingInterval), !y[g] || y[g][1] !== L)
2459
+ return W && j() && S().onDiscarded(g), !1;
2460
+ me.error = z;
2461
+ const te = p[g];
2462
+ if (!_(te) && // case 1
2463
+ (L <= te[0] || // case 2
2464
+ L <= te[1] || // case 3
2465
+ te[1] === 0))
2466
+ return dr(), W && j() && S().onDiscarded(g), !1;
2467
+ const pe = P().data;
2468
+ me.data = a(pe, J) ? pe : J, W && j() && S().onSuccess(J, g, r);
2469
+ } catch (te) {
2470
+ ur();
2471
+ const pe = S(), { shouldRetryOnError: St } = pe;
2472
+ pe.isPaused() || (me.error = te, W && j() && (pe.onError(te, g, pe), (St === !0 || de(St) && St(te)) && (!S().revalidateOnFocus || !S().revalidateOnReconnect || v()) && pe.onErrorRetry(te, g, pe, (Mn) => {
2473
+ const wt = d[g];
2474
+ wt && wt[0] && wt[0](Nr, Mn);
2475
+ }, {
2476
+ retryCount: (Ie.retryCount || 0) + 1,
2477
+ dedupe: !0
2478
+ })));
2479
+ }
2480
+ return oe = !1, dr(), !0;
2481
+ },
2482
+ // `setState` is immutable, and `eventsCallback`, `fnArg`, and
2483
+ // `keyValidating` are depending on `key`, so we can exclude them from
2484
+ // the deps array.
2485
+ //
2486
+ // FIXME:
2487
+ // `fn` and `config` might be changed during the lifecycle,
2488
+ // but they might be changed every render like this.
2489
+ // `useSWR('key', () => fetch('/api/'), { suspense: true })`
2490
+ // So we omit the values from the deps array
2491
+ // even though it might cause unexpected behaviors.
2492
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2493
+ [
2494
+ g,
2495
+ n
2496
+ ]
2497
+ ), lr = re(
2498
+ // Use callback to make sure `keyRef.current` returns latest result every time
2499
+ (...N) => wn(n, I.current, ...N),
2500
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2501
+ []
2502
+ );
2503
+ if (xt(() => {
2504
+ D.current = t, M.current = r, _(fe) || (bt.current = fe);
2505
+ }), xt(() => {
2506
+ if (!g) return;
2507
+ const N = Le.bind(z, $t);
2508
+ let O = 0;
2509
+ const L = js(g, d, (oe, Ie = {}) => {
2510
+ if (oe == gn) {
2511
+ const W = Date.now();
2512
+ S().revalidateOnFocus && W > O && v() && (O = W + S().focusThrottleInterval, N());
2513
+ } else if (oe == yn)
2514
+ S().revalidateOnReconnect && v() && N();
2515
+ else {
2516
+ if (oe == En)
2517
+ return Le();
2518
+ if (oe == Nr)
2519
+ return Le(Ie);
2520
+ }
2521
+ });
2522
+ return K.current = !1, I.current = g, U.current = !0, R({
2523
+ _k: $
2524
+ }), ir && (_(Q) || He ? N() : Os(N)), () => {
2525
+ K.current = !0, L();
2526
+ };
2527
+ }, [
2528
+ g
2529
+ ]), xt(() => {
2530
+ let N;
2531
+ function O() {
2532
+ const L = de(m) ? m(P().data) : m;
2533
+ L && N !== -1 && (N = setTimeout(J, L));
2534
+ }
2535
+ function J() {
2536
+ !P().error && (f || S().isVisible()) && (u || S().isOnline()) ? Le($t).then(O) : O();
2537
+ }
2538
+ return O(), () => {
2539
+ N && (clearTimeout(N), N = -1);
2540
+ };
2541
+ }, [
2542
+ m,
2543
+ f,
2544
+ u,
2545
+ g
2546
+ ]), Kn(Je), s && _(Q) && g) {
2547
+ if (!Cr && He)
2548
+ throw new Error("Fallback data is required when using Suspense in SSR.");
2549
+ D.current = t, M.current = r, K.current = !1;
2550
+ const N = w[g];
2551
+ if (!_(N)) {
2552
+ const O = lr(N);
2553
+ Lt(O);
2554
+ }
2555
+ if (_(Fe)) {
2556
+ const O = Le($t);
2557
+ _(Je) || (O.status = "fulfilled", O.value = !0), Lt(O);
2558
+ } else
2559
+ throw Fe;
2560
+ }
2561
+ return {
2562
+ mutate: lr,
2563
+ get data() {
2564
+ return V.data = !0, Je;
2565
+ },
2566
+ get error() {
2567
+ return V.error = !0, Fe;
2568
+ },
2569
+ get isValidating() {
2570
+ return V.isValidating = !0, $n;
2571
+ },
2572
+ get isLoading() {
2573
+ return V.isLoading = !0, Un;
2574
+ }
2575
+ };
2576
+ }, qs = Ys(zs), ye = {
2577
+ GET_LOCATION: `query GetLocation($latitude: Float!, $longitude: Float!) {
2578
+ location(latitude: $latitude, longitude: $longitude) {
2579
+ country
2580
+ state
2581
+ city
2582
+ displayName
2583
+ }
2584
+ }`,
2585
+ GET_CHATS: `query GetChats(
2586
+ $user: String!,
2587
+ $searchString: String,
2588
+ $limit: Float,
2589
+ $direction: String,
2590
+ $truncateSize: Float) {
2591
+ chats(
2592
+ user: $user,
2593
+ searchString: $searchString,
2594
+ limit: $limit,
2595
+ direction: $direction,
2596
+ truncateSize: $truncateSize) {
2597
+ timestamp
2598
+ id
2599
+ model
2600
+ summary
2601
+ messages {
2602
+ content
2603
+ }
2604
+ }
2605
+ }`,
2606
+ GET_CHATS_STATS: `query GetChatsStats($user: String!) {
2607
+ chatsStats(user: $user) {
2608
+ totalChats
2609
+ averageProcessingTimes
2610
+ }
2611
+ }`,
2612
+ GET_CHAT: `query GetChatById($id: String!) {
2613
+ chatById(id: $id) {
2614
+ model
2615
+ provider
2616
+ usage
2617
+ summary
2618
+ messages {
2619
+ content
2620
+ role
2621
+ name
2622
+ processingTime
2623
+ }
2624
+ }
2625
+ }`,
2626
+ DELETE_CHAT: `mutation DeleteChat(
2627
+ $id: String!,
2628
+ $userId: String!) {
2629
+ deleteChat(
2630
+ id: $id,
2631
+ user: $userId) {
2632
+ id
2633
+ }
2634
+ }`,
2635
+ SAVE_CHAT: `mutation SaveChat(
2636
+ $id: String!,
2637
+ $userId: String!,
2638
+ $messages: [MessageIn],
2639
+ $provider: String,
2640
+ $usage: Float,
2641
+ ) {
2642
+ saveChat(
2643
+ id: $id,
2644
+ user: $userId,
2645
+ messages: $messages,
2646
+ provider: $provider,
2647
+ usage: $usage) {
2648
+ id
2649
+ }
2650
+ }`,
2651
+ GET_SERVER_CAPABILITIES: `query GetServerCapabilities {
2652
+ getServerCapabilities {
2653
+ version
2654
+ models
2655
+ providers
2656
+ runningMode
2657
+ plans {
2658
+ name
2659
+ description
2660
+ }
2661
+ }
2662
+ }`,
2663
+ GET_USER_PREFERENCES: `query GetUserPreferences($user: String!) {
2664
+ getUserPreferences(user: $user) {
2665
+ instructions
2666
+ location
2667
+ provider
2668
+ plan
2669
+ tags {
2670
+ enabled
2671
+ slot
2672
+ label
2673
+ content
2674
+ privateChat
2675
+ }
2676
+ }
2677
+ }`,
2678
+ SET_USER_PREFERENCES: `mutation SetUserPreferences(
2679
+ $user: String!,
2680
+ $instructions: String,
2681
+ $location: String,
2682
+ $provider: String,
2683
+ $plan: String,
2684
+ $tags: [TagIn]) {
2685
+ setUserPreferences(
2686
+ user: $user,
2687
+ instructions: $instructions,
2688
+ location: $location,
2689
+ provider: $provider,
2690
+ plan: $plan,
2691
+ tags: $tags)
2692
+ }`
2693
+ }, Be = {
2694
+ GET_LOCATION: {
2695
+ schema: ye.GET_LOCATION,
2696
+ method: "location"
2697
+ },
2698
+ GET_CHATS: {
2699
+ schema: ye.GET_CHATS,
2700
+ method: "chats"
2701
+ },
2702
+ GET_CHATS_STATS: {
2703
+ schema: ye.GET_CHATS_STATS,
2704
+ method: "chatsStats"
2705
+ },
2706
+ GET_CHAT: {
2707
+ schema: ye.GET_CHAT,
2708
+ method: "chatById"
2709
+ },
2710
+ DELETE_CHAT: {
2711
+ schema: ye.DELETE_CHAT,
2712
+ method: "deleteChat"
2713
+ },
2714
+ SAVE_CHAT: {
2715
+ schema: ye.SAVE_CHAT,
2716
+ method: "saveChat"
2717
+ },
2718
+ GET_SERVER_CAPABILITIES: {
2719
+ schema: ye.GET_SERVER_CAPABILITIES,
2720
+ method: "getServerCapabilities"
2721
+ },
2722
+ GET_USER_PREFERENCES: {
2723
+ schema: ye.GET_USER_PREFERENCES,
2724
+ method: "getUserPreferences"
2725
+ },
2726
+ SET_USER_PREFERENCES: {
2727
+ schema: ye.SET_USER_PREFERENCES,
2728
+ method: "setUserPreferences"
2729
+ }
2730
+ }, In = process.env.PUBLIC_SASSY_API_SERVER_URL, Dr = async ({
2731
+ query: e,
2732
+ data: t,
2733
+ headers: r = {}
2734
+ }) => await fetch(`${In}/graphql`, {
2735
+ method: "POST",
2736
+ credentials: "include",
2737
+ headers: {
2738
+ ...r,
2739
+ "Content-Type": "application/json",
2740
+ Accept: "application/json"
2741
+ },
2742
+ body: JSON.stringify({
2743
+ query: e,
2744
+ variables: t
2745
+ })
2746
+ }), qt = async (e) => {
2747
+ var r;
2748
+ const t = (r = e.type) != null && r.data ? e.type.data(e.params) : e.params;
2749
+ try {
2750
+ let n;
2751
+ if (e.noAuth === !0)
2752
+ n = await Dr({
2753
+ query: e.type.schema,
2754
+ data: t
2755
+ });
2756
+ else {
2757
+ const o = `Bearer ${e.accessToken}`;
2758
+ n = await Dr({
2759
+ headers: {
2760
+ authorization: o
2761
+ },
2762
+ query: e.type.schema,
2763
+ data: t
2764
+ });
2765
+ }
2766
+ if (n.status !== 200)
2767
+ return { status: n.status, data: [] };
2768
+ const { data: a, errors: s } = await n.json();
2769
+ return {
2770
+ status: n.status,
2771
+ data: a[e.type.method],
2772
+ errors: s
2773
+ };
2774
+ } catch (n) {
2775
+ return console.error(n), { status: 500, data: [] };
2776
+ }
2777
+ }, sc = async ({
2778
+ accessToken: e,
2779
+ name: t,
2780
+ data: r,
2781
+ method: n = "POST"
2782
+ }) => {
2783
+ const a = `Bearer ${e}`;
2784
+ return await fetch(`${In}/api/${t}`, {
2785
+ method: n,
2786
+ credentials: "include",
2787
+ headers: {
2788
+ "Content-Type": "application/json",
2789
+ authorization: a
2790
+ },
2791
+ body: JSON.stringify(r)
2792
+ });
2793
+ }, oc = async ({
2794
+ provider: e,
2795
+ accessToken: t,
2796
+ username: r
2797
+ }) => {
2798
+ try {
2799
+ await qt({
2800
+ accessToken: t,
2801
+ type: Be.SET_USER_PREFERENCES,
2802
+ params: {
2803
+ user: r,
2804
+ provider: e
2805
+ }
2806
+ });
2807
+ } catch {
2808
+ }
2809
+ }, mt = ({
2810
+ fetcher: e,
2811
+ scope: t,
2812
+ keys: r,
2813
+ swrOptions: n,
2814
+ getAccessToken: a
2815
+ }) => {
2816
+ const { data: s, error: o, isLoading: i, mutate: c } = qs(
2817
+ [t, ...r],
2818
+ (m) => e(m, a),
2819
+ { ...n }
2820
+ );
2821
+ return { data: s, error: o, isLoading: i, mutate: c };
2822
+ }, pt = async (e) => {
2823
+ let t;
2824
+ if (e.noAuth === !0)
2825
+ t = await qt({
2826
+ noAuth: !0,
2827
+ type: e.type,
2828
+ params: e.params
2829
+ });
2830
+ else {
2831
+ const r = await e.getAccessToken();
2832
+ t = await qt({
2833
+ accessToken: r,
2834
+ type: e.type,
2835
+ params: e.params
2836
+ });
2837
+ }
2838
+ if (t.status === 200 && t.errors === void 0)
2839
+ return t.data;
2840
+ throw new Error("An error occurred while fetching the data.");
2841
+ }, Qs = async ([e, t], r) => pt({
2842
+ getAccessToken: r,
2843
+ type: Be.GET_USER_PREFERENCES,
2844
+ params: {
2845
+ user: t
2846
+ }
2847
+ }), ic = ({
2848
+ keys: e,
2849
+ getAccessToken: t,
2850
+ isPaused: r = !1
2851
+ }) => mt({
2852
+ fetcher: Qs,
2853
+ scope: "/preferences",
2854
+ keys: e,
2855
+ swrOptions: {
2856
+ keepPreviousData: !0,
2857
+ revalidateIfStale: r,
2858
+ revalidateOnFocus: r,
2859
+ revalidateOnReconnect: r
2860
+ },
2861
+ getAccessToken: t
2862
+ }), Xs = async ([e, t], r) => pt({
2863
+ getAccessToken: r,
2864
+ type: Be.GET_CHATS_STATS,
2865
+ params: {
2866
+ user: t
2867
+ }
2868
+ }), cc = ({
2869
+ keys: e,
2870
+ getAccessToken: t
2871
+ }) => mt({
2872
+ fetcher: Xs,
2873
+ scope: "/stats",
2874
+ keys: e,
2875
+ swrOptions: {
2876
+ keepPreviousData: !0,
2877
+ dedupingInterval: 1e4,
2878
+ revalidateIfStale: !0,
2879
+ revalidateOnFocus: !1,
2880
+ revalidateOnReconnect: !0
2881
+ },
2882
+ getAccessToken: t
2883
+ }), Rn = async ([e, t, r, n], a) => pt({
2884
+ getAccessToken: a,
2885
+ type: Be.GET_CHATS,
2886
+ params: {
2887
+ user: t,
2888
+ searchString: r,
2889
+ direction: n,
2890
+ limit: 1,
2891
+ truncateSize: 100
2892
+ }
2893
+ }), lc = ({
2894
+ keys: e,
2895
+ getAccessToken: t
2896
+ }) => mt({
2897
+ fetcher: Rn,
2898
+ scope: "/history",
2899
+ keys: e,
2900
+ getAccessToken: t,
2901
+ swrOptions: {
2902
+ keepPreviousData: !0,
2903
+ dedupingInterval: 1e4,
2904
+ revalidateIfStale: !0,
2905
+ revalidateOnFocus: !1,
2906
+ revalidateOnReconnect: !0
2907
+ }
2908
+ }), dc = ({
2909
+ keys: e,
2910
+ getAccessToken: t
2911
+ }) => {
2912
+ _n(["/history", ...e], (r) => Rn(r, t));
2913
+ }, An = async ([e]) => pt({
2914
+ noAuth: !0,
2915
+ type: Be.GET_SERVER_CAPABILITIES
2916
+ }), uc = () => mt({
2917
+ fetcher: An,
2918
+ scope: "/capabilities",
2919
+ keys: [],
2920
+ getAccessToken: () => Promise.resolve("")
2921
+ // No auth required
2922
+ }), Zs = () => {
2923
+ _n(["/capabilities"], (e) => An(e));
2924
+ }, Lr = (e) => Number.isFinite(e) ? e : 0;
2925
+ function eo(e) {
2926
+ return {
2927
+ days: Math.trunc(e / 864e5),
2928
+ hours: Math.trunc(e / 36e5 % 24),
2929
+ minutes: Math.trunc(e / 6e4 % 60),
2930
+ seconds: Math.trunc(e / 1e3 % 60),
2931
+ milliseconds: Math.trunc(e % 1e3),
2932
+ microseconds: Math.trunc(Lr(e * 1e3) % 1e3),
2933
+ nanoseconds: Math.trunc(Lr(e * 1e6) % 1e3)
2934
+ };
2935
+ }
2936
+ function to(e) {
2937
+ return {
2938
+ days: e / 86400000n,
2939
+ hours: e / 3600000n % 24n,
2940
+ minutes: e / 60000n % 60n,
2941
+ seconds: e / 1000n % 60n,
2942
+ milliseconds: e % 1000n,
2943
+ microseconds: 0n,
2944
+ nanoseconds: 0n
2945
+ };
2946
+ }
2947
+ function ro(e) {
2948
+ switch (typeof e) {
2949
+ case "number": {
2950
+ if (Number.isFinite(e))
2951
+ return eo(e);
2952
+ break;
2953
+ }
2954
+ case "bigint":
2955
+ return to(e);
2956
+ }
2957
+ throw new TypeError("Expected a finite number or bigint");
2958
+ }
2959
+ const no = (e) => e === 0 || e === 0n, ao = (e, t) => t === 1 || t === 1n ? e : `${e}s`, so = 1e-7, oo = 24n * 60n * 60n * 1000n;
2960
+ function io(e, t) {
2961
+ const r = typeof e == "bigint";
2962
+ if (!r && !Number.isFinite(e))
2963
+ throw new TypeError("Expected a finite number or bigint");
2964
+ t = { ...t };
2965
+ const n = e < 0 ? "-" : "";
2966
+ e = e < 0 ? -e : e, t.colonNotation && (t.compact = !1, t.formatSubMilliseconds = !1, t.separateMilliseconds = !1, t.verbose = !1), t.compact && (t.unitCount = 1, t.secondsDecimalDigits = 0, t.millisecondsDecimalDigits = 0);
2967
+ let a = [];
2968
+ const s = (f, u) => {
2969
+ const l = Math.floor(f * 10 ** u + so);
2970
+ return (Math.round(l) / 10 ** u).toFixed(u);
2971
+ }, o = (f, u, l, d) => {
2972
+ if (!((a.length === 0 || !t.colonNotation) && no(f) && !(t.colonNotation && l === "m"))) {
2973
+ if (d ?? (d = String(f)), t.colonNotation) {
2974
+ const p = d.includes(".") ? d.split(".")[0].length : d.length, y = a.length > 0 ? 2 : 1;
2975
+ d = "0".repeat(Math.max(0, y - p)) + d;
2976
+ } else
2977
+ d += t.verbose ? " " + ao(u, f) : l;
2978
+ a.push(d);
2979
+ }
2980
+ }, i = ro(e), c = BigInt(i.days);
2981
+ if (t.hideYearAndDays ? o(BigInt(c) * 24n + BigInt(i.hours), "hour", "h") : (t.hideYear ? o(c, "day", "d") : (o(c / 365n, "year", "y"), o(c % 365n, "day", "d")), o(Number(i.hours), "hour", "h")), o(Number(i.minutes), "minute", "m"), !t.hideSeconds)
2982
+ if (t.separateMilliseconds || t.formatSubMilliseconds || !t.colonNotation && e < 1e3) {
2983
+ const f = Number(i.seconds), u = Number(i.milliseconds), l = Number(i.microseconds), d = Number(i.nanoseconds);
2984
+ if (o(f, "second", "s"), t.formatSubMilliseconds)
2985
+ o(u, "millisecond", "ms"), o(l, "microsecond", "µs"), o(d, "nanosecond", "ns");
2986
+ else {
2987
+ const p = u + l / 1e3 + d / 1e6, y = typeof t.millisecondsDecimalDigits == "number" ? t.millisecondsDecimalDigits : 0, w = p >= 1 ? Math.round(p) : Math.ceil(p), g = y ? p.toFixed(y) : w;
2988
+ o(
2989
+ Number.parseFloat(g),
2990
+ "millisecond",
2991
+ "ms",
2992
+ g
2993
+ );
2994
+ }
2995
+ } else {
2996
+ const f = (r ? Number(e % oo) : e) / 1e3 % 60, u = typeof t.secondsDecimalDigits == "number" ? t.secondsDecimalDigits : 1, l = s(f, u), d = t.keepDecimalsOnWholeSeconds ? l : l.replace(/\.0+$/, "");
2997
+ o(Number.parseFloat(d), "second", "s", d);
2998
+ }
2999
+ if (a.length === 0)
3000
+ return n + "0" + (t.verbose ? " milliseconds" : "ms");
3001
+ const m = t.colonNotation ? ":" : " ";
3002
+ return typeof t.unitCount == "number" && (a = a.slice(0, Math.max(t.unitCount, 1))), n + a.join(m);
3003
+ }
3004
+ const co = process.env.NODE_ENV === "production", vn = !co, lo = vn ? "gizmette.local.com" : "gizmette.com", hc = async () => {
3005
+ const e = {
3006
+ /**
3007
+ * A boolean value that indicates the application would
3008
+ * like to receive the best possible results. If true
3009
+ * and if the device is able to provide a more accurate
3010
+ * position, it will do so. Note that this can result in
3011
+ * slower response times or increased power consumption
3012
+ * (with a GPS chip on a mobile device for example). On
3013
+ * the other hand, if false, the device can take the
3014
+ * liberty to save resources by responding more quickly
3015
+ * and/or using less power. Default: false.
3016
+ */
3017
+ enableHighAccuracy: !1,
3018
+ /**
3019
+ * A positive long value representing the maximum length
3020
+ * of time (in milliseconds) the device is allowed to
3021
+ * take in order to return a position. The default value
3022
+ * is Infinity, meaning that getCurrentPosition() won't
3023
+ * return until the position is available.
3024
+ */
3025
+ timeout: 1e4,
3026
+ /**
3027
+ * A positive long value indicating the maximum age in
3028
+ * milliseconds of a possible cached position that is
3029
+ * acceptable to return. If set to 0, it means that the
3030
+ * device cannot use a cached position and must attempt
3031
+ * to retrieve the real current position. If set to
3032
+ * Infinity the device must return a cached position
3033
+ * regardless of its age. Default: 0.
3034
+ */
3035
+ maximumAge: 6e4
3036
+ };
3037
+ return new Promise((t, r) => {
3038
+ var n;
3039
+ (n = navigator == null ? void 0 : navigator.geolocation) == null || n.getCurrentPosition(
3040
+ (a) => {
3041
+ t({
3042
+ latitude: a.coords.latitude,
3043
+ longitude: a.coords.longitude,
3044
+ accuracy: a.coords.accuracy
3045
+ });
3046
+ },
3047
+ (a) => {
3048
+ r(a);
3049
+ },
3050
+ e
3051
+ );
3052
+ });
3053
+ }, fc = (e, t) => t ? Object.keys(t).map((r) => /* @__PURE__ */ h("dl", { className: "my-0", children: /* @__PURE__ */ X("div", { className: "flex items-center justify-between", children: [
3054
+ /* @__PURE__ */ h("dt", { className: "my-1 inline-block font-bold text-copy-dark dark:text-copy-lighter", children: r }),
3055
+ /* @__PURE__ */ h("dd", { className: "my-1 inline-block", children: t[r] })
3056
+ ] }) }, `${e}-${r}`)) : null, mc = new Intl.NumberFormat("en", {
3057
+ style: "decimal",
3058
+ signDisplay: "never",
3059
+ minimumFractionDigits: 0,
3060
+ maximumFractionDigits: 0
3061
+ }), pc = (e) => e > 0 ? io(e, {
3062
+ secondsDecimalDigits: 2,
3063
+ unitCount: 2
3064
+ }) : "N/A", uo = ({
3065
+ isAuthenticated: e,
3066
+ extraClass: t
3067
+ }) => E(
3068
+ "flex-1 overflow-y-auto bg-slate-900 px-4 pb-10 text-base leading-6 text-slate-300 shadow-sm sm:text-base sm:leading-7",
3069
+ e ? "pt-0" : "pt-10",
3070
+ t
3071
+ ), ho = ({
3072
+ extraClass: e
3073
+ } = {}) => E("px-2 sm:px-0", e), gc = (e, t) => t === 1 ? e : `${e}s`, yc = (e, t) => {
3074
+ let r;
3075
+ return (...n) => {
3076
+ window.clearTimeout(r), r = window.setTimeout(() => e(...n), t);
3077
+ };
3078
+ }, fo = () => !!(window != null && window.__VERSINI_CALLISTO_ELECTRON__), mo = () => window.innerWidth < 403, Ec = () => {
3079
+ const e = ["iPhone Simulator", "iPhone"].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document || window.indexedDB !== null, t = /iPhone/.test(navigator.userAgent), r = mo(), n = navigator.maxTouchPoints > 1;
3080
+ return e && t && r && n;
3081
+ }, $r = "av-button", gt = "icon", ar = "button", Qt = "link", po = ({
3082
+ type: e,
3083
+ size: t,
3084
+ labelRight: r,
3085
+ labelLeft: n,
3086
+ align: a,
3087
+ animated: s
3088
+ }) => {
3089
+ const o = "max-h-8 py-0 px-2", i = "max-h-9 h-8 px-3", c = "max-h-12 py-2 px-4";
3090
+ switch (e) {
3091
+ case ar:
3092
+ case Qt:
3093
+ return E({
3094
+ [o]: t === "small",
3095
+ [i]: t === "medium",
3096
+ [c]: t === "large"
3097
+ });
3098
+ case gt:
3099
+ return E("flex items-center", {
3100
+ "justify-center": a === "center",
3101
+ "justify-start": a === "left",
3102
+ "justify-end": a === "right",
3103
+ "h-6 w-6 p-0": t === "small" && !s && !(r || n),
3104
+ "h-6 px-2": t === "small" && !s && (r || n),
3105
+ "h-8 w-8 p-1": t === "medium" && !s && !(r || n),
3106
+ "h-8 px-3": t === "medium" && !s && (r || n),
3107
+ "h-12 w-12 p-2": t === "large" && !s && !(r || n),
3108
+ "h-12 px-4": t === "large" && !s && (r || n),
3109
+ "h-6 py-0": t === "small" && s && !(r || n),
3110
+ "h-6": t === "small" && s && (r || n),
3111
+ "h-8 py-1": t === "medium" && s && !(r || n),
3112
+ "h-8": t === "medium" && s && (r || n),
3113
+ "h-12 py-2": t === "large" && s && !(r || n),
3114
+ "h-12": t === "large" && s && (r || n)
3115
+ });
3116
+ }
3117
+ }, go = ({
3118
+ type: e,
3119
+ size: t,
3120
+ labelRight: r,
3121
+ labelLeft: n
3122
+ }) => {
3123
+ const a = "text-sm font-medium", s = "text-base font-medium", o = "text-lg font-medium";
3124
+ switch (e) {
3125
+ case ar:
3126
+ case Qt:
3127
+ return E({
3128
+ "text-center": e === Qt,
3129
+ [a]: t === "small",
3130
+ [s]: t === "medium",
3131
+ [o]: t === "large"
3132
+ });
3133
+ case gt:
3134
+ return E({
3135
+ [a]: t === "small" && (r || n),
3136
+ [s]: t === "medium" && (r || n),
3137
+ [o]: t === "large" && (r || n)
3138
+ });
3139
+ }
3140
+ }, yo = ({
3141
+ mode: e,
3142
+ noBackground: t,
3143
+ noTruncate: r,
3144
+ variant: n
3145
+ }) => {
3146
+ if (t)
3147
+ return "not-prose";
3148
+ if (n === "primary")
3149
+ return E("not-prose", {
3150
+ truncate: !r,
3151
+ "text-copy-light": e === "dark" || e === "system",
3152
+ "text-copy-lighter": e === "light" || e === "alt-system",
3153
+ "dark:text-copy-lighter": e === "system",
3154
+ "dark:text-copy-light": e === "alt-system"
3155
+ });
3156
+ if (n === "secondary")
3157
+ return E("not-prose", {
3158
+ truncate: !r,
3159
+ "text-copy-light": e === "light" || e === "system",
3160
+ "text-copy-lighter": e === "dark" || e === "alt-system",
3161
+ "dark:text-copy-lighter": e === "alt-system",
3162
+ "dark:text-copy-light": e === "system"
3163
+ });
3164
+ if (n === "danger")
3165
+ return E("not-prose", {
3166
+ truncate: !r,
3167
+ "text-copy-light": e === "dark" || e === "system",
3168
+ "text-copy-lighter": e === "light" || e === "alt-system",
3169
+ "dark:text-copy-lighter": e === "system",
3170
+ "dark:text-copy-light": e === "alt-system"
3171
+ });
3172
+ if (n === "selected")
3173
+ return E("not-prose text-copy-lighter", {
3174
+ truncate: !r
3175
+ });
3176
+ }, Eo = ({
3177
+ mode: e,
3178
+ noBackground: t,
3179
+ variant: r
3180
+ }) => {
3181
+ if (!t) {
3182
+ if (r === "primary")
3183
+ return E({
3184
+ "bg-action-dark": e === "dark",
3185
+ "bg-action-light": e === "light",
3186
+ "bg-action-dark dark:bg-action-light": e === "system",
3187
+ "bg-action-light dark:bg-action-dark": e === "alt-system"
3188
+ });
3189
+ if (r === "secondary")
3190
+ return E({
3191
+ "bg-action-dark": e === "light",
3192
+ "bg-action-light": e === "dark",
3193
+ "bg-action-dark dark:bg-action-light": e === "alt-system",
3194
+ "bg-action-light dark:bg-action-dark": e === "system"
3195
+ });
3196
+ if (r === "danger")
3197
+ return E({
3198
+ "bg-action-danger-dark": e === "dark",
3199
+ "bg-action-danger-light": e === "light",
3200
+ "bg-action-danger-dark dark:bg-action-danger-light": e === "system",
3201
+ "bg-action-danger-light dark:bg-action-danger-dark": e === "alt-system"
3202
+ });
3203
+ if (r === "selected")
3204
+ return "bg-action-selected-dark";
3205
+ }
3206
+ }, bo = ({
3207
+ radius: e
3208
+ }) => E({
3209
+ "rounded-full": e === "large",
3210
+ "rounded-md": e === "medium",
3211
+ "rounded-sm": e === "small"
3212
+ }), So = ({
3213
+ mode: e,
3214
+ disabled: t,
3215
+ variant: r
3216
+ }) => {
3217
+ if (t)
3218
+ return "";
3219
+ if (r === "primary")
3220
+ return E("hover:text-copy-light-hover", {
3221
+ "hover:bg-action-dark-hover": e === "dark",
3222
+ "hover:bg-action-light-hover": e === "light",
3223
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
3224
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
3225
+ });
3226
+ if (r === "secondary")
3227
+ return E("hover:text-copy-light-hover", {
3228
+ "hover:bg-action-dark-hover": e === "light",
3229
+ "hover:bg-action-light-hover": e === "dark",
3230
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
3231
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
3232
+ });
3233
+ if (r === "danger")
3234
+ return E("hover:text-copy-light-hover", {
3235
+ "hover:bg-action-danger-dark-hover": e === "dark",
3236
+ "hover:bg-action-danger-light-hover": e === "light",
3237
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
3238
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
3239
+ });
3240
+ if (r === "selected")
3241
+ return "hover:text-copy-light-hover hover:bg-action-selected-dark-hover";
3242
+ }, wo = ({
3243
+ mode: e,
3244
+ disabled: t,
3245
+ variant: r
3246
+ }) => {
3247
+ if (t)
3248
+ return "";
3249
+ if (r === "primary")
3250
+ return E("active:text-copy-light-active", {
3251
+ "active:bg-action-dark-active": e === "dark",
3252
+ "active:bg-action-light-active": e === "light",
3253
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
3254
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
3255
+ });
3256
+ if (r === "secondary")
3257
+ return E("active:text-copy-light-active", {
3258
+ "active:bg-action-dark-active": e === "light",
3259
+ "active:bg-action-light-active": e === "dark",
3260
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
3261
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
3262
+ });
3263
+ if (r === "danger")
3264
+ return E("active:text-copy-lighter-active", {
3265
+ "active:bg-action-danger-dark-active": e === "dark",
3266
+ "active:bg-action-danger-light-active": e === "light",
3267
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
3268
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
3269
+ });
3270
+ if (r === "selected")
3271
+ return "active:text-copy-lighter-active active:bg-action-selected-dark-active";
3272
+ }, To = ({
3273
+ mode: e,
3274
+ noBorder: t,
3275
+ variant: r
3276
+ }) => {
3277
+ if (t)
3278
+ return "border border-transparent";
3279
+ if (r === "primary")
3280
+ return E("border", {
3281
+ "border-border-dark": e === "dark",
3282
+ "border-border-accent": e === "light",
3283
+ "border-border-dark dark:border-border-accent": e === "system",
3284
+ "border-border-accent dark:border-border-dark": e === "alt-system"
3285
+ });
3286
+ if (r === "secondary")
3287
+ return E("border", {
3288
+ "border-border-dark": e === "light",
3289
+ "border-border-accent": e === "dark",
3290
+ "border-border-dark dark:border-border-accent": e === "alt-system",
3291
+ "border-border-accent dark:border-border-dark": e === "system"
3292
+ });
3293
+ if (r === "danger")
3294
+ return E("border", {
3295
+ "border-border-danger-dark": e === "dark",
3296
+ "border-border-danger-medium": e === "light",
3297
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
3298
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
3299
+ });
3300
+ if (r === "selected")
3301
+ return "border border-border-selected-dark";
3302
+ }, _o = ({
3303
+ focusMode: e
3304
+ }) => E("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
3305
+ "focus:outline-focus-dark": e === "dark",
3306
+ "focus:outline-focus-light": e === "light",
3307
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
3308
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
3309
+ }), Io = ({
3310
+ mode: e,
3311
+ raw: t,
3312
+ iconClassName: r
3313
+ }) => t ? "" : E(
3314
+ {
3315
+ "text-copy-accent-dark": e === "light" || e === "alt-system",
3316
+ "text-copy-light": e === "dark" || e === "system",
3317
+ "dark:text-copy-light": e === "alt-system",
3318
+ "dark:text-copy-accent-dark": e === "system"
3319
+ },
3320
+ r
3321
+ ), Ro = ({
3322
+ animated: e
3323
+ }) => E({
3324
+ "transition-opacity duration-300 ease-in": e
3325
+ }), kn = ({
3326
+ type: e,
3327
+ className: t,
3328
+ raw: r,
3329
+ mode: n,
3330
+ focusMode: a,
3331
+ disabled: s,
3332
+ fullWidth: o,
3333
+ size: i,
3334
+ noBorder: c,
3335
+ labelRight: m,
3336
+ labelLeft: f,
3337
+ noBackground: u,
3338
+ variant: l,
3339
+ noTruncate: d,
3340
+ align: p,
3341
+ radius: y,
3342
+ animated: w
3343
+ }) => (l || (l = "primary"), r ? E($r, t) : E(
3344
+ $r,
3345
+ yo({
3346
+ mode: n,
3347
+ variant: l,
3348
+ noBackground: u,
3349
+ noTruncate: d
3350
+ }),
3351
+ Eo({ mode: n, noBackground: u, variant: l }),
3352
+ bo({ radius: y }),
3353
+ po({
3354
+ type: e,
3355
+ size: i,
3356
+ labelRight: m,
3357
+ labelLeft: f,
3358
+ align: p,
3359
+ animated: w
3360
+ }),
3361
+ go({ type: e, size: i, labelRight: m, labelLeft: f }),
3362
+ To({ mode: n, variant: l, noBorder: c }),
3363
+ _o({ focusMode: a }),
3364
+ So({ mode: n, variant: l, disabled: s }),
3365
+ wo({ mode: n, variant: l, disabled: s }),
3366
+ {
3367
+ "w-full": o,
3368
+ "disabled:cursor-not-allowed disabled:opacity-50": s
3369
+ },
3370
+ E({
3371
+ "transition-[width] duration-300 ease-in-out": e === gt && w
3372
+ }),
3373
+ t
3374
+ )), Ao = (e, t, r) => {
3375
+ var n;
3376
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((n = e == null ? void 0 : e.currentTarget) == null ? void 0 : n.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
3377
+ }, sr = Z.forwardRef((e, t) => {
3378
+ const { onClick: r, noInternalClick: n = !1, ...a } = e;
3379
+ return /* @__PURE__ */ h(
3380
+ "button",
3381
+ {
3382
+ ref: t,
3383
+ onClick: (s) => {
3384
+ Ao(s, n, r);
3385
+ },
3386
+ ...a
3387
+ }
3388
+ );
3389
+ });
3390
+ sr.displayName = "BaseButton";
3391
+ const Nn = Z.forwardRef(
3392
+ ({
3393
+ children: e,
3394
+ disabled: t = !1,
3395
+ mode: r = "system",
3396
+ focusMode: n = "system",
3397
+ fullWidth: a = !1,
3398
+ className: s,
3399
+ size: o = "medium",
3400
+ raw: i = !1,
3401
+ noBorder: c = !1,
3402
+ variant: m = "primary",
3403
+ noTruncate: f = !1,
3404
+ radius: u = "large",
3405
+ ...l
3406
+ }, d) => {
3407
+ const p = kn({
3408
+ type: ar,
3409
+ mode: r,
3410
+ focusMode: n,
3411
+ fullWidth: a,
3412
+ disabled: t,
3413
+ raw: i,
3414
+ className: s,
3415
+ size: o,
3416
+ noBorder: c,
3417
+ variant: m,
3418
+ noTruncate: f,
3419
+ radius: u
3420
+ });
3421
+ return /* @__PURE__ */ h(
3422
+ sr,
3423
+ {
3424
+ ref: d,
3425
+ className: p,
3426
+ disabled: t,
3427
+ ...l,
3428
+ children: e
3429
+ }
3430
+ );
3431
+ }
3432
+ );
3433
+ Nn.displayName = "Button";
3434
+ function vo() {
3435
+ const e = x(!1);
3436
+ return se(() => (e.current = !0, () => {
3437
+ e.current = !1;
3438
+ }), []), re(() => e.current, []);
3439
+ }
3440
+ function ko(e) {
3441
+ return Ke(() => e.every((t) => t == null) ? () => {
3442
+ } : (t) => {
3443
+ e.forEach((r) => {
3444
+ typeof r == "function" ? r(t) : r != null && (r.current = t);
3445
+ });
3446
+ }, e);
3447
+ }
3448
+ const No = {
3449
+ x: 0,
3450
+ y: 0,
3451
+ width: 0,
3452
+ height: 0,
3453
+ top: 0,
3454
+ left: 0,
3455
+ bottom: 0,
3456
+ right: 0
3457
+ };
3458
+ function Ut(e) {
3459
+ const t = vo(), r = x(0), n = x(null), [a, s] = Ee(No), o = Ke(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((i) => {
3460
+ const c = i[0];
3461
+ c && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
3462
+ n.current && t() && s(c.contentRect);
3463
+ }));
3464
+ }), [t]);
3465
+ return se(() => (n.current && (o == null || o.observe(n.current, e)), () => {
3466
+ o == null || o.disconnect(), r.current && cancelAnimationFrame(r.current);
3467
+ }), [o, e]), [n, a];
3468
+ }
3469
+ const Oo = {
3470
+ small: 24,
3471
+ // w-6
3472
+ medium: 32,
3473
+ // w-8
3474
+ large: 48
3475
+ // w-12
3476
+ }, Co = {
3477
+ small: 8 * 2,
3478
+ // px-2 x 2
3479
+ medium: 12 * 2,
3480
+ // px-3 x 2
3481
+ large: 16 * 2
3482
+ // px-4 x 2
3483
+ }, xo = 2, ct = Z.forwardRef(
3484
+ ({
3485
+ children: e,
3486
+ disabled: t = !1,
3487
+ mode: r = "system",
3488
+ focusMode: n = "system",
3489
+ fullWidth: a = !1,
3490
+ className: s,
3491
+ type: o = "button",
3492
+ raw: i = !1,
3493
+ noBorder: c = !1,
3494
+ "aria-label": m,
3495
+ label: f,
3496
+ size: u = "medium",
3497
+ labelRight: l,
3498
+ labelLeft: d,
3499
+ noBackground: p = !1,
3500
+ align: y = "center",
3501
+ radius: w = "large",
3502
+ variant: g = "primary",
3503
+ iconClassName: $,
3504
+ animated: U = !1,
3505
+ ...K
3506
+ }, I) => {
3507
+ const D = kn({
3508
+ type: gt,
3509
+ mode: r,
3510
+ focusMode: n,
3511
+ fullWidth: a,
3512
+ disabled: t,
3513
+ raw: i,
3514
+ className: s,
3515
+ noBorder: c,
3516
+ size: u,
3517
+ labelRight: l,
3518
+ labelLeft: d,
3519
+ noBackground: p,
3520
+ align: y,
3521
+ radius: w,
3522
+ variant: g,
3523
+ animated: U
3524
+ }), M = Io({ mode: r, raw: i, iconClassName: $ }), S = Ro({ animated: U }), [v, P] = Ut(), [R, C] = Ut(), [A, V] = Ut(), ee = x(0), b = x(null), k = ko([I, b]);
3525
+ return Ue(() => {
3526
+ A && A.current && U && (ee.current = V.width + Co[u] + (c ? 0 : xo));
3527
+ }, [V, A, u, c, U]), Ue(() => {
3528
+ b && b.current && U && (l && v && P.width > 0 ? (v.current && (v.current.style.opacity = "100"), b.current.style.width = `${P.width + ee.current}px`) : d && C.width > 0 ? (R.current && (R.current.style.opacity = "100"), b.current.style.width = `${C.width + ee.current}px`) : (v.current && (v.current.style.opacity = "0"), R.current && (R.current.style.opacity = "0"), b.current.style.width = `${Oo[u]}px`));
3529
+ }, [
3530
+ P,
3531
+ l,
3532
+ v,
3533
+ C,
3534
+ d,
3535
+ R,
3536
+ u,
3537
+ U
3538
+ ]), /* @__PURE__ */ X(
3539
+ sr,
3540
+ {
3541
+ ref: k,
3542
+ className: D,
3543
+ disabled: t,
3544
+ type: o,
3545
+ "aria-label": m || f,
3546
+ ...K,
3547
+ children: [
3548
+ /* @__PURE__ */ h(
3549
+ Ur,
3550
+ {
3551
+ label: d,
3552
+ labelRef: R,
3553
+ labelClass: S,
3554
+ labelInnerClass: "pr-2"
3555
+ }
3556
+ ),
3557
+ /* @__PURE__ */ h("span", { ref: A, className: M, children: e }),
3558
+ /* @__PURE__ */ h(
3559
+ Ur,
3560
+ {
3561
+ label: l,
3562
+ labelRef: v,
3563
+ labelClass: S,
3564
+ labelInnerClass: "pl-2"
3565
+ }
3566
+ )
3567
+ ]
3568
+ }
3569
+ );
3570
+ }
3571
+ ), Ur = ({
3572
+ labelRef: e,
3573
+ labelClass: t,
3574
+ label: r,
3575
+ labelInnerClass: n
3576
+ }) => /* @__PURE__ */ h("span", { ref: e, className: t, children: r && /* @__PURE__ */ h("span", { className: n, children: r }) });
3577
+ ct.displayName = "ButtonIcon";
3578
+ /*!
3579
+ @versini/ui-button v4.2.8
3580
+ © 2025 gizmette.com
3581
+ */
3582
+ try {
3583
+ window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
3584
+ version: "4.2.8",
3585
+ buildTime: "02/16/2025 06:39 PM EST",
3586
+ homepage: "https://github.com/aversini/ui-components",
3587
+ license: "MIT"
3588
+ });
3589
+ } catch {
3590
+ }
3591
+ const Po = Z.forwardRef(
3592
+ ({
3593
+ children: e,
3594
+ mode: t = "system",
3595
+ className: r,
3596
+ active: n = !1,
3597
+ ...a
3598
+ }, s) => {
3599
+ const o = n ? E(
3600
+ "relative",
3601
+ "focus-within:static",
3602
+ "focus-within:after:border-transparent",
3603
+ "after:absolute",
3604
+ "after:content-['']",
3605
+ "after:border-b-2",
3606
+ "after:bottom-[-4px]",
3607
+ "after:left-0",
3608
+ "after:right-0",
3609
+ {
3610
+ "after:border-table-dark": t === "dark",
3611
+ "after:border-table-light": t === "light",
3612
+ "after:border-table-dark dark:after:border-table-light": t === "system",
3613
+ "after:border-table-light dark:after:border-table-dark": t === "alt-system"
3614
+ }
3615
+ ) : "";
3616
+ return /* @__PURE__ */ h("div", { className: o, children: /* @__PURE__ */ h(
3617
+ ct,
3618
+ {
3619
+ className: E("justify-center", r),
3620
+ ref: s,
3621
+ mode: t,
3622
+ radius: "small",
3623
+ ...a,
3624
+ children: e
3625
+ }
3626
+ ) });
3627
+ }
3628
+ );
3629
+ Po.displayName = "ButtonSort";
3630
+ /*!
3631
+ @versini/ui-card v3.0.17
3632
+ © 2025 gizmette.com
3633
+ */
3634
+ try {
3635
+ window.__VERSINI_UI_CARD__ || (window.__VERSINI_UI_CARD__ = {
3636
+ version: "3.0.17",
3637
+ buildTime: "02/16/2025 06:39 PM EST",
3638
+ homepage: "https://github.com/aversini/ui-components",
3639
+ license: "MIT"
3640
+ });
3641
+ } catch {
3642
+ }
3643
+ const nt = "av-card";
3644
+ function Do(e) {
3645
+ const t = Gr();
3646
+ return `${e}${t}`;
3647
+ }
3648
+ const Lo = ({
3649
+ className: e,
3650
+ headerClassName: t,
3651
+ bodyClassName: r,
3652
+ footerClassName: n,
3653
+ mode: a,
3654
+ compact: s,
3655
+ noBorder: o
3656
+ }) => {
3657
+ const i = E(
3658
+ nt,
3659
+ "rounded-md",
3660
+ {
3661
+ "border-none": o,
3662
+ "border-2": !o,
3663
+ "p-4": !s,
3664
+ "p-1 sm:p-2": s,
3665
+ "border-border-accent bg-surface-darker text-copy-light": a === "darker",
3666
+ "border-border-accent bg-surface-dark text-copy-light": a === "dark",
3667
+ "border-border-dark bg-surface-lighter text-copy-dark": a === "light",
3668
+ "border-border-dark bg-surface-lighter text-copy-dark dark:border-border-accent dark:bg-surface-dark dark:text-copy-light": a === "system",
3669
+ "border-border-accent bg-surface-dark text-copy-light dark:border-border-dark dark:bg-surface-lighter dark:text-copy-dark": a === "alt-system"
3670
+ },
3671
+ e
3672
+ ), c = t || E(`${nt}__header mt-0 border-b-2`, {
3673
+ "text-copy-light border-border-accent": a === "darker",
3674
+ "border-border-accent": a === "dark",
3675
+ "border-border-medium": a === "light",
3676
+ "border-border-medium dark:border-border-accent": a === "system",
3677
+ "border-border-accent dark:border-border-medium": a === "alt-system",
3678
+ "mb-4": !s,
3679
+ "mb-2": s
3680
+ }), m = E(r), f = n || E(`${nt}__footer pt-2`);
3681
+ return {
3682
+ wrapper: i,
3683
+ header: c,
3684
+ body: m,
3685
+ footer: f
3686
+ };
3687
+ };
3688
+ function $o({
3689
+ id: e,
3690
+ content: t,
3691
+ userAriaLabelledby: r,
3692
+ className: n
3693
+ }) {
3694
+ return typeof t == "string" ? /* @__PURE__ */ h("h2", { id: e, className: n, children: t }) : r ? /* @__PURE__ */ h("div", { className: n, children: t }) : t ? /* @__PURE__ */ h("div", { className: n, id: e, children: t }) : null;
3695
+ }
3696
+ const Uo = ({
3697
+ header: e,
3698
+ headerClassName: t,
3699
+ footer: r,
3700
+ footerClassName: n,
3701
+ children: a,
3702
+ className: s,
3703
+ bodyClassName: o,
3704
+ "aria-labelledby": i,
3705
+ mode: c = "system",
3706
+ compact: m = !1,
3707
+ noBorder: f = !1,
3708
+ ...u
3709
+ }) => {
3710
+ let l = null, d = null;
3711
+ const p = typeof e == "string", y = Do(nt), w = Lo({
3712
+ className: s,
3713
+ headerClassName: t,
3714
+ bodyClassName: o,
3715
+ footerClassName: n,
3716
+ mode: c,
3717
+ compact: m,
3718
+ noBorder: f
3719
+ });
3720
+ return p ? (l = y, d = l) : !p && e && i ? (l = null, d = i) : !p && e && !i ? (l = y, d = l) : (l = null, d = i || null), /* @__PURE__ */ h("div", { className: w.wrapper, children: /* @__PURE__ */ X(
3721
+ "section",
3722
+ {
3723
+ ...d && {
3724
+ "aria-labelledby": d
3725
+ },
3726
+ className: w.body,
3727
+ ...u,
3728
+ children: [
3729
+ /* @__PURE__ */ h(
3730
+ $o,
3731
+ {
3732
+ ...l && { id: l },
3733
+ content: e,
3734
+ className: w.header,
3735
+ userAriaLabelledby: i
3736
+ }
3737
+ ),
3738
+ /* @__PURE__ */ h("div", { children: a }),
3739
+ r ? /* @__PURE__ */ h("div", { className: w.footer, children: r }) : null
3740
+ ]
3741
+ }
3742
+ ) });
3743
+ }, yt = ({
3744
+ children: e,
3745
+ fill: t,
3746
+ viewBox: r,
3747
+ className: n,
3748
+ defaultViewBox: a,
3749
+ size: s,
3750
+ title: o,
3751
+ semantic: i = !1,
3752
+ ...c
3753
+ }) => {
3754
+ const m = E(s, n);
3755
+ return /* @__PURE__ */ X(at, { children: [
3756
+ /* @__PURE__ */ h(
3757
+ "svg",
3758
+ {
3759
+ xmlns: "http://www.w3.org/2000/svg",
3760
+ className: m,
3761
+ viewBox: r || a,
3762
+ fill: t || "currentColor",
3763
+ role: "img",
3764
+ "aria-hidden": !i,
3765
+ focusable: !1,
3766
+ ...c,
3767
+ children: e
3768
+ }
3769
+ ),
3770
+ o && i && /* @__PURE__ */ h("span", { className: "sr-only", children: o })
3771
+ ] });
3772
+ };
3773
+ /*!
3774
+ @versini/ui-svgicon v4.0.7
3775
+ © 2025 gizmette.com
3776
+ */
3777
+ try {
3778
+ window.__VERSINI_UI_SVGICON__ || (window.__VERSINI_UI_SVGICON__ = {
3779
+ version: "4.0.7",
3780
+ buildTime: "01/20/2025 01:49 PM EST",
3781
+ homepage: "https://github.com/aversini/ui-components",
3782
+ license: "MIT"
3783
+ });
3784
+ } catch {
3785
+ }
3786
+ const Mo = ({
3787
+ className: e,
3788
+ viewBox: t,
3789
+ title: r,
3790
+ monotone: n,
3791
+ ...a
3792
+ }) => /* @__PURE__ */ h(
3793
+ yt,
3794
+ {
3795
+ defaultViewBox: "0 0 1200 500",
3796
+ size: "w-full",
3797
+ viewBox: t,
3798
+ className: e,
3799
+ title: r || "Dog",
3800
+ ...a,
3801
+ children: /* @__PURE__ */ h("path", { d: "M927.943 30.81c0-2.381-1.191-5.954-3.573-7.145-7.146-4.763-19.055-1.19-26.2 0-17.864 2.382-34.537 4.764-53.592 4.764-26.2 0-53.591-1.19-79.791-4.764-23.819-3.572-44.064-10.718-69.074-3.572-35.727 9.527-58.355 38.109-57.164 75.028 1.191 21.436-2.382 38.109-9.527 57.164-7.146 17.864-15.482 20.245-32.155 20.245-115.52 0-229.848-1.19-345.367 0h-63.119c-29.773 0-59.546 5.955-89.319 0-21.436-4.763-42.873-15.482-58.355-30.964-3.573-3.572-10.718-14.29-14.29-14.29-4.765 1.19-4.765 15.481-4.765 19.054 0 15.482 5.955 30.964 5.955 46.446s-7.145 28.582-11.91 42.873c-4.763 16.673-4.763 33.346-2.381 50.019 4.764 27.39 9.527 55.973 11.91 84.555 2.381 25.01 2.381 48.828 4.763 73.837 2.382 20.246 3.573 29.773 29.773 33.346 30.964 4.764 30.964-5.955 38.11-26.2 9.527-25.01 17.863-51.21 27.39-76.22 8.337-19.054 15.482-60.736 67.883-40.49 28.582 10.718 58.355 16.672 88.128 25.009 32.155 8.336 65.5 16.673 97.655 22.627 65.501 13.1 132.193 20.246 200.075 23.819 7.146 0 11.91 0 16.673 5.954 17.864 22.628-3.573 63.119 41.682 70.265 40.491 5.954 40.491-22.628 45.255-47.637 2.382-14.291 4.764-27.391 8.337-40.492 1.19-5.954 5.954-11.909 10.718-15.481 55.973-33.346 88.128-98.847 78.6-164.347-1.19-10.719-4.763-21.437-3.572-33.346 2.382-23.819 32.155-33.346 50.018-42.873 22.628-13.1 47.637-25.01 66.692-42.873 13.1-11.91 23.818-27.392 29.773-44.064 3.573-5.955 5.955-14.292 4.764-20.246M737.395 190.395c-2.381 25.01-13.1 36.919-35.727 41.682-40.491 8.337-66.692-19.054-54.783-58.355 8.337-26.2 17.864-51.21 29.773-75.028 11.91-23.818 22.628-23.818 36.919-1.19 17.864 28.581 27.391 59.545 23.818 92.891m38.11-109.564c-7.146 0-13.1-5.955-13.1-13.1 0-7.146 5.954-13.1 13.1-13.1 7.145 0 13.1 5.954 13.1 13.1 0 7.145-5.955 13.1-13.1 13.1" })
3802
+ }
3803
+ ), Ho = ({
3804
+ className: e,
3805
+ viewBox: t,
3806
+ title: r,
3807
+ monotone: n,
3808
+ ...a
3809
+ }) => /* @__PURE__ */ X(
3810
+ yt,
3811
+ {
3812
+ defaultViewBox: "0 0 640 512",
3813
+ size: "size-5",
3814
+ viewBox: t,
3815
+ className: e,
3816
+ title: r || "Hide",
3817
+ ...a,
3818
+ children: [
3819
+ /* @__PURE__ */ h(
3820
+ "path",
3821
+ {
3822
+ d: "M0 256c0 4.2.8 8.4 2.5 12.3C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480c56.1 0 104.4-17.8 144.5-43.2l-71.7-56.5C339.4 392.8 314.6 400 288 400c-79.5 0-144-64.5-144-144 0-14.5 2.1-28.5 6.1-41.7L63.5 146c-29.4 34.7-49.9 70.8-61.1 97.6-1.6 4-2.4 8.2-2.4 12.4M135.2 80.7l71.8 56.2c23.1-15.7 51-24.9 81-24.9 79.5 0 144 64.5 144 144 0 17.7-3.2 34.6-9 50.2 28 22 56.1 44 84.1 65.9 32.3-36.6 54.6-75.4 66.4-103.9 1.6-3.9 2.5-8.1 2.5-12.3s-.8-8.4-2.5-12.3c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32c-60 0-111.1 20.3-152.8 48.7M192 260.1c.3 6.9 1.3 13.8 3.2 20.7 13.7 51.2 66.4 81.6 117.6 67.9 1.9-.5 3.9-1.1 5.7-1.7l-120-94.6c-3.7.8-6.7 3.7-6.5 7.7m92.7-88.4c2.1 6.4 3.3 13.2 3.3 20.3 0 2.7-.2 5.4-.5 8 31.6 24.8 63.2 49.5 94.8 74.3 2.7-13.9 2.4-28.6-1.5-43.2-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7z",
3823
+ opacity: n ? "1" : "0.4"
3824
+ }
3825
+ ),
3826
+ /* @__PURE__ */ h("path", { d: "M5.1 9.2C13.3-1.2 28.4-3.1 38.8 5.1l592 464c10.4 8.2 12.3 23.3 4.1 33.7s-23.3 12.3-33.7 4.1l-592-464C-1.2 34.7-3.1 19.6 5.1 9.2" })
3827
+ ]
3828
+ }
3829
+ ), Ko = ({
3830
+ className: e,
3831
+ viewBox: t,
3832
+ title: r,
3833
+ monotone: n,
3834
+ ...a
3835
+ }) => {
3836
+ const s = n ? "1" : "0.4";
3837
+ return /* @__PURE__ */ X(
3838
+ yt,
3839
+ {
3840
+ defaultViewBox: "0 0 190 190",
3841
+ size: "size-5",
3842
+ viewBox: t,
3843
+ className: e,
3844
+ title: r || "Passkey",
3845
+ ...a,
3846
+ children: [
3847
+ /* @__PURE__ */ h(
3848
+ "path",
3849
+ {
3850
+ d: "M172.32 96.79c0 13.78-8.48 25.5-20.29 29.78l7.14 11.83-10.57 13 10.57 12.71-17.04 22.87-12.01-12.82V125.7c-10.68-4.85-18.15-15.97-18.15-28.91 0-17.4 13.51-31.51 30.18-31.51 16.66 0 30.17 14.11 30.17 31.51m-30.18 4.82c4.02 0 7.28-3.4 7.28-7.6s-3.26-7.61-7.28-7.61-7.28 3.4-7.28 7.61c-.01 4.2 3.26 7.6 7.28 7.6",
3851
+ opacity: s
3852
+ }
3853
+ ),
3854
+ /* @__PURE__ */ h(
3855
+ "path",
3856
+ {
3857
+ d: "M172.41 96.88c0 13.62-8.25 25.23-19.83 29.67l6.58 11.84-9.73 13 9.73 12.71-17.03 23.05v-85.54c4.02 0 7.28-3.41 7.28-7.6 0-4.2-3.26-7.61-7.28-7.61V65.28c16.73 0 30.28 14.15 30.28 31.6",
3858
+ opacity: s
3859
+ }
3860
+ ),
3861
+ /* @__PURE__ */ h("path", { d: "M120.24 131.43c-9.75-8-16.3-20.3-17.2-34.27H50.8c-10.96 0-19.84 9.01-19.84 20.13v25.17c0 5.56 4.44 10.07 9.92 10.07h69.44c5.48 0 9.92-4.51 9.92-10.07zM73.16 91.13c-2.42-.46-4.82-.89-7.11-1.86-8.65-3.63-13.69-10.32-15.32-19.77-1.12-6.47-.59-12.87 2.03-18.92 3.72-8.6 10.39-13.26 19.15-14.84 5.24-.94 10.46-.73 15.5 1.15 7.59 2.82 12.68 8.26 15.03 16.24 2.38 8.05 2.03 16.1-1.56 23.72-3.72 7.96-10.21 12.23-18.42 13.9-.68.14-1.37.27-2.05.41-2.41-.03-4.83-.03-7.25-.03" })
3862
+ ]
3863
+ }
3864
+ );
3865
+ }, Vo = ({
3866
+ className: e,
3867
+ viewBox: t,
3868
+ title: r,
3869
+ monotone: n,
3870
+ ...a
3871
+ }) => /* @__PURE__ */ X(
3872
+ yt,
3873
+ {
3874
+ defaultViewBox: "0 0 576 512",
3875
+ size: "size-5",
3876
+ viewBox: t,
3877
+ className: e,
3878
+ title: r || "Show",
3879
+ ...a,
3880
+ children: [
3881
+ /* @__PURE__ */ h(
3882
+ "path",
3883
+ {
3884
+ d: "M0 256c0 4.2.8 8.4 2.5 12.3C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1 1.6-3.9 2.5-8.1 2.5-12.3s-.8-8.4-2.5-12.3c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32S142.5 68.8 95.4 112.6C48.6 156 17.3 208 2.5 243.7.8 247.6 0 251.8 0 256m432 0a144 144 0 1 1-288 0 144 144 0 1 1 288 0",
3885
+ opacity: n ? "1" : "0.4"
3886
+ }
3887
+ ),
3888
+ /* @__PURE__ */ h("path", { d: "M224 256c35.3 0 64-28.7 64-64 0-7.1-1.2-13.9-3.3-20.3-1.8-5.5 1.6-11.9 7.4-11.7 40.8 1.7 77.5 29.6 88.6 71.1 13.7 51.2-16.7 103.9-67.9 117.6S208.9 332 195.2 280.8c-1.9-6.9-2.9-13.9-3.2-20.7-.3-5.8 6.1-9.2 11.7-7.4 6.4 2.1 13.2 3.3 20.3 3.3" })
3889
+ ]
3890
+ }
3891
+ );
3892
+ /*!
3893
+ @versini/ui-icons v4.6.1
3894
+ © 2025 gizmette.com
3895
+ */
3896
+ try {
3897
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
3898
+ version: "4.6.1",
3899
+ buildTime: "01/21/2025 01:33 PM EST",
3900
+ homepage: "https://github.com/aversini/ui-components",
3901
+ license: "MIT"
3902
+ });
3903
+ } catch {
3904
+ }
3905
+ /*!
3906
+ @versini/ui-main v3.0.11
3907
+ © 2025 gizmette.com
3908
+ */
3909
+ try {
3910
+ window.__VERSINI_UI_MAIN__ || (window.__VERSINI_UI_MAIN__ = {
3911
+ version: "3.0.11",
3912
+ buildTime: "02/16/2025 07:04 PM EST",
3913
+ homepage: "https://github.com/aversini/ui-components",
3914
+ license: "MIT"
3915
+ });
3916
+ } catch {
3917
+ }
3918
+ const Wo = "av-main", Go = ({
3919
+ children: e,
3920
+ className: t,
3921
+ raw: r = !1,
3922
+ noMargin: n = !1,
3923
+ noPadding: a = !1,
3924
+ ...s
3925
+ }) => {
3926
+ const o = E(
3927
+ Wo,
3928
+ {
3929
+ "mt-2 sm:mt-3": !r && !n,
3930
+ "p-2": !r && !a,
3931
+ "flex w-full flex-col md:mx-auto md:max-w-4xl": !r
3932
+ },
3933
+ t
3934
+ );
3935
+ return /* @__PURE__ */ h("main", { className: o, ...s, children: e });
3936
+ }, Bo = "av-flexgrid", tt = "av-flexgrid-item", lt = 0.25, Xt = Z.createContext({
3937
+ columnGap: 0,
3938
+ rowGap: 0
3939
+ }), Fo = ({
3940
+ children: e,
3941
+ className: t,
3942
+ columnGap: r = 1,
3943
+ rowGap: n = 0,
3944
+ height: a = "auto",
3945
+ width: s = "auto",
3946
+ direction: o = "row",
3947
+ alignHorizontal: i = "normal",
3948
+ alignVertical: c = "normal",
3949
+ ...m
3950
+ }) => {
3951
+ const f = {
3952
+ flexDirection: o,
3953
+ justifyContent: i,
3954
+ alignItems: c,
3955
+ height: a,
3956
+ width: s,
3957
+ /**
3958
+ * Trick to account for the extra space taken
3959
+ * by the columnGap and rowGap that will be applied
3960
+ * to all FlexgridItems (see context and paddings).
3961
+ */
3962
+ marginLeft: r * -1 * lt + "rem",
3963
+ marginTop: n * -1 * lt + "rem"
3964
+ }, u = E(
3965
+ Bo,
3966
+ "box-border flex flex-wrap"
3967
+ ), l = { columnGap: r, rowGap: n };
3968
+ return t ? /* @__PURE__ */ h("div", { className: t, children: /* @__PURE__ */ h("div", { className: u, style: f, ...m, children: /* @__PURE__ */ h(Xt.Provider, { value: l, children: e }) }) }) : /* @__PURE__ */ h("div", { className: u, style: f, ...m, children: /* @__PURE__ */ h(Xt.Provider, { value: l, children: e }) });
3969
+ }, Mt = (e, t) => E({
3970
+ "basis-1/12": e === 1 && !t,
3971
+ "sm:basis-1/12": e === 1 && t === "sm",
3972
+ "md:basis-1/12": e === 1 && t === "md",
3973
+ "lg:basis-1/12": e === 1 && t === "lg",
3974
+ "xl:basis-1/12": e === 1 && t === "xl",
3975
+ "2xl:basis-1/12": e === 1 && t === "2xl",
3976
+ "basis-2/12": e === 2 && !t,
3977
+ "sm:basis-2/12": e === 2 && t === "sm",
3978
+ "md:basis-2/12": e === 2 && t === "md",
3979
+ "lg:basis-2/12": e === 2 && t === "lg",
3980
+ "xl:basis-2/12": e === 2 && t === "xl",
3981
+ "2xl:basis-2/12": e === 2 && t === "2xl",
3982
+ "basis-3/12": e === 3 && !t,
3983
+ "sm:basis-3/12": e === 3 && t === "sm",
3984
+ "md:basis-3/12": e === 3 && t === "md",
3985
+ "lg:basis-3/12": e === 3 && t === "lg",
3986
+ "xl:basis-3/12": e === 3 && t === "xl",
3987
+ "2xl:basis-3/12": e === 3 && t === "2xl",
3988
+ "basis-4/12": e === 4 && !t,
3989
+ "sm:basis-4/12": e === 4 && t === "sm",
3990
+ "md:basis-4/12": e === 4 && t === "md",
3991
+ "lg:basis-4/12": e === 4 && t === "lg",
3992
+ "xl:basis-4/12": e === 4 && t === "xl",
3993
+ "2xl:basis-4/12": e === 4 && t === "2xl",
3994
+ "basis-5/12": e === 5 && !t,
3995
+ "sm:basis-5/12": e === 5 && t === "sm",
3996
+ "md:basis-5/12": e === 5 && t === "md",
3997
+ "lg:basis-5/12": e === 5 && t === "lg",
3998
+ "xl:basis-5/12": e === 5 && t === "xl",
3999
+ "2xl:basis-5/12": e === 5 && t === "2xl",
4000
+ "basis-6/12": e === 6 && !t,
4001
+ "sm:basis-6/12": e === 6 && t === "sm",
4002
+ "md:basis-6/12": e === 6 && t === "md",
4003
+ "lg:basis-6/12": e === 6 && t === "lg",
4004
+ "xl:basis-6/12": e === 6 && t === "xl",
4005
+ "2xl:basis-6/12": e === 6 && t === "2xl",
4006
+ "basis-7/12": e === 7 && !t,
4007
+ "sm:basis-7/12": e === 7 && t === "sm",
4008
+ "md:basis-7/12": e === 7 && t === "md",
4009
+ "lg:basis-7/12": e === 7 && t === "lg",
4010
+ "xl:basis-7/12": e === 7 && t === "xl",
4011
+ "2xl:basis-7/12": e === 7 && t === "2xl",
4012
+ "basis-8/12": e === 8 && !t,
4013
+ "sm:basis-8/12": e === 8 && t === "sm",
4014
+ "md:basis-8/12": e === 8 && t === "md",
4015
+ "lg:basis-8/12": e === 8 && t === "lg",
4016
+ "xl:basis-8/12": e === 8 && t === "xl",
4017
+ "2xl:basis-8/12": e === 8 && t === "2xl",
4018
+ "basis-9/12": e === 9 && !t,
4019
+ "sm:basis-9/12": e === 9 && t === "sm",
4020
+ "md:basis-9/12": e === 9 && t === "md",
4021
+ "lg:basis-9/12": e === 9 && t === "lg",
4022
+ "xl:basis-9/12": e === 9 && t === "xl",
4023
+ "2xl:basis-9/12": e === 9 && t === "2xl",
4024
+ "basis-10/12": e === 10 && !t,
4025
+ "sm:basis-10/12": e === 10 && t === "sm",
4026
+ "md:basis-10/12": e === 10 && t === "md",
4027
+ "lg:basis-10/12": e === 10 && t === "lg",
4028
+ "xl:basis-10/12": e === 10 && t === "xl",
4029
+ "2xl:basis-10/12": e === 10 && t === "2xl",
4030
+ "basis-11/12": e === 11 && !t,
4031
+ "sm:basis-11/12": e === 11 && t === "sm",
4032
+ "md:basis-11/12": e === 11 && t === "md",
4033
+ "lg:basis-11/12": e === 11 && t === "lg",
4034
+ "xl:basis-11/12": e === 11 && t === "xl",
4035
+ "2xl:basis-11/12": e === 11 && t === "2xl",
4036
+ "basis-full": e === 12 && !t,
4037
+ "sm:basis-full": e === 12 && t === "sm",
4038
+ "md:basis-full": e === 12 && t === "md",
4039
+ "lg:basis-full": e === 12 && t === "lg",
4040
+ "xl:basis-full": e === 12 && t === "xl",
4041
+ "2xl:basis-full": e === 12 && t === "2xl"
4042
+ }), Jo = ({
4043
+ className: e,
4044
+ span: t
4045
+ }) => {
4046
+ if (!t)
4047
+ return E(e, tt, "box-border basis-auto");
4048
+ if (typeof t == "number")
4049
+ return E(e, tt, "box-border max-w-full", {
4050
+ [`${Mt(t)}`]: !0
4051
+ });
4052
+ if (typeof t == "string")
4053
+ return E(e, tt, "box-border basis-auto", {
4054
+ "max-w-full grow": t === "auto"
4055
+ });
4056
+ if (typeof t == "object") {
4057
+ const r = Object.entries(t).map(([n, a]) => n === "fallback" ? Mt(a) : Mt(a, n));
4058
+ return E(
4059
+ e,
4060
+ tt,
4061
+ "box-border",
4062
+ r
4063
+ );
4064
+ }
4065
+ }, _e = ({
4066
+ children: e,
4067
+ className: t,
4068
+ span: r,
4069
+ ...n
4070
+ }) => {
4071
+ const { columnGap: a, rowGap: s } = Zt(Xt), o = {
4072
+ paddingLeft: a * lt + "rem",
4073
+ paddingTop: s * lt + "rem"
4074
+ }, i = Jo({
4075
+ className: t,
4076
+ span: r
4077
+ });
4078
+ return /* @__PURE__ */ h("div", { className: i, style: o, ...n, children: e });
4079
+ };
4080
+ /*!
4081
+ @versini/ui-system v3.0.9
4082
+ © 2025 gizmette.com
4083
+ */
4084
+ try {
4085
+ window.__VERSINI_UI_SYSTEM__ || (window.__VERSINI_UI_SYSTEM__ = {
4086
+ version: "3.0.9",
4087
+ buildTime: "02/16/2025 06:39 PM EST",
4088
+ homepage: "https://github.com/aversini/ui-components",
4089
+ license: "MIT"
4090
+ });
4091
+ } catch {
4092
+ }
4093
+ const On = "av-text-input", Yo = "av-text-input-wrapper", Ht = "av-text-input-helper-text";
4094
+ function jo() {
4095
+ const e = x(!1);
4096
+ return se(() => (e.current = !0, () => {
4097
+ e.current = !1;
4098
+ }), []), re(() => e.current, []);
4099
+ }
4100
+ const zo = {
4101
+ x: 0,
4102
+ y: 0,
4103
+ width: 0,
4104
+ height: 0,
4105
+ top: 0,
4106
+ left: 0,
4107
+ bottom: 0,
4108
+ right: 0
4109
+ };
4110
+ function qo(e) {
4111
+ const t = jo(), r = x(0), n = x(null), [a, s] = Ee(zo), o = Ke(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((i) => {
4112
+ const c = i[0];
4113
+ c && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
4114
+ n.current && t() && s(c.contentRect);
4115
+ }));
4116
+ }), [t]);
4117
+ return se(() => (n.current && (o == null || o.observe(n.current, e)), () => {
4118
+ o == null || o.disconnect(), r.current && cancelAnimationFrame(r.current);
4119
+ }), [o, e]), [n, a];
4120
+ }
4121
+ function Qo(e) {
4122
+ const t = Gr();
4123
+ if (!e)
4124
+ return t;
4125
+ if (typeof e == "number" || typeof e == "string")
4126
+ return `${e}${t}`;
4127
+ if (typeof e == "object") {
4128
+ const { id: r, prefix: n = "" } = e;
4129
+ return typeof r == "number" || typeof r == "string" ? `${n}${r}` : `${n}${t}`;
4130
+ }
4131
+ }
4132
+ const Cn = "SET_ANNOUNCEMENT", xn = "CLEAR_ANNOUNCEMENT", Xo = {
4133
+ alert: null,
4134
+ alertdialog: null,
4135
+ log: "polite",
4136
+ marquee: null,
4137
+ progressbar: null,
4138
+ status: "polite",
4139
+ timer: "assertive"
4140
+ }, Zo = (e, t) => {
4141
+ switch (t == null ? void 0 : t.type) {
4142
+ case Cn:
4143
+ return {
4144
+ ...e,
4145
+ announcement: t.payload
4146
+ };
4147
+ case xn:
4148
+ return {
4149
+ ...e,
4150
+ announcement: null
4151
+ };
4152
+ default:
4153
+ return e;
4154
+ }
4155
+ }, ei = ({
4156
+ onAnnouncementClear: e,
4157
+ dispatch: t
4158
+ }) => {
4159
+ t({
4160
+ type: xn
4161
+ }), typeof e == "function" && e();
4162
+ }, Mr = ({
4163
+ children: e,
4164
+ clearAnnouncementDelay: t,
4165
+ clearAnnouncementTimeoutRef: r,
4166
+ onAnnouncementClear: n,
4167
+ dispatch: a
4168
+ }) => {
4169
+ clearTimeout(r.current), e !== null && a({
4170
+ type: Cn,
4171
+ payload: e
4172
+ }), t && (r.current = setTimeout(
4173
+ () => ei({
4174
+ onAnnouncementClear: n,
4175
+ dispatch: a
4176
+ }),
4177
+ t
4178
+ ));
4179
+ }, ti = ({
4180
+ children: e,
4181
+ announcementTimeoutRef: t,
4182
+ announcementDelay: r,
4183
+ clearAnnouncementDelay: n,
4184
+ clearAnnouncementTimeoutRef: a,
4185
+ onAnnouncementClear: s,
4186
+ dispatch: o
4187
+ }) => {
4188
+ clearTimeout(t.current), r ? t.current = setTimeout(Mr, r, {
4189
+ children: e,
4190
+ clearAnnouncementDelay: n,
4191
+ clearAnnouncementTimeoutRef: a,
4192
+ onAnnouncementClear: s,
4193
+ dispatch: o
4194
+ }) : Mr({
4195
+ children: e,
4196
+ clearAnnouncementDelay: n,
4197
+ clearAnnouncementTimeoutRef: a,
4198
+ onAnnouncementClear: s,
4199
+ dispatch: o
4200
+ });
4201
+ };
4202
+ function Pn({
4203
+ children: e,
4204
+ className: t,
4205
+ politeness: r,
4206
+ role: n = null,
4207
+ announcementDelay: a,
4208
+ clearAnnouncementDelay: s,
4209
+ onAnnouncementClear: o,
4210
+ visible: i,
4211
+ ...c
4212
+ }) {
4213
+ const m = x(null), f = x(null), [u, l] = Wr(Zo, {
4214
+ announcement: null
4215
+ });
4216
+ let d = r;
4217
+ typeof d > "u" && (d = n ? Xo[n] : "assertive"), se(() => {
4218
+ ti({
4219
+ announcementTimeoutRef: m,
4220
+ announcementDelay: a,
4221
+ children: e,
4222
+ clearAnnouncementDelay: s,
4223
+ clearAnnouncementTimeoutRef: f,
4224
+ onAnnouncementClear: o,
4225
+ dispatch: l
4226
+ });
4227
+ }, [
4228
+ e,
4229
+ a,
4230
+ s,
4231
+ o
4232
+ ]);
4233
+ const p = E(t, {
4234
+ "sr-only": !i
4235
+ });
4236
+ return /* @__PURE__ */ h(
4237
+ "div",
4238
+ {
4239
+ "aria-live": d,
4240
+ ...n && { role: n },
4241
+ className: p,
4242
+ ...c,
4243
+ children: u.announcement
4244
+ }
4245
+ );
4246
+ }
4247
+ /*!
4248
+ @versini/ui-liveregion v1.3.9
4249
+ © 2025 gizmette.com
4250
+ */
4251
+ try {
4252
+ window.__VERSINI_UI_LIVEREGION__ || (window.__VERSINI_UI_LIVEREGION__ = {
4253
+ version: "1.3.9",
4254
+ buildTime: "02/16/2025 06:39 PM EST",
4255
+ homepage: "https://github.com/aversini/ui-components",
4256
+ license: "MIT"
4257
+ });
4258
+ } catch {
4259
+ }
4260
+ const ri = ({
4261
+ mode: e
4262
+ }) => E({
4263
+ "bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
4264
+ "bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
4265
+ "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
4266
+ "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
4267
+ }), ni = ({
4268
+ focusMode: e
4269
+ }) => E("focus:outline focus:outline-2 focus:outline-offset-2", {
4270
+ "focus:outline-focus-dark": e === "dark",
4271
+ "focus:outline-focus-light": e === "light",
4272
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
4273
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
4274
+ }), ai = ({
4275
+ noBorder: e,
4276
+ error: t
4277
+ }) => E("border-2", {
4278
+ "border-border-dark": !e && !t,
4279
+ "focus:border-border-dark": !e && t,
4280
+ "border-border-error-dark": !e && t,
4281
+ "border-transparent": e
4282
+ }), si = ({
4283
+ disabled: e,
4284
+ raw: t,
4285
+ error: r,
4286
+ mode: n
4287
+ }) => {
4288
+ if (t)
4289
+ return "";
4290
+ if (e)
4291
+ return E("absolute px-2 cursor-not-allowed opacity-50 font-medium");
4292
+ if (!r)
4293
+ return E("absolute px-2 cursor-text font-medium", {
4294
+ "text-copy-lighter": n === "dark",
4295
+ "text-copy-dark": n === "light",
4296
+ "text-copy-dark dark:text-copy-lighter": n === "system",
4297
+ "text-copy-lighter dark:text-copy-dark": n === "alt-system"
4298
+ });
4299
+ if (r)
4300
+ return E("absolute px-2 cursor-text font-medium", {
4301
+ "text-copy-lighter": n === "dark",
4302
+ "text-copy-error-dark": n === "light",
4303
+ "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": n === "system",
4304
+ "text-copy-lighter dark:text-copy-error-dark": n === "alt-system"
4305
+ });
4306
+ }, oi = ({
4307
+ error: e,
4308
+ raw: t,
4309
+ mode: r,
4310
+ disabled: n
4311
+ }) => {
4312
+ if (t)
4313
+ return "";
4314
+ if (n)
4315
+ return E(
4316
+ Ht,
4317
+ "absolute px-2 cursor-not-allowed opacity-50 font-medium"
4318
+ );
4319
+ if (!e)
4320
+ return E(Ht, "absolute px-2 font-medium", {
4321
+ "text-copy-lighter": r === "dark",
4322
+ "text-copy-dark": r === "light",
4323
+ "text-copy-dark dark:text-copy-lighter": r === "system",
4324
+ "text-copy-lighter dark:text-copy-dark": r === "alt-system"
4325
+ });
4326
+ if (e)
4327
+ return E(Ht, "absolute px-2 font-medium", {
4328
+ "text-copy-error-light bg-surface-darker": r === "dark",
4329
+ "text-copy-error-dark": r === "light",
4330
+ "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": r === "system",
4331
+ "dark:text-copy-error-dark text-copy-error-light bg-surface-darker": r === "alt-system"
4332
+ });
4333
+ }, ii = ({
4334
+ className: e,
4335
+ inputClassName: t,
4336
+ raw: r,
4337
+ disabled: n,
4338
+ noBorder: a,
4339
+ error: s,
4340
+ mode: o,
4341
+ focusMode: i,
4342
+ size: c,
4343
+ rightElementClassName: m
4344
+ }) => {
4345
+ const f = r ? e : E(
4346
+ "relative flex w-full flex-col justify-center",
4347
+ Yo,
4348
+ e
4349
+ );
4350
+ let u = "";
4351
+ switch (c) {
4352
+ case "xs":
4353
+ u = "h-8";
4354
+ break;
4355
+ case "sm":
4356
+ u = "h-10";
4357
+ break;
4358
+ case "lg":
4359
+ u = "h-14";
4360
+ break;
4361
+ case "xl":
4362
+ u = "h-16";
4363
+ break;
4364
+ default:
4365
+ u = "h-12";
4366
+ break;
4367
+ }
4368
+ const l = r ? E(t) : E(
4369
+ On,
4370
+ u,
4371
+ "rounded-md text-base px-4",
4372
+ ri({ mode: o }),
4373
+ ni({ focusMode: i }),
4374
+ ai({ noBorder: a, error: s }),
4375
+ {
4376
+ "disabled:cursor-not-allowed disabled:opacity-50": n
4377
+ },
4378
+ t
4379
+ ), d = r ? void 0 : "sr-only", p = si({
4380
+ disabled: n,
4381
+ raw: r,
4382
+ error: s,
4383
+ mode: o
4384
+ }), y = oi({
4385
+ error: s,
4386
+ raw: r,
4387
+ mode: o,
4388
+ disabled: n
4389
+ }), w = r ? void 0 : E("absolute right-3", m);
4390
+ return {
4391
+ wrapper: f,
4392
+ input: l,
4393
+ accessibleLabel: d,
4394
+ visibleLabel: p,
4395
+ helperText: y,
4396
+ rightElement: w
4397
+ };
4398
+ }, or = Z.forwardRef(
4399
+ ({
4400
+ id: e,
4401
+ name: t,
4402
+ label: r,
4403
+ error: n = !1,
4404
+ raw: a = !1,
4405
+ className: s,
4406
+ inputClassName: o,
4407
+ mode: i = "system",
4408
+ focusMode: c = "system",
4409
+ disabled: m = !1,
4410
+ noBorder: f = !1,
4411
+ labelId: u,
4412
+ labelHidden: l = !1,
4413
+ type: d = "text",
4414
+ helperText: p = "",
4415
+ rightElement: y,
4416
+ rightElementClassName: w,
4417
+ size: g = "md",
4418
+ ...$
4419
+ }, U) => {
4420
+ const [K, I] = qo(), [D, M] = Ee(0), S = Qo({ id: e, prefix: `${On}-` }), v = `${t} error, ${p}`, P = x(null), R = x(null), C = {
4421
+ xs: { label: "-25px", helperText: "30px" },
4422
+ sm: { label: "-29px", helperText: "34px" },
4423
+ md: { label: "-33px", helperText: "38px" },
4424
+ lg: { label: "-15px", helperText: "22px" },
4425
+ xl: { label: "-19px", helperText: "25px" }
4426
+ }, A = ii({
4427
+ className: s,
4428
+ inputClassName: o,
4429
+ error: n,
4430
+ raw: a,
4431
+ focusMode: c,
4432
+ disabled: m,
4433
+ noBorder: f,
4434
+ mode: i,
4435
+ size: g,
4436
+ rightElementClassName: w
4437
+ });
4438
+ return Ue(() => {
4439
+ I && I.width && M(I.width + 18 + 10);
4440
+ }, [I]), Ue(() => {
4441
+ var V, ee;
4442
+ const { label: b, helperText: k } = C[g];
4443
+ (V = P == null ? void 0 : P.current) == null || V.style.setProperty("--av-text-input-label", b), (ee = R == null ? void 0 : R.current) == null || ee.style.setProperty(
4444
+ "--av-text-input-helper-text",
4445
+ k
4446
+ );
4447
+ }, [g]), /* @__PURE__ */ X("div", { className: A.wrapper, children: [
4448
+ /* @__PURE__ */ h(
4449
+ "label",
4450
+ {
4451
+ htmlFor: S,
4452
+ id: u,
4453
+ className: A.accessibleLabel,
4454
+ children: r
4455
+ }
4456
+ ),
4457
+ /* @__PURE__ */ h(
4458
+ "input",
4459
+ {
4460
+ ref: U,
4461
+ id: S,
4462
+ name: t,
4463
+ type: d,
4464
+ disabled: m,
4465
+ placeholder: a ? void 0 : " ",
4466
+ className: A.input,
4467
+ ...p && { "aria-describedby": `${S}-helper` },
4468
+ ...n && { "aria-invalid": "true" },
4469
+ ...y && !a && { style: { paddingRight: D } },
4470
+ ...$
4471
+ }
4472
+ ),
4473
+ !a && !l && /* @__PURE__ */ h(
4474
+ "label",
4475
+ {
4476
+ ref: P,
4477
+ "aria-hidden": !0,
4478
+ htmlFor: S,
4479
+ className: A.visibleLabel,
4480
+ children: r
4481
+ }
4482
+ ),
4483
+ p && /* @__PURE__ */ h(
4484
+ "div",
4485
+ {
4486
+ ref: R,
4487
+ id: `${S}-helper`,
4488
+ className: A.helperText,
4489
+ children: p
4490
+ }
4491
+ ),
4492
+ y && /* @__PURE__ */ h(
4493
+ "div",
4494
+ {
4495
+ ref: K,
4496
+ className: A.rightElement,
4497
+ children: y
4498
+ }
4499
+ ),
4500
+ n && p && /* @__PURE__ */ h(Pn, { politeness: "polite", clearAnnouncementDelay: 500, children: v })
4501
+ ] });
4502
+ }
4503
+ );
4504
+ or.displayName = "TextInput";
4505
+ function ci(e) {
4506
+ return Ke(() => e.every((t) => t == null) ? () => {
4507
+ } : (t) => {
4508
+ e.forEach((r) => {
4509
+ typeof r == "function" ? r(t) : r != null && (r.current = t);
4510
+ });
4511
+ }, e);
4512
+ }
4513
+ const li = 500, di = 5e3, ui = 2e4, Dn = Z.forwardRef(
4514
+ ({
4515
+ name: e,
4516
+ disabled: t,
4517
+ label: r,
4518
+ labelHidden: n,
4519
+ onMaskChange: a,
4520
+ onChange: s,
4521
+ onBlur: o,
4522
+ onFocus: i,
4523
+ onTextInputMaskBlur: c,
4524
+ rightElement: m,
4525
+ ...f
4526
+ }, u) => {
4527
+ const [l, d] = Ee(!0), [p, y] = Ee({
4528
+ message: null,
4529
+ politeness: null
4530
+ }), w = x(!0), g = x(null), $ = x(null), U = ci([u, $]), K = l ? "Show" : "Hide", I = () => {
4531
+ g.current && clearTimeout(g.current), w.current || (g.current = setTimeout(() => {
4532
+ w.current = !0, d(!0), y({
4533
+ announcementTimeout: di,
4534
+ politeness: "polite",
4535
+ message: `${r} hiding characters`
4536
+ }), a && a(!0);
4537
+ }, ui));
4538
+ }, D = (R) => {
4539
+ R.preventDefault();
4540
+ const C = !w.current;
4541
+ w.current = C, I(), d(C), y({
4542
+ announcementTimeout: li,
4543
+ politeness: "assertive",
4544
+ message: C ? "Characters hidden" : "Characters showing"
4545
+ }), a && a(C);
4546
+ }, M = (R) => {
4547
+ var C;
4548
+ const { relatedTarget: A } = R, V = (C = $.current) == null ? void 0 : C.parentElement;
4549
+ V != null && V.contains(A) || c && c();
4550
+ }, S = (R) => {
4551
+ I(), o && o(R), M(R);
4552
+ }, v = (R) => {
4553
+ I(), i && i(R);
4554
+ }, P = (R) => {
4555
+ I(), s && s(R);
4556
+ };
4557
+ return se(() => () => {
4558
+ g.current && clearTimeout(g.current);
4559
+ }, []), /* @__PURE__ */ X(at, { children: [
4560
+ /* @__PURE__ */ h(
4561
+ or,
4562
+ {
4563
+ ref: U,
4564
+ name: e,
4565
+ label: r,
4566
+ labelHidden: n,
4567
+ type: l ? "password" : "text",
4568
+ disabled: t,
4569
+ onBlur: S,
4570
+ onFocus: v,
4571
+ onChange: P,
4572
+ rightElement: Z.cloneElement(m, {
4573
+ ref: u,
4574
+ label: K,
4575
+ onClick: D,
4576
+ onBlur: M,
4577
+ disabled: t
4578
+ }),
4579
+ ...f
4580
+ }
4581
+ ),
4582
+ /* @__PURE__ */ h(
4583
+ Pn,
4584
+ {
4585
+ role: "status",
4586
+ politeness: p.politeness,
4587
+ clearAnnouncementDelay: p.announcementTimeout,
4588
+ children: p.message
4589
+ }
4590
+ )
4591
+ ] });
4592
+ }
4593
+ );
4594
+ Dn.displayName = "TextInputMask";
4595
+ /*!
4596
+ @versini/ui-textinput v3.0.17
4597
+ © 2025 gizmette.com
4598
+ */
4599
+ try {
4600
+ window.__VERSINI_UI_TEXTINPUT__ || (window.__VERSINI_UI_TEXTINPUT__ = {
4601
+ version: "3.0.17",
4602
+ buildTime: "02/16/2025 06:39 PM EST",
4603
+ homepage: "https://github.com/aversini/ui-components",
4604
+ license: "MIT"
4605
+ });
4606
+ } catch {
4607
+ }
4608
+ const hi = "ASK! ME! ANYTHING!", Ln = "Callisto", fi = "Log in", mi = "Sign in with a Passkey", bc = "Log out", pi = "Password", Sc = "Profile", wc = "Settings", Tc = "Chat history", _c = "About", Ic = "Type your question here", Rc = "{{clipboard}}", Ac = `Sometimes, ${Ln} hallucinates. Review important details.`, vc = "Prompts are pre-filled buttons available on the main screen, to help you quickly start requests. The label is used for the button, and the content is what will be inserted in the chat when the button is pressed. You can use the special placeholder {{clipboard}} to automatically insert the content of your clipboard.", kc = {
4609
+ PREFERENCES: {
4610
+ TITLE: "User profile",
4611
+ NAME: "Name",
4612
+ EMAIL: "Email",
4613
+ LOCATION: "Location",
4614
+ PASSKEY_TITLE: "Passkey",
4615
+ PASSKEY_INSTRUCTIONS: "Log in password-free with a passkey (facial recognition or fingerprint authentication).",
4616
+ PASSKEY_BUTTON: "Create a Passkey"
4617
+ },
4618
+ CURRENT_STATISTICS: {
4619
+ TITLE: "Current chat statistics",
4620
+ MODEL_NAME: "GPT model",
4621
+ TOKENS_USED: "Tokens used",
4622
+ REMAINING_TOKENS: "Remaining tokens",
4623
+ PROCESSING_TIME: "Average response time"
4624
+ },
4625
+ MAIN_STATISTICS: {
4626
+ TITLE: "Lifetime statistics",
4627
+ TOTAL: "Total chat session",
4628
+ PROCESSING_TIME: "Average response time"
4629
+ },
4630
+ HISTORY: {
4631
+ TITLE: "Chat history"
4632
+ },
4633
+ ABOUT: {
4634
+ TITLE_CLIENT: "Client details",
4635
+ TITLE_SERVER: "Server details",
4636
+ VERSION: "Version",
4637
+ BUILD_TIMESTAMP: "Build date",
4638
+ PROVIDER: "Available AI model"
4639
+ },
4640
+ SETTINGS_PROMPTS: {
4641
+ TITLE: "Prompts"
4642
+ },
4643
+ SETTINGS_DETAILS: {
4644
+ TITLE: "Chat Details",
4645
+ INSTRUCTION: "This option adds individual statistics for each messages under their respective bubbles, such as processing time, model name, and more."
4646
+ }
4647
+ }, gi = () => /* @__PURE__ */ X("div", { className: "flex items-center justify-center", children: [
4648
+ /* @__PURE__ */ h("div", { className: "basis-1/4", children: /* @__PURE__ */ h(Mo, {}) }),
4649
+ /* @__PURE__ */ X("div", { className: "prose prose-sm prose-light md:prose-base prose-h1:mb-0 prose-h2:mt-0", children: [
4650
+ /* @__PURE__ */ h("h1", { children: Ln }),
4651
+ /* @__PURE__ */ h("h2", { children: hi })
4652
+ ] })
4653
+ ] }), yi = () => {
4654
+ const { login: e, logoutReason: t, loginWithPasskey: r } = pn(), [n, a] = Ee(""), [s, o] = Ee(""), [i, c] = Ee(!0), [m, f] = Ee({
4655
+ username: "",
4656
+ password: ""
4657
+ }), u = async (l) => {
4658
+ l.preventDefault(), await e(m.username, m.password) || (o(""), a("Invalid username or password"));
4659
+ };
4660
+ return se(() => {
4661
+ var l;
4662
+ (l = document.getElementById("logo")) == null || l.classList.add("fadeOut"), setTimeout(() => {
4663
+ var d;
4664
+ (d = document.getElementById("root")) == null || d.classList.replace("app-hidden", "fadeIn");
4665
+ }, 500);
4666
+ }), se(() => {
4667
+ t && o(t);
4668
+ }, [t]), /* @__PURE__ */ h(at, { children: /* @__PURE__ */ X(
4669
+ Go,
4670
+ {
4671
+ className: ho({
4672
+ extraClass: "mt-5"
4673
+ }),
4674
+ noMargin: !0,
4675
+ noPadding: !0,
4676
+ children: [
4677
+ /* @__PURE__ */ h(
4678
+ "div",
4679
+ {
4680
+ className: uo({
4681
+ extraClass: "rounded-md"
4682
+ }),
4683
+ children: /* @__PURE__ */ h(gi, {})
4684
+ }
4685
+ ),
4686
+ /* @__PURE__ */ h("form", { className: "mt-5", onSubmit: u, children: /* @__PURE__ */ h(Fo, { alignHorizontal: "center", children: /* @__PURE__ */ h(_e, { span: 6, children: /* @__PURE__ */ X(Uo, { mode: "dark", children: [
4687
+ /* @__PURE__ */ h(_e, { span: 12, className: "mt-7", children: s && /* @__PURE__ */ h("div", { className: "p-2 text-sm text-center text-copy-error-light bg-surface-darker", children: s }) }),
4688
+ /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4689
+ or,
4690
+ {
4691
+ className: "mt-7",
4692
+ required: !0,
4693
+ autoCapitalize: "off",
4694
+ autoComplete: "off",
4695
+ autoCorrect: "off",
4696
+ mode: "dark",
4697
+ focusMode: "light",
4698
+ name: "username",
4699
+ label: "Username",
4700
+ onChange: (l) => {
4701
+ f({
4702
+ ...m,
4703
+ username: l.target.value
4704
+ }), a("");
4705
+ },
4706
+ error: n !== ""
4707
+ }
4708
+ ) }),
4709
+ /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4710
+ Dn,
4711
+ {
4712
+ className: "mt-7",
4713
+ required: !0,
4714
+ autoCapitalize: "off",
4715
+ autoComplete: "off",
4716
+ autoCorrect: "off",
4717
+ mode: "dark",
4718
+ focusMode: "light",
4719
+ name: "password",
4720
+ label: pi,
4721
+ rightElement: /* @__PURE__ */ h(
4722
+ ct,
4723
+ {
4724
+ focusMode: "light",
4725
+ mode: "dark",
4726
+ label: i ? "Show" : "Hide",
4727
+ children: i ? /* @__PURE__ */ h(Vo, {}) : /* @__PURE__ */ h(Ho, {})
4728
+ }
4729
+ ),
4730
+ onMaskChange: c,
4731
+ onChange: (l) => {
4732
+ f({
4733
+ ...m,
4734
+ password: l.target.value
4735
+ }), a("");
4736
+ },
4737
+ error: n !== "",
4738
+ helperText: n
4739
+ }
4740
+ ) }),
4741
+ /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4742
+ Nn,
4743
+ {
4744
+ mode: "light",
4745
+ focusMode: "light",
4746
+ fullWidth: !0,
4747
+ noBorder: !0,
4748
+ type: "submit",
4749
+ className: "mt-7",
4750
+ children: fi
4751
+ }
4752
+ ) }),
4753
+ !fo() && /* @__PURE__ */ X(at, { children: [
4754
+ /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h("div", { className: "text-center text-copy-light mt-2 mb-2", children: "or" }) }),
4755
+ /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4756
+ ct,
4757
+ {
4758
+ variant: "selected",
4759
+ mode: "dark",
4760
+ focusMode: "light",
4761
+ fullWidth: !0,
4762
+ className: "mb-4",
4763
+ labelRight: mi,
4764
+ onClick: r,
4765
+ children: /* @__PURE__ */ h(Ko, { size: "size-7" })
4766
+ }
4767
+ ) })
4768
+ ] })
4769
+ ] }) }) }) })
4770
+ ]
4771
+ }
4772
+ ) });
4773
+ }, Ei = new URL(document.location.href).searchParams, Hr = !!Ei.get("debug") || !1, bi = Vn(() => import(
4774
+ /* webpackChunkName: "LazyApp" */
4775
+ "./App.BDqQnTrq.js"
4776
+ ).then((e) => e.App)), Kr = ({ isComponent: e }) => {
4777
+ const { isAuthenticated: t } = pn();
4778
+ return t ? /* @__PURE__ */ h(Wn, { fallback: /* @__PURE__ */ h("div", {}), children: /* @__PURE__ */ h(bi, { isComponent: e }) }) : /* @__PURE__ */ h(yi, {});
4779
+ }, Si = ({
4780
+ isComponent: e = !1,
4781
+ domain: t = lo
4782
+ }) => (Zs(), vn ? /* @__PURE__ */ h(
4783
+ Ir,
4784
+ {
4785
+ clientId: Rr,
4786
+ domain: t,
4787
+ debug: Hr,
4788
+ endpoint: process.env.PUBLIC_AUTH_SERVER_URL,
4789
+ children: /* @__PURE__ */ h(Kr, { isComponent: e })
4790
+ }
4791
+ ) : /* @__PURE__ */ h(Ir, { clientId: Rr, domain: t, debug: Hr, children: /* @__PURE__ */ h(Kr, { isComponent: e }) })), Nc = ({ domain: e }) => /* @__PURE__ */ h(Si, { isComponent: !0, domain: e });
4792
+ export {
4793
+ _c as ABOUT_TITLE,
4794
+ Gi as ACTION_RESET_PROMPT,
4795
+ Ki as ACTION_SEARCH,
4796
+ Vi as ACTION_SORT,
4797
+ Wi as ACTION_TOGGLE_PROMPT,
4798
+ Ln as APP_NAME,
4799
+ Nn as C,
4800
+ kc as CARDS,
4801
+ Rc as CLIPBOARD_PROMPT,
4802
+ Ui as DEFAULT_AI_PROVIDER,
4803
+ tc as DEFAULT_ICON_ACTION_SIZE,
4804
+ $i as ERROR_MESSAGE,
4805
+ Ac as FOOTER_DISCLAIMER,
4806
+ Tc as HISTORY_TITLE,
4807
+ Go as I,
4808
+ Xi as INFINITE_SCROLL_LIMIT,
4809
+ Qi as INFINITE_SCROLL_THRESHOLD,
4810
+ Fo as L,
4811
+ Fi as LOCAL_STORAGE_CHAT_DETAILS,
4812
+ Bi as LOCAL_STORAGE_PREFIX,
4813
+ ji as LOCAL_STORAGE_PRIVATE_DISCLOSURE,
4814
+ Ji as LOCAL_STORAGE_SEARCH,
4815
+ Yi as LOCAL_STORAGE_SORT,
4816
+ bc as LOG_OUT,
4817
+ gi as Logo,
4818
+ xe as M,
4819
+ Sc as PROFILE_TITLE,
4820
+ vc as PROMPTS_DESCRIPTION,
4821
+ Zi as PROMPT_CLASSNAME,
4822
+ ec as PROMPT_EDITABLE_AREA_CLASSNAME,
4823
+ Hi as PROVIDER_ANTHROPIC,
4824
+ Mi as PROVIDER_OPENAI,
4825
+ Uo as R,
4826
+ xi as ROLE_ASSISTANT,
4827
+ Li as ROLE_HIDDEN,
4828
+ Di as ROLE_INTERNAL,
4829
+ Pi as ROLE_SYSTEM,
4830
+ Ci as ROLE_USER,
4831
+ Be as SERVICE_TYPES,
4832
+ wc as SETTINGS_TITLE,
4833
+ zi as STATS_SEPARATOR,
4834
+ Nc as SassySaint,
4835
+ Ic as TYPE_QUESTION,
4836
+ nc as UI_BUTTON_SCROLL_BUFFER,
4837
+ ac as UI_DEFAULT_MAIN_HEIGHT,
4838
+ rc as UI_FOOTER_BUFFER,
4839
+ qi as WAIT_SEPARATOR,
4840
+ yc as debounce,
4841
+ pc as durationFormatter,
4842
+ yt as f,
4843
+ or as fe,
4844
+ hc as getCurrentGeoLocation,
4845
+ ho as getMainPaddingClass,
4846
+ uo as getMessageContaintWrapperClass,
4847
+ fo as isElectron,
4848
+ Ec as isProbablyiPhone,
4849
+ _e as j,
4850
+ Ko as l,
4851
+ mc as numberFormatter,
4852
+ gc as pluralize,
4853
+ ct as re,
4854
+ fc as renderDataAsList,
4855
+ sc as restCall,
4856
+ qt as serviceCall,
4857
+ oc as setNewProvider,
4858
+ pn as un,
4859
+ lc as useChatsHistory,
4860
+ dc as usePreloadChatsHistory,
4861
+ uc as useServerCapabilities,
4862
+ cc as useUserChatStats,
4863
+ ic as useUserPreferences
4864
+ };