zudoku 0.53.0 → 0.53.1

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 (75) hide show
  1. package/dist/app/demo.js +14 -0
  2. package/dist/app/demo.js.map +1 -1
  3. package/dist/lib/authentication/authentication.d.ts +2 -0
  4. package/dist/lib/authentication/components/SignIn.js +4 -3
  5. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  6. package/dist/lib/authentication/providers/openid.d.ts +4 -2
  7. package/dist/lib/authentication/providers/openid.js +11 -5
  8. package/dist/lib/authentication/providers/openid.js.map +1 -1
  9. package/dist/lib/components/MobileTopNavigation.js +8 -5
  10. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  11. package/dist/lib/components/TopNavigation.d.ts +5 -0
  12. package/dist/lib/components/TopNavigation.js +16 -12
  13. package/dist/lib/components/TopNavigation.js.map +1 -1
  14. package/dist/lib/core/ZudokuContext.d.ts +2 -1
  15. package/dist/lib/core/ZudokuContext.js +14 -1
  16. package/dist/lib/core/ZudokuContext.js.map +1 -1
  17. package/dist/lib/plugins/api-keys/index.js +1 -1
  18. package/dist/lib/plugins/markdown/MdxPage.js +3 -2
  19. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  20. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  21. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  22. package/dist/lib/plugins/openapi/index.js +1 -1
  23. package/dist/lib/plugins/openapi/index.js.map +1 -1
  24. package/lib/{MdxPage-swXPJ0gf.js → MdxPage-8UuEK446.js} +37 -37
  25. package/lib/MdxPage-8UuEK446.js.map +1 -0
  26. package/lib/{OasProvider-CDAM3TB1.js → OasProvider-BsWpguVO.js} +2 -2
  27. package/lib/{OasProvider-CDAM3TB1.js.map → OasProvider-BsWpguVO.js.map} +1 -1
  28. package/lib/{OperationList-C9Hb9ql8.js → OperationList-PnZbf3b2.js} +6 -6
  29. package/lib/{OperationList-C9Hb9ql8.js.map → OperationList-PnZbf3b2.js.map} +1 -1
  30. package/lib/{Pagination-VGlgeCmS.js → Pagination-DY7gCrm4.js} +2 -2
  31. package/lib/{Pagination-VGlgeCmS.js.map → Pagination-DY7gCrm4.js.map} +1 -1
  32. package/lib/{SchemaList-BAbh1BXO.js → SchemaList-D6k4DKWH.js} +3 -3
  33. package/lib/{SchemaList-BAbh1BXO.js.map → SchemaList-D6k4DKWH.js.map} +1 -1
  34. package/lib/{SchemaView-C2Io712T.js → SchemaView-BhgJ9WB8.js} +3 -3
  35. package/lib/{SchemaView-C2Io712T.js.map → SchemaView-BhgJ9WB8.js.map} +1 -1
  36. package/lib/SignUp-CpUD6DUM.js +56 -0
  37. package/lib/SignUp-CpUD6DUM.js.map +1 -0
  38. package/lib/{circular-B42RaanD.js → circular-BUMjK3JF.js} +2 -2
  39. package/lib/{circular-B42RaanD.js.map → circular-BUMjK3JF.js.map} +1 -1
  40. package/lib/{createServer-BKFsRuuk.js → createServer-BPz8ZCrd.js} +3 -3
  41. package/lib/createServer-BPz8ZCrd.js.map +1 -0
  42. package/lib/{errors-CF2X_x5o.js → errors-DY-qOx9n.js} +3 -3
  43. package/lib/{errors-CF2X_x5o.js.map → errors-DY-qOx9n.js.map} +1 -1
  44. package/lib/{index-CLy1XyH0.js → index-C_xVKbf9.js} +1285 -1240
  45. package/lib/index-C_xVKbf9.js.map +1 -0
  46. package/lib/{index-B6Re5_cx.js → index-dVBKCNMa.js} +123 -123
  47. package/lib/{index-B6Re5_cx.js.map → index-dVBKCNMa.js.map} +1 -1
  48. package/lib/zudoku.auth-azureb2c.js +1 -1
  49. package/lib/zudoku.auth-clerk.js +1 -1
  50. package/lib/zudoku.auth-openid.js +114 -105
  51. package/lib/zudoku.auth-openid.js.map +1 -1
  52. package/lib/zudoku.components.js +1 -1
  53. package/lib/zudoku.plugin-api-catalog.js +1 -1
  54. package/lib/zudoku.plugin-api-keys.js +271 -265
  55. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  56. package/lib/zudoku.plugin-markdown.js +1 -1
  57. package/lib/zudoku.plugin-openapi.js +1 -1
  58. package/package.json +4 -4
  59. package/src/app/demo.tsx +16 -1
  60. package/src/lib/authentication/authentication.ts +2 -2
  61. package/src/lib/authentication/components/SignIn.tsx +5 -12
  62. package/src/lib/authentication/providers/openid.tsx +23 -4
  63. package/src/lib/components/MobileTopNavigation.tsx +56 -7
  64. package/src/lib/components/TopNavigation.tsx +30 -14
  65. package/src/lib/core/ZudokuContext.ts +21 -0
  66. package/src/lib/plugins/api-keys/index.tsx +1 -1
  67. package/src/lib/plugins/markdown/MdxPage.tsx +3 -2
  68. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  69. package/src/lib/plugins/openapi/index.tsx +1 -1
  70. package/dist/flat-config.d.ts +0 -325
  71. package/lib/MdxPage-swXPJ0gf.js.map +0 -1
  72. package/lib/SignUp-5RUdVhnq.js +0 -63
  73. package/lib/SignUp-5RUdVhnq.js.map +0 -1
  74. package/lib/createServer-BKFsRuuk.js.map +0 -1
  75. 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 P } 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 ve, { createContext as O, useRef as E, useLayoutEffect as we, 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 N } 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 A } from "./Dialog-CiIdyz6a.js";
