@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.
@@ -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 P, Fragment as _e } from "react/jsx-runtime";
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 T, useMemo as H, useContext as se, createContext as ye, useSyncExternalStore as nt, useState as M, useCallback as k, Component as to, useEffect as $, createElement as de, Suspense as Et, Fragment as Kn, lazy as ut } from "react";
8
- import { AlertTriangleIcon as no, ImageIcon as ze, FileTextIcon as xe, 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 tt, Skeleton as vo, Spinner as Rt, Button as $e, AlertDialog as yo, AlertDialogContent as wo, AlertDialogHeader as bo, AlertDialogTitle as So, AlertDialogDescription as xo, AlertDialogFooter as ko, AlertDialogCancel as Po, AlertDialogAction as Co, EmptyState as Xn, Kbd as et, 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";
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}`, h = c.get(p);
58
- if (h !== void 0) {
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 ${h}, then again). If you are composing kits, two of them are registering the same id — namespace one of them.`
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 = T(null), a = T(null);
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 nt(e.subscribe, e.getSnapshot);
401
+ return rt(e.subscribe, e.getSnapshot);
402
402
  }
403
403
  function ai() {
404
404
  const e = Ft();
405
- return nt(e.subscribe, e.getSnapshot);
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__ */ P("span", { className: "block min-w-0 truncate", children: [
415
- /* @__PURE__ */ P("span", { className: "font-medium", children: [
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] = M([]), r = k((i) => {
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 Si(e) {
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", h = `file:${c}`;
557
- if (d.panels.find((v) => v.id === h)) {
558
- const v = d.activePanel;
559
- return d.activatePanel(h), d.visibleFiles.includes(c) || d.openFile(c, h), a("panel:activated", { panelId: h, previousPanelId: v }), o();
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, h), d.openPanel({ id: h, component: "editor", params: { path: c, mode: p } }), a("file:opened", { path: c, mode: p }), a("panel:opened", { panelId: h, params: { path: c, mode: p } }), o());
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 xi = 100, ki = 3e3;
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, h = null, g = !1, v = !1, w = 0;
701
- function S(N) {
702
- v || g !== N && (g = N, f == null || f(N));
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 _(N) {
705
- if (v) return;
706
- const O = Pi(r, N);
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(O)
711
+ body: JSON.stringify(_)
712
712
  });
713
- if (v) return;
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 L(N) {
718
+ function D(T) {
719
719
  p !== null && clearTimeout(p), p = setTimeout(() => {
720
- p = null, _(N);
721
- }, xi);
720
+ p = null, $(T);
721
+ }, Si);
722
722
  }
723
- function m(N, O) {
724
- if (!v)
725
- switch (N) {
723
+ function h(T, _) {
724
+ if (!y)
725
+ switch (T) {
726
726
  case "init": {
727
- S(!0), _("restore");
727
+ k(!0), $("restore");
728
728
  break;
729
729
  }
730
730
  case "command": {
731
731
  let W;
732
732
  try {
733
- W = JSON.parse(O);
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
- w++, gn(n, W.kind, W.params).finally(() => {
742
- w--;
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(O);
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 F() {
763
- const N = `${t}/api/v1/ui/commands/next`, O = new EventSource(N, { withCredentials: !0 });
764
- O.addEventListener("init", (W) => {
765
- m("init", W.data);
766
- }), O.addEventListener("command", (W) => {
767
- m("command", W.data);
768
- }), O.addEventListener("error", (W) => {
769
- W.data ? m("error", W.data) : S(!1);
770
- }), O.addEventListener("heartbeat", (W) => {
771
- m("heartbeat", W.data);
772
- }), s = O;
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 I() {
775
- if (!v)
774
+ async function v() {
775
+ if (!y)
776
776
  try {
777
- const N = `${t}/api/v1/ui/commands/next?poll=true`, O = await fetch(N, { headers: hn(o) });
778
- if (v) return;
779
- if (O.status === 401 || O.status === 403) {
780
- l == null || l(O.status);
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 (!O.ok) return;
784
- const W = await O.json();
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 (v) return;
787
+ if (y) return;
788
788
  if (te.v !== 1) {
789
789
  c == null || c(te.v);
790
790
  continue;
791
791
  }
792
- w++;
792
+ x++;
793
793
  try {
794
794
  await gn(n, te.kind, te.params);
795
795
  } finally {
796
- w--;
796
+ x--;
797
797
  }
798
798
  }
799
- S(!0);
799
+ k(!0);
800
800
  } catch {
801
- S(!1);
801
+ k(!1);
802
802
  }
803
803
  }
804
- function x() {
805
- h = r.subscribe(() => {
806
- if (v) return;
807
- const N = w > 0 ? "agent" : "user";
808
- L(N);
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
- v = !1, !i && typeof EventSource < "u" ? F() : (I(), d = setInterval(I, a)), x();
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), h && (h(), h = null), S(!1), v = !0;
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(N) {
819
- _(N);
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 rt() {
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 ot(e) {
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 = T(t);
986
- n.current = t, $(() => q.on(e, (r) => n.current(r)), [e]);
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, { ...rt(), command: e }), typeof globalThis.dispatchEvent == "function" && typeof CustomEvent < "u" && globalThis.dispatchEvent(new CustomEvent(Mi, { detail: e }));
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, h = null, g = 0, v = !1;
1007
- function w(L) {
1008
- L && typeof L == "object" && typeof L.kind == "string" && qt(L, n);
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 S() {
1011
- if (f || v || !i) return;
1012
- v = !0;
1013
- const L = async () => {
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 m = await i(vn(`${t}/api/v1/ui/commands/next?poll=true`, r), {
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 (m.ok) {
1022
- const F = await m.json();
1023
- if (Array.isArray(F)) for (const I of F) w(I);
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(L, c));
1029
+ f || (d = setTimeout(D, c));
1030
1030
  }
1031
1031
  };
1032
- L();
1032
+ D();
1033
1033
  }
1034
- function _() {
1034
+ function $() {
1035
1035
  if (!f) {
1036
1036
  if (!o) {
1037
- S();
1037
+ k();
1038
1038
  return;
1039
1039
  }
1040
- s = new o(vn(`${t}/api/v1/ui/commands/next`, r)), s.addEventListener("command", (L) => {
1041
- const m = L.data;
1042
- if (!(typeof m != "string" || m.length === 0))
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
- w(JSON.parse(m));
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
- S();
1052
+ k();
1053
1053
  return;
1054
1054
  }
1055
- h = setTimeout(_, a * g);
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), h && (clearTimeout(h), h = 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 h = setTimeout(() => d.abort(), a);
1094
+ const m = setTimeout(() => d.abort(), a);
1095
1095
  try {
1096
- const g = r != null, v = await fetch(`${this.baseUrl}${n}`, {
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(h), i == null || i.removeEventListener("abort", p), v.status === 401 || v.status === 403)
1103
- throw (c = this.onAuthError) == null || c.call(this, v.status), new je(v.status, `Auth error: ${v.status}`);
1104
- if (yn(v.status)) {
1105
- l = new je(v.status, `HTTP ${v.status}: ${v.statusText}`);
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 (!v.ok) {
1109
- const w = await Gi(v);
1108
+ if (!y.ok) {
1109
+ const x = await Gi(y);
1110
1110
  throw new je(
1111
- v.status,
1112
- `HTTP ${v.status}: ${v.statusText}`,
1113
- w
1111
+ y.status,
1112
+ `HTTP ${y.status}: ${y.statusText}`,
1113
+ x
1114
1114
  );
1115
1115
  }
1116
- return await v.json();
1116
+ return await y.json();
1117
1117
  } catch (g) {
1118
- if (clearTimeout(h), i == null || i.removeEventListener("abort", p), g instanceof je && !yn(g.status))
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 = (h) => {
1274
- if (a.has(h)) return !1;
1275
- if (a.add(h), l.push(h), l.length > c) {
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 = (h) => {
1280
+ }, s = (m) => {
1281
1281
  let g;
1282
1282
  try {
1283
- g = JSON.parse(h.data);
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: (h) => os(h.queryKey) });
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, { ...ot(), path: e.path });
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, { ...ot(), path: e.path, kind: "dir" });
1304
+ q.emit(Q.created, { ...Ze(), path: e.path, kind: "dir" });
1305
1305
  return;
1306
1306
  case "unlink":
1307
- q.emit(Q.deleted, { ...ot(), path: e.path });
1307
+ q.emit(Q.deleted, { ...Ze(), path: e.path });
1308
1308
  return;
1309
1309
  case "rename":
1310
- e.oldPath ? q.emit(Q.moved, { ...ot(), from: e.oldPath, to: e.path }) : q.emit(Q.created, { ...ot(), path: e.path, kind: "file" });
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 = T(null);
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__ */ P(rn.Provider, { value: l, children: [
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] = M(e), l = T(void 0);
1417
- return $(() => (clearTimeout(l.current), l.current = setTimeout(() => a(e), 300), () => clearTimeout(l.current)), [e]), Qt({
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, { ...rt(), path: n });
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, { ...rt(), path: n, kind: "dir" });
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, { ...rt(), from: n, to: r });
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, { ...rt(), path: n });
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 = k((n) => {
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 Ss(e) {
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 xs(e) {
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 = k((i, a) => {
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
- $(() => () => r("missing"), [r]);
1510
- const o = k((i) => {
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(xs, { onLoading: () => r("loading") }),
1533
- children: de(Ss, { onReady: () => r("ready"), children: e.children })
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 h;
1637
- nt(r.subscribe, r.getSnapshot, r.getSnapshot);
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 ((h = a == null ? void 0 : a.api) == null ? void 0 : h.id) == "string" ? a.api.id : void 0;
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: xe,
1698
- mdx: xe,
1699
- txt: xe,
1700
- csv: xe,
1701
- tsv: xe,
1702
- yaml: xe,
1703
- yml: xe,
1704
- toml: xe,
1705
- ini: xe,
1706
- cfg: xe,
1707
- conf: xe,
1708
- env: xe,
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] = M(t.title ?? t.id), [i, a] = M(null), l = T(null);
1869
- $(() => {
1870
- var I;
1871
- const m = () => o(t.title ?? t.id);
1872
- m();
1873
- const F = (I = t.onDidTitleChange) == null ? void 0 : I.call(t, m);
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 x;
1876
- return (x = F == null ? void 0 : F.dispose) == null ? void 0 : x.call(F);
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 m(F) {
1881
- l.current && !l.current.contains(F.target) && a(null);
1880
+ function v(w) {
1881
+ l.current && !l.current.contains(w.target) && a(null);
1882
1882
  }
1883
- return document.addEventListener("pointerdown", m), () => document.removeEventListener("pointerdown", m);
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((m) => m.id !== t.id && m.close), [h, g] = M(!1);
1886
- Vt(ve.editorSaveStart, (m) => {
1887
- m.panelId === t.id && g(!0);
1888
- }), Vt(ve.editorSaveEnd, (m) => {
1889
- m.panelId === t.id && g(!1);
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 v = (m) => {
1892
- m.preventDefault(), m.stopPropagation(), n && m.nativeEvent.stopImmediatePropagation(), t.close(), n && Ds();
1893
- }, w = (m) => {
1894
- !d && p.length === 0 || (m.preventDefault(), m.stopPropagation(), a({ x: m.clientX, y: m.clientY }));
1895
- }, S = (m) => {
1896
- a(null), Fs(m);
1897
- }, _ = () => {
1898
- var m, F;
1899
- a(null), (m = t.setActive) == null || m.call(t);
1900
- for (const I of p) (F = I.close) == null || F.call(I);
1901
- }, L = i && typeof document < "u" ? Ko(
1902
- /* @__PURE__ */ P(
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: (m) => m.stopPropagation(),
1910
- onContextMenu: (m) => {
1911
- m.preventDefault(), m.stopPropagation();
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: () => S(d),
1924
+ onClick: () => $(d),
1921
1925
  children: "Copy path"
1922
1926
  }
1923
1927
  ) : null,
1924
- p.length > 0 ? /* @__PURE__ */ u(
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__ */ P(Kn, { children: [
1940
- /* @__PURE__ */ P(
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: (m) => {
1950
- m.button === 2 && w(m);
1963
+ onPointerDown: (v) => {
1964
+ v.button === 2 && k(v);
1951
1965
  },
1952
- onContextMenu: w,
1966
+ onContextMenu: k,
1953
1967
  children: [
1954
- h ? /* @__PURE__ */ u(
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__ */ P("div", { className: "flex shrink-0 items-center gap-1", children: [
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: v }
2000
- ) : { onClick: v },
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
- L
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 Sn(e, t) {
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 xn(e, t) {
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), xn(a, s));
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
- xn(a, d);
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), h = () => {
2202
+ }, p = a.onDidLayoutChange(d), m = () => {
2189
2203
  s && (clearTimeout(s), o(a.toJSON()));
2190
2204
  };
2191
- window.addEventListener("beforeunload", h), f = () => {
2192
- h(), p.dispose(), window.removeEventListener("beforeunload", h), c == null || c();
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 = nt(f.subscribe, f.getSnapshot, f.getSnapshot), d = Es(), p = T(null), h = T(null), g = T(void 0), v = T(null), w = H(() => {
2212
- const m = f.getComponents(), F = o ? Object.fromEntries(Object.entries(m).filter(([x]) => o.includes(x))) : m, I = v.current;
2213
- if (I) {
2214
- const x = Object.keys(I), D = Object.keys(F);
2215
- if (x.length === D.length && D.every((N) => I[N] === F[N]))
2216
- return I;
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 v.current = F, F;
2219
- }, [f, s, o]), S = H(() => Ms(p), []), _ = k(
2220
- (m) => {
2221
- var F;
2222
- (F = g.current) == null || F.call(g), g.current = zs(
2223
- m,
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(m.api);
2243
+ ), n == null || n(h.api);
2230
2244
  },
2231
2245
  [e, t, f, r, n]
2232
2246
  );
2233
- $(() => () => {
2234
- var m;
2235
- return (m = g.current) == null ? void 0 : m.call(g);
2236
- }, []), $(() => {
2237
- const m = q.on(ve.panelUpdate, ({ match: I, params: x, title: D }) => {
2238
- const N = p.current;
2239
- if (N)
2240
- for (const O of Sn(N, I))
2241
- x && O.api.updateParameters({
2242
- ...O.params ?? {},
2243
- ...x
2244
- }), D && O.api.setTitle(D);
2245
- }), F = q.on(ve.panelClose, ({ match: I }) => {
2246
- const x = p.current;
2247
- if (x)
2248
- for (const D of Sn(x, I))
2249
- x.removePanel(D);
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
- m(), F();
2266
+ h(), M();
2253
2267
  };
2254
2268
  }, []);
2255
- const L = k(
2256
- (m) => {
2269
+ const D = P(
2270
+ (h) => {
2257
2271
  if (!d) {
2258
- h.current = m;
2272
+ m.current = h;
2259
2273
  return;
2260
2274
  }
2261
- _(m);
2275
+ $(h);
2262
2276
  },
2263
- [d, _]
2277
+ [d, $]
2264
2278
  );
2265
- return $(() => {
2266
- d && h.current && (_(h.current), h.current = null);
2267
- }, [d, _]), d ? /* @__PURE__ */ u(br.Provider, { value: S, children: /* @__PURE__ */ u(
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: w,
2285
+ components: x,
2272
2286
  defaultTabComponent: Ls,
2273
2287
  prefixHeaderActionsComponent: a,
2274
2288
  rightHeaderActionsComponent: l,
2275
2289
  watermarkComponent: c,
2276
- onReady: L
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__ */ P("div", { className: oe("flex h-full flex-col overflow-hidden", o), children: [
2317
- /* @__PURE__ */ P("div", { className: "flex h-9 shrink-0 items-center gap-2 border-b border-border bg-muted/50 px-3", children: [
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 Sr(e) {
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 xr = () => import("./FileTree-SmsE0Raq.js").then((e) => ({ default: e.FileTree }));
2435
+ const Sr = () => import("./FileTree-DWbh0xNI.js").then((e) => ({ default: e.FileTree }));
2422
2436
  function Js() {
2423
- xr();
2437
+ Sr();
2424
2438
  }
2425
- const Ys = ut(xr);
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] = M(/* @__PURE__ */ new Map()), p = Ot(e), h = H(
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(h, o),
2449
- [h, o]
2450
- ), { mutateAsync: v } = hr(), { mutateAsync: w } = ms(), { mutateAsync: S } = hs(), { mutateAsync: _ } = gs(), [L, m] = M(/* @__PURE__ */ new Map()), F = H(() => {
2451
- if (s.size === 0) return L;
2452
- const b = new Map(L);
2453
- for (const [R, A] of s) {
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(b.get(R), A);
2456
- U && b.set(R, U);
2469
+ const U = Mt(S.get(R), F);
2470
+ U && S.set(R, U);
2457
2471
  }
2458
- return b;
2459
- }, [L, s, p]), I = T(null), [x, D] = M(400), [N, O] = M(null), [W, te] = M(null), le = T(null), [B, ie] = M(
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] = M(null), [G, ue] = M(null), Ie = T(0), me = T(0), he = T(0), ke = ((t == null ? void 0 : t.trim().length) ?? 0) > 0, { data: Ue } = ps(
2462
- ke ? Sr(t ?? "") : "",
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 (!N) return;
2467
- function b(R) {
2468
- le.current && !le.current.contains(R.target) && O(null);
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", b), () => document.removeEventListener("pointerdown", b);
2471
- }, [N]), $(() => {
2472
- const b = I.current;
2473
- if (!b) return;
2474
- const R = new ResizeObserver(([A]) => {
2475
- A && D(Math.floor(A.contentRect.height));
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(b), () => R.disconnect();
2491
+ return R.observe(S), () => R.disconnect();
2478
2492
  }, []);
2479
- const Qe = (ke && Ue ? Ue.map((b) => ({
2480
- name: b.split("/").pop() ?? b,
2493
+ const Qe = (ke && Ue ? Ue.map((S) => ({
2494
+ name: S.split("/").pop() ?? S,
2481
2495
  kind: "file",
2482
- path: b
2483
- })) : void 0) ?? vr(g ?? [], F), X = yr(Qe, z, e), ae = k(
2484
- (b) => {
2485
- ie(b), n == null || n.openFile(b, { mode: "edit" });
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 = k(
2489
- async (b) => {
2502
+ ), we = P(
2503
+ async (S) => {
2490
2504
  try {
2491
- const R = await a.getTree(b), A = o.length === 0 ? R : R.filter((U) => !Jt(U.name, o));
2492
- m((U) => new Map(U).set(b, A));
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 = k(
2498
- async (b, R) => {
2499
- const A = Array.from(new Set(b)).filter(
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 (A.length === 0) return;
2516
+ if (F.length === 0) return;
2503
2517
  const U = await Promise.all(
2504
- A.map(async (Y) => {
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
- m((Y) => {
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 = k(
2525
- async (b, R) => {
2526
- if (!b) return;
2527
- const A = kr(b), U = ++Ie.current;
2528
- ie(A);
2529
- const Y = R != null && R.refreshTargetDir ? [...kn(A), A] : kn(A);
2530
- await ce([...new Set(Y)], { force: !0 }), Ie.current === U && ue(A);
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 = k((b) => {
2534
- ue((R) => R === b ? null : R);
2535
- }, []), Re = k(
2536
- async (b) => {
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(b, { refreshTargetDir: !0 });
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 A;
2550
- const b = ((A = n == null ? void 0 : n.getActiveFile) == null ? void 0 : A.call(n)) ?? null;
2551
- b && me.current === 0 && be(b);
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 = k((b, R) => {
2566
- d((A) => {
2567
- const U = Ot(b), Y = new Map(A), ee = Mt(Y.get(U), [R]) ?? [R];
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 = k((b, R) => {
2571
- d((A) => {
2572
- const U = Ot(b), Y = A.get(U);
2573
- if (!(Y != null && Y.length)) return A;
2574
- const ee = Y.filter((Te) => Te.path !== R), Pe = new Map(A);
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, y] = M(/* @__PURE__ */ new Set()), C = k((b) => {
2578
- y((R) => {
2579
- const A = new Set(R);
2580
- return A.add(b), A;
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
- }, []), E = k((b) => {
2583
- y((R) => {
2584
- if (!R.has(b)) return R;
2585
- const A = new Set(R);
2586
- return A.delete(b), A;
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 = k(
2589
- (b, R) => {
2590
- O({ node: R, x: b.clientX, y: b.clientY });
2602
+ }, []), j = P(
2603
+ (S, R) => {
2604
+ _({ node: R, x: S.clientX, y: S.clientY });
2591
2605
  },
2592
2606
  []
2593
- ), Z = k(
2594
- (b) => {
2595
- const R = b.target;
2596
- R.closest("[role=treeitem]") || R.closest("[data-path]") || (b.preventDefault(), O({
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: b.clientX,
2599
- y: b.clientY,
2612
+ x: S.clientX,
2613
+ y: S.clientY,
2600
2614
  isBackground: !0
2601
2615
  }));
2602
2616
  },
2603
2617
  [e]
2604
- ), fe = k(
2605
- async (b, R) => {
2606
- const A = b.split("/").pop() ?? b, U = R === "." ? e : R, Y = U === "." ? A : `${U}/${A}`;
2607
- if (Y !== b) {
2608
- C(b);
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 S({ from: b, to: Y }), await ce([Ge(b), Ge(Y)]), Ae.success({ title: "Moved", description: `${b} → ${Y}` });
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
- E(b);
2631
+ I(S);
2618
2632
  }
2619
2633
  }
2620
2634
  },
2621
- [S, ce, e, C, E]
2635
+ [k, ce, e, E, I]
2622
2636
  );
2623
- function pe(b) {
2637
+ function pe(S) {
2624
2638
  return () => {
2625
- O(null), (async () => {
2639
+ _(null), (async () => {
2626
2640
  try {
2627
- await b();
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 = (b) => {
2638
- const R = N == null ? void 0 : N.node;
2639
- O(null);
2640
- const A = (R == null ? void 0 : R.kind) === "dir" ? R.path : R ? Ge(R.path) : e, U = `__draft__:${++he.current}`;
2641
- J({ kind: b, parentDir: A, path: U });
2642
- }, Se = () => ne("create-file"), ft = () => ne("create-folder"), pt = () => {
2643
- const b = N == null ? void 0 : N.node;
2644
- O(null), b && J({ kind: "rename", path: b.path, initialValue: b.name });
2645
- }, Lt = k(
2646
- async (b, R) => {
2647
- const A = z;
2648
- if (J(null), !A) return;
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 = A.kind === "rename" ? Ge(A.path) : A.parentDir, ee = A.kind === "rename" ? A.path : Y === "." || Y === "" ? U : `${Y}/${U}`, Pe = A.kind === "rename" ? A.path : ee;
2652
- C(Pe);
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 (A.kind === "rename") {
2656
- if (U === A.initialValue) return;
2657
- const Ce = A.path.split("/");
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 S({ from: A.path, to: mt }), await ce([Ge(A.path)]), Ae.success({ title: "Renamed", description: `${A.path} → ${mt}` });
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: A.kind === "create-file" ? "file" : "dir",
2678
+ kind: F.kind === "create-file" ? "file" : "dir",
2665
2679
  path: ee
2666
2680
  };
2667
- Ke(Y, Ce), Te = ee, A.kind === "create-file" ? (await v({ path: ee, content: "" }), q.emit(Q.created, {
2668
- ...rt(),
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 w({ path: ee }), Ae.success({ title: "Folder created", description: ee })), await ce([Y], { force: !0 }), ue(ee);
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: A.kind === "rename" ? "Rename failed" : A.kind === "create-file" ? "Create file failed" : "Create folder failed",
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
- E(Pe);
2695
+ I(Pe);
2682
2696
  }
2683
2697
  },
2684
2698
  [
2685
2699
  z,
2686
- S,
2687
- v,
2688
- w,
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 = k(() => {
2709
+ ), $t = P(() => {
2696
2710
  J(null);
2697
2711
  }, []), Gr = pe(async () => {
2698
- N != null && N.node && (await Gs(N.node.path), Ae.success({ title: "Path copied", description: N.node.path }));
2699
- }), Jr = k(async () => {
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 b = W;
2702
- te(null), C(b.path);
2715
+ const S = W;
2716
+ te(null), E(S.path);
2703
2717
  try {
2704
- await _({ path: b.path }), De(Ge(b.path), b.path), b.kind === "dir" && m((R) => {
2705
- const A = new Map(R);
2706
- for (const U of A.keys())
2707
- (U === b.path || U.startsWith(`${b.path}/`)) && A.delete(U);
2708
- return A;
2709
- }), await ce([Ge(b.path)]), Ae.success({ title: "Deleted", description: b.path });
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
- E(b.path);
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__ */ P("div", { className: "flex h-full min-h-0 flex-col", children: [
2740
+ return /* @__PURE__ */ C("div", { className: "flex h-full min-h-0 flex-col", children: [
2727
2741
  c && /* @__PURE__ */ u(
2728
- tt,
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: I,
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((b, R) => /* @__PURE__ */ u(
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__ */ P("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
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: x,
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
- N && /* @__PURE__ */ P(
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: N.x, top: N.y },
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: Se, children: "New file" }),
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
- !N.isBackground && /* @__PURE__ */ P(_e, { children: [
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(N.node), O(null);
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: (b) => {
2819
- b || te(null);
2832
+ onOpenChange: (S) => {
2833
+ S || te(null);
2820
2834
  },
2821
- children: /* @__PURE__ */ P(wo, { children: [
2822
- /* @__PURE__ */ P(bo, { children: [
2823
- /* @__PURE__ */ P(So, { children: [
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(xo, { children: "This action cannot be undone." })
2842
+ /* @__PURE__ */ u(So, { children: "This action cannot be undone." })
2829
2843
  ] }),
2830
- /* @__PURE__ */ P(ko, { children: [
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, h = r ?? i, [g, v] = M(""), [w, S] = M(""), _ = T(void 0);
2850
- $(() => (clearTimeout(_.current), _.current = setTimeout(() => S(g), 200), () => clearTimeout(_.current)), [g]);
2851
- const L = p !== void 0 ? p || void 0 : w || void 0;
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: L,
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: h, children: /* @__PURE__ */ P("div", { className: "flex h-full flex-col", children: [
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: (m) => v(m.target.value),
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: L,
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 $(() => q.on(ve.agentData, ({ part: e }) => {
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] = M(!1), [c, f] = M(!1), [s, d] = M(null), [p, h] = M(!1), [g, v] = M(!1), w = T(void 0), S = T(null), _ = T(0), L = T(null), m = T(0), F = T(void 0), I = T(o);
2976
- I.current = o;
2977
- const x = T(n);
2978
- x.current = n;
2979
- const D = k(async () => {
2980
- const z = x.current;
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 (S.current) return S.current;
2983
- const J = m.current;
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 (m.current !== J) return;
2998
- he === "saved" && (_.current = Date.now(), d(Date.now()), l(!1), (me = I.current) == null || me.call(I, e, !1));
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 (m.current !== J) return;
3014
+ if (h.current !== J) return;
3001
3015
  } finally {
3002
- if (ue && clearTimeout(ue), S.current === G && (S.current = null), m.current !== J) return;
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
- })(), S.current = G, G;
3006
- }, [e, r]), N = k(() => {
3007
- clearTimeout(w.current), w.current = setTimeout(D, ia);
3008
- }, [D]), O = k(() => {
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 = I.current) == null || z.call(I, e, !0), N());
3011
- }, [e, N]), W = k(() => {
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(w.current), l(!1), v(!1), e && ((z = I.current) == null || z.call(I, e, !1));
3014
- }, [e]), te = k(async () => {
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(w.current), S.current) return S.current;
3017
- if ((z = x.current) != null && z.isDirty())
3018
- return D();
3019
- }, [D]), le = k(() => h(!1), []), B = k(() => v(!1), []), ie = k((z) => {
3020
- L.current = z, v(!1);
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 (L.current === null) {
3025
- L.current = i;
3038
+ if (D.current === null) {
3039
+ D.current = i;
3026
3040
  return;
3027
3041
  }
3028
- if (i !== L.current) {
3029
- if (Date.now() - _.current < sa) {
3030
- L.current = i;
3042
+ if (i !== D.current) {
3043
+ if (Date.now() - $.current < sa) {
3044
+ D.current = i;
3031
3045
  return;
3032
3046
  }
3033
- L.current = i, a ? v(!0) : h(!0);
3047
+ D.current = i, a ? y(!0) : m(!0);
3034
3048
  }
3035
3049
  }
3036
- }, [i, e, a]), $(() => {
3037
- if (F.current === void 0) {
3038
- F.current = e;
3050
+ }, [i, e, a]), L(() => {
3051
+ if (M.current === void 0) {
3052
+ M.current = e;
3039
3053
  return;
3040
3054
  }
3041
- F.current !== e && (F.current = e, m.current += 1, clearTimeout(w.current), S.current && q.emit(ve.editorSaveEnd, { panelId: r }), S.current = null, L.current = null, _.current = 0, l(!1), f(!1), h(!1), v(!1));
3042
- }, [e]), $(() => () => clearTimeout(w.current), []), {
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: O,
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 = T(e);
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 = T(n ?? `file-pane:${da++}`), a = n ?? i.current, { data: l, isLoading: c, error: f, refetch: s } = fs(o), { mutateAsync: d } = hr(), [p, h] = M(r), g = T(""), v = T(!1), w = T(null), S = T(null), _ = T(null), L = T(0), [m, F] = M(null);
3089
- $(() => {
3090
- w.current !== t && (h(r), g.current = r ?? "", v.current = !1, S.current = null, L.current += 1, F(null), w.current = t);
3091
- }, [t, r]), $(() => {
3092
- (l == null ? void 0 : l.content) != null && p === null && (h(l.content), g.current = l.content, S.current = l.mtimeMs ?? 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 I = o && p != null ? {
3095
- isDirty: () => v.current,
3108
+ const v = o && p != null ? {
3109
+ isDirty: () => y.current,
3096
3110
  save: async () => {
3097
3111
  var J;
3098
- const z = ++L.current;
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: S.current ?? void 0
3117
+ expectedMtimeMs: k.current ?? void 0
3104
3118
  });
3105
- if (L.current !== z) return;
3106
- typeof G.mtimeMs == "number" && (S.current = G.mtimeMs, (J = _.current) == null || J.call(_, G.mtimeMs)), v.current = !1, F(null);
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 L.current !== z || G instanceof ct && (typeof G.currentMtimeMs == "number" && (S.current = G.currentMtimeMs), F(G)), G;
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, x = ca(o, {
3113
- adapter: I,
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
- _.current = x.notifySaved, $(() => {
3118
- if (!(!x.shouldSync || (l == null ? void 0 : l.content) == null)) {
3119
- if (v.current) {
3120
- x.ackSync();
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
- h(l.content), g.current = l.content, S.current = l.mtimeMs ?? null, v.current = !1, x.ackSync();
3137
+ m(l.content), g.current = l.content, k.current = l.mtimeMs ?? null, y.current = !1, w.ackSync();
3124
3138
  }
3125
- }, [x.shouldSync, x, l, h]), $(() => {
3126
- !x.externalChangeWhileDirty || (l == null ? void 0 : l.mtimeMs) == null || (F(new ct(o ?? t, l.mtimeMs, S.current)), S.current = l.mtimeMs, x.ackExternalChange());
3127
- }, [o, x.externalChangeWhileDirty, x, l, t]);
3128
- const D = o ? o.split("/").pop() ?? o : "", [N, O] = M("");
3129
- $(() => {
3130
- const z = D ? x.isDirty ? `${D} ●` : D : "";
3131
- O(z);
3132
- }, [D, x.isDirty]);
3133
- const W = k((z) => {
3134
- h(z), g.current = z, v.current = !0, x.markDirty();
3135
- }, [h, x]), te = k(async () => {
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
- h(J.content), g.current = J.content, S.current = J.mtimeMs ?? null, v.current = !1, x.markClean(), typeof J.mtimeMs == "number" && ((G = _.current) == null || G.call(_, J.mtimeMs)), F(null);
3142
- }, [o, x, s, h]), le = k(async () => {
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 = ++L.current;
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 (L.current !== z) return;
3149
- typeof ue.mtimeMs == "number" && (S.current = ue.mtimeMs, (J = _.current) == null || J.call(_, ue.mtimeMs)), v.current = !1, F(null);
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 = k(async () => {
3153
- !I || !v.current || await I.save();
3154
- }, [I]), ie = k(async () => {
3155
- await x.flushSave();
3156
- }, [x]);
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: x.isDirty,
3162
- conflict: m,
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: D,
3169
- tabTitle: N
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__ */ P(_e, { children: [
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(tt, { title: "Failed to load file", description: d ?? r.message }) });
3216
- const h = s ?? /* @__PURE__ */ P("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
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__ */ P("div", { className: `flex h-full min-h-0 flex-col ${p ?? ""}`, children: [
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: h, children: n || t === null ? h : /* @__PURE__ */ u(
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-zbp8ezds.js").then((e) => ({ default: e.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 Ze(e) {
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] = M(null), [f, s] = M(null), [d, p] = M(!0), h = H(() => {
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 v = null;
3354
+ let y = null;
3341
3355
  p(!0), s(null), c(null);
3342
- const w = {};
3343
- return a && (w["x-boring-workspace-id"] = a), fetch(h, {
3356
+ const x = {};
3357
+ return a && (x["x-boring-workspace-id"] = a), fetch(m, {
3344
3358
  credentials: "include",
3345
- headers: w,
3359
+ headers: x,
3346
3360
  signal: g.signal
3347
- }).then(async (S) => {
3348
- if (!S.ok) throw new Error(`HTTP ${S.status}`);
3349
- const _ = await S.blob();
3350
- v = URL.createObjectURL(_), c(v);
3351
- }).catch((S) => {
3352
- g.signal.aborted || s(S instanceof Error ? S.message : "Failed to load preview");
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(), v && URL.revokeObjectURL(v);
3370
+ g.abort(), y && URL.revokeObjectURL(y);
3357
3371
  };
3358
- }, [h, a]), e ? /* @__PURE__ */ P("div", { className: oe("flex h-full min-h-0 flex-col bg-background", o), children: [
3359
- /* @__PURE__ */ P("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border/60 px-3 py-2", children: [
3360
- /* @__PURE__ */ u("div", { className: "min-w-0 truncate text-xs font-medium text-muted-foreground", title: e, children: Ze(e) }),
3361
- /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
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 ${Ze(e)}`,
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: Ze(e),
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 ${Ze(e)}`,
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__ */ P("div", { className: "flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [
3401
+ /* @__PURE__ */ u("div", { className: "flex min-h-0 flex-1 items-center justify-center overflow-auto p-4", children: d ? /* @__PURE__ */ C("div", { className: "flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [
3388
3402
  /* @__PURE__ */ u(Rt, { className: "size-3.5" }),
3389
3403
  /* @__PURE__ */ u("span", { children: "Loading preview..." })
3390
- ] }) : f || !l ? /* @__PURE__ */ u(tt, { title: "Failed to load preview", description: f ?? "Preview unavailable." }) : t === "image" ? /* @__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: Ze(e),
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: Ze(e),
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(tt, { title: "No file selected", description: "Choose an image or PDF from the file tree." }) });
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] = M(0), r = k(() => {
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 Sa(e, t) {
3455
+ function xa(e, t) {
3442
3456
  return `${e.replace(/\/$/, "")}${t}`;
3443
3457
  }
3444
- function xa(e) {
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), Sa(e, `/api/v1/files/raw?${r.toString()}`);
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), h = l.createElement("style");
3516
- h.setAttribute("data-boring-html-viewer-href", s), h.textContent = Wt(p, d, r, i), f.replaceWith(h);
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] = M(null), [a, l] = M(null), [c, f] = M(!0), s = H(
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] = M(0), h = k(() => {
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 v = {};
3563
- return r && (v["x-boring-workspace-id"] = r), Nr(s, v, g.signal).then(async (w) => {
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: w,
3579
+ html: x,
3566
3580
  path: e,
3567
3581
  apiBaseUrl: n,
3568
- headers: v,
3582
+ headers: y,
3569
3583
  workspaceRequestId: r,
3570
3584
  signal: g.signal
3571
3585
  }));
3572
- }).catch((w) => {
3573
- g.signal.aborted || l(w instanceof Error ? w.message : "Failed to load HTML preview");
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__ */ P("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
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(tt, { title: "Failed to load HTML preview", description: a ?? "Preview unavailable." }) }) : /* @__PURE__ */ P("div", { className: oe("flex h-full min-h-0 flex-col bg-background", t), children: [
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__ */ P("div", { className: "flex items-center gap-1", children: [
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: h,
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: xa(e),
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(tt, { title: "No file selected", description: "Choose an HTML file from the file tree." }) });
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(et, { children: t })
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(Sr(i), r, o);
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_-]+$/), St = K.string().max(1024), Ka = K.number().nonnegative(), Ha = K.object({
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: St,
4004
- contentComponent: St.optional(),
4005
- title: St.optional()
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(St, Ya)
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((h) => h.id === s.id) ? d.panels : [...d.panels, s],
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, ...h } = d.dirtyFiles;
4100
- return { dirtyFiles: h };
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 = k((f, s) => {
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 = k(
4276
+ }, [o]), l = P(
4263
4277
  (f) => {
4264
4278
  _n(f.id, f.title), f.run(), o();
4265
4279
  },
4266
4280
  [o]
4267
- ), c = k((f) => {
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 = T(null), a = T(null), l = T(!1);
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
- }, h = (g) => {
4297
- const v = g.target;
4298
- if (!v) return;
4299
- const w = document.querySelector('[data-slot="dialog-content"]');
4300
- w && !w.contains(v) && (g.preventDefault(), g.stopPropagation(), t(!1));
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", h, { capture: !0 }), () => {
4303
- window.removeEventListener("keydown", p, { capture: !0 }), window.removeEventListener("pointerdown", h, { capture: !0 });
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 = k(() => {
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 = k((p) => {
4330
- r(p), o((h) => h.replace(/^>\s*/, "")), requestAnimationFrame(() => {
4331
- var h;
4332
- return (h = i.current) == null ? void 0 : h.focus();
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 = k(() => {
4348
+ }, [r, o]), s = P(() => {
4335
4349
  f(n === "commands" ? "catalogs" : "commands");
4336
- }, [n, f]), d = k((p) => {
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] = M(""), [i, a] = M([]);
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 h = d.get(p.id);
4381
+ const m = d.get(p.id);
4368
4382
  return {
4369
4383
  catalog: p,
4370
- rows: (h == null ? void 0 : h.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
- (h) => h.catalog.id === s.id ? { catalog: s, ...d } : h
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] = M(!1), [r, o] = M(""), [i, a] = M("catalogs"), l = ai(), c = si(), f = pl(), s = H(() => {
4420
- const x = {};
4421
- for (const D of (f == null ? void 0 : f.registeredPlugins) ?? [])
4422
- D.label && (x[D.id] = D.label);
4423
- return x;
4424
- }, [f == null ? void 0 : f.registeredPlugins]), d = i === "commands", p = r.trim(), h = cc({
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: v, handleInputKeyDown: w } = ac({
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
- }), S = k((x) => {
4435
- if (x.startsWith(">")) {
4436
- a("commands"), o(x.slice(1));
4448
+ }), k = P((w) => {
4449
+ if (w.startsWith(">")) {
4450
+ a("commands"), o(w.slice(1));
4437
4451
  return;
4438
4452
  }
4439
- o(x);
4440
- }, []), _ = H(() => d ? rc(c, p) : [], [c, d, p]), {
4441
- recentEntries: L,
4442
- handleCatalogSelect: m,
4443
- handleCommandSelect: F,
4444
- handleRecentSelect: I
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__ */ P(
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__ */ P(Ro, { className: "sr-only", children: [
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__ */ P(Ao, { shouldFilter: !1, className: "flex min-h-0 flex-1 flex-col bg-transparent", children: [
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: S,
4473
- onInputKeyDown: w,
4474
- onSwitchMode: v,
4475
- loading: !d && h.some((x) => x.loading)
4486
+ onQueryChange: k,
4487
+ onInputKeyDown: x,
4488
+ onSwitchMode: y,
4489
+ loading: !d && m.some((w) => w.loading)
4476
4490
  }
4477
4491
  ),
4478
- /* @__PURE__ */ P(
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: L,
4503
+ recentEntries: D,
4490
4504
  searchQuery: p,
4491
- onRecentSelect: I
4505
+ onRecentSelect: v
4492
4506
  }
4493
4507
  ),
4494
4508
  /* @__PURE__ */ u(
4495
4509
  fc,
4496
4510
  {
4497
- catalogGroups: h,
4511
+ catalogGroups: m,
4498
4512
  isCommandMode: d,
4499
- onCatalogSelect: m
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: F
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__ */ P("div", { className: "relative shrink-0", children: [
4530
- /* @__PURE__ */ P("div", { className: "relative flex items-stretch [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:h-auto", children: [
4531
- /* @__PURE__ */ P(
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__ */ P(_e, { children: [
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__ */ P(_e, { children: [
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__ */ P(Xt, { heading: r.catalog.label, children: [
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__ */ P(
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__ */ P(
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__ */ P(
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__ */ P("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: [
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__ */ P("div", { className: "flex items-center gap-3", children: [
4677
- /* @__PURE__ */ P("span", { className: "flex items-center gap-1", children: [
4678
- /* @__PURE__ */ u(et, { children: "tab" }),
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__ */ P("span", { className: "flex items-center gap-1", children: [
4682
- /* @__PURE__ */ u(et, { children: /* @__PURE__ */ u(lo, { className: "size-3" }) }),
4683
- /* @__PURE__ */ u(et, { children: /* @__PURE__ */ u(uo, { className: "size-3" }) }),
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__ */ P("span", { className: "flex items-center gap-1", children: [
4687
- /* @__PURE__ */ u(et, { children: /* @__PURE__ */ u(fo, { className: "size-3" }) }),
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__ */ P("span", { className: "flex items-center gap-1", children: [
4691
- /* @__PURE__ */ u(et, { children: "esc" }),
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__ */ P(
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__ */ P("span", { className: "flex min-w-0 flex-1 items-baseline gap-2 truncate", children: [
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 = k(
4747
- (w) => {
4748
- var S;
4760
+ } = e, s = P(
4761
+ (x) => {
4762
+ var k;
4749
4763
  r && o && i && qt(
4750
- { kind: "openFile", params: { path: w } },
4764
+ { kind: "openFile", params: { path: x } },
4751
4765
  { surface: r, isWorkbenchOpen: o, openWorkbench: i, openWorkbenchSources: a, closeWorkbench: l }
4752
- ), (S = e.onOpenArtifact) == null || S.call(e, w);
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((w) => !w.sessionId || w.sessionId === f.sessionId);
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 h = k(() => {
4771
- var w;
4772
- window.dispatchEvent(new CustomEvent("boring:workspace-composer-stop", { detail: { sessionId: f.sessionId } })), (w = e.onComposerStop) == null || w.call(e);
4773
- }, [f.sessionId, e.onComposerStop]), g = k(
4774
- (w, S) => {
4775
- if (S === "cancel") {
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
- S !== "open" || !w.surfaceKind || r && o && i && qt(
4780
- { kind: "openSurface", params: { kind: w.surfaceKind, target: w.target, meta: {} } },
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
- ), v = k(
4786
- (w) => {
4787
- var S;
4788
- Oi(w), (S = e.onData) == null || S.call(e, w);
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: v,
4812
+ onData: y,
4799
4813
  composerBlockers: p,
4800
- onComposerStop: h,
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 xt(e) {
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 Sc(e) {
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 h = xt(p.updatedAt);
4830
- if (!h) {
4843
+ const m = St(p.updatedAt);
4844
+ if (!m) {
4831
4845
  f.push(p);
4832
4846
  continue;
4833
4847
  }
4834
- const g = Wn(h);
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, h) => {
4838
- var w, S;
4839
- const g = ((w = xt(p.updatedAt)) == null ? void 0 : w.getTime()) ?? 0;
4840
- return (((S = xt(h.updatedAt)) == null ? void 0 : S.getTime()) ?? 0) - g;
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 xc(e) {
4845
- const t = xt(e);
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(() => Sc(e), [e]);
4873
- return /* @__PURE__ */ P(
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__ */ P("div", { className: "flex h-11 items-center justify-between border-b border-border/60 px-3.5", children: [
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__ */ P("div", { className: "flex items-center gap-0.5", children: [
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__ */ P("div", { className: "flex-1 overflow-y-auto py-2.5", children: [
4892
- e.length === 0 && /* @__PURE__ */ P("div", { className: "px-3 py-8 text-center text-[13px] text-muted-foreground", children: [
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__ */ P("section", { className: oe(p > 0 && "mt-4"), children: [
4898
- /* @__PURE__ */ P("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: [
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((h) => /* @__PURE__ */ u(
4916
+ /* @__PURE__ */ u("ul", { role: "list", className: "flex flex-col", children: d.items.map((m) => /* @__PURE__ */ u(
4903
4917
  Pc,
4904
4918
  {
4905
- session: h,
4906
- active: h.id === t,
4919
+ session: m,
4920
+ active: m.id === t,
4907
4921
  onSwitch: n,
4908
4922
  onDelete: o
4909
4923
  },
4910
- h.id
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 = xc(e.updatedAt);
4935
- return /* @__PURE__ */ P(
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__ */ P("span", { className: "min-w-0 flex-1 truncate leading-5", title: e.title, children: [
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 = nt(
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] = M(n ?? ""), h = s.some((B) => B.id === d) ? d : ((te = s[0]) == null ? void 0 : te.id) ?? "", [g, v] = M(!1), [w, S] = M(""), [_, L] = M(""), m = T(null), F = T(void 0);
5029
- $(() => (clearTimeout(F.current), F.current = setTimeout(() => L(w), 180), () => clearTimeout(F.current)), [w]), $(() => {
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 = m.current) == null || B.focus());
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 I = k(() => {
5038
- v((B) => (B && S(""), !B));
5039
- }, []), x = k((B) => {
5040
- B.key === "Escape" && (B.preventDefault(), v(!1), S(""));
5041
- }, []), D = s.find((B) => B.id === h), O = !!!((le = D == null ? void 0 : D.panel) != null && le.chromeless), W = H(
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: _ || void 0,
5059
+ query: $,
5060
+ searchQuery: $ || void 0,
5047
5061
  chromeless: !0,
5048
5062
  revealFileTreeRequest: r
5049
5063
  }),
5050
- [t, _, r, e]
5064
+ [t, $, r, e]
5051
5065
  );
5052
- return /* @__PURE__ */ P("div", { "data-boring-workspace-part": "workbench-left", className: oe("workbench-left-root flex h-full min-h-0 flex-col", a), children: [
5053
- /* @__PURE__ */ P("div", { className: "flex h-11 items-center gap-1 border-b border-border/60 px-2.5", children: [
5054
- /* @__PURE__ */ u(_o, { value: h, 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__ */ P(
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
- O && /* @__PURE__ */ u(
5080
+ _ && /* @__PURE__ */ u(
5067
5081
  ge,
5068
5082
  {
5069
5083
  type: "button",
5070
5084
  variant: "ghost",
5071
5085
  size: "icon-xs",
5072
- onClick: I,
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
- O && g && /* @__PURE__ */ P("div", { className: "flex items-center gap-1 border-b border-border/60 px-2 py-1.5", children: [
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: m,
5111
+ ref: h,
5098
5112
  type: "text",
5099
- value: w,
5100
- onChange: (B) => S(B.target.value),
5101
- onKeyDown: x,
5102
- placeholder: `Search ${((D == null ? void 0 : D.title) ?? "sources").toLowerCase()}...`,
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
- w && /* @__PURE__ */ u(
5120
+ x && /* @__PURE__ */ u(
5107
5121
  ge,
5108
5122
  {
5109
5123
  type: "button",
5110
5124
  variant: "ghost",
5111
5125
  size: "icon-xs",
5112
- onClick: () => S(""),
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: D == null ? void 0 : D.panel, params: W, onOpenPanel: o }) })
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]), h = k(
5234
+ }, [n, s, t]), m = P(
5221
5235
  (g) => {
5222
5236
  if (o) {
5223
5237
  o(g);
5224
5238
  return;
5225
5239
  }
5226
- const v = { v: zr, layout: g };
5240
+ const y = { v: zr, layout: g };
5227
5241
  try {
5228
- window.localStorage.setItem(t, JSON.stringify(v));
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: h,
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, h] = M(() => {
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, v] = M(() => {
5337
+ }), [g, y] = O(() => {
5324
5338
  if (!o) return t;
5325
5339
  try {
5326
- const y = localStorage.getItem(`${o}:sidebarWidth`);
5327
- if (!y) return t;
5328
- const C = Number(y);
5329
- return Number.isFinite(C) ? Math.max(n, Math.min(r, C)) : t;
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
- }), w = T(null), S = T(null), _ = T(null), [L, m] = M(null), [F, I] = M(null), x = T(i);
5334
- x.current = i;
5335
- const D = T(a);
5336
- D.current = a;
5337
- const N = T(l);
5338
- N.current = l;
5339
- const O = T(/* @__PURE__ */ new Set()), W = T(/* @__PURE__ */ new Set()), te = T(null), le = T(
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 = nt(
5355
+ ), B = At(), ie = rt(
5342
5356
  B.subscribe,
5343
5357
  B.getSnapshot,
5344
5358
  B.getSnapshot
5345
- ), z = nr(), J = T(B);
5359
+ ), z = nr(), J = A(B);
5346
5360
  J.current = B;
5347
- const G = T(z);
5361
+ const G = A(z);
5348
5362
  G.current = z;
5349
5363
  const ue = H(() => {
5350
- const y = /* @__PURE__ */ new Set();
5351
- for (const C of ie)
5352
- C.placement === "center" && y.add(C.id);
5353
- for (const C of c ?? [])
5354
- y.add(C);
5355
- return [...y];
5356
- }, [c, ie]), Ie = k((y) => {
5357
- const C = w.current;
5358
- if (!C) {
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 E = kt(y), j = {
5376
+ const I = kt(b), j = {
5363
5377
  kind: Be,
5364
- target: E
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 "${E}"`);
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 = C.getPanel(pe), Se = Bt(Z.params, E);
5387
+ const ne = E.getPanel(pe), xe = Bt(Z.params, I);
5374
5388
  if (ne) {
5375
- ne.api.updateParameters(Se), ne.api.setActive();
5389
+ ne.api.updateParameters(xe), ne.api.setActive();
5376
5390
  return;
5377
5391
  }
5378
- C.addPanel({
5392
+ E.addPanel({
5379
5393
  id: pe,
5380
5394
  component: Z.component,
5381
- title: Z.title ?? E.split("/").pop() ?? E,
5382
- params: Se
5395
+ title: Z.title ?? I.split("/").pop() ?? I,
5396
+ params: xe
5383
5397
  });
5384
5398
  return;
5385
5399
  }
5386
- const fe = jn(C, E);
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 "${E}"`);
5392
- }, []), me = k((y) => {
5405
+ console.warn(`[SurfaceShell] openFile: no surface resolver matched "${I}"`);
5406
+ }, []), me = P((b) => {
5393
5407
  var pt;
5394
- const C = w.current;
5395
- if (!C) {
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 E = _c(y), j = G.current.resolve(E);
5413
+ const I = _c(b), j = G.current.resolve(I);
5400
5414
  if (!j) {
5401
- console.warn(`[SurfaceShell] openSurface: no resolver matched kind="${E.kind}" target="${E.target}"`);
5415
+ console.warn(`[SurfaceShell] openSurface: no resolver matched kind="${I.kind}" target="${I.target}"`);
5402
5416
  return;
5403
5417
  }
5404
- const Z = jt(E, j);
5405
- E.kind === Be && W.current.add(Z);
5406
- const fe = C.getPanel(Z), pe = ((pt = E.meta) == null ? void 0 : pt.closeWorkbenchOnDone) === !0, ne = E.kind === Be ? Bt(j.params, E.target) : j.params, Se = pe && N.current ? { ...ne ?? {}, __closeWorkbenchOnDone: N.current } : ne;
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
- Se && fe.api.updateParameters(Se), fe.api.setActive();
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
- C.addPanel({
5432
+ E.addPanel({
5419
5433
  id: Z,
5420
5434
  component: j.component,
5421
- title: j.title ?? E.target,
5422
- params: Se
5435
+ title: j.title ?? I.target,
5436
+ params: xe
5423
5437
  });
5424
- }, []), he = k((y) => {
5425
- const C = w.current;
5426
- if (!C) return;
5427
- const E = C.getPanel(y.id);
5428
- if (E) {
5429
- y.params && E.api.updateParameters(y.params), E.api.setActive();
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(y.component)) {
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 "${y.component}". Registered panels: [${Z}]. Add the component to WorkspaceProvider's "panels" prop, or pick one of the registered ids.`
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
- C.addPanel({
5440
- id: y.id,
5441
- component: y.component,
5442
- title: y.title ?? y.id,
5443
- params: y.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 = k(() => {
5446
- var E;
5447
- const y = w.current;
5448
- return y ? { openTabs: y.panels.map((j) => ({
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: ((E = y.activePanel) == null ? void 0 : E.id) ?? null } : { openTabs: [], activeTab: null };
5453
- }, []), Ue = k((y, C) => {
5454
- const E = le.current.get(y);
5455
- if (!E || E.size === 0) return !1;
5456
- for (const j of [...E])
5457
- j(C);
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 = k((y) => {
5460
- const C = kt(y);
5461
- te.current = C, I((E) => ({ path: C, seq: ((E == null ? void 0 : E.seq) ?? 0) + 1 })), h(!1), Ue("tree:expand", { path: C }) && (te.current = null);
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: () => h(!0),
5480
+ closeWorkbenchLeftPane: () => m(!0),
5467
5481
  expandToFile: qe,
5468
5482
  getSnapshot: ke
5469
- }), [qe, ke, Ie, he, me]), X = k(() => {
5483
+ }), [qe, ke, Ie, he, me]), X = P(() => {
5470
5484
  var pe;
5471
- const y = w.current, C = y ? y.panels.map((ne) => ({
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
- })) : [], E = ((pe = y == null ? void 0 : y.activePanel) == null ? void 0 : pe.id) ?? null, j = W.current, Z = C.find((ne) => ne.id === E), fe = Bn(Z, j);
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: C,
5483
- activePanel: E,
5496
+ panels: E,
5497
+ activePanel: I,
5484
5498
  activeFile: fe,
5485
- visibleFiles: C.map((ne) => Bn(ne, j)).filter((ne) => ne !== null),
5499
+ visibleFiles: E.map((ne) => Bn(ne, j)).filter((ne) => ne !== null),
5486
5500
  dirtyFiles: {},
5487
5501
  notifications: []
5488
5502
  };
5489
- }, [t]), ae = k(() => {
5490
- const y = X();
5491
- for (const C of O.current)
5492
- C(y);
5493
- }, [X]), we = T(!1), ce = k((y) => {
5494
- var E;
5495
- if (w.current = y, m(y), !we.current) {
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
- y.getPanel(j.id) || y.addPanel({ id: j.id, component: j.component, title: j.title, params: j.params });
5512
+ b.getPanel(j.id) || b.addPanel({ id: j.id, component: j.component, title: j.title, params: j.params });
5499
5513
  }
5500
- (E = x.current) == null || E.call(x, Qe);
5501
- const C = () => {
5514
+ (I = w.current) == null || I.call(w, Qe);
5515
+ const E = () => {
5502
5516
  var j;
5503
- (j = D.current) == null || j.call(D, ke()), ae();
5517
+ (j = N.current) == null || j.call(N, ke()), ae();
5504
5518
  };
5505
- y.onDidAddPanel(C), y.onDidRemovePanel(C), y.onDidActivePanelChange(C), C();
5506
- }, [Qe, ke, ae]), be = k(
5507
- async (y) => {
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 C = w.current;
5510
- if (!C) return gt("not-ready", "surface not ready");
5511
- const E = kt(y), j = {
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: E
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, E), Se = C.getPanel(pe);
5524
- return Se ? (Se.api.updateParameters(ne), Se.api.setActive(), Le()) : (C.addPanel({
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 ?? E.split("/").pop() ?? E,
5541
+ title: Z.title ?? I.split("/").pop() ?? I,
5528
5542
  params: ne
5529
5543
  }), Le());
5530
5544
  }
5531
- const fe = jn(C, E);
5532
- return fe ? (fe.api.setActive(), Le()) : gt("NO_SURFACE_RESOLVER", `no registered surface resolver handles ${E}`);
5533
- } catch (C) {
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
- C instanceof Error ? C.message : "failed to open file"
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 () => (h(!0), Le()),
5563
+ closeWorkbenchLeftPane: async () => (m(!0), Le()),
5550
5564
  showNotification: async () => Le(),
5551
5565
  navigateToLine: async () => Le(),
5552
- expandToFile: async (y) => (qe(y), Le()),
5566
+ expandToFile: async (b) => (qe(b), Le()),
5553
5567
  markDirty: () => {
5554
5568
  },
5555
5569
  markClean: () => {
5556
5570
  },
5557
- subscribe: (y, C) => {
5558
- let E = le.current.get(y);
5559
- return E || (E = /* @__PURE__ */ new Set(), le.current.set(y, E)), E.add(C), y === "tree:expand" && te.current && (C({ path: te.current }), te.current = null), () => {
5560
- E == null || E.delete(C);
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: (y, C) => {
5564
- const E = (j) => C(y(j));
5565
- return O.current.add(E), E(X()), () => {
5566
- O.current.delete(E);
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 = k(
5570
- (y) => {
5583
+ }), [qe, be, X]), Re = P(
5584
+ (b) => {
5571
5585
  if (p) return;
5572
- y.preventDefault(), y.currentTarget.setPointerCapture(y.pointerId), _.current = { startX: y.clientX, startWidth: g };
5586
+ b.preventDefault(), b.currentTarget.setPointerCapture(b.pointerId), $.current = { startX: b.clientX, startWidth: g };
5573
5587
  },
5574
5588
  [p, g]
5575
- ), Ke = k(
5576
- (y) => {
5577
- const C = _.current;
5578
- if (!C) return;
5579
- const E = y.clientX - C.startX, j = Math.max(n, Math.min(r, C.startWidth + E));
5580
- v(j);
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 = k((y) => {
5584
- _.current && (_.current = null, y.currentTarget.releasePointerCapture(y.pointerId));
5585
- }, []), Ne = k(
5586
- (y) => {
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 C = y.shiftKey ? 32 : 16;
5589
- y.key === "ArrowLeft" ? (y.preventDefault(), v((E) => Math.max(n, E - C))) : y.key === "ArrowRight" ? (y.preventDefault(), v((E) => Math.min(r, E + C))) : y.key === "Home" ? (y.preventDefault(), v(n)) : y.key === "End" && (y.preventDefault(), v(r));
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__ */ P(
5619
+ }, [o, p]), /* @__PURE__ */ C(
5606
5620
  "div",
5607
5621
  {
5608
- ref: S,
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__ */ P(_e, { children: [
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: F,
5642
+ revealFileTreeRequest: M,
5629
5643
  onOpenPanel: he,
5630
- onCollapse: () => h(!0)
5644
+ onCollapse: () => m(!0)
5631
5645
  }
5632
5646
  )
5633
5647
  }
@@ -5652,7 +5666,7 @@ function Oc({
5652
5666
  }
5653
5667
  )
5654
5668
  ] }),
5655
- /* @__PURE__ */ P("div", { className: "relative min-w-0 flex-1", children: [
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__ */ P(
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: () => h(!1),
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: L,
5713
+ api: D,
5700
5714
  collapsed: p,
5701
- onExpandFiles: () => h(!1)
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] = M(!0);
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__ */ P(_e, { children: [
5739
- /* @__PURE__ */ P("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: [
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__ */ P("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-start justify-center gap-2 px-6 pt-12 pb-10", children: [
5756
- /* @__PURE__ */ P("div", { className: "flex items-center gap-2 text-[11px] font-medium tracking-tight text-muted-foreground/75", children: [
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__ */ P(
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] = M([]), r = k((a) => {
5818
+ const [t, n] = O([]), r = P((a) => {
5805
5819
  n((l) => [...l.filter((c) => c.id !== a.id), a]);
5806
- }, []), o = k((a) => {
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 = T(/* @__PURE__ */ new Map()), a = T(/* @__PURE__ */ new Map()), l = T(/* @__PURE__ */ new Set()), [c, f] = M(0), s = T(!1);
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 h = p.detail;
5998
- al(h) && (s.current = !0, f((g) => g + 1));
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), h = Hc(Vr(e.apiBaseUrl ?? "", "/api/v1/agent-plugins/events"), e.workspaceId), g = new EventSource(h, { withCredentials: !0 }), v = (L) => {
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 m, F = !1;
6026
+ let h, M = !1;
6013
6027
  try {
6014
- if (m = JSON.parse(L.data), d || m.workspaceId && e.workspaceId && m.workspaceId !== e.workspaceId) return;
6015
- m.replay && l.current.add(m.id);
6016
- const I = i.current.get(m.id) ?? 0, x = a.current.get(m.id) ?? 0;
6017
- if (m.revision <= Math.max(I, x)) return;
6018
- a.current.set(m.id, m.revision);
6019
- const D = Jc(m, e.apiBaseUrl);
6020
- D && (F = !0, window.dispatchEvent(new CustomEvent(Ee, {
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: m.id,
6024
- revision: m.revision,
6025
- workspaceId: m.workspaceId ?? e.workspaceId,
6026
- replay: m.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 N = null;
6043
+ let T = null;
6030
6044
  try {
6031
- N = D ? await tl(m.id, D, m.revision, e.importFront) : null;
6032
- } catch (O) {
6045
+ T = N ? await tl(h.id, N, h.revision, e.importFront) : null;
6046
+ } catch (_) {
6033
6047
  throw {
6034
6048
  stage: "import",
6035
- error: O
6049
+ error: _
6036
6050
  };
6037
6051
  }
6038
- if (d || a.current.get(m.id) !== m.revision || m.revision <= (i.current.get(m.id) ?? 0)) return;
6039
- if (!N) {
6040
- yt(m.id, p), i.current.set(m.id, m.revision), window.dispatchEvent(new CustomEvent(Ee, { detail: m }));
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(m.id, m.revision, N, p);
6045
- } catch (O) {
6058
+ sl(h.id, h.revision, T, p);
6059
+ } catch (_) {
6046
6060
  throw {
6047
6061
  stage: "register",
6048
- error: O
6062
+ error: _
6049
6063
  };
6050
6064
  }
6051
- i.current.set(m.id, m.revision), window.dispatchEvent(new CustomEvent(Ee, { detail: m }));
6052
- } catch (I) {
6053
- m && a.current.get(m.id) === m.revision && a.current.delete(m.id);
6054
- const x = typeof I == "object" && I && "stage" in I && I.stage === "register" ? "register" : "import", D = typeof I == "object" && I && "error" in I ? I.error : I;
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 N = (m == null ? void 0 : m.id) ?? "<malformed>", O = D instanceof Error ? D.message : String(D);
6057
- console.error(`[boring-ui] failed to load plugin ${N}; keeping previous version`, D), m && window.dispatchEvent(new CustomEvent(Ee, {
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: m.id,
6061
- revision: m.revision,
6062
- workspaceId: m.workspaceId ?? e.workspaceId,
6063
- message: O,
6074
+ id: h.id,
6075
+ revision: h.revision,
6076
+ workspaceId: h.workspaceId ?? e.workspaceId,
6077
+ message: _,
6064
6078
  code: Kc,
6065
- stage: x,
6066
- replay: m.replay
6079
+ stage: w,
6080
+ replay: h.replay
6067
6081
  }
6068
6082
  }));
6069
6083
  } finally {
6070
- F && m && window.dispatchEvent(new CustomEvent(Ee, {
6084
+ M && h && window.dispatchEvent(new CustomEvent(Ee, {
6071
6085
  detail: {
6072
6086
  type: "boring.plugin.front-settled",
6073
- id: m.id,
6074
- revision: m.revision,
6075
- workspaceId: m.workspaceId ?? e.workspaceId,
6076
- replay: m.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
- }, w = (L) => {
6095
+ }, x = (D) => {
6082
6096
  if (!d)
6083
6097
  try {
6084
- const m = JSON.parse(L.data);
6085
- if (m.workspaceId && e.workspaceId && m.workspaceId !== e.workspaceId) return;
6086
- const F = i.current.get(m.id) ?? 0, I = a.current.get(m.id) ?? 0;
6087
- if (m.revision <= Math.max(F, I)) return;
6088
- a.current.set(m.id, m.revision), yt(m.id, p), i.current.set(m.id, m.revision), window.dispatchEvent(new CustomEvent(Ee, { detail: m }));
6089
- } catch (m) {
6090
- console.error("[boring-ui] failed to process plugin unload event", m);
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
- }, S = (L) => {
6106
+ }, k = (D) => {
6093
6107
  if (!d)
6094
6108
  try {
6095
- const m = JSON.parse(L.data);
6096
- if (m.workspaceId && e.workspaceId && m.workspaceId !== e.workspaceId) return;
6097
- console.error(`[boring-ui] plugin ${m.id} failed to reload: ${m.message}`), window.dispatchEvent(new CustomEvent(Ee, {
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: m.id,
6101
- revision: m.revision,
6102
- workspaceId: m.workspaceId ?? e.workspaceId,
6103
- message: m.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 (m) {
6107
- console.error("[boring-ui] failed to process plugin error event", m);
6120
+ } catch (h) {
6121
+ console.error("[boring-ui] failed to process plugin error event", h);
6108
6122
  }
6109
- }, _ = (L) => {
6123
+ }, $ = (D) => {
6110
6124
  if (!d)
6111
6125
  try {
6112
- const m = JSON.parse(L.data);
6113
- if (m.workspaceId && e.workspaceId && m.workspaceId !== e.workspaceId) return;
6114
- const F = l.current;
6115
- for (const [I, x] of i.current.entries())
6116
- F.has(I) || (yt(I, p), i.current.delete(I), a.current.delete(I), window.dispatchEvent(new CustomEvent(Ee, {
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: I,
6120
- revision: x + 1,
6121
- workspaceId: m.workspaceId ?? e.workspaceId,
6133
+ id: v,
6134
+ revision: w + 1,
6135
+ workspaceId: h.workspaceId ?? e.workspaceId,
6122
6136
  replay: !0
6123
6137
  }
6124
6138
  })));
6125
- F.clear(), window.dispatchEvent(new CustomEvent(Ee, { detail: m }));
6126
- } catch (m) {
6127
- console.error("[boring-ui] failed to process plugin replay-complete event", m);
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", v), g.addEventListener("boring.plugin.unload", w), g.addEventListener("boring.plugin.error", S), g.addEventListener("boring.plugin.replay-complete", _), () => {
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 L of i.current.keys()) yt(L, p);
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 = T(null);
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 = k(
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 = k(() => {
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
- $(() => (document.documentElement.setAttribute("data-theme", l), () => {
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 Sl(e, t) {
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: h,
6336
+ workspaceId: m,
6323
6337
  storageKey: g,
6324
- persistenceEnabled: v = !0,
6325
- bridgeEndpoint: w,
6326
- onAuthError: S,
6327
- onOpenFile: _,
6328
- debug: L = !1,
6329
- frontPluginHotReload: m = !1,
6330
- fullPageBasePath: F
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 I = T(null);
6333
- if (!I.current) {
6346
+ const v = A(null);
6347
+ if (!v.current) {
6334
6348
  const X = Fr({
6335
- workspaceId: h,
6349
+ workspaceId: m,
6336
6350
  storageKey: g,
6337
- persistenceEnabled: v
6351
+ persistenceEnabled: y
6338
6352
  });
6339
6353
  wr(X);
6340
6354
  const ae = d ?? Kr();
6341
- ae !== "light" && !v ? X.getState().setTheme(ae) : ae !== "light" && (typeof localStorage < "u" && localStorage.getItem("boring-ui-v2:preferences") !== null || X.getState().setTheme(ae)), I.current = X;
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 x = I.current, D = T(null), N = T(f);
6344
- N.current = f;
6345
- const O = T(S);
6346
- O.current = S, $(() => () => {
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 = D.current) == null || X.disconnect(), D.current = null, x.cleanup();
6349
- }, [x]), $(() => {
6362
+ (X = N.current) == null || X.disconnect(), N.current = null, w.cleanup();
6363
+ }, [w]), L(() => {
6350
6364
  var ce, be;
6351
- if (D.current && (D.current.disconnect(), D.current = null), !w) return;
6352
- const X = Si(x), ae = (be = (ce = N.current) == null ? void 0 : ce.Authorization) == null ? void 0 : be.replace(/^Bearer\s+/i, ""), we = Ci({
6353
- endpoint: w,
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: x,
6369
+ store: w,
6356
6370
  authToken: ae,
6357
6371
  onAuthError: (Ve) => {
6358
6372
  var Re;
6359
- return (Re = O.current) == null ? void 0 : Re.call(O, Ve);
6373
+ return (Re = _.current) == null ? void 0 : Re.call(_, Ve);
6360
6374
  },
6361
6375
  onConnectionChange: Ue
6362
6376
  });
6363
- return we.connect(), D.current = we, () => {
6364
- we.disconnect(), D.current = null;
6377
+ return we.connect(), N.current = we, () => {
6378
+ we.disconnect(), N.current = null;
6365
6379
  };
6366
- }, [w, x]);
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: y, ...C } = Ne;
6371
- X.register(y, C);
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: y, ...C } = Ne;
6390
- X.register(y, C);
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 = T(p);
6414
+ }, [l, t, n, r, o]), J = A(p);
6401
6415
  J.current = p;
6402
- const G = k(
6416
+ const G = P(
6403
6417
  (X) => {
6404
6418
  var ae;
6405
- x.getState().setTheme(X), (ae = J.current) == null || ae.call(J, X);
6419
+ w.getState().setTheme(X), (ae = J.current) == null || ae.call(J, X);
6406
6420
  },
6407
- [x]
6408
- ), ue = k(() => {
6409
- const X = x.getState().preferences.theme === "light" ? "dark" : "light";
6421
+ [w]
6422
+ ), ue = P(() => {
6423
+ const X = w.getState().preferences.theme === "light" ? "dark" : "light";
6410
6424
  G(X);
6411
- }, [x, G]), Ie = sn();
6412
- $(() => (document.documentElement.setAttribute("data-theme", Ie), () => {
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
- () => Sl(h, f),
6420
- [f, h]
6421
- ), [ke, Ue] = M(!1), qe = H(
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: L }),
6426
- [t, ie, L]
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: F, children: /* @__PURE__ */ u(Vc, { children: /* @__PURE__ */ u(li, { children: /* @__PURE__ */ u(
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: h, authHeaders: he, children: /* @__PURE__ */ P(
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: S,
6455
+ onAuthError: k,
6442
6456
  apiTimeout: s,
6443
6457
  children: [
6444
6458
  /* @__PURE__ */ u(yl, { plugins: z }),
6445
- /* @__PURE__ */ u(ul, { apiBaseUrl: c, workspaceId: h, mode: m, authHeaders: he }),
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: x }),
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
- rt as ar,
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
- Si as x,
6564
+ xi as x,
6551
6565
  Ci as y,
6552
6566
  Fr as z
6553
6567
  };