@versini/auth-provider 6.3.2 → 6.3.4

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.
Files changed (2) hide show
  1. package/dist/index.js +608 -608
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  var _t = Object.defineProperty;
2
2
  var vt = (e, t, n) => t in e ? _t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var z = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as Pe } from "react/jsx-runtime";
5
- import Pt, { useSyncExternalStore as kt, useCallback as W, useEffect as Te, createContext as Ct, useReducer as Ot, useRef as ke, useContext as Nt } from "react";
3
+ var Q = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as ve } from "react/jsx-runtime";
5
+ import Ct, { useSyncExternalStore as Pt, useCallback as x, useEffect as Ae, createContext as kt, useReducer as Ot, useRef as Ce, useContext as Nt } from "react";
6
6
  /*!
7
- @versini/auth-provider v6.3.2
7
+ @versini/auth-provider v6.3.4
8
8
  © 2024 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "6.3.2",
13
- buildTime: "07/23/2024 01:37 PM EDT",
12
+ version: "6.3.4",
13
+ buildTime: "07/24/2024 07:31 PM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
@@ -29,8 +29,8 @@ function ie(e) {
29
29
  o[i] = a.charCodeAt(i);
30
30
  return s;
31
31
  }
32
- function Re() {
33
- return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
32
+ function Te() {
33
+ return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
34
34
  }
35
35
  function Ye(e) {
36
36
  const { id: t } = e;
@@ -49,7 +49,6 @@ class b extends Error {
49
49
  }
50
50
  }
51
51
  function Dt({ error: e, options: t }) {
52
- var r, a;
53
52
  const { publicKey: n } = t;
54
53
  if (!n)
55
54
  throw Error("options was missing required publicKey property");
@@ -61,13 +60,13 @@ function Dt({ error: e, options: t }) {
61
60
  cause: e
62
61
  });
63
62
  } else if (e.name === "ConstraintError") {
64
- if (((r = n.authenticatorSelection) == null ? void 0 : r.requireResidentKey) === !0)
63
+ if (n.authenticatorSelection?.requireResidentKey === !0)
65
64
  return new b({
66
65
  message: "Discoverable credentials were required but no available authenticator supported it",
67
66
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
68
67
  cause: e
69
68
  });
70
- if (((a = n.authenticatorSelection) == null ? void 0 : a.userVerification) === "required")
69
+ if (n.authenticatorSelection?.userVerification === "required")
71
70
  return new b({
72
71
  message: "User verification was required but no available authenticator supported it",
73
72
  code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
@@ -87,7 +86,7 @@ function Dt({ error: e, options: t }) {
87
86
  cause: e
88
87
  });
89
88
  if (e.name === "NotSupportedError")
90
- return n.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new b({
89
+ return n.pubKeyCredParams.filter((a) => a.type === "public-key").length === 0 ? new b({
91
90
  message: 'No entry in pubKeyCredParams was of type "public-key"',
92
91
  code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
93
92
  cause: e
@@ -97,9 +96,9 @@ function Dt({ error: e, options: t }) {
97
96
  cause: e
98
97
  });
99
98
  if (e.name === "SecurityError") {
100
- const s = window.location.hostname;
101
- if (Ve(s)) {
102
- if (n.rp.id !== s)
99
+ const r = window.location.hostname;
100
+ if (Ve(r)) {
101
+ if (n.rp.id !== r)
103
102
  return new b({
104
103
  message: `The RP ID "${n.rp.id}" is invalid for this domain`,
105
104
  code: "ERROR_INVALID_RP_ID",
@@ -148,8 +147,7 @@ function Fe(e) {
148
147
  return e;
149
148
  }
150
149
  async function Kt(e) {
151
- var m;
152
- if (!Re())
150
+ if (!Te())
153
151
  throw new Error("WebAuthn is not supported in this browser");
154
152
  const n = { publicKey: {
155
153
  ...e,
@@ -158,41 +156,41 @@ async function Kt(e) {
158
156
  ...e.user,
159
157
  id: ie(e.user.id)
160
158
  },
161
- excludeCredentials: (m = e.excludeCredentials) == null ? void 0 : m.map(Ye)
159
+ excludeCredentials: e.excludeCredentials?.map(Ye)
162
160
  } };
163
161
  n.signal = je.createNewAbortSignal();
164
162
  let r;
165
163
  try {
166
164
  r = await navigator.credentials.create(n);
167
- } catch (u) {
168
- throw Dt({ error: u, options: n });
165
+ } catch (y) {
166
+ throw Dt({ error: y, options: n });
169
167
  }
170
168
  if (!r)
171
169
  throw new Error("Registration was not completed");
172
170
  const { id: a, rawId: s, response: o, type: i } = r;
173
- let l;
174
- typeof o.getTransports == "function" && (l = o.getTransports());
175
- let y;
171
+ let c;
172
+ typeof o.getTransports == "function" && (c = o.getTransports());
173
+ let g;
176
174
  if (typeof o.getPublicKeyAlgorithm == "function")
177
175
  try {
178
- y = o.getPublicKeyAlgorithm();
179
- } catch (u) {
180
- fe("getPublicKeyAlgorithm()", u);
176
+ g = o.getPublicKeyAlgorithm();
177
+ } catch (y) {
178
+ fe("getPublicKeyAlgorithm()", y);
181
179
  }
182
- let h;
180
+ let l;
183
181
  if (typeof o.getPublicKey == "function")
184
182
  try {
185
- const u = o.getPublicKey();
186
- u !== null && (h = v(u));
187
- } catch (u) {
188
- fe("getPublicKey()", u);
183
+ const y = o.getPublicKey();
184
+ y !== null && (l = v(y));
185
+ } catch (y) {
186
+ fe("getPublicKey()", y);
189
187
  }
190
- let p;
188
+ let h;
191
189
  if (typeof o.getAuthenticatorData == "function")
192
190
  try {
193
- p = v(o.getAuthenticatorData());
194
- } catch (u) {
195
- fe("getAuthenticatorData()", u);
191
+ h = v(o.getAuthenticatorData());
192
+ } catch (y) {
193
+ fe("getAuthenticatorData()", y);
196
194
  }
197
195
  return {
198
196
  id: a,
@@ -200,10 +198,10 @@ async function Kt(e) {
200
198
  response: {
201
199
  attestationObject: v(o.attestationObject),
202
200
  clientDataJSON: v(o.clientDataJSON),
203
- transports: l,
204
- publicKeyAlgorithm: y,
205
- publicKey: h,
206
- authenticatorData: p
201
+ transports: c,
202
+ publicKeyAlgorithm: g,
203
+ publicKey: l,
204
+ authenticatorData: h
207
205
  },
208
206
  type: i,
209
207
  clientExtensionResults: r.getClientExtensionResults(),
@@ -215,7 +213,7 @@ function fe(e, t) {
215
213
  `, t);
216
214
  }
217
215
  function Ht() {
218
- if (!Re())
216
+ if (!Te())
219
217
  return new Promise((t) => t(!1));
220
218
  const e = window.PublicKeyCredential;
221
219
  return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
@@ -262,11 +260,10 @@ function Lt({ error: e, options: t }) {
262
260
  return e;
263
261
  }
264
262
  async function Wt(e, t = !1) {
265
- var p, m;
266
- if (!Re())
263
+ if (!Te())
267
264
  throw new Error("WebAuthn is not supported in this browser");
268
265
  let n;
269
- ((p = e.allowCredentials) == null ? void 0 : p.length) !== 0 && (n = (m = e.allowCredentials) == null ? void 0 : m.map(Ye));
266
+ e.allowCredentials?.length !== 0 && (n = e.allowCredentials?.map(Ye));
270
267
  const r = {
271
268
  ...e,
272
269
  challenge: ie(e.challenge),
@@ -283,23 +280,23 @@ async function Wt(e, t = !1) {
283
280
  let s;
284
281
  try {
285
282
  s = await navigator.credentials.get(a);
286
- } catch (u) {
287
- throw Lt({ error: u, options: a });
283
+ } catch (h) {
284
+ throw Lt({ error: h, options: a });
288
285
  }
289
286
  if (!s)
290
287
  throw new Error("Authentication was not completed");
291
- const { id: o, rawId: i, response: l, type: y } = s;
292
- let h;
293
- return l.userHandle && (h = v(l.userHandle)), {
288
+ const { id: o, rawId: i, response: c, type: g } = s;
289
+ let l;
290
+ return c.userHandle && (l = v(c.userHandle)), {
294
291
  id: o,
295
292
  rawId: v(i),
296
293
  response: {
297
- authenticatorData: v(l.authenticatorData),
298
- clientDataJSON: v(l.clientDataJSON),
299
- signature: v(l.signature),
300
- userHandle: h
294
+ authenticatorData: v(c.authenticatorData),
295
+ clientDataJSON: v(c.clientDataJSON),
296
+ signature: v(c.signature),
297
+ userHandle: l
301
298
  },
302
- type: y,
299
+ type: g,
303
300
  clientExtensionResults: s.getClientExtensionResults(),
304
301
  authenticatorAttachment: Fe(s.authenticatorAttachment)
305
302
  };
@@ -311,13 +308,13 @@ async function Wt(e, t = !1) {
311
308
  try {
312
309
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
313
310
  version: "3.3.0",
314
- buildTime: "07/23/2024 01:36 PM EDT",
311
+ buildTime: "07/24/2024 07:31 PM EDT",
315
312
  homepage: "https://github.com/aversini/auth-client",
316
313
  license: "MIT"
317
314
  });
318
315
  } catch {
319
316
  }
320
- const j = {
317
+ const F = {
321
318
  ID_TOKEN: "id_token",
322
319
  ACCESS_TOKEN: "token",
323
320
  ID_AND_ACCESS_TOKEN: "id_token token",
@@ -326,7 +323,7 @@ const j = {
326
323
  PASSKEY: "passkey"
327
324
  }, Be = {
328
325
  CLIENT_ID: "X-Auth-ClientId"
329
- }, T = {
326
+ }, A = {
330
327
  ALG: "RS256",
331
328
  USER_ID_KEY: "sub",
332
329
  TOKEN_ID_KEY: "__raw",
@@ -349,7 +346,7 @@ awIDAQAB
349
346
  AUTHENTICATE: "authenticate",
350
347
  CODE: "code",
351
348
  LOGOUT: "logout"
352
- }, he = crypto, qe = (e) => e instanceof CryptoKey, Q = new TextEncoder(), F = new TextDecoder();
349
+ }, he = crypto, qe = (e) => e instanceof CryptoKey, X = new TextEncoder(), B = new TextDecoder();
353
350
  function Mt(...e) {
354
351
  const t = e.reduce((a, { length: s }) => a + s, 0), n = new Uint8Array(t);
355
352
  let r = 0;
@@ -362,9 +359,9 @@ const Gt = (e) => {
362
359
  for (let r = 0; r < t.length; r++)
363
360
  n[r] = t.charCodeAt(r);
364
361
  return n;
365
- }, V = (e) => {
362
+ }, j = (e) => {
366
363
  let t = e;
367
- t instanceof Uint8Array && (t = F.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
364
+ t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
368
365
  try {
369
366
  return Gt(t);
370
367
  } catch {
@@ -386,7 +383,7 @@ let D = class extends Error {
386
383
  constructor(t, n, r = "unspecified", a = "unspecified") {
387
384
  super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = r, this.reason = a, this.payload = n;
388
385
  }
389
- }, Ce = class extends D {
386
+ }, Pe = class extends D {
390
387
  static get code() {
391
388
  return "ERR_JWT_EXPIRED";
392
389
  }
@@ -410,7 +407,7 @@ let O = class extends D {
410
407
  return "ERR_JOSE_NOT_SUPPORTED";
411
408
  }
412
409
  };
413
- class A extends D {
410
+ class S extends D {
414
411
  constructor() {
415
412
  super(...arguments), this.code = "ERR_JWS_INVALID";
416
413
  }
@@ -418,7 +415,7 @@ class A extends D {
418
415
  return "ERR_JWS_INVALID";
419
416
  }
420
417
  }
421
- let k = class extends D {
418
+ let P = class extends D {
422
419
  constructor() {
423
420
  super(...arguments), this.code = "ERR_JWT_INVALID";
424
421
  }
@@ -434,10 +431,10 @@ class Yt extends D {
434
431
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
435
432
  }
436
433
  }
437
- function P(e, t = "algorithm.name") {
434
+ function C(e, t = "algorithm.name") {
438
435
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
439
436
  }
440
- function X(e, t) {
437
+ function Z(e, t) {
441
438
  return e.name === t;
442
439
  }
443
440
  function ye(e) {
@@ -470,46 +467,46 @@ function Ft(e, t, ...n) {
470
467
  case "HS256":
471
468
  case "HS384":
472
469
  case "HS512": {
473
- if (!X(e.algorithm, "HMAC"))
474
- throw P("HMAC");
470
+ if (!Z(e.algorithm, "HMAC"))
471
+ throw C("HMAC");
475
472
  const r = parseInt(t.slice(2), 10);
476
473
  if (ye(e.algorithm.hash) !== r)
477
- throw P(`SHA-${r}`, "algorithm.hash");
474
+ throw C(`SHA-${r}`, "algorithm.hash");
478
475
  break;
479
476
  }
480
477
  case "RS256":
481
478
  case "RS384":
482
479
  case "RS512": {
483
- if (!X(e.algorithm, "RSASSA-PKCS1-v1_5"))
484
- throw P("RSASSA-PKCS1-v1_5");
480
+ if (!Z(e.algorithm, "RSASSA-PKCS1-v1_5"))
481
+ throw C("RSASSA-PKCS1-v1_5");
485
482
  const r = parseInt(t.slice(2), 10);
486
483
  if (ye(e.algorithm.hash) !== r)
487
- throw P(`SHA-${r}`, "algorithm.hash");
484
+ throw C(`SHA-${r}`, "algorithm.hash");
488
485
  break;
489
486
  }
490
487
  case "PS256":
491
488
  case "PS384":
492
489
  case "PS512": {
493
- if (!X(e.algorithm, "RSA-PSS"))
494
- throw P("RSA-PSS");
490
+ if (!Z(e.algorithm, "RSA-PSS"))
491
+ throw C("RSA-PSS");
495
492
  const r = parseInt(t.slice(2), 10);
496
493
  if (ye(e.algorithm.hash) !== r)
497
- throw P(`SHA-${r}`, "algorithm.hash");
494
+ throw C(`SHA-${r}`, "algorithm.hash");
498
495
  break;
499
496
  }
500
497
  case "EdDSA": {
501
498
  if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
502
- throw P("Ed25519 or Ed448");
499
+ throw C("Ed25519 or Ed448");
503
500
  break;
504
501
  }
505
502
  case "ES256":
506
503
  case "ES384":
507
504
  case "ES512": {
508
- if (!X(e.algorithm, "ECDSA"))
509
- throw P("ECDSA");
505
+ if (!Z(e.algorithm, "ECDSA"))
506
+ throw C("ECDSA");
510
507
  const r = Vt(t);
511
508
  if (e.algorithm.namedCurve !== r)
512
- throw P(r, "algorithm.namedCurve");
509
+ throw C(r, "algorithm.namedCurve");
513
510
  break;
514
511
  }
515
512
  default:
@@ -525,11 +522,11 @@ function ze(e, t, ...n) {
525
522
  } else n.length === 2 ? e += `one of type ${n[0]} or ${n[1]}.` : e += `of type ${n[0]}.`;
526
523
  return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (r = t.constructor) != null && r.name && (e += ` Received an instance of ${t.constructor.name}`), e;
527
524
  }
528
- const Oe = (e, ...t) => ze("Key must be ", e, ...t);
525
+ const ke = (e, ...t) => ze("Key must be ", e, ...t);
529
526
  function Qe(e, t, ...n) {
530
527
  return ze(`Key for the ${e} algorithm must be `, t, ...n);
531
528
  }
532
- const Xe = (e) => qe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", ce = ["CryptoKey"], Bt = (...e) => {
529
+ const Xe = (e) => qe(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", ce = ["CryptoKey"], Bt = (...e) => {
533
530
  const t = e.filter(Boolean);
534
531
  if (t.length === 0 || t.length === 1)
535
532
  return !0;
@@ -649,9 +646,9 @@ const Xt = async (e) => {
649
646
  e.key_ops ?? n
650
647
  ], a = { ...e };
651
648
  return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
652
- }, Ze = (e) => V(e);
649
+ }, Ze = (e) => j(e);
653
650
  let ge, me;
654
- const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", tt = async (e, t, n, r) => {
651
+ const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", tt = async (e, t, n, r) => {
655
652
  let a = e.get(t);
656
653
  if (a != null && a[r])
657
654
  return a[r];
@@ -669,35 +666,35 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
669
666
  return n.k ? Ze(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), tt(ge, e, n, t));
670
667
  }
671
668
  return e;
672
- }, tn = { normalizePublicKey: Zt, normalizePrivateKey: en }, C = (e, t, n = 0) => {
669
+ }, tn = { normalizePublicKey: Zt, normalizePrivateKey: en }, k = (e, t, n = 0) => {
673
670
  n === 0 && (t.unshift(t.length), t.unshift(6));
674
671
  const r = e.indexOf(t[0], n);
675
672
  if (r === -1)
676
673
  return !1;
677
674
  const a = e.subarray(r, r + t.length);
678
- return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || C(e, t, r + 1);
679
- }, Ne = (e) => {
675
+ return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || k(e, t, r + 1);
676
+ }, Oe = (e) => {
680
677
  switch (!0) {
681
- case C(e, [42, 134, 72, 206, 61, 3, 1, 7]):
678
+ case k(e, [42, 134, 72, 206, 61, 3, 1, 7]):
682
679
  return "P-256";
683
- case C(e, [43, 129, 4, 0, 34]):
680
+ case k(e, [43, 129, 4, 0, 34]):
684
681
  return "P-384";
685
- case C(e, [43, 129, 4, 0, 35]):
682
+ case k(e, [43, 129, 4, 0, 35]):
686
683
  return "P-521";
687
- case C(e, [43, 101, 110]):
684
+ case k(e, [43, 101, 110]):
688
685
  return "X25519";
689
- case C(e, [43, 101, 111]):
686
+ case k(e, [43, 101, 111]):
690
687
  return "X448";
691
- case C(e, [43, 101, 112]):
688
+ case k(e, [43, 101, 112]):
692
689
  return "Ed25519";
693
- case C(e, [43, 101, 113]):
690
+ case k(e, [43, 101, 113]):
694
691
  return "Ed448";
695
692
  default:
696
693
  throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
697
694
  }
698
695
  }, nn = async (e, t, n, r, a) => {
699
696
  let s, o;
700
- const i = new Uint8Array(atob(n.replace(e, "")).split("").map((l) => l.charCodeAt(0)));
697
+ const i = new Uint8Array(atob(n.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
701
698
  switch (r) {
702
699
  case "PS256":
703
700
  case "PS384":
@@ -731,12 +728,12 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
731
728
  case "ECDH-ES+A128KW":
732
729
  case "ECDH-ES+A192KW":
733
730
  case "ECDH-ES+A256KW": {
734
- const l = Ne(i);
735
- s = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, o = [];
731
+ const c = Oe(i);
732
+ s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
736
733
  break;
737
734
  }
738
735
  case "EdDSA":
739
- s = { name: Ne(i) }, o = ["verify"];
736
+ s = { name: Oe(i) }, o = ["verify"];
740
737
  break;
741
738
  default:
742
739
  throw new O('Invalid or unsupported "alg" (Algorithm) value');
@@ -748,7 +745,7 @@ async function an(e, t, n) {
748
745
  throw new TypeError('"spki" must be SPKI formatted string');
749
746
  return rn(e, t);
750
747
  }
751
- const se = (e) => e == null ? void 0 : e[Symbol.toStringTag], on = (e, t) => {
748
+ const se = (e) => e?.[Symbol.toStringTag], on = (e, t) => {
752
749
  if (!(t instanceof Uint8Array)) {
753
750
  if (!Xe(t))
754
751
  throw new TypeError(Qe(e, t, ...ce, "Uint8Array"));
@@ -768,7 +765,7 @@ const se = (e) => e == null ? void 0 : e[Symbol.toStringTag], on = (e, t) => {
768
765
  e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? on(e, t) : sn(e, t, n);
769
766
  };
770
767
  function un(e, t, n, r, a) {
771
- if (a.crit !== void 0 && (r == null ? void 0 : r.crit) === void 0)
768
+ if (a.crit !== void 0 && r?.crit === void 0)
772
769
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
773
770
  if (!r || r.crit === void 0)
774
771
  return /* @__PURE__ */ new Set();
