@versini/auth-provider 7.5.1 → 7.5.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 +536 -492
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  var yt = Object.defineProperty;
2
- var ht = (e, t, r) => t in e ? yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var X = (e, t, r) => ht(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsx as Re } from "react/jsx-runtime";
5
- import pt, { useSyncExternalStore as ft, useCallback as D, useEffect as De, createContext as Et, useReducer as mt, useRef as gt, useContext as wt } from "react";
2
+ var pt = (e, t, r) => t in e ? yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var X = (e, t, r) => pt(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as _e } from "react/jsx-runtime";
5
+ import ft, { useSyncExternalStore as Et, useCallback as D, useEffect as Ue, createContext as gt, useReducer as mt, useRef as wt, useContext as St } from "react";
6
6
  /*!
7
- @versini/auth-provider v7.5.1
7
+ @versini/auth-provider v7.5.3
8
8
  © 2025 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "7.5.1",
13
- buildTime: "04/02/2025 04:33 PM EDT",
12
+ version: "7.5.3",
13
+ buildTime: "04/02/2025 05:48 PM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
@@ -30,94 +30,119 @@ function se(e) {
30
30
  return s;
31
31
  }
32
32
  function me() {
33
- return window?.PublicKeyCredential !== void 0 && typeof window.PublicKeyCredential == "function";
33
+ return At.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
34
34
  }
35
- function Ue(e) {
35
+ const At = {
36
+ stubThis: (e) => e
37
+ };
38
+ function He(e) {
36
39
  const { id: t } = e;
37
40
  return {
38
41
  ...e,
39
42
  id: se(t),
43
+ /**
44
+ * `descriptor.transports` is an array of our `AuthenticatorTransportFuture` that includes newer
45
+ * transports that TypeScript's DOM lib is ignorant of. Convince TS that our list of transports
46
+ * are fine to pass to WebAuthn since browsers will recognize the new value.
47
+ */
40
48
  transports: e.transports
41
49
  };
42
50
  }
43
- function He(e) {
44
- return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
51
+ function Le(e) {
52
+ return (
53
+ // Consider localhost valid as well since it's okay wrt Secure Contexts
54
+ e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)
55
+ );
45
56
  }
