@versini/auth-provider 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,49 +1,49 @@
1
1
  var _t = Object.defineProperty;
2
2
  var vt = (e, t, n) => t in e ? _t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var B = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as ve } from "react/jsx-runtime";
5
- import kt, { useSyncExternalStore as Pt, useCallback as x, useEffect as Se, createContext as Ct, useReducer as Ot, useRef as ke, useContext as Nt } from "react";
3
+ var z = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as Pe } from "react/jsx-runtime";
5
+ import Pt, { useSyncExternalStore as Ct, useCallback as x, useEffect as Te, createContext as kt, useReducer as Ot, useRef as Ce, useContext as Nt } from "react";
6
6
  /*!
7
- @versini/auth-provider v6.2.0
7
+ @versini/auth-provider v6.3.0
8
8
  © 2024 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "6.2.0",
13
- buildTime: "07/18/2024 11:48 AM EDT",
12
+ version: "6.3.0",
13
+ buildTime: "07/21/2024 06:09 PM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
17
17
  } catch {
18
18
  }
19
- function k(e) {
19
+ function P(e) {
20
20
  const t = new Uint8Array(e);
21
21
  let n = "";
22
22
  for (const a of t)
23
23
  n += String.fromCharCode(a);
24
24
  return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
25
25
  }
26
- function oe(e) {
26
+ function ie(e) {
27
27
  const t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, r = t.padEnd(t.length + n, "="), a = atob(r), s = new ArrayBuffer(a.length), o = new Uint8Array(s);
28
28
  for (let i = 0; i < a.length; i++)
29
29
  o[i] = a.charCodeAt(i);
30
30
  return s;
31
31
  }
32
- function Te() {
32
+ function Re() {
33
33
  return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
34
34
  }
35
- function Ve(e) {
35
+ function Ye(e) {
36
36
  const { id: t } = e;
37
37
  return {
38
38
  ...e,
39
- id: oe(t),
39
+ id: ie(t),
40
40
  transports: e.transports
41
41
  };
42
42
  }
43
- function Ye(e) {
43
+ function Ve(e) {
44
44
  return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
45
45
  }
46
- class b extends Error {
46
+ class I extends Error {
47
47
  constructor({ message: t, code: n, cause: r, name: a }) {
48
48
  super(t, { cause: r }), this.name = a ?? r.name, this.code = n;
49
49
  }
@@ -55,70 +55,70 @@ function Dt({ error: e, options: t }) {
55
55
  throw Error("options was missing required publicKey property");
56
56
  if (e.name === "AbortError") {
57
57
  if (t.signal instanceof AbortSignal)
58
- return new b({
58
+ return new I({
59
59
  message: "Registration ceremony was sent an abort signal",
60
60
  code: "ERROR_CEREMONY_ABORTED",
61
61
  cause: e
62
62
  });
63
63
  } else if (e.name === "ConstraintError") {
64
64
  if (((r = n.authenticatorSelection) == null ? void 0 : r.requireResidentKey) === !0)
65
- return new b({
65
+ return new I({
66
66
  message: "Discoverable credentials were required but no available authenticator supported it",
67
67
  code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
68
68
  cause: e
69
69
  });
70
70
  if (((a = n.authenticatorSelection) == null ? void 0 : a.userVerification) === "required")
71
- return new b({
71
+ return new I({
72
72
  message: "User verification was required but no available authenticator supported it",
73
73
  code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
74
74
  cause: e
75
75
  });
76
76
  } else {
77
77
  if (e.name === "InvalidStateError")
78
- return new b({
78
+ return new I({
79
79
  message: "The authenticator was previously registered",
80
80
  code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
81
81
  cause: e
82
82
  });
83
83
  if (e.name === "NotAllowedError")
84
- return new b({
84
+ return new I({
85
85
  message: e.message,
86
86
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
87
87
  cause: e
88
88
  });
89
89
  if (e.name === "NotSupportedError")
90
- return n.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new b({
90
+ return n.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new I({
91
91
  message: 'No entry in pubKeyCredParams was of type "public-key"',
92
92
  code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
93
93
  cause: e
94
- }) : new b({
94
+ }) : new I({
95
95
  message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
96
96
  code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
97
97
  cause: e
98
98
  });
99
99
  if (e.name === "SecurityError") {
100
100
  const s = window.location.hostname;
101
- if (Ye(s)) {
101
+ if (Ve(s)) {
102
102
  if (n.rp.id !== s)
103
- return new b({
103
+ return new I({
104
104
  message: `The RP ID "${n.rp.id}" is invalid for this domain`,
105
105
  code: "ERROR_INVALID_RP_ID",
106
106
  cause: e
107
107
  });
108
- } else return new b({
108
+ } else return new I({
109
109
  message: `${window.location.hostname} is an invalid domain`,
110
110
  code: "ERROR_INVALID_DOMAIN",
111
111
  cause: e
112
112
  });
113
113
  } else if (e.name === "TypeError") {
114
114
  if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64)
115
- return new b({
115
+ return new I({
116
116
  message: "User ID was not between 1 and 64 characters",
117
117
  code: "ERROR_INVALID_USER_ID_LENGTH",
118
118
  cause: e
119
119
  });
120
120
  } else if (e.name === "UnknownError")
121
- return new b({
121
+ return new I({
122
122
  message: "The authenticator was unable to process the specified options, or could not create a new credential",
123
123
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
124
124
  cause: e
@@ -143,22 +143,22 @@ class Ut {
143
143
  }
144
144
  }
145
145
  const je = new Ut(), $t = ["cross-platform", "platform"];
146
- function Je(e) {
146
+ function Fe(e) {
147
147
  if (e && !($t.indexOf(e) < 0))
148
148
  return e;
149
149
  }
150
- async function Ht(e) {
150
+ async function Kt(e) {
151
151
  var p;
152
- if (!Te())
152
+ if (!Re())
153
153
  throw new Error("WebAuthn is not supported in this browser");
154
154
  const n = { publicKey: {
155
155
  ...e,
156
- challenge: oe(e.challenge),
156
+ challenge: ie(e.challenge),
157
157
  user: {
158
158
  ...e.user,
159
- id: oe(e.user.id)
159
+ id: ie(e.user.id)
160
160
  },
161
- excludeCredentials: (p = e.excludeCredentials) == null ? void 0 : p.map(Ve)
161
+ excludeCredentials: (p = e.excludeCredentials) == null ? void 0 : p.map(Ye)
162
162
  } };
163
163
  n.signal = je.createNewAbortSignal();
164
164
  let r;
@@ -172,50 +172,50 @@ async function Ht(e) {
172
172
  const { id: a, rawId: s, response: o, type: i } = r;
173
173
  let u;
174
174
  typeof o.getTransports == "function" && (u = o.getTransports());
175
- let y;
175
+ let f;
176
176
  if (typeof o.getPublicKeyAlgorithm == "function")
177
177
  try {
178
- y = o.getPublicKeyAlgorithm();
178
+ f = o.getPublicKeyAlgorithm();
179
179
  } catch (l) {
180
- he("getPublicKeyAlgorithm()", l);
180
+ fe("getPublicKeyAlgorithm()", l);
181
181
  }
182
- let f;
182
+ let y;
183
183
  if (typeof o.getPublicKey == "function")
184
184
  try {
185
185
  const l = o.getPublicKey();
186
- l !== null && (f = k(l));
186
+ l !== null && (y = P(l));
187
187
  } catch (l) {
188
- he("getPublicKey()", l);
188
+ fe("getPublicKey()", l);
189
189
  }
190
190
  let h;
191
191
  if (typeof o.getAuthenticatorData == "function")
192
192
  try {
193
- h = k(o.getAuthenticatorData());
193
+ h = P(o.getAuthenticatorData());
194
194
  } catch (l) {
195
- he("getAuthenticatorData()", l);
195
+ fe("getAuthenticatorData()", l);
196
196
  }
197
197
  return {
198
198
  id: a,
199
- rawId: k(s),
199
+ rawId: P(s),
200
200
  response: {
201
- attestationObject: k(o.attestationObject),
202
- clientDataJSON: k(o.clientDataJSON),
201
+ attestationObject: P(o.attestationObject),
202
+ clientDataJSON: P(o.clientDataJSON),
203
203
  transports: u,
204
- publicKeyAlgorithm: y,
205
- publicKey: f,
204
+ publicKeyAlgorithm: f,
205
+ publicKey: y,
206
206
  authenticatorData: h
207
207
  },
208
208
  type: i,
209
209
  clientExtensionResults: r.getClientExtensionResults(),
210
- authenticatorAttachment: Je(r.authenticatorAttachment)
210
+ authenticatorAttachment: Fe(r.authenticatorAttachment)
211
211
  };
212
212
  }
213
- function he(e, t) {
213
+ function fe(e, t) {
214
214
  console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
215
215
  `, t);
216
216
  }
217
- function Kt() {
218
- if (!Te())
217
+ function Ht() {
218
+ if (!Re())
219
219
  return new Promise((t) => t(!1));
220
220
  const e = window.PublicKeyCredential;
221
221
  return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
@@ -226,34 +226,34 @@ function Lt({ error: e, options: t }) {
226
226
  throw Error("options was missing required publicKey property");
227
227
  if (e.name === "AbortError") {
228
228
  if (t.signal instanceof AbortSignal)
229
- return new b({
229
+ return new I({
230
230
  message: "Authentication ceremony was sent an abort signal",
231
231
  code: "ERROR_CEREMONY_ABORTED",
232
232
  cause: e
233
233
  });
234
234
  } else {
235
235
  if (e.name === "NotAllowedError")
236
- return new b({
236
+ return new I({
237
237
  message: e.message,
238
238
  code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
239
239
  cause: e
240
240
  });
241
241
  if (e.name === "SecurityError") {
242
242
  const r = window.location.hostname;
243
- if (Ye(r)) {
243
+ if (Ve(r)) {
244
244
  if (n.rpId !== r)
245
- return new b({
245
+ return new I({
246
246
  message: `The RP ID "${n.rpId}" is invalid for this domain`,
247
247
  code: "ERROR_INVALID_RP_ID",
248
248
  cause: e
249
249
  });
250
- } else return new b({
250
+ } else return new I({
251
251
  message: `${window.location.hostname} is an invalid domain`,
252
252
  code: "ERROR_INVALID_DOMAIN",
253
253
  cause: e
254
254
  });
255
255
  } else if (e.name === "UnknownError")
256
- return new b({
256
+ return new I({
257
257
  message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
258
258
  code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
259
259
  cause: e
@@ -261,19 +261,19 @@ function Lt({ error: e, options: t }) {
261
261
  }
262
262
  return e;
263
263
  }
264
- async function xt(e, t = !1) {
264
+ async function Wt(e, t = !1) {
265
265
  var h, p;
266
- if (!Te())
266
+ if (!Re())
267
267
  throw new Error("WebAuthn is not supported in this browser");
268
268
  let n;
269
- ((h = e.allowCredentials) == null ? void 0 : h.length) !== 0 && (n = (p = e.allowCredentials) == null ? void 0 : p.map(Ve));
269
+ ((h = e.allowCredentials) == null ? void 0 : h.length) !== 0 && (n = (p = e.allowCredentials) == null ? void 0 : p.map(Ye));
270
270
  const r = {
271
271
  ...e,
272
- challenge: oe(e.challenge),
272
+ challenge: ie(e.challenge),
273
273
  allowCredentials: n
274
274
  }, a = {};
275
275
  if (t) {
276
- if (!await Kt())
276
+ if (!await Ht())
277
277
  throw Error("Browser does not support WebAuthn autofill");
278
278
  if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
279
279
  throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
@@ -288,36 +288,36 @@ async function xt(e, t = !1) {
288
288
  }
289
289
  if (!s)
290
290
  throw new Error("Authentication was not completed");
291
- const { id: o, rawId: i, response: u, type: y } = s;
292
- let f;
293
- return u.userHandle && (f = k(u.userHandle)), {
291
+ const { id: o, rawId: i, response: u, type: f } = s;
292
+ let y;
293
+ return u.userHandle && (y = P(u.userHandle)), {
294
294
  id: o,
295
- rawId: k(i),
295
+ rawId: P(i),
296
296
  response: {
297
- authenticatorData: k(u.authenticatorData),
298
- clientDataJSON: k(u.clientDataJSON),
299
- signature: k(u.signature),
300
- userHandle: f
297
+ authenticatorData: P(u.authenticatorData),
298
+ clientDataJSON: P(u.clientDataJSON),
299
+ signature: P(u.signature),
300
+ userHandle: y
301
301
  },
302
- type: y,
302
+ type: f,
303
303
  clientExtensionResults: s.getClientExtensionResults(),
304
- authenticatorAttachment: Je(s.authenticatorAttachment)
304
+ authenticatorAttachment: Fe(s.authenticatorAttachment)
305
305
  };
306
306
  }
307
307
  /*!
308
- @versini/auth-common v2.12.1
308
+ @versini/auth-common v3.2.0
309
309
  © 2024 gizmette.com
310
310
  */
