@hachej/boring-workspace 0.1.33 → 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-SmsE0Raq.js → FileTree-DWbh0xNI.js} +1 -1
- package/dist/{MarkdownEditor-zbp8ezds.js → MarkdownEditor-BhLjIyPQ.js} +1 -1
- package/dist/{WorkspaceLoadingState-BlvZXmFg.js → WorkspaceLoadingState-RVGURLJy.js} +1 -1
- package/dist/{WorkspaceProvider-CuIZx1ua.js → WorkspaceProvider-hCE2wXKZ.js} +1029 -1015
- package/dist/app-front.js +3 -3
- 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.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";
|
|
@@ -54,12 +54,12 @@ function He(e) {
|
|
|
54
54
|
}
|
|
55
55
|
function Zn(e = {}) {
|
|
56
56
|
const t = [], n = [], r = [], o = [], i = [], a = [], l = [], c = /* @__PURE__ */ new Map(), f = (s, d) => {
|
|
57
|
-
const p = `${s}:${d}`,
|
|
58
|
-
if (
|
|
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} "${d}" twice (first as ${
|
|
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
65
|
c.set(p, `${s} "${d}"`);
|
|
@@ -363,7 +363,7 @@ 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
368
|
const l = n ?? i.current, c = r ?? a.current, f = H(
|
|
369
369
|
() => ({
|
|
@@ -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() {
|
|
@@ -553,12 +553,12 @@ function Si(e) {
|
|
|
553
553
|
async openFile(c, f) {
|
|
554
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 d = e.getState(), p = s.data.mode ?? "edit",
|
|
557
|
-
if (d.panels.find((
|
|
558
|
-
const
|
|
559
|
-
return d.activatePanel(
|
|
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 d.panels.length >= ht ? i("MAX_PANELS", `cannot exceed ${ht} open panels`) : (d.openFile(c,
|
|
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
564
|
const f = gi.safeParse(c);
|
|
@@ -623,7 +623,7 @@ function Si(e) {
|
|
|
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;
|
|
@@ -697,40 +697,40 @@ function Ci(e) {
|
|
|
697
697
|
onVersionMismatch: c,
|
|
698
698
|
onConnectionChange: f
|
|
699
699
|
} = e;
|
|
700
|
-
let s = null, d = null, p = 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), d !== null && (clearInterval(d), d = null), p !== null && (clearTimeout(p), p = 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
|
}
|
|
@@ -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,45 +1003,45 @@ 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 f = !1, s = null, d = null, p = null,
|
|
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 (f ||
|
|
1012
|
-
|
|
1013
|
-
const
|
|
1010
|
+
function k() {
|
|
1011
|
+
if (f || y || !i) return;
|
|
1012
|
+
y = !0;
|
|
1013
|
+
const D = async () => {
|
|
1014
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
1020
|
if (f) return;
|
|
1021
|
-
if (
|
|
1022
|
-
const
|
|
1023
|
-
if (Array.isArray(
|
|
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
|
-
f || (d = setTimeout(
|
|
1029
|
+
f || (d = setTimeout(D, c));
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
|
-
|
|
1032
|
+
D();
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function $() {
|
|
1035
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", () => {
|
|
@@ -1049,16 +1049,16 @@ function Bi(e) {
|
|
|
1049
1049
|
}), s.addEventListener("error", () => {
|
|
1050
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
|
-
f = !0, s && (s.close(), s = null), d && (clearTimeout(d), d = null), p && (p.abort(), p = null),
|
|
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;
|
|
@@ -1091,31 +1091,31 @@ class Hi {
|
|
|
1091
1091
|
s > 0 && await Ki(this.retryBaseMs * 2 ** (s - 1));
|
|
1092
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
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)
|
|
@@ -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,17 +1270,17 @@ function ns() {
|
|
|
1270
1270
|
} catch {
|
|
1271
1271
|
return;
|
|
1272
1272
|
}
|
|
1273
|
-
const f = (
|
|
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
|
}
|
|
@@ -1288,7 +1288,7 @@ function ns() {
|
|
|
1288
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
1293
|
return o.addEventListener("change", s), o.addEventListener("unsupported", d), o.addEventListener("resync-required", p), () => {
|
|
1294
1294
|
o && (o.removeEventListener("change", s), o.removeEventListener("unsupported", d), o.removeEventListener("resync-required", p), i || o.close(), o = null);
|
|
@@ -1298,16 +1298,16 @@ function ns() {
|
|
|
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,7 +1348,7 @@ 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: {
|
|
@@ -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,11 +1633,11 @@ 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
|
-
|
|
1636
|
+
var m;
|
|
1637
|
+
rt(r.subscribe, r.getSnapshot, r.getSnapshot);
|
|
1638
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
1639
|
if (!f) return null;
|
|
1640
|
-
const d = (l == null ? void 0 : l.pluginId) ?? (l == null ? void 0 : l.id) ?? t, p = typeof ((
|
|
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
|
{
|
|
@@ -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,50 +1865,54 @@ 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(" ●"), f = c ? r.slice(0, -2) : r, s = Cs(f), d = Ts(e.params, "path") ?? As(t.id), p = Ns(e).map(Rs).filter((
|
|
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
|
-
!d &&
|
|
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(
|
|
@@ -1917,27 +1921,37 @@ function Ls(e) {
|
|
|
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(
|
|
@@ -1946,12 +1960,12 @@ function Ls(e) {
|
|
|
1946
1960
|
"cursor-pointer transition-colors"
|
|
1947
1961
|
),
|
|
1948
1962
|
title: c ? `${f} (unsaved changes)` : f,
|
|
1949
|
-
onPointerDown: (
|
|
1950
|
-
|
|
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",
|
|
@@ -1970,7 +1984,7 @@ function Ls(e) {
|
|
|
1970
1984
|
}
|
|
1971
1985
|
),
|
|
1972
1986
|
/* @__PURE__ */ u("span", { className: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap", children: f }),
|
|
1973
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ C("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
1974
1988
|
c ? /* @__PURE__ */ u(
|
|
1975
1989
|
"span",
|
|
1976
1990
|
{
|
|
@@ -1996,8 +2010,8 @@ 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:
|
|
2013
|
+
{ onClickCapture: x }
|
|
2014
|
+
) : { onClick: x },
|
|
2001
2015
|
"aria-label": `Close ${f}`,
|
|
2002
2016
|
children: /* @__PURE__ */ u(Hn, { className: "h-3 w-3", strokeWidth: 2.25 })
|
|
2003
2017
|
}
|
|
@@ -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)));
|
|
@@ -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);
|
|
@@ -2162,7 +2176,7 @@ function zs(e, t, n, r, o, i) {
|
|
|
2162
2176
|
}
|
|
2163
2177
|
for (const s of t.groups) {
|
|
2164
2178
|
const d = a.getPanel(s.panel ?? s.id);
|
|
2165
|
-
d != null && d.group && (s.locked && (d.group.locked = "no-drop-target"), s.hideHeader && (d.group.header.hidden = !0),
|
|
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) => {
|
|
@@ -2174,7 +2188,7 @@ function zs(e, t, n, r, o, i) {
|
|
|
2174
2188
|
if (l.length > 0) {
|
|
2175
2189
|
const s = () => {
|
|
2176
2190
|
for (const d of l)
|
|
2177
|
-
|
|
2191
|
+
Sn(a, d);
|
|
2178
2192
|
};
|
|
2179
2193
|
window.addEventListener("resize", s), c = () => window.removeEventListener("resize", s);
|
|
2180
2194
|
}
|
|
@@ -2185,11 +2199,11 @@ function zs(e, t, n, r, o, i) {
|
|
|
2185
2199
|
s && clearTimeout(s), s = setTimeout(() => {
|
|
2186
2200
|
o(a.toJSON());
|
|
2187
2201
|
}, $s);
|
|
2188
|
-
}, p = a.onDidLayoutChange(d),
|
|
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 = () => {
|
|
@@ -2208,72 +2222,72 @@ function js({
|
|
|
2208
2222
|
rightHeaderActions: l,
|
|
2209
2223
|
watermarkComponent: c
|
|
2210
2224
|
}) {
|
|
2211
|
-
const f = At(), s =
|
|
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
|
-
}, [f, s, o]),
|
|
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
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
|
-
(
|
|
2269
|
+
const D = P(
|
|
2270
|
+
(h) => {
|
|
2257
2271
|
if (!d) {
|
|
2258
|
-
|
|
2272
|
+
m.current = h;
|
|
2259
2273
|
return;
|
|
2260
2274
|
}
|
|
2261
|
-
|
|
2275
|
+
$(h);
|
|
2262
2276
|
},
|
|
2263
|
-
[d,
|
|
2277
|
+
[d, $]
|
|
2264
2278
|
);
|
|
2265
|
-
return
|
|
2266
|
-
d &&
|
|
2267
|
-
}, [d,
|
|
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: f } = mr(e), [s, d] =
|
|
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
|
-
d((
|
|
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
|
-
d((
|
|
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: f ? /* @__PURE__ */ u("div", { className: "space-y-1 p-2", "data-testid": "tree-skeleton", children: Array.from({ length: 8 }).map((
|
|
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, 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,
|
|
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:
|
|
2870
|
+
searchQuery: D,
|
|
2857
2871
|
bridge: f,
|
|
2858
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,7 +2887,7 @@ function Xs({
|
|
|
2873
2887
|
Pn,
|
|
2874
2888
|
{
|
|
2875
2889
|
rootDir: c,
|
|
2876
|
-
searchQuery:
|
|
2890
|
+
searchQuery: D,
|
|
2877
2891
|
bridge: f,
|
|
2878
2892
|
revealFileTreeRequest: d,
|
|
2879
2893
|
className: l
|
|
@@ -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,15 +2986,15 @@ 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;
|
|
@@ -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),
|
|
3016
|
+
if (ue && clearTimeout(ue), k.current === G && (k.current = null), h.current !== J) return;
|
|
3003
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
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
3161
|
const G = g.current, ue = await d({ path: o, content: G });
|
|
3148
|
-
if (
|
|
3149
|
-
typeof ue.mtimeMs == "number" && (
|
|
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, d]), B =
|
|
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
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,
|
|
@@ -3212,12 +3226,12 @@ function Er({
|
|
|
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,7 +3240,7 @@ 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,
|
|
@@ -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 : "", {
|
|
@@ -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: d ? /* @__PURE__ */
|
|
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
|
-
] }) : f || !l ? /* @__PURE__ */ u(
|
|
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);
|
|
@@ -3512,8 +3526,8 @@ async function Ea(e) {
|
|
|
3512
3526
|
const d = Rr(n, s);
|
|
3513
3527
|
if (d)
|
|
3514
3528
|
try {
|
|
3515
|
-
const p = await Nr(an(r, d, i), o, a),
|
|
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
|
}
|
|
@@ -3550,35 +3564,35 @@ async function Ea(e) {
|
|
|
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
|
-
), [d, p] =
|
|
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
3575
|
f(!0), l(null), i(null);
|
|
3562
|
-
const
|
|
3563
|
-
return r && (
|
|
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
3589
|
g.signal.aborted || f(!1);
|
|
3576
3590
|
}), () => g.abort();
|
|
3577
|
-
}, [n, e, s, r, d]), e ? c ? /* @__PURE__ */
|
|
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,
|
|
@@ -4076,7 +4090,7 @@ function Fr(e = {}) {
|
|
|
4076
4090
|
);
|
|
4077
4091
|
},
|
|
4078
4092
|
openPanel: (s) => c((d) => ({
|
|
4079
|
-
panels: d.panels.some((
|
|
4093
|
+
panels: d.panels.some((m) => m.id === s.id) ? d.panels : [...d.panels, s],
|
|
4080
4094
|
activePanel: s.id
|
|
4081
4095
|
})),
|
|
4082
4096
|
closePanel: (s) => c((d) => ({
|
|
@@ -4096,8 +4110,8 @@ function Fr(e = {}) {
|
|
|
4096
4110
|
}
|
|
4097
4111
|
})),
|
|
4098
4112
|
markClean: (s) => c((d) => {
|
|
4099
|
-
const { [s]: p, ...
|
|
4100
|
-
return { dirtyFiles:
|
|
4113
|
+
const { [s]: p, ...m } = d.dirtyFiles;
|
|
4114
|
+
return { dirtyFiles: m };
|
|
4101
4115
|
}),
|
|
4102
4116
|
showNotification: (s) => c((d) => ({
|
|
4103
4117
|
notifications: [
|
|
@@ -4257,14 +4271,14 @@ 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 =
|
|
4274
|
+
const i = H(() => n || r ? [] : oc(cn(), e, t), [n, r, e, t]), a = P((f, s) => {
|
|
4261
4275
|
$n(f.id, s), f.onSelect(s), o();
|
|
4262
|
-
}, [o]), l =
|
|
4276
|
+
}, [o]), l = P(
|
|
4263
4277
|
(f) => {
|
|
4264
4278
|
_n(f.id, f.title), f.run(), o();
|
|
4265
4279
|
},
|
|
4266
4280
|
[o]
|
|
4267
|
-
), c =
|
|
4281
|
+
), c = P((f) => {
|
|
4268
4282
|
if (f.type === "catalog") {
|
|
4269
4283
|
const s = e.find((d) => d.id === f.catalogId);
|
|
4270
4284
|
s && ($n(s.id, f.rowSnapshot), s.onSelect(f.rowSnapshot));
|
|
@@ -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,14 +4340,14 @@ function ac({
|
|
|
4326
4340
|
}
|
|
4327
4341
|
l.current = e;
|
|
4328
4342
|
}, [e, r, o]);
|
|
4329
|
-
const f =
|
|
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 =
|
|
4348
|
+
}, [r, o]), s = P(() => {
|
|
4335
4349
|
f(n === "commands" ? "catalogs" : "commands");
|
|
4336
|
-
}, [n, f]), d =
|
|
4350
|
+
}, [n, f]), d = P((p) => {
|
|
4337
4351
|
p.key === "Tab" && (p.preventDefault(), p.stopPropagation(), s());
|
|
4338
4352
|
}, [s]);
|
|
4339
4353
|
return {
|
|
@@ -4347,15 +4361,15 @@ 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;
|
|
@@ -4364,10 +4378,10 @@ function cc({
|
|
|
4364
4378
|
a((s) => {
|
|
4365
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
|
});
|
|
@@ -4375,7 +4389,7 @@ function cc({
|
|
|
4375
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
|
};
|
|
@@ -4416,32 +4430,32 @@ 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
|
-
}, [f == null ? void 0 : f.registeredPlugins]), d = i === "commands", p = r.trim(),
|
|
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
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,
|
|
@@ -4449,7 +4463,7 @@ function lc(e) {
|
|
|
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,24 +4472,24 @@ 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
4484
|
isCommandMode: d,
|
|
4471
4485
|
query: r,
|
|
4472
|
-
onQueryChange:
|
|
4473
|
-
onInputKeyDown:
|
|
4474
|
-
onSwitchMode:
|
|
4475
|
-
loading: !d &&
|
|
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",
|
|
@@ -4486,26 +4500,26 @@ function lc(e) {
|
|
|
4486
4500
|
dc,
|
|
4487
4501
|
{
|
|
4488
4502
|
isCommandMode: d,
|
|
4489
|
-
recentEntries:
|
|
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:
|
|
4511
|
+
catalogGroups: m,
|
|
4498
4512
|
isCommandMode: d,
|
|
4499
|
-
onCatalogSelect:
|
|
4513
|
+
onCatalogSelect: h
|
|
4500
4514
|
}
|
|
4501
4515
|
),
|
|
4502
4516
|
/* @__PURE__ */ u(
|
|
4503
4517
|
mc,
|
|
4504
4518
|
{
|
|
4505
|
-
commandResults:
|
|
4519
|
+
commandResults: $,
|
|
4506
4520
|
isCommandMode: d,
|
|
4507
4521
|
pluginLabelMap: s,
|
|
4508
|
-
onCommandSelect:
|
|
4522
|
+
onCommandSelect: M
|
|
4509
4523
|
}
|
|
4510
4524
|
)
|
|
4511
4525
|
]
|
|
@@ -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
|
|
@@ -4743,17 +4757,17 @@ function yc(e) {
|
|
|
4743
4757
|
closeWorkbench: l,
|
|
4744
4758
|
bridgeEndpoint: c,
|
|
4745
4759
|
...f
|
|
4746
|
-
} = e, s =
|
|
4747
|
-
(
|
|
4748
|
-
var
|
|
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
|
-
), d = gc(f.requestHeaders), p = n.filter((
|
|
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),
|
|
@@ -4767,25 +4781,25 @@ function yc(e) {
|
|
|
4767
4781
|
}
|
|
4768
4782
|
});
|
|
4769
4783
|
}, [c, r, o, i, a, l, d]);
|
|
4770
|
-
const
|
|
4771
|
-
var
|
|
4772
|
-
window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: f.sessionId } })), (
|
|
4773
|
-
}, [f.sessionId, e.onComposerStop]), g =
|
|
4774
|
-
(
|
|
4775
|
-
if (
|
|
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") {
|
|
4776
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
4798
|
[f.sessionId, l, r, o, i, a]
|
|
4785
|
-
),
|
|
4786
|
-
(
|
|
4787
|
-
var
|
|
4788
|
-
Oi(
|
|
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
|
);
|
|
@@ -4795,9 +4809,9 @@ function yc(e) {
|
|
|
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
|
|
4840
|
+
function xc(e) {
|
|
4827
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 (!
|
|
4843
|
+
const m = St(p.updatedAt);
|
|
4844
|
+
if (!m) {
|
|
4831
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 (((
|
|
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;
|
|
4841
4855
|
}, d = [];
|
|
4842
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";
|
|
@@ -4869,8 +4883,8 @@ function kc({
|
|
|
4869
4883
|
onClose: c,
|
|
4870
4884
|
className: f
|
|
4871
4885
|
}) {
|
|
4872
|
-
const s = H(() =>
|
|
4873
|
-
return /* @__PURE__ */
|
|
4886
|
+
const s = H(() => xc(e), [e]);
|
|
4887
|
+
return /* @__PURE__ */ C(
|
|
4874
4888
|
"div",
|
|
4875
4889
|
{
|
|
4876
4890
|
"data-boring-workspace-part": "session-list",
|
|
@@ -4881,33 +4895,33 @@ function kc({
|
|
|
4881
4895
|
role: "navigation",
|
|
4882
4896
|
"aria-label": "Session history",
|
|
4883
4897
|
children: [
|
|
4884
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ C("div", { className: "flex h-11 items-center justify-between border-b border-border/60 px-3.5", children: [
|
|
4885
4899
|
/* @__PURE__ */ u("span", { className: "text-[12px] font-medium tracking-tight text-foreground/70", children: "Sessions" }),
|
|
4886
|
-
/* @__PURE__ */
|
|
4900
|
+
/* @__PURE__ */ C("div", { className: "flex items-center gap-0.5", children: [
|
|
4887
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 }) }),
|
|
4888
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 }) })
|
|
4889
4903
|
] })
|
|
4890
4904
|
] }),
|
|
4891
|
-
/* @__PURE__ */
|
|
4892
|
-
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: [
|
|
4893
4907
|
"No sessions yet.",
|
|
4894
4908
|
/* @__PURE__ */ u("br", {}),
|
|
4895
4909
|
"Start a new chat to begin."
|
|
4896
4910
|
] }),
|
|
4897
|
-
s.map((d, p) => /* @__PURE__ */
|
|
4898
|
-
/* @__PURE__ */
|
|
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: [
|
|
4899
4913
|
/* @__PURE__ */ u("span", { children: d.label }),
|
|
4900
4914
|
/* @__PURE__ */ u("span", { "aria-hidden": "true", className: "text-[10.5px] tabular-nums text-muted-foreground/40", children: d.items.length })
|
|
4901
4915
|
] }),
|
|
4902
|
-
/* @__PURE__ */ u("ul", { role: "list", className: "flex flex-col", children: d.items.map((
|
|
4916
|
+
/* @__PURE__ */ u("ul", { role: "list", className: "flex flex-col", children: d.items.map((m) => /* @__PURE__ */ u(
|
|
4903
4917
|
Pc,
|
|
4904
4918
|
{
|
|
4905
|
-
session:
|
|
4906
|
-
active:
|
|
4919
|
+
session: m,
|
|
4920
|
+
active: m.id === t,
|
|
4907
4921
|
onSwitch: n,
|
|
4908
4922
|
onDelete: o
|
|
4909
4923
|
},
|
|
4910
|
-
|
|
4924
|
+
m.id
|
|
4911
4925
|
)) })
|
|
4912
4926
|
] }, d.key)),
|
|
4913
4927
|
a && i ? /* @__PURE__ */ u("div", { className: "px-3 py-3", children: /* @__PURE__ */ u(
|
|
@@ -4931,8 +4945,8 @@ function Pc({
|
|
|
4931
4945
|
onSwitch: n,
|
|
4932
4946
|
onDelete: r
|
|
4933
4947
|
}) {
|
|
4934
|
-
const o =
|
|
4935
|
-
return /* @__PURE__ */
|
|
4948
|
+
const o = Sc(e.updatedAt);
|
|
4949
|
+
return /* @__PURE__ */ C(
|
|
4936
4950
|
"li",
|
|
4937
4951
|
{
|
|
4938
4952
|
role: "listitem",
|
|
@@ -4945,7 +4959,7 @@ function Pc({
|
|
|
4945
4959
|
),
|
|
4946
4960
|
onClick: () => n == null ? void 0 : n(e.id),
|
|
4947
4961
|
children: [
|
|
4948
|
-
/* @__PURE__ */
|
|
4962
|
+
/* @__PURE__ */ C("span", { className: "min-w-0 flex-1 truncate leading-5", title: e.title, children: [
|
|
4949
4963
|
/* @__PURE__ */ u("span", { className: oe(t ? "font-medium text-foreground" : "text-foreground/90"), children: e.title || "Untitled" }),
|
|
4950
4964
|
o && /* @__PURE__ */ u(
|
|
4951
4965
|
"span",
|
|
@@ -5006,7 +5020,7 @@ function Wr({
|
|
|
5006
5020
|
className: a
|
|
5007
5021
|
}) {
|
|
5008
5022
|
var te, le;
|
|
5009
|
-
const l = At(), c =
|
|
5023
|
+
const l = At(), c = rt(
|
|
5010
5024
|
l.subscribe,
|
|
5011
5025
|
l.getSnapshot,
|
|
5012
5026
|
l.getSnapshot
|
|
@@ -5025,33 +5039,33 @@ function Wr({
|
|
|
5025
5039
|
});
|
|
5026
5040
|
}
|
|
5027
5041
|
return B;
|
|
5028
|
-
}, [f]), [d, p] =
|
|
5029
|
-
|
|
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(() => {
|
|
5030
5044
|
var B;
|
|
5031
|
-
g && ((B =
|
|
5032
|
-
}, [g]),
|
|
5045
|
+
g && ((B = h.current) == null || B.focus());
|
|
5046
|
+
}, [g]), L(() => {
|
|
5033
5047
|
s.length > 0 && !s.some((B) => B.id === d) && p(s[0].id);
|
|
5034
|
-
}, [d, s]),
|
|
5048
|
+
}, [d, s]), L(() => {
|
|
5035
5049
|
r && s.some((B) => B.id === zn) && p(zn);
|
|
5036
5050
|
}, [r, s]);
|
|
5037
|
-
const
|
|
5038
|
-
|
|
5039
|
-
}, []),
|
|
5040
|
-
B.key === "Escape" && (B.preventDefault(),
|
|
5041
|
-
}, []),
|
|
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(
|
|
5042
5056
|
() => ({
|
|
5043
5057
|
rootDir: e,
|
|
5044
5058
|
bridge: t,
|
|
5045
|
-
query:
|
|
5046
|
-
searchQuery:
|
|
5059
|
+
query: $,
|
|
5060
|
+
searchQuery: $ || void 0,
|
|
5047
5061
|
chromeless: !0,
|
|
5048
5062
|
revealFileTreeRequest: r
|
|
5049
5063
|
}),
|
|
5050
|
-
[t,
|
|
5064
|
+
[t, $, r, e]
|
|
5051
5065
|
);
|
|
5052
|
-
return /* @__PURE__ */
|
|
5053
|
-
/* @__PURE__ */
|
|
5054
|
-
/* @__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(
|
|
5055
5069
|
Mo,
|
|
5056
5070
|
{
|
|
5057
5071
|
value: B.id,
|
|
@@ -5063,13 +5077,13 @@ function Wr({
|
|
|
5063
5077
|
},
|
|
5064
5078
|
B.id
|
|
5065
5079
|
)) }) }),
|
|
5066
|
-
|
|
5080
|
+
_ && /* @__PURE__ */ u(
|
|
5067
5081
|
ge,
|
|
5068
5082
|
{
|
|
5069
5083
|
type: "button",
|
|
5070
5084
|
variant: "ghost",
|
|
5071
5085
|
size: "icon-xs",
|
|
5072
|
-
onClick:
|
|
5086
|
+
onClick: v,
|
|
5073
5087
|
className: oe(g && "bg-foreground/5 text-foreground"),
|
|
5074
5088
|
"aria-label": "Search",
|
|
5075
5089
|
title: "Search",
|
|
@@ -5089,33 +5103,33 @@ function Wr({
|
|
|
5089
5103
|
}
|
|
5090
5104
|
)
|
|
5091
5105
|
] }),
|
|
5092
|
-
|
|
5106
|
+
_ && g && /* @__PURE__ */ C("div", { className: "flex items-center gap-1 border-b border-border/60 px-2 py-1.5", children: [
|
|
5093
5107
|
/* @__PURE__ */ u(pn, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
5094
5108
|
/* @__PURE__ */ u(
|
|
5095
5109
|
Yn,
|
|
5096
5110
|
{
|
|
5097
|
-
ref:
|
|
5111
|
+
ref: h,
|
|
5098
5112
|
type: "text",
|
|
5099
|
-
value:
|
|
5100
|
-
onChange: (B) =>
|
|
5101
|
-
onKeyDown:
|
|
5102
|
-
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()}...`,
|
|
5103
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"
|
|
5104
5118
|
}
|
|
5105
5119
|
),
|
|
5106
|
-
|
|
5120
|
+
x && /* @__PURE__ */ u(
|
|
5107
5121
|
ge,
|
|
5108
5122
|
{
|
|
5109
5123
|
type: "button",
|
|
5110
5124
|
variant: "ghost",
|
|
5111
5125
|
size: "icon-xs",
|
|
5112
|
-
onClick: () =>
|
|
5126
|
+
onClick: () => k(""),
|
|
5113
5127
|
"aria-label": "Clear search",
|
|
5114
5128
|
children: /* @__PURE__ */ u(Hn, { className: "h-3 w-3" })
|
|
5115
5129
|
}
|
|
5116
5130
|
)
|
|
5117
5131
|
] }),
|
|
5118
|
-
/* @__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 }) })
|
|
5119
5133
|
] });
|
|
5120
5134
|
}
|
|
5121
5135
|
const Ic = { dispose() {
|
|
@@ -5217,15 +5231,15 @@ function jr({
|
|
|
5217
5231
|
const s = !!(o || r), d = (n == null ? void 0 : n.slice().sort().join("\0")) ?? "*", p = H(() => {
|
|
5218
5232
|
if (!s)
|
|
5219
5233
|
return $c(t, n ? new Set(n) : void 0);
|
|
5220
|
-
}, [n, s, t]),
|
|
5234
|
+
}, [n, s, t]), m = P(
|
|
5221
5235
|
(g) => {
|
|
5222
5236
|
if (o) {
|
|
5223
5237
|
o(g);
|
|
5224
5238
|
return;
|
|
5225
5239
|
}
|
|
5226
|
-
const
|
|
5240
|
+
const y = { v: zr, layout: g };
|
|
5227
5241
|
try {
|
|
5228
|
-
window.localStorage.setItem(t, JSON.stringify(
|
|
5242
|
+
window.localStorage.setItem(t, JSON.stringify(y));
|
|
5229
5243
|
} catch {
|
|
5230
5244
|
}
|
|
5231
5245
|
},
|
|
@@ -5241,7 +5255,7 @@ function jr({
|
|
|
5241
5255
|
{
|
|
5242
5256
|
layout: Lc,
|
|
5243
5257
|
persistedLayout: r ?? p,
|
|
5244
|
-
onLayoutChange:
|
|
5258
|
+
onLayoutChange: m,
|
|
5245
5259
|
onReady: i,
|
|
5246
5260
|
allowedPanels: n,
|
|
5247
5261
|
prefixHeaderActions: a,
|
|
@@ -5313,99 +5327,99 @@ function Oc({
|
|
|
5313
5327
|
initialPanels: s,
|
|
5314
5328
|
className: d
|
|
5315
5329
|
}) {
|
|
5316
|
-
const [p,
|
|
5330
|
+
const [p, m] = O(() => {
|
|
5317
5331
|
if (!o) return !1;
|
|
5318
5332
|
try {
|
|
5319
5333
|
return localStorage.getItem(`${o}:sidebarCollapsed`) === "1";
|
|
5320
5334
|
} catch {
|
|
5321
5335
|
return !1;
|
|
5322
5336
|
}
|
|
5323
|
-
}), [g,
|
|
5337
|
+
}), [g, y] = O(() => {
|
|
5324
5338
|
if (!o) return t;
|
|
5325
5339
|
try {
|
|
5326
|
-
const
|
|
5327
|
-
if (!
|
|
5328
|
-
const
|
|
5329
|
-
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;
|
|
5330
5344
|
} catch {
|
|
5331
5345
|
return t;
|
|
5332
5346
|
}
|
|
5333
|
-
}),
|
|
5334
|
-
|
|
5335
|
-
const
|
|
5336
|
-
|
|
5337
|
-
const
|
|
5338
|
-
|
|
5339
|
-
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(
|
|
5340
5354
|
/* @__PURE__ */ new Map()
|
|
5341
|
-
), B = At(), ie =
|
|
5355
|
+
), B = At(), ie = rt(
|
|
5342
5356
|
B.subscribe,
|
|
5343
5357
|
B.getSnapshot,
|
|
5344
5358
|
B.getSnapshot
|
|
5345
|
-
), z = nr(), J =
|
|
5359
|
+
), z = nr(), J = A(B);
|
|
5346
5360
|
J.current = B;
|
|
5347
|
-
const G =
|
|
5361
|
+
const G = A(z);
|
|
5348
5362
|
G.current = z;
|
|
5349
5363
|
const ue = H(() => {
|
|
5350
|
-
const
|
|
5351
|
-
for (const
|
|
5352
|
-
|
|
5353
|
-
for (const
|
|
5354
|
-
|
|
5355
|
-
return [...
|
|
5356
|
-
}, [c, ie]), Ie =
|
|
5357
|
-
const
|
|
5358
|
-
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) {
|
|
5359
5373
|
console.warn("[SurfaceShell] openFile: surface not ready (dockview not initialized)");
|
|
5360
5374
|
return;
|
|
5361
5375
|
}
|
|
5362
|
-
const
|
|
5376
|
+
const I = kt(b), j = {
|
|
5363
5377
|
kind: Be,
|
|
5364
|
-
target:
|
|
5378
|
+
target: I
|
|
5365
5379
|
}, Z = G.current.resolve(j);
|
|
5366
5380
|
if (Z) {
|
|
5367
5381
|
if (!J.current.has(Z.component)) {
|
|
5368
|
-
console.warn(`[SurfaceShell] openFile: resolver returned unknown panel "${Z.component}" for "${
|
|
5382
|
+
console.warn(`[SurfaceShell] openFile: resolver returned unknown panel "${Z.component}" for "${I}"`);
|
|
5369
5383
|
return;
|
|
5370
5384
|
}
|
|
5371
5385
|
const pe = jt(j, Z);
|
|
5372
5386
|
W.current.add(pe);
|
|
5373
|
-
const ne =
|
|
5387
|
+
const ne = E.getPanel(pe), xe = Bt(Z.params, I);
|
|
5374
5388
|
if (ne) {
|
|
5375
|
-
ne.api.updateParameters(
|
|
5389
|
+
ne.api.updateParameters(xe), ne.api.setActive();
|
|
5376
5390
|
return;
|
|
5377
5391
|
}
|
|
5378
|
-
|
|
5392
|
+
E.addPanel({
|
|
5379
5393
|
id: pe,
|
|
5380
5394
|
component: Z.component,
|
|
5381
|
-
title: Z.title ??
|
|
5382
|
-
params:
|
|
5395
|
+
title: Z.title ?? I.split("/").pop() ?? I,
|
|
5396
|
+
params: xe
|
|
5383
5397
|
});
|
|
5384
5398
|
return;
|
|
5385
5399
|
}
|
|
5386
|
-
const fe = jn(
|
|
5400
|
+
const fe = jn(E, I);
|
|
5387
5401
|
if (fe) {
|
|
5388
5402
|
fe.api.setActive();
|
|
5389
5403
|
return;
|
|
5390
5404
|
}
|
|
5391
|
-
console.warn(`[SurfaceShell] openFile: no surface resolver matched "${
|
|
5392
|
-
}, []), me =
|
|
5405
|
+
console.warn(`[SurfaceShell] openFile: no surface resolver matched "${I}"`);
|
|
5406
|
+
}, []), me = P((b) => {
|
|
5393
5407
|
var pt;
|
|
5394
|
-
const
|
|
5395
|
-
if (!
|
|
5408
|
+
const E = x.current;
|
|
5409
|
+
if (!E) {
|
|
5396
5410
|
console.warn("[SurfaceShell] openSurface: surface not ready (dockview not initialized)");
|
|
5397
5411
|
return;
|
|
5398
5412
|
}
|
|
5399
|
-
const
|
|
5413
|
+
const I = _c(b), j = G.current.resolve(I);
|
|
5400
5414
|
if (!j) {
|
|
5401
|
-
console.warn(`[SurfaceShell] openSurface: no resolver matched kind="${
|
|
5415
|
+
console.warn(`[SurfaceShell] openSurface: no resolver matched kind="${I.kind}" target="${I.target}"`);
|
|
5402
5416
|
return;
|
|
5403
5417
|
}
|
|
5404
|
-
const Z = jt(
|
|
5405
|
-
|
|
5406
|
-
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;
|
|
5407
5421
|
if (fe) {
|
|
5408
|
-
|
|
5422
|
+
xe && fe.api.updateParameters(xe), fe.api.setActive();
|
|
5409
5423
|
return;
|
|
5410
5424
|
}
|
|
5411
5425
|
const ft = J.current;
|
|
@@ -5415,102 +5429,102 @@ function Oc({
|
|
|
5415
5429
|
`openSurface: unknown component "${j.component}". Registered panels: [${Lt}]. Register the component through a panel output before resolving to it.`
|
|
5416
5430
|
);
|
|
5417
5431
|
}
|
|
5418
|
-
|
|
5432
|
+
E.addPanel({
|
|
5419
5433
|
id: Z,
|
|
5420
5434
|
component: j.component,
|
|
5421
|
-
title: j.title ??
|
|
5422
|
-
params:
|
|
5435
|
+
title: j.title ?? I.target,
|
|
5436
|
+
params: xe
|
|
5423
5437
|
});
|
|
5424
|
-
}, []), he =
|
|
5425
|
-
const
|
|
5426
|
-
if (!
|
|
5427
|
-
const
|
|
5428
|
-
if (
|
|
5429
|
-
|
|
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();
|
|
5430
5444
|
return;
|
|
5431
5445
|
}
|
|
5432
5446
|
const j = J.current;
|
|
5433
|
-
if (!j.has(
|
|
5447
|
+
if (!j.has(b.component)) {
|
|
5434
5448
|
const Z = j.list().map((fe) => fe.id).join(", ");
|
|
5435
5449
|
throw new Error(
|
|
5436
|
-
`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.`
|
|
5437
5451
|
);
|
|
5438
5452
|
}
|
|
5439
|
-
|
|
5440
|
-
id:
|
|
5441
|
-
component:
|
|
5442
|
-
title:
|
|
5443
|
-
params:
|
|
5453
|
+
E.addPanel({
|
|
5454
|
+
id: b.id,
|
|
5455
|
+
component: b.component,
|
|
5456
|
+
title: b.title ?? b.id,
|
|
5457
|
+
params: b.params
|
|
5444
5458
|
});
|
|
5445
|
-
}, []), ke =
|
|
5446
|
-
var
|
|
5447
|
-
const
|
|
5448
|
-
return
|
|
5459
|
+
}, []), ke = P(() => {
|
|
5460
|
+
var I;
|
|
5461
|
+
const b = x.current;
|
|
5462
|
+
return b ? { openTabs: b.panels.map((j) => ({
|
|
5449
5463
|
id: j.id,
|
|
5450
5464
|
title: j.title ?? j.id,
|
|
5451
5465
|
params: j.params ?? void 0
|
|
5452
|
-
})), activeTab: ((
|
|
5453
|
-
}, []), Ue =
|
|
5454
|
-
const
|
|
5455
|
-
if (!
|
|
5456
|
-
for (const j of [...
|
|
5457
|
-
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);
|
|
5458
5472
|
return !0;
|
|
5459
|
-
}, []), qe =
|
|
5460
|
-
const
|
|
5461
|
-
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);
|
|
5462
5476
|
}, [Ue]), Qe = H(() => ({
|
|
5463
5477
|
openFile: Ie,
|
|
5464
5478
|
openSurface: me,
|
|
5465
5479
|
openPanel: he,
|
|
5466
|
-
closeWorkbenchLeftPane: () =>
|
|
5480
|
+
closeWorkbenchLeftPane: () => m(!0),
|
|
5467
5481
|
expandToFile: qe,
|
|
5468
5482
|
getSnapshot: ke
|
|
5469
|
-
}), [qe, ke, Ie, he, me]), X =
|
|
5483
|
+
}), [qe, ke, Ie, he, me]), X = P(() => {
|
|
5470
5484
|
var pe;
|
|
5471
|
-
const
|
|
5485
|
+
const b = x.current, E = b ? b.panels.map((ne) => ({
|
|
5472
5486
|
id: ne.id,
|
|
5473
5487
|
component: String(ne.component ?? ""),
|
|
5474
5488
|
params: ne.params ?? void 0
|
|
5475
|
-
})) : [],
|
|
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);
|
|
5476
5490
|
return {
|
|
5477
5491
|
hydrationComplete: !0,
|
|
5478
5492
|
layout: null,
|
|
5479
5493
|
sidebar: { collapsed: !1, width: t },
|
|
5480
5494
|
panelSizes: {},
|
|
5481
5495
|
preferences: { theme: "dark" },
|
|
5482
|
-
panels:
|
|
5483
|
-
activePanel:
|
|
5496
|
+
panels: E,
|
|
5497
|
+
activePanel: I,
|
|
5484
5498
|
activeFile: fe,
|
|
5485
|
-
visibleFiles:
|
|
5499
|
+
visibleFiles: E.map((ne) => Bn(ne, j)).filter((ne) => ne !== null),
|
|
5486
5500
|
dirtyFiles: {},
|
|
5487
5501
|
notifications: []
|
|
5488
5502
|
};
|
|
5489
|
-
}, [t]), ae =
|
|
5490
|
-
const
|
|
5491
|
-
for (const
|
|
5492
|
-
|
|
5493
|
-
}, [X]), we =
|
|
5494
|
-
var
|
|
5495
|
-
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) {
|
|
5496
5510
|
we.current = !0;
|
|
5497
5511
|
for (const j of s ?? [])
|
|
5498
|
-
|
|
5512
|
+
b.getPanel(j.id) || b.addPanel({ id: j.id, component: j.component, title: j.title, params: j.params });
|
|
5499
5513
|
}
|
|
5500
|
-
(
|
|
5501
|
-
const
|
|
5514
|
+
(I = w.current) == null || I.call(w, Qe);
|
|
5515
|
+
const E = () => {
|
|
5502
5516
|
var j;
|
|
5503
|
-
(j =
|
|
5517
|
+
(j = N.current) == null || j.call(N, ke()), ae();
|
|
5504
5518
|
};
|
|
5505
|
-
|
|
5506
|
-
}, [Qe, ke, ae]), be =
|
|
5507
|
-
async (
|
|
5519
|
+
b.onDidAddPanel(E), b.onDidRemovePanel(E), b.onDidActivePanelChange(E), E();
|
|
5520
|
+
}, [Qe, ke, ae]), be = P(
|
|
5521
|
+
async (b) => {
|
|
5508
5522
|
try {
|
|
5509
|
-
const
|
|
5510
|
-
if (!
|
|
5511
|
-
const
|
|
5523
|
+
const E = x.current;
|
|
5524
|
+
if (!E) return gt("not-ready", "surface not ready");
|
|
5525
|
+
const I = kt(b), j = {
|
|
5512
5526
|
kind: Be,
|
|
5513
|
-
target:
|
|
5527
|
+
target: I
|
|
5514
5528
|
}, Z = G.current.resolve(j);
|
|
5515
5529
|
if (Z) {
|
|
5516
5530
|
if (!J.current.has(Z.component))
|
|
@@ -5520,20 +5534,20 @@ function Oc({
|
|
|
5520
5534
|
);
|
|
5521
5535
|
const pe = jt(j, Z);
|
|
5522
5536
|
W.current.add(pe);
|
|
5523
|
-
const ne = Bt(Z.params,
|
|
5524
|
-
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({
|
|
5525
5539
|
id: pe,
|
|
5526
5540
|
component: Z.component,
|
|
5527
|
-
title: Z.title ??
|
|
5541
|
+
title: Z.title ?? I.split("/").pop() ?? I,
|
|
5528
5542
|
params: ne
|
|
5529
5543
|
}), Le());
|
|
5530
5544
|
}
|
|
5531
|
-
const fe = jn(
|
|
5532
|
-
return fe ? (fe.api.setActive(), Le()) : gt("NO_SURFACE_RESOLVER", `no registered surface resolver handles ${
|
|
5533
|
-
} 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) {
|
|
5534
5548
|
return gt(
|
|
5535
5549
|
"INVALID_SURFACE_PATH",
|
|
5536
|
-
|
|
5550
|
+
E instanceof Error ? E.message : "failed to open file"
|
|
5537
5551
|
);
|
|
5538
5552
|
}
|
|
5539
5553
|
},
|
|
@@ -5546,71 +5560,71 @@ function Oc({
|
|
|
5546
5560
|
openFile: be,
|
|
5547
5561
|
openPanel: async () => Le(),
|
|
5548
5562
|
closePanel: async () => Le(),
|
|
5549
|
-
closeWorkbenchLeftPane: async () => (
|
|
5563
|
+
closeWorkbenchLeftPane: async () => (m(!0), Le()),
|
|
5550
5564
|
showNotification: async () => Le(),
|
|
5551
5565
|
navigateToLine: async () => Le(),
|
|
5552
|
-
expandToFile: async (
|
|
5566
|
+
expandToFile: async (b) => (qe(b), Le()),
|
|
5553
5567
|
markDirty: () => {
|
|
5554
5568
|
},
|
|
5555
5569
|
markClean: () => {
|
|
5556
5570
|
},
|
|
5557
|
-
subscribe: (
|
|
5558
|
-
let
|
|
5559
|
-
return
|
|
5560
|
-
|
|
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);
|
|
5561
5575
|
};
|
|
5562
5576
|
},
|
|
5563
|
-
select: (
|
|
5564
|
-
const
|
|
5565
|
-
return
|
|
5566
|
-
|
|
5577
|
+
select: (b, E) => {
|
|
5578
|
+
const I = (j) => E(b(j));
|
|
5579
|
+
return _.current.add(I), I(X()), () => {
|
|
5580
|
+
_.current.delete(I);
|
|
5567
5581
|
};
|
|
5568
5582
|
}
|
|
5569
|
-
}), [qe, be, X]), Re =
|
|
5570
|
-
(
|
|
5583
|
+
}), [qe, be, X]), Re = P(
|
|
5584
|
+
(b) => {
|
|
5571
5585
|
if (p) return;
|
|
5572
|
-
|
|
5586
|
+
b.preventDefault(), b.currentTarget.setPointerCapture(b.pointerId), $.current = { startX: b.clientX, startWidth: g };
|
|
5573
5587
|
},
|
|
5574
5588
|
[p, g]
|
|
5575
|
-
), Ke =
|
|
5576
|
-
(
|
|
5577
|
-
const
|
|
5578
|
-
if (!
|
|
5579
|
-
const
|
|
5580
|
-
|
|
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);
|
|
5581
5595
|
},
|
|
5582
5596
|
[n, r]
|
|
5583
|
-
), De =
|
|
5584
|
-
|
|
5585
|
-
}, []), Ne =
|
|
5586
|
-
(
|
|
5597
|
+
), De = P((b) => {
|
|
5598
|
+
$.current && ($.current = null, b.currentTarget.releasePointerCapture(b.pointerId));
|
|
5599
|
+
}, []), Ne = P(
|
|
5600
|
+
(b) => {
|
|
5587
5601
|
if (p) return;
|
|
5588
|
-
const
|
|
5589
|
-
|
|
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));
|
|
5590
5604
|
},
|
|
5591
5605
|
[p, n, r]
|
|
5592
5606
|
);
|
|
5593
|
-
return
|
|
5607
|
+
return L(() => {
|
|
5594
5608
|
if (o)
|
|
5595
5609
|
try {
|
|
5596
5610
|
localStorage.setItem(`${o}:sidebarWidth`, String(g));
|
|
5597
5611
|
} catch {
|
|
5598
5612
|
}
|
|
5599
|
-
}, [o, g]),
|
|
5613
|
+
}, [o, g]), L(() => {
|
|
5600
5614
|
if (o)
|
|
5601
5615
|
try {
|
|
5602
5616
|
localStorage.setItem(`${o}:sidebarCollapsed`, p ? "1" : "0");
|
|
5603
5617
|
} catch {
|
|
5604
5618
|
}
|
|
5605
|
-
}, [o, p]), /* @__PURE__ */
|
|
5619
|
+
}, [o, p]), /* @__PURE__ */ C(
|
|
5606
5620
|
"div",
|
|
5607
5621
|
{
|
|
5608
|
-
ref:
|
|
5622
|
+
ref: k,
|
|
5609
5623
|
"data-boring-workspace-part": "surface",
|
|
5610
5624
|
className: oe("flex h-full min-h-0 w-full bg-background", d),
|
|
5611
5625
|
"data-testid": "surface-shell",
|
|
5612
5626
|
children: [
|
|
5613
|
-
p ? null : /* @__PURE__ */
|
|
5627
|
+
p ? null : /* @__PURE__ */ C(_e, { children: [
|
|
5614
5628
|
/* @__PURE__ */ u(
|
|
5615
5629
|
"aside",
|
|
5616
5630
|
{
|
|
@@ -5625,9 +5639,9 @@ function Oc({
|
|
|
5625
5639
|
rootDir: e,
|
|
5626
5640
|
bridge: Ve,
|
|
5627
5641
|
defaultTab: f,
|
|
5628
|
-
revealFileTreeRequest:
|
|
5642
|
+
revealFileTreeRequest: M,
|
|
5629
5643
|
onOpenPanel: he,
|
|
5630
|
-
onCollapse: () =>
|
|
5644
|
+
onCollapse: () => m(!0)
|
|
5631
5645
|
}
|
|
5632
5646
|
)
|
|
5633
5647
|
}
|
|
@@ -5652,7 +5666,7 @@ function Oc({
|
|
|
5652
5666
|
}
|
|
5653
5667
|
)
|
|
5654
5668
|
] }),
|
|
5655
|
-
/* @__PURE__ */
|
|
5669
|
+
/* @__PURE__ */ C("div", { className: "relative min-w-0 flex-1", children: [
|
|
5656
5670
|
/* @__PURE__ */ u(
|
|
5657
5671
|
"div",
|
|
5658
5672
|
{
|
|
@@ -5670,7 +5684,7 @@ function Oc({
|
|
|
5670
5684
|
)
|
|
5671
5685
|
}
|
|
5672
5686
|
),
|
|
5673
|
-
/* @__PURE__ */
|
|
5687
|
+
/* @__PURE__ */ C(
|
|
5674
5688
|
"div",
|
|
5675
5689
|
{
|
|
5676
5690
|
className: "pointer-events-none absolute inset-x-0 top-0 flex items-center justify-between",
|
|
@@ -5682,7 +5696,7 @@ function Oc({
|
|
|
5682
5696
|
type: "button",
|
|
5683
5697
|
variant: "ghost",
|
|
5684
5698
|
size: "icon-xs",
|
|
5685
|
-
onClick: () =>
|
|
5699
|
+
onClick: () => m(!1),
|
|
5686
5700
|
className: "pointer-events-auto ml-2",
|
|
5687
5701
|
"aria-label": "Show sources",
|
|
5688
5702
|
title: "Show sources",
|
|
@@ -5696,9 +5710,9 @@ function Oc({
|
|
|
5696
5710
|
/* @__PURE__ */ u(
|
|
5697
5711
|
Wc,
|
|
5698
5712
|
{
|
|
5699
|
-
api:
|
|
5713
|
+
api: D,
|
|
5700
5714
|
collapsed: p,
|
|
5701
|
-
onExpandFiles: () =>
|
|
5715
|
+
onExpandFiles: () => m(!1)
|
|
5702
5716
|
}
|
|
5703
5717
|
)
|
|
5704
5718
|
] })
|
|
@@ -5726,8 +5740,8 @@ function Wc({
|
|
|
5726
5740
|
collapsed: t,
|
|
5727
5741
|
onExpandFiles: n
|
|
5728
5742
|
}) {
|
|
5729
|
-
const [r, o] =
|
|
5730
|
-
return
|
|
5743
|
+
const [r, o] = O(!0);
|
|
5744
|
+
return L(() => {
|
|
5731
5745
|
if (!e) return;
|
|
5732
5746
|
const i = () => o(e.panels.length === 0);
|
|
5733
5747
|
i();
|
|
@@ -5735,8 +5749,8 @@ function Wc({
|
|
|
5735
5749
|
return () => {
|
|
5736
5750
|
a.dispose(), l.dispose();
|
|
5737
5751
|
};
|
|
5738
|
-
}, [e]), r ? /* @__PURE__ */
|
|
5739
|
-
/* @__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: [
|
|
5740
5754
|
t && /* @__PURE__ */ u(
|
|
5741
5755
|
ge,
|
|
5742
5756
|
{
|
|
@@ -5752,14 +5766,14 @@ function Wc({
|
|
|
5752
5766
|
),
|
|
5753
5767
|
/* @__PURE__ */ u("div", { className: "flex-1" })
|
|
5754
5768
|
] }),
|
|
5755
|
-
/* @__PURE__ */
|
|
5756
|
-
/* @__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: [
|
|
5757
5771
|
/* @__PURE__ */ u("span", { className: "inline-block h-px w-3 bg-[color:var(--accent)]", "aria-hidden": "true" }),
|
|
5758
5772
|
"Workbench"
|
|
5759
5773
|
] }),
|
|
5760
5774
|
/* @__PURE__ */ u("div", { className: "text-[15px] font-medium tracking-tight text-foreground", children: "Nothing open yet" }),
|
|
5761
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." }),
|
|
5762
|
-
t && /* @__PURE__ */
|
|
5776
|
+
t && /* @__PURE__ */ C(
|
|
5763
5777
|
$e,
|
|
5764
5778
|
{
|
|
5765
5779
|
type: "button",
|
|
@@ -5801,9 +5815,9 @@ function qc() {
|
|
|
5801
5815
|
return se(qr) ?? Uc;
|
|
5802
5816
|
}
|
|
5803
5817
|
function Vc({ children: e }) {
|
|
5804
|
-
const [t, n] =
|
|
5818
|
+
const [t, n] = O([]), r = P((a) => {
|
|
5805
5819
|
n((l) => [...l.filter((c) => c.id !== a.id), a]);
|
|
5806
|
-
}, []), o =
|
|
5820
|
+
}, []), o = P((a) => {
|
|
5807
5821
|
n((l) => l.filter((c) => c.id !== a));
|
|
5808
5822
|
}, []), i = H(
|
|
5809
5823
|
() => ({ blockers: t, addBlocker: r, removeBlocker: o }),
|
|
@@ -5990,15 +6004,15 @@ function al(e) {
|
|
|
5990
6004
|
return typeof t != "string" || !t.startsWith("boring.plugin.");
|
|
5991
6005
|
}
|
|
5992
6006
|
function cl(e) {
|
|
5993
|
-
const t = At(), n = Zt(), r = Ft(), o = nr(), i =
|
|
5994
|
-
|
|
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(() => {
|
|
5995
6009
|
if (e.enabled === !1 || typeof EventSource > "u") return;
|
|
5996
6010
|
const d = (p) => {
|
|
5997
|
-
const
|
|
5998
|
-
al(
|
|
6011
|
+
const m = p.detail;
|
|
6012
|
+
al(m) && (s.current = !0, f((g) => g + 1));
|
|
5999
6013
|
};
|
|
6000
6014
|
return window.addEventListener(Ee, d), () => window.removeEventListener(Ee, d);
|
|
6001
|
-
}, [e.enabled]),
|
|
6015
|
+
}, [e.enabled]), L(() => {
|
|
6002
6016
|
if (e.enabled === !1 || typeof EventSource > "u") return;
|
|
6003
6017
|
if (s.current && (s.current = !1, i.current.clear(), a.current.clear()), Qc(e.authHeaders)) {
|
|
6004
6018
|
console.warn(
|
|
@@ -6007,129 +6021,129 @@ function cl(e) {
|
|
|
6007
6021
|
return;
|
|
6008
6022
|
}
|
|
6009
6023
|
let d = !1;
|
|
6010
|
-
const p = Yc(t, n, r, o),
|
|
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) => {
|
|
6011
6025
|
(async () => {
|
|
6012
|
-
let
|
|
6026
|
+
let h, M = !1;
|
|
6013
6027
|
try {
|
|
6014
|
-
if (
|
|
6015
|
-
|
|
6016
|
-
const
|
|
6017
|
-
if (
|
|
6018
|
-
a.current.set(
|
|
6019
|
-
const
|
|
6020
|
-
|
|
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, {
|
|
6021
6035
|
detail: {
|
|
6022
6036
|
type: "boring.plugin.front-pending",
|
|
6023
|
-
id:
|
|
6024
|
-
revision:
|
|
6025
|
-
workspaceId:
|
|
6026
|
-
replay:
|
|
6037
|
+
id: h.id,
|
|
6038
|
+
revision: h.revision,
|
|
6039
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6040
|
+
replay: h.replay
|
|
6027
6041
|
}
|
|
6028
6042
|
})));
|
|
6029
|
-
let
|
|
6043
|
+
let T = null;
|
|
6030
6044
|
try {
|
|
6031
|
-
|
|
6032
|
-
} catch (
|
|
6045
|
+
T = N ? await tl(h.id, N, h.revision, e.importFront) : null;
|
|
6046
|
+
} catch (_) {
|
|
6033
6047
|
throw {
|
|
6034
6048
|
stage: "import",
|
|
6035
|
-
error:
|
|
6049
|
+
error: _
|
|
6036
6050
|
};
|
|
6037
6051
|
}
|
|
6038
|
-
if (d || a.current.get(
|
|
6039
|
-
if (!
|
|
6040
|
-
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 }));
|
|
6041
6055
|
return;
|
|
6042
6056
|
}
|
|
6043
6057
|
try {
|
|
6044
|
-
sl(
|
|
6045
|
-
} catch (
|
|
6058
|
+
sl(h.id, h.revision, T, p);
|
|
6059
|
+
} catch (_) {
|
|
6046
6060
|
throw {
|
|
6047
6061
|
stage: "register",
|
|
6048
|
-
error:
|
|
6062
|
+
error: _
|
|
6049
6063
|
};
|
|
6050
6064
|
}
|
|
6051
|
-
i.current.set(
|
|
6052
|
-
} catch (
|
|
6053
|
-
|
|
6054
|
-
const
|
|
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;
|
|
6055
6069
|
if (d) return;
|
|
6056
|
-
const
|
|
6057
|
-
console.error(`[boring-ui] failed to load plugin ${
|
|
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, {
|
|
6058
6072
|
detail: {
|
|
6059
6073
|
type: "boring.plugin.front-error",
|
|
6060
|
-
id:
|
|
6061
|
-
revision:
|
|
6062
|
-
workspaceId:
|
|
6063
|
-
message:
|
|
6074
|
+
id: h.id,
|
|
6075
|
+
revision: h.revision,
|
|
6076
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6077
|
+
message: _,
|
|
6064
6078
|
code: Kc,
|
|
6065
|
-
stage:
|
|
6066
|
-
replay:
|
|
6079
|
+
stage: w,
|
|
6080
|
+
replay: h.replay
|
|
6067
6081
|
}
|
|
6068
6082
|
}));
|
|
6069
6083
|
} finally {
|
|
6070
|
-
|
|
6084
|
+
M && h && window.dispatchEvent(new CustomEvent(Ee, {
|
|
6071
6085
|
detail: {
|
|
6072
6086
|
type: "boring.plugin.front-settled",
|
|
6073
|
-
id:
|
|
6074
|
-
revision:
|
|
6075
|
-
workspaceId:
|
|
6076
|
-
replay:
|
|
6087
|
+
id: h.id,
|
|
6088
|
+
revision: h.revision,
|
|
6089
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6090
|
+
replay: h.replay
|
|
6077
6091
|
}
|
|
6078
6092
|
}));
|
|
6079
6093
|
}
|
|
6080
6094
|
})();
|
|
6081
|
-
},
|
|
6095
|
+
}, x = (D) => {
|
|
6082
6096
|
if (!d)
|
|
6083
6097
|
try {
|
|
6084
|
-
const
|
|
6085
|
-
if (
|
|
6086
|
-
const
|
|
6087
|
-
if (
|
|
6088
|
-
a.current.set(
|
|
6089
|
-
} catch (
|
|
6090
|
-
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);
|
|
6091
6105
|
}
|
|
6092
|
-
},
|
|
6106
|
+
}, k = (D) => {
|
|
6093
6107
|
if (!d)
|
|
6094
6108
|
try {
|
|
6095
|
-
const
|
|
6096
|
-
if (
|
|
6097
|
-
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, {
|
|
6098
6112
|
detail: {
|
|
6099
6113
|
type: "boring.plugin.error",
|
|
6100
|
-
id:
|
|
6101
|
-
revision:
|
|
6102
|
-
workspaceId:
|
|
6103
|
-
message:
|
|
6114
|
+
id: h.id,
|
|
6115
|
+
revision: h.revision,
|
|
6116
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6117
|
+
message: h.message
|
|
6104
6118
|
}
|
|
6105
6119
|
}));
|
|
6106
|
-
} catch (
|
|
6107
|
-
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);
|
|
6108
6122
|
}
|
|
6109
|
-
},
|
|
6123
|
+
}, $ = (D) => {
|
|
6110
6124
|
if (!d)
|
|
6111
6125
|
try {
|
|
6112
|
-
const
|
|
6113
|
-
if (
|
|
6114
|
-
const
|
|
6115
|
-
for (const [
|
|
6116
|
-
|
|
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, {
|
|
6117
6131
|
detail: {
|
|
6118
6132
|
type: "boring.plugin.unload",
|
|
6119
|
-
id:
|
|
6120
|
-
revision:
|
|
6121
|
-
workspaceId:
|
|
6133
|
+
id: v,
|
|
6134
|
+
revision: w + 1,
|
|
6135
|
+
workspaceId: h.workspaceId ?? e.workspaceId,
|
|
6122
6136
|
replay: !0
|
|
6123
6137
|
}
|
|
6124
6138
|
})));
|
|
6125
|
-
|
|
6126
|
-
} catch (
|
|
6127
|
-
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);
|
|
6128
6142
|
}
|
|
6129
6143
|
};
|
|
6130
|
-
return g.addEventListener("boring.plugin.load",
|
|
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", $), () => {
|
|
6131
6145
|
d = !0;
|
|
6132
|
-
for (const
|
|
6146
|
+
for (const D of i.current.keys()) yt(D, p);
|
|
6133
6147
|
i.current.clear(), a.current.clear(), l.current.clear(), g.close();
|
|
6134
6148
|
};
|
|
6135
6149
|
}, [e.apiBaseUrl, e.workspaceId, e.enabled, e.authHeaders, e.importFront, t, n, r, o, c]);
|
|
@@ -6155,23 +6169,23 @@ function Xl() {
|
|
|
6155
6169
|
return { theme: sn(), setTheme: e.setTheme, toggleTheme: e.toggleTheme };
|
|
6156
6170
|
}
|
|
6157
6171
|
function Ql({ children: e, defaultTheme: t, onThemeChange: n }) {
|
|
6158
|
-
const r =
|
|
6172
|
+
const r = A(null);
|
|
6159
6173
|
if (!r.current) {
|
|
6160
6174
|
const f = Fr({ persistenceEnabled: !1 });
|
|
6161
6175
|
wr(f);
|
|
6162
6176
|
const s = t ?? Kr();
|
|
6163
6177
|
s !== "light" && f.getState().setTheme(s), r.current = f;
|
|
6164
6178
|
}
|
|
6165
|
-
const o = r.current, i =
|
|
6179
|
+
const o = r.current, i = P(
|
|
6166
6180
|
(f) => {
|
|
6167
6181
|
o.getState().setTheme(f), n == null || n(f);
|
|
6168
6182
|
},
|
|
6169
6183
|
[o, n]
|
|
6170
|
-
), a =
|
|
6184
|
+
), a = P(() => {
|
|
6171
6185
|
const f = o.getState().preferences.theme === "light" ? "dark" : "light";
|
|
6172
6186
|
i(f);
|
|
6173
6187
|
}, [o, i]), l = sn();
|
|
6174
|
-
|
|
6188
|
+
L(() => (document.documentElement.setAttribute("data-theme", l), () => {
|
|
6175
6189
|
document.documentElement.removeAttribute("data-theme");
|
|
6176
6190
|
}), [l]);
|
|
6177
6191
|
const c = H(() => ({ setTheme: i, toggleTheme: a }), [i, a]);
|
|
@@ -6234,7 +6248,7 @@ function hl({
|
|
|
6234
6248
|
}
|
|
6235
6249
|
function gl({ commands: e }) {
|
|
6236
6250
|
const t = Zt();
|
|
6237
|
-
return
|
|
6251
|
+
return L(() => {
|
|
6238
6252
|
if (!(e != null && e.length)) return;
|
|
6239
6253
|
const n = e.map((r) => r.id);
|
|
6240
6254
|
for (const r of n) t.unregisterCommand(r);
|
|
@@ -6249,7 +6263,7 @@ function vl({
|
|
|
6249
6263
|
catalogs: e
|
|
6250
6264
|
}) {
|
|
6251
6265
|
const t = Ft();
|
|
6252
|
-
return
|
|
6266
|
+
return L(() => {
|
|
6253
6267
|
if (e != null && e.length) {
|
|
6254
6268
|
for (const n of e)
|
|
6255
6269
|
t.register(n, Vn);
|
|
@@ -6293,7 +6307,7 @@ function wl({
|
|
|
6293
6307
|
}, i);
|
|
6294
6308
|
}
|
|
6295
6309
|
function bl({ onOpenFile: e }) {
|
|
6296
|
-
return
|
|
6310
|
+
return L(() => {
|
|
6297
6311
|
if (e)
|
|
6298
6312
|
return q.on(ve.uiCommand, ({ command: t }) => {
|
|
6299
6313
|
if (t.kind !== "openFile") return;
|
|
@@ -6302,7 +6316,7 @@ function bl({ onOpenFile: e }) {
|
|
|
6302
6316
|
});
|
|
6303
6317
|
}, [e]), null;
|
|
6304
6318
|
}
|
|
6305
|
-
function
|
|
6319
|
+
function xl(e, t) {
|
|
6306
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 };
|
|
6307
6321
|
}
|
|
6308
6322
|
function eu({
|
|
@@ -6319,56 +6333,56 @@ function eu({
|
|
|
6319
6333
|
apiTimeout: s,
|
|
6320
6334
|
defaultTheme: d,
|
|
6321
6335
|
onThemeChange: p,
|
|
6322
|
-
workspaceId:
|
|
6336
|
+
workspaceId: m,
|
|
6323
6337
|
storageKey: g,
|
|
6324
|
-
persistenceEnabled:
|
|
6325
|
-
bridgeEndpoint:
|
|
6326
|
-
onAuthError:
|
|
6327
|
-
onOpenFile:
|
|
6328
|
-
debug:
|
|
6329
|
-
frontPluginHotReload:
|
|
6330
|
-
fullPageBasePath:
|
|
6338
|
+
persistenceEnabled: y = !0,
|
|
6339
|
+
bridgeEndpoint: x,
|
|
6340
|
+
onAuthError: k,
|
|
6341
|
+
onOpenFile: $,
|
|
6342
|
+
debug: D = !1,
|
|
6343
|
+
frontPluginHotReload: h = !1,
|
|
6344
|
+
fullPageBasePath: M
|
|
6331
6345
|
}) {
|
|
6332
|
-
const
|
|
6333
|
-
if (!
|
|
6346
|
+
const v = A(null);
|
|
6347
|
+
if (!v.current) {
|
|
6334
6348
|
const X = Fr({
|
|
6335
|
-
workspaceId:
|
|
6349
|
+
workspaceId: m,
|
|
6336
6350
|
storageKey: g,
|
|
6337
|
-
persistenceEnabled:
|
|
6351
|
+
persistenceEnabled: y
|
|
6338
6352
|
});
|
|
6339
6353
|
wr(X);
|
|
6340
6354
|
const ae = d ?? Kr();
|
|
6341
|
-
ae !== "light" && !
|
|
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;
|
|
6342
6356
|
}
|
|
6343
|
-
const
|
|
6344
|
-
|
|
6345
|
-
const
|
|
6346
|
-
|
|
6357
|
+
const w = v.current, N = A(null), T = A(f);
|
|
6358
|
+
T.current = f;
|
|
6359
|
+
const _ = A(k);
|
|
6360
|
+
_.current = k, L(() => () => {
|
|
6347
6361
|
var X;
|
|
6348
|
-
(X =
|
|
6349
|
-
}, [
|
|
6362
|
+
(X = N.current) == null || X.disconnect(), N.current = null, w.cleanup();
|
|
6363
|
+
}, [w]), L(() => {
|
|
6350
6364
|
var ce, be;
|
|
6351
|
-
if (
|
|
6352
|
-
const X =
|
|
6353
|
-
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,
|
|
6354
6368
|
bridge: X,
|
|
6355
|
-
store:
|
|
6369
|
+
store: w,
|
|
6356
6370
|
authToken: ae,
|
|
6357
6371
|
onAuthError: (Ve) => {
|
|
6358
6372
|
var Re;
|
|
6359
|
-
return (Re =
|
|
6373
|
+
return (Re = _.current) == null ? void 0 : Re.call(_, Ve);
|
|
6360
6374
|
},
|
|
6361
6375
|
onConnectionChange: Ue
|
|
6362
6376
|
});
|
|
6363
|
-
return we.connect(),
|
|
6364
|
-
we.disconnect(),
|
|
6377
|
+
return we.connect(), N.current = we, () => {
|
|
6378
|
+
we.disconnect(), N.current = null;
|
|
6365
6379
|
};
|
|
6366
|
-
}, [
|
|
6380
|
+
}, [x, w]);
|
|
6367
6381
|
const { panelRegistry: W, commandRegistry: te, catalogRegistry: le, surfaceResolverRegistry: B, pluginMetas: ie, pluginsWithBindings: z } = H(() => {
|
|
6368
6382
|
const X = new Ps(l), ae = new ja(), we = new er(), ce = new tr();
|
|
6369
6383
|
for (const Ne of Bc) {
|
|
6370
|
-
const { id:
|
|
6371
|
-
X.register(
|
|
6384
|
+
const { id: b, ...E } = Ne;
|
|
6385
|
+
X.register(b, E);
|
|
6372
6386
|
}
|
|
6373
6387
|
const Ve = new Set(r ?? []).has(Nn.pluginId) ? [] : [Nn], Ke = ri({
|
|
6374
6388
|
chatPanel: t ?? ll,
|
|
@@ -6386,8 +6400,8 @@ function eu({
|
|
|
6386
6400
|
];
|
|
6387
6401
|
if (o)
|
|
6388
6402
|
for (const Ne of o) {
|
|
6389
|
-
const { id:
|
|
6390
|
-
X.register(
|
|
6403
|
+
const { id: b, ...E } = Ne;
|
|
6404
|
+
X.register(b, E);
|
|
6391
6405
|
}
|
|
6392
6406
|
return {
|
|
6393
6407
|
panelRegistry: X,
|
|
@@ -6397,53 +6411,53 @@ function eu({
|
|
|
6397
6411
|
pluginMetas: De,
|
|
6398
6412
|
pluginsWithBindings: Ke.plugins
|
|
6399
6413
|
};
|
|
6400
|
-
}, [l, t, n, r, o]), J =
|
|
6414
|
+
}, [l, t, n, r, o]), J = A(p);
|
|
6401
6415
|
J.current = p;
|
|
6402
|
-
const G =
|
|
6416
|
+
const G = P(
|
|
6403
6417
|
(X) => {
|
|
6404
6418
|
var ae;
|
|
6405
|
-
|
|
6419
|
+
w.getState().setTheme(X), (ae = J.current) == null || ae.call(J, X);
|
|
6406
6420
|
},
|
|
6407
|
-
[
|
|
6408
|
-
), ue =
|
|
6409
|
-
const X =
|
|
6421
|
+
[w]
|
|
6422
|
+
), ue = P(() => {
|
|
6423
|
+
const X = w.getState().preferences.theme === "light" ? "dark" : "light";
|
|
6410
6424
|
G(X);
|
|
6411
|
-
}, [
|
|
6412
|
-
|
|
6425
|
+
}, [w, G]), Ie = sn();
|
|
6426
|
+
L(() => (document.documentElement.setAttribute("data-theme", Ie), () => {
|
|
6413
6427
|
document.documentElement.removeAttribute("data-theme");
|
|
6414
6428
|
}), [Ie]);
|
|
6415
6429
|
const me = H(
|
|
6416
6430
|
() => ({ setTheme: G, toggleTheme: ue }),
|
|
6417
6431
|
[G, ue]
|
|
6418
6432
|
), he = H(
|
|
6419
|
-
() =>
|
|
6420
|
-
[f,
|
|
6421
|
-
), [ke, Ue] =
|
|
6433
|
+
() => xl(m, f),
|
|
6434
|
+
[f, m]
|
|
6435
|
+
), [ke, Ue] = O(!1), qe = H(
|
|
6422
6436
|
() => ({ connected: ke }),
|
|
6423
6437
|
[ke]
|
|
6424
6438
|
), Qe = H(
|
|
6425
|
-
() => ({ chatPanel: t ?? null, registeredPlugins: ie, debug:
|
|
6426
|
-
[t, ie,
|
|
6439
|
+
() => ({ chatPanel: t ?? null, registeredPlugins: ie, debug: D }),
|
|
6440
|
+
[t, ie, D]
|
|
6427
6441
|
);
|
|
6428
|
-
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(
|
|
6429
6443
|
ii,
|
|
6430
6444
|
{
|
|
6431
6445
|
panelRegistry: W,
|
|
6432
6446
|
commandRegistry: te,
|
|
6433
6447
|
catalogRegistry: le,
|
|
6434
6448
|
surfaceResolverRegistry: B,
|
|
6435
|
-
children: /* @__PURE__ */ u(bs, { apiBaseUrl: c, workspaceId:
|
|
6449
|
+
children: /* @__PURE__ */ u(bs, { apiBaseUrl: c, workspaceId: m, authHeaders: he, children: /* @__PURE__ */ C(
|
|
6436
6450
|
wl,
|
|
6437
6451
|
{
|
|
6438
6452
|
plugins: z,
|
|
6439
6453
|
apiBaseUrl: c,
|
|
6440
6454
|
authHeaders: he,
|
|
6441
|
-
onAuthError:
|
|
6455
|
+
onAuthError: k,
|
|
6442
6456
|
apiTimeout: s,
|
|
6443
6457
|
children: [
|
|
6444
6458
|
/* @__PURE__ */ u(yl, { plugins: z }),
|
|
6445
|
-
/* @__PURE__ */ u(ul, { apiBaseUrl: c, workspaceId:
|
|
6446
|
-
/* @__PURE__ */ u(bl, { onOpenFile:
|
|
6459
|
+
/* @__PURE__ */ u(ul, { apiBaseUrl: c, workspaceId: m, mode: h, authHeaders: he }),
|
|
6460
|
+
/* @__PURE__ */ u(bl, { onOpenFile: $ }),
|
|
6447
6461
|
/* @__PURE__ */ u(gl, { commands: i }),
|
|
6448
6462
|
/* @__PURE__ */ u(
|
|
6449
6463
|
vl,
|
|
@@ -6451,7 +6465,7 @@ function eu({
|
|
|
6451
6465
|
catalogs: a
|
|
6452
6466
|
}
|
|
6453
6467
|
),
|
|
6454
|
-
/* @__PURE__ */ u(hl, { store:
|
|
6468
|
+
/* @__PURE__ */ u(hl, { store: w }),
|
|
6455
6469
|
/* @__PURE__ */ u(lc, {}),
|
|
6456
6470
|
/* @__PURE__ */ u(Wo, {}),
|
|
6457
6471
|
e,
|
|
@@ -6519,7 +6533,7 @@ export {
|
|
|
6519
6533
|
fl as ao,
|
|
6520
6534
|
pl as ap,
|
|
6521
6535
|
Xe as aq,
|
|
6522
|
-
|
|
6536
|
+
ot as ar,
|
|
6523
6537
|
Ol as as,
|
|
6524
6538
|
Xo as at,
|
|
6525
6539
|
qt as au,
|
|
@@ -6547,7 +6561,7 @@ export {
|
|
|
6547
6561
|
At as u,
|
|
6548
6562
|
Ua as v,
|
|
6549
6563
|
vi as w,
|
|
6550
|
-
|
|
6564
|
+
xi as x,
|
|
6551
6565
|
Ci as y,
|
|
6552
6566
|
Fr as z
|
|
6553
6567
|
};
|