zudoku 0.40.1 → 0.41.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 (122) hide show
  1. package/dist/app/main.js +7 -4
  2. package/dist/app/main.js.map +1 -1
  3. package/dist/cli/cli.js +12 -1
  4. package/dist/cli/cli.js.map +1 -1
  5. package/dist/cli/common/machine-id/lib.js +1 -0
  6. package/dist/cli/common/machine-id/lib.js.map +1 -1
  7. package/dist/config/ZuploBuildConfig.d.ts +155 -0
  8. package/dist/config/ZuploBuildConfig.js +29 -0
  9. package/dist/config/ZuploBuildConfig.js.map +1 -0
  10. package/dist/config/loader.js +0 -3
  11. package/dist/config/loader.js.map +1 -1
  12. package/dist/config/validators/common.d.ts +17 -11
  13. package/dist/config/validators/common.js +1 -1
  14. package/dist/config/validators/common.js.map +1 -1
  15. package/dist/config/validators/validate.d.ts +7 -5
  16. package/dist/lib/authentication/providers/openid.d.ts +3 -1
  17. package/dist/lib/authentication/providers/openid.js +17 -11
  18. package/dist/lib/authentication/providers/openid.js.map +1 -1
  19. package/dist/lib/components/BuildCheck.d.ts +4 -0
  20. package/dist/lib/components/BuildCheck.js +22 -0
  21. package/dist/lib/components/BuildCheck.js.map +1 -0
  22. package/dist/lib/components/Zudoku.js +1 -3
  23. package/dist/lib/components/Zudoku.js.map +1 -1
  24. package/dist/lib/components/context/ViewportAnchorContext.js +8 -9
  25. package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
  26. package/dist/lib/components/index.d.ts +4 -0
  27. package/dist/lib/components/index.js +2 -0
  28. package/dist/lib/components/index.js.map +1 -1
  29. package/dist/lib/components/navigation/PoweredByZudoku.js +2 -1
  30. package/dist/lib/components/navigation/PoweredByZudoku.js.map +1 -1
  31. package/dist/lib/components/navigation/ZuploLogo.d.ts +3 -0
  32. package/dist/lib/components/navigation/ZuploLogo.js +4 -0
  33. package/dist/lib/components/navigation/ZuploLogo.js.map +1 -0
  34. package/dist/lib/oas/parser/index.d.ts +1 -1
  35. package/dist/lib/oas/parser/index.js +3 -2
  36. package/dist/lib/oas/parser/index.js.map +1 -1
  37. package/dist/lib/plugins/openapi/OperationList.d.ts +1 -1
  38. package/dist/lib/plugins/openapi/OperationList.js +6 -4
  39. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  40. package/dist/lib/plugins/openapi/util/getRoutes.js +20 -13
  41. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  42. package/dist/lib/util/ensureArray.d.ts +1 -0
  43. package/dist/lib/util/ensureArray.js +2 -0
  44. package/dist/lib/util/ensureArray.js.map +1 -0
  45. package/dist/vite/api/SchemaManager.d.ts +36 -0
  46. package/dist/vite/api/SchemaManager.js +120 -0
  47. package/dist/vite/api/SchemaManager.js.map +1 -0
  48. package/dist/vite/api/SchemaManager.test.d.ts +1 -0
  49. package/dist/vite/api/SchemaManager.test.js +106 -0
  50. package/dist/vite/api/SchemaManager.test.js.map +1 -0
  51. package/dist/vite/config.js +5 -1
  52. package/dist/vite/config.js.map +1 -1
  53. package/dist/vite/plugin-api.js +38 -110
  54. package/dist/vite/plugin-api.js.map +1 -1
  55. package/dist/vite/plugin-sidebar.d.ts +3 -1
  56. package/dist/vite/plugin-sidebar.js +8 -2
  57. package/dist/vite/plugin-sidebar.js.map +1 -1
  58. package/dist/zuplo/env.d.ts +26 -0
  59. package/dist/zuplo/env.js +17 -0
  60. package/dist/zuplo/env.js.map +1 -1
  61. package/dist/zuplo/with-zuplo.d.ts +3 -0
  62. package/dist/zuplo/with-zuplo.js +6 -9
  63. package/dist/zuplo/with-zuplo.js.map +1 -1
  64. package/lib/{Markdown-C5h6bxbE.js → Markdown-DqDbGCj2.js} +314 -315
  65. package/lib/{Markdown-C5h6bxbE.js.map → Markdown-DqDbGCj2.js.map} +1 -1
  66. package/lib/{MdxPage-B66ht0D_.js → MdxPage-DGVqOhzg.js} +5 -5
  67. package/lib/{MdxPage-B66ht0D_.js.map → MdxPage-DGVqOhzg.js.map} +1 -1
  68. package/lib/{OasProvider-BKPF0Pbt.js → OasProvider-qeJNCq-h.js} +2 -2
  69. package/lib/{OasProvider-BKPF0Pbt.js.map → OasProvider-qeJNCq-h.js.map} +1 -1
  70. package/lib/{OperationList-0bhBU7ME.js → OperationList-CBpQALZd.js} +798 -794
  71. package/lib/{OperationList-0bhBU7ME.js.map → OperationList-CBpQALZd.js.map} +1 -1
  72. package/lib/{Pagination-Bt1czAiJ.js → Pagination-PfYTF0cF.js} +2 -2
  73. package/lib/{Pagination-Bt1czAiJ.js.map → Pagination-PfYTF0cF.js.map} +1 -1
  74. package/lib/{SchemaList-CsTIT1pi.js → SchemaList-BIzyXPnY.js} +5 -5
  75. package/lib/{SchemaList-CsTIT1pi.js.map → SchemaList-BIzyXPnY.js.map} +1 -1
  76. package/lib/{SchemaView-DCSWtnYr.js → SchemaView-DwlVvFfp.js} +2 -2
  77. package/lib/{SchemaView-DCSWtnYr.js.map → SchemaView-DwlVvFfp.js.map} +1 -1
  78. package/lib/{SlotletProvider-VUmTNmLZ.js → SlotletProvider-p4XaFFOh.js} +2 -2
  79. package/lib/{SlotletProvider-VUmTNmLZ.js.map → SlotletProvider-p4XaFFOh.js.map} +1 -1
  80. package/lib/{Toc-BK39DQvI.js → Toc-BVdRaIC0.js} +2 -2
  81. package/lib/{Toc-BK39DQvI.js.map → Toc-BVdRaIC0.js.map} +1 -1
  82. package/lib/{createServer-DLN7APz_.js → createServer-D_5UkLtY.js} +1459 -1485
  83. package/lib/createServer-D_5UkLtY.js.map +1 -0
  84. package/lib/{index-tpbiZmWp.js → index-B7lRu87v.js} +686 -648
  85. package/lib/index-B7lRu87v.js.map +1 -0
  86. package/lib/index-BpThvE5R.js +66 -0
  87. package/lib/index-BpThvE5R.js.map +1 -0
  88. package/lib/{index-Ba_X7EnR.js → index-CxdJ8TBB.js} +255 -249
  89. package/lib/{index-Ba_X7EnR.js.map → index-CxdJ8TBB.js.map} +1 -1
  90. package/lib/index-ueM1dihS.js +247 -0
  91. package/lib/index-ueM1dihS.js.map +1 -0
  92. package/lib/{index-DcHeSvkE.js → public-api-CrAQFYc4.js} +651 -684
  93. package/lib/public-api-CrAQFYc4.js.map +1 -0
  94. package/lib/zudoku.auth-openid.js +144 -138
  95. package/lib/zudoku.auth-openid.js.map +1 -1
  96. package/lib/zudoku.components.js +23 -22
  97. package/lib/zudoku.plugin-api-catalog.js +2 -2
  98. package/lib/zudoku.plugin-api-keys.js +1 -1
  99. package/lib/zudoku.plugin-custom-pages.js +1 -1
  100. package/lib/zudoku.plugin-markdown.js +1 -1
  101. package/lib/zudoku.plugin-openapi.js +1 -1
  102. package/package.json +2 -2
  103. package/src/app/main.tsx +12 -1
  104. package/src/lib/authentication/providers/openid.tsx +23 -12
  105. package/src/lib/components/BuildCheck.tsx +60 -0
  106. package/src/lib/components/Zudoku.tsx +1 -3
  107. package/src/lib/components/context/ViewportAnchorContext.tsx +8 -15
  108. package/src/lib/components/index.ts +2 -0
  109. package/src/lib/components/navigation/PoweredByZudoku.tsx +8 -3
  110. package/src/lib/components/navigation/ZuploLogo.tsx +14 -0
  111. package/src/lib/oas/parser/index.ts +4 -2
  112. package/src/lib/plugins/openapi/OperationList.tsx +15 -3
  113. package/src/lib/plugins/openapi/util/getRoutes.tsx +21 -13
  114. package/src/lib/util/ensureArray.ts +3 -0
  115. package/client.d.ts +0 -8
  116. package/dist/lib/oas/parser/upgrade/index.d.ts +0 -9
  117. package/dist/lib/oas/parser/upgrade/index.js +0 -90
  118. package/dist/lib/oas/parser/upgrade/index.js.map +0 -1
  119. package/lib/createServer-DLN7APz_.js.map +0 -1
  120. package/lib/index-DcHeSvkE.js.map +0 -1
  121. package/lib/index-tpbiZmWp.js.map +0 -1
  122. package/src/lib/oas/parser/upgrade/index.ts +0 -103
