zudoku 0.7.2-dev.13 → 0.7.2-dev.2

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 (94) hide show
  1. package/dist/cli/dev/handler.js +0 -5
  2. package/dist/cli/dev/handler.js.map +1 -1
  3. package/dist/lib/util/fetchTimeout.d.ts +1 -0
  4. package/dist/lib/util/fetchTimeout.js +14 -0
  5. package/dist/lib/util/fetchTimeout.js.map +1 -0
  6. package/dist/vite/config.d.ts +2 -2
  7. package/dist/vite/config.js +20 -21
  8. package/dist/vite/config.js.map +1 -1
  9. package/dist/vite/config.test.js +4 -1
  10. package/dist/vite/config.test.js.map +1 -1
  11. package/dist/vite/dev-server.js +4 -1
  12. package/dist/vite/dev-server.js.map +1 -1
  13. package/dist/vite/esbuild-yaml.d.ts +2 -0
  14. package/dist/vite/esbuild-yaml.js +50 -0
  15. package/dist/vite/esbuild-yaml.js.map +1 -0
  16. package/dist/vite/plugin-vercel.d.ts +3 -0
  17. package/dist/vite/plugin-vercel.js +8 -0
  18. package/dist/vite/plugin-vercel.js.map +1 -0
  19. package/dist/vite/plugin-yaml.d.ts +3 -0
  20. package/dist/vite/plugin-yaml.js +24 -0
  21. package/dist/vite/plugin-yaml.js.map +1 -0
  22. package/dist/vite/sitemap.d.ts +19 -0
  23. package/dist/vite/sitemap.js +36 -0
  24. package/dist/vite/sitemap.js.map +1 -0
  25. package/lib/AuthenticationPlugin-BMjOjKqE.js +54 -0
  26. package/lib/{AuthenticationPlugin-Bx9FK124.js.map → AuthenticationPlugin-BMjOjKqE.js.map} +1 -1
  27. package/lib/CategoryHeading-BE8e6QdS.js +9 -0
  28. package/lib/{CategoryHeading-XnFqN2lJ.js.map → CategoryHeading-BE8e6QdS.js.map} +1 -1
  29. package/lib/DeveloperHint-Bl9gIdNI.js +12 -0
  30. package/lib/{DeveloperHint-FBb2uXJe.js.map → DeveloperHint-Bl9gIdNI.js.map} +1 -1
  31. package/lib/ErrorPage-CPR1XVKW.js +12 -0
  32. package/lib/{ErrorPage-knunPbKI.js.map → ErrorPage-CPR1XVKW.js.map} +1 -1
  33. package/lib/Input-BBlyeDuG.js +2192 -0
  34. package/lib/{Input-BEDZAKw0.js.map → Input-BBlyeDuG.js.map} +1 -1
  35. package/lib/{Markdown-B4aR03g6.js → Markdown-CCNihH_N.js} +2641 -2650
  36. package/lib/{Markdown-B4aR03g6.js.map → Markdown-CCNihH_N.js.map} +1 -1
  37. package/lib/MdxPage-BavkYqzi.js +140 -0
  38. package/lib/{MdxPage-BZyQsH8Z.js.map → MdxPage-BavkYqzi.js.map} +1 -1
  39. package/lib/OperationList-C6Ps2keZ.js +460 -0
  40. package/lib/{OperationList-2NeWEM0u.js.map → OperationList-C6Ps2keZ.js.map} +1 -1
  41. package/lib/Route-xRJ9mJgH.js +13 -0
  42. package/lib/{Route-BZPewmrN.js.map → Route-xRJ9mJgH.js.map} +1 -1
  43. package/lib/{SidebarBadge-COz0hgfa.js → SidebarBadge-2JcxswKF.js} +41 -41
  44. package/lib/{SidebarBadge-COz0hgfa.js.map → SidebarBadge-2JcxswKF.js.map} +1 -1
  45. package/lib/SlotletProvider-CuB3Ts8r.js +213 -0
  46. package/lib/{SlotletProvider-DJMaOUDs.js.map → SlotletProvider-CuB3Ts8r.js.map} +1 -1
  47. package/lib/Spinner-BlxzaFFF.js +6 -0
  48. package/lib/Spinner-BlxzaFFF.js.map +1 -0
  49. package/lib/{ZudokuContext-cr-pTRY1.js → ZudokuContext-JoyeA9dT.js} +65 -66
  50. package/lib/{ZudokuContext-cr-pTRY1.js.map → ZudokuContext-JoyeA9dT.js.map} +1 -1
  51. package/lib/{index-Dv2KZuEw.js → index-BF4cn28H.js} +1804 -1991
  52. package/lib/{index-Dv2KZuEw.js.map → index-BF4cn28H.js.map} +1 -1
  53. package/lib/{index-Zezcv0xb.js → index-BLvMkqjO.js} +5 -5
  54. package/lib/{index-Zezcv0xb.js.map → index-BLvMkqjO.js.map} +1 -1
  55. package/lib/{index-1EDgIO6b.js → index-G1-TGLO1.js} +4 -4
  56. package/lib/{index-1EDgIO6b.js.map → index-G1-TGLO1.js.map} +1 -1
  57. package/lib/jsx-runtime-lNnQYwFN.js +2403 -0
  58. package/lib/jsx-runtime-lNnQYwFN.js.map +1 -0
  59. package/lib/{utils-ByIc_KIM.js → utils-B8R4grFM.js} +97 -98
  60. package/lib/{utils-ByIc_KIM.js.map → utils-B8R4grFM.js.map} +1 -1
  61. package/lib/zudoku.auth-auth0.js +16 -21
  62. package/lib/zudoku.auth-auth0.js.map +1 -1
  63. package/lib/zudoku.auth-clerk.js +32 -37
  64. package/lib/zudoku.auth-clerk.js.map +1 -1
  65. package/lib/zudoku.auth-openid.js +485 -505
  66. package/lib/zudoku.auth-openid.js.map +1 -1
  67. package/lib/zudoku.components.js +1531 -1659
  68. package/lib/zudoku.components.js.map +1 -1
  69. package/lib/zudoku.plugin-api-keys.js +150 -214
  70. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  71. package/lib/zudoku.plugin-custom-page.js +5 -6
  72. package/lib/zudoku.plugin-custom-page.js.map +1 -1
  73. package/lib/zudoku.plugin-markdown.js +12 -13
  74. package/lib/zudoku.plugin-markdown.js.map +1 -1
  75. package/lib/zudoku.plugin-openapi.js +7 -8
  76. package/lib/zudoku.plugin-openapi.js.map +1 -1
  77. package/lib/zudoku.plugin-search-inkeep.js +20 -21
  78. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  79. package/package.json +2 -2
  80. package/lib/AuthenticationPlugin-Bx9FK124.js +0 -55
  81. package/lib/CategoryHeading-XnFqN2lJ.js +0 -10
  82. package/lib/DeveloperHint-FBb2uXJe.js +0 -16
  83. package/lib/ErrorPage-knunPbKI.js +0 -18
  84. package/lib/Input-BEDZAKw0.js +0 -2198
  85. package/lib/MdxPage-BZyQsH8Z.js +0 -172
  86. package/lib/OperationList-2NeWEM0u.js +0 -560
  87. package/lib/Route-BZPewmrN.js +0 -14
  88. package/lib/SlotletProvider-DJMaOUDs.js +0 -238
  89. package/lib/Spinner-3cQDBVGr.js +0 -7
  90. package/lib/Spinner-3cQDBVGr.js.map +0 -1
  91. package/lib/index-BG0g4WW0.js +0 -1771
  92. package/lib/index-BG0g4WW0.js.map +0 -1
  93. package/lib/jsx-runtime-B6kdoens.js +0 -635
  94. package/lib/jsx-runtime-B6kdoens.js.map +0 -1