46
- class T extends Error {
57
+ class b extends Error {
47
58
  constructor({ message: t, code: r, cause: a, name: n }) {
48
- super(t, { cause: a }), this.name = n ?? a.name, this.code = r;
59
+ super(t, { cause: a }), Object.defineProperty(this, "code", {
60
+ enumerable: !0,
61
+ configurable: !0,
62
+ writable: !0,
63
+ value: void 0
64
+ }), this.name = n ?? a.name, this.code = r;
49
65
  }
50
66
  }
51
- function St({ error: e, options: t }) {
67
+ function Tt({ error: e, options: t }) {
52
68
  const { publicKey: r } = t;
53
69
  if (!r)
54
70
  throw Error("options was missing required publicKey property");
55
71
  if (e.name === "AbortError") {
56
72
  if (t.signal instanceof AbortSignal)
57
- return new T({
73
+ return new b({
58
74
  message: "Registration ceremony was sent an abort signal",
59
75
  code: "ERROR_CEREMONY_ABORTED",
60
76
  cause: e
61
77
  });
62
78
  } else if (e.name === "ConstraintError") {
63
79
  if (r.authenticatorSelection?.requireResidentKey === !0)
64
- return new T({
80
+ return new b({
65
81
  message: "Discoverable credentials were required but no available authenticator supported it",
66
82
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
67
83
  cause: e
68
84
  });
85
+ if (
86
+ // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
87
+ t.mediation === "conditional" && r.authenticatorSelection?.userVerification === "required"
88
+ )
89
+ return new b({
90
+ message: "User verification was required during automatic registration but it could not be performed",
91
+ code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
92
+ cause: e
93
+ });
69
94
  if (r.authenticatorSelection?.userVerification === "required")
70
- return new T({
95
+ return new b({
71
96
  message: "User verification was required but no available authenticator supported it",
72
97
  code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
73
98
  cause: e
74
99
  });
75
100
  } else {
76
101
  if (e.name === "InvalidStateError")
77
- return new T({
102
+ return new b({
78
103
  message: "The authenticator was previously registered",
79
104
  code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
80
105
  cause: e
81
106
  });
82
107
  if (e.name === "NotAllowedError")
83
- return new T({
108
+ return new b({
84
109
  message: e.message,
85
110
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
86
111
  cause: e
87
112
  });
88
113
  if (e.name === "NotSupportedError")
89
- return r.pubKeyCredParams.filter((n) => n.type === "public-key").length === 0 ? new T({
114
+ return r.pubKeyCredParams.filter((n) => n.type === "public-key").length === 0 ? new b({
90
115
  message: 'No entry in pubKeyCredParams was of type "public-key"',
91
116
  code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
92
117
  cause: e
93
- }) : new T({
118
+ }) : new b({
94
119
  message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
95
120
  code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
96
121
  cause: e
97
122
  });
98
123
  if (e.name === "SecurityError") {
99
- const a = window.location.hostname;
100
- if (He(a)) {
124
+ const a = globalThis.location.hostname;
125
+ if (Le(a)) {
101
126
  if (r.rp.id !== a)
102
- return new T({
127
+ return new b({
103
128
  message: `The RP ID "${r.rp.id}" is invalid for this domain`,
104
129
  code: "ERROR_INVALID_RP_ID",
105
130
  cause: e
106
131
  });
107
- } else return new T({
108
- message: `${window.location.hostname} is an invalid domain`,
132
+ } else return new b({
133
+ message: `${globalThis.location.hostname} is an invalid domain`,
109
134
  code: "ERROR_INVALID_DOMAIN",
110
135
  cause: e
111
136
  });
112
137
  } else if (e.name === "TypeError") {
113
138
  if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
114
- return new T({
139
+ return new b({
115
140
  message: "User ID was not between 1 and 64 characters",
116
141
  code: "ERROR_INVALID_USER_ID_LENGTH",
117
142
  cause: e
118
143
  });
119
144
  } else if (e.name === "UnknownError")
120
- return new T({
145
+ return new b({
121
146
  message: "The authenticator was unable to process the specified options, or could not create a new credential",
122
147
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
123
148
  cause: e
@@ -125,7 +150,15 @@ function St({ error: e, options: t }) {
125
150
  }
126
151
  return e;
127
152
  }
128
- class At {
153
+ class bt {
154
+ constructor() {
155
+ Object.defineProperty(this, "controller", {
156
+ enumerable: !0,
157
+ configurable: !0,
158
+ writable: !0,
159
+ value: void 0
160
+ });
161
+ }
129
162
  createNewAbortSignal() {
130
163
  if (this.controller) {
131
164
  const r = new Error("Cancelling existing WebAuthn API call for new one");
@@ -141,117 +174,122 @@ class At {
141
174
  }
142
175
  }
143
176
  }
144
- const Le = new At(), Tt = ["cross-platform", "platform"];
145
- function $e(e) {
146
- if (e && !(Tt.indexOf(e) < 0))
177
+ const $e = new bt(), Rt = ["cross-platform", "platform"];
178
+ function We(e) {
179
+ if (e && !(Rt.indexOf(e) < 0))
147
180
  return e;
148
181
  }
149
- async function bt(e) {
182
+ async function _t(e) {
183
+ !e.optionsJSON && e.challenge && (console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
184
+ const { optionsJSON: t, useAutoRegister: r = !1 } = e;
150
185
  if (!me())
151
186
  throw new Error("WebAuthn is not supported in this browser");
152
- const r = { publicKey: {
153
- ...e,
154
- challenge: se(e.challenge),
187
+ const a = {
188
+ ...t,
189
+ challenge: se(t.challenge),
155
190
  user: {
156
- ...e.user,
157
- id: se(e.user.id)
191
+ ...t.user,
192
+ id: se(t.user.id)
158
193
  },
159
- excludeCredentials: e.excludeCredentials?.map(Ue)
160
- } };
161
- r.signal = Le.createNewAbortSignal();
162
- let a;
194
+ excludeCredentials: t.excludeCredentials?.map(He)
195
+ }, n = {};
196
+ r && (n.mediation = "conditional"), n.publicKey = a, n.signal = $e.createNewAbortSignal();
197
+ let s;
163
198
  try {
164
- a = await navigator.credentials.create(r);
199
+ s = await navigator.credentials.create(n);
165
200
  } catch (h) {
166
- throw St({ error: h, options: r });
201
+ throw Tt({ error: h, options: n });
167
202
  }
168
- if (!a)
203
+ if (!s)
169
204
  throw new Error("Registration was not completed");
170
- const { id: n, rawId: s, response: o, type: i } = a;
171
- let c;
172
- typeof o.getTransports == "function" && (c = o.getTransports());
173
- let f;
174
- if (typeof o.getPublicKeyAlgorithm == "function")
205
+ const { id: o, rawId: i, response: c, type: m } = s;
206
+ let d;
207
+ typeof c.getTransports == "function" && (d = c.getTransports());
208
+ let p;
209
+ if (typeof c.getPublicKeyAlgorithm == "function")
175
210
  try {
176
- f = o.getPublicKeyAlgorithm();
211
+ p = c.getPublicKeyAlgorithm();
177
212
  } catch (h) {
178
213
  ue("getPublicKeyAlgorithm()", h);
179
214
  }
180
- let y;
181
- if (typeof o.getPublicKey == "function")
215
+ let E;
216
+ if (typeof c.getPublicKey == "function")
182
217
  try {
183
- const h = o.getPublicKey();
184
- h !== null && (y = I(h));
218
+ const h = c.getPublicKey();
219
+ h !== null && (E = I(h));
185
220
  } catch (h) {
186
221
  ue("getPublicKey()", h);
187
222
  }
188
- let d;
189
- if (typeof o.getAuthenticatorData == "function")
223
+ let y;
224
+ if (typeof c.getAuthenticatorData == "function")
190
225
  try {
191
- d = I(o.getAuthenticatorData());
226
+ y = I(c.getAuthenticatorData());
192
227
  } catch (h) {
193
228
  ue("getAuthenticatorData()", h);
194
229
  }
195
230
  return {
196
- id: n,
197
- rawId: I(s),
231
+ id: o,
232
+ rawId: I(i),
198
233
  response: {
199
- attestationObject: I(o.attestationObject),
200
- clientDataJSON: I(o.clientDataJSON),
201
- transports: c,
202
- publicKeyAlgorithm: f,
203
- publicKey: y,
204
- authenticatorData: d
234
+ attestationObject: I(c.attestationObject),
235
+ clientDataJSON: I(c.clientDataJSON),
236
+ transports: d,
237
+ publicKeyAlgorithm: p,
238
+ publicKey: E,
239
+ authenticatorData: y
205
240
  },
206
- type: i,
207
- clientExtensionResults: a.getClientExtensionResults(),
208
- authenticatorAttachment: $e(a.authenticatorAttachment)
241
+ type: m,
242
+ clientExtensionResults: s.getClientExtensionResults(),
243
+ authenticatorAttachment: We(s.authenticatorAttachment)
209
244
  };
210
245
  }
211
246
  function ue(e, t) {
212
247
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
213
248
  `, t);
214
249
  }
215
- function Rt() {
250
+ function It() {
216
251
  if (!me())
217
- return new Promise((t) => t(!1));
218
- const e = window.PublicKeyCredential;
219
- return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
252
+ return le.stubThis(new Promise((t) => t(!1)));
253
+ const e = globalThis.PublicKeyCredential;
254
+ return e?.isConditionalMediationAvailable === void 0 ? le.stubThis(new Promise((t) => t(!1))) : le.stubThis(e.isConditionalMediationAvailable());
220
255
  }
221
- function _t({ error: e, options: t }) {
256
+ const le = {
257
+ stubThis: (e) => e
258
+ };
259
+ function Ot({ error: e, options: t }) {
222
260
  const { publicKey: r } = t;
223
261
  if (!r)
224
262
  throw Error("options was missing required publicKey property");
225
263
  if (e.name === "AbortError") {
226
264
  if (t.signal instanceof AbortSignal)
227
- return new T({
265
+ return new b({
228
266
  message: "Authentication ceremony was sent an abort signal",
229
267
  code: "ERROR_CEREMONY_ABORTED",
230
268
  cause: e
231
269
  });
232
270
  } else {
233
271
  if (e.name === "NotAllowedError")
234
- return new T({
272
+ return new b({
235
273
  message: e.message,
236
274
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
237
275
  cause: e
238
276
  });
239
277
  if (e.name === "SecurityError") {
240
- const a = window.location.hostname;
241
- if (He(a)) {
278
+ const a = globalThis.location.hostname;
279
+ if (Le(a)) {
242
280
  if (r.rpId !== a)
243
- return new T({
281
+ return new b({
244
282
  message: `The RP ID "${r.rpId}" is invalid for this domain`,
245
283
  code: "ERROR_INVALID_RP_ID",
246
284
  cause: e
247
285
  });
248
- } else return new T({
249
- message: `${window.location.hostname} is an invalid domain`,
286
+ } else return new b({
287
+ message: `${globalThis.location.hostname} is an invalid domain`,
250
288
  code: "ERROR_INVALID_DOMAIN",
251
289
  cause: e
252
290
  });
253
291
  } else if (e.name === "UnknownError")
254
- return new T({
292
+ return new b({
255
293
  message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
256
294
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
257
295
  cause: e
@@ -259,49 +297,51 @@ function _t({ error: e, options: t }) {
259
297
  }
260
298
  return e;
261
299
  }
262
- async function It(e, t = !1) {
300
+ async function vt(e) {
301
+ !e.optionsJSON && e.challenge && (console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
302
+ const { optionsJSON: t, useBrowserAutofill: r = !1, verifyBrowserAutofillInput: a = !0 } = e;
263
303
  if (!me())
264
304
  throw new Error("WebAuthn is not supported in this browser");
265
- let r;
266
- e.allowCredentials?.length !== 0 && (r = e.allowCredentials?.map(Ue));
267
- const a = {
268
- ...e,
269
- challenge: se(e.challenge),
270
- allowCredentials: r
271
- }, n = {};
272
- if (t) {
273
- if (!await Rt())
305
+ let n;
306
+ t.allowCredentials?.length !== 0 && (n = t.allowCredentials?.map(He));
307
+ const s = {
308
+ ...t,
309
+ challenge: se(t.challenge),
310
+ allowCredentials: n
311
+ }, o = {};
312
+ if (r) {
313
+ if (!await It())
274
314
  throw Error("Browser does not support WebAuthn autofill");
275
- if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
315
+ if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && a)
276
316
  throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
277
- n.mediation = "conditional", a.allowCredentials = [];
317
+ o.mediation = "conditional", s.allowCredentials = [];
278
318
  }
279
- n.publicKey = a, n.signal = Le.createNewAbortSignal();
280
- let s;
319
+ o.publicKey = s, o.signal = $e.createNewAbortSignal();
320
+ let i;
281
321
  try {
282
- s = await navigator.credentials.get(n);
283
- } catch (d) {
284
- throw _t({ error: d, options: n });
322
+ i = await navigator.credentials.get(o);
323
+ } catch (y) {
324
+ throw Ot({ error: y, options: o });
285
325
  }
286
- if (!s)
326
+ if (!i)
287
327
  throw new Error("Authentication was not completed");
288
- const { id: o, rawId: i, response: c, type: f } = s;
289
- let y;
290
- return c.userHandle && (y = I(c.userHandle)), {
291
- id: o,
292
- rawId: I(i),
328
+ const { id: c, rawId: m, response: d, type: p } = i;
329
+ let E;
330
+ return d.userHandle && (E = I(d.userHandle)), {
331
+ id: c,
332
+ rawId: I(m),
293
333
  response: {
294
- authenticatorData: I(c.authenticatorData),
295
- clientDataJSON: I(c.clientDataJSON),
296
- signature: I(c.signature),
297
- userHandle: y
334
+ authenticatorData: I(d.authenticatorData),
335
+ clientDataJSON: I(d.clientDataJSON),
336
+ signature: I(d.signature),
337
+ userHandle: E
298
338
  },
299
- type: f,
300
- clientExtensionResults: s.getClientExtensionResults(),
301
- authenticatorAttachment: $e(s.authenticatorAttachment)
339
+ type: p,
340
+ clientExtensionResults: i.getClientExtensionResults(),
341
+ authenticatorAttachment: We(i.authenticatorAttachment)
302
342
  };
303
343
  }
304
- var vt = Object.defineProperty, kt = (e, t, r) => t in e ? vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, p = (e, t, r) => kt(e, typeof t != "symbol" ? t + "" : t, r);
344
+ var kt = Object.defineProperty, Ct = (e, t, r) => t in e ? kt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, f = (e, t, r) => Ct(e, typeof t != "symbol" ? t + "" : t, r);
305
345
  /*!
306
346
  @versini/auth-common v4.2.1
307
347
  © 2025 gizmette.com
@@ -309,7 +349,7 @@ var vt = Object.defineProperty, kt = (e, t, r) => t in e ? vt(e, t, { enumerable
309
349
  try {
310
350
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
311
351
  version: "4.2.1",
312
- buildTime: "04/02/2025 04:33 PM EDT",
352
+ buildTime: "04/02/2025 05:48 PM EDT",
313
353
  homepage: "https://github.com/aversini/auth-client",
314
354
  license: "MIT"
315
355
  });
@@ -322,9 +362,9 @@ const x = {
322
362
  CODE: "code",
323
363
  REFRESH_TOKEN: "refresh_token",
324
364
  PASSKEY: "passkey"
325
- }, We = {
365
+ }, Je = {
326
366
  CLIENT_ID: "X-Auth-ClientId"
327
- }, m = {
367
+ }, g = {
328
368
  ALG: "RS256",
329
369
  USER_ID_KEY: "sub",
330
370
  USERNAME_KEY: "username",
@@ -337,7 +377,7 @@ const x = {
337
377
  SCOPES_KEY: "scopes",
338
378
  CLIENT_ID_KEY: "aud",
339
379
  ISSUER: "gizmette.com"
340
- }, Ot = `-----BEGIN PUBLIC KEY-----
380
+ }, Pt = `-----BEGIN PUBLIC KEY-----
341
381
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
342
382
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
343
383
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -351,14 +391,14 @@ awIDAQAB
351
391
  LOGIN: "login",
352
392
  REFRESH: "refresh"
353
393
  }, Z = new TextEncoder(), G = new TextDecoder();
354
- function Ct(...e) {
394
+ function Nt(...e) {
355
395
  const t = e.reduce((n, { length: s }) => n + s, 0), r = new Uint8Array(t);
356
396
  let a = 0;
357
397
  for (const n of e)
358
398
  r.set(n, a), a += n.length;
359
399
  return r;
360
400
  }
361
- function Pt(e) {
401
+ function Kt(e) {
362
402
  if (Uint8Array.fromBase64)
363
403
  return Uint8Array.fromBase64(e);
364
404
  const t = atob(e), r = new Uint8Array(t.length);
@@ -374,7 +414,7 @@ function F(e) {
374
414
  let t = e;
375
415
  t instanceof Uint8Array && (t = G.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
376
416
  try {
377
- return Pt(t);
417
+ return Kt(t);
378
418
  } catch {
379
419
  throw new TypeError("The input to be decoded is not correctly encoded.");
380
420
  }
@@ -382,62 +422,62 @@ function F(e) {
382
422
  class P extends Error {
383
423
  constructor(t, r) {
384
424
  var a;
385
- super(t, r), p(this, "code", "ERR_JOSE_GENERIC"), this.name = this.constructor.name, (a = Error.captureStackTrace) == null || a.call(Error, this, this.constructor);
425
+ super(t, r), f(this, "code", "ERR_JOSE_GENERIC"), this.name = this.constructor.name, (a = Error.captureStackTrace) == null || a.call(Error, this, this.constructor);
386
426
  }
387
427
  }
388
- p(P, "code", "ERR_JOSE_GENERIC");
428
+ f(P, "code", "ERR_JOSE_GENERIC");
389
429
  class R extends P {
390
430
  constructor(t, r, a = "unspecified", n = "unspecified") {
391
- super(t, { cause: { claim: a, reason: n, payload: r } }), p(this, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED"), p(this, "claim"), p(this, "reason"), p(this, "payload"), this.claim = a, this.reason = n, this.payload = r;
431
+ super(t, { cause: { claim: a, reason: n, payload: r } }), f(this, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED"), f(this, "claim"), f(this, "reason"), f(this, "payload"), this.claim = a, this.reason = n, this.payload = r;
392
432
  }
393
433
  }
394
- p(R, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
395
- class fe extends P {
434
+ f(R, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
435
+ class Ee extends P {
396
436
  constructor(t, r, a = "unspecified", n = "unspecified") {
397
- super(t, { cause: { claim: a, reason: n, payload: r } }), p(this, "code", "ERR_JWT_EXPIRED"), p(this, "claim"), p(this, "reason"), p(this, "payload"), this.claim = a, this.reason = n, this.payload = r;
437
+ super(t, { cause: { claim: a, reason: n, payload: r } }), f(this, "code", "ERR_JWT_EXPIRED"), f(this, "claim"), f(this, "reason"), f(this, "payload"), this.claim = a, this.reason = n, this.payload = r;
398
438
  }
399
439
  }
400
- p(fe, "code", "ERR_JWT_EXPIRED");
401
- class Je extends P {
440
+ f(Ee, "code", "ERR_JWT_EXPIRED");
441
+ class Ye extends P {
402
442
  constructor() {
403
- super(...arguments), p(this, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
443
+ super(...arguments), f(this, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
404
444
  }
405
445
  }
406
- p(Je, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
407
- let O = class extends P {
446
+ f(Ye, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
447
+ let k = class extends P {
408
448
  constructor() {
409
- super(...arguments), p(this, "code", "ERR_JOSE_NOT_SUPPORTED");
449
+ super(...arguments), f(this, "code", "ERR_JOSE_NOT_SUPPORTED");
410
450
  }
411
451
  };
412
- p(O, "code", "ERR_JOSE_NOT_SUPPORTED");
413
- class g extends P {
452
+ f(k, "code", "ERR_JOSE_NOT_SUPPORTED");
453
+ class w extends P {
414
454
  constructor() {
415
- super(...arguments), p(this, "code", "ERR_JWS_INVALID");
455
+ super(...arguments), f(this, "code", "ERR_JWS_INVALID");
416
456
  }
417
457
  }
418
- p(g, "code", "ERR_JWS_INVALID");
458
+ f(w, "code", "ERR_JWS_INVALID");
419
459
  class _ extends P {
420
460
  constructor() {
421
- super(...arguments), p(this, "code", "ERR_JWT_INVALID");
461
+ super(...arguments), f(this, "code", "ERR_JWT_INVALID");
422
462
  }
423
463
  }
424
- p(_, "code", "ERR_JWT_INVALID");
425
- class Ye extends P {
464
+ f(_, "code", "ERR_JWT_INVALID");
465
+ class xe extends P {
426
466
  constructor(t = "signature verification failed", r) {
427
- super(t, r), p(this, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
467
+ super(t, r), f(this, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
428
468
  }
429
469
  }
430
- p(Ye, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
431
- function k(e, t = "algorithm.name") {
470
+ f(xe, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
471
+ function v(e, t = "algorithm.name") {
432
472
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
433
473
  }
434
474
  function V(e, t) {
435
475
  return e.name === t;
436
476
  }
437
- function le(e) {
477
+ function de(e) {
438
478
  return parseInt(e.name.slice(4), 10);
439
479
  }
440
- function Kt(e) {
480
+ function Dt(e) {
441
481
  switch (e) {
442
482
  case "ES256":
443
483
  return "P-256";
@@ -449,64 +489,64 @@ function Kt(e) {
449
489
  throw new Error("unreachable");
450
490
  }
451
491
  }
452
- function Nt(e, t) {
492
+ function Ut(e, t) {
453
493
  if (!e.usages.includes(t))
454
494
  throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`);
455
495
  }
456
- function Dt(e, t, r) {
496
+ function Ht(e, t, r) {
457
497
  switch (t) {
458
498
  case "HS256":
459
499
  case "HS384":
460
500
  case "HS512": {
461
501
  if (!V(e.algorithm, "HMAC"))
462
- throw k("HMAC");
502
+ throw v("HMAC");
463
503
  const a = parseInt(t.slice(2), 10);
464
- if (le(e.algorithm.hash) !== a)
465
- throw k(`SHA-${a}`, "algorithm.hash");
504
+ if (de(e.algorithm.hash) !== a)
505
+ throw v(`SHA-${a}`, "algorithm.hash");
466
506
  break;
467
507
  }
468
508
  case "RS256":
469
509
  case "RS384":
470
510
  case "RS512": {
471
511
  if (!V(e.algorithm, "RSASSA-PKCS1-v1_5"))
472
- throw k("RSASSA-PKCS1-v1_5");
512
+ throw v("RSASSA-PKCS1-v1_5");
473
513
  const a = parseInt(t.slice(2), 10);
474
- if (le(e.algorithm.hash) !== a)
475
- throw k(`SHA-${a}`, "algorithm.hash");
514
+ if (de(e.algorithm.hash) !== a)
515
+ throw v(`SHA-${a}`, "algorithm.hash");
476
516
  break;
477
517
  }
478
518
  case "PS256":
479
519
  case "PS384":
480
520
  case "PS512": {
481
521
  if (!V(e.algorithm, "RSA-PSS"))
482
- throw k("RSA-PSS");
522
+ throw v("RSA-PSS");
483
523
  const a = parseInt(t.slice(2), 10);
484
- if (le(e.algorithm.hash) !== a)
485
- throw k(`SHA-${a}`, "algorithm.hash");
524
+ if (de(e.algorithm.hash) !== a)
525
+ throw v(`SHA-${a}`, "algorithm.hash");
486
526
  break;
487
527
  }
488
528
  case "Ed25519":
489
529
  case "EdDSA": {
490
530
  if (!V(e.algorithm, "Ed25519"))
491
- throw k("Ed25519");
531
+ throw v("Ed25519");
492
532
  break;
493
533
  }
494
534
  case "ES256":
495
535
  case "ES384":
496
536
  case "ES512": {
497
537
  if (!V(e.algorithm, "ECDSA"))
498
- throw k("ECDSA");
499
- const a = Kt(t);
538
+ throw v("ECDSA");
539
+ const a = Dt(t);
500
540
  if (e.algorithm.namedCurve !== a)
501
- throw k(a, "algorithm.namedCurve");
541
+ throw v(a, "algorithm.namedCurve");
502
542
  break;
503
543
  }
504
544
  default:
505
545
  throw new TypeError("CryptoKey does not support this operation");
506
546
  }
507
- Nt(e, r);
547
+ Ut(e, r);
508
548
  }
509
- function xe(e, t, ...r) {
549
+ function Ge(e, t, ...r) {
510
550
  var a;
511
551
  if (r = r.filter(Boolean), r.length > 2) {
512
552
  const n = r.pop();
@@ -514,17 +554,17 @@ function xe(e, t, ...r) {
514
554
  } else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
515
555
  return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
516
556
  }
517
- const Ut = (e, ...t) => xe("Key must be ", e, ...t);
518
- function Ge(e, t, ...r) {
519
- return xe(`Key for the ${e} algorithm must be `, t, ...r);
557
+ const Lt = (e, ...t) => Ge("Key must be ", e, ...t);
558
+ function Me(e, t, ...r) {
559
+ return Ge(`Key for the ${e} algorithm must be `, t, ...r);
520
560
  }
521
- function Me(e) {
561
+ function je(e) {
522
562
  return e?.[Symbol.toStringTag] === "CryptoKey";
523
563
  }
524
- function je(e) {
564
+ function Ve(e) {
525
565
  return e?.[Symbol.toStringTag] === "KeyObject";
526
566
  }
527
- const Ve = (e) => Me(e) || je(e), Ht = (...e) => {
567
+ const Be = (e) => je(e) || Ve(e), $t = (...e) => {
528
568
  const t = e.filter(Boolean);
529
569
  if (t.length === 0 || t.length === 1)
530
570
  return !0;
@@ -543,11 +583,11 @@ const Ve = (e) => Me(e) || je(e), Ht = (...e) => {
543
583
  }
544
584
  return !0;
545
585
  };
546
- function Lt(e) {
586
+ function Wt(e) {
547
587
  return typeof e == "object" && e !== null;
548
588
  }
549
589
  const q = (e) => {
550
- if (!Lt(e) || Object.prototype.toString.call(e) !== "[object Object]")
590
+ if (!Wt(e) || Object.prototype.toString.call(e) !== "[object Object]")
551
591
  return !1;
552
592
  if (Object.getPrototypeOf(e) === null)
553
593
  return !0;
@@ -555,7 +595,7 @@ const q = (e) => {
555
595
  for (; Object.getPrototypeOf(t) !== null; )
556
596
  t = Object.getPrototypeOf(t);
557
597
  return Object.getPrototypeOf(e) === t;
558
- }, $t = (e, t) => {
598
+ }, Jt = (e, t) => {
559
599
  if (e.startsWith("RS") || e.startsWith("PS")) {
560
600
  const { modulusLength: r } = t.algorithm;
561
601
  if (typeof r != "number" || r < 2048)
@@ -568,7 +608,7 @@ const q = (e) => {
568
608
  return !1;
569
609
  const n = e.subarray(a, a + t.length);
570
610
  return n.length !== t.length ? !1 : n.every((s, o) => s === t[o]) || ae(e, t, a + 1);
571
- }, Wt = (e) => {
611
+ }, Yt = (e) => {
572
612
  switch (!0) {
573
613
  case ae(e, [42, 134, 72, 206, 61, 3, 1, 7]):
574
614
  return "P-256";
@@ -579,7 +619,7 @@ const q = (e) => {
579
619
  default:
580
620
  return;
581
621
  }
582
- }, Jt = async (e, t, r, a, n) => {
622
+ }, xt = async (e, t, r, a, n) => {
583
623
  let s, o;
584
624
  const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
585
625
  switch (a) {
@@ -615,7 +655,7 @@ const q = (e) => {
615
655
  case "ECDH-ES+A128KW":
616
656
  case "ECDH-ES+A192KW":
617
657
  case "ECDH-ES+A256KW": {
618
- const c = Wt(i);
658
+ const c = Yt(i);
619
659
  s = c != null && c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: "X25519" }, o = [];
620
660
  break;
621
661
  }
@@ -624,11 +664,11 @@ const q = (e) => {
624
664
  s = { name: "Ed25519" }, o = ["verify"];
625
665
  break;
626
666
  default:
627
- throw new O('Invalid or unsupported "alg" (Algorithm) value');
667
+ throw new k('Invalid or unsupported "alg" (Algorithm) value');
628
668
  }
629
669
  return crypto.subtle.importKey(t, i, s, !0, o);
630
- }, Yt = (e, t, r) => Jt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
631
- function xt(e) {
670
+ }, Gt = (e, t, r) => xt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
671
+ function Mt(e) {
632
672
  let t, r;
633
673
  switch (e.kty) {
634
674
  case "RSA": {
@@ -653,7 +693,7 @@ function xt(e) {
653
693
  }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
654
694
  break;
655
695
  default:
656
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
696
+ throw new k('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
657
697
  }
658
698
  break;
659
699
  }
@@ -675,7 +715,7 @@ function xt(e) {
675
715
  t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
676
716
  break;
677
717
  default:
678
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
718
+ throw new k('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
679
719
  }
680
720
  break;
681
721
  }
@@ -692,27 +732,27 @@ function xt(e) {
692
732
  t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
693
733
  break;
694
734
  default:
695
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
735
+ throw new k('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
696
736
  }
697
737
  break;
698
738
  }
699
739
  default:
700
- throw new O('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
740
+ throw new k('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
701
741
  }
702
742
  return { algorithm: t, keyUsages: r };
703
743
  }
704
- const Gt = async (e) => {
744
+ const jt = async (e) => {
705
745
  if (!e.alg)
706
746
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
707
- const { algorithm: t, keyUsages: r } = xt(e), a = { ...e };
747
+ const { algorithm: t, keyUsages: r } = Mt(e), a = { ...e };
708
748
  return delete a.alg, delete a.use, crypto.subtle.importKey("jwk", a, t, e.ext ?? !e.d, e.key_ops ?? r);
709
749
  };
710
- async function Mt(e, t, r) {
750
+ async function Vt(e, t, r) {
711
751
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
712
752
  throw new TypeError('"spki" must be SPKI formatted string');
713
- return Yt(e, t);
753
+ return Gt(e, t);
714
754
  }
715
- const jt = (e, t, r, a, n) => {
755
+ const Bt = (e, t, r, a, n) => {
716
756
  if (n.crit !== void 0 && a?.crit === void 0)
717
757
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
718
758
  if (!a || a.crit === void 0)
@@ -723,40 +763,40 @@ const jt = (e, t, r, a, n) => {
723
763
  r !== void 0 ? s = new Map([...Object.entries(r), ...t.entries()]) : s = t;
724
764
  for (const o of a.crit) {
725
765
  if (!s.has(o))
726
- throw new O(`Extension Header Parameter "${o}" is not recognized`);
766
+ throw new k(`Extension Header Parameter "${o}" is not recognized`);
727
767
  if (n[o] === void 0)
728
768
  throw new e(`Extension Header Parameter "${o}" is missing`);
729
769
  if (s.get(o) && a[o] === void 0)
730
770
  throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`);
731
771
  }
732
772
  return new Set(a.crit);
733
- }, Vt = (e, t) => {
773
+ }, Ft = (e, t) => {
734
774
  if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
735
775
  throw new TypeError(`"${e}" option must be an array of strings`);
736
776
  if (t)
737
777
  return new Set(t);
738
778
  };
739
- function ge(e) {
779
+ function we(e) {
740
780
  return q(e) && typeof e.kty == "string";
741
781
  }
742
- function Bt(e) {
782
+ function qt(e) {
743
783
  return e.kty !== "oct" && typeof e.d == "string";
744
784
  }
745
- function Ft(e) {
785
+ function zt(e) {
746
786
  return e.kty !== "oct" && typeof e.d > "u";
747
787
  }
748
- function qt(e) {
788
+ function Qt(e) {
749
789
  return e.kty === "oct" && typeof e.k == "string";
750
790
  }
751
791
  let C;
752
- const _e = async (e, t, r, a = !1) => {
792
+ const Ie = async (e, t, r, a = !1) => {
753
793
  C || (C = /* @__PURE__ */ new WeakMap());
754
794
  let n = C.get(e);
755
795
  if (n != null && n[r])
756
796
  return n[r];
757
- const s = await Gt({ ...t, alg: r });
797
+ const s = await jt({ ...t, alg: r });
758
798
  return a && Object.freeze(e), n ? n[r] = s : C.set(e, { [r]: s }), s;
759
- }, zt = (e, t) => {
799
+ }, Xt = (e, t) => {
760
800
  var r;
761
801
  C || (C = /* @__PURE__ */ new WeakMap());
762
802
  let a = C.get(e);
@@ -842,26 +882,26 @@ const _e = async (e, t, r, a = !1) => {
842
882
  if (!o)
843
883
  throw new TypeError("given KeyObject instance cannot be used for this algorithm");
844
884
  return a ? a[t] = o : C.set(e, { [t]: o }), o;
845
- }, Qt = async (e, t) => {
846
- if (e instanceof Uint8Array || Me(e))
885
+ }, Zt = async (e, t) => {
886
+ if (e instanceof Uint8Array || je(e))
847
887
  return e;
848
- if (je(e)) {
888
+ if (Ve(e)) {
849
889
  if (e.type === "secret")
850
890
  return e.export();
851
891
  if ("toCryptoKey" in e && typeof e.toCryptoKey == "function")
852
892
  try {
853
- return zt(e, t);
893
+ return Xt(e, t);
854
894
  } catch (a) {
855
895
  if (a instanceof TypeError)
856
896
  throw a;
857
897
  }
858
898
  let r = e.export({ format: "jwk" });
859
- return _e(e, r, t);
899
+ return Ie(e, r, t);
860
900
  }
861
- if (ge(e))
862
- return e.k ? F(e.k) : _e(e, e, t, !0);
901
+ if (we(e))
902
+ return e.k ? F(e.k) : Ie(e, e, t, !0);
863
903
  throw new Error("unreachable");
864
- }, Y = (e) => e?.[Symbol.toStringTag], Ee = (e, t, r) => {
904
+ }, Y = (e) => e?.[Symbol.toStringTag], ge = (e, t, r) => {
865
905
  var a, n;
866
906
  if (t.use !== void 0) {
867
907
  let s;
@@ -905,34 +945,34 @@ const _e = async (e, t, r, a = !1) => {
905
945
  throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${s}" when present`);
906
946
  }
907
947
  return !0;
908
- }, Xt = (e, t, r) => {
948
+ }, er = (e, t, r) => {
909
949
  if (!(t instanceof Uint8Array)) {
910
- if (ge(t)) {
911
- if (qt(t) && Ee(e, t, r))
950
+ if (we(t)) {
951
+ if (Qt(t) && ge(e, t, r))
912
952
  return;
913
953
  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');
914
954
  }
915
- if (!Ve(t))
916
- throw new TypeError(Ge(e, t, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
955
+ if (!Be(t))
956
+ throw new TypeError(Me(e, t, "CryptoKey", "KeyObject", "JSON Web Key", "Uint8Array"));
917
957
  if (t.type !== "secret")
918
958
  throw new TypeError(`${Y(t)} instances for symmetric algorithms must be of type "secret"`);
919
959
  }
920
- }, Zt = (e, t, r) => {
921
- if (ge(t))
960
+ }, tr = (e, t, r) => {
961
+ if (we(t))
922
962
  switch (r) {
923
963
  case "decrypt":
924
964
  case "sign":
925
- if (Bt(t) && Ee(e, t, r))
965
+ if (qt(t) && ge(e, t, r))
926
966
  return;
927
967
  throw new TypeError("JSON Web Key for this operation be a private JWK");
928
968
  case "encrypt":
929
969
  case "verify":
930
- if (Ft(t) && Ee(e, t, r))
970
+ if (zt(t) && ge(e, t, r))
931
971
  return;
932
972
  throw new TypeError("JSON Web Key for this operation be a public JWK");
933
973
  }
934
- if (!Ve(t))
935
- throw new TypeError(Ge(e, t, "CryptoKey", "KeyObject", "JSON Web Key"));
974
+ if (!Be(t))
975
+ throw new TypeError(Me(e, t, "CryptoKey", "KeyObject", "JSON Web Key"));
936
976
  if (t.type === "secret")
937
977
  throw new TypeError(`${Y(t)} instances for asymmetric algorithms must not be of type "secret"`);
938
978
  if (t.type === "public")
@@ -949,9 +989,9 @@ const _e = async (e, t, r, a = !1) => {
949
989
  case "encrypt":
950
990
  throw new TypeError(`${Y(t)} instances for asymmetric algorithm encryption must be of type "public"`);
951
991
  }
952
- }, er = (e, t, r) => {
953
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(e) || /^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(e) ? Xt(e, t, r) : Zt(e, t, r);
954
- }, tr = (e, t) => {
992
+ }, rr = (e, t, r) => {
993
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(e) || /^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(e) ? er(e, t, r) : tr(e, t, r);
994
+ }, ar = (e, t) => {
955
995
  const r = `SHA-${e.slice(-3)}`;
956
996
  switch (e) {
957
997
  case "HS256":
@@ -974,100 +1014,100 @@ const _e = async (e, t, r, a = !1) => {
974
1014
  case "EdDSA":
975
1015
  return { name: "Ed25519" };
976
1016
  default:
977
- throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
1017
+ throw new k(`alg ${e} is not supported either by JOSE or your javascript runtime`);
978
1018
  }
979
- }, rr = async (e, t, r) => {
1019
+ }, nr = async (e, t, r) => {
980
1020
  if (t instanceof Uint8Array) {
981
1021
  if (!e.startsWith("HS"))
982
- throw new TypeError(Ut(t, "CryptoKey", "KeyObject", "JSON Web Key"));
1022
+ throw new TypeError(Lt(t, "CryptoKey", "KeyObject", "JSON Web Key"));
983
1023
  return crypto.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
984
1024
  }
985
- return Dt(t, e, r), t;
986
- }, ar = async (e, t, r, a) => {
987
- const n = await rr(e, t, "verify");
988
- $t(e, n);
989
- const s = tr(e, n.algorithm);
1025
+ return Ht(t, e, r), t;
1026
+ }, sr = async (e, t, r, a) => {
1027
+ const n = await nr(e, t, "verify");
1028
+ Jt(e, n);
1029
+ const s = ar(e, n.algorithm);
990
1030
  try {
991
1031
  return await crypto.subtle.verify(s, n, r, a);
992
1032
  } catch {
993
1033
  return !1;
994
1034
  }
995
1035
  };
996
- async function nr(e, t, r) {
1036
+ async function or(e, t, r) {
997
1037
  if (!q(e))
998
- throw new g("Flattened JWS must be an object");
1038
+ throw new w("Flattened JWS must be an object");
999
1039
  if (e.protected === void 0 && e.header === void 0)
1000
- throw new g('Flattened JWS must have either of the "protected" or "header" members');
1040
+ throw new w('Flattened JWS must have either of the "protected" or "header" members');
1001
1041
  if (e.protected !== void 0 && typeof e.protected != "string")
1002
- throw new g("JWS Protected Header incorrect type");
1042
+ throw new w("JWS Protected Header incorrect type");
1003
1043
  if (e.payload === void 0)
1004
- throw new g("JWS Payload missing");
1044
+ throw new w("JWS Payload missing");
1005
1045
  if (typeof e.signature != "string")
1006
- throw new g("JWS Signature missing or incorrect type");
1046
+ throw new w("JWS Signature missing or incorrect type");
1007
1047
  if (e.header !== void 0 && !q(e.header))
1008
- throw new g("JWS Unprotected Header incorrect type");
1048
+ throw new w("JWS Unprotected Header incorrect type");
1009
1049
  let a = {};
1010
1050
  if (e.protected)
1011
1051
  try {
1012
1052
  const U = F(e.protected);
1013
1053
  a = JSON.parse(G.decode(U));
1014
1054
  } catch {
1015
- throw new g("JWS Protected Header is invalid");
1055
+ throw new w("JWS Protected Header is invalid");
1016
1056
  }
1017
- if (!Ht(a, e.header))
1018
- throw new g("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
1057
+ if (!$t(a, e.header))
1058
+ throw new w("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
1019
1059
  const n = {
1020
1060
  ...a,
1021
1061
  ...e.header
1022
- }, s = jt(g, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, a, n);
1062
+ }, s = Bt(w, /* @__PURE__ */ new Map([["b64", !0]]), r?.crit, a, n);
1023
1063
  let o = !0;
1024
1064
  if (s.has("b64") && (o = a.b64, typeof o != "boolean"))
1025
- throw new g('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
1065
+ throw new w('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
1026
1066
  const { alg: i } = n;
1027
1067
  if (typeof i != "string" || !i)
1028
- throw new g('JWS "alg" (Algorithm) Header Parameter missing or invalid');
1029
- const c = r && Vt("algorithms", r.algorithms);
1068
+ throw new w('JWS "alg" (Algorithm) Header Parameter missing or invalid');
1069
+ const c = r && Ft("algorithms", r.algorithms);
1030
1070
  if (c && !c.has(i))
1031
- throw new Je('"alg" (Algorithm) Header Parameter value not allowed');
1071
+ throw new Ye('"alg" (Algorithm) Header Parameter value not allowed');
1032
1072
  if (o) {
1033
1073
  if (typeof e.payload != "string")
1034
- throw new g("JWS Payload must be a string");
1074
+ throw new w("JWS Payload must be a string");
1035
1075
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
1036
- throw new g("JWS Payload must be a string or an Uint8Array instance");
1037
- let f = !1;
1038
- typeof t == "function" && (t = await t(a, e), f = !0), er(i, t, "verify");
1039
- const y = Ct(Z.encode(e.protected ?? ""), Z.encode("."), typeof e.payload == "string" ? Z.encode(e.payload) : e.payload);
1040
- let d;
1076
+ throw new w("JWS Payload must be a string or an Uint8Array instance");
1077
+ let m = !1;
1078
+ typeof t == "function" && (t = await t(a, e), m = !0), rr(i, t, "verify");
1079
+ const d = Nt(Z.encode(e.protected ?? ""), Z.encode("."), typeof e.payload == "string" ? Z.encode(e.payload) : e.payload);
1080
+ let p;
1041
1081
  try {
1042
- d = F(e.signature);
1082
+ p = F(e.signature);
1043
1083
  } catch {
1044
- throw new g("Failed to base64url decode the signature");
1084
+ throw new w("Failed to base64url decode the signature");
1045
1085
  }
1046
- const h = await Qt(t, i);
1047
- if (!await ar(i, h, d, y))
1048
- throw new Ye();
1049
- let E;
1086
+ const E = await Zt(t, i);
1087
+ if (!await sr(i, E, p, d))
1088
+ throw new xe();
1089
+ let y;
1050
1090
  if (o)
1051
1091
  try {
1052
- E = F(e.payload);
1092
+ y = F(e.payload);
1053
1093
  } catch {
1054
- throw new g("Failed to base64url decode the payload");
1094
+ throw new w("Failed to base64url decode the payload");
1055
1095
  }
1056
- else typeof e.payload == "string" ? E = Z.encode(e.payload) : E = e.payload;
1057
- const b = { payload: E };
1058
- return e.protected !== void 0 && (b.protectedHeader = a), e.header !== void 0 && (b.unprotectedHeader = e.header), f ? { ...b, key: h } : b;
1096
+ else typeof e.payload == "string" ? y = Z.encode(e.payload) : y = e.payload;
1097
+ const h = { payload: y };
1098
+ return e.protected !== void 0 && (h.protectedHeader = a), e.header !== void 0 && (h.unprotectedHeader = e.header), m ? { ...h, key: E } : h;
1059
1099
  }
1060
- async function sr(e, t, r) {
1100
+ async function ir(e, t, r) {
1061
1101
  if (e instanceof Uint8Array && (e = G.decode(e)), typeof e != "string")
1062
- throw new g("Compact JWS must be a string or Uint8Array");
1102
+ throw new w("Compact JWS must be a string or Uint8Array");
1063
1103
  const { 0: a, 1: n, 2: s, length: o } = e.split(".");
1064
1104
  if (o !== 3)
1065
- throw new g("Invalid Compact JWS");
1066
- const i = await nr({ payload: n, protected: a, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
1105
+ throw new w("Invalid Compact JWS");
1106
+ const i = await or({ payload: n, protected: a, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
1067
1107
  return typeof t == "function" ? { ...c, key: i.key } : c;
1068
1108
  }
1069
- const or = (e) => Math.floor(e.getTime() / 1e3), Be = 60, Fe = Be * 60, we = Fe * 24, ir = we * 7, cr = we * 365.25, ur = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Ie = (e) => {
1070
- const t = ur.exec(e);
1109
+ const cr = (e) => Math.floor(e.getTime() / 1e3), Fe = 60, qe = Fe * 60, Se = qe * 24, ur = Se * 7, lr = Se * 365.25, dr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Oe = (e) => {
1110
+ const t = dr.exec(e);
1071
1111
  if (!t || t[4] && t[1])
1072
1112
  throw new TypeError("Invalid time period format");
1073
1113
  const r = parseFloat(t[2]), a = t[3].toLowerCase();
@@ -1085,32 +1125,32 @@ const or = (e) => Math.floor(e.getTime() / 1e3), Be = 60, Fe = Be * 60, we = Fe
1085
1125
  case "min":
1086
1126
  case "mins":
1087
1127
  case "m":
1088
- n = Math.round(r * Be);
1128
+ n = Math.round(r * Fe);
1089
1129
  break;
1090
1130
  case "hour":
1091
1131
  case "hours":
1092
1132
  case "hr":
1093
1133
  case "hrs":
1094
1134
  case "h":
1095
- n = Math.round(r * Fe);
1135
+ n = Math.round(r * qe);
1096
1136
  break;
1097
1137
  case "day":
1098
1138
  case "days":
1099
1139
  case "d":
1100
- n = Math.round(r * we);
1140
+ n = Math.round(r * Se);
1101
1141
  break;
1102
1142
  case "week":
1103
1143
  case "weeks":
1104
1144
  case "w":
1105
- n = Math.round(r * ir);
1145
+ n = Math.round(r * ur);
1106
1146
  break;
1107
1147
  default:
1108
- n = Math.round(r * cr);
1148
+ n = Math.round(r * lr);
1109
1149
  break;
1110
1150
  }
1111
1151
  return t[1] === "-" || t[4] === "ago" ? -n : n;
1112
- }, ve = (e) => e.toLowerCase().replace(/^application\//, ""), lr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1;
1113
- function dr(e, t, r = {}) {
1152
+ }, ve = (e) => e.toLowerCase().replace(/^application\//, ""), hr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1;
1153
+ function yr(e, t, r = {}) {
1114
1154
  let a;
1115
1155
  try {
1116
1156
  a = JSON.parse(G.decode(t));
@@ -1121,64 +1161,64 @@ function dr(e, t, r = {}) {
1121
1161
  const { typ: n } = r;
1122
1162
  if (n && (typeof e.typ != "string" || ve(e.typ) !== ve(n)))
1123
1163
  throw new R('unexpected "typ" JWT header value', a, "typ", "check_failed");
1124
- const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: f } = r, y = [...s];
1125
- f !== void 0 && y.push("iat"), c !== void 0 && y.push("aud"), i !== void 0 && y.push("sub"), o !== void 0 && y.push("iss");
1126
- for (const b of new Set(y.reverse()))
1127
- if (!(b in a))
1128
- throw new R(`missing required "${b}" claim`, a, b, "missing");
1164
+ const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: m } = r, d = [...s];
1165
+ m !== void 0 && d.push("iat"), c !== void 0 && d.push("aud"), i !== void 0 && d.push("sub"), o !== void 0 && d.push("iss");
1166
+ for (const h of new Set(d.reverse()))
1167
+ if (!(h in a))
1168
+ throw new R(`missing required "${h}" claim`, a, h, "missing");
1129
1169
  if (o && !(Array.isArray(o) ? o : [o]).includes(a.iss))
1130
1170
  throw new R('unexpected "iss" claim value', a, "iss", "check_failed");
1131
1171
  if (i && a.sub !== i)
1132
1172
  throw new R('unexpected "sub" claim value', a, "sub", "check_failed");
1133
- if (c && !lr(a.aud, typeof c == "string" ? [c] : c))
1173
+ if (c && !hr(a.aud, typeof c == "string" ? [c] : c))
1134
1174
  throw new R('unexpected "aud" claim value', a, "aud", "check_failed");
1135
- let d;
1175
+ let p;
1136
1176
  switch (typeof r.clockTolerance) {
1137
1177
  case "string":
1138
- d = Ie(r.clockTolerance);
1178
+ p = Oe(r.clockTolerance);
1139
1179
  break;
1140
1180
  case "number":
1141
- d = r.clockTolerance;
1181
+ p = r.clockTolerance;
1142
1182
  break;
1143
1183
  case "undefined":
1144
- d = 0;
1184
+ p = 0;
1145
1185
  break;
1146
1186
  default:
1147
1187
  throw new TypeError("Invalid clockTolerance option type");
1148
1188
  }
1149
- const { currentDate: h } = r, E = or(h || /* @__PURE__ */ new Date());
1150
- if ((a.iat !== void 0 || f) && typeof a.iat != "number")
1189
+ const { currentDate: E } = r, y = cr(E || /* @__PURE__ */ new Date());
1190
+ if ((a.iat !== void 0 || m) && typeof a.iat != "number")
1151
1191
  throw new R('"iat" claim must be a number', a, "iat", "invalid");
1152
1192
  if (a.nbf !== void 0) {
1153
1193
  if (typeof a.nbf != "number")
1154
1194
  throw new R('"nbf" claim must be a number', a, "nbf", "invalid");
1155
- if (a.nbf > E + d)
1195
+ if (a.nbf > y + p)
1156
1196
  throw new R('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
1157
1197
  }
1158
1198
  if (a.exp !== void 0) {
1159
1199
  if (typeof a.exp != "number")
1160
1200
  throw new R('"exp" claim must be a number', a, "exp", "invalid");
1161
- if (a.exp <= E - d)
1162
- throw new fe('"exp" claim timestamp check failed', a, "exp", "check_failed");
1201
+ if (a.exp <= y - p)
1202
+ throw new Ee('"exp" claim timestamp check failed', a, "exp", "check_failed");
1163
1203
  }
1164
- if (f) {
1165
- const b = E - a.iat, U = typeof f == "number" ? f : Ie(f);
1166
- if (b - d > U)
1167
- throw new fe('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
1168
- if (b < 0 - d)
1204
+ if (m) {
1205
+ const h = y - a.iat, U = typeof m == "number" ? m : Oe(m);
1206
+ if (h - p > U)
1207
+ throw new Ee('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
1208
+ if (h < 0 - p)
1169
1209
  throw new R('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
1170
1210
  }
1171
1211
  return a;
1172
1212
  }
1173
- async function yr(e, t, r) {
1213
+ async function pr(e, t, r) {
1174
1214
  var a;
1175
- const n = await sr(e, t, r);
1215
+ const n = await ir(e, t, r);
1176
1216
  if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
1177
1217
  throw new _("JWTs MUST NOT use unencoded payload");
1178
- const s = { payload: dr(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
1218
+ const s = { payload: yr(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
1179
1219
  return typeof t == "function" ? { ...s, key: n.key } : s;
1180
1220
  }
1181
- function hr(e) {
1221
+ function fr(e) {
1182
1222
  if (typeof e != "string")
1183
1223
  throw new _("JWTs must use Compact JWS serialization, JWT must be a string");
1184
1224
  const { 1: t, length: r } = e.split(".");
@@ -1206,94 +1246,94 @@ function hr(e) {
1206
1246
  }
1207
1247
  const M = async (e) => {
1208
1248
  try {
1209
- const t = m.ALG, r = await Mt(Ot, t);
1210
- return await yr(e, r, {
1211
- issuer: m.ISSUER
1249
+ const t = g.ALG, r = await Vt(Pt, t);
1250
+ return await pr(e, r, {
1251
+ issuer: g.ISSUER
1212
1252
  });
1213
1253
  } catch {
1214
1254
  return;
1215
1255
  }
1216
- }, pr = (e) => {
1256
+ }, Er = (e) => {
1217
1257
  try {
1218
- return hr(e);
1258
+ return fr(e);
1219
1259
  } catch {
1220
1260
  return;
1221
1261
  }
1222
- }, S = [];
1262
+ }, A = [];
1223
1263
  for (let e = 0; e < 256; ++e)
1224
- S.push((e + 256).toString(16).slice(1));
1225
- function fr(e, t = 0) {
1226
- 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();
1264
+ A.push((e + 256).toString(16).slice(1));
1265
+ function gr(e, t = 0) {
1266
+ return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
1227
1267
  }
1228
- let de;
1229
- const Er = new Uint8Array(16);
1230
- function mr() {
1231
- if (!de) {
1268
+ let he;
1269
+ const mr = new Uint8Array(16);
1270
+ function wr() {
1271
+ if (!he) {
1232
1272
  if (typeof crypto > "u" || !crypto.getRandomValues)
1233
1273
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1234
- de = crypto.getRandomValues.bind(crypto);
1274
+ he = crypto.getRandomValues.bind(crypto);
1235
1275
  }
1236
- return de(Er);
1276
+ return he(mr);
1237
1277
  }
1238
- const gr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ke = { randomUUID: gr };
1239
- function Oe(e, t, r) {
1278
+ const Sr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ke = { randomUUID: Sr };
1279
+ function Ce(e, t, r) {
1240
1280
  var a;
1241
1281
  if (ke.randomUUID && !e)
1242
1282
  return ke.randomUUID();
1243
1283
  e = e || {};
1244
- const n = e.random ?? ((a = e.rng) == null ? void 0 : a.call(e)) ?? mr();
1284
+ const n = e.random ?? ((a = e.rng) == null ? void 0 : a.call(e)) ?? wr();
1245
1285
  if (n.length < 16)
1246
1286
  throw new Error("Random bytes length must be >= 16");
1247
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, fr(n);
1287
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, gr(n);
1248
1288
  }
1249
- const Ce = globalThis.crypto, wr = (e) => `${Oe()}${Oe()}`.slice(0, e), Sr = (e) => btoa(
1289
+ const Pe = globalThis.crypto, Ar = (e) => `${Ce()}${Ce()}`.slice(0, e), Tr = (e) => btoa(
1250
1290
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1251
1291
  );
1252
- async function Ar(e) {
1253
- if (!Ce.subtle)
1292
+ async function br(e) {
1293
+ if (!Pe.subtle)
1254
1294
  throw new Error(
1255
1295
  "crypto.subtle is available only in secure contexts (HTTPS)."
1256
1296
  );
1257
- const t = new TextEncoder().encode(e), r = await Ce.subtle.digest("SHA-256", t);
1258
- return Sr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1297
+ const t = new TextEncoder().encode(e), r = await Pe.subtle.digest("SHA-256", t);
1298
+ return Tr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1259
1299
  }
1260
- async function Tr(e) {
1261
- const r = wr(43), a = await Ar(r);
1300
+ async function Rr(e) {
1301
+ const r = Ar(43), a = await br(r);
1262
1302
  return {
1263
1303
  code_verifier: r,
1264
1304
  code_challenge: a
1265
1305
  };
1266
1306
  }
1267
- const Br = async (e, t) => {
1307
+ const qr = async (e, t) => {
1268
1308
  var r;
1269
1309
  const a = await M(e);
1270
- if (!a || !Array.isArray((r = a.payload) == null ? void 0 : r[m.SCOPES_KEY]))
1310
+ if (!a || !Array.isArray((r = a.payload) == null ? void 0 : r[g.SCOPES_KEY]))
1271
1311
  return !1;
1272
- const n = a.payload[m.SCOPES_KEY];
1312
+ const n = a.payload[g.SCOPES_KEY];
1273
1313
  return Array.isArray(t) ? t.every((s) => n.includes(s)) : Object.keys(t).some(
1274
1314
  (s) => t[s].every((o) => n.includes(o))
1275
1315
  );
1276
1316
  };
1277
- function qe(e, t) {
1317
+ function ze(e, t) {
1278
1318
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1279
1319
  }
1280
- const Pe = (e, t) => {
1320
+ const Ne = (e, t) => {
1281
1321
  const r = JSON.stringify(
1282
1322
  typeof t == "function" ? t() : t
1283
1323
  );
1284
- window.localStorage.setItem(e, r), qe(e, r);
1285
- }, br = (e) => {
1286
- window.localStorage.removeItem(e), qe(e, null);
1287
- }, Ke = (e) => window.localStorage.getItem(e), Rr = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1324
+ window.localStorage.setItem(e, r), ze(e, r);
1325
+ }, _r = (e) => {
1326
+ window.localStorage.removeItem(e), ze(e, null);
1327
+ }, Ke = (e) => window.localStorage.getItem(e), Ir = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1288
1328
  function ee({
1289
1329
  key: e,
1290
1330
  initialValue: t
1291
1331
  }) {
1292
- const r = ft(Rr, () => Ke(e)), a = D(
1332
+ const r = Et(Ir, () => Ke(e)), a = D(
1293
1333
  (o) => {
1294
1334
  try {
1295
1335
  const i = typeof o == "function" ? o(JSON.parse(r)) : o;
1296
- i == null ? br(e) : Pe(e, i);
1336
+ i == null ? _r(e) : Ne(e, i);
1297
1337
  } catch (i) {
1298
1338
  console.warn(i);
1299
1339
  }
@@ -1304,41 +1344,41 @@ function ee({
1304
1344
  }, [t, a]), s = D(() => {
1305
1345
  a(null);
1306
1346
  }, [a]);
1307
- return De(() => {
1347
+ return Ue(() => {
1308
1348
  try {
1309
- Ke(e) === null && typeof t < "u" && Pe(e, t);
1349
+ Ke(e) === null && typeof t < "u" && Ne(e, t);
1310
1350
  } catch (o) {
1311
1351
  console.warn(o);
1312
1352
  }
1313
1353
  }, [e, t]), [r ? JSON.parse(r) : null, a, n, s];
1314
1354
  }
1315
- const A = [];
1355
+ const T = [];
1316
1356
  for (let e = 0; e < 256; ++e)
1317
- A.push((e + 256).toString(16).slice(1));
1318
- function _r(e, t = 0) {
1319
- return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
1357
+ T.push((e + 256).toString(16).slice(1));
1358
+ function Or(e, t = 0) {
1359
+ return (T[e[t + 0]] + T[e[t + 1]] + T[e[t + 2]] + T[e[t + 3]] + "-" + T[e[t + 4]] + T[e[t + 5]] + "-" + T[e[t + 6]] + T[e[t + 7]] + "-" + T[e[t + 8]] + T[e[t + 9]] + "-" + T[e[t + 10]] + T[e[t + 11]] + T[e[t + 12]] + T[e[t + 13]] + T[e[t + 14]] + T[e[t + 15]]).toLowerCase();
1320
1360
  }
1321
1361
  let ye;
1322
- const Ir = new Uint8Array(16);
1323
- function vr() {
1362
+ const vr = new Uint8Array(16);
1363
+ function kr() {
1324
1364
  if (!ye) {
1325
1365
  if (typeof crypto > "u" || !crypto.getRandomValues)
1326
1366
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1327
1367
  ye = crypto.getRandomValues.bind(crypto);
1328
1368
  }
1329
- return ye(Ir);
1369
+ return ye(vr);
1330
1370
  }
1331
- const kr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ne = { randomUUID: kr };
1332
- function he(e, t, r) {
1333
- if (Ne.randomUUID && !e)
1334
- return Ne.randomUUID();
1371
+ const Cr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), De = { randomUUID: Cr };
1372
+ function pe(e, t, r) {
1373
+ if (De.randomUUID && !e)
1374
+ return De.randomUUID();
1335
1375
  e = e || {};
1336
- const a = e.random ?? e.rng?.() ?? vr();
1376
+ const a = e.random ?? e.rng?.() ?? kr();
1337
1377
  if (a.length < 16)
1338
1378
  throw new Error("Random bytes length must be >= 16");
1339
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, _r(a);
1379
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Or(a);
1340
1380
  }
1341
- const L = "Your session has expired. For your security, please log in again to continue.", Or = "Your session has been successfully terminated.", pe = "Login failed. Please try again.", Cr = "Error getting access token, please re-authenticate.", Pr = "You forgot to wrap your component in <AuthProvider>.", te = "@@auth@@", B = "LOADING", ne = "LOGIN", ze = "LOGOUT", z = "success", v = "failure", Qe = "include", Xe = "POST", Ze = "application/json", re = {
1381
+ const L = "Your session has expired. For your security, please log in again to continue.", Pr = "Your session has been successfully terminated.", fe = "Login failed. Please try again.", Nr = "Error getting access token, please re-authenticate.", Kr = "You forgot to wrap your component in <AuthProvider>.", te = "@@auth@@", B = "LOADING", ne = "LOGIN", Qe = "LOGOUT", z = "success", O = "failure", Xe = "include", Ze = "POST", et = "application/json", re = {
1342
1382
  GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1343
1383
  $clientId: String!,
1344
1384
  $username: String!,
@@ -1445,12 +1485,12 @@ const L = "Your session has expired. For your security, please log in again to c
1445
1485
  }) => {
1446
1486
  try {
1447
1487
  const s = `Bearer ${e}`, o = await fetch(`${n}/graphql`, {
1448
- credentials: Qe,
1449
- method: Xe,
1488
+ credentials: Xe,
1489
+ method: Ze,
1450
1490
  headers: {
1451
1491
  authorization: s,
1452
- "Content-Type": Ze,
1453
- [We.CLIENT_ID]: `${r}`
1492
+ "Content-Type": et,
1493
+ [Je.CLIENT_ID]: `${r}`
1454
1494
  },
1455
1495
  body: JSON.stringify({
1456
1496
  query: t.schema,
@@ -1458,14 +1498,14 @@ const L = "Your session has expired. For your security, please log in again to c
1458
1498
  })
1459
1499
  });
1460
1500
  if (o.status !== 200)
1461
- return { status: v, data: [] };
1501
+ return { status: O, data: [] };
1462
1502
  const { data: i } = await o.json();
1463
1503
  return {
1464
1504
  status: z,
1465
1505
  data: i[t.method]
1466
1506
  };
1467
1507
  } catch (s) {
1468
- return console.error(s), { status: v, data: [] };
1508
+ return console.error(s), { status: O, data: [] };
1469
1509
  }
1470
1510
  }, ie = async ({
1471
1511
  type: e,
@@ -1475,39 +1515,39 @@ const L = "Your session has expired. For your security, please log in again to c
1475
1515
  }) => {
1476
1516
  try {
1477
1517
  const n = await fetch(`${a}/${e}`, {
1478
- credentials: Qe,
1479
- method: Xe,
1518
+ credentials: Xe,
1519
+ method: Ze,
1480
1520
  headers: {
1481
- "Content-Type": Ze,
1482
- [We.CLIENT_ID]: `${t}`
1521
+ "Content-Type": et,
1522
+ [Je.CLIENT_ID]: `${t}`
1483
1523
  },
1484
1524
  body: JSON.stringify(r)
1485
1525
  });
1486
1526
  if (n.status !== 200)
1487
- return { status: v, data: [] };
1527
+ return { status: O, data: [] };
1488
1528
  const { data: s } = await n.json();
1489
1529
  return {
1490
1530
  status: z,
1491
1531
  data: s || []
1492
1532
  };
1493
1533
  } catch (n) {
1494
- return console.error(n), { status: v, data: [] };
1534
+ return console.error(n), { status: O, data: [] };
1495
1535
  }
1496
- }, Kr = process.env.NODE_ENV === "production", Nr = !Kr, et = {
1536
+ }, Dr = process.env.NODE_ENV === "production", Ur = !Dr, tt = {
1497
1537
  isLoading: !0,
1498
1538
  isAuthenticated: !1,
1499
1539
  user: void 0,
1500
1540
  logoutReason: "",
1501
1541
  debug: !1,
1502
1542
  authenticationType: ""
1503
- }, Dr = (e) => {
1543
+ }, Hr = (e) => {
1504
1544
  try {
1505
- const t = pr(e);
1506
- return t ? t[m.USER_ID_KEY] : "";
1545
+ const t = Er(e);
1546
+ return t ? t[g.USER_ID_KEY] : "";
1507
1547
  } catch {
1508
1548
  return "";
1509
1549
  }
1510
- }, Ur = async ({
1550
+ }, Lr = async ({
1511
1551
  userId: e,
1512
1552
  clientId: t,
1513
1553
  domain: r,
@@ -1525,14 +1565,14 @@ const L = "Your session has expired. For your security, please log in again to c
1525
1565
  domain: r,
1526
1566
  idToken: a
1527
1567
  }
1528
- }))?.status || v
1568
+ }))?.status || O
1529
1569
  };
1530
1570
  } catch {
1531
1571
  return {
1532
- status: v
1572
+ status: O
1533
1573
  };
1534
1574
  }
1535
- }, Hr = async ({
1575
+ }, $r = async ({
1536
1576
  username: e,
1537
1577
  password: t,
1538
1578
  clientId: r,
@@ -1542,12 +1582,12 @@ const L = "Your session has expired. For your security, please log in again to c
1542
1582
  code: o,
1543
1583
  code_verifier: i,
1544
1584
  domain: c,
1545
- ua: f,
1546
- endpoint: y
1585
+ ua: m,
1586
+ endpoint: d
1547
1587
  }) => {
1548
1588
  try {
1549
- const d = await ie({
1550
- endpoint: y,
1589
+ const p = await ie({
1590
+ endpoint: d,
1551
1591
  type: oe.LOGIN,
1552
1592
  clientId: r,
1553
1593
  params: {
@@ -1559,15 +1599,15 @@ const L = "Your session has expired. For your security, please log in again to c
1559
1599
  code: o,
1560
1600
  code_verifier: i,
1561
1601
  domain: c,
1562
- ua: f
1602
+ ua: m
1563
1603
  }
1564
- }), h = await M(d?.data?.idToken);
1565
- return h && h.payload[m.USER_ID_KEY] !== "" && h.payload[m.NONCE_KEY] === a ? {
1566
- idToken: d.data.idToken,
1567
- accessToken: d.data.accessToken,
1568
- refreshToken: d.data.refreshToken,
1569
- userId: h.payload[m.USER_ID_KEY],
1570
- email: h.payload[m.EMAIL_KEY],
1604
+ }), E = await M(p?.data?.idToken);
1605
+ return E && E.payload[g.USER_ID_KEY] !== "" && E.payload[g.NONCE_KEY] === a ? {
1606
+ idToken: p.data.idToken,
1607
+ accessToken: p.data.accessToken,
1608
+ refreshToken: p.data.refreshToken,
1609
+ userId: E.payload[g.USER_ID_KEY],
1610
+ email: E.payload[g.EMAIL_KEY],
1571
1611
  status: !0
1572
1612
  } : {
1573
1613
  status: !1
@@ -1577,7 +1617,7 @@ const L = "Your session has expired. For your security, please log in again to c
1577
1617
  status: !1
1578
1618
  };
1579
1619
  }
1580
- }, Lr = async ({
1620
+ }, Wr = async ({
1581
1621
  nonce: e,
1582
1622
  clientId: t,
1583
1623
  code_challenge: r,
@@ -1598,16 +1638,16 @@ const L = "Your session has expired. For your security, please log in again to c
1598
1638
  status: z,
1599
1639
  data: n.data.code
1600
1640
  } : {
1601
- status: v,
1641
+ status: O,
1602
1642
  data: ""
1603
1643
  };
1604
1644
  } catch {
1605
1645
  return {
1606
- status: v,
1646
+ status: O,
1607
1647
  data: ""
1608
1648
  };
1609
1649
  }
1610
- }, $r = async ({
1650
+ }, Jr = async ({
1611
1651
  clientId: e,
1612
1652
  userId: t,
1613
1653
  nonce: r,
@@ -1630,10 +1670,10 @@ const L = "Your session has expired. For your security, please log in again to c
1630
1670
  domain: s
1631
1671
  }
1632
1672
  }), c = await M(i?.data?.accessToken);
1633
- return c && c.payload[m.USER_ID_KEY] !== "" && c.payload[m.NONCE_KEY] === r ? {
1673
+ return c && c.payload[g.USER_ID_KEY] !== "" && c.payload[g.NONCE_KEY] === r ? {
1634
1674
  accessToken: i.data.accessToken,
1635
1675
  refreshToken: i.data.refreshToken,
1636
- userId: c.payload[m.USER_ID_KEY],
1676
+ userId: c.payload[g.USER_ID_KEY],
1637
1677
  status: !0
1638
1678
  } : {
1639
1679
  status: !1
@@ -1644,7 +1684,7 @@ const L = "Your session has expired. For your security, please log in again to c
1644
1684
  };
1645
1685
  }
1646
1686
  };
1647
- class Wr {
1687
+ class Yr {
1648
1688
  constructor(t = null, r = null) {
1649
1689
  X(this, "refreshTokenPromise", null);
1650
1690
  X(this, "accessToken");
@@ -1679,8 +1719,8 @@ class Wr {
1679
1719
  domain: s
1680
1720
  }) {
1681
1721
  const o = await M(this.refreshToken);
1682
- if (o && o.payload[m.USER_ID_KEY] !== "") {
1683
- const i = await $r({
1722
+ if (o && o.payload[g.USER_ID_KEY] !== "") {
1723
+ const i = await Jr({
1684
1724
  endpoint: t,
1685
1725
  clientId: r,
1686
1726
  userId: a,
@@ -1694,22 +1734,22 @@ class Wr {
1694
1734
  newAccessToken: i.accessToken,
1695
1735
  newRefreshToken: i.refreshToken
1696
1736
  }) : {
1697
- status: v
1737
+ status: O
1698
1738
  };
1699
1739
  } else
1700
1740
  return {
1701
- status: v
1741
+ status: O
1702
1742
  };
1703
1743
  }
1704
1744
  }
1705
- const Jr = (e) => D(
1745
+ const xr = (e) => D(
1706
1746
  (...t) => {
1707
1747
  e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1708
1748
  },
1709
1749
  [e]
1710
1750
  ), J = () => {
1711
- throw new Error(Pr);
1712
- }, tt = Et({
1751
+ throw new Error(Kr);
1752
+ }, rt = gt({
1713
1753
  isAuthenticated: !1,
1714
1754
  isLoading: !1,
1715
1755
  login: J,
@@ -1720,11 +1760,11 @@ const Jr = (e) => D(
1720
1760
  loginWithPasskey: J,
1721
1761
  logoutReason: "",
1722
1762
  authenticationType: ""
1723
- }), Yr = pt.createContext({
1724
- state: et,
1763
+ }), Gr = ft.createContext({
1764
+ state: tt,
1725
1765
  dispatch: () => {
1726
1766
  }
1727
- }), xr = (e, t) => t?.type === B ? {
1767
+ }), Mr = (e, t) => t?.type === B ? {
1728
1768
  ...e,
1729
1769
  isLoading: t.payload.isLoading
1730
1770
  } : t?.type === ne ? {
@@ -1734,41 +1774,41 @@ const Jr = (e) => D(
1734
1774
  user: t.payload.user,
1735
1775
  authenticationType: t.payload.authenticationType,
1736
1776
  logoutReason: ""
1737
- } : t?.type === ze ? {
1777
+ } : t?.type === Qe ? {
1738
1778
  ...e,
1739
1779
  isLoading: !1,
1740
1780
  isAuthenticated: !1,
1741
1781
  user: void 0,
1742
1782
  authenticationType: "",
1743
1783
  logoutReason: t.payload.logoutReason
1744
- } : e, Fr = ({
1784
+ } : e, zr = ({
1745
1785
  children: e,
1746
1786
  sessionExpiration: t,
1747
1787
  clientId: r,
1748
1788
  domain: a = "",
1749
1789
  debug: n = !1,
1750
- endpoint: s = Nr ? "https://auth.gizmette.local.com:3003" : "https://mylogin.gizmette.com/auth"
1790
+ endpoint: s = Ur ? "https://auth.gizmette.local.com:3003" : "https://mylogin.gizmette.com/auth"
1751
1791
  }) => {
1752
- const [o, i] = mt(xr, {
1753
- ...et,
1792
+ const [o, i] = mt(Mr, {
1793
+ ...tt,
1754
1794
  debug: n
1755
- }), c = Jr(n), f = gt(!1), [y, d, , h] = ee({
1795
+ }), c = xr(n), m = wt(!1), [d, p, , E] = ee({
1756
1796
  key: `${te}::${r}::@@user@@`
1757
- }), [E, b, , U] = ee({
1797
+ }), [y, h, , U] = ee({
1758
1798
  key: `${te}::${r}::@@access@@`
1759
- }), [rt, ce, , Se] = ee(
1799
+ }), [at, ce, , Ae] = ee(
1760
1800
  {
1761
1801
  key: `${te}::${r}::@@refresh@@`
1762
1802
  }
1763
- ), [at, Ae, , Te] = ee({
1803
+ ), [nt, Te, , be] = ee({
1764
1804
  key: `${te}::${r}::@@nonce@@`
1765
- }), nt = new Wr(E, rt), Q = D(() => {
1766
- c("removeLocalStorage: removing local storage"), h(), U(), Se(), Te();
1805
+ }), st = new Yr(y, at), Q = D(() => {
1806
+ c("removeLocalStorage: removing local storage"), E(), U(), Ae(), be();
1767
1807
  }, [
1768
1808
  U,
1769
- h,
1770
- Te,
1771
- Se,
1809
+ E,
1810
+ be,
1811
+ Ae,
1772
1812
  c
1773
1813
  ]), j = D(
1774
1814
  (u) => {
@@ -1776,29 +1816,29 @@ const Jr = (e) => D(
1776
1816
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
1777
1817
  u
1778
1818
  ), i({
1779
- type: ze,
1819
+ type: Qe,
1780
1820
  payload: {
1781
1821
  logoutReason: u || L
1782
1822
  }
1783
1823
  }), Q(), i({ type: B, payload: { isLoading: !1 } });
1784
1824
  },
1785
1825
  [Q, c]
1786
- ), K = D(
1826
+ ), N = D(
1787
1827
  async (u) => {
1788
1828
  c("invalidateAndLogout: invalidating and logging out");
1789
- const { user: w } = o, l = w?.userId || Dr(y);
1829
+ const { user: S } = o, l = S?.userId || Hr(d);
1790
1830
  l || c(
1791
1831
  "invalidateAndLogout: user cannot be identified, logging out without userId"
1792
- ), await Ur({
1832
+ ), await Lr({
1793
1833
  userId: l,
1794
1834
  clientId: r,
1795
1835
  domain: a,
1796
- idToken: y,
1836
+ idToken: d,
1797
1837
  endpoint: s
1798
1838
  }), j(u || L);
1799
1839
  },
1800
1840
  [
1801
- y,
1841
+ d,
1802
1842
  o,
1803
1843
  r,
1804
1844
  a,
@@ -1807,56 +1847,56 @@ const Jr = (e) => D(
1807
1847
  s
1808
1848
  ]
1809
1849
  );
1810
- De(() => {
1811
- if (!f.current)
1812
- return o.isLoading && y !== null ? (async () => {
1850
+ Ue(() => {
1851
+ if (!m.current)
1852
+ return o.isLoading && d !== null ? (async () => {
1813
1853
  try {
1814
- const u = await M(y);
1815
- u && u.payload[m.USER_ID_KEY] !== "" ? (c("useEffect: setting the authentication state"), i({
1854
+ const u = await M(d);
1855
+ u && u.payload[g.USER_ID_KEY] !== "" ? (c("useEffect: setting the authentication state"), i({
1816
1856
  type: ne,
1817
1857
  payload: {
1818
- authenticationType: u.payload[m.AUTH_TYPE_KEY],
1858
+ authenticationType: u.payload[g.AUTH_TYPE_KEY],
1819
1859
  user: {
1820
- userId: u.payload[m.USER_ID_KEY],
1821
- username: u.payload[m.USERNAME_KEY],
1822
- email: u.payload[m.EMAIL_KEY]
1860
+ userId: u.payload[g.USER_ID_KEY],
1861
+ username: u.payload[g.USERNAME_KEY],
1862
+ email: u.payload[g.EMAIL_KEY]
1823
1863
  }
1824
1864
  }
1825
- })) : (c("useEffect: invalid JWT, invalidating and logging out"), await K(L));
1865
+ })) : (c("useEffect: invalid JWT, invalidating and logging out"), await N(L));
1826
1866
  } catch {
1827
1867
  c(
1828
1868
  "useEffect: exception validating JWT, invalidating and logging out"
1829
- ), await K(L);
1869
+ ), await N(L);
1830
1870
  }
1831
1871
  })() : (c("useEffect: setting the loading state to false"), i({ type: B, payload: { isLoading: !1 } })), () => {
1832
- f.current = !0;
1872
+ m.current = !0;
1833
1873
  };
1834
- }, [o.isLoading, y, K, c]);
1835
- const st = async (u, w) => {
1874
+ }, [o.isLoading, d, N, c]);
1875
+ const ot = async (u, S) => {
1836
1876
  i({ type: B, payload: { isLoading: !0 } }), Q();
1837
- const l = he();
1838
- Ae(l), c("login: Logging in with password");
1839
- const { code_verifier: N, code_challenge: dt } = await Tr(), be = await Lr({
1877
+ const l = pe();
1878
+ Te(l), c("login: Logging in with password");
1879
+ const { code_verifier: K, code_challenge: ht } = await Rr(), Re = await Wr({
1840
1880
  endpoint: s,
1841
1881
  nonce: l,
1842
1882
  clientId: r,
1843
- code_challenge: dt
1883
+ code_challenge: ht
1844
1884
  });
1845
- if (be.status) {
1846
- const H = await Hr({
1885
+ if (Re.status) {
1886
+ const H = await $r({
1847
1887
  endpoint: s,
1848
1888
  username: u,
1849
- password: w,
1889
+ password: S,
1850
1890
  clientId: r,
1851
1891
  sessionExpiration: t,
1852
1892
  nonce: l,
1853
1893
  type: x.CODE,
1854
- code: be.data,
1855
- code_verifier: N,
1894
+ code: Re.data,
1895
+ code_verifier: K,
1856
1896
  domain: a,
1857
1897
  ua: navigator.userAgent
1858
1898
  });
1859
- return H.status ? (d(H.idToken), b(H.accessToken), ce(H.refreshToken), i({
1899
+ return H.status ? (p(H.idToken), h(H.accessToken), ce(H.refreshToken), i({
1860
1900
  type: ne,
1861
1901
  payload: {
1862
1902
  authenticationType: x.CODE,
@@ -1866,46 +1906,46 @@ const Jr = (e) => D(
1866
1906
  email: H.email
1867
1907
  }
1868
1908
  }
1869
- }), !0) : (j(pe), !1);
1909
+ }), !0) : (j(fe), !1);
1870
1910
  }
1871
1911
  return !1;
1872
- }, ot = async (u) => {
1873
- u?.preventDefault(), await K(Or);
1874
- }, it = async () => {
1875
- const { isAuthenticated: u, user: w } = o;
1912
+ }, it = async (u) => {
1913
+ u?.preventDefault(), await N(Pr);
1914
+ }, ct = async () => {
1915
+ const { isAuthenticated: u, user: S } = o;
1876
1916
  try {
1877
- if (u && w && w.userId) {
1878
- if (E) {
1917
+ if (u && S && S.userId) {
1918
+ if (y) {
1879
1919
  c("getAccessToken");
1880
- const N = await M(E);
1881
- if (N && N.payload[m.USER_ID_KEY] !== "")
1882
- return E;
1920
+ const K = await M(y);
1921
+ if (K && K.payload[g.USER_ID_KEY] !== "")
1922
+ return y;
1883
1923
  }
1884
1924
  c("getAccessToken: invalid access token, trying to refresh it");
1885
- const l = await nt.refreshtoken({
1925
+ const l = await st.refreshtoken({
1886
1926
  endpoint: s,
1887
1927
  clientId: r,
1888
- userId: w.userId,
1889
- nonce: at,
1928
+ userId: S.userId,
1929
+ nonce: nt,
1890
1930
  domain: a
1891
1931
  });
1892
- return l.status && l.status === "success" && l.newAccessToken ? (b(l.newAccessToken), ce(l.newRefreshToken), l.newAccessToken) : (c(
1932
+ return l.status && l.status === "success" && l.newAccessToken ? (h(l.newAccessToken), ce(l.newRefreshToken), l.newAccessToken) : (c(
1893
1933
  "getAccessToken: invalid refresh token, need to re-authenticate"
1894
- ), await K(L), "");
1934
+ ), await N(L), "");
1895
1935
  }
1896
1936
  return c(
1897
1937
  "getAccessToken: user is not authenticated, cannot get access token"
1898
- ), await K(L), "";
1938
+ ), await N(L), "";
1899
1939
  } catch {
1900
1940
  return c(
1901
1941
  "getAccessToken: exception occurred, invalidating and logging out"
1902
- ), await K(Cr), "";
1942
+ ), await N(Nr), "";
1903
1943
  }
1904
- }, ct = () => o.isAuthenticated && y ? y : "", ut = async () => {
1944
+ }, ut = () => o.isAuthenticated && d ? d : "", lt = async () => {
1905
1945
  const { user: u } = o;
1906
- let w = await W({
1946
+ let S = await W({
1907
1947
  endpoint: s,
1908
- accessToken: E,
1948
+ accessToken: y,
1909
1949
  clientId: r,
1910
1950
  type: $.GET_REGISTRATION_OPTIONS,
1911
1951
  params: {
@@ -1914,12 +1954,14 @@ const Jr = (e) => D(
1914
1954
  username: u?.username
1915
1955
  }
1916
1956
  });
1917
- if (w.status)
1957
+ if (S.status)
1918
1958
  try {
1919
- const l = await bt(w.data);
1920
- return w = await W({
1959
+ const l = await _t({
1960
+ optionsJSON: S.data
1961
+ });
1962
+ return S = await W({
1921
1963
  endpoint: s,
1922
- accessToken: E,
1964
+ accessToken: y,
1923
1965
  clientId: r,
1924
1966
  type: $.VERIFY_REGISTRATION,
1925
1967
  params: {
@@ -1928,11 +1970,11 @@ const Jr = (e) => D(
1928
1970
  username: u?.username,
1929
1971
  registration: l
1930
1972
  }
1931
- }), !!(w.status && w.data.length > 0);
1973
+ }), !!(S.status && S.data.length > 0);
1932
1974
  } catch {
1933
1975
  return await W({
1934
1976
  endpoint: s,
1935
- accessToken: E,
1977
+ accessToken: y,
1936
1978
  clientId: r,
1937
1979
  type: $.VERIFY_REGISTRATION,
1938
1980
  params: {
@@ -1944,39 +1986,41 @@ const Jr = (e) => D(
1944
1986
  }), !1;
1945
1987
  }
1946
1988
  return !1;
1947
- }, lt = async () => {
1989
+ }, dt = async () => {
1948
1990
  i({ type: B, payload: { isLoading: !0 } }), Q();
1949
- const u = he();
1950
- Ae(u), c("loginWithPasskey");
1951
- const w = he();
1991
+ const u = pe();
1992
+ Te(u), c("loginWithPasskey");
1993
+ const S = pe();
1952
1994
  let l = await W({
1953
1995
  endpoint: s,
1954
- accessToken: E,
1996
+ accessToken: y,
1955
1997
  clientId: r,
1956
1998
  type: $.GET_AUTHENTICATION_OPTIONS,
1957
1999
  params: {
1958
- id: w,
2000
+ id: S,
1959
2001
  clientId: r
1960
2002
  }
1961
2003
  });
1962
2004
  if (l.status)
1963
2005
  try {
1964
- const N = await It(l.data);
2006
+ const K = await vt({
2007
+ optionsJSON: l.data
2008
+ });
1965
2009
  return l = await W({
1966
2010
  endpoint: s,
1967
- accessToken: E,
2011
+ accessToken: y,
1968
2012
  clientId: r,
1969
2013
  type: $.VERIFY_AUTHENTICATION,
1970
2014
  params: {
1971
2015
  clientId: r,
1972
- id: w,
1973
- authentication: N,
2016
+ id: S,
2017
+ authentication: K,
1974
2018
  nonce: u,
1975
2019
  domain: a,
1976
2020
  sessionExpiration: t,
1977
2021
  ua: navigator.userAgent
1978
2022
  }
1979
- }), l.data.status === z ? (d(l.data.idToken), b(l.data.accessToken), ce(l.data.refreshToken), i({
2023
+ }), l.data.status === z ? (p(l.data.idToken), h(l.data.accessToken), ce(l.data.refreshToken), i({
1980
2024
  type: ne,
1981
2025
  payload: {
1982
2026
  authenticationType: x.PASSKEY,
@@ -1986,44 +2030,44 @@ const Jr = (e) => D(
1986
2030
  email: l.data.email
1987
2031
  }
1988
2032
  }
1989
- }), !0) : (j(pe), !1);
2033
+ }), !0) : (j(fe), !1);
1990
2034
  } catch {
1991
2035
  return await W({
1992
2036
  endpoint: s,
1993
- accessToken: E,
2037
+ accessToken: y,
1994
2038
  clientId: r,
1995
2039
  type: $.VERIFY_AUTHENTICATION,
1996
2040
  params: {
1997
2041
  clientId: r,
1998
- id: w,
2042
+ id: S,
1999
2043
  authentication: {},
2000
2044
  nonce: u,
2001
2045
  domain: a,
2002
2046
  sessionExpiration: t
2003
2047
  }
2004
- }), j(pe), !1;
2048
+ }), j(fe), !1;
2005
2049
  }
2006
2050
  return !1;
2007
2051
  };
2008
- return /* @__PURE__ */ Re(Yr.Provider, { value: { state: o, dispatch: i }, children: /* @__PURE__ */ Re(
2009
- tt.Provider,
2052
+ return /* @__PURE__ */ _e(Gr.Provider, { value: { state: o, dispatch: i }, children: /* @__PURE__ */ _e(
2053
+ rt.Provider,
2010
2054
  {
2011
2055
  value: {
2012
2056
  ...o,
2013
- login: st,
2014
- logout: ot,
2015
- getAccessToken: it,
2016
- getIdToken: ct,
2017
- registeringForPasskey: ut,
2018
- loginWithPasskey: lt
2057
+ login: ot,
2058
+ logout: it,
2059
+ getAccessToken: ct,
2060
+ getIdToken: ut,
2061
+ registeringForPasskey: lt,
2062
+ loginWithPasskey: dt
2019
2063
  },
2020
2064
  children: e
2021
2065
  }
2022
2066
  ) });
2023
- }, qr = (e = tt) => wt(e);
2067
+ }, Qr = (e = rt) => St(e);
2024
2068
  export {
2025
2069
  x as AUTH_TYPES,
2026
- Fr as AuthProvider,
2027
- Br as isGranted,
2028
- qr as useAuth
2070
+ zr as AuthProvider,
2071
+ qr as isGranted,
2072
+ Qr as useAuth
2029
2073
  };