13
+ import { Input as Ie } from "./ui/Input.js";
14
+ import { c as R } 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 = E(null);
29
+ return i.current === null && (i.current = t()), i.current;
30
+ }
31
+ const Te = typeof window < "u", ze = Te ? we : 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;
40
38
  }
41
- class Me extends q.Component {
39
+ function qe(t) {
40
+ return Se(t) && "offsetHeight" in t;
41
+ }
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,235 @@ 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 = E(null), r = E({
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 D = (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(D), y = E(!0), p = E(d), k = ne(() => /* @__PURE__ */ new Map()), [a, c] = N(d), [m, v] = N(d);
134
+ ze(() => {
135
+ y.current = !1, p.current = d;
136
+ for (let w = 0; w < m.length; w++) {
137
+ const g = D(m[w]);
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 w = [...d];
144
+ for (let g = 0; g < m.length; g++) {
145
+ const b = m[g], z = D(b);
146
+ l.includes(z) || (w.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 && (w = C), v(U(w)), 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((w) => {
153
+ const g = D(w), 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?.(), v(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: w }, 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] = N(
161
167
  null
162
- ), [l, m] = b(""), { data: a, isFetching: x } = xe({
168
+ ), [r, f] = N(""), { 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"], (v) => v && v.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"], (v) => v && v.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(
268
+ className: R(
263
269
  "grid grid-cols-1 divide-y divide-border col-span-6",
264
270
  "lg:grid-cols-[1fr_min-content]"
265
271
  ),
266
- children: a.map((r) => /* @__PURE__ */ e.jsxs(
267
- be,
272
+ children: x.map((a) => /* @__PURE__ */ e.jsxs(
273
+ Pe,
268
274
  {
269
275
  className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
270
276
  children: [
271
- /* @__PURE__ */ e.jsxs(Ee, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
277
+ /* @__PURE__ */ e.jsxs(De, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
272
278
  /* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
273
279
  /* @__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: [
280
+ n === a.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
275
281
  /* @__PURE__ */ e.jsx(
276
- Ne,
282
+ Ie,
277
283
  {
278
284
  maxLength: 32,
279
- value: l,
280
- onChange: (c) => m(c.target.value),
285
+ value: r,
286
+ onChange: (c) => f(c.target.value),
281
287
  onKeyDown: (c) => {
282
- c.key === "Enter" ? w(r.id) : c.key === "Escape" && j();
288
+ c.key === "Enter" ? p(a.id) : c.key === "Escape" && k();
283
289
  },
284
290
  className: "text-lg font-medium",
285
291
  autoFocus: !0
@@ -287,72 +293,72 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
287
293
  ),
288
294
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
289
295
  /* @__PURE__ */ e.jsx(
290
- y,
296
+ j,
291
297
  {
292
298
  size: "icon",
293
299
  variant: "ghost",
294
- onClick: () => w(r.id),
295
- disabled: !l.trim(),
296
- children: /* @__PURE__ */ e.jsx(_, { size: 16 })
300
+ onClick: () => p(a.id),
301
+ disabled: !r.trim(),
302
+ children: /* @__PURE__ */ e.jsx(W, { size: 16 })
297
303
  }
298
304
  ),
299
305
  /* @__PURE__ */ e.jsx(
300
- y,
306
+ j,
301
307
  {
302
308
  size: "icon",
303
309
  variant: "ghost",
304
- onClick: j,
305
- children: /* @__PURE__ */ e.jsx(se, { size: 16 })
310
+ onClick: k,
311
+ children: /* @__PURE__ */ e.jsx(ae, { size: 16 })
306
312
  }
307
313
  )
308
314
  ] })
309
- ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: r.label }),
310
- /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: r.createdOn })
315
+ ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: a.label }),
316
+ /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: a.createdOn })
311
317
  ] }),
312
318
  /* @__PURE__ */ e.jsxs("div", { className: "text-muted-foreground text-xs", children: [
313
- r.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
319
+ a.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
314
320
  "Created on",
315
321
  " ",
316
- new Date(r.createdOn).toLocaleDateString()
322
+ new Date(a.createdOn).toLocaleDateString()
317
323
  ] }),
318
- r.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
324
+ a.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
319
325
  "Expires on",
320
326
  " ",
321
- new Date(r.expiresOn).toLocaleDateString()
327
+ new Date(a.expiresOn).toLocaleDateString()
322
328
  ] })
323
329
  ] })
324
330
  ] }),