@@ -1,31 +1,27 @@
1
- var Ue = Object.defineProperty;
2
- var Le = (t, e, r) => e in t ? Ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var _ = (t, e, r) => Le(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { j as E } from "./jsx-runtime-B6kdoens.js";
5
- import { c as Ce, g as Ie } from "./_commonjsHelpers-BkfeUUK-.js";
6
- import { A as je } from "./AuthenticationPlugin-Bx9FK124.js";
7
- import { useState as Je, useRef as Oe, useEffect as Ne } from "react";
8
- import { D as ze } from "./DeveloperHint-FBb2uXJe.js";
9
- import { E as De } from "./ErrorPage-knunPbKI.js";
10
- import { S as Ke } from "./Spinner-3cQDBVGr.js";
11
- import { S as We } from "./Markdown-B4aR03g6.js";
12
- import { a as He } from "./index-BG0g4WW0.js";
13
- import { u as z } from "./state-lIwt9isb.js";
14
- var fe = { exports: {} };
1
+ import { c as Pe, g as Ue } from "./_commonjsHelpers-BkfeUUK-.js";
2
+ import { A as Le } from "./AuthenticationPlugin-BMjOjKqE.js";
3
+ import { useState as Ce, useRef as xe, useEffect as Ie } from "react";
4
+ import { D as Je } from "./DeveloperHint-Bl9gIdNI.js";
5
+ import { E as je } from "./ErrorPage-CPR1XVKW.js";
6
+ import { S as Oe } from "./Spinner-BlxzaFFF.js";
7
+ import { S as Ne } from "./Markdown-CCNihH_N.js";
8
+ import { a as ze } from "./jsx-runtime-lNnQYwFN.js";
9
+ import { u as N } from "./state-lIwt9isb.js";
10
+ var he = { exports: {} };
15
11
  (function(t) {
16
- (function(e, r) {
17
- t.exports ? t.exports = r() : e.log = r();
18
- })(Ce, function() {
12
+ (function(e, n) {
13
+ t.exports ? t.exports = n() : e.log = n();
14
+ })(Pe, function() {
19
15
  var e = function() {
20
- }, r = "undefined", o = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
16
+ }, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
21
17
  "trace",
22
18
  "debug",
23
19
  "info",
24
20
  "warn",
25
21
  "error"
26
- ], n = {}, i = null;
27
- function u(l, w) {
28
- var c = l[w];
22
+ ], r = {}, i = null;
23
+ function u(l, m) {
24
+ var c = l[m];
29
25
  if (typeof c.bind == "function")
30
26
  return c.bind(l);
31
27
  try {
@@ -36,80 +32,80 @@ var fe = { exports: {} };
36
32
  };
37
33
  }
38
34
  }
39
- function f() {
35
+ function d() {
40
36
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
41
37
  }
42
- function m(l) {
43
- return l === "debug" && (l = "log"), typeof console === r ? !1 : l === "trace" && o ? f : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
38
+ function p(l) {
39
+ return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? d : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
44
40
  }
45
- function y() {
46
- for (var l = this.getLevel(), w = 0; w < s.length; w++) {
47
- var c = s[w];
48
- this[c] = w < l ? e : this.methodFactory(c, l, this.name);
41
+ function w() {
42
+ for (var l = this.getLevel(), m = 0; m < s.length; m++) {
43
+ var c = s[m];
44
+ this[c] = m < l ? e : this.methodFactory(c, l, this.name);
49
45
  }
50
- if (this.log = this.debug, typeof console === r && l < this.levels.SILENT)
46
+ if (this.log = this.debug, typeof console === n && l < this.levels.SILENT)
51
47
  return "No console available for logging";
52
48
  }
53
49
  function b(l) {
54
50
  return function() {
55
- typeof console !== r && (y.call(this), this[l].apply(this, arguments));
51
+ typeof console !== n && (w.call(this), this[l].apply(this, arguments));
56
52
  };
57
53
  }
58
- function h(l, w, c) {
59
- return m(l) || b.apply(this, arguments);
54
+ function f(l, m, c) {
55
+ return p(l) || b.apply(this, arguments);
60
56
  }
61
- function R(l, w) {
62
- var c = this, O, B, x, v = "loglevel";
63
- typeof l == "string" ? v += ":" + l : typeof l == "symbol" && (v = void 0);
64
- function Re(d) {
65
- var g = (s[d] || "silent").toUpperCase();
66
- if (!(typeof window === r || !v)) {
57
+ function A(l, m) {
58
+ var c = this, R, L, P, _ = "loglevel";
59
+ typeof l == "string" ? _ += ":" + l : typeof l == "symbol" && (_ = void 0);
60
+ function ke(h) {
61
+ var y = (s[h] || "silent").toUpperCase();
62
+ if (!(typeof window === n || !_)) {
67
63
  try {
68
- window.localStorage[v] = g;
64
+ window.localStorage[_] = y;
69
65
  return;
70
66
  } catch {
71
67
  }
72
68
  try {
73
- window.document.cookie = encodeURIComponent(v) + "=" + g + ";";
69
+ window.document.cookie = encodeURIComponent(_) + "=" + y + ";";
74
70
  } catch {
75
71
  }
76
72
  }
77
73
  }
78
- function ne() {
79
- var d;
80
- if (!(typeof window === r || !v)) {
74
+ function te() {
75
+ var h;
76
+ if (!(typeof window === n || !_)) {
81
77
  try {
82
- d = window.localStorage[v];
78
+ h = window.localStorage[_];
83
79
  } catch {
84
80
  }
85
- if (typeof d === r)
81
+ if (typeof h === n)
86
82
  try {
87
- var g = window.document.cookie, N = encodeURIComponent(v), ie = g.indexOf(N + "=");
88
- ie !== -1 && (d = /^([^;]+)/.exec(
89
- g.slice(ie + N.length + 1)
83
+ var y = window.document.cookie, O = encodeURIComponent(_), re = y.indexOf(O + "=");
84
+ re !== -1 && (h = /^([^;]+)/.exec(
85
+ y.slice(re + O.length + 1)
90
86
  )[1]);
91
87
  } catch {
92
88
  }
93
- return c.levels[d] === void 0 && (d = void 0), d;
89
+ return c.levels[h] === void 0 && (h = void 0), h;
94
90
  }
95
91
  }
96
- function Pe() {
97
- if (!(typeof window === r || !v)) {
92
+ function Ae() {
93
+ if (!(typeof window === n || !_)) {
98
94
  try {
99
- window.localStorage.removeItem(v);
95
+ window.localStorage.removeItem(_);
100
96
  } catch {
101
97
  }
102
98
  try {
103
- window.document.cookie = encodeURIComponent(v) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
99
+ window.document.cookie = encodeURIComponent(_) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
104
100
  } catch {
105
101
  }
106
102
  }
107
103
  }
108
- function L(d) {
109
- var g = d;
110
- if (typeof g == "string" && c.levels[g.toUpperCase()] !== void 0 && (g = c.levels[g.toUpperCase()]), typeof g == "number" && g >= 0 && g <= c.levels.SILENT)
111
- return g;
112
- throw new TypeError("log.setLevel() called with invalid level: " + d);
104
+ function C(h) {
105
+ var y = h;
106
+ if (typeof y == "string" && c.levels[y.toUpperCase()] !== void 0 && (y = c.levels[y.toUpperCase()]), typeof y == "number" && y >= 0 && y <= c.levels.SILENT)
107
+ return y;
108
+ throw new TypeError("log.setLevel() called with invalid level: " + h);
113
109
  }
114
110
  c.name = l, c.levels = {
115
111
  TRACE: 0,
@@ -118,51 +114,51 @@ var fe = { exports: {} };
118
114
  WARN: 3,
119
115
  ERROR: 4,
120
116
  SILENT: 5
121
- }, c.methodFactory = w || h, c.getLevel = function() {
122
- return x ?? B ?? O;
123
- }, c.setLevel = function(d, g) {
124
- return x = L(d), g !== !1 && Re(x), y.call(c);
125
- }, c.setDefaultLevel = function(d) {
126
- B = L(d), ne() || c.setLevel(d, !1);
117
+ }, c.methodFactory = m || f, c.getLevel = function() {
118
+ return P ?? L ?? R;
119
+ }, c.setLevel = function(h, y) {
120
+ return P = C(h), y !== !1 && ke(P), w.call(c);
121
+ }, c.setDefaultLevel = function(h) {
122
+ L = C(h), te() || c.setLevel(h, !1);
127
123
  }, c.resetLevel = function() {
128
- x = null, Pe(), y.call(c);
129
- }, c.enableAll = function(d) {
130
- c.setLevel(c.levels.TRACE, d);
131
- }, c.disableAll = function(d) {
132
- c.setLevel(c.levels.SILENT, d);
124
+ P = null, Ae(), w.call(c);
125
+ }, c.enableAll = function(h) {
126
+ c.setLevel(c.levels.TRACE, h);
127
+ }, c.disableAll = function(h) {
128
+ c.setLevel(c.levels.SILENT, h);
133
129
  }, c.rebuild = function() {
134
- if (i !== c && (O = L(i.getLevel())), y.call(c), i === c)
135
- for (var d in n)
136
- n[d].rebuild();
137
- }, O = L(
130
+ if (i !== c && (R = C(i.getLevel())), w.call(c), i === c)
131
+ for (var h in r)
132
+ r[h].rebuild();
133
+ }, R = C(
138
134
  i ? i.getLevel() : "WARN"
139
135
  );
140
- var oe = ne();
141
- oe != null && (x = L(oe)), y.call(c);
136
+ var ne = te();
137
+ ne != null && (P = C(ne)), w.call(c);
142
138
  }
143
- i = new R(), i.getLogger = function(w) {
144
- if (typeof w != "symbol" && typeof w != "string" || w === "")
139
+ i = new A(), i.getLogger = function(m) {
140
+ if (typeof m != "symbol" && typeof m != "string" || m === "")
145
141
  throw new TypeError("You must supply a name when creating a logger.");
146
- var c = n[w];
147
- return c || (c = n[w] = new R(
148
- w,
142
+ var c = r[m];
143
+ return c || (c = r[m] = new A(
144
+ m,
149
145
  i.methodFactory
150
146
  )), c;
151
147
  };
152
- var P = typeof window !== r ? window.log : void 0;
148
+ var S = typeof window !== n ? window.log : void 0;
153
149
  return i.noConflict = function() {
154
- return typeof window !== r && window.log === i && (window.log = P), i;
150
+ return typeof window !== n && window.log === i && (window.log = S), i;
155
151
  }, i.getLoggers = function() {
156
- return n;
152
+ return r;
157
153
  }, i.default = i, i;
158
154
  });
159
- })(fe);
160
- var $e = fe.exports;
161
- const K = /* @__PURE__ */ Ie($e);
162
- let Y;
163
- var D, he;
164
- (typeof navigator > "u" || !((he = (D = navigator.userAgent) == null ? void 0 : D.startsWith) != null && he.call(D, "Mozilla/5.0 "))) && (Y = "oauth4webapi/v2.11.1");
165
- function Q(t, e) {
155
+ })(he);
156
+ var De = he.exports;
157
+ const D = /* @__PURE__ */ Ue(De);
158
+ let G;
159
+ var z, le;
160
+ (typeof navigator > "u" || !((le = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && le.call(z, "Mozilla/5.0 "))) && (G = "oauth4webapi/v2.11.1");
161
+ function Y(t, e) {
166
162
  if (t == null)
167
163
  return !1;
168
164
  try {
@@ -171,183 +167,183 @@ function Q(t, e) {
171
167
  return !1;
172
168
  }
173
169
  }
174
- const H = Symbol(), Fe = Symbol(), X = Symbol(), Me = new TextEncoder(), Be = new TextDecoder();
175
- function A(t) {
176
- return typeof t == "string" ? Me.encode(t) : Be.decode(t);
170
+ const W = Symbol(), Ke = Symbol(), Z = Symbol(), We = new TextEncoder(), He = new TextDecoder();
171
+ function k(t) {
172
+ return typeof t == "string" ? We.encode(t) : He.decode(t);
177
173
  }
178
- const se = 32768;
179
- function qe(t) {
174
+ const oe = 32768;
175
+ function $e(t) {
180
176
  t instanceof ArrayBuffer && (t = new Uint8Array(t));
181
177
  const e = [];
182
- for (let r = 0; r < t.byteLength; r += se)
183
- e.push(String.fromCharCode.apply(null, t.subarray(r, r + se)));
178
+ for (let n = 0; n < t.byteLength; n += oe)
179
+ e.push(String.fromCharCode.apply(null, t.subarray(n, n + oe)));
184
180
  return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
185
181
  }
186
- function Ge(t) {
182
+ function Fe(t) {
187
183
  try {
188
- const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), r = new Uint8Array(e.length);
184
+ const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(e.length);
189
185
  for (let o = 0; o < e.length; o++)
190
- r[o] = e.charCodeAt(o);
191
- return r;
186
+ n[o] = e.charCodeAt(o);
187
+ return n;
192
188
  } catch (e) {
193
189
  throw new a("The input to be decoded is not correctly encoded.", { cause: e });
194
190
  }
195
191
  }
196
- function k(t) {
197
- return typeof t == "string" ? Ge(t) : qe(t);
192
+ function E(t) {
193
+ return typeof t == "string" ? Fe(t) : $e(t);
198
194
  }
199
- class Ve {
195
+ class Me {
200
196
  constructor(e) {
201
197
  this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = e;
202
198
  }
203
199
  get(e) {
204
- let r = this.cache.get(e);
205
- if (r)
206
- return r;
207
- if (r = this._cache.get(e))
208
- return this.update(e, r), r;
200
+ let n = this.cache.get(e);
201
+ if (n)
202
+ return n;
203
+ if (n = this._cache.get(e))
204
+ return this.update(e, n), n;
209
205
  }
210
206
  has(e) {
211
207
  return this.cache.has(e) || this._cache.has(e);
212
208
  }
213
- set(e, r) {
214
- return this.cache.has(e) ? this.cache.set(e, r) : this.update(e, r), this;
209
+ set(e, n) {
210
+ return this.cache.has(e) ? this.cache.set(e, n) : this.update(e, n), this;
215
211
  }
216
212
  delete(e) {
217
213
  return this.cache.has(e) ? this.cache.delete(e) : this._cache.has(e) ? this._cache.delete(e) : !1;
218
214
  }
219
- update(e, r) {
220
- this.cache.set(e, r), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
215
+ update(e, n) {
216
+ this.cache.set(e, n), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
221
217
  }
222
218
  }
223
- class S extends Error {
219
+ class v extends Error {
224
220
  constructor(e) {
225
- var r;
226
- super(e ?? "operation not supported"), this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
221
+ var n;
222
+ super(e ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
227
223
  }
228
224
  }
229
- class Ye extends Error {
230
- constructor(e, r) {
225
+ class Be extends Error {
226
+ constructor(e, n) {
231
227
  var o;
232
- super(e, r), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
228
+ super(e, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
233
229
  }
234
230
  }
235
- const a = Ye, pe = new Ve(100);
236
- function we(t) {
231
+ const a = Be, de = new Me(100);
232
+ function fe(t) {
237
233
  return t instanceof CryptoKey;
238
234
  }
239
- function ge(t) {
240
- return we(t) && t.type === "private";
235
+ function pe(t) {
236
+ return fe(t) && t.type === "private";
241
237
  }
242
- function Ze(t) {
243
- return we(t) && t.type === "public";
238
+ function qe(t) {
239
+ return fe(t) && t.type === "public";
244
240
  }
245
- function ee(t) {
241
+ function Q(t) {
246
242
  try {
247
243
  const e = t.headers.get("dpop-nonce");
248
- e && pe.set(new URL(t.url).origin, e);
244
+ e && de.set(new URL(t.url).origin, e);
249
245
  } catch {
250
246
  }
251
247
  return t;
252
248
  }
253
- function C(t) {
249
+ function x(t) {
254
250
  return !(t === null || typeof t != "object" || Array.isArray(t));
255
251
  }
256
- function $(t) {
257
- Q(t, Headers) && (t = Object.fromEntries(t.entries()));
252
+ function H(t) {
253
+ Y(t, Headers) && (t = Object.fromEntries(t.entries()));
258
254
  const e = new Headers(t);
259
- if (Y && !e.has("user-agent") && e.set("user-agent", Y), e.has("authorization"))
255
+ if (G && !e.has("user-agent") && e.set("user-agent", G), e.has("authorization"))
260
256
  throw new TypeError('"options.headers" must not include the "authorization" header name');
261
257
  if (e.has("dpop"))
262
258
  throw new TypeError('"options.headers" must not include the "dpop" header name');
263
259
  return e;
264
260
  }
265
- function te(t) {
261
+ function X(t) {
266
262
  if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
267
263
  throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
268
264
  return t;
269
265
  }
270
- async function Qe(t, e) {
266
+ async function Ge(t, e) {
271
267
  if (!(t instanceof URL))
272
268
  throw new TypeError('"issuerIdentifier" must be an instance of URL');
273
269
  if (t.protocol !== "https:" && t.protocol !== "http:")
274
270
  throw new TypeError('"issuer.protocol" must be "https:" or "http:"');
275
- const r = new URL(t.href);
271
+ const n = new URL(t.href);
276
272
  switch (e == null ? void 0 : e.algorithm) {
277
273
  case void 0:
278
274
  case "oidc":
279
- r.pathname = `${r.pathname}/.well-known/openid-configuration`.replace("//", "/");
275
+ n.pathname = `${n.pathname}/.well-known/openid-configuration`.replace("//", "/");
280
276
  break;
281
277
  case "oauth2":
282
- r.pathname === "/" ? r.pathname = ".well-known/oauth-authorization-server" : r.pathname = `.well-known/oauth-authorization-server/${r.pathname}`.replace("//", "/");
278
+ n.pathname === "/" ? n.pathname = ".well-known/oauth-authorization-server" : n.pathname = `.well-known/oauth-authorization-server/${n.pathname}`.replace("//", "/");
283
279
  break;
284
280
  default:
285
281
  throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
286
282
  }
287
- const o = $(e == null ? void 0 : e.headers);
288
- return o.set("accept", "application/json"), ((e == null ? void 0 : e[X]) || fetch)(r.href, {
283
+ const o = H(e == null ? void 0 : e.headers);
284
+ return o.set("accept", "application/json"), ((e == null ? void 0 : e[Z]) || fetch)(n.href, {
289
285
  headers: Object.fromEntries(o.entries()),
290
286
  method: "GET",
291
287
  redirect: "manual",
292
- signal: e != null && e.signal ? te(e.signal) : null
293
- }).then(ee);
288
+ signal: e != null && e.signal ? X(e.signal) : null
289
+ }).then(Q);
294
290
  }
295
- function p(t) {
291
+ function g(t) {
296
292
  return typeof t == "string" && t.length !== 0;
297
293
  }
298
- async function Xe(t, e) {
294
+ async function Ve(t, e) {
299
295
  if (!(t instanceof URL))
300
296
  throw new TypeError('"expectedIssuer" must be an instance of URL');
301
- if (!Q(e, Response))
297
+ if (!Y(e, Response))
302
298
  throw new TypeError('"response" must be an instance of Response');
303
299
  if (e.status !== 200)
304
300
  throw new a('"response" is not a conform Authorization Server Metadata response');
305
- re(e);
306
- let r;
301
+ ee(e);
302
+ let n;
307
303
  try {
308
- r = await e.json();
304
+ n = await e.json();
309
305
  } catch (o) {
310
306
  throw new a('failed to parse "response" body as JSON', { cause: o });
311
307
  }
312
- if (!C(r))
308
+ if (!x(n))
313
309
  throw new a('"response" body must be a top level object');
314
- if (!p(r.issuer))
310
+ if (!g(n.issuer))
315
311
  throw new a('"response" body "issuer" property must be a non-empty string');
316
- if (new URL(r.issuer).href !== t.href)
312
+ if (new URL(n.issuer).href !== t.href)
317
313
  throw new a('"response" body "issuer" does not match "expectedIssuer"');
318
- return r;
314
+ return n;
319
315
  }
320
- function F() {
321
- return k(crypto.getRandomValues(new Uint8Array(32)));
316
+ function $() {
317
+ return E(crypto.getRandomValues(new Uint8Array(32)));
322
318
  }
323
- function et() {
324
- return F();
319
+ function Ye() {
320
+ return $();
325
321
  }
326
- function tt() {
327
- return F();
322
+ function Ze() {
323
+ return $();
328
324
  }
329
- async function rt(t) {
330
- if (!p(t))
325
+ async function Qe(t) {
326
+ if (!g(t))
331
327
  throw new TypeError('"codeVerifier" must be a non-empty string');
332
- return k(await crypto.subtle.digest("SHA-256", A(t)));
328
+ return E(await crypto.subtle.digest("SHA-256", k(t)));
333
329
  }
334
- function nt(t) {
330
+ function Xe(t) {
335
331
  if (t instanceof CryptoKey)
336
332
  return { key: t };
337
333
  if (!((t == null ? void 0 : t.key) instanceof CryptoKey))
338
334
  return {};
339
- if (t.kid !== void 0 && !p(t.kid))
335
+ if (t.kid !== void 0 && !g(t.kid))
340
336
  throw new TypeError('"kid" must be a non-empty string');
341
337
  return { key: t.key, kid: t.kid };
342
338
  }
343
- function ae(t) {
339
+ function ie(t) {
344
340
  return encodeURIComponent(t).replace(/%20/g, "+");
345
341
  }
346
- function ot(t, e) {
347
- const r = ae(t), o = ae(e);
348
- return `Basic ${btoa(`${r}:${o}`)}`;
342
+ function et(t, e) {
343
+ const n = ie(t), o = ie(e);
344
+ return `Basic ${btoa(`${n}:${o}`)}`;
349
345
  }
350
- function it(t) {
346
+ function tt(t) {
351
347
  switch (t.algorithm.hash.name) {
352
348
  case "SHA-256":
353
349
  return "PS256";
@@ -356,10 +352,10 @@ function it(t) {
356
352
  case "SHA-512":
357
353
  return "PS512";
358
354
  default:
359
- throw new S("unsupported RsaHashedKeyAlgorithm hash name");
355
+ throw new v("unsupported RsaHashedKeyAlgorithm hash name");
360
356
  }
361
357
  }
362
- function st(t) {
358
+ function nt(t) {
363
359
  switch (t.algorithm.hash.name) {
364
360
  case "SHA-256":
365
361
  return "RS256";
@@ -368,10 +364,10 @@ function st(t) {
368
364
  case "SHA-512":
369
365
  return "RS512";
370
366
  default:
371
- throw new S("unsupported RsaHashedKeyAlgorithm hash name");
367
+ throw new v("unsupported RsaHashedKeyAlgorithm hash name");
372
368
  }
373
369
  }
374
- function at(t) {
370
+ function rt(t) {
375
371
  switch (t.algorithm.namedCurve) {
376
372
  case "P-256":
377
373
  return "ES256";
@@ -380,259 +376,259 @@ function at(t) {
380
376
  case "P-521":
381
377
  return "ES512";
382
378
  default:
383
- throw new S("unsupported EcKeyAlgorithm namedCurve");
379
+ throw new v("unsupported EcKeyAlgorithm namedCurve");
384
380
  }
385
381
  }
386
- function me(t) {
382
+ function we(t) {
387
383
  switch (t.algorithm.name) {
388
384
  case "RSA-PSS":
389
- return it(t);
385
+ return tt(t);
390
386
  case "RSASSA-PKCS1-v1_5":
391
- return st(t);
387
+ return nt(t);
392
388
  case "ECDSA":
393
- return at(t);
389
+ return rt(t);
394
390
  case "Ed25519":
395
391
  case "Ed448":
396
392
  return "EdDSA";
397
393
  default:
398
- throw new S("unsupported CryptoKey algorithm name");
394
+ throw new v("unsupported CryptoKey algorithm name");
399
395
  }
400
396
  }
401
397
  function I(t) {
402
- const e = t == null ? void 0 : t[H];
398
+ const e = t == null ? void 0 : t[W];
403
399
  return typeof e == "number" && Number.isFinite(e) ? e : 0;
404
400
  }
405
- function ye(t) {
406
- const e = t == null ? void 0 : t[Fe];
401
+ function ge(t) {
402
+ const e = t == null ? void 0 : t[Ke];
407
403
  return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
408
404
  }
409
- function M() {
405
+ function F() {
410
406
  return Math.floor(Date.now() / 1e3);
411
407
  }
412
- function ct(t, e) {
413
- const r = M() + I(e);
408
+ function ot(t, e) {
409
+ const n = F() + I(e);
414
410
  return {
415
- jti: F(),
411
+ jti: $(),
416
412
  aud: [t.issuer, t.token_endpoint],
417
- exp: r + 60,
418
- iat: r,
419
- nbf: r,
413
+ exp: n + 60,
414
+ iat: n,
415
+ nbf: n,
420
416
  iss: e.client_id,
421
417
  sub: e.client_id
422
418
  };
423
419
  }
424
- async function ut(t, e, r, o) {
425
- return be({
426
- alg: me(r),
420
+ async function it(t, e, n, o) {
421
+ return me({
422
+ alg: we(n),
427
423
  kid: o
428
- }, ct(t, e), r);
424
+ }, ot(t, e), n);
429
425
  }
430
- function j(t) {
426
+ function J(t) {
431
427
  if (typeof t != "object" || t === null)
432
428
  throw new TypeError('"as" must be an object');
433
- if (!p(t.issuer))
429
+ if (!g(t.issuer))
434
430
  throw new TypeError('"as.issuer" property must be a non-empty string');
435
431
  return !0;
436
432
  }
437
- function J(t) {
433
+ function j(t) {
438
434
  if (typeof t != "object" || t === null)
439
435
  throw new TypeError('"client" must be an object');
440
- if (!p(t.client_id))
436
+ if (!g(t.client_id))
441
437
  throw new TypeError('"client.client_id" property must be a non-empty string');
442
438
  return !0;
443
439
  }
444
- function ce(t) {
445
- if (!p(t))
440
+ function se(t) {
441
+ if (!g(t))
446
442
  throw new TypeError('"client.client_secret" property must be a non-empty string');
447
443
  return t;
448
444
  }
449
- function q(t, e) {
445
+ function M(t, e) {
450
446
  if (e !== void 0)
451
447
  throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${t} client authentication method is used.`);
452
448
  }
453
- function ue(t, e) {
449
+ function ae(t, e) {
454
450
  if (e !== void 0)
455
451
  throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
456
452
  }
457
- async function lt(t, e, r, o, s) {
458
- switch (r.delete("client_secret"), r.delete("client_assertion_type"), r.delete("client_assertion"), e.token_endpoint_auth_method) {
453
+ async function st(t, e, n, o, s) {
454
+ switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
459
455
  case void 0:
460
456
  case "client_secret_basic": {
461
- q("client_secret_basic", s), o.set("authorization", ot(e.client_id, ce(e.client_secret)));
457
+ M("client_secret_basic", s), o.set("authorization", et(e.client_id, se(e.client_secret)));
462
458
  break;
463
459
  }
464
460
  case "client_secret_post": {
465
- q("client_secret_post", s), r.set("client_id", e.client_id), r.set("client_secret", ce(e.client_secret));
461
+ M("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", se(e.client_secret));
466
462
  break;
467
463
  }
468
464
  case "private_key_jwt": {
469
- if (ue("private_key_jwt", e.client_secret), s === void 0)
465
+ if (ae("private_key_jwt", e.client_secret), s === void 0)
470
466
  throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
471
- const { key: n, kid: i } = nt(s);
472
- if (!ge(n))
467
+ const { key: r, kid: i } = Xe(s);
468
+ if (!pe(r))
473
469
  throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
474
- r.set("client_id", e.client_id), r.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), r.set("client_assertion", await ut(t, e, n, i));
470
+ n.set("client_id", e.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await it(t, e, r, i));
475
471
  break;
476
472
  }
477
473
  case "tls_client_auth":
478
474
  case "self_signed_tls_client_auth":
479
475
  case "none": {
480
- ue(e.token_endpoint_auth_method, e.client_secret), q(e.token_endpoint_auth_method, s), r.set("client_id", e.client_id);
476
+ ae(e.token_endpoint_auth_method, e.client_secret), M(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
481
477
  break;
482
478
  }
483
479
  default:
484
- throw new S("unsupported client token_endpoint_auth_method");
480
+ throw new v("unsupported client token_endpoint_auth_method");
485
481
  }
486
482
  }
487
- async function be(t, e, r) {
488
- if (!r.usages.includes("sign"))
483
+ async function me(t, e, n) {
484
+ if (!n.usages.includes("sign"))
489
485
  throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
490
- const o = `${k(A(JSON.stringify(t)))}.${k(A(JSON.stringify(e)))}`, s = k(await crypto.subtle.sign(Ee(r), r, A(o)));
486
+ const o = `${E(k(JSON.stringify(t)))}.${E(k(JSON.stringify(e)))}`, s = E(await crypto.subtle.sign(Te(n), n, k(o)));
491
487
  return `${o}.${s}`;
492
488
  }
493
- async function dt(t, e, r, o, s, n) {
494
- const { privateKey: i, publicKey: u, nonce: f = pe.get(r.origin) } = e;
495
- if (!ge(i))
489
+ async function at(t, e, n, o, s, r) {
490
+ const { privateKey: i, publicKey: u, nonce: d = de.get(n.origin) } = e;
491
+ if (!pe(i))
496
492
  throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
497
- if (!Ze(u))
493
+ if (!qe(u))
498
494
  throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
499
- if (f !== void 0 && !p(f))
495
+ if (d !== void 0 && !g(d))
500
496
  throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
501
497
  if (!u.extractable)
502
498
  throw new TypeError('"DPoP.publicKey.extractable" must be true');
503
- const m = M() + s, y = await be({
504
- alg: me(i),
499
+ const p = F() + s, w = await me({
500
+ alg: we(i),
505
501
  typ: "dpop+jwt",
506
- jwk: await ft(u)
502
+ jwk: await ut(u)
507
503
  }, {
508
- iat: m,
509
- jti: F(),
504
+ iat: p,
505
+ jti: $(),
510
506
  htm: o,
511
- nonce: f,
512
- htu: `${r.origin}${r.pathname}`,
513
- ath: n ? k(await crypto.subtle.digest("SHA-256", A(n))) : void 0
507
+ nonce: d,
508
+ htu: `${n.origin}${n.pathname}`,
509
+ ath: r ? E(await crypto.subtle.digest("SHA-256", k(r))) : void 0
514
510
  }, i);
515
- t.set("dpop", y);
511
+ t.set("dpop", w);
516
512
  }
517
- let W;
518
- async function ht(t) {
519
- const { kty: e, e: r, n: o, x: s, y: n, crv: i } = await crypto.subtle.exportKey("jwk", t), u = { kty: e, e: r, n: o, x: s, y: n, crv: i };
520
- return W.set(t, u), u;
513
+ let K;
514
+ async function ct(t) {
515
+ const { kty: e, e: n, n: o, x: s, y: r, crv: i } = await crypto.subtle.exportKey("jwk", t), u = { kty: e, e: n, n: o, x: s, y: r, crv: i };
516
+ return K.set(t, u), u;
521
517
  }
522
- async function ft(t) {
523
- return W || (W = /* @__PURE__ */ new WeakMap()), W.get(t) || ht(t);
518
+ async function ut(t) {
519
+ return K || (K = /* @__PURE__ */ new WeakMap()), K.get(t) || ct(t);
524
520
  }
525
- function pt(t, e, r) {
521
+ function lt(t, e, n) {
526
522
  if (typeof t != "string")
527
523
  throw new TypeError(`"as.${e}" must be a string`);
528
524
  return new URL(t);
529
525
  }
530
- function _e(t, e, r) {
531
- return pt(t[e], e);
526
+ function ye(t, e, n) {
527
+ return lt(t[e], e);
532
528
  }
533
- function Z(t) {
529
+ function V(t) {
534
530
  const e = t;
535
531
  return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
536
532
  }
537
- async function wt(t, e, r, o, s, n) {
538
- if (!p(t))
533
+ async function ht(t, e, n, o, s, r) {
534
+ if (!g(t))
539
535
  throw new TypeError('"accessToken" must be a non-empty string');
540
- if (!(r instanceof URL))
536
+ if (!(n instanceof URL))
541
537
  throw new TypeError('"url" must be an instance of URL');
542
- return o = $(o), (n == null ? void 0 : n.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await dt(o, n.DPoP, r, "GET", I({ [H]: n == null ? void 0 : n[H] }), t), o.set("authorization", `DPoP ${t}`)), ((n == null ? void 0 : n[X]) || fetch)(r.href, {
538
+ return o = H(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await at(o, r.DPoP, n, "GET", I({ [W]: r == null ? void 0 : r[W] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[Z]) || fetch)(n.href, {
543
539
  body: s,
544
540
  headers: Object.fromEntries(o.entries()),
545
541
  method: e,
546
542
  redirect: "manual",
547
- signal: n != null && n.signal ? te(n.signal) : null
548
- }).then(ee);
543
+ signal: r != null && r.signal ? X(r.signal) : null
544
+ }).then(Q);
549
545
  }
550
- async function gt(t, e, r, o) {
551
- j(t), J(e);
552
- const s = _e(t, "userinfo_endpoint"), n = $(o == null ? void 0 : o.headers);
553
- return e.userinfo_signed_response_alg ? n.set("accept", "application/jwt") : (n.set("accept", "application/json"), n.append("accept", "application/jwt")), wt(r, "GET", s, n, null, {
546
+ async function dt(t, e, n, o) {
547
+ J(t), j(e);
548
+ const s = ye(t, "userinfo_endpoint"), r = H(o == null ? void 0 : o.headers);
549
+ return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), ht(n, "GET", s, r, null, {
554
550
  ...o,
555
- [H]: I(e)
551
+ [W]: I(e)
556
552
  });
557
553
  }
558
- async function mt(t, e, r, o, s, n, i) {
559
- return await lt(t, e, s, n, i == null ? void 0 : i.clientPrivateKey), n.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[X]) || fetch)(o.href, {
554
+ async function ft(t, e, n, o, s, r, i) {
555
+ return await st(t, e, s, r, i == null ? void 0 : i.clientPrivateKey), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Z]) || fetch)(o.href, {
560
556
  body: s,
561
- headers: Object.fromEntries(n.entries()),
562
- method: r,
557
+ headers: Object.fromEntries(r.entries()),
558
+ method: n,
563
559
  redirect: "manual",
564
- signal: i != null && i.signal ? te(i.signal) : null
565
- }).then(ee);
560
+ signal: i != null && i.signal ? X(i.signal) : null
561
+ }).then(Q);
566
562
  }
567
- async function ve(t, e, r, o, s) {
568
- const n = _e(t, "token_endpoint");
569
- o.set("grant_type", r);
570
- const i = $(s == null ? void 0 : s.headers);
571
- return i.set("accept", "application/json"), mt(t, e, "POST", n, o, i, s);
563
+ async function be(t, e, n, o, s) {
564
+ const r = ye(t, "token_endpoint");
565
+ o.set("grant_type", n);
566
+ const i = H(s == null ? void 0 : s.headers);
567
+ return i.set("accept", "application/json"), ft(t, e, "POST", r, o, i, s);
572
568
  }
573
- async function yt(t, e, r, o) {
574
- if (j(t), J(e), !p(r))
569
+ async function pt(t, e, n, o) {
570
+ if (J(t), j(e), !g(n))
575
571
  throw new TypeError('"refreshToken" must be a non-empty string');
576
572
  const s = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
577
- return s.set("refresh_token", r), ve(t, e, "refresh_token", s, o);
573
+ return s.set("refresh_token", n), be(t, e, "refresh_token", s, o);
578
574
  }
579
- const Se = /* @__PURE__ */ new WeakMap();
580
- function bt(t) {
575
+ const _e = /* @__PURE__ */ new WeakMap();
576
+ function wt(t) {
581
577
  if (!t.id_token)
582
578
  return;
583
- const e = Se.get(t);
579
+ const e = _e.get(t);
584
580
  if (!e)
585
581
  throw new TypeError('"ref" was already garbage collected or did not resolve from the proper sources');
586
582
  return e;
587
583
  }
588
- async function Te(t, e, r, o = !1, s = !1) {
589
- if (j(t), J(e), !Q(r, Response))
584
+ async function ve(t, e, n, o = !1, s = !1) {
585
+ if (J(t), j(e), !Y(n, Response))
590
586
  throw new TypeError('"response" must be an instance of Response');
591
- if (r.status !== 200) {
587
+ if (n.status !== 200) {
592
588
  let i;
593
- if (i = await xt(r))
589
+ if (i = await kt(n))
594
590
  return i;
595
591
  throw new a('"response" is not a conform Token Endpoint response');
596
592
  }
597
- re(r);
598
- let n;
593
+ ee(n);
594
+ let r;
599
595
  try {
600
- n = await r.json();
596
+ r = await n.json();
601
597
  } catch (i) {
602
598
  throw new a('failed to parse "response" body as JSON', { cause: i });
603
599
  }
604
- if (!C(n))
600
+ if (!x(r))
605
601
  throw new a('"response" body must be a top level object');
606
- if (!p(n.access_token))
602
+ if (!g(r.access_token))
607
603
  throw new a('"response" body "access_token" property must be a non-empty string');
608
- if (!p(n.token_type))
604
+ if (!g(r.token_type))
609
605
  throw new a('"response" body "token_type" property must be a non-empty string');
610
- if (n.token_type = n.token_type.toLowerCase(), n.token_type !== "dpop" && n.token_type !== "bearer")
611
- throw new S("unsupported `token_type` value");
612
- if (n.expires_in !== void 0 && (typeof n.expires_in != "number" || n.expires_in <= 0))
606
+ if (r.token_type = r.token_type.toLowerCase(), r.token_type !== "dpop" && r.token_type !== "bearer")
607
+ throw new v("unsupported `token_type` value");
608
+ if (r.expires_in !== void 0 && (typeof r.expires_in != "number" || r.expires_in <= 0))
613
609
  throw new a('"response" body "expires_in" property must be a positive number');
614
- if (!s && n.refresh_token !== void 0 && !p(n.refresh_token))
610
+ if (!s && r.refresh_token !== void 0 && !g(r.refresh_token))
615
611
  throw new a('"response" body "refresh_token" property must be a non-empty string');
616
- if (n.scope !== void 0 && typeof n.scope != "string")
612
+ if (r.scope !== void 0 && typeof r.scope != "string")
617
613
  throw new a('"response" body "scope" property must be a string');
618
614
  if (!o) {
619
- if (n.id_token !== void 0 && !p(n.id_token))
615
+ if (r.id_token !== void 0 && !g(r.id_token))
620
616
  throw new a('"response" body "id_token" property must be a non-empty string');
621
- if (n.id_token) {
622
- const { claims: i } = await Lt(n.id_token, Ct.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ae, I(e), ye(e)).then(At.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(St.bind(void 0, t.issuer)).then(vt.bind(void 0, e.client_id));
617
+ if (r.id_token) {
618
+ const { claims: i } = await Rt(r.id_token, Pt.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ee, I(e), ge(e)).then(St.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(yt.bind(void 0, t.issuer)).then(mt.bind(void 0, e.client_id));
623
619
  if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== e.client_id)
624
620
  throw new a('unexpected ID Token "azp" (authorized party) claim value');
625
621
  if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
626
622
  throw new a('ID Token "auth_time" (authentication time) must be a positive number');
627
- Se.set(n, i);
623
+ _e.set(r, i);
628
624
  }
629
625
  }
630
- return n;
626
+ return r;
631
627
  }
632
- async function _t(t, e, r) {
633
- return Te(t, e, r);
628
+ async function gt(t, e, n) {
629
+ return ve(t, e, n);
634
630
  }
635
- function vt(t, e) {
631
+ function mt(t, e) {
636
632
  if (Array.isArray(e.claims.aud)) {
637
633
  if (!e.claims.aud.includes(t))
638
634
  throw new a('unexpected JWT "aud" (audience) claim value');
@@ -640,29 +636,29 @@ function vt(t, e) {
640
636
  throw new a('unexpected JWT "aud" (audience) claim value');
641
637
  return e;
642
638
  }
643
- function St(t, e) {
639
+ function yt(t, e) {
644
640
  if (e.claims.iss !== t)
645
641
  throw new a('unexpected JWT "iss" (issuer) claim value');
646
642
  return e;
647
643
  }
648
- const ke = /* @__PURE__ */ new WeakSet();
649
- function Tt(t) {
650
- return ke.add(t), t;
644
+ const Se = /* @__PURE__ */ new WeakSet();
645
+ function bt(t) {
646
+ return Se.add(t), t;
651
647
  }
652
- async function kt(t, e, r, o, s, n) {
653
- if (j(t), J(e), !ke.has(r))
648
+ async function _t(t, e, n, o, s, r) {
649
+ if (J(t), j(e), !Se.has(n))
654
650
  throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
655
- if (!p(o))
651
+ if (!g(o))
656
652
  throw new TypeError('"redirectUri" must be a non-empty string');
657
- if (!p(s))
653
+ if (!g(s))
658
654
  throw new TypeError('"codeVerifier" must be a non-empty string');
659
- const i = T(r, "code");
655
+ const i = T(n, "code");
660
656
  if (!i)
661
657
  throw new a('no authorization code in "callbackParameters"');
662
- const u = new URLSearchParams(n == null ? void 0 : n.additionalParameters);
663
- return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i), ve(t, e, "authorization_code", u, n);
658
+ const u = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
659
+ return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i), be(t, e, "authorization_code", u, r);
664
660
  }
665
- const Et = {
661
+ const vt = {
666
662
  aud: "audience",
667
663
  c_hash: "code hash",
668
664
  client_id: "client id",
@@ -678,66 +674,66 @@ const Et = {
678
674
  htu: "http uri",
679
675
  cnf: "confirmation"
680
676
  };
681
- function At(t, e) {
682
- for (const r of t)
683
- if (e.claims[r] === void 0)
684
- throw new a(`JWT "${r}" (${Et[r]}) claim missing`);
677
+ function St(t, e) {
678
+ for (const n of t)
679
+ if (e.claims[n] === void 0)
680
+ throw new a(`JWT "${n}" (${vt[n]}) claim missing`);
685
681
  return e;
686
682
  }
687
- const Rt = Symbol(), G = Symbol();
688
- async function Pt(t, e, r, o, s) {
689
- const n = await Te(t, e, r);
690
- if (Z(n))
691
- return n;
692
- if (!p(n.id_token))
683
+ const Tt = Symbol(), B = Symbol();
684
+ async function Et(t, e, n, o, s) {
685
+ const r = await ve(t, e, n);
686
+ if (V(r))
687
+ return r;
688
+ if (!g(r.id_token))
693
689
  throw new a('"response" body "id_token" property must be a non-empty string');
694
- s ?? (s = e.default_max_age ?? G);
695
- const i = bt(n);
696
- if ((e.require_auth_time || s !== G) && i.auth_time === void 0)
690
+ s ?? (s = e.default_max_age ?? B);
691
+ const i = wt(r);
692
+ if ((e.require_auth_time || s !== B) && i.auth_time === void 0)
697
693
  throw new a('ID Token "auth_time" (authentication time) claim missing');
698
- if (s !== G) {
694
+ if (s !== B) {
699
695
  if (typeof s != "number" || s < 0)
700
696
  throw new TypeError('"maxAge" must be a non-negative number');
701
- const u = M() + I(e), f = ye(e);
702
- if (i.auth_time + s < u - f)
697
+ const u = F() + I(e), d = ge(e);
698
+ if (i.auth_time + s < u - d)
703
699
  throw new a("too much time has elapsed since the last End-User authentication");
704
700
  }
705
701
  switch (o) {
706
702
  case void 0:
707
- case Rt:
703
+ case Tt:
708
704
  if (i.nonce !== void 0)
709
705
  throw new a('unexpected ID Token "nonce" claim value');
710
706
  break;
711
707
  default:
712
- if (!p(o))
708
+ if (!g(o))
713
709
  throw new TypeError('"expectedNonce" must be a non-empty string');
714
710
  if (i.nonce === void 0)
715
711
  throw new a('ID Token "nonce" claim missing');
716
712
  if (i.nonce !== o)
717
713
  throw new a('unexpected ID Token "nonce" claim value');
718
714
  }
719
- return n;
715
+ return r;
720
716
  }
721
- function re(t) {
717
+ function ee(t) {
722
718
  if (t.bodyUsed)
723
719
  throw new TypeError('"response" body has been used already');
724
720
  }
725
- async function xt(t) {
721
+ async function kt(t) {
726
722
  if (t.status > 399 && t.status < 500) {
727
- re(t);
723
+ ee(t);
728
724
  try {
729
725
  const e = await t.json();
730
- if (C(e) && typeof e.error == "string" && e.error.length)
726
+ if (x(e) && typeof e.error == "string" && e.error.length)
731
727
  return e.error_description !== void 0 && typeof e.error_description != "string" && delete e.error_description, e.error_uri !== void 0 && typeof e.error_uri != "string" && delete e.error_uri, e.algs !== void 0 && typeof e.algs != "string" && delete e.algs, e.scope !== void 0 && typeof e.scope != "string" && delete e.scope, e;
732
728
  } catch {
733
729
  }
734
730
  }
735
731
  }
736
- function le(t) {
732
+ function ce(t) {
737
733
  if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
738
734
  throw new a(`${t.name} modulusLength must be at least 2048 bits`);
739
735
  }
740
- function Ut(t) {
736
+ function At(t) {
741
737
  switch (t) {
742
738
  case "P-256":
743
739
  return "SHA-256";
@@ -746,18 +742,18 @@ function Ut(t) {
746
742
  case "P-521":
747
743
  return "SHA-512";
748
744
  default:
749
- throw new S();
745
+ throw new v();
750
746
  }
751
747
  }
752
- function Ee(t) {
748
+ function Te(t) {
753
749
  switch (t.algorithm.name) {
754
750
  case "ECDSA":
755
751
  return {
756
752
  name: t.algorithm.name,
757
- hash: Ut(t.algorithm.namedCurve)
753
+ hash: At(t.algorithm.namedCurve)
758
754
  };
759
755
  case "RSA-PSS":
760
- switch (le(t.algorithm), t.algorithm.hash.name) {
756
+ switch (ce(t.algorithm), t.algorithm.hash.name) {
761
757
  case "SHA-256":
762
758
  case "SHA-384":
763
759
  case "SHA-512":
@@ -766,271 +762,255 @@ function Ee(t) {
766
762
  saltLength: parseInt(t.algorithm.hash.name.slice(-3), 10) >> 3
767
763
  };
768
764
  default:
769
- throw new S();
765
+ throw new v();
770
766
  }
771
767
  case "RSASSA-PKCS1-v1_5":
772
- return le(t.algorithm), t.algorithm.name;
768
+ return ce(t.algorithm), t.algorithm.name;
773
769
  case "Ed448":
774
770
  case "Ed25519":
775
771
  return t.algorithm.name;
776
772
  }
777
- throw new S();
778
- }
779
- const Ae = Symbol();
780
- async function Lt(t, e, r, o, s) {
781
- const { 0: n, 1: i, 2: u, length: f } = t.split(".");
782
- if (f === 5)
783
- throw new S("JWE structure JWTs are not supported");
784
- if (f !== 3)
773
+ throw new v();
774
+ }
775
+ const Ee = Symbol();
776
+ async function Rt(t, e, n, o, s) {
777
+ const { 0: r, 1: i, 2: u, length: d } = t.split(".");
778
+ if (d === 5)
779
+ throw new v("JWE structure JWTs are not supported");
780
+ if (d !== 3)
785
781
  throw new a("Invalid JWT");
786
- let m;
782
+ let p;
787
783
  try {
788
- m = JSON.parse(A(k(n)));
789
- } catch (P) {
790
- throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: P });
784
+ p = JSON.parse(k(E(r)));
785
+ } catch (S) {
786
+ throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: S });
791
787
  }
792
- if (!C(m))
788
+ if (!x(p))
793
789
  throw new a("JWT Header must be a top level object");
794
- if (e(m), m.crit !== void 0)
790
+ if (e(p), p.crit !== void 0)
795
791
  throw new a('unexpected JWT "crit" header parameter');
796
- const y = k(u);
792
+ const w = E(u);
797
793
  let b;
798
- if (r !== Ae) {
799
- b = await r(m);
800
- const P = `${n}.${i}`;
801
- if (!await crypto.subtle.verify(Ee(b), b, y, A(P)))
794
+ if (n !== Ee) {
795
+ b = await n(p);
796
+ const S = `${r}.${i}`;
797
+ if (!await crypto.subtle.verify(Te(b), b, w, k(S)))
802
798
  throw new a("JWT signature verification failed");
803
799
  }
804
- let h;
800
+ let f;
805
801
  try {
806
- h = JSON.parse(A(k(i)));
807
- } catch (P) {
808
- throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: P });
802
+ f = JSON.parse(k(E(i)));
803
+ } catch (S) {
804
+ throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: S });
809
805
  }
810
- if (!C(h))
806
+ if (!x(f))
811
807
  throw new a("JWT Payload must be a top level object");
812
- const R = M() + o;
813
- if (h.exp !== void 0) {
814
- if (typeof h.exp != "number")
808
+ const A = F() + o;
809
+ if (f.exp !== void 0) {
810
+ if (typeof f.exp != "number")
815
811
  throw new a('unexpected JWT "exp" (expiration time) claim type');
816
- if (h.exp <= R - s)
812
+ if (f.exp <= A - s)
817
813
  throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
818
814
  }
819
- if (h.iat !== void 0 && typeof h.iat != "number")
815
+ if (f.iat !== void 0 && typeof f.iat != "number")
820
816
  throw new a('unexpected JWT "iat" (issued at) claim type');
821
- if (h.iss !== void 0 && typeof h.iss != "string")
817
+ if (f.iss !== void 0 && typeof f.iss != "string")
822
818
  throw new a('unexpected JWT "iss" (issuer) claim type');
823
- if (h.nbf !== void 0) {
824
- if (typeof h.nbf != "number")
819
+ if (f.nbf !== void 0) {
820
+ if (typeof f.nbf != "number")
825
821
  throw new a('unexpected JWT "nbf" (not before) claim type');
826
- if (h.nbf > R + s)
822
+ if (f.nbf > A + s)
827
823
  throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
828
824
  }
829
- if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
825
+ if (f.aud !== void 0 && typeof f.aud != "string" && !Array.isArray(f.aud))
830
826
  throw new a('unexpected JWT "aud" (audience) claim type');
831
- return { header: m, claims: h, signature: y, key: b };
827
+ return { header: p, claims: f, signature: w, key: b };
832
828
  }
833
- function Ct(t, e, r) {
829
+ function Pt(t, e, n) {
834
830
  if (t !== void 0) {
835
- if (r.alg !== t)
831
+ if (n.alg !== t)
836
832
  throw new a('unexpected JWT "alg" header parameter');
837
833
  return;
838
834
  }
839
835
  if (Array.isArray(e)) {
840
- if (!e.includes(r.alg))
836
+ if (!e.includes(n.alg))
841
837
  throw new a('unexpected JWT "alg" header parameter');
842
838
  return;
843
839
  }
844
- if (r.alg !== "RS256")
840
+ if (n.alg !== "RS256")
845
841
  throw new a('unexpected JWT "alg" header parameter');
846
842
  }
847
843
  function T(t, e) {
848
- const { 0: r, length: o } = t.getAll(e);
844
+ const { 0: n, length: o } = t.getAll(e);
849
845
  if (o > 1)
850
846
  throw new a(`"${e}" parameter must be provided only once`);
851
- return r;
847
+ return n;
852
848
  }
853
- const It = Symbol(), jt = Symbol();
854
- function Jt(t, e, r, o) {
855
- if (j(t), J(e), r instanceof URL && (r = r.searchParams), !(r instanceof URLSearchParams))
849
+ const Ut = Symbol(), Lt = Symbol();
850
+ function Ct(t, e, n, o) {
851
+ if (J(t), j(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
856
852
  throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
857
- if (T(r, "response"))
853
+ if (T(n, "response"))
858
854
  throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
859
- const s = T(r, "iss"), n = T(r, "state");
855
+ const s = T(n, "iss"), r = T(n, "state");
860
856
  if (!s && t.authorization_response_iss_parameter_supported)
861
857
  throw new a('response parameter "iss" (issuer) missing');
862
858
  if (s && s !== t.issuer)
863
859
  throw new a('unexpected "iss" (issuer) response parameter value');
864
860
  switch (o) {
865
861
  case void 0:
866
- case jt:
867
- if (n !== void 0)
862
+ case Lt:
863
+ if (r !== void 0)
868
864
  throw new a('unexpected "state" response parameter encountered');
869
865
  break;
870
- case It:
866
+ case Ut:
871
867
  break;
872
868
  default:
873
- if (!p(o))
869
+ if (!g(o))
874
870
  throw new a('"expectedState" must be a non-empty string');
875
- if (n === void 0)
871
+ if (r === void 0)
876
872
  throw new a('response parameter "state" missing');
877
- if (n !== o)
873
+ if (r !== o)
878
874
  throw new a('unexpected "state" response parameter value');
879
875
  }
880
- const i = T(r, "error");
876
+ const i = T(n, "error");
881
877
  if (i)
882
878
  return {
883
879
  error: i,
884
- error_description: T(r, "error_description"),
885
- error_uri: T(r, "error_uri")
880
+ error_description: T(n, "error_description"),
881
+ error_uri: T(n, "error_uri")
886
882
  };
887
- const u = T(r, "id_token"), f = T(r, "token");
888
- if (u !== void 0 || f !== void 0)
889
- throw new S("implicit and hybrid flows are not supported");
890
- return Tt(new URLSearchParams(r));
883
+ const u = T(n, "id_token"), d = T(n, "token");
884
+ if (u !== void 0 || d !== void 0)
885
+ throw new v("implicit and hybrid flows are not supported");
886
+ return bt(new URLSearchParams(n));
891
887
  }
892
- function Ot({
888
+ function xt({
893
889
  handleCallback: t
894
890
  }) {
895
- const [e, r] = Je(null), o = He(), s = Oe(!1);
896
- return Ne(() => {
897
- s.current || (s.current = !0, t().then((n) => {
898
- o(n);
899
- }).catch((n) => {
900
- K.error(n), r(n);
891
+ const [e, n] = Ce(null), o = ze(), s = xe(!1);
892
+ return Ie(() => {
893
+ s.current || (s.current = !0, t().then((r) => {
894
+ o(r);
895
+ }).catch((r) => {
896
+ D.error(r), n(r);
901
897
  }));
902
- }, [o, t]), e ? /* @__PURE__ */ E.jsx(
903
- De,
898
+ }, [o, t]), e ? /* @__PURE__ */ React.createElement(
899
+ je,
904
900
  {
905
901
  category: "Error",
906
902
  title: "Authentication Error",
907
- message: /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
908
- /* @__PURE__ */ E.jsx(ze, { className: "mb-4", children: "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly." }),
909
- "An error occurred while authorizing the user.",
910
- /* @__PURE__ */ E.jsx(We, { code: e.toString(), language: "plain" })
911
- ] })
903
+ message: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Je, { className: "mb-4" }, "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly."), "An error occurred while authorizing the user.", /* @__PURE__ */ React.createElement(Ne, { code: e.toString(), language: "plain" }))
912
904
  }
913
- ) : /* @__PURE__ */ E.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ E.jsx(Ke, {}) });
905
+ ) : /* @__PURE__ */ React.createElement("div", { className: "grid h-full place-items-center" }, /* @__PURE__ */ React.createElement(Oe, null));
914
906
  }
915
907
  class U extends Error {
916
908
  }
917
- class de extends U {
918
- constructor(e, r, o) {
919
- super(e, o), this.error = r;
909
+ class ue extends U {
910
+ constructor(e, n, o) {
911
+ super(e, o), this.error = n;
920
912
  }
921
913
  }
922
- const V = "code-verifier";
923
- class Nt extends je {
924
- constructor(e, r) {
925
- super(), this.callbackUrlPath = e, this.handleCallback = r;
914
+ const q = "code-verifier";
915
+ class It extends Le {
916
+ constructor(e, n) {
917
+ super(), this.callbackUrlPath = e, this.handleCallback = n;
926
918
  }
927
919
  getRoutes() {
928
920
  return [
929
921
  ...super.getRoutes(),
930
922
  {
931
923
  path: this.callbackUrlPath,
932
- element: /* @__PURE__ */ E.jsx(Ot, { handleCallback: this.handleCallback })
924
+ element: /* @__PURE__ */ React.createElement(xt, { handleCallback: this.handleCallback })
933
925
  }
934
926
  ];
935
927
  }
936
928
  }
937
- class zt {
929
+ class Jt {
938
930
  constructor({
939
931
  issuer: e,
940
- audience: r,
932
+ audience: n,
941
933
  clientId: o,
942
934
  redirectToAfterSignUp: s,
943
- redirectToAfterSignIn: n,
935
+ redirectToAfterSignIn: r,
944
936
  redirectToAfterSignOut: i
945
937
  }) {
946
- _(this, "client");
947
- _(this, "issuer");
948
- _(this, "authorizationServer");
949
- _(this, "callbackUrlPath", "/oauth/callback");
950
- _(this, "logoutRedirectUrlPath", "/");
951
- _(this, "onAuthorizationUrl");
952
- _(this, "redirectToAfterSignUp");
953
- _(this, "redirectToAfterSignIn");
954
- _(this, "redirectToAfterSignOut");
955
- _(this, "audience");
956
- _(this, "signOut", async () => {
957
- z.setState({
938
+ this.callbackUrlPath = "/oauth/callback", this.logoutRedirectUrlPath = "/", this.signOut = async () => {
939
+ N.setState({
958
940
  isAuthenticated: !1,
959
941
  isPending: !1,
960
942
  profile: void 0
961
943
  }), sessionStorage.clear();
962
- const e = await this.getAuthServer(), r = new URL(
944
+ const u = await this.getAuthServer(), d = new URL(
963
945
  window.location.origin + this.redirectToAfterSignOut
964
946
  );
965
- r.pathname = this.logoutRedirectUrlPath;
966
- let o;
967
- e.end_session_endpoint ? (o = new URL(e.end_session_endpoint), o.searchParams.set(
947
+ d.pathname = this.logoutRedirectUrlPath;
948
+ let p;
949
+ u.end_session_endpoint ? (p = new URL(u.end_session_endpoint), p.searchParams.set(
968
950
  "post_logout_redirect_uri",
969
- r.toString()
970
- )) : o = r;
971
- });
972
- _(this, "handleCallback", async () => {
973
- const e = new URL(window.location.href), r = e.searchParams.get("state"), o = sessionStorage.getItem(V);
974
- if (sessionStorage.removeItem(V), !o)
951
+ d.toString()
952
+ )) : p = d;
953
+ }, this.handleCallback = async () => {
954
+ const u = new URL(window.location.href), d = u.searchParams.get("state"), p = sessionStorage.getItem(q);
955
+ if (sessionStorage.removeItem(q), !p)
975
956
  throw new U("No code verifier found in state.");
976
- const s = await this.getAuthServer(), n = Jt(
977
- s,
957
+ const w = await this.getAuthServer(), b = Ct(
958
+ w,
978
959
  this.client,
979
- e.searchParams,
980
- r ?? void 0
960
+ u.searchParams,
961
+ d ?? void 0
981
962
  );
982
- if (Z(n))
983
- throw K.error("Error validating OAuth response", n), new de(
963
+ if (V(b))
964
+ throw D.error("Error validating OAuth response", b), new ue(
984
965
  "Error validating OAuth response",
985
- n
966
+ b
986
967
  );
987
- const i = new URL(e);
988
- i.pathname = this.redirectToAfterSignIn, i.search = "";
989
- const u = await kt(
990
- s,
968
+ const f = new URL(u);
969
+ f.pathname = this.redirectToAfterSignIn, f.search = "";
970
+ const A = await _t(
971
+ w,
991
972
  this.client,
992
- n,
993
- i.toString(),
994
- o
995
- ), f = await Pt(
996
- s,
973
+ b,
974
+ f.toString(),
975
+ p
976
+ ), S = await Et(
977
+ w,
997
978
  this.client,
998
- u
979
+ A
999
980
  );
1000
- this.setTokensFromResponse(f);
1001
- const m = await this.getAccessToken(), b = await (await gt(
1002
- s,
981
+ this.setTokensFromResponse(S);
982
+ const l = await this.getAccessToken(), c = await (await dt(
983
+ w,
1003
984
  this.client,
1004
- m
1005
- )).json(), h = {
1006
- sub: b.sub,
1007
- email: b.email,
1008
- name: b.name,
1009
- emailVerified: b.email_verified ?? !1,
1010
- pictureUrl: b.picture
985
+ l
986
+ )).json(), R = {
987
+ sub: c.sub,
988
+ email: c.email,
989
+ name: c.name,
990
+ emailVerified: c.email_verified ?? !1,
991
+ pictureUrl: c.picture
1011
992
  };
1012
- z.setState({
993
+ N.setState({
1013
994
  isAuthenticated: !0,
1014
995
  isPending: !1,
1015
- profile: h
996
+ profile: R
1016
997
  }), sessionStorage.setItem(
1017
998
  "profile-state",
1018
- JSON.stringify(z.getState().profile)
999
+ JSON.stringify(N.getState().profile)
1019
1000
  );
1020
- const R = sessionStorage.getItem("redirect-to") ?? "/";
1021
- return sessionStorage.removeItem("redirect-to"), R;
1022
- });
1023
- this.client = {
1001
+ const L = sessionStorage.getItem("redirect-to") ?? "/";
1002
+ return sessionStorage.removeItem("redirect-to"), L;
1003
+ }, this.client = {
1024
1004
  client_id: o,
1025
1005
  token_endpoint_auth_method: "none"
1026
- }, this.audience = r, this.issuer = e, this.redirectToAfterSignUp = s ?? "/", this.redirectToAfterSignIn = n ?? "/", this.redirectToAfterSignOut = i ?? "/";
1006
+ }, this.audience = n, this.issuer = e, this.redirectToAfterSignUp = s ?? "/", this.redirectToAfterSignIn = r ?? "/", this.redirectToAfterSignOut = i ?? "/";
1027
1007
  }
1028
1008
  async getAuthServer() {
1029
1009
  if (!this.authorizationServer) {
1030
- const e = new URL(this.issuer), r = await Qe(e);
1031
- this.authorizationServer = await Xe(
1010
+ const e = new URL(this.issuer), n = await Ge(e);
1011
+ this.authorizationServer = await Ve(
1032
1012
  e,
1033
- r
1013
+ n
1034
1014
  );
1035
1015
  }
1036
1016
  return this.authorizationServer;
@@ -1040,17 +1020,17 @@ class zt {
1040
1020
  * @param response
1041
1021
  */
1042
1022
  setTokensFromResponse(e) {
1043
- if (Z(e))
1044
- throw K.error("Bad Token Response", e), new de("Bad Token Response", e);
1023
+ if (V(e))
1024
+ throw D.error("Bad Token Response", e), new ue("Bad Token Response", e);
1045
1025
  if (!e.expires_in)
1046
1026
  throw new U("No expires_in in response");
1047
- const r = {
1027
+ const n = {
1048
1028
  accessToken: e.access_token,
1049
1029
  refreshToken: e.refresh_token,
1050
1030
  expiresOn: new Date(Date.now() + e.expires_in * 1e3),
1051
1031
  tokenType: e.token_type
1052
1032
  };
1053
- sessionStorage.setItem("token-state", JSON.stringify(r));
1033
+ sessionStorage.setItem("token-state", JSON.stringify(n));
1054
1034
  }
1055
1035
  async signUp({ redirectTo: e } = {}) {
1056
1036
  return this.authorize({
@@ -1065,51 +1045,51 @@ class zt {
1065
1045
  }
1066
1046
  async authorize({
1067
1047
  redirectTo: e,
1068
- isSignUp: r = !1
1048
+ isSignUp: n = !1
1069
1049
  }) {
1070
- var m, y;
1050
+ var p, w;
1071
1051
  const o = "S256", s = await this.getAuthServer();
1072
1052
  if (!s.authorization_endpoint)
1073
1053
  throw new U("No authorization endpoint");
1074
- const n = et(), i = await rt(n);
1075
- sessionStorage.setItem(V, n);
1054
+ const r = Ye(), i = await Qe(r);
1055
+ sessionStorage.setItem(q, r);
1076
1056
  const u = new URL(
1077
1057
  s.authorization_endpoint
1078
1058
  );
1079
1059
  sessionStorage.setItem("redirect-to", e);
1080
- const f = new URL(window.location.origin);
1081
- if (f.pathname = this.callbackUrlPath, f.search = "", u.searchParams.set("client_id", this.client.client_id), u.searchParams.set("redirect_uri", f.toString()), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", "openid profile email"), u.searchParams.set("code_challenge", i), u.searchParams.set(
1060
+ const d = new URL(window.location.origin);
1061
+ if (d.pathname = this.callbackUrlPath, d.search = "", u.searchParams.set("client_id", this.client.client_id), u.searchParams.set("redirect_uri", d.toString()), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", "openid profile email"), u.searchParams.set("code_challenge", i), u.searchParams.set(
1082
1062
  "code_challenge_method",
1083
1063
  o
1084
- ), this.audience && u.searchParams.set("audience", this.audience), (m = this.onAuthorizationUrl) == null || m.call(this, u, {
1085
- isSignIn: !r,
1086
- isSignUp: r
1087
- }), ((y = s.code_challenge_methods_supported) == null ? void 0 : y.includes("S256")) !== !0) {
1088
- const b = tt();
1064
+ ), this.audience && u.searchParams.set("audience", this.audience), (p = this.onAuthorizationUrl) == null || p.call(this, u, {
1065
+ isSignIn: !n,
1066
+ isSignUp: n
1067
+ }), ((w = s.code_challenge_methods_supported) == null ? void 0 : w.includes("S256")) !== !0) {
1068
+ const b = Ze();
1089
1069
  u.searchParams.set("state", b);
1090
1070
  }
1091
1071
  location.href = u.href;
1092
1072
  }
1093
1073
  async getAccessToken() {
1094
- const e = await this.getAuthServer(), r = sessionStorage.getItem("token-state");
1095
- if (!r)
1074
+ const e = await this.getAuthServer(), n = sessionStorage.getItem("token-state");
1075
+ if (!n)
1096
1076
  throw new U("User is not authenticated");
1097
- const o = JSON.parse(r);
1077
+ const o = JSON.parse(n);
1098
1078
  if (o.expiresOn < /* @__PURE__ */ new Date()) {
1099
1079
  if (!o.refreshToken)
1100
1080
  return await this.signIn(), "";
1101
- const s = await yt(
1081
+ const s = await pt(
1102
1082
  e,
1103
1083
  this.client,
1104
1084
  o.refreshToken
1105
- ), n = await _t(
1085
+ ), r = await gt(
1106
1086
  e,
1107
1087
  this.client,
1108
1088
  s
1109
1089
  );
1110
- if (!n.access_token)
1090
+ if (!r.access_token)
1111
1091
  throw new U("No access token in response");
1112
- return this.setTokensFromResponse(n), n.access_token.toString();
1092
+ return this.setTokensFromResponse(r), r.access_token.toString();
1113
1093
  } else
1114
1094
  return o.accessToken;
1115
1095
  }
@@ -1117,23 +1097,23 @@ class zt {
1117
1097
  const e = sessionStorage.getItem("profile-state");
1118
1098
  if (e)
1119
1099
  try {
1120
- const r = JSON.parse(e);
1121
- z.setState({
1100
+ const n = JSON.parse(e);
1101
+ N.setState({
1122
1102
  isAuthenticated: !0,
1123
1103
  isPending: !1,
1124
- profile: r
1104
+ profile: n
1125
1105
  });
1126
- } catch (r) {
1127
- K.error("Error parsing auth state", r);
1106
+ } catch (n) {
1107
+ D.error("Error parsing auth state", n);
1128
1108
  }
1129
1109
  }
1130
1110
  getAuthenticationPlugin() {
1131
- return new Nt(this.callbackUrlPath, this.handleCallback);
1111
+ return new It(this.callbackUrlPath, this.handleCallback);
1132
1112
  }
1133
1113
  }
1134
- const Yt = (t) => new zt(t);
1114
+ const Ft = (t) => new Jt(t);
1135
1115
  export {
1136
- zt as OpenIDAuthenticationProvider,
1137
- Yt as default
1116
+ Jt as OpenIDAuthenticationProvider,
1117
+ Ft as default
1138
1118
  };
1139
1119
  //# sourceMappingURL=zudoku.auth-openid.js.map