zudoku 0.35.5 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/app/entry.server.js +5 -1
  2. package/dist/app/entry.server.js.map +1 -1
  3. package/dist/config/validators/common.d.ts +176 -176
  4. package/dist/config/validators/common.js +8 -6
  5. package/dist/config/validators/common.js.map +1 -1
  6. package/dist/config/validators/validate.d.ts +63 -63
  7. package/dist/lib/authentication/providers/openid.js +11 -7
  8. package/dist/lib/authentication/providers/openid.js.map +1 -1
  9. package/dist/lib/components/AnchorLink.js +3 -2
  10. package/dist/lib/components/AnchorLink.js.map +1 -1
  11. package/dist/lib/components/Layout.js +3 -14
  12. package/dist/lib/components/Layout.js.map +1 -1
  13. package/dist/lib/components/Zudoku.js +3 -1
  14. package/dist/lib/components/Zudoku.js.map +1 -1
  15. package/dist/lib/components/cache.d.ts +7 -0
  16. package/dist/lib/components/cache.js +7 -0
  17. package/dist/lib/components/cache.js.map +1 -1
  18. package/dist/lib/components/context/ViewportAnchorContext.js +3 -6
  19. package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
  20. package/dist/lib/components/context/ZudokuContext.d.ts +1 -1
  21. package/dist/lib/components/context/ZudokuContext.js +4 -3
  22. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  23. package/dist/lib/components/navigation/SidebarItem.js +3 -2
  24. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  25. package/dist/lib/core/ZudokuContext.d.ts +8 -6
  26. package/dist/lib/core/ZudokuContext.js +4 -2
  27. package/dist/lib/core/ZudokuContext.js.map +1 -1
  28. package/dist/lib/core/plugins.d.ts +3 -3
  29. package/dist/lib/hooks/useEvent.test.js +1 -1
  30. package/dist/lib/hooks/useEvent.test.js.map +1 -1
  31. package/dist/lib/oas/graphql/index.d.ts +16 -4
  32. package/dist/lib/oas/graphql/index.js +59 -43
  33. package/dist/lib/oas/graphql/index.js.map +1 -1
  34. package/dist/lib/plugins/openapi/OperationList.js +19 -5
  35. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  36. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  37. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  38. package/dist/lib/plugins/openapi/Sidecar.js +2 -2
  39. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  40. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +1 -1
  41. package/dist/lib/plugins/openapi/client/useCreateQuery.js +2 -1
  42. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  43. package/dist/lib/plugins/openapi/graphql/gql.d.ts +4 -4
  44. package/dist/lib/plugins/openapi/graphql/gql.js +3 -3
  45. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  46. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +34 -45
  47. package/dist/lib/plugins/openapi/graphql/graphql.js +20 -30
  48. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  49. package/dist/lib/plugins/openapi/index.d.ts +5 -10
  50. package/dist/lib/plugins/openapi/index.js +29 -60
  51. package/dist/lib/plugins/openapi/index.js.map +1 -1
  52. package/dist/lib/plugins/openapi/interfaces.d.ts +3 -1
  53. package/dist/lib/plugins/openapi/util/createSidebarCategory.js +5 -7
  54. package/dist/lib/plugins/openapi/util/createSidebarCategory.js.map +1 -1
  55. package/dist/lib/util/traverse.js +2 -2
  56. package/dist/lib/util/traverse.js.map +1 -1
  57. package/dist/lib/util/useScrollToAnchor.js +2 -0
  58. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  59. package/dist/vite/api/schema-codegen.js +19 -4
  60. package/dist/vite/api/schema-codegen.js.map +1 -1
  61. package/dist/vite/api/schema-codegen.test.js +61 -0
  62. package/dist/vite/api/schema-codegen.test.js.map +1 -1
  63. package/dist/vite/plugin-api.js +3 -11
  64. package/dist/vite/plugin-api.js.map +1 -1
  65. package/lib/{AuthenticationPlugin-4ip08maU.js → AuthenticationPlugin-Cr6xjOJD.js} +2 -2
  66. package/lib/{AuthenticationPlugin-4ip08maU.js.map → AuthenticationPlugin-Cr6xjOJD.js.map} +1 -1
  67. package/lib/{Markdown-hBN9vkm5.js → Markdown-BlioIqkZ.js} +313 -311
  68. package/lib/Markdown-BlioIqkZ.js.map +1 -0
  69. package/lib/{MdxPage-UCWwxhzC.js → MdxPage-7XnN9J9R.js} +3 -3
  70. package/lib/{MdxPage-UCWwxhzC.js.map → MdxPage-7XnN9J9R.js.map} +1 -1
  71. package/lib/{OasProvider-CJ8KOnsH.js → OasProvider-BaRRMSsD.js} +3 -3
  72. package/lib/{OasProvider-CJ8KOnsH.js.map → OasProvider-BaRRMSsD.js.map} +1 -1
  73. package/lib/{OperationList-C4rpJdcE.js → OperationList-BjL1hzSx.js} +988 -961
  74. package/lib/OperationList-BjL1hzSx.js.map +1 -0
  75. package/lib/{SlotletProvider-D-XPr1Wg.js → SlotletProvider-CXb3wQiR.js} +2 -2
  76. package/lib/{SlotletProvider-D-XPr1Wg.js.map → SlotletProvider-CXb3wQiR.js.map} +1 -1
  77. package/lib/{circular-v7K6lDDh.js → circular-ByJI6Mci.js} +4887 -4419
  78. package/lib/circular-ByJI6Mci.js.map +1 -0
  79. package/lib/{createServer-BEFAOb-x.js → createServer-DjgKDpGV.js} +3887 -4291
  80. package/lib/createServer-DjgKDpGV.js.map +1 -0
  81. package/lib/{hook-CfCFKZ-2.js → hook-Bo80UX00.js} +75 -74
  82. package/lib/hook-Bo80UX00.js.map +1 -0
  83. package/lib/{index-Dowg8c_k.js → index-D5m8_oyY.js} +612 -650
  84. package/lib/index-D5m8_oyY.js.map +1 -0
  85. package/lib/post-processors/traverse.js +2 -2
  86. package/lib/post-processors/traverse.js.map +1 -1
  87. package/lib/zudoku.auth-auth0.js +1 -1
  88. package/lib/zudoku.auth-clerk.js +2 -2
  89. package/lib/zudoku.auth-openid.js +283 -282
  90. package/lib/zudoku.auth-openid.js.map +1 -1
  91. package/lib/zudoku.components.js +395 -397
  92. package/lib/zudoku.components.js.map +1 -1
  93. package/lib/zudoku.hooks.js +1 -1
  94. package/lib/zudoku.plugin-api-catalog.js +2 -2
  95. package/lib/zudoku.plugin-api-keys.js +2 -2
  96. package/lib/zudoku.plugin-custom-pages.js +1 -1
  97. package/lib/zudoku.plugin-markdown.js +1 -1
  98. package/lib/zudoku.plugin-openapi.js +4 -5
  99. package/lib/zudoku.plugin-openapi.js.map +1 -1
  100. package/lib/zudoku.plugins.js.map +1 -1
  101. package/package.json +5 -5
  102. package/src/app/entry.server.tsx +7 -1
  103. package/src/lib/authentication/providers/openid.tsx +12 -9
  104. package/src/lib/components/AnchorLink.tsx +4 -2
  105. package/src/lib/components/Layout.tsx +3 -16
  106. package/src/lib/components/Zudoku.tsx +5 -1
  107. package/src/lib/components/cache.ts +8 -0
  108. package/src/lib/components/context/ViewportAnchorContext.tsx +3 -6
  109. package/src/lib/components/context/ZudokuContext.ts +5 -4
  110. package/src/lib/components/navigation/SidebarItem.tsx +3 -2
  111. package/src/lib/core/ZudokuContext.ts +11 -8
  112. package/src/lib/core/plugins.ts +4 -4
  113. package/src/lib/hooks/useEvent.test.tsx +1 -1
  114. package/src/lib/oas/graphql/index.ts +116 -76
  115. package/src/lib/plugins/openapi/OperationList.tsx +31 -37
  116. package/src/lib/plugins/openapi/OperationListItem.tsx +1 -1
  117. package/src/lib/plugins/openapi/Sidecar.tsx +2 -2
  118. package/src/lib/plugins/openapi/client/useCreateQuery.ts +2 -1
  119. package/src/lib/plugins/openapi/graphql/gql.ts +17 -17
  120. package/src/lib/plugins/openapi/graphql/graphql.ts +62 -79
  121. package/src/lib/plugins/openapi/index.tsx +40 -84
  122. package/src/lib/plugins/openapi/interfaces.ts +4 -1
  123. package/src/lib/plugins/openapi/util/createSidebarCategory.tsx +5 -7
  124. package/src/lib/util/traverse.ts +2 -2
  125. package/src/lib/util/useScrollToAnchor.ts +2 -0
  126. package/lib/Markdown-hBN9vkm5.js.map +0 -1
  127. package/lib/OperationList-C4rpJdcE.js.map +0 -1
  128. package/lib/circular-v7K6lDDh.js.map +0 -1
  129. package/lib/createServer-BEFAOb-x.js.map +0 -1
  130. package/lib/hook-CfCFKZ-2.js.map +0 -1
  131. package/lib/index-Dowg8c_k.js.map +0 -1