325
331
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
326
332
  t.updateConsumer && /* @__PURE__ */ e.jsxs(
327
- y,
333
+ j,
328
334
  {
329
335
  variant: "ghost",
330
- onClick: () => C(r.id, r.label),
331
- className: P(
336
+ onClick: () => y(a.id, a.label),
337
+ className: R(
332
338
  "flex gap-2",
333
- n === r.id && "opacity-0! pointer-events-none"
339
+ n === a.id && "opacity-0! pointer-events-none"
334
340
  ),
335
- disabled: n === r.id,
341
+ disabled: n === a.id,
336
342
  children: [
337
- /* @__PURE__ */ e.jsx(ne, { size: 16 }),
343
+ /* @__PURE__ */ e.jsx(oe, { size: 16 }),
338
344
  "Edit label"
339
345
  ]
340
346
  }
341
347
  ),
342
- t.rollKey && /* @__PURE__ */ e.jsxs(J, { children: [
343
- /* @__PURE__ */ e.jsx(U, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
344
- y,
348
+ t.rollKey && /* @__PURE__ */ e.jsxs(Y, { children: [
349
+ /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
350
+ j,
345
351
  {
346
352
  title: "Roll this key",
347
353
  variant: "ghost",
348
- disabled: d.isPending,
354
+ disabled: l.isPending,
349
355
  className: "flex items-center gap-2",
350
356
  children: [
351
357
  /* @__PURE__ */ e.jsx(
352
- ie,
358
+ le,
353
359
  {
354
360
  size: 16,
355
- className: d.isPending ? "animate-spin" : void 0
361
+ className: l.isPending ? "animate-spin" : void 0
356
362
  }
357
363
  ),
358
364
  "Roll key"
@@ -360,17 +366,17 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
360
366
  }
361
367
  ) }),
362
368
  /* @__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?" })
369
+ /* @__PURE__ */ e.jsxs(Z, { children: [
370
+ /* @__PURE__ */ e.jsx(ee, { children: "Roll API Key" }),
371
+ /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to roll this API key?" })
366
372
  ] }),
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,
373
+ /* @__PURE__ */ e.jsxs(se, { children: [
374
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
375
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
376
+ j,
371
377
  {
372
378
  onClick: () => {
373
- d.mutate(r.id);
379
+ l.mutate(a.id);
374
380
  },
375
381
  children: "Roll Key"
376
382
  }
@@ -380,109 +386,109 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
380
386
  ] })
381
387
  ] })
382
388
  ] }),
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: [
389
+ /* @__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(ve.Fragment, { children: [
384
390
  /* @__PURE__ */ e.jsx(
385
- Qe,
391
+ Je,
386
392
  {
387
393
  apiKey: c,
388
394
  onDeleteKey: () => {
389
395
  h.mutate({
390
- consumerId: r.id,
396
+ consumerId: a.id,
391
397
  keyId: c.id
392
398
  });
393
399
  },
394
- className: h.variables?.keyId === c.id && (h.isPending || x) ? "opacity-10!" : void 0
400
+ className: h.variables?.keyId === c.id && (h.isPending || u) ? "opacity-10!" : void 0
395
401
  }
396
402
  ),
397
403
  /* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
398
404
  ] }, c.id)) }) })
399
405
  ]
400
406
  },
401
- r.id
407
+ a.id
402
408
  ))
403
409
  }
404
410
  ) })
405
411
  ] });
406
- }, $e = (t) => {
412
+ }, Be = (t) => {
407
413
  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
414
  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 = ({
415
+ }, Je = ({
410
416
  apiKey: t,
411
417
  onDeleteKey: i,
412
418
  className: s
413
419
  }) => {
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(
420
+ const [n, o] = N(!1), [r, f] = Ke(), { key: x, createdOn: u, expiresOn: h } = t, d = h && new Date(h) < /* @__PURE__ */ new Date(), l = h ? Math.ceil(
415
421
  (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: [
422
+ ) : 1 / 0, y = l <= 7 && !d;
423
+ return /* @__PURE__ */ e.jsxs("div", { className: R("grid col-span-full grid-cols-subgrid p-6", s), children: [
418
424
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
419
425
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center text-sm border rounded-md w-fit px-1", children: [
420
426
  /* @__PURE__ */ e.jsxs("div", { className: "font-mono truncate h-9 items-center flex px-2 text-xs gap-2", children: [
421
427
  /* @__PURE__ */ e.jsx(
422
428
  "div",
423
429
  {
424
- className: P(
430
+ className: R(
425
431
  "rounded-full w-2 h-2 bg-emerald-400 mr-2",
426
- (C || p) && "bg-neutral-200"
432
+ (y || d) && "bg-neutral-200"
427
433
  )
428
434
  }
429
435
  ),
430
436
  /* @__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) })
437
+ /* @__PURE__ */ e.jsx("span", { className: n ? "" : "opacity-20", children: n ? x.slice(0, -5) : "**** ".repeat(x.slice(0, -5).length / 5) + "*".repeat(x.slice(0, -5).length % 5) }),
438
+ /* @__PURE__ */ e.jsx("span", { children: x.slice(-5) })
433
439
  ] })
434
440
  ] }),
435
441
  /* @__PURE__ */ e.jsx(
436
- y,
442
+ j,
437
443
  {
438
444
  variant: "ghost",
439
- onClick: () => o((w) => !w),
445
+ onClick: () => o((p) => !p),
440
446
  size: "icon",
441
- children: n ? /* @__PURE__ */ e.jsx(re, { size: 16 }) : /* @__PURE__ */ e.jsx(ae, { size: 16 })
447
+ children: n ? /* @__PURE__ */ e.jsx(ce, { size: 16 }) : /* @__PURE__ */ e.jsx(de, { size: 16 })
442
448
  }
443
449
  ),
444
450
  /* @__PURE__ */ e.jsx(
445
- y,
451
+ j,
446
452
  {
447
453
  variant: "ghost",
448
- onClick: () => m(a),
454
+ onClick: () => f(x),
449
455
  size: "icon",
450
- children: l ? /* @__PURE__ */ e.jsx(_, { size: 16 }) : /* @__PURE__ */ e.jsx(oe, { size: 16 })
456
+ children: r ? /* @__PURE__ */ e.jsx(W, { size: 16 }) : /* @__PURE__ */ e.jsx(ue, { size: 16 })
451
457
  }
452
458
  )
453
459
  ] }),
454
460
  /* @__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: [
461
+ u && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
456
462
  "Created ",
457
- $e(x),
463
+ Be(u),
458
464
  "."
459
465
  ] }),
460
466
  " ",
461
- h && C && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
467
+ h && y && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
462
468
  "Expires in ",
463
- d,
469
+ l,
464
470
  " ",
465
- d === 1 ? "day" : "days",
471
+ l === 1 ? "day" : "days",
466
472
  "."
467
473
  ] }),
468
- h && p && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
474
+ h && d && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
469
475
  "Expired",
470
476
  " ",
471
- d === 0 ? "today." : `${d * -1} days ago.`
477
+ l === 0 ? "today." : `${l * -1} days ago.`
472
478
  ] })
473
479
  ] })
474
480
  ] }),
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 }) }) }),
481
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: h && i && /* @__PURE__ */ e.jsxs(Y, { children: [
482
+ /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(he, { size: 16 }) }) }),
477
483
  /* @__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?" })
484
+ /* @__PURE__ */ e.jsxs(Z, { children: [
485
+ /* @__PURE__ */ e.jsx(ee, { children: "Delete API Key" }),
486
+ /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to delete this API key?" })
481
487
  ] }),
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,
488
+ /* @__PURE__ */ e.jsxs(se, { children: [
489
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(j, { variant: "outline", children: "Cancel" }) }),
490
+ /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
491
+ j,
486
492
  {
487
493
  onClick: () => {
488
494
  i();
@@ -494,36 +500,36 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
494
500
  ] })
