nexus-shell 0.2.11 → 0.2.12

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.
@@ -2,18 +2,18 @@ var gt = Object.defineProperty;
2
2
  var xt = (e, t, r) => t in e ? gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var ee = (e, t, r) => xt(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { jsxs as x, jsx as o, Fragment as He } from "react/jsx-runtime";
5
- import pe, { useMemo as B, useContext as bt, createContext as yt, useEffect as F, useState as A, useRef as _, forwardRef as vt, useCallback as Y, useImperativeHandle as wt } from "react";
6
- import { Model as G, Actions as ae, DockLocation as Nt, Layout as kt } from "flexlayout-react";
5
+ import pe, { useMemo as B, useContext as bt, createContext as yt, useEffect as F, useState as $, useRef as _, useId as vt, forwardRef as wt, useCallback as Y, useImperativeHandle as Nt } from "react";
6
+ import { Model as G, Actions as ae, DockLocation as kt, Layout as Et } from "flexlayout-react";
7
7
  import "flexlayout-react/style/light.css";
8
- import { clsx as Et } from "clsx";
9
- import { twMerge as Tt } from "tailwind-merge";
8
+ import { clsx as Tt } from "clsx";
9
+ import { twMerge as Dt } from "tailwind-merge";
10
10
  import { create as Q } from "zustand";
11
- import { ChevronRight as je, X, MessageCircle as Ee, User as We, Terminal as Te, Send as Dt, GraduationCap as Se, Moon as Lt, Sun as It, Palette as Pt, ChevronUp as Ge, Settings as St, Search as ge, Info as Mt, HelpCircle as Ct, AlertCircle as At, Check as $t, Camera as Rt, Edit2 as Ft, Loader2 as Ye, ChevronsUpDown as zt, ChevronDown as Je, Clock as Ot, Plus as _t } from "lucide-react";
12
- import { TableVirtuoso as Kt, Virtuoso as Ut } from "react-virtuoso";
13
- function P(...e) {
14
- return Tt(Et(e));
11
+ import { ChevronRight as je, X, MessageCircle as Ee, User as We, Terminal as Te, Send as Lt, GraduationCap as Pe, Moon as It, Sun as St, Palette as Pt, ChevronUp as Ge, Settings as Mt, Search as ge, Info as Ct, HelpCircle as At, AlertCircle as $t, Check as Rt, Camera as Ft, Edit2 as zt, Loader2 as Ye, ChevronsUpDown as Ot, ChevronDown as Je, Clock as _t, Plus as Kt } from "lucide-react";
12
+ import { TableVirtuoso as Ut, Virtuoso as Bt } from "react-virtuoso";
13
+ function M(...e) {
14
+ return Dt(Tt(e));
15
15
  }
16
- const Bt = ({
16
+ const Ht = ({
17
17
  items: e = [],
18
18
  bottomItems: t = [],
19
19
  activeId: r = null,
@@ -30,7 +30,7 @@ const Bt = ({
30
30
  "aria-label": l,
31
31
  title: l,
32
32
  "aria-pressed": r === c,
33
- className: P(
33
+ className: M(
34
34
  "p-2 cursor-pointer rounded text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
35
35
  r === c && [
36
36
  "text-foreground border-primary rounded-none",
@@ -48,7 +48,7 @@ const Bt = ({
48
48
  role: "navigation",
49
49
  "aria-label": a,
50
50
  "data-side": s,
51
- className: P(
51
+ className: M(
52
52
  "w-12 h-full bg-muted flex flex-col items-center py-2 select-none",
53
53
  s === "right" ? "border-l" : "border-r",
54
54
  i
@@ -59,22 +59,34 @@ const Bt = ({
59
59
  ]
60
60
  }
61
61
  );
62
- }, Xe = "chat", qe = "terminal", Ht = "settings", De = (e) => Q((t) => {
63
- const r = (n) => (n === null ? localStorage.removeItem(e) : localStorage.setItem(e, n), n);
62
+ }, Xe = "chat", qe = "terminal", jt = "settings", Wt = (e) => {
63
+ try {
64
+ return typeof window > "u" || !window.localStorage ? null : window.localStorage.getItem(e);
65
+ } catch {
66
+ return null;
67
+ }
68
+ }, Gt = (e, t) => {
69
+ try {
70
+ if (typeof window > "u" || !window.localStorage) return;
71
+ t === null ? window.localStorage.removeItem(e) : window.localStorage.setItem(e, t);
72
+ } catch {
73
+ }
74
+ }, De = (e) => Q((t) => {
75
+ const r = (n) => (Gt(e, n), n);
64
76
  return {
65
- activePanel: localStorage.getItem(e),
77
+ activePanel: Wt(e),
66
78
  panels: [],
67
79
  setActivePanel: (n) => t({ activePanel: r(n) }),
68
80
  togglePanel: (n) => t((s) => ({
69
81
  activePanel: r(s.activePanel === n ? null : n)
70
82
  })),
71
- setPanels: (n) => t({ panels: n })
83
+ setPanels: (n) => t((s) => n.length > 0 && s.activePanel !== null && !n.some((a) => a.id === s.activePanel) ? { panels: n, activePanel: r(null) } : { panels: n })
72
84
  };
73
- }), jt = De("nexus-shell-pane-left"), Wt = De("nexus-shell-pane-right"), Gt = De("nexus-shell-pane-bottom"), Yt = {
74
- left: jt,
75
- right: Wt,
76
- bottom: Gt
77
- }, ce = (e) => Yt[e], Ve = ["left", "right", "bottom"], Qe = (e) => {
85
+ }), Yt = De("nexus-shell-pane-left"), Jt = De("nexus-shell-pane-right"), Xt = De("nexus-shell-pane-bottom"), qt = {
86
+ left: Yt,
87
+ right: Jt,
88
+ bottom: Xt
89
+ }, ce = (e) => qt[e], Ve = ["left", "right", "bottom"], Qe = (e) => {
78
90
  Ve.forEach((t) => {
79
91
  ce(t).getState().setPanels(e.filter((r) => (r.side ?? "left") === t));
80
92
  });
@@ -87,7 +99,7 @@ const Bt = ({
87
99
  ];
88
100
  }, [n]);
89
101
  return n.length === 0 ? null : /* @__PURE__ */ o(
90
- Bt,
102
+ Ht,
91
103
  {
92
104
  ...t,
93
105
  side: e,
@@ -98,7 +110,7 @@ const Bt = ({
98
110
  "aria-label": t["aria-label"] ?? (e === "right" ? "Inspector Bar" : "Activity Bar")
99
111
  }
100
112
  );
101
- }, Jt = ({
113
+ }, Vt = ({
102
114
  menus: e = {},
103
115
  onSelect: t,
104
116
  title: r,
@@ -163,7 +175,7 @@ const Bt = ({
163
175
  {
164
176
  role: "banner",
165
177
  "aria-label": "Application Header",
166
- className: P(
178
+ className: M(
167
179
  "bg-muted border-b flex items-center justify-between px-4 select-none shrink-0 transition-all z-50 relative",
168
180
  r !== void 0 ? "h-12 bg-card/65 backdrop-blur-sm" : "h-8",
169
181
  i
@@ -199,7 +211,7 @@ const Bt = ({
199
211
  }
200
212
  );
201
213
  };
202
- class Xt {
214
+ class Qt {
203
215
  constructor() {
204
216
  ee(this, "menus", /* @__PURE__ */ new Map());
205
217
  }
@@ -220,8 +232,8 @@ class Xt {
220
232
  }), t;
221
233
  }
222
234
  }
223
- const Le = new Xt();
224
- class qt {
235
+ const Le = new Qt();
236
+ class Zt {
225
237
  constructor() {
226
238
  ee(this, "commands", /* @__PURE__ */ new Map());
227
239
  }
@@ -243,7 +255,7 @@ class qt {
243
255
  return Array.from(this.commands.values());
244
256
  }
245
257
  }
246
- const re = new qt(), Ze = (e) => e.map((t) => {
258
+ const re = new Zt(), Ze = (e) => e.map((t) => {
247
259
  var r;
248
260
  return {
249
261
  ...t,
@@ -256,11 +268,11 @@ const re = new qt(), Ze = (e) => e.map((t) => {
256
268
  const n = r.submenu && et(r.submenu, t);
257
269
  if (n) return n;
258
270
  }
259
- }, Vt = (e) => {
271
+ }, er = (e) => {
260
272
  const t = Le.getAllMenus(), r = Object.fromEntries(
261
273
  Object.entries(t).map(([s, i]) => [s, Ze(i)])
262
274
  );
263
- return /* @__PURE__ */ o(Jt, { ...e, menus: r, onSelect: (s) => {
275
+ return /* @__PURE__ */ o(Vt, { ...e, menus: r, onSelect: (s) => {
264
276
  for (const i of Object.values(t)) {
265
277
  const a = et(i, s.id);
266
278
  if (a != null && a.commandId) {
@@ -290,7 +302,7 @@ const re = new qt(), Ze = (e) => e.map((t) => {
290
302
  "aria-label": `${e} Panel`,
291
303
  "data-side": i,
292
304
  style: i === "bottom" ? { height: s } : { width: n },
293
- className: P(
305
+ className: M(
294
306
  "bg-muted flex flex-col select-none shrink-0",
295
307
  i === "bottom" ? "w-full" : "h-full",
296
308
  // The divider always faces the content it separates from.
@@ -322,7 +334,7 @@ const re = new qt(), Ze = (e) => e.map((t) => {
322
334
  return /* @__PURE__ */ o(Ce, { ...t, side: e, title: n, onClose: a, children: /* @__PURE__ */ o("div", { className: "p-4 text-sm italic text-muted-foreground", children: "Panel content not found." }) });
323
335
  const c = typeof d.component == "function" ? d.component : null;
324
336
  return /* @__PURE__ */ o(Ce, { ...t, side: e, title: d.label, onClose: a, children: c ? /* @__PURE__ */ o(c, {}) : d.component });
325
- }, be = (e, t) => (t.priority ?? 0) - (e.priority ?? 0), Qt = ({
337
+ }, be = (e, t) => (t.priority ?? 0) - (e.priority ?? 0), tr = ({
326
338
  widgets: e = [],
327
339
  className: t,
328
340
  "aria-label": r = "Status Bar"
@@ -343,7 +355,7 @@ const re = new qt(), Ze = (e) => e.map((t) => {
343
355
  } : void 0,
344
356
  role: d ? "button" : void 0,
345
357
  tabIndex: d ? 0 : void 0,
346
- className: P(
358
+ className: M(
347
359
  "flex items-center space-x-1.5 px-2 py-0.5 rounded transition-colors h-full focus:outline-none",
348
360
  d ? "cursor-pointer hover:bg-white/10 focus:ring-1 focus:ring-white" : "cursor-default",
349
361
  i.className
@@ -361,7 +373,7 @@ const re = new qt(), Ze = (e) => e.map((t) => {
361
373
  {
362
374
  role: "status",
363
375
  "aria-label": r,
364
- className: P(
376
+ className: M(
365
377
  "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",
366
378
  t
367
379
  ),
@@ -386,7 +398,7 @@ const re = new qt(), Ze = (e) => e.map((t) => {
386
398
  updateWidget: (t, r) => e((n) => ({
387
399
  widgets: n.widgets.map((s) => s.id === t ? { ...s, ...r } : s)
388
400
  }))
389
- })), Zt = (e) => {
401
+ })), rr = (e) => {
390
402
  const t = Ie((n) => n.widgets), r = B(
391
403
  () => t.map(({ commandId: n, ...s }) => ({
392
404
  ...s,
@@ -394,9 +406,9 @@ const re = new qt(), Ze = (e) => e.map((t) => {
394
406
  })),
395
407
  [t]
396
408
  );
397
- return /* @__PURE__ */ o(Qt, { ...e, widgets: r });
409
+ return /* @__PURE__ */ o(tr, { ...e, widgets: r });
398
410
  };
399
- class er {
411
+ class nr {
400
412
  constructor() {
401
413
  ee(this, "components", /* @__PURE__ */ new Map());
402
414
  }
@@ -420,18 +432,29 @@ class er {
420
432
  return Array.from(this.components.keys());
421
433
  }
422
434
  }
423
- const st = new er();
424
- let tr = 0;
425
- const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
435
+ const st = new nr();
436
+ let or = 0;
437
+ const sr = () => `msg-${Date.now()}-${or += 1}`, le = Q((e) => ({
426
438
  messages: [],
427
439
  slashCommands: [],
428
440
  setMessages: (t) => e({ messages: t }),
429
441
  addMessage: (t) => e((r) => ({
430
- messages: [...r.messages, { ...t, id: t.id ?? rr() }]
442
+ messages: [...r.messages, { ...t, id: t.id ?? sr() }]
431
443
  })),
432
444
  clearMessages: () => e({ messages: [] }),
433
445
  setSlashCommands: (t) => e({ slashCommands: t }),
434
- registerSlashCommand: (t) => e((r) => ({ slashCommands: [...r.slashCommands, t] }))
446
+ registerSlashCommand: (t) => e((r) => {
447
+ const n = r.slashCommands.findIndex(
448
+ (i) => i.command === t.command
449
+ );
450
+ if (n === -1)
451
+ return { slashCommands: [...r.slashCommands, t] };
452
+ const s = [...r.slashCommands];
453
+ return s[n] = t, { slashCommands: s };
454
+ }),
455
+ unregisterSlashCommand: (t) => e((r) => ({
456
+ slashCommands: r.slashCommands.filter((n) => n.command !== t)
457
+ }))
435
458
  })), V = {
436
459
  global: { tabEnableClose: !0, tabSetEnableMaximize: !1, tabSetEnableDivide: !0 },
437
460
  borders: [
@@ -582,7 +605,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
582
605
  ae.addNode(
583
606
  { type: "tab", component: n, name: s || n, config: p },
584
607
  c,
585
- Nt.CENTER,
608
+ kt.CENTER,
586
609
  -1
587
610
  )
588
611
  );
@@ -633,12 +656,12 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
633
656
  shortLabel: "TAMU",
634
657
  description: "Aggie Maroon (#500000) on white."
635
658
  }
636
- ], nr = de.map((e) => `theme-${e.id}`), or = (e) => `theme-${e}`, $e = "nexus-shell-theme", Re = (e) => {
659
+ ], ar = de.map((e) => `theme-${e.id}`), ir = (e) => `theme-${e}`, $e = "nexus-shell-theme", Re = (e) => {
637
660
  const t = window.document.documentElement, r = [
638
- ...nr,
661
+ ...ar,
639
662
  ...Array.from(t.classList).filter((n) => n.startsWith("theme-"))
640
663
  ];
641
- t.classList.remove(...r), t.classList.add(or(e));
664
+ t.classList.remove(...r), t.classList.add(ir(e));
642
665
  }, ie = Q((e) => {
643
666
  const r = localStorage.getItem($e) || "light";
644
667
  return Re(r), {
@@ -647,7 +670,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
647
670
  localStorage.setItem($e, n), Re(n), e({ theme: n });
648
671
  }
649
672
  };
650
- }), xn = ({
673
+ }), vn = ({
651
674
  panels: e,
652
675
  slashCommands: t,
653
676
  menuConfig: r,
@@ -660,7 +683,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
660
683
  disableLocalStorage: l = !1,
661
684
  onLayoutChange: p
662
685
  }) => {
663
- const { model: u, setModel: m, initLayout: v, isTabDirty: b, setTabDirty: f } = at(), h = ie((L) => L.theme), y = le((L) => L.setSlashCommands), k = Ie((L) => L.setWidgets);
686
+ const { model: u, setModel: m, initLayout: v, isTabDirty: b, setTabDirty: h } = at(), g = ie((S) => S.theme), y = le((S) => S.setSlashCommands), w = Ie((S) => S.setWidgets);
664
687
  F(() => {
665
688
  e && Qe(e);
666
689
  }, [e]), F(() => {
@@ -668,44 +691,44 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
668
691
  }, [t, y]), F(() => {
669
692
  r && Le.setMenus(r);
670
693
  }, [r]), F(() => {
671
- n && k(n);
672
- }, [n, k]), F(() => {
694
+ n && w(n);
695
+ }, [n, w]), F(() => {
673
696
  d || !c && !l || v(c, l);
674
697
  }, []);
675
- const w = (L) => {
698
+ const L = (S) => {
676
699
  try {
677
- const T = L.getComponent(), M = L.getConfig() || {}, I = T ? st.get(T) : void 0;
678
- return I ? (
700
+ const D = S.getComponent(), C = S.getConfig() || {}, N = D ? st.get(D) : void 0;
701
+ return N ? (
679
702
  // The tab strip is the title bar, so a component that draws its own
680
703
  // — chat, terminal — omits it here.
681
- /* @__PURE__ */ o(ot, { chrome: !0, placement: "tab", children: /* @__PURE__ */ o(I, { node: L, ...M }) })
704
+ /* @__PURE__ */ o(ot, { chrome: !0, placement: "tab", children: /* @__PURE__ */ o(N, { node: S, ...C }) })
682
705
  ) : /* @__PURE__ */ x("div", { className: "p-4 text-sm", children: [
683
706
  "Unknown Component: ",
684
- T
707
+ D
685
708
  ] });
686
- } catch (T) {
687
- return console.error("Error in component factory:", T), /* @__PURE__ */ x("div", { className: "p-8 text-destructive bg-destructive/10 border border-destructive/20 h-full flex items-center justify-center", children: [
709
+ } catch (D) {
710
+ return console.error("Error in component factory:", D), /* @__PURE__ */ x("div", { className: "p-8 text-destructive bg-destructive/10 border border-destructive/20 h-full flex items-center justify-center", children: [
688
711
  "Error rendering component: ",
689
- T instanceof Error ? T.message : "Unknown error"
712
+ D instanceof Error ? D.message : "Unknown error"
690
713
  ] });
691
714
  }
692
- }, N = (L) => {
693
- if (L.type !== ae.DELETE_TAB) return L;
694
- const T = u.getNodeById(L.data.node);
695
- if (!T || !b(T.getId())) return L;
715
+ }, k = (S) => {
716
+ if (S.type !== ae.DELETE_TAB) return S;
717
+ const D = u.getNodeById(S.data.node);
718
+ if (!D || !b(D.getId())) return S;
696
719
  it.getState().openConfirm(
697
- `Tab "${T.getName()}" has unsaved changes. Are you sure you want to close it?`
698
- ).then((M) => {
699
- M && (f(T.getId(), !1), u.doAction(L));
720
+ `Tab "${D.getName()}" has unsaved changes. Are you sure you want to close it?`
721
+ ).then((C) => {
722
+ C && (h(D.getId(), !1), u.doAction(S));
700
723
  });
701
724
  };
702
725
  return /* @__PURE__ */ x(
703
726
  "div",
704
727
  {
705
- className: `flex flex-col h-screen w-screen bg-background text-foreground overflow-hidden theme-${h}`,
728
+ className: `flex flex-col h-screen w-screen bg-background text-foreground overflow-hidden theme-${g}`,
706
729
  children: [
707
730
  /* @__PURE__ */ o(
708
- Vt,
731
+ er,
709
732
  {
710
733
  title: s,
711
734
  center: a,
@@ -717,14 +740,14 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
717
740
  /* @__PURE__ */ o(xe, { side: "left" }),
718
741
  /* @__PURE__ */ x("div", { className: "flex-1 flex flex-col min-w-0 bg-card", children: [
719
742
  /* @__PURE__ */ o("div", { className: "flex-1 relative h-full w-full", children: /* @__PURE__ */ o(
720
- kt,
743
+ Et,
721
744
  {
722
745
  model: d || u,
723
- factory: w,
724
- onModelChange: (L) => {
725
- d || m(L), p == null || p(L.toJson());
746
+ factory: L,
747
+ onModelChange: (S) => {
748
+ d || m(S), p == null || p(S.toJson());
726
749
  },
727
- onAction: N
750
+ onAction: k
728
751
  }
729
752
  ) }),
730
753
  /* @__PURE__ */ o(xe, { side: "bottom" })
@@ -732,7 +755,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
732
755
  /* @__PURE__ */ o(xe, { side: "right" }),
733
756
  /* @__PURE__ */ o(Me, { side: "right" })
734
757
  ] }),
735
- /* @__PURE__ */ o(Zt, {})
758
+ /* @__PURE__ */ o(rr, {})
736
759
  ]
737
760
  }
738
761
  );
@@ -740,7 +763,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
740
763
  id: `theme.${e.id}`,
741
764
  label: `Preferences: ${e.label} Theme`,
742
765
  execute: () => ie.getState().setTheme(e.id)
743
- })), bn = [
766
+ })), wn = [
744
767
  "view.toggleTerminal",
745
768
  "view.toggleChat",
746
769
  "view.toggleSidebar",
@@ -752,7 +775,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
752
775
  return r.getState().togglePanel(e), !0;
753
776
  }
754
777
  return st.get(e) ? (at.getState().addTab(e), !0) : !1;
755
- }, sr = [
778
+ }, lr = [
756
779
  {
757
780
  id: "view.toggleTerminal",
758
781
  label: "View: Toggle Terminal",
@@ -775,7 +798,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
775
798
  }
776
799
  },
777
800
  ...lt
778
- ], ar = {
801
+ ], cr = {
779
802
  View: [
780
803
  { id: "view.terminal", label: "Toggle Terminal", commandId: "view.toggleTerminal" },
781
804
  { id: "view.chat", label: "Toggle Chat", commandId: "view.toggleChat" },
@@ -790,7 +813,7 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
790
813
  }))
791
814
  }
792
815
  ]
793
- }, yn = (e = {}) => {
816
+ }, Nn = (e = {}) => {
794
817
  const {
795
818
  panels: t,
796
819
  menus: r,
@@ -800,14 +823,14 @@ const rr = () => `msg-${Date.now()}-${tr += 1}`, le = Q((e) => ({
800
823
  defaultCommands: a = !0,
801
824
  defaultMenus: d = !0
802
825
  } = e;
803
- a && sr.forEach((l) => re.registerCommand(l)), n == null || n.forEach((l) => re.registerCommand(l));
826
+ a && lr.forEach((l) => re.registerCommand(l)), n == null || n.forEach((l) => re.registerCommand(l));
804
827
  const c = {
805
- ...a && d ? ar : {},
828
+ ...a && d ? cr : {},
806
829
  ...r ?? {}
807
830
  };
808
831
  Object.keys(c).length > 0 && Le.setMenus(c), t && Qe(t), s && Ie.getState().setWidgets(s), i && le.getState().setSlashCommands(i);
809
832
  };
810
- class ir {
833
+ class dr {
811
834
  constructor() {
812
835
  ee(this, "plugins", /* @__PURE__ */ new Map());
813
836
  ee(this, "loaders", /* @__PURE__ */ new Map());
@@ -870,7 +893,7 @@ class ir {
870
893
  return Array.from(this.plugins.values());
871
894
  }
872
895
  }
873
- const vn = new ir(), ye = Q((e) => ({
896
+ const kn = new dr(), ye = Q((e) => ({
874
897
  history: [
875
898
  "Welcome to Nexus Shell Terminal v0.1.0",
876
899
  'Type "help" for a list of commands.'
@@ -924,12 +947,12 @@ const vn = new ir(), ye = Q((e) => ({
924
947
  return r(s), { customAvatar: "" };
925
948
  })
926
949
  };
927
- }), wn = () => {
950
+ }), En = () => {
928
951
  F(() => {
929
952
  const e = (t) => {
930
953
  const r = re.getCommands();
931
954
  for (const n of r)
932
- if (n.keybinding && lr(t, n.keybinding)) {
955
+ if (n.keybinding && ur(t, n.keybinding)) {
933
956
  t.preventDefault(), n.execute();
934
957
  break;
935
958
  }
@@ -937,12 +960,12 @@ const vn = new ir(), ye = Q((e) => ({
937
960
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
938
961
  }, []);
939
962
  };
940
- function lr(e, t) {
963
+ function ur(e, t) {
941
964
  var m;
942
965
  const r = t.split("+"), n = (m = r.pop()) == null ? void 0 : m.toLowerCase(), s = r.includes("Control") || r.includes("Ctrl"), i = r.includes("Shift"), a = r.includes("Alt"), d = r.includes("Meta") || r.includes("Cmd"), c = e.ctrlKey, l = e.shiftKey, p = e.altKey, u = e.metaKey;
943
966
  return e.key.toLowerCase() === n && c === s && l === i && p === a && u === d;
944
967
  }
945
- const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
968
+ const mr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
946
969
  /* @__PURE__ */ o(Ee, { size: 28, className: "mb-3 opacity-40" }),
947
970
  /* @__PURE__ */ o("p", { className: "text-xs", children: "No messages yet." }),
948
971
  /* @__PURE__ */ x("p", { className: "text-[11px] mt-1 opacity-70", children: [
@@ -950,7 +973,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
950
973
  /* @__PURE__ */ o("span", { className: "font-mono", children: "/" }),
951
974
  " for commands."
952
975
  ] })
953
- ] }), dr = ({
976
+ ] }), fr = ({
954
977
  messages: e = [],
955
978
  onSend: t,
956
979
  slashCommands: r = [],
@@ -958,47 +981,47 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
958
981
  onClose: s,
959
982
  title: i = "Chat",
960
983
  placeholder: a = "Send a message…",
961
- emptyState: d = cr,
984
+ emptyState: d = mr,
962
985
  chrome: c,
963
986
  className: l
964
987
  }) => {
965
- const p = nt(c), [u, m] = A(""), [v, b] = A(0), f = _(null), h = _(null), y = u.startsWith("/") ? r.filter(
966
- (T) => `/${T.command}`.startsWith(u.toLowerCase().split(" ")[0])
967
- ) : [], k = y.length > 0;
988
+ const p = nt(c), [u, m] = $(""), [v, b] = $(0), h = _(null), g = _(null), y = u.startsWith("/") ? r.filter(
989
+ (D) => `/${D.command}`.startsWith(u.toLowerCase().split(" ")[0])
990
+ ) : [], w = y.length > 0;
968
991
  F(() => {
969
- h.current && (h.current.scrollTop = h.current.scrollHeight);
992
+ g.current && (g.current.scrollTop = g.current.scrollHeight);
970
993
  }, [e]), F(() => {
971
994
  b(0);
972
995
  }, [u]);
973
- const w = () => {
974
- const T = u.trim();
975
- T && (t == null || t(T), m(""));
976
- }, N = (T) => {
977
- var M;
978
- n == null || n(T), m(`/${T.command} `), (M = f.current) == null || M.focus();
979
- }, L = (T) => {
980
- if (k) {
981
- if (T.key === "ArrowDown") {
982
- T.preventDefault(), b((M) => (M + 1) % y.length);
996
+ const L = () => {
997
+ const D = u.trim();
998
+ D && (t == null || t(D), m(""));
999
+ }, k = (D) => {
1000
+ var C;
1001
+ n == null || n(D), m(`/${D.command} `), (C = h.current) == null || C.focus();
1002
+ }, S = (D) => {
1003
+ if (w) {
1004
+ if (D.key === "ArrowDown") {
1005
+ D.preventDefault(), b((C) => (C + 1) % y.length);
983
1006
  return;
984
1007
  }
985
- if (T.key === "ArrowUp") {
986
- T.preventDefault(), b((M) => (M - 1 + y.length) % y.length);
1008
+ if (D.key === "ArrowUp") {
1009
+ D.preventDefault(), b((C) => (C - 1 + y.length) % y.length);
987
1010
  return;
988
1011
  }
989
- if (T.key === "Tab" || T.key === "Enter" && !T.shiftKey) {
990
- T.preventDefault(), N(y[v]);
1012
+ if (D.key === "Tab" || D.key === "Enter" && !D.shiftKey) {
1013
+ D.preventDefault(), k(y[v]);
991
1014
  return;
992
1015
  }
993
1016
  }
994
- T.key === "Enter" && !T.shiftKey && (T.preventDefault(), w());
1017
+ D.key === "Enter" && !D.shiftKey && (D.preventDefault(), L());
995
1018
  };
996
1019
  return /* @__PURE__ */ x(
997
1020
  "aside",
998
1021
  {
999
1022
  role: "complementary",
1000
1023
  "aria-label": i,
1001
- className: P(
1024
+ className: M(
1002
1025
  // Fills whatever hosts it — a side pane, a dockable tab, your own box.
1003
1026
  // It used to hardcode `w-[320px] border-l`, which is why it could only
1004
1027
  // ever live in one place.
@@ -1025,65 +1048,65 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1025
1048
  /* @__PURE__ */ o(
1026
1049
  "div",
1027
1050
  {
1028
- ref: h,
1051
+ ref: g,
1029
1052
  role: "log",
1030
1053
  "aria-label": `${i} transcript`,
1031
1054
  className: "flex-1 overflow-y-auto border-t border-border/50 bg-background/50 px-3 py-3 space-y-3",
1032
- children: e.length === 0 ? d : e.map((T) => {
1033
- const M = T.role === "user";
1055
+ children: e.length === 0 ? d : e.map((D) => {
1056
+ const C = D.role === "user";
1034
1057
  return /* @__PURE__ */ x(
1035
1058
  "div",
1036
1059
  {
1037
- className: P("flex flex-col", M ? "items-end" : "items-start"),
1060
+ className: M("flex flex-col", C ? "items-end" : "items-start"),
1038
1061
  children: [
1039
1062
  /* @__PURE__ */ x("div", { className: "flex items-center space-x-1 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-bold", children: [
1040
- M ? /* @__PURE__ */ o(We, { size: 10 }) : /* @__PURE__ */ o(Te, { size: 10 }),
1041
- /* @__PURE__ */ o("span", { children: T.author ?? (M ? "You" : "Assistant") })
1063
+ C ? /* @__PURE__ */ o(We, { size: 10 }) : /* @__PURE__ */ o(Te, { size: 10 }),
1064
+ /* @__PURE__ */ o("span", { children: D.author ?? (C ? "You" : "Assistant") })
1042
1065
  ] }),
1043
1066
  /* @__PURE__ */ o(
1044
1067
  "div",
1045
1068
  {
1046
- className: P(
1069
+ className: M(
1047
1070
  "max-w-[85%] rounded-lg px-3 py-2 text-xs whitespace-pre-wrap break-words",
1048
- M ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
1071
+ C ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
1049
1072
  ),
1050
- children: T.text
1073
+ children: D.text
1051
1074
  }
1052
1075
  )
1053
1076
  ]
1054
1077
  },
1055
- T.id
1078
+ D.id
1056
1079
  );
1057
1080
  })
1058
1081
  }
1059
1082
  ),
1060
1083
  /* @__PURE__ */ x("div", { className: "relative border-t border-border/50 p-2 shrink-0", children: [
1061
- k && /* @__PURE__ */ o(
1084
+ w && /* @__PURE__ */ o(
1062
1085
  "div",
1063
1086
  {
1064
1087
  role: "listbox",
1065
1088
  "aria-label": "Slash commands",
1066
1089
  className: "absolute bottom-full left-2 right-2 mb-1 bg-popover border border-border rounded-md shadow-lg overflow-hidden z-20",
1067
- children: y.map((T, M) => /* @__PURE__ */ x(
1090
+ children: y.map((D, C) => /* @__PURE__ */ x(
1068
1091
  "div",
1069
1092
  {
1070
1093
  role: "option",
1071
- "aria-selected": M === v,
1072
- onMouseEnter: () => b(M),
1073
- onClick: () => N(T),
1074
- className: P(
1094
+ "aria-selected": C === v,
1095
+ onMouseEnter: () => b(C),
1096
+ onClick: () => k(D),
1097
+ className: M(
1075
1098
  "px-3 py-1.5 text-xs cursor-pointer flex items-baseline justify-between gap-3",
1076
- M === v ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1099
+ C === v ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1077
1100
  ),
1078
1101
  children: [
1079
1102
  /* @__PURE__ */ x("span", { className: "font-mono", children: [
1080
1103
  "/",
1081
- T.command
1104
+ D.command
1082
1105
  ] }),
1083
- /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground truncate", children: T.description })
1106
+ /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground truncate", children: D.description })
1084
1107
  ]
1085
1108
  },
1086
- T.command
1109
+ D.command
1087
1110
  ))
1088
1111
  }
1089
1112
  ),
@@ -1091,13 +1114,13 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1091
1114
  /* @__PURE__ */ o(
1092
1115
  "textarea",
1093
1116
  {
1094
- ref: f,
1117
+ ref: h,
1095
1118
  rows: 1,
1096
1119
  value: u,
1097
1120
  "aria-label": `${i} message`,
1098
1121
  placeholder: a,
1099
- onChange: (T) => m(T.target.value),
1100
- onKeyDown: L,
1122
+ onChange: (D) => m(D.target.value),
1123
+ onKeyDown: S,
1101
1124
  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"
1102
1125
  }
1103
1126
  ),
@@ -1105,11 +1128,11 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1105
1128
  "button",
1106
1129
  {
1107
1130
  type: "button",
1108
- onClick: w,
1131
+ onClick: L,
1109
1132
  disabled: !u.trim(),
1110
1133
  "aria-label": "Send message",
1111
1134
  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",
1112
- children: /* @__PURE__ */ o(Dt, { size: 14 })
1135
+ children: /* @__PURE__ */ o(Lt, { size: 14 })
1113
1136
  }
1114
1137
  )
1115
1138
  ] })
@@ -1117,10 +1140,10 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1117
1140
  ]
1118
1141
  }
1119
1142
  );
1120
- }, ur = ({ onSend: e, ...t }) => {
1143
+ }, pr = ({ onSend: e, ...t }) => {
1121
1144
  const r = le((a) => a.messages), n = le((a) => a.slashCommands), s = le((a) => a.addMessage);
1122
1145
  return /* @__PURE__ */ o(
1123
- dr,
1146
+ fr,
1124
1147
  {
1125
1148
  ...t,
1126
1149
  messages: r,
@@ -1139,21 +1162,21 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1139
1162
  }
1140
1163
  }
1141
1164
  );
1142
- }, mr = {
1143
- light: It,
1144
- dark: Lt,
1145
- gt: Se,
1146
- tamu: Se
1147
- }, fr = de.map((e) => ({
1165
+ }, hr = {
1166
+ light: St,
1167
+ dark: It,
1168
+ gt: Pe,
1169
+ tamu: Pe
1170
+ }, gr = de.map((e) => ({
1148
1171
  id: e.id,
1149
1172
  label: e.label,
1150
- icon: mr[e.id] ?? Pt
1151
- })), pr = ({
1173
+ icon: hr[e.id] ?? Pt
1174
+ })), xr = ({
1152
1175
  theme: e,
1153
1176
  onThemeChange: t,
1154
- themes: r = fr,
1177
+ themes: r = gr,
1155
1178
  className: n
1156
- }) => /* @__PURE__ */ o("div", { className: P("p-4 space-y-6", n), children: /* @__PURE__ */ x("section", { children: [
1179
+ }) => /* @__PURE__ */ o("div", { className: M("p-4 space-y-6", n), children: /* @__PURE__ */ x("section", { children: [
1157
1180
  /* @__PURE__ */ o("h3", { className: "text-[11px] font-bold text-muted-foreground uppercase mb-3", children: "Theme" }),
1158
1181
  /* @__PURE__ */ o(
1159
1182
  "div",
@@ -1168,7 +1191,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1168
1191
  role: "radio",
1169
1192
  "aria-checked": e === s,
1170
1193
  onClick: () => t(s),
1171
- className: P(
1194
+ className: M(
1172
1195
  "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",
1173
1196
  e === s ? "bg-primary text-primary-foreground border-primary" : "bg-background hover:bg-accent border-border"
1174
1197
  ),
@@ -1181,17 +1204,17 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1181
1204
  ))
1182
1205
  }
1183
1206
  )
1184
- ] }) }), hr = (e) => {
1207
+ ] }) }), br = (e) => {
1185
1208
  const t = ie((n) => n.theme), r = ie((n) => n.setTheme);
1186
1209
  return /* @__PURE__ */ o(
1187
- pr,
1210
+ xr,
1188
1211
  {
1189
1212
  ...e,
1190
1213
  theme: t,
1191
1214
  onThemeChange: (n) => r(n)
1192
1215
  }
1193
1216
  );
1194
- }, gr = ({
1217
+ }, yr = ({
1195
1218
  history: e = [],
1196
1219
  onCommand: t,
1197
1220
  onClose: r,
@@ -1201,12 +1224,12 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1201
1224
  chrome: a,
1202
1225
  className: d
1203
1226
  }) => {
1204
- const c = rt(), l = nt(a), p = n ?? (c ? void 0 : "250px"), [u, m] = A(""), v = _(null), b = _(null);
1227
+ const c = rt(), l = nt(a), p = n ?? (c ? void 0 : "250px"), [u, m] = $(""), v = _(null), b = _(null);
1205
1228
  F(() => {
1206
1229
  v.current && (v.current.scrollTop = v.current.scrollHeight);
1207
1230
  }, [e]);
1208
- const f = (h) => {
1209
- if (h.key !== "Enter") return;
1231
+ const h = (g) => {
1232
+ if (g.key !== "Enter") return;
1210
1233
  const y = u.trim();
1211
1234
  y && (t == null || t(y), m(""));
1212
1235
  };
@@ -1214,7 +1237,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1214
1237
  "div",
1215
1238
  {
1216
1239
  style: { height: p },
1217
- className: P(
1240
+ className: M(
1218
1241
  "bg-card flex flex-col font-mono text-xs",
1219
1242
  // Standalone it is a bottom-docked strip with its own top edge; hosted
1220
1243
  // it fills, and the host owns the edges.
@@ -1258,10 +1281,10 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1258
1281
  "aria-label": `${i} output`,
1259
1282
  className: "flex-1 overflow-y-auto px-3 py-2 space-y-0.5",
1260
1283
  onClick: () => {
1261
- var h;
1262
- return (h = b.current) == null ? void 0 : h.focus();
1284
+ var g;
1285
+ return (g = b.current) == null ? void 0 : g.focus();
1263
1286
  },
1264
- children: e.map((h, y) => /* @__PURE__ */ o("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: h }, y))
1287
+ children: e.map((g, y) => /* @__PURE__ */ o("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: g }, y))
1265
1288
  }
1266
1289
  ),
1267
1290
  /* @__PURE__ */ x("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
@@ -1273,8 +1296,8 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1273
1296
  type: "text",
1274
1297
  "aria-label": `${i} input`,
1275
1298
  value: u,
1276
- onChange: (h) => m(h.target.value),
1277
- onKeyDown: f,
1299
+ onChange: (g) => m(g.target.value),
1300
+ onKeyDown: h,
1278
1301
  spellCheck: !1,
1279
1302
  autoComplete: "off",
1280
1303
  className: "flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground"
@@ -1284,17 +1307,17 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1284
1307
  ]
1285
1308
  }
1286
1309
  );
1287
- }, xr = [
1310
+ }, vr = [
1288
1311
  "Available commands:",
1289
1312
  " help — show this message",
1290
1313
  " clear — clear the terminal"
1291
- ], br = ({
1314
+ ], wr = ({
1292
1315
  onCommand: e,
1293
1316
  ...t
1294
1317
  }) => {
1295
1318
  const r = ye((a) => a.history), n = ye((a) => a.addHistory), s = ye((a) => a.clearHistory);
1296
1319
  return /* @__PURE__ */ o(
1297
- gr,
1320
+ yr,
1298
1321
  {
1299
1322
  ...t,
1300
1323
  history: r,
@@ -1306,65 +1329,65 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1306
1329
  return;
1307
1330
  }
1308
1331
  if (d === "help") {
1309
- xr.forEach(n);
1332
+ vr.forEach(n);
1310
1333
  return;
1311
1334
  }
1312
1335
  (e == null ? void 0 : e(a)) !== !0 && n(`command not found: ${a.split(" ")[0]}`);
1313
1336
  }
1314
1337
  }
1315
1338
  );
1316
- }, Nn = (e = {}) => ({
1339
+ }, Tn = (e = {}) => ({
1317
1340
  id: Xe,
1318
1341
  label: "Chat",
1319
1342
  icon: Ee,
1320
- component: ur,
1343
+ component: pr,
1321
1344
  ...e
1322
- }), kn = (e = {}) => ({
1345
+ }), Dn = (e = {}) => ({
1323
1346
  id: qe,
1324
1347
  label: "Terminal",
1325
1348
  icon: Te,
1326
- component: br,
1349
+ component: wr,
1327
1350
  ...e
1328
- }), En = (e = {}) => ({
1329
- id: Ht,
1351
+ }), Ln = (e = {}) => ({
1352
+ id: jt,
1330
1353
  label: "Settings",
1331
- icon: St,
1332
- component: hr,
1354
+ icon: Mt,
1355
+ component: br,
1333
1356
  align: "end",
1334
1357
  ...e
1335
- }), yr = (e, t) => {
1358
+ }), Nr = (e, t) => {
1336
1359
  const r = t.toLowerCase();
1337
1360
  return e.label.toLowerCase().includes(r) || e.id.toLowerCase().includes(r);
1338
- }, vr = ({
1361
+ }, kr = ({
1339
1362
  open: e,
1340
1363
  commands: t,
1341
1364
  onSelect: r,
1342
1365
  onClose: n,
1343
1366
  inline: s = !1,
1344
1367
  placeholder: i = "Type a command to run…",
1345
- filter: a = yr,
1368
+ filter: a = Nr,
1346
1369
  className: d
1347
1370
  }) => {
1348
- const [c, l] = A(""), [p, u] = A(0), m = _(null), v = B(
1349
- () => t.filter((f) => a(f, c)),
1371
+ const [c, l] = $(""), [p, u] = $(0), m = _(null), v = B(
1372
+ () => t.filter((h) => a(h, c)),
1350
1373
  [t, c, a]
1351
1374
  );
1352
1375
  if (F(() => {
1353
- var f;
1354
- e && (l(""), u(0), (f = m.current) == null || f.focus());
1376
+ var h;
1377
+ e && (l(""), u(0), (h = m.current) == null || h.focus());
1355
1378
  }, [e]), F(() => {
1356
1379
  u(0);
1357
1380
  }, [c]), !e) return null;
1358
- const b = (f) => {
1359
- f.key === "ArrowDown" ? (f.preventDefault(), u((h) => v.length ? (h + 1) % v.length : 0)) : f.key === "ArrowUp" ? (f.preventDefault(), u(
1360
- (h) => v.length ? (h - 1 + v.length) % v.length : 0
1361
- )) : f.key === "Enter" ? (f.preventDefault(), v[p] && r(v[p])) : f.key === "Escape" && (f.preventDefault(), n == null || n());
1381
+ const b = (h) => {
1382
+ h.key === "ArrowDown" ? (h.preventDefault(), u((g) => v.length ? (g + 1) % v.length : 0)) : h.key === "ArrowUp" ? (h.preventDefault(), u(
1383
+ (g) => v.length ? (g - 1 + v.length) % v.length : 0
1384
+ )) : h.key === "Enter" ? (h.preventDefault(), v[p] && r(v[p])) : h.key === "Escape" && (h.preventDefault(), n == null || n());
1362
1385
  };
1363
1386
  return /* @__PURE__ */ o(
1364
1387
  "div",
1365
1388
  {
1366
1389
  onClick: s ? void 0 : n,
1367
- className: P(
1390
+ className: M(
1368
1391
  "z-[100] flex items-start justify-center",
1369
1392
  s ? "relative w-full max-w-xl" : "fixed inset-0 pt-[10vh] bg-black/50 backdrop-blur-sm"
1370
1393
  ),
@@ -1374,8 +1397,8 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1374
1397
  role: "dialog",
1375
1398
  "aria-modal": !s,
1376
1399
  "aria-label": "Command Palette",
1377
- onClick: (f) => f.stopPropagation(),
1378
- className: P(
1400
+ onClick: (h) => h.stopPropagation(),
1401
+ className: M(
1379
1402
  "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",
1380
1403
  d
1381
1404
  ),
@@ -1393,7 +1416,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1393
1416
  "aria-label": "Command",
1394
1417
  placeholder: i,
1395
1418
  value: c,
1396
- onChange: (f) => l(f.target.value),
1419
+ onChange: (h) => l(h.target.value),
1397
1420
  onKeyDown: b,
1398
1421
  className: "flex-1 h-14 bg-transparent outline-none text-base text-foreground placeholder:text-muted-foreground"
1399
1422
  }
@@ -1405,23 +1428,23 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1405
1428
  id: "command-palette-list",
1406
1429
  role: "listbox",
1407
1430
  className: "max-h-[300px] overflow-y-auto py-2",
1408
- children: v.length === 0 ? /* @__PURE__ */ o("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: c ? `No commands found matching "${c}"` : "No commands available." }) : v.map((f, h) => /* @__PURE__ */ x(
1431
+ children: v.length === 0 ? /* @__PURE__ */ o("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: c ? `No commands found matching "${c}"` : "No commands available." }) : v.map((h, g) => /* @__PURE__ */ x(
1409
1432
  "div",
1410
1433
  {
1411
1434
  role: "option",
1412
- "aria-selected": h === p,
1413
- onClick: () => r(f),
1414
- onMouseEnter: () => u(h),
1415
- className: P(
1435
+ "aria-selected": g === p,
1436
+ onClick: () => r(h),
1437
+ onMouseEnter: () => u(g),
1438
+ className: M(
1416
1439
  "px-4 py-2 cursor-pointer flex justify-between items-center text-sm",
1417
- h === p ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1440
+ g === p ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1418
1441
  ),
1419
1442
  children: [
1420
- /* @__PURE__ */ o("span", { children: f.label }),
1421
- f.keybinding && /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: f.keybinding })
1443
+ /* @__PURE__ */ o("span", { children: h.label }),
1444
+ h.keybinding && /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: h.keybinding })
1422
1445
  ]
1423
1446
  },
1424
- f.id
1447
+ h.id
1425
1448
  ))
1426
1449
  }
1427
1450
  ),
@@ -1446,11 +1469,11 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1446
1469
  )
1447
1470
  }
1448
1471
  );
1449
- }, Tn = ({
1472
+ }, In = ({
1450
1473
  shortcutKey: e = "p",
1451
1474
  ...t
1452
1475
  }) => {
1453
- const [r, n] = A(!1);
1476
+ const [r, n] = $(!1);
1454
1477
  return F(() => {
1455
1478
  if (e === null) return;
1456
1479
  const s = (i) => {
@@ -1458,7 +1481,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1458
1481
  };
1459
1482
  return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
1460
1483
  }, [e]), /* @__PURE__ */ o(
1461
- vr,
1484
+ kr,
1462
1485
  {
1463
1486
  ...t,
1464
1487
  open: r,
@@ -1469,15 +1492,15 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1469
1492
  onClose: () => n(!1)
1470
1493
  }
1471
1494
  );
1472
- }, wr = {
1473
- alert: At,
1474
- confirm: Ct,
1475
- prompt: Mt
1476
- }, Nr = {
1495
+ }, Er = {
1496
+ alert: $t,
1497
+ confirm: At,
1498
+ prompt: Ct
1499
+ }, Tr = {
1477
1500
  alert: "text-destructive",
1478
1501
  confirm: "text-amber-500",
1479
1502
  prompt: "text-blue-500"
1480
- }, kr = ({
1503
+ }, Dr = ({
1481
1504
  open: e,
1482
1505
  type: t = "alert",
1483
1506
  title: r,
@@ -1490,24 +1513,24 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1490
1513
  placeholder: l = "Enter value…",
1491
1514
  className: p
1492
1515
  }) => {
1493
- const [u, m] = A(s), v = _(null);
1516
+ const [u, m] = $(s), v = _(null);
1494
1517
  if (F(() => {
1495
1518
  if (!e || (m(s), t !== "prompt")) return;
1496
1519
  const y = window.setTimeout(() => {
1497
- var k, w;
1498
- (k = v.current) == null || k.focus(), (w = v.current) == null || w.select();
1520
+ var w, L;
1521
+ (w = v.current) == null || w.focus(), (L = v.current) == null || L.select();
1499
1522
  }, 50);
1500
1523
  return () => window.clearTimeout(y);
1501
1524
  }, [e, t, s]), F(() => {
1502
1525
  if (!e) return;
1503
- const y = (k) => {
1504
- k.key === "Escape" && (k.preventDefault(), a == null || a());
1526
+ const y = (w) => {
1527
+ w.key === "Escape" && (w.preventDefault(), a == null || a());
1505
1528
  };
1506
1529
  return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
1507
1530
  }, [e, a]), !e) return null;
1508
- const b = () => i == null ? void 0 : i(t === "prompt" ? u : void 0), f = (y) => {
1531
+ const b = () => i == null ? void 0 : i(t === "prompt" ? u : void 0), h = (y) => {
1509
1532
  y.key === "Enter" && (y.preventDefault(), b());
1510
- }, h = wr[t];
1533
+ }, g = Er[t];
1511
1534
  return /* @__PURE__ */ o(
1512
1535
  "div",
1513
1536
  {
@@ -1520,8 +1543,8 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1520
1543
  "aria-modal": "true",
1521
1544
  "aria-label": r,
1522
1545
  onClick: (y) => y.stopPropagation(),
1523
- onKeyDown: f,
1524
- className: P(
1546
+ onKeyDown: h,
1547
+ className: M(
1525
1548
  "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",
1526
1549
  p
1527
1550
  ),
@@ -1537,7 +1560,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1537
1560
  }
1538
1561
  ),
1539
1562
  /* @__PURE__ */ x("div", { className: "flex items-start space-x-4 mb-4", children: [
1540
- /* @__PURE__ */ o("div", { className: P("p-2 bg-muted rounded-full shrink-0", Nr[t]), children: /* @__PURE__ */ o(h, { size: 24 }) }),
1563
+ /* @__PURE__ */ o("div", { className: M("p-2 bg-muted rounded-full shrink-0", Tr[t]), children: /* @__PURE__ */ o(g, { size: 24 }) }),
1541
1564
  /* @__PURE__ */ x("div", { className: "flex-1 mt-1", children: [
1542
1565
  /* @__PURE__ */ o("h2", { className: "text-lg font-semibold tracking-tight pr-6", children: r }),
1543
1566
  n && /* @__PURE__ */ o("p", { className: "text-sm text-muted-foreground mt-1 whitespace-pre-wrap", children: n })
@@ -1581,10 +1604,10 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1581
1604
  )
1582
1605
  }
1583
1606
  );
1584
- }, Dn = (e) => {
1607
+ }, Sn = (e) => {
1585
1608
  const { isOpen: t, type: r, title: n, message: s, defaultValue: i, close: a } = it();
1586
1609
  return /* @__PURE__ */ o(
1587
- kr,
1610
+ Dr,
1588
1611
  {
1589
1612
  ...e,
1590
1613
  open: t,
@@ -1600,13 +1623,13 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1600
1623
  }
1601
1624
  }
1602
1625
  );
1603
- }, Er = de.map((e) => ({
1626
+ }, Lr = de.map((e) => ({
1604
1627
  id: e.id,
1605
1628
  label: e.shortLabel
1606
- })), Tr = ({
1629
+ })), Ir = ({
1607
1630
  value: e,
1608
1631
  onChange: t,
1609
- options: r = Er,
1632
+ options: r = Lr,
1610
1633
  className: n,
1611
1634
  "aria-label": s = "Theme"
1612
1635
  }) => /* @__PURE__ */ o(
@@ -1614,7 +1637,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1614
1637
  {
1615
1638
  role: "radiogroup",
1616
1639
  "aria-label": s,
1617
- className: P(
1640
+ className: M(
1618
1641
  "flex items-center border border-border rounded-lg p-0.5 bg-secondary/80 select-none",
1619
1642
  n
1620
1643
  ),
@@ -1624,7 +1647,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1624
1647
  role: "radio",
1625
1648
  "aria-checked": e === i.id,
1626
1649
  onClick: () => t(i.id),
1627
- className: P(
1650
+ className: M(
1628
1651
  "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",
1629
1652
  e === i.id ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-foreground"
1630
1653
  ),
@@ -1633,10 +1656,10 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1633
1656
  i.id
1634
1657
  ))
1635
1658
  }
1636
- ), Ln = (e) => {
1659
+ ), Pn = (e) => {
1637
1660
  const t = ie((n) => n.theme), r = ie((n) => n.setTheme);
1638
- return /* @__PURE__ */ o(Tr, { ...e, value: t, onChange: r });
1639
- }, Dr = ({
1661
+ return /* @__PURE__ */ o(Ir, { ...e, value: t, onChange: r });
1662
+ }, Sr = ({
1640
1663
  profile: e,
1641
1664
  actions: t = [],
1642
1665
  onProfileChange: r,
@@ -1645,33 +1668,33 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1645
1668
  showName: i = !0,
1646
1669
  className: a
1647
1670
  }) => {
1648
- const { name: d, role: c, email: l, avatarUrl: p } = e, [u, m] = A(!1), [v, b] = A(!1), [f, h] = A(d), [y, k] = A(c ?? ""), w = _(null), N = _(null);
1671
+ const { name: d, role: c, email: l, avatarUrl: p } = e, [u, m] = $(!1), [v, b] = $(!1), [h, g] = $(d), [y, w] = $(c ?? ""), L = _(null), k = _(null);
1649
1672
  F(() => {
1650
- u && (h(d), k(c ?? ""), b(!1));
1673
+ u && (g(d), w(c ?? ""), b(!1));
1651
1674
  }, [u, d, c]), F(() => {
1652
1675
  if (!u) return;
1653
- const I = (S) => {
1654
- w.current && !w.current.contains(S.target) && m(!1);
1676
+ const N = (I) => {
1677
+ L.current && !L.current.contains(I.target) && m(!1);
1655
1678
  };
1656
- return document.addEventListener("mousedown", I), () => document.removeEventListener("mousedown", I);
1679
+ return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
1657
1680
  }, [u]);
1658
- const L = (I) => {
1659
- I.preventDefault(), r == null || r({ name: f, role: y }), b(!1);
1660
- }, T = (I) => {
1661
- var g;
1662
- const S = (g = I.target.files) == null ? void 0 : g[0];
1663
- S && (n == null || n(S)), I.target.value = "";
1664
- }, M = (I) => p ? /* @__PURE__ */ o("img", { src: p, alt: d, className: "w-full h-full object-cover" }) : /* @__PURE__ */ o(We, { size: I, className: "text-muted-foreground" });
1665
- return /* @__PURE__ */ x("div", { ref: w, className: "relative inline-block text-left", children: [
1681
+ const S = (N) => {
1682
+ N.preventDefault(), r == null || r({ name: h, role: y }), b(!1);
1683
+ }, D = (N) => {
1684
+ var f;
1685
+ const I = (f = N.target.files) == null ? void 0 : f[0];
1686
+ I && (n == null || n(I)), N.target.value = "";
1687
+ }, C = (N) => p ? /* @__PURE__ */ o("img", { src: p, alt: d, className: "w-full h-full object-cover" }) : /* @__PURE__ */ o(We, { size: N, className: "text-muted-foreground" });
1688
+ return /* @__PURE__ */ x("div", { ref: L, className: "relative inline-block text-left", children: [
1666
1689
  /* @__PURE__ */ x(
1667
1690
  "button",
1668
1691
  {
1669
1692
  type: "button",
1670
- onClick: () => s ? s() : m((I) => !I),
1693
+ onClick: () => s ? s() : m((N) => !N),
1671
1694
  "aria-haspopup": s ? void 0 : "menu",
1672
1695
  "aria-expanded": s ? void 0 : u,
1673
1696
  "aria-label": "User Profile Menu",
1674
- className: P(
1697
+ className: M(
1675
1698
  "focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none transition-all duration-200 select-none",
1676
1699
  i ? "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",
1677
1700
  u && (i ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
@@ -1681,11 +1704,11 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1681
1704
  /* @__PURE__ */ o(
1682
1705
  "div",
1683
1706
  {
1684
- className: P(
1707
+ className: M(
1685
1708
  "rounded-full overflow-hidden border border-border/50 bg-muted flex items-center justify-center shrink-0 shadow-sm",
1686
1709
  i ? "w-6 h-6" : "w-full h-full"
1687
1710
  ),
1688
- children: M(i ? 13 : 12)
1711
+ children: C(i ? 13 : 12)
1689
1712
  }
1690
1713
  ),
1691
1714
  i && /* @__PURE__ */ x("div", { className: "flex flex-col min-w-0 leading-tight pr-1", children: [
@@ -1699,8 +1722,8 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1699
1722
  "input",
1700
1723
  {
1701
1724
  type: "file",
1702
- ref: N,
1703
- onChange: T,
1725
+ ref: k,
1726
+ onChange: D,
1704
1727
  accept: "image/*",
1705
1728
  "aria-label": "Upload avatar",
1706
1729
  className: "hidden"
@@ -1710,11 +1733,11 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1710
1733
  "div",
1711
1734
  {
1712
1735
  role: "menu",
1713
- className: P(
1736
+ className: M(
1714
1737
  "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",
1715
1738
  i ? "left-0" : "right-0"
1716
1739
  ),
1717
- children: v ? /* @__PURE__ */ x("form", { onSubmit: L, className: "p-2 flex flex-col gap-2", children: [
1740
+ children: v ? /* @__PURE__ */ x("form", { onSubmit: S, className: "p-2 flex flex-col gap-2", children: [
1718
1741
  /* @__PURE__ */ o("span", { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground", children: "Edit Profile" }),
1719
1742
  /* @__PURE__ */ x("div", { className: "flex flex-col gap-1", children: [
1720
1743
  /* @__PURE__ */ o("label", { htmlFor: "profile-name", className: "text-[9px] font-semibold text-muted-foreground", children: "Name" }),
@@ -1723,8 +1746,8 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1723
1746
  {
1724
1747
  id: "profile-name",
1725
1748
  type: "text",
1726
- value: f,
1727
- onChange: (I) => h(I.target.value),
1749
+ value: h,
1750
+ onChange: (N) => g(N.target.value),
1728
1751
  required: !0,
1729
1752
  className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
1730
1753
  }
@@ -1738,7 +1761,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1738
1761
  id: "profile-role",
1739
1762
  type: "text",
1740
1763
  value: y,
1741
- onChange: (I) => k(I.target.value),
1764
+ onChange: (N) => w(N.target.value),
1742
1765
  className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
1743
1766
  }
1744
1767
  )
@@ -1762,7 +1785,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1762
1785
  type: "submit",
1763
1786
  className: "px-2 py-1 text-[10px] rounded bg-primary text-primary-foreground hover:bg-primary/95 flex items-center gap-1 font-semibold",
1764
1787
  children: [
1765
- /* @__PURE__ */ o($t, { size: 10 }),
1788
+ /* @__PURE__ */ o(Rt, { size: 10 }),
1766
1789
  " Save"
1767
1790
  ]
1768
1791
  }
@@ -1774,17 +1797,17 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1774
1797
  "div",
1775
1798
  {
1776
1799
  onClick: () => {
1777
- var I;
1778
- return n && ((I = N.current) == null ? void 0 : I.click());
1800
+ var N;
1801
+ return n && ((N = k.current) == null ? void 0 : N.click());
1779
1802
  },
1780
1803
  title: n ? "Upload avatar image" : void 0,
1781
- className: P(
1804
+ className: M(
1782
1805
  "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",
1783
1806
  n && "cursor-pointer"
1784
1807
  ),
1785
1808
  children: [
1786
- M(24),
1787
- n && /* @__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(Rt, { size: 14, className: "text-white" }) })
1809
+ C(24),
1810
+ n && /* @__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(Ft, { size: 14, className: "text-white" }) })
1788
1811
  ]
1789
1812
  }
1790
1813
  ),
@@ -1799,7 +1822,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1799
1822
  title: "Edit Profile",
1800
1823
  "aria-label": "Edit Profile",
1801
1824
  className: "p-1 text-muted-foreground hover:text-foreground hover:bg-accent/40 rounded transition-colors",
1802
- children: /* @__PURE__ */ o(Ft, { size: 10 })
1825
+ children: /* @__PURE__ */ o(zt, { size: 10 })
1803
1826
  }
1804
1827
  )
1805
1828
  ] }),
@@ -1807,37 +1830,37 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1807
1830
  l && /* @__PURE__ */ o("span", { className: "text-[9px] text-muted-foreground/60 truncate font-mono mt-0.5", children: l })
1808
1831
  ] })
1809
1832
  ] }),
1810
- t.map((I) => {
1811
- const S = I.icon;
1833
+ t.map((N) => {
1834
+ const I = N.icon;
1812
1835
  return /* @__PURE__ */ x(
1813
1836
  "button",
1814
1837
  {
1815
1838
  type: "button",
1816
1839
  role: "menuitem",
1817
1840
  onClick: () => {
1818
- I.onSelect(), m(!1);
1841
+ N.onSelect(), m(!1);
1819
1842
  },
1820
- className: P(
1843
+ className: M(
1821
1844
  "w-full px-2 py-1.5 text-left rounded-md text-[11px] font-medium flex items-center gap-2 cursor-pointer transition-colors",
1822
- I.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
1823
- I.divider && "border-t border-border/20 pt-2 mt-1"
1845
+ N.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
1846
+ N.divider && "border-t border-border/20 pt-2 mt-1"
1824
1847
  ),
1825
1848
  children: [
1826
- S && /* @__PURE__ */ o(S, { size: 12, className: "opacity-70" }),
1827
- I.label
1849
+ I && /* @__PURE__ */ o(I, { size: 12, className: "opacity-70" }),
1850
+ N.label
1828
1851
  ]
1829
1852
  },
1830
- I.id
1853
+ N.id
1831
1854
  );
1832
1855
  })
1833
1856
  ] })
1834
1857
  }
1835
1858
  )
1836
1859
  ] });
1837
- }, In = (e) => {
1860
+ }, Mn = (e) => {
1838
1861
  const t = te((l) => l.name), r = te((l) => l.role), n = te((l) => l.email), s = te((l) => l.avatarUrl), i = te((l) => l.customAvatar), a = te((l) => l.updateProfile), d = te((l) => l.setCustomAvatar);
1839
1862
  return /* @__PURE__ */ o(
1840
- Dr,
1863
+ Sr,
1841
1864
  {
1842
1865
  ...e,
1843
1866
  profile: { name: t, role: r, email: n, avatarUrl: i || s },
@@ -1850,13 +1873,13 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1850
1873
  }
1851
1874
  }
1852
1875
  );
1853
- }, Pn = ({ title: e, subtitle: t, icon: r, className: n }) => /* @__PURE__ */ x("div", { className: P("flex items-center space-x-3 select-none", n), children: [
1876
+ }, Cn = ({ title: e, subtitle: t, icon: r, className: n }) => /* @__PURE__ */ x("div", { className: M("flex items-center space-x-3 select-none", n), children: [
1854
1877
  r && /* @__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: r }),
1855
1878
  /* @__PURE__ */ x("div", { className: "min-w-0", children: [
1856
1879
  /* @__PURE__ */ o("h1", { className: "text-xs font-black uppercase tracking-wider text-foreground font-mono truncate", children: e }),
1857
1880
  t && /* @__PURE__ */ o("p", { className: "text-[9px] text-muted-foreground font-semibold truncate", children: t })
1858
1881
  ] })
1859
- ] }), Lr = ({ x: e, y: t, items: r, onClose: n, className: s }) => {
1882
+ ] }), Pr = ({ x: e, y: t, items: r, onClose: n, className: s }) => {
1860
1883
  const i = _(null);
1861
1884
  return F(() => {
1862
1885
  const a = (c) => {
@@ -1873,7 +1896,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1873
1896
  ref: i,
1874
1897
  role: "menu",
1875
1898
  style: { top: t, left: e },
1876
- className: P(
1899
+ className: M(
1877
1900
  "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",
1878
1901
  s
1879
1902
  ),
@@ -1891,7 +1914,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1891
1914
  onKeyDown: (c) => {
1892
1915
  a.disabled || c.key !== "Enter" && c.key !== " " || (c.preventDefault(), a.onClick(), n());
1893
1916
  },
1894
- className: P(
1917
+ className: M(
1895
1918
  "px-3 py-1.5 text-xs flex items-center focus:outline-none",
1896
1919
  a.disabled ? "opacity-40 cursor-default" : "cursor-pointer hover:bg-accent hover:text-accent-foreground focus:bg-accent"
1897
1920
  ),
@@ -1904,7 +1927,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1904
1927
  ] }, `${a.label}-${d}`))
1905
1928
  }
1906
1929
  );
1907
- }, Sn = ({
1930
+ }, An = ({
1908
1931
  columns: e,
1909
1932
  data: t,
1910
1933
  onRowClick: r,
@@ -1916,150 +1939,150 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
1916
1939
  placeholder: c = "No data available",
1917
1940
  className: l
1918
1941
  }) => {
1919
- const [p, u] = A(""), [m, v] = A(null), [b, f] = A(-1), h = _(null);
1942
+ const [p, u] = $(""), [m, v] = $(null), [b, h] = $(-1), g = _(null);
1920
1943
  F(() => {
1921
- f(-1);
1944
+ h(-1);
1922
1945
  }, [p, m]);
1923
1946
  const y = B(() => {
1924
1947
  if (!p) return t;
1925
- const g = p.toLowerCase();
1926
- return t.filter((D) => Object.values(D).some((C) => C == null ? !1 : String(C).toLowerCase().includes(g)));
1927
- }, [t, p]), k = B(() => {
1948
+ const f = p.toLowerCase();
1949
+ return t.filter((E) => Object.values(E).some((P) => P == null ? !1 : String(P).toLowerCase().includes(f)));
1950
+ }, [t, p]), w = B(() => {
1928
1951
  if (!m) return y;
1929
- const { key: g, direction: D } = m;
1930
- return [...y].sort((C, $) => {
1931
- const K = C[g], O = $[g];
1952
+ const { key: f, direction: E } = m;
1953
+ return [...y].sort((P, A) => {
1954
+ const K = P[f], O = A[f];
1932
1955
  if (K === O) return 0;
1933
1956
  if (K == null) return 1;
1934
1957
  if (O == null) return -1;
1935
- const H = Number(K), E = Number(O);
1936
- if (!isNaN(H) && !isNaN(E))
1937
- return D === "asc" ? H - E : E - H;
1958
+ const H = Number(K), T = Number(O);
1959
+ if (!isNaN(H) && !isNaN(T))
1960
+ return E === "asc" ? H - T : T - H;
1938
1961
  const z = String(K).toLowerCase(), R = String(O).toLowerCase();
1939
- return D === "asc" ? z.localeCompare(R) : R.localeCompare(z);
1962
+ return E === "asc" ? z.localeCompare(R) : R.localeCompare(z);
1940
1963
  });
1941
- }, [y, m]), w = (g, D) => {
1942
- D !== !1 && v((C) => !C || C.key !== g ? { key: g, direction: "asc" } : C.direction === "asc" ? { key: g, direction: "desc" } : null);
1943
- }, N = (g) => {
1944
- if (!(k.length === 0 || d)) {
1945
- if (g.key === "ArrowDown")
1946
- g.preventDefault(), f((D) => {
1947
- const C = D + 1;
1948
- return C >= k.length ? 0 : C;
1964
+ }, [y, m]), L = (f, E) => {
1965
+ E !== !1 && v((P) => !P || P.key !== f ? { key: f, direction: "asc" } : P.direction === "asc" ? { key: f, direction: "desc" } : null);
1966
+ }, k = (f) => {
1967
+ if (!(w.length === 0 || d)) {
1968
+ if (f.key === "ArrowDown")
1969
+ f.preventDefault(), h((E) => {
1970
+ const P = E + 1;
1971
+ return P >= w.length ? 0 : P;
1949
1972
  });
1950
- else if (g.key === "ArrowUp")
1951
- g.preventDefault(), f((D) => {
1952
- const C = D - 1;
1953
- return C < 0 ? k.length - 1 : C;
1973
+ else if (f.key === "ArrowUp")
1974
+ f.preventDefault(), h((E) => {
1975
+ const P = E - 1;
1976
+ return P < 0 ? w.length - 1 : P;
1954
1977
  });
1955
- else if ((g.key === "Enter" || g.key === " ") && (g.preventDefault(), b >= 0 && b < k.length)) {
1956
- const D = k[b];
1957
- r && r(D);
1978
+ else if ((f.key === "Enter" || f.key === " ") && (f.preventDefault(), b >= 0 && b < w.length)) {
1979
+ const E = w[b];
1980
+ r && r(E);
1958
1981
  }
1959
1982
  }
1960
- }, L = (g) => g.sortable === !1 ? null : (m == null ? void 0 : m.key) !== g.key ? /* @__PURE__ */ o(zt, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : m.direction === "asc" ? /* @__PURE__ */ o(Ge, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ o(Je, { size: 14, className: "text-primary ml-1.5" }), T = () => /* @__PURE__ */ o("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: e.map((g) => /* @__PURE__ */ o(
1983
+ }, S = (f) => f.sortable === !1 ? null : (m == null ? void 0 : m.key) !== f.key ? /* @__PURE__ */ o(Ot, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : m.direction === "asc" ? /* @__PURE__ */ o(Ge, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ o(Je, { size: 14, className: "text-primary ml-1.5" }), D = () => /* @__PURE__ */ o("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: e.map((f) => /* @__PURE__ */ o(
1961
1984
  "th",
1962
1985
  {
1963
1986
  role: "columnheader",
1964
- "aria-sort": (m == null ? void 0 : m.key) === g.key ? m.direction === "asc" ? "ascending" : "descending" : "none",
1965
- className: P(
1987
+ "aria-sort": (m == null ? void 0 : m.key) === f.key ? m.direction === "asc" ? "ascending" : "descending" : "none",
1988
+ className: M(
1966
1989
  "p-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider text-left transition-colors",
1967
- g.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
1990
+ f.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
1968
1991
  ),
1969
- style: { width: g.width },
1970
- onClick: () => w(g.key, g.sortable),
1992
+ style: { width: f.width },
1993
+ onClick: () => L(f.key, f.sortable),
1971
1994
  children: /* @__PURE__ */ x("div", { className: "flex items-center", children: [
1972
- /* @__PURE__ */ o("span", { children: g.header }),
1973
- L(g)
1995
+ /* @__PURE__ */ o("span", { children: f.header }),
1996
+ S(f)
1974
1997
  ] })
1975
1998
  },
1976
- g.key
1977
- )) }), M = (g, D) => {
1978
- const C = n !== void 0 && g[s] === n;
1999
+ f.key
2000
+ )) }), C = (f, E) => {
2001
+ const P = n !== void 0 && f[s] === n;
1979
2002
  return /* @__PURE__ */ o(
1980
2003
  "tr",
1981
2004
  {
1982
2005
  role: "row",
1983
- "aria-selected": C,
1984
- onClick: () => r && r(g),
1985
- className: P(
2006
+ "aria-selected": P,
2007
+ onClick: () => r && r(f),
2008
+ className: M(
1986
2009
  "border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
1987
- C && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1988
- b === D && "bg-accent/60 ring-1 ring-inset ring-ring"
2010
+ P && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
2011
+ b === E && "bg-accent/60 ring-1 ring-inset ring-ring"
1989
2012
  ),
1990
2013
  children: e.map((K) => {
1991
- const O = g[K.key];
1992
- return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: K.render ? K.render(O, g) : O != null ? String(O) : "" }, K.key);
2014
+ const O = f[K.key];
2015
+ return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: K.render ? K.render(O, f) : O != null ? String(O) : "" }, K.key);
1993
2016
  })
1994
2017
  },
1995
- String(g[s] || D)
2018
+ String(f[s] || E)
1996
2019
  );
1997
- }, I = B(() => ({
1998
- Table: (g) => /* @__PURE__ */ o(
2020
+ }, N = B(() => ({
2021
+ Table: (f) => /* @__PURE__ */ o(
1999
2022
  "table",
2000
2023
  {
2001
- ...g,
2024
+ ...f,
2002
2025
  role: "grid",
2003
2026
  className: "w-full border-collapse text-left bg-background text-foreground"
2004
2027
  }
2005
2028
  ),
2006
- TableHead: pe.forwardRef((g, D) => /* @__PURE__ */ o("thead", { ref: D, ...g, 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)]" })),
2007
- TableBody: pe.forwardRef((g, D) => /* @__PURE__ */ o("tbody", { ref: D, ...g })),
2008
- TableRow: ({ item: g, context: D, ...C }) => {
2009
- if (!D || !g) return /* @__PURE__ */ o("tr", { ...C });
2010
- const $ = D.selectedRowId !== void 0 && g[D.rowKey] === D.selectedRowId, K = D.focusedIndex === C["data-index"];
2029
+ TableHead: pe.forwardRef((f, E) => /* @__PURE__ */ o("thead", { ref: E, ...f, 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)]" })),
2030
+ TableBody: pe.forwardRef((f, E) => /* @__PURE__ */ o("tbody", { ref: E, ...f })),
2031
+ TableRow: ({ item: f, context: E, ...P }) => {
2032
+ if (!E || !f) return /* @__PURE__ */ o("tr", { ...P });
2033
+ const A = E.selectedRowId !== void 0 && f[E.rowKey] === E.selectedRowId, K = E.focusedIndex === P["data-index"];
2011
2034
  return /* @__PURE__ */ o(
2012
2035
  "tr",
2013
2036
  {
2014
- ...C,
2037
+ ...P,
2015
2038
  onClick: () => {
2016
2039
  var O;
2017
- return (O = D.onRowClick) == null ? void 0 : O.call(D, g);
2040
+ return (O = E.onRowClick) == null ? void 0 : O.call(E, f);
2018
2041
  },
2019
- className: P(
2042
+ className: M(
2020
2043
  "border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
2021
- $ && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
2044
+ A && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
2022
2045
  K && "bg-accent/60 ring-1 ring-inset ring-ring"
2023
2046
  )
2024
2047
  }
2025
2048
  );
2026
2049
  }
2027
- }), []), S = () => d ? /* @__PURE__ */ x("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
2050
+ }), []), I = () => d ? /* @__PURE__ */ x("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
2028
2051
  /* @__PURE__ */ o(Ye, { className: "animate-spin text-primary", size: 24 }),
2029
2052
  /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground", children: "Loading dataset..." })
2030
- ] }) : k.length === 0 ? /* @__PURE__ */ x("div", { className: "flex flex-col items-center justify-center h-48 text-center px-4", children: [
2053
+ ] }) : w.length === 0 ? /* @__PURE__ */ x("div", { className: "flex flex-col items-center justify-center h-48 text-center px-4", children: [
2031
2054
  /* @__PURE__ */ o("span", { className: "text-sm font-medium text-foreground", children: c }),
2032
2055
  /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground mt-1", children: "No items matched your search query." })
2033
2056
  ] }) : i ? /* @__PURE__ */ o("div", { className: "flex-1 min-h-[300px] h-full relative", children: /* @__PURE__ */ o(
2034
- Kt,
2057
+ Ut,
2035
2058
  {
2036
- data: k,
2059
+ data: w,
2037
2060
  context: {
2038
2061
  selectedRowId: n,
2039
2062
  focusedIndex: b,
2040
2063
  rowKey: s,
2041
2064
  onRowClick: r
2042
2065
  },
2043
- components: I,
2044
- fixedHeaderContent: T,
2045
- itemContent: (g, D) => /* @__PURE__ */ o(He, { children: e.map((C) => {
2046
- const $ = D[C.key];
2047
- return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: C.render ? C.render($, D) : $ != null ? String($) : "" }, C.key);
2066
+ components: N,
2067
+ fixedHeaderContent: D,
2068
+ itemContent: (f, E) => /* @__PURE__ */ o(He, { children: e.map((P) => {
2069
+ const A = E[P.key];
2070
+ return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: P.render ? P.render(A, E) : A != null ? String(A) : "" }, P.key);
2048
2071
  }) })
2049
2072
  }
2050
2073
  ) }) : /* @__PURE__ */ o("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ x("table", { role: "grid", className: "w-full border-collapse text-left bg-background text-foreground", children: [
2051
- /* @__PURE__ */ o("thead", { children: T() }),
2052
- /* @__PURE__ */ o("tbody", { children: k.map((g, D) => M(g, D)) })
2074
+ /* @__PURE__ */ o("thead", { children: D() }),
2075
+ /* @__PURE__ */ o("tbody", { children: w.map((f, E) => C(f, E)) })
2053
2076
  ] }) });
2054
2077
  return /* @__PURE__ */ x(
2055
2078
  "div",
2056
2079
  {
2057
- ref: h,
2080
+ ref: g,
2058
2081
  role: "region",
2059
2082
  "aria-label": "Data Grid",
2060
2083
  tabIndex: 0,
2061
- onKeyDown: N,
2062
- className: P(
2084
+ onKeyDown: k,
2085
+ className: M(
2063
2086
  "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",
2064
2087
  l
2065
2088
  ),
@@ -2074,7 +2097,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2074
2097
  placeholder: "Filter table rows...",
2075
2098
  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",
2076
2099
  value: p,
2077
- onChange: (g) => u(g.target.value)
2100
+ onChange: (f) => u(f.target.value)
2078
2101
  }
2079
2102
  ),
2080
2103
  p && /* @__PURE__ */ o(
@@ -2088,17 +2111,17 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2088
2111
  )
2089
2112
  ] }),
2090
2113
  /* @__PURE__ */ x("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
2091
- k.length,
2114
+ w.length,
2092
2115
  " of ",
2093
2116
  t.length,
2094
2117
  " records"
2095
2118
  ] })
2096
2119
  ] }),
2097
- S()
2120
+ I()
2098
2121
  ]
2099
2122
  }
2100
2123
  );
2101
- }, Mn = ({
2124
+ }, $n = ({
2102
2125
  results: e,
2103
2126
  onQueryChange: t,
2104
2127
  onSelect: r,
@@ -2107,35 +2130,35 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2107
2130
  debounceMs: i = 200,
2108
2131
  className: a
2109
2132
  }) => {
2110
- const [d, c] = A(""), [l, p] = A(!1), [u, m] = A(0), v = _(null), b = _(null), f = B(() => n || [...new Set(e.map((w) => w.category))], [n, e]), h = B(
2111
- () => f.flatMap((w) => e.filter((N) => N.category === w)),
2112
- [f, e]
2133
+ const [d, c] = $(""), [l, p] = $(!1), [u, m] = $(0), v = _(null), b = _(null), h = vt(), g = (N) => `${h}-option-${N}`, y = B(() => n || [...new Set(e.map((N) => N.category))], [n, e]), w = B(
2134
+ () => y.flatMap((N) => e.filter((I) => I.category === N)),
2135
+ [y, e]
2113
2136
  );
2114
2137
  F(() => {
2115
- const w = (N) => {
2116
- v.current && !v.current.contains(N.target) && p(!1);
2138
+ const N = (I) => {
2139
+ v.current && !v.current.contains(I.target) && p(!1);
2117
2140
  };
2118
- return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
2141
+ return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
2119
2142
  }, []), F(() => {
2120
2143
  if (!t) return;
2121
- const w = window.setTimeout(() => t(d), i);
2122
- return () => window.clearTimeout(w);
2144
+ const N = window.setTimeout(() => t(d), i);
2145
+ return () => window.clearTimeout(N);
2123
2146
  }, [d, i, t]), F(() => {
2124
2147
  m(0);
2125
2148
  }, [e]);
2126
- const y = (w) => {
2127
- r(w), p(!1), c("");
2128
- }, k = (w) => {
2129
- var N;
2149
+ const L = (N) => {
2150
+ r(N), p(!1), c("");
2151
+ }, k = (N) => {
2152
+ var I;
2130
2153
  if (!l) {
2131
- (w.key === "ArrowDown" || w.key === "Enter") && p(!0);
2154
+ (N.key === "ArrowDown" || N.key === "Enter") && p(!0);
2132
2155
  return;
2133
2156
  }
2134
- w.key === "ArrowDown" ? (w.preventDefault(), m((L) => h.length ? (L + 1) % h.length : 0)) : w.key === "ArrowUp" ? (w.preventDefault(), m(
2135
- (L) => h.length ? (L - 1 + h.length) % h.length : 0
2136
- )) : w.key === "Enter" ? (w.preventDefault(), h[u] && y(h[u])) : w.key === "Escape" && (w.preventDefault(), p(!1), (N = b.current) == null || N.blur());
2137
- };
2138
- return /* @__PURE__ */ x("div", { ref: v, className: P("relative w-full", a), children: [
2157
+ N.key === "ArrowDown" ? (N.preventDefault(), m((f) => w.length ? (f + 1) % w.length : 0)) : N.key === "ArrowUp" ? (N.preventDefault(), m(
2158
+ (f) => w.length ? (f - 1 + w.length) % w.length : 0
2159
+ )) : N.key === "Enter" ? (N.preventDefault(), w[u] && L(w[u])) : N.key === "Escape" && (N.preventDefault(), p(!1), (I = b.current) == null || I.blur());
2160
+ }, S = l && !!d.trim(), D = `${h}-listbox`, C = w[u];
2161
+ return /* @__PURE__ */ x("div", { ref: v, className: M("relative w-full", a), children: [
2139
2162
  /* @__PURE__ */ x("div", { className: "relative flex items-center", children: [
2140
2163
  /* @__PURE__ */ o(
2141
2164
  ge,
@@ -2150,12 +2173,15 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2150
2173
  ref: b,
2151
2174
  type: "text",
2152
2175
  role: "combobox",
2153
- "aria-expanded": l,
2176
+ "aria-expanded": S,
2177
+ "aria-controls": S ? D : void 0,
2178
+ "aria-activedescendant": S && C ? g(u) : void 0,
2179
+ "aria-autocomplete": "list",
2154
2180
  "aria-label": s,
2155
2181
  value: d,
2156
2182
  placeholder: s,
2157
- onChange: (w) => {
2158
- c(w.target.value), p(!0);
2183
+ onChange: (N) => {
2184
+ c(N.target.value), p(!0);
2159
2185
  },
2160
2186
  onFocus: () => p(!0),
2161
2187
  onKeyDown: k,
@@ -2167,8 +2193,8 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2167
2193
  {
2168
2194
  type: "button",
2169
2195
  onClick: () => {
2170
- var w;
2171
- c(""), (w = b.current) == null || w.focus();
2196
+ var N;
2197
+ c(""), (N = b.current) == null || N.focus();
2172
2198
  },
2173
2199
  "aria-label": "Clear search",
2174
2200
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
@@ -2176,56 +2202,59 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2176
2202
  }
2177
2203
  )
2178
2204
  ] }),
2179
- l && d.trim() && /* @__PURE__ */ x(
2205
+ S && /* @__PURE__ */ x(
2180
2206
  "div",
2181
2207
  {
2208
+ id: D,
2182
2209
  role: "listbox",
2210
+ "aria-label": s,
2183
2211
  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",
2184
2212
  children: [
2185
- /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto py-1", children: h.length === 0 ? /* @__PURE__ */ x("div", { className: "px-4 py-6 text-center text-xs text-muted-foreground italic", children: [
2213
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto py-1", children: w.length === 0 ? /* @__PURE__ */ x("div", { className: "px-4 py-6 text-center text-xs text-muted-foreground italic", children: [
2186
2214
  'No results found matching "',
2187
2215
  d,
2188
2216
  '"'
2189
- ] }) : f.map((w) => {
2190
- const N = e.filter((L) => L.category === w);
2191
- return N.length === 0 ? null : /* @__PURE__ */ x("div", { className: "flex flex-col", children: [
2192
- /* @__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 }),
2193
- N.map((L) => {
2194
- const T = L.icon, M = h.indexOf(L), I = M === u;
2217
+ ] }) : y.map((N) => {
2218
+ const I = e.filter((f) => f.category === N);
2219
+ return I.length === 0 ? null : /* @__PURE__ */ x("div", { className: "flex flex-col", children: [
2220
+ /* @__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: N }),
2221
+ I.map((f) => {
2222
+ const E = f.icon, P = w.indexOf(f), A = P === u;
2195
2223
  return /* @__PURE__ */ x(
2196
2224
  "div",
2197
2225
  {
2226
+ id: g(P),
2198
2227
  role: "option",
2199
- "aria-selected": I,
2200
- onClick: () => y(L),
2201
- onMouseEnter: () => m(M),
2202
- className: P(
2228
+ "aria-selected": A,
2229
+ onClick: () => L(f),
2230
+ onMouseEnter: () => m(P),
2231
+ className: M(
2203
2232
  "px-3 py-2 cursor-pointer flex items-start space-x-2.5 transition-colors border-l-2",
2204
- I ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
2233
+ A ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
2205
2234
  ),
2206
2235
  children: [
2207
- T && /* @__PURE__ */ o(
2236
+ E && /* @__PURE__ */ o(
2208
2237
  "div",
2209
2238
  {
2210
- className: P(
2239
+ className: M(
2211
2240
  "mt-0.5 p-1 rounded bg-muted/50",
2212
- I && "bg-background text-primary"
2241
+ A && "bg-background text-primary"
2213
2242
  ),
2214
- children: /* @__PURE__ */ o(T, { size: 12 })
2243
+ children: /* @__PURE__ */ o(E, { size: 12 })
2215
2244
  }
2216
2245
  ),
2217
2246
  /* @__PURE__ */ x("div", { className: "flex-1 min-w-0", children: [
2218
- /* @__PURE__ */ o("div", { className: "text-xs font-medium truncate", children: L.title }),
2219
- L.description && /* @__PURE__ */ o("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: L.description })
2247
+ /* @__PURE__ */ o("div", { className: "text-xs font-medium truncate", children: f.title }),
2248
+ f.description && /* @__PURE__ */ o("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: f.description })
2220
2249
  ] })
2221
2250
  ]
2222
2251
  },
2223
- `${L.category}-${L.id}`
2252
+ `${f.category}-${f.id}`
2224
2253
  );
2225
2254
  })
2226
- ] }, w);
2255
+ ] }, N);
2227
2256
  }) }),
2228
- h.length > 0 && /* @__PURE__ */ x("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: [
2257
+ w.length > 0 && /* @__PURE__ */ x("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: [
2229
2258
  /* @__PURE__ */ x("div", { className: "flex space-x-2", children: [
2230
2259
  /* @__PURE__ */ x("span", { children: [
2231
2260
  /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↑↓" }),
@@ -2244,7 +2273,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2244
2273
  }
2245
2274
  )
2246
2275
  ] });
2247
- }, Cn = ({
2276
+ }, Rn = ({
2248
2277
  placeholder: e = "Search...",
2249
2278
  onSearch: t,
2250
2279
  results: r,
@@ -2253,19 +2282,19 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2253
2282
  loading: i = !1,
2254
2283
  className: a
2255
2284
  }) => {
2256
- const [d, c] = A(""), [l, p] = A(!1), [u, m] = A(-1), v = _(null);
2285
+ const [d, c] = $(""), [l, p] = $(!1), [u, m] = $(-1), v = _(null);
2257
2286
  F(() => {
2258
- const h = setTimeout(() => {
2287
+ const g = setTimeout(() => {
2259
2288
  t(d);
2260
2289
  }, 300);
2261
- return () => clearTimeout(h);
2290
+ return () => clearTimeout(g);
2262
2291
  }, [d, t]);
2263
2292
  const b = s.filter(
2264
- (h) => h.toLowerCase().includes(d.toLowerCase()) && h.toLowerCase() !== d.toLowerCase()
2265
- ), f = (h) => {
2266
- l && b.length > 0 && (h.key === "ArrowDown" ? (h.preventDefault(), m((y) => (y + 1) % b.length)) : h.key === "ArrowUp" ? (h.preventDefault(), m((y) => (y - 1 + b.length) % b.length)) : h.key === "Enter" && u >= 0 && (h.preventDefault(), c(b[u]), p(!1)));
2293
+ (g) => g.toLowerCase().includes(d.toLowerCase()) && g.toLowerCase() !== d.toLowerCase()
2294
+ ), h = (g) => {
2295
+ l && b.length > 0 && (g.key === "ArrowDown" ? (g.preventDefault(), m((y) => (y + 1) % b.length)) : g.key === "ArrowUp" ? (g.preventDefault(), m((y) => (y - 1 + b.length) % b.length)) : g.key === "Enter" && u >= 0 && (g.preventDefault(), c(b[u]), p(!1)));
2267
2296
  };
2268
- return /* @__PURE__ */ x("div", { ref: v, className: P("flex flex-col h-full bg-background", a), children: [
2297
+ return /* @__PURE__ */ x("div", { ref: v, className: M("flex flex-col h-full bg-background", a), children: [
2269
2298
  /* @__PURE__ */ x("div", { className: "p-3 border-b border-border/50", children: [
2270
2299
  /* @__PURE__ */ x("div", { className: "relative", children: [
2271
2300
  /* @__PURE__ */ o("div", { className: "absolute left-2.5 top-2.5 text-muted-foreground", children: i ? /* @__PURE__ */ o(Ye, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ o(ge, { size: 14 }) }),
@@ -2276,10 +2305,10 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2276
2305
  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",
2277
2306
  placeholder: e,
2278
2307
  value: d,
2279
- onChange: (h) => {
2280
- c(h.target.value), p(!0), m(-1);
2308
+ onChange: (g) => {
2309
+ c(g.target.value), p(!0), m(-1);
2281
2310
  },
2282
- onKeyDown: f,
2311
+ onKeyDown: h,
2283
2312
  onFocus: () => p(!0)
2284
2313
  }
2285
2314
  ),
@@ -2294,51 +2323,51 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2294
2323
  }
2295
2324
  )
2296
2325
  ] }),
2297
- l && b.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: b.map((h, y) => /* @__PURE__ */ x(
2326
+ l && b.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: b.map((g, y) => /* @__PURE__ */ x(
2298
2327
  "div",
2299
2328
  {
2300
- className: P(
2329
+ className: M(
2301
2330
  "px-3 py-1.5 text-xs cursor-pointer flex items-center space-x-2",
2302
2331
  y === u ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
2303
2332
  ),
2304
2333
  onClick: () => {
2305
- c(h), p(!1);
2334
+ c(g), p(!1);
2306
2335
  },
2307
2336
  children: [
2308
- /* @__PURE__ */ o(Ot, { size: 12, className: "text-muted-foreground" }),
2309
- /* @__PURE__ */ o("span", { children: h })
2337
+ /* @__PURE__ */ o(_t, { size: 12, className: "text-muted-foreground" }),
2338
+ /* @__PURE__ */ o("span", { children: g })
2310
2339
  ]
2311
2340
  },
2312
- h
2341
+ g
2313
2342
  )) })
2314
2343
  ] }),
2315
- /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto", children: r.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: r.map((h) => {
2316
- const y = h.icon;
2344
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto", children: r.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: r.map((g) => {
2345
+ const y = g.icon;
2317
2346
  return /* @__PURE__ */ o(
2318
2347
  "div",
2319
2348
  {
2320
- onClick: () => n(h),
2349
+ onClick: () => n(g),
2321
2350
  className: "px-4 py-2 hover:bg-accent/50 cursor-pointer group transition-colors border-l-2 border-transparent hover:border-primary",
2322
2351
  children: /* @__PURE__ */ x("div", { className: "flex items-start space-x-3", children: [
2323
2352
  y && /* @__PURE__ */ o("div", { className: "mt-0.5 p-1 rounded bg-muted group-hover:bg-background transition-colors", children: /* @__PURE__ */ o(y, { size: 14, className: "text-muted-foreground group-hover:text-primary" }) }),
2324
2353
  /* @__PURE__ */ x("div", { className: "flex-1 min-w-0", children: [
2325
2354
  /* @__PURE__ */ x("div", { className: "flex items-center justify-between", children: [
2326
- /* @__PURE__ */ o("span", { className: "text-xs font-medium truncate", children: h.title }),
2327
- h.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: h.category })
2355
+ /* @__PURE__ */ o("span", { className: "text-xs font-medium truncate", children: g.title }),
2356
+ g.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: g.category })
2328
2357
  ] }),
2329
- h.description && /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: h.description })
2358
+ g.description && /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: g.description })
2330
2359
  ] })
2331
2360
  ] })
2332
2361
  },
2333
- h.id
2362
+ g.id
2334
2363
  );
2335
2364
  }) }) })
2336
2365
  ] });
2337
- }, ct = (e, t = 0) => e.reduce((r, n) => (r.push({ ...n, level: t }), n.isOpen && n.children && r.push(...ct(n.children, t + 1)), r), []), Ir = (e) => {
2366
+ }, ct = (e, t = 0) => e.reduce((r, n) => (r.push({ ...n, level: t }), n.isOpen && n.children && r.push(...ct(n.children, t + 1)), r), []), Mr = (e) => {
2338
2367
  if (!e) return ["background"];
2339
2368
  const t = [e.isBranch ? "branch" : "leaf"];
2340
2369
  return e.kind && t.push(e.kind), t;
2341
- }, An = ({
2370
+ }, Fn = ({
2342
2371
  data: e,
2343
2372
  onToggle: t,
2344
2373
  onActivate: r,
@@ -2349,66 +2378,66 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2349
2378
  "aria-label": d = "Tree",
2350
2379
  className: c
2351
2380
  }) => {
2352
- const [l, p] = A(null), [u, m] = A(null), v = B(() => ct(e), [e]);
2381
+ const [l, p] = $(null), [u, m] = $(null), v = B(() => ct(e), [e]);
2353
2382
  F(() => {
2354
2383
  m(null);
2355
2384
  }, [e]);
2356
2385
  const b = s.filter(
2357
- (y) => !y.showFor || l && y.showFor.some((k) => l.scopes.includes(k))
2386
+ (y) => !y.showFor || l && y.showFor.some((w) => l.scopes.includes(w))
2358
2387
  ).map((y) => ({
2359
2388
  label: y.label,
2360
2389
  icon: y.icon,
2361
2390
  divider: y.divider,
2362
2391
  onClick: () => l && y.onSelect(l.context)
2363
- })), f = (y, k) => {
2392
+ })), h = (y, w) => {
2364
2393
  s.length !== 0 && (y.preventDefault(), y.stopPropagation(), p({
2365
2394
  x: y.clientX,
2366
2395
  y: y.clientY,
2367
- scopes: Ir(k),
2368
- context: { nodeId: (k == null ? void 0 : k.id) ?? null, node: k }
2396
+ scopes: Mr(w),
2397
+ context: { nodeId: (w == null ? void 0 : w.id) ?? null, node: w }
2369
2398
  }));
2370
- }, h = (y) => {
2371
- const k = v[y], w = !!k.isBranch;
2399
+ }, g = (y) => {
2400
+ const w = v[y], L = !!w.isBranch;
2372
2401
  return /* @__PURE__ */ x(
2373
2402
  "div",
2374
2403
  {
2375
2404
  role: "treeitem",
2376
- "aria-expanded": w ? !!k.isOpen : void 0,
2377
- "aria-level": k.level + 1,
2405
+ "aria-expanded": L ? !!w.isOpen : void 0,
2406
+ "aria-level": w.level + 1,
2378
2407
  tabIndex: 0,
2379
2408
  draggable: !0,
2380
- onDragStart: (N) => {
2381
- N.dataTransfer.setData("text/plain", k.id), N.dataTransfer.effectAllowed = "move";
2409
+ onDragStart: (k) => {
2410
+ k.dataTransfer.setData("text/plain", w.id), k.dataTransfer.effectAllowed = "move";
2382
2411
  },
2383
- onDragOver: (N) => {
2384
- w && (N.preventDefault(), m(k.id));
2412
+ onDragOver: (k) => {
2413
+ L && (k.preventDefault(), m(w.id));
2385
2414
  },
2386
2415
  onDragLeave: () => m(null),
2387
- onDrop: (N) => {
2388
- N.preventDefault(), m(null);
2389
- const L = N.dataTransfer.getData("text/plain");
2390
- L && L !== k.id && w && (n == null || n(L, k.id));
2416
+ onDrop: (k) => {
2417
+ k.preventDefault(), m(null);
2418
+ const S = k.dataTransfer.getData("text/plain");
2419
+ S && S !== w.id && L && (n == null || n(S, w.id));
2391
2420
  },
2392
- onClick: () => w && (t == null ? void 0 : t(k)),
2393
- onDoubleClick: () => r == null ? void 0 : r(k),
2394
- onKeyDown: (N) => {
2395
- N.key === "Enter" && (N.preventDefault(), w ? t == null || t(k) : r == null || r(k));
2421
+ onClick: () => L && (t == null ? void 0 : t(w)),
2422
+ onDoubleClick: () => r == null ? void 0 : r(w),
2423
+ onKeyDown: (k) => {
2424
+ k.key === "Enter" && (k.preventDefault(), L ? t == null || t(w) : r == null || r(w));
2396
2425
  },
2397
- onContextMenu: (N) => f(N, k),
2398
- style: { paddingLeft: `${k.level * i + 8}px` },
2399
- className: P(
2426
+ onContextMenu: (k) => h(k, w),
2427
+ style: { paddingLeft: `${w.level * i + 8}px` },
2428
+ className: M(
2400
2429
  "flex items-center py-1 px-2 cursor-pointer hover:bg-accent hover:text-accent-foreground select-none text-xs",
2401
2430
  "transition-colors duration-150 relative focus:outline-none focus:ring-1 focus:ring-ring",
2402
- u === k.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
2403
- k.className
2431
+ u === w.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
2432
+ w.className
2404
2433
  ),
2405
2434
  children: [
2406
- /* @__PURE__ */ o("div", { className: "w-4 h-4 mr-1 flex items-center justify-center shrink-0", children: w && (k.isOpen ? /* @__PURE__ */ o(Je, { size: 14 }) : /* @__PURE__ */ o(je, { size: 14 })) }),
2407
- k.icon && /* @__PURE__ */ o("div", { className: "mr-2 flex items-center shrink-0", children: k.icon }),
2408
- /* @__PURE__ */ o("span", { className: "truncate", children: k.label })
2435
+ /* @__PURE__ */ o("div", { className: "w-4 h-4 mr-1 flex items-center justify-center shrink-0", children: L && (w.isOpen ? /* @__PURE__ */ o(Je, { size: 14 }) : /* @__PURE__ */ o(je, { size: 14 })) }),
2436
+ w.icon && /* @__PURE__ */ o("div", { className: "mr-2 flex items-center shrink-0", children: w.icon }),
2437
+ /* @__PURE__ */ o("span", { className: "truncate", children: w.label })
2409
2438
  ]
2410
2439
  },
2411
- k.id
2440
+ w.id
2412
2441
  );
2413
2442
  };
2414
2443
  return /* @__PURE__ */ x(
@@ -2416,19 +2445,19 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2416
2445
  {
2417
2446
  role: "tree",
2418
2447
  "aria-label": d,
2419
- className: P("h-full w-full bg-muted/30", c),
2420
- onContextMenu: (y) => f(y, null),
2448
+ className: M("h-full w-full bg-muted/30", c),
2449
+ onContextMenu: (y) => h(y, null),
2421
2450
  children: [
2422
2451
  a ? /* @__PURE__ */ o(
2423
- Ut,
2452
+ Bt,
2424
2453
  {
2425
2454
  style: { height: "100%" },
2426
2455
  totalCount: v.length,
2427
- itemContent: h
2456
+ itemContent: g
2428
2457
  }
2429
- ) : /* @__PURE__ */ o("div", { className: "h-full overflow-auto", children: v.map((y, k) => h(k)) }),
2458
+ ) : /* @__PURE__ */ o("div", { className: "h-full overflow-auto", children: v.map((y, w) => g(w)) }),
2430
2459
  l && b.length > 0 && /* @__PURE__ */ o(
2431
- Lr,
2460
+ Pr,
2432
2461
  {
2433
2462
  x: l.x,
2434
2463
  y: l.y,
@@ -2453,7 +2482,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2453
2482
  }), we = (e, t) => ({
2454
2483
  x: (e.x - t.x) / t.scale,
2455
2484
  y: (e.y - t.y) / t.scale
2456
- }), $n = (e, t) => ({
2485
+ }), zn = (e, t) => ({
2457
2486
  x: e.x * t.scale + t.x,
2458
2487
  y: e.y * t.scale + t.y
2459
2488
  }), _e = (e, t, r) => {
@@ -2475,14 +2504,14 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2475
2504
  case "right":
2476
2505
  return { x: e.x + e.width, y: r.y };
2477
2506
  }
2478
- }, Pr = (e, t) => {
2507
+ }, Cr = (e, t) => {
2479
2508
  const r = J(e), n = J(t), s = n.x - r.x, i = n.y - r.y;
2480
2509
  return Math.abs(s) >= Math.abs(i) ? s >= 0 ? { source: "right", target: "left" } : { source: "left", target: "right" } : i >= 0 ? { source: "bottom", target: "top" } : { source: "top", target: "bottom" };
2481
2510
  }, ut = (e) => {
2482
2511
  if (e.length === 0) return null;
2483
2512
  const t = e.map(j), r = Math.min(...t.map((a) => a.x)), n = Math.min(...t.map((a) => a.y)), s = Math.max(...t.map((a) => a.x + a.width)), i = Math.max(...t.map((a) => a.y + a.height));
2484
2513
  return { x: r, y: n, width: s - r, height: i - n };
2485
- }, Sr = (e, t) => ({
2514
+ }, Ar = (e, t) => ({
2486
2515
  // Written as a subtraction rather than `-viewport.x / scale` so a pan of zero
2487
2516
  // yields +0 rather than -0, which otherwise leaks into equality checks.
2488
2517
  x: (0 - e.x) / e.scale,
@@ -2493,7 +2522,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2493
2522
  scale: r,
2494
2523
  x: t.width / 2 - e.x * r,
2495
2524
  y: t.height / 2 - e.y * r
2496
- }), Mr = (e, t) => {
2525
+ }), $r = (e, t) => {
2497
2526
  const r = Math.min(e.x, t.x), n = Math.min(e.y, t.y);
2498
2527
  return {
2499
2528
  x: r,
@@ -2501,7 +2530,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2501
2530
  width: Math.max(e.x + e.width, t.x + t.width) - r,
2502
2531
  height: Math.max(e.y + e.height, t.y + t.height) - n
2503
2532
  };
2504
- }, Cr = (e, t, r = 48) => {
2533
+ }, Rr = (e, t, r = 48) => {
2505
2534
  const n = ut(e);
2506
2535
  if (!n || t.width === 0 || t.height === 0) return dt;
2507
2536
  const s = Ne(
@@ -2535,7 +2564,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2535
2564
  (!a || v < a.score) && (a = { node: d, score: v });
2536
2565
  }
2537
2566
  return (a == null ? void 0 : a.node) ?? null;
2538
- }, Ar = (e, t, r, n = 64) => {
2567
+ }, Fr = (e, t, r, n = 64) => {
2539
2568
  const s = e.find((l) => l.id === t);
2540
2569
  if (!s) return { x: 0, y: 0 };
2541
2570
  const i = j(s), a = mt[r], d = {
@@ -2545,21 +2574,21 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2545
2574
  let c = { x: i.x + d.x, y: i.y + d.y };
2546
2575
  for (let l = 0; l < 24; l += 1) {
2547
2576
  const p = { ...c, width: i.width, height: i.height };
2548
- if (!e.some((m) => $r(j(m), p))) break;
2577
+ if (!e.some((m) => zr(j(m), p))) break;
2549
2578
  c = a.x !== 0 ? { x: c.x, y: c.y + i.height + n } : { x: c.x + i.width + n, y: c.y };
2550
2579
  }
2551
2580
  return c;
2552
- }, $r = (e, t) => e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y, Rn = (e, t) => e.filter((r) => r.source === t || r.target === t), Fn = (e, t, r) => e.some(
2581
+ }, zr = (e, t) => e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y, On = (e, t) => e.filter((r) => r.source === t || r.target === t), _n = (e, t, r) => e.some(
2553
2582
  (n) => n.source === t && n.target === r || n.source === r && n.target === t
2554
- ), zn = (e, t, r) => ({
2583
+ ), Kn = (e, t, r) => ({
2555
2584
  nodes: e.filter((n) => n.id !== r),
2556
2585
  edges: t.filter((n) => n.source !== r && n.target !== r)
2557
- }), On = (e, t) => {
2586
+ }), Un = (e, t) => {
2558
2587
  let r = t.length + 1;
2559
2588
  const n = new Set(t.map((s) => s.id));
2560
2589
  for (; n.has(`${e}-${r}`); ) r += 1;
2561
2590
  return `${e}-${r}`;
2562
- }, Rr = vt(
2591
+ }, Or = wt(
2563
2592
  ({
2564
2593
  children: e,
2565
2594
  overlay: t,
@@ -2576,141 +2605,141 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2576
2605
  minScale: m = 0.1,
2577
2606
  maxScale: v = 4,
2578
2607
  pannable: b = !0,
2579
- zoomable: f = !0,
2580
- "aria-label": h = "Graph canvas",
2608
+ zoomable: h = !0,
2609
+ "aria-label": g = "Graph canvas",
2581
2610
  className: y
2582
- }, k) => {
2583
- const w = _(null), [N, L] = A(n), [T, M] = A(!1), [I, S] = A(!1), g = r ?? N, D = _(g);
2584
- D.current = g;
2585
- const C = Y(
2586
- (E) => {
2587
- r || L(E), s == null || s(E);
2611
+ }, w) => {
2612
+ const L = _(null), [k, S] = $(n), [D, C] = $(!1), [N, I] = $(!1), f = r ?? k, E = _(f);
2613
+ E.current = f;
2614
+ const P = Y(
2615
+ (T) => {
2616
+ r || S(T), s == null || s(T);
2588
2617
  },
2589
2618
  [r, s]
2590
- ), $ = Y((E) => {
2619
+ ), A = Y((T) => {
2591
2620
  var R;
2592
- const z = (R = w.current) == null ? void 0 : R.getBoundingClientRect();
2593
- return z ? { x: E.x - z.left, y: E.y - z.top } : E;
2621
+ const z = (R = L.current) == null ? void 0 : R.getBoundingClientRect();
2622
+ return z ? { x: T.x - z.left, y: T.y - z.top } : T;
2594
2623
  }, []);
2595
2624
  F(() => {
2596
- const E = w.current;
2597
- if (!E || !i) return;
2625
+ const T = L.current;
2626
+ if (!T || !i) return;
2598
2627
  const z = () => {
2599
- const U = E.getBoundingClientRect();
2628
+ const U = T.getBoundingClientRect();
2600
2629
  i({ width: U.width, height: U.height });
2601
2630
  };
2602
2631
  z();
2603
2632
  const R = new ResizeObserver(z);
2604
- return R.observe(E), () => R.disconnect();
2633
+ return R.observe(T), () => R.disconnect();
2605
2634
  }, [i]), F(() => {
2606
- const E = w.current;
2607
- if (!E || !f) return;
2635
+ const T = L.current;
2636
+ if (!T || !h) return;
2608
2637
  const z = (R) => {
2609
2638
  R.preventDefault();
2610
- const U = D.current, W = $({ x: R.clientX, y: R.clientY }), ue = R.ctrlKey ? 0.01 : 2e-3, me = Ne(
2639
+ const U = E.current, W = A({ x: R.clientX, y: R.clientY }), ue = R.ctrlKey ? 0.01 : 2e-3, me = Ne(
2611
2640
  U.scale * Math.exp(-R.deltaY * ue),
2612
2641
  m,
2613
2642
  v
2614
2643
  );
2615
- C(_e(U, W, me));
2644
+ P(_e(U, W, me));
2616
2645
  };
2617
- return E.addEventListener("wheel", z, { passive: !1 }), () => E.removeEventListener("wheel", z);
2618
- }, [f, m, v, C, $]), F(() => {
2646
+ return T.addEventListener("wheel", z, { passive: !1 }), () => T.removeEventListener("wheel", z);
2647
+ }, [h, m, v, P, A]), F(() => {
2619
2648
  if (!b) return;
2620
- const E = (R) => {
2649
+ const T = (R) => {
2621
2650
  var W;
2622
2651
  if (R.code !== "Space") return;
2623
2652
  const U = R.target;
2624
- U != null && U.closest('input, textarea, [contenteditable="true"]') || (W = w.current) != null && W.contains(document.activeElement) && (R.preventDefault(), S(!0));
2653
+ U != null && U.closest('input, textarea, [contenteditable="true"]') || (W = L.current) != null && W.contains(document.activeElement) && (R.preventDefault(), I(!0));
2625
2654
  }, z = (R) => {
2626
- R.code === "Space" && S(!1);
2655
+ R.code === "Space" && I(!1);
2627
2656
  };
2628
- return window.addEventListener("keydown", E), window.addEventListener("keyup", z), () => {
2629
- window.removeEventListener("keydown", E), window.removeEventListener("keyup", z);
2657
+ return window.addEventListener("keydown", T), window.addEventListener("keyup", z), () => {
2658
+ window.removeEventListener("keydown", T), window.removeEventListener("keyup", z);
2630
2659
  };
2631
2660
  }, [b]);
2632
- const K = (E) => {
2661
+ const K = (T) => {
2633
2662
  if (!b) return;
2634
- const z = E.target === E.currentTarget, R = E.button === 1;
2635
- if (!z && !R && !I || E.button !== 0 && !R) return;
2636
- E.preventDefault(), M(!0);
2637
- const U = { x: E.clientX, y: E.clientY }, W = { ...D.current }, ue = (Pe) => {
2638
- C({
2663
+ const z = T.target === T.currentTarget, R = T.button === 1;
2664
+ if (!z && !R && !N || T.button !== 0 && !R) return;
2665
+ T.preventDefault(), C(!0);
2666
+ const U = { x: T.clientX, y: T.clientY }, W = { ...E.current }, ue = (Se) => {
2667
+ P({
2639
2668
  ...W,
2640
- x: W.x + (Pe.clientX - U.x),
2641
- y: W.y + (Pe.clientY - U.y)
2669
+ x: W.x + (Se.clientX - U.x),
2670
+ y: W.y + (Se.clientY - U.y)
2642
2671
  });
2643
2672
  }, me = () => {
2644
- M(!1), window.removeEventListener("pointermove", ue), window.removeEventListener("pointerup", me);
2673
+ C(!1), window.removeEventListener("pointermove", ue), window.removeEventListener("pointerup", me);
2645
2674
  };
2646
2675
  window.addEventListener("pointermove", ue), window.addEventListener("pointerup", me);
2647
2676
  };
2648
- wt(
2649
- k,
2677
+ Nt(
2678
+ w,
2650
2679
  () => ({
2651
- getViewport: () => D.current,
2652
- setViewport: C,
2653
- fitTo: (E, z) => {
2680
+ getViewport: () => E.current,
2681
+ setViewport: P,
2682
+ fitTo: (T, z) => {
2654
2683
  var U;
2655
- const R = (U = w.current) == null ? void 0 : U.getBoundingClientRect();
2656
- R && C(Cr(E, { width: R.width, height: R.height }, z));
2684
+ const R = (U = L.current) == null ? void 0 : U.getBoundingClientRect();
2685
+ R && P(Rr(T, { width: R.width, height: R.height }, z));
2657
2686
  },
2658
- zoomBy: (E) => {
2687
+ zoomBy: (T) => {
2659
2688
  var W;
2660
- const z = (W = w.current) == null ? void 0 : W.getBoundingClientRect();
2689
+ const z = (W = L.current) == null ? void 0 : W.getBoundingClientRect();
2661
2690
  if (!z) return;
2662
2691
  const R = { x: z.width / 2, y: z.height / 2 }, U = Ne(
2663
- D.current.scale * E,
2692
+ E.current.scale * T,
2664
2693
  m,
2665
2694
  v
2666
2695
  );
2667
- C(_e(D.current, R, U));
2696
+ P(_e(E.current, R, U));
2668
2697
  },
2669
- clientToGraph: (E) => we($(E), D.current),
2698
+ clientToGraph: (T) => we(A(T), E.current),
2670
2699
  getSize: () => {
2671
2700
  var z;
2672
- const E = (z = w.current) == null ? void 0 : z.getBoundingClientRect();
2673
- return { width: (E == null ? void 0 : E.width) ?? 0, height: (E == null ? void 0 : E.height) ?? 0 };
2701
+ const T = (z = L.current) == null ? void 0 : z.getBoundingClientRect();
2702
+ return { width: (T == null ? void 0 : T.width) ?? 0, height: (T == null ? void 0 : T.height) ?? 0 };
2674
2703
  },
2675
2704
  focus: () => {
2676
- var E;
2677
- return (E = w.current) == null ? void 0 : E.focus();
2705
+ var T;
2706
+ return (T = L.current) == null ? void 0 : T.focus();
2678
2707
  }
2679
2708
  }),
2680
- [C, m, v, $]
2709
+ [P, m, v, A]
2681
2710
  );
2682
- const O = (E) => we($({ x: E.clientX, y: E.clientY }), g), H = (E) => E.target === E.currentTarget;
2711
+ const O = (T) => we(A({ x: T.clientX, y: T.clientY }), f), H = (T) => T.target === T.currentTarget;
2683
2712
  return /* @__PURE__ */ x(
2684
2713
  "div",
2685
2714
  {
2686
- ref: w,
2715
+ ref: L,
2687
2716
  role: "application",
2688
- "aria-label": h,
2717
+ "aria-label": g,
2689
2718
  tabIndex: 0,
2690
2719
  onPointerDown: K,
2691
- onClick: (E) => H(E) && (a == null ? void 0 : a(O(E), E)),
2692
- onDoubleClick: (E) => H(E) && (d == null ? void 0 : d(O(E), E)),
2693
- onContextMenu: (E) => {
2694
- !c || !H(E) || (E.preventDefault(), c(O(E), E));
2720
+ onClick: (T) => H(T) && (a == null ? void 0 : a(O(T), T)),
2721
+ onDoubleClick: (T) => H(T) && (d == null ? void 0 : d(O(T), T)),
2722
+ onContextMenu: (T) => {
2723
+ !c || !H(T) || (T.preventDefault(), c(O(T), T));
2695
2724
  },
2696
- onDragOver: (E) => {
2697
- l && (E.preventDefault(), E.dataTransfer.dropEffect = "copy");
2725
+ onDragOver: (T) => {
2726
+ l && (T.preventDefault(), T.dataTransfer.dropEffect = "copy");
2698
2727
  },
2699
- onDrop: (E) => {
2700
- l && (E.preventDefault(), l(O(E), E));
2728
+ onDrop: (T) => {
2729
+ l && (T.preventDefault(), l(O(T), T));
2701
2730
  },
2702
2731
  style: p ? {
2703
2732
  // The grid is painted on the element rather than inside the
2704
2733
  // transformed layer, so it can be infinite without needing a
2705
2734
  // giant element behind it.
2706
2735
  backgroundImage: "radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)",
2707
- backgroundSize: `${u * g.scale}px ${u * g.scale}px`,
2708
- backgroundPosition: `${g.x}px ${g.y}px`
2736
+ backgroundSize: `${u * f.scale}px ${u * f.scale}px`,
2737
+ backgroundPosition: `${f.x}px ${f.y}px`
2709
2738
  } : void 0,
2710
- className: P(
2739
+ className: M(
2711
2740
  "relative w-full h-full overflow-hidden bg-background outline-none",
2712
2741
  "focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
2713
- I || T ? "cursor-grabbing" : "cursor-grab",
2742
+ N || D ? "cursor-grabbing" : "cursor-grab",
2714
2743
  y
2715
2744
  ),
2716
2745
  children: [
@@ -2718,7 +2747,7 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2718
2747
  "div",
2719
2748
  {
2720
2749
  style: {
2721
- transform: `translate(${g.x}px, ${g.y}px) scale(${g.scale})`,
2750
+ transform: `translate(${f.x}px, ${f.y}px) scale(${f.scale})`,
2722
2751
  transformOrigin: "0 0",
2723
2752
  willChange: "transform"
2724
2753
  },
@@ -2732,13 +2761,13 @@ const cr = /* @__PURE__ */ x("div", { className: "h-full flex flex-col items-cen
2732
2761
  );
2733
2762
  }
2734
2763
  );
2735
- Rr.displayName = "GraphCanvas";
2736
- const Fr = ["top", "right", "bottom", "left"], zr = {
2764
+ Or.displayName = "GraphCanvas";
2765
+ const _r = ["top", "right", "bottom", "left"], Kr = {
2737
2766
  top: "left-1/2 -translate-x-1/2 -top-1.5",
2738
2767
  bottom: "left-1/2 -translate-x-1/2 -bottom-1.5",
2739
2768
  left: "top-1/2 -translate-y-1/2 -left-1.5",
2740
2769
  right: "top-1/2 -translate-y-1/2 -right-1.5"
2741
- }, _n = ({
2770
+ }, Bn = ({
2742
2771
  node: e,
2743
2772
  children: t,
2744
2773
  onMove: r,
@@ -2754,19 +2783,19 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2754
2783
  draggable: m = !0,
2755
2784
  className: v
2756
2785
  }) => {
2757
- var k, w;
2758
- const b = _(!1), f = ((k = e.size) == null ? void 0 : k.width) ?? he.width, h = ((w = e.size) == null ? void 0 : w.height) ?? he.height, y = (N) => {
2759
- if (!m || !r || N.button !== 0 || N.nativeEvent.shiftKey) return;
2760
- N.stopPropagation(), b.current = !1;
2761
- const L = { x: N.clientX, y: N.clientY }, T = { ...e.position }, M = Or(N.currentTarget);
2762
- let I = T;
2763
- const S = (D) => {
2764
- const C = (D.clientX - L.x) / M, $ = (D.clientY - L.y) / M;
2765
- (Math.abs(C) > 1 || Math.abs($) > 1) && (b.current = !0), I = { x: T.x + C, y: T.y + $ }, r(e.id, I);
2766
- }, g = () => {
2767
- b.current && (n == null || n(e.id, I)), window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", g);
2786
+ var w, L;
2787
+ const b = _(!1), h = ((w = e.size) == null ? void 0 : w.width) ?? he.width, g = ((L = e.size) == null ? void 0 : L.height) ?? he.height, y = (k) => {
2788
+ if (!m || !r || k.button !== 0 || k.nativeEvent.shiftKey) return;
2789
+ k.stopPropagation(), b.current = !1;
2790
+ const S = { x: k.clientX, y: k.clientY }, D = { ...e.position }, C = Ur(k.currentTarget);
2791
+ let N = D;
2792
+ const I = (E) => {
2793
+ const P = (E.clientX - S.x) / C, A = (E.clientY - S.y) / C;
2794
+ (Math.abs(P) > 1 || Math.abs(A) > 1) && (b.current = !0), N = { x: D.x + P, y: D.y + A }, r(e.id, N);
2795
+ }, f = () => {
2796
+ b.current && (n == null || n(e.id, N)), window.removeEventListener("pointermove", I), window.removeEventListener("pointerup", f);
2768
2797
  };
2769
- window.addEventListener("pointermove", S), window.addEventListener("pointerup", g);
2798
+ window.addEventListener("pointermove", I), window.addEventListener("pointerup", f);
2770
2799
  };
2771
2800
  return /* @__PURE__ */ x(
2772
2801
  "div",
@@ -2779,21 +2808,21 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2779
2808
  position: "absolute",
2780
2809
  left: e.position.x,
2781
2810
  top: e.position.y,
2782
- width: f,
2783
- height: h
2811
+ width: h,
2812
+ height: g
2784
2813
  },
2785
2814
  onPointerDown: y,
2786
- onClick: (N) => {
2787
- N.stopPropagation(), b.current || s == null || s(e.id, N);
2815
+ onClick: (k) => {
2816
+ k.stopPropagation(), b.current || s == null || s(e.id, k);
2788
2817
  },
2789
- onDoubleClick: (N) => {
2790
- N.stopPropagation(), i == null || i(e.id);
2818
+ onDoubleClick: (k) => {
2819
+ k.stopPropagation(), i == null || i(e.id);
2791
2820
  },
2792
- onContextMenu: (N) => {
2793
- a && (N.preventDefault(), N.stopPropagation(), a(e.id, { x: N.clientX, y: N.clientY }, N));
2821
+ onContextMenu: (k) => {
2822
+ a && (k.preventDefault(), k.stopPropagation(), a(e.id, { x: k.clientX, y: k.clientY }, k));
2794
2823
  },
2795
2824
  onPointerUp: () => c == null ? void 0 : c(e.id),
2796
- className: P(
2825
+ className: M(
2797
2826
  "group rounded-lg border bg-card text-card-foreground shadow-sm select-none",
2798
2827
  "flex flex-col overflow-hidden transition-shadow",
2799
2828
  m && r && "cursor-grab active:cursor-grabbing",
@@ -2805,28 +2834,28 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2805
2834
  ),
2806
2835
  children: [
2807
2836
  t,
2808
- u && d && Fr.map((N) => /* @__PURE__ */ o(
2837
+ u && d && _r.map((k) => /* @__PURE__ */ o(
2809
2838
  "button",
2810
2839
  {
2811
2840
  type: "button",
2812
2841
  tabIndex: -1,
2813
- "aria-label": `Connect from ${N}`,
2814
- onPointerDown: (L) => {
2815
- L.stopPropagation(), d(e.id, N);
2842
+ "aria-label": `Connect from ${k}`,
2843
+ onPointerDown: (S) => {
2844
+ S.stopPropagation(), d(e.id, k);
2816
2845
  },
2817
- className: P(
2846
+ className: M(
2818
2847
  "absolute w-3 h-3 rounded-full border-2 border-background bg-primary",
2819
2848
  "opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity",
2820
2849
  p && "opacity-100",
2821
- zr[N]
2850
+ Kr[k]
2822
2851
  )
2823
2852
  },
2824
- N
2853
+ k
2825
2854
  ))
2826
2855
  ]
2827
2856
  }
2828
2857
  );
2829
- }, Or = (e) => {
2858
+ }, Ur = (e) => {
2830
2859
  let t = e.parentElement;
2831
2860
  for (; t; ) {
2832
2861
  const r = window.getComputedStyle(t).transform;
@@ -2837,7 +2866,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2837
2866
  t = t.parentElement;
2838
2867
  }
2839
2868
  return 1;
2840
- }, _r = (e, t, r, n) => {
2869
+ }, Br = (e, t, r, n) => {
2841
2870
  if (n === "straight")
2842
2871
  return `M ${e.x} ${e.y} L ${t.x} ${t.y}`;
2843
2872
  const s = r === "left" || r === "right";
@@ -2847,7 +2876,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2847
2876
  }
2848
2877
  const i = Math.hypot(t.x - e.x, t.y - e.y), a = Math.min(Math.max(i / 2, 24), 160), d = s ? { x: e.x + (r === "right" ? a : -a), y: e.y } : { x: e.x, y: e.y + (r === "bottom" ? a : -a) }, c = s ? { x: t.x - (r === "right" ? a : -a), y: t.y } : { x: t.x, y: t.y - (r === "bottom" ? a : -a) };
2849
2878
  return `M ${e.x} ${e.y} C ${d.x} ${d.y}, ${c.x} ${c.y}, ${t.x} ${t.y}`;
2850
- }, Kn = ({
2879
+ }, Hn = ({
2851
2880
  edge: e,
2852
2881
  source: t,
2853
2882
  target: r,
@@ -2858,12 +2887,12 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2858
2887
  onContextMenu: d,
2859
2888
  className: c
2860
2889
  }) => {
2861
- const l = j(t), p = j(r), u = Pr(l, p), m = Ke(l, u.source), v = Ke(p, u.target), b = _r(m, v, u.source, n), f = { x: (m.x + v.x) / 2, y: (m.y + v.y) / 2 }, h = !!(a || d);
2890
+ const l = j(t), p = j(r), u = Cr(l, p), m = Ke(l, u.source), v = Ke(p, u.target), b = Br(m, v, u.source, n), h = { x: (m.x + v.x) / 2, y: (m.y + v.y) / 2 }, g = !!(a || d);
2862
2891
  return /* @__PURE__ */ x(
2863
2892
  "g",
2864
2893
  {
2865
2894
  "data-graph-edge": e.id,
2866
- className: P(h && "cursor-pointer"),
2895
+ className: M(g && "cursor-pointer"),
2867
2896
  onClick: (y) => {
2868
2897
  a && (y.stopPropagation(), a(e.id, y));
2869
2898
  },
@@ -2871,7 +2900,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2871
2900
  d && (y.preventDefault(), y.stopPropagation(), d(e.id, { x: y.clientX, y: y.clientY }, y));
2872
2901
  },
2873
2902
  children: [
2874
- h && /* @__PURE__ */ o("path", { d: b, fill: "none", stroke: "transparent", strokeWidth: 16 }),
2903
+ g && /* @__PURE__ */ o("path", { d: b, fill: "none", stroke: "transparent", strokeWidth: 16 }),
2875
2904
  /* @__PURE__ */ o(
2876
2905
  "path",
2877
2906
  {
@@ -2879,7 +2908,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2879
2908
  fill: "none",
2880
2909
  strokeWidth: s ? 2.5 : 1.5,
2881
2910
  markerEnd: i ? "url(#nexus-graph-arrow)" : void 0,
2882
- className: P(
2911
+ className: M(
2883
2912
  "transition-[stroke]",
2884
2913
  s ? "stroke-primary" : "stroke-border",
2885
2914
  c
@@ -2889,8 +2918,8 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2889
2918
  e.label && /* @__PURE__ */ o(
2890
2919
  "text",
2891
2920
  {
2892
- x: f.x,
2893
- y: f.y,
2921
+ x: h.x,
2922
+ y: h.y,
2894
2923
  textAnchor: "middle",
2895
2924
  dominantBaseline: "middle",
2896
2925
  className: "fill-muted-foreground text-[10px] font-medium select-none",
@@ -2901,14 +2930,14 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2901
2930
  ]
2902
2931
  }
2903
2932
  );
2904
- }, Un = ({ children: e, className: t }) => /* @__PURE__ */ x(
2933
+ }, jn = ({ children: e, className: t }) => /* @__PURE__ */ x(
2905
2934
  "svg",
2906
2935
  {
2907
2936
  style: { position: "absolute", left: -5e4, top: -5e4, overflow: "visible" },
2908
2937
  width: 1e5,
2909
2938
  height: 1e5,
2910
2939
  viewBox: "-50000 -50000 100000 100000",
2911
- className: P("pointer-events-none [&_g]:pointer-events-auto", t),
2940
+ className: M("pointer-events-none [&_g]:pointer-events-auto", t),
2912
2941
  children: [
2913
2942
  /* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o(
2914
2943
  "marker",
@@ -2926,7 +2955,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2926
2955
  e
2927
2956
  ]
2928
2957
  }
2929
- ), Bn = {
2958
+ ), Wn = {
2930
2959
  /** Move focus to the nearest node in a direction. */
2931
2960
  moveFocus: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
2932
2961
  /** Create a connected node in a direction. */
@@ -2941,12 +2970,12 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2941
2970
  connect: "c",
2942
2971
  /** Nudge the focused node. Held with the arrow keys. */
2943
2972
  nudgeModifier: "shiftKey"
2944
- }, Kr = {
2973
+ }, Hr = {
2945
2974
  ArrowUp: "up",
2946
2975
  ArrowDown: "down",
2947
2976
  ArrowLeft: "left",
2948
2977
  ArrowRight: "right"
2949
- }, Hn = ({
2978
+ }, Gn = ({
2950
2979
  nodes: e,
2951
2980
  edges: t,
2952
2981
  focusedId: r,
@@ -2961,138 +2990,138 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
2961
2990
  onMoveNode: u,
2962
2991
  onEditNode: m
2963
2992
  }) => {
2964
- const [v, b] = A(
2993
+ const [v, b] = $(
2965
2994
  n
2966
- ), [f, h] = A(null), [y, k] = A(null), w = r !== void 0 ? r : v, N = Y(
2967
- (I) => {
2968
- r === void 0 && b(I), s == null || s(I);
2995
+ ), [h, g] = $(null), [y, w] = $(null), L = r !== void 0 ? r : v, k = Y(
2996
+ (N) => {
2997
+ r === void 0 && b(N), s == null || s(N);
2969
2998
  },
2970
2999
  [r, s]
2971
- ), L = _({
3000
+ ), S = _({
2972
3001
  nodes: e,
2973
3002
  edges: t,
2974
- focusedId: w,
2975
- editingId: f,
3003
+ focusedId: L,
3004
+ editingId: h,
2976
3005
  connectingFrom: y
2977
3006
  });
2978
- L.current = { nodes: e, edges: t, focusedId: w, editingId: f, connectingFrom: y };
2979
- const T = Y(
2980
- (I) => {
2981
- const { nodes: S, focusedId: g } = L.current;
2982
- if (S.length === 0) return;
2983
- if (!g) {
2984
- N(S[0].id);
3007
+ S.current = { nodes: e, edges: t, focusedId: L, editingId: h, connectingFrom: y };
3008
+ const D = Y(
3009
+ (N) => {
3010
+ const { nodes: I, focusedId: f } = S.current;
3011
+ if (I.length === 0) return;
3012
+ if (!f) {
3013
+ k(I[0].id);
2985
3014
  return;
2986
3015
  }
2987
- const D = ve(S, g, I);
2988
- D && N(D.id);
3016
+ const E = ve(I, f, N);
3017
+ E && k(E.id);
2989
3018
  },
2990
- [N]
2991
- ), M = Y(
2992
- (I = "right") => {
2993
- const { nodes: S, focusedId: g } = L.current;
3019
+ [k]
3020
+ ), C = Y(
3021
+ (N = "right") => {
3022
+ const { nodes: I, focusedId: f } = S.current;
2994
3023
  if (!c) return;
2995
- const D = g ? Ar(S, g, I) : { x: 0, y: 0 }, C = c(D, { from: g ?? void 0, direction: I });
2996
- C && (g && (l == null || l(g, C)), N(C), h(C));
3024
+ const E = f ? Fr(I, f, N) : { x: 0, y: 0 }, P = c(E, { from: f ?? void 0, direction: N });
3025
+ P && (f && (l == null || l(f, P)), k(P), g(P));
2997
3026
  },
2998
- [c, l, N]
3027
+ [c, l, k]
2999
3028
  );
3000
3029
  return F(() => {
3001
3030
  if (d) return;
3002
- const I = i.current;
3003
- if (!I) return;
3004
- const S = (g) => {
3005
- const { focusedId: D, editingId: C, connectingFrom: $ } = L.current;
3006
- if (C) {
3007
- g.key === "Escape" && (g.preventDefault(), h(null));
3031
+ const N = i.current;
3032
+ if (!N) return;
3033
+ const I = (f) => {
3034
+ const { focusedId: E, editingId: P, connectingFrom: A } = S.current;
3035
+ if (P) {
3036
+ f.key === "Escape" && (f.preventDefault(), g(null));
3008
3037
  return;
3009
3038
  }
3010
- const K = g.target;
3039
+ const K = f.target;
3011
3040
  if (K != null && K.closest('input, textarea, select, [contenteditable="true"]')) return;
3012
- const O = Kr[g.key];
3041
+ const O = Hr[f.key];
3013
3042
  if (O) {
3014
- g.preventDefault();
3015
- const H = L.current.nodes.find((E) => E.id === D);
3016
- if (g.shiftKey && H && u) {
3017
- const E = {
3043
+ f.preventDefault();
3044
+ const H = S.current.nodes.find((T) => T.id === E);
3045
+ if (f.shiftKey && H && u) {
3046
+ const T = {
3018
3047
  up: { x: 0, y: -a },
3019
3048
  down: { x: 0, y: a },
3020
3049
  left: { x: -a, y: 0 },
3021
3050
  right: { x: a, y: 0 }
3022
3051
  }[O];
3023
3052
  u(H.id, {
3024
- x: H.position.x + E.x,
3025
- y: H.position.y + E.y
3053
+ x: H.position.x + T.x,
3054
+ y: H.position.y + T.y
3026
3055
  });
3027
3056
  return;
3028
3057
  }
3029
- T(O);
3058
+ D(O);
3030
3059
  return;
3031
3060
  }
3032
- switch (g.key) {
3061
+ switch (f.key) {
3033
3062
  case "Tab": {
3034
3063
  if (!c) return;
3035
- g.preventDefault(), M(g.shiftKey ? "left" : "right");
3064
+ f.preventDefault(), C(f.shiftKey ? "left" : "right");
3036
3065
  return;
3037
3066
  }
3038
3067
  case "Enter": {
3039
- if (!D) return;
3040
- if (g.preventDefault(), $ && $ !== D) {
3041
- l == null || l($, D), k(null);
3068
+ if (!E) return;
3069
+ if (f.preventDefault(), A && A !== E) {
3070
+ l == null || l(A, E), w(null);
3042
3071
  return;
3043
3072
  }
3044
- m == null || m(D), h(D);
3073
+ m == null || m(E), g(E);
3045
3074
  return;
3046
3075
  }
3047
3076
  case "Escape": {
3048
- g.preventDefault(), $ ? k(null) : N(null);
3077
+ f.preventDefault(), A ? w(null) : k(null);
3049
3078
  return;
3050
3079
  }
3051
3080
  case "Delete":
3052
3081
  case "Backspace": {
3053
- if (!D || !p) return;
3054
- g.preventDefault();
3055
- const H = L.current.nodes.filter((z) => z.id !== D), E = ve(L.current.nodes, D, "left") ?? ve(L.current.nodes, D, "right") ?? H[0] ?? null;
3056
- p(D), N((E == null ? void 0 : E.id) ?? null);
3082
+ if (!E || !p) return;
3083
+ f.preventDefault();
3084
+ const H = S.current.nodes.filter((z) => z.id !== E), T = ve(S.current.nodes, E, "left") ?? ve(S.current.nodes, E, "right") ?? H[0] ?? null;
3085
+ p(E), k((T == null ? void 0 : T.id) ?? null);
3057
3086
  return;
3058
3087
  }
3059
3088
  case "c":
3060
3089
  case "C": {
3061
- if (!D || !l || g.metaKey || g.ctrlKey) return;
3062
- g.preventDefault(), k($ === D ? null : D);
3090
+ if (!E || !l || f.metaKey || f.ctrlKey) return;
3091
+ f.preventDefault(), w(A === E ? null : E);
3063
3092
  return;
3064
3093
  }
3065
3094
  }
3066
3095
  };
3067
- return I.addEventListener("keydown", S), () => I.removeEventListener("keydown", S);
3096
+ return N.addEventListener("keydown", I), () => N.removeEventListener("keydown", I);
3068
3097
  }, [
3069
3098
  d,
3070
3099
  i,
3071
- T,
3072
- M,
3100
+ D,
3101
+ C,
3073
3102
  a,
3074
3103
  l,
3075
3104
  c,
3076
3105
  p,
3077
3106
  m,
3078
3107
  u,
3079
- N
3108
+ k
3080
3109
  ]), F(() => {
3081
- w && !e.some((I) => I.id === w) && N(null), f && !e.some((I) => I.id === f) && h(null), y && !e.some((I) => I.id === y) && k(null);
3082
- }, [e, w, f, y, N]), B(
3110
+ L && !e.some((N) => N.id === L) && k(null), h && !e.some((N) => N.id === h) && g(null), y && !e.some((N) => N.id === y) && w(null);
3111
+ }, [e, L, h, y, k]), B(
3083
3112
  () => ({
3084
- focusedId: w,
3085
- setFocusedId: N,
3086
- editingId: f,
3087
- setEditingId: h,
3113
+ focusedId: L,
3114
+ setFocusedId: k,
3115
+ editingId: h,
3116
+ setEditingId: g,
3088
3117
  connectingFrom: y,
3089
- setConnectingFrom: k,
3090
- moveFocus: T,
3091
- createConnected: M
3118
+ setConnectingFrom: w,
3119
+ moveFocus: D,
3120
+ createConnected: C
3092
3121
  }),
3093
- [w, N, f, y, T, M]
3122
+ [L, k, h, y, D, C]
3094
3123
  );
3095
- }, jn = ({
3124
+ }, Yn = ({
3096
3125
  nodes: e,
3097
3126
  viewport: t,
3098
3127
  canvasSize: r,
@@ -3106,103 +3135,103 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3106
3135
  "aria-label": p = "Graph minimap",
3107
3136
  className: u
3108
3137
  }) => {
3109
- const m = _(null), v = B(() => new Set(d ?? []), [d]), b = Sr(t, r), f = B(() => {
3110
- const S = ut(e);
3111
- return S ? Mr(S, b) : b;
3112
- }, [e, b.x, b.y, b.width, b.height]), h = Math.min(
3113
- (s - c * 2) / Math.max(f.width, 1),
3114
- (i - c * 2) / Math.max(f.height, 1)
3138
+ const m = _(null), v = B(() => new Set(d ?? []), [d]), b = Ar(t, r), h = B(() => {
3139
+ const I = ut(e);
3140
+ return I ? $r(I, b) : b;
3141
+ }, [e, b.x, b.y, b.width, b.height]), g = Math.min(
3142
+ (s - c * 2) / Math.max(h.width, 1),
3143
+ (i - c * 2) / Math.max(h.height, 1)
3115
3144
  ), y = {
3116
- x: (s - f.width * h) / 2 - f.x * h,
3117
- y: (i - f.height * h) / 2 - f.y * h
3118
- }, k = (S) => ({
3119
- x: S.x * h + y.x,
3120
- y: S.y * h + y.y
3121
- }), w = (S) => ({
3122
- x: (S.x - y.x) / h,
3123
- y: (S.y - y.y) / h
3124
- }), N = Y(
3125
- (S) => {
3126
- var C;
3145
+ x: (s - h.width * g) / 2 - h.x * g,
3146
+ y: (i - h.height * g) / 2 - h.y * g
3147
+ }, w = (I) => ({
3148
+ x: I.x * g + y.x,
3149
+ y: I.y * g + y.y
3150
+ }), L = (I) => ({
3151
+ x: (I.x - y.x) / g,
3152
+ y: (I.y - y.y) / g
3153
+ }), k = Y(
3154
+ (I) => {
3155
+ var P;
3127
3156
  if (!n) return;
3128
- const g = (C = m.current) == null ? void 0 : C.getBoundingClientRect();
3129
- if (!g) return;
3130
- const D = w({ x: S.x - g.left, y: S.y - g.top });
3131
- n(Ue(D, r, t.scale));
3157
+ const f = (P = m.current) == null ? void 0 : P.getBoundingClientRect();
3158
+ if (!f) return;
3159
+ const E = L({ x: I.x - f.left, y: I.y - f.top });
3160
+ n(Ue(E, r, t.scale));
3132
3161
  },
3133
- [n, r, t.scale, h, y.x, y.y]
3134
- ), L = (S) => {
3135
- var C;
3136
- if (!n || S.button !== 0) return;
3137
- S.preventDefault(), (C = m.current) == null || C.focus(), N({ x: S.clientX, y: S.clientY });
3138
- const g = ($) => N({ x: $.clientX, y: $.clientY }), D = () => {
3139
- window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", D);
3162
+ [n, r, t.scale, g, y.x, y.y]
3163
+ ), S = (I) => {
3164
+ var P;
3165
+ if (!n || I.button !== 0) return;
3166
+ I.preventDefault(), (P = m.current) == null || P.focus(), k({ x: I.clientX, y: I.clientY });
3167
+ const f = (A) => k({ x: A.clientX, y: A.clientY }), E = () => {
3168
+ window.removeEventListener("pointermove", f), window.removeEventListener("pointerup", E);
3140
3169
  };
3141
- window.addEventListener("pointermove", g), window.addEventListener("pointerup", D);
3142
- }, T = (S) => {
3170
+ window.addEventListener("pointermove", f), window.addEventListener("pointerup", E);
3171
+ }, D = (I) => {
3143
3172
  if (!n) return;
3144
- const g = {
3173
+ const f = {
3145
3174
  ArrowUp: { x: 0, y: -l },
3146
3175
  ArrowDown: { x: 0, y: l },
3147
3176
  ArrowLeft: { x: -l, y: 0 },
3148
3177
  ArrowRight: { x: l, y: 0 }
3149
- }[S.key];
3150
- if (!g) return;
3151
- S.preventDefault();
3152
- const D = J(b);
3178
+ }[I.key];
3179
+ if (!f) return;
3180
+ I.preventDefault();
3181
+ const E = J(b);
3153
3182
  n(
3154
- Ue({ x: D.x + g.x, y: D.y + g.y }, r, t.scale)
3183
+ Ue({ x: E.x + f.x, y: E.y + f.y }, r, t.scale)
3155
3184
  );
3156
- }, M = {
3157
- x: k(b).x,
3158
- y: k(b).y,
3159
- width: b.width * h,
3160
- height: b.height * h
3161
- }, I = !!n;
3185
+ }, C = {
3186
+ x: w(b).x,
3187
+ y: w(b).y,
3188
+ width: b.width * g,
3189
+ height: b.height * g
3190
+ }, N = !!n;
3162
3191
  return /* @__PURE__ */ o(
3163
3192
  "div",
3164
3193
  {
3165
3194
  ref: m,
3166
- role: I ? "slider" : "img",
3195
+ role: N ? "slider" : "img",
3167
3196
  "aria-label": p,
3168
3197
  "aria-valuetext": e.length === 0 ? "Empty graph" : `${e.length} nodes, viewing around ${Math.round(J(b).x)}, ${Math.round(J(b).y)}`,
3169
- tabIndex: I ? 0 : void 0,
3170
- onPointerDown: L,
3171
- onKeyDown: T,
3198
+ tabIndex: N ? 0 : void 0,
3199
+ onPointerDown: S,
3200
+ onKeyDown: D,
3172
3201
  style: { width: s, height: i },
3173
- className: P(
3202
+ className: M(
3174
3203
  "rounded-lg border border-border bg-card/90 backdrop-blur-sm shadow-sm overflow-hidden",
3175
3204
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3176
- I && "cursor-pointer",
3205
+ N && "cursor-pointer",
3177
3206
  u
3178
3207
  ),
3179
3208
  children: /* @__PURE__ */ x("svg", { width: s, height: i, className: "block", children: [
3180
- e.map((S) => {
3181
- const g = j(S), D = k(g), C = v.has(S.id);
3209
+ e.map((I) => {
3210
+ const f = j(I), E = w(f), P = v.has(I.id);
3182
3211
  return /* @__PURE__ */ o(
3183
3212
  "rect",
3184
3213
  {
3185
- x: D.x,
3186
- y: D.y,
3187
- width: Math.max(g.width * h, 2),
3188
- height: Math.max(g.height * h, 2),
3214
+ x: E.x,
3215
+ y: E.y,
3216
+ width: Math.max(f.width * g, 2),
3217
+ height: Math.max(f.height * g, 2),
3189
3218
  rx: 1,
3190
- fill: C || a == null ? void 0 : a(S),
3191
- className: P(
3192
- !a && !C && "fill-muted-foreground/50",
3193
- C && "fill-primary"
3219
+ fill: P || a == null ? void 0 : a(I),
3220
+ className: M(
3221
+ !a && !P && "fill-muted-foreground/50",
3222
+ P && "fill-primary"
3194
3223
  )
3195
3224
  },
3196
- S.id
3225
+ I.id
3197
3226
  );
3198
3227
  }),
3199
3228
  r.width > 0 && /* @__PURE__ */ o(
3200
3229
  "rect",
3201
3230
  {
3202
- x: M.x,
3203
- y: M.y,
3204
- width: Math.max(M.width, 4),
3205
- height: Math.max(M.height, 4),
3231
+ x: C.x,
3232
+ y: C.y,
3233
+ width: Math.max(C.width, 4),
3234
+ height: Math.max(C.height, 4),
3206
3235
  rx: 2,
3207
3236
  className: "fill-primary/10 stroke-primary",
3208
3237
  strokeWidth: 1.5
@@ -3211,7 +3240,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3211
3240
  ] })
3212
3241
  }
3213
3242
  );
3214
- }, Ur = (e, t) => {
3243
+ }, jr = (e, t) => {
3215
3244
  const r = new Set(e.map((l) => l.id)), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
3216
3245
  e.forEach((l) => {
3217
3246
  n.set(l.id, []), s.set(l.id, 0);
@@ -3244,49 +3273,49 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3244
3273
  align: s = "center"
3245
3274
  } = {}) => (i, a) => {
3246
3275
  if (i.length === 0) return i;
3247
- const d = Ur(i, a), c = e === "down" || e === "up", l = /* @__PURE__ */ new Map();
3248
- i.forEach((w) => {
3249
- const N = d.get(w.id) ?? 0, L = l.get(N) ?? [];
3250
- L.push(w), l.set(N, L);
3276
+ const d = jr(i, a), c = e === "down" || e === "up", l = /* @__PURE__ */ new Map();
3277
+ i.forEach((L) => {
3278
+ const k = d.get(L.id) ?? 0, S = l.get(k) ?? [];
3279
+ S.push(L), l.set(k, S);
3251
3280
  });
3252
- const p = [...l.keys()].sort((w, N) => w - N), u = /* @__PURE__ */ new Map();
3253
- p.forEach((w) => {
3254
- const N = l.get(w), L = Math.max(
3255
- ...N.map((T) => {
3256
- const M = j(T);
3257
- return c ? M.height : M.width;
3281
+ const p = [...l.keys()].sort((L, k) => L - k), u = /* @__PURE__ */ new Map();
3282
+ p.forEach((L) => {
3283
+ const k = l.get(L), S = Math.max(
3284
+ ...k.map((D) => {
3285
+ const C = j(D);
3286
+ return c ? C.height : C.width;
3258
3287
  })
3259
3288
  );
3260
- u.set(w, L);
3289
+ u.set(L, S);
3261
3290
  });
3262
3291
  const m = /* @__PURE__ */ new Map();
3263
3292
  let v = 0;
3264
- p.forEach((w) => {
3265
- m.set(w, v), v += (u.get(w) ?? 0) + r;
3293
+ p.forEach((L) => {
3294
+ m.set(L, v), v += (u.get(L) ?? 0) + r;
3266
3295
  });
3267
- const b = (w) => {
3268
- const N = l.get(w);
3269
- return N.map((T) => {
3270
- const M = j(T);
3271
- return c ? M.width : M.height;
3272
- }).reduce((T, M) => T + M, 0) + t * (N.length - 1);
3273
- }, f = Math.max(...p.map(b)), h = e === "up" || e === "left", y = v - r, k = /* @__PURE__ */ new Map();
3274
- return p.forEach((w) => {
3275
- const N = l.get(w), L = b(w);
3276
- let T = s === "center" ? (f - L) / 2 : 0;
3277
- const M = m.get(w) ?? 0, I = h ? y - M - (u.get(w) ?? 0) : M;
3278
- N.forEach((S) => {
3279
- const g = j(S), D = c ? g.width : g.height, C = c ? g.height : g.width, $ = I + ((u.get(w) ?? 0) - C) / 2;
3280
- k.set(
3281
- S.id,
3282
- c ? { x: n.x + T, y: n.y + $ } : { x: n.x + $, y: n.y + T }
3283
- ), T += D + t;
3296
+ const b = (L) => {
3297
+ const k = l.get(L);
3298
+ return k.map((D) => {
3299
+ const C = j(D);
3300
+ return c ? C.width : C.height;
3301
+ }).reduce((D, C) => D + C, 0) + t * (k.length - 1);
3302
+ }, h = Math.max(...p.map(b)), g = e === "up" || e === "left", y = v - r, w = /* @__PURE__ */ new Map();
3303
+ return p.forEach((L) => {
3304
+ const k = l.get(L), S = b(L);
3305
+ let D = s === "center" ? (h - S) / 2 : 0;
3306
+ const C = m.get(L) ?? 0, N = g ? y - C - (u.get(L) ?? 0) : C;
3307
+ k.forEach((I) => {
3308
+ const f = j(I), E = c ? f.width : f.height, P = c ? f.height : f.width, A = N + ((u.get(L) ?? 0) - P) / 2;
3309
+ w.set(
3310
+ I.id,
3311
+ c ? { x: n.x + D, y: n.y + A } : { x: n.x + A, y: n.y + D }
3312
+ ), D += E + t;
3284
3313
  });
3285
- }), i.map((w) => {
3286
- const N = k.get(w.id);
3287
- return N ? { ...w, position: N } : w;
3314
+ }), i.map((L) => {
3315
+ const k = w.get(L.id);
3316
+ return k ? { ...L, position: k } : L;
3288
3317
  });
3289
- }, Br = ({
3318
+ }, Wr = ({
3290
3319
  columns: e,
3291
3320
  spacingX: t = 48,
3292
3321
  spacingY: r = 48,
@@ -3313,44 +3342,44 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3313
3342
  y: n.y + p[Math.floor(m / i)]
3314
3343
  }
3315
3344
  }));
3316
- }, Hr = {
3345
+ }, Gr = {
3317
3346
  vertical: Be({ direction: "down" }),
3318
3347
  horizontal: Be({ direction: "right" }),
3319
- grid: Br()
3320
- }, fe = "freeform", Wn = ({
3348
+ grid: Wr()
3349
+ }, fe = "freeform", Jn = ({
3321
3350
  nodes: e,
3322
3351
  edges: t,
3323
- layouts: r = Hr,
3352
+ layouts: r = Gr,
3324
3353
  mode: n,
3325
3354
  defaultMode: s = fe,
3326
3355
  onModeChange: i,
3327
3356
  onNodeMove: a,
3328
3357
  escapeOnDrag: d = !0
3329
3358
  }) => {
3330
- const [c, l] = A(s), p = n ?? c, u = Y(
3331
- (k) => {
3332
- n === void 0 && l(k), i == null || i(k);
3359
+ const [c, l] = $(s), p = n ?? c, u = Y(
3360
+ (w) => {
3361
+ n === void 0 && l(w), i == null || i(w);
3333
3362
  },
3334
3363
  [n, i]
3335
3364
  ), m = p === fe ? void 0 : r[p], v = !!m, b = B(
3336
3365
  () => m ? m(e, t) : e,
3337
3366
  [m, e, t]
3338
- ), f = Y(
3339
- (k, w) => {
3340
- v && d && u(fe), a == null || a(k, w);
3367
+ ), h = Y(
3368
+ (w, L) => {
3369
+ v && d && u(fe), a == null || a(w, L);
3341
3370
  },
3342
3371
  [v, d, u, a]
3343
- ), h = Y(() => b, [b]), y = B(
3372
+ ), g = Y(() => b, [b]), y = B(
3344
3373
  // `freeform` is a mode, not a layout; registering one under that name would
3345
3374
  // shadow the escape hatch, so it never appears here.
3346
- () => Object.keys(r).filter((k) => k !== fe),
3375
+ () => Object.keys(r).filter((w) => w !== fe),
3347
3376
  [r]
3348
3377
  );
3349
3378
  return B(
3350
- () => ({ nodes: b, mode: p, setMode: u, available: y, isAuto: v, onMove: f, bake: h }),
3351
- [b, p, u, y, v, f, h]
3379
+ () => ({ nodes: b, mode: p, setMode: u, available: y, isAuto: v, onMove: h, bake: g }),
3380
+ [b, p, u, y, v, h, g]
3352
3381
  );
3353
- }, ft = "application/x-nexus-graph-node", Gn = ({
3382
+ }, ft = "application/x-nexus-graph-node", Xn = ({
3354
3383
  items: e,
3355
3384
  onSelect: t,
3356
3385
  onDragStart: r,
@@ -3360,30 +3389,30 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3360
3389
  className: a,
3361
3390
  "aria-label": d = "Node palette"
3362
3391
  }) => {
3363
- const c = _(null), [l, p] = A("horizontal"), u = n === "auto" ? l : n, m = _(s);
3392
+ const c = _(null), [l, p] = $("horizontal"), u = n === "auto" ? l : n, m = _(s);
3364
3393
  m.current = s;
3365
3394
  const v = Y(() => {
3366
- const f = c.current;
3367
- if (!f) return;
3368
- const h = [...f.querySelectorAll("[data-palette-item]")];
3369
- if (h.length === 0) return;
3370
- const y = window.getComputedStyle(f), k = parseFloat(y.gap) || 0, w = (parseFloat(y.paddingLeft) || 0) + (parseFloat(y.paddingRight) || 0), N = h.reduce((S, g) => S + g.offsetWidth, 0) + k * (h.length - 1) + w, L = h.reduce((S, g) => S + g.offsetHeight, 0) + k * (h.length - 1) + w, T = jr(f);
3371
- if (!T) return;
3372
- const M = 4, I = N <= T.width + M ? "horizontal" : L <= T.height + M ? "vertical" : "horizontal";
3373
- p((S) => {
3374
- var g;
3375
- return S === I ? S : ((g = m.current) == null || g.call(m, I), I);
3395
+ const h = c.current;
3396
+ if (!h) return;
3397
+ const g = [...h.querySelectorAll("[data-palette-item]")];
3398
+ if (g.length === 0) return;
3399
+ const y = window.getComputedStyle(h), w = parseFloat(y.gap) || 0, L = (parseFloat(y.paddingLeft) || 0) + (parseFloat(y.paddingRight) || 0), k = g.reduce((I, f) => I + f.offsetWidth, 0) + w * (g.length - 1) + L, S = g.reduce((I, f) => I + f.offsetHeight, 0) + w * (g.length - 1) + L, D = Yr(h);
3400
+ if (!D) return;
3401
+ const C = 4, N = k <= D.width + C ? "horizontal" : S <= D.height + C ? "vertical" : "horizontal";
3402
+ p((I) => {
3403
+ var f;
3404
+ return I === N ? I : ((f = m.current) == null || f.call(m, N), N);
3376
3405
  });
3377
3406
  }, []);
3378
3407
  F(() => {
3379
3408
  if (n !== "auto") return;
3380
- const f = c.current;
3381
- if (!f) return;
3409
+ const h = c.current;
3410
+ if (!h) return;
3382
3411
  v();
3383
- const h = new ResizeObserver(v);
3384
- h.observe(f);
3385
- const y = pt(f);
3386
- return y && y !== f && h.observe(y), () => h.disconnect();
3412
+ const g = new ResizeObserver(v);
3413
+ g.observe(h);
3414
+ const y = pt(h);
3415
+ return y && y !== h && g.observe(y), () => g.disconnect();
3387
3416
  }, [n, v, e.length]);
3388
3417
  const b = u === "vertical";
3389
3418
  return /* @__PURE__ */ o(
@@ -3394,24 +3423,24 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3394
3423
  "aria-label": d,
3395
3424
  "aria-orientation": u,
3396
3425
  "data-orientation": u,
3397
- className: P(
3426
+ className: M(
3398
3427
  "flex gap-1.5 p-1.5 rounded-lg border border-border bg-card/90 backdrop-blur-sm shadow-sm",
3399
3428
  b ? "flex-col items-stretch" : "flex-wrap items-center",
3400
3429
  a
3401
3430
  ),
3402
- children: e.map((f) => /* @__PURE__ */ x(
3431
+ children: e.map((h) => /* @__PURE__ */ x(
3403
3432
  "button",
3404
3433
  {
3405
3434
  type: "button",
3406
3435
  "data-palette-item": !0,
3407
3436
  draggable: !0,
3408
- title: f.description ?? (i ? f.label : void 0),
3409
- "aria-label": i ? f.label : void 0,
3410
- onDragStart: (h) => {
3411
- h.dataTransfer.setData(ft, f.kind), h.dataTransfer.setData("text/plain", f.label), h.dataTransfer.effectAllowed = "copy", r == null || r(f);
3437
+ title: h.description ?? (i ? h.label : void 0),
3438
+ "aria-label": i ? h.label : void 0,
3439
+ onDragStart: (g) => {
3440
+ g.dataTransfer.setData(ft, h.kind), g.dataTransfer.setData("text/plain", h.label), g.dataTransfer.effectAllowed = "copy", r == null || r(h);
3412
3441
  },
3413
- onClick: () => t == null ? void 0 : t(f),
3414
- className: P(
3442
+ onClick: () => t == null ? void 0 : t(h),
3443
+ className: M(
3415
3444
  "flex items-center gap-1.5 rounded-md text-xs font-medium",
3416
3445
  "border border-border bg-background text-foreground",
3417
3446
  "hover:bg-accent hover:text-accent-foreground transition-colors",
@@ -3422,11 +3451,11 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3422
3451
  b && !i && "justify-start"
3423
3452
  ),
3424
3453
  children: [
3425
- f.icon,
3426
- !i && f.label
3454
+ h.icon,
3455
+ !i && h.label
3427
3456
  ]
3428
3457
  },
3429
- f.kind
3458
+ h.kind
3430
3459
  ))
3431
3460
  }
3432
3461
  );
@@ -3438,7 +3467,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3438
3467
  t = t.parentElement;
3439
3468
  }
3440
3469
  return null;
3441
- }, jr = (e) => {
3470
+ }, Yr = (e) => {
3442
3471
  const t = pt(e);
3443
3472
  if (!t) return null;
3444
3473
  const r = window.getComputedStyle(t), n = t.getBoundingClientRect();
@@ -3446,7 +3475,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3446
3475
  width: n.width - (parseFloat(r.paddingLeft) || 0) - (parseFloat(r.paddingRight) || 0),
3447
3476
  height: n.height - (parseFloat(r.paddingTop) || 0) - (parseFloat(r.paddingBottom) || 0)
3448
3477
  };
3449
- }, Yn = (e) => e.dataTransfer.getData(ft) || null, q = ({
3478
+ }, qn = (e) => e.dataTransfer.getData(ft) || null, q = ({
3450
3479
  label: e,
3451
3480
  htmlFor: t,
3452
3481
  description: r,
@@ -3455,7 +3484,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3455
3484
  children: i,
3456
3485
  inline: a = !1,
3457
3486
  className: d
3458
- }) => /* @__PURE__ */ x("div", { className: P("flex flex-col gap-1.5", d), children: [
3487
+ }) => /* @__PURE__ */ x("div", { className: M("flex flex-col gap-1.5", d), children: [
3459
3488
  !a && /* @__PURE__ */ x("div", { className: "flex items-baseline justify-between gap-2", children: [
3460
3489
  /* @__PURE__ */ o(
3461
3490
  "label",
@@ -3474,7 +3503,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3474
3503
  ] }) : i,
3475
3504
  r && !n && /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground/80 leading-snug", children: r }),
3476
3505
  n && /* @__PURE__ */ o("p", { className: "text-[11px] text-destructive leading-snug", children: n })
3477
- ] }), ne = "w-full rounded-md border bg-background px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground/60 transition-colors focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/50 disabled:opacity-50 disabled:cursor-not-allowed", oe = (e) => e ? "border-destructive" : "border-border", Z = (e, t = "") => `property-${e.toLowerCase().replace(/[^a-z0-9]+/g, "-")}${t}`, se = "Mixed values", Wr = ({
3506
+ ] }), ne = "w-full rounded-md border bg-background px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground/60 transition-colors focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/50 disabled:opacity-50 disabled:cursor-not-allowed", oe = (e) => e ? "border-destructive" : "border-border", Z = (e, t = "") => `property-${e.toLowerCase().replace(/[^a-z0-9]+/g, "-")}${t}`, se = "Mixed values", Jr = ({
3478
3507
  label: e,
3479
3508
  value: t,
3480
3509
  onChange: r,
@@ -3505,12 +3534,12 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3505
3534
  placeholder: s ? se : d,
3506
3535
  disabled: i,
3507
3536
  onChange: (u) => r == null ? void 0 : r(u.target.value),
3508
- className: P(ne, oe(a))
3537
+ className: M(ne, oe(a))
3509
3538
  }
3510
3539
  )
3511
3540
  }
3512
3541
  );
3513
- }, Gr = ({
3542
+ }, Xr = ({
3514
3543
  label: e,
3515
3544
  value: t,
3516
3545
  onChange: r,
@@ -3541,12 +3570,12 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3541
3570
  placeholder: s ? se : d,
3542
3571
  disabled: i,
3543
3572
  onChange: (u) => r == null ? void 0 : r(u.target.value),
3544
- className: P(ne, oe(a), "resize-y leading-relaxed")
3573
+ className: M(ne, oe(a), "resize-y leading-relaxed")
3545
3574
  }
3546
3575
  )
3547
3576
  }
3548
3577
  );
3549
- }, Yr = ({
3578
+ }, qr = ({
3550
3579
  label: e,
3551
3580
  value: t,
3552
3581
  onChange: r,
@@ -3575,7 +3604,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3575
3604
  value: s ? "" : t ?? "",
3576
3605
  disabled: i,
3577
3606
  onChange: (u) => r == null ? void 0 : r(u.target.value),
3578
- className: P(ne, oe(a), "cursor-pointer"),
3607
+ className: M(ne, oe(a), "cursor-pointer"),
3579
3608
  children: [
3580
3609
  (s || c || t === void 0) && /* @__PURE__ */ o("option", { value: "", disabled: !c, children: s ? se : c ?? "—" }),
3581
3610
  d.map((u) => /* @__PURE__ */ o("option", { value: u.value, disabled: u.disabled, children: u.label }, u.value))
@@ -3584,7 +3613,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3584
3613
  )
3585
3614
  }
3586
3615
  );
3587
- }, Jr = ({
3616
+ }, Vr = ({
3588
3617
  label: e,
3589
3618
  value: t,
3590
3619
  onChange: r,
@@ -3621,7 +3650,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3621
3650
  )
3622
3651
  }
3623
3652
  );
3624
- }, Xr = ({
3653
+ }, Qr = ({
3625
3654
  label: e,
3626
3655
  value: t,
3627
3656
  onChange: r,
@@ -3660,17 +3689,17 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3660
3689
  disabled: i,
3661
3690
  onChange: (b) => {
3662
3691
  if (b.target.value === "") return;
3663
- const f = Number(b.target.value);
3664
- Number.isFinite(f) && (r == null || r(f));
3692
+ const h = Number(b.target.value);
3693
+ Number.isFinite(h) && (r == null || r(h));
3665
3694
  },
3666
- className: P(ne, oe(a), p && "pr-8")
3695
+ className: M(ne, oe(a), p && "pr-8")
3667
3696
  }
3668
3697
  ),
3669
3698
  p && /* @__PURE__ */ o("span", { className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: p })
3670
3699
  ] })
3671
3700
  }
3672
3701
  );
3673
- }, qr = ({
3702
+ }, Zr = ({
3674
3703
  label: e,
3675
3704
  value: t,
3676
3705
  onChange: r,
@@ -3712,13 +3741,13 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3712
3741
  placeholder: s ? se : "#000000",
3713
3742
  disabled: i,
3714
3743
  onChange: (p) => r == null ? void 0 : r(p.target.value),
3715
- className: P(ne, oe(a), "font-mono")
3744
+ className: M(ne, oe(a), "font-mono")
3716
3745
  }
3717
3746
  )
3718
3747
  ] })
3719
3748
  }
3720
3749
  );
3721
- }, Vr = ({
3750
+ }, en = ({
3722
3751
  label: e,
3723
3752
  value: t,
3724
3753
  onChange: r,
@@ -3751,12 +3780,12 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3751
3780
  max: l,
3752
3781
  disabled: i,
3753
3782
  onChange: (m) => r == null ? void 0 : r(m.target.value),
3754
- className: P(ne, oe(a))
3783
+ className: M(ne, oe(a))
3755
3784
  }
3756
3785
  )
3757
3786
  }
3758
3787
  );
3759
- }, Qr = ({
3788
+ }, tn = ({
3760
3789
  label: e,
3761
3790
  value: t,
3762
3791
  onChange: r,
@@ -3768,13 +3797,13 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3768
3797
  suggestions: c,
3769
3798
  className: l
3770
3799
  }) => {
3771
- const [p, u] = A(""), m = Z(e), v = s ? [] : t ?? [], b = () => {
3772
- const f = p.trim();
3773
- if (!f || v.includes(f)) {
3800
+ const [p, u] = $(""), m = Z(e), v = s ? [] : t ?? [], b = () => {
3801
+ const h = p.trim();
3802
+ if (!h || v.includes(h)) {
3774
3803
  u("");
3775
3804
  return;
3776
3805
  }
3777
- r == null || r([...v, f]), u("");
3806
+ r == null || r([...v, h]), u("");
3778
3807
  };
3779
3808
  return /* @__PURE__ */ x(
3780
3809
  q,
@@ -3786,25 +3815,25 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3786
3815
  mixed: s,
3787
3816
  className: l,
3788
3817
  children: [
3789
- v.length > 0 && /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1", children: v.map((f) => /* @__PURE__ */ x(
3818
+ v.length > 0 && /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1", children: v.map((h) => /* @__PURE__ */ x(
3790
3819
  "span",
3791
3820
  {
3792
3821
  className: "flex items-center gap-1 rounded-md border border-border bg-secondary px-1.5 py-0.5 text-[11px] text-secondary-foreground",
3793
3822
  children: [
3794
- f,
3823
+ h,
3795
3824
  !i && /* @__PURE__ */ o(
3796
3825
  "button",
3797
3826
  {
3798
3827
  type: "button",
3799
- "aria-label": `Remove ${f}`,
3800
- onClick: () => r == null ? void 0 : r(v.filter((h) => h !== f)),
3828
+ "aria-label": `Remove ${h}`,
3829
+ onClick: () => r == null ? void 0 : r(v.filter((g) => g !== h)),
3801
3830
  className: "text-muted-foreground hover:text-destructive",
3802
3831
  children: /* @__PURE__ */ o(X, { size: 10 })
3803
3832
  }
3804
3833
  )
3805
3834
  ]
3806
3835
  },
3807
- f
3836
+ h
3808
3837
  )) }),
3809
3838
  /* @__PURE__ */ x("div", { className: "flex gap-1.5", children: [
3810
3839
  /* @__PURE__ */ o(
@@ -3816,11 +3845,11 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3816
3845
  value: p,
3817
3846
  placeholder: s ? se : d,
3818
3847
  disabled: i,
3819
- onChange: (f) => u(f.target.value),
3820
- onKeyDown: (f) => {
3821
- f.key === "Enter" && (f.preventDefault(), b());
3848
+ onChange: (h) => u(h.target.value),
3849
+ onKeyDown: (h) => {
3850
+ h.key === "Enter" && (h.preventDefault(), b());
3822
3851
  },
3823
- className: P(ne, oe(a))
3852
+ className: M(ne, oe(a))
3824
3853
  }
3825
3854
  ),
3826
3855
  /* @__PURE__ */ o(
@@ -3831,15 +3860,15 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3831
3860
  disabled: i || !p.trim(),
3832
3861
  onClick: b,
3833
3862
  className: "shrink-0 rounded-md border border-border px-2 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",
3834
- children: /* @__PURE__ */ o(_t, { size: 13 })
3863
+ children: /* @__PURE__ */ o(Kt, { size: 13 })
3835
3864
  }
3836
3865
  )
3837
3866
  ] }),
3838
- c && /* @__PURE__ */ o("datalist", { id: `${m}-suggestions`, children: c.map((f) => /* @__PURE__ */ o("option", { value: f }, f)) })
3867
+ c && /* @__PURE__ */ o("datalist", { id: `${m}-suggestions`, children: c.map((h) => /* @__PURE__ */ o("option", { value: h }, h)) })
3839
3868
  ]
3840
3869
  }
3841
3870
  );
3842
- }, Zr = ({
3871
+ }, rn = ({
3843
3872
  label: e,
3844
3873
  value: t,
3845
3874
  description: r,
@@ -3849,14 +3878,14 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3849
3878
  }) => /* @__PURE__ */ o(q, { label: e, description: r, mixed: n, className: i, children: /* @__PURE__ */ o(
3850
3879
  "p",
3851
3880
  {
3852
- className: P(
3881
+ className: M(
3853
3882
  "break-words text-xs text-foreground",
3854
3883
  s && "font-mono text-[11px]",
3855
3884
  (n || t === void 0 || t === "") && "text-muted-foreground/60"
3856
3885
  ),
3857
3886
  children: n ? se : t ?? "—"
3858
3887
  }
3859
- ) }), en = (e, t) => {
3888
+ ) }), nn = (e, t) => {
3860
3889
  if (e != null)
3861
3890
  return t.split(".").reduce(
3862
3891
  (r, n) => r == null ? void 0 : r[n],
@@ -3873,15 +3902,15 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3873
3902
  ...i,
3874
3903
  [n]: ht(d, s.join("."), r)
3875
3904
  };
3876
- }, ke = (e, t) => t.get ? t.get(e) : en(e, t.key), tn = (e, t, r) => t.set ? t.set(e, r) : ht(e, t.key, r), rn = (e, t) => {
3905
+ }, ke = (e, t) => t.get ? t.get(e) : nn(e, t.key), on = (e, t, r) => t.set ? t.set(e, r) : ht(e, t.key, r), sn = (e, t) => {
3877
3906
  if (e.length === 0) return { value: void 0, mixed: !1 };
3878
3907
  const r = ke(e[0], t);
3879
3908
  return e.every((s) => Object.is(ke(s, t), r)) ? { value: r, mixed: !1 } : { value: void 0, mixed: !0 };
3880
- }, nn = (e, t, r) => e.map(
3881
- (n) => Object.is(ke(n, t), r) ? n : tn(n, t, r)
3882
- ), on = {
3909
+ }, an = (e, t, r) => e.map(
3910
+ (n) => Object.is(ke(n, t), r) ? n : on(n, t, r)
3911
+ ), ln = {
3883
3912
  text: ({ field: e, state: t, onChange: r, error: n }) => /* @__PURE__ */ o(
3884
- Wr,
3913
+ Jr,
3885
3914
  {
3886
3915
  label: e.label,
3887
3916
  description: e.description,
@@ -3894,7 +3923,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3894
3923
  }
3895
3924
  ),
3896
3925
  textarea: ({ field: e, state: t, onChange: r, error: n }) => /* @__PURE__ */ o(
3897
- Gr,
3926
+ Xr,
3898
3927
  {
3899
3928
  label: e.label,
3900
3929
  description: e.description,
@@ -3909,7 +3938,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3909
3938
  select: ({ field: e, state: t, onChange: r, error: n }) => {
3910
3939
  var s;
3911
3940
  return /* @__PURE__ */ o(
3912
- Yr,
3941
+ qr,
3913
3942
  {
3914
3943
  label: e.label,
3915
3944
  description: e.description,
@@ -3924,7 +3953,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3924
3953
  );
3925
3954
  },
3926
3955
  checkbox: ({ field: e, state: t, onChange: r, error: n }) => /* @__PURE__ */ o(
3927
- Jr,
3956
+ Vr,
3928
3957
  {
3929
3958
  label: e.label,
3930
3959
  description: e.description,
@@ -3937,7 +3966,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3937
3966
  }
3938
3967
  ),
3939
3968
  number: ({ field: e, state: t, onChange: r, error: n }) => /* @__PURE__ */ o(
3940
- Xr,
3969
+ Qr,
3941
3970
  {
3942
3971
  label: e.label,
3943
3972
  description: e.description,
@@ -3950,7 +3979,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3950
3979
  }
3951
3980
  ),
3952
3981
  color: ({ field: e, state: t, onChange: r, error: n }) => /* @__PURE__ */ o(
3953
- qr,
3982
+ Zr,
3954
3983
  {
3955
3984
  label: e.label,
3956
3985
  description: e.description,
@@ -3963,7 +3992,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3963
3992
  }
3964
3993
  ),
3965
3994
  date: ({ field: e, state: t, onChange: r, error: n }) => /* @__PURE__ */ o(
3966
- Vr,
3995
+ en,
3967
3996
  {
3968
3997
  label: e.label,
3969
3998
  description: e.description,
@@ -3976,7 +4005,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3976
4005
  }
3977
4006
  ),
3978
4007
  tags: ({ field: e, state: t, onChange: r, error: n }) => /* @__PURE__ */ o(
3979
- Qr,
4008
+ tn,
3980
4009
  {
3981
4010
  label: e.label,
3982
4011
  description: e.description,
@@ -3989,7 +4018,7 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3989
4018
  }
3990
4019
  ),
3991
4020
  static: ({ field: e, state: t }) => /* @__PURE__ */ o(
3992
- Zr,
4021
+ rn,
3993
4022
  {
3994
4023
  label: e.label,
3995
4024
  description: e.description,
@@ -3998,12 +4027,12 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
3998
4027
  ...e.props
3999
4028
  }
4000
4029
  )
4001
- }, sn = /* @__PURE__ */ o("div", { className: "grid h-full place-items-center px-6 py-10 text-center", children: /* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground", children: "Nothing selected. Choose an item to see its properties." }) }), Jn = ({
4030
+ }, cn = /* @__PURE__ */ o("div", { className: "grid h-full place-items-center px-6 py-10 text-center", children: /* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground", children: "Nothing selected. Choose an item to see its properties." }) }), Vn = ({
4002
4031
  subjects: e,
4003
4032
  fields: t,
4004
4033
  onChange: r,
4005
- fieldTypes: n = on,
4006
- emptyState: s = sn,
4034
+ fieldTypes: n = ln,
4035
+ emptyState: s = cn,
4007
4036
  title: i,
4008
4037
  groupOrder: a,
4009
4038
  className: d,
@@ -4014,39 +4043,39 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
4014
4043
  [t, e]
4015
4044
  ), p = B(() => {
4016
4045
  const m = /* @__PURE__ */ new Map();
4017
- l.forEach((f) => {
4018
- const h = f.group ?? "";
4019
- m.set(h, [...m.get(h) ?? [], f]);
4046
+ l.forEach((h) => {
4047
+ const g = h.group ?? "";
4048
+ m.set(g, [...m.get(g) ?? [], h]);
4020
4049
  });
4021
4050
  const v = [...m.keys()];
4022
4051
  return (a ? [
4023
4052
  // Ungrouped fields always lead — they are the identity of the thing.
4024
4053
  ...m.has("") ? [""] : [],
4025
- ...a.filter((f) => m.has(f)),
4026
- ...v.filter((f) => f !== "" && !a.includes(f))
4027
- ] : v).map((f) => ({ group: f, fields: m.get(f) }));
4054
+ ...a.filter((h) => m.has(h)),
4055
+ ...v.filter((h) => h !== "" && !a.includes(h))
4056
+ ] : v).map((h) => ({ group: h, fields: m.get(h) }));
4028
4057
  }, [l, a]);
4029
4058
  if (e.length === 0)
4030
- return /* @__PURE__ */ o("section", { "aria-label": c, className: P("h-full overflow-y-auto", d), children: s });
4059
+ return /* @__PURE__ */ o("section", { "aria-label": c, className: M("h-full overflow-y-auto", d), children: s });
4031
4060
  const u = typeof i == "function" ? i(e) : i;
4032
4061
  return /* @__PURE__ */ x(
4033
4062
  "section",
4034
4063
  {
4035
4064
  "aria-label": c,
4036
- className: P("h-full overflow-y-auto", d),
4065
+ className: M("h-full overflow-y-auto", d),
4037
4066
  children: [
4038
4067
  u != null && /* @__PURE__ */ o("header", { className: "sticky top-0 z-10 border-b border-border/60 bg-background/95 px-4 py-2.5 backdrop-blur-sm", children: /* @__PURE__ */ o("div", { className: "text-xs font-semibold text-foreground", children: u }) }),
4039
4068
  /* @__PURE__ */ o("div", { className: "flex flex-col gap-5 p-4", children: p.map(({ group: m, fields: v }) => /* @__PURE__ */ x("div", { className: "flex flex-col gap-4", children: [
4040
4069
  m && /* @__PURE__ */ o("h3", { className: "border-b border-border/40 pb-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/70", children: m }),
4041
4070
  v.map((b) => {
4042
4071
  var y;
4043
- const f = rn(e, b), h = n[b.type ?? "text"];
4044
- return h ? /* @__PURE__ */ o(pe.Fragment, { children: h({
4072
+ const h = sn(e, b), g = n[b.type ?? "text"];
4073
+ return g ? /* @__PURE__ */ o(pe.Fragment, { children: g({
4045
4074
  field: b,
4046
- state: f,
4075
+ state: h,
4047
4076
  subjects: e,
4048
- error: (y = b.validate) == null ? void 0 : y.call(b, f.value, e),
4049
- onChange: (k) => r == null ? void 0 : r(nn(e, b, k), b, k)
4077
+ error: (y = b.validate) == null ? void 0 : y.call(b, h.value, e),
4078
+ onChange: (w) => r == null ? void 0 : r(an(e, b, w), b, w)
4050
4079
  }) }, b.key) : /* @__PURE__ */ x("p", { className: "text-[11px] text-destructive", children: [
4051
4080
  "No renderer registered for field type “",
4052
4081
  b.type,
@@ -4059,131 +4088,131 @@ const Fr = ["top", "right", "bottom", "left"], zr = {
4059
4088
  );
4060
4089
  };
4061
4090
  export {
4062
- Bt as ActivityBar,
4063
- Pn as AppTitle,
4064
- on as BUILT_IN_FIELD_TYPES,
4065
- Hr as BUILT_IN_LAYOUTS,
4091
+ Ht as ActivityBar,
4092
+ Cn as AppTitle,
4093
+ ln as BUILT_IN_FIELD_TYPES,
4094
+ Gr as BUILT_IN_LAYOUTS,
4066
4095
  de as BUNDLED_THEMES,
4067
- nr as BUNDLED_THEME_CLASSES,
4096
+ ar as BUNDLED_THEME_CLASSES,
4068
4097
  Xe as CHAT_PANEL_ID,
4069
4098
  ne as CONTROL_CLASS,
4070
- dr as ChatPane,
4071
- Jr as CheckboxField,
4072
- qr as ColorField,
4073
- vr as CommandPalette,
4074
- qt as CommandRegistry,
4075
- ur as ConnectedChatPane,
4076
- Tn as ConnectedCommandPalette,
4077
- Vt as ConnectedMenuBar,
4078
- Dn as ConnectedModal,
4099
+ fr as ChatPane,
4100
+ Vr as CheckboxField,
4101
+ Zr as ColorField,
4102
+ kr as CommandPalette,
4103
+ Zt as CommandRegistry,
4104
+ pr as ConnectedChatPane,
4105
+ In as ConnectedCommandPalette,
4106
+ er as ConnectedMenuBar,
4107
+ Sn as ConnectedModal,
4079
4108
  xe as ConnectedPane,
4080
4109
  Me as ConnectedPaneRail,
4081
- hr as ConnectedSettingsPanel,
4082
- Zt as ConnectedStatusBar,
4083
- br as ConnectedTerminalPane,
4084
- Ln as ConnectedThemeSwitcher,
4085
- In as ConnectedUserProfile,
4086
- Lr as ContextMenu,
4087
- bn as DEFAULT_COMMAND_IDS,
4088
- Bn as DEFAULT_GRAPH_KEYS,
4110
+ br as ConnectedSettingsPanel,
4111
+ rr as ConnectedStatusBar,
4112
+ wr as ConnectedTerminalPane,
4113
+ Pn as ConnectedThemeSwitcher,
4114
+ Mn as ConnectedUserProfile,
4115
+ Pr as ContextMenu,
4116
+ wn as DEFAULT_COMMAND_IDS,
4117
+ Wn as DEFAULT_GRAPH_KEYS,
4089
4118
  he as DEFAULT_NODE_SIZE,
4090
- fr as DEFAULT_SETTINGS_THEMES,
4091
- Er as DEFAULT_THEME_OPTIONS,
4092
- Sn as DataGrid,
4093
- Vr as DateField,
4119
+ gr as DEFAULT_SETTINGS_THEMES,
4120
+ Lr as DEFAULT_THEME_OPTIONS,
4121
+ An as DataGrid,
4122
+ en as DateField,
4094
4123
  fe as FREEFORM,
4095
4124
  q as FieldShell,
4096
4125
  ft as GRAPH_NODE_MIME,
4097
- Rr as GraphCanvas,
4098
- Kn as GraphEdge,
4099
- Un as GraphEdgeLayer,
4100
- jn as GraphMiniMap,
4101
- _n as GraphNode,
4126
+ Or as GraphCanvas,
4127
+ Hn as GraphEdge,
4128
+ jn as GraphEdgeLayer,
4129
+ Yn as GraphMiniMap,
4130
+ Bn as GraphNode,
4102
4131
  dt as IDENTITY_VIEWPORT,
4103
- Jt as MenuBar,
4104
- Xt as MenuRegistry,
4105
- kr as Modal,
4106
- xn as NexusWorkspaceShell,
4107
- Gn as NodePalette,
4108
- Xr as NumberField,
4132
+ Vt as MenuBar,
4133
+ Qt as MenuRegistry,
4134
+ Dr as Modal,
4135
+ vn as NexusWorkspaceShell,
4136
+ Xn as NodePalette,
4137
+ Qr as NumberField,
4109
4138
  Ve as PANE_SIDES,
4110
4139
  ot as PaneHostProvider,
4111
- Jn as PropertyPanel,
4112
- Mn as QuickSearch,
4113
- Ht as SETTINGS_PANEL_ID,
4114
- Cn as SearchWidget,
4115
- Yr as SelectField,
4116
- pr as SettingsPanel,
4117
- xn as ShellLayout,
4140
+ Vn as PropertyPanel,
4141
+ $n as QuickSearch,
4142
+ jt as SETTINGS_PANEL_ID,
4143
+ Rn as SearchWidget,
4144
+ qr as SelectField,
4145
+ xr as SettingsPanel,
4146
+ vn as ShellLayout,
4118
4147
  Ce as SidebarPane,
4119
- Zr as StaticField,
4120
- Qt as StatusBar,
4148
+ rn as StaticField,
4149
+ tr as StatusBar,
4121
4150
  qe as TERMINAL_PANEL_ID,
4122
- Qr as TagField,
4123
- gr as TerminalPane,
4124
- Gr as TextAreaField,
4125
- Wr as TextField,
4126
- Tr as ThemeSwitcher,
4127
- An as TreeWidget,
4128
- Dr as UserProfile,
4151
+ tn as TagField,
4152
+ yr as TerminalPane,
4153
+ Xr as TextAreaField,
4154
+ Jr as TextField,
4155
+ Ir as ThemeSwitcher,
4156
+ Fn as TreeWidget,
4157
+ Sr as UserProfile,
4129
4158
  oe as borderClass,
4130
4159
  Ue as centerOn,
4131
- Nn as chatPanel,
4160
+ Tn as chatPanel,
4132
4161
  Ne as clampScale,
4133
- P as cn,
4162
+ M as cn,
4134
4163
  re as commandRegistry,
4135
4164
  st as componentRegistry,
4136
4165
  De as createPaneStore,
4137
- _r as edgePath,
4138
- Rn as edgesOf,
4166
+ Br as edgePath,
4167
+ On as edgesOf,
4139
4168
  Z as fieldId,
4140
4169
  ve as findNeighbour,
4141
- Cr as fitViewport,
4142
- en as getPath,
4170
+ Rr as fitViewport,
4171
+ nn as getPath,
4143
4172
  ut as graphBounds,
4144
- Br as gridLayout,
4145
- yn as initializeShell,
4146
- Fn as isConnected,
4173
+ Wr as gridLayout,
4174
+ Nn as initializeShell,
4175
+ _n as isConnected,
4147
4176
  Be as layeredLayout,
4148
4177
  Le as menuRegistry,
4149
- On as nextId,
4178
+ Un as nextId,
4150
4179
  j as nodeRect,
4151
4180
  ce as paneStore,
4152
- Ar as placeRelativeTo,
4153
- vn as pluginRegistry,
4181
+ Fr as placeRelativeTo,
4182
+ kn as pluginRegistry,
4154
4183
  Ke as portPoint,
4155
- Yn as readPaletteDrag,
4184
+ qn as readPaletteDrag,
4156
4185
  ke as readValue,
4157
- rn as readValues,
4186
+ sn as readValues,
4158
4187
  J as rectCenter,
4159
- zn as removeNode,
4160
- Pr as resolvePorts,
4188
+ Kn as removeNode,
4189
+ Cr as resolvePorts,
4161
4190
  Qe as setPanels,
4162
4191
  ht as setPath,
4163
- En as settingsPanel,
4164
- kn as terminalPanel,
4165
- or as themeClass,
4192
+ Ln as settingsPanel,
4193
+ Dn as terminalPanel,
4194
+ ir as themeClass,
4166
4195
  we as toGraphSpace,
4167
- $n as toScreenSpace,
4196
+ zn as toScreenSpace,
4168
4197
  Fe as togglePanel,
4169
- Mr as unionRect,
4170
- Gt as useBottomPaneStore,
4198
+ $r as unionRect,
4199
+ Xt as useBottomPaneStore,
4171
4200
  le as useChatStore,
4172
- Hn as useGraphKeyboard,
4173
- Wn as useGraphLayout,
4201
+ Gn as useGraphKeyboard,
4202
+ Jn as useGraphLayout,
4174
4203
  nt as useHostChrome,
4175
- wn as useKeyboardShortcuts,
4204
+ En as useKeyboardShortcuts,
4176
4205
  at as useLayoutStore,
4177
- jt as useLeftPaneStore,
4206
+ Yt as useLeftPaneStore,
4178
4207
  it as useModalStore,
4179
4208
  rt as usePaneHost,
4180
- Wt as useRightPaneStore,
4209
+ Jt as useRightPaneStore,
4181
4210
  Ie as useStatusBarStore,
4182
4211
  ye as useTerminalStore,
4183
4212
  ie as useThemeStore,
4184
4213
  te as useUserProfileStore,
4185
- Sr as viewportRect,
4186
- tn as writeValue,
4187
- nn as writeValues,
4214
+ Ar as viewportRect,
4215
+ on as writeValue,
4216
+ an as writeValues,
4188
4217
  _e as zoomAt
4189
4218
  };