@marimo-team/frontend 0.23.2-dev42 → 0.23.2-dev44
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/{edit-page-DLoHgnmR.js → edit-page-mEKXGNP8.js} +2 -2
- package/dist/assets/{file-explorer-panel-BUgLGfwg.js → file-explorer-panel-DH1Yf6zQ.js} +1 -1
- package/dist/assets/{index-D7RqQR10.js → index-BMa4-yRO.js} +2 -2
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/editor/file-tree/file-explorer.tsx +1 -0
|
@@ -23,4 +23,4 @@ ${ae}...
|
|
|
23
23
|
${ae}...
|
|
24
24
|
`,unknown:t=>`with open("${t}", "r") as _f:
|
|
25
25
|
${ae}...
|
|
26
|
-
`};var nn=oe(),sn=1024*1024*100;function _t(t){let e=(0,nn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:r}=we(),s;e[2]===r?s=e[3]:(s=async c=>{if(c.length===0)return;let h=c.length===1;await Gt(h?"Uploading file...":"Uploading files...",async l=>{l.addTotal(c.length);for(let f of c){let x=hn(dn(f)),p="";x&&(p=Se.guessDeliminator(x).dirname(x));let g=(await ua(f)).split(",")[1];await r({path:p,type:"file",name:f.name,contents:g}),l.increment(1)}await an()},{title:h?"File uploaded":`${c.length} files uploaded`})},e[2]=r,e[3]=s);let d;return e[4]!==i||e[5]!==s?(d={multiple:!0,maxSize:sn,onError:cn,onDropRejected:rn,onDrop:s,...i},e[4]=i,e[5]=s,e[6]=d):d=e[6],pa(d)}function rn(t){I({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(ln)}),variant:"danger"})}function ln(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(on).join(", "),")"]},t.file.name)}function on(t){return t.message}function cn(t){je.error(t),I({title:"File upload failed",description:t.message,variant:"danger"})}function dn(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 hn(t){if(t)return t.replace(/^\/+/,"")}var de=oe(),mn=Be("marimo:showHiddenFiles",!0,Ie,{getOnInit:!0}),St=z.createContext(null);const pn=t=>{let e=(0,de.c)(72),{height:n}=t,i=(0,z.useRef)(null),r=Ya(),[s]=fe(Ft),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,h]=(0,z.useState)(d),[l,f]=(0,z.useState)(null),[x,p]=fe(mn),{openPrompt:g}=nt(),[j,w]=fe(tn),v;e[1]===s?v=e[2]:(v=()=>s.initialize(h),e[1]=s,e[2]=v);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[3]=o):o=e[3];let{isPending:y,error:m}=De(v,o),b;e[4]!==j||e[5]!==s?(b=()=>s.refreshAll(Object.keys(j).filter(k=>j[k])),e[4]=j,e[5]=s,e[6]=b):b=e[6];let u=J(b),N;e[7]!==p||e[8]!==x?(N=()=>{p(!x)},e[7]=p,e[8]=x,e[9]=N):N=e[9];let F=J(N),_;e[10]!==g||e[11]!==s?(_=async()=>{g({title:"Folder name",onConfirm:async k=>{s.createFolder(k,null)}})},e[10]=g,e[11]=s,e[12]=_):_=e[12];let S=J(_),M;e[13]!==g||e[14]!==s?(M=async()=>{g({title:"File name",onConfirm:async k=>{s.createFile(k,null)}})},e[13]=g,e[14]=s,e[15]=M):M=e[15];let P=J(M),D;e[16]!==g||e[17]!==s?(D=async()=>{g({title:"Notebook name",onConfirm:async k=>{s.createFile(k,null,"notebook")}})},e[16]=g,e[17]=s,e[18]=D):D=e[18];let A=J(D),R;e[19]===w?R=e[20]:(R=()=>{var k;(k=i.current)==null||k.closeAll(),w({})},e[19]=w,e[20]=R);let ne=J(R),Y;e[21]!==c||e[22]!==x?(Y=Dt(c,x),e[21]=c,e[22]=x,e[23]=Y):Y=e[23];let K=Y;if(y){let k;return e[24]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(la,{size:"medium",centered:!0}),e[24]=k):k=e[24],k}if(m){let k;return e[25]===m?k=e[26]:(k=(0,a.jsx)(rt,{error:m}),e[25]=m,e[26]=k),k}if(l){let k;e[27]===Symbol.for("react.memo_cache_sentinel")?(k=()=>f(null),e[27]=k):k=e[27];let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(T,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ge,{size:16})}),e[28]=O):O=e[28];let W;e[29]===l.name?W=e[30]:(W=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[O,(0,a.jsx)("span",{className:"font-bold",children:l.name})]}),e[29]=l.name,e[30]=W);let ie;e[31]!==l.path||e[32]!==s?(ie=zt=>Pt(zt,s.relativeFromRoot(l.path)),e[31]=l.path,e[32]=s,e[33]=ie):ie=e[33];let le;e[34]!==l||e[35]!==ie?(le=(0,a.jsx)(z.Suspense,{children:(0,a.jsx)(Xa,{onOpenNotebook:ie,file:l})}),e[34]=l,e[35]=ie,e[36]=le):le=e[36];let pe;return e[37]!==W||e[38]!==le?(pe=(0,a.jsxs)(a.Fragment,{children:[W,le]}),e[37]=W,e[38]=le,e[39]=pe):pe=e[39],pe}let B;e[40]!==ne||e[41]!==P||e[42]!==S||e[43]!==A||e[44]!==F||e[45]!==u||e[46]!==s?(B=(0,a.jsx)(xn,{onRefresh:u,onHidden:F,onCreateFile:P,onCreateNotebook:A,onCreateFolder:S,onCollapseAll:ne,tree:s}),e[40]=ne,e[41]=P,e[42]=S,e[43]=A,e[44]=F,e[45]=u,e[46]=s,e[47]=B):B=e[47];let se=n-33,V,H,L;e[48]===s?(V=e[49],H=e[50],L=e[51]):(V=async k=>{let{ids:O}=k;for(let W of O)await s.delete(W)},H=async k=>{let{id:O,name:W}=k;await s.rename(O,W)},L=async k=>{let{dragIds:O,parentId:W}=k;await s.move(O,W)},e[48]=s,e[49]=V,e[50]=H,e[51]=L);let Z;e[52]===Symbol.for("react.memo_cache_sentinel")?(Z=k=>{let O=k[0];O&&(O.data.isDirectory||f(O.data))},e[52]=Z):Z=e[52];let q;e[53]!==j||e[54]!==w||e[55]!==s?(q=async k=>{if(await s.expand(k)){let O=j[k]??!1;w({...j,[k]:!O})}},e[53]=j,e[54]=w,e[55]=s,e[56]=q):q=e[56];let U;e[57]!==r||e[58]!==j||e[59]!==se||e[60]!==V||e[61]!==H||e[62]!==L||e[63]!==q||e[64]!==K?(U=(0,a.jsx)(ba,{width:"100%",ref:i,height:se,className:"h-full",data:K,initialOpenState:j,openByDefault:!1,dndManager:r,renderCursor:vn,disableDrop:wn,onDelete:V,onRename:H,onMove:L,onSelect:Z,onToggle:q,padding:15,rowHeight:30,indent:fn,overscanCount:1e3,disableMultiSelection:!0,children:yn}),e[57]=r,e[58]=j,e[59]=se,e[60]=V,e[61]=H,e[62]=L,e[63]=q,e[64]=K,e[65]=U):U=e[65];let G;e[66]!==U||e[67]!==s?(G=(0,a.jsx)(St,{value:s,children:U}),e[66]=U,e[67]=s,e[68]=G):G=e[68];let C;return e[69]!==B||e[70]!==G?(C=(0,a.jsxs)(a.Fragment,{children:[B,G]}),e[69]=B,e[70]=G,e[71]=C):C=e[71],C};var fn=15,xn=t=>{let e=(0,de.c)(37),{onRefresh:n,onHidden:i,onCreateFile:r,onCreateNotebook:s,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:l,getInputProps:f}=_t(h),x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(pt,{size:16}),e[1]=x):x=e[1];let p;e[2]===s?p=e[3]:(p=(0,a.jsx)(E,{content:"Add notebook",children:(0,a.jsx)(T,{"data-testid":"file-explorer-add-notebook-button",onClick:s,variant:"text",size:"xs",children:x})}),e[2]=s,e[3]=p);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(ft,{size:16}),e[4]=g):g=e[4];let j;e[5]===r?j=e[6]:(j=(0,a.jsx)(E,{content:"Add file",children:(0,a.jsx)(T,{"data-testid":"file-explorer-add-file-button",onClick:r,variant:"text",size:"xs",children:g})}),e[5]=r,e[6]=j);let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsx)(xt,{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)(T,{"data-testid":"file-explorer-add-folder-button",onClick:d,variant:"text",size:"xs",children:w})}),e[8]=d,e[9]=v);let o;e[10]===l?o=e[11]:(o=l({}),e[10]=l,e[11]=o);let y,m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=Kt({variant:"text",size:"xs"}),y=(0,a.jsx)(ha,{size:16}),e[12]=y,e[13]=m):(y=e[12],m=e[13]);let b;e[14]===o?b=e[15]:(b=(0,a.jsx)(E,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...o,className:m,children:y})}),e[14]=o,e[15]=b);let u;e[16]===f?u=e[17]:(u=f({}),e[16]=f,e[17]=u);let N;e[18]===u?N=e[19]:(N=(0,a.jsx)("input",{...u,type:"file"}),e[18]=u,e[19]=N);let F;e[20]===n?F=e[21]:(F=(0,a.jsx)(ct,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=F);let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)(aa,{size:16}),e[22]=_):_=e[22];let S;e[23]===i?S=e[24]:(S=(0,a.jsx)(E,{content:"Toggle hidden files",children:(0,a.jsx)(T,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:_})}),e[23]=i,e[24]=S);let M;e[25]===Symbol.for("react.memo_cache_sentinel")?(M=(0,a.jsx)(Ra,{size:16}),e[25]=M):M=e[25];let P;e[26]===c?P=e[27]:(P=(0,a.jsx)(E,{content:"Collapse all folders",children:(0,a.jsx)(T,{"data-testid":"file-explorer-collapse-button",onClick:c,variant:"text",size:"xs",children:M})}),e[26]=c,e[27]=P);let D;return e[28]!==b||e[29]!==N||e[30]!==F||e[31]!==S||e[32]!==P||e[33]!==p||e[34]!==j||e[35]!==v?(D=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[p,j,v,b,N,F,S,P]}),e[28]=b,e[29]=N,e[30]=F,e[31]=S,e[32]=P,e[33]=p,e[34]=j,e[35]=v,e[36]=D):D=e[36],D},un=t=>{let e=(0,de.c)(9),{node:n,onOpenMarimoFile:i}=t,r;e[0]===n?r=e[1]:(r=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=r);let s;e[2]!==n.data.isMarimoFile||e[3]!==i?(s=n.data.isMarimoFile&&!xe()&&(0,a.jsxs)("span",{className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:i,children:["open ",(0,a.jsx)(ke,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=s):s=e[4];let d;return e[5]!==n.data.name||e[6]!==r||e[7]!==s?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=d):d=e[8],d},gn=t=>{let e=(0,de.c)(10),{node:n}=t,i=(0,z.useRef)(null),r,s;e[0]===n.data.name?(r=e[1],s=e[2]):(r=()=>{var l,f;(l=i.current)==null||l.focus(),(f=i.current)==null||f.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s),(0,z.useEffect)(r,s);let d,c;e[3]===n?(d=e[4],c=e[5]):(d=()=>n.reset(),c=l=>{l.key==="Escape"&&n.reset(),l.key==="Enter"&&n.submit(l.currentTarget.value)},e[3]=n,e[4]=d,e[5]=c);let h;return e[6]!==n.data.name||e[7]!==d||e[8]!==c?(h=(0,a.jsx)("input",{ref:i,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:Nn,onBlur:d,onKeyDown:c}),e[6]=n.data.name,e[7]=d,e[8]=c,e[9]=h):h=e[9],h},yn=t=>{let e=(0,de.c)(71),{node:n,style:i,dragHandle:r}=t,{openFile:s,sendFileDetails:d}=we(),c=he(Ve),h;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(h=n.data.isDirectory?"directory":sa(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=h):h=e[2];let l=h,f=ra[l],{openConfirm:x,openPrompt:p}=nt(),{createNewCell:g}=At(),j=Ca(),w;e[3]!==g||e[4]!==j?(w=C=>{g({code:C,before:!1,cellId:j??"__end__"})},e[3]=g,e[4]=j,e[5]=w):w=e[5];let v=w,o=(0,z.use)(St),y;e[6]!==n.data.path||e[7]!==o?(y=async C=>{Pt(C,o?o.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=o,e[8]=y):y=e[8];let m=y,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==x?(b=async C=>{C.stopPropagation(),C.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 u=b,N;e[14]!==n||e[15]!==p||e[16]!==o?(N=async()=>{n.open(),p({title:"Folder name",onConfirm:async C=>{o==null||o.createFolder(C,n.id)}})},e[14]=n,e[15]=p,e[16]=o,e[17]=N):N=e[17];let F=J(N),_;e[18]!==n||e[19]!==p||e[20]!==o?(_=async()=>{n.open(),p({title:"File name",onConfirm:async C=>{o==null||o.createFile(C,n.id)}})},e[18]=n,e[19]=p,e[20]=o,e[21]=_):_=e[21];let S=J(_),M;e[22]!==n||e[23]!==p||e[24]!==o?(M=async()=>{n.open(),p({title:"Notebook name",onConfirm:async C=>{o==null||o.createFile(C,n.id,"notebook")}})},e[22]=n,e[23]=p,e[24]=o,e[25]=M):M=e[25];let P=J(M),D;e[26]!==n.data.name||e[27]!==n.id||e[28]!==o?(D=async()=>{if(!o)return;let[C,k]=ma(n.data.name),O=`${C}_copy${k}`;await o.copy(n.id,O)},e[26]=n.data.name,e[27]=n.id,e[28]=o,e[29]=D):D=e[29];let A=J(D),R;e[30]!==c||e[31]!==l||e[32]!==S||e[33]!==F||e[34]!==P||e[35]!==u||e[36]!==A||e[37]!==v||e[38]!==m||e[39]!==n||e[40]!==s||e[41]!==d||e[42]!==o?(R=()=>(0,a.jsxs)(Le,{align:"end",className:"print:hidden w-[220px]",onClick:kn,onCloseAutoFocus:Fn,children:[!n.data.isDirectory&&(0,a.jsxs)($,{onSelect:()=>n.select(),children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),!n.data.isDirectory&&!xe()&&(0,a.jsxs)($,{onSelect:()=>{s({path:n.data.path})},children:[(0,a.jsx)(ke,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)($,{onSelect:()=>P(),children:[(0,a.jsx)(pt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)($,{onSelect:()=>S(),children:[(0,a.jsx)(ft,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)($,{onSelect:()=>F(),children:[(0,a.jsx)(xt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ce,{})]}),(0,a.jsxs)($,{onSelect:()=>n.edit(),children:[(0,a.jsx)(Ea,{className:ee}),"Rename"]}),(0,a.jsxs)($,{onSelect:A,children:[(0,a.jsx)(Ce,{className:ee}),"Duplicate"]}),(0,a.jsxs)($,{onSelect:async()=>{await me(n.data.path),I({title:"Copied to clipboard"})},children:[(0,a.jsx)(ut,{className:ee}),"Copy path"]}),o&&(0,a.jsxs)($,{onSelect:async()=>{await me(o.relativeFromRoot(n.data.path)),I({title:"Copied to clipboard"})},children:[(0,a.jsx)(ut,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),(0,a.jsx)(ce,{}),(0,a.jsxs)($,{onSelect:()=>{let{path:C}=n.data;v(Ct[l](C))},children:[(0,a.jsx)(Xt,{className:ee}),"Insert snippet for reading file"]}),(0,a.jsxs)($,{onSelect:async()=>{I({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:C}=n.data;await me(Ct[l](C))},children:[(0,a.jsx)(Et,{className:ee}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!xe()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ce,{}),(0,a.jsxs)($,{onSelect:m,children:[(0,a.jsx)(Ia,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),(0,a.jsx)(ce,{}),!n.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)($,{onSelect:async()=>{let C=await d({path:n.data.path});C.isBase64&&C.contents?ge(st(Fe(C.contents,C.mimeType||"application/octet-stream")),n.data.name):ge(new Blob([C.contents||""]),n.data.name)},children:[(0,a.jsx)(be,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ce,{})]}),(0,a.jsxs)($,{onSelect:u,variant:"danger",children:[(0,a.jsx)(ca,{className:ee}),"Delete"]})]}),e[30]=c,e[31]=l,e[32]=S,e[33]=F,e[34]=P,e[35]=u,e[36]=A,e[37]=v,e[38]=m,e[39]=n,e[40]=s,e[41]=d,e[42]=o,e[43]=R):R=e[43];let ne=R,Y;e[44]===Symbol.for("react.memo_cache_sentinel")?(Y=re("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[44]=Y):Y=e[44];let K,B;e[45]===n?(K=e[46],B=e[47]):(K=C=>{C.stopPropagation(),n.data.isDirectory&&n.toggle()},B=(0,a.jsx)(jn,{node:n}),e[45]=n,e[46]=K,e[47]=B);let se=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",V;e[48]===se?V=e[49]:(V=re("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",se),e[48]=se,e[49]=V);let H;e[50]!==f||e[51]!==l||e[52]!==n.data.isMarimoFile?(H=n.data.isMarimoFile?(0,a.jsx)(Oa,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(f,{className:re("w-5 h-5 shrink-0 mr-2",Ye[l]),strokeWidth:1.5}),e[50]=f,e[51]=l,e[52]=n.data.isMarimoFile,e[53]=H):H=e[53];let L;e[54]!==m||e[55]!==n?(L=n.isEditing?(0,a.jsx)(gn,{node:n}):(0,a.jsx)(un,{node:n,onOpenMarimoFile:m}),e[54]=m,e[55]=n,e[56]=L):L=e[56];let Z;e[57]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,a.jsx)(He,{asChild:!0,tabIndex:-1,onClick:Cn,children:(0,a.jsx)(ot,{"data-testid":"file-explorer-more-button",iconClassName:"w-5 h-5"})}),e[57]=Z):Z=e[57];let q;e[58]===ne?q=e[59]:(q=(0,a.jsxs)(qe,{modal:!1,children:[Z,ne()]}),e[58]=ne,e[59]=q);let U;e[60]!==V||e[61]!==H||e[62]!==L||e[63]!==q?(U=(0,a.jsxs)("span",{className:V,children:[H,L,q]}),e[60]=V,e[61]=H,e[62]=L,e[63]=q,e[64]=U):U=e[64];let G;return e[65]!==r||e[66]!==i||e[67]!==K||e[68]!==B||e[69]!==U?(G=(0,a.jsxs)("div",{style:i,ref:r,className:Y,draggable:!0,onClick:K,children:[B,U]}),e[65]=r,e[66]=i,e[67]=K,e[68]=B,e[69]=U,e[70]=G):G=e[70],G},jn=t=>{let e=(0,de.c)(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=r):r=e[0],r}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Me,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Pt(t,e){t.stopPropagation(),t.preventDefault(),$a(e)}function Dt(t,e){if(e)return t;let n=[];for(let i of t){if(bn(i.name))continue;let r=i;if(i.children){let s=Dt(i.children,e);s!==i.children&&(r={...i,children:s})}n.push(r)}return n}function bn(t){return!!t.startsWith(".")}function vn(){return null}function wn(t){let{parentNode:e}=t;return!e.data.isDirectory}function Nn(t){return t.stopPropagation()}function kn(t){return t.stopPropagation()}function Fn(t){return t.preventDefault()}function Cn(t){return t.stopPropagation()}var Mt=oe(),_n=Be("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},Ie),Sn=t=>{let e=(0,Mt.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:r,getInputProps:s,isDragActive:d}=_t(i),c;e[1]===r?c=e[2]:(c=r(),e[1]=r,e[2]=c);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=re("flex flex-col overflow-hidden relative"),e[3]=h):h=e[3];let l;e[4]===n?l=e[5]:(l={height:n},e[4]=n,e[5]=l);let f;e[6]===s?f=e[7]:(f=s(),e[6]=s,e[7]=f);let x;e[8]===f?x=e[9]:(x=(0,a.jsx)("input",{...f}),e[8]=f,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 g;e[12]===n?g=e[13]:(g=(0,a.jsx)(pn,{height:n}),e[12]=n,e[13]=g);let j;return e[14]!==c||e[15]!==l||e[16]!==x||e[17]!==p||e[18]!==g?(j=(0,a.jsx)(Qa,{children:(0,a.jsxs)("div",{...c,className:h,style:l,children:[x,p,g]})}),e[14]=c,e[15]=l,e[16]=x,e[17]=p,e[18]=g,e[19]=j):j=e[19],j},Pn=33,Dn=()=>{let t=(0,Mt.c)(36),{ref:e,height:n}=Sa(),i=n===void 0?500:n,[r,s]=fe(_n),d=he(Qt).length,c;e:{if(!r.hasUserInteracted&&d>0){if(r.openSections.includes("remote-storage")){c=r.openSections;break e}let R;t[0]===r.openSections?R=t[1]:(R=[...r.openSections,"remote-storage"],t[0]=r.openSections,t[1]=R),c=R;break e}c=r.openSections}let h=c,l;t[2]===s?l=t[3]:(l=R=>{s({openSections:R,hasUserInteracted:!0})},t[2]=s,t[3]=l);let f=l,x=i-Pn*2,p;t[4]===h?p=t[5]:(p=h.includes("remote-storage"),t[4]=h,t[5]=p);let g=p,j;t[6]!==h||t[7]!==g?(j=g&&h.includes("files"),t[6]=h,t[7]=g,t[8]=j):j=t[8];let w=j,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 o=v,y=Math.max(200,w?x-o:x),m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Qe,{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)(za,{children:d}),t[13]=d,t[14]=b);let u;t[15]===b?u=t[16]:(u=(0,a.jsxs)(ht,{children:[m," Remote storage",b]}),t[15]=b,t[16]=u);let N;t[17]===o?N=t[18]:(N={maxHeight:o},t[17]=o,t[18]=N);let F;t[19]===Symbol.for("react.memo_cache_sentinel")?(F=(0,a.jsx)(Ja,{}),t[19]=F):F=t[19];let _;t[20]===N?_=t[21]:(_=(0,a.jsx)(mt,{className:"overflow-auto",style:N,children:F}),t[20]=N,t[21]=_);let S;t[22]!==_||t[23]!==u?(S=(0,a.jsxs)(dt,{value:"remote-storage",children:[u,_]}),t[22]=_,t[23]=u,t[24]=S):S=t[24];let M;t[25]===Symbol.for("react.memo_cache_sentinel")?(M=(0,a.jsxs)(ht,{children:[(0,a.jsx)(Ze,{className:"w-4 h-4"}),"Files"]}),t[25]=M):M=t[25];let P;t[26]===y?P=t[27]:(P=(0,a.jsxs)(dt,{value:"files",children:[M,(0,a.jsx)(mt,{children:(0,a.jsx)(Sn,{height:y})})]}),t[26]=y,t[27]=P);let D;t[28]!==f||t[29]!==h||t[30]!==S||t[31]!==P?(D=(0,a.jsxs)(qt,{type:"multiple",value:h,onValueChange:f,children:[S,P]}),t[28]=f,t[29]=h,t[30]=S,t[31]=P,t[32]=D):D=t[32];let A;return t[33]!==e||t[34]!==D?(A=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:D}),t[33]=e,t[34]=D,t[35]=A):A=t[35],A};export{Dn as default};
|
|
26
|
+
`};var nn=oe(),sn=1024*1024*100;function _t(t){let e=(0,nn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:r}=we(),s;e[2]===r?s=e[3]:(s=async c=>{if(c.length===0)return;let h=c.length===1;await Gt(h?"Uploading file...":"Uploading files...",async l=>{l.addTotal(c.length);for(let f of c){let x=hn(dn(f)),p="";x&&(p=Se.guessDeliminator(x).dirname(x));let g=(await ua(f)).split(",")[1];await r({path:p,type:"file",name:f.name,contents:g}),l.increment(1)}await an()},{title:h?"File uploaded":`${c.length} files uploaded`})},e[2]=r,e[3]=s);let d;return e[4]!==i||e[5]!==s?(d={multiple:!0,maxSize:sn,onError:cn,onDropRejected:rn,onDrop:s,...i},e[4]=i,e[5]=s,e[6]=d):d=e[6],pa(d)}function rn(t){I({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(ln)}),variant:"danger"})}function ln(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(on).join(", "),")"]},t.file.name)}function on(t){return t.message}function cn(t){je.error(t),I({title:"File upload failed",description:t.message,variant:"danger"})}function dn(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 hn(t){if(t)return t.replace(/^\/+/,"")}var de=oe(),mn=Be("marimo:showHiddenFiles",!0,Ie,{getOnInit:!0}),St=z.createContext(null);const pn=t=>{let e=(0,de.c)(72),{height:n}=t,i=(0,z.useRef)(null),r=Ya(),[s]=fe(Ft),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,h]=(0,z.useState)(d),[l,f]=(0,z.useState)(null),[x,p]=fe(mn),{openPrompt:g}=nt(),[j,w]=fe(tn),v;e[1]===s?v=e[2]:(v=()=>s.initialize(h),e[1]=s,e[2]=v);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[3]=o):o=e[3];let{isPending:y,error:m}=De(v,o),b;e[4]!==j||e[5]!==s?(b=()=>s.refreshAll(Object.keys(j).filter(k=>j[k])),e[4]=j,e[5]=s,e[6]=b):b=e[6];let u=J(b),N;e[7]!==p||e[8]!==x?(N=()=>{p(!x)},e[7]=p,e[8]=x,e[9]=N):N=e[9];let F=J(N),_;e[10]!==g||e[11]!==s?(_=async()=>{g({title:"Folder name",onConfirm:async k=>{s.createFolder(k,null)}})},e[10]=g,e[11]=s,e[12]=_):_=e[12];let S=J(_),M;e[13]!==g||e[14]!==s?(M=async()=>{g({title:"File name",onConfirm:async k=>{s.createFile(k,null)}})},e[13]=g,e[14]=s,e[15]=M):M=e[15];let P=J(M),D;e[16]!==g||e[17]!==s?(D=async()=>{g({title:"Notebook name",onConfirm:async k=>{s.createFile(k,null,"notebook")}})},e[16]=g,e[17]=s,e[18]=D):D=e[18];let A=J(D),R;e[19]===w?R=e[20]:(R=()=>{var k;(k=i.current)==null||k.closeAll(),w({})},e[19]=w,e[20]=R);let ne=J(R),Y;e[21]!==c||e[22]!==x?(Y=Dt(c,x),e[21]=c,e[22]=x,e[23]=Y):Y=e[23];let K=Y;if(y){let k;return e[24]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(la,{size:"medium",centered:!0}),e[24]=k):k=e[24],k}if(m){let k;return e[25]===m?k=e[26]:(k=(0,a.jsx)(rt,{error:m}),e[25]=m,e[26]=k),k}if(l){let k;e[27]===Symbol.for("react.memo_cache_sentinel")?(k=()=>f(null),e[27]=k):k=e[27];let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(T,{onClick:k,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ge,{size:16})}),e[28]=O):O=e[28];let W;e[29]===l.name?W=e[30]:(W=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[O,(0,a.jsx)("span",{className:"font-bold",children:l.name})]}),e[29]=l.name,e[30]=W);let ie;e[31]!==l.path||e[32]!==s?(ie=zt=>Pt(zt,s.relativeFromRoot(l.path)),e[31]=l.path,e[32]=s,e[33]=ie):ie=e[33];let le;e[34]!==l||e[35]!==ie?(le=(0,a.jsx)(z.Suspense,{children:(0,a.jsx)(Xa,{onOpenNotebook:ie,file:l})}),e[34]=l,e[35]=ie,e[36]=le):le=e[36];let pe;return e[37]!==W||e[38]!==le?(pe=(0,a.jsxs)(a.Fragment,{children:[W,le]}),e[37]=W,e[38]=le,e[39]=pe):pe=e[39],pe}let B;e[40]!==ne||e[41]!==P||e[42]!==S||e[43]!==A||e[44]!==F||e[45]!==u||e[46]!==s?(B=(0,a.jsx)(xn,{onRefresh:u,onHidden:F,onCreateFile:P,onCreateNotebook:A,onCreateFolder:S,onCollapseAll:ne,tree:s}),e[40]=ne,e[41]=P,e[42]=S,e[43]=A,e[44]=F,e[45]=u,e[46]=s,e[47]=B):B=e[47];let se=n-33,V,H,L;e[48]===s?(V=e[49],H=e[50],L=e[51]):(V=async k=>{let{ids:O}=k;for(let W of O)await s.delete(W)},H=async k=>{let{id:O,name:W}=k;await s.rename(O,W)},L=async k=>{let{dragIds:O,parentId:W}=k;await s.move(O,W)},e[48]=s,e[49]=V,e[50]=H,e[51]=L);let Z;e[52]===Symbol.for("react.memo_cache_sentinel")?(Z=k=>{let O=k[0];O&&(O.data.isDirectory||f(O.data))},e[52]=Z):Z=e[52];let q;e[53]!==j||e[54]!==w||e[55]!==s?(q=async k=>{if(await s.expand(k)){let O=j[k]??!1;w({...j,[k]:!O})}},e[53]=j,e[54]=w,e[55]=s,e[56]=q):q=e[56];let U;e[57]!==r||e[58]!==j||e[59]!==se||e[60]!==V||e[61]!==H||e[62]!==L||e[63]!==q||e[64]!==K?(U=(0,a.jsx)(ba,{width:"100%",ref:i,height:se,className:"h-full",data:K,initialOpenState:j,openByDefault:!1,dndManager:r,renderCursor:vn,disableDrop:wn,onDelete:V,onRename:H,onMove:L,onSelect:Z,onToggle:q,padding:15,rowHeight:30,indent:fn,overscanCount:1e3,disableMultiSelection:!0,children:yn}),e[57]=r,e[58]=j,e[59]=se,e[60]=V,e[61]=H,e[62]=L,e[63]=q,e[64]=K,e[65]=U):U=e[65];let G;e[66]!==U||e[67]!==s?(G=(0,a.jsx)(St,{value:s,children:U}),e[66]=U,e[67]=s,e[68]=G):G=e[68];let C;return e[69]!==B||e[70]!==G?(C=(0,a.jsxs)(a.Fragment,{children:[B,G]}),e[69]=B,e[70]=G,e[71]=C):C=e[71],C};var fn=15,xn=t=>{let e=(0,de.c)(37),{onRefresh:n,onHidden:i,onCreateFile:r,onCreateNotebook:s,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:l,getInputProps:f}=_t(h),x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(pt,{size:16}),e[1]=x):x=e[1];let p;e[2]===s?p=e[3]:(p=(0,a.jsx)(E,{content:"Add notebook",children:(0,a.jsx)(T,{"data-testid":"file-explorer-add-notebook-button",onClick:s,variant:"text",size:"xs",children:x})}),e[2]=s,e[3]=p);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(ft,{size:16}),e[4]=g):g=e[4];let j;e[5]===r?j=e[6]:(j=(0,a.jsx)(E,{content:"Add file",children:(0,a.jsx)(T,{"data-testid":"file-explorer-add-file-button",onClick:r,variant:"text",size:"xs",children:g})}),e[5]=r,e[6]=j);let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsx)(xt,{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)(T,{"data-testid":"file-explorer-add-folder-button",onClick:d,variant:"text",size:"xs",children:w})}),e[8]=d,e[9]=v);let o;e[10]===l?o=e[11]:(o=l({}),e[10]=l,e[11]=o);let y,m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=Kt({variant:"text",size:"xs"}),y=(0,a.jsx)(ha,{size:16}),e[12]=y,e[13]=m):(y=e[12],m=e[13]);let b;e[14]===o?b=e[15]:(b=(0,a.jsx)(E,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...o,className:m,children:y})}),e[14]=o,e[15]=b);let u;e[16]===f?u=e[17]:(u=f({}),e[16]=f,e[17]=u);let N;e[18]===u?N=e[19]:(N=(0,a.jsx)("input",{...u,type:"file"}),e[18]=u,e[19]=N);let F;e[20]===n?F=e[21]:(F=(0,a.jsx)(ct,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=F);let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)(aa,{size:16}),e[22]=_):_=e[22];let S;e[23]===i?S=e[24]:(S=(0,a.jsx)(E,{content:"Toggle hidden files",children:(0,a.jsx)(T,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:_})}),e[23]=i,e[24]=S);let M;e[25]===Symbol.for("react.memo_cache_sentinel")?(M=(0,a.jsx)(Ra,{size:16}),e[25]=M):M=e[25];let P;e[26]===c?P=e[27]:(P=(0,a.jsx)(E,{content:"Collapse all folders",children:(0,a.jsx)(T,{"data-testid":"file-explorer-collapse-button",onClick:c,variant:"text",size:"xs",children:M})}),e[26]=c,e[27]=P);let D;return e[28]!==b||e[29]!==N||e[30]!==F||e[31]!==S||e[32]!==P||e[33]!==p||e[34]!==j||e[35]!==v?(D=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[p,j,v,b,N,F,S,P]}),e[28]=b,e[29]=N,e[30]=F,e[31]=S,e[32]=P,e[33]=p,e[34]=j,e[35]=v,e[36]=D):D=e[36],D},un=t=>{let e=(0,de.c)(9),{node:n,onOpenMarimoFile:i}=t,r;e[0]===n?r=e[1]:(r=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=r);let s;e[2]!==n.data.isMarimoFile||e[3]!==i?(s=n.data.isMarimoFile&&!xe()&&(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)(ke,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=s):s=e[4];let d;return e[5]!==n.data.name||e[6]!==r||e[7]!==s?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=d):d=e[8],d},gn=t=>{let e=(0,de.c)(10),{node:n}=t,i=(0,z.useRef)(null),r,s;e[0]===n.data.name?(r=e[1],s=e[2]):(r=()=>{var l,f;(l=i.current)==null||l.focus(),(f=i.current)==null||f.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s),(0,z.useEffect)(r,s);let d,c;e[3]===n?(d=e[4],c=e[5]):(d=()=>n.reset(),c=l=>{l.key==="Escape"&&n.reset(),l.key==="Enter"&&n.submit(l.currentTarget.value)},e[3]=n,e[4]=d,e[5]=c);let h;return e[6]!==n.data.name||e[7]!==d||e[8]!==c?(h=(0,a.jsx)("input",{ref:i,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:Nn,onBlur:d,onKeyDown:c}),e[6]=n.data.name,e[7]=d,e[8]=c,e[9]=h):h=e[9],h},yn=t=>{let e=(0,de.c)(71),{node:n,style:i,dragHandle:r}=t,{openFile:s,sendFileDetails:d}=we(),c=he(Ve),h;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(h=n.data.isDirectory?"directory":sa(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=h):h=e[2];let l=h,f=ra[l],{openConfirm:x,openPrompt:p}=nt(),{createNewCell:g}=At(),j=Ca(),w;e[3]!==g||e[4]!==j?(w=C=>{g({code:C,before:!1,cellId:j??"__end__"})},e[3]=g,e[4]=j,e[5]=w):w=e[5];let v=w,o=(0,z.use)(St),y;e[6]!==n.data.path||e[7]!==o?(y=async C=>{Pt(C,o?o.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=o,e[8]=y):y=e[8];let m=y,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==x?(b=async C=>{C.stopPropagation(),C.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 u=b,N;e[14]!==n||e[15]!==p||e[16]!==o?(N=async()=>{n.open(),p({title:"Folder name",onConfirm:async C=>{o==null||o.createFolder(C,n.id)}})},e[14]=n,e[15]=p,e[16]=o,e[17]=N):N=e[17];let F=J(N),_;e[18]!==n||e[19]!==p||e[20]!==o?(_=async()=>{n.open(),p({title:"File name",onConfirm:async C=>{o==null||o.createFile(C,n.id)}})},e[18]=n,e[19]=p,e[20]=o,e[21]=_):_=e[21];let S=J(_),M;e[22]!==n||e[23]!==p||e[24]!==o?(M=async()=>{n.open(),p({title:"Notebook name",onConfirm:async C=>{o==null||o.createFile(C,n.id,"notebook")}})},e[22]=n,e[23]=p,e[24]=o,e[25]=M):M=e[25];let P=J(M),D;e[26]!==n.data.name||e[27]!==n.id||e[28]!==o?(D=async()=>{if(!o)return;let[C,k]=ma(n.data.name),O=`${C}_copy${k}`;await o.copy(n.id,O)},e[26]=n.data.name,e[27]=n.id,e[28]=o,e[29]=D):D=e[29];let A=J(D),R;e[30]!==c||e[31]!==l||e[32]!==S||e[33]!==F||e[34]!==P||e[35]!==u||e[36]!==A||e[37]!==v||e[38]!==m||e[39]!==n||e[40]!==s||e[41]!==d||e[42]!==o?(R=()=>(0,a.jsxs)(Le,{align:"end",className:"print:hidden w-[220px]",onClick:kn,onCloseAutoFocus:Fn,children:[!n.data.isDirectory&&(0,a.jsxs)($,{onSelect:()=>n.select(),children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),!n.data.isDirectory&&!xe()&&(0,a.jsxs)($,{onSelect:()=>{s({path:n.data.path})},children:[(0,a.jsx)(ke,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)($,{onSelect:()=>P(),children:[(0,a.jsx)(pt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)($,{onSelect:()=>S(),children:[(0,a.jsx)(ft,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)($,{onSelect:()=>F(),children:[(0,a.jsx)(xt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ce,{})]}),(0,a.jsxs)($,{onSelect:()=>n.edit(),children:[(0,a.jsx)(Ea,{className:ee}),"Rename"]}),(0,a.jsxs)($,{onSelect:A,children:[(0,a.jsx)(Ce,{className:ee}),"Duplicate"]}),(0,a.jsxs)($,{onSelect:async()=>{await me(n.data.path),I({title:"Copied to clipboard"})},children:[(0,a.jsx)(ut,{className:ee}),"Copy path"]}),o&&(0,a.jsxs)($,{onSelect:async()=>{await me(o.relativeFromRoot(n.data.path)),I({title:"Copied to clipboard"})},children:[(0,a.jsx)(ut,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),(0,a.jsx)(ce,{}),(0,a.jsxs)($,{onSelect:()=>{let{path:C}=n.data;v(Ct[l](C))},children:[(0,a.jsx)(Xt,{className:ee}),"Insert snippet for reading file"]}),(0,a.jsxs)($,{onSelect:async()=>{I({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:C}=n.data;await me(Ct[l](C))},children:[(0,a.jsx)(Et,{className:ee}),"Copy snippet for reading file"]}),n.data.isMarimoFile&&!xe()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ce,{}),(0,a.jsxs)($,{onSelect:m,children:[(0,a.jsx)(Ia,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),(0,a.jsx)(ce,{}),!n.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)($,{onSelect:async()=>{let C=await d({path:n.data.path});C.isBase64&&C.contents?ge(st(Fe(C.contents,C.mimeType||"application/octet-stream")),n.data.name):ge(new Blob([C.contents||""]),n.data.name)},children:[(0,a.jsx)(be,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ce,{})]}),(0,a.jsxs)($,{onSelect:u,variant:"danger",children:[(0,a.jsx)(ca,{className:ee}),"Delete"]})]}),e[30]=c,e[31]=l,e[32]=S,e[33]=F,e[34]=P,e[35]=u,e[36]=A,e[37]=v,e[38]=m,e[39]=n,e[40]=s,e[41]=d,e[42]=o,e[43]=R):R=e[43];let ne=R,Y;e[44]===Symbol.for("react.memo_cache_sentinel")?(Y=re("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[44]=Y):Y=e[44];let K,B;e[45]===n?(K=e[46],B=e[47]):(K=C=>{C.stopPropagation(),n.data.isDirectory&&n.toggle()},B=(0,a.jsx)(jn,{node:n}),e[45]=n,e[46]=K,e[47]=B);let se=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",V;e[48]===se?V=e[49]:(V=re("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",se),e[48]=se,e[49]=V);let H;e[50]!==f||e[51]!==l||e[52]!==n.data.isMarimoFile?(H=n.data.isMarimoFile?(0,a.jsx)(Oa,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(f,{className:re("w-5 h-5 shrink-0 mr-2",Ye[l]),strokeWidth:1.5}),e[50]=f,e[51]=l,e[52]=n.data.isMarimoFile,e[53]=H):H=e[53];let L;e[54]!==m||e[55]!==n?(L=n.isEditing?(0,a.jsx)(gn,{node:n}):(0,a.jsx)(un,{node:n,onOpenMarimoFile:m}),e[54]=m,e[55]=n,e[56]=L):L=e[56];let Z;e[57]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,a.jsx)(He,{asChild:!0,tabIndex:-1,onClick:Cn,children:(0,a.jsx)(ot,{"data-testid":"file-explorer-more-button",iconClassName:"w-5 h-5"})}),e[57]=Z):Z=e[57];let q;e[58]===ne?q=e[59]:(q=(0,a.jsxs)(qe,{modal:!1,children:[Z,ne()]}),e[58]=ne,e[59]=q);let U;e[60]!==V||e[61]!==H||e[62]!==L||e[63]!==q?(U=(0,a.jsxs)("span",{className:V,children:[H,L,q]}),e[60]=V,e[61]=H,e[62]=L,e[63]=q,e[64]=U):U=e[64];let G;return e[65]!==r||e[66]!==i||e[67]!==K||e[68]!==B||e[69]!==U?(G=(0,a.jsxs)("div",{style:i,ref:r,className:Y,draggable:!0,onClick:K,children:[B,U]}),e[65]=r,e[66]=i,e[67]=K,e[68]=B,e[69]=U,e[70]=G):G=e[70],G},jn=t=>{let e=(0,de.c)(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=r):r=e[0],r}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Me,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Pt(t,e){t.stopPropagation(),t.preventDefault(),$a(e)}function Dt(t,e){if(e)return t;let n=[];for(let i of t){if(bn(i.name))continue;let r=i;if(i.children){let s=Dt(i.children,e);s!==i.children&&(r={...i,children:s})}n.push(r)}return n}function bn(t){return!!t.startsWith(".")}function vn(){return null}function wn(t){let{parentNode:e}=t;return!e.data.isDirectory}function Nn(t){return t.stopPropagation()}function kn(t){return t.stopPropagation()}function Fn(t){return t.preventDefault()}function Cn(t){return t.stopPropagation()}var Mt=oe(),_n=Be("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},Ie),Sn=t=>{let e=(0,Mt.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:r,getInputProps:s,isDragActive:d}=_t(i),c;e[1]===r?c=e[2]:(c=r(),e[1]=r,e[2]=c);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=re("flex flex-col overflow-hidden relative"),e[3]=h):h=e[3];let l;e[4]===n?l=e[5]:(l={height:n},e[4]=n,e[5]=l);let f;e[6]===s?f=e[7]:(f=s(),e[6]=s,e[7]=f);let x;e[8]===f?x=e[9]:(x=(0,a.jsx)("input",{...f}),e[8]=f,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 g;e[12]===n?g=e[13]:(g=(0,a.jsx)(pn,{height:n}),e[12]=n,e[13]=g);let j;return e[14]!==c||e[15]!==l||e[16]!==x||e[17]!==p||e[18]!==g?(j=(0,a.jsx)(Qa,{children:(0,a.jsxs)("div",{...c,className:h,style:l,children:[x,p,g]})}),e[14]=c,e[15]=l,e[16]=x,e[17]=p,e[18]=g,e[19]=j):j=e[19],j},Pn=33,Dn=()=>{let t=(0,Mt.c)(36),{ref:e,height:n}=Sa(),i=n===void 0?500:n,[r,s]=fe(_n),d=he(Qt).length,c;e:{if(!r.hasUserInteracted&&d>0){if(r.openSections.includes("remote-storage")){c=r.openSections;break e}let R;t[0]===r.openSections?R=t[1]:(R=[...r.openSections,"remote-storage"],t[0]=r.openSections,t[1]=R),c=R;break e}c=r.openSections}let h=c,l;t[2]===s?l=t[3]:(l=R=>{s({openSections:R,hasUserInteracted:!0})},t[2]=s,t[3]=l);let f=l,x=i-Pn*2,p;t[4]===h?p=t[5]:(p=h.includes("remote-storage"),t[4]=h,t[5]=p);let g=p,j;t[6]!==h||t[7]!==g?(j=g&&h.includes("files"),t[6]=h,t[7]=g,t[8]=j):j=t[8];let w=j,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 o=v,y=Math.max(200,w?x-o:x),m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Qe,{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)(za,{children:d}),t[13]=d,t[14]=b);let u;t[15]===b?u=t[16]:(u=(0,a.jsxs)(ht,{children:[m," Remote storage",b]}),t[15]=b,t[16]=u);let N;t[17]===o?N=t[18]:(N={maxHeight:o},t[17]=o,t[18]=N);let F;t[19]===Symbol.for("react.memo_cache_sentinel")?(F=(0,a.jsx)(Ja,{}),t[19]=F):F=t[19];let _;t[20]===N?_=t[21]:(_=(0,a.jsx)(mt,{className:"overflow-auto",style:N,children:F}),t[20]=N,t[21]=_);let S;t[22]!==_||t[23]!==u?(S=(0,a.jsxs)(dt,{value:"remote-storage",children:[u,_]}),t[22]=_,t[23]=u,t[24]=S):S=t[24];let M;t[25]===Symbol.for("react.memo_cache_sentinel")?(M=(0,a.jsxs)(ht,{children:[(0,a.jsx)(Ze,{className:"w-4 h-4"}),"Files"]}),t[25]=M):M=t[25];let P;t[26]===y?P=t[27]:(P=(0,a.jsxs)(dt,{value:"files",children:[M,(0,a.jsx)(mt,{children:(0,a.jsx)(Sn,{height:y})})]}),t[26]=y,t[27]=P);let D;t[28]!==f||t[29]!==h||t[30]!==S||t[31]!==P?(D=(0,a.jsxs)(qt,{type:"multiple",value:h,onValueChange:f,children:[S,P]}),t[28]=f,t[29]=h,t[30]=S,t[31]=P,t[32]=D):D=t[32];let A;return t[33]!==e||t[34]!==D?(A=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:D}),t[33]=e,t[34]=D,t[35]=A):A=t[35],A};export{Dn as default};
|