@mcp-b/react-components 0.65.0 → 0.67.0

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.
Files changed (107) hide show
  1. package/dist/AgentComputer-BP9ixGGE.js +8093 -0
  2. package/dist/{ExecutionResult-CXnGcmM4.js → ExecutionResult-C7SzVquo.js} +1 -1
  3. package/dist/WallpaperPicker-C-FItmDS.d.ts +34 -0
  4. package/dist/WorkspaceBrowser-Dz48H-7X.d.ts +89 -0
  5. package/dist/{WorkspaceFileCommands-SNIjRgtU.d.ts → WorkspaceFileCommands-1s9Ol8CG.d.ts} +11 -3
  6. package/dist/{WorkspaceMessageResponse-CXGOQgpo.js → WorkspaceMessageResponse-BoeeltJM.js} +1 -1
  7. package/dist/assets/wallpapers/README.md +31 -0
  8. package/dist/assets/wallpapers/alpine.webp +0 -0
  9. package/dist/assets/wallpapers/dusk.webp +0 -0
  10. package/dist/assets/wallpapers/ember.webp +0 -0
  11. package/dist/assets/wallpapers/graphite.webp +0 -0
  12. package/dist/assets/wallpapers/sigvelo.webp +0 -0
  13. package/dist/assets/wallpapers/tide.webp +0 -0
  14. package/dist/automations-host-DPORjdc7.js +17 -0
  15. package/dist/components/agents-sdk/AgentComputer.d.ts +7 -1
  16. package/dist/components/agents-sdk/AgentComputer.js +1 -8044
  17. package/dist/components/agents-sdk/AgentScreenSwitcher.js +1 -0
  18. package/dist/components/agents-sdk/BrowserLiveScreen.d.ts +7 -1
  19. package/dist/components/agents-sdk/BrowserLiveScreen.js +259 -257
  20. package/dist/components/agents-sdk/BrowserRunPanel.d.ts +2 -0
  21. package/dist/components/agents-sdk/BrowserRunPanel.js +1 -0
  22. package/dist/components/agents-sdk/ComputerAutomations.d.ts +70 -0
  23. package/dist/components/agents-sdk/ComputerAutomations.js +1410 -0
  24. package/dist/components/agents-sdk/ComputerCalendar.d.ts +7 -0
  25. package/dist/components/agents-sdk/ComputerCalendar.js +1344 -0
  26. package/dist/components/agents-sdk/ComputerFiles.d.ts +153 -0
  27. package/dist/components/agents-sdk/ComputerFiles.js +2401 -0
  28. package/dist/components/agents-sdk/ComputerHome.d.ts +15 -0
  29. package/dist/components/agents-sdk/ComputerHome.js +90 -0
  30. package/dist/components/agents-sdk/ComputerNotifications.d.ts +54 -0
  31. package/dist/components/agents-sdk/ComputerNotifications.js +692 -0
  32. package/dist/components/agents-sdk/ComputerScreen.d.ts +78 -0
  33. package/dist/components/agents-sdk/ComputerScreen.js +750 -0
  34. package/dist/components/agents-sdk/ComputerSettings.d.ts +69 -0
  35. package/dist/components/agents-sdk/ComputerSettings.js +1371 -0
  36. package/dist/components/agents-sdk/ComputerSpotlight.d.ts +29 -0
  37. package/dist/components/agents-sdk/ComputerSpotlight.js +232 -0
  38. package/dist/components/agents-sdk/ComputerViewer.d.ts +51 -0
  39. package/dist/components/agents-sdk/ComputerViewer.js +339 -0
  40. package/dist/components/agents-sdk/ComputerWallpapers.d.ts +11 -0
  41. package/dist/components/agents-sdk/ComputerWallpapers.js +43 -0
  42. package/dist/components/agents-sdk/EmployeeApp.js +1 -1
  43. package/dist/components/agents-sdk/EmployeeChat.js +1 -1
  44. package/dist/components/agents-sdk/EmployeeChrome.js +4 -4
  45. package/dist/components/agents-sdk/EmployeeSchedules.js +3 -3
  46. package/dist/components/agents-sdk/EmployeeStartScreen.js +1 -1
  47. package/dist/components/agents-sdk/ExecutionBoard.js +1 -1
  48. package/dist/components/agents-sdk/ManagerOffice.js +1 -1
  49. package/dist/components/agents-sdk/ManagerOfficeScreens.js +1 -1
  50. package/dist/components/agents-sdk/McpPluginCatalog.js +1 -1
  51. package/dist/components/agents-sdk/ModelSelector.js +1 -1
  52. package/dist/components/agents-sdk/ThinkChat.js +1 -1
  53. package/dist/components/agents-sdk/ThinkChatActivitySummary.js +1 -1
  54. package/dist/components/agents-sdk/ThinkChatToolPanels.js +5 -5
  55. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
  56. package/dist/components/agents-sdk/ThinkFullApp.d.ts +13 -0
  57. package/dist/components/agents-sdk/ThinkFullApp.js +13 -0
  58. package/dist/components/agents-sdk/ThinkScheduleActions.js +1 -1
  59. package/dist/components/agents-sdk/ThinkScheduleDetail.js +3 -3
  60. package/dist/components/agents-sdk/ThinkScheduleForm.js +4 -4
  61. package/dist/components/agents-sdk/WorkspaceAutomation.js +4 -4
  62. package/dist/components/agents-sdk/WorkspaceAutomationTable.js +1 -1
  63. package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +2 -88
  64. package/dist/components/agents-sdk/WorkspaceCorrespondence.js +1 -1
  65. package/dist/components/agents-sdk/WorkspaceDesktop.d.ts +1 -1
  66. package/dist/components/agents-sdk/WorkspaceDocumentFrame.d.ts +17 -0
  67. package/dist/components/agents-sdk/WorkspaceDocumentFrame.js +90 -0
  68. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +4 -1
  69. package/dist/components/agents-sdk/WorkspaceExplorer.js +70 -66
  70. package/dist/components/agents-sdk/WorkspaceFileCommands.d.ts +2 -2
  71. package/dist/components/agents-sdk/WorkspaceFileCommands.js +346 -316
  72. package/dist/components/agents-sdk/WorkspaceFileView.d.ts +7 -1
  73. package/dist/components/agents-sdk/WorkspaceFileView.js +83 -71
  74. package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
  75. package/dist/components/agents-sdk/WorkspaceLive.d.ts +2 -4
  76. package/dist/components/agents-sdk/WorkspaceLive.js +18 -11
  77. package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
  78. package/dist/components/ai-sdk/ConnectedAppCards.js +1 -1
  79. package/dist/components/ai-sdk/Goal.d.ts +1 -2
  80. package/dist/components/ai-sdk/Goal.js +1 -2
  81. package/dist/components/extension/FirstRunSetup.js +5 -5
  82. package/dist/components/general-purpose/CommandPalette.d.ts +6 -1
  83. package/dist/components/general-purpose/CommandPalette.js +90 -82
  84. package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
  85. package/dist/components/general-purpose/ThemeModeControl.js +1 -1
  86. package/dist/components/general-purpose/WallpaperPicker.d.ts +2 -33
  87. package/dist/components/nanites/AgentConnection.js +1 -1
  88. package/dist/parts-RXV6GGdB.js +112 -0
  89. package/dist/styles/agent-computer.css +35 -0
  90. package/dist/styles/base.css +6 -0
  91. package/dist/styles/computer-app-tile.css +20 -0
  92. package/dist/styles/computer-automations.css +454 -0
  93. package/dist/styles/computer-calendar.css +648 -0
  94. package/dist/styles/computer-files.css +566 -0
  95. package/dist/styles/computer-home.css +90 -0
  96. package/dist/styles/computer-notifications.css +242 -0
  97. package/dist/styles/computer-screen.css +89 -0
  98. package/dist/styles/computer-settings.css +550 -0
  99. package/dist/styles/computer-spotlight.css +7 -0
  100. package/dist/styles/computer-viewer.css +130 -0
  101. package/dist/styles/index.css +11 -0
  102. package/dist/styles/recipes.css +42 -0
  103. package/dist/styles/workspace-document-frame.css +31 -0
  104. package/package.json +2 -2
  105. package/dist/{ManagerOffice-T79utm-P.js → ManagerOffice-kSK7vTBl.js} +1 -1
  106. package/dist/{WorkspaceLink-DDkj-Tq5.js → WorkspaceLink-DK9kdMUH.js} +1 -1
  107. package/dist/{connected-app-drafts-Bocdg3Z-.js → connected-app-drafts-C49343p9.js} +1 -1
