@versini/auth-provider 5.0.5 → 5.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.
package/dist/index.js CHANGED
@@ -1,51 +1,51 @@
1
- var Me = Object.defineProperty;
2
- var Ve = (e, t, r) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var L = (e, t, r) => (Ve(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { jsx as Ye } from "react/jsx-runtime";
5
- import * as U from "react";
6
- import { createContext as Be, useRef as Fe, useState as Ge, useCallback as de, useEffect as qe, useContext as ze } from "react";
1
+ var St = Object.defineProperty;
2
+ var wt = (e, t, r) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var B = (e, t, r) => (wt(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import { jsx as gt } from "react/jsx-runtime";
5
+ import * as K from "react";
6
+ import { useContext as Ve, useState as ze, useLayoutEffect as At, useMemo as Ee, createContext as vt, useRef as _t, useCallback as Re, useEffect as Tt } from "react";
7
7
  /*!
8
- @versini/auth-provider v5.0.5
8
+ @versini/auth-provider v5.1.0
9
9
  © 2024 gizmette.com
10
10
  */
11
11
  try {
12
12
  window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
13
- version: "5.0.5",
14
- buildTime: "07/05/2024 02:22 PM EDT",
13
+ version: "5.1.0",
14
+ buildTime: "07/07/2024 10:25 AM EDT",
15
15
  homepage: "https://github.com/aversini/auth-client",
16
16
  license: "MIT"
17
17
  });
18
18
  } catch {
19
19
  }
20
20
  /*!
21
- @versini/auth-common v2.10.1
21
+ @versini/auth-common v2.11.0
22
22
  © 2024 gizmette.com
23
23
  */
24
24
  try {
25
25
  window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
26
- version: "2.10.1",
27
- buildTime: "07/05/2024 02:22 PM EDT",
26
+ version: "2.11.0",
27
+ buildTime: "07/07/2024 10:25 AM EDT",
28
28
  homepage: "https://github.com/aversini/auth-client",
29
29
  license: "MIT"
30
30
  });
31
31
  } catch {
32
32
  }
