@versini/auth-provider 7.4.2 → 7.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +303 -312
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- var At = Object.defineProperty;
2
- var Tt = (e, t, r) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var X = (e, t, r) => Tt(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsx as Oe } from "react/jsx-runtime";
5
- import Rt, { useSyncExternalStore as _t, useCallback as D, useEffect as Je, createContext as It, useReducer as bt, useRef as kt, useContext as Ot } from "react";
1
+ var St = Object.defineProperty;
2
+ var At = (e, t, r) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var X = (e, t, r) => At(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as ke } from "react/jsx-runtime";
5
+ import Tt, { useSyncExternalStore as Rt, useCallback as D, useEffect as $e, createContext as _t, useReducer as It, useRef as bt, useContext as kt } from "react";
6
6
  /*!
7
- @versini/auth-provider v7.4.2
7
+ @versini/auth-provider v7.4.3
8
8
  © 2025 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "7.4.2",
13
- buildTime: "02/09/2025 06:14 PM EST",
12
+ version: "7.4.3",
13
+ buildTime: "02/09/2025 06:40 PM EST",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
@@ -29,10 +29,10 @@ function oe(e) {
29
29
  o[i] = a.charCodeAt(i);
30
30
  return s;
31
31
  }
32
- function Te() {
32
+ function Ae() {
33
33
  return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
34
34
  }
35
- function Ye(e) {
35
+ function Je(e) {
36
36
  const { id: t } = e;
37
37
  return {
38
38
  ...e,
@@ -40,7 +40,7 @@ function Ye(e) {
40
40
  transports: e.transports
41
41
  };
42
42
  }
43
- function xe(e) {
43
+ function Ye(e) {
44
44
  return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
45
45
  }
46
46
  class S extends Error {
@@ -48,7 +48,7 @@ class S extends Error {
48
48
  super(t, { cause: n }), this.name = a ?? n.name, this.code = r;
49
49
  }
50
50
  }
51
- function vt({ error: e, options: t }) {
51
+ function Ot({ error: e, options: t }) {
52
52
  const { publicKey: r } = t;
53
53
  if (!r)
54
54
  throw Error("options was missing required publicKey property");
@@ -97,7 +97,7 @@ function vt({ error: e, options: t }) {
97
97
  });
98
98
  if (e.name === "SecurityError") {
99
99
  const n = window.location.hostname;
100
- if (xe(n)) {
100
+ if (Ye(n)) {
101
101
  if (r.rp.id !== n)
102
102
  return new S({
103
103
  message: `The RP ID "${r.rp.id}" is invalid for this domain`,
@@ -125,7 +125,7 @@ function vt({ error: e, options: t }) {
125
125
  }
126
126
  return e;
127
127
  }
128
- class Pt {
128
+ class vt {
129
129
  createNewAbortSignal() {
130
130
  if (this.controller) {
131
131
  const r = new Error("Cancelling existing WebAuthn API call for new one");
@@ -141,13 +141,13 @@ class Pt {
141
141
  }
142
142
  }
143
143
  }
144
- const Me = new Pt(), Ct = ["cross-platform", "platform"];
145
- function Ge(e) {
146
- if (e && !(Ct.indexOf(e) < 0))
144
+ const xe = new vt(), Pt = ["cross-platform", "platform"];
145
+ function Me(e) {
146
+ if (e && !(Pt.indexOf(e) < 0))
147
147
  return e;
148
148
  }
149
- async function Nt(e) {
150
- if (!Te())
149
+ async function Ct(e) {
150
+ if (!Ae())
151
151
  throw new Error("WebAuthn is not supported in this browser");
152
152
  const r = { publicKey: {
153
153
  ...e,
@@ -156,14 +156,14 @@ async function Nt(e) {
156
156
  ...e.user,
157
157
  id: oe(e.user.id)
158
158
  },
159
- excludeCredentials: e.excludeCredentials?.map(Ye)
159
+ excludeCredentials: e.excludeCredentials?.map(Je)
160
160
  } };
161
- r.signal = Me.createNewAbortSignal();
161
+ r.signal = xe.createNewAbortSignal();
162
162
  let n;
163
163
  try {
164
164
  n = await navigator.credentials.create(r);
165
165
  } catch (l) {
166
- throw vt({ error: l, options: r });
166
+ throw Ot({ error: l, options: r });
167
167
  }
168
168
  if (!n)
169
169
  throw new Error("Registration was not completed");
@@ -175,7 +175,7 @@ async function Nt(e) {
175
175
  try {
176
176
  h = o.getPublicKeyAlgorithm();
177
177
  } catch (l) {
178
- ye("getPublicKeyAlgorithm()", l);
178
+ pe("getPublicKeyAlgorithm()", l);
179
179
  }
180
180
  let y;
181
181
  if (typeof o.getPublicKey == "function")
@@ -183,14 +183,14 @@ async function Nt(e) {
183
183
  const l = o.getPublicKey();
184
184
  l !== null && (y = k(l));
185
185
  } catch (l) {
186
- ye("getPublicKey()", l);
186
+ pe("getPublicKey()", l);
187
187
  }
188
188
  let p;
189
189
  if (typeof o.getAuthenticatorData == "function")
190
190
  try {
191
191
  p = k(o.getAuthenticatorData());
192
192
  } catch (l) {
193
- ye("getAuthenticatorData()", l);
193
+ pe("getAuthenticatorData()", l);
194
194
  }
195
195
  return {
196
196
  id: a,
@@ -205,20 +205,20 @@ async function Nt(e) {
205
205
  },
206
206
  type: i,
207
207
  clientExtensionResults: n.getClientExtensionResults(),
208
- authenticatorAttachment: Ge(n.authenticatorAttachment)
208
+ authenticatorAttachment: Me(n.authenticatorAttachment)
209
209
  };
210
210
  }
211
- function ye(e, t) {
211
+ function pe(e, t) {
212
212
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
213
213
  `, t);
214
214
  }
215
- function Kt() {
216
- if (!Te())
215
+ function Nt() {
216
+ if (!Ae())
217
217
  return new Promise((t) => t(!1));
218
218
  const e = window.PublicKeyCredential;
219
219
  return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
220
220
  }
221
- function Dt({ error: e, options: t }) {
221
+ function Kt({ error: e, options: t }) {
222
222
  const { publicKey: r } = t;
223
223
  if (!r)
224
224
  throw Error("options was missing required publicKey property");
@@ -238,7 +238,7 @@ function Dt({ error: e, options: t }) {
238
238
  });
239
239
  if (e.name === "SecurityError") {
240
240
  const n = window.location.hostname;
241
- if (xe(n)) {
241
+ if (Ye(n)) {
242
242
  if (r.rpId !== n)
243
243
  return new S({
244
244
  message: `The RP ID "${r.rpId}" is invalid for this domain`,
@@ -259,29 +259,29 @@ function Dt({ error: e, options: t }) {
259
259
  }
260
260
  return e;
261
261
  }
262
- async function Ut(e, t = !1) {
263
- if (!Te())
262
+ async function Dt(e, t = !1) {
263
+ if (!Ae())
264
264
  throw new Error("WebAuthn is not supported in this browser");
265
265
  let r;
266
- e.allowCredentials?.length !== 0 && (r = e.allowCredentials?.map(Ye));
266
+ e.allowCredentials?.length !== 0 && (r = e.allowCredentials?.map(Je));
267
267
  const n = {
268
268
  ...e,
269
269
  challenge: oe(e.challenge),
270
270
  allowCredentials: r
271
271
  }, a = {};
272
272
  if (t) {
273
- if (!await Kt())
273
+ if (!await Nt())
274
274
  throw Error("Browser does not support WebAuthn autofill");
275
275
  if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
276
276
  throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
277
277
  a.mediation = "conditional", n.allowCredentials = [];
278
278
  }
279
- a.publicKey = n, a.signal = Me.createNewAbortSignal();
279
+ a.publicKey = n, a.signal = xe.createNewAbortSignal();
280
280
  let s;
281
281
  try {
282
282
  s = await navigator.credentials.get(a);
283
283
  } catch (p) {
284
- throw Dt({ error: p, options: a });
284
+ throw Kt({ error: p, options: a });
285
285
  }
286
286
  if (!s)
287
287
  throw new Error("Authentication was not completed");
@@ -298,7 +298,7 @@ async function Ut(e, t = !1) {
298
298
  },
299
299
  type: h,
300
300
  clientExtensionResults: s.getClientExtensionResults(),
301
- authenticatorAttachment: Ge(s.authenticatorAttachment)
301
+ authenticatorAttachment: Me(s.authenticatorAttachment)
302
302
  };
303
303
  }
304
304
  /*!
@@ -308,7 +308,7 @@ async function Ut(e, t = !1) {
308
308
  try {
309
309
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
310
310
  version: "4.2.0",
311
- buildTime: "02/09/2025 06:14 PM EST",
311
+ buildTime: "02/09/2025 06:40 PM EST",
312
312
  homepage: "https://github.com/aversini/auth-client",
313
313
  license: "MIT"
314
314
  });
@@ -321,7 +321,7 @@ const M = {
321
321
  CODE: "code",
322
322
  REFRESH_TOKEN: "refresh_token",
323
323
  PASSKEY: "passkey"
324
- }, Ve = {
324
+ }, Ge = {
325
325
  CLIENT_ID: "X-Auth-ClientId"
326
326
  }, f = {
327
327
  ALG: "RS256",
@@ -336,7 +336,7 @@ const M = {
336
336
  SCOPES_KEY: "scopes",
337
337
  CLIENT_ID_KEY: "aud",
338
338
  ISSUER: "gizmette.com"
339
- }, Lt = `-----BEGIN PUBLIC KEY-----
339
+ }, Ut = `-----BEGIN PUBLIC KEY-----
340
340
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
341
341
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
342
342
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -344,20 +344,20 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
344
344
  l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
345
345
  sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
346
346
  awIDAQAB
347
- -----END PUBLIC KEY-----`, ue = {
347
+ -----END PUBLIC KEY-----`, ce = {
348
348
  CODE: "code",
349
349
  LOGOUT: "logout",
350
350
  LOGIN: "login",
351
351
  REFRESH: "refresh"
352
- }, le = crypto, je = (e) => e instanceof CryptoKey, Z = new TextEncoder(), q = new TextDecoder();
353
- function Ht(...e) {
352
+ }, ue = crypto, Ve = (e) => e instanceof CryptoKey, Z = new TextEncoder(), q = new TextDecoder();
353
+ function Lt(...e) {
354
354
  const t = e.reduce((a, { length: s }) => a + s, 0), r = new Uint8Array(t);
355
355
  let n = 0;
356
356
  for (const a of e)
357
357
  r.set(a, n), n += a.length;
358
358
  return r;
359
359
  }
360
- const Wt = (e) => {
360
+ const Ht = (e) => {
361
361
  const t = atob(e), r = new Uint8Array(t.length);
362
362
  for (let n = 0; n < t.length; n++)
363
363
  r[n] = t.charCodeAt(n);
@@ -366,7 +366,7 @@ const Wt = (e) => {
366
366
  let t = e;
367
367
  t instanceof Uint8Array && (t = q.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
368
368
  try {
369
- return Wt(t);
369
+ return Ht(t);
370
370
  } catch {
371
371
  throw new TypeError("The input to be decoded is not correctly encoded.");
372
372
  }
@@ -384,36 +384,36 @@ class _ extends A {
384
384
  }
385
385
  }
386
386
  _.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
387
- class Se extends A {
387
+ class we extends A {
388
388
  constructor(t, r, n = "unspecified", a = "unspecified") {
389
389
  super(t, { cause: { claim: n, reason: a, payload: r } }), this.code = "ERR_JWT_EXPIRED", this.claim = n, this.reason = a, this.payload = r;
390
390
  }
391
391
  }
392
- Se.code = "ERR_JWT_EXPIRED";
393
- class Fe extends A {
392
+ we.code = "ERR_JWT_EXPIRED";
393
+ class je extends A {
394
394
  constructor() {
395
395
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
396
396
  }
397
397
  }
398
- Fe.code = "ERR_JOSE_ALG_NOT_ALLOWED";
398
+ je.code = "ERR_JOSE_ALG_NOT_ALLOWED";
399
399
  class I extends A {
400
400
  constructor() {
401
401
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
402
402
  }
403
403
  }
404
404
  I.code = "ERR_JOSE_NOT_SUPPORTED";
405
- class $t extends A {
405
+ class Wt extends A {
406
406
  constructor(t = "decryption operation failed", r) {
407
407
  super(t, r), this.code = "ERR_JWE_DECRYPTION_FAILED";
408
408
  }
409
409
  }
410
- $t.code = "ERR_JWE_DECRYPTION_FAILED";
411
- class Jt extends A {
410
+ Wt.code = "ERR_JWE_DECRYPTION_FAILED";
411
+ class $t extends A {
412
412
  constructor() {
413
413
  super(...arguments), this.code = "ERR_JWE_INVALID";
414
414
  }
415
415
  }
416
- Jt.code = "ERR_JWE_INVALID";
416
+ $t.code = "ERR_JWE_INVALID";
417
417
  class E extends A {
418
418
  constructor() {
419
419
  super(...arguments), this.code = "ERR_JWS_INVALID";
@@ -426,52 +426,52 @@ let b = class extends A {
426
426
  }
427
427
  };
428
428
  b.code = "ERR_JWT_INVALID";
429
- class Yt extends A {
429
+ class Jt extends A {
430
430
  constructor() {
431
431
  super(...arguments), this.code = "ERR_JWK_INVALID";
432
432
  }
433
433
  }
434
- Yt.code = "ERR_JWK_INVALID";
435
- class xt extends A {
434
+ Jt.code = "ERR_JWK_INVALID";
435
+ class Yt extends A {
436
436
  constructor() {
437
437
  super(...arguments), this.code = "ERR_JWKS_INVALID";
438
438
  }
439
439
  }
440
- xt.code = "ERR_JWKS_INVALID";
441
- class Mt extends A {
440
+ Yt.code = "ERR_JWKS_INVALID";
441
+ class xt extends A {
442
442
  constructor(t = "no applicable key found in the JSON Web Key Set", r) {
443
443
  super(t, r), this.code = "ERR_JWKS_NO_MATCHING_KEY";
444
444
  }
445
445
  }
446
- Mt.code = "ERR_JWKS_NO_MATCHING_KEY";
447
- class Gt extends A {
446
+ xt.code = "ERR_JWKS_NO_MATCHING_KEY";
447
+ class Mt extends A {
448
448
  constructor(t = "multiple matching keys found in the JSON Web Key Set", r) {
449
449
  super(t, r), this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
450
450
  }
451
451
  }
452
- Gt.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
453
- class Vt extends A {
452
+ Mt.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
453
+ class Gt extends A {
454
454
  constructor(t = "request timed out", r) {
455
455
  super(t, r), this.code = "ERR_JWKS_TIMEOUT";
456
456
  }
457
457
  }
458
- Vt.code = "ERR_JWKS_TIMEOUT";
459
- class Be extends A {
458
+ Gt.code = "ERR_JWKS_TIMEOUT";
459
+ class Fe extends A {
460
460
  constructor(t = "signature verification failed", r) {
461
461
  super(t, r), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
462
462
  }
463
463
  }
464
- Be.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
464
+ Fe.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
465
465
  function v(e, t = "algorithm.name") {
466
466
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
467
467
  }
468
468
  function ee(e, t) {
469
469
  return e.name === t;
470
470
  }
471
- function fe(e) {
471
+ function ye(e) {
472
472
  return parseInt(e.name.slice(4), 10);
473
473
  }
474
- function jt(e) {
474
+ function Vt(e) {
475
475
  switch (e) {
476
476
  case "ES256":
477
477
  return "P-256";
@@ -483,7 +483,7 @@ function jt(e) {
483
483
  throw new Error("unreachable");
484
484
  }
485
485
  }
486
- function Ft(e, t) {
486
+ function jt(e, t) {
487
487
  if (t.length && !t.some((r) => e.usages.includes(r))) {
488
488
  let r = "CryptoKey does not support this operation, its usages must include ";
489
489
  if (t.length > 2) {
@@ -493,7 +493,7 @@ function Ft(e, t) {
493
493
  throw new TypeError(r);
494
494
  }
495
495
  }
496
- function Bt(e, t, ...r) {
496
+ function Ft(e, t, ...r) {
497
497
  switch (t) {
498
498
  case "HS256":
499
499
  case "HS384":
@@ -501,7 +501,7 @@ function Bt(e, t, ...r) {
501
501
  if (!ee(e.algorithm, "HMAC"))
502
502
  throw v("HMAC");
503
503
  const n = parseInt(t.slice(2), 10);
504
- if (fe(e.algorithm.hash) !== n)
504
+ if (ye(e.algorithm.hash) !== n)
505
505
  throw v(`SHA-${n}`, "algorithm.hash");
506
506
  break;
507
507
  }
@@ -511,7 +511,7 @@ function Bt(e, t, ...r) {
511
511
  if (!ee(e.algorithm, "RSASSA-PKCS1-v1_5"))
512
512
  throw v("RSASSA-PKCS1-v1_5");
513
513
  const n = parseInt(t.slice(2), 10);
514
- if (fe(e.algorithm.hash) !== n)
514
+ if (ye(e.algorithm.hash) !== n)
515
515
  throw v(`SHA-${n}`, "algorithm.hash");
516
516
  break;
517
517
  }
@@ -521,7 +521,7 @@ function Bt(e, t, ...r) {
521
521
  if (!ee(e.algorithm, "RSA-PSS"))
522
522
  throw v("RSA-PSS");
523
523
  const n = parseInt(t.slice(2), 10);
524
- if (fe(e.algorithm.hash) !== n)
524
+ if (ye(e.algorithm.hash) !== n)
525
525
  throw v(`SHA-${n}`, "algorithm.hash");
526
526
  break;
527
527
  }
@@ -535,7 +535,7 @@ function Bt(e, t, ...r) {
535
535
  case "ES512": {
536
536
  if (!ee(e.algorithm, "ECDSA"))
537
537
  throw v("ECDSA");
538
- const n = jt(t);
538
+ const n = Vt(t);
539
539
  if (e.algorithm.namedCurve !== n)
540
540
  throw v(n, "algorithm.namedCurve");
541
541
  break;
@@ -543,9 +543,9 @@ function Bt(e, t, ...r) {
543
543
  default:
544
544
  throw new TypeError("CryptoKey does not support this operation");
545
545
  }
546
- Ft(e, r);
546
+ jt(e, r);
547
547
  }
548
- function qe(e, t, ...r) {
548
+ function Be(e, t, ...r) {
549
549
  var n;
550
550
  if (r = r.filter(Boolean), r.length > 2) {
551
551
  const a = r.pop();
@@ -553,11 +553,11 @@ function qe(e, t, ...r) {
553
553
  } else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
554
554
  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;
555
555
  }
556
- const ve = (e, ...t) => qe("Key must be ", e, ...t);
557
- function ze(e, t, ...r) {
558
- return qe(`Key for the ${e} algorithm must be `, t, ...r);
556
+ const Oe = (e, ...t) => Be("Key must be ", e, ...t);
557
+ function qe(e, t, ...r) {
558
+ return Be(`Key for the ${e} algorithm must be `, t, ...r);
559
559
  }
560
- const Qe = (e) => je(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", se = ["CryptoKey"], qt = (...e) => {
560
+ const ze = (e) => Ve(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", se = ["CryptoKey"], Bt = (...e) => {
561
561
  const t = e.filter(Boolean);
562
562
  if (t.length === 0 || t.length === 1)
563
563
  return !0;
@@ -576,11 +576,11 @@ const Qe = (e) => je(e) ? !0 : e?.[Symbol.toStringTag] === "KeyObject", se = ["C
576
576
  }
577
577
  return !0;
578
578
  };
579
- function zt(e) {
579
+ function qt(e) {
580
580
  return typeof e == "object" && e !== null;
581
581
  }
582
582
  function G(e) {
583
- if (!zt(e) || Object.prototype.toString.call(e) !== "[object Object]")
583
+ if (!qt(e) || Object.prototype.toString.call(e) !== "[object Object]")
584
584
  return !1;
585
585
  if (Object.getPrototypeOf(e) === null)
586
586
  return !0;
@@ -589,7 +589,7 @@ function G(e) {
589
589
  t = Object.getPrototypeOf(t);
590
590
  return Object.getPrototypeOf(e) === t;
591
591
  }
592
- const Qt = (e, t) => {
592
+ const zt = (e, t) => {
593
593
  if (e.startsWith("RS") || e.startsWith("PS")) {
594
594
  const { modulusLength: r } = t.algorithm;
595
595
  if (typeof r != "number" || r < 2048)
@@ -599,16 +599,16 @@ const Qt = (e, t) => {
599
599
  function j(e) {
600
600
  return G(e) && typeof e.kty == "string";
601
601
  }
602
- function Xt(e) {
602
+ function Qt(e) {
603
603
  return e.kty !== "oct" && typeof e.d == "string";
604
604
  }
605
- function Zt(e) {
605
+ function Xt(e) {
606
606
  return e.kty !== "oct" && typeof e.d > "u";
607
607
  }
608
- function er(e) {
608
+ function Zt(e) {
609
609
  return j(e) && e.kty === "oct" && typeof e.k == "string";
610
610
  }
611
- function tr(e) {
611
+ function er(e) {
612
612
  let t, r;
613
613
  switch (e.kty) {
614
614
  case "RSA": {
@@ -680,43 +680,43 @@ function tr(e) {
680
680
  }
681
681
  return { algorithm: t, keyUsages: r };
682
682
  }
683
- const Xe = async (e) => {
683
+ const Qe = async (e) => {
684
684
  if (!e.alg)
685
685
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
686
- const { algorithm: t, keyUsages: r } = tr(e), n = [
686
+ const { algorithm: t, keyUsages: r } = er(e), n = [
687
687
  t,
688
688
  e.ext ?? !1,
689
689
  e.key_ops ?? r
690
690
  ], a = { ...e };
691
- return delete a.alg, delete a.use, le.subtle.importKey("jwk", a, ...n);
692
- }, Ze = (e) => C(e);
691
+ return delete a.alg, delete a.use, ue.subtle.importKey("jwk", a, ...n);
692
+ }, Xe = (e) => C(e);
693
693
  let L, H;
694
- const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", ie = async (e, t, r, n, a = !1) => {
694
+ const Ze = (e) => e?.[Symbol.toStringTag] === "KeyObject", ie = async (e, t, r, n, a = !1) => {
695
695
  let s = e.get(t);
696
696
  if (s != null && s[n])
697
697
  return s[n];
698
- const o = await Xe({ ...r, alg: n });
698
+ const o = await Qe({ ...r, alg: n });
699
699
  return a && Object.freeze(t), s ? s[n] = o : e.set(t, { [n]: o }), o;
700
- }, rr = (e, t) => {
701
- if (et(e)) {
700
+ }, tr = (e, t) => {
701
+ if (Ze(e)) {
702
702
  let r = e.export({ format: "jwk" });
703
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Ze(r.k) : (H || (H = /* @__PURE__ */ new WeakMap()), ie(H, e, r, t));
703
+ return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Xe(r.k) : (H || (H = /* @__PURE__ */ new WeakMap()), ie(H, e, r, t));
704
704
  }