@@ -1,10 +1,10 @@
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 b = (t, e, n) => xe(t, typeof e != "symbol" ? e + "" : e, n);
1
+ var Ce = Object.defineProperty;
2
+ var Le = (t, e, n) => e in t ? Ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var w = (t, e, n) => Le(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { j as B } from "./jsx-runtime-C5mzlN2N.js";
5
- import { g as Ce } from "./_commonjsHelpers-B4e78b8K.js";
5
+ import { g as xe } from "./_commonjsHelpers-B4e78b8K.js";
6
6
  import { C as Ie } from "./ClientOnly-E7hGysn1.js";
7
- import { d as je, f as ie, u as x } from "./hook-pPrHCB6G.js";
7
+ import { d as je, f as ie, u as L } from "./hook-pPrHCB6G.js";
8
8
  import { A as Je } from "./AuthenticationPlugin-CJOFRBk3.js";
9
9
  import { N as Oe } from "./chunk-KNED5TY2-BUPjb3LQ.js";
10
10
  import { Z as ze } from "./invariant-Caa8-XvF.js";
@@ -37,7 +37,7 @@ function Ne() {
37
37
  function p() {
38
38
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
39
39
  }
40
- function w(l) {
40
+ function _(l) {
41
41
  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;
42
42
  }
43
43
  function f() {
@@ -53,14 +53,14 @@ function Ne() {
53
53
  typeof console !== n && (f.call(this), this[l].apply(this, arguments));
54
54
  };
55
55
  }
56
- function _(l, m, u) {
57
- return w(l) || v.apply(this, arguments);
56
+ function b(l, m, u) {
57
+ return _(l) || v.apply(this, arguments);
58
58
  }
59
- function h(l, m) {
59
+ function d(l, m) {
60
60
  var u = this, J, $, U, S = "loglevel";
61
61
  typeof l == "string" ? S += ":" + l : typeof l == "symbol" && (S = void 0);
62
- function Re(d) {
63
- var y = (a[d] || "silent").toUpperCase();
62
+ function Re(h) {
63
+ var y = (a[h] || "silent").toUpperCase();
64
64
  if (!(typeof window === n || !S)) {
65
65
  try {
66
66
  window.localStorage[S] = y;
@@ -74,21 +74,21 @@ function Ne() {
74
74
  }
75
75
  }
76
76
  function ne() {
77
- var d;
77
+ var h;
78
78
  if (!(typeof window === n || !S)) {
79
79
  try {
80
- d = window.localStorage[S];
80
+ h = window.localStorage[S];
81
81
  } catch {
82
82
  }
83
- if (typeof d === n)
83
+ if (typeof h === n)
84
84
  try {
85
85
  var y = window.document.cookie, O = encodeURIComponent(S), oe = y.indexOf(O + "=");
86
- oe !== -1 && (d = /^([^;]+)/.exec(
86
+ oe !== -1 && (h = /^([^;]+)/.exec(
87
87
  y.slice(oe + O.length + 1)
88
88
  )[1]);
89
89
  } catch {
90
90
  }
91
- return u.levels[d] === void 0 && (d = void 0), d;
91
+ return u.levels[h] === void 0 && (h = void 0), h;
92
92
  }
93
93
  }
94
94
  function Pe() {
@@ -103,11 +103,11 @@ function Ne() {
103
103
  }
104
104
  }
105
105
  }
106
- function L(d) {
107
- var y = d;
106
+ function C(h) {
107
+ var y = h;
108
108
  if (typeof y == "string" && u.levels[y.toUpperCase()] !== void 0 && (y = u.levels[y.toUpperCase()]), typeof y == "number" && y >= 0 && y <= u.levels.SILENT)
109
109
  return y;
110
- throw new TypeError("log.setLevel() called with invalid level: " + d);
110
+ throw new TypeError("log.setLevel() called with invalid level: " + h);
111
111
  }
112
112
  u.name = l, u.levels = {
113
113
  TRACE: 0,
@@ -116,33 +116,33 @@ function Ne() {
116
116
  WARN: 3,
117
117
  ERROR: 4,
118
118
  SILENT: 5
119
- }, u.methodFactory = m || _, u.getLevel = function() {
119
+ }, u.methodFactory = m || b, u.getLevel = function() {
120
120
  return U ?? $ ?? J;
121
- }, u.setLevel = function(d, y) {
122
- return U = L(d), y !== !1 && Re(U), f.call(u);
123
- }, u.setDefaultLevel = function(d) {
124
- $ = L(d), ne() || u.setLevel(d, !1);
121
+ }, u.setLevel = function(h, y) {
122
+ return U = C(h), y !== !1 && Re(U), f.call(u);
123
+ }, u.setDefaultLevel = function(h) {
124
+ $ = C(h), ne() || u.setLevel(h, !1);
125
125
  }, u.resetLevel = function() {
126
126
  U = null, Pe(), f.call(u);
127
- }, u.enableAll = function(d) {
128
- u.setLevel(u.levels.TRACE, d);
129
- }, u.disableAll = function(d) {
130
- u.setLevel(u.levels.SILENT, d);
127
+ }, u.enableAll = function(h) {
128
+ u.setLevel(u.levels.TRACE, h);
129
+ }, u.disableAll = function(h) {
130
+ u.setLevel(u.levels.SILENT, h);
131
131
  }, u.rebuild = function() {
132
- if (i !== u && (J = L(i.getLevel())), f.call(u), i === u)
133
- for (var d in r)
134
- r[d].rebuild();
135
- }, J = L(
132
+ if (i !== u && (J = C(i.getLevel())), f.call(u), i === u)
133
+ for (var h in r)
134
+ r[h].rebuild();
135
+ }, J = C(
136
136
  i ? i.getLevel() : "WARN"
137
137
  );
138
138
  var re = ne();
139
- re != null && (U = L(re)), f.call(u);
139
+ re != null && (U = C(re)), f.call(u);
140
140
  }
141
- i = new h(), i.getLogger = function(m) {
141
+ i = new d(), i.getLogger = function(m) {
142
142
  if (typeof m != "symbol" && typeof m != "string" || m === "")
143
143
  throw new TypeError("You must supply a name when creating a logger.");
144
144
  var u = r[m];
145
- return u || (u = r[m] = new h(
145
+ return u || (u = r[m] = new d(
146
146
  m,
147
147
  i.methodFactory
148
148
  )), u;
@@ -157,7 +157,7 @@ function Ne() {
157
157
  }(D)), D.exports;
158
158
  }
159
159
  var We = Ne();
160
- const se = /* @__PURE__ */ Ce(We);
160
+ const se = /* @__PURE__ */ xe(We);
161
161
  let V;
162
162
  var z, we;
163
163
  (typeof navigator > "u" || !((we = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && we.call(z, "Mozilla/5.0 "))) && (V = "oauth4webapi/v2.17.0");
@@ -192,7 +192,7 @@ function Ve(t) {
192
192
  throw new s("The input to be decoded is not correctly encoded.", { cause: e });
193
193
  }
194
194
  }
195
- function k(t) {
195
+ function A(t) {
196
196
  return typeof t == "string" ? Ve(t) : Be(t);
197
197
  }
198
198
  class Ge {
@@ -249,7 +249,7 @@ function Q(t) {
249
249
  }
250
250
  return t;
251
251
  }
252
- function C(t) {
252
+ function x(t) {
253
253
  return !(t === null || typeof t != "object" || Array.isArray(t));
254
254
  }
255
255
  function K(t) {
@@ -308,7 +308,7 @@ async function tt(t, e) {
308
308
  } catch (o) {
309
309
  throw new s('failed to parse "response" body as JSON', { cause: o });
310
310
  }
311
- if (!C(n))
311
+ if (!x(n))
312
312
  throw new s('"response" body must be a top level object');
313
313
  if (!g(n.issuer))
314
314
  throw new s('"response" body "issuer" property must be a non-empty string');
@@ -317,7 +317,7 @@ async function tt(t, e) {
317
317
  return n;
318
318
  }
319
319
  function X() {
320
- return k(crypto.getRandomValues(new Uint8Array(32)));
320
+ return A(crypto.getRandomValues(new Uint8Array(32)));
321
321
  }
322
322
  function nt() {
323
323
  return X();
@@ -328,7 +328,7 @@ function rt() {
328
328
  async function ot(t) {
329
329
  if (!g(t))
330
330
  throw new TypeError('"codeVerifier" must be a non-empty string');
331
- return k(await crypto.subtle.digest("SHA-256", E(t)));
331
+ return A(await crypto.subtle.digest("SHA-256", E(t)));
332
332
  }
333
333
  function ue(t) {
334
334
  return encodeURIComponent(t).replace(/%20/g, "+");
@@ -418,7 +418,7 @@ function le(t) {
418
418
  throw new TypeError('"client.client_secret" property must be a non-empty string');
419
419
  return t;
420
420
  }
421
- function de(t, e) {
421
+ function he(t, e) {
422
422
  if (e !== void 0)
423
423
  throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
424
424
  }
@@ -434,25 +434,25 @@ async function lt(t, e, n, o, a) {
434
434
  break;
435
435
  }
436
436
  case "private_key_jwt":
437
- 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"');
437
+ throw he("private_key_jwt", e.client_secret), new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
438
438
  case "tls_client_auth":
439
439
  case "self_signed_tls_client_auth":
440
440
  case "none": {
441
- de(e.token_endpoint_auth_method, e.client_secret), e.token_endpoint_auth_method, n.set("client_id", e.client_id);
441
+ he(e.token_endpoint_auth_method, e.client_secret), e.token_endpoint_auth_method, n.set("client_id", e.client_id);
442
442
  break;
443
443
  }
444
444
  default:
445
445
  throw new T("unsupported client token_endpoint_auth_method");
446
446
  }
447
447
  }
448
- async function dt(t, e, n) {
448
+ async function ht(t, e, n) {
449
449
  if (!n.usages.includes("sign"))
450
450
  throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
451
- const o = `${k(E(JSON.stringify(t)))}.${k(E(JSON.stringify(e)))}`, a = k(await crypto.subtle.sign(ke(n), n, E(o)));
451
+ const o = `${A(E(JSON.stringify(t)))}.${A(E(JSON.stringify(e)))}`, a = A(await crypto.subtle.sign(Ae(n), n, E(o)));
452
452
  return `${o}.${a}`;
453
453
  }
454
- async function ht(t, e, n, o, a, r) {
455
- var _;
454
+ async function dt(t, e, n, o, a, r) {
455
+ var b;
456
456
  const { privateKey: i, publicKey: c, nonce: p = ge.get(n.origin) } = e;
457
457
  if (!Ze(i))
458
458
  throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
@@ -462,19 +462,19 @@ async function ht(t, e, n, o, a, r) {
462
462
  throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
463
463
  if (!c.extractable)
464
464
  throw new TypeError('"DPoP.publicKey.extractable" must be true');
465
- const w = ee() + a, f = {
465
+ const _ = ee() + a, f = {
466
466
  alg: ut(i),
467
467
  typ: "dpop+jwt",
468
468
  jwk: await pt(c)
469
469
  }, v = {
470
- iat: w,
470
+ iat: _,
471
471
  jti: X(),
472
472
  htm: o,
473
473
  nonce: p,
474
474
  htu: `${n.origin}${n.pathname}`,
475
- ath: r ? k(await crypto.subtle.digest("SHA-256", E(r))) : void 0
475
+ ath: r ? A(await crypto.subtle.digest("SHA-256", E(r))) : void 0
476
476
  };
477
- (_ = e[He]) == null || _.call(e, f, v), t.set("dpop", await dt(f, v, i));
477
+ (b = e[He]) == null || b.call(e, f, v), t.set("dpop", await ht(f, v, i));
478
478
  }
479
479
  let N;
480
480
  async function ft(t) {
@@ -484,13 +484,13 @@ async function ft(t) {
484
484
  async function pt(t) {
485
485
  return N || (N = /* @__PURE__ */ new WeakMap()), N.get(t) || ft(t);
486
486
  }
487
- function he(t, e, n) {
487
+ function de(t, e, n) {
488
488
  if (typeof t != "string")
489
489
  throw n ? new TypeError(`"as.mtls_endpoint_aliases.${e}" must be a string`) : new TypeError(`"as.${e}" must be a string`);
490
490
  return new URL(t);
491
491
  }
492
492
  function be(t, e, n = !1) {
493
- 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);
493
+ 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);
494
494
  }
495
495
  function _e(t, e) {
496
496
  return !!(t.use_mtls_endpoint_aliases || e != null && e[Fe]);
@@ -504,7 +504,7 @@ async function wt(t, e, n, o, a, r) {
504
504
  throw new TypeError('"accessToken" must be a non-empty string');
505
505
  if (!(n instanceof URL))
506
506
  throw new TypeError('"url" must be an instance of URL');
507
- 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, {
507
+ 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
508
  body: a,
509
509
  headers: Object.fromEntries(o.entries()),
510
510
  method: e,
@@ -566,7 +566,7 @@ async function Te(t, e, n, o = !1, a = !1) {
566
566
  } catch (i) {
567
567
  throw new s('failed to parse "response" body as JSON', { cause: i });
568
568
  }
569
- if (!C(r))
569
+ if (!x(r))
570
570
  throw new s('"response" body must be a top level object');
571
571
  if (!g(r.access_token))
572
572
  throw new s('"response" body "access_token" property must be a non-empty string');
@@ -584,7 +584,7 @@ async function Te(t, e, n, o = !1, a = !1) {
584
584
  if (r.id_token !== void 0 && !g(r.id_token))
585
585
  throw new s('"response" body "id_token" property must be a non-empty string');
586
586
  if (r.id_token) {
587
- 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));
587
+ const { claims: i, jwt: c } = await xt(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));
588
588
  if (Array.isArray(i.aud) && i.aud.length !== 1) {
589
589
  if (i.azp === void 0)
590
590
  throw new s('ID Token "aud" (audience) claim includes additional untrusted audiences');
@@ -614,24 +614,24 @@ function St(t, e) {
614
614
  throw new s('unexpected JWT "iss" (issuer) claim value');
615
615
  return e;
616
616
  }
617
- const Ae = /* @__PURE__ */ new WeakSet();
617
+ const ke = /* @__PURE__ */ new WeakSet();
618
618
  function Tt(t) {
619
- return Ae.add(t), t;
619
+ return ke.add(t), t;
620
620
  }
621
- async function At(t, e, n, o, a, r) {
622
- if (I(t), j(e), !Ae.has(n))
621
+ async function kt(t, e, n, o, a, r) {
622
+ if (I(t), j(e), !ke.has(n))
623
623
  throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
624
624
  if (!g(o))
625
625
  throw new TypeError('"redirectUri" must be a non-empty string');
626
626
  if (!g(a))
627
627
  throw new TypeError('"codeVerifier" must be a non-empty string');
628
- const i = A(n, "code");
628
+ const i = k(n, "code");
629
629
  if (!i)
630
630
  throw new s('no authorization code in "callbackParameters"');
631
631
  const c = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
632
632
  return c.set("redirect_uri", o), c.set("code_verifier", a), c.set("code", i), ve(t, e, "authorization_code", c, r);
633
633
  }
634
- const kt = {
634
+ const At = {
635
635
  aud: "audience",
636
636
  c_hash: "code hash",
637
637
  client_id: "client id",
@@ -650,7 +650,7 @@ const kt = {
650
650
  function Et(t, e) {
651
651
  for (const n of t)
652
652
  if (e.claims[n] === void 0)
653
- throw new s(`JWT "${n}" (${kt[n]}) claim missing`);
653
+ throw new s(`JWT "${n}" (${At[n]}) claim missing`);
654
654
  return e;
655
655
  }
656
656
  const Rt = Symbol(), F = Symbol();
@@ -696,7 +696,7 @@ async function Ut(t) {
696
696
  te(t);
697
697
  try {
698
698
  const e = await t.json();
699
- if (C(e) && typeof e.error == "string" && e.error.length)
699
+ if (x(e) && typeof e.error == "string" && e.error.length)
700
700
  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;
701
701
  } catch {
702
702
  }
@@ -706,7 +706,7 @@ function fe(t) {
706
706
  if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
707
707
  throw new s(`${t.name} modulusLength must be at least 2048 bits`);
708
708
  }
709
- function Lt(t) {
709
+ function Ct(t) {
710
710
  switch (t) {
711
711
  case "P-256":
712
712
  return "SHA-256";
@@ -718,12 +718,12 @@ function Lt(t) {
718
718
  throw new T();
719
719
  }
720
720
  }
721
- function ke(t) {
721
+ function Ae(t) {
722
722
  switch (t.algorithm.name) {
723
723
  case "ECDSA":
724
724
  return {
725
725
  name: t.algorithm.name,
726
- hash: Lt(t.algorithm.namedCurve)
726
+ hash: Ct(t.algorithm.namedCurve)
727
727
  };
728
728
  case "RSA-PSS":
729
729
  switch (fe(t.algorithm), t.algorithm.hash.name) {
@@ -746,61 +746,61 @@ function ke(t) {
746
746
  throw new T();
747
747
  }
748
748
  const Ee = Symbol();
749
- async function xt(t, e, n, o) {
749
+ async function Lt(t, e, n, o) {
750
750
  const a = `${t}.${e}`;
751
- if (!await crypto.subtle.verify(ke(n), n, o, E(a)))
751
+ if (!await crypto.subtle.verify(Ae(n), n, o, E(a)))
752
752
  throw new s("JWT signature verification failed");
753
753
  }
754
- async function Ct(t, e, n, o, a, r) {
755
- let { 0: i, 1: c, 2: p, length: w } = t.split(".");
756
- if (w === 5)
754
+ async function xt(t, e, n, o, a, r) {
755
+ let { 0: i, 1: c, 2: p, length: _ } = t.split(".");
756
+ if (_ === 5)
757
757
  if (r !== void 0)
758
- t = await r(t), { 0: i, 1: c, 2: p, length: w } = t.split(".");
758
+ t = await r(t), { 0: i, 1: c, 2: p, length: _ } = t.split(".");
759
759
  else
760
760
  throw new T("JWE structure JWTs are not supported");
761
- if (w !== 3)
761
+ if (_ !== 3)
762
762
  throw new s("Invalid JWT");
763
763
  let f;
764
764
  try {
765
- f = JSON.parse(E(k(i)));
765
+ f = JSON.parse(E(A(i)));
766
766
  } catch (l) {
767
767
  throw new s("failed to parse JWT Header body as base64url encoded JSON", { cause: l });
768
768
  }
769
- if (!C(f))
769
+ if (!x(f))
770
770
  throw new s("JWT Header must be a top level object");
771
771
  if (e(f), f.crit !== void 0)
772
772
  throw new s('unexpected JWT "crit" header parameter');
773
- const v = k(p);
774
- let _;
775
- n !== Ee && (_ = await n(f), await xt(i, c, _, v));
776
- let h;
773
+ const v = A(p);
774
+ let b;
775
+ n !== Ee && (b = await n(f), await Lt(i, c, b, v));
776
+ let d;
777
777
  try {
778
- h = JSON.parse(E(k(c)));
778
+ d = JSON.parse(E(A(c)));
779
779
  } catch (l) {
780
780
  throw new s("failed to parse JWT Payload body as base64url encoded JSON", { cause: l });
781
781
  }
782
- if (!C(h))
782
+ if (!x(d))
783
783
  throw new s("JWT Payload must be a top level object");
784
784
  const P = ee() + o;
785
- if (h.exp !== void 0) {
786
- if (typeof h.exp != "number")
785
+ if (d.exp !== void 0) {
786
+ if (typeof d.exp != "number")
787
787
  throw new s('unexpected JWT "exp" (expiration time) claim type');
788
- if (h.exp <= P - a)
788
+ if (d.exp <= P - a)
789
789
  throw new s('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
790
790
  }
791
- if (h.iat !== void 0 && typeof h.iat != "number")
791
+ if (d.iat !== void 0 && typeof d.iat != "number")
792
792
  throw new s('unexpected JWT "iat" (issued at) claim type');
793
- if (h.iss !== void 0 && typeof h.iss != "string")
793
+ if (d.iss !== void 0 && typeof d.iss != "string")
794
794
  throw new s('unexpected JWT "iss" (issuer) claim type');
795
- if (h.nbf !== void 0) {
796
- if (typeof h.nbf != "number")
795
+ if (d.nbf !== void 0) {
796
+ if (typeof d.nbf != "number")
797
797
  throw new s('unexpected JWT "nbf" (not before) claim type');
798
- if (h.nbf > P + a)
798
+ if (d.nbf > P + a)
799
799
  throw new s('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
800
800
  }
801
- if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
801
+ if (d.aud !== void 0 && typeof d.aud != "string" && !Array.isArray(d.aud))
802
802
  throw new s('unexpected JWT "aud" (audience) claim type');
803
- return { header: f, claims: h, signature: v, key: _, jwt: t };
803
+ return { header: f, claims: d, signature: v, key: b, jwt: t };
804
804
  }
805
805
  function It(t, e, n) {
806
806
  if (t !== void 0) {
@@ -816,7 +816,7 @@ function It(t, e, n) {
816
816
  if (n.alg !== "RS256")
817
817
  throw new s('unexpected JWT "alg" header parameter');
818
818
  }
819
- function A(t, e) {
819
+ function k(t, e) {
820
820
  const { 0: n, length: o } = t.getAll(e);
821
821
  if (o > 1)
822
822
  throw new s(`"${e}" parameter must be provided only once`);
@@ -826,9 +826,9 @@ const jt = Symbol(), Jt = Symbol();
826
826
  function Ot(t, e, n, o) {
827
827
  if (I(t), j(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
828
828
  throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
829
- if (A(n, "response"))
829
+ if (k(n, "response"))
830
830
  throw new s('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
831
- const a = A(n, "iss"), r = A(n, "state");
831
+ const a = k(n, "iss"), r = k(n, "state");
832
832
  if (!a && t.authorization_response_iss_parameter_supported)
833
833
  throw new s('response parameter "iss" (issuer) missing');
834
834
  if (a && a !== t.issuer)
@@ -849,14 +849,14 @@ function Ot(t, e, n, o) {
849
849
  if (r !== o)
850
850
  throw new s('unexpected "state" response parameter value');
851
851
  }
852
- const i = A(n, "error");
852
+ const i = k(n, "error");
853
853
  if (i)
854
854
  return {
855
855
  error: i,
856
- error_description: A(n, "error_description"),
857
- error_uri: A(n, "error_uri")
856
+ error_description: k(n, "error_description"),
857
+ error_uri: k(n, "error_uri")
858
858
  };
859
- const c = A(n, "id_token"), p = A(n, "token");
859
+ const c = k(n, "id_token"), p = k(n, "token");
860
860
  if (c !== void 0 || p !== void 0)
861
861
  throw new T("implicit and hybrid flows are not supported");
862
862
  return Tt(new URLSearchParams(n));
@@ -914,23 +914,25 @@ class Nt {
914
914
  basePath: c,
915
915
  scopes: p
916
916
  }) {
917
- b(this, "client");
918
- b(this, "issuer");
919
- b(this, "authorizationServer");
920
- b(this, "callbackUrlPath");
921
- b(this, "logoutRedirectUrlPath");
922
- b(this, "onAuthorizationUrl");
923
- b(this, "redirectToAfterSignUp");
924
- b(this, "redirectToAfterSignIn");
925
- b(this, "redirectToAfterSignOut");
926
- b(this, "audience");
927
- b(this, "scopes");
928
- b(this, "signRequest", async (e) => {
917
+ w(this, "client");
918
+ w(this, "issuer");
919
+ w(this, "authorizationServer");
920
+ w(this, "absoluteCallbackUrlPath");
921
+ w(this, "relativeCallbackUrlPath");
922
+ w(this, "logoutRedirectUrlPath");
923
+ w(this, "onAuthorizationUrl");
924
+ w(this, "redirectToAfterSignUp");
925
+ w(this, "redirectToAfterSignIn");
926
+ w(this, "redirectToAfterSignOut");
927
+ w(this, "audience");
928
+ w(this, "scopes");
929
+ w(this, "root");
930
+ w(this, "signRequest", async (e) => {
929
931
  const n = await this.getAccessToken();
930
932
  return e.headers.set("Authorization", `Bearer ${n}`), e;
931
933
  });
932
- b(this, "signOut", async () => {
933
- x.setState({
934
+ w(this, "signOut", async () => {
935
+ L.setState({
934
936
  isAuthenticated: !1,
935
937
  isPending: !1,
936
938
  profile: void 0,
@@ -946,7 +948,7 @@ class Nt {
946
948
  n.toString()
947
949
  )) : o = n;
948
950
  });
949
- b(this, "handleCallback", async () => {
951
+ w(this, "handleCallback", async () => {
950
952
  const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(q);
951
953
  if (sessionStorage.removeItem(q), n !== o)
952
954
  throw new R("Invalid state parameter");
@@ -965,34 +967,34 @@ class Nt {
965
967
  i
966
968
  );
967
969
  const c = new URL(e);
968
- c.pathname = this.callbackUrlPath, c.search = "";
969
- const p = await At(
970
+ c.pathname = this.absoluteCallbackUrlPath, c.search = "";
971
+ const p = await kt(
970
972
  r,
971
973
  this.client,
972
974
  i,
973
975
  c.toString(),
974
976
  a
975
- ), w = await Pt(
977
+ ), _ = await Pt(
976
978
  r,
977
979
  this.client,
978
980
  p
979
981
  );
980
- this.setTokensFromResponse(w);
981
- const f = await this.getAccessToken(), _ = await (await gt(
982
+ this.setTokensFromResponse(_);
983
+ const f = await this.getAccessToken(), b = await (await gt(
982
984
  r,
983
985
  this.client,
984
986
  f
985
- )).json(), h = {
986
- sub: _.sub,
987
- email: _.email,
988
- name: _.name,
989
- emailVerified: _.email_verified ?? !1,
990
- pictureUrl: _.picture
987
+ )).json(), d = {
988
+ sub: b.sub,
989
+ email: b.email,
990
+ name: b.name,
991
+ emailVerified: b.email_verified ?? !1,
992
+ pictureUrl: b.picture
991
993
  };
992
- x.setState({
994
+ L.setState({
993
995
  isAuthenticated: !0,
994
996
  isPending: !1,
995
- profile: h
997
+ profile: d
996
998
  });
997
999
  const P = sessionStorage.getItem("redirect-to") ?? "/";
998
1000
  return sessionStorage.removeItem("redirect-to"), P;
@@ -1000,9 +1002,10 @@ class Nt {
1000
1002
  this.client = {
1001
1003
  client_id: o,
1002
1004
  token_endpoint_auth_method: "none"
1003
- }, this.audience = n, this.issuer = e, this.callbackUrlPath = ie(c, "/oauth/callback"), this.scopes = p ?? ["openid", "profile", "email"];
1004
- const w = ie(c, "/");
1005
- this.logoutRedirectUrlPath = w, this.redirectToAfterSignUp = a ?? w, this.redirectToAfterSignIn = r ?? w, this.redirectToAfterSignOut = i ?? w;
1005
+ }, this.audience = n, this.issuer = e, this.relativeCallbackUrlPath = "/oauth/callback", this.absoluteCallbackUrlPath = ie(
1006
+ c,
1007
+ this.relativeCallbackUrlPath
1008
+ ), this.scopes = p ?? ["openid", "profile", "email"], this.root = ie(c, "/"), this.logoutRedirectUrlPath = this.root, this.redirectToAfterSignUp = a ?? this.root, this.redirectToAfterSignIn = r ?? this.root, this.redirectToAfterSignOut = i ?? this.root;
1006
1009
  }
1007
1010
  async getAuthServer() {
1008
1011
  if (!this.authorizationServer) {
@@ -1030,7 +1033,7 @@ class Nt {
1030
1033
  expiresOn: new Date(Date.now() + e.expires_in * 1e3),
1031
1034
  tokenType: e.token_type
1032
1035
  };
1033
- x.setState({
1036
+ L.setState({
1034
1037
  providerData: n
1035
1038
  });
1036
1039
  }
@@ -1057,10 +1060,10 @@ class Nt {
1057
1060
  sessionStorage.setItem(M, r);
1058
1061
  const c = new URL(
1059
1062
  a.authorization_endpoint
1060
- ), p = e.startsWith(window.location.origin) ? e.slice(window.location.origin.length) : e;
1063
+ ), p = e.startsWith(window.location.origin) ? this.root !== "/" && e.startsWith(window.location.origin + this.root) ? e.slice(window.location.origin.length + this.root.length) : e.slice(window.location.origin.length) : e;
1061
1064
  sessionStorage.setItem("redirect-to", p);
1062
- const w = new URL(window.location.origin);
1063
- 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(
1065
+ const _ = new URL(window.location.origin);
1066
+ _.pathname = this.absoluteCallbackUrlPath, _.search = "", c.searchParams.set("client_id", this.client.client_id), c.searchParams.set("redirect_uri", _.toString()), c.searchParams.set("response_type", "code"), c.searchParams.set("scope", this.scopes.join(" ")), c.searchParams.set("code_challenge", i), c.searchParams.set(
1064
1067
  "code_challenge_method",
1065
1068
  o
1066
1069
  ), this.audience && c.searchParams.set("audience", this.audience), (v = this.onAuthorizationUrl) == null || v.call(this, c, {
@@ -1071,13 +1074,13 @@ class Nt {
1071
1074
  sessionStorage.setItem(q, f), c.searchParams.set("state", f), location.href = c.href;
1072
1075
  }
1073
1076
  async getAccessToken() {
1074
- const e = await this.getAuthServer(), { providerData: n } = x.getState();
1077
+ const e = await this.getAuthServer(), { providerData: n } = L.getState();
1075
1078
  if (!n)
1076
1079
  throw new R("User is not authenticated");
1077
1080
  const o = n;
1078
1081
  if (new Date(o.expiresOn) < /* @__PURE__ */ new Date()) {
1079
1082
  if (!o.refreshToken)
1080
- return x.setState({
1083
+ return L.setState({
1081
1084
  isAuthenticated: !1,
1082
1085
  isPending: !1,
1083
1086
  profile: null,
@@ -1099,7 +1102,10 @@ class Nt {
1099
1102
  return o.accessToken;
1100
1103
  }
1101
1104
  getAuthenticationPlugin() {
1102
- return new Dt(this.callbackUrlPath, this.handleCallback);
1105
+ return new Dt(
1106
+ this.relativeCallbackUrlPath,
1107
+ this.handleCallback
1108
+ );
1103
1109
  }
1104
1110
  }
1105
1111
  const Vt = (t) => new Nt(t);