@@ -0,0 +1,2401 @@
1
+ import { desktopArtwork } from "../../utils/desktop-artwork.js";
2
+ import { C as DownloadIcon, E as EyeIcon, I as ListIcon, J as PencilIcon, V as MessageSquareIcon, Z as PlusIcon, a as ArrowUpDownIcon, et as RefreshIcon, g as ChevronRightIcon, h as ChevronLeftIcon, j as GridIcon, k as FolderIcon, p as CheckIcon, v as ClockIcon, w as EllipsisIcon, y as CodeIcon } from "../../icons-nLTnB9kd.js";
3
+ import { Field } from "../foundations/Field.js";
4
+ import { o as formatOperationError } from "../../format-DL7f2rqp.js";
5
+ import { Button } from "../foundations/Button.js";
6
+ import { SettingsFormDialog } from "../general-purpose/SettingsFormDialog.js";
7
+ import { IconButton } from "../foundations/IconButton.js";
8
+ import { AppIcon } from "../foundations/AppIcon.js";
9
+ import { Menu } from "../foundations/Menu.js";
10
+ import { a as workspaceDirname, i as workspaceBasename } from "../../workspace-path-TZggP-u4.js";
11
+ import { downloadWorkspaceFile, saveWorkspaceFileAs } from "./WorkspaceFileTransfer.js";
12
+ import { r as useWorkspaceDragAndDrop } from "../../workspace-drag-B6hMXUNt.js";
13
+ import { a as useAgentComputerWindow, r as useAgentComputerAppHandlers } from "../../AgentComputer-BP9ixGGE.js";
14
+ import { Menubar } from "../foundations/Menubar.js";
15
+ import { EmptyState } from "../foundations/EmptyState.js";
16
+ import { AppTopBar } from "../general-purpose/AppTopBar.js";
17
+ import { n as computerAppTile } from "../../parts-RXV6GGdB.js";
18
+ import { SearchField } from "../foundations/SearchField.js";
19
+ import { ToggleGroup } from "../foundations/ToggleGroup.js";
20
+ import { useWorkspace, workspaceInfoQueryKey } from "./Workspace.js";
21
+ import { o as hasModifier } from "../../workspace-quick-look-9V-UFpjj.js";
22
+ import { WORKSPACE_TRASH, isHiddenWorkspaceEntry, isInWorkspaceTrash, isWithin, useWorkspaceFileCommands, workspaceFileCommandForKey, workspaceFileShortcut } from "./WorkspaceFileCommands.js";
23
+ import { WorkspaceFileDetails, WorkspaceFileFacts } from "./WorkspaceFileDetails.js";
24
+ import { WorkspaceFileView } from "./WorkspaceFileView.js";
25
+ import { WorkspaceExplorer } from "./WorkspaceExplorer.js";
26
+ import { ListDetail } from "../general-purpose/ListDetail.js";
27
+ import { c } from "react/compiler-runtime";
28
+ import * as React from "react";
29
+ import { useDeferredValue, useRef, useState, useSyncExternalStore } from "react";
30
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
31
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
32
+ //#region src/components/_internal/computer-files/finder.tsx
33
+ /**
34
+ * Finder's Recents and a search are queries, not folders: each lists under a
35
+ * root the workspace cannot have (a dot name is reserved for the system), so
36
+ * the listing reads its rows from the host and its cache follows the volume's.
37
+ */
38
+ const RECENTS = "/.Recents";
39
+ const SEARCH = "/.Search/";
40
+ const QUERY_LIMIT = 200;
41
+ const NO_UNSUPPORTED = () => null;
42
+ function finderPlaces(locations) {
43
+ return [{
44
+ id: "recents",
45
+ label: "Recents",
46
+ path: RECENTS,
47
+ icon: /* @__PURE__ */ jsx(ClockIcon, {})
48
+ }, ...locations];
49
+ }
50
+ /**
51
+ * The home volume's source, with Recents and a search read from the host.
52
+ * A Proxy, so a class-backed source keeps its own `this`.
53
+ */
54
+ function querySource(source, recent, search) {
55
+ const readDir = async (path = "/", options) => {
56
+ const rows = path === "/.Recents" ? await recent(QUERY_LIMIT) : path.startsWith(SEARCH) ? await search(decodeURIComponent(path.slice(9)), QUERY_LIMIT) : null;
57
+ if (!rows) return source.readDir(path, options);
58
+ const offset = options?.offset ?? 0;
59
+ return rows.slice(offset, offset + (options?.limit ?? Infinity));
60
+ };
61
+ return new Proxy(source, { get(target, key) {
62
+ if (key === "readDir") return readDir;
63
+ const value = Reflect.get(target, key);
64
+ return typeof value === "function" ? value.bind(target) : value;
65
+ } });
66
+ }
67
+ /** What a desktop icon or Quick Look opens into: a folder's contents, or the file itself. */
68
+ function ComputerFilesPreview(t0) {
69
+ const $ = c(28);
70
+ const { entry, source, sourceKey, renderUnsupported: t1 } = t0;
71
+ const renderUnsupported = t1 === void 0 ? NO_UNSUPPORTED : t1;
72
+ const t2 = entry.type === "directory" ? entry.path : "/";
73
+ const t3 = entry.type === "file" ? entry.path : null;
74
+ let t4;
75
+ if ($[0] !== source || $[1] !== sourceKey || $[2] !== t2 || $[3] !== t3) {
76
+ t4 = {
77
+ source,
78
+ sourceKey,
79
+ root: t2,
80
+ selectedPath: t3
81
+ };
82
+ $[0] = source;
83
+ $[1] = sourceKey;
84
+ $[2] = t2;
85
+ $[3] = t3;
86
+ $[4] = t4;
87
+ } else t4 = $[4];
88
+ const workspace = useWorkspace(t4);
89
+ if (entry.type === "directory") {
90
+ let t5;
91
+ if ($[5] !== entry.path || $[6] !== workspace.entriesByDirectory) {
92
+ t5 = workspace.entriesByDirectory[entry.path] ?? [];
93
+ $[5] = entry.path;
94
+ $[6] = workspace.entriesByDirectory;
95
+ $[7] = t5;
96
+ } else t5 = $[7];
97
+ const children = t5;
98
+ let t6;
99
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t6 = /* @__PURE__ */ jsx(AppIcon.Root, {
101
+ "aria-hidden": "true",
102
+ children: /* @__PURE__ */ jsx(AppIcon.Image, {
103
+ src: desktopArtwork.folder,
104
+ alt: ""
105
+ })
106
+ });
107
+ $[8] = t6;
108
+ } else t6 = $[8];
109
+ const t7 = workspace.error ?? (workspace.isLoading ? "Loading folder…" : `${children.length} items`);
110
+ let t8;
111
+ if ($[9] !== t7) {
112
+ t8 = /* @__PURE__ */ jsx("p", { children: t7 });
113
+ $[9] = t7;
114
+ $[10] = t8;
115
+ } else t8 = $[10];
116
+ let t9;
117
+ if ($[11] !== children) {
118
+ t9 = children.map(_temp$1);
119
+ $[11] = children;
120
+ $[12] = t9;
121
+ } else t9 = $[12];
122
+ let t10;
123
+ if ($[13] !== t9) {
124
+ t10 = /* @__PURE__ */ jsx("ul", { children: t9 });
125
+ $[13] = t9;
126
+ $[14] = t10;
127
+ } else t10 = $[14];
128
+ let t11;
129
+ if ($[15] !== t10 || $[16] !== t8) {
130
+ t11 = /* @__PURE__ */ jsxs("div", {
131
+ className: "computer-files-folder-preview",
132
+ children: [
133
+ t6,
134
+ t8,
135
+ t10
136
+ ]
137
+ });
138
+ $[15] = t10;
139
+ $[16] = t8;
140
+ $[17] = t11;
141
+ } else t11 = $[17];
142
+ return t11;
143
+ }
144
+ const t5 = entry.path;
145
+ const t6 = workspace.selectedFile;
146
+ let t7;
147
+ if ($[18] !== entry.path || $[19] !== workspace.loadingPaths) {
148
+ t7 = workspace.loadingPaths.has(entry.path);
149
+ $[18] = entry.path;
150
+ $[19] = workspace.loadingPaths;
151
+ $[20] = t7;
152
+ } else t7 = $[20];
153
+ let t8;
154
+ if ($[21] !== entry.path || $[22] !== renderUnsupported || $[23] !== t7 || $[24] !== workspace.isLoading || $[25] !== workspace.refresh || $[26] !== workspace.selectedFile) {
155
+ t8 = /* @__PURE__ */ jsx(WorkspaceFileView, {
156
+ header: "none",
157
+ appearance: "fill",
158
+ path: t5,
159
+ file: t6,
160
+ isLoading: t7,
161
+ isRefreshing: workspace.isLoading,
162
+ renderUnsupported,
163
+ onRefresh: workspace.refresh
164
+ });
165
+ $[21] = entry.path;
166
+ $[22] = renderUnsupported;
167
+ $[23] = t7;
168
+ $[24] = workspace.isLoading;
169
+ $[25] = workspace.refresh;
170
+ $[26] = workspace.selectedFile;
171
+ $[27] = t8;
172
+ } else t8 = $[27];
173
+ return t8;
174
+ }
175
+ function _temp$1(child) {
176
+ return /* @__PURE__ */ jsx("li", { children: child.name }, child.path);
177
+ }
178
+ /** Downloads or saves one file and resolves to its status line, including a failure's. */
179
+ async function exportAs(source, path, mode) {
180
+ const name = workspaceBasename(path);
181
+ const started = `Download started for ${name}. Your browser controls where it is saved.`;
182
+ try {
183
+ if (mode === "download") {
184
+ await downloadWorkspaceFile(source, path);
185
+ return started;
186
+ }
187
+ const result = await saveWorkspaceFileAs(source, path);
188
+ return result === "saved" ? `Saved ${name} to this computer.` : result === "cancelled" ? "Save cancelled." : started;
189
+ } catch (error) {
190
+ return `Export failed: ${formatOperationError(error)}`;
191
+ }
192
+ }
193
+ function projectSlug(name) {
194
+ return name.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64);
195
+ }
196
+ function projectDocument(name, description) {
197
+ return `---\nname: ${name.replaceAll("\n", " ").trim()}\ndescription: ${description.replaceAll("\n", " ").trim()}\n---\n\n## Working set\n`;
198
+ }
199
+ /** Finder titles its window after the folder you are looking at. */
200
+ function folderName(location, titles) {
201
+ return titles.get(location) ?? (location === "/.Trash" ? "Trash" : void 0) ?? location.slice(location.lastIndexOf("/") + 1);
202
+ }
203
+ function FinderBreadcrumbs(t0) {
204
+ const $ = c(5);
205
+ const { path, file, onLocation, titles } = t0;
206
+ let t1;
207
+ if ($[0] !== file || $[1] !== onLocation || $[2] !== path || $[3] !== titles) {
208
+ const parts = path.split("/").filter(Boolean);
209
+ const paths = ["/", ...parts.map((_, index) => `/${parts.slice(0, index + 1).join("/")}`)];
210
+ t1 = /* @__PURE__ */ jsx("nav", {
211
+ className: "computer-finder-breadcrumbs",
212
+ "aria-label": "Current folder",
213
+ children: /* @__PURE__ */ jsx("ol", { children: paths.map((crumb, index_0) => /* @__PURE__ */ jsxs("li", { children: [index_0 ? /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true" }) : null, index_0 === paths.length - 1 ? /* @__PURE__ */ jsx("span", {
214
+ "aria-current": "page",
215
+ title: file ? workspaceBasename(path) : folderName(crumb, titles),
216
+ children: file ? workspaceBasename(path) : folderName(crumb, titles)
217
+ }) : /* @__PURE__ */ jsx(Button, {
218
+ variant: "ghost",
219
+ color: "neutral",
220
+ size: "xs",
221
+ onClick: () => onLocation(crumb),
222
+ children: folderName(crumb, titles)
223
+ })] }, crumb)) })
224
+ });
225
+ $[0] = file;
226
+ $[1] = onLocation;
227
+ $[2] = path;
228
+ $[3] = titles;
229
+ $[4] = t1;
230
+ } else t1 = $[4];
231
+ return t1;
232
+ }
233
+ /** The orders the toolbar's Sort menu and View › Sort By both offer. */
234
+ const SORT_KEYS = [
235
+ ["name", "Name"],
236
+ ["kind", "Kind"],
237
+ ["modified", "Date Modified"],
238
+ ["size", "Size"]
239
+ ];
240
+ function FinderViewControls(t0) {
241
+ const $ = c(31);
242
+ const { layout, onLayoutChange, sort, onSortChange } = t0;
243
+ let t1;
244
+ if ($[0] !== layout) {
245
+ t1 = [layout];
246
+ $[0] = layout;
247
+ $[1] = t1;
248
+ } else t1 = $[1];
249
+ let t2;
250
+ if ($[2] !== onLayoutChange) {
251
+ t2 = (next) => {
252
+ if (next[0]) onLayoutChange(next[0]);
253
+ };
254
+ $[2] = onLayoutChange;
255
+ $[3] = t2;
256
+ } else t2 = $[3];
257
+ let t3;
258
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
259
+ t3 = /* @__PURE__ */ jsxs(ToggleGroup.Item, {
260
+ value: "list",
261
+ iconOnly: true,
262
+ children: [/* @__PURE__ */ jsx(ListIcon, {}), /* @__PURE__ */ jsx("span", {
263
+ className: "sigvelo-visually-hidden",
264
+ children: "List"
265
+ })]
266
+ });
267
+ $[4] = t3;
268
+ } else t3 = $[4];
269
+ let t4;
270
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
271
+ t4 = /* @__PURE__ */ jsxs(ToggleGroup.Item, {
272
+ value: "grid",
273
+ iconOnly: true,
274
+ children: [/* @__PURE__ */ jsx(GridIcon, {}), /* @__PURE__ */ jsx("span", {
275
+ className: "sigvelo-visually-hidden",
276
+ children: "Grid"
277
+ })]
278
+ });
279
+ $[5] = t4;
280
+ } else t4 = $[5];
281
+ let t5;
282
+ if ($[6] !== t1 || $[7] !== t2) {
283
+ t5 = /* @__PURE__ */ jsxs(ToggleGroup.Root, {
284
+ className: "computer-finder-views",
285
+ size: "sm",
286
+ value: t1,
287
+ "aria-label": "Files view",
288
+ onValueChange: t2,
289
+ children: [t3, t4]
290
+ });
291
+ $[6] = t1;
292
+ $[7] = t2;
293
+ $[8] = t5;
294
+ } else t5 = $[8];
295
+ let t6;
296
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
297
+ t6 = /* @__PURE__ */ jsx(Menu.Trigger, { render: /* @__PURE__ */ jsx(IconButton, {
298
+ label: "Sort",
299
+ variant: "ghost",
300
+ color: "neutral",
301
+ children: /* @__PURE__ */ jsx(ArrowUpDownIcon, {})
302
+ }) });
303
+ $[9] = t6;
304
+ } else t6 = $[9];
305
+ const t7 = sort.by;
306
+ let t8;
307
+ if ($[10] !== onSortChange || $[11] !== sort) {
308
+ t8 = (next_0) => onSortChange({
309
+ ...sort,
310
+ by: next_0
311
+ });
312
+ $[10] = onSortChange;
313
+ $[11] = sort;
314
+ $[12] = t8;
315
+ } else t8 = $[12];
316
+ let t9;
317
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
318
+ t9 = SORT_KEYS.map(_temp2$1);
319
+ $[13] = t9;
320
+ } else t9 = $[13];
321
+ let t10;
322
+ if ($[14] !== sort.by || $[15] !== t8) {
323
+ t10 = /* @__PURE__ */ jsx(Menu.RadioGroup, {
324
+ value: t7,
325
+ onValueChange: t8,
326
+ children: t9
327
+ });
328
+ $[14] = sort.by;
329
+ $[15] = t8;
330
+ $[16] = t10;
331
+ } else t10 = $[16];
332
+ let t11;
333
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
334
+ t11 = /* @__PURE__ */ jsx(Menu.Separator, {});
335
+ $[17] = t11;
336
+ } else t11 = $[17];
337
+ const t12 = sort.direction === "descending";
338
+ let t13;
339
+ if ($[18] !== onSortChange || $[19] !== sort) {
340
+ t13 = (checked) => onSortChange({
341
+ ...sort,
342
+ direction: checked ? "descending" : "ascending"
343
+ });
344
+ $[18] = onSortChange;
345
+ $[19] = sort;
346
+ $[20] = t13;
347
+ } else t13 = $[20];
348
+ let t14;
349
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
350
+ t14 = /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {});
351
+ $[21] = t14;
352
+ } else t14 = $[21];
353
+ let t15;
354
+ if ($[22] !== t12 || $[23] !== t13) {
355
+ t15 = /* @__PURE__ */ jsxs(Menu.CheckboxItem, {
356
+ checked: t12,
357
+ onCheckedChange: t13,
358
+ children: [t14, "Descending"]
359
+ });
360
+ $[22] = t12;
361
+ $[23] = t13;
362
+ $[24] = t15;
363
+ } else t15 = $[24];
364
+ let t16;
365
+ if ($[25] !== t10 || $[26] !== t15) {
366
+ t16 = /* @__PURE__ */ jsxs(Menu.Root, { children: [t6, /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
367
+ align: "end",
368
+ sideOffset: 4,
369
+ children: /* @__PURE__ */ jsxs(Menu.Popup, { children: [
370
+ t10,
371
+ t11,
372
+ t15
373
+ ] })
374
+ }) })] });
375
+ $[25] = t10;
376
+ $[26] = t15;
377
+ $[27] = t16;
378
+ } else t16 = $[27];
379
+ let t17;
380
+ if ($[28] !== t16 || $[29] !== t5) {
381
+ t17 = /* @__PURE__ */ jsxs(Fragment, { children: [t5, t16] });
382
+ $[28] = t16;
383
+ $[29] = t5;
384
+ $[30] = t17;
385
+ } else t17 = $[30];
386
+ return t17;
387
+ }
388
+ function _temp2$1(t0) {
389
+ const [by, label] = t0;
390
+ return /* @__PURE__ */ jsxs(Menu.RadioItem, {
391
+ value: by,
392
+ children: [/* @__PURE__ */ jsx(Menu.RadioItemIndicator, {}), label]
393
+ }, by);
394
+ }
395
+ function FinderPathBar(t0) {
396
+ const $ = c(16);
397
+ let onLocation;
398
+ let screen;
399
+ let viewControls;
400
+ if ($[0] !== t0) {
401
+ ({screen, onLocation, ...viewControls} = t0);
402
+ $[0] = t0;
403
+ $[1] = onLocation;
404
+ $[2] = screen;
405
+ $[3] = viewControls;
406
+ } else {
407
+ onLocation = $[1];
408
+ screen = $[2];
409
+ viewControls = $[3];
410
+ }
411
+ const fileInfo = screen.workspace.selectedFile?.path === screen.file ? screen.workspace.selectedFile.info : null;
412
+ const t1 = screen.file ?? screen.location;
413
+ const t2 = Boolean(screen.file);
414
+ let t3;
415
+ if ($[4] !== onLocation || $[5] !== screen.titles || $[6] !== t1 || $[7] !== t2) {
416
+ t3 = /* @__PURE__ */ jsx(FinderBreadcrumbs, {
417
+ path: t1,
418
+ file: t2,
419
+ onLocation,
420
+ titles: screen.titles
421
+ });
422
+ $[4] = onLocation;
423
+ $[5] = screen.titles;
424
+ $[6] = t1;
425
+ $[7] = t2;
426
+ $[8] = t3;
427
+ } else t3 = $[8];
428
+ let t4;
429
+ if ($[9] !== fileInfo || $[10] !== screen.file || $[11] !== viewControls) {
430
+ t4 = screen.file ? fileInfo ? /* @__PURE__ */ jsx(WorkspaceFileDetails, { file: fileInfo }) : null : /* @__PURE__ */ jsx(FinderViewControls, { ...viewControls });
431
+ $[9] = fileInfo;
432
+ $[10] = screen.file;
433
+ $[11] = viewControls;
434
+ $[12] = t4;
435
+ } else t4 = $[12];
436
+ let t5;
437
+ if ($[13] !== t3 || $[14] !== t4) {
438
+ t5 = /* @__PURE__ */ jsxs("div", {
439
+ className: "computer-finder-path-bar",
440
+ children: [t3, t4]
441
+ });
442
+ $[13] = t3;
443
+ $[14] = t4;
444
+ $[15] = t5;
445
+ } else t5 = $[15];
446
+ return t5;
447
+ }
448
+ function openFilePath(navigation) {
449
+ return navigation.current.destination.kind === "file" ? navigation.current.destination.path : null;
450
+ }
451
+ /**
452
+ * The detail screens for a location, outermost first: the folder or file
453
+ * showing, and the folder under it that a stacked layout pops back to. iOS
454
+ * Files' root screen is the locations list, so a folder one level down goes
455
+ * back to that rather than to a listing of "/".
456
+ */
457
+ function finderDetail(location, file) {
458
+ const folder = (path) => ({
459
+ key: path,
460
+ location: path,
461
+ file: null
462
+ });
463
+ if (file) {
464
+ const opened = {
465
+ key: `file:${file}`,
466
+ location,
467
+ file
468
+ };
469
+ return location === "/" ? [opened] : [folder(location), opened];
470
+ }
471
+ const parent = workspaceDirname(location);
472
+ return location === "/" || parent === "/" ? [folder(location)] : [folder(parent), folder(location)];
473
+ }
474
+ /** The listing under the top screen of a stacked Finder, read only when that screen is drawn. */
475
+ function FinderParentListing(t0) {
476
+ const $ = c(7);
477
+ const { source, sourceKey, root, children } = t0;
478
+ let t1;
479
+ if ($[0] !== root || $[1] !== source || $[2] !== sourceKey) {
480
+ t1 = {
481
+ source,
482
+ sourceKey,
483
+ root,
484
+ selectedPath: null
485
+ };
486
+ $[0] = root;
487
+ $[1] = source;
488
+ $[2] = sourceKey;
489
+ $[3] = t1;
490
+ } else t1 = $[3];
491
+ const t2 = useWorkspace(t1);
492
+ let t3;
493
+ if ($[4] !== children || $[5] !== t2) {
494
+ t3 = children(t2);
495
+ $[4] = children;
496
+ $[5] = t2;
497
+ $[6] = t3;
498
+ } else t3 = $[6];
499
+ return t3;
500
+ }
501
+ /** The screen's own name in its bar: the folder, or the open file. */
502
+ function screenTitle(screen) {
503
+ return screen.file ? workspaceBasename(screen.file) : folderName(screen.location, screen.titles);
504
+ }
505
+ /**
506
+ * Where a screen's Back goes, named after where it lands, as iOS's is: an open
507
+ * file returns to the folder that listed it, a folder to the screen one level
508
+ * up, and the root screen has nowhere further up.
509
+ */
510
+ function phoneBack(screen, onLocation) {
511
+ if (screen.file) return {
512
+ label: folderName(screen.location, screen.titles),
513
+ go: () => onLocation(screen.location)
514
+ };
515
+ if (screen.location === "/") return null;
516
+ const folder = workspaceDirname(screen.location);
517
+ return {
518
+ label: folderName(folder, screen.titles),
519
+ go: () => onLocation(folder)
520
+ };
521
+ }
522
+ function NewProjectDialog(t0) {
523
+ const $ = c(8);
524
+ const { open, onOpenChange, onCreate } = t0;
525
+ let t1;
526
+ if ($[0] !== onCreate) {
527
+ t1 = (t2) => {
528
+ const { name, description } = t2;
529
+ return onCreate(name, description);
530
+ };
531
+ $[0] = onCreate;
532
+ $[1] = t1;
533
+ } else t1 = $[1];
534
+ let t2;
535
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
536
+ t2 = /* @__PURE__ */ jsxs(Field.Root, {
537
+ name: "name",
538
+ children: [/* @__PURE__ */ jsx(Field.Label, { children: "Project name" }), /* @__PURE__ */ jsx(Field.Control, {
539
+ required: true,
540
+ autoComplete: "off"
541
+ })]
542
+ });
543
+ $[2] = t2;
544
+ } else t2 = $[2];
545
+ let t3;
546
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
547
+ t3 = /* @__PURE__ */ jsxs(Field.Root, {
548
+ name: "description",
549
+ children: [/* @__PURE__ */ jsx(Field.Label, { children: "Description" }), /* @__PURE__ */ jsx(Field.Control, { autoComplete: "off" })]
550
+ });
551
+ $[3] = t3;
552
+ } else t3 = $[3];
553
+ let t4;
554
+ if ($[4] !== onOpenChange || $[5] !== open || $[6] !== t1) {
555
+ t4 = /* @__PURE__ */ jsxs(SettingsFormDialog, {
556
+ open,
557
+ onOpenChange,
558
+ title: "New project",
559
+ description: "Create a project folder in Agent files.",
560
+ submitLabel: "Create project",
561
+ submittingLabel: "Creating…",
562
+ onFormSubmit: t1,
563
+ children: [t2, t3]
564
+ });
565
+ $[4] = onOpenChange;
566
+ $[5] = open;
567
+ $[6] = t1;
568
+ $[7] = t4;
569
+ } else t4 = $[7];
570
+ return t4;
571
+ }
572
+ function FinderTransferStatus(t0) {
573
+ const $ = c(8);
574
+ const { message, transferring, onCancel } = t0;
575
+ if (!message) return null;
576
+ let t1;
577
+ if ($[0] !== message) {
578
+ t1 = /* @__PURE__ */ jsx("span", { children: message });
579
+ $[0] = message;
580
+ $[1] = t1;
581
+ } else t1 = $[1];
582
+ let t2;
583
+ if ($[2] !== onCancel || $[3] !== transferring) {
584
+ t2 = transferring ? /* @__PURE__ */ jsx(Button, {
585
+ type: "button",
586
+ size: "xs",
587
+ variant: "ghost",
588
+ color: "neutral",
589
+ onClick: onCancel,
590
+ children: "Cancel"
591
+ }) : null;
592
+ $[2] = onCancel;
593
+ $[3] = transferring;
594
+ $[4] = t2;
595
+ } else t2 = $[4];
596
+ let t3;
597
+ if ($[5] !== t1 || $[6] !== t2) {
598
+ t3 = /* @__PURE__ */ jsxs("div", {
599
+ className: "computer-finder-transfer",
600
+ role: "status",
601
+ "aria-live": "polite",
602
+ children: [t1, t2]
603
+ });
604
+ $[5] = t1;
605
+ $[6] = t2;
606
+ $[7] = t3;
607
+ } else t3 = $[7];
608
+ return t3;
609
+ }
610
+ /**
611
+ * The rail iOS Files calls Browse: the root screen's own content, a list of
612
+ * locations rather than a listing of "/". A phone groups each section into an
613
+ * inset card and leaves out the workspace root, which the list itself is; the
614
+ * desktop rail is one run of rows.
615
+ */
616
+ function FinderRail(t0) {
617
+ const $ = c(40);
618
+ const { phone, location, onLocation, places, projects, railDragAndDrop } = t0;
619
+ const group = phone ? "inset-group" : void 0;
620
+ let t1;
621
+ if ($[0] !== phone || $[1] !== places) {
622
+ t1 = phone ? places.filter(_temp3$1) : places;
623
+ $[0] = phone;
624
+ $[1] = places;
625
+ $[2] = t1;
626
+ } else t1 = $[2];
627
+ const shown = t1;
628
+ let t2;
629
+ if ($[3] !== location || $[4] !== projects || $[5] !== shown) {
630
+ t2 = shown.find((place_0) => location === place_0.path)?.path ?? projects.map(_temp4).find((path) => location === path) ?? shown[0]?.path;
631
+ $[3] = location;
632
+ $[4] = projects;
633
+ $[5] = shown;
634
+ $[6] = t2;
635
+ } else t2 = $[6];
636
+ const tabStop = t2;
637
+ let t3;
638
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
639
+ t3 = /* @__PURE__ */ jsx("span", {
640
+ className: "computer-section-label",
641
+ children: "Favorites"
642
+ });
643
+ $[7] = t3;
644
+ } else t3 = $[7];
645
+ let t4;
646
+ if ($[8] !== location || $[9] !== onLocation || $[10] !== railDragAndDrop || $[11] !== shown || $[12] !== tabStop) {
647
+ let t5;
648
+ if ($[14] !== location || $[15] !== onLocation || $[16] !== railDragAndDrop || $[17] !== tabStop) {
649
+ t5 = (place_1) => /* @__PURE__ */ jsxs(FinderRailRow, {
650
+ tabStop: tabStop === place_1.path,
651
+ directory: place_1.path,
652
+ dragAndDrop: railDragAndDrop?.(place_1.path),
653
+ pressed: location === place_1.path,
654
+ onOpen: () => onLocation(place_1.path),
655
+ children: [place_1.icon ?? /* @__PURE__ */ jsx(FolderIcon, {}), /* @__PURE__ */ jsx("span", { children: place_1.label })]
656
+ }, place_1.id);
657
+ $[14] = location;
658
+ $[15] = onLocation;
659
+ $[16] = railDragAndDrop;
660
+ $[17] = tabStop;
661
+ $[18] = t5;
662
+ } else t5 = $[18];
663
+ t4 = shown.map(t5);
664
+ $[8] = location;
665
+ $[9] = onLocation;
666
+ $[10] = railDragAndDrop;
667
+ $[11] = shown;
668
+ $[12] = tabStop;
669
+ $[13] = t4;
670
+ } else t4 = $[13];
671
+ let t5;
672
+ if ($[19] !== group || $[20] !== t4) {
673
+ t5 = /* @__PURE__ */ jsx("div", {
674
+ className: "computer-finder-group",
675
+ "data-recipe": group,
676
+ children: t4
677
+ });
678
+ $[19] = group;
679
+ $[20] = t4;
680
+ $[21] = t5;
681
+ } else t5 = $[21];
682
+ let t6;
683
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
684
+ t6 = /* @__PURE__ */ jsx("span", {
685
+ className: "computer-section-label",
686
+ children: "Projects"
687
+ });
688
+ $[22] = t6;
689
+ } else t6 = $[22];
690
+ let t7;
691
+ if ($[23] !== location || $[24] !== onLocation || $[25] !== projects || $[26] !== railDragAndDrop || $[27] !== tabStop) {
692
+ let t8;
693
+ if ($[29] !== location || $[30] !== onLocation || $[31] !== railDragAndDrop || $[32] !== tabStop) {
694
+ t8 = (project_0) => {
695
+ const folderPath = workspaceDirname(project_0.path);
696
+ return /* @__PURE__ */ jsxs(FinderRailRow, {
697
+ tabStop: tabStop === folderPath,
698
+ directory: folderPath,
699
+ dragAndDrop: railDragAndDrop?.(folderPath),
700
+ pressed: location === folderPath,
701
+ onOpen: () => onLocation(folderPath),
702
+ children: [/* @__PURE__ */ jsx(FolderIcon, {}), /* @__PURE__ */ jsx("span", { children: project_0.name })]
703
+ }, project_0.path);
704
+ };
705
+ $[29] = location;
706
+ $[30] = onLocation;
707
+ $[31] = railDragAndDrop;
708
+ $[32] = tabStop;
709
+ $[33] = t8;
710
+ } else t8 = $[33];
711
+ t7 = projects.map(t8);
712
+ $[23] = location;
713
+ $[24] = onLocation;
714
+ $[25] = projects;
715
+ $[26] = railDragAndDrop;
716
+ $[27] = tabStop;
717
+ $[28] = t7;
718
+ } else t7 = $[28];
719
+ let t8;
720
+ if ($[34] !== group || $[35] !== t7) {
721
+ t8 = /* @__PURE__ */ jsx("div", {
722
+ className: "computer-finder-group",
723
+ "data-recipe": group,
724
+ children: t7
725
+ });
726
+ $[34] = group;
727
+ $[35] = t7;
728
+ $[36] = t8;
729
+ } else t8 = $[36];
730
+ let t9;
731
+ if ($[37] !== t5 || $[38] !== t8) {
732
+ t9 = /* @__PURE__ */ jsxs("nav", {
733
+ className: "computer-finder-sidebar",
734
+ "aria-label": "Workspace locations",
735
+ onKeyDown: _temp5,
736
+ children: [
737
+ t3,
738
+ t5,
739
+ t6,
740
+ t8
741
+ ]
742
+ });
743
+ $[37] = t5;
744
+ $[38] = t8;
745
+ $[39] = t9;
746
+ } else t9 = $[39];
747
+ return t9;
748
+ }
749
+ function _temp5(event) {
750
+ const rows = [...event.currentTarget.querySelectorAll(".computer-sidebar-row")];
751
+ const at = rows.indexOf(event.target);
752
+ if (at === -1 || hasModifier(event)) return;
753
+ const next = {
754
+ ArrowDown: at + 1,
755
+ ArrowUp: at - 1,
756
+ Home: 0,
757
+ End: rows.length - 1
758
+ }[event.key];
759
+ const row = next === void 0 ? void 0 : rows[next];
760
+ if (!row) return;
761
+ event.preventDefault();
762
+ row.focus();
763
+ }
764
+ function _temp4(project) {
765
+ return workspaceDirname(project.path);
766
+ }
767
+ function _temp3$1(place) {
768
+ return place.path !== "/";
769
+ }
770
+ /** One sidebar location: it opens on a press and, as in Finder, takes a drop and springs open under a held drag. */
771
+ function FinderRailRow(t0) {
772
+ const $ = c(12);
773
+ const { directory, dragAndDrop, pressed, tabStop, onOpen, children } = t0;
774
+ const { dropTarget } = useWorkspaceDragAndDrop(dragAndDrop);
775
+ const t1 = tabStop ? 0 : -1;
776
+ let t2;
777
+ if ($[0] !== directory || $[1] !== dragAndDrop || $[2] !== dropTarget || $[3] !== onOpen) {
778
+ t2 = dragAndDrop ? dropTarget(directory, onOpen) : {};
779
+ $[0] = directory;
780
+ $[1] = dragAndDrop;
781
+ $[2] = dropTarget;
782
+ $[3] = onOpen;
783
+ $[4] = t2;
784
+ } else t2 = $[4];
785
+ let t3;
786
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
787
+ t3 = /* @__PURE__ */ jsx(ChevronRightIcon, { className: "computer-finder-chevron" });
788
+ $[5] = t3;
789
+ } else t3 = $[5];
790
+ let t4;
791
+ if ($[6] !== children || $[7] !== onOpen || $[8] !== pressed || $[9] !== t1 || $[10] !== t2) {
792
+ t4 = /* @__PURE__ */ jsxs(Button, {
793
+ className: "computer-sidebar-row",
794
+ variant: "ghost",
795
+ color: "neutral",
796
+ size: "sm",
797
+ "aria-pressed": pressed,
798
+ tabIndex: t1,
799
+ onClick: onOpen,
800
+ ...t2,
801
+ children: [children, t3]
802
+ });
803
+ $[6] = children;
804
+ $[7] = onOpen;
805
+ $[8] = pressed;
806
+ $[9] = t1;
807
+ $[10] = t2;
808
+ $[11] = t4;
809
+ } else t4 = $[11];
810
+ return t4;
811
+ }
812
+ function ComputerFinder(t0) {
813
+ const $ = c(58);
814
+ const { workspace, source, sourceKey, navigation, location, onLocation, filter, onFilterChange, view, onViewChange, renderThumbnail, renderUnsupported, phone, layout, onLayoutChange, sort, onSortChange, locations, projects, titles, toolbarActions, dialogs, status, dragAndDrop, commands, actionsRef, railDragAndDrop } = t0;
815
+ let T0;
816
+ let back;
817
+ let selectedPath;
818
+ let t1;
819
+ let t2;
820
+ let t3;
821
+ let t4;
822
+ if ($[0] !== actionsRef || $[1] !== commands || $[2] !== dragAndDrop || $[3] !== filter || $[4] !== layout || $[5] !== location || $[6] !== locations || $[7] !== navigation || $[8] !== onFilterChange || $[9] !== onLayoutChange || $[10] !== onLocation || $[11] !== onSortChange || $[12] !== onViewChange || $[13] !== phone || $[14] !== projects || $[15] !== railDragAndDrop || $[16] !== renderThumbnail || $[17] !== renderUnsupported || $[18] !== sort || $[19] !== source || $[20] !== sourceKey || $[21] !== status || $[22] !== titles || $[23] !== toolbarActions || $[24] !== view || $[25] !== workspace) {
823
+ selectedPath = openFilePath(navigation);
824
+ const places = finderDetail(selectedPath ? workspaceDirname(selectedPath) : location, selectedPath);
825
+ const top = places.at(-1);
826
+ let t5;
827
+ if ($[33] !== titles) {
828
+ t5 = folderName("/", titles);
829
+ $[33] = titles;
830
+ $[34] = t5;
831
+ } else t5 = $[34];
832
+ const rootLabel = t5;
833
+ back = phoneBack({
834
+ ...top,
835
+ workspace,
836
+ titles
837
+ }, onLocation);
838
+ const t6 = phone ? void 0 : railDragAndDrop;
839
+ let t7;
840
+ if ($[35] !== location || $[36] !== locations || $[37] !== onLocation || $[38] !== phone || $[39] !== projects || $[40] !== t6) {
841
+ t7 = /* @__PURE__ */ jsx(FinderRail, {
842
+ phone,
843
+ location,
844
+ onLocation,
845
+ places: locations,
846
+ projects,
847
+ railDragAndDrop: t6
848
+ });
849
+ $[35] = location;
850
+ $[36] = locations;
851
+ $[37] = onLocation;
852
+ $[38] = phone;
853
+ $[39] = projects;
854
+ $[40] = t6;
855
+ $[41] = t7;
856
+ } else t7 = $[41];
857
+ const rail = t7;
858
+ const content = function content(screen) {
859
+ const currentScreen = screen.key === top.key;
860
+ return /* @__PURE__ */ jsxs("div", {
861
+ className: "computer-finder-content",
862
+ children: [
863
+ /* @__PURE__ */ jsx(FinderPathBar, {
864
+ screen,
865
+ layout,
866
+ onLayoutChange,
867
+ sort,
868
+ onSortChange,
869
+ onLocation
870
+ }),
871
+ currentScreen ? status : null,
872
+ /* @__PURE__ */ jsx(WorkspaceExplorer, {
873
+ workspace: screen.workspace,
874
+ navigation: screen.file !== selectedPath ? {
875
+ ...navigation,
876
+ current: {
877
+ ...navigation.current,
878
+ destination: { kind: "files" }
879
+ }
880
+ } : navigation,
881
+ header: "none",
882
+ layout,
883
+ sort,
884
+ showFilter: phone && !screen.file,
885
+ filterPlaceholder: "Search files",
886
+ filter,
887
+ onFilterChange,
888
+ view,
889
+ onViewChange,
890
+ onDirectoryOpen: onLocation,
891
+ renderThumbnail,
892
+ renderUnsupported,
893
+ renderPreview: (entry) => /* @__PURE__ */ jsx(ComputerFilesPreview, {
894
+ entry,
895
+ source,
896
+ sourceKey,
897
+ renderUnsupported
898
+ }),
899
+ actionsRef: currentScreen ? actionsRef : void 0,
900
+ dragAndDrop: phone || !currentScreen ? void 0 : dragAndDrop,
901
+ commands: phone || !currentScreen ? void 0 : commands
902
+ })
903
+ ]
904
+ });
905
+ };
906
+ const screenView = function screenView(screen_0) {
907
+ if (!phone) return content(screen_0);
908
+ const screenBack = phoneBack(screen_0, onLocation);
909
+ return /* @__PURE__ */ jsxs("div", {
910
+ className: "computer-finder-screen",
911
+ children: [/* @__PURE__ */ jsxs(AppTopBar.Root, {
912
+ className: "computer-finder-bar",
913
+ "aria-label": screenTitle(screen_0),
914
+ "data-nav-bar": "",
915
+ children: [
916
+ /* @__PURE__ */ jsx(AppTopBar.Leading, { children: screenBack ? /* @__PURE__ */ jsx(AppTopBar.Button, {
917
+ "data-nav-back": "",
918
+ label: screenBack.label,
919
+ onClick: screenBack.go,
920
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
921
+ }) : null }),
922
+ /* @__PURE__ */ jsx(AppTopBar.Title, {
923
+ className: "computer-finder-bar__title",
924
+ children: screenTitle(screen_0)
925
+ }),
926
+ /* @__PURE__ */ jsx(AppTopBar.Trailing, { children: screen_0.key === top.key ? toolbarActions : null })
927
+ ]
928
+ }), content(screen_0)]
929
+ });
930
+ };
931
+ T0 = ListDetail;
932
+ t1 = "computer-finder";
933
+ if ($[42] !== phone || $[43] !== rail || $[44] !== rootLabel || $[45] !== toolbarActions) {
934
+ t2 = phone ? /* @__PURE__ */ jsxs("div", {
935
+ className: "computer-finder-browse",
936
+ children: [
937
+ /* @__PURE__ */ jsxs(AppTopBar.Root, {
938
+ className: "computer-finder-bar",
939
+ "aria-label": rootLabel,
940
+ "data-nav-bar": "",
941
+ children: [
942
+ /* @__PURE__ */ jsx(AppTopBar.Leading, {}),
943
+ /* @__PURE__ */ jsx(AppTopBar.Title, {
944
+ className: "computer-finder-bar__title",
945
+ "aria-hidden": "true",
946
+ children: rootLabel
947
+ }),
948
+ /* @__PURE__ */ jsx(AppTopBar.Trailing, { children: toolbarActions })
949
+ ]
950
+ }),
951
+ /* @__PURE__ */ jsx("h2", {
952
+ className: "computer-finder-browse-title",
953
+ children: rootLabel
954
+ }),
955
+ rail
956
+ ]
957
+ }) : rail;
958
+ $[42] = phone;
959
+ $[43] = rail;
960
+ $[44] = rootLabel;
961
+ $[45] = toolbarActions;
962
+ $[46] = t2;
963
+ } else t2 = $[46];
964
+ t3 = "Locations";
965
+ t4 = places.map((place) => ({
966
+ key: place.key,
967
+ content: place.key === top.key ? screenView({
968
+ ...place,
969
+ workspace,
970
+ titles
971
+ }) : /* @__PURE__ */ jsx(FinderParentListing, {
972
+ source,
973
+ sourceKey,
974
+ root: place.location,
975
+ children: (listing) => screenView({
976
+ ...place,
977
+ workspace: listing,
978
+ titles
979
+ })
980
+ })
981
+ }));
982
+ $[0] = actionsRef;
983
+ $[1] = commands;
984
+ $[2] = dragAndDrop;
985
+ $[3] = filter;
986
+ $[4] = layout;
987
+ $[5] = location;
988
+ $[6] = locations;
989
+ $[7] = navigation;
990
+ $[8] = onFilterChange;
991
+ $[9] = onLayoutChange;
992
+ $[10] = onLocation;
993
+ $[11] = onSortChange;
994
+ $[12] = onViewChange;
995
+ $[13] = phone;
996
+ $[14] = projects;
997
+ $[15] = railDragAndDrop;
998
+ $[16] = renderThumbnail;
999
+ $[17] = renderUnsupported;
1000
+ $[18] = sort;
1001
+ $[19] = source;
1002
+ $[20] = sourceKey;
1003
+ $[21] = status;
1004
+ $[22] = titles;
1005
+ $[23] = toolbarActions;
1006
+ $[24] = view;
1007
+ $[25] = workspace;
1008
+ $[26] = T0;
1009
+ $[27] = back;
1010
+ $[28] = selectedPath;
1011
+ $[29] = t1;
1012
+ $[30] = t2;
1013
+ $[31] = t3;
1014
+ $[32] = t4;
1015
+ } else {
1016
+ T0 = $[26];
1017
+ back = $[27];
1018
+ selectedPath = $[28];
1019
+ t1 = $[29];
1020
+ t2 = $[30];
1021
+ t3 = $[31];
1022
+ t4 = $[32];
1023
+ }
1024
+ const t5 = !(location === "/" && !selectedPath);
1025
+ const t6 = back?.go;
1026
+ let t7;
1027
+ if ($[47] !== T0 || $[48] !== t1 || $[49] !== t2 || $[50] !== t3 || $[51] !== t4 || $[52] !== t5 || $[53] !== t6) {
1028
+ t7 = /* @__PURE__ */ jsx(T0, {
1029
+ className: t1,
1030
+ list: t2,
1031
+ listLabel: t3,
1032
+ detail: t4,
1033
+ detailLabel: "Folder contents",
1034
+ open: t5,
1035
+ onBack: t6
1036
+ });
1037
+ $[47] = T0;
1038
+ $[48] = t1;
1039
+ $[49] = t2;
1040
+ $[50] = t3;
1041
+ $[51] = t4;
1042
+ $[52] = t5;
1043
+ $[53] = t6;
1044
+ $[54] = t7;
1045
+ } else t7 = $[54];
1046
+ let t8;
1047
+ if ($[55] !== dialogs || $[56] !== t7) {
1048
+ t8 = /* @__PURE__ */ jsxs(Fragment, { children: [t7, dialogs] });
1049
+ $[55] = dialogs;
1050
+ $[56] = t7;
1051
+ $[57] = t8;
1052
+ } else t8 = $[57];
1053
+ return t8;
1054
+ }
1055
+ /**
1056
+ * Finder's unified toolbar, painted on the window frame beside the traffic
1057
+ * lights: the rail spacer carries the sidebar column the lights sit over, then
1058
+ * the folder history, the folder or file name, and the trailing controls the
1059
+ * surface below actually answers to.
1060
+ */
1061
+ function ComputerFinderToolbar(t0) {
1062
+ const $ = c(53);
1063
+ const { screen, layout, onLayoutChange, sort, onSortChange, onBack, onForward, searchRef, filter, onFilterChange, markdown, view, onViewChange, isRefreshing, onRefresh, actions } = t0;
1064
+ let t1;
1065
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1066
+ t1 = /* @__PURE__ */ jsx("span", {
1067
+ className: "computer-finder-toolbar__rail",
1068
+ "aria-hidden": "true"
1069
+ });
1070
+ $[0] = t1;
1071
+ } else t1 = $[0];
1072
+ const t2 = onBack === null;
1073
+ let t3;
1074
+ if ($[1] !== onBack) {
1075
+ t3 = () => onBack?.();
1076
+ $[1] = onBack;
1077
+ $[2] = t3;
1078
+ } else t3 = $[2];
1079
+ let t4;
1080
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1081
+ t4 = /* @__PURE__ */ jsx(ChevronLeftIcon, {});
1082
+ $[3] = t4;
1083
+ } else t4 = $[3];
1084
+ let t5;
1085
+ if ($[4] !== t2 || $[5] !== t3) {
1086
+ t5 = /* @__PURE__ */ jsx(IconButton, {
1087
+ label: "Back",
1088
+ variant: "ghost",
1089
+ color: "neutral",
1090
+ disabled: t2,
1091
+ onClick: t3,
1092
+ children: t4
1093
+ });
1094
+ $[4] = t2;
1095
+ $[5] = t3;
1096
+ $[6] = t5;
1097
+ } else t5 = $[6];
1098
+ const t6 = onForward === null;
1099
+ let t7;
1100
+ if ($[7] !== onForward) {
1101
+ t7 = () => onForward?.();
1102
+ $[7] = onForward;
1103
+ $[8] = t7;
1104
+ } else t7 = $[8];
1105
+ let t8;
1106
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1107
+ t8 = /* @__PURE__ */ jsx(ChevronRightIcon, {});
1108
+ $[9] = t8;
1109
+ } else t8 = $[9];
1110
+ let t9;
1111
+ if ($[10] !== t6 || $[11] !== t7) {
1112
+ t9 = /* @__PURE__ */ jsx(IconButton, {
1113
+ label: "Forward",
1114
+ variant: "ghost",
1115
+ color: "neutral",
1116
+ disabled: t6,
1117
+ onClick: t7,
1118
+ children: t8
1119
+ });
1120
+ $[10] = t6;
1121
+ $[11] = t7;
1122
+ $[12] = t9;
1123
+ } else t9 = $[12];
1124
+ let t10;
1125
+ if ($[13] !== t5 || $[14] !== t9) {
1126
+ t10 = /* @__PURE__ */ jsxs("div", {
1127
+ className: "computer-finder-capsule",
1128
+ role: "group",
1129
+ "aria-label": "Folder history",
1130
+ children: [t5, t9]
1131
+ });
1132
+ $[13] = t5;
1133
+ $[14] = t9;
1134
+ $[15] = t10;
1135
+ } else t10 = $[15];
1136
+ let t11;
1137
+ if ($[16] !== screen.file || $[17] !== screen.location || $[18] !== screen.titles) {
1138
+ t11 = screen.file ? workspaceBasename(screen.file) : folderName(screen.location, screen.titles);
1139
+ $[16] = screen.file;
1140
+ $[17] = screen.location;
1141
+ $[18] = screen.titles;
1142
+ $[19] = t11;
1143
+ } else t11 = $[19];
1144
+ let t12;
1145
+ if ($[20] !== t11) {
1146
+ t12 = /* @__PURE__ */ jsx("span", {
1147
+ className: "computer-finder-toolbar__title",
1148
+ children: t11
1149
+ });
1150
+ $[20] = t11;
1151
+ $[21] = t12;
1152
+ } else t12 = $[21];
1153
+ let t13;
1154
+ if ($[22] !== layout || $[23] !== onLayoutChange || $[24] !== onSortChange || $[25] !== screen.file || $[26] !== screen.workspace || $[27] !== sort) {
1155
+ t13 = screen.file ? screen.workspace.selectedFile?.path === screen.file && screen.workspace.selectedFile.info ? /* @__PURE__ */ jsx(WorkspaceFileDetails, { file: screen.workspace.selectedFile.info }) : null : /* @__PURE__ */ jsx(FinderViewControls, {
1156
+ layout,
1157
+ onLayoutChange,
1158
+ sort,
1159
+ onSortChange
1160
+ });
1161
+ $[22] = layout;
1162
+ $[23] = onLayoutChange;
1163
+ $[24] = onSortChange;
1164
+ $[25] = screen.file;
1165
+ $[26] = screen.workspace;
1166
+ $[27] = sort;
1167
+ $[28] = t13;
1168
+ } else t13 = $[28];
1169
+ let t14;
1170
+ if ($[29] !== t13) {
1171
+ t14 = /* @__PURE__ */ jsx("span", {
1172
+ className: "computer-finder-toolbar__views",
1173
+ children: t13
1174
+ });
1175
+ $[29] = t13;
1176
+ $[30] = t14;
1177
+ } else t14 = $[30];
1178
+ let t15;
1179
+ if ($[31] !== markdown || $[32] !== onViewChange || $[33] !== view) {
1180
+ t15 = markdown ? /* @__PURE__ */ jsx(IconButton, {
1181
+ label: view === "preview" ? "View Markdown source" : "Preview Markdown",
1182
+ variant: "ghost",
1183
+ color: "neutral",
1184
+ onClick: () => onViewChange(view === "preview" ? "source" : "preview"),
1185
+ children: view === "preview" ? /* @__PURE__ */ jsx(CodeIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {})
1186
+ }) : null;
1187
+ $[31] = markdown;
1188
+ $[32] = onViewChange;
1189
+ $[33] = view;
1190
+ $[34] = t15;
1191
+ } else t15 = $[34];
1192
+ let t16;
1193
+ if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
1194
+ t16 = /* @__PURE__ */ jsx(RefreshIcon, {});
1195
+ $[35] = t16;
1196
+ } else t16 = $[35];
1197
+ let t17;
1198
+ if ($[36] !== isRefreshing || $[37] !== onRefresh) {
1199
+ t17 = /* @__PURE__ */ jsx(IconButton, {
1200
+ label: "Reload",
1201
+ variant: "ghost",
1202
+ color: "neutral",
1203
+ disabled: isRefreshing,
1204
+ onClick: onRefresh,
1205
+ children: t16
1206
+ });
1207
+ $[36] = isRefreshing;
1208
+ $[37] = onRefresh;
1209
+ $[38] = t17;
1210
+ } else t17 = $[38];
1211
+ let t18;
1212
+ if ($[39] !== t14 || $[40] !== t15 || $[41] !== t17) {
1213
+ t18 = /* @__PURE__ */ jsxs("div", {
1214
+ className: "computer-finder-capsule",
1215
+ role: "group",
1216
+ "aria-label": "Folder actions",
1217
+ children: [
1218
+ t14,
1219
+ t15,
1220
+ t17
1221
+ ]
1222
+ });
1223
+ $[39] = t14;
1224
+ $[40] = t15;
1225
+ $[41] = t17;
1226
+ $[42] = t18;
1227
+ } else t18 = $[42];
1228
+ let t19;
1229
+ if ($[43] !== filter || $[44] !== onFilterChange || $[45] !== searchRef) {
1230
+ t19 = filter === null ? null : /* @__PURE__ */ jsxs(SearchField.Root, {
1231
+ variant: "toolbar",
1232
+ className: "computer-finder-search",
1233
+ name: "finder-search",
1234
+ children: [/* @__PURE__ */ jsx(SearchField.Label, {
1235
+ className: "sigvelo-visually-hidden",
1236
+ children: "Search files"
1237
+ }), /* @__PURE__ */ jsx(SearchField.Control, {
1238
+ ref: searchRef,
1239
+ value: filter,
1240
+ placeholder: "Search",
1241
+ autoComplete: "off",
1242
+ onChange: (event) => onFilterChange(event.currentTarget.value)
1243
+ })]
1244
+ });
1245
+ $[43] = filter;
1246
+ $[44] = onFilterChange;
1247
+ $[45] = searchRef;
1248
+ $[46] = t19;
1249
+ } else t19 = $[46];
1250
+ let t20;
1251
+ if ($[47] !== actions || $[48] !== t10 || $[49] !== t12 || $[50] !== t18 || $[51] !== t19) {
1252
+ t20 = /* @__PURE__ */ jsxs("div", {
1253
+ className: "computer-finder-toolbar",
1254
+ children: [
1255
+ t1,
1256
+ t10,
1257
+ t12,
1258
+ t18,
1259
+ actions,
1260
+ t19
1261
+ ]
1262
+ });
1263
+ $[47] = actions;
1264
+ $[48] = t10;
1265
+ $[49] = t12;
1266
+ $[50] = t18;
1267
+ $[51] = t19;
1268
+ $[52] = t20;
1269
+ } else t20 = $[52];
1270
+ return t20;
1271
+ }
1272
+ const FOLDER_VIEW = {
1273
+ layout: "list",
1274
+ sort: {
1275
+ by: "name",
1276
+ direction: "ascending"
1277
+ }
1278
+ };
1279
+ const RECENTS_VIEW = {
1280
+ layout: "list",
1281
+ sort: {
1282
+ by: "modified",
1283
+ direction: "descending"
1284
+ }
1285
+ };
1286
+ /** `path` and each folder above it, nearest first. */
1287
+ function folderLineage(path) {
1288
+ const lineage = [path];
1289
+ while (lineage.at(-1) !== "/") lineage.push(workspaceDirname(lineage.at(-1)));
1290
+ return lineage;
1291
+ }
1292
+ /**
1293
+ * The Files window: places rail beside the explorer. The window's own toolbar
1294
+ * carries the folder's controls, so the model holds the workspace, the list's
1295
+ * search, and which face of a Markdown file shows — the bar and the content
1296
+ * are separate subtrees of the same window.
1297
+ */
1298
+ function useFinderModel(host) {
1299
+ const $ = c(129);
1300
+ const { files, navigation, location, onLocation, onBack, onForward, projects, onOpenConversation, onStartConversation, views } = host;
1301
+ const { source, sourceKey } = files.home;
1302
+ const queryClient = useQueryClient();
1303
+ const places = finderPlaces(files.locations);
1304
+ let t0;
1305
+ if ($[0] !== navigation) {
1306
+ t0 = openFilePath(navigation);
1307
+ $[0] = navigation;
1308
+ $[1] = t0;
1309
+ } else t0 = $[1];
1310
+ const file = t0;
1311
+ const listing = file === null;
1312
+ const [filter, setFilter] = useState("");
1313
+ const [filterLocation, setFilterLocation] = useState(location);
1314
+ if (filterLocation !== location) {
1315
+ setFilterLocation(location);
1316
+ setFilter("");
1317
+ }
1318
+ let t1;
1319
+ if ($[2] !== filter) {
1320
+ t1 = filter.trim();
1321
+ $[2] = filter;
1322
+ $[3] = t1;
1323
+ } else t1 = $[3];
1324
+ const query = useDeferredValue(t1);
1325
+ const searching = listing && query !== "";
1326
+ const recents = location === RECENTS;
1327
+ const virtual = recents || searching;
1328
+ let t2;
1329
+ if ($[4] !== host.recent || $[5] !== host.search || $[6] !== source) {
1330
+ t2 = querySource(source, host.recent, host.search);
1331
+ $[4] = host.recent;
1332
+ $[5] = host.search;
1333
+ $[6] = source;
1334
+ $[7] = t2;
1335
+ } else t2 = $[7];
1336
+ const finderSource = t2;
1337
+ const t3 = file ? "/" : searching ? `${SEARCH}${encodeURIComponent(query)}` : location;
1338
+ let t4;
1339
+ if ($[8] !== file || $[9] !== finderSource || $[10] !== sourceKey || $[11] !== t3) {
1340
+ t4 = {
1341
+ source: finderSource,
1342
+ sourceKey,
1343
+ root: t3,
1344
+ selectedPath: file
1345
+ };
1346
+ $[8] = file;
1347
+ $[9] = finderSource;
1348
+ $[10] = sourceKey;
1349
+ $[11] = t3;
1350
+ $[12] = t4;
1351
+ } else t4 = $[12];
1352
+ const workspace = useWorkspace(t4);
1353
+ let t5;
1354
+ if ($[13] !== location || $[14] !== projects) {
1355
+ let t6;
1356
+ if ($[16] !== location) {
1357
+ t6 = (candidate) => workspaceDirname(candidate.path) === location;
1358
+ $[16] = location;
1359
+ $[17] = t6;
1360
+ } else t6 = $[17];
1361
+ t5 = projects.find(t6);
1362
+ $[13] = location;
1363
+ $[14] = projects;
1364
+ $[15] = t5;
1365
+ } else t5 = $[15];
1366
+ const project = t5;
1367
+ const titles = new Map([
1368
+ ["/", files.home.name],
1369
+ ...projects.map(_temp6),
1370
+ ...places.map(_temp7)
1371
+ ]);
1372
+ const readOnlyAt = (path) => places.some((place_0) => place_0.readOnly && isWithin(path, place_0.path));
1373
+ const lockedHere = readOnlyAt(location);
1374
+ const [view, setView] = useState("preview");
1375
+ let t6;
1376
+ if ($[18] !== location || $[19] !== recents || $[20] !== views) {
1377
+ t6 = () => (recents ? [location] : folderLineage(location)).map((folder) => views.get(folder)).find(Boolean) ?? (recents ? RECENTS_VIEW : FOLDER_VIEW);
1378
+ $[18] = location;
1379
+ $[19] = recents;
1380
+ $[20] = views;
1381
+ $[21] = t6;
1382
+ } else t6 = $[21];
1383
+ const folderView = useSyncExternalStore(views.subscribe, t6);
1384
+ const { layout, sort } = folderView;
1385
+ let t7;
1386
+ if ($[22] !== folderView || $[23] !== location || $[24] !== views) {
1387
+ t7 = (patch) => views.set(location, {
1388
+ ...folderView,
1389
+ ...patch
1390
+ });
1391
+ $[22] = folderView;
1392
+ $[23] = location;
1393
+ $[24] = views;
1394
+ $[25] = t7;
1395
+ } else t7 = $[25];
1396
+ const setFolderView = t7;
1397
+ let t8;
1398
+ if ($[26] !== setFolderView) {
1399
+ t8 = (next) => setFolderView({ layout: next });
1400
+ $[26] = setFolderView;
1401
+ $[27] = t8;
1402
+ } else t8 = $[27];
1403
+ const setLayout = t8;
1404
+ let t9;
1405
+ if ($[28] !== setFolderView) {
1406
+ t9 = (next_0) => setFolderView({ sort: next_0 });
1407
+ $[28] = setFolderView;
1408
+ $[29] = t9;
1409
+ } else t9 = $[29];
1410
+ const setSort = t9;
1411
+ const [newProjectOpen, setNewProjectOpen] = useState(false);
1412
+ const inTrash = location === WORKSPACE_TRASH;
1413
+ const actionsRef = useRef(null);
1414
+ const focusAfterMenu = useRef(false);
1415
+ const [exporting, setExporting] = useState(false);
1416
+ const [exportFeedback, setExportFeedback] = useState(null);
1417
+ const exportBusyRef = useRef(false);
1418
+ const inputRef = useRef(null);
1419
+ const searchRef = useRef(null);
1420
+ const focusSearchAfterMenu = useRef(false);
1421
+ const importFolder = virtual ? "/" : location;
1422
+ const importLocked = readOnlyAt(importFolder);
1423
+ let t10;
1424
+ if ($[30] !== files || $[31] !== onLocation || $[32] !== queryClient || $[33] !== source || $[34] !== sourceKey) {
1425
+ t10 = async function createProject(name, description) {
1426
+ const slug = projectSlug(name);
1427
+ if (!slug) throw new Error("Use at least one letter or number in the name.");
1428
+ const folderPath = `/projects/${slug}`;
1429
+ if (!await source.createFileIfAbsent(`${folderPath}/PROJECT.md`, new TextEncoder().encode(projectDocument(name, description)), "text/markdown")) throw new Error("A project with this name already exists. Choose another name.");
1430
+ await queryClient.invalidateQueries({ queryKey: ["workspace", sourceKey] });
1431
+ onLocation(folderPath);
1432
+ files.setStatus(`Created ${name} in Agent files.`);
1433
+ };
1434
+ $[30] = files;
1435
+ $[31] = onLocation;
1436
+ $[32] = queryClient;
1437
+ $[33] = source;
1438
+ $[34] = sourceKey;
1439
+ $[35] = t10;
1440
+ } else t10 = $[35];
1441
+ const createProject = t10;
1442
+ let t11;
1443
+ if ($[36] !== file || $[37] !== files || $[38] !== setExportFeedback || $[39] !== setExporting || $[40] !== source) {
1444
+ t11 = async function exportFile(mode) {
1445
+ if (!file || exportBusyRef.current) return;
1446
+ exportBusyRef.current = true;
1447
+ setExporting(true);
1448
+ setExportFeedback(null);
1449
+ files.setStatus(null);
1450
+ const path_0 = file;
1451
+ const message = await exportAs(source, path_0, mode);
1452
+ setExportFeedback({
1453
+ message,
1454
+ path: path_0
1455
+ });
1456
+ exportBusyRef.current = false;
1457
+ setExporting(false);
1458
+ };
1459
+ $[36] = file;
1460
+ $[37] = files;
1461
+ $[38] = setExportFeedback;
1462
+ $[39] = setExporting;
1463
+ $[40] = source;
1464
+ $[41] = t11;
1465
+ } else t11 = $[41];
1466
+ const exportFile = t11;
1467
+ let t12;
1468
+ if ($[42] !== files || $[43] !== readOnlyAt || $[44] !== source || $[45] !== sourceKey) {
1469
+ t12 = function dragAndDropAt(folder_0) {
1470
+ return readOnlyAt(folder_0) ? {
1471
+ source,
1472
+ sourceKey
1473
+ } : {
1474
+ source,
1475
+ sourceKey,
1476
+ onDrop: (drop, into, operation) => void files.drop(files.home, drop, into, operation)
1477
+ };
1478
+ };
1479
+ $[42] = files;
1480
+ $[43] = readOnlyAt;
1481
+ $[44] = source;
1482
+ $[45] = sourceKey;
1483
+ $[46] = t12;
1484
+ } else t12 = $[46];
1485
+ const dragAndDropAt = t12;
1486
+ let t13;
1487
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
1488
+ t13 = function perform(command) {
1489
+ focusAfterMenu.current = command === "rename" || command === "new-folder";
1490
+ actionsRef.current?.run(command);
1491
+ };
1492
+ $[47] = t13;
1493
+ } else t13 = $[47];
1494
+ const perform = t13;
1495
+ let t14;
1496
+ if ($[48] !== listing || $[49] !== virtual) {
1497
+ t14 = function fileItem(command_0, label, t15) {
1498
+ const disabled = t15 === void 0 ? false : t15;
1499
+ const shortcut = workspaceFileShortcut(command_0);
1500
+ return /* @__PURE__ */ jsxs(Menubar.Item, {
1501
+ disabled: disabled || !listing || virtual,
1502
+ "aria-keyshortcuts": shortcut?.aria,
1503
+ onClick: () => perform(command_0),
1504
+ children: [label, shortcut ? /* @__PURE__ */ jsx(Menubar.Shortcut, { children: shortcut.glyph }) : null]
1505
+ });
1506
+ };
1507
+ $[48] = listing;
1508
+ $[49] = virtual;
1509
+ $[50] = t14;
1510
+ } else t14 = $[50];
1511
+ const fileItem = t14;
1512
+ let t15;
1513
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
1514
+ t15 = function keepFieldFocus() {
1515
+ if (!focusAfterMenu.current) return true;
1516
+ focusAfterMenu.current = false;
1517
+ return false;
1518
+ };
1519
+ $[51] = t15;
1520
+ } else t15 = $[51];
1521
+ const keepFieldFocus = t15;
1522
+ let t16;
1523
+ if ($[52] !== files || $[53] !== importFolder) {
1524
+ t16 = async function importFiles(chosen) {
1525
+ if (chosen.length === 0) return;
1526
+ await files.drop(files.home, {
1527
+ kind: "files",
1528
+ items: chosen.map(_temp8)
1529
+ }, importFolder, "copy");
1530
+ if (inputRef.current) inputRef.current.value = "";
1531
+ };
1532
+ $[52] = files;
1533
+ $[53] = importFolder;
1534
+ $[54] = t16;
1535
+ } else t16 = $[54];
1536
+ const importFiles = t16;
1537
+ let t17;
1538
+ if ($[55] === Symbol.for("react.memo_cache_sentinel")) {
1539
+ t17 = function find() {
1540
+ searchRef.current?.focus();
1541
+ searchRef.current?.select();
1542
+ };
1543
+ $[55] = t17;
1544
+ } else t17 = $[55];
1545
+ const find = t17;
1546
+ let t18;
1547
+ if ($[56] !== onLocation || $[57] !== setFilter) {
1548
+ t18 = function goTo(path_1) {
1549
+ setFilter("");
1550
+ onLocation(path_1);
1551
+ };
1552
+ $[56] = onLocation;
1553
+ $[57] = setFilter;
1554
+ $[58] = t18;
1555
+ } else t18 = $[58];
1556
+ const goTo = t18;
1557
+ let t19;
1558
+ if ($[59] !== importFiles) {
1559
+ t19 = /* @__PURE__ */ jsx("input", {
1560
+ ref: inputRef,
1561
+ className: "sigvelo-visually-hidden",
1562
+ type: "file",
1563
+ multiple: true,
1564
+ tabIndex: -1,
1565
+ "aria-hidden": "true",
1566
+ onChange: (event) => void importFiles([...event.currentTarget.files ?? []])
1567
+ });
1568
+ $[59] = importFiles;
1569
+ $[60] = t19;
1570
+ } else t19 = $[60];
1571
+ let t20;
1572
+ if ($[61] !== createProject || $[62] !== newProjectOpen || $[63] !== setNewProjectOpen) {
1573
+ t20 = /* @__PURE__ */ jsx(NewProjectDialog, {
1574
+ open: newProjectOpen,
1575
+ onOpenChange: setNewProjectOpen,
1576
+ onCreate: createProject
1577
+ });
1578
+ $[61] = createProject;
1579
+ $[62] = newProjectOpen;
1580
+ $[63] = setNewProjectOpen;
1581
+ $[64] = t20;
1582
+ } else t20 = $[64];
1583
+ let t21;
1584
+ if ($[65] !== t19 || $[66] !== t20) {
1585
+ t21 = /* @__PURE__ */ jsxs(Fragment, { children: [t19, t20] });
1586
+ $[65] = t19;
1587
+ $[66] = t20;
1588
+ $[67] = t21;
1589
+ } else t21 = $[67];
1590
+ const dialogs = t21;
1591
+ const conversationId = project && listing ? project.conversationId : null;
1592
+ let t22;
1593
+ if ($[68] !== conversationId || $[69] !== onOpenConversation) {
1594
+ t22 = conversationId ? /* @__PURE__ */ jsx(IconButton, {
1595
+ label: "Resume conversation",
1596
+ variant: "ghost",
1597
+ color: "neutral",
1598
+ onClick: () => onOpenConversation(conversationId),
1599
+ children: /* @__PURE__ */ jsx(MessageSquareIcon, {})
1600
+ }) : null;
1601
+ $[68] = conversationId;
1602
+ $[69] = onOpenConversation;
1603
+ $[70] = t22;
1604
+ } else t22 = $[70];
1605
+ let t23;
1606
+ if ($[71] !== listing || $[72] !== onStartConversation || $[73] !== project) {
1607
+ t23 = project && listing ? /* @__PURE__ */ jsx(IconButton, {
1608
+ label: "Start conversation",
1609
+ variant: "ghost",
1610
+ color: "neutral",
1611
+ onClick: () => onStartConversation(project.path, project.name),
1612
+ children: /* @__PURE__ */ jsx(PencilIcon, {})
1613
+ }) : null;
1614
+ $[71] = listing;
1615
+ $[72] = onStartConversation;
1616
+ $[73] = project;
1617
+ $[74] = t23;
1618
+ } else t23 = $[74];
1619
+ let t24;
1620
+ if ($[75] !== exportFile || $[76] !== exporting || $[77] !== files.emptyTrash || $[78] !== files.transferring || $[79] !== files.trashFull || $[80] !== importLocked || $[81] !== inTrash || $[82] !== listing || $[83] !== setNewProjectOpen) {
1621
+ t24 = inTrash ? /* @__PURE__ */ jsx(Button, {
1622
+ variant: "ghost",
1623
+ color: "neutral",
1624
+ size: "sm",
1625
+ disabled: !files.trashFull,
1626
+ onClick: files.emptyTrash,
1627
+ children: "Empty"
1628
+ }) : listing ? /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, { render: /* @__PURE__ */ jsx(IconButton, {
1629
+ label: "File actions",
1630
+ variant: "ghost",
1631
+ color: "neutral",
1632
+ children: /* @__PURE__ */ jsx(EllipsisIcon, {})
1633
+ }) }), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
1634
+ align: "end",
1635
+ sideOffset: 4,
1636
+ children: /* @__PURE__ */ jsxs(Menu.Popup, { children: [/* @__PURE__ */ jsxs(Menu.Item, {
1637
+ onClick: () => setNewProjectOpen(true),
1638
+ children: [/* @__PURE__ */ jsx(PlusIcon, {}), " New project"]
1639
+ }), /* @__PURE__ */ jsxs(Menu.Item, {
1640
+ disabled: files.transferring || importLocked,
1641
+ onClick: () => inputRef.current?.click(),
1642
+ children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Import files…"]
1643
+ })] })
1644
+ }) })] }) : /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, { render: /* @__PURE__ */ jsx(IconButton, {
1645
+ label: "File actions",
1646
+ variant: "ghost",
1647
+ color: "neutral",
1648
+ children: /* @__PURE__ */ jsx(EllipsisIcon, {})
1649
+ }) }), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
1650
+ align: "end",
1651
+ sideOffset: 4,
1652
+ children: /* @__PURE__ */ jsxs(Menu.Popup, { children: [/* @__PURE__ */ jsxs(Menu.Item, {
1653
+ disabled: exporting,
1654
+ onClick: () => void exportFile("download"),
1655
+ children: [/* @__PURE__ */ jsx(DownloadIcon, {}), " Download"]
1656
+ }), /* @__PURE__ */ jsx(Menu.Item, {
1657
+ disabled: exporting,
1658
+ onClick: () => void exportFile("save-as"),
1659
+ children: "Save As…"
1660
+ })] })
1661
+ }) })] });
1662
+ $[75] = exportFile;
1663
+ $[76] = exporting;
1664
+ $[77] = files.emptyTrash;
1665
+ $[78] = files.transferring;
1666
+ $[79] = files.trashFull;
1667
+ $[80] = importLocked;
1668
+ $[81] = inTrash;
1669
+ $[82] = listing;
1670
+ $[83] = setNewProjectOpen;
1671
+ $[84] = t24;
1672
+ } else t24 = $[84];
1673
+ let t25;
1674
+ if ($[85] !== t22 || $[86] !== t23 || $[87] !== t24) {
1675
+ t25 = /* @__PURE__ */ jsxs("div", {
1676
+ className: "computer-finder-toolbar__actions",
1677
+ children: [
1678
+ t22,
1679
+ t23,
1680
+ t24
1681
+ ]
1682
+ });
1683
+ $[85] = t22;
1684
+ $[86] = t23;
1685
+ $[87] = t24;
1686
+ $[88] = t25;
1687
+ } else t25 = $[88];
1688
+ const toolbarActions = t25;
1689
+ let t26;
1690
+ if ($[89] !== files || $[90] !== filter || $[91] !== listing || $[92] !== setFilter) {
1691
+ t26 = (event_0) => {
1692
+ const command_1 = event_0.defaultPrevented ? null : workspaceFileCommandForKey(event_0.nativeEvent);
1693
+ if (command_1 === "undo" || command_1 === "redo") {
1694
+ if (!(command_1 === "undo" ? files.undoLabel : files.redoLabel)) return;
1695
+ event_0.preventDefault();
1696
+ files[command_1]();
1697
+ } else if ((event_0.ctrlKey || event_0.metaKey) && !event_0.altKey && !event_0.shiftKey && event_0.key.toLowerCase() === "f" && searchRef.current?.getClientRects().length) {
1698
+ event_0.preventDefault();
1699
+ find();
1700
+ } else if (event_0.key === "Escape" && listing && filter) {
1701
+ event_0.preventDefault();
1702
+ setFilter("");
1703
+ }
1704
+ };
1705
+ $[89] = files;
1706
+ $[90] = filter;
1707
+ $[91] = listing;
1708
+ $[92] = setFilter;
1709
+ $[93] = t26;
1710
+ } else t26 = $[93];
1711
+ let t27;
1712
+ if ($[94] !== files.emptyTrash || $[95] !== files.trashFull) {
1713
+ t27 = () => /* @__PURE__ */ jsxs(Menubar.Item, {
1714
+ disabled: !files.trashFull,
1715
+ "aria-keyshortcuts": workspaceFileShortcut("empty-trash")?.aria,
1716
+ onClick: files.emptyTrash,
1717
+ children: ["Empty Trash…", /* @__PURE__ */ jsx(Menubar.Shortcut, { children: workspaceFileShortcut("empty-trash")?.glyph })]
1718
+ });
1719
+ $[94] = files.emptyTrash;
1720
+ $[95] = files.trashFull;
1721
+ $[96] = t27;
1722
+ } else t27 = $[96];
1723
+ let t28;
1724
+ if ($[97] !== exportFile || $[98] !== exporting || $[99] !== file || $[100] !== fileItem || $[101] !== files.redo || $[102] !== files.redoLabel || $[103] !== files.transferring || $[104] !== files.undo || $[105] !== files.undoLabel || $[106] !== goTo || $[107] !== importLocked || $[108] !== inTrash || $[109] !== layout || $[110] !== listing || $[111] !== lockedHere || $[112] !== onBack || $[113] !== onForward || $[114] !== places || $[115] !== setLayout || $[116] !== setNewProjectOpen || $[117] !== setSort || $[118] !== setView || $[119] !== sort || $[120] !== view || $[121] !== workspace) {
1725
+ t28 = () => /* @__PURE__ */ jsxs(Fragment, { children: [
1726
+ /* @__PURE__ */ jsxs(Menubar.Menu, { children: [/* @__PURE__ */ jsx(Menubar.Trigger, { children: "File" }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
1727
+ align: "start",
1728
+ sideOffset: 4,
1729
+ children: /* @__PURE__ */ jsxs(Menubar.Popup, {
1730
+ finalFocus: keepFieldFocus,
1731
+ children: [
1732
+ fileItem("new-folder", "New Folder", inTrash || lockedHere),
1733
+ /* @__PURE__ */ jsx(Menubar.Item, {
1734
+ disabled: !listing,
1735
+ onClick: () => setNewProjectOpen(true),
1736
+ children: "New Project…"
1737
+ }),
1738
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1739
+ fileItem("open", "Open"),
1740
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1741
+ inTrash ? fileItem("put-back", "Put Back") : fileItem("trash", "Move to Trash"),
1742
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1743
+ fileItem("get-info", "Get Info"),
1744
+ fileItem("rename", "Rename", inTrash || lockedHere),
1745
+ fileItem("duplicate", "Duplicate", inTrash || lockedHere),
1746
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1747
+ /* @__PURE__ */ jsx(Menubar.Item, {
1748
+ disabled: !listing || files.transferring || importLocked,
1749
+ onClick: () => inputRef.current?.click(),
1750
+ children: "Import Files…"
1751
+ }),
1752
+ /* @__PURE__ */ jsx(Menubar.Item, {
1753
+ disabled: !file || exporting,
1754
+ onClick: () => void exportFile("save-as"),
1755
+ children: "Save As…"
1756
+ }),
1757
+ /* @__PURE__ */ jsx(Menubar.Item, {
1758
+ disabled: !file || exporting,
1759
+ onClick: () => void exportFile("download"),
1760
+ children: "Download"
1761
+ })
1762
+ ]
1763
+ })
1764
+ }) })] }),
1765
+ /* @__PURE__ */ jsxs(Menubar.Menu, { children: [/* @__PURE__ */ jsx(Menubar.Trigger, { children: "Edit" }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
1766
+ align: "start",
1767
+ sideOffset: 4,
1768
+ children: /* @__PURE__ */ jsxs(Menubar.Popup, {
1769
+ finalFocus: () => {
1770
+ if (!focusSearchAfterMenu.current) return true;
1771
+ focusSearchAfterMenu.current = false;
1772
+ return searchRef.current ?? true;
1773
+ },
1774
+ children: [
1775
+ /* @__PURE__ */ jsxs(Menubar.Item, {
1776
+ disabled: !files.undoLabel,
1777
+ "aria-keyshortcuts": workspaceFileShortcut("undo")?.aria,
1778
+ onClick: files.undo,
1779
+ children: [files.undoLabel ? `Undo ${files.undoLabel}` : "Undo", /* @__PURE__ */ jsx(Menubar.Shortcut, { children: workspaceFileShortcut("undo")?.glyph })]
1780
+ }),
1781
+ /* @__PURE__ */ jsxs(Menubar.Item, {
1782
+ disabled: !files.redoLabel,
1783
+ "aria-keyshortcuts": workspaceFileShortcut("redo")?.aria,
1784
+ onClick: files.redo,
1785
+ children: [files.redoLabel ? `Redo ${files.redoLabel}` : "Redo", /* @__PURE__ */ jsx(Menubar.Shortcut, { children: workspaceFileShortcut("redo")?.glyph })]
1786
+ }),
1787
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1788
+ fileItem("cut", "Cut", lockedHere),
1789
+ fileItem("copy", "Copy"),
1790
+ fileItem("paste", "Paste", inTrash || lockedHere),
1791
+ fileItem("move-here", "Move Item Here", inTrash || lockedHere),
1792
+ fileItem("select-all", "Select All"),
1793
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1794
+ /* @__PURE__ */ jsxs(Menubar.Item, {
1795
+ disabled: !listing,
1796
+ onClick: () => {
1797
+ focusSearchAfterMenu.current = true;
1798
+ },
1799
+ "aria-keyshortcuts": "Control+F Meta+F",
1800
+ children: ["Find in folder ", /* @__PURE__ */ jsx(Menubar.Shortcut, { children: "⌘F" })]
1801
+ })
1802
+ ]
1803
+ })
1804
+ }) })] }),
1805
+ /* @__PURE__ */ jsxs(Menubar.Menu, { children: [/* @__PURE__ */ jsx(Menubar.Trigger, { children: "View" }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
1806
+ align: "start",
1807
+ sideOffset: 4,
1808
+ children: /* @__PURE__ */ jsxs(Menubar.Popup, { children: [
1809
+ /* @__PURE__ */ jsxs(Menubar.RadioGroup, {
1810
+ value: layout,
1811
+ onValueChange: (next_1) => setLayout(next_1),
1812
+ children: [/* @__PURE__ */ jsxs(Menubar.RadioItem, {
1813
+ value: "grid",
1814
+ disabled: !listing,
1815
+ closeOnClick: true,
1816
+ children: [/* @__PURE__ */ jsx(Menubar.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }), "as Icons"]
1817
+ }), /* @__PURE__ */ jsxs(Menubar.RadioItem, {
1818
+ value: "list",
1819
+ disabled: !listing,
1820
+ closeOnClick: true,
1821
+ children: [/* @__PURE__ */ jsx(Menubar.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }), "as List"]
1822
+ })]
1823
+ }),
1824
+ /* @__PURE__ */ jsxs(Menubar.SubmenuRoot, { children: [/* @__PURE__ */ jsx(Menubar.SubmenuTrigger, {
1825
+ disabled: !listing,
1826
+ children: "Sort By"
1827
+ }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
1828
+ align: "start",
1829
+ side: "right",
1830
+ sideOffset: 0,
1831
+ children: /* @__PURE__ */ jsxs(Menubar.Popup, { children: [
1832
+ /* @__PURE__ */ jsx(Menubar.RadioGroup, {
1833
+ value: sort.by,
1834
+ onValueChange: (by) => setSort({
1835
+ ...sort,
1836
+ by
1837
+ }),
1838
+ children: SORT_KEYS.map(_temp9)
1839
+ }),
1840
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1841
+ /* @__PURE__ */ jsxs(Menubar.CheckboxItem, {
1842
+ checked: sort.direction === "descending",
1843
+ onCheckedChange: (checked) => setSort({
1844
+ ...sort,
1845
+ direction: checked ? "descending" : "ascending"
1846
+ }),
1847
+ closeOnClick: true,
1848
+ children: [/* @__PURE__ */ jsx(Menubar.CheckboxItemIndicator, {}), "Descending"]
1849
+ })
1850
+ ] })
1851
+ }) })] }),
1852
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1853
+ /* @__PURE__ */ jsx(Menubar.Item, {
1854
+ disabled: workspace.isLoading,
1855
+ onClick: workspace.refresh,
1856
+ children: "Reload"
1857
+ }),
1858
+ file?.endsWith(".md") ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Menubar.Separator, {}), /* @__PURE__ */ jsxs(Menubar.RadioGroup, {
1859
+ value: view,
1860
+ onValueChange: (next_2) => setView(next_2),
1861
+ children: [/* @__PURE__ */ jsxs(Menubar.RadioItem, {
1862
+ value: "preview",
1863
+ closeOnClick: true,
1864
+ children: [/* @__PURE__ */ jsx(Menubar.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }), "Preview Markdown"]
1865
+ }), /* @__PURE__ */ jsxs(Menubar.RadioItem, {
1866
+ value: "source",
1867
+ closeOnClick: true,
1868
+ children: [/* @__PURE__ */ jsx(Menubar.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }), "Markdown source"]
1869
+ })]
1870
+ })] }) : null
1871
+ ] })
1872
+ }) })] }),
1873
+ /* @__PURE__ */ jsxs(Menubar.Menu, { children: [/* @__PURE__ */ jsx(Menubar.Trigger, { children: "Go" }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
1874
+ align: "start",
1875
+ sideOffset: 4,
1876
+ children: /* @__PURE__ */ jsxs(Menubar.Popup, { children: [
1877
+ /* @__PURE__ */ jsx(Menubar.Item, {
1878
+ disabled: !onBack,
1879
+ onClick: () => onBack?.(),
1880
+ children: "Back"
1881
+ }),
1882
+ /* @__PURE__ */ jsx(Menubar.Item, {
1883
+ disabled: !onForward,
1884
+ onClick: () => onForward?.(),
1885
+ children: "Forward"
1886
+ }),
1887
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1888
+ places.map((place_1) => /* @__PURE__ */ jsx(Menubar.Item, {
1889
+ onClick: () => goTo(place_1.path),
1890
+ children: place_1.label
1891
+ }, place_1.id))
1892
+ ] })
1893
+ }) })] })
1894
+ ] });
1895
+ $[97] = exportFile;
1896
+ $[98] = exporting;
1897
+ $[99] = file;
1898
+ $[100] = fileItem;
1899
+ $[101] = files.redo;
1900
+ $[102] = files.redoLabel;
1901
+ $[103] = files.transferring;
1902
+ $[104] = files.undo;
1903
+ $[105] = files.undoLabel;
1904
+ $[106] = goTo;
1905
+ $[107] = importLocked;
1906
+ $[108] = inTrash;
1907
+ $[109] = layout;
1908
+ $[110] = listing;
1909
+ $[111] = lockedHere;
1910
+ $[112] = onBack;
1911
+ $[113] = onForward;
1912
+ $[114] = places;
1913
+ $[115] = setLayout;
1914
+ $[116] = setNewProjectOpen;
1915
+ $[117] = setSort;
1916
+ $[118] = setView;
1917
+ $[119] = sort;
1918
+ $[120] = view;
1919
+ $[121] = workspace;
1920
+ $[122] = t28;
1921
+ } else t28 = $[122];
1922
+ const t29 = (t30) => {
1923
+ const { phone } = t30;
1924
+ return phone ? null : /* @__PURE__ */ jsx(ComputerFinderToolbar, {
1925
+ screen: {
1926
+ key: location,
1927
+ location,
1928
+ file,
1929
+ workspace,
1930
+ titles
1931
+ },
1932
+ layout,
1933
+ onLayoutChange: setLayout,
1934
+ sort,
1935
+ onSortChange: setSort,
1936
+ onBack,
1937
+ onForward,
1938
+ searchRef,
1939
+ filter: listing ? filter : null,
1940
+ onFilterChange: setFilter,
1941
+ markdown: file?.endsWith(".md") ?? false,
1942
+ view,
1943
+ onViewChange: setView,
1944
+ isRefreshing: workspace.isLoading,
1945
+ onRefresh: workspace.refresh,
1946
+ actions: toolbarActions
1947
+ });
1948
+ };
1949
+ const t31 = (t32) => {
1950
+ const { phone: phone_0 } = t32;
1951
+ return /* @__PURE__ */ jsx(ComputerFinder, {
1952
+ workspace,
1953
+ source: finderSource,
1954
+ sourceKey,
1955
+ navigation,
1956
+ location,
1957
+ onLocation: goTo,
1958
+ filter,
1959
+ onFilterChange: setFilter,
1960
+ view,
1961
+ onViewChange: setView,
1962
+ renderThumbnail: host.renderThumbnail,
1963
+ renderUnsupported: host.renderUnsupported ?? NO_UNSUPPORTED,
1964
+ layout,
1965
+ onLayoutChange: setLayout,
1966
+ sort,
1967
+ onSortChange: setSort,
1968
+ phone: phone_0,
1969
+ locations: places,
1970
+ projects,
1971
+ titles,
1972
+ toolbarActions,
1973
+ dialogs,
1974
+ status: /* @__PURE__ */ jsx(FinderTransferStatus, {
1975
+ message: files.status ?? (exportFeedback?.path === file ? exportFeedback.message : null),
1976
+ transferring: files.transferring,
1977
+ onCancel: files.cancelTransfer
1978
+ }),
1979
+ dragAndDrop: listing && !virtual ? dragAndDropAt(location) : void 0,
1980
+ commands: listing && !virtual ? files.commands(files.home, "browser") : void 0,
1981
+ actionsRef,
1982
+ railDragAndDrop: (directory) => directory === "/.Recents" || readOnlyAt(directory) ? void 0 : dragAndDropAt(directory)
1983
+ });
1984
+ };
1985
+ let t33;
1986
+ if ($[123] !== t26 || $[124] !== t27 || $[125] !== t28 || $[126] !== t29 || $[127] !== t31) {
1987
+ t33 = {
1988
+ onKeyDown: t26,
1989
+ renderAppMenu: t27,
1990
+ renderMenus: t28,
1991
+ renderTitle: t29,
1992
+ render: t31
1993
+ };
1994
+ $[123] = t26;
1995
+ $[124] = t27;
1996
+ $[125] = t28;
1997
+ $[126] = t29;
1998
+ $[127] = t31;
1999
+ $[128] = t33;
2000
+ } else t33 = $[128];
2001
+ return t33;
2002
+ }
2003
+ function _temp9(t0) {
2004
+ const [by_0, label_0] = t0;
2005
+ return /* @__PURE__ */ jsxs(Menubar.RadioItem, {
2006
+ value: by_0,
2007
+ closeOnClick: true,
2008
+ children: [/* @__PURE__ */ jsx(Menubar.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }), label_0]
2009
+ }, by_0);
2010
+ }
2011
+ function _temp8(file_0) {
2012
+ return {
2013
+ kind: "file",
2014
+ name: file_0.name,
2015
+ file: file_0
2016
+ };
2017
+ }
2018
+ function _temp7(place) {
2019
+ return [place.path, place.label];
2020
+ }
2021
+ function _temp6(candidate_0) {
2022
+ return [workspaceDirname(candidate_0.path), candidate_0.name];
2023
+ }
2024
+ //#endregion
2025
+ //#region src/components/_internal/computer-files/files.tsx
2026
+ const FILES_APP_ID = "files";
2027
+ const FILES_ICON = computerAppTile(/* @__PURE__ */ jsx(AppIcon.Image, {
2028
+ src: desktopArtwork.folder,
2029
+ alt: ""
2030
+ }));
2031
+ /** Every Get Info window's subject, by window id, for the panel to read. */
2032
+ const InfoPanels = React.createContext({});
2033
+ /** What Get Info lists for `path`, or null once it is gone. */
2034
+ async function readInfo(volume, path) {
2035
+ const entry = await volume.source.stat(path);
2036
+ if (!entry) return null;
2037
+ const folders = workspaceDirname(path).split("/").filter(Boolean);
2038
+ const inTrash = isInWorkspaceTrash(path) && !volume.linked;
2039
+ const where = path === "/" ? "" : inTrash ? "Trash" : [volume.name, ...folders].join(" › ");
2040
+ const items = entry.type === "directory" ? (await volume.source.readDir(path)).filter((child) => !isHiddenWorkspaceEntry(child)).length : null;
2041
+ return {
2042
+ entry: path === "/" ? {
2043
+ ...entry,
2044
+ name: volume.name
2045
+ } : entry,
2046
+ where,
2047
+ items
2048
+ };
2049
+ }
2050
+ /** A Get Info window: the file's facts, read again whenever its volume changes. */
2051
+ function InfoPanel() {
2052
+ const $ = c(11);
2053
+ const { id } = useAgentComputerWindow();
2054
+ const { volume, path } = React.use(InfoPanels)[id];
2055
+ let t0;
2056
+ if ($[0] !== path || $[1] !== volume.sourceKey) {
2057
+ t0 = [...workspaceInfoQueryKey(volume.sourceKey, "/"), path];
2058
+ $[0] = path;
2059
+ $[1] = volume.sourceKey;
2060
+ $[2] = t0;
2061
+ } else t0 = $[2];
2062
+ let t1;
2063
+ if ($[3] !== path || $[4] !== volume) {
2064
+ t1 = () => readInfo(volume, path);
2065
+ $[3] = path;
2066
+ $[4] = volume;
2067
+ $[5] = t1;
2068
+ } else t1 = $[5];
2069
+ let t2;
2070
+ if ($[6] !== t0 || $[7] !== t1) {
2071
+ t2 = {
2072
+ queryKey: t0,
2073
+ queryFn: t1
2074
+ };
2075
+ $[6] = t0;
2076
+ $[7] = t1;
2077
+ $[8] = t2;
2078
+ } else t2 = $[8];
2079
+ const { data: info, isPending } = useQuery(t2);
2080
+ if (isPending) return null;
2081
+ let t3;
2082
+ if ($[9] !== info) {
2083
+ t3 = info ? /* @__PURE__ */ jsx("div", {
2084
+ className: "computer-info",
2085
+ children: /* @__PURE__ */ jsx(WorkspaceFileFacts, {
2086
+ file: info.entry,
2087
+ place: info
2088
+ })
2089
+ }) : /* @__PURE__ */ jsx(EmptyState, { description: "This item is no longer available." });
2090
+ $[9] = info;
2091
+ $[10] = t3;
2092
+ } else t3 = $[10];
2093
+ return t3;
2094
+ }
2095
+ /** Finder's Get Info window for one item: a panel of Files, fixed in size. */
2096
+ function infoApp(id, { volume, path }) {
2097
+ return {
2098
+ id,
2099
+ label: `${path === "/" ? volume.name : workspaceBasename(path)} Info`,
2100
+ icon: FILES_ICON,
2101
+ owner: FILES_APP_ID,
2102
+ panel: true,
2103
+ defaultWindowSize: {
2104
+ width: 320,
2105
+ height: 380
2106
+ },
2107
+ Content: InfoPanel
2108
+ };
2109
+ }
2110
+ /**
2111
+ * One computer's files: the design system's file commands over the home
2112
+ * volume and its locations, Get Info as computer windows, and the status line
2113
+ * every Finder window shows.
2114
+ */
2115
+ function useComputerFiles(t0) {
2116
+ const $ = c(25);
2117
+ const { volume: home, locations, openFolder, openApp } = t0;
2118
+ const [status, setStatus] = React.useState(null);
2119
+ let t1;
2120
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2121
+ t1 = {};
2122
+ $[0] = t1;
2123
+ } else t1 = $[0];
2124
+ const [infoPanels, setInfoPanels] = React.useState(t1);
2125
+ let t2;
2126
+ if ($[1] !== infoPanels) {
2127
+ t2 = Object.entries(infoPanels).map(_temp);
2128
+ $[1] = infoPanels;
2129
+ $[2] = t2;
2130
+ } else t2 = $[2];
2131
+ const infoApps = t2;
2132
+ let t3;
2133
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2134
+ t3 = [];
2135
+ $[3] = t3;
2136
+ } else t3 = $[3];
2137
+ const opening = React.useRef(t3);
2138
+ let t4;
2139
+ if ($[4] !== openApp) {
2140
+ t4 = () => {
2141
+ const ids = opening.current;
2142
+ opening.current = [];
2143
+ for (const id_0 of ids) openApp?.(id_0);
2144
+ };
2145
+ $[4] = openApp;
2146
+ $[5] = t4;
2147
+ } else t4 = $[5];
2148
+ let t5;
2149
+ if ($[6] !== infoPanels || $[7] !== openApp) {
2150
+ t5 = [infoPanels, openApp];
2151
+ $[6] = infoPanels;
2152
+ $[7] = openApp;
2153
+ $[8] = t5;
2154
+ } else t5 = $[8];
2155
+ React.useLayoutEffect(t4, t5);
2156
+ let t6;
2157
+ if ($[9] !== infoPanels || $[10] !== openApp) {
2158
+ t6 = function getInfo(volume, paths) {
2159
+ const known = Object.entries(infoPanels);
2160
+ const added = {};
2161
+ const ids_0 = paths.map((path) => {
2162
+ const open = known.find((t7) => {
2163
+ const [, subject_0] = t7;
2164
+ return subject_0.volume.sourceKey === volume.sourceKey && subject_0.path === path;
2165
+ });
2166
+ if (open) return open[0];
2167
+ const id_1 = `info:${known.length + Object.keys(added).length + 1}`;
2168
+ added[id_1] = {
2169
+ volume,
2170
+ path
2171
+ };
2172
+ return id_1;
2173
+ });
2174
+ if (!Object.keys(added).length) {
2175
+ for (const id_2 of ids_0) openApp?.(id_2);
2176
+ return;
2177
+ }
2178
+ opening.current = ids_0;
2179
+ setInfoPanels((current) => ({
2180
+ ...current,
2181
+ ...added
2182
+ }));
2183
+ };
2184
+ $[9] = infoPanels;
2185
+ $[10] = openApp;
2186
+ $[11] = t6;
2187
+ } else t6 = $[11];
2188
+ const getInfo = t6;
2189
+ let t7;
2190
+ if ($[12] !== locations) {
2191
+ t7 = locations.filter(_temp2).map(_temp3);
2192
+ $[12] = locations;
2193
+ $[13] = t7;
2194
+ } else t7 = $[13];
2195
+ const t8 = openApp ? getInfo : void 0;
2196
+ let t9;
2197
+ if ($[14] !== home || $[15] !== openFolder || $[16] !== t7 || $[17] !== t8) {
2198
+ t9 = {
2199
+ home,
2200
+ readOnly: t7,
2201
+ openFolder,
2202
+ getInfo: t8,
2203
+ onStatus: setStatus
2204
+ };
2205
+ $[14] = home;
2206
+ $[15] = openFolder;
2207
+ $[16] = t7;
2208
+ $[17] = t8;
2209
+ $[18] = t9;
2210
+ } else t9 = $[18];
2211
+ const files = useWorkspaceFileCommands(t9);
2212
+ let t10;
2213
+ if ($[19] !== files || $[20] !== infoApps || $[21] !== infoPanels || $[22] !== locations || $[23] !== status) {
2214
+ t10 = {
2215
+ ...files,
2216
+ locations,
2217
+ status,
2218
+ setStatus,
2219
+ infoApps,
2220
+ infoPanels
2221
+ };
2222
+ $[19] = files;
2223
+ $[20] = infoApps;
2224
+ $[21] = infoPanels;
2225
+ $[22] = locations;
2226
+ $[23] = status;
2227
+ $[24] = t10;
2228
+ } else t10 = $[24];
2229
+ return t10;
2230
+ }
2231
+ function _temp3(location_0) {
2232
+ return location_0.path;
2233
+ }
2234
+ function _temp2(location) {
2235
+ return location.readOnly;
2236
+ }
2237
+ function _temp(t0) {
2238
+ const [id, subject] = t0;
2239
+ return infoApp(id, subject);
2240
+ }
2241
+ //#endregion
2242
+ //#region src/components/agents-sdk/ComputerFiles.tsx
2243
+ const HostContext = React.createContext(null);
2244
+ const ModelContext = React.createContext(null);
2245
+ function useHost() {
2246
+ const host = React.use(HostContext);
2247
+ if (!host) throw new Error("ComputerFiles.app needs a ComputerFiles.Host above the computer.");
2248
+ return host;
2249
+ }
2250
+ /** Supplies the Files app, its Get Info windows and its previews with the host's files. */
2251
+ function Host(t0) {
2252
+ const $ = c(6);
2253
+ const { value, children } = t0;
2254
+ let t1;
2255
+ if ($[0] !== children || $[1] !== value.files.infoPanels) {
2256
+ t1 = /* @__PURE__ */ jsx(InfoPanels, {
2257
+ value: value.files.infoPanels,
2258
+ children
2259
+ });
2260
+ $[0] = children;
2261
+ $[1] = value.files.infoPanels;
2262
+ $[2] = t1;
2263
+ } else t1 = $[2];
2264
+ let t2;
2265
+ if ($[3] !== t1 || $[4] !== value) {
2266
+ t2 = /* @__PURE__ */ jsx(HostContext, {
2267
+ value,
2268
+ children: t1
2269
+ });
2270
+ $[3] = t1;
2271
+ $[4] = value;
2272
+ $[5] = t2;
2273
+ } else t2 = $[5];
2274
+ return t2;
2275
+ }
2276
+ function Provider(t0) {
2277
+ const $ = c(5);
2278
+ const { children } = t0;
2279
+ const model = useFinderModel(useHost());
2280
+ let t1;
2281
+ if ($[0] !== model.onKeyDown) {
2282
+ t1 = { onKeyDown: model.onKeyDown };
2283
+ $[0] = model.onKeyDown;
2284
+ $[1] = t1;
2285
+ } else t1 = $[1];
2286
+ useAgentComputerAppHandlers(t1);
2287
+ let t2;
2288
+ if ($[2] !== children || $[3] !== model) {
2289
+ t2 = /* @__PURE__ */ jsx(ModelContext, {
2290
+ value: model,
2291
+ children
2292
+ });
2293
+ $[2] = children;
2294
+ $[3] = model;
2295
+ $[4] = t2;
2296
+ } else t2 = $[4];
2297
+ return t2;
2298
+ }
2299
+ function useModel() {
2300
+ const $ = c(5);
2301
+ const t0 = React.use(ModelContext);
2302
+ const t1 = useAgentComputerWindow();
2303
+ let t2;
2304
+ if ($[0] !== t1.phone) {
2305
+ t2 = { phone: t1.phone };
2306
+ $[0] = t1.phone;
2307
+ $[1] = t2;
2308
+ } else t2 = $[1];
2309
+ let t3;
2310
+ if ($[2] !== t0 || $[3] !== t2) {
2311
+ t3 = [t0, t2];
2312
+ $[2] = t0;
2313
+ $[3] = t2;
2314
+ $[4] = t3;
2315
+ } else t3 = $[4];
2316
+ return t3;
2317
+ }
2318
+ function Title() {
2319
+ const $ = c(3);
2320
+ const [model, state] = useModel();
2321
+ let t0;
2322
+ if ($[0] !== model || $[1] !== state) {
2323
+ t0 = model.renderTitle(state);
2324
+ $[0] = model;
2325
+ $[1] = state;
2326
+ $[2] = t0;
2327
+ } else t0 = $[2];
2328
+ return t0;
2329
+ }
2330
+ function AppMenu() {
2331
+ return React.use(ModelContext).renderAppMenu();
2332
+ }
2333
+ function Menus() {
2334
+ return React.use(ModelContext).renderMenus();
2335
+ }
2336
+ function Content() {
2337
+ const $ = c(3);
2338
+ const [model, state] = useModel();
2339
+ let t0;
2340
+ if ($[0] !== model || $[1] !== state) {
2341
+ t0 = model.render(state);
2342
+ $[0] = model;
2343
+ $[1] = state;
2344
+ $[2] = t0;
2345
+ } else t0 = $[2];
2346
+ return t0;
2347
+ }
2348
+ /** What a desktop icon opens into, as Quick Look shows it: a folder's contents, or the file. */
2349
+ function Preview(t0) {
2350
+ const $ = c(5);
2351
+ const { entry } = t0;
2352
+ const { files, renderUnsupported } = useHost();
2353
+ let t1;
2354
+ if ($[0] !== entry || $[1] !== files.home.source || $[2] !== files.home.sourceKey || $[3] !== renderUnsupported) {
2355
+ t1 = /* @__PURE__ */ jsx(ComputerFilesPreview, {
2356
+ entry,
2357
+ source: files.home.source,
2358
+ sourceKey: files.home.sourceKey,
2359
+ renderUnsupported
2360
+ });
2361
+ $[0] = entry;
2362
+ $[1] = files.home.source;
2363
+ $[2] = files.home.sourceKey;
2364
+ $[3] = renderUnsupported;
2365
+ $[4] = t1;
2366
+ } else t1 = $[4];
2367
+ return t1;
2368
+ }
2369
+ /**
2370
+ * Finder for an agent's workspace, as an `AgentComputer` app. The host keeps
2371
+ * one `useFiles` per computer — its clipboard, Undo and Trash are the
2372
+ * desktop's too — and hands it, with the address and the queries the Finder
2373
+ * reads, to `Host` above the computer. Get Info windows are `useFiles`'s
2374
+ * `infoApps`, listed beside `app`.
2375
+ *
2376
+ * ```tsx
2377
+ * const files = ComputerFiles.useFiles({ volume, locations, openFolder, openApp });
2378
+ * <ComputerFiles.Host value={{ files, recent, search, ...address, ... }}>
2379
+ * <AgentComputer apps={[ComputerFiles.app, ...files.infoApps]} … />
2380
+ * </ComputerFiles.Host>
2381
+ * ```
2382
+ */
2383
+ const ComputerFiles = {
2384
+ app: {
2385
+ id: FILES_APP_ID,
2386
+ label: "Files",
2387
+ icon: FILES_ICON,
2388
+ launcher: "favorite",
2389
+ titleBar: "unified",
2390
+ Provider,
2391
+ Title,
2392
+ AppMenu,
2393
+ Menus,
2394
+ Content
2395
+ },
2396
+ Host,
2397
+ useFiles: useComputerFiles,
2398
+ Preview
2399
+ };
2400
+ //#endregion
2401
+ export { ComputerFiles };