zudoku 0.3.0-dev.70 → 0.3.0-dev.72

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 (78) hide show
  1. package/dist/app/main.js +6 -2
  2. package/dist/app/main.js.map +1 -1
  3. package/dist/lib/authentication/authentication.d.ts +6 -2
  4. package/dist/lib/authentication/components/SignIn.js +6 -2
  5. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  6. package/dist/lib/authentication/components/SignOut.js +4 -2
  7. package/dist/lib/authentication/components/SignOut.js.map +1 -1
  8. package/dist/lib/authentication/providers/auth0.js +2 -2
  9. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  10. package/dist/lib/authentication/providers/openid.d.ts +14 -8
  11. package/dist/lib/authentication/providers/openid.js +40 -39
  12. package/dist/lib/authentication/providers/openid.js.map +1 -1
  13. package/dist/lib/authentication/state.js +1 -1
  14. package/dist/lib/authentication/state.js.map +1 -1
  15. package/dist/lib/components/DevPortal.js +3 -6
  16. package/dist/lib/components/DevPortal.js.map +1 -1
  17. package/dist/lib/components/Header.js +7 -3
  18. package/dist/lib/components/Header.js.map +1 -1
  19. package/dist/lib/core/DevPortalContext.js +1 -0
  20. package/dist/lib/core/DevPortalContext.js.map +1 -1
  21. package/lib/{AnchorLink-C_pYhuZi.js → AnchorLink-DwUyvkrL.js} +3 -3
  22. package/lib/{AnchorLink-C_pYhuZi.js.map → AnchorLink-DwUyvkrL.js.map} +1 -1
  23. package/lib/AuthenticationPlugin-BuCQtecV.js +55 -0
  24. package/lib/AuthenticationPlugin-BuCQtecV.js.map +1 -0
  25. package/lib/{CategoryHeading-D5Q-X6lE.js → CategoryHeading-8saHYD9L.js} +3 -3
  26. package/lib/{CategoryHeading-D5Q-X6lE.js.map → CategoryHeading-8saHYD9L.js.map} +1 -1
  27. package/lib/{Combination-Cq0UkOXq.js → Combination-BMJg4xHo.js} +4 -4
  28. package/lib/{Combination-Cq0UkOXq.js.map → Combination-BMJg4xHo.js.map} +1 -1
  29. package/lib/{DevPortalProvider-BBhQ8kgI.js → DevPortalProvider-DMrk4yw1.js} +2 -2
  30. package/lib/{DevPortalProvider-BBhQ8kgI.js.map → DevPortalProvider-DMrk4yw1.js.map} +1 -1
  31. package/lib/{Input-DdAxw3vC.js → Input-98JuH9ox.js} +5 -5
  32. package/lib/{Input-DdAxw3vC.js.map → Input-98JuH9ox.js.map} +1 -1
  33. package/lib/{Markdown-DsCvZnhw.js → Markdown-CSdXDuYx.js} +2914 -3825
  34. package/lib/Markdown-CSdXDuYx.js.map +1 -0
  35. package/lib/{MdxPage-B_7x36CA.js → MdxPage-7CszsIct.js} +13 -12
  36. package/lib/{MdxPage-B_7x36CA.js.map → MdxPage-7CszsIct.js.map} +1 -1
  37. package/lib/{OperationList-i6FGZUu4.js → OperationList-CzXPfUMy.js} +29 -28
  38. package/lib/{OperationList-i6FGZUu4.js.map → OperationList-CzXPfUMy.js.map} +1 -1
  39. package/lib/{Route-Bsrd0acQ.js → Route-CueiECQ0.js} +2 -2
  40. package/lib/{Route-Bsrd0acQ.js.map → Route-CueiECQ0.js.map} +1 -1
  41. package/lib/{SlotletProvider-CpNYmq6S.js → SlotletProvider-ibdqvOie.js} +22 -21
  42. package/lib/{SlotletProvider-CpNYmq6S.js.map → SlotletProvider-ibdqvOie.js.map} +1 -1
  43. package/lib/{Spinner-BBPlEab_.js → Spinner-D0EmkS4m.js} +4 -4
  44. package/lib/{Spinner-BBPlEab_.js.map → Spinner-D0EmkS4m.js.map} +1 -1
  45. package/lib/index-CjHZiWvQ.js +916 -0
  46. package/lib/index-CjHZiWvQ.js.map +1 -0
  47. package/lib/{index-DT-cf5tv.js → index-D_ZoO3pi.js} +18 -17
  48. package/lib/{index-DT-cf5tv.js.map → index-D_ZoO3pi.js.map} +1 -1
  49. package/lib/{jsx-runtime-BIr0WBt_.js → jsx-runtime-D0NHp7nI.js} +3 -3
  50. package/lib/{jsx-runtime-BIr0WBt_.js.map → jsx-runtime-D0NHp7nI.js.map} +1 -1
  51. package/lib/{state-DKdaQzvh.js → state-DsXXkBLH.js} +2 -2
  52. package/lib/{state-DKdaQzvh.js.map → state-DsXXkBLH.js.map} +1 -1
  53. package/lib/zudoku.auth-auth0.js +26 -20
  54. package/lib/zudoku.auth-auth0.js.map +1 -1
  55. package/lib/zudoku.auth-clerk.js +2 -2
  56. package/lib/zudoku.auth-openid.js +211 -200
  57. package/lib/zudoku.auth-openid.js.map +1 -1
  58. package/lib/zudoku.components.js +473 -467
  59. package/lib/zudoku.components.js.map +1 -1
  60. package/lib/zudoku.plugin-api-keys.js +17 -16
  61. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  62. package/lib/zudoku.plugin-custom-page.js +2 -2
  63. package/lib/zudoku.plugin-markdown.js +3 -3
  64. package/lib/zudoku.plugin-openapi.js +3 -3
  65. package/package.json +1 -1
  66. package/src/app/main.tsx +6 -8
  67. package/src/lib/authentication/authentication.ts +2 -2
  68. package/src/lib/authentication/components/SignIn.tsx +6 -2
  69. package/src/lib/authentication/components/SignOut.tsx +4 -2
  70. package/src/lib/authentication/providers/auth0.tsx +2 -2
  71. package/src/lib/authentication/providers/openid.tsx +53 -43
  72. package/src/lib/authentication/state.ts +1 -1
  73. package/src/lib/components/DevPortal.tsx +5 -7
  74. package/src/lib/components/Header.tsx +11 -3
  75. package/src/lib/core/DevPortalContext.ts +2 -0
  76. package/lib/AuthenticationPlugin-RvXALgvS.js +0 -52
  77. package/lib/AuthenticationPlugin-RvXALgvS.js.map +0 -1
  78. package/lib/Markdown-DsCvZnhw.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  var Re = Object.defineProperty;