495
501
  ] }) })
496
502
  ] });
497
- }, D = "https://api.zuploedge.com/v2/client", _e = async (t) => {
503
+ }, I = "https://api.zuploedge.com/v2/client", Ue = async (t) => {
498
504
  try {
499
505
  return await t.json();
500
506
  } catch {
501
507
  return;
502
508
  }
503
- }, I = async (t) => {
509
+ }, K = async (t) => {
504
510
  const i = t.headers.get("content-type");
505
511
  if (!t.ok && i?.includes("application/problem+json")) {
506
- const s = await _e(t);
512
+ const s = await Ue(t);
507
513
  if (s.type && s.title)
508
514
  throw new Error(s.detail ?? s.title);
509
515
  }
510
- }, He = (t) => ({
516
+ }, We = (t) => ({
511
517
  deleteKey: async (i, s, n) => {
512
518
  const o = new Request(
513
- D + `/${t}/consumers/${i}/keys/${s}`,
519
+ I + `/${t}/consumers/${i}/keys/${s}`,
514
520
  {
515
521
  method: "DELETE"
516
522
  }
517
523
  );
518
524
  await n.signRequest(o);
519
- const l = await fetch(o);
520
- await I(l), E(l.ok, "Failed to delete API key");
525
+ const r = await fetch(o);
526
+ await K(r), P(r.ok, "Failed to delete API key");
521
527
  },
522
528
  updateConsumer: async (i, s) => {
523
529
  const n = await fetch(
524
530
  await s.signRequest(
525
531
  new Request(
526
- D + `/${t}/consumers/${i.id}`,
532
+ I + `/${t}/consumers/${i.id}`,
527
533
  {
528
534
  method: "PATCH",
529
535
  headers: {
@@ -536,13 +542,13 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
536
542
  )
537
543
  )
538
544
  );
539
- await I(n), E(n.ok, "Failed to update API key description");
545
+ await K(n), P(n.ok, "Failed to update API key description");
540
546
  },
541
547
  rollKey: async (i, s) => {
542
548
  const n = await fetch(
543
549
  await s.signRequest(
544
550
  new Request(
545
- D + `/${t}/consumers/${i}/roll-key`,
551
+ I + `/${t}/consumers/${i}/roll-key`,
546
552
  {
547
553
  method: "POST",
548
554
  headers: {
@@ -553,39 +559,39 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
553
559
  )
554
560
  )
555
561
  );
556
- await I(n), E(n.ok, "Failed to delete API key");
562
+ await K(n), P(n.ok, "Failed to delete API key");
557
563
  },
558
564
  getConsumers: async (i) => {
559
565
  const s = new Request(
560
- D + `/${t}/consumers`
566
+ I + `/${t}/consumers`
561
567
  );
562
568
  await i.signRequest(s);
563
569
  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)
570
+ return await K(n), P(n.ok, "Failed to fetch API keys"), (await n.json()).data.map((r) => ({
571
+ id: r.id,
572
+ label: r.label || r.subject || "API Key",
573
+ apiKeys: r.apiKeys.data,
574
+ key: r.apiKeys.data.at(0)
569
575
  }));
570
576
  }
571
- }), rt = (t) => t, at = (t) => {
572
- const i = "deploymentName" in t ? He(t.deploymentName) : t;
577
+ }), ct = (t) => t, dt = (t) => {
578
+ const i = "deploymentName" in t ? We(t.deploymentName) : t;
573
579
  return {
574
580
  getProfileMenuItems: () => [
575
581
  {
576
582
  label: "API Keys",
577
583
  path: "/settings/api-keys",
578
584
  category: "middle",
579
- icon: ce
585
+ icon: fe
580
586
  }
581
587
  ],
582
588
  getIdentities: async (s) => {
583
589
  try {
584
590
  return (await i.getConsumers(s)).map((o) => ({
585
- authorizeRequest: (l) => (l.headers.set(
591
+ authorizeRequest: (r) => (r.headers.set(
586
592
  "Authorization",
587
593
  `Bearer ${o.apiKeys.at(0)?.key}`
588
- ), l),
594
+ ), r),
589
595
  id: o.id,
590
596
  label: o.label
591
597
  }));
@@ -595,12 +601,12 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
595
601
  },
596
602
  getRoutes: () => [
597
603
  {
598
- element: /* @__PURE__ */ e.jsx(Ie, {}),
599
- errorElement: /* @__PURE__ */ e.jsx(ue, {}),
604
+ element: /* @__PURE__ */ e.jsx(Ae, {}),
605
+ errorElement: /* @__PURE__ */ e.jsx(me, {}),
600
606
  children: [
601
607
  {
602
608
  path: "/settings/api-keys",
603
- element: /* @__PURE__ */ e.jsx(Fe, { service: i })
609
+ element: /* @__PURE__ */ e.jsx(_e, { service: i })
604
610
  }
605
611
  // {
606
612
  // path: "/settings/api-keys/new",
@@ -612,7 +618,7 @@ const Oe = ({ children: t, exitBeforeEnter: i, custom: s, initial: n = !0, onExi
612
618
  };
613
619
  };
614
620
  export {
615
- at as apiKeyPlugin,
616
- rt as createApiKeyService
621
+ dt as apiKeyPlugin,
622
+ ct as createApiKeyService
617
623
  };
618
624
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map