33
- const q = {
33
+ const ie = {
34
34
  ID_TOKEN: "id_token",
35
35
  ACCESS_TOKEN: "token",
36
36
  ID_AND_ACCESS_TOKEN: "id_token token",
37
37
  CODE: "code",
38
38
  REFRESH_TOKEN: "refresh_token"
39
- }, Xe = {
39
+ }, bt = {
40
40
  CLIENT_ID: "X-Auth-ClientId"
41
- }, y = {
41
+ }, k = {
42
42
  ALG: "RS256",
43
43
  USER_ID_KEY: "sub",
44
44
  TOKEN_ID_KEY: "__raw",
45
45
  NONCE_KEY: "_nonce",
46
46
  USERNAME_KEY: "username",
47
47
  ISSUER: "gizmette.com"
48
- }, Qe = `-----BEGIN PUBLIC KEY-----
48
+ }, kt = `-----BEGIN PUBLIC KEY-----
49
49
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
50
50
  w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
51
51
  i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
@@ -53,33 +53,33 @@ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
53
53
  l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
54
54
  sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
55
55
  awIDAQAB
56
- -----END PUBLIC KEY-----`, z = {
56
+ -----END PUBLIC KEY-----`, ce = {
57
57
  AUTHENTICATE: "authenticate",
58
58
  CODE: "code",
59
59
  LOGOUT: "logout"
60
- }, X = crypto, _e = (e) => e instanceof CryptoKey, $ = new TextEncoder(), Q = new TextDecoder();
61
- function Ze(...e) {
60
+ }, ue = crypto, Be = (e) => e instanceof CryptoKey, G = new TextEncoder(), le = new TextDecoder();
61
+ function Ct(...e) {
62
62
  const t = e.reduce((n, { length: s }) => n + s, 0), r = new Uint8Array(t);
63
- let a = 0;
63
+ let o = 0;
64
64
  for (const n of e)
65
- r.set(n, a), a += n.length;
65
+ r.set(n, o), o += n.length;
66
66
  return r;
67
67
  }
68
- const et = (e) => {
68
+ const Rt = (e) => {
69
69
  const t = atob(e), r = new Uint8Array(t.length);
70
- for (let a = 0; a < t.length; a++)
71
- r[a] = t.charCodeAt(a);
70
+ for (let o = 0; o < t.length; o++)
71
+ r[o] = t.charCodeAt(o);
72
72
  return r;
73
- }, B = (e) => {
73
+ }, ne = (e) => {
74
74
  let t = e;
75
- t instanceof Uint8Array && (t = Q.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
75
+ t instanceof Uint8Array && (t = le.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
76
76
  try {
77
- return et(t);
77
+ return Rt(t);
78
78
  } catch {
79
79
  throw new TypeError("The input to be decoded is not correctly encoded.");
80
80
  }
81
81
  };
82
- class C extends Error {
82
+ class H extends Error {
83
83
  static get code() {
84
84
  return "ERR_JOSE_GENERIC";
85
85
  }
@@ -88,23 +88,23 @@ class C extends Error {
88
88
  super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
89
89
  }
90
90
  }
91
- class g extends C {
91
+ class O extends H {
92
92
  static get code() {
93
93
  return "ERR_JWT_CLAIM_VALIDATION_FAILED";
94
94
  }
95
- constructor(t, r, a = "unspecified", n = "unspecified") {
96
- super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = a, this.reason = n, this.payload = r;
95
+ constructor(t, r, o = "unspecified", n = "unspecified") {
96
+ super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = o, this.reason = n, this.payload = r;
97
97
  }
98
98
  }
99
- class le extends C {
99
+ class Oe extends H {
100
100
  static get code() {
101
101
  return "ERR_JWT_EXPIRED";
102
102
  }
103
- constructor(t, r, a = "unspecified", n = "unspecified") {
104
- super(t), this.code = "ERR_JWT_EXPIRED", this.claim = a, this.reason = n, this.payload = r;
103
+ constructor(t, r, o = "unspecified", n = "unspecified") {
104
+ super(t), this.code = "ERR_JWT_EXPIRED", this.claim = o, this.reason = n, this.payload = r;
105
105
  }
106
106
  }
107
- class tt extends C {
107
+ class Ot extends H {
108
108
  constructor() {
109
109
  super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
110
110
  }
@@ -112,14 +112,14 @@ class tt extends C {
112
112
  return "ERR_JOSE_ALG_NOT_ALLOWED";
113
113
  }
114
114
  }
115
- let _ = class extends C {
115
+ let x = class extends H {
116
116
  constructor() {
117
117
  super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
118
118
  }
119
119
  static get code() {
120
120
  return "ERR_JOSE_NOT_SUPPORTED";
121
121
  }
122
- }, f = class extends C {
122
+ }, _ = class extends H {
123
123
  constructor() {
124
124
  super(...arguments), this.code = "ERR_JWS_INVALID";
125
125
  }
@@ -127,7 +127,7 @@ let _ = class extends C {
127
127
  return "ERR_JWS_INVALID";
128
128
  }
129
129
  };
130
- class ve extends C {
130
+ class Ge extends H {
131
131
  constructor() {
132
132
  super(...arguments), this.code = "ERR_JWT_INVALID";
133
133
  }
@@ -135,7 +135,7 @@ class ve extends C {
135
135
  return "ERR_JWT_INVALID";
136
136
  }
137
137
  }
138
- class rt extends C {
138
+ class Pt extends H {
139
139
  constructor() {
140
140
  super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
141
141
  }
@@ -143,16 +143,16 @@ class rt extends C {
143
143
  return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
144
144
  }
145
145
  }
146
- function T(e, t = "algorithm.name") {
146
+ function $(e, t = "algorithm.name") {
147
147
  return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
148
148
  }
149
- function W(e, t) {
149
+ function q(e, t) {
150
150
  return e.name === t;
151
151
  }
152
- function te(e) {
152
+ function Se(e) {
153
153
  return parseInt(e.name.slice(4), 10);
154
154
  }
155
- function at(e) {
155
+ function It(e) {
156
156
  switch (e) {
157
157
  case "ES256":
158
158
  return "P-256";
@@ -164,89 +164,89 @@ function at(e) {
164
164
  throw new Error("unreachable");
165
165
  }
166
166
  }
167
- function nt(e, t) {
167
+ function Dt(e, t) {
168
168
  if (t.length && !t.some((r) => e.usages.includes(r))) {
169
169
  let r = "CryptoKey does not support this operation, its usages must include ";
170
170
  if (t.length > 2) {
171
- const a = t.pop();
172
- r += `one of ${t.join(", ")}, or ${a}.`;
171
+ const o = t.pop();
172
+ r += `one of ${t.join(", ")}, or ${o}.`;
173
173
  } else
174
174
  t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
175
175
  throw new TypeError(r);
176
176
  }
177
177
  }
178
- function st(e, t, ...r) {
178
+ function Nt(e, t, ...r) {
179
179
  switch (t) {
180
180
  case "HS256":
181
181
  case "HS384":
182
182
  case "HS512": {
183
- if (!W(e.algorithm, "HMAC"))
184
- throw T("HMAC");
185
- const a = parseInt(t.slice(2), 10);
186
- if (te(e.algorithm.hash) !== a)
187
- throw T(`SHA-${a}`, "algorithm.hash");
183
+ if (!q(e.algorithm, "HMAC"))
184
+ throw $("HMAC");
185
+ const o = parseInt(t.slice(2), 10);
186
+ if (Se(e.algorithm.hash) !== o)
187
+ throw $(`SHA-${o}`, "algorithm.hash");
188
188
  break;
189
189
  }
190
190
  case "RS256":
191
191
  case "RS384":
192
192
  case "RS512": {
193
- if (!W(e.algorithm, "RSASSA-PKCS1-v1_5"))
194
- throw T("RSASSA-PKCS1-v1_5");
195
- const a = parseInt(t.slice(2), 10);
196
- if (te(e.algorithm.hash) !== a)
197
- throw T(`SHA-${a}`, "algorithm.hash");
193
+ if (!q(e.algorithm, "RSASSA-PKCS1-v1_5"))
194
+ throw $("RSASSA-PKCS1-v1_5");
195
+ const o = parseInt(t.slice(2), 10);
196
+ if (Se(e.algorithm.hash) !== o)
197
+ throw $(`SHA-${o}`, "algorithm.hash");
198
198
  break;
199
199
  }
200
200
  case "PS256":
201
201
  case "PS384":
202
202
  case "PS512": {
203
- if (!W(e.algorithm, "RSA-PSS"))
204
- throw T("RSA-PSS");
205
- const a = parseInt(t.slice(2), 10);
206
- if (te(e.algorithm.hash) !== a)
207
- throw T(`SHA-${a}`, "algorithm.hash");
203
+ if (!q(e.algorithm, "RSA-PSS"))
204
+ throw $("RSA-PSS");
205
+ const o = parseInt(t.slice(2), 10);
206
+ if (Se(e.algorithm.hash) !== o)
207
+ throw $(`SHA-${o}`, "algorithm.hash");
208
208
  break;
209
209
  }
210
210
  case "EdDSA": {
211
211
  if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
212
- throw T("Ed25519 or Ed448");
212
+ throw $("Ed25519 or Ed448");
213
213
  break;
214
214
  }
215
215
  case "ES256":
216
216
  case "ES384":
217
217
  case "ES512": {
218
- if (!W(e.algorithm, "ECDSA"))
219
- throw T("ECDSA");
220
- const a = at(t);
221
- if (e.algorithm.namedCurve !== a)
222
- throw T(a, "algorithm.namedCurve");
218
+ if (!q(e.algorithm, "ECDSA"))
219
+ throw $("ECDSA");
220
+ const o = It(t);
221
+ if (e.algorithm.namedCurve !== o)
222
+ throw $(o, "algorithm.namedCurve");
223
223
  break;
224
224
  }
225
225
  default:
226
226
  throw new TypeError("CryptoKey does not support this operation");
227
227
  }
228
- nt(e, r);
228
+ Dt(e, r);
229
229
  }
230
- function Re(e, t, ...r) {
231
- var a;
230
+ function qe(e, t, ...r) {
231
+ var o;
232
232
  if (r.length > 2) {
233
233
  const n = r.pop();
234
234
  e += `one of type ${r.join(", ")}, or ${n}.`;
235
235
  } else
236
236
  r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
237
- return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
237
+ return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (o = t.constructor) != null && o.name && (e += ` Received an instance of ${t.constructor.name}`), e;
238
238
  }
239
- const he = (e, ...t) => Re("Key must be ", e, ...t);
240
- function Ie(e, t, ...r) {
241
- return Re(`Key for the ${e} algorithm must be `, t, ...r);
239
+ const Pe = (e, ...t) => qe("Key must be ", e, ...t);
240
+ function Xe(e, t, ...r) {
241
+ return qe(`Key for the ${e} algorithm must be `, t, ...r);
242
242
  }
243
- const Ce = (e) => _e(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", G = ["CryptoKey"], ot = (...e) => {
243
+ const Qe = (e) => Be(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", se = ["CryptoKey"], $t = (...e) => {
244
244
  const t = e.filter(Boolean);
245
245
  if (t.length === 0 || t.length === 1)
246
246
  return !0;
247
247
  let r;
248
- for (const a of t) {
249
- const n = Object.keys(a);
248
+ for (const o of t) {
249
+ const n = Object.keys(o);
250
250
  if (!r || r.size === 0) {
251
251
  r = new Set(n);
252
252
  continue;
@@ -259,11 +259,11 @@ const Ce = (e) => _e(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) ===
259
259
  }
260
260
  return !0;
261
261
  };
262
- function it(e) {
262
+ function Ut(e) {
263
263
  return typeof e == "object" && e !== null;
264
264
  }
265
- function ie(e) {
266
- if (!it(e) || Object.prototype.toString.call(e) !== "[object Object]")
265
+ function be(e) {
266
+ if (!Ut(e) || Object.prototype.toString.call(e) !== "[object Object]")
267
267
  return !1;
268
268
  if (Object.getPrototypeOf(e) === null)
269
269
  return !0;
@@ -272,14 +272,14 @@ function ie(e) {
272
272
  t = Object.getPrototypeOf(t);
273
273
  return Object.getPrototypeOf(e) === t;
274
274
  }
275
- const ct = (e, t) => {
275
+ const Lt = (e, t) => {
276
276
  if (e.startsWith("RS") || e.startsWith("PS")) {
277
277
  const { modulusLength: r } = t.algorithm;
278
278
  if (typeof r != "number" || r < 2048)
279
279
  throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
280
280
  }
281
281
  };
282
- function ut(e) {
282
+ function xt(e) {
283
283
  let t, r;
284
284
  switch (e.kty) {
285
285
  case "RSA": {
@@ -304,7 +304,7 @@ function ut(e) {
304
304
  }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
305
305
  break;
306
306
  default:
307
- throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
307
+ throw new x('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
308
308
  }
309
309
  break;
310
310
  }
@@ -326,7 +326,7 @@ function ut(e) {
326
326
  t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
327
327
  break;
328
328
  default:
329
- throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
329
+ throw new x('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
330
330
  }
331
331
  break;
332
332
  }
@@ -342,83 +342,83 @@ function ut(e) {
342
342
  t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
343
343
  break;
344
344
  default:
345
- throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
345
+ throw new x('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
346
346
  }
347
347
  break;
348
348
  }
349
349
  default:
350
- throw new _('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
350
+ throw new x('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
351
351
  }
352
352
  return { algorithm: t, keyUsages: r };
353
353
  }
354
- const dt = async (e) => {
354
+ const Ht = async (e) => {
355
355
  if (!e.alg)
356
356
  throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
357
- const { algorithm: t, keyUsages: r } = ut(e), a = [
357
+ const { algorithm: t, keyUsages: r } = xt(e), o = [
358
358
  t,
359
359
  e.ext ?? !1,
360
360
  e.key_ops ?? r
361
361
  ], n = { ...e };
362
- return delete n.alg, delete n.use, X.subtle.importKey("jwk", n, ...a);
363
- }, Pe = (e) => B(e);
364
- let re, ae;
365
- const Oe = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", De = async (e, t, r, a) => {
362
+ return delete n.alg, delete n.use, ue.subtle.importKey("jwk", n, ...o);
363
+ }, Ze = (e) => ne(e);
364
+ let we, ge;
365
+ const et = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", tt = async (e, t, r, o) => {
366
366
  let n = e.get(t);
367
- if (n != null && n[a])
368
- return n[a];
369
- const s = await dt({ ...r, alg: a });
370
- return n ? n[a] = s : e.set(t, { [a]: s }), s;
371
- }, lt = (e, t) => {
372
- if (Oe(e)) {
367
+ if (n != null && n[o])
368
+ return n[o];
369
+ const s = await Ht({ ...r, alg: o });
370
+ return n ? n[o] = s : e.set(t, { [o]: s }), s;
371
+ }, Mt = (e, t) => {
372
+ if (et(e)) {
373
373
  let r = e.export({ format: "jwk" });
374
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Pe(r.k) : (ae || (ae = /* @__PURE__ */ new WeakMap()), De(ae, e, r, t));
374
+ return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Ze(r.k) : (ge || (ge = /* @__PURE__ */ new WeakMap()), tt(ge, e, r, t));
375
375
  }
376
376
  return e;
377
- }, ht = (e, t) => {
378
- if (Oe(e)) {
377
+ }, Kt = (e, t) => {
378
+ if (et(e)) {
379
379
  let r = e.export({ format: "jwk" });
380
- return r.k ? Pe(r.k) : (re || (re = /* @__PURE__ */ new WeakMap()), De(re, e, r, t));
380
+ return r.k ? Ze(r.k) : (we || (we = /* @__PURE__ */ new WeakMap()), tt(we, e, r, t));
381
381
  }
382
382
  return e;
383
- }, ft = { normalizePublicKey: lt, normalizePrivateKey: ht }, b = (e, t, r = 0) => {
383
+ }, jt = { normalizePublicKey: Mt, normalizePrivateKey: Kt }, L = (e, t, r = 0) => {
384
384
  r === 0 && (t.unshift(t.length), t.unshift(6));
385
- const a = e.indexOf(t[0], r);
386
- if (a === -1)
385
+ const o = e.indexOf(t[0], r);
386
+ if (o === -1)
387
387
  return !1;
388
- const n = e.subarray(a, a + t.length);
389
- return n.length !== t.length ? !1 : n.every((s, o) => s === t[o]) || b(e, t, a + 1);
390
- }, fe = (e) => {
388
+ const n = e.subarray(o, o + t.length);
389
+ return n.length !== t.length ? !1 : n.every((s, a) => s === t[a]) || L(e, t, o + 1);
390
+ }, Ie = (e) => {
391
391
  switch (!0) {
392
- case b(e, [42, 134, 72, 206, 61, 3, 1, 7]):
392
+ case L(e, [42, 134, 72, 206, 61, 3, 1, 7]):
393
393
  return "P-256";
394
- case b(e, [43, 129, 4, 0, 34]):
394
+ case L(e, [43, 129, 4, 0, 34]):
395
395
  return "P-384";
396
- case b(e, [43, 129, 4, 0, 35]):
396
+ case L(e, [43, 129, 4, 0, 35]):
397
397
  return "P-521";
398
- case b(e, [43, 101, 110]):
398
+ case L(e, [43, 101, 110]):
399
399
  return "X25519";
400
- case b(e, [43, 101, 111]):
400
+ case L(e, [43, 101, 111]):
401
401
  return "X448";
402
- case b(e, [43, 101, 112]):
402
+ case L(e, [43, 101, 112]):
403
403
  return "Ed25519";
404
- case b(e, [43, 101, 113]):
404
+ case L(e, [43, 101, 113]):
405
405
  return "Ed448";
406
406
  default:
407
- throw new _("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
407
+ throw new x("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
408
408
  }
409
- }, pt = async (e, t, r, a, n) => {
410
- let s, o;
411
- const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
412
- switch (a) {
409
+ }, Wt = async (e, t, r, o, n) => {
410
+ let s, a;
411
+ const c = new Uint8Array(atob(r.replace(e, "")).split("").map((l) => l.charCodeAt(0)));
412
+ switch (o) {
413
413
  case "PS256":
414
414
  case "PS384":
415
415
  case "PS512":
416
- s = { name: "RSA-PSS", hash: `SHA-${a.slice(-3)}` }, o = ["verify"];
416
+ s = { name: "RSA-PSS", hash: `SHA-${o.slice(-3)}` }, a = ["verify"];
417
417
  break;
418
418
  case "RS256":
419
419
  case "RS384":
420
420
  case "RS512":
421
- s = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${a.slice(-3)}` }, o = ["verify"];
421
+ s = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${o.slice(-3)}` }, a = ["verify"];
422
422
  break;
423
423
  case "RSA-OAEP":
424
424
  case "RSA-OAEP-256":
@@ -426,84 +426,84 @@ const Oe = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject",
426
426
  case "RSA-OAEP-512":
427
427
  s = {
428
428
  name: "RSA-OAEP",
429
- hash: `SHA-${parseInt(a.slice(-3), 10) || 1}`
430
- }, o = ["encrypt", "wrapKey"];
429
+ hash: `SHA-${parseInt(o.slice(-3), 10) || 1}`
430
+ }, a = ["encrypt", "wrapKey"];
431
431
  break;
432
432
  case "ES256":
433
- s = { name: "ECDSA", namedCurve: "P-256" }, o = ["verify"];
433
+ s = { name: "ECDSA", namedCurve: "P-256" }, a = ["verify"];
434
434
  break;
435
435
  case "ES384":
436
- s = { name: "ECDSA", namedCurve: "P-384" }, o = ["verify"];
436
+ s = { name: "ECDSA", namedCurve: "P-384" }, a = ["verify"];
437
437
  break;
438
438
  case "ES512":
439
- s = { name: "ECDSA", namedCurve: "P-521" }, o = ["verify"];
439
+ s = { name: "ECDSA", namedCurve: "P-521" }, a = ["verify"];
440
440
  break;
441
441
  case "ECDH-ES":
442
442
  case "ECDH-ES+A128KW":
443
443
  case "ECDH-ES+A192KW":
444
444
  case "ECDH-ES+A256KW": {
445
- const c = fe(i);
446
- s = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, o = [];
445
+ const l = Ie(c);
446
+ s = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, a = [];
447
447
  break;
448
448
  }
449
449
  case "EdDSA":
450
- s = { name: fe(i) }, o = ["verify"];
450
+ s = { name: Ie(c) }, a = ["verify"];
451
451
  break;
452
452
  default:
453
- throw new _('Invalid or unsupported "alg" (Algorithm) value');
453
+ throw new x('Invalid or unsupported "alg" (Algorithm) value');
454
454
  }
455
- return X.subtle.importKey(t, i, s, !1, o);
456
- }, yt = (e, t, r) => pt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
457
- async function mt(e, t, r) {
455
+ return ue.subtle.importKey(t, c, s, !1, a);
456
+ }, Jt = (e, t, r) => Wt(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
457
+ async function Yt(e, t, r) {
458
458
  if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
459
459
  throw new TypeError('"spki" must be SPKI formatted string');
460
- return yt(e, t);
460
+ return Jt(e, t);
461
461
  }
462
- const F = (e) => e == null ? void 0 : e[Symbol.toStringTag], wt = (e, t) => {
462
+ const ae = (e) => e == null ? void 0 : e[Symbol.toStringTag], Ft = (e, t) => {
463
463
  if (!(t instanceof Uint8Array)) {
464
- if (!Ce(t))
465
- throw new TypeError(Ie(e, t, ...G, "Uint8Array"));
464
+ if (!Qe(t))
465
+ throw new TypeError(Xe(e, t, ...se, "Uint8Array"));
466
466
  if (t.type !== "secret")
467
- throw new TypeError(`${F(t)} instances for symmetric algorithms must be of type "secret"`);
467
+ throw new TypeError(`${ae(t)} instances for symmetric algorithms must be of type "secret"`);
468
468
  }
469
- }, Et = (e, t, r) => {
470
- if (!Ce(t))
471
- throw new TypeError(Ie(e, t, ...G));
469
+ }, Vt = (e, t, r) => {
470
+ if (!Qe(t))
471
+ throw new TypeError(Xe(e, t, ...se));
472
472
  if (t.type === "secret")
473
- throw new TypeError(`${F(t)} instances for asymmetric algorithms must not be of type "secret"`);
473
+ throw new TypeError(`${ae(t)} instances for asymmetric algorithms must not be of type "secret"`);
474
474
  if (t.algorithm && r === "verify" && t.type === "private")
475
- throw new TypeError(`${F(t)} instances for asymmetric algorithm verifying must be of type "public"`);
475
+ throw new TypeError(`${ae(t)} instances for asymmetric algorithm verifying must be of type "public"`);
476
476
  if (t.algorithm && r === "encrypt" && t.type === "private")
477
- throw new TypeError(`${F(t)} instances for asymmetric algorithm encryption must be of type "public"`);
478
- }, St = (e, t, r) => {
479
- e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? wt(e, t) : Et(e, t, r);
477
+ throw new TypeError(`${ae(t)} instances for asymmetric algorithm encryption must be of type "public"`);
478
+ }, zt = (e, t, r) => {
479
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? Ft(e, t) : Vt(e, t, r);
480
480
  };
481
- function gt(e, t, r, a, n) {
482
- if (n.crit !== void 0 && (a == null ? void 0 : a.crit) === void 0)
481
+ function Bt(e, t, r, o, n) {
482
+ if (n.crit !== void 0 && (o == null ? void 0 : o.crit) === void 0)
483
483
  throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
484
- if (!a || a.crit === void 0)
484
+ if (!o || o.crit === void 0)
485
485
  return /* @__PURE__ */ new Set();
486
- if (!Array.isArray(a.crit) || a.crit.length === 0 || a.crit.some((o) => typeof o != "string" || o.length === 0))
486
+ if (!Array.isArray(o.crit) || o.crit.length === 0 || o.crit.some((a) => typeof a != "string" || a.length === 0))
487
487
  throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
488
488
  let s;
489
489
  r !== void 0 ? s = new Map([...Object.entries(r), ...t.entries()]) : s = t;
490
- for (const o of a.crit) {
491
- if (!s.has(o))
492
- throw new _(`Extension Header Parameter "${o}" is not recognized`);
493
- if (n[o] === void 0)
494
- throw new e(`Extension Header Parameter "${o}" is missing`);
495
- if (s.get(o) && a[o] === void 0)
496
- throw new e(`Extension Header Parameter "${o}" MUST be integrity protected`);
497
- }
498
- return new Set(a.crit);
490
+ for (const a of o.crit) {
491
+ if (!s.has(a))
492
+ throw new x(`Extension Header Parameter "${a}" is not recognized`);
493
+ if (n[a] === void 0)
494
+ throw new e(`Extension Header Parameter "${a}" is missing`);
495
+ if (s.get(a) && o[a] === void 0)
496
+ throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`);
497
+ }
498
+ return new Set(o.crit);
499
499
  }
500
- const At = (e, t) => {
500
+ const Gt = (e, t) => {
501
501
  if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
502
502
  throw new TypeError(`"${e}" option must be an array of strings`);
503
503
  if (t)
504
504
  return new Set(t);
505
505
  };
506
- function Tt(e, t) {
506
+ function qt(e, t) {
507
507
  const r = `SHA-${e.slice(-3)}`;
508
508
  switch (e) {
509
509
  case "HS256":
@@ -525,109 +525,109 @@ function Tt(e, t) {
525
525
  case "EdDSA":
526
526
  return { name: t.name };
527
527
  default:
528
- throw new _(`alg ${e} is not supported either by JOSE or your javascript runtime`);
528
+ throw new x(`alg ${e} is not supported either by JOSE or your javascript runtime`);
529
529
  }
530
530
  }
531
- async function kt(e, t, r) {
532
- if (t = await ft.normalizePublicKey(t, e), _e(t))
533
- return st(t, e, r), t;
531
+ async function Xt(e, t, r) {
532
+ if (t = await jt.normalizePublicKey(t, e), Be(t))
533
+ return Nt(t, e, r), t;
534
534
  if (t instanceof Uint8Array) {
535
535
  if (!e.startsWith("HS"))
536
- throw new TypeError(he(t, ...G));
537
- return X.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
536
+ throw new TypeError(Pe(t, ...se));
537
+ return ue.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
538
538
  }
539
- throw new TypeError(he(t, ...G, "Uint8Array"));
539
+ throw new TypeError(Pe(t, ...se, "Uint8Array"));
540
540
  }
541
- const bt = async (e, t, r, a) => {
542
- const n = await kt(e, t, "verify");
543
- ct(e, n);
544
- const s = Tt(e, n.algorithm);
541
+ const Qt = async (e, t, r, o) => {
542
+ const n = await Xt(e, t, "verify");
543
+ Lt(e, n);
544
+ const s = qt(e, n.algorithm);
545
545
  try {
546
- return await X.subtle.verify(s, n, r, a);
546
+ return await ue.subtle.verify(s, n, r, o);
547
547
  } catch {
548
548
  return !1;
549
549
  }
550
550
  };
551
- async function _t(e, t, r) {
552
- if (!ie(e))
553
- throw new f("Flattened JWS must be an object");
551
+ async function Zt(e, t, r) {
552
+ if (!be(e))
553
+ throw new _("Flattened JWS must be an object");
554
554
  if (e.protected === void 0 && e.header === void 0)
555
- throw new f('Flattened JWS must have either of the "protected" or "header" members');
555
+ throw new _('Flattened JWS must have either of the "protected" or "header" members');
556
556
  if (e.protected !== void 0 && typeof e.protected != "string")
557
- throw new f("JWS Protected Header incorrect type");
557
+ throw new _("JWS Protected Header incorrect type");
558
558
  if (e.payload === void 0)
559
- throw new f("JWS Payload missing");
559
+ throw new _("JWS Payload missing");
560
560
  if (typeof e.signature != "string")
561
- throw new f("JWS Signature missing or incorrect type");
562
- if (e.header !== void 0 && !ie(e.header))
563
- throw new f("JWS Unprotected Header incorrect type");
564
- let a = {};
561
+ throw new _("JWS Signature missing or incorrect type");
562
+ if (e.header !== void 0 && !be(e.header))
563
+ throw new _("JWS Unprotected Header incorrect type");
564
+ let o = {};
565
565
  if (e.protected)
566
566
  try {
567
- const E = B(e.protected);
568
- a = JSON.parse(Q.decode(E));
567
+ const S = ne(e.protected);
568
+ o = JSON.parse(le.decode(S));
569
569
  } catch {
570
- throw new f("JWS Protected Header is invalid");
570
+ throw new _("JWS Protected Header is invalid");
571
571
  }
572
- if (!ot(a, e.header))
573
- throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
572
+ if (!$t(o, e.header))
573
+ throw new _("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
574
574
  const n = {
575
- ...a,
575
+ ...o,
576
576
  ...e.header
577
- }, s = gt(f, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
578
- let o = !0;
579
- if (s.has("b64") && (o = a.b64, typeof o != "boolean"))
580
- throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
581
- const { alg: i } = n;
582
- if (typeof i != "string" || !i)
583
- throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');
584
- const c = r && At("algorithms", r.algorithms);
585
- if (c && !c.has(i))
586
- throw new tt('"alg" (Algorithm) Header Parameter value not allowed');
587
- if (o) {
577
+ }, s = Bt(_, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, o, n);
578
+ let a = !0;
579
+ if (s.has("b64") && (a = o.b64, typeof a != "boolean"))
580
+ throw new _('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
581
+ const { alg: c } = n;
582
+ if (typeof c != "string" || !c)
583
+ throw new _('JWS "alg" (Algorithm) Header Parameter missing or invalid');
584
+ const l = r && Gt("algorithms", r.algorithms);
585
+ if (l && !l.has(c))
586
+ throw new Ot('"alg" (Algorithm) Header Parameter value not allowed');
587
+ if (a) {
588
588
  if (typeof e.payload != "string")
589
- throw new f("JWS Payload must be a string");
589
+ throw new _("JWS Payload must be a string");
590
590
  } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
591
- throw new f("JWS Payload must be a string or an Uint8Array instance");
591
+ throw new _("JWS Payload must be a string or an Uint8Array instance");
592
592
  let d = !1;
593
- typeof t == "function" && (t = await t(a, e), d = !0), St(i, t, "verify");
594
- const m = Ze($.encode(e.protected ?? ""), $.encode("."), typeof e.payload == "string" ? $.encode(e.payload) : e.payload);
595
- let p;
593
+ typeof t == "function" && (t = await t(o, e), d = !0), zt(c, t, "verify");
594
+ const p = Ct(G.encode(e.protected ?? ""), G.encode("."), typeof e.payload == "string" ? G.encode(e.payload) : e.payload);
595
+ let m;
596
596
  try {
597
- p = B(e.signature);
597
+ m = ne(e.signature);
598
598
  } catch {
599
- throw new f("Failed to base64url decode the signature");
599
+ throw new _("Failed to base64url decode the signature");
600
600
  }
601
- if (!await bt(i, t, p, m))
602
- throw new rt();
603
- let A;
604
- if (o)
601
+ if (!await Qt(c, t, m, p))
602
+ throw new Pt();
603
+ let T;
604
+ if (a)
605
605
  try {
606
- A = B(e.payload);
606
+ T = ne(e.payload);
607
607
  } catch {
608
- throw new f("Failed to base64url decode the payload");
608
+ throw new _("Failed to base64url decode the payload");
609
609
  }
610
610
  else
611
- typeof e.payload == "string" ? A = $.encode(e.payload) : A = e.payload;
612
- const w = { payload: A };
613
- return e.protected !== void 0 && (w.protectedHeader = a), e.header !== void 0 && (w.unprotectedHeader = e.header), d ? { ...w, key: t } : w;
611
+ typeof e.payload == "string" ? T = G.encode(e.payload) : T = e.payload;
612
+ const E = { payload: T };
613
+ return e.protected !== void 0 && (E.protectedHeader = o), e.header !== void 0 && (E.unprotectedHeader = e.header), d ? { ...E, key: t } : E;
614
614
  }
615
- async function vt(e, t, r) {
616
- if (e instanceof Uint8Array && (e = Q.decode(e)), typeof e != "string")
617
- throw new f("Compact JWS must be a string or Uint8Array");
618
- const { 0: a, 1: n, 2: s, length: o } = e.split(".");
619
- if (o !== 3)
620
- throw new f("Invalid Compact JWS");
621
- const i = await _t({ payload: n, protected: a, signature: s }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
622
- return typeof t == "function" ? { ...c, key: i.key } : c;
615
+ async function er(e, t, r) {
616
+ if (e instanceof Uint8Array && (e = le.decode(e)), typeof e != "string")
617
+ throw new _("Compact JWS must be a string or Uint8Array");
618
+ const { 0: o, 1: n, 2: s, length: a } = e.split(".");
619
+ if (a !== 3)
620
+ throw new _("Invalid Compact JWS");
621
+ const c = await Zt({ payload: n, protected: o, signature: s }, t, r), l = { payload: c.payload, protectedHeader: c.protectedHeader };
622
+ return typeof t == "function" ? { ...l, key: c.key } : l;
623
623
  }
624
- const Rt = (e) => Math.floor(e.getTime() / 1e3), Ue = 60, He = Ue * 60, ce = He * 24, It = ce * 7, Ct = ce * 365.25, Pt = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, pe = (e) => {
625
- const t = Pt.exec(e);
624
+ const tr = (e) => Math.floor(e.getTime() / 1e3), rt = 60, ot = rt * 60, ke = ot * 24, rr = ke * 7, or = ke * 365.25, nr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, De = (e) => {
625
+ const t = nr.exec(e);
626
626
  if (!t || t[4] && t[1])
627
627
  throw new TypeError("Invalid time period format");
628
- const r = parseFloat(t[2]), a = t[3].toLowerCase();
628
+ const r = parseFloat(t[2]), o = t[3].toLowerCase();
629
629
  let n;
630
- switch (a) {
630
+ switch (o) {
631
631
  case "sec":
632
632
  case "secs":
633
633
  case "second":
@@ -640,256 +640,646 @@ const Rt = (e) => Math.floor(e.getTime() / 1e3), Ue = 60, He = Ue * 60, ce = He
640
640
  case "min":
641
641
  case "mins":
642
642
  case "m":
643
- n = Math.round(r * Ue);
643
+ n = Math.round(r * rt);
644
644
  break;
645
645
  case "hour":
646
646
  case "hours":
647
647
  case "hr":
648
648
  case "hrs":
649
649
  case "h":
650
- n = Math.round(r * He);
650
+ n = Math.round(r * ot);
651
651
  break;
652
652
  case "day":
653
653
  case "days":
654
654
  case "d":
655
- n = Math.round(r * ce);
655
+ n = Math.round(r * ke);
656
656
  break;
657
657
  case "week":
658
658
  case "weeks":
659
659
  case "w":
660
- n = Math.round(r * It);
660
+ n = Math.round(r * rr);
661
661
  break;
662
662
  default:
663
- n = Math.round(r * Ct);
663
+ n = Math.round(r * or);
664
664
  break;
665
665
  }
666
666
  return t[1] === "-" || t[4] === "ago" ? -n : n;
667
- }, ye = (e) => e.toLowerCase().replace(/^application\//, ""), Ot = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Dt = (e, t, r = {}) => {
668
- let a;
667
+ }, Ne = (e) => e.toLowerCase().replace(/^application\//, ""), ar = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, sr = (e, t, r = {}) => {
668
+ let o;
669
669
  try {
670
- a = JSON.parse(Q.decode(t));
670
+ o = JSON.parse(le.decode(t));
671
671
  } catch {
672
672
  }
673
- if (!ie(a))
674
- throw new ve("JWT Claims Set must be a top-level JSON object");
673
+ if (!be(o))
674
+ throw new Ge("JWT Claims Set must be a top-level JSON object");
675
675
  const { typ: n } = r;
676
- if (n && (typeof e.typ != "string" || ye(e.typ) !== ye(n)))
677
- throw new g('unexpected "typ" JWT header value', a, "typ", "check_failed");
678
- const { requiredClaims: s = [], issuer: o, subject: i, audience: c, maxTokenAge: d } = r, m = [...s];
679
- d !== void 0 && m.push("iat"), c !== void 0 && m.push("aud"), i !== void 0 && m.push("sub"), o !== void 0 && m.push("iss");
680
- for (const E of new Set(m.reverse()))
681
- if (!(E in a))
682
- throw new g(`missing required "${E}" claim`, a, E, "missing");
683
- if (o && !(Array.isArray(o) ? o : [o]).includes(a.iss))
684
- throw new g('unexpected "iss" claim value', a, "iss", "check_failed");
685
- if (i && a.sub !== i)
686
- throw new g('unexpected "sub" claim value', a, "sub", "check_failed");
687
- if (c && !Ot(a.aud, typeof c == "string" ? [c] : c))
688
- throw new g('unexpected "aud" claim value', a, "aud", "check_failed");
689
- let p;
676
+ if (n && (typeof e.typ != "string" || Ne(e.typ) !== Ne(n)))
677
+ throw new O('unexpected "typ" JWT header value', o, "typ", "check_failed");
678
+ const { requiredClaims: s = [], issuer: a, subject: c, audience: l, maxTokenAge: d } = r, p = [...s];
679
+ d !== void 0 && p.push("iat"), l !== void 0 && p.push("aud"), c !== void 0 && p.push("sub"), a !== void 0 && p.push("iss");
680
+ for (const S of new Set(p.reverse()))
681
+ if (!(S in o))
682
+ throw new O(`missing required "${S}" claim`, o, S, "missing");
683
+ if (a && !(Array.isArray(a) ? a : [a]).includes(o.iss))
684
+ throw new O('unexpected "iss" claim value', o, "iss", "check_failed");
685
+ if (c && o.sub !== c)
686
+ throw new O('unexpected "sub" claim value', o, "sub", "check_failed");
687
+ if (l && !ar(o.aud, typeof l == "string" ? [l] : l))
688
+ throw new O('unexpected "aud" claim value', o, "aud", "check_failed");
689
+ let m;
690
690
  switch (typeof r.clockTolerance) {
691
691
  case "string":
692
- p = pe(r.clockTolerance);
692
+ m = De(r.clockTolerance);
693
693
  break;
694
694
  case "number":
695
- p = r.clockTolerance;
695
+ m = r.clockTolerance;
696
696
  break;
697
697
  case "undefined":
698
- p = 0;
698
+ m = 0;
699
699
  break;
700
700
  default:
701
701
  throw new TypeError("Invalid clockTolerance option type");
702
702
  }
703
- const { currentDate: A } = r, w = Rt(A || /* @__PURE__ */ new Date());
704
- if ((a.iat !== void 0 || d) && typeof a.iat != "number")
705
- throw new g('"iat" claim must be a number', a, "iat", "invalid");
706
- if (a.nbf !== void 0) {
707
- if (typeof a.nbf != "number")
708
- throw new g('"nbf" claim must be a number', a, "nbf", "invalid");
709
- if (a.nbf > w + p)
710
- throw new g('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
711
- }
712
- if (a.exp !== void 0) {
713
- if (typeof a.exp != "number")
714
- throw new g('"exp" claim must be a number', a, "exp", "invalid");
715
- if (a.exp <= w - p)
716
- throw new le('"exp" claim timestamp check failed', a, "exp", "check_failed");
703
+ const { currentDate: T } = r, E = tr(T || /* @__PURE__ */ new Date());
704
+ if ((o.iat !== void 0 || d) && typeof o.iat != "number")
705
+ throw new O('"iat" claim must be a number', o, "iat", "invalid");
706
+ if (o.nbf !== void 0) {
707
+ if (typeof o.nbf != "number")
708
+ throw new O('"nbf" claim must be a number', o, "nbf", "invalid");
709
+ if (o.nbf > E + m)
710
+ throw new O('"nbf" claim timestamp check failed', o, "nbf", "check_failed");
711
+ }
712
+ if (o.exp !== void 0) {
713
+ if (typeof o.exp != "number")
714
+ throw new O('"exp" claim must be a number', o, "exp", "invalid");
715
+ if (o.exp <= E - m)
716
+ throw new Oe('"exp" claim timestamp check failed', o, "exp", "check_failed");
717
717
  }
718
718
  if (d) {
719
- const E = w - a.iat, K = typeof d == "number" ? d : pe(d);
720
- if (E - p > K)
721
- throw new le('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
722
- if (E < 0 - p)
723
- throw new g('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
719
+ const S = E - o.iat, P = typeof d == "number" ? d : De(d);
720
+ if (S - m > P)
721
+ throw new Oe('"iat" claim timestamp check failed (too far in the past)', o, "iat", "check_failed");
722
+ if (S < 0 - m)
723
+ throw new O('"iat" claim timestamp check failed (it should be in the past)', o, "iat", "check_failed");
724
724
  }
725
- return a;
725
+ return o;
726
726
  };
727
- async function Ut(e, t, r) {
728
- var a;
729
- const n = await vt(e, t, r);
730
- if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
731
- throw new ve("JWTs MUST NOT use unencoded payload");
732
- const s = { payload: Dt(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
727
+ async function ir(e, t, r) {
728
+ var o;
729
+ const n = await er(e, t, r);
730
+ if ((o = n.protectedHeader.crit) != null && o.includes("b64") && n.protectedHeader.b64 === !1)
731
+ throw new Ge("JWTs MUST NOT use unencoded payload");
732
+ const s = { payload: sr(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
733
733
  return typeof t == "function" ? { ...s, key: n.key } : s;
734
734
  }
735
- const H = async (e) => {
735
+ const Y = async (e) => {
736
736
  try {
737
- const t = y.ALG, r = await mt(Qe, t);
738
- return await Ut(e, r, {
739
- issuer: y.ISSUER
737
+ const t = k.ALG, r = await Yt(kt, t);
738
+ return await ir(e, r, {
739
+ issuer: k.ISSUER
740
740
  });
741
741
  } catch {
742
742
  return;
743
743
  }
744
744
  };
745
- var l = [];
746
- for (var ne = 0; ne < 256; ++ne)
747
- l.push((ne + 256).toString(16).slice(1));
748
- function Ht(e, t = 0) {
749
- return (l[e[t + 0]] + l[e[t + 1]] + l[e[t + 2]] + l[e[t + 3]] + "-" + l[e[t + 4]] + l[e[t + 5]] + "-" + l[e[t + 6]] + l[e[t + 7]] + "-" + l[e[t + 8]] + l[e[t + 9]] + "-" + l[e[t + 10]] + l[e[t + 11]] + l[e[t + 12]] + l[e[t + 13]] + l[e[t + 14]] + l[e[t + 15]]).toLowerCase();
745
+ var A = [];
746
+ for (var Ae = 0; Ae < 256; ++Ae)
747
+ A.push((Ae + 256).toString(16).slice(1));
748
+ function cr(e, t = 0) {
749
+ return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
750
750
  }
751
- var J, Kt = new Uint8Array(16);
752
- function Nt() {
753
- if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
751
+ var X, ur = new Uint8Array(16);
752
+ function lr() {
753
+ if (!X && (X = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !X))
754
754
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
755
- return J(Kt);
755
+ return X(ur);
756
756
  }
757
- var Lt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
758
- const me = {
759
- randomUUID: Lt
757
+ var dr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
758
+ const $e = {
759
+ randomUUID: dr
760
760
  };
761
- function we(e, t, r) {
762
- if (me.randomUUID && !t && !e)
763
- return me.randomUUID();
761
+ function Ue(e, t, r) {
762
+ if ($e.randomUUID && !t && !e)
763
+ return $e.randomUUID();
764
764
  e = e || {};
765
- var a = e.random || (e.rng || Nt)();
766
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Ht(a);
765
+ var o = e.random || (e.rng || lr)();
766
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, cr(o);
767
767
  }
768
- const Ee = globalThis.crypto, $t = (e) => `${we()}${we()}`.slice(0, e), Wt = (e) => btoa(
768
+ const Le = globalThis.crypto, fr = (e) => `${Ue()}${Ue()}`.slice(0, e), hr = (e) => btoa(
769
769
  [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
770
770
  );
771
- async function Jt(e) {
772
- if (!Ee.subtle)
771
+ async function pr(e) {
772
+ if (!Le.subtle)
773
773
  throw new Error(
774
774
  "crypto.subtle is available only in secure contexts (HTTPS)."
775
775
  );
776
- const t = new TextEncoder().encode(e), r = await Ee.subtle.digest("SHA-256", t);
777
- return Wt(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
776
+ const t = new TextEncoder().encode(e), r = await Le.subtle.digest("SHA-256", t);
777
+ return hr(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
778
778
  }
779
- async function xt(e) {
780
- const r = $t(43), a = await Jt(r);
779
+ async function yr(e) {
780
+ const r = fr(43), o = await pr(r);
781
781
  return {
782
782
  code_verifier: r,
783
- code_challenge: a
783
+ code_challenge: o
784
784
  };
785
785
  }
786
- function Ke(e, t) {
786
+ function nt(e, t) {
787
787
  window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
788
788
  }
789
- const Se = (e, t) => {
789
+ const xe = (e, t) => {
790
790
  const r = JSON.stringify(
791
791
  typeof t == "function" ? t() : t
792
792
  );
793
- window.localStorage.setItem(e, r), Ke(e, r);
794
- }, jt = (e) => {
795
- window.localStorage.removeItem(e), Ke(e, null);
796
- }, ge = (e) => window.localStorage.getItem(e), Mt = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
797
- function x({
793
+ window.localStorage.setItem(e, r), nt(e, r);
794
+ }, mr = (e) => {
795
+ window.localStorage.removeItem(e), nt(e, null);
796
+ }, He = (e) => window.localStorage.getItem(e), Er = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
797
+ function Q({
798
798
  key: e,
799
799
  initialValue: t
800
800
  }) {
801
- const r = () => ge(e), a = U.useSyncExternalStore(
802
- Mt,
801
+ const r = () => He(e), o = K.useSyncExternalStore(
802
+ Er,
803
803
  r
804
- ), n = U.useCallback(
805
- (i) => {
804
+ ), n = K.useCallback(
805
+ (c) => {
806
806
  try {
807
- const c = typeof i == "function" ? i(JSON.parse(a)) : i;
808
- c == null ? jt(e) : Se(e, c);
809
- } catch (c) {
810
- console.warn(c);
807
+ const l = typeof c == "function" ? c(JSON.parse(o)) : c;
808
+ l == null ? mr(e) : xe(e, l);
809
+ } catch (l) {
810
+ console.warn(l);
811
811
  }
812
812
  },
813
- [e, a]
814
- ), s = U.useCallback(() => {
813
+ [e, o]
814
+ ), s = K.useCallback(() => {
815
815
  n(t);
816
- }, [t, n]), o = U.useCallback(() => {
816
+ }, [t, n]), a = K.useCallback(() => {
817
817
  n(null);
818
818
  }, [n]);
819
- return U.useEffect(() => {
819
+ return K.useEffect(() => {
820
820
  try {
821
- ge(e) === null && typeof t < "u" && Se(e, t);
822
- } catch (i) {
823
- console.warn(i);
821
+ He(e) === null && typeof t < "u" && xe(e, t);
822
+ } catch (c) {
823
+ console.warn(c);
824
+ }
825
+ }, [e, t]), [o ? JSON.parse(o) : null, n, s, a];
826
+ }
827
+ /*!
828
+ * cookie
829
+ * Copyright(c) 2012-2014 Roman Shtylman
830
+ * Copyright(c) 2015 Douglas Christopher Wilson
831
+ * MIT Licensed
832
+ */
833
+ var at = wr, Me = gr, Sr = Object.prototype.toString, Z = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
834
+ function wr(e, t) {
835
+ if (typeof e != "string")
836
+ throw new TypeError("argument str must be a string");
837
+ for (var r = {}, o = t || {}, n = o.decode || Ar, s = 0; s < e.length; ) {
838
+ var a = e.indexOf("=", s);
839
+ if (a === -1)
840
+ break;
841
+ var c = e.indexOf(";", s);
842
+ if (c === -1)
843
+ c = e.length;
844
+ else if (c < a) {
845
+ s = e.lastIndexOf(";", a - 1) + 1;
846
+ continue;
847
+ }
848
+ var l = e.slice(s, a).trim();
849
+ if (r[l] === void 0) {
850
+ var d = e.slice(a + 1, c).trim();
851
+ d.charCodeAt(0) === 34 && (d = d.slice(1, -1)), r[l] = Tr(d, n);
852
+ }
853
+ s = c + 1;
854
+ }
855
+ return r;
856
+ }
857
+ function gr(e, t, r) {
858
+ var o = r || {}, n = o.encode || vr;
859
+ if (typeof n != "function")
860
+ throw new TypeError("option encode is invalid");
861
+ if (!Z.test(e))
862
+ throw new TypeError("argument name is invalid");
863
+ var s = n(t);
864
+ if (s && !Z.test(s))
865
+ throw new TypeError("argument val is invalid");
866
+ var a = e + "=" + s;
867
+ if (o.maxAge != null) {
868
+ var c = o.maxAge - 0;
869
+ if (isNaN(c) || !isFinite(c))
870
+ throw new TypeError("option maxAge is invalid");
871
+ a += "; Max-Age=" + Math.floor(c);
872
+ }
873
+ if (o.domain) {
874
+ if (!Z.test(o.domain))
875
+ throw new TypeError("option domain is invalid");
876
+ a += "; Domain=" + o.domain;
877
+ }
878
+ if (o.path) {
879
+ if (!Z.test(o.path))
880
+ throw new TypeError("option path is invalid");
881
+ a += "; Path=" + o.path;
882
+ }
883
+ if (o.expires) {
884
+ var l = o.expires;
885
+ if (!_r(l) || isNaN(l.valueOf()))
886
+ throw new TypeError("option expires is invalid");
887
+ a += "; Expires=" + l.toUTCString();
888
+ }
889
+ if (o.httpOnly && (a += "; HttpOnly"), o.secure && (a += "; Secure"), o.partitioned && (a += "; Partitioned"), o.priority) {
890
+ var d = typeof o.priority == "string" ? o.priority.toLowerCase() : o.priority;
891
+ switch (d) {
892
+ case "low":
893
+ a += "; Priority=Low";
894
+ break;
895
+ case "medium":
896
+ a += "; Priority=Medium";
897
+ break;
898
+ case "high":
899
+ a += "; Priority=High";
900
+ break;
901
+ default:
902
+ throw new TypeError("option priority is invalid");
903
+ }
904
+ }
905
+ if (o.sameSite) {
906
+ var p = typeof o.sameSite == "string" ? o.sameSite.toLowerCase() : o.sameSite;
907
+ switch (p) {
908
+ case !0:
909
+ a += "; SameSite=Strict";
910
+ break;
911
+ case "lax":
912
+ a += "; SameSite=Lax";
913
+ break;
914
+ case "strict":
915
+ a += "; SameSite=Strict";
916
+ break;
917
+ case "none":
918
+ a += "; SameSite=None";
919
+ break;
920
+ default:
921
+ throw new TypeError("option sameSite is invalid");
922
+ }
923
+ }
924
+ return a;
925
+ }
926
+ function Ar(e) {
927
+ return e.indexOf("%") !== -1 ? decodeURIComponent(e) : e;
928
+ }
929
+ function vr(e) {
930
+ return encodeURIComponent(e);
931
+ }
932
+ function _r(e) {
933
+ return Sr.call(e) === "[object Date]" || e instanceof Date;
934
+ }
935
+ function Tr(e, t) {
936
+ try {
937
+ return t(e);
938
+ } catch {
939
+ return e;
940
+ }
941
+ }
942
+ function br() {
943
+ const e = typeof global > "u" ? void 0 : global.TEST_HAS_DOCUMENT_COOKIE;
944
+ return typeof e == "boolean" ? e : typeof document == "object" && typeof document.cookie == "string";
945
+ }
946
+ function kr(e) {
947
+ return typeof e == "string" ? at(e) : typeof e == "object" && e !== null ? e : {};
948
+ }
949
+ function ve(e, t = {}) {
950
+ const r = Cr(e);
951
+ if (!t.doNotParse)
952
+ try {
953
+ return JSON.parse(r);
954
+ } catch {
955
+ }
956
+ return e;
957
+ }
958
+ function Cr(e) {
959
+ return e && e[0] === "j" && e[1] === ":" ? e.substr(2) : e;
960
+ }
961
+ class Rr {
962
+ constructor(t, r = {}) {
963
+ this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.update = () => {
964
+ if (!this.HAS_DOCUMENT_COOKIE)
965
+ return;
966
+ const n = this.cookies;
967
+ this.cookies = at(document.cookie), this._checkChanges(n);
968
+ };
969
+ const o = typeof document > "u" ? "" : document.cookie;
970
+ this.cookies = kr(t || o), this.defaultSetOptions = r, this.HAS_DOCUMENT_COOKIE = br();
971
+ }
972
+ _emitChange(t) {
973
+ for (let r = 0; r < this.changeListeners.length; ++r)
974
+ this.changeListeners[r](t);
975
+ }
976
+ _checkChanges(t) {
977
+ new Set(Object.keys(t).concat(Object.keys(this.cookies))).forEach((o) => {
978
+ t[o] !== this.cookies[o] && this._emitChange({
979
+ name: o,
980
+ value: ve(this.cookies[o])
981
+ });
982
+ });
983
+ }
984
+ _startPolling() {
985
+ this.pollingInterval = setInterval(this.update, 300);
986
+ }
987
+ _stopPolling() {
988
+ this.pollingInterval && clearInterval(this.pollingInterval);
989
+ }
990
+ get(t, r = {}) {
991
+ return r.doNotUpdate || this.update(), ve(this.cookies[t], r);
992
+ }
993
+ getAll(t = {}) {
994
+ t.doNotUpdate || this.update();
995
+ const r = {};
996
+ for (let o in this.cookies)
997
+ r[o] = ve(this.cookies[o], t);
998
+ return r;
999
+ }
1000
+ set(t, r, o) {
1001
+ o ? o = Object.assign(Object.assign({}, this.defaultSetOptions), o) : o = this.defaultSetOptions;
1002
+ const n = typeof r == "string" ? r : JSON.stringify(r);
1003
+ this.cookies = Object.assign(Object.assign({}, this.cookies), { [t]: n }), this.HAS_DOCUMENT_COOKIE && (document.cookie = Me(t, n, o)), this._emitChange({ name: t, value: r, options: o });
1004
+ }
1005
+ remove(t, r) {
1006
+ const o = r = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), r), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 });
1007
+ this.cookies = Object.assign({}, this.cookies), delete this.cookies[t], this.HAS_DOCUMENT_COOKIE && (document.cookie = Me(t, "", o)), this._emitChange({ name: t, value: void 0, options: r });
1008
+ }
1009
+ addChangeListener(t) {
1010
+ this.changeListeners.push(t), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.addEventListener("change", this.update) : this._startPolling());
1011
+ }
1012
+ removeChangeListener(t) {
1013
+ const r = this.changeListeners.indexOf(t);
1014
+ r >= 0 && this.changeListeners.splice(r, 1), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.removeEventListener("change", this.update) : this._stopPolling());
1015
+ }
1016
+ }
1017
+ const Or = K.createContext(new Rr());
1018
+ var f = {};
1019
+ /** @license React v16.13.1
1020
+ * react-is.production.min.js
1021
+ *
1022
+ * Copyright (c) Facebook, Inc. and its affiliates.
1023
+ *
1024
+ * This source code is licensed under the MIT license found in the
1025
+ * LICENSE file in the root directory of this source tree.
1026
+ */
1027
+ var Ke;
1028
+ function Pr() {
1029
+ if (Ke)
1030
+ return f;
1031
+ Ke = 1;
1032
+ var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, l = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, T = e ? Symbol.for("react.suspense_list") : 60120, E = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, P = e ? Symbol.for("react.block") : 60121, j = e ? Symbol.for("react.fundamental") : 60117, W = e ? Symbol.for("react.responder") : 60118, M = e ? Symbol.for("react.scope") : 60119;
1033
+ function g(i) {
1034
+ if (typeof i == "object" && i !== null) {
1035
+ var C = i.$$typeof;
1036
+ switch (C) {
1037
+ case t:
1038
+ switch (i = i.type, i) {
1039
+ case l:
1040
+ case d:
1041
+ case o:
1042
+ case s:
1043
+ case n:
1044
+ case m:
1045
+ return i;
1046
+ default:
1047
+ switch (i = i && i.$$typeof, i) {
1048
+ case c:
1049
+ case p:
1050
+ case S:
1051
+ case E:
1052
+ case a:
1053
+ return i;
1054
+ default:
1055
+ return C;
1056
+ }
1057
+ }
1058
+ case r:
1059
+ return C;
1060
+ }
824
1061
  }
825
- }, [e, t]), [a ? JSON.parse(a) : null, n, s, o];
1062
+ }
1063
+ function w(i) {
1064
+ return g(i) === d;
1065
+ }
1066
+ return f.AsyncMode = l, f.ConcurrentMode = d, f.ContextConsumer = c, f.ContextProvider = a, f.Element = t, f.ForwardRef = p, f.Fragment = o, f.Lazy = S, f.Memo = E, f.Portal = r, f.Profiler = s, f.StrictMode = n, f.Suspense = m, f.isAsyncMode = function(i) {
1067
+ return w(i) || g(i) === l;
1068
+ }, f.isConcurrentMode = w, f.isContextConsumer = function(i) {
1069
+ return g(i) === c;
1070
+ }, f.isContextProvider = function(i) {
1071
+ return g(i) === a;
1072
+ }, f.isElement = function(i) {
1073
+ return typeof i == "object" && i !== null && i.$$typeof === t;
1074
+ }, f.isForwardRef = function(i) {
1075
+ return g(i) === p;
1076
+ }, f.isFragment = function(i) {
1077
+ return g(i) === o;
1078
+ }, f.isLazy = function(i) {
1079
+ return g(i) === S;
1080
+ }, f.isMemo = function(i) {
1081
+ return g(i) === E;
1082
+ }, f.isPortal = function(i) {
1083
+ return g(i) === r;
1084
+ }, f.isProfiler = function(i) {
1085
+ return g(i) === s;
1086
+ }, f.isStrictMode = function(i) {
1087
+ return g(i) === n;
1088
+ }, f.isSuspense = function(i) {
1089
+ return g(i) === m;
1090
+ }, f.isValidElementType = function(i) {
1091
+ return typeof i == "string" || typeof i == "function" || i === o || i === d || i === s || i === n || i === m || i === T || typeof i == "object" && i !== null && (i.$$typeof === S || i.$$typeof === E || i.$$typeof === a || i.$$typeof === c || i.$$typeof === p || i.$$typeof === j || i.$$typeof === W || i.$$typeof === M || i.$$typeof === P);
1092
+ }, f.typeOf = g, f;
826
1093
  }
827
- var h = [];
828
- for (var se = 0; se < 256; ++se)
829
- h.push((se + 256).toString(16).slice(1));
830
- function Vt(e, t = 0) {
831
- return (h[e[t + 0]] + h[e[t + 1]] + h[e[t + 2]] + h[e[t + 3]] + "-" + h[e[t + 4]] + h[e[t + 5]] + "-" + h[e[t + 6]] + h[e[t + 7]] + "-" + h[e[t + 8]] + h[e[t + 9]] + "-" + h[e[t + 10]] + h[e[t + 11]] + h[e[t + 12]] + h[e[t + 13]] + h[e[t + 14]] + h[e[t + 15]]).toLowerCase();
1094
+ var h = {};
1095
+ /** @license React v16.13.1
1096
+ * react-is.development.js
1097
+ *
1098
+ * Copyright (c) Facebook, Inc. and its affiliates.
1099
+ *
1100
+ * This source code is licensed under the MIT license found in the
1101
+ * LICENSE file in the root directory of this source tree.
1102
+ */
1103
+ var je;
1104
+ function Ir() {
1105
+ return je || (je = 1, process.env.NODE_ENV !== "production" && function() {
1106
+ var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, l = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, T = e ? Symbol.for("react.suspense_list") : 60120, E = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, P = e ? Symbol.for("react.block") : 60121, j = e ? Symbol.for("react.fundamental") : 60117, W = e ? Symbol.for("react.responder") : 60118, M = e ? Symbol.for("react.scope") : 60119;
1107
+ function g(u) {
1108
+ return typeof u == "string" || typeof u == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1109
+ u === o || u === d || u === s || u === n || u === m || u === T || typeof u == "object" && u !== null && (u.$$typeof === S || u.$$typeof === E || u.$$typeof === a || u.$$typeof === c || u.$$typeof === p || u.$$typeof === j || u.$$typeof === W || u.$$typeof === M || u.$$typeof === P);
1110
+ }
1111
+ function w(u) {
1112
+ if (typeof u == "object" && u !== null) {
1113
+ var me = u.$$typeof;
1114
+ switch (me) {
1115
+ case t:
1116
+ var z = u.type;
1117
+ switch (z) {
1118
+ case l:
1119
+ case d:
1120
+ case o:
1121
+ case s:
1122
+ case n:
1123
+ case m:
1124
+ return z;
1125
+ default:
1126
+ var Ce = z && z.$$typeof;
1127
+ switch (Ce) {
1128
+ case c:
1129
+ case p:
1130
+ case S:
1131
+ case E:
1132
+ case a:
1133
+ return Ce;
1134
+ default:
1135
+ return me;
1136
+ }
1137
+ }
1138
+ case r:
1139
+ return me;
1140
+ }
1141
+ }
1142
+ }
1143
+ var i = l, C = d, I = c, fe = a, he = t, pe = p, ye = o, y = S, R = E, b = r, D = s, U = n, J = m, F = !1;
1144
+ function V(u) {
1145
+ return F || (F = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), N(u) || w(u) === l;
1146
+ }
1147
+ function N(u) {
1148
+ return w(u) === d;
1149
+ }
1150
+ function it(u) {
1151
+ return w(u) === c;
1152
+ }
1153
+ function ct(u) {
1154
+ return w(u) === a;
1155
+ }
1156
+ function ut(u) {
1157
+ return typeof u == "object" && u !== null && u.$$typeof === t;
1158
+ }
1159
+ function lt(u) {
1160
+ return w(u) === p;
1161
+ }
1162
+ function dt(u) {
1163
+ return w(u) === o;
1164
+ }
1165
+ function ft(u) {
1166
+ return w(u) === S;
1167
+ }
1168
+ function ht(u) {
1169
+ return w(u) === E;
1170
+ }
1171
+ function pt(u) {
1172
+ return w(u) === r;
1173
+ }
1174
+ function yt(u) {
1175
+ return w(u) === s;
1176
+ }
1177
+ function mt(u) {
1178
+ return w(u) === n;
1179
+ }
1180
+ function Et(u) {
1181
+ return w(u) === m;
1182
+ }
1183
+ h.AsyncMode = i, h.ConcurrentMode = C, h.ContextConsumer = I, h.ContextProvider = fe, h.Element = he, h.ForwardRef = pe, h.Fragment = ye, h.Lazy = y, h.Memo = R, h.Portal = b, h.Profiler = D, h.StrictMode = U, h.Suspense = J, h.isAsyncMode = V, h.isConcurrentMode = N, h.isContextConsumer = it, h.isContextProvider = ct, h.isElement = ut, h.isForwardRef = lt, h.isFragment = dt, h.isLazy = ft, h.isMemo = ht, h.isPortal = pt, h.isProfiler = yt, h.isStrictMode = mt, h.isSuspense = Et, h.isValidElementType = g, h.typeOf = w;
1184
+ }()), h;
832
1185
  }
833
- var j, Yt = new Uint8Array(16);
834
- function Bt() {
835
- if (!j && (j = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !j))
1186
+ process.env.NODE_ENV === "production" ? Pr() : Ir();
1187
+ function Dr() {
1188
+ return typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
1189
+ }
1190
+ function Nr(e) {
1191
+ const t = Ve(Or);
1192
+ if (!t)
1193
+ throw new Error("Missing <CookiesProvider>");
1194
+ const [r, o] = ze(() => t.getAll({ doNotUpdate: !0 }));
1195
+ Dr() && At(() => {
1196
+ function c() {
1197
+ const l = t.getAll({
1198
+ doNotUpdate: !0
1199
+ });
1200
+ $r(e || null, l, r) && o(l);
1201
+ }
1202
+ return t.addChangeListener(c), () => {
1203
+ t.removeChangeListener(c);
1204
+ };
1205
+ }, [t, r]);
1206
+ const n = Ee(() => t.set.bind(t), [t]), s = Ee(() => t.remove.bind(t), [t]), a = Ee(() => t.update.bind(t), [t]);
1207
+ return [r, n, s, a];
1208
+ }
1209
+ function $r(e, t, r) {
1210
+ if (!e)
1211
+ return !0;
1212
+ for (let o of e)
1213
+ if (t[o] !== r[o])
1214
+ return !0;
1215
+ return !1;
1216
+ }
1217
+ var v = [];
1218
+ for (var _e = 0; _e < 256; ++_e)
1219
+ v.push((_e + 256).toString(16).slice(1));
1220
+ function Ur(e, t = 0) {
1221
+ return (v[e[t + 0]] + v[e[t + 1]] + v[e[t + 2]] + v[e[t + 3]] + "-" + v[e[t + 4]] + v[e[t + 5]] + "-" + v[e[t + 6]] + v[e[t + 7]] + "-" + v[e[t + 8]] + v[e[t + 9]] + "-" + v[e[t + 10]] + v[e[t + 11]] + v[e[t + 12]] + v[e[t + 13]] + v[e[t + 14]] + v[e[t + 15]]).toLowerCase();
1222
+ }
1223
+ var ee, Lr = new Uint8Array(16);
1224
+ function xr() {
1225
+ if (!ee && (ee = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ee))
836
1226
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
837
- return j(Yt);
1227
+ return ee(Lr);
838
1228
  }
839
- var Ft = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
840
- const Ae = {
841
- randomUUID: Ft
1229
+ var Hr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1230
+ const We = {
1231
+ randomUUID: Hr
842
1232
  };
843
- function Gt(e, t, r) {
844
- if (Ae.randomUUID && !t && !e)
845
- return Ae.randomUUID();
1233
+ function Mr(e, t, r) {
1234
+ if (We.randomUUID && !t && !e)
1235
+ return We.randomUUID();
846
1236
  e = e || {};
847
- var a = e.random || (e.rng || Bt)();
848
- return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, Vt(a);
1237
+ var o = e.random || (e.rng || xr)();
1238
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Ur(o);
849
1239
  }
850
- const M = "Oops! It looks like your session has expired. For your security, please log in again to continue.", qt = "Your session has been successfully terminated.", Te = "Login failed. Please try again.", oe = "Error getting access token, please re-authenticate.", zt = "You forgot to wrap your component in <AuthProvider>.", ke = {
1240
+ const te = "Oops! It looks like your session has expired. For your security, please log in again to continue.", Kr = "Your session has been successfully terminated.", Je = "Login failed. Please try again.", Te = "Error getting access token, please re-authenticate.", jr = "You forgot to wrap your component in <AuthProvider>.", Ye = {
851
1241
  dev: "https://auth.gizmette.local.com:3003",
852
1242
  prod: "https://mylogin.gizmette.com"
853
- }, V = "@@auth@@", Xt = process.env.NODE_ENV === "production", Qt = !Xt, Z = async ({
1243
+ }, re = "@@auth@@", Wr = process.env.NODE_ENV === "production", Jr = !Wr, de = async ({
854
1244
  type: e,
855
1245
  clientId: t,
856
1246
  params: r = {}
857
1247
  }) => {
858
1248
  try {
859
- const a = await fetch(
860
- Qt ? `${ke.dev}/${e}` : `${ke.prod}/${e}`,
1249
+ const o = await fetch(
1250
+ Jr ? `${Ye.dev}/${e}` : `${Ye.prod}/${e}`,
861
1251
  {
862
1252
  credentials: "include",
863
1253
  method: "POST",
864
1254
  headers: {
865
1255
  "Content-Type": "application/json",
866
- [Xe.CLIENT_ID]: `${t}`
1256
+ [bt.CLIENT_ID]: `${t}`
867
1257
  },
868
1258
  body: JSON.stringify(r)
869
1259
  }
870
1260
  );
871
- if (a.status !== 200)
872
- return { status: a.status, data: [] };
873
- const { data: n, errors: s } = await a.json();
1261
+ if (o.status !== 200)
1262
+ return { status: o.status, data: [] };
1263
+ const { data: n, errors: s } = await o.json();
874
1264
  return {
875
- status: a.status,
1265
+ status: o.status,
876
1266
  data: n,
877
1267
  errors: s
878
1268
  };
879
- } catch (a) {
880
- return console.error(a), { status: 500, data: [] };
1269
+ } catch (o) {
1270
+ return console.error(o), { status: 500, data: [] };
881
1271
  }
882
- }, Zt = async ({
1272
+ }, Yr = async ({
883
1273
  idToken: e,
884
1274
  accessToken: t,
885
1275
  refreshToken: r,
886
- clientId: a
1276
+ clientId: o
887
1277
  }) => {
888
1278
  try {
889
1279
  return {
890
- status: (await Z({
891
- type: z.LOGOUT,
892
- clientId: a,
1280
+ status: (await de({
1281
+ type: ce.LOGOUT,
1282
+ clientId: o,
893
1283
  params: {
894
1284
  idToken: e,
895
1285
  accessToken: t,
@@ -902,35 +1292,35 @@ const M = "Oops! It looks like your session has expired. For your security, plea
902
1292
  status: !1
903
1293
  };
904
1294
  }
905
- }, be = async ({
1295
+ }, Fe = async ({
906
1296
  username: e,
907
1297
  password: t,
908
1298
  clientId: r,
909
- nonce: a,
1299
+ nonce: o,
910
1300
  type: n,
911
1301
  sessionExpiration: s,
912
- code: o,
913
- code_verifier: i
1302
+ code: a,
1303
+ code_verifier: c
914
1304
  }) => {
915
1305
  try {
916
- const c = await Z({
917
- type: z.AUTHENTICATE,
1306
+ const l = await de({
1307
+ type: ce.AUTHENTICATE,
918
1308
  clientId: r,
919
1309
  params: {
920
- type: n || q.ID_AND_ACCESS_TOKEN,
1310
+ type: n || ie.ID_AND_ACCESS_TOKEN,
921
1311
  username: e,
922
1312
  password: t,
923
1313
  sessionExpiration: s,
924
- nonce: a,
925
- code: o,
926
- code_verifier: i
1314
+ nonce: o,
1315
+ code: a,
1316
+ code_verifier: c
927
1317
  }
928
- }), d = await H(c.data.idToken);
929
- return d && d.payload[y.USER_ID_KEY] !== "" && d.payload[y.NONCE_KEY] === a ? {
930
- idToken: c.data.idToken,
931
- accessToken: c.data.accessToken,
932
- refreshToken: c.data.refreshToken,
933
- userId: d.payload[y.USER_ID_KEY],
1318
+ }), d = await Y(l.data.idToken);
1319
+ return d && d.payload[k.USER_ID_KEY] !== "" && d.payload[k.NONCE_KEY] === o ? {
1320
+ idToken: l.data.idToken,
1321
+ accessToken: l.data.accessToken,
1322
+ refreshToken: l.data.refreshToken,
1323
+ userId: d.payload[k.USER_ID_KEY],
934
1324
  status: !0
935
1325
  } : {
936
1326
  status: !1
@@ -940,24 +1330,24 @@ const M = "Oops! It looks like your session has expired. For your security, plea
940
1330
  status: !1
941
1331
  };
942
1332
  }
943
- }, er = async ({
1333
+ }, Fr = async ({
944
1334
  nonce: e,
945
1335
  clientId: t,
946
1336
  code_challenge: r
947
1337
  }) => {
948
1338
  try {
949
- const a = await Z({
950
- type: z.CODE,
1339
+ const o = await de({
1340
+ type: ce.CODE,
951
1341
  clientId: t,
952
1342
  params: {
953
- type: q.CODE,
1343
+ type: ie.CODE,
954
1344
  nonce: e,
955
1345
  code_challenge: r
956
1346
  }
957
1347
  });
958
- return a.data.code ? {
1348
+ return o.data.code ? {
959
1349
  status: !0,
960
- code: a.data.code
1350
+ code: o.data.code
961
1351
  } : {
962
1352
  status: !1
963
1353
  };
@@ -966,29 +1356,29 @@ const M = "Oops! It looks like your session has expired. For your security, plea
966
1356
  status: !1
967
1357
  };
968
1358
  }
969
- }, tr = async ({
1359
+ }, Vr = async ({
970
1360
  clientId: e,
971
1361
  userId: t,
972
1362
  nonce: r,
973
- refreshToken: a,
1363
+ refreshToken: o,
974
1364
  accessToken: n
975
1365
  }) => {
976
1366
  try {
977
- const s = await Z({
978
- type: z.AUTHENTICATE,
1367
+ const s = await de({
1368
+ type: ce.AUTHENTICATE,
979
1369
  clientId: e,
980
1370
  params: {
981
- type: q.REFRESH_TOKEN,
1371
+ type: ie.REFRESH_TOKEN,
982
1372
  userId: t,
983
1373
  nonce: r,
984
- refreshToken: a,
1374
+ refreshToken: o,
985
1375
  accessToken: n
986
1376
  }
987
- }), o = await H(s.data.accessToken);
988
- return o && o.payload[y.USER_ID_KEY] !== "" && o.payload[y.NONCE_KEY] === r ? {
1377
+ }), a = await Y(s.data.accessToken);
1378
+ return a && a.payload[k.USER_ID_KEY] !== "" && a.payload[k.NONCE_KEY] === r ? {
989
1379
  accessToken: s.data.accessToken,
990
1380
  refreshToken: s.data.refreshToken,
991
- userId: o.payload[y.USER_ID_KEY],
1381
+ userId: a.payload[k.USER_ID_KEY],
992
1382
  status: !0
993
1383
  } : {
994
1384
  status: !1
@@ -999,22 +1389,22 @@ const M = "Oops! It looks like your session has expired. For your security, plea
999
1389
  };
1000
1390
  }
1001
1391
  };
1002
- class rr {
1392
+ class zr {
1003
1393
  constructor(t = null, r = null) {
1004
- L(this, "refreshTokenPromise", null);
1005
- L(this, "accessToken");
1006
- L(this, "refreshToken");
1394
+ B(this, "refreshTokenPromise", null);
1395
+ B(this, "accessToken");
1396
+ B(this, "refreshToken");
1007
1397
  this.accessToken = t || "", this.refreshToken = r || "";
1008
1398
  }
1009
1399
  async refreshtoken({
1010
1400
  clientId: t,
1011
1401
  userId: r,
1012
- nonce: a
1402
+ nonce: o
1013
1403
  }) {
1014
1404
  this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
1015
1405
  clientId: t,
1016
1406
  userId: r,
1017
- nonce: a
1407
+ nonce: o
1018
1408
  }));
1019
1409
  try {
1020
1410
  return await this.refreshTokenPromise;
@@ -1025,14 +1415,14 @@ class rr {
1025
1415
  async _refreshToken({
1026
1416
  clientId: t,
1027
1417
  userId: r,
1028
- nonce: a
1418
+ nonce: o
1029
1419
  }) {
1030
- const n = await H(this.refreshToken);
1031
- if (n && n.payload[y.USER_ID_KEY] !== "") {
1032
- const s = await tr({
1420
+ const n = await Y(this.refreshToken);
1421
+ if (n && n.payload[k.USER_ID_KEY] !== "") {
1422
+ const s = await Vr({
1033
1423
  clientId: t,
1034
1424
  userId: r,
1035
- nonce: a,
1425
+ nonce: o,
1036
1426
  refreshToken: this.refreshToken,
1037
1427
  accessToken: this.accessToken
1038
1428
  });
@@ -1049,170 +1439,191 @@ class rr {
1049
1439
  };
1050
1440
  }
1051
1441
  }
1052
- const Y = () => {
1053
- throw new Error(zt);
1054
- }, Ne = Be({
1442
+ const oe = () => {
1443
+ throw new Error(jr);
1444
+ }, st = vt({
1055
1445
  isAuthenticated: !1,
1056
1446
  isLoading: !1,
1057
- login: Y,
1058
- logout: Y,
1059
- getAccessToken: Y,
1060
- getIdToken: Y,
1447
+ login: oe,
1448
+ logout: oe,
1449
+ getAccessToken: oe,
1450
+ getIdToken: oe,
1061
1451
  logoutReason: ""
1062
- }), cr = ({
1452
+ }), Zr = ({
1063
1453
  children: e,
1064
1454
  sessionExpiration: t,
1065
- clientId: r
1455
+ clientId: r,
1456
+ domain: o
1066
1457
  }) => {
1067
- const a = Fe(!1), [n, s, , o] = x({
1068
- key: `${V}::${r}::@@user@@`
1069
- }), [i, c, , d] = x({
1070
- key: `${V}::${r}::@@access@@`
1071
- }), [m, p, , A] = x(
1458
+ const n = _t(!1), [, s, a] = Nr([`auth.${r}`]), [c, l, , d] = Q({
1459
+ key: `${re}::${r}::@@user@@`
1460
+ }), [p, m, , T] = Q({
1461
+ key: `${re}::${r}::@@access@@`
1462
+ }), [E, S, , P] = Q(
1072
1463
  {
1073
- key: `${V}::${r}::@@refresh@@`
1464
+ key: `${re}::${r}::@@refresh@@`
1074
1465
  }
1075
- ), [w, E, , K] = x({
1076
- key: `${V}::${r}::@@nonce@@`
1077
- }), Le = new rr(i, m), [P, v] = Ge({
1466
+ ), [j, W, , M] = Q({
1467
+ key: `${re}::${r}::@@nonce@@`
1468
+ }), g = new zr(p, E), [w, i] = ze({
1078
1469
  isLoading: !0,
1079
1470
  isAuthenticated: !1,
1080
1471
  user: void 0,
1081
1472
  logoutReason: ""
1082
- }), N = de(
1083
- (u) => {
1084
- console.warn(u), v({
1473
+ }), C = Re(
1474
+ (y) => {
1475
+ console.warn(y), i({
1085
1476
  isLoading: !0,
1086
1477
  isAuthenticated: !1,
1087
1478
  user: void 0,
1088
- logoutReason: u || M
1089
- }), o(), d(), A(), K();
1479
+ logoutReason: y || te
1480
+ }), d(), T(), P(), M(), o && a(`auth.${r}`, {
1481
+ secure: !0,
1482
+ domain: o
1483
+ });
1090
1484
  },
1091
- [o, d, K, A]
1092
- ), R = de(
1093
- async (u) => {
1094
- N(u || M), await Zt({
1095
- idToken: n,
1096
- accessToken: i,
1097
- refreshToken: m,
1485
+ [
1486
+ r,
1487
+ o,
1488
+ T,
1489
+ a,
1490
+ d,
1491
+ M,
1492
+ P
1493
+ ]
1494
+ ), I = Re(
1495
+ async (y) => {
1496
+ C(y || te), await Yr({
1497
+ idToken: c,
1498
+ accessToken: p,
1499
+ refreshToken: E,
1098
1500
  clientId: r
1099
- }), v((k) => ({
1100
- ...k,
1501
+ }), i((R) => ({
1502
+ ...R,
1101
1503
  isLoading: !1
1102
1504
  }));
1103
1505
  },
1104
- [i, r, n, N, m]
1506
+ [p, r, c, C, E]
1105
1507
  );
1106
- qe(() => {
1107
- if (!a.current)
1108
- return P.isLoading && n !== null ? (async () => {
1508
+ Tt(() => {
1509
+ if (!n.current)
1510
+ return w.isLoading && c !== null ? (async () => {
1109
1511
  try {
1110
- const u = await H(n);
1111
- u && u.payload[y.USER_ID_KEY] !== "" ? v({
1512
+ const y = await Y(c);
1513
+ y && y.payload[k.USER_ID_KEY] !== "" ? i({
1112
1514
  isLoading: !1,
1113
1515
  isAuthenticated: !0,
1114
1516
  user: {
1115
- userId: u.payload[y.USER_ID_KEY],
1116
- username: u.payload[y.USERNAME_KEY]
1517
+ userId: y.payload[k.USER_ID_KEY],
1518
+ username: y.payload[k.USERNAME_KEY]
1117
1519
  },
1118
1520
  logoutReason: ""
1119
- }) : await R(M);
1521
+ }) : await I(te);
1120
1522
  } catch {
1121
- await R(M);
1523
+ await I(te);
1122
1524
  }
1123
- })() : v((u) => ({
1124
- ...u,
1525
+ })() : i((y) => ({
1526
+ ...y,
1125
1527
  isLoading: !1
1126
1528
  })), () => {
1127
- a.current = !0;
1529
+ n.current = !0;
1128
1530
  };
1129
- }, [P.isLoading, n, R]);
1130
- const $e = async (u, k, S) => {
1131
- const I = Gt();
1132
- if (E(I), v((ee) => ({
1133
- ...ee,
1531
+ }, [w.isLoading, c, I]);
1532
+ const fe = async (y, R, b) => {
1533
+ const D = Mr();
1534
+ if (W(D), i((J) => ({
1535
+ ...J,
1134
1536
  isLoading: !0
1135
- })), S === q.CODE) {
1136
- const { code_verifier: ee, code_challenge: je } = await xt(), ue = await er({
1137
- nonce: I,
1537
+ })), d(), T(), P(), b === ie.CODE) {
1538
+ const { code_verifier: J, code_challenge: F } = await yr(), V = await Fr({
1539
+ nonce: D,
1138
1540
  clientId: r,
1139
- code_challenge: je
1541
+ code_challenge: F
1140
1542
  });
1141
- if (ue.status) {
1142
- const D = await be({
1143
- username: u,
1144
- password: k,
1543
+ if (V.status) {
1544
+ const N = await Fe({
1545
+ username: y,
1546
+ password: R,
1145
1547
  clientId: r,
1146
1548
  sessionExpiration: t,
1147
- nonce: I,
1148
- type: S,
1149
- code: ue.code,
1150
- code_verifier: ee
1549
+ nonce: D,
1550
+ type: b,
1551
+ code: V.code,
1552
+ code_verifier: J
1151
1553
  });
1152
- return D.status ? (s(D.idToken), c(D.accessToken), p(D.refreshToken), v({
1554
+ return N.status ? (o && s(`auth.${r}`, N.accessToken, {
1555
+ secure: !0,
1556
+ domain: o
1557
+ }), l(N.idToken), m(N.accessToken), S(N.refreshToken), i({
1153
1558
  isLoading: !1,
1154
1559
  isAuthenticated: !0,
1155
1560
  user: {
1156
- userId: D.userId,
1157
- username: u
1561
+ userId: N.userId,
1562
+ username: y
1158
1563
  },
1159
1564
  logoutReason: ""
1160
- }), !0) : (N(Te), !1);
1565
+ }), !0) : (C(Je), !1);
1161
1566
  }
1162
1567
  return !1;
1163
1568
  }
1164
- const O = await be({
1165
- username: u,
1166
- password: k,
1569
+ const U = await Fe({
1570
+ username: y,
1571
+ password: R,
1167
1572
  clientId: r,
1168
1573
  sessionExpiration: t,
1169
- nonce: I,
1170
- type: S
1574
+ nonce: D,
1575
+ type: b
1171
1576
  });
1172
- return O.status ? (s(O.idToken), c(O.accessToken), p(O.refreshToken), v({
1577
+ return U.status ? (o && s(`auth.${r}`, U.accessToken, {
1578
+ secure: !0,
1579
+ domain: o
1580
+ }), l(U.idToken), m(U.accessToken), S(U.refreshToken), i({
1173
1581
  isLoading: !1,
1174
1582
  isAuthenticated: !0,
1175
1583
  user: {
1176
- userId: O.userId,
1177
- username: u
1584
+ userId: U.userId,
1585
+ username: y
1178
1586
  }
1179
- }), !0) : (N(Te), !1);
1180
- }, We = async (u) => {
1181
- u == null || u.preventDefault(), await R(qt);
1182
- }, Je = async () => {
1183
- const { isAuthenticated: u, user: k } = P;
1587
+ }), !0) : (C(Je), !1);
1588
+ }, he = async (y) => {
1589
+ y == null || y.preventDefault(), await I(Kr);
1590
+ }, pe = async () => {
1591
+ const { isAuthenticated: y, user: R } = w;
1184
1592
  try {
1185
- if (u && k && k.userId) {
1186
- if (i) {
1187
- const I = await H(i);
1188
- if (I && I.payload[y.USER_ID_KEY] !== "")
1189
- return i;
1593
+ if (y && R && R.userId) {
1594
+ if (p) {
1595
+ const D = await Y(p);
1596
+ if (D && D.payload[k.USER_ID_KEY] !== "")
1597
+ return p;
1190
1598
  }
1191
- const S = await Le.refreshtoken({
1599
+ const b = await g.refreshtoken({
1192
1600
  clientId: r,
1193
- userId: k.userId,
1194
- nonce: w
1601
+ userId: R.userId,
1602
+ nonce: j
1195
1603
  });
1196
- return S.status && S.status === "success" ? (c(S.newAccessToken), p(S.newRefreshToken), S.newAccessToken) : (await R(oe), "");
1604
+ return b.status && b.status === "success" ? (o && s(`auth.${r}`, b.newAccessToken, {
1605
+ secure: !0,
1606
+ domain: o
1607
+ }), m(b.newAccessToken), S(b.newRefreshToken), b.newAccessToken) : (await I(Te), "");
1197
1608
  }
1198
- return await R(oe), "";
1609
+ return await I(Te), "";
1199
1610
  } catch {
1200
- return await R(oe), "";
1611
+ return await I(Te), "";
1201
1612
  }
1202
- }, xe = () => {
1203
- if (P.isAuthenticated && n)
1204
- return n;
1613
+ }, ye = () => {
1614
+ if (w.isAuthenticated && c)
1615
+ return c;
1205
1616
  };
1206
- return /* @__PURE__ */ Ye(
1207
- Ne.Provider,
1617
+ return /* @__PURE__ */ gt(
1618
+ st.Provider,
1208
1619
  {
1209
- value: { ...P, login: $e, logout: We, getAccessToken: Je, getIdToken: xe },
1620
+ value: { ...w, login: fe, logout: he, getAccessToken: pe, getIdToken: ye },
1210
1621
  children: e
1211
1622
  }
1212
1623
  );
1213
- }, ur = (e = Ne) => ze(e);
1624
+ }, eo = (e = st) => Ve(e);
1214
1625
  export {
1215
- q as AUTH_TYPES,
1216
- cr as AuthProvider,
1217
- ur as useAuth
1626
+ ie as AUTH_TYPES,
1627
+ Zr as AuthProvider,
1628
+ eo as useAuth
1218
1629
  };