@versini/sassysaint 1.0.12 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3950 +0,0 @@
1
- import { jsx as l, jsxs as S, Fragment as me } from "react/jsx-runtime";
2
- import W, { createContext as br, useReducer as vt, useRef as L, useCallback as q, useEffect as V, useContext as St, useSyncExternalStore as wr, useId as It, useMemo as At, useState as j, useLayoutEffect as Er, lazy as kt, Suspense as _t } from "react";
3
- import f from "clsx";
4
- var Tr = Object.defineProperty, vr = (e, t, r) => t in e ? Tr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ke = (e, t, r) => vr(e, typeof t != "symbol" ? t + "" : t, r);
5
- /*!
6
- @versini/auth-provider v6.4.4
7
- © 2024 gizmette.com
8
- */
9
- try {
10
- window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
11
- version: "6.4.4",
12
- buildTime: "07/31/2024 08:11 PM EDT",
13
- homepage: "https://github.com/aversini/auth-client",
14
- license: "MIT"
15
- });
16
- } catch {
17
- }
18
- function M(e) {
19
- const t = new Uint8Array(e);
20
- let r = "";
21
- for (const n of t)
22
- r += String.fromCharCode(n);
23
- return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
24
- }
25
- function ke(e) {
26
- const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), o = new ArrayBuffer(a.length), s = new Uint8Array(o);
27
- for (let i = 0; i < a.length; i++)
28
- s[i] = a.charCodeAt(i);
29
- return o;
30
- }
31
- function Qe() {
32
- return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
33
- }
34
- function Rt(e) {
35
- const { id: t } = e;
36
- return {
37
- ...e,
38
- id: ke(t),
39
- transports: e.transports
40
- };
41
- }
42
- function Nt(e) {
43
- return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
44
- }
45
- let R = class extends Error {
46
- constructor({ message: t, code: r, cause: n, name: a }) {
47
- super(t, { cause: n }), this.name = a ?? n.name, this.code = r;
48
- }
49
- };
50
- function Sr({ error: e, options: t }) {
51
- var n, a;
52
- const { publicKey: r } = t;
53
- if (!r)
54
- throw Error("options was missing required publicKey property");
55
- if (e.name === "AbortError") {
56
- if (t.signal instanceof AbortSignal)
57
- return new R({
58
- message: "Registration ceremony was sent an abort signal",
59
- code: "ERROR_CEREMONY_ABORTED",
60
- cause: e
61
- });
62
- } else if (e.name === "ConstraintError") {
63
- if (((n = r.authenticatorSelection) == null ? void 0 : n.requireResidentKey) === !0)
64
- return new R({
65
- message: "Discoverable credentials were required but no available authenticator supported it",
66
- code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
67
- cause: e
68
- });
69
- if (((a = r.authenticatorSelection) == null ? void 0 : a.userVerification) === "required")
70
- return new R({
71
- message: "User verification was required but no available authenticator supported it",
72
- code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
73
- cause: e
74
- });
75
- } else {
76
- if (e.name === "InvalidStateError")
77
- return new R({
78
- message: "The authenticator was previously registered",
79
- code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
80
- cause: e
81
- });
82
- if (e.name === "NotAllowedError")
83
- return new R({
84
- message: e.message,
85
- code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
86
- cause: e
87
- });
88
- if (e.name === "NotSupportedError")
89
- return r.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new R({
90
- message: 'No entry in pubKeyCredParams was of type "public-key"',
91
- code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
92
- cause: e
93
- }) : new R({
94
- message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
95
- code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
96
- cause: e
97
- });
98
- if (e.name === "SecurityError") {
99
- const o = window.location.hostname;
100
- if (Nt(o)) {
101
- if (r.rp.id !== o)
102
- return new R({
103
- message: `The RP ID "${r.rp.id}" is invalid for this domain`,
104
- code: "ERROR_INVALID_RP_ID",
105
- cause: e
106
- });
107
- } else return new R({
108
- message: `${window.location.hostname} is an invalid domain`,
109
- code: "ERROR_INVALID_DOMAIN",
110
- cause: e
111
- });
112
- } else if (e.name === "TypeError") {
113
- if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
114
- return new R({
115
- message: "User ID was not between 1 and 64 characters",
116
- code: "ERROR_INVALID_USER_ID_LENGTH",
117
- cause: e
118
- });
119
- } else if (e.name === "UnknownError")
120
- return new R({
121
- message: "The authenticator was unable to process the specified options, or could not create a new credential",
122
- code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
123
- cause: e
124
- });
125
- }
126
- return e;
127
- }
128
- class Ir {
129
- createNewAbortSignal() {
130
- if (this.controller) {
131
- const r = new Error("Cancelling existing WebAuthn API call for new one");
132
- r.name = "AbortError", this.controller.abort(r);
133
- }
134
- const t = new AbortController();
135
- return this.controller = t, t.signal;
136
- }
137
- cancelCeremony() {
138
- if (this.controller) {
139
- const t = new Error("Manually cancelling existing WebAuthn API call");
140
- t.name = "AbortError", this.controller.abort(t), this.controller = void 0;
141
- }
142
- }
143
- }
144
- const Ct = new Ir(), Ar = ["cross-platform", "platform"];
145
- function xt(e) {
146
- if (e && !(Ar.indexOf(e) < 0))
147
- return e;
148
- }
149
- async function kr(e) {
150
- var h;
151
- if (!Qe())
152
- throw new Error("WebAuthn is not supported in this browser");
153
- const t = { publicKey: {
154
- ...e,
155
- challenge: ke(e.challenge),
156
- user: {
157
- ...e.user,
158
- id: ke(e.user.id)
159
- },
160
- excludeCredentials: (h = e.excludeCredentials) == null ? void 0 : h.map(Rt)
161
- } };
162
- t.signal = Ct.createNewAbortSignal();
163
- let r;
164
- try {
165
- r = await navigator.credentials.create(t);
166
- } catch (u) {
167
- throw Sr({ error: u, options: t });
168
- }
169
- if (!r)
170
- throw new Error("Registration was not completed");
171
- const { id: n, rawId: a, response: o, type: s } = r;
172
- let i;
173
- typeof o.getTransports == "function" && (i = o.getTransports());
174
- let d;
175
- if (typeof o.getPublicKeyAlgorithm == "function")
176
- try {
177
- d = o.getPublicKeyAlgorithm();
178
- } catch (u) {
179
- Ge("getPublicKeyAlgorithm()", u);
180
- }
181
- let g;
182
- if (typeof o.getPublicKey == "function")
183
- try {
184
- const u = o.getPublicKey();
185
- u !== null && (g = M(u));
186
- } catch (u) {
187
- Ge("getPublicKey()", u);
188
- }
189
- let p;
190
- if (typeof o.getAuthenticatorData == "function")
191
- try {
192
- p = M(o.getAuthenticatorData());
193
- } catch (u) {
194
- Ge("getAuthenticatorData()", u);
195
- }
196
- return {
197
- id: n,
198
- rawId: M(a),
199
- response: {
200
- attestationObject: M(o.attestationObject),
201
- clientDataJSON: M(o.clientDataJSON),
202
- transports: i,
203
- publicKeyAlgorithm: d,
204
- publicKey: g,
205
- authenticatorData: p
206
- },
207
- type: s,
208
- clientExtensionResults: r.getClientExtensionResults(),
209
- authenticatorAttachment: xt(r.authenticatorAttachment)
210
- };
211
- }
212
- function Ge(e, t) {
213
- console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
214
- `, t);
215
- }
216
- function _r() {
217
- if (!Qe())
218
- return new Promise((t) => t(!1));
219
- const e = window.PublicKeyCredential;
220
- return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
221
- }
222
- function Rr({ error: e, options: t }) {
223
- const { publicKey: r } = t;
224
- if (!r)
225
- throw Error("options was missing required publicKey property");
226
- if (e.name === "AbortError") {
227
- if (t.signal instanceof AbortSignal)
228
- return new R({
229
- message: "Authentication ceremony was sent an abort signal",
230
- code: "ERROR_CEREMONY_ABORTED",
231
- cause: e
232
- });
233
- } else {
234
- if (e.name === "NotAllowedError")
235
- return new R({
236
- message: e.message,
237
- code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
238
- cause: e
239
- });
240
- if (e.name === "SecurityError") {
241
- const n = window.location.hostname;
242
- if (Nt(n)) {
243
- if (r.rpId !== n)
244
- return new R({
245
- message: `The RP ID "${r.rpId}" is invalid for this domain`,
246
- code: "ERROR_INVALID_RP_ID",
247
- cause: e
248
- });
249
- } else return new R({
250
- message: `${window.location.hostname} is an invalid domain`,
251
- code: "ERROR_INVALID_DOMAIN",
252
- cause: e
253
- });
254
- } else if (e.name === "UnknownError")
255
- return new R({
256
- message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
257
- code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
258
- cause: e
259
- });
260
- }
261
- return e;
262
- }
263
- async function Nr(e, t = !1) {
264
- var h, u;
265
- if (!Qe())
266
- throw new Error("WebAuthn is not supported in this browser");
267
- let r;
268
- ((h = e.allowCredentials) == null ? void 0 : h.length) !== 0 && (r = (u = e.allowCredentials) == null ? void 0 : u.map(Rt));
269
- const n = {
270
- ...e,
271
- challenge: ke(e.challenge),
272
- allowCredentials: r
273
- }, a = {};
274
- if (t) {
275
- if (!await _r())
276
- throw Error("Browser does not support WebAuthn autofill");
277
- if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
278
- throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
279
- a.mediation = "conditional", n.allowCredentials = [];
280
- }
281
- a.publicKey = n, a.signal = Ct.createNewAbortSignal();
282
- let o;
283
- try {
284
- o = await navigator.credentials.get(a);
285
- } catch (c) {
286
- throw Rr({ error: c, options: a });
287
- }
288
- if (!o)
289
- throw new Error("Authentication was not completed");
290
- const { id: s, rawId: i, response: d, type: g } = o;
291
- let p;
292
- return d.userHandle && (p = M(d.userHandle)), {
293
- id: s,
294
- rawId: M(i),
295
- response: {
296
- authenticatorData: M(d.authenticatorData),
297
- clientDataJSON: M(d.clientDataJSON),
298
- signature: M(d.signature),
299
- userHandle: p
300
- },
301
- type: g,
302
- clientExtensionResults: o.getClientExtensionResults(),
303
- authenticatorAttachment: xt(o.authenticatorAttachment)
304
- };
305
- }
306
- /*!
307
- @versini/auth-common v3.3.0
308
- © 2024 gizmette.com
309
- */
310
- try {
311
- window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
312
- version: "3.3.0",
313
- buildTime: "07/31/2024 08:11 PM EDT",
314
- homepage: "https://github.com/aversini/auth-client",
315
- license: "MIT"
316
- });
317
- } catch {
318
- }
319
- const Q = {
320
- ID_TOKEN: "id_token",
321
- ACCESS_TOKEN: "token",
322
- ID_AND_ACCESS_TOKEN: "id_token token",
323
- CODE: "code",
324
- REFRESH_TOKEN: "refresh_token",
325
- PASSKEY: "passkey"
326
- }, Ot = {
327
- CLIENT_ID: "X-Auth-ClientId"
328
- }, N = {
329
- ALG: "RS256",
330
- USER_ID_KEY: "sub",
331
- TOKEN_ID_KEY: "__raw",
332
- NONCE_KEY: "_nonce",
333
- USERNAME_KEY: "username",
334
- AUTH_TYPE_KEY: "auth_type",
335
- EXPIRES_AT_KEY: "exp",
336
- CREATED_AT_KEY: "iat",
337
- SCOPES_KEY: "scopes",
338
- ISSUER: "gizmette.com"
339
- }, Cr = `-----BEGIN PUBLIC KEY-----
340
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
341
- w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
342
- i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
343
- aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
344
- l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
345
- sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
346
- awIDAQAB
347
- -----END PUBLIC KEY-----`, xe = {
348
- AUTHENTICATE: "authenticate",
349
- CODE: "code",
350
- LOGOUT: "logout"
351
- }, Oe = crypto, Pt = (e) => e instanceof CryptoKey, ge = new TextEncoder(), he = new TextDecoder();
352
- function xr(...e) {
353
- const t = e.reduce((a, { length: o }) => a + o, 0), r = new Uint8Array(t);
354
- let n = 0;
355
- for (const a of e)
356
- r.set(a, n), n += a.length;
357
- return r;
358
- }
359
- const Or = (e) => {
360
- const t = atob(e), r = new Uint8Array(t.length);
361
- for (let n = 0; n < t.length; n++)
362
- r[n] = t.charCodeAt(n);
363
- return r;
364
- }, de = (e) => {
365
- let t = e;
366
- t instanceof Uint8Array && (t = he.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
367
- try {
368
- return Or(t);
369
- } catch {
370
- throw new TypeError("The input to be decoded is not correctly encoded.");
371
- }
372
- };
373
- let X = class extends Error {
374
- static get code() {
375
- return "ERR_JOSE_GENERIC";
376
- }
377
- constructor(t) {
378
- var r;
379
- super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
380
- }
381
- }, $ = class extends X {
382
- static get code() {
383
- return "ERR_JWT_CLAIM_VALIDATION_FAILED";
384
- }
385
- constructor(t, r, n = "unspecified", a = "unspecified") {
386
- super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = n, this.reason = a, this.payload = r;
387
- }
388
- }, at = class extends X {
389
- static get code() {
390
- return "ERR_JWT_EXPIRED";
391
- }
392
- constructor(e, t, r = "unspecified", n = "unspecified") {
393
- super(e), this.code = "ERR_JWT_EXPIRED", this.claim = r, this.reason = n, this.payload = t;
394
- }
395
- };
396
- class Pr extends X {
397
- constructor() {
398
- super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
399
- }
400
- static get code() {
401
- return "ERR_JOSE_ALG_NOT_ALLOWED";
402
- }
403
- }
404
- let z = class extends X {
405
- constructor() {
406
- super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
407
- }
408
- static get code() {
409
- return "ERR_JOSE_NOT_SUPPORTED";
410
- }
411
- }, k = class extends X {
412
- constructor() {
413
- super(...arguments), this.code = "ERR_JWS_INVALID";
414
- }
415
- static get code() {
416
- return "ERR_JWS_INVALID";
417
- }
418
- }, B = class extends X {
419
- constructor() {
420
- super(...arguments), this.code = "ERR_JWT_INVALID";
421
- }
422
- static get code() {
423
- return "ERR_JWT_INVALID";
424
- }
425
- };
426
- class Dr extends X {
427
- constructor() {
428
- super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
429
- }
430
- static get code() {
431
- return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
432
- }
433
- }
434
- function G(e, t = "algorithm.name") {
435
- return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
436
- }
437
- function fe(e, t) {
438
- return e.name === t;
439
- }
440
- function Be(e) {
441
- return parseInt(e.name.slice(4), 10);
442
- }
443
- function $r(e) {
444
- switch (e) {
445
- case "ES256":
446
- return "P-256";
447
- case "ES384":
448
- return "P-384";
449
- case "ES512":
450
- return "P-521";
451
- default:
452
- throw new Error("unreachable");
453
- }
454
- }
455
- function Mr(e, t) {
456
- if (t.length && !t.some((r) => e.usages.includes(r))) {
457
- let r = "CryptoKey does not support this operation, its usages must include ";
458
- if (t.length > 2) {
459
- const n = t.pop();
460
- r += `one of ${t.join(", ")}, or ${n}.`;
461
- } else t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
462
- throw new TypeError(r);
463
- }
464
- }
465
- function Lr(e, t, ...r) {
466
- switch (t) {
467
- case "HS256":
468
- case "HS384":
469
- case "HS512": {
470
- if (!fe(e.algorithm, "HMAC"))
471
- throw G("HMAC");
472
- const n = parseInt(t.slice(2), 10);
473
- if (Be(e.algorithm.hash) !== n)
474
- throw G(`SHA-${n}`, "algorithm.hash");
475
- break;
476
- }
477
- case "RS256":
478
- case "RS384":
479
- case "RS512": {
480
- if (!fe(e.algorithm, "RSASSA-PKCS1-v1_5"))
481
- throw G("RSASSA-PKCS1-v1_5");
482
- const n = parseInt(t.slice(2), 10);
483
- if (Be(e.algorithm.hash) !== n)
484
- throw G(`SHA-${n}`, "algorithm.hash");
485
- break;
486
- }
487
- case "PS256":
488
- case "PS384":
489
- case "PS512": {
490
- if (!fe(e.algorithm, "RSA-PSS"))
491
- throw G("RSA-PSS");
492
- const n = parseInt(t.slice(2), 10);
493
- if (Be(e.algorithm.hash) !== n)
494
- throw G(`SHA-${n}`, "algorithm.hash");
495
- break;
496
- }
497
- case "EdDSA": {
498
- if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
499
- throw G("Ed25519 or Ed448");
500
- break;
501
- }
502
- case "ES256":
503
- case "ES384":
504
- case "ES512": {
505
- if (!fe(e.algorithm, "ECDSA"))
506
- throw G("ECDSA");
507
- const n = $r(t);
508
- if (e.algorithm.namedCurve !== n)
509
- throw G(n, "algorithm.namedCurve");
510
- break;
511
- }
512
- default:
513
- throw new TypeError("CryptoKey does not support this operation");
514
- }
515
- Mr(e, r);
516
- }
517
- function Dt(e, t, ...r) {
518
- var n;
519
- if (r.length > 2) {
520
- const a = r.pop();
521
- e += `one of type ${r.join(", ")}, or ${a}.`;
522
- } else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
523
- return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (n = t.constructor) != null && n.name && (e += ` Received an instance of ${t.constructor.name}`), e;
524
- }
525
- const ot = (e, ...t) => Dt("Key must be ", e, ...t);
526
- function $t(e, t, ...r) {
527
- return Dt(`Key for the ${e} algorithm must be `, t, ...r);
528
- }
529
- const Mt = (e) => Pt(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", _e = ["CryptoKey"], Ur = (...e) => {
530
- const t = e.filter(Boolean);
531
- if (t.length === 0 || t.length === 1)
532
- return !0;
533
- let r;
534
- for (const n of t) {
535
- const a = Object.keys(n);
536
- if (!r || r.size === 0) {
537
- r = new Set(a);
538
- continue;
539
- }
540
- for (const o of a) {
541
- if (r.has(o))
542
- return !1;
543
- r.add(o);
544
- }
545
- }
546
- return !0;
547
- };
548
- function Hr(e) {
549
- return typeof e == "object" && e !== null;
550
- }
551
- function Re(e) {
552
- if (!Hr(e) || Object.prototype.toString.call(e) !== "[object Object]")
553
- return !1;
554
- if (Object.getPrototypeOf(e) === null)
555
- return !0;
556
- let t = e;
557
- for (; Object.getPrototypeOf(t) !== null; )
558
- t = Object.getPrototypeOf(t);
559
- return Object.getPrototypeOf(e) === t;
560
- }
561
- const Kr = (e, t) => {
562
- if (e.startsWith("RS") || e.startsWith("PS")) {
563
- const { modulusLength: r } = t.algorithm;
564
- if (typeof r != "number" || r < 2048)
565
- throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
566
- }
567
- };
568
- function Gr(e) {
569
- let t, r;
570
- switch (e.kty) {
571
- case "RSA": {
572
- switch (e.alg) {
573
- case "PS256":
574
- case "PS384":
575
- case "PS512":
576
- t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
577
- break;
578
- case "RS256":
579
- case "RS384":
580
- case "RS512":
581
- t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
582
- break;
583
- case "RSA-OAEP":
584
- case "RSA-OAEP-256":
585
- case "RSA-OAEP-384":
586
- case "RSA-OAEP-512":
587
- t = {
588
- name: "RSA-OAEP",
589
- hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
590
- }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
591
- break;
592
- default:
593
- throw new z('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
594
- }
595
- break;
596
- }
597
- case "EC": {
598
- switch (e.alg) {
599
- case "ES256":
600
- t = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
601
- break;
602
- case "ES384":
603
- t = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
604
- break;
605
- case "ES512":
606
- t = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
607
- break;
608
- case "ECDH-ES":
609
- case "ECDH-ES+A128KW":
610
- case "ECDH-ES+A192KW":
611
- case "ECDH-ES+A256KW":
612
- t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
613
- break;
614
- default:
615
- throw new z('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
616
- }
617
- break;
618
- }
619
- case "OKP": {
620
- switch (e.alg) {
621
- case "EdDSA":
622
- t = { name: e.crv }, r = e.d ? ["sign"] : ["verify"];
623
- break;
624
- case "ECDH-ES":
625
- case "ECDH-ES+A128KW":
626
- case "ECDH-ES+A192KW":
627
- case "ECDH-ES+A256KW":
628
- t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
629
- break;
630
- default:
631
- throw new z('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
632
- }
633
- break;
634
- }
635
- default:
636
- throw new z('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
637
- }
638
- return { algorithm: t, keyUsages: r };
639
- }
640
- const Br = async (e) => {
641
- if (!e.alg)
642
- throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
643
- const { algorithm: t, keyUsages: r } = Gr(e), n = [
644
- t,
645
- e.ext ?? !1,
646
- e.key_ops ?? r
647
- ], a = { ...e };
648
- return delete a.alg, delete a.use, Oe.subtle.importKey("jwk", a, ...n);
649
- }, Lt = (e) => de(e);
650
- let We, Ve;
651
- const Ut = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Ht = async (e, t, r, n) => {
652
- let a = e.get(t);
653
- if (a != null && a[n])
654
- return a[n];
655
- const o = await Br({ ...r, alg: n });
656
- return a ? a[n] = o : e.set(t, { [n]: o }), o;
657
- }, Wr = (e, t) => {
658
- if (Ut(e)) {
659
- let r = e.export({ format: "jwk" });
660
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Lt(r.k) : (Ve || (Ve = /* @__PURE__ */ new WeakMap()), Ht(Ve, e, r, t));
661
- }
662
- return e;
663
- }, Vr = (e, t) => {
664
- if (Ut(e)) {
665
- let r = e.export({ format: "jwk" });
666
- return r.k ? Lt(r.k) : (We || (We = /* @__PURE__ */ new WeakMap()), Ht(We, e, r, t));
667
- }
668
- return e;
669
- }, Fr = { normalizePublicKey: Wr, normalizePrivateKey: Vr }, Y = (e, t, r = 0) => {
670
- r === 0 && (t.unshift(t.length), t.unshift(6));
671
- const n = e.indexOf(t[0], r);
672
- if (n === -1)
673
- return !1;
674
- const a = e.subarray(n, n + t.length);
675
- return a.length !== t.length ? !1 : a.every((o, s) => o === t[s]) || Y(e, t, n + 1);
676
- }, st = (e) => {
677
- switch (!0) {
678
- case Y(e, [42, 134, 72, 206, 61, 3, 1, 7]):
679
- return "P-256";
680
- case Y(e, [43, 129, 4, 0, 34]):
681
- return "P-384";
682
- case Y(e, [43, 129, 4, 0, 35]):
683
- return "P-521";
684
- case Y(e, [43, 101, 110]):
685
- return "X25519";
686
- case Y(e, [43, 101, 111]):
687
- return "X448";
688
- case Y(e, [43, 101, 112]):
689
- return "Ed25519";
690
- case Y(e, [43, 101, 113]):
691
- return "Ed448";
692
- default:
693
- throw new z("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
694
- }
695
- }, Jr = async (e, t, r, n, a) => {
696
- let o, s;
697
- const i = new Uint8Array(atob(r.replace(e, "")).split("").map((d) => d.charCodeAt(0)));
698
- switch (n) {
699
- case "PS256":
700
- case "PS384":
701
- case "PS512":
702
- o = { name: "RSA-PSS", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
703
- break;
704
- case "RS256":
705
- case "RS384":
706
- case "RS512":
707
- o = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
708
- break;
709
- case "RSA-OAEP":
710
- case "RSA-OAEP-256":
711
- case "RSA-OAEP-384":
712
- case "RSA-OAEP-512":
713
- o = {
714
- name: "RSA-OAEP",
715
- hash: `SHA-${parseInt(n.slice(-3), 10) || 1}`
716
- }, s = ["encrypt", "wrapKey"];
717
- break;
718
- case "ES256":
719
- o = { name: "ECDSA", namedCurve: "P-256" }, s = ["verify"];
720
- break;
721
- case "ES384":
722
- o = { name: "ECDSA", namedCurve: "P-384" }, s = ["verify"];
723
- break;
724
- case "ES512":
725
- o = { name: "ECDSA", namedCurve: "P-521" }, s = ["verify"];
726
- break;
727
- case "ECDH-ES":
728
- case "ECDH-ES+A128KW":
729
- case "ECDH-ES+A192KW":
730
- case "ECDH-ES+A256KW": {
731
- const d = st(i);
732
- o = d.startsWith("P-") ? { name: "ECDH", namedCurve: d } : { name: d }, s = [];
733
- break;
734
- }
735
- case "EdDSA":
736
- o = { name: st(i) }, s = ["verify"];
737
- break;
738
- default:
739
- throw new z('Invalid or unsupported "alg" (Algorithm) value');
740
- }
741
- return Oe.subtle.importKey(t, i, o, !1, s);
742
- }, Yr = (e, t, r) => Jr(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
743
- async function jr(e, t, r) {
744
- if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
745
- throw new TypeError('"spki" must be SPKI formatted string');
746
- return Yr(e, t);
747
- }
748
- const Ie = (e) => e == null ? void 0 : e[Symbol.toStringTag], zr = (e, t) => {
749
- if (!(t instanceof Uint8Array)) {
750
- if (!Mt(t))
751
- throw new TypeError($t(e, t, ..._e, "Uint8Array"));
752
- if (t.type !== "secret")
753
- throw new TypeError(`${Ie(t)} instances for symmetric algorithms must be of type "secret"`);
754
- }
755
- }, qr = (e, t, r) => {
756
- if (!Mt(t))
757
- throw new TypeError($t(e, t, ..._e));
758
- if (t.type === "secret")
759
- throw new TypeError(`${Ie(t)} instances for asymmetric algorithms must not be of type "secret"`);
760
- if (t.algorithm && r === "verify" && t.type === "private")
761
- throw new TypeError(`${Ie(t)} instances for asymmetric algorithm verifying must be of type "public"`);
762
- if (t.algorithm && r === "encrypt" && t.type === "private")
763
- throw new TypeError(`${Ie(t)} instances for asymmetric algorithm encryption must be of type "public"`);
764
- }, Qr = (e, t, r) => {
765
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? zr(e, t) : qr(e, t, r);
766
- };
767
- function Xr(e, t, r, n, a) {
768
- if (a.crit !== void 0 && (n == null ? void 0 : n.crit) === void 0)
769
- throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
770
- if (!n || n.crit === void 0)
771
- return /* @__PURE__ */ new Set();
772
- if (!Array.isArray(n.crit) || n.crit.length === 0 || n.crit.some((s) => typeof s != "string" || s.length === 0))
773
- throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
774
- let o;
775
- r !== void 0 ? o = new Map([...Object.entries(r), ...t.entries()]) : o = t;
776
- for (const s of n.crit) {
777
- if (!o.has(s))
778
- throw new z(`Extension Header Parameter "${s}" is not recognized`);
779
- if (a[s] === void 0)
780
- throw new e(`Extension Header Parameter "${s}" is missing`);
781
- if (o.get(s) && n[s] === void 0)
782
- throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`);
783
- }
784
- return new Set(n.crit);
785
- }
786
- const Zr = (e, t) => {
787
- if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
788
- throw new TypeError(`"${e}" option must be an array of strings`);
789
- if (t)
790
- return new Set(t);
791
- };
792
- function en(e, t) {
793
- const r = `SHA-${e.slice(-3)}`;
794
- switch (e) {
795
- case "HS256":
796
- case "HS384":
797
- case "HS512":
798
- return { hash: r, name: "HMAC" };
799
- case "PS256":
800
- case "PS384":
801
- case "PS512":
802
- return { hash: r, name: "RSA-PSS", saltLength: e.slice(-3) >> 3 };
803
- case "RS256":
804
- case "RS384":
805
- case "RS512":
806
- return { hash: r, name: "RSASSA-PKCS1-v1_5" };
807
- case "ES256":
808
- case "ES384":
809
- case "ES512":
810
- return { hash: r, name: "ECDSA", namedCurve: t.namedCurve };
811
- case "EdDSA":
812
- return { name: t.name };
813
- default:
814
- throw new z(`alg ${e} is not supported either by JOSE or your javascript runtime`);
815
- }
816
- }
817
- async function tn(e, t, r) {
818
- if (t = await Fr.normalizePublicKey(t, e), Pt(t))
819
- return Lr(t, e, r), t;
820
- if (t instanceof Uint8Array) {
821
- if (!e.startsWith("HS"))
822
- throw new TypeError(ot(t, ..._e));
823
- return Oe.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
824
- }
825
- throw new TypeError(ot(t, ..._e, "Uint8Array"));
826
- }
827
- const rn = async (e, t, r, n) => {
828
- const a = await tn(e, t, "verify");
829
- Kr(e, a);
830
- const o = en(e, a.algorithm);
831
- try {
832
- return await Oe.subtle.verify(o, a, r, n);
833
- } catch {
834
- return !1;
835
- }
836
- };
837
- async function nn(e, t, r) {
838
- if (!Re(e))
839
- throw new k("Flattened JWS must be an object");
840
- if (e.protected === void 0 && e.header === void 0)
841
- throw new k('Flattened JWS must have either of the "protected" or "header" members');
842
- if (e.protected !== void 0 && typeof e.protected != "string")
843
- throw new k("JWS Protected Header incorrect type");
844
- if (e.payload === void 0)
845
- throw new k("JWS Payload missing");
846
- if (typeof e.signature != "string")
847
- throw new k("JWS Signature missing or incorrect type");
848
- if (e.header !== void 0 && !Re(e.header))
849
- throw new k("JWS Unprotected Header incorrect type");
850
- let n = {};
851
- if (e.protected)
852
- try {
853
- const m = de(e.protected);
854
- n = JSON.parse(he.decode(m));
855
- } catch {
856
- throw new k("JWS Protected Header is invalid");
857
- }
858
- if (!Ur(n, e.header))
859
- throw new k("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
860
- const a = {
861
- ...n,
862
- ...e.header
863
- }, o = Xr(k, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, n, a);
864
- let s = !0;
865
- if (o.has("b64") && (s = n.b64, typeof s != "boolean"))
866
- throw new k('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
867
- const { alg: i } = a;
868
- if (typeof i != "string" || !i)
869
- throw new k('JWS "alg" (Algorithm) Header Parameter missing or invalid');
870
- const d = r && Zr("algorithms", r.algorithms);
871
- if (d && !d.has(i))
872
- throw new Pr('"alg" (Algorithm) Header Parameter value not allowed');
873
- if (s) {
874
- if (typeof e.payload != "string")
875
- throw new k("JWS Payload must be a string");
876
- } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
877
- throw new k("JWS Payload must be a string or an Uint8Array instance");
878
- let g = !1;
879
- typeof t == "function" && (t = await t(n, e), g = !0), Qr(i, t, "verify");
880
- const p = xr(ge.encode(e.protected ?? ""), ge.encode("."), typeof e.payload == "string" ? ge.encode(e.payload) : e.payload);
881
- let h;
882
- try {
883
- h = de(e.signature);
884
- } catch {
885
- throw new k("Failed to base64url decode the signature");
886
- }
887
- if (!await rn(i, t, h, p))
888
- throw new Dr();
889
- let u;
890
- if (s)
891
- try {
892
- u = de(e.payload);
893
- } catch {
894
- throw new k("Failed to base64url decode the payload");
895
- }
896
- else typeof e.payload == "string" ? u = ge.encode(e.payload) : u = e.payload;
897
- const c = { payload: u };
898
- return e.protected !== void 0 && (c.protectedHeader = n), e.header !== void 0 && (c.unprotectedHeader = e.header), g ? { ...c, key: t } : c;
899
- }
900
- async function an(e, t, r) {
901
- if (e instanceof Uint8Array && (e = he.decode(e)), typeof e != "string")
902
- throw new k("Compact JWS must be a string or Uint8Array");
903
- const { 0: n, 1: a, 2: o, length: s } = e.split(".");
904
- if (s !== 3)
905
- throw new k("Invalid Compact JWS");
906
- const i = await nn({ payload: a, protected: n, signature: o }, t, r), d = { payload: i.payload, protectedHeader: i.protectedHeader };
907
- return typeof t == "function" ? { ...d, key: i.key } : d;
908
- }
909
- const on = (e) => Math.floor(e.getTime() / 1e3), Kt = 60, Gt = Kt * 60, Xe = Gt * 24, sn = Xe * 7, cn = Xe * 365.25, ln = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, it = (e) => {
910
- const t = ln.exec(e);
911
- if (!t || t[4] && t[1])
912
- throw new TypeError("Invalid time period format");
913
- const r = parseFloat(t[2]), n = t[3].toLowerCase();
914
- let a;
915
- switch (n) {
916
- case "sec":
917
- case "secs":
918
- case "second":
919
- case "seconds":
920
- case "s":
921
- a = Math.round(r);
922
- break;
923
- case "minute":
924
- case "minutes":
925
- case "min":
926
- case "mins":
927
- case "m":
928
- a = Math.round(r * Kt);
929
- break;
930
- case "hour":
931
- case "hours":
932
- case "hr":
933
- case "hrs":
934
- case "h":
935
- a = Math.round(r * Gt);
936
- break;
937
- case "day":
938
- case "days":
939
- case "d":
940
- a = Math.round(r * Xe);
941
- break;
942
- case "week":
943
- case "weeks":
944
- case "w":
945
- a = Math.round(r * sn);
946
- break;
947
- default:
948
- a = Math.round(r * cn);
949
- break;
950
- }
951
- return t[1] === "-" || t[4] === "ago" ? -a : a;
952
- }, ct = (e) => e.toLowerCase().replace(/^application\//, ""), dn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, un = (e, t, r = {}) => {
953
- let n;
954
- try {
955
- n = JSON.parse(he.decode(t));
956
- } catch {
957
- }
958
- if (!Re(n))
959
- throw new B("JWT Claims Set must be a top-level JSON object");
960
- const { typ: a } = r;
961
- if (a && (typeof e.typ != "string" || ct(e.typ) !== ct(a)))
962
- throw new $('unexpected "typ" JWT header value', n, "typ", "check_failed");
963
- const { requiredClaims: o = [], issuer: s, subject: i, audience: d, maxTokenAge: g } = r, p = [...o];
964
- g !== void 0 && p.push("iat"), d !== void 0 && p.push("aud"), i !== void 0 && p.push("sub"), s !== void 0 && p.push("iss");
965
- for (const m of new Set(p.reverse()))
966
- if (!(m in n))
967
- throw new $(`missing required "${m}" claim`, n, m, "missing");
968
- if (s && !(Array.isArray(s) ? s : [s]).includes(n.iss))
969
- throw new $('unexpected "iss" claim value', n, "iss", "check_failed");
970
- if (i && n.sub !== i)
971
- throw new $('unexpected "sub" claim value', n, "sub", "check_failed");
972
- if (d && !dn(n.aud, typeof d == "string" ? [d] : d))
973
- throw new $('unexpected "aud" claim value', n, "aud", "check_failed");
974
- let h;
975
- switch (typeof r.clockTolerance) {
976
- case "string":
977
- h = it(r.clockTolerance);
978
- break;
979
- case "number":
980
- h = r.clockTolerance;
981
- break;
982
- case "undefined":
983
- h = 0;
984
- break;
985
- default:
986
- throw new TypeError("Invalid clockTolerance option type");
987
- }
988
- const { currentDate: u } = r, c = on(u || /* @__PURE__ */ new Date());
989
- if ((n.iat !== void 0 || g) && typeof n.iat != "number")
990
- throw new $('"iat" claim must be a number', n, "iat", "invalid");
991
- if (n.nbf !== void 0) {
992
- if (typeof n.nbf != "number")
993
- throw new $('"nbf" claim must be a number', n, "nbf", "invalid");
994
- if (n.nbf > c + h)
995
- throw new $('"nbf" claim timestamp check failed', n, "nbf", "check_failed");
996
- }
997
- if (n.exp !== void 0) {
998
- if (typeof n.exp != "number")
999
- throw new $('"exp" claim must be a number', n, "exp", "invalid");
1000
- if (n.exp <= c - h)
1001
- throw new at('"exp" claim timestamp check failed', n, "exp", "check_failed");
1002
- }
1003
- if (g) {
1004
- const m = c - n.iat, b = typeof g == "number" ? g : it(g);
1005
- if (m - h > b)
1006
- throw new at('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1007
- if (m < 0 - h)
1008
- throw new $('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
1009
- }
1010
- return n;
1011
- };
1012
- async function mn(e, t, r) {
1013
- var n;
1014
- const a = await an(e, t, r);
1015
- if ((n = a.protectedHeader.crit) != null && n.includes("b64") && a.protectedHeader.b64 === !1)
1016
- throw new B("JWTs MUST NOT use unencoded payload");
1017
- const o = { payload: un(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1018
- return typeof t == "function" ? { ...o, key: a.key } : o;
1019
- }
1020
- const hn = de;
1021
- function pn(e) {
1022
- if (typeof e != "string")
1023
- throw new B("JWTs must use Compact JWS serialization, JWT must be a string");
1024
- const { 1: t, length: r } = e.split(".");
1025
- if (r === 5)
1026
- throw new B("Only JWTs using Compact JWS serialization can be decoded");
1027
- if (r !== 3)
1028
- throw new B("Invalid JWT");
1029
- if (!t)
1030
- throw new B("JWTs must contain a payload");
1031
- let n;
1032
- try {
1033
- n = hn(t);
1034
- } catch {
1035
- throw new B("Failed to base64url decode the payload");
1036
- }
1037
- let a;
1038
- try {
1039
- a = JSON.parse(he.decode(n));
1040
- } catch {
1041
- throw new B("Failed to parse the decoded payload as JSON");
1042
- }
1043
- if (!Re(a))
1044
- throw new B("Invalid JWT Claims Set");
1045
- return a;
1046
- }
1047
- const ue = async (e) => {
1048
- try {
1049
- const t = N.ALG, r = await jr(Cr, t);
1050
- return await mn(e, r, {
1051
- issuer: N.ISSUER
1052
- });
1053
- } catch {
1054
- return;
1055
- }
1056
- }, gn = (e) => {
1057
- try {
1058
- return pn(e);
1059
- } catch {
1060
- return;
1061
- }
1062
- };
1063
- var I = [];
1064
- for (var Fe = 0; Fe < 256; ++Fe)
1065
- I.push((Fe + 256).toString(16).slice(1));
1066
- function fn(e, t = 0) {
1067
- return (I[e[t + 0]] + I[e[t + 1]] + I[e[t + 2]] + I[e[t + 3]] + "-" + I[e[t + 4]] + I[e[t + 5]] + "-" + I[e[t + 6]] + I[e[t + 7]] + "-" + I[e[t + 8]] + I[e[t + 9]] + "-" + I[e[t + 10]] + I[e[t + 11]] + I[e[t + 12]] + I[e[t + 13]] + I[e[t + 14]] + I[e[t + 15]]).toLowerCase();
1068
- }
1069
- var ye, yn = new Uint8Array(16);
1070
- function bn() {
1071
- if (!ye && (ye = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ye))
1072
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1073
- return ye(yn);
1074
- }
1075
- var wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1076
- const lt = {
1077
- randomUUID: wn
1078
- };
1079
- function dt(e, t, r) {
1080
- if (lt.randomUUID && !t && !e)
1081
- return lt.randomUUID();
1082
- e = e || {};
1083
- var n = e.random || (e.rng || bn)();
1084
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, fn(n);
1085
- }
1086
- const ut = globalThis.crypto, En = (e) => `${dt()}${dt()}`.slice(0, e), Tn = (e) => btoa(
1087
- [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1088
- );
1089
- async function vn(e) {
1090
- if (!ut.subtle)
1091
- throw new Error(
1092
- "crypto.subtle is available only in secure contexts (HTTPS)."
1093
- );
1094
- const t = new TextEncoder().encode(e), r = await ut.subtle.digest("SHA-256", t);
1095
- return Tn(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1096
- }
1097
- async function Sn(e) {
1098
- const t = En(43), r = await vn(t);
1099
- return {
1100
- code_verifier: t,
1101
- code_challenge: r
1102
- };
1103
- }
1104
- function Bt(e, t) {
1105
- window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1106
- }
1107
- const mt = (e, t) => {
1108
- const r = JSON.stringify(
1109
- typeof t == "function" ? t() : t
1110
- );
1111
- window.localStorage.setItem(e, r), Bt(e, r);
1112
- }, In = (e) => {
1113
- window.localStorage.removeItem(e), Bt(e, null);
1114
- }, ht = (e) => window.localStorage.getItem(e), An = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1115
- function be({
1116
- key: e,
1117
- initialValue: t
1118
- }) {
1119
- const r = wr(An, () => ht(e)), n = q(
1120
- (s) => {
1121
- try {
1122
- const i = typeof s == "function" ? s(JSON.parse(r)) : s;
1123
- i == null ? In(e) : mt(e, i);
1124
- } catch (i) {
1125
- console.warn(i);
1126
- }
1127
- },
1128
- [e, r]
1129
- ), a = q(() => {
1130
- n(t);
1131
- }, [t, n]), o = q(() => {
1132
- n(null);
1133
- }, [n]);
1134
- return V(() => {
1135
- try {
1136
- ht(e) === null && typeof t < "u" && mt(e, t);
1137
- } catch (s) {
1138
- console.warn(s);
1139
- }
1140
- }, [e, t]), [r ? JSON.parse(r) : null, n, a, o];
1141
- }
1142
- var A = [];
1143
- for (var Je = 0; Je < 256; ++Je)
1144
- A.push((Je + 256).toString(16).slice(1));
1145
- function kn(e, t = 0) {
1146
- return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
1147
- }
1148
- var we, _n = new Uint8Array(16);
1149
- function Rn() {
1150
- if (!we && (we = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !we))
1151
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1152
- return we(_n);
1153
- }
1154
- var Nn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1155
- const pt = {
1156
- randomUUID: Nn
1157
- };
1158
- function Ye(e, t, r) {
1159
- if (pt.randomUUID && !t && !e)
1160
- return pt.randomUUID();
1161
- e = e || {};
1162
- var n = e.random || (e.rng || Rn)();
1163
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, kn(n);
1164
- }
1165
- const ee = "Your session has expired. For your security, please log in again to continue.", Cn = "Your session has been successfully terminated.", Ee = "Login failed. Please try again.", xn = "Error getting access token, please re-authenticate.", On = "You forgot to wrap your component in <AuthProvider>.", Ne = {
1166
- dev: "https://auth.gizmette.local.com:3003",
1167
- prod: "https://mylogin.gizmette.com/auth"
1168
- }, Te = "@@auth@@", ce = "LOADING", le = "LOGIN", Wt = "LOGOUT", Pe = "success", U = "failure", Vt = "include", Ft = "POST", Jt = "application/json", ve = {
1169
- GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1170
- $clientId: String!,
1171
- $username: String!,
1172
- $id: String!) {
1173
- getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
1174
- challenge
1175
- rp {
1176
- id
1177
- name
1178
- }
1179
- user {
1180
- id
1181
- name
1182
- displayName
1183
- }
1184
- pubKeyCredParams {
1185
- type
1186
- alg
1187
- }
1188
- timeout
1189
- attestation
1190
- }
1191
- }`,
1192
- VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
1193
- $clientId: String!,
1194
- $username: String!,
1195
- $id: String!,
1196
- $registration: RegistrationOptionsInput!) {
1197
- verifyPasskeyRegistration(
1198
- clientId: $clientId,
1199
- username: $username,
1200
- id: $id,
1201
- registration: $registration) {
1202
- status
1203
- message
1204
- }
1205
- }`,
1206
- GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
1207
- $id: String!,
1208
- $clientId: String!,
1209
- ) {
1210
- getPasskeyAuthenticationOptions(
1211
- id: $id,
1212
- clientId: $clientId) {
1213
- rpId,
1214
- challenge,
1215
- allowCredentials {
1216
- id,
1217
- type,
1218
- transports
1219
- }
1220
- timeout,
1221
- userVerification,
1222
- }
1223
- }`,
1224
- VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
1225
- $clientId: String!,
1226
- $id: String!,
1227
- $authentication: AuthenticationOptionsInput!,
1228
- $nonce: String!,
1229
- $domain: String,
1230
- $fingerprint: String) {
1231
- verifyPasskeyAuthentication(
1232
- clientId: $clientId,
1233
- id: $id,
1234
- authentication: $authentication,
1235
- nonce: $nonce,
1236
- domain: $domain,
1237
- fingerprint: $fingerprint) {
1238
- status,
1239
- idToken,
1240
- accessToken,
1241
- refreshToken,
1242
- userId,
1243
- username,
1244
- }
1245
- }`
1246
- };
1247
- /*!
1248
- @versini/ui-fingerprint v1.0.1
1249
- © 2024 gizmette.com
1250
- */
1251
- try {
1252
- window.__VERSINI_UI_FINGERPRINT__ || (window.__VERSINI_UI_FINGERPRINT__ = {
1253
- version: "1.0.1",
1254
- buildTime: "07/18/2024 09:17 AM EDT",
1255
- homepage: "https://github.com/aversini/ui-components",
1256
- license: "MIT"
1257
- });
1258
- } catch {
1259
- }
1260
- const Pn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), Yt = async (e) => {
1261
- if (e === "")
1262
- return "";
1263
- const t = new TextEncoder().encode(e), r = await crypto.subtle.digest("SHA-256", t);
1264
- return Array.from(new Uint8Array(r)).map((n) => n.toString(16).padStart(2, "0")).join("");
1265
- };
1266
- function gt(e, t) {
1267
- return new Promise((r) => setTimeout(r, e, t));
1268
- }
1269
- async function Dn(e, t, r = 50) {
1270
- var n, a, o;
1271
- const s = document;
1272
- for (; !s.body; )
1273
- await gt(r);
1274
- const i = s.createElement("iframe");
1275
- try {
1276
- for (await new Promise((d, g) => {
1277
- let p = !1;
1278
- const h = () => {
1279
- p = !0, d();
1280
- }, u = (b) => {
1281
- p = !0, g(b);
1282
- };
1283
- i.onload = h, i.onerror = u;
1284
- const { style: c } = i;
1285
- c.setProperty("display", "block", "important"), c.position = "absolute", c.top = "0", c.left = "0", c.visibility = "hidden", i.src = "about:blank", s.body.appendChild(i);
1286
- const m = () => {
1287
- var b, w;
1288
- p || (((w = (b = i.contentWindow) == null ? void 0 : b.document) == null ? void 0 : w.readyState) === "complete" ? h() : setTimeout(m, 10));
1289
- };
1290
- m();
1291
- }); !((a = (n = i.contentWindow) == null ? void 0 : n.document) != null && a.body); )
1292
- await gt(r);
1293
- return await e(i, i.contentWindow);
1294
- } finally {
1295
- (o = i.parentNode) == null || o.removeChild(i);
1296
- }
1297
- }
1298
- const $n = {
1299
- audio: {
1300
- sampleHash: "",
1301
- oscillator: "",
1302
- maxChannels: 0,
1303
- channelCountMode: ""
1304
- }
1305
- }, Mn = async (e) => new Promise((t) => {
1306
- try {
1307
- const r = new window.OfflineAudioContext(1, 5e3, 44100), n = r.createBufferSource(), a = r.createOscillator();
1308
- a.frequency.value = 1e3;
1309
- const o = r.createDynamicsCompressor();
1310
- o.threshold.value = -50, o.knee.value = 40, o.ratio.value = 12, o.attack.value = 0, o.release.value = 0.2, a.connect(o), o.connect(r.destination), a.start(), r.startRendering(), r.oncomplete = (s) => {
1311
- const i = s.renderedBuffer.getChannelData(0);
1312
- a.disconnect(), o.disconnect(), t({
1313
- audio: {
1314
- sampleHash: Pn(i),
1315
- oscillator: a.type,
1316
- maxChannels: r.destination.maxChannelCount,
1317
- channelCountMode: n.channelCountMode
1318
- }
1319
- });
1320
- };
1321
- } catch {
1322
- t({
1323
- audio: {
1324
- sampleHash: "",
1325
- oscillator: "",
1326
- maxChannels: 0,
1327
- channelCountMode: ""
1328
- }
1329
- });
1330
- }
1331
- }), jt = { browser: "" }, Ln = async (e) => typeof navigator > "u" ? jt : { browser: navigator.userAgent }, zt = {
1332
- canvas: {
1333
- data: ""
1334
- }
1335
- }, Un = async (e) => {
1336
- try {
1337
- const t = Array.from(
1338
- { length: 3 },
1339
- () => Hn(300, 30)
1340
- ), r = Gn(t, 300, 30);
1341
- return {
1342
- canvas: {
1343
- data: (await Yt(r.data.toString())).toString()
1344
- }
1345
- };
1346
- } catch {
1347
- return zt;
1348
- }
1349
- }, Hn = (e, t) => {
1350
- const r = document.createElement("canvas"), n = r.getContext("2d");
1351
- if (!n)
1352
- return new ImageData(1, 1);
1353
- r.width = e, r.height = t;
1354
- const a = n.createLinearGradient(0, 0, r.width, r.height);
1355
- a.addColorStop(0, "red"), a.addColorStop(1 / 6, "orange"), a.addColorStop(2 / 6, "yellow"), a.addColorStop(3 / 6, "green"), a.addColorStop(4 / 6, "blue"), a.addColorStop(5 / 6, "indigo"), a.addColorStop(1, "violet"), n.fillStyle = a, n.fillRect(0, 0, r.width, r.height);
1356
- const o = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
1357
- return n.font = "26.321px Arial", n.fillStyle = "black", n.fillText(o, -5, 15), n.fillStyle = "rgba(0, 0, 255, 0.5)", n.fillText(o, -3.3, 17.7), n.beginPath(), n.moveTo(0, 0), n.lineTo(r.width * 2 / 7, r.height), n.strokeStyle = "white", n.lineWidth = 2, n.stroke(), n.getImageData(0, 0, r.width, r.height);
1358
- }, Kn = (e) => {
1359
- if (e.length === 0)
1360
- return 0;
1361
- const t = {};
1362
- for (const n of e)
1363
- t[n] = (t[n] || 0) + 1;
1364
- let r = e[0];
1365
- for (const n in t)
1366
- t[n] > t[r] && (r = parseInt(n, 10));
1367
- return r;
1368
- }, Gn = (e, t, r) => {
1369
- const n = [];
1370
- for (let s = 0; s < e[0].data.length; s++) {
1371
- const i = [];
1372
- for (let d = 0; d < e.length; d++)
1373
- i.push(e[d].data[s]);
1374
- n.push(Kn(i));
1375
- }
1376
- const a = n, o = new Uint8ClampedArray(a);
1377
- return new ImageData(o, t, r);
1378
- }, Bn = [], Wn = "mmMwWLliI0O&1", Vn = "48px", te = ["monospace", "sans-serif", "serif"], ft = [
1379
- "sans-serif-thin",
1380
- "ARNO PRO",
1381
- "Agency FB",
1382
- "Arabic Typesetting",
1383
- "Arial Unicode MS",
1384
- "AvantGarde Bk BT",
1385
- "BankGothic Md BT",
1386
- "Bitstream Vera Sans Mono",
1387
- "Calibri",
1388
- "Century",
1389
- "Century Gothic",
1390
- "Clarendon",
1391
- "EUROSTILE",
1392
- "Franklin Gothic",
1393
- "GOTHAM",
1394
- "Gill Sans",
1395
- "Helvetica Neue",
1396
- "Letter Gothic",
1397
- "Menlo",
1398
- "MS Outlook",
1399
- "MS Reference Specialty",
1400
- "MS UI Gothic",
1401
- "MT Extra",
1402
- "MYRIAD PRO",
1403
- "Marlett",
1404
- "Microsoft Uighur",
1405
- "Minion Pro",
1406
- "Monotype Corsiva",
1407
- "PMingLiU",
1408
- "Pristina",
1409
- "SCRIPTINA",
1410
- "SimHei",
1411
- "Small Fonts",
1412
- "Staccato222 BT",
1413
- "TRAJAN PRO",
1414
- "Univers CE 55 Medium",
1415
- "ZWAdobeF"
1416
- ], Fn = async (e) => Dn(async (t, { document: r }) => {
1417
- const n = r.body;
1418
- n.style.fontSize = Vn;
1419
- const a = r.createElement("div");
1420
- a.style.setProperty("visibility", "hidden", "important");
1421
- const o = {}, s = {}, i = (m) => {
1422
- const b = r.createElement("span"), { style: w } = b;
1423
- return w.position = "absolute", w.top = "0", w.left = "0", w.fontFamily = m, b.textContent = Wn, a.appendChild(b), b;
1424
- }, d = (m, b) => i(`'${m}',${b}`), g = () => te.map(i), p = () => {
1425
- const m = {};
1426
- for (const b of ft)
1427
- m[b] = te.map(
1428
- (w) => d(b, w)
1429
- );
1430
- return m;
1431
- }, h = (m) => te.some(
1432
- (b, w) => m[w].offsetWidth !== o[b] || m[w].offsetHeight !== s[b]
1433
- ), u = g(), c = p();
1434
- n.appendChild(a);
1435
- for (let m = 0; m < te.length; m++)
1436
- o[te[m]] = u[m].offsetWidth, s[te[m]] = u[m].offsetHeight;
1437
- return ft.filter((m) => h(c[m]));
1438
- }), qt = {
1439
- vendor: "",
1440
- vendorUnmasked: "",
1441
- renderer: "",
1442
- rendererUnmasked: "",
1443
- version: "",
1444
- shadingLanguageVersion: ""
1445
- }, Qt = {
1446
- hardware: {
1447
- videocard: qt,
1448
- architecture: 0,
1449
- deviceMemory: "undefined",
1450
- jsHeapSizeLimit: 0
1451
- }
1452
- };
1453
- function Jn() {
1454
- const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
1455
- if (t && "getParameter" in t) {
1456
- const r = t.getExtension("WEBGL_debug_renderer_info");
1457
- return {
1458
- vendor: (t.getParameter(t.VENDOR) || "").toString(),
1459
- vendorUnmasked: r ? (t.getParameter(r.UNMASKED_VENDOR_WEBGL) || "").toString() : "",
1460
- renderer: (t.getParameter(t.RENDERER) || "").toString(),
1461
- rendererUnmasked: r ? (t.getParameter(r.UNMASKED_RENDERER_WEBGL) || "").toString() : "",
1462
- version: (t.getParameter(t.VERSION) || "").toString(),
1463
- shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
1464
- };
1465
- }
1466
- return qt;
1467
- }
1468
- function Yn() {
1469
- const e = new Float32Array(1), t = new Uint8Array(e.buffer);
1470
- return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
1471
- }
1472
- const jn = () => navigator.deviceMemory || 0, zn = () => window.performance && window.performance.memory || {
1473
- jsHeapSizeLimit: 0
1474
- }, qn = async (e) => new Promise((t) => {
1475
- try {
1476
- const r = jn(), n = zn();
1477
- t({
1478
- hardware: {
1479
- videocard: Jn(),
1480
- architecture: Yn(),
1481
- deviceMemory: r.toString() || "undefined",
1482
- jsHeapSizeLimit: n.jsHeapSizeLimit || 0
1483
- }
1484
- });
1485
- } catch {
1486
- t(Qt);
1487
- }
1488
- }), Qn = {
1489
- locales: {
1490
- languages: "",
1491
- timezone: ""
1492
- }
1493
- }, Xn = async (e) => new Promise((t) => {
1494
- t({
1495
- locales: {
1496
- languages: navigator.language,
1497
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
1498
- }
1499
- });
1500
- }), Xt = {
1501
- screen: {
1502
- colorDepth: 0,
1503
- pixelDepth: 0,
1504
- isTouchScreen: !1,
1505
- maxTouchPoints: 0,
1506
- mediaMatches: []
1507
- }
1508
- }, Zn = async (e) => new Promise((t) => {
1509
- try {
1510
- const r = window.screen, n = {
1511
- screen: {
1512
- colorDepth: r.colorDepth,
1513
- pixelDepth: r.pixelDepth,
1514
- isTouchScreen: navigator.maxTouchPoints > 0,
1515
- maxTouchPoints: navigator.maxTouchPoints,
1516
- mediaMatches: ea()
1517
- }
1518
- };
1519
- t(n);
1520
- } catch {
1521
- t(Xt);
1522
- }
1523
- });
1524
- function ea() {
1525
- const e = [], t = {
1526
- "prefers-contrast": [
1527
- "high",
1528
- "more",
1529
- "low",
1530
- "less",
1531
- "forced",
1532
- "no-preference"
1533
- ],
1534
- "any-hover": ["hover", "none"],
1535
- "any-pointer": ["none", "coarse", "fine"],
1536
- pointer: ["none", "coarse", "fine"],
1537
- hover: ["hover", "none"],
1538
- update: ["fast", "slow"],
1539
- "inverted-colors": ["inverted", "none"],
1540
- "prefers-reduced-motion": ["reduce", "no-preference"],
1541
- "prefers-reduced-transparency": ["reduce", "no-preference"],
1542
- scripting: ["none", "initial-only", "enabled"],
1543
- "forced-colors": ["active", "none"],
1544
- "color-gamut": ["srgb", "p3", "rec2020"]
1545
- };
1546
- return Object.keys(t).forEach((r) => {
1547
- t[r].forEach((n) => {
1548
- matchMedia(`(${r}: ${n})`).matches && e.push(`${r}: ${n}`);
1549
- });
1550
- }), e;
1551
- }
1552
- const ta = async (e) => {
1553
- try {
1554
- return {
1555
- system: {
1556
- platform: navigator.platform,
1557
- cookieEnabled: navigator.cookieEnabled,
1558
- productSub: navigator.productSub,
1559
- product: navigator.product
1560
- }
1561
- };
1562
- } catch {
1563
- return Zt;
1564
- }
1565
- }, Zt = {
1566
- system: {
1567
- platform: "",
1568
- cookieEnabled: !1,
1569
- productSub: "",
1570
- product: ""
1571
- }
1572
- }, ra = async (e) => {
1573
- try {
1574
- return Promise.all([
1575
- Mn(),
1576
- Ln(),
1577
- Un(),
1578
- Fn(),
1579
- qn(),
1580
- Xn(),
1581
- Zn(),
1582
- ta()
1583
- ]);
1584
- } catch {
1585
- return [
1586
- $n,
1587
- jt,
1588
- zt,
1589
- Bn,
1590
- Qt,
1591
- Qn,
1592
- Xt,
1593
- Zt
1594
- ];
1595
- }
1596
- }, na = async (e) => {
1597
- try {
1598
- const t = await ra();
1599
- return await Yt(JSON.stringify(t));
1600
- } catch {
1601
- return "";
1602
- }
1603
- }, re = {
1604
- GET_REGISTRATION_OPTIONS: {
1605
- schema: ve.GET_REGISTRATION_OPTIONS,
1606
- method: "getPasskeyRegistrationOptions"
1607
- },
1608
- VERIFY_REGISTRATION: {
1609
- schema: ve.VERIFY_REGISTRATION,
1610
- method: "verifyPasskeyRegistration"
1611
- },
1612
- GET_AUTHENTICATION_OPTIONS: {
1613
- schema: ve.GET_AUTHENTICATION_OPTIONS,
1614
- method: "getPasskeyAuthenticationOptions"
1615
- },
1616
- VERIFY_AUTHENTICATION: {
1617
- schema: ve.VERIFY_AUTHENTICATION,
1618
- method: "verifyPasskeyAuthentication"
1619
- }
1620
- }, ne = async ({
1621
- accessToken: e,
1622
- type: t,
1623
- clientId: r,
1624
- params: n = {}
1625
- }) => {
1626
- try {
1627
- const a = n, o = `Bearer ${e}`, s = await fetch(
1628
- er ? `${Ne.dev}/graphql` : `${Ne.prod}/graphql`,
1629
- {
1630
- credentials: Vt,
1631
- method: Ft,
1632
- headers: {
1633
- authorization: o,
1634
- "Content-Type": Jt,
1635
- [Ot.CLIENT_ID]: `${r}`
1636
- },
1637
- body: JSON.stringify({
1638
- query: t.schema,
1639
- variables: a
1640
- })
1641
- }
1642
- );
1643
- if (s.status !== 200)
1644
- return { status: U, data: [] };
1645
- const { data: i } = await s.json();
1646
- return {
1647
- status: Pe,
1648
- data: i[t.method]
1649
- };
1650
- } catch (a) {
1651
- return console.error(a), { status: U, data: [] };
1652
- }
1653
- }, De = async ({
1654
- type: e,
1655
- clientId: t,
1656
- params: r = {}
1657
- }) => {
1658
- try {
1659
- const n = await fetch(
1660
- er ? `${Ne.dev}/${e}` : `${Ne.prod}/${e}`,
1661
- {
1662
- credentials: Vt,
1663
- method: Ft,
1664
- headers: {
1665
- "Content-Type": Jt,
1666
- [Ot.CLIENT_ID]: `${t}`
1667
- },
1668
- body: JSON.stringify(r)
1669
- }
1670
- );
1671
- if (n.status !== 200)
1672
- return { status: U, data: [] };
1673
- const { data: a } = await n.json();
1674
- return {
1675
- status: Pe,
1676
- data: a || []
1677
- };
1678
- } catch (n) {
1679
- return console.error(n), { status: U, data: [] };
1680
- }
1681
- }, aa = process.env.NODE_ENV === "production", er = !aa, tr = {
1682
- isLoading: !0,
1683
- isAuthenticated: !1,
1684
- authenticationType: null,
1685
- user: void 0,
1686
- logoutReason: "",
1687
- debug: !1
1688
- }, oa = (e) => {
1689
- try {
1690
- const t = gn(e);
1691
- return t ? t[N.USER_ID_KEY] : "";
1692
- } catch {
1693
- return "";
1694
- }
1695
- }, sa = async ({
1696
- userId: e,
1697
- idToken: t,
1698
- accessToken: r,
1699
- refreshToken: n,
1700
- clientId: a,
1701
- domain: o
1702
- }) => {
1703
- var s;
1704
- try {
1705
- return {
1706
- status: ((s = await De({
1707
- type: xe.LOGOUT,
1708
- clientId: a,
1709
- params: {
1710
- userId: e,
1711
- idToken: t,
1712
- accessToken: r,
1713
- refreshToken: n,
1714
- domain: o
1715
- }
1716
- })) == null ? void 0 : s.status) || U
1717
- };
1718
- } catch {
1719
- return {
1720
- status: U
1721
- };
1722
- }
1723
- }, yt = async ({
1724
- username: e,
1725
- password: t,
1726
- clientId: r,
1727
- nonce: n,
1728
- type: a,
1729
- sessionExpiration: o,
1730
- code: s,
1731
- code_verifier: i,
1732
- domain: d,
1733
- fingerprint: g
1734
- }) => {
1735
- var p;
1736
- try {
1737
- const h = await De({
1738
- type: xe.AUTHENTICATE,
1739
- clientId: r,
1740
- params: {
1741
- type: a || Q.ID_AND_ACCESS_TOKEN,
1742
- username: e,
1743
- password: t,
1744
- sessionExpiration: o,
1745
- nonce: n,
1746
- code: s,
1747
- code_verifier: i,
1748
- domain: d,
1749
- fingerprint: g
1750
- }
1751
- }), u = await ue((p = h == null ? void 0 : h.data) == null ? void 0 : p.idToken);
1752
- return u && u.payload[N.USER_ID_KEY] !== "" && u.payload[N.NONCE_KEY] === n ? {
1753
- idToken: h.data.idToken,
1754
- accessToken: h.data.accessToken,
1755
- refreshToken: h.data.refreshToken,
1756
- userId: u.payload[N.USER_ID_KEY],
1757
- status: !0
1758
- } : {
1759
- status: !1
1760
- };
1761
- } catch {
1762
- return {
1763
- status: !1
1764
- };
1765
- }
1766
- }, ia = async ({
1767
- nonce: e,
1768
- clientId: t,
1769
- code_challenge: r
1770
- }) => {
1771
- var n;
1772
- try {
1773
- const a = await De({
1774
- type: xe.CODE,
1775
- clientId: t,
1776
- params: {
1777
- type: Q.CODE,
1778
- nonce: e,
1779
- code_challenge: r
1780
- }
1781
- });
1782
- return (n = a == null ? void 0 : a.data) != null && n.code ? {
1783
- status: Pe,
1784
- data: a.data.code
1785
- } : {
1786
- status: U,
1787
- data: ""
1788
- };
1789
- } catch {
1790
- return {
1791
- status: U,
1792
- data: ""
1793
- };
1794
- }
1795
- }, ca = async ({
1796
- clientId: e,
1797
- userId: t,
1798
- nonce: r,
1799
- refreshToken: n,
1800
- accessToken: a,
1801
- domain: o
1802
- }) => {
1803
- var s;
1804
- try {
1805
- const i = await De({
1806
- type: xe.AUTHENTICATE,
1807
- clientId: e,
1808
- params: {
1809
- type: Q.REFRESH_TOKEN,
1810
- userId: t,
1811
- nonce: r,
1812
- refreshToken: n,
1813
- accessToken: a,
1814
- domain: o,
1815
- fingerprint: await rr()
1816
- }
1817
- }), d = await ue((s = i == null ? void 0 : i.data) == null ? void 0 : s.accessToken);
1818
- return d && d.payload[N.USER_ID_KEY] !== "" && d.payload[N.NONCE_KEY] === r ? {
1819
- accessToken: i.data.accessToken,
1820
- refreshToken: i.data.refreshToken,
1821
- userId: d.payload[N.USER_ID_KEY],
1822
- status: !0
1823
- } : {
1824
- status: !1
1825
- };
1826
- } catch {
1827
- return {
1828
- status: !1
1829
- };
1830
- }
1831
- }, rr = async () => {
1832
- try {
1833
- return await na();
1834
- } catch {
1835
- return "";
1836
- }
1837
- };
1838
- class la {
1839
- constructor(t = null, r = null) {
1840
- Ke(this, "refreshTokenPromise", null), Ke(this, "accessToken"), Ke(this, "refreshToken"), this.accessToken = t || "", this.refreshToken = r || "";
1841
- }
1842
- async refreshtoken({
1843
- clientId: t,
1844
- userId: r,
1845
- nonce: n,
1846
- domain: a
1847
- }) {
1848
- this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
1849
- clientId: t,
1850
- userId: r,
1851
- nonce: n,
1852
- domain: a
1853
- }));
1854
- try {
1855
- return await this.refreshTokenPromise;
1856
- } finally {
1857
- this.refreshTokenPromise = null;
1858
- }
1859
- }
1860
- async _refreshToken({
1861
- clientId: t,
1862
- userId: r,
1863
- nonce: n,
1864
- domain: a
1865
- }) {
1866
- const o = await ue(this.refreshToken);
1867
- if (o && o.payload[N.USER_ID_KEY] !== "") {
1868
- const s = await ca({
1869
- clientId: t,
1870
- userId: r,
1871
- nonce: n,
1872
- refreshToken: this.refreshToken,
1873
- accessToken: this.accessToken,
1874
- domain: a
1875
- });
1876
- return s.status ? (this.accessToken = s.accessToken, this.refreshToken = s.refreshToken, {
1877
- status: Pe,
1878
- newAccessToken: s.accessToken,
1879
- newRefreshToken: s.refreshToken
1880
- }) : {
1881
- status: U
1882
- };
1883
- } else
1884
- return {
1885
- status: U
1886
- };
1887
- }
1888
- }
1889
- const da = (e) => q(
1890
- (...t) => {
1891
- e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1892
- },
1893
- [e]
1894
- ), ae = () => {
1895
- throw new Error(On);
1896
- }, nr = br({
1897
- isAuthenticated: !1,
1898
- isLoading: !1,
1899
- authenticationType: null,
1900
- login: ae,
1901
- logout: ae,
1902
- getAccessToken: ae,
1903
- getIdToken: ae,
1904
- registeringForPasskey: ae,
1905
- loginWithPasskey: ae,
1906
- logoutReason: ""
1907
- }), ua = W.createContext({
1908
- state: tr,
1909
- dispatch: () => {
1910
- }
1911
- }), ma = (e, t) => (t == null ? void 0 : t.type) === ce ? {
1912
- ...e,
1913
- isLoading: t.payload.isLoading
1914
- } : (t == null ? void 0 : t.type) === le ? {
1915
- ...e,
1916
- isLoading: !1,
1917
- isAuthenticated: !0,
1918
- user: t.payload.user,
1919
- authenticationType: t.payload.authenticationType,
1920
- logoutReason: ""
1921
- } : (t == null ? void 0 : t.type) === Wt ? {
1922
- ...e,
1923
- isLoading: !1,
1924
- isAuthenticated: !1,
1925
- user: void 0,
1926
- authenticationType: null,
1927
- logoutReason: t.payload.logoutReason
1928
- } : e, ha = ({
1929
- children: e,
1930
- sessionExpiration: t,
1931
- clientId: r,
1932
- domain: n = "",
1933
- debug: a = !1
1934
- }) => {
1935
- const [o, s] = vt(ma, {
1936
- ...tr,
1937
- debug: a
1938
- }), i = da(a), d = L(!1), g = L(""), [p, h, , u] = be({
1939
- key: `${Te}::${r}::@@user@@`
1940
- }), [c, m, , b] = be({
1941
- key: `${Te}::${r}::@@access@@`
1942
- }), [w, T, , D] = be(
1943
- {
1944
- key: `${Te}::${r}::@@refresh@@`
1945
- }
1946
- ), [F, O, , Z] = be({
1947
- key: `${Te}::${r}::@@nonce@@`
1948
- }), J = new la(c, w), C = q(() => {
1949
- i("removeLocalStorage: removing local storage"), u(), b(), D(), Z();
1950
- }, [
1951
- b,
1952
- u,
1953
- Z,
1954
- D,
1955
- i
1956
- ]), P = q(
1957
- (y) => {
1958
- i(
1959
- "removeStateAndLocalStorage: removing state and local storage with reason: ",
1960
- y
1961
- ), s({
1962
- type: Wt,
1963
- payload: {
1964
- logoutReason: y || ee
1965
- }
1966
- }), C(), s({ type: ce, payload: { isLoading: !1 } });
1967
- },
1968
- [C, i]
1969
- ), _ = q(
1970
- async (y) => {
1971
- i("invalidateAndLogout: invalidating and logging out");
1972
- const { user: v } = o, E = (v == null ? void 0 : v.userId) || oa(p);
1973
- E || i(
1974
- "invalidateAndLogout: user cannot be identified, logging out without userId"
1975
- ), await sa({
1976
- userId: E,
1977
- idToken: p,
1978
- accessToken: c,
1979
- refreshToken: w,
1980
- clientId: r,
1981
- domain: n
1982
- }), P(y || ee);
1983
- },
1984
- [
1985
- c,
1986
- o,
1987
- r,
1988
- n,
1989
- p,
1990
- w,
1991
- P,
1992
- i
1993
- ]
1994
- );
1995
- V(() => ((async () => g.current = await rr())(), () => {
1996
- g.current = "";
1997
- }), []), V(() => {
1998
- if (!d.current)
1999
- return o.isLoading && p !== null ? (async () => {
2000
- try {
2001
- const y = await ue(p);
2002
- y && y.payload[N.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), s({
2003
- type: le,
2004
- payload: {
2005
- authenticationType: y.payload[N.AUTH_TYPE_KEY],
2006
- user: {
2007
- userId: y.payload[N.USER_ID_KEY],
2008
- username: y.payload[N.USERNAME_KEY]
2009
- }
2010
- }
2011
- })) : (i("useEffect: invalid JWT, invalidating and logging out"), await _(ee));
2012
- } catch {
2013
- i(
2014
- "useEffect: exception validating JWT, invalidating and logging out"
2015
- ), await _(ee);
2016
- }
2017
- })() : (i("useEffect: setting the loading state to false"), s({ type: ce, payload: { isLoading: !1 } })), () => {
2018
- d.current = !0;
2019
- };
2020
- }, [o.isLoading, p, _, i]);
2021
- const Le = async (y, v, E = Q.CODE) => {
2022
- s({ type: ce, payload: { isLoading: !0 } }), C();
2023
- const K = Ye();
2024
- if (O(K), i("login: Logging in with type: ", E), E === Q.CODE) {
2025
- const { code_verifier: fr, code_challenge: yr } = await Sn(), nt = await ia({
2026
- nonce: K,
2027
- clientId: r,
2028
- code_challenge: yr
2029
- });
2030
- if (nt.status) {
2031
- const ie = await yt({
2032
- username: y,
2033
- password: v,
2034
- clientId: r,
2035
- sessionExpiration: t,
2036
- nonce: K,
2037
- type: E,
2038
- code: nt.data,
2039
- code_verifier: fr,
2040
- domain: n,
2041
- fingerprint: g.current
2042
- });
2043
- return ie.status ? (h(ie.idToken), m(ie.accessToken), T(ie.refreshToken), s({
2044
- type: le,
2045
- payload: {
2046
- authenticationType: E,
2047
- user: {
2048
- userId: ie.userId,
2049
- username: y
2050
- }
2051
- }
2052
- }), !0) : (P(Ee), !1);
2053
- }
2054
- return !1;
2055
- }
2056
- const se = await yt({
2057
- username: y,
2058
- password: v,
2059
- clientId: r,
2060
- sessionExpiration: t,
2061
- nonce: K,
2062
- type: E,
2063
- domain: n,
2064
- fingerprint: g.current
2065
- });
2066
- return se.status ? (h(se.idToken), m(se.accessToken), T(se.refreshToken), s({
2067
- type: le,
2068
- payload: {
2069
- authenticationType: E,
2070
- user: {
2071
- userId: se.userId,
2072
- username: y
2073
- }
2074
- }
2075
- }), !0) : (P(Ee), !1);
2076
- }, Ue = async (y) => {
2077
- y == null || y.preventDefault(), await _(Cn);
2078
- }, x = async () => {
2079
- const { isAuthenticated: y, user: v } = o;
2080
- try {
2081
- if (y && v && v.userId) {
2082
- if (c) {
2083
- i("getAccessToken");
2084
- const K = await ue(c);
2085
- if (K && K.payload[N.USER_ID_KEY] !== "")
2086
- return c;
2087
- }
2088
- i("getAccessToken: invalid access token, trying to refresh it");
2089
- const E = await J.refreshtoken({
2090
- clientId: r,
2091
- userId: v.userId,
2092
- nonce: F,
2093
- domain: n
2094
- });
2095
- return E.status && E.status === "success" && E.newAccessToken ? (m(E.newAccessToken), T(E.newRefreshToken), E.newAccessToken) : (i(
2096
- "getAccessToken: invalid refresh token, need to re-authenticate"
2097
- ), await _(ee), "");
2098
- }
2099
- return i(
2100
- "getAccessToken: user is not authenticated, cannot get access token"
2101
- ), await _(ee), "";
2102
- } catch {
2103
- return i(
2104
- "getAccessToken: exception occurred, invalidating and logging out"
2105
- ), await _(xn), "";
2106
- }
2107
- }, H = () => o.isAuthenticated && p ? p : "", He = async () => {
2108
- const { user: y } = o;
2109
- let v = await ne({
2110
- accessToken: c,
2111
- clientId: r,
2112
- type: re.GET_REGISTRATION_OPTIONS,
2113
- params: {
2114
- clientId: r,
2115
- id: y == null ? void 0 : y.userId,
2116
- username: y == null ? void 0 : y.username
2117
- }
2118
- });
2119
- if (v.status)
2120
- try {
2121
- const E = await kr(v.data);
2122
- return v = await ne({
2123
- accessToken: c,
2124
- clientId: r,
2125
- type: re.VERIFY_REGISTRATION,
2126
- params: {
2127
- clientId: r,
2128
- id: y == null ? void 0 : y.userId,
2129
- username: y == null ? void 0 : y.username,
2130
- registration: E
2131
- }
2132
- }), !!(v.status && v.data.length > 0);
2133
- } catch {
2134
- return await ne({
2135
- accessToken: c,
2136
- clientId: r,
2137
- type: re.VERIFY_REGISTRATION,
2138
- params: {
2139
- clientId: r,
2140
- id: y == null ? void 0 : y.userId,
2141
- username: y == null ? void 0 : y.username,
2142
- registration: {}
2143
- }
2144
- }), !1;
2145
- }
2146
- return !1;
2147
- }, pe = async () => {
2148
- s({ type: ce, payload: { isLoading: !0 } }), C();
2149
- const y = Ye();
2150
- O(y), i("loginWithPasskey");
2151
- const v = Ye();
2152
- let E = await ne({
2153
- accessToken: c,
2154
- clientId: r,
2155
- type: re.GET_AUTHENTICATION_OPTIONS,
2156
- params: {
2157
- id: v,
2158
- clientId: r
2159
- }
2160
- });
2161
- if (E.status)
2162
- try {
2163
- const K = await Nr(E.data);
2164
- return E = await ne({
2165
- accessToken: c,
2166
- clientId: r,
2167
- type: re.VERIFY_AUTHENTICATION,
2168
- params: {
2169
- clientId: r,
2170
- id: v,
2171
- authentication: K,
2172
- nonce: y,
2173
- domain: n,
2174
- fingerprint: g.current
2175
- }
2176
- }), E.data.status === "success" ? (h(E.data.idToken), m(E.data.accessToken), T(E.data.refreshToken), s({
2177
- type: le,
2178
- payload: {
2179
- authenticationType: Q.PASSKEY,
2180
- user: {
2181
- userId: E.data.userId,
2182
- username: E.data.username
2183
- }
2184
- }
2185
- }), !0) : (P(Ee), !1);
2186
- } catch {
2187
- return await ne({
2188
- accessToken: c,
2189
- clientId: r,
2190
- type: re.VERIFY_AUTHENTICATION,
2191
- params: {
2192
- clientId: r,
2193
- id: v,
2194
- authentication: {},
2195
- nonce: y,
2196
- domain: n
2197
- }
2198
- }), P(Ee), !1;
2199
- }
2200
- return !1;
2201
- };
2202
- return /* @__PURE__ */ l(ua.Provider, { value: { state: o, dispatch: s }, children: /* @__PURE__ */ l(
2203
- nr.Provider,
2204
- {
2205
- value: {
2206
- ...o,
2207
- login: Le,
2208
- logout: Ue,
2209
- getAccessToken: x,
2210
- getIdToken: H,
2211
- registeringForPasskey: He,
2212
- loginWithPasskey: pe
2213
- },
2214
- children: e
2215
- }
2216
- ) });
2217
- }, Ze = (e = nr) => St(e), Go = "user", Bo = "assistant", Wo = "system", Vo = "internal", Fo = "hidden", Jo = "I'm having trouble right now. Please try again later.", Yo = "gpt-4", jo = 128e3, zo = "action-message", qo = "action-reset", Qo = "action-model", Xo = "action-restore", Zo = "action-location", es = "action-streaming", ts = "action-search", rs = "action-sort", ns = "sassy-saint-", as = "details", os = "search", ss = "sort", is = "location", cs = "==stats==", pa = "b44c68f0-e5b3-4a1d-a3e3-df8632b0223b", bt = (e) => Number.isFinite(e) ? e : 0;
2218
- function ga(e) {
2219
- return {
2220
- days: Math.trunc(e / 864e5),
2221
- hours: Math.trunc(e / 36e5 % 24),
2222
- minutes: Math.trunc(e / 6e4 % 60),
2223
- seconds: Math.trunc(e / 1e3 % 60),
2224
- milliseconds: Math.trunc(e % 1e3),
2225
- microseconds: Math.trunc(bt(e * 1e3) % 1e3),
2226
- nanoseconds: Math.trunc(bt(e * 1e6) % 1e3)
2227
- };
2228
- }
2229
- function fa(e) {
2230
- return {
2231
- days: e / 86400000n,
2232
- hours: e / 3600000n % 24n,
2233
- minutes: e / 60000n % 60n,
2234
- seconds: e / 1000n % 60n,
2235
- milliseconds: e % 1000n,
2236
- microseconds: 0n,
2237
- nanoseconds: 0n
2238
- };
2239
- }
2240
- function ya(e) {
2241
- switch (typeof e) {
2242
- case "number": {
2243
- if (Number.isFinite(e))
2244
- return ga(e);
2245
- break;
2246
- }
2247
- case "bigint":
2248
- return fa(e);
2249
- }
2250
- throw new TypeError("Expected a finite number or bigint");
2251
- }
2252
- const ba = (e) => e === 0 || e === 0n, wa = (e, t) => t === 1 || t === 1n ? e : `${e}s`, Ea = 1e-7, Ta = 24n * 60n * 60n * 1000n;
2253
- function va(e, t) {
2254
- const r = typeof e == "bigint";
2255
- if (!r && !Number.isFinite(e))
2256
- throw new TypeError("Expected a finite number or bigint");
2257
- t = { ...t };
2258
- const n = e < 0 ? "-" : "";
2259
- e = e < 0 ? -e : e, t.colonNotation && (t.compact = !1, t.formatSubMilliseconds = !1, t.separateMilliseconds = !1, t.verbose = !1), t.compact && (t.unitCount = 1, t.secondsDecimalDigits = 0, t.millisecondsDecimalDigits = 0);
2260
- let a = [];
2261
- const o = (p, h) => {
2262
- const u = Math.floor(p * 10 ** h + Ea);
2263
- return (Math.round(u) / 10 ** h).toFixed(h);
2264
- }, s = (p, h, u, c) => {
2265
- if (!((a.length === 0 || !t.colonNotation) && ba(p) && !(t.colonNotation && u === "m"))) {
2266
- if (c ?? (c = String(p)), t.colonNotation) {
2267
- const m = c.includes(".") ? c.split(".")[0].length : c.length, b = a.length > 0 ? 2 : 1;
2268
- c = "0".repeat(Math.max(0, b - m)) + c;
2269
- } else
2270
- c += t.verbose ? " " + wa(h, p) : u;
2271
- a.push(c);
2272
- }
2273
- }, i = ya(e), d = BigInt(i.days);
2274
- if (s(d / 365n, "year", "y"), s(d % 365n, "day", "d"), s(Number(i.hours), "hour", "h"), s(Number(i.minutes), "minute", "m"), t.separateMilliseconds || t.formatSubMilliseconds || !t.colonNotation && e < 1e3) {
2275
- const p = Number(i.seconds), h = Number(i.milliseconds), u = Number(i.microseconds), c = Number(i.nanoseconds);
2276
- if (s(p, "second", "s"), t.formatSubMilliseconds)
2277
- s(h, "millisecond", "ms"), s(u, "microsecond", "µs"), s(c, "nanosecond", "ns");
2278
- else {
2279
- const m = h + u / 1e3 + c / 1e6, b = typeof t.millisecondsDecimalDigits == "number" ? t.millisecondsDecimalDigits : 0, w = m >= 1 ? Math.round(m) : Math.ceil(m), T = b ? m.toFixed(b) : w;
2280
- s(
2281
- Number.parseFloat(T),
2282
- "millisecond",
2283
- "ms",
2284
- T
2285
- );
2286
- }
2287
- } else {
2288
- const p = (r ? Number(e % Ta) : e) / 1e3 % 60, h = typeof t.secondsDecimalDigits == "number" ? t.secondsDecimalDigits : 1, u = o(p, h), c = t.keepDecimalsOnWholeSeconds ? u : u.replace(/\.0+$/, "");
2289
- s(Number.parseFloat(c), "second", "s", c);
2290
- }
2291
- if (a.length === 0)
2292
- return n + "0" + (t.verbose ? " milliseconds" : "ms");
2293
- const g = t.colonNotation ? ":" : " ";
2294
- return typeof t.unitCount == "number" && (a = a.slice(0, Math.max(t.unitCount, 1))), n + a.join(g);
2295
- }
2296
- const Sa = process.env.NODE_ENV === "production", et = !Sa, Ia = et ? "gizmette.local.com" : "gizmette.com", ls = (e, t) => e.length > t ? e.substring(0, t) + "..." : e, ar = (e, t) => {
2297
- const r = e < 0 ? t ? "W" : "S" : t ? "E" : "N", n = 0 | Math.abs(e), a = 0 | Math.abs(e) * 60 % 60, o = (0 | Math.abs(e) * 60 % 1 * 6e3) / 100;
2298
- return {
2299
- dir: r,
2300
- deg: n,
2301
- min: a,
2302
- sec: o
2303
- };
2304
- }, ds = (e) => {
2305
- if (!e && e !== 0)
2306
- return "N/A";
2307
- const t = ar(e, !1);
2308
- return `${t.deg}° ${t.min}' ${t.sec}" ${t.dir}`;
2309
- }, us = (e) => {
2310
- if (!e && e !== 0)
2311
- return "N/A";
2312
- const t = ar(e, !0);
2313
- return `${t.deg}° ${t.min}' ${t.sec}" ${t.dir}`;
2314
- }, ms = async () => {
2315
- const e = {
2316
- /**
2317
- * A boolean value that indicates the application would
2318
- * like to receive the best possible results. If true
2319
- * and if the device is able to provide a more accurate
2320
- * position, it will do so. Note that this can result in
2321
- * slower response times or increased power consumption
2322
- * (with a GPS chip on a mobile device for example). On
2323
- * the other hand, if false, the device can take the
2324
- * liberty to save resources by responding more quickly
2325
- * and/or using less power. Default: false.
2326
- */
2327
- enableHighAccuracy: !1,
2328
- /**
2329
- * A positive long value representing the maximum length
2330
- * of time (in milliseconds) the device is allowed to
2331
- * take in order to return a position. The default value
2332
- * is Infinity, meaning that getCurrentPosition() won't
2333
- * return until the position is available.
2334
- */
2335
- timeout: 1e4,
2336
- /**
2337
- * A positive long value indicating the maximum age in
2338
- * milliseconds of a possible cached position that is
2339
- * acceptable to return. If set to 0, it means that the
2340
- * device cannot use a cached position and must attempt
2341
- * to retrieve the real current position. If set to
2342
- * Infinity the device must return a cached position
2343
- * regardless of its age. Default: 0.
2344
- */
2345
- maximumAge: 6e4
2346
- };
2347
- return new Promise((t, r) => {
2348
- var n;
2349
- (n = navigator == null ? void 0 : navigator.geolocation) == null || n.getCurrentPosition(
2350
- (a) => {
2351
- t({
2352
- latitude: a.coords.latitude,
2353
- longitude: a.coords.longitude,
2354
- accuracy: a.coords.accuracy
2355
- });
2356
- },
2357
- (a) => {
2358
- r(a);
2359
- },
2360
- e
2361
- );
2362
- });
2363
- }, hs = (e, t) => t ? Object.keys(t).map((r) => /* @__PURE__ */ l("dl", { className: "my-0", children: /* @__PURE__ */ S("div", { className: "flex items-center justify-between", children: [
2364
- /* @__PURE__ */ l("dt", { className: "inline-block font-bold text-copy-dark dark:text-copy-lighter", children: r }),
2365
- /* @__PURE__ */ l("dd", { className: "inline-block", children: t[r] })
2366
- ] }) }, `${e}-${r}`)) : null;
2367
- function ps({
2368
- data: e,
2369
- formatter: t = (r) => r
2370
- }) {
2371
- const r = e.filter(
2372
- (a) => typeof a == "number" && a > 0
2373
- ), n = r.reduce(
2374
- (a, o) => (a || 0) + (o || 0),
2375
- 0
2376
- );
2377
- return t(n ? n / r.length : 0);
2378
- }
2379
- const gs = (e, t) => t && t.messages.length > 0 && t.messages[t.messages.length - 1].message.role === e, fs = new Intl.NumberFormat("en", {
2380
- style: "decimal",
2381
- signDisplay: "never",
2382
- minimumFractionDigits: 0,
2383
- maximumFractionDigits: 0
2384
- }), ys = (e) => va(e, {
2385
- secondsDecimalDigits: 2,
2386
- unitCount: 2
2387
- }), Aa = (e) => f(
2388
- "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",
2389
- e || et ? "pt-4" : "pt-10"
2390
- ), bs = (e, t) => t === 1 ? e : `${e}s`, $e = (e) => {
2391
- let t = "";
2392
- if (typeof e == "number" || typeof e == "string")
2393
- t = "m-" + e;
2394
- else {
2395
- const r = [];
2396
- (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(" ");
2397
- }
2398
- return t;
2399
- }, ws = "av-bubble", wt = "av-button", Ae = "av-card", ka = "av-footer", _a = "av-main", Es = "av-messagebox", Ts = "av-panel", vs = "av-spinner", or = "icon", sr = "button", Ra = "link", Na = ({
2400
- type: e,
2401
- size: t,
2402
- labelRight: r,
2403
- labelLeft: n,
2404
- align: a
2405
- }) => {
2406
- 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";
2407
- switch (e) {
2408
- case sr:
2409
- return f("px-4", {
2410
- [o]: t === "small",
2411
- [s]: t === "medium",
2412
- [i]: t === "large"
2413
- });
2414
- case Ra:
2415
- return f("px-4 text-center", {
2416
- [o]: t === "small",
2417
- [s]: t === "medium",
2418
- [i]: t === "large"
2419
- });
2420
- case or:
2421
- return f("inline-flex items-center", {
2422
- "justify-center": a === "center",
2423
- "justify-start": a === "left",
2424
- "justify-end": a === "right",
2425
- "h-6 w-6 p-0": t === "small" && !(r || n),
2426
- "h-6 px-4 text-sm font-medium": t === "small" && (r || n),
2427
- "h-8 w-8 p-1": t === "medium" && !(r || n),
2428
- "h-8 px-4 text-base font-medium": t === "medium" && (r || n),
2429
- "h-12 w-12 p-2": t === "large" && !(r || n),
2430
- "h-12 px-4 text-lg font-medium": t === "large" && (r || n)
2431
- });
2432
- }
2433
- }, Ca = ({
2434
- mode: e,
2435
- noBackground: t,
2436
- noTruncate: r,
2437
- variant: n
2438
- }) => {
2439
- if (t)
2440
- return "not-prose rounded-full";
2441
- if (n === "primary")
2442
- return f("not-prose rounded-full", {
2443
- truncate: !r,
2444
- "bg-action-dark text-copy-light": e === "dark",
2445
- "bg-action-light text-copy-lighter": e === "light",
2446
- "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
2447
- "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
2448
- });
2449
- if (n === "secondary")
2450
- return f("not-prose rounded-full", {
2451
- truncate: !r,
2452
- "bg-action-dark text-copy-light": e === "light",
2453
- "bg-action-light text-copy-lighter": e === "dark",
2454
- "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
2455
- "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
2456
- });
2457
- if (n === "danger")
2458
- return f("not-prose rounded-full", {
2459
- truncate: !r,
2460
- "bg-action-danger-dark text-copy-light": e === "dark",
2461
- "bg-action-danger-light text-copy-lighter": e === "light",
2462
- "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
2463
- "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
2464
- });
2465
- }, xa = ({
2466
- mode: e,
2467
- disabled: t,
2468
- variant: r
2469
- }) => {
2470
- if (t)
2471
- return "";
2472
- if (r === "primary")
2473
- return f("hover:text-copy-light-hover", {
2474
- "hover:bg-action-dark-hover": e === "dark",
2475
- "hover:bg-action-light-hover": e === "light",
2476
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
2477
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
2478
- });
2479
- if (r === "secondary")
2480
- return f("hover:text-copy-light-hover", {
2481
- "hover:bg-action-dark-hover": e === "light",
2482
- "hover:bg-action-light-hover": e === "dark",
2483
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
2484
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
2485
- });
2486
- if (r === "danger")
2487
- return f("hover:text-copy-light-hover", {
2488
- "hover:bg-action-danger-dark-hover": e === "dark",
2489
- "hover:bg-action-danger-light-hover": e === "light",
2490
- "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
2491
- "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
2492
- });
2493
- }, Oa = ({
2494
- mode: e,
2495
- disabled: t,
2496
- variant: r
2497
- }) => {
2498
- if (t)
2499
- return "";
2500
- if (r === "primary")
2501
- return f("active:text-copy-light-active", {
2502
- "active:bg-action-dark-active": e === "dark",
2503
- "active:bg-action-light-active": e === "light",
2504
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
2505
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
2506
- });
2507
- if (r === "secondary")
2508
- return f("active:text-copy-light-active", {
2509
- "active:bg-action-dark-active": e === "light",
2510
- "active:bg-action-light-active": e === "dark",
2511
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
2512
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
2513
- });
2514
- if (r === "danger")
2515
- return f("active:text-copy-lighter-active", {
2516
- "active:bg-action-danger-dark-active": e === "dark",
2517
- "active:bg-action-danger-light-active": e === "light",
2518
- "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
2519
- "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
2520
- });
2521
- }, Pa = ({
2522
- mode: e,
2523
- noBorder: t,
2524
- variant: r
2525
- }) => {
2526
- if (t)
2527
- return "border border-transparent";
2528
- if (r === "primary")
2529
- return f("border", {
2530
- "border-border-dark": e === "dark",
2531
- "border-border-accent": e === "light",
2532
- "border-border-dark dark:border-border-accent": e === "system",
2533
- "border-border-accent dark:border-border-dark": e === "alt-system"
2534
- });
2535
- if (r === "secondary")
2536
- return f("border", {
2537
- "border-border-dark": e === "light",
2538
- "border-border-accent": e === "dark",
2539
- "border-border-dark dark:border-border-accent": e === "alt-system",
2540
- "border-border-accent dark:border-border-dark": e === "system"
2541
- });
2542
- if (r === "danger")
2543
- return f("border", {
2544
- "border-border-danger-dark": e === "dark",
2545
- "border-border-danger-medium": e === "light",
2546
- "border-border-danger-dark dark:border-border-danger-medium": e === "system",
2547
- "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
2548
- });
2549
- }, Da = ({ focusMode: e }) => f("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
2550
- "focus:outline-focus-dark": e === "dark",
2551
- "focus:outline-focus-light": e === "light",
2552
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
2553
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
2554
- }), ir = ({
2555
- type: e,
2556
- className: t,
2557
- raw: r,
2558
- mode: n,
2559
- focusMode: a,
2560
- disabled: o,
2561
- fullWidth: s,
2562
- size: i,
2563
- noBorder: d,
2564
- labelRight: g,
2565
- labelLeft: p,
2566
- spacing: h,
2567
- noBackground: u,
2568
- variant: c,
2569
- noTruncate: m,
2570
- align: b
2571
- }) => (c || (c = "primary"), r ? f(wt, t) : f(
2572
- wt,
2573
- t,
2574
- $e(h),
2575
- Ca({ mode: n, variant: c, noBackground: u, noTruncate: m }),
2576
- Na({ type: e, size: i, labelRight: g, labelLeft: p, align: b }),
2577
- Pa({ mode: n, variant: c, noBorder: d }),
2578
- Da({ focusMode: a }),
2579
- xa({ mode: n, variant: c, disabled: o }),
2580
- Oa({ mode: n, variant: c, disabled: o }),
2581
- {
2582
- "w-full": s,
2583
- "disabled:cursor-not-allowed disabled:opacity-50": o
2584
- }
2585
- )), $a = (e, t, r) => {
2586
- var n;
2587
- !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((n = e == null ? void 0 : e.currentTarget) == null ? void 0 : n.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
2588
- }, tt = W.forwardRef(
2589
- (e, t) => {
2590
- const { onClick: r, noInternalClick: n = !1, ...a } = e;
2591
- return /* @__PURE__ */ l(
2592
- "button",
2593
- {
2594
- ref: t,
2595
- onClick: (o) => {
2596
- $a(o, n, r);
2597
- },
2598
- ...a
2599
- }
2600
- );
2601
- }
2602
- );
2603
- tt.displayName = "BaseButton";
2604
- const qe = W.forwardRef(
2605
- ({
2606
- children: e,
2607
- disabled: t = !1,
2608
- mode: r = "system",
2609
- focusMode: n = "system",
2610
- fullWidth: a = !1,
2611
- className: o,
2612
- type: s = "button",
2613
- raw: i = !1,
2614
- noBorder: d = !1,
2615
- "aria-label": g,
2616
- label: p,
2617
- size: h = "medium",
2618
- labelRight: u,
2619
- labelLeft: c,
2620
- spacing: m,
2621
- noBackground: b = !1,
2622
- align: w = "center",
2623
- ...T
2624
- }, D) => {
2625
- const F = ir({
2626
- type: or,
2627
- mode: r,
2628
- focusMode: n,
2629
- fullWidth: a,
2630
- disabled: t,
2631
- raw: i,
2632
- className: o,
2633
- noBorder: d,
2634
- size: h,
2635
- labelRight: u,
2636
- labelLeft: c,
2637
- spacing: m,
2638
- noBackground: b,
2639
- align: w
2640
- }), O = f({
2641
- "text-copy-accent-dark": r === "light" && !i,
2642
- "text-copy-light": r === "dark" && !i,
2643
- "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !i,
2644
- "text-copy-light dark:text-copy-accent-dark": r === "system" && !i
2645
- });
2646
- return /* @__PURE__ */ S(
2647
- tt,
2648
- {
2649
- ref: D,
2650
- className: F,
2651
- disabled: t,
2652
- type: s,
2653
- "aria-label": g || p,
2654
- ...T,
2655
- children: [
2656
- c && /* @__PURE__ */ l("span", { className: "pr-2", children: c }),
2657
- /* @__PURE__ */ l("div", { className: O, children: e }),
2658
- u && /* @__PURE__ */ l("span", { className: "pl-2", children: u })
2659
- ]
2660
- }
2661
- );
2662
- }
2663
- );
2664
- qe.displayName = "ButtonIcon";
2665
- const cr = W.forwardRef(
2666
- ({
2667
- children: e,
2668
- disabled: t = !1,
2669
- mode: r = "system",
2670
- focusMode: n = "system",
2671
- fullWidth: a = !1,
2672
- className: o,
2673
- size: s = "medium",
2674
- raw: i = !1,
2675
- noBorder: d = !1,
2676
- spacing: g,
2677
- variant: p = "primary",
2678
- noTruncate: h = !1,
2679
- ...u
2680
- }, c) => {
2681
- const m = ir({
2682
- type: sr,
2683
- mode: r,
2684
- focusMode: n,
2685
- fullWidth: a,
2686
- disabled: t,
2687
- raw: i,
2688
- className: o,
2689
- size: s,
2690
- noBorder: d,
2691
- spacing: g,
2692
- variant: p,
2693
- noTruncate: h
2694
- });
2695
- return /* @__PURE__ */ l(
2696
- tt,
2697
- {
2698
- ref: c,
2699
- className: m,
2700
- disabled: t,
2701
- ...u,
2702
- children: e
2703
- }
2704
- );
2705
- }
2706
- );
2707
- cr.displayName = "Button";
2708
- function Ma(e) {
2709
- const t = It();
2710
- return `${e}${t}`;
2711
- }
2712
- const La = ({
2713
- className: e,
2714
- headerClassName: t,
2715
- bodyClassName: r,
2716
- footerClassName: n,
2717
- spacing: a,
2718
- mode: o,
2719
- compact: s,
2720
- noBorder: i
2721
- }) => {
2722
- const d = f(
2723
- Ae,
2724
- e,
2725
- "rounded-md",
2726
- $e(a),
2727
- {
2728
- "border-none": i,
2729
- "border-2": !i,
2730
- "p-4": !s,
2731
- "p-1 sm:p-2": s,
2732
- "border-border-accent bg-surface-darker text-copy-light": o === "darker",
2733
- "border-border-accent bg-surface-dark text-copy-light": o === "dark",
2734
- "border-border-dark bg-surface-lighter text-copy-dark": o === "light",
2735
- "border-border-dark bg-surface-lighter text-copy-dark dark:border-border-accent dark:bg-surface-dark dark:text-copy-light": o === "system",
2736
- "border-border-accent bg-surface-dark text-copy-light dark:border-border-dark dark:bg-surface-lighter dark:text-copy-dark": o === "alt-system"
2737
- }
2738
- ), g = t || f(`${Ae}__header mt-0 border-b-2`, {
2739
- "text-copy-light border-border-accent": o === "darker",
2740
- "border-border-accent": o === "dark",
2741
- "border-border-medium": o === "light",
2742
- "border-border-medium dark:border-border-accent": o === "system",
2743
- "border-border-accent dark:border-border-medium": o === "alt-system",
2744
- "mb-4": !s,
2745
- "mb-2": s
2746
- }), p = f(r), h = n || f(`${Ae}__footer pt-2`);
2747
- return {
2748
- wrapper: d,
2749
- header: g,
2750
- body: p,
2751
- footer: h
2752
- };
2753
- };
2754
- function Ua({
2755
- id: e,
2756
- content: t,
2757
- userAriaLabelledby: r,
2758
- className: n
2759
- }) {
2760
- return typeof t == "string" ? /* @__PURE__ */ l("h2", { id: e, className: n, children: t }) : r ? /* @__PURE__ */ l("div", { className: n, children: t }) : t ? /* @__PURE__ */ l("div", { className: n, id: e, children: t }) : null;
2761
- }
2762
- const Ha = ({
2763
- header: e,
2764
- headerClassName: t,
2765
- footer: r,
2766
- footerClassName: n,
2767
- children: a,
2768
- className: o,
2769
- bodyClassName: s,
2770
- "aria-labelledby": i,
2771
- spacing: d,
2772
- mode: g = "system",
2773
- compact: p = !1,
2774
- noBorder: h = !1,
2775
- ...u
2776
- }) => {
2777
- let c = null, m = null;
2778
- const b = typeof e == "string", w = Ma(Ae), T = La({
2779
- className: o,
2780
- headerClassName: t,
2781
- bodyClassName: s,
2782
- footerClassName: n,
2783
- spacing: d,
2784
- mode: g,
2785
- compact: p,
2786
- noBorder: h
2787
- });
2788
- return b ? (c = w, m = c) : !b && e && i ? (c = null, m = i) : !b && e && !i ? (c = w, m = c) : (c = null, m = i || null), /* @__PURE__ */ l("div", { className: T.wrapper, children: /* @__PURE__ */ S(
2789
- "section",
2790
- {
2791
- ...m && {
2792
- "aria-labelledby": m
2793
- },
2794
- className: T.body,
2795
- ...u,
2796
- children: [
2797
- /* @__PURE__ */ l(
2798
- Ua,
2799
- {
2800
- ...c && { id: c },
2801
- content: e,
2802
- className: T.header,
2803
- userAriaLabelledby: i
2804
- }
2805
- ),
2806
- /* @__PURE__ */ l("div", { children: a }),
2807
- r ? /* @__PURE__ */ l("div", { className: T.footer, children: r }) : null
2808
- ]
2809
- }
2810
- ) });
2811
- }, Ka = ({
2812
- className: e,
2813
- mode: t = "system",
2814
- row1: r,
2815
- row2: n,
2816
- noMargins: a = !1,
2817
- spacing: o,
2818
- raw: s = !1
2819
- }) => {
2820
- const i = f(ka, e, $e(o), {
2821
- "text-copy-dark": !s && t === "dark",
2822
- "text-copy-lighter": !s && t === "light",
2823
- "text-copy-dark dark:text-copy-lighter": !s && t === "system",
2824
- "text-copy-lighter dark:text-copy-dark": !s && t === "alt-system",
2825
- "mb-[100px]": !a && !s,
2826
- "mt-0 flex w-full flex-col p-2 text-center text-xs sm:mt-3 md:mx-auto md:max-w-4xl": !s
2827
- });
2828
- return /* @__PURE__ */ S("footer", { className: i, children: [
2829
- r && /* @__PURE__ */ l("div", { children: r }),
2830
- n && /* @__PURE__ */ l("div", { children: n })
2831
- ] });
2832
- }, Ga = ({
2833
- children: e,
2834
- className: t,
2835
- raw: r = !1,
2836
- spacing: n
2837
- }) => {
2838
- const a = f(t, _a, $e(n), {
2839
- "mt-2 flex w-full flex-col p-2 sm:mt-3 md:mx-auto md:max-w-4xl": !r
2840
- });
2841
- return /* @__PURE__ */ l("main", { className: a, children: e });
2842
- };
2843
- /*!
2844
- @versini/ui-components v5.21.1
2845
- © 2024 gizmette.com
2846
- */
2847
- try {
2848
- window.__VERSINI_UI_GLOBAL__ || (window.__VERSINI_UI_GLOBAL__ = {
2849
- version: "5.21.1",
2850
- buildTime: "08/07/2024 09:49 AM EDT",
2851
- homepage: "https://github.com/aversini/ui-components",
2852
- license: "MIT"
2853
- });
2854
- } catch {
2855
- }
2856
- function Ba(e) {
2857
- return At(() => e.every((t) => t == null) ? () => {
2858
- } : (t) => {
2859
- e.forEach((r) => {
2860
- typeof r == "function" ? r(t) : r != null && (r.current = t);
2861
- });
2862
- }, e);
2863
- }
2864
- function Wa(e) {
2865
- const t = It();
2866
- if (!e)
2867
- return t;
2868
- if (typeof e == "number" || typeof e == "string")
2869
- return `${e}${t}`;
2870
- if (typeof e == "object") {
2871
- const { id: r, prefix: n = "" } = e;
2872
- return typeof r == "number" || typeof r == "string" ? `${n}${r}` : `${n}${t}`;
2873
- }
2874
- }
2875
- const lr = "SET_ANNOUNCEMENT", dr = "CLEAR_ANNOUNCEMENT", Va = {
2876
- alert: null,
2877
- alertdialog: null,
2878
- log: "polite",
2879
- marquee: null,
2880
- progressbar: null,
2881
- status: "polite",
2882
- timer: "assertive"
2883
- }, Fa = (e, t) => {
2884
- switch (t == null ? void 0 : t.type) {
2885
- case lr:
2886
- return {
2887
- ...e,
2888
- announcement: t.payload
2889
- };
2890
- case dr:
2891
- return {
2892
- ...e,
2893
- announcement: null
2894
- };
2895
- default:
2896
- return e;
2897
- }
2898
- }, Ja = ({
2899
- onAnnouncementClear: e,
2900
- dispatch: t
2901
- }) => {
2902
- t({
2903
- type: dr
2904
- }), typeof e == "function" && e();
2905
- }, Et = ({
2906
- children: e,
2907
- clearAnnouncementDelay: t,
2908
- clearAnnouncementTimeoutRef: r,
2909
- onAnnouncementClear: n,
2910
- dispatch: a
2911
- }) => {
2912
- (r == null ? void 0 : r.current) !== null && clearTimeout(r.current), e !== null && a({
2913
- type: lr,
2914
- payload: e
2915
- }), t && (r.current = setTimeout(
2916
- () => Ja({
2917
- onAnnouncementClear: n,
2918
- dispatch: a
2919
- }),
2920
- t
2921
- ));
2922
- }, Ya = ({
2923
- children: e,
2924
- announcementTimeoutRef: t,
2925
- announcementDelay: r,
2926
- clearAnnouncementDelay: n,
2927
- clearAnnouncementTimeoutRef: a,
2928
- onAnnouncementClear: o,
2929
- dispatch: s
2930
- }) => {
2931
- clearTimeout(t.current), r ? t.current = setTimeout(Et, r, {
2932
- children: e,
2933
- clearAnnouncementDelay: n,
2934
- clearAnnouncementTimeoutRef: a,
2935
- onAnnouncementClear: o,
2936
- dispatch: s
2937
- }) : Et({
2938
- children: e,
2939
- clearAnnouncementDelay: n,
2940
- clearAnnouncementTimeoutRef: a,
2941
- onAnnouncementClear: o,
2942
- dispatch: s
2943
- });
2944
- };
2945
- function ur({
2946
- children: e,
2947
- className: t,
2948
- politeness: r,
2949
- role: n = null,
2950
- announcementDelay: a,
2951
- clearAnnouncementDelay: o,
2952
- onAnnouncementClear: s,
2953
- visible: i,
2954
- ...d
2955
- }) {
2956
- const g = L(), p = L(), [h, u] = vt(Fa, {
2957
- announcement: null
2958
- });
2959
- let c = r;
2960
- typeof c > "u" && (c = n ? Va[n] : "assertive"), V(() => {
2961
- Ya({
2962
- announcementTimeoutRef: g,
2963
- announcementDelay: a,
2964
- children: e,
2965
- clearAnnouncementDelay: o,
2966
- clearAnnouncementTimeoutRef: p,
2967
- onAnnouncementClear: s,
2968
- dispatch: u
2969
- });
2970
- }, [
2971
- e,
2972
- a,
2973
- o,
2974
- s
2975
- ]);
2976
- const m = f(t, {
2977
- "sr-only": !i
2978
- });
2979
- return /* @__PURE__ */ l(
2980
- "div",
2981
- {
2982
- "aria-live": c,
2983
- ...n && { role: n },
2984
- className: m,
2985
- ...d,
2986
- children: h.announcement
2987
- }
2988
- );
2989
- }
2990
- /*!
2991
- @versini/ui-private v1.4.7
2992
- © 2024 gizmette.com
2993
- */
2994
- try {
2995
- window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
2996
- version: "1.4.7",
2997
- buildTime: "08/07/2024 12:36 PM EDT",
2998
- homepage: "https://github.com/aversini/ui-components",
2999
- license: "MIT"
3000
- });
3001
- } catch {
3002
- }
3003
- const ja = (e) => {
3004
- let t = "";
3005
- if (typeof e == "number" || typeof e == "string")
3006
- t = "m-" + e;
3007
- else {
3008
- const r = [];
3009
- (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(" ");
3010
- }
3011
- return t;
3012
- }, mr = "av-text-input", za = "av-text-input-wrapper", je = "av-text-input-helper-text", Ss = "av-text-area", Is = "av-text-area-wrapper", As = "av-text-area-helper-text", ks = "av-text-area__control--right", _s = "av-toggle";
3013
- function qa() {
3014
- const e = L(!1);
3015
- return V(() => (e.current = !0, () => {
3016
- e.current = !1;
3017
- }), []), q(() => e.current, []);
3018
- }
3019
- const Qa = {
3020
- x: 0,
3021
- y: 0,
3022
- width: 0,
3023
- height: 0,
3024
- top: 0,
3025
- left: 0,
3026
- bottom: 0,
3027
- right: 0
3028
- };
3029
- function Xa(e) {
3030
- const t = qa(), r = L(0), n = L(null), [a, o] = j(Qa), s = At(
3031
- () => typeof window < "u" ? new ResizeObserver((i) => {
3032
- const d = i[0];
3033
- d && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
3034
- n.current && t() && o(d.contentRect);
3035
- }));
3036
- }) : null,
3037
- [t]
3038
- );
3039
- return V(() => (n.current && (s == null || s.observe(n.current, e)), () => {
3040
- s == null || s.disconnect(), r.current && cancelAnimationFrame(r.current);
3041
- }), [s, e]), [n, a];
3042
- }
3043
- const Za = ({
3044
- mode: e
3045
- }) => f({
3046
- "bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
3047
- "bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
3048
- "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
3049
- "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
3050
- }), eo = ({
3051
- focusMode: e
3052
- }) => f("focus:outline focus:outline-2 focus:outline-offset-2", {
3053
- "focus:outline-focus-dark": e === "dark",
3054
- "focus:outline-focus-light": e === "light",
3055
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
3056
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
3057
- }), to = ({
3058
- noBorder: e,
3059
- error: t
3060
- }) => f("border-2", {
3061
- "border-border-dark": !e && !t,
3062
- "focus:border-border-dark": !e && t,
3063
- "border-border-error-dark": !e && t,
3064
- "border-transparent": e
3065
- }), ro = ({
3066
- disabled: e,
3067
- raw: t,
3068
- error: r,
3069
- mode: n
3070
- }) => {
3071
- if (t)
3072
- return "";
3073
- if (e)
3074
- return f("absolute px-2 cursor-not-allowed opacity-50 font-medium");
3075
- if (!r)
3076
- return f("absolute px-2 cursor-text font-medium", {
3077
- "text-copy-lighter": n === "dark",
3078
- "text-copy-dark": n === "light",
3079
- "text-copy-dark dark:text-copy-lighter": n === "system",
3080
- "text-copy-lighter dark:text-copy-dark": n === "alt-system"
3081
- });
3082
- if (r)
3083
- return f("absolute px-2 cursor-text font-medium", {
3084
- "text-copy-lighter": n === "dark",
3085
- "text-copy-error-dark": n === "light",
3086
- "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": n === "system",
3087
- "text-copy-lighter dark:text-copy-error-dark": n === "alt-system"
3088
- });
3089
- }, no = ({
3090
- error: e,
3091
- raw: t,
3092
- mode: r,
3093
- disabled: n
3094
- }) => {
3095
- if (t)
3096
- return "";
3097
- if (n)
3098
- return f(
3099
- je,
3100
- "absolute px-2 cursor-not-allowed opacity-50 font-medium"
3101
- );
3102
- if (!e)
3103
- return f(je, "absolute px-2 font-medium", {
3104
- "text-copy-lighter": r === "dark",
3105
- "text-copy-dark": r === "light",
3106
- "text-copy-dark dark:text-copy-lighter": r === "system",
3107
- "text-copy-lighter dark:text-copy-dark": r === "alt-system"
3108
- });
3109
- if (e)
3110
- return f(je, "absolute px-2 font-medium", {
3111
- "text-copy-error-light bg-surface-darker": r === "dark",
3112
- "text-copy-error-dark": r === "light",
3113
- "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": r === "system",
3114
- "dark:text-copy-error-dark text-copy-error-light bg-surface-darker": r === "alt-system"
3115
- });
3116
- }, ao = ({
3117
- className: e,
3118
- inputClassName: t,
3119
- raw: r,
3120
- disabled: n,
3121
- noBorder: a,
3122
- error: o,
3123
- spacing: s,
3124
- mode: i,
3125
- focusMode: d
3126
- }) => {
3127
- const g = r ? e : f(
3128
- "relative flex w-full flex-col justify-center",
3129
- za,
3130
- e,
3131
- ja(s)
3132
- ), p = r ? f(t) : f(
3133
- mr,
3134
- t,
3135
- "h-12 rounded-md px-4 text-base",
3136
- Za({ mode: i }),
3137
- eo({ focusMode: d }),
3138
- to({ noBorder: a, error: o }),
3139
- {
3140
- "disabled:cursor-not-allowed disabled:opacity-50": n
3141
- }
3142
- ), h = r ? void 0 : "sr-only", u = ro({
3143
- disabled: n,
3144
- raw: r,
3145
- error: o,
3146
- mode: i
3147
- }), c = no({
3148
- error: o,
3149
- raw: r,
3150
- mode: i,
3151
- disabled: n
3152
- });
3153
- return {
3154
- wrapper: g,
3155
- input: p,
3156
- accessibleLabel: h,
3157
- visibleLabel: u,
3158
- helperText: c,
3159
- rightElement: r ? void 0 : "absolute right-3"
3160
- };
3161
- }, rt = W.forwardRef(
3162
- ({
3163
- id: e,
3164
- name: t,
3165
- label: r,
3166
- error: n = !1,
3167
- raw: a = !1,
3168
- className: o,
3169
- inputClassName: s,
3170
- mode: i = "system",
3171
- focusMode: d = "system",
3172
- disabled: g = !1,
3173
- noBorder: p = !1,
3174
- labelId: h,
3175
- labelHidden: u = !1,
3176
- type: c = "text",
3177
- helperText: m = "",
3178
- rightElement: b,
3179
- spacing: w,
3180
- ...T
3181
- }, D) => {
3182
- const [F, O] = Xa(), [Z, J] = j(0), C = Wa({ id: e, prefix: `${mr}-` }), P = `${t} error, ${m}`, _ = ao({
3183
- className: o,
3184
- inputClassName: s,
3185
- error: n,
3186
- raw: a,
3187
- focusMode: d,
3188
- disabled: g,
3189
- noBorder: p,
3190
- spacing: w,
3191
- mode: i
3192
- });
3193
- return Er(() => {
3194
- O && O.width && J(O.width + 18 + 10);
3195
- }, [O]), /* @__PURE__ */ S("div", { className: _.wrapper, children: [
3196
- /* @__PURE__ */ l(
3197
- "label",
3198
- {
3199
- htmlFor: C,
3200
- id: h,
3201
- className: _.accessibleLabel,
3202
- children: r
3203
- }
3204
- ),
3205
- /* @__PURE__ */ l(
3206
- "input",
3207
- {
3208
- ref: D,
3209
- id: C,
3210
- name: t,
3211
- type: c,
3212
- disabled: g,
3213
- placeholder: a ? void 0 : " ",
3214
- className: _.input,
3215
- ...m && { "aria-describedby": `${C}-helper` },
3216
- ...n && { "aria-invalid": "true" },
3217
- ...b && !a && { style: { paddingRight: Z } },
3218
- ...T
3219
- }
3220
- ),
3221
- !a && !u && /* @__PURE__ */ l(
3222
- "label",
3223
- {
3224
- "aria-hidden": !0,
3225
- htmlFor: C,
3226
- className: _.visibleLabel,
3227
- children: r
3228
- }
3229
- ),
3230
- m && /* @__PURE__ */ l(
3231
- "div",
3232
- {
3233
- id: `${C}-helper`,
3234
- className: _.helperText,
3235
- children: m
3236
- }
3237
- ),
3238
- b && /* @__PURE__ */ l(
3239
- "div",
3240
- {
3241
- ref: F,
3242
- className: _.rightElement,
3243
- children: b
3244
- }
3245
- ),
3246
- n && m && /* @__PURE__ */ l(ur, { politeness: "polite", clearAnnouncementDelay: 500, children: P })
3247
- ] });
3248
- }
3249
- );
3250
- rt.displayName = "TextInput";
3251
- const oo = 500, so = 5e3, io = 2e4, hr = W.forwardRef(
3252
- ({
3253
- name: e,
3254
- disabled: t,
3255
- label: r,
3256
- labelHidden: n,
3257
- onMaskChange: a,
3258
- onChange: o,
3259
- onBlur: s,
3260
- onFocus: i,
3261
- onTextInputMaskBlur: d,
3262
- rightElement: g,
3263
- spacing: p,
3264
- ...h
3265
- }, u) => {
3266
- const [c, m] = j(!0), [b, w] = j({
3267
- message: null,
3268
- politeness: null
3269
- }), T = L(!0), D = L(), F = L(null), O = Ba([u, F]), Z = c ? "Show" : "Hide", J = () => {
3270
- clearTimeout(D.current), T.current || (D.current = window.setTimeout(() => {
3271
- T.current = !0, m(!0), w({
3272
- announcementTimeout: so,
3273
- politeness: "polite",
3274
- message: `${r} hiding characters`
3275
- }), a && a(!0);
3276
- }, io));
3277
- }, C = (x) => {
3278
- x.preventDefault();
3279
- const H = !T.current;
3280
- T.current = H, J(), m(H), w({
3281
- announcementTimeout: oo,
3282
- politeness: "assertive",
3283
- message: H ? "Characters hidden" : "Characters showing"
3284
- }), a && a(H);
3285
- }, P = (x) => {
3286
- var H;
3287
- const { relatedTarget: He } = x, pe = (H = F.current) == null ? void 0 : H.parentElement;
3288
- pe != null && pe.contains(He) || d && d();
3289
- }, _ = (x) => {
3290
- J(), s && s(x), P(x);
3291
- }, Le = (x) => {
3292
- J(), i && i(x);
3293
- }, Ue = (x) => {
3294
- J(), o && o(x);
3295
- };
3296
- return V(() => () => {
3297
- clearTimeout(D.current);
3298
- }, []), /* @__PURE__ */ S(me, { children: [
3299
- /* @__PURE__ */ l(
3300
- rt,
3301
- {
3302
- ref: O,
3303
- name: e,
3304
- label: r,
3305
- labelHidden: n,
3306
- type: c ? "password" : "text",
3307
- disabled: t,
3308
- spacing: p,
3309
- onBlur: _,
3310
- onFocus: Le,
3311
- onChange: Ue,
3312
- rightElement: W.cloneElement(g, {
3313
- ref: u,
3314
- label: Z,
3315
- onClick: C,
3316
- onBlur: P,
3317
- disabled: t
3318
- }),
3319
- ...h
3320
- }
3321
- ),
3322
- /* @__PURE__ */ l(
3323
- ur,
3324
- {
3325
- role: "status",
3326
- politeness: b.politeness,
3327
- clearAnnouncementDelay: b.announcementTimeout,
3328
- children: b.message
3329
- }
3330
- )
3331
- ] });
3332
- }
3333
- );
3334
- hr.displayName = "TextInputMask";
3335
- /*!
3336
- @versini/ui-form v1.3.7
3337
- © 2024 gizmette.com
3338
- */
3339
- try {
3340
- window.__VERSINI_UI_FORM__ || (window.__VERSINI_UI_FORM__ = {
3341
- version: "1.3.7",
3342
- buildTime: "08/07/2024 12:37 PM EDT",
3343
- homepage: "https://github.com/aversini/ui-components",
3344
- license: "MIT"
3345
- });
3346
- } catch {
3347
- }
3348
- const co = (e) => {
3349
- let t = "";
3350
- if (typeof e == "number" || typeof e == "string")
3351
- t = "m-" + e;
3352
- else {
3353
- const r = [];
3354
- (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(" ");
3355
- }
3356
- return t;
3357
- }, Me = ({
3358
- children: e,
3359
- fill: t,
3360
- viewBox: r,
3361
- className: n,
3362
- defaultViewBox: a,
3363
- defaultClassName: o,
3364
- spacing: s,
3365
- title: i,
3366
- semantic: d = !1,
3367
- ...g
3368
- }) => {
3369
- const p = co(s), h = f(
3370
- p,
3371
- n || o
3372
- );
3373
- return /* @__PURE__ */ S(me, { children: [
3374
- /* @__PURE__ */ l(
3375
- "svg",
3376
- {
3377
- xmlns: "http://www.w3.org/2000/svg",
3378
- className: h,
3379
- viewBox: r || a,
3380
- fill: t || "currentColor",
3381
- role: "img",
3382
- "aria-hidden": !d,
3383
- focusable: !1,
3384
- ...g,
3385
- children: e
3386
- }
3387
- ),
3388
- i && d && /* @__PURE__ */ l("span", { className: "sr-only", children: i })
3389
- ] });
3390
- };
3391
- /*!
3392
- @versini/ui-private v1.4.6
3393
- © 2024 gizmette.com
3394
- */
3395
- try {
3396
- window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
3397
- version: "1.4.6",
3398
- buildTime: "07/14/2024 07:45 PM EDT",
3399
- homepage: "https://github.com/aversini/ui-components",
3400
- license: "MIT"
3401
- });
3402
- } catch {
3403
- }
3404
- const lo = ({
3405
- className: e,
3406
- viewBox: t,
3407
- spacing: r,
3408
- ...n
3409
- }) => /* @__PURE__ */ l(
3410
- Me,
3411
- {
3412
- defaultViewBox: "0 0 1200 500",
3413
- defaultClassName: "w-full",
3414
- viewBox: t,
3415
- className: e,
3416
- spacing: r,
3417
- title: "Sassy Dog",
3418
- ...n,
3419
- children: /* @__PURE__ */ l("g", { transform: "matrix(11.9092 0 0 11.9092 470.0017 250.0009)", id: "879221", children: /* @__PURE__ */ l(
3420
- "path",
3421
- {
3422
- vectorEffect: "non-scaling-stroke",
3423
- transform: " translate(-50.7473, -45.4051)",
3424
- 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",
3425
- strokeLinecap: "round"
3426
- }
3427
- ) })
3428
- }
3429
- ), uo = ({
3430
- className: e,
3431
- viewBox: t,
3432
- spacing: r,
3433
- title: n,
3434
- monotone: a,
3435
- ...o
3436
- }) => /* @__PURE__ */ S(
3437
- Me,
3438
- {
3439
- defaultViewBox: "0 0 640 512",
3440
- defaultClassName: "size-5",
3441
- viewBox: t,
3442
- className: e,
3443
- spacing: r,
3444
- title: n || "Hide",
3445
- ...o,
3446
- children: [
3447
- /* @__PURE__ */ l(
3448
- "path",
3449
- {
3450
- opacity: a ? "1" : "0.4",
3451
- 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"
3452
- }
3453
- ),
3454
- /* @__PURE__ */ l("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" })
3455
- ]
3456
- }
3457
- ), mo = ({
3458
- className: e,
3459
- viewBox: t,
3460
- spacing: r,
3461
- title: n,
3462
- monotone: a,
3463
- ...o
3464
- }) => /* @__PURE__ */ S(
3465
- Me,
3466
- {
3467
- defaultViewBox: "0 0 512 512",
3468
- defaultClassName: "size-5",
3469
- viewBox: t,
3470
- className: e,
3471
- spacing: r,
3472
- title: n || "Key",
3473
- ...o,
3474
- children: [
3475
- /* @__PURE__ */ l(
3476
- "path",
3477
- {
3478
- className: "fa-secondary",
3479
- opacity: a ? "1" : "0.4",
3480
- d: "M168.3 229.7L282.3 343.7l0 0s0 0 0 0L249 377c-4.5 4.5-10.6 7-17 7H192v40c0 13.3-10.7 24-24 24H128v40c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V408c0-6.4 2.5-12.5 7-17L168.3 229.7s0 0 0 0l0 0z"
3481
- }
3482
- ),
3483
- /* @__PURE__ */ l(
3484
- "path",
3485
- {
3486
- className: "fa-primary",
3487
- d: "M168.3 229.7L282.3 343.7l0 0c16.9 5.4 35 8.3 53.7 8.3c97.2 0 176-78.8 176-176S433.2 0 336 0S160 78.8 160 176c0 18.7 2.9 36.8 8.3 53.7l0 0zM336 136a40 40 0 1 1 80 0 40 40 0 1 1 -80 0z"
3488
- }
3489
- )
3490
- ]
3491
- }
3492
- ), ho = ({
3493
- className: e,
3494
- viewBox: t,
3495
- spacing: r,
3496
- title: n,
3497
- monotone: a,
3498
- ...o
3499
- }) => /* @__PURE__ */ S(
3500
- Me,
3501
- {
3502
- defaultViewBox: "0 0 576 512",
3503
- defaultClassName: "size-5",
3504
- viewBox: t,
3505
- className: e,
3506
- spacing: r,
3507
- title: n || "Show",
3508
- ...o,
3509
- children: [
3510
- /* @__PURE__ */ l(
3511
- "path",
3512
- {
3513
- opacity: a ? "1" : "0.4",
3514
- 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"
3515
- }
3516
- ),
3517
- /* @__PURE__ */ l("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" })
3518
- ]
3519
- }
3520
- );
3521
- /*!
3522
- @versini/ui-icons v1.11.0
3523
- © 2024 gizmette.com
3524
- */
3525
- try {
3526
- window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
3527
- version: "1.11.0",
3528
- buildTime: "07/14/2024 07:45 PM EDT",
3529
- homepage: "https://github.com/aversini/ui-components",
3530
- license: "MIT"
3531
- });
3532
- } catch {
3533
- }
3534
- const po = (e) => {
3535
- let t = "";
3536
- if (typeof e == "number" || typeof e == "string")
3537
- t = "m-" + e;
3538
- else {
3539
- const r = [];
3540
- (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(" ");
3541
- }
3542
- return t;
3543
- }, go = "av-flexgrid", Se = "av-flexgrid-item", Ce = 0.25, pr = W.createContext({
3544
- columnGap: 0,
3545
- rowGap: 0
3546
- }), Tt = ({
3547
- children: e,
3548
- className: t,
3549
- columnGap: r = 1,
3550
- rowGap: n = 0,
3551
- height: a = "auto",
3552
- width: o = "auto",
3553
- direction: s = "row",
3554
- alignHorizontal: i = "normal",
3555
- alignVertical: d = "normal",
3556
- spacing: g,
3557
- ...p
3558
- }) => {
3559
- const h = {
3560
- flexDirection: s,
3561
- justifyContent: i,
3562
- alignItems: d,
3563
- height: a,
3564
- width: o,
3565
- /**
3566
- * Trick to account for the extra space taken
3567
- * by the columnGap and rowGap that will be applied
3568
- * to all FlexgridItems (see context and paddings).
3569
- */
3570
- marginLeft: r * -1 * Ce + "rem",
3571
- marginTop: n * -1 * Ce + "rem"
3572
- }, u = f(
3573
- go,
3574
- t,
3575
- "box-border flex flex-wrap"
3576
- ), c = { columnGap: r, rowGap: n }, m = g ? "div" : W.Fragment;
3577
- return /* @__PURE__ */ l(m, { ...g ? { className: po(g) } : {}, children: /* @__PURE__ */ l("div", { className: u, style: h, ...p, children: /* @__PURE__ */ l(pr.Provider, { value: c, children: e }) }) });
3578
- }, ze = (e, t) => f({
3579
- "basis-1/12": e === 1 && !t,
3580
- "sm:basis-1/12": e === 1 && t === "sm",
3581
- "md:basis-1/12": e === 1 && t === "md",
3582
- "lg:basis-1/12": e === 1 && t === "lg",
3583
- "xl:basis-1/12": e === 1 && t === "xl",
3584
- "2xl:basis-1/12": e === 1 && t === "2xl",
3585
- "basis-2/12": e === 2 && !t,
3586
- "sm:basis-2/12": e === 2 && t === "sm",
3587
- "md:basis-2/12": e === 2 && t === "md",
3588
- "lg:basis-2/12": e === 2 && t === "lg",
3589
- "xl:basis-2/12": e === 2 && t === "xl",
3590
- "2xl:basis-2/12": e === 2 && t === "2xl",
3591
- "basis-3/12": e === 3 && !t,
3592
- "sm:basis-3/12": e === 3 && t === "sm",
3593
- "md:basis-3/12": e === 3 && t === "md",
3594
- "lg:basis-3/12": e === 3 && t === "lg",
3595
- "xl:basis-3/12": e === 3 && t === "xl",
3596
- "2xl:basis-3/12": e === 3 && t === "2xl",
3597
- "basis-4/12": e === 4 && !t,
3598
- "sm:basis-4/12": e === 4 && t === "sm",
3599
- "md:basis-4/12": e === 4 && t === "md",
3600
- "lg:basis-4/12": e === 4 && t === "lg",
3601
- "xl:basis-4/12": e === 4 && t === "xl",
3602
- "2xl:basis-4/12": e === 4 && t === "2xl",
3603
- "basis-5/12": e === 5 && !t,
3604
- "sm:basis-5/12": e === 5 && t === "sm",
3605
- "md:basis-5/12": e === 5 && t === "md",
3606
- "lg:basis-5/12": e === 5 && t === "lg",
3607
- "xl:basis-5/12": e === 5 && t === "xl",
3608
- "2xl:basis-5/12": e === 5 && t === "2xl",
3609
- "basis-6/12": e === 6 && !t,
3610
- "sm:basis-6/12": e === 6 && t === "sm",
3611
- "md:basis-6/12": e === 6 && t === "md",
3612
- "lg:basis-6/12": e === 6 && t === "lg",
3613
- "xl:basis-6/12": e === 6 && t === "xl",
3614
- "2xl:basis-6/12": e === 6 && t === "2xl",
3615
- "basis-7/12": e === 7 && !t,
3616
- "sm:basis-7/12": e === 7 && t === "sm",
3617
- "md:basis-7/12": e === 7 && t === "md",
3618
- "lg:basis-7/12": e === 7 && t === "lg",
3619
- "xl:basis-7/12": e === 7 && t === "xl",
3620
- "2xl:basis-7/12": e === 7 && t === "2xl",
3621
- "basis-8/12": e === 8 && !t,
3622
- "sm:basis-8/12": e === 8 && t === "sm",
3623
- "md:basis-8/12": e === 8 && t === "md",
3624
- "lg:basis-8/12": e === 8 && t === "lg",
3625
- "xl:basis-8/12": e === 8 && t === "xl",
3626
- "2xl:basis-8/12": e === 8 && t === "2xl",
3627
- "basis-9/12": e === 9 && !t,
3628
- "sm:basis-9/12": e === 9 && t === "sm",
3629
- "md:basis-9/12": e === 9 && t === "md",
3630
- "lg:basis-9/12": e === 9 && t === "lg",
3631
- "xl:basis-9/12": e === 9 && t === "xl",
3632
- "2xl:basis-9/12": e === 9 && t === "2xl",
3633
- "basis-10/12": e === 10 && !t,
3634
- "sm:basis-10/12": e === 10 && t === "sm",
3635
- "md:basis-10/12": e === 10 && t === "md",
3636
- "lg:basis-10/12": e === 10 && t === "lg",
3637
- "xl:basis-10/12": e === 10 && t === "xl",
3638
- "2xl:basis-10/12": e === 10 && t === "2xl",
3639
- "basis-11/12": e === 11 && !t,
3640
- "sm:basis-11/12": e === 11 && t === "sm",
3641
- "md:basis-11/12": e === 11 && t === "md",
3642
- "lg:basis-11/12": e === 11 && t === "lg",
3643
- "xl:basis-11/12": e === 11 && t === "xl",
3644
- "2xl:basis-11/12": e === 11 && t === "2xl",
3645
- "basis-full": e === 12 && !t,
3646
- "sm:basis-full": e === 12 && t === "sm",
3647
- "md:basis-full": e === 12 && t === "md",
3648
- "lg:basis-full": e === 12 && t === "lg",
3649
- "xl:basis-full": e === 12 && t === "xl",
3650
- "2xl:basis-full": e === 12 && t === "2xl"
3651
- }), fo = ({
3652
- className: e,
3653
- span: t
3654
- }) => {
3655
- if (!t)
3656
- return f(e, Se, "box-border basis-auto");
3657
- if (typeof t == "number")
3658
- return f(e, Se, "box-border max-w-full", {
3659
- [`${ze(t)}`]: !0
3660
- });
3661
- if (typeof t == "string")
3662
- return f(e, Se, "box-border basis-auto", {
3663
- "max-w-full grow": t === "auto"
3664
- });
3665
- if (typeof t == "object") {
3666
- const r = Object.entries(t).map(([n, a]) => n === "fallback" ? ze(a) : ze(a, n));
3667
- return f(
3668
- e,
3669
- Se,
3670
- "box-border",
3671
- r
3672
- );
3673
- }
3674
- }, oe = ({
3675
- children: e,
3676
- className: t,
3677
- span: r,
3678
- ...n
3679
- }) => {
3680
- const { columnGap: a, rowGap: o } = St(pr), s = {
3681
- paddingLeft: a * Ce + "rem",
3682
- paddingTop: o * Ce + "rem"
3683
- }, i = fo({
3684
- className: t,
3685
- span: r
3686
- });
3687
- return /* @__PURE__ */ l("div", { className: i, style: s, ...n, children: e });
3688
- };
3689
- /*!
3690
- @versini/ui-system v1.4.3
3691
- © 2024 gizmette.com
3692
- */
3693
- try {
3694
- window.__VERSINI_UI_SYSTEM__ || (window.__VERSINI_UI_SYSTEM__ = {
3695
- version: "1.4.3",
3696
- buildTime: "08/07/2024 09:49 AM EDT",
3697
- homepage: "https://github.com/aversini/ui-components",
3698
- license: "MIT"
3699
- });
3700
- } catch {
3701
- }
3702
- const yo = "ASK! ME! ANYTHING!", gr = "Sassy Saint", bo = "gizmette.com", wo = "Log in", Eo = "Sign in with a Passkey", Rs = "Log out", To = "Password", vo = "Powered by OpenAI", Ns = "Send", Cs = "Profile", xs = "Statistics", Os = "Chat history", Ps = "About", Ds = "Type your question here", $s = "Clear chat", Ms = "Cancel chat", Ls = "N/A", Us = {
3703
- PREFERENCES: {
3704
- TITLE: "User preferences",
3705
- NAME: "Name",
3706
- EMAIL: "Email",
3707
- ENGINE_DETAILS: "Show message statistics",
3708
- LOCATION: "Current location",
3709
- MODEL_TYPE: "Use GPT model 4"
3710
- },
3711
- CURRENT_STATISTICS: {
3712
- TITLE: "Current chat statistics",
3713
- MODEL_NAME: "GPT model",
3714
- TOKENS_USED: "Tokens used",
3715
- REMAINING_TOKENS: "Remaining tokens",
3716
- PROCESSING_TIME: "Average response time"
3717
- },
3718
- MAIN_STATISTICS: {
3719
- TITLE: "Lifetime statistics",
3720
- TOTAL: "Total chat session",
3721
- PROCESSING_TIME: "Average response time"
3722
- },
3723
- HISTORY: {
3724
- TITLE: "Chat history"
3725
- },
3726
- ABOUT: {
3727
- TITLE_CLIENT: "Client details",
3728
- TITLE_SERVER: "Server details",
3729
- VERSION: "Version",
3730
- BUILD_TIMESTAMP: "Build date",
3731
- ENGINE: "OpenAI model",
3732
- PLUGIN: "Plugin"
3733
- }
3734
- }, So = ({
3735
- serverStats: e
3736
- }) => /* @__PURE__ */ l(
3737
- Ka,
3738
- {
3739
- mode: "light",
3740
- row1: /* @__PURE__ */ S("div", { children: [
3741
- gr,
3742
- " v",
3743
- "3.4.6",
3744
- " - ",
3745
- vo,
3746
- et && e && e.models.length > 0 && e.models[0] === "development" ? " - Development Mode" : ""
3747
- ] }),
3748
- row2: /* @__PURE__ */ S("div", { children: [
3749
- "© ",
3750
- (/* @__PURE__ */ new Date()).getFullYear(),
3751
- " ",
3752
- bo
3753
- ] })
3754
- }
3755
- ), Io = kt(() => import("./LazyHeader.Cn4krbeU.js")), Ao = () => {
3756
- const { isAuthenticated: e } = Ze();
3757
- return /* @__PURE__ */ S(me, { children: [
3758
- e && /* @__PURE__ */ l(_t, { fallback: /* @__PURE__ */ l("div", {}), children: /* @__PURE__ */ l(Io, {}) }),
3759
- /* @__PURE__ */ S("div", { className: "flex items-center justify-center", children: [
3760
- /* @__PURE__ */ l("div", { className: "basis-1/4", children: /* @__PURE__ */ l(lo, {}) }),
3761
- /* @__PURE__ */ S("div", { className: "prose prose-sm prose-light md:prose-base prose-h1:mb-0 prose-h2:mt-0", children: [
3762
- /* @__PURE__ */ l("h1", { children: gr }),
3763
- /* @__PURE__ */ l("h2", { children: yo })
3764
- ] })
3765
- ] })
3766
- ] });
3767
- }, ko = () => {
3768
- const { login: e, logoutReason: t, loginWithPasskey: r } = Ze(), [n, a] = j(""), [o, s] = j(""), [i, d] = j(!0), [g, p] = j({
3769
- username: "",
3770
- password: ""
3771
- }), h = async (u) => {
3772
- u.preventDefault(), await e(
3773
- g.username,
3774
- g.password,
3775
- Q.CODE
3776
- ) || (s(""), a("Invalid username or password"));
3777
- };
3778
- return V(() => {
3779
- var u;
3780
- (u = document.getElementById("logo")) == null || u.classList.add("fadeOut"), setTimeout(() => {
3781
- var c;
3782
- (c = document.getElementById("root")) == null || c.classList.replace("app-hidden", "fadeIn");
3783
- }, 500);
3784
- }), V(() => {
3785
- t && s(t);
3786
- }, [t]), /* @__PURE__ */ S(me, { children: [
3787
- /* @__PURE__ */ S(Ga, { children: [
3788
- /* @__PURE__ */ l("div", { className: Aa(), children: /* @__PURE__ */ l(Ao, {}) }),
3789
- /* @__PURE__ */ S("form", { className: "mt-5", onSubmit: h, children: [
3790
- /* @__PURE__ */ l(Tt, { alignHorizontal: "center", rowGap: 7, children: /* @__PURE__ */ l(oe, { span: 6, children: /* @__PURE__ */ S(Ha, { mode: "dark", children: [
3791
- /* @__PURE__ */ l(oe, { span: 12, children: o && /* @__PURE__ */ l("div", { className: "p-2 text-sm text-center text-copy-error-light bg-surface-darker", children: o }) }),
3792
- /* @__PURE__ */ l(oe, { span: 12, children: /* @__PURE__ */ l(
3793
- rt,
3794
- {
3795
- required: !0,
3796
- autoCapitalize: "off",
3797
- autoComplete: "off",
3798
- autoCorrect: "off",
3799
- mode: "dark",
3800
- focusMode: "light",
3801
- name: "username",
3802
- label: "Username",
3803
- onChange: (u) => {
3804
- p({
3805
- ...g,
3806
- username: u.target.value
3807
- }), a("");
3808
- },
3809
- error: n !== ""
3810
- }
3811
- ) }),
3812
- /* @__PURE__ */ l(oe, { span: 12, children: /* @__PURE__ */ l(
3813
- hr,
3814
- {
3815
- required: !0,
3816
- autoCapitalize: "off",
3817
- autoComplete: "off",
3818
- autoCorrect: "off",
3819
- mode: "dark",
3820
- focusMode: "light",
3821
- name: "password",
3822
- label: To,
3823
- rightElement: /* @__PURE__ */ l(qe, { focusMode: "light", mode: "dark", children: i ? /* @__PURE__ */ l(ho, {}) : /* @__PURE__ */ l(uo, {}) }),
3824
- onMaskChange: d,
3825
- onChange: (u) => {
3826
- p({
3827
- ...g,
3828
- password: u.target.value
3829
- }), a("");
3830
- },
3831
- error: n !== "",
3832
- helperText: n
3833
- }
3834
- ) }),
3835
- /* @__PURE__ */ l(oe, { span: 12, children: /* @__PURE__ */ l(
3836
- cr,
3837
- {
3838
- mode: "light",
3839
- focusMode: "light",
3840
- fullWidth: !0,
3841
- noBorder: !0,
3842
- type: "submit",
3843
- className: "mb-4 mt-6",
3844
- children: wo
3845
- }
3846
- ) })
3847
- ] }) }) }),
3848
- /* @__PURE__ */ l("div", { className: "text-center text-copy-light", children: "or" }),
3849
- /* @__PURE__ */ l(Tt, { alignHorizontal: "center", children: /* @__PURE__ */ l(oe, { span: 6, children: /* @__PURE__ */ l(
3850
- qe,
3851
- {
3852
- mode: "dark",
3853
- focusMode: "light",
3854
- fullWidth: !0,
3855
- noBorder: !0,
3856
- className: "mb-4 mt-1",
3857
- labelRight: Eo,
3858
- onClick: r,
3859
- children: /* @__PURE__ */ l(mo, { className: "size-4" })
3860
- }
3861
- ) }) })
3862
- ] })
3863
- ] }),
3864
- /* @__PURE__ */ l(So, {})
3865
- ] });
3866
- }, _o = new URL(document.location.href).searchParams, Ro = !!_o.get("debug") || !1, No = kt(() => import("./App.nuKvm0UW.js").then((e) => e.App)), Co = ({ isComponent: e }) => {
3867
- const { isAuthenticated: t } = Ze();
3868
- return t ? /* @__PURE__ */ l(_t, { fallback: /* @__PURE__ */ l("div", {}), children: /* @__PURE__ */ l(No, { isComponent: e }) }) : /* @__PURE__ */ l(ko, {});
3869
- }, xo = ({
3870
- isComponent: e = !1,
3871
- domain: t = Ia
3872
- }) => /* @__PURE__ */ l(me, { children: /* @__PURE__ */ l(ha, { clientId: pa, domain: t, debug: Ro, children: /* @__PURE__ */ l(Co, { isComponent: e }) }) }), Oo = ({ domain: e }) => /* @__PURE__ */ l(xo, { isComponent: !0, domain: e });
3873
- Oo.displayName = "SassySaint-3.4.6";
3874
- export {
3875
- ir as A,
3876
- Ps as ABOUT_TITLE,
3877
- Zo as ACTION_LOCATION,
3878
- zo as ACTION_MESSAGE,
3879
- Qo as ACTION_MODEL,
3880
- qo as ACTION_RESET,
3881
- Xo as ACTION_RESTORE,
3882
- ts as ACTION_SEARCH,
3883
- rs as ACTION_SORT,
3884
- es as ACTION_STREAMING,
3885
- So as AppFooter,
3886
- Ms as CANCEL,
3887
- Us as CARDS,
3888
- $s as CLEAR,
3889
- Jo as ERROR_MESSAGE,
3890
- Q as G,
3891
- jo as GPT4_MAX_TOKENS,
3892
- Os as HISTORY_TITLE,
3893
- as as LOCAL_STORAGE_CHAT_DETAILS,
3894
- is as LOCAL_STORAGE_LOCATION,
3895
- ns as LOCAL_STORAGE_PREFIX,
3896
- os as LOCAL_STORAGE_SEARCH,
3897
- ss as LOCAL_STORAGE_SORT,
3898
- Rs as LOG_OUT,
3899
- Wa as M,
3900
- Yo as MODEL_GPT4,
3901
- Ao as MessagesContainerHeader,
3902
- Es as N,
3903
- Ha as N$1,
3904
- Ls as NA,
3905
- qe as O,
3906
- Cs as PROFILE_TITLE,
3907
- Bo as ROLE_ASSISTANT,
3908
- Fo as ROLE_HIDDEN,
3909
- Vo as ROLE_INTERNAL,
3910
- Wo as ROLE_SYSTEM,
3911
- Go as ROLE_USER,
3912
- $e as S,
3913
- Ns as SEND,
3914
- xs as STATS,
3915
- cs as STATS_SEPARATOR,
3916
- Oo as SassySaint,
3917
- Ds as TYPE_QUESTION,
3918
- ur as U,
3919
- Ze as Wr,
3920
- rt as Y,
3921
- As as a,
3922
- Tt as b,
3923
- Ga as c,
3924
- vs as c$1,
3925
- ds as convertLatitudeToDMS,
3926
- us as convertLongitudeToDMS,
3927
- ys as durationFormatter,
3928
- ps as extractAverage,
3929
- or as f,
3930
- Ba as f$1,
3931
- mo as f$2,
3932
- Me as g,
3933
- ms as getCurrentGeoLocation,
3934
- Aa as getMessageContaintWrapperClass,
3935
- tt as i,
3936
- Ts as i$1,
3937
- gs as isLastMessageFromRole,
3938
- oe as j,
3939
- ks as l,
3940
- Ss as n,
3941
- fs as numberFormatter,
3942
- ja as o,
3943
- _s as p,
3944
- bs as pluralize,
3945
- Is as r,
3946
- hs as renderDataAsList,
3947
- ws as s,
3948
- ls as truncate,
3949
- cr as x
3950
- };