@marimo-team/frontend 0.25.3-dev48 → 0.25.3-dev51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CellStatus-BpOBz-8m.js → CellStatus-RQxLjC9P.js} +1 -1
- package/dist/assets/{ErrorBoundary-DmXl4Nre.js → ErrorBoundary-DzEMMFh0.js} +2 -2
- package/dist/assets/{JsonOutput-53CM4rZw.js → JsonOutput-9IONH7hu.js} +5 -5
- package/dist/assets/MarimoErrorOutput-BT8Qy5wh.js +10 -0
- package/dist/assets/{RenderHTML-BFaztTR0.js → RenderHTML-PyMU3fBB.js} +1 -1
- package/dist/assets/{RunButton-B44xE_d5.js → RunButton-2p2uCp9U.js} +1 -1
- package/dist/assets/{add-cell-with-ai-DQlEdS75.js → add-cell-with-ai-CEQ8jvcR.js} +5 -5
- package/dist/assets/{add-connection-dialog-CWLLVKju.js → add-connection-dialog-D9fnw-j0.js} +1 -1
- package/dist/assets/{agent-panel-Dvr9HVds.js → agent-panel-DkTYXm6j.js} +1 -1
- package/dist/assets/{ai-model-dropdown-F3mm17Wa.js → ai-model-dropdown-Cv9fEAp9.js} +3 -3
- package/dist/assets/{app-config-button-D0uDs5nC.js → app-config-button-BZzwY1BU.js} +1 -1
- package/dist/assets/{blob-BSfsdCNF.js → blob-DmUUV8Xf.js} +1 -1
- package/dist/assets/{cell-editor-B9xsMBv-.js → cell-editor-C6xeN3x0.js} +8 -8
- package/dist/assets/cell-link-BNDZZ97N.js +1 -0
- package/dist/assets/cells-0e2dpq3z.js +220 -0
- package/dist/assets/{chat-display-C3__xzM4.js → chat-display-D6TNcsmz.js} +1 -1
- package/dist/assets/{chat-panel-CffQmmt6.js → chat-panel-CN45Q9wF.js} +2 -2
- package/dist/assets/{chat-ui-TDKs3kxj.js → chat-ui-BGl1jPPe.js} +1 -1
- package/dist/assets/code-visibility-CV3S4xuf.js +1 -0
- package/dist/assets/{column-preview-8r_KX_X9.js → column-preview-D7sTOokc.js} +1 -1
- package/dist/assets/{command-palette-CymnpCiy.js → command-palette-CP5KmR-S.js} +1 -1
- package/dist/assets/{common-BcEY1yDS.js → common-GvwCMUGF.js} +1 -1
- package/dist/assets/{components-lkCfd2vy.js → components-nnFZuekV.js} +1 -1
- package/dist/assets/{config-DXjnAwtL.js → config-CjQ4WJnJ.js} +1 -1
- package/dist/assets/config-DzdxZb17.js +1 -0
- package/dist/assets/{datasource-dKk3JHSQ.js → datasource-BpMPWJoj.js} +1 -1
- package/dist/assets/{dependency-graph-panel-BaisS9Zt.js → dependency-graph-panel-lyJ3aygI.js} +1 -1
- package/dist/assets/{documentation-panel-CpSUoM8r.js → documentation-panel-CTUWNQQy.js} +1 -1
- package/dist/assets/{download-RV4i1fWI.js → download-Csw35OD4.js} +1 -1
- package/dist/assets/{edit-page-CWjREE5g.js → edit-page-Dwf3-IB6.js} +6 -6
- package/dist/assets/{error-entries-CJS0gOId.js → error-entries-D3H6JH3A.js} +1 -1
- package/dist/assets/{error-panel-BxCKpZtN.js → error-panel-CgpCPUEO.js} +1 -1
- package/dist/assets/feedback-button-B8idT199.js +1 -0
- package/dist/assets/{feedback-button-DYjae3_b.js → feedback-button-BEBY1q2a.js} +2 -2
- package/dist/assets/{file-explorer-panel-DRj-91dB.js → file-explorer-panel-MnNgzxxE.js} +1 -1
- package/dist/assets/{file-name-input-BpfSzvEB.js → file-name-input-DrtIQ1VP.js} +1 -1
- package/dist/assets/{floating-outline-CrWdiNQ2.js → floating-outline-Dtc8YhnE.js} +1 -1
- package/dist/assets/{gallery-page-W_b-XWq6.js → gallery-page-DL4SSfun.js} +1 -1
- package/dist/assets/{glide-data-editor-C_bIL30J.js → glide-data-editor-BTlU9F_s.js} +1 -1
- package/dist/assets/{home-page-D1teQDdF.js → home-page-BOmrrw3X.js} +1 -1
- package/dist/assets/hooks-DRNEKPFW.js +1 -0
- package/dist/assets/{index-yFM8bRve.js → index-BdCbOYjS.js} +9 -9
- package/dist/assets/{layout-BDFQESY4.js → layout-DY2TXsTM.js} +5 -5
- package/dist/assets/{logs-panel-DVSgfMgv.js → logs-panel-9f0amGf0.js} +1 -1
- package/dist/assets/{markdown-renderer-DX2O5YiE.js → markdown-renderer-BRDCZeXA.js} +1 -1
- package/dist/assets/{name-cell-input-DL1i8Mj0.js → name-cell-input-13mN6CiO.js} +1 -1
- package/dist/assets/{outline-panel-DPKPT2eg.js → outline-panel-DxC82nfD.js} +1 -1
- package/dist/assets/{packages-panel-CZZwD9YV.js → packages-panel-Bi_mcFbl.js} +1 -1
- package/dist/assets/{panel-accordion-state-C7vvsYz1.js → panel-accordion-state-D_2i5aDC.js} +1 -1
- package/dist/assets/panels-C-ygF1Rv.js +107 -0
- package/dist/assets/{process-output-BKhybJBb.js → process-output-DlZH3EId.js} +1 -1
- package/dist/assets/{readonly-code-display-9QrSm_7D.js → readonly-code-display-C8kpTYRT.js} +1 -1
- package/dist/assets/{readonly-python-code-BLotL3XP.js → readonly-python-code-XeDpkiXX.js} +1 -1
- package/dist/assets/{reveal-component-DaU9bJyq.js → reveal-component-DgYlZOla.js} +3 -3
- package/dist/assets/run-page-C_A8W1eR.js +1 -0
- package/dist/assets/{runtime-details-state-B25uM-Ps.js → runtime-details-state-BeyT-Z-4.js} +1 -1
- package/dist/assets/{scratchpad-panel-DVHXbcng.js → scratchpad-panel-Fb-8g4-S.js} +1 -1
- package/dist/assets/session-panel-Cl85FUT5.js +1 -0
- package/dist/assets/{snippets-panel-IxIxfxNc.js → snippets-panel-1hl_ey1w.js} +1 -1
- package/dist/assets/state-CbjD81T1.js +3 -0
- package/dist/assets/{state-CVgqwwCU.js → state-ClkxCKxQ.js} +1 -1
- package/dist/assets/{terminal-CjvCrRrA.js → terminal-D__Z_QZ0.js} +3 -3
- package/dist/assets/{tracing-V5zejPsw.js → tracing-DcFczEy0.js} +1 -1
- package/dist/assets/{tracing-panel-DLS3iwK6.js → tracing-panel-EWvfWPFQ.js} +2 -2
- package/dist/assets/{tree-actions-Be_mzC1C.js → tree-actions-Dof5VISm.js} +1 -1
- package/dist/assets/{useAddCell-DK79W1vA.js → useAddCell-CqnFgwhm.js} +1 -1
- package/dist/assets/{useBoolean-DGV7FfNx.js → useBoolean-CMgj9hnq.js} +1 -1
- package/dist/assets/{useCellActionButton-Cw9Ob12j.js → useCellActionButton--Sq8PDBs.js} +1 -1
- package/dist/assets/{useDeleteCell-BNqX6PPu.js → useDeleteCell-DNTqIwU8.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-GnTnqKJo.js → useDependencyPanelTab-C4_EiuVH.js} +1 -1
- package/dist/assets/{useInstallPackage-CVItDn1e.js → useInstallPackage-DDjpV5RE.js} +1 -1
- package/dist/assets/useNotebookActions-C00MOhyT.js +1 -0
- package/dist/assets/{useRunCells-DP09DHT6.js → useRunCells-DqLsZnRn.js} +1 -1
- package/dist/assets/{useSplitCell-IfumZ4sm.js → useSplitCell-Daxc689Z.js} +1 -1
- package/dist/assets/vega-component-D7JFthDD.js +1 -0
- package/dist/index.html +30 -30
- package/package.json +1 -1
- package/src/__tests__/mount.test.ts +0 -20
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +2 -2
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +2 -2
- package/src/core/host/__tests__/notebook-client.test.ts +66 -3
- package/src/core/host/events.ts +1 -10
- package/src/core/host/notebook-client.ts +11 -18
- package/src/core/runtime/__tests__/runtime.test.ts +2 -53
- package/src/core/runtime/runtime.ts +1 -14
- package/src/core/runtime/types.ts +0 -2
- package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +2 -23
- package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +17 -25
- package/src/core/websocket/transports/__tests__/sse.test.ts +17 -0
- package/src/core/websocket/transports/sse.ts +14 -2
- package/src/core/websocket/useNotebookClient.ts +1 -11
- package/src/core/websocket/useNotebookSession.tsx +1 -6
- package/src/mount.tsx +0 -4
- package/dist/assets/MarimoErrorOutput-DVjK8RgY.js +0 -10
- package/dist/assets/cell-link-DFPHORAO.js +0 -1
- package/dist/assets/cells-BdgzY0of.js +0 -220
- package/dist/assets/code-visibility-Cs-Vv3jV.js +0 -1
- package/dist/assets/config-BwHT0yGp.js +0 -104
- package/dist/assets/feedback-button-BLvwvndE.js +0 -1
- package/dist/assets/hooks-CXfUfh2H.js +0 -1
- package/dist/assets/panels-Ky-lM0iL.js +0 -4
- package/dist/assets/run-page-5-VklWLa.js +0 -1
- package/dist/assets/session-panel-CPVhiI4m.js +0 -1
- package/dist/assets/state-D7Y-ORmT.js +0 -3
- package/dist/assets/useNotebookActions-CqqHJtAd.js +0 -1
- package/dist/assets/vega-component-CMn031HF.js +0 -1
|
@@ -36,7 +36,6 @@ vi.mock("@/core/runtime/config", async () => {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
39
|
-
import * as Toast from "@/components/ui/use-toast";
|
|
40
39
|
import { Logger } from "@/utils/Logger";
|
|
41
40
|
import { Deferred } from "@/utils/Deferred";
|
|
42
41
|
import { cellId } from "@/__tests__/branded";
|
|
@@ -235,36 +234,29 @@ describe("useNotebookSession messages", () => {
|
|
|
235
234
|
}
|
|
236
235
|
|
|
237
236
|
it.each(["{broken", "null"])(
|
|
238
|
-
"
|
|
237
|
+
"closes a malformed stream and ignores subsequent notifications: %s",
|
|
239
238
|
(data) => {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
expect(store.get(connectionAtom)).toEqual({
|
|
254
|
-
state: ConnectionState.OPEN,
|
|
255
|
-
});
|
|
256
|
-
receive({
|
|
257
|
-
data: {
|
|
239
|
+
receive({ event: "marimo", data: { marimo: { op: "reconnected" } } });
|
|
240
|
+
act(() =>
|
|
241
|
+
getTransportHandlers().onMessage(new MessageEvent("message", { data })),
|
|
242
|
+
);
|
|
243
|
+
expect(store.get(connectionAtom)).toEqual({
|
|
244
|
+
state: ConnectionState.CLOSED,
|
|
245
|
+
code: "KERNEL_DISCONNECTED",
|
|
246
|
+
reason: "Failed to decode notebook message",
|
|
247
|
+
});
|
|
248
|
+
receive({
|
|
249
|
+
event: "marimo",
|
|
250
|
+
data: {
|
|
251
|
+
marimo: {
|
|
258
252
|
op: "completed-run",
|
|
259
253
|
run_id: "r1",
|
|
260
254
|
outcome: "succeeded",
|
|
261
255
|
error: null,
|
|
262
256
|
},
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
toast.mockRestore();
|
|
267
|
-
}
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
expect(store.get(initialRunCompletedAtom)).toBe(false);
|
|
268
260
|
},
|
|
269
261
|
);
|
|
270
262
|
|
|
@@ -90,6 +90,23 @@ describe("SseTransport", () => {
|
|
|
90
90
|
expect(messages[1].data).toBe("line1\nline2");
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
+
it("preserves host event names and cursors without carrying IDs into snapshots", async () => {
|
|
94
|
+
const { stream, push } = createControllableStream();
|
|
95
|
+
fetchMock.mockResolvedValueOnce(sseResponse(stream));
|
|
96
|
+
transport.reconnect();
|
|
97
|
+
await vi.waitFor(() => expect(opens).toHaveLength(1));
|
|
98
|
+
|
|
99
|
+
push("id: cursor-1\nevent: rea");
|
|
100
|
+
push("dy\ndata: {}\n\n: keep-alive\n\nevent: reset\ndata: {}\n\n");
|
|
101
|
+
push('event: marimo\ndata: {"marimo":\ndata: {"op":"reconnected"}}\n\n');
|
|
102
|
+
await vi.waitFor(() => expect(messages).toHaveLength(3));
|
|
103
|
+
expect(messages.map((message) => JSON.parse(message.data))).toEqual([
|
|
104
|
+
{ event: "ready", id: "cursor-1", data: {} },
|
|
105
|
+
{ event: "reset", data: {} },
|
|
106
|
+
{ event: "marimo", data: { marimo: { op: "reconnected" } } },
|
|
107
|
+
]);
|
|
108
|
+
});
|
|
109
|
+
|
|
93
110
|
it("ignores keep-alive comments", async () => {
|
|
94
111
|
const { stream, push } = createControllableStream();
|
|
95
112
|
fetchMock.mockResolvedValueOnce(sseResponse(stream));
|
|
@@ -218,16 +218,20 @@ export class SseTransport implements IConnectionTransport {
|
|
|
218
218
|
const decoder = new TextDecoder();
|
|
219
219
|
let buffer = "";
|
|
220
220
|
let eventName: string | null = null;
|
|
221
|
+
let eventId: string | null = null;
|
|
221
222
|
let dataLines: string[] = [];
|
|
222
223
|
|
|
223
224
|
const dispatch = (): ServerClose | null => {
|
|
224
225
|
if (dataLines.length === 0) {
|
|
225
226
|
eventName = null;
|
|
227
|
+
eventId = null;
|
|
226
228
|
return null;
|
|
227
229
|
}
|
|
228
230
|
const data = dataLines.join("\n");
|
|
229
231
|
const name = eventName;
|
|
232
|
+
const id = eventId;
|
|
230
233
|
eventName = null;
|
|
234
|
+
eventId = null;
|
|
231
235
|
dataLines = [];
|
|
232
236
|
if (name === "close") {
|
|
233
237
|
return parseServerClose(data);
|
|
@@ -236,9 +240,15 @@ export class SseTransport implements IConnectionTransport {
|
|
|
236
240
|
// (rather than on open, so a server that accepts and immediately
|
|
237
241
|
// closes cannot retry forever).
|
|
238
242
|
this.retryCount = 0;
|
|
243
|
+
// Normalize SSE fields into the same envelope as host WebSockets.
|
|
244
|
+
// Leave the payload text intact for the client's JSON decoder.
|
|
245
|
+
const envelope =
|
|
246
|
+
name === null
|
|
247
|
+
? data
|
|
248
|
+
: `{"event":${JSON.stringify(name)},"data":${data}${id === null ? "" : `,"id":${JSON.stringify(id)}`}}`;
|
|
239
249
|
this.subscriptions.notify(
|
|
240
250
|
"message",
|
|
241
|
-
new MessageEvent("message", { data }),
|
|
251
|
+
new MessageEvent("message", { data: envelope }),
|
|
242
252
|
);
|
|
243
253
|
return null;
|
|
244
254
|
};
|
|
@@ -284,8 +294,10 @@ export class SseTransport implements IConnectionTransport {
|
|
|
284
294
|
dataLines.push(fieldValue);
|
|
285
295
|
} else if (field === "event") {
|
|
286
296
|
eventName = fieldValue;
|
|
297
|
+
} else if (field === "id") {
|
|
298
|
+
eventId = fieldValue;
|
|
287
299
|
}
|
|
288
|
-
//
|
|
300
|
+
// The host client owns the cursor; `retry` does not override our policy.
|
|
289
301
|
}
|
|
290
302
|
if (cursor > 0) {
|
|
291
303
|
buffer = buffer.slice(cursor);
|
|
@@ -11,7 +11,6 @@ import type {
|
|
|
11
11
|
import {
|
|
12
12
|
createNotebookClient,
|
|
13
13
|
type NotebookClient,
|
|
14
|
-
type NotebookConnection,
|
|
15
14
|
} from "../host/notebook-client";
|
|
16
15
|
import { classifyCloseEvent } from "./connection-state";
|
|
17
16
|
import { notebookClientAtom } from "./state";
|
|
@@ -21,24 +20,20 @@ import {
|
|
|
21
20
|
} from "./transports/create";
|
|
22
21
|
|
|
23
22
|
type Options = ConnectionTransportOptions & {
|
|
24
|
-
sessionId: string;
|
|
25
|
-
messageFormat: NotebookConnection["messageFormat"];
|
|
26
23
|
waitUntilReady: () => Promise<void>;
|
|
27
24
|
checkHealth: () => Promise<boolean>;
|
|
28
25
|
onNotification: (notification: NotificationPayload) => void;
|
|
29
|
-
onMessageError: NotebookConnection["onMessageError"];
|
|
30
26
|
};
|
|
31
27
|
|
|
32
28
|
export function useNotebookClient(options: Options): NotebookClient {
|
|
33
29
|
const store = useStore();
|
|
34
|
-
const {
|
|
30
|
+
const { static: isStatic, transportType } = options;
|
|
35
31
|
const controller = useMemo(() => createNotebookClient(store), [store]);
|
|
36
32
|
const url = useEvent(options.url);
|
|
37
33
|
const headers = useEvent(options.headers);
|
|
38
34
|
const waitUntilReady = useEvent(options.waitUntilReady);
|
|
39
35
|
const checkHealth = useEvent(options.checkHealth);
|
|
40
36
|
const onNotification = useEvent(options.onNotification);
|
|
41
|
-
const onMessageError = useEvent(options.onMessageError);
|
|
42
37
|
|
|
43
38
|
useEffect(() => {
|
|
44
39
|
const lifetime = new AbortController();
|
|
@@ -52,11 +47,9 @@ export function useNotebookClient(options: Options): NotebookClient {
|
|
|
52
47
|
transportType,
|
|
53
48
|
}),
|
|
54
49
|
url,
|
|
55
|
-
messageFormat,
|
|
56
50
|
signal: lifetime.signal,
|
|
57
51
|
waitUntilReady,
|
|
58
52
|
checkHealth,
|
|
59
|
-
onMessageError,
|
|
60
53
|
// The host validates the envelope, not the native notification contents.
|
|
61
54
|
onNotification: (notification) =>
|
|
62
55
|
onNotification({ data: notification as NotificationMessage }),
|
|
@@ -72,16 +65,13 @@ export function useNotebookClient(options: Options): NotebookClient {
|
|
|
72
65
|
}, [
|
|
73
66
|
controller,
|
|
74
67
|
store,
|
|
75
|
-
sessionId,
|
|
76
68
|
isStatic,
|
|
77
69
|
transportType,
|
|
78
|
-
messageFormat,
|
|
79
70
|
url,
|
|
80
71
|
headers,
|
|
81
72
|
waitUntilReady,
|
|
82
73
|
checkHealth,
|
|
83
74
|
onNotification,
|
|
84
|
-
onMessageError,
|
|
85
75
|
]);
|
|
86
76
|
|
|
87
77
|
return controller.client;
|
|
@@ -65,7 +65,7 @@ import { type LayoutState, useLayoutActions } from "../layout/state";
|
|
|
65
65
|
import { kioskModeAtom } from "../mode";
|
|
66
66
|
import { connectionAtom, startupProgressAtom } from "../network/connection";
|
|
67
67
|
import type { RequestId } from "../network/DeferredRequestRegistry";
|
|
68
|
-
import {
|
|
68
|
+
import { useRuntimeManager } from "../runtime/config";
|
|
69
69
|
import { SECRETS_REGISTRY } from "../secrets/request-registry";
|
|
70
70
|
import { isStaticNotebook } from "../static/static-state";
|
|
71
71
|
import {
|
|
@@ -135,7 +135,6 @@ export function useNotebookSession(opts: {
|
|
|
135
135
|
const setStableSessionId = useSetAtom(stableSessionIdAtom);
|
|
136
136
|
const setCapabilities = useSetAtom(capabilitiesAtom);
|
|
137
137
|
const runtimeManager = useRuntimeManager();
|
|
138
|
-
const { notebookId } = useAtomValue(runtimeConfigAtom);
|
|
139
138
|
const transportType = useAtomValue(connectionTransportTypeAtom);
|
|
140
139
|
const setCacheInfo = useSetAtom(cacheInfoAtom);
|
|
141
140
|
const setKernelStartupError = useSetAtom(kernelStartupErrorAtom);
|
|
@@ -411,11 +410,8 @@ export function useNotebookSession(opts: {
|
|
|
411
410
|
});
|
|
412
411
|
};
|
|
413
412
|
const notebook = useNotebookClient({
|
|
414
|
-
sessionId,
|
|
415
413
|
static: isStaticNotebook(),
|
|
416
414
|
transportType,
|
|
417
|
-
messageFormat:
|
|
418
|
-
notebookId && transportType === "websocket" ? "host" : "session",
|
|
419
415
|
url: () =>
|
|
420
416
|
transportType === "sse"
|
|
421
417
|
? runtimeManager.getSseURL(sessionId).toString()
|
|
@@ -428,7 +424,6 @@ export function useNotebookSession(opts: {
|
|
|
428
424
|
}
|
|
429
425
|
},
|
|
430
426
|
checkHealth: () => runtimeManager.reconcileFromHealth(),
|
|
431
|
-
onMessageError,
|
|
432
427
|
onNotification: (notification) => {
|
|
433
428
|
try {
|
|
434
429
|
handleNotification(notification);
|
package/src/mount.tsx
CHANGED
|
@@ -274,8 +274,6 @@ const mountOptionsSchema = z.object({
|
|
|
274
274
|
.transform((val) => val as api.Notebook["NotebookV1"]),
|
|
275
275
|
]),
|
|
276
276
|
|
|
277
|
-
notebookId: z.string().optional(),
|
|
278
|
-
|
|
279
277
|
/**
|
|
280
278
|
* Runtime configs
|
|
281
279
|
*/
|
|
@@ -286,7 +284,6 @@ const mountOptionsSchema = z.object({
|
|
|
286
284
|
// Lazy by default, but can be overridden by the runtime config
|
|
287
285
|
lazy: z.boolean().default(true),
|
|
288
286
|
authToken: z.string().nullish(),
|
|
289
|
-
notebookId: z.string().optional(),
|
|
290
287
|
}),
|
|
291
288
|
)
|
|
292
289
|
.nullish()
|
|
@@ -367,7 +364,6 @@ function initStore(options: unknown) {
|
|
|
367
364
|
} else {
|
|
368
365
|
store.set(runtimeConfigAtom, {
|
|
369
366
|
...DEFAULT_RUNTIME_CONFIG,
|
|
370
|
-
notebookId: parsedOptions.data.notebookId,
|
|
371
367
|
lazy: false,
|
|
372
368
|
serverToken: parsedOptions.data.serverToken,
|
|
373
369
|
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,d as n,f as r,l as i,r as a,t as o,u as s}from"./useEvent-Dfcbgjhg.js";import{t as c}from"./react-DVplv7_D.js";import{Ao as l,D as u,Kr as d,Oa as f,Q as p,Qr as m,Z as h,Za as g,ai as _,b as v,ka as y,no as b,qa as x,ut as S}from"./cells-BdgzY0of.js";import{A as C}from"./config-BwHT0yGp.js";import{t as w}from"./compiler-runtime-BrajqUja.js";import{i as T,r as E,x as D}from"./config-DGX7JYor.js";import{g as O,p as k}from"./useEventListener-CjDeLqFC.js";import{t as A}from"./invariant-Ci2dTZ72.js";import{a as j,i as M,o as ee,p as te,r as N,s as P,t as F}from"./config-DXjnAwtL.js";import{r as ne,v as re}from"./session-B8Y-GJnS.js";import{t as ie}from"./cn-ldLVeaqm.js";import{t as ae}from"./jsx-runtime-B74pBk57.js";import{a as oe,p as se,r as ce,t as le}from"./dropdown-menu-DS6umAnH.js";import{t as I}from"./tooltip-CkGm8X7m.js";import{r as ue,t as L}from"./button-D8gVKwe-.js";import{t as R}from"./createLucideIcon-DfJ2oMlA.js";import{t as de}from"./check-BQNapYaf.js";import{a as fe}from"./useNumberFormatter-D7O_26UI.js";import{t as pe}from"./chevron-right-eAtVhbNZ.js";import{t as me}from"./hat-glasses-C8RhSVii.js";import{p as z}from"./write-secret-modal-usRSi1bb.js";import{t as he}from"./package-GSoSTiIK.js";import{l as ge,r as _e}from"./datasource-dKk3JHSQ.js";import{t as ve}from"./use-toast-Wu434mLr.js";import{n as ye}from"./strings-C25fhMR_.js";import{a as be}from"./dist-DusFODSa.js";import{t as xe}from"./uuid-k9DpjH68.js";import{t as Se}from"./RenderHTML-BFaztTR0.js";import{t as Ce,u as we}from"./useInstallPackage-CVItDn1e.js";import{a as Te,r as Ee}from"./errors-CNsgAw6m.js";import{t as De}from"./kbd-pdKBv96t.js";import{t as Oe}from"./error-entries-CJS0gOId.js";import{r as ke,t as Ae}from"./alert-DTaqCu_d.js";import{n as je,o as Me}from"./state-CVgqwwCU.js";import{n as B}from"./cell-link-DFPHORAO.js";var Ne=R(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),V=R(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),Pe=R(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),H=e(c(),1),U=w(),Fe=`Fix this notebook error.`;function Ie(e,t){let n,r;return`errors`in t?(n=t.errors.map(Oe).join(`
|
|
2
|
-
`),r=t.errors.flatMap(e=>`traceback`in e&&e.traceback?[h(S(e.traceback))]:[]).join(`
|
|
3
|
-
|
|
4
|
-
`)):(r=t.tracebackFormat===`html`?h(S(t.traceback)):t.traceback,n=r.split(`
|
|
5
|
-
`).findLast(e=>e.length>0)??``),{type:`cell-output`,cell_id:e,output:{type:`error`,instructions:Fe,message:n,...r?{traceback:r}:{}},...t.code===void 0?{}:{code:t.code}}}var Le=String.raw`_cell_([^\W_][\w-]*?)(_\w*)`,Re=String.raw`(?<!_)${Le}`;RegExp(`^${Le}$`);var ze=new RegExp(Re),W=new RegExp(Re,`g`);function Be(e){let t=[];W.lastIndex=0;let n=0,r=W.exec(e);for(;r!==null;)r.index>n&&t.push(e.slice(n,r.index)),t.push({cellId:r[1],name:r[2]}),n=r.index+r[0].length,r=W.exec(e);return n<e.length&&t.push(e.slice(n)),t}function Ve(e){return ze.test(e)}function He(e){let t=null,n=e.cursor();do n.name===`ExpressionStatement`&&(t=n.node);while(n.next());return t}function Ue(e){let t=e.split(`
|
|
6
|
-
`),n=` `,r=He(be.parse(e));if(!r)return[`def _():`,...G(t,n),`${n}return`,``,``,`_()`].join(`
|
|
7
|
-
`);let i=e.slice(0,r.from).trim(),a=e.slice(r.from).trim(),o=i.split(`
|
|
8
|
-
`),s=a.split(`
|
|
9
|
-
`);return[`def _():`,...G(o,n),`${n}return ${s[0]}`,...G(s.slice(1),n),``,``,`_()`].join(`
|
|
10
|
-
`)}function G(e,t){if(e.length===1&&e[0]===``)return[];let n=[];for(let r of e)r===``?n.push(``):n.push(t+r);return n}function We(e,t){if(e.type===`multiple-defs`)return[{title:`Fix: Wrap in a function`,description:`Make this cell's variables local by wrapping the cell in a function.`,fixType:`manual`,onFix:async e=>{A(e.editor,`Editor is null`);let t=Ue(e.editor.state.doc.toString());e.editor.dispatch({changes:{from:0,to:e.editor.state.doc.length,insert:t}})}}];if(e.type===`exception`&&e.exception_type===`NameError`){let t=e.msg.match(/name '(.+)' is not defined/)?.[1];if(!t||!(t in Ke))return[];let n=Ge(t);return[{title:`Fix: Add '${n}'`,description:`Add a new cell for the missing import`,fixType:`manual`,onFix:async e=>{e.addCodeBelow(n)}}]}return e.type===`sql-error`&&t.aiEnabled?[{title:`Fix with AI`,description:`Fix the SQL statement`,fixType:`ai`,onFix:async t=>{let n=_e(t.cellId,a),r=`Fix the SQL statement: ${e.msg}.`;n&&(r+=`\nDatabase schema: ${n}`),t.aiFix?.setAiCompletionCell({cellId:t.cellId,initialPrompt:r,triggerImmediately:t.aiFix.triggerFix})}}]:[]}function Ge(e){let t=Ke[e];return t===e?`import ${t}`:`import ${t} as ${e}`}var Ke={mo:`marimo`,alt:`altair`,bokeh:`bokeh`,dask:`dask`,np:`numpy`,pd:`pandas`,pl:`polars`,plotly:`plotly`,plt:`matplotlib.pyplot`,px:`plotly.express`,scipy:`scipy`,sk:`sklearn`,sns:`seaborn`,stats:`scipy.stats`,tf:`tensorflow`,torch:`torch`,xr:`xarray`,dt:`datetime`,json:`json`,math:`math`,os:`os`,re:`re`,sys:`sys`},K=C(`marimo:acp:sessions:v1`,{sessions:[],activeTabId:null},m),qe=r(e=>{let t=e(K);return t.activeTabId&&t.sessions.find(e=>e.tabId===t.activeTabId)||null},(e,t,n)=>{t(K,e=>({...e,activeTabId:n}))});function Je(){return`tab_${xe()}`}function Ye(e,t=20){return e.length<=t?e:`${e.slice(0,t-3)}...`}function Xe(e,t){let n=it(t.agentId),r=Date.now(),i=t.firstMessage?Ye(t.firstMessage.trim()):`New ${t.agentId} session`,a=Je();if(n===`single`){let n=e.sessions.filter(e=>e.agentId===t.agentId),a=e.sessions.filter(e=>e.agentId!==t.agentId);if(n.length>0){let o=n[0],s={agentId:t.agentId,title:i,createdAt:r,lastUsedAt:r,tabId:o.tabId,externalAgentSessionId:null,selectedModel:t.model??o.selectedModel??null};return{...e,sessions:[...a.slice(0,0),s],activeTabId:s.tabId}}}return{...e,sessions:[...e.sessions.slice(0,0),{agentId:t.agentId,tabId:a,title:i,createdAt:r,lastUsedAt:r,externalAgentSessionId:null,selectedModel:t.model??null}],activeTabId:a}}function Ze(e,t){let n=e.sessions.filter(e=>e.tabId!==t);return{sessions:n,activeTabId:e.activeTabId===t?n.length>0?n[n.length-1].tabId:null:e.activeTabId}}function Qe(e,t){let n=e.activeTabId;return n?{...e,sessions:e.sessions.map(e=>e.tabId===n?{...e,title:Ye(t)}:e)}:e}function $e(e,t){return{...e,sessions:e.sessions.map(e=>e.tabId===t?{...e,lastUsedAt:Date.now()}:e)}}function et(e,t){let n=e.activeTabId;return n?{...e,sessions:e.sessions.map(e=>e.tabId===n?{...e,externalAgentSessionId:t,lastUsedAt:Date.now()}:e)}:e}function tt(){return[`claude`,`gemini`,`codex`,`opencode`,`cursor`]}function nt(e){return ye(e)}function rt(e){let t=q[e].port,n=window.location.hostname;return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${n}:${t}/message`}var q={claude:{port:3017,command:`npx @agentclientprotocol/claude-agent-acp`,sessionSupport:`single`},gemini:{port:3019,command:`npx @google/gemini-cli --experimental-acp`,sessionSupport:`single`},codex:{port:3021,command:`npx @zed-industries/codex-acp`,sessionSupport:`single`},opencode:{port:3023,command:`npx opencode-ai acp`,sessionSupport:`single`},cursor:{port:3025,command:`agent acp`,sessionSupport:`single`}};function it(e){return q[e].sessionSupport}function at(e){let t=q[e].port,n=q[e].command;return`npx stdio-to-ws "${k()?`cmd /c ${n}`:n}" --port ${t}`}var ot=C(`marimo:chrome:ai-panel-tab`,`chat`,m);function st(){let e=(0,U.c)(3),[n,r]=t(ot),i;return e[0]!==n||e[1]!==r?(i={aiPanelTab:n,setAiPanelTab:r},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}var ct=`code_mode`;function lt(e,t){return e||(_(`external_agents`)?t:`chat`)}function ut(){let e=(0,U.c)(6),{openApplication:t}=d(),{setAiPanelTab:r}=st(),{saveModeChange:i}=F(),a=s(Me),c=n(),l;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==c?(l=async e=>{let n=lt(e.panel,c.get(ot)),o=c.get(T),s=_(`external_agents`)&&c.get(K).sessions.length>0;if(!(n===`agents`?s:o)){ve({title:n===`agents`?`No agent session`:`AI not configured`,description:n===`agents`?`Start an agent session or switch to the chat panel.`:`Configure an AI provider and chat model to fix with AI.`,variant:`danger`});return}e.panel&&r(e.panel),n===`chat`&&await i(ct).catch(dt),a({prompt:e.prompt,submit:e.submit??!1}),t(`ai`)},e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=c,e[5]=l):l=e[5],o(l)}function dt(){return O.error(`Failed to save mode change`)}var ft=C(`marimo:ai-autofix-mode`,`autofix`,m);function pt(){let e=(0,U.c)(3),[n,r]=t(ft),i;return e[0]!==n||e[1]!==r?(i={fixMode:n,setFixMode:r},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}var J=ae();function mt(e,t){if(e!=null)return`@error://${e}\n\nPlease fix this error.`;let n=t?.trim();return n?`My code gives the following error. Please fix it:\n\n${n}`:`Please fix this error.`}var Y=e=>{let t=(0,U.c)(25),{errors:r,cellId:a,className:o}=e,c=n(),{createNewCell:l}=u(),d=i(E),f;if(t[0]!==d||t[1]!==r){let e;t[3]===d?e=t[4]:(e=e=>We(e,{aiEnabled:d}),t[3]=d,t[4]=e),f=r.flatMap(e),t[0]=d,t[1]=r,t[2]=f}else f=t[2];let p=f,m=s(je),h=ut();if(p.length===0)return null;let g=p[0],_;t[5]!==a||t[6]!==l||t[7]!==g||t[8]!==m||t[9]!==c?(_=e=>{let t=c.get(v).cellHandles[a].current?.editorView;g.onFix({addCodeBelow:e=>{l({cellId:a,autoFocus:!1,before:!1,code:e})},editor:t,cellId:a,aiFix:{setAiCompletionCell:m,triggerFix:e}}),t?.focus()},t[5]=a,t[6]=l,t[7]=g,t[8]=m,t[9]=c,t[10]=_):_=t[10];let y=_,b;t[11]!==a||t[12]!==h?(b=()=>{h({prompt:mt(a)})},t[11]=a,t[12]=h,t[13]=b):b=t[13];let x=b,S;t[14]===o?S=t[15]:(S=ie(`my-2`,o),t[14]=o,t[15]=S);let C;t[16]!==g.description||t[17]!==g.fixType||t[18]!==g.title||t[19]!==y||t[20]!==x?(C=g.fixType===`ai`?(0,J.jsx)(_t,{tooltip:g.description,openPrompt:()=>y(!1),applyAutofix:()=>y(!0),openChat:x}):(0,J.jsx)(I,{content:g.description,align:`start`,children:(0,J.jsxs)(L,{size:`xs`,variant:`outline`,className:`font-normal`,onClick:()=>y(!1),children:[(0,J.jsx)(ge,{className:`h-3 w-3 mr-2`}),g.title]})}),t[16]=g.description,t[17]=g.fixType,t[18]=g.title,t[19]=y,t[20]=x,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,J.jsx)(`div`,{className:S,children:C}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w},ht={autofix:{Icon:ge,title:`Inline AI Fix`,description:`Apply AI fixes inline in the cell`},chat:{Icon:me,title:`Fix with AI assistant`,description:`Open the AI sidebar to fix`},prompt:{Icon:x,title:`Suggest a prompt`,description:`Edit the prompt before applying`}},gt=[`autofix`,`prompt`,`chat`],_t=e=>{let t=(0,U.c)(18),{tooltip:n,openPrompt:r,applyAutofix:i,openChat:a}=e,{fixMode:o,setFixMode:s}=pt(),c=r;o===`chat`?c=a:o===`autofix`&&(c=i);let{Icon:l,title:u}=ht[o],d;t[0]===l?d=t[1]:(d=(0,J.jsx)(l,{className:`h-3 w-3 mr-2 mb-0.5`}),t[0]=l,t[1]=d);let f;t[2]!==c||t[3]!==d||t[4]!==u?(f=(0,J.jsxs)(L,{size:`xs`,variant:`outline`,className:`font-normal rounded-r-none border-r-0`,onClick:c,children:[d,u]}),t[2]=c,t[3]=d,t[4]=u,t[5]=f):f=t[5];let p;t[6]!==f||t[7]!==n?(p=(0,J.jsx)(I,{content:n,align:`start`,children:f}),t[6]=f,t[7]=n,t[8]=p):p=t[8];let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(se,{asChild:!0,children:(0,J.jsx)(L,{size:`xs`,variant:`outline`,className:`rounded-l-none px-2`,"aria-label":`Fix options`,children:(0,J.jsx)(fe,{className:`h-3 w-3`})})}),t[9]=m):m=t[9];let h;t[10]!==o||t[11]!==s?(h=gt.map(e=>(0,J.jsx)(oe,{className:`flex items-center gap-2`,onClick:()=>s(e),children:(0,J.jsx)(vt,{mode:e,selected:e===o})},e)),t[10]=o,t[11]=s,t[12]=h):h=t[12];let g;t[13]===h?g=t[14]:(g=(0,J.jsxs)(le,{children:[m,(0,J.jsx)(ce,{align:`end`,className:`w-56`,children:h})]}),t[13]=h,t[14]=g);let _;return t[15]!==p||t[16]!==g?(_=(0,J.jsxs)(`div`,{className:`flex`,children:[p,g]}),t[15]=p,t[16]=g,t[17]=_):_=t[17],_},vt=e=>{let t=(0,U.c)(15),{mode:n,selected:r}=e,{Icon:i,title:a,description:o}=ht[n],s;t[0]===i?s=t[1]:(s=(0,J.jsx)(i,{className:`h-4 w-4 shrink-0`}),t[0]=i,t[1]=s);let c;t[2]===a?c=t[3]:(c=(0,J.jsx)(`span`,{className:`font-medium`,children:a}),t[2]=a,t[3]=c);let l;t[4]===o?l=t[5]:(l=(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o}),t[4]=o,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=r&&(0,J.jsx)(de,{className:`h-4 w-4 ml-auto shrink-0`}),t[9]=r,t[10]=d);let f;return t[11]!==s||t[12]!==u||t[13]!==d?(f=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 w-full`,children:[s,u,d]}),t[11]=s,t[12]=u,t[13]=d,t[14]=f):f=t[14],f},yt=e=>{let t=(0,U.c)(12),{local:n}=e,r;t[0]===n.name?r=t[1]:(r=(0,J.jsx)(`span`,{className:`font-code`,children:n.name}),t[0]=n.name,t[1]=r);let i;t[2]===n.cellId?i=t[3]:(i=(0,J.jsx)(B,{cellId:n.cellId}),t[2]=n.cellId,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,J.jsxs)(`div`,{className:`max-w-xs`,children:[`Local variable `,r,` in cell`,` `,i,`.`]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o=a,s;t[7]===n.name?s=t[8]:(s=(0,J.jsx)(`span`,{className:`font-code cursor-help`,children:n.name}),t[7]=n.name,t[8]=s);let c;return t[9]!==s||t[10]!==o?(c=(0,J.jsx)(I,{content:o,children:s}),t[9]=s,t[10]=o,t[11]=c):c=t[11],c},bt=e=>{let t=(0,U.c)(4),{segments:n}=e,r;t[0]===n?r=t[1]:(r=n.map(xt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,J.jsx)(J.Fragment,{children:r}),t[2]=r,t[3]=i),i};function xt(e,t){return typeof e==`string`?(0,J.jsx)(`span`,{children:e},t):(0,J.jsx)(yt,{local:e},t)}var St=r(null),Ct=r(e=>{let t=e(St);return(t?e(t.attachmentsAtom):[]).filter(e=>e.kind===`agent`)});function wt(e){return e.name||`Agent`}function X(e){let t=e.variant===`danger`?5e3:3e3,{dismiss:n}=ve({...e,duration:t});window.setTimeout(n,t)}function Tt({getContent:e}){let t=i(te)?.hostEnabled,n=i(Ct),r=i(ne),[a,o]=(0,H.useState)(!1);return t?(0,J.jsxs)(L,{size:`xs`,variant:`outline`,disabled:a||n.length===0||!r,onClick:async()=>{if(!(a||n.length===0||!r)){o(!0);try{await P.post(`/pair/notebooks/${encodeURIComponent(r)}/messages`,e()),X({title:`Sent to ${n.map(wt).join(`, `)}`})}catch(e){X({variant:`danger`,title:e instanceof Ee&&e.status===409?`No agent attached`:`Could not send error`,description:Te(e)})}finally{o(!1)}}},children:[(0,J.jsx)(Ne,{className:`h-3 w-3 mr-2`}),`Send error to agent`]}):null}var Et=new p,Z=e=>{let t=RegExp(`\x1B\\[[0-9;]*m`,`g`);return e.replaceAll(t,``)},Dt=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function Ot(e){Dt.lastIndex=0;let t=Dt.exec(e);if(!t)return null;let n=t.index+t[0].length,r=e.slice(n).split(/\s+/),i=``,a=0;for(let e of r){let t=e.trim();if(!t)continue;if(t.startsWith(`-`)){a+=t.length+1;continue}let n=t.match(/^[\w,.[\]-]+/);if(n){i=n[0];break}break}if(!i)return null;let o=n+a+i.length;return{package:i,endIndex:o}}function Q(e,t=``){if(!e)return null;if(!/https?:\/\//.test(e))return e;let n=l(e);return n.length===1&&n[0].type===`text`?e:(0,J.jsx)(J.Fragment,{children:n.map((e,n)=>{let r=t?`${t}-${n}`:n;if(e.type===`url`){let t=Z(e.url);return(0,J.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:ue.stopPropagation(),className:`text-link hover:underline`,children:t},r)}if(e.type===`image`){let t=Z(e.url);return(0,J.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:ue.stopPropagation(),className:`text-link hover:underline`,children:t},r)}return(0,J.jsx)(H.Fragment,{children:e.value},r)})})}var kt=e=>{let t=(0,U.c)(6),{packages:n,children:r}=e,{handleInstallPackages:i}=Ce(),a;t[0]!==i||t[1]!==n?(a=e=>{i(n),e.preventDefault()},t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==r||t[4]!==a?(o=(0,J.jsx)(`button`,{onClick:a,className:`text-link hover:underline`,type:`button`,children:r}),t[3]=r,t[4]=a,t[5]=o):o=t[5],o},At=e=>{if(!(e instanceof y.Text))return;let t=Z(e.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(t))return;let n=[],r=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=r.exec(t))!==null;){let e=i.index,r=Ot(t.slice(e));r&&n.push({match:i,result:r})}if(n.length===0)return;let a=[],o=0;if(n.forEach((e,n)=>{let{match:r,result:i}=e,s=r.index,c=s+i.endIndex;if(o<s){let e=t.slice(o,s);a.push((0,J.jsx)(H.Fragment,{children:Q(e,`before-${n}`)},`before-${n}`))}let l=t.slice(s,c);a.push((0,J.jsx)(kt,{packages:[i.package],children:l},`install-${n}`)),o=c}),o<t.length){let e=t.slice(o);a.push((0,J.jsx)(H.Fragment,{children:Q(e,`after`)},`after`))}return(0,J.jsx)(J.Fragment,{children:a})},jt=e=>{if(!(e instanceof y.Text))return;let t=e.data;if(!/https?:\/\//.test(t))return;let n=Q(t);if(typeof n!=`string`)return(0,J.jsx)(J.Fragment,{children:n})},Mt=(...e)=>t=>{for(let n of e){let e=n(t);if(e!==void 0)return e}},Nt=(e,t)=>{let n=Et.ansi_to_html(e),r=f(n,{replace:e=>t(e)});return(0,J.jsx)(`span`,{children:r})},Pt=e=>{let t=(0,U.c)(2),{text:n}=e,r;return t[0]===n?r=t[1]:(r=Nt(n,Mt(At,jt)),t[0]=n,t[1]=r),r},Ft=e=>{let t=(0,U.c)(16),{traceback:n}=e,[r,i]=(0,H.useState)(!0),a;t[0]===r?a=t[1]:(a=()=>i(!r),t[0]=r,t[1]=a);let o=r?`Collapse traceback`:`Expand traceback`,s;t[2]===r?s=t[3]:(s=r?(0,J.jsx)(fe,{className:`h-3 w-3`}):(0,J.jsx)(pe,{className:`h-3 w-3`}),t[2]=r,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.jsx)(`span`,{className:`text-[0.6875rem] uppercase tracking-wider`,children:`Traceback`}),t[4]=c):c=t[4];let l;t[5]!==r||t[6]!==a||t[7]!==o||t[8]!==s?(l=(0,J.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":r,"aria-label":o,className:`flex items-center gap-1 text-muted-foreground/70 hover:text-muted-foreground transition-colors`,children:[s,c]}),t[5]=r,t[6]=a,t[7]=o,t[8]=s,t[9]=l):l=t[9];let u;t[10]!==r||t[11]!==n?(u=r&&(0,J.jsx)(`div`,{className:`font-code text-sm mt-1 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text`,children:Se({html:n})}),t[10]=r,t[11]=n,t[12]=u):u=t[12];let d;return t[13]!==l||t[14]!==u?(d=(0,J.jsxs)(`div`,{className:`mt-2`,children:[l,u]}),t[13]=l,t[14]=u,t[15]=d):d=t[15],d},$=e=>{let t=(0,U.c)(10),n=e.title??`Tip`,r;t[0]===n?r=t[1]:(r=(0,J.jsx)(ee,{className:`pt-2 pb-0 font-normal`,children:n}),t[0]=n,t[1]=r);let i;t[2]===e.children?i=t[3]:(i=(0,J.jsx)(M,{className:`mr-24 text-[0.84375rem]`,wrapperClassName:`pt-0 pb-2`,children:e.children}),t[2]=e.children,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,J.jsxs)(j,{value:`item-1`,className:`text-muted-foreground`,children:[r,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==e.className||t[8]!==a?(o=(0,J.jsx)(N,{type:`single`,collapsible:!0,className:e.className,children:a}),t[7]=e.className,t[8]=a,t[9]=o):o=t[9],o},It=e=>{let t=(0,U.c)(44),{errors:n,cellId:r,code:a,className:o}=e,s=d(),c=i(D).display.cell_output===`above`,l=i(re).mode!==`edit`,u=`This cell wasn't run because it has errors`,f=`destructive`,p=`text-error`,m=null;if(n.some(Lt))u=`Interrupted`;else if(n.some(Rt))u=`An internal error occurred`;else if(n.some(zt))u=`Ancestor prevented from running`,f=`default`,p=`text-secondary-foreground`;else if(n.some(Bt))u=`Ancestor stopped`,f=`default`,p=`text-secondary-foreground`;else if(n.some(Vt))u=`SQL error`;else if(n.some(Ht))u=null,m=`Cell not run`;else{let e;t[0]===n?e=t[1]:(e=n.find(Ut),t[0]=n,t[1]=e);let r=e;r&&`exception_type`in r&&(u=r.exception_type)}let h,_,v,y,x,S;if(t[2]!==f||t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n||t[7]!==c||t[8]!==l||t[9]!==m||t[10]!==p||t[11]!==u){let e=n.filter(Wt),i=n.filter(Gt),a=n.filter(Kt),d=n.filter(qt),C=n.filter(Jt),w=n.filter(Yt),T=n.filter(Xt),E=n.filter(Zt),D=n.filter(Qt),O=n.filter($t),k=n.filter(en),A=n.filter(tn),j=n.filter(nn),M;t[18]===s?M=t[19]:(M=()=>{s.openApplication(`scratchpad`)},t[18]=s,t[19]=M);let ee=M,te=()=>{let t=[];if(k.length>0||A.length>0){let e=k.some(rn),n=!e&&k.some(an);t.push((0,J.jsxs)(`div`,{children:[k.map(on),A.map(sn),e&&(0,J.jsxs)(L,{size:`xs`,variant:`outline`,className:`mt-2 font-normal`,onClick:()=>we(s),children:[(0,J.jsx)(he,{className:`h-3.5 w-3.5 mr-1.5 mb-0.5`}),(0,J.jsx)(`span`,{children:`Open package manager`})]}),n&&(0,J.jsxs)(L,{size:`xs`,variant:`outline`,className:`mt-2 font-normal`,onClick:()=>s.openApplication(`terminal`),children:[(0,J.jsx)(Pe,{className:`h-3.5 w-3.5 mr-1.5`}),(0,J.jsx)(`span`,{children:`Open terminal`})]}),r&&(0,J.jsx)(Y,{errors:[...k,...A],cellId:r})]},`syntax-unknown`))}if(e.length>0&&t.push((0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`The setup cell cannot be run because it has references.`}),(0,J.jsx)(`ul`,{className:`list-disc`,children:e.flatMap(cn)}),r&&(0,J.jsx)(Y,{errors:e,cellId:r}),(0,J.jsxs)($,{title:`Why can't the setup cell have references?`,className:`mb-2`,children:[(0,J.jsx)(`p`,{className:`pb-2`,children:`The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables.`}),(0,J.jsx)(`p`,{className:`py-2`,children:`Try simplifying the setup cell to only contain only necessary variables.`}),(0,J.jsxs)(`p`,{className:`py-2`,children:[(0,J.jsxs)(z,{href:`https://links.marimo.app/errors-setup`,children:[`Learn more at our docs`,` `,(0,J.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`setup-refs`)),i.length>0&&t.push((0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`This cell is in a cycle.`}),(0,J.jsx)(`ul`,{className:`list-disc`,children:i.flatMap(ln)}),r&&(0,J.jsx)(Y,{errors:i,cellId:r}),(0,J.jsxs)($,{title:`What are cycles and how do I resolve them?`,className:`mb-2`,children:[(0,J.jsx)(`p`,{className:`pb-2`,children:`An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug.`}),(0,J.jsx)(`p`,{className:`py-2`,children:`Try merging these cells into a single cell to eliminate the cycle.`}),(0,J.jsxs)(`p`,{className:`py-2`,children:[(0,J.jsxs)(z,{href:`https://links.marimo.app/errors-cycles`,children:[`Learn more at our docs`,` `,(0,J.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`cycle`)),a.length>0){let e=a[0].name;t.push((0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`This cell redefines variables from other cells.`}),a.map(dn),r&&(0,J.jsx)(Y,{errors:a,cellId:r}),(0,J.jsxs)($,{title:`Why can't I redefine variables?`,children:[(0,J.jsx)(`p`,{className:`pb-2`,children:`marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more.`}),(0,J.jsxs)(`p`,{className:`py-2`,children:[`Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., `,(0,J.jsxs)(De,{className:`inline`,children:[`_`,e]}),`). to make them private to this cell.`]}),(0,J.jsxs)(`p`,{className:`py-2`,children:[(0,J.jsxs)(z,{href:`https://links.marimo.app/errors-multiple-definitions`,children:[`Learn more at our docs`,` `,(0,J.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]}),(0,J.jsx)($,{title:`Need a scratchpad?`,children:(0,J.jsxs)(`div`,{className:`flex flex-row gap-2 items-center`,children:[(0,J.jsxs)(L,{size:`xs`,variant:`link`,className:`my-2 font-normal mx-0 px-0`,onClick:ee,children:[(0,J.jsx)(g,{className:`h-3`}),(0,J.jsx)(`span`,{children:`Try the scratchpad`})]}),(0,J.jsx)(`span`,{children:`to experiment without restrictions on variable names.`})]})})]},`multiple-defs`))}return d.length>0&&t.push((0,J.jsxs)(`div`,{children:[d.map(fn),r&&(0,J.jsx)(Y,{errors:d,cellId:r}),(0,J.jsxs)($,{title:"Why can't I use `import *`?",children:[(0,J.jsx)(`p`,{className:`pb-2`,children:`Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution.`}),(0,J.jsx)(`p`,{className:`py-2`,children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,J.jsx)(`p`,{className:`py-2`,children:`Star imports would also silently add names to globals, which would be incompatible with reactive execution.`}),(0,J.jsxs)(`p`,{className:`py-2`,children:[(0,J.jsxs)(z,{href:`https://links.marimo.app/errors-import-star`,children:[`Learn more at our docs`,` `,(0,J.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`import-star`)),C.length>0&&t.push((0,J.jsxs)(`div`,{children:[C.map(pn),r&&(0,J.jsx)(Y,{errors:C,cellId:r})]},`interruption`)),w.length>0&&t.push((0,J.jsxs)(`ul`,{children:[w.map((e,t)=>{if(e.exception_type===`NameError`&&e.msg.startsWith(`name 'mo'`))return(0,J.jsx)(`li`,{className:`my-2`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`name 'mo' is not defined.`}),(0,J.jsxs)(`p`,{className:`text-muted-foreground mt-2`,children:[`The marimo module (imported as`,` `,(0,J.jsx)(De,{className:`inline`,children:`mo`}),`) is required for Markdown, SQL, and UI elements.`]})]})},`exception-${t}`);if(e.exception_type===`NameError`&&e.msg.startsWith(`name '_`)){let n=Be(e.msg);return(0,J.jsx)(`li`,{className:`my-2`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:(0,J.jsx)(bt,{segments:n})}),(0,J.jsxs)(`p`,{className:`text-muted-foreground mt-2`,children:[`Variables prefixed with an underscore are local to a cell`,` `,`(`,(0,J.jsxs)(z,{href:`https://links.marimo.app/local-variables`,children:[`docs`,` `,(0,J.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`).`]}),c&&(0,J.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`See the console area for a traceback.`})]})},`exception-${t}`)}return(0,J.jsx)(`li`,{className:`my-2`,children:e.raising_cell==null?(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:Q(e.msg,`exception-${t}`)}),l&&`traceback`in e&&e.traceback?(0,J.jsx)(Ft,{traceback:e.traceback}):c&&(0,J.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`See the console area for a traceback.`})]}):(0,J.jsxs)(`div`,{children:[Q(e.msg,`exception-${t}`),(0,J.jsx)(B,{cellId:e.raising_cell}),l&&`traceback`in e&&e.traceback&&(0,J.jsx)(Ft,{traceback:e.traceback})]})},`exception-${t}`)}),w.some(mn)&&(0,J.jsx)($,{children:`Fix the error in the mentioned cells, or handle the exceptions with try/except blocks.`}),r&&(0,J.jsx)(Y,{errors:w,cellId:r})]},`exception`)),T.length>0&&t.push((0,J.jsxs)(`ul`,{children:[T.map(hn),r&&(0,J.jsx)(Y,{errors:T,cellId:r}),(0,J.jsx)($,{children:T.some(gn)?`Ensure that the referenced cells define the required variables, or turn off strict execution.`:`Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution.`})]},`strict-exception`)),E.length>0&&t.push((0,J.jsxs)(`div`,{children:[E.map(_n),r&&(0,J.jsx)(Y,{errors:E,cellId:r})]},`internal`)),D.length>0&&t.push((0,J.jsxs)(`div`,{children:[D.map(vn),r&&(0,J.jsx)(Y,{errors:D,cellId:r})]},`ancestor-prevented`)),O.length>0&&t.push((0,J.jsxs)(`div`,{children:[O.map(yn),r&&(0,J.jsx)(Y,{errors:O,cellId:r})]},`ancestor-stopped`)),j.length>0&&t.push((0,J.jsxs)(`div`,{children:[j.map(bn),r&&(0,J.jsx)(Y,{errors:j,cellId:r,className:`mt-2.5`})]},`sql-errors`)),t},N;t[20]===m?N=t[21]:(N=m&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1 font-code text-[0.6875rem] uppercase tracking-wider text-muted-foreground/70`,children:[m,(0,J.jsx)(I,{content:`marimo didn't run this cell because it detected an error.`,delayDuration:200,children:(0,J.jsx)(b,{className:`size-3 cursor-help`})})]}),t[20]=m,t[21]=N);let P;t[22]!==p||t[23]!==u?(P=u&&(0,J.jsx)(ke,{className:`font-code font-medium ${p}`,children:u}),t[22]=p,t[23]=u,t[24]=P):P=t[24];let F;t[25]!==N||t[26]!==P?(F=(0,J.jsxs)(`div`,{className:`space-y-0.5`,children:[N,P]}),t[25]=N,t[26]=P,t[27]=F):F=t[27];let ne=F;h=Ae,y=f,t[28]===o?x=t[29]:(x=ie(`border-none font-code text-sm text-[0.84375rem] p-0 text-muted-foreground normal has-[svg]:pl-0 space-y-2`,o),t[28]=o,t[29]=x),S=ne,_=`flex flex-col gap-4`,v=te(),t[2]=f,t[3]=r,t[4]=s,t[5]=o,t[6]=n,t[7]=c,t[8]=l,t[9]=m,t[10]=p,t[11]=u,t[12]=h,t[13]=_,t[14]=v,t[15]=y,t[16]=x,t[17]=S}else h=t[12],_=t[13],v=t[14],y=t[15],x=t[16],S=t[17];let C;t[30]!==_||t[31]!==v?(C=(0,J.jsx)(`div`,{className:_,children:v}),t[30]=_,t[31]=v,t[32]=C):C=t[32];let w;t[33]!==r||t[34]!==a||t[35]!==n?(w=r&&n.length>0&&(0,J.jsx)(Tt,{getContent:()=>Ie(r,{code:a,errors:n})}),t[33]=r,t[34]=a,t[35]=n,t[36]=w):w=t[36];let T;return t[37]!==h||t[38]!==y||t[39]!==x||t[40]!==S||t[41]!==C||t[42]!==w?(T=(0,J.jsxs)(h,{variant:y,className:x,children:[S,C,w]}),t[37]=h,t[38]=y,t[39]=x,t[40]=S,t[41]=C,t[42]=w,t[43]=T):T=t[43],T};function Lt(e){return e.type===`interruption`}function Rt(e){return e.type===`internal`}function zt(e){return e.type===`ancestor-prevented`}function Bt(e){return e.type===`ancestor-stopped`}function Vt(e){return e.type===`sql-error`}function Ht(e){return e.type===`multiple-defs`||e.type===`cycle`||e.type===`setup-refs`||e.type===`import-star`}function Ut(e){return e.type===`exception`}function Wt(e){return e.type===`setup-refs`}function Gt(e){return e.type===`cycle`}function Kt(e){return e.type===`multiple-defs`}function qt(e){return e.type===`import-star`}function Jt(e){return e.type===`interruption`}function Yt(e){return e.type===`exception`}function Xt(e){return e.type===`strict-exception`}function Zt(e){return e.type===`internal`}function Qt(e){return e.type===`ancestor-prevented`}function $t(e){return e.type===`ancestor-stopped`}function en(e){return e.type===`syntax`}function tn(e){return e.type===`unknown`}function nn(e){return e.type===`sql-error`}function rn(e){return e.msg.includes(`!pip`)}function an(e){return e.msg.includes(`use os.subprocess`)}function on(e,t){return(0,J.jsx)(`pre`,{children:Q(e.msg,`syntax-${t}`)},`syntax-${t}`)}function sn(e,t){return(0,J.jsx)(`pre`,{children:Q(e.msg,`unknown-${t}`)},`unknown-${t}`)}function cn(e,t){return e.edges_with_vars.map((e,n)=>(0,J.jsxs)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:[(0,J.jsx)(B,{cellId:e[0]}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,` `,e[1].length===1?e[1][0]:e[1].join(`, `)]})]},`setup-refs-${t}-${n}`))}function ln(e,t){return e.edges_with_vars.map((e,n)=>(0,J.jsxs)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:[(0,J.jsx)(B,{cellId:e[0]}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` -> `,e[1].length===1?e[1][0]:e[1].join(`, `),` -> `]}),(0,J.jsx)(B,{cellId:e[2]})]},`cycle-${t}-${n}`))}function un(e,t){return(0,J.jsx)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:(0,J.jsx)(B,{cellId:e})},`cell-${t}`)}function dn(e,t){return(0,J.jsxs)(H.Fragment,{children:[(0,J.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`'${e.name}' was also defined by:`}),(0,J.jsx)(`ul`,{className:`list-disc`,children:e.cells.map(un)})]},`multiple-defs-${t}`)}function fn(e,t){return(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:e.msg},`import-star-${t}`)}function pn(e,t){return(0,J.jsx)(`p`,{children:`This cell was interrupted and needs to be re-run.`},`interruption-${t}`)}function mn(e){return e.raising_cell!=null}function hn(e,t){return(0,J.jsx)(`li`,{className:`my-2`,children:e.blamed_cell==null?(0,J.jsx)(`p`,{children:e.msg}):(0,J.jsxs)(`div`,{children:[e.msg,(0,J.jsx)(B,{cellId:e.blamed_cell})]})},`strict-exception-${t}`)}function gn(e){return e.blamed_cell!=null}function _n(e,t){return(0,J.jsx)(`p`,{children:e.msg},`internal-${t}`)}function vn(e,t){return(0,J.jsxs)(`div`,{children:[e.msg,e.blamed_cell==null?(0,J.jsxs)(`span`,{children:[`(`,(0,J.jsx)(B,{cellId:e.raising_cell}),`)`]}):(0,J.jsxs)(`span`,{children:[`(`,(0,J.jsx)(B,{cellId:e.raising_cell}),`\xA0blames\xA0`,(0,J.jsx)(B,{cellId:e.blamed_cell}),`)`]})]},`ancestor-prevented-${t}`)}function yn(e,t){return(0,J.jsxs)(`div`,{children:[e.msg,(0,J.jsx)(B,{cellId:e.raising_cell})]},`ancestor-stopped-${t}`)}function bn(e,t){return(0,J.jsx)(`div`,{className:`space-y-2 mt-2`,children:(0,J.jsx)(`p`,{className:`text-muted-foreground whitespace-pre-wrap`,children:e.msg})},`sql-error-${t}`)}export{$e as C,Ie as D,Be as E,Pe as O,et as S,Ve as T,it as _,Ct as a,Ze as b,bt as c,ut as d,st as f,nt as g,at as h,X as i,_t as l,K as m,Pt as n,wt as o,Xe as p,Tt as r,St as s,It as t,mt as u,rt as v,Qe as w,qe as x,tt as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,l as t,t as n,u as r}from"./useEvent-Dfcbgjhg.js";import{D as i,In as a,M as o,P as s,gr as c,xo as l,za as u}from"./cells-BdgzY0of.js";import{E as d,v as f}from"./config-BwHT0yGp.js";import{t as p}from"./compiler-runtime-BrajqUja.js";import{p as m}from"./config-DGX7JYor.js";import{g as h}from"./useEventListener-CjDeLqFC.js";import{i as g}from"./utils-B4K466FK.js";import{c as _}from"./session-B8Y-GJnS.js";import{t as v}from"./cn-ldLVeaqm.js";import{t as y}from"./jsx-runtime-B74pBk57.js";import{n as b}from"./paths-bkIFVj8h.js";import{b as x}from"./write-secret-modal-usRSi1bb.js";import{r as S}from"./requests-lt0JK8Jt.js";var C=p();function w(){return t(u)}function T(){let t=(0,C.c)(5),[i]=e(f),a=r(u),{openAlert:o}=x(),{sendRename:s}=S(),c;return t[0]!==i.state||t[1]!==o||t[2]!==s||t[3]!==a?(c=async e=>{let t=m();return i.state===d.OPEN?(_(t=>{e===null?t.delete(g.filePath):t.set(g.filePath,e)}),s({filename:e}).then(()=>(a(e),document.title=t.app_title||b.basename(e)||`Untitled Notebook`,e)).catch(e=>(o(e.message),null))):(o(`Failed to save notebook: not connected to a kernel.`),null)},t[0]=i.state,t[1]=o,t[2]=s,t[3]=a,t[4]=c):c=t[4],n(c)}var E=y(),D=e=>{let t=(0,C.c)(12),{className:n,cellId:r,variant:c,onClick:l,formatCellName:u,skipScroll:d}=e,f=s()[r]??``,p=o().inOrderIds.indexOf(r),{showCellIfHidden:m}=i(),h=u??j,g;t[0]===n?g=t[1]:(g=v(`inline-block cursor-pointer text-link hover:underline`,n),t[0]=n,t[1]=g);let _;t[2]!==r||t[3]!==l||t[4]!==m||t[5]!==d||t[6]!==c?(_=e=>{if(r===`__scratch__`)return!1;m({cellId:r}),e.stopPropagation(),e.preventDefault(),requestAnimationFrame(()=>{A(r,c,d)&&l?.()})},t[2]=r,t[3]=l,t[4]=m,t[5]=d,t[6]=c,t[7]=_):_=t[7];let y=h(a(f,p)),b;return t[8]!==g||t[9]!==_||t[10]!==y?(b=(0,E.jsx)(`div`,{className:g,role:`link`,tabIndex:-1,onClick:_,children:y}),t[8]=g,t[9]=_,t[10]=y,t[11]=b):b=t[11],b},O=e=>{let t=(0,C.c)(2),n;return t[0]===e?n=t[1]:(n=(0,E.jsx)(D,{...e,variant:`destructive`}),t[0]=e,t[1]=n),n},k=e=>{let t=(0,C.c)(10),{cellId:n,lineNumber:r}=e,i=w(),a;t[0]!==n||t[1]!==r?(a=()=>c(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]!==n||t[4]!==i?(o=e=>n===`__scratch__`?`scratch`:`marimo://${i||`untitled`}#cell=${e}`,t[3]=n,t[4]=i,t[5]=o):o=t[5];let s;return t[6]!==n||t[7]!==a||t[8]!==o?(s=(0,E.jsx)(D,{cellId:n,onClick:a,skipScroll:!0,variant:`destructive`,className:`traceback-cell-link`,formatCellName:o}),t[6]=n,t[7]=a,t[8]=o,t[9]=s):s=t[9],s};function A(e,t,n){let r=l.create(e),i=document.getElementById(r),a=i?.classList.contains(`has-error`);return i===null?(h.error(`Cell ${r} not found on page.`),!1):(n||i.scrollIntoView({behavior:`smooth`,block:`center`}),(t===`destructive`||a&&t===void 0)&&(i.classList.add(`error-outline`),setTimeout(()=>{i.classList.remove(`error-outline`)},2e3)),(t===`focus`||!a&&t===void 0)&&(i.classList.add(`focus-outline`),setTimeout(()=>{i.classList.remove(`focus-outline`)},2e3)),!0)}function j(e){return e}export{w as a,A as i,O as n,T as o,k as r,D as t};
|