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