@marimo-team/frontend 0.23.7-dev50 → 0.23.7-dev52
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-DIS3iCFo.js → CellStatus-DXNmZJpi.js} +1 -1
- package/dist/assets/{JsonOutput-eeHUhz4_.js → JsonOutput-Dxol3ZtH.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-C_s2Utqa.js → MarimoErrorOutput-YGhIA85d.js} +1 -1
- package/dist/assets/{RenderHTML-GX_O9tyW.js → RenderHTML-Dz1OIbOh.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BMODIFpo.js → add-cell-with-ai-hIPYl46r.js} +1 -1
- package/dist/assets/{add-connection-dialog-Dzd39V2c.js → add-connection-dialog-CMR-c9XE.js} +1 -1
- package/dist/assets/{agent-panel-BAN4LsQS.js → agent-panel-DnBAoLsM.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CFx7zgXS.js → ai-model-dropdown-zvokTxf_.js} +1 -1
- package/dist/assets/{app-config-button-XMCeCwhm.js → app-config-button-BjFAqaTN.js} +1 -1
- package/dist/assets/{cell-editor-Cts6KKBo.js → cell-editor-Dak_jwhB.js} +1 -1
- package/dist/assets/{cell-link-DqucEHxF.js → cell-link-pRI-YfIp.js} +1 -1
- package/dist/assets/{cells-CJWUXz1v.js → cells-DbE28H1u.js} +74 -74
- package/dist/assets/{chat-display-D3hLpbGd.js → chat-display-D_nDPZek.js} +1 -1
- package/dist/assets/{chat-panel-y8jUpvvS.js → chat-panel-BktSpl2P.js} +1 -1
- package/dist/assets/{chat-ui-B6oULfnR.js → chat-ui-C0_KcXrv.js} +1 -1
- package/dist/assets/{column-preview-qXG5O_LC.js → column-preview-CNeXQtKn.js} +1 -1
- package/dist/assets/{command-palette-CE-WHL_Z.js → command-palette-CcjZs_TG.js} +1 -1
- package/dist/assets/{common-Dfc8zq5C.js → common-CWRr25jC.js} +1 -1
- package/dist/assets/{components-BxcnsrL3.js → components-Cj3Al1Y6.js} +1 -1
- package/dist/assets/{components-OEABNydc.js → components-DUd0ki0p.js} +1 -1
- package/dist/assets/{datasource-DTg26i09.js → datasource-Prn_GWOB.js} +1 -1
- package/dist/assets/{dependency-graph-panel-DIEzM3vx.js → dependency-graph-panel-DUUCij85.js} +1 -1
- package/dist/assets/{documentation-panel-CL8DLWB8.js → documentation-panel-CB8xalFX.js} +1 -1
- package/dist/assets/{download-DHh51UwN.js → download-DEJbA1IY.js} +1 -1
- package/dist/assets/{edit-page-txENC58E.js → edit-page-BkHYt2if.js} +3 -3
- package/dist/assets/{error-panel-C1f6E7YQ.js → error-panel-DG6AtqLR.js} +1 -1
- package/dist/assets/file-explorer-panel-Co6MlwYD.js +26 -0
- package/dist/assets/{file-icons-BQOxwp7s.js → file-icons-BjTIuMQg.js} +1 -1
- package/dist/assets/{floating-outline-n07aHtSF.js → floating-outline-uy6dAsIe.js} +1 -1
- package/dist/assets/{focus-CmJ1iwZ3.js → focus-0RBjdtZw.js} +1 -1
- package/dist/assets/{form-CHy-k6AI.js → form-DNa2VnwU.js} +1 -1
- package/dist/assets/{home-page-vf_qM8OB.js → home-page-BSuXANlw.js} +1 -1
- package/dist/assets/{hooks-BFV8DhjR.js → hooks-B7pYZHjF.js} +1 -1
- package/dist/assets/{html-to-image-CS4X2edG.js → html-to-image-CIu-0LbU.js} +1 -1
- package/dist/assets/{index-DTnzKdRs.js → index-DySiGerD.js} +4 -4
- package/dist/assets/{kiosk-mode-tMe1OphD.js → kiosk-mode-Ch75k65P.js} +1 -1
- package/dist/assets/{layout-BzITvb58.js → layout-DFhJt7oJ.js} +3 -3
- package/dist/assets/{logs-panel-Dxu-x-VS.js → logs-panel-DR-1BC0S.js} +1 -1
- package/dist/assets/{markdown-renderer-C_hNGAKl.js → markdown-renderer-DGqYztXR.js} +1 -1
- package/dist/assets/{name-cell-input-C3bm2h5H.js → name-cell-input-DwfyLq31.js} +1 -1
- package/dist/assets/{outline-panel-YJ_yN1ON.js → outline-panel-CWunrooQ.js} +1 -1
- package/dist/assets/{packages-panel-DEssvZRX.js → packages-panel-BdcXUFQJ.js} +1 -1
- package/dist/assets/{panels-DcLJ_sFr.js → panels-CJ1t18_z.js} +1 -1
- package/dist/assets/{process-output-G4hcUe0V.js → process-output-CS4QGJvL.js} +1 -1
- package/dist/assets/{radio-group-DkplF0z9.js → radio-group-BS2PIEzV.js} +1 -1
- package/dist/assets/{readonly-python-code-CiB7SZvF.js → readonly-python-code-C5JNX2fu.js} +1 -1
- package/dist/assets/{reveal-component-TQNx-CFf.js → reveal-component-PiSHIrbA.js} +1 -1
- package/dist/assets/{run-page-W5ATFp1J.js → run-page-BovrPK0f.js} +1 -1
- package/dist/assets/{scratchpad-panel-B9b6gk7y.js → scratchpad-panel-CAWFveBD.js} +1 -1
- package/dist/assets/{session-panel-Br71eft2.js → session-panel-BR9h5w96.js} +1 -1
- package/dist/assets/{snippets-panel-CU32gjAk.js → snippets-panel-Y2etH9Qg.js} +1 -1
- package/dist/assets/{state-QBvZnVYO.js → state-1SbOXCLX.js} +1 -1
- package/dist/assets/{state-DQ_uHgcD.js → state-Fa6RzVTL.js} +1 -1
- package/dist/assets/{textarea-WSbqzqT1.js → textarea-wgoQLrBS.js} +1 -1
- package/dist/assets/{tracing-CckKQ3eq.js → tracing-C9PZ0Pr1.js} +1 -1
- package/dist/assets/{tracing-panel-ML726M-W.js → tracing-panel-C20Rk6hU.js} +2 -2
- package/dist/assets/{useCellActionButton-BR00pdte.js → useCellActionButton-D_-iAhme.js} +1 -1
- package/dist/assets/{useDeleteCell-C-ffkF5n.js → useDeleteCell-41mvwiyA.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-CjRA2E1n.js → useDependencyPanelTab-ELdrL73c.js} +1 -1
- package/dist/assets/{useNotebookActions-BJ2NNEh5.js → useNotebookActions-CgN-58GN.js} +1 -1
- package/dist/assets/{useRunCells-DX2yB43w.js → useRunCells-CfHlqXY6.js} +1 -1
- package/dist/assets/{useSplitCell-B9NiIxqj.js → useSplitCell-gHtyz873.js} +1 -1
- package/dist/index.html +22 -22
- package/package.json +1 -1
- package/src/components/editor/file-tree/file-explorer.tsx +12 -2
- package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +152 -0
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +99 -0
- package/src/core/codemirror/go-to-definition/commands.ts +382 -22
- package/src/core/codemirror/go-to-definition/utils.ts +23 -5
- package/dist/assets/file-explorer-panel-CjpptQL3.js +0 -26
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { syntaxTree } from "@codemirror/language";
|
|
4
|
+
import type { EditorState } from "@codemirror/state";
|
|
4
5
|
import { EditorView } from "@codemirror/view";
|
|
6
|
+
import type { SyntaxNode, Tree, TreeCursor } from "@lezer/common";
|
|
7
|
+
|
|
8
|
+
const SCOPE_CREATING_NODES = new Set([
|
|
9
|
+
"FunctionDefinition",
|
|
10
|
+
"LambdaExpression",
|
|
11
|
+
"ArrayComprehensionExpression",
|
|
12
|
+
"SetComprehensionExpression",
|
|
13
|
+
"DictionaryComprehensionExpression",
|
|
14
|
+
"ComprehensionExpression",
|
|
15
|
+
"ClassDefinition",
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const POSITION_SENSITIVE_SCOPES = new Set(["ClassDefinition"]);
|
|
19
|
+
|
|
20
|
+
interface ScopeContext {
|
|
21
|
+
id: number;
|
|
22
|
+
type: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface VariableDeclaration {
|
|
26
|
+
from: number;
|
|
27
|
+
scopeId: number;
|
|
28
|
+
}
|
|
5
29
|
|
|
6
30
|
function goToPosition(view: EditorView, from: number): void {
|
|
7
31
|
view.focus();
|
|
@@ -22,50 +46,386 @@ function goToPosition(view: EditorView, from: number): void {
|
|
|
22
46
|
});
|
|
23
47
|
}
|
|
24
48
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* for a given editor view.
|
|
28
|
-
* @param view The editor view which contains the variable name.
|
|
29
|
-
* @param variableName The name of the variable to select, if found in the editor.
|
|
30
|
-
*/
|
|
31
|
-
export function goToVariableDefinition(
|
|
32
|
-
view: EditorView,
|
|
49
|
+
function findFirstMatchingVariable(
|
|
50
|
+
state: EditorState,
|
|
33
51
|
variableName: string,
|
|
34
|
-
):
|
|
35
|
-
const { state } = view;
|
|
52
|
+
): number | null {
|
|
36
53
|
const tree = syntaxTree(state);
|
|
37
54
|
|
|
38
|
-
let
|
|
39
|
-
let from = 0;
|
|
55
|
+
let from: number | null = null;
|
|
40
56
|
|
|
41
57
|
tree.iterate({
|
|
42
58
|
enter: (node) => {
|
|
43
|
-
if (
|
|
59
|
+
if (from !== null) {
|
|
44
60
|
return false;
|
|
45
|
-
}
|
|
61
|
+
}
|
|
46
62
|
|
|
47
|
-
// Check if the node is an identifier and matches the variable name
|
|
48
63
|
if (
|
|
49
64
|
node.name === "VariableName" &&
|
|
50
65
|
state.doc.sliceString(node.from, node.to) === variableName
|
|
51
66
|
) {
|
|
52
67
|
from = node.from;
|
|
53
|
-
|
|
54
|
-
return false; // Stop traversal
|
|
68
|
+
return false;
|
|
55
69
|
}
|
|
56
70
|
|
|
57
|
-
// Skip comments and strings
|
|
58
71
|
if (node.name === "Comment" || node.name === "String") {
|
|
59
72
|
return false;
|
|
60
73
|
}
|
|
74
|
+
|
|
75
|
+
return undefined;
|
|
61
76
|
},
|
|
62
77
|
});
|
|
63
78
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
return from;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function getScopeChain(tree: Tree, usagePosition: number): ScopeContext[] {
|
|
83
|
+
const scopeChain: ScopeContext[] = [];
|
|
84
|
+
let currentNode: SyntaxNode | null = tree.resolveInner(usagePosition, 0);
|
|
85
|
+
|
|
86
|
+
while (currentNode) {
|
|
87
|
+
if (SCOPE_CREATING_NODES.has(currentNode.name)) {
|
|
88
|
+
// Skip ClassDefinition if we've already seen a function/lambda.
|
|
89
|
+
const inFunctionLikeScope = scopeChain.some(
|
|
90
|
+
(scope) =>
|
|
91
|
+
scope.type === "FunctionDefinition" ||
|
|
92
|
+
scope.type === "LambdaExpression",
|
|
93
|
+
);
|
|
94
|
+
if (!(inFunctionLikeScope && currentNode.name === "ClassDefinition")) {
|
|
95
|
+
scopeChain.push({
|
|
96
|
+
id: currentNode.from,
|
|
97
|
+
type: currentNode.name,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
currentNode = currentNode.parent;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
scopeChain.push({ id: -1, type: "global" });
|
|
105
|
+
return scopeChain;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function addDeclaration(
|
|
109
|
+
declarations: VariableDeclaration[],
|
|
110
|
+
scopeId: number,
|
|
111
|
+
from: number,
|
|
112
|
+
) {
|
|
113
|
+
declarations.push({ scopeId, from });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function traverseChildren(
|
|
117
|
+
cursor: TreeCursor,
|
|
118
|
+
callback: (node: SyntaxNode) => void,
|
|
119
|
+
) {
|
|
120
|
+
if (cursor.firstChild()) {
|
|
121
|
+
do {
|
|
122
|
+
callback(cursor.node);
|
|
123
|
+
} while (cursor.nextSibling());
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function collectMatchingTargets(
|
|
128
|
+
cursor: TreeCursor,
|
|
129
|
+
state: EditorState,
|
|
130
|
+
variableName: string,
|
|
131
|
+
scopeId: number,
|
|
132
|
+
declarations: VariableDeclaration[],
|
|
133
|
+
) {
|
|
134
|
+
switch (cursor.name) {
|
|
135
|
+
case "VariableName":
|
|
136
|
+
if (state.doc.sliceString(cursor.from, cursor.to) === variableName) {
|
|
137
|
+
addDeclaration(declarations, scopeId, cursor.from);
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
|
|
141
|
+
case "TupleExpression":
|
|
142
|
+
case "ArrayExpression": {
|
|
143
|
+
const childCursor = cursor.node.cursor();
|
|
144
|
+
childCursor.firstChild();
|
|
145
|
+
do {
|
|
146
|
+
collectMatchingTargets(
|
|
147
|
+
childCursor,
|
|
148
|
+
state,
|
|
149
|
+
variableName,
|
|
150
|
+
scopeId,
|
|
151
|
+
declarations,
|
|
152
|
+
);
|
|
153
|
+
} while (childCursor.nextSibling());
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
default:
|
|
157
|
+
break;
|
|
67
158
|
}
|
|
68
|
-
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function collectFunctionParameters(
|
|
162
|
+
node: SyntaxNode | Tree,
|
|
163
|
+
state: EditorState,
|
|
164
|
+
variableName: string,
|
|
165
|
+
scopeId: number,
|
|
166
|
+
declarations: VariableDeclaration[],
|
|
167
|
+
) {
|
|
168
|
+
const cursor = node.cursor();
|
|
169
|
+
cursor.firstChild();
|
|
170
|
+
do {
|
|
171
|
+
if (cursor.name !== "ParamList") {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const paramCursor = cursor.node.cursor();
|
|
176
|
+
paramCursor.firstChild();
|
|
177
|
+
do {
|
|
178
|
+
if (
|
|
179
|
+
paramCursor.name === "VariableName" &&
|
|
180
|
+
state.doc.sliceString(paramCursor.from, paramCursor.to) === variableName
|
|
181
|
+
) {
|
|
182
|
+
addDeclaration(declarations, scopeId, paramCursor.from);
|
|
183
|
+
}
|
|
184
|
+
} while (paramCursor.nextSibling());
|
|
185
|
+
} while (cursor.nextSibling());
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function collectForTargets(
|
|
189
|
+
node: SyntaxNode | Tree,
|
|
190
|
+
state: EditorState,
|
|
191
|
+
variableName: string,
|
|
192
|
+
scopeId: number,
|
|
193
|
+
declarations: VariableDeclaration[],
|
|
194
|
+
) {
|
|
195
|
+
const cursor = node.cursor();
|
|
196
|
+
cursor.firstChild();
|
|
197
|
+
let foundFor = false;
|
|
198
|
+
do {
|
|
199
|
+
if (cursor.name === "for") {
|
|
200
|
+
foundFor = true;
|
|
201
|
+
} else if (foundFor && cursor.name === "in") {
|
|
202
|
+
break;
|
|
203
|
+
} else if (foundFor) {
|
|
204
|
+
collectMatchingTargets(
|
|
205
|
+
cursor,
|
|
206
|
+
state,
|
|
207
|
+
variableName,
|
|
208
|
+
scopeId,
|
|
209
|
+
declarations,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
} while (cursor.nextSibling());
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function collectMatchingDeclarations(
|
|
216
|
+
node: SyntaxNode | Tree,
|
|
217
|
+
state: EditorState,
|
|
218
|
+
variableName: string,
|
|
219
|
+
scopeStack: number[],
|
|
220
|
+
declarations: VariableDeclaration[],
|
|
221
|
+
) {
|
|
222
|
+
const cursor = node.cursor();
|
|
223
|
+
const nodeName = cursor.name;
|
|
224
|
+
const nodeStart = cursor.from;
|
|
225
|
+
|
|
226
|
+
const isNewScope = SCOPE_CREATING_NODES.has(nodeName);
|
|
227
|
+
const currentScopeStack = isNewScope
|
|
228
|
+
? [...scopeStack, nodeStart]
|
|
229
|
+
: scopeStack;
|
|
230
|
+
const currentScope = currentScopeStack[currentScopeStack.length - 1] ?? -1;
|
|
231
|
+
|
|
232
|
+
switch (nodeName) {
|
|
233
|
+
case "FunctionDefinition":
|
|
234
|
+
case "ClassDefinition": {
|
|
235
|
+
const subCursor = node.cursor();
|
|
236
|
+
subCursor.firstChild();
|
|
237
|
+
do {
|
|
238
|
+
if (
|
|
239
|
+
subCursor.name === "VariableName" &&
|
|
240
|
+
state.doc.sliceString(subCursor.from, subCursor.to) === variableName
|
|
241
|
+
) {
|
|
242
|
+
const parentScope = scopeStack[scopeStack.length - 1] ?? -1;
|
|
243
|
+
addDeclaration(declarations, parentScope, subCursor.from);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
} while (subCursor.nextSibling());
|
|
247
|
+
|
|
248
|
+
if (nodeName === "FunctionDefinition") {
|
|
249
|
+
collectFunctionParameters(
|
|
250
|
+
node,
|
|
251
|
+
state,
|
|
252
|
+
variableName,
|
|
253
|
+
nodeStart,
|
|
254
|
+
declarations,
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
case "LambdaExpression":
|
|
260
|
+
collectFunctionParameters(
|
|
261
|
+
node,
|
|
262
|
+
state,
|
|
263
|
+
variableName,
|
|
264
|
+
nodeStart,
|
|
265
|
+
declarations,
|
|
266
|
+
);
|
|
267
|
+
break;
|
|
268
|
+
|
|
269
|
+
case "ArrayComprehensionExpression":
|
|
270
|
+
case "DictionaryComprehensionExpression":
|
|
271
|
+
case "SetComprehensionExpression":
|
|
272
|
+
case "ComprehensionExpression":
|
|
273
|
+
case "ForStatement":
|
|
274
|
+
collectForTargets(node, state, variableName, currentScope, declarations);
|
|
275
|
+
break;
|
|
276
|
+
|
|
277
|
+
case "AssignStatement": {
|
|
278
|
+
const assignOpPositions: number[] = [];
|
|
279
|
+
const subCursor = node.cursor();
|
|
280
|
+
subCursor.firstChild();
|
|
281
|
+
do {
|
|
282
|
+
if (subCursor.name === "AssignOp") {
|
|
283
|
+
assignOpPositions.push(subCursor.from);
|
|
284
|
+
}
|
|
285
|
+
} while (subCursor.nextSibling());
|
|
286
|
+
|
|
287
|
+
const lastAssignOpPosition =
|
|
288
|
+
assignOpPositions[assignOpPositions.length - 1];
|
|
289
|
+
if (lastAssignOpPosition === undefined) {
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const targetCursor = node.cursor();
|
|
294
|
+
targetCursor.firstChild();
|
|
295
|
+
do {
|
|
296
|
+
if (targetCursor.from < lastAssignOpPosition) {
|
|
297
|
+
collectMatchingTargets(
|
|
298
|
+
targetCursor,
|
|
299
|
+
state,
|
|
300
|
+
variableName,
|
|
301
|
+
currentScope,
|
|
302
|
+
declarations,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
} while (targetCursor.nextSibling());
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
case "ImportStatement": {
|
|
309
|
+
const subCursor = node.cursor();
|
|
310
|
+
subCursor.firstChild();
|
|
311
|
+
do {
|
|
312
|
+
if (
|
|
313
|
+
subCursor.name === "VariableName" &&
|
|
314
|
+
state.doc.sliceString(subCursor.from, subCursor.to) === variableName
|
|
315
|
+
) {
|
|
316
|
+
addDeclaration(declarations, currentScope, subCursor.from);
|
|
317
|
+
}
|
|
318
|
+
} while (subCursor.nextSibling());
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
case "ImportFromStatement": {
|
|
322
|
+
const subCursor = node.cursor();
|
|
323
|
+
subCursor.firstChild();
|
|
324
|
+
let foundImport = false;
|
|
325
|
+
do {
|
|
326
|
+
if (subCursor.name === "import") {
|
|
327
|
+
foundImport = true;
|
|
328
|
+
} else if (
|
|
329
|
+
foundImport &&
|
|
330
|
+
subCursor.name === "VariableName" &&
|
|
331
|
+
state.doc.sliceString(subCursor.from, subCursor.to) === variableName
|
|
332
|
+
) {
|
|
333
|
+
addDeclaration(declarations, currentScope, subCursor.from);
|
|
334
|
+
}
|
|
335
|
+
} while (subCursor.nextSibling());
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
case "TryStatement":
|
|
339
|
+
case "WithStatement": {
|
|
340
|
+
const subCursor = node.cursor();
|
|
341
|
+
subCursor.firstChild();
|
|
342
|
+
let foundAs = false;
|
|
343
|
+
do {
|
|
344
|
+
if (subCursor.name === "as") {
|
|
345
|
+
foundAs = true;
|
|
346
|
+
} else if (
|
|
347
|
+
foundAs &&
|
|
348
|
+
subCursor.name === "VariableName" &&
|
|
349
|
+
state.doc.sliceString(subCursor.from, subCursor.to) === variableName
|
|
350
|
+
) {
|
|
351
|
+
addDeclaration(declarations, currentScope, subCursor.from);
|
|
352
|
+
foundAs = false;
|
|
353
|
+
}
|
|
354
|
+
} while (subCursor.nextSibling());
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
default:
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
traverseChildren(cursor, (childNode) => {
|
|
362
|
+
collectMatchingDeclarations(
|
|
363
|
+
childNode,
|
|
364
|
+
state,
|
|
365
|
+
variableName,
|
|
366
|
+
currentScopeStack,
|
|
367
|
+
declarations,
|
|
368
|
+
);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function findScopedDefinitionPosition(
|
|
373
|
+
state: EditorState,
|
|
374
|
+
variableName: string,
|
|
375
|
+
usagePosition: number,
|
|
376
|
+
): number | null {
|
|
377
|
+
const tree = syntaxTree(state);
|
|
378
|
+
const declarations: VariableDeclaration[] = [];
|
|
379
|
+
|
|
380
|
+
collectMatchingDeclarations(tree, state, variableName, [], declarations);
|
|
381
|
+
|
|
382
|
+
const clampedUsagePosition = Math.max(
|
|
383
|
+
0,
|
|
384
|
+
Math.min(usagePosition, state.doc.length),
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
for (const scope of getScopeChain(tree, clampedUsagePosition)) {
|
|
388
|
+
const match = declarations
|
|
389
|
+
.filter((declaration) => declaration.scopeId === scope.id)
|
|
390
|
+
.filter((declaration) => {
|
|
391
|
+
return POSITION_SENSITIVE_SCOPES.has(scope.type)
|
|
392
|
+
? declaration.from <= clampedUsagePosition
|
|
393
|
+
: true;
|
|
394
|
+
})
|
|
395
|
+
.toSorted((left, right) => left.from - right.from)[0];
|
|
396
|
+
|
|
397
|
+
if (match) {
|
|
398
|
+
return match.from;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* This function will select the first occurrence of the given variable name,
|
|
407
|
+
* for a given editor view.
|
|
408
|
+
* @param view The editor view which contains the variable name.
|
|
409
|
+
* @param variableName The name of the variable to select, if found in the editor.
|
|
410
|
+
* @param usagePosition The position of the variable usage, if available.
|
|
411
|
+
*/
|
|
412
|
+
export function goToVariableDefinition(
|
|
413
|
+
view: EditorView,
|
|
414
|
+
variableName: string,
|
|
415
|
+
usagePosition?: number,
|
|
416
|
+
): boolean {
|
|
417
|
+
const { state } = view;
|
|
418
|
+
const from =
|
|
419
|
+
(usagePosition !== undefined
|
|
420
|
+
? findScopedDefinitionPosition(state, variableName, usagePosition)
|
|
421
|
+
: null) ?? findFirstMatchingVariable(state, variableName);
|
|
422
|
+
|
|
423
|
+
if (from === null) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
goToPosition(view, from);
|
|
428
|
+
return true;
|
|
69
429
|
}
|
|
70
430
|
|
|
71
431
|
/**
|
|
@@ -18,10 +18,16 @@ function getWordUnderCursor(state: EditorState) {
|
|
|
18
18
|
const { from, to } = state.selection.main;
|
|
19
19
|
if (from === to) {
|
|
20
20
|
const { startToken, endToken } = getPositionAtWordBounds(state.doc, from);
|
|
21
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
position: startToken,
|
|
23
|
+
word: state.doc.sliceString(startToken, endToken),
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
return
|
|
27
|
+
return {
|
|
28
|
+
position: from,
|
|
29
|
+
word: state.doc.sliceString(from, to),
|
|
30
|
+
};
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/**
|
|
@@ -51,15 +57,15 @@ function isPrivateVariable(variableName: string) {
|
|
|
51
57
|
*/
|
|
52
58
|
export function goToDefinitionAtCursorPosition(view: EditorView): boolean {
|
|
53
59
|
const { state } = view;
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
60
|
+
const { position, word } = getWordUnderCursor(state);
|
|
61
|
+
if (!word) {
|
|
56
62
|
return false;
|
|
57
63
|
}
|
|
58
64
|
// Close popovers/tooltips
|
|
59
65
|
closeCompletion(view);
|
|
60
66
|
view.dispatch({ effects: closeHoverTooltips });
|
|
61
67
|
|
|
62
|
-
return goToDefinition(view,
|
|
68
|
+
return goToDefinition(view, word, position);
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
/**
|
|
@@ -69,7 +75,19 @@ export function goToDefinitionAtCursorPosition(view: EditorView): boolean {
|
|
|
69
75
|
export function goToDefinition(
|
|
70
76
|
view: EditorView,
|
|
71
77
|
variableName: string,
|
|
78
|
+
usagePosition?: number,
|
|
72
79
|
): boolean {
|
|
80
|
+
if (usagePosition !== undefined) {
|
|
81
|
+
const foundLocally = goToVariableDefinition(
|
|
82
|
+
view,
|
|
83
|
+
variableName,
|
|
84
|
+
usagePosition,
|
|
85
|
+
);
|
|
86
|
+
if (foundLocally) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
73
91
|
// The variable may exist in another cell
|
|
74
92
|
const editorWithVariable = getEditorForVariable(view, variableName);
|
|
75
93
|
if (!editorWithVariable) {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{s as qe}from"./chunk-LvLJmgfZ.js";import{i as It,l as ke,n as ee,p as Ue,u as ye}from"./useEvent-D91BmmQi.js";import{t as Rt}from"./react-Bj1aDYRI.js";import{D as At,Fn as We,Oi as Ge,wi as Et,wr as Ht}from"./cells-CJWUXz1v.js";import"./react-dom-CSu739Rf.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{_ as De}from"./useEventListener-DvoEXWke.js";import{t as Lt}from"./invariant-BUdrueMv.js";import{p as Vt,u as Je}from"./utils-Wvjk_Y4h.js";import{T as _e}from"./config-DGudsRYK.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as Bt}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{n as qt}from"./multi-map-CUuNtzHt.js";import{o as Ut}from"./alert-dialog-BqFLkbUc.js";import"./popover-Bz_0Vkyf.js";import{a as A,c as ue,p as Wt,r as Gt,t as Jt}from"./dropdown-menu-CR7cnzLX.js";import{_t as Me,a as Kt,i as Ke,o as Fe}from"./JsonOutput-eeHUhz4_.js";import{c as Yt,i as ze,r as Ce}from"./download-DHh51UwN.js";import{r as Ye}from"./radio-group-DkplF0z9.js";import{t as E}from"./tooltip-DTV9tlSr.js";import{n as Xt,t as O}from"./button-BbCh-29a.js";import{St as Zt}from"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{n as Qt,r as Pe}from"./requests-DIwGYs0l.js";import{t as re}from"./createLucideIcon-D5guW7EU.js";import{a as Xe,c as Ze,i as Qe,n as Se,o as Te,r as ea,t as ta}from"./state-dx303w7J.js";import{n as aa}from"./LazyAnyLanguageCodeMirror-B2pl_WA3.js";import{t as na}from"./x-C-6liIBr.js";import{n as $e}from"./markdown-renderer-C_hNGAKl.js";import{u as ra}from"./toDate-B5A0DFEz.js";import{t as et}from"./copy-BwrPA9zQ.js";import{t as Oe}from"./external-link-BTNxSavU.js";import{t as sa}from"./eye-off-BT-KOYV5.js";import{a as la,i as tt,n as at,r as oa,t as ia}from"./file-icons-BQOxwp7s.js";import{t as nt}from"./file-HTLbeC2b.js";import{i as rt,r as ca,t as st}from"./add-connection-dialog-Dzd39V2c.js";import{n as Ie,t as da}from"./spinner-UuZAUjoP.js";import{a as ma,c as pa,d as ha,f as xa,i as fa,l as ua,n as ya,r as ja,t as ga,u as ba}from"./file-name-input-CQVbWhL8.js";import{t as lt}from"./plus-CxkHs8QM.js";import{t as ot}from"./refresh-cw-a_9k9BK7.js";import{t as va}from"./save-DZ5aail6.js";import{t as wa}from"./triangle-alert-CJ0ZIqcz.js";import{n as Na,t as ka}from"./es-au8YY-8E.js";import"./dist-DCqxOggh.js";import"./dist-BZr6MMV-.js";import"./dist-BU26XwgJ.js";import"./dist-COs9gIu5.js";import"./dist-DkA__6UI.js";import{t as te}from"./use-toast-ERM44-k9.js";import{t as _a}from"./paths-SFhaqGlE.js";import"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import"./dates-DI1TvEEK.js";import{n as je}from"./copy-Ch48HVPK.js";import{t as Fa}from"./copy-icon-BdZPgXgo.js";import{t as it}from"./context-C1Tm_47t.js";import{n as ct}from"./ImperativeModal-DEC1mXgV.js";import{t as dt}from"./blob-3_FN0u9S.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{n as Ca,t as Sa}from"./alert-DrHguQlr.js";import{n as mt}from"./error-banner-CLO6LFll.js";import{n as Re}from"./useAsyncData-C5i0IRVM.js";import{a as Da,o as pt,t as Ma,u as za}from"./command-2NPJCYDa.js";import"./chunk-5FQGJX7Z-DILIU9Rm.js";import"./html-to-image-CS4X2edG.js";import{o as Pa}from"./focus-CmJ1iwZ3.js";import"./react-resizable-panels.browser.esm-CgWOEYeG.js";import{a as Ta}from"./renderShortcut-D7FYCtYQ.js";import{t as $a}from"./bundle.esm-DjhGJy4I.js";import{i as Ae,n as Oa,r as ht,t as ge}from"./tree-actions-D9i3o3Zk.js";import{a as Ia}from"./components-BxcnsrL3.js";import{n as Ra}from"./pathUtils-vgBYIo5B.js";import{n as Aa}from"./semaphore-X3ApuO41.js";import{t as Ea}from"./empty-state-CcobJSnG.js";import{t as Ee}from"./formatting-XTtGIhGk.js";import{a as Ha,i as La,n as xt,r as ft,t as ut}from"./components-OEABNydc.js";import{n as yt,t as Va}from"./marimo-icons-CUuBQ0ae.js";import{t as Ba}from"./links-Av1BIe0O.js";var qa=re("book-plus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]),Ua=re("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),jt=re("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]),Wa=re("file-symlink",[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"huwfnr"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}]]),gt=re("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),bt=re("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]),Ga=re("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}]]),vt=re("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),T=qe(Rt(),1),Ja=fe(),a=qe(Bt(),1);const wt=t=>{let e=(0,Ja.c)(17),{filename:n,filenameIcon:i,onBack:o,onRefresh:r,onDownload:d,actions:c}=t,h;e[0]===o?h=e[1]:(h=o&&(0,a.jsx)(E,{content:"Back to file list",children:(0,a.jsx)(O,{variant:"text",size:"xs",onClick:o,children:(0,a.jsx)(Ze,{className:"h-4 w-4"})})}),e[0]=o,e[1]=h);let s;e[2]!==n||e[3]!==i?(s=n?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[i,n]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=n,e[3]=i,e[4]=s):s=e[4];let u;e[5]===r?u=e[6]:(u=r&&(0,a.jsx)(E,{content:"Refresh",children:(0,a.jsx)(O,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(ot,{className:"h-3.5 w-3.5"})})}),e[5]=r,e[6]=u);let x;e[7]===d?x=e[8]:(x=d&&(0,a.jsx)(E,{content:"Download",children:(0,a.jsx)(O,{variant:"text",size:"xs",onClick:d,children:(0,a.jsx)(Me,{className:"h-3.5 w-3.5"})})}),e[7]=d,e[8]=x);let p;e[9]!==c||e[10]!==u||e[11]!==x?(p=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[u,c,x]}),e[9]=c,e[10]=u,e[11]=x,e[12]=p):p=e[12];let y;return e[13]!==h||e[14]!==s||e[15]!==p?(y=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[h,s,p]}),e[13]=h,e[14]=s,e[15]=p,e[16]=y):y=e[16],y};var Ka=new Set(["http","file","in-memory"]);function He(t){return JSON.stringify(t).slice(1,-1)}const Nt=[{id:"read-file",label:"Insert read snippet",icon:qa,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);return t.backendType==="obstore"?`_data = ${t.variableName}.get("${e}").bytes()
|
|
2
|
-
_data`:`_data = ${t.variableName}.cat_file("${e}")
|
|
3
|
-
_data`}},{id:"download-file",label:"Insert download snippet",icon:Wa,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);if(t.backendType==="obstore")return Ka.has(t.protocol)?null:`from datetime import timedelta
|
|
4
|
-
from obstore import sign
|
|
5
|
-
|
|
6
|
-
signed_url = sign(
|
|
7
|
-
${t.variableName}, "GET", "${e}",
|
|
8
|
-
expires_in=timedelta(hours=1),
|
|
9
|
-
)
|
|
10
|
-
signed_url`;let n=He(t.entry.path.split("/").pop()||"download");return`${t.variableName}.get("${e}", "${n}")`}}];var Ya=100*1024*1024;function Xa(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Za=({entry:t,namespace:e,protocol:n,backendType:i,onBack:o})=>{let{locale:r}=it(),d=Ye(),c=Xa(t.path),h=t.mimeType||"text/plain",s=Fe(h),u=s&&t.size>Ya&&t.size>0,{data:x,isPending:p,error:y,refetch:g}=Re(async()=>{if(u)return null;let m=await Te.request({namespace:e,path:t.path,preview:!s});if(m.error)throw Error(m.error);if(!m.url)throw Error("No URL returned");if(s)return{type:"media",url:m.url};let b=await fetch(m.url);if(!b.ok)throw Error(`Failed to fetch preview: ${b.statusText}`);return{type:"text",content:await b.text()}},[e,t.path,s,u]),w=(0,T.useCallback)(async()=>{try{let m=await Te.request({namespace:e,path:t.path});if(m.error){te({title:"Download failed",description:m.error,variant:"danger"});return}m.url&&ze(m.url,m.filename??c)}catch(m){De.error("Failed to download storage entry",m),te({title:"Download failed",description:String(m),variant:"danger"})}},[e,t.path,c]),v=Nt.map(m=>{let b=m.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(b===null)return null;let f=m.icon;return(0,a.jsx)(E,{content:m.label,children:(0,a.jsx)(O,{variant:"text",size:"xs",onClick:()=>d(b),"aria-label":m.label,children:(0,a.jsx)(f,{className:"h-3.5 w-3.5"})})},m.id)}),l=(0,a.jsx)(wt,{filename:c,filenameIcon:tt(c),onBack:o,onDownload:w,actions:v}),j=({includeMime:m=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)(Fa,{value:t.path,className:"h-3 w-3"})]}),m&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),m&&(0,a.jsx)("span",{children:h}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Ee(t.size,r)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Ee(t.size,r),")."]})]}):p?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Ie,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",y.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(O,{variant:"secondary",size:"xs",onClick:g,children:[(0,a.jsx)(ot,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):x?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsx)(Ke,{mimeType:h,contents:x.type==="text"?x.content:void 0,mediaSource:x.type==="media"?{url:x.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(nt,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Le=fe(),Qa=16;function se(t){return{paddingLeft:t*Qa}}function en(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function kt(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}function Ve(t,e,n,i){let o=n.toLowerCase();if(kt(t.path).toLowerCase().includes(o))return!0;if(t.kind==="directory"){let r=i.get(Xe(e,t.path));if(r)return r.some(d=>Ve(d,e,n,i))}return!1}function _t(t,e,n,i){return n.trim()?t.filter(o=>Ve(o,e,n,i)):t}var tn=t=>{let e=(0,Le.c)(36),{namespace:n,protocol:i,rootPath:o,backendType:r,prefix:d,depth:c,locale:h,searchValue:s,onOpenFile:u}=t,{entriesByPath:x}=Se(),{entries:p,isPending:y,error:g}=Qe(n,d);if(y){let l;e[0]===c?l=e[1]:(l=se(c),e[0]=c,e[1]=l);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),e[2]=j):j=e[2];let m;return e[3]===l?m=e[4]:(m=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:l,children:[j,"Loading..."]}),e[3]=l,e[4]=m),m}if(g){let l;e[5]===c?l=e[6]:(l=se(c),e[5]=c,e[6]=l);let j;return e[7]!==g.message||e[8]!==l?(j=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:l,children:["Failed to load: ",g.message]}),e[7]=g.message,e[8]=l,e[9]=j):j=e[9],j}if(p.length===0){let l;e[10]===c?l=e[11]:(l=se(c),e[10]=c,e[11]=l);let j;return e[12]===l?j=e[13]:(j=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:l,children:"Empty"}),e[12]=l,e[13]=j),j}let w;if(e[14]!==r||e[15]!==p||e[16]!==c||e[17]!==x||e[18]!==h||e[19]!==n||e[20]!==u||e[21]!==i||e[22]!==o||e[23]!==s){let l=_t(p,n,s,x),j;e[25]!==r||e[26]!==c||e[27]!==h||e[28]!==n||e[29]!==u||e[30]!==i||e[31]!==o||e[32]!==s?(j=m=>(0,a.jsx)(Ft,{entry:m,namespace:n,protocol:i,rootPath:o,backendType:r,depth:c,locale:h,searchValue:s,onOpenFile:u},m.path),e[25]=r,e[26]=c,e[27]=h,e[28]=n,e[29]=u,e[30]=i,e[31]=o,e[32]=s,e[33]=j):j=e[33],w=l.map(j),e[14]=r,e[15]=p,e[16]=c,e[17]=x,e[18]=h,e[19]=n,e[20]=u,e[21]=i,e[22]=o,e[23]=s,e[24]=w}else w=e[24];let v;return e[34]===w?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:w}),e[34]=w,e[35]=v),v},Ft=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:o,depth:r,locale:d,searchValue:c,onOpenFile:h})=>{var b;let[s,u]=(0,T.useState)(!1),{entriesByPath:x}=Se(),p=Ye(),y=t.kind==="directory",g=kt(t.path),w=!!c.trim(),v=y&&w&&g.toLowerCase().includes(c.trim().toLowerCase()),l=y&&w&&!!((b=x.get(Xe(e,t.path)))!=null&&b.some(f=>Ve(f,e,c,x))),j=s||l,m=(0,T.useCallback)(async()=>{try{let f=await Te.request({namespace:e,path:t.path});if(f.error){te({title:"Download failed",description:f.error,variant:"danger"});return}f.url&&ze(f.url,f.filename??"download")}catch(f){De.error("Failed to download storage entry",f),te({title:"Download failed",description:String(f),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(pt,{className:ie("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",y&&"font-medium"),style:se(r),value:`${e}:${t.path}`,onSelect:()=>{y?u(!j):h({entry:t,namespace:e,protocol:n,backendType:o})},children:[y?(0,a.jsx)(Ae,{isExpanded:j,className:"h-3 w-3"}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),y?(0,a.jsx)(la,{className:ie("h-3.5 w-3.5 shrink-0",at.directory)}):tt(g),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:g}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Ee(t.size,d)}),t.lastModified!=null&&(0,a.jsx)(E,{content:`Last modified: ${new Date(t.lastModified*1e3).toLocaleString()}`,children:(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:en(t.lastModified,d)})}),(0,a.jsxs)(Jt,{children:[(0,a.jsx)(Wt,{asChild:!0,children:(0,a.jsx)(Oa,{iconClassName:"h-3 w-3",onClick:f=>f.stopPropagation()})}),(0,a.jsxs)(Gt,{align:"end",onClick:f=>f.stopPropagation(),onCloseAutoFocus:f=>f.preventDefault(),children:[!y&&(0,a.jsxs)(A,{onSelect:()=>h({entry:t,namespace:e,protocol:n,backendType:o}),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(A,{onSelect:async()=>{await je(t.path),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(et,{className:ge}),"Copy path"]}),!y&&(0,a.jsxs)(A,{onSelect:()=>m(),children:[(0,a.jsx)(Me,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Nt.map(f=>{let k=f.getCode({variableName:e,protocol:n,entry:t,backendType:o});if(k===null)return null;let _=f.icon;return(0,a.jsxs)(A,{onSelect:()=>p(k),children:[(0,a.jsx)(_,{className:ge}),f.label]},f.id)})]})]})]})]}),y&&j&&(0,a.jsx)(tn,{namespace:e,protocol:n,rootPath:i,backendType:o,prefix:t.path,depth:r+1,locale:d,searchValue:v?"":c,onOpenFile:h})]})},an=t=>{let e=(0,Le.c)(43),{namespace:n,locale:i,searchValue:o,onOpenFile:r}=t,[d,c]=(0,T.useState)(!0),{entriesByPath:h}=Se(),{clearNamespaceCache:s}=ea(),u=n.name??n.displayName,{entries:x,isPending:p,error:y,refetch:g}=Qe(u),w;e[0]!==s||e[1]!==u||e[2]!==g?(w=m=>{m.stopPropagation(),s(u),g()},e[0]=s,e[1]=u,e[2]=g,e[3]=w):w=e[3];let v=w,l=p?n.storageEntries:x,j;if(e[4]!==l||e[5]!==h||e[6]!==y||e[7]!==v||e[8]!==d||e[9]!==p||e[10]!==i||e[11]!==n.backendType||e[12]!==n.displayName||e[13]!==n.name||e[14]!==n.protocol||e[15]!==n.rootPath||e[16]!==u||e[17]!==r||e[18]!==o){let m=_t(l,u,o,h),b;e[20]===d?b=e[21]:(b=()=>c(!d),e[20]=d,e[21]=b);let f;e[22]===d?f=e[23]:(f=(0,a.jsx)(Ae,{isExpanded:d,className:"h-3 w-3"}),e[22]=d,e[23]=f);let k;e[24]===n.protocol?k=e[25]:(k=(0,a.jsx)(ca,{protocol:n.protocol}),e[24]=n.protocol,e[25]=k);let _;e[26]===n.displayName?_=e[27]:(_=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=_);let F;e[28]===n.name?F=e[29]:(F=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Ha,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=F);let C;e[30]===v?C=e[31]:(C=(0,a.jsx)(ht,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=C);let z=n.rootPath||"(root)",S;e[32]===z?S=e[33]:(S=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:z}),e[32]=z,e[33]=S);let D;e[34]!==n.name||e[35]!==S||e[36]!==b||e[37]!==f||e[38]!==k||e[39]!==_||e[40]!==F||e[41]!==C?(D=(0,a.jsxs)(pt,{value:n.name,onSelect:b,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[f,k,_,F,C,S]}),e[34]=n.name,e[35]=S,e[36]=b,e[37]=f,e[38]=k,e[39]=_,e[40]=F,e[41]=C,e[42]=D):D=e[42],j=(0,a.jsxs)(a.Fragment,{children:[D,d&&(0,a.jsxs)(a.Fragment,{children:[p&&l.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:se(1),children:[(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),y&&l.length===0&&(0,a.jsx)(Ia,{error:y,style:se(1),className:"py-1 text-xs h-auto overflow-auto max-h-32 items-start",showIcon:!1}),!p&&l.length===0&&!y&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No entries"}),o&&m.length===0&&l.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No matches"}),m.map(R=>(0,a.jsx)(Ft,{entry:R,namespace:u,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:o,onOpenFile:r},R.path))]})]}),e[4]=l,e[5]=h,e[6]=y,e[7]=v,e[8]=d,e[9]=p,e[10]=i,e[11]=n.backendType,e[12]=n.displayName,e[13]=n.name,e[14]=n.protocol,e[15]=n.rootPath,e[16]=u,e[17]=r,e[18]=o,e[19]=j}else j=e[19];return j};const nn=()=>{let t=(0,Le.c)(31),{namespaces:e}=Se(),{locale:n}=it(),[i,o]=(0,T.useState)(""),[r,d]=(0,T.useState)(null),c=!!i.trim();if(e.length===0){let b;t[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsxs)("span",{children:["Create an obstore or fsspec connection in your notebook. See the"," ",(0,a.jsx)("a",{className:"text-link",href:"https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start",target:"_blank",rel:"noopener noreferrer",children:"docs"}),"."]}),t[0]=b):b=t[0];let f;return t[1]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(Ea,{title:"No storage connected",description:b,action:(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsxs)(O,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(lt,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(rt,{className:"h-8 w-8"})}),t[1]=f):f=t[1],f}let h;t[2]===r?h=t[3]:(h=r&&(0,a.jsx)(Za,{entry:r.entry,namespace:r.namespace,protocol:r.protocol,backendType:r.backendType,onBack:()=>d(null)}),t[2]=r,t[3]=h);let s=r&&"hidden",u;t[4]===s?u=t[5]:(u=ie("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",s),t[4]=s,t[5]=u);let x;t[6]===i?x=t[7]:(x=(0,a.jsx)(Da,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:o,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=x);let p;t[8]===c?p=t[9]:(p=c&&(0,a.jsx)(O,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>o(""),children:(0,a.jsx)(na,{className:"h-4 w-4"})}),t[8]=c,t[9]=p);let y;t[10]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsx)(E,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(ra,{className:"h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2"})}),t[10]=y):y=t[10];let g;t[11]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsx)(O,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(lt,{className:"h-4 w-4"})})}),t[11]=g):g=t[11];let w;t[12]!==x||t[13]!==p?(w=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[x,p,y,g]}),t[12]=x,t[13]=p,t[14]=w):w=t[14];let v;if(t[15]!==n||t[16]!==e||t[17]!==i){let b;t[19]!==n||t[20]!==i?(b=f=>(0,a.jsx)(an,{namespace:f,locale:n,searchValue:i,onOpenFile:d},f.name??f.displayName),t[19]=n,t[20]=i,t[21]=b):b=t[21],v=e.map(b),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let l;t[22]===v?l=t[23]:(l=(0,a.jsx)(za,{className:"flex flex-col",children:v}),t[22]=v,t[23]=l);let j;t[24]!==u||t[25]!==w||t[26]!==l?(j=(0,a.jsxs)(Ma,{className:u,shouldFilter:!1,children:[w,l]}),t[24]=u,t[25]=w,t[26]=l,t[27]=j):j=t[27];let m;return t[28]!==h||t[29]!==j?(m=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[h,j]}),t[28]=h,t[29]=j,t[30]=m):m=t[30],m};var Ct=fe(),St=(0,T.createContext)(null);function rn(){return(0,T.useContext)(St)??void 0}var sn=t=>{let e=(0,Ct.c)(3),{children:n}=t,i=ha(),o;return e[0]!==n||e[1]!==i?(o=(0,a.jsx)(St.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=o):o=e[2],o};const ln=t=>{let e=(0,Ct.c)(5),{children:n}=t,[i,o]=(0,T.useState)(null),r;e[0]!==n||e[1]!==i?(r=i&&(0,a.jsx)(xa,{backend:ba,options:{rootElement:i},children:(0,a.jsx)(sn,{children:n})}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let d;return e[3]===r?d=e[4]:(d=(0,a.jsx)("div",{ref:o,className:"contents",children:r}),e[3]=r,e[4]=d),d};var Be=new Map;const on=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=Pe(),o=ye(Vt),r=ye(Je),d=ye(Et),[c,h]=(0,T.useState)(""),{data:s,isPending:u,error:x,setData:p,refetch:y}=Re(async()=>{let k=await n({path:t.path}),_=k.contents||"";return h(Be.get(t.path)||_),k},[t.path]),g=async()=>{c!==(s==null?void 0:s.contents)&&await i({path:t.path,contents:c}).then(k=>{k.success&&(p(_=>({..._,contents:c})),h(c))})},w=(0,T.useRef)(c);if(w.current=c,(0,T.useEffect)(()=>()=>{if(!(s!=null&&s.contents))return;let k=w.current;k===s.contents?Be.delete(t.path):Be.set(t.path,k)},[t.path,s==null?void 0:s.contents]),x)return(0,a.jsx)(mt,{error:x});if(u||!s)return null;let v=s.mimeType||"text/plain",l=v in Kt,j=d&&s.file.isMarimoFile&&(t.path===d||t.path.endsWith(`/${d}`));if(!s.contents&&!l)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let m=(0,a.jsx)(wt,{filename:s.file.name,onRefresh:y,onDownload:r?void 0:()=>{if(s.isBase64&&s.contents){Fe(v)?ze($e(s.contents,v),s.file.name):Ce(dt($e(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Ce(new Blob([s.contents||c],{type:v}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!_e()&&(0,a.jsx)(E,{content:"Open notebook",children:(0,a.jsx)(O,{variant:"text",size:"xs",onClick:k=>e(k),children:(0,a.jsx)(Oe,{className:"h-3.5 w-3.5"})})}),!Fe(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(E,{content:"Copy contents to clipboard",children:(0,a.jsx)(O,{variant:"text",size:"xs",onClick:async()=>{await je(c)},children:(0,a.jsx)(et,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(E,{content:Ta("global.save"),children:(0,a.jsx)(O,{variant:"text",size:"xs",onClick:g,disabled:c===s.contents,children:(0,a.jsx)(va,{className:"h-3.5 w-3.5"})})})]})]})}),b=Fe(v),f=!b&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[m,f&&j&&(0,a.jsxs)(Sa,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(wa,{className:"h-4 w-4"}),(0,a.jsx)(Ca,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Ke,{mimeType:v,contents:b?void 0:f?c:s.contents??void 0,mediaSource:b?{base64:s.contents,mime:v}:void 0,readOnly:!f,onChange:h,extensions:[Zt.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===s.contents?!1:(g(),!0)}])]})]})},Dt=Ue(t=>{let e=t(Qt);return Lt(e,"no requestClientAtom set"),new pa({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),cn=Ue({});async function dn(){await It.get(Dt).refreshAll([])}var le=" ";const Mt={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
|
|
11
|
-
${le}...
|
|
12
|
-
`,json:t=>`with open("${t}", "r") as _f:
|
|
13
|
-
${le}_data = json.load(_f)
|
|
14
|
-
`,code:t=>`with open("${t}", "r") as _f:
|
|
15
|
-
${le}...
|
|
16
|
-
`,text:t=>`with open("${t}", "r") as _f:
|
|
17
|
-
${le}...
|
|
18
|
-
`,image:t=>`mo.image("${t}")`,audio:t=>`mo.audio("${t}")`,video:t=>`mo.video("${t}")`,pdf:t=>`with open("${t}", "rb") as _f:
|
|
19
|
-
${le}...
|
|
20
|
-
`,zip:t=>`with open("${t}", "rb") as _f:
|
|
21
|
-
${le}...
|
|
22
|
-
`,data:t=>`with open("${t}", "r") as _f:
|
|
23
|
-
${le}...
|
|
24
|
-
`,unknown:t=>`with open("${t}", "r") as _f:
|
|
25
|
-
${le}...
|
|
26
|
-
`};var mn=fe(),pn=1024*1024*100,hn=5;function zt(t){let e=(0,mn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:o}=Pe(),r;e[2]===o?r=e[3]:(r=async c=>{if(c.length===0)return;let h=c.length===1;await Yt(h?"Uploading file...":"Uploading files...",async s=>{s.addTotal(c.length),await Aa(c,hn,async u=>{let x=gn(jn(u)),p="";x&&(p=_a.guessDeliminator(x).dirname(x)),await o({path:p,type:"file",name:u.name,file:u}),s.increment(1)}),await dn()},{title:h?"File uploaded":`${c.length} files uploaded`})},e[2]=o,e[3]=r);let d;return e[4]!==i||e[5]!==r?(d={multiple:!0,maxSize:pn,onError:yn,onDropRejected:xn,onDrop:r,...i},e[4]=i,e[5]=r,e[6]=d):d=e[6],ka(d)}function xn(t){te({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(fn)}),variant:"danger"})}function fn(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(un).join(", "),")"]},t.file.name)}function un(t){return t.message}function yn(t){De.error(t),te({title:"File upload failed",description:t.message,variant:"danger"})}function jn(t){if(t.webkitRelativePath)return t.webkitRelativePath;if("path"in t&&typeof t.path=="string")return t.path;if("relativePath"in t&&typeof t.relativePath=="string")return t.relativePath}function gn(t){if(t)return t.replace(/^\/+/,"")}var be=fe(),bn=Ge("marimo:showHiddenFiles",!0,We,{getOnInit:!0}),Pt=T.createContext(null);const vn=t=>{let e=(0,be.c)(72),{height:n}=t,i=(0,T.useRef)(null),o=rn(),[r]=ke(Dt),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,h]=(0,T.useState)(d),[s,u]=(0,T.useState)(null),[x,p]=ke(bn),{openPrompt:y}=ct(),[g,w]=ke(cn),v;e[1]===r?v=e[2]:(v=()=>r.initialize(h),e[1]=r,e[2]=v);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3];let{isPending:j,error:m}=Re(v,l),b;e[4]!==g||e[5]!==r?(b=()=>r.refreshAll(Object.keys(g).filter(N=>g[N])),e[4]=g,e[5]=r,e[6]=b):b=e[6];let f=ee(b),k;e[7]!==p||e[8]!==x?(k=()=>{p(!x)},e[7]=p,e[8]=x,e[9]=k):k=e[9];let _=ee(k),F;e[10]!==y||e[11]!==r?(F=async()=>{y({title:"Folder name",onConfirm:async N=>{r.createFolder(N,null)}})},e[10]=y,e[11]=r,e[12]=F):F=e[12];let C=ee(F),z;e[13]!==y||e[14]!==r?(z=async()=>{y({title:"File name",onConfirm:async N=>{r.createFile({name:N,parentId:null})}})},e[13]=y,e[14]=r,e[15]=z):z=e[15];let S=ee(z),D;e[16]!==y||e[17]!==r?(D=async()=>{y({title:"Notebook name",onConfirm:async N=>{r.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=y,e[17]=r,e[18]=D):D=e[18];let R=ee(D),I;e[19]===w?I=e[20]:(I=()=>{var N;(N=i.current)==null||N.closeAll(),w({})},e[19]=w,e[20]=I);let Z=ee(I),J;e[21]!==c||e[22]!==x?(J=$t(c,x),e[21]=c,e[22]=x,e[23]=J):J=e[23];let oe=J;if(j){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(da,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(m){let N;return e[25]===m?N=e[26]:(N=(0,a.jsx)(mt,{error:m}),e[25]=m,e[26]=N),N}if(s){let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=()=>u(null),e[27]=N):N=e[27];let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsx)(O,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ze,{size:16})}),e[28]=P):P=e[28];let $;e[29]===s.name?$=e[30]:($=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[P,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=$);let G;e[31]!==s.path||e[32]!==r?(G=ne=>Tt(ne,r.relativeFromRoot(s.path)),e[31]=s.path,e[32]=r,e[33]=G):G=e[33];let Y;e[34]!==s||e[35]!==G?(Y=(0,a.jsx)(T.Suspense,{children:(0,a.jsx)(on,{onOpenNotebook:G,file:s})}),e[34]=s,e[35]=G,e[36]=Y):Y=e[36];let X;return e[37]!==$||e[38]!==Y?(X=(0,a.jsxs)(a.Fragment,{children:[$,Y]}),e[37]=$,e[38]=Y,e[39]=X):X=e[39],X}let H;e[40]!==Z||e[41]!==S||e[42]!==C||e[43]!==R||e[44]!==_||e[45]!==f||e[46]!==r?(H=(0,a.jsx)(Nn,{onRefresh:f,onHidden:_,onCreateFile:S,onCreateNotebook:R,onCreateFolder:C,onCollapseAll:Z,tree:r}),e[40]=Z,e[41]=S,e[42]=C,e[43]=R,e[44]=_,e[45]=f,e[46]=r,e[47]=H):H=e[47];let Q=n-33,L,V,B;e[48]===r?(L=e[49],V=e[50],B=e[51]):(L=async N=>{let{ids:P}=N;for(let $ of P)await r.delete($)},V=async N=>{let{id:P,name:$}=N;await r.rename(P,$)},B=async N=>{let{dragIds:P,parentId:$}=N;await r.move(P,$)},e[48]=r,e[49]=L,e[50]=V,e[51]=B);let K;e[52]===Symbol.for("react.memo_cache_sentinel")?(K=N=>{let P=N[0];P&&(P.data.isDirectory||u(P.data))},e[52]=K):K=e[52];let q;e[53]!==g||e[54]!==w||e[55]!==r?(q=async N=>{if(await r.expand(N)){let P=g[N]??!1;w({...g,[N]:!P})}},e[53]=g,e[54]=w,e[55]=r,e[56]=q):q=e[56];let U;e[57]!==o||e[58]!==g||e[59]!==Q||e[60]!==L||e[61]!==V||e[62]!==B||e[63]!==q||e[64]!==oe?(U=(0,a.jsx)(ua,{width:"100%",ref:i,height:Q,className:"h-full",data:oe,initialOpenState:g,openByDefault:!1,dndManager:o,renderCursor:Sn,disableDrop:Dn,onDelete:L,onRename:V,onMove:B,onSelect:K,onToggle:q,padding:15,rowHeight:30,indent:wn,overscanCount:1e3,disableMultiSelection:!0,children:_n}),e[57]=o,e[58]=g,e[59]=Q,e[60]=L,e[61]=V,e[62]=B,e[63]=q,e[64]=oe,e[65]=U):U=e[65];let W;e[66]!==U||e[67]!==r?(W=(0,a.jsx)(Pt,{value:r,children:U}),e[66]=U,e[67]=r,e[68]=W):W=e[68];let ae;return e[69]!==H||e[70]!==W?(ae=(0,a.jsxs)(a.Fragment,{children:[H,W]}),e[69]=H,e[70]=W,e[71]=ae):ae=e[71],ae};var wn=15,Nn=t=>{let e=(0,be.c)(37),{onRefresh:n,onHidden:i,onCreateFile:o,onCreateNotebook:r,onCreateFolder:d,onCollapseAll:c}=t,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={noDrag:!0,noDragEventsBubbling:!0},e[0]=h):h=e[0];let{getRootProps:s,getInputProps:u}=zt(h),x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(yt,{size:16}),e[1]=x):x=e[1];let p;e[2]===r?p=e[3]:(p=(0,a.jsx)(E,{content:"Add notebook",children:(0,a.jsx)(O,{"data-testid":"file-explorer-add-notebook-button",onClick:r,variant:"text",size:"xs",children:x})}),e[2]=r,e[3]=p);let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsx)(jt,{size:16}),e[4]=y):y=e[4];let g;e[5]===o?g=e[6]:(g=(0,a.jsx)(E,{content:"Add file",children:(0,a.jsx)(O,{"data-testid":"file-explorer-add-file-button",onClick:o,variant:"text",size:"xs",children:y})}),e[5]=o,e[6]=g);let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsx)(gt,{size:16}),e[7]=w):w=e[7];let v;e[8]===d?v=e[9]:(v=(0,a.jsx)(E,{content:"Add folder",children:(0,a.jsx)(O,{"data-testid":"file-explorer-add-folder-button",onClick:d,variant:"text",size:"xs",children:w})}),e[8]=d,e[9]=v);let l;e[10]===s?l=e[11]:(l=s({}),e[10]=s,e[11]=l);let j,m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=Xt({variant:"text",size:"xs"}),j=(0,a.jsx)(Na,{size:16}),e[12]=j,e[13]=m):(j=e[12],m=e[13]);let b;e[14]===l?b=e[15]:(b=(0,a.jsx)(E,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...l,className:m,children:j})}),e[14]=l,e[15]=b);let f;e[16]===u?f=e[17]:(f=u({}),e[16]=u,e[17]=f);let k;e[18]===f?k=e[19]:(k=(0,a.jsx)("input",{...f,type:"file"}),e[18]=f,e[19]=k);let _;e[20]===n?_=e[21]:(_=(0,a.jsx)(ht,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=_);let F;e[22]===Symbol.for("react.memo_cache_sentinel")?(F=(0,a.jsx)(sa,{size:16}),e[22]=F):F=e[22];let C;e[23]===i?C=e[24]:(C=(0,a.jsx)(E,{content:"Toggle hidden files",children:(0,a.jsx)(O,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:F})}),e[23]=i,e[24]=C);let z;e[25]===Symbol.for("react.memo_cache_sentinel")?(z=(0,a.jsx)(Ua,{size:16}),e[25]=z):z=e[25];let S;e[26]===c?S=e[27]:(S=(0,a.jsx)(E,{content:"Collapse all folders",children:(0,a.jsx)(O,{"data-testid":"file-explorer-collapse-button",onClick:c,variant:"text",size:"xs",children:z})}),e[26]=c,e[27]=S);let D;return e[28]!==b||e[29]!==k||e[30]!==_||e[31]!==C||e[32]!==S||e[33]!==p||e[34]!==g||e[35]!==v?(D=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[p,g,v,b,k,_,C,S]}),e[28]=b,e[29]=k,e[30]=_,e[31]=C,e[32]=S,e[33]=p,e[34]=g,e[35]=v,e[36]=D):D=e[36],D},kn=t=>{let e=(0,be.c)(9),{node:n,onOpenMarimoFile:i}=t,o;e[0]===n?o=e[1]:(o=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=o);let r;e[2]!==n.data.isMarimoFile||e[3]!==i?(r=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)("span",{"data-testid":"file-explorer-open-marimo-button",className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:i,children:["open ",(0,a.jsx)(Oe,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=r):r=e[4];let d;return e[5]!==n.data.name||e[6]!==o||e[7]!==r?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:o,children:[n.data.name,r]}),e[5]=n.data.name,e[6]=o,e[7]=r,e[8]=d):d=e[8],d},_n=t=>{let e=(0,be.c)(116),{node:n,style:i,dragHandle:o}=t,{openFile:r,sendFileDetails:d}=Pe(),c=ye(Je),h;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(h=n.data.isDirectory?"directory":oa(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=h):h=e[2];let s=h,u=ia[s],{openConfirm:x,openPrompt:p}=ct(),{createNewCell:y}=At(),g=Pa(),w;e[3]!==y||e[4]!==g?(w=M=>{y({code:M,before:!1,cellId:g??"__end__"})},e[3]=y,e[4]=g,e[5]=w):w=e[5];let v=w,l=(0,T.use)(Pt),j;e[6]!==n.data.path||e[7]!==l?(j=async M=>{Tt(M,l?l.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=l,e[8]=j):j=e[8];let m=j,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==x?(b=async M=>{M.stopPropagation(),M.preventDefault(),x({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,a.jsx)(Ut,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[9]=n.data.name,e[10]=n.id,e[11]=n.tree,e[12]=x,e[13]=b):b=e[13];let f=b,k;e[14]!==n||e[15]!==p||e[16]!==l?(k=async()=>{n.open(),p({title:"Folder name",onConfirm:async M=>{l==null||l.createFolder(M,n.id)}})},e[14]=n,e[15]=p,e[16]=l,e[17]=k):k=e[17];let _=ee(k),F;e[18]!==n||e[19]!==p||e[20]!==l?(F=async()=>{n.open(),p({title:"File name",onConfirm:async M=>{l==null||l.createFile({name:M,parentId:n.id})}})},e[18]=n,e[19]=p,e[20]=l,e[21]=F):F=e[21];let C=ee(F),z;e[22]!==n||e[23]!==p||e[24]!==l?(z=async()=>{n.open(),p({title:"Notebook name",onConfirm:async M=>{l==null||l.createFile({name:M,parentId:n.id,type:"notebook"})}})},e[22]=n,e[23]=p,e[24]=l,e[25]=z):z=e[25];let S=ee(z),D;e[26]!==n.data.name||e[27]!==n.id||e[28]!==l?(D=async()=>{l&&await l.copy(n.id,Ra(n.data.name))},e[26]=n.data.name,e[27]=n.id,e[28]=l,e[29]=D):D=e[29];let R=ee(D),I;e[30]===Symbol.for("react.memo_cache_sentinel")?(I=ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=I):I=e[30];let Z,J;e[31]===n?(Z=e[32],J=e[33]):(Z=M=>{M.stopPropagation(),n.data.isDirectory&&n.toggle()},J=(0,a.jsx)(Fn,{node:n}),e[31]=n,e[32]=Z,e[33]=J);let oe=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",H;e[34]===oe?H=e[35]:(H=ie("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",oe),e[34]=oe,e[35]=H);let Q;e[36]!==u||e[37]!==s||e[38]!==n.data.isMarimoFile?(Q=n.data.isMarimoFile?(0,a.jsx)(Va,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(u,{className:ie("w-5 h-5 shrink-0 mr-2",at[s]),strokeWidth:1.5}),e[36]=u,e[37]=s,e[38]=n.data.isMarimoFile,e[39]=Q):Q=e[39];let L;e[40]!==m||e[41]!==n?(L=n.isEditing?(0,a.jsx)(ga,{node:n}):(0,a.jsx)(kn,{node:n,onOpenMarimoFile:m}),e[40]=m,e[41]=n,e[42]=L):L=e[42];let V;e[43]===n?V=e[44]:(V=!n.data.isDirectory&&(0,a.jsxs)(A,{onSelect:()=>n.select(),"data-testid":"file-explorer-open-file-menu-item",children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=n,e[44]=V);let B;e[45]!==n.data.isDirectory||e[46]!==n.data.path||e[47]!==r?(B=!n.data.isDirectory&&!_e()&&(0,a.jsxs)(A,{onSelect:()=>{r({path:n.data.path})},"data-testid":"file-explorer-open-external-menu-item",children:[(0,a.jsx)(Oe,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),e[45]=n.data.isDirectory,e[46]=n.data.path,e[47]=r,e[48]=B):B=e[48];let K;e[49]!==C||e[50]!==_||e[51]!==S||e[52]!==n.data.isDirectory?(K=n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A,{onSelect:()=>S(),"data-testid":"file-explorer-create-notebook-menu-item",children:[(0,a.jsx)(yt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(A,{onSelect:()=>C(),"data-testid":"file-explorer-create-file-menu-item",children:[(0,a.jsx)(jt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(A,{onSelect:()=>_(),"data-testid":"file-explorer-create-folder-menu-item",children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=C,e[50]=_,e[51]=S,e[52]=n.data.isDirectory,e[53]=K):K=e[53];let q;e[54]===n?q=e[55]:(q=(0,a.jsx)(ma,{onSelect:()=>n.edit(),testId:"file-explorer-rename-menu-item"}),e[54]=n,e[55]=q);let U;e[56]===R?U=e[57]:(U=(0,a.jsx)(ja,{onSelect:R,testId:"file-explorer-duplicate-menu-item"}),e[56]=R,e[57]=U);let W;e[58]===n.data.path?W=e[59]:(W=async()=>{await je(n.data.path),te({title:"Copied to clipboard"})},e[58]=n.data.path,e[59]=W);let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=(0,a.jsx)(bt,{className:ge}),e[60]=ae):ae=e[60];let N;e[61]===W?N=e[62]:(N=(0,a.jsxs)(A,{onSelect:W,"data-testid":"file-explorer-copy-path-menu-item",children:[ae,"Copy path"]}),e[61]=W,e[62]=N);let P;e[63]!==n.data.path||e[64]!==l?(P=l&&(0,a.jsxs)(A,{onSelect:async()=>{await je(l.relativeFromRoot(n.data.path)),te({title:"Copied to clipboard"})},"data-testid":"file-explorer-copy-relative-path-menu-item",children:[(0,a.jsx)(bt,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=n.data.path,e[64]=l,e[65]=P):P=e[65];let $;e[66]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(ue,{}),e[66]=$):$=e[66];let G;e[67]!==s||e[68]!==v||e[69]!==n.data?(G=()=>{let{path:M}=n.data;v(Mt[s](M))},e[67]=s,e[68]=v,e[69]=n.data,e[70]=G):G=e[70];let Y;e[71]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,a.jsx)(aa,{className:ge}),e[71]=Y):Y=e[71];let X;e[72]===G?X=e[73]:(X=(0,a.jsxs)(A,{onSelect:G,"data-testid":"file-explorer-insert-snippet-menu-item",children:[Y,"Insert snippet for reading file"]}),e[72]=G,e[73]=X);let ne;e[74]!==s||e[75]!==n.data?(ne=async()=>{te({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});let{path:M}=n.data;await je(Mt[s](M))},e[74]=s,e[75]=n.data,e[76]=ne):ne=e[76];let ve;e[77]===Symbol.for("react.memo_cache_sentinel")?(ve=(0,a.jsx)(Ht,{className:ge}),e[77]=ve):ve=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(A,{onSelect:ne,"data-testid":"file-explorer-copy-snippet-menu-item",children:[ve,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==m||e[81]!==n.data.isMarimoFile?(de=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(A,{onSelect:m,"data-testid":"file-explorer-open-notebook-menu-item",children:[(0,a.jsx)(Ga,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=m,e[81]=n.data.isMarimoFile,e[82]=de):de=e[82];let we;e[83]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(ue,{}),e[83]=we):we=e[83];let me;e[84]!==c||e[85]!==n.data.isDirectory||e[86]!==n.data.name||e[87]!==n.data.path||e[88]!==d?(me=!n.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A,{onSelect:async()=>{let M=await d({path:n.data.path});M.isBase64&&M.contents?Ce(dt($e(M.contents,M.mimeType||"application/octet-stream")),n.data.name):Ce(new Blob([M.contents||""]),n.data.name)},"data-testid":"file-explorer-download-menu-item",children:[(0,a.jsx)(Me,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{})]}),e[84]=c,e[85]=n.data.isDirectory,e[86]=n.data.name,e[87]=n.data.path,e[88]=d,e[89]=me):me=e[89];let pe;e[90]===f?pe=e[91]:(pe=(0,a.jsx)(ya,{onSelect:f,testId:"file-explorer-delete-menu-item"}),e[90]=f,e[91]=pe);let he;e[92]!==V||e[93]!==B||e[94]!==K||e[95]!==q||e[96]!==U||e[97]!==N||e[98]!==P||e[99]!==X||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(fa,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[V,B,K,q,U,N,P,$,X,ce,de,we,me,pe]}),e[92]=V,e[93]=B,e[94]=K,e[95]=q,e[96]=U,e[97]=N,e[98]=P,e[99]=X,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==H||e[106]!==Q||e[107]!==L||e[108]!==he?(xe=(0,a.jsxs)("span",{className:H,children:[Q,L,he]}),e[105]=H,e[106]=Q,e[107]=L,e[108]=he,e[109]=xe):xe=e[109];let Ne;return e[110]!==o||e[111]!==i||e[112]!==Z||e[113]!==J||e[114]!==xe?(Ne=(0,a.jsxs)("div",{style:i,ref:o,className:I,draggable:!0,onClick:Z,children:[J,xe]}),e[110]=o,e[111]=i,e[112]=Z,e[113]=J,e[114]=xe,e[115]=Ne):Ne=e[115],Ne},Fn=t=>{let e=(0,be.c)(3),{node:n}=t;if(!n.data.isDirectory){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=o):o=e[0],o}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Ae,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Tt(t,e){t.stopPropagation(),t.preventDefault(),Ba(e)}function $t(t,e){if(e)return t;let n=[];for(let i of t){if(Cn(i.name))continue;let o=i;if(i.children){let r=$t(i.children,e);r!==i.children&&(o={...i,children:r})}n.push(o)}return n}function Cn(t){return!!t.startsWith(".")}function Sn(){return null}function Dn(t){let{parentNode:e}=t;return!e.data.isDirectory}var Ot=fe(),Mn=Ge("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},We),zn=t=>{let e=(0,Ot.c)(20),{height:n}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noClick:!0,noKeyboard:!0},e[0]=i):i=e[0];let{getRootProps:o,getInputProps:r,isDragActive:d}=zt(i),c;e[1]===o?c=e[2]:(c=o(),e[1]=o,e[2]=c);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=ie("flex flex-col overflow-hidden relative"),e[3]=h):h=e[3];let s;e[4]===n?s=e[5]:(s={height:n},e[4]=n,e[5]=s);let u;e[6]===r?u=e[7]:(u=r(),e[6]=r,e[7]=u);let x;e[8]===u?x=e[9]:(x=(0,a.jsx)("input",{...u}),e[8]=u,e[9]=x);let p;e[10]===d?p=e[11]:(p=d&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),e[10]=d,e[11]=p);let y;e[12]===n?y=e[13]:(y=(0,a.jsx)(vn,{height:n}),e[12]=n,e[13]=y);let g;return e[14]!==c||e[15]!==s||e[16]!==x||e[17]!==p||e[18]!==y?(g=(0,a.jsx)(ln,{children:(0,a.jsxs)("div",{...c,className:h,style:s,children:[x,p,y]})}),e[14]=c,e[15]=s,e[16]=x,e[17]=p,e[18]=y,e[19]=g):g=e[19],g},Pn=33,Tn=()=>{let t=(0,Ot.c)(36),{ref:e,height:n}=$a(),i=n===void 0?500:n,[o,r]=ke(Mn),d=ye(ta).length,c;e:{if(!o.hasUserInteracted&&d>0){if(o.openSections.includes("remote-storage")){c=o.openSections;break e}let I;t[0]===o.openSections?I=t[1]:(I=[...o.openSections,"remote-storage"],t[0]=o.openSections,t[1]=I),c=I;break e}c=o.openSections}let h=c,s;t[2]===r?s=t[3]:(s=I=>{r({openSections:I,hasUserInteracted:!0})},t[2]=r,t[3]=s);let u=s,x=i-Pn*2,p;t[4]===h?p=t[5]:(p=h.includes("remote-storage"),t[4]=h,t[5]=p);let y=p,g;t[6]!==h||t[7]!==y?(g=y&&h.includes("files"),t[6]=h,t[7]=y,t[8]=g):g=t[8];let w=g,v;t[9]!==x||t[10]!==w?(v=w?Math.round(x*.4):x,t[9]=x,t[10]=w,t[11]=v):v=t[11];let l=v,j=Math.max(200,w?x-l:x),m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(rt,{className:"w-4 h-4"}),t[12]=m):m=t[12];let b;t[13]===d?b=t[14]:(b=d>0&&(0,a.jsx)(La,{children:d}),t[13]=d,t[14]=b);let f;t[15]===b?f=t[16]:(f=(0,a.jsxs)(ft,{children:[m," Remote storage",b]}),t[15]=b,t[16]=f);let k;t[17]===l?k=t[18]:(k={maxHeight:l},t[17]=l,t[18]=k);let _;t[19]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)(nn,{}),t[19]=_):_=t[19];let F;t[20]===k?F=t[21]:(F=(0,a.jsx)(ut,{className:"overflow-auto",style:k,children:_}),t[20]=k,t[21]=F);let C;t[22]!==F||t[23]!==f?(C=(0,a.jsxs)(xt,{value:"remote-storage",children:[f,F]}),t[22]=F,t[23]=f,t[24]=C):C=t[24];let z;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=(0,a.jsxs)(ft,{children:[(0,a.jsx)(nt,{className:"w-4 h-4"}),"Files"]}),t[25]=z):z=t[25];let S;t[26]===j?S=t[27]:(S=(0,a.jsxs)(xt,{value:"files",children:[z,(0,a.jsx)(ut,{children:(0,a.jsx)(zn,{height:j})})]}),t[26]=j,t[27]=S);let D;t[28]!==u||t[29]!==h||t[30]!==C||t[31]!==S?(D=(0,a.jsxs)(qt,{type:"multiple",value:h,onValueChange:u,children:[C,S]}),t[28]=u,t[29]=h,t[30]=C,t[31]=S,t[32]=D):D=t[32];let R;return t[33]!==e||t[34]!==D?(R=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:D}),t[33]=e,t[34]=D,t[35]=R):R=t[35],R};export{Tn as default};
|