@versini/sassysaint 1.0.3 → 1.0.5

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.
@@ -1,2772 +0,0 @@
1
- import { jsx as c, jsxs as T, Fragment as q } from "react/jsx-runtime";
2
- import * as F from "react";
3
- import K, { createContext as xt, useRef as W, useState as U, useCallback as Me, useEffect as z, useContext as Ze, useMemo as Nt, useId as Ct, useReducer as Rt, useLayoutEffect as Ot, lazy as et, Suspense as tt } from "react";
4
- import g from "clsx";
5
- var Dt = Object.defineProperty, $t = (e, t, r) => t in e ? Dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, ye = (e, t, r) => ($t(e, typeof t != "symbol" ? t + "" : t, r), r);
6
- /*!
7
- @versini/auth-provider v5.1.1
8
- © 2024 gizmette.com
9
- */
10
- try {
11
- window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "5.1.1",
13
- buildTime: "07/07/2024 10:59 AM EDT",
14
- homepage: "https://github.com/aversini/auth-client",
15
- license: "MIT"
16
- });
17
- } catch {
18
- }
19
- /*!
20
- @versini/auth-common v2.11.0
21
- © 2024 gizmette.com
22
- */
23
- try {
24
- window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
25
- version: "2.11.0",
26
- buildTime: "07/07/2024 10:59 AM EDT",
27
- homepage: "https://github.com/aversini/auth-client",
28
- license: "MIT"
29
- });
30
- } catch {
31
- }
32
- const Q = {
33
- ID_TOKEN: "id_token",
34
- ACCESS_TOKEN: "token",
35
- ID_AND_ACCESS_TOKEN: "id_token token",
36
- CODE: "code",
37
- REFRESH_TOKEN: "refresh_token"
38
- }, Mt = {
39
- CLIENT_ID: "X-Auth-ClientId"
40
- }, I = {
41
- ALG: "RS256",
42
- USER_ID_KEY: "sub",
43
- TOKEN_ID_KEY: "__raw",
44
- NONCE_KEY: "_nonce",
45
- USERNAME_KEY: "username",
46
- ISSUER: "gizmette.com"
47
- }, Lt = `-----BEGIN PUBLIC KEY-----
48
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
49
- w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
50
- i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
51
- aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
52
- l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
53
- sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
54
- awIDAQAB
55
- -----END PUBLIC KEY-----`, me = {
56
- AUTHENTICATE: "authenticate",
57
- CODE: "code",
58
- LOGOUT: "logout"
59
- }, he = crypto, rt = (e) => e instanceof CryptoKey, X = new TextEncoder(), pe = new TextDecoder();
60
- function Pt(...e) {
61
- const t = e.reduce((n, { length: o }) => n + o, 0), r = new Uint8Array(t);
62
- let a = 0;
63
- for (const n of e)
64
- r.set(n, a), a += n.length;
65
- return r;
66
- }
67
- const Ut = (e) => {
68
- const t = atob(e), r = new Uint8Array(t.length);
69
- for (let a = 0; a < t.length; a++)
70
- r[a] = t.charCodeAt(a);
71
- return r;
72
- }, ce = (e) => {
73
- let t = e;
74
- t instanceof Uint8Array && (t = pe.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
75
- try {
76
- return Ut(t);
77
- } catch {
78
- throw new TypeError("The input to be decoded is not correctly encoded.");
79
- }
80
- };
81
- let j = class extends Error {
82
- static get code() {
83
- return "ERR_JOSE_GENERIC";
84
- }
85
- constructor(t) {
86
- var r;
87
- super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
88
- }
89
- }, M = class extends j {
90
- static get code() {
91
- return "ERR_JWT_CLAIM_VALIDATION_FAILED";
92
- }
93
- constructor(t, r, a = "unspecified", n = "unspecified") {
94
- super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = a, this.reason = n, this.payload = r;
95
- }
96
- };
97
- class Le extends j {
98
- static get code() {
99
- return "ERR_JWT_EXPIRED";
100
- }
101
- constructor(t, r, a = "unspecified", n = "unspecified") {
102
- super(t), this.code = "ERR_JWT_EXPIRED", this.claim = a, this.reason = n, this.payload = r;
103
- }
104
- }
105
- class Ht extends j {
106
- constructor() {
107
- super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
108
- }
109
- static get code() {
110
- return "ERR_JOSE_ALG_NOT_ALLOWED";
111
- }
112
- }
113
- let H = class extends j {
114
- constructor() {
115
- super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
116
- }
117
- static get code() {
118
- return "ERR_JOSE_NOT_SUPPORTED";
119
- }
120
- }, k = class extends j {
121
- constructor() {
122
- super(...arguments), this.code = "ERR_JWS_INVALID";
123
- }
124
- static get code() {
125
- return "ERR_JWS_INVALID";
126
- }
127
- };
128
- class at extends j {
129
- constructor() {
130
- super(...arguments), this.code = "ERR_JWT_INVALID";
131
- }
132
- static get code() {
133
- return "ERR_JWT_INVALID";
134
- }
135
- }
136
- class Kt extends j {
137
- constructor() {
138
- super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
139
- }
140
- static get code() {
141
- return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
142
- }
143
- }
144
- function L(e, t = "algorithm.name") {
145
- return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
146
- }
147
- function Z(e, t) {
148
- return e.name === t;
149
- }
150
- function be(e) {
151
- return parseInt(e.name.slice(4), 10);
152
- }
153
- function Bt(e) {
154
- switch (e) {
155
- case "ES256":
156
- return "P-256";
157
- case "ES384":
158
- return "P-384";
159
- case "ES512":
160
- return "P-521";
161
- default:
162
- throw new Error("unreachable");
163
- }
164
- }
165
- function Wt(e, t) {
166
- if (t.length && !t.some((r) => e.usages.includes(r))) {
167
- let r = "CryptoKey does not support this operation, its usages must include ";
168
- if (t.length > 2) {
169
- const a = t.pop();
170
- r += `one of ${t.join(", ")}, or ${a}.`;
171
- } else
172
- t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
173
- throw new TypeError(r);
174
- }
175
- }
176
- function jt(e, t, ...r) {
177
- switch (t) {
178
- case "HS256":
179
- case "HS384":
180
- case "HS512": {
181
- if (!Z(e.algorithm, "HMAC"))
182
- throw L("HMAC");
183
- const a = parseInt(t.slice(2), 10);
184
- if (be(e.algorithm.hash) !== a)
185
- throw L(`SHA-${a}`, "algorithm.hash");
186
- break;
187
- }
188
- case "RS256":
189
- case "RS384":
190
- case "RS512": {
191
- if (!Z(e.algorithm, "RSASSA-PKCS1-v1_5"))
192
- throw L("RSASSA-PKCS1-v1_5");
193
- const a = parseInt(t.slice(2), 10);
194
- if (be(e.algorithm.hash) !== a)
195
- throw L(`SHA-${a}`, "algorithm.hash");
196
- break;
197
- }
198
- case "PS256":
199
- case "PS384":
200
- case "PS512": {
201
- if (!Z(e.algorithm, "RSA-PSS"))
202
- throw L("RSA-PSS");
203
- const a = parseInt(t.slice(2), 10);
204
- if (be(e.algorithm.hash) !== a)
205
- throw L(`SHA-${a}`, "algorithm.hash");
206
- break;
207
- }
208
- case "EdDSA": {
209
- if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
210
- throw L("Ed25519 or Ed448");
211
- break;
212
- }
213
- case "ES256":
214
- case "ES384":
215
- case "ES512": {
216
- if (!Z(e.algorithm, "ECDSA"))
217
- throw L("ECDSA");
218
- const a = Bt(t);
219
- if (e.algorithm.namedCurve !== a)
220
- throw L(a, "algorithm.namedCurve");
221
- break;
222
- }
223
- default:
224
- throw new TypeError("CryptoKey does not support this operation");
225
- }
226
- Wt(e, r);
227
- }
228
- function nt(e, t, ...r) {
229
- var a;
230
- if (r.length > 2) {
231
- const n = r.pop();
232
- e += `one of type ${r.join(", ")}, or ${n}.`;
233
- } else
234
- r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
235
- return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
236
- }
237
- const Pe = (e, ...t) => nt("Key must be ", e, ...t);
238
- function ot(e, t, ...r) {
239
- return nt(`Key for the ${e} algorithm must be `, t, ...r);
240
- }
241
- const st = (e) => rt(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", de = ["CryptoKey"], Gt = (...e) => {
242
- const t = e.filter(Boolean);
243
- if (t.length === 0 || t.length === 1)
244
- return !0;
245
- let r;
246
- for (const a of t) {
247
- const n = Object.keys(a);
248
- if (!r || r.size === 0) {
249
- r = new Set(n);
250
- continue;
251
- }
252
- for (const o of n) {
253
- if (r.has(o))
254
- return !1;
255
- r.add(o);
256
- }
257
- }
258
- return !0;
259
- };
260
- function Vt(e) {
261
- return typeof e == "object" && e !== null;
262
- }
263
- function _e(e) {
264
- if (!Vt(e) || Object.prototype.toString.call(e) !== "[object Object]")
265
- return !1;
266
- if (Object.getPrototypeOf(e) === null)
267
- return !0;
268
- let t = e;
269
- for (; Object.getPrototypeOf(t) !== null; )
270
- t = Object.getPrototypeOf(t);
271
- return Object.getPrototypeOf(e) === t;
272
- }
273
- const Jt = (e, t) => {
274
- if (e.startsWith("RS") || e.startsWith("PS")) {
275
- const { modulusLength: r } = t.algorithm;
276
- if (typeof r != "number" || r < 2048)
277
- throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
278
- }
279
- };
280
- function Ft(e) {
281
- let t, r;
282
- switch (e.kty) {
283
- case "RSA": {
284
- switch (e.alg) {
285
- case "PS256":
286
- case "PS384":
287
- case "PS512":
288
- t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
289
- break;
290
- case "RS256":
291
- case "RS384":
292
- case "RS512":
293
- t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
294
- break;
295
- case "RSA-OAEP":
296
- case "RSA-OAEP-256":
297
- case "RSA-OAEP-384":
298
- case "RSA-OAEP-512":
299
- t = {
300
- name: "RSA-OAEP",
301
- hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
302
- }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
303
- break;
304
- default:
305
- throw new H('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
306
- }
307
- break;
308
- }
309
- case "EC": {
310
- switch (e.alg) {
311
- case "ES256":
312
- t = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
313
- break;
314
- case "ES384":
315
- t = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
316
- break;
317
- case "ES512":
318
- t = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
319
- break;
320
- case "ECDH-ES":
321
- case "ECDH-ES+A128KW":
322
- case "ECDH-ES+A192KW":
323
- case "ECDH-ES+A256KW":
324
- t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
325
- break;
326
- default:
327
- throw new H('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
328
- }
329
- break;
330
- }
331
- case "OKP": {
332
- switch (e.alg) {
333
- case "EdDSA":
334
- t = { name: e.crv }, r = e.d ? ["sign"] : ["verify"];
335
- break;
336
- case "ECDH-ES":
337
- case "ECDH-ES+A128KW":
338
- case "ECDH-ES+A192KW":
339
- case "ECDH-ES+A256KW":
340
- t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
341
- break;
342
- default:
343
- throw new H('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
344
- }
345
- break;
346
- }
347
- default:
348
- throw new H('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
349
- }
350
- return { algorithm: t, keyUsages: r };
351
- }
352
- const zt = async (e) => {
353
- if (!e.alg)
354
- throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
355
- const { algorithm: t, keyUsages: r } = Ft(e), a = [
356
- t,
357
- e.ext ?? !1,
358
- e.key_ops ?? r
359
- ], n = { ...e };
360
- return delete n.alg, delete n.use, he.subtle.importKey("jwk", n, ...a);
361
- }, it = (e) => ce(e);
362
- let we, Ee;
363
- const ct = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", lt = async (e, t, r, a) => {
364
- let n = e.get(t);
365
- if (n != null && n[a])
366
- return n[a];
367
- const o = await zt({ ...r, alg: a });
368
- return n ? n[a] = o : e.set(t, { [a]: o }), o;
369
- }, Yt = (e, t) => {
370
- if (ct(e)) {
371
- let r = e.export({ format: "jwk" });
372
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? it(r.k) : (Ee || (Ee = /* @__PURE__ */ new WeakMap()), lt(Ee, e, r, t));
373
- }
374
- return e;
375
- }, qt = (e, t) => {
376
- if (ct(e)) {
377
- let r = e.export({ format: "jwk" });
378
- return r.k ? it(r.k) : (we || (we = /* @__PURE__ */ new WeakMap()), lt(we, e, r, t));
379
- }
380
- return e;
381
- }, Qt = { normalizePublicKey: Yt, normalizePrivateKey: qt }, P = (e, t, r = 0) => {
382
- r === 0 && (t.unshift(t.length), t.unshift(6));
383
- const a = e.indexOf(t[0], r);
384
- if (a === -1)
385
- return !1;
386
- const n = e.subarray(a, a + t.length);
387
- return n.length !== t.length ? !1 : n.every((o, s) => o === t[s]) || P(e, t, a + 1);
388
- }, Ue = (e) => {
389
- switch (!0) {
390
- case P(e, [42, 134, 72, 206, 61, 3, 1, 7]):
391
- return "P-256";
392
- case P(e, [43, 129, 4, 0, 34]):
393
- return "P-384";
394
- case P(e, [43, 129, 4, 0, 35]):
395
- return "P-521";
396
- case P(e, [43, 101, 110]):
397
- return "X25519";
398
- case P(e, [43, 101, 111]):
399
- return "X448";
400
- case P(e, [43, 101, 112]):
401
- return "Ed25519";
402
- case P(e, [43, 101, 113]):
403
- return "Ed448";
404
- default:
405
- throw new H("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
406
- }
407
- }, Xt = async (e, t, r, a, n) => {
408
- let o, s;
409
- const i = new Uint8Array(atob(r.replace(e, "")).split("").map((l) => l.charCodeAt(0)));
410
- switch (a) {
411
- case "PS256":
412
- case "PS384":
413
- case "PS512":
414
- o = { name: "RSA-PSS", hash: `SHA-${a.slice(-3)}` }, s = ["verify"];
415
- break;
416
- case "RS256":
417
- case "RS384":
418
- case "RS512":
419
- o = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${a.slice(-3)}` }, s = ["verify"];
420
- break;
421
- case "RSA-OAEP":
422
- case "RSA-OAEP-256":
423
- case "RSA-OAEP-384":
424
- case "RSA-OAEP-512":
425
- o = {
426
- name: "RSA-OAEP",
427
- hash: `SHA-${parseInt(a.slice(-3), 10) || 1}`
428
- }, s = ["encrypt", "wrapKey"];
429
- break;
430
- case "ES256":
431
- o = { name: "ECDSA", namedCurve: "P-256" }, s = ["verify"];
432
- break;
433
- case "ES384":
434
- o = { name: "ECDSA", namedCurve: "P-384" }, s = ["verify"];
435
- break;
436
- case "ES512":
437
- o = { name: "ECDSA", namedCurve: "P-521" }, s = ["verify"];
438
- break;
439
- case "ECDH-ES":
440
- case "ECDH-ES+A128KW":
441
- case "ECDH-ES+A192KW":
442
- case "ECDH-ES+A256KW": {
443
- const l = Ue(i);
444
- o = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, s = [];
445
- break;
446
- }
447
- case "EdDSA":
448
- o = { name: Ue(i) }, s = ["verify"];
449
- break;
450
- default:
451
- throw new H('Invalid or unsupported "alg" (Algorithm) value');
452
- }
453
- return he.subtle.importKey(t, i, o, !1, s);
454
- }, Zt = (e, t, r) => Xt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
455
- async function er(e, t, r) {
456
- if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
457
- throw new TypeError('"spki" must be SPKI formatted string');
458
- return Zt(e, t);
459
- }
460
- const le = (e) => e == null ? void 0 : e[Symbol.toStringTag], tr = (e, t) => {
461
- if (!(t instanceof Uint8Array)) {
462
- if (!st(t))
463
- throw new TypeError(ot(e, t, ...de, "Uint8Array"));
464
- if (t.type !== "secret")
465
- throw new TypeError(`${le(t)} instances for symmetric algorithms must be of type "secret"`);
466
- }
467
- }, rr = (e, t, r) => {
468
- if (!st(t))
469
- throw new TypeError(ot(e, t, ...de));
470
- if (t.type === "secret")
471
- throw new TypeError(`${le(t)} instances for asymmetric algorithms must not be of type "secret"`);
472
- if (t.algorithm && r === "verify" && t.type === "private")
473
- throw new TypeError(`${le(t)} instances for asymmetric algorithm verifying must be of type "public"`);
474
- if (t.algorithm && r === "encrypt" && t.type === "private")
475
- throw new TypeError(`${le(t)} instances for asymmetric algorithm encryption must be of type "public"`);
476
- }, ar = (e, t, r) => {
477
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? tr(e, t) : rr(e, t, r);
478
- };
479
- function nr(e, t, r, a, n) {
480
- if (n.crit !== void 0 && (a == null ? void 0 : a.crit) === void 0)
481
- throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
482
- if (!a || a.crit === void 0)
483
- return /* @__PURE__ */ new Set();
484
- if (!Array.isArray(a.crit) || a.crit.length === 0 || a.crit.some((s) => typeof s != "string" || s.length === 0))
485
- throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
486
- let o;
487
- r !== void 0 ? o = new Map([...Object.entries(r), ...t.entries()]) : o = t;
488
- for (const s of a.crit) {
489
- if (!o.has(s))
490
- throw new H(`Extension Header Parameter "${s}" is not recognized`);
491
- if (n[s] === void 0)
492
- throw new e(`Extension Header Parameter "${s}" is missing`);
493
- if (o.get(s) && a[s] === void 0)
494
- throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`);
495
- }
496
- return new Set(a.crit);
497
- }
498
- const or = (e, t) => {
499
- if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
500
- throw new TypeError(`"${e}" option must be an array of strings`);
501
- if (t)
502
- return new Set(t);
503
- };
504
- function sr(e, t) {
505
- const r = `SHA-${e.slice(-3)}`;
506
- switch (e) {
507
- case "HS256":
508
- case "HS384":
509
- case "HS512":
510
- return { hash: r, name: "HMAC" };
511
- case "PS256":
512
- case "PS384":
513
- case "PS512":
514
- return { hash: r, name: "RSA-PSS", saltLength: e.slice(-3) >> 3 };
515
- case "RS256":
516
- case "RS384":
517
- case "RS512":
518
- return { hash: r, name: "RSASSA-PKCS1-v1_5" };
519
- case "ES256":
520
- case "ES384":
521
- case "ES512":
522
- return { hash: r, name: "ECDSA", namedCurve: t.namedCurve };
523
- case "EdDSA":
524
- return { name: t.name };
525
- default:
526
- throw new H(`alg ${e} is not supported either by JOSE or your javascript runtime`);
527
- }
528
- }
529
- async function ir(e, t, r) {
530
- if (t = await Qt.normalizePublicKey(t, e), rt(t))
531
- return jt(t, e, r), t;
532
- if (t instanceof Uint8Array) {
533
- if (!e.startsWith("HS"))
534
- throw new TypeError(Pe(t, ...de));
535
- return he.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
536
- }
537
- throw new TypeError(Pe(t, ...de, "Uint8Array"));
538
- }
539
- const cr = async (e, t, r, a) => {
540
- const n = await ir(e, t, "verify");
541
- Jt(e, n);
542
- const o = sr(e, n.algorithm);
543
- try {
544
- return await he.subtle.verify(o, n, r, a);
545
- } catch {
546
- return !1;
547
- }
548
- };
549
- async function lr(e, t, r) {
550
- if (!_e(e))
551
- throw new k("Flattened JWS must be an object");
552
- if (e.protected === void 0 && e.header === void 0)
553
- throw new k('Flattened JWS must have either of the "protected" or "header" members');
554
- if (e.protected !== void 0 && typeof e.protected != "string")
555
- throw new k("JWS Protected Header incorrect type");
556
- if (e.payload === void 0)
557
- throw new k("JWS Payload missing");
558
- if (typeof e.signature != "string")
559
- throw new k("JWS Signature missing or incorrect type");
560
- if (e.header !== void 0 && !_e(e.header))
561
- throw new k("JWS Unprotected Header incorrect type");
562
- let a = {};
563
- if (e.protected)
564
- try {
565
- const f = ce(e.protected);
566
- a = JSON.parse(pe.decode(f));
567
- } catch {
568
- throw new k("JWS Protected Header is invalid");
569
- }
570
- if (!Gt(a, e.header))
571
- throw new k("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
572
- const n = {
573
- ...a,
574
- ...e.header
575
- }, o = nr(k, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
576
- let s = !0;
577
- if (o.has("b64") && (s = a.b64, typeof s != "boolean"))
578
- throw new k('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
579
- const { alg: i } = n;
580
- if (typeof i != "string" || !i)
581
- throw new k('JWS "alg" (Algorithm) Header Parameter missing or invalid');
582
- const l = r && or("algorithms", r.algorithms);
583
- if (l && !l.has(i))
584
- throw new Ht('"alg" (Algorithm) Header Parameter value not allowed');
585
- if (s) {
586
- if (typeof e.payload != "string")
587
- throw new k("JWS Payload must be a string");
588
- } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
589
- throw new k("JWS Payload must be a string or an Uint8Array instance");
590
- let d = !1;
591
- typeof t == "function" && (t = await t(a, e), d = !0), ar(i, t, "verify");
592
- const h = Pt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
593
- let u;
594
- try {
595
- u = ce(e.signature);
596
- } catch {
597
- throw new k("Failed to base64url decode the signature");
598
- }
599
- if (!await cr(i, t, u, h))
600
- throw new Kt();
601
- let m;
602
- if (s)
603
- try {
604
- m = ce(e.payload);
605
- } catch {
606
- throw new k("Failed to base64url decode the payload");
607
- }
608
- else
609
- typeof e.payload == "string" ? m = X.encode(e.payload) : m = e.payload;
610
- const p = { payload: m };
611
- return e.protected !== void 0 && (p.protectedHeader = a), e.header !== void 0 && (p.unprotectedHeader = e.header), d ? { ...p, key: t } : p;
612
- }
613
- async function dr(e, t, r) {
614
- if (e instanceof Uint8Array && (e = pe.decode(e)), typeof e != "string")
615
- throw new k("Compact JWS must be a string or Uint8Array");
616
- const { 0: a, 1: n, 2: o, length: s } = e.split(".");
617
- if (s !== 3)
618
- throw new k("Invalid Compact JWS");
619
- const i = await lr({ payload: n, protected: a, signature: o }, t, r), l = { payload: i.payload, protectedHeader: i.protectedHeader };
620
- return typeof t == "function" ? { ...l, key: i.key } : l;
621
- }
622
- const ur = (e) => Math.floor(e.getTime() / 1e3), dt = 60, ut = dt * 60, Ie = ut * 24, mr = Ie * 7, hr = Ie * 365.25, pr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, He = (e) => {
623
- const t = pr.exec(e);
624
- if (!t || t[4] && t[1])
625
- throw new TypeError("Invalid time period format");
626
- const r = parseFloat(t[2]), a = t[3].toLowerCase();
627
- let n;
628
- switch (a) {
629
- case "sec":
630
- case "secs":
631
- case "second":
632
- case "seconds":
633
- case "s":
634
- n = Math.round(r);
635
- break;
636
- case "minute":
637
- case "minutes":
638
- case "min":
639
- case "mins":
640
- case "m":
641
- n = Math.round(r * dt);
642
- break;
643
- case "hour":
644
- case "hours":
645
- case "hr":
646
- case "hrs":
647
- case "h":
648
- n = Math.round(r * ut);
649
- break;
650
- case "day":
651
- case "days":
652
- case "d":
653
- n = Math.round(r * Ie);
654
- break;
655
- case "week":
656
- case "weeks":
657
- case "w":
658
- n = Math.round(r * mr);
659
- break;
660
- default:
661
- n = Math.round(r * hr);
662
- break;
663
- }
664
- return t[1] === "-" || t[4] === "ago" ? -n : n;
665
- }, Ke = (e) => e.toLowerCase().replace(/^application\//, ""), gr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, fr = (e, t, r = {}) => {
666
- let a;
667
- try {
668
- a = JSON.parse(pe.decode(t));
669
- } catch {
670
- }
671
- if (!_e(a))
672
- throw new at("JWT Claims Set must be a top-level JSON object");
673
- const { typ: n } = r;
674
- if (n && (typeof e.typ != "string" || Ke(e.typ) !== Ke(n)))
675
- throw new M('unexpected "typ" JWT header value', a, "typ", "check_failed");
676
- const { requiredClaims: o = [], issuer: s, subject: i, audience: l, maxTokenAge: d } = r, h = [...o];
677
- d !== void 0 && h.push("iat"), l !== void 0 && h.push("aud"), i !== void 0 && h.push("sub"), s !== void 0 && h.push("iss");
678
- for (const f of new Set(h.reverse()))
679
- if (!(f in a))
680
- throw new M(`missing required "${f}" claim`, a, f, "missing");
681
- if (s && !(Array.isArray(s) ? s : [s]).includes(a.iss))
682
- throw new M('unexpected "iss" claim value', a, "iss", "check_failed");
683
- if (i && a.sub !== i)
684
- throw new M('unexpected "sub" claim value', a, "sub", "check_failed");
685
- if (l && !gr(a.aud, typeof l == "string" ? [l] : l))
686
- throw new M('unexpected "aud" claim value', a, "aud", "check_failed");
687
- let u;
688
- switch (typeof r.clockTolerance) {
689
- case "string":
690
- u = He(r.clockTolerance);
691
- break;
692
- case "number":
693
- u = r.clockTolerance;
694
- break;
695
- case "undefined":
696
- u = 0;
697
- break;
698
- default:
699
- throw new TypeError("Invalid clockTolerance option type");
700
- }
701
- const { currentDate: m } = r, p = ur(m || /* @__PURE__ */ new Date());
702
- if ((a.iat !== void 0 || d) && typeof a.iat != "number")
703
- throw new M('"iat" claim must be a number', a, "iat", "invalid");
704
- if (a.nbf !== void 0) {
705
- if (typeof a.nbf != "number")
706
- throw new M('"nbf" claim must be a number', a, "nbf", "invalid");
707
- if (a.nbf > p + u)
708
- throw new M('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
709
- }
710
- if (a.exp !== void 0) {
711
- if (typeof a.exp != "number")
712
- throw new M('"exp" claim must be a number', a, "exp", "invalid");
713
- if (a.exp <= p - u)
714
- throw new Le('"exp" claim timestamp check failed', a, "exp", "check_failed");
715
- }
716
- if (d) {
717
- const f = p - a.iat, w = typeof d == "number" ? d : He(d);
718
- if (f - u > w)
719
- throw new Le('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
720
- if (f < 0 - u)
721
- throw new M('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
722
- }
723
- return a;
724
- };
725
- async function yr(e, t, r) {
726
- var a;
727
- const n = await dr(e, t, r);
728
- if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
729
- throw new at("JWTs MUST NOT use unencoded payload");
730
- const o = { payload: fr(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
731
- return typeof t == "function" ? { ...o, key: n.key } : o;
732
- }
733
- const Y = async (e) => {
734
- try {
735
- const t = I.ALG, r = await er(Lt, t);
736
- return await yr(e, r, {
737
- issuer: I.ISSUER
738
- });
739
- } catch {
740
- return;
741
- }
742
- };
743
- var E = [];
744
- for (var ve = 0; ve < 256; ++ve)
745
- E.push((ve + 256).toString(16).slice(1));
746
- function br(e, t = 0) {
747
- return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
748
- }
749
- var ee, wr = new Uint8Array(16);
750
- function Er() {
751
- if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
752
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
753
- return ee(wr);
754
- }
755
- var vr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
756
- const Be = {
757
- randomUUID: vr
758
- };
759
- function We(e, t, r) {
760
- if (Be.randomUUID && !t && !e)
761
- return Be.randomUUID();
762
- e = e || {};
763
- var a = e.random || (e.rng || Er)();
764
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, br(a);
765
- }
766
- const je = globalThis.crypto, kr = (e) => `${We()}${We()}`.slice(0, e), Sr = (e) => btoa(
767
- [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
768
- );
769
- async function Tr(e) {
770
- if (!je.subtle)
771
- throw new Error(
772
- "crypto.subtle is available only in secure contexts (HTTPS)."
773
- );
774
- const t = new TextEncoder().encode(e), r = await je.subtle.digest("SHA-256", t);
775
- return Sr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
776
- }
777
- async function Ar(e) {
778
- const t = kr(43), r = await Tr(t);
779
- return {
780
- code_verifier: t,
781
- code_challenge: r
782
- };
783
- }
784
- function mt(e, t) {
785
- window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
786
- }
787
- const Ge = (e, t) => {
788
- const r = JSON.stringify(
789
- typeof t == "function" ? t() : t
790
- );
791
- window.localStorage.setItem(e, r), mt(e, r);
792
- }, _r = (e) => {
793
- window.localStorage.removeItem(e), mt(e, null);
794
- }, Ve = (e) => window.localStorage.getItem(e), Ir = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
795
- function te({
796
- key: e,
797
- initialValue: t
798
- }) {
799
- const r = () => Ve(e), a = F.useSyncExternalStore(
800
- Ir,
801
- r
802
- ), n = F.useCallback(
803
- (i) => {
804
- try {
805
- const l = typeof i == "function" ? i(JSON.parse(a)) : i;
806
- l == null ? _r(e) : Ge(e, l);
807
- } catch (l) {
808
- console.warn(l);
809
- }
810
- },
811
- [e, a]
812
- ), o = F.useCallback(() => {
813
- n(t);
814
- }, [t, n]), s = F.useCallback(() => {
815
- n(null);
816
- }, [n]);
817
- return F.useEffect(() => {
818
- try {
819
- Ve(e) === null && typeof t < "u" && Ge(e, t);
820
- } catch (i) {
821
- console.warn(i);
822
- }
823
- }, [e, t]), [a ? JSON.parse(a) : null, n, o, s];
824
- }
825
- var v = [];
826
- for (var ke = 0; ke < 256; ++ke)
827
- v.push((ke + 256).toString(16).slice(1));
828
- function xr(e, t = 0) {
829
- return (v[e[t + 0]] + v[e[t + 1]] + v[e[t + 2]] + v[e[t + 3]] + "-" + v[e[t + 4]] + v[e[t + 5]] + "-" + v[e[t + 6]] + v[e[t + 7]] + "-" + v[e[t + 8]] + v[e[t + 9]] + "-" + v[e[t + 10]] + v[e[t + 11]] + v[e[t + 12]] + v[e[t + 13]] + v[e[t + 14]] + v[e[t + 15]]).toLowerCase();
830
- }
831
- var re, Nr = new Uint8Array(16);
832
- function Cr() {
833
- if (!re && (re = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !re))
834
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
835
- return re(Nr);
836
- }
837
- var Rr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
838
- const Je = {
839
- randomUUID: Rr
840
- };
841
- function Or(e, t, r) {
842
- if (Je.randomUUID && !t && !e)
843
- return Je.randomUUID();
844
- e = e || {};
845
- var a = e.random || (e.rng || Cr)();
846
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, xr(a);
847
- }
848
- const ae = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Dr = "Your session has been successfully terminated.", Fe = "Login failed. Please try again.", Se = "Error getting access token, please re-authenticate.", $r = "You forgot to wrap your component in <AuthProvider>.", ze = {
849
- dev: "https://auth.gizmette.local.com:3003",
850
- prod: "https://mylogin.gizmette.com"
851
- }, ne = "@@auth@@", Mr = process.env.NODE_ENV === "production", Lr = !Mr, ge = async ({
852
- type: e,
853
- clientId: t,
854
- params: r = {}
855
- }) => {
856
- try {
857
- const a = await fetch(
858
- Lr ? `${ze.dev}/${e}` : `${ze.prod}/${e}`,
859
- {
860
- credentials: "include",
861
- method: "POST",
862
- headers: {
863
- "Content-Type": "application/json",
864
- [Mt.CLIENT_ID]: `${t}`
865
- },
866
- body: JSON.stringify(r)
867
- }
868
- );
869
- if (a.status !== 200)
870
- return { status: a.status, data: [] };
871
- const { data: n, errors: o } = await a.json();
872
- return {
873
- status: a.status,
874
- data: n,
875
- errors: o
876
- };
877
- } catch (a) {
878
- return console.error(a), { status: 500, data: [] };
879
- }
880
- }, Pr = async ({
881
- idToken: e,
882
- accessToken: t,
883
- refreshToken: r,
884
- clientId: a,
885
- domain: n
886
- }) => {
887
- try {
888
- return {
889
- status: (await ge({
890
- type: me.LOGOUT,
891
- clientId: a,
892
- params: {
893
- idToken: e,
894
- accessToken: t,
895
- refreshToken: r,
896
- domain: n
897
- }
898
- })).status === 200
899
- };
900
- } catch {
901
- return {
902
- status: !1
903
- };
904
- }
905
- }, Ye = async ({
906
- username: e,
907
- password: t,
908
- clientId: r,
909
- nonce: a,
910
- type: n,
911
- sessionExpiration: o,
912
- code: s,
913
- code_verifier: i,
914
- domain: l
915
- }) => {
916
- try {
917
- const d = await ge({
918
- type: me.AUTHENTICATE,
919
- clientId: r,
920
- params: {
921
- type: n || Q.ID_AND_ACCESS_TOKEN,
922
- username: e,
923
- password: t,
924
- sessionExpiration: o,
925
- nonce: a,
926
- code: s,
927
- code_verifier: i,
928
- domain: l
929
- }
930
- }), h = await Y(d.data.idToken);
931
- return h && h.payload[I.USER_ID_KEY] !== "" && h.payload[I.NONCE_KEY] === a ? {
932
- idToken: d.data.idToken,
933
- accessToken: d.data.accessToken,
934
- refreshToken: d.data.refreshToken,
935
- userId: h.payload[I.USER_ID_KEY],
936
- status: !0
937
- } : {
938
- status: !1
939
- };
940
- } catch {
941
- return {
942
- status: !1
943
- };
944
- }
945
- }, Ur = async ({
946
- nonce: e,
947
- clientId: t,
948
- code_challenge: r
949
- }) => {
950
- try {
951
- const a = await ge({
952
- type: me.CODE,
953
- clientId: t,
954
- params: {
955
- type: Q.CODE,
956
- nonce: e,
957
- code_challenge: r
958
- }
959
- });
960
- return a.data.code ? {
961
- status: !0,
962
- code: a.data.code
963
- } : {
964
- status: !1
965
- };
966
- } catch {
967
- return {
968
- status: !1
969
- };
970
- }
971
- }, Hr = async ({
972
- clientId: e,
973
- userId: t,
974
- nonce: r,
975
- refreshToken: a,
976
- accessToken: n,
977
- domain: o
978
- }) => {
979
- try {
980
- const s = await ge({
981
- type: me.AUTHENTICATE,
982
- clientId: e,
983
- params: {
984
- type: Q.REFRESH_TOKEN,
985
- userId: t,
986
- nonce: r,
987
- refreshToken: a,
988
- accessToken: n,
989
- domain: o
990
- }
991
- }), i = await Y(s.data.accessToken);
992
- return i && i.payload[I.USER_ID_KEY] !== "" && i.payload[I.NONCE_KEY] === r ? {
993
- accessToken: s.data.accessToken,
994
- refreshToken: s.data.refreshToken,
995
- userId: i.payload[I.USER_ID_KEY],
996
- status: !0
997
- } : {
998
- status: !1
999
- };
1000
- } catch {
1001
- return {
1002
- status: !1
1003
- };
1004
- }
1005
- };
1006
- class Kr {
1007
- constructor(t = null, r = null) {
1008
- ye(this, "refreshTokenPromise", null), ye(this, "accessToken"), ye(this, "refreshToken"), this.accessToken = t || "", this.refreshToken = r || "";
1009
- }
1010
- async refreshtoken({
1011
- clientId: t,
1012
- userId: r,
1013
- nonce: a,
1014
- domain: n
1015
- }) {
1016
- this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
1017
- clientId: t,
1018
- userId: r,
1019
- nonce: a,
1020
- domain: n
1021
- }));
1022
- try {
1023
- return await this.refreshTokenPromise;
1024
- } finally {
1025
- this.refreshTokenPromise = null;
1026
- }
1027
- }
1028
- async _refreshToken({
1029
- clientId: t,
1030
- userId: r,
1031
- nonce: a,
1032
- domain: n
1033
- }) {
1034
- const o = await Y(this.refreshToken);
1035
- if (o && o.payload[I.USER_ID_KEY] !== "") {
1036
- const s = await Hr({
1037
- clientId: t,
1038
- userId: r,
1039
- nonce: a,
1040
- refreshToken: this.refreshToken,
1041
- accessToken: this.accessToken,
1042
- domain: n
1043
- });
1044
- return s.status ? (this.accessToken = s.accessToken, this.refreshToken = s.refreshToken, {
1045
- status: "success",
1046
- newAccessToken: s.accessToken,
1047
- newRefreshToken: s.refreshToken
1048
- }) : {
1049
- status: "failure"
1050
- };
1051
- } else
1052
- return {
1053
- status: "failure"
1054
- };
1055
- }
1056
- }
1057
- const oe = () => {
1058
- throw new Error($r);
1059
- }, ht = xt({
1060
- isAuthenticated: !1,
1061
- isLoading: !1,
1062
- login: oe,
1063
- logout: oe,
1064
- getAccessToken: oe,
1065
- getIdToken: oe,
1066
- logoutReason: ""
1067
- }), Br = ({
1068
- children: e,
1069
- sessionExpiration: t,
1070
- clientId: r,
1071
- domain: a = ""
1072
- }) => {
1073
- const n = W(!1), [o, s, , i] = te({
1074
- key: `${ne}::${r}::@@user@@`
1075
- }), [l, d, , h] = te({
1076
- key: `${ne}::${r}::@@access@@`
1077
- }), [u, m, , p] = te(
1078
- {
1079
- key: `${ne}::${r}::@@refresh@@`
1080
- }
1081
- ), [f, w, , x] = te({
1082
- key: `${ne}::${r}::@@nonce@@`
1083
- }), O = new Kr(l, u), [_, S] = U({
1084
- isLoading: !0,
1085
- isAuthenticated: !1,
1086
- user: void 0,
1087
- logoutReason: ""
1088
- }), D = Me(
1089
- (y) => {
1090
- console.warn(y), S({
1091
- isLoading: !0,
1092
- isAuthenticated: !1,
1093
- user: void 0,
1094
- logoutReason: y || ae
1095
- }), i(), h(), p(), x();
1096
- },
1097
- [h, i, x, p]
1098
- ), C = Me(
1099
- async (y) => {
1100
- D(y || ae), await Pr({
1101
- idToken: o,
1102
- accessToken: l,
1103
- refreshToken: u,
1104
- clientId: r,
1105
- domain: a
1106
- }), S(($) => ({
1107
- ...$,
1108
- isLoading: !1
1109
- }));
1110
- },
1111
- [
1112
- l,
1113
- r,
1114
- a,
1115
- o,
1116
- u,
1117
- D
1118
- ]
1119
- );
1120
- z(() => {
1121
- if (!n.current)
1122
- return _.isLoading && o !== null ? (async () => {
1123
- try {
1124
- const y = await Y(o);
1125
- y && y.payload[I.USER_ID_KEY] !== "" ? S({
1126
- isLoading: !1,
1127
- isAuthenticated: !0,
1128
- user: {
1129
- userId: y.payload[I.USER_ID_KEY],
1130
- username: y.payload[I.USERNAME_KEY]
1131
- },
1132
- logoutReason: ""
1133
- }) : await C(ae);
1134
- } catch {
1135
- await C(ae);
1136
- }
1137
- })() : S((y) => ({
1138
- ...y,
1139
- isLoading: !1
1140
- })), () => {
1141
- n.current = !0;
1142
- };
1143
- }, [_.isLoading, o, C]);
1144
- const N = async (y, $, b) => {
1145
- const A = Or();
1146
- if (w(A), S((G) => ({
1147
- ...G,
1148
- isLoading: !0
1149
- })), i(), h(), p(), b === Q.CODE) {
1150
- const { code_verifier: G, code_challenge: It } = await Ar(), $e = await Ur({
1151
- nonce: A,
1152
- clientId: r,
1153
- code_challenge: It
1154
- });
1155
- if ($e.status) {
1156
- const J = await Ye({
1157
- username: y,
1158
- password: $,
1159
- clientId: r,
1160
- sessionExpiration: t,
1161
- nonce: A,
1162
- type: b,
1163
- code: $e.code,
1164
- code_verifier: G,
1165
- domain: a
1166
- });
1167
- return J.status ? (s(J.idToken), d(J.accessToken), m(J.refreshToken), S({
1168
- isLoading: !1,
1169
- isAuthenticated: !0,
1170
- user: {
1171
- userId: J.userId,
1172
- username: y
1173
- },
1174
- logoutReason: ""
1175
- }), !0) : (D(Fe), !1);
1176
- }
1177
- return !1;
1178
- }
1179
- const B = await Ye({
1180
- username: y,
1181
- password: $,
1182
- clientId: r,
1183
- sessionExpiration: t,
1184
- nonce: A,
1185
- type: b,
1186
- domain: a
1187
- });
1188
- return B.status ? (s(B.idToken), d(B.accessToken), m(B.refreshToken), S({
1189
- isLoading: !1,
1190
- isAuthenticated: !0,
1191
- user: {
1192
- userId: B.userId,
1193
- username: y
1194
- }
1195
- }), !0) : (D(Fe), !1);
1196
- }, V = async (y) => {
1197
- y == null || y.preventDefault(), await C(Dr);
1198
- }, R = async () => {
1199
- const { isAuthenticated: y, user: $ } = _;
1200
- try {
1201
- if (y && $ && $.userId) {
1202
- if (l) {
1203
- const A = await Y(l);
1204
- if (A && A.payload[I.USER_ID_KEY] !== "")
1205
- return l;
1206
- }
1207
- const b = await O.refreshtoken({
1208
- clientId: r,
1209
- userId: $.userId,
1210
- nonce: f,
1211
- domain: a
1212
- });
1213
- return b.status && b.status === "success" ? (d(b.newAccessToken), m(b.newRefreshToken), b.newAccessToken) : (await C(Se), "");
1214
- }
1215
- return await C(Se), "";
1216
- } catch {
1217
- return await C(Se), "";
1218
- }
1219
- }, fe = () => {
1220
- if (_.isAuthenticated && o)
1221
- return o;
1222
- };
1223
- return /* @__PURE__ */ c(
1224
- ht.Provider,
1225
- {
1226
- value: { ..._, login: N, logout: V, getAccessToken: R, getIdToken: fe },
1227
- children: e
1228
- }
1229
- );
1230
- }, xe = (e = ht) => Ze(e), rn = "user", an = "assistant", nn = "system", on = "internal", sn = "hidden", cn = "I'm having trouble right now. Please try again later.", ln = "gpt-4", dn = 128e3, un = "action-message", mn = "action-reset", hn = "action-model", pn = "action-restore", gn = "action-location", fn = "action-streaming", yn = "action-search", bn = "action-sort", wn = "sassy-saint-", En = "details", vn = "search", kn = "sort", Sn = "location", Tn = "==stats==", Wr = "b44c68f0-e5b3-4a1d-a3e3-df8632b0223b", qe = (e) => Number.isFinite(e) ? e : 0;
1231
- function jr(e) {
1232
- return {
1233
- days: Math.trunc(e / 864e5),
1234
- hours: Math.trunc(e / 36e5 % 24),
1235
- minutes: Math.trunc(e / 6e4 % 60),
1236
- seconds: Math.trunc(e / 1e3 % 60),
1237
- milliseconds: Math.trunc(e % 1e3),
1238
- microseconds: Math.trunc(qe(e * 1e3) % 1e3),
1239
- nanoseconds: Math.trunc(qe(e * 1e6) % 1e3)
1240
- };
1241
- }
1242
- function Gr(e) {
1243
- return {
1244
- days: e / 86400000n,
1245
- hours: e / 3600000n % 24n,
1246
- minutes: e / 60000n % 60n,
1247
- seconds: e / 1000n % 60n,
1248
- milliseconds: e % 1000n,
1249
- microseconds: 0n,
1250
- nanoseconds: 0n
1251
- };
1252
- }
1253
- function Vr(e) {
1254
- switch (typeof e) {
1255
- case "number": {
1256
- if (Number.isFinite(e))
1257
- return jr(e);
1258
- break;
1259
- }
1260
- case "bigint":
1261
- return Gr(e);
1262
- }
1263
- throw new TypeError("Expected a finite number or bigint");
1264
- }
1265
- const Jr = (e) => e === 0 || e === 0n, Fr = (e, t) => t === 1 || t === 1n ? e : `${e}s`, zr = 1e-7, Yr = 24n * 60n * 60n * 1000n;
1266
- function qr(e, t) {
1267
- const r = typeof e == "bigint";
1268
- if (!r && !Number.isFinite(e))
1269
- throw new TypeError("Expected a finite number or bigint");
1270
- t = { ...t }, 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);
1271
- let a = [];
1272
- const n = (d, h) => {
1273
- const u = Math.floor(d * 10 ** h + zr);
1274
- return (Math.round(u) / 10 ** h).toFixed(h);
1275
- }, o = (d, h, u, m) => {
1276
- if (!((a.length === 0 || !t.colonNotation) && Jr(d) && !(t.colonNotation && u === "m"))) {
1277
- if (m = m ?? String(d), t.colonNotation) {
1278
- const p = m.includes(".") ? m.split(".")[0].length : m.length, f = a.length > 0 ? 2 : 1;
1279
- m = "0".repeat(Math.max(0, f - p)) + m;
1280
- } else
1281
- m += t.verbose ? " " + Fr(h, d) : u;
1282
- a.push(m);
1283
- }
1284
- }, s = Vr(e), i = BigInt(s.days);
1285
- if (o(i / 365n, "year", "y"), o(i % 365n, "day", "d"), o(Number(s.hours), "hour", "h"), o(Number(s.minutes), "minute", "m"), t.separateMilliseconds || t.formatSubMilliseconds || !t.colonNotation && e < 1e3) {
1286
- const d = Number(s.seconds), h = Number(s.milliseconds), u = Number(s.microseconds), m = Number(s.nanoseconds);
1287
- if (o(d, "second", "s"), t.formatSubMilliseconds)
1288
- o(h, "millisecond", "ms"), o(u, "microsecond", "µs"), o(m, "nanosecond", "ns");
1289
- else {
1290
- const p = h + u / 1e3 + m / 1e6, f = typeof t.millisecondsDecimalDigits == "number" ? t.millisecondsDecimalDigits : 0, w = p >= 1 ? Math.round(p) : Math.ceil(p), x = f ? p.toFixed(f) : w;
1291
- o(
1292
- Number.parseFloat(x),
1293
- "millisecond",
1294
- "ms",
1295
- x
1296
- );
1297
- }
1298
- } else {
1299
- const d = (r ? Number(e % Yr) : e) / 1e3 % 60, h = typeof t.secondsDecimalDigits == "number" ? t.secondsDecimalDigits : 1, u = n(d, h), m = t.keepDecimalsOnWholeSeconds ? u : u.replace(/\.0+$/, "");
1300
- o(Number.parseFloat(m), "second", "s", m);
1301
- }
1302
- if (a.length === 0)
1303
- return "0" + (t.verbose ? " milliseconds" : "ms");
1304
- const l = t.colonNotation ? ":" : " ";
1305
- return typeof t.unitCount == "number" && (a = a.slice(0, Math.max(t.unitCount, 1))), a.join(l);
1306
- }
1307
- const Qr = process.env.NODE_ENV === "production", Ne = !Qr, Xr = Ne ? "gizmette.local.com" : "gizmette.com", An = (e, t) => e.length > t ? e.substring(0, t) + "..." : e, pt = (e, t) => {
1308
- const r = e < 0 ? t ? "W" : "S" : t ? "E" : "N", a = 0 | Math.abs(e), n = 0 | Math.abs(e) * 60 % 60, o = (0 | Math.abs(e) * 60 % 1 * 6e3) / 100;
1309
- return {
1310
- dir: r,
1311
- deg: a,
1312
- min: n,
1313
- sec: o
1314
- };
1315
- }, _n = (e) => {
1316
- if (!e && e !== 0)
1317
- return "N/A";
1318
- const t = pt(e, !1);
1319
- return `${t.deg}° ${t.min}' ${t.sec}" ${t.dir}`;
1320
- }, In = (e) => {
1321
- if (!e && e !== 0)
1322
- return "N/A";
1323
- const t = pt(e, !0);
1324
- return `${t.deg}° ${t.min}' ${t.sec}" ${t.dir}`;
1325
- }, xn = async () => {
1326
- const e = {
1327
- /**
1328
- * A boolean value that indicates the application would
1329
- * like to receive the best possible results. If true
1330
- * and if the device is able to provide a more accurate
1331
- * position, it will do so. Note that this can result in
1332
- * slower response times or increased power consumption
1333
- * (with a GPS chip on a mobile device for example). On
1334
- * the other hand, if false, the device can take the
1335
- * liberty to save resources by responding more quickly
1336
- * and/or using less power. Default: false.
1337
- */
1338
- enableHighAccuracy: !1,
1339
- /**
1340
- * A positive long value representing the maximum length
1341
- * of time (in milliseconds) the device is allowed to
1342
- * take in order to return a position. The default value
1343
- * is Infinity, meaning that getCurrentPosition() won't
1344
- * return until the position is available.
1345
- */
1346
- timeout: 1e4,
1347
- /**
1348
- * A positive long value indicating the maximum age in
1349
- * milliseconds of a possible cached position that is
1350
- * acceptable to return. If set to 0, it means that the
1351
- * device cannot use a cached position and must attempt
1352
- * to retrieve the real current position. If set to
1353
- * Infinity the device must return a cached position
1354
- * regardless of its age. Default: 0.
1355
- */
1356
- maximumAge: 6e4
1357
- };
1358
- return new Promise((t, r) => {
1359
- var a;
1360
- (a = navigator == null ? void 0 : navigator.geolocation) == null || a.getCurrentPosition(
1361
- (n) => {
1362
- t({
1363
- latitude: n.coords.latitude,
1364
- longitude: n.coords.longitude,
1365
- accuracy: n.coords.accuracy
1366
- });
1367
- },
1368
- (n) => {
1369
- r(n);
1370
- },
1371
- e
1372
- );
1373
- });
1374
- }, Nn = (e, t) => t ? Object.keys(t).map((r) => /* @__PURE__ */ c("dl", { className: "my-0", children: /* @__PURE__ */ T("div", { className: "flex items-center justify-between", children: [
1375
- /* @__PURE__ */ c("dt", { className: "inline-block font-bold text-copy-dark dark:text-copy-lighter", children: r }),
1376
- /* @__PURE__ */ c("dd", { className: "inline-block", children: t[r] })
1377
- ] }) }, `${e}-${r}`)) : null;
1378
- function Cn({
1379
- data: e,
1380
- formatter: t = (r) => r
1381
- }) {
1382
- const r = e.filter(
1383
- (n) => typeof n == "number" && n > 0
1384
- ), a = r.reduce(
1385
- (n, o) => (n || 0) + (o || 0),
1386
- 0
1387
- );
1388
- return t(a ? a / r.length : 0);
1389
- }
1390
- const Rn = (e, t) => t && t.messages.length > 0 && t.messages[t.messages.length - 1].message.role === e, On = new Intl.NumberFormat("en", {
1391
- style: "decimal",
1392
- signDisplay: "never",
1393
- minimumFractionDigits: 0,
1394
- maximumFractionDigits: 0
1395
- }), Dn = (e) => qr(e, {
1396
- secondsDecimalDigits: 2,
1397
- unitCount: 2
1398
- }), Zr = (e) => g(
1399
- "flex-1 space-y-6 overflow-y-auto rounded-md bg-slate-900 px-4 pb-10 text-base leading-6 text-slate-300 shadow-sm sm:text-base sm:leading-7",
1400
- e || Ne ? "pt-4" : "pt-10"
1401
- ), $n = (e, t) => t === 1 ? e : `${e}s`, Ce = (e) => {
1402
- let t = "";
1403
- if (typeof e == "number" || typeof e == "string")
1404
- t = "m-" + e;
1405
- else {
1406
- const r = [];
1407
- (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
1408
- }
1409
- return t;
1410
- }, Mn = "av-bubble", Qe = "av-button", Ln = "av-card", ea = "av-footer", ta = "av-main", Pn = "av-messagebox", Un = "av-panel", Hn = "av-spinner", gt = "icon", ft = "button", ra = "link", aa = ({
1411
- type: e,
1412
- size: t,
1413
- labelRight: r,
1414
- labelLeft: a,
1415
- align: n
1416
- }) => {
1417
- const o = "text-sm font-medium max-h-8 py-0", s = "text-base font-medium max-h-9 py-1", i = "text-lg font-medium max-h-12 py-2";
1418
- switch (e) {
1419
- case ft:
1420
- return g("px-4", {
1421
- [o]: t === "small",
1422
- [s]: t === "medium",
1423
- [i]: t === "large"
1424
- });
1425
- case ra:
1426
- return g("px-4 text-center", {
1427
- [o]: t === "small",
1428
- [s]: t === "medium",
1429
- [i]: t === "large"
1430
- });
1431
- case gt:
1432
- return g("inline-flex items-center", {
1433
- "justify-center": n === "center",
1434
- "justify-start": n === "left",
1435
- "justify-end": n === "right",
1436
- "h-6 w-6 p-0": t === "small" && !(r || a),
1437
- "h-6 px-4 text-sm font-medium": t === "small" && (r || a),
1438
- "h-8 w-8 p-1": t === "medium" && !(r || a),
1439
- "h-8 px-4 text-base font-medium": t === "medium" && (r || a),
1440
- "h-12 w-12 p-2": t === "large" && !(r || a),
1441
- "h-12 px-4 text-lg font-medium": t === "large" && (r || a)
1442
- });
1443
- }
1444
- }, na = ({
1445
- mode: e,
1446
- noBackground: t,
1447
- noTruncate: r,
1448
- variant: a
1449
- }) => {
1450
- if (t)
1451
- return "not-prose rounded-full";
1452
- if (a === "primary")
1453
- return g("not-prose rounded-full", {
1454
- truncate: !r,
1455
- "bg-action-dark text-copy-light": e === "dark",
1456
- "bg-action-light text-copy-lighter": e === "light",
1457
- "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
1458
- "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
1459
- });
1460
- if (a === "secondary")
1461
- return g("not-prose rounded-full", {
1462
- truncate: !r,
1463
- "bg-action-dark text-copy-light": e === "light",
1464
- "bg-action-light text-copy-lighter": e === "dark",
1465
- "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
1466
- "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
1467
- });
1468
- if (a === "danger")
1469
- return g("not-prose rounded-full", {
1470
- truncate: !r,
1471
- "bg-action-danger-dark text-copy-light": e === "dark",
1472
- "bg-action-danger-light text-copy-lighter": e === "light",
1473
- "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
1474
- "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
1475
- });
1476
- }, oa = ({
1477
- mode: e,
1478
- disabled: t,
1479
- variant: r
1480
- }) => {
1481
- if (t)
1482
- return "";
1483
- if (r === "primary")
1484
- return g("hover:text-copy-light-hover", {
1485
- "hover:bg-action-dark-hover": e === "dark",
1486
- "hover:bg-action-light-hover": e === "light",
1487
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
1488
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
1489
- });
1490
- if (r === "secondary")
1491
- return g("hover:text-copy-light-hover", {
1492
- "hover:bg-action-dark-hover": e === "light",
1493
- "hover:bg-action-light-hover": e === "dark",
1494
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
1495
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
1496
- });
1497
- if (r === "danger")
1498
- return g("hover:text-copy-light-hover", {
1499
- "hover:bg-action-danger-dark-hover": e === "dark",
1500
- "hover:bg-action-danger-light-hover": e === "light",
1501
- "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
1502
- "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
1503
- });
1504
- }, sa = ({
1505
- mode: e,
1506
- disabled: t,
1507
- variant: r
1508
- }) => {
1509
- if (t)
1510
- return "";
1511
- if (r === "primary")
1512
- return g("active:text-copy-light-active", {
1513
- "active:bg-action-dark-active": e === "dark",
1514
- "active:bg-action-light-active": e === "light",
1515
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
1516
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
1517
- });
1518
- if (r === "secondary")
1519
- return g("active:text-copy-light-active", {
1520
- "active:bg-action-dark-active": e === "light",
1521
- "active:bg-action-light-active": e === "dark",
1522
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
1523
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
1524
- });
1525
- if (r === "danger")
1526
- return g("active:text-copy-lighter-active", {
1527
- "active:bg-action-danger-dark-active": e === "dark",
1528
- "active:bg-action-danger-light-active": e === "light",
1529
- "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
1530
- "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
1531
- });
1532
- }, ia = ({
1533
- mode: e,
1534
- noBorder: t,
1535
- variant: r
1536
- }) => {
1537
- if (t)
1538
- return "border border-transparent";
1539
- if (r === "primary")
1540
- return g("border", {
1541
- "border-border-dark": e === "dark",
1542
- "border-border-accent": e === "light",
1543
- "border-border-dark dark:border-border-accent": e === "system",
1544
- "border-border-accent dark:border-border-dark": e === "alt-system"
1545
- });
1546
- if (r === "secondary")
1547
- return g("border", {
1548
- "border-border-dark": e === "light",
1549
- "border-border-accent": e === "dark",
1550
- "border-border-dark dark:border-border-accent": e === "alt-system",
1551
- "border-border-accent dark:border-border-dark": e === "system"
1552
- });
1553
- if (r === "danger")
1554
- return g("border", {
1555
- "border-border-danger-dark": e === "dark",
1556
- "border-border-danger-medium": e === "light",
1557
- "border-border-danger-dark dark:border-border-danger-medium": e === "system",
1558
- "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
1559
- });
1560
- }, ca = ({ focusMode: e }) => g("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
1561
- "focus:outline-focus-dark": e === "dark",
1562
- "focus:outline-focus-light": e === "light",
1563
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
1564
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
1565
- }), yt = ({
1566
- type: e,
1567
- className: t,
1568
- raw: r,
1569
- mode: a,
1570
- focusMode: n,
1571
- disabled: o,
1572
- fullWidth: s,
1573
- size: i,
1574
- noBorder: l,
1575
- labelRight: d,
1576
- labelLeft: h,
1577
- spacing: u,
1578
- noBackground: m,
1579
- variant: p,
1580
- noTruncate: f,
1581
- align: w
1582
- }) => (p || (p = "primary"), r ? g(Qe, t) : g(
1583
- Qe,
1584
- t,
1585
- Ce(u),
1586
- na({ mode: a, variant: p, noBackground: m, noTruncate: f }),
1587
- aa({ type: e, size: i, labelRight: d, labelLeft: h, align: w }),
1588
- ia({ mode: a, variant: p, noBorder: l }),
1589
- ca({ focusMode: n }),
1590
- oa({ mode: a, variant: p, disabled: o }),
1591
- sa({ mode: a, variant: p, disabled: o }),
1592
- {
1593
- "w-full": s,
1594
- "disabled:cursor-not-allowed disabled:opacity-50": o
1595
- }
1596
- )), la = (e, t, r) => {
1597
- var a;
1598
- !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
1599
- }, Re = K.forwardRef(
1600
- (e, t) => {
1601
- const { onClick: r, noInternalClick: a = !1, ...n } = e;
1602
- return /* @__PURE__ */ c(
1603
- "button",
1604
- {
1605
- ref: t,
1606
- onClick: (o) => {
1607
- la(o, a, r);
1608
- },
1609
- ...n
1610
- }
1611
- );
1612
- }
1613
- );
1614
- Re.displayName = "BaseButton";
1615
- const bt = K.forwardRef(
1616
- ({
1617
- children: e,
1618
- disabled: t = !1,
1619
- mode: r = "system",
1620
- focusMode: a = "system",
1621
- fullWidth: n = !1,
1622
- className: o,
1623
- type: s = "button",
1624
- raw: i = !1,
1625
- noBorder: l = !1,
1626
- "aria-label": d,
1627
- label: h,
1628
- size: u = "medium",
1629
- labelRight: m,
1630
- labelLeft: p,
1631
- spacing: f,
1632
- noBackground: w = !1,
1633
- align: x = "center",
1634
- ...O
1635
- }, _) => {
1636
- const S = yt({
1637
- type: gt,
1638
- mode: r,
1639
- focusMode: a,
1640
- fullWidth: n,
1641
- disabled: t,
1642
- raw: i,
1643
- className: o,
1644
- noBorder: l,
1645
- size: u,
1646
- labelRight: m,
1647
- labelLeft: p,
1648
- spacing: f,
1649
- noBackground: w,
1650
- align: x
1651
- }), D = g({
1652
- "text-copy-accent-dark": r === "light" && !i,
1653
- "text-copy-light": r === "dark" && !i,
1654
- "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !i,
1655
- "text-copy-light dark:text-copy-accent-dark": r === "system" && !i
1656
- });
1657
- return /* @__PURE__ */ T(
1658
- Re,
1659
- {
1660
- ref: _,
1661
- className: S,
1662
- disabled: t,
1663
- type: s,
1664
- "aria-label": d || h,
1665
- ...O,
1666
- children: [
1667
- p && /* @__PURE__ */ c("span", { className: "pr-2", children: p }),
1668
- /* @__PURE__ */ c("div", { className: D, children: e }),
1669
- m && /* @__PURE__ */ c("span", { className: "pl-2", children: m })
1670
- ]
1671
- }
1672
- );
1673
- }
1674
- );
1675
- bt.displayName = "ButtonIcon";
1676
- const wt = K.forwardRef(
1677
- ({
1678
- children: e,
1679
- disabled: t = !1,
1680
- mode: r = "system",
1681
- focusMode: a = "system",
1682
- fullWidth: n = !1,
1683
- className: o,
1684
- size: s = "medium",
1685
- raw: i = !1,
1686
- noBorder: l = !1,
1687
- spacing: d,
1688
- variant: h = "primary",
1689
- noTruncate: u = !1,
1690
- ...m
1691
- }, p) => {
1692
- const f = yt({
1693
- type: ft,
1694
- mode: r,
1695
- focusMode: a,
1696
- fullWidth: n,
1697
- disabled: t,
1698
- raw: i,
1699
- className: o,
1700
- size: s,
1701
- noBorder: l,
1702
- spacing: d,
1703
- variant: h,
1704
- noTruncate: u
1705
- });
1706
- return /* @__PURE__ */ c(
1707
- Re,
1708
- {
1709
- ref: p,
1710
- className: f,
1711
- disabled: t,
1712
- ...m,
1713
- children: e
1714
- }
1715
- );
1716
- }
1717
- );
1718
- wt.displayName = "Button";
1719
- const da = ({
1720
- className: e,
1721
- mode: t = "system",
1722
- row1: r,
1723
- row2: a,
1724
- noMargins: n = !1,
1725
- spacing: o,
1726
- raw: s = !1
1727
- }) => {
1728
- const i = g(ea, e, Ce(o), {
1729
- "text-copy-dark": !s && t === "dark",
1730
- "text-copy-lighter": !s && t === "light",
1731
- "text-copy-dark dark:text-copy-lighter": !s && t === "system",
1732
- "text-copy-lighter dark:text-copy-dark": !s && t === "alt-system",
1733
- "mb-[100px]": !n && !s,
1734
- "mt-0 flex w-full flex-col p-2 text-center text-xs sm:mt-3 md:mx-auto md:max-w-4xl": !s
1735
- });
1736
- return /* @__PURE__ */ T("footer", { className: i, children: [
1737
- r && /* @__PURE__ */ c("div", { children: r }),
1738
- a && /* @__PURE__ */ c("div", { children: a })
1739
- ] });
1740
- }, ua = ({
1741
- children: e,
1742
- className: t,
1743
- raw: r = !1,
1744
- spacing: a
1745
- }) => {
1746
- const n = g(t, ta, Ce(a), {
1747
- "mt-2 flex w-full flex-col p-2 sm:mt-3 md:mx-auto md:max-w-4xl": !r
1748
- });
1749
- return /* @__PURE__ */ c("main", { className: n, children: e });
1750
- };
1751
- /*!
1752
- @versini/ui-components v5.20.0
1753
- © 2024 gizmette.com
1754
- */
1755
- try {
1756
- window.__VERSINI_UI_GLOBAL__ || (window.__VERSINI_UI_GLOBAL__ = {
1757
- version: "5.20.0",
1758
- buildTime: "07/06/2024 10:24 AM EDT",
1759
- homepage: "https://github.com/aversini/ui-components",
1760
- license: "MIT"
1761
- });
1762
- } catch {
1763
- }
1764
- function ma(e) {
1765
- return Nt(() => e.every((t) => t == null) ? () => {
1766
- } : (t) => {
1767
- e.forEach((r) => {
1768
- typeof r == "function" ? r(t) : r != null && (r.current = t);
1769
- });
1770
- }, e);
1771
- }
1772
- function ha(e) {
1773
- const t = Ct();
1774
- if (!e)
1775
- return t;
1776
- if (typeof e == "number" || typeof e == "string")
1777
- return `${e}${t}`;
1778
- if (typeof e == "object") {
1779
- const { id: r, prefix: a = "" } = e;
1780
- return typeof r == "number" || typeof r == "string" ? `${a}${r}` : `${a}${t}`;
1781
- }
1782
- }
1783
- const Et = "SET_ANNOUNCEMENT", vt = "CLEAR_ANNOUNCEMENT", pa = {
1784
- alert: null,
1785
- alertdialog: null,
1786
- log: "polite",
1787
- marquee: null,
1788
- progressbar: null,
1789
- status: "polite",
1790
- timer: "assertive"
1791
- }, ga = (e, t) => {
1792
- switch (t == null ? void 0 : t.type) {
1793
- case Et:
1794
- return {
1795
- ...e,
1796
- announcement: t.payload
1797
- };
1798
- case vt:
1799
- return {
1800
- ...e,
1801
- announcement: null
1802
- };
1803
- default:
1804
- return e;
1805
- }
1806
- }, fa = ({
1807
- onAnnouncementClear: e,
1808
- dispatch: t
1809
- }) => {
1810
- t({
1811
- type: vt
1812
- }), typeof e == "function" && e();
1813
- }, Xe = ({
1814
- children: e,
1815
- clearAnnouncementDelay: t,
1816
- clearAnnouncementTimeoutRef: r,
1817
- onAnnouncementClear: a,
1818
- dispatch: n
1819
- }) => {
1820
- (r == null ? void 0 : r.current) !== null && clearTimeout(r.current), e !== null && n({
1821
- type: Et,
1822
- payload: e
1823
- }), t && (r.current = setTimeout(
1824
- () => fa({
1825
- onAnnouncementClear: a,
1826
- dispatch: n
1827
- }),
1828
- t
1829
- ));
1830
- }, ya = ({
1831
- children: e,
1832
- announcementTimeoutRef: t,
1833
- announcementDelay: r,
1834
- clearAnnouncementDelay: a,
1835
- clearAnnouncementTimeoutRef: n,
1836
- onAnnouncementClear: o,
1837
- dispatch: s
1838
- }) => {
1839
- clearTimeout(t.current), r ? t.current = setTimeout(Xe, r, {
1840
- children: e,
1841
- clearAnnouncementDelay: a,
1842
- clearAnnouncementTimeoutRef: n,
1843
- onAnnouncementClear: o,
1844
- dispatch: s
1845
- }) : Xe({
1846
- children: e,
1847
- clearAnnouncementDelay: a,
1848
- clearAnnouncementTimeoutRef: n,
1849
- onAnnouncementClear: o,
1850
- dispatch: s
1851
- });
1852
- };
1853
- function kt({
1854
- children: e,
1855
- className: t,
1856
- politeness: r,
1857
- role: a = null,
1858
- announcementDelay: n,
1859
- clearAnnouncementDelay: o,
1860
- onAnnouncementClear: s,
1861
- visible: i,
1862
- ...l
1863
- }) {
1864
- const d = W(), h = W(), [u, m] = Rt(ga, {
1865
- announcement: null
1866
- });
1867
- let p = r;
1868
- typeof p > "u" && (p = a ? pa[a] : "assertive"), z(() => {
1869
- ya({
1870
- announcementTimeoutRef: d,
1871
- announcementDelay: n,
1872
- children: e,
1873
- clearAnnouncementDelay: o,
1874
- clearAnnouncementTimeoutRef: h,
1875
- onAnnouncementClear: s,
1876
- dispatch: m
1877
- });
1878
- }, [
1879
- e,
1880
- n,
1881
- o,
1882
- s
1883
- ]);
1884
- const f = g(t, {
1885
- "sr-only": !i
1886
- });
1887
- return /* @__PURE__ */ c(
1888
- "div",
1889
- {
1890
- "aria-live": p,
1891
- ...a && { role: a },
1892
- className: f,
1893
- ...l,
1894
- children: u.announcement
1895
- }
1896
- );
1897
- }
1898
- /*!
1899
- @versini/ui-private v1.4.5
1900
- © 2024 gizmette.com
1901
- */
1902
- try {
1903
- window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
1904
- version: "1.4.5",
1905
- buildTime: "07/01/2024 11:35 AM EDT",
1906
- homepage: "https://github.com/aversini/ui-components",
1907
- license: "MIT"
1908
- });
1909
- } catch {
1910
- }
1911
- const ba = (e) => {
1912
- let t = "";
1913
- if (typeof e == "number" || typeof e == "string")
1914
- t = "m-" + e;
1915
- else {
1916
- const r = [];
1917
- (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
1918
- }
1919
- return t;
1920
- }, St = "av-text-input", wa = "av-text-input-wrapper", Te = "av-text-input-helper-text", Kn = "av-text-area", Bn = "av-text-area-wrapper", Wn = "av-text-area-helper-text", jn = "av-text-area__control--right", Gn = "av-toggle", Ea = ({
1921
- mode: e
1922
- }) => g({
1923
- "bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
1924
- "bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
1925
- "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
1926
- "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
1927
- }), va = ({
1928
- focusMode: e
1929
- }) => g("focus:outline focus:outline-2 focus:outline-offset-2", {
1930
- "focus:outline-focus-dark": e === "dark",
1931
- "focus:outline-focus-light": e === "light",
1932
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
1933
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
1934
- }), ka = ({
1935
- noBorder: e,
1936
- error: t
1937
- }) => g("border-2", {
1938
- "border-border-dark": !e && !t,
1939
- "focus:border-border-dark": !e && t,
1940
- "border-border-error-dark": !e && t,
1941
- "border-transparent": e
1942
- }), Sa = ({
1943
- disabled: e,
1944
- raw: t,
1945
- error: r,
1946
- mode: a
1947
- }) => {
1948
- if (t)
1949
- return "";
1950
- if (e)
1951
- return g("absolute px-2 cursor-not-allowed opacity-50 font-medium");
1952
- if (!r)
1953
- return g("absolute px-2 cursor-text font-medium", {
1954
- "text-copy-lighter": a === "dark",
1955
- "text-copy-dark": a === "light",
1956
- "text-copy-dark dark:text-copy-lighter": a === "system",
1957
- "text-copy-lighter dark:text-copy-dark": a === "alt-system"
1958
- });
1959
- if (r)
1960
- return g("absolute px-2 cursor-text font-medium", {
1961
- "text-copy-lighter": a === "dark",
1962
- "text-copy-error-dark": a === "light",
1963
- "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": a === "system",
1964
- "text-copy-lighter dark:text-copy-error-dark": a === "alt-system"
1965
- });
1966
- }, Ta = ({
1967
- error: e,
1968
- raw: t,
1969
- mode: r,
1970
- disabled: a
1971
- }) => {
1972
- if (t)
1973
- return "";
1974
- if (a)
1975
- return g(
1976
- Te,
1977
- "absolute px-2 cursor-not-allowed opacity-50 font-medium"
1978
- );
1979
- if (!e)
1980
- return g(Te, "absolute px-2 font-medium", {
1981
- "text-copy-lighter": r === "dark",
1982
- "text-copy-dark": r === "light",
1983
- "text-copy-dark dark:text-copy-lighter": r === "system",
1984
- "text-copy-lighter dark:text-copy-dark": r === "alt-system"
1985
- });
1986
- if (e)
1987
- return g(Te, "absolute px-2 font-medium", {
1988
- "text-copy-error-light bg-surface-darker": r === "dark",
1989
- "text-copy-error-dark": r === "light",
1990
- "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": r === "system",
1991
- "dark:text-copy-error-dark text-copy-error-light bg-surface-darker": r === "alt-system"
1992
- });
1993
- }, Aa = ({
1994
- className: e,
1995
- inputClassName: t,
1996
- raw: r,
1997
- disabled: a,
1998
- noBorder: n,
1999
- error: o,
2000
- spacing: s,
2001
- mode: i,
2002
- focusMode: l
2003
- }) => {
2004
- const d = r ? e : g(
2005
- "relative flex w-full flex-col justify-center",
2006
- wa,
2007
- e,
2008
- ba(s)
2009
- ), h = r ? g(t) : g(
2010
- St,
2011
- t,
2012
- "h-12 rounded-md px-4 text-base",
2013
- Ea({ mode: i }),
2014
- va({ focusMode: l }),
2015
- ka({ noBorder: n, error: o }),
2016
- {
2017
- "disabled:cursor-not-allowed disabled:opacity-50": a
2018
- }
2019
- ), u = r ? void 0 : "sr-only", m = Sa({
2020
- disabled: a,
2021
- raw: r,
2022
- error: o,
2023
- mode: i
2024
- }), p = Ta({
2025
- error: o,
2026
- raw: r,
2027
- mode: i,
2028
- disabled: a
2029
- });
2030
- return {
2031
- wrapper: d,
2032
- input: h,
2033
- accessibleLabel: u,
2034
- visibleLabel: m,
2035
- helperText: p,
2036
- rightElement: r ? void 0 : "absolute right-3"
2037
- };
2038
- }, Oe = K.forwardRef(
2039
- ({
2040
- id: e,
2041
- name: t,
2042
- label: r,
2043
- error: a = !1,
2044
- raw: n = !1,
2045
- className: o,
2046
- inputClassName: s,
2047
- mode: i = "system",
2048
- focusMode: l = "system",
2049
- disabled: d = !1,
2050
- noBorder: h = !1,
2051
- labelId: u,
2052
- labelHidden: m = !1,
2053
- type: p = "text",
2054
- helperText: f = "",
2055
- rightElement: w,
2056
- spacing: x,
2057
- ...O
2058
- }, _) => {
2059
- const S = W(null), [D, C] = U(0), N = ha({ id: e, prefix: `${St}-` }), V = `${t} error, ${f}`, R = Aa({
2060
- className: o,
2061
- inputClassName: s,
2062
- error: a,
2063
- raw: n,
2064
- focusMode: l,
2065
- disabled: d,
2066
- noBorder: h,
2067
- spacing: x,
2068
- mode: i
2069
- });
2070
- return Ot(() => {
2071
- S.current && C(S.current.offsetWidth + 18 + 10);
2072
- }, []), /* @__PURE__ */ T("div", { className: R.wrapper, children: [
2073
- /* @__PURE__ */ c(
2074
- "label",
2075
- {
2076
- htmlFor: N,
2077
- id: u,
2078
- className: R.accessibleLabel,
2079
- children: r
2080
- }
2081
- ),
2082
- /* @__PURE__ */ c(
2083
- "input",
2084
- {
2085
- ref: _,
2086
- id: N,
2087
- name: t,
2088
- type: p,
2089
- disabled: d,
2090
- placeholder: n ? void 0 : " ",
2091
- className: R.input,
2092
- ...f && { "aria-describedby": `${N}-helper` },
2093
- ...a && { "aria-invalid": "true" },
2094
- ...w && !n && { style: { paddingRight: D } },
2095
- ...O
2096
- }
2097
- ),
2098
- !n && !m && /* @__PURE__ */ c(
2099
- "label",
2100
- {
2101
- "aria-hidden": !0,
2102
- htmlFor: N,
2103
- className: R.visibleLabel,
2104
- children: r
2105
- }
2106
- ),
2107
- f && /* @__PURE__ */ c(
2108
- "div",
2109
- {
2110
- id: `${N}-helper`,
2111
- className: R.helperText,
2112
- children: f
2113
- }
2114
- ),
2115
- w && /* @__PURE__ */ c(
2116
- "div",
2117
- {
2118
- ref: S,
2119
- className: R.rightElement,
2120
- children: w
2121
- }
2122
- ),
2123
- a && f && /* @__PURE__ */ c(kt, { politeness: "polite", clearAnnouncementDelay: 500, children: V })
2124
- ] });
2125
- }
2126
- );
2127
- Oe.displayName = "TextInput";
2128
- const _a = 500, Ia = 5e3, xa = 2e4, Tt = K.forwardRef(
2129
- ({
2130
- name: e,
2131
- disabled: t,
2132
- label: r,
2133
- labelHidden: a,
2134
- onMaskChange: n,
2135
- onChange: o,
2136
- onBlur: s,
2137
- onFocus: i,
2138
- onTextInputMaskBlur: l,
2139
- rightElement: d,
2140
- spacing: h,
2141
- ...u
2142
- }, m) => {
2143
- const [p, f] = U(!0), [w, x] = U({
2144
- message: null,
2145
- politeness: null
2146
- }), O = W(!0), _ = W(), S = W(null), D = ma([m, S]), C = p ? "Show" : "Hide", N = () => {
2147
- clearTimeout(_.current), O.current || (_.current = window.setTimeout(() => {
2148
- O.current = !0, f(!0), x({
2149
- announcementTimeout: Ia,
2150
- politeness: "polite",
2151
- message: `${r} hiding characters`
2152
- }), n && n(!0);
2153
- }, xa));
2154
- }, V = (b) => {
2155
- b.preventDefault();
2156
- const A = !O.current;
2157
- O.current = A, N(), f(A), x({
2158
- announcementTimeout: _a,
2159
- politeness: "assertive",
2160
- message: A ? "Characters hidden" : "Characters showing"
2161
- }), n && n(A);
2162
- }, R = (b) => {
2163
- var A;
2164
- const { relatedTarget: B } = b, G = (A = S.current) == null ? void 0 : A.parentElement;
2165
- G != null && G.contains(B) || l && l();
2166
- }, fe = (b) => {
2167
- N(), s && s(b), R(b);
2168
- }, y = (b) => {
2169
- N(), i && i(b);
2170
- }, $ = (b) => {
2171
- N(), o && o(b);
2172
- };
2173
- return z(() => () => {
2174
- clearTimeout(_.current);
2175
- }, []), /* @__PURE__ */ T(q, { children: [
2176
- /* @__PURE__ */ c(
2177
- Oe,
2178
- {
2179
- ref: D,
2180
- name: e,
2181
- label: r,
2182
- labelHidden: a,
2183
- type: p ? "password" : "text",
2184
- disabled: t,
2185
- spacing: h,
2186
- onBlur: fe,
2187
- onFocus: y,
2188
- onChange: $,
2189
- rightElement: K.cloneElement(d, {
2190
- ref: m,
2191
- label: C,
2192
- onClick: V,
2193
- onBlur: R,
2194
- disabled: t
2195
- }),
2196
- ...u
2197
- }
2198
- ),
2199
- /* @__PURE__ */ c(
2200
- kt,
2201
- {
2202
- role: "status",
2203
- politeness: w.politeness,
2204
- clearAnnouncementDelay: w.announcementTimeout,
2205
- children: w.message
2206
- }
2207
- )
2208
- ] });
2209
- }
2210
- );
2211
- Tt.displayName = "TextInputMask";
2212
- /*!
2213
- @versini/ui-form v1.3.5
2214
- © 2024 gizmette.com
2215
- */
2216
- try {
2217
- window.__VERSINI_UI_FORM__ || (window.__VERSINI_UI_FORM__ = {
2218
- version: "1.3.5",
2219
- buildTime: "07/01/2024 11:36 AM EDT",
2220
- homepage: "https://github.com/aversini/ui-components",
2221
- license: "MIT"
2222
- });
2223
- } catch {
2224
- }
2225
- const Na = (e) => {
2226
- let t = "";
2227
- if (typeof e == "number" || typeof e == "string")
2228
- t = "m-" + e;
2229
- else {
2230
- const r = [];
2231
- (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
2232
- }
2233
- return t;
2234
- }, De = ({
2235
- children: e,
2236
- fill: t,
2237
- viewBox: r,
2238
- className: a,
2239
- defaultViewBox: n,
2240
- defaultClassName: o,
2241
- spacing: s,
2242
- title: i,
2243
- semantic: l = !1,
2244
- ...d
2245
- }) => {
2246
- const h = Na(s), u = g(
2247
- h,
2248
- a || o
2249
- );
2250
- return /* @__PURE__ */ T(q, { children: [
2251
- /* @__PURE__ */ c(
2252
- "svg",
2253
- {
2254
- xmlns: "http://www.w3.org/2000/svg",
2255
- className: u,
2256
- viewBox: r || n,
2257
- fill: t || "currentColor",
2258
- role: "img",
2259
- "aria-hidden": !l,
2260
- focusable: !1,
2261
- ...d,
2262
- children: e
2263
- }
2264
- ),
2265
- i && l && /* @__PURE__ */ c("span", { className: "sr-only", children: i })
2266
- ] });
2267
- };
2268
- /*!
2269
- @versini/ui-private v1.4.6
2270
- © 2024 gizmette.com
2271
- */
2272
- try {
2273
- window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
2274
- version: "1.4.6",
2275
- buildTime: "07/05/2024 05:27 PM EDT",
2276
- homepage: "https://github.com/aversini/ui-components",
2277
- license: "MIT"
2278
- });
2279
- } catch {
2280
- }
2281
- const Ca = ({
2282
- className: e,
2283
- viewBox: t,
2284
- spacing: r,
2285
- ...a
2286
- }) => /* @__PURE__ */ c(
2287
- De,
2288
- {
2289
- defaultViewBox: "0 0 1200 500",
2290
- defaultClassName: "w-full",
2291
- viewBox: t,
2292
- className: e,
2293
- spacing: r,
2294
- title: "Sassy Dog",
2295
- ...a,
2296
- children: /* @__PURE__ */ c("g", { transform: "matrix(11.9092 0 0 11.9092 470.0017 250.0009)", id: "879221", children: /* @__PURE__ */ c(
2297
- "path",
2298
- {
2299
- vectorEffect: "non-scaling-stroke",
2300
- transform: " translate(-50.7473, -45.4051)",
2301
- d: "M 89.2 27 c 0 -0.2 -0.1 -0.5 -0.3 -0.6 c -0.6 -0.4 -1.6 -0.1 -2.2 0 c -1.5 0.2 -2.9 0.4 -4.5 0.4 c -2.2 0 -4.5 -0.1 -6.7 -0.4 c -2 -0.3 -3.7 -0.9 -5.8 -0.3 c -3 0.8 -4.9 3.2 -4.8 6.3 c 0.1 1.8 -0.2 3.2 -0.8 4.8 c -0.6 1.5 -1.3 1.7 -2.7 1.7 c -9.7 0 -19.3 -0.1 -29 0 c -1.7 0 -3.5 0 -5.3 0 c -2.5 0 -5 0.5 -7.5 0 c -1.8 -0.4 -3.6 -1.3 -4.9 -2.6 c -0.3 -0.3 -0.9 -1.2 -1.2 -1.2 c -0.4 0.1 -0.4 1.3 -0.4 1.6 c 0 1.3 0.5 2.6 0.5 3.9 c 0 1.3 -0.6 2.4 -1 3.6 c -0.4 1.4 -0.4 2.8 -0.2 4.2 c 0.4 2.3 0.8 4.7 1 7.1 c 0.2 2.1 0.2 4.1 0.4 6.2 c 0.2 1.7 0.3 2.5 2.5 2.8 c 2.6 0.4 2.6 -0.5 3.2 -2.2 c 0.8 -2.1 1.5 -4.3 2.3 -6.4 c 0.7 -1.6 1.3 -5.1 5.7 -3.4 c 2.4 0.9 4.9 1.4 7.4 2.1 c 2.7 0.7 5.5 1.4 8.2 1.9 c 5.5 1.1 11.1 1.7 16.8 2 c 0.6 0 1 0 1.4 0.5 c 1.5 1.9 -0.3 5.3 3.5 5.9 c 3.4 0.5 3.4 -1.9 3.8 -4 c 0.2 -1.2 0.4 -2.3 0.7 -3.4 c 0.1 -0.5 0.5 -1 0.9 -1.3 c 4.7 -2.8 7.4 -8.3 6.6 -13.8 c -0.1 -0.9 -0.4 -1.8 -0.3 -2.8 c 0.2 -2 2.7 -2.8 4.2 -3.6 c 1.9 -1.1 4 -2.1 5.6 -3.6 c 1.1 -1 2 -2.3 2.5 -3.7 C 89.1 28.2 89.3 27.5 89.2 27 z M 73.2 40.4 c -0.2 2.1 -1.1 3.1 -3 3.5 c -3.4 0.7 -5.6 -1.6 -4.6 -4.9 c 0.7 -2.2 1.5 -4.3 2.5 -6.3 c 1 -2 1.9 -2 3.1 -0.1 C 72.7 35 73.5 37.6 73.2 40.4 z M 76.4 31.2 c -0.6 0 -1.1 -0.5 -1.1 -1.1 c 0 -0.6 0.5 -1.1 1.1 -1.1 c 0.6 0 1.1 0.5 1.1 1.1 C 77.5 30.7 77 31.2 76.4 31.2 z",
2302
- strokeLinecap: "round"
2303
- }
2304
- ) })
2305
- }
2306
- ), Ra = ({
2307
- className: e,
2308
- viewBox: t,
2309
- spacing: r,
2310
- title: a,
2311
- monotone: n,
2312
- ...o
2313
- }) => /* @__PURE__ */ T(
2314
- De,
2315
- {
2316
- defaultViewBox: "0 0 640 512",
2317
- defaultClassName: "size-5",
2318
- viewBox: t,
2319
- className: e,
2320
- spacing: r,
2321
- title: a || "Hide",
2322
- ...o,
2323
- children: [
2324
- /* @__PURE__ */ c(
2325
- "path",
2326
- {
2327
- opacity: n ? "1" : "0.4",
2328
- d: "M360.8 380.3C339.4 392.8 314.6 400 288 400c-79.5 0-144-64.5-144-144c0-14.5 2.1-28.5 6.1-41.7L63.5 146c-29.4 34.7-49.9 70.8-61.1 97.6c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480c56.1 0 104.4-17.8 144.5-43.2l-71.7-56.5zM198.5 252.4c-3.7 .8-6.7 3.7-6.5 7.7c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9c1.9-.5 3.9-1.1 5.7-1.7l-120-94.6zm89-52.4l94.8 74.3c2.7-13.9 2.4-28.6-1.5-43.2c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3c0 2.7-.2 5.4-.5 8zM432 256c0 17.7-3.2 34.6-9 50.2l84.1 65.9c32.3-36.6 54.6-75.4 66.4-103.9c3.3-7.9 3.3-16.7 0-24.6c-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.7L207 136.9c23.1-15.7 51-24.9 81-24.9c79.5 0 144 64.5 144 144z"
2329
- }
2330
- ),
2331
- /* @__PURE__ */ c("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.1L9.2 42.9C-1.2 34.7-3.1 19.6 5.1 9.2z" })
2332
- ]
2333
- }
2334
- ), Oa = ({
2335
- className: e,
2336
- viewBox: t,
2337
- spacing: r,
2338
- title: a,
2339
- monotone: n,
2340
- ...o
2341
- }) => /* @__PURE__ */ T(
2342
- De,
2343
- {
2344
- defaultViewBox: "0 0 576 512",
2345
- defaultClassName: "size-5",
2346
- viewBox: t,
2347
- className: e,
2348
- spacing: r,
2349
- title: a || "Show",
2350
- ...o,
2351
- children: [
2352
- /* @__PURE__ */ c(
2353
- "path",
2354
- {
2355
- opacity: n ? "1" : "0.4",
2356
- d: "M95.4 112.6C142.5 68.8 207.2 32 288 32s145.5 36.8 192.6 80.6c46.8 43.5 78.1 95.4 93 131.1c3.3 7.9 3.3 16.7 0 24.6c-14.9 35.7-46.2 87.7-93 131.1C433.5 443.2 368.8 480 288 480s-145.5-36.8-192.6-80.6C48.6 356 17.3 304 2.5 268.3c-3.3-7.9-3.3-16.7 0-24.6C17.3 208 48.6 156 95.4 112.6zM288 400a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"
2357
- }
2358
- ),
2359
- /* @__PURE__ */ c("path", { d: "M224 256c35.3 0 64-28.7 64-64c0-7.1-1.2-13.9-3.3-20.3c-1.8-5.5 1.6-11.9 7.4-11.7c40.8 1.7 77.5 29.6 88.6 71.1c13.7 51.2-16.7 103.9-67.9 117.6s-103.9-16.7-117.6-67.9c-1.9-6.9-2.9-13.9-3.2-20.7c-.3-5.8 6.1-9.2 11.7-7.4c6.4 2.1 13.2 3.3 20.3 3.3z" })
2360
- ]
2361
- }
2362
- );
2363
- /*!
2364
- @versini/ui-icons v1.10.0
2365
- © 2024 gizmette.com
2366
- */
2367
- try {
2368
- window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
2369
- version: "1.10.0",
2370
- buildTime: "07/05/2024 05:27 PM EDT",
2371
- homepage: "https://github.com/aversini/ui-components",
2372
- license: "MIT"
2373
- });
2374
- } catch {
2375
- }
2376
- const Da = (e) => {
2377
- let t = "";
2378
- if (typeof e == "number" || typeof e == "string")
2379
- t = "m-" + e;
2380
- else {
2381
- const r = [];
2382
- (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
2383
- }
2384
- return t;
2385
- }, $a = "av-flexgrid", se = "av-flexgrid-item", ue = 0.25, At = K.createContext({
2386
- columnGap: 0,
2387
- rowGap: 0
2388
- }), Ma = ({
2389
- children: e,
2390
- className: t,
2391
- columnGap: r = 1,
2392
- rowGap: a = 0,
2393
- height: n = "auto",
2394
- width: o = "auto",
2395
- direction: s = "row",
2396
- alignHorizontal: i = "normal",
2397
- alignVertical: l = "normal",
2398
- spacing: d,
2399
- ...h
2400
- }) => {
2401
- const u = {
2402
- flexDirection: s,
2403
- justifyContent: i,
2404
- alignItems: l,
2405
- height: n,
2406
- width: o,
2407
- /**
2408
- * Trick to account for the extra space taken
2409
- * by the columnGap and rowGap that will be applied
2410
- * to all FlexgridItems (see context and paddings).
2411
- */
2412
- marginLeft: r * -1 * ue + "rem",
2413
- marginTop: a * -1 * ue + "rem"
2414
- }, m = g(
2415
- $a,
2416
- t,
2417
- "box-border flex flex-wrap"
2418
- ), p = { columnGap: r, rowGap: a }, f = d ? "div" : K.Fragment;
2419
- return /* @__PURE__ */ c(f, { ...d ? { className: Da(d) } : {}, children: /* @__PURE__ */ c("div", { className: m, style: u, ...h, children: /* @__PURE__ */ c(At.Provider, { value: p, children: e }) }) });
2420
- }, Ae = (e, t) => g({
2421
- "basis-1/12": e === 1 && !t,
2422
- "sm:basis-1/12": e === 1 && t === "sm",
2423
- "md:basis-1/12": e === 1 && t === "md",
2424
- "lg:basis-1/12": e === 1 && t === "lg",
2425
- "xl:basis-1/12": e === 1 && t === "xl",
2426
- "2xl:basis-1/12": e === 1 && t === "2xl",
2427
- "basis-2/12": e === 2 && !t,
2428
- "sm:basis-2/12": e === 2 && t === "sm",
2429
- "md:basis-2/12": e === 2 && t === "md",
2430
- "lg:basis-2/12": e === 2 && t === "lg",
2431
- "xl:basis-2/12": e === 2 && t === "xl",
2432
- "2xl:basis-2/12": e === 2 && t === "2xl",
2433
- "basis-3/12": e === 3 && !t,
2434
- "sm:basis-3/12": e === 3 && t === "sm",
2435
- "md:basis-3/12": e === 3 && t === "md",
2436
- "lg:basis-3/12": e === 3 && t === "lg",
2437
- "xl:basis-3/12": e === 3 && t === "xl",
2438
- "2xl:basis-3/12": e === 3 && t === "2xl",
2439
- "basis-4/12": e === 4 && !t,
2440
- "sm:basis-4/12": e === 4 && t === "sm",
2441
- "md:basis-4/12": e === 4 && t === "md",
2442
- "lg:basis-4/12": e === 4 && t === "lg",
2443
- "xl:basis-4/12": e === 4 && t === "xl",
2444
- "2xl:basis-4/12": e === 4 && t === "2xl",
2445
- "basis-5/12": e === 5 && !t,
2446
- "sm:basis-5/12": e === 5 && t === "sm",
2447
- "md:basis-5/12": e === 5 && t === "md",
2448
- "lg:basis-5/12": e === 5 && t === "lg",
2449
- "xl:basis-5/12": e === 5 && t === "xl",
2450
- "2xl:basis-5/12": e === 5 && t === "2xl",
2451
- "basis-6/12": e === 6 && !t,
2452
- "sm:basis-6/12": e === 6 && t === "sm",
2453
- "md:basis-6/12": e === 6 && t === "md",
2454
- "lg:basis-6/12": e === 6 && t === "lg",
2455
- "xl:basis-6/12": e === 6 && t === "xl",
2456
- "2xl:basis-6/12": e === 6 && t === "2xl",
2457
- "basis-7/12": e === 7 && !t,
2458
- "sm:basis-7/12": e === 7 && t === "sm",
2459
- "md:basis-7/12": e === 7 && t === "md",
2460
- "lg:basis-7/12": e === 7 && t === "lg",
2461
- "xl:basis-7/12": e === 7 && t === "xl",
2462
- "2xl:basis-7/12": e === 7 && t === "2xl",
2463
- "basis-8/12": e === 8 && !t,
2464
- "sm:basis-8/12": e === 8 && t === "sm",
2465
- "md:basis-8/12": e === 8 && t === "md",
2466
- "lg:basis-8/12": e === 8 && t === "lg",
2467
- "xl:basis-8/12": e === 8 && t === "xl",
2468
- "2xl:basis-8/12": e === 8 && t === "2xl",
2469
- "basis-9/12": e === 9 && !t,
2470
- "sm:basis-9/12": e === 9 && t === "sm",
2471
- "md:basis-9/12": e === 9 && t === "md",
2472
- "lg:basis-9/12": e === 9 && t === "lg",
2473
- "xl:basis-9/12": e === 9 && t === "xl",
2474
- "2xl:basis-9/12": e === 9 && t === "2xl",
2475
- "basis-10/12": e === 10 && !t,
2476
- "sm:basis-10/12": e === 10 && t === "sm",
2477
- "md:basis-10/12": e === 10 && t === "md",
2478
- "lg:basis-10/12": e === 10 && t === "lg",
2479
- "xl:basis-10/12": e === 10 && t === "xl",
2480
- "2xl:basis-10/12": e === 10 && t === "2xl",
2481
- "basis-11/12": e === 11 && !t,
2482
- "sm:basis-11/12": e === 11 && t === "sm",
2483
- "md:basis-11/12": e === 11 && t === "md",
2484
- "lg:basis-11/12": e === 11 && t === "lg",
2485
- "xl:basis-11/12": e === 11 && t === "xl",
2486
- "2xl:basis-11/12": e === 11 && t === "2xl",
2487
- "basis-full": e === 12 && !t,
2488
- "sm:basis-full": e === 12 && t === "sm",
2489
- "md:basis-full": e === 12 && t === "md",
2490
- "lg:basis-full": e === 12 && t === "lg",
2491
- "xl:basis-full": e === 12 && t === "xl",
2492
- "2xl:basis-full": e === 12 && t === "2xl"
2493
- }), La = ({
2494
- className: e,
2495
- span: t
2496
- }) => {
2497
- if (!t)
2498
- return g(e, se, "box-border basis-auto");
2499
- if (typeof t == "number")
2500
- return g(e, se, "box-border max-w-full", {
2501
- [`${Ae(t)}`]: !0
2502
- });
2503
- if (typeof t == "string")
2504
- return g(e, se, "box-border basis-auto", {
2505
- "max-w-full grow": t === "auto"
2506
- });
2507
- if (typeof t == "object") {
2508
- const r = Object.entries(t).map(([a, n]) => a === "fallback" ? Ae(n) : Ae(n, a));
2509
- return g(
2510
- e,
2511
- se,
2512
- "box-border",
2513
- r
2514
- );
2515
- }
2516
- }, ie = ({
2517
- children: e,
2518
- className: t,
2519
- span: r,
2520
- ...a
2521
- }) => {
2522
- const { columnGap: n, rowGap: o } = Ze(At), s = {
2523
- paddingLeft: n * ue + "rem",
2524
- paddingTop: o * ue + "rem"
2525
- }, i = La({
2526
- className: t,
2527
- span: r
2528
- });
2529
- return /* @__PURE__ */ c("div", { className: i, style: s, ...a, children: e });
2530
- };
2531
- /*!
2532
- @versini/ui-system v1.4.2
2533
- © 2024 gizmette.com
2534
- */
2535
- try {
2536
- window.__VERSINI_UI_SYSTEM__ || (window.__VERSINI_UI_SYSTEM__ = {
2537
- version: "1.4.2",
2538
- buildTime: "07/05/2024 05:27 PM EDT",
2539
- homepage: "https://github.com/aversini/ui-components",
2540
- license: "MIT"
2541
- });
2542
- } catch {
2543
- }
2544
- const Pa = "ASK! ME! ANYTHING!", _t = "Sassy Saint", Ua = "gizmette.com", Ha = "Log in", Vn = "Log out", Ka = "Password", Ba = "Powered by OpenAI", Jn = "Send", Fn = "Profile", zn = "Statistics", Yn = "Chat history", qn = "About", Qn = "Type your question here", Xn = "Clear chat", Zn = "Cancel chat", eo = "N/A", to = {
2545
- PREFERENCES: {
2546
- TITLE: "User preferences",
2547
- NAME: "Name",
2548
- EMAIL: "Email",
2549
- ENGINE_DETAILS: "Show message statistics",
2550
- LOCATION: "Current location",
2551
- MODEL_TYPE: "Use GPT model 4"
2552
- },
2553
- CURRENT_STATISTICS: {
2554
- TITLE: "Current chat statistics",
2555
- MODEL_NAME: "GPT model",
2556
- TOKENS_USED: "Tokens used",
2557
- REMAINING_TOKENS: "Remaining tokens",
2558
- PROCESSING_TIME: "Average response time"
2559
- },
2560
- MAIN_STATISTICS: {
2561
- TITLE: "Lifetime statistics",
2562
- TOTAL: "Total chat session",
2563
- PROCESSING_TIME: "Average response time"
2564
- },
2565
- HISTORY: {
2566
- TITLE: "Chat history"
2567
- },
2568
- ABOUT: {
2569
- TITLE_CLIENT: "Client details",
2570
- TITLE_SERVER: "Server details",
2571
- VERSION: "Version",
2572
- BUILD_TIMESTAMP: "Build date",
2573
- ENGINE: "OpenAI model",
2574
- PLUGIN: "Plugin"
2575
- }
2576
- }, Wa = ({
2577
- serverStats: e
2578
- }) => /* @__PURE__ */ c(
2579
- da,
2580
- {
2581
- mode: "light",
2582
- row1: /* @__PURE__ */ T("div", { children: [
2583
- _t,
2584
- " v",
2585
- "3.2.1",
2586
- " - ",
2587
- Ba,
2588
- Ne && e && e.models.length > 0 && e.models[0] === "development" ? " - Development Mode" : ""
2589
- ] }),
2590
- row2: /* @__PURE__ */ T("div", { children: [
2591
- "© ",
2592
- (/* @__PURE__ */ new Date()).getFullYear(),
2593
- " ",
2594
- Ua
2595
- ] })
2596
- }
2597
- ), ja = et(() => import("./LazyHeader.D3qbUck7.js")), Ga = () => {
2598
- const { isAuthenticated: e } = xe();
2599
- return /* @__PURE__ */ T(q, { children: [
2600
- e && /* @__PURE__ */ c(tt, { fallback: /* @__PURE__ */ c("div", {}), children: /* @__PURE__ */ c(ja, {}) }),
2601
- /* @__PURE__ */ T("div", { className: "flex items-center justify-center", children: [
2602
- /* @__PURE__ */ c("div", { className: "basis-1/4", children: /* @__PURE__ */ c(Ca, {}) }),
2603
- /* @__PURE__ */ T("div", { className: "prose prose-sm prose-light md:prose-base prose-h1:mb-0 prose-h2:mt-0", children: [
2604
- /* @__PURE__ */ c("h1", { children: _t }),
2605
- /* @__PURE__ */ c("h2", { children: Pa })
2606
- ] })
2607
- ] })
2608
- ] });
2609
- }, Va = () => {
2610
- const { login: e, logoutReason: t } = xe(), [r, a] = U(""), [n, o] = U(""), [s, i] = U(!0), [l, d] = U({
2611
- username: "",
2612
- password: ""
2613
- }), h = async (u) => {
2614
- u.preventDefault(), await e(
2615
- l.username,
2616
- l.password,
2617
- Q.CODE
2618
- ) || (o(""), a("Invalid username or password"));
2619
- };
2620
- return z(() => {
2621
- var u;
2622
- (u = document.getElementById("logo")) == null || u.classList.add("fadeOut"), setTimeout(() => {
2623
- var m;
2624
- (m = document.getElementById("root")) == null || m.classList.replace("app-hidden", "fadeIn");
2625
- }, 500);
2626
- }), z(() => {
2627
- t && o(t);
2628
- }, [t]), /* @__PURE__ */ T(q, { children: [
2629
- /* @__PURE__ */ T(ua, { children: [
2630
- /* @__PURE__ */ c("div", { className: Zr(), children: /* @__PURE__ */ c(Ga, {}) }),
2631
- /* @__PURE__ */ c("form", { className: "mx-auto mt-5", onSubmit: h, children: /* @__PURE__ */ T(Ma, { rowGap: 7, width: "350px", children: [
2632
- /* @__PURE__ */ c(ie, { span: 12, children: n && /* @__PURE__ */ c("div", { className: "p-2 text-sm text-center text-copy-error-light bg-surface-darker", children: n }) }),
2633
- /* @__PURE__ */ c(ie, { span: 12, children: /* @__PURE__ */ c(
2634
- Oe,
2635
- {
2636
- required: !0,
2637
- autoCapitalize: "off",
2638
- autoComplete: "off",
2639
- autoCorrect: "off",
2640
- mode: "dark",
2641
- focusMode: "light",
2642
- name: "username",
2643
- label: "Username",
2644
- onChange: (u) => {
2645
- d({
2646
- ...l,
2647
- username: u.target.value
2648
- }), a("");
2649
- },
2650
- error: r !== ""
2651
- }
2652
- ) }),
2653
- /* @__PURE__ */ c(ie, { span: 12, children: /* @__PURE__ */ c(
2654
- Tt,
2655
- {
2656
- required: !0,
2657
- autoCapitalize: "off",
2658
- autoComplete: "off",
2659
- autoCorrect: "off",
2660
- mode: "dark",
2661
- focusMode: "light",
2662
- name: "password",
2663
- label: Ka,
2664
- rightElement: /* @__PURE__ */ c(bt, { focusMode: "light", children: s ? /* @__PURE__ */ c(Oa, {}) : /* @__PURE__ */ c(Ra, {}) }),
2665
- onMaskChange: i,
2666
- onChange: (u) => {
2667
- d({
2668
- ...l,
2669
- password: u.target.value
2670
- }), a("");
2671
- },
2672
- error: r !== "",
2673
- helperText: r
2674
- }
2675
- ) }),
2676
- /* @__PURE__ */ c(ie, { span: 12, children: /* @__PURE__ */ c(
2677
- wt,
2678
- {
2679
- focusMode: "light",
2680
- fullWidth: !0,
2681
- noBorder: !0,
2682
- type: "submit",
2683
- className: "mb-4 mt-6",
2684
- children: Ha
2685
- }
2686
- ) })
2687
- ] }) })
2688
- ] }),
2689
- /* @__PURE__ */ c(Wa, {})
2690
- ] });
2691
- }, Ja = et(() => import("./App.pFoMWtnP.js").then((e) => e.App)), Fa = ({ isComponent: e }) => {
2692
- const { isAuthenticated: t } = xe();
2693
- return t ? /* @__PURE__ */ c(tt, { fallback: /* @__PURE__ */ c("div", {}), children: /* @__PURE__ */ c(Ja, { isComponent: e }) }) : /* @__PURE__ */ c(Va, {});
2694
- }, za = ({
2695
- isComponent: e = !1,
2696
- domain: t = Xr
2697
- }) => /* @__PURE__ */ c(q, { children: /* @__PURE__ */ c(Br, { clientId: Wr, domain: t, children: /* @__PURE__ */ c(Fa, { isComponent: e }) }) }), ro = ({ domain: e }) => /* @__PURE__ */ c(za, { isComponent: !0, domain: e });
2698
- export {
2699
- yt as A,
2700
- qn as ABOUT_TITLE,
2701
- gn as ACTION_LOCATION,
2702
- un as ACTION_MESSAGE,
2703
- hn as ACTION_MODEL,
2704
- mn as ACTION_RESET,
2705
- pn as ACTION_RESTORE,
2706
- yn as ACTION_SEARCH,
2707
- bn as ACTION_SORT,
2708
- fn as ACTION_STREAMING,
2709
- Wa as AppFooter,
2710
- Zn as CANCEL,
2711
- to as CARDS,
2712
- Xn as CLEAR,
2713
- Ln as E,
2714
- cn as ERROR_MESSAGE,
2715
- Oe as G,
2716
- dn as GPT4_MAX_TOKENS,
2717
- Yn as HISTORY_TITLE,
2718
- En as LOCAL_STORAGE_CHAT_DETAILS,
2719
- Sn as LOCAL_STORAGE_LOCATION,
2720
- wn as LOCAL_STORAGE_PREFIX,
2721
- vn as LOCAL_STORAGE_SEARCH,
2722
- kn as LOCAL_STORAGE_SORT,
2723
- Vn as LOG_OUT,
2724
- ha as M,
2725
- ln as MODEL_GPT4,
2726
- Ga as MessagesContainerHeader,
2727
- Pn as N,
2728
- eo as NA,
2729
- bt as O,
2730
- Fn as PROFILE_TITLE,
2731
- an as ROLE_ASSISTANT,
2732
- sn as ROLE_HIDDEN,
2733
- on as ROLE_INTERNAL,
2734
- nn as ROLE_SYSTEM,
2735
- rn as ROLE_USER,
2736
- Ce as S,
2737
- Jn as SEND,
2738
- zn as STATS,
2739
- Tn as STATS_SEPARATOR,
2740
- ro as SassySaint,
2741
- Qn as TYPE_QUESTION,
2742
- kt as U,
2743
- Wn as a,
2744
- Ma as b,
2745
- ua as c,
2746
- Hn as c$1,
2747
- _n as convertLatitudeToDMS,
2748
- In as convertLongitudeToDMS,
2749
- xe as dr,
2750
- Dn as durationFormatter,
2751
- Cn as extractAverage,
2752
- gt as f,
2753
- ma as f$1,
2754
- De as g,
2755
- xn as getCurrentGeoLocation,
2756
- Zr as getMessageContaintWrapperClass,
2757
- Re as i,
2758
- Un as i$1,
2759
- Rn as isLastMessageFromRole,
2760
- ie as j,
2761
- jn as l,
2762
- Kn as n,
2763
- On as numberFormatter,
2764
- ba as o,
2765
- Gn as p,
2766
- $n as pluralize,
2767
- Bn as r,
2768
- Nn as renderDataAsList,
2769
- Mn as s,
2770
- An as truncate,
2771
- wt as x
2772
- };