@@ -822,10 +819,10 @@ async function hn(e, t, n) {
822
819
  return Ft(t, e, n), t;
823
820
  if (t instanceof Uint8Array) {
824
821
  if (!e.startsWith("HS"))
825
- throw new TypeError(Oe(t, ...ce));
822
+ throw new TypeError(ke(t, ...ce));
826
823
  return he.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
827
824
  }
828
- throw new TypeError(Oe(t, ...ce, "Uint8Array"));
825
+ throw new TypeError(ke(t, ...ce, "Uint8Array"));
829
826
  }
830
827
  const pn = async (e, t, n, r) => {
831
828
  const a = await hn(e, t, "verify");
@@ -839,77 +836,77 @@ const pn = async (e, t, n, r) => {
839
836
  };
840
837
  async function fn(e, t, n) {
841
838
  if (!ue(e))
842
- throw new A("Flattened JWS must be an object");
839
+ throw new S("Flattened JWS must be an object");
843
840
  if (e.protected === void 0 && e.header === void 0)
844
- throw new A('Flattened JWS must have either of the "protected" or "header" members');
841
+ throw new S('Flattened JWS must have either of the "protected" or "header" members');
845
842
  if (e.protected !== void 0 && typeof e.protected != "string")
846
- throw new A("JWS Protected Header incorrect type");
843
+ throw new S("JWS Protected Header incorrect type");
847
844
  if (e.payload === void 0)
848
- throw new A("JWS Payload missing");
845
+ throw new S("JWS Payload missing");
849
846
  if (typeof e.signature != "string")
850
- throw new A("JWS Signature missing or incorrect type");
847
+ throw new S("JWS Signature missing or incorrect type");
851
848
  if (e.header !== void 0 && !ue(e.header))
852
- throw new A("JWS Unprotected Header incorrect type");
849
+ throw new S("JWS Unprotected Header incorrect type");
853
850
  let r = {};
854
851
  if (e.protected)
855
852
  try {
856
- const d = V(e.protected);
857
- r = JSON.parse(F.decode(d));
853
+ const u = j(e.protected);
854
+ r = JSON.parse(B.decode(u));
858
855
  } catch {
859
- throw new A("JWS Protected Header is invalid");
856
+ throw new S("JWS Protected Header is invalid");
860
857
  }
861
858
  if (!Bt(r, e.header))
862
- throw new A("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
859
+ throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
863
860
  const a = {
864
861
  ...r,
865
862
  ...e.header
866
- }, s = un(A, /* @__PURE__ */ new Map([["b64", !0]]), n == null ? void 0 : n.crit, r, a);
863
+ }, s = un(S, /* @__PURE__ */ new Map([["b64", !0]]), n?.crit, r, a);
867
864
  let o = !0;
868
865
  if (s.has("b64") && (o = r.b64, typeof o != "boolean"))
869
- throw new A('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
866
+ throw new S('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
870
867
  const { alg: i } = a;
871
868
  if (typeof i != "string" || !i)
872
- throw new A('JWS "alg" (Algorithm) Header Parameter missing or invalid');
873
- const l = n && ln("algorithms", n.algorithms);
874
- if (l && !l.has(i))
869
+ throw new S('JWS "alg" (Algorithm) Header Parameter missing or invalid');
870
+ const c = n && ln("algorithms", n.algorithms);
871
+ if (c && !c.has(i))
875
872
  throw new Jt('"alg" (Algorithm) Header Parameter value not allowed');
876
873
  if (o) {
877
874
  if (typeof e.payload != "string")
878
- throw new A("JWS Payload must be a string");
875
+ throw new S("JWS Payload must be a string");
879
876
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
880
- throw new A("JWS Payload must be a string or an Uint8Array instance");
881
- let y = !1;
882
- typeof t == "function" && (t = await t(r, e), y = !0), cn(i, t, "verify");
883
- const h = Mt(Q.encode(e.protected ?? ""), Q.encode("."), typeof e.payload == "string" ? Q.encode(e.payload) : e.payload);
884
- let p;
877
+ throw new S("JWS Payload must be a string or an Uint8Array instance");
878
+ let g = !1;
879
+ typeof t == "function" && (t = await t(r, e), g = !0), cn(i, t, "verify");
880
+ const l = Mt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
881
+ let h;
885
882
  try {
886
- p = V(e.signature);
883
+ h = j(e.signature);
887
884
  } catch {
888
- throw new A("Failed to base64url decode the signature");
885
+ throw new S("Failed to base64url decode the signature");
889
886
  }
890
- if (!await pn(i, t, p, h))
887
+ if (!await pn(i, t, h, l))
891
888
  throw new Yt();
892
- let m;
889
+ let y;
893
890
  if (o)
894
891
  try {
895
- m = V(e.payload);
892
+ y = j(e.payload);
896
893
  } catch {
897
- throw new A("Failed to base64url decode the payload");
894
+ throw new S("Failed to base64url decode the payload");
898
895
  }
899
- else typeof e.payload == "string" ? m = Q.encode(e.payload) : m = e.payload;
900
- const u = { payload: m };
901
- return e.protected !== void 0 && (u.protectedHeader = r), e.header !== void 0 && (u.unprotectedHeader = e.header), y ? { ...u, key: t } : u;
896
+ else typeof e.payload == "string" ? y = X.encode(e.payload) : y = e.payload;
897
+ const p = { payload: y };
898
+ return e.protected !== void 0 && (p.protectedHeader = r), e.header !== void 0 && (p.unprotectedHeader = e.header), g ? { ...p, key: t } : p;
902
899
  }
903
900
  async function yn(e, t, n) {
904
- if (e instanceof Uint8Array && (e = F.decode(e)), typeof e != "string")
905
- throw new A("Compact JWS must be a string or Uint8Array");
901
+ if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
902
+ throw new S("Compact JWS must be a string or Uint8Array");
906
903
  const { 0: r, 1: a, 2: s, length: o } = e.split(".");
907
904
  if (o !== 3)
908
- throw new A("Invalid Compact JWS");
909
- const i = await fn({ payload: a, protected: r, signature: s }, t, n), l = { payload: i.payload, protectedHeader: i.protectedHeader };
910
- return typeof t == "function" ? { ...l, key: i.key } : l;
905
+ throw new S("Invalid Compact JWS");
906
+ const i = await fn({ payload: a, protected: r, signature: s }, t, n), c = { payload: i.payload, protectedHeader: i.protectedHeader };
907
+ return typeof t == "function" ? { ...c, key: i.key } : c;
911
908
  }
912
- const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt * 24, mn = be * 7, wn = be * 365.25, En = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, De = (e) => {
909
+ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt * 24, mn = Re * 7, wn = Re * 365.25, En = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Ne = (e) => {
913
910
  const t = En.exec(e);
914
911
  if (!t || t[4] && t[1])
915
912
  throw new TypeError("Invalid time period format");
@@ -940,7 +937,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
940
937
  case "day":
941
938
  case "days":
942
939
  case "d":
943
- a = Math.round(n * be);
940
+ a = Math.round(n * Re);
944
941
  break;
945
942
  case "week":
946
943
  case "weeks":
@@ -952,62 +949,62 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt
952
949
  break;
953
950
  }
954
951
  return t[1] === "-" || t[4] === "ago" ? -a : a;
955
- }, Ue = (e) => e.toLowerCase().replace(/^application\//, ""), Sn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, An = (e, t, n = {}) => {
952
+ }, De = (e) => e.toLowerCase().replace(/^application\//, ""), Sn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, An = (e, t, n = {}) => {
956
953
  let r;
957
954
  try {
958
- r = JSON.parse(F.decode(t));
955
+ r = JSON.parse(B.decode(t));
959
956
  } catch {
960
957
  }
961
958
  if (!ue(r))
962
- throw new k("JWT Claims Set must be a top-level JSON object");
959
+ throw new P("JWT Claims Set must be a top-level JSON object");
963
960
  const { typ: a } = n;
964
- if (a && (typeof e.typ != "string" || Ue(e.typ) !== Ue(a)))
961
+ if (a && (typeof e.typ != "string" || De(e.typ) !== De(a)))
965
962
  throw new _('unexpected "typ" JWT header value', r, "typ", "check_failed");
966
- const { requiredClaims: s = [], issuer: o, subject: i, audience: l, maxTokenAge: y } = n, h = [...s];
967
- y !== void 0 && h.push("iat"), l !== void 0 && h.push("aud"), i !== void 0 && h.push("sub"), o !== void 0 && h.push("iss");
968
- for (const d of new Set(h.reverse()))
969
- if (!(d in r))
970
- throw new _(`missing required "${d}" claim`, r, d, "missing");
963
+ const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: g } = n, l = [...s];
964
+ g !== void 0 && l.push("iat"), c !== void 0 && l.push("aud"), i !== void 0 && l.push("sub"), o !== void 0 && l.push("iss");
965
+ for (const u of new Set(l.reverse()))
966
+ if (!(u in r))
967
+ throw new _(`missing required "${u}" claim`, r, u, "missing");
971
968
  if (o && !(Array.isArray(o) ? o : [o]).includes(r.iss))
972
969
  throw new _('unexpected "iss" claim value', r, "iss", "check_failed");
973
970
  if (i && r.sub !== i)
974
971
  throw new _('unexpected "sub" claim value', r, "sub", "check_failed");
975
- if (l && !Sn(r.aud, typeof l == "string" ? [l] : l))
972
+ if (c && !Sn(r.aud, typeof c == "string" ? [c] : c))
976
973
  throw new _('unexpected "aud" claim value', r, "aud", "check_failed");
977
- let p;
974
+ let h;
978
975
  switch (typeof n.clockTolerance) {
979
976
  case "string":
980
- p = De(n.clockTolerance);
977
+ h = Ne(n.clockTolerance);
981
978
  break;
982
979
  case "number":
983
- p = n.clockTolerance;
980
+ h = n.clockTolerance;
984
981
  break;
985
982
  case "undefined":
986
- p = 0;
983
+ h = 0;
987
984
  break;
988
985
  default:
989
986
  throw new TypeError("Invalid clockTolerance option type");
990
987
  }
991
- const { currentDate: m } = n, u = gn(m || /* @__PURE__ */ new Date());
992
- if ((r.iat !== void 0 || y) && typeof r.iat != "number")
988
+ const { currentDate: y } = n, p = gn(y || /* @__PURE__ */ new Date());
989
+ if ((r.iat !== void 0 || g) && typeof r.iat != "number")
993
990
  throw new _('"iat" claim must be a number', r, "iat", "invalid");
994
991
  if (r.nbf !== void 0) {
995
992
  if (typeof r.nbf != "number")
996
993
  throw new _('"nbf" claim must be a number', r, "nbf", "invalid");
997
- if (r.nbf > u + p)
994
+ if (r.nbf > p + h)
998
995
  throw new _('"nbf" claim timestamp check failed', r, "nbf", "check_failed");
999
996
  }
1000
997
  if (r.exp !== void 0) {
1001
998
  if (typeof r.exp != "number")
1002
999
  throw new _('"exp" claim must be a number', r, "exp", "invalid");
1003
- if (r.exp <= u - p)
1004
- throw new Ce('"exp" claim timestamp check failed', r, "exp", "check_failed");
1005
- }
1006
- if (y) {
1007
- const d = u - r.iat, g = typeof y == "number" ? y : De(y);
1008
- if (d - p > g)
1009
- throw new Ce('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1010
- if (d < 0 - p)
1000
+ if (r.exp <= p - h)
1001
+ throw new Pe('"exp" claim timestamp check failed', r, "exp", "check_failed");
1002
+ }
1003
+ if (g) {
1004
+ const u = p - r.iat, m = typeof g == "number" ? g : Ne(g);
1005
+ if (u - h > m)
1006
+ throw new Pe('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1007
+ if (u < 0 - h)
1011
1008
  throw new _('"iat" claim timestamp check failed (it should be in the past)', r, "iat", "check_failed");
1012
1009
  }
1013
1010
  return r;
@@ -1016,42 +1013,42 @@ async function Tn(e, t, n) {
1016
1013
  var r;
1017
1014
  const a = await yn(e, t, n);
1018
1015
  if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
1019
- throw new k("JWTs MUST NOT use unencoded payload");
1016
+ throw new P("JWTs MUST NOT use unencoded payload");
1020
1017
  const s = { payload: An(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1021
1018
  return typeof t == "function" ? { ...s, key: a.key } : s;
1022
1019
  }
1023
- const Rn = V;
1020
+ const Rn = j;
1024
1021
  function bn(e) {
1025
1022
  if (typeof e != "string")
1026
- throw new k("JWTs must use Compact JWS serialization, JWT must be a string");
1023
+ throw new P("JWTs must use Compact JWS serialization, JWT must be a string");
1027
1024
  const { 1: t, length: n } = e.split(".");
1028
1025
  if (n === 5)
1029
- throw new k("Only JWTs using Compact JWS serialization can be decoded");
1026
+ throw new P("Only JWTs using Compact JWS serialization can be decoded");
1030
1027
  if (n !== 3)
1031
- throw new k("Invalid JWT");
1028
+ throw new P("Invalid JWT");
1032
1029
  if (!t)
1033
- throw new k("JWTs must contain a payload");
1030
+ throw new P("JWTs must contain a payload");
1034
1031
  let r;
1035
1032
  try {
1036
1033
  r = Rn(t);
1037
1034
  } catch {
1038
- throw new k("Failed to base64url decode the payload");
1035
+ throw new P("Failed to base64url decode the payload");
1039
1036
  }
1040
1037
  let a;
1041
1038
  try {
1042
- a = JSON.parse(F.decode(r));
1039
+ a = JSON.parse(B.decode(r));
1043
1040
  } catch {
1044
- throw new k("Failed to parse the decoded payload as JSON");
1041
+ throw new P("Failed to parse the decoded payload as JSON");
1045
1042
  }
1046
1043
  if (!ue(a))
1047
- throw new k("Invalid JWT Claims Set");
1044
+ throw new P("Invalid JWT Claims Set");
1048
1045
  return a;
1049
1046
  }
1050
- const x = async (e) => {
1047
+ const M = async (e) => {
1051
1048
  try {
1052
- const t = T.ALG, n = await an(xt, t);
1049
+ const t = A.ALG, n = await an(xt, t);
1053
1050
  return await Tn(e, n, {
1054
- issuer: T.ISSUER
1051
+ issuer: A.ISSUER
1055
1052
  });
1056
1053
  } catch {
1057
1054
  return;
@@ -1063,53 +1060,53 @@ const x = async (e) => {
1063
1060
  return;
1064
1061
  }
1065
1062
  };
1066
- var E = [];
1063
+ var w = [];
1067
1064
  for (var we = 0; we < 256; ++we)
1068
- E.push((we + 256).toString(16).slice(1));
1065
+ w.push((we + 256).toString(16).slice(1));
1069
1066
  function _n(e, t = 0) {
1070
- return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
1067
+ return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
1071
1068
  }
1072
- var Z, vn = new Uint8Array(16);
1073
- function Pn() {
1074
- if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))
1069
+ var ee, vn = new Uint8Array(16);
1070
+ function Cn() {
1071
+ if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
1075
1072
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1076
- return Z(vn);
1073
+ return ee(vn);
1077
1074
  }
1078
- var kn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1079
- const $e = {
1080
- randomUUID: kn
1075
+ var Pn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1076
+ const Ue = {
1077
+ randomUUID: Pn
1081
1078
  };
1082
- function Ke(e, t, n) {
1083
- if ($e.randomUUID && !t && !e)
1084
- return $e.randomUUID();
1079
+ function $e(e, t, n) {
1080
+ if (Ue.randomUUID && !t && !e)
1081
+ return Ue.randomUUID();
1085
1082
  e = e || {};
1086
- var r = e.random || (e.rng || Pn)();
1083
+ var r = e.random || (e.rng || Cn)();
1087
1084
  return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, _n(r);
1088
1085
  }
1089
- const He = globalThis.crypto, Cn = (e) => `${Ke()}${Ke()}`.slice(0, e), On = (e) => btoa(
1086
+ const Ke = globalThis.crypto, kn = (e) => `${$e()}${$e()}`.slice(0, e), On = (e) => btoa(
1090
1087
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1091
1088
  );
1092
1089
  async function Nn(e) {
1093
- if (!He.subtle)
1090
+ if (!Ke.subtle)
1094
1091
  throw new Error(
1095
1092
  "crypto.subtle is available only in secure contexts (HTTPS)."
1096
1093
  );
1097
- const t = new TextEncoder().encode(e), n = await He.subtle.digest("SHA-256", t);
1094
+ const t = new TextEncoder().encode(e), n = await Ke.subtle.digest("SHA-256", t);
1098
1095
  return On(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1099
1096
  }
1100
1097
  async function Dn(e) {
1101
- const n = Cn(43), r = await Nn(n);
1098
+ const n = kn(43), r = await Nn(n);
1102
1099
  return {
1103
1100
  code_verifier: n,
1104
1101
  code_challenge: r
1105
1102
  };
1106
1103
  }
1107
- const Cr = async (e, t) => {
1104
+ const Nr = async (e, t) => {
1108
1105
  var n;
1109
- const r = await x(e);
1110
- if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[T.SCOPES_KEY]))
1106
+ const r = await M(e);
1107
+ if (!r || !Array.isArray((n = r.payload) == null ? void 0 : n[A.SCOPES_KEY]))
1111
1108
  return !1;
1112
- const a = r.payload[T.SCOPES_KEY];
1109
+ const a = r.payload[A.SCOPES_KEY];
1113
1110
  return Array.isArray(t) ? t.every((s) => a.includes(s)) : Object.keys(t).some(
1114
1111
  (s) => t[s].every((o) => a.includes(o))
1115
1112
  );
@@ -1117,64 +1114,68 @@ const Cr = async (e, t) => {
1117
1114
  function at(e, t) {
1118
1115
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1119
1116
  }
1120
- const Le = (e, t) => {
1117
+ const He = (e, t) => {
1121
1118
  const n = JSON.stringify(
1122
1119
  typeof t == "function" ? t() : t
1123
1120
  );
1124
1121
  window.localStorage.setItem(e, n), at(e, n);
1125
1122
  }, Un = (e) => {
1126
1123
  window.localStorage.removeItem(e), at(e, null);
1127
- }, We = (e) => window.localStorage.getItem(e), $n = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1128
- function ee({
1124
+ }, Le = (e) => window.localStorage.getItem(e), $n = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1125
+ function te({
1129
1126
  key: e,
1130
1127
  initialValue: t
1131
1128
  }) {
1132
- const n = kt($n, () => We(e)), r = W(
1129
+ const n = Pt($n, () => Le(e)), r = x(
1133
1130
  (o) => {
1134
1131
  try {
1135
1132
  const i = typeof o == "function" ? o(JSON.parse(n)) : o;
1136
- i == null ? Un(e) : Le(e, i);
1133
+ i == null ? Un(e) : He(e, i);
1137
1134
  } catch (i) {
1138
1135
  console.warn(i);
1139
1136
  }
1140
1137
  },
1141
1138
  [e, n]
1142
- ), a = W(() => {
1139
+ ), a = x(() => {
1143
1140
  r(t);
1144
- }, [t, r]), s = W(() => {
1141
+ }, [t, r]), s = x(() => {
1145
1142
  r(null);
1146
1143
  }, [r]);
1147
- return Te(() => {
1144
+ return Ae(() => {
1148
1145
  try {
1149
- We(e) === null && typeof t < "u" && Le(e, t);
1146
+ Le(e) === null && typeof t < "u" && He(e, t);
1150
1147
  } catch (o) {
1151
1148
  console.warn(o);
1152
1149
  }
1153
1150
  }, [e, t]), [n ? JSON.parse(n) : null, r, a, s];
1154
1151
  }
1155
- var S = [];
1152
+ var E = [];
1156
1153
  for (var Ee = 0; Ee < 256; ++Ee)
1157
- S.push((Ee + 256).toString(16).slice(1));
1154
+ E.push((Ee + 256).toString(16).slice(1));
1158
1155
  function Kn(e, t = 0) {
1159
- return (S[e[t + 0]] + S[e[t + 1]] + S[e[t + 2]] + S[e[t + 3]] + "-" + S[e[t + 4]] + S[e[t + 5]] + "-" + S[e[t + 6]] + S[e[t + 7]] + "-" + S[e[t + 8]] + S[e[t + 9]] + "-" + S[e[t + 10]] + S[e[t + 11]] + S[e[t + 12]] + S[e[t + 13]] + S[e[t + 14]] + S[e[t + 15]]).toLowerCase();
1156
+ return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
1160
1157
  }
1161
- var te, Hn = new Uint8Array(16);
1158
+ var ne, Hn = new Uint8Array(16);
1162
1159
  function Ln() {
1163
- if (!te && (te = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !te))
1160
+ if (!ne && (ne = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ne))
1164
1161
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1165
- return te(Hn);
1162
+ return ne(Hn);
1166
1163
  }
1167
1164
  var Wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1168
- const xe = {
1165
+ const We = {
1169
1166
  randomUUID: Wn
1170
1167
  };
1171
1168
  function Se(e, t, n) {
1172
- if (xe.randomUUID && !t && !e)
1173
- return xe.randomUUID();
1169
+ if (We.randomUUID && !t && !e)
1170
+ return We.randomUUID();
1174
1171
  e = e || {};
1175
1172
  var r = e.random || (e.rng || Ln)();
1176
1173
  return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Kn(r);
1177
1174
  }
1175
+ const $ = "Oops! It looks like your session has expired. For your security, please log in again to continue.", xn = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Mn = "Error getting access token, please re-authenticate.", Gn = "You forgot to wrap your component in <AuthProvider>.", le = {
1176
+ dev: "https://auth.gizmette.local.com:3003",
1177
+ prod: "https://mylogin.gizmette.com/auth"
1178
+ }, ae = "@@auth@@", Y = "LOADING", V = "LOGIN", ot = "LOGOUT", Jn = "success", xe = "failure";
1178
1179
  /*!
1179
1180
  @versini/ui-fingerprint v1.0.1
1180
1181
  © 2024 gizmette.com
@@ -1188,7 +1189,7 @@ try {
1188
1189
  });
1189
1190
  } catch {
1190
1191
  }
1191
- const xn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), ot = async (e) => {
1192
+ const Yn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), st = async (e) => {
1192
1193
  if (e === "")
1193
1194
  return "";
1194
1195
  const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
@@ -1197,28 +1198,28 @@ const xn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join
1197
1198
  function Me(e, t) {
1198
1199
  return new Promise((n) => setTimeout(n, e, t));
1199
1200
  }
1200
- async function Mn(e, t, n = 50) {
1201
+ async function Vn(e, t, n = 50) {
1201
1202
  var r, a, s;
1202
1203
  const o = document;
1203
1204
  for (; !o.body; )
1204
1205
  await Me(n);
1205
1206
  const i = o.createElement("iframe");
1206
1207
  try {
1207
- for (await new Promise((l, y) => {
1208
- let h = !1;
1209
- const p = () => {
1210
- h = !0, l();
1211
- }, m = (g) => {
1212
- h = !0, y(g);
1208
+ for (await new Promise((c, g) => {
1209
+ let l = !1;
1210
+ const h = () => {
1211
+ l = !0, c();
1212
+ }, y = (m) => {
1213
+ l = !0, g(m);
1213
1214
  };
1214
- i.onload = p, i.onerror = m;
1215
- const { style: u } = i;
1216
- u.setProperty("display", "block", "important"), u.position = "absolute", u.top = "0", u.left = "0", u.visibility = "hidden", i.src = "about:blank", o.body.appendChild(i);
1217
- const d = () => {
1218
- var g, R;
1219
- h || (((R = (g = i.contentWindow) == null ? void 0 : g.document) == null ? void 0 : R.readyState) === "complete" ? p() : setTimeout(d, 10));
1215
+ i.onload = h, i.onerror = y;
1216
+ const { style: p } = i;
1217
+ p.setProperty("display", "block", "important"), p.position = "absolute", p.top = "0", p.left = "0", p.visibility = "hidden", i.src = "about:blank", o.body.appendChild(i);
1218
+ const u = () => {
1219
+ var m, T;
1220
+ l || (((T = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : T.readyState) === "complete" ? h() : setTimeout(u, 10));
1220
1221
  };
1221
- d();
1222
+ u();
1222
1223
  }); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
1223
1224
  await Me(n);
1224
1225
  return await e(i, i.contentWindow);
@@ -1226,14 +1227,14 @@ async function Mn(e, t, n = 50) {
1226
1227
  (s = i.parentNode) == null || s.removeChild(i);
1227
1228
  }
1228
1229
  }
1229
- const Gn = {
1230
+ const jn = {
1230
1231
  audio: {
1231
1232
  sampleHash: "",
1232
1233
  oscillator: "",
1233
1234
  maxChannels: 0,
1234
1235
  channelCountMode: ""
1235
1236
  }
1236
- }, Jn = async (e) => new Promise((t) => {
1237
+ }, Fn = async (e) => new Promise((t) => {
1237
1238
  try {
1238
1239
  const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
1239
1240
  a.frequency.value = 1e3;
@@ -1242,7 +1243,7 @@ const Gn = {
1242
1243
  const i = o.renderedBuffer.getChannelData(0);
1243
1244
  a.disconnect(), s.disconnect(), t({
1244
1245
  audio: {
1245
- sampleHash: xn(i),
1246
+ sampleHash: Yn(i),
1246
1247
  oscillator: a.type,
1247
1248
  maxChannels: n.destination.maxChannelCount,
1248
1249
  channelCountMode: r.channelCountMode
@@ -1259,25 +1260,25 @@ const Gn = {
1259
1260
  }
1260
1261
  });
1261
1262
  }
1262
- }), st = { browser: "" }, Yn = async (e) => typeof navigator > "u" ? st : { browser: navigator.userAgent }, it = {
1263
+ }), it = { browser: "" }, Bn = async (e) => typeof navigator > "u" ? it : { browser: navigator.userAgent }, ct = {
1263
1264
  canvas: {
1264
1265
  data: ""
1265
1266
  }
1266
- }, Vn = async (e) => {
1267
+ }, qn = async (e) => {
1267
1268
  try {
1268
1269
  const t = Array.from(
1269
1270
  { length: 3 },
1270
- () => jn(300, 30)
1271
- ), n = Bn(t, 300, 30);
1271
+ () => zn(300, 30)
1272
+ ), n = Xn(t, 300, 30);
1272
1273
  return {
1273
1274
  canvas: {
1274
- data: (await ot(n.data.toString())).toString()
1275
+ data: (await st(n.data.toString())).toString()
1275
1276
  }
1276
1277
  };
1277
1278
  } catch {
1278
- return it;
1279
+ return ct;
1279
1280
  }
1280
- }, jn = (e, t) => {
1281
+ }, zn = (e, t) => {
1281
1282
  const n = document.createElement("canvas"), r = n.getContext("2d");
1282
1283
  if (!r)
1283
1284
  return new ImageData(1, 1);
@@ -1286,7 +1287,7 @@ const Gn = {
1286
1287
  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"), r.fillStyle = a, r.fillRect(0, 0, n.width, n.height);
1287
1288
  const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
1288
1289
  return r.font = "26.321px Arial", r.fillStyle = "black", r.fillText(s, -5, 15), r.fillStyle = "rgba(0, 0, 255, 0.5)", r.fillText(s, -3.3, 17.7), r.beginPath(), r.moveTo(0, 0), r.lineTo(n.width * 2 / 7, n.height), r.strokeStyle = "white", r.lineWidth = 2, r.stroke(), r.getImageData(0, 0, n.width, n.height);
1289
- }, Fn = (e) => {
1290
+ }, Qn = (e) => {
1290
1291
  if (e.length === 0)
1291
1292
  return 0;
1292
1293
  const t = {};
@@ -1296,17 +1297,17 @@ const Gn = {
1296
1297
  for (const r in t)
1297
1298
  t[r] > t[n] && (n = parseInt(r, 10));
1298
1299
  return n;
1299
- }, Bn = (e, t, n) => {
1300
+ }, Xn = (e, t, n) => {
1300
1301
  const r = [];
1301
1302
  for (let o = 0; o < e[0].data.length; o++) {
1302
1303
  const i = [];
1303
- for (let l = 0; l < e.length; l++)
1304
- i.push(e[l].data[o]);
1305
- r.push(Fn(i));
1304
+ for (let c = 0; c < e.length; c++)
1305
+ i.push(e[c].data[o]);
1306
+ r.push(Qn(i));
1306
1307
  }
1307
1308
  const a = r, s = new Uint8ClampedArray(a);
1308
1309
  return new ImageData(s, t, n);
1309
- }, qn = [], zn = "mmMwWLliI0O&1", Qn = "48px", $ = ["monospace", "sans-serif", "serif"], Ge = [
1310
+ }, Zn = [], er = "mmMwWLliI0O&1", tr = "48px", K = ["monospace", "sans-serif", "serif"], Ge = [
1310
1311
  "sans-serif-thin",
1311
1312
  "ARNO PRO",
1312
1313
  "Agency FB",
@@ -1344,44 +1345,44 @@ const Gn = {
1344
1345
  "TRAJAN PRO",
1345
1346
  "Univers CE 55 Medium",
1346
1347
  "ZWAdobeF"
1347
- ], Xn = async (e) => Mn(async (t, { document: n }) => {
1348
+ ], nr = async (e) => Vn(async (t, { document: n }) => {
1348
1349
  const r = n.body;
1349
- r.style.fontSize = Qn;
1350
+ r.style.fontSize = tr;
1350
1351
  const a = n.createElement("div");
1351
1352
  a.style.setProperty("visibility", "hidden", "important");
1352
- const s = {}, o = {}, i = (d) => {
1353
- const g = n.createElement("span"), { style: R } = g;
1354
- return R.position = "absolute", R.top = "0", R.left = "0", R.fontFamily = d, g.textContent = zn, a.appendChild(g), g;
1355
- }, l = (d, g) => i(`'${d}',${g}`), y = () => $.map(i), h = () => {
1356
- const d = {};
1357
- for (const g of Ge)
1358
- d[g] = $.map(
1359
- (R) => l(g, R)
1353
+ const s = {}, o = {}, i = (u) => {
1354
+ const m = n.createElement("span"), { style: T } = m;
1355
+ return T.position = "absolute", T.top = "0", T.left = "0", T.fontFamily = u, m.textContent = er, a.appendChild(m), m;
1356
+ }, c = (u, m) => i(`'${u}',${m}`), g = () => K.map(i), l = () => {
1357
+ const u = {};
1358
+ for (const m of Ge)
1359
+ u[m] = K.map(
1360
+ (T) => c(m, T)
1360
1361
  );
1361
- return d;
1362
- }, p = (d) => $.some(
1363
- (g, R) => d[R].offsetWidth !== s[g] || d[R].offsetHeight !== o[g]
1364
- ), m = y(), u = h();
1362
+ return u;
1363
+ }, h = (u) => K.some(
1364
+ (m, T) => u[T].offsetWidth !== s[m] || u[T].offsetHeight !== o[m]
1365
+ ), y = g(), p = l();
1365
1366
  r.appendChild(a);
1366
- for (let d = 0; d < $.length; d++)
1367
- s[$[d]] = m[d].offsetWidth, o[$[d]] = m[d].offsetHeight;
1368
- return Ge.filter((d) => p(u[d]));
1369
- }), ct = {
1367
+ for (let u = 0; u < K.length; u++)
1368
+ s[K[u]] = y[u].offsetWidth, o[K[u]] = y[u].offsetHeight;
1369
+ return Ge.filter((u) => h(p[u]));
1370
+ }), ut = {
1370
1371
  vendor: "",
1371
1372
  vendorUnmasked: "",
1372
1373
  renderer: "",
1373
1374
  rendererUnmasked: "",
1374
1375
  version: "",
1375
1376
  shadingLanguageVersion: ""
1376
- }, ut = {
1377
+ }, lt = {
1377
1378
  hardware: {
1378
- videocard: ct,
1379
+ videocard: ut,
1379
1380
  architecture: 0,
1380
1381
  deviceMemory: "undefined",
1381
1382
  jsHeapSizeLimit: 0
1382
1383
  }
1383
1384
  };
1384
- function Zn() {
1385
+ function rr() {
1385
1386
  const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
1386
1387
  if (t && "getParameter" in t) {
1387
1388
  const n = t.getExtension("WEBGL_debug_renderer_info");
@@ -1394,41 +1395,41 @@ function Zn() {
1394
1395
  shadingLanguageVersion: (t.getParameter(t.SHADING_LANGUAGE_VERSION) || "").toString()
1395
1396
  };
1396
1397
  }
1397
- return ct;
1398
+ return ut;
1398
1399
  }
1399
- function er() {
1400
+ function ar() {
1400
1401
  const e = new Float32Array(1), t = new Uint8Array(e.buffer);
1401
1402
  return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
1402
1403
  }
1403
- const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && window.performance.memory || {
1404
+ const or = () => navigator.deviceMemory || 0, sr = () => window.performance && window.performance.memory || {
1404
1405
  jsHeapSizeLimit: 0
1405
- }, rr = async (e) => new Promise((t) => {
1406
+ }, ir = async (e) => new Promise((t) => {
1406
1407
  try {
1407
- const n = tr(), r = nr();
1408
+ const n = or(), r = sr();
1408
1409
  t({
1409
1410
  hardware: {
1410
- videocard: Zn(),
1411
- architecture: er(),
1411
+ videocard: rr(),
1412
+ architecture: ar(),
1412
1413
  deviceMemory: n.toString() || "undefined",
1413
1414
  jsHeapSizeLimit: r.jsHeapSizeLimit || 0
1414
1415
  }
1415
1416
  });
1416
1417
  } catch {
1417
- t(ut);
1418
+ t(lt);
1418
1419
  }
1419
- }), ar = {
1420
+ }), cr = {
1420
1421
  locales: {
1421
1422
  languages: "",
1422
1423
  timezone: ""
1423
1424
  }
1424
- }, or = async (e) => new Promise((t) => {
1425
+ }, ur = async (e) => new Promise((t) => {
1425
1426
  t({
1426
1427
  locales: {
1427
1428
  languages: navigator.language,
1428
1429
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
1429
1430
  }
1430
1431
  });
1431
- }), lt = {
1432
+ }), dt = {
1432
1433
  screen: {
1433
1434
  colorDepth: 0,
1434
1435
  pixelDepth: 0,
@@ -1436,7 +1437,7 @@ const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && w
1436
1437
  maxTouchPoints: 0,
1437
1438
  mediaMatches: []
1438
1439
  }
1439
- }, sr = async (e) => new Promise((t) => {
1440
+ }, lr = async (e) => new Promise((t) => {
1440
1441
  try {
1441
1442
  const n = window.screen, r = {
1442
1443
  screen: {
@@ -1444,15 +1445,15 @@ const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && w
1444
1445
  pixelDepth: n.pixelDepth,
1445
1446
  isTouchScreen: navigator.maxTouchPoints > 0,
1446
1447
  maxTouchPoints: navigator.maxTouchPoints,
1447
- mediaMatches: ir()
1448
+ mediaMatches: dr()
1448
1449
  }
1449
1450
  };
1450
1451
  t(r);
1451
1452
  } catch {
1452
- t(lt);
1453
+ t(dt);
1453
1454
  }
1454
1455
  });
1455
- function ir() {
1456
+ function dr() {
1456
1457
  const e = [], t = {
1457
1458
  "prefers-contrast": [
1458
1459
  "high",
@@ -1480,7 +1481,7 @@ function ir() {
1480
1481
  });
1481
1482
  }), e;
1482
1483
  }
1483
- const cr = async (e) => {
1484
+ const hr = async (e) => {
1484
1485
  try {
1485
1486
  return {
1486
1487
  system: {
@@ -1491,55 +1492,175 @@ const cr = async (e) => {
1491
1492
  }
1492
1493
  };
1493
1494
  } catch {
1494
- return dt;
1495
+ return ht;
1495
1496
  }
1496
- }, dt = {
1497
+ }, ht = {
1497
1498
  system: {
1498
1499
  platform: "",
1499
1500
  cookieEnabled: !1,
1500
1501
  productSub: "",
1501
1502
  product: ""
1502
1503
  }
1503
- }, ur = async (e) => {
1504
+ }, pr = async (e) => {
1504
1505
  try {
1505
1506
  return Promise.all([
1506
- Jn(),
1507
- Yn(),
1508
- Vn(),
1509
- Xn(),
1510
- rr(),
1511
- or(),
1512
- sr(),
1513
- cr()
1507
+ Fn(e),
1508
+ Bn(),
1509
+ qn(e),
1510
+ nr(),
1511
+ ir(e),
1512
+ ur(),
1513
+ lr(e),
1514
+ hr(e)
1514
1515
  ]);
1515
1516
  } catch {
1516
1517
  return [
1517
- Gn,
1518
- st,
1518
+ jn,
1519
1519
  it,
1520
- qn,
1521
- ut,
1522
- ar,
1520
+ ct,
1521
+ Zn,
1523
1522
  lt,
1524
- dt
1523
+ cr,
1524
+ dt,
1525
+ ht
1525
1526
  ];
1526
1527
  }
1527
- }, lr = async (e) => {
1528
+ }, fr = async (e) => {
1528
1529
  try {
1529
- const t = await ur();
1530
- return await ot(JSON.stringify(t));
1530
+ const t = await pr(e);
1531
+ return await st(JSON.stringify(t));
1531
1532
  } catch {
1532
1533
  return "";
1533
1534
  }
1534
- }, ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", dr = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Ae = "Error getting access token, please re-authenticate.", hr = "You forgot to wrap your component in <AuthProvider>.", le = {
1535
- dev: "https://auth.gizmette.local.com:3003",
1536
- prod: "https://mylogin.gizmette.com/auth"
1537
- }, ae = "@@auth@@", J = "LOADING", Y = "LOGIN", ht = "LOGOUT", pr = process.env.NODE_ENV === "production", pt = !pr, fr = (e) => {
1535
+ }, oe = {
1536
+ GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1537
+ $clientId: String!,
1538
+ $username: String!,
1539
+ $id: String!) {
1540
+ getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
1541
+ challenge
1542
+ rp {
1543
+ id
1544
+ name
1545
+ }
1546
+ user {
1547
+ id
1548
+ name
1549
+ displayName
1550
+ }
1551
+ pubKeyCredParams {
1552
+ type
1553
+ alg
1554
+ }
1555
+ timeout
1556
+ attestation
1557
+ }
1558
+ }`,
1559
+ VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
1560
+ $clientId: String!,
1561
+ $username: String!,
1562
+ $id: String!,
1563
+ $registration: RegistrationOptionsInput!) {
1564
+ verifyPasskeyRegistration(
1565
+ clientId: $clientId,
1566
+ username: $username,
1567
+ id: $id,
1568
+ registration: $registration) {
1569
+ status
1570
+ message
1571
+ }
1572
+ }`,
1573
+ GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
1574
+ $id: String!,
1575
+ $clientId: String!,
1576
+ ) {
1577
+ getPasskeyAuthenticationOptions(
1578
+ id: $id,
1579
+ clientId: $clientId) {
1580
+ rpId,
1581
+ challenge,
1582
+ allowCredentials {
1583
+ id,
1584
+ type,
1585
+ transports
1586
+ }
1587
+ timeout,
1588
+ userVerification,
1589
+ }
1590
+ }`,
1591
+ VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
1592
+ $clientId: String!,
1593
+ $id: String!,
1594
+ $authentication: AuthenticationOptionsInput!,
1595
+ $nonce: String!,
1596
+ $domain: String,
1597
+ $fingerprint: String) {
1598
+ verifyPasskeyAuthentication(
1599
+ clientId: $clientId,
1600
+ id: $id,
1601
+ authentication: $authentication,
1602
+ nonce: $nonce,
1603
+ domain: $domain,
1604
+ fingerprint: $fingerprint) {
1605
+ status,
1606
+ idToken,
1607
+ accessToken,
1608
+ refreshToken,
1609
+ userId,
1610
+ username,
1611
+ }
1612
+ }`
1613
+ }, H = {
1614
+ GET_REGISTRATION_OPTIONS: {
1615
+ schema: oe.GET_REGISTRATION_OPTIONS,
1616
+ method: "getPasskeyRegistrationOptions"
1617
+ },
1618
+ VERIFY_REGISTRATION: {
1619
+ schema: oe.VERIFY_REGISTRATION,
1620
+ method: "verifyPasskeyRegistration"
1621
+ },
1622
+ GET_AUTHENTICATION_OPTIONS: {
1623
+ schema: oe.GET_AUTHENTICATION_OPTIONS,
1624
+ method: "getPasskeyAuthenticationOptions"
1625
+ },
1626
+ VERIFY_AUTHENTICATION: {
1627
+ schema: oe.VERIFY_AUTHENTICATION,
1628
+ method: "verifyPasskeyAuthentication"
1629
+ }
1630
+ }, L = async ({
1631
+ accessToken: e,
1632
+ type: t,
1633
+ clientId: n,
1634
+ params: r = {}
1635
+ }) => {
1538
1636
  try {
1539
- const t = In(e);
1540
- return t ? t[T.USER_ID_KEY] : "";
1541
- } catch {
1542
- return "";
1637
+ const a = t?.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
1638
+ pt ? `${le.dev}/graphql` : `${le.prod}/graphql`,
1639
+ {
1640
+ method: "POST",
1641
+ credentials: "include",
1642
+ headers: {
1643
+ authorization: s,
1644
+ "Content-Type": "application/json",
1645
+ Accept: "application/json",
1646
+ [Be.CLIENT_ID]: `${n}`
1647
+ },
1648
+ body: JSON.stringify({
1649
+ query: t.schema,
1650
+ variables: a
1651
+ })
1652
+ }
1653
+ );
1654
+ if (o.status !== 200)
1655
+ return { status: o.status, data: [] };
1656
+ const { data: i, errors: c } = await o.json();
1657
+ return {
1658
+ status: o.status,
1659
+ data: i[t.method],
1660
+ errors: c
1661
+ };
1662
+ } catch (a) {
1663
+ return console.error(a), { status: 500, data: [] };
1543
1664
  }
1544
1665
  }, pe = async ({
1545
1666
  type: e,
@@ -1570,7 +1691,14 @@ const cr = async (e) => {
1570
1691
  } catch (r) {
1571
1692
  return console.error(r), { status: 500, data: [] };
1572
1693
  }
1573
- }, yr = async ({
1694
+ }, yr = process.env.NODE_ENV === "production", pt = !yr, gr = (e) => {
1695
+ try {
1696
+ const t = In(e);
1697
+ return t ? t[A.USER_ID_KEY] : "";
1698
+ } catch {
1699
+ return "";
1700
+ }
1701
+ }, mr = async ({
1574
1702
  userId: e,
1575
1703
  idToken: t,
1576
1704
  accessToken: n,
@@ -1590,7 +1718,7 @@ const cr = async (e) => {
1590
1718
  refreshToken: r,
1591
1719
  domain: s
1592
1720
  }
1593
- })).status === 200
1721
+ }))?.status === 200
1594
1722
  };
1595
1723
  } catch {
1596
1724
  return {
@@ -1606,30 +1734,30 @@ const cr = async (e) => {
1606
1734
  sessionExpiration: s,
1607
1735
  code: o,
1608
1736
  code_verifier: i,
1609
- domain: l,
1610
- fingerprint: y
1737
+ domain: c,
1738
+ fingerprint: g
1611
1739
  }) => {
1612
1740
  try {
1613
- const h = await pe({
1741
+ const l = await pe({
1614
1742
  type: de.AUTHENTICATE,
1615
1743
  clientId: n,
1616
1744
  params: {
1617
- type: a || j.ID_AND_ACCESS_TOKEN,
1745
+ type: a || F.ID_AND_ACCESS_TOKEN,
1618
1746
  username: e,
1619
1747
  password: t,
1620
1748
  sessionExpiration: s,
1621
1749
  nonce: r,
1622
1750
  code: o,
1623
1751
  code_verifier: i,
1624
- domain: l,
1625
- fingerprint: y
1752
+ domain: c,
1753
+ fingerprint: g
1626
1754
  }
1627
- }), p = await x(h.data.idToken);
1628
- return p && p.payload[T.USER_ID_KEY] !== "" && p.payload[T.NONCE_KEY] === r ? {
1629
- idToken: h.data.idToken,
1630
- accessToken: h.data.accessToken,
1631
- refreshToken: h.data.refreshToken,
1632
- userId: p.payload[T.USER_ID_KEY],
1755
+ }), h = await M(l?.data?.idToken);
1756
+ return h && h.payload[A.USER_ID_KEY] !== "" && h.payload[A.NONCE_KEY] === r ? {
1757
+ idToken: l.data.idToken,
1758
+ accessToken: l.data.accessToken,
1759
+ refreshToken: l.data.refreshToken,
1760
+ userId: h.payload[A.USER_ID_KEY],
1633
1761
  status: !0
1634
1762
  } : {
1635
1763
  status: !1
@@ -1639,7 +1767,7 @@ const cr = async (e) => {
1639
1767
  status: !1
1640
1768
  };
1641
1769
  }
1642
- }, gr = async ({
1770
+ }, wr = async ({
1643
1771
  nonce: e,
1644
1772
  clientId: t,
1645
1773
  code_challenge: n
@@ -1649,12 +1777,12 @@ const cr = async (e) => {
1649
1777
  type: de.CODE,
1650
1778
  clientId: t,
1651
1779
  params: {
1652
- type: j.CODE,
1780
+ type: F.CODE,
1653
1781
  nonce: e,
1654
1782
  code_challenge: n
1655
1783
  }
1656
1784
  });
1657
- return r.data.code ? {
1785
+ return r?.data?.code ? {
1658
1786
  status: !0,
1659
1787
  code: r.data.code
1660
1788
  } : {
@@ -1665,7 +1793,7 @@ const cr = async (e) => {
1665
1793
  status: !1
1666
1794
  };
1667
1795
  }
1668
- }, mr = async ({
1796
+ }, Er = async ({
1669
1797
  clientId: e,
1670
1798
  userId: t,
1671
1799
  nonce: n,
@@ -1678,7 +1806,7 @@ const cr = async (e) => {
1678
1806
  type: de.AUTHENTICATE,
1679
1807
  clientId: e,
1680
1808
  params: {
1681
- type: j.REFRESH_TOKEN,
1809
+ type: F.REFRESH_TOKEN,
1682
1810
  userId: t,
1683
1811
  nonce: n,
1684
1812
  refreshToken: r,
@@ -1686,11 +1814,11 @@ const cr = async (e) => {
1686
1814
  domain: s,
1687
1815
  fingerprint: await ft()
1688
1816
  }
1689
- }), i = await x(o.data.accessToken);
1690
- return i && i.payload[T.USER_ID_KEY] !== "" && i.payload[T.NONCE_KEY] === n ? {
1817
+ }), i = await M(o?.data?.accessToken);
1818
+ return i && i.payload[A.USER_ID_KEY] !== "" && i.payload[A.NONCE_KEY] === n ? {
1691
1819
  accessToken: o.data.accessToken,
1692
1820
  refreshToken: o.data.refreshToken,
1693
- userId: i.payload[T.USER_ID_KEY],
1821
+ userId: i.payload[A.USER_ID_KEY],
1694
1822
  status: !0
1695
1823
  } : {
1696
1824
  status: !1
@@ -1700,148 +1828,18 @@ const cr = async (e) => {
1700
1828
  status: !1
1701
1829
  };
1702
1830
  }
1703
- }, oe = {
1704
- GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1705
- $clientId: String!,
1706
- $username: String!,
1707
- $id: String!) {
1708
- getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
1709
- challenge
1710
- rp {
1711
- id
1712
- name
1713
- }
1714
- user {
1715
- id
1716
- name
1717
- displayName
1718
- }
1719
- pubKeyCredParams {
1720
- type
1721
- alg
1722
- }
1723
- timeout
1724
- attestation
1725
- }
1726
- }`,
1727
- VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
1728
- $clientId: String!,
1729
- $username: String!,
1730
- $id: String!,
1731
- $registration: RegistrationOptionsInput!) {
1732
- verifyPasskeyRegistration(
1733
- clientId: $clientId,
1734
- username: $username,
1735
- id: $id,
1736
- registration: $registration) {
1737
- status
1738
- message
1739
- }
1740
- }`,
1741
- GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
1742
- $id: String!,
1743
- $clientId: String!,
1744
- ) {
1745
- getPasskeyAuthenticationOptions(
1746
- id: $id,
1747
- clientId: $clientId) {
1748
- rpId,
1749
- challenge,
1750
- allowCredentials {
1751
- id,
1752
- type,
1753
- transports
1754
- }
1755
- timeout,
1756
- userVerification,
1757
- }
1758
- }`,
1759
- VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
1760
- $clientId: String!,
1761
- $id: String!,
1762
- $authentication: AuthenticationOptionsInput!,
1763
- $nonce: String!,
1764
- $domain: String,
1765
- $fingerprint: String) {
1766
- verifyPasskeyAuthentication(
1767
- clientId: $clientId,
1768
- id: $id,
1769
- authentication: $authentication,
1770
- nonce: $nonce,
1771
- domain: $domain,
1772
- fingerprint: $fingerprint) {
1773
- status,
1774
- idToken,
1775
- accessToken,
1776
- refreshToken,
1777
- userId,
1778
- username,
1779
- }
1780
- }`
1781
- }, K = {
1782
- GET_REGISTRATION_OPTIONS: {
1783
- schema: oe.GET_REGISTRATION_OPTIONS,
1784
- method: "getPasskeyRegistrationOptions"
1785
- },
1786
- VERIFY_REGISTRATION: {
1787
- schema: oe.VERIFY_REGISTRATION,
1788
- method: "verifyPasskeyRegistration"
1789
- },
1790
- GET_AUTHENTICATION_OPTIONS: {
1791
- schema: oe.GET_AUTHENTICATION_OPTIONS,
1792
- method: "getPasskeyAuthenticationOptions"
1793
- },
1794
- VERIFY_AUTHENTICATION: {
1795
- schema: oe.VERIFY_AUTHENTICATION,
1796
- method: "verifyPasskeyAuthentication"
1797
- }
1798
- }, H = async ({
1799
- accessToken: e,
1800
- type: t,
1801
- clientId: n,
1802
- params: r = {}
1803
- }) => {
1804
- try {
1805
- const a = t != null && t.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
1806
- pt ? `${le.dev}/graphql` : `${le.prod}/graphql`,
1807
- {
1808
- method: "POST",
1809
- credentials: "include",
1810
- headers: {
1811
- authorization: s,
1812
- "Content-Type": "application/json",
1813
- Accept: "application/json",
1814
- [Be.CLIENT_ID]: `${n}`
1815
- },
1816
- body: JSON.stringify({
1817
- query: t.schema,
1818
- variables: a
1819
- })
1820
- }
1821
- );
1822
- if (o.status !== 200)
1823
- return { status: o.status, data: [] };
1824
- const { data: i, errors: l } = await o.json();
1825
- return {
1826
- status: o.status,
1827
- data: i[t.method],
1828
- errors: l
1829
- };
1830
- } catch (a) {
1831
- return console.error(a), { status: 500, data: [] };
1832
- }
1833
1831
  }, ft = async () => {
1834
1832
  try {
1835
- return await lr();
1833
+ return await fr();
1836
1834
  } catch {
1837
1835
  return "";
1838
1836
  }
1839
1837
  };
1840
- class wr {
1838
+ class Sr {
1841
1839
  constructor(t = null, n = null) {
1842
- z(this, "refreshTokenPromise", null);
1843
- z(this, "accessToken");
1844
- z(this, "refreshToken");
1840
+ Q(this, "refreshTokenPromise", null);
1841
+ Q(this, "accessToken");
1842
+ Q(this, "refreshToken");
1845
1843
  this.accessToken = t || "", this.refreshToken = n || "";
1846
1844
  }
1847
1845
  async refreshtoken({
@@ -1868,9 +1866,9 @@ class wr {
1868
1866
  nonce: r,
1869
1867
  domain: a
1870
1868
  }) {
1871
- const s = await x(this.refreshToken);
1872
- if (s && s.payload[T.USER_ID_KEY] !== "") {
1873
- const o = await mr({
1869
+ const s = await M(this.refreshToken);
1870
+ if (s && s.payload[A.USER_ID_KEY] !== "") {
1871
+ const o = await Er({
1874
1872
  clientId: t,
1875
1873
  userId: n,
1876
1874
  nonce: r,
@@ -1879,37 +1877,37 @@ class wr {
1879
1877
  domain: a
1880
1878
  });
1881
1879
  return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
1882
- status: "success",
1880
+ status: Jn,
1883
1881
  newAccessToken: o.accessToken,
1884
1882
  newRefreshToken: o.refreshToken
1885
1883
  }) : {
1886
- status: "failure"
1884
+ status: xe
1887
1885
  };
1888
1886
  } else
1889
1887
  return {
1890
- status: "failure"
1888
+ status: xe
1891
1889
  };
1892
1890
  }
1893
1891
  }
1894
- const Er = (e) => W(
1892
+ const Ar = (e) => x(
1895
1893
  (...t) => {
1896
1894
  e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1897
1895
  },
1898
1896
  [e]
1899
- ), L = () => {
1900
- throw new Error(hr);
1901
- }, yt = Ct({
1897
+ ), W = () => {
1898
+ throw new Error(Gn);
1899
+ }, yt = kt({
1902
1900
  isAuthenticated: !1,
1903
1901
  isLoading: !1,
1904
1902
  authenticationType: null,
1905
- login: L,
1906
- logout: L,
1907
- getAccessToken: L,
1908
- getIdToken: L,
1909
- registeringForPasskey: L,
1910
- loginWithPasskey: L,
1903
+ login: W,
1904
+ logout: W,
1905
+ getAccessToken: W,
1906
+ getIdToken: W,
1907
+ registeringForPasskey: W,
1908
+ loginWithPasskey: W,
1911
1909
  logoutReason: ""
1912
- }), Sr = Pt.createContext({
1910
+ }), Tr = Ct.createContext({
1913
1911
  state: {
1914
1912
  isLoading: !0,
1915
1913
  isAuthenticated: !1,
@@ -1920,269 +1918,271 @@ const Er = (e) => W(
1920
1918
  },
1921
1919
  dispatch: () => {
1922
1920
  }
1923
- }), Ar = (e, t) => (t == null ? void 0 : t.type) === J ? {
1921
+ }), Rr = (e, t) => t?.type === Y ? {
1924
1922
  ...e,
1925
1923
  isLoading: t.payload.isLoading
1926
- } : (t == null ? void 0 : t.type) === Y ? {
1924
+ } : t?.type === V ? {
1927
1925
  ...e,
1928
1926
  isLoading: !1,
1929
1927
  isAuthenticated: !0,
1930
1928
  user: t.payload.user,
1931
1929
  authenticationType: t.payload.authenticationType,
1932
1930
  logoutReason: ""
1933
- } : (t == null ? void 0 : t.type) === ht ? {
1931
+ } : t?.type === ot ? {
1934
1932
  ...e,
1935
1933
  isLoading: !1,
1936
1934
  isAuthenticated: !1,
1937
1935
  user: void 0,
1938
1936
  authenticationType: null,
1939
1937
  logoutReason: t.payload.logoutReason
1940
- } : e, Or = ({
1938
+ } : e, Dr = ({
1941
1939
  children: e,
1942
1940
  sessionExpiration: t,
1943
1941
  clientId: n,
1944
1942
  domain: r = "",
1945
1943
  debug: a = !1
1946
1944
  }) => {
1947
- const [s, o] = Ot(Ar, {
1945
+ const [s, o] = Ot(Rr, {
1948
1946
  isLoading: !0,
1949
1947
  isAuthenticated: !1,
1950
1948
  authenticationType: null,
1951
1949
  user: void 0,
1952
1950
  logoutReason: "",
1953
1951
  debug: a
1954
- }), i = Er(a), l = ke(!1), y = ke(""), [h, p, , m] = ee({
1952
+ }), i = Ar(a), c = Ce(!1), g = Ce(""), [l, h, , y] = te({
1955
1953
  key: `${ae}::${n}::@@user@@`
1956
- }), [u, d, , g] = ee({
1954
+ }), [p, u, , m] = te({
1957
1955
  key: `${ae}::${n}::@@access@@`
1958
- }), [R, B, , q] = ee(
1956
+ }), [T, q, , z] = te(
1959
1957
  {
1960
1958
  key: `${ae}::${n}::@@refresh@@`
1961
1959
  }
1962
- ), [gt, Ie, , _e] = ee({
1960
+ ), [gt, be, , Ie] = te({
1963
1961
  key: `${ae}::${n}::@@nonce@@`
1964
- }), mt = new wr(u, R), U = W(
1965
- (c) => {
1962
+ }), mt = new Sr(p, T), U = x(
1963
+ (d) => {
1966
1964
  i(
1967
1965
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
1968
- c
1966
+ d
1969
1967
  ), o({
1970
- type: ht,
1968
+ type: ot,
1971
1969
  payload: {
1972
- logoutReason: c || ne
1970
+ logoutReason: d || $
1973
1971
  }
1974
- }), m(), g(), q(), _e(), o({ type: J, payload: { isLoading: !1 } });
1972
+ }), y(), m(), z(), Ie(), o({ type: Y, payload: { isLoading: !1 } });
1975
1973
  },
1976
- [g, m, _e, q, i]
1977
- ), N = W(
1978
- async (c) => {
1974
+ [m, y, Ie, z, i]
1975
+ ), N = x(
1976
+ async (d) => {
1979
1977
  i("invalidateAndLogout: invalidating and logging out");
1980
- const { user: w } = s, f = (w == null ? void 0 : w.userId) || fr(h);
1978
+ const { user: R } = s, f = R?.userId || gr(l);
1981
1979
  f || i(
1982
1980
  "invalidateAndLogout: user cannot be identified, logging out without userId"
1983
- ), await yr({
1981
+ ), await mr({
1984
1982
  userId: f,
1985
- idToken: h,
1986
- accessToken: u,
1987
- refreshToken: R,
1983
+ idToken: l,
1984
+ accessToken: p,
1985
+ refreshToken: T,
1988
1986
  clientId: n,
1989
1987
  domain: r
1990
- }), U(c || ne);
1988
+ }), U(d || $);
1991
1989
  },
1992
1990
  [
1993
- u,
1991
+ p,
1994
1992
  s,
1995
1993
  n,
1996
1994
  r,
1997
- h,
1998
- R,
1995
+ l,
1996
+ T,
1999
1997
  U,
2000
1998
  i
2001
1999
  ]
2002
2000
  );
2003
- Te(() => ((async () => (i("useEffect: setting the fingerprint"), y.current = await ft()))(), () => {
2004
- i("useEffect: cleaning up the fingerprint"), y.current = "";
2005
- }), []), Te(() => {
2006
- if (!l.current)
2007
- return s.isLoading && h !== null ? (async () => {
2001
+ Ae(() => ((async () => (i("useEffect: setting the fingerprint"), g.current = await ft()))(), () => {
2002
+ i("useEffect: cleaning up the fingerprint"), g.current = "";
2003
+ }), []), Ae(() => {
2004
+ if (!c.current)
2005
+ return s.isLoading && l !== null ? (async () => {
2008
2006
  try {
2009
- const c = await x(h);
2010
- c && c.payload[T.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
2011
- type: Y,
2007
+ const d = await M(l);
2008
+ d && d.payload[A.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), o({
2009
+ type: V,
2012
2010
  payload: {
2013
- authenticationType: c.payload[T.AUTH_TYPE_KEY],
2011
+ authenticationType: d.payload[A.AUTH_TYPE_KEY],
2014
2012
  user: {
2015
- userId: c.payload[T.USER_ID_KEY],
2016
- username: c.payload[T.USERNAME_KEY]
2013
+ userId: d.payload[A.USER_ID_KEY],
2014
+ username: d.payload[A.USERNAME_KEY]
2017
2015
  }
2018
2016
  }
2019
- })) : (i("useEffect: invalid JWT, invalidating and logging out"), await N(ne));
2017
+ })) : (i("useEffect: invalid JWT, invalidating and logging out"), await N($));
2020
2018
  } catch {
2021
2019
  i(
2022
2020
  "useEffect: exception validating JWT, invalidating and logging out"
2023
- ), await N(ne);
2021
+ ), await N($);
2024
2022
  }
2025
- })() : (i("useEffect: setting the loading state to false"), o({ type: J, payload: { isLoading: !1 } })), () => {
2026
- l.current = !0;
2023
+ })() : (i("useEffect: setting the loading state to false"), o({ type: Y, payload: { isLoading: !1 } })), () => {
2024
+ c.current = !0;
2027
2025
  };
2028
- }, [s.isLoading, h, N, i]);
2029
- const wt = async (c, w, f) => {
2026
+ }, [s.isLoading, l, N, i]);
2027
+ const wt = async (d, R, f) => {
2030
2028
  const I = Se();
2031
- if (Ie(I), o({ type: J, payload: { isLoading: !0 } }), m(), g(), q(), i("login: Logging in with type: ", f), f === j.CODE) {
2032
- const { code_verifier: bt, code_challenge: It } = await Dn(), ve = await gr({
2029
+ if (be(I), o({ type: Y, payload: { isLoading: !0 } }), y(), m(), z(), i("login: Logging in with type: ", f), f === F.CODE) {
2030
+ const { code_verifier: bt, code_challenge: It } = await Dn(), _e = await wr({
2033
2031
  nonce: I,
2034
2032
  clientId: n,
2035
2033
  code_challenge: It
2036
2034
  });
2037
- if (ve.status) {
2038
- const G = await Je({
2039
- username: c,
2040
- password: w,
2035
+ if (_e.status) {
2036
+ const J = await Je({
2037
+ username: d,
2038
+ password: R,
2041
2039
  clientId: n,
2042
2040
  sessionExpiration: t,
2043
2041
  nonce: I,
2044
2042
  type: f,
2045
- code: ve.code,
2043
+ code: _e.code,
2046
2044
  code_verifier: bt,
2047
2045
  domain: r,
2048
- fingerprint: y.current
2046
+ fingerprint: g.current
2049
2047
  });
2050
- return G.status ? (p(G.idToken), d(G.accessToken), B(G.refreshToken), o({
2051
- type: Y,
2048
+ return J.status ? (h(J.idToken), u(J.accessToken), q(J.refreshToken), o({
2049
+ type: V,
2052
2050
  payload: {
2053
2051
  authenticationType: f,
2054
2052
  user: {
2055
- userId: G.userId,
2056
- username: c
2053
+ userId: J.userId,
2054
+ username: d
2057
2055
  }
2058
2056
  }
2059
2057
  }), !0) : (U(re), !1);
2060
2058
  }
2061
2059
  return !1;
2062
2060
  }
2063
- const M = await Je({
2064
- username: c,
2065
- password: w,
2061
+ const G = await Je({
2062
+ username: d,
2063
+ password: R,
2066
2064
  clientId: n,
2067
2065
  sessionExpiration: t,
2068
2066
  nonce: I,
2069
2067
  type: f,
2070
2068
  domain: r,
2071
- fingerprint: y.current
2069
+ fingerprint: g.current
2072
2070
  });
2073
- return M.status ? (p(M.idToken), d(M.accessToken), B(M.refreshToken), o({
2074
- type: Y,
2071
+ return G.status ? (h(G.idToken), u(G.accessToken), q(G.refreshToken), o({
2072
+ type: V,
2075
2073
  payload: {
2076
2074
  authenticationType: f,
2077
2075
  user: {
2078
- userId: M.userId,
2079
- username: c
2076
+ userId: G.userId,
2077
+ username: d
2080
2078
  }
2081
2079
  }
2082
2080
  }), !0) : (U(re), !1);
2083
- }, Et = async (c) => {
2084
- c == null || c.preventDefault(), await N(dr);
2081
+ }, Et = async (d) => {
2082
+ d?.preventDefault(), await N(xn);
2085
2083
  }, St = async () => {
2086
- const { isAuthenticated: c, user: w } = s;
2084
+ const { isAuthenticated: d, user: R } = s;
2087
2085
  try {
2088
- if (c && w && w.userId) {
2089
- if (u) {
2086
+ if (d && R && R.userId) {
2087
+ if (p) {
2090
2088
  i("getAccessToken");
2091
- const I = await x(u);
2092
- if (I && I.payload[T.USER_ID_KEY] !== "")
2093
- return u;
2089
+ const I = await M(p);
2090
+ if (I && I.payload[A.USER_ID_KEY] !== "")
2091
+ return p;
2094
2092
  }
2095
- i("getAccessToken: invalid access token, refreshing it");
2093
+ i("getAccessToken: invalid access token, trying to refresh it");
2096
2094
  const f = await mt.refreshtoken({
2097
2095
  clientId: n,
2098
- userId: w.userId,
2096
+ userId: R.userId,
2099
2097
  nonce: gt,
2100
2098
  domain: r
2101
2099
  });
2102
- return f.status && f.status === "success" ? (d(f.newAccessToken), B(f.newRefreshToken), f.newAccessToken) : (i("getAccessToken: invalid refresh token, re-authenticating user"), await N(Ae), "");
2100
+ return f.status && f.status === "success" ? (u(f.newAccessToken), q(f.newRefreshToken), f.newAccessToken) : (i(
2101
+ "getAccessToken: invalid refresh token, need to re-authenticate"
2102
+ ), await N($), "");
2103
2103
  }
2104
2104
  return i(
2105
2105
  "getAccessToken: user is not authenticated, cannot get access token"
2106
- ), await N(Ae), "";
2106
+ ), await N($), "";
2107
2107
  } catch {
2108
2108
  return i(
2109
2109
  "getAccessToken: exception occurred, invalidating and logging out"
2110
- ), await N(Ae), "";
2110
+ ), await N(Mn), "";
2111
2111
  }
2112
2112
  }, At = () => {
2113
- if (s.isAuthenticated && h)
2114
- return h;
2113
+ if (s.isAuthenticated && l)
2114
+ return l;
2115
2115
  }, Tt = async () => {
2116
- const { user: c } = s;
2117
- let w = await H({
2118
- accessToken: u,
2116
+ const { user: d } = s;
2117
+ let R = await L({
2118
+ accessToken: p,
2119
2119
  clientId: n,
2120
- type: K.GET_REGISTRATION_OPTIONS,
2120
+ type: H.GET_REGISTRATION_OPTIONS,
2121
2121
  params: {
2122
2122
  clientId: n,
2123
- id: c == null ? void 0 : c.userId,
2124
- username: c == null ? void 0 : c.username
2123
+ id: d?.userId,
2124
+ username: d?.username
2125
2125
  }
2126
2126
  });
2127
- if (w.status)
2127
+ if (R.status)
2128
2128
  try {
2129
- const f = await Kt(w.data);
2130
- w = await H({
2131
- accessToken: u,
2129
+ const f = await Kt(R.data);
2130
+ R = await L({
2131
+ accessToken: p,
2132
2132
  clientId: n,
2133
- type: K.VERIFY_REGISTRATION,
2133
+ type: H.VERIFY_REGISTRATION,
2134
2134
  params: {
2135
2135
  clientId: n,
2136
- id: c == null ? void 0 : c.userId,
2137
- username: c == null ? void 0 : c.username,
2136
+ id: d?.userId,
2137
+ username: d?.username,
2138
2138
  registration: f
2139
2139
  }
2140
2140
  });
2141
2141
  } catch {
2142
- return await H({
2143
- accessToken: u,
2142
+ return await L({
2143
+ accessToken: p,
2144
2144
  clientId: n,
2145
- type: K.VERIFY_REGISTRATION,
2145
+ type: H.VERIFY_REGISTRATION,
2146
2146
  params: {
2147
2147
  clientId: n,
2148
- id: c == null ? void 0 : c.userId,
2149
- username: c == null ? void 0 : c.username,
2148
+ id: d?.userId,
2149
+ username: d?.username,
2150
2150
  registration: {}
2151
2151
  }
2152
2152
  }), !1;
2153
2153
  }
2154
2154
  }, Rt = async () => {
2155
- const c = Se();
2156
- Ie(c), o({ type: J, payload: { isLoading: !0 } }), m(), g(), q(), i("loginWithPasskey");
2157
- const w = Se();
2158
- let f = await H({
2159
- accessToken: u,
2155
+ const d = Se();
2156
+ be(d), o({ type: Y, payload: { isLoading: !0 } }), y(), m(), z(), i("loginWithPasskey");
2157
+ const R = Se();
2158
+ let f = await L({
2159
+ accessToken: p,
2160
2160
  clientId: n,
2161
- type: K.GET_AUTHENTICATION_OPTIONS,
2161
+ type: H.GET_AUTHENTICATION_OPTIONS,
2162
2162
  params: {
2163
- id: w,
2163
+ id: R,
2164
2164
  clientId: n
2165
2165
  }
2166
2166
  });
2167
2167
  if (f.status)
2168
2168
  try {
2169
2169
  const I = await Wt(f.data);
2170
- return f = await H({
2171
- accessToken: u,
2170
+ return f = await L({
2171
+ accessToken: p,
2172
2172
  clientId: n,
2173
- type: K.VERIFY_AUTHENTICATION,
2173
+ type: H.VERIFY_AUTHENTICATION,
2174
2174
  params: {
2175
2175
  clientId: n,
2176
- id: w,
2176
+ id: R,
2177
2177
  authentication: I,
2178
- nonce: c,
2178
+ nonce: d,
2179
2179
  domain: r,
2180
- fingerprint: y.current
2180
+ fingerprint: g.current
2181
2181
  }
2182
- }), f.data.status === "success" ? (p(f.data.idToken), d(f.data.accessToken), B(f.data.refreshToken), o({
2183
- type: Y,
2182
+ }), f.data.status === "success" ? (h(f.data.idToken), u(f.data.accessToken), q(f.data.refreshToken), o({
2183
+ type: V,
2184
2184
  payload: {
2185
- authenticationType: j.PASSKEY,
2185
+ authenticationType: F.PASSKEY,
2186
2186
  user: {
2187
2187
  userId: f.data.userId,
2188
2188
  username: f.data.username
@@ -2190,21 +2190,21 @@ const Er = (e) => W(
2190
2190
  }
2191
2191
  }), !0) : (U(re), !1);
2192
2192
  } catch {
2193
- return await H({
2194
- accessToken: u,
2193
+ return await L({
2194
+ accessToken: p,
2195
2195
  clientId: n,
2196
- type: K.VERIFY_AUTHENTICATION,
2196
+ type: H.VERIFY_AUTHENTICATION,
2197
2197
  params: {
2198
2198
  clientId: n,
2199
- id: w,
2199
+ id: R,
2200
2200
  authentication: {},
2201
- nonce: c,
2201
+ nonce: d,
2202
2202
  domain: r
2203
2203
  }
2204
2204
  }), U(re), !1;
2205
2205
  }
2206
2206
  };
2207
- return /* @__PURE__ */ Pe(Sr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ Pe(
2207
+ return /* @__PURE__ */ ve(Tr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ve(
2208
2208
  yt.Provider,
2209
2209
  {
2210
2210
  value: {
@@ -2219,10 +2219,10 @@ const Er = (e) => W(
2219
2219
  children: e
2220
2220
  }
2221
2221
  ) });
2222
- }, Nr = (e = yt) => Nt(e);
2222
+ }, Ur = (e = yt) => Nt(e);
2223
2223
  export {
2224
- j as AUTH_TYPES,
2225
- Or as AuthProvider,
2226
- Cr as isGranted,
2227
- Nr as useAuth
2224
+ F as AUTH_TYPES,
2225
+ Dr as AuthProvider,
2226
+ Nr as isGranted,
2227
+ Ur as useAuth
2228
2228
  };