zudoku 0.53.0 → 0.53.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 (91) hide show
  1. package/README.md +2 -2
  2. package/dist/app/demo.js +16 -1
  3. package/dist/app/demo.js.map +1 -1
  4. package/dist/cli/build/handler.js +9 -1
  5. package/dist/cli/build/handler.js.map +1 -1
  6. package/dist/config/loader.js +2 -5
  7. package/dist/config/loader.js.map +1 -1
  8. package/dist/config/validators/BuildSchema.js +5 -0
  9. package/dist/config/validators/BuildSchema.js.map +1 -1
  10. package/dist/config/validators/validate.d.ts +1 -1
  11. package/dist/config/validators/validate.js +11 -2
  12. package/dist/config/validators/validate.js.map +1 -1
  13. package/dist/config/validators/validate.test.js +65 -2
  14. package/dist/config/validators/validate.test.js.map +1 -1
  15. package/dist/lib/authentication/authentication.d.ts +2 -0
  16. package/dist/lib/authentication/components/SignIn.js +4 -3
  17. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  18. package/dist/lib/authentication/providers/openid.d.ts +4 -2
  19. package/dist/lib/authentication/providers/openid.js +11 -5
  20. package/dist/lib/authentication/providers/openid.js.map +1 -1
  21. package/dist/lib/components/MobileTopNavigation.js +8 -5
  22. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  23. package/dist/lib/components/TopNavigation.d.ts +5 -0
  24. package/dist/lib/components/TopNavigation.js +16 -12
  25. package/dist/lib/components/TopNavigation.js.map +1 -1
  26. package/dist/lib/core/ZudokuContext.d.ts +2 -1
  27. package/dist/lib/core/ZudokuContext.js +14 -1
  28. package/dist/lib/core/ZudokuContext.js.map +1 -1
  29. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +4 -4
  30. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  31. package/dist/lib/plugins/api-keys/index.js +1 -1
  32. package/dist/lib/plugins/markdown/MdxPage.js +3 -2
  33. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  34. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  35. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  36. package/dist/lib/plugins/openapi/index.js +1 -1
  37. package/dist/lib/plugins/openapi/index.js.map +1 -1
  38. package/dist/vite/mdx/remark-last-modified.js +1 -28
  39. package/dist/vite/mdx/remark-last-modified.js.map +1 -1
  40. package/lib/{MdxPage-swXPJ0gf.js → MdxPage-8UuEK446.js} +37 -37
  41. package/lib/MdxPage-8UuEK446.js.map +1 -0
  42. package/lib/{OasProvider-CDAM3TB1.js → OasProvider-BsWpguVO.js} +2 -2
  43. package/lib/{OasProvider-CDAM3TB1.js.map → OasProvider-BsWpguVO.js.map} +1 -1
  44. package/lib/{OperationList-C9Hb9ql8.js → OperationList-PnZbf3b2.js} +6 -6
  45. package/lib/{OperationList-C9Hb9ql8.js.map → OperationList-PnZbf3b2.js.map} +1 -1
  46. package/lib/{Pagination-VGlgeCmS.js → Pagination-DY7gCrm4.js} +2 -2
  47. package/lib/{Pagination-VGlgeCmS.js.map → Pagination-DY7gCrm4.js.map} +1 -1
  48. package/lib/{SchemaList-BAbh1BXO.js → SchemaList-D6k4DKWH.js} +3 -3
  49. package/lib/{SchemaList-BAbh1BXO.js.map → SchemaList-D6k4DKWH.js.map} +1 -1
  50. package/lib/{SchemaView-C2Io712T.js → SchemaView-BhgJ9WB8.js} +3 -3
  51. package/lib/{SchemaView-C2Io712T.js.map → SchemaView-BhgJ9WB8.js.map} +1 -1
  52. package/lib/SignUp-CpUD6DUM.js +56 -0
  53. package/lib/SignUp-CpUD6DUM.js.map +1 -0
  54. package/lib/{circular-B42RaanD.js → circular-BUMjK3JF.js} +2 -2
  55. package/lib/{circular-B42RaanD.js.map → circular-BUMjK3JF.js.map} +1 -1
  56. package/lib/{createServer-BKFsRuuk.js → createServer-BPz8ZCrd.js} +3 -3
  57. package/lib/createServer-BPz8ZCrd.js.map +1 -0
  58. package/lib/{errors-CF2X_x5o.js → errors-DY-qOx9n.js} +3 -3
  59. package/lib/{errors-CF2X_x5o.js.map → errors-DY-qOx9n.js.map} +1 -1
  60. package/lib/{index-CLy1XyH0.js → index-C_xVKbf9.js} +1285 -1240
  61. package/lib/index-C_xVKbf9.js.map +1 -0
  62. package/lib/{index-B6Re5_cx.js → index-dVBKCNMa.js} +123 -123
  63. package/lib/{index-B6Re5_cx.js.map → index-dVBKCNMa.js.map} +1 -1
  64. package/lib/zudoku.auth-azureb2c.js +1 -1
  65. package/lib/zudoku.auth-clerk.js +1 -1
  66. package/lib/zudoku.auth-openid.js +114 -105
  67. package/lib/zudoku.auth-openid.js.map +1 -1
  68. package/lib/zudoku.components.js +1 -1
  69. package/lib/zudoku.plugin-api-catalog.js +1 -1
  70. package/lib/zudoku.plugin-api-keys.js +286 -272
  71. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  72. package/lib/zudoku.plugin-markdown.js +1 -1
  73. package/lib/zudoku.plugin-openapi.js +1 -1
  74. package/package.json +7 -7
  75. package/src/app/demo.tsx +19 -2
  76. package/src/lib/authentication/authentication.ts +2 -2
  77. package/src/lib/authentication/components/SignIn.tsx +5 -12
  78. package/src/lib/authentication/providers/openid.tsx +23 -4
  79. package/src/lib/components/MobileTopNavigation.tsx +56 -7
  80. package/src/lib/components/TopNavigation.tsx +30 -14
  81. package/src/lib/core/ZudokuContext.ts +21 -0
  82. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +13 -9
  83. package/src/lib/plugins/api-keys/index.tsx +1 -1
  84. package/src/lib/plugins/markdown/MdxPage.tsx +3 -2
  85. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  86. package/src/lib/plugins/openapi/index.tsx +1 -1
  87. package/lib/MdxPage-swXPJ0gf.js.map +0 -1
  88. package/lib/SignUp-5RUdVhnq.js +0 -63
  89. package/lib/SignUp-5RUdVhnq.js.map +0 -1
  90. package/lib/createServer-BKFsRuuk.js.map +0 -1
  91. package/lib/index-CLy1XyH0.js.map +0 -1
