@marimo-team/frontend 0.23.7-dev51 → 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/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-uDKD04Qe.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-DySiGerD.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-DdZsAcJe.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.23.7-dev51",
3
+ "version": "0.23.7-dev52",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -9,6 +9,7 @@ import {
9
9
  CopyMinusIcon,
10
10
  DownloadIcon,
11
11
  ExternalLinkIcon,
12
+ EyeIcon,
12
13
  EyeOffIcon,
13
14
  FilePlus2Icon,
14
15
  FolderPlusIcon,
@@ -198,6 +199,7 @@ export const FileExplorer: React.FC<{
198
199
  <Toolbar
199
200
  onRefresh={handleRefresh}
200
201
  onHidden={handleHiddenFilesToggle}
202
+ showHiddenFiles={showHiddenFiles}
201
203
  onCreateFile={handleCreateFile}
202
204
  onCreateNotebook={handleCreateNotebook}
203
205
  onCreateFolder={handleCreateFolder}
@@ -265,6 +267,7 @@ const INDENT_STEP = 15;
265
267
  interface ToolbarProps {
266
268
  onRefresh: () => void;
267
269
  onHidden: () => void;
270
+ showHiddenFiles: boolean;
268
271
  onCreateFile: () => void;
269
272
  onCreateNotebook: () => void;
270
273
  onCreateFolder: () => void;
@@ -275,6 +278,7 @@ interface ToolbarProps {
275
278
  const Toolbar = ({
276
279
  onRefresh,
277
280
  onHidden,
281
+ showHiddenFiles,
278
282
  onCreateFile,
279
283
  onCreateNotebook,
280
284
  onCreateFolder,
@@ -334,14 +338,20 @@ const Toolbar = ({
334
338
  data-testid="file-explorer-refresh-button"
335
339
  onClick={onRefresh}
336
340
  />
337
- <Tooltip content="Toggle hidden files">
341
+ <Tooltip
342
+ content={showHiddenFiles ? "Hide hidden files" : "Show hidden files"}
343
+ >
338
344
  <Button
339
345
  data-testid="file-explorer-hidden-files-button"
340
346
  onClick={onHidden}
341
347
  variant="text"
342
348
  size="xs"
343
349
  >
344
- <EyeOffIcon size={16} />
350
+ {showHiddenFiles ? (
351
+ <EyeIcon size={16} className="text-primary" />
352
+ ) : (
353
+ <EyeOffIcon size={16} />
354
+ )}
345
355
  </Button>
346
356
  </Tooltip>
347
357
  <Tooltip content="Collapse all folders">
@@ -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-DbE28H1u.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-Dxol3ZtH.js";import{c as Yt,i as ze,r as Ce}from"./download-DEJbA1IY.js";import{r as Ye}from"./radio-group-BS2PIEzV.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-DGqYztXR.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-BjTIuMQg.js";import{t as nt}from"./file-HTLbeC2b.js";import{i as rt,r as ca,t as st}from"./add-connection-dialog-CMR-c9XE.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-CIu-0LbU.js";import{o as Pa}from"./focus-0RBjdtZw.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-Cj3Al1Y6.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-DUd0ki0p.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};