@mcp-b/react-components 0.67.0 → 0.69.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 (66) hide show
  1. package/dist/{AgentComputer-BP9ixGGE.js → AgentComputer-CFJxjMFE.js} +32 -3
  2. package/dist/ComputerFileThumbnail-CXHy127c.js +393 -0
  3. package/dist/{ThinkSchedule-D4Ulsa0-.d.ts → ThinkSchedule-9nzxIoX1.d.ts} +1 -1
  4. package/dist/{Workspace-B9nuTfIi.d.ts → Workspace-mZddFyvP.d.ts} +7 -3
  5. package/dist/{WorkspaceAutomation-C0fghGLi.d.ts → WorkspaceAutomation-hwl6C1aX.d.ts} +2 -2
  6. package/dist/{WorkspaceBrowser-Dz48H-7X.d.ts → WorkspaceBrowser-CNVAKXXZ.d.ts} +4 -11
  7. package/dist/{WorkspaceBrowser-oBJv-Dac.js → WorkspaceBrowser-ojoZy0uO.js} +202 -210
  8. package/dist/{WorkspaceConcept-D46cYerS.d.ts → WorkspaceConcept-DqzfZWws.d.ts} +1 -1
  9. package/dist/{WorkspaceFileCommands-1s9Ol8CG.d.ts → WorkspaceFileCommands-CN2oVUzx.d.ts} +5 -2
  10. package/dist/{WorkspaceFileTransfer-BRD22nW-.d.ts → WorkspaceFileTransfer-D--dVla2.d.ts} +1 -1
  11. package/dist/components/agents-sdk/AgentComputer.d.ts +1 -1
  12. package/dist/components/agents-sdk/AgentComputer.js +1 -1
  13. package/dist/components/agents-sdk/ComputerAppIds.d.ts +15 -0
  14. package/dist/components/agents-sdk/ComputerAppIds.js +14 -0
  15. package/dist/components/agents-sdk/ComputerAutomations.d.ts +23 -14
  16. package/dist/components/agents-sdk/ComputerAutomations.js +437 -354
  17. package/dist/components/agents-sdk/ComputerCalendar.js +16 -15
  18. package/dist/components/agents-sdk/ComputerCustomWallpaper.d.ts +39 -0
  19. package/dist/components/agents-sdk/ComputerCustomWallpaper.js +522 -0
  20. package/dist/components/agents-sdk/ComputerFileThumbnail.d.ts +17 -0
  21. package/dist/components/agents-sdk/ComputerFileThumbnail.js +2 -0
  22. package/dist/components/agents-sdk/ComputerFiles.d.ts +4 -6
  23. package/dist/components/agents-sdk/ComputerFiles.js +337 -316
  24. package/dist/components/agents-sdk/ComputerHome.js +1 -1
  25. package/dist/components/agents-sdk/ComputerLayout.d.ts +9 -0
  26. package/dist/components/agents-sdk/ComputerLayout.js +66 -0
  27. package/dist/components/agents-sdk/ComputerNotifications.js +60 -83
  28. package/dist/components/agents-sdk/ComputerScreen.d.ts +12 -6
  29. package/dist/components/agents-sdk/ComputerScreen.js +49 -36
  30. package/dist/components/agents-sdk/ComputerSettings.d.ts +10 -4
  31. package/dist/components/agents-sdk/ComputerSettings.js +92 -72
  32. package/dist/components/agents-sdk/ComputerSpotlight.js +1 -1
  33. package/dist/components/agents-sdk/EmployeeSchedules.d.ts +2 -2
  34. package/dist/components/agents-sdk/ManagerOffice.d.ts +1 -1
  35. package/dist/components/agents-sdk/ThinkSchedule.d.ts +1 -1
  36. package/dist/components/agents-sdk/ThinkScheduleActions.d.ts +1 -1
  37. package/dist/components/agents-sdk/ThinkScheduleBrowser.d.ts +1 -1
  38. package/dist/components/agents-sdk/ThinkScheduleDetail.d.ts +2 -2
  39. package/dist/components/agents-sdk/ThinkScheduleForm.d.ts +1 -1
  40. package/dist/components/agents-sdk/Workspace.d.ts +1 -1
  41. package/dist/components/agents-sdk/Workspace.js +197 -190
  42. package/dist/components/agents-sdk/WorkspaceAutomation.d.ts +1 -1
  43. package/dist/components/agents-sdk/WorkspaceAutomationTable.d.ts +1 -1
  44. package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
  45. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  46. package/dist/components/agents-sdk/WorkspaceConcept.d.ts +1 -1
  47. package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +1 -1
  48. package/dist/components/agents-sdk/WorkspaceDesktop.d.ts +6 -6
  49. package/dist/components/agents-sdk/WorkspaceDesktop.js +126 -101
  50. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +2 -10
  51. package/dist/components/agents-sdk/WorkspaceExplorer.js +67 -71
  52. package/dist/components/agents-sdk/WorkspaceFileCommands.d.ts +1 -1
  53. package/dist/components/agents-sdk/WorkspaceFileCommands.js +11 -6
  54. package/dist/components/agents-sdk/WorkspaceFileTransfer.d.ts +1 -1
  55. package/dist/components/agents-sdk/WorkspaceLive.d.ts +1 -1
  56. package/dist/components/agents-sdk/WorkspaceLive.js +7 -5
  57. package/dist/components/agents-sdk/WorkspaceLocalFolder.d.ts +1 -1
  58. package/dist/components/agents-sdk/WorkspacePerson.d.ts +2 -2
  59. package/dist/components/agents-sdk/WorkspaceProject.d.ts +2 -2
  60. package/dist/components/extension/FirstRunSetup.d.ts +2 -2
  61. package/dist/minute-clock-CXpRGCMF.js +35 -0
  62. package/dist/{parts-RXV6GGdB.js → parts-CPVz9l31.js} +1 -1
  63. package/dist/styles/computer-files.css +31 -0
  64. package/dist/{workspace-concept-panel-BDTBISNO.d.ts → workspace-concept-panel-D1czupvi.d.ts} +1 -1
  65. package/dist/{workspace-quick-look-9V-UFpjj.js → workspace-quick-look-DODjsfhH.js} +79 -251
  66. package/package.json +2 -2
