@versini/auth-provider 6.0.0 → 6.1.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.
Files changed (2) hide show
  1. package/dist/index.js +1117 -638
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -1,124 +1,124 @@
1
- var dt = Object.defineProperty;
2
- var ht = (e, t, r) => t in e ? dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var M = (e, t, r) => ht(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsx as Te } from "react/jsx-runtime";
5
- import pt, { useSyncExternalStore as ft, useCallback as x, useEffect as Ke, createContext as yt, useReducer as mt, useRef as Et, useContext as wt } from "react";
1
+ var Ot = Object.defineProperty;
2
+ var Nt = (e, t, r) => t in e ? Ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var Q = (e, t, r) => Nt(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as Ue } from "react/jsx-runtime";
5
+ import Dt, { useSyncExternalStore as Ut, useCallback as Y, useEffect as Xe, createContext as $t, useReducer as Kt, useRef as Lt, useContext as Mt } from "react";
6
6
  /*!
7
- @versini/auth-provider v6.0.0
7
+ @versini/auth-provider v6.1.0
8
8
  © 2024 gizmette.com
9
9
  */
10
10
  try {
11
11
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
12
- version: "6.0.0",
13
- buildTime: "07/15/2024 12:46 PM EDT",
12
+ version: "6.1.0",
13
+ buildTime: "07/16/2024 05:03 PM EDT",
14
14
  homepage: "https://github.com/aversini/auth-client",
15
15
  license: "MIT"
16
16
  });
17
17
  } catch {
18
18
  }
19
- function _(e) {
19
+ function P(e) {
20
20
  const t = new Uint8Array(e);
21
21
  let r = "";
22
22
  for (const a of t)
23
23
  r += String.fromCharCode(a);
24
24
  return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
25
25
  }
26
- function te(e) {
27
- const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), o = new ArrayBuffer(a.length), s = new Uint8Array(o);
28
- for (let i = 0; i < a.length; i++)
29
- s[i] = a.charCodeAt(i);
30
- return o;
26
+ function ue(e) {
27
+ const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), i = new ArrayBuffer(a.length), o = new Uint8Array(i);
28
+ for (let s = 0; s < a.length; s++)
29
+ o[s] = a.charCodeAt(s);
30
+ return i;
31
31
  }
