@marimo-team/frontend 0.20.3-dev82 → 0.20.3-dev87

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-Cj6B1HI3.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-Mpiu_IjZ.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-y72bE5iF.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/clsx-A78R3nYl.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/cn-d_A4rA-x.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.20.3-dev82",
3
+ "version": "0.20.3-dev87",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -240,6 +240,11 @@ const StorageEntryRow: React.FC<{
240
240
  const name = displayName(entry.path);
241
241
  const hasSearch = !!searchValue.trim();
242
242
 
243
+ const selfMatches =
244
+ isDir &&
245
+ hasSearch &&
246
+ name.toLowerCase().includes(searchValue.trim().toLowerCase());
247
+
243
248
  // During a search, auto-expand directories whose loaded descendants match
244
249
  const hasMatchingDescendants =
245
250
  isDir &&
@@ -380,7 +385,7 @@ const StorageEntryRow: React.FC<{
380
385
  prefix={entry.path}
381
386
  depth={depth + 1}
382
387
  locale={locale}
383
- searchValue={searchValue}
388
+ searchValue={selfMatches ? "" : searchValue} // When a parent directory matches the search, we don't need to filter the children.
384
389
  onOpenFile={onOpenFile}
385
390
  />
386
391
  )}
@@ -1 +0,0 @@
1
- var kt=Object.defineProperty;var Nt=(t,e,s)=>e in t?kt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var G=(t,e,s)=>Nt(t,typeof e!="symbol"?e+"":e,s);import{s as Ae}from"./chunk-LvLJmgfZ.js";import{i as Ft,l as me,n as W,p as Ee,u as ne}from"./useEvent-WUlsM6MC.js";import{t as Ct}from"./react-Bj1aDYRI.js";import{En as St,T as Mt,kn as Le,li as Ie,oi as _t,rr as Pt,ur as zt}from"./cells-DVXjWBHI.js";import"./react-dom-CSu739Rf.js";import{t as Q}from"./compiler-runtime-B3qBwwSJ.js";import"./tooltip-BrjpohcK.js";import{h as Dt,m as ge}from"./useEventListener-CjXriKgk.js";import{t as Ot}from"./invariant-awXiPaF0.js";import{p as Rt,u as Ve}from"./utils-CORJ8yYa.js";import{S as pe}from"./config-vle9v48l.js";import{t as At}from"./jsx-runtime-CP2fAiZX.js";import{n as Et,t as R}from"./button-BmOH9agK.js";import{t as Y}from"./cn-d_A4rA-x.js";import{St as Lt}from"./dist-DUY6xZX8.js";import{a as It,i as Be,o as xe}from"./JsonOutput-DgTX3wDl.js";import"./cjs-CVt8hZ5L.js";import"./main-Cmx6WhDY.js";import"./useNonce-BY4jV7Yb.js";import{n as Vt,r as je}from"./requests-DZy_SQ_v.js";import{t as K}from"./createLucideIcon-BvP5LBIs.js";import{a as Te,i as He,l as Ze,n as fe,o as Bt,r as Tt,s as ye,t as Ht}from"./state-O2Ife70c.js";import{n as Zt}from"./LazyAnyLanguageCodeMirror-BuxbbXY6.js";import{r as qt,t as Ut}from"./x-yqLqiq5Q.js";import{c as Wt,i as ve,r as qe}from"./download-CNypwy8-.js";import{t as we}from"./chevron-right-_z3dkNFy.js";import{f as be}from"./maps-8VTEe-0T.js";import{n as $t}from"./markdown-renderer-BF7gphWI.js";import{u as Gt}from"./toDate-DDAiY7kz.js";import{a as A,c as le,p as Ue,r as We,t as $e}from"./dropdown-menu-CYyWUG65.js";import{t as ke}from"./copy-CAR4dOiD.js";import{t as Kt}from"./database-zap-B3efE3T2.js";import{t as Ne}from"./download-BG-iMGgV.js";import{t as Ge}from"./ellipsis-vertical-CqcBoxmi.js";import{t as Yt}from"./eye-off-DgTL09j7.js";import{a as Jt,i as Qt,n as Ke,r as Xt,t as ea}from"./types-DmqhedDv.js";import{t as Ye}from"./file-plus-corner-BRwJx0yp.js";import{t as Fe}from"./file-DVwc11C3.js";import{t as ta}from"./globe-B68kre4p.js";import{t as aa}from"./image-DJi6ovcV.js";import{n as Ce,t as sa}from"./spinner-Cg6xI4rq.js";import{t as ra}from"./refresh-ccw-fkpyyW4C.js";import{t as Se}from"./refresh-cw-6vegZcuZ.js";import{t as na}from"./save-BShTD2ty.js";import{t as la}from"./trash-2-B00-wGoJ.js";import{n as ia,r as oa,t as ca}from"./azure-B1scLE4v.js";import{i as da,n as ha,t as ma}from"./es-BLdjaIr6.js";import"./dist-DRM_TtJV.js";import"./dist-CLn8560E.js";import"./dist-4go66rGa.js";import"./dist-C_w6Go0g.js";import"./dist-D3d3ioNg.js";import{t as V}from"./use-toast-BtZldTi5.js";import{t as Me}from"./paths-BVwhPRFT.js";import"./session-BQVN1Kxg.js";import{r as pa}from"./useTheme-0tqyqYah.js";import"./Combination-BM4eSgxb.js";import{t as L}from"./tooltip-D7xdZcKW.js";import"./purify.es-DFAhPV1y.js";import"./dates-BL9QfUQ0.js";import{o as xa}from"./alert-dialog-DNI_v2jv.js";import{t as Je}from"./context-DAH8i0ik.js";import"./popover-2GpKY98n.js";import{n as Qe}from"./ImperativeModal-Upm6NvJ2.js";import{r as fa}from"./errors-iwK4b4VF.js";import{n as ua}from"./blob-C3EfaMOb.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{t as ie}from"./copy-hG3KkB-h.js";import{t as ga}from"./copy-icon-Cg5270DP.js";import{n as ja}from"./multi-map-CDn9gple.js";import{a as ya,i as va,n as _e,r as wa,t as ba}from"./tree-Rwd8OPB8.js";import{n as ka,t as Na}from"./alert-DdNm63Am.js";import{n as Xe}from"./error-banner-AdDcypw3.js";import{n as Pe}from"./useAsyncData-D89z7Kpl.js";import{a as Fa,o as et,t as Ca,u as Sa}from"./command-COYC8fga.js";import"./chunk-5FQGJX7Z-C3tg8qpb.js";import"./katex-0Z75JF53.js";import"./html-to-image-Din4blht.js";import{o as Ma}from"./focus-C2gi0jxY.js";import{a as _a}from"./renderShortcut-CMdaUbHS.js";import{t as Pa}from"./bundle.esm-cfPbrCwe.js";import{a as za}from"./components-W1WrEQth.js";import{t as Da}from"./empty-state-DFr2pZOz.js";import{t as ze}from"./formatting-CkUjNdR1.js";import{a as Oa,i as Ra,n as tt,r as at,t as st}from"./components-kyddrdJc.js";import{n as rt,t as Aa}from"./marimo-icons-B0iaQddz.js";import{t as Ea}from"./links-DJ5XP9fV.js";var La=K("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"}]]),Ia=K("file-play",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]]),Va=K("file-spreadsheet",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),nt=K("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"}]]),ue=K("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),lt=K("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"}]]),Ba=K("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),Ta=K("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"}]]),it=K("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"}]]),Ha=Q(),D=Ae(Ct(),1),Za="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20id='Layer_1'%20x='0'%20y='0'%20version='1.1'%20viewBox='0.02%20102.6%20511.9%20306.4'%3e%3cstyle%3e.st1{fill-rule:evenodd;clip-rule:evenodd;fill:%23f90}%3c/style%3e%3cpath%20d='M144.3%20214.1c0%206.3.7%2011.4%201.9%2015.2%201.4%203.7%203.1%207.8%205.4%2012.3.9%201.4%201.2%202.7%201.2%203.9%200%201.7-1%203.4-3.2%205.1l-10.7%207.2c-1.5%201-3.1%201.5-4.4%201.5-1.7%200-3.4-.9-5.1-2.4-2.4-2.6-4.4-5.3-6.1-8-1.7-2.9-3.4-6.1-5.3-10-13.3%2015.7-30%2023.5-50.1%2023.5-14.3%200-25.7-4.1-34.1-12.3-8.3-8.2-12.6-19.1-12.6-32.7%200-14.5%205.1-26.2%2015.5-35.1S60.8%20169%2078.4%20169c5.8%200%2011.7.5%2018.1%201.4s12.8%202.2%2019.6%203.7v-12.4c0-12.9-2.7-22-8-27.2-5.4-5.3-14.6-7.8-27.8-7.8-6%200-12.1.7-18.4%202.2s-12.4%203.4-18.4%205.8c-2.7%201.2-4.8%201.9-6%202.2s-2%20.5-2.7.5c-2.4%200-3.6-1.7-3.6-5.3v-8.3c0-2.7.3-4.8%201.2-6s2.4-2.4%204.8-3.6c6-3.1%2013.1-5.6%2021.5-7.7%208.3-2.2%2017.2-3.2%2026.6-3.2%2020.3%200%2035.1%204.6%2044.6%2013.8%209.4%209.2%2014.1%2023.2%2014.1%2041.9v55.2h.3zM75.2%20240c5.6%200%2011.4-1%2017.5-3.1%206.1-2%2011.6-5.8%2016.2-10.9%202.7-3.2%204.8-6.8%205.8-10.9s1.7-9%201.7-14.8v-7.2c-4.9-1.2-10.2-2.2-15.7-2.9-5.4-.7-10.7-1-16-1-11.4%200-19.8%202.2-25.4%206.8S51%20207.1%2051%20215.6c0%208%202%2014%206.3%2018.1%204.1%204.2%2010%206.3%2017.9%206.3m136.7%2018.4c-3.1%200-5.1-.5-6.5-1.7-1.4-1-2.6-3.4-3.6-6.6l-40-131.6c-1-3.4-1.5-5.6-1.5-6.8%200-2.7%201.4-4.3%204.1-4.3h16.7c3.2%200%205.4.5%206.6%201.7%201.4%201%202.4%203.4%203.4%206.6l28.6%20112.7%2026.6-112.7c.9-3.4%201.9-5.6%203.2-6.6%201.4-1%203.7-1.7%206.8-1.7H270c3.2%200%205.4.5%206.8%201.7%201.4%201%202.6%203.4%203.2%206.6l26.9%20114.1%2029.5-114.1c1-3.4%202.2-5.6%203.4-6.6%201.4-1%203.6-1.7%206.6-1.7h15.8c2.7%200%204.3%201.4%204.3%204.3%200%20.9-.2%201.7-.3%202.7-.2%201-.5%202.4-1.2%204.3l-41%20131.6q-1.5%205.1-3.6%206.6c-1.4%201-3.6%201.7-6.5%201.7h-14.6c-3.2%200-5.4-.5-6.8-1.7s-2.6-3.4-3.2-6.8l-26.4-109.8L236.7%20250c-.9%203.4-1.9%205.6-3.2%206.8-1.4%201.2-3.7%201.7-6.8%201.7h-14.8zm218.8%204.6c-8.9%200-17.7-1-26.2-3.1-8.5-2-15.2-4.3-19.6-6.8-2.7-1.5-4.6-3.2-5.3-4.8s-1-3.2-1-4.8v-8.7c0-3.6%201.4-5.3%203.9-5.3%201%200%202%20.2%203.1.5%201%20.3%202.6%201%204.3%201.7%205.8%202.6%2012.1%204.6%2018.7%206%206.8%201.4%2013.5%202%2020.3%202%2010.7%200%2019.1-1.9%2024.9-5.6s8.9-9.2%208.9-16.2c0-4.8-1.5-8.7-4.6-11.9s-8.9-6.1-17.2-8.9l-24.7-7.7c-12.4-3.9-21.6-9.7-27.2-17.4-5.6-7.5-8.5-15.8-8.5-24.7%200-7.2%201.5-13.5%204.6-18.9s7.2-10.2%2012.3-14c5.1-3.9%2010.9-6.8%2017.7-8.9%206.8-2%2014-2.9%2021.5-2.9%203.7%200%207.7.2%2011.4.7%203.9.5%207.5%201.2%2011.1%201.9%203.4.9%206.6%201.7%209.7%202.7s5.4%202%207.2%203.1c2.4%201.4%204.1%202.7%205.1%204.3%201%201.4%201.5%203.2%201.5%205.6v8c0%203.6-1.4%205.4-3.9%205.4-1.4%200-3.6-.7-6.5-2q-14.55-6.6-32.7-6.6c-9.7%200-17.4%201.5-22.6%204.8s-8%208.2-8%2015.2c0%204.8%201.7%208.9%205.1%2012.1s9.7%206.5%2018.7%209.4l24.2%207.7c12.3%203.9%2021.1%209.4%2026.4%2016.3s7.8%2015%207.8%2023.8c0%207.3-1.5%2014-4.4%2019.8-3.1%205.8-7.2%2010.9-12.4%2015-5.3%204.3-11.6%207.3-18.9%209.5-8%202.5-16%203.7-24.7%203.7'%20style='fill:%23fff'/%3e%3cpath%20fill='%23fff'%20d='M462.9%20345.7c-56%2041.4-137.4%2063.3-207.4%2063.3-98.1%200-186.5-36.3-253.2-96.6-5.3-4.8-.5-11.2%205.8-7.5%2072.2%2041.9%20161.3%2067.3%20253.4%2067.3%2062.2%200%20130.4-12.9%20193.3-39.5%209.3-4.2%2017.3%206.2%208.1%2013'%20class='st1'/%3e%3cpath%20fill='%23fff'%20d='M486.2%20319.2c-7.2-9.2-47.3-4.4-65.6-2.2-5.4.7-6.3-4.1-1.4-7.7%2032-22.5%2084.6-16%2090.8-8.5%206.1%207.7-1.7%2060.3-31.7%2085.5-4.6%203.9-9%201.9-7-3.2%206.9-16.9%2022.1-54.9%2014.9-63.9'%20class='st1'/%3e%3c/svg%3e",qa="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20128%20128'%3e%3cpath%20fill='%23FFF'%20d='m115.679%2069.288-15.591-8.94-2.689-1.163-63.781.436v32.381h82.061z'/%3e%3cpath%20fill='%23F38020'%20d='M87.295%2089.022c.763-2.617.472-5.015-.8-6.796-1.163-1.635-3.125-2.58-5.488-2.689l-44.737-.581c-.291%200-.545-.145-.691-.363s-.182-.509-.109-.8c.145-.436.581-.763%201.054-.8l45.137-.581c5.342-.254%2011.157-4.579%2013.192-9.885l2.58-6.723c.109-.291.145-.581.073-.872-2.906-13.158-14.644-22.97-28.672-22.97-12.938%200-23.913%208.359-27.838%2019.952a13.35%2013.35%200%200%200-9.267-2.58c-6.215.618-11.193%205.597-11.811%2011.811-.145%201.599-.036%203.162.327%204.615C10.104%2070.051%202%2078.337%202%2088.549c0%20.909.073%201.817.182%202.726a.895.895%200%200%200%20.872.763h82.57c.472%200%20.909-.327%201.054-.8l.617-2.216z'/%3e%3cpath%20fill='%23FAAE40'%20d='M101.542%2060.275c-.4%200-.836%200-1.236.036-.291%200-.545.218-.654.509l-1.744%206.069c-.763%202.617-.472%205.015.8%206.796%201.163%201.635%203.125%202.58%205.488%202.689l9.522.581c.291%200%20.545.145.691.363.145.218.182.545.109.8-.145.436-.581.763-1.054.8l-9.924.582c-5.379.254-11.157%204.579-13.192%209.885l-.727%201.853c-.145.363.109.727.509.727h34.089c.4%200%20.763-.254.872-.654.581-2.108.909-4.325.909-6.614%200-13.447-10.975-24.422-24.458-24.422'/%3e%3c/svg%3e",Ua="data:image/svg+xml,%3csvg%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns='http://www.w3.org/2000/svg'%20id='Layer_1'%20data-name='Layer%201'%20viewBox='0%200%20224.09%20161.1'%20width='224.09'%20height='161.1'%20%3e%3cdefs%3e%3cstyle%3e%20.cls-1,%20.cls-2%20{%20fill:%20%23000;%20stroke-width:%200px;%20}%20.cls-2%20{%20fill-rule:%20evenodd;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M92.1,112.3h-27.07c-1.65,0-3.3-.99-4.29-2.64l-12.55-22.47c-.66-1.65-.66-3.3,0-4.62l12.55-22.47c.99-1.65,2.64-2.64,4.29-2.64h15.52c1.65,0,3.3-.99,4.29-2.64l11.23-20.16c.99-1.65-.33-3.63-1.98-3.63h-41.6c-3.63,0-6.6,1.98-8.58,4.96l-24.76,44.28c-1.65,2.97-1.65,6.61,0,9.58l24.76,43.94c1.65,2.97,4.95,4.96,8.58,4.96h53.15c1.98,0,2.97-1.98,1.98-3.64l-11.55-20.49c-.33-1.65-1.98-2.31-3.96-2.31Z'/%3e%3cpath%20class='cls-1'%20d='M165.4,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.55,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61,0-9.58Z'/%3e%3cpath%20class='cls-2'%20d='M111.58,86.86l13.21-23.46c.66-1.32.66-3.3,0-4.96l-15.19-26.1c-.99-1.65-3.3-1.65-4.29,0l-12.88,22.8c-.66,1.32-.66,3.3,0,4.63l14.86,26.76c.99,1.98,3.63,1.98,4.29.33Z'/%3e%3cpath%20class='cls-1'%20d='M204.35,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.89,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61-.33-9.58Z'/%3e%3c/svg%3e",Wa="data:image/svg+xml,%3csvg%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns='http://www.w3.org/2000/svg'%20id='Layer_1'%20data-name='Layer%201'%20viewBox='0%200%20224.09%20161.1'%20width='224.09'%20height='161.1'%3e%3cdefs%3e%3cstyle%3e%20.cls-1,%20.cls-2%20{%20fill:%20%23fff;%20stroke-width:%200px;%20}%20.cls-2%20{%20fill-rule:%20evenodd;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M92.1,112.3h-27.07c-1.65,0-3.3-.99-4.29-2.64l-12.55-22.47c-.66-1.65-.66-3.3,0-4.62l12.55-22.47c.99-1.65,2.64-2.64,4.29-2.64h15.52c1.65,0,3.3-.99,4.29-2.64l11.23-20.16c.99-1.65-.33-3.63-1.98-3.63h-41.6c-3.63,0-6.6,1.98-8.58,4.96l-24.76,44.28c-1.65,2.97-1.65,6.61,0,9.58l24.76,43.94c1.65,2.97,4.95,4.96,8.58,4.96h53.15c1.98,0,2.97-1.98,1.98-3.64l-11.55-20.49c-.33-1.65-1.98-2.31-3.96-2.31Z'%3e%3c/path%3e%3cpath%20class='cls-1'%20d='M165.4,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.55,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61,0-9.58Z'%3e%3c/path%3e%3cpath%20class='cls-2'%20d='M111.58,86.86l13.21-23.46c.66-1.32.66-3.3,0-4.96l-15.19-26.1c-.99-1.65-3.3-1.65-4.29,0l-12.88,22.8c-.66,1.32-.66,3.3,0,4.63l14.86,26.76c.99,1.98,3.63,1.98,4.29.33Z'%3e%3c/path%3e%3cpath%20class='cls-1'%20d='M204.35,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.89,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61-.33-9.58Z'%3e%3c/path%3e%3c/svg%3e",$a="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='standard_product_icon'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20512%20512'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.1.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20142)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20none;%20}%20.st1%20{%20fill:%20%234285f4;%20}%20.st2%20{%20fill:%20%2334a853;%20}%20.st3%20{%20fill:%20%23fbbc04;%20}%20.st4%20{%20fill:%20%23ea4335;%20}%20%3c/style%3e%3c/defs%3e%3cg%20id='bounding_box'%3e%3crect%20class='st0'%20width='512'%20height='512'/%3e%3c/g%3e%3cg%20id='art'%3e%3cpath%20class='st2'%20d='M442,277.9H70c-8.8,0-16,7.2-16,16v148.1c0,8.8,7.2,16,16,16h107.2c1.5.5,3.1.7,4.8.7s3.3-.3,4.8-.7h255.2c8.8,0,16-7.2,16-16v-148.1c0-8.8-7.2-16-16-16ZM86,309.9h80v116.1h-80v-116.1ZM426,425.9h-228v-116.1h228v116.1Z'/%3e%3cpath%20class='st3'%20d='M442,54H70c-8.8,0-16,7.2-16,16v148.8c0,8.8,7.2,16,16,16h372c8.8,0,16-7.2,16-16V70c0-8.8-7.2-16-16-16ZM86,86h80v116.8h-80v-116.8ZM426,202.8h-228v-116.8h228v116.8Z'/%3e%3cpath%20class='st4'%20d='M442,234.8h-16V86H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.8c0,8.8-7.2,16-16,16Z'/%3e%3cpath%20class='st1'%20d='M442,457.9h-16v-148.1H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.1c0,8.8-7.2,16-16,16Z'/%3e%3ccircle%20class='st4'%20cx='349'%20cy='144.4'%20r='37'/%3e%3ccircle%20class='st1'%20cx='349'%20cy='367.9'%20r='37'/%3e%3c/g%3e%3c/svg%3e",a=Ae(At(),1);function ot(t){var e;switch((e=t.split(".").pop())==null?void 0:e.toLowerCase()){case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return(0,a.jsx)(aa,{className:"h-3.5 w-3.5 text-purple-500"});case"csv":case"parquet":case"arrow":case"xlsx":return(0,a.jsx)(Va,{className:"h-3.5 w-3.5 text-green-500"});case"py":case"js":case"ts":case"json":return(0,a.jsx)(Jt,{className:"h-3.5 w-3.5 text-blue-500"});case"mp4":case"mpeg":return(0,a.jsx)(Ia,{className:"h-3.5 w-3.5 text-orange-500"});case"txt":case"md":case"log":return(0,a.jsx)(Pt,{className:"h-3.5 w-3.5 text-muted-foreground"});default:return(0,a.jsx)(Fe,{className:"h-3.5 w-3.5 text-muted-foreground"})}}var Ga={s3:{src:ia,dark:Za},coreweave:{src:Ua,dark:Wa},cloudflare:{src:qa},azure:{src:ca},gcs:{src:$a},http:ta,file:ue,"in-memory":Kt};const Ka=t=>{let e=(0,Ha.c)(5),{protocol:s}=t,{theme:l}=pa(),n=Ga[s.toLowerCase()]??ue;if("src"in n){let c=l==="dark"&&n.dark?n.dark:n.src,h;return e[0]!==s||e[1]!==c?(h=(0,a.jsx)("img",{src:c,alt:s,className:"h-3.5 w-3.5"}),e[0]=s,e[1]=c,e[2]=h):h=e[2],h}let r=n,i;return e[3]===r?i=e[4]:(i=(0,a.jsx)(r,{className:"h-3.5 w-3.5"}),e[3]=r,e[4]=i),i};var Ya=Q();const ct=t=>{let e=(0,Ya.c)(17),{filename:s,filenameIcon:l,onBack:n,onRefresh:r,onDownload:i,actions:c}=t,h;e[0]===n?h=e[1]:(h=n&&(0,a.jsx)(L,{content:"Back to file list",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:n,children:(0,a.jsx)(Ze,{className:"h-4 w-4"})})}),e[0]=n,e[1]=h);let o;e[2]!==s||e[3]!==l?(o=s?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[l,s]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=s,e[3]=l,e[4]=o):o=e[4];let g;e[5]===r?g=e[6]:(g=r&&(0,a.jsx)(L,{content:"Refresh",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(Se,{className:"h-3.5 w-3.5"})})}),e[5]=r,e[6]=g);let p;e[7]===i?p=e[8]:(p=i&&(0,a.jsx)(L,{content:"Download",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:i,children:(0,a.jsx)(Ne,{className:"h-3.5 w-3.5"})})}),e[7]=i,e[8]=p);let u;e[9]!==c||e[10]!==g||e[11]!==p?(u=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[g,c,p]}),e[9]=c,e[10]=g,e[11]=p,e[12]=u):u=e[12];let j;return e[13]!==h||e[14]!==o||e[15]!==u?(j=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[h,o,u]}),e[13]=h,e[14]=o,e[15]=u,e[16]=j):j=e[16],j};var Ja=100*1024*1024;function Qa(t){let e=t.endsWith("/")?t.slice(0,-1):t,s=e.split("/");return s[s.length-1]||e}const Xa=({entry:t,namespace:e,onBack:s})=>{let{locale:l}=Je(),n=Qa(t.path),r=t.mimeType||"text/plain",i=xe(r),c=i&&t.size>Ja&&t.size>0,{data:h,isPending:o,error:g,refetch:p}=Pe(async()=>{if(c)return null;let f=await ye.request({namespace:e,path:t.path,preview:!i});if(f.error)throw Error(f.error);if(!f.url)throw Error("No URL returned");if(i)return{type:"media",url:f.url};let m=await fetch(f.url);if(!m.ok)throw Error(`Failed to fetch preview: ${m.statusText}`);return{type:"text",content:await m.text()}},[e,t.path,i,c]),u=(0,D.useCallback)(async()=>{try{let f=await ye.request({namespace:e,path:t.path});if(f.error){V({title:"Download failed",description:f.error,variant:"danger"});return}f.url&&ve(f.url,f.filename??n)}catch(f){ge.error("Failed to download storage entry",f),V({title:"Download failed",description:String(f),variant:"danger"})}},[e,t.path,n]),j=(0,a.jsx)(ct,{filename:n,filenameIcon:ot(n),onBack:s,onDownload:u}),d=({includeMime:f=!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)(ga,{value:t.path,className:"h-3 w-3"})]}),f&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),f&&(0,a.jsx)("span",{children:r}),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:ze(t.size,l)})]}),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 c?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[j,d({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",ze(t.size,l),")."]})]}):o?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[j,d({}),(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)(Ce,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):g?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[j,d({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",g.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(R,{variant:"secondary",size:"xs",onClick:p,children:[(0,a.jsx)(Se,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):h?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[j,d({}),(0,a.jsx)(Be,{mimeType:r,contents:h.type==="text"?h.content:void 0,mediaSource:h.type==="media"?{url:h.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[j,d({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(Fe,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var De=Q(),es=16;function J(t){return{paddingLeft:t*es}}function ts(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function dt(t){let e=t.endsWith("/")?t.slice(0,-1):t,s=e.split("/");return s[s.length-1]||e}function Oe(t,e,s,l){let n=s.toLowerCase();if(dt(t.path).toLowerCase().includes(n))return!0;if(t.kind==="directory"){let r=l.get(Te(e,t.path));if(r)return r.some(i=>Oe(i,e,s,l))}return!1}function ht(t,e,s,l){return s.trim()?t.filter(n=>Oe(n,e,s,l)):t}var as=t=>{let e=(0,De.c)(34),{namespace:s,protocol:l,rootPath:n,prefix:r,depth:i,locale:c,searchValue:h,onOpenFile:o}=t,{entriesByPath:g}=fe(),{entries:p,isPending:u,error:j}=He(s,r);if(u){let m;e[0]===i?m=e[1]:(m=J(i),e[0]=i,e[1]=m);let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsx)(Ce,{className:"h-3 w-3 animate-spin"}),e[2]=y):y=e[2];let v;return e[3]===m?v=e[4]:(v=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:m,children:[y,"Loading..."]}),e[3]=m,e[4]=v),v}if(j){let m;e[5]===i?m=e[6]:(m=J(i),e[5]=i,e[6]=m);let y;return e[7]!==j.message||e[8]!==m?(y=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:m,children:["Failed to load: ",j.message]}),e[7]=j.message,e[8]=m,e[9]=y):y=e[9],y}if(p.length===0){let m;e[10]===i?m=e[11]:(m=J(i),e[10]=i,e[11]=m);let y;return e[12]===m?y=e[13]:(y=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:m,children:"Empty"}),e[12]=m,e[13]=y),y}let d;if(e[14]!==p||e[15]!==i||e[16]!==g||e[17]!==c||e[18]!==s||e[19]!==o||e[20]!==l||e[21]!==n||e[22]!==h){let m=ht(p,s,h,g),y;e[24]!==i||e[25]!==c||e[26]!==s||e[27]!==o||e[28]!==l||e[29]!==n||e[30]!==h?(y=v=>(0,a.jsx)(mt,{entry:v,namespace:s,protocol:l,rootPath:n,depth:i,locale:c,searchValue:h,onOpenFile:o},v.path),e[24]=i,e[25]=c,e[26]=s,e[27]=o,e[28]=l,e[29]=n,e[30]=h,e[31]=y):y=e[31],d=m.map(y),e[14]=p,e[15]=i,e[16]=g,e[17]=c,e[18]=s,e[19]=o,e[20]=l,e[21]=n,e[22]=h,e[23]=d}else d=e[23];let f;return e[32]===d?f=e[33]:(f=(0,a.jsx)(a.Fragment,{children:d}),e[32]=d,e[33]=f),f},mt=({entry:t,namespace:e,protocol:s,rootPath:l,depth:n,locale:r,searchValue:i,onOpenFile:c})=>{var y;let[h,o]=(0,D.useState)(!1),{entriesByPath:g}=fe(),p=t.kind==="directory",u=dt(t.path),j=!!i.trim(),d=p&&j&&!!((y=g.get(Te(e,t.path)))!=null&&y.some(v=>Oe(v,e,i,g))),f=h||d,m=(0,D.useCallback)(async()=>{try{let v=await ye.request({namespace:e,path:t.path});if(v.error){V({title:"Download failed",description:v.error,variant:"danger"});return}v.url&&ve(v.url,v.filename??"download")}catch(v){ge.error("Failed to download storage entry",v),V({title:"Download failed",description:String(v),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(et,{className:Y("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",p&&"font-medium"),style:J(n),value:`${e}:${t.path}`,onSelect:()=>{p?o(!f):c({entry:t,namespace:e})},children:[p?(0,a.jsx)(we,{className:Y("h-3 w-3 shrink-0 transition-transform",f&&"rotate-90")}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),p?(0,a.jsx)(Qt,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}):ot(u),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:u}),(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:ze(t.size,r)}),t.lastModified!=null&&(0,a.jsx)(L,{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:ts(t.lastModified,r)})}),(0,a.jsxs)($e,{children:[(0,a.jsx)(Ue,{asChild:!0,children:(0,a.jsx)(R,{variant:"text",size:"icon",className:"opacity-0 group-hover:opacity-100 transition-opacity hover:shadow-none hover:text-link text-muted-foreground",onClick:v=>v.stopPropagation(),children:(0,a.jsx)(Ge,{className:"h-3 w-3"})})}),(0,a.jsxs)(We,{align:"end",onClick:v=>v.stopPropagation(),onCloseAutoFocus:v=>v.preventDefault(),children:[!p&&(0,a.jsxs)(A,{onSelect:()=>c({entry:t,namespace:e}),children:[(0,a.jsx)(it,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(A,{onSelect:async()=>{await ie(Bt(s,l,t.path).toString()),V({title:"Copied to clipboard"})},children:[(0,a.jsx)(ke,{className:"h-3.5 w-3.5 mr-2"}),"Copy URL"]}),!p&&(0,a.jsxs)(A,{onSelect:()=>m(),children:[(0,a.jsx)(Ne,{className:"h-3.5 w-3.5 mr-2"}),"Download"]})]})]})]})]}),p&&f&&(0,a.jsx)(as,{namespace:e,protocol:s,rootPath:l,prefix:t.path,depth:n+1,locale:r,searchValue:i,onOpenFile:c})]})},ss=t=>{let e=(0,De.c)(50),{namespace:s,locale:l,searchValue:n,onOpenFile:r}=t,[i,c]=(0,D.useState)(!0),[h,o]=(0,D.useState)(!1),{entriesByPath:g}=fe(),{clearNamespaceCache:p}=Tt(),u=s.name??s.displayName,{entries:j,isPending:d,error:f,refetch:m}=He(u),y;e[0]!==p||e[1]!==u||e[2]!==m?(y=F=>{F.stopPropagation(),o(!0),p(u),m(),setTimeout(()=>o(!1),500)},e[0]=p,e[1]=u,e[2]=m,e[3]=y):y=e[3];let v=y,b=d?s.storageEntries:j,N;if(e[4]!==b||e[5]!==g||e[6]!==f||e[7]!==v||e[8]!==i||e[9]!==d||e[10]!==h||e[11]!==l||e[12]!==s.displayName||e[13]!==s.name||e[14]!==s.protocol||e[15]!==s.rootPath||e[16]!==u||e[17]!==r||e[18]!==n){let F=ht(b,u,n,g),x=s.name,k;e[20]===i?k=e[21]:(k=()=>c(!i),e[20]=i,e[21]=k);let P=i&&"rotate-90",S;e[22]===P?S=e[23]:(S=Y("h-3 w-3 shrink-0 transition-transform",P),e[22]=P,e[23]=S);let C;e[24]===S?C=e[25]:(C=(0,a.jsx)(we,{className:S}),e[24]=S,e[25]=C);let M;e[26]===s.protocol?M=e[27]:(M=(0,a.jsx)(Ka,{protocol:s.protocol}),e[26]=s.protocol,e[27]=M);let _;e[28]===s.displayName?_=e[29]:(_=(0,a.jsx)("span",{children:s.displayName}),e[28]=s.displayName,e[29]=_);let O;e[30]===s.name?O=e[31]:(O=s.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Oa,{variableName:s.name}),")"]}),e[30]=s.name,e[31]=O);let z=h&&"animate-[spin_0.5s]",I;e[32]===z?I=e[33]:(I=Y("h-3 w-3 text-muted-foreground hover:text-foreground",z),e[32]=z,e[33]=I);let T;e[34]===I?T=e[35]:(T=(0,a.jsx)(Se,{className:I}),e[34]=I,e[35]=T);let Z;e[36]!==v||e[37]!==T?(Z=(0,a.jsx)(L,{content:"Refresh storage connection",children:(0,a.jsx)(R,{variant:"ghost",size:"icon",className:"hover:bg-transparent hover:shadow-none",onClick:v,children:T})}),e[36]=v,e[37]=T,e[38]=Z):Z=e[38];let q=s.rootPath||"(root)",U;e[39]===q?U=e[40]:(U=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:q}),e[39]=q,e[40]=U);let H;e[41]!==s.name||e[42]!==O||e[43]!==Z||e[44]!==U||e[45]!==k||e[46]!==C||e[47]!==M||e[48]!==_?(H=(0,a.jsxs)(et,{value:x,onSelect:k,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[C,M,_,O,Z,U]}),e[41]=s.name,e[42]=O,e[43]=Z,e[44]=U,e[45]=k,e[46]=C,e[47]=M,e[48]=_,e[49]=H):H=e[49],N=(0,a.jsxs)(a.Fragment,{children:[H,i&&(0,a.jsxs)(a.Fragment,{children:[d&&b.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:J(1),children:[(0,a.jsx)(Ce,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),f&&b.length===0&&(0,a.jsx)(za,{error:f,style:J(1),className:"py-1 text-xs h-auto",showIcon:!1}),!d&&b.length===0&&!f&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:J(1),children:"No entries"}),n&&F.length===0&&b.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:J(1),children:"No matches"}),F.map($=>(0,a.jsx)(mt,{entry:$,namespace:u,protocol:s.protocol,rootPath:s.rootPath,depth:1,locale:l,searchValue:n,onOpenFile:r},$.path))]})]}),e[4]=b,e[5]=g,e[6]=f,e[7]=v,e[8]=i,e[9]=d,e[10]=h,e[11]=l,e[12]=s.displayName,e[13]=s.name,e[14]=s.protocol,e[15]=s.rootPath,e[16]=u,e[17]=r,e[18]=n,e[19]=N}else N=e[19];return N};const rs=()=>{let t=(0,De.c)(29),{namespaces:e}=fe(),{locale:s}=Je(),[l,n]=(0,D.useState)(""),[r,i]=(0,D.useState)(null),c=!!l.trim();if(e.length===0){let b;return t[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsx)(Da,{title:"No storage connected",description:(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"}),"."]}),icon:(0,a.jsx)(ue,{className:"h-8 w-8"})}),t[0]=b):b=t[0],b}let h;t[1]===r?h=t[2]:(h=r&&(0,a.jsx)(Xa,{entry:r.entry,namespace:r.namespace,onBack:()=>i(null)}),t[1]=r,t[2]=h);let o=r&&"hidden",g;t[3]===o?g=t[4]:(g=Y("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",o),t[3]=o,t[4]=g);let p;t[5]===l?p=t[6]:(p=(0,a.jsx)(Fa,{placeholder:"Search entries...",className:"h-6 m-1",value:l,onValueChange:n,rootClassName:"flex-1 border-b-0"}),t[5]=l,t[6]=p);let u;t[7]===c?u=t[8]:(u=c&&(0,a.jsx)(R,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>n(""),children:(0,a.jsx)(Ut,{className:"h-4 w-4"})}),t[7]=c,t[8]=u);let j;t[9]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(L,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(Gt,{className:"h-3.5 w-3.5 mr-2 shrink-0 cursor-help text-muted-foreground hover:text-foreground"})}),t[9]=j):j=t[9];let d;t[10]!==p||t[11]!==u?(d=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[p,u,j]}),t[10]=p,t[11]=u,t[12]=d):d=t[12];let f;if(t[13]!==s||t[14]!==e||t[15]!==l){let b;t[17]!==s||t[18]!==l?(b=N=>(0,a.jsx)(ss,{namespace:N,locale:s,searchValue:l,onOpenFile:i},N.name??N.displayName),t[17]=s,t[18]=l,t[19]=b):b=t[19],f=e.map(b),t[13]=s,t[14]=e,t[15]=l,t[16]=f}else f=t[16];let m;t[20]===f?m=t[21]:(m=(0,a.jsx)(Sa,{className:"flex flex-col",children:f}),t[20]=f,t[21]=m);let y;t[22]!==g||t[23]!==d||t[24]!==m?(y=(0,a.jsxs)(Ca,{className:g,shouldFilter:!1,children:[d,m]}),t[22]=g,t[23]=d,t[24]=m,t[25]=y):y=t[25];let v;return t[26]!==h||t[27]!==y?(v=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[h,y]}),t[26]=h,t[27]=y,t[28]=v):v=t[28],v};var pt=Q(),xt=(0,D.createContext)(null);function ns(){return(0,D.useContext)(xt)??void 0}var ls=t=>{let e=(0,pt.c)(3),{children:s}=t,l=va(),n;return e[0]!==s||e[1]!==l?(n=(0,a.jsx)(xt.Provider,{value:l,children:s}),e[0]=s,e[1]=l,e[2]=n):n=e[2],n};const is=t=>{let e=(0,pt.c)(5),{children:s}=t,[l,n]=(0,D.useState)(null),r;e[0]!==s||e[1]!==l?(r=l&&(0,a.jsx)(ya,{backend:wa,options:{rootElement:l},children:(0,a.jsx)(ls,{children:s})}),e[0]=s,e[1]=l,e[2]=r):r=e[2];let i;return e[3]===r?i=e[4]:(i=(0,a.jsx)("div",{ref:n,className:"contents",children:r}),e[3]=r,e[4]=i),i};var Re=new Map;const os=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:s,sendUpdateFile:l}=je(),n=ne(Rt),r=ne(Ve),i=ne(_t),[c,h]=(0,D.useState)(""),{data:o,isPending:g,error:p,setData:u,refetch:j}=Pe(async()=>{let x=await s({path:t.path}),k=x.contents||"";return h(Re.get(t.path)||k),x},[t.path]),d=async()=>{c!==(o==null?void 0:o.contents)&&await l({path:t.path,contents:c}).then(x=>{x.success&&(u(k=>({...k,contents:c})),h(c))})},f=(0,D.useRef)(c);if(f.current=c,(0,D.useEffect)(()=>()=>{if(!(o!=null&&o.contents))return;let x=f.current;x===o.contents?Re.delete(t.path):Re.set(t.path,x)},[t.path,o==null?void 0:o.contents]),p)return(0,a.jsx)(Xe,{error:p});if(g||!o)return null;let m=o.mimeType||"text/plain",y=m in It,v=i&&o.file.isMarimoFile&&(t.path===i||t.path.endsWith(`/${i}`));if(!o.contents&&!y)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:o.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:m})]});let b=(0,a.jsx)(ct,{filename:o.file.name,onRefresh:j,onDownload:r?void 0:()=>{if(xe(m)){ve($t(o.contents,m),o.file.name);return}qe(new Blob([o.contents||c],{type:m}),o.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!pe()&&(0,a.jsx)(L,{content:"Open notebook",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:x=>e(x),children:(0,a.jsx)(be,{className:"h-3.5 w-3.5"})})}),!xe(m)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{content:"Copy contents to clipboard",children:(0,a.jsx)(R,{variant:"text",size:"xs",onClick:async()=>{await ie(c)},children:(0,a.jsx)(ke,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(L,{content:_a("global.save"),children:(0,a.jsx)(R,{variant:c===o.contents?"text":"success",size:"xs",onClick:d,disabled:c===o.contents,children:(0,a.jsx)(na,{className:"h-3.5 w-3.5"})})})]})]})}),N=xe(m),F=!N&&m!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[b,F&&v&&(0,a.jsxs)(Na,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(oa,{className:"h-4 w-4"}),(0,a.jsx)(ka,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Be,{mimeType:m,contents:N?void 0:F?c:o.contents??void 0,mediaSource:N?{base64:o.contents,mime:m}:void 0,readOnly:!F,onChange:h,extensions:[Lt.of([{key:n.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===o.contents?!1:(d(),!0)}])]})]})};var cs=class{constructor(t){G(this,"delegate",new _e([]));G(this,"rootPath","");G(this,"onChange",Dt.NOOP);G(this,"path",new Me("/"));G(this,"initialize",async t=>{if(this.onChange=t,this.delegate.data.length===0)try{let e=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new _e(e.files),this.rootPath=e.root,this.path=Me.guessDeliminator(e.root)}catch(e){V({title:"Failed",description:fa(e)})}this.onChange(this.delegate.data)});G(this,"refreshAll",async t=>{let e=[this.rootPath,...t.map(l=>{var n;return(n=this.delegate.find(l))==null?void 0:n.data.path})].filter(Boolean),s=await Promise.all(e.map(l=>this.callbacks.listFiles({path:l}).catch(()=>({files:[]}))));for(let[l,n]of e.entries()){let r=s[l];n===this.rootPath?this.delegate=new _e(r.files):this.delegate.update({id:n,changes:{children:r.files}})}this.onChange(this.delegate.data)});G(this,"relativeFromRoot",t=>{let e=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return t.startsWith(e)?t.slice(e.length):t});G(this,"handleResponse",t=>t.success?t:(V({title:"Failed",description:t.message}),null));this.callbacks=t}async expand(t){let e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;let s=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:s.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){let s=this.delegate.find(t);if(!s)return;let l=s.data.path,n=this.path.join(this.path.dirname(l),e);await this.callbacks.renameFileOrFolder({path:l,newPath:n}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:n}}),this.onChange(this.delegate.data),await this.refreshAll([n])}async move(t,e){var l;let s=e?((l=this.delegate.find(e))==null?void 0:l.data.path)??e:this.rootPath;await Promise.all(t.map(n=>{this.delegate.move({id:n,parentId:e,index:0});let r=this.delegate.find(n);if(!r)return Promise.resolve();let i=this.path.join(s,this.path.basename(r.data.path));return this.delegate.update({id:n,changes:{path:i}}),this.callbacks.renameFileOrFolder({path:r.data.path,newPath:i}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([s])}async createFile(t,e,s="file"){var r;let l=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,n=await this.callbacks.createFileOrFolder({path:l,type:s,name:t}).then(this.handleResponse);n!=null&&n.info&&(this.delegate.create({parentId:e,index:0,data:n.info}),this.onChange(this.delegate.data),await this.refreshAll([l]))}async createFolder(t,e){var n;let s=e?((n=this.delegate.find(e))==null?void 0:n.data.path)??e:this.rootPath,l=await this.callbacks.createFileOrFolder({path:s,type:"directory",name:t}).then(this.handleResponse);l!=null&&l.info&&(this.delegate.create({parentId:e,index:0,data:l.info}),this.onChange(this.delegate.data),await this.refreshAll([s]))}async delete(t){let e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}};const ft=Ee(t=>{let e=t(Vt);return Ot(e,"no requestClientAtom set"),new cs({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),ds=Ee({});async function hs(){await Ft.get(ft).refreshAll([])}var ms=Q(),ps=1024*1024*100;function ut(t){let e=(0,ms.c)(7),s;e[0]===t?s=e[1]:(s=t===void 0?{}:t,e[0]=t,e[1]=s);let l=s,{sendCreateFileOrFolder:n}=je(),r;e[2]===n?r=e[3]:(r=async c=>{if(c.length===0)return;let h=c.length===1;await Wt(h?"Uploading file...":"Uploading files...",async o=>{o.addTotal(c.length);for(let g of c){let p=ys(js(g)),u="";p&&(u=Me.guessDeliminator(p).dirname(p));let j=(await ua(g)).split(",")[1];await n({path:u,type:"file",name:g.name,contents:j}),o.increment(1)}await hs()},{title:h?"File uploaded":`${c.length} files uploaded`})},e[2]=n,e[3]=r);let i;return e[4]!==l||e[5]!==r?(i={multiple:!0,maxSize:ps,onError:gs,onDropRejected:xs,onDrop:r,...l},e[4]=l,e[5]=r,e[6]=i):i=e[6],ma(i)}function xs(t){V({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(fs)}),variant:"danger"})}function fs(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(us).join(", "),")"]},t.file.name)}function us(t){return t.message}function gs(t){ge.error(t),V({title:"File upload failed",description:t.message,variant:"danger"})}function js(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 ys(t){if(t)return t.replace(/^\/+/,"")}var oe=Q(),vs=Ie("marimo:showHiddenFiles",!0,Le,{getOnInit:!0}),gt=D.createContext(null);const ws=t=>{let e=(0,oe.c)(72),{height:s}=t,l=(0,D.useRef)(null),n=ns(),[r]=me(ft),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[0]=i):i=e[0];let[c,h]=(0,D.useState)(i),[o,g]=(0,D.useState)(null),[p,u]=me(vs),{openPrompt:j}=Qe(),[d,f]=me(ds),m;e[1]===r?m=e[2]:(m=()=>r.initialize(h),e[1]=r,e[2]=m);let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[3]=y):y=e[3];let{isPending:v,error:b}=Pe(m,y),N;e[4]!==d||e[5]!==r?(N=()=>{r.refreshAll(Object.keys(d).filter(w=>d[w]))},e[4]=d,e[5]=r,e[6]=N):N=e[6];let F=W(N),x;e[7]!==u||e[8]!==p?(x=()=>{u(!p)},e[7]=u,e[8]=p,e[9]=x):x=e[9];let k=W(x),P;e[10]!==j||e[11]!==r?(P=async()=>{j({title:"Folder name",onConfirm:async w=>{r.createFolder(w,null)}})},e[10]=j,e[11]=r,e[12]=P):P=e[12];let S=W(P),C;e[13]!==j||e[14]!==r?(C=async()=>{j({title:"File name",onConfirm:async w=>{r.createFile(w,null)}})},e[13]=j,e[14]=r,e[15]=C):C=e[15];let M=W(C),_;e[16]!==j||e[17]!==r?(_=async()=>{j({title:"Notebook name",onConfirm:async w=>{r.createFile(w,null,"notebook")}})},e[16]=j,e[17]=r,e[18]=_):_=e[18];let O=W(_),z;e[19]===f?z=e[20]:(z=()=>{var w;(w=l.current)==null||w.closeAll(),f({})},e[19]=f,e[20]=z);let I=W(z),T;e[21]!==c||e[22]!==p?(T=yt(c,p),e[21]=c,e[22]=p,e[23]=T):T=e[23];let Z=T;if(v){let w;return e[24]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsx)(sa,{size:"medium",centered:!0}),e[24]=w):w=e[24],w}if(b){let w;return e[25]===b?w=e[26]:(w=(0,a.jsx)(Xe,{error:b}),e[25]=b,e[26]=w),w}if(o){let w;e[27]===Symbol.for("react.memo_cache_sentinel")?(w=()=>g(null),e[27]=w):w=e[27];let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=(0,a.jsx)(R,{onClick:w,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ze,{size:16})}),e[28]=E):E=e[28];let B;e[29]===o.name?B=e[30]:(B=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[E,(0,a.jsx)("span",{className:"font-bold",children:o.name})]}),e[29]=o.name,e[30]=B);let se;e[31]!==o.path||e[32]!==r?(se=bt=>jt(bt,r.relativeFromRoot(o.path)),e[31]=o.path,e[32]=r,e[33]=se):se=e[33];let re;e[34]!==o||e[35]!==se?(re=(0,a.jsx)(D.Suspense,{children:(0,a.jsx)(os,{onOpenNotebook:se,file:o})}),e[34]=o,e[35]=se,e[36]=re):re=e[36];let he;return e[37]!==B||e[38]!==re?(he=(0,a.jsxs)(a.Fragment,{children:[B,re]}),e[37]=B,e[38]=re,e[39]=he):he=e[39],he}let q;e[40]!==I||e[41]!==M||e[42]!==S||e[43]!==O||e[44]!==k||e[45]!==F||e[46]!==r?(q=(0,a.jsx)(ks,{onRefresh:F,onHidden:k,onCreateFile:M,onCreateNotebook:O,onCreateFolder:S,onCollapseAll:I,tree:r}),e[40]=I,e[41]=M,e[42]=S,e[43]=O,e[44]=k,e[45]=F,e[46]=r,e[47]=q):q=e[47];let U=s-33,H,$,X;e[48]===r?(H=e[49],$=e[50],X=e[51]):(H=async w=>{let{ids:E}=w;for(let B of E)await r.delete(B)},$=async w=>{let{id:E,name:B}=w;await r.rename(E,B)},X=async w=>{let{dragIds:E,parentId:B}=w;await r.move(E,B)},e[48]=r,e[49]=H,e[50]=$,e[51]=X);let ce;e[52]===Symbol.for("react.memo_cache_sentinel")?(ce=w=>{let E=w[0];E&&(E.data.isDirectory||g(E.data))},e[52]=ce):ce=e[52];let ee;e[53]!==d||e[54]!==f||e[55]!==r?(ee=async w=>{if(await r.expand(w)){let E=d[w]??!1;f({...d,[w]:!E})}},e[53]=d,e[54]=f,e[55]=r,e[56]=ee):ee=e[56];let te;e[57]!==n||e[58]!==d||e[59]!==U||e[60]!==H||e[61]!==$||e[62]!==X||e[63]!==ee||e[64]!==Z?(te=(0,a.jsx)(ba,{width:"100%",ref:l,height:U,className:"h-full",data:Z,initialOpenState:d,openByDefault:!1,dndManager:n,renderCursor:_s,disableDrop:Ps,onDelete:H,onRename:$,onMove:X,onSelect:ce,onToggle:ee,padding:15,rowHeight:30,indent:bs,overscanCount:1e3,disableMultiSelection:!0,children:Cs}),e[57]=n,e[58]=d,e[59]=U,e[60]=H,e[61]=$,e[62]=X,e[63]=ee,e[64]=Z,e[65]=te):te=e[65];let ae;e[66]!==te||e[67]!==r?(ae=(0,a.jsx)(gt,{value:r,children:te}),e[66]=te,e[67]=r,e[68]=ae):ae=e[68];let de;return e[69]!==q||e[70]!==ae?(de=(0,a.jsxs)(a.Fragment,{children:[q,ae]}),e[69]=q,e[70]=ae,e[71]=de):de=e[71],de};var bs=15,ks=t=>{let e=(0,oe.c)(38),{onRefresh:s,onHidden:l,onCreateFile:n,onCreateNotebook:r,onCreateFolder:i,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:o,getInputProps:g}=ut(h),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(rt,{size:16}),e[1]=p):p=e[1];let u;e[2]===r?u=e[3]:(u=(0,a.jsx)(L,{content:"Add notebook",children:(0,a.jsx)(R,{"data-testid":"file-explorer-add-notebook-button",onClick:r,variant:"text",size:"xs",children:p})}),e[2]=r,e[3]=u);let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Ye,{size:16}),e[4]=j):j=e[4];let d;e[5]===n?d=e[6]:(d=(0,a.jsx)(L,{content:"Add file",children:(0,a.jsx)(R,{"data-testid":"file-explorer-add-file-button",onClick:n,variant:"text",size:"xs",children:j})}),e[5]=n,e[6]=d);let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(nt,{size:16}),e[7]=f):f=e[7];let m;e[8]===i?m=e[9]:(m=(0,a.jsx)(L,{content:"Add folder",children:(0,a.jsx)(R,{"data-testid":"file-explorer-add-folder-button",onClick:i,variant:"text",size:"xs",children:f})}),e[8]=i,e[9]=m);let y;e[10]===o?y=e[11]:(y=o({}),e[10]=o,e[11]=y);let v,b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=Et({variant:"text",size:"xs"}),v=(0,a.jsx)(da,{size:16}),e[12]=v,e[13]=b):(v=e[12],b=e[13]);let N;e[14]===y?N=e[15]:(N=(0,a.jsx)(L,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...y,className:b,children:v})}),e[14]=y,e[15]=N);let F;e[16]===g?F=e[17]:(F=g({}),e[16]=g,e[17]=F);let x;e[18]===F?x=e[19]:(x=(0,a.jsx)("input",{...F,type:"file"}),e[18]=F,e[19]=x);let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(ra,{size:16}),e[20]=k):k=e[20];let P;e[21]===s?P=e[22]:(P=(0,a.jsx)(L,{content:"Refresh",children:(0,a.jsx)(R,{"data-testid":"file-explorer-refresh-button",onClick:s,variant:"text",size:"xs",children:k})}),e[21]=s,e[22]=P);let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=(0,a.jsx)(Yt,{size:16}),e[23]=S):S=e[23];let C;e[24]===l?C=e[25]:(C=(0,a.jsx)(L,{content:"Toggle hidden files",children:(0,a.jsx)(R,{"data-testid":"file-explorer-hidden-files-button",onClick:l,variant:"text",size:"xs",children:S})}),e[24]=l,e[25]=C);let M;e[26]===Symbol.for("react.memo_cache_sentinel")?(M=(0,a.jsx)(La,{size:16}),e[26]=M):M=e[26];let _;e[27]===c?_=e[28]:(_=(0,a.jsx)(L,{content:"Collapse all folders",children:(0,a.jsx)(R,{"data-testid":"file-explorer-collapse-button",onClick:c,variant:"text",size:"xs",children:M})}),e[27]=c,e[28]=_);let O;return e[29]!==N||e[30]!==x||e[31]!==P||e[32]!==C||e[33]!==_||e[34]!==u||e[35]!==d||e[36]!==m?(O=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[u,d,m,N,x,P,C,_]}),e[29]=N,e[30]=x,e[31]=P,e[32]=C,e[33]=_,e[34]=u,e[35]=d,e[36]=m,e[37]=O):O=e[37],O},Ns=t=>{let e=(0,oe.c)(9),{node:s,onOpenMarimoFile:l}=t,n;e[0]===s?n=e[1]:(n=c=>{s.data.isDirectory||(c.stopPropagation(),s.select())},e[0]=s,e[1]=n);let r;e[2]!==s.data.isMarimoFile||e[3]!==l?(r=s.data.isMarimoFile&&!pe()&&(0,a.jsxs)("span",{className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:l,children:["open ",(0,a.jsx)(be,{className:"inline ml-1",size:12})]}),e[2]=s.data.isMarimoFile,e[3]=l,e[4]=r):r=e[4];let i;return e[5]!==s.data.name||e[6]!==n||e[7]!==r?(i=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:n,children:[s.data.name,r]}),e[5]=s.data.name,e[6]=n,e[7]=r,e[8]=i):i=e[8],i},Fs=t=>{let e=(0,oe.c)(10),{node:s}=t,l=(0,D.useRef)(null),n,r;e[0]===s.data.name?(n=e[1],r=e[2]):(n=()=>{var o,g;(o=l.current)==null||o.focus(),(g=l.current)==null||g.setSelectionRange(0,s.data.name.lastIndexOf("."))},r=[s.data.name],e[0]=s.data.name,e[1]=n,e[2]=r),(0,D.useEffect)(n,r);let i,c;e[3]===s?(i=e[4],c=e[5]):(i=()=>s.reset(),c=o=>{o.key==="Escape"&&s.reset(),o.key==="Enter"&&s.submit(o.currentTarget.value)},e[3]=s,e[4]=i,e[5]=c);let h;return e[6]!==s.data.name||e[7]!==i||e[8]!==c?(h=(0,a.jsx)("input",{ref:l,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:s.data.name,onClick:zs,onBlur:i,onKeyDown:c}),e[6]=s.data.name,e[7]=i,e[8]=c,e[9]=h):h=e[9],h},Cs=({node:t,style:e,dragHandle:s})=>{let{openFile:l,sendCreateFileOrFolder:n,sendFileDetails:r}=je(),i=ne(Ve),c=t.data.isDirectory?"directory":Xt(t.data.name),h=ea[c],{openConfirm:o,openPrompt:g}=Qe(),{createNewCell:p}=Mt(),u=Ma(),j=x=>{p({code:x,before:!1,cellId:u??"__end__"})},d=(0,D.use)(gt),f=async x=>{jt(x,d?d.relativeFromRoot(t.data.path):t.data.path)},m=async x=>{x.stopPropagation(),x.preventDefault(),o({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:(0,a.jsx)(xa,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},y=W(async()=>{t.open(),g({title:"Folder name",onConfirm:async x=>{d==null||d.createFolder(x,t.id)}})}),v=W(async()=>{t.open(),g({title:"File name",onConfirm:async x=>{d==null||d.createFile(x,t.id)}})}),b=W(async()=>{t.open(),g({title:"Notebook name",onConfirm:async x=>{d==null||d.createFile(x,t.id,"notebook")}})}),N=W(async()=>{var S;if(!d||t.data.isDirectory)return;let[x,k]=ha(t.data.name),P=`${x}_copy${k}`;try{let C=await r({path:t.data.path}),M=((S=t.parent)==null?void 0:S.data.path)||"";await n({path:M,type:"file",name:P,contents:C.contents?btoa(C.contents):void 0}),await d.refreshAll([M])}catch{V({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}}),F=()=>{let x={size:14,strokeWidth:1.5,className:"mr-2"};return(0,a.jsxs)(We,{align:"end",className:"print:hidden w-[220px]",onClick:k=>k.stopPropagation(),onCloseAutoFocus:k=>k.preventDefault(),children:[!t.data.isDirectory&&(0,a.jsxs)(A,{onSelect:()=>t.select(),children:[(0,a.jsx)(it,{...x}),"Open file"]}),!t.data.isDirectory&&!pe()&&(0,a.jsxs)(A,{onSelect:()=>{l({path:t.data.path})},children:[(0,a.jsx)(be,{...x}),"Open file in external editor"]}),t.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A,{onSelect:()=>b(),children:[(0,a.jsx)(rt,{...x}),"Create notebook"]}),(0,a.jsxs)(A,{onSelect:()=>v(),children:[(0,a.jsx)(Ye,{...x}),"Create file"]}),(0,a.jsxs)(A,{onSelect:()=>y(),children:[(0,a.jsx)(nt,{...x}),"Create folder"]}),(0,a.jsx)(le,{})]}),(0,a.jsxs)(A,{onSelect:()=>t.edit(),children:[(0,a.jsx)(Ba,{...x}),"Rename"]}),!t.data.isDirectory&&(0,a.jsxs)(A,{onSelect:N,children:[(0,a.jsx)(ke,{...x}),"Duplicate"]}),(0,a.jsxs)(A,{onSelect:async()=>{await ie(t.data.path),V({title:"Copied to clipboard"})},children:[(0,a.jsx)(lt,{...x}),"Copy path"]}),d&&(0,a.jsxs)(A,{onSelect:async()=>{await ie(d.relativeFromRoot(t.data.path)),V({title:"Copied to clipboard"})},children:[(0,a.jsx)(lt,{...x}),"Copy relative path"]}),(0,a.jsx)(le,{}),(0,a.jsxs)(A,{onSelect:()=>{let{path:k}=t.data;j(Ke[c](k))},children:[(0,a.jsx)(Zt,{...x}),"Insert snippet for reading file"]}),(0,a.jsxs)(A,{onSelect:async()=>{V({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:k}=t.data;await ie(Ke[c](k))},children:[(0,a.jsx)(zt,{...x}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!pe()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(le,{}),(0,a.jsxs)(A,{onSelect:f,children:[(0,a.jsx)(Ta,{...x}),"Open notebook"]})]}),(0,a.jsx)(le,{}),!t.data.isDirectory&&!i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A,{onSelect:async()=>{let k=(await r({path:t.data.path})).contents||"";qe(new Blob([k]),t.data.name)},children:[(0,a.jsx)(Ne,{...x}),"Download"]}),(0,a.jsx)(le,{})]}),(0,a.jsxs)(A,{onSelect:m,variant:"danger",children:[(0,a.jsx)(la,{...x}),"Delete"]})]})};return(0,a.jsxs)("div",{style:e,ref:s,className:Y("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:x=>{x.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[(0,a.jsx)(Ss,{node:t}),(0,a.jsxs)("span",{className:Y("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?(0,a.jsx)(Aa,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(h,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}),t.isEditing?(0,a.jsx)(Fs,{node:t}):(0,a.jsx)(Ns,{node:t,onOpenMarimoFile:f}),(0,a.jsxs)($e,{modal:!1,children:[(0,a.jsx)(Ue,{asChild:!0,tabIndex:-1,onClick:x=>x.stopPropagation(),children:(0,a.jsx)(R,{"data-testid":"file-explorer-more-button",variant:"text",tabIndex:-1,size:"xs",className:"mb-0","aria-label":"More options",children:(0,a.jsx)(Ge,{strokeWidth:2,className:"w-5 h-5 hidden group-hover:block"})})}),F()]})]})]})},Ss=t=>{let e=(0,oe.c)(3),{node:s}=t;if(!s.data.isDirectory){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,a.jsx)("span",{className:"w-5 h-5 shrink-0"}),e[0]=n):n=e[0],n}let l;return e[1]===s.isOpen?l=e[2]:(l=s.isOpen?(0,a.jsx)(qt,{className:"w-5 h-5 shrink-0"}):(0,a.jsx)(we,{className:"w-5 h-5 shrink-0"}),e[1]=s.isOpen,e[2]=l),l};function jt(t,e){t.stopPropagation(),t.preventDefault(),Ea(e)}function yt(t,e){if(e)return t;let s=[];for(let l of t){if(Ms(l.name))continue;let n=l;if(l.children){let r=yt(l.children,e);r!==l.children&&(n={...l,children:r})}s.push(n)}return s}function Ms(t){return!!t.startsWith(".")}function _s(){return null}function Ps(t){let{parentNode:e}=t;return!e.data.isDirectory}function zs(t){return t.stopPropagation()}var vt=Q(),Ds=Ie("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},Le),wt=t=>{let e=(0,vt.c)(20),{height:s}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={noClick:!0,noKeyboard:!0},e[0]=l):l=e[0];let{getRootProps:n,getInputProps:r,isDragActive:i}=ut(l),c;e[1]===n?c=e[2]:(c=n(),e[1]=n,e[2]=c);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=Y("flex flex-col overflow-hidden relative"),e[3]=h):h=e[3];let o;e[4]===s?o=e[5]:(o={height:s},e[4]=s,e[5]=o);let g;e[6]===r?g=e[7]:(g=r(),e[6]=r,e[7]=g);let p;e[8]===g?p=e[9]:(p=(0,a.jsx)("input",{...g}),e[8]=g,e[9]=p);let u;e[10]===i?u=e[11]:(u=i&&(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]=i,e[11]=u);let j;e[12]===s?j=e[13]:(j=(0,a.jsx)(ws,{height:s}),e[12]=s,e[13]=j);let d;return e[14]!==c||e[15]!==o||e[16]!==p||e[17]!==u||e[18]!==j?(d=(0,a.jsx)(is,{children:(0,a.jsxs)("div",{...c,className:h,style:o,children:[p,u,j]})}),e[14]=c,e[15]=o,e[16]=p,e[17]=u,e[18]=j,e[19]=d):d=e[19],d},Os=33,Rs=()=>{let t=(0,vt.c)(41),{ref:e,height:s}=Pa(),l=s===void 0?500:s,[n,r]=me(Ds),i=ne(Ht).length,c;e:{if(!n.hasUserInteracted&&i>0){if(n.openSections.includes("remote-storage")){c=n.openSections;break e}let z;t[0]===n.openSections?z=t[1]:(z=[...n.openSections,"remote-storage"],t[0]=n.openSections,t[1]=z),c=z;break e}c=n.openSections}let h=c,o;t[2]===r?o=t[3]:(o=z=>{r({openSections:z,hasUserInteracted:!0})},t[2]=r,t[3]=o);let g=o,p=l-Os*2,u;t[4]===h?u=t[5]:(u=h.includes("remote-storage"),t[4]=h,t[5]=u);let j=u,d;t[6]!==h||t[7]!==j?(d=j&&h.includes("files"),t[6]=h,t[7]=j,t[8]=d):d=t[8];let f=d,m;t[9]!==p||t[10]!==f?(m=f?Math.round(p*.4):p,t[9]=p,t[10]=f,t[11]=m):m=t[11];let y=m,v=Math.max(200,f?p-y:p);if(!St("storage_inspector")){let z;t[12]===l?z=t[13]:(z=(0,a.jsx)(wt,{height:l}),t[12]=l,t[13]=z);let I;return t[14]!==e||t[15]!==z?(I=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:z}),t[14]=e,t[15]=z,t[16]=I):I=t[16],I}let b;t[17]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsx)(ue,{className:"w-4 h-4"}),t[17]=b):b=t[17];let N;t[18]===i?N=t[19]:(N=i>0&&(0,a.jsx)(Ra,{children:i}),t[18]=i,t[19]=N);let F;t[20]===N?F=t[21]:(F=(0,a.jsxs)(at,{children:[b," Remote storage",N]}),t[20]=N,t[21]=F);let x;t[22]===y?x=t[23]:(x={maxHeight:y},t[22]=y,t[23]=x);let k;t[24]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(rs,{}),t[24]=k):k=t[24];let P;t[25]===x?P=t[26]:(P=(0,a.jsx)(st,{className:"overflow-auto",style:x,children:k}),t[25]=x,t[26]=P);let S;t[27]!==P||t[28]!==F?(S=(0,a.jsxs)(tt,{value:"remote-storage",children:[F,P]}),t[27]=P,t[28]=F,t[29]=S):S=t[29];let C;t[30]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsxs)(at,{children:[(0,a.jsx)(Fe,{className:"w-4 h-4"}),"Files"]}),t[30]=C):C=t[30];let M;t[31]===v?M=t[32]:(M=(0,a.jsxs)(tt,{value:"files",children:[C,(0,a.jsx)(st,{children:(0,a.jsx)(wt,{height:v})})]}),t[31]=v,t[32]=M);let _;t[33]!==g||t[34]!==h||t[35]!==S||t[36]!==M?(_=(0,a.jsxs)(ja,{type:"multiple",value:h,onValueChange:g,children:[S,M]}),t[33]=g,t[34]=h,t[35]=S,t[36]=M,t[37]=_):_=t[37];let O;return t[38]!==e||t[39]!==_?(O=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:_}),t[38]=e,t[39]=_,t[40]=O):O=t[40],O};export{Rs as default};