311
311
  try {
312
312
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
313
- version: "2.12.1",
314
- buildTime: "07/18/2024 11:48 AM EDT",
313
+ version: "3.2.0",
314
+ buildTime: "07/21/2024 06:09 PM EDT",
315
315
  homepage: "https://github.com/aversini/auth-client",
316
316
  license: "MIT"
317
317
  });
318
318
  } catch {
319
319
  }
320
- const Y = {
320
+ const F = {
321
321
  ID_TOKEN: "id_token",
322
322
  ACCESS_TOKEN: "token",
323
323
  ID_AND_ACCESS_TOKEN: "id_token token",
@@ -326,15 +326,18 @@ const Y = {
326
326
  PASSKEY: "passkey"
327
327
  }, Be = {
328
328
  CLIENT_ID: "X-Auth-ClientId"
329
- }, I = {
329
+ }, b = {
330
330
  ALG: "RS256",
331
331
  USER_ID_KEY: "sub",
332
332
  TOKEN_ID_KEY: "__raw",
333
333
  NONCE_KEY: "_nonce",
334
334
  USERNAME_KEY: "username",
335
335
  AUTH_TYPE_KEY: "auth_type",
336
+ EXPIRES_AT_KEY: "exp",
337
+ CREATED_AT_KEY: "iat",
338
+ SCOPES_KEY: "scopes",
336
339
  ISSUER: "gizmette.com"
337
- }, Mt = `-----BEGIN PUBLIC KEY-----
340
+ }, xt = `-----BEGIN PUBLIC KEY-----
338
341
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
339
342
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
340
343
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -342,12 +345,12 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
342
345
  l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
343
346
  sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
344
347
  awIDAQAB
345
- -----END PUBLIC KEY-----`, ce = {
348
+ -----END PUBLIC KEY-----`, de = {
346
349
  AUTHENTICATE: "authenticate",
347
350
  CODE: "code",
348
351
  LOGOUT: "logout"
349
- }, ue = crypto, Fe = (e) => e instanceof CryptoKey, F = new TextEncoder(), le = new TextDecoder();
350
- function Wt(...e) {
352
+ }, he = crypto, qe = (e) => e instanceof CryptoKey, Q = new TextEncoder(), B = new TextDecoder();
353
+ function Mt(...e) {
351
354
  const t = e.reduce((a, { length: s }) => a + s, 0), n = new Uint8Array(t);
352
355
  let r = 0;
353
356
  for (const a of e)
@@ -359,16 +362,16 @@ const Gt = (e) => {
359
362
  for (let r = 0; r < t.length; r++)
360
363
  n[r] = t.charCodeAt(r);
361
364
  return n;
362
- }, re = (e) => {
365
+ }, j = (e) => {
363
366
  let t = e;
364
- t instanceof Uint8Array && (t = le.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
367
+ t instanceof Uint8Array && (t = B.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
365
368
  try {
366
369
  return Gt(t);
367
370
  } catch {
368
371
  throw new TypeError("The input to be decoded is not correctly encoded.");
369
372
  }
370
373
  };
371
- let D = class extends Error {
374
+ let U = class extends Error {
372
375
  static get code() {
373
376
  return "ERR_JOSE_GENERIC";
374
377
  }
@@ -376,14 +379,14 @@ let D = class extends Error {
376
379
  var n;
377
380
  super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
378
381
  }
379
- }, v = class extends D {
382
+ }, v = class extends U {
380
383
  static get code() {
381
384
  return "ERR_JWT_CLAIM_VALIDATION_FAILED";
382
385
  }
383
386
  constructor(t, n, r = "unspecified", a = "unspecified") {
384
387
  super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = r, this.reason = a, this.payload = n;
385
388
  }
386
- }, Pe = class extends D {
389
+ }, ke = class extends U {
387
390
  static get code() {
388
391
  return "ERR_JWT_EXPIRED";
389
392
  }
@@ -391,7 +394,7 @@ let D = class extends Error {
391
394
  super(t), this.code = "ERR_JWT_EXPIRED", this.claim = r, this.reason = a, this.payload = n;
392
395
  }
393
396
  };
394
- class Vt extends D {
397
+ class Jt extends U {
395
398
  constructor() {
396
399
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
397
400
  }
@@ -399,7 +402,7 @@ class Vt extends D {
399
402
  return "ERR_JOSE_ALG_NOT_ALLOWED";
400
403
  }
401
404
  }
402
- let O = class extends D {
405
+ let N = class extends U {
403
406
  constructor() {
404
407
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
405
408
  }
@@ -407,7 +410,7 @@ let O = class extends D {
407
410
  return "ERR_JOSE_NOT_SUPPORTED";
408
411
  }
409
412
  };
410
- class R extends D {
413
+ class R extends U {
411
414
  constructor() {
412
415
  super(...arguments), this.code = "ERR_JWS_INVALID";
413
416
  }
@@ -415,7 +418,7 @@ class R extends D {
415
418
  return "ERR_JWS_INVALID";
416
419
  }
417
420
  }
418
- let qe = class extends D {
421
+ let k = class extends U {
419
422
  constructor() {
420
423
  super(...arguments), this.code = "ERR_JWT_INVALID";
421
424
  }
@@ -423,7 +426,7 @@ let qe = class extends D {
423
426
  return "ERR_JWT_INVALID";
424
427
  }
425
428
  };
426
- class Yt extends D {
429
+ class Yt extends U {
427
430
  constructor() {
428
431
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
429
432
  }
@@ -431,16 +434,16 @@ class Yt extends D {
431
434
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
432
435
  }
433
436
  }
434
- function P(e, t = "algorithm.name") {
437
+ function C(e, t = "algorithm.name") {
435
438
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
436
439
  }
437
- function q(e, t) {
440
+ function X(e, t) {
438
441
  return e.name === t;
439
442
  }
440
- function pe(e) {
443
+ function ye(e) {
441
444
  return parseInt(e.name.slice(4), 10);
442
445
  }
443
- function jt(e) {
446
+ function Vt(e) {
444
447
  switch (e) {
445
448
  case "ES256":
446
449
  return "P-256";
@@ -452,7 +455,7 @@ function jt(e) {
452
455
  throw new Error("unreachable");
453
456
  }
454
457
  }
455
- function Jt(e, t) {
458
+ function jt(e, t) {
456
459
  if (t.length && !t.some((n) => e.usages.includes(n))) {
457
460
  let n = "CryptoKey does not support this operation, its usages must include ";
458
461
  if (t.length > 2) {
@@ -462,57 +465,57 @@ function Jt(e, t) {
462
465
  throw new TypeError(n);
463
466
  }
464
467
  }
465
- function Bt(e, t, ...n) {
468
+ function Ft(e, t, ...n) {
466
469
  switch (t) {
467
470
  case "HS256":
468
471
  case "HS384":
469
472
  case "HS512": {
470
- if (!q(e.algorithm, "HMAC"))
471
- throw P("HMAC");
473
+ if (!X(e.algorithm, "HMAC"))
474
+ throw C("HMAC");
472
475
  const r = parseInt(t.slice(2), 10);
473
- if (pe(e.algorithm.hash) !== r)
474
- throw P(`SHA-${r}`, "algorithm.hash");
476
+ if (ye(e.algorithm.hash) !== r)
477
+ throw C(`SHA-${r}`, "algorithm.hash");
475
478
  break;
476
479
  }
477
480
  case "RS256":
478
481
  case "RS384":
479
482
  case "RS512": {
480
- if (!q(e.algorithm, "RSASSA-PKCS1-v1_5"))
481
- throw P("RSASSA-PKCS1-v1_5");
483
+ if (!X(e.algorithm, "RSASSA-PKCS1-v1_5"))
484
+ throw C("RSASSA-PKCS1-v1_5");
482
485
  const r = parseInt(t.slice(2), 10);
483
- if (pe(e.algorithm.hash) !== r)
484
- throw P(`SHA-${r}`, "algorithm.hash");
486
+ if (ye(e.algorithm.hash) !== r)
487
+ throw C(`SHA-${r}`, "algorithm.hash");
485
488
  break;
486
489
  }
487
490
  case "PS256":
488
491
  case "PS384":
489
492
  case "PS512": {
490
- if (!q(e.algorithm, "RSA-PSS"))
491
- throw P("RSA-PSS");
493
+ if (!X(e.algorithm, "RSA-PSS"))
494
+ throw C("RSA-PSS");
492
495
  const r = parseInt(t.slice(2), 10);
493
- if (pe(e.algorithm.hash) !== r)
494
- throw P(`SHA-${r}`, "algorithm.hash");
496
+ if (ye(e.algorithm.hash) !== r)
497
+ throw C(`SHA-${r}`, "algorithm.hash");
495
498
  break;
496
499
  }
497
500
  case "EdDSA": {
498
501
  if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
499
- throw P("Ed25519 or Ed448");
502
+ throw C("Ed25519 or Ed448");
500
503
  break;
501
504
  }
502
505
  case "ES256":
503
506
  case "ES384":
504
507
  case "ES512": {
505
- if (!q(e.algorithm, "ECDSA"))
506
- throw P("ECDSA");
507
- const r = jt(t);
508
+ if (!X(e.algorithm, "ECDSA"))
509
+ throw C("ECDSA");
510
+ const r = Vt(t);
508
511
  if (e.algorithm.namedCurve !== r)
509
- throw P(r, "algorithm.namedCurve");
512
+ throw C(r, "algorithm.namedCurve");
510
513
  break;
511
514
  }
512
515
  default:
513
516
  throw new TypeError("CryptoKey does not support this operation");
514
517
  }
515
- Jt(e, n);
518
+ jt(e, n);
516
519
  }
517
520
  function ze(e, t, ...n) {
518
521
  var r;
@@ -522,11 +525,11 @@ function ze(e, t, ...n) {
522
525
  } else n.length === 2 ? e += `one of type ${n[0]} or ${n[1]}.` : e += `of type ${n[0]}.`;
523
526
  return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (r = t.constructor) != null && r.name && (e += ` Received an instance of ${t.constructor.name}`), e;
524
527
  }
525
- const Ce = (e, ...t) => ze("Key must be ", e, ...t);
528
+ const Oe = (e, ...t) => ze("Key must be ", e, ...t);
526
529
  function Qe(e, t, ...n) {
527
530
  return ze(`Key for the ${e} algorithm must be `, t, ...n);
528
531
  }
529
- const Xe = (e) => Fe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", se = ["CryptoKey"], Ft = (...e) => {
532
+ const Xe = (e) => qe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", ce = ["CryptoKey"], Bt = (...e) => {
530
533
  const t = e.filter(Boolean);
531
534
  if (t.length === 0 || t.length === 1)
532
535
  return !0;
@@ -548,7 +551,7 @@ const Xe = (e) => Fe(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
548
551
  function qt(e) {
549
552
  return typeof e == "object" && e !== null;
550
553
  }
551
- function Ae(e) {
554
+ function ue(e) {
552
555
  if (!qt(e) || Object.prototype.toString.call(e) !== "[object Object]")
553
556
  return !1;
554
557
  if (Object.getPrototypeOf(e) === null)
@@ -590,7 +593,7 @@ function Qt(e) {
590
593
  }, n = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
591
594
  break;
592
595
  default:
593
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
596
+ throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
594
597
  }
595
598
  break;
596
599
  }
@@ -612,7 +615,7 @@ function Qt(e) {
612
615
  t = { name: "ECDH", namedCurve: e.crv }, n = e.d ? ["deriveBits"] : [];
613
616
  break;
614
617
  default:
615
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
618
+ throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
616
619
  }
617
620
  break;
618
621
  }
@@ -628,12 +631,12 @@ function Qt(e) {
628
631
  t = { name: e.crv }, n = e.d ? ["deriveBits"] : [];
629
632
  break;
630
633
  default:
631
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
634
+ throw new N('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
632
635
  }
633
636
  break;
634
637
  }
635
638
  default:
636
- throw new O('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
639
+ throw new N('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
637
640
  }
638
641
  return { algorithm: t, keyUsages: n };
639
642
  }
@@ -645,9 +648,9 @@ const Xt = async (e) => {
645
648
  e.ext ?? !1,
646
649
  e.key_ops ?? n
647
650
  ], a = { ...e };
648
- return delete a.alg, delete a.use, ue.subtle.importKey("jwk", a, ...r);
649
- }, Ze = (e) => re(e);
650
- let fe, ye;
651
+ return delete a.alg, delete a.use, he.subtle.importKey("jwk", a, ...r);
652
+ }, Ze = (e) => j(e);
653
+ let ge, me;
651
654
  const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", tt = async (e, t, n, r) => {
652
655
  let a = e.get(t);
653
656
  if (a != null && a[r])
@@ -657,40 +660,40 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
657
660
  }, Zt = (e, t) => {
658
661
  if (et(e)) {
659
662
  let n = e.export({ format: "jwk" });
660
- return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? Ze(n.k) : (ye || (ye = /* @__PURE__ */ new WeakMap()), tt(ye, e, n, t));
663
+ return delete n.d, delete n.dp, delete n.dq, delete n.p, delete n.q, delete n.qi, n.k ? Ze(n.k) : (me || (me = /* @__PURE__ */ new WeakMap()), tt(me, e, n, t));
661
664
  }
662
665
  return e;
663
666
  }, en = (e, t) => {
664
667
  if (et(e)) {
665
668
  let n = e.export({ format: "jwk" });
666
- return n.k ? Ze(n.k) : (fe || (fe = /* @__PURE__ */ new WeakMap()), tt(fe, e, n, t));
669
+ return n.k ? Ze(n.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), tt(ge, e, n, t));
667
670
  }
668
671
  return e;
669
- }, tn = { normalizePublicKey: Zt, normalizePrivateKey: en }, C = (e, t, n = 0) => {
672
+ }, tn = { normalizePublicKey: Zt, normalizePrivateKey: en }, O = (e, t, n = 0) => {
670
673
  n === 0 && (t.unshift(t.length), t.unshift(6));
671
674
  const r = e.indexOf(t[0], n);
672
675
  if (r === -1)
673
676
  return !1;
674
677
  const a = e.subarray(r, r + t.length);
675
- return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || C(e, t, r + 1);
676
- }, Oe = (e) => {
678
+ return a.length !== t.length ? !1 : a.every((s, o) => s === t[o]) || O(e, t, r + 1);
679
+ }, Ne = (e) => {
677
680
  switch (!0) {
678
- case C(e, [42, 134, 72, 206, 61, 3, 1, 7]):
681
+ case O(e, [42, 134, 72, 206, 61, 3, 1, 7]):
679
682
  return "P-256";
680
- case C(e, [43, 129, 4, 0, 34]):
683
+ case O(e, [43, 129, 4, 0, 34]):
681
684
  return "P-384";
682
- case C(e, [43, 129, 4, 0, 35]):
685
+ case O(e, [43, 129, 4, 0, 35]):
683
686
  return "P-521";
684
- case C(e, [43, 101, 110]):
687
+ case O(e, [43, 101, 110]):
685
688
  return "X25519";
686
- case C(e, [43, 101, 111]):
689
+ case O(e, [43, 101, 111]):
687
690
  return "X448";
688
- case C(e, [43, 101, 112]):
691
+ case O(e, [43, 101, 112]):
689
692
  return "Ed25519";
690
- case C(e, [43, 101, 113]):
693
+ case O(e, [43, 101, 113]):
691
694
  return "Ed448";
692
695
  default:
693
- throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
696
+ throw new N("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
694
697
  }
695
698
  }, nn = async (e, t, n, r, a) => {
696
699
  let s, o;
@@ -728,39 +731,39 @@ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
728
731
  case "ECDH-ES+A128KW":
729
732
  case "ECDH-ES+A192KW":
730
733
  case "ECDH-ES+A256KW": {
731
- const u = Oe(i);
734
+ const u = Ne(i);
732
735
  s = u.startsWith("P-") ? { name: "ECDH", namedCurve: u } : { name: u }, o = [];
733
736
  break;
734
737
  }
735
738
  case "EdDSA":
736
- s = { name: Oe(i) }, o = ["verify"];
739
+ s = { name: Ne(i) }, o = ["verify"];
737
740
  break;
738
741
  default:
739
- throw new O('Invalid or unsupported "alg" (Algorithm) value');
742
+ throw new N('Invalid or unsupported "alg" (Algorithm) value');
740
743
  }
741
- return ue.subtle.importKey(t, i, s, !1, o);
744
+ return he.subtle.importKey(t, i, s, !1, o);
742
745
  }, rn = (e, t, n) => nn(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
743
746
  async function an(e, t, n) {
744
747
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
745
748
  throw new TypeError('"spki" must be SPKI formatted string');
746
749
  return rn(e, t);
747
750
  }
748
- const ae = (e) => e == null ? void 0 : e[Symbol.toStringTag], on = (e, t) => {
751
+ const se = (e) => e == null ? void 0 : e[Symbol.toStringTag], on = (e, t) => {
749
752
  if (!(t instanceof Uint8Array)) {
750
753
  if (!Xe(t))
751
- throw new TypeError(Qe(e, t, ...se, "Uint8Array"));
754
+ throw new TypeError(Qe(e, t, ...ce, "Uint8Array"));
752
755
  if (t.type !== "secret")
753
- throw new TypeError(`${ae(t)} instances for symmetric algorithms must be of type "secret"`);
756
+ throw new TypeError(`${se(t)} instances for symmetric algorithms must be of type "secret"`);
754
757
  }
755
758
  }, sn = (e, t, n) => {
756
759
  if (!Xe(t))
757
- throw new TypeError(Qe(e, t, ...se));
760
+ throw new TypeError(Qe(e, t, ...ce));
758
761
  if (t.type === "secret")
759
- throw new TypeError(`${ae(t)} instances for asymmetric algorithms must not be of type "secret"`);
762
+ throw new TypeError(`${se(t)} instances for asymmetric algorithms must not be of type "secret"`);
760
763
  if (t.algorithm && n === "verify" && t.type === "private")
761
- throw new TypeError(`${ae(t)} instances for asymmetric algorithm verifying must be of type "public"`);
764
+ throw new TypeError(`${se(t)} instances for asymmetric algorithm verifying must be of type "public"`);
762
765
  if (t.algorithm && n === "encrypt" && t.type === "private")
763
- throw new TypeError(`${ae(t)} instances for asymmetric algorithm encryption must be of type "public"`);
766
+ throw new TypeError(`${se(t)} instances for asymmetric algorithm encryption must be of type "public"`);
764
767
  }, cn = (e, t, n) => {
765
768
  e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? on(e, t) : sn(e, t, n);
766
769
  };
@@ -775,7 +778,7 @@ function un(e, t, n, r, a) {
775
778
  n !== void 0 ? s = new Map([...Object.entries(n), ...t.entries()]) : s = t;
776
779
  for (const o of r.crit) {
777
780
  if (!s.has(o))
778
- throw new O(`Extension Header Parameter "${o}" is not recognized`);
781
+ throw new N(`Extension Header Parameter "${o}" is not recognized`);
779
782
  if (a[o] === void 0)
780
783
  throw new e(`Extension Header Parameter "${o}" is missing`);
781
784
  if (s.get(o) && r[o] === void 0)
@@ -811,31 +814,31 @@ function dn(e, t) {
811
814
  case "EdDSA":
812
815
  return { name: t.name };
813
816
  default:
814
- throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
817
+ throw new N(`alg ${e} is not supported either by JOSE or your javascript runtime`);
815
818
  }
816
819
  }
817
820
  async function hn(e, t, n) {
818
- if (t = await tn.normalizePublicKey(t, e), Fe(t))
819
- return Bt(t, e, n), t;
821
+ if (t = await tn.normalizePublicKey(t, e), qe(t))
822
+ return Ft(t, e, n), t;
820
823
  if (t instanceof Uint8Array) {
821
824
  if (!e.startsWith("HS"))
822
- throw new TypeError(Ce(t, ...se));
823
- return ue.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
825
+ throw new TypeError(Oe(t, ...ce));
826
+ return he.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [n]);
824
827
  }
825
- throw new TypeError(Ce(t, ...se, "Uint8Array"));
828
+ throw new TypeError(Oe(t, ...ce, "Uint8Array"));
826
829
  }
827
830
  const pn = async (e, t, n, r) => {
828
831
  const a = await hn(e, t, "verify");
829
832
  zt(e, a);
830
833
  const s = dn(e, a.algorithm);
831
834
  try {
832
- return await ue.subtle.verify(s, a, n, r);
835
+ return await he.subtle.verify(s, a, n, r);
833
836
  } catch {
834
837
  return !1;
835
838
  }
836
839
  };
837
840
  async function fn(e, t, n) {
838
- if (!Ae(e))
841
+ if (!ue(e))
839
842
  throw new R("Flattened JWS must be an object");
840
843
  if (e.protected === void 0 && e.header === void 0)
841
844
  throw new R('Flattened JWS must have either of the "protected" or "header" members');
@@ -845,17 +848,17 @@ async function fn(e, t, n) {
845
848
  throw new R("JWS Payload missing");
846
849
  if (typeof e.signature != "string")
847
850
  throw new R("JWS Signature missing or incorrect type");
848
- if (e.header !== void 0 && !Ae(e.header))
851
+ if (e.header !== void 0 && !ue(e.header))
849
852
  throw new R("JWS Unprotected Header incorrect type");
850
853
  let r = {};
851
854
  if (e.protected)
852
855
  try {
853
- const d = re(e.protected);
854
- r = JSON.parse(le.decode(d));
856
+ const d = j(e.protected);
857
+ r = JSON.parse(B.decode(d));
855
858
  } catch {
856
859
  throw new R("JWS Protected Header is invalid");
857
860
  }
858
- if (!Ft(r, e.header))
861
+ if (!Bt(r, e.header))
859
862
  throw new R("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
860
863
  const a = {
861
864
  ...r,
@@ -869,36 +872,36 @@ async function fn(e, t, n) {
869
872
  throw new R('JWS "alg" (Algorithm) Header Parameter missing or invalid');
870
873
  const u = n && ln("algorithms", n.algorithms);
871
874
  if (u && !u.has(i))
872
- throw new Vt('"alg" (Algorithm) Header Parameter value not allowed');
875
+ throw new Jt('"alg" (Algorithm) Header Parameter value not allowed');
873
876
  if (o) {
874
877
  if (typeof e.payload != "string")
875
878
  throw new R("JWS Payload must be a string");
876
879
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
877
880
  throw new R("JWS Payload must be a string or an Uint8Array instance");
878
- let y = !1;
879
- typeof t == "function" && (t = await t(r, e), y = !0), cn(i, t, "verify");
880
- const f = Wt(F.encode(e.protected ?? ""), F.encode("."), typeof e.payload == "string" ? F.encode(e.payload) : e.payload);
881
+ let f = !1;
882
+ typeof t == "function" && (t = await t(r, e), f = !0), cn(i, t, "verify");
883
+ const y = Mt(Q.encode(e.protected ?? ""), Q.encode("."), typeof e.payload == "string" ? Q.encode(e.payload) : e.payload);
881
884
  let h;
882
885
  try {
883
- h = re(e.signature);
886
+ h = j(e.signature);
884
887
  } catch {
885
888
  throw new R("Failed to base64url decode the signature");
886
889
  }
887
- if (!await pn(i, t, h, f))
890
+ if (!await pn(i, t, h, y))
888
891
  throw new Yt();
889
892
  let p;
890
893
  if (o)
891
894
  try {
892
- p = re(e.payload);
895
+ p = j(e.payload);
893
896
  } catch {
894
897
  throw new R("Failed to base64url decode the payload");
895
898
  }
896
- else typeof e.payload == "string" ? p = F.encode(e.payload) : p = e.payload;
899
+ else typeof e.payload == "string" ? p = Q.encode(e.payload) : p = e.payload;
897
900
  const l = { payload: p };
898
- return e.protected !== void 0 && (l.protectedHeader = r), e.header !== void 0 && (l.unprotectedHeader = e.header), y ? { ...l, key: t } : l;
901
+ return e.protected !== void 0 && (l.protectedHeader = r), e.header !== void 0 && (l.unprotectedHeader = e.header), f ? { ...l, key: t } : l;
899
902
  }
900
903
  async function yn(e, t, n) {
901
- if (e instanceof Uint8Array && (e = le.decode(e)), typeof e != "string")
904
+ if (e instanceof Uint8Array && (e = B.decode(e)), typeof e != "string")
902
905
  throw new R("Compact JWS must be a string or Uint8Array");
903
906
  const { 0: r, 1: a, 2: s, length: o } = e.split(".");
904
907
  if (o !== 3)
@@ -906,7 +909,7 @@ async function yn(e, t, n) {
906
909
  const i = await fn({ payload: a, protected: r, signature: s }, t, n), u = { payload: i.payload, protectedHeader: i.protectedHeader };
907
910
  return typeof t == "function" ? { ...u, key: i.key } : u;
908
911
  }
909
- const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt * 24, mn = Re * 7, wn = Re * 365.25, En = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Ne = (e) => {
912
+ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, be = rt * 24, mn = be * 7, wn = be * 365.25, En = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, De = (e) => {
910
913
  const t = En.exec(e);
911
914
  if (!t || t[4] && t[1])
912
915
  throw new TypeError("Invalid time period format");
@@ -937,7 +940,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
937
940
  case "day":
938
941
  case "days":
939
942
  case "d":
940
- a = Math.round(n * Re);
943
+ a = Math.round(n * be);
941
944
  break;
942
945
  case "week":
943
946
  case "weeks":
@@ -949,20 +952,20 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
949
952
  break;
950
953
  }
951
954
  return t[1] === "-" || t[4] === "ago" ? -a : a;
952
- }, De = (e) => e.toLowerCase().replace(/^application\//, ""), Sn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, An = (e, t, n = {}) => {
955
+ }, Ue = (e) => e.toLowerCase().replace(/^application\//, ""), Sn = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, An = (e, t, n = {}) => {
953
956
  let r;
954
957
  try {
955
- r = JSON.parse(le.decode(t));
958
+ r = JSON.parse(B.decode(t));
956
959
  } catch {
957
960
  }
958
- if (!Ae(r))
959
- throw new qe("JWT Claims Set must be a top-level JSON object");
961
+ if (!ue(r))
962
+ throw new k("JWT Claims Set must be a top-level JSON object");
960
963
  const { typ: a } = n;
961
- if (a && (typeof e.typ != "string" || De(e.typ) !== De(a)))
964
+ if (a && (typeof e.typ != "string" || Ue(e.typ) !== Ue(a)))
962
965
  throw new v('unexpected "typ" JWT header value', r, "typ", "check_failed");
963
- const { requiredClaims: s = [], issuer: o, subject: i, audience: u, maxTokenAge: y } = n, f = [...s];
964
- y !== void 0 && f.push("iat"), u !== void 0 && f.push("aud"), i !== void 0 && f.push("sub"), o !== void 0 && f.push("iss");
965
- for (const d of new Set(f.reverse()))
966
+ const { requiredClaims: s = [], issuer: o, subject: i, audience: u, maxTokenAge: f } = n, y = [...s];
967
+ f !== void 0 && y.push("iat"), u !== void 0 && y.push("aud"), i !== void 0 && y.push("sub"), o !== void 0 && y.push("iss");
968
+ for (const d of new Set(y.reverse()))
966
969
  if (!(d in r))
967
970
  throw new v(`missing required "${d}" claim`, r, d, "missing");
968
971
  if (o && !(Array.isArray(o) ? o : [o]).includes(r.iss))
@@ -974,7 +977,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
974
977
  let h;
975
978
  switch (typeof n.clockTolerance) {
976
979
  case "string":
977
- h = Ne(n.clockTolerance);
980
+ h = De(n.clockTolerance);
978
981
  break;
979
982
  case "number":
980
983
  h = n.clockTolerance;
@@ -986,7 +989,7 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
986
989
  throw new TypeError("Invalid clockTolerance option type");
987
990
  }
988
991
  const { currentDate: p } = n, l = gn(p || /* @__PURE__ */ new Date());
989
- if ((r.iat !== void 0 || y) && typeof r.iat != "number")
992
+ if ((r.iat !== void 0 || f) && typeof r.iat != "number")
990
993
  throw new v('"iat" claim must be a number', r, "iat", "invalid");
991
994
  if (r.nbf !== void 0) {
992
995
  if (typeof r.nbf != "number")
@@ -998,12 +1001,12 @@ const gn = (e) => Math.floor(e.getTime() / 1e3), nt = 60, rt = nt * 60, Re = rt
998
1001
  if (typeof r.exp != "number")
999
1002
  throw new v('"exp" claim must be a number', r, "exp", "invalid");
1000
1003
  if (r.exp <= l - h)
1001
- throw new Pe('"exp" claim timestamp check failed', r, "exp", "check_failed");
1004
+ throw new ke('"exp" claim timestamp check failed', r, "exp", "check_failed");
1002
1005
  }
1003
- if (y) {
1004
- const d = l - r.iat, m = typeof y == "number" ? y : Ne(y);
1006
+ if (f) {
1007
+ const d = l - r.iat, m = typeof f == "number" ? f : De(f);
1005
1008
  if (d - h > m)
1006
- throw new Pe('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1009
+ throw new ke('"iat" claim timestamp check failed (too far in the past)', r, "iat", "check_failed");
1007
1010
  if (d < 0 - h)
1008
1011
  throw new v('"iat" claim timestamp check failed (it should be in the past)', r, "iat", "check_failed");
1009
1012
  }
@@ -1013,81 +1016,123 @@ async function Tn(e, t, n) {
1013
1016
  var r;
1014
1017
  const a = await yn(e, t, n);
1015
1018
  if ((r = a.protectedHeader.crit) != null && r.includes("b64") && a.protectedHeader.b64 === !1)
1016
- throw new qe("JWTs MUST NOT use unencoded payload");
1019
+ throw new k("JWTs MUST NOT use unencoded payload");
1017
1020
  const s = { payload: An(a.protectedHeader, a.payload, n), protectedHeader: a.protectedHeader };
1018
1021
  return typeof t == "function" ? { ...s, key: a.key } : s;
1019
1022
  }
1020
- const j = async (e) => {
1023
+ const Rn = j;
1024
+ function bn(e) {
1025
+ if (typeof e != "string")
1026
+ throw new k("JWTs must use Compact JWS serialization, JWT must be a string");
1027
+ const { 1: t, length: n } = e.split(".");
1028
+ if (n === 5)
1029
+ throw new k("Only JWTs using Compact JWS serialization can be decoded");
1030
+ if (n !== 3)
1031
+ throw new k("Invalid JWT");
1032
+ if (!t)
1033
+ throw new k("JWTs must contain a payload");
1034
+ let r;
1035
+ try {
1036
+ r = Rn(t);
1037
+ } catch {
1038
+ throw new k("Failed to base64url decode the payload");
1039
+ }
1040
+ let a;
1041
+ try {
1042
+ a = JSON.parse(B.decode(r));
1043
+ } catch {
1044
+ throw new k("Failed to parse the decoded payload as JSON");
1045
+ }
1046
+ if (!ue(a))
1047
+ throw new k("Invalid JWT Claims Set");
1048
+ return a;
1049
+ }
1050
+ const M = async (e) => {
1021
1051
  try {
1022
- const t = I.ALG, n = await an(Mt, t);
1052
+ const t = b.ALG, n = await an(xt, t);
1023
1053
  return await Tn(e, n, {
1024
- issuer: I.ISSUER
1054
+ issuer: b.ISSUER
1025
1055
  });
1026
1056
  } catch {
1027
1057
  return;
1028
1058
  }
1059
+ }, In = (e) => {
1060
+ try {
1061
+ return bn(e);
1062
+ } catch {
1063
+ return;
1064
+ }
1029
1065
  };
1030
1066
  var A = [];
1031
- for (var ge = 0; ge < 256; ++ge)
1032
- A.push((ge + 256).toString(16).slice(1));
1033
- function Rn(e, t = 0) {
1067
+ for (var we = 0; we < 256; ++we)
1068
+ A.push((we + 256).toString(16).slice(1));
1069
+ function _n(e, t = 0) {
1034
1070
  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();
1035
1071
  }
1036
- var z, bn = new Uint8Array(16);
1037
- function In() {
1038
- if (!z && (z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !z))
1072
+ var Z, vn = new Uint8Array(16);
1073
+ function Pn() {
1074
+ if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))
1039
1075
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1040
- return z(bn);
1076
+ return Z(vn);
1041
1077
  }
1042
- var _n = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1043
- const Ue = {
1044
- randomUUID: _n
1078
+ var Cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1079
+ const $e = {
1080
+ randomUUID: Cn
1045
1081
  };
1046
- function $e(e, t, n) {
1047
- if (Ue.randomUUID && !t && !e)
1048
- return Ue.randomUUID();
1082
+ function Ke(e, t, n) {
1083
+ if ($e.randomUUID && !t && !e)
1084
+ return $e.randomUUID();
1049
1085
  e = e || {};
1050
- var r = e.random || (e.rng || In)();
1051
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Rn(r);
1086
+ var r = e.random || (e.rng || Pn)();
1087
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, _n(r);
1052
1088
  }
1053
- const He = globalThis.crypto, vn = (e) => `${$e()}${$e()}`.slice(0, e), kn = (e) => btoa(
1089
+ const He = globalThis.crypto, kn = (e) => `${Ke()}${Ke()}`.slice(0, e), On = (e) => btoa(
1054
1090
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1055
1091
  );
1056
- async function Pn(e) {
1092
+ async function Nn(e) {
1057
1093
  if (!He.subtle)
1058
1094
  throw new Error(
1059
1095
  "crypto.subtle is available only in secure contexts (HTTPS)."
1060
1096
  );
1061
1097
  const t = new TextEncoder().encode(e), n = await He.subtle.digest("SHA-256", t);
1062
- return kn(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1098
+ return On(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1063
1099
  }
1064
- async function Cn(e) {
1065
- const n = vn(43), r = await Pn(n);
1100
+ async function Dn(e) {
1101
+ const n = kn(43), r = await Nn(n);
1066
1102
  return {
1067
1103
  code_verifier: n,
1068
1104
  code_challenge: r
1069
1105
  };
1070
1106
  }
1107
+ const Cr = async (e, t) => {
1108
+ var n, r;
1109
+ const a = await M(e);
1110
+ if ((r = a && ((n = a == null ? void 0 : a.payload) == null ? void 0 : n[b.SCOPES_KEY])) != null && r.length) {
1111
+ const s = a.payload[b.SCOPES_KEY];
1112
+ return t.every((o) => s.includes(o));
1113
+ }
1114
+ return !1;
1115
+ };
1071
1116
  function at(e, t) {
1072
1117
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1073
1118
  }
1074
- const Ke = (e, t) => {
1119
+ const Le = (e, t) => {
1075
1120
  const n = JSON.stringify(
1076
1121
  typeof t == "function" ? t() : t
1077
1122
  );
1078
1123
  window.localStorage.setItem(e, n), at(e, n);
1079
- }, On = (e) => {
1124
+ }, Un = (e) => {
1080
1125
  window.localStorage.removeItem(e), at(e, null);
1081
- }, Le = (e) => window.localStorage.getItem(e), Nn = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1082
- function Q({
1126
+ }, We = (e) => window.localStorage.getItem(e), $n = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1127
+ function ee({
1083
1128
  key: e,
1084
1129
  initialValue: t
1085
1130
  }) {
1086
- const n = Pt(Nn, () => Le(e)), r = x(
1131
+ const n = Ct($n, () => We(e)), r = x(
1087
1132
  (o) => {
1088
1133
  try {
1089
1134
  const i = typeof o == "function" ? o(JSON.parse(n)) : o;
1090
- i == null ? On(e) : Ke(e, i);
1135
+ i == null ? Un(e) : Le(e, i);
1091
1136
  } catch (i) {
1092
1137
  console.warn(i);
1093
1138
  }
@@ -1098,36 +1143,36 @@ function Q({
1098
1143
  }, [t, r]), s = x(() => {
1099
1144
  r(null);
1100
1145
  }, [r]);
1101
- return Se(() => {
1146
+ return Te(() => {
1102
1147
  try {
1103
- Le(e) === null && typeof t < "u" && Ke(e, t);
1148
+ We(e) === null && typeof t < "u" && Le(e, t);
1104
1149
  } catch (o) {
1105
1150
  console.warn(o);
1106
1151
  }
1107
1152
  }, [e, t]), [n ? JSON.parse(n) : null, r, a, s];
1108
1153
  }
1109
1154
  var T = [];
1110
- for (var me = 0; me < 256; ++me)
1111
- T.push((me + 256).toString(16).slice(1));
1112
- function Dn(e, t = 0) {
1155
+ for (var Ee = 0; Ee < 256; ++Ee)
1156
+ T.push((Ee + 256).toString(16).slice(1));
1157
+ function Kn(e, t = 0) {
1113
1158
  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();
1114
1159
  }
1115
- var X, Un = new Uint8Array(16);
1116
- function $n() {
1117
- if (!X && (X = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !X))
1160
+ var te, Hn = new Uint8Array(16);
1161
+ function Ln() {
1162
+ if (!te && (te = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !te))
1118
1163
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1119
- return X(Un);
1164
+ return te(Hn);
1120
1165
  }
1121
- var Hn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1166
+ var Wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1122
1167
  const xe = {
1123
- randomUUID: Hn
1168
+ randomUUID: Wn
1124
1169
  };
1125
- function we(e, t, n) {
1170
+ function Se(e, t, n) {
1126
1171
  if (xe.randomUUID && !t && !e)
1127
1172
  return xe.randomUUID();
1128
1173
  e = e || {};
1129
- var r = e.random || (e.rng || $n)();
1130
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Dn(r);
1174
+ var r = e.random || (e.rng || Ln)();
1175
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Kn(r);
1131
1176
  }
1132
1177
  /*!
1133
1178
  @versini/ui-fingerprint v1.0.1
@@ -1142,7 +1187,7 @@ try {
1142
1187
  });
1143
1188
  } catch {
1144
1189
  }
1145
- const Kn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), ot = async (e) => {
1190
+ const xn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join(""), ot = async (e) => {
1146
1191
  if (e === "")
1147
1192
  return "";
1148
1193
  const t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
@@ -1151,26 +1196,26 @@ const Kn = (e) => Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join
1151
1196
  function Me(e, t) {
1152
1197
  return new Promise((n) => setTimeout(n, e, t));
1153
1198
  }
1154
- async function Ln(e, t, n = 50) {
1199
+ async function Mn(e, t, n = 50) {
1155
1200
  var r, a, s;
1156
1201
  const o = document;
1157
1202
  for (; !o.body; )
1158
1203
  await Me(n);
1159
1204
  const i = o.createElement("iframe");
1160
1205
  try {
1161
- for (await new Promise((u, y) => {
1162
- let f = !1;
1206
+ for (await new Promise((u, f) => {
1207
+ let y = !1;
1163
1208
  const h = () => {
1164
- f = !0, u();
1209
+ y = !0, u();
1165
1210
  }, p = (m) => {
1166
- f = !0, y(m);
1211
+ y = !0, f(m);
1167
1212
  };
1168
1213
  i.onload = h, i.onerror = p;
1169
1214
  const { style: l } = i;
1170
1215
  l.setProperty("display", "block", "important"), l.position = "absolute", l.top = "0", l.left = "0", l.visibility = "hidden", i.src = "about:blank", o.body.appendChild(i);
1171
1216
  const d = () => {
1172
1217
  var m, S;
1173
- f || (((S = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : S.readyState) === "complete" ? h() : setTimeout(d, 10));
1218
+ y || (((S = (m = i.contentWindow) == null ? void 0 : m.document) == null ? void 0 : S.readyState) === "complete" ? h() : setTimeout(d, 10));
1174
1219
  };
1175
1220
  d();
1176
1221
  }); !((a = (r = i.contentWindow) == null ? void 0 : r.document) != null && a.body); )
@@ -1180,14 +1225,14 @@ async function Ln(e, t, n = 50) {
1180
1225
  (s = i.parentNode) == null || s.removeChild(i);
1181
1226
  }
1182
1227
  }
1183
- const xn = {
1228
+ const Gn = {
1184
1229
  audio: {
1185
1230
  sampleHash: "",
1186
1231
  oscillator: "",
1187
1232
  maxChannels: 0,
1188
1233
  channelCountMode: ""
1189
1234
  }
1190
- }, Mn = async (e) => new Promise((t) => {
1235
+ }, Jn = async (e) => new Promise((t) => {
1191
1236
  try {
1192
1237
  const n = new window.OfflineAudioContext(1, 5e3, 44100), r = n.createBufferSource(), a = n.createOscillator();
1193
1238
  a.frequency.value = 1e3;
@@ -1196,7 +1241,7 @@ const xn = {
1196
1241
  const i = o.renderedBuffer.getChannelData(0);
1197
1242
  a.disconnect(), s.disconnect(), t({
1198
1243
  audio: {
1199
- sampleHash: Kn(i),
1244
+ sampleHash: xn(i),
1200
1245
  oscillator: a.type,
1201
1246
  maxChannels: n.destination.maxChannelCount,
1202
1247
  channelCountMode: r.channelCountMode
@@ -1213,16 +1258,16 @@ const xn = {
1213
1258
  }
1214
1259
  });
1215
1260
  }
1216
- }), st = { browser: "" }, Wn = async (e) => typeof navigator > "u" ? st : { browser: navigator.userAgent }, it = {
1261
+ }), st = { browser: "" }, Yn = async (e) => typeof navigator > "u" ? st : { browser: navigator.userAgent }, it = {
1217
1262
  canvas: {
1218
1263
  data: ""
1219
1264
  }
1220
- }, Gn = async (e) => {
1265
+ }, Vn = async (e) => {
1221
1266
  try {
1222
1267
  const t = Array.from(
1223
1268
  { length: 3 },
1224
- () => Vn(300, 30)
1225
- ), n = jn(t, 300, 30);
1269
+ () => jn(300, 30)
1270
+ ), n = Bn(t, 300, 30);
1226
1271
  return {
1227
1272
  canvas: {
1228
1273
  data: (await ot(n.data.toString())).toString()
@@ -1231,7 +1276,7 @@ const xn = {
1231
1276
  } catch {
1232
1277
  return it;
1233
1278
  }
1234
- }, Vn = (e, t) => {
1279
+ }, jn = (e, t) => {
1235
1280
  const n = document.createElement("canvas"), r = n.getContext("2d");
1236
1281
  if (!r)
1237
1282
  return new ImageData(1, 1);
@@ -1240,7 +1285,7 @@ const xn = {
1240
1285
  a.addColorStop(0, "red"), a.addColorStop(1 / 6, "orange"), a.addColorStop(2 / 6, "yellow"), a.addColorStop(3 / 6, "green"), a.addColorStop(4 / 6, "blue"), a.addColorStop(5 / 6, "indigo"), a.addColorStop(1, "violet"), r.fillStyle = a, r.fillRect(0, 0, n.width, n.height);
1241
1286
  const s = "mmMwWLliI0O&1 - Les sanglots longs des violons de l'automne blessent mon coeur d'une langueur monotone";
1242
1287
  return r.font = "26.321px Arial", r.fillStyle = "black", r.fillText(s, -5, 15), r.fillStyle = "rgba(0, 0, 255, 0.5)", r.fillText(s, -3.3, 17.7), r.beginPath(), r.moveTo(0, 0), r.lineTo(n.width * 2 / 7, n.height), r.strokeStyle = "white", r.lineWidth = 2, r.stroke(), r.getImageData(0, 0, n.width, n.height);
1243
- }, Yn = (e) => {
1288
+ }, Fn = (e) => {
1244
1289
  if (e.length === 0)
1245
1290
  return 0;
1246
1291
  const t = {};
@@ -1250,17 +1295,17 @@ const xn = {
1250
1295
  for (const r in t)
1251
1296
  t[r] > t[n] && (n = parseInt(r, 10));
1252
1297
  return n;
1253
- }, jn = (e, t, n) => {
1298
+ }, Bn = (e, t, n) => {
1254
1299
  const r = [];
1255
1300
  for (let o = 0; o < e[0].data.length; o++) {
1256
1301
  const i = [];
1257
1302
  for (let u = 0; u < e.length; u++)
1258
1303
  i.push(e[u].data[o]);
1259
- r.push(Yn(i));
1304
+ r.push(Fn(i));
1260
1305
  }
1261
1306
  const a = r, s = new Uint8ClampedArray(a);
1262
1307
  return new ImageData(s, t, n);
1263
- }, Jn = [], Bn = "mmMwWLliI0O&1", Fn = "48px", $ = ["monospace", "sans-serif", "serif"], We = [
1308
+ }, qn = [], zn = "mmMwWLliI0O&1", Qn = "48px", K = ["monospace", "sans-serif", "serif"], Ge = [
1264
1309
  "sans-serif-thin",
1265
1310
  "ARNO PRO",
1266
1311
  "Agency FB",
@@ -1298,28 +1343,28 @@ const xn = {
1298
1343
  "TRAJAN PRO",
1299
1344
  "Univers CE 55 Medium",
1300
1345
  "ZWAdobeF"
1301
- ], qn = async (e) => Ln(async (t, { document: n }) => {
1346
+ ], Xn = async (e) => Mn(async (t, { document: n }) => {
1302
1347
  const r = n.body;
1303
- r.style.fontSize = Fn;
1348
+ r.style.fontSize = Qn;
1304
1349
  const a = n.createElement("div");
1305
1350
  a.style.setProperty("visibility", "hidden", "important");
1306
1351
  const s = {}, o = {}, i = (d) => {
1307
1352
  const m = n.createElement("span"), { style: S } = m;
1308
- return S.position = "absolute", S.top = "0", S.left = "0", S.fontFamily = d, m.textContent = Bn, a.appendChild(m), m;
1309
- }, u = (d, m) => i(`'${d}',${m}`), y = () => $.map(i), f = () => {
1353
+ return S.position = "absolute", S.top = "0", S.left = "0", S.fontFamily = d, m.textContent = zn, a.appendChild(m), m;
1354
+ }, u = (d, m) => i(`'${d}',${m}`), f = () => K.map(i), y = () => {
1310
1355
  const d = {};
1311
- for (const m of We)
1312
- d[m] = $.map(
1356
+ for (const m of Ge)
1357
+ d[m] = K.map(
1313
1358
  (S) => u(m, S)
1314
1359
  );
1315
1360
  return d;
1316
- }, h = (d) => $.some(
1361
+ }, h = (d) => K.some(
1317
1362
  (m, S) => d[S].offsetWidth !== s[m] || d[S].offsetHeight !== o[m]
1318
- ), p = y(), l = f();
1363
+ ), p = f(), l = y();
1319
1364
  r.appendChild(a);
1320
- for (let d = 0; d < $.length; d++)
1321
- s[$[d]] = p[d].offsetWidth, o[$[d]] = p[d].offsetHeight;
1322
- return We.filter((d) => h(l[d]));
1365
+ for (let d = 0; d < K.length; d++)
1366
+ s[K[d]] = p[d].offsetWidth, o[K[d]] = p[d].offsetHeight;
1367
+ return Ge.filter((d) => h(l[d]));
1323
1368
  }), ct = {
1324
1369
  vendor: "",
1325
1370
  vendorUnmasked: "",
@@ -1335,7 +1380,7 @@ const xn = {
1335
1380
  jsHeapSizeLimit: 0
1336
1381
  }
1337
1382
  };
1338
- function zn() {
1383
+ function Zn() {
1339
1384
  const e = document.createElement("canvas"), t = e.getContext("webgl") ?? e.getContext("experimental-webgl");
1340
1385
  if (t && "getParameter" in t) {
1341
1386
  const n = t.getExtension("WEBGL_debug_renderer_info");
@@ -1350,19 +1395,19 @@ function zn() {
1350
1395
  }
1351
1396
  return ct;
1352
1397
  }
1353
- function Qn() {
1398
+ function er() {
1354
1399
  const e = new Float32Array(1), t = new Uint8Array(e.buffer);
1355
1400
  return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
1356
1401
  }
1357
- const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && window.performance.memory || {
1402
+ const tr = () => navigator.deviceMemory || 0, nr = () => window.performance && window.performance.memory || {
1358
1403
  jsHeapSizeLimit: 0
1359
- }, er = async (e) => new Promise((t) => {
1404
+ }, rr = async (e) => new Promise((t) => {
1360
1405
  try {
1361
- const n = Xn(), r = Zn();
1406
+ const n = tr(), r = nr();
1362
1407
  t({
1363
1408
  hardware: {
1364
- videocard: zn(),
1365
- architecture: Qn(),
1409
+ videocard: Zn(),
1410
+ architecture: er(),
1366
1411
  deviceMemory: n.toString() || "undefined",
1367
1412
  jsHeapSizeLimit: r.jsHeapSizeLimit || 0
1368
1413
  }
@@ -1370,12 +1415,12 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
1370
1415
  } catch {
1371
1416
  t(ut);
1372
1417
  }
1373
- }), tr = {
1418
+ }), ar = {
1374
1419
  locales: {
1375
1420
  languages: "",
1376
1421
  timezone: ""
1377
1422
  }
1378
- }, nr = async (e) => new Promise((t) => {
1423
+ }, or = async (e) => new Promise((t) => {
1379
1424
  t({
1380
1425
  locales: {
1381
1426
  languages: navigator.language,
@@ -1390,7 +1435,7 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
1390
1435
  maxTouchPoints: 0,
1391
1436
  mediaMatches: []
1392
1437
  }
1393
- }, rr = async (e) => new Promise((t) => {
1438
+ }, sr = async (e) => new Promise((t) => {
1394
1439
  try {
1395
1440
  const n = window.screen, r = {
1396
1441
  screen: {
@@ -1398,7 +1443,7 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
1398
1443
  pixelDepth: n.pixelDepth,
1399
1444
  isTouchScreen: navigator.maxTouchPoints > 0,
1400
1445
  maxTouchPoints: navigator.maxTouchPoints,
1401
- mediaMatches: ar()
1446
+ mediaMatches: ir()
1402
1447
  }
1403
1448
  };
1404
1449
  t(r);
@@ -1406,7 +1451,7 @@ const Xn = () => navigator.deviceMemory || 0, Zn = () => window.performance && w
1406
1451
  t(lt);
1407
1452
  }
1408
1453
  });
1409
- function ar() {
1454
+ function ir() {
1410
1455
  const e = [], t = {
1411
1456
  "prefers-contrast": [
1412
1457
  "high",
@@ -1434,7 +1479,7 @@ function ar() {
1434
1479
  });
1435
1480
  }), e;
1436
1481
  }
1437
- const or = async (e) => {
1482
+ const cr = async (e) => {
1438
1483
  try {
1439
1484
  return {
1440
1485
  system: {
@@ -1454,48 +1499,55 @@ const or = async (e) => {
1454
1499
  productSub: "",
1455
1500
  product: ""
1456
1501
  }
1457
- }, sr = async (e) => {
1502
+ }, ur = async (e) => {
1458
1503
  try {
1459
1504
  return Promise.all([
1460
- Mn(),
1461
- Wn(),
1462
- Gn(),
1463
- qn(),
1464
- er(),
1465
- nr(),
1505
+ Jn(),
1506
+ Yn(),
1507
+ Vn(),
1508
+ Xn(),
1466
1509
  rr(),
1467
- or()
1510
+ or(),
1511
+ sr(),
1512
+ cr()
1468
1513
  ]);
1469
1514
  } catch {
1470
1515
  return [
1471
- xn,
1516
+ Gn,
1472
1517
  st,
1473
1518
  it,
1474
- Jn,
1519
+ qn,
1475
1520
  ut,
1476
- tr,
1521
+ ar,
1477
1522
  lt,
1478
1523
  dt
1479
1524
  ];
1480
1525
  }
1481
- }, ir = async (e) => {
1526
+ }, lr = async (e) => {
1482
1527
  try {
1483
- const t = await sr();
1528
+ const t = await ur();
1484
1529
  return await ot(JSON.stringify(t));
1485
1530
  } catch {
1486
1531
  return "";
1487
1532
  }
1488
- }, Z = "Oops! It looks like your session has expired. For your security, please log in again to continue.", cr = "Your session has been successfully terminated.", ee = "Login failed. Please try again.", Ee = "Error getting access token, please re-authenticate.", ur = "You forgot to wrap your component in <AuthProvider>.", ie = {
1533
+ }, ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", dr = "Your session has been successfully terminated.", re = "Login failed. Please try again.", Ae = "Error getting access token, please re-authenticate.", hr = "You forgot to wrap your component in <AuthProvider>.", le = {
1489
1534
  dev: "https://auth.gizmette.local.com:3003",
1490
1535
  prod: "https://mylogin.gizmette.com/auth"
1491
- }, te = "@@auth@@", G = "LOADING", V = "LOGIN", ht = "LOGOUT", lr = process.env.NODE_ENV === "production", pt = !lr, de = async ({
1536
+ }, ae = "@@auth@@", Y = "LOADING", V = "LOGIN", ht = "LOGOUT", pr = process.env.NODE_ENV === "production", pt = !pr, fr = (e) => {
1537
+ try {
1538
+ const t = In(e);
1539
+ return t ? t[b.USER_ID_KEY] : "";
1540
+ } catch {
1541
+ return "";
1542
+ }
1543
+ }, pe = async ({
1492
1544
  type: e,
1493
1545
  clientId: t,
1494
1546
  params: n = {}
1495
1547
  }) => {
1496
1548
  try {
1497
1549
  const r = await fetch(
1498
- pt ? `${ie.dev}/${e}` : `${ie.prod}/${e}`,
1550
+ pt ? `${le.dev}/${e}` : `${le.prod}/${e}`,
1499
1551
  {
1500
1552
  credentials: "include",
1501
1553
  method: "POST",
@@ -1517,7 +1569,7 @@ const or = async (e) => {
1517
1569
  } catch (r) {
1518
1570
  return console.error(r), { status: 500, data: [] };
1519
1571
  }
1520
- }, dr = async ({
1572
+ }, yr = async ({
1521
1573
  userId: e,
1522
1574
  idToken: t,
1523
1575
  accessToken: n,
@@ -1527,8 +1579,8 @@ const or = async (e) => {
1527
1579
  }) => {
1528
1580
  try {
1529
1581
  return {
1530
- status: (await de({
1531
- type: ce.LOGOUT,
1582
+ status: (await pe({
1583
+ type: de.LOGOUT,
1532
1584
  clientId: a,
1533
1585
  params: {
1534
1586
  userId: e,
@@ -1544,7 +1596,7 @@ const or = async (e) => {
1544
1596
  status: !1
1545
1597
  };
1546
1598
  }
1547
- }, Ge = async ({
1599
+ }, Je = async ({
1548
1600
  username: e,
1549
1601
  password: t,
1550
1602
  clientId: n,
@@ -1554,14 +1606,14 @@ const or = async (e) => {
1554
1606
  code: o,
1555
1607
  code_verifier: i,
1556
1608
  domain: u,
1557
- fingerprint: y
1609
+ fingerprint: f
1558
1610
  }) => {
1559
1611
  try {
1560
- const f = await de({
1561
- type: ce.AUTHENTICATE,
1612
+ const y = await pe({
1613
+ type: de.AUTHENTICATE,
1562
1614
  clientId: n,
1563
1615
  params: {
1564
- type: a || Y.ID_AND_ACCESS_TOKEN,
1616
+ type: a || F.ID_AND_ACCESS_TOKEN,
1565
1617
  username: e,
1566
1618
  password: t,
1567
1619
  sessionExpiration: s,
@@ -1569,14 +1621,14 @@ const or = async (e) => {
1569
1621
  code: o,
1570
1622
  code_verifier: i,
1571
1623
  domain: u,
1572
- fingerprint: y
1624
+ fingerprint: f
1573
1625
  }
1574
- }), h = await j(f.data.idToken);
1575
- return h && h.payload[I.USER_ID_KEY] !== "" && h.payload[I.NONCE_KEY] === r ? {
1576
- idToken: f.data.idToken,
1577
- accessToken: f.data.accessToken,
1578
- refreshToken: f.data.refreshToken,
1579
- userId: h.payload[I.USER_ID_KEY],
1626
+ }), h = await M(y.data.idToken);
1627
+ return h && h.payload[b.USER_ID_KEY] !== "" && h.payload[b.NONCE_KEY] === r ? {
1628
+ idToken: y.data.idToken,
1629
+ accessToken: y.data.accessToken,
1630
+ refreshToken: y.data.refreshToken,
1631
+ userId: h.payload[b.USER_ID_KEY],
1580
1632
  status: !0
1581
1633
  } : {
1582
1634
  status: !1
@@ -1586,17 +1638,17 @@ const or = async (e) => {
1586
1638
  status: !1
1587
1639
  };
1588
1640
  }
1589
- }, hr = async ({
1641
+ }, gr = async ({
1590
1642
  nonce: e,
1591
1643
  clientId: t,
1592
1644
  code_challenge: n
1593
1645
  }) => {
1594
1646
  try {
1595
- const r = await de({
1596
- type: ce.CODE,
1647
+ const r = await pe({
1648
+ type: de.CODE,
1597
1649
  clientId: t,
1598
1650
  params: {
1599
- type: Y.CODE,
1651
+ type: F.CODE,
1600
1652
  nonce: e,
1601
1653
  code_challenge: n
1602
1654
  }
@@ -1612,7 +1664,7 @@ const or = async (e) => {
1612
1664
  status: !1
1613
1665
  };
1614
1666
  }
1615
- }, pr = async ({
1667
+ }, mr = async ({
1616
1668
  clientId: e,
1617
1669
  userId: t,
1618
1670
  nonce: n,
@@ -1621,11 +1673,11 @@ const or = async (e) => {
1621
1673
  domain: s
1622
1674
  }) => {
1623
1675
  try {
1624
- const o = await de({
1625
- type: ce.AUTHENTICATE,
1676
+ const o = await pe({
1677
+ type: de.AUTHENTICATE,
1626
1678
  clientId: e,
1627
1679
  params: {
1628
- type: Y.REFRESH_TOKEN,
1680
+ type: F.REFRESH_TOKEN,
1629
1681
  userId: t,
1630
1682
  nonce: n,
1631
1683
  refreshToken: r,
@@ -1633,11 +1685,11 @@ const or = async (e) => {
1633
1685
  domain: s,
1634
1686
  fingerprint: await ft()
1635
1687
  }
1636
- }), i = await j(o.data.accessToken);
1637
- return i && i.payload[I.USER_ID_KEY] !== "" && i.payload[I.NONCE_KEY] === n ? {
1688
+ }), i = await M(o.data.accessToken);
1689
+ return i && i.payload[b.USER_ID_KEY] !== "" && i.payload[b.NONCE_KEY] === n ? {
1638
1690
  accessToken: o.data.accessToken,
1639
1691
  refreshToken: o.data.refreshToken,
1640
- userId: i.payload[I.USER_ID_KEY],
1692
+ userId: i.payload[b.USER_ID_KEY],
1641
1693
  status: !0
1642
1694
  } : {
1643
1695
  status: !1
@@ -1647,7 +1699,7 @@ const or = async (e) => {
1647
1699
  status: !1
1648
1700
  };
1649
1701
  }
1650
- }, ne = {
1702
+ }, oe = {
1651
1703
  GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1652
1704
  $clientId: String!,
1653
1705
  $username: String!,
@@ -1724,22 +1776,22 @@ const or = async (e) => {
1724
1776
  }`
1725
1777
  }, H = {
1726
1778
  GET_REGISTRATION_OPTIONS: {
1727
- schema: ne.GET_REGISTRATION_OPTIONS,
1779
+ schema: oe.GET_REGISTRATION_OPTIONS,
1728
1780
  method: "getPasskeyRegistrationOptions"
1729
1781
  },
1730
1782
  VERIFY_REGISTRATION: {
1731
- schema: ne.VERIFY_REGISTRATION,
1783
+ schema: oe.VERIFY_REGISTRATION,
1732
1784
  method: "verifyPasskeyRegistration"
1733
1785
  },
1734
1786
  GET_AUTHENTICATION_OPTIONS: {
1735
- schema: ne.GET_AUTHENTICATION_OPTIONS,
1787
+ schema: oe.GET_AUTHENTICATION_OPTIONS,
1736
1788
  method: "getPasskeyAuthenticationOptions"
1737
1789
  },
1738
1790
  VERIFY_AUTHENTICATION: {
1739
- schema: ne.VERIFY_AUTHENTICATION,
1791
+ schema: oe.VERIFY_AUTHENTICATION,
1740
1792
  method: "verifyPasskeyAuthentication"
1741
1793
  }
1742
- }, K = async ({
1794
+ }, L = async ({
1743
1795
  accessToken: e,
1744
1796
  type: t,
1745
1797
  clientId: n,
@@ -1747,7 +1799,7 @@ const or = async (e) => {
1747
1799
  }) => {
1748
1800
  try {
1749
1801
  const a = t != null && t.data ? t.data(r) : r, s = `Bearer ${e}`, o = await fetch(
1750
- pt ? `${ie.dev}/graphql` : `${ie.prod}/graphql`,
1802
+ pt ? `${le.dev}/graphql` : `${le.prod}/graphql`,
1751
1803
  {
1752
1804
  method: "POST",
1753
1805
  credentials: "include",
@@ -1776,16 +1828,16 @@ const or = async (e) => {
1776
1828
  }
1777
1829
  }, ft = async () => {
1778
1830
  try {
1779
- return await ir();
1831
+ return await lr();
1780
1832
  } catch {
1781
1833
  return "";
1782
1834
  }
1783
1835
  };
1784
- class fr {
1836
+ class wr {
1785
1837
  constructor(t = null, n = null) {
1786
- B(this, "refreshTokenPromise", null);
1787
- B(this, "accessToken");
1788
- B(this, "refreshToken");
1838
+ z(this, "refreshTokenPromise", null);
1839
+ z(this, "accessToken");
1840
+ z(this, "refreshToken");
1789
1841
  this.accessToken = t || "", this.refreshToken = n || "";
1790
1842
  }
1791
1843
  async refreshtoken({
@@ -1812,9 +1864,9 @@ class fr {
1812
1864
  nonce: r,
1813
1865
  domain: a
1814
1866
  }) {
1815
- const s = await j(this.refreshToken);
1816
- if (s && s.payload[I.USER_ID_KEY] !== "") {
1817
- const o = await pr({
1867
+ const s = await M(this.refreshToken);
1868
+ if (s && s.payload[b.USER_ID_KEY] !== "") {
1869
+ const o = await mr({
1818
1870
  clientId: t,
1819
1871
  userId: n,
1820
1872
  nonce: r,
@@ -1835,20 +1887,20 @@ class fr {
1835
1887
  };
1836
1888
  }
1837
1889
  }
1838
- const L = () => {
1839
- throw new Error(ur);
1840
- }, yt = Ct({
1890
+ const W = () => {
1891
+ throw new Error(hr);
1892
+ }, yt = kt({
1841
1893
  isAuthenticated: !1,
1842
1894
  isLoading: !1,
1843
1895
  authenticationType: null,
1844
- login: L,
1845
- logout: L,
1846
- getAccessToken: L,
1847
- getIdToken: L,
1848
- registeringForPasskey: L,
1849
- loginWithPasskey: L,
1896
+ login: W,
1897
+ logout: W,
1898
+ getAccessToken: W,
1899
+ getIdToken: W,
1900
+ registeringForPasskey: W,
1901
+ loginWithPasskey: W,
1850
1902
  logoutReason: ""
1851
- }), yr = kt.createContext({
1903
+ }), Er = Pt.createContext({
1852
1904
  state: {
1853
1905
  isLoading: !0,
1854
1906
  isAuthenticated: !1,
@@ -1859,7 +1911,7 @@ const L = () => {
1859
1911
  },
1860
1912
  dispatch: () => {
1861
1913
  }
1862
- }), gr = (e, t) => (t == null ? void 0 : t.type) === G ? {
1914
+ }), Sr = (e, t) => (t == null ? void 0 : t.type) === Y ? {
1863
1915
  ...e,
1864
1916
  isLoading: t.payload.isLoading
1865
1917
  } : (t == null ? void 0 : t.type) === V ? {
@@ -1876,36 +1928,36 @@ const L = () => {
1876
1928
  user: void 0,
1877
1929
  authenticationType: null,
1878
1930
  logoutReason: t.payload.logoutReason
1879
- } : e, Ir = ({
1931
+ } : e, kr = ({
1880
1932
  children: e,
1881
1933
  sessionExpiration: t,
1882
1934
  clientId: n,
1883
1935
  domain: r = "",
1884
1936
  debug: a = !1
1885
1937
  }) => {
1886
- const [s, o] = Ot(gr, {
1938
+ const [s, o] = Ot(Sr, {
1887
1939
  isLoading: !0,
1888
1940
  isAuthenticated: !1,
1889
1941
  authenticationType: null,
1890
1942
  user: void 0,
1891
1943
  logoutReason: "",
1892
1944
  debug: a
1893
- }), i = ke(!1), u = ke(""), [y, f, , h] = Q({
1894
- key: `${te}::${n}::@@user@@`
1895
- }), [p, l, , d] = Q({
1896
- key: `${te}::${n}::@@access@@`
1897
- }), [m, S, , J] = Q(
1945
+ }), i = Ce(!1), u = Ce(""), [f, y, , h] = ee({
1946
+ key: `${ae}::${n}::@@user@@`
1947
+ }), [p, l, , d] = ee({
1948
+ key: `${ae}::${n}::@@access@@`
1949
+ }), [m, S, , q] = ee(
1898
1950
  {
1899
- key: `${te}::${n}::@@refresh@@`
1951
+ key: `${ae}::${n}::@@refresh@@`
1900
1952
  }
1901
- ), [gt, be, , Ie] = Q({
1902
- key: `${te}::${n}::@@nonce@@`
1953
+ ), [gt, Ie, , _e] = ee({
1954
+ key: `${ae}::${n}::@@nonce@@`
1903
1955
  }), w = x(
1904
1956
  (...c) => {
1905
1957
  a && console.info(`==> [Auth ${Date.now()}]: `, ...c);
1906
1958
  },
1907
1959
  [a]
1908
- ), mt = new fr(p, m), U = x(
1960
+ ), mt = new wr(p, m), $ = x(
1909
1961
  (c) => {
1910
1962
  w(
1911
1963
  "removeStateAndLocalStorage: removing state and local storage with reason: ",
@@ -1913,96 +1965,98 @@ const L = () => {
1913
1965
  ), o({
1914
1966
  type: ht,
1915
1967
  payload: {
1916
- logoutReason: c || Z
1968
+ logoutReason: c || ne
1917
1969
  }
1918
- }), h(), d(), J(), Ie(), o({ type: G, payload: { isLoading: !1 } });
1970
+ }), h(), d(), q(), _e(), o({ type: Y, payload: { isLoading: !1 } });
1919
1971
  },
1920
- [d, h, Ie, J, w]
1921
- ), N = x(
1972
+ [d, h, _e, q, w]
1973
+ ), D = x(
1922
1974
  async (c) => {
1923
1975
  w("invalidateAndLogout: invalidating and logging out");
1924
- const { user: E } = s;
1925
- await dr({
1926
- userId: (E == null ? void 0 : E.userId) || "",
1927
- idToken: y,
1976
+ const { user: E } = s, g = (E == null ? void 0 : E.userId) || fr(f);
1977
+ g || w(
1978
+ "invalidateAndLogout: user cannot be identified, logging out without userId"
1979
+ ), await yr({
1980
+ userId: g,
1981
+ idToken: f,
1928
1982
  accessToken: p,
1929
1983
  refreshToken: m,
1930
1984
  clientId: n,
1931
1985
  domain: r
1932
- }), U(c || Z);
1986
+ }), $(c || ne);
1933
1987
  },
1934
1988
  [
1935
1989
  p,
1936
1990
  s,
1937
1991
  n,
1938
1992
  r,
1939
- y,
1993
+ f,
1940
1994
  m,
1941
- U,
1995
+ $,
1942
1996
  w
1943
1997
  ]
1944
1998
  );
1945
- Se(() => ((async () => (w("useEffect: setting the fingerprint"), u.current = await ft()))(), () => {
1999
+ Te(() => ((async () => (w("useEffect: setting the fingerprint"), u.current = await ft()))(), () => {
1946
2000
  w("useEffect: cleaning up the fingerprint"), u.current = "";
1947
- }), []), Se(() => {
2001
+ }), []), Te(() => {
1948
2002
  if (!i.current)
1949
- return s.isLoading && y !== null ? (async () => {
2003
+ return s.isLoading && f !== null ? (async () => {
1950
2004
  try {
1951
- const c = await j(y);
1952
- c && c.payload[I.USER_ID_KEY] !== "" ? (w("useEffect: setting the authentication state"), o({
2005
+ const c = await M(f);
2006
+ c && c.payload[b.USER_ID_KEY] !== "" ? (w("useEffect: setting the authentication state"), o({
1953
2007
  type: V,
1954
2008
  payload: {
1955
- authenticationType: c.payload[I.AUTH_TYPE_KEY],
2009
+ authenticationType: c.payload[b.AUTH_TYPE_KEY],
1956
2010
  user: {
1957
- userId: c.payload[I.USER_ID_KEY],
1958
- username: c.payload[I.USERNAME_KEY]
2011
+ userId: c.payload[b.USER_ID_KEY],
2012
+ username: c.payload[b.USERNAME_KEY]
1959
2013
  }
1960
2014
  }
1961
- })) : (w("useEffect: invalid JWT, invalidating and logging out"), await N(Z));
2015
+ })) : (w("useEffect: invalid JWT, invalidating and logging out"), await D(ne));
1962
2016
  } catch {
1963
2017
  w(
1964
2018
  "useEffect: exception validating JWT, invalidating and logging out"
1965
- ), await N(Z);
2019
+ ), await D(ne);
1966
2020
  }
1967
- })() : (w("useEffect: setting the loading state to false"), o({ type: G, payload: { isLoading: !1 } })), () => {
2021
+ })() : (w("useEffect: setting the loading state to false"), o({ type: Y, payload: { isLoading: !1 } })), () => {
1968
2022
  i.current = !0;
1969
2023
  };
1970
- }, [s.isLoading, y, N, w]);
2024
+ }, [s.isLoading, f, D, w]);
1971
2025
  const wt = async (c, E, g) => {
1972
- const _ = we();
1973
- if (be(_), o({ type: G, payload: { isLoading: !0 } }), h(), d(), J(), w("login: Logging in with type: ", g), g === Y.CODE) {
1974
- const { code_verifier: bt, code_challenge: It } = await Cn(), _e = await hr({
2026
+ const _ = Se();
2027
+ if (Ie(_), o({ type: Y, payload: { isLoading: !0 } }), h(), d(), q(), w("login: Logging in with type: ", g), g === F.CODE) {
2028
+ const { code_verifier: bt, code_challenge: It } = await Dn(), ve = await gr({
1975
2029
  nonce: _,
1976
2030
  clientId: n,
1977
2031
  code_challenge: It
1978
2032
  });
1979
- if (_e.status) {
1980
- const W = await Ge({
2033
+ if (ve.status) {
2034
+ const J = await Je({
1981
2035
  username: c,
1982
2036
  password: E,
1983
2037
  clientId: n,
1984
2038
  sessionExpiration: t,
1985
2039
  nonce: _,
1986
2040
  type: g,
1987
- code: _e.code,
2041
+ code: ve.code,
1988
2042
  code_verifier: bt,
1989
2043
  domain: r,
1990
2044
  fingerprint: u.current
1991
2045
  });
1992
- return W.status ? (f(W.idToken), l(W.accessToken), S(W.refreshToken), o({
2046
+ return J.status ? (y(J.idToken), l(J.accessToken), S(J.refreshToken), o({
1993
2047
  type: V,
1994
2048
  payload: {
1995
2049
  authenticationType: g,
1996
2050
  user: {
1997
- userId: W.userId,
2051
+ userId: J.userId,
1998
2052
  username: c
1999
2053
  }
2000
2054
  }
2001
- }), !0) : (U(ee), !1);
2055
+ }), !0) : ($(re), !1);
2002
2056
  }
2003
2057
  return !1;
2004
2058
  }
2005
- const M = await Ge({
2059
+ const G = await Je({
2006
2060
  username: c,
2007
2061
  password: E,
2008
2062
  clientId: n,
@@ -2012,26 +2066,26 @@ const L = () => {
2012
2066
  domain: r,
2013
2067
  fingerprint: u.current
2014
2068
  });
2015
- return M.status ? (f(M.idToken), l(M.accessToken), S(M.refreshToken), o({
2069
+ return G.status ? (y(G.idToken), l(G.accessToken), S(G.refreshToken), o({
2016
2070
  type: V,
2017
2071
  payload: {
2018
2072
  authenticationType: g,
2019
2073
  user: {
2020
- userId: M.userId,
2074
+ userId: G.userId,
2021
2075
  username: c
2022
2076
  }
2023
2077
  }
2024
- }), !0) : (U(ee), !1);
2078
+ }), !0) : ($(re), !1);
2025
2079
  }, Et = async (c) => {
2026
- c == null || c.preventDefault(), await N(cr);
2080
+ c == null || c.preventDefault(), await D(dr);
2027
2081
  }, St = async () => {
2028
2082
  const { isAuthenticated: c, user: E } = s;
2029
2083
  try {
2030
2084
  if (c && E && E.userId) {
2031
2085
  if (p) {
2032
2086
  w("getAccessToken");
2033
- const _ = await j(p);
2034
- if (_ && _.payload[I.USER_ID_KEY] !== "")
2087
+ const _ = await M(p);
2088
+ if (_ && _.payload[b.USER_ID_KEY] !== "")
2035
2089
  return p;
2036
2090
  }
2037
2091
  w("getAccessToken: invalid access token, refreshing it");
@@ -2041,22 +2095,22 @@ const L = () => {
2041
2095
  nonce: gt,
2042
2096
  domain: r
2043
2097
  });
2044
- return g.status && g.status === "success" ? (l(g.newAccessToken), S(g.newRefreshToken), g.newAccessToken) : (w("getAccessToken: invalid refresh token, re-authenticating user"), await N(Ee), "");
2098
+ return g.status && g.status === "success" ? (l(g.newAccessToken), S(g.newRefreshToken), g.newAccessToken) : (w("getAccessToken: invalid refresh token, re-authenticating user"), await D(Ae), "");
2045
2099
  }
2046
2100
  return w(
2047
2101
  "getAccessToken: user is not authenticated, cannot get access token"
2048
- ), await N(Ee), "";
2102
+ ), await D(Ae), "";
2049
2103
  } catch {
2050
2104
  return w(
2051
2105
  "getAccessToken: exception occurred, invalidating and logging out"
2052
- ), await N(Ee), "";
2106
+ ), await D(Ae), "";
2053
2107
  }
2054
2108
  }, At = () => {
2055
- if (s.isAuthenticated && y)
2056
- return y;
2109
+ if (s.isAuthenticated && f)
2110
+ return f;
2057
2111
  }, Tt = async () => {
2058
2112
  const { user: c } = s;
2059
- let E = await K({
2113
+ let E = await L({
2060
2114
  accessToken: p,
2061
2115
  clientId: n,
2062
2116
  type: H.GET_REGISTRATION_OPTIONS,
@@ -2068,8 +2122,8 @@ const L = () => {
2068
2122
  });
2069
2123
  if (E.status)
2070
2124
  try {
2071
- const g = await Ht(E.data);
2072
- E = await K({
2125
+ const g = await Kt(E.data);
2126
+ E = await L({
2073
2127
  accessToken: p,
2074
2128
  clientId: n,
2075
2129
  type: H.VERIFY_REGISTRATION,
@@ -2081,7 +2135,7 @@ const L = () => {
2081
2135
  }
2082
2136
  });
2083
2137
  } catch {
2084
- return await K({
2138
+ return await L({
2085
2139
  accessToken: p,
2086
2140
  clientId: n,
2087
2141
  type: H.VERIFY_REGISTRATION,
@@ -2094,10 +2148,10 @@ const L = () => {
2094
2148
  }), !1;
2095
2149
  }
2096
2150
  }, Rt = async () => {
2097
- const c = we();
2098
- be(c), o({ type: G, payload: { isLoading: !0 } }), h(), d(), J(), w("loginWithPasskey");
2099
- const E = we();
2100
- let g = await K({
2151
+ const c = Se();
2152
+ Ie(c), o({ type: Y, payload: { isLoading: !0 } }), h(), d(), q(), w("loginWithPasskey");
2153
+ const E = Se();
2154
+ let g = await L({
2101
2155
  accessToken: p,
2102
2156
  clientId: n,
2103
2157
  type: H.GET_AUTHENTICATION_OPTIONS,
@@ -2108,8 +2162,8 @@ const L = () => {
2108
2162
  });
2109
2163
  if (g.status)
2110
2164
  try {
2111
- const _ = await xt(g.data);
2112
- return g = await K({
2165
+ const _ = await Wt(g.data);
2166
+ return g = await L({
2113
2167
  accessToken: p,
2114
2168
  clientId: n,
2115
2169
  type: H.VERIFY_AUTHENTICATION,
@@ -2121,18 +2175,18 @@ const L = () => {
2121
2175
  domain: r,
2122
2176
  fingerprint: u.current
2123
2177
  }
2124
- }), g.data.status === "success" ? (f(g.data.idToken), l(g.data.accessToken), S(g.data.refreshToken), o({
2178
+ }), g.data.status === "success" ? (y(g.data.idToken), l(g.data.accessToken), S(g.data.refreshToken), o({
2125
2179
  type: V,
2126
2180
  payload: {
2127
- authenticationType: Y.PASSKEY,
2181
+ authenticationType: F.PASSKEY,
2128
2182
  user: {
2129
2183
  userId: g.data.userId,
2130
2184
  username: g.data.username
2131
2185
  }
2132
2186
  }
2133
- }), !0) : (U(ee), !1);
2187
+ }), !0) : ($(re), !1);
2134
2188
  } catch {
2135
- return await K({
2189
+ return await L({
2136
2190
  accessToken: p,
2137
2191
  clientId: n,
2138
2192
  type: H.VERIFY_AUTHENTICATION,
@@ -2143,10 +2197,10 @@ const L = () => {
2143
2197
  nonce: c,
2144
2198
  domain: r
2145
2199
  }
2146
- }), U(ee), !1;
2200
+ }), $(re), !1;
2147
2201
  }
2148
2202
  };
2149
- return /* @__PURE__ */ ve(yr.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ ve(
2203
+ return /* @__PURE__ */ Pe(Er.Provider, { value: { state: s, dispatch: o }, children: /* @__PURE__ */ Pe(
2150
2204
  yt.Provider,
2151
2205
  {
2152
2206
  value: {
@@ -2161,9 +2215,10 @@ const L = () => {
2161
2215
  children: e
2162
2216
  }
2163
2217
  ) });
2164
- }, _r = (e = yt) => Nt(e);
2218
+ }, Or = (e = yt) => Nt(e);
2165
2219
  export {
2166
- Y as AUTH_TYPES,
2167
- Ir as AuthProvider,
2168
- _r as useAuth
2220
+ F as AUTH_TYPES,
2221
+ kr as AuthProvider,
2222
+ Cr as isGranted,
2223
+ Or as useAuth
2169
2224
  };