32
- function Ee() {
32
+ function Pe() {
33
33
  return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
34
34
  }
35
- function He(e) {
35
+ function Ze(e) {
36
36
  const { id: t } = e;
37
37
  return {
38
38
  ...e,
39
- id: te(t),
39
+ id: ue(t),
40
40
  transports: e.transports
41
41
  };
42
42
  }
43
- function $e(e) {
43
+ function et(e) {
44
44
  return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
45
45
  }
46
- class A extends Error {
46
+ class v extends Error {
47
47
  constructor({ message: t, code: r, cause: n, name: a }) {
48
48
  super(t, { cause: n }), this.name = a ?? n.name, this.code = r;
49
49
  }
50
50
  }
51
- function gt({ error: e, options: t }) {
51
+ function Ht({ error: e, options: t }) {
52
52
  var n, a;
53
53
  const { publicKey: r } = t;
54
54
  if (!r)
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 A({
58
+ return new v({
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 (((n = r.authenticatorSelection) == null ? void 0 : n.requireResidentKey) === !0)
65
- return new A({
65
+ return new v({
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 = r.authenticatorSelection) == null ? void 0 : a.userVerification) === "required")
71
- return new A({
71
+ return new v({
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 A({
78
+ return new v({
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 A({
84
+ return new v({
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 r.pubKeyCredParams.filter((s) => s.type === "public-key").length === 0 ? new A({
90
+ return r.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new v({
91
91
  message: 'No entry in pubKeyCredParams was of type "public-key"',
92
92
  code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
93
93
  cause: e
94
- }) : new A({
94
+ }) : new v({
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
- const o = window.location.hostname;
101
- if ($e(o)) {
102
- if (r.rp.id !== o)
103
- return new A({
100
+ const i = window.location.hostname;
101
+ if (et(i)) {
102
+ if (r.rp.id !== i)
103
+ return new v({
104
104
  message: `The RP ID "${r.rp.id}" is invalid for this domain`,
105
105
  code: "ERROR_INVALID_RP_ID",
106
106
  cause: e
107
107
  });
108
- } else return new A({
108
+ } else return new v({
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 (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
115
- return new A({
115
+ return new v({
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 A({
121
+ return new v({
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
@@ -126,7 +126,7 @@ function gt({ error: e, options: t }) {
126
126
  }
127
127
  return e;
128
128
  }
129
- class At {
129
+ class xt {
130
130
  createNewAbortSignal() {
131
131
  if (this.controller) {
132
132
  const r = new Error("Cancelling existing WebAuthn API call for new one");
@@ -142,118 +142,118 @@ class At {
142
142
  }
143
143
  }
144
144
  }
145
- const Le = new At(), St = ["cross-platform", "platform"];
146
- function We(e) {
147
- if (e && !(St.indexOf(e) < 0))
145
+ const tt = new xt(), Wt = ["cross-platform", "platform"];
146
+ function rt(e) {
147
+ if (e && !(Wt.indexOf(e) < 0))
148
148
  return e;
149
149
  }
150
- async function Tt(e) {
151
- var m;
152
- if (!Ee())
150
+ async function Gt(e) {
151
+ var g;
152
+ if (!Pe())
153
153
  throw new Error("WebAuthn is not supported in this browser");
154
154
  const r = { publicKey: {
155
155
  ...e,
156
- challenge: te(e.challenge),
156
+ challenge: ue(e.challenge),
157
157
  user: {
158
158
  ...e.user,
159
- id: te(e.user.id)
159
+ id: ue(e.user.id)
160
160
  },
161
- excludeCredentials: (m = e.excludeCredentials) == null ? void 0 : m.map(He)
161
+ excludeCredentials: (g = e.excludeCredentials) == null ? void 0 : g.map(Ze)
162
162
  } };
163
- r.signal = Le.createNewAbortSignal();
163
+ r.signal = tt.createNewAbortSignal();
164
164
  let n;
165
165
  try {
166
166
  n = await navigator.credentials.create(r);
167
- } catch (d) {
168
- throw gt({ error: d, options: r });
167
+ } catch (p) {
168
+ throw Ht({ error: p, options: r });
169
169
  }
170
170
  if (!n)
171
171
  throw new Error("Registration was not completed");
172
- const { id: a, rawId: o, response: s, type: i } = n;
172
+ const { id: a, rawId: i, response: o, type: s } = n;
173
173
  let u;
174
- typeof s.getTransports == "function" && (u = s.getTransports());
174
+ typeof o.getTransports == "function" && (u = o.getTransports());
175
175
  let h;
176
- if (typeof s.getPublicKeyAlgorithm == "function")
176
+ if (typeof o.getPublicKeyAlgorithm == "function")
177
177
  try {
178
- h = s.getPublicKeyAlgorithm();
179
- } catch (d) {
180
- ce("getPublicKeyAlgorithm()", d);
178
+ h = o.getPublicKeyAlgorithm();
179
+ } catch (p) {
180
+ ge("getPublicKeyAlgorithm()", p);
181
181
  }
182
- let l;
183
- if (typeof s.getPublicKey == "function")
182
+ let c;
183
+ if (typeof o.getPublicKey == "function")
184
184
  try {
185
- const d = s.getPublicKey();
186
- d !== null && (l = _(d));
187
- } catch (d) {
188
- ce("getPublicKey()", d);
185
+ const p = o.getPublicKey();
186
+ p !== null && (c = P(p));
187
+ } catch (p) {
188
+ ge("getPublicKey()", p);
189
189
  }
190
190
  let f;
191
- if (typeof s.getAuthenticatorData == "function")
191
+ if (typeof o.getAuthenticatorData == "function")
192
192
  try {
193
- f = _(s.getAuthenticatorData());
194
- } catch (d) {
195
- ce("getAuthenticatorData()", d);
193
+ f = P(o.getAuthenticatorData());
194
+ } catch (p) {
195
+ ge("getAuthenticatorData()", p);
196
196
  }
197
197
  return {
198
198
  id: a,
199
- rawId: _(o),
199
+ rawId: P(i),
200
200
  response: {
201
- attestationObject: _(s.attestationObject),
202
- clientDataJSON: _(s.clientDataJSON),
201
+ attestationObject: P(o.attestationObject),
202
+ clientDataJSON: P(o.clientDataJSON),
203
203
  transports: u,
204
204
  publicKeyAlgorithm: h,
205
- publicKey: l,
205
+ publicKey: c,
206
206
  authenticatorData: f
207
207
  },
208
- type: i,
208
+ type: s,
209
209
  clientExtensionResults: n.getClientExtensionResults(),
210
- authenticatorAttachment: We(n.authenticatorAttachment)
210
+ authenticatorAttachment: rt(n.authenticatorAttachment)
211
211
  };
212
212
  }
213
- function ce(e, t) {
213
+ function ge(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 Rt() {
218
- if (!Ee())
217
+ function Vt() {
218
+ if (!Pe())
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();
222
222
  }
223
- function It({ error: e, options: t }) {
223
+ function jt({ error: e, options: t }) {
224
224
  const { publicKey: r } = t;
225
225
  if (!r)
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 A({
229
+ return new v({
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 A({
236
+ return new v({
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 n = window.location.hostname;
243
- if ($e(n)) {
243
+ if (et(n)) {
244
244
  if (r.rpId !== n)
245
- return new A({
245
+ return new v({
246
246
  message: `The RP ID "${r.rpId}" is invalid for this domain`,
247
247
  code: "ERROR_INVALID_RP_ID",
248
248
  cause: e
249
249
  });
250
- } else return new A({
250
+ } else return new v({
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 A({
256
+ return new v({
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,47 +261,47 @@ function It({ error: e, options: t }) {
261
261
  }
262
262
  return e;
263
263
  }
264
- async function _t(e, t = !1) {
265
- var f, m;
266
- if (!Ee())
264
+ async function Bt(e, t = !1) {
265
+ var f, g;
266
+ if (!Pe())
267
267
  throw new Error("WebAuthn is not supported in this browser");
268
268
  let r;
269
- ((f = e.allowCredentials) == null ? void 0 : f.length) !== 0 && (r = (m = e.allowCredentials) == null ? void 0 : m.map(He));
269
+ ((f = e.allowCredentials) == null ? void 0 : f.length) !== 0 && (r = (g = e.allowCredentials) == null ? void 0 : g.map(Ze));
270
270
  const n = {
271
271
  ...e,
272
- challenge: te(e.challenge),
272
+ challenge: ue(e.challenge),
273
273
  allowCredentials: r
274
274
  }, a = {};
275
275
  if (t) {
276
- if (!await Rt())
276
+ if (!await Vt())
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');
280
280
  a.mediation = "conditional", n.allowCredentials = [];
281
281
  }
282
- a.publicKey = n, a.signal = Le.createNewAbortSignal();
283
- let o;
282
+ a.publicKey = n, a.signal = tt.createNewAbortSignal();
283
+ let i;
284
284
  try {
285
- o = await navigator.credentials.get(a);
286
- } catch (d) {
287
- throw It({ error: d, options: a });
285
+ i = await navigator.credentials.get(a);
286
+ } catch (p) {
287
+ throw jt({ error: p, options: a });
288
288
  }
289
- if (!o)
289
+ if (!i)
290
290
  throw new Error("Authentication was not completed");
291
- const { id: s, rawId: i, response: u, type: h } = o;
292
- let l;
293
- return u.userHandle && (l = _(u.userHandle)), {
294
- id: s,
295
- rawId: _(i),
291
+ const { id: o, rawId: s, response: u, type: h } = i;
292
+ let c;
293
+ return u.userHandle && (c = P(u.userHandle)), {
294
+ id: o,
295
+ rawId: P(s),
296
296
  response: {
297
- authenticatorData: _(u.authenticatorData),
298
- clientDataJSON: _(u.clientDataJSON),
299
- signature: _(u.signature),
300
- userHandle: l
297
+ authenticatorData: P(u.authenticatorData),
298
+ clientDataJSON: P(u.clientDataJSON),
299
+ signature: P(u.signature),
300
+ userHandle: c
301
301
  },
302
302
  type: h,
303
- clientExtensionResults: o.getClientExtensionResults(),
304
- authenticatorAttachment: We(o.authenticatorAttachment)
303
+ clientExtensionResults: i.getClientExtensionResults(),
304
+ authenticatorAttachment: rt(i.authenticatorAttachment)
305
305
  };
306
306
  }
307
307
  /*!
@@ -311,22 +311,22 @@ async function _t(e, t = !1) {
311
311
  try {
312
312
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
313
313
  version: "2.12.1",
314
- buildTime: "07/15/2024 12:46 PM EDT",
314
+ buildTime: "07/16/2024 05:03 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 J = {
321
321
  ID_TOKEN: "id_token",
322
322
  ACCESS_TOKEN: "token",
323
323
  ID_AND_ACCESS_TOKEN: "id_token token",
324
324
  CODE: "code",
325
325
  REFRESH_TOKEN: "refresh_token",
326
326
  PASSKEY: "passkey"
327
- }, xe = {
327
+ }, nt = {
328
328
  CLIENT_ID: "X-Auth-ClientId"
329
- }, S = {
329
+ }, b = {
330
330
  ALG: "RS256",
331
331
  USER_ID_KEY: "sub",
332
332
  TOKEN_ID_KEY: "__raw",
@@ -334,7 +334,7 @@ const Y = {
334
334
  USERNAME_KEY: "username",
335
335
  AUTH_TYPE_KEY: "auth_type",
336
336
  ISSUER: "gizmette.com"
337
- }, bt = `-----BEGIN PUBLIC KEY-----
337
+ }, Ft = `-----BEGIN PUBLIC KEY-----
338
338
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
339
339
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
340
340
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -342,33 +342,33 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
342
342
  l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
343
343
  sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
344
344
  awIDAQAB
345
- -----END PUBLIC KEY-----`, ae = {
345
+ -----END PUBLIC KEY-----`, he = {
346
346
  AUTHENTICATE: "authenticate",
347
347
  CODE: "code",
348
348
  LOGOUT: "logout"
349
- }, se = crypto, Ye = (e) => e instanceof CryptoKey, V = new TextEncoder(), oe = new TextDecoder();
350
- function kt(...e) {
351
- const t = e.reduce((a, { length: o }) => a + o, 0), r = new Uint8Array(t);
349
+ }, fe = crypto, at = (e) => e instanceof CryptoKey, X = new TextEncoder(), pe = new TextDecoder();
350
+ function Yt(...e) {
351
+ const t = e.reduce((a, { length: i }) => a + i, 0), r = new Uint8Array(t);
352
352
  let n = 0;
353
353
  for (const a of e)
354
354
  r.set(a, n), n += a.length;
355
355
  return r;
356
356
  }
357
- const Ot = (e) => {
357
+ const Jt = (e) => {
358
358
  const t = atob(e), r = new Uint8Array(t.length);
359
359
  for (let n = 0; n < t.length; n++)
360
360
  r[n] = t.charCodeAt(n);
361
361
  return r;
362
- }, Z = (e) => {
362
+ }, se = (e) => {
363
363
  let t = e;
364
- t instanceof Uint8Array && (t = oe.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
364
+ t instanceof Uint8Array && (t = pe.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
365
365
  try {
366
- return Ot(t);
366
+ return Jt(t);
367
367
  } catch {
368
368
  throw new TypeError("The input to be decoded is not correctly encoded.");
369
369
  }
370
370
  };
371
- class v extends Error {
371
+ let M = class extends Error {
372
372
  static get code() {
373
373
  return "ERR_JOSE_GENERIC";
374
374
  }
@@ -376,16 +376,15 @@ class v extends Error {
376
376
  var r;
377
377
  super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
378
378
  }
379
- }
380
- class I extends v {
379
+ }, _ = class extends M {
381
380
  static get code() {
382
381
  return "ERR_JWT_CLAIM_VALIDATION_FAILED";
383
382
  }
384
383
  constructor(t, r, n = "unspecified", a = "unspecified") {
385
384
  super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = n, this.reason = a, this.payload = r;
386
385
  }
387
- }
388
- class Re extends v {
386
+ };
387
+ class $e extends M {
389
388
  static get code() {
390
389
  return "ERR_JWT_EXPIRED";
391
390
  }
@@ -393,7 +392,7 @@ class Re extends v {
393
392
  super(t), this.code = "ERR_JWT_EXPIRED", this.claim = n, this.reason = a, this.payload = r;
394
393
  }
395
394
  }
396
- class Pt extends v {
395
+ class qt extends M {
397
396
  constructor() {
398
397
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
399
398
  }
@@ -401,23 +400,21 @@ class Pt extends v {
401
400
  return "ERR_JOSE_ALG_NOT_ALLOWED";
402
401
  }
403
402
  }
404
- class O extends v {
403
+ let U = class extends M {
405
404
  constructor() {
406
405
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
407
406
  }
408
407
  static get code() {
409
408
  return "ERR_JOSE_NOT_SUPPORTED";
410
409
  }
411
- }
412
- class g extends v {
410
+ }, S = class extends M {
413
411
  constructor() {
414
412
  super(...arguments), this.code = "ERR_JWS_INVALID";
415
413
  }
416
414
  static get code() {
417
415
  return "ERR_JWS_INVALID";
418
416
  }
419
- }
420
- let Ge = class extends v {
417
+ }, ot = class extends M {
421
418
  constructor() {
422
419
  super(...arguments), this.code = "ERR_JWT_INVALID";
423
420
  }
@@ -425,7 +422,7 @@ let Ge = class extends v {
425
422
  return "ERR_JWT_INVALID";
426
423
  }
427
424
  };
428
- class vt extends v {
425
+ class zt extends M {
429
426
  constructor() {
430
427
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
431
428
  }
@@ -433,16 +430,16 @@ class vt extends v {
433
430
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
434
431
  }
435
432
  }
436
- function b(e, t = "algorithm.name") {
433
+ function C(e, t = "algorithm.name") {
437
434
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
438
435
  }
439
- function J(e, t) {
436
+ function Z(e, t) {
440
437
  return e.name === t;
441
438
  }
442
- function ue(e) {
439
+ function ye(e) {
443
440
  return parseInt(e.name.slice(4), 10);
444
441
  }
445
- function Ct(e) {
442
+ function Qt(e) {
446
443
  switch (e) {
447
444
  case "ES256":
448
445
  return "P-256";
@@ -454,7 +451,7 @@ function Ct(e) {
454
451
  throw new Error("unreachable");
455
452
  }
456
453
  }
457
- function Nt(e, t) {
454
+ function Xt(e, t) {
458
455
  if (t.length && !t.some((r) => e.usages.includes(r))) {
459
456
  let r = "CryptoKey does not support this operation, its usages must include ";
460
457
  if (t.length > 2) {
@@ -464,59 +461,59 @@ function Nt(e, t) {
464
461
  throw new TypeError(r);
465
462
  }
466
463
  }
467
- function Dt(e, t, ...r) {
464
+ function Zt(e, t, ...r) {
468
465
  switch (t) {
469
466
  case "HS256":
470
467
  case "HS384":
471
468
  case "HS512": {
472
- if (!J(e.algorithm, "HMAC"))
473
- throw b("HMAC");
469
+ if (!Z(e.algorithm, "HMAC"))
470
+ throw C("HMAC");
474
471
  const n = parseInt(t.slice(2), 10);
475
- if (ue(e.algorithm.hash) !== n)
476
- throw b(`SHA-${n}`, "algorithm.hash");
472
+ if (ye(e.algorithm.hash) !== n)
473
+ throw C(`SHA-${n}`, "algorithm.hash");
477
474
  break;
478
475
  }
479
476
  case "RS256":
480
477
  case "RS384":
481
478
  case "RS512": {
482
- if (!J(e.algorithm, "RSASSA-PKCS1-v1_5"))
483
- throw b("RSASSA-PKCS1-v1_5");
479
+ if (!Z(e.algorithm, "RSASSA-PKCS1-v1_5"))
480
+ throw C("RSASSA-PKCS1-v1_5");
484
481
  const n = parseInt(t.slice(2), 10);
485
- if (ue(e.algorithm.hash) !== n)
486
- throw b(`SHA-${n}`, "algorithm.hash");
482
+ if (ye(e.algorithm.hash) !== n)
483
+ throw C(`SHA-${n}`, "algorithm.hash");
487
484
  break;
488
485
  }
489
486
  case "PS256":
490
487
  case "PS384":
491
488
  case "PS512": {
492
- if (!J(e.algorithm, "RSA-PSS"))
493
- throw b("RSA-PSS");
489
+ if (!Z(e.algorithm, "RSA-PSS"))
490
+ throw C("RSA-PSS");
494
491
  const n = parseInt(t.slice(2), 10);
495
- if (ue(e.algorithm.hash) !== n)
496
- throw b(`SHA-${n}`, "algorithm.hash");
492
+ if (ye(e.algorithm.hash) !== n)
493
+ throw C(`SHA-${n}`, "algorithm.hash");
497
494
  break;
498
495
  }
499
496
  case "EdDSA": {
500
497
  if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
501
- throw b("Ed25519 or Ed448");
498
+ throw C("Ed25519 or Ed448");
502
499
  break;
503
500
  }
504
501
  case "ES256":
505
502
  case "ES384":
506
503
  case "ES512": {
507
- if (!J(e.algorithm, "ECDSA"))
508
- throw b("ECDSA");
509
- const n = Ct(t);
504
+ if (!Z(e.algorithm, "ECDSA"))
505
+ throw C("ECDSA");
506
+ const n = Qt(t);
510
507
  if (e.algorithm.namedCurve !== n)
511
- throw b(n, "algorithm.namedCurve");
508
+ throw C(n, "algorithm.namedCurve");
512
509
  break;
513
510
  }
514
511
  default:
515
512
  throw new TypeError("CryptoKey does not support this operation");
516
513
  }
517
- Nt(e, r);
514
+ Xt(e, r);
518
515
  }
519
- function Me(e, t, ...r) {
516
+ function it(e, t, ...r) {
520
517
  var n;
521
518
  if (r.length > 2) {
522
519
  const a = r.pop();
@@ -524,11 +521,11 @@ function Me(e, t, ...r) {
524
521
  } else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
525
522
  return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (n = t.constructor) != null && n.name && (e += ` Received an instance of ${t.constructor.name}`), e;
526
523
  }
527
- const Ie = (e, ...t) => Me("Key must be ", e, ...t);
528
- function Ve(e, t, ...r) {
529
- return Me(`Key for the ${e} algorithm must be `, t, ...r);
524
+ const Ke = (e, ...t) => it("Key must be ", e, ...t);
525
+ function st(e, t, ...r) {
526
+ return it(`Key for the ${e} algorithm must be `, t, ...r);
530
527
  }
531
- const Je = (e) => Ye(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", re = ["CryptoKey"], Ut = (...e) => {
528
+ const ct = (e) => at(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", le = ["CryptoKey"], er = (...e) => {
532
529
  const t = e.filter(Boolean);
533
530
  if (t.length === 0 || t.length === 1)
534
531
  return !0;
@@ -539,19 +536,19 @@ const Je = (e) => Ye(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
539
536
  r = new Set(a);
540
537
  continue;
541
538
  }
542
- for (const o of a) {
543
- if (r.has(o))
539
+ for (const i of a) {
540
+ if (r.has(i))
544
541
  return !1;
545
- r.add(o);
542
+ r.add(i);
546
543
  }
547
544
  }
548
545
  return !0;
549
546
  };
550
- function Kt(e) {
547
+ function tr(e) {
551
548
  return typeof e == "object" && e !== null;
552
549
  }
553
- function me(e) {
554
- if (!Kt(e) || Object.prototype.toString.call(e) !== "[object Object]")
550
+ function _e(e) {
551
+ if (!tr(e) || Object.prototype.toString.call(e) !== "[object Object]")
555
552
  return !1;
556
553
  if (Object.getPrototypeOf(e) === null)
557
554
  return !0;
@@ -560,14 +557,14 @@ function me(e) {
560
557
  t = Object.getPrototypeOf(t);
561
558
  return Object.getPrototypeOf(e) === t;
562
559
  }
563
- const Ht = (e, t) => {
560
+ const rr = (e, t) => {
564
561
  if (e.startsWith("RS") || e.startsWith("PS")) {
565
562
  const { modulusLength: r } = t.algorithm;
566
563
  if (typeof r != "number" || r < 2048)
567
564
  throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
568
565
  }
569
566
  };
570
- function $t(e) {
567
+ function nr(e) {
571
568
  let t, r;
572
569
  switch (e.kty) {
573
570
  case "RSA": {
@@ -592,7 +589,7 @@ function $t(e) {
592
589
  }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
593
590
  break;
594
591
  default:
595
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
592
+ throw new U('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
596
593
  }
597
594
  break;
598
595
  }
@@ -614,7 +611,7 @@ function $t(e) {
614
611
  t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
615
612
  break;
616
613
  default:
617
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
614
+ throw new U('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
618
615
  }
619
616
  break;
620
617
  }
@@ -630,168 +627,168 @@ function $t(e) {
630
627
  t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
631
628
  break;
632
629
  default:
633
- throw new O('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
630
+ throw new U('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
634
631
  }
635
632
  break;
636
633
  }
637
634
  default:
638
- throw new O('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
635
+ throw new U('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
639
636
  }
640
637
  return { algorithm: t, keyUsages: r };
641
638
  }
642
- const Lt = async (e) => {
639
+ const ar = async (e) => {
643
640
  if (!e.alg)
644
641
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
645
- const { algorithm: t, keyUsages: r } = $t(e), n = [
642
+ const { algorithm: t, keyUsages: r } = nr(e), n = [
646
643
  t,
647
644
  e.ext ?? !1,
648
645
  e.key_ops ?? r
649
646
  ], a = { ...e };
650
- return delete a.alg, delete a.use, se.subtle.importKey("jwk", a, ...n);
651
- }, je = (e) => Z(e);
652
- let le, de;
653
- const Fe = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Be = async (e, t, r, n) => {
647
+ return delete a.alg, delete a.use, fe.subtle.importKey("jwk", a, ...n);
648
+ }, ut = (e) => se(e);
649
+ let we, Ee;
650
+ const lt = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", dt = async (e, t, r, n) => {
654
651
  let a = e.get(t);
655
652
  if (a != null && a[n])
656
653
  return a[n];
657
- const o = await Lt({ ...r, alg: n });
658
- return a ? a[n] = o : e.set(t, { [n]: o }), o;
659
- }, Wt = (e, t) => {
660
- if (Fe(e)) {
654
+ const i = await ar({ ...r, alg: n });
655
+ return a ? a[n] = i : e.set(t, { [n]: i }), i;
656
+ }, or = (e, t) => {
657
+ if (lt(e)) {
661
658
  let r = e.export({ format: "jwk" });
662
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? je(r.k) : (de || (de = /* @__PURE__ */ new WeakMap()), Be(de, e, r, t));
659
+ return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? ut(r.k) : (Ee || (Ee = /* @__PURE__ */ new WeakMap()), dt(Ee, e, r, t));
663
660
  }
664
661
  return e;
665
- }, xt = (e, t) => {
666
- if (Fe(e)) {
662
+ }, ir = (e, t) => {
663
+ if (lt(e)) {
667
664
  let r = e.export({ format: "jwk" });
668
- return r.k ? je(r.k) : (le || (le = /* @__PURE__ */ new WeakMap()), Be(le, e, r, t));
665
+ return r.k ? ut(r.k) : (we || (we = /* @__PURE__ */ new WeakMap()), dt(we, e, r, t));
669
666
  }
670
667
  return e;
671
- }, Yt = { normalizePublicKey: Wt, normalizePrivateKey: xt }, k = (e, t, r = 0) => {
668
+ }, sr = { normalizePublicKey: or, normalizePrivateKey: ir }, D = (e, t, r = 0) => {
672
669
  r === 0 && (t.unshift(t.length), t.unshift(6));
673
670
  const n = e.indexOf(t[0], r);
674
671
  if (n === -1)
675
672
  return !1;
676
673
  const a = e.subarray(n, n + t.length);
677
- return a.length !== t.length ? !1 : a.every((o, s) => o === t[s]) || k(e, t, n + 1);
678
- }, _e = (e) => {
674
+ return a.length !== t.length ? !1 : a.every((i, o) => i === t[o]) || D(e, t, n + 1);
675
+ }, Le = (e) => {
679
676
  switch (!0) {
680
- case k(e, [42, 134, 72, 206, 61, 3, 1, 7]):
677
+ case D(e, [42, 134, 72, 206, 61, 3, 1, 7]):
681
678
  return "P-256";
682
- case k(e, [43, 129, 4, 0, 34]):
679
+ case D(e, [43, 129, 4, 0, 34]):
683
680
  return "P-384";
684
- case k(e, [43, 129, 4, 0, 35]):
681
+ case D(e, [43, 129, 4, 0, 35]):
685
682
  return "P-521";
686
- case k(e, [43, 101, 110]):
683
+ case D(e, [43, 101, 110]):
687
684
  return "X25519";
688
- case k(e, [43, 101, 111]):
685
+ case D(e, [43, 101, 111]):
689
686
  return "X448";
690
- case k(e, [43, 101, 112]):
687
+ case D(e, [43, 101, 112]):
691
688
  return "Ed25519";
692
- case k(e, [43, 101, 113]):
689
+ case D(e, [43, 101, 113]):
693
690
  return "Ed448";
694
691
  default:
695
- throw new O("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
692
+ throw new U("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
696
693
  }
697
- }, Gt = async (e, t, r, n, a) => {
698
- let o, s;
699
- const i = new Uint8Array(atob(r.replace(e, "")).split("").map((u) => u.charCodeAt(0)));
694
+ }, cr = async (e, t, r, n, a) => {
695
+ let i, o;
696
+ const s = new Uint8Array(atob(r.replace(e, "")).split("").map((u) => u.charCodeAt(0)));
700
697
  switch (n) {
701
698
  case "PS256":
702
699
  case "PS384":
703
700
  case "PS512":
704
- o = { name: "RSA-PSS", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
701
+ i = { name: "RSA-PSS", hash: `SHA-${n.slice(-3)}` }, o = ["verify"];
705
702
  break;
706
703
  case "RS256":
707
704
  case "RS384":
708
705
  case "RS512":
709
- o = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
706
+ i = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${n.slice(-3)}` }, o = ["verify"];
710
707
  break;
711
708
  case "RSA-OAEP":
712
709
  case "RSA-OAEP-256":
713
710
  case "RSA-OAEP-384":
714
711
  case "RSA-OAEP-512":
715
- o = {
712
+ i = {
716
713
  name: "RSA-OAEP",
717
714
  hash: `SHA-${parseInt(n.slice(-3), 10) || 1}`
718
- }, s = ["encrypt", "wrapKey"];
715
+ }, o = ["encrypt", "wrapKey"];
719
716
  break;
720
717
  case "ES256":
721
- o = { name: "ECDSA", namedCurve: "P-256" }, s = ["verify"];
718
+ i = { name: "ECDSA", namedCurve: "P-256" }, o = ["verify"];
722
719
  break;
723
720
  case "ES384":
724
- o = { name: "ECDSA", namedCurve: "P-384" }, s = ["verify"];
721
+ i = { name: "ECDSA", namedCurve: "P-384" }, o = ["verify"];
725
722
  break;
726
723
  case "ES512":
727
- o = { name: "ECDSA", namedCurve: "P-521" }, s = ["verify"];
724
+ i = { name: "ECDSA", namedCurve: "P-521" }, o = ["verify"];
728
725
  break;
729
726
  case "ECDH-ES":
730
727
  case "ECDH-ES+A128KW":
731
728
  case "ECDH-ES+A192KW":
732
729
  case "ECDH-ES+A256KW": {
733
- const u = _e(i);
734
- o = u.startsWith("P-") ? { name: "ECDH", namedCurve: u } : { name: u }, s = [];
730
+ const u = Le(s);
731
+ i = u.startsWith("P-") ? { name: "ECDH", namedCurve: u } : { name: u }, o = [];
735
732
  break;
736
733
  }
737
734
  case "EdDSA":
738
- o = { name: _e(i) }, s = ["verify"];
735
+ i = { name: Le(s) }, o = ["verify"];
739
736
  break;
740
737
  default:
741
- throw new O('Invalid or unsupported "alg" (Algorithm) value');
738
+ throw new U('Invalid or unsupported "alg" (Algorithm) value');
742
739
  }
743
- return se.subtle.importKey(t, i, o, !1, s);
744
- }, Mt = (e, t, r) => Gt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
745
- async function Vt(e, t, r) {
740
+ return fe.subtle.importKey(t, s, i, !1, o);
741
+ }, ur = (e, t, r) => cr(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
742
+ async function lr(e, t, r) {
746
743
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
747
744
  throw new TypeError('"spki" must be SPKI formatted string');
748
- return Mt(e, t);
745
+ return ur(e, t);
749
746
  }
750
- const ee = (e) => e == null ? void 0 : e[Symbol.toStringTag], Jt = (e, t) => {
747
+ const ce = (e) => e == null ? void 0 : e[Symbol.toStringTag], dr = (e, t) => {
751
748
  if (!(t instanceof Uint8Array)) {
752
- if (!Je(t))
753
- throw new TypeError(Ve(e, t, ...re, "Uint8Array"));
749
+ if (!ct(t))
750
+ throw new TypeError(st(e, t, ...le, "Uint8Array"));
754
751
  if (t.type !== "secret")
755
- throw new TypeError(`${ee(t)} instances for symmetric algorithms must be of type "secret"`);
752
+ throw new TypeError(`${ce(t)} instances for symmetric algorithms must be of type "secret"`);
756
753
  }
757
- }, jt = (e, t, r) => {
758
- if (!Je(t))
759
- throw new TypeError(Ve(e, t, ...re));
754
+ }, hr = (e, t, r) => {
755
+ if (!ct(t))
756
+ throw new TypeError(st(e, t, ...le));
760
757
  if (t.type === "secret")
761
- throw new TypeError(`${ee(t)} instances for asymmetric algorithms must not be of type "secret"`);
758
+ throw new TypeError(`${ce(t)} instances for asymmetric algorithms must not be of type "secret"`);
762
759
  if (t.algorithm && r === "verify" && t.type === "private")
763
- throw new TypeError(`${ee(t)} instances for asymmetric algorithm verifying must be of type "public"`);
760
+ throw new TypeError(`${ce(t)} instances for asymmetric algorithm verifying must be of type "public"`);
764
761
  if (t.algorithm && r === "encrypt" && t.type === "private")
765
- throw new TypeError(`${ee(t)} instances for asymmetric algorithm encryption must be of type "public"`);
766
- }, Ft = (e, t, r) => {
767
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? Jt(e, t) : jt(e, t, r);
762
+ throw new TypeError(`${ce(t)} instances for asymmetric algorithm encryption must be of type "public"`);
763
+ }, fr = (e, t, r) => {
764
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? dr(e, t) : hr(e, t, r);
768
765
  };
769
- function Bt(e, t, r, n, a) {
766
+ function pr(e, t, r, n, a) {
770
767
  if (a.crit !== void 0 && (n == null ? void 0 : n.crit) === void 0)
771
768
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
772
769
  if (!n || n.crit === void 0)
773
770
  return /* @__PURE__ */ new Set();
774
- if (!Array.isArray(n.crit) || n.crit.length === 0 || n.crit.some((s) => typeof s != "string" || s.length === 0))
771
+ if (!Array.isArray(n.crit) || n.crit.length === 0 || n.crit.some((o) => typeof o != "string" || o.length === 0))
775
772
  throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
776
- let o;
777
- r !== void 0 ? o = new Map([...Object.entries(r), ...t.entries()]) : o = t;
778
- for (const s of n.crit) {
779
- if (!o.has(s))
780
- throw new O(`Extension Header Parameter "${s}" is not recognized`);
781
- if (a[s] === void 0)
782
- throw new e(`Extension Header Parameter "${s}" is missing`);
783
- if (o.get(s) && n[s] === void 0)
784
- throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`);
773
+ let i;
774
+ r !== void 0 ? i = new Map([...Object.entries(r), ...t.entries()]) : i = t;
775
+ for (const o of n.crit) {
776
+ if (!i.has(o))
777
+ throw new U(`Extension Header Parameter "${o}" is not recognized`);
778
+ if (a[o] === void 0)
779
+ throw new e(`Extension Header Parameter "${o}" is missing`);
780
+ if (i.get(o) && n[o] === void 0)
781
+ throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`);
785
782
  }
786
783
  return new Set(n.crit);
787
784
  }
788
- const qt = (e, t) => {
785
+ const mr = (e, t) => {
789
786
  if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
790
787
  throw new TypeError(`"${e}" option must be an array of strings`);
791
788
  if (t)
792
789
  return new Set(t);
793
790
  };
794
- function zt(e, t) {
791
+ function gr(e, t) {
795
792
  const r = `SHA-${e.slice(-3)}`;
796
793
  switch (e) {
797
794
  case "HS256":
@@ -813,103 +810,103 @@ function zt(e, t) {
813
810
  case "EdDSA":
814
811
  return { name: t.name };
815
812
  default:
816
- throw new O(`alg ${e} is not supported either by JOSE or your javascript runtime`);
813
+ throw new U(`alg ${e} is not supported either by JOSE or your javascript runtime`);
817
814
  }
818
815
  }
819
- async function Qt(e, t, r) {
820
- if (t = await Yt.normalizePublicKey(t, e), Ye(t))
821
- return Dt(t, e, r), t;
816
+ async function yr(e, t, r) {
817
+ if (t = await sr.normalizePublicKey(t, e), at(t))
818
+ return Zt(t, e, r), t;
822
819
  if (t instanceof Uint8Array) {
823
820
  if (!e.startsWith("HS"))
824
- throw new TypeError(Ie(t, ...re));
825
- return se.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
821
+ throw new TypeError(Ke(t, ...le));
822
+ return fe.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
826
823
  }
827
- throw new TypeError(Ie(t, ...re, "Uint8Array"));
824
+ throw new TypeError(Ke(t, ...le, "Uint8Array"));
828
825
  }
829
- const Xt = async (e, t, r, n) => {
830
- const a = await Qt(e, t, "verify");
831
- Ht(e, a);
832
- const o = zt(e, a.algorithm);
826
+ const wr = async (e, t, r, n) => {
827
+ const a = await yr(e, t, "verify");
828
+ rr(e, a);
829
+ const i = gr(e, a.algorithm);
833
830
  try {
834
- return await se.subtle.verify(o, a, r, n);
831
+ return await fe.subtle.verify(i, a, r, n);
835
832
  } catch {
836
833
  return !1;
837
834
  }
838
835
  };
839
- async function Zt(e, t, r) {
840
- if (!me(e))
841
- throw new g("Flattened JWS must be an object");
836
+ async function Er(e, t, r) {
837
+ if (!_e(e))
838
+ throw new S("Flattened JWS must be an object");
842
839
  if (e.protected === void 0 && e.header === void 0)
843
- throw new g('Flattened JWS must have either of the "protected" or "header" members');
840
+ throw new S('Flattened JWS must have either of the "protected" or "header" members');
844
841
  if (e.protected !== void 0 && typeof e.protected != "string")
845
- throw new g("JWS Protected Header incorrect type");
842
+ throw new S("JWS Protected Header incorrect type");
846
843
  if (e.payload === void 0)
847
- throw new g("JWS Payload missing");
844
+ throw new S("JWS Payload missing");
848
845
  if (typeof e.signature != "string")
849
- throw new g("JWS Signature missing or incorrect type");
850
- if (e.header !== void 0 && !me(e.header))
851
- throw new g("JWS Unprotected Header incorrect type");
846
+ throw new S("JWS Signature missing or incorrect type");
847
+ if (e.header !== void 0 && !_e(e.header))
848
+ throw new S("JWS Unprotected Header incorrect type");
852
849
  let n = {};
853
850
  if (e.protected)
854
851
  try {
855
- const T = Z(e.protected);
856
- n = JSON.parse(oe.decode(T));
852
+ const A = se(e.protected);
853
+ n = JSON.parse(pe.decode(A));
857
854
  } catch {
858
- throw new g("JWS Protected Header is invalid");
855
+ throw new S("JWS Protected Header is invalid");
859
856
  }
860
- if (!Ut(n, e.header))
861
- throw new g("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
857
+ if (!er(n, e.header))
858
+ throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
862
859
  const a = {
863
860
  ...n,
864
861
  ...e.header
865
- }, o = Bt(g, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, n, a);
866
- let s = !0;
867
- if (o.has("b64") && (s = n.b64, typeof s != "boolean"))
868
- throw new g('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
869
- const { alg: i } = a;
870
- if (typeof i != "string" || !i)
871
- throw new g('JWS "alg" (Algorithm) Header Parameter missing or invalid');
872
- const u = r && qt("algorithms", r.algorithms);
873
- if (u && !u.has(i))
874
- throw new Pt('"alg" (Algorithm) Header Parameter value not allowed');
875
- if (s) {
862
+ }, i = pr(S, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, n, a);
863
+ let o = !0;
864
+ if (i.has("b64") && (o = n.b64, typeof o != "boolean"))
865
+ throw new S('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
866
+ const { alg: s } = a;
867
+ if (typeof s != "string" || !s)
868
+ throw new S('JWS "alg" (Algorithm) Header Parameter missing or invalid');
869
+ const u = r && mr("algorithms", r.algorithms);
870
+ if (u && !u.has(s))
871
+ throw new qt('"alg" (Algorithm) Header Parameter value not allowed');
872
+ if (o) {
876
873
  if (typeof e.payload != "string")
877
- throw new g("JWS Payload must be a string");
874
+ throw new S("JWS Payload must be a string");
878
875
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
879
- throw new g("JWS Payload must be a string or an Uint8Array instance");
876
+ throw new S("JWS Payload must be a string or an Uint8Array instance");
880
877
  let h = !1;
881
- typeof t == "function" && (t = await t(n, e), h = !0), Ft(i, t, "verify");
882
- const l = kt(V.encode(e.protected ?? ""), V.encode("."), typeof e.payload == "string" ? V.encode(e.payload) : e.payload);
878
+ typeof t == "function" && (t = await t(n, e), h = !0), fr(s, t, "verify");
879
+ const c = Yt(X.encode(e.protected ?? ""), X.encode("."), typeof e.payload == "string" ? X.encode(e.payload) : e.payload);
883
880
  let f;
884
881
  try {
885
- f = Z(e.signature);
882
+ f = se(e.signature);
886
883
  } catch {
887
- throw new g("Failed to base64url decode the signature");
884
+ throw new S("Failed to base64url decode the signature");
888
885
  }
889
- if (!await Xt(i, t, f, l))
890
- throw new vt();
891
- let m;
892
- if (s)
886
+ if (!await wr(s, t, f, c))
887
+ throw new zt();
888
+ let g;
889
+ if (o)
893
890
  try {
894
- m = Z(e.payload);
891
+ g = se(e.payload);
895
892
  } catch {
896
- throw new g("Failed to base64url decode the payload");
893
+ throw new S("Failed to base64url decode the payload");
897
894
  }
898
- else typeof e.payload == "string" ? m = V.encode(e.payload) : m = e.payload;
899
- const d = { payload: m };
900
- return e.protected !== void 0 && (d.protectedHeader = n), e.header !== void 0 && (d.unprotectedHeader = e.header), h ? { ...d, key: t } : d;
901
- }
902
- async function er(e, t, r) {
903
- if (e instanceof Uint8Array && (e = oe.decode(e)), typeof e != "string")
904
- throw new g("Compact JWS must be a string or Uint8Array");
905
- const { 0: n, 1: a, 2: o, length: s } = e.split(".");
906
- if (s !== 3)
907
- throw new g("Invalid Compact JWS");
908
- const i = await Zt({ payload: a, protected: n, signature: o }, t, r), u = { payload: i.payload, protectedHeader: i.protectedHeader };
909
- return typeof t == "function" ? { ...u, key: i.key } : u;
910
- }
911
- const tr = (e) => Math.floor(e.getTime() / 1e3), qe = 60, ze = qe * 60, we = ze * 24, rr = we * 7, nr = we * 365.25, ar = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, be = (e) => {
912
- const t = ar.exec(e);
895
+ else typeof e.payload == "string" ? g = X.encode(e.payload) : g = e.payload;
896
+ const p = { payload: g };
897
+ return e.protected !== void 0 && (p.protectedHeader = n), e.header !== void 0 && (p.unprotectedHeader = e.header), h ? { ...p, key: t } : p;
898
+ }
899
+ async function Sr(e, t, r) {
900
+ if (e instanceof Uint8Array && (e = pe.decode(e)), typeof e != "string")
901
+ throw new S("Compact JWS must be a string or Uint8Array");
902
+ const { 0: n, 1: a, 2: i, length: o } = e.split(".");
903
+ if (o !== 3)
904
+ throw new S("Invalid Compact JWS");
905
+ const s = await Er({ payload: a, protected: n, signature: i }, t, r), u = { payload: s.payload, protectedHeader: s.protectedHeader };
906
+ return typeof t == "function" ? { ...u, key: s.key } : u;
907
+ }
908
+ const Ar = (e) => Math.floor(e.getTime() / 1e3), ht = 60, ft = ht * 60, Ce = ft * 24, vr = Ce * 7, Tr = Ce * 365.25, br = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, Me = (e) => {
909
+ const t = br.exec(e);
913
910
  if (!t || t[4] && t[1])
914
911
  throw new TypeError("Invalid time period format");
915
912
  const r = parseFloat(t[2]), n = t[3].toLowerCase();
@@ -927,56 +924,56 @@ const tr = (e) => Math.floor(e.getTime() / 1e3), qe = 60, ze = qe * 60, we = ze
927
924
  case "min":
928
925
  case "mins":
929
926
  case "m":
930
- a = Math.round(r * qe);
927
+ a = Math.round(r * ht);
931
928
  break;
932
929
  case "hour":
933
930
  case "hours":
934
931
  case "hr":
935
932
  case "hrs":
936
933
  case "h":
937
- a = Math.round(r * ze);
934
+ a = Math.round(r * ft);
938
935
  break;
939
936
  case "day":
940
937
  case "days":
941
938
  case "d":
942
- a = Math.round(r * we);
939
+ a = Math.round(r * Ce);
943
940
  break;
944
941
  case "week":
945
942
  case "weeks":
946
943
  case "w":
947
- a = Math.round(r * rr);
944
+ a = Math.round(r * vr);
948
945
  break;
949
946
  default:
950
- a = Math.round(r * nr);
947
+ a = Math.round(r * Tr);
951
948
  break;
952
949
  }
953
950
  return t[1] === "-" || t[4] === "ago" ? -a : a;
954
- }, ke = (e) => e.toLowerCase().replace(/^application\//, ""), sr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, or = (e, t, r = {}) => {
951
+ }, He = (e) => e.toLowerCase().replace(/^application\//, ""), Rr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Ir = (e, t, r = {}) => {
955
952
  let n;
956
953
  try {
957
- n = JSON.parse(oe.decode(t));
954
+ n = JSON.parse(pe.decode(t));
958
955
  } catch {
959
956
  }
960
- if (!me(n))
961
- throw new Ge("JWT Claims Set must be a top-level JSON object");
957
+ if (!_e(n))
958
+ throw new ot("JWT Claims Set must be a top-level JSON object");
962
959
  const { typ: a } = r;
963
- if (a && (typeof e.typ != "string" || ke(e.typ) !== ke(a)))
964
- throw new I('unexpected "typ" JWT header value', n, "typ", "check_failed");
965
- const { requiredClaims: o = [], issuer: s, subject: i, audience: u, maxTokenAge: h } = r, l = [...o];
966
- h !== void 0 && l.push("iat"), u !== void 0 && l.push("aud"), i !== void 0 && l.push("sub"), s !== void 0 && l.push("iss");
967
- for (const T of new Set(l.reverse()))
968
- if (!(T in n))
969
- throw new I(`missing required "${T}" claim`, n, T, "missing");
970
- if (s && !(Array.isArray(s) ? s : [s]).includes(n.iss))
971
- throw new I('unexpected "iss" claim value', n, "iss", "check_failed");
972
- if (i && n.sub !== i)
973
- throw new I('unexpected "sub" claim value', n, "sub", "check_failed");
974
- if (u && !sr(n.aud, typeof u == "string" ? [u] : u))
975
- throw new I('unexpected "aud" claim value', n, "aud", "check_failed");
960
+ if (a && (typeof e.typ != "string" || He(e.typ) !== He(a)))
961
+ throw new _('unexpected "typ" JWT header value', n, "typ", "check_failed");
962
+ const { requiredClaims: i = [], issuer: o, subject: s, audience: u, maxTokenAge: h } = r, c = [...i];
963
+ h !== void 0 && c.push("iat"), u !== void 0 && c.push("aud"), s !== void 0 && c.push("sub"), o !== void 0 && c.push("iss");
964
+ for (const A of new Set(c.reverse()))
965
+ if (!(A in n))
966
+ throw new _(`missing required "${A}" claim`, n, A, "missing");
967
+ if (o && !(Array.isArray(o) ? o : [o]).includes(n.iss))
968
+ throw new _('unexpected "iss" claim value', n, "iss", "check_failed");
969
+ if (s && n.sub !== s)
970
+ throw new _('unexpected "sub" claim value', n, "sub", "check_failed");
971
+ if (u && !Rr(n.aud, typeof u == "string" ? [u] : u))
972
+ throw new _('unexpected "aud" claim value', n, "aud", "check_failed");
976
973
  let f;
977
974
  switch (typeof r.clockTolerance) {
978
975
  case "string":
979
- f = be(r.clockTolerance);
976
+ f = Me(r.clockTolerance);
980
977
  break;
981
978
  case "number":
982
979
  f = r.clockTolerance;
@@ -987,201 +984,669 @@ const tr = (e) => Math.floor(e.getTime() / 1e3), qe = 60, ze = qe * 60, we = ze
987
984
  default:
988
985
  throw new TypeError("Invalid clockTolerance option type");
989
986
  }
990
- const { currentDate: m } = r, d = tr(m || /* @__PURE__ */ new Date());
987
+ const { currentDate: g } = r, p = Ar(g || /* @__PURE__ */ new Date());
991
988
  if ((n.iat !== void 0 || h) && typeof n.iat != "number")
992
- throw new I('"iat" claim must be a number', n, "iat", "invalid");
989
+ throw new _('"iat" claim must be a number', n, "iat", "invalid");
993
990
  if (n.nbf !== void 0) {
994
991
  if (typeof n.nbf != "number")
995
- throw new I('"nbf" claim must be a number', n, "nbf", "invalid");
996
- if (n.nbf > d + f)
997
- throw new I('"nbf" claim timestamp check failed', n, "nbf", "check_failed");
992
+ throw new _('"nbf" claim must be a number', n, "nbf", "invalid");
993
+ if (n.nbf > p + f)
994
+ throw new _('"nbf" claim timestamp check failed', n, "nbf", "check_failed");
998
995
  }
999
996
  if (n.exp !== void 0) {
1000
997
  if (typeof n.exp != "number")
1001
- throw new I('"exp" claim must be a number', n, "exp", "invalid");
1002
- if (n.exp <= d - f)
1003
- throw new Re('"exp" claim timestamp check failed', n, "exp", "check_failed");
998
+ throw new _('"exp" claim must be a number', n, "exp", "invalid");
999
+ if (n.exp <= p - f)
1000
+ throw new $e('"exp" claim timestamp check failed', n, "exp", "check_failed");
1004
1001
  }
1005
1002
  if (h) {
1006
- const T = d - n.iat, C = typeof h == "number" ? h : be(h);
1007
- if (T - f > C)
1008
- throw new Re('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1009
- if (T < 0 - f)
1010
- throw new I('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
1003
+ const A = p - n.iat, $ = typeof h == "number" ? h : Me(h);
1004
+ if (A - f > $)
1005
+ throw new $e('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1006
+ if (A < 0 - f)
1007
+ throw new _('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
1011
1008
  }
1012
1009
  return n;
1013
1010
  };
1014
- async function ir(e, t, r) {
1011
+ async function _r(e, t, r) {
1015
1012
  var n;
1016
- const a = await er(e, t, r);
1013
+ const a = await Sr(e, t, r);
1017
1014
  if ((n = a.protectedHeader.crit) != null && n.includes("b64") && a.protectedHeader.b64 === !1)
1018
- throw new Ge("JWTs MUST NOT use unencoded payload");
1019
- const o = { payload: or(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1020
- return typeof t == "function" ? { ...o, key: a.key } : o;
1015
+ throw new ot("JWTs MUST NOT use unencoded payload");
1016
+ const i = { payload: Ir(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1017
+ return typeof t == "function" ? { ...i, key: a.key } : i;
1021
1018
  }
1022
- const G = async (e) => {
1019
+ const q = async (e) => {
1023
1020
  try {
1024
- const t = S.ALG, r = await Vt(bt, t);
1025
- return await ir(e, r, {
1026
- issuer: S.ISSUER
1021
+ const t = b.ALG, r = await lr(Ft, t);
1022
+ return await _r(e, r, {
1023
+ issuer: b.ISSUER
1027
1024
  });
1028
1025
  } catch {
1029
1026
  return;
1030
1027
  }
1031
1028
  };
1032
- var E = [];
1033
- for (var he = 0; he < 256; ++he)
1034
- E.push((he + 256).toString(16).slice(1));
1035
- function cr(e, t = 0) {
1036
- return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
1029
+ var w = [];
1030
+ for (var Se = 0; Se < 256; ++Se)
1031
+ w.push((Se + 256).toString(16).slice(1));
1032
+ function Pr(e, t = 0) {
1033
+ return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
1037
1034
  }
1038
- var j, ur = new Uint8Array(16);
1039
- function lr() {
1040
- if (!j && (j = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !j))
1035
+ var ee, Cr = new Uint8Array(16);
1036
+ function kr() {
1037
+ if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
1041
1038
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1042
- return j(ur);
1039
+ return ee(Cr);
1043
1040
  }
1044
- var dr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1045
- const Oe = {
1046
- randomUUID: dr
1041
+ var Or = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1042
+ const xe = {
1043
+ randomUUID: Or
1047
1044
  };
1048
- function Pe(e, t, r) {
1049
- if (Oe.randomUUID && !t && !e)
1050
- return Oe.randomUUID();
1045
+ function We(e, t, r) {
1046
+ if (xe.randomUUID && !t && !e)
1047
+ return xe.randomUUID();
1051
1048
  e = e || {};
1052
- var n = e.random || (e.rng || lr)();
1053
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, cr(n);
1049
+ var n = e.random || (e.rng || kr)();
1050
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Pr(n);
1054
1051
  }
1055
- const ve = globalThis.crypto, hr = (e) => `${Pe()}${Pe()}`.slice(0, e), pr = (e) => btoa(
1052
+ const Ge = globalThis.crypto, Nr = (e) => `${We()}${We()}`.slice(0, e), Dr = (e) => btoa(
1056
1053
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1057
1054
  );
1058
- async function fr(e) {
1059
- if (!ve.subtle)
1055
+ async function Ur(e) {
1056
+ if (!Ge.subtle)
1060
1057
  throw new Error(
1061
1058
  "crypto.subtle is available only in secure contexts (HTTPS)."
1062
1059
  );
1063
- const t = new TextEncoder().encode(e), r = await ve.subtle.digest("SHA-256", t);
1064
- return pr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1060
+ const t = new TextEncoder().encode(e), r = await Ge.subtle.digest("SHA-256", t);
1061
+ return Dr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1065
1062
  }
1066
- async function yr(e) {
1067
- const r = hr(43), n = await fr(r);
1063
+ async function $r(e) {
1064
+ const r = Nr(43), n = await Ur(r);
1068
1065
  return {
1069
1066
  code_verifier: r,
1070
1067
  code_challenge: n
1071
1068
  };
1072
1069
  }
1073
- function Qe(e, t) {
1070
+ function pt(e, t) {
1074
1071
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1075
1072
  }
1076
- const Ce = (e, t) => {
1073
+ const Ve = (e, t) => {
1077
1074
  const r = JSON.stringify(
1078
1075
  typeof t == "function" ? t() : t
1079
1076
  );
1080
- window.localStorage.setItem(e, r), Qe(e, r);
1081
- }, mr = (e) => {
1082
- window.localStorage.removeItem(e), Qe(e, null);
1083
- }, Ne = (e) => window.localStorage.getItem(e), Er = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1084
- function F({
1077
+ window.localStorage.setItem(e, r), pt(e, r);
1078
+ }, Kr = (e) => {
1079
+ window.localStorage.removeItem(e), pt(e, null);
1080
+ }, je = (e) => window.localStorage.getItem(e), Lr = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1081
+ function te({
1085
1082
  key: e,
1086
1083
  initialValue: t
1087
1084
  }) {
1088
- const r = ft(Er, () => Ne(e)), n = x(
1089
- (s) => {
1085
+ const r = Ut(Lr, () => je(e)), n = Y(
1086
+ (o) => {
1090
1087
  try {
1091
- const i = typeof s == "function" ? s(JSON.parse(r)) : s;
1092
- i == null ? mr(e) : Ce(e, i);
1093
- } catch (i) {
1094
- console.warn(i);
1088
+ const s = typeof o == "function" ? o(JSON.parse(r)) : o;
1089
+ s == null ? Kr(e) : Ve(e, s);
1090
+ } catch (s) {
1091
+ console.warn(s);
1095
1092
  }
1096
1093
  },
1097
1094
  [e, r]
1098
- ), a = x(() => {
1095
+ ), a = Y(() => {
1099
1096
  n(t);
1100
- }, [t, n]), o = x(() => {
1097
+ }, [t, n]), i = Y(() => {
1101
1098
  n(null);
1102
1099
  }, [n]);
1103
- return Ke(() => {
1100
+ return Xe(() => {
1104
1101
  try {
1105
- Ne(e) === null && typeof t < "u" && Ce(e, t);
1106
- } catch (s) {
1107
- console.warn(s);
1102
+ je(e) === null && typeof t < "u" && Ve(e, t);
1103
+ } catch (o) {
1104
+ console.warn(o);
1108
1105
  }
1109
- }, [e, t]), [r ? JSON.parse(r) : null, n, a, o];
1106
+ }, [e, t]), [r ? JSON.parse(r) : null, n, a, i];
1110
1107
  }
1111
- var w = [];
1112
- for (var pe = 0; pe < 256; ++pe)
1113
- w.push((pe + 256).toString(16).slice(1));
1114
- function wr(e, t = 0) {
1115
- return (w[e[t + 0]] + w[e[t + 1]] + w[e[t + 2]] + w[e[t + 3]] + "-" + w[e[t + 4]] + w[e[t + 5]] + "-" + w[e[t + 6]] + w[e[t + 7]] + "-" + w[e[t + 8]] + w[e[t + 9]] + "-" + w[e[t + 10]] + w[e[t + 11]] + w[e[t + 12]] + w[e[t + 13]] + w[e[t + 14]] + w[e[t + 15]]).toLowerCase();
1108
+ var E = [];
1109
+ for (var Ae = 0; Ae < 256; ++Ae)
1110
+ E.push((Ae + 256).toString(16).slice(1));
1111
+ function Mr(e, t = 0) {
1112
+ return (E[e[t + 0]] + E[e[t + 1]] + E[e[t + 2]] + E[e[t + 3]] + "-" + E[e[t + 4]] + E[e[t + 5]] + "-" + E[e[t + 6]] + E[e[t + 7]] + "-" + E[e[t + 8]] + E[e[t + 9]] + "-" + E[e[t + 10]] + E[e[t + 11]] + E[e[t + 12]] + E[e[t + 13]] + E[e[t + 14]] + E[e[t + 15]]).toLowerCase();
1116
1113
  }
1117
- var B, gr = new Uint8Array(16);
1118
- function Ar() {
1119
- if (!B && (B = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !B))
1114
+ var re, Hr = new Uint8Array(16);
1115
+ function xr() {
1116
+ if (!re && (re = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !re))
1120
1117
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1121
- return B(gr);
1118
+ return re(Hr);
1122
1119
  }
1123
- var Sr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1124
- const De = {
1125
- randomUUID: Sr
1120
+ var Wr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1121
+ const Be = {
1122
+ randomUUID: Wr
1126
1123
  };
1127
- function fe(e, t, r) {
1128
- if (De.randomUUID && !t && !e)
1129
- return De.randomUUID();
1124
+ function ve(e, t, r) {
1125
+ if (Be.randomUUID && !t && !e)
1126
+ return Be.randomUUID();
1130
1127
  e = e || {};
1131
- var n = e.random || (e.rng || Ar)();
1132
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, wr(n);
1128
+ var n = e.random || (e.rng || xr)();
1129
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Mr(n);
1130
+ }
1131
+ function k(e, t, r, n) {
1132
+ return new (r || (r = Promise))(function(a, i) {
1133
+ function o(h) {
1134
+ try {
1135
+ u(n.next(h));
1136
+ } catch (c) {
1137
+ i(c);
1138
+ }
1139
+ }
1140
+ function s(h) {
1141
+ try {
1142
+ u(n.throw(h));
1143
+ } catch (c) {
1144
+ i(c);
1145
+ }
1146
+ }
1147
+ function u(h) {
1148
+ var c;
1149
+ h.done ? a(h.value) : (c = h.value, c instanceof r ? c : new r(function(f) {
1150
+ f(c);
1151
+ })).then(o, s);
1152
+ }
1153
+ u((n = n.apply(e, [])).next());
1154
+ });
1155
+ }
1156
+ function O(e, t) {
1157
+ var r, n, a, i, o = { label: 0, sent: function() {
1158
+ if (1 & a[0]) throw a[1];
1159
+ return a[1];
1160
+ }, trys: [], ops: [] };
1161
+ return i = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (i[Symbol.iterator] = function() {
1162
+ return this;
1163
+ }), i;
1164
+ function s(u) {
1165
+ return function(h) {
1166
+ return function(c) {
1167
+ if (r) throw new TypeError("Generator is already executing.");
1168
+ for (; i && (i = 0, c[0] && (o = 0)), o; ) try {
1169
+ if (r = 1, n && (a = 2 & c[0] ? n.return : c[0] ? n.throw || ((a = n.return) && a.call(n), 0) : n.next) && !(a = a.call(n, c[1])).done) return a;
1170
+ switch (n = 0, a && (c = [2 & c[0], a.value]), c[0]) {
1171
+ case 0:
1172
+ case 1:
1173
+ a = c;
1174
+ break;
1175
+ case 4:
1176
+ return o.label++, { value: c[1], done: !1 };
1177
+ case 5:
1178
+ o.label++, n = c[1], c = [0];
1179
+ continue;
1180
+ case 7:
1181
+ c = o.ops.pop(), o.trys.pop();
1182
+ continue;
1183
+ default:
1184
+ if (a = o.trys, !((a = a.length > 0 && a[a.length - 1]) || c[0] !== 6 && c[0] !== 2)) {
1185
+ o = 0;
1186
+ continue;
1187
+ }
1188
+ if (c[0] === 3 && (!a || c[1] > a[0] && c[1] < a[3])) {
1189
+ o.label = c[1];
1190
+ break;
1191
+ }
1192
+ if (c[0] === 6 && o.label < a[1]) {
1193
+ o.label = a[1], a = c;
1194
+ break;
1195
+ }
1196
+ if (a && o.label < a[2]) {
1197
+ o.label = a[2], o.ops.push(c);
1198
+ break;
1199
+ }
1200
+ a[2] && o.ops.pop(), o.trys.pop();
1201
+ continue;
1202
+ }
1203
+ c = t.call(e, o);
1204
+ } catch (f) {
1205
+ c = [6, f], n = 0;
1206
+ } finally {
1207
+ r = a = 0;
1208
+ }
1209
+ if (5 & c[0]) throw c[1];
1210
+ return { value: c[0] ? c[1] : void 0, done: !0 };
1211
+ }([u, h]);
1212
+ };
1213
+ }
1214
+ }
1215
+ var N = { exclude: [] }, mt = {}, Gr = { timeout: "true" }, R = function(e, t) {
1216
+ typeof window < "u" && (mt[e] = t);
1217
+ }, Vr = function() {
1218
+ return Object.fromEntries(Object.entries(mt).filter(function(e) {
1219
+ var t, r = e[0];
1220
+ return !(!((t = N == null ? void 0 : N.exclude) === null || t === void 0) && t.includes(r));
1221
+ }).map(function(e) {
1222
+ return [e[0], (0, e[1])()];
1223
+ }));
1224
+ }, Fe = 3432918353, Ye = 461845907, jr = 3864292196, Br = 2246822507, Fr = 3266489909;
1225
+ function Te(e, t) {
1226
+ return e << t | e >>> 32 - t;
1227
+ }
1228
+ function ke(e, t) {
1229
+ t === void 0 && (t = 0);
1230
+ for (var r = t, n = 0, a = 3 & e.length, i = e.length - a, o = 0; o < i; ) n = 255 & e.charCodeAt(o) | (255 & e.charCodeAt(++o)) << 8 | (255 & e.charCodeAt(++o)) << 16 | (255 & e.charCodeAt(++o)) << 24, ++o, n = Te(n = Math.imul(n, Fe), 15), r = Te(r ^= n = Math.imul(n, Ye), 13), r = Math.imul(r, 5) + jr;
1231
+ switch (n = 0, a) {
1232
+ case 3:
1233
+ n ^= (255 & e.charCodeAt(o + 2)) << 16;
1234
+ case 2:
1235
+ n ^= (255 & e.charCodeAt(o + 1)) << 8;
1236
+ case 1:
1237
+ n ^= 255 & e.charCodeAt(o), n = Te(n = Math.imul(n, Fe), 15), r ^= n = Math.imul(n, Ye);
1238
+ }
1239
+ return ((r = function(s) {
1240
+ return s ^= s >>> 16, s = Math.imul(s, Br), s ^= s >>> 13, s = Math.imul(s, Fr), s ^ s >>> 16;
1241
+ }(r ^= e.length)) >>> 0).toString(36);
1242
+ }
1243
+ function Yr(e, t) {
1244
+ return new Promise(function(r) {
1245
+ setTimeout(function() {
1246
+ return r(t);
1247
+ }, e);
1248
+ });
1249
+ }
1250
+ function Jr(e, t, r) {
1251
+ return Promise.all(e.map(function(n) {
1252
+ return Promise.race([n, Yr(t, r)]);
1253
+ }));
1254
+ }
1255
+ function qr() {
1256
+ return k(this, void 0, void 0, function() {
1257
+ var e, t, r, n, a;
1258
+ return O(this, function(i) {
1259
+ switch (i.label) {
1260
+ case 0:
1261
+ return i.trys.push([0, 2, , 3]), e = Vr(), t = Object.keys(e), [4, Jr(Object.values(e), (N == null ? void 0 : N.timeout) || 1e3, Gr)];
1262
+ case 1:
1263
+ return r = i.sent(), n = r.filter(function(o) {
1264
+ return o !== void 0;
1265
+ }), a = {}, n.forEach(function(o, s) {
1266
+ a[t[s]] = o;
1267
+ }), [2, gt(a, N.exclude || [])];
1268
+ case 2:
1269
+ throw i.sent();
1270
+ case 3:
1271
+ return [2];
1272
+ }
1273
+ });
1274
+ });
1275
+ }
1276
+ function gt(e, t) {
1277
+ var r = {}, n = function(i) {
1278
+ if (e.hasOwnProperty(i)) {
1279
+ var o = e[i];
1280
+ if (typeof o != "object" || Array.isArray(o)) t.includes(i) || (r[i] = o);
1281
+ else {
1282
+ var s = gt(o, t.map(function(u) {
1283
+ return u.startsWith(i + ".") ? u.slice(i.length + 1) : u;
1284
+ }));
1285
+ Object.keys(s).length > 0 && (r[i] = s);
1286
+ }
1287
+ }
1288
+ };
1289
+ for (var a in e) n(a);
1290
+ return r;
1291
+ }
1292
+ function zr(e) {
1293
+ return k(this, void 0, void 0, function() {
1294
+ var t, r;
1295
+ return O(this, function(n) {
1296
+ switch (n.label) {
1297
+ case 0:
1298
+ return n.trys.push([0, 2, , 3]), [4, qr()];
1299
+ case 1:
1300
+ return t = n.sent(), r = ke(JSON.stringify(t)), [2, r.toString()];
1301
+ case 2:
1302
+ throw n.sent();
1303
+ case 3:
1304
+ return [2];
1305
+ }
1306
+ });
1307
+ });
1308
+ }
1309
+ function Qr(e) {
1310
+ for (var t = 0, r = 0; r < e.length; ++r) t += Math.abs(e[r]);
1311
+ return t;
1312
+ }
1313
+ function yt(e, t, r) {
1314
+ for (var n = [], a = 0; a < e[0].data.length; a++) {
1315
+ for (var i = [], o = 0; o < e.length; o++) i.push(e[o].data[a]);
1316
+ n.push(Xr(i));
1317
+ }
1318
+ var s = new Uint8ClampedArray(n);
1319
+ return new ImageData(s, t, r);
1133
1320
  }
1134
- const q = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Tr = "Your session has been successfully terminated.", z = "Login failed. Please try again.", ye = "Error getting access token, please re-authenticate.", Rr = "You forgot to wrap your component in <AuthProvider>.", ne = {
1321
+ function Xr(e) {
1322
+ if (e.length === 0) return 0;
1323
+ for (var t = {}, r = 0, n = e; r < n.length; r++)
1324
+ t[i = n[r]] = (t[i] || 0) + 1;
1325
+ var a = e[0];
1326
+ for (var i in t) t[i] > t[a] && (a = parseInt(i, 10));
1327
+ return a;
1328
+ }
1329
+ function z() {
1330
+ if (typeof navigator > "u") return { name: "unknown", version: "unknown" };
1331
+ for (var e = navigator.userAgent, t = { Edg: "Edge", OPR: "Opera" }, r = 0, n = [/(?<name>Edge|Edg)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Chrome|Chromium|OPR|Opera|Vivaldi|Brave))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>(?:Firefox|Waterfox|Iceweasel|IceCat))\/(?<version>\d+(?:\.\d+)?)/, /(?<name>Safari)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>MSIE|Trident|IEMobile).+?(?<version>\d+(?:\.\d+)?)/, /(?<name>[A-Za-z]+)\/(?<version>\d+(?:\.\d+)?)/, /(?<name>SamsungBrowser)\/(?<version>\d+(?:\.\d+)?)/]; r < n.length; r++) {
1332
+ var a = n[r], i = e.match(a);
1333
+ if (i && i.groups) return { name: t[i.groups.name] || i.groups.name, version: i.groups.version };
1334
+ }
1335
+ return { name: "unknown", version: "unknown" };
1336
+ }
1337
+ R("audio", function() {
1338
+ return k(this, void 0, void 0, function() {
1339
+ return O(this, function(e) {
1340
+ return [2, new Promise(function(t, r) {
1341
+ try {
1342
+ var n = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 5e3, 44100), a = n.createBufferSource(), i = n.createOscillator();
1343
+ i.frequency.value = 1e3;
1344
+ var o, s = n.createDynamicsCompressor();
1345
+ s.threshold.value = -50, s.knee.value = 40, s.ratio.value = 12, s.attack.value = 0, s.release.value = 0.2, i.connect(s), s.connect(n.destination), i.start(), n.oncomplete = function(u) {
1346
+ o = u.renderedBuffer.getChannelData(0), t({ sampleHash: Qr(o), oscillator: i.type, maxChannels: n.destination.maxChannelCount, channelCountMode: a.channelCountMode });
1347
+ }, n.startRendering();
1348
+ } catch (u) {
1349
+ console.error("Error creating audio fingerprint:", u), r(u);
1350
+ }
1351
+ })];
1352
+ });
1353
+ });
1354
+ });
1355
+ var Zr = z().name !== "SamsungBrowser" ? 1 : 3, Je = 280, qe = 20;
1356
+ z().name != "Firefox" && R("canvas", function() {
1357
+ return document.createElement("canvas").getContext("2d"), new Promise(function(e) {
1358
+ var t = Array.from({ length: Zr }, function() {
1359
+ return function() {
1360
+ var r = document.createElement("canvas"), n = r.getContext("2d");
1361
+ if (!n) return new ImageData(1, 1);
1362
+ r.width = Je, r.height = qe;
1363
+ var a = n.createLinearGradient(0, 0, r.width, r.height);
1364
+ a.addColorStop(0, "red"), a.addColorStop(0.16666666666666666, "orange"), a.addColorStop(0.3333333333333333, "yellow"), a.addColorStop(0.5, "green"), a.addColorStop(0.6666666666666666, "blue"), a.addColorStop(0.8333333333333334, "indigo"), a.addColorStop(1, "violet"), n.fillStyle = a, n.fillRect(0, 0, r.width, r.height);
1365
+ var i = "Random Text WMwmil10Oo";
1366
+ n.font = "23.123px Arial", n.fillStyle = "black", n.fillText(i, -5, 15), n.fillStyle = "rgba(0, 0, 255, 0.5)", n.fillText(i, -3.3, 17.7), n.beginPath(), n.moveTo(0, 0), n.lineTo(2 * r.width / 7, r.height), n.strokeStyle = "white", n.lineWidth = 2, n.stroke();
1367
+ var o = n.getImageData(0, 0, r.width, r.height);
1368
+ return o;
1369
+ }();
1370
+ });
1371
+ e({ commonImageDataHash: ke(yt(t, Je, qe).data.toString()).toString() });
1372
+ });
1373
+ });
1374
+ var be, en = ["Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT", "Arimo", "Archivo", "Barlow", "Bebas Neue", "Bitter", "Bookman", "Calibri", "Cabin", "Candara", "Century", "Century Gothic", "Comic Sans MS", "Constantia", "Courier", "Courier New", "Crimson Text", "DM Mono", "DM Sans", "DM Serif Display", "DM Serif Text", "Dosis", "Droid Sans", "Exo", "Fira Code", "Fira Sans", "Franklin Gothic Medium", "Garamond", "Geneva", "Georgia", "Gill Sans", "Helvetica", "Impact", "Inconsolata", "Indie Flower", "Inter", "Josefin Sans", "Karla", "Lato", "Lexend", "Lucida Bright", "Lucida Console", "Lucida Sans Unicode", "Manrope", "Merriweather", "Merriweather Sans", "Montserrat", "Myriad", "Noto Sans", "Nunito", "Nunito Sans", "Open Sans", "Optima", "Orbitron", "Oswald", "Pacifico", "Palatino", "Perpetua", "PT Sans", "PT Serif", "Poppins", "Prompt", "Public Sans", "Quicksand", "Rajdhani", "Recursive", "Roboto", "Roboto Condensed", "Rockwell", "Rubik", "Segoe Print", "Segoe Script", "Segoe UI", "Sora", "Source Sans Pro", "Space Mono", "Tahoma", "Taviraj", "Times", "Times New Roman", "Titillium Web", "Trebuchet MS", "Ubuntu", "Varela Round", "Verdana", "Work Sans"], tn = ["monospace", "sans-serif", "serif"];
1375
+ function ze(e, t) {
1376
+ if (!e) throw new Error("Canvas context not supported");
1377
+ return e.font = "72px ".concat(t), e.measureText("WwMmLli0Oo").width;
1378
+ }
1379
+ function rn() {
1380
+ var e, t = document.createElement("canvas"), r = (e = t.getContext("webgl")) !== null && e !== void 0 ? e : t.getContext("experimental-webgl");
1381
+ if (r && "getParameter" in r) {
1382
+ var n = r.getExtension("WEBGL_debug_renderer_info");
1383
+ return { vendor: (r.getParameter(r.VENDOR) || "").toString(), vendorUnmasked: n ? (r.getParameter(n.UNMASKED_VENDOR_WEBGL) || "").toString() : "", renderer: (r.getParameter(r.RENDERER) || "").toString(), rendererUnmasked: n ? (r.getParameter(n.UNMASKED_RENDERER_WEBGL) || "").toString() : "", version: (r.getParameter(r.VERSION) || "").toString(), shadingLanguageVersion: (r.getParameter(r.SHADING_LANGUAGE_VERSION) || "").toString() };
1384
+ }
1385
+ return "undefined";
1386
+ }
1387
+ function nn() {
1388
+ var e = new Float32Array(1), t = new Uint8Array(e.buffer);
1389
+ return e[0] = 1 / 0, e[0] = e[0] - e[0], t[3];
1390
+ }
1391
+ function an(e, t) {
1392
+ var r = {};
1393
+ return t.forEach(function(n) {
1394
+ var a = function(i) {
1395
+ if (i.length === 0) return null;
1396
+ var o = {};
1397
+ i.forEach(function(h) {
1398
+ var c = String(h);
1399
+ o[c] = (o[c] || 0) + 1;
1400
+ });
1401
+ var s = i[0], u = 1;
1402
+ return Object.keys(o).forEach(function(h) {
1403
+ o[h] > u && (s = h, u = o[h]);
1404
+ }), s;
1405
+ }(e.map(function(i) {
1406
+ return n in i ? i[n] : void 0;
1407
+ }).filter(function(i) {
1408
+ return i !== void 0;
1409
+ }));
1410
+ a && (r[n] = a);
1411
+ }), r;
1412
+ }
1413
+ function on() {
1414
+ var e = [], t = { "prefers-contrast": ["high", "more", "low", "less", "forced", "no-preference"], "any-hover": ["hover", "none"], "any-pointer": ["none", "coarse", "fine"], pointer: ["none", "coarse", "fine"], hover: ["hover", "none"], update: ["fast", "slow"], "inverted-colors": ["inverted", "none"], "prefers-reduced-motion": ["reduce", "no-preference"], "prefers-reduced-transparency": ["reduce", "no-preference"], scripting: ["none", "initial-only", "enabled"], "forced-colors": ["active", "none"] };
1415
+ return Object.keys(t).forEach(function(r) {
1416
+ t[r].forEach(function(n) {
1417
+ matchMedia("(".concat(r, ": ").concat(n, ")")).matches && e.push("".concat(r, ": ").concat(n));
1418
+ });
1419
+ }), e;
1420
+ }
1421
+ function sn() {
1422
+ if (window.location.protocol === "https:" && typeof window.ApplePaySession == "function") try {
1423
+ for (var e = window.ApplePaySession.supportsVersion, t = 15; t > 0; t--) if (e(t)) return t;
1424
+ } catch {
1425
+ return 0;
1426
+ }
1427
+ return 0;
1428
+ }
1429
+ z().name != "Firefox" && R("fonts", function() {
1430
+ var e = this;
1431
+ return new Promise(function(t, r) {
1432
+ try {
1433
+ (function(n) {
1434
+ var a;
1435
+ k(this, void 0, void 0, function() {
1436
+ var i, o, s;
1437
+ return O(this, function(u) {
1438
+ switch (u.label) {
1439
+ case 0:
1440
+ return document.body ? [3, 2] : [4, (h = 50, new Promise(function(f) {
1441
+ return setTimeout(f, h, c);
1442
+ }))];
1443
+ case 1:
1444
+ return u.sent(), [3, 0];
1445
+ case 2:
1446
+ if ((i = document.createElement("iframe")).setAttribute("frameBorder", "0"), (o = i.style).setProperty("position", "fixed"), o.setProperty("display", "block", "important"), o.setProperty("visibility", "visible"), o.setProperty("border", "0"), o.setProperty("opacity", "0"), i.src = "about:blank", document.body.appendChild(i), !(s = i.contentDocument || ((a = i.contentWindow) === null || a === void 0 ? void 0 : a.document))) throw new Error("Iframe document is not accessible");
1447
+ return n({ iframe: s }), setTimeout(function() {
1448
+ document.body.removeChild(i);
1449
+ }, 0), [2];
1450
+ }
1451
+ var h, c;
1452
+ });
1453
+ });
1454
+ })(function(n) {
1455
+ var a = n.iframe;
1456
+ return k(e, void 0, void 0, function() {
1457
+ var i, o, s, u;
1458
+ return O(this, function(h) {
1459
+ return i = a.createElement("canvas"), o = i.getContext("2d"), s = tn.map(function(c) {
1460
+ return ze(o, c);
1461
+ }), u = {}, en.forEach(function(c) {
1462
+ var f = ze(o, c);
1463
+ s.includes(f) || (u[c] = f);
1464
+ }), t(u), [2];
1465
+ });
1466
+ });
1467
+ });
1468
+ } catch {
1469
+ r({ error: "unsupported" });
1470
+ }
1471
+ });
1472
+ }), R("hardware", function() {
1473
+ return new Promise(function(e, t) {
1474
+ var r = navigator.deviceMemory !== void 0 ? navigator.deviceMemory : 0, n = window.performance && window.performance.memory ? window.performance.memory : 0;
1475
+ e({ videocard: rn(), architecture: nn(), deviceMemory: r.toString() || "undefined", jsHeapSizeLimit: n.jsHeapSizeLimit || 0 });
1476
+ });
1477
+ }), R("locales", function() {
1478
+ return new Promise(function(e) {
1479
+ e({ languages: navigator.language, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
1480
+ });
1481
+ }), R("permissions", function() {
1482
+ return k(this, void 0, void 0, function() {
1483
+ var e;
1484
+ return O(this, function(t) {
1485
+ return be = (N == null ? void 0 : N.permissions_to_check) || ["accelerometer", "accessibility", "accessibility-events", "ambient-light-sensor", "background-fetch", "background-sync", "bluetooth", "camera", "clipboard-read", "clipboard-write", "device-info", "display-capture", "gyroscope", "geolocation", "local-fonts", "magnetometer", "microphone", "midi", "nfc", "notifications", "payment-handler", "persistent-storage", "push", "speaker", "storage-access", "top-level-storage-access", "window-management", "query"], e = Array.from({ length: (N == null ? void 0 : N.retries) || 3 }, function() {
1486
+ return function() {
1487
+ return k(this, void 0, void 0, function() {
1488
+ var r, n, a, i, o;
1489
+ return O(this, function(s) {
1490
+ switch (s.label) {
1491
+ case 0:
1492
+ r = {}, n = 0, a = be, s.label = 1;
1493
+ case 1:
1494
+ if (!(n < a.length)) return [3, 6];
1495
+ i = a[n], s.label = 2;
1496
+ case 2:
1497
+ return s.trys.push([2, 4, , 5]), [4, navigator.permissions.query({ name: i })];
1498
+ case 3:
1499
+ return o = s.sent(), r[i] = o.state.toString(), [3, 5];
1500
+ case 4:
1501
+ return s.sent(), [3, 5];
1502
+ case 5:
1503
+ return n++, [3, 1];
1504
+ case 6:
1505
+ return [2, r];
1506
+ }
1507
+ });
1508
+ });
1509
+ }();
1510
+ }), [2, Promise.all(e).then(function(r) {
1511
+ return an(r, be);
1512
+ })];
1513
+ });
1514
+ });
1515
+ }), R("plugins", function() {
1516
+ var e = [];
1517
+ if (navigator.plugins) for (var t = 0; t < navigator.plugins.length; t++) {
1518
+ var r = navigator.plugins[t];
1519
+ e.push([r.name, r.filename, r.description].join("|"));
1520
+ }
1521
+ return new Promise(function(n) {
1522
+ n({ plugins: e });
1523
+ });
1524
+ }), R("screen", function() {
1525
+ return new Promise(function(e) {
1526
+ e({ is_touchscreen: navigator.maxTouchPoints > 0, maxTouchPoints: navigator.maxTouchPoints, colorDepth: screen.colorDepth, mediaMatches: on() });
1527
+ });
1528
+ }), R("system", function() {
1529
+ return new Promise(function(e) {
1530
+ var t = z();
1531
+ e({ platform: window.navigator.platform, cookieEnabled: window.navigator.cookieEnabled, productSub: navigator.productSub, product: navigator.product, useragent: navigator.userAgent, browser: { name: t.name, version: t.version }, applePayVersion: sn() });
1532
+ });
1533
+ });
1534
+ var T, cn = z().name !== "SamsungBrowser" ? 1 : 3, l = null;
1535
+ typeof document < "u" && ((T = document.createElement("canvas")).width = 200, T.height = 100, l = T.getContext("webgl")), R("webgl", function() {
1536
+ return k(this, void 0, void 0, function() {
1537
+ var e;
1538
+ return O(this, function(t) {
1539
+ try {
1540
+ if (!l) throw new Error("WebGL not supported");
1541
+ return e = Array.from({ length: cn }, function() {
1542
+ return function() {
1543
+ try {
1544
+ if (!l) throw new Error("WebGL not supported");
1545
+ var r = `
1546
+ attribute vec2 position;
1547
+ void main() {
1548
+ gl_Position = vec4(position, 0.0, 1.0);
1549
+ }
1550
+ `, n = `
1551
+ precision mediump float;
1552
+ void main() {
1553
+ gl_FragColor = vec4(0.812, 0.195, 0.553, 0.921); // Set line color
1554
+ }
1555
+ `, a = l.createShader(l.VERTEX_SHADER), i = l.createShader(l.FRAGMENT_SHADER);
1556
+ if (!a || !i) throw new Error("Failed to create shaders");
1557
+ if (l.shaderSource(a, r), l.shaderSource(i, n), l.compileShader(a), !l.getShaderParameter(a, l.COMPILE_STATUS)) throw new Error("Vertex shader compilation failed: " + l.getShaderInfoLog(a));
1558
+ if (l.compileShader(i), !l.getShaderParameter(i, l.COMPILE_STATUS)) throw new Error("Fragment shader compilation failed: " + l.getShaderInfoLog(i));
1559
+ var o = l.createProgram();
1560
+ if (!o) throw new Error("Failed to create shader program");
1561
+ if (l.attachShader(o, a), l.attachShader(o, i), l.linkProgram(o), !l.getProgramParameter(o, l.LINK_STATUS)) throw new Error("Shader program linking failed: " + l.getProgramInfoLog(o));
1562
+ l.useProgram(o);
1563
+ for (var s = 137, u = new Float32Array(4 * s), h = 2 * Math.PI / s, c = 0; c < s; c++) {
1564
+ var f = c * h;
1565
+ u[4 * c] = 0, u[4 * c + 1] = 0, u[4 * c + 2] = Math.cos(f) * (T.width / 2), u[4 * c + 3] = Math.sin(f) * (T.height / 2);
1566
+ }
1567
+ var g = l.createBuffer();
1568
+ l.bindBuffer(l.ARRAY_BUFFER, g), l.bufferData(l.ARRAY_BUFFER, u, l.STATIC_DRAW);
1569
+ var p = l.getAttribLocation(o, "position");
1570
+ l.enableVertexAttribArray(p), l.vertexAttribPointer(p, 2, l.FLOAT, !1, 0, 0), l.viewport(0, 0, T.width, T.height), l.clearColor(0, 0, 0, 1), l.clear(l.COLOR_BUFFER_BIT), l.drawArrays(l.LINES, 0, 2 * s);
1571
+ var A = new Uint8ClampedArray(T.width * T.height * 4);
1572
+ return l.readPixels(0, 0, T.width, T.height, l.RGBA, l.UNSIGNED_BYTE, A), new ImageData(A, T.width, T.height);
1573
+ } catch {
1574
+ return new ImageData(1, 1);
1575
+ } finally {
1576
+ l && (l.bindBuffer(l.ARRAY_BUFFER, null), l.useProgram(null), l.viewport(0, 0, l.drawingBufferWidth, l.drawingBufferHeight), l.clearColor(0, 0, 0, 0));
1577
+ }
1578
+ }();
1579
+ }), [2, { commonImageHash: ke(yt(e, T.width, T.height).data.toString()).toString() }];
1580
+ } catch {
1581
+ return [2, { webgl: "unsupported" }];
1582
+ }
1583
+ return [2];
1584
+ });
1585
+ });
1586
+ });
1587
+ var L = function(e, t, r, n) {
1588
+ for (var a = (r - t) / n, i = 0, o = 0; o < n; o++)
1589
+ i += e(t + (o + 0.5) * a);
1590
+ return i * a;
1591
+ };
1592
+ R("math", function() {
1593
+ return k(void 0, void 0, void 0, function() {
1594
+ return O(this, function(e) {
1595
+ return [2, { acos: Math.acos(0.5), asin: L(Math.asin, -1, 1, 97), atan: L(Math.atan, -1, 1, 97), cos: L(Math.cos, 0, Math.PI, 97), cosh: Math.cosh(9 / 7), e: Math.E, largeCos: Math.cos(1e20), largeSin: Math.sin(1e20), largeTan: Math.tan(1e20), log: Math.log(1e3), pi: Math.PI, sin: L(Math.sin, -Math.PI, Math.PI, 97), sinh: L(Math.sinh, -9 / 7, 7 / 9, 97), sqrt: Math.sqrt(2), tan: L(Math.tan, 0, 2 * Math.PI, 97), tanh: L(Math.tanh, -9 / 7, 7 / 9, 97) }];
1596
+ });
1597
+ });
1598
+ });
1599
+ const ne = "Oops! It looks like your session has expired. For your security, please log in again to continue.", un = "Your session has been successfully terminated.", ae = "Login failed. Please try again.", Re = "Error getting access token, please re-authenticate.", ln = "You forgot to wrap your component in <AuthProvider>.", de = {
1135
1600
  dev: "https://auth.gizmette.local.com:3003",
1136
1601
  prod: "https://mylogin.gizmette.com/auth"
1137
- }, Q = "@@auth@@", L = "LOADING", W = "LOGIN", Xe = "LOGOUT", Ir = process.env.NODE_ENV === "production", Ze = !Ir, ie = async ({
1602
+ }, oe = "@@auth@@", B = "LOADING", F = "LOGIN", wt = "LOGOUT", dn = process.env.NODE_ENV === "production", Et = !dn, me = async ({
1138
1603
  type: e,
1139
1604
  clientId: t,
1140
1605
  params: r = {}
1141
1606
  }) => {
1142
1607
  try {
1143
1608
  const n = await fetch(
1144
- Ze ? `${ne.dev}/${e}` : `${ne.prod}/${e}`,
1609
+ Et ? `${de.dev}/${e}` : `${de.prod}/${e}`,
1145
1610
  {
1146
1611
  credentials: "include",
1147
1612
  method: "POST",
1148
1613
  headers: {
1149
1614
  "Content-Type": "application/json",
1150
- [xe.CLIENT_ID]: `${t}`
1615
+ [nt.CLIENT_ID]: `${t}`
1151
1616
  },
1152
1617
  body: JSON.stringify(r)
1153
1618
  }
1154
1619
  );
1155
1620
  if (n.status !== 200)
1156
1621
  return { status: n.status, data: [] };
1157
- const { data: a, errors: o } = await n.json();
1622
+ const { data: a, errors: i } = await n.json();
1158
1623
  return {
1159
1624
  status: n.status,
1160
1625
  data: a,
1161
- errors: o
1626
+ errors: i
1162
1627
  };
1163
1628
  } catch (n) {
1164
1629
  return console.error(n), { status: 500, data: [] };
1165
1630
  }
1166
- }, _r = async ({
1631
+ }, hn = async ({
1167
1632
  userId: e,
1168
1633
  idToken: t,
1169
1634
  accessToken: r,
1170
1635
  refreshToken: n,
1171
1636
  clientId: a,
1172
- domain: o
1637
+ domain: i
1173
1638
  }) => {
1174
1639
  try {
1175
1640
  return {
1176
- status: (await ie({
1177
- type: ae.LOGOUT,
1641
+ status: (await me({
1642
+ type: he.LOGOUT,
1178
1643
  clientId: a,
1179
1644
  params: {
1180
1645
  userId: e,
1181
1646
  idToken: t,
1182
1647
  accessToken: r,
1183
1648
  refreshToken: n,
1184
- domain: o
1649
+ domain: i
1185
1650
  }
1186
1651
  })).status === 200
1187
1652
  };
@@ -1190,37 +1655,39 @@ const q = "Oops! It looks like your session has expired. For your security, plea
1190
1655
  status: !1
1191
1656
  };
1192
1657
  }
1193
- }, Ue = async ({
1658
+ }, Qe = async ({
1194
1659
  username: e,
1195
1660
  password: t,
1196
1661
  clientId: r,
1197
1662
  nonce: n,
1198
1663
  type: a,
1199
- sessionExpiration: o,
1200
- code: s,
1201
- code_verifier: i,
1202
- domain: u
1664
+ sessionExpiration: i,
1665
+ code: o,
1666
+ code_verifier: s,
1667
+ domain: u,
1668
+ fingerprint: h
1203
1669
  }) => {
1204
1670
  try {
1205
- const h = await ie({
1206
- type: ae.AUTHENTICATE,
1671
+ const c = await me({
1672
+ type: he.AUTHENTICATE,
1207
1673
  clientId: r,
1208
1674
  params: {
1209
- type: a || Y.ID_AND_ACCESS_TOKEN,
1675
+ type: a || J.ID_AND_ACCESS_TOKEN,
1210
1676
  username: e,
1211
1677
  password: t,
1212
- sessionExpiration: o,
1678
+ sessionExpiration: i,
1213
1679
  nonce: n,
1214
- code: s,
1215
- code_verifier: i,
1216
- domain: u
1680
+ code: o,
1681
+ code_verifier: s,
1682
+ domain: u,
1683
+ fingerprint: h
1217
1684
  }
1218
- }), l = await G(h.data.idToken);
1219
- return l && l.payload[S.USER_ID_KEY] !== "" && l.payload[S.NONCE_KEY] === n ? {
1220
- idToken: h.data.idToken,
1221
- accessToken: h.data.accessToken,
1222
- refreshToken: h.data.refreshToken,
1223
- userId: l.payload[S.USER_ID_KEY],
1685
+ }), f = await q(c.data.idToken);
1686
+ return f && f.payload[b.USER_ID_KEY] !== "" && f.payload[b.NONCE_KEY] === n ? {
1687
+ idToken: c.data.idToken,
1688
+ accessToken: c.data.accessToken,
1689
+ refreshToken: c.data.refreshToken,
1690
+ userId: f.payload[b.USER_ID_KEY],
1224
1691
  status: !0
1225
1692
  } : {
1226
1693
  status: !1
@@ -1230,17 +1697,17 @@ const q = "Oops! It looks like your session has expired. For your security, plea
1230
1697
  status: !1
1231
1698
  };
1232
1699
  }
1233
- }, br = async ({
1700
+ }, fn = async ({
1234
1701
  nonce: e,
1235
1702
  clientId: t,
1236
1703
  code_challenge: r
1237
1704
  }) => {
1238
1705
  try {
1239
- const n = await ie({
1240
- type: ae.CODE,
1706
+ const n = await me({
1707
+ type: he.CODE,
1241
1708
  clientId: t,
1242
1709
  params: {
1243
- type: Y.CODE,
1710
+ type: J.CODE,
1244
1711
  nonce: e,
1245
1712
  code_challenge: r
1246
1713
  }
@@ -1256,31 +1723,31 @@ const q = "Oops! It looks like your session has expired. For your security, plea
1256
1723
  status: !1
1257
1724
  };
1258
1725
  }
1259
- }, kr = async ({
1726
+ }, pn = async ({
1260
1727
  clientId: e,
1261
1728
  userId: t,
1262
1729
  nonce: r,
1263
1730
  refreshToken: n,
1264
1731
  accessToken: a,
1265
- domain: o
1732
+ domain: i
1266
1733
  }) => {
1267
1734
  try {
1268
- const s = await ie({
1269
- type: ae.AUTHENTICATE,
1735
+ const o = await me({
1736
+ type: he.AUTHENTICATE,
1270
1737
  clientId: e,
1271
1738
  params: {
1272
- type: Y.REFRESH_TOKEN,
1739
+ type: J.REFRESH_TOKEN,
1273
1740
  userId: t,
1274
1741
  nonce: r,
1275
1742
  refreshToken: n,
1276
1743
  accessToken: a,
1277
- domain: o
1744
+ domain: i
1278
1745
  }
1279
- }), i = await G(s.data.accessToken);
1280
- return i && i.payload[S.USER_ID_KEY] !== "" && i.payload[S.NONCE_KEY] === r ? {
1281
- accessToken: s.data.accessToken,
1282
- refreshToken: s.data.refreshToken,
1283
- userId: i.payload[S.USER_ID_KEY],
1746
+ }), s = await q(o.data.accessToken);
1747
+ return s && s.payload[b.USER_ID_KEY] !== "" && s.payload[b.NONCE_KEY] === r ? {
1748
+ accessToken: o.data.accessToken,
1749
+ refreshToken: o.data.refreshToken,
1750
+ userId: s.payload[b.USER_ID_KEY],
1284
1751
  status: !0
1285
1752
  } : {
1286
1753
  status: !1
@@ -1290,7 +1757,7 @@ const q = "Oops! It looks like your session has expired. For your security, plea
1290
1757
  status: !1
1291
1758
  };
1292
1759
  }
1293
- }, X = {
1760
+ }, ie = {
1294
1761
  GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1295
1762
  $clientId: String!,
1296
1763
  $username: String!,
@@ -1348,13 +1815,15 @@ const q = "Oops! It looks like your session has expired. For your security, plea
1348
1815
  $id: String!,
1349
1816
  $authentication: AuthenticationOptionsInput!,
1350
1817
  $nonce: String!,
1351
- $domain: String) {
1818
+ $domain: String,
1819
+ $fingerprint: String) {
1352
1820
  verifyPasskeyAuthentication(
1353
1821
  clientId: $clientId,
1354
1822
  id: $id,
1355
1823
  authentication: $authentication,
1356
1824
  nonce: $nonce,
1357
- domain: $domain) {
1825
+ domain: $domain,
1826
+ fingerprint: $fingerprint) {
1358
1827
  status,
1359
1828
  idToken,
1360
1829
  accessToken,
@@ -1363,40 +1832,40 @@ const q = "Oops! It looks like your session has expired. For your security, plea
1363
1832
  username,
1364
1833
  }
1365
1834
  }`
1366
- }, D = {
1835
+ }, x = {
1367
1836
  GET_REGISTRATION_OPTIONS: {
1368
- schema: X.GET_REGISTRATION_OPTIONS,
1837
+ schema: ie.GET_REGISTRATION_OPTIONS,
1369
1838
  method: "getPasskeyRegistrationOptions"
1370
1839
  },
1371
1840
  VERIFY_REGISTRATION: {
1372
- schema: X.VERIFY_REGISTRATION,
1841
+ schema: ie.VERIFY_REGISTRATION,
1373
1842
  method: "verifyPasskeyRegistration"
1374
1843
  },
1375
1844
  GET_AUTHENTICATION_OPTIONS: {
1376
- schema: X.GET_AUTHENTICATION_OPTIONS,
1845
+ schema: ie.GET_AUTHENTICATION_OPTIONS,
1377
1846
  method: "getPasskeyAuthenticationOptions"
1378
1847
  },
1379
1848
  VERIFY_AUTHENTICATION: {
1380
- schema: X.VERIFY_AUTHENTICATION,
1849
+ schema: ie.VERIFY_AUTHENTICATION,
1381
1850
  method: "verifyPasskeyAuthentication"
1382
1851
  }
1383
- }, U = async ({
1852
+ }, W = async ({
1384
1853
  accessToken: e,
1385
1854
  type: t,
1386
1855
  clientId: r,
1387
1856
  params: n = {}
1388
1857
  }) => {
1389
1858
  try {
1390
- const a = t != null && t.data ? t.data(n) : n, o = `Bearer ${e}`, s = await fetch(
1391
- Ze ? `${ne.dev}/graphql` : `${ne.prod}/graphql`,
1859
+ const a = t != null && t.data ? t.data(n) : n, i = `Bearer ${e}`, o = await fetch(
1860
+ Et ? `${de.dev}/graphql` : `${de.prod}/graphql`,
1392
1861
  {
1393
1862
  method: "POST",
1394
1863
  credentials: "include",
1395
1864
  headers: {
1396
- authorization: o,
1865
+ authorization: i,
1397
1866
  "Content-Type": "application/json",
1398
1867
  Accept: "application/json",
1399
- [xe.CLIENT_ID]: `${r}`
1868
+ [nt.CLIENT_ID]: `${r}`
1400
1869
  },
1401
1870
  body: JSON.stringify({
1402
1871
  query: t.schema,
@@ -1404,23 +1873,30 @@ const q = "Oops! It looks like your session has expired. For your security, plea
1404
1873
  })
1405
1874
  }
1406
1875
  );
1407
- if (s.status !== 200)
1408
- return { status: s.status, data: [] };
1409
- const { data: i, errors: u } = await s.json();
1876
+ if (o.status !== 200)
1877
+ return { status: o.status, data: [] };
1878
+ const { data: s, errors: u } = await o.json();
1410
1879
  return {
1411
- status: s.status,
1412
- data: i[t.method],
1880
+ status: o.status,
1881
+ data: s[t.method],
1413
1882
  errors: u
1414
1883
  };
1415
1884
  } catch (a) {
1416
1885
  return console.error(a), { status: 500, data: [] };
1417
1886
  }
1887
+ }, Ie = async () => {
1888
+ try {
1889
+ const e = await zr();
1890
+ return typeof e == "string" ? e : e.hash && typeof e.hash == "string" ? e.hash : "";
1891
+ } catch {
1892
+ return "";
1893
+ }
1418
1894
  };
1419
- class Or {
1895
+ class mn {
1420
1896
  constructor(t = null, r = null) {
1421
- M(this, "refreshTokenPromise", null);
1422
- M(this, "accessToken");
1423
- M(this, "refreshToken");
1897
+ Q(this, "refreshTokenPromise", null);
1898
+ Q(this, "accessToken");
1899
+ Q(this, "refreshToken");
1424
1900
  this.accessToken = t || "", this.refreshToken = r || "";
1425
1901
  }
1426
1902
  async refreshtoken({
@@ -1447,9 +1923,9 @@ class Or {
1447
1923
  nonce: n,
1448
1924
  domain: a
1449
1925
  }) {
1450
- const o = await G(this.refreshToken);
1451
- if (o && o.payload[S.USER_ID_KEY] !== "") {
1452
- const s = await kr({
1926
+ const i = await q(this.refreshToken);
1927
+ if (i && i.payload[b.USER_ID_KEY] !== "") {
1928
+ const o = await pn({
1453
1929
  clientId: t,
1454
1930
  userId: r,
1455
1931
  nonce: n,
@@ -1457,10 +1933,10 @@ class Or {
1457
1933
  accessToken: this.accessToken,
1458
1934
  domain: a
1459
1935
  });
1460
- return s.status ? (this.accessToken = s.accessToken, this.refreshToken = s.refreshToken, {
1936
+ return o.status ? (this.accessToken = o.accessToken, this.refreshToken = o.refreshToken, {
1461
1937
  status: "success",
1462
- newAccessToken: s.accessToken,
1463
- newRefreshToken: s.refreshToken
1938
+ newAccessToken: o.accessToken,
1939
+ newRefreshToken: o.refreshToken
1464
1940
  }) : {
1465
1941
  status: "failure"
1466
1942
  };
@@ -1470,20 +1946,20 @@ class Or {
1470
1946
  };
1471
1947
  }
1472
1948
  }
1473
- const K = () => {
1474
- throw new Error(Rr);
1475
- }, et = yt({
1949
+ const G = () => {
1950
+ throw new Error(ln);
1951
+ }, St = $t({
1476
1952
  isAuthenticated: !1,
1477
1953
  isLoading: !1,
1478
1954
  authenticationType: null,
1479
- login: K,
1480
- logout: K,
1481
- getAccessToken: K,
1482
- getIdToken: K,
1483
- registeringForPasskey: K,
1484
- loginWithPasskey: K,
1955
+ login: G,
1956
+ logout: G,
1957
+ getAccessToken: G,
1958
+ getIdToken: G,
1959
+ registeringForPasskey: G,
1960
+ loginWithPasskey: G,
1485
1961
  logoutReason: ""
1486
- }), Pr = pt.createContext({
1962
+ }), gn = Dt.createContext({
1487
1963
  state: {
1488
1964
  isLoading: !0,
1489
1965
  isAuthenticated: !1,
@@ -1493,286 +1969,289 @@ const K = () => {
1493
1969
  },
1494
1970
  dispatch: () => {
1495
1971
  }
1496
- }), vr = (e, t) => (t == null ? void 0 : t.type) === L ? {
1972
+ }), yn = (e, t) => (t == null ? void 0 : t.type) === B ? {
1497
1973
  ...e,
1498
1974
  isLoading: t.payload.isLoading
1499
- } : (t == null ? void 0 : t.type) === W ? {
1975
+ } : (t == null ? void 0 : t.type) === F ? {
1500
1976
  ...e,
1501
1977
  isLoading: !1,
1502
1978
  isAuthenticated: !0,
1503
1979
  user: t.payload.user,
1504
1980
  authenticationType: t.payload.authenticationType,
1505
1981
  logoutReason: ""
1506
- } : (t == null ? void 0 : t.type) === Xe ? {
1982
+ } : (t == null ? void 0 : t.type) === wt ? {
1507
1983
  ...e,
1508
1984
  isLoading: !1,
1509
1985
  isAuthenticated: !1,
1510
1986
  user: void 0,
1511
1987
  authenticationType: null,
1512
1988
  logoutReason: t.payload.logoutReason
1513
- } : e, Kr = ({
1989
+ } : e, In = ({
1514
1990
  children: e,
1515
1991
  sessionExpiration: t,
1516
1992
  clientId: r,
1517
1993
  domain: n = ""
1518
1994
  }) => {
1519
- const [a, o] = mt(vr, {
1995
+ const [a, i] = Kt(yn, {
1520
1996
  isLoading: !0,
1521
1997
  isAuthenticated: !1,
1522
1998
  authenticationType: null,
1523
1999
  user: void 0,
1524
2000
  logoutReason: ""
1525
- }), s = Et(!1), [i, u, , h] = F({
1526
- key: `${Q}::${r}::@@user@@`
1527
- }), [l, f, , m] = F({
1528
- key: `${Q}::${r}::@@access@@`
1529
- }), [d, T, , C] = F(
2001
+ }), o = Lt(!1), [s, u, , h] = te({
2002
+ key: `${oe}::${r}::@@user@@`
2003
+ }), [c, f, , g] = te({
2004
+ key: `${oe}::${r}::@@access@@`
2005
+ }), [p, A, , $] = te(
1530
2006
  {
1531
- key: `${Q}::${r}::@@refresh@@`
2007
+ key: `${oe}::${r}::@@refresh@@`
1532
2008
  }
1533
- ), [tt, ge, , Ae] = F({
1534
- key: `${Q}::${r}::@@nonce@@`
1535
- }), rt = new Or(l, d), N = x(
1536
- (c) => {
1537
- console.warn(c), o({
1538
- type: Xe,
2009
+ ), [At, Oe, , Ne] = te({
2010
+ key: `${oe}::${r}::@@nonce@@`
2011
+ }), vt = new mn(c, p), H = Y(
2012
+ (d) => {
2013
+ console.warn(d), i({
2014
+ type: wt,
1539
2015
  payload: {
1540
- logoutReason: c || q
2016
+ logoutReason: d || ne
1541
2017
  }
1542
- }), h(), m(), C(), Ae(), o({ type: L, payload: { isLoading: !1 } });
2018
+ }), h(), g(), $(), Ne(), i({ type: B, payload: { isLoading: !1 } });
1543
2019
  },
1544
- [m, h, Ae, C]
1545
- ), P = x(
1546
- async (c) => {
2020
+ [g, h, Ne, $]
2021
+ ), K = Y(
2022
+ async (d) => {
1547
2023
  const { user: y } = a;
1548
- await _r({
2024
+ await hn({
1549
2025
  userId: (y == null ? void 0 : y.userId) || "",
1550
- idToken: i,
1551
- accessToken: l,
1552
- refreshToken: d,
2026
+ idToken: s,
2027
+ accessToken: c,
2028
+ refreshToken: p,
1553
2029
  clientId: r,
1554
2030
  domain: n
1555
- }), N(c || q);
2031
+ }), H(d || ne);
1556
2032
  },
1557
2033
  [
1558
- l,
2034
+ c,
1559
2035
  a,
1560
2036
  r,
1561
2037
  n,
1562
- i,
1563
- d,
1564
- N
2038
+ s,
2039
+ p,
2040
+ H
1565
2041
  ]
1566
2042
  );
1567
- Ke(() => {
1568
- if (!s.current)
1569
- return a.isLoading && i !== null ? (async () => {
2043
+ Xe(() => {
2044
+ if (!o.current)
2045
+ return a.isLoading && s !== null ? (async () => {
1570
2046
  try {
1571
- const c = await G(i);
1572
- c && c.payload[S.USER_ID_KEY] !== "" ? o({
1573
- type: W,
2047
+ const d = await q(s);
2048
+ d && d.payload[b.USER_ID_KEY] !== "" ? i({
2049
+ type: F,
1574
2050
  payload: {
1575
- authenticationType: c.payload[S.AUTH_TYPE_KEY],
2051
+ authenticationType: d.payload[b.AUTH_TYPE_KEY],
1576
2052
  user: {
1577
- userId: c.payload[S.USER_ID_KEY],
1578
- username: c.payload[S.USERNAME_KEY]
2053
+ userId: d.payload[b.USER_ID_KEY],
2054
+ username: d.payload[b.USERNAME_KEY]
1579
2055
  }
1580
2056
  }
1581
- }) : await P(q);
2057
+ }) : await K(ne);
1582
2058
  } catch {
1583
- await P(q);
2059
+ await K(ne);
1584
2060
  }
1585
- })() : o({ type: L, payload: { isLoading: !1 } }), () => {
1586
- s.current = !0;
2061
+ })() : i({ type: B, payload: { isLoading: !1 } }), () => {
2062
+ o.current = !0;
1587
2063
  };
1588
- }, [a.isLoading, i, P]);
1589
- const nt = async (c, y, p) => {
1590
- const R = fe();
1591
- if (ge(R), o({ type: L, payload: { isLoading: !0 } }), h(), m(), C(), p === Y.CODE) {
1592
- const { code_verifier: ut, code_challenge: lt } = await yr(), Se = await br({
1593
- nonce: R,
2064
+ }, [a.isLoading, s, K]);
2065
+ const Tt = async (d, y, m) => {
2066
+ const I = ve();
2067
+ if (Oe(I), i({ type: B, payload: { isLoading: !0 } }), h(), g(), $(), m === J.CODE) {
2068
+ const { code_verifier: Ct, code_challenge: kt } = await $r(), De = await fn({
2069
+ nonce: I,
1594
2070
  clientId: r,
1595
- code_challenge: lt
2071
+ code_challenge: kt
1596
2072
  });
1597
- if (Se.status) {
1598
- const $ = await Ue({
1599
- username: c,
2073
+ if (De.status) {
2074
+ const j = await Qe({
2075
+ username: d,
1600
2076
  password: y,
1601
2077
  clientId: r,
1602
2078
  sessionExpiration: t,
1603
- nonce: R,
1604
- type: p,
1605
- code: Se.code,
1606
- code_verifier: ut,
1607
- domain: n
2079
+ nonce: I,
2080
+ type: m,
2081
+ code: De.code,
2082
+ code_verifier: Ct,
2083
+ domain: n,
2084
+ fingerprint: await Ie()
1608
2085
  });
1609
- return $.status ? (u($.idToken), f($.accessToken), T($.refreshToken), o({
1610
- type: W,
2086
+ return j.status ? (u(j.idToken), f(j.accessToken), A(j.refreshToken), i({
2087
+ type: F,
1611
2088
  payload: {
1612
- authenticationType: p,
2089
+ authenticationType: m,
1613
2090
  user: {
1614
- userId: $.userId,
1615
- username: c
2091
+ userId: j.userId,
2092
+ username: d
1616
2093
  }
1617
2094
  }
1618
- }), !0) : (N(z), !1);
2095
+ }), !0) : (H(ae), !1);
1619
2096
  }
1620
2097
  return !1;
1621
2098
  }
1622
- const H = await Ue({
1623
- username: c,
2099
+ const V = await Qe({
2100
+ username: d,
1624
2101
  password: y,
1625
2102
  clientId: r,
1626
2103
  sessionExpiration: t,
1627
- nonce: R,
1628
- type: p,
1629
- domain: n
2104
+ nonce: I,
2105
+ type: m,
2106
+ domain: n,
2107
+ fingerprint: await Ie()
1630
2108
  });
1631
- return H.status ? (u(H.idToken), f(H.accessToken), T(H.refreshToken), o({
1632
- type: W,
2109
+ return V.status ? (u(V.idToken), f(V.accessToken), A(V.refreshToken), i({
2110
+ type: F,
1633
2111
  payload: {
1634
- authenticationType: p,
2112
+ authenticationType: m,
1635
2113
  user: {
1636
- userId: H.userId,
1637
- username: c
2114
+ userId: V.userId,
2115
+ username: d
1638
2116
  }
1639
2117
  }
1640
- }), !0) : (N(z), !1);
1641
- }, at = async (c) => {
1642
- c == null || c.preventDefault(), await P(Tr);
1643
- }, st = async () => {
1644
- const { isAuthenticated: c, user: y } = a;
2118
+ }), !0) : (H(ae), !1);
2119
+ }, bt = async (d) => {
2120
+ d == null || d.preventDefault(), await K(un);
2121
+ }, Rt = async () => {
2122
+ const { isAuthenticated: d, user: y } = a;
1645
2123
  try {
1646
- if (c && y && y.userId) {
1647
- if (l) {
1648
- const R = await G(l);
1649
- if (R && R.payload[S.USER_ID_KEY] !== "")
1650
- return l;
2124
+ if (d && y && y.userId) {
2125
+ if (c) {
2126
+ const I = await q(c);
2127
+ if (I && I.payload[b.USER_ID_KEY] !== "")
2128
+ return c;
1651
2129
  }
1652
- const p = await rt.refreshtoken({
2130
+ const m = await vt.refreshtoken({
1653
2131
  clientId: r,
1654
2132
  userId: y.userId,
1655
- nonce: tt,
2133
+ nonce: At,
1656
2134
  domain: n
1657
2135
  });
1658
- return p.status && p.status === "success" ? (f(p.newAccessToken), T(p.newRefreshToken), p.newAccessToken) : (await P(ye), "");
2136
+ return m.status && m.status === "success" ? (f(m.newAccessToken), A(m.newRefreshToken), m.newAccessToken) : (await K(Re), "");
1659
2137
  }
1660
- return await P(ye), "";
2138
+ return await K(Re), "";
1661
2139
  } catch {
1662
- return await P(ye), "";
2140
+ return await K(Re), "";
1663
2141
  }
1664
- }, ot = () => {
1665
- if (a.isAuthenticated && i)
1666
- return i;
1667
- }, it = async () => {
1668
- const { user: c } = a;
1669
- let y = await U({
1670
- accessToken: l,
2142
+ }, It = () => {
2143
+ if (a.isAuthenticated && s)
2144
+ return s;
2145
+ }, _t = async () => {
2146
+ const { user: d } = a;
2147
+ let y = await W({
2148
+ accessToken: c,
1671
2149
  clientId: r,
1672
- type: D.GET_REGISTRATION_OPTIONS,
2150
+ type: x.GET_REGISTRATION_OPTIONS,
1673
2151
  params: {
1674
2152
  clientId: r,
1675
- id: c == null ? void 0 : c.userId,
1676
- username: c == null ? void 0 : c.username
2153
+ id: d == null ? void 0 : d.userId,
2154
+ username: d == null ? void 0 : d.username
1677
2155
  }
1678
2156
  });
1679
2157
  if (y.status)
1680
2158
  try {
1681
- const p = await Tt(y.data);
1682
- y = await U({
1683
- accessToken: l,
2159
+ const m = await Gt(y.data);
2160
+ y = await W({
2161
+ accessToken: c,
1684
2162
  clientId: r,
1685
- type: D.VERIFY_REGISTRATION,
2163
+ type: x.VERIFY_REGISTRATION,
1686
2164
  params: {
1687
2165
  clientId: r,
1688
- id: c == null ? void 0 : c.userId,
1689
- username: c == null ? void 0 : c.username,
1690
- registration: p
2166
+ id: d == null ? void 0 : d.userId,
2167
+ username: d == null ? void 0 : d.username,
2168
+ registration: m
1691
2169
  }
1692
2170
  });
1693
2171
  } catch {
1694
- return await U({
1695
- accessToken: l,
2172
+ return await W({
2173
+ accessToken: c,
1696
2174
  clientId: r,
1697
- type: D.VERIFY_REGISTRATION,
2175
+ type: x.VERIFY_REGISTRATION,
1698
2176
  params: {
1699
2177
  clientId: r,
1700
- id: c == null ? void 0 : c.userId,
1701
- username: c == null ? void 0 : c.username,
2178
+ id: d == null ? void 0 : d.userId,
2179
+ username: d == null ? void 0 : d.username,
1702
2180
  registration: {}
1703
2181
  }
1704
2182
  }), !1;
1705
2183
  }
1706
- }, ct = async () => {
1707
- const c = fe();
1708
- ge(c), o({ type: L, payload: { isLoading: !0 } }), h(), m(), C();
1709
- const y = fe();
1710
- let p = await U({
1711
- accessToken: l,
2184
+ }, Pt = async () => {
2185
+ const d = ve();
2186
+ Oe(d), i({ type: B, payload: { isLoading: !0 } }), h(), g(), $();
2187
+ const y = ve();
2188
+ let m = await W({
2189
+ accessToken: c,
1712
2190
  clientId: r,
1713
- type: D.GET_AUTHENTICATION_OPTIONS,
2191
+ type: x.GET_AUTHENTICATION_OPTIONS,
1714
2192
  params: {
1715
2193
  id: y,
1716
2194
  clientId: r
1717
2195
  }
1718
2196
  });
1719
- if (p.status)
2197
+ if (m.status)
1720
2198
  try {
1721
- const R = await _t(p.data);
1722
- return p = await U({
1723
- accessToken: l,
2199
+ const I = await Bt(m.data);
2200
+ return m = await W({
2201
+ accessToken: c,
1724
2202
  clientId: r,
1725
- type: D.VERIFY_AUTHENTICATION,
2203
+ type: x.VERIFY_AUTHENTICATION,
1726
2204
  params: {
1727
2205
  clientId: r,
1728
2206
  id: y,
1729
- authentication: R,
1730
- nonce: c,
1731
- domain: n
2207
+ authentication: I,
2208
+ nonce: d,
2209
+ domain: n,
2210
+ fingerprint: await Ie()
1732
2211
  }
1733
- }), p.data.status === "success" ? (u(p.data.idToken), f(p.data.accessToken), T(p.data.refreshToken), o({
1734
- type: W,
2212
+ }), m.data.status === "success" ? (u(m.data.idToken), f(m.data.accessToken), A(m.data.refreshToken), i({
2213
+ type: F,
1735
2214
  payload: {
1736
- authenticationType: Y.PASSKEY,
2215
+ authenticationType: J.PASSKEY,
1737
2216
  user: {
1738
- userId: p.data.userId,
1739
- username: p.data.username
2217
+ userId: m.data.userId,
2218
+ username: m.data.username
1740
2219
  }
1741
2220
  }
1742
- }), !0) : (N(z), !1);
2221
+ }), !0) : (H(ae), !1);
1743
2222
  } catch {
1744
- return await U({
1745
- accessToken: l,
2223
+ return await W({
2224
+ accessToken: c,
1746
2225
  clientId: r,
1747
- type: D.VERIFY_AUTHENTICATION,
2226
+ type: x.VERIFY_AUTHENTICATION,
1748
2227
  params: {
1749
2228
  clientId: r,
1750
2229
  id: y,
1751
2230
  authentication: {},
1752
- nonce: c,
2231
+ nonce: d,
1753
2232
  domain: n
1754
2233
  }
1755
- }), N(z), !1;
2234
+ }), H(ae), !1;
1756
2235
  }
1757
2236
  };
1758
- return /* @__PURE__ */ Te(Pr.Provider, { value: { state: a, dispatch: o }, children: /* @__PURE__ */ Te(
1759
- et.Provider,
2237
+ return /* @__PURE__ */ Ue(gn.Provider, { value: { state: a, dispatch: i }, children: /* @__PURE__ */ Ue(
2238
+ St.Provider,
1760
2239
  {
1761
2240
  value: {
1762
2241
  ...a,
1763
- login: nt,
1764
- logout: at,
1765
- getAccessToken: st,
1766
- getIdToken: ot,
1767
- registeringForPasskey: it,
1768
- loginWithPasskey: ct
2242
+ login: Tt,
2243
+ logout: bt,
2244
+ getAccessToken: Rt,
2245
+ getIdToken: It,
2246
+ registeringForPasskey: _t,
2247
+ loginWithPasskey: Pt
1769
2248
  },
1770
2249
  children: e
1771
2250
  }
1772
2251
  ) });
1773
- }, Hr = (e = et) => wt(e);
2252
+ }, _n = (e = St) => Mt(e);
1774
2253
  export {
1775
- Y as AUTH_TYPES,
1776
- Kr as AuthProvider,
1777
- Hr as useAuth
2254
+ J as AUTH_TYPES,
2255
+ In as AuthProvider,
2256
+ _n as useAuth
1778
2257
  };