705
705
  return j(e) ? e.k ? C(e.k) : (H || (H = /* @__PURE__ */ new WeakMap()), ie(H, e, e, t, !0)) : e;
706
- }, nr = (e, t) => {
707
- if (et(e)) {
706
+ }, rr = (e, t) => {
707
+ if (Ze(e)) {
708
708
  let r = e.export({ format: "jwk" });
709
- return r.k ? Ze(r.k) : (L || (L = /* @__PURE__ */ new WeakMap()), ie(L, e, r, t));
709
+ return r.k ? Xe(r.k) : (L || (L = /* @__PURE__ */ new WeakMap()), ie(L, e, r, t));
710
710
  }
711
711
  return j(e) ? e.k ? C(e.k) : (L || (L = /* @__PURE__ */ new WeakMap()), ie(L, e, e, t, !0)) : e;
712
- }, ar = { normalizePublicKey: rr, normalizePrivateKey: nr }, P = (e, t, r = 0) => {
712
+ }, nr = { normalizePublicKey: tr, normalizePrivateKey: rr }, P = (e, t, r = 0) => {
713
713
  r === 0 && (t.unshift(t.length), t.unshift(6));
714
714
  const n = e.indexOf(t[0], r);
715
715
  if (n === -1)
716
716
  return !1;
717
717
  const a = e.subarray(n, n + t.length);
718
718
  return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || P(e, t, n + 1);
719
- }, Pe = (e) => {
719
+ }, ve = (e) => {
720
720
  switch (!0) {
721
721
  case P(e, [42, 134, 72, 206, 61, 3, 1, 7]):
722
722
  return "P-256";
@@ -735,7 +735,7 @@ const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", ie = async (e, t, r,
735
735
  default:
736
736
  throw new I("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
737
737
  }
738
- }, or = async (e, t, r, n, a) => {
738
+ }, ar = async (e, t, r, n, a) => {
739
739
  let s, o;
740
740
  const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
741
741
  switch (n) {
@@ -771,24 +771,24 @@ const et = (e) => e?.[Symbol.toStringTag] === "KeyObject", ie = async (e, t, r,
771
771
  case "ECDH-ES+A128KW":
772
772
  case "ECDH-ES+A192KW":
773
773
  case "ECDH-ES+A256KW": {
774
- const c = Pe(i);
774
+ const c = ve(i);
775
775
  s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
776
776
  break;
777
777
  }
778
778
  case "EdDSA":
779
- s = { name: Pe(i) }, o = ["verify"];
779
+ s = { name: ve(i) }, o = ["verify"];
780
780
  break;
781
781
  default:
782
782
  throw new I('Invalid or unsupported "alg" (Algorithm) value');
783
783
  }
784
- return le.subtle.importKey(t, i, s, !1, o);
785
- }, sr = (e, t, r) => or(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
786
- async function ir(e, t, r) {
784
+ return ue.subtle.importKey(t, i, s, !1, o);
785
+ }, or = (e, t, r) => ar(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
786
+ async function sr(e, t, r) {
787
787
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
788
788
  throw new TypeError('"spki" must be SPKI formatted string');
789
- return sr(e, t);
789
+ return or(e, t);
790
790
  }
791
- async function cr(e, t) {
791
+ async function ir(e, t) {
792
792
  if (!G(e))
793
793
  throw new TypeError("JWK must be an object");
794
794
  switch (t || (t = e.alg), e.kty) {
@@ -801,12 +801,12 @@ async function cr(e, t) {
801
801
  throw new I('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
802
802
  case "EC":
803
803
  case "OKP":
804
- return Xe({ ...e, alg: t });
804
+ return Qe({ ...e, alg: t });
805
805
  default:
806
806
  throw new I('Unsupported "kty" (Key Type) Parameter value');
807
807
  }
808
808
  }
809
- const x = (e) => e?.[Symbol.toStringTag], Ae = (e, t, r) => {
809
+ const x = (e) => e?.[Symbol.toStringTag], Se = (e, t, r) => {
810
810
  var n, a;
811
811
  if (t.use !== void 0 && t.use !== "sig")
812
812
  throw new TypeError("Invalid key for this operation, when present its use must be sig");
@@ -815,32 +815,32 @@ const x = (e) => e?.[Symbol.toStringTag], Ae = (e, t, r) => {
815
815
  if (t.alg !== void 0 && t.alg !== e)
816
816
  throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`);
817
817
  return !0;
818
- }, ur = (e, t, r, n) => {
818
+ }, cr = (e, t, r, n) => {
819
819
  if (!(t instanceof Uint8Array)) {
820
820
  if (n && j(t)) {
821
- if (er(t) && Ae(e, t, r))
821
+ if (Zt(t) && Se(e, t, r))
822
822
  return;
823
823
  throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
824
824
  }
825
- if (!Qe(t))
826
- throw new TypeError(ze(e, t, ...se, "Uint8Array", n ? "JSON Web Key" : null));
825
+ if (!ze(t))
826
+ throw new TypeError(qe(e, t, ...se, "Uint8Array", n ? "JSON Web Key" : null));
827
827
  if (t.type !== "secret")
828
828
  throw new TypeError(`${x(t)} instances for symmetric algorithms must be of type "secret"`);
829
829
  }
830
- }, lr = (e, t, r, n) => {
830
+ }, ur = (e, t, r, n) => {
831
831
  if (n && j(t))
832
832
  switch (r) {
833
833
  case "sign":
834
- if (Xt(t) && Ae(e, t, r))
834
+ if (Qt(t) && Se(e, t, r))
835
835
  return;
836
836
  throw new TypeError("JSON Web Key for this operation be a private JWK");
837
837
  case "verify":
838
- if (Zt(t) && Ae(e, t, r))
838
+ if (Xt(t) && Se(e, t, r))
839
839
  return;
840
840
  throw new TypeError("JSON Web Key for this operation be a public JWK");
841
841
  }
842
- if (!Qe(t))
843
- throw new TypeError(ze(e, t, ...se, n ? "JSON Web Key" : null));
842
+ if (!ze(t))
843
+ throw new TypeError(qe(e, t, ...se, n ? "JSON Web Key" : null));
844
844
  if (t.type === "secret")
845
845
  throw new TypeError(`${x(t)} instances for asymmetric algorithms must not be of type "secret"`);
846
846
  if (r === "sign" && t.type === "public")
@@ -852,12 +852,12 @@ const x = (e) => e?.[Symbol.toStringTag], Ae = (e, t, r) => {
852
852
  if (t.algorithm && r === "encrypt" && t.type === "private")
853
853
  throw new TypeError(`${x(t)} instances for asymmetric algorithm encryption must be of type "public"`);
854
854
  };
855
- function tt(e, t, r, n) {
856
- t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ? ur(t, r, n, e) : lr(t, r, n, e);
855
+ function et(e, t, r, n) {
856
+ t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ? cr(t, r, n, e) : ur(t, r, n, e);
857
857
  }
858
- tt.bind(void 0, !1);
859
- const Ce = tt.bind(void 0, !0);
860
- function dr(e, t, r, n, a) {
858
+ et.bind(void 0, !1);
859
+ const Pe = et.bind(void 0, !0);
860
+ function lr(e, t, r, n, a) {
861
861
  if (a.crit !== void 0 && n?.crit === void 0)
862
862
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
863
863
  if (!n || n.crit === void 0)
@@ -876,13 +876,13 @@ function dr(e, t, r, n, a) {
876
876
  }
877
877
  return new Set(n.crit);
878
878
  }
879
- const hr = (e, t) => {
879
+ const dr = (e, t) => {
880
880
  if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
881
881
  throw new TypeError(`"${e}" option must be an array of strings`);
882
882
  if (t)
883
883
  return new Set(t);
884
884
  };
885
- function pr(e, t) {
885
+ function hr(e, t) {
886
886
  const r = `SHA-${e.slice(-3)}`;
887
887
  switch (e) {
888
888
  case "HS256":
@@ -907,27 +907,27 @@ function pr(e, t) {
907
907
  throw new I(`alg ${e} is not supported either by JOSE or your javascript runtime`);
908
908
  }
909
909
  }
910
- async function yr(e, t, r) {
911
- if (t = await ar.normalizePublicKey(t, e), je(t))
912
- return Bt(t, e, r), t;
910
+ async function pr(e, t, r) {
911
+ if (t = await nr.normalizePublicKey(t, e), Ve(t))
912
+ return Ft(t, e, r), t;
913
913
  if (t instanceof Uint8Array) {
914
914
  if (!e.startsWith("HS"))
915
- throw new TypeError(ve(t, ...se));
916
- return le.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
915
+ throw new TypeError(Oe(t, ...se));
916
+ return ue.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
917
917
  }
918
- throw new TypeError(ve(t, ...se, "Uint8Array", "JSON Web Key"));
918
+ throw new TypeError(Oe(t, ...se, "Uint8Array", "JSON Web Key"));
919
919
  }
920
- const fr = async (e, t, r, n) => {
921
- const a = await yr(e, t, "verify");
922
- Qt(e, a);
923
- const s = pr(e, a.algorithm);
920
+ const yr = async (e, t, r, n) => {
921
+ const a = await pr(e, t, "verify");
922
+ zt(e, a);
923
+ const s = hr(e, a.algorithm);
924
924
  try {
925
- return await le.subtle.verify(s, a, r, n);
925
+ return await ue.subtle.verify(s, a, r, n);
926
926
  } catch {
927
927
  return !1;
928
928
  }
929
929
  };
930
- async function Er(e, t, r) {
930
+ async function fr(e, t, r) {
931
931
  if (!G(e))
932
932
  throw new E("Flattened JWS must be an object");
933
933
  if (e.protected === void 0 && e.header === void 0)
@@ -948,37 +948,37 @@ async function Er(e, t, r) {
948
948
  } catch {
949
949
  throw new E("JWS Protected Header is invalid");
950
950
  }
951
- if (!qt(n, e.header))
951
+ if (!Bt(n, e.header))
952
952
  throw new E("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
953
953
  const a = {
954
954
  ...n,
955
955
  ...e.header
956
- }, s = dr(E, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, n, a);
956
+ }, s = lr(E, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, n, a);
957
957
  let o = !0;
958
958
  if (s.has("b64") && (o = n.b64, typeof o != "boolean"))
959
959
  throw new E('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
960
960
  const { alg: i } = a;
961
961
  if (typeof i != "string" || !i)
962
962
  throw new E('JWS "alg" (Algorithm) Header Parameter missing or invalid');
963
- const c = r && hr("algorithms", r.algorithms);
963
+ const c = r && dr("algorithms", r.algorithms);
964
964
  if (c && !c.has(i))
965
- throw new Fe('"alg" (Algorithm) Header Parameter value not allowed');
965
+ throw new je('"alg" (Algorithm) Header Parameter value not allowed');
966
966
  if (o) {
967
967
  if (typeof e.payload != "string")
968
968
  throw new E("JWS Payload must be a string");
969
969
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
970
970
  throw new E("JWS Payload must be a string or an Uint8Array instance");
971
971
  let h = !1;
972
- typeof t == "function" ? (t = await t(n, e), h = !0, Ce(i, t, "verify"), j(t) && (t = await cr(t, i))) : Ce(i, t, "verify");
973
- const y = Ht(Z.encode(e.protected ?? ""), Z.encode("."), typeof e.payload == "string" ? Z.encode(e.payload) : e.payload);
972
+ typeof t == "function" ? (t = await t(n, e), h = !0, Pe(i, t, "verify"), j(t) && (t = await ir(t, i))) : Pe(i, t, "verify");
973
+ const y = Lt(Z.encode(e.protected ?? ""), Z.encode("."), typeof e.payload == "string" ? Z.encode(e.payload) : e.payload);
974
974
  let p;
975
975
  try {
976
976
  p = C(e.signature);
977
977
  } catch {
978
978
  throw new E("Failed to base64url decode the signature");
979
979
  }
980
- if (!await fr(i, t, p, y))
981
- throw new Be();
980
+ if (!await yr(i, t, p, y))
981
+ throw new Fe();
982
982
  let l;
983
983
  if (o)
984
984
  try {
@@ -990,17 +990,17 @@ async function Er(e, t, r) {
990
990
  const T = { payload: l };
991
991
  return e.protected !== void 0 && (T.protectedHeader = n), e.header !== void 0 && (T.unprotectedHeader = e.header), h ? { ...T, key: t } : T;
992
992
  }
993
- async function gr(e, t, r) {
993
+ async function Er(e, t, r) {
994
994
  if (e instanceof Uint8Array && (e = q.decode(e)), typeof e != "string")
995
995
  throw new E("Compact JWS must be a string or Uint8Array");
996
996
  const { 0: n, 1: a, 2: s, length: o } = e.split(".");
997
997
  if (o !== 3)
998
998
  throw new E("Invalid Compact JWS");
999
- const i = await Er({ payload: a, protected: n, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
999
+ const i = await fr({ payload: a, protected: n, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
1000
1000
  return typeof t == "function" ? { ...c, key: i.key } : c;
1001
1001
  }
1002
- const mr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, nt = rt * 60, Re = nt * 24, wr = Re * 7, Sr = Re * 365.25, Ar = /^(\+|\-)? ?(\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) => {
1003
- const t = Ar.exec(e);
1002
+ const gr = (e) => Math.floor(e.getTime() / 1e3), tt = 60, rt = tt * 60, Te = rt * 24, mr = Te * 7, wr = Te * 365.25, Sr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Ce = (e) => {
1003
+ const t = Sr.exec(e);
1004
1004
  if (!t || t[4] && t[1])
1005
1005
  throw new TypeError("Invalid time period format");
1006
1006
  const r = parseFloat(t[2]), n = t[3].toLowerCase();
@@ -1018,31 +1018,31 @@ const mr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, nt = rt * 60, Re = nt
1018
1018
  case "min":
1019
1019
  case "mins":
1020
1020
  case "m":
1021
- a = Math.round(r * rt);
1021
+ a = Math.round(r * tt);
1022
1022
  break;
1023
1023
  case "hour":
1024
1024
  case "hours":
1025
1025
  case "hr":
1026
1026
  case "hrs":
1027
1027
  case "h":
1028
- a = Math.round(r * nt);
1028
+ a = Math.round(r * rt);
1029
1029
  break;
1030
1030
  case "day":
1031
1031
  case "days":
1032
1032
  case "d":
1033
- a = Math.round(r * Re);
1033
+ a = Math.round(r * Te);
1034
1034
  break;
1035
1035
  case "week":
1036
1036
  case "weeks":
1037
1037
  case "w":
1038
- a = Math.round(r * wr);
1038
+ a = Math.round(r * mr);
1039
1039
  break;
1040
1040
  default:
1041
- a = Math.round(r * Sr);
1041
+ a = Math.round(r * wr);
1042
1042
  break;
1043
1043
  }
1044
1044
  return t[1] === "-" || t[4] === "ago" ? -a : a;
1045
- }, Ke = (e) => e.toLowerCase().replace(/^application\//, ""), Tr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Rr = (e, t, r = {}) => {
1045
+ }, Ne = (e) => e.toLowerCase().replace(/^application\//, ""), Ar = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Tr = (e, t, r = {}) => {
1046
1046
  let n;
1047
1047
  try {
1048
1048
  n = JSON.parse(q.decode(t));
@@ -1051,7 +1051,7 @@ const mr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, nt = rt * 60, Re = nt
1051
1051
  if (!G(n))
1052
1052
  throw new b("JWT Claims Set must be a top-level JSON object");
1053
1053
  const { typ: a } = r;
1054
- if (a && (typeof e.typ != "string" || Ke(e.typ) !== Ke(a)))
1054
+ if (a && (typeof e.typ != "string" || Ne(e.typ) !== Ne(a)))
1055
1055
  throw new _('unexpected "typ" JWT header value', n, "typ", "check_failed");
1056
1056
  const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: h } = r, y = [...s];
1057
1057
  h !== void 0 && y.push("iat"), c !== void 0 && y.push("aud"), i !== void 0 && y.push("sub"), o !== void 0 && y.push("iss");
@@ -1062,12 +1062,12 @@ const mr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, nt = rt * 60, Re = nt
1062
1062
  throw new _('unexpected "iss" claim value', n, "iss", "check_failed");
1063
1063
  if (i && n.sub !== i)
1064
1064
  throw new _('unexpected "sub" claim value', n, "sub", "check_failed");
1065
- if (c && !Tr(n.aud, typeof c == "string" ? [c] : c))
1065
+ if (c && !Ar(n.aud, typeof c == "string" ? [c] : c))
1066
1066
  throw new _('unexpected "aud" claim value', n, "aud", "check_failed");
1067
1067
  let p;
1068
1068
  switch (typeof r.clockTolerance) {
1069
1069
  case "string":
1070
- p = Ne(r.clockTolerance);
1070
+ p = Ce(r.clockTolerance);
1071
1071
  break;
1072
1072
  case "number":
1073
1073
  p = r.clockTolerance;
@@ -1078,7 +1078,7 @@ const mr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, nt = rt * 60, Re = nt
1078
1078
  default:
1079
1079
  throw new TypeError("Invalid clockTolerance option type");
1080
1080
  }
1081
- const { currentDate: l } = r, T = mr(l || /* @__PURE__ */ new Date());
1081
+ const { currentDate: l } = r, T = gr(l || /* @__PURE__ */ new Date());
1082
1082
  if ((n.iat !== void 0 || h) && typeof n.iat != "number")
1083
1083
  throw new _('"iat" claim must be a number', n, "iat", "invalid");
1084
1084
  if (n.nbf !== void 0) {
@@ -1091,27 +1091,27 @@ const mr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, nt = rt * 60, Re = nt
1091
1091
  if (typeof n.exp != "number")
1092
1092
  throw new _('"exp" claim must be a number', n, "exp", "invalid");
1093
1093
  if (n.exp <= T - p)
1094
- throw new Se('"exp" claim timestamp check failed', n, "exp", "check_failed");
1094
+ throw new we('"exp" claim timestamp check failed', n, "exp", "check_failed");
1095
1095
  }
1096
1096
  if (h) {
1097
- const R = T - n.iat, he = typeof h == "number" ? h : Ne(h);
1098
- if (R - p > he)
1099
- throw new Se('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1097
+ const R = T - n.iat, de = typeof h == "number" ? h : Ce(h);
1098
+ if (R - p > de)
1099
+ throw new we('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1100
1100
  if (R < 0 - p)
1101
1101
  throw new _('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
1102
1102
  }
1103
1103
  return n;
1104
1104
  };
1105
- async function _r(e, t, r) {
1105
+ async function Rr(e, t, r) {
1106
1106
  var n;
1107
- const a = await gr(e, t, r);
1107
+ const a = await Er(e, t, r);
1108
1108
  if ((n = a.protectedHeader.crit) != null && n.includes("b64") && a.protectedHeader.b64 === !1)
1109
1109
  throw new b("JWTs MUST NOT use unencoded payload");
1110
- const s = { payload: Rr(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1110
+ const s = { payload: Tr(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1111
1111
  return typeof t == "function" ? { ...s, key: a.key } : s;
1112
1112
  }
1113
- const Ir = C;
1114
- function br(e) {
1113
+ const _r = C;
1114
+ function Ir(e) {
1115
1115
  if (typeof e != "string")
1116
1116
  throw new b("JWTs must use Compact JWS serialization, JWT must be a string");
1117
1117
  const { 1: t, length: r } = e.split(".");
@@ -1123,7 +1123,7 @@ function br(e) {
1123
1123
  throw new b("JWTs must contain a payload");
1124
1124
  let n;
1125
1125
  try {
1126
- n = Ir(t);
1126
+ n = _r(t);
1127
1127
  } catch {
1128
1128
  throw new b("Failed to base64url decode the payload");
1129
1129
  }
@@ -1139,56 +1139,56 @@ function br(e) {
1139
1139
  }
1140
1140
  const V = async (e) => {
1141
1141
  try {
1142
- const t = f.ALG, r = await ir(Lt, t);
1143
- return await _r(e, r, {
1142
+ const t = f.ALG, r = await sr(Ut, t);
1143
+ return await Rr(e, r, {
1144
1144
  issuer: f.ISSUER
1145
1145
  });
1146
1146
  } catch {
1147
1147
  return;
1148
1148
  }
1149
- }, kr = (e) => {
1149
+ }, br = (e) => {
1150
1150
  try {
1151
- return br(e);
1151
+ return Ir(e);
1152
1152
  } catch {
1153
1153
  return;
1154
1154
  }
1155
1155
  }, m = [];
1156
1156
  for (let e = 0; e < 256; ++e)
1157
1157
  m.push((e + 256).toString(16).slice(1));
1158
- function Or(e, t = 0) {
1158
+ function kr(e, t = 0) {
1159
1159
  return (m[e[t + 0]] + m[e[t + 1]] + m[e[t + 2]] + m[e[t + 3]] + "-" + m[e[t + 4]] + m[e[t + 5]] + "-" + m[e[t + 6]] + m[e[t + 7]] + "-" + m[e[t + 8]] + m[e[t + 9]] + "-" + m[e[t + 10]] + m[e[t + 11]] + m[e[t + 12]] + m[e[t + 13]] + m[e[t + 14]] + m[e[t + 15]]).toLowerCase();
1160
1160
  }
1161
- let Ee;
1162
- const vr = new Uint8Array(16);
1163
- function Pr() {
1164
- if (!Ee) {
1161
+ let fe;
1162
+ const Or = new Uint8Array(16);
1163
+ function vr() {
1164
+ if (!fe) {
1165
1165
  if (typeof crypto > "u" || !crypto.getRandomValues)
1166
1166
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1167
- Ee = crypto.getRandomValues.bind(crypto);
1167
+ fe = crypto.getRandomValues.bind(crypto);
1168
1168
  }
1169
- return Ee(vr);
1169
+ return fe(Or);
1170
1170
  }
1171
- const Cr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), De = { randomUUID: Cr };
1172
- function Ue(e, t, r) {
1173
- if (De.randomUUID && !t && !e)
1174
- return De.randomUUID();
1171
+ const Pr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ke = { randomUUID: Pr };
1172
+ function De(e, t, r) {
1173
+ if (Ke.randomUUID && !t && !e)
1174
+ return Ke.randomUUID();
1175
1175
  e = e || {};
1176
- const n = e.random || (e.rng || Pr)();
1177
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Or(n);
1176
+ const n = e.random || (e.rng || vr)();
1177
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, kr(n);
1178
1178
  }
1179
- const Le = globalThis.crypto, Nr = (e) => `${Ue()}${Ue()}`.slice(0, e), Kr = (e) => btoa(
1179
+ const Ue = globalThis.crypto, Cr = (e) => `${De()}${De()}`.slice(0, e), Nr = (e) => btoa(
1180
1180
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1181
1181
  );
1182
- async function Dr(e) {
1183
- if (!Le.subtle)
1182
+ async function Kr(e) {
1183
+ if (!Ue.subtle)
1184
1184
  throw new Error(
1185
1185
  "crypto.subtle is available only in secure contexts (HTTPS)."
1186
1186
  );
1187
- const t = new TextEncoder().encode(e), r = await Le.subtle.digest("SHA-256", t);
1188
- return Kr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1187
+ const t = new TextEncoder().encode(e), r = await Ue.subtle.digest("SHA-256", t);
1188
+ return Nr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1189
1189
  }
1190
- async function Ur(e) {
1191
- const r = Nr(43), n = await Dr(r);
1190
+ async function Dr(e) {
1191
+ const r = Cr(43), n = await Kr(r);
1192
1192
  return {
1193
1193
  code_verifier: r,
1194
1194
  code_challenge: n
@@ -1204,26 +1204,26 @@ const sn = async (e, t) => {
1204
1204
  (s) => t[s].every((o) => a.includes(o))
1205
1205
  );
1206
1206
  };
1207
- function at(e, t) {
1207
+ function nt(e, t) {
1208
1208
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1209
1209
  }
1210
- const He = (e, t) => {
1210
+ const Le = (e, t) => {
1211
1211
  const r = JSON.stringify(
1212
1212
  typeof t == "function" ? t() : t
1213
1213
  );
1214
- window.localStorage.setItem(e, r), at(e, r);
1215
- }, Lr = (e) => {
1216
- window.localStorage.removeItem(e), at(e, null);
1217
- }, We = (e) => window.localStorage.getItem(e), Hr = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1214
+ window.localStorage.setItem(e, r), nt(e, r);
1215
+ }, Ur = (e) => {
1216
+ window.localStorage.removeItem(e), nt(e, null);
1217
+ }, He = (e) => window.localStorage.getItem(e), Lr = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1218
1218
  function te({
1219
1219
  key: e,
1220
1220
  initialValue: t
1221
1221
  }) {
1222
- const r = _t(Hr, () => We(e)), n = D(
1222
+ const r = Rt(Lr, () => He(e)), n = D(
1223
1223
  (o) => {
1224
1224
  try {
1225
1225
  const i = typeof o == "function" ? o(JSON.parse(r)) : o;
1226
- i == null ? Lr(e) : He(e, i);
1226
+ i == null ? Ur(e) : Le(e, i);
1227
1227
  } catch (i) {
1228
1228
  console.warn(i);
1229
1229
  }
@@ -1234,9 +1234,9 @@ function te({
1234
1234
  }, [t, n]), s = D(() => {
1235
1235
  n(null);
1236
1236
  }, [n]);
1237
- return Je(() => {
1237
+ return $e(() => {
1238
1238
  try {
1239
- We(e) === null && typeof t < "u" && He(e, t);
1239
+ He(e) === null && typeof t < "u" && Le(e, t);
1240
1240
  } catch (o) {
1241
1241
  console.warn(o);
1242
1242
  }
@@ -1245,28 +1245,28 @@ function te({
1245
1245
  const w = [];
1246
1246
  for (let e = 0; e < 256; ++e)
1247
1247
  w.push((e + 256).toString(16).slice(1));
1248
- function Wr(e, t = 0) {
1248
+ function Hr(e, t = 0) {
1249
1249
  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();
1250
1250
  }
1251
- let ge;
1252
- const $r = new Uint8Array(16);
1253
- function Jr() {
1254
- if (!ge) {
1251
+ let Ee;
1252
+ const Wr = new Uint8Array(16);
1253
+ function $r() {
1254
+ if (!Ee) {
1255
1255
  if (typeof crypto > "u" || !crypto.getRandomValues)
1256
1256
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1257
- ge = crypto.getRandomValues.bind(crypto);
1257
+ Ee = crypto.getRandomValues.bind(crypto);
1258
1258
  }
1259
- return ge($r);
1259
+ return Ee(Wr);
1260
1260
  }
1261
- const Yr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), $e = { randomUUID: Yr };
1262
- function me(e, t, r) {
1263
- if ($e.randomUUID && !t && !e)
1264
- return $e.randomUUID();
1261
+ const Jr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), We = { randomUUID: Jr };
1262
+ function ge(e, t, r) {
1263
+ if (We.randomUUID && !t && !e)
1264
+ return We.randomUUID();
1265
1265
  e = e || {};
1266
- const n = e.random || (e.rng || Jr)();
1267
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Wr(n);
1266
+ const n = e.random || (e.rng || $r)();
1267
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Hr(n);
1268
1268
  }
1269
- const W = "Your session has expired. For your security, please log in again to continue.", xr = "Your session has been successfully terminated.", we = "Login failed. Please try again.", Mr = "Error getting access token, please re-authenticate.", Gr = "You forgot to wrap your component in <AuthProvider>.", re = "@@auth@@", B = "LOADING", ae = "LOGIN", ot = "LOGOUT", z = "success", O = "failure", st = "include", it = "POST", ct = "application/json", ne = {
1269
+ const W = "Your session has expired. For your security, please log in again to continue.", Yr = "Your session has been successfully terminated.", me = "Login failed. Please try again.", xr = "Error getting access token, please re-authenticate.", Mr = "You forgot to wrap your component in <AuthProvider>.", re = "@@auth@@", B = "LOADING", ae = "LOGIN", at = "LOGOUT", z = "success", O = "failure", ot = "include", st = "POST", it = "application/json", ne = {
1270
1270
  GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1271
1271
  $clientId: String!,
1272
1272
  $username: String!,
@@ -1371,22 +1371,19 @@ const W = "Your session has expired. For your security, please log in again to c
1371
1371
  params: n = {}
1372
1372
  }) => {
1373
1373
  try {
1374
- const a = `Bearer ${e}`, s = await fetch(
1375
- ut ? `${ce.dev}/graphql` : `${ce.prod}/graphql`,
1376
- {
1377
- credentials: st,
1378
- method: it,
1379
- headers: {
1380
- authorization: a,
1381
- "Content-Type": ct,
1382
- [Ve.CLIENT_ID]: `${r}`
1383
- },
1384
- body: JSON.stringify({
1385
- query: t.schema,
1386
- variables: n
1387
- })
1388
- }
1389
- );
1374
+ const a = `Bearer ${e}`, s = await fetch(`${ct()}/graphql`, {
1375
+ credentials: ot,
1376
+ method: st,
1377
+ headers: {
1378
+ authorization: a,
1379
+ "Content-Type": it,
1380
+ [Ge.CLIENT_ID]: `${r}`
1381
+ },
1382
+ body: JSON.stringify({
1383
+ query: t.schema,
1384
+ variables: n
1385
+ })
1386
+ });
1390
1387
  if (s.status !== 200)
1391
1388
  return { status: O, data: [] };
1392
1389
  const { data: o } = await s.json();
@@ -1397,24 +1394,21 @@ const W = "Your session has expired. For your security, please log in again to c
1397
1394
  } catch (a) {
1398
1395
  return console.error(a), { status: O, data: [] };
1399
1396
  }
1400
- }, de = async ({
1397
+ }, le = async ({
1401
1398
  type: e,
1402
1399
  clientId: t,
1403
1400
  params: r = {}
1404
1401
  }) => {
1405
1402
  try {
1406
- const n = await fetch(
1407
- ut ? `${ce.dev}/${e}` : `${ce.prod}/${e}`,
1408
- {
1409
- credentials: st,
1410
- method: it,
1411
- headers: {
1412
- "Content-Type": ct,
1413
- [Ve.CLIENT_ID]: `${t}`
1414
- },
1415
- body: JSON.stringify(r)
1416
- }
1417
- );
1403
+ const n = await fetch(`${ct()}/${e}`, {
1404
+ credentials: ot,
1405
+ method: st,
1406
+ headers: {
1407
+ "Content-Type": it,
1408
+ [Ge.CLIENT_ID]: `${t}`
1409
+ },
1410
+ body: JSON.stringify(r)
1411
+ });
1418
1412
  if (n.status !== 200)
1419
1413
  return { status: O, data: [] };
1420
1414
  const { data: a } = await n.json();
@@ -1425,10 +1419,7 @@ const W = "Your session has expired. For your security, please log in again to c
1425
1419
  } catch (n) {
1426
1420
  return console.error(n), { status: O, data: [] };
1427
1421
  }
1428
- }, Vr = process.env.NODE_ENV === "production", ut = !Vr, ce = {
1429
- dev: process.env.PUBLIC_AUTH_SERVER_URL || "https://auth.gizmette.local.com:3003",
1430
- prod: "https://mylogin.gizmette.com/auth"
1431
- }, lt = {
1422
+ }, Gr = process.env.NODE_ENV === "production", Vr = !Gr, ct = () => Vr ? process && process?.env?.PUBLIC_AUTH_SERVER_URL ? process?.env?.PUBLIC_AUTH_SERVER_URL : "https://auth.gizmette.local.com:3003" : "https://mylogin.gizmette.com/auth", ut = {
1432
1423
  isLoading: !0,
1433
1424
  isAuthenticated: !1,
1434
1425
  user: void 0,
@@ -1437,7 +1428,7 @@ const W = "Your session has expired. For your security, please log in again to c
1437
1428
  authenticationType: ""
1438
1429
  }, jr = (e) => {
1439
1430
  try {
1440
- const t = kr(e);
1431
+ const t = br(e);
1441
1432
  return t ? t[f.USER_ID_KEY] : "";
1442
1433
  } catch {
1443
1434
  return "";
@@ -1450,8 +1441,8 @@ const W = "Your session has expired. For your security, please log in again to c
1450
1441
  }) => {
1451
1442
  try {
1452
1443
  return {
1453
- status: (await de({
1454
- type: ue.LOGOUT,
1444
+ status: (await le({
1445
+ type: ce.LOGOUT,
1455
1446
  clientId: t,
1456
1447
  params: {
1457
1448
  userId: e,
@@ -1478,8 +1469,8 @@ const W = "Your session has expired. For your security, please log in again to c
1478
1469
  ua: h
1479
1470
  }) => {
1480
1471
  try {
1481
- const y = await de({
1482
- type: ue.LOGIN,
1472
+ const y = await le({
1473
+ type: ce.LOGIN,
1483
1474
  clientId: r,
1484
1475
  params: {
1485
1476
  type: a || M.ID_AND_ACCESS_TOKEN,
@@ -1514,8 +1505,8 @@ const W = "Your session has expired. For your security, please log in again to c
1514
1505
  code_challenge: r
1515
1506
  }) => {
1516
1507
  try {
1517
- const n = await de({
1518
- type: ue.CODE,
1508
+ const n = await le({
1509
+ type: ce.CODE,
1519
1510
  clientId: t,
1520
1511
  params: {
1521
1512
  type: M.CODE,
@@ -1545,8 +1536,8 @@ const W = "Your session has expired. For your security, please log in again to c
1545
1536
  domain: s
1546
1537
  }) => {
1547
1538
  try {
1548
- const o = await de({
1549
- type: ue.REFRESH,
1539
+ const o = await le({
1540
+ type: ce.REFRESH,
1550
1541
  clientId: e,
1551
1542
  params: {
1552
1543
  type: M.REFRESH_TOKEN,
@@ -1631,8 +1622,8 @@ const Xr = (e) => D(
1631
1622
  },
1632
1623
  [e]
1633
1624
  ), Y = () => {
1634
- throw new Error(Gr);
1635
- }, dt = It({
1625
+ throw new Error(Mr);
1626
+ }, lt = _t({
1636
1627
  isAuthenticated: !1,
1637
1628
  isLoading: !1,
1638
1629
  login: Y,
@@ -1643,8 +1634,8 @@ const Xr = (e) => D(
1643
1634
  loginWithPasskey: Y,
1644
1635
  logoutReason: "",
1645
1636
  authenticationType: ""
1646
- }), Zr = Rt.createContext({
1647
- state: lt,
1637
+ }), Zr = Tt.createContext({
1638
+ state: ut,
1648
1639
  dispatch: () => {
1649
1640
  }
1650
1641
  }), en = (e, t) => t?.type === B ? {
@@ -1657,7 +1648,7 @@ const Xr = (e) => D(
1657
1648
  user: t.payload.user,
1658
1649
  authenticationType: t.payload.authenticationType,
1659
1650
  logoutReason: ""
1660
- } : t?.type === ot ? {
1651
+ } : t?.type === at ? {
1661
1652
  ...e,
1662
1653
  isLoading: !1,
1663
1654
  isAuthenticated: !1,
@@ -1671,26 +1662,26 @@ const Xr = (e) => D(
1671
1662
  domain: n = "",
1672
1663
  debug: a = !1
1673
1664
  }) => {
1674
- const [s, o] = bt(en, {
1675
- ...lt,
1665
+ const [s, o] = It(en, {
1666
+ ...ut,
1676
1667
  debug: a
1677
- }), i = Xr(a), c = kt(!1), [h, y, , p] = te({
1668
+ }), i = Xr(a), c = bt(!1), [h, y, , p] = te({
1678
1669
  key: `${re}::${r}::@@user@@`
1679
1670
  }), [l, T, , R] = te({
1680
1671
  key: `${re}::${r}::@@access@@`
1681
- }), [he, pe, , _e] = te(
1672
+ }), [de, he, , Re] = te(
1682
1673
  {
1683
1674
  key: `${re}::${r}::@@refresh@@`
1684
1675
  }
1685
- ), [ht, Ie, , be] = te({
1676
+ ), [dt, _e, , Ie] = te({
1686
1677
  key: `${re}::${r}::@@nonce@@`
1687
- }), pt = new Qr(l, he), Q = D(() => {
1688
- i("removeLocalStorage: removing local storage"), p(), R(), _e(), be();
1678
+ }), ht = new Qr(l, de), Q = D(() => {
1679
+ i("removeLocalStorage: removing local storage"), p(), R(), Re(), Ie();
1689
1680
  }, [
1690
1681
  R,
1691
1682
  p,
1692
- be,
1693
- _e,
1683
+ Ie,
1684
+ Re,
1694
1685
  i
1695
1686
  ]), F = D(
1696
1687
  (u) => {
@@ -1698,7 +1689,7 @@ const Xr = (e) => D(
1698
1689
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
1699
1690
  u
1700
1691
  ), o({
1701
- type: ot,
1692
+ type: at,
1702
1693
  payload: {
1703
1694
  logoutReason: u || W
1704
1695
  }
@@ -1720,7 +1711,7 @@ const Xr = (e) => D(
1720
1711
  },
1721
1712
  [h, s, r, n, F, i]
1722
1713
  );
1723
- Je(() => {
1714
+ $e(() => {
1724
1715
  if (!c.current)
1725
1716
  return s.isLoading && h !== null ? (async () => {
1726
1717
  try {
@@ -1745,16 +1736,16 @@ const Xr = (e) => D(
1745
1736
  c.current = !0;
1746
1737
  };
1747
1738
  }, [s.isLoading, h, N, i]);
1748
- const yt = async (u, g) => {
1739
+ const pt = async (u, g) => {
1749
1740
  o({ type: B, payload: { isLoading: !0 } }), Q();
1750
- const d = me();
1751
- Ie(d), i("login: Logging in with password");
1752
- const { code_verifier: K, code_challenge: St } = await Ur(), ke = await qr({
1741
+ const d = ge();
1742
+ _e(d), i("login: Logging in with password");
1743
+ const { code_verifier: K, code_challenge: wt } = await Dr(), be = await qr({
1753
1744
  nonce: d,
1754
1745
  clientId: r,
1755
- code_challenge: St
1746
+ code_challenge: wt
1756
1747
  });
1757
- if (ke.status) {
1748
+ if (be.status) {
1758
1749
  const U = await Br({
1759
1750
  username: u,
1760
1751
  password: g,
@@ -1762,12 +1753,12 @@ const Xr = (e) => D(
1762
1753
  sessionExpiration: t,
1763
1754
  nonce: d,
1764
1755
  type: M.CODE,
1765
- code: ke.data,
1756
+ code: be.data,
1766
1757
  code_verifier: K,
1767
1758
  domain: n,
1768
1759
  ua: navigator.userAgent
1769
1760
  });
1770
- return U.status ? (y(U.idToken), T(U.accessToken), pe(U.refreshToken), o({
1761
+ return U.status ? (y(U.idToken), T(U.accessToken), he(U.refreshToken), o({
1771
1762
  type: ae,
1772
1763
  payload: {
1773
1764
  authenticationType: M.CODE,
@@ -1777,12 +1768,12 @@ const Xr = (e) => D(
1777
1768
  email: U.email
1778
1769
  }
1779
1770
  }
1780
- }), !0) : (F(we), !1);
1771
+ }), !0) : (F(me), !1);
1781
1772
  }
1782
1773
  return !1;
1783
- }, ft = async (u) => {
1784
- u?.preventDefault(), await N(xr);
1785
- }, Et = async () => {
1774
+ }, yt = async (u) => {
1775
+ u?.preventDefault(), await N(Yr);
1776
+ }, ft = async () => {
1786
1777
  const { isAuthenticated: u, user: g } = s;
1787
1778
  try {
1788
1779
  if (u && g && g.userId) {
@@ -1793,13 +1784,13 @@ const Xr = (e) => D(
1793
1784
  return l;
1794
1785
  }
1795
1786
  i("getAccessToken: invalid access token, trying to refresh it");
1796
- const d = await pt.refreshtoken({
1787
+ const d = await ht.refreshtoken({
1797
1788
  clientId: r,
1798
1789
  userId: g.userId,
1799
- nonce: ht,
1790
+ nonce: dt,
1800
1791
  domain: n
1801
1792
  });
1802
- return d.status && d.status === "success" && d.newAccessToken ? (T(d.newAccessToken), pe(d.newRefreshToken), d.newAccessToken) : (i(
1793
+ return d.status && d.status === "success" && d.newAccessToken ? (T(d.newAccessToken), he(d.newRefreshToken), d.newAccessToken) : (i(
1803
1794
  "getAccessToken: invalid refresh token, need to re-authenticate"
1804
1795
  ), await N(W), "");
1805
1796
  }
@@ -1809,9 +1800,9 @@ const Xr = (e) => D(
1809
1800
  } catch {
1810
1801
  return i(
1811
1802
  "getAccessToken: exception occurred, invalidating and logging out"
1812
- ), await N(Mr), "";
1803
+ ), await N(xr), "";
1813
1804
  }
1814
- }, gt = () => s.isAuthenticated && h ? h : "", mt = async () => {
1805
+ }, Et = () => s.isAuthenticated && h ? h : "", gt = async () => {
1815
1806
  const { user: u } = s;
1816
1807
  let g = await J({
1817
1808
  accessToken: l,
@@ -1825,7 +1816,7 @@ const Xr = (e) => D(
1825
1816
  });
1826
1817
  if (g.status)
1827
1818
  try {
1828
- const d = await Nt(g.data);
1819
+ const d = await Ct(g.data);
1829
1820
  return g = await J({
1830
1821
  accessToken: l,
1831
1822
  clientId: r,
@@ -1851,11 +1842,11 @@ const Xr = (e) => D(
1851
1842
  }), !1;
1852
1843
  }
1853
1844
  return !1;
1854
- }, wt = async () => {
1845
+ }, mt = async () => {
1855
1846
  o({ type: B, payload: { isLoading: !0 } }), Q();
1856
- const u = me();
1857
- Ie(u), i("loginWithPasskey");
1858
- const g = me();
1847
+ const u = ge();
1848
+ _e(u), i("loginWithPasskey");
1849
+ const g = ge();
1859
1850
  let d = await J({
1860
1851
  accessToken: l,
1861
1852
  clientId: r,
@@ -1867,7 +1858,7 @@ const Xr = (e) => D(
1867
1858
  });
1868
1859
  if (d.status)
1869
1860
  try {
1870
- const K = await Ut(d.data);
1861
+ const K = await Dt(d.data);
1871
1862
  return d = await J({
1872
1863
  accessToken: l,
1873
1864
  clientId: r,
@@ -1881,7 +1872,7 @@ const Xr = (e) => D(
1881
1872
  sessionExpiration: t,
1882
1873
  ua: navigator.userAgent
1883
1874
  }
1884
- }), d.data.status === z ? (y(d.data.idToken), T(d.data.accessToken), pe(d.data.refreshToken), o({
1875
+ }), d.data.status === z ? (y(d.data.idToken), T(d.data.accessToken), he(d.data.refreshToken), o({
1885
1876
  type: ae,
1886
1877
  payload: {
1887
1878
  authenticationType: M.PASSKEY,
@@ -1891,7 +1882,7 @@ const Xr = (e) => D(
1891
1882
  email: d.data.email
1892
1883
  }
1893
1884
  }
1894
- }), !0) : (F(we), !1);
1885
+ }), !0) : (F(me), !1);
1895
1886
  } catch {
1896
1887
  return await J({
1897
1888
  accessToken: l,
@@ -1905,26 +1896,26 @@ const Xr = (e) => D(
1905
1896
  domain: n,
1906
1897
  sessionExpiration: t
1907
1898
  }
1908
- }), F(we), !1;
1899
+ }), F(me), !1;
1909
1900
  }
1910
1901
  return !1;
1911
1902
  };
1912
- return /* @__PURE__ */ Oe(Zr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ Oe(
1913
- dt.Provider,
1903
+ return /* @__PURE__ */ ke(Zr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ke(
1904
+ lt.Provider,
1914
1905
  {
1915
1906
  value: {
1916
1907
  ...s,
1917
- login: yt,
1918
- logout: ft,
1919
- getAccessToken: Et,
1920
- getIdToken: gt,
1921
- registeringForPasskey: mt,
1922
- loginWithPasskey: wt
1908
+ login: pt,
1909
+ logout: yt,
1910
+ getAccessToken: ft,
1911
+ getIdToken: Et,
1912
+ registeringForPasskey: gt,
1913
+ loginWithPasskey: mt
1923
1914
  },
1924
1915
  children: e
1925
1916
  }
1926
1917
  ) });
1927
- }, un = (e = dt) => Ot(e);
1918
+ }, un = (e = lt) => kt(e);
1928
1919
  export {
1929
1920
  M as AUTH_TYPES,
1930
1921
  cn as AuthProvider,