@@ -1,20 +1,20 @@
1
- var Ue = Object.defineProperty;
2
- var Le = (t, e, n) => e in t ? Ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var _ = (t, e, n) => Le(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { j as q } from "./jsx-runtime-CYK1ROHF.js";
5
- import { g as xe } from "./_commonjsHelpers-BkfeUUK-.js";
6
- import { C as Ce } from "./ClientOnly-E7hGysn1.js";
7
- import { j as oe } from "./joinUrl-10po2Jdj.js";
8
- import { A as je } from "./AuthenticationPlugin-4ip08maU.js";
9
- import { b as Ie, u as L } from "./hook-CfCFKZ-2.js";
10
- import { N as Je } from "./chunk-HA7DTUK3-ZGg2W6yV.js";
11
- import { Z as Oe } from "./invariant-Caa8-XvF.js";
12
- var D = { exports: {} }, ze = D.exports, ie;
13
- function De() {
14
- return ie || (ie = 1, function(t) {
1
+ var Le = Object.defineProperty;
2
+ var xe = (t, e, n) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var _ = (t, e, n) => xe(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { j as B } from "./jsx-runtime-CYK1ROHF.js";
5
+ import { g as Ce } from "./_commonjsHelpers-BkfeUUK-.js";
6
+ import { C as Ie } from "./ClientOnly-E7hGysn1.js";
7
+ import { j as ie } from "./joinUrl-10po2Jdj.js";
8
+ import { A as je } from "./AuthenticationPlugin-Cr6xjOJD.js";
9
+ import { b as Je, u as x } from "./hook-Bo80UX00.js";
10
+ import { N as Oe } from "./chunk-HA7DTUK3-ZGg2W6yV.js";
11
+ import { Z as ze } from "./invariant-Caa8-XvF.js";
12
+ var D = { exports: {} }, De = D.exports, ae;
13
+ function Ne() {
14
+ return ae || (ae = 1, function(t) {
15
15
  (function(e, n) {
16
16
  t.exports ? t.exports = n() : e.log = n();
17
- })(ze, function() {
17
+ })(De, function() {
18
18
  var e = function() {
19
19
  }, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), a = [
20
20
  "trace",
@@ -23,8 +23,8 @@ function De() {
23
23
  "warn",
24
24
  "error"
25
25
  ], r = {}, i = null;
26
- function c(l, y) {
27
- var u = l[y];
26
+ function c(l, g) {
27
+ var u = l[g];
28
28
  if (typeof u.bind == "function")
29
29
  return u.bind(l);
30
30
  try {
@@ -42,39 +42,39 @@ function De() {
42
42
  return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? p : console[l] !== void 0 ? c(console, l) : console.log !== void 0 ? c(console, "log") : e;
43
43
  }
44
44
  function f() {
45
- for (var l = this.getLevel(), y = 0; y < a.length; y++) {
46
- var u = a[y];
47
- this[u] = y < l ? e : this.methodFactory(u, l, this.name);
45
+ for (var l = this.getLevel(), g = 0; g < a.length; g++) {
46
+ var u = a[g];
47
+ this[u] = g < l ? e : this.methodFactory(u, l, this.name);
48
48
  }
49
49
  if (this.log = this.debug, typeof console === n && l < this.levels.SILENT)
50
50
  return "No console available for logging";
51
51
  }
52
- function g(l) {
52
+ function v(l) {
53
53
  return function() {
54
54
  typeof console !== n && (f.call(this), this[l].apply(this, arguments));
55
55
  };
56
56
  }
57
- function v(l, y, u) {
58
- return w(l) || g.apply(this, arguments);
57
+ function b(l, g, u) {
58
+ return w(l) || v.apply(this, arguments);
59
59
  }
60
- function h(l, y) {
61
- var u = this, J, $, R, S = "loglevel";
60
+ function h(l, g) {
61
+ var u = this, J, $, U, S = "loglevel";
62
62
  typeof l == "string" ? S += ":" + l : typeof l == "symbol" && (S = void 0);
63
- function Ee(d) {
64
- var b = (a[d] || "silent").toUpperCase();
63
+ function Re(d) {
64
+ var y = (a[d] || "silent").toUpperCase();
65
65
  if (!(typeof window === n || !S)) {
66
66
  try {
67
- window.localStorage[S] = b;
67
+ window.localStorage[S] = y;
68
68
  return;
69
69
  } catch {
70
70
  }
71
71
  try {
72
- window.document.cookie = encodeURIComponent(S) + "=" + b + ";";
72
+ window.document.cookie = encodeURIComponent(S) + "=" + y + ";";
73
73
  } catch {
74
74
  }
75
75
  }
76
76
  }
77
- function te() {
77
+ function ne() {
78
78
  var d;
79
79
  if (!(typeof window === n || !S)) {
80
80
  try {
@@ -83,16 +83,16 @@ function De() {
83
83
  }
84
84
  if (typeof d === n)
85
85
  try {
86
- var b = window.document.cookie, O = encodeURIComponent(S), re = b.indexOf(O + "=");
87
- re !== -1 && (d = /^([^;]+)/.exec(
88
- b.slice(re + O.length + 1)
86
+ var y = window.document.cookie, O = encodeURIComponent(S), oe = y.indexOf(O + "=");
87
+ oe !== -1 && (d = /^([^;]+)/.exec(
88
+ y.slice(oe + O.length + 1)
89
89
  )[1]);
90
90
  } catch {
91
91
  }
92
92
  return u.levels[d] === void 0 && (d = void 0), d;
93
93
  }
94
94
  }
95
- function Re() {
95
+ function Pe() {
96
96
  if (!(typeof window === n || !S)) {
97
97
  try {
98
98
  window.localStorage.removeItem(S);
@@ -104,10 +104,10 @@ function De() {
104
104
  }
105
105
  }
106
106
  }
107
- function U(d) {
108
- var b = d;
109
- if (typeof b == "string" && u.levels[b.toUpperCase()] !== void 0 && (b = u.levels[b.toUpperCase()]), typeof b == "number" && b >= 0 && b <= u.levels.SILENT)
110
- return b;
107
+ function L(d) {
108
+ var y = d;
109
+ if (typeof y == "string" && u.levels[y.toUpperCase()] !== void 0 && (y = u.levels[y.toUpperCase()]), typeof y == "number" && y >= 0 && y <= u.levels.SILENT)
110
+ return y;
111
111
  throw new TypeError("log.setLevel() called with invalid level: " + d);
112
112
  }
113
113
  u.name = l, u.levels = {
@@ -117,52 +117,52 @@ function De() {
117
117
  WARN: 3,
118
118
  ERROR: 4,
119
119
  SILENT: 5
120
- }, u.methodFactory = y || v, u.getLevel = function() {
121
- return R ?? $ ?? J;
122
- }, u.setLevel = function(d, b) {
123
- return R = U(d), b !== !1 && Ee(R), f.call(u);
120
+ }, u.methodFactory = g || b, u.getLevel = function() {
121
+ return U ?? $ ?? J;
122
+ }, u.setLevel = function(d, y) {
123
+ return U = L(d), y !== !1 && Re(U), f.call(u);
124
124
  }, u.setDefaultLevel = function(d) {
125
- $ = U(d), te() || u.setLevel(d, !1);
125
+ $ = L(d), ne() || u.setLevel(d, !1);
126
126
  }, u.resetLevel = function() {
127
- R = null, Re(), f.call(u);
127
+ U = null, Pe(), f.call(u);
128
128
  }, u.enableAll = function(d) {
129
129
  u.setLevel(u.levels.TRACE, d);
130
130
  }, u.disableAll = function(d) {
131
131
  u.setLevel(u.levels.SILENT, d);
132
132
  }, u.rebuild = function() {
133
- if (i !== u && (J = U(i.getLevel())), f.call(u), i === u)
133
+ if (i !== u && (J = L(i.getLevel())), f.call(u), i === u)
134
134
  for (var d in r)
135
135
  r[d].rebuild();
136
- }, J = U(
136
+ }, J = L(
137
137
  i ? i.getLevel() : "WARN"
138
138
  );
139
- var ne = te();
140
- ne != null && (R = U(ne)), f.call(u);
139
+ var re = ne();
140
+ re != null && (U = L(re)), f.call(u);
141
141
  }
142
- i = new h(), i.getLogger = function(y) {
143
- if (typeof y != "symbol" && typeof y != "string" || y === "")
142
+ i = new h(), i.getLogger = function(g) {
143
+ if (typeof g != "symbol" && typeof g != "string" || g === "")
144
144
  throw new TypeError("You must supply a name when creating a logger.");
145
- var u = r[y];
146
- return u || (u = r[y] = new h(
147
- y,
145
+ var u = r[g];
146
+ return u || (u = r[g] = new h(
147
+ g,
148
148
  i.methodFactory
149
149
  )), u;
150
150
  };
151
- var I = typeof window !== n ? window.log : void 0;
151
+ var P = typeof window !== n ? window.log : void 0;
152
152
  return i.noConflict = function() {
153
- return typeof window !== n && window.log === i && (window.log = I), i;
153
+ return typeof window !== n && window.log === i && (window.log = P), i;
154
154
  }, i.getLoggers = function() {
155
155
  return r;
156
156
  }, i.default = i, i;
157
157
  });
158
158
  }(D)), D.exports;
159
159
  }
160
- var Ne = De();
161
- const ae = /* @__PURE__ */ xe(Ne);
162
- let B;
163
- var z, pe;
164
- (typeof navigator > "u" || !((pe = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && pe.call(z, "Mozilla/5.0 "))) && (B = "oauth4webapi/v2.17.0");
165
- function G(t, e) {
160
+ var We = Ne();
161
+ const se = /* @__PURE__ */ Ce(We);
162
+ let V;
163
+ var z, we;
164
+ (typeof navigator > "u" || !((we = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && we.call(z, "Mozilla/5.0 "))) && (V = "oauth4webapi/v2.17.0");
165
+ function Y(t, e) {
166
166
  if (t == null)
167
167
  return !1;
168
168
  try {
@@ -171,19 +171,19 @@ function G(t, e) {
171
171
  return !1;
172
172
  }
173
173
  }
174
- const W = Symbol(), We = Symbol(), Z = Symbol(), Ke = Symbol(), He = Symbol(), $e = Symbol(), Fe = new TextEncoder(), Me = new TextDecoder();
174
+ const W = Symbol(), Ke = Symbol(), Z = Symbol(), He = Symbol(), $e = Symbol(), Fe = Symbol(), Me = new TextEncoder(), qe = new TextDecoder();
175
175
  function E(t) {
176
- return typeof t == "string" ? Fe.encode(t) : Me.decode(t);
176
+ return typeof t == "string" ? Me.encode(t) : qe.decode(t);
177
177
  }
178
- const se = 32768;
179
- function qe(t) {
178
+ const ce = 32768;
179
+ function Be(t) {
180
180
  t instanceof ArrayBuffer && (t = new Uint8Array(t));
181
181
  const e = [];
182
- for (let n = 0; n < t.byteLength; n += se)
183
- e.push(String.fromCharCode.apply(null, t.subarray(n, n + se)));
182
+ for (let n = 0; n < t.byteLength; n += ce)
183
+ e.push(String.fromCharCode.apply(null, t.subarray(n, n + ce)));
184
184
  return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
185
185
  }
186
- function Be(t) {
186
+ function Ve(t) {
187
187
  try {
188
188
  const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(e.length);
189
189
  for (let o = 0; o < e.length; o++)
@@ -194,9 +194,9 @@ function Be(t) {
194
194
  }
195
195
  }
196
196
  function k(t) {
197
- return typeof t == "string" ? Be(t) : qe(t);
197
+ return typeof t == "string" ? Ve(t) : Be(t);
198
198
  }
199
- class Ve {
199
+ class Ge {
200
200
  constructor(e) {
201
201
  this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = e;
202
202
  }
@@ -226,48 +226,48 @@ class T extends Error {
226
226
  super(e ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
227
227
  }
228
228
  }
229
- class Ge extends Error {
229
+ class Ye extends Error {
230
230
  constructor(e, n) {
231
231
  var o;
232
232
  super(e, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
233
233
  }
234
234
  }
235
- const s = Ge, we = new Ve(100);
236
- function me(t) {
235
+ const s = Ye, me = new Ge(100);
236
+ function ge(t) {
237
237
  return t instanceof CryptoKey;
238
238
  }
239
239
  function Ze(t) {
240
- return me(t) && t.type === "private";
240
+ return ge(t) && t.type === "private";
241
241
  }
242
- function Ye(t) {
243
- return me(t) && t.type === "public";
242
+ function Qe(t) {
243
+ return ge(t) && t.type === "public";
244
244
  }
245
- function Y(t) {
245
+ function Q(t) {
246
246
  try {
247
247
  const e = t.headers.get("dpop-nonce");
248
- e && we.set(new URL(t.url).origin, e);
248
+ e && me.set(new URL(t.url).origin, e);
249
249
  } catch {
250
250
  }
251
251
  return t;
252
252
  }
253
- function x(t) {
253
+ function C(t) {
254
254
  return !(t === null || typeof t != "object" || Array.isArray(t));
255
255
  }
256
256
  function K(t) {
257
- G(t, Headers) && (t = Object.fromEntries(t.entries()));
257
+ Y(t, Headers) && (t = Object.fromEntries(t.entries()));
258
258
  const e = new Headers(t);
259
- if (B && !e.has("user-agent") && e.set("user-agent", B), e.has("authorization"))
259
+ if (V && !e.has("user-agent") && e.set("user-agent", V), e.has("authorization"))
260
260
  throw new TypeError('"options.headers" must not include the "authorization" header name');
261
261
  if (e.has("dpop"))
262
262
  throw new TypeError('"options.headers" must not include the "dpop" header name');
263
263
  return e;
264
264
  }
265
- function Qe(t) {
265
+ function Xe(t) {
266
266
  if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
267
267
  throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
268
268
  return t;
269
269
  }
270
- async function Xe(t, e) {
270
+ async function et(t, e) {
271
271
  if (!(t instanceof URL))
272
272
  throw new TypeError('"issuerIdentifier" must be an instance of URL');
273
273
  if (t.protocol !== "https:" && t.protocol !== "http:")
@@ -290,26 +290,26 @@ async function Xe(t, e) {
290
290
  method: "GET",
291
291
  redirect: "manual",
292
292
  signal: null
293
- }).then(Y);
293
+ }).then(Q);
294
294
  }
295
295
  function m(t) {
296
296
  return typeof t == "string" && t.length !== 0;
297
297
  }
298
- async function et(t, e) {
298
+ async function tt(t, e) {
299
299
  if (!(t instanceof URL))
300
300
  throw new TypeError('"expectedIssuer" must be an instance of URL');
301
- if (!G(e, Response))
301
+ if (!Y(e, Response))
302
302
  throw new TypeError('"response" must be an instance of Response');
303
303
  if (e.status !== 200)
304
304
  throw new s('"response" is not a conform Authorization Server Metadata response');
305
- ee(e);
305
+ te(e);
306
306
  let n;
307
307
  try {
308
308
  n = await e.json();
309
309
  } catch (o) {
310
310
  throw new s('failed to parse "response" body as JSON', { cause: o });
311
311
  }
312
- if (!x(n))
312
+ if (!C(n))
313
313
  throw new s('"response" body must be a top level object');
314
314
  if (!m(n.issuer))
315
315
  throw new s('"response" body "issuer" property must be a non-empty string');
@@ -317,28 +317,28 @@ async function et(t, e) {
317
317
  throw new s('"response" body "issuer" does not match "expectedIssuer"');
318
318
  return n;
319
319
  }
320
- function Q() {
320
+ function X() {
321
321
  return k(crypto.getRandomValues(new Uint8Array(32)));
322
322
  }
323
- function tt() {
324
- return Q();
325
- }
326
323
  function nt() {
327
- return Q();
324
+ return X();
325
+ }
326
+ function rt() {
327
+ return X();
328
328
  }
329
- async function rt(t) {
329
+ async function ot(t) {
330
330
  if (!m(t))
331
331
  throw new TypeError('"codeVerifier" must be a non-empty string');
332
332
  return k(await crypto.subtle.digest("SHA-256", E(t)));
333
333
  }
334
- function ce(t) {
334
+ function ue(t) {
335
335
  return encodeURIComponent(t).replace(/%20/g, "+");
336
336
  }
337
- function ot(t, e) {
338
- const n = ce(t), o = ce(e);
337
+ function it(t, e) {
338
+ const n = ue(t), o = ue(e);
339
339
  return `Basic ${btoa(`${n}:${o}`)}`;
340
340
  }
341
- function it(t) {
341
+ function at(t) {
342
342
  switch (t.algorithm.hash.name) {
343
343
  case "SHA-256":
344
344
  return "PS256";
@@ -350,7 +350,7 @@ function it(t) {
350
350
  throw new T("unsupported RsaHashedKeyAlgorithm hash name");
351
351
  }
352
352
  }
353
- function at(t) {
353
+ function st(t) {
354
354
  switch (t.algorithm.hash.name) {
355
355
  case "SHA-256":
356
356
  return "RS256";
@@ -362,7 +362,7 @@ function at(t) {
362
362
  throw new T("unsupported RsaHashedKeyAlgorithm hash name");
363
363
  }
364
364
  }
365
- function st(t) {
365
+ function ct(t) {
366
366
  switch (t.algorithm.namedCurve) {
367
367
  case "P-256":
368
368
  return "ES256";
@@ -374,14 +374,14 @@ function st(t) {
374
374
  throw new T("unsupported EcKeyAlgorithm namedCurve");
375
375
  }
376
376
  }
377
- function ct(t) {
377
+ function ut(t) {
378
378
  switch (t.algorithm.name) {
379
379
  case "RSA-PSS":
380
- return it(t);
381
- case "RSASSA-PKCS1-v1_5":
382
380
  return at(t);
383
- case "ECDSA":
381
+ case "RSASSA-PKCS1-v1_5":
384
382
  return st(t);
383
+ case "ECDSA":
384
+ return ct(t);
385
385
  case "Ed25519":
386
386
  case "Ed448":
387
387
  return "EdDSA";
@@ -393,14 +393,14 @@ function H(t) {
393
393
  const e = t == null ? void 0 : t[W];
394
394
  return typeof e == "number" && Number.isFinite(e) ? e : 0;
395
395
  }
396
- function ge(t) {
397
- const e = t == null ? void 0 : t[We];
396
+ function ye(t) {
397
+ const e = t == null ? void 0 : t[Ke];
398
398
  return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
399
399
  }
400
- function X() {
400
+ function ee() {
401
401
  return Math.floor(Date.now() / 1e3);
402
402
  }
403
- function C(t) {
403
+ function I(t) {
404
404
  if (typeof t != "object" || t === null)
405
405
  throw new TypeError('"as" must be an object');
406
406
  if (!m(t.issuer))
@@ -414,160 +414,160 @@ function j(t) {
414
414
  throw new TypeError('"client.client_id" property must be a non-empty string');
415
415
  return !0;
416
416
  }
417
- function ue(t) {
417
+ function le(t) {
418
418
  if (!m(t))
419
419
  throw new TypeError('"client.client_secret" property must be a non-empty string');
420
420
  return t;
421
421
  }
422
- function le(t, e) {
422
+ function de(t, e) {
423
423
  if (e !== void 0)
424
424
  throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
425
425
  }
426
- async function ut(t, e, n, o, a) {
426
+ async function lt(t, e, n, o, a) {
427
427
  switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
428
428
  case void 0:
429
429
  case "client_secret_basic": {
430
- o.set("authorization", ot(e.client_id, ue(e.client_secret)));
430
+ o.set("authorization", it(e.client_id, le(e.client_secret)));
431
431
  break;
432
432
  }
433
433
  case "client_secret_post": {
434
- n.set("client_id", e.client_id), n.set("client_secret", ue(e.client_secret));
434
+ n.set("client_id", e.client_id), n.set("client_secret", le(e.client_secret));
435
435
  break;
436
436
  }
437
437
  case "private_key_jwt":
438
- throw le("private_key_jwt", e.client_secret), new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
438
+ throw de("private_key_jwt", e.client_secret), new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
439
439
  case "tls_client_auth":
440
440
  case "self_signed_tls_client_auth":
441
441
  case "none": {
442
- le(e.token_endpoint_auth_method, e.client_secret), e.token_endpoint_auth_method, n.set("client_id", e.client_id);
442
+ de(e.token_endpoint_auth_method, e.client_secret), e.token_endpoint_auth_method, n.set("client_id", e.client_id);
443
443
  break;
444
444
  }
445
445
  default:
446
446
  throw new T("unsupported client token_endpoint_auth_method");
447
447
  }
448
448
  }
449
- async function lt(t, e, n) {
449
+ async function dt(t, e, n) {
450
450
  if (!n.usages.includes("sign"))
451
451
  throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
452
- const o = `${k(E(JSON.stringify(t)))}.${k(E(JSON.stringify(e)))}`, a = k(await crypto.subtle.sign(Ae(n), n, E(o)));
452
+ const o = `${k(E(JSON.stringify(t)))}.${k(E(JSON.stringify(e)))}`, a = k(await crypto.subtle.sign(ke(n), n, E(o)));
453
453
  return `${o}.${a}`;
454
454
  }
455
- async function dt(t, e, n, o, a, r) {
456
- var v;
457
- const { privateKey: i, publicKey: c, nonce: p = we.get(n.origin) } = e;
455
+ async function ht(t, e, n, o, a, r) {
456
+ var b;
457
+ const { privateKey: i, publicKey: c, nonce: p = me.get(n.origin) } = e;
458
458
  if (!Ze(i))
459
459
  throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
460
- if (!Ye(c))
460
+ if (!Qe(c))
461
461
  throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
462
462
  if (p !== void 0 && !m(p))
463
463
  throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
464
464
  if (!c.extractable)
465
465
  throw new TypeError('"DPoP.publicKey.extractable" must be true');
466
- const w = X() + a, f = {
467
- alg: ct(i),
466
+ const w = ee() + a, f = {
467
+ alg: ut(i),
468
468
  typ: "dpop+jwt",
469
- jwk: await ft(c)
470
- }, g = {
469
+ jwk: await pt(c)
470
+ }, v = {
471
471
  iat: w,
472
- jti: Q(),
472
+ jti: X(),
473
473
  htm: o,
474
474
  nonce: p,
475
475
  htu: `${n.origin}${n.pathname}`,
476
476
  ath: r ? k(await crypto.subtle.digest("SHA-256", E(r))) : void 0
477
477
  };
478
- (v = e[Ke]) == null || v.call(e, f, g), t.set("dpop", await lt(f, g, i));
478
+ (b = e[He]) == null || b.call(e, f, v), t.set("dpop", await dt(f, v, i));
479
479
  }
480
480
  let N;
481
- async function ht(t) {
481
+ async function ft(t) {
482
482
  const { kty: e, e: n, n: o, x: a, y: r, crv: i } = await crypto.subtle.exportKey("jwk", t), c = { kty: e, e: n, n: o, x: a, y: r, crv: i };
483
483
  return N.set(t, c), c;
484
484
  }
485
- async function ft(t) {
486
- return N || (N = /* @__PURE__ */ new WeakMap()), N.get(t) || ht(t);
485
+ async function pt(t) {
486
+ return N || (N = /* @__PURE__ */ new WeakMap()), N.get(t) || ft(t);
487
487
  }
488
- function de(t, e, n) {
488
+ function he(t, e, n) {
489
489
  if (typeof t != "string")
490
490
  throw n ? new TypeError(`"as.mtls_endpoint_aliases.${e}" must be a string`) : new TypeError(`"as.${e}" must be a string`);
491
491
  return new URL(t);
492
492
  }
493
- function ye(t, e, n = !1) {
494
- return n && t.mtls_endpoint_aliases && e in t.mtls_endpoint_aliases ? de(t.mtls_endpoint_aliases[e], e, n) : de(t[e], e, n);
493
+ function be(t, e, n = !1) {
494
+ return n && t.mtls_endpoint_aliases && e in t.mtls_endpoint_aliases ? he(t.mtls_endpoint_aliases[e], e, n) : he(t[e], e, n);
495
495
  }
496
- function be(t, e) {
497
- return !!(t.use_mtls_endpoint_aliases || e != null && e[$e]);
496
+ function _e(t, e) {
497
+ return !!(t.use_mtls_endpoint_aliases || e != null && e[Fe]);
498
498
  }
499
- function V(t) {
499
+ function G(t) {
500
500
  const e = t;
501
501
  return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
502
502
  }
503
- async function pt(t, e, n, o, a, r) {
503
+ async function wt(t, e, n, o, a, r) {
504
504
  if (!m(t))
505
505
  throw new TypeError('"accessToken" must be a non-empty string');
506
506
  if (!(n instanceof URL))
507
507
  throw new TypeError('"url" must be an instance of URL');
508
- return o = K(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await dt(o, r.DPoP, n, e.toUpperCase(), H({ [W]: r == null ? void 0 : r[W] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[Z]) || fetch)(n.href, {
508
+ return o = K(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await ht(o, r.DPoP, n, e.toUpperCase(), H({ [W]: r == null ? void 0 : r[W] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[Z]) || fetch)(n.href, {
509
509
  body: a,
510
510
  headers: Object.fromEntries(o.entries()),
511
511
  method: e,
512
512
  redirect: "manual",
513
- signal: r != null && r.signal ? Qe(r.signal) : null
514
- }).then(Y);
513
+ signal: r != null && r.signal ? Xe(r.signal) : null
514
+ }).then(Q);
515
515
  }
516
- async function wt(t, e, n, o) {
517
- C(t), j(e);
518
- const a = ye(t, "userinfo_endpoint", be(e, o)), r = K(o == null ? void 0 : o.headers);
519
- return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), pt(n, "GET", a, r, null, {
516
+ async function mt(t, e, n, o) {
517
+ I(t), j(e);
518
+ const a = be(t, "userinfo_endpoint", _e(e, o)), r = K(o == null ? void 0 : o.headers);
519
+ return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), wt(n, "GET", a, r, null, {
520
520
  ...o,
521
521
  [W]: H(e)
522
522
  });
523
523
  }
524
- async function mt(t, e, n, o, a, r, i) {
525
- return await ut(t, e, a, r), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Z]) || fetch)(o.href, {
524
+ async function gt(t, e, n, o, a, r, i) {
525
+ return await lt(t, e, a, r), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Z]) || fetch)(o.href, {
526
526
  body: a,
527
527
  headers: Object.fromEntries(r.entries()),
528
528
  method: n,
529
529
  redirect: "manual",
530
530
  signal: null
531
- }).then(Y);
531
+ }).then(Q);
532
532
  }
533
- async function _e(t, e, n, o, a) {
534
- const r = ye(t, "token_endpoint", be(e, a));
533
+ async function ve(t, e, n, o, a) {
534
+ const r = be(t, "token_endpoint", _e(e, a));
535
535
  o.set("grant_type", n);
536
536
  const i = K(a == null ? void 0 : a.headers);
537
- return i.set("accept", "application/json"), mt(t, e, "POST", r, o, i, a);
537
+ return i.set("accept", "application/json"), gt(t, e, "POST", r, o, i, a);
538
538
  }
539
- async function gt(t, e, n, o) {
540
- if (C(t), j(e), !m(n))
539
+ async function yt(t, e, n, o) {
540
+ if (I(t), j(e), !m(n))
541
541
  throw new TypeError('"refreshToken" must be a non-empty string');
542
542
  const a = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
543
- return a.set("refresh_token", n), _e(t, e, "refresh_token", a, o);
543
+ return a.set("refresh_token", n), ve(t, e, "refresh_token", a, o);
544
544
  }
545
- const ve = /* @__PURE__ */ new WeakMap();
546
- function yt(t) {
545
+ const Se = /* @__PURE__ */ new WeakMap();
546
+ function bt(t) {
547
547
  if (!t.id_token)
548
548
  return;
549
- const e = ve.get(t);
549
+ const e = Se.get(t);
550
550
  if (!e)
551
551
  throw new TypeError('"ref" was already garbage collected or did not resolve from the proper sources');
552
552
  return e[0];
553
553
  }
554
- async function Se(t, e, n, o = !1, a = !1) {
555
- if (C(t), j(e), !G(n, Response))
554
+ async function Te(t, e, n, o = !1, a = !1) {
555
+ if (I(t), j(e), !Y(n, Response))
556
556
  throw new TypeError('"response" must be an instance of Response');
557
557
  if (n.status !== 200) {
558
558
  let i;
559
- if (i = await Pt(n))
559
+ if (i = await Ut(n))
560
560
  return i;
561
561
  throw new s('"response" is not a conform Token Endpoint response');
562
562
  }
563
- ee(n);
563
+ te(n);
564
564
  let r;
565
565
  try {
566
566
  r = await n.json();
567
567
  } catch (i) {
568
568
  throw new s('failed to parse "response" body as JSON', { cause: i });
569
569
  }
570
- if (!x(r))
570
+ if (!C(r))
571
571
  throw new s('"response" body must be a top level object');
572
572
  if (!m(r.access_token))
573
573
  throw new s('"response" body "access_token" property must be a non-empty string');
@@ -585,7 +585,7 @@ async function Se(t, e, n, o = !1, a = !1) {
585
585
  if (r.id_token !== void 0 && !m(r.id_token))
586
586
  throw new s('"response" body "id_token" property must be a non-empty string');
587
587
  if (r.id_token) {
588
- const { claims: i, jwt: c } = await xt(r.id_token, Ct.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), ke, H(e), ge(e), e[He]).then(kt.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(vt.bind(void 0, t.issuer)).then(_t.bind(void 0, e.client_id));
588
+ const { claims: i, jwt: c } = await Ct(r.id_token, It.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ee, H(e), ye(e), e[$e]).then(Et.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(St.bind(void 0, t.issuer)).then(vt.bind(void 0, e.client_id));
589
589
  if (Array.isArray(i.aud) && i.aud.length !== 1) {
590
590
  if (i.azp === void 0)
591
591
  throw new s('ID Token "aud" (audience) claim includes additional untrusted audiences');
@@ -594,15 +594,15 @@ async function Se(t, e, n, o = !1, a = !1) {
594
594
  }
595
595
  if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
596
596
  throw new s('ID Token "auth_time" (authentication time) must be a positive number');
597
- ve.set(r, [i, c]);
597
+ Se.set(r, [i, c]);
598
598
  }
599
599
  }
600
600
  return r;
601
601
  }
602
- async function bt(t, e, n) {
603
- return Se(t, e, n);
602
+ async function _t(t, e, n) {
603
+ return Te(t, e, n);
604
604
  }
605
- function _t(t, e) {
605
+ function vt(t, e) {
606
606
  if (Array.isArray(e.claims.aud)) {
607
607
  if (!e.claims.aud.includes(t))
608
608
  throw new s('unexpected JWT "aud" (audience) claim value');
@@ -610,17 +610,17 @@ function _t(t, e) {
610
610
  throw new s('unexpected JWT "aud" (audience) claim value');
611
611
  return e;
612
612
  }
613
- function vt(t, e) {
613
+ function St(t, e) {
614
614
  if (e.claims.iss !== t)
615
615
  throw new s('unexpected JWT "iss" (issuer) claim value');
616
616
  return e;
617
617
  }
618
- const Te = /* @__PURE__ */ new WeakSet();
619
- function St(t) {
620
- return Te.add(t), t;
618
+ const Ae = /* @__PURE__ */ new WeakSet();
619
+ function Tt(t) {
620
+ return Ae.add(t), t;
621
621
  }
622
- async function Tt(t, e, n, o, a, r) {
623
- if (C(t), j(e), !Te.has(n))
622
+ async function At(t, e, n, o, a, r) {
623
+ if (I(t), j(e), !Ae.has(n))
624
624
  throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
625
625
  if (!m(o))
626
626
  throw new TypeError('"redirectUri" must be a non-empty string');
@@ -630,9 +630,9 @@ async function Tt(t, e, n, o, a, r) {
630
630
  if (!i)
631
631
  throw new s('no authorization code in "callbackParameters"');
632
632
  const c = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
633
- return c.set("redirect_uri", o), c.set("code_verifier", a), c.set("code", i), _e(t, e, "authorization_code", c, r);
633
+ return c.set("redirect_uri", o), c.set("code_verifier", a), c.set("code", i), ve(t, e, "authorization_code", c, r);
634
634
  }
635
- const At = {
635
+ const kt = {
636
636
  aud: "audience",
637
637
  c_hash: "code hash",
638
638
  client_id: "client id",
@@ -648,33 +648,33 @@ const At = {
648
648
  htu: "http uri",
649
649
  cnf: "confirmation"
650
650
  };
651
- function kt(t, e) {
651
+ function Et(t, e) {
652
652
  for (const n of t)
653
653
  if (e.claims[n] === void 0)
654
- throw new s(`JWT "${n}" (${At[n]}) claim missing`);
654
+ throw new s(`JWT "${n}" (${kt[n]}) claim missing`);
655
655
  return e;
656
656
  }
657
- const Et = Symbol(), F = Symbol();
658
- async function Rt(t, e, n, o, a) {
659
- const r = await Se(t, e, n);
660
- if (V(r))
657
+ const Rt = Symbol(), F = Symbol();
658
+ async function Pt(t, e, n, o, a) {
659
+ const r = await Te(t, e, n);
660
+ if (G(r))
661
661
  return r;
662
662
  if (!m(r.id_token))
663
663
  throw new s('"response" body "id_token" property must be a non-empty string');
664
664
  a ?? (a = e.default_max_age ?? F);
665
- const i = yt(r);
665
+ const i = bt(r);
666
666
  if ((e.require_auth_time || a !== F) && i.auth_time === void 0)
667
667
  throw new s('ID Token "auth_time" (authentication time) claim missing');
668
668
  if (a !== F) {
669
669
  if (typeof a != "number" || a < 0)
670
670
  throw new TypeError('"maxAge" must be a non-negative number');
671
- const c = X() + H(e), p = ge(e);
671
+ const c = ee() + H(e), p = ye(e);
672
672
  if (i.auth_time + a < c - p)
673
673
  throw new s("too much time has elapsed since the last End-User authentication");
674
674
  }
675
675
  switch (o) {
676
676
  case void 0:
677
- case Et:
677
+ case Rt:
678
678
  if (i.nonce !== void 0)
679
679
  throw new s('unexpected ID Token "nonce" claim value');
680
680
  break;
@@ -688,26 +688,26 @@ async function Rt(t, e, n, o, a) {
688
688
  }
689
689
  return r;
690
690
  }
691
- function ee(t) {
691
+ function te(t) {
692
692
  if (t.bodyUsed)
693
693
  throw new TypeError('"response" body has been used already');
694
694
  }
695
- async function Pt(t) {
695
+ async function Ut(t) {
696
696
  if (t.status > 399 && t.status < 500) {
697
- ee(t);
697
+ te(t);
698
698
  try {
699
699
  const e = await t.json();
700
- if (x(e) && typeof e.error == "string" && e.error.length)
700
+ if (C(e) && typeof e.error == "string" && e.error.length)
701
701
  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;
702
702
  } catch {
703
703
  }
704
704
  }
705
705
  }
706
- function he(t) {
706
+ function fe(t) {
707
707
  if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
708
708
  throw new s(`${t.name} modulusLength must be at least 2048 bits`);
709
709
  }
710
- function Ut(t) {
710
+ function Lt(t) {
711
711
  switch (t) {
712
712
  case "P-256":
713
713
  return "SHA-256";
@@ -719,15 +719,15 @@ function Ut(t) {
719
719
  throw new T();
720
720
  }
721
721
  }
722
- function Ae(t) {
722
+ function ke(t) {
723
723
  switch (t.algorithm.name) {
724
724
  case "ECDSA":
725
725
  return {
726
726
  name: t.algorithm.name,
727
- hash: Ut(t.algorithm.namedCurve)
727
+ hash: Lt(t.algorithm.namedCurve)
728
728
  };
729
729
  case "RSA-PSS":
730
- switch (he(t.algorithm), t.algorithm.hash.name) {
730
+ switch (fe(t.algorithm), t.algorithm.hash.name) {
731
731
  case "SHA-256":
732
732
  case "SHA-384":
733
733
  case "SHA-512":
@@ -739,20 +739,20 @@ function Ae(t) {
739
739
  throw new T();
740
740
  }
741
741
  case "RSASSA-PKCS1-v1_5":
742
- return he(t.algorithm), t.algorithm.name;
742
+ return fe(t.algorithm), t.algorithm.name;
743
743
  case "Ed448":
744
744
  case "Ed25519":
745
745
  return t.algorithm.name;
746
746
  }
747
747
  throw new T();
748
748
  }
749
- const ke = Symbol();
750
- async function Lt(t, e, n, o) {
749
+ const Ee = Symbol();
750
+ async function xt(t, e, n, o) {
751
751
  const a = `${t}.${e}`;
752
- if (!await crypto.subtle.verify(Ae(n), n, o, E(a)))
752
+ if (!await crypto.subtle.verify(ke(n), n, o, E(a)))
753
753
  throw new s("JWT signature verification failed");
754
754
  }
755
- async function xt(t, e, n, o, a, r) {
755
+ async function Ct(t, e, n, o, a, r) {
756
756
  let { 0: i, 1: c, 2: p, length: w } = t.split(".");
757
757
  if (w === 5)
758
758
  if (r !== void 0)
@@ -767,26 +767,26 @@ async function xt(t, e, n, o, a, r) {
767
767
  } catch (l) {
768
768
  throw new s("failed to parse JWT Header body as base64url encoded JSON", { cause: l });
769
769
  }
770
- if (!x(f))
770
+ if (!C(f))
771
771
  throw new s("JWT Header must be a top level object");
772
772
  if (e(f), f.crit !== void 0)
773
773
  throw new s('unexpected JWT "crit" header parameter');
774
- const g = k(p);
775
- let v;
776
- n !== ke && (v = await n(f), await Lt(i, c, v, g));
774
+ const v = k(p);
775
+ let b;
776
+ n !== Ee && (b = await n(f), await xt(i, c, b, v));
777
777
  let h;
778
778
  try {
779
779
  h = JSON.parse(E(k(c)));
780
780
  } catch (l) {
781
781
  throw new s("failed to parse JWT Payload body as base64url encoded JSON", { cause: l });
782
782
  }
783
- if (!x(h))
783
+ if (!C(h))
784
784
  throw new s("JWT Payload must be a top level object");
785
- const I = X() + o;
785
+ const P = ee() + o;
786
786
  if (h.exp !== void 0) {
787
787
  if (typeof h.exp != "number")
788
788
  throw new s('unexpected JWT "exp" (expiration time) claim type');
789
- if (h.exp <= I - a)
789
+ if (h.exp <= P - a)
790
790
  throw new s('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
791
791
  }
792
792
  if (h.iat !== void 0 && typeof h.iat != "number")
@@ -796,14 +796,14 @@ async function xt(t, e, n, o, a, r) {
796
796
  if (h.nbf !== void 0) {
797
797
  if (typeof h.nbf != "number")
798
798
  throw new s('unexpected JWT "nbf" (not before) claim type');
799
- if (h.nbf > I + a)
799
+ if (h.nbf > P + a)
800
800
  throw new s('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
801
801
  }
802
802
  if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
803
803
  throw new s('unexpected JWT "aud" (audience) claim type');
804
- return { header: f, claims: h, signature: g, key: v, jwt: t };
804
+ return { header: f, claims: h, signature: v, key: b, jwt: t };
805
805
  }
806
- function Ct(t, e, n) {
806
+ function It(t, e, n) {
807
807
  if (t !== void 0) {
808
808
  if (n.alg !== t)
809
809
  throw new s('unexpected JWT "alg" header parameter');
@@ -823,9 +823,9 @@ function A(t, e) {
823
823
  throw new s(`"${e}" parameter must be provided only once`);
824
824
  return n;
825
825
  }
826
- const jt = Symbol(), It = Symbol();
827
- function Jt(t, e, n, o) {
828
- if (C(t), j(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
826
+ const jt = Symbol(), Jt = Symbol();
827
+ function Ot(t, e, n, o) {
828
+ if (I(t), j(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
829
829
  throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
830
830
  if (A(n, "response"))
831
831
  throw new s('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
@@ -836,7 +836,7 @@ function Jt(t, e, n, o) {
836
836
  throw new s('unexpected "iss" (issuer) response parameter value');
837
837
  switch (o) {
838
838
  case void 0:
839
- case It:
839
+ case Jt:
840
840
  if (r !== void 0)
841
841
  throw new s('unexpected "state" response parameter encountered');
842
842
  break;
@@ -860,19 +860,19 @@ function Jt(t, e, n, o) {
860
860
  const c = A(n, "id_token"), p = A(n, "token");
861
861
  if (c !== void 0 || p !== void 0)
862
862
  throw new T("implicit and hybrid flows are not supported");
863
- return St(new URLSearchParams(n));
863
+ return Tt(new URLSearchParams(n));
864
864
  }
865
- function Ot({
865
+ function zt({
866
866
  handleCallback: t
867
867
  }) {
868
- const e = Ie({
868
+ const e = Je({
869
869
  retry: !1,
870
870
  queryKey: ["oauth-callback"],
871
871
  queryFn: async () => {
872
872
  try {
873
873
  return await t();
874
874
  } catch (n) {
875
- throw new Oe("Could not validate user", {
875
+ throw new ze("Could not validate user", {
876
876
  cause: n,
877
877
  title: "Authentication Error",
878
878
  developerHint: "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly."
@@ -880,17 +880,17 @@ function Ot({
880
880
  }
881
881
  }
882
882
  });
883
- return /* @__PURE__ */ q.jsx(Je, { to: e.data });
883
+ return /* @__PURE__ */ B.jsx(Oe, { to: e.data });
884
884
  }
885
- class P extends Error {
885
+ class R extends Error {
886
886
  }
887
- class fe extends P {
887
+ class pe extends R {
888
888
  constructor(e, n, o) {
889
889
  super(e, o), this.error = n;
890
890
  }
891
891
  }
892
- const M = "code-verifier";
893
- class zt extends je {
892
+ const M = "code-verifier", q = "oauth-state";
893
+ class Dt extends je {
894
894
  constructor(e, n) {
895
895
  super(), this.callbackUrlPath = e, this.handleCallback = n;
896
896
  }
@@ -899,12 +899,12 @@ class zt extends je {
899
899
  ...super.getRoutes(),
900
900
  {
901
901
  path: this.callbackUrlPath,
902
- element: /* @__PURE__ */ q.jsx(Ce, { children: /* @__PURE__ */ q.jsx(Ot, { handleCallback: this.handleCallback }) })
902
+ element: /* @__PURE__ */ B.jsx(Ie, { children: /* @__PURE__ */ B.jsx(zt, { handleCallback: this.handleCallback }) })
903
903
  }
904
904
  ];
905
905
  }
906
906
  }
907
- class Dt {
907
+ class Nt {
908
908
  constructor({
909
909
  issuer: e,
910
910
  audience: n,
@@ -927,7 +927,7 @@ class Dt {
927
927
  _(this, "audience");
928
928
  _(this, "scopes");
929
929
  _(this, "signOut", async () => {
930
- L.setState({
930
+ x.setState({
931
931
  isAuthenticated: !1,
932
932
  isPending: !1,
933
933
  profile: void 0,
@@ -944,64 +944,67 @@ class Dt {
944
944
  )) : o = n;
945
945
  });
946
946
  _(this, "handleCallback", async () => {
947
- const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(M);
948
- if (sessionStorage.removeItem(M), !o)
949
- throw new P("No code verifier found in state.");
950
- const a = await this.getAuthServer(), r = Jt(
951
- a,
947
+ const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(q);
948
+ if (sessionStorage.removeItem(q), n !== o)
949
+ throw new R("Invalid state parameter");
950
+ const a = sessionStorage.getItem(M);
951
+ if (sessionStorage.removeItem(M), !a)
952
+ throw new R("No code verifier found in state.");
953
+ const r = await this.getAuthServer(), i = Ot(
954
+ r,
952
955
  this.client,
953
956
  e.searchParams,
954
957
  n ?? void 0
955
958
  );
956
- if (V(r))
957
- throw ae.error("Error validating OAuth response", r), new fe(
959
+ if (G(i))
960
+ throw se.error("Error validating OAuth response", i), new pe(
958
961
  "Error validating OAuth response",
959
- r
962
+ i
960
963
  );
961
- const i = new URL(e);
962
- i.pathname = this.callbackUrlPath, i.search = "";
963
- const c = await Tt(
964
- a,
964
+ const c = new URL(e);
965
+ c.pathname = this.callbackUrlPath, c.search = "";
966
+ const p = await At(
967
+ r,
965
968
  this.client,
969
+ i,
970
+ c.toString(),
971
+ a
972
+ ), w = await Pt(
966
973
  r,
967
- i.toString(),
968
- o
969
- ), p = await Rt(
970
- a,
971
974
  this.client,
972
- c
975
+ p
973
976
  );
974
- this.setTokensFromResponse(p);
975
- const w = await this.getAccessToken(), g = await (await wt(
976
- a,
977
+ this.setTokensFromResponse(w);
978
+ const f = await this.getAccessToken(), b = await (await mt(
979
+ r,
977
980
  this.client,
978
- w
979
- )).json(), v = {
980
- sub: g.sub,
981
- email: g.email,
982
- name: g.name,
983
- emailVerified: g.email_verified ?? !1,
984
- pictureUrl: g.picture
981
+ f
982
+ )).json(), h = {
983
+ sub: b.sub,
984
+ email: b.email,
985
+ name: b.name,
986
+ emailVerified: b.email_verified ?? !1,
987
+ pictureUrl: b.picture
985
988
  };
986
- L.setState({
989
+ x.setState({
987
990
  isAuthenticated: !0,
988
991
  isPending: !1,
989
- profile: v
992
+ profile: h
990
993
  });
991
- const h = sessionStorage.getItem("redirect-to") ?? "/";
992
- return sessionStorage.removeItem("redirect-to"), h;
994
+ const P = sessionStorage.getItem("redirect-to") ?? "/";
995
+ return sessionStorage.removeItem("redirect-to"), P;
993
996
  });
994
997
  this.client = {
995
998
  client_id: o,
996
999
  token_endpoint_auth_method: "none"
997
- }, this.audience = n, this.issuer = e, this.callbackUrlPath = oe(c, "/oauth/callback"), this.scopes = p ?? ["openid", "profile", "email"];
998
- const w = oe(c, "/");
1000
+ }, this.audience = n, this.issuer = e, this.callbackUrlPath = ie(c, "/oauth/callback"), this.scopes = p ?? ["openid", "profile", "email"];
1001
+ const w = ie(c, "/");
999
1002
  this.logoutRedirectUrlPath = w, this.redirectToAfterSignUp = a ?? w, this.redirectToAfterSignIn = r ?? w, this.redirectToAfterSignOut = i ?? w;
1000
1003
  }
1001
1004
  async getAuthServer() {
1002
1005
  if (!this.authorizationServer) {
1003
- const e = new URL(this.issuer), n = await Xe(e);
1004
- this.authorizationServer = await et(
1006
+ const e = new URL(this.issuer), n = await et(e);
1007
+ this.authorizationServer = await tt(
1005
1008
  e,
1006
1009
  n
1007
1010
  );
@@ -1013,10 +1016,10 @@ class Dt {
1013
1016
  * @param response
1014
1017
  */
1015
1018
  setTokensFromResponse(e) {
1016
- if (V(e))
1017
- throw ae.error("Bad Token Response", e), new fe("Bad Token Response", e);
1019
+ if (G(e))
1020
+ throw se.error("Bad Token Response", e), new pe("Bad Token Response", e);
1018
1021
  if (!e.expires_in)
1019
- throw new P("No expires_in in response");
1022
+ throw new R("No expires_in in response");
1020
1023
  const n = {
1021
1024
  accessToken: e.access_token,
1022
1025
  refreshToken: e.refresh_token,
@@ -1024,7 +1027,7 @@ class Dt {
1024
1027
  expiresOn: new Date(Date.now() + e.expires_in * 1e3),
1025
1028
  tokenType: e.token_type
1026
1029
  };
1027
- L.setState({
1030
+ x.setState({
1028
1031
  providerData: n
1029
1032
  });
1030
1033
  }
@@ -1043,64 +1046,62 @@ class Dt {
1043
1046
  redirectTo: e,
1044
1047
  isSignUp: n = !1
1045
1048
  }) {
1046
- var f, g;
1049
+ var v;
1047
1050
  const o = "S256", a = await this.getAuthServer();
1048
1051
  if (!a.authorization_endpoint)
1049
- throw new P("No authorization endpoint");
1050
- const r = tt(), i = await rt(r);
1052
+ throw new R("No authorization endpoint");
1053
+ const r = nt(), i = await ot(r);
1051
1054
  sessionStorage.setItem(M, r);
1052
1055
  const c = new URL(
1053
1056
  a.authorization_endpoint
1054
1057
  ), p = e.startsWith(window.location.origin) ? e.slice(window.location.origin.length) : e;
1055
1058
  sessionStorage.setItem("redirect-to", p);
1056
1059
  const w = new URL(window.location.origin);
1057
- if (w.pathname = this.callbackUrlPath, w.search = "", c.searchParams.set("client_id", this.client.client_id), c.searchParams.set("redirect_uri", w.toString()), c.searchParams.set("response_type", "code"), c.searchParams.set("scope", this.scopes.join(" ")), c.searchParams.set("code_challenge", i), c.searchParams.set(
1060
+ w.pathname = this.callbackUrlPath, w.search = "", c.searchParams.set("client_id", this.client.client_id), c.searchParams.set("redirect_uri", w.toString()), c.searchParams.set("response_type", "code"), c.searchParams.set("scope", this.scopes.join(" ")), c.searchParams.set("code_challenge", i), c.searchParams.set(
1058
1061
  "code_challenge_method",
1059
1062
  o
1060
- ), this.audience && c.searchParams.set("audience", this.audience), (f = this.onAuthorizationUrl) == null || f.call(this, c, {
1063
+ ), this.audience && c.searchParams.set("audience", this.audience), (v = this.onAuthorizationUrl) == null || v.call(this, c, {
1061
1064
  isSignIn: !n,
1062
1065
  isSignUp: n
1063
- }), ((g = a.code_challenge_methods_supported) == null ? void 0 : g.includes("S256")) !== !0) {
1064
- const v = nt();
1065
- c.searchParams.set("state", v);
1066
- }
1067
- location.href = c.href;
1066
+ });
1067
+ const f = rt();
1068
+ sessionStorage.setItem(q, f), c.searchParams.set("state", f), location.href = c.href;
1068
1069
  }
1069
1070
  async getAccessToken() {
1070
- const e = await this.getAuthServer(), { providerData: n } = L.getState();
1071
+ const e = await this.getAuthServer(), { providerData: n } = x.getState();
1071
1072
  if (!n)
1072
- throw new P("User is not authenticated");
1073
+ throw new R("User is not authenticated");
1073
1074
  const o = n;
1074
1075
  if (new Date(o.expiresOn) < /* @__PURE__ */ new Date()) {
1075
1076
  if (!o.refreshToken)
1076
- return L.setState({
1077
+ return x.setState({
1077
1078
  isAuthenticated: !1,
1078
1079
  isPending: !1,
1079
1080
  profile: null,
1080
1081
  providerData: null
1081
1082
  }), "";
1082
- const a = await gt(
1083
+ const a = await yt(
1083
1084
  e,
1084
1085
  this.client,
1085
1086
  o.refreshToken
1086
- ), r = await bt(
1087
+ ), r = await _t(
1087
1088
  e,
1088
1089
  this.client,
1089
1090
  a
1090
1091
  );
1091
1092
  if (!r.access_token)
1092
- throw new P("No access token in response");
1093
+ throw new R("No access token in response");
1093
1094
  return this.setTokensFromResponse(r), r.access_token.toString();
1094
1095
  } else
1095
1096
  return o.accessToken;
1096
1097
  }
1097
1098
  getAuthenticationPlugin() {
1098
- return new zt(this.callbackUrlPath, this.handleCallback);
1099
+ return new Dt(this.callbackUrlPath, this.handleCallback);
1099
1100
  }
1100
1101
  }
1101
- const Vt = (t) => new Dt(t);
1102
+ const Gt = (t) => new Nt(t);
1102
1103
  export {
1103
- Dt as OpenIDAuthenticationProvider,
1104
- Vt as default
1104
+ Nt as OpenIDAuthenticationProvider,
1105
+ Gt as default
1105
1106
  };
1106
1107
  //# sourceMappingURL=zudoku.auth-openid.js.map