@hachej/boring-workspace 0.1.32 → 0.1.34
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/{FileTree-BltQETt9.js → FileTree-DWbh0xNI.js} +1 -1
- package/dist/{MarkdownEditor-heUJdK4j.js → MarkdownEditor-BhLjIyPQ.js} +1 -1
- package/dist/{WorkspaceLoadingState-InXsc_8G.js → WorkspaceLoadingState-RVGURLJy.js} +1 -1
- package/dist/{WorkspaceProvider-Cg-J1wxr.js → WorkspaceProvider-hCE2wXKZ.js} +1287 -1257
- package/dist/app-front.d.ts +3 -0
- package/dist/app-front.js +238 -235
- package/dist/app-server.d.ts +11 -8
- package/dist/app-server.js +603 -79
- package/dist/{createInMemoryBridge-HJopAIbo.d.ts → createInMemoryBridge-zb8MpO60.d.ts} +11 -1
- package/dist/runtime-server.d.ts +47 -0
- package/dist/runtime-server.js +32 -0
- package/dist/server.d.ts +63 -25
- package/dist/server.js +549 -46
- package/dist/testing.js +1 -1
- package/dist/workspace.css +5 -0
- package/dist/workspace.d.ts +4 -1
- package/dist/workspace.js +5 -5
- package/docs/PLUGIN_SYSTEM.md +5 -6
- package/package.json +9 -3
|
@@ -2,11 +2,11 @@ var Xr = Object.defineProperty;
|
|
|
2
2
|
var Qr = (e, t, n) => t in e ? Xr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var V = (e, t, n) => Qr(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import * as Zr from "react/jsx-runtime";
|
|
5
|
-
import { jsx as u, jsxs as
|
|
5
|
+
import { jsx as u, jsxs as C, Fragment as _e } from "react/jsx-runtime";
|
|
6
6
|
import * as eo from "react";
|
|
7
|
-
import { useRef as
|
|
8
|
-
import { AlertTriangleIcon as no, ImageIcon as ze, FileTextIcon as
|
|
9
|
-
import { Notice as Jn, IconButton as ge, LoadingState as go, Input as Yn, toast as Ae, ErrorState as
|
|
7
|
+
import { useRef as A, useMemo as H, useContext as se, createContext as ye, useSyncExternalStore as rt, useState as O, useCallback as P, Component as to, useEffect as L, createElement as de, Suspense as Et, Fragment as Kn, lazy as ut } from "react";
|
|
8
|
+
import { AlertTriangleIcon as no, ImageIcon as ze, FileTextIcon as Se, FileJsonIcon as fn, FileCodeIcon as re, FileIcon as It, Loader2 as ro, X as Hn, RefreshCw as oo, Download as io, RefreshCcw as so, ExternalLink as ao, FolderTree as Pt, TerminalIcon as Yt, ClockIcon as co, ArrowUp as lo, ArrowDown as uo, CornerDownLeft as fo, Plus as po, ChevronLeft as Gn, PanelLeft as mo, Search as pn, ChevronRight as ho } from "lucide-react";
|
|
9
|
+
import { Notice as Jn, IconButton as ge, LoadingState as go, Input as Yn, toast as Ae, ErrorState as nt, Skeleton as vo, Spinner as Rt, Button as $e, AlertDialog as yo, AlertDialogContent as wo, AlertDialogHeader as bo, AlertDialogTitle as xo, AlertDialogDescription as So, AlertDialogFooter as ko, AlertDialogCancel as Po, AlertDialogAction as Co, EmptyState as Xn, Kbd as tt, Dialog as Eo, DialogContent as Io, DialogHeader as Ro, DialogTitle as No, DialogDescription as To, Command as Ao, CommandList as Fo, CommandEmpty as Do, CommandInput as Lo, CommandGroup as Xt, CommandItem as Nt, CommandShortcut as $o, Tabs as _o, TabsList as Oo, TabsTrigger as Mo, Toaster as Wo } from "@hachej/boring-ui-kit";
|
|
10
10
|
import { useStore as Oe, create as zo } from "zustand";
|
|
11
11
|
import { persist as jo } from "zustand/middleware";
|
|
12
12
|
import { z as K } from "zod";
|
|
@@ -53,39 +53,39 @@ function He(e) {
|
|
|
53
53
|
return [...e];
|
|
54
54
|
}
|
|
55
55
|
function Zn(e = {}) {
|
|
56
|
-
const t = [], n = [], r = [], o = [], i = [], a = [], l = [], c = /* @__PURE__ */ new Map(),
|
|
57
|
-
const p = `${s}:${
|
|
58
|
-
if (
|
|
56
|
+
const t = [], n = [], r = [], o = [], i = [], a = [], l = [], c = /* @__PURE__ */ new Map(), f = (s, d) => {
|
|
57
|
+
const p = `${s}:${d}`, m = c.get(p);
|
|
58
|
+
if (m !== void 0) {
|
|
59
59
|
const g = e.pluginId ?? "<plugin>";
|
|
60
60
|
throw new Ut(
|
|
61
61
|
"duplicate-id",
|
|
62
|
-
`plugin "${g}" registers ${s} "${
|
|
62
|
+
`plugin "${g}" registers ${s} "${d}" twice (first as ${m}, then again). If you are composing kits, two of them are registering the same id — namespace one of them.`
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
|
-
c.set(p, `${s} "${
|
|
65
|
+
c.set(p, `${s} "${d}"`);
|
|
66
66
|
};
|
|
67
67
|
return {
|
|
68
68
|
registerProvider(s) {
|
|
69
|
-
|
|
69
|
+
f("provider", s.id), t.push(s);
|
|
70
70
|
},
|
|
71
71
|
registerBinding(s) {
|
|
72
|
-
|
|
72
|
+
f("binding", s.id), n.push(s);
|
|
73
73
|
},
|
|
74
74
|
registerCatalog(s) {
|
|
75
|
-
|
|
75
|
+
f("catalog", s.id), r.push(s);
|
|
76
76
|
},
|
|
77
77
|
registerPanel(s) {
|
|
78
|
-
|
|
78
|
+
f("panel", s.id), o.push(s);
|
|
79
79
|
},
|
|
80
80
|
registerPanelCommand(s) {
|
|
81
|
-
|
|
81
|
+
f("command", s.id), i.push(s);
|
|
82
82
|
},
|
|
83
83
|
registerLeftTab(s) {
|
|
84
|
-
|
|
84
|
+
f("left-tab", s.id), a.push(s);
|
|
85
85
|
},
|
|
86
86
|
registerSurfaceResolver(s) {
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const d = s.id ?? `${e.pluginId ?? "anon"}:${s.kind}`;
|
|
88
|
+
f("surface-resolver", d), s.id === void 0 && (s.id = d), l.push(s);
|
|
89
89
|
},
|
|
90
90
|
flush() {
|
|
91
91
|
return {
|
|
@@ -335,9 +335,9 @@ class tr {
|
|
|
335
335
|
let n, r = -1 / 0, o = !1, i = -1;
|
|
336
336
|
return this.registrationOrder.forEach((a, l) => {
|
|
337
337
|
const c = this.resolvers.get(a);
|
|
338
|
-
let
|
|
338
|
+
let f;
|
|
339
339
|
try {
|
|
340
|
-
|
|
340
|
+
f = c.resolve(t);
|
|
341
341
|
} catch (p) {
|
|
342
342
|
console.warn(
|
|
343
343
|
`[SurfaceResolverRegistry] resolver "${a}" failed:`,
|
|
@@ -345,9 +345,9 @@ class tr {
|
|
|
345
345
|
);
|
|
346
346
|
return;
|
|
347
347
|
}
|
|
348
|
-
if (!
|
|
349
|
-
const s =
|
|
350
|
-
(s > r || s === r &&
|
|
348
|
+
if (!f) return;
|
|
349
|
+
const s = f.score ?? 0, d = c.source === "app";
|
|
350
|
+
(s > r || s === r && d && !o || s === r && d === o && l >= i) && (n = f, r = s, o = d, i = l);
|
|
351
351
|
}), n;
|
|
352
352
|
}
|
|
353
353
|
emit() {
|
|
@@ -363,9 +363,9 @@ function ii({
|
|
|
363
363
|
surfaceResolverRegistry: r,
|
|
364
364
|
children: o
|
|
365
365
|
}) {
|
|
366
|
-
const i =
|
|
366
|
+
const i = A(null), a = A(null);
|
|
367
367
|
i.current || (i.current = new er()), a.current || (a.current = new tr());
|
|
368
|
-
const l = n ?? i.current, c = r ?? a.current,
|
|
368
|
+
const l = n ?? i.current, c = r ?? a.current, f = H(
|
|
369
369
|
() => ({
|
|
370
370
|
panelRegistry: e,
|
|
371
371
|
commandRegistry: t,
|
|
@@ -374,7 +374,7 @@ function ii({
|
|
|
374
374
|
}),
|
|
375
375
|
[e, t, l, c]
|
|
376
376
|
);
|
|
377
|
-
return /* @__PURE__ */ u(dt.Provider, { value:
|
|
377
|
+
return /* @__PURE__ */ u(dt.Provider, { value: f, children: o });
|
|
378
378
|
}
|
|
379
379
|
function At() {
|
|
380
380
|
const e = se(dt);
|
|
@@ -398,11 +398,11 @@ function nr() {
|
|
|
398
398
|
}
|
|
399
399
|
function si() {
|
|
400
400
|
const e = Zt();
|
|
401
|
-
return
|
|
401
|
+
return rt(e.subscribe, e.getSnapshot);
|
|
402
402
|
}
|
|
403
403
|
function ai() {
|
|
404
404
|
const e = Ft();
|
|
405
|
-
return
|
|
405
|
+
return rt(e.subscribe, e.getSnapshot);
|
|
406
406
|
}
|
|
407
407
|
function ci({ pluginId: e, message: t, kind: n }) {
|
|
408
408
|
return /* @__PURE__ */ u(
|
|
@@ -411,8 +411,8 @@ function ci({ pluginId: e, message: t, kind: n }) {
|
|
|
411
411
|
tone: "error",
|
|
412
412
|
icon: /* @__PURE__ */ u(no, { className: "size-4" }),
|
|
413
413
|
className: "py-2",
|
|
414
|
-
description: /* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
414
|
+
description: /* @__PURE__ */ C("span", { className: "block min-w-0 truncate", children: [
|
|
415
|
+
/* @__PURE__ */ C("span", { className: "font-medium", children: [
|
|
416
416
|
"[",
|
|
417
417
|
e,
|
|
418
418
|
"]"
|
|
@@ -427,7 +427,7 @@ function ci({ pluginId: e, message: t, kind: n }) {
|
|
|
427
427
|
}
|
|
428
428
|
const en = ye(null);
|
|
429
429
|
function li({ children: e }) {
|
|
430
|
-
const [t, n] =
|
|
430
|
+
const [t, n] = O([]), r = P((i) => {
|
|
431
431
|
n((a) => [...a, i]);
|
|
432
432
|
}, []), o = H(
|
|
433
433
|
() => ({ errors: t, reportPluginError: r }),
|
|
@@ -515,7 +515,7 @@ const di = 1024, fi = 500, pi = /^[a-zA-Z0-9_-]+$/, mi = 64, ht = 50, mn = 16384
|
|
|
515
515
|
}), bi = K.object({
|
|
516
516
|
path: tn
|
|
517
517
|
});
|
|
518
|
-
function
|
|
518
|
+
function xi(e) {
|
|
519
519
|
let t = 0;
|
|
520
520
|
const n = /* @__PURE__ */ new Map();
|
|
521
521
|
function r() {
|
|
@@ -524,15 +524,15 @@ function Si(e) {
|
|
|
524
524
|
function o() {
|
|
525
525
|
return { seq: r(), status: "ok" };
|
|
526
526
|
}
|
|
527
|
-
function i(c,
|
|
528
|
-
return { seq: r(), status: "error", error: { code: c, message:
|
|
527
|
+
function i(c, f) {
|
|
528
|
+
return { seq: r(), status: "error", error: { code: c, message: f } };
|
|
529
529
|
}
|
|
530
|
-
function a(c,
|
|
530
|
+
function a(c, f) {
|
|
531
531
|
const s = n.get(c);
|
|
532
532
|
if (s)
|
|
533
|
-
for (const
|
|
533
|
+
for (const d of [...s])
|
|
534
534
|
try {
|
|
535
|
-
f
|
|
535
|
+
d(f);
|
|
536
536
|
} catch (p) {
|
|
537
537
|
console.error(`[bridge] listener for "${String(c)}" threw:`, p);
|
|
538
538
|
}
|
|
@@ -550,19 +550,19 @@ function Si(e) {
|
|
|
550
550
|
getVisibleFiles() {
|
|
551
551
|
return e.getState().visibleFiles;
|
|
552
552
|
},
|
|
553
|
-
async openFile(c,
|
|
554
|
-
const s = hi.safeParse({ path: c, mode:
|
|
553
|
+
async openFile(c, f) {
|
|
554
|
+
const s = hi.safeParse({ path: c, mode: f == null ? void 0 : f.mode });
|
|
555
555
|
if (!s.success) return i("VALIDATION", s.error.issues[0].message);
|
|
556
|
-
const
|
|
557
|
-
if (
|
|
558
|
-
const
|
|
559
|
-
return
|
|
556
|
+
const d = e.getState(), p = s.data.mode ?? "edit", m = `file:${c}`;
|
|
557
|
+
if (d.panels.find((y) => y.id === m)) {
|
|
558
|
+
const y = d.activePanel;
|
|
559
|
+
return d.activatePanel(m), d.visibleFiles.includes(c) || d.openFile(c, m), a("panel:activated", { panelId: m, previousPanelId: y }), o();
|
|
560
560
|
}
|
|
561
|
-
return
|
|
561
|
+
return d.panels.length >= ht ? i("MAX_PANELS", `cannot exceed ${ht} open panels`) : (d.openFile(c, m), d.openPanel({ id: m, component: "editor", params: { path: c, mode: p } }), a("file:opened", { path: c, mode: p }), a("panel:opened", { panelId: m, params: { path: c, mode: p } }), o());
|
|
562
562
|
},
|
|
563
563
|
async openPanel(c) {
|
|
564
|
-
const
|
|
565
|
-
if (!
|
|
564
|
+
const f = gi.safeParse(c);
|
|
565
|
+
if (!f.success) return i("VALIDATION", f.error.issues[0].message);
|
|
566
566
|
const s = e.getState();
|
|
567
567
|
if (s.panels.find((p) => p.id === c.id)) {
|
|
568
568
|
const p = s.activePanel;
|
|
@@ -575,31 +575,31 @@ function Si(e) {
|
|
|
575
575
|
}), a("panel:opened", { panelId: c.id, params: c.params ?? {} }), o());
|
|
576
576
|
},
|
|
577
577
|
async closePanel(c) {
|
|
578
|
-
const
|
|
579
|
-
if (!
|
|
580
|
-
const s = e.getState(),
|
|
581
|
-
return
|
|
578
|
+
const f = vi.safeParse({ id: c });
|
|
579
|
+
if (!f.success) return i("VALIDATION", f.error.issues[0].message);
|
|
580
|
+
const s = e.getState(), d = s.panels.find((p) => p.id === c);
|
|
581
|
+
return d ? d.essential ? i("ESSENTIAL", `panel ${c} is essential and cannot be closed`) : (s.closePanel(c), a("panel:closed", { panelId: c }), o()) : i("NOT_FOUND", `panel ${c} not found`);
|
|
582
582
|
},
|
|
583
583
|
async closeWorkbenchLeftPane() {
|
|
584
584
|
return e.getState().setSidebar({ collapsed: !0 }), a("sidebar:toggled", { collapsed: !0 }), o();
|
|
585
585
|
},
|
|
586
|
-
async showNotification(c,
|
|
587
|
-
const s = yi.safeParse({ msg: c, level:
|
|
586
|
+
async showNotification(c, f = "info") {
|
|
587
|
+
const s = yi.safeParse({ msg: c, level: f });
|
|
588
588
|
if (!s.success) return i("VALIDATION", s.error.issues[0].message);
|
|
589
|
-
const
|
|
590
|
-
return e.getState().showNotification({ message: s.data.msg, type: p }), a("notification:shown", { message: s.data.msg, level:
|
|
589
|
+
const d = s.data.level ?? "info", p = d === "warn" ? "warning" : d;
|
|
590
|
+
return e.getState().showNotification({ message: s.data.msg, type: p }), a("notification:shown", { message: s.data.msg, level: d }), o();
|
|
591
591
|
},
|
|
592
|
-
async navigateToLine(c,
|
|
593
|
-
const s = wi.safeParse({ file: c, line:
|
|
592
|
+
async navigateToLine(c, f) {
|
|
593
|
+
const s = wi.safeParse({ file: c, line: f });
|
|
594
594
|
if (!s.success) return i("VALIDATION", s.error.issues[0].message);
|
|
595
|
-
const
|
|
596
|
-
return
|
|
595
|
+
const d = await l.openFile(c);
|
|
596
|
+
return d.status === "error" ? d : (e.getState().navigateToLine(c, s.data.line), o());
|
|
597
597
|
},
|
|
598
598
|
async expandToFile(c) {
|
|
599
|
-
const
|
|
600
|
-
if (!
|
|
599
|
+
const f = bi.safeParse({ path: c });
|
|
600
|
+
if (!f.success) return i("VALIDATION", f.error.issues[0].message);
|
|
601
601
|
const s = e.getState();
|
|
602
|
-
return s.sidebar.collapsed && (s.setSidebar({ collapsed: !1 }), a("sidebar:toggled", { collapsed: !1 })), a("tree:expand", { path:
|
|
602
|
+
return s.sidebar.collapsed && (s.setSidebar({ collapsed: !1 }), a("sidebar:toggled", { collapsed: !1 })), a("tree:expand", { path: f.data.path }), o();
|
|
603
603
|
},
|
|
604
604
|
markDirty(c) {
|
|
605
605
|
e.getState().markDirty(c, "bridge"), a("file:dirty", { path: c, dirty: !0 });
|
|
@@ -607,23 +607,23 @@ function Si(e) {
|
|
|
607
607
|
markClean(c) {
|
|
608
608
|
e.getState().markClean(c), a("file:dirty", { path: c, dirty: !1 });
|
|
609
609
|
},
|
|
610
|
-
subscribe(c,
|
|
610
|
+
subscribe(c, f) {
|
|
611
611
|
let s = n.get(c);
|
|
612
612
|
s || (s = /* @__PURE__ */ new Set(), n.set(c, s));
|
|
613
|
-
const
|
|
614
|
-
return s.add(
|
|
613
|
+
const d = f;
|
|
614
|
+
return s.add(d), () => s.delete(d);
|
|
615
615
|
},
|
|
616
|
-
select(c,
|
|
616
|
+
select(c, f) {
|
|
617
617
|
let s = c(e.getState());
|
|
618
|
-
return e.subscribe((
|
|
619
|
-
const p = c(
|
|
620
|
-
Object.is(p, s) || (s = p,
|
|
618
|
+
return e.subscribe((d) => {
|
|
619
|
+
const p = c(d);
|
|
620
|
+
Object.is(p, s) || (s = p, f(p));
|
|
621
621
|
});
|
|
622
622
|
}
|
|
623
623
|
};
|
|
624
624
|
return l;
|
|
625
625
|
}
|
|
626
|
-
const
|
|
626
|
+
const Si = 100, ki = 3e3;
|
|
627
627
|
function hn(e) {
|
|
628
628
|
const t = { "Content-Type": "application/json" };
|
|
629
629
|
return e && (t.Authorization = `Bearer ${e}`), t;
|
|
@@ -695,42 +695,42 @@ function Ci(e) {
|
|
|
695
695
|
pollInterval: a = ki,
|
|
696
696
|
onAuthError: l,
|
|
697
697
|
onVersionMismatch: c,
|
|
698
|
-
onConnectionChange:
|
|
698
|
+
onConnectionChange: f
|
|
699
699
|
} = e;
|
|
700
|
-
let s = null,
|
|
701
|
-
function
|
|
702
|
-
|
|
700
|
+
let s = null, d = null, p = null, m = null, g = !1, y = !1, x = 0;
|
|
701
|
+
function k(T) {
|
|
702
|
+
y || g !== T && (g = T, f == null || f(T));
|
|
703
703
|
}
|
|
704
|
-
async function
|
|
705
|
-
if (
|
|
706
|
-
const
|
|
704
|
+
async function $(T) {
|
|
705
|
+
if (y) return;
|
|
706
|
+
const _ = Pi(r, T);
|
|
707
707
|
try {
|
|
708
708
|
const W = await fetch(`${t}/api/v1/ui/state`, {
|
|
709
709
|
method: "PUT",
|
|
710
710
|
headers: hn(o),
|
|
711
|
-
body: JSON.stringify(
|
|
711
|
+
body: JSON.stringify(_)
|
|
712
712
|
});
|
|
713
|
-
if (
|
|
713
|
+
if (y) return;
|
|
714
714
|
(W.status === 401 || W.status === 403) && (l == null || l(W.status));
|
|
715
715
|
} catch {
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function D(T) {
|
|
719
719
|
p !== null && clearTimeout(p), p = setTimeout(() => {
|
|
720
|
-
p = null,
|
|
721
|
-
},
|
|
720
|
+
p = null, $(T);
|
|
721
|
+
}, Si);
|
|
722
722
|
}
|
|
723
|
-
function
|
|
724
|
-
if (!
|
|
725
|
-
switch (
|
|
723
|
+
function h(T, _) {
|
|
724
|
+
if (!y)
|
|
725
|
+
switch (T) {
|
|
726
726
|
case "init": {
|
|
727
|
-
|
|
727
|
+
k(!0), $("restore");
|
|
728
728
|
break;
|
|
729
729
|
}
|
|
730
730
|
case "command": {
|
|
731
731
|
let W;
|
|
732
732
|
try {
|
|
733
|
-
W = JSON.parse(
|
|
733
|
+
W = JSON.parse(_);
|
|
734
734
|
} catch {
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
@@ -738,15 +738,15 @@ function Ci(e) {
|
|
|
738
738
|
c == null || c(W.v);
|
|
739
739
|
return;
|
|
740
740
|
}
|
|
741
|
-
|
|
742
|
-
|
|
741
|
+
x++, gn(n, W.kind, W.params).finally(() => {
|
|
742
|
+
x--;
|
|
743
743
|
});
|
|
744
744
|
break;
|
|
745
745
|
}
|
|
746
746
|
case "error": {
|
|
747
747
|
let W;
|
|
748
748
|
try {
|
|
749
|
-
W = JSON.parse(
|
|
749
|
+
W = JSON.parse(_);
|
|
750
750
|
} catch {
|
|
751
751
|
return;
|
|
752
752
|
}
|
|
@@ -759,64 +759,64 @@ function Ci(e) {
|
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
function
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
}),
|
|
767
|
-
|
|
768
|
-
}),
|
|
769
|
-
W.data ?
|
|
770
|
-
}),
|
|
771
|
-
|
|
772
|
-
}), s =
|
|
762
|
+
function M() {
|
|
763
|
+
const T = `${t}/api/v1/ui/commands/next`, _ = new EventSource(T, { withCredentials: !0 });
|
|
764
|
+
_.addEventListener("init", (W) => {
|
|
765
|
+
h("init", W.data);
|
|
766
|
+
}), _.addEventListener("command", (W) => {
|
|
767
|
+
h("command", W.data);
|
|
768
|
+
}), _.addEventListener("error", (W) => {
|
|
769
|
+
W.data ? h("error", W.data) : k(!1);
|
|
770
|
+
}), _.addEventListener("heartbeat", (W) => {
|
|
771
|
+
h("heartbeat", W.data);
|
|
772
|
+
}), s = _;
|
|
773
773
|
}
|
|
774
|
-
async function
|
|
775
|
-
if (!
|
|
774
|
+
async function v() {
|
|
775
|
+
if (!y)
|
|
776
776
|
try {
|
|
777
|
-
const
|
|
778
|
-
if (
|
|
779
|
-
if (
|
|
780
|
-
l == null || l(
|
|
777
|
+
const T = `${t}/api/v1/ui/commands/next?poll=true`, _ = await fetch(T, { headers: hn(o) });
|
|
778
|
+
if (y) return;
|
|
779
|
+
if (_.status === 401 || _.status === 403) {
|
|
780
|
+
l == null || l(_.status);
|
|
781
781
|
return;
|
|
782
782
|
}
|
|
783
|
-
if (!
|
|
784
|
-
const W = await
|
|
783
|
+
if (!_.ok) return;
|
|
784
|
+
const W = await _.json();
|
|
785
785
|
if (!Array.isArray(W)) return;
|
|
786
786
|
for (const te of W) {
|
|
787
|
-
if (
|
|
787
|
+
if (y) return;
|
|
788
788
|
if (te.v !== 1) {
|
|
789
789
|
c == null || c(te.v);
|
|
790
790
|
continue;
|
|
791
791
|
}
|
|
792
|
-
|
|
792
|
+
x++;
|
|
793
793
|
try {
|
|
794
794
|
await gn(n, te.kind, te.params);
|
|
795
795
|
} finally {
|
|
796
|
-
|
|
796
|
+
x--;
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
|
-
|
|
799
|
+
k(!0);
|
|
800
800
|
} catch {
|
|
801
|
-
|
|
801
|
+
k(!1);
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
|
-
function
|
|
805
|
-
|
|
806
|
-
if (
|
|
807
|
-
const
|
|
808
|
-
|
|
804
|
+
function w() {
|
|
805
|
+
m = r.subscribe(() => {
|
|
806
|
+
if (y) return;
|
|
807
|
+
const T = x > 0 ? "agent" : "user";
|
|
808
|
+
D(T);
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
return {
|
|
812
812
|
connect() {
|
|
813
|
-
|
|
813
|
+
y = !1, !i && typeof EventSource < "u" ? M() : (v(), d = setInterval(v, a)), w();
|
|
814
814
|
},
|
|
815
815
|
disconnect() {
|
|
816
|
-
s && (s.close(), s = null),
|
|
816
|
+
s && (s.close(), s = null), d !== null && (clearInterval(d), d = null), p !== null && (clearTimeout(p), p = null), m && (m(), m = null), k(!1), y = !0;
|
|
817
817
|
},
|
|
818
|
-
pushState(
|
|
819
|
-
|
|
818
|
+
pushState(T) {
|
|
819
|
+
$(T);
|
|
820
820
|
}
|
|
821
821
|
};
|
|
822
822
|
}
|
|
@@ -909,10 +909,10 @@ function qt(e, t) {
|
|
|
909
909
|
const l = (c) => {
|
|
910
910
|
try {
|
|
911
911
|
c.openPanel(i);
|
|
912
|
-
} catch (
|
|
912
|
+
} catch (f) {
|
|
913
913
|
console.warn(
|
|
914
914
|
"[uiCommandDispatcher] openPanel dispatch failed:",
|
|
915
|
-
|
|
915
|
+
f instanceof Error ? f.message : f
|
|
916
916
|
);
|
|
917
917
|
}
|
|
918
918
|
};
|
|
@@ -972,25 +972,25 @@ const Ti = "workspace:ui.command", Ai = "workspace:editor.save.start", Fi = "wor
|
|
|
972
972
|
panelClose: Li,
|
|
973
973
|
agentData: $i
|
|
974
974
|
};
|
|
975
|
-
function
|
|
975
|
+
function ot() {
|
|
976
976
|
return { cause: "user", ts: Date.now() };
|
|
977
977
|
}
|
|
978
978
|
function _i(e) {
|
|
979
979
|
return { cause: "agent", toolCallId: e, ts: Date.now() };
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function Ze(e) {
|
|
982
982
|
return { cause: "remote", toolCallId: e, ts: Date.now() };
|
|
983
983
|
}
|
|
984
984
|
function Vt(e, t) {
|
|
985
|
-
const n =
|
|
986
|
-
n.current = t,
|
|
985
|
+
const n = A(t);
|
|
986
|
+
n.current = t, L(() => q.on(e, (r) => n.current(r)), [e]);
|
|
987
987
|
}
|
|
988
988
|
function Oi(e) {
|
|
989
989
|
q.emit(ve.agentData, { ts: Date.now(), part: e });
|
|
990
990
|
}
|
|
991
991
|
const q = Ni(), Mi = "boring-workspace:ui-command";
|
|
992
992
|
function or(e) {
|
|
993
|
-
q.emit(ve.uiCommand, { ...
|
|
993
|
+
q.emit(ve.uiCommand, { ...ot(), command: e }), typeof globalThis.dispatchEvent == "function" && typeof CustomEvent < "u" && globalThis.dispatchEvent(new CustomEvent(Mi, { detail: e }));
|
|
994
994
|
}
|
|
995
995
|
const Wi = 1500, zi = 1e3, ji = 5;
|
|
996
996
|
function vn(e, t) {
|
|
@@ -1003,62 +1003,62 @@ function vn(e, t) {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
function Bi(e) {
|
|
1005
1005
|
const t = e.endpoint ?? "", n = e.ctx, r = e.query, o = e.eventSourceCtor === null ? null : e.eventSourceCtor ?? (typeof EventSource < "u" ? EventSource : null), i = e.fetcher ?? (typeof fetch < "u" ? fetch : null), a = e.reconnectDelayMs ?? zi, l = e.maxReconnects ?? ji, c = e.pollIntervalMs ?? Wi;
|
|
1006
|
-
let
|
|
1007
|
-
function
|
|
1008
|
-
|
|
1006
|
+
let f = !1, s = null, d = null, p = null, m = null, g = 0, y = !1;
|
|
1007
|
+
function x(D) {
|
|
1008
|
+
D && typeof D == "object" && typeof D.kind == "string" && qt(D, n);
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1011
|
-
if (
|
|
1012
|
-
|
|
1013
|
-
const
|
|
1014
|
-
if (!
|
|
1010
|
+
function k() {
|
|
1011
|
+
if (f || y || !i) return;
|
|
1012
|
+
y = !0;
|
|
1013
|
+
const D = async () => {
|
|
1014
|
+
if (!f) {
|
|
1015
1015
|
p = new AbortController();
|
|
1016
1016
|
try {
|
|
1017
|
-
const
|
|
1017
|
+
const h = await i(vn(`${t}/api/v1/ui/commands/next?poll=true`, r), {
|
|
1018
1018
|
signal: p.signal
|
|
1019
1019
|
});
|
|
1020
|
-
if (
|
|
1021
|
-
if (
|
|
1022
|
-
const
|
|
1023
|
-
if (Array.isArray(
|
|
1020
|
+
if (f) return;
|
|
1021
|
+
if (h.ok) {
|
|
1022
|
+
const M = await h.json();
|
|
1023
|
+
if (Array.isArray(M)) for (const v of M) x(v);
|
|
1024
1024
|
}
|
|
1025
1025
|
} catch {
|
|
1026
1026
|
} finally {
|
|
1027
1027
|
p = null;
|
|
1028
1028
|
}
|
|
1029
|
-
|
|
1029
|
+
f || (d = setTimeout(D, c));
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
|
-
|
|
1032
|
+
D();
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1035
|
-
if (!
|
|
1034
|
+
function $() {
|
|
1035
|
+
if (!f) {
|
|
1036
1036
|
if (!o) {
|
|
1037
|
-
|
|
1037
|
+
k();
|
|
1038
1038
|
return;
|
|
1039
1039
|
}
|
|
1040
|
-
s = new o(vn(`${t}/api/v1/ui/commands/next`, r)), s.addEventListener("command", (
|
|
1041
|
-
const
|
|
1042
|
-
if (!(typeof
|
|
1040
|
+
s = new o(vn(`${t}/api/v1/ui/commands/next`, r)), s.addEventListener("command", (D) => {
|
|
1041
|
+
const h = D.data;
|
|
1042
|
+
if (!(typeof h != "string" || h.length === 0))
|
|
1043
1043
|
try {
|
|
1044
|
-
|
|
1044
|
+
x(JSON.parse(h));
|
|
1045
1045
|
} catch {
|
|
1046
1046
|
}
|
|
1047
1047
|
}), s.addEventListener("init", () => {
|
|
1048
1048
|
g = 0;
|
|
1049
1049
|
}), s.addEventListener("error", () => {
|
|
1050
|
-
if (!
|
|
1050
|
+
if (!f) {
|
|
1051
1051
|
if (s == null || s.close(), s = null, g += 1, g > l) {
|
|
1052
|
-
|
|
1052
|
+
k();
|
|
1053
1053
|
return;
|
|
1054
1054
|
}
|
|
1055
|
-
|
|
1055
|
+
m = setTimeout($, a * g);
|
|
1056
1056
|
}
|
|
1057
1057
|
});
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
|
-
return
|
|
1061
|
-
|
|
1060
|
+
return $(), () => {
|
|
1061
|
+
f = !0, s && (s.close(), s = null), d && (clearTimeout(d), d = null), p && (p.abort(), p = null), m && (clearTimeout(m), m = null);
|
|
1062
1062
|
};
|
|
1063
1063
|
}
|
|
1064
1064
|
const Ui = 1e4, qi = 3, Vi = 1e3;
|
|
@@ -1084,43 +1084,43 @@ class Hi {
|
|
|
1084
1084
|
this.headers = n, this.onAuthError = t.onAuthError, this.onTimeout = t.onTimeout, this.timeout = t.timeout ?? Ui, this.maxRetries = t.maxRetries ?? qi, this.retryBaseMs = t.retryBaseMs ?? Vi;
|
|
1085
1085
|
}
|
|
1086
1086
|
async request(t, n, r, o, i) {
|
|
1087
|
-
var c,
|
|
1087
|
+
var c, f;
|
|
1088
1088
|
const a = o ?? this.timeout;
|
|
1089
1089
|
let l = null;
|
|
1090
1090
|
for (let s = 0; s <= this.maxRetries; s++) {
|
|
1091
1091
|
s > 0 && await Ki(this.retryBaseMs * 2 ** (s - 1));
|
|
1092
|
-
const
|
|
1092
|
+
const d = new AbortController(), p = () => d.abort();
|
|
1093
1093
|
i == null || i.addEventListener("abort", p, { once: !0 });
|
|
1094
|
-
const
|
|
1094
|
+
const m = setTimeout(() => d.abort(), a);
|
|
1095
1095
|
try {
|
|
1096
|
-
const g = r != null,
|
|
1096
|
+
const g = r != null, y = await fetch(`${this.baseUrl}${n}`, {
|
|
1097
1097
|
method: t,
|
|
1098
1098
|
headers: g ? { ...this.headers, "Content-Type": "application/json" } : this.headers,
|
|
1099
1099
|
body: g ? JSON.stringify(r) : void 0,
|
|
1100
|
-
signal:
|
|
1100
|
+
signal: d.signal
|
|
1101
1101
|
});
|
|
1102
|
-
if (clearTimeout(
|
|
1103
|
-
throw (c = this.onAuthError) == null || c.call(this,
|
|
1104
|
-
if (yn(
|
|
1105
|
-
l = new je(
|
|
1102
|
+
if (clearTimeout(m), i == null || i.removeEventListener("abort", p), y.status === 401 || y.status === 403)
|
|
1103
|
+
throw (c = this.onAuthError) == null || c.call(this, y.status), new je(y.status, `Auth error: ${y.status}`);
|
|
1104
|
+
if (yn(y.status)) {
|
|
1105
|
+
l = new je(y.status, `HTTP ${y.status}: ${y.statusText}`);
|
|
1106
1106
|
continue;
|
|
1107
1107
|
}
|
|
1108
|
-
if (!
|
|
1109
|
-
const
|
|
1108
|
+
if (!y.ok) {
|
|
1109
|
+
const x = await Gi(y);
|
|
1110
1110
|
throw new je(
|
|
1111
|
-
|
|
1112
|
-
`HTTP ${
|
|
1113
|
-
|
|
1111
|
+
y.status,
|
|
1112
|
+
`HTTP ${y.status}: ${y.statusText}`,
|
|
1113
|
+
x
|
|
1114
1114
|
);
|
|
1115
1115
|
}
|
|
1116
|
-
return await
|
|
1116
|
+
return await y.json();
|
|
1117
1117
|
} catch (g) {
|
|
1118
|
-
if (clearTimeout(
|
|
1118
|
+
if (clearTimeout(m), i == null || i.removeEventListener("abort", p), g instanceof je && !yn(g.status))
|
|
1119
1119
|
throw g;
|
|
1120
1120
|
if (g instanceof DOMException && g.name === "AbortError") {
|
|
1121
1121
|
if (i != null && i.aborted)
|
|
1122
1122
|
throw g;
|
|
1123
|
-
(
|
|
1123
|
+
(f = this.onTimeout) == null || f.call(this, n), l = new je(0, `Request timeout after ${a}ms: ${n}`);
|
|
1124
1124
|
continue;
|
|
1125
1125
|
}
|
|
1126
1126
|
if (g instanceof TypeError) {
|
|
@@ -1234,7 +1234,7 @@ const Ji = "filesystem:file.changed", Yi = "filesystem:file.created", Xi = "file
|
|
|
1234
1234
|
}, wt = "filesystem", Kt = "files", bt = Kt, nn = "files", Zi = "filesystem-path", Ht = "code-editor", ir = "csv-viewer", sr = "markdown-editor", ar = "image-viewer", cr = "pdf-viewer", lr = "html-viewer", es = "empty-file-panel";
|
|
1235
1235
|
function ts() {
|
|
1236
1236
|
const e = Qn(), t = Ye(), n = Xe();
|
|
1237
|
-
|
|
1237
|
+
L(() => {
|
|
1238
1238
|
const r = q.on(Q.changed, (l) => {
|
|
1239
1239
|
it(e, t, n, l.path);
|
|
1240
1240
|
}), o = q.on(Q.created, (l) => {
|
|
@@ -1260,7 +1260,7 @@ function wn(e, t, n) {
|
|
|
1260
1260
|
}
|
|
1261
1261
|
function ns() {
|
|
1262
1262
|
const e = Ye(), t = Xe(), n = Qn();
|
|
1263
|
-
|
|
1263
|
+
L(() => {
|
|
1264
1264
|
if (typeof window > "u" || typeof EventSource > "u") return;
|
|
1265
1265
|
const r = ss(is(e, "/api/v1/fs/events"), t);
|
|
1266
1266
|
let o, i = !1;
|
|
@@ -1270,44 +1270,44 @@ function ns() {
|
|
|
1270
1270
|
} catch {
|
|
1271
1271
|
return;
|
|
1272
1272
|
}
|
|
1273
|
-
const
|
|
1274
|
-
if (a.has(
|
|
1275
|
-
if (a.add(
|
|
1273
|
+
const f = (m) => {
|
|
1274
|
+
if (a.has(m)) return !1;
|
|
1275
|
+
if (a.add(m), l.push(m), l.length > c) {
|
|
1276
1276
|
const g = l.shift();
|
|
1277
1277
|
g !== void 0 && a.delete(g);
|
|
1278
1278
|
}
|
|
1279
1279
|
return !0;
|
|
1280
|
-
}, s = (
|
|
1280
|
+
}, s = (m) => {
|
|
1281
1281
|
let g;
|
|
1282
1282
|
try {
|
|
1283
|
-
g = JSON.parse(
|
|
1283
|
+
g = JSON.parse(m.data);
|
|
1284
1284
|
} catch {
|
|
1285
1285
|
return;
|
|
1286
1286
|
}
|
|
1287
|
-
typeof (g == null ? void 0 : g.eventId) != "string" || typeof g.change != "object" || g.change == null ||
|
|
1288
|
-
},
|
|
1287
|
+
typeof (g == null ? void 0 : g.eventId) != "string" || typeof g.change != "object" || g.change == null || f(g.eventId) && rs(g.change);
|
|
1288
|
+
}, d = () => {
|
|
1289
1289
|
i = !0, o == null || o.close();
|
|
1290
1290
|
}, p = () => {
|
|
1291
|
-
a.clear(), l.length = 0, n.invalidateQueries({ predicate: (
|
|
1291
|
+
a.clear(), l.length = 0, n.invalidateQueries({ predicate: (m) => os(m.queryKey) });
|
|
1292
1292
|
};
|
|
1293
|
-
return o.addEventListener("change", s), o.addEventListener("unsupported",
|
|
1294
|
-
o && (o.removeEventListener("change", s), o.removeEventListener("unsupported",
|
|
1293
|
+
return o.addEventListener("change", s), o.addEventListener("unsupported", d), o.addEventListener("resync-required", p), () => {
|
|
1294
|
+
o && (o.removeEventListener("change", s), o.removeEventListener("unsupported", d), o.removeEventListener("resync-required", p), i || o.close(), o = null);
|
|
1295
1295
|
};
|
|
1296
1296
|
}, [e, t, n]);
|
|
1297
1297
|
}
|
|
1298
1298
|
function rs(e) {
|
|
1299
1299
|
switch (e.op) {
|
|
1300
1300
|
case "write":
|
|
1301
|
-
q.emit(Q.changed, { ...
|
|
1301
|
+
q.emit(Q.created, { ...Ze(), path: e.path, kind: "file" }), q.emit(Q.changed, { ...Ze(), path: e.path });
|
|
1302
1302
|
return;
|
|
1303
1303
|
case "mkdir":
|
|
1304
|
-
q.emit(Q.created, { ...
|
|
1304
|
+
q.emit(Q.created, { ...Ze(), path: e.path, kind: "dir" });
|
|
1305
1305
|
return;
|
|
1306
1306
|
case "unlink":
|
|
1307
|
-
q.emit(Q.deleted, { ...
|
|
1307
|
+
q.emit(Q.deleted, { ...Ze(), path: e.path });
|
|
1308
1308
|
return;
|
|
1309
1309
|
case "rename":
|
|
1310
|
-
e.oldPath ? q.emit(Q.moved, { ...
|
|
1310
|
+
e.oldPath ? q.emit(Q.moved, { ...Ze(), from: e.oldPath, to: e.path }) : q.emit(Q.created, { ...Ze(), path: e.path, kind: "file" });
|
|
1311
1311
|
return;
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
@@ -1348,12 +1348,12 @@ function as({
|
|
|
1348
1348
|
client: o,
|
|
1349
1349
|
children: i
|
|
1350
1350
|
}) {
|
|
1351
|
-
const a =
|
|
1351
|
+
const a = A(null);
|
|
1352
1352
|
a.current || (a.current = new Bo({
|
|
1353
1353
|
defaultOptions: {
|
|
1354
1354
|
queries: {
|
|
1355
1355
|
retry: 3,
|
|
1356
|
-
retryDelay: (
|
|
1356
|
+
retryDelay: (f) => Math.min(1e3 * 2 ** f, 3e4)
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
1359
|
}));
|
|
@@ -1361,7 +1361,7 @@ function as({
|
|
|
1361
1361
|
() => o ?? new Hi({ apiBaseUrl: e, authHeaders: t, onAuthError: n, timeout: r }),
|
|
1362
1362
|
[o, e, t, n, r]
|
|
1363
1363
|
), c = (t == null ? void 0 : t["x-boring-workspace-id"]) ?? (t == null ? void 0 : t["X-Boring-Workspace-Id"]) ?? null;
|
|
1364
|
-
return /* @__PURE__ */ u(Uo, { client: a.current, children: /* @__PURE__ */ u(ur.Provider, { value: e, children: /* @__PURE__ */ u(dr.Provider, { value: c, children: /* @__PURE__ */
|
|
1364
|
+
return /* @__PURE__ */ u(Uo, { client: a.current, children: /* @__PURE__ */ u(ur.Provider, { value: e, children: /* @__PURE__ */ u(dr.Provider, { value: c, children: /* @__PURE__ */ C(rn.Provider, { value: l, children: [
|
|
1365
1365
|
/* @__PURE__ */ u(cs, {}),
|
|
1366
1366
|
i
|
|
1367
1367
|
] }) }) }) });
|
|
@@ -1413,8 +1413,8 @@ function mr(e) {
|
|
|
1413
1413
|
});
|
|
1414
1414
|
}
|
|
1415
1415
|
function ps(e, t) {
|
|
1416
|
-
const n = Me(), r = Ye(), o = Xe(), [i, a] =
|
|
1417
|
-
return
|
|
1416
|
+
const n = Me(), r = Ye(), o = Xe(), [i, a] = O(e), l = A(void 0);
|
|
1417
|
+
return L(() => (clearTimeout(l.current), l.current = setTimeout(() => a(e), 300), () => clearTimeout(l.current)), [e]), Qt({
|
|
1418
1418
|
queryKey: [r, o, "search", i, t],
|
|
1419
1419
|
queryFn: ({ signal: c }) => n.search(i, t, c),
|
|
1420
1420
|
enabled: i.length > 0,
|
|
@@ -1426,7 +1426,7 @@ function hr() {
|
|
|
1426
1426
|
return Tt({
|
|
1427
1427
|
mutationFn: ({ path: t, content: n, expectedMtimeMs: r }) => e.writeFile(t, n, r != null ? { expectedMtimeMs: r } : void 0),
|
|
1428
1428
|
onSuccess: (t, { path: n }) => {
|
|
1429
|
-
q.emit(Q.changed, { ...
|
|
1429
|
+
q.emit(Q.changed, { ...ot(), path: n });
|
|
1430
1430
|
}
|
|
1431
1431
|
});
|
|
1432
1432
|
}
|
|
@@ -1435,7 +1435,7 @@ function ms() {
|
|
|
1435
1435
|
return Tt({
|
|
1436
1436
|
mutationFn: ({ path: t }) => e.createDir(t),
|
|
1437
1437
|
onSuccess: (t, { path: n }) => {
|
|
1438
|
-
q.emit(Q.created, { ...
|
|
1438
|
+
q.emit(Q.created, { ...ot(), path: n, kind: "dir" });
|
|
1439
1439
|
}
|
|
1440
1440
|
});
|
|
1441
1441
|
}
|
|
@@ -1444,7 +1444,7 @@ function hs() {
|
|
|
1444
1444
|
return Tt({
|
|
1445
1445
|
mutationFn: ({ from: t, to: n }) => e.moveFile(t, n),
|
|
1446
1446
|
onSuccess: (t, { from: n, to: r }) => {
|
|
1447
|
-
q.emit(Q.moved, { ...
|
|
1447
|
+
q.emit(Q.moved, { ...ot(), from: n, to: r });
|
|
1448
1448
|
}
|
|
1449
1449
|
});
|
|
1450
1450
|
}
|
|
@@ -1453,7 +1453,7 @@ function gs() {
|
|
|
1453
1453
|
return Tt({
|
|
1454
1454
|
mutationFn: ({ path: t }) => e.deleteFile(t),
|
|
1455
1455
|
onSuccess: (t, { path: n }) => {
|
|
1456
|
-
q.emit(Q.deleted, { ...
|
|
1456
|
+
q.emit(Q.deleted, { ...ot(), path: n });
|
|
1457
1457
|
}
|
|
1458
1458
|
});
|
|
1459
1459
|
}
|
|
@@ -1466,7 +1466,7 @@ function ws(e) {
|
|
|
1466
1466
|
return { "content-type": "application/json", ...e ?? {} };
|
|
1467
1467
|
}
|
|
1468
1468
|
function bs(e) {
|
|
1469
|
-
const t =
|
|
1469
|
+
const t = P((n) => {
|
|
1470
1470
|
if (!n.panelInstanceId) return;
|
|
1471
1471
|
const r = n;
|
|
1472
1472
|
fetch(ys(e.apiBaseUrl, "/api/v1/ui/panels/status"), {
|
|
@@ -1478,13 +1478,13 @@ function bs(e) {
|
|
|
1478
1478
|
}, [e.apiBaseUrl, e.authHeaders]);
|
|
1479
1479
|
return de(gr.Provider, { value: { report: t } }, e.children);
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1482
|
-
return
|
|
1481
|
+
function xs(e) {
|
|
1482
|
+
return L(() => {
|
|
1483
1483
|
e.onReady();
|
|
1484
1484
|
}, [e.onReady]), de(Kn, null, e.children);
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1487
|
-
return
|
|
1486
|
+
function Ss(e) {
|
|
1487
|
+
return L(() => {
|
|
1488
1488
|
e.onLoading();
|
|
1489
1489
|
}, [e.onLoading]), de(
|
|
1490
1490
|
"div",
|
|
@@ -1496,7 +1496,7 @@ function xs(e) {
|
|
|
1496
1496
|
);
|
|
1497
1497
|
}
|
|
1498
1498
|
function ks(e) {
|
|
1499
|
-
const t = se(gr), n = e.panelInstanceId, r =
|
|
1499
|
+
const t = se(gr), n = e.panelInstanceId, r = P((i, a) => {
|
|
1500
1500
|
n != null && n.startsWith("self-test:") && t.report({
|
|
1501
1501
|
pluginId: e.pluginId,
|
|
1502
1502
|
panelId: e.panelId,
|
|
@@ -1506,8 +1506,8 @@ function ks(e) {
|
|
|
1506
1506
|
...a ? { error: a } : {}
|
|
1507
1507
|
});
|
|
1508
1508
|
}, [n, e.panelId, e.pluginId, e.revision, t]);
|
|
1509
|
-
|
|
1510
|
-
const o =
|
|
1509
|
+
L(() => () => r("missing"), [r]);
|
|
1510
|
+
const o = P((i) => {
|
|
1511
1511
|
r("error", { code: "PLUGIN_PANEL_RENDER_ERROR", message: i.message });
|
|
1512
1512
|
}, [r]);
|
|
1513
1513
|
return de(
|
|
@@ -1529,8 +1529,8 @@ function ks(e) {
|
|
|
1529
1529
|
children: de(
|
|
1530
1530
|
Et,
|
|
1531
1531
|
{
|
|
1532
|
-
fallback: de(
|
|
1533
|
-
children: de(
|
|
1532
|
+
fallback: de(Ss, { onLoading: () => r("loading") }),
|
|
1533
|
+
children: de(xs, { onReady: () => r("ready"), children: e.children })
|
|
1534
1534
|
}
|
|
1535
1535
|
)
|
|
1536
1536
|
}
|
|
@@ -1633,15 +1633,15 @@ class Ps {
|
|
|
1633
1633
|
const n = this.wrapperComponentCache.get(t);
|
|
1634
1634
|
if (n) return n;
|
|
1635
1635
|
const r = this, o = function(a) {
|
|
1636
|
-
var
|
|
1637
|
-
|
|
1638
|
-
const l = r.get(t), c = r.generation,
|
|
1639
|
-
if (!
|
|
1640
|
-
const
|
|
1636
|
+
var m;
|
|
1637
|
+
rt(r.subscribe, r.getSnapshot, r.getSnapshot);
|
|
1638
|
+
const l = r.get(t), c = r.generation, f = !!(l && r.satisfiesCapabilities(l)), s = H(() => !l || !r.satisfiesCapabilities(l) ? () => null : l.lazy ? r.getLazyComponent(t, l.component) : l.component, [l == null ? void 0 : l.component, l == null ? void 0 : l.lazy, l == null ? void 0 : l.requiresCapabilities, c]);
|
|
1639
|
+
if (!f) return null;
|
|
1640
|
+
const d = (l == null ? void 0 : l.pluginId) ?? (l == null ? void 0 : l.id) ?? t, p = typeof ((m = a == null ? void 0 : a.api) == null ? void 0 : m.id) == "string" ? a.api.id : void 0;
|
|
1641
1641
|
return de(
|
|
1642
1642
|
ks,
|
|
1643
1643
|
{
|
|
1644
|
-
pluginId:
|
|
1644
|
+
pluginId: d,
|
|
1645
1645
|
panelId: t,
|
|
1646
1646
|
panelInstanceId: p,
|
|
1647
1647
|
revision: l == null ? void 0 : l.pluginRevision,
|
|
@@ -1694,18 +1694,18 @@ const bn = {
|
|
|
1694
1694
|
zsh: re,
|
|
1695
1695
|
json: fn,
|
|
1696
1696
|
jsonl: fn,
|
|
1697
|
-
md:
|
|
1698
|
-
mdx:
|
|
1699
|
-
txt:
|
|
1700
|
-
csv:
|
|
1701
|
-
tsv:
|
|
1702
|
-
yaml:
|
|
1703
|
-
yml:
|
|
1704
|
-
toml:
|
|
1705
|
-
ini:
|
|
1706
|
-
cfg:
|
|
1707
|
-
conf:
|
|
1708
|
-
env:
|
|
1697
|
+
md: Se,
|
|
1698
|
+
mdx: Se,
|
|
1699
|
+
txt: Se,
|
|
1700
|
+
csv: Se,
|
|
1701
|
+
tsv: Se,
|
|
1702
|
+
yaml: Se,
|
|
1703
|
+
yml: Se,
|
|
1704
|
+
toml: Se,
|
|
1705
|
+
ini: Se,
|
|
1706
|
+
cfg: Se,
|
|
1707
|
+
conf: Se,
|
|
1708
|
+
env: Se,
|
|
1709
1709
|
png: ze,
|
|
1710
1710
|
jpg: ze,
|
|
1711
1711
|
jpeg: ze,
|
|
@@ -1865,79 +1865,93 @@ function Ds() {
|
|
|
1865
1865
|
);
|
|
1866
1866
|
}
|
|
1867
1867
|
function Ls(e) {
|
|
1868
|
-
const { api: t } = e, n = e.tabLocation === "headerOverflow", [r, o] =
|
|
1869
|
-
|
|
1870
|
-
var
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1873
|
-
const
|
|
1868
|
+
const { api: t } = e, n = e.tabLocation === "headerOverflow", [r, o] = O(t.title ?? t.id), [i, a] = O(null), l = A(null);
|
|
1869
|
+
L(() => {
|
|
1870
|
+
var N;
|
|
1871
|
+
const v = () => o(t.title ?? t.id);
|
|
1872
|
+
v();
|
|
1873
|
+
const w = (N = t.onDidTitleChange) == null ? void 0 : N.call(t, v);
|
|
1874
1874
|
return () => {
|
|
1875
|
-
var
|
|
1876
|
-
return (
|
|
1875
|
+
var T;
|
|
1876
|
+
return (T = w == null ? void 0 : w.dispose) == null ? void 0 : T.call(w);
|
|
1877
1877
|
};
|
|
1878
|
-
}, [t]),
|
|
1878
|
+
}, [t]), L(() => {
|
|
1879
1879
|
if (!i) return;
|
|
1880
|
-
function
|
|
1881
|
-
l.current && !l.current.contains(
|
|
1880
|
+
function v(w) {
|
|
1881
|
+
l.current && !l.current.contains(w.target) && a(null);
|
|
1882
1882
|
}
|
|
1883
|
-
return document.addEventListener("pointerdown",
|
|
1883
|
+
return document.addEventListener("pointerdown", v), () => document.removeEventListener("pointerdown", v);
|
|
1884
1884
|
}, [i]);
|
|
1885
|
-
const c = r.endsWith(" ●"),
|
|
1886
|
-
Vt(ve.editorSaveStart, (
|
|
1887
|
-
|
|
1888
|
-
}), Vt(ve.editorSaveEnd, (
|
|
1889
|
-
|
|
1885
|
+
const c = r.endsWith(" ●"), f = c ? r.slice(0, -2) : r, s = Cs(f), d = Ts(e.params, "path") ?? As(t.id), p = Ns(e).map(Rs).filter((v) => v.close), m = p.filter((v) => v.id !== t.id), [g, y] = O(!1);
|
|
1886
|
+
Vt(ve.editorSaveStart, (v) => {
|
|
1887
|
+
v.panelId === t.id && y(!0);
|
|
1888
|
+
}), Vt(ve.editorSaveEnd, (v) => {
|
|
1889
|
+
v.panelId === t.id && y(!1);
|
|
1890
1890
|
});
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1893
|
-
},
|
|
1894
|
-
!
|
|
1895
|
-
},
|
|
1896
|
-
a(null), Fs(
|
|
1897
|
-
},
|
|
1898
|
-
var
|
|
1899
|
-
a(null), (
|
|
1900
|
-
for (const
|
|
1901
|
-
},
|
|
1902
|
-
|
|
1891
|
+
const x = (v) => {
|
|
1892
|
+
v.preventDefault(), v.stopPropagation(), n && v.nativeEvent.stopImmediatePropagation(), t.close(), n && Ds();
|
|
1893
|
+
}, k = (v) => {
|
|
1894
|
+
!d && m.length === 0 || (v.preventDefault(), v.stopPropagation(), a({ x: v.clientX, y: v.clientY }));
|
|
1895
|
+
}, $ = (v) => {
|
|
1896
|
+
a(null), Fs(v);
|
|
1897
|
+
}, D = () => {
|
|
1898
|
+
var v, w;
|
|
1899
|
+
a(null), (v = t.setActive) == null || v.call(t);
|
|
1900
|
+
for (const N of m) (w = N.close) == null || w.call(N);
|
|
1901
|
+
}, h = () => {
|
|
1902
|
+
var v, w;
|
|
1903
|
+
a(null), (v = t.setActive) == null || v.call(t);
|
|
1904
|
+
for (const N of p) (w = N.close) == null || w.call(N);
|
|
1905
|
+
}, M = i && typeof document < "u" ? Ko(
|
|
1906
|
+
/* @__PURE__ */ C(
|
|
1903
1907
|
"div",
|
|
1904
1908
|
{
|
|
1905
1909
|
ref: l,
|
|
1906
1910
|
role: "menu",
|
|
1907
1911
|
className: "fixed z-[1000] min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1908
1912
|
style: { left: i.x, top: i.y },
|
|
1909
|
-
onPointerDown: (
|
|
1910
|
-
onContextMenu: (
|
|
1911
|
-
|
|
1913
|
+
onPointerDown: (v) => v.stopPropagation(),
|
|
1914
|
+
onContextMenu: (v) => {
|
|
1915
|
+
v.preventDefault(), v.stopPropagation();
|
|
1912
1916
|
},
|
|
1913
1917
|
children: [
|
|
1914
|
-
|
|
1918
|
+
d ? /* @__PURE__ */ u(
|
|
1915
1919
|
"button",
|
|
1916
1920
|
{
|
|
1917
1921
|
type: "button",
|
|
1918
1922
|
role: "menuitem",
|
|
1919
1923
|
className: "flex w-full items-center rounded-sm px-2 py-1.5 text-left text-xs hover:bg-accent hover:text-accent-foreground",
|
|
1920
|
-
onClick: () =>
|
|
1924
|
+
onClick: () => $(d),
|
|
1921
1925
|
children: "Copy path"
|
|
1922
1926
|
}
|
|
1923
1927
|
) : null,
|
|
1924
|
-
|
|
1928
|
+
m.length > 0 ? /* @__PURE__ */ u(
|
|
1925
1929
|
"button",
|
|
1926
1930
|
{
|
|
1927
1931
|
type: "button",
|
|
1928
1932
|
role: "menuitem",
|
|
1929
1933
|
className: "flex w-full items-center rounded-sm px-2 py-1.5 text-left text-xs hover:bg-accent hover:text-accent-foreground",
|
|
1930
|
-
onClick:
|
|
1934
|
+
onClick: D,
|
|
1931
1935
|
children: "Close other tabs"
|
|
1932
1936
|
}
|
|
1937
|
+
) : null,
|
|
1938
|
+
p.length > 0 ? /* @__PURE__ */ u(
|
|
1939
|
+
"button",
|
|
1940
|
+
{
|
|
1941
|
+
type: "button",
|
|
1942
|
+
role: "menuitem",
|
|
1943
|
+
className: "flex w-full items-center rounded-sm px-2 py-1.5 text-left text-xs hover:bg-accent hover:text-accent-foreground",
|
|
1944
|
+
onClick: h,
|
|
1945
|
+
children: "Close all"
|
|
1946
|
+
}
|
|
1933
1947
|
) : null
|
|
1934
1948
|
]
|
|
1935
1949
|
}
|
|
1936
1950
|
),
|
|
1937
1951
|
document.body
|
|
1938
1952
|
) : null;
|
|
1939
|
-
return /* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
1953
|
+
return /* @__PURE__ */ C(Kn, { children: [
|
|
1954
|
+
/* @__PURE__ */ C(
|
|
1941
1955
|
"div",
|
|
1942
1956
|
{
|
|
1943
1957
|
className: oe(
|
|
@@ -1945,13 +1959,13 @@ function Ls(e) {
|
|
|
1945
1959
|
"text-[12.5px] leading-none tracking-tight",
|
|
1946
1960
|
"cursor-pointer transition-colors"
|
|
1947
1961
|
),
|
|
1948
|
-
title: c ? `${
|
|
1949
|
-
onPointerDown: (
|
|
1950
|
-
|
|
1962
|
+
title: c ? `${f} (unsaved changes)` : f,
|
|
1963
|
+
onPointerDown: (v) => {
|
|
1964
|
+
v.button === 2 && k(v);
|
|
1951
1965
|
},
|
|
1952
|
-
onContextMenu:
|
|
1966
|
+
onContextMenu: k,
|
|
1953
1967
|
children: [
|
|
1954
|
-
|
|
1968
|
+
g ? /* @__PURE__ */ u(
|
|
1955
1969
|
ro,
|
|
1956
1970
|
{
|
|
1957
1971
|
"data-testid": "tab-saving-spinner",
|
|
@@ -1969,8 +1983,8 @@ function Ls(e) {
|
|
|
1969
1983
|
strokeWidth: 1.5
|
|
1970
1984
|
}
|
|
1971
1985
|
),
|
|
1972
|
-
/* @__PURE__ */ u("span", { className: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap", children:
|
|
1973
|
-
/* @__PURE__ */
|
|
1986
|
+
/* @__PURE__ */ u("span", { className: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap", children: f }),
|
|
1987
|
+
/* @__PURE__ */ C("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
1974
1988
|
c ? /* @__PURE__ */ u(
|
|
1975
1989
|
"span",
|
|
1976
1990
|
{
|
|
@@ -1996,9 +2010,9 @@ function Ls(e) {
|
|
|
1996
2010
|
...n ? (
|
|
1997
2011
|
// In the overflow popover, intercept on capture so we run before
|
|
1998
2012
|
// dockview's native row click listener (see handleClose).
|
|
1999
|
-
{ onClickCapture:
|
|
2000
|
-
) : { onClick:
|
|
2001
|
-
"aria-label": `Close ${
|
|
2013
|
+
{ onClickCapture: x }
|
|
2014
|
+
) : { onClick: x },
|
|
2015
|
+
"aria-label": `Close ${f}`,
|
|
2002
2016
|
children: /* @__PURE__ */ u(Hn, { className: "h-3 w-3", strokeWidth: 2.25 })
|
|
2003
2017
|
}
|
|
2004
2018
|
)
|
|
@@ -2006,7 +2020,7 @@ function Ls(e) {
|
|
|
2006
2020
|
]
|
|
2007
2021
|
}
|
|
2008
2022
|
),
|
|
2009
|
-
|
|
2023
|
+
M
|
|
2010
2024
|
] });
|
|
2011
2025
|
}
|
|
2012
2026
|
const $s = 300, br = ye(null);
|
|
@@ -2019,7 +2033,7 @@ function _s(e, t) {
|
|
|
2019
2033
|
}
|
|
2020
2034
|
return (n == null ? void 0 : n[t.param]) === t.value;
|
|
2021
2035
|
}
|
|
2022
|
-
function
|
|
2036
|
+
function xn(e, t) {
|
|
2023
2037
|
const n = Array.isArray(t) ? t : [t], r = /* @__PURE__ */ new Set(), o = [];
|
|
2024
2038
|
for (const i of e.panels)
|
|
2025
2039
|
n.some((a) => _s(i, a)) && (r.has(i.id) || (r.add(i.id), o.push(i)));
|
|
@@ -2076,17 +2090,17 @@ function Ms(e) {
|
|
|
2076
2090
|
if (!i) return;
|
|
2077
2091
|
const a = i.view.contentComponent, l = i.params, c = i.title;
|
|
2078
2092
|
o.removePanel(i);
|
|
2079
|
-
const
|
|
2093
|
+
const f = { id: n, component: a, params: l, title: c };
|
|
2080
2094
|
if ("groupId" in r) {
|
|
2081
|
-
const s = o.groups.find((
|
|
2095
|
+
const s = o.groups.find((d) => d.id === r.groupId);
|
|
2082
2096
|
o.addPanel({
|
|
2083
|
-
...
|
|
2097
|
+
...f,
|
|
2084
2098
|
position: s ? { referenceGroup: s } : void 0
|
|
2085
2099
|
});
|
|
2086
2100
|
} else {
|
|
2087
2101
|
const s = o.getPanel(r.referencePanelId);
|
|
2088
2102
|
o.addPanel({
|
|
2089
|
-
...
|
|
2103
|
+
...f,
|
|
2090
2104
|
position: s ? { referencePanel: s, direction: r.direction } : void 0
|
|
2091
2105
|
});
|
|
2092
2106
|
}
|
|
@@ -2132,7 +2146,7 @@ function Ws(e) {
|
|
|
2132
2146
|
maximumHeight: e.constraints.maxHeight
|
|
2133
2147
|
};
|
|
2134
2148
|
}
|
|
2135
|
-
function
|
|
2149
|
+
function Sn(e, t) {
|
|
2136
2150
|
const n = e.getPanel(t.panel ?? t.id);
|
|
2137
2151
|
if (!(n != null && n.group)) return;
|
|
2138
2152
|
const r = Ws(t);
|
|
@@ -2144,58 +2158,58 @@ function zs(e, t, n, r, o, i) {
|
|
|
2144
2158
|
a.fromJSON(n);
|
|
2145
2159
|
else {
|
|
2146
2160
|
let s = !1;
|
|
2147
|
-
for (const
|
|
2148
|
-
if (
|
|
2149
|
-
if (!r.has(
|
|
2161
|
+
for (const d of t.groups)
|
|
2162
|
+
if (d.panel) {
|
|
2163
|
+
if (!r.has(d.panel)) {
|
|
2150
2164
|
console.error(
|
|
2151
|
-
`[DockviewShell] Panel "${
|
|
2165
|
+
`[DockviewShell] Panel "${d.panel}" not found in registry. Available: ${r.list().map((p) => p.id).join(", ")}`
|
|
2152
2166
|
);
|
|
2153
2167
|
continue;
|
|
2154
2168
|
}
|
|
2155
2169
|
a.addPanel({
|
|
2156
|
-
id:
|
|
2157
|
-
component:
|
|
2158
|
-
params:
|
|
2159
|
-
position: s ? { direction: Os(
|
|
2170
|
+
id: d.panel,
|
|
2171
|
+
component: d.panel,
|
|
2172
|
+
params: d.params,
|
|
2173
|
+
position: s ? { direction: Os(d.position) } : void 0
|
|
2160
2174
|
}), s = !0;
|
|
2161
2175
|
}
|
|
2162
2176
|
}
|
|
2163
2177
|
for (const s of t.groups) {
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2178
|
+
const d = a.getPanel(s.panel ?? s.id);
|
|
2179
|
+
d != null && d.group && (s.locked && (d.group.locked = "no-drop-target"), s.hideHeader && (d.group.header.hidden = !0), Sn(a, s));
|
|
2166
2180
|
}
|
|
2167
2181
|
const l = t.groups.filter(
|
|
2168
2182
|
(s) => {
|
|
2169
|
-
var
|
|
2170
|
-
return typeof ((
|
|
2183
|
+
var d;
|
|
2184
|
+
return typeof ((d = s.constraints) == null ? void 0 : d.maxWidthViewportRatio) == "number";
|
|
2171
2185
|
}
|
|
2172
2186
|
);
|
|
2173
2187
|
let c;
|
|
2174
2188
|
if (l.length > 0) {
|
|
2175
2189
|
const s = () => {
|
|
2176
|
-
for (const
|
|
2177
|
-
|
|
2190
|
+
for (const d of l)
|
|
2191
|
+
Sn(a, d);
|
|
2178
2192
|
};
|
|
2179
2193
|
window.addEventListener("resize", s), c = () => window.removeEventListener("resize", s);
|
|
2180
2194
|
}
|
|
2181
|
-
let
|
|
2195
|
+
let f;
|
|
2182
2196
|
if (o) {
|
|
2183
2197
|
let s = null;
|
|
2184
|
-
const
|
|
2198
|
+
const d = () => {
|
|
2185
2199
|
s && clearTimeout(s), s = setTimeout(() => {
|
|
2186
2200
|
o(a.toJSON());
|
|
2187
2201
|
}, $s);
|
|
2188
|
-
}, p = a.onDidLayoutChange(
|
|
2202
|
+
}, p = a.onDidLayoutChange(d), m = () => {
|
|
2189
2203
|
s && (clearTimeout(s), o(a.toJSON()));
|
|
2190
2204
|
};
|
|
2191
|
-
window.addEventListener("beforeunload",
|
|
2192
|
-
|
|
2205
|
+
window.addEventListener("beforeunload", m), f = () => {
|
|
2206
|
+
m(), p.dispose(), window.removeEventListener("beforeunload", m), c == null || c();
|
|
2193
2207
|
};
|
|
2194
2208
|
} else
|
|
2195
|
-
|
|
2209
|
+
f = () => {
|
|
2196
2210
|
c == null || c();
|
|
2197
2211
|
};
|
|
2198
|
-
return
|
|
2212
|
+
return f;
|
|
2199
2213
|
}
|
|
2200
2214
|
function js({
|
|
2201
2215
|
layout: e,
|
|
@@ -2208,72 +2222,72 @@ function js({
|
|
|
2208
2222
|
rightHeaderActions: l,
|
|
2209
2223
|
watermarkComponent: c
|
|
2210
2224
|
}) {
|
|
2211
|
-
const
|
|
2212
|
-
const
|
|
2213
|
-
if (
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2216
|
-
return
|
|
2225
|
+
const f = At(), s = rt(f.subscribe, f.getSnapshot, f.getSnapshot), d = Es(), p = A(null), m = A(null), g = A(void 0), y = A(null), x = H(() => {
|
|
2226
|
+
const h = f.getComponents(), M = o ? Object.fromEntries(Object.entries(h).filter(([w]) => o.includes(w))) : h, v = y.current;
|
|
2227
|
+
if (v) {
|
|
2228
|
+
const w = Object.keys(v), N = Object.keys(M);
|
|
2229
|
+
if (w.length === N.length && N.every((T) => v[T] === M[T]))
|
|
2230
|
+
return v;
|
|
2217
2231
|
}
|
|
2218
|
-
return
|
|
2219
|
-
}, [
|
|
2220
|
-
(
|
|
2221
|
-
var
|
|
2222
|
-
(
|
|
2223
|
-
|
|
2232
|
+
return y.current = M, M;
|
|
2233
|
+
}, [f, s, o]), k = H(() => Ms(p), []), $ = P(
|
|
2234
|
+
(h) => {
|
|
2235
|
+
var M;
|
|
2236
|
+
(M = g.current) == null || M.call(g), g.current = zs(
|
|
2237
|
+
h,
|
|
2224
2238
|
e,
|
|
2225
2239
|
t,
|
|
2226
|
-
|
|
2240
|
+
f,
|
|
2227
2241
|
r,
|
|
2228
2242
|
p
|
|
2229
|
-
), n == null || n(
|
|
2243
|
+
), n == null || n(h.api);
|
|
2230
2244
|
},
|
|
2231
|
-
[e, t,
|
|
2245
|
+
[e, t, f, r, n]
|
|
2232
2246
|
);
|
|
2233
|
-
|
|
2234
|
-
var
|
|
2235
|
-
return (
|
|
2236
|
-
}, []),
|
|
2237
|
-
const
|
|
2238
|
-
const
|
|
2239
|
-
if (
|
|
2240
|
-
for (const
|
|
2241
|
-
|
|
2242
|
-
...
|
|
2243
|
-
...
|
|
2244
|
-
}),
|
|
2245
|
-
}),
|
|
2246
|
-
const
|
|
2247
|
-
if (
|
|
2248
|
-
for (const
|
|
2249
|
-
|
|
2247
|
+
L(() => () => {
|
|
2248
|
+
var h;
|
|
2249
|
+
return (h = g.current) == null ? void 0 : h.call(g);
|
|
2250
|
+
}, []), L(() => {
|
|
2251
|
+
const h = q.on(ve.panelUpdate, ({ match: v, params: w, title: N }) => {
|
|
2252
|
+
const T = p.current;
|
|
2253
|
+
if (T)
|
|
2254
|
+
for (const _ of xn(T, v))
|
|
2255
|
+
w && _.api.updateParameters({
|
|
2256
|
+
..._.params ?? {},
|
|
2257
|
+
...w
|
|
2258
|
+
}), N && _.api.setTitle(N);
|
|
2259
|
+
}), M = q.on(ve.panelClose, ({ match: v }) => {
|
|
2260
|
+
const w = p.current;
|
|
2261
|
+
if (w)
|
|
2262
|
+
for (const N of xn(w, v))
|
|
2263
|
+
w.removePanel(N);
|
|
2250
2264
|
});
|
|
2251
2265
|
return () => {
|
|
2252
|
-
|
|
2266
|
+
h(), M();
|
|
2253
2267
|
};
|
|
2254
2268
|
}, []);
|
|
2255
|
-
const
|
|
2256
|
-
(
|
|
2257
|
-
if (!
|
|
2258
|
-
|
|
2269
|
+
const D = P(
|
|
2270
|
+
(h) => {
|
|
2271
|
+
if (!d) {
|
|
2272
|
+
m.current = h;
|
|
2259
2273
|
return;
|
|
2260
2274
|
}
|
|
2261
|
-
|
|
2275
|
+
$(h);
|
|
2262
2276
|
},
|
|
2263
|
-
[
|
|
2277
|
+
[d, $]
|
|
2264
2278
|
);
|
|
2265
|
-
return
|
|
2266
|
-
|
|
2267
|
-
}, [
|
|
2279
|
+
return L(() => {
|
|
2280
|
+
d && m.current && ($(m.current), m.current = null);
|
|
2281
|
+
}, [d, $]), d ? /* @__PURE__ */ u(br.Provider, { value: k, children: /* @__PURE__ */ u(
|
|
2268
2282
|
qo,
|
|
2269
2283
|
{
|
|
2270
2284
|
className: `dv-shell ${i ?? ""}`,
|
|
2271
|
-
components:
|
|
2285
|
+
components: x,
|
|
2272
2286
|
defaultTabComponent: Ls,
|
|
2273
2287
|
prefixHeaderActionsComponent: a,
|
|
2274
2288
|
rightHeaderActionsComponent: l,
|
|
2275
2289
|
watermarkComponent: c,
|
|
2276
|
-
onReady:
|
|
2290
|
+
onReady: D
|
|
2277
2291
|
}
|
|
2278
2292
|
) }) : /* @__PURE__ */ u(Bs, {});
|
|
2279
2293
|
}
|
|
@@ -2313,8 +2327,8 @@ function qs({
|
|
|
2313
2327
|
return H(
|
|
2314
2328
|
() => i ? Us(i) : null,
|
|
2315
2329
|
[i]
|
|
2316
|
-
), /* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
2330
|
+
), /* @__PURE__ */ C("div", { className: oe("flex h-full flex-col overflow-hidden", o), children: [
|
|
2331
|
+
/* @__PURE__ */ C("div", { className: "flex h-9 shrink-0 items-center gap-2 border-b border-border bg-muted/50 px-3", children: [
|
|
2318
2332
|
t && /* @__PURE__ */ u(t, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2319
2333
|
/* @__PURE__ */ u("span", { className: "truncate text-sm font-medium", children: e }),
|
|
2320
2334
|
/* @__PURE__ */ u("div", { className: "flex-1" }),
|
|
@@ -2364,7 +2378,7 @@ function Jt(e, t) {
|
|
|
2364
2378
|
function Ks(e, t) {
|
|
2365
2379
|
return t.length === 0 ? e : e == null ? void 0 : e.filter((n) => !Jt(n.name, t));
|
|
2366
2380
|
}
|
|
2367
|
-
function
|
|
2381
|
+
function xr(e) {
|
|
2368
2382
|
const t = e.trim();
|
|
2369
2383
|
if (!t) return t;
|
|
2370
2384
|
const n = /[*?\[\]{}]/.test(t) ? t : `*${t}*`;
|
|
@@ -2418,11 +2432,11 @@ async function Gs(e) {
|
|
|
2418
2432
|
}
|
|
2419
2433
|
if (!n) throw new Error("Clipboard not available");
|
|
2420
2434
|
}
|
|
2421
|
-
const
|
|
2435
|
+
const Sr = () => import("./FileTree-DWbh0xNI.js").then((e) => ({ default: e.FileTree }));
|
|
2422
2436
|
function Js() {
|
|
2423
|
-
|
|
2437
|
+
Sr();
|
|
2424
2438
|
}
|
|
2425
|
-
const Ys = ut(
|
|
2439
|
+
const Ys = ut(Sr);
|
|
2426
2440
|
function kr(e) {
|
|
2427
2441
|
return e.trim().replace(/\\/g, "/").replace(/^\.\/+/, "").replace(/^\/+/, "").replace(/\/+/g, "/").replace(/\/+$/, "") || ".";
|
|
2428
2442
|
}
|
|
@@ -2441,67 +2455,67 @@ function Pn({
|
|
|
2441
2455
|
className: i
|
|
2442
2456
|
}) {
|
|
2443
2457
|
var dn;
|
|
2444
|
-
const a = Me(), { data: l, error: c, isLoading:
|
|
2458
|
+
const a = Me(), { data: l, error: c, isLoading: f } = mr(e), [s, d] = O(/* @__PURE__ */ new Map()), p = Ot(e), m = H(
|
|
2445
2459
|
() => Mt(l, s.get(p)),
|
|
2446
2460
|
[l, s, p]
|
|
2447
2461
|
), g = H(
|
|
2448
|
-
() => Ks(
|
|
2449
|
-
[
|
|
2450
|
-
), { mutateAsync:
|
|
2451
|
-
if (s.size === 0) return
|
|
2452
|
-
const
|
|
2453
|
-
for (const [R,
|
|
2462
|
+
() => Ks(m, o),
|
|
2463
|
+
[m, o]
|
|
2464
|
+
), { mutateAsync: y } = hr(), { mutateAsync: x } = ms(), { mutateAsync: k } = hs(), { mutateAsync: $ } = gs(), [D, h] = O(/* @__PURE__ */ new Map()), M = H(() => {
|
|
2465
|
+
if (s.size === 0) return D;
|
|
2466
|
+
const S = new Map(D);
|
|
2467
|
+
for (const [R, F] of s) {
|
|
2454
2468
|
if (R === p) continue;
|
|
2455
|
-
const U = Mt(
|
|
2456
|
-
U &&
|
|
2469
|
+
const U = Mt(S.get(R), F);
|
|
2470
|
+
U && S.set(R, U);
|
|
2457
2471
|
}
|
|
2458
|
-
return
|
|
2459
|
-
}, [
|
|
2472
|
+
return S;
|
|
2473
|
+
}, [D, s, p]), v = A(null), [w, N] = O(400), [T, _] = O(null), [W, te] = O(null), le = A(null), [B, ie] = O(
|
|
2460
2474
|
((dn = n == null ? void 0 : n.getActiveFile) == null ? void 0 : dn.call(n)) ?? null
|
|
2461
|
-
), [z, J] =
|
|
2462
|
-
ke ?
|
|
2475
|
+
), [z, J] = O(null), [G, ue] = O(null), Ie = A(0), me = A(0), he = A(0), ke = ((t == null ? void 0 : t.trim().length) ?? 0) > 0, { data: Ue } = ps(
|
|
2476
|
+
ke ? xr(t ?? "") : "",
|
|
2463
2477
|
50
|
|
2464
2478
|
);
|
|
2465
|
-
|
|
2466
|
-
if (!
|
|
2467
|
-
function
|
|
2468
|
-
le.current && !le.current.contains(R.target) &&
|
|
2479
|
+
L(() => {
|
|
2480
|
+
if (!T) return;
|
|
2481
|
+
function S(R) {
|
|
2482
|
+
le.current && !le.current.contains(R.target) && _(null);
|
|
2469
2483
|
}
|
|
2470
|
-
return document.addEventListener("pointerdown",
|
|
2471
|
-
}, [
|
|
2472
|
-
const
|
|
2473
|
-
if (!
|
|
2474
|
-
const R = new ResizeObserver(([
|
|
2475
|
-
|
|
2484
|
+
return document.addEventListener("pointerdown", S), () => document.removeEventListener("pointerdown", S);
|
|
2485
|
+
}, [T]), L(() => {
|
|
2486
|
+
const S = v.current;
|
|
2487
|
+
if (!S) return;
|
|
2488
|
+
const R = new ResizeObserver(([F]) => {
|
|
2489
|
+
F && N(Math.floor(F.contentRect.height));
|
|
2476
2490
|
});
|
|
2477
|
-
return R.observe(
|
|
2491
|
+
return R.observe(S), () => R.disconnect();
|
|
2478
2492
|
}, []);
|
|
2479
|
-
const Qe = (ke && Ue ? Ue.map((
|
|
2480
|
-
name:
|
|
2493
|
+
const Qe = (ke && Ue ? Ue.map((S) => ({
|
|
2494
|
+
name: S.split("/").pop() ?? S,
|
|
2481
2495
|
kind: "file",
|
|
2482
|
-
path:
|
|
2483
|
-
})) : void 0) ?? vr(g ?? [],
|
|
2484
|
-
(
|
|
2485
|
-
ie(
|
|
2496
|
+
path: S
|
|
2497
|
+
})) : void 0) ?? vr(g ?? [], M), X = yr(Qe, z, e), ae = P(
|
|
2498
|
+
(S) => {
|
|
2499
|
+
ie(S), n == null || n.openFile(S, { mode: "edit" });
|
|
2486
2500
|
},
|
|
2487
2501
|
[n]
|
|
2488
|
-
), we =
|
|
2489
|
-
async (
|
|
2502
|
+
), we = P(
|
|
2503
|
+
async (S) => {
|
|
2490
2504
|
try {
|
|
2491
|
-
const R = await a.getTree(
|
|
2492
|
-
|
|
2505
|
+
const R = await a.getTree(S), F = o.length === 0 ? R : R.filter((U) => !Jt(U.name, o));
|
|
2506
|
+
h((U) => new Map(U).set(S, F));
|
|
2493
2507
|
} catch {
|
|
2494
2508
|
}
|
|
2495
2509
|
},
|
|
2496
2510
|
[a, o]
|
|
2497
|
-
), ce =
|
|
2498
|
-
async (
|
|
2499
|
-
const
|
|
2511
|
+
), ce = P(
|
|
2512
|
+
async (S, R) => {
|
|
2513
|
+
const F = Array.from(new Set(S)).filter(
|
|
2500
2514
|
(Y) => Y && Y !== e && Y !== "."
|
|
2501
2515
|
);
|
|
2502
|
-
if (
|
|
2516
|
+
if (F.length === 0) return;
|
|
2503
2517
|
const U = await Promise.all(
|
|
2504
|
-
|
|
2518
|
+
F.map(async (Y) => {
|
|
2505
2519
|
try {
|
|
2506
2520
|
const ee = await a.getTree(Y), Pe = o.length === 0 ? ee : ee.filter((Te) => !Jt(Te.name, o));
|
|
2507
2521
|
return [Y, Pe];
|
|
@@ -2510,7 +2524,7 @@ function Pn({
|
|
|
2510
2524
|
}
|
|
2511
2525
|
})
|
|
2512
2526
|
);
|
|
2513
|
-
|
|
2527
|
+
h((Y) => {
|
|
2514
2528
|
const ee = new Map(Y);
|
|
2515
2529
|
for (const Pe of U) {
|
|
2516
2530
|
if (!Pe) continue;
|
|
@@ -2521,34 +2535,34 @@ function Pn({
|
|
|
2521
2535
|
});
|
|
2522
2536
|
},
|
|
2523
2537
|
[a, e, o]
|
|
2524
|
-
), be =
|
|
2525
|
-
async (
|
|
2526
|
-
if (!
|
|
2527
|
-
const
|
|
2528
|
-
ie(
|
|
2529
|
-
const Y = R != null && R.refreshTargetDir ? [...kn(
|
|
2530
|
-
await ce([...new Set(Y)], { force: !0 }), Ie.current === U && ue(
|
|
2538
|
+
), be = P(
|
|
2539
|
+
async (S, R) => {
|
|
2540
|
+
if (!S) return;
|
|
2541
|
+
const F = kr(S), U = ++Ie.current;
|
|
2542
|
+
ie(F);
|
|
2543
|
+
const Y = R != null && R.refreshTargetDir ? [...kn(F), F] : kn(F);
|
|
2544
|
+
await ce([...new Set(Y)], { force: !0 }), Ie.current === U && ue(F);
|
|
2531
2545
|
},
|
|
2532
2546
|
[ce]
|
|
2533
|
-
), Ve =
|
|
2534
|
-
ue((R) => R ===
|
|
2535
|
-
}, []), Re =
|
|
2536
|
-
async (
|
|
2547
|
+
), Ve = P((S) => {
|
|
2548
|
+
ue((R) => R === S ? null : R);
|
|
2549
|
+
}, []), Re = P(
|
|
2550
|
+
async (S) => {
|
|
2537
2551
|
const R = ++me.current;
|
|
2538
2552
|
try {
|
|
2539
|
-
await be(
|
|
2553
|
+
await be(S, { refreshTargetDir: !0 });
|
|
2540
2554
|
} finally {
|
|
2541
2555
|
me.current === R && (me.current = 0);
|
|
2542
2556
|
}
|
|
2543
2557
|
},
|
|
2544
2558
|
[be]
|
|
2545
2559
|
);
|
|
2546
|
-
|
|
2560
|
+
L(() => {
|
|
2547
2561
|
r && Re(r.path);
|
|
2548
|
-
}, [r, Re]),
|
|
2549
|
-
var
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2562
|
+
}, [r, Re]), L(() => {
|
|
2563
|
+
var F;
|
|
2564
|
+
const S = ((F = n == null ? void 0 : n.getActiveFile) == null ? void 0 : F.call(n)) ?? null;
|
|
2565
|
+
S && me.current === 0 && be(S);
|
|
2552
2566
|
const R = [];
|
|
2553
2567
|
return n != null && n.select && R.push(
|
|
2554
2568
|
n.select((U) => U.activeFile, (U) => {
|
|
@@ -2562,69 +2576,69 @@ function Pn({
|
|
|
2562
2576
|
for (const U of R) U();
|
|
2563
2577
|
};
|
|
2564
2578
|
}, [n, Re, be]);
|
|
2565
|
-
const Ke =
|
|
2566
|
-
|
|
2567
|
-
const U = Ot(
|
|
2579
|
+
const Ke = P((S, R) => {
|
|
2580
|
+
d((F) => {
|
|
2581
|
+
const U = Ot(S), Y = new Map(F), ee = Mt(Y.get(U), [R]) ?? [R];
|
|
2568
2582
|
return Y.set(U, ee), Y;
|
|
2569
2583
|
});
|
|
2570
|
-
}, []), De =
|
|
2571
|
-
|
|
2572
|
-
const U = Ot(
|
|
2573
|
-
if (!(Y != null && Y.length)) return
|
|
2574
|
-
const ee = Y.filter((Te) => Te.path !== R), Pe = new Map(
|
|
2584
|
+
}, []), De = P((S, R) => {
|
|
2585
|
+
d((F) => {
|
|
2586
|
+
const U = Ot(S), Y = F.get(U);
|
|
2587
|
+
if (!(Y != null && Y.length)) return F;
|
|
2588
|
+
const ee = Y.filter((Te) => Te.path !== R), Pe = new Map(F);
|
|
2575
2589
|
return ee.length > 0 ? Pe.set(U, ee) : Pe.delete(U), Pe;
|
|
2576
2590
|
});
|
|
2577
|
-
}, []), [Ne,
|
|
2578
|
-
|
|
2579
|
-
const
|
|
2580
|
-
return
|
|
2591
|
+
}, []), [Ne, b] = O(/* @__PURE__ */ new Set()), E = P((S) => {
|
|
2592
|
+
b((R) => {
|
|
2593
|
+
const F = new Set(R);
|
|
2594
|
+
return F.add(S), F;
|
|
2581
2595
|
});
|
|
2582
|
-
}, []),
|
|
2583
|
-
|
|
2584
|
-
if (!R.has(
|
|
2585
|
-
const
|
|
2586
|
-
return
|
|
2596
|
+
}, []), I = P((S) => {
|
|
2597
|
+
b((R) => {
|
|
2598
|
+
if (!R.has(S)) return R;
|
|
2599
|
+
const F = new Set(R);
|
|
2600
|
+
return F.delete(S), F;
|
|
2587
2601
|
});
|
|
2588
|
-
}, []), j =
|
|
2589
|
-
(
|
|
2590
|
-
|
|
2602
|
+
}, []), j = P(
|
|
2603
|
+
(S, R) => {
|
|
2604
|
+
_({ node: R, x: S.clientX, y: S.clientY });
|
|
2591
2605
|
},
|
|
2592
2606
|
[]
|
|
2593
|
-
), Z =
|
|
2594
|
-
(
|
|
2595
|
-
const R =
|
|
2596
|
-
R.closest("[role=treeitem]") || R.closest("[data-path]") || (
|
|
2607
|
+
), Z = P(
|
|
2608
|
+
(S) => {
|
|
2609
|
+
const R = S.target;
|
|
2610
|
+
R.closest("[role=treeitem]") || R.closest("[data-path]") || (S.preventDefault(), _({
|
|
2597
2611
|
node: { name: e, kind: "dir", path: e },
|
|
2598
|
-
x:
|
|
2599
|
-
y:
|
|
2612
|
+
x: S.clientX,
|
|
2613
|
+
y: S.clientY,
|
|
2600
2614
|
isBackground: !0
|
|
2601
2615
|
}));
|
|
2602
2616
|
},
|
|
2603
2617
|
[e]
|
|
2604
|
-
), fe =
|
|
2605
|
-
async (
|
|
2606
|
-
const
|
|
2607
|
-
if (Y !==
|
|
2608
|
-
|
|
2618
|
+
), fe = P(
|
|
2619
|
+
async (S, R) => {
|
|
2620
|
+
const F = S.split("/").pop() ?? S, U = R === "." ? e : R, Y = U === "." ? F : `${U}/${F}`;
|
|
2621
|
+
if (Y !== S) {
|
|
2622
|
+
E(S);
|
|
2609
2623
|
try {
|
|
2610
|
-
await
|
|
2624
|
+
await k({ from: S, to: Y }), await ce([Ge(S), Ge(Y)]), Ae.success({ title: "Moved", description: `${S} → ${Y}` });
|
|
2611
2625
|
} catch (ee) {
|
|
2612
2626
|
Ae.error({
|
|
2613
2627
|
title: "Move failed",
|
|
2614
2628
|
description: ee instanceof Error ? ee.message : String(ee)
|
|
2615
2629
|
});
|
|
2616
2630
|
} finally {
|
|
2617
|
-
|
|
2631
|
+
I(S);
|
|
2618
2632
|
}
|
|
2619
2633
|
}
|
|
2620
2634
|
},
|
|
2621
|
-
[
|
|
2635
|
+
[k, ce, e, E, I]
|
|
2622
2636
|
);
|
|
2623
|
-
function pe(
|
|
2637
|
+
function pe(S) {
|
|
2624
2638
|
return () => {
|
|
2625
|
-
|
|
2639
|
+
_(null), (async () => {
|
|
2626
2640
|
try {
|
|
2627
|
-
await
|
|
2641
|
+
await S();
|
|
2628
2642
|
} catch (R) {
|
|
2629
2643
|
Ae.error({
|
|
2630
2644
|
title: "Action failed",
|
|
@@ -2634,98 +2648,98 @@ function Pn({
|
|
|
2634
2648
|
})();
|
|
2635
2649
|
};
|
|
2636
2650
|
}
|
|
2637
|
-
const ne = (
|
|
2638
|
-
const R =
|
|
2639
|
-
|
|
2640
|
-
const
|
|
2641
|
-
J({ kind:
|
|
2642
|
-
},
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2645
|
-
}, Lt =
|
|
2646
|
-
async (
|
|
2647
|
-
const
|
|
2648
|
-
if (J(null), !
|
|
2651
|
+
const ne = (S) => {
|
|
2652
|
+
const R = T == null ? void 0 : T.node;
|
|
2653
|
+
_(null);
|
|
2654
|
+
const F = (R == null ? void 0 : R.kind) === "dir" ? R.path : R ? Ge(R.path) : e, U = `__draft__:${++he.current}`;
|
|
2655
|
+
J({ kind: S, parentDir: F, path: U });
|
|
2656
|
+
}, xe = () => ne("create-file"), ft = () => ne("create-folder"), pt = () => {
|
|
2657
|
+
const S = T == null ? void 0 : T.node;
|
|
2658
|
+
_(null), S && J({ kind: "rename", path: S.path, initialValue: S.name });
|
|
2659
|
+
}, Lt = P(
|
|
2660
|
+
async (S, R) => {
|
|
2661
|
+
const F = z;
|
|
2662
|
+
if (J(null), !F) return;
|
|
2649
2663
|
const U = R.trim();
|
|
2650
2664
|
if (!U) return;
|
|
2651
|
-
const Y =
|
|
2652
|
-
|
|
2665
|
+
const Y = F.kind === "rename" ? Ge(F.path) : F.parentDir, ee = F.kind === "rename" ? F.path : Y === "." || Y === "" ? U : `${Y}/${U}`, Pe = F.kind === "rename" ? F.path : ee;
|
|
2666
|
+
E(Pe);
|
|
2653
2667
|
let Te = null;
|
|
2654
2668
|
try {
|
|
2655
|
-
if (
|
|
2656
|
-
if (U ===
|
|
2657
|
-
const Ce =
|
|
2669
|
+
if (F.kind === "rename") {
|
|
2670
|
+
if (U === F.initialValue) return;
|
|
2671
|
+
const Ce = F.path.split("/");
|
|
2658
2672
|
Ce[Ce.length - 1] = U;
|
|
2659
2673
|
const mt = Ce.join("/");
|
|
2660
|
-
await
|
|
2674
|
+
await k({ from: F.path, to: mt }), await ce([Ge(F.path)]), Ae.success({ title: "Renamed", description: `${F.path} → ${mt}` });
|
|
2661
2675
|
} else {
|
|
2662
2676
|
const Ce = {
|
|
2663
2677
|
name: U,
|
|
2664
|
-
kind:
|
|
2678
|
+
kind: F.kind === "create-file" ? "file" : "dir",
|
|
2665
2679
|
path: ee
|
|
2666
2680
|
};
|
|
2667
|
-
Ke(Y, Ce), Te = ee,
|
|
2668
|
-
...
|
|
2681
|
+
Ke(Y, Ce), Te = ee, F.kind === "create-file" ? (await y({ path: ee, content: "" }), q.emit(Q.created, {
|
|
2682
|
+
...ot(),
|
|
2669
2683
|
path: ee,
|
|
2670
2684
|
kind: "file"
|
|
2671
|
-
}), Ae.success({ title: "File created", description: ee })) : (await
|
|
2685
|
+
}), Ae.success({ title: "File created", description: ee })) : (await x({ path: ee }), Ae.success({ title: "Folder created", description: ee })), await ce([Y], { force: !0 }), ue(ee);
|
|
2672
2686
|
}
|
|
2673
2687
|
} catch (Ce) {
|
|
2674
2688
|
Te && De(Y, Te);
|
|
2675
2689
|
const mt = Ce instanceof Error ? Ce.message : String(Ce);
|
|
2676
2690
|
Ae.error({
|
|
2677
|
-
title:
|
|
2691
|
+
title: F.kind === "rename" ? "Rename failed" : F.kind === "create-file" ? "Create file failed" : "Create folder failed",
|
|
2678
2692
|
description: mt
|
|
2679
2693
|
});
|
|
2680
2694
|
} finally {
|
|
2681
|
-
|
|
2695
|
+
I(Pe);
|
|
2682
2696
|
}
|
|
2683
2697
|
},
|
|
2684
2698
|
[
|
|
2685
2699
|
z,
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2700
|
+
k,
|
|
2701
|
+
y,
|
|
2702
|
+
x,
|
|
2689
2703
|
ce,
|
|
2690
|
-
C,
|
|
2691
2704
|
E,
|
|
2705
|
+
I,
|
|
2692
2706
|
Ke,
|
|
2693
2707
|
De
|
|
2694
2708
|
]
|
|
2695
|
-
), $t =
|
|
2709
|
+
), $t = P(() => {
|
|
2696
2710
|
J(null);
|
|
2697
2711
|
}, []), Gr = pe(async () => {
|
|
2698
|
-
|
|
2699
|
-
}), Jr =
|
|
2712
|
+
T != null && T.node && (await Gs(T.node.path), Ae.success({ title: "Path copied", description: T.node.path }));
|
|
2713
|
+
}), Jr = P(async () => {
|
|
2700
2714
|
if (!W) return;
|
|
2701
|
-
const
|
|
2702
|
-
te(null),
|
|
2715
|
+
const S = W;
|
|
2716
|
+
te(null), E(S.path);
|
|
2703
2717
|
try {
|
|
2704
|
-
await
|
|
2705
|
-
const
|
|
2706
|
-
for (const U of
|
|
2707
|
-
(U ===
|
|
2708
|
-
return
|
|
2709
|
-
}), await ce([Ge(
|
|
2718
|
+
await $({ path: S.path }), De(Ge(S.path), S.path), S.kind === "dir" && h((R) => {
|
|
2719
|
+
const F = new Map(R);
|
|
2720
|
+
for (const U of F.keys())
|
|
2721
|
+
(U === S.path || U.startsWith(`${S.path}/`)) && F.delete(U);
|
|
2722
|
+
return F;
|
|
2723
|
+
}), await ce([Ge(S.path)]), Ae.success({ title: "Deleted", description: S.path });
|
|
2710
2724
|
} catch (R) {
|
|
2711
2725
|
Ae.error({
|
|
2712
2726
|
title: "Delete failed",
|
|
2713
2727
|
description: R instanceof Error ? R.message : String(R)
|
|
2714
2728
|
});
|
|
2715
2729
|
} finally {
|
|
2716
|
-
|
|
2730
|
+
I(S.path);
|
|
2717
2731
|
}
|
|
2718
2732
|
}, [
|
|
2719
2733
|
W,
|
|
2720
|
-
|
|
2734
|
+
$,
|
|
2721
2735
|
ce,
|
|
2722
|
-
C,
|
|
2723
2736
|
E,
|
|
2737
|
+
I,
|
|
2724
2738
|
De
|
|
2725
2739
|
]), Yr = !ke && ((t == null ? void 0 : t.length) ?? 0) > 0 ? t : void 0;
|
|
2726
|
-
return /* @__PURE__ */
|
|
2740
|
+
return /* @__PURE__ */ C("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
2727
2741
|
c && /* @__PURE__ */ u(
|
|
2728
|
-
|
|
2742
|
+
nt,
|
|
2729
2743
|
{
|
|
2730
2744
|
className: "m-2 rounded-md p-3",
|
|
2731
2745
|
title: "Failed to load files",
|
|
@@ -2735,10 +2749,10 @@ function Pn({
|
|
|
2735
2749
|
/* @__PURE__ */ u(
|
|
2736
2750
|
"div",
|
|
2737
2751
|
{
|
|
2738
|
-
ref:
|
|
2752
|
+
ref: v,
|
|
2739
2753
|
className: "min-h-0 flex-1 overflow-hidden",
|
|
2740
2754
|
onContextMenu: Z,
|
|
2741
|
-
children:
|
|
2755
|
+
children: f ? /* @__PURE__ */ u("div", { className: "space-y-1 p-2", "data-testid": "tree-skeleton", children: Array.from({ length: 8 }).map((S, R) => /* @__PURE__ */ u(
|
|
2742
2756
|
vo,
|
|
2743
2757
|
{
|
|
2744
2758
|
className: "h-5",
|
|
@@ -2748,7 +2762,7 @@ function Pn({
|
|
|
2748
2762
|
)) }) : /* @__PURE__ */ u(
|
|
2749
2763
|
Et,
|
|
2750
2764
|
{
|
|
2751
|
-
fallback: /* @__PURE__ */
|
|
2765
|
+
fallback: /* @__PURE__ */ C("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
2752
2766
|
/* @__PURE__ */ u(Rt, { className: "size-3.5" }),
|
|
2753
2767
|
/* @__PURE__ */ u("span", { children: "Loading..." })
|
|
2754
2768
|
] }),
|
|
@@ -2772,7 +2786,7 @@ function Pn({
|
|
|
2772
2786
|
onSubmitEdit: Lt,
|
|
2773
2787
|
onCancelEdit: $t,
|
|
2774
2788
|
onDragDrop: fe,
|
|
2775
|
-
height:
|
|
2789
|
+
height: w,
|
|
2776
2790
|
className: oe(i)
|
|
2777
2791
|
}
|
|
2778
2792
|
)
|
|
@@ -2780,17 +2794,17 @@ function Pn({
|
|
|
2780
2794
|
)
|
|
2781
2795
|
}
|
|
2782
2796
|
),
|
|
2783
|
-
|
|
2797
|
+
T && /* @__PURE__ */ C(
|
|
2784
2798
|
"div",
|
|
2785
2799
|
{
|
|
2786
2800
|
ref: le,
|
|
2787
2801
|
role: "menu",
|
|
2788
2802
|
className: "fixed z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
2789
|
-
style: { left:
|
|
2803
|
+
style: { left: T.x, top: T.y },
|
|
2790
2804
|
children: [
|
|
2791
|
-
/* @__PURE__ */ u($e, { type: "button", role: "menuitem", variant: "ghost", size: "sm", className: "w-full justify-start", onClick:
|
|
2805
|
+
/* @__PURE__ */ u($e, { type: "button", role: "menuitem", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: xe, children: "New file" }),
|
|
2792
2806
|
/* @__PURE__ */ u($e, { type: "button", role: "menuitem", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: ft, children: "New folder" }),
|
|
2793
|
-
!
|
|
2807
|
+
!T.isBackground && /* @__PURE__ */ C(_e, { children: [
|
|
2794
2808
|
/* @__PURE__ */ u($e, { type: "button", role: "menuitem", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: pt, children: "Rename" }),
|
|
2795
2809
|
/* @__PURE__ */ u(
|
|
2796
2810
|
$e,
|
|
@@ -2801,7 +2815,7 @@ function Pn({
|
|
|
2801
2815
|
size: "sm",
|
|
2802
2816
|
className: "w-full justify-start text-destructive hover:bg-destructive/10 hover:text-destructive",
|
|
2803
2817
|
onClick: () => {
|
|
2804
|
-
te(
|
|
2818
|
+
te(T.node), _(null);
|
|
2805
2819
|
},
|
|
2806
2820
|
children: "Delete"
|
|
2807
2821
|
}
|
|
@@ -2815,19 +2829,19 @@ function Pn({
|
|
|
2815
2829
|
yo,
|
|
2816
2830
|
{
|
|
2817
2831
|
open: W !== null,
|
|
2818
|
-
onOpenChange: (
|
|
2819
|
-
|
|
2832
|
+
onOpenChange: (S) => {
|
|
2833
|
+
S || te(null);
|
|
2820
2834
|
},
|
|
2821
|
-
children: /* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2835
|
+
children: /* @__PURE__ */ C(wo, { children: [
|
|
2836
|
+
/* @__PURE__ */ C(bo, { children: [
|
|
2837
|
+
/* @__PURE__ */ C(xo, { children: [
|
|
2824
2838
|
"Delete ",
|
|
2825
2839
|
W == null ? void 0 : W.name,
|
|
2826
2840
|
"?"
|
|
2827
2841
|
] }),
|
|
2828
|
-
/* @__PURE__ */ u(
|
|
2842
|
+
/* @__PURE__ */ u(So, { children: "This action cannot be undone." })
|
|
2829
2843
|
] }),
|
|
2830
|
-
/* @__PURE__ */
|
|
2844
|
+
/* @__PURE__ */ C(ko, { children: [
|
|
2831
2845
|
/* @__PURE__ */ u(Po, { children: "Cancel" }),
|
|
2832
2846
|
/* @__PURE__ */ u(Co, { onClick: Jr, children: "Delete" })
|
|
2833
2847
|
] })
|
|
@@ -2846,25 +2860,25 @@ function Xs({
|
|
|
2846
2860
|
chromeless: a = !1,
|
|
2847
2861
|
className: l
|
|
2848
2862
|
}) {
|
|
2849
|
-
const c = (e == null ? void 0 : e.rootDir) ?? t,
|
|
2850
|
-
|
|
2851
|
-
const
|
|
2863
|
+
const c = (e == null ? void 0 : e.rootDir) ?? t, f = (e == null ? void 0 : e.bridge) ?? o, s = (e == null ? void 0 : e.chromeless) ?? a, d = (e == null ? void 0 : e.revealFileTreeRequest) ?? null, p = (e == null ? void 0 : e.searchQuery) ?? (e == null ? void 0 : e.query) ?? n, m = r ?? i, [g, y] = O(""), [x, k] = O(""), $ = A(void 0);
|
|
2864
|
+
L(() => (clearTimeout($.current), $.current = setTimeout(() => k(g), 200), () => clearTimeout($.current)), [g]);
|
|
2865
|
+
const D = p !== void 0 ? p || void 0 : x || void 0;
|
|
2852
2866
|
return s ? /* @__PURE__ */ u(
|
|
2853
2867
|
Pn,
|
|
2854
2868
|
{
|
|
2855
2869
|
rootDir: c,
|
|
2856
|
-
searchQuery:
|
|
2857
|
-
bridge:
|
|
2858
|
-
revealFileTreeRequest:
|
|
2870
|
+
searchQuery: D,
|
|
2871
|
+
bridge: f,
|
|
2872
|
+
revealFileTreeRequest: d,
|
|
2859
2873
|
className: oe("px-1 pt-1 [&_[role=treeitem]]:!indent-0", l)
|
|
2860
2874
|
}
|
|
2861
|
-
) : /* @__PURE__ */ u(qs, { title: "Files", panelApi:
|
|
2875
|
+
) : /* @__PURE__ */ u(qs, { title: "Files", panelApi: m, children: /* @__PURE__ */ C("div", { className: "flex h-full flex-col", children: [
|
|
2862
2876
|
/* @__PURE__ */ u("div", { className: "border-b border-border px-2 py-1.5", children: /* @__PURE__ */ u(
|
|
2863
2877
|
Yn,
|
|
2864
2878
|
{
|
|
2865
2879
|
placeholder: "Search files...",
|
|
2866
2880
|
value: p ?? g,
|
|
2867
|
-
onChange: (
|
|
2881
|
+
onChange: (h) => y(h.target.value),
|
|
2868
2882
|
className: "h-7 text-xs",
|
|
2869
2883
|
"aria-label": "Search files"
|
|
2870
2884
|
}
|
|
@@ -2873,9 +2887,9 @@ function Xs({
|
|
|
2873
2887
|
Pn,
|
|
2874
2888
|
{
|
|
2875
2889
|
rootDir: c,
|
|
2876
|
-
searchQuery:
|
|
2877
|
-
bridge:
|
|
2878
|
-
revealFileTreeRequest:
|
|
2890
|
+
searchQuery: D,
|
|
2891
|
+
bridge: f,
|
|
2892
|
+
revealFileTreeRequest: d,
|
|
2879
2893
|
className: l
|
|
2880
2894
|
}
|
|
2881
2895
|
) })
|
|
@@ -2885,7 +2899,7 @@ function Qs(e) {
|
|
|
2885
2899
|
return e.split("/").pop() ?? e;
|
|
2886
2900
|
}
|
|
2887
2901
|
function Zs() {
|
|
2888
|
-
return
|
|
2902
|
+
return L(() => {
|
|
2889
2903
|
const e = q.on(Q.moved, ({ from: n, to: r, ...o }) => {
|
|
2890
2904
|
q.emit(ve.panelUpdate, {
|
|
2891
2905
|
...o,
|
|
@@ -2964,7 +2978,7 @@ function Kl(e) {
|
|
|
2964
2978
|
return q.on(Q.changed, e);
|
|
2965
2979
|
}
|
|
2966
2980
|
function oa() {
|
|
2967
|
-
return
|
|
2981
|
+
return L(() => q.on(ve.agentData, ({ part: e }) => {
|
|
2968
2982
|
na(e);
|
|
2969
2983
|
}), []), ra((e) => {
|
|
2970
2984
|
or({ kind: "openFile", params: { path: e } });
|
|
@@ -2972,19 +2986,19 @@ function oa() {
|
|
|
2972
2986
|
}
|
|
2973
2987
|
const ia = 250, sa = 3e3, aa = 3e4;
|
|
2974
2988
|
function ca(e, t) {
|
|
2975
|
-
const { adapter: n, panelId: r, onDirtyChange: o, serverMtime: i } = t, [a, l] =
|
|
2976
|
-
|
|
2977
|
-
const
|
|
2978
|
-
|
|
2979
|
-
const
|
|
2980
|
-
const z =
|
|
2989
|
+
const { adapter: n, panelId: r, onDirtyChange: o, serverMtime: i } = t, [a, l] = O(!1), [c, f] = O(!1), [s, d] = O(null), [p, m] = O(!1), [g, y] = O(!1), x = A(void 0), k = A(null), $ = A(0), D = A(null), h = A(0), M = A(void 0), v = A(o);
|
|
2990
|
+
v.current = o;
|
|
2991
|
+
const w = A(n);
|
|
2992
|
+
w.current = n;
|
|
2993
|
+
const N = P(async () => {
|
|
2994
|
+
const z = w.current;
|
|
2981
2995
|
if (!z || !e || !z.isDirty()) return;
|
|
2982
|
-
if (
|
|
2983
|
-
const J =
|
|
2996
|
+
if (k.current) return k.current;
|
|
2997
|
+
const J = h.current;
|
|
2984
2998
|
let G = null;
|
|
2985
2999
|
return G = (async () => {
|
|
2986
3000
|
var me;
|
|
2987
|
-
|
|
3001
|
+
f(!0), q.emit(ve.editorSaveStart, { panelId: r });
|
|
2988
3002
|
let ue;
|
|
2989
3003
|
const Ie = new Promise((he) => {
|
|
2990
3004
|
ue = setTimeout(() => he("timeout"), aa);
|
|
@@ -2994,56 +3008,56 @@ function ca(e, t) {
|
|
|
2994
3008
|
z.save().then(() => "saved"),
|
|
2995
3009
|
Ie
|
|
2996
3010
|
]);
|
|
2997
|
-
if (
|
|
2998
|
-
he === "saved" && (
|
|
3011
|
+
if (h.current !== J) return;
|
|
3012
|
+
he === "saved" && ($.current = Date.now(), d(Date.now()), l(!1), (me = v.current) == null || me.call(v, e, !1));
|
|
2999
3013
|
} catch {
|
|
3000
|
-
if (
|
|
3014
|
+
if (h.current !== J) return;
|
|
3001
3015
|
} finally {
|
|
3002
|
-
if (ue && clearTimeout(ue),
|
|
3003
|
-
q.emit(ve.editorSaveEnd, { panelId: r }),
|
|
3016
|
+
if (ue && clearTimeout(ue), k.current === G && (k.current = null), h.current !== J) return;
|
|
3017
|
+
q.emit(ve.editorSaveEnd, { panelId: r }), f(!1);
|
|
3004
3018
|
}
|
|
3005
|
-
})(),
|
|
3006
|
-
}, [e, r]),
|
|
3007
|
-
clearTimeout(
|
|
3008
|
-
}, [
|
|
3019
|
+
})(), k.current = G, G;
|
|
3020
|
+
}, [e, r]), T = P(() => {
|
|
3021
|
+
clearTimeout(x.current), x.current = setTimeout(N, ia);
|
|
3022
|
+
}, [N]), _ = P(() => {
|
|
3009
3023
|
var z;
|
|
3010
|
-
e && (l(!0), (z =
|
|
3011
|
-
}, [e,
|
|
3024
|
+
e && (l(!0), (z = v.current) == null || z.call(v, e, !0), T());
|
|
3025
|
+
}, [e, T]), W = P(() => {
|
|
3012
3026
|
var z;
|
|
3013
|
-
clearTimeout(
|
|
3014
|
-
}, [e]), te =
|
|
3027
|
+
clearTimeout(x.current), l(!1), y(!1), e && ((z = v.current) == null || z.call(v, e, !1));
|
|
3028
|
+
}, [e]), te = P(async () => {
|
|
3015
3029
|
var z;
|
|
3016
|
-
if (clearTimeout(
|
|
3017
|
-
if ((z =
|
|
3018
|
-
return
|
|
3019
|
-
}, [
|
|
3020
|
-
|
|
3030
|
+
if (clearTimeout(x.current), k.current) return k.current;
|
|
3031
|
+
if ((z = w.current) != null && z.isDirty())
|
|
3032
|
+
return N();
|
|
3033
|
+
}, [N]), le = P(() => m(!1), []), B = P(() => y(!1), []), ie = P((z) => {
|
|
3034
|
+
D.current = z, y(!1);
|
|
3021
3035
|
}, []);
|
|
3022
|
-
return
|
|
3036
|
+
return L(() => {
|
|
3023
3037
|
if (!(i == null || !e)) {
|
|
3024
|
-
if (
|
|
3025
|
-
|
|
3038
|
+
if (D.current === null) {
|
|
3039
|
+
D.current = i;
|
|
3026
3040
|
return;
|
|
3027
3041
|
}
|
|
3028
|
-
if (i !==
|
|
3029
|
-
if (Date.now() -
|
|
3030
|
-
|
|
3042
|
+
if (i !== D.current) {
|
|
3043
|
+
if (Date.now() - $.current < sa) {
|
|
3044
|
+
D.current = i;
|
|
3031
3045
|
return;
|
|
3032
3046
|
}
|
|
3033
|
-
|
|
3047
|
+
D.current = i, a ? y(!0) : m(!0);
|
|
3034
3048
|
}
|
|
3035
3049
|
}
|
|
3036
|
-
}, [i, e, a]),
|
|
3037
|
-
if (
|
|
3038
|
-
|
|
3050
|
+
}, [i, e, a]), L(() => {
|
|
3051
|
+
if (M.current === void 0) {
|
|
3052
|
+
M.current = e;
|
|
3039
3053
|
return;
|
|
3040
3054
|
}
|
|
3041
|
-
|
|
3042
|
-
}, [e]),
|
|
3055
|
+
M.current !== e && (M.current = e, h.current += 1, clearTimeout(x.current), k.current && q.emit(ve.editorSaveEnd, { panelId: r }), k.current = null, D.current = null, $.current = 0, l(!1), f(!1), m(!1), y(!1));
|
|
3056
|
+
}, [e]), L(() => () => clearTimeout(x.current), []), {
|
|
3043
3057
|
isDirty: a,
|
|
3044
3058
|
isSaving: c,
|
|
3045
3059
|
lastSavedAt: s,
|
|
3046
|
-
markDirty:
|
|
3060
|
+
markDirty: _,
|
|
3047
3061
|
markClean: W,
|
|
3048
3062
|
flushSave: te,
|
|
3049
3063
|
shouldSync: p,
|
|
@@ -3063,8 +3077,8 @@ function ua(e) {
|
|
|
3063
3077
|
return e instanceof HTMLElement ? e.isContentEditable || e.closest("[contenteditable='true'], [contenteditable=''], [contenteditable='plaintext-only']") || e.closest("[role='textbox'], [role='searchbox'], [role='combobox']") ? !0 : !!e.closest("input, textarea, select") : !1;
|
|
3064
3078
|
}
|
|
3065
3079
|
function Pr({ shortcuts: e, enabled: t = !0 }) {
|
|
3066
|
-
const n =
|
|
3067
|
-
n.current = e,
|
|
3080
|
+
const n = A(e);
|
|
3081
|
+
n.current = e, L(() => {
|
|
3068
3082
|
if (!t) return;
|
|
3069
3083
|
function r(o) {
|
|
3070
3084
|
const i = ua(o.target);
|
|
@@ -3085,88 +3099,88 @@ function Hl(e) {
|
|
|
3085
3099
|
}
|
|
3086
3100
|
let da = 0;
|
|
3087
3101
|
function Cr(e) {
|
|
3088
|
-
const { path: t, panelId: n, initialContent: r = null } = e, o = /\S/.test(t) ? t : null, i =
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
}, [t, r]),
|
|
3092
|
-
(l == null ? void 0 : l.content) != null && p === null && (
|
|
3102
|
+
const { path: t, panelId: n, initialContent: r = null } = e, o = /\S/.test(t) ? t : null, i = A(n ?? `file-pane:${da++}`), a = n ?? i.current, { data: l, isLoading: c, error: f, refetch: s } = fs(o), { mutateAsync: d } = hr(), [p, m] = O(r), g = A(""), y = A(!1), x = A(null), k = A(null), $ = A(null), D = A(0), [h, M] = O(null);
|
|
3103
|
+
L(() => {
|
|
3104
|
+
x.current !== t && (m(r), g.current = r ?? "", y.current = !1, k.current = null, D.current += 1, M(null), x.current = t);
|
|
3105
|
+
}, [t, r]), L(() => {
|
|
3106
|
+
(l == null ? void 0 : l.content) != null && p === null && (m(l.content), g.current = l.content, k.current = l.mtimeMs ?? null);
|
|
3093
3107
|
}, [l, p]);
|
|
3094
|
-
const
|
|
3095
|
-
isDirty: () =>
|
|
3108
|
+
const v = o && p != null ? {
|
|
3109
|
+
isDirty: () => y.current,
|
|
3096
3110
|
save: async () => {
|
|
3097
3111
|
var J;
|
|
3098
|
-
const z = ++
|
|
3112
|
+
const z = ++D.current;
|
|
3099
3113
|
try {
|
|
3100
|
-
const G = await
|
|
3114
|
+
const G = await d({
|
|
3101
3115
|
path: o,
|
|
3102
3116
|
content: g.current,
|
|
3103
|
-
expectedMtimeMs:
|
|
3117
|
+
expectedMtimeMs: k.current ?? void 0
|
|
3104
3118
|
});
|
|
3105
|
-
if (
|
|
3106
|
-
typeof G.mtimeMs == "number" && (
|
|
3119
|
+
if (D.current !== z) return;
|
|
3120
|
+
typeof G.mtimeMs == "number" && (k.current = G.mtimeMs, (J = $.current) == null || J.call($, G.mtimeMs)), y.current = !1, M(null);
|
|
3107
3121
|
} catch (G) {
|
|
3108
|
-
throw
|
|
3122
|
+
throw D.current !== z || G instanceof ct && (typeof G.currentMtimeMs == "number" && (k.current = G.currentMtimeMs), M(G)), G;
|
|
3109
3123
|
}
|
|
3110
3124
|
},
|
|
3111
3125
|
getContent: () => g.current
|
|
3112
|
-
} : null,
|
|
3113
|
-
adapter:
|
|
3126
|
+
} : null, w = ca(o, {
|
|
3127
|
+
adapter: v,
|
|
3114
3128
|
panelId: a,
|
|
3115
3129
|
serverMtime: (l == null ? void 0 : l.mtimeMs) ?? null
|
|
3116
3130
|
});
|
|
3117
|
-
|
|
3118
|
-
if (!(!
|
|
3119
|
-
if (
|
|
3120
|
-
|
|
3131
|
+
$.current = w.notifySaved, L(() => {
|
|
3132
|
+
if (!(!w.shouldSync || (l == null ? void 0 : l.content) == null)) {
|
|
3133
|
+
if (y.current) {
|
|
3134
|
+
w.ackSync();
|
|
3121
3135
|
return;
|
|
3122
3136
|
}
|
|
3123
|
-
|
|
3137
|
+
m(l.content), g.current = l.content, k.current = l.mtimeMs ?? null, y.current = !1, w.ackSync();
|
|
3124
3138
|
}
|
|
3125
|
-
}, [
|
|
3126
|
-
!
|
|
3127
|
-
}, [o,
|
|
3128
|
-
const
|
|
3129
|
-
|
|
3130
|
-
const z =
|
|
3131
|
-
|
|
3132
|
-
}, [
|
|
3133
|
-
const W =
|
|
3134
|
-
|
|
3135
|
-
}, [
|
|
3139
|
+
}, [w.shouldSync, w, l, m]), L(() => {
|
|
3140
|
+
!w.externalChangeWhileDirty || (l == null ? void 0 : l.mtimeMs) == null || (M(new ct(o ?? t, l.mtimeMs, k.current)), k.current = l.mtimeMs, w.ackExternalChange());
|
|
3141
|
+
}, [o, w.externalChangeWhileDirty, w, l, t]);
|
|
3142
|
+
const N = o ? o.split("/").pop() ?? o : "", [T, _] = O("");
|
|
3143
|
+
L(() => {
|
|
3144
|
+
const z = N ? w.isDirty ? `${N} ●` : N : "";
|
|
3145
|
+
_(z);
|
|
3146
|
+
}, [N, w.isDirty]);
|
|
3147
|
+
const W = P((z) => {
|
|
3148
|
+
m(z), g.current = z, y.current = !0, w.markDirty();
|
|
3149
|
+
}, [m, w]), te = P(async () => {
|
|
3136
3150
|
var G;
|
|
3137
3151
|
if (!o) return;
|
|
3138
3152
|
const z = await s();
|
|
3139
3153
|
if (z.status !== "success" || z.data == null) return;
|
|
3140
3154
|
const J = z.data;
|
|
3141
|
-
|
|
3142
|
-
}, [o,
|
|
3155
|
+
m(J.content), g.current = J.content, k.current = J.mtimeMs ?? null, y.current = !1, w.markClean(), typeof J.mtimeMs == "number" && ((G = $.current) == null || G.call($, J.mtimeMs)), M(null);
|
|
3156
|
+
}, [o, w, s, m]), le = P(async () => {
|
|
3143
3157
|
var J;
|
|
3144
|
-
const z = ++
|
|
3158
|
+
const z = ++D.current;
|
|
3145
3159
|
try {
|
|
3146
3160
|
if (!o) return;
|
|
3147
|
-
const G = g.current, ue = await
|
|
3148
|
-
if (
|
|
3149
|
-
typeof ue.mtimeMs == "number" && (
|
|
3161
|
+
const G = g.current, ue = await d({ path: o, content: G });
|
|
3162
|
+
if (D.current !== z) return;
|
|
3163
|
+
typeof ue.mtimeMs == "number" && (k.current = ue.mtimeMs, (J = $.current) == null || J.call($, ue.mtimeMs)), y.current = !1, M(null);
|
|
3150
3164
|
} catch {
|
|
3151
3165
|
}
|
|
3152
|
-
}, [o,
|
|
3153
|
-
!
|
|
3154
|
-
}, [
|
|
3155
|
-
await
|
|
3156
|
-
}, [
|
|
3166
|
+
}, [o, d]), B = P(async () => {
|
|
3167
|
+
!v || !y.current || await v.save();
|
|
3168
|
+
}, [v]), ie = P(async () => {
|
|
3169
|
+
await w.flushSave();
|
|
3170
|
+
}, [w]);
|
|
3157
3171
|
return {
|
|
3158
3172
|
isLoading: c,
|
|
3159
|
-
error:
|
|
3173
|
+
error: f,
|
|
3160
3174
|
content: p,
|
|
3161
|
-
isDirty:
|
|
3162
|
-
conflict:
|
|
3175
|
+
isDirty: w.isDirty,
|
|
3176
|
+
conflict: h,
|
|
3163
3177
|
onReloadFromServer: te,
|
|
3164
3178
|
onOverwrite: le,
|
|
3165
3179
|
setContent: W,
|
|
3166
3180
|
save: B,
|
|
3167
3181
|
flushSave: ie,
|
|
3168
|
-
fileName:
|
|
3169
|
-
tabTitle:
|
|
3182
|
+
fileName: N,
|
|
3183
|
+
tabTitle: T
|
|
3170
3184
|
};
|
|
3171
3185
|
}
|
|
3172
3186
|
function fa({ conflict: e, onReload: t, onOverwrite: n }) {
|
|
@@ -3177,7 +3191,7 @@ function fa({ conflict: e, onReload: t, onOverwrite: n }) {
|
|
|
3177
3191
|
tone: "accent",
|
|
3178
3192
|
className: "rounded-none border-x-0 border-t-0",
|
|
3179
3193
|
description: /* @__PURE__ */ u(_e, { children: "This file has been modified outside the editor. Your unsaved changes will be lost if you reload, or will overwrite the latest version on disk if you save." }),
|
|
3180
|
-
actions: /* @__PURE__ */
|
|
3194
|
+
actions: /* @__PURE__ */ C(_e, { children: [
|
|
3181
3195
|
/* @__PURE__ */ u($e, { type: "button", variant: "outline", size: "xs", onClick: () => void t(), children: "Reload" }),
|
|
3182
3196
|
/* @__PURE__ */ u(
|
|
3183
3197
|
$e,
|
|
@@ -3204,20 +3218,20 @@ function Er({
|
|
|
3204
3218
|
onReload: a,
|
|
3205
3219
|
onOverwrite: l,
|
|
3206
3220
|
editorComponent: c,
|
|
3207
|
-
editorProps:
|
|
3221
|
+
editorProps: f = {},
|
|
3208
3222
|
loadingFallback: s,
|
|
3209
|
-
errorMessage:
|
|
3223
|
+
errorMessage: d,
|
|
3210
3224
|
className: p
|
|
3211
3225
|
}) {
|
|
3212
3226
|
if (!/\S/.test(e))
|
|
3213
3227
|
return /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(Xn, { className: "min-h-0 border-0", title: "No file selected", description: "Choose a file from the file tree to open an editor." }) });
|
|
3214
3228
|
if (r)
|
|
3215
|
-
return /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(
|
|
3216
|
-
const
|
|
3229
|
+
return /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(nt, { title: "Failed to load file", description: d ?? r.message }) });
|
|
3230
|
+
const m = s ?? /* @__PURE__ */ C("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
3217
3231
|
/* @__PURE__ */ u(Rt, { className: "size-3.5" }),
|
|
3218
3232
|
/* @__PURE__ */ u("span", { children: "Loading file..." })
|
|
3219
3233
|
] });
|
|
3220
|
-
return /* @__PURE__ */
|
|
3234
|
+
return /* @__PURE__ */ C("div", { className: `flex h-full min-h-0 flex-col ${p ?? ""}`, children: [
|
|
3221
3235
|
o && /* @__PURE__ */ u(
|
|
3222
3236
|
fa,
|
|
3223
3237
|
{
|
|
@@ -3226,13 +3240,13 @@ function Er({
|
|
|
3226
3240
|
onOverwrite: l
|
|
3227
3241
|
}
|
|
3228
3242
|
),
|
|
3229
|
-
/* @__PURE__ */ u(Et, { fallback:
|
|
3243
|
+
/* @__PURE__ */ u(Et, { fallback: m, children: n || t === null ? m : /* @__PURE__ */ u(
|
|
3230
3244
|
c,
|
|
3231
3245
|
{
|
|
3232
3246
|
content: t,
|
|
3233
3247
|
onChange: i,
|
|
3234
|
-
className:
|
|
3235
|
-
...
|
|
3248
|
+
className: f.className,
|
|
3249
|
+
...f
|
|
3236
3250
|
}
|
|
3237
3251
|
) })
|
|
3238
3252
|
] });
|
|
@@ -3272,11 +3286,11 @@ function Cn({ params: e, api: t, className: n }) {
|
|
|
3272
3286
|
error: a,
|
|
3273
3287
|
conflict: l,
|
|
3274
3288
|
setContent: c,
|
|
3275
|
-
onReloadFromServer:
|
|
3289
|
+
onReloadFromServer: f,
|
|
3276
3290
|
onOverwrite: s,
|
|
3277
|
-
tabTitle:
|
|
3291
|
+
tabTitle: d
|
|
3278
3292
|
} = Cr({ path: r, panelId: t == null ? void 0 : t.id });
|
|
3279
|
-
t &&
|
|
3293
|
+
t && d && t.setTitle(d);
|
|
3280
3294
|
const p = ma(r);
|
|
3281
3295
|
return /* @__PURE__ */ u(
|
|
3282
3296
|
Er,
|
|
@@ -3287,7 +3301,7 @@ function Cn({ params: e, api: t, className: n }) {
|
|
|
3287
3301
|
error: a,
|
|
3288
3302
|
conflict: l,
|
|
3289
3303
|
onChange: c,
|
|
3290
|
-
onReload:
|
|
3304
|
+
onReload: f,
|
|
3291
3305
|
onOverwrite: s,
|
|
3292
3306
|
editorComponent: pa,
|
|
3293
3307
|
editorProps: { language: p, wordWrap: !0, className: n }
|
|
@@ -3295,7 +3309,7 @@ function Cn({ params: e, api: t, className: n }) {
|
|
|
3295
3309
|
);
|
|
3296
3310
|
}
|
|
3297
3311
|
const ha = ut(
|
|
3298
|
-
() => import("./MarkdownEditor-
|
|
3312
|
+
() => import("./MarkdownEditor-BhLjIyPQ.js").then((e) => ({ default: e.MarkdownEditor }))
|
|
3299
3313
|
);
|
|
3300
3314
|
function ga({ params: e, api: t, className: n }) {
|
|
3301
3315
|
const r = typeof (e == null ? void 0 : e.path) == "string" ? e.path : "", {
|
|
@@ -3304,11 +3318,11 @@ function ga({ params: e, api: t, className: n }) {
|
|
|
3304
3318
|
error: a,
|
|
3305
3319
|
conflict: l,
|
|
3306
3320
|
setContent: c,
|
|
3307
|
-
onReloadFromServer:
|
|
3321
|
+
onReloadFromServer: f,
|
|
3308
3322
|
onOverwrite: s,
|
|
3309
|
-
tabTitle:
|
|
3323
|
+
tabTitle: d
|
|
3310
3324
|
} = Cr({ path: r, panelId: t == null ? void 0 : t.id });
|
|
3311
|
-
return t &&
|
|
3325
|
+
return t && d && t.setTitle(d), /* @__PURE__ */ u(
|
|
3312
3326
|
Er,
|
|
3313
3327
|
{
|
|
3314
3328
|
path: r,
|
|
@@ -3317,7 +3331,7 @@ function ga({ params: e, api: t, className: n }) {
|
|
|
3317
3331
|
error: a,
|
|
3318
3332
|
conflict: l,
|
|
3319
3333
|
onChange: c,
|
|
3320
|
-
onReload:
|
|
3334
|
+
onReload: f,
|
|
3321
3335
|
onOverwrite: s,
|
|
3322
3336
|
editorComponent: ha,
|
|
3323
3337
|
editorProps: { className: n, documentPath: r }
|
|
@@ -3327,38 +3341,38 @@ function ga({ params: e, api: t, className: n }) {
|
|
|
3327
3341
|
function va(e, t) {
|
|
3328
3342
|
return `${e.replace(/\/$/, "")}${t}`;
|
|
3329
3343
|
}
|
|
3330
|
-
function
|
|
3344
|
+
function et(e) {
|
|
3331
3345
|
return e.split("/").pop() ?? e;
|
|
3332
3346
|
}
|
|
3333
3347
|
function ya({ path: e, kind: t, reloadKey: n = 0, onReload: r, className: o }) {
|
|
3334
|
-
const i = Ye(), a = Xe(), [l, c] =
|
|
3348
|
+
const i = Ye(), a = Xe(), [l, c] = O(null), [f, s] = O(null), [d, p] = O(!0), m = H(() => {
|
|
3335
3349
|
const g = new URLSearchParams({ path: e });
|
|
3336
3350
|
return n > 0 && g.set("reload", String(n)), va(i, `/api/v1/files/raw?${g.toString()}`);
|
|
3337
3351
|
}, [i, e, n]);
|
|
3338
|
-
return
|
|
3352
|
+
return L(() => {
|
|
3339
3353
|
const g = new AbortController();
|
|
3340
|
-
let
|
|
3354
|
+
let y = null;
|
|
3341
3355
|
p(!0), s(null), c(null);
|
|
3342
|
-
const
|
|
3343
|
-
return a && (
|
|
3356
|
+
const x = {};
|
|
3357
|
+
return a && (x["x-boring-workspace-id"] = a), fetch(m, {
|
|
3344
3358
|
credentials: "include",
|
|
3345
|
-
headers:
|
|
3359
|
+
headers: x,
|
|
3346
3360
|
signal: g.signal
|
|
3347
|
-
}).then(async (
|
|
3348
|
-
if (!
|
|
3349
|
-
const
|
|
3350
|
-
|
|
3351
|
-
}).catch((
|
|
3352
|
-
g.signal.aborted || s(
|
|
3361
|
+
}).then(async (k) => {
|
|
3362
|
+
if (!k.ok) throw new Error(`HTTP ${k.status}`);
|
|
3363
|
+
const $ = await k.blob();
|
|
3364
|
+
y = URL.createObjectURL($), c(y);
|
|
3365
|
+
}).catch((k) => {
|
|
3366
|
+
g.signal.aborted || s(k instanceof Error ? k.message : "Failed to load preview");
|
|
3353
3367
|
}).finally(() => {
|
|
3354
3368
|
g.signal.aborted || p(!1);
|
|
3355
3369
|
}), () => {
|
|
3356
|
-
g.abort(),
|
|
3370
|
+
g.abort(), y && URL.revokeObjectURL(y);
|
|
3357
3371
|
};
|
|
3358
|
-
}, [
|
|
3359
|
-
/* @__PURE__ */
|
|
3360
|
-
/* @__PURE__ */ u("div", { className: "min-w-0 truncate text-xs font-medium text-muted-foreground", title: e, children:
|
|
3361
|
-
/* @__PURE__ */
|
|
3372
|
+
}, [m, a]), e ? /* @__PURE__ */ C("div", { className: oe("flex h-full min-h-0 flex-col bg-background", o), children: [
|
|
3373
|
+
/* @__PURE__ */ C("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border/60 px-3 py-2", children: [
|
|
3374
|
+
/* @__PURE__ */ u("div", { className: "min-w-0 truncate text-xs font-medium text-muted-foreground", title: e, children: et(e) }),
|
|
3375
|
+
/* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
|
|
3362
3376
|
/* @__PURE__ */ u(
|
|
3363
3377
|
"button",
|
|
3364
3378
|
{
|
|
@@ -3366,7 +3380,7 @@ function ya({ path: e, kind: t, reloadKey: n = 0, onReload: r, className: o }) {
|
|
|
3366
3380
|
onClick: r,
|
|
3367
3381
|
disabled: !r,
|
|
3368
3382
|
className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50",
|
|
3369
|
-
"aria-label": `Reload ${
|
|
3383
|
+
"aria-label": `Reload ${et(e)}`,
|
|
3370
3384
|
title: "Reload preview",
|
|
3371
3385
|
children: /* @__PURE__ */ u(oo, { className: "size-3.5" })
|
|
3372
3386
|
}
|
|
@@ -3375,40 +3389,40 @@ function ya({ path: e, kind: t, reloadKey: n = 0, onReload: r, className: o }) {
|
|
|
3375
3389
|
"a",
|
|
3376
3390
|
{
|
|
3377
3391
|
href: l,
|
|
3378
|
-
download:
|
|
3392
|
+
download: et(e),
|
|
3379
3393
|
className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3380
|
-
"aria-label": `Download ${
|
|
3394
|
+
"aria-label": `Download ${et(e)}`,
|
|
3381
3395
|
title: "Download",
|
|
3382
3396
|
children: /* @__PURE__ */ u(io, { className: "size-3.5" })
|
|
3383
3397
|
}
|
|
3384
3398
|
) : null
|
|
3385
3399
|
] })
|
|
3386
3400
|
] }),
|
|
3387
|
-
/* @__PURE__ */ u("div", { className: "flex min-h-0 flex-1 items-center justify-center overflow-auto p-4", children:
|
|
3401
|
+
/* @__PURE__ */ u("div", { className: "flex min-h-0 flex-1 items-center justify-center overflow-auto p-4", children: d ? /* @__PURE__ */ C("div", { className: "flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
3388
3402
|
/* @__PURE__ */ u(Rt, { className: "size-3.5" }),
|
|
3389
3403
|
/* @__PURE__ */ u("span", { children: "Loading preview..." })
|
|
3390
|
-
] }) :
|
|
3404
|
+
] }) : f || !l ? /* @__PURE__ */ u(nt, { title: "Failed to load preview", description: f ?? "Preview unavailable." }) : t === "image" ? /* @__PURE__ */ u(
|
|
3391
3405
|
"img",
|
|
3392
3406
|
{
|
|
3393
3407
|
src: l,
|
|
3394
|
-
alt:
|
|
3408
|
+
alt: et(e),
|
|
3395
3409
|
className: "max-h-full max-w-full rounded-md object-contain shadow-sm"
|
|
3396
3410
|
}
|
|
3397
3411
|
) : /* @__PURE__ */ u(
|
|
3398
3412
|
"iframe",
|
|
3399
3413
|
{
|
|
3400
3414
|
src: l,
|
|
3401
|
-
title:
|
|
3415
|
+
title: et(e),
|
|
3402
3416
|
className: "h-full min-h-[480px] w-full rounded-md border border-border bg-background"
|
|
3403
3417
|
}
|
|
3404
3418
|
) })
|
|
3405
|
-
] }) : /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(
|
|
3419
|
+
] }) : /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(nt, { title: "No file selected", description: "Choose an image or PDF from the file tree." }) });
|
|
3406
3420
|
}
|
|
3407
3421
|
function wa({ path: e }) {
|
|
3408
|
-
const [t, n] =
|
|
3422
|
+
const [t, n] = O(0), r = P(() => {
|
|
3409
3423
|
n((o) => o + 1);
|
|
3410
3424
|
}, []);
|
|
3411
|
-
return
|
|
3425
|
+
return L(() => {
|
|
3412
3426
|
if (!e) return;
|
|
3413
3427
|
const o = q.on(Q.changed, (l) => {
|
|
3414
3428
|
l.path === e && r();
|
|
@@ -3438,10 +3452,10 @@ function En({ params: e, className: t }) {
|
|
|
3438
3452
|
}
|
|
3439
3453
|
);
|
|
3440
3454
|
}
|
|
3441
|
-
function
|
|
3455
|
+
function xa(e, t) {
|
|
3442
3456
|
return `${e.replace(/\/$/, "")}${t}`;
|
|
3443
3457
|
}
|
|
3444
|
-
function
|
|
3458
|
+
function Sa(e) {
|
|
3445
3459
|
return e.split("/").pop() ?? e;
|
|
3446
3460
|
}
|
|
3447
3461
|
function ka(e) {
|
|
@@ -3474,7 +3488,7 @@ function Rr(e, t) {
|
|
|
3474
3488
|
}
|
|
3475
3489
|
function an(e, t, n) {
|
|
3476
3490
|
const r = new URLSearchParams({ path: t });
|
|
3477
|
-
return n && r.set("workspaceId", n),
|
|
3491
|
+
return n && r.set("workspaceId", n), xa(e, `/api/v1/files/raw?${r.toString()}`);
|
|
3478
3492
|
}
|
|
3479
3493
|
function lt(e, t, n, r) {
|
|
3480
3494
|
const o = Rr(t, n);
|
|
@@ -3506,24 +3520,24 @@ async function Nr(e, t, n) {
|
|
|
3506
3520
|
async function Ea(e) {
|
|
3507
3521
|
const { html: t, path: n, apiBaseUrl: r, headers: o, workspaceRequestId: i, signal: a } = e, l = new DOMParser().parseFromString(t, "text/html");
|
|
3508
3522
|
await Promise.all(
|
|
3509
|
-
Array.from(l.querySelectorAll('link[rel~="stylesheet"][href]')).map(async (
|
|
3510
|
-
const s =
|
|
3523
|
+
Array.from(l.querySelectorAll('link[rel~="stylesheet"][href]')).map(async (f) => {
|
|
3524
|
+
const s = f.getAttribute("href");
|
|
3511
3525
|
if (!s) return;
|
|
3512
|
-
const
|
|
3513
|
-
if (
|
|
3526
|
+
const d = Rr(n, s);
|
|
3527
|
+
if (d)
|
|
3514
3528
|
try {
|
|
3515
|
-
const p = await Nr(an(r,
|
|
3516
|
-
|
|
3529
|
+
const p = await Nr(an(r, d, i), o, a), m = l.createElement("style");
|
|
3530
|
+
m.setAttribute("data-boring-html-viewer-href", s), m.textContent = Wt(p, d, r, i), f.replaceWith(m);
|
|
3517
3531
|
} catch {
|
|
3518
|
-
|
|
3532
|
+
f.setAttribute("href", lt(r, n, s, i));
|
|
3519
3533
|
}
|
|
3520
3534
|
})
|
|
3521
3535
|
);
|
|
3522
|
-
for (const
|
|
3523
|
-
|
|
3524
|
-
for (const
|
|
3525
|
-
const s =
|
|
3526
|
-
s &&
|
|
3536
|
+
for (const f of Array.from(l.querySelectorAll("style")))
|
|
3537
|
+
f.hasAttribute("data-boring-html-viewer-href") || (f.textContent = Wt(f.textContent ?? "", n, r, i));
|
|
3538
|
+
for (const f of Array.from(l.querySelectorAll("[style]"))) {
|
|
3539
|
+
const s = f.getAttribute("style");
|
|
3540
|
+
s && f.setAttribute("style", Wt(s, n, r, i));
|
|
3527
3541
|
}
|
|
3528
3542
|
const c = [
|
|
3529
3543
|
["img", "src"],
|
|
@@ -3537,48 +3551,48 @@ async function Ea(e) {
|
|
|
3537
3551
|
["embed", "src"],
|
|
3538
3552
|
["link", "href"]
|
|
3539
3553
|
];
|
|
3540
|
-
for (const [
|
|
3541
|
-
for (const
|
|
3542
|
-
const p =
|
|
3543
|
-
p &&
|
|
3554
|
+
for (const [f, s] of c)
|
|
3555
|
+
for (const d of Array.from(l.querySelectorAll(`${f}[${s}]`))) {
|
|
3556
|
+
const p = d.getAttribute(s);
|
|
3557
|
+
p && d.setAttribute(s, lt(r, n, p, i));
|
|
3544
3558
|
}
|
|
3545
|
-
for (const
|
|
3546
|
-
const s =
|
|
3547
|
-
s &&
|
|
3559
|
+
for (const f of Array.from(l.querySelectorAll("[srcset]"))) {
|
|
3560
|
+
const s = f.getAttribute("srcset");
|
|
3561
|
+
s && f.setAttribute("srcset", Ca(s, n, r, i));
|
|
3548
3562
|
}
|
|
3549
3563
|
return `<!doctype html>
|
|
3550
3564
|
${l.documentElement.outerHTML}`;
|
|
3551
3565
|
}
|
|
3552
3566
|
function Ia({ path: e, className: t }) {
|
|
3553
|
-
const n = Ye(), r = Xe(), [o, i] =
|
|
3567
|
+
const n = Ye(), r = Xe(), [o, i] = O(null), [a, l] = O(null), [c, f] = O(!0), s = H(
|
|
3554
3568
|
() => an(n, e, r),
|
|
3555
3569
|
[n, e, r]
|
|
3556
|
-
), [
|
|
3570
|
+
), [d, p] = O(0), m = P(() => {
|
|
3557
3571
|
p((g) => g + 1);
|
|
3558
3572
|
}, []);
|
|
3559
|
-
return
|
|
3573
|
+
return L(() => {
|
|
3560
3574
|
const g = new AbortController();
|
|
3561
|
-
|
|
3562
|
-
const
|
|
3563
|
-
return r && (
|
|
3575
|
+
f(!0), l(null), i(null);
|
|
3576
|
+
const y = {};
|
|
3577
|
+
return r && (y["x-boring-workspace-id"] = r), Nr(s, y, g.signal).then(async (x) => {
|
|
3564
3578
|
i(await Ea({
|
|
3565
|
-
html:
|
|
3579
|
+
html: x,
|
|
3566
3580
|
path: e,
|
|
3567
3581
|
apiBaseUrl: n,
|
|
3568
|
-
headers:
|
|
3582
|
+
headers: y,
|
|
3569
3583
|
workspaceRequestId: r,
|
|
3570
3584
|
signal: g.signal
|
|
3571
3585
|
}));
|
|
3572
|
-
}).catch((
|
|
3573
|
-
g.signal.aborted || l(
|
|
3586
|
+
}).catch((x) => {
|
|
3587
|
+
g.signal.aborted || l(x instanceof Error ? x.message : "Failed to load HTML preview");
|
|
3574
3588
|
}).finally(() => {
|
|
3575
|
-
g.signal.aborted ||
|
|
3589
|
+
g.signal.aborted || f(!1);
|
|
3576
3590
|
}), () => g.abort();
|
|
3577
|
-
}, [n, e, s, r,
|
|
3591
|
+
}, [n, e, s, r, d]), e ? c ? /* @__PURE__ */ C("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
3578
3592
|
/* @__PURE__ */ u(Rt, { className: "size-3.5" }),
|
|
3579
3593
|
/* @__PURE__ */ u("span", { children: "Loading HTML preview..." })
|
|
3580
|
-
] }) : a || o === null ? /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(
|
|
3581
|
-
/* @__PURE__ */ u("div", { className: "flex shrink-0 items-center justify-end gap-3 border-b border-border/60 px-3 py-2", children: /* @__PURE__ */
|
|
3594
|
+
] }) : a || o === null ? /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(nt, { title: "Failed to load HTML preview", description: a ?? "Preview unavailable." }) }) : /* @__PURE__ */ C("div", { className: oe("flex h-full min-h-0 flex-col bg-background", t), children: [
|
|
3595
|
+
/* @__PURE__ */ u("div", { className: "flex shrink-0 items-center justify-end gap-3 border-b border-border/60 px-3 py-2", children: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
|
|
3582
3596
|
/* @__PURE__ */ u(
|
|
3583
3597
|
ge,
|
|
3584
3598
|
{
|
|
@@ -3586,7 +3600,7 @@ function Ia({ path: e, className: t }) {
|
|
|
3586
3600
|
variant: "ghost",
|
|
3587
3601
|
size: "icon-xs",
|
|
3588
3602
|
className: "text-muted-foreground hover:text-foreground",
|
|
3589
|
-
onClick:
|
|
3603
|
+
onClick: m,
|
|
3590
3604
|
"aria-label": "Refresh preview",
|
|
3591
3605
|
title: "Refresh preview",
|
|
3592
3606
|
children: /* @__PURE__ */ u(so, { className: "h-3.5 w-3.5", strokeWidth: 1.75 })
|
|
@@ -3609,12 +3623,12 @@ function Ia({ path: e, className: t }) {
|
|
|
3609
3623
|
"iframe",
|
|
3610
3624
|
{
|
|
3611
3625
|
srcDoc: o,
|
|
3612
|
-
title:
|
|
3626
|
+
title: Sa(e),
|
|
3613
3627
|
sandbox: "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",
|
|
3614
3628
|
className: "min-h-0 flex-1 border-0 bg-white"
|
|
3615
3629
|
}
|
|
3616
3630
|
)
|
|
3617
|
-
] }) : /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(
|
|
3631
|
+
] }) : /* @__PURE__ */ u("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u(nt, { title: "No file selected", description: "Choose an HTML file from the file tree." }) });
|
|
3618
3632
|
}
|
|
3619
3633
|
function Ra({ params: e, className: t }) {
|
|
3620
3634
|
return /* @__PURE__ */ u(Ia, { path: (e == null ? void 0 : e.path) ?? "", className: t });
|
|
@@ -3627,7 +3641,7 @@ function Na({ params: e }) {
|
|
|
3627
3641
|
className: "border-0",
|
|
3628
3642
|
title: "No editor available",
|
|
3629
3643
|
description: n ? `Install or enable a plugin that handles *.${n} files.` : "Install or enable a plugin that handles this file type.",
|
|
3630
|
-
children: /* @__PURE__ */ u(
|
|
3644
|
+
children: /* @__PURE__ */ u(tt, { children: t })
|
|
3631
3645
|
}
|
|
3632
3646
|
) });
|
|
3633
3647
|
}
|
|
@@ -3768,7 +3782,7 @@ function _a({
|
|
|
3768
3782
|
async search({ query: n, limit: r, signal: o }) {
|
|
3769
3783
|
const i = n.trim();
|
|
3770
3784
|
if (!i || o != null && o.aborted) return Rn();
|
|
3771
|
-
const a = await e.search(
|
|
3785
|
+
const a = await e.search(xr(i), r, o);
|
|
3772
3786
|
return o != null && o.aborted ? Rn() : {
|
|
3773
3787
|
items: a.map($a),
|
|
3774
3788
|
total: a.length,
|
|
@@ -3798,13 +3812,13 @@ function Oa({
|
|
|
3798
3812
|
);
|
|
3799
3813
|
}
|
|
3800
3814
|
function Ma() {
|
|
3801
|
-
return
|
|
3815
|
+
return L(() => {
|
|
3802
3816
|
Js();
|
|
3803
3817
|
}, []), mr("."), null;
|
|
3804
3818
|
}
|
|
3805
3819
|
function Wa() {
|
|
3806
3820
|
const e = Me(), t = Ft();
|
|
3807
|
-
return
|
|
3821
|
+
return L(() => {
|
|
3808
3822
|
const n = t.get(bt);
|
|
3809
3823
|
if (n && n.pluginId !== wt) return;
|
|
3810
3824
|
const r = _a({
|
|
@@ -3991,7 +4005,7 @@ function qa() {
|
|
|
3991
4005
|
function Yl() {
|
|
3992
4006
|
return qa() === "full-page";
|
|
3993
4007
|
}
|
|
3994
|
-
const Va = K.string().max(64).regex(/^[a-zA-Z0-9_-]+$/),
|
|
4008
|
+
const Va = K.string().max(64).regex(/^[a-zA-Z0-9_-]+$/), xt = K.string().max(1024), Ka = K.number().nonnegative(), Ha = K.object({
|
|
3995
4009
|
collapsed: K.boolean(),
|
|
3996
4010
|
width: K.number().int().positive()
|
|
3997
4011
|
}), Ga = K.record(Va, Ka), Ja = K.object({
|
|
@@ -4000,12 +4014,12 @@ const Va = K.string().max(64).regex(/^[a-zA-Z0-9_-]+$/), St = K.string().max(102
|
|
|
4000
4014
|
height: K.number().nonnegative().optional(),
|
|
4001
4015
|
orientation: K.number().optional()
|
|
4002
4016
|
}).passthrough(), Ya = K.object({
|
|
4003
|
-
id:
|
|
4004
|
-
contentComponent:
|
|
4005
|
-
title:
|
|
4017
|
+
id: xt,
|
|
4018
|
+
contentComponent: xt.optional(),
|
|
4019
|
+
title: xt.optional()
|
|
4006
4020
|
}).passthrough(), Xa = K.object({
|
|
4007
4021
|
grid: Ja,
|
|
4008
|
-
panels: K.record(
|
|
4022
|
+
panels: K.record(xt, Ya)
|
|
4009
4023
|
}).passthrough().nullable(), Qa = K.object({
|
|
4010
4024
|
layout: Xa,
|
|
4011
4025
|
sidebar: Ha,
|
|
@@ -4053,7 +4067,7 @@ function nc(e) {
|
|
|
4053
4067
|
function Fr(e = {}) {
|
|
4054
4068
|
const t = e.storageKey ?? (e.workspaceId ? `boring-ui-v2:layout:${e.workspaceId}` : "boring-ui-v2:layout"), n = "boring-ui-v2:preferences", r = e.persistenceEnabled === !1, o = r ? { theme: "light" } : nc(n), i = zo()(
|
|
4055
4069
|
jo(
|
|
4056
|
-
(c,
|
|
4070
|
+
(c, f) => ({
|
|
4057
4071
|
hydrationComplete: !1,
|
|
4058
4072
|
layout: null,
|
|
4059
4073
|
sidebar: { collapsed: !1, width: 260 },
|
|
@@ -4067,41 +4081,41 @@ function Fr(e = {}) {
|
|
|
4067
4081
|
notifications: [],
|
|
4068
4082
|
setHydrationComplete: (s) => c({ hydrationComplete: s }),
|
|
4069
4083
|
setLayout: (s) => c({ layout: s }),
|
|
4070
|
-
setSidebar: (s) => c({ sidebar: { ...
|
|
4071
|
-
setPanelSize: (s,
|
|
4084
|
+
setSidebar: (s) => c({ sidebar: { ...f().sidebar, ...s } }),
|
|
4085
|
+
setPanelSize: (s, d) => c({ panelSizes: { ...f().panelSizes, [s]: d } }),
|
|
4072
4086
|
setTheme: (s) => {
|
|
4073
4087
|
c({ preferences: { theme: s } }), r || Dn(
|
|
4074
4088
|
n,
|
|
4075
4089
|
JSON.stringify({ state: { theme: s }, version: 0 })
|
|
4076
4090
|
);
|
|
4077
4091
|
},
|
|
4078
|
-
openPanel: (s) => c((
|
|
4079
|
-
panels:
|
|
4092
|
+
openPanel: (s) => c((d) => ({
|
|
4093
|
+
panels: d.panels.some((m) => m.id === s.id) ? d.panels : [...d.panels, s],
|
|
4080
4094
|
activePanel: s.id
|
|
4081
4095
|
})),
|
|
4082
|
-
closePanel: (s) => c((
|
|
4083
|
-
panels:
|
|
4084
|
-
activePanel:
|
|
4096
|
+
closePanel: (s) => c((d) => ({
|
|
4097
|
+
panels: d.panels.filter((p) => p.id !== s),
|
|
4098
|
+
activePanel: d.activePanel === s ? null : d.activePanel
|
|
4085
4099
|
})),
|
|
4086
4100
|
activatePanel: (s) => c({ activePanel: s }),
|
|
4087
|
-
openFile: (s,
|
|
4101
|
+
openFile: (s, d) => c((p) => ({
|
|
4088
4102
|
activeFile: s,
|
|
4089
4103
|
visibleFiles: p.visibleFiles.includes(s) ? p.visibleFiles : [...p.visibleFiles, s],
|
|
4090
|
-
activePanel:
|
|
4104
|
+
activePanel: d ?? p.activePanel
|
|
4091
4105
|
})),
|
|
4092
|
-
markDirty: (s,
|
|
4106
|
+
markDirty: (s, d) => c((p) => ({
|
|
4093
4107
|
dirtyFiles: {
|
|
4094
4108
|
...p.dirtyFiles,
|
|
4095
|
-
[s]: { panelId:
|
|
4109
|
+
[s]: { panelId: d, savedAt: null }
|
|
4096
4110
|
}
|
|
4097
4111
|
})),
|
|
4098
|
-
markClean: (s) => c((
|
|
4099
|
-
const { [s]: p, ...
|
|
4100
|
-
return { dirtyFiles:
|
|
4112
|
+
markClean: (s) => c((d) => {
|
|
4113
|
+
const { [s]: p, ...m } = d.dirtyFiles;
|
|
4114
|
+
return { dirtyFiles: m };
|
|
4101
4115
|
}),
|
|
4102
|
-
showNotification: (s) => c((
|
|
4116
|
+
showNotification: (s) => c((d) => ({
|
|
4103
4117
|
notifications: [
|
|
4104
|
-
...
|
|
4118
|
+
...d.notifications,
|
|
4105
4119
|
{
|
|
4106
4120
|
...s,
|
|
4107
4121
|
id: crypto.randomUUID(),
|
|
@@ -4109,10 +4123,10 @@ function Fr(e = {}) {
|
|
|
4109
4123
|
}
|
|
4110
4124
|
]
|
|
4111
4125
|
})),
|
|
4112
|
-
dismissNotification: (s) => c((
|
|
4113
|
-
notifications:
|
|
4126
|
+
dismissNotification: (s) => c((d) => ({
|
|
4127
|
+
notifications: d.notifications.filter((p) => p.id !== s)
|
|
4114
4128
|
})),
|
|
4115
|
-
navigateToLine: (s,
|
|
4129
|
+
navigateToLine: (s, d) => c({ activeFile: s }),
|
|
4116
4130
|
resetLayout: () => {
|
|
4117
4131
|
localStorage.removeItem(t), c({
|
|
4118
4132
|
layout: null,
|
|
@@ -4136,22 +4150,22 @@ function Fr(e = {}) {
|
|
|
4136
4150
|
} } : {
|
|
4137
4151
|
getItem: (c) => {
|
|
4138
4152
|
try {
|
|
4139
|
-
const
|
|
4140
|
-
if (!
|
|
4141
|
-
const s = JSON.parse(
|
|
4153
|
+
const f = localStorage.getItem(c);
|
|
4154
|
+
if (!f) return null;
|
|
4155
|
+
const s = JSON.parse(f);
|
|
4142
4156
|
if ((s == null ? void 0 : s.version) !== void 0 && String(s.version) !== An)
|
|
4143
4157
|
return e.onLayoutVersionMismatch ? e.onLayoutVersionMismatch() : localStorage.removeItem(c), null;
|
|
4144
|
-
const
|
|
4145
|
-
return
|
|
4158
|
+
const d = ec(s == null ? void 0 : s.state);
|
|
4159
|
+
return d ? { ...s, state: d } : (console.error("Layout restored with defaults"), null);
|
|
4146
4160
|
} catch {
|
|
4147
4161
|
return console.error("Layout restored with defaults"), null;
|
|
4148
4162
|
}
|
|
4149
4163
|
},
|
|
4150
|
-
setItem: (c,
|
|
4151
|
-
const s = { ...
|
|
4152
|
-
|
|
4153
|
-
`Workspace state serialized to ${
|
|
4154
|
-
), Dn(c,
|
|
4164
|
+
setItem: (c, f) => {
|
|
4165
|
+
const s = { ...f, version: An }, d = JSON.stringify(s);
|
|
4166
|
+
d.length > Tn && console.warn(
|
|
4167
|
+
`Workspace state serialized to ${d.length} bytes (budget: <${Tn})`
|
|
4168
|
+
), Dn(c, d);
|
|
4155
4169
|
},
|
|
4156
4170
|
removeItem: (c) => {
|
|
4157
4171
|
localStorage.removeItem(c);
|
|
@@ -4257,19 +4271,19 @@ function sc({
|
|
|
4257
4271
|
searchQuery: r,
|
|
4258
4272
|
close: o
|
|
4259
4273
|
}) {
|
|
4260
|
-
const i = H(() => n || r ? [] : oc(cn(), e, t), [n, r, e, t]), a =
|
|
4261
|
-
$n(
|
|
4262
|
-
}, [o]), l =
|
|
4263
|
-
(
|
|
4264
|
-
_n(
|
|
4274
|
+
const i = H(() => n || r ? [] : oc(cn(), e, t), [n, r, e, t]), a = P((f, s) => {
|
|
4275
|
+
$n(f.id, s), f.onSelect(s), o();
|
|
4276
|
+
}, [o]), l = P(
|
|
4277
|
+
(f) => {
|
|
4278
|
+
_n(f.id, f.title), f.run(), o();
|
|
4265
4279
|
},
|
|
4266
4280
|
[o]
|
|
4267
|
-
), c =
|
|
4268
|
-
if (
|
|
4269
|
-
const s = e.find((
|
|
4270
|
-
s && ($n(s.id,
|
|
4281
|
+
), c = P((f) => {
|
|
4282
|
+
if (f.type === "catalog") {
|
|
4283
|
+
const s = e.find((d) => d.id === f.catalogId);
|
|
4284
|
+
s && ($n(s.id, f.rowSnapshot), s.onSelect(f.rowSnapshot));
|
|
4271
4285
|
} else {
|
|
4272
|
-
const s = t.find((
|
|
4286
|
+
const s = t.find((d) => d.id === f.commandId);
|
|
4273
4287
|
s && (_n(s.id, s.title), s.run());
|
|
4274
4288
|
}
|
|
4275
4289
|
o();
|
|
@@ -4288,22 +4302,22 @@ function ac({
|
|
|
4288
4302
|
setMode: r,
|
|
4289
4303
|
setQuery: o
|
|
4290
4304
|
}) {
|
|
4291
|
-
const i =
|
|
4292
|
-
|
|
4305
|
+
const i = A(null), a = A(null), l = A(!1);
|
|
4306
|
+
L(() => {
|
|
4293
4307
|
if (!e) return;
|
|
4294
4308
|
const p = (g) => {
|
|
4295
4309
|
g.key === "Escape" && (g.preventDefault(), g.stopPropagation(), t(!1));
|
|
4296
|
-
},
|
|
4297
|
-
const
|
|
4298
|
-
if (!
|
|
4299
|
-
const
|
|
4300
|
-
|
|
4310
|
+
}, m = (g) => {
|
|
4311
|
+
const y = g.target;
|
|
4312
|
+
if (!y) return;
|
|
4313
|
+
const x = document.querySelector('[data-slot="dialog-content"]');
|
|
4314
|
+
x && !x.contains(y) && (g.preventDefault(), g.stopPropagation(), t(!1));
|
|
4301
4315
|
};
|
|
4302
|
-
return window.addEventListener("keydown", p, { capture: !0 }), window.addEventListener("pointerdown",
|
|
4303
|
-
window.removeEventListener("keydown", p, { capture: !0 }), window.removeEventListener("pointerdown",
|
|
4316
|
+
return window.addEventListener("keydown", p, { capture: !0 }), window.addEventListener("pointerdown", m, { capture: !0 }), () => {
|
|
4317
|
+
window.removeEventListener("keydown", p, { capture: !0 }), window.removeEventListener("pointerdown", m, { capture: !0 });
|
|
4304
4318
|
};
|
|
4305
4319
|
}, [e, t]);
|
|
4306
|
-
const c =
|
|
4320
|
+
const c = P(() => {
|
|
4307
4321
|
!e && document.activeElement instanceof HTMLElement && (a.current = document.activeElement), t(!0);
|
|
4308
4322
|
}, [e, t]);
|
|
4309
4323
|
Pr({
|
|
@@ -4314,7 +4328,7 @@ function ac({
|
|
|
4314
4328
|
],
|
|
4315
4329
|
[c]
|
|
4316
4330
|
)
|
|
4317
|
-
}),
|
|
4331
|
+
}), L(() => {
|
|
4318
4332
|
if (e)
|
|
4319
4333
|
o(""), r("catalogs"), requestAnimationFrame(() => {
|
|
4320
4334
|
var p;
|
|
@@ -4326,20 +4340,20 @@ function ac({
|
|
|
4326
4340
|
}
|
|
4327
4341
|
l.current = e;
|
|
4328
4342
|
}, [e, r, o]);
|
|
4329
|
-
const
|
|
4330
|
-
r(p), o((
|
|
4331
|
-
var
|
|
4332
|
-
return (
|
|
4343
|
+
const f = P((p) => {
|
|
4344
|
+
r(p), o((m) => m.replace(/^>\s*/, "")), requestAnimationFrame(() => {
|
|
4345
|
+
var m;
|
|
4346
|
+
return (m = i.current) == null ? void 0 : m.focus();
|
|
4333
4347
|
});
|
|
4334
|
-
}, [r, o]), s =
|
|
4335
|
-
|
|
4336
|
-
}, [n,
|
|
4348
|
+
}, [r, o]), s = P(() => {
|
|
4349
|
+
f(n === "commands" ? "catalogs" : "commands");
|
|
4350
|
+
}, [n, f]), d = P((p) => {
|
|
4337
4351
|
p.key === "Tab" && (p.preventDefault(), p.stopPropagation(), s());
|
|
4338
4352
|
}, [s]);
|
|
4339
4353
|
return {
|
|
4340
4354
|
inputRef: i,
|
|
4341
|
-
switchMode:
|
|
4342
|
-
handleInputKeyDown:
|
|
4355
|
+
switchMode: f,
|
|
4356
|
+
handleInputKeyDown: d
|
|
4343
4357
|
};
|
|
4344
4358
|
}
|
|
4345
4359
|
function cc({
|
|
@@ -4347,67 +4361,67 @@ function cc({
|
|
|
4347
4361
|
isCommandMode: t,
|
|
4348
4362
|
searchQuery: n
|
|
4349
4363
|
}) {
|
|
4350
|
-
const [r, o] =
|
|
4351
|
-
return
|
|
4364
|
+
const [r, o] = O(""), [i, a] = O([]);
|
|
4365
|
+
return L(() => {
|
|
4352
4366
|
if (t) {
|
|
4353
4367
|
o("");
|
|
4354
4368
|
return;
|
|
4355
4369
|
}
|
|
4356
4370
|
const l = setTimeout(() => o(n), 180);
|
|
4357
4371
|
return () => clearTimeout(l);
|
|
4358
|
-
}, [t, n]),
|
|
4372
|
+
}, [t, n]), L(() => {
|
|
4359
4373
|
if (t || !r) {
|
|
4360
4374
|
a([]);
|
|
4361
4375
|
return;
|
|
4362
4376
|
}
|
|
4363
4377
|
const l = new AbortController(), c = [...e];
|
|
4364
4378
|
a((s) => {
|
|
4365
|
-
const
|
|
4379
|
+
const d = new Map(s.map((p) => [p.catalog.id, p]));
|
|
4366
4380
|
return c.map((p) => {
|
|
4367
|
-
const
|
|
4381
|
+
const m = d.get(p.id);
|
|
4368
4382
|
return {
|
|
4369
4383
|
catalog: p,
|
|
4370
|
-
rows: (
|
|
4384
|
+
rows: (m == null ? void 0 : m.rows) ?? [],
|
|
4371
4385
|
loading: !0
|
|
4372
4386
|
};
|
|
4373
4387
|
});
|
|
4374
4388
|
});
|
|
4375
|
-
const
|
|
4389
|
+
const f = (s, d) => {
|
|
4376
4390
|
l.signal.aborted || a(
|
|
4377
4391
|
(p) => p.map(
|
|
4378
|
-
(
|
|
4392
|
+
(m) => m.catalog.id === s.id ? { catalog: s, ...d } : m
|
|
4379
4393
|
)
|
|
4380
4394
|
);
|
|
4381
4395
|
};
|
|
4382
4396
|
for (const s of c)
|
|
4383
4397
|
try {
|
|
4384
|
-
const
|
|
4398
|
+
const d = s.adapter.search({
|
|
4385
4399
|
query: r,
|
|
4386
4400
|
filters: {},
|
|
4387
4401
|
limit: Ct,
|
|
4388
4402
|
offset: 0,
|
|
4389
4403
|
signal: l.signal
|
|
4390
4404
|
});
|
|
4391
|
-
Promise.resolve(
|
|
4405
|
+
Promise.resolve(d).then(
|
|
4392
4406
|
(p) => {
|
|
4393
|
-
|
|
4407
|
+
f(s, {
|
|
4394
4408
|
rows: p.items.slice(0, Ct),
|
|
4395
4409
|
loading: !1
|
|
4396
4410
|
});
|
|
4397
4411
|
},
|
|
4398
4412
|
(p) => {
|
|
4399
|
-
|
|
4413
|
+
f(s, {
|
|
4400
4414
|
rows: [],
|
|
4401
4415
|
loading: !1,
|
|
4402
4416
|
error: Ln(p)
|
|
4403
4417
|
});
|
|
4404
4418
|
}
|
|
4405
4419
|
);
|
|
4406
|
-
} catch (
|
|
4407
|
-
|
|
4420
|
+
} catch (d) {
|
|
4421
|
+
f(s, {
|
|
4408
4422
|
rows: [],
|
|
4409
4423
|
loading: !1,
|
|
4410
|
-
error: Ln(
|
|
4424
|
+
error: Ln(d)
|
|
4411
4425
|
});
|
|
4412
4426
|
}
|
|
4413
4427
|
return () => {
|
|
@@ -4416,40 +4430,40 @@ function cc({
|
|
|
4416
4430
|
}, [e, r, t]), i;
|
|
4417
4431
|
}
|
|
4418
4432
|
function lc(e) {
|
|
4419
|
-
const [t, n] =
|
|
4420
|
-
const
|
|
4421
|
-
for (const
|
|
4422
|
-
|
|
4423
|
-
return
|
|
4424
|
-
}, [
|
|
4433
|
+
const [t, n] = O(!1), [r, o] = O(""), [i, a] = O("catalogs"), l = ai(), c = si(), f = pl(), s = H(() => {
|
|
4434
|
+
const w = {};
|
|
4435
|
+
for (const N of (f == null ? void 0 : f.registeredPlugins) ?? [])
|
|
4436
|
+
N.label && (w[N.id] = N.label);
|
|
4437
|
+
return w;
|
|
4438
|
+
}, [f == null ? void 0 : f.registeredPlugins]), d = i === "commands", p = r.trim(), m = cc({
|
|
4425
4439
|
catalogs: l,
|
|
4426
|
-
isCommandMode:
|
|
4440
|
+
isCommandMode: d,
|
|
4427
4441
|
searchQuery: p
|
|
4428
|
-
}), { inputRef: g, switchMode:
|
|
4442
|
+
}), { inputRef: g, switchMode: y, handleInputKeyDown: x } = ac({
|
|
4429
4443
|
open: t,
|
|
4430
4444
|
setOpen: n,
|
|
4431
4445
|
mode: i,
|
|
4432
4446
|
setMode: a,
|
|
4433
4447
|
setQuery: o
|
|
4434
|
-
}),
|
|
4435
|
-
if (
|
|
4436
|
-
a("commands"), o(
|
|
4448
|
+
}), k = P((w) => {
|
|
4449
|
+
if (w.startsWith(">")) {
|
|
4450
|
+
a("commands"), o(w.slice(1));
|
|
4437
4451
|
return;
|
|
4438
4452
|
}
|
|
4439
|
-
o(
|
|
4440
|
-
}, []),
|
|
4441
|
-
recentEntries:
|
|
4442
|
-
handleCatalogSelect:
|
|
4443
|
-
handleCommandSelect:
|
|
4444
|
-
handleRecentSelect:
|
|
4453
|
+
o(w);
|
|
4454
|
+
}, []), $ = H(() => d ? rc(c, p) : [], [c, d, p]), {
|
|
4455
|
+
recentEntries: D,
|
|
4456
|
+
handleCatalogSelect: h,
|
|
4457
|
+
handleCommandSelect: M,
|
|
4458
|
+
handleRecentSelect: v
|
|
4445
4459
|
} = sc({
|
|
4446
4460
|
catalogs: l,
|
|
4447
4461
|
commands: c,
|
|
4448
|
-
isCommandMode:
|
|
4462
|
+
isCommandMode: d,
|
|
4449
4463
|
searchQuery: p,
|
|
4450
4464
|
close: () => n(!1)
|
|
4451
4465
|
});
|
|
4452
|
-
return /* @__PURE__ */ u(Eo, { open: t, onOpenChange: n, children: /* @__PURE__ */
|
|
4466
|
+
return /* @__PURE__ */ u(Eo, { open: t, onOpenChange: n, children: /* @__PURE__ */ C(
|
|
4453
4467
|
Io,
|
|
4454
4468
|
{
|
|
4455
4469
|
className: "cmdk-shell flex flex-col gap-0 overflow-hidden border-border/60 p-0 shadow-2xl backdrop-blur-md [&>button.dialog-close]:hidden",
|
|
@@ -4458,60 +4472,60 @@ function lc(e) {
|
|
|
4458
4472
|
onPointerDownOutside: () => n(!1),
|
|
4459
4473
|
onEscapeKeyDown: () => n(!1),
|
|
4460
4474
|
children: [
|
|
4461
|
-
/* @__PURE__ */
|
|
4475
|
+
/* @__PURE__ */ C(Ro, { className: "sr-only", children: [
|
|
4462
4476
|
/* @__PURE__ */ u(No, { children: "Command Palette" }),
|
|
4463
4477
|
/* @__PURE__ */ u(To, { children: "Search catalogs or switch to commands" })
|
|
4464
4478
|
] }),
|
|
4465
|
-
/* @__PURE__ */
|
|
4479
|
+
/* @__PURE__ */ C(Ao, { shouldFilter: !1, className: "flex min-h-0 flex-1 flex-col bg-transparent", children: [
|
|
4466
4480
|
/* @__PURE__ */ u(
|
|
4467
4481
|
uc,
|
|
4468
4482
|
{
|
|
4469
4483
|
inputRef: g,
|
|
4470
|
-
isCommandMode:
|
|
4484
|
+
isCommandMode: d,
|
|
4471
4485
|
query: r,
|
|
4472
|
-
onQueryChange:
|
|
4473
|
-
onInputKeyDown:
|
|
4474
|
-
onSwitchMode:
|
|
4475
|
-
loading: !
|
|
4486
|
+
onQueryChange: k,
|
|
4487
|
+
onInputKeyDown: x,
|
|
4488
|
+
onSwitchMode: y,
|
|
4489
|
+
loading: !d && m.some((w) => w.loading)
|
|
4476
4490
|
}
|
|
4477
4491
|
),
|
|
4478
|
-
/* @__PURE__ */
|
|
4492
|
+
/* @__PURE__ */ C(
|
|
4479
4493
|
Fo,
|
|
4480
4494
|
{
|
|
4481
4495
|
className: "min-h-0 flex-1 overflow-y-auto py-1",
|
|
4482
4496
|
style: { maxHeight: "none" },
|
|
4483
4497
|
children: [
|
|
4484
|
-
/* @__PURE__ */ u(Do, { className: "py-10 text-center text-sm text-muted-foreground", children:
|
|
4498
|
+
/* @__PURE__ */ u(Do, { className: "py-10 text-center text-sm text-muted-foreground", children: d ? "No matching commands" : "No catalog results" }),
|
|
4485
4499
|
/* @__PURE__ */ u(
|
|
4486
4500
|
dc,
|
|
4487
4501
|
{
|
|
4488
|
-
isCommandMode:
|
|
4489
|
-
recentEntries:
|
|
4502
|
+
isCommandMode: d,
|
|
4503
|
+
recentEntries: D,
|
|
4490
4504
|
searchQuery: p,
|
|
4491
|
-
onRecentSelect:
|
|
4505
|
+
onRecentSelect: v
|
|
4492
4506
|
}
|
|
4493
4507
|
),
|
|
4494
4508
|
/* @__PURE__ */ u(
|
|
4495
4509
|
fc,
|
|
4496
4510
|
{
|
|
4497
|
-
catalogGroups:
|
|
4498
|
-
isCommandMode:
|
|
4499
|
-
onCatalogSelect:
|
|
4511
|
+
catalogGroups: m,
|
|
4512
|
+
isCommandMode: d,
|
|
4513
|
+
onCatalogSelect: h
|
|
4500
4514
|
}
|
|
4501
4515
|
),
|
|
4502
4516
|
/* @__PURE__ */ u(
|
|
4503
4517
|
mc,
|
|
4504
4518
|
{
|
|
4505
|
-
commandResults:
|
|
4506
|
-
isCommandMode:
|
|
4519
|
+
commandResults: $,
|
|
4520
|
+
isCommandMode: d,
|
|
4507
4521
|
pluginLabelMap: s,
|
|
4508
|
-
onCommandSelect:
|
|
4522
|
+
onCommandSelect: M
|
|
4509
4523
|
}
|
|
4510
4524
|
)
|
|
4511
4525
|
]
|
|
4512
4526
|
}
|
|
4513
4527
|
),
|
|
4514
|
-
/* @__PURE__ */ u(hc, { isCommandMode:
|
|
4528
|
+
/* @__PURE__ */ u(hc, { isCommandMode: d })
|
|
4515
4529
|
] })
|
|
4516
4530
|
]
|
|
4517
4531
|
}
|
|
@@ -4526,9 +4540,9 @@ function uc({
|
|
|
4526
4540
|
onSwitchMode: i,
|
|
4527
4541
|
loading: a
|
|
4528
4542
|
}) {
|
|
4529
|
-
return /* @__PURE__ */
|
|
4530
|
-
/* @__PURE__ */
|
|
4531
|
-
/* @__PURE__ */
|
|
4543
|
+
return /* @__PURE__ */ C("div", { className: "relative shrink-0", children: [
|
|
4544
|
+
/* @__PURE__ */ C("div", { className: "relative flex items-stretch [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:h-auto", children: [
|
|
4545
|
+
/* @__PURE__ */ C(
|
|
4532
4546
|
"div",
|
|
4533
4547
|
{
|
|
4534
4548
|
role: "group",
|
|
@@ -4591,10 +4605,10 @@ function dc({
|
|
|
4591
4605
|
value: i,
|
|
4592
4606
|
onSelect: () => r(o),
|
|
4593
4607
|
className: "group flex items-center gap-3 rounded-md px-3 py-2 text-sm aria-selected:bg-[color:oklch(from_var(--accent)_l_c_h/0.10)] aria-selected:text-foreground",
|
|
4594
|
-
children: o.type === "catalog" ? /* @__PURE__ */
|
|
4608
|
+
children: o.type === "catalog" ? /* @__PURE__ */ C(_e, { children: [
|
|
4595
4609
|
/* @__PURE__ */ u(co, { className: "size-4 shrink-0 text-muted-foreground/70 group-aria-selected:text-[color:var(--accent)]" }),
|
|
4596
4610
|
/* @__PURE__ */ u(Mr, { row: o.rowSnapshot })
|
|
4597
|
-
] }) : /* @__PURE__ */
|
|
4611
|
+
] }) : /* @__PURE__ */ C(_e, { children: [
|
|
4598
4612
|
/* @__PURE__ */ u(Yt, { className: "size-4 shrink-0 text-muted-foreground/70 group-aria-selected:text-[color:var(--accent)]" }),
|
|
4599
4613
|
/* @__PURE__ */ u("span", { className: "flex-1 truncate", children: o.titleSnapshot }),
|
|
4600
4614
|
/* @__PURE__ */ u("span", { className: "shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground", children: "command" })
|
|
@@ -4609,7 +4623,7 @@ function fc({
|
|
|
4609
4623
|
isCommandMode: t,
|
|
4610
4624
|
onCatalogSelect: n
|
|
4611
4625
|
}) {
|
|
4612
|
-
return t ? null : /* @__PURE__ */ u(_e, { children: e.filter((r) => r.error || r.rows.length > 0).map((r) => /* @__PURE__ */
|
|
4626
|
+
return t ? null : /* @__PURE__ */ u(_e, { children: e.filter((r) => r.error || r.rows.length > 0).map((r) => /* @__PURE__ */ C(Xt, { heading: r.catalog.label, children: [
|
|
4613
4627
|
r.error ? /* @__PURE__ */ u(pc, { catalogId: r.catalog.id, error: r.error }) : null,
|
|
4614
4628
|
r.rows.map((o) => /* @__PURE__ */ u(
|
|
4615
4629
|
Nt,
|
|
@@ -4617,7 +4631,7 @@ function fc({
|
|
|
4617
4631
|
value: `${r.catalog.id}:${o.id}`,
|
|
4618
4632
|
onSelect: () => n(r.catalog, o),
|
|
4619
4633
|
className: "group flex items-center gap-3 rounded-md px-3 py-2 text-sm aria-selected:bg-[color:oklch(from_var(--accent)_l_c_h/0.10)] aria-selected:text-foreground",
|
|
4620
|
-
children: /* @__PURE__ */
|
|
4634
|
+
children: /* @__PURE__ */ C(
|
|
4621
4635
|
Dt,
|
|
4622
4636
|
{
|
|
4623
4637
|
pluginId: r.catalog.pluginId ?? r.catalog.id,
|
|
@@ -4635,7 +4649,7 @@ function fc({
|
|
|
4635
4649
|
] }, r.catalog.id)) });
|
|
4636
4650
|
}
|
|
4637
4651
|
function pc({ catalogId: e, error: t }) {
|
|
4638
|
-
return /* @__PURE__ */
|
|
4652
|
+
return /* @__PURE__ */ C(
|
|
4639
4653
|
Nt,
|
|
4640
4654
|
{
|
|
4641
4655
|
value: `${e}:error`,
|
|
@@ -4654,7 +4668,7 @@ function mc({
|
|
|
4654
4668
|
pluginLabelMap: n,
|
|
4655
4669
|
onCommandSelect: r
|
|
4656
4670
|
}) {
|
|
4657
|
-
return !t || e.length === 0 ? null : /* @__PURE__ */ u(Xt, { heading: "Commands", children: e.map((o) => /* @__PURE__ */
|
|
4671
|
+
return !t || e.length === 0 ? null : /* @__PURE__ */ u(Xt, { heading: "Commands", children: e.map((o) => /* @__PURE__ */ C(
|
|
4658
4672
|
Nt,
|
|
4659
4673
|
{
|
|
4660
4674
|
value: o.title,
|
|
@@ -4671,24 +4685,24 @@ function mc({
|
|
|
4671
4685
|
)) });
|
|
4672
4686
|
}
|
|
4673
4687
|
function hc({ isCommandMode: e }) {
|
|
4674
|
-
return /* @__PURE__ */
|
|
4688
|
+
return /* @__PURE__ */ C("div", { className: "flex items-center justify-between border-t border-border/50 bg-muted/30 px-3 py-2 text-[11px] text-muted-foreground", children: [
|
|
4675
4689
|
/* @__PURE__ */ u("span", { className: "font-medium tracking-wide uppercase", children: e ? "Commands" : Dr }),
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */ u(
|
|
4690
|
+
/* @__PURE__ */ C("div", { className: "flex items-center gap-3", children: [
|
|
4691
|
+
/* @__PURE__ */ C("span", { className: "flex items-center gap-1", children: [
|
|
4692
|
+
/* @__PURE__ */ u(tt, { children: "tab" }),
|
|
4679
4693
|
/* @__PURE__ */ u("span", { children: "switch" })
|
|
4680
4694
|
] }),
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
/* @__PURE__ */ u(
|
|
4683
|
-
/* @__PURE__ */ u(
|
|
4695
|
+
/* @__PURE__ */ C("span", { className: "flex items-center gap-1", children: [
|
|
4696
|
+
/* @__PURE__ */ u(tt, { children: /* @__PURE__ */ u(lo, { className: "size-3" }) }),
|
|
4697
|
+
/* @__PURE__ */ u(tt, { children: /* @__PURE__ */ u(uo, { className: "size-3" }) }),
|
|
4684
4698
|
/* @__PURE__ */ u("span", { children: "navigate" })
|
|
4685
4699
|
] }),
|
|
4686
|
-
/* @__PURE__ */
|
|
4687
|
-
/* @__PURE__ */ u(
|
|
4700
|
+
/* @__PURE__ */ C("span", { className: "flex items-center gap-1", children: [
|
|
4701
|
+
/* @__PURE__ */ u(tt, { children: /* @__PURE__ */ u(fo, { className: "size-3" }) }),
|
|
4688
4702
|
/* @__PURE__ */ u("span", { children: "open" })
|
|
4689
4703
|
] }),
|
|
4690
|
-
/* @__PURE__ */
|
|
4691
|
-
/* @__PURE__ */ u(
|
|
4704
|
+
/* @__PURE__ */ C("span", { className: "flex items-center gap-1", children: [
|
|
4705
|
+
/* @__PURE__ */ u(tt, { children: "esc" }),
|
|
4692
4706
|
/* @__PURE__ */ u("span", { children: "close" })
|
|
4693
4707
|
] })
|
|
4694
4708
|
] })
|
|
@@ -4700,7 +4714,7 @@ function On({
|
|
|
4700
4714
|
label: n,
|
|
4701
4715
|
onClick: r
|
|
4702
4716
|
}) {
|
|
4703
|
-
return /* @__PURE__ */
|
|
4717
|
+
return /* @__PURE__ */ C(
|
|
4704
4718
|
$e,
|
|
4705
4719
|
{
|
|
4706
4720
|
type: "button",
|
|
@@ -4720,7 +4734,7 @@ function On({
|
|
|
4720
4734
|
);
|
|
4721
4735
|
}
|
|
4722
4736
|
function Mr({ row: e }) {
|
|
4723
|
-
return /* @__PURE__ */
|
|
4737
|
+
return /* @__PURE__ */ C("span", { className: "flex min-w-0 flex-1 items-baseline gap-2 truncate", children: [
|
|
4724
4738
|
/* @__PURE__ */ u("span", { className: "truncate font-medium text-foreground", children: e.title }),
|
|
4725
4739
|
e.subtitle ? /* @__PURE__ */ u("span", { className: "truncate text-xs text-muted-foreground/70", children: e.subtitle }) : null,
|
|
4726
4740
|
e.meta ? /* @__PURE__ */ u("span", { className: "ml-auto shrink-0 text-xs text-muted-foreground/70", children: e.meta }) : null
|
|
@@ -4742,22 +4756,22 @@ function yc(e) {
|
|
|
4742
4756
|
openWorkbenchSources: a,
|
|
4743
4757
|
closeWorkbench: l,
|
|
4744
4758
|
bridgeEndpoint: c,
|
|
4745
|
-
...
|
|
4746
|
-
} = e, s =
|
|
4747
|
-
(
|
|
4748
|
-
var
|
|
4759
|
+
...f
|
|
4760
|
+
} = e, s = P(
|
|
4761
|
+
(x) => {
|
|
4762
|
+
var k;
|
|
4749
4763
|
r && o && i && qt(
|
|
4750
|
-
{ kind: "openFile", params: { path:
|
|
4764
|
+
{ kind: "openFile", params: { path: x } },
|
|
4751
4765
|
{ surface: r, isWorkbenchOpen: o, openWorkbench: i, openWorkbenchSources: a, closeWorkbench: l }
|
|
4752
|
-
), (
|
|
4766
|
+
), (k = e.onOpenArtifact) == null || k.call(e, x);
|
|
4753
4767
|
},
|
|
4754
4768
|
[r, o, i, a, l, e.onOpenArtifact]
|
|
4755
|
-
),
|
|
4756
|
-
|
|
4769
|
+
), d = gc(f.requestHeaders), p = n.filter((x) => !x.sessionId || x.sessionId === f.sessionId);
|
|
4770
|
+
L(() => {
|
|
4757
4771
|
if (!(c === null || !r || !o || !i))
|
|
4758
4772
|
return Bi({
|
|
4759
4773
|
endpoint: vc(c),
|
|
4760
|
-
query:
|
|
4774
|
+
query: d ? { workspaceId: d } : void 0,
|
|
4761
4775
|
ctx: {
|
|
4762
4776
|
surface: r,
|
|
4763
4777
|
isWorkbenchOpen: o,
|
|
@@ -4766,26 +4780,26 @@ function yc(e) {
|
|
|
4766
4780
|
closeWorkbench: l
|
|
4767
4781
|
}
|
|
4768
4782
|
});
|
|
4769
|
-
}, [c, r, o, i, a, l,
|
|
4770
|
-
const
|
|
4771
|
-
var
|
|
4772
|
-
window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId:
|
|
4773
|
-
}, [
|
|
4774
|
-
(
|
|
4775
|
-
if (
|
|
4776
|
-
window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId:
|
|
4783
|
+
}, [c, r, o, i, a, l, d]);
|
|
4784
|
+
const m = P(() => {
|
|
4785
|
+
var x;
|
|
4786
|
+
window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: f.sessionId } })), (x = e.onComposerStop) == null || x.call(e);
|
|
4787
|
+
}, [f.sessionId, e.onComposerStop]), g = P(
|
|
4788
|
+
(x, k) => {
|
|
4789
|
+
if (k === "cancel") {
|
|
4790
|
+
window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: f.sessionId } }));
|
|
4777
4791
|
return;
|
|
4778
4792
|
}
|
|
4779
|
-
|
|
4780
|
-
{ kind: "openSurface", params: { kind:
|
|
4793
|
+
k !== "open" || !x.surfaceKind || r && o && i && qt(
|
|
4794
|
+
{ kind: "openSurface", params: { kind: x.surfaceKind, target: x.target, meta: {} } },
|
|
4781
4795
|
{ surface: r, isWorkbenchOpen: o, openWorkbench: i, openWorkbenchSources: a, closeWorkbench: l }
|
|
4782
4796
|
);
|
|
4783
4797
|
},
|
|
4784
|
-
[
|
|
4785
|
-
),
|
|
4786
|
-
(
|
|
4787
|
-
var
|
|
4788
|
-
Oi(
|
|
4798
|
+
[f.sessionId, l, r, o, i, a]
|
|
4799
|
+
), y = P(
|
|
4800
|
+
(x) => {
|
|
4801
|
+
var k;
|
|
4802
|
+
Oi(x), (k = e.onData) == null || k.call(e, x);
|
|
4789
4803
|
},
|
|
4790
4804
|
[e.onData]
|
|
4791
4805
|
);
|
|
@@ -4793,11 +4807,11 @@ function yc(e) {
|
|
|
4793
4807
|
t,
|
|
4794
4808
|
{
|
|
4795
4809
|
chrome: !1,
|
|
4796
|
-
...
|
|
4810
|
+
...f,
|
|
4797
4811
|
onOpenArtifact: s,
|
|
4798
|
-
onData:
|
|
4812
|
+
onData: y,
|
|
4799
4813
|
composerBlockers: p,
|
|
4800
|
-
onComposerStop:
|
|
4814
|
+
onComposerStop: m,
|
|
4801
4815
|
onComposerBlockerAction: g
|
|
4802
4816
|
}
|
|
4803
4817
|
);
|
|
@@ -4814,7 +4828,7 @@ const bc = {
|
|
|
4814
4828
|
placement: "left",
|
|
4815
4829
|
source: "builtin"
|
|
4816
4830
|
}, Mn = 1440 * 60 * 1e3;
|
|
4817
|
-
function
|
|
4831
|
+
function St(e) {
|
|
4818
4832
|
if (e == null) return null;
|
|
4819
4833
|
const t = typeof e == "number" ? new Date(e) : new Date(e);
|
|
4820
4834
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
@@ -4823,26 +4837,26 @@ function Wn(e) {
|
|
|
4823
4837
|
const t = new Date(e);
|
|
4824
4838
|
return t.setHours(0, 0, 0, 0), t.getTime();
|
|
4825
4839
|
}
|
|
4826
|
-
function
|
|
4827
|
-
const n = Wn(/* @__PURE__ */ new Date()), r = n - Mn, o = n - 7 * Mn, i = [], a = [], l = [], c = [],
|
|
4840
|
+
function xc(e) {
|
|
4841
|
+
const n = Wn(/* @__PURE__ */ new Date()), r = n - Mn, o = n - 7 * Mn, i = [], a = [], l = [], c = [], f = [];
|
|
4828
4842
|
for (const p of e) {
|
|
4829
|
-
const
|
|
4830
|
-
if (!
|
|
4831
|
-
|
|
4843
|
+
const m = St(p.updatedAt);
|
|
4844
|
+
if (!m) {
|
|
4845
|
+
f.push(p);
|
|
4832
4846
|
continue;
|
|
4833
4847
|
}
|
|
4834
|
-
const g = Wn(
|
|
4848
|
+
const g = Wn(m);
|
|
4835
4849
|
g >= n ? i.push(p) : g >= r ? a.push(p) : g >= o ? l.push(p) : c.push(p);
|
|
4836
4850
|
}
|
|
4837
|
-
const s = (p,
|
|
4838
|
-
var
|
|
4839
|
-
const g = ((
|
|
4840
|
-
return (((
|
|
4841
|
-
},
|
|
4842
|
-
return i.length &&
|
|
4851
|
+
const s = (p, m) => {
|
|
4852
|
+
var x, k;
|
|
4853
|
+
const g = ((x = St(p.updatedAt)) == null ? void 0 : x.getTime()) ?? 0;
|
|
4854
|
+
return (((k = St(m.updatedAt)) == null ? void 0 : k.getTime()) ?? 0) - g;
|
|
4855
|
+
}, d = [];
|
|
4856
|
+
return i.length && d.push({ key: "today", label: "Today", items: i.sort(s) }), a.length && d.push({ key: "yesterday", label: "Yesterday", items: a.sort(s) }), l.length && d.push({ key: "week", label: "This week", items: l.sort(s) }), c.length && d.push({ key: "earlier", label: "Earlier", items: c.sort(s) }), f.length && d.push({ key: "undated", label: "Other", items: f }), d;
|
|
4843
4857
|
}
|
|
4844
|
-
function
|
|
4845
|
-
const t =
|
|
4858
|
+
function Sc(e) {
|
|
4859
|
+
const t = St(e);
|
|
4846
4860
|
if (!t) return "";
|
|
4847
4861
|
const n = Date.now() - t.getTime();
|
|
4848
4862
|
if (n < 6e4) return "now";
|
|
@@ -4863,50 +4877,63 @@ function kc({
|
|
|
4863
4877
|
onSwitch: n,
|
|
4864
4878
|
onCreate: r,
|
|
4865
4879
|
onDelete: o,
|
|
4866
|
-
|
|
4867
|
-
|
|
4880
|
+
onLoadMore: i,
|
|
4881
|
+
hasMore: a = !1,
|
|
4882
|
+
loadingMore: l = !1,
|
|
4883
|
+
onClose: c,
|
|
4884
|
+
className: f
|
|
4868
4885
|
}) {
|
|
4869
|
-
const
|
|
4870
|
-
return /* @__PURE__ */
|
|
4886
|
+
const s = H(() => xc(e), [e]);
|
|
4887
|
+
return /* @__PURE__ */ C(
|
|
4871
4888
|
"div",
|
|
4872
4889
|
{
|
|
4873
4890
|
"data-boring-workspace-part": "session-list",
|
|
4874
4891
|
className: oe(
|
|
4875
4892
|
"flex h-full min-h-0 flex-col bg-[color:oklch(from_var(--background)_calc(l-0.01)_c_h)]",
|
|
4876
|
-
|
|
4893
|
+
f
|
|
4877
4894
|
),
|
|
4878
4895
|
role: "navigation",
|
|
4879
4896
|
"aria-label": "Session history",
|
|
4880
4897
|
children: [
|
|
4881
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ C("div", { className: "flex h-11 items-center justify-between border-b border-border/60 px-3.5", children: [
|
|
4882
4899
|
/* @__PURE__ */ u("span", { className: "text-[12px] font-medium tracking-tight text-foreground/70", children: "Sessions" }),
|
|
4883
|
-
/* @__PURE__ */
|
|
4900
|
+
/* @__PURE__ */ C("div", { className: "flex items-center gap-0.5", children: [
|
|
4884
4901
|
r && /* @__PURE__ */ u(ge, { type: "button", variant: "ghost", size: "icon-xs", onClick: r, "aria-label": "New session", title: "New chat", children: /* @__PURE__ */ u(po, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
|
|
4885
|
-
|
|
4902
|
+
c && /* @__PURE__ */ u(ge, { type: "button", variant: "ghost", size: "icon-xs", onClick: c, "aria-label": "Close sessions", title: "Close sessions (⌘1)", children: /* @__PURE__ */ u(Gn, { className: "h-4 w-4", strokeWidth: 1.75 }) })
|
|
4886
4903
|
] })
|
|
4887
4904
|
] }),
|
|
4888
|
-
/* @__PURE__ */
|
|
4889
|
-
e.length === 0 && /* @__PURE__ */
|
|
4905
|
+
/* @__PURE__ */ C("div", { className: "flex-1 overflow-y-auto py-2.5", children: [
|
|
4906
|
+
e.length === 0 && /* @__PURE__ */ C("div", { className: "px-3 py-8 text-center text-[13px] text-muted-foreground", children: [
|
|
4890
4907
|
"No sessions yet.",
|
|
4891
4908
|
/* @__PURE__ */ u("br", {}),
|
|
4892
4909
|
"Start a new chat to begin."
|
|
4893
4910
|
] }),
|
|
4894
|
-
|
|
4895
|
-
/* @__PURE__ */
|
|
4896
|
-
/* @__PURE__ */ u("span", { children:
|
|
4897
|
-
/* @__PURE__ */ u("span", { "aria-hidden": "true", className: "text-[10.5px] tabular-nums text-muted-foreground/40", children:
|
|
4911
|
+
s.map((d, p) => /* @__PURE__ */ C("section", { className: oe(p > 0 && "mt-4"), children: [
|
|
4912
|
+
/* @__PURE__ */ C("div", { className: "flex items-baseline justify-between gap-2 px-3.5 pb-2 pt-2 text-[11px] font-medium tracking-tight text-muted-foreground/75", children: [
|
|
4913
|
+
/* @__PURE__ */ u("span", { children: d.label }),
|
|
4914
|
+
/* @__PURE__ */ u("span", { "aria-hidden": "true", className: "text-[10.5px] tabular-nums text-muted-foreground/40", children: d.items.length })
|
|
4898
4915
|
] }),
|
|
4899
|
-
/* @__PURE__ */ u("ul", { role: "list", className: "flex flex-col", children:
|
|
4916
|
+
/* @__PURE__ */ u("ul", { role: "list", className: "flex flex-col", children: d.items.map((m) => /* @__PURE__ */ u(
|
|
4900
4917
|
Pc,
|
|
4901
4918
|
{
|
|
4902
|
-
session:
|
|
4903
|
-
active:
|
|
4919
|
+
session: m,
|
|
4920
|
+
active: m.id === t,
|
|
4904
4921
|
onSwitch: n,
|
|
4905
4922
|
onDelete: o
|
|
4906
4923
|
},
|
|
4907
|
-
|
|
4924
|
+
m.id
|
|
4908
4925
|
)) })
|
|
4909
|
-
] },
|
|
4926
|
+
] }, d.key)),
|
|
4927
|
+
a && i ? /* @__PURE__ */ u("div", { className: "px-3 py-3", children: /* @__PURE__ */ u(
|
|
4928
|
+
"button",
|
|
4929
|
+
{
|
|
4930
|
+
type: "button",
|
|
4931
|
+
onClick: i,
|
|
4932
|
+
disabled: l,
|
|
4933
|
+
className: "w-full rounded-md border border-border/60 px-2.5 py-1.5 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-60",
|
|
4934
|
+
children: l ? "Loading…" : "Load more"
|
|
4935
|
+
}
|
|
4936
|
+
) }) : null
|
|
4910
4937
|
] })
|
|
4911
4938
|
]
|
|
4912
4939
|
}
|
|
@@ -4918,8 +4945,8 @@ function Pc({
|
|
|
4918
4945
|
onSwitch: n,
|
|
4919
4946
|
onDelete: r
|
|
4920
4947
|
}) {
|
|
4921
|
-
const o =
|
|
4922
|
-
return /* @__PURE__ */
|
|
4948
|
+
const o = Sc(e.updatedAt);
|
|
4949
|
+
return /* @__PURE__ */ C(
|
|
4923
4950
|
"li",
|
|
4924
4951
|
{
|
|
4925
4952
|
role: "listitem",
|
|
@@ -4932,7 +4959,7 @@ function Pc({
|
|
|
4932
4959
|
),
|
|
4933
4960
|
onClick: () => n == null ? void 0 : n(e.id),
|
|
4934
4961
|
children: [
|
|
4935
|
-
/* @__PURE__ */
|
|
4962
|
+
/* @__PURE__ */ C("span", { className: "min-w-0 flex-1 truncate leading-5", title: e.title, children: [
|
|
4936
4963
|
/* @__PURE__ */ u("span", { className: oe(t ? "font-medium text-foreground" : "text-foreground/90"), children: e.title || "Untitled" }),
|
|
4937
4964
|
o && /* @__PURE__ */ u(
|
|
4938
4965
|
"span",
|
|
@@ -4970,6 +4997,9 @@ function Cc({ params: e }) {
|
|
|
4970
4997
|
onSwitch: e == null ? void 0 : e.onSwitch,
|
|
4971
4998
|
onCreate: e == null ? void 0 : e.onCreate,
|
|
4972
4999
|
onDelete: e == null ? void 0 : e.onDelete,
|
|
5000
|
+
onLoadMore: e == null ? void 0 : e.onLoadMore,
|
|
5001
|
+
hasMore: e == null ? void 0 : e.hasMore,
|
|
5002
|
+
loadingMore: e == null ? void 0 : e.loadingMore,
|
|
4973
5003
|
onClose: e == null ? void 0 : e.onClose
|
|
4974
5004
|
});
|
|
4975
5005
|
}
|
|
@@ -4990,16 +5020,16 @@ function Wr({
|
|
|
4990
5020
|
className: a
|
|
4991
5021
|
}) {
|
|
4992
5022
|
var te, le;
|
|
4993
|
-
const l = At(), c =
|
|
5023
|
+
const l = At(), c = rt(
|
|
4994
5024
|
l.subscribe,
|
|
4995
5025
|
l.getSnapshot,
|
|
4996
5026
|
l.getSnapshot
|
|
4997
|
-
),
|
|
5027
|
+
), f = H(
|
|
4998
5028
|
() => c.filter((B) => B.placement === "left-tab"),
|
|
4999
5029
|
[c]
|
|
5000
5030
|
), s = H(() => {
|
|
5001
5031
|
const B = [];
|
|
5002
|
-
for (const ie of
|
|
5032
|
+
for (const ie of f) {
|
|
5003
5033
|
const z = ie.icon;
|
|
5004
5034
|
B.push({
|
|
5005
5035
|
id: ie.id,
|
|
@@ -5009,33 +5039,33 @@ function Wr({
|
|
|
5009
5039
|
});
|
|
5010
5040
|
}
|
|
5011
5041
|
return B;
|
|
5012
|
-
}, [
|
|
5013
|
-
|
|
5042
|
+
}, [f]), [d, p] = O(n ?? ""), m = s.some((B) => B.id === d) ? d : ((te = s[0]) == null ? void 0 : te.id) ?? "", [g, y] = O(!1), [x, k] = O(""), [$, D] = O(""), h = A(null), M = A(void 0);
|
|
5043
|
+
L(() => (clearTimeout(M.current), M.current = setTimeout(() => D(x), 180), () => clearTimeout(M.current)), [x]), L(() => {
|
|
5014
5044
|
var B;
|
|
5015
|
-
g && ((B =
|
|
5016
|
-
}, [g]),
|
|
5017
|
-
s.length > 0 && !s.some((B) => B.id ===
|
|
5018
|
-
}, [
|
|
5045
|
+
g && ((B = h.current) == null || B.focus());
|
|
5046
|
+
}, [g]), L(() => {
|
|
5047
|
+
s.length > 0 && !s.some((B) => B.id === d) && p(s[0].id);
|
|
5048
|
+
}, [d, s]), L(() => {
|
|
5019
5049
|
r && s.some((B) => B.id === zn) && p(zn);
|
|
5020
5050
|
}, [r, s]);
|
|
5021
|
-
const
|
|
5022
|
-
|
|
5023
|
-
}, []),
|
|
5024
|
-
B.key === "Escape" && (B.preventDefault(),
|
|
5025
|
-
}, []),
|
|
5051
|
+
const v = P(() => {
|
|
5052
|
+
y((B) => (B && k(""), !B));
|
|
5053
|
+
}, []), w = P((B) => {
|
|
5054
|
+
B.key === "Escape" && (B.preventDefault(), y(!1), k(""));
|
|
5055
|
+
}, []), N = s.find((B) => B.id === m), _ = !!!((le = N == null ? void 0 : N.panel) != null && le.chromeless), W = H(
|
|
5026
5056
|
() => ({
|
|
5027
5057
|
rootDir: e,
|
|
5028
5058
|
bridge: t,
|
|
5029
|
-
query:
|
|
5030
|
-
searchQuery:
|
|
5059
|
+
query: $,
|
|
5060
|
+
searchQuery: $ || void 0,
|
|
5031
5061
|
chromeless: !0,
|
|
5032
5062
|
revealFileTreeRequest: r
|
|
5033
5063
|
}),
|
|
5034
|
-
[t,
|
|
5064
|
+
[t, $, r, e]
|
|
5035
5065
|
);
|
|
5036
|
-
return /* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */ u(_o, { value:
|
|
5066
|
+
return /* @__PURE__ */ C("div", { "data-boring-workspace-part": "workbench-left", className: oe("workbench-left-root flex h-full min-h-0 flex-col", a), children: [
|
|
5067
|
+
/* @__PURE__ */ C("div", { className: "flex h-11 items-center gap-1 border-b border-border/60 px-2.5", children: [
|
|
5068
|
+
/* @__PURE__ */ u(_o, { value: m, onValueChange: p, className: "min-w-0 flex-1 overflow-hidden", "aria-label": "Workbench sources", children: /* @__PURE__ */ u(Oo, { variant: "line", className: "h-auto min-w-0 max-w-full gap-0.5 overflow-x-auto p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: s.map((B) => /* @__PURE__ */ C(
|
|
5039
5069
|
Mo,
|
|
5040
5070
|
{
|
|
5041
5071
|
value: B.id,
|
|
@@ -5047,13 +5077,13 @@ function Wr({
|
|
|
5047
5077
|
},
|
|
5048
5078
|
B.id
|
|
5049
5079
|
)) }) }),
|
|
5050
|
-
|
|
5080
|
+
_ && /* @__PURE__ */ u(
|
|
5051
5081
|
ge,
|
|
5052
5082
|
{
|
|
5053
5083
|
type: "button",
|
|
5054
5084
|
variant: "ghost",
|
|
5055
5085
|
size: "icon-xs",
|
|
5056
|
-
onClick:
|
|
5086
|
+
onClick: v,
|
|
5057
5087
|
className: oe(g && "bg-foreground/5 text-foreground"),
|
|
5058
5088
|
"aria-label": "Search",
|
|
5059
5089
|
title: "Search",
|
|
@@ -5073,33 +5103,33 @@ function Wr({
|
|
|
5073
5103
|
}
|
|
5074
5104
|
)
|
|
5075
5105
|
] }),
|
|
5076
|
-
|
|
5106
|
+
_ && g && /* @__PURE__ */ C("div", { className: "flex items-center gap-1 border-b border-border/60 px-2 py-1.5", children: [
|
|
5077
5107
|
/* @__PURE__ */ u(pn, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
5078
5108
|
/* @__PURE__ */ u(
|
|
5079
5109
|
Yn,
|
|
5080
5110
|
{
|
|
5081
|
-
ref:
|
|
5111
|
+
ref: h,
|
|
5082
5112
|
type: "text",
|
|
5083
|
-
value:
|
|
5084
|
-
onChange: (B) =>
|
|
5085
|
-
onKeyDown:
|
|
5086
|
-
placeholder: `Search ${((
|
|
5113
|
+
value: x,
|
|
5114
|
+
onChange: (B) => k(B.target.value),
|
|
5115
|
+
onKeyDown: w,
|
|
5116
|
+
placeholder: `Search ${((N == null ? void 0 : N.title) ?? "sources").toLowerCase()}...`,
|
|
5087
5117
|
className: "h-7 flex-1 border-0 bg-transparent px-0 py-0 text-xs shadow-none focus-visible:ring-0 dark:bg-transparent"
|
|
5088
5118
|
}
|
|
5089
5119
|
),
|
|
5090
|
-
|
|
5120
|
+
x && /* @__PURE__ */ u(
|
|
5091
5121
|
ge,
|
|
5092
5122
|
{
|
|
5093
5123
|
type: "button",
|
|
5094
5124
|
variant: "ghost",
|
|
5095
5125
|
size: "icon-xs",
|
|
5096
|
-
onClick: () =>
|
|
5126
|
+
onClick: () => k(""),
|
|
5097
5127
|
"aria-label": "Clear search",
|
|
5098
5128
|
children: /* @__PURE__ */ u(Hn, { className: "h-3 w-3" })
|
|
5099
5129
|
}
|
|
5100
5130
|
)
|
|
5101
5131
|
] }),
|
|
5102
|
-
/* @__PURE__ */ u("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ u(Tc, { panel:
|
|
5132
|
+
/* @__PURE__ */ u("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ u(Tc, { panel: N == null ? void 0 : N.panel, params: W, onOpenPanel: o }) })
|
|
5103
5133
|
] });
|
|
5104
5134
|
}
|
|
5105
5135
|
const Ic = { dispose() {
|
|
@@ -5196,20 +5226,20 @@ function jr({
|
|
|
5196
5226
|
prefixHeaderActions: a,
|
|
5197
5227
|
rightHeaderActions: l,
|
|
5198
5228
|
watermarkComponent: c,
|
|
5199
|
-
className:
|
|
5229
|
+
className: f
|
|
5200
5230
|
}) {
|
|
5201
|
-
const s = !!(o || r),
|
|
5231
|
+
const s = !!(o || r), d = (n == null ? void 0 : n.slice().sort().join("\0")) ?? "*", p = H(() => {
|
|
5202
5232
|
if (!s)
|
|
5203
5233
|
return $c(t, n ? new Set(n) : void 0);
|
|
5204
|
-
}, [n, s, t]),
|
|
5234
|
+
}, [n, s, t]), m = P(
|
|
5205
5235
|
(g) => {
|
|
5206
5236
|
if (o) {
|
|
5207
5237
|
o(g);
|
|
5208
5238
|
return;
|
|
5209
5239
|
}
|
|
5210
|
-
const
|
|
5240
|
+
const y = { v: zr, layout: g };
|
|
5211
5241
|
try {
|
|
5212
|
-
window.localStorage.setItem(t, JSON.stringify(
|
|
5242
|
+
window.localStorage.setItem(t, JSON.stringify(y));
|
|
5213
5243
|
} catch {
|
|
5214
5244
|
}
|
|
5215
5245
|
},
|
|
@@ -5218,21 +5248,21 @@ function jr({
|
|
|
5218
5248
|
return e ? /* @__PURE__ */ u(
|
|
5219
5249
|
"div",
|
|
5220
5250
|
{
|
|
5221
|
-
className: oe("h-full w-full",
|
|
5251
|
+
className: oe("h-full w-full", f),
|
|
5222
5252
|
"data-testid": "artifact-surface",
|
|
5223
5253
|
children: /* @__PURE__ */ u(
|
|
5224
5254
|
js,
|
|
5225
5255
|
{
|
|
5226
5256
|
layout: Lc,
|
|
5227
5257
|
persistedLayout: r ?? p,
|
|
5228
|
-
onLayoutChange:
|
|
5258
|
+
onLayoutChange: m,
|
|
5229
5259
|
onReady: i,
|
|
5230
5260
|
allowedPanels: n,
|
|
5231
5261
|
prefixHeaderActions: a,
|
|
5232
5262
|
rightHeaderActions: l,
|
|
5233
5263
|
watermarkComponent: c
|
|
5234
5264
|
},
|
|
5235
|
-
`${t}:${s ? "ext" : "auto"}:${
|
|
5265
|
+
`${t}:${s ? "ext" : "auto"}:${d}`
|
|
5236
5266
|
)
|
|
5237
5267
|
}
|
|
5238
5268
|
) : null;
|
|
@@ -5293,103 +5323,103 @@ function Oc({
|
|
|
5293
5323
|
onChange: a,
|
|
5294
5324
|
onClose: l,
|
|
5295
5325
|
extraPanels: c,
|
|
5296
|
-
defaultLeftTab:
|
|
5326
|
+
defaultLeftTab: f,
|
|
5297
5327
|
initialPanels: s,
|
|
5298
|
-
className:
|
|
5328
|
+
className: d
|
|
5299
5329
|
}) {
|
|
5300
|
-
const [p,
|
|
5330
|
+
const [p, m] = O(() => {
|
|
5301
5331
|
if (!o) return !1;
|
|
5302
5332
|
try {
|
|
5303
5333
|
return localStorage.getItem(`${o}:sidebarCollapsed`) === "1";
|
|
5304
5334
|
} catch {
|
|
5305
5335
|
return !1;
|
|
5306
5336
|
}
|
|
5307
|
-
}), [g,
|
|
5337
|
+
}), [g, y] = O(() => {
|
|
5308
5338
|
if (!o) return t;
|
|
5309
5339
|
try {
|
|
5310
|
-
const
|
|
5311
|
-
if (!
|
|
5312
|
-
const
|
|
5313
|
-
return Number.isFinite(
|
|
5340
|
+
const b = localStorage.getItem(`${o}:sidebarWidth`);
|
|
5341
|
+
if (!b) return t;
|
|
5342
|
+
const E = Number(b);
|
|
5343
|
+
return Number.isFinite(E) ? Math.max(n, Math.min(r, E)) : t;
|
|
5314
5344
|
} catch {
|
|
5315
5345
|
return t;
|
|
5316
5346
|
}
|
|
5317
|
-
}),
|
|
5318
|
-
|
|
5319
|
-
const
|
|
5320
|
-
|
|
5321
|
-
const
|
|
5322
|
-
|
|
5323
|
-
const
|
|
5347
|
+
}), x = A(null), k = A(null), $ = A(null), [D, h] = O(null), [M, v] = O(null), w = A(i);
|
|
5348
|
+
w.current = i;
|
|
5349
|
+
const N = A(a);
|
|
5350
|
+
N.current = a;
|
|
5351
|
+
const T = A(l);
|
|
5352
|
+
T.current = l;
|
|
5353
|
+
const _ = A(/* @__PURE__ */ new Set()), W = A(/* @__PURE__ */ new Set()), te = A(null), le = A(
|
|
5324
5354
|
/* @__PURE__ */ new Map()
|
|
5325
|
-
), B = At(), ie =
|
|
5355
|
+
), B = At(), ie = rt(
|
|
5326
5356
|
B.subscribe,
|
|
5327
5357
|
B.getSnapshot,
|
|
5328
5358
|
B.getSnapshot
|
|
5329
|
-
), z = nr(), J =
|
|
5359
|
+
), z = nr(), J = A(B);
|
|
5330
5360
|
J.current = B;
|
|
5331
|
-
const G =
|
|
5361
|
+
const G = A(z);
|
|
5332
5362
|
G.current = z;
|
|
5333
5363
|
const ue = H(() => {
|
|
5334
|
-
const
|
|
5335
|
-
for (const
|
|
5336
|
-
|
|
5337
|
-
for (const
|
|
5338
|
-
|
|
5339
|
-
return [...
|
|
5340
|
-
}, [c, ie]), Ie =
|
|
5341
|
-
const
|
|
5342
|
-
if (!
|
|
5364
|
+
const b = /* @__PURE__ */ new Set();
|
|
5365
|
+
for (const E of ie)
|
|
5366
|
+
E.placement === "center" && b.add(E.id);
|
|
5367
|
+
for (const E of c ?? [])
|
|
5368
|
+
b.add(E);
|
|
5369
|
+
return [...b];
|
|
5370
|
+
}, [c, ie]), Ie = P((b) => {
|
|
5371
|
+
const E = x.current;
|
|
5372
|
+
if (!E) {
|
|
5343
5373
|
console.warn("[SurfaceShell] openFile: surface not ready (dockview not initialized)");
|
|
5344
5374
|
return;
|
|
5345
5375
|
}
|
|
5346
|
-
const
|
|
5376
|
+
const I = kt(b), j = {
|
|
5347
5377
|
kind: Be,
|
|
5348
|
-
target:
|
|
5378
|
+
target: I
|
|
5349
5379
|
}, Z = G.current.resolve(j);
|
|
5350
5380
|
if (Z) {
|
|
5351
5381
|
if (!J.current.has(Z.component)) {
|
|
5352
|
-
console.warn(`[SurfaceShell] openFile: resolver returned unknown panel "${Z.component}" for "${
|
|
5382
|
+
console.warn(`[SurfaceShell] openFile: resolver returned unknown panel "${Z.component}" for "${I}"`);
|
|
5353
5383
|
return;
|
|
5354
5384
|
}
|
|
5355
5385
|
const pe = jt(j, Z);
|
|
5356
5386
|
W.current.add(pe);
|
|
5357
|
-
const ne =
|
|
5387
|
+
const ne = E.getPanel(pe), xe = Bt(Z.params, I);
|
|
5358
5388
|
if (ne) {
|
|
5359
|
-
ne.api.updateParameters(
|
|
5389
|
+
ne.api.updateParameters(xe), ne.api.setActive();
|
|
5360
5390
|
return;
|
|
5361
5391
|
}
|
|
5362
|
-
|
|
5392
|
+
E.addPanel({
|
|
5363
5393
|
id: pe,
|
|
5364
5394
|
component: Z.component,
|
|
5365
|
-
title: Z.title ??
|
|
5366
|
-
params:
|
|
5395
|
+
title: Z.title ?? I.split("/").pop() ?? I,
|
|
5396
|
+
params: xe
|
|
5367
5397
|
});
|
|
5368
5398
|
return;
|
|
5369
5399
|
}
|
|
5370
|
-
const fe = jn(
|
|
5400
|
+
const fe = jn(E, I);
|
|
5371
5401
|
if (fe) {
|
|
5372
5402
|
fe.api.setActive();
|
|
5373
5403
|
return;
|
|
5374
5404
|
}
|
|
5375
|
-
console.warn(`[SurfaceShell] openFile: no surface resolver matched "${
|
|
5376
|
-
}, []), me =
|
|
5405
|
+
console.warn(`[SurfaceShell] openFile: no surface resolver matched "${I}"`);
|
|
5406
|
+
}, []), me = P((b) => {
|
|
5377
5407
|
var pt;
|
|
5378
|
-
const
|
|
5379
|
-
if (!
|
|
5408
|
+
const E = x.current;
|
|
5409
|
+
if (!E) {
|
|
5380
5410
|
console.warn("[SurfaceShell] openSurface: surface not ready (dockview not initialized)");
|
|
5381
5411
|
return;
|
|
5382
5412
|
}
|
|
5383
|
-
const
|
|
5413
|
+
const I = _c(b), j = G.current.resolve(I);
|
|
5384
5414
|
if (!j) {
|
|
5385
|
-
console.warn(`[SurfaceShell] openSurface: no resolver matched kind="${
|
|
5415
|
+
console.warn(`[SurfaceShell] openSurface: no resolver matched kind="${I.kind}" target="${I.target}"`);
|
|
5386
5416
|
return;
|
|
5387
5417
|
}
|
|
5388
|
-
const Z = jt(
|
|
5389
|
-
|
|
5390
|
-
const fe =
|
|
5418
|
+
const Z = jt(I, j);
|
|
5419
|
+
I.kind === Be && W.current.add(Z);
|
|
5420
|
+
const fe = E.getPanel(Z), pe = ((pt = I.meta) == null ? void 0 : pt.closeWorkbenchOnDone) === !0, ne = I.kind === Be ? Bt(j.params, I.target) : j.params, xe = pe && T.current ? { ...ne ?? {}, __closeWorkbenchOnDone: T.current } : ne;
|
|
5391
5421
|
if (fe) {
|
|
5392
|
-
|
|
5422
|
+
xe && fe.api.updateParameters(xe), fe.api.setActive();
|
|
5393
5423
|
return;
|
|
5394
5424
|
}
|
|
5395
5425
|
const ft = J.current;
|
|
@@ -5399,102 +5429,102 @@ function Oc({
|
|
|
5399
5429
|
`openSurface: unknown component "${j.component}". Registered panels: [${Lt}]. Register the component through a panel output before resolving to it.`
|
|
5400
5430
|
);
|
|
5401
5431
|
}
|
|
5402
|
-
|
|
5432
|
+
E.addPanel({
|
|
5403
5433
|
id: Z,
|
|
5404
5434
|
component: j.component,
|
|
5405
|
-
title: j.title ??
|
|
5406
|
-
params:
|
|
5435
|
+
title: j.title ?? I.target,
|
|
5436
|
+
params: xe
|
|
5407
5437
|
});
|
|
5408
|
-
}, []), he =
|
|
5409
|
-
const
|
|
5410
|
-
if (!
|
|
5411
|
-
const
|
|
5412
|
-
if (
|
|
5413
|
-
|
|
5438
|
+
}, []), he = P((b) => {
|
|
5439
|
+
const E = x.current;
|
|
5440
|
+
if (!E) return;
|
|
5441
|
+
const I = E.getPanel(b.id);
|
|
5442
|
+
if (I) {
|
|
5443
|
+
b.params && I.api.updateParameters(b.params), I.api.setActive();
|
|
5414
5444
|
return;
|
|
5415
5445
|
}
|
|
5416
5446
|
const j = J.current;
|
|
5417
|
-
if (!j.has(
|
|
5447
|
+
if (!j.has(b.component)) {
|
|
5418
5448
|
const Z = j.list().map((fe) => fe.id).join(", ");
|
|
5419
5449
|
throw new Error(
|
|
5420
|
-
`openPanel: unknown component "${
|
|
5450
|
+
`openPanel: unknown component "${b.component}". Registered panels: [${Z}]. Add the component to WorkspaceProvider's "panels" prop, or pick one of the registered ids.`
|
|
5421
5451
|
);
|
|
5422
5452
|
}
|
|
5423
|
-
|
|
5424
|
-
id:
|
|
5425
|
-
component:
|
|
5426
|
-
title:
|
|
5427
|
-
params:
|
|
5453
|
+
E.addPanel({
|
|
5454
|
+
id: b.id,
|
|
5455
|
+
component: b.component,
|
|
5456
|
+
title: b.title ?? b.id,
|
|
5457
|
+
params: b.params
|
|
5428
5458
|
});
|
|
5429
|
-
}, []), ke =
|
|
5430
|
-
var
|
|
5431
|
-
const
|
|
5432
|
-
return
|
|
5459
|
+
}, []), ke = P(() => {
|
|
5460
|
+
var I;
|
|
5461
|
+
const b = x.current;
|
|
5462
|
+
return b ? { openTabs: b.panels.map((j) => ({
|
|
5433
5463
|
id: j.id,
|
|
5434
5464
|
title: j.title ?? j.id,
|
|
5435
5465
|
params: j.params ?? void 0
|
|
5436
|
-
})), activeTab: ((
|
|
5437
|
-
}, []), Ue =
|
|
5438
|
-
const
|
|
5439
|
-
if (!
|
|
5440
|
-
for (const j of [...
|
|
5441
|
-
j(
|
|
5466
|
+
})), activeTab: ((I = b.activePanel) == null ? void 0 : I.id) ?? null } : { openTabs: [], activeTab: null };
|
|
5467
|
+
}, []), Ue = P((b, E) => {
|
|
5468
|
+
const I = le.current.get(b);
|
|
5469
|
+
if (!I || I.size === 0) return !1;
|
|
5470
|
+
for (const j of [...I])
|
|
5471
|
+
j(E);
|
|
5442
5472
|
return !0;
|
|
5443
|
-
}, []), qe =
|
|
5444
|
-
const
|
|
5445
|
-
te.current =
|
|
5473
|
+
}, []), qe = P((b) => {
|
|
5474
|
+
const E = kt(b);
|
|
5475
|
+
te.current = E, v((I) => ({ path: E, seq: ((I == null ? void 0 : I.seq) ?? 0) + 1 })), m(!1), Ue("tree:expand", { path: E }) && (te.current = null);
|
|
5446
5476
|
}, [Ue]), Qe = H(() => ({
|
|
5447
5477
|
openFile: Ie,
|
|
5448
5478
|
openSurface: me,
|
|
5449
5479
|
openPanel: he,
|
|
5450
|
-
closeWorkbenchLeftPane: () =>
|
|
5480
|
+
closeWorkbenchLeftPane: () => m(!0),
|
|
5451
5481
|
expandToFile: qe,
|
|
5452
5482
|
getSnapshot: ke
|
|
5453
|
-
}), [qe, ke, Ie, he, me]), X =
|
|
5483
|
+
}), [qe, ke, Ie, he, me]), X = P(() => {
|
|
5454
5484
|
var pe;
|
|
5455
|
-
const
|
|
5485
|
+
const b = x.current, E = b ? b.panels.map((ne) => ({
|
|
5456
5486
|
id: ne.id,
|
|
5457
5487
|
component: String(ne.component ?? ""),
|
|
5458
5488
|
params: ne.params ?? void 0
|
|
5459
|
-
})) : [],
|
|
5489
|
+
})) : [], I = ((pe = b == null ? void 0 : b.activePanel) == null ? void 0 : pe.id) ?? null, j = W.current, Z = E.find((ne) => ne.id === I), fe = Bn(Z, j);
|
|
5460
5490
|
return {
|
|
5461
5491
|
hydrationComplete: !0,
|
|
5462
5492
|
layout: null,
|
|
5463
5493
|
sidebar: { collapsed: !1, width: t },
|
|
5464
5494
|
panelSizes: {},
|
|
5465
5495
|
preferences: { theme: "dark" },
|
|
5466
|
-
panels:
|
|
5467
|
-
activePanel:
|
|
5496
|
+
panels: E,
|
|
5497
|
+
activePanel: I,
|
|
5468
5498
|
activeFile: fe,
|
|
5469
|
-
visibleFiles:
|
|
5499
|
+
visibleFiles: E.map((ne) => Bn(ne, j)).filter((ne) => ne !== null),
|
|
5470
5500
|
dirtyFiles: {},
|
|
5471
5501
|
notifications: []
|
|
5472
5502
|
};
|
|
5473
|
-
}, [t]), ae =
|
|
5474
|
-
const
|
|
5475
|
-
for (const
|
|
5476
|
-
|
|
5477
|
-
}, [X]), we =
|
|
5478
|
-
var
|
|
5479
|
-
if (
|
|
5503
|
+
}, [t]), ae = P(() => {
|
|
5504
|
+
const b = X();
|
|
5505
|
+
for (const E of _.current)
|
|
5506
|
+
E(b);
|
|
5507
|
+
}, [X]), we = A(!1), ce = P((b) => {
|
|
5508
|
+
var I;
|
|
5509
|
+
if (x.current = b, h(b), !we.current) {
|
|
5480
5510
|
we.current = !0;
|
|
5481
5511
|
for (const j of s ?? [])
|
|
5482
|
-
|
|
5512
|
+
b.getPanel(j.id) || b.addPanel({ id: j.id, component: j.component, title: j.title, params: j.params });
|
|
5483
5513
|
}
|
|
5484
|
-
(
|
|
5485
|
-
const
|
|
5514
|
+
(I = w.current) == null || I.call(w, Qe);
|
|
5515
|
+
const E = () => {
|
|
5486
5516
|
var j;
|
|
5487
|
-
(j =
|
|
5517
|
+
(j = N.current) == null || j.call(N, ke()), ae();
|
|
5488
5518
|
};
|
|
5489
|
-
|
|
5490
|
-
}, [Qe, ke, ae]), be =
|
|
5491
|
-
async (
|
|
5519
|
+
b.onDidAddPanel(E), b.onDidRemovePanel(E), b.onDidActivePanelChange(E), E();
|
|
5520
|
+
}, [Qe, ke, ae]), be = P(
|
|
5521
|
+
async (b) => {
|
|
5492
5522
|
try {
|
|
5493
|
-
const
|
|
5494
|
-
if (!
|
|
5495
|
-
const
|
|
5523
|
+
const E = x.current;
|
|
5524
|
+
if (!E) return gt("not-ready", "surface not ready");
|
|
5525
|
+
const I = kt(b), j = {
|
|
5496
5526
|
kind: Be,
|
|
5497
|
-
target:
|
|
5527
|
+
target: I
|
|
5498
5528
|
}, Z = G.current.resolve(j);
|
|
5499
5529
|
if (Z) {
|
|
5500
5530
|
if (!J.current.has(Z.component))
|
|
@@ -5504,20 +5534,20 @@ function Oc({
|
|
|
5504
5534
|
);
|
|
5505
5535
|
const pe = jt(j, Z);
|
|
5506
5536
|
W.current.add(pe);
|
|
5507
|
-
const ne = Bt(Z.params,
|
|
5508
|
-
return
|
|
5537
|
+
const ne = Bt(Z.params, I), xe = E.getPanel(pe);
|
|
5538
|
+
return xe ? (xe.api.updateParameters(ne), xe.api.setActive(), Le()) : (E.addPanel({
|
|
5509
5539
|
id: pe,
|
|
5510
5540
|
component: Z.component,
|
|
5511
|
-
title: Z.title ??
|
|
5541
|
+
title: Z.title ?? I.split("/").pop() ?? I,
|
|
5512
5542
|
params: ne
|
|
5513
5543
|
}), Le());
|
|
5514
5544
|
}
|
|
5515
|
-
const fe = jn(
|
|
5516
|
-
return fe ? (fe.api.setActive(), Le()) : gt("NO_SURFACE_RESOLVER", `no registered surface resolver handles ${
|
|
5517
|
-
} catch (
|
|
5545
|
+
const fe = jn(E, I);
|
|
5546
|
+
return fe ? (fe.api.setActive(), Le()) : gt("NO_SURFACE_RESOLVER", `no registered surface resolver handles ${I}`);
|
|
5547
|
+
} catch (E) {
|
|
5518
5548
|
return gt(
|
|
5519
5549
|
"INVALID_SURFACE_PATH",
|
|
5520
|
-
|
|
5550
|
+
E instanceof Error ? E.message : "failed to open file"
|
|
5521
5551
|
);
|
|
5522
5552
|
}
|
|
5523
5553
|
},
|
|
@@ -5530,71 +5560,71 @@ function Oc({
|
|
|
5530
5560
|
openFile: be,
|
|
5531
5561
|
openPanel: async () => Le(),
|
|
5532
5562
|
closePanel: async () => Le(),
|
|
5533
|
-
closeWorkbenchLeftPane: async () => (
|
|
5563
|
+
closeWorkbenchLeftPane: async () => (m(!0), Le()),
|
|
5534
5564
|
showNotification: async () => Le(),
|
|
5535
5565
|
navigateToLine: async () => Le(),
|
|
5536
|
-
expandToFile: async (
|
|
5566
|
+
expandToFile: async (b) => (qe(b), Le()),
|
|
5537
5567
|
markDirty: () => {
|
|
5538
5568
|
},
|
|
5539
5569
|
markClean: () => {
|
|
5540
5570
|
},
|
|
5541
|
-
subscribe: (
|
|
5542
|
-
let
|
|
5543
|
-
return
|
|
5544
|
-
|
|
5571
|
+
subscribe: (b, E) => {
|
|
5572
|
+
let I = le.current.get(b);
|
|
5573
|
+
return I || (I = /* @__PURE__ */ new Set(), le.current.set(b, I)), I.add(E), b === "tree:expand" && te.current && (E({ path: te.current }), te.current = null), () => {
|
|
5574
|
+
I == null || I.delete(E);
|
|
5545
5575
|
};
|
|
5546
5576
|
},
|
|
5547
|
-
select: (
|
|
5548
|
-
const
|
|
5549
|
-
return
|
|
5550
|
-
|
|
5577
|
+
select: (b, E) => {
|
|
5578
|
+
const I = (j) => E(b(j));
|
|
5579
|
+
return _.current.add(I), I(X()), () => {
|
|
5580
|
+
_.current.delete(I);
|
|
5551
5581
|
};
|
|
5552
5582
|
}
|
|
5553
|
-
}), [qe, be, X]), Re =
|
|
5554
|
-
(
|
|
5583
|
+
}), [qe, be, X]), Re = P(
|
|
5584
|
+
(b) => {
|
|
5555
5585
|
if (p) return;
|
|
5556
|
-
|
|
5586
|
+
b.preventDefault(), b.currentTarget.setPointerCapture(b.pointerId), $.current = { startX: b.clientX, startWidth: g };
|
|
5557
5587
|
},
|
|
5558
5588
|
[p, g]
|
|
5559
|
-
), Ke =
|
|
5560
|
-
(
|
|
5561
|
-
const
|
|
5562
|
-
if (!
|
|
5563
|
-
const
|
|
5564
|
-
|
|
5589
|
+
), Ke = P(
|
|
5590
|
+
(b) => {
|
|
5591
|
+
const E = $.current;
|
|
5592
|
+
if (!E) return;
|
|
5593
|
+
const I = b.clientX - E.startX, j = Math.max(n, Math.min(r, E.startWidth + I));
|
|
5594
|
+
y(j);
|
|
5565
5595
|
},
|
|
5566
5596
|
[n, r]
|
|
5567
|
-
), De =
|
|
5568
|
-
|
|
5569
|
-
}, []), Ne =
|
|
5570
|
-
(
|
|
5597
|
+
), De = P((b) => {
|
|
5598
|
+
$.current && ($.current = null, b.currentTarget.releasePointerCapture(b.pointerId));
|
|
5599
|
+
}, []), Ne = P(
|
|
5600
|
+
(b) => {
|
|
5571
5601
|
if (p) return;
|
|
5572
|
-
const
|
|
5573
|
-
|
|
5602
|
+
const E = b.shiftKey ? 32 : 16;
|
|
5603
|
+
b.key === "ArrowLeft" ? (b.preventDefault(), y((I) => Math.max(n, I - E))) : b.key === "ArrowRight" ? (b.preventDefault(), y((I) => Math.min(r, I + E))) : b.key === "Home" ? (b.preventDefault(), y(n)) : b.key === "End" && (b.preventDefault(), y(r));
|
|
5574
5604
|
},
|
|
5575
5605
|
[p, n, r]
|
|
5576
5606
|
);
|
|
5577
|
-
return
|
|
5607
|
+
return L(() => {
|
|
5578
5608
|
if (o)
|
|
5579
5609
|
try {
|
|
5580
5610
|
localStorage.setItem(`${o}:sidebarWidth`, String(g));
|
|
5581
5611
|
} catch {
|
|
5582
5612
|
}
|
|
5583
|
-
}, [o, g]),
|
|
5613
|
+
}, [o, g]), L(() => {
|
|
5584
5614
|
if (o)
|
|
5585
5615
|
try {
|
|
5586
5616
|
localStorage.setItem(`${o}:sidebarCollapsed`, p ? "1" : "0");
|
|
5587
5617
|
} catch {
|
|
5588
5618
|
}
|
|
5589
|
-
}, [o, p]), /* @__PURE__ */
|
|
5619
|
+
}, [o, p]), /* @__PURE__ */ C(
|
|
5590
5620
|
"div",
|
|
5591
5621
|
{
|
|
5592
|
-
ref:
|
|
5622
|
+
ref: k,
|
|
5593
5623
|
"data-boring-workspace-part": "surface",
|
|
5594
|
-
className: oe("flex h-full min-h-0 w-full bg-background",
|
|
5624
|
+
className: oe("flex h-full min-h-0 w-full bg-background", d),
|
|
5595
5625
|
"data-testid": "surface-shell",
|
|
5596
5626
|
children: [
|
|
5597
|
-
p ? null : /* @__PURE__ */
|
|
5627
|
+
p ? null : /* @__PURE__ */ C(_e, { children: [
|
|
5598
5628
|
/* @__PURE__ */ u(
|
|
5599
5629
|
"aside",
|
|
5600
5630
|
{
|
|
@@ -5608,10 +5638,10 @@ function Oc({
|
|
|
5608
5638
|
{
|
|
5609
5639
|
rootDir: e,
|
|
5610
5640
|
bridge: Ve,
|
|
5611
|
-
defaultTab:
|
|
5612
|
-
revealFileTreeRequest:
|
|
5641
|
+
defaultTab: f,
|
|
5642
|
+
revealFileTreeRequest: M,
|
|
5613
5643
|
onOpenPanel: he,
|
|
5614
|
-
onCollapse: () =>
|
|
5644
|
+
onCollapse: () => m(!0)
|
|
5615
5645
|
}
|
|
5616
5646
|
)
|
|
5617
5647
|
}
|
|
@@ -5636,7 +5666,7 @@ function Oc({
|
|
|
5636
5666
|
}
|
|
5637
5667
|
)
|
|
5638
5668
|
] }),
|
|
5639
|
-
/* @__PURE__ */
|
|
5669
|
+
/* @__PURE__ */ C("div", { className: "relative min-w-0 flex-1", children: [
|
|
5640
5670
|
/* @__PURE__ */ u(
|
|
5641
5671
|
"div",
|
|
5642
5672
|
{
|
|
@@ -5654,7 +5684,7 @@ function Oc({
|
|
|
5654
5684
|
)
|
|
5655
5685
|
}
|
|
5656
5686
|
),
|
|
5657
|
-
/* @__PURE__ */
|
|
5687
|
+
/* @__PURE__ */ C(
|
|
5658
5688
|
"div",
|
|
5659
5689
|
{
|
|
5660
5690
|
className: "pointer-events-none absolute inset-x-0 top-0 flex items-center justify-between",
|
|
@@ -5666,7 +5696,7 @@ function Oc({
|
|
|
5666
5696
|
type: "button",
|
|
5667
5697
|
variant: "ghost",
|
|
5668
5698
|
size: "icon-xs",
|
|
5669
|
-
onClick: () =>
|
|
5699
|
+
onClick: () => m(!1),
|
|
5670
5700
|
className: "pointer-events-auto ml-2",
|
|
5671
5701
|
"aria-label": "Show sources",
|
|
5672
5702
|
title: "Show sources",
|
|
@@ -5680,9 +5710,9 @@ function Oc({
|
|
|
5680
5710
|
/* @__PURE__ */ u(
|
|
5681
5711
|
Wc,
|
|
5682
5712
|
{
|
|
5683
|
-
api:
|
|
5713
|
+
api: D,
|
|
5684
5714
|
collapsed: p,
|
|
5685
|
-
onExpandFiles: () =>
|
|
5715
|
+
onExpandFiles: () => m(!1)
|
|
5686
5716
|
}
|
|
5687
5717
|
)
|
|
5688
5718
|
] })
|
|
@@ -5710,8 +5740,8 @@ function Wc({
|
|
|
5710
5740
|
collapsed: t,
|
|
5711
5741
|
onExpandFiles: n
|
|
5712
5742
|
}) {
|
|
5713
|
-
const [r, o] =
|
|
5714
|
-
return
|
|
5743
|
+
const [r, o] = O(!0);
|
|
5744
|
+
return L(() => {
|
|
5715
5745
|
if (!e) return;
|
|
5716
5746
|
const i = () => o(e.panels.length === 0);
|
|
5717
5747
|
i();
|
|
@@ -5719,8 +5749,8 @@ function Wc({
|
|
|
5719
5749
|
return () => {
|
|
5720
5750
|
a.dispose(), l.dispose();
|
|
5721
5751
|
};
|
|
5722
|
-
}, [e]), r ? /* @__PURE__ */
|
|
5723
|
-
/* @__PURE__ */
|
|
5752
|
+
}, [e]), r ? /* @__PURE__ */ C(_e, { children: [
|
|
5753
|
+
/* @__PURE__ */ C("div", { className: "pointer-events-none absolute inset-x-0 top-0 flex items-center gap-0.5 border-b border-[color:oklch(from_var(--border)_l_c_h/0.4)] bg-background px-1", style: { height: 44 }, children: [
|
|
5724
5754
|
t && /* @__PURE__ */ u(
|
|
5725
5755
|
ge,
|
|
5726
5756
|
{
|
|
@@ -5736,14 +5766,14 @@ function Wc({
|
|
|
5736
5766
|
),
|
|
5737
5767
|
/* @__PURE__ */ u("div", { className: "flex-1" })
|
|
5738
5768
|
] }),
|
|
5739
|
-
/* @__PURE__ */
|
|
5740
|
-
/* @__PURE__ */
|
|
5769
|
+
/* @__PURE__ */ C("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-start justify-center gap-2 px-6 pt-12 pb-10", children: [
|
|
5770
|
+
/* @__PURE__ */ C("div", { className: "flex items-center gap-2 text-[11px] font-medium tracking-tight text-muted-foreground/75", children: [
|
|
5741
5771
|
/* @__PURE__ */ u("span", { className: "inline-block h-px w-3 bg-[color:var(--accent)]", "aria-hidden": "true" }),
|
|
5742
5772
|
"Workbench"
|
|
5743
5773
|
] }),
|
|
5744
5774
|
/* @__PURE__ */ u("div", { className: "text-[15px] font-medium tracking-tight text-foreground", children: "Nothing open yet" }),
|
|
5745
5775
|
/* @__PURE__ */ u("p", { className: "max-w-[280px] text-[12.5px] leading-relaxed text-muted-foreground/85", children: "Open a source item, or let the agent produce an artifact here." }),
|
|
5746
|
-
t && /* @__PURE__ */
|
|
5776
|
+
t && /* @__PURE__ */ C(
|
|
5747
5777
|
$e,
|
|
5748
5778
|
{
|
|
5749
5779
|
type: "button",
|
|
@@ -5785,9 +5815,9 @@ function qc() {
|
|
|
5785
5815
|
return se(qr) ?? Uc;
|
|
5786
5816
|
}
|
|
5787
5817
|
function Vc({ children: e }) {
|
|
5788
|
-
const [t, n] =
|
|
5818
|
+
const [t, n] = O([]), r = P((a) => {
|
|
5789
5819
|
n((l) => [...l.filter((c) => c.id !== a.id), a]);
|
|
5790
|
-
}, []), o =
|
|
5820
|
+
}, []), o = P((a) => {
|
|
5791
5821
|
n((l) => l.filter((c) => c.id !== a));
|
|
5792
5822
|
}, []), i = H(
|
|
5793
5823
|
() => ({ blockers: t, addBlocker: r, removeBlocker: o }),
|
|
@@ -5882,11 +5912,11 @@ function nl(e, t, n) {
|
|
|
5882
5912
|
...c.chromeless !== void 0 ? { chromeless: c.chromeless } : {}
|
|
5883
5913
|
});
|
|
5884
5914
|
for (const c of n.leftTabs) {
|
|
5885
|
-
const
|
|
5915
|
+
const f = o.get(c.panelId);
|
|
5886
5916
|
r.push({
|
|
5887
5917
|
id: c.id,
|
|
5888
5918
|
title: c.title,
|
|
5889
|
-
component: c.component ?? (
|
|
5919
|
+
component: c.component ?? (f == null ? void 0 : f.component) ?? (() => null),
|
|
5890
5920
|
placement: "left-tab",
|
|
5891
5921
|
source: c.source ?? "plugin",
|
|
5892
5922
|
pluginId: e,
|
|
@@ -5913,9 +5943,9 @@ function nl(e, t, n) {
|
|
|
5913
5943
|
id: c.id ?? `${e}:${c.kind}`,
|
|
5914
5944
|
source: c.source ?? "plugin",
|
|
5915
5945
|
pluginId: e,
|
|
5916
|
-
resolve(
|
|
5917
|
-
if (
|
|
5918
|
-
return c.resolve(
|
|
5946
|
+
resolve(f) {
|
|
5947
|
+
if (f.kind === c.kind)
|
|
5948
|
+
return c.resolve(f) ?? void 0;
|
|
5919
5949
|
}
|
|
5920
5950
|
}));
|
|
5921
5951
|
return { panels: r, commands: i, catalogs: a, surfaceResolvers: l };
|
|
@@ -5974,15 +6004,15 @@ function al(e) {
|
|
|
5974
6004
|
return typeof t != "string" || !t.startsWith("boring.plugin.");
|
|
5975
6005
|
}
|
|
5976
6006
|
function cl(e) {
|
|
5977
|
-
const t = At(), n = Zt(), r = Ft(), o = nr(), i =
|
|
5978
|
-
|
|
6007
|
+
const t = At(), n = Zt(), r = Ft(), o = nr(), i = A(/* @__PURE__ */ new Map()), a = A(/* @__PURE__ */ new Map()), l = A(/* @__PURE__ */ new Set()), [c, f] = O(0), s = A(!1);
|
|
6008
|
+
L(() => {
|
|
5979
6009
|
if (e.enabled === !1 || typeof EventSource > "u") return;
|
|
5980
|
-
const
|
|
5981
|
-
const
|
|
5982
|
-
al(
|
|
6010
|
+
const d = (p) => {
|
|
6011
|
+
const m = p.detail;
|
|
6012
|
+
al(m) && (s.current = !0, f((g) => g + 1));
|
|
5983
6013
|
};
|
|
5984
|
-
return window.addEventListener(Ee,
|
|
5985
|
-
}, [e.enabled]),
|
|
6014
|
+
return window.addEventListener(Ee, d), () => window.removeEventListener(Ee, d);
|
|
6015
|
+
}, [e.enabled]), L(() => {
|
|
5986
6016
|
if (e.enabled === !1 || typeof EventSource > "u") return;
|
|
5987
6017
|
if (s.current && (s.current = !1, i.current.clear(), a.current.clear()), Qc(e.authHeaders)) {
|
|
5988
6018
|
console.warn(
|
|
@@ -5990,130 +6020,130 @@ function cl(e) {
|
|
|
5990
6020
|
);
|
|
5991
6021
|
return;
|
|
5992
6022
|
}
|
|
5993
|
-
let
|
|
5994
|
-
const p = Yc(t, n, r, o),
|
|
6023
|
+
let d = !1;
|
|
6024
|
+
const p = Yc(t, n, r, o), m = Hc(Vr(e.apiBaseUrl ?? "", "/api/v1/agent-plugins/events"), e.workspaceId), g = new EventSource(m, { withCredentials: !0 }), y = (D) => {
|
|
5995
6025
|
(async () => {
|
|
5996
|
-
let
|
|
6026
|
+
let h, M = !1;
|
|
5997
6027
|
try {
|
|
5998
|
-
if (
|
|
5999
|
-
|
|
6000
|
-
const
|
|
6001
|
-
if (
|
|
6002
|
-
a.current.set(
|
|
6003
|
-
const
|
|
6004
|
-
|
|
6028
|
+
if (h = JSON.parse(D.data), d || h.workspaceId && e.workspaceId && h.workspaceId !== e.workspaceId) return;
|
|
6029
|
+
h.replay && l.current.add(h.id);
|
|
6030
|
+
const v = i.current.get(h.id) ?? 0, w = a.current.get(h.id) ?? 0;
|
|
6031
|
+
if (h.revision <= Math.max(v, w)) return;
|
|
6032
|
+
a.current.set(h.id, h.revision);
|
|
6033
|
+
const N = Jc(h, e.apiBaseUrl);
|
|
6034
|
+
N && (M = !0, window.dispatchEvent(new CustomEvent(Ee, {
|
|
6005
6035
|
detail: {
|
|
6006
6036
|
type: "boring.plugin.front-pending",
|
|
6007
|
-
id:
|
|
6008
|
-
revision:
|
|
6009
|
-
workspaceId:
|
|
6010
|
-
replay:
|
|
6037
|
+
id: h.id,
|
|
6038
|
+
revision: h.revision,
|
|
6039
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6040
|
+
replay: h.replay
|
|
6011
6041
|
}
|
|
6012
6042
|
})));
|
|
6013
|
-
let
|
|
6043
|
+
let T = null;
|
|
6014
6044
|
try {
|
|
6015
|
-
|
|
6016
|
-
} catch (
|
|
6045
|
+
T = N ? await tl(h.id, N, h.revision, e.importFront) : null;
|
|
6046
|
+
} catch (_) {
|
|
6017
6047
|
throw {
|
|
6018
6048
|
stage: "import",
|
|
6019
|
-
error:
|
|
6049
|
+
error: _
|
|
6020
6050
|
};
|
|
6021
6051
|
}
|
|
6022
|
-
if (
|
|
6023
|
-
if (!
|
|
6024
|
-
yt(
|
|
6052
|
+
if (d || a.current.get(h.id) !== h.revision || h.revision <= (i.current.get(h.id) ?? 0)) return;
|
|
6053
|
+
if (!T) {
|
|
6054
|
+
yt(h.id, p), i.current.set(h.id, h.revision), window.dispatchEvent(new CustomEvent(Ee, { detail: h }));
|
|
6025
6055
|
return;
|
|
6026
6056
|
}
|
|
6027
6057
|
try {
|
|
6028
|
-
sl(
|
|
6029
|
-
} catch (
|
|
6058
|
+
sl(h.id, h.revision, T, p);
|
|
6059
|
+
} catch (_) {
|
|
6030
6060
|
throw {
|
|
6031
6061
|
stage: "register",
|
|
6032
|
-
error:
|
|
6062
|
+
error: _
|
|
6033
6063
|
};
|
|
6034
6064
|
}
|
|
6035
|
-
i.current.set(
|
|
6036
|
-
} catch (
|
|
6037
|
-
|
|
6038
|
-
const
|
|
6039
|
-
if (
|
|
6040
|
-
const
|
|
6041
|
-
console.error(`[boring-ui] failed to load plugin ${
|
|
6065
|
+
i.current.set(h.id, h.revision), window.dispatchEvent(new CustomEvent(Ee, { detail: h }));
|
|
6066
|
+
} catch (v) {
|
|
6067
|
+
h && a.current.get(h.id) === h.revision && a.current.delete(h.id);
|
|
6068
|
+
const w = typeof v == "object" && v && "stage" in v && v.stage === "register" ? "register" : "import", N = typeof v == "object" && v && "error" in v ? v.error : v;
|
|
6069
|
+
if (d) return;
|
|
6070
|
+
const T = (h == null ? void 0 : h.id) ?? "<malformed>", _ = N instanceof Error ? N.message : String(N);
|
|
6071
|
+
console.error(`[boring-ui] failed to load plugin ${T}; keeping previous version`, N), h && window.dispatchEvent(new CustomEvent(Ee, {
|
|
6042
6072
|
detail: {
|
|
6043
6073
|
type: "boring.plugin.front-error",
|
|
6044
|
-
id:
|
|
6045
|
-
revision:
|
|
6046
|
-
workspaceId:
|
|
6047
|
-
message:
|
|
6074
|
+
id: h.id,
|
|
6075
|
+
revision: h.revision,
|
|
6076
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6077
|
+
message: _,
|
|
6048
6078
|
code: Kc,
|
|
6049
|
-
stage:
|
|
6050
|
-
replay:
|
|
6079
|
+
stage: w,
|
|
6080
|
+
replay: h.replay
|
|
6051
6081
|
}
|
|
6052
6082
|
}));
|
|
6053
6083
|
} finally {
|
|
6054
|
-
|
|
6084
|
+
M && h && window.dispatchEvent(new CustomEvent(Ee, {
|
|
6055
6085
|
detail: {
|
|
6056
6086
|
type: "boring.plugin.front-settled",
|
|
6057
|
-
id:
|
|
6058
|
-
revision:
|
|
6059
|
-
workspaceId:
|
|
6060
|
-
replay:
|
|
6087
|
+
id: h.id,
|
|
6088
|
+
revision: h.revision,
|
|
6089
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6090
|
+
replay: h.replay
|
|
6061
6091
|
}
|
|
6062
6092
|
}));
|
|
6063
6093
|
}
|
|
6064
6094
|
})();
|
|
6065
|
-
},
|
|
6066
|
-
if (!
|
|
6095
|
+
}, x = (D) => {
|
|
6096
|
+
if (!d)
|
|
6067
6097
|
try {
|
|
6068
|
-
const
|
|
6069
|
-
if (
|
|
6070
|
-
const
|
|
6071
|
-
if (
|
|
6072
|
-
a.current.set(
|
|
6073
|
-
} catch (
|
|
6074
|
-
console.error("[boring-ui] failed to process plugin unload event",
|
|
6098
|
+
const h = JSON.parse(D.data);
|
|
6099
|
+
if (h.workspaceId && e.workspaceId && h.workspaceId !== e.workspaceId) return;
|
|
6100
|
+
const M = i.current.get(h.id) ?? 0, v = a.current.get(h.id) ?? 0;
|
|
6101
|
+
if (h.revision <= Math.max(M, v)) return;
|
|
6102
|
+
a.current.set(h.id, h.revision), yt(h.id, p), i.current.set(h.id, h.revision), window.dispatchEvent(new CustomEvent(Ee, { detail: h }));
|
|
6103
|
+
} catch (h) {
|
|
6104
|
+
console.error("[boring-ui] failed to process plugin unload event", h);
|
|
6075
6105
|
}
|
|
6076
|
-
},
|
|
6077
|
-
if (!
|
|
6106
|
+
}, k = (D) => {
|
|
6107
|
+
if (!d)
|
|
6078
6108
|
try {
|
|
6079
|
-
const
|
|
6080
|
-
if (
|
|
6081
|
-
console.error(`[boring-ui] plugin ${
|
|
6109
|
+
const h = JSON.parse(D.data);
|
|
6110
|
+
if (h.workspaceId && e.workspaceId && h.workspaceId !== e.workspaceId) return;
|
|
6111
|
+
console.error(`[boring-ui] plugin ${h.id} failed to reload: ${h.message}`), window.dispatchEvent(new CustomEvent(Ee, {
|
|
6082
6112
|
detail: {
|
|
6083
6113
|
type: "boring.plugin.error",
|
|
6084
|
-
id:
|
|
6085
|
-
revision:
|
|
6086
|
-
workspaceId:
|
|
6087
|
-
message:
|
|
6114
|
+
id: h.id,
|
|
6115
|
+
revision: h.revision,
|
|
6116
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6117
|
+
message: h.message
|
|
6088
6118
|
}
|
|
6089
6119
|
}));
|
|
6090
|
-
} catch (
|
|
6091
|
-
console.error("[boring-ui] failed to process plugin error event",
|
|
6120
|
+
} catch (h) {
|
|
6121
|
+
console.error("[boring-ui] failed to process plugin error event", h);
|
|
6092
6122
|
}
|
|
6093
|
-
},
|
|
6094
|
-
if (!
|
|
6123
|
+
}, $ = (D) => {
|
|
6124
|
+
if (!d)
|
|
6095
6125
|
try {
|
|
6096
|
-
const
|
|
6097
|
-
if (
|
|
6098
|
-
const
|
|
6099
|
-
for (const [
|
|
6100
|
-
|
|
6126
|
+
const h = JSON.parse(D.data);
|
|
6127
|
+
if (h.workspaceId && e.workspaceId && h.workspaceId !== e.workspaceId) return;
|
|
6128
|
+
const M = l.current;
|
|
6129
|
+
for (const [v, w] of i.current.entries())
|
|
6130
|
+
M.has(v) || (yt(v, p), i.current.delete(v), a.current.delete(v), window.dispatchEvent(new CustomEvent(Ee, {
|
|
6101
6131
|
detail: {
|
|
6102
6132
|
type: "boring.plugin.unload",
|
|
6103
|
-
id:
|
|
6104
|
-
revision:
|
|
6105
|
-
workspaceId:
|
|
6133
|
+
id: v,
|
|
6134
|
+
revision: w + 1,
|
|
6135
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6106
6136
|
replay: !0
|
|
6107
6137
|
}
|
|
6108
6138
|
})));
|
|
6109
|
-
|
|
6110
|
-
} catch (
|
|
6111
|
-
console.error("[boring-ui] failed to process plugin replay-complete event",
|
|
6139
|
+
M.clear(), window.dispatchEvent(new CustomEvent(Ee, { detail: h }));
|
|
6140
|
+
} catch (h) {
|
|
6141
|
+
console.error("[boring-ui] failed to process plugin replay-complete event", h);
|
|
6112
6142
|
}
|
|
6113
6143
|
};
|
|
6114
|
-
return g.addEventListener("boring.plugin.load",
|
|
6115
|
-
|
|
6116
|
-
for (const
|
|
6144
|
+
return g.addEventListener("boring.plugin.load", y), g.addEventListener("boring.plugin.unload", x), g.addEventListener("boring.plugin.error", k), g.addEventListener("boring.plugin.replay-complete", $), () => {
|
|
6145
|
+
d = !0;
|
|
6146
|
+
for (const D of i.current.keys()) yt(D, p);
|
|
6117
6147
|
i.current.clear(), a.current.clear(), l.current.clear(), g.close();
|
|
6118
6148
|
};
|
|
6119
6149
|
}, [e.apiBaseUrl, e.workspaceId, e.enabled, e.authHeaders, e.importFront, t, n, r, o, c]);
|
|
@@ -6139,23 +6169,23 @@ function Xl() {
|
|
|
6139
6169
|
return { theme: sn(), setTheme: e.setTheme, toggleTheme: e.toggleTheme };
|
|
6140
6170
|
}
|
|
6141
6171
|
function Ql({ children: e, defaultTheme: t, onThemeChange: n }) {
|
|
6142
|
-
const r =
|
|
6172
|
+
const r = A(null);
|
|
6143
6173
|
if (!r.current) {
|
|
6144
|
-
const
|
|
6145
|
-
wr(
|
|
6174
|
+
const f = Fr({ persistenceEnabled: !1 });
|
|
6175
|
+
wr(f);
|
|
6146
6176
|
const s = t ?? Kr();
|
|
6147
|
-
s !== "light" &&
|
|
6177
|
+
s !== "light" && f.getState().setTheme(s), r.current = f;
|
|
6148
6178
|
}
|
|
6149
|
-
const o = r.current, i =
|
|
6150
|
-
(
|
|
6151
|
-
o.getState().setTheme(
|
|
6179
|
+
const o = r.current, i = P(
|
|
6180
|
+
(f) => {
|
|
6181
|
+
o.getState().setTheme(f), n == null || n(f);
|
|
6152
6182
|
},
|
|
6153
6183
|
[o, n]
|
|
6154
|
-
), a =
|
|
6155
|
-
const
|
|
6156
|
-
i(
|
|
6184
|
+
), a = P(() => {
|
|
6185
|
+
const f = o.getState().preferences.theme === "light" ? "dark" : "light";
|
|
6186
|
+
i(f);
|
|
6157
6187
|
}, [o, i]), l = sn();
|
|
6158
|
-
|
|
6188
|
+
L(() => (document.documentElement.setAttribute("data-theme", l), () => {
|
|
6159
6189
|
document.documentElement.removeAttribute("data-theme");
|
|
6160
6190
|
}), [l]);
|
|
6161
6191
|
const c = H(() => ({ setTheme: i, toggleTheme: a }), [i, a]);
|
|
@@ -6218,7 +6248,7 @@ function hl({
|
|
|
6218
6248
|
}
|
|
6219
6249
|
function gl({ commands: e }) {
|
|
6220
6250
|
const t = Zt();
|
|
6221
|
-
return
|
|
6251
|
+
return L(() => {
|
|
6222
6252
|
if (!(e != null && e.length)) return;
|
|
6223
6253
|
const n = e.map((r) => r.id);
|
|
6224
6254
|
for (const r of n) t.unregisterCommand(r);
|
|
@@ -6233,7 +6263,7 @@ function vl({
|
|
|
6233
6263
|
catalogs: e
|
|
6234
6264
|
}) {
|
|
6235
6265
|
const t = Ft();
|
|
6236
|
-
return
|
|
6266
|
+
return L(() => {
|
|
6237
6267
|
if (e != null && e.length) {
|
|
6238
6268
|
for (const n of e)
|
|
6239
6269
|
t.register(n, Vn);
|
|
@@ -6261,8 +6291,8 @@ function wl({
|
|
|
6261
6291
|
}) {
|
|
6262
6292
|
return e.flatMap(
|
|
6263
6293
|
(l) => l.registrations.providers.map((c) => ({ plugin: l, provider: c }))
|
|
6264
|
-
).reduceRight((l, { plugin: c, provider:
|
|
6265
|
-
const s =
|
|
6294
|
+
).reduceRight((l, { plugin: c, provider: f }) => {
|
|
6295
|
+
const s = f.component;
|
|
6266
6296
|
return /* @__PURE__ */ u(
|
|
6267
6297
|
s,
|
|
6268
6298
|
{
|
|
@@ -6272,12 +6302,12 @@ function wl({
|
|
|
6272
6302
|
apiTimeout: o,
|
|
6273
6303
|
children: l
|
|
6274
6304
|
},
|
|
6275
|
-
`${c.id}:provider:${
|
|
6305
|
+
`${c.id}:provider:${f.id}`
|
|
6276
6306
|
);
|
|
6277
6307
|
}, i);
|
|
6278
6308
|
}
|
|
6279
6309
|
function bl({ onOpenFile: e }) {
|
|
6280
|
-
return
|
|
6310
|
+
return L(() => {
|
|
6281
6311
|
if (e)
|
|
6282
6312
|
return q.on(ve.uiCommand, ({ command: t }) => {
|
|
6283
6313
|
if (t.kind !== "openFile") return;
|
|
@@ -6286,7 +6316,7 @@ function bl({ onOpenFile: e }) {
|
|
|
6286
6316
|
});
|
|
6287
6317
|
}, [e]), null;
|
|
6288
6318
|
}
|
|
6289
|
-
function
|
|
6319
|
+
function xl(e, t) {
|
|
6290
6320
|
return !e || (t == null ? void 0 : t["x-boring-workspace-id"]) != null || (t == null ? void 0 : t["X-Boring-Workspace-Id"]) != null ? t : { "x-boring-workspace-id": e, ...t };
|
|
6291
6321
|
}
|
|
6292
6322
|
function eu({
|
|
@@ -6299,60 +6329,60 @@ function eu({
|
|
|
6299
6329
|
catalogs: a,
|
|
6300
6330
|
capabilities: l,
|
|
6301
6331
|
apiBaseUrl: c = "",
|
|
6302
|
-
authHeaders:
|
|
6332
|
+
authHeaders: f,
|
|
6303
6333
|
apiTimeout: s,
|
|
6304
|
-
defaultTheme:
|
|
6334
|
+
defaultTheme: d,
|
|
6305
6335
|
onThemeChange: p,
|
|
6306
|
-
workspaceId:
|
|
6336
|
+
workspaceId: m,
|
|
6307
6337
|
storageKey: g,
|
|
6308
|
-
persistenceEnabled:
|
|
6309
|
-
bridgeEndpoint:
|
|
6310
|
-
onAuthError:
|
|
6311
|
-
onOpenFile:
|
|
6312
|
-
debug:
|
|
6313
|
-
frontPluginHotReload:
|
|
6314
|
-
fullPageBasePath:
|
|
6338
|
+
persistenceEnabled: y = !0,
|
|
6339
|
+
bridgeEndpoint: x,
|
|
6340
|
+
onAuthError: k,
|
|
6341
|
+
onOpenFile: $,
|
|
6342
|
+
debug: D = !1,
|
|
6343
|
+
frontPluginHotReload: h = !1,
|
|
6344
|
+
fullPageBasePath: M
|
|
6315
6345
|
}) {
|
|
6316
|
-
const
|
|
6317
|
-
if (!
|
|
6346
|
+
const v = A(null);
|
|
6347
|
+
if (!v.current) {
|
|
6318
6348
|
const X = Fr({
|
|
6319
|
-
workspaceId:
|
|
6349
|
+
workspaceId: m,
|
|
6320
6350
|
storageKey: g,
|
|
6321
|
-
persistenceEnabled:
|
|
6351
|
+
persistenceEnabled: y
|
|
6322
6352
|
});
|
|
6323
6353
|
wr(X);
|
|
6324
|
-
const ae =
|
|
6325
|
-
ae !== "light" && !
|
|
6354
|
+
const ae = d ?? Kr();
|
|
6355
|
+
ae !== "light" && !y ? X.getState().setTheme(ae) : ae !== "light" && (typeof localStorage < "u" && localStorage.getItem("boring-ui-v2:preferences") !== null || X.getState().setTheme(ae)), v.current = X;
|
|
6326
6356
|
}
|
|
6327
|
-
const
|
|
6328
|
-
|
|
6329
|
-
const
|
|
6330
|
-
|
|
6357
|
+
const w = v.current, N = A(null), T = A(f);
|
|
6358
|
+
T.current = f;
|
|
6359
|
+
const _ = A(k);
|
|
6360
|
+
_.current = k, L(() => () => {
|
|
6331
6361
|
var X;
|
|
6332
|
-
(X =
|
|
6333
|
-
}, [
|
|
6362
|
+
(X = N.current) == null || X.disconnect(), N.current = null, w.cleanup();
|
|
6363
|
+
}, [w]), L(() => {
|
|
6334
6364
|
var ce, be;
|
|
6335
|
-
if (
|
|
6336
|
-
const X =
|
|
6337
|
-
endpoint:
|
|
6365
|
+
if (N.current && (N.current.disconnect(), N.current = null), !x) return;
|
|
6366
|
+
const X = xi(w), ae = (be = (ce = T.current) == null ? void 0 : ce.Authorization) == null ? void 0 : be.replace(/^Bearer\s+/i, ""), we = Ci({
|
|
6367
|
+
endpoint: x,
|
|
6338
6368
|
bridge: X,
|
|
6339
|
-
store:
|
|
6369
|
+
store: w,
|
|
6340
6370
|
authToken: ae,
|
|
6341
6371
|
onAuthError: (Ve) => {
|
|
6342
6372
|
var Re;
|
|
6343
|
-
return (Re =
|
|
6373
|
+
return (Re = _.current) == null ? void 0 : Re.call(_, Ve);
|
|
6344
6374
|
},
|
|
6345
6375
|
onConnectionChange: Ue
|
|
6346
6376
|
});
|
|
6347
|
-
return we.connect(),
|
|
6348
|
-
we.disconnect(),
|
|
6377
|
+
return we.connect(), N.current = we, () => {
|
|
6378
|
+
we.disconnect(), N.current = null;
|
|
6349
6379
|
};
|
|
6350
|
-
}, [
|
|
6380
|
+
}, [x, w]);
|
|
6351
6381
|
const { panelRegistry: W, commandRegistry: te, catalogRegistry: le, surfaceResolverRegistry: B, pluginMetas: ie, pluginsWithBindings: z } = H(() => {
|
|
6352
6382
|
const X = new Ps(l), ae = new ja(), we = new er(), ce = new tr();
|
|
6353
6383
|
for (const Ne of Bc) {
|
|
6354
|
-
const { id:
|
|
6355
|
-
X.register(
|
|
6384
|
+
const { id: b, ...E } = Ne;
|
|
6385
|
+
X.register(b, E);
|
|
6356
6386
|
}
|
|
6357
6387
|
const Ve = new Set(r ?? []).has(Nn.pluginId) ? [] : [Nn], Ke = ri({
|
|
6358
6388
|
chatPanel: t ?? ll,
|
|
@@ -6370,8 +6400,8 @@ function eu({
|
|
|
6370
6400
|
];
|
|
6371
6401
|
if (o)
|
|
6372
6402
|
for (const Ne of o) {
|
|
6373
|
-
const { id:
|
|
6374
|
-
X.register(
|
|
6403
|
+
const { id: b, ...E } = Ne;
|
|
6404
|
+
X.register(b, E);
|
|
6375
6405
|
}
|
|
6376
6406
|
return {
|
|
6377
6407
|
panelRegistry: X,
|
|
@@ -6381,53 +6411,53 @@ function eu({
|
|
|
6381
6411
|
pluginMetas: De,
|
|
6382
6412
|
pluginsWithBindings: Ke.plugins
|
|
6383
6413
|
};
|
|
6384
|
-
}, [l, t, n, r, o]), J =
|
|
6414
|
+
}, [l, t, n, r, o]), J = A(p);
|
|
6385
6415
|
J.current = p;
|
|
6386
|
-
const G =
|
|
6416
|
+
const G = P(
|
|
6387
6417
|
(X) => {
|
|
6388
6418
|
var ae;
|
|
6389
|
-
|
|
6419
|
+
w.getState().setTheme(X), (ae = J.current) == null || ae.call(J, X);
|
|
6390
6420
|
},
|
|
6391
|
-
[
|
|
6392
|
-
), ue =
|
|
6393
|
-
const X =
|
|
6421
|
+
[w]
|
|
6422
|
+
), ue = P(() => {
|
|
6423
|
+
const X = w.getState().preferences.theme === "light" ? "dark" : "light";
|
|
6394
6424
|
G(X);
|
|
6395
|
-
}, [
|
|
6396
|
-
|
|
6425
|
+
}, [w, G]), Ie = sn();
|
|
6426
|
+
L(() => (document.documentElement.setAttribute("data-theme", Ie), () => {
|
|
6397
6427
|
document.documentElement.removeAttribute("data-theme");
|
|
6398
6428
|
}), [Ie]);
|
|
6399
6429
|
const me = H(
|
|
6400
6430
|
() => ({ setTheme: G, toggleTheme: ue }),
|
|
6401
6431
|
[G, ue]
|
|
6402
6432
|
), he = H(
|
|
6403
|
-
() =>
|
|
6404
|
-
[
|
|
6405
|
-
), [ke, Ue] =
|
|
6433
|
+
() => xl(m, f),
|
|
6434
|
+
[f, m]
|
|
6435
|
+
), [ke, Ue] = O(!1), qe = H(
|
|
6406
6436
|
() => ({ connected: ke }),
|
|
6407
6437
|
[ke]
|
|
6408
6438
|
), Qe = H(
|
|
6409
|
-
() => ({ chatPanel: t ?? null, registeredPlugins: ie, debug:
|
|
6410
|
-
[t, ie,
|
|
6439
|
+
() => ({ chatPanel: t ?? null, registeredPlugins: ie, debug: D }),
|
|
6440
|
+
[t, ie, D]
|
|
6411
6441
|
);
|
|
6412
|
-
return /* @__PURE__ */ u(un.Provider, { value: Qe, children: /* @__PURE__ */ u(ln.Provider, { value: me, children: /* @__PURE__ */ u(Hr.Provider, { value: qe, children: /* @__PURE__ */ u(Ba, { basePath:
|
|
6442
|
+
return /* @__PURE__ */ u(un.Provider, { value: Qe, children: /* @__PURE__ */ u(ln.Provider, { value: me, children: /* @__PURE__ */ u(Hr.Provider, { value: qe, children: /* @__PURE__ */ u(Ba, { basePath: M, children: /* @__PURE__ */ u(Vc, { children: /* @__PURE__ */ u(li, { children: /* @__PURE__ */ u(
|
|
6413
6443
|
ii,
|
|
6414
6444
|
{
|
|
6415
6445
|
panelRegistry: W,
|
|
6416
6446
|
commandRegistry: te,
|
|
6417
6447
|
catalogRegistry: le,
|
|
6418
6448
|
surfaceResolverRegistry: B,
|
|
6419
|
-
children: /* @__PURE__ */ u(bs, { apiBaseUrl: c, workspaceId:
|
|
6449
|
+
children: /* @__PURE__ */ u(bs, { apiBaseUrl: c, workspaceId: m, authHeaders: he, children: /* @__PURE__ */ C(
|
|
6420
6450
|
wl,
|
|
6421
6451
|
{
|
|
6422
6452
|
plugins: z,
|
|
6423
6453
|
apiBaseUrl: c,
|
|
6424
6454
|
authHeaders: he,
|
|
6425
|
-
onAuthError:
|
|
6455
|
+
onAuthError: k,
|
|
6426
6456
|
apiTimeout: s,
|
|
6427
6457
|
children: [
|
|
6428
6458
|
/* @__PURE__ */ u(yl, { plugins: z }),
|
|
6429
|
-
/* @__PURE__ */ u(ul, { apiBaseUrl: c, workspaceId:
|
|
6430
|
-
/* @__PURE__ */ u(bl, { onOpenFile:
|
|
6459
|
+
/* @__PURE__ */ u(ul, { apiBaseUrl: c, workspaceId: m, mode: h, authHeaders: he }),
|
|
6460
|
+
/* @__PURE__ */ u(bl, { onOpenFile: $ }),
|
|
6431
6461
|
/* @__PURE__ */ u(gl, { commands: i }),
|
|
6432
6462
|
/* @__PURE__ */ u(
|
|
6433
6463
|
vl,
|
|
@@ -6435,7 +6465,7 @@ function eu({
|
|
|
6435
6465
|
catalogs: a
|
|
6436
6466
|
}
|
|
6437
6467
|
),
|
|
6438
|
-
/* @__PURE__ */ u(hl, { store:
|
|
6468
|
+
/* @__PURE__ */ u(hl, { store: w }),
|
|
6439
6469
|
/* @__PURE__ */ u(lc, {}),
|
|
6440
6470
|
/* @__PURE__ */ u(Wo, {}),
|
|
6441
6471
|
e,
|
|
@@ -6503,7 +6533,7 @@ export {
|
|
|
6503
6533
|
fl as ao,
|
|
6504
6534
|
pl as ap,
|
|
6505
6535
|
Xe as aq,
|
|
6506
|
-
|
|
6536
|
+
ot as ar,
|
|
6507
6537
|
Ol as as,
|
|
6508
6538
|
Xo as at,
|
|
6509
6539
|
qt as au,
|
|
@@ -6531,7 +6561,7 @@ export {
|
|
|
6531
6561
|
At as u,
|
|
6532
6562
|
Ua as v,
|
|
6533
6563
|
vi as w,
|
|
6534
|
-
|
|
6564
|
+
xi as x,
|
|
6535
6565
|
Ci as y,
|
|
6536
6566
|
Fr as z
|
|
6537
6567
|
};
|