nexus-shell 0.2.4 → 0.2.6

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.
@@ -1,251 +1,251 @@
1
- var Oe = Object.defineProperty;
2
- var Ae = (n, e, o) => e in n ? Oe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o;
3
- var H = (n, e, o) => Ae(n, typeof e != "symbol" ? e + "" : e, o);
4
- import { jsxs as c, jsx as r, Fragment as be } from "react/jsx-runtime";
5
- import se, { useMemo as j, useState as A, useRef as z, useEffect as O } from "react";
6
- import { Model as R, Actions as G, DockLocation as Le, Layout as Me } from "flexlayout-react";
1
+ var qe = Object.defineProperty;
2
+ var Ve = (t, e, n) => e in t ? qe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var Q = (t, e, n) => Ve(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { jsxs as p, jsx as o, Fragment as Ae } from "react/jsx-runtime";
5
+ import ge, { useMemo as B, useState as R, useRef as F, useEffect as O, forwardRef as Qe, useCallback as ee, useImperativeHandle as Ze } from "react";
6
+ import { Model as W, Actions as re, DockLocation as et, Layout as tt } from "flexlayout-react";
7
7
  import "flexlayout-react/style/light.css";
8
- import { Settings as ze, MessageCircle as xe, X as B, User as ve, Terminal as ye, Send as Pe, ChevronRight as we, GraduationCap as ue, Moon as $e, Sun as Re, Palette as Ke, ChevronUp as Ne, Search as Z, Info as je, HelpCircle as Ue, AlertCircle as Fe, Check as _e, Camera as Be, Edit2 as He, Loader2 as ke, ChevronsUpDown as We, ChevronDown as Ce, Clock as Je } from "lucide-react";
9
- import { clsx as Ge } from "clsx";
10
- import { twMerge as Ve } from "tailwind-merge";
11
- import { create as F } from "zustand";
12
- import { TableVirtuoso as Ye, Virtuoso as qe } from "react-virtuoso";
13
- function S(...n) {
14
- return Ve(Ge(n));
8
+ import { Settings as rt, MessageCircle as $e, X as V, User as Oe, Terminal as Re, Send as nt, ChevronRight as Pe, GraduationCap as ke, Moon as ot, Sun as st, Palette as at, ChevronUp as ze, Search as ue, Info as it, HelpCircle as lt, AlertCircle as ct, Check as dt, Camera as ut, Edit2 as ft, Loader2 as Ke, ChevronsUpDown as mt, ChevronDown as Fe, Clock as pt } from "lucide-react";
9
+ import { clsx as ht } from "clsx";
10
+ import { twMerge as gt } from "tailwind-merge";
11
+ import { create as J } from "zustand";
12
+ import { TableVirtuoso as xt, Virtuoso as bt } from "react-virtuoso";
13
+ function L(...t) {
14
+ return gt(ht(t));
15
15
  }
16
- const Qe = [
17
- { id: "settings", label: "Settings", icon: ze }
18
- ], Xe = ({
19
- items: n = [],
20
- bottomItems: e = Qe,
21
- activeId: o = null,
22
- onSelect: t,
16
+ const yt = [
17
+ { id: "settings", label: "Settings", icon: rt }
18
+ ], vt = ({
19
+ items: t = [],
20
+ bottomItems: e = yt,
21
+ activeId: n = null,
22
+ onSelect: r,
23
23
  className: a,
24
24
  "aria-label": s = "Activity Bar"
25
25
  }) => {
26
- const l = ({ id: u, label: i, icon: d }) => /* @__PURE__ */ r(
26
+ const i = ({ id: d, label: l, icon: c }) => /* @__PURE__ */ o(
27
27
  "button",
28
28
  {
29
29
  type: "button",
30
- onClick: () => t == null ? void 0 : t(u),
31
- "aria-label": i,
32
- title: i,
33
- "aria-pressed": o === u,
34
- className: S(
30
+ onClick: () => r == null ? void 0 : r(d),
31
+ "aria-label": l,
32
+ title: l,
33
+ "aria-pressed": n === d,
34
+ className: L(
35
35
  "p-2 cursor-pointer rounded text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
36
- o === u && "text-foreground border-l-2 border-primary rounded-none"
36
+ n === d && "text-foreground border-l-2 border-primary rounded-none"
37
37
  ),
38
- children: /* @__PURE__ */ r(d, { size: 20 })
38
+ children: /* @__PURE__ */ o(c, { size: 20 })
39
39
  },
40
- u
40
+ d
41
41
  );
42
- return /* @__PURE__ */ c(
42
+ return /* @__PURE__ */ p(
43
43
  "aside",
44
44
  {
45
45
  role: "navigation",
46
46
  "aria-label": s,
47
- className: S(
47
+ className: L(
48
48
  "w-12 h-full bg-muted border-r flex flex-col items-center py-2 select-none",
49
49
  a
50
50
  ),
51
51
  children: [
52
- /* @__PURE__ */ r("div", { className: "flex-1 flex flex-col space-y-4", children: n.map(l) }),
53
- e.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-col space-y-4", children: e.map(l) })
52
+ /* @__PURE__ */ o("div", { className: "flex-1 flex flex-col space-y-4", children: t.map(i) }),
53
+ e.length > 0 && /* @__PURE__ */ o("div", { className: "flex flex-col space-y-4", children: e.map(i) })
54
54
  ]
55
55
  }
56
56
  );
57
- }, q = "nexus-shell-sidebar", U = F((n) => {
58
- const e = localStorage.getItem(q);
57
+ }, se = "nexus-shell-sidebar", G = J((t) => {
58
+ const e = localStorage.getItem(se);
59
59
  return {
60
60
  activeSidebar: e !== null ? e : null,
61
61
  panels: [],
62
- setActiveSidebar: (t) => {
63
- t === null ? localStorage.removeItem(q) : localStorage.setItem(q, t), n({ activeSidebar: t });
62
+ setActiveSidebar: (r) => {
63
+ r === null ? localStorage.removeItem(se) : localStorage.setItem(se, r), t({ activeSidebar: r });
64
64
  },
65
- toggleSidebar: (t) => n((a) => {
66
- const s = a.activeSidebar === t ? null : t;
67
- return s === null ? localStorage.removeItem(q) : localStorage.setItem(q, s), { activeSidebar: s };
65
+ toggleSidebar: (r) => t((a) => {
66
+ const s = a.activeSidebar === r ? null : r;
67
+ return s === null ? localStorage.removeItem(se) : localStorage.setItem(se, s), { activeSidebar: s };
68
68
  }),
69
- setPanels: (t) => n({ panels: t })
69
+ setPanels: (r) => t({ panels: r })
70
70
  };
71
- }), Ze = (n) => {
72
- const e = U((s) => s.panels), o = U((s) => s.activeSidebar), t = U((s) => s.toggleSidebar), a = j(
73
- () => e.map(({ id: s, label: l, icon: u }) => ({ id: s, label: l, icon: u })),
71
+ }), wt = (t) => {
72
+ const e = G((s) => s.panels), n = G((s) => s.activeSidebar), r = G((s) => s.toggleSidebar), a = B(
73
+ () => e.map(({ id: s, label: i, icon: d }) => ({ id: s, label: i, icon: d })),
74
74
  [e]
75
75
  );
76
- return /* @__PURE__ */ r(
77
- Xe,
76
+ return /* @__PURE__ */ o(
77
+ vt,
78
78
  {
79
- ...n,
79
+ ...t,
80
80
  items: a,
81
- activeId: o,
82
- onSelect: t
81
+ activeId: n,
82
+ onSelect: r
83
83
  }
84
84
  );
85
- }, et = /* @__PURE__ */ c("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
86
- /* @__PURE__ */ r(xe, { size: 28, className: "mb-3 opacity-40" }),
87
- /* @__PURE__ */ r("p", { className: "text-xs", children: "No messages yet." }),
88
- /* @__PURE__ */ c("p", { className: "text-[11px] mt-1 opacity-70", children: [
85
+ }, Nt = /* @__PURE__ */ p("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
86
+ /* @__PURE__ */ o($e, { size: 28, className: "mb-3 opacity-40" }),
87
+ /* @__PURE__ */ o("p", { className: "text-xs", children: "No messages yet." }),
88
+ /* @__PURE__ */ p("p", { className: "text-[11px] mt-1 opacity-70", children: [
89
89
  "Type a message, or ",
90
- /* @__PURE__ */ r("span", { className: "font-mono", children: "/" }),
90
+ /* @__PURE__ */ o("span", { className: "font-mono", children: "/" }),
91
91
  " for commands."
92
92
  ] })
93
- ] }), tt = ({
94
- messages: n = [],
93
+ ] }), kt = ({
94
+ messages: t = [],
95
95
  onSend: e,
96
- slashCommands: o = [],
97
- onSlashCommand: t,
96
+ slashCommands: n = [],
97
+ onSlashCommand: r,
98
98
  onClose: a,
99
99
  title: s = "Chat",
100
- placeholder: l = "Send a message…",
101
- emptyState: u = et,
102
- className: i
100
+ placeholder: i = "Send a message…",
101
+ emptyState: d = Nt,
102
+ className: l
103
103
  }) => {
104
- const [d, m] = A(""), [f, p] = A(0), N = z(null), k = z(null), w = d.startsWith("/") ? o.filter(
105
- (g) => `/${g.command}`.startsWith(d.toLowerCase().split(" ")[0])
106
- ) : [], h = w.length > 0;
104
+ const [c, y] = R(""), [x, h] = R(0), T = F(null), E = F(null), g = c.startsWith("/") ? n.filter(
105
+ (f) => `/${f.command}`.startsWith(c.toLowerCase().split(" ")[0])
106
+ ) : [], m = g.length > 0;
107
107
  O(() => {
108
- k.current && (k.current.scrollTop = k.current.scrollHeight);
109
- }, [n]), O(() => {
110
- p(0);
111
- }, [d]);
112
- const x = () => {
113
- const g = d.trim();
114
- g && (e == null || e(g), m(""));
115
- }, b = (g) => {
116
- var C;
117
- t == null || t(g), m(`/${g.command} `), (C = N.current) == null || C.focus();
118
- }, y = (g) => {
119
- if (h) {
120
- if (g.key === "ArrowDown") {
121
- g.preventDefault(), p((C) => (C + 1) % w.length);
108
+ E.current && (E.current.scrollTop = E.current.scrollHeight);
109
+ }, [t]), O(() => {
110
+ h(0);
111
+ }, [c]);
112
+ const b = () => {
113
+ const f = c.trim();
114
+ f && (e == null || e(f), y(""));
115
+ }, N = (f) => {
116
+ var D;
117
+ r == null || r(f), y(`/${f.command} `), (D = T.current) == null || D.focus();
118
+ }, w = (f) => {
119
+ if (m) {
120
+ if (f.key === "ArrowDown") {
121
+ f.preventDefault(), h((D) => (D + 1) % g.length);
122
122
  return;
123
123
  }
124
- if (g.key === "ArrowUp") {
125
- g.preventDefault(), p((C) => (C - 1 + w.length) % w.length);
124
+ if (f.key === "ArrowUp") {
125
+ f.preventDefault(), h((D) => (D - 1 + g.length) % g.length);
126
126
  return;
127
127
  }
128
- if (g.key === "Tab" || g.key === "Enter" && !g.shiftKey) {
129
- g.preventDefault(), b(w[f]);
128
+ if (f.key === "Tab" || f.key === "Enter" && !f.shiftKey) {
129
+ f.preventDefault(), N(g[x]);
130
130
  return;
131
131
  }
132
132
  }
133
- g.key === "Enter" && !g.shiftKey && (g.preventDefault(), x());
133
+ f.key === "Enter" && !f.shiftKey && (f.preventDefault(), b());
134
134
  };
135
- return /* @__PURE__ */ c(
135
+ return /* @__PURE__ */ p(
136
136
  "aside",
137
137
  {
138
138
  role: "complementary",
139
139
  "aria-label": s,
140
- className: S(
140
+ className: L(
141
141
  "w-[320px] h-full bg-muted border-l border-border flex flex-col select-none shrink-0",
142
- i
142
+ l
143
143
  ),
144
144
  children: [
145
- /* @__PURE__ */ c("div", { className: "h-10 flex items-center justify-between px-4 shrink-0", children: [
146
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
147
- /* @__PURE__ */ r(xe, { size: 13 }),
148
- /* @__PURE__ */ r("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
145
+ /* @__PURE__ */ p("div", { className: "h-10 flex items-center justify-between px-4 shrink-0", children: [
146
+ /* @__PURE__ */ p("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
147
+ /* @__PURE__ */ o($e, { size: 13 }),
148
+ /* @__PURE__ */ o("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
149
149
  ] }),
150
- a && /* @__PURE__ */ r(
150
+ a && /* @__PURE__ */ o(
151
151
  "button",
152
152
  {
153
153
  type: "button",
154
154
  onClick: a,
155
155
  "aria-label": "Close Chat",
156
156
  className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
157
- children: /* @__PURE__ */ r(B, { size: 14 })
157
+ children: /* @__PURE__ */ o(V, { size: 14 })
158
158
  }
159
159
  )
160
160
  ] }),
161
- /* @__PURE__ */ r(
161
+ /* @__PURE__ */ o(
162
162
  "div",
163
163
  {
164
- ref: k,
164
+ ref: E,
165
165
  role: "log",
166
166
  "aria-label": `${s} transcript`,
167
167
  className: "flex-1 overflow-y-auto border-t border-border/50 bg-background/50 px-3 py-3 space-y-3",
168
- children: n.length === 0 ? u : n.map((g) => {
169
- const C = g.role === "user";
170
- return /* @__PURE__ */ c(
168
+ children: t.length === 0 ? d : t.map((f) => {
169
+ const D = f.role === "user";
170
+ return /* @__PURE__ */ p(
171
171
  "div",
172
172
  {
173
- className: S("flex flex-col", C ? "items-end" : "items-start"),
173
+ className: L("flex flex-col", D ? "items-end" : "items-start"),
174
174
  children: [
175
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-1 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-bold", children: [
176
- C ? /* @__PURE__ */ r(ve, { size: 10 }) : /* @__PURE__ */ r(ye, { size: 10 }),
177
- /* @__PURE__ */ r("span", { children: g.author ?? (C ? "You" : "Assistant") })
175
+ /* @__PURE__ */ p("div", { className: "flex items-center space-x-1 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-bold", children: [
176
+ D ? /* @__PURE__ */ o(Oe, { size: 10 }) : /* @__PURE__ */ o(Re, { size: 10 }),
177
+ /* @__PURE__ */ o("span", { children: f.author ?? (D ? "You" : "Assistant") })
178
178
  ] }),
179
- /* @__PURE__ */ r(
179
+ /* @__PURE__ */ o(
180
180
  "div",
181
181
  {
182
- className: S(
182
+ className: L(
183
183
  "max-w-[85%] rounded-lg px-3 py-2 text-xs whitespace-pre-wrap break-words",
184
- C ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
184
+ D ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
185
185
  ),
186
- children: g.text
186
+ children: f.text
187
187
  }
188
188
  )
189
189
  ]
190
190
  },
191
- g.id
191
+ f.id
192
192
  );
193
193
  })
194
194
  }
195
195
  ),
196
- /* @__PURE__ */ c("div", { className: "relative border-t border-border/50 p-2 shrink-0", children: [
197
- h && /* @__PURE__ */ r(
196
+ /* @__PURE__ */ p("div", { className: "relative border-t border-border/50 p-2 shrink-0", children: [
197
+ m && /* @__PURE__ */ o(
198
198
  "div",
199
199
  {
200
200
  role: "listbox",
201
201
  "aria-label": "Slash commands",
202
202
  className: "absolute bottom-full left-2 right-2 mb-1 bg-popover border border-border rounded-md shadow-lg overflow-hidden z-20",
203
- children: w.map((g, C) => /* @__PURE__ */ c(
203
+ children: g.map((f, D) => /* @__PURE__ */ p(
204
204
  "div",
205
205
  {
206
206
  role: "option",
207
- "aria-selected": C === f,
208
- onMouseEnter: () => p(C),
209
- onClick: () => b(g),
210
- className: S(
207
+ "aria-selected": D === x,
208
+ onMouseEnter: () => h(D),
209
+ onClick: () => N(f),
210
+ className: L(
211
211
  "px-3 py-1.5 text-xs cursor-pointer flex items-baseline justify-between gap-3",
212
- C === f ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
212
+ D === x ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
213
213
  ),
214
214
  children: [
215
- /* @__PURE__ */ c("span", { className: "font-mono", children: [
215
+ /* @__PURE__ */ p("span", { className: "font-mono", children: [
216
216
  "/",
217
- g.command
217
+ f.command
218
218
  ] }),
219
- /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground truncate", children: g.description })
219
+ /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground truncate", children: f.description })
220
220
  ]
221
221
  },
222
- g.command
222
+ f.command
223
223
  ))
224
224
  }
225
225
  ),
226
- /* @__PURE__ */ c("div", { className: "flex items-end space-x-2", children: [
227
- /* @__PURE__ */ r(
226
+ /* @__PURE__ */ p("div", { className: "flex items-end space-x-2", children: [
227
+ /* @__PURE__ */ o(
228
228
  "textarea",
229
229
  {
230
- ref: N,
230
+ ref: T,
231
231
  rows: 1,
232
- value: d,
232
+ value: c,
233
233
  "aria-label": `${s} message`,
234
- placeholder: l,
235
- onChange: (g) => m(g.target.value),
236
- onKeyDown: y,
234
+ placeholder: i,
235
+ onChange: (f) => y(f.target.value),
236
+ onKeyDown: w,
237
237
  className: "flex-1 resize-none bg-background border border-border rounded-md px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/50 max-h-32"
238
238
  }
239
239
  ),
240
- /* @__PURE__ */ r(
240
+ /* @__PURE__ */ o(
241
241
  "button",
242
242
  {
243
243
  type: "button",
244
- onClick: x,
245
- disabled: !d.trim(),
244
+ onClick: b,
245
+ disabled: !c.trim(),
246
246
  "aria-label": "Send message",
247
247
  className: "p-2 rounded-md bg-primary text-primary-foreground disabled:opacity-40 disabled:cursor-not-allowed hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
248
- children: /* @__PURE__ */ r(Pe, { size: 14 })
248
+ children: /* @__PURE__ */ o(nt, { size: 14 })
249
249
  }
250
250
  )
251
251
  ] })
@@ -254,157 +254,157 @@ const Qe = [
254
254
  }
255
255
  );
256
256
  };
257
- let rt = 0;
258
- const nt = () => `msg-${Date.now()}-${rt += 1}`, Q = F((n) => ({
257
+ let Et = 0;
258
+ const Tt = () => `msg-${Date.now()}-${Et += 1}`, ae = J((t) => ({
259
259
  messages: [],
260
260
  slashCommands: [],
261
- setMessages: (e) => n({ messages: e }),
262
- addMessage: (e) => n((o) => ({
263
- messages: [...o.messages, { ...e, id: e.id ?? nt() }]
261
+ setMessages: (e) => t({ messages: e }),
262
+ addMessage: (e) => t((n) => ({
263
+ messages: [...n.messages, { ...e, id: e.id ?? Tt() }]
264
264
  })),
265
- clearMessages: () => n({ messages: [] }),
266
- setSlashCommands: (e) => n({ slashCommands: e }),
267
- registerSlashCommand: (e) => n((o) => ({ slashCommands: [...o.slashCommands, e] }))
268
- })), re = "nexus-shell-right-sidebar", ae = F((n) => ({
269
- isChatOpen: localStorage.getItem(re) === "true",
270
- setChatOpen: (t) => {
271
- localStorage.setItem(re, String(t)), n({ isChatOpen: t });
265
+ clearMessages: () => t({ messages: [] }),
266
+ setSlashCommands: (e) => t({ slashCommands: e }),
267
+ registerSlashCommand: (e) => t((n) => ({ slashCommands: [...n.slashCommands, e] }))
268
+ })), fe = "nexus-shell-right-sidebar", xe = J((t) => ({
269
+ isChatOpen: localStorage.getItem(fe) === "true",
270
+ setChatOpen: (r) => {
271
+ localStorage.setItem(fe, String(r)), t({ isChatOpen: r });
272
272
  },
273
- toggleChat: () => n((t) => {
274
- const a = !t.isChatOpen;
275
- return localStorage.setItem(re, String(a)), { isChatOpen: a };
273
+ toggleChat: () => t((r) => {
274
+ const a = !r.isChatOpen;
275
+ return localStorage.setItem(fe, String(a)), { isChatOpen: a };
276
276
  })
277
- })), ot = ({ onSend: n, ...e }) => {
278
- const o = ae((i) => i.isChatOpen), t = ae((i) => i.setChatOpen), a = Q((i) => i.messages), s = Q((i) => i.slashCommands), l = Q((i) => i.addMessage);
279
- return o ? /* @__PURE__ */ r(
280
- tt,
277
+ })), Ct = ({ onSend: t, ...e }) => {
278
+ const n = xe((l) => l.isChatOpen), r = xe((l) => l.setChatOpen), a = ae((l) => l.messages), s = ae((l) => l.slashCommands), i = ae((l) => l.addMessage);
279
+ return n ? /* @__PURE__ */ o(
280
+ kt,
281
281
  {
282
282
  ...e,
283
283
  messages: a,
284
284
  slashCommands: s,
285
- onSend: (i) => {
286
- if (l({ role: "user", text: i }), i.startsWith("/")) {
287
- const [d, ...m] = i.slice(1).split(/\s+/), f = s.find((p) => p.command === d);
288
- if (f) {
289
- f.execute(m);
285
+ onSend: (l) => {
286
+ if (i({ role: "user", text: l }), l.startsWith("/")) {
287
+ const [c, ...y] = l.slice(1).split(/\s+/), x = s.find((h) => h.command === c);
288
+ if (x) {
289
+ x.execute(y);
290
290
  return;
291
291
  }
292
- l({ role: "assistant", text: `Unknown command: /${d}` });
292
+ i({ role: "assistant", text: `Unknown command: /${c}` });
293
293
  return;
294
294
  }
295
- n == null || n(i);
295
+ t == null || t(l);
296
296
  },
297
- onClose: () => t(!1)
297
+ onClose: () => r(!1)
298
298
  }
299
299
  ) : null;
300
- }, st = ({
301
- menus: n = {},
300
+ }, Dt = ({
301
+ menus: t = {},
302
302
  onSelect: e,
303
- title: o,
304
- center: t,
303
+ title: n,
304
+ center: r,
305
305
  right: a,
306
306
  className: s
307
307
  }) => {
308
- const l = (i) => i.keybinding ? /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground opacity-60 ml-4", children: i.keybinding }) : null, u = (i) => /* @__PURE__ */ r(
308
+ const i = (l) => l.keybinding ? /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground opacity-60 ml-4", children: l.keybinding }) : null, d = (l) => /* @__PURE__ */ o(
309
309
  "div",
310
310
  {
311
311
  role: "menu",
312
312
  className: "absolute left-0 top-full hidden group-hover:block z-50 min-w-[180px] bg-popover text-popover-foreground border shadow-md rounded-md py-1",
313
- children: i.map((d) => /* @__PURE__ */ c("div", { className: "relative group/sub", children: [
314
- /* @__PURE__ */ c(
313
+ children: l.map((c) => /* @__PURE__ */ p("div", { className: "relative group/sub", children: [
314
+ /* @__PURE__ */ p(
315
315
  "div",
316
316
  {
317
317
  role: "menuitem",
318
318
  tabIndex: 0,
319
- onClick: () => !d.submenu && (e == null ? void 0 : e(d)),
320
- onKeyDown: (m) => {
321
- !d.submenu && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), e == null || e(d));
319
+ onClick: () => !c.submenu && (e == null ? void 0 : e(c)),
320
+ onKeyDown: (y) => {
321
+ !c.submenu && (y.key === "Enter" || y.key === " ") && (y.preventDefault(), e == null || e(c));
322
322
  },
323
323
  className: "px-3 py-1.5 hover:bg-accent hover:text-accent-foreground cursor-pointer text-xs flex justify-between items-center focus:outline-none focus:bg-accent",
324
324
  children: [
325
- /* @__PURE__ */ r("span", { children: d.label }),
326
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
327
- l(d),
328
- d.submenu && /* @__PURE__ */ r(we, { size: 10 })
325
+ /* @__PURE__ */ o("span", { children: c.label }),
326
+ /* @__PURE__ */ p("div", { className: "flex items-center space-x-2", children: [
327
+ i(c),
328
+ c.submenu && /* @__PURE__ */ o(Pe, { size: 10 })
329
329
  ] })
330
330
  ]
331
331
  }
332
332
  ),
333
- d.submenu && /* @__PURE__ */ r(
333
+ c.submenu && /* @__PURE__ */ o(
334
334
  "div",
335
335
  {
336
336
  role: "menu",
337
337
  className: "absolute left-full top-0 hidden group-hover/sub:block z-[60] min-w-[180px] bg-popover text-popover-foreground border shadow-md rounded-md py-1 ml-[-2px]",
338
- children: d.submenu.map((m) => /* @__PURE__ */ c(
338
+ children: c.submenu.map((y) => /* @__PURE__ */ p(
339
339
  "div",
340
340
  {
341
341
  role: "menuitem",
342
342
  tabIndex: 0,
343
- onClick: () => e == null ? void 0 : e(m),
344
- onKeyDown: (f) => {
345
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), e == null || e(m));
343
+ onClick: () => e == null ? void 0 : e(y),
344
+ onKeyDown: (x) => {
345
+ (x.key === "Enter" || x.key === " ") && (x.preventDefault(), e == null || e(y));
346
346
  },
347
347
  className: "px-3 py-1.5 hover:bg-accent hover:text-accent-foreground cursor-pointer text-xs flex justify-between items-center focus:outline-none focus:bg-accent",
348
348
  children: [
349
- /* @__PURE__ */ r("span", { children: m.label }),
350
- l(m)
349
+ /* @__PURE__ */ o("span", { children: y.label }),
350
+ i(y)
351
351
  ]
352
352
  },
353
- m.id
353
+ y.id
354
354
  ))
355
355
  }
356
356
  )
357
- ] }, d.id))
357
+ ] }, c.id))
358
358
  }
359
359
  );
360
- return /* @__PURE__ */ c(
360
+ return /* @__PURE__ */ p(
361
361
  "header",
362
362
  {
363
363
  role: "banner",
364
364
  "aria-label": "Application Header",
365
- className: S(
365
+ className: L(
366
366
  "bg-muted border-b flex items-center justify-between px-4 select-none shrink-0 transition-all z-50 relative",
367
- o !== void 0 ? "h-12 bg-card/65 backdrop-blur-sm" : "h-8",
367
+ n !== void 0 ? "h-12 bg-card/65 backdrop-blur-sm" : "h-8",
368
368
  s
369
369
  ),
370
370
  children: [
371
- /* @__PURE__ */ c("div", { className: "flex items-center flex-1 min-w-0", children: [
372
- o !== void 0 ? /* @__PURE__ */ r("div", { className: "mr-12 flex items-center shrink-0", children: o }) : /* @__PURE__ */ r("div", { className: "font-semibold mr-6 text-sm shrink-0", children: "Nexus Shell" }),
373
- /* @__PURE__ */ r(
371
+ /* @__PURE__ */ p("div", { className: "flex items-center flex-1 min-w-0", children: [
372
+ n !== void 0 ? /* @__PURE__ */ o("div", { className: "mr-12 flex items-center shrink-0", children: n }) : /* @__PURE__ */ o("div", { className: "font-semibold mr-6 text-sm shrink-0", children: "Nexus Shell" }),
373
+ /* @__PURE__ */ o(
374
374
  "nav",
375
375
  {
376
376
  role: "navigation",
377
377
  "aria-label": "Main Menu",
378
378
  className: "flex space-x-1 text-sm shrink-0",
379
- children: Object.entries(n).map(([i, d]) => /* @__PURE__ */ c("div", { className: "relative group", children: [
380
- /* @__PURE__ */ r(
379
+ children: Object.entries(t).map(([l, c]) => /* @__PURE__ */ p("div", { className: "relative group", children: [
380
+ /* @__PURE__ */ o(
381
381
  "div",
382
382
  {
383
383
  role: "button",
384
384
  tabIndex: 0,
385
385
  "aria-haspopup": "menu",
386
386
  className: "cursor-pointer hover:bg-accent hover:text-accent-foreground px-3 py-1 rounded text-xs focus:outline-none focus:ring-2 focus:ring-ring",
387
- children: i
387
+ children: l
388
388
  }
389
389
  ),
390
- d.length > 0 && u(d)
391
- ] }, i))
390
+ c.length > 0 && d(c)
391
+ ] }, l))
392
392
  }
393
393
  ),
394
- t && /* @__PURE__ */ r("div", { className: "ml-8 w-60 md:w-72 relative hidden sm:block", children: t })
394
+ r && /* @__PURE__ */ o("div", { className: "ml-8 w-60 md:w-72 relative hidden sm:block", children: r })
395
395
  ] }),
396
- a && /* @__PURE__ */ r("div", { className: "flex items-center ml-4 shrink-0", children: a })
396
+ a && /* @__PURE__ */ o("div", { className: "flex items-center ml-4 shrink-0", children: a })
397
397
  ]
398
398
  }
399
399
  );
400
400
  };
401
- class at {
401
+ class St {
402
402
  constructor() {
403
- H(this, "menus", /* @__PURE__ */ new Map());
403
+ Q(this, "menus", /* @__PURE__ */ new Map());
404
404
  }
405
- registerMenu(e, o) {
406
- var t;
407
- this.menus.has(e) || this.menus.set(e, []), (t = this.menus.get(e)) == null || t.push(o);
405
+ registerMenu(e, n) {
406
+ var r;
407
+ this.menus.has(e) || this.menus.set(e, []), (r = this.menus.get(e)) == null || r.push(n);
408
408
  }
409
409
  setMenus(e) {
410
410
  this.menus = new Map(Object.entries(e));
@@ -414,15 +414,15 @@ class at {
414
414
  }
415
415
  getAllMenus() {
416
416
  const e = {};
417
- return this.menus.forEach((o, t) => {
418
- e[t] = o;
417
+ return this.menus.forEach((n, r) => {
418
+ e[r] = n;
419
419
  }), e;
420
420
  }
421
421
  }
422
- const le = new at();
423
- class lt {
422
+ const ve = new St();
423
+ class It {
424
424
  constructor() {
425
- H(this, "commands", /* @__PURE__ */ new Map());
425
+ Q(this, "commands", /* @__PURE__ */ new Map());
426
426
  }
427
427
  registerCommand(e) {
428
428
  if (this.commands.has(e.id)) {
@@ -431,9 +431,9 @@ class lt {
431
431
  }
432
432
  this.commands.set(e.id, e);
433
433
  }
434
- executeCommand(e, ...o) {
435
- const t = this.commands.get(e);
436
- t ? t.execute(...o) : console.warn(`Command ${e} not found.`);
434
+ executeCommand(e, ...n) {
435
+ const r = this.commands.get(e);
436
+ r ? r.execute(...n) : console.warn(`Command ${e} not found.`);
437
437
  }
438
438
  getCommand(e) {
439
439
  return this.commands.get(e);
@@ -442,66 +442,66 @@ class lt {
442
442
  return Array.from(this.commands.values());
443
443
  }
444
444
  }
445
- const J = new lt(), Se = (n) => n.map((e) => {
446
- var o;
445
+ const te = new It(), _e = (t) => t.map((e) => {
446
+ var n;
447
447
  return {
448
448
  ...e,
449
- keybinding: e.keybinding ?? (e.commandId ? (o = J.getCommand(e.commandId)) == null ? void 0 : o.keybinding : void 0),
450
- submenu: e.submenu ? Se(e.submenu) : void 0
449
+ keybinding: e.keybinding ?? (e.commandId ? (n = te.getCommand(e.commandId)) == null ? void 0 : n.keybinding : void 0),
450
+ submenu: e.submenu ? _e(e.submenu) : void 0
451
451
  };
452
- }), Te = (n, e) => {
453
- for (const o of n) {
454
- if (o.id === e) return o;
455
- const t = o.submenu && Te(o.submenu, e);
456
- if (t) return t;
452
+ }), Ue = (t, e) => {
453
+ for (const n of t) {
454
+ if (n.id === e) return n;
455
+ const r = n.submenu && Ue(n.submenu, e);
456
+ if (r) return r;
457
457
  }
458
- }, it = (n) => {
459
- const e = le.getAllMenus(), o = Object.fromEntries(
460
- Object.entries(e).map(([a, s]) => [a, Se(s)])
458
+ }, Lt = (t) => {
459
+ const e = ve.getAllMenus(), n = Object.fromEntries(
460
+ Object.entries(e).map(([a, s]) => [a, _e(s)])
461
461
  );
462
- return /* @__PURE__ */ r(st, { ...n, menus: o, onSelect: (a) => {
462
+ return /* @__PURE__ */ o(Dt, { ...t, menus: n, onSelect: (a) => {
463
463
  for (const s of Object.values(e)) {
464
- const l = Te(s, a.id);
465
- if (l != null && l.commandId) {
466
- J.executeCommand(l.commandId);
464
+ const i = Ue(s, a.id);
465
+ if (i != null && i.commandId) {
466
+ te.executeCommand(i.commandId);
467
467
  return;
468
468
  }
469
469
  }
470
470
  } });
471
- }, ne = ({
472
- title: n,
471
+ }, me = ({
472
+ title: t,
473
473
  children: e,
474
- onClose: o,
475
- width: t = "300px",
474
+ onClose: n,
475
+ width: r = "300px",
476
476
  className: a
477
- }) => /* @__PURE__ */ c(
477
+ }) => /* @__PURE__ */ p(
478
478
  "aside",
479
479
  {
480
480
  role: "tabpanel",
481
- "aria-label": `${n} Panel`,
482
- style: { width: t },
483
- className: S(
481
+ "aria-label": `${t} Panel`,
482
+ style: { width: r },
483
+ className: L(
484
484
  "h-full bg-muted border-r flex flex-col select-none shrink-0",
485
485
  a
486
486
  ),
487
487
  children: [
488
- /* @__PURE__ */ c("div", { className: "h-10 flex items-center justify-between px-4 text-[11px] font-bold text-muted-foreground uppercase tracking-widest", children: [
489
- /* @__PURE__ */ r("span", { className: "truncate", children: n }),
490
- o && /* @__PURE__ */ r(
488
+ /* @__PURE__ */ p("div", { className: "h-10 flex items-center justify-between px-4 text-[11px] font-bold text-muted-foreground uppercase tracking-widest", children: [
489
+ /* @__PURE__ */ o("span", { className: "truncate", children: t }),
490
+ n && /* @__PURE__ */ o(
491
491
  "button",
492
492
  {
493
493
  type: "button",
494
- onClick: o,
494
+ onClick: n,
495
495
  "aria-label": "Close Panel",
496
496
  className: "p-1 hover:bg-accent hover:text-foreground rounded transition-colors focus:outline-none focus:ring-2 focus:ring-ring shrink-0",
497
- children: /* @__PURE__ */ r(B, { size: 14 })
497
+ children: /* @__PURE__ */ o(V, { size: 14 })
498
498
  }
499
499
  )
500
500
  ] }),
501
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-auto border-t border-border/50 bg-background/50", children: e })
501
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-auto border-t border-border/50 bg-background/50", children: e })
502
502
  ]
503
503
  }
504
- ), X = [
504
+ ), ie = [
505
505
  {
506
506
  id: "light",
507
507
  label: "Light",
@@ -526,232 +526,232 @@ const J = new lt(), Se = (n) => n.map((e) => {
526
526
  shortLabel: "TAMU",
527
527
  description: "Aggie Maroon (#500000) on white."
528
528
  }
529
- ], dt = X.map((n) => `theme-${n.id}`), ct = (n) => `theme-${n}`, ut = {
530
- light: Re,
531
- dark: $e,
532
- gt: ue,
533
- tamu: ue
534
- }, mt = X.map((n) => ({
535
- id: n.id,
536
- label: n.label,
537
- icon: ut[n.id] ?? Ke
538
- })), ft = ({
539
- theme: n,
529
+ ], Mt = ie.map((t) => `theme-${t.id}`), At = (t) => `theme-${t}`, $t = {
530
+ light: st,
531
+ dark: ot,
532
+ gt: ke,
533
+ tamu: ke
534
+ }, Ot = ie.map((t) => ({
535
+ id: t.id,
536
+ label: t.label,
537
+ icon: $t[t.id] ?? at
538
+ })), Rt = ({
539
+ theme: t,
540
540
  onThemeChange: e,
541
- themes: o = mt,
542
- className: t
543
- }) => /* @__PURE__ */ r("div", { className: S("p-4 space-y-6", t), children: /* @__PURE__ */ c("section", { children: [
544
- /* @__PURE__ */ r("h3", { className: "text-[11px] font-bold text-muted-foreground uppercase mb-3", children: "Theme" }),
545
- /* @__PURE__ */ r(
541
+ themes: n = Ot,
542
+ className: r
543
+ }) => /* @__PURE__ */ o("div", { className: L("p-4 space-y-6", r), children: /* @__PURE__ */ p("section", { children: [
544
+ /* @__PURE__ */ o("h3", { className: "text-[11px] font-bold text-muted-foreground uppercase mb-3", children: "Theme" }),
545
+ /* @__PURE__ */ o(
546
546
  "div",
547
547
  {
548
548
  role: "radiogroup",
549
549
  "aria-label": "Theme",
550
550
  className: "grid grid-cols-1 gap-2",
551
- children: o.map(({ id: a, label: s, icon: l }) => /* @__PURE__ */ c(
551
+ children: n.map(({ id: a, label: s, icon: i }) => /* @__PURE__ */ p(
552
552
  "button",
553
553
  {
554
554
  type: "button",
555
555
  role: "radio",
556
- "aria-checked": n === a,
556
+ "aria-checked": t === a,
557
557
  onClick: () => e(a),
558
- className: S(
558
+ className: L(
559
559
  "flex items-center space-x-3 px-3 py-2 rounded-md border text-sm transition-all focus:outline-none focus:ring-2 focus:ring-ring",
560
- n === a ? "bg-primary text-primary-foreground border-primary" : "bg-background hover:bg-accent border-border"
560
+ t === a ? "bg-primary text-primary-foreground border-primary" : "bg-background hover:bg-accent border-border"
561
561
  ),
562
562
  children: [
563
- /* @__PURE__ */ r(l, { size: 16 }),
564
- /* @__PURE__ */ r("span", { children: s })
563
+ /* @__PURE__ */ o(i, { size: 16 }),
564
+ /* @__PURE__ */ o("span", { children: s })
565
565
  ]
566
566
  },
567
567
  a
568
568
  ))
569
569
  }
570
570
  )
571
- ] }) }), me = "nexus-shell-theme", fe = (n) => {
572
- const e = window.document.documentElement, o = [
573
- ...dt,
574
- ...Array.from(e.classList).filter((t) => t.startsWith("theme-"))
571
+ ] }) }), Ee = "nexus-shell-theme", Te = (t) => {
572
+ const e = window.document.documentElement, n = [
573
+ ...Mt,
574
+ ...Array.from(e.classList).filter((r) => r.startsWith("theme-"))
575
575
  ];
576
- e.classList.remove(...o), e.classList.add(ct(n));
577
- }, Y = F((n) => {
578
- const o = localStorage.getItem(me) || "light";
579
- return fe(o), {
580
- theme: o,
581
- setTheme: (t) => {
582
- localStorage.setItem(me, t), fe(t), n({ theme: t });
576
+ e.classList.remove(...n), e.classList.add(At(t));
577
+ }, oe = J((t) => {
578
+ const n = localStorage.getItem(Ee) || "light";
579
+ return Te(n), {
580
+ theme: n,
581
+ setTheme: (r) => {
582
+ localStorage.setItem(Ee, r), Te(r), t({ theme: r });
583
583
  }
584
584
  };
585
- }), pt = (n) => {
586
- const e = U((d) => d.activeSidebar), o = U((d) => d.panels), t = U((d) => d.setActiveSidebar), a = Y((d) => d.theme), s = Y((d) => d.setTheme);
585
+ }), Pt = (t) => {
586
+ const e = G((c) => c.activeSidebar), n = G((c) => c.panels), r = G((c) => c.setActiveSidebar), a = oe((c) => c.theme), s = oe((c) => c.setTheme);
587
587
  if (!e) return null;
588
- const l = () => t(null);
588
+ const i = () => r(null);
589
589
  if (e === "settings")
590
- return /* @__PURE__ */ r(ne, { ...n, title: "Settings", onClose: l, children: /* @__PURE__ */ r(
591
- ft,
590
+ return /* @__PURE__ */ o(me, { ...t, title: "Settings", onClose: i, children: /* @__PURE__ */ o(
591
+ Rt,
592
592
  {
593
593
  theme: a,
594
- onThemeChange: (d) => s(d)
594
+ onThemeChange: (c) => s(c)
595
595
  }
596
596
  ) });
597
- const u = o.find((d) => d.id === e);
598
- if (!u)
599
- return /* @__PURE__ */ r(ne, { ...n, title: e, onClose: l, children: /* @__PURE__ */ r("div", { className: "p-4 text-sm italic text-muted-foreground", children: "Panel content not found." }) });
600
- const i = typeof u.component == "function" ? u.component : null;
601
- return /* @__PURE__ */ r(ne, { ...n, title: u.label, onClose: l, children: i ? /* @__PURE__ */ r(i, {}) : u.component });
602
- }, oe = (n, e) => (e.priority ?? 0) - (n.priority ?? 0), gt = ({
603
- widgets: n = [],
597
+ const d = n.find((c) => c.id === e);
598
+ if (!d)
599
+ return /* @__PURE__ */ o(me, { ...t, title: e, onClose: i, children: /* @__PURE__ */ o("div", { className: "p-4 text-sm italic text-muted-foreground", children: "Panel content not found." }) });
600
+ const l = typeof d.component == "function" ? d.component : null;
601
+ return /* @__PURE__ */ o(me, { ...t, title: d.label, onClose: i, children: l ? /* @__PURE__ */ o(l, {}) : d.component });
602
+ }, pe = (t, e) => (e.priority ?? 0) - (t.priority ?? 0), zt = ({
603
+ widgets: t = [],
604
604
  className: e,
605
- "aria-label": o = "Status Bar"
605
+ "aria-label": n = "Status Bar"
606
606
  }) => {
607
- const t = {
608
- left: n.filter((s) => s.alignment === "left").sort(oe),
609
- center: n.filter((s) => s.alignment === "center").sort(oe),
610
- right: n.filter((s) => s.alignment === "right").sort(oe)
607
+ const r = {
608
+ left: t.filter((s) => s.alignment === "left").sort(pe),
609
+ center: t.filter((s) => s.alignment === "center").sort(pe),
610
+ right: t.filter((s) => s.alignment === "right").sort(pe)
611
611
  }, a = (s) => {
612
- const l = s.icon, u = !!s.onClick;
613
- return /* @__PURE__ */ c(
612
+ const i = s.icon, d = !!s.onClick;
613
+ return /* @__PURE__ */ p(
614
614
  "div",
615
615
  {
616
616
  onClick: s.onClick,
617
- onKeyDown: u ? (i) => {
618
- var d;
619
- (i.key === "Enter" || i.key === " ") && (i.preventDefault(), (d = s.onClick) == null || d.call(s));
617
+ onKeyDown: d ? (l) => {
618
+ var c;
619
+ (l.key === "Enter" || l.key === " ") && (l.preventDefault(), (c = s.onClick) == null || c.call(s));
620
620
  } : void 0,
621
- role: u ? "button" : void 0,
622
- tabIndex: u ? 0 : void 0,
623
- className: S(
621
+ role: d ? "button" : void 0,
622
+ tabIndex: d ? 0 : void 0,
623
+ className: L(
624
624
  "flex items-center space-x-1.5 px-2 py-0.5 rounded transition-colors h-full focus:outline-none",
625
- u ? "cursor-pointer hover:bg-white/10 focus:ring-1 focus:ring-white" : "cursor-default",
625
+ d ? "cursor-pointer hover:bg-white/10 focus:ring-1 focus:ring-white" : "cursor-default",
626
626
  s.className
627
627
  ),
628
628
  children: [
629
- l && /* @__PURE__ */ r(l, { size: 12 }),
630
- s.label && /* @__PURE__ */ r("span", { children: s.label })
629
+ i && /* @__PURE__ */ o(i, { size: 12 }),
630
+ s.label && /* @__PURE__ */ o("span", { children: s.label })
631
631
  ]
632
632
  },
633
633
  s.id
634
634
  );
635
635
  };
636
- return /* @__PURE__ */ c(
636
+ return /* @__PURE__ */ p(
637
637
  "footer",
638
638
  {
639
639
  role: "status",
640
- "aria-label": o,
641
- className: S(
640
+ "aria-label": n,
641
+ className: L(
642
642
  "h-6 bg-primary text-primary-foreground text-[11px] flex items-center justify-between px-1 select-none shrink-0 border-t border-white/5",
643
643
  e
644
644
  ),
645
645
  children: [
646
- /* @__PURE__ */ r("div", { className: "flex items-center space-x-1 h-full", children: t.left.map(a) }),
647
- /* @__PURE__ */ r("div", { className: "flex items-center space-x-1 h-full", children: t.center.map(a) }),
648
- /* @__PURE__ */ r("div", { className: "flex items-center space-x-1 h-full", children: t.right.map(a) })
646
+ /* @__PURE__ */ o("div", { className: "flex items-center space-x-1 h-full", children: r.left.map(a) }),
647
+ /* @__PURE__ */ o("div", { className: "flex items-center space-x-1 h-full", children: r.center.map(a) }),
648
+ /* @__PURE__ */ o("div", { className: "flex items-center space-x-1 h-full", children: r.right.map(a) })
649
649
  ]
650
650
  }
651
651
  );
652
- }, ie = F((n) => ({
652
+ }, we = J((t) => ({
653
653
  widgets: [],
654
- setWidgets: (e) => n({ widgets: e }),
655
- addWidget: (e) => n((o) => ({
656
- widgets: [...o.widgets, e].sort(
657
- (t, a) => (a.priority || 0) - (t.priority || 0)
654
+ setWidgets: (e) => t({ widgets: e }),
655
+ addWidget: (e) => t((n) => ({
656
+ widgets: [...n.widgets, e].sort(
657
+ (r, a) => (a.priority || 0) - (r.priority || 0)
658
658
  )
659
659
  })),
660
- removeWidget: (e) => n((o) => ({
661
- widgets: o.widgets.filter((t) => t.id !== e)
660
+ removeWidget: (e) => t((n) => ({
661
+ widgets: n.widgets.filter((r) => r.id !== e)
662
662
  })),
663
- updateWidget: (e, o) => n((t) => ({
664
- widgets: t.widgets.map((a) => a.id === e ? { ...a, ...o } : a)
663
+ updateWidget: (e, n) => t((r) => ({
664
+ widgets: r.widgets.map((a) => a.id === e ? { ...a, ...n } : a)
665
665
  }))
666
- })), ht = (n) => {
667
- const e = ie((t) => t.widgets), o = j(
668
- () => e.map(({ commandId: t, ...a }) => ({
666
+ })), Kt = (t) => {
667
+ const e = we((r) => r.widgets), n = B(
668
+ () => e.map(({ commandId: r, ...a }) => ({
669
669
  ...a,
670
- onClick: a.onClick ?? (t ? () => J.executeCommand(t) : void 0)
670
+ onClick: a.onClick ?? (r ? () => te.executeCommand(r) : void 0)
671
671
  })),
672
672
  [e]
673
673
  );
674
- return /* @__PURE__ */ r(gt, { ...n, widgets: o });
675
- }, bt = ({
676
- history: n = [],
674
+ return /* @__PURE__ */ o(zt, { ...t, widgets: n });
675
+ }, Ft = ({
676
+ history: t = [],
677
677
  onCommand: e,
678
- onClose: o,
679
- height: t = "250px",
678
+ onClose: n,
679
+ height: r = "250px",
680
680
  prompt: a = "$",
681
681
  title: s = "Terminal",
682
- className: l
682
+ className: i
683
683
  }) => {
684
- const [u, i] = A(""), d = z(null), m = z(null);
684
+ const [d, l] = R(""), c = F(null), y = F(null);
685
685
  O(() => {
686
- d.current && (d.current.scrollTop = d.current.scrollHeight);
687
- }, [n]);
688
- const f = (p) => {
689
- if (p.key !== "Enter") return;
690
- const N = u.trim();
691
- N && (e == null || e(N), i(""));
686
+ c.current && (c.current.scrollTop = c.current.scrollHeight);
687
+ }, [t]);
688
+ const x = (h) => {
689
+ if (h.key !== "Enter") return;
690
+ const T = d.trim();
691
+ T && (e == null || e(T), l(""));
692
692
  };
693
- return /* @__PURE__ */ c(
693
+ return /* @__PURE__ */ p(
694
694
  "div",
695
695
  {
696
- style: { height: t },
697
- className: S(
696
+ style: { height: r },
697
+ className: L(
698
698
  "bg-card border-t border-border flex flex-col shrink-0 font-mono text-xs",
699
- l
699
+ i
700
700
  ),
701
701
  children: [
702
- /* @__PURE__ */ c("div", { className: "h-8 flex items-center justify-between px-3 border-b border-border/50 shrink-0", children: [
703
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
704
- /* @__PURE__ */ r(ye, { size: 13 }),
705
- /* @__PURE__ */ r("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
702
+ /* @__PURE__ */ p("div", { className: "h-8 flex items-center justify-between px-3 border-b border-border/50 shrink-0", children: [
703
+ /* @__PURE__ */ p("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
704
+ /* @__PURE__ */ o(Re, { size: 13 }),
705
+ /* @__PURE__ */ o("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
706
706
  ] }),
707
- o && /* @__PURE__ */ c("div", { className: "flex items-center space-x-1", children: [
708
- /* @__PURE__ */ r(
707
+ n && /* @__PURE__ */ p("div", { className: "flex items-center space-x-1", children: [
708
+ /* @__PURE__ */ o(
709
709
  "button",
710
710
  {
711
711
  type: "button",
712
- onClick: o,
712
+ onClick: n,
713
713
  "aria-label": "Collapse Terminal",
714
714
  className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
715
- children: /* @__PURE__ */ r(Ne, { size: 14 })
715
+ children: /* @__PURE__ */ o(ze, { size: 14 })
716
716
  }
717
717
  ),
718
- /* @__PURE__ */ r(
718
+ /* @__PURE__ */ o(
719
719
  "button",
720
720
  {
721
721
  type: "button",
722
- onClick: o,
722
+ onClick: n,
723
723
  "aria-label": "Close Terminal",
724
724
  className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
725
- children: /* @__PURE__ */ r(B, { size: 14 })
725
+ children: /* @__PURE__ */ o(V, { size: 14 })
726
726
  }
727
727
  )
728
728
  ] })
729
729
  ] }),
730
- /* @__PURE__ */ r(
730
+ /* @__PURE__ */ o(
731
731
  "div",
732
732
  {
733
- ref: d,
733
+ ref: c,
734
734
  role: "log",
735
735
  "aria-label": `${s} output`,
736
736
  className: "flex-1 overflow-y-auto px-3 py-2 space-y-0.5",
737
737
  onClick: () => {
738
- var p;
739
- return (p = m.current) == null ? void 0 : p.focus();
738
+ var h;
739
+ return (h = y.current) == null ? void 0 : h.focus();
740
740
  },
741
- children: n.map((p, N) => /* @__PURE__ */ r("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: p }, N))
741
+ children: t.map((h, T) => /* @__PURE__ */ o("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: h }, T))
742
742
  }
743
743
  ),
744
- /* @__PURE__ */ c("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
745
- /* @__PURE__ */ r("span", { className: "text-primary mr-2 select-none", children: a }),
746
- /* @__PURE__ */ r(
744
+ /* @__PURE__ */ p("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
745
+ /* @__PURE__ */ o("span", { className: "text-primary mr-2 select-none", children: a }),
746
+ /* @__PURE__ */ o(
747
747
  "input",
748
748
  {
749
- ref: m,
749
+ ref: y,
750
750
  type: "text",
751
751
  "aria-label": `${s} input`,
752
- value: u,
753
- onChange: (p) => i(p.target.value),
754
- onKeyDown: f,
752
+ value: d,
753
+ onChange: (h) => l(h.target.value),
754
+ onKeyDown: x,
755
755
  spellCheck: !1,
756
756
  autoComplete: "off",
757
757
  className: "flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground"
@@ -761,54 +761,54 @@ const J = new lt(), Se = (n) => n.map((e) => {
761
761
  ]
762
762
  }
763
763
  );
764
- }, V = F((n) => ({
764
+ }, ne = J((t) => ({
765
765
  isOpen: !1,
766
766
  history: ["Welcome to Nexus Shell Terminal v0.1.0", 'Type "help" for a list of commands.'],
767
- setOpen: (e) => n({ isOpen: e }),
768
- toggle: () => n((e) => ({ isOpen: !e.isOpen })),
769
- addHistory: (e) => n((o) => ({ history: [...o.history, e] })),
770
- clearHistory: () => n({ history: [] })
771
- })), xt = [
767
+ setOpen: (e) => t({ isOpen: e }),
768
+ toggle: () => t((e) => ({ isOpen: !e.isOpen })),
769
+ addHistory: (e) => t((n) => ({ history: [...n.history, e] })),
770
+ clearHistory: () => t({ history: [] })
771
+ })), _t = [
772
772
  "Available commands:",
773
773
  " help — show this message",
774
774
  " clear — clear the terminal"
775
- ], vt = ({
776
- onCommand: n,
775
+ ], Ut = ({
776
+ onCommand: t,
777
777
  ...e
778
778
  }) => {
779
- const o = V((i) => i.isOpen), t = V((i) => i.history), a = V((i) => i.setOpen), s = V((i) => i.addHistory), l = V((i) => i.clearHistory);
780
- return o ? /* @__PURE__ */ r(
781
- bt,
779
+ const n = ne((l) => l.isOpen), r = ne((l) => l.history), a = ne((l) => l.setOpen), s = ne((l) => l.addHistory), i = ne((l) => l.clearHistory);
780
+ return n ? /* @__PURE__ */ o(
781
+ Ft,
782
782
  {
783
783
  ...e,
784
- history: t,
785
- onCommand: (i) => {
786
- s(`$ ${i}`);
787
- const d = i.toLowerCase();
788
- if (d === "clear") {
789
- l();
784
+ history: r,
785
+ onCommand: (l) => {
786
+ s(`$ ${l}`);
787
+ const c = l.toLowerCase();
788
+ if (c === "clear") {
789
+ i();
790
790
  return;
791
791
  }
792
- if (d === "help") {
793
- xt.forEach(s);
792
+ if (c === "help") {
793
+ _t.forEach(s);
794
794
  return;
795
795
  }
796
- (n == null ? void 0 : n(i)) !== !0 && s(`command not found: ${i.split(" ")[0]}`);
796
+ (t == null ? void 0 : t(l)) !== !0 && s(`command not found: ${l.split(" ")[0]}`);
797
797
  },
798
798
  onClose: () => a(!1)
799
799
  }
800
800
  ) : null;
801
801
  };
802
- class yt {
802
+ class jt {
803
803
  constructor() {
804
- H(this, "components", /* @__PURE__ */ new Map());
804
+ Q(this, "components", /* @__PURE__ */ new Map());
805
805
  }
806
806
  /**
807
807
  * Register a component with a unique ID.
808
808
  * This ID is what you use in your FlexLayout models.
809
809
  */
810
- register(e, o) {
811
- this.components.has(e) && console.warn(`Component with ID "${e}" is already registered.`), this.components.set(e, o);
810
+ register(e, n) {
811
+ this.components.has(e) && console.warn(`Component with ID "${e}" is already registered.`), this.components.set(e, n);
812
812
  }
813
813
  /**
814
814
  * Retrieve a registered component by its ID.
@@ -823,7 +823,7 @@ class yt {
823
823
  return Array.from(this.components.keys());
824
824
  }
825
825
  }
826
- const wt = new yt(), _ = {
826
+ const Bt = new jt(), X = {
827
827
  global: { tabEnableClose: !0, tabSetEnableMaximize: !1, tabSetEnableDivide: !0 },
828
828
  borders: [
829
829
  {
@@ -849,273 +849,273 @@ const wt = new yt(), _ = {
849
849
  }
850
850
  ]
851
851
  }
852
- }, pe = "nexus-shell-layout", Nt = F((n, e) => {
853
- let o;
852
+ }, Ce = "nexus-shell-layout", Ht = J((t, e) => {
853
+ let n;
854
854
  if (typeof window < "u")
855
855
  try {
856
- const t = localStorage.getItem(pe);
857
- if (t) {
858
- const a = JSON.parse(t);
859
- o = R.fromJson(a);
860
- const s = /* @__PURE__ */ new Set(["dialogue-library", "argument-inspector"]), l = [];
861
- o.visitNodes((u) => {
862
- if (u.getType() === "tab") {
863
- const i = u;
864
- s.has(i.getComponent()) && l.push(i.getId());
856
+ const r = localStorage.getItem(Ce);
857
+ if (r) {
858
+ const a = JSON.parse(r);
859
+ n = W.fromJson(a);
860
+ const s = /* @__PURE__ */ new Set(["dialogue-library", "argument-inspector"]), i = [];
861
+ n.visitNodes((d) => {
862
+ if (d.getType() === "tab") {
863
+ const l = d;
864
+ s.has(l.getComponent()) && i.push(l.getId());
865
865
  }
866
- }), l.forEach((u) => {
867
- o.doAction(G.deleteTab(u));
866
+ }), i.forEach((d) => {
867
+ n.doAction(re.deleteTab(d));
868
868
  });
869
869
  } else
870
- o = R.fromJson(_);
871
- } catch (t) {
872
- console.warn("Failed to load layout from storage, using default", t), o = R.fromJson(_);
870
+ n = W.fromJson(X);
871
+ } catch (r) {
872
+ console.warn("Failed to load layout from storage, using default", r), n = W.fromJson(X);
873
873
  }
874
874
  else
875
- o = R.fromJson(_);
875
+ n = W.fromJson(X);
876
876
  return {
877
- model: o,
877
+ model: n,
878
878
  dirtyTabs: /* @__PURE__ */ new Set(),
879
- storageKey: pe,
879
+ storageKey: Ce,
880
880
  disableLocalStorage: !1,
881
- initLayout: (t, a) => {
881
+ initLayout: (r, a) => {
882
882
  let s;
883
- if (t && Object.keys(t).length > 0)
883
+ if (r && Object.keys(r).length > 0)
884
884
  try {
885
- s = R.fromJson(t);
886
- } catch (l) {
887
- console.warn("Failed to parse init layout json, using default", l), s = R.fromJson(_);
885
+ s = W.fromJson(r);
886
+ } catch (i) {
887
+ console.warn("Failed to parse init layout json, using default", i), s = W.fromJson(X);
888
888
  }
889
889
  else
890
- s = R.fromJson(_);
891
- n({ model: s, disableLocalStorage: a || !1 });
890
+ s = W.fromJson(X);
891
+ t({ model: s, disableLocalStorage: a || !1 });
892
892
  },
893
- setModel: (t) => {
894
- n({ model: t });
893
+ setModel: (r) => {
894
+ t({ model: r });
895
895
  const a = e().storageKey;
896
896
  if (typeof window < "u" && !e().disableLocalStorage)
897
897
  try {
898
- localStorage.setItem(a, JSON.stringify(t.toJson()));
898
+ localStorage.setItem(a, JSON.stringify(r.toJson()));
899
899
  } catch (s) {
900
900
  console.error("Failed to save layout to storage", s);
901
901
  }
902
902
  },
903
- setStorageKey: (t, a) => {
903
+ setStorageKey: (r, a) => {
904
904
  let s;
905
905
  if (typeof window < "u")
906
906
  try {
907
- const l = localStorage.getItem(t);
908
- l ? s = R.fromJson(JSON.parse(l)) : s = R.fromJson(a || _);
909
- } catch (l) {
910
- console.warn("Failed to load layout from storage for key", t, l), s = R.fromJson(a || _);
907
+ const i = localStorage.getItem(r);
908
+ i ? s = W.fromJson(JSON.parse(i)) : s = W.fromJson(a || X);
909
+ } catch (i) {
910
+ console.warn("Failed to load layout from storage for key", r, i), s = W.fromJson(a || X);
911
911
  }
912
912
  else
913
- s = R.fromJson(a || _);
914
- n({ storageKey: t, model: s });
913
+ s = W.fromJson(a || X);
914
+ t({ storageKey: r, model: s });
915
915
  },
916
- setTabDirty: (t, a) => {
917
- n((s) => {
918
- const l = new Set(s.dirtyTabs);
919
- return a ? l.add(t) : l.delete(t), { dirtyTabs: l };
916
+ setTabDirty: (r, a) => {
917
+ t((s) => {
918
+ const i = new Set(s.dirtyTabs);
919
+ return a ? i.add(r) : i.delete(r), { dirtyTabs: i };
920
920
  });
921
921
  },
922
- isTabDirty: (t) => e().dirtyTabs.has(t),
923
- addTab: (t, a, s) => {
924
- const l = e().model, u = l.getActiveTabset();
925
- let i = u == null ? void 0 : u.getId();
926
- if (!i)
922
+ isTabDirty: (r) => e().dirtyTabs.has(r),
923
+ addTab: (r, a, s) => {
924
+ const i = e().model, d = i.getActiveTabset();
925
+ let l = d == null ? void 0 : d.getId();
926
+ if (!l)
927
927
  try {
928
- const f = l.getFirstTabSet();
929
- i = f == null ? void 0 : f.getId();
930
- } catch (f) {
931
- console.warn("Failed to get first tabset fallback", f);
928
+ const x = i.getFirstTabSet();
929
+ l = x == null ? void 0 : x.getId();
930
+ } catch (x) {
931
+ console.warn("Failed to get first tabset fallback", x);
932
932
  }
933
- const m = { ...{}, ...s };
934
- if (["nexus-dashboard", "nexus-docs"].includes(t)) {
935
- let f = null;
936
- if (l.visitNodes((p) => {
937
- if (p.getType() === "tab") {
938
- const N = p;
939
- N.getComponent() === t && (f = N.getId());
933
+ const y = { ...{}, ...s };
934
+ if (["nexus-dashboard", "nexus-docs"].includes(r)) {
935
+ let x = null;
936
+ if (i.visitNodes((h) => {
937
+ if (h.getType() === "tab") {
938
+ const T = h;
939
+ T.getComponent() === r && (x = T.getId());
940
940
  }
941
- }), f) {
942
- l.doAction(G.selectTab(f));
941
+ }), x) {
942
+ i.doAction(re.selectTab(x));
943
943
  return;
944
944
  }
945
945
  }
946
- if (m.mapId) {
947
- let f = null;
948
- if (l.visitNodes((p) => {
949
- var N;
950
- if (p.getType() === "tab") {
951
- const k = p;
952
- ((N = k.getConfig()) == null ? void 0 : N.mapId) === m.mapId && (f = k.getId());
946
+ if (y.mapId) {
947
+ let x = null;
948
+ if (i.visitNodes((h) => {
949
+ var T;
950
+ if (h.getType() === "tab") {
951
+ const E = h;
952
+ ((T = E.getConfig()) == null ? void 0 : T.mapId) === y.mapId && (x = E.getId());
953
953
  }
954
- }), f) {
955
- l.doAction(G.selectTab(f));
954
+ }), x) {
955
+ i.doAction(re.selectTab(x));
956
956
  return;
957
957
  }
958
958
  }
959
- if (m.projectId) {
960
- let f = null;
961
- if (l.visitNodes((p) => {
962
- var N;
963
- if (p.getType() === "tab") {
964
- const k = p;
965
- ((N = k.getConfig()) == null ? void 0 : N.projectId) === m.projectId && (f = k.getId());
959
+ if (y.projectId) {
960
+ let x = null;
961
+ if (i.visitNodes((h) => {
962
+ var T;
963
+ if (h.getType() === "tab") {
964
+ const E = h;
965
+ ((T = E.getConfig()) == null ? void 0 : T.projectId) === y.projectId && (x = E.getId());
966
966
  }
967
- }), f) {
968
- l.doAction(G.selectTab(f));
967
+ }), x) {
968
+ i.doAction(re.selectTab(x));
969
969
  return;
970
970
  }
971
971
  }
972
- i && l.doAction(
973
- G.addNode(
974
- { type: "tab", component: t, name: a || t, config: m },
975
- i,
976
- Le.CENTER,
972
+ l && i.doAction(
973
+ re.addNode(
974
+ { type: "tab", component: r, name: a || r, config: y },
975
+ l,
976
+ et.CENTER,
977
977
  -1
978
978
  )
979
979
  );
980
980
  }
981
981
  };
982
- }), Ee = F((n, e) => ({
982
+ }), je = J((t, e) => ({
983
983
  isOpen: !1,
984
984
  type: "alert",
985
985
  title: "",
986
986
  message: "",
987
987
  defaultValue: "",
988
988
  resolve: null,
989
- openAlert: (o, t = "Alert") => new Promise((a) => {
990
- n({ isOpen: !0, type: "alert", title: t, message: o, defaultValue: "", resolve: a });
989
+ openAlert: (n, r = "Alert") => new Promise((a) => {
990
+ t({ isOpen: !0, type: "alert", title: r, message: n, defaultValue: "", resolve: a });
991
991
  }),
992
- openConfirm: (o, t = "Confirm") => new Promise((a) => {
993
- n({ isOpen: !0, type: "confirm", title: t, message: o, defaultValue: "", resolve: a });
992
+ openConfirm: (n, r = "Confirm") => new Promise((a) => {
993
+ t({ isOpen: !0, type: "confirm", title: r, message: n, defaultValue: "", resolve: a });
994
994
  }),
995
- openPrompt: (o, t = "", a = "Prompt") => new Promise((s) => {
996
- n({ isOpen: !0, type: "prompt", title: a, message: o, defaultValue: t, resolve: s });
995
+ openPrompt: (n, r = "", a = "Prompt") => new Promise((s) => {
996
+ t({ isOpen: !0, type: "prompt", title: a, message: n, defaultValue: r, resolve: s });
997
997
  }),
998
- close: (o = null) => {
999
- const { resolve: t } = e();
1000
- t && t(o), n({ isOpen: !1, resolve: null });
998
+ close: (n = null) => {
999
+ const { resolve: r } = e();
1000
+ r && r(n), t({ isOpen: !1, resolve: null });
1001
1001
  }
1002
- })), Gt = ({
1003
- panels: n,
1002
+ })), Sr = ({
1003
+ panels: t,
1004
1004
  slashCommands: e,
1005
- menuConfig: o,
1006
- statusBarConfig: t,
1005
+ menuConfig: n,
1006
+ statusBarConfig: r,
1007
1007
  title: a,
1008
1008
  rightMenuBarContent: s,
1009
- centerMenuBarContent: l,
1010
- layoutModel: u,
1011
- initialLayoutJson: i,
1012
- disableLocalStorage: d = !1,
1013
- onLayoutChange: m
1009
+ centerMenuBarContent: i,
1010
+ layoutModel: d,
1011
+ initialLayoutJson: l,
1012
+ disableLocalStorage: c = !1,
1013
+ onLayoutChange: y
1014
1014
  }) => {
1015
- const { model: f, setModel: p, initLayout: N, isTabDirty: k, setTabDirty: w } = Nt(), h = Y((D) => D.theme), x = U((D) => D.setPanels), b = Q((D) => D.setSlashCommands), y = ie((D) => D.setWidgets);
1015
+ const { model: x, setModel: h, initLayout: T, isTabDirty: E, setTabDirty: g } = Ht(), m = oe((M) => M.theme), b = G((M) => M.setPanels), N = ae((M) => M.setSlashCommands), w = we((M) => M.setWidgets);
1016
1016
  O(() => {
1017
- n && x(n);
1018
- }, [n, x]), O(() => {
1019
- e && b(e);
1020
- }, [e, b]), O(() => {
1021
- o && le.setMenus(o);
1022
- }, [o]), O(() => {
1023
- t && y(t);
1024
- }, [t, y]), O(() => {
1025
- u || !i && !d || N(i, d);
1017
+ t && b(t);
1018
+ }, [t, b]), O(() => {
1019
+ e && N(e);
1020
+ }, [e, N]), O(() => {
1021
+ n && ve.setMenus(n);
1022
+ }, [n]), O(() => {
1023
+ r && w(r);
1024
+ }, [r, w]), O(() => {
1025
+ d || !l && !c || T(l, c);
1026
1026
  }, []);
1027
- const g = (D) => {
1027
+ const f = (M) => {
1028
1028
  try {
1029
- const L = D.getComponent(), T = D.getConfig() || {}, P = L ? wt.get(L) : void 0;
1030
- return P ? /* @__PURE__ */ r(P, { node: D, ...T }) : /* @__PURE__ */ c("div", { className: "p-4 text-sm", children: [
1029
+ const A = M.getComponent(), C = M.getConfig() || {}, S = A ? Bt.get(A) : void 0;
1030
+ return S ? /* @__PURE__ */ o(S, { node: M, ...C }) : /* @__PURE__ */ p("div", { className: "p-4 text-sm", children: [
1031
1031
  "Unknown Component: ",
1032
- L
1032
+ A
1033
1033
  ] });
1034
- } catch (L) {
1035
- return console.error("Error in component factory:", L), /* @__PURE__ */ c("div", { className: "p-8 text-destructive bg-destructive/10 border border-destructive/20 h-full flex items-center justify-center", children: [
1034
+ } catch (A) {
1035
+ return console.error("Error in component factory:", A), /* @__PURE__ */ p("div", { className: "p-8 text-destructive bg-destructive/10 border border-destructive/20 h-full flex items-center justify-center", children: [
1036
1036
  "Error rendering component: ",
1037
- L instanceof Error ? L.message : "Unknown error"
1037
+ A instanceof Error ? A.message : "Unknown error"
1038
1038
  ] });
1039
1039
  }
1040
- }, C = (D) => {
1041
- if (D.type !== G.DELETE_TAB) return D;
1042
- const L = f.getNodeById(D.data.node);
1043
- if (!L || !k(L.getId())) return D;
1044
- Ee.getState().openConfirm(
1045
- `Tab "${L.getName()}" has unsaved changes. Are you sure you want to close it?`
1046
- ).then((T) => {
1047
- T && (w(L.getId(), !1), f.doAction(D));
1040
+ }, D = (M) => {
1041
+ if (M.type !== re.DELETE_TAB) return M;
1042
+ const A = x.getNodeById(M.data.node);
1043
+ if (!A || !E(A.getId())) return M;
1044
+ je.getState().openConfirm(
1045
+ `Tab "${A.getName()}" has unsaved changes. Are you sure you want to close it?`
1046
+ ).then((C) => {
1047
+ C && (g(A.getId(), !1), x.doAction(M));
1048
1048
  });
1049
1049
  };
1050
- return /* @__PURE__ */ c(
1050
+ return /* @__PURE__ */ p(
1051
1051
  "div",
1052
1052
  {
1053
- className: `flex flex-col h-screen w-screen bg-background text-foreground overflow-hidden theme-${h}`,
1053
+ className: `flex flex-col h-screen w-screen bg-background text-foreground overflow-hidden theme-${m}`,
1054
1054
  children: [
1055
- /* @__PURE__ */ r(
1056
- it,
1055
+ /* @__PURE__ */ o(
1056
+ Lt,
1057
1057
  {
1058
1058
  title: a,
1059
- center: l,
1059
+ center: i,
1060
1060
  right: s
1061
1061
  }
1062
1062
  ),
1063
- /* @__PURE__ */ c("div", { className: "flex-1 flex overflow-hidden", children: [
1064
- /* @__PURE__ */ r(Ze, {}),
1065
- /* @__PURE__ */ r(pt, {}),
1066
- /* @__PURE__ */ c("div", { className: "flex-1 flex flex-col min-w-0 bg-card", children: [
1067
- /* @__PURE__ */ r("div", { className: "flex-1 relative h-full w-full", children: /* @__PURE__ */ r(
1068
- Me,
1063
+ /* @__PURE__ */ p("div", { className: "flex-1 flex overflow-hidden", children: [
1064
+ /* @__PURE__ */ o(wt, {}),
1065
+ /* @__PURE__ */ o(Pt, {}),
1066
+ /* @__PURE__ */ p("div", { className: "flex-1 flex flex-col min-w-0 bg-card", children: [
1067
+ /* @__PURE__ */ o("div", { className: "flex-1 relative h-full w-full", children: /* @__PURE__ */ o(
1068
+ tt,
1069
1069
  {
1070
- model: u || f,
1071
- factory: g,
1072
- onModelChange: (D) => {
1073
- u || p(D), m == null || m(D.toJson());
1070
+ model: d || x,
1071
+ factory: f,
1072
+ onModelChange: (M) => {
1073
+ d || h(M), y == null || y(M.toJson());
1074
1074
  },
1075
- onAction: C
1075
+ onAction: D
1076
1076
  }
1077
1077
  ) }),
1078
- /* @__PURE__ */ r(vt, {})
1078
+ /* @__PURE__ */ o(Ut, {})
1079
1079
  ] }),
1080
- /* @__PURE__ */ r(ot, {})
1080
+ /* @__PURE__ */ o(Ct, {})
1081
1081
  ] }),
1082
- /* @__PURE__ */ r(ht, {})
1082
+ /* @__PURE__ */ o(Kt, {})
1083
1083
  ]
1084
1084
  }
1085
1085
  );
1086
- }, De = X.map((n) => ({
1087
- id: `theme.${n.id}`,
1088
- label: `Preferences: ${n.label} Theme`,
1089
- execute: () => Y.getState().setTheme(n.id)
1090
- })), Vt = [
1086
+ }, Be = ie.map((t) => ({
1087
+ id: `theme.${t.id}`,
1088
+ label: `Preferences: ${t.label} Theme`,
1089
+ execute: () => oe.getState().setTheme(t.id)
1090
+ })), Ir = [
1091
1091
  "view.toggleTerminal",
1092
1092
  "view.toggleChat",
1093
1093
  "view.toggleSidebar",
1094
- ...De.map((n) => n.id)
1095
- ], kt = [
1094
+ ...Be.map((t) => t.id)
1095
+ ], Wt = [
1096
1096
  {
1097
1097
  id: "view.toggleTerminal",
1098
1098
  label: "View: Toggle Terminal",
1099
1099
  keybinding: "Control+`",
1100
- execute: () => V.getState().toggle()
1100
+ execute: () => ne.getState().toggle()
1101
1101
  },
1102
1102
  {
1103
1103
  id: "view.toggleChat",
1104
1104
  label: "View: Toggle Chat",
1105
- execute: () => ae.getState().toggleChat()
1105
+ execute: () => xe.getState().toggleChat()
1106
1106
  },
1107
1107
  {
1108
1108
  id: "view.toggleSidebar",
1109
1109
  label: "View: Toggle Sidebar",
1110
1110
  keybinding: "Control+b",
1111
1111
  execute: () => {
1112
- var t;
1113
- const { activeSidebar: n, panels: e, setActiveSidebar: o } = U.getState();
1114
- o(n ? null : ((t = e[0]) == null ? void 0 : t.id) ?? null);
1112
+ var r;
1113
+ const { activeSidebar: t, panels: e, setActiveSidebar: n } = G.getState();
1114
+ n(t ? null : ((r = e[0]) == null ? void 0 : r.id) ?? null);
1115
1115
  }
1116
1116
  },
1117
- ...De
1118
- ], Ct = {
1117
+ ...Be
1118
+ ], Gt = {
1119
1119
  View: [
1120
1120
  { id: "view.terminal", label: "Toggle Terminal", commandId: "view.toggleTerminal" },
1121
1121
  { id: "view.chat", label: "Toggle Chat", commandId: "view.toggleChat" },
@@ -1123,35 +1123,35 @@ const wt = new yt(), _ = {
1123
1123
  {
1124
1124
  id: "view.theme",
1125
1125
  label: "Theme",
1126
- submenu: X.map((n) => ({
1127
- id: `view.theme.${n.id}`,
1128
- label: n.label,
1129
- commandId: `theme.${n.id}`
1126
+ submenu: ie.map((t) => ({
1127
+ id: `view.theme.${t.id}`,
1128
+ label: t.label,
1129
+ commandId: `theme.${t.id}`
1130
1130
  }))
1131
1131
  }
1132
1132
  ]
1133
- }, Yt = (n = {}) => {
1133
+ }, Lr = (t = {}) => {
1134
1134
  const {
1135
1135
  panels: e,
1136
- menus: o,
1137
- commands: t,
1136
+ menus: n,
1137
+ commands: r,
1138
1138
  statusBar: a,
1139
1139
  slashCommands: s,
1140
- defaultCommands: l = !0,
1141
- defaultMenus: u = !0
1142
- } = n;
1143
- l && kt.forEach((d) => J.registerCommand(d)), t == null || t.forEach((d) => J.registerCommand(d));
1144
- const i = {
1145
- ...l && u ? Ct : {},
1146
- ...o ?? {}
1140
+ defaultCommands: i = !0,
1141
+ defaultMenus: d = !0
1142
+ } = t;
1143
+ i && Wt.forEach((c) => te.registerCommand(c)), r == null || r.forEach((c) => te.registerCommand(c));
1144
+ const l = {
1145
+ ...i && d ? Gt : {},
1146
+ ...n ?? {}
1147
1147
  };
1148
- Object.keys(i).length > 0 && le.setMenus(i), e && U.getState().setPanels(e), a && ie.getState().setWidgets(a), s && Q.getState().setSlashCommands(s);
1148
+ Object.keys(l).length > 0 && ve.setMenus(l), e && G.getState().setPanels(e), a && we.getState().setWidgets(a), s && ae.getState().setSlashCommands(s);
1149
1149
  };
1150
- class St {
1150
+ class Yt {
1151
1151
  constructor() {
1152
- H(this, "plugins", /* @__PURE__ */ new Map());
1153
- H(this, "loaders", /* @__PURE__ */ new Map());
1154
- H(this, "statuses", /* @__PURE__ */ new Map());
1152
+ Q(this, "plugins", /* @__PURE__ */ new Map());
1153
+ Q(this, "loaders", /* @__PURE__ */ new Map());
1154
+ Q(this, "statuses", /* @__PURE__ */ new Map());
1155
1155
  }
1156
1156
  registerPlugin(e) {
1157
1157
  if (this.plugins.has(e.id)) {
@@ -1160,38 +1160,38 @@ class St {
1160
1160
  }
1161
1161
  this.plugins.set(e.id, e), this.statuses.set(e.id, "registered"), console.log(`Plugin ${e.name} (${e.id}) registered.`);
1162
1162
  }
1163
- registerLazyPlugin(e, o) {
1163
+ registerLazyPlugin(e, n) {
1164
1164
  if (this.loaders.has(e) || this.plugins.has(e)) {
1165
1165
  console.warn(`Plugin ${e} is already registered or has a loader.`);
1166
1166
  return;
1167
1167
  }
1168
- this.loaders.set(e, o), this.statuses.set(e, "inactive"), console.log(`Lazy plugin loader for ${e} registered.`);
1168
+ this.loaders.set(e, n), this.statuses.set(e, "inactive"), console.log(`Lazy plugin loader for ${e} registered.`);
1169
1169
  }
1170
1170
  async activatePlugin(e) {
1171
- let o = this.plugins.get(e);
1172
- if (!o && this.loaders.has(e))
1171
+ let n = this.plugins.get(e);
1172
+ if (!n && this.loaders.has(e))
1173
1173
  try {
1174
- o = await this.loaders.get(e)(), this.plugins.set(e, o), this.statuses.set(e, "registered"), console.log(`Lazy plugin ${e} loaded.`);
1175
- } catch (t) {
1176
- console.error(`Failed to load lazy plugin ${e}`, t), this.statuses.set(e, "failed");
1174
+ n = await this.loaders.get(e)(), this.plugins.set(e, n), this.statuses.set(e, "registered"), console.log(`Lazy plugin ${e} loaded.`);
1175
+ } catch (r) {
1176
+ console.error(`Failed to load lazy plugin ${e}`, r), this.statuses.set(e, "failed");
1177
1177
  return;
1178
1178
  }
1179
- if (o)
1179
+ if (n)
1180
1180
  try {
1181
- this.statuses.set(e, "activating"), o.activate(), this.statuses.set(e, "active"), console.log(`Plugin ${o.name} activated.`);
1182
- } catch (t) {
1183
- console.error(`Failed to activate plugin ${e}`, t), this.statuses.set(e, "failed");
1181
+ this.statuses.set(e, "activating"), n.activate(), this.statuses.set(e, "active"), console.log(`Plugin ${n.name} activated.`);
1182
+ } catch (r) {
1183
+ console.error(`Failed to activate plugin ${e}`, r), this.statuses.set(e, "failed");
1184
1184
  }
1185
1185
  else
1186
1186
  console.warn(`Plugin ${e} not found for activation.`), this.statuses.set(e, "failed");
1187
1187
  }
1188
1188
  async deactivatePlugin(e) {
1189
- const o = this.plugins.get(e);
1190
- if (o)
1189
+ const n = this.plugins.get(e);
1190
+ if (n)
1191
1191
  try {
1192
- o.deactivate(), this.statuses.set(e, "deactivated"), console.log(`Plugin ${o.name} deactivated.`);
1193
- } catch (t) {
1194
- console.error(`Failed to deactivate plugin ${e}`, t), this.statuses.set(e, "failed");
1192
+ n.deactivate(), this.statuses.set(e, "deactivated"), console.log(`Plugin ${n.name} deactivated.`);
1193
+ } catch (r) {
1194
+ console.error(`Failed to deactivate plugin ${e}`, r), this.statuses.set(e, "failed");
1195
1195
  }
1196
1196
  }
1197
1197
  getPluginStatus(e) {
@@ -1199,8 +1199,8 @@ class St {
1199
1199
  }
1200
1200
  getPluginStatuses() {
1201
1201
  const e = {};
1202
- return this.statuses.forEach((o, t) => {
1203
- e[t] = o;
1202
+ return this.statuses.forEach((n, r) => {
1203
+ e[r] = n;
1204
1204
  }), e;
1205
1205
  }
1206
1206
  getPlugin(e) {
@@ -1210,32 +1210,32 @@ class St {
1210
1210
  return Array.from(this.plugins.values());
1211
1211
  }
1212
1212
  }
1213
- const qt = new St(), ge = "nexus-shell-user-profile", he = {
1213
+ const Mr = new Yt(), De = "nexus-shell-user-profile", Se = {
1214
1214
  name: "David Tech",
1215
1215
  role: "Shell Architect",
1216
1216
  email: "david@techmuch.io",
1217
1217
  avatarUrl: "",
1218
1218
  customAvatar: ""
1219
- }, W = F((n) => {
1220
- let e = { ...he };
1219
+ }, Z = J((t) => {
1220
+ let e = { ...Se };
1221
1221
  if (typeof window < "u")
1222
1222
  try {
1223
- const t = localStorage.getItem(ge);
1224
- t && (e = { ...he, ...JSON.parse(t) });
1225
- } catch (t) {
1226
- console.error("Failed to parse saved user profile:", t);
1223
+ const r = localStorage.getItem(De);
1224
+ r && (e = { ...Se, ...JSON.parse(r) });
1225
+ } catch (r) {
1226
+ console.error("Failed to parse saved user profile:", r);
1227
1227
  }
1228
- const o = (t) => {
1228
+ const n = (r) => {
1229
1229
  if (typeof window < "u")
1230
1230
  try {
1231
1231
  localStorage.setItem(
1232
- ge,
1232
+ De,
1233
1233
  JSON.stringify({
1234
- name: t.name,
1235
- role: t.role,
1236
- email: t.email,
1237
- avatarUrl: t.avatarUrl,
1238
- customAvatar: t.customAvatar
1234
+ name: r.name,
1235
+ role: r.role,
1236
+ email: r.email,
1237
+ avatarUrl: r.avatarUrl,
1238
+ customAvatar: r.customAvatar
1239
1239
  })
1240
1240
  );
1241
1241
  } catch (a) {
@@ -1244,143 +1244,143 @@ const qt = new St(), ge = "nexus-shell-user-profile", he = {
1244
1244
  };
1245
1245
  return {
1246
1246
  ...e,
1247
- updateProfile: (t) => n((a) => {
1248
- const s = { ...a, ...t };
1249
- return o(s), t;
1247
+ updateProfile: (r) => t((a) => {
1248
+ const s = { ...a, ...r };
1249
+ return n(s), r;
1250
1250
  }),
1251
- setCustomAvatar: (t) => n((a) => {
1252
- const s = { ...a, customAvatar: t };
1253
- return o(s), { customAvatar: t };
1251
+ setCustomAvatar: (r) => t((a) => {
1252
+ const s = { ...a, customAvatar: r };
1253
+ return n(s), { customAvatar: r };
1254
1254
  }),
1255
- clearCustomAvatar: () => n((t) => {
1256
- const a = { ...t, customAvatar: "" };
1257
- return o(a), { customAvatar: "" };
1255
+ clearCustomAvatar: () => t((r) => {
1256
+ const a = { ...r, customAvatar: "" };
1257
+ return n(a), { customAvatar: "" };
1258
1258
  })
1259
1259
  };
1260
- }), Qt = () => {
1260
+ }), Ar = () => {
1261
1261
  O(() => {
1262
- const n = (e) => {
1263
- const o = J.getCommands();
1264
- for (const t of o)
1265
- if (t.keybinding && Tt(e, t.keybinding)) {
1266
- e.preventDefault(), t.execute();
1262
+ const t = (e) => {
1263
+ const n = te.getCommands();
1264
+ for (const r of n)
1265
+ if (r.keybinding && Jt(e, r.keybinding)) {
1266
+ e.preventDefault(), r.execute();
1267
1267
  break;
1268
1268
  }
1269
1269
  };
1270
- return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
1270
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1271
1271
  }, []);
1272
1272
  };
1273
- function Tt(n, e) {
1274
- var p;
1275
- const o = e.split("+"), t = (p = o.pop()) == null ? void 0 : p.toLowerCase(), a = o.includes("Control") || o.includes("Ctrl"), s = o.includes("Shift"), l = o.includes("Alt"), u = o.includes("Meta") || o.includes("Cmd"), i = n.ctrlKey, d = n.shiftKey, m = n.altKey, f = n.metaKey;
1276
- return n.key.toLowerCase() === t && i === a && d === s && m === l && f === u;
1273
+ function Jt(t, e) {
1274
+ var h;
1275
+ const n = e.split("+"), r = (h = n.pop()) == null ? void 0 : h.toLowerCase(), a = n.includes("Control") || n.includes("Ctrl"), s = n.includes("Shift"), i = n.includes("Alt"), d = n.includes("Meta") || n.includes("Cmd"), l = t.ctrlKey, c = t.shiftKey, y = t.altKey, x = t.metaKey;
1276
+ return t.key.toLowerCase() === r && l === a && c === s && y === i && x === d;
1277
1277
  }
1278
- const Et = (n, e) => {
1279
- const o = e.toLowerCase();
1280
- return n.label.toLowerCase().includes(o) || n.id.toLowerCase().includes(o);
1281
- }, Dt = ({
1282
- open: n,
1278
+ const Xt = (t, e) => {
1279
+ const n = e.toLowerCase();
1280
+ return t.label.toLowerCase().includes(n) || t.id.toLowerCase().includes(n);
1281
+ }, qt = ({
1282
+ open: t,
1283
1283
  commands: e,
1284
- onSelect: o,
1285
- onClose: t,
1284
+ onSelect: n,
1285
+ onClose: r,
1286
1286
  inline: a = !1,
1287
1287
  placeholder: s = "Type a command to run…",
1288
- filter: l = Et,
1289
- className: u
1288
+ filter: i = Xt,
1289
+ className: d
1290
1290
  }) => {
1291
- const [i, d] = A(""), [m, f] = A(0), p = z(null), N = j(
1292
- () => e.filter((w) => l(w, i)),
1293
- [e, i, l]
1291
+ const [l, c] = R(""), [y, x] = R(0), h = F(null), T = B(
1292
+ () => e.filter((g) => i(g, l)),
1293
+ [e, l, i]
1294
1294
  );
1295
1295
  if (O(() => {
1296
- var w;
1297
- n && (d(""), f(0), (w = p.current) == null || w.focus());
1298
- }, [n]), O(() => {
1299
- f(0);
1300
- }, [i]), !n) return null;
1301
- const k = (w) => {
1302
- w.key === "ArrowDown" ? (w.preventDefault(), f((h) => N.length ? (h + 1) % N.length : 0)) : w.key === "ArrowUp" ? (w.preventDefault(), f(
1303
- (h) => N.length ? (h - 1 + N.length) % N.length : 0
1304
- )) : w.key === "Enter" ? (w.preventDefault(), N[m] && o(N[m])) : w.key === "Escape" && (w.preventDefault(), t == null || t());
1296
+ var g;
1297
+ t && (c(""), x(0), (g = h.current) == null || g.focus());
1298
+ }, [t]), O(() => {
1299
+ x(0);
1300
+ }, [l]), !t) return null;
1301
+ const E = (g) => {
1302
+ g.key === "ArrowDown" ? (g.preventDefault(), x((m) => T.length ? (m + 1) % T.length : 0)) : g.key === "ArrowUp" ? (g.preventDefault(), x(
1303
+ (m) => T.length ? (m - 1 + T.length) % T.length : 0
1304
+ )) : g.key === "Enter" ? (g.preventDefault(), T[y] && n(T[y])) : g.key === "Escape" && (g.preventDefault(), r == null || r());
1305
1305
  };
1306
- return /* @__PURE__ */ r(
1306
+ return /* @__PURE__ */ o(
1307
1307
  "div",
1308
1308
  {
1309
- onClick: a ? void 0 : t,
1310
- className: S(
1309
+ onClick: a ? void 0 : r,
1310
+ className: L(
1311
1311
  "z-[100] flex items-start justify-center",
1312
1312
  a ? "relative w-full max-w-xl" : "fixed inset-0 pt-[10vh] bg-black/50 backdrop-blur-sm"
1313
1313
  ),
1314
- children: /* @__PURE__ */ c(
1314
+ children: /* @__PURE__ */ p(
1315
1315
  "div",
1316
1316
  {
1317
1317
  role: "dialog",
1318
1318
  "aria-modal": !a,
1319
1319
  "aria-label": "Command Palette",
1320
- onClick: (w) => w.stopPropagation(),
1321
- className: S(
1320
+ onClick: (g) => g.stopPropagation(),
1321
+ className: L(
1322
1322
  "w-full max-w-xl bg-popover text-popover-foreground border shadow-2xl rounded-xl overflow-hidden animate-in fade-in zoom-in duration-200",
1323
- u
1323
+ d
1324
1324
  ),
1325
1325
  children: [
1326
- /* @__PURE__ */ c("div", { className: "flex items-center px-4 border-b", children: [
1327
- /* @__PURE__ */ r(Z, { size: 18, className: "text-muted-foreground mr-3" }),
1328
- /* @__PURE__ */ r(
1326
+ /* @__PURE__ */ p("div", { className: "flex items-center px-4 border-b", children: [
1327
+ /* @__PURE__ */ o(ue, { size: 18, className: "text-muted-foreground mr-3" }),
1328
+ /* @__PURE__ */ o(
1329
1329
  "input",
1330
1330
  {
1331
- ref: p,
1331
+ ref: h,
1332
1332
  type: "text",
1333
1333
  role: "combobox",
1334
1334
  "aria-expanded": !0,
1335
1335
  "aria-controls": "command-palette-list",
1336
1336
  "aria-label": "Command",
1337
1337
  placeholder: s,
1338
- value: i,
1339
- onChange: (w) => d(w.target.value),
1340
- onKeyDown: k,
1338
+ value: l,
1339
+ onChange: (g) => c(g.target.value),
1340
+ onKeyDown: E,
1341
1341
  className: "flex-1 h-14 bg-transparent outline-none text-base text-foreground placeholder:text-muted-foreground"
1342
1342
  }
1343
1343
  )
1344
1344
  ] }),
1345
- /* @__PURE__ */ r(
1345
+ /* @__PURE__ */ o(
1346
1346
  "div",
1347
1347
  {
1348
1348
  id: "command-palette-list",
1349
1349
  role: "listbox",
1350
1350
  className: "max-h-[300px] overflow-y-auto py-2",
1351
- children: N.length === 0 ? /* @__PURE__ */ r("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: i ? `No commands found matching "${i}"` : "No commands available." }) : N.map((w, h) => /* @__PURE__ */ c(
1351
+ children: T.length === 0 ? /* @__PURE__ */ o("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: l ? `No commands found matching "${l}"` : "No commands available." }) : T.map((g, m) => /* @__PURE__ */ p(
1352
1352
  "div",
1353
1353
  {
1354
1354
  role: "option",
1355
- "aria-selected": h === m,
1356
- onClick: () => o(w),
1357
- onMouseEnter: () => f(h),
1358
- className: S(
1355
+ "aria-selected": m === y,
1356
+ onClick: () => n(g),
1357
+ onMouseEnter: () => x(m),
1358
+ className: L(
1359
1359
  "px-4 py-2 cursor-pointer flex justify-between items-center text-sm",
1360
- h === m ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1360
+ m === y ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1361
1361
  ),
1362
1362
  children: [
1363
- /* @__PURE__ */ r("span", { children: w.label }),
1364
- w.keybinding && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: w.keybinding })
1363
+ /* @__PURE__ */ o("span", { children: g.label }),
1364
+ g.keybinding && /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: g.keybinding })
1365
1365
  ]
1366
1366
  },
1367
- w.id
1367
+ g.id
1368
1368
  ))
1369
1369
  }
1370
1370
  ),
1371
- /* @__PURE__ */ c("div", { className: "px-4 py-2 border-t bg-muted/30 flex justify-between items-center text-[10px] text-muted-foreground", children: [
1372
- /* @__PURE__ */ c("div", { className: "flex gap-3", children: [
1373
- /* @__PURE__ */ c("span", { children: [
1374
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border", children: "↑↓" }),
1371
+ /* @__PURE__ */ p("div", { className: "px-4 py-2 border-t bg-muted/30 flex justify-between items-center text-[10px] text-muted-foreground", children: [
1372
+ /* @__PURE__ */ p("div", { className: "flex gap-3", children: [
1373
+ /* @__PURE__ */ p("span", { children: [
1374
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "↑↓" }),
1375
1375
  " to navigate"
1376
1376
  ] }),
1377
- /* @__PURE__ */ c("span", { children: [
1378
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border", children: "Enter" }),
1377
+ /* @__PURE__ */ p("span", { children: [
1378
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "Enter" }),
1379
1379
  " to select"
1380
1380
  ] })
1381
1381
  ] }),
1382
- /* @__PURE__ */ c("span", { children: [
1383
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border", children: "Esc" }),
1382
+ /* @__PURE__ */ p("span", { children: [
1383
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "Esc" }),
1384
1384
  " to close"
1385
1385
  ] })
1386
1386
  ] })
@@ -1389,133 +1389,133 @@ const Et = (n, e) => {
1389
1389
  )
1390
1390
  }
1391
1391
  );
1392
- }, Xt = ({
1393
- shortcutKey: n = "p",
1392
+ }, $r = ({
1393
+ shortcutKey: t = "p",
1394
1394
  ...e
1395
1395
  }) => {
1396
- const [o, t] = A(!1);
1396
+ const [n, r] = R(!1);
1397
1397
  return O(() => {
1398
- if (n === null) return;
1398
+ if (t === null) return;
1399
1399
  const a = (s) => {
1400
- (s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() === n && (s.preventDefault(), t((l) => !l));
1400
+ (s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() === t && (s.preventDefault(), r((i) => !i));
1401
1401
  };
1402
1402
  return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
1403
- }, [n]), /* @__PURE__ */ r(
1404
- Dt,
1403
+ }, [t]), /* @__PURE__ */ o(
1404
+ qt,
1405
1405
  {
1406
1406
  ...e,
1407
- open: o,
1408
- commands: J.getCommands(),
1407
+ open: n,
1408
+ commands: te.getCommands(),
1409
1409
  onSelect: (a) => {
1410
- a.execute(), t(!1);
1410
+ a.execute(), r(!1);
1411
1411
  },
1412
- onClose: () => t(!1)
1412
+ onClose: () => r(!1)
1413
1413
  }
1414
1414
  );
1415
- }, It = {
1416
- alert: Fe,
1417
- confirm: Ue,
1418
- prompt: je
1419
- }, Ot = {
1415
+ }, Vt = {
1416
+ alert: ct,
1417
+ confirm: lt,
1418
+ prompt: it
1419
+ }, Qt = {
1420
1420
  alert: "text-destructive",
1421
1421
  confirm: "text-amber-500",
1422
1422
  prompt: "text-blue-500"
1423
- }, At = ({
1424
- open: n,
1423
+ }, Zt = ({
1424
+ open: t,
1425
1425
  type: e = "alert",
1426
- title: o,
1427
- message: t,
1426
+ title: n,
1427
+ message: r,
1428
1428
  defaultValue: a = "",
1429
1429
  onConfirm: s,
1430
- onCancel: l,
1431
- confirmLabel: u,
1432
- cancelLabel: i = "Cancel",
1433
- placeholder: d = "Enter value…",
1434
- className: m
1430
+ onCancel: i,
1431
+ confirmLabel: d,
1432
+ cancelLabel: l = "Cancel",
1433
+ placeholder: c = "Enter value…",
1434
+ className: y
1435
1435
  }) => {
1436
- const [f, p] = A(a), N = z(null);
1436
+ const [x, h] = R(a), T = F(null);
1437
1437
  if (O(() => {
1438
- if (!n || (p(a), e !== "prompt")) return;
1439
- const x = window.setTimeout(() => {
1440
- var b, y;
1441
- (b = N.current) == null || b.focus(), (y = N.current) == null || y.select();
1438
+ if (!t || (h(a), e !== "prompt")) return;
1439
+ const b = window.setTimeout(() => {
1440
+ var N, w;
1441
+ (N = T.current) == null || N.focus(), (w = T.current) == null || w.select();
1442
1442
  }, 50);
1443
- return () => window.clearTimeout(x);
1444
- }, [n, e, a]), O(() => {
1445
- if (!n) return;
1446
- const x = (b) => {
1447
- b.key === "Escape" && (b.preventDefault(), l == null || l());
1443
+ return () => window.clearTimeout(b);
1444
+ }, [t, e, a]), O(() => {
1445
+ if (!t) return;
1446
+ const b = (N) => {
1447
+ N.key === "Escape" && (N.preventDefault(), i == null || i());
1448
1448
  };
1449
- return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
1450
- }, [n, l]), !n) return null;
1451
- const k = () => s == null ? void 0 : s(e === "prompt" ? f : void 0), w = (x) => {
1452
- x.key === "Enter" && (x.preventDefault(), k());
1453
- }, h = It[e];
1454
- return /* @__PURE__ */ r(
1449
+ return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
1450
+ }, [t, i]), !t) return null;
1451
+ const E = () => s == null ? void 0 : s(e === "prompt" ? x : void 0), g = (b) => {
1452
+ b.key === "Enter" && (b.preventDefault(), E());
1453
+ }, m = Vt[e];
1454
+ return /* @__PURE__ */ o(
1455
1455
  "div",
1456
1456
  {
1457
1457
  className: "fixed inset-0 z-50 flex items-center justify-center overflow-hidden bg-background/80 backdrop-blur-sm transition-all duration-300",
1458
- onClick: l,
1459
- children: /* @__PURE__ */ c(
1458
+ onClick: i,
1459
+ children: /* @__PURE__ */ p(
1460
1460
  "div",
1461
1461
  {
1462
1462
  role: "dialog",
1463
1463
  "aria-modal": "true",
1464
- "aria-label": o,
1465
- onClick: (x) => x.stopPropagation(),
1466
- onKeyDown: w,
1467
- className: S(
1464
+ "aria-label": n,
1465
+ onClick: (b) => b.stopPropagation(),
1466
+ onKeyDown: g,
1467
+ className: L(
1468
1468
  "relative flex flex-col w-full max-w-md p-6 bg-card border border-border shadow-2xl rounded-2xl animate-in fade-in zoom-in-95 ring-1 ring-white/10",
1469
- m
1469
+ y
1470
1470
  ),
1471
1471
  children: [
1472
- /* @__PURE__ */ r(
1472
+ /* @__PURE__ */ o(
1473
1473
  "button",
1474
1474
  {
1475
1475
  type: "button",
1476
- onClick: l,
1476
+ onClick: i,
1477
1477
  "aria-label": "Close",
1478
1478
  className: "absolute top-4 right-4 p-1 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
1479
- children: /* @__PURE__ */ r(B, { size: 18 })
1479
+ children: /* @__PURE__ */ o(V, { size: 18 })
1480
1480
  }
1481
1481
  ),
1482
- /* @__PURE__ */ c("div", { className: "flex items-start space-x-4 mb-4", children: [
1483
- /* @__PURE__ */ r("div", { className: S("p-2 bg-muted rounded-full shrink-0", Ot[e]), children: /* @__PURE__ */ r(h, { size: 24 }) }),
1484
- /* @__PURE__ */ c("div", { className: "flex-1 mt-1", children: [
1485
- /* @__PURE__ */ r("h2", { className: "text-lg font-semibold tracking-tight pr-6", children: o }),
1486
- t && /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground mt-1 whitespace-pre-wrap", children: t })
1482
+ /* @__PURE__ */ p("div", { className: "flex items-start space-x-4 mb-4", children: [
1483
+ /* @__PURE__ */ o("div", { className: L("p-2 bg-muted rounded-full shrink-0", Qt[e]), children: /* @__PURE__ */ o(m, { size: 24 }) }),
1484
+ /* @__PURE__ */ p("div", { className: "flex-1 mt-1", children: [
1485
+ /* @__PURE__ */ o("h2", { className: "text-lg font-semibold tracking-tight pr-6", children: n }),
1486
+ r && /* @__PURE__ */ o("p", { className: "text-sm text-muted-foreground mt-1 whitespace-pre-wrap", children: r })
1487
1487
  ] })
1488
1488
  ] }),
1489
- e === "prompt" && /* @__PURE__ */ r("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ r(
1489
+ e === "prompt" && /* @__PURE__ */ o("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ o(
1490
1490
  "input",
1491
1491
  {
1492
- ref: N,
1492
+ ref: T,
1493
1493
  type: "text",
1494
- "aria-label": o,
1495
- value: f,
1496
- placeholder: d,
1497
- onChange: (x) => p(x.target.value),
1494
+ "aria-label": n,
1495
+ value: x,
1496
+ placeholder: c,
1497
+ onChange: (b) => h(b.target.value),
1498
1498
  className: "w-full bg-background border border-border rounded-lg px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 transition-all placeholder:text-muted-foreground/50"
1499
1499
  }
1500
1500
  ) }),
1501
- /* @__PURE__ */ c("div", { className: "flex items-center justify-end space-x-3 mt-4", children: [
1502
- e !== "alert" && /* @__PURE__ */ r(
1501
+ /* @__PURE__ */ p("div", { className: "flex items-center justify-end space-x-3 mt-4", children: [
1502
+ e !== "alert" && /* @__PURE__ */ o(
1503
1503
  "button",
1504
1504
  {
1505
1505
  type: "button",
1506
- onClick: l,
1506
+ onClick: i,
1507
1507
  className: "px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
1508
- children: i
1508
+ children: l
1509
1509
  }
1510
1510
  ),
1511
- /* @__PURE__ */ r(
1511
+ /* @__PURE__ */ o(
1512
1512
  "button",
1513
1513
  {
1514
1514
  type: "button",
1515
- onClick: k,
1515
+ onClick: E,
1516
1516
  autoFocus: e !== "prompt",
1517
1517
  className: "px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
1518
- children: u ?? (e === "alert" ? "OK" : "Confirm")
1518
+ children: d ?? (e === "alert" ? "OK" : "Confirm")
1519
1519
  }
1520
1520
  )
1521
1521
  ] })
@@ -1524,917 +1524,1817 @@ const Et = (n, e) => {
1524
1524
  )
1525
1525
  }
1526
1526
  );
1527
- }, Zt = (n) => {
1528
- const { isOpen: e, type: o, title: t, message: a, defaultValue: s, close: l } = Ee();
1529
- return /* @__PURE__ */ r(
1530
- At,
1527
+ }, Or = (t) => {
1528
+ const { isOpen: e, type: n, title: r, message: a, defaultValue: s, close: i } = je();
1529
+ return /* @__PURE__ */ o(
1530
+ Zt,
1531
1531
  {
1532
- ...n,
1532
+ ...t,
1533
1533
  open: e,
1534
- type: o,
1535
- title: t,
1534
+ type: n,
1535
+ title: r,
1536
1536
  message: a,
1537
1537
  defaultValue: s,
1538
- onConfirm: (d) => {
1539
- o === "prompt" ? l(d ?? "") : o === "confirm" ? l(!0) : l();
1538
+ onConfirm: (c) => {
1539
+ n === "prompt" ? i(c ?? "") : n === "confirm" ? i(!0) : i();
1540
1540
  },
1541
1541
  onCancel: () => {
1542
- o === "prompt" ? l(null) : o === "confirm" ? l(!1) : l();
1542
+ n === "prompt" ? i(null) : n === "confirm" ? i(!1) : i();
1543
1543
  }
1544
1544
  }
1545
1545
  );
1546
- }, Lt = X.map((n) => ({
1547
- id: n.id,
1548
- label: n.shortLabel
1549
- })), Mt = ({
1550
- value: n,
1546
+ }, er = ie.map((t) => ({
1547
+ id: t.id,
1548
+ label: t.shortLabel
1549
+ })), tr = ({
1550
+ value: t,
1551
1551
  onChange: e,
1552
- options: o = Lt,
1553
- className: t,
1552
+ options: n = er,
1553
+ className: r,
1554
1554
  "aria-label": a = "Theme"
1555
- }) => /* @__PURE__ */ r(
1555
+ }) => /* @__PURE__ */ o(
1556
1556
  "div",
1557
1557
  {
1558
1558
  role: "radiogroup",
1559
1559
  "aria-label": a,
1560
- className: S(
1560
+ className: L(
1561
1561
  "flex items-center border border-border rounded-lg p-0.5 bg-secondary/80 select-none",
1562
- t
1562
+ r
1563
1563
  ),
1564
- children: o.map((s) => /* @__PURE__ */ r(
1564
+ children: n.map((s) => /* @__PURE__ */ o(
1565
1565
  "button",
1566
1566
  {
1567
1567
  role: "radio",
1568
- "aria-checked": n === s.id,
1568
+ "aria-checked": t === s.id,
1569
1569
  onClick: () => e(s.id),
1570
- className: S(
1570
+ className: L(
1571
1571
  "px-2.5 py-1 text-[9px] font-extrabold uppercase rounded-md transition-all font-mono cursor-pointer outline-none focus-visible:ring-1 focus-visible:ring-ring",
1572
- n === s.id ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-foreground"
1572
+ t === s.id ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-foreground"
1573
1573
  ),
1574
1574
  children: s.label
1575
1575
  },
1576
1576
  s.id
1577
1577
  ))
1578
1578
  }
1579
- ), er = (n) => {
1580
- const e = Y((t) => t.theme), o = Y((t) => t.setTheme);
1581
- return /* @__PURE__ */ r(Mt, { ...n, value: e, onChange: o });
1582
- }, zt = ({
1583
- profile: n,
1579
+ ), Rr = (t) => {
1580
+ const e = oe((r) => r.theme), n = oe((r) => r.setTheme);
1581
+ return /* @__PURE__ */ o(tr, { ...t, value: e, onChange: n });
1582
+ }, rr = ({
1583
+ profile: t,
1584
1584
  actions: e = [],
1585
- onProfileChange: o,
1586
- onAvatarChange: t,
1585
+ onProfileChange: n,
1586
+ onAvatarChange: r,
1587
1587
  onClick: a,
1588
1588
  showName: s = !0,
1589
- className: l
1589
+ className: i
1590
1590
  }) => {
1591
- const { name: u, role: i, email: d, avatarUrl: m } = n, [f, p] = A(!1), [N, k] = A(!1), [w, h] = A(u), [x, b] = A(i ?? ""), y = z(null), g = z(null);
1591
+ const { name: d, role: l, email: c, avatarUrl: y } = t, [x, h] = R(!1), [T, E] = R(!1), [g, m] = R(d), [b, N] = R(l ?? ""), w = F(null), f = F(null);
1592
1592
  O(() => {
1593
- f && (h(u), b(i ?? ""), k(!1));
1594
- }, [f, u, i]), O(() => {
1595
- if (!f) return;
1596
- const T = (P) => {
1597
- y.current && !y.current.contains(P.target) && p(!1);
1593
+ x && (m(d), N(l ?? ""), E(!1));
1594
+ }, [x, d, l]), O(() => {
1595
+ if (!x) return;
1596
+ const C = (S) => {
1597
+ w.current && !w.current.contains(S.target) && h(!1);
1598
1598
  };
1599
- return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
1600
- }, [f]);
1601
- const C = (T) => {
1602
- T.preventDefault(), o == null || o({ name: w, role: x }), k(!1);
1603
- }, D = (T) => {
1604
- var v;
1605
- const P = (v = T.target.files) == null ? void 0 : v[0];
1606
- P && (t == null || t(P)), T.target.value = "";
1607
- }, L = (T) => m ? /* @__PURE__ */ r("img", { src: m, alt: u, className: "w-full h-full object-cover" }) : /* @__PURE__ */ r(ve, { size: T, className: "text-muted-foreground" });
1608
- return /* @__PURE__ */ c("div", { ref: y, className: "relative inline-block text-left", children: [
1609
- /* @__PURE__ */ c(
1599
+ return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
1600
+ }, [x]);
1601
+ const D = (C) => {
1602
+ C.preventDefault(), n == null || n({ name: g, role: b }), E(!1);
1603
+ }, M = (C) => {
1604
+ var u;
1605
+ const S = (u = C.target.files) == null ? void 0 : u[0];
1606
+ S && (r == null || r(S)), C.target.value = "";
1607
+ }, A = (C) => y ? /* @__PURE__ */ o("img", { src: y, alt: d, className: "w-full h-full object-cover" }) : /* @__PURE__ */ o(Oe, { size: C, className: "text-muted-foreground" });
1608
+ return /* @__PURE__ */ p("div", { ref: w, className: "relative inline-block text-left", children: [
1609
+ /* @__PURE__ */ p(
1610
1610
  "button",
1611
1611
  {
1612
1612
  type: "button",
1613
- onClick: () => a ? a() : p((T) => !T),
1613
+ onClick: () => a ? a() : h((C) => !C),
1614
1614
  "aria-haspopup": a ? void 0 : "menu",
1615
- "aria-expanded": a ? void 0 : f,
1615
+ "aria-expanded": a ? void 0 : x,
1616
1616
  "aria-label": "User Profile Menu",
1617
- className: S(
1617
+ className: L(
1618
1618
  "focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none transition-all duration-200 select-none",
1619
1619
  s ? "flex items-center space-x-2 px-2 py-1 rounded-md hover:bg-accent/50 hover:text-accent-foreground text-left cursor-pointer border border-transparent hover:border-border/30" : "w-7 h-7 rounded-full bg-secondary/80 border border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-secondary cursor-pointer",
1620
- f && (s ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
1621
- l
1620
+ x && (s ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
1621
+ i
1622
1622
  ),
1623
1623
  children: [
1624
- /* @__PURE__ */ r(
1624
+ /* @__PURE__ */ o(
1625
1625
  "div",
1626
1626
  {
1627
- className: S(
1627
+ className: L(
1628
1628
  "rounded-full overflow-hidden border border-border/50 bg-muted flex items-center justify-center shrink-0 shadow-sm",
1629
1629
  s ? "w-6 h-6" : "w-full h-full"
1630
1630
  ),
1631
- children: L(s ? 13 : 12)
1631
+ children: A(s ? 13 : 12)
1632
1632
  }
1633
1633
  ),
1634
- s && /* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 leading-tight pr-1", children: [
1635
- /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold truncate text-foreground", children: u }),
1636
- i && /* @__PURE__ */ r("span", { className: "text-[9px] text-muted-foreground/80 truncate font-medium", children: i })
1634
+ s && /* @__PURE__ */ p("div", { className: "flex flex-col min-w-0 leading-tight pr-1", children: [
1635
+ /* @__PURE__ */ o("span", { className: "text-[11px] font-semibold truncate text-foreground", children: d }),
1636
+ l && /* @__PURE__ */ o("span", { className: "text-[9px] text-muted-foreground/80 truncate font-medium", children: l })
1637
1637
  ] })
1638
1638
  ]
1639
1639
  }
1640
1640
  ),
1641
- t && /* @__PURE__ */ r(
1641
+ r && /* @__PURE__ */ o(
1642
1642
  "input",
1643
1643
  {
1644
1644
  type: "file",
1645
- ref: g,
1646
- onChange: D,
1645
+ ref: f,
1646
+ onChange: M,
1647
1647
  accept: "image/*",
1648
1648
  "aria-label": "Upload avatar",
1649
1649
  className: "hidden"
1650
1650
  }
1651
1651
  ),
1652
- f && /* @__PURE__ */ r(
1652
+ x && /* @__PURE__ */ o(
1653
1653
  "div",
1654
1654
  {
1655
1655
  role: "menu",
1656
- className: S(
1656
+ className: L(
1657
1657
  "absolute z-50 w-64 rounded-lg border border-border/50 bg-card text-card-foreground shadow-lg backdrop-blur-md p-2 flex flex-col gap-1 mt-1.5 animate-in fade-in slide-in-from-top-2 duration-150 origin-top-right",
1658
1658
  s ? "left-0" : "right-0"
1659
1659
  ),
1660
- children: N ? /* @__PURE__ */ c("form", { onSubmit: C, className: "p-2 flex flex-col gap-2", children: [
1661
- /* @__PURE__ */ r("span", { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground", children: "Edit Profile" }),
1662
- /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: [
1663
- /* @__PURE__ */ r("label", { htmlFor: "profile-name", className: "text-[9px] font-semibold text-muted-foreground", children: "Name" }),
1664
- /* @__PURE__ */ r(
1660
+ children: T ? /* @__PURE__ */ p("form", { onSubmit: D, className: "p-2 flex flex-col gap-2", children: [
1661
+ /* @__PURE__ */ o("span", { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground", children: "Edit Profile" }),
1662
+ /* @__PURE__ */ p("div", { className: "flex flex-col gap-1", children: [
1663
+ /* @__PURE__ */ o("label", { htmlFor: "profile-name", className: "text-[9px] font-semibold text-muted-foreground", children: "Name" }),
1664
+ /* @__PURE__ */ o(
1665
1665
  "input",
1666
1666
  {
1667
1667
  id: "profile-name",
1668
1668
  type: "text",
1669
- value: w,
1670
- onChange: (T) => h(T.target.value),
1669
+ value: g,
1670
+ onChange: (C) => m(C.target.value),
1671
1671
  required: !0,
1672
1672
  className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
1673
1673
  }
1674
1674
  )
1675
1675
  ] }),
1676
- /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: [
1677
- /* @__PURE__ */ r("label", { htmlFor: "profile-role", className: "text-[9px] font-semibold text-muted-foreground", children: "Role" }),
1678
- /* @__PURE__ */ r(
1676
+ /* @__PURE__ */ p("div", { className: "flex flex-col gap-1", children: [
1677
+ /* @__PURE__ */ o("label", { htmlFor: "profile-role", className: "text-[9px] font-semibold text-muted-foreground", children: "Role" }),
1678
+ /* @__PURE__ */ o(
1679
1679
  "input",
1680
1680
  {
1681
1681
  id: "profile-role",
1682
1682
  type: "text",
1683
- value: x,
1684
- onChange: (T) => b(T.target.value),
1683
+ value: b,
1684
+ onChange: (C) => N(C.target.value),
1685
1685
  className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
1686
1686
  }
1687
1687
  )
1688
1688
  ] }),
1689
- /* @__PURE__ */ c("div", { className: "flex gap-1.5 mt-1 justify-end", children: [
1690
- /* @__PURE__ */ c(
1689
+ /* @__PURE__ */ p("div", { className: "flex gap-1.5 mt-1 justify-end", children: [
1690
+ /* @__PURE__ */ p(
1691
1691
  "button",
1692
1692
  {
1693
1693
  type: "button",
1694
- onClick: () => k(!1),
1694
+ onClick: () => E(!1),
1695
1695
  className: "px-2 py-1 text-[10px] rounded hover:bg-accent text-muted-foreground flex items-center gap-1 border border-border/30",
1696
1696
  children: [
1697
- /* @__PURE__ */ r(B, { size: 10 }),
1697
+ /* @__PURE__ */ o(V, { size: 10 }),
1698
1698
  " Cancel"
1699
1699
  ]
1700
1700
  }
1701
1701
  ),
1702
- /* @__PURE__ */ c(
1702
+ /* @__PURE__ */ p(
1703
1703
  "button",
1704
1704
  {
1705
1705
  type: "submit",
1706
1706
  className: "px-2 py-1 text-[10px] rounded bg-primary text-primary-foreground hover:bg-primary/95 flex items-center gap-1 font-semibold",
1707
1707
  children: [
1708
- /* @__PURE__ */ r(_e, { size: 10 }),
1708
+ /* @__PURE__ */ o(dt, { size: 10 }),
1709
1709
  " Save"
1710
1710
  ]
1711
1711
  }
1712
1712
  )
1713
1713
  ] })
1714
- ] }) : /* @__PURE__ */ c(be, { children: [
1715
- /* @__PURE__ */ c("div", { className: "p-2 flex items-center gap-3 border-b border-border/40 pb-2.5 mb-1", children: [
1716
- /* @__PURE__ */ c(
1714
+ ] }) : /* @__PURE__ */ p(Ae, { children: [
1715
+ /* @__PURE__ */ p("div", { className: "p-2 flex items-center gap-3 border-b border-border/40 pb-2.5 mb-1", children: [
1716
+ /* @__PURE__ */ p(
1717
1717
  "div",
1718
1718
  {
1719
1719
  onClick: () => {
1720
- var T;
1721
- return t && ((T = g.current) == null ? void 0 : T.click());
1720
+ var C;
1721
+ return r && ((C = f.current) == null ? void 0 : C.click());
1722
1722
  },
1723
- title: t ? "Upload avatar image" : void 0,
1724
- className: S(
1723
+ title: r ? "Upload avatar image" : void 0,
1724
+ className: L(
1725
1725
  "group relative w-12 h-12 rounded-full overflow-hidden border border-border/80 bg-muted flex items-center justify-center shrink-0 shadow-inner",
1726
- t && "cursor-pointer"
1726
+ r && "cursor-pointer"
1727
1727
  ),
1728
1728
  children: [
1729
- L(24),
1730
- t && /* @__PURE__ */ r("div", { className: "absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity", children: /* @__PURE__ */ r(Be, { size: 14, className: "text-white" }) })
1729
+ A(24),
1730
+ r && /* @__PURE__ */ o("div", { className: "absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity", children: /* @__PURE__ */ o(ut, { size: 14, className: "text-white" }) })
1731
1731
  ]
1732
1732
  }
1733
1733
  ),
1734
- /* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 leading-normal flex-1", children: [
1735
- /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
1736
- /* @__PURE__ */ r("span", { className: "text-xs font-bold truncate text-foreground", children: u }),
1737
- o && /* @__PURE__ */ r(
1734
+ /* @__PURE__ */ p("div", { className: "flex flex-col min-w-0 leading-normal flex-1", children: [
1735
+ /* @__PURE__ */ p("div", { className: "flex items-center gap-1", children: [
1736
+ /* @__PURE__ */ o("span", { className: "text-xs font-bold truncate text-foreground", children: d }),
1737
+ n && /* @__PURE__ */ o(
1738
1738
  "button",
1739
1739
  {
1740
1740
  type: "button",
1741
- onClick: () => k(!0),
1741
+ onClick: () => E(!0),
1742
1742
  title: "Edit Profile",
1743
1743
  "aria-label": "Edit Profile",
1744
1744
  className: "p-1 text-muted-foreground hover:text-foreground hover:bg-accent/40 rounded transition-colors",
1745
- children: /* @__PURE__ */ r(He, { size: 10 })
1745
+ children: /* @__PURE__ */ o(ft, { size: 10 })
1746
1746
  }
1747
1747
  )
1748
1748
  ] }),
1749
- i && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground/80 truncate font-semibold", children: i }),
1750
- d && /* @__PURE__ */ r("span", { className: "text-[9px] text-muted-foreground/60 truncate font-mono mt-0.5", children: d })
1749
+ l && /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground/80 truncate font-semibold", children: l }),
1750
+ c && /* @__PURE__ */ o("span", { className: "text-[9px] text-muted-foreground/60 truncate font-mono mt-0.5", children: c })
1751
1751
  ] })
1752
1752
  ] }),
1753
- e.map((T) => {
1754
- const P = T.icon;
1755
- return /* @__PURE__ */ c(
1753
+ e.map((C) => {
1754
+ const S = C.icon;
1755
+ return /* @__PURE__ */ p(
1756
1756
  "button",
1757
1757
  {
1758
1758
  type: "button",
1759
1759
  role: "menuitem",
1760
1760
  onClick: () => {
1761
- T.onSelect(), p(!1);
1761
+ C.onSelect(), h(!1);
1762
1762
  },
1763
- className: S(
1763
+ className: L(
1764
1764
  "w-full px-2 py-1.5 text-left rounded-md text-[11px] font-medium flex items-center gap-2 cursor-pointer transition-colors",
1765
- T.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
1766
- T.divider && "border-t border-border/20 pt-2 mt-1"
1765
+ C.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
1766
+ C.divider && "border-t border-border/20 pt-2 mt-1"
1767
1767
  ),
1768
1768
  children: [
1769
- P && /* @__PURE__ */ r(P, { size: 12, className: "opacity-70" }),
1770
- T.label
1769
+ S && /* @__PURE__ */ o(S, { size: 12, className: "opacity-70" }),
1770
+ C.label
1771
1771
  ]
1772
1772
  },
1773
- T.id
1773
+ C.id
1774
1774
  );
1775
1775
  })
1776
1776
  ] })
1777
1777
  }
1778
1778
  )
1779
1779
  ] });
1780
- }, tr = (n) => {
1781
- const e = W((d) => d.name), o = W((d) => d.role), t = W((d) => d.email), a = W((d) => d.avatarUrl), s = W((d) => d.customAvatar), l = W((d) => d.updateProfile), u = W((d) => d.setCustomAvatar);
1782
- return /* @__PURE__ */ r(
1783
- zt,
1780
+ }, Pr = (t) => {
1781
+ const e = Z((c) => c.name), n = Z((c) => c.role), r = Z((c) => c.email), a = Z((c) => c.avatarUrl), s = Z((c) => c.customAvatar), i = Z((c) => c.updateProfile), d = Z((c) => c.setCustomAvatar);
1782
+ return /* @__PURE__ */ o(
1783
+ rr,
1784
1784
  {
1785
- ...n,
1786
- profile: { name: e, role: o, email: t, avatarUrl: s || a },
1787
- onProfileChange: l,
1788
- onAvatarChange: (d) => {
1789
- const m = new FileReader();
1790
- m.onloadend = () => {
1791
- typeof m.result == "string" && u(m.result);
1792
- }, m.readAsDataURL(d);
1785
+ ...t,
1786
+ profile: { name: e, role: n, email: r, avatarUrl: s || a },
1787
+ onProfileChange: i,
1788
+ onAvatarChange: (c) => {
1789
+ const y = new FileReader();
1790
+ y.onloadend = () => {
1791
+ typeof y.result == "string" && d(y.result);
1792
+ }, y.readAsDataURL(c);
1793
1793
  }
1794
1794
  }
1795
1795
  );
1796
- }, rr = ({ title: n, subtitle: e, icon: o, className: t }) => /* @__PURE__ */ c("div", { className: S("flex items-center space-x-3 select-none", t), children: [
1797
- o && /* @__PURE__ */ r("div", { className: "w-8 h-8 rounded-lg bg-primary/10 border border-primary/30 flex items-center justify-center text-primary shadow-inner shrink-0", children: o }),
1798
- /* @__PURE__ */ c("div", { className: "min-w-0", children: [
1799
- /* @__PURE__ */ r("h1", { className: "text-xs font-black uppercase tracking-wider text-foreground font-mono truncate", children: n }),
1800
- e && /* @__PURE__ */ r("p", { className: "text-[9px] text-muted-foreground font-semibold truncate", children: e })
1796
+ }, zr = ({ title: t, subtitle: e, icon: n, className: r }) => /* @__PURE__ */ p("div", { className: L("flex items-center space-x-3 select-none", r), children: [
1797
+ n && /* @__PURE__ */ o("div", { className: "w-8 h-8 rounded-lg bg-primary/10 border border-primary/30 flex items-center justify-center text-primary shadow-inner shrink-0", children: n }),
1798
+ /* @__PURE__ */ p("div", { className: "min-w-0", children: [
1799
+ /* @__PURE__ */ o("h1", { className: "text-xs font-black uppercase tracking-wider text-foreground font-mono truncate", children: t }),
1800
+ e && /* @__PURE__ */ o("p", { className: "text-[9px] text-muted-foreground font-semibold truncate", children: e })
1801
1801
  ] })
1802
- ] }), Pt = ({ x: n, y: e, items: o, onClose: t, className: a }) => {
1803
- const s = z(null);
1802
+ ] }), nr = ({ x: t, y: e, items: n, onClose: r, className: a }) => {
1803
+ const s = F(null);
1804
1804
  return O(() => {
1805
- const l = (i) => {
1806
- s.current && !s.current.contains(i.target) && t();
1807
- }, u = (i) => {
1808
- i.key === "Escape" && t();
1805
+ const i = (l) => {
1806
+ s.current && !s.current.contains(l.target) && r();
1807
+ }, d = (l) => {
1808
+ l.key === "Escape" && r();
1809
1809
  };
1810
- return document.addEventListener("mousedown", l), document.addEventListener("keydown", u), () => {
1811
- document.removeEventListener("mousedown", l), document.removeEventListener("keydown", u);
1810
+ return document.addEventListener("mousedown", i), document.addEventListener("keydown", d), () => {
1811
+ document.removeEventListener("mousedown", i), document.removeEventListener("keydown", d);
1812
1812
  };
1813
- }, [t]), /* @__PURE__ */ r(
1813
+ }, [r]), /* @__PURE__ */ o(
1814
1814
  "div",
1815
1815
  {
1816
1816
  ref: s,
1817
1817
  role: "menu",
1818
- style: { top: e, left: n },
1819
- className: S(
1818
+ style: { top: e, left: t },
1819
+ className: L(
1820
1820
  "fixed z-[1000] min-w-[160px] bg-popover text-popover-foreground border shadow-md rounded-md py-1 animate-in fade-in zoom-in-95 duration-100",
1821
1821
  a
1822
1822
  ),
1823
- children: o.map((l, u) => /* @__PURE__ */ c(se.Fragment, { children: [
1824
- l.divider && /* @__PURE__ */ r("div", { className: "h-[1px] bg-border my-1" }),
1825
- /* @__PURE__ */ c(
1823
+ children: n.map((i, d) => /* @__PURE__ */ p(ge.Fragment, { children: [
1824
+ i.divider && /* @__PURE__ */ o("div", { className: "h-[1px] bg-border my-1" }),
1825
+ /* @__PURE__ */ p(
1826
1826
  "div",
1827
1827
  {
1828
1828
  role: "menuitem",
1829
- tabIndex: l.disabled ? void 0 : 0,
1830
- "aria-disabled": l.disabled,
1829
+ tabIndex: i.disabled ? void 0 : 0,
1830
+ "aria-disabled": i.disabled,
1831
1831
  onClick: () => {
1832
- l.disabled || (l.onClick(), t());
1832
+ i.disabled || (i.onClick(), r());
1833
1833
  },
1834
- onKeyDown: (i) => {
1835
- l.disabled || i.key !== "Enter" && i.key !== " " || (i.preventDefault(), l.onClick(), t());
1834
+ onKeyDown: (l) => {
1835
+ i.disabled || l.key !== "Enter" && l.key !== " " || (l.preventDefault(), i.onClick(), r());
1836
1836
  },
1837
- className: S(
1837
+ className: L(
1838
1838
  "px-3 py-1.5 text-xs flex items-center focus:outline-none",
1839
- l.disabled ? "opacity-40 cursor-default" : "cursor-pointer hover:bg-accent hover:text-accent-foreground focus:bg-accent"
1839
+ i.disabled ? "opacity-40 cursor-default" : "cursor-pointer hover:bg-accent hover:text-accent-foreground focus:bg-accent"
1840
1840
  ),
1841
1841
  children: [
1842
- l.icon && /* @__PURE__ */ r("span", { className: "mr-2 opacity-70", children: l.icon }),
1843
- /* @__PURE__ */ r("span", { children: l.label })
1842
+ i.icon && /* @__PURE__ */ o("span", { className: "mr-2 opacity-70", children: i.icon }),
1843
+ /* @__PURE__ */ o("span", { children: i.label })
1844
1844
  ]
1845
1845
  }
1846
1846
  )
1847
- ] }, `${l.label}-${u}`))
1847
+ ] }, `${i.label}-${d}`))
1848
1848
  }
1849
1849
  );
1850
- }, nr = ({
1851
- columns: n,
1850
+ }, Kr = ({
1851
+ columns: t,
1852
1852
  data: e,
1853
- onRowClick: o,
1854
- selectedRowId: t,
1853
+ onRowClick: n,
1854
+ selectedRowId: r,
1855
1855
  rowKey: a = "id",
1856
1856
  virtualized: s = !0,
1857
- showFilter: l = !0,
1858
- loading: u = !1,
1859
- placeholder: i = "No data available",
1860
- className: d
1857
+ showFilter: i = !0,
1858
+ loading: d = !1,
1859
+ placeholder: l = "No data available",
1860
+ className: c
1861
1861
  }) => {
1862
- const [m, f] = A(""), [p, N] = A(null), [k, w] = A(-1), h = z(null);
1862
+ const [y, x] = R(""), [h, T] = R(null), [E, g] = R(-1), m = F(null);
1863
1863
  O(() => {
1864
- w(-1);
1865
- }, [m, p]);
1866
- const x = j(() => {
1867
- if (!m) return e;
1868
- const v = m.toLowerCase();
1869
- return e.filter((E) => Object.values(E).some((I) => I == null ? !1 : String(I).toLowerCase().includes(v)));
1870
- }, [e, m]), b = j(() => {
1871
- if (!p) return x;
1872
- const { key: v, direction: E } = p;
1873
- return [...x].sort((I, K) => {
1874
- const $ = I[v], M = K[v];
1875
- if ($ === M) return 0;
1876
- if ($ == null) return 1;
1877
- if (M == null) return -1;
1878
- const ee = Number($), te = Number(M);
1879
- if (!isNaN(ee) && !isNaN(te))
1880
- return E === "asc" ? ee - te : te - ee;
1881
- const de = String($).toLowerCase(), ce = String(M).toLowerCase();
1882
- return E === "asc" ? de.localeCompare(ce) : ce.localeCompare(de);
1864
+ g(-1);
1865
+ }, [y, h]);
1866
+ const b = B(() => {
1867
+ if (!y) return e;
1868
+ const u = y.toLowerCase();
1869
+ return e.filter((k) => Object.values(k).some((I) => I == null ? !1 : String(I).toLowerCase().includes(u)));
1870
+ }, [e, y]), N = B(() => {
1871
+ if (!h) return b;
1872
+ const { key: u, direction: k } = h;
1873
+ return [...b].sort((I, z) => {
1874
+ const _ = I[u], K = z[u];
1875
+ if (_ === K) return 0;
1876
+ if (_ == null) return 1;
1877
+ if (K == null) return -1;
1878
+ const j = Number(_), v = Number(K);
1879
+ if (!isNaN(j) && !isNaN(v))
1880
+ return k === "asc" ? j - v : v - j;
1881
+ const P = String(_).toLowerCase(), $ = String(K).toLowerCase();
1882
+ return k === "asc" ? P.localeCompare($) : $.localeCompare(P);
1883
1883
  });
1884
- }, [x, p]), y = (v, E) => {
1885
- E !== !1 && N((I) => !I || I.key !== v ? { key: v, direction: "asc" } : I.direction === "asc" ? { key: v, direction: "desc" } : null);
1886
- }, g = (v) => {
1887
- if (!(b.length === 0 || u)) {
1888
- if (v.key === "ArrowDown")
1889
- v.preventDefault(), w((E) => {
1890
- const I = E + 1;
1891
- return I >= b.length ? 0 : I;
1884
+ }, [b, h]), w = (u, k) => {
1885
+ k !== !1 && T((I) => !I || I.key !== u ? { key: u, direction: "asc" } : I.direction === "asc" ? { key: u, direction: "desc" } : null);
1886
+ }, f = (u) => {
1887
+ if (!(N.length === 0 || d)) {
1888
+ if (u.key === "ArrowDown")
1889
+ u.preventDefault(), g((k) => {
1890
+ const I = k + 1;
1891
+ return I >= N.length ? 0 : I;
1892
1892
  });
1893
- else if (v.key === "ArrowUp")
1894
- v.preventDefault(), w((E) => {
1895
- const I = E - 1;
1896
- return I < 0 ? b.length - 1 : I;
1893
+ else if (u.key === "ArrowUp")
1894
+ u.preventDefault(), g((k) => {
1895
+ const I = k - 1;
1896
+ return I < 0 ? N.length - 1 : I;
1897
1897
  });
1898
- else if ((v.key === "Enter" || v.key === " ") && (v.preventDefault(), k >= 0 && k < b.length)) {
1899
- const E = b[k];
1900
- o && o(E);
1898
+ else if ((u.key === "Enter" || u.key === " ") && (u.preventDefault(), E >= 0 && E < N.length)) {
1899
+ const k = N[E];
1900
+ n && n(k);
1901
1901
  }
1902
1902
  }
1903
- }, C = (v) => v.sortable === !1 ? null : (p == null ? void 0 : p.key) !== v.key ? /* @__PURE__ */ r(We, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : p.direction === "asc" ? /* @__PURE__ */ r(Ne, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ r(Ce, { size: 14, className: "text-primary ml-1.5" }), D = () => /* @__PURE__ */ r("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: n.map((v) => /* @__PURE__ */ r(
1903
+ }, D = (u) => u.sortable === !1 ? null : (h == null ? void 0 : h.key) !== u.key ? /* @__PURE__ */ o(mt, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : h.direction === "asc" ? /* @__PURE__ */ o(ze, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ o(Fe, { size: 14, className: "text-primary ml-1.5" }), M = () => /* @__PURE__ */ o("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: t.map((u) => /* @__PURE__ */ o(
1904
1904
  "th",
1905
1905
  {
1906
1906
  role: "columnheader",
1907
- "aria-sort": (p == null ? void 0 : p.key) === v.key ? p.direction === "asc" ? "ascending" : "descending" : "none",
1908
- className: S(
1907
+ "aria-sort": (h == null ? void 0 : h.key) === u.key ? h.direction === "asc" ? "ascending" : "descending" : "none",
1908
+ className: L(
1909
1909
  "p-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider text-left transition-colors",
1910
- v.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
1910
+ u.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
1911
1911
  ),
1912
- style: { width: v.width },
1913
- onClick: () => y(v.key, v.sortable),
1914
- children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
1915
- /* @__PURE__ */ r("span", { children: v.header }),
1916
- C(v)
1912
+ style: { width: u.width },
1913
+ onClick: () => w(u.key, u.sortable),
1914
+ children: /* @__PURE__ */ p("div", { className: "flex items-center", children: [
1915
+ /* @__PURE__ */ o("span", { children: u.header }),
1916
+ D(u)
1917
1917
  ] })
1918
1918
  },
1919
- v.key
1920
- )) }), L = (v, E) => {
1921
- const I = t !== void 0 && v[a] === t;
1922
- return /* @__PURE__ */ r(
1919
+ u.key
1920
+ )) }), A = (u, k) => {
1921
+ const I = r !== void 0 && u[a] === r;
1922
+ return /* @__PURE__ */ o(
1923
1923
  "tr",
1924
1924
  {
1925
1925
  role: "row",
1926
1926
  "aria-selected": I,
1927
- onClick: () => o && o(v),
1928
- className: S(
1927
+ onClick: () => n && n(u),
1928
+ className: L(
1929
1929
  "border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
1930
1930
  I && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1931
- k === E && "bg-accent/60 ring-1 ring-inset ring-ring"
1931
+ E === k && "bg-accent/60 ring-1 ring-inset ring-ring"
1932
1932
  ),
1933
- children: n.map(($) => {
1934
- const M = v[$.key];
1935
- return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: $.render ? $.render(M, v) : M != null ? String(M) : "" }, $.key);
1933
+ children: t.map((_) => {
1934
+ const K = u[_.key];
1935
+ return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: _.render ? _.render(K, u) : K != null ? String(K) : "" }, _.key);
1936
1936
  })
1937
1937
  },
1938
- String(v[a] || E)
1938
+ String(u[a] || k)
1939
1939
  );
1940
- }, T = j(() => ({
1941
- Table: (v) => /* @__PURE__ */ r(
1940
+ }, C = B(() => ({
1941
+ Table: (u) => /* @__PURE__ */ o(
1942
1942
  "table",
1943
1943
  {
1944
- ...v,
1944
+ ...u,
1945
1945
  role: "grid",
1946
1946
  className: "w-full border-collapse text-left bg-background text-foreground"
1947
1947
  }
1948
1948
  ),
1949
- TableHead: se.forwardRef((v, E) => /* @__PURE__ */ r("thead", { ref: E, ...v, className: "sticky top-0 bg-background z-10 shadow-[0_1px_0_0_rgba(0,0,0,0.1)] dark:shadow-[0_1px_0_0_rgba(255,255,255,0.05)]" })),
1950
- TableBody: se.forwardRef((v, E) => /* @__PURE__ */ r("tbody", { ref: E, ...v })),
1951
- TableRow: ({ item: v, context: E, ...I }) => {
1952
- if (!E || !v) return /* @__PURE__ */ r("tr", { ...I });
1953
- const K = E.selectedRowId !== void 0 && v[E.rowKey] === E.selectedRowId, $ = E.focusedIndex === I["data-index"];
1954
- return /* @__PURE__ */ r(
1949
+ TableHead: ge.forwardRef((u, k) => /* @__PURE__ */ o("thead", { ref: k, ...u, className: "sticky top-0 bg-background z-10 shadow-[0_1px_0_0_rgba(0,0,0,0.1)] dark:shadow-[0_1px_0_0_rgba(255,255,255,0.05)]" })),
1950
+ TableBody: ge.forwardRef((u, k) => /* @__PURE__ */ o("tbody", { ref: k, ...u })),
1951
+ TableRow: ({ item: u, context: k, ...I }) => {
1952
+ if (!k || !u) return /* @__PURE__ */ o("tr", { ...I });
1953
+ const z = k.selectedRowId !== void 0 && u[k.rowKey] === k.selectedRowId, _ = k.focusedIndex === I["data-index"];
1954
+ return /* @__PURE__ */ o(
1955
1955
  "tr",
1956
1956
  {
1957
1957
  ...I,
1958
1958
  onClick: () => {
1959
- var M;
1960
- return (M = E.onRowClick) == null ? void 0 : M.call(E, v);
1959
+ var K;
1960
+ return (K = k.onRowClick) == null ? void 0 : K.call(k, u);
1961
1961
  },
1962
- className: S(
1962
+ className: L(
1963
1963
  "border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
1964
- K && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1965
- $ && "bg-accent/60 ring-1 ring-inset ring-ring"
1964
+ z && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1965
+ _ && "bg-accent/60 ring-1 ring-inset ring-ring"
1966
1966
  )
1967
1967
  }
1968
1968
  );
1969
1969
  }
1970
- }), []), P = () => u ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
1971
- /* @__PURE__ */ r(ke, { className: "animate-spin text-primary", size: 24 }),
1972
- /* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: "Loading dataset..." })
1973
- ] }) : b.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center h-48 text-center px-4", children: [
1974
- /* @__PURE__ */ r("span", { className: "text-sm font-medium text-foreground", children: i }),
1975
- /* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground mt-1", children: "No items matched your search query." })
1976
- ] }) : s ? /* @__PURE__ */ r("div", { className: "flex-1 min-h-[300px] h-full relative", children: /* @__PURE__ */ r(
1977
- Ye,
1970
+ }), []), S = () => d ? /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
1971
+ /* @__PURE__ */ o(Ke, { className: "animate-spin text-primary", size: 24 }),
1972
+ /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground", children: "Loading dataset..." })
1973
+ ] }) : N.length === 0 ? /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center h-48 text-center px-4", children: [
1974
+ /* @__PURE__ */ o("span", { className: "text-sm font-medium text-foreground", children: l }),
1975
+ /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground mt-1", children: "No items matched your search query." })
1976
+ ] }) : s ? /* @__PURE__ */ o("div", { className: "flex-1 min-h-[300px] h-full relative", children: /* @__PURE__ */ o(
1977
+ xt,
1978
1978
  {
1979
- data: b,
1979
+ data: N,
1980
1980
  context: {
1981
- selectedRowId: t,
1982
- focusedIndex: k,
1981
+ selectedRowId: r,
1982
+ focusedIndex: E,
1983
1983
  rowKey: a,
1984
- onRowClick: o
1984
+ onRowClick: n
1985
1985
  },
1986
- components: T,
1987
- fixedHeaderContent: D,
1988
- itemContent: (v, E) => /* @__PURE__ */ r(be, { children: n.map((I) => {
1989
- const K = E[I.key];
1990
- return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: I.render ? I.render(K, E) : K != null ? String(K) : "" }, I.key);
1986
+ components: C,
1987
+ fixedHeaderContent: M,
1988
+ itemContent: (u, k) => /* @__PURE__ */ o(Ae, { children: t.map((I) => {
1989
+ const z = k[I.key];
1990
+ return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: I.render ? I.render(z, k) : z != null ? String(z) : "" }, I.key);
1991
1991
  }) })
1992
1992
  }
1993
- ) }) : /* @__PURE__ */ r("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ c("table", { role: "grid", className: "w-full border-collapse text-left bg-background text-foreground", children: [
1994
- /* @__PURE__ */ r("thead", { children: D() }),
1995
- /* @__PURE__ */ r("tbody", { children: b.map((v, E) => L(v, E)) })
1993
+ ) }) : /* @__PURE__ */ o("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ p("table", { role: "grid", className: "w-full border-collapse text-left bg-background text-foreground", children: [
1994
+ /* @__PURE__ */ o("thead", { children: M() }),
1995
+ /* @__PURE__ */ o("tbody", { children: N.map((u, k) => A(u, k)) })
1996
1996
  ] }) });
1997
- return /* @__PURE__ */ c(
1997
+ return /* @__PURE__ */ p(
1998
1998
  "div",
1999
1999
  {
2000
- ref: h,
2000
+ ref: m,
2001
2001
  role: "region",
2002
2002
  "aria-label": "Data Grid",
2003
2003
  tabIndex: 0,
2004
- onKeyDown: g,
2005
- className: S(
2004
+ onKeyDown: f,
2005
+ className: L(
2006
2006
  "flex flex-col h-full bg-background border border-border rounded-lg shadow-sm overflow-hidden focus:outline-none focus:ring-1 focus:ring-ring focus:border-transparent",
2007
- d
2007
+ c
2008
2008
  ),
2009
2009
  children: [
2010
- l && /* @__PURE__ */ c("div", { className: "flex items-center justify-between p-3 border-b border-border bg-muted/20", children: [
2011
- /* @__PURE__ */ c("div", { className: "relative flex-1 max-w-sm", children: [
2012
- /* @__PURE__ */ r(Z, { size: 14, className: "absolute left-2.5 top-2.5 text-muted-foreground" }),
2013
- /* @__PURE__ */ r(
2010
+ i && /* @__PURE__ */ p("div", { className: "flex items-center justify-between p-3 border-b border-border bg-muted/20", children: [
2011
+ /* @__PURE__ */ p("div", { className: "relative flex-1 max-w-sm", children: [
2012
+ /* @__PURE__ */ o(ue, { size: 14, className: "absolute left-2.5 top-2.5 text-muted-foreground" }),
2013
+ /* @__PURE__ */ o(
2014
2014
  "input",
2015
2015
  {
2016
2016
  type: "text",
2017
2017
  placeholder: "Filter table rows...",
2018
2018
  className: "w-full bg-secondary/40 border border-border rounded-md pl-8 pr-7 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary focus:border-transparent transition-all",
2019
- value: m,
2020
- onChange: (v) => f(v.target.value)
2019
+ value: y,
2020
+ onChange: (u) => x(u.target.value)
2021
2021
  }
2022
2022
  ),
2023
- m && /* @__PURE__ */ r(
2023
+ y && /* @__PURE__ */ o(
2024
2024
  "button",
2025
2025
  {
2026
- onClick: () => f(""),
2026
+ onClick: () => x(""),
2027
2027
  className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
2028
2028
  "aria-label": "Clear filter",
2029
- children: /* @__PURE__ */ r(B, { size: 12 })
2029
+ children: /* @__PURE__ */ o(V, { size: 12 })
2030
2030
  }
2031
2031
  )
2032
2032
  ] }),
2033
- /* @__PURE__ */ c("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
2034
- b.length,
2033
+ /* @__PURE__ */ p("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
2034
+ N.length,
2035
2035
  " of ",
2036
2036
  e.length,
2037
2037
  " records"
2038
2038
  ] })
2039
2039
  ] }),
2040
- P()
2040
+ S()
2041
2041
  ]
2042
2042
  }
2043
2043
  );
2044
- }, or = ({
2045
- results: n,
2044
+ }, Fr = ({
2045
+ results: t,
2046
2046
  onQueryChange: e,
2047
- onSelect: o,
2048
- categories: t,
2047
+ onSelect: n,
2048
+ categories: r,
2049
2049
  placeholder: a = "Search…",
2050
2050
  debounceMs: s = 200,
2051
- className: l
2051
+ className: i
2052
2052
  }) => {
2053
- const [u, i] = A(""), [d, m] = A(!1), [f, p] = A(0), N = z(null), k = z(null), w = j(() => t || [...new Set(n.map((y) => y.category))], [t, n]), h = j(
2054
- () => w.flatMap((y) => n.filter((g) => g.category === y)),
2055
- [w, n]
2053
+ const [d, l] = R(""), [c, y] = R(!1), [x, h] = R(0), T = F(null), E = F(null), g = B(() => r || [...new Set(t.map((w) => w.category))], [r, t]), m = B(
2054
+ () => g.flatMap((w) => t.filter((f) => f.category === w)),
2055
+ [g, t]
2056
2056
  );
2057
2057
  O(() => {
2058
- const y = (g) => {
2059
- N.current && !N.current.contains(g.target) && m(!1);
2058
+ const w = (f) => {
2059
+ T.current && !T.current.contains(f.target) && y(!1);
2060
2060
  };
2061
- return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
2061
+ return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
2062
2062
  }, []), O(() => {
2063
2063
  if (!e) return;
2064
- const y = window.setTimeout(() => e(u), s);
2065
- return () => window.clearTimeout(y);
2066
- }, [u, s, e]), O(() => {
2067
- p(0);
2068
- }, [n]);
2069
- const x = (y) => {
2070
- o(y), m(!1), i("");
2071
- }, b = (y) => {
2072
- var g;
2073
- if (!d) {
2074
- (y.key === "ArrowDown" || y.key === "Enter") && m(!0);
2064
+ const w = window.setTimeout(() => e(d), s);
2065
+ return () => window.clearTimeout(w);
2066
+ }, [d, s, e]), O(() => {
2067
+ h(0);
2068
+ }, [t]);
2069
+ const b = (w) => {
2070
+ n(w), y(!1), l("");
2071
+ }, N = (w) => {
2072
+ var f;
2073
+ if (!c) {
2074
+ (w.key === "ArrowDown" || w.key === "Enter") && y(!0);
2075
2075
  return;
2076
2076
  }
2077
- y.key === "ArrowDown" ? (y.preventDefault(), p((C) => h.length ? (C + 1) % h.length : 0)) : y.key === "ArrowUp" ? (y.preventDefault(), p(
2078
- (C) => h.length ? (C - 1 + h.length) % h.length : 0
2079
- )) : y.key === "Enter" ? (y.preventDefault(), h[f] && x(h[f])) : y.key === "Escape" && (y.preventDefault(), m(!1), (g = k.current) == null || g.blur());
2077
+ w.key === "ArrowDown" ? (w.preventDefault(), h((D) => m.length ? (D + 1) % m.length : 0)) : w.key === "ArrowUp" ? (w.preventDefault(), h(
2078
+ (D) => m.length ? (D - 1 + m.length) % m.length : 0
2079
+ )) : w.key === "Enter" ? (w.preventDefault(), m[x] && b(m[x])) : w.key === "Escape" && (w.preventDefault(), y(!1), (f = E.current) == null || f.blur());
2080
2080
  };
2081
- return /* @__PURE__ */ c("div", { ref: N, className: S("relative w-full", l), children: [
2082
- /* @__PURE__ */ c("div", { className: "relative flex items-center", children: [
2083
- /* @__PURE__ */ r(
2084
- Z,
2081
+ return /* @__PURE__ */ p("div", { ref: T, className: L("relative w-full", i), children: [
2082
+ /* @__PURE__ */ p("div", { className: "relative flex items-center", children: [
2083
+ /* @__PURE__ */ o(
2084
+ ue,
2085
2085
  {
2086
2086
  size: 13,
2087
2087
  className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"
2088
2088
  }
2089
2089
  ),
2090
- /* @__PURE__ */ r(
2090
+ /* @__PURE__ */ o(
2091
2091
  "input",
2092
2092
  {
2093
- ref: k,
2093
+ ref: E,
2094
2094
  type: "text",
2095
2095
  role: "combobox",
2096
- "aria-expanded": d,
2096
+ "aria-expanded": c,
2097
2097
  "aria-label": a,
2098
- value: u,
2098
+ value: d,
2099
2099
  placeholder: a,
2100
- onChange: (y) => {
2101
- i(y.target.value), m(!0);
2100
+ onChange: (w) => {
2101
+ l(w.target.value), y(!0);
2102
2102
  },
2103
- onFocus: () => m(!0),
2104
- onKeyDown: b,
2103
+ onFocus: () => y(!0),
2104
+ onKeyDown: N,
2105
2105
  className: "w-full h-7 pl-8 pr-7 bg-secondary/35 border border-border/40 rounded-md text-xs text-foreground placeholder:text-muted-foreground/75 focus:outline-none focus:ring-1 focus:ring-primary/40 focus:bg-background/95 focus:border-primary/50 transition-all font-sans"
2106
2106
  }
2107
2107
  ),
2108
- u && /* @__PURE__ */ r(
2108
+ d && /* @__PURE__ */ o(
2109
2109
  "button",
2110
2110
  {
2111
2111
  type: "button",
2112
2112
  onClick: () => {
2113
- var y;
2114
- i(""), (y = k.current) == null || y.focus();
2113
+ var w;
2114
+ l(""), (w = E.current) == null || w.focus();
2115
2115
  },
2116
2116
  "aria-label": "Clear search",
2117
2117
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
2118
- children: /* @__PURE__ */ r(B, { size: 11 })
2118
+ children: /* @__PURE__ */ o(V, { size: 11 })
2119
2119
  }
2120
2120
  )
2121
2121
  ] }),
2122
- d && u.trim() && /* @__PURE__ */ c(
2122
+ c && d.trim() && /* @__PURE__ */ p(
2123
2123
  "div",
2124
2124
  {
2125
2125
  role: "listbox",
2126
2126
  className: "absolute right-0 md:left-0 mt-1.5 w-80 max-h-[380px] bg-popover text-popover-foreground border border-border shadow-lg rounded-lg overflow-hidden flex flex-col z-[100] animate-in fade-in-50 slide-in-from-top-1 duration-100",
2127
2127
  children: [
2128
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto py-1", children: h.length === 0 ? /* @__PURE__ */ c("div", { className: "px-4 py-6 text-center text-xs text-muted-foreground italic", children: [
2128
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto py-1", children: m.length === 0 ? /* @__PURE__ */ p("div", { className: "px-4 py-6 text-center text-xs text-muted-foreground italic", children: [
2129
2129
  'No results found matching "',
2130
- u,
2130
+ d,
2131
2131
  '"'
2132
- ] }) : w.map((y) => {
2133
- const g = n.filter((C) => C.category === y);
2134
- return g.length === 0 ? null : /* @__PURE__ */ c("div", { className: "flex flex-col", children: [
2135
- /* @__PURE__ */ r("div", { className: "px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-muted-foreground/80 bg-muted/40 border-y border-border/20 first:border-t-0", children: y }),
2136
- g.map((C) => {
2137
- const D = C.icon, L = h.indexOf(C), T = L === f;
2138
- return /* @__PURE__ */ c(
2132
+ ] }) : g.map((w) => {
2133
+ const f = t.filter((D) => D.category === w);
2134
+ return f.length === 0 ? null : /* @__PURE__ */ p("div", { className: "flex flex-col", children: [
2135
+ /* @__PURE__ */ o("div", { className: "px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-muted-foreground/80 bg-muted/40 border-y border-border/20 first:border-t-0", children: w }),
2136
+ f.map((D) => {
2137
+ const M = D.icon, A = m.indexOf(D), C = A === x;
2138
+ return /* @__PURE__ */ p(
2139
2139
  "div",
2140
2140
  {
2141
2141
  role: "option",
2142
- "aria-selected": T,
2143
- onClick: () => x(C),
2144
- onMouseEnter: () => p(L),
2145
- className: S(
2142
+ "aria-selected": C,
2143
+ onClick: () => b(D),
2144
+ onMouseEnter: () => h(A),
2145
+ className: L(
2146
2146
  "px-3 py-2 cursor-pointer flex items-start space-x-2.5 transition-colors border-l-2",
2147
- T ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
2147
+ C ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
2148
2148
  ),
2149
2149
  children: [
2150
- D && /* @__PURE__ */ r(
2150
+ M && /* @__PURE__ */ o(
2151
2151
  "div",
2152
2152
  {
2153
- className: S(
2153
+ className: L(
2154
2154
  "mt-0.5 p-1 rounded bg-muted/50",
2155
- T && "bg-background text-primary"
2155
+ C && "bg-background text-primary"
2156
2156
  ),
2157
- children: /* @__PURE__ */ r(D, { size: 12 })
2157
+ children: /* @__PURE__ */ o(M, { size: 12 })
2158
2158
  }
2159
2159
  ),
2160
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
2161
- /* @__PURE__ */ r("div", { className: "text-xs font-medium truncate", children: C.title }),
2162
- C.description && /* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: C.description })
2160
+ /* @__PURE__ */ p("div", { className: "flex-1 min-w-0", children: [
2161
+ /* @__PURE__ */ o("div", { className: "text-xs font-medium truncate", children: D.title }),
2162
+ D.description && /* @__PURE__ */ o("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: D.description })
2163
2163
  ] })
2164
2164
  ]
2165
2165
  },
2166
- `${C.category}-${C.id}`
2166
+ `${D.category}-${D.id}`
2167
2167
  );
2168
2168
  })
2169
- ] }, y);
2169
+ ] }, w);
2170
2170
  }) }),
2171
- h.length > 0 && /* @__PURE__ */ c("div", { className: "px-3 py-1.5 border-t border-border bg-muted/20 flex items-center justify-between text-[9px] text-muted-foreground select-none shrink-0 font-mono", children: [
2172
- /* @__PURE__ */ c("div", { className: "flex space-x-2", children: [
2173
- /* @__PURE__ */ c("span", { children: [
2174
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↑↓" }),
2171
+ m.length > 0 && /* @__PURE__ */ p("div", { className: "px-3 py-1.5 border-t border-border bg-muted/20 flex items-center justify-between text-[9px] text-muted-foreground select-none shrink-0 font-mono", children: [
2172
+ /* @__PURE__ */ p("div", { className: "flex space-x-2", children: [
2173
+ /* @__PURE__ */ p("span", { children: [
2174
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↑↓" }),
2175
2175
  " ",
2176
2176
  "navigate"
2177
2177
  ] }),
2178
- /* @__PURE__ */ c("span", { children: [
2179
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↵" }),
2178
+ /* @__PURE__ */ p("span", { children: [
2179
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↵" }),
2180
2180
  " ",
2181
2181
  "select"
2182
2182
  ] })
2183
2183
  ] }),
2184
- /* @__PURE__ */ r("span", { children: "ESC to close" })
2184
+ /* @__PURE__ */ o("span", { children: "ESC to close" })
2185
2185
  ] })
2186
2186
  ]
2187
2187
  }
2188
2188
  )
2189
2189
  ] });
2190
- }, sr = ({
2191
- placeholder: n = "Search...",
2190
+ }, _r = ({
2191
+ placeholder: t = "Search...",
2192
2192
  onSearch: e,
2193
- results: o,
2194
- onSelect: t,
2193
+ results: n,
2194
+ onSelect: r,
2195
2195
  suggestions: a = [],
2196
2196
  loading: s = !1,
2197
- className: l
2197
+ className: i
2198
2198
  }) => {
2199
- const [u, i] = A(""), [d, m] = A(!1), [f, p] = A(-1), N = z(null);
2199
+ const [d, l] = R(""), [c, y] = R(!1), [x, h] = R(-1), T = F(null);
2200
2200
  O(() => {
2201
- const h = setTimeout(() => {
2202
- e(u);
2201
+ const m = setTimeout(() => {
2202
+ e(d);
2203
2203
  }, 300);
2204
- return () => clearTimeout(h);
2205
- }, [u, e]);
2206
- const k = a.filter(
2207
- (h) => h.toLowerCase().includes(u.toLowerCase()) && h.toLowerCase() !== u.toLowerCase()
2208
- ), w = (h) => {
2209
- d && k.length > 0 && (h.key === "ArrowDown" ? (h.preventDefault(), p((x) => (x + 1) % k.length)) : h.key === "ArrowUp" ? (h.preventDefault(), p((x) => (x - 1 + k.length) % k.length)) : h.key === "Enter" && f >= 0 && (h.preventDefault(), i(k[f]), m(!1)));
2204
+ return () => clearTimeout(m);
2205
+ }, [d, e]);
2206
+ const E = a.filter(
2207
+ (m) => m.toLowerCase().includes(d.toLowerCase()) && m.toLowerCase() !== d.toLowerCase()
2208
+ ), g = (m) => {
2209
+ c && E.length > 0 && (m.key === "ArrowDown" ? (m.preventDefault(), h((b) => (b + 1) % E.length)) : m.key === "ArrowUp" ? (m.preventDefault(), h((b) => (b - 1 + E.length) % E.length)) : m.key === "Enter" && x >= 0 && (m.preventDefault(), l(E[x]), y(!1)));
2210
2210
  };
2211
- return /* @__PURE__ */ c("div", { ref: N, className: S("flex flex-col h-full bg-background", l), children: [
2212
- /* @__PURE__ */ c("div", { className: "p-3 border-b border-border/50", children: [
2213
- /* @__PURE__ */ c("div", { className: "relative", children: [
2214
- /* @__PURE__ */ r("div", { className: "absolute left-2.5 top-2.5 text-muted-foreground", children: s ? /* @__PURE__ */ r(ke, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ r(Z, { size: 14 }) }),
2215
- /* @__PURE__ */ r(
2211
+ return /* @__PURE__ */ p("div", { ref: T, className: L("flex flex-col h-full bg-background", i), children: [
2212
+ /* @__PURE__ */ p("div", { className: "p-3 border-b border-border/50", children: [
2213
+ /* @__PURE__ */ p("div", { className: "relative", children: [
2214
+ /* @__PURE__ */ o("div", { className: "absolute left-2.5 top-2.5 text-muted-foreground", children: s ? /* @__PURE__ */ o(Ke, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ o(ue, { size: 14 }) }),
2215
+ /* @__PURE__ */ o(
2216
2216
  "input",
2217
2217
  {
2218
2218
  type: "text",
2219
2219
  className: "w-full bg-secondary/50 border border-border rounded-md pl-9 pr-8 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all",
2220
- placeholder: n,
2221
- value: u,
2222
- onChange: (h) => {
2223
- i(h.target.value), m(!0), p(-1);
2220
+ placeholder: t,
2221
+ value: d,
2222
+ onChange: (m) => {
2223
+ l(m.target.value), y(!0), h(-1);
2224
2224
  },
2225
- onKeyDown: w,
2226
- onFocus: () => m(!0)
2225
+ onKeyDown: g,
2226
+ onFocus: () => y(!0)
2227
2227
  }
2228
2228
  ),
2229
- u && /* @__PURE__ */ r(
2229
+ d && /* @__PURE__ */ o(
2230
2230
  "button",
2231
2231
  {
2232
2232
  onClick: () => {
2233
- i(""), e("");
2233
+ l(""), e("");
2234
2234
  },
2235
2235
  className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
2236
- children: /* @__PURE__ */ r(B, { size: 14 })
2236
+ children: /* @__PURE__ */ o(V, { size: 14 })
2237
2237
  }
2238
2238
  )
2239
2239
  ] }),
2240
- d && k.length > 0 && /* @__PURE__ */ r("div", { className: "absolute left-3 right-3 mt-1 bg-popover border shadow-lg rounded-md z-50 py-1 overflow-hidden", children: k.map((h, x) => /* @__PURE__ */ c(
2240
+ c && E.length > 0 && /* @__PURE__ */ o("div", { className: "absolute left-3 right-3 mt-1 bg-popover border shadow-lg rounded-md z-50 py-1 overflow-hidden", children: E.map((m, b) => /* @__PURE__ */ p(
2241
2241
  "div",
2242
2242
  {
2243
- className: S(
2243
+ className: L(
2244
2244
  "px-3 py-1.5 text-xs cursor-pointer flex items-center space-x-2",
2245
- x === f ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
2245
+ b === x ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
2246
2246
  ),
2247
2247
  onClick: () => {
2248
- i(h), m(!1);
2248
+ l(m), y(!1);
2249
2249
  },
2250
2250
  children: [
2251
- /* @__PURE__ */ r(Je, { size: 12, className: "text-muted-foreground" }),
2252
- /* @__PURE__ */ r("span", { children: h })
2251
+ /* @__PURE__ */ o(pt, { size: 12, className: "text-muted-foreground" }),
2252
+ /* @__PURE__ */ o("span", { children: m })
2253
2253
  ]
2254
2254
  },
2255
- h
2255
+ m
2256
2256
  )) })
2257
2257
  ] }),
2258
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children: o.length === 0 ? /* @__PURE__ */ r("div", { className: "p-8 text-center text-xs text-muted-foreground italic", children: u ? `No results found for "${u}"` : "Type to start searching..." }) : /* @__PURE__ */ r("div", { className: "py-2", children: o.map((h) => {
2259
- const x = h.icon;
2260
- return /* @__PURE__ */ r(
2258
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto", children: n.length === 0 ? /* @__PURE__ */ o("div", { className: "p-8 text-center text-xs text-muted-foreground italic", children: d ? `No results found for "${d}"` : "Type to start searching..." }) : /* @__PURE__ */ o("div", { className: "py-2", children: n.map((m) => {
2259
+ const b = m.icon;
2260
+ return /* @__PURE__ */ o(
2261
2261
  "div",
2262
2262
  {
2263
- onClick: () => t(h),
2263
+ onClick: () => r(m),
2264
2264
  className: "px-4 py-2 hover:bg-accent/50 cursor-pointer group transition-colors border-l-2 border-transparent hover:border-primary",
2265
- children: /* @__PURE__ */ c("div", { className: "flex items-start space-x-3", children: [
2266
- x && /* @__PURE__ */ r("div", { className: "mt-0.5 p-1 rounded bg-muted group-hover:bg-background transition-colors", children: /* @__PURE__ */ r(x, { size: 14, className: "text-muted-foreground group-hover:text-primary" }) }),
2267
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
2268
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
2269
- /* @__PURE__ */ r("span", { className: "text-xs font-medium truncate", children: h.title }),
2270
- h.category && /* @__PURE__ */ r("span", { className: "text-[10px] uppercase tracking-wider text-muted-foreground font-bold px-1.5 py-0.5 bg-muted rounded", children: h.category })
2265
+ children: /* @__PURE__ */ p("div", { className: "flex items-start space-x-3", children: [
2266
+ b && /* @__PURE__ */ o("div", { className: "mt-0.5 p-1 rounded bg-muted group-hover:bg-background transition-colors", children: /* @__PURE__ */ o(b, { size: 14, className: "text-muted-foreground group-hover:text-primary" }) }),
2267
+ /* @__PURE__ */ p("div", { className: "flex-1 min-w-0", children: [
2268
+ /* @__PURE__ */ p("div", { className: "flex items-center justify-between", children: [
2269
+ /* @__PURE__ */ o("span", { className: "text-xs font-medium truncate", children: m.title }),
2270
+ m.category && /* @__PURE__ */ o("span", { className: "text-[10px] uppercase tracking-wider text-muted-foreground font-bold px-1.5 py-0.5 bg-muted rounded", children: m.category })
2271
2271
  ] }),
2272
- h.description && /* @__PURE__ */ r("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: h.description })
2272
+ m.description && /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: m.description })
2273
2273
  ] })
2274
2274
  ] })
2275
2275
  },
2276
- h.id
2276
+ m.id
2277
2277
  );
2278
2278
  }) }) })
2279
2279
  ] });
2280
- }, Ie = (n, e = 0) => n.reduce((o, t) => (o.push({ ...t, level: e }), t.isOpen && t.children && o.push(...Ie(t.children, e + 1)), o), []), $t = (n) => {
2281
- if (!n) return ["background"];
2282
- const e = [n.isBranch ? "branch" : "leaf"];
2283
- return n.kind && e.push(n.kind), e;
2284
- }, ar = ({
2285
- data: n,
2280
+ }, He = (t, e = 0) => t.reduce((n, r) => (n.push({ ...r, level: e }), r.isOpen && r.children && n.push(...He(r.children, e + 1)), n), []), or = (t) => {
2281
+ if (!t) return ["background"];
2282
+ const e = [t.isBranch ? "branch" : "leaf"];
2283
+ return t.kind && e.push(t.kind), e;
2284
+ }, Ur = ({
2285
+ data: t,
2286
2286
  onToggle: e,
2287
- onActivate: o,
2288
- onMoveNode: t,
2287
+ onActivate: n,
2288
+ onMoveNode: r,
2289
2289
  actions: a = [],
2290
2290
  indent: s = 12,
2291
- virtualized: l = !0,
2292
- "aria-label": u = "Tree",
2293
- className: i
2291
+ virtualized: i = !0,
2292
+ "aria-label": d = "Tree",
2293
+ className: l
2294
2294
  }) => {
2295
- const [d, m] = A(null), [f, p] = A(null), N = j(() => Ie(n), [n]);
2295
+ const [c, y] = R(null), [x, h] = R(null), T = B(() => He(t), [t]);
2296
2296
  O(() => {
2297
- p(null);
2298
- }, [n]);
2299
- const k = a.filter(
2300
- (x) => !x.showFor || d && x.showFor.some((b) => d.scopes.includes(b))
2301
- ).map((x) => ({
2302
- label: x.label,
2303
- icon: x.icon,
2304
- divider: x.divider,
2305
- onClick: () => d && x.onSelect(d.context)
2306
- })), w = (x, b) => {
2307
- a.length !== 0 && (x.preventDefault(), x.stopPropagation(), m({
2308
- x: x.clientX,
2309
- y: x.clientY,
2310
- scopes: $t(b),
2311
- context: { nodeId: (b == null ? void 0 : b.id) ?? null, node: b }
2297
+ h(null);
2298
+ }, [t]);
2299
+ const E = a.filter(
2300
+ (b) => !b.showFor || c && b.showFor.some((N) => c.scopes.includes(N))
2301
+ ).map((b) => ({
2302
+ label: b.label,
2303
+ icon: b.icon,
2304
+ divider: b.divider,
2305
+ onClick: () => c && b.onSelect(c.context)
2306
+ })), g = (b, N) => {
2307
+ a.length !== 0 && (b.preventDefault(), b.stopPropagation(), y({
2308
+ x: b.clientX,
2309
+ y: b.clientY,
2310
+ scopes: or(N),
2311
+ context: { nodeId: (N == null ? void 0 : N.id) ?? null, node: N }
2312
2312
  }));
2313
- }, h = (x) => {
2314
- const b = N[x], y = !!b.isBranch;
2315
- return /* @__PURE__ */ c(
2313
+ }, m = (b) => {
2314
+ const N = T[b], w = !!N.isBranch;
2315
+ return /* @__PURE__ */ p(
2316
2316
  "div",
2317
2317
  {
2318
2318
  role: "treeitem",
2319
- "aria-expanded": y ? !!b.isOpen : void 0,
2320
- "aria-level": b.level + 1,
2319
+ "aria-expanded": w ? !!N.isOpen : void 0,
2320
+ "aria-level": N.level + 1,
2321
2321
  tabIndex: 0,
2322
2322
  draggable: !0,
2323
- onDragStart: (g) => {
2324
- g.dataTransfer.setData("text/plain", b.id), g.dataTransfer.effectAllowed = "move";
2323
+ onDragStart: (f) => {
2324
+ f.dataTransfer.setData("text/plain", N.id), f.dataTransfer.effectAllowed = "move";
2325
2325
  },
2326
- onDragOver: (g) => {
2327
- y && (g.preventDefault(), p(b.id));
2326
+ onDragOver: (f) => {
2327
+ w && (f.preventDefault(), h(N.id));
2328
2328
  },
2329
- onDragLeave: () => p(null),
2330
- onDrop: (g) => {
2331
- g.preventDefault(), p(null);
2332
- const C = g.dataTransfer.getData("text/plain");
2333
- C && C !== b.id && y && (t == null || t(C, b.id));
2329
+ onDragLeave: () => h(null),
2330
+ onDrop: (f) => {
2331
+ f.preventDefault(), h(null);
2332
+ const D = f.dataTransfer.getData("text/plain");
2333
+ D && D !== N.id && w && (r == null || r(D, N.id));
2334
2334
  },
2335
- onClick: () => y && (e == null ? void 0 : e(b)),
2336
- onDoubleClick: () => o == null ? void 0 : o(b),
2337
- onKeyDown: (g) => {
2338
- g.key === "Enter" && (g.preventDefault(), y ? e == null || e(b) : o == null || o(b));
2335
+ onClick: () => w && (e == null ? void 0 : e(N)),
2336
+ onDoubleClick: () => n == null ? void 0 : n(N),
2337
+ onKeyDown: (f) => {
2338
+ f.key === "Enter" && (f.preventDefault(), w ? e == null || e(N) : n == null || n(N));
2339
2339
  },
2340
- onContextMenu: (g) => w(g, b),
2341
- style: { paddingLeft: `${b.level * s + 8}px` },
2342
- className: S(
2340
+ onContextMenu: (f) => g(f, N),
2341
+ style: { paddingLeft: `${N.level * s + 8}px` },
2342
+ className: L(
2343
2343
  "flex items-center py-1 px-2 cursor-pointer hover:bg-accent hover:text-accent-foreground select-none text-xs",
2344
2344
  "transition-colors duration-150 relative focus:outline-none focus:ring-1 focus:ring-ring",
2345
- f === b.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
2346
- b.className
2345
+ x === N.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
2346
+ N.className
2347
2347
  ),
2348
2348
  children: [
2349
- /* @__PURE__ */ r("div", { className: "w-4 h-4 mr-1 flex items-center justify-center shrink-0", children: y && (b.isOpen ? /* @__PURE__ */ r(Ce, { size: 14 }) : /* @__PURE__ */ r(we, { size: 14 })) }),
2350
- b.icon && /* @__PURE__ */ r("div", { className: "mr-2 flex items-center shrink-0", children: b.icon }),
2351
- /* @__PURE__ */ r("span", { className: "truncate", children: b.label })
2349
+ /* @__PURE__ */ o("div", { className: "w-4 h-4 mr-1 flex items-center justify-center shrink-0", children: w && (N.isOpen ? /* @__PURE__ */ o(Fe, { size: 14 }) : /* @__PURE__ */ o(Pe, { size: 14 })) }),
2350
+ N.icon && /* @__PURE__ */ o("div", { className: "mr-2 flex items-center shrink-0", children: N.icon }),
2351
+ /* @__PURE__ */ o("span", { className: "truncate", children: N.label })
2352
2352
  ]
2353
2353
  },
2354
- b.id
2354
+ N.id
2355
2355
  );
2356
2356
  };
2357
- return /* @__PURE__ */ c(
2357
+ return /* @__PURE__ */ p(
2358
2358
  "div",
2359
2359
  {
2360
2360
  role: "tree",
2361
- "aria-label": u,
2362
- className: S("h-full w-full bg-muted/30", i),
2363
- onContextMenu: (x) => w(x, null),
2361
+ "aria-label": d,
2362
+ className: L("h-full w-full bg-muted/30", l),
2363
+ onContextMenu: (b) => g(b, null),
2364
2364
  children: [
2365
- l ? /* @__PURE__ */ r(
2366
- qe,
2365
+ i ? /* @__PURE__ */ o(
2366
+ bt,
2367
2367
  {
2368
2368
  style: { height: "100%" },
2369
- totalCount: N.length,
2370
- itemContent: h
2369
+ totalCount: T.length,
2370
+ itemContent: m
2371
2371
  }
2372
- ) : /* @__PURE__ */ r("div", { className: "h-full overflow-auto", children: N.map((x, b) => h(b)) }),
2373
- d && k.length > 0 && /* @__PURE__ */ r(
2374
- Pt,
2372
+ ) : /* @__PURE__ */ o("div", { className: "h-full overflow-auto", children: T.map((b, N) => m(N)) }),
2373
+ c && E.length > 0 && /* @__PURE__ */ o(
2374
+ nr,
2375
2375
  {
2376
- x: d.x,
2377
- y: d.y,
2378
- items: k,
2379
- onClose: () => m(null)
2376
+ x: c.x,
2377
+ y: c.y,
2378
+ items: E,
2379
+ onClose: () => y(null)
2380
2380
  }
2381
2381
  )
2382
2382
  ]
2383
2383
  }
2384
2384
  );
2385
- };
2385
+ }, de = { width: 180, height: 72 }, We = { x: 0, y: 0, scale: 1 }, q = (t) => {
2386
+ var e, n;
2387
+ return {
2388
+ x: t.position.x,
2389
+ y: t.position.y,
2390
+ width: ((e = t.size) == null ? void 0 : e.width) ?? de.width,
2391
+ height: ((n = t.size) == null ? void 0 : n.height) ?? de.height
2392
+ };
2393
+ }, Y = (t) => ({
2394
+ x: t.x + t.width / 2,
2395
+ y: t.y + t.height / 2
2396
+ }), be = (t, e) => ({
2397
+ x: (t.x - e.x) / e.scale,
2398
+ y: (t.y - e.y) / e.scale
2399
+ }), jr = (t, e) => ({
2400
+ x: t.x * e.scale + e.x,
2401
+ y: t.y * e.scale + e.y
2402
+ }), Ie = (t, e, n) => {
2403
+ const r = be(e, t);
2404
+ return {
2405
+ scale: n,
2406
+ x: e.x - r.x * n,
2407
+ y: e.y - r.y * n
2408
+ };
2409
+ }, ye = (t, e = 0.1, n = 4) => Math.min(n, Math.max(e, t)), Le = (t, e) => {
2410
+ const n = Y(t);
2411
+ switch (e) {
2412
+ case "top":
2413
+ return { x: n.x, y: t.y };
2414
+ case "bottom":
2415
+ return { x: n.x, y: t.y + t.height };
2416
+ case "left":
2417
+ return { x: t.x, y: n.y };
2418
+ case "right":
2419
+ return { x: t.x + t.width, y: n.y };
2420
+ }
2421
+ }, sr = (t, e) => {
2422
+ const n = Y(t), r = Y(e), a = r.x - n.x, s = r.y - n.y;
2423
+ return Math.abs(a) >= Math.abs(s) ? a >= 0 ? { source: "right", target: "left" } : { source: "left", target: "right" } : s >= 0 ? { source: "bottom", target: "top" } : { source: "top", target: "bottom" };
2424
+ }, Ge = (t) => {
2425
+ if (t.length === 0) return null;
2426
+ const e = t.map(q), n = Math.min(...e.map((i) => i.x)), r = Math.min(...e.map((i) => i.y)), a = Math.max(...e.map((i) => i.x + i.width)), s = Math.max(...e.map((i) => i.y + i.height));
2427
+ return { x: n, y: r, width: a - n, height: s - r };
2428
+ }, ar = (t, e) => ({
2429
+ // Written as a subtraction rather than `-viewport.x / scale` so a pan of zero
2430
+ // yields +0 rather than -0, which otherwise leaks into equality checks.
2431
+ x: (0 - t.x) / t.scale,
2432
+ y: (0 - t.y) / t.scale,
2433
+ width: e.width / t.scale,
2434
+ height: e.height / t.scale
2435
+ }), Me = (t, e, n) => ({
2436
+ scale: n,
2437
+ x: e.width / 2 - t.x * n,
2438
+ y: e.height / 2 - t.y * n
2439
+ }), ir = (t, e) => {
2440
+ const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
2441
+ return {
2442
+ x: n,
2443
+ y: r,
2444
+ width: Math.max(t.x + t.width, e.x + e.width) - n,
2445
+ height: Math.max(t.y + t.height, e.y + e.height) - r
2446
+ };
2447
+ }, lr = (t, e, n = 48) => {
2448
+ const r = Ge(t);
2449
+ if (!r || e.width === 0 || e.height === 0) return We;
2450
+ const a = ye(
2451
+ Math.min(
2452
+ (e.width - n * 2) / Math.max(r.width, 1),
2453
+ (e.height - n * 2) / Math.max(r.height, 1)
2454
+ )
2455
+ ), s = Y(r);
2456
+ return {
2457
+ scale: a,
2458
+ x: e.width / 2 - s.x * a,
2459
+ y: e.height / 2 - s.y * a
2460
+ };
2461
+ }, Ye = {
2462
+ up: { x: 0, y: -1 },
2463
+ down: { x: 0, y: 1 },
2464
+ left: { x: -1, y: 0 },
2465
+ right: { x: 1, y: 0 }
2466
+ }, he = (t, e, n) => {
2467
+ const r = t.find((d) => d.id === e);
2468
+ if (!r) return null;
2469
+ const a = Y(q(r)), s = Ye[n];
2470
+ let i = null;
2471
+ for (const d of t) {
2472
+ if (d.id === e) continue;
2473
+ const l = Y(q(d)), c = l.x - a.x, y = l.y - a.y, x = c * s.x + y * s.y;
2474
+ if (x <= 0) continue;
2475
+ const h = Math.abs(c * s.y - y * s.x);
2476
+ if (h > x * 2) continue;
2477
+ const T = x + h * 2;
2478
+ (!i || T < i.score) && (i = { node: d, score: T });
2479
+ }
2480
+ return (i == null ? void 0 : i.node) ?? null;
2481
+ }, cr = (t, e, n, r = 64) => {
2482
+ const a = t.find((c) => c.id === e);
2483
+ if (!a) return { x: 0, y: 0 };
2484
+ const s = q(a), i = Ye[n], d = {
2485
+ x: i.x * (s.width + r),
2486
+ y: i.y * (s.height + r)
2487
+ };
2488
+ let l = { x: s.x + d.x, y: s.y + d.y };
2489
+ for (let c = 0; c < 24; c += 1) {
2490
+ const y = { ...l, width: s.width, height: s.height };
2491
+ if (!t.some((h) => dr(q(h), y))) break;
2492
+ l = i.x !== 0 ? { x: l.x, y: l.y + s.height + r } : { x: l.x + s.width + r, y: l.y };
2493
+ }
2494
+ return l;
2495
+ }, dr = (t, e) => t.x < e.x + e.width && t.x + t.width > e.x && t.y < e.y + e.height && t.y + t.height > e.y, Br = (t, e) => t.filter((n) => n.source === e || n.target === e), Hr = (t, e, n) => t.some(
2496
+ (r) => r.source === e && r.target === n || r.source === n && r.target === e
2497
+ ), Wr = (t, e, n) => ({
2498
+ nodes: t.filter((r) => r.id !== n),
2499
+ edges: e.filter((r) => r.source !== n && r.target !== n)
2500
+ }), Gr = (t, e) => {
2501
+ let n = e.length + 1;
2502
+ const r = new Set(e.map((a) => a.id));
2503
+ for (; r.has(`${t}-${n}`); ) n += 1;
2504
+ return `${t}-${n}`;
2505
+ }, ur = Qe(
2506
+ ({
2507
+ children: t,
2508
+ overlay: e,
2509
+ viewport: n,
2510
+ defaultViewport: r = We,
2511
+ onViewportChange: a,
2512
+ onSizeChange: s,
2513
+ onCanvasClick: i,
2514
+ onCanvasDoubleClick: d,
2515
+ onCanvasContextMenu: l,
2516
+ onDrop: c,
2517
+ grid: y = !0,
2518
+ gridSize: x = 24,
2519
+ minScale: h = 0.1,
2520
+ maxScale: T = 4,
2521
+ pannable: E = !0,
2522
+ zoomable: g = !0,
2523
+ "aria-label": m = "Graph canvas",
2524
+ className: b
2525
+ }, N) => {
2526
+ const w = F(null), [f, D] = R(r), [M, A] = R(!1), [C, S] = R(!1), u = n ?? f, k = F(u);
2527
+ k.current = u;
2528
+ const I = ee(
2529
+ (v) => {
2530
+ n || D(v), a == null || a(v);
2531
+ },
2532
+ [n, a]
2533
+ ), z = ee((v) => {
2534
+ var $;
2535
+ const P = ($ = w.current) == null ? void 0 : $.getBoundingClientRect();
2536
+ return P ? { x: v.x - P.left, y: v.y - P.top } : v;
2537
+ }, []);
2538
+ O(() => {
2539
+ const v = w.current;
2540
+ if (!v || !s) return;
2541
+ const P = () => {
2542
+ const U = v.getBoundingClientRect();
2543
+ s({ width: U.width, height: U.height });
2544
+ };
2545
+ P();
2546
+ const $ = new ResizeObserver(P);
2547
+ return $.observe(v), () => $.disconnect();
2548
+ }, [s]), O(() => {
2549
+ const v = w.current;
2550
+ if (!v || !g) return;
2551
+ const P = ($) => {
2552
+ $.preventDefault();
2553
+ const U = k.current, H = z({ x: $.clientX, y: $.clientY }), le = $.ctrlKey ? 0.01 : 2e-3, ce = ye(
2554
+ U.scale * Math.exp(-$.deltaY * le),
2555
+ h,
2556
+ T
2557
+ );
2558
+ I(Ie(U, H, ce));
2559
+ };
2560
+ return v.addEventListener("wheel", P, { passive: !1 }), () => v.removeEventListener("wheel", P);
2561
+ }, [g, h, T, I, z]), O(() => {
2562
+ if (!E) return;
2563
+ const v = ($) => {
2564
+ var H;
2565
+ if ($.code !== "Space") return;
2566
+ const U = $.target;
2567
+ U != null && U.closest('input, textarea, [contenteditable="true"]') || (H = w.current) != null && H.contains(document.activeElement) && ($.preventDefault(), S(!0));
2568
+ }, P = ($) => {
2569
+ $.code === "Space" && S(!1);
2570
+ };
2571
+ return window.addEventListener("keydown", v), window.addEventListener("keyup", P), () => {
2572
+ window.removeEventListener("keydown", v), window.removeEventListener("keyup", P);
2573
+ };
2574
+ }, [E]);
2575
+ const _ = (v) => {
2576
+ if (!E) return;
2577
+ const P = v.target === v.currentTarget, $ = v.button === 1;
2578
+ if (!P && !$ && !C || v.button !== 0 && !$) return;
2579
+ v.preventDefault(), A(!0);
2580
+ const U = { x: v.clientX, y: v.clientY }, H = { ...k.current }, le = (Ne) => {
2581
+ I({
2582
+ ...H,
2583
+ x: H.x + (Ne.clientX - U.x),
2584
+ y: H.y + (Ne.clientY - U.y)
2585
+ });
2586
+ }, ce = () => {
2587
+ A(!1), window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", ce);
2588
+ };
2589
+ window.addEventListener("pointermove", le), window.addEventListener("pointerup", ce);
2590
+ };
2591
+ Ze(
2592
+ N,
2593
+ () => ({
2594
+ getViewport: () => k.current,
2595
+ setViewport: I,
2596
+ fitTo: (v, P) => {
2597
+ var U;
2598
+ const $ = (U = w.current) == null ? void 0 : U.getBoundingClientRect();
2599
+ $ && I(lr(v, { width: $.width, height: $.height }, P));
2600
+ },
2601
+ zoomBy: (v) => {
2602
+ var H;
2603
+ const P = (H = w.current) == null ? void 0 : H.getBoundingClientRect();
2604
+ if (!P) return;
2605
+ const $ = { x: P.width / 2, y: P.height / 2 }, U = ye(
2606
+ k.current.scale * v,
2607
+ h,
2608
+ T
2609
+ );
2610
+ I(Ie(k.current, $, U));
2611
+ },
2612
+ clientToGraph: (v) => be(z(v), k.current),
2613
+ getSize: () => {
2614
+ var P;
2615
+ const v = (P = w.current) == null ? void 0 : P.getBoundingClientRect();
2616
+ return { width: (v == null ? void 0 : v.width) ?? 0, height: (v == null ? void 0 : v.height) ?? 0 };
2617
+ },
2618
+ focus: () => {
2619
+ var v;
2620
+ return (v = w.current) == null ? void 0 : v.focus();
2621
+ }
2622
+ }),
2623
+ [I, h, T, z]
2624
+ );
2625
+ const K = (v) => be(z({ x: v.clientX, y: v.clientY }), u), j = (v) => v.target === v.currentTarget;
2626
+ return /* @__PURE__ */ p(
2627
+ "div",
2628
+ {
2629
+ ref: w,
2630
+ role: "application",
2631
+ "aria-label": m,
2632
+ tabIndex: 0,
2633
+ onPointerDown: _,
2634
+ onClick: (v) => j(v) && (i == null ? void 0 : i(K(v), v)),
2635
+ onDoubleClick: (v) => j(v) && (d == null ? void 0 : d(K(v), v)),
2636
+ onContextMenu: (v) => {
2637
+ !l || !j(v) || (v.preventDefault(), l(K(v), v));
2638
+ },
2639
+ onDragOver: (v) => {
2640
+ c && (v.preventDefault(), v.dataTransfer.dropEffect = "copy");
2641
+ },
2642
+ onDrop: (v) => {
2643
+ c && (v.preventDefault(), c(K(v), v));
2644
+ },
2645
+ style: y ? {
2646
+ // The grid is painted on the element rather than inside the
2647
+ // transformed layer, so it can be infinite without needing a
2648
+ // giant element behind it.
2649
+ backgroundImage: "radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)",
2650
+ backgroundSize: `${x * u.scale}px ${x * u.scale}px`,
2651
+ backgroundPosition: `${u.x}px ${u.y}px`
2652
+ } : void 0,
2653
+ className: L(
2654
+ "relative w-full h-full overflow-hidden bg-background outline-none",
2655
+ "focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
2656
+ C || M ? "cursor-grabbing" : "cursor-grab",
2657
+ b
2658
+ ),
2659
+ children: [
2660
+ /* @__PURE__ */ o(
2661
+ "div",
2662
+ {
2663
+ style: {
2664
+ transform: `translate(${u.x}px, ${u.y}px) scale(${u.scale})`,
2665
+ transformOrigin: "0 0",
2666
+ willChange: "transform"
2667
+ },
2668
+ className: "absolute inset-0 pointer-events-none [&>*]:pointer-events-auto",
2669
+ children: t
2670
+ }
2671
+ ),
2672
+ e && /* @__PURE__ */ o("div", { className: "absolute inset-0 pointer-events-none [&>*]:pointer-events-auto", children: e })
2673
+ ]
2674
+ }
2675
+ );
2676
+ }
2677
+ );
2678
+ ur.displayName = "GraphCanvas";
2679
+ const fr = ["top", "right", "bottom", "left"], mr = {
2680
+ top: "left-1/2 -translate-x-1/2 -top-1.5",
2681
+ bottom: "left-1/2 -translate-x-1/2 -bottom-1.5",
2682
+ left: "top-1/2 -translate-y-1/2 -left-1.5",
2683
+ right: "top-1/2 -translate-y-1/2 -right-1.5"
2684
+ }, Yr = ({
2685
+ node: t,
2686
+ children: e,
2687
+ onMove: n,
2688
+ onMoveEnd: r,
2689
+ onSelect: a,
2690
+ onActivate: s,
2691
+ onContextMenu: i,
2692
+ onConnectStart: d,
2693
+ onConnectEnd: l,
2694
+ selected: c = !1,
2695
+ focused: y = !1,
2696
+ ports: x = !0,
2697
+ draggable: h = !0,
2698
+ className: T
2699
+ }) => {
2700
+ var N, w;
2701
+ const E = F(!1), g = ((N = t.size) == null ? void 0 : N.width) ?? de.width, m = ((w = t.size) == null ? void 0 : w.height) ?? de.height, b = (f) => {
2702
+ if (!h || !n || f.button !== 0 || f.nativeEvent.shiftKey) return;
2703
+ f.stopPropagation(), E.current = !1;
2704
+ const D = { x: f.clientX, y: f.clientY }, M = { ...t.position }, A = pr(f.currentTarget);
2705
+ let C = M;
2706
+ const S = (k) => {
2707
+ const I = (k.clientX - D.x) / A, z = (k.clientY - D.y) / A;
2708
+ (Math.abs(I) > 1 || Math.abs(z) > 1) && (E.current = !0), C = { x: M.x + I, y: M.y + z }, n(t.id, C);
2709
+ }, u = () => {
2710
+ E.current && (r == null || r(t.id, C)), window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", u);
2711
+ };
2712
+ window.addEventListener("pointermove", S), window.addEventListener("pointerup", u);
2713
+ };
2714
+ return /* @__PURE__ */ p(
2715
+ "div",
2716
+ {
2717
+ "data-graph-node": t.id,
2718
+ role: "button",
2719
+ tabIndex: -1,
2720
+ "aria-pressed": c,
2721
+ style: {
2722
+ position: "absolute",
2723
+ left: t.position.x,
2724
+ top: t.position.y,
2725
+ width: g,
2726
+ height: m
2727
+ },
2728
+ onPointerDown: b,
2729
+ onClick: (f) => {
2730
+ f.stopPropagation(), E.current || a == null || a(t.id, f);
2731
+ },
2732
+ onDoubleClick: (f) => {
2733
+ f.stopPropagation(), s == null || s(t.id);
2734
+ },
2735
+ onContextMenu: (f) => {
2736
+ i && (f.preventDefault(), f.stopPropagation(), i(t.id, { x: f.clientX, y: f.clientY }, f));
2737
+ },
2738
+ onPointerUp: () => l == null ? void 0 : l(t.id),
2739
+ className: L(
2740
+ "group rounded-lg border bg-card text-card-foreground shadow-sm select-none",
2741
+ "flex flex-col overflow-hidden transition-shadow",
2742
+ h && n && "cursor-grab active:cursor-grabbing",
2743
+ c ? "border-primary shadow-md" : "border-border",
2744
+ // Focus is the keyboard cursor: it must be visible even when the node
2745
+ // is also selected, so it gets a ring rather than a border change.
2746
+ y && "ring-2 ring-ring ring-offset-1 ring-offset-background",
2747
+ T
2748
+ ),
2749
+ children: [
2750
+ e,
2751
+ x && d && fr.map((f) => /* @__PURE__ */ o(
2752
+ "button",
2753
+ {
2754
+ type: "button",
2755
+ tabIndex: -1,
2756
+ "aria-label": `Connect from ${f}`,
2757
+ onPointerDown: (D) => {
2758
+ D.stopPropagation(), d(t.id, f);
2759
+ },
2760
+ className: L(
2761
+ "absolute w-3 h-3 rounded-full border-2 border-background bg-primary",
2762
+ "opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity",
2763
+ y && "opacity-100",
2764
+ mr[f]
2765
+ )
2766
+ },
2767
+ f
2768
+ ))
2769
+ ]
2770
+ }
2771
+ );
2772
+ }, pr = (t) => {
2773
+ let e = t.parentElement;
2774
+ for (; e; ) {
2775
+ const n = window.getComputedStyle(e).transform;
2776
+ if (n && n !== "none") {
2777
+ const r = /matrix\(([^,]+),/.exec(n), a = r ? parseFloat(r[1]) : NaN;
2778
+ if (Number.isFinite(a) && a !== 0) return a;
2779
+ }
2780
+ e = e.parentElement;
2781
+ }
2782
+ return 1;
2783
+ }, hr = (t, e, n, r) => {
2784
+ if (r === "straight")
2785
+ return `M ${t.x} ${t.y} L ${e.x} ${e.y}`;
2786
+ const a = n === "left" || n === "right";
2787
+ if (r === "smoothstep") {
2788
+ const c = a ? (t.x + e.x) / 2 : (t.y + e.y) / 2;
2789
+ return a ? `M ${t.x} ${t.y} L ${c} ${t.y} L ${c} ${e.y} L ${e.x} ${e.y}` : `M ${t.x} ${t.y} L ${t.x} ${c} L ${e.x} ${c} L ${e.x} ${e.y}`;
2790
+ }
2791
+ const s = Math.hypot(e.x - t.x, e.y - t.y), i = Math.min(Math.max(s / 2, 24), 160), d = a ? { x: t.x + (n === "right" ? i : -i), y: t.y } : { x: t.x, y: t.y + (n === "bottom" ? i : -i) }, l = a ? { x: e.x - (n === "right" ? i : -i), y: e.y } : { x: e.x, y: e.y - (n === "bottom" ? i : -i) };
2792
+ return `M ${t.x} ${t.y} C ${d.x} ${d.y}, ${l.x} ${l.y}, ${e.x} ${e.y}`;
2793
+ }, Jr = ({
2794
+ edge: t,
2795
+ source: e,
2796
+ target: n,
2797
+ routing: r = "bezier",
2798
+ selected: a = !1,
2799
+ arrow: s = !0,
2800
+ onSelect: i,
2801
+ onContextMenu: d,
2802
+ className: l
2803
+ }) => {
2804
+ const c = q(e), y = q(n), x = sr(c, y), h = Le(c, x.source), T = Le(y, x.target), E = hr(h, T, x.source, r), g = { x: (h.x + T.x) / 2, y: (h.y + T.y) / 2 }, m = !!(i || d);
2805
+ return /* @__PURE__ */ p(
2806
+ "g",
2807
+ {
2808
+ "data-graph-edge": t.id,
2809
+ className: L(m && "cursor-pointer"),
2810
+ onClick: (b) => {
2811
+ i && (b.stopPropagation(), i(t.id, b));
2812
+ },
2813
+ onContextMenu: (b) => {
2814
+ d && (b.preventDefault(), b.stopPropagation(), d(t.id, { x: b.clientX, y: b.clientY }, b));
2815
+ },
2816
+ children: [
2817
+ m && /* @__PURE__ */ o("path", { d: E, fill: "none", stroke: "transparent", strokeWidth: 16 }),
2818
+ /* @__PURE__ */ o(
2819
+ "path",
2820
+ {
2821
+ d: E,
2822
+ fill: "none",
2823
+ strokeWidth: a ? 2.5 : 1.5,
2824
+ markerEnd: s ? "url(#nexus-graph-arrow)" : void 0,
2825
+ className: L(
2826
+ "transition-[stroke]",
2827
+ a ? "stroke-primary" : "stroke-border",
2828
+ l
2829
+ )
2830
+ }
2831
+ ),
2832
+ t.label && /* @__PURE__ */ o(
2833
+ "text",
2834
+ {
2835
+ x: g.x,
2836
+ y: g.y,
2837
+ textAnchor: "middle",
2838
+ dominantBaseline: "middle",
2839
+ className: "fill-muted-foreground text-[10px] font-medium select-none",
2840
+ style: { paintOrder: "stroke", stroke: "hsl(var(--background))", strokeWidth: 4 },
2841
+ children: t.label
2842
+ }
2843
+ )
2844
+ ]
2845
+ }
2846
+ );
2847
+ }, Xr = ({ children: t, className: e }) => /* @__PURE__ */ p(
2848
+ "svg",
2849
+ {
2850
+ style: { position: "absolute", left: -5e4, top: -5e4, overflow: "visible" },
2851
+ width: 1e5,
2852
+ height: 1e5,
2853
+ viewBox: "-50000 -50000 100000 100000",
2854
+ className: L("pointer-events-none [&_g]:pointer-events-auto", e),
2855
+ children: [
2856
+ /* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o(
2857
+ "marker",
2858
+ {
2859
+ id: "nexus-graph-arrow",
2860
+ viewBox: "0 0 10 10",
2861
+ refX: 9,
2862
+ refY: 5,
2863
+ markerWidth: 6,
2864
+ markerHeight: 6,
2865
+ orient: "auto-start-reverse",
2866
+ children: /* @__PURE__ */ o("path", { d: "M 0 0 L 10 5 L 0 10 z", className: "fill-border" })
2867
+ }
2868
+ ) }),
2869
+ t
2870
+ ]
2871
+ }
2872
+ ), qr = {
2873
+ /** Move focus to the nearest node in a direction. */
2874
+ moveFocus: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
2875
+ /** Create a connected node in a direction. */
2876
+ createConnected: "Tab",
2877
+ /** Edit the focused node. */
2878
+ edit: "Enter",
2879
+ /** Leave edit mode, cancel a pending connection, or clear focus. */
2880
+ cancel: "Escape",
2881
+ /** Delete the focused node. */
2882
+ delete: ["Delete", "Backspace"],
2883
+ /** Begin connecting from the focused node. */
2884
+ connect: "c",
2885
+ /** Nudge the focused node. Held with the arrow keys. */
2886
+ nudgeModifier: "shiftKey"
2887
+ }, gr = {
2888
+ ArrowUp: "up",
2889
+ ArrowDown: "down",
2890
+ ArrowLeft: "left",
2891
+ ArrowRight: "right"
2892
+ }, Vr = ({
2893
+ nodes: t,
2894
+ edges: e,
2895
+ focusedId: n,
2896
+ defaultFocusedId: r = null,
2897
+ onFocusChange: a,
2898
+ targetRef: s,
2899
+ nudgeDistance: i = 16,
2900
+ disabled: d = !1,
2901
+ onCreateNode: l,
2902
+ onConnect: c,
2903
+ onDeleteNode: y,
2904
+ onMoveNode: x,
2905
+ onEditNode: h
2906
+ }) => {
2907
+ const [T, E] = R(
2908
+ r
2909
+ ), [g, m] = R(null), [b, N] = R(null), w = n !== void 0 ? n : T, f = ee(
2910
+ (C) => {
2911
+ n === void 0 && E(C), a == null || a(C);
2912
+ },
2913
+ [n, a]
2914
+ ), D = F({
2915
+ nodes: t,
2916
+ edges: e,
2917
+ focusedId: w,
2918
+ editingId: g,
2919
+ connectingFrom: b
2920
+ });
2921
+ D.current = { nodes: t, edges: e, focusedId: w, editingId: g, connectingFrom: b };
2922
+ const M = ee(
2923
+ (C) => {
2924
+ const { nodes: S, focusedId: u } = D.current;
2925
+ if (S.length === 0) return;
2926
+ if (!u) {
2927
+ f(S[0].id);
2928
+ return;
2929
+ }
2930
+ const k = he(S, u, C);
2931
+ k && f(k.id);
2932
+ },
2933
+ [f]
2934
+ ), A = ee(
2935
+ (C = "right") => {
2936
+ const { nodes: S, focusedId: u } = D.current;
2937
+ if (!l) return;
2938
+ const k = u ? cr(S, u, C) : { x: 0, y: 0 }, I = l(k, { from: u ?? void 0, direction: C });
2939
+ I && (u && (c == null || c(u, I)), f(I), m(I));
2940
+ },
2941
+ [l, c, f]
2942
+ );
2943
+ return O(() => {
2944
+ if (d) return;
2945
+ const C = s.current;
2946
+ if (!C) return;
2947
+ const S = (u) => {
2948
+ const { focusedId: k, editingId: I, connectingFrom: z } = D.current;
2949
+ if (I) {
2950
+ u.key === "Escape" && (u.preventDefault(), m(null));
2951
+ return;
2952
+ }
2953
+ const _ = u.target;
2954
+ if (_ != null && _.closest('input, textarea, select, [contenteditable="true"]')) return;
2955
+ const K = gr[u.key];
2956
+ if (K) {
2957
+ u.preventDefault();
2958
+ const j = D.current.nodes.find((v) => v.id === k);
2959
+ if (u.shiftKey && j && x) {
2960
+ const v = {
2961
+ up: { x: 0, y: -i },
2962
+ down: { x: 0, y: i },
2963
+ left: { x: -i, y: 0 },
2964
+ right: { x: i, y: 0 }
2965
+ }[K];
2966
+ x(j.id, {
2967
+ x: j.position.x + v.x,
2968
+ y: j.position.y + v.y
2969
+ });
2970
+ return;
2971
+ }
2972
+ M(K);
2973
+ return;
2974
+ }
2975
+ switch (u.key) {
2976
+ case "Tab": {
2977
+ if (!l) return;
2978
+ u.preventDefault(), A(u.shiftKey ? "left" : "right");
2979
+ return;
2980
+ }
2981
+ case "Enter": {
2982
+ if (!k) return;
2983
+ if (u.preventDefault(), z && z !== k) {
2984
+ c == null || c(z, k), N(null);
2985
+ return;
2986
+ }
2987
+ h == null || h(k), m(k);
2988
+ return;
2989
+ }
2990
+ case "Escape": {
2991
+ u.preventDefault(), z ? N(null) : f(null);
2992
+ return;
2993
+ }
2994
+ case "Delete":
2995
+ case "Backspace": {
2996
+ if (!k || !y) return;
2997
+ u.preventDefault();
2998
+ const j = D.current.nodes.filter((P) => P.id !== k), v = he(D.current.nodes, k, "left") ?? he(D.current.nodes, k, "right") ?? j[0] ?? null;
2999
+ y(k), f((v == null ? void 0 : v.id) ?? null);
3000
+ return;
3001
+ }
3002
+ case "c":
3003
+ case "C": {
3004
+ if (!k || !c || u.metaKey || u.ctrlKey) return;
3005
+ u.preventDefault(), N(z === k ? null : k);
3006
+ return;
3007
+ }
3008
+ }
3009
+ };
3010
+ return C.addEventListener("keydown", S), () => C.removeEventListener("keydown", S);
3011
+ }, [
3012
+ d,
3013
+ s,
3014
+ M,
3015
+ A,
3016
+ i,
3017
+ c,
3018
+ l,
3019
+ y,
3020
+ h,
3021
+ x,
3022
+ f
3023
+ ]), O(() => {
3024
+ w && !t.some((C) => C.id === w) && f(null), g && !t.some((C) => C.id === g) && m(null), b && !t.some((C) => C.id === b) && N(null);
3025
+ }, [t, w, g, b, f]), B(
3026
+ () => ({
3027
+ focusedId: w,
3028
+ setFocusedId: f,
3029
+ editingId: g,
3030
+ setEditingId: m,
3031
+ connectingFrom: b,
3032
+ setConnectingFrom: N,
3033
+ moveFocus: M,
3034
+ createConnected: A
3035
+ }),
3036
+ [w, f, g, b, M, A]
3037
+ );
3038
+ }, Qr = ({
3039
+ nodes: t,
3040
+ viewport: e,
3041
+ canvasSize: n,
3042
+ onViewportChange: r,
3043
+ width: a = 180,
3044
+ height: s = 120,
3045
+ nodeColor: i,
3046
+ highlightIds: d,
3047
+ padding: l = 8,
3048
+ panDistance: c = 80,
3049
+ "aria-label": y = "Graph minimap",
3050
+ className: x
3051
+ }) => {
3052
+ const h = F(null), T = B(() => new Set(d ?? []), [d]), E = ar(e, n), g = B(() => {
3053
+ const S = Ge(t);
3054
+ return S ? ir(S, E) : E;
3055
+ }, [t, E.x, E.y, E.width, E.height]), m = Math.min(
3056
+ (a - l * 2) / Math.max(g.width, 1),
3057
+ (s - l * 2) / Math.max(g.height, 1)
3058
+ ), b = {
3059
+ x: (a - g.width * m) / 2 - g.x * m,
3060
+ y: (s - g.height * m) / 2 - g.y * m
3061
+ }, N = (S) => ({
3062
+ x: S.x * m + b.x,
3063
+ y: S.y * m + b.y
3064
+ }), w = (S) => ({
3065
+ x: (S.x - b.x) / m,
3066
+ y: (S.y - b.y) / m
3067
+ }), f = ee(
3068
+ (S) => {
3069
+ var I;
3070
+ if (!r) return;
3071
+ const u = (I = h.current) == null ? void 0 : I.getBoundingClientRect();
3072
+ if (!u) return;
3073
+ const k = w({ x: S.x - u.left, y: S.y - u.top });
3074
+ r(Me(k, n, e.scale));
3075
+ },
3076
+ [r, n, e.scale, m, b.x, b.y]
3077
+ ), D = (S) => {
3078
+ var I;
3079
+ if (!r || S.button !== 0) return;
3080
+ S.preventDefault(), (I = h.current) == null || I.focus(), f({ x: S.clientX, y: S.clientY });
3081
+ const u = (z) => f({ x: z.clientX, y: z.clientY }), k = () => {
3082
+ window.removeEventListener("pointermove", u), window.removeEventListener("pointerup", k);
3083
+ };
3084
+ window.addEventListener("pointermove", u), window.addEventListener("pointerup", k);
3085
+ }, M = (S) => {
3086
+ if (!r) return;
3087
+ const u = {
3088
+ ArrowUp: { x: 0, y: -c },
3089
+ ArrowDown: { x: 0, y: c },
3090
+ ArrowLeft: { x: -c, y: 0 },
3091
+ ArrowRight: { x: c, y: 0 }
3092
+ }[S.key];
3093
+ if (!u) return;
3094
+ S.preventDefault();
3095
+ const k = Y(E);
3096
+ r(
3097
+ Me({ x: k.x + u.x, y: k.y + u.y }, n, e.scale)
3098
+ );
3099
+ }, A = {
3100
+ x: N(E).x,
3101
+ y: N(E).y,
3102
+ width: E.width * m,
3103
+ height: E.height * m
3104
+ }, C = !!r;
3105
+ return /* @__PURE__ */ o(
3106
+ "div",
3107
+ {
3108
+ ref: h,
3109
+ role: C ? "slider" : "img",
3110
+ "aria-label": y,
3111
+ "aria-valuetext": t.length === 0 ? "Empty graph" : `${t.length} nodes, viewing around ${Math.round(Y(E).x)}, ${Math.round(Y(E).y)}`,
3112
+ tabIndex: C ? 0 : void 0,
3113
+ onPointerDown: D,
3114
+ onKeyDown: M,
3115
+ style: { width: a, height: s },
3116
+ className: L(
3117
+ "rounded-lg border border-border bg-card/90 backdrop-blur-sm shadow-sm overflow-hidden",
3118
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3119
+ C && "cursor-pointer",
3120
+ x
3121
+ ),
3122
+ children: /* @__PURE__ */ p("svg", { width: a, height: s, className: "block", children: [
3123
+ t.map((S) => {
3124
+ const u = q(S), k = N(u), I = T.has(S.id);
3125
+ return /* @__PURE__ */ o(
3126
+ "rect",
3127
+ {
3128
+ x: k.x,
3129
+ y: k.y,
3130
+ width: Math.max(u.width * m, 2),
3131
+ height: Math.max(u.height * m, 2),
3132
+ rx: 1,
3133
+ fill: I || i == null ? void 0 : i(S),
3134
+ className: L(
3135
+ !i && !I && "fill-muted-foreground/50",
3136
+ I && "fill-primary"
3137
+ )
3138
+ },
3139
+ S.id
3140
+ );
3141
+ }),
3142
+ n.width > 0 && /* @__PURE__ */ o(
3143
+ "rect",
3144
+ {
3145
+ x: A.x,
3146
+ y: A.y,
3147
+ width: Math.max(A.width, 4),
3148
+ height: Math.max(A.height, 4),
3149
+ rx: 2,
3150
+ className: "fill-primary/10 stroke-primary",
3151
+ strokeWidth: 1.5
3152
+ }
3153
+ )
3154
+ ] })
3155
+ }
3156
+ );
3157
+ }, Je = "application/x-nexus-graph-node", Zr = ({
3158
+ items: t,
3159
+ onSelect: e,
3160
+ onDragStart: n,
3161
+ orientation: r = "auto",
3162
+ onOrientationChange: a,
3163
+ iconOnly: s = !1,
3164
+ className: i,
3165
+ "aria-label": d = "Node palette"
3166
+ }) => {
3167
+ const l = F(null), [c, y] = R("horizontal"), x = r === "auto" ? c : r, h = F(a);
3168
+ h.current = a;
3169
+ const T = ee(() => {
3170
+ const g = l.current;
3171
+ if (!g) return;
3172
+ const m = [...g.querySelectorAll("[data-palette-item]")];
3173
+ if (m.length === 0) return;
3174
+ const b = window.getComputedStyle(g), N = parseFloat(b.gap) || 0, w = (parseFloat(b.paddingLeft) || 0) + (parseFloat(b.paddingRight) || 0), f = m.reduce((S, u) => S + u.offsetWidth, 0) + N * (m.length - 1) + w, D = m.reduce((S, u) => S + u.offsetHeight, 0) + N * (m.length - 1) + w, M = xr(g);
3175
+ if (!M) return;
3176
+ const A = 4, C = f <= M.width + A ? "horizontal" : D <= M.height + A ? "vertical" : "horizontal";
3177
+ y((S) => {
3178
+ var u;
3179
+ return S === C ? S : ((u = h.current) == null || u.call(h, C), C);
3180
+ });
3181
+ }, []);
3182
+ O(() => {
3183
+ if (r !== "auto") return;
3184
+ const g = l.current;
3185
+ if (!g) return;
3186
+ T();
3187
+ const m = new ResizeObserver(T);
3188
+ m.observe(g);
3189
+ const b = Xe(g);
3190
+ return b && b !== g && m.observe(b), () => m.disconnect();
3191
+ }, [r, T, t.length]);
3192
+ const E = x === "vertical";
3193
+ return /* @__PURE__ */ o(
3194
+ "div",
3195
+ {
3196
+ ref: l,
3197
+ role: "toolbar",
3198
+ "aria-label": d,
3199
+ "aria-orientation": x,
3200
+ "data-orientation": x,
3201
+ className: L(
3202
+ "flex gap-1.5 p-1.5 rounded-lg border border-border bg-card/90 backdrop-blur-sm shadow-sm",
3203
+ E ? "flex-col items-stretch" : "flex-wrap items-center",
3204
+ i
3205
+ ),
3206
+ children: t.map((g) => /* @__PURE__ */ p(
3207
+ "button",
3208
+ {
3209
+ type: "button",
3210
+ "data-palette-item": !0,
3211
+ draggable: !0,
3212
+ title: g.description ?? (s ? g.label : void 0),
3213
+ "aria-label": s ? g.label : void 0,
3214
+ onDragStart: (m) => {
3215
+ m.dataTransfer.setData(Je, g.kind), m.dataTransfer.setData("text/plain", g.label), m.dataTransfer.effectAllowed = "copy", n == null || n(g);
3216
+ },
3217
+ onClick: () => e == null ? void 0 : e(g),
3218
+ className: L(
3219
+ "flex items-center gap-1.5 rounded-md text-xs font-medium",
3220
+ "border border-border bg-background text-foreground",
3221
+ "hover:bg-accent hover:text-accent-foreground transition-colors",
3222
+ "cursor-grab active:cursor-grabbing",
3223
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3224
+ s ? "p-2 justify-center" : "px-2.5 py-1.5",
3225
+ // A column reads better left-aligned; a row centres naturally.
3226
+ E && !s && "justify-start"
3227
+ ),
3228
+ children: [
3229
+ g.icon,
3230
+ !s && g.label
3231
+ ]
3232
+ },
3233
+ g.kind
3234
+ ))
3235
+ }
3236
+ );
3237
+ }, Xe = (t) => {
3238
+ let e = t.parentElement;
3239
+ for (let n = 0; e && n < 6; n += 1) {
3240
+ const r = e.getBoundingClientRect(), a = t.getBoundingClientRect();
3241
+ if (r.width > a.width + 8) return e;
3242
+ e = e.parentElement;
3243
+ }
3244
+ return null;
3245
+ }, xr = (t) => {
3246
+ const e = Xe(t);
3247
+ if (!e) return null;
3248
+ const n = window.getComputedStyle(e), r = e.getBoundingClientRect();
3249
+ return {
3250
+ width: r.width - (parseFloat(n.paddingLeft) || 0) - (parseFloat(n.paddingRight) || 0),
3251
+ height: r.height - (parseFloat(n.paddingTop) || 0) - (parseFloat(n.paddingBottom) || 0)
3252
+ };
3253
+ }, en = (t) => t.dataTransfer.getData(Je) || null;
2386
3254
  export {
2387
- Xe as ActivityBar,
2388
- rr as AppTitle,
2389
- X as BUNDLED_THEMES,
2390
- dt as BUNDLED_THEME_CLASSES,
2391
- tt as ChatPane,
2392
- Dt as CommandPalette,
2393
- lt as CommandRegistry,
2394
- Ze as ConnectedActivityBar,
2395
- ot as ConnectedChatPane,
2396
- Xt as ConnectedCommandPalette,
2397
- it as ConnectedMenuBar,
2398
- Zt as ConnectedModal,
2399
- pt as ConnectedSidebarPane,
2400
- ht as ConnectedStatusBar,
2401
- vt as ConnectedTerminalPane,
2402
- er as ConnectedThemeSwitcher,
2403
- tr as ConnectedUserProfile,
2404
- Pt as ContextMenu,
2405
- Vt as DEFAULT_COMMAND_IDS,
2406
- mt as DEFAULT_SETTINGS_THEMES,
2407
- Lt as DEFAULT_THEME_OPTIONS,
2408
- nr as DataGrid,
2409
- st as MenuBar,
2410
- at as MenuRegistry,
2411
- At as Modal,
2412
- Gt as NexusWorkspaceShell,
2413
- or as QuickSearch,
2414
- sr as SearchWidget,
2415
- ft as SettingsPanel,
2416
- Gt as ShellLayout,
2417
- ne as SidebarPane,
2418
- gt as StatusBar,
2419
- bt as TerminalPane,
2420
- Mt as ThemeSwitcher,
2421
- ar as TreeWidget,
2422
- zt as UserProfile,
2423
- S as cn,
2424
- J as commandRegistry,
2425
- wt as componentRegistry,
2426
- Yt as initializeShell,
2427
- le as menuRegistry,
2428
- qt as pluginRegistry,
2429
- ct as themeClass,
2430
- Q as useChatStore,
2431
- Qt as useKeyboardShortcuts,
2432
- Nt as useLayoutStore,
2433
- Ee as useModalStore,
2434
- ae as useRightSidebarStore,
2435
- U as useSidebarStore,
2436
- ie as useStatusBarStore,
2437
- V as useTerminalStore,
2438
- Y as useThemeStore,
2439
- W as useUserProfileStore
3255
+ vt as ActivityBar,
3256
+ zr as AppTitle,
3257
+ ie as BUNDLED_THEMES,
3258
+ Mt as BUNDLED_THEME_CLASSES,
3259
+ kt as ChatPane,
3260
+ qt as CommandPalette,
3261
+ It as CommandRegistry,
3262
+ wt as ConnectedActivityBar,
3263
+ Ct as ConnectedChatPane,
3264
+ $r as ConnectedCommandPalette,
3265
+ Lt as ConnectedMenuBar,
3266
+ Or as ConnectedModal,
3267
+ Pt as ConnectedSidebarPane,
3268
+ Kt as ConnectedStatusBar,
3269
+ Ut as ConnectedTerminalPane,
3270
+ Rr as ConnectedThemeSwitcher,
3271
+ Pr as ConnectedUserProfile,
3272
+ nr as ContextMenu,
3273
+ Ir as DEFAULT_COMMAND_IDS,
3274
+ qr as DEFAULT_GRAPH_KEYS,
3275
+ de as DEFAULT_NODE_SIZE,
3276
+ Ot as DEFAULT_SETTINGS_THEMES,
3277
+ er as DEFAULT_THEME_OPTIONS,
3278
+ Kr as DataGrid,
3279
+ Je as GRAPH_NODE_MIME,
3280
+ ur as GraphCanvas,
3281
+ Jr as GraphEdge,
3282
+ Xr as GraphEdgeLayer,
3283
+ Qr as GraphMiniMap,
3284
+ Yr as GraphNode,
3285
+ We as IDENTITY_VIEWPORT,
3286
+ Dt as MenuBar,
3287
+ St as MenuRegistry,
3288
+ Zt as Modal,
3289
+ Sr as NexusWorkspaceShell,
3290
+ Zr as NodePalette,
3291
+ Fr as QuickSearch,
3292
+ _r as SearchWidget,
3293
+ Rt as SettingsPanel,
3294
+ Sr as ShellLayout,
3295
+ me as SidebarPane,
3296
+ zt as StatusBar,
3297
+ Ft as TerminalPane,
3298
+ tr as ThemeSwitcher,
3299
+ Ur as TreeWidget,
3300
+ rr as UserProfile,
3301
+ Me as centerOn,
3302
+ ye as clampScale,
3303
+ L as cn,
3304
+ te as commandRegistry,
3305
+ Bt as componentRegistry,
3306
+ hr as edgePath,
3307
+ Br as edgesOf,
3308
+ he as findNeighbour,
3309
+ lr as fitViewport,
3310
+ Ge as graphBounds,
3311
+ Lr as initializeShell,
3312
+ Hr as isConnected,
3313
+ ve as menuRegistry,
3314
+ Gr as nextId,
3315
+ q as nodeRect,
3316
+ cr as placeRelativeTo,
3317
+ Mr as pluginRegistry,
3318
+ Le as portPoint,
3319
+ en as readPaletteDrag,
3320
+ Y as rectCenter,
3321
+ Wr as removeNode,
3322
+ sr as resolvePorts,
3323
+ At as themeClass,
3324
+ be as toGraphSpace,
3325
+ jr as toScreenSpace,
3326
+ ir as unionRect,
3327
+ ae as useChatStore,
3328
+ Vr as useGraphKeyboard,
3329
+ Ar as useKeyboardShortcuts,
3330
+ Ht as useLayoutStore,
3331
+ je as useModalStore,
3332
+ xe as useRightSidebarStore,
3333
+ G as useSidebarStore,
3334
+ we as useStatusBarStore,
3335
+ ne as useTerminalStore,
3336
+ oe as useThemeStore,
3337
+ Z as useUserProfileStore,
3338
+ ar as viewportRect,
3339
+ Ie as zoomAt
2440
3340
  };