@@ -2,16 +2,17 @@ import { Z as PlusIcon, g as ChevronRightIcon, gt as XIcon, h as ChevronLeftIcon
2
2
  import { Checkbox } from "../foundations/Checkbox.js";
3
3
  import { Button } from "../foundations/Button.js";
4
4
  import { IconButton } from "../foundations/IconButton.js";
5
- import { n as useAgentComputerActions } from "../../AgentComputer-BP9ixGGE.js";
5
+ import { n as useAgentComputerActions } from "../../AgentComputer-CFJxjMFE.js";
6
6
  import { Menubar } from "../foundations/Menubar.js";
7
7
  import { EmptyState } from "../foundations/EmptyState.js";
8
+ import { COMPUTER_APP_IDS } from "./ComputerAppIds.js";
8
9
  import { DescriptionList } from "../foundations/DescriptionList.js";
9
10
  import { formatThinkExecutionStatus, getThinkExecutionRunId, getThinkExecutionRunStatus, isThinkSubmissionRun } from "./ThinkExecutionRun.js";
10
11
  import { AppTopBar } from "../general-purpose/AppTopBar.js";
11
12
  import { ResponsiveSidebarShell } from "../general-purpose/ResponsiveSidebarShell.js";
12
13
  import { LinkButton } from "../foundations/LinkButton.js";
13
14
  import { n as useComputerAutomationsContext, r as zonedFormat } from "../../automations-host-DPORjdc7.js";
14
- import { t as computerAppParts } from "../../parts-RXV6GGdB.js";
15
+ import { t as computerAppParts } from "../../parts-CPVz9l31.js";
15
16
  import { SearchField } from "../foundations/SearchField.js";
16
17
  import { formatThinkScheduleTimeZone } from "./ThinkSchedule.js";
17
18
  import { Popover } from "../foundations/Popover.js";
@@ -794,12 +795,12 @@ function _temp(entry_0) {
794
795
  /** Today's date on Calendar's paper, from the host's clock. */
795
796
  function CalendarIcon() {
796
797
  const $ = c(13);
797
- const { host } = useComputerAutomationsContext();
798
+ const { clock } = useComputerAutomationsContext();
798
799
  let t0;
799
- if ($[0] !== host.now || $[1] !== host.timeZone) {
800
- t0 = zonedFormat(host.timeZone, { weekday: "short" }).format(host.now);
801
- $[0] = host.now;
802
- $[1] = host.timeZone;
800
+ if ($[0] !== clock.now || $[1] !== clock.timeZone) {
801
+ t0 = zonedFormat(clock.timeZone, { weekday: "short" }).format(clock.now);
802
+ $[0] = clock.now;
803
+ $[1] = clock.timeZone;
803
804
  $[2] = t0;
804
805
  } else t0 = $[2];
805
806
  let t1;
@@ -809,10 +810,10 @@ function CalendarIcon() {
809
810
  $[4] = t1;
810
811
  } else t1 = $[4];
811
812
  let t2;
812
- if ($[5] !== host.now || $[6] !== host.timeZone) {
813
- t2 = zonedFormat(host.timeZone, { day: "numeric" }).format(host.now);
814
- $[5] = host.now;
815
- $[6] = host.timeZone;
813
+ if ($[5] !== clock.now || $[6] !== clock.timeZone) {
814
+ t2 = zonedFormat(clock.timeZone, { day: "numeric" }).format(clock.now);
815
+ $[5] = clock.now;
816
+ $[6] = clock.timeZone;
816
817
  $[7] = t2;
817
818
  } else t2 = $[7];
818
819
  let t3;
@@ -840,12 +841,12 @@ function CalendarIcon() {
840
841
  */
841
842
  function useCalendarModel() {
842
843
  const $ = c(71);
843
- const { host, calendar } = useComputerAutomationsContext();
844
+ const { host, clock: hostClock, calendar } = useComputerAutomationsContext();
844
845
  const { openApp } = useAgentComputerActions();
845
846
  let t0;
846
847
  if ($[0] !== openApp) {
847
848
  t0 = (shown) => void shown.then((ok) => {
848
- if (ok) openApp("automations");
849
+ if (ok) openApp(COMPUTER_APP_IDS.automations);
849
850
  });
850
851
  $[0] = openApp;
851
852
  $[1] = t0;
@@ -860,7 +861,7 @@ function useCalendarModel() {
860
861
  } else t1 = $[4];
861
862
  const onCreateSchedule = t1;
862
863
  const { schedules } = host;
863
- const clock = calendarClock(host.timeZone, host.now);
864
+ const clock = calendarClock(hostClock.timeZone, hostClock.now);
864
865
  const [t2, setDate] = useState({
865
866
  selected: clock.today,
866
867
  month: clock.today
@@ -1326,7 +1327,7 @@ function _temp2(entry_1) {
1326
1327
  }
1327
1328
  /** Calendar in the Dock. It reads the schedules and runs `ComputerAutomations.Host` keeps. */
1328
1329
  const ComputerCalendar = { app: {
1329
- id: "calendar",
1330
+ id: COMPUTER_APP_IDS.calendar,
1330
1331
  label: "Calendar",
1331
1332
  launcher: "favorite",
1332
1333
  icon: /* @__PURE__ */ jsx(CalendarIcon, {}),
@@ -0,0 +1,39 @@
1
+ import { t as WallpaperOption } from "../../WallpaperPicker-C-FItmDS.js";
2
+ import { ReactNode } from "react";
3
+ //#region src/components/agents-sdk/ComputerCustomWallpaper.d.ts
4
+ /** A person's own background image, prepared for bounded browser storage. */
5
+ export interface CustomWallpaper {
6
+ label: string;
7
+ dataUrl: string;
8
+ fit: "fill" | "fit";
9
+ x: number;
10
+ y: number;
11
+ }
12
+ /** The chosen background, and the person's own image if they added one. */
13
+ export interface ComputerWallpaper {
14
+ value: string;
15
+ custom: CustomWallpaper | null;
16
+ }
17
+ /** A saved background, or null when it names no wallpaper this desktop has. */
18
+ export declare function readWallpaper(value: unknown): ComputerWallpaper | null;
19
+ export interface UseComputerWallpaperOptions {
20
+ /** The saved choice; `readWallpaper` validates one from storage. */
21
+ wallpaper: ComputerWallpaper;
22
+ /** Saves a new choice, including the prepared image and its placement. */
23
+ onChange: (next: ComputerWallpaper) => void;
24
+ /** Where the choice is kept, under the controls. */
25
+ hint: ReactNode;
26
+ }
27
+ /** The desktop background with a person's own image: `AgentComputer`'s wallpaper and Settings' fields. */
28
+ export declare function useComputerWallpaper({ wallpaper, onChange, hint }: UseComputerWallpaperOptions): {
29
+ /** The background the computer shows, for `AgentComputer`'s `wallpaper`. */
30
+ selected: WallpaperOption;
31
+ /** ComputerSettings.Host's wallpaper fields. */
32
+ settings: {
33
+ wallpapers: readonly WallpaperOption[];
34
+ wallpaper: string;
35
+ onWallpaperChange: (next: string) => void;
36
+ display: import("react").JSX.Element;
37
+ };
38
+ };
39
+ //#endregion
@@ -0,0 +1,522 @@
1
+ import { Button } from "../foundations/Button.js";
2
+ import { COMPUTER_WALLPAPERS, DEFAULT_COMPUTER_WALLPAPER } from "./ComputerWallpapers.js";
3
+ import { Slider } from "../foundations/Slider.js";
4
+ import { Radio, RadioGroup } from "../foundations/RadioGroup.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { useEffect, useEffectEvent, useId, useRef, useState } from "react";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/agents-sdk/ComputerCustomWallpaper.tsx
9
+ const JPEG_PREFIX = "data:image/jpeg;base64,";
10
+ const MAX_IMAGE_BYTES = 10485760;
11
+ const MAX_STORED_IMAGE_LENGTH = 75e4;
12
+ function readCustomWallpaper(image) {
13
+ if (!image || typeof image !== "object" || !("label" in image && "dataUrl" in image && "fit" in image && "x" in image && "y" in image) || typeof image.label !== "string" || !image.label.trim() || image.label.length > 240 || typeof image.dataUrl !== "string" || image.dataUrl.length > MAX_STORED_IMAGE_LENGTH || !/^data:image\/jpeg;base64,[a-z0-9+/]+=*$/i.test(image.dataUrl) || image.fit !== "fill" && image.fit !== "fit" || ![image.x, image.y].every((position) => typeof position === "number" && Number.isFinite(position) && position >= 0 && position <= 100)) return null;
14
+ const header = atob(image.dataUrl.slice(23, 31));
15
+ if (header.charCodeAt(0) !== 255 || header.charCodeAt(1) !== 216 || header.charCodeAt(2) !== 255) return null;
16
+ const { label, dataUrl, fit } = image;
17
+ return {
18
+ label,
19
+ dataUrl,
20
+ fit,
21
+ x: image.x,
22
+ y: image.y
23
+ };
24
+ }
25
+ /** A saved background, or null when it names no wallpaper this desktop has. */
26
+ function readWallpaper(value) {
27
+ if (!value || typeof value !== "object" || !("value" in value) || !("custom" in value)) return null;
28
+ const custom = value.custom === null ? null : readCustomWallpaper(value.custom);
29
+ if (value.custom !== null && !custom) return null;
30
+ if (value.value === "custom" ? !custom : !COMPUTER_WALLPAPERS.some((w) => w.value === value.value)) return null;
31
+ return {
32
+ value: value.value,
33
+ custom
34
+ };
35
+ }
36
+ async function prepareWallpaper(file) {
37
+ if (!file.size || file.size > MAX_IMAGE_BYTES) throw new Error("Choose an image smaller than 10 MB.");
38
+ const bytes = new Uint8Array(await file.slice(0, 12).arrayBuffer());
39
+ const isPng = [
40
+ 137,
41
+ 80,
42
+ 78,
43
+ 71,
44
+ 13,
45
+ 10,
46
+ 26,
47
+ 10
48
+ ].every((byte, index) => bytes[index] === byte);
49
+ const isJpeg = bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255;
50
+ const isWebp = [
51
+ 82,
52
+ 73,
53
+ 70,
54
+ 70
55
+ ].every((byte, index) => bytes[index] === byte) && [
56
+ 87,
57
+ 69,
58
+ 66,
59
+ 80
60
+ ].every((byte, index) => bytes[index + 8] === byte);
61
+ if (!(file.type === "image/png" && isPng || file.type === "image/jpeg" && isJpeg || file.type === "image/webp" && isWebp)) throw new Error("Choose a PNG, JPEG, or WebP image.");
62
+ let bitmap;
63
+ try {
64
+ bitmap = await createImageBitmap(file);
65
+ } catch {
66
+ throw new Error("This image couldn’t be opened. Choose another image.");
67
+ }
68
+ try {
69
+ if (!bitmap.width || !bitmap.height || bitmap.width * bitmap.height > 4e7) throw new Error("Choose an image with fewer than 40 million pixels.");
70
+ const canvas = document.createElement("canvas");
71
+ const context = canvas.getContext("2d");
72
+ if (!context) throw new Error("Your browser couldn’t prepare this image.");
73
+ for (const edge of [
74
+ 1600,
75
+ 1200,
76
+ 800
77
+ ]) {
78
+ const scale = Math.min(1, edge / Math.max(bitmap.width, bitmap.height));
79
+ canvas.width = Math.max(1, Math.round(bitmap.width * scale));
80
+ canvas.height = Math.max(1, Math.round(bitmap.height * scale));
81
+ context.fillStyle = "#171c22";
82
+ context.fillRect(0, 0, canvas.width, canvas.height);
83
+ context.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
84
+ const dataUrl = canvas.toDataURL("image/jpeg", .82);
85
+ if (dataUrl.startsWith(JPEG_PREFIX) && dataUrl.length <= MAX_STORED_IMAGE_LENGTH) return {
86
+ label: file.name.trim().slice(0, 240) || "Custom image",
87
+ dataUrl,
88
+ fit: "fill",
89
+ x: 50,
90
+ y: 50
91
+ };
92
+ }
93
+ throw new Error("This image is too detailed to save. Choose a smaller image.");
94
+ } finally {
95
+ bitmap.close();
96
+ }
97
+ }
98
+ function customOption(image) {
99
+ return {
100
+ value: "custom",
101
+ label: image.label,
102
+ background: `url("${image.dataUrl}") ${image.x}% ${image.y}% / ${image.fit === "fill" ? "cover" : "contain"} no-repeat #171c22`
103
+ };
104
+ }
105
+ /** The desktop background with a person's own image: `AgentComputer`'s wallpaper and Settings' fields. */
106
+ function useComputerWallpaper(t0) {
107
+ const $ = c(83);
108
+ const { wallpaper, onChange, hint } = t0;
109
+ const uploadButtonId = useId();
110
+ const uploadInput = useRef(null);
111
+ const helpId = useId();
112
+ const errorId = useId();
113
+ const uploadRevision = useRef(0);
114
+ const [uploading, setUploading] = useState(false);
115
+ const [uploadError, setUploadError] = useState("");
116
+ const { value, custom: saved } = wallpaper;
117
+ const [position, setPosition] = useState(null);
118
+ let t1;
119
+ if ($[0] !== position || $[1] !== saved) {
120
+ t1 = saved && position?.dataUrl === saved.dataUrl ? {
121
+ ...saved,
122
+ x: position.x ?? saved.x,
123
+ y: position.y ?? saved.y
124
+ } : saved;
125
+ $[0] = position;
126
+ $[1] = saved;
127
+ $[2] = t1;
128
+ } else t1 = $[2];
129
+ const custom = t1;
130
+ const customUrl = saved?.dataUrl;
131
+ let t2;
132
+ if ($[3] !== onChange || $[4] !== value) {
133
+ t2 = () => {
134
+ onChange({
135
+ value: value === "custom" ? DEFAULT_COMPUTER_WALLPAPER : value,
136
+ custom: null
137
+ });
138
+ setUploadError("The saved image couldn’t be opened. Choose a new image.");
139
+ };
140
+ $[3] = onChange;
141
+ $[4] = value;
142
+ $[5] = t2;
143
+ } else t2 = $[5];
144
+ const dropUnreadable = useEffectEvent(t2);
145
+ let t3;
146
+ if ($[6] !== customUrl || $[7] !== dropUnreadable) {
147
+ t3 = () => {
148
+ if (!customUrl) return;
149
+ let active = true;
150
+ const image = new Image();
151
+ image.src = customUrl;
152
+ image.decode().catch(() => {
153
+ if (!active) return;
154
+ dropUnreadable();
155
+ });
156
+ return () => {
157
+ active = false;
158
+ };
159
+ };
160
+ $[6] = customUrl;
161
+ $[7] = dropUnreadable;
162
+ $[8] = t3;
163
+ } else t3 = $[8];
164
+ let t4;
165
+ if ($[9] !== customUrl) {
166
+ t4 = [customUrl];
167
+ $[9] = customUrl;
168
+ $[10] = t4;
169
+ } else t4 = $[10];
170
+ useEffect(t3, t4);
171
+ let t5;
172
+ let t6;
173
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
174
+ t5 = () => () => {
175
+ uploadRevision.current = uploadRevision.current + 1;
176
+ };
177
+ t6 = [];
178
+ $[11] = t5;
179
+ $[12] = t6;
180
+ } else {
181
+ t5 = $[11];
182
+ t6 = $[12];
183
+ }
184
+ useEffect(t5, t6);
185
+ const customLabel = custom?.label;
186
+ const customFit = custom?.fit;
187
+ const customX = custom?.x;
188
+ const customY = custom?.y;
189
+ let t7;
190
+ if ($[13] !== customFit || $[14] !== customLabel || $[15] !== customUrl || $[16] !== customX || $[17] !== customY) {
191
+ t7 = customUrl !== void 0 && customLabel !== void 0 && customFit !== void 0 && customX !== void 0 && customY !== void 0 ? [...COMPUTER_WALLPAPERS, customOption({
192
+ dataUrl: customUrl,
193
+ label: customLabel,
194
+ fit: customFit,
195
+ x: customX,
196
+ y: customY
197
+ })] : COMPUTER_WALLPAPERS;
198
+ $[13] = customFit;
199
+ $[14] = customLabel;
200
+ $[15] = customUrl;
201
+ $[16] = customX;
202
+ $[17] = customY;
203
+ $[18] = t7;
204
+ } else t7 = $[18];
205
+ const wallpapers = t7;
206
+ let t8;
207
+ if ($[19] !== value || $[20] !== wallpapers) {
208
+ let t9;
209
+ if ($[22] !== value) {
210
+ t9 = (wallpaper_0) => wallpaper_0.value === value;
211
+ $[22] = value;
212
+ $[23] = t9;
213
+ } else t9 = $[23];
214
+ t8 = wallpapers.find(t9);
215
+ $[19] = value;
216
+ $[20] = wallpapers;
217
+ $[21] = t8;
218
+ } else t8 = $[21];
219
+ const selected = t8;
220
+ let t9;
221
+ if ($[24] !== onChange) {
222
+ t9 = function save(next, image_0) {
223
+ setPosition(null);
224
+ onChange({
225
+ value: next,
226
+ custom: image_0
227
+ });
228
+ };
229
+ $[24] = onChange;
230
+ $[25] = t9;
231
+ } else t9 = $[25];
232
+ const save = t9;
233
+ let t10;
234
+ if ($[26] !== save || $[27] !== saved || $[28] !== wallpapers) {
235
+ t10 = function select(next_0) {
236
+ if (!wallpapers.some((wallpaper_1) => wallpaper_1.value === next_0)) return;
237
+ uploadRevision.current = uploadRevision.current + 1;
238
+ setUploading(false);
239
+ save(next_0, saved);
240
+ };
241
+ $[26] = save;
242
+ $[27] = saved;
243
+ $[28] = wallpapers;
244
+ $[29] = t10;
245
+ } else t10 = $[29];
246
+ const select = t10;
247
+ let t11;
248
+ if ($[30] !== save || $[31] !== saved) {
249
+ t11 = function updateCustom(patch, t12) {
250
+ const persist = t12 === void 0 ? true : t12;
251
+ if (!saved) return;
252
+ if (persist) save("custom", {
253
+ ...saved,
254
+ ...patch
255
+ });
256
+ else setPosition((current) => ({
257
+ ...current,
258
+ ...patch,
259
+ dataUrl: saved.dataUrl
260
+ }));
261
+ };
262
+ $[30] = save;
263
+ $[31] = saved;
264
+ $[32] = t11;
265
+ } else t11 = $[32];
266
+ const updateCustom = t11;
267
+ let t12;
268
+ if ($[33] !== save) {
269
+ t12 = async function upload(file) {
270
+ const revision = uploadRevision.current = uploadRevision.current + 1;
271
+ setUploading(true);
272
+ setUploadError("");
273
+ const prepared = await prepareWallpaper(file).then(_temp, _temp2);
274
+ if (revision !== uploadRevision.current) return;
275
+ if ("image" in prepared) save("custom", prepared.image);
276
+ else setUploadError(prepared.error instanceof Error ? prepared.error.message : "This image couldn’t be opened.");
277
+ setUploading(false);
278
+ };
279
+ $[33] = save;
280
+ $[34] = t12;
281
+ } else t12 = $[34];
282
+ const upload = t12;
283
+ const t13 = `${helpId}${uploadError ? ` ${errorId}` : ""}`;
284
+ let t14;
285
+ if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
286
+ t14 = () => uploadInput.current?.click();
287
+ $[35] = t14;
288
+ } else t14 = $[35];
289
+ let t15;
290
+ if ($[36] !== t13 || $[37] !== uploadButtonId || $[38] !== uploading) {
291
+ t15 = /* @__PURE__ */ jsx(Button, {
292
+ id: uploadButtonId,
293
+ size: "xs",
294
+ variant: "surface",
295
+ color: "neutral",
296
+ disabled: uploading,
297
+ "aria-describedby": t13,
298
+ onClick: t14,
299
+ children: "Use your own image…"
300
+ });
301
+ $[36] = t13;
302
+ $[37] = uploadButtonId;
303
+ $[38] = uploading;
304
+ $[39] = t15;
305
+ } else t15 = $[39];
306
+ let t16;
307
+ if ($[40] !== uploading) {
308
+ t16 = uploading ? /* @__PURE__ */ jsx("p", {
309
+ role: "status",
310
+ children: "Preparing background…"
311
+ }) : null;
312
+ $[40] = uploading;
313
+ $[41] = t16;
314
+ } else t16 = $[41];
315
+ let t17;
316
+ if ($[42] !== errorId || $[43] !== uploadError) {
317
+ t17 = uploadError ? /* @__PURE__ */ jsx("p", {
318
+ id: errorId,
319
+ role: "alert",
320
+ children: uploadError
321
+ }) : null;
322
+ $[42] = errorId;
323
+ $[43] = uploadError;
324
+ $[44] = t17;
325
+ } else t17 = $[44];
326
+ let t18;
327
+ if ($[45] !== t15 || $[46] !== t16 || $[47] !== t17) {
328
+ t18 = /* @__PURE__ */ jsxs(Fragment, { children: [
329
+ t15,
330
+ t16,
331
+ t17
332
+ ] });
333
+ $[45] = t15;
334
+ $[46] = t16;
335
+ $[47] = t17;
336
+ $[48] = t18;
337
+ } else t18 = $[48];
338
+ const uploadControls = t18;
339
+ const t19 = Boolean(uploadError);
340
+ const t20 = `${helpId}${uploadError ? ` ${errorId}` : ""}`;
341
+ let t21;
342
+ if ($[49] !== upload) {
343
+ t21 = (event) => {
344
+ const file_0 = event.currentTarget.files?.[0];
345
+ event.currentTarget.value = "";
346
+ if (file_0) upload(file_0);
347
+ };
348
+ $[49] = upload;
349
+ $[50] = t21;
350
+ } else t21 = $[50];
351
+ let t22;
352
+ if ($[51] !== t19 || $[52] !== t20 || $[53] !== t21 || $[54] !== uploadButtonId || $[55] !== uploading) {
353
+ t22 = /* @__PURE__ */ jsx("input", {
354
+ ref: uploadInput,
355
+ hidden: true,
356
+ "aria-labelledby": uploadButtonId,
357
+ type: "file",
358
+ accept: "image/png,image/jpeg,image/webp",
359
+ disabled: uploading,
360
+ "aria-invalid": t19,
361
+ "aria-describedby": t20,
362
+ onChange: t21
363
+ });
364
+ $[51] = t19;
365
+ $[52] = t20;
366
+ $[53] = t21;
367
+ $[54] = uploadButtonId;
368
+ $[55] = uploading;
369
+ $[56] = t22;
370
+ } else t22 = $[56];
371
+ let t23;
372
+ if ($[57] !== helpId) {
373
+ t23 = /* @__PURE__ */ jsx("p", {
374
+ id: helpId,
375
+ className: "sigvelo-visually-hidden",
376
+ children: "PNG, JPEG, or WebP, up to 10 MB. Images are dimmed to keep desktop labels readable."
377
+ });
378
+ $[57] = helpId;
379
+ $[58] = t23;
380
+ } else t23 = $[58];
381
+ let t24;
382
+ if ($[59] !== custom || $[60] !== save || $[61] !== updateCustom || $[62] !== uploadButtonId || $[63] !== value) {
383
+ t24 = custom ? /* @__PURE__ */ jsxs("section", {
384
+ className: "computer-wallpapers__custom",
385
+ "aria-label": "Custom background",
386
+ children: [value === "custom" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(RadioGroup.Root, {
387
+ className: "computer-wallpapers__placement",
388
+ value: custom.fit,
389
+ onValueChange: (fit) => {
390
+ if (fit === "fill" || fit === "fit") updateCustom({ fit });
391
+ },
392
+ "aria-label": "Image placement",
393
+ children: [/* @__PURE__ */ jsxs("label", {
394
+ className: "computer-wallpapers__choice",
395
+ children: [/* @__PURE__ */ jsx(Radio.Root, {
396
+ value: "fill",
397
+ children: /* @__PURE__ */ jsx(Radio.Indicator, {})
398
+ }), "Fill the screen (crop edges)"]
399
+ }), /* @__PURE__ */ jsxs("label", {
400
+ className: "computer-wallpapers__choice",
401
+ children: [/* @__PURE__ */ jsx(Radio.Root, {
402
+ value: "fit",
403
+ children: /* @__PURE__ */ jsx(Radio.Indicator, {})
404
+ }), "Fit the entire image"]
405
+ })]
406
+ }), /* @__PURE__ */ jsx("div", {
407
+ className: "computer-wallpapers__crop",
408
+ children: ["x", "y"].map((axis) => /* @__PURE__ */ jsxs(Slider.Root, {
409
+ value: custom[axis],
410
+ min: 0,
411
+ max: 100,
412
+ step: 1,
413
+ onValueChange: (position_0) => updateCustom({ [axis]: position_0 }, false),
414
+ onValueCommitted: (position_1) => updateCustom({ [axis]: position_1 }),
415
+ children: [/* @__PURE__ */ jsxs("div", {
416
+ className: "computer-wallpapers__crop-label",
417
+ children: [/* @__PURE__ */ jsx(Slider.Label, { children: axis === "x" ? "Horizontal position" : "Vertical position" }), /* @__PURE__ */ jsxs("span", { children: [custom[axis], "%"] })]
418
+ }), /* @__PURE__ */ jsx(Slider.Control, {
419
+ className: "computer-wallpapers__crop-control",
420
+ children: /* @__PURE__ */ jsxs(Slider.Track, { children: [/* @__PURE__ */ jsx(Slider.Indicator, {}), /* @__PURE__ */ jsx(Slider.Thumb, {})] })
421
+ })]
422
+ }, axis))
423
+ })] }) : null, /* @__PURE__ */ jsxs("div", {
424
+ className: "computer-wallpapers__actions",
425
+ children: [value === "custom" ? /* @__PURE__ */ jsx(Button, {
426
+ variant: "surface",
427
+ color: "neutral",
428
+ onClick: () => updateCustom({
429
+ x: 50,
430
+ y: 50
431
+ }),
432
+ children: "Center image"
433
+ }) : null, /* @__PURE__ */ jsx(Button, {
434
+ variant: "surface",
435
+ color: "neutral",
436
+ onClick: () => {
437
+ uploadRevision.current = uploadRevision.current + 1;
438
+ setUploading(false);
439
+ setUploadError("");
440
+ save(DEFAULT_COMPUTER_WALLPAPER, null);
441
+ requestAnimationFrame(() => uploadInput.current?.ownerDocument.getElementById(uploadButtonId)?.focus());
442
+ },
443
+ children: "Remove custom image"
444
+ })]
445
+ })]
446
+ }) : null;
447
+ $[59] = custom;
448
+ $[60] = save;
449
+ $[61] = updateCustom;
450
+ $[62] = uploadButtonId;
451
+ $[63] = value;
452
+ $[64] = t24;
453
+ } else t24 = $[64];
454
+ let t25;
455
+ if ($[65] !== hint) {
456
+ t25 = /* @__PURE__ */ jsx("p", {
457
+ className: "computer-wallpapers__hint",
458
+ role: "status",
459
+ children: hint
460
+ });
461
+ $[65] = hint;
462
+ $[66] = t25;
463
+ } else t25 = $[66];
464
+ let t26;
465
+ if ($[67] !== t22 || $[68] !== t23 || $[69] !== t24 || $[70] !== t25) {
466
+ t26 = /* @__PURE__ */ jsxs(Fragment, { children: [
467
+ t22,
468
+ t23,
469
+ t24,
470
+ t25
471
+ ] });
472
+ $[67] = t22;
473
+ $[68] = t23;
474
+ $[69] = t24;
475
+ $[70] = t25;
476
+ $[71] = t26;
477
+ } else t26 = $[71];
478
+ const details = t26;
479
+ let t27;
480
+ if ($[72] !== details || $[73] !== uploadControls) {
481
+ t27 = /* @__PURE__ */ jsxs("div", {
482
+ className: "computer-wallpapers__controls",
483
+ children: [uploadControls, details]
484
+ });
485
+ $[72] = details;
486
+ $[73] = uploadControls;
487
+ $[74] = t27;
488
+ } else t27 = $[74];
489
+ let t28;
490
+ if ($[75] !== select || $[76] !== t27 || $[77] !== value || $[78] !== wallpapers) {
491
+ t28 = {
492
+ wallpapers,
493
+ wallpaper: value,
494
+ onWallpaperChange: select,
495
+ display: t27
496
+ };
497
+ $[75] = select;
498
+ $[76] = t27;
499
+ $[77] = value;
500
+ $[78] = wallpapers;
501
+ $[79] = t28;
502
+ } else t28 = $[79];
503
+ let t29;
504
+ if ($[80] !== selected || $[81] !== t28) {
505
+ t29 = {
506
+ selected,
507
+ settings: t28
508
+ };
509
+ $[80] = selected;
510
+ $[81] = t28;
511
+ $[82] = t29;
512
+ } else t29 = $[82];
513
+ return t29;
514
+ }
515
+ function _temp2(error) {
516
+ return { error };
517
+ }
518
+ function _temp(image_1) {
519
+ return { image: image_1 };
520
+ }
521
+ //#endregion
522
+ export { readWallpaper, useComputerWallpaper };
@@ -0,0 +1,17 @@
1
+ import { y as WorkspaceSource } from "../../Workspace-mZddFyvP.js";
2
+ import { FileInfo } from "@cloudflare/shell";
3
+ //#region src/components/agents-sdk/ComputerFileThumbnail.d.ts
4
+ export interface ComputerFileThumbnailProps {
5
+ entry: FileInfo;
6
+ source: WorkspaceSource;
7
+ sourceKey: string;
8
+ }
9
+ /**
10
+ * A desktop or Finder thumbnail drawn from the file itself, the way Finder
11
+ * draws one: an SVG shows as the image, a text file as a page of its text.
12
+ * Every other entry, and one whose read has not come back, draws its kind's
13
+ * generic folder or page. The file is read once it nears the viewport, under
14
+ * a key of its own version, so listing refreshes never read it again.
15
+ */
16
+ export declare function ComputerFileThumbnail({ entry, source, sourceKey }: ComputerFileThumbnailProps): import("react").JSX.Element;
17
+ //#endregion
@@ -0,0 +1,2 @@
1
+ import { t as ComputerFileThumbnail } from "../../ComputerFileThumbnail-CXHy127c.js";
2
+ export { ComputerFileThumbnail };
@@ -1,10 +1,10 @@
1
1
  import { l as WorkspaceNavigationAdapter, n as WorkspaceDestination } from "../../WorkspaceLink-C8HH2fMT.js";
2
2
  import { a as WorkspaceFileState } from "../../WorkspaceFile-BJC6vlp_.js";
3
- import "../../Workspace-B9nuTfIi.js";
4
- import { a as WorkspaceDrop, i as WorkspaceDragSource, u as WorkspaceTransferOperation } from "../../WorkspaceFileTransfer-BRD22nW-.js";
3
+ import "../../Workspace-mZddFyvP.js";
4
+ import { a as WorkspaceDrop, i as WorkspaceDragSource, u as WorkspaceTransferOperation } from "../../WorkspaceFileTransfer-D--dVla2.js";
5
5
  import { AgentComputerApp } from "./AgentComputer.js";
6
- import { i as WorkspaceFileCommands, s as WorkspaceVolume } from "../../WorkspaceFileCommands-1s9Ol8CG.js";
7
- import { i as WorkspaceBrowserSort } from "../../WorkspaceBrowser-Dz48H-7X.js";
6
+ import { i as WorkspaceFileCommands, s as WorkspaceVolume } from "../../WorkspaceFileCommands-CN2oVUzx.js";
7
+ import { i as WorkspaceBrowserSort } from "../../WorkspaceBrowser-CNVAKXXZ.js";
8
8
  import * as React from "react";
9
9
  import { ReactNode } from "react";
10
10
  import { FileInfo } from "@cloudflare/shell";
@@ -104,8 +104,6 @@ interface ComputerFilesHost {
104
104
  /** Folder history; null where there is nowhere to go. */
105
105
  onBack: (() => void) | null;
106
106
  onForward: (() => void) | null;
107
- /** A file's own artwork for its row, or null for the kind's icon. */
108
- renderThumbnail: (entry: FileInfo) => ReactNode;
109
107
  /**
110
108
  * What Quick Look and the file window show for a file they cannot preview,
111
109
  * such as a `WorkspaceDocumentFrame`; omit it, or return null, for the