@@ -1,49 +1,50 @@
1
1
  import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
- import { CircleSlashIcon as R, CheckIcon as _, XIcon as se, PencilLineIcon as ne, RefreshCwIcon as ie, EyeOffIcon as re, EyeIcon as ae, CopyIcon as oe, TrashIcon as le, KeyRoundIcon as ce } from "lucide-react";
3
- import { D as de, a as F, R as ue } from "./Slot-DwZlQ-vX.js";
4
- import { i as E } from "./invariant-DAFpPywt.js";
5
- import { O as he, L as $ } from "./chunk-DQRVZFIR-DHK7_Ilc.js";
6
- import { e as pe, d as fe, g as me, c as xe } from "./hook-Bd0yS8M0.js";
7
- import { Button as y } from "./ui/Button.js";
8
- import { u as z, A as T, a as M } from "./Alert-CT_ViLrJ.js";
9
- import * as q from "react";
10
- import ye, { createContext as L, useLayoutEffect as ge, useEffect as je, useRef as k, useId as H, useContext as B, useInsertionEffect as Ce, useCallback as ve, useMemo as S, Children as we, isValidElement as ke, useState as b } from "react";
11
- import { C as be, a as Ee } from "./Card-DPhGbYUM.js";
12
- import { D as J, e as U, a as V, c as Y, b as G, d as Z, f as W, g as K } from "./Dialog-CiIdyz6a.js";
13
- import { Input as Ne } from "./ui/Input.js";
14
- import { c as P } from "./cn-wvCW-ho6.js";
15
- import { u as De } from "./CodeBlock-DAKxs_Tu.js";
16
- const Ie = () => {
17
- const t = pe();
18
- return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(he, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
2
+ import { CircleSlashIcon as M, CheckIcon as W, XIcon as ae, PencilLineIcon as oe, RefreshCwIcon as le, EyeOffIcon as ce, EyeIcon as de, CopyIcon as ue, TrashIcon as he, KeyRoundIcon as fe } from "lucide-react";
3
+ import { D as pe, a as B, R as me } from "./Slot-DwZlQ-vX.js";
4
+ import { i as D } from "./invariant-DAFpPywt.js";
5
+ import { O as xe, L as J } from "./chunk-DQRVZFIR-DHK7_Ilc.js";
6
+ import { e as ye, d as ge, g as je, c as Ce } from "./hook-Bd0yS8M0.js";
7
+ import { Button as j } from "./ui/Button.js";
8
+ import { u as S, A as q, a as L } from "./Alert-CT_ViLrJ.js";
9
+ import * as F from "react";
10
+ import we, { createContext as O, useRef as N, useLayoutEffect as ve, useEffect as X, useId as Q, useContext as H, useInsertionEffect as ke, useMemo as $, useCallback as be, Children as Ee, isValidElement as Ne, useState as P } from "react";
11
+ import { C as Pe, a as De } from "./Card-DPhGbYUM.js";
12
+ import { D as Y, e as G, a as V, c as Z, b as ee, d as te, f as se, g as R } from "./Dialog-CiIdyz6a.js";
13
+ import { Input as Ie } from "./ui/Input.js";
14
+ import { c as E } from "./cn-wvCW-ho6.js";
15
+ import { u as Ke } from "./CodeBlock-DAKxs_Tu.js";
16
+ const Ae = () => {
17
+ const t = ye();
18
+ return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(xe, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
19
19
  "Please login first to view this page",
20
- /* @__PURE__ */ e.jsx(y, { onClick: () => t.login(), children: "Login" })
21
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(de, { className: "max-w-[600px]", children: [
20
+ /* @__PURE__ */ e.jsx(j, { onClick: () => t.login(), children: "Login" })
21
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(pe, { className: "max-w-[600px]", children: [
22
22
  "Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ",
23
23
  /* @__PURE__ */ e.jsx("code", { children: "authentication" }),
24
24
  "."
25
25
  ] }) });
26
- }, Ke = (t) => t;
27
- let X = Ke;
28
- process.env.NODE_ENV !== "production" && (X = (t, i) => {
29
- if (!t)
30
- throw new Error(i);
31
- });
32
- const Pe = L(null), Ae = L({}), Re = L({
26
+ }, Re = O({});
27
+ function ne(t) {
28
+ const i = N(null);
29
+ return i.current === null && (i.current = t()), i.current;
30
+ }
31
+ const Te = typeof window < "u", ze = Te ? ve : X, ie = /* @__PURE__ */ O(null), Me = O({
33
32
  transformPagePoint: (t) => t,
34
33
  isStatic: !1,
35
34
  reducedMotion: "never"
36
- }), ze = typeof window < "u", Te = ze ? ge : je;
37
- function ee(t) {
38
- const i = k(null);
39
- return i.current === null && (i.current = t()), i.current;
35
+ });
36
+ function Se(t) {
37
+ return typeof t == "object" && t !== null;
38
+ }
39
+ function qe(t) {
40
+ return Se(t) && "offsetHeight" in t;
40
41
  }
41
- class Me extends q.Component {
42
+ class Le extends F.Component {
42
43
  getSnapshotBeforeUpdate(i) {
43
44
  const s = this.props.childRef.current;
44
45
  if (s && i.isPresent && !this.props.isPresent) {
45
- const n = this.props.sizeRef.current;
46
- n.height = s.offsetHeight || 0, n.width = s.offsetWidth || 0, n.top = s.offsetTop, n.left = s.offsetLeft;
46
+ const n = s.offsetParent, o = qe(n) && n.offsetWidth || 0, r = this.props.sizeRef.current;
47
+ r.height = s.offsetHeight || 0, r.width = s.offsetWidth || 0, r.top = s.offsetTop, r.left = s.offsetLeft, r.right = o - r.width - r.left;
47
48
  }
48
49
  return null;
49
50
  }
@@ -56,230 +57,234 @@ class Me extends q.Component {
56
57
  return this.props.children;
57
58
  }
58
59
  }
59
- function Se({ children: t, isPresent: i }) {
60
- const s = H(), n = k(null), o = k({
60
+ function $e({ children: t, isPresent: i, anchorX: s }) {
61
+ const n = Q(), o = N(null), r = N({
61
62
  width: 0,
62
63
  height: 0,
63
64
  top: 0,
64
- left: 0
65
- }), { nonce: l } = B(Re);
66
- return Ce(() => {
67
- const { width: m, height: a, top: x, left: h } = o.current;
68
- if (i || !n.current || !m || !a)
65
+ left: 0,
66
+ right: 0
67
+ }), { nonce: f } = H(Me);
68
+ return ke(() => {
69
+ const { width: x, height: u, top: h, left: d, right: l } = r.current;
70
+ if (i || !o.current || !x || !u)
69
71
  return;
70
- n.current.dataset.motionPopId = s;
72
+ const y = s === "left" ? `left: ${d}` : `right: ${l}`;
73
+ o.current.dataset.motionPopId = n;
71
74
  const p = document.createElement("style");
72
- return l && (p.nonce = l), document.head.appendChild(p), p.sheet && p.sheet.insertRule(`
73
- [data-motion-pop-id="${s}"] {
75
+ return f && (p.nonce = f), document.head.appendChild(p), p.sheet && p.sheet.insertRule(`
76
+ [data-motion-pop-id="${n}"] {
74
77
  position: absolute !important;
75
- width: ${m}px !important;
76
- height: ${a}px !important;
77
- top: ${x}px !important;
78
- left: ${h}px !important;
78
+ width: ${x}px !important;
79
+ height: ${u}px !important;
80
+ ${y}px !important;
81
+ top: ${h}px !important;
79
82
  }
80
83
  `), () => {
81
- document.head.removeChild(p);
84
+ document.head.contains(p) && document.head.removeChild(p);
82
85
  };
83
- }, [i]), e.jsx(Me, { isPresent: i, childRef: n, sizeRef: o, children: q.cloneElement(t, { ref: n }) });
86
+ }, [i]), e.jsx(Le, { isPresent: i, childRef: o, sizeRef: r, children: F.cloneElement(t, { ref: o }) });
84
87
  }
85
- const qe = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: o, presenceAffectsLayout: l, mode: m }) => {
86
- const a = ee(Le), x = H(), h = ve((d) => {
87
- a.set(d, !0);
88
- for (const C of a.values())
89
- if (!C)
90
- return;
91
- n && n();
92
- }, [a, n]), p = S(
93
- () => ({
94
- id: x,
95
- initial: i,
96
- isPresent: s,
97
- custom: o,
98
- onExitComplete: h,
99
- register: (d) => (a.set(d, !1), () => a.delete(d))
100
- }),
101
- /**
102
- * If the presence of a child affects the layout of the components around it,
103
- * we want to make a new context value to ensure they get re-rendered
104
- * so they can detect that layout change.
105
- */
106
- l ? [Math.random(), h] : [s, h]
107
- );
108
- return S(() => {
109
- a.forEach((d, C) => a.set(C, !1));
110
- }, [s]), q.useEffect(() => {
111
- !s && !a.size && n && n();
112
- }, [s]), m === "popLayout" && (t = e.jsx(Se, { isPresent: s, children: t })), e.jsx(Pe.Provider, { value: p, children: t });
88
+ const Fe = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: o, presenceAffectsLayout: r, mode: f, anchorX: x }) => {
89
+ const u = ne(Oe), h = Q();
90
+ let d = !0, l = $(() => (d = !1, {
91
+ id: h,
92
+ initial: i,
93
+ isPresent: s,
94
+ custom: o,
95
+ onExitComplete: (y) => {
96
+ u.set(y, !0);
97
+ for (const p of u.values())
98
+ if (!p)
99
+ return;
100
+ n && n();
101
+ },
102
+ register: (y) => (u.set(y, !1), () => u.delete(y))
103
+ }), [s, u, n]);
104
+ return r && d && (l = { ...l }), $(() => {
105
+ u.forEach((y, p) => u.set(p, !1));
106
+ }, [s]), F.useEffect(() => {
107
+ !s && !u.size && n && n();
108
+ }, [s]), f === "popLayout" && (t = e.jsx($e, { isPresent: s, anchorX: x, children: t })), e.jsx(ie.Provider, { value: l, children: t });
113
109
  };
114
- function Le() {
110
+ function Oe() {
115
111
  return /* @__PURE__ */ new Map();
116
112
  }
117
- const N = (t) => t.key || "";
118
- function Q(t) {
113
+ function Qe(t = !0) {
114
+ const i = H(ie);
115
+ if (i === null)
116
+ return [!0, null];
117
+ const { isPresent: s, onExitComplete: n, register: o } = i, r = Q();
118
+ X(() => {
119
+ if (t)
120
+ return o(r);
121
+ }, [t]);
122
+ const f = be(() => t && n && n(r), [r, n, t]);
123
+ return !s && n ? [!1, f] : [!0];
124
+ }
125
+ const I = (t) => t.key || "";
126
+ function U(t) {
119
127
  const i = [];
120
- return we.forEach(t, (s) => {
121
- ke(s) && i.push(s);
128
+ return Ee.forEach(t, (s) => {
129
+ Ne(s) && i.push(s);
122
130
  }), i;
123
131
  }
124
- const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExitComplete: o, presenceAffectsLayout: l = !0, mode: m = "sync" }) => {
125
- X(!i, "Replace exitBeforeEnter with mode='wait'");
126
- const a = S(() => Q(t), [t]), x = a.map(N), h = k(!0), p = k(a), d = ee(() => /* @__PURE__ */ new Map()), [C, w] = b(a), [j, r] = b(a);
127
- Te(() => {
128
- h.current = !1, p.current = a;
129
- for (let f = 0; f < j.length; f++) {
130
- const u = N(j[f]);
131
- x.includes(u) ? d.delete(u) : d.get(u) !== !0 && d.set(u, !1);
132
+ const He = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presenceAffectsLayout: o = !0, mode: r = "sync", propagate: f = !1, anchorX: x = "left" }) => {
133
+ const [u, h] = Qe(f), d = $(() => U(t), [t]), l = f && !u ? [] : d.map(I), y = N(!0), p = N(d), k = ne(() => /* @__PURE__ */ new Map()), [a, c] = P(d), [m, w] = P(d);
134
+ ze(() => {
135
+ y.current = !1, p.current = d;
136
+ for (let v = 0; v < m.length; v++) {
137
+ const g = I(m[v]);
138
+ l.includes(g) ? k.delete(g) : k.get(g) !== !0 && k.set(g, !1);
132
139
  }
133
- }, [j, x.length, x.join("-")]);
134
- const c = [];
135
- if (a !== C) {
136
- let f = [...a];
137
- for (let u = 0; u < j.length; u++) {
138
- const v = j[u], A = N(v);
139
- x.includes(A) || (f.splice(u, 0, v), c.push(v));
140
+ }, [m, l.length, l.join("-")]);
141
+ const C = [];
142
+ if (d !== a) {
143
+ let v = [...d];
144
+ for (let g = 0; g < m.length; g++) {
145
+ const b = m[g], z = I(b);
146
+ l.includes(z) || (v.splice(g, 0, b), C.push(b));
140
147
  }
141
- m === "wait" && c.length && (f = c), r(Q(f)), w(a);
142
- return;
148
+ return r === "wait" && C.length && (v = C), w(U(v)), c(d), null;
143
149
  }
144
- process.env.NODE_ENV !== "production" && m === "wait" && j.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
145
- const { forceRender: g } = B(Ae);
146
- return e.jsx(e.Fragment, { children: j.map((f) => {
147
- const u = N(f), v = a === j || x.includes(u), A = () => {
148
- if (d.has(u))
149
- d.set(u, !0);
150
+ process.env.NODE_ENV !== "production" && r === "wait" && m.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
151
+ const { forceRender: T } = H(Re);
152
+ return e.jsx(e.Fragment, { children: m.map((v) => {
153
+ const g = I(v), b = f && !u ? !1 : d === m || l.includes(g), z = () => {
154
+ if (k.has(g))
155
+ k.set(g, !0);
150
156
  else
151
157
  return;
152
- let O = !0;
153
- d.forEach((te) => {
154
- te || (O = !1);
155
- }), O && (g?.(), r(p.current), o && o());
158
+ let _ = !0;
159
+ k.forEach((re) => {
160
+ re || (_ = !1);
161
+ }), _ && (T?.(), w(p.current), f && h?.(), n && n());
156
162
  };
157
- return e.jsx(qe, { isPresent: v, initial: !h.current || n ? void 0 : !1, custom: v ? void 0 : s, presenceAffectsLayout: l, mode: m, onExitComplete: v ? void 0 : A, children: f }, u);
163
+ return e.jsx(Fe, { isPresent: b, initial: !y.current || s ? void 0 : !1, custom: i, presenceAffectsLayout: o, mode: r, onExitComplete: b ? void 0 : z, anchorX: x, children: v }, g);
158
164
  }) });
159
- }, Fe = ({ service: t }) => {
160
- const i = fe(), s = me(), [n, o] = b(
165
+ }, _e = ({ service: t }) => {
166
+ const i = ge(), s = je(), [n, o] = P(
161
167
  null
162
- ), [l, m] = b(""), { data: a, isFetching: x } = xe({
168
+ ), [r, f] = P(""), { data: x, isFetching: u } = Ce({
163
169
  queryFn: () => t.getConsumers(i),
164
170
  queryKey: ["api-keys"],
165
171
  retry: !1
166
- }), h = z({
172
+ }), h = S({
167
173
  mutationFn: ({
168
- consumerId: r,
174
+ consumerId: a,
169
175
  keyId: c
170
176
  }) => {
171
177
  if (!t.deleteKey)
172
178
  throw new Error("deleteKey not implemented");
173
- return t.deleteKey(r, c, i);
179
+ return t.deleteKey(a, c, i);
174
180
  },
175
- onMutate: async ({ consumerId: r, keyId: c }) => {
181
+ onMutate: async ({ consumerId: a, keyId: c }) => {
176
182
  await s.cancelQueries({ queryKey: ["api-keys"] });
177
- const g = s.getQueryData([
183
+ const m = s.getQueryData([
178
184
  "api-keys"
179
185
  ]);
180
- return s.setQueryData(["api-keys"], (f) => f && f.map((u) => u.id === r ? {
181
- ...u,
182
- apiKeys: u.apiKeys.filter((v) => v.id !== c)
183
- } : u)), { previousData: g };
186
+ return s.setQueryData(["api-keys"], (w) => w && w.map((C) => C.id === a ? {
187
+ ...C,
188
+ apiKeys: C.apiKeys.filter((T) => T.id !== c)
189
+ } : C)), { previousData: m };
184
190
  },
185
- onError: (r, c, g) => {
186
- g?.previousData && s.setQueryData(["api-keys"], g.previousData);
191
+ onError: (a, c, m) => {
192
+ m?.previousData && s.setQueryData(["api-keys"], m.previousData);
187
193
  },
188
194
  onSuccess: () => {
189
195
  s.invalidateQueries({ queryKey: ["api-keys"] });
190
196
  }
191
- }), p = z({
197
+ }), d = S({
192
198
  mutationFn: ({
193
- consumerId: r,
199
+ consumerId: a,
194
200
  label: c
195
201
  }) => {
196
202
  if (!t.updateConsumer)
197
203
  throw new Error("updateConsumer not implemented");
198
- return t.updateConsumer({ id: r, label: c }, i);
204
+ return t.updateConsumer({ id: a, label: c }, i);
199
205
  },
200
- onMutate: async ({ consumerId: r, label: c }) => {
206
+ onMutate: async ({ consumerId: a, label: c }) => {
201
207
  await s.cancelQueries({ queryKey: ["api-keys"] });
202
- const g = s.getQueryData(["api-keys"]);
203
- return s.setQueryData(["api-keys"], (f) => f && f.map((u) => u.id === r ? {
204
- ...u,
208
+ const m = s.getQueryData(["api-keys"]);
209
+ return s.setQueryData(["api-keys"], (w) => w && w.map((C) => C.id === a ? {
210
+ ...C,
205
211
  label: c
206
- } : u)), { previousData: g };
212
+ } : C)), { previousData: m };
207
213
  },
208
- onError: (r, c, g) => {
209
- g?.previousData && s.setQueryData(["api-keys"], g.previousData);
214
+ onError: (a, c, m) => {
215
+ m?.previousData && s.setQueryData(["api-keys"], m.previousData);
210
216
  },
211
217
  onSuccess: () => {
212
218
  s.invalidateQueries({ queryKey: ["api-keys"] });
213
219
  }
214
- }), d = z({
215
- mutationFn: (r) => {
220
+ }), l = S({
221
+ mutationFn: (a) => {
216
222
  if (!t.rollKey)
217
223
  throw new Error("rollKey not implemented");
218
- return t.rollKey(r, i);
224
+ return t.rollKey(a, i);
219
225
  },
220
226
  onSuccess: () => s.invalidateQueries({ queryKey: ["api-keys"] })
221
- }), C = (r, c) => {
222
- o(r), m(c);
223
- }, w = (r) => {
224
- l.trim() && p.mutate({
225
- consumerId: r,
226
- label: l.trim()
227
- }), o(null), m("");
228
- }, j = () => {
229
- o(null), m("");
227
+ }), y = (a, c) => {
228
+ o(a), f(c);
229
+ }, p = (a) => {
230
+ r.trim() && d.mutate({
231
+ consumerId: a,
232
+ label: r.trim()
233
+ }), o(null), f("");
234
+ }, k = () => {
235
+ o(null), f("");
230
236
  };
231
237
  return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-md h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
232
- /* @__PURE__ */ e.jsx(F.Target, { name: "api-keys-list-page" }),
238
+ /* @__PURE__ */ e.jsx(B.Target, { name: "api-keys-list-page" }),
233
239
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
234
240
  /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
235
- t.createKey && /* @__PURE__ */ e.jsx(y, { asChild: !0, children: /* @__PURE__ */ e.jsx($, { to: "/settings/api-keys/new", children: "Create API Key" }) })
241
+ t.createKey && /* @__PURE__ */ e.jsx(j, { asChild: !0, children: /* @__PURE__ */ e.jsx(J, { to: "/settings/api-keys/new", children: "Create API Key" }) })
236
242
  ] }),
237
243
  /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
238
- /* @__PURE__ */ e.jsx(F.Target, { name: "api-keys-list-page-before-keys" }),
244
+ /* @__PURE__ */ e.jsx(B.Target, { name: "api-keys-list-page-before-keys" }),
239
245
  /* @__PURE__ */ e.jsx("div", { className: "h-8" }),
240
- d.isError && /* @__PURE__ */ e.jsxs(T, { variant: "destructive", className: "mb-4", children: [
241
- /* @__PURE__ */ e.jsx(R, { size: 16 }),
242
- /* @__PURE__ */ e.jsx(M, { children: d.error.message })
246
+ l.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
247
+ /* @__PURE__ */ e.jsx(M, { size: 16 }),
248
+ /* @__PURE__ */ e.jsx(L, { children: l.error.message })
243
249
  ] }),
244
- p.isError && /* @__PURE__ */ e.jsxs(T, { variant: "destructive", className: "mb-4", children: [
245
- /* @__PURE__ */ e.jsx(R, { size: 16 }),
246
- /* @__PURE__ */ e.jsx(M, { children: p.error.message })
250
+ d.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
251
+ /* @__PURE__ */ e.jsx(M, { size: 16 }),
252
+ /* @__PURE__ */ e.jsx(L, { children: d.error.message })
247
253
  ] }),
248
- h.isError && /* @__PURE__ */ e.jsxs(T, { variant: "destructive", className: "mb-4", children: [
249
- /* @__PURE__ */ e.jsx(R, { size: 16 }),
250
- /* @__PURE__ */ e.jsx(M, { children: h.error.message })
254
+ h.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
255
+ /* @__PURE__ */ e.jsx(M, { size: 16 }),
256
+ /* @__PURE__ */ e.jsx(L, { children: h.error.message })
251
257
  ] }),
252
- /* @__PURE__ */ e.jsx("div", { className: "", children: a.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
258
+ /* @__PURE__ */ e.jsx("div", { className: "", children: x.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
253
259
  /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
254
260
  "You have no API keys yet.",
255
261
  /* @__PURE__ */ e.jsx("br", {}),
256
262
  t.createKey && "Get started and create your first key."
257
263
  ] }),
258
- t.createKey && /* @__PURE__ */ e.jsx(y, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx($, { to: "/settings/api-keys/new", children: "Create API Key" }) })
264
+ t.createKey && /* @__PURE__ */ e.jsx(j, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx(J, { to: "/settings/api-keys/new", children: "Create API Key" }) })
259
265
  ] }) : /* @__PURE__ */ e.jsx(
260
266
  "ul",
261
267
  {
262
- className: P(
263
- "grid grid-cols-1 divide-y divide-border col-span-6",
264
- "lg:grid-cols-[1fr_min-content]"
268
+ className: E(
269
+ "grid grid-cols-[1fr_min-content] divide-y divide-border col-span-6"
265
270
  ),
266
- children: a.map((r) => /* @__PURE__ */ e.jsxs(
267
- be,
271
+ children: x.map((a) => /* @__PURE__ */ e.jsxs(
272
+ Pe,
268
273
  {
269
274
  className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
270
275
  children: [
271
- /* @__PURE__ */ e.jsxs(Ee, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
276
+ /* @__PURE__ */ e.jsxs(De, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
272
277
  /* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
273
278
  /* @__PURE__ */ e.jsxs("div", { className: "font-medium text-lg flex items-center gap-2", children: [
274
- n === r.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
279
+ n === a.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
275
280
  /* @__PURE__ */ e.jsx(
276
- Ne,
281
+ Ie,
277
282
  {
278
283
  maxLength: 32,
279
- value: l,
280
- onChange: (c) => m(c.target.value),
284
+ value: r,
285
+ onChange: (c) => f(c.target.value),
281
286
  onKeyDown: (c) => {
282
- c.key === "Enter" ? w(r.id) : c.key === "Escape" && j();
287
+ c.key === "Enter" ? p(a.id) : c.key === "Escape" && k();
283
288
  },
284
289
  className: "text-lg font-medium",
285
290
  autoFocus: !0
@@ -287,90 +292,90 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
287
292
  ),
288
293
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
289
294
  /* @__PURE__ */ e.jsx(
290
- y,
295
+ j,
291
296
  {
292
297
  size: "icon",
293
298
  variant: "ghost",
294
- onClick: () => w(r.id),
295
- disabled: !l.trim(),
296
- children: /* @__PURE__ */ e.jsx(_, { size: 16 })
299
+ onClick: () => p(a.id),
300
+ disabled: !r.trim(),
301
+ children: /* @__PURE__ */ e.jsx(W, { size: 16 })
297
302
  }
298
303
  ),
299
304
  /* @__PURE__ */ e.jsx(
300
- y,
305
+ j,
301
306
  {
302
307
  size: "icon",
303
308
  variant: "ghost",
304
- onClick: j,
305
- children: /* @__PURE__ */ e.jsx(se, { size: 16 })
309
+ onClick: k,
310
+ children: /* @__PURE__ */ e.jsx(ae, { size: 16 })
306
311
  }
307
312
  )
308
313
  ] })
309
- ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: r.label }),
310
- /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: r.createdOn })
314
+ ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: a.label }),
315
+ /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: a.createdOn })
311
316
  ] }),
312
317
  /* @__PURE__ */ e.jsxs("div", { className: "text-muted-foreground text-xs", children: [
313
- r.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
318
+ a.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
314
319
  "Created on",
315
320
  " ",
316
- new Date(r.createdOn).toLocaleDateString()
321
+ new Date(a.createdOn).toLocaleDateString()
317
322
  ] }),
318
- r.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
323
+ a.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
319
324
  "Expires on",
320
325
  " ",
321
- new Date(r.expiresOn).toLocaleDateString()
326
+ new Date(a.expiresOn).toLocaleDateString()
322
327
  ] })
323
328
  ] })
324
329
  ] }),
325
330
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
326
331
  t.updateConsumer && /* @__PURE__ */ e.jsxs(
327
- y,
332
+ j,
328
333
  {
329
334
  variant: "ghost",
330
- onClick: () => C(r.id, r.label),
331
- className: P(
335
+ onClick: () => y(a.id, a.label),
336
+ className: E(
332
337
  "flex gap-2",
333
- n === r.id && "opacity-0! pointer-events-none"
338
+ n === a.id && "opacity-0! pointer-events-none"
334
339
  ),
335
- disabled: n === r.id,
340
+ disabled: n === a.id,
336
341
  children: [
337
- /* @__PURE__ */ e.jsx(ne, { size: 16 }),
338
- "Edit label"
342
+ /* @__PURE__ */ e.jsx(oe, { size: 16 }),
343
+ /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
339
344
  ]
340
345
  }
341
346
  ),
342
- t.rollKey && /* @__PURE__ */ e.jsxs(J, { children: [
343
- /* @__PURE__ */ e.jsx(U, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
344
- y,
347
+ t.rollKey && /* @__PURE__ */ e.jsxs(Y, { children: [
348
+ /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
349
+ j,
345
350
  {
346
351
  title: "Roll this key",
347
352
  variant: "ghost",
348
- disabled: d.isPending,
353
+ disabled: l.isPending,
349
354
  className: "flex items-center gap-2",
350
355
  children: [
351
356
  /* @__PURE__ */ e.jsx(
352
- ie,
357
+ le,
353
358
  {
354
359
  size: 16,
355
- className: d.isPending ? "animate-spin" : void 0
360
+ className: l.isPending ? "animate-spin" : void 0
356
361
  }
357
362
  ),
358
- "Roll key"
363
+ /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
359
364
  ]
360
365
  }
361
366
  ) }),
362
367
  /* @__PURE__ */ e.jsxs(V, { children: [
363
- /* @__PURE__ */ e.jsxs(Y, { children: [
364
- /* @__PURE__ */ e.jsx(G, { children: "Roll API Key" }),
365
- /* @__PURE__ */ e.jsx(Z, { children: "Are you sure you want to roll this API key?" })
368
+ /* @__PURE__ */ e.jsxs(Z, { children: [
369
+ /* @__PURE__ */ e.jsx(ee, { children: "Roll API Key" }),
370
+ /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to roll this API key?" })
366
371
  ] }),
367
- /* @__PURE__ */ e.jsxs(W, { children: [
368
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Cancel" }) }),
369
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(
370
- y,
372
+ /* @__PURE__ */ e.jsxs(se, { children: [
373
+ /* @__PURE__ */ e.jsx(R, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
374
+ /* @__PURE__ */ e.jsx(R, { asChild: !0, children: /* @__PURE__ */ e.jsx(
375
+ j,
371
376
  {
372
377
  onClick: () => {
373
- d.mutate(r.id);
378
+ l.mutate(a.id);
374
379
  },
375
380
  children: "Roll Key"
376
381
  }
@@ -380,109 +385,118 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
380
385
  ] })
381
386
  ] })
382
387
  ] }),
383
- /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(Oe, { children: r.apiKeys.map((c) => /* @__PURE__ */ e.jsxs(ye.Fragment, { children: [
388
+ /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(He, { children: a.apiKeys.map((c) => /* @__PURE__ */ e.jsxs(we.Fragment, { children: [
384
389
  /* @__PURE__ */ e.jsx(
385
- Qe,
390
+ Je,
386
391
  {
387
392
  apiKey: c,
388
393
  onDeleteKey: () => {
389
394
  h.mutate({
390
- consumerId: r.id,
395
+ consumerId: a.id,
391
396
  keyId: c.id
392
397
  });
393
398
  },
394
- className: h.variables?.keyId === c.id && (h.isPending || x) ? "opacity-10!" : void 0
399
+ className: h.variables?.keyId === c.id && (h.isPending || u) ? "opacity-10!" : void 0
395
400
  }
396
401
  ),
397
402
  /* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
398
403
  ] }, c.id)) }) })
399
404
  ]
400
405
  },
401
- r.id
406
+ a.id
402
407
  ))
403
408
  }
404
409
  ) })
405
410
  ] });
406
- }, $e = (t) => {
411
+ }, Be = (t) => {
407
412
  const i = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((i.getTime() - s.getTime()) / 1e3), o = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
408
413
  return n < 60 ? o.format(-n, "second") : n < 3600 ? o.format(-Math.floor(n / 60), "minute") : n < 86400 ? o.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? o.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? o.format(-Math.floor(n / 2592e3), "month") : o.format(-Math.floor(n / 31536e3), "year");
409
- }, Qe = ({
414
+ }, Je = ({
410
415
  apiKey: t,
411
416
  onDeleteKey: i,
412
417
  className: s
413
418
  }) => {
414
- const [n, o] = b(!1), [l, m] = De(), { key: a, createdOn: x, expiresOn: h } = t, p = h && new Date(h) < /* @__PURE__ */ new Date(), d = h ? Math.ceil(
419
+ const [n, o] = P(!1), [r, f] = Ke(), { key: x, createdOn: u, expiresOn: h } = t, d = h && new Date(h) < /* @__PURE__ */ new Date(), l = h ? Math.ceil(
415
420
  (new Date(h).getTime() - (/* @__PURE__ */ new Date()).getTime()) / (1e3 * 60 * 60 * 24)
416
- ) : 1 / 0, C = d <= 7 && !p;
417
- return /* @__PURE__ */ e.jsxs("div", { className: P("grid col-span-full grid-cols-subgrid p-6", s), children: [
421
+ ) : 1 / 0, y = l <= 7 && !d;
422
+ return /* @__PURE__ */ e.jsxs("div", { className: E("grid col-span-full grid-cols-subgrid p-6", s), children: [
418
423
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
419
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center text-sm border rounded-md w-fit px-1", children: [
420
- /* @__PURE__ */ e.jsxs("div", { className: "font-mono truncate h-9 items-center flex px-2 text-xs gap-2", children: [
424
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center text-sm border rounded-md w-full max-w-fit px-1", children: [
425
+ /* @__PURE__ */ e.jsxs("div", { className: "font-mono w-full h-9 items-center flex px-2 text-xs gap-2", children: [
421
426
  /* @__PURE__ */ e.jsx(
422
427
  "div",
423
428
  {
424
- className: P(
429
+ className: E(
425
430
  "rounded-full w-2 h-2 bg-emerald-400 mr-2",
426
- (C || p) && "bg-neutral-200"
431
+ (y || d) && "bg-neutral-200"
427
432
  )
428
433
  }
429
434
  ),
430
- /* @__PURE__ */ e.jsxs("span", { children: [
431
- /* @__PURE__ */ e.jsx("span", { className: n ? "" : "opacity-20", children: n ? a.slice(0, -5) : "**** ".repeat(a.slice(0, -5).length / 5) + "*".repeat(a.slice(0, -5).length % 5) }),
432
- /* @__PURE__ */ e.jsx("span", { children: a.slice(-5) })
435
+ /* @__PURE__ */ e.jsxs("span", { className: "w-full truncate", children: [
436
+ /* @__PURE__ */ e.jsx(
437
+ "div",
438
+ {
439
+ className: E(
440
+ "w-40 inline-block md:w-full truncate",
441
+ n ? "" : "opacity-20"
442
+ ),
443
+ children: n ? x.slice(0, -5) : "**** ".repeat(x.slice(0, -5).length / 5) + "*".repeat(x.slice(0, -5).length % 5)
444
+ }
445
+ ),
446
+ /* @__PURE__ */ e.jsx("span", { children: x.slice(-5) })
433
447
  ] })
434
448
  ] }),
435
449
  /* @__PURE__ */ e.jsx(
436
- y,
450
+ j,
437
451
  {
438
452
  variant: "ghost",
439
- onClick: () => o((w) => !w),
453
+ onClick: () => o((p) => !p),
440
454
  size: "icon",
441
- children: n ? /* @__PURE__ */ e.jsx(re, { size: 16 }) : /* @__PURE__ */ e.jsx(ae, { size: 16 })
455
+ children: n ? /* @__PURE__ */ e.jsx(ce, { size: 16 }) : /* @__PURE__ */ e.jsx(de, { size: 16 })
442
456
  }
443
457
  ),
444
458
  /* @__PURE__ */ e.jsx(
445
- y,
459
+ j,
446
460
  {
447
461
  variant: "ghost",
448
- onClick: () => m(a),
462
+ onClick: () => f(x),
449
463
  size: "icon",
450
- children: l ? /* @__PURE__ */ e.jsx(_, { size: 16 }) : /* @__PURE__ */ e.jsx(oe, { size: 16 })
464
+ children: r ? /* @__PURE__ */ e.jsx(W, { size: 16 }) : /* @__PURE__ */ e.jsx(ue, { size: 16 })
451
465
  }
452
466
  )
453
467
  ] }),
454
468
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
455
- x && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
469
+ u && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
456
470
  "Created ",
457
- $e(x),
471
+ Be(u),
458
472
  "."
459
473
  ] }),
460
474
  " ",
461
- h && C && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
475
+ h && y && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
462
476
  "Expires in ",
463
- d,
477
+ l,
464
478
  " ",
465
- d === 1 ? "day" : "days",
479
+ l === 1 ? "day" : "days",
466
480
  "."
467
481
  ] }),
468
- h && p && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
482
+ h && d && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
469
483
  "Expired",
470
484
  " ",
471
- d === 0 ? "today." : `${d * -1} days ago.`
485
+ l === 0 ? "today." : `${l * -1} days ago.`
472
486
  ] })
473
487
  ] })
474
488
  ] }),
475
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: h && i && /* @__PURE__ */ e.jsxs(J, { children: [
476
- /* @__PURE__ */ e.jsx(U, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(le, { size: 16 }) }) }),
489
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: h && i && /* @__PURE__ */ e.jsxs(Y, { children: [
490
+ /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(he, { size: 16 }) }) }),
477
491
  /* @__PURE__ */ e.jsxs(V, { children: [
478
- /* @__PURE__ */ e.jsxs(Y, { children: [
479
- /* @__PURE__ */ e.jsx(G, { children: "Delete API Key" }),
480
- /* @__PURE__ */ e.jsx(Z, { children: "Are you sure you want to delete this API key?" })
492
+ /* @__PURE__ */ e.jsxs(Z, { children: [
493
+ /* @__PURE__ */ e.jsx(ee, { children: "Delete API Key" }),
494
+ /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to delete this API key?" })
481
495
  ] }),
482
- /* @__PURE__ */ e.jsxs(W, { children: [
483
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(y, { variant: "outline", children: "Cancel" }) }),
484
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(
485
- y,
496
+ /* @__PURE__ */ e.jsxs(se, { children: [
497
+ /* @__PURE__ */ e.jsx(R, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
498
+ /* @__PURE__ */ e.jsx(R, { asChild: !0, children: /* @__PURE__ */ e.jsx(
499
+ j,
486
500
  {
487
501
  onClick: () => {
488
502
  i();
@@ -494,36 +508,36 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
494
508
  ] })
495
509
  ] }) })
496
510
  ] });
497
- }, D = "https://api.zuploedge.com/v2/client", _e = async (t) => {
511
+ }, K = "https://api.zuploedge.com/v2/client", Ue = async (t) => {
498
512
  try {
499
513
  return await t.json();
500
514
  } catch {
501
515
  return;
502
516
  }
503
- }, I = async (t) => {
517
+ }, A = async (t) => {
504
518
  const i = t.headers.get("content-type");
505
519
  if (!t.ok && i?.includes("application/problem+json")) {
506
- const s = await _e(t);
520
+ const s = await Ue(t);
507
521
  if (s.type && s.title)
508
522
  throw new Error(s.detail ?? s.title);
509
523
  }
510
- }, He = (t) => ({
524
+ }, We = (t) => ({
511
525
  deleteKey: async (i, s, n) => {
512
526
  const o = new Request(
513
- D + `/${t}/consumers/${i}/keys/${s}`,
527
+ K + `/${t}/consumers/${i}/keys/${s}`,
514
528
  {
515
529
  method: "DELETE"
516
530
  }
517
531
  );
518
532
  await n.signRequest(o);
519
- const l = await fetch(o);
520
- await I(l), E(l.ok, "Failed to delete API key");
533
+ const r = await fetch(o);
534
+ await A(r), D(r.ok, "Failed to delete API key");
521
535
  },
522
536
  updateConsumer: async (i, s) => {
523
537
  const n = await fetch(
524
538
  await s.signRequest(
525
539
  new Request(
526
- D + `/${t}/consumers/${i.id}`,
540
+ K + `/${t}/consumers/${i.id}`,
527
541
  {
528
542
  method: "PATCH",
529
543
  headers: {
@@ -536,13 +550,13 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
536
550
  )
537
551
  )
538
552
  );
539
- await I(n), E(n.ok, "Failed to update API key description");
553
+ await A(n), D(n.ok, "Failed to update API key description");
540
554
  },
541
555
  rollKey: async (i, s) => {
542
556
  const n = await fetch(
543
557
  await s.signRequest(
544
558
  new Request(
545
- D + `/${t}/consumers/${i}/roll-key`,
559
+ K + `/${t}/consumers/${i}/roll-key`,
546
560
  {
547
561
  method: "POST",
548
562
  headers: {
@@ -553,39 +567,39 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
553
567
  )
554
568
  )
555
569
  );
556
- await I(n), E(n.ok, "Failed to delete API key");
570
+ await A(n), D(n.ok, "Failed to delete API key");
557
571
  },
558
572
  getConsumers: async (i) => {
559
573
  const s = new Request(
560
- D + `/${t}/consumers`
574
+ K + `/${t}/consumers`
561
575
  );
562
576
  await i.signRequest(s);
563
577
  const n = await fetch(s);
564
- return await I(n), E(n.ok, "Failed to fetch API keys"), (await n.json()).data.map((l) => ({
565
- id: l.id,
566
- label: l.label ?? l.subject ?? "API Key",
567
- apiKeys: l.apiKeys.data,
568
- key: l.apiKeys.data.at(0)
578
+ return await A(n), D(n.ok, "Failed to fetch API keys"), (await n.json()).data.map((r) => ({
579
+ id: r.id,
580
+ label: r.label || r.subject || "API Key",
581
+ apiKeys: r.apiKeys.data,
582
+ key: r.apiKeys.data.at(0)
569
583
  }));
570
584
  }
571
- }), rt = (t) => t, at = (t) => {
572
- const i = "deploymentName" in t ? He(t.deploymentName) : t;
585
+ }), ct = (t) => t, dt = (t) => {
586
+ const i = "deploymentName" in t ? We(t.deploymentName) : t;
573
587
  return {
574
588
  getProfileMenuItems: () => [
575
589
  {
576
590
  label: "API Keys",
577
591
  path: "/settings/api-keys",
578
592
  category: "middle",
579
- icon: ce
593
+ icon: fe
580
594
  }
581
595
  ],
582
596
  getIdentities: async (s) => {
583
597
  try {
584
598
  return (await i.getConsumers(s)).map((o) => ({
585
- authorizeRequest: (l) => (l.headers.set(
599
+ authorizeRequest: (r) => (r.headers.set(
586
600
  "Authorization",
587
601
  `Bearer ${o.apiKeys.at(0)?.key}`
588
- ), l),
602
+ ), r),
589
603
  id: o.id,
590
604
  label: o.label
591
605
  }));
@@ -595,12 +609,12 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
595
609
  },
596
610
  getRoutes: () => [
597
611
  {
598
- element: /* @__PURE__ */ e.jsx(Ie, {}),
599
- errorElement: /* @__PURE__ */ e.jsx(ue, {}),
612
+ element: /* @__PURE__ */ e.jsx(Ae, {}),
613
+ errorElement: /* @__PURE__ */ e.jsx(me, {}),
600
614
  children: [
601
615
  {
602
616
  path: "/settings/api-keys",
603
- element: /* @__PURE__ */ e.jsx(Fe, { service: i })
617
+ element: /* @__PURE__ */ e.jsx(_e, { service: i })
604
618
  }
605
619
  // {
606
620
  // path: "/settings/api-keys/new",
@@ -612,7 +626,7 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
612
626
  };
613
627
  };
614
628
  export {
615
- at as apiKeyPlugin,
616
- rt as createApiKeyService
629
+ dt as apiKeyPlugin,
630
+ ct as createApiKeyService
617
631
  };
618
632
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map