2
2
  var Pe = (t, e, n) => e in t ? Re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var y = (t, e, n) => Pe(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { b as xe, j as A } from "./jsx-runtime-BIr0WBt_.js";
3
+ var m = (t, e, n) => Pe(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { b as xe, j as E } from "./jsx-runtime-D0NHp7nI.js";
5
5
  import { c as Ue, a as Le } from "./_commonjsHelpers-BVfed4GL.js";
6
- import { A as Ce } from "./AuthenticationPlugin-RvXALgvS.js";
6
+ import { A as Ce } from "./AuthenticationPlugin-BuCQtecV.js";
7
7
  import { useRef as je, useState as Ie, useEffect as ze } from "react";
8
- import { u as re } from "./state-DKdaQzvh.js";
8
+ import { u as oe } from "./state-DsXXkBLH.js";
9
9
  var he = { exports: {} };
10
10
  (function(t) {
11
11
  (function(e, n) {
@@ -19,8 +19,8 @@ var he = { exports: {} };
19
19
  "warn",
20
20
  "error"
21
21
  ], o = {}, i = null;
22
- function u(l, f) {
23
- var c = l[f];
22
+ function u(l, p) {
23
+ var c = l[p];
24
24
  if (typeof c.bind == "function")
25
25
  return c.bind(l);
26
26
  try {
@@ -31,16 +31,16 @@ var he = { exports: {} };
31
31
  };
32
32
  }
33
33
  }
34
- function g() {
34
+ function f() {
35
35
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
36
36
  }
37
- function m(l) {
38
- return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && r ? g : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
37
+ function y(l) {
38
+ return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && r ? f : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
39
39
  }
40
40
  function b() {
41
- for (var l = this.getLevel(), f = 0; f < s.length; f++) {
42
- var c = s[f];
43
- this[c] = f < l ? e : this.methodFactory(c, l, this.name);
41
+ for (var l = this.getLevel(), p = 0; p < s.length; p++) {
42
+ var c = s[p];
43
+ this[c] = p < l ? e : this.methodFactory(c, l, this.name);
44
44
  }
45
45
  if (this.log = this.debug, typeof console === n && l < this.levels.SILENT)
46
46
  return "No console available for logging";
@@ -50,27 +50,27 @@ var he = { exports: {} };
50
50
  typeof console !== n && (b.call(this), this[l].apply(this, arguments));
51
51
  };
52
52
  }
53
- function h(l, f, c) {
54
- return m(l) || _.apply(this, arguments);
53
+ function h(l, p, c) {
54
+ return y(l) || _.apply(this, arguments);
55
55
  }
56
- function U(l, f) {
56
+ function U(l, p) {
57
57
  var c = this, z, $, P, v = "loglevel";
58
58
  typeof l == "string" ? v += ":" + l : typeof l == "symbol" && (v = void 0);
59
59
  function Te(d) {
60
- var p = (s[d] || "silent").toUpperCase();
60
+ var w = (s[d] || "silent").toUpperCase();
61
61
  if (!(typeof window === n || !v)) {
62
62
  try {
63
- window.localStorage[v] = p;
63
+ window.localStorage[v] = w;
64
64
  return;
65
65
  } catch {
66
66
  }
67
67
  try {
68
- window.document.cookie = encodeURIComponent(v) + "=" + p + ";";
68
+ window.document.cookie = encodeURIComponent(v) + "=" + w + ";";
69
69
  } catch {
70
70
  }
71
71
  }
72
72
  }
73
- function ee() {
73
+ function te() {
74
74
  var d;
75
75
  if (!(typeof window === n || !v)) {
76
76
  try {
@@ -79,16 +79,16 @@ var he = { exports: {} };
79
79
  }
80
80
  if (typeof d === n)
81
81
  try {
82
- var p = window.document.cookie, J = encodeURIComponent(v), ne = p.indexOf(J + "=");
83
- ne !== -1 && (d = /^([^;]+)/.exec(
84
- p.slice(ne + J.length + 1)
82
+ var w = window.document.cookie, J = encodeURIComponent(v), re = w.indexOf(J + "=");
83
+ re !== -1 && (d = /^([^;]+)/.exec(
84
+ w.slice(re + J.length + 1)
85
85
  )[1]);
86
86
  } catch {
87
87
  }
88
88
  return c.levels[d] === void 0 && (d = void 0), d;
89
89
  }
90
90
  }
91
- function Ae() {
91
+ function Ee() {
92
92
  if (!(typeof window === n || !v)) {
93
93
  try {
94
94
  window.localStorage.removeItem(v);
@@ -101,9 +101,9 @@ var he = { exports: {} };
101
101
  }
102
102
  }
103
103
  function L(d) {
104
- var p = d;
105
- if (typeof p == "string" && c.levels[p.toUpperCase()] !== void 0 && (p = c.levels[p.toUpperCase()]), typeof p == "number" && p >= 0 && p <= c.levels.SILENT)
106
- return p;
104
+ var w = d;
105
+ if (typeof w == "string" && c.levels[w.toUpperCase()] !== void 0 && (w = c.levels[w.toUpperCase()]), typeof w == "number" && w >= 0 && w <= c.levels.SILENT)
106
+ return w;
107
107
  throw new TypeError("log.setLevel() called with invalid level: " + d);
108
108
  }
109
109
  c.name = l, c.levels = {
@@ -113,14 +113,14 @@ var he = { exports: {} };
113
113
  WARN: 3,
114
114
  ERROR: 4,
115
115
  SILENT: 5
116
- }, c.methodFactory = f || h, c.getLevel = function() {
116
+ }, c.methodFactory = p || h, c.getLevel = function() {
117
117
  return P ?? $ ?? z;
118
- }, c.setLevel = function(d, p) {
119
- return P = L(d), p !== !1 && Te(P), b.call(c);
118
+ }, c.setLevel = function(d, w) {
119
+ return P = L(d), w !== !1 && Te(P), b.call(c);
120
120
  }, c.setDefaultLevel = function(d) {
121
- $ = L(d), ee() || c.setLevel(d, !1);
121
+ $ = L(d), te() || c.setLevel(d, !1);
122
122
  }, c.resetLevel = function() {
123
- P = null, Ae(), b.call(c);
123
+ P = null, Ee(), b.call(c);
124
124
  }, c.enableAll = function(d) {
125
125
  c.setLevel(c.levels.TRACE, d);
126
126
  }, c.disableAll = function(d) {
@@ -132,15 +132,15 @@ var he = { exports: {} };
132
132
  }, z = L(
133
133
  i ? i.getLevel() : "WARN"
134
134
  );
135
- var te = ee();
136
- te != null && (P = L(te)), b.call(c);
135
+ var ne = te();
136
+ ne != null && (P = L(ne)), b.call(c);
137
137
  }
138
- i = new U(), i.getLogger = function(f) {
139
- if (typeof f != "symbol" && typeof f != "string" || f === "")
138
+ i = new U(), i.getLogger = function(p) {
139
+ if (typeof p != "symbol" && typeof p != "string" || p === "")
140
140
  throw new TypeError("You must supply a name when creating a logger.");
141
- var c = o[f];
142
- return c || (c = o[f] = new U(
143
- f,
141
+ var c = o[p];
142
+ return c || (c = o[p] = new U(
143
+ p,
144
144
  i.methodFactory
145
145
  )), c;
146
146
  };
@@ -153,11 +153,11 @@ var he = { exports: {} };
153
153
  });
154
154
  })(he);
155
155
  var Je = he.exports;
156
- const oe = /* @__PURE__ */ Le(Je);
157
- let M;
156
+ const ie = /* @__PURE__ */ Le(Je);
157
+ let B;
158
158
  var O, de;
159
- (typeof navigator > "u" || !((de = (O = navigator.userAgent) == null ? void 0 : O.startsWith) != null && de.call(O, "Mozilla/5.0 "))) && (M = "oauth4webapi/v2.11.1");
160
- function q(t, e) {
159
+ (typeof navigator > "u" || !((de = (O = navigator.userAgent) == null ? void 0 : O.startsWith) != null && de.call(O, "Mozilla/5.0 "))) && (B = "oauth4webapi/v2.11.1");
160
+ function V(t, e) {
161
161
  if (t == null)
162
162
  return !1;
163
163
  try {
@@ -166,16 +166,16 @@ function q(t, e) {
166
166
  return !1;
167
167
  }
168
168
  }
169
- const K = Symbol(), Oe = Symbol(), V = Symbol(), Ne = new TextEncoder(), Ke = new TextDecoder();
170
- function E(t) {
169
+ const K = Symbol(), Oe = Symbol(), Y = Symbol(), Ne = new TextEncoder(), Ke = new TextDecoder();
170
+ function A(t) {
171
171
  return typeof t == "string" ? Ne.encode(t) : Ke.decode(t);
172
172
  }
173
- const ie = 32768;
173
+ const se = 32768;
174
174
  function We(t) {
175
175
  t instanceof ArrayBuffer && (t = new Uint8Array(t));
176
176
  const e = [];
177
- for (let n = 0; n < t.byteLength; n += ie)
178
- e.push(String.fromCharCode.apply(null, t.subarray(n, n + ie)));
177
+ for (let n = 0; n < t.byteLength; n += se)
178
+ e.push(String.fromCharCode.apply(null, t.subarray(n, n + se)));
179
179
  return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
180
180
  }
181
181
  function De(t) {
@@ -237,7 +237,7 @@ function we(t) {
237
237
  function Fe(t) {
238
238
  return pe(t) && t.type === "public";
239
239
  }
240
- function Y(t) {
240
+ function Z(t) {
241
241
  try {
242
242
  const e = t.headers.get("dpop-nonce");
243
243
  e && fe.set(new URL(t.url).origin, e);
@@ -249,15 +249,15 @@ function C(t) {
249
249
  return !(t === null || typeof t != "object" || Array.isArray(t));
250
250
  }
251
251
  function W(t) {
252
- q(t, Headers) && (t = Object.fromEntries(t.entries()));
252
+ V(t, Headers) && (t = Object.fromEntries(t.entries()));
253
253
  const e = new Headers(t);
254
- if (M && !e.has("user-agent") && e.set("user-agent", M), e.has("authorization"))
254
+ if (B && !e.has("user-agent") && e.set("user-agent", B), e.has("authorization"))
255
255
  throw new TypeError('"options.headers" must not include the "authorization" header name');
256
256
  if (e.has("dpop"))
257
257
  throw new TypeError('"options.headers" must not include the "dpop" header name');
258
258
  return e;
259
259
  }
260
- function Z(t) {
260
+ function Q(t) {
261
261
  if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
262
262
  throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
263
263
  return t;
@@ -280,24 +280,24 @@ async function Me(t, e) {
280
280
  throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
281
281
  }
282
282
  const r = W(e == null ? void 0 : e.headers);
283
- return r.set("accept", "application/json"), ((e == null ? void 0 : e[V]) || fetch)(n.href, {
283
+ return r.set("accept", "application/json"), ((e == null ? void 0 : e[Y]) || fetch)(n.href, {
284
284
  headers: Object.fromEntries(r.entries()),
285
285
  method: "GET",
286
286
  redirect: "manual",
287
- signal: e != null && e.signal ? Z(e.signal) : null
288
- }).then(Y);
287
+ signal: e != null && e.signal ? Q(e.signal) : null
288
+ }).then(Z);
289
289
  }
290
- function w(t) {
290
+ function g(t) {
291
291
  return typeof t == "string" && t.length !== 0;
292
292
  }
293
293
  async function Be(t, e) {
294
294
  if (!(t instanceof URL))
295
295
  throw new TypeError('"expectedIssuer" must be an instance of URL');
296
- if (!q(e, Response))
296
+ if (!V(e, Response))
297
297
  throw new TypeError('"response" must be an instance of Response');
298
298
  if (e.status !== 200)
299
299
  throw new a('"response" is not a conform Authorization Server Metadata response');
300
- X(e);
300
+ ee(e);
301
301
  let n;
302
302
  try {
303
303
  n = await e.json();
@@ -306,7 +306,7 @@ async function Be(t, e) {
306
306
  }
307
307
  if (!C(n))
308
308
  throw new a('"response" body must be a top level object');
309
- if (!w(n.issuer))
309
+ if (!g(n.issuer))
310
310
  throw new a('"response" body "issuer" property must be a non-empty string');
311
311
  if (new URL(n.issuer).href !== t.href)
312
312
  throw new a('"response" body "issuer" does not match "expectedIssuer"');
@@ -322,24 +322,24 @@ function qe() {
322
322
  return D();
323
323
  }
324
324
  async function Ve(t) {
325
- if (!w(t))
325
+ if (!g(t))
326
326
  throw new TypeError('"codeVerifier" must be a non-empty string');
327
- return T(await crypto.subtle.digest("SHA-256", E(t)));
327
+ return T(await crypto.subtle.digest("SHA-256", A(t)));
328
328
  }
329
329
  function Ye(t) {
330
330
  if (t instanceof CryptoKey)
331
331
  return { key: t };
332
332
  if (!((t == null ? void 0 : t.key) instanceof CryptoKey))
333
333
  return {};
334
- if (t.kid !== void 0 && !w(t.kid))
334
+ if (t.kid !== void 0 && !g(t.kid))
335
335
  throw new TypeError('"kid" must be a non-empty string');
336
336
  return { key: t.key, kid: t.kid };
337
337
  }
338
- function se(t) {
338
+ function ae(t) {
339
339
  return encodeURIComponent(t).replace(/%20/g, "+");
340
340
  }
341
341
  function Ze(t, e) {
342
- const n = se(t), r = se(e);
342
+ const n = ae(t), r = ae(e);
343
343
  return `Basic ${btoa(`${n}:${r}`)}`;
344
344
  }
345
345
  function Qe(t) {
@@ -401,11 +401,11 @@ function tt(t) {
401
401
  const e = t == null ? void 0 : t[Oe];
402
402
  return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
403
403
  }
404
- function Q() {
404
+ function X() {
405
405
  return Math.floor(Date.now() / 1e3);
406
406
  }
407
407
  function nt(t, e) {
408
- const n = Q() + H(e);
408
+ const n = X() + H(e);
409
409
  return {
410
410
  jti: D(),
411
411
  aud: [t.issuer, t.token_endpoint],
@@ -425,19 +425,19 @@ async function rt(t, e, n, r) {
425
425
  function j(t) {
426
426
  if (typeof t != "object" || t === null)
427
427
  throw new TypeError('"as" must be an object');
428
- if (!w(t.issuer))
428
+ if (!g(t.issuer))
429
429
  throw new TypeError('"as.issuer" property must be a non-empty string');
430
430
  return !0;
431
431
  }
432
432
  function I(t) {
433
433
  if (typeof t != "object" || t === null)
434
434
  throw new TypeError('"client" must be an object');
435
- if (!w(t.client_id))
435
+ if (!g(t.client_id))
436
436
  throw new TypeError('"client.client_id" property must be a non-empty string');
437
437
  return !0;
438
438
  }
439
- function ae(t) {
440
- if (!w(t))
439
+ function ce(t) {
440
+ if (!g(t))
441
441
  throw new TypeError('"client.client_secret" property must be a non-empty string');
442
442
  return t;
443
443
  }
@@ -445,7 +445,7 @@ function F(t, e) {
445
445
  if (e !== void 0)
446
446
  throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${t} client authentication method is used.`);
447
447
  }
448
- function ce(t, e) {
448
+ function ue(t, e) {
449
449
  if (e !== void 0)
450
450
  throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
451
451
  }
@@ -453,15 +453,15 @@ async function ot(t, e, n, r, s) {
453
453
  switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
454
454
  case void 0:
455
455
  case "client_secret_basic": {
456
- F("client_secret_basic", s), r.set("authorization", Ze(e.client_id, ae(e.client_secret)));
456
+ F("client_secret_basic", s), r.set("authorization", Ze(e.client_id, ce(e.client_secret)));
457
457
  break;
458
458
  }
459
459
  case "client_secret_post": {
460
- F("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", ae(e.client_secret));
460
+ F("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", ce(e.client_secret));
461
461
  break;
462
462
  }
463
463
  case "private_key_jwt": {
464
- if (ce("private_key_jwt", e.client_secret), s === void 0)
464
+ if (ue("private_key_jwt", e.client_secret), s === void 0)
465
465
  throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
466
466
  const { key: o, kid: i } = Ye(s);
467
467
  if (!we(o))
@@ -472,7 +472,7 @@ async function ot(t, e, n, r, s) {
472
472
  case "tls_client_auth":
473
473
  case "self_signed_tls_client_auth":
474
474
  case "none": {
475
- ce(e.token_endpoint_auth_method, e.client_secret), F(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
475
+ ue(e.token_endpoint_auth_method, e.client_secret), F(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
476
476
  break;
477
477
  }
478
478
  default:
@@ -482,30 +482,30 @@ async function ot(t, e, n, r, s) {
482
482
  async function me(t, e, n) {
483
483
  if (!n.usages.includes("sign"))
484
484
  throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
485
- const r = `${T(E(JSON.stringify(t)))}.${T(E(JSON.stringify(e)))}`, s = T(await crypto.subtle.sign(Se(n), n, E(r)));
485
+ const r = `${T(A(JSON.stringify(t)))}.${T(A(JSON.stringify(e)))}`, s = T(await crypto.subtle.sign(Se(n), n, A(r)));
486
486
  return `${r}.${s}`;
487
487
  }
488
488
  async function it(t, e, n, r, s, o) {
489
- const { privateKey: i, publicKey: u, nonce: g = fe.get(n.origin) } = e;
489
+ const { privateKey: i, publicKey: u, nonce: f = fe.get(n.origin) } = e;
490
490
  if (!we(i))
491
491
  throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
492
492
  if (!Fe(u))
493
493
  throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
494
- if (g !== void 0 && !w(g))
494
+ if (f !== void 0 && !g(f))
495
495
  throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
496
496
  if (!u.extractable)
497
497
  throw new TypeError('"DPoP.publicKey.extractable" must be true');
498
- const m = Q() + s, b = await me({
498
+ const y = X() + s, b = await me({
499
499
  alg: ge(i),
500
500
  typ: "dpop+jwt",
501
501
  jwk: await at(u)
502
502
  }, {
503
- iat: m,
503
+ iat: y,
504
504
  jti: D(),
505
505
  htm: r,
506
- nonce: g,
506
+ nonce: f,
507
507
  htu: `${n.origin}${n.pathname}`,
508
- ath: o ? T(await crypto.subtle.digest("SHA-256", E(o))) : void 0
508
+ ath: o ? T(await crypto.subtle.digest("SHA-256", A(o))) : void 0
509
509
  }, i);
510
510
  t.set("dpop", b);
511
511
  }
@@ -525,22 +525,22 @@ function ct(t, e, n) {
525
525
  function ye(t, e, n) {
526
526
  return ct(t[e], e);
527
527
  }
528
- function B(t) {
528
+ function G(t) {
529
529
  const e = t;
530
530
  return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
531
531
  }
532
532
  async function ut(t, e, n, r, s, o) {
533
- if (!w(t))
533
+ if (!g(t))
534
534
  throw new TypeError('"accessToken" must be a non-empty string');
535
535
  if (!(n instanceof URL))
536
536
  throw new TypeError('"url" must be an instance of URL');
537
- return r = W(r), (o == null ? void 0 : o.DPoP) === void 0 ? r.set("authorization", `Bearer ${t}`) : (await it(r, o.DPoP, n, "GET", H({ [K]: o == null ? void 0 : o[K] }), t), r.set("authorization", `DPoP ${t}`)), ((o == null ? void 0 : o[V]) || fetch)(n.href, {
537
+ return r = W(r), (o == null ? void 0 : o.DPoP) === void 0 ? r.set("authorization", `Bearer ${t}`) : (await it(r, o.DPoP, n, "GET", H({ [K]: o == null ? void 0 : o[K] }), t), r.set("authorization", `DPoP ${t}`)), ((o == null ? void 0 : o[Y]) || fetch)(n.href, {
538
538
  body: s,
539
539
  headers: Object.fromEntries(r.entries()),
540
540
  method: e,
541
541
  redirect: "manual",
542
- signal: o != null && o.signal ? Z(o.signal) : null
543
- }).then(Y);
542
+ signal: o != null && o.signal ? Q(o.signal) : null
543
+ }).then(Z);
544
544
  }
545
545
  async function lt(t, e, n, r) {
546
546
  j(t), I(e);
@@ -551,13 +551,13 @@ async function lt(t, e, n, r) {
551
551
  });
552
552
  }
553
553
  async function dt(t, e, n, r, s, o, i) {
554
- return await ot(t, e, s, o, i == null ? void 0 : i.clientPrivateKey), o.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[V]) || fetch)(r.href, {
554
+ return await ot(t, e, s, o, i == null ? void 0 : i.clientPrivateKey), o.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Y]) || fetch)(r.href, {
555
555
  body: s,
556
556
  headers: Object.fromEntries(o.entries()),
557
557
  method: n,
558
558
  redirect: "manual",
559
- signal: i != null && i.signal ? Z(i.signal) : null
560
- }).then(Y);
559
+ signal: i != null && i.signal ? Q(i.signal) : null
560
+ }).then(Z);
561
561
  }
562
562
  async function _e(t, e, n, r, s) {
563
563
  const o = ye(t, "token_endpoint");
@@ -566,14 +566,14 @@ async function _e(t, e, n, r, s) {
566
566
  return i.set("accept", "application/json"), dt(t, e, "POST", o, r, i, s);
567
567
  }
568
568
  async function ht(t, e, n, r) {
569
- if (j(t), I(e), !w(n))
569
+ if (j(t), I(e), !g(n))
570
570
  throw new TypeError('"refreshToken" must be a non-empty string');
571
571
  const s = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
572
572
  return s.set("refresh_token", n), _e(t, e, "refresh_token", s, r);
573
573
  }
574
574
  const ft = /* @__PURE__ */ new WeakMap();
575
575
  async function be(t, e, n, r = !1, s = !1) {
576
- if (j(t), I(e), !q(n, Response))
576
+ if (j(t), I(e), !V(n, Response))
577
577
  throw new TypeError('"response" must be an instance of Response');
578
578
  if (n.status !== 200) {
579
579
  let i;
@@ -581,7 +581,7 @@ async function be(t, e, n, r = !1, s = !1) {
581
581
  return i;
582
582
  throw new a('"response" is not a conform Token Endpoint response');
583
583
  }
584
- X(n);
584
+ ee(n);
585
585
  let o;
586
586
  try {
587
587
  o = await n.json();
@@ -590,23 +590,23 @@ async function be(t, e, n, r = !1, s = !1) {
590
590
  }
591
591
  if (!C(o))
592
592
  throw new a('"response" body must be a top level object');
593
- if (!w(o.access_token))
593
+ if (!g(o.access_token))
594
594
  throw new a('"response" body "access_token" property must be a non-empty string');
595
- if (!w(o.token_type))
595
+ if (!g(o.token_type))
596
596
  throw new a('"response" body "token_type" property must be a non-empty string');
597
597
  if (o.token_type = o.token_type.toLowerCase(), o.token_type !== "dpop" && o.token_type !== "bearer")
598
598
  throw new S("unsupported `token_type` value");
599
599
  if (o.expires_in !== void 0 && (typeof o.expires_in != "number" || o.expires_in <= 0))
600
600
  throw new a('"response" body "expires_in" property must be a positive number');
601
- if (!s && o.refresh_token !== void 0 && !w(o.refresh_token))
601
+ if (!s && o.refresh_token !== void 0 && !g(o.refresh_token))
602
602
  throw new a('"response" body "refresh_token" property must be a non-empty string');
603
603
  if (o.scope !== void 0 && typeof o.scope != "string")
604
604
  throw new a('"response" body "scope" property must be a string');
605
605
  if (!r) {
606
- if (o.id_token !== void 0 && !w(o.id_token))
606
+ if (o.id_token !== void 0 && !g(o.id_token))
607
607
  throw new a('"response" body "id_token" property must be a non-empty string');
608
608
  if (o.id_token) {
609
- const { claims: i } = await Tt(o.id_token, At.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), ke, H(e), tt(e)).then(bt.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(gt.bind(void 0, t.issuer)).then(wt.bind(void 0, e.client_id));
609
+ const { claims: i } = await Tt(o.id_token, Et.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), ke, H(e), tt(e)).then(bt.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(gt.bind(void 0, t.issuer)).then(wt.bind(void 0, e.client_id));
610
610
  if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== e.client_id)
611
611
  throw new a('unexpected ID Token "azp" (authorized party) claim value');
612
612
  if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
@@ -639,9 +639,9 @@ function mt(t) {
639
639
  async function yt(t, e, n, r, s, o) {
640
640
  if (j(t), I(e), !ve.has(n))
641
641
  throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
642
- if (!w(r))
642
+ if (!g(r))
643
643
  throw new TypeError('"redirectUri" must be a non-empty string');
644
- if (!w(s))
644
+ if (!g(s))
645
645
  throw new TypeError('"codeVerifier" must be a non-empty string');
646
646
  const i = k(n, "code");
647
647
  if (!i)
@@ -673,7 +673,7 @@ function bt(t, e) {
673
673
  }
674
674
  async function vt(t, e, n) {
675
675
  const r = await be(t, e, n, !0);
676
- if (B(r))
676
+ if (G(r))
677
677
  return r;
678
678
  if (r.id_token !== void 0) {
679
679
  if (typeof r.id_token == "string" && r.id_token.length)
@@ -682,13 +682,13 @@ async function vt(t, e, n) {
682
682
  }
683
683
  return r;
684
684
  }
685
- function X(t) {
685
+ function ee(t) {
686
686
  if (t.bodyUsed)
687
687
  throw new TypeError('"response" body has been used already');
688
688
  }
689
689
  async function St(t) {
690
690
  if (t.status > 399 && t.status < 500) {
691
- X(t);
691
+ ee(t);
692
692
  try {
693
693
  const e = await t.json();
694
694
  if (C(e) && typeof e.error == "string" && e.error.length)
@@ -697,7 +697,7 @@ async function St(t) {
697
697
  }
698
698
  }
699
699
  }
700
- function ue(t) {
700
+ function le(t) {
701
701
  if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
702
702
  throw new a(`${t.name} modulusLength must be at least 2048 bits`);
703
703
  }
@@ -721,7 +721,7 @@ function Se(t) {
721
721
  hash: kt(t.algorithm.namedCurve)
722
722
  };
723
723
  case "RSA-PSS":
724
- switch (ue(t.algorithm), t.algorithm.hash.name) {
724
+ switch (le(t.algorithm), t.algorithm.hash.name) {
725
725
  case "SHA-256":
726
726
  case "SHA-384":
727
727
  case "SHA-512":
@@ -733,7 +733,7 @@ function Se(t) {
733
733
  throw new S();
734
734
  }
735
735
  case "RSASSA-PKCS1-v1_5":
736
- return ue(t.algorithm), t.algorithm.name;
736
+ return le(t.algorithm), t.algorithm.name;
737
737
  case "Ed448":
738
738
  case "Ed25519":
739
739
  return t.algorithm.name;
@@ -742,38 +742,38 @@ function Se(t) {
742
742
  }
743
743
  const ke = Symbol();
744
744
  async function Tt(t, e, n, r, s) {
745
- const { 0: o, 1: i, 2: u, length: g } = t.split(".");
746
- if (g === 5)
745
+ const { 0: o, 1: i, 2: u, length: f } = t.split(".");
746
+ if (f === 5)
747
747
  throw new S("JWE structure JWTs are not supported");
748
- if (g !== 3)
748
+ if (f !== 3)
749
749
  throw new a("Invalid JWT");
750
- let m;
750
+ let y;
751
751
  try {
752
- m = JSON.parse(E(T(o)));
752
+ y = JSON.parse(A(T(o)));
753
753
  } catch (R) {
754
754
  throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: R });
755
755
  }
756
- if (!C(m))
756
+ if (!C(y))
757
757
  throw new a("JWT Header must be a top level object");
758
- if (e(m), m.crit !== void 0)
758
+ if (e(y), y.crit !== void 0)
759
759
  throw new a('unexpected JWT "crit" header parameter');
760
760
  const b = T(u);
761
761
  let _;
762
762
  if (n !== ke) {
763
- _ = await n(m);
763
+ _ = await n(y);
764
764
  const R = `${o}.${i}`;
765
- if (!await crypto.subtle.verify(Se(_), _, b, E(R)))
765
+ if (!await crypto.subtle.verify(Se(_), _, b, A(R)))
766
766
  throw new a("JWT signature verification failed");
767
767
  }
768
768
  let h;
769
769
  try {
770
- h = JSON.parse(E(T(i)));
770
+ h = JSON.parse(A(T(i)));
771
771
  } catch (R) {
772
772
  throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: R });
773
773
  }
774
774
  if (!C(h))
775
775
  throw new a("JWT Payload must be a top level object");
776
- const U = Q() + r;
776
+ const U = X() + r;
777
777
  if (h.exp !== void 0) {
778
778
  if (typeof h.exp != "number")
779
779
  throw new a('unexpected JWT "exp" (expiration time) claim type');
@@ -792,9 +792,9 @@ async function Tt(t, e, n, r, s) {
792
792
  }
793
793
  if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
794
794
  throw new a('unexpected JWT "aud" (audience) claim type');
795
- return { header: m, claims: h, signature: b, key: _ };
795
+ return { header: y, claims: h, signature: b, key: _ };
796
796
  }
797
- function At(t, e, n) {
797
+ function Et(t, e, n) {
798
798
  if (t !== void 0) {
799
799
  if (n.alg !== t)
800
800
  throw new a('unexpected JWT "alg" header parameter');
@@ -814,7 +814,7 @@ function k(t, e) {
814
814
  throw new a(`"${e}" parameter must be provided only once`);
815
815
  return n;
816
816
  }
817
- const Et = Symbol(), Rt = Symbol();
817
+ const At = Symbol(), Rt = Symbol();
818
818
  function Pt(t, e, n, r) {
819
819
  if (j(t), I(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
820
820
  throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
@@ -831,10 +831,10 @@ function Pt(t, e, n, r) {
831
831
  if (o !== void 0)
832
832
  throw new a('unexpected "state" response parameter encountered');
833
833
  break;
834
- case Et:
834
+ case At:
835
835
  break;
836
836
  default:
837
- if (!w(r))
837
+ if (!g(r))
838
838
  throw new a('"expectedState" must be a non-empty string');
839
839
  if (o === void 0)
840
840
  throw new a('response parameter "state" missing');
@@ -848,14 +848,14 @@ function Pt(t, e, n, r) {
848
848
  error_description: k(n, "error_description"),
849
849
  error_uri: k(n, "error_uri")
850
850
  };
851
- const u = k(n, "id_token"), g = k(n, "token");
852
- if (u !== void 0 || g !== void 0)
851
+ const u = k(n, "id_token"), f = k(n, "token");
852
+ if (u !== void 0 || f !== void 0)
853
853
  throw new S("implicit and hybrid flows are not supported");
854
854
  return mt(new URLSearchParams(n));
855
855
  }
856
856
  class x extends Error {
857
857
  }
858
- class G extends x {
858
+ class q extends x {
859
859
  constructor(e, n, r) {
860
860
  super(e, r), this.error = n;
861
861
  }
@@ -870,32 +870,32 @@ function xt({
870
870
  }).catch((o) => {
871
871
  r(o);
872
872
  }));
873
- }, []), n ? n instanceof G ? /* @__PURE__ */ A.jsxs("div", { children: [
874
- /* @__PURE__ */ A.jsx("h2", { children: "Error" }),
875
- /* @__PURE__ */ A.jsxs("pre", { children: [
873
+ }, []), n ? n instanceof q ? /* @__PURE__ */ E.jsxs("div", { children: [
874
+ /* @__PURE__ */ E.jsx("h2", { children: "Error" }),
875
+ /* @__PURE__ */ E.jsxs("pre", { children: [
876
876
  n.error.error,
877
877
  n.error.error_description,
878
878
  n.error.error_uri
879
879
  ] })
880
- ] }) : /* @__PURE__ */ A.jsxs("div", { children: [
881
- /* @__PURE__ */ A.jsx("h2", { children: "Error" }),
882
- /* @__PURE__ */ A.jsxs("pre", { children: [
880
+ ] }) : /* @__PURE__ */ E.jsxs("div", { children: [
881
+ /* @__PURE__ */ E.jsx("h2", { children: "Error" }),
882
+ /* @__PURE__ */ E.jsxs("pre", { children: [
883
883
  n.message,
884
884
  n.stack
885
885
  ] })
886
- ] }) : /* @__PURE__ */ A.jsx("div", { children: "Loading..." });
886
+ ] }) : /* @__PURE__ */ E.jsx("div", { children: "Loading..." });
887
887
  }
888
- const le = "code-verifier";
888
+ const M = "code-verifier";
889
889
  class Ut extends Ce {
890
- constructor(e, n) {
891
- super(), this.callbackUrlPath = e, this.handleCallback = n;
890
+ constructor(e, n, r) {
891
+ super(), this.callbackUrlPath = e, this.handleCallback = n, this.initialize = r;
892
892
  }
893
893
  getRoutes() {
894
894
  return [
895
895
  ...super.getRoutes(),
896
896
  {
897
897
  path: this.callbackUrlPath,
898
- element: /* @__PURE__ */ A.jsx(xt, { handleCallback: this.handleCallback })
898
+ element: /* @__PURE__ */ E.jsx(xt, { handleCallback: this.handleCallback })
899
899
  }
900
900
  ];
901
901
  }
@@ -903,27 +903,45 @@ class Ut extends Ce {
903
903
  class Lt {
904
904
  constructor({
905
905
  issuer: e,
906
- authorizationEndpoint: n,
907
- tokenEndpoint: r,
908
- clientId: s,
909
- redirectToAfterSignUp: o,
910
- redirectToAfterSignIn: i,
911
- redirectToAfterSignOut: u
906
+ audience: n,
907
+ authorizationEndpoint: r,
908
+ tokenEndpoint: s,
909
+ clientId: o,
910
+ redirectToAfterSignUp: i,
911
+ redirectToAfterSignIn: u,
912
+ redirectToAfterSignOut: f
912
913
  }) {
913
- y(this, "client");
914
- y(this, "issuer");
915
- y(this, "authorizationEndpoint");
916
- y(this, "tokenEndpoint");
917
- y(this, "authorizationServer");
918
- y(this, "tokens");
919
- y(this, "callbackUrlPath", "/oauth/callback");
920
- y(this, "logoutRedirectUrlPath", "/");
921
- y(this, "redirectToAfterSignUp");
922
- y(this, "redirectToAfterSignIn");
923
- y(this, "redirectToAfterSignOut");
924
- y(this, "handleCallback", async () => {
925
- const e = new URL(window.location.href), n = e.searchParams.get("state"), r = localStorage.getItem(le);
926
- if (!r)
914
+ m(this, "client");
915
+ m(this, "issuer");
916
+ m(this, "authorizationEndpoint");
917
+ m(this, "tokenEndpoint");
918
+ m(this, "authorizationServer");
919
+ m(this, "tokens");
920
+ m(this, "callbackUrlPath", "/oauth/callback");
921
+ m(this, "logoutRedirectUrlPath", "/");
922
+ m(this, "redirectToAfterSignUp");
923
+ m(this, "redirectToAfterSignIn");
924
+ m(this, "redirectToAfterSignOut");
925
+ m(this, "audience");
926
+ m(this, "signOut", async () => {
927
+ oe.setState({
928
+ isAuthenticated: !1,
929
+ isPending: !1,
930
+ profile: void 0
931
+ }), localStorage.removeItem("auto-login");
932
+ const e = await this.getAuthServer(), n = new URL(
933
+ window.location.origin + this.redirectToAfterSignOut
934
+ );
935
+ n.pathname = this.logoutRedirectUrlPath;
936
+ let r;
937
+ e.end_session_endpoint ? (r = new URL(e.end_session_endpoint), r.searchParams.set(
938
+ "post_logout_redirect_uri",
939
+ n.toString()
940
+ )) : r = n;
941
+ });
942
+ m(this, "handleCallback", async () => {
943
+ const e = new URL(window.location.href), n = e.searchParams.get("state"), r = sessionStorage.getItem(M);
944
+ if (sessionStorage.removeItem(M), !r)
927
945
  throw new x(
928
946
  "Code verifier not found. Invalid auth state."
929
947
  );
@@ -933,29 +951,29 @@ class Lt {
933
951
  e.searchParams,
934
952
  n ?? void 0
935
953
  );
936
- if (B(o))
937
- throw oe.error("Error validating OAuth response", o), new G(
954
+ if (G(o))
955
+ throw ie.error("Error validating OAuth response", o), new q(
938
956
  "Error validating OAuth response",
939
957
  o
940
958
  );
941
959
  const i = new URL(e);
942
- i.pathname = this.redirectToAfterSignIn ?? this.callbackUrlPath, i.search = "";
960
+ i.pathname = this.redirectToAfterSignIn, i.search = "";
943
961
  const u = await yt(
944
962
  s,
945
963
  this.client,
946
964
  o,
947
965
  i.toString(),
948
966
  r
949
- ), g = await vt(
967
+ ), f = await vt(
950
968
  s,
951
969
  this.client,
952
970
  u
953
971
  );
954
- this.setTokensFromResponse(g);
955
- const m = await this.getAccessToken(), _ = await (await lt(
972
+ this.setTokensFromResponse(f);
973
+ const y = await this.getAccessToken(), _ = await (await lt(
956
974
  s,
957
975
  this.client,
958
- m
976
+ y
959
977
  )).json(), h = {
960
978
  sub: _.sub,
961
979
  email: _.email,
@@ -963,16 +981,16 @@ class Lt {
963
981
  emailVerified: _.email_verified ?? !1,
964
982
  pictureUrl: _.picture
965
983
  };
966
- return re.setState({
984
+ return oe.setState({
967
985
  isAuthenticated: !0,
968
986
  isPending: !1,
969
987
  profile: h
970
- }), localStorage.getItem("sign-up") ? this.redirectToAfterSignUp : this.redirectToAfterSignIn;
988
+ }), localStorage.setItem("auto-login", "1"), sessionStorage.getItem("redirect-to") ?? "/";
971
989
  });
972
990
  this.client = {
973
- client_id: s,
991
+ client_id: o,
974
992
  token_endpoint_auth_method: "none"
975
- }, this.issuer = e, this.authorizationEndpoint = n, this.tokenEndpoint = r, this.redirectToAfterSignUp = o ?? "/", this.redirectToAfterSignIn = i ?? "/", this.redirectToAfterSignOut = u ?? "/";
993
+ }, this.audience = n, this.issuer = e, this.authorizationEndpoint = r, this.tokenEndpoint = s, this.redirectToAfterSignUp = i ?? "/", this.redirectToAfterSignIn = u ?? "/", this.redirectToAfterSignOut = f ?? "/";
976
994
  }
977
995
  async getAuthServer() {
978
996
  if (!this.authorizationServer)
@@ -997,8 +1015,8 @@ class Lt {
997
1015
  * @param response
998
1016
  */
999
1017
  setTokensFromResponse(e) {
1000
- if (B(e))
1001
- throw oe.error("Bad Token Response", e), new G("Bad Token Response", e);
1018
+ if (G(e))
1019
+ throw ie.error("Bad Token Response", e), new q("Bad Token Response", e);
1002
1020
  if (!e.expires_in)
1003
1021
  throw new x("No expires_in in response");
1004
1022
  this.tokens = {
@@ -1006,32 +1024,38 @@ class Lt {
1006
1024
  refreshToken: e.refresh_token,
1007
1025
  expiresOn: new Date(Date.now() + e.expires_in * 1e3),
1008
1026
  tokenType: e.token_type
1009
- };
1027
+ }, sessionStorage.setItem("openid-token", JSON.stringify(this.tokens));
1010
1028
  }
1011
- async signUp() {
1012
- return this.authorize(!0);
1029
+ async signUp({ redirectTo: e } = {}) {
1030
+ return this.authorize({
1031
+ redirectTo: e ?? this.redirectToAfterSignUp
1032
+ });
1013
1033
  }
1014
- async signIn() {
1015
- return this.authorize();
1034
+ async signIn({ redirectTo: e } = {}) {
1035
+ return this.authorize({
1036
+ redirectTo: e ?? this.redirectToAfterSignIn
1037
+ });
1016
1038
  }
1017
- async authorize(e = !1) {
1018
- var g;
1039
+ async authorize({
1040
+ redirectTo: e
1041
+ }) {
1042
+ var f;
1019
1043
  const n = "S256", r = await this.getAuthServer();
1020
- if (e ? localStorage.setItem("sign-up", "true") : localStorage.removeItem("sign-up"), !r.authorization_endpoint)
1044
+ if (!r.authorization_endpoint)
1021
1045
  throw new x("No authorization endpoint");
1022
1046
  const s = Ge(), o = await Ve(s);
1023
- localStorage.setItem(le, s);
1047
+ sessionStorage.setItem(M, s);
1024
1048
  const i = new URL(
1025
- e ? r.registration_endpoint ?? r.authorization_endpoint : r.authorization_endpoint
1026
- ), u = new URL(
1027
- (e ? window.location.origin + this.redirectToAfterSignUp : window.location.origin + this.redirectToAfterSignIn) ?? window.location.href
1049
+ r.authorization_endpoint
1028
1050
  );
1051
+ sessionStorage.setItem("redirect-to", e);
1052
+ const u = new URL(window.location.origin);
1029
1053
  if (u.pathname = this.callbackUrlPath, u.search = "", i.searchParams.set("client_id", this.client.client_id), i.searchParams.set("redirect_uri", u.toString()), i.searchParams.set("response_type", "code"), i.searchParams.set("scope", "openid+profile+email"), i.searchParams.set("code_challenge", o), i.searchParams.set(
1030
1054
  "code_challenge_method",
1031
1055
  n
1032
- ), ((g = r.code_challenge_methods_supported) == null ? void 0 : g.includes("S256")) !== !0) {
1033
- const m = qe();
1034
- i.searchParams.set("state", m);
1056
+ ), this.audience && i.searchParams.set("audience", this.audience), ((f = r.code_challenge_methods_supported) == null ? void 0 : f.includes("S256")) !== !0) {
1057
+ const y = qe();
1058
+ i.searchParams.set("state", y);
1035
1059
  }
1036
1060
  location.href = i.href;
1037
1061
  }
@@ -1057,26 +1081,13 @@ class Lt {
1057
1081
  }
1058
1082
  return this.tokens.accessToken;
1059
1083
  }
1060
- async signOut() {
1061
- re.setState({
1062
- isAuthenticated: !1,
1063
- isPending: !1,
1064
- profile: void 0
1065
- });
1066
- const e = await this.getAuthServer(), n = new URL(
1067
- window.location.origin + this.redirectToAfterSignOut
1068
- );
1069
- n.pathname = this.logoutRedirectUrlPath;
1070
- let r;
1071
- e.end_session_endpoint ? (r = new URL(e.end_session_endpoint), r.searchParams.set(
1072
- "post_logout_redirect_uri",
1073
- n.toString()
1074
- )) : r = n;
1075
- }
1076
1084
  getAuthenticationPlugin() {
1077
1085
  return new Ut(
1078
1086
  this.callbackUrlPath,
1079
- () => this.handleCallback()
1087
+ async () => this.handleCallback(),
1088
+ async () => {
1089
+ typeof localStorage < "u" && localStorage.getItem("auto-login") && (localStorage.removeItem("auto-login"), await this.authorize({ redirectTo: window.location.pathname }));
1090
+ }
1080
1091
  );
1081
1092
  }
1082
1093
  }