@marimo-team/frontend 0.24.1-dev80 → 0.24.1-dev82

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.
Files changed (128) hide show
  1. package/dist/assets/{CellStatus-DMQfH9wD.js → CellStatus-GcHBZKLm.js} +1 -1
  2. package/dist/assets/{JsonOutput-B7sDhGzR.js → JsonOutput-CUJlEdsN.js} +8 -8
  3. package/dist/assets/{MarimoErrorOutput-C0vk393J.js → MarimoErrorOutput-DCAezqcJ.js} +2 -2
  4. package/dist/assets/{RenderHTML-BnMaGpV8.js → RenderHTML-D9-75ltP.js} +1 -1
  5. package/dist/assets/{RunButton-nocIODpS.js → RunButton-plSsbubG.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-B_TSaqjJ.js → add-cell-with-ai-Cfby28hZ.js} +14 -14
  7. package/dist/assets/{add-connection-dialog-DOuojDa-.js → add-connection-dialog-By0i0Fq5.js} +42 -42
  8. package/dist/assets/{agent-panel-CkKCGjDp.js → agent-panel-Cf482jaA.js} +4 -4
  9. package/dist/assets/ai-model-dropdown-DMfaGQ8o.js +3 -0
  10. package/dist/assets/app-config-button-93unbEYx.js +1 -0
  11. package/dist/assets/{blob-CYM8xQsK.js → blob-yxfhyyvD.js} +1 -1
  12. package/dist/assets/cell-editor-CZmqG6aB.js +21 -0
  13. package/dist/assets/{cell-link-DCOAqVkE.js → cell-link-hHrWcozB.js} +1 -1
  14. package/dist/assets/{cells-C6lBv8kg.js → cells-yuYDzbAy.js} +51 -51
  15. package/dist/assets/{chat-display-B6GBZDq8.js → chat-display-CnhvADgL.js} +1 -1
  16. package/dist/assets/{chat-panel-wWuBXhXw.js → chat-panel-CdE97AxM.js} +2 -2
  17. package/dist/assets/{chat-ui-CQ7A3qdB.js → chat-ui-BD3rpULw.js} +2 -2
  18. package/dist/assets/{column-preview-CatwdUda.js → column-preview-BEmcYaKl.js} +1 -1
  19. package/dist/assets/{command-palette-DcPM_WiO.js → command-palette-BGRRw0sn.js} +1 -1
  20. package/dist/assets/{common-B4aMxphz.js → common-Bs2kaOs2.js} +1 -1
  21. package/dist/assets/{components-D8-ffQsq.js → components-ByyAzQxP.js} +1 -1
  22. package/dist/assets/{datasource-D-_jFtGs.js → datasource-DeZYq5UY.js} +2 -2
  23. package/dist/assets/{dependency-graph-panel-BQli6zxh.js → dependency-graph-panel-g10osAFc.js} +4 -4
  24. package/dist/assets/{documentation-panel-_QE3nPOg.js → documentation-panel-CZ1mKkDh.js} +1 -1
  25. package/dist/assets/{download-Cqjqrhzo.js → download-D1crMjD8.js} +1 -1
  26. package/dist/assets/edit-page-Bk1sT7Wb.js +9 -0
  27. package/dist/assets/{error-entries-c5sIySli.js → error-entries-B6XTLRyE.js} +1 -1
  28. package/dist/assets/{error-panel-CXKrWK_u.js → error-panel-lexB3L6f.js} +1 -1
  29. package/dist/assets/{file-explorer-panel-BZiAb4x_.js → file-explorer-panel-DHRH2J-3.js} +1 -1
  30. package/dist/assets/{file-icons-uUY_hGYm.js → file-icons-Dx3v6lMu.js} +1 -1
  31. package/dist/assets/{file-name-input-DWUKg4LS.js → file-name-input-DzL8D_7x.js} +1 -1
  32. package/dist/assets/{floating-outline-DhGtHg6T.js → floating-outline-3rQEbxxk.js} +1 -1
  33. package/dist/assets/{home-page-Bka_7H02.js → home-page-Dnz4tfZB.js} +1 -1
  34. package/dist/assets/index-BID9w87A.js +29 -0
  35. package/dist/assets/layout-qHVpnnQT.js +9 -0
  36. package/dist/assets/{logs-panel-ragZa1sf.js → logs-panel-CSbUhhRo.js} +1 -1
  37. package/dist/assets/{markdown-renderer-B-uA_6mP.js → markdown-renderer-BgUTGtM0.js} +1 -1
  38. package/dist/assets/{name-cell-input-gC1flbyT.js → name-cell-input-pEE4FGAL.js} +1 -1
  39. package/dist/assets/{outline-panel-D7H7bhOh.js → outline-panel-BgnjEQWg.js} +1 -1
  40. package/dist/assets/{packages-panel-BZnsUm4S.js → packages-panel-BprfUOzZ.js} +1 -1
  41. package/dist/assets/panel-accordion-state-vpqEc3Kd.js +1 -0
  42. package/dist/assets/panels-3h7Cf8xJ.js +4 -0
  43. package/dist/assets/{process-output-DQQ8T5gv.js → process-output-siRm_lza.js} +1 -1
  44. package/dist/assets/{readonly-code-display-Bc0VX9i6.js → readonly-code-display-CLWV76FT.js} +1 -1
  45. package/dist/assets/readonly-python-code-Bor9b9pV.js +1 -0
  46. package/dist/assets/reveal-component-DNPksvzT.js +1069 -0
  47. package/dist/assets/run-page-C4aONLoP.js +1 -0
  48. package/dist/assets/{scratchpad-panel-BJHlMBZV.js → scratchpad-panel-BQSoRQvQ.js} +1 -1
  49. package/dist/assets/session-panel-DB5qEYqt.js +1 -0
  50. package/dist/assets/skeleton-BSxwEE0h.js +1 -0
  51. package/dist/assets/{snippets-panel-2jq36DdG.js → snippets-panel-B8Yi81tz.js} +1 -1
  52. package/dist/assets/state-D1N9_41P.js +3 -0
  53. package/dist/assets/state-O8w98G11.js +1 -0
  54. package/dist/assets/{tracing-91_akEkv.js → tracing-DuLkr7ts.js} +1 -1
  55. package/dist/assets/{tracing-panel-BvE81RYx.js → tracing-panel-CeLKVG8M.js} +2 -2
  56. package/dist/assets/{tree-actions-CGkbUSfG.js → tree-actions-Bh-Nnaub.js} +1 -1
  57. package/dist/assets/useAddCell-_JRYhAFd.js +1 -0
  58. package/dist/assets/useBoolean-Cu7Eado1.js +1 -0
  59. package/dist/assets/{useCellActionButton-cv6xOsnc.js → useCellActionButton-Bi8Lnv3F.js} +1 -1
  60. package/dist/assets/{useDeleteCell-DB-bhhnO.js → useDeleteCell-CBQiavzs.js} +1 -1
  61. package/dist/assets/{useDependencyPanelTab-BDnVzNV-.js → useDependencyPanelTab-BOn3UJ07.js} +1 -1
  62. package/dist/assets/useNotebookActions--pblpIWF.js +10 -0
  63. package/dist/assets/{useRunCells-GCTS1YFv.js → useRunCells-BFQfLlUl.js} +1 -1
  64. package/dist/assets/{useSplitCell-DhT9BA2_.js → useSplitCell-Ig9P6lAn.js} +1 -1
  65. package/dist/index.html +20 -20
  66. package/package.json +1 -1
  67. package/src/__tests__/mount.test.ts +54 -2
  68. package/src/components/editor/__tests__/viewer-banner.test.tsx +1 -1
  69. package/src/components/editor/actions/export-dialog/__tests__/export-notebook.test.ts +9 -0
  70. package/src/components/editor/actions/export-dialog/export-notebook.ts +8 -1
  71. package/src/components/editor/actions/export-dialog/use-export-dialog.ts +2 -0
  72. package/src/components/editor/actions/useNotebookActions.tsx +1 -1
  73. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +1 -1
  74. package/src/components/editor/renderers/__tests__/cells-renderer.test.tsx +1 -1
  75. package/src/components/editor/renderers/cells-renderer.tsx +15 -28
  76. package/src/components/editor/renderers/grid-layout/__tests__/plugin.test.ts +42 -0
  77. package/src/components/editor/renderers/grid-layout/plugin.tsx +20 -10
  78. package/src/components/editor/renderers/layout-select.tsx +1 -1
  79. package/src/components/editor/renderers/plugins.ts +7 -1
  80. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +49 -15
  81. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +16 -2
  82. package/src/components/editor/renderers/slides-layout/types.ts +15 -11
  83. package/src/components/editor/renderers/types.ts +5 -5
  84. package/src/components/editor/viewer-banner.tsx +1 -1
  85. package/src/components/pages/run-page.tsx +16 -7
  86. package/src/components/slides/__tests__/reveal-component.test.ts +33 -8
  87. package/src/components/slides/__tests__/speaker-view.test.ts +27 -0
  88. package/src/components/slides/reveal-component.tsx +110 -45
  89. package/src/components/slides/speaker-view.ts +22 -0
  90. package/src/components/static-html/share-modal.tsx +2 -0
  91. package/src/core/cells/__tests__/document-changes.test.ts +343 -26
  92. package/src/core/cells/document-changes.ts +181 -4
  93. package/src/core/export/hooks.ts +2 -0
  94. package/src/core/export/layout.ts +9 -0
  95. package/src/core/kernel/handlers.ts +7 -16
  96. package/src/core/kernel/state.ts +2 -0
  97. package/src/core/layout/__tests__/layout.test.ts +95 -0
  98. package/src/core/layout/layout.ts +59 -65
  99. package/src/core/layout/state.ts +121 -0
  100. package/src/core/meta/__tests__/code-visibility.test.tsx +28 -0
  101. package/src/core/meta/code-visibility.ts +3 -1
  102. package/src/core/run-app.tsx +6 -2
  103. package/src/core/saving/__tests__/save-component.test.ts +31 -1
  104. package/src/core/saving/save-component.tsx +39 -29
  105. package/src/core/saving/state.ts +1 -1
  106. package/src/core/static/download-html.ts +2 -0
  107. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +47 -14
  108. package/src/core/websocket/useMarimoKernelConnection.tsx +7 -2
  109. package/src/mount.tsx +24 -6
  110. package/dist/assets/ai-model-dropdown-CfWMIzjl.js +0 -3
  111. package/dist/assets/app-config-button-ii-Hj5CZ.js +0 -1
  112. package/dist/assets/cell-editor-BVb6iKbw.js +0 -21
  113. package/dist/assets/edit-page-RuyN164g.js +0 -9
  114. package/dist/assets/index-ChbtcNW2.js +0 -29
  115. package/dist/assets/layout-Uv1ZP5XB.js +0 -9
  116. package/dist/assets/panel-accordion-state-BLU7OiMD.js +0 -1
  117. package/dist/assets/panels-B3Y6fue9.js +0 -4
  118. package/dist/assets/readonly-python-code-D2HXwAfT.js +0 -1
  119. package/dist/assets/reveal-component-BN1C8zFu.js +0 -1069
  120. package/dist/assets/run-page-ByVvsH9G.js +0 -1
  121. package/dist/assets/session-panel-CdCKWAOf.js +0 -1
  122. package/dist/assets/skeleton-DirOIQrj.js +0 -1
  123. package/dist/assets/state-C9O-2hQL.js +0 -3
  124. package/dist/assets/state-DyxPdcEa.js +0 -1
  125. package/dist/assets/types-CoHi_MQq.js +0 -1
  126. package/dist/assets/useAddCell-DqvY2ulx.js +0 -1
  127. package/dist/assets/useBoolean-DWBCpKfT.js +0 -1
  128. package/dist/assets/useNotebookActions-Dxp4gTEa.js +0 -10
@@ -1,4 +1,4 @@
1
- import{Bn as e,Ga as t,Ka as n,Wa as r,b as i,rt as a}from"./cells-C6lBv8kg.js";import{i as o}from"./strings-CpYReX2Q.js";function s(e){if(t(e.mimetype)){if(!Array.isArray(e.data))return null;let t=e.data.filter(e=>!e.type.includes(`ancestor`));return t.length===0?null:{errorData:t}}return n(e.mimetype)?typeof e.data!=`string`||e.data.length===0?null:{errorData:[],tracebackHtml:e.data}:null}function c(e){return e.some(e=>`traceback`in e&&e.traceback)}function l(e){let t=e?.find(e=>n(e.mimetype));if(!(!t||typeof t.data!=`string`||t.data.length===0))return t.data}function u(e,t){if(e.tracebackHtml)return e.tracebackHtml;if(!c(e.errorData))return l(t)}function d(t){let{cellIds:n,cellRuntime:a,cellData:o}=t.get(i),c=[];for(let[t,i]of n.inOrderIds.entries()){let n=a[i],l=n.output;if(!l||!r(l.mimetype))continue;let d=s(l);if(!d)continue;let f=e(o[i].name,t),p=o[i].lastCodeRun??o[i].code;c.push({cellId:i,cellName:f,cellCode:p,errorData:d.errorData,tracebackHtml:u(d,n.consoleOutputs)})}return c}function f(e){return e.type===`setup-refs`?`The setup cell cannot have references`:e.type===`cycle`?`This cell is in a cycle`:e.type===`multiple-defs`?`The variable '${e.name}' was defined by another cell`:e.type===`import-star`||e.type===`ancestor-stopped`||e.type===`ancestor-prevented`||e.type===`exception`||e.type===`strict-exception`?e.msg:e.type===`interruption`?`This cell was interrupted and needs to be re-run`:e.type===`syntax`||e.type===`unknown`||e.type===`sql-error`?e.msg:e.type===`internal`?e.msg||`An internal error occurred`:(o(e),`Unknown error`)}function p(e){let t=f(e);return`traceback`in e&&e.traceback&&(t+=`\n\nTraceback:\n${a(e.traceback)}`),t}function m(e){let t=[e.cellName];return e.tracebackHtml&&t.push(a(e.tracebackHtml)),e.errorData.length>0&&t.push(e.errorData.map(p).join(`
1
+ import{Hn as e,Ja as t,Ka as n,b as r,qa as i,rt as a}from"./cells-yuYDzbAy.js";import{i as o}from"./strings-CpYReX2Q.js";function s(e){if(i(e.mimetype)){if(!Array.isArray(e.data))return null;let t=e.data.filter(e=>!e.type.includes(`ancestor`));return t.length===0?null:{errorData:t}}return t(e.mimetype)?typeof e.data!=`string`||e.data.length===0?null:{errorData:[],tracebackHtml:e.data}:null}function c(e){return e.some(e=>`traceback`in e&&e.traceback)}function l(e){let n=e?.find(e=>t(e.mimetype));if(!(!n||typeof n.data!=`string`||n.data.length===0))return n.data}function u(e,t){if(e.tracebackHtml)return e.tracebackHtml;if(!c(e.errorData))return l(t)}function d(t){let{cellIds:i,cellRuntime:a,cellData:o}=t.get(r),c=[];for(let[t,r]of i.inOrderIds.entries()){let i=a[r],l=i.output;if(!l||!n(l.mimetype))continue;let d=s(l);if(!d)continue;let f=e(o[r].name,t),p=o[r].lastCodeRun??o[r].code;c.push({cellId:r,cellName:f,cellCode:p,errorData:d.errorData,tracebackHtml:u(d,i.consoleOutputs)})}return c}function f(e){return e.type===`setup-refs`?`The setup cell cannot have references`:e.type===`cycle`?`This cell is in a cycle`:e.type===`multiple-defs`?`The variable '${e.name}' was defined by another cell`:e.type===`import-star`||e.type===`ancestor-stopped`||e.type===`ancestor-prevented`||e.type===`exception`||e.type===`strict-exception`?e.msg:e.type===`interruption`?`This cell was interrupted and needs to be re-run`:e.type===`syntax`||e.type===`unknown`||e.type===`sql-error`?e.msg:e.type===`internal`?e.msg||`An internal error occurred`:(o(e),`Unknown error`)}function p(e){let t=f(e);return`traceback`in e&&e.traceback&&(t+=`\n\nTraceback:\n${a(e.traceback)}`),t}function m(e){let t=[e.cellName];return e.tracebackHtml&&t.push(a(e.tracebackHtml)),e.errorData.length>0&&t.push(e.errorData.map(p).join(`
2
2
 
3
3
  `)),t.join(`
4
4
 
@@ -1 +1 @@
1
- import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-CBDbhulC.js";import{A as t}from"./cells-C6lBv8kg.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./createLucideIcon-B7HeEoG2.js";import{t as a}from"./MarimoErrorOutput-C0vk393J.js";import{n as o}from"./cell-link-DCOAqVkE.js";import{t as s}from"./empty-state-kWyb5dCS.js";var c=i(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),l=n();e();var u=r(),d=()=>{let e=(0,l.c)(5),n=t();if(n.length===0){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,u.jsx)(s,{title:`No errors!`,icon:(0,u.jsx)(c,{})}),e[0]=t):t=e[0],t}let r;e[1]===n?r=e[2]:(r=n.map(f),e[1]=n,e[2]=r);let i;return e[3]===r?i=e[4]:(i=(0,u.jsx)(`div`,{className:`flex flex-col h-full overflow-auto`,children:r}),e[3]=r,e[4]=i),i};function f(e){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`text-xs font-mono font-semibold bg-muted border-y px-2 py-1`,children:(0,u.jsx)(o,{cellId:e.cellId})}),(0,u.jsx)(`div`,{className:`px-2`,children:(0,u.jsx)(a,{errors:e.output.data,cellId:e.cellId},e.cellId)},e.cellId)]},e.cellId)}export{d as default};
1
+ import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-CBDbhulC.js";import{A as t}from"./cells-yuYDzbAy.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./createLucideIcon-B7HeEoG2.js";import{t as a}from"./MarimoErrorOutput-DCAezqcJ.js";import{n as o}from"./cell-link-hHrWcozB.js";import{t as s}from"./empty-state-kWyb5dCS.js";var c=i(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),l=n();e();var u=r(),d=()=>{let e=(0,l.c)(5),n=t();if(n.length===0){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,u.jsx)(s,{title:`No errors!`,icon:(0,u.jsx)(c,{})}),e[0]=t):t=e[0],t}let r;e[1]===n?r=e[2]:(r=n.map(f),e[1]=n,e[2]=r);let i;return e[3]===r?i=e[4]:(i=(0,u.jsx)(`div`,{className:`flex flex-col h-full overflow-auto`,children:r}),e[3]=r,e[4]=i),i};function f(e){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`text-xs font-mono font-semibold bg-muted border-y px-2 py-1`,children:(0,u.jsx)(o,{cellId:e.cellId})}),(0,u.jsx)(`div`,{className:`px-2`,children:(0,u.jsx)(a,{errors:e.output.data,cellId:e.cellId},e.cellId)},e.cellId)]},e.cellId)}export{d as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i}from"./useEvent-xfs0Sn4r.js";import{t as a}from"./react-CBDbhulC.js";import{At as o,Ct as s,D as c,Dn as l,Dt as u,Et as d,Ht as f,Ot as p,Tt as m,_o as h,bn as g,gn as _,ia as v,kt as y,ni as b,wt as x,xn as S,xo as C}from"./cells-C6lBv8kg.js";import{t as w}from"./compiler-runtime-CYIjoINj.js";import{g as T,p as E}from"./utils-CUZQNAWJ.js";import{g as D}from"./useEventListener-D27Dii_l.js";import{t as O}from"./invariant-Ci2dTZ72.js";import{N as k,r as A}from"./config-DaNyNpZL.js";import{t as j}from"./cn-ldLVeaqm.js";import{t as M}from"./jsx-runtime-B74pBk57.js";import{r as N}from"./config-Cl3eMWxb.js";import{o as P}from"./alert-dialog-BVi_GyOB.js";import{a as F,c as I,p as L,r as R,t as z}from"./dropdown-menu-CqNabM1f.js";import{Pt as B,a as V,h as H,i as U,o as W,s as G}from"./JsonOutput-B7sDhGzR.js";import{c as K,n as ee,r as te}from"./download-Cqjqrhzo.js";import{t as q}from"./tooltip-D7dq6bnc.js";import{t as J}from"./button-Btj6GXNy.js";import{Tt as ne}from"./dist-PIe1xcZo.js";import{n as Y,r as re,t as ie}from"./requests-C6_IaFh7.js";import{t as X}from"./createLucideIcon-B7HeEoG2.js";import{t as ae}from"./arrow-left-DrqK6gPp.js";import{n as oe}from"./LazyAnyLanguageCodeMirror-zSwE3dvU.js";import{r as se}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as ce,i as le,n as ue,r as de,t as fe}from"./tree-actions-CGkbUSfG.js";import{a as pe}from"./markdown-renderer-B-uA_6mP.js";import{u as me}from"./toDate-hGYJX0Ha.js";import{t as he}from"./copy-BMXKNElG.js";import{t as ge}from"./external-link-Bp3BxyRA.js";import{a as _e,i as ve,n as ye,r as be,t as xe}from"./file-icons-uUY_hGYm.js";import{t as Se}from"./file-DF8n85RA.js";import{n as Ce,t as we}from"./components-ib4asSo7.js";import{b as Te}from"./write-secret-modal-lNU_7c2x.js";import{n as Ee,t as De}from"./spinner-Ck-Hgfvj.js";import{a as Oe,c as ke,d as Ae,f as je,i as Me,l as Ne,n as Pe,r as Fe,t as Ie,u as Le}from"./file-name-input-DWUKg4LS.js";import{t as Re}from"./refresh-cw-Bf-rx_aV.js";import{t as ze}from"./save-BybsbOKz.js";import{t as Be}from"./triangle-alert-MihykDYG.js";import{n as Ve,t as He}from"./es-BuMFDpR4.js";import{t as Ue}from"./use-toast-DpWHUGuF.js";import{n as We,t as Ge}from"./paths-zcL04qUW.js";import{t as Ke}from"./context-Do8M9TDF.js";import{n as qe}from"./useAsyncData-Buhk-UgR.js";import{n as Je}from"./copy-Cg05mM3C.js";import{t as Ye}from"./copy-icon-CRxVZTJ9.js";import{t as Xe}from"./blob-CYM8xQsK.js";import{a as Ze}from"./errors-DzO-nXy-.js";import{n as Qe,t as $e}from"./alert-dmKwNsrp.js";import{n as et}from"./error-banner-BYN8YUMe.js";import{a as tt}from"./renderShortcut-CS4ccH3x.js";import{t as nt}from"./bundle.esm-DzY74mzC.js";import{t as rt}from"./useAddCell-DqvY2ulx.js";import{n as it}from"./pathUtils-Cryrlpma.js";import{n as at}from"./semaphore-BjoL5P0h.js";import{t as ot}from"./empty-state-kWyb5dCS.js";import{t as st}from"./formatting-BJlT1s_3.js";import{a as ct,i as lt,n as ut,o as dt,r as ft,s as pt,t as mt}from"./components-D8-ffQsq.js";import{n as ht,t as gt}from"./marimo-icons-C3KxMV9A.js";import{t as _t}from"./links-DPh7yoP-.js";import{n as vt}from"./panel-accordion-state-BLU7OiMD.js";var yt=X(`book-plus`,[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),bt=X(`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`}]]),xt=X(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),St=X(`file-symlink`,[[`path`,{d:`M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`huwfnr`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}]]),Ct=X(`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`}]]),wt=X(`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`}]]),Tt=X(`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`}]]),Et=X(`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`}]]),Z=e(a(),1),Q=w(),$=M(),Dt=e=>{let t=(0,Q.c)(17),{filename:n,filenameIcon:r,onBack:i,onRefresh:a,onDownload:o,actions:s}=e,c;t[0]===i?c=t[1]:(c=i&&(0,$.jsx)(q,{content:`Back to file list`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:i,children:(0,$.jsx)(ae,{className:`h-4 w-4`})})}),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=n?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate`,children:[r,n]}):(0,$.jsx)(`span`,{className:`flex-1`}),t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]===a?u=t[6]:(u=a&&(0,$.jsx)(q,{content:`Refresh`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:a,children:(0,$.jsx)(Re,{className:`h-3.5 w-3.5`})})}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o&&(0,$.jsx)(q,{content:`Download`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:o,children:(0,$.jsx)(B,{className:`h-3.5 w-3.5`})})}),t[7]=o,t[8]=d);let f;t[9]!==s||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[u,s,d]}),t[9]=s,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center shrink-0 border-b px-1 gap-1`,children:[c,l,f]}),t[13]=c,t[14]=l,t[15]=f,t[16]=p):p=t[16],p},Ot=new Set([`http`,`file`,`in-memory`]);function kt(e){return JSON.stringify(e).slice(1,-1)}var At=new Set([`datasets`,`spaces`,`buckets`]);function jt(e){let t=e.split(`/`).filter(Boolean);return t[0]===`datasets`&&t.length>=4?{repoType:`dataset`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t[0]===`spaces`&&t.length>=4?{repoType:`space`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t.length>=3&&!At.has(t[0])?{repoType:`model`,repoId:`${t[0]}/${t[1]}`,filename:t.slice(2).join(`/`)}:null}function Mt(e){return`from huggingface_hub import hf_hub_download\n\nlocal_path = hf_hub_download(\n repo_id="${kt(e.repoId)}",\n filename="${kt(e.filename)}",\n repo_type="${kt(e.repoType)}",\n)`}var Nt=[{id:`read-file`,label:`Insert read snippet`,icon:yt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=kt(e.entry.path);if(e.backendType===`huggingface`){let t=jt(e.entry.path);return t?`${Mt(t)}\n\nwith open(local_path, "rb") as f:\n _data = f.read()\n_data`:null}return e.backendType===`obstore`?`_data = ${e.variableName}.get("${t}").bytes()\n_data`:`_data = ${e.variableName}.cat_file("${t}")\n_data`}},{id:`download-file`,label:`Insert download snippet`,icon:St,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=kt(e.entry.path);if(e.backendType===`huggingface`){let t=jt(e.entry.path);return t?`${Mt(t)}\nlocal_path`:null}if(e.backendType===`obstore`)return Ot.has(e.protocol)?null:`from datetime import timedelta\nfrom obstore import sign\n\nsigned_url = sign(\n ${e.variableName}, "GET", "${t}",\n expires_in=timedelta(hours=1),\n)\nsigned_url`;let n=kt(e.entry.path.split(`/`).pop()||`download`);return`${e.variableName}.get("${t}", "${n}")`}}],Pt=104857600;function Ft(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}var It=e=>{let t=(0,Q.c)(83),{entry:n,namespace:r,protocol:i,backendType:a,onBack:s}=e,{locale:c}=Ke(),l=rt(),u;t[0]===n.path?u=t[1]:(u=Ft(n.path),t[0]=n.path,t[1]=u);let d=u,f=n.mimeType||`text/plain`,p;t[2]===f?p=t[3]:(p=G(f),t[2]=f,t[3]=p);let m=p,h=m&&n.size>Pt&&n.size>0,g,_;t[4]!==n.path||t[5]!==m||t[6]!==r||t[7]!==h?(g=async()=>{if(h)return null;let e=await o.request({namespace:r,path:n.path,preview:!m});if(e.error)throw Error(e.error);if(!e.url)throw Error(`No URL returned`);if(m)return{type:`media`,url:e.url};let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to fetch preview: ${t.statusText}`);return{type:`text`,content:await t.text()}},_=[r,n.path,m,h],t[4]=n.path,t[5]=m,t[6]=r,t[7]=h,t[8]=g,t[9]=_):(g=t[8],_=t[9]);let{data:v,isPending:y,error:b,refetch:x}=qe(g,_),S;t[10]!==n.path||t[11]!==d||t[12]!==r?(S=async()=>{try{let e=await o.request({namespace:r,path:n.path});if(e.error){Ue({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&te(e.url,e.filename??d)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),Ue({title:`Download failed`,description:String(t),variant:`danger`})}},t[10]=n.path,t[11]=d,t[12]=r,t[13]=S):S=t[13];let C=S,w;t[14]!==l||t[15]!==a||t[16]!==n||t[17]!==r||t[18]!==i?(w=Nt.map(e=>{let t=e.getCode({variableName:r,protocol:i,entry:n,backendType:a});if(t===null)return null;let o=e.icon;return(0,$.jsx)(q,{content:e.label,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:()=>l(t),"aria-label":e.label,children:(0,$.jsx)(o,{className:`h-3.5 w-3.5`})})},e.id)}),t[14]=l,t[15]=a,t[16]=n,t[17]=r,t[18]=i,t[19]=w):w=t[19];let T=w,E;t[20]===d?E=t[21]:(E=ve(d),t[20]=d,t[21]=E);let O;t[22]!==C||t[23]!==d||t[24]!==s||t[25]!==T||t[26]!==E?(O=(0,$.jsx)(Dt,{filename:d,filenameIcon:E,onBack:s,onDownload:C,actions:T}),t[22]=C,t[23]=d,t[24]=s,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k=O,A;t[28]!==n.lastModified||t[29]!==n.path||t[30]!==n.size||t[31]!==c||t[32]!==f?(A=e=>{let{includeMime:t}=e,r=t!==void 0&&t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),(0,$.jsxs)(`div`,{className:`truncate flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[11px]`,children:n.path}),(0,$.jsx)(Ye,{value:n.path,className:`h-3 w-3`})]}),r&&(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),r&&(0,$.jsx)(`span`,{children:f}),n.size>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:st(n.size,c)})]}),n.lastModified!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Modified`}),(0,$.jsx)(`span`,{children:new Date(n.lastModified*1e3).toLocaleString()})]})]})},t[28]=n.lastModified,t[29]=n.path,t[30]=n.size,t[31]=c,t[32]=f,t[33]=A):A=t[33];let j=A;if(h){let e;t[34]===j?e=t[35]:(e=j({includeMime:!0}),t[34]=j,t[35]=e);let r;t[36]!==n.size||t[37]!==c?(r=st(n.size,c),t[36]=n.size,t[37]=c,t[38]=r):r=t[38];let i;t[39]===r?i=t[40]:(i=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-muted-foreground italic`,children:[`File is too large to preview (`,r,`).`]}),t[39]=r,t[40]=i);let a;return t[41]!==k||t[42]!==e||t[43]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[41]=k,t[42]=e,t[43]=i,t[44]=a):a=t[44],a}if(y){let e;t[45]===j?e=t[46]:(e=j({}),t[45]=j,t[46]=e);let n;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24`,children:[(0,$.jsx)(Ee,{className:`h-4 w-4 animate-spin`}),`Loading preview...`]}),t[47]=n):n=t[47];let r;return t[48]!==k||t[49]!==e?(r=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n]}),t[48]=k,t[49]=e,t[50]=r):r=t[50],r}if(b){let e;t[51]===j?e=t[52]:(e=j({includeMime:!0}),t[51]=j,t[52]=e);let n;t[53]===b.message?n=t[54]:(n=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-destructive`,children:[`Failed to load preview: `,b.message]}),t[53]=b.message,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Re,{className:`h-3 w-3 mr-1`}),t[55]=r):r=t[55];let i;t[56]===x?i=t[57]:(i=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:(0,$.jsxs)(J,{variant:`secondary`,size:`xs`,onClick:x,children:[r,`Retry`]})}),t[56]=x,t[57]=i);let a;return t[58]!==k||t[59]!==e||t[60]!==n||t[61]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n,i]}),t[58]=k,t[59]=e,t[60]=n,t[61]=i,t[62]=a):a=t[62],a}if(v){let e;t[63]===j?e=t[64]:(e=j({}),t[63]=j,t[64]=e);let n=v.type===`text`?v.content:void 0,r;t[65]!==v.type||t[66]!==v.url?(r=v.type===`media`?{url:v.url}:void 0,t[65]=v.type,t[66]=v.url,t[67]=r):r=t[67];let i;t[68]!==f||t[69]!==d||t[70]!==n||t[71]!==r?(i=(0,$.jsx)(U,{mimeType:f,filename:d,contents:n,mediaSource:r}),t[68]=f,t[69]=d,t[70]=n,t[71]=r,t[72]=i):i=t[72];let a;return t[73]!==k||t[74]!==e||t[75]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[73]=k,t[74]=e,t[75]=i,t[76]=a):a=t[76],a}let M;t[77]===j?M=t[78]:(M=j({includeMime:!0}),t[77]=j,t[78]=M);let N;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(`div`,{className:`p-4 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Se,{className:`h-4 w-4`}),`Preview not available for this file type.`]}),t[79]=N):N=t[79];let P;return t[80]!==k||t[81]!==M?(P=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,M,N]}),t[80]=k,t[81]=M,t[82]=P):P=t[82],P},Lt=16;function Rt(e){return{paddingLeft:e*Lt}}function zt(e,t){return new Date(e*1e3).toLocaleDateString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Bt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}function Vt(e){return e.endsWith(`/`)?e:`${e}/`}function Ht(e,t){let n=e.metadata?.id;return typeof n==`string`&&n.length>0?n:`${e.path}::${t}`}function Ut(e,{namespace:t,searchValue:n,entriesByPath:r}){let i=n.trim().toLowerCase(),a=e.path.toLowerCase();if(Bt(e.path).toLowerCase().includes(i)||a.includes(i))return!0;if(e.kind===`directory`){let i=r.get(y(t,Vt(e.path)));if(i)return i.some(e=>Ut(e,{namespace:t,searchValue:n,entriesByPath:r}))}return!1}function Wt(e,t){return t.searchValue.trim()?e.filter(e=>Ut(e,t)):e}var Gt=5;function Kt(e){return{query:e,status:`idle`}}function qt(e){return e.status===`idle`||e.status===`error`||e.status===`capped`}function Jt(e,t,n){return t.get(e)===void 0||n.get(e)?.nextPageToken!=null}function Yt({hasSearch:e,hasLoadedMatches:t,isPending:n,remoteSearch:r,searchKey:i,entriesByPath:a,pageMetadataByPath:o}){return!e||t||n||!qt(r)?!1:Jt(i,a,o)}function Xt(e){let t=e.trim(),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n+1)}function Zt(e,t){let n=t.trim().toLowerCase();return!n||e.path.toLowerCase().includes(n)||Bt(e.path).toLowerCase().includes(n)}var Qt=e=>{let t=(0,Q.c)(15),{depth:n,isLoading:r,error:i,onLoadMore:a}=e,o;t[0]===n?o=t[1]:(o=Rt(n),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,$.jsx)(Ee,{className:`h-3 w-3 mr-1 animate-spin`}),t[2]=r,t[3]=s);let c=r?`Loading...`:`Load more`,l;t[4]!==r||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(J,{variant:`text`,size:`xs`,className:`h-6 px-0 hover:text-blue-600`,disabled:r,onClick:a,children:[s,c]}),t[4]=r,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=i&&(0,$.jsxs)(`span`,{className:`ml-2 text-destructive`,children:[`Failed to load: `,i.message]}),t[9]=i,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`div`,{className:`py-px text-xs`,style:o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d},$t=e=>{let t=(0,Q.c)(44),{namespace:n,protocol:r,rootPath:i,backendType:a,prefix:o,depth:s,locale:c,searchValue:l,onOpenFile:d}=e,{entriesByPath:f}=m(),{entries:p,isPending:h,error:g,hasMore:_,loadMore:v,isLoadingMore:y,loadMoreError:b}=u(n,o);if(h){let e;t[0]===s?e=t[1]:(e=Rt(s),t[0]=s,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Ee,{className:`h-3 w-3 animate-spin`}),t[2]=n):n=t[2];let r;return t[3]===e?r=t[4]:(r=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 py-1 text-xs text-muted-foreground`,style:e,children:[n,`Loading...`]}),t[3]=e,t[4]=r),r}if(g){let e;t[5]===s?e=t[6]:(e=Rt(s),t[5]=s,t[6]=e);let n;return t[7]!==g.message||t[8]!==e?(n=(0,$.jsxs)(`div`,{className:`py-1 text-xs text-destructive`,style:e,children:[`Failed to load: `,g.message]}),t[7]=g.message,t[8]=e,t[9]=n):n=t[9],n}if(p.length===0){let e;t[10]===s?e=t[11]:(e=Rt(s),t[10]=s,t[11]=e);let n;return t[12]===e?n=t[13]:(n=(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:e,children:`Empty`}),t[12]=e,t[13]=n),n}let x;if(t[14]!==a||t[15]!==p||t[16]!==s||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==d||t[21]!==r||t[22]!==i||t[23]!==l){let e=Wt(p,{namespace:n,searchValue:l,entriesByPath:f}),o;t[25]!==a||t[26]!==p||t[27]!==s||t[28]!==c||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==i||t[33]!==l?(o=e=>{let t=Ht(e,p.indexOf(e));return(0,$.jsx)(en,{rowKey:t,entry:e,namespace:n,protocol:r,rootPath:i,backendType:a,depth:s,locale:c,searchValue:l,onOpenFile:d},t)},t[25]=a,t[26]=p,t[27]=s,t[28]=c,t[29]=n,t[30]=d,t[31]=r,t[32]=i,t[33]=l,t[34]=o):o=t[34],x=e.map(o),t[14]=a,t[15]=p,t[16]=s,t[17]=f,t[18]=c,t[19]=n,t[20]=d,t[21]=r,t[22]=i,t[23]=l,t[24]=x}else x=t[24];let S;t[35]!==s||t[36]!==_||t[37]!==y||t[38]!==v||t[39]!==b?(S=_&&(0,$.jsx)(Qt,{depth:s,isLoading:y,error:b,onLoadMore:v}),t[35]=s,t[36]=_,t[37]=y,t[38]=v,t[39]=b,t[40]=S):S=t[40];let C;return t[41]!==x||t[42]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[41]=x,t[42]=S,t[43]=C):C=t[43],C},en=e=>{let t=(0,Q.c)(115),{entry:n,rowKey:r,namespace:i,protocol:a,rootPath:s,backendType:c,depth:l,locale:u,searchValue:d,onOpenFile:f}=e,[p,h]=(0,Z.useState)(!1),{entriesByPath:g}=m(),_=rt(),v=n.kind===`directory`,b,x,C,w,T,E,O,k,A,M,N;if(t[0]!==c||t[1]!==l||t[2]!==g||t[3]!==n||t[4]!==v||t[5]!==p||t[6]!==i||t[7]!==f||t[8]!==a||t[9]!==r||t[10]!==d){w=Bt(n.path);let e;t[22]===d?e=t[23]:(e=d.trim(),t[22]=d,t[23]=e);let s=!!e;T=v&&s&&w.toLowerCase().includes(d.trim().toLowerCase());let u;t[24]!==g||t[25]!==n.path||t[26]!==s||t[27]!==v||t[28]!==i||t[29]!==d?(u=v&&s&&!!g.get(y(i,Vt(n.path)))?.some(e=>Ut(e,{namespace:i,searchValue:d,entriesByPath:g})),t[24]=g,t[25]=n.path,t[26]=s,t[27]=v,t[28]=i,t[29]=d,t[30]=u):u=t[30],x=p||u;let m;t[31]!==n.path||t[32]!==i?(m=async()=>{try{let e=await o.request({namespace:i,path:n.path});if(e.error){Ue({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&te(e.url,e.filename??`download`)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),Ue({title:`Download failed`,description:String(t),variant:`danger`})}},t[31]=n.path,t[32]=i,t[33]=m):m=t[33],C=m,b=S;let _=v&&`font-medium`;t[34]===_?E=t[35]:(E=j(`text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5`,_),t[34]=_,t[35]=E),t[36]===l?O=t[37]:(O=Rt(l),t[36]=l,t[37]=O),k=`${i}:${r}`,t[38]!==c||t[39]!==x||t[40]!==n||t[41]!==v||t[42]!==i||t[43]!==f||t[44]!==a?(A=()=>{v?h(!x):f({entry:n,namespace:i,protocol:a,backendType:c})},t[38]=c,t[39]=x,t[40]=n,t[41]=v,t[42]=i,t[43]=f,t[44]=a,t[45]=A):A=t[45],t[46]!==x||t[47]!==v?(M=v?(0,$.jsx)(le,{isExpanded:x,className:`h-3 w-3`}):(0,$.jsx)(`span`,{className:`w-3 shrink-0`}),t[46]=x,t[47]=v,t[48]=M):M=t[48],N=v?(0,$.jsx)(_e,{className:j(`h-3.5 w-3.5 shrink-0`,ye.directory)}):ve(w),t[0]=c,t[1]=l,t[2]=g,t[3]=n,t[4]=v,t[5]=p,t[6]=i,t[7]=f,t[8]=a,t[9]=r,t[10]=d,t[11]=b,t[12]=x,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=O,t[18]=k,t[19]=A,t[20]=M,t[21]=N}else b=t[11],x=t[12],C=t[13],w=t[14],T=t[15],E=t[16],O=t[17],k=t[18],A=t[19],M=t[20],N=t[21];let P;t[49]===w?P=t[50]:(P=(0,$.jsx)(`span`,{className:`truncate flex-1 text-left`,children:w}),t[49]=w,t[50]=P);let V;t[51]!==n.size||t[52]!==u?(V=n.size>0&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums`,children:st(n.size,u)}),t[51]=n.size,t[52]=u,t[53]=V):V=t[53];let H;t[54]!==n.lastModified||t[55]!==u?(H=n.lastModified!=null&&(0,$.jsx)(q,{content:`Last modified: ${new Date(n.lastModified*1e3).toLocaleString()}`,children:(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap`,children:zt(n.lastModified,u)})}),t[54]=n.lastModified,t[55]=u,t[56]=H):H=t[56];let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(ue,{iconClassName:`h-3 w-3`,onClick:rn})}),t[57]=U):U=t[57];let W;t[58]!==c||t[59]!==n||t[60]!==v||t[61]!==i||t[62]!==f||t[63]!==a?(W=!v&&(0,$.jsxs)(F,{onSelect:()=>f({entry:n,namespace:i,protocol:a,backendType:c}),children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`View`]}),t[58]=c,t[59]=n,t[60]=v,t[61]=i,t[62]=f,t[63]=a,t[64]=W):W=t[64];let G;t[65]===n.path?G=t[66]:(G=async()=>{await Je(n.path),Ue({title:`Copied to clipboard`})},t[65]=n.path,t[66]=G);let K;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(he,{className:fe}),t[67]=K):K=t[67];let ee;t[68]===G?ee=t[69]:(ee=(0,$.jsxs)(F,{onSelect:G,children:[K,`Copy path`]}),t[68]=G,t[69]=ee);let J;t[70]!==C||t[71]!==v?(J=!v&&(0,$.jsxs)(F,{onSelect:()=>C(),children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[70]=C,t[71]=v,t[72]=J):J=t[72];let ne;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(I,{}),t[73]=ne):ne=t[73];let Y;t[74]!==_||t[75]!==c||t[76]!==n||t[77]!==i||t[78]!==a?(Y=Nt.map(e=>{let t=e.getCode({variableName:i,protocol:a,entry:n,backendType:c});if(t===null)return null;let r=e.icon;return(0,$.jsxs)(F,{onSelect:()=>_(t),children:[(0,$.jsx)(r,{className:fe}),e.label]},e.id)}),t[74]=_,t[75]=c,t[76]=n,t[77]=i,t[78]=a,t[79]=Y):Y=t[79];let re;t[80]!==W||t[81]!==ee||t[82]!==J||t[83]!==Y?(re=(0,$.jsxs)(z,{children:[U,(0,$.jsxs)(R,{align:`end`,onClick:an,onCloseAutoFocus:on,children:[W,ee,J,ne,Y]})]}),t[80]=W,t[81]=ee,t[82]=J,t[83]=Y,t[84]=re):re=t[84];let ie;t[85]!==re||t[86]!==V||t[87]!==H?(ie=(0,$.jsxs)(`div`,{className:`flex items-center`,children:[V,H,re]}),t[85]=re,t[86]=V,t[87]=H,t[88]=ie):ie=t[88];let X;t[89]!==b||t[90]!==E||t[91]!==ie||t[92]!==O||t[93]!==k||t[94]!==A||t[95]!==M||t[96]!==N||t[97]!==P?(X=(0,$.jsxs)(b,{className:E,style:O,value:k,onSelect:A,children:[M,N,P,ie]}),t[89]=b,t[90]=E,t[91]=ie,t[92]=O,t[93]=k,t[94]=A,t[95]=M,t[96]=N,t[97]=P,t[98]=X):X=t[98];let ae;t[99]!==c||t[100]!==l||t[101]!==x||t[102]!==n.path||t[103]!==v||t[104]!==u||t[105]!==i||t[106]!==f||t[107]!==a||t[108]!==s||t[109]!==d||t[110]!==T?(ae=v&&x&&(0,$.jsx)($t,{namespace:i,protocol:a,rootPath:s,backendType:c,prefix:Vt(n.path),depth:l+1,locale:u,searchValue:T?``:d,onOpenFile:f}),t[99]=c,t[100]=l,t[101]=x,t[102]=n.path,t[103]=v,t[104]=u,t[105]=i,t[106]=f,t[107]=a,t[108]=s,t[109]=d,t[110]=T,t[111]=ae):ae=t[111];let oe;return t[112]!==X||t[113]!==ae?(oe=(0,$.jsxs)($.Fragment,{children:[X,ae]}),t[112]=X,t[113]=ae,t[114]=oe):oe=t[114],oe},tn=e=>{let t=(0,Q.c)(66),{namespace:n,locale:r,searchValue:i,remoteSearch:a,onContinueRemoteSearch:o,onOpenFile:s}=e,[c,l]=(0,Z.useState)(!0),{entriesByPath:f,pageMetadataByPath:p}=m(),{clearNamespaceCache:h}=d(),g=n.name??n.displayName,{entries:_,isPending:v,error:b,hasMore:x,loadMore:C,isLoadingMore:w,loadMoreError:T,refetch:E}=u(g),D;t[0]!==h||t[1]!==g||t[2]!==E?(D=e=>{e.stopPropagation(),h(g),E()},t[0]=h,t[1]=g,t[2]=E,t[3]=D):D=t[3];let O=D,k=v?n.storageEntries:_,A;if(t[4]!==k||t[5]!==f||t[6]!==b||t[7]!==O||t[8]!==x||t[9]!==c||t[10]!==w||t[11]!==v||t[12]!==C||t[13]!==T||t[14]!==r||t[15]!==n.backendType||t[16]!==n.displayName||t[17]!==n.name||t[18]!==n.protocol||t[19]!==n.rootPath||t[20]!==g||t[21]!==o||t[22]!==s||t[23]!==p||t[24]!==a||t[25]!==i){let e=Wt(k,{namespace:g,searchValue:i,entriesByPath:f}),u=Xt(i),d=y(g,u),m=u===``?[]:f.get(d)??[],h=Wt(m,{namespace:g,searchValue:i,entriesByPath:f}),_;t[27]===i?_=t[28]:(_=i.trim(),t[27]=i,t[28]=_);let E=!!_,D=e.length>0||h.length>0,j=u!==``&&Yt({hasSearch:E,hasLoadedMatches:D,isPending:v,remoteSearch:a,searchKey:d,entriesByPath:f,pageMetadataByPath:p}),M=E&&e.length===0,N;bb0:{if(v&&k.length===0){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ee,{className:`h-3 w-3 animate-spin`}),`Loading...`]}),t[29]=e):e=t[29],N=e;break bb0}if(a.status===`searching`){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ee,{className:`h-3 w-3 animate-spin`}),`Searching more entries...`]}),t[30]=e):e=t[30],N=e;break bb0}if(a.status===`error`){let e;t[31]===a.error.message?e=t[32]:(e=(0,$.jsxs)(`span`,{className:`text-destructive`,children:[`Search failed: `,a.error.message]}),t[31]=a.error.message,t[32]=e),N=e;break bb0}if(a.status===`capped`){let e;t[33]===o?e=t[34]:(e=(0,$.jsx)(J,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Continue searching`}),t[33]=o,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[35]=n):n=t[35];let r;t[36]===e?r=t[37]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Searched more entries.`,e,n]}),t[36]=e,t[37]=r),N=r;break bb0}if(a.status===`exhausted`&&!D){N=`No matches`;break bb0}if(!E&&!v&&k.length===0){N=`No entries`;break bb0}if(j){let e;t[38]===o?e=t[39]:(e=(0,$.jsx)(J,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Search more entries`}),t[38]=o,t[39]=e);let n;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[40]=n):n=t[40];let r;t[41]===e?r=t[42]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`No loaded matches.`,e,n]}),t[41]=e,t[42]=r),N=r;break bb0}if(E&&!D&&k.length>0){N=`No matches`;break bb0}N=null}let P=N,F;t[43]===c?F=t[44]:(F=()=>l(!c),t[43]=c,t[44]=F);let I;t[45]===c?I=t[46]:(I=(0,$.jsx)(le,{isExpanded:c,className:`h-3 w-3`}),t[45]=c,t[46]=I);let L;t[47]===n.protocol?L=t[48]:(L=(0,$.jsx)(we,{protocol:n.protocol}),t[47]=n.protocol,t[48]=L);let R;t[49]===n.displayName?R=t[50]:(R=(0,$.jsx)(`span`,{children:n.displayName}),t[49]=n.displayName,t[50]=R);let z;t[51]===n.name?z=t[52]:(z=n.name&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-normal`,children:[`(`,(0,$.jsx)(pt,{variableName:n.name}),`)`]}),t[51]=n.name,t[52]=z);let B;t[53]===O?B=t[54]:(B=(0,$.jsx)(de,{onClick:O,tooltip:`Refresh storage connection`,className:`p-0`,iconClassName:`h-3 w-3`}),t[53]=O,t[54]=B);let V=n.rootPath||`(root)`,U;t[55]===V?U=t[56]:(U=(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-normal tabular-nums ml-auto`,children:V}),t[55]=V,t[56]=U);let W;t[57]!==n.name||t[58]!==B||t[59]!==U||t[60]!==F||t[61]!==I||t[62]!==L||t[63]!==R||t[64]!==z?(W=(0,$.jsxs)(S,{value:n.name,onSelect:F,className:`flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none`,children:[I,L,R,z,B,U]}),t[57]=n.name,t[58]=B,t[59]=U,t[60]=F,t[61]=I,t[62]=L,t[63]=R,t[64]=z,t[65]=W):W=t[65],A=(0,$.jsxs)($.Fragment,{children:[W,c&&(0,$.jsxs)($.Fragment,{children:[b&&k.length===0&&(0,$.jsx)(H,{error:b,style:Rt(1),className:`py-1 text-xs h-auto overflow-auto max-h-32 items-start`,showIcon:!1}),!b&&P&&(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:Rt(1),children:P}),e.map(e=>{let t=Ht(e,k.indexOf(e));return(0,$.jsx)(en,{rowKey:t,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:s},t)}),M&&h.map(e=>{let t=Ht(e,m.indexOf(e));return(0,$.jsx)(en,{rowKey:`remote-search:${t}`,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:s},`remote-search:${t}`)}),x&&!j&&(0,$.jsx)(Qt,{depth:1,isLoading:w,error:T,onLoadMore:C})]})]}),t[4]=k,t[5]=f,t[6]=b,t[7]=O,t[8]=x,t[9]=c,t[10]=w,t[11]=v,t[12]=C,t[13]=T,t[14]=r,t[15]=n.backendType,t[16]=n.displayName,t[17]=n.name,t[18]=n.protocol,t[19]=n.rootPath,t[20]=g,t[21]=o,t[22]=s,t[23]=p,t[24]=a,t[25]=i,t[26]=A}else A=t[26];return A},nn=()=>{let e=(0,Q.c)(63),{namespaces:t,entriesByPath:n,pageMetadataByPath:r}=m(),{locale:i}=Ke(),[a,o]=(0,Z.useState)(``),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={},e[0]=s):s=e[0];let[c,u]=(0,Z.useState)(s),[d,f]=(0,Z.useState)(null),h=p(),v;e[1]===a?v=e[2]:(v=a.trim(),e[1]=a,e[2]=v);let b=!!v,x;e[3]===a?x=e[4]:(x=a.trim(),e[3]=a,e[4]=x);let S=x,C;e[5]!==S||e[6]!==c?(C=e=>{let t=c[e];return t?.query===S?t:Kt(S)},e[5]=S,e[6]=c,e[7]=C):C=e[7];let w=C,T;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{u(n=>({...n,[e]:t}))},e[8]=T):T=e[8];let E=T,D;e[9]!==S||e[10]!==n||e[11]!==r||e[12]!==w?(D=e=>{if(!S)return!1;let t=e.name??e.displayName,i=Xt(S);if(i===``||!qt(w(t))||Wt(n.get(y(t,``))??e.storageEntries,{namespace:t,searchValue:S,entriesByPath:n}).length>0)return!1;let a=y(t,i);return Wt(n.get(a)??[],{namespace:t,searchValue:S,entriesByPath:n}).length>0?!1:Jt(a,n,r)},e[9]=S,e[10]=n,e[11]=r,e[12]=w,e[13]=D):D=e[13];let O=D,k;e[14]!==O||e[15]!==S||e[16]!==n||e[17]!==h||e[18]!==r?(k=async e=>{if(!O(e))return;let t=S,i=e.name??e.displayName,a=Xt(t),o=y(i,a),s=n.get(o),c=r.get(o)?.nextPageToken??null,l=s!==void 0;E(i,{query:t,status:`searching`});try{for(let e=0;e<Gt;e++){let e=!l||c!==null,n=[];if(e){let e=await h({namespace:i,prefix:a,pageToken:c,append:l});n=e.entries,c=e.next_page_token??null,l=!0}if((e?n:s??[]).some(e=>Zt(e,t))){E(i,{query:t,status:`found`});return}if(c===null){E(i,{query:t,status:`exhausted`});return}}E(i,{query:t,status:`capped`})}catch(e){let n=e;E(i,{query:t,status:`error`,error:n instanceof Error?n:Error(String(n))})}},e[14]=O,e[15]=S,e[16]=n,e[17]=h,e[18]=r,e[19]=k):k=e[19];let A=k,M;e[20]!==O||e[21]!==A||e[22]!==t?(M=()=>{let e=t.filter(O);for(let t of e)A(t)},e[20]=O,e[21]=A,e[22]=t,e[23]=M):M=e[23];let N=M;if(t.length===0){let t;return e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ot,{title:`No storage connected`,description:(0,$.jsxs)(`span`,{children:[`Create an obstore or fsspec connection in your notebook. See the`,` `,(0,$.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`}),`.`]}),action:(0,$.jsx)(dt,{group:`storage`,label:`Add remote storage`,variant:`outline`,size:`sm`}),icon:(0,$.jsx)(Ce,{className:`h-8 w-8`})}),e[24]=t):t=e[24],t}let P;e[25]===d?P=e[26]:(P=d&&(0,$.jsx)(It,{entry:d.entry,namespace:d.namespace,protocol:d.protocol,backendType:d.backendType,onBack:()=>f(null)}),e[25]=d,e[26]=P);let F=d&&`hidden`,I;e[27]===F?I=e[28]:(I=j(`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin`,F),e[27]=F,e[28]=I);let L;e[29]!==O||e[30]!==N||e[31]!==t?(L=e=>{e.key===`Enter`&&t.some(O)&&(e.preventDefault(),N())},e[29]=O,e[30]=N,e[31]=t,e[32]=L):L=e[32];let R;e[33]!==a||e[34]!==L?(R=(0,$.jsx)(g,{placeholder:`Search entries...`,className:`h-6 m-1`,value:a,onValueChange:o,onKeyDown:L,rootClassName:`flex-1 border-b-0`}),e[33]=a,e[34]=L,e[35]=R):R=e[35];let z;e[36]===b?z=e[37]:(z=b&&(0,$.jsx)(J,{variant:`text`,size:`xs`,className:`float-right border-none px-2 m-0 h-full`,onClick:()=>o(``),children:(0,$.jsx)(se,{className:`h-4 w-4`})}),e[36]=b,e[37]=z);let B,V;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(q,{content:`Search by file name within loaded entries, or by prefix (e.g. 'folder/x') for backend search. Press Enter to fetch more results.`,delayDuration:200,children:(0,$.jsx)(me,{className:`h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2`})}),V=(0,$.jsx)(dt,{group:`storage`,label:`Add remote storage`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0`}),e[38]=B,e[39]=V):(B=e[38],V=e[39]);let H;e[40]!==R||e[41]!==z?(H=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[R,z,B,V]}),e[40]=R,e[41]=z,e[42]=H):H=e[42];let U;if(e[43]!==A||e[44]!==i||e[45]!==t||e[46]!==w||e[47]!==a){let n;e[49]!==A||e[50]!==i||e[51]!==w||e[52]!==a?(n=e=>{let t=e.name??e.displayName;return(0,$.jsx)(tn,{namespace:e,locale:i,searchValue:a,remoteSearch:w(t),onContinueRemoteSearch:()=>void A(e),onOpenFile:f},t)},e[49]=A,e[50]=i,e[51]=w,e[52]=a,e[53]=n):n=e[53],U=t.map(n),e[43]=A,e[44]=i,e[45]=t,e[46]=w,e[47]=a,e[48]=U}else U=e[48];let W;e[54]===U?W=e[55]:(W=(0,$.jsx)(l,{className:`flex flex-col`,children:U}),e[54]=U,e[55]=W);let G;e[56]!==I||e[57]!==H||e[58]!==W?(G=(0,$.jsxs)(_,{className:I,shouldFilter:!1,children:[H,W]}),e[56]=I,e[57]=H,e[58]=W,e[59]=G):G=e[59];let K;return e[60]!==G||e[61]!==P?(K=(0,$.jsxs)(`div`,{className:`h-full flex flex-col`,children:[P,G]}),e[60]=G,e[61]=P,e[62]=K):K=e[62],K};function rn(e){return e.stopPropagation()}function an(e){return e.stopPropagation()}function on(e){return e.preventDefault()}var sn=(0,Z.createContext)(null);function cn(){return(0,Z.useContext)(sn)??void 0}var ln=e=>{let t=(0,Q.c)(3),{children:n}=e,r=Ae(),i;return t[0]!==n||t[1]!==r?(i=(0,$.jsx)(sn.Provider,{value:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},un=e=>{let t=(0,Q.c)(5),{children:n}=e,[r,i]=(0,Z.useState)(null),a;t[0]!==n||t[1]!==r?(a=r&&(0,$.jsx)(je,{backend:Le,options:{rootElement:r},children:(0,$.jsx)(ln,{children:n})}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]===a?o=t[4]:(o=(0,$.jsx)(`div`,{ref:i,className:`contents`,children:a}),t[3]=a,t[4]=o),o};async function dn(e,t){if(!k()){let n=A().formatNavigableHttpURL(`api/files/download`,new URLSearchParams({path:e}));te(n.toString(),t);return}let n=await ie().sendFileDetails({path:e});if(n.isBase64&&n.contents){let e=Xe(pe(n.contents,n.mimeType||`application/octet-stream`));ee(e,t)}else ee(new Blob([n.contents||``],{type:n.mimeType||`application/octet-stream`}),t)}var fn=e=>{let t=(0,Q.c)(21),{file:n,mimeType:r,message:i,onDownload:a}=e,{locale:o}=Ke(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),t[0]=s):s=t[0];let c;t[1]===n.path?c=t[2]:(c=(0,$.jsx)(`span`,{className:`font-mono text-xs break-all`,children:n.path}),t[1]=n.path,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),t[3]=l):l=t[3];let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{children:r}),t[4]=r,t[5]=u);let d;t[6]!==n.size||t[7]!==o?(d=n.size!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:st(n.size,o)})]}),t[6]=n.size,t[7]=o,t[8]=d):d=t[8];let f;t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2`,children:[s,c,l,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(`div`,{className:`mt-4 text-muted-foreground italic`,children:i}),t[13]=i,t[14]=p);let m;t[15]===a?m=t[16]:(m=a&&(0,$.jsxs)(J,{variant:`outline`,size:`sm`,className:`mt-4`,onClick:a,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[15]=a,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`p-4 text-sm`,children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h};function pn(e,t){let n=e||`text/plain`;return G(n)?`media`:t?`unsupported`:n===`text/csv`?`csv`:n.startsWith(`text/`)||n!=="default"&&n in V||e==null?`text`:`unsupported`}var mn=10485760,hn=new Map,gn=({file:e,onOpenNotebook:t})=>{let{sendFileDetails:n,sendUpdateFile:i}=re(),a=r(T),o=r(E),s=r(h),[c,l]=(0,Z.useState)(``),{data:u,isPending:d,error:f,setData:p,refetch:m}=qe(async()=>{let t=await n({path:e.path,maxBytes:mn}),r=pn(t.mimeType,t.isBase64);if(!t.isTooLarge&&r===`text`){let n=t.contents||``;l(hn.get(e.path)??n)}return t},[e.path]),g=async()=>{c!==u?.contents&&await i({path:e.path,contents:c}).then(e=>{e.success&&(p(e=>({...e,contents:c})),l(c))})},_=(0,Z.useRef)(c);if(_.current=c,(0,Z.useEffect)(()=>()=>{if(u?.contents==null||u.isTooLarge||pn(u.mimeType,u.isBase64)!==`text`)return;let t=_.current;t===u.contents?hn.delete(e.path):hn.set(e.path,t)},[e.path,u?.contents,u?.isTooLarge,u?.mimeType,u?.isBase64]),f)return(0,$.jsx)(et,{error:f});if(d||!u)return null;let v=u.mimeType||`text/plain`,y=pn(u.mimeType,u.isBase64),b=y===`text`,x=y===`csv`,S=y===`media`,C=s&&u.file.isMarimoFile&&(e.path===s||e.path.endsWith(`/${s}`)),w=async()=>{await dn(e.path,u.file.name)},D=ne.of([{key:a.getHotkey(`global.save`).key,stopPropagation:!0,run:()=>c!==u.contents&&(g(),!0)}]),O=(0,$.jsx)(Dt,{filename:u.file.name,onRefresh:m,onDownload:o?void 0:w,actions:(0,$.jsxs)($.Fragment,{children:[e.isMarimoFile&&!k()&&(0,$.jsx)(q,{content:`Open notebook`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:e=>t(e),children:(0,$.jsx)(ge,{className:`h-3.5 w-3.5`})})}),b&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{content:`Copy contents to clipboard`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:async()=>{await Je(c)},children:(0,$.jsx)(he,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(q,{content:tt(`global.save`),children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:g,disabled:c===u.contents,children:(0,$.jsx)(ze,{className:`h-3.5 w-3.5`})})})]})]})});if(u.isTooLarge||y===`unsupported`)return(0,$.jsxs)($.Fragment,{children:[O,(0,$.jsx)(fn,{file:u.file,mimeType:v,message:u.isTooLarge?`File is too large to preview.`:`This file type cannot be previewed.`,onDownload:o?void 0:w})]});let A=b&&C&&(0,$.jsxs)($e,{variant:`warning`,className:`rounded-none`,children:[(0,$.jsx)(Be,{className:`h-4 w-4`}),(0,$.jsx)(Qe,{children:`Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution.`})]}),j=S&&u.contents?W({contents:u.contents,mimeType:v,isBase64:u.isBase64??!1}):void 0;return(0,$.jsxs)($.Fragment,{children:[O,A,(0,$.jsx)(U,{mimeType:v,filename:u.file.name,contents:b?c:x?u.contents??void 0:void 0,mediaSource:j,readOnly:!b,onChange:b?l:void 0,extensions:b?[D]:[]})]})},_n=n(e=>{let t=e(Y);return O(t,`no requestClientAtom set`),new ke({listFiles:t.sendListFiles,createFileOrFolder:t.sendCreateFileOrFolder,deleteFileOrFolder:t.sendDeleteFileOrFolder,copyFileOrFolder:t.sendCopyFileOrFolder,renameFileOrFolder:t.sendRenameFileOrFolder})}),vn=n({}),yn=` `,bn={directory:e=>`os.listdir("${e}")`,python:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,json:e=>`with open("${e}", "r") as _f:\n${yn}_data = json.load(_f)\n`,code:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,text:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,image:e=>`mo.image("${e}")`,audio:e=>`mo.audio("${e}")`,video:e=>`mo.video("${e}")`,pdf:e=>`with open("${e}", "rb") as _f:\n${yn}...\n`,zip:e=>`with open("${e}", "rb") as _f:\n${yn}...\n`,data:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,unknown:e=>`with open("${e}", "r") as _f:\n${yn}...\n`},xn=104857600,Sn=5,Cn=`data-file-explorer-directory-path`;function wn(e){let{destinationPath:t,getDestinationLabel:n=e=>e,onUploadStart:r,refreshDestination:i,...a}=e,{sendCreateFileOrFolder:o}=re();return He({multiple:!0,maxSize:xn,...a,onError:e=>{D.error(e),Ue({title:`File upload failed`,description:e.message,variant:`danger`})},onDropRejected:e=>{Ue({title:`File upload failed`,description:(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,$.jsxs)(`div`,{children:[e.file.name,` (`,e.errors.map(e=>e.message).join(`, `),`)`]},e.file.name))}),variant:`danger`})},onDrop:async(e,a,s)=>{if(e.length===0)return;let c=typeof t==`function`?t(s):t,l=n(c),u=e.length===1?`Uploading file to ${l}...`:`Uploading files to ${l}...`;r?.(c,e);let d;try{d=await K(u,async t=>(t.addTotal(e.length),Tn({files:e,destinationPath:c,createFile:o,onFileProcessed:()=>t.increment(1)})))}catch{await i(c);return}await i(c),On(d,l)}})}async function Tn({files:e,destinationPath:t,createFile:n,onFileProcessed:r}){let i=await at(e,Sn,async e=>{try{return{file:e,response:await n({path:En({destinationPath:t,filePath:An(kn(e))}),type:`file`,name:e.name,file:e})}}catch(t){return{file:e,response:{success:!1,message:Ze(t)}}}finally{r?.()}});return{successful:i.filter(({response:e})=>e.success),failed:i.filter(({response:e})=>!e.success)}}function En({destinationPath:e,filePath:t}){if(!t)return e;if(We.isAbsolute(t))throw Error(`Upload path must be relative: ${t}`);let n=t.split(/[\\/]+/).slice(0,-1).filter(Boolean);if(n.includes(`..`))throw Error(`Upload path cannot contain parent traversal: ${t}`);let r=n.filter(e=>e!==`.`);if(r.length===0)return e;let i=Ge.guessDeliminator(e),a=r.join(i.deliminator);return i.join(e,a)}function Dn(e,t){return e instanceof Element&&e.closest(`[${Cn}]`)?.getAttribute(Cn)||t}function On(e,t){let n=e.successful.length+e.failed.length;if(e.failed.length>0){let r;r=e.successful.length===0?n===1?`File upload failed`:`Files failed to upload`:`${e.successful.length} of ${n} files uploaded`,Ue({title:r,description:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Destination: `,t,`.`]}),e.failed.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,`:`,` `,t.message||`The server rejected the upload.`]},`${e.name}-${n}`))]}),variant:`danger`});return}let r=e.successful.filter(({file:e,response:t})=>t.info?.name&&t.info.name!==e.name);Ue({title:n===1?`File uploaded`:`${n} files uploaded`,description:r.length===0?`Uploaded to ${t}.`:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Uploaded to `,t,`.`]}),r.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,` was saved as `,t.info?.name,`.`]},`${e.name}-${n}`))]})})}function kn(e){if(e.webkitRelativePath)return e.webkitRelativePath;if(`path`in e&&typeof e.path==`string`)return e.path;if(`relativePath`in e&&typeof e.relativePath==`string`)return e.relativePath}function An(e){if(e)return e.replace(/^\/+/,``)}var jn=C(`marimo:showHiddenFiles`,!0,b,{getOnInit:!0}),Mn=Z.createContext(null),Nn=e=>{let n=(0,Q.c)(107),{height:r,externalDropDestinationPath:a}=e,o=a===void 0?null:a,s=(0,Z.useRef)(null),c=cn(),[l]=t(_n),u;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[0]=u):u=n[0];let[d,f]=(0,Z.useState)(u),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[_,v]=t(jn),[y,b]=t(vn),x;n[1]===l?x=n[2]:(x=e=>l.refreshPath(e),n[1]=l,n[2]=x);let S=i(x),C=(0,Z.useRef)(``),w;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>C.current,n[3]=w):w=n[3];let T;n[4]===l?T=n[5]:(T=e=>Bn(l,e),n[4]=l,n[5]=T);let E;n[6]!==S||n[7]!==T?(E={noClick:!0,noDrag:!0,noKeyboard:!0,destinationPath:w,getDestinationLabel:T,refreshDestination:S},n[6]=S,n[7]=T,n[8]=E):E=n[8];let{getInputProps:D,open:O}=wn(E),k;n[9]===O?k=n[10]:(k=e=>{C.current=e,O()},n[9]=O,n[10]=k);let A=i(k),{openPrompt:j}=Te(),M;n[11]===l?M=n[12]:(M=()=>l.initialize(f),n[11]=l,n[12]=M);let N;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],n[13]=N):N=n[13];let{isPending:P,error:F}=qe(M,N),I;n[14]!==y||n[15]!==l?(I=()=>l.refreshAll(Object.keys(y).filter(e=>y[e])),n[14]=y,n[15]=l,n[16]=I):I=n[16];let L=i(I),R;n[17]!==v||n[18]!==_?(R=()=>{v(!_)},n[17]=v,n[18]=_,n[19]=R):R=n[19];let z=i(R),B;n[20]!==j||n[21]!==l?(B=async()=>{j({title:`Folder name`,onConfirm:async e=>{l.createFolder(e,null)}})},n[20]=j,n[21]=l,n[22]=B):B=n[22];let V=i(B),H;n[23]!==j||n[24]!==l?(H=async()=>{j({title:`File name`,onConfirm:async e=>{l.createFile({name:e,parentId:null})}})},n[23]=j,n[24]=l,n[25]=H):H=n[25];let U=i(H),W;n[26]!==j||n[27]!==l?(W=async()=>{j({title:`Notebook name`,onConfirm:async e=>{l.createFile({name:e,parentId:null,type:`notebook`})}})},n[26]=j,n[27]=l,n[28]=W):W=n[28];let G=i(W),K;n[29]===b?K=n[30]:(K=()=>{s.current?.closeAll(),b({})},n[29]=b,n[30]=K);let ee=i(K),te;n[31]!==d||n[32]!==_?(te=Vn(d,_),n[31]=d,n[32]=_,n[33]=te):te=n[33];let q=te,ne,Y;n[34]!==h||n[35]!==q?(ne=()=>{h&&!Un(q,h)&&g(null)},Y=[h,q],n[34]=h,n[35]=q,n[36]=ne,n[37]=Y):(ne=n[36],Y=n[37]),Z.useEffect(ne,Y);let re;n[38]!==o||n[39]!==A||n[40]!==l?(re={tree:l,uploadFiles:A,externalDropDestinationPath:o},n[38]=o,n[39]=A,n[40]=l,n[41]=re):re=n[41];let ie=re;if(P){let e;return n[42]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(De,{size:`medium`,centered:!0}),n[42]=e):e=n[42],e}if(F){let e;return n[43]===F?e=n[44]:(e=(0,$.jsx)(et,{error:F}),n[43]=F,n[44]=e),e}if(p){let e;n[45]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>m(null),n[45]=e):e=n[45];let t;n[46]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(J,{onClick:e,"data-testid":`file-explorer-back-button`,variant:`text`,size:`xs`,className:`mb-0`,children:(0,$.jsx)(ae,{size:16})}),n[46]=t):t=n[46];let r;n[47]===p.name?r=n[48]:(r=(0,$.jsxs)(`div`,{className:`flex items-center pl-1 pr-3 shrink-0 border-b justify-between`,children:[t,(0,$.jsx)(`span`,{className:`font-bold`,children:p.name})]}),n[47]=p.name,n[48]=r);let i;n[49]!==p.path||n[50]!==l?(i=e=>zn(e,l.relativeFromRoot(p.path)),n[49]=p.path,n[50]=l,n[51]=i):i=n[51];let a;n[52]!==p||n[53]!==i?(a=(0,$.jsx)(Z.Suspense,{children:(0,$.jsx)(gn,{onOpenNotebook:i,file:p})}),n[52]=p,n[53]=i,n[54]=a):a=n[54];let o;return n[55]!==r||n[56]!==a?(o=(0,$.jsxs)($.Fragment,{children:[r,a]}),n[55]=r,n[56]=a,n[57]=o):o=n[57],o}let X;n[58]===D?X=n[59]:(X=D(),n[58]=D,n[59]=X);let oe;n[60]===X?oe=n[61]:(oe=(0,$.jsx)(`input`,{"data-testid":`file-explorer-upload-input`,...X}),n[60]=X,n[61]=oe);let se;n[62]!==h||n[63]!==l?(se=h??l.getRootPath(),n[62]=h,n[63]=l,n[64]=se):se=n[64];let ce;n[65]!==h||n[66]!==l?(ce=h??l.getRootPath(),n[65]=h,n[66]=l,n[67]=ce):ce=n[67];let le;n[68]!==ce||n[69]!==l?(le=Bn(l,ce),n[68]=ce,n[69]=l,n[70]=le):le=n[70];let ue;n[71]!==ee||n[72]!==U||n[73]!==V||n[74]!==G||n[75]!==z||n[76]!==L||n[77]!==A||n[78]!==_||n[79]!==se||n[80]!==le?(ue=(0,$.jsx)(Fn,{onRefresh:L,onHidden:z,showHiddenFiles:_,onCreateFile:U,onCreateNotebook:G,onCreateFolder:V,onCollapseAll:ee,uploadDestinationPath:se,uploadDestinationLabel:le,onUpload:A}),n[71]=ee,n[72]=U,n[73]=V,n[74]=G,n[75]=z,n[76]=L,n[77]=A,n[78]=_,n[79]=se,n[80]=le,n[81]=ue):ue=n[81];let de=r-33,fe,pe,me;n[82]===l?(fe=n[83],pe=n[84],me=n[85]):(fe=async e=>{let{ids:t}=e;for(let e of t)await l.delete(e)},pe=async e=>{let{id:t,name:n}=e;await l.rename(t,n)},me=async e=>{let{dragIds:t,parentId:n}=e;await l.move(t,n)},n[82]=l,n[83]=fe,n[84]=pe,n[85]=me);let he;n[86]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>{let t=e[0];if(!t){g(null);return}if(t.data.isDirectory){g(t.data.path);return}g(null),m(t.data)},n[86]=he):he=n[86];let ge;n[87]!==y||n[88]!==b||n[89]!==l?(ge=async e=>{if(await l.expand(e)){let t=y[e]??!1;b({...y,[e]:!t})}},n[87]=y,n[88]=b,n[89]=l,n[90]=ge):ge=n[90];let _e;n[91]!==c||n[92]!==y||n[93]!==de||n[94]!==fe||n[95]!==pe||n[96]!==me||n[97]!==ge||n[98]!==q?(_e=(0,$.jsx)(Ne,{width:`100%`,ref:s,height:de,className:`h-full`,data:q,initialOpenState:y,openByDefault:!1,dndManager:c,renderCursor:Wn,disableDrop:Gn,onDelete:fe,onRename:pe,onMove:me,onSelect:he,onToggle:ge,padding:15,rowHeight:30,indent:Pn,overscanCount:1e3,disableMultiSelection:!0,children:Ln}),n[91]=c,n[92]=y,n[93]=de,n[94]=fe,n[95]=pe,n[96]=me,n[97]=ge,n[98]=q,n[99]=_e):_e=n[99];let ve;n[100]!==ie||n[101]!==_e?(ve=(0,$.jsx)(Mn,{value:ie,children:_e}),n[100]=ie,n[101]=_e,n[102]=ve):ve=n[102];let ye;return n[103]!==oe||n[104]!==ue||n[105]!==ve?(ye=(0,$.jsxs)($.Fragment,{children:[oe,ue,ve]}),n[103]=oe,n[104]=ue,n[105]=ve,n[106]=ye):ye=n[106],ye},Pn=15,Fn=e=>{let t=(0,Q.c)(35),{onRefresh:n,onHidden:r,showHiddenFiles:i,onCreateFile:a,onCreateNotebook:o,onCreateFolder:s,onCollapseAll:c,uploadDestinationPath:l,uploadDestinationLabel:u,onUpload:d}=e,f=`Upload files to ${u}`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ht,{size:16}),t[0]=p):p=t[0];let m;t[1]===o?m=t[2]:(m=(0,$.jsx)(q,{content:`Add notebook`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-add-notebook-button`,onClick:o,variant:`text`,size:`xs`,children:p})}),t[1]=o,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(xt,{size:16}),t[3]=h):h=t[3];let g;t[4]===a?g=t[5]:(g=(0,$.jsx)(q,{content:`Add file`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-add-file-button`,onClick:a,variant:`text`,size:`xs`,children:h})}),t[4]=a,t[5]=g);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ct,{size:16}),t[6]=_):_=t[6];let v;t[7]===s?v=t[8]:(v=(0,$.jsx)(q,{content:`Add folder`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-add-folder-button`,onClick:s,variant:`text`,size:`xs`,children:_})}),t[7]=s,t[8]=v);let y;t[9]!==d||t[10]!==l?(y=()=>d(l),t[9]=d,t[10]=l,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Ve,{size:16}),t[12]=b):b=t[12];let x;t[13]!==y||t[14]!==f?(x=(0,$.jsx)(J,{"data-testid":`file-explorer-upload-button`,"aria-label":f,onClick:y,variant:`text`,size:`xs`,children:b}),t[13]=y,t[14]=f,t[15]=x):x=t[15];let S;t[16]!==x||t[17]!==f?(S=(0,$.jsx)(q,{content:f,children:x}),t[16]=x,t[17]=f,t[18]=S):S=t[18];let C;t[19]===n?C=t[20]:(C=(0,$.jsx)(de,{"data-testid":`file-explorer-refresh-button`,onClick:n}),t[19]=n,t[20]=C);let w;t[21]!==r||t[22]!==i?(w=(0,$.jsx)(ce,{"data-testid":`file-explorer-hidden-files-button`,isVisible:i,onToggle:r,showTooltip:`Show hidden files`,hideTooltip:`Hide hidden files`}),t[21]=r,t[22]=i,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(bt,{size:16}),t[24]=T):T=t[24];let E;t[25]===c?E=t[26]:(E=(0,$.jsx)(q,{content:`Collapse all folders`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-collapse-button`,onClick:c,variant:`text`,size:`xs`,children:T})}),t[25]=c,t[26]=E);let D;return t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==E||t[31]!==m||t[32]!==g||t[33]!==v?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-end px-2 shrink-0 border-b`,children:[m,g,v,S,C,w,E]}),t[27]=S,t[28]=C,t[29]=w,t[30]=E,t[31]=m,t[32]=g,t[33]=v,t[34]=D):D=t[34],D},In=e=>{let t=(0,Q.c)(9),{node:n,onOpenMarimoFile:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=i);let a;t[2]!==n.data.isMarimoFile||t[3]!==r?(a=n.data.isMarimoFile&&!k()&&(0,$.jsxs)(`span`,{"data-testid":`file-explorer-open-marimo-button`,className:`shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline`,onClick:r,children:[`open `,(0,$.jsx)(ge,{className:`inline ml-1`,size:12})]}),t[2]=n.data.isMarimoFile,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==n.data.name||t[6]!==i||t[7]!==a?(o=(0,$.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,onClick:i,children:[n.data.name,a]}),t[5]=n.data.name,t[6]=i,t[7]=a,t[8]=o):o=t[8],o},Ln=e=>{let t=(0,Q.c)(123),{node:n,style:a,dragHandle:o}=e,{openFile:s}=re(),l=r(E),u;t[0]!==n.data.isDirectory||t[1]!==n.data.name?(u=n.data.isDirectory?`directory`:be(n.data.name),t[0]=n.data.isDirectory,t[1]=n.data.name,t[2]=u):u=t[2];let d=u,p=xe[d],{openConfirm:m,openPrompt:h}=Te(),{createNewCell:g}=c(),_=f(),y;t[3]!==g||t[4]!==_?(y=e=>{g({code:e,before:!1,cellId:_??`__end__`})},t[3]=g,t[4]=_,t[5]=y):y=t[5];let b=y,x=(0,Z.use)(Mn),S=x?.tree,C=n.data.isDirectory&&x?.externalDropDestinationPath===n.data.path,w;t[6]!==n.data.path||t[7]!==S?(w=async e=>{zn(e,S?S.relativeFromRoot(n.data.path):n.data.path)},t[6]=n.data.path,t[7]=S,t[8]=w):w=t[8];let T=w,D;t[9]!==n.data.name||t[10]!==n.id||t[11]!==n.tree||t[12]!==m?(D=async e=>{e.stopPropagation(),e.preventDefault(),m({title:`Delete file`,description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,$.jsx)(P,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":`Confirm`,children:`Delete`})})},t[9]=n.data.name,t[10]=n.id,t[11]=n.tree,t[12]=m,t[13]=D):D=t[13];let O=D,A;t[14]!==n||t[15]!==h||t[16]!==S?(A=async()=>{n.open(),h({title:`Folder name`,onConfirm:async e=>{S?.createFolder(e,n.id)}})},t[14]=n,t[15]=h,t[16]=S,t[17]=A):A=t[17];let M=i(A),N;t[18]!==n||t[19]!==h||t[20]!==S?(N=async()=>{n.open(),h({title:`File name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id})}})},t[18]=n,t[19]=h,t[20]=S,t[21]=N):N=t[21];let L=i(N),R;t[22]!==n||t[23]!==h||t[24]!==S?(R=async()=>{n.open(),h({title:`Notebook name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id,type:`notebook`})}})},t[22]=n,t[23]=h,t[24]=S,t[25]=R):R=t[25];let z=i(R),V;t[26]!==n.data.name||t[27]!==n.id||t[28]!==S?(V=async()=>{S&&await S.copy(n.id,it(n.data.name))},t[26]=n.data.name,t[27]=n.id,t[28]=S,t[29]=V):V=t[29];let H=i(V),U;t[30]!==n.data.isDirectory||t[31]!==n.data.path?(U=n.data.isDirectory?{[Cn]:n.data.path}:{},t[30]=n.data.isDirectory,t[31]=n.data.path,t[32]=U):U=t[32];let W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(W=j(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group`),t[33]=W):W=t[33];let G,K;t[34]===n?(G=t[35],K=t[36]):(G=e=>{e.stopPropagation(),n.data.isDirectory&&(n.select(),n.toggle())},K=(0,$.jsx)(Rn,{node:n}),t[34]=n,t[35]=G,t[36]=K);let ee=n.willReceiveDrop&&n.data.isDirectory&&`bg-accent/80 hover:bg-accent/80 text-accent-foreground`,te=n.isSelected&&`bg-accent/60 hover:bg-accent/60 text-accent-foreground`,q=C&&`bg-primary/15 hover:bg-primary/15 text-accent-foreground ring-1 ring-inset ring-primary`,J;t[37]!==ee||t[38]!==te||t[39]!==q?(J=j(`flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group`,ee,te,q),t[37]=ee,t[38]=te,t[39]=q,t[40]=J):J=t[40];let ne;t[41]!==p||t[42]!==d||t[43]!==n.data.isMarimoFile?(ne=n.data.isMarimoFile?(0,$.jsx)(gt,{className:`w-5 h-5 shrink-0 mr-2`,strokeWidth:1.5}):(0,$.jsx)(p,{className:j(`w-5 h-5 shrink-0 mr-2`,ye[d]),strokeWidth:1.5}),t[41]=p,t[42]=d,t[43]=n.data.isMarimoFile,t[44]=ne):ne=t[44];let Y;t[45]!==T||t[46]!==n?(Y=n.isEditing?(0,$.jsx)(Ie,{node:n}):(0,$.jsx)(In,{node:n,onOpenMarimoFile:T}),t[45]=T,t[46]=n,t[47]=Y):Y=t[47];let ie;t[48]===n?ie=t[49]:(ie=!n.data.isDirectory&&(0,$.jsxs)(F,{onSelect:()=>n.select(),"data-testid":`file-explorer-open-file-menu-item`,children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`Open file`]}),t[48]=n,t[49]=ie);let X;t[50]!==n.data.isDirectory||t[51]!==n.data.path||t[52]!==s?(X=!n.data.isDirectory&&!k()&&(0,$.jsxs)(F,{onSelect:()=>{s({path:n.data.path})},"data-testid":`file-explorer-open-external-menu-item`,children:[(0,$.jsx)(ge,{className:`h-3.5 w-3.5 mr-2`}),`Open file in external editor`]}),t[50]=n.data.isDirectory,t[51]=n.data.path,t[52]=s,t[53]=X):X=t[53];let ae;t[54]!==x||t[55]!==L||t[56]!==M||t[57]!==z||t[58]!==n.data.isDirectory||t[59]!==n.data.path?(ae=n.data.isDirectory&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{onSelect:()=>z(),"data-testid":`file-explorer-create-notebook-menu-item`,children:[(0,$.jsx)(ht,{className:`h-3.5 w-3.5 mr-2`}),`Create notebook`]}),(0,$.jsxs)(F,{onSelect:()=>L(),"data-testid":`file-explorer-create-file-menu-item`,children:[(0,$.jsx)(xt,{className:`h-3.5 w-3.5 mr-2`}),`Create file`]}),(0,$.jsxs)(F,{onSelect:()=>M(),"data-testid":`file-explorer-create-folder-menu-item`,children:[(0,$.jsx)(Ct,{className:`h-3.5 w-3.5 mr-2`}),`Create folder`]}),(0,$.jsxs)(F,{onSelect:()=>x?.uploadFiles(n.data.path),"data-testid":`file-explorer-upload-files-menu-item`,children:[(0,$.jsx)(Ve,{className:`h-3.5 w-3.5 mr-2`}),`Upload files here`]}),(0,$.jsx)(I,{})]}),t[54]=x,t[55]=L,t[56]=M,t[57]=z,t[58]=n.data.isDirectory,t[59]=n.data.path,t[60]=ae):ae=t[60];let se;t[61]===n?se=t[62]:(se=(0,$.jsx)(Oe,{onSelect:()=>n.edit(),testId:`file-explorer-rename-menu-item`}),t[61]=n,t[62]=se);let ce;t[63]===H?ce=t[64]:(ce=(0,$.jsx)(Fe,{onSelect:H,testId:`file-explorer-duplicate-menu-item`}),t[63]=H,t[64]=ce);let le;t[65]===n.data.path?le=t[66]:(le=async()=>{await Je(n.data.path),Ue({title:`Copied to clipboard`})},t[65]=n.data.path,t[66]=le);let ue;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(wt,{className:fe}),t[67]=ue):ue=t[67];let de;t[68]===le?de=t[69]:(de=(0,$.jsxs)(F,{onSelect:le,"data-testid":`file-explorer-copy-path-menu-item`,children:[ue,`Copy path`]}),t[68]=le,t[69]=de);let pe;t[70]!==n.data.path||t[71]!==S?(pe=S&&(0,$.jsxs)(F,{onSelect:async()=>{await Je(S.relativeFromRoot(n.data.path)),Ue({title:`Copied to clipboard`})},"data-testid":`file-explorer-copy-relative-path-menu-item`,children:[(0,$.jsx)(wt,{className:`h-3.5 w-3.5 mr-2`}),`Copy relative path`]}),t[70]=n.data.path,t[71]=S,t[72]=pe):pe=t[72];let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(I,{}),t[73]=me):me=t[73];let he;t[74]!==d||t[75]!==b||t[76]!==n.data?(he=()=>{let{path:e}=n.data,t=bn[d](e);b(t)},t[74]=d,t[75]=b,t[76]=n.data,t[77]=he):he=t[77];let _e;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(oe,{className:fe}),t[78]=_e):_e=t[78];let ve;t[79]===he?ve=t[80]:(ve=(0,$.jsxs)(F,{onSelect:he,"data-testid":`file-explorer-insert-snippet-menu-item`,children:[_e,`Insert snippet for reading file`]}),t[79]=he,t[80]=ve);let Se;t[81]!==d||t[82]!==n.data?(Se=async()=>{Ue({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:e}=n.data,t=bn[d](e);await Je(t)},t[81]=d,t[82]=n.data,t[83]=Se):Se=t[83];let Ce;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(v,{className:fe}),t[84]=Ce):Ce=t[84];let we;t[85]===Se?we=t[86]:(we=(0,$.jsxs)(F,{onSelect:Se,"data-testid":`file-explorer-copy-snippet-menu-item`,children:[Ce,`Copy snippet for reading file`]}),t[85]=Se,t[86]=we);let Ee;t[87]!==T||t[88]!==n.data.isMarimoFile?(Ee=n.data.isMarimoFile&&!k()&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:T,"data-testid":`file-explorer-open-notebook-menu-item`,children:[(0,$.jsx)(Tt,{className:`h-3.5 w-3.5 mr-2`}),`Open notebook`]})]}),t[87]=T,t[88]=n.data.isMarimoFile,t[89]=Ee):Ee=t[89];let De;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,$.jsx)(I,{}),t[90]=De):De=t[90];let ke;t[91]!==l||t[92]!==n.data.isDirectory||t[93]!==n.data.name||t[94]!==n.data.path?(ke=!n.data.isDirectory&&!l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{onSelect:async()=>{await dn(n.data.path,n.data.name)},"data-testid":`file-explorer-download-menu-item`,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),(0,$.jsx)(I,{})]}),t[91]=l,t[92]=n.data.isDirectory,t[93]=n.data.name,t[94]=n.data.path,t[95]=ke):ke=t[95];let Ae;t[96]===O?Ae=t[97]:(Ae=(0,$.jsx)(Pe,{onSelect:O,testId:`file-explorer-delete-menu-item`}),t[96]=O,t[97]=Ae);let je;t[98]!==ie||t[99]!==X||t[100]!==ae||t[101]!==se||t[102]!==ce||t[103]!==de||t[104]!==pe||t[105]!==ve||t[106]!==we||t[107]!==Ee||t[108]!==ke||t[109]!==Ae?(je=(0,$.jsxs)(Me,{testId:`file-explorer-more-button`,iconClassName:`w-5 h-5`,children:[ie,X,ae,se,ce,de,pe,me,ve,we,Ee,De,ke,Ae]}),t[98]=ie,t[99]=X,t[100]=ae,t[101]=se,t[102]=ce,t[103]=de,t[104]=pe,t[105]=ve,t[106]=we,t[107]=Ee,t[108]=ke,t[109]=Ae,t[110]=je):je=t[110];let Ne;t[111]!==J||t[112]!==ne||t[113]!==Y||t[114]!==je?(Ne=(0,$.jsxs)(`span`,{className:J,children:[ne,Y,je]}),t[111]=J,t[112]=ne,t[113]=Y,t[114]=je,t[115]=Ne):Ne=t[115];let Le;return t[116]!==o||t[117]!==a||t[118]!==G||t[119]!==K||t[120]!==Ne||t[121]!==U?(Le=(0,$.jsxs)(`div`,{style:a,ref:o,...U,className:W,draggable:!0,onClick:G,children:[K,Ne]}),t[116]=o,t[117]=a,t[118]=G,t[119]=K,t[120]=Ne,t[121]=U,t[122]=Le):Le=t[122],Le},Rn=e=>{let t=(0,Q.c)(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`w-4 h-4 shrink-0`}),t[0]=e):e=t[0],e}let r;return t[1]===n.isOpen?r=t[2]:(r=(0,$.jsx)(le,{isExpanded:n.isOpen,className:`w-4 h-4`}),t[1]=n.isOpen,t[2]=r),r};function zn(e,t){e.stopPropagation(),e.preventDefault(),_t(t)}function Bn(e,t){return t===e.getRootPath()?`workspace root`:e.relativeFromRoot(t)}function Vn(e,t){if(t)return e;let n=[];for(let r of e){if(Hn(r.name))continue;let e=r;if(r.children){let n=Vn(r.children,t);n!==r.children&&(e={...r,children:n})}n.push(e)}return n}function Hn(e){return!!e.startsWith(`.`)}function Un(e,t){return e.some(e=>e.path===t||(e.children?Un(e.children,t):!1))}function Wn(){return null}function Gn(e){let{parentNode:t}=e;return!t.data.isDirectory}var Kn=e=>{let t=(0,Q.c)(44),{height:n}=e,i=r(_n),[a,o]=(0,Z.useState)(null),s;t[0]===i?s=t[1]:(s=e=>qn(e,i.getRootPath()),t[0]=i,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=e=>i.refreshPath(e),t[2]=i,t[3]=l);let u=l,d;t[4]===i?d=t[5]:(d=e=>Bn(i,e),t[4]=i,t[5]=d);let f,p;t[6]===c?(f=t[7],p=t[8]):(f=e=>o(c(e)),p=e=>o(c(e)),t[6]=c,t[7]=f,t[8]=p);let m,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o(null),h=()=>o(null),t[9]=m,t[10]=h):(m=t[9],h=t[10]);let g;t[11]!==c||t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(g={noClick:!0,noKeyboard:!0,destinationPath:c,getDestinationLabel:d,refreshDestination:u,onDragEnter:f,onDragOver:p,onDragLeave:m,onUploadStart:h},t[11]=c,t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=g):g=t[16];let{getRootProps:_,getInputProps:v,isDragActive:y}=wn(g),b;t[17]!==a||t[18]!==i?(b=a??i.getRootPath(),t[17]=a,t[18]=i,t[19]=b):b=t[19];let x=b,S;t[20]!==x||t[21]!==i?(S=Bn(i,x),t[20]=x,t[21]=i,t[22]=S):S=t[22];let C=S,w;t[23]===_?w=t[24]:(w=_(),t[23]=_,t[24]=w);let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=j(`flex flex-col overflow-hidden relative`),t[25]=T):T=t[25];let E;t[26]===n?E=t[27]:(E={height:n},t[26]=n,t[27]=E);let D;t[28]===v?D=t[29]:(D=v(),t[28]=v,t[29]=D);let O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`input`,{...D}),t[30]=D,t[31]=O);let k;t[32]!==C||t[33]!==y?(k=y&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-start justify-center pt-3 bg-accent/20 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none`,children:(0,$.jsxs)(`span`,{className:`px-3 py-1.5 rounded-md bg-background/95 border shadow-sm text-sm font-semibold text-primary`,children:[`Drop files into `,C]})}),t[32]=C,t[33]=y,t[34]=k):k=t[34];let A=y?x:null,M;t[35]!==n||t[36]!==A?(M=(0,$.jsx)(Nn,{height:n,externalDropDestinationPath:A}),t[35]=n,t[36]=A,t[37]=M):M=t[37];let N;return t[38]!==w||t[39]!==E||t[40]!==O||t[41]!==k||t[42]!==M?(N=(0,$.jsx)(un,{children:(0,$.jsxs)(`div`,{...w,className:T,style:E,children:[O,k,M]})}),t[38]=w,t[39]=E,t[40]=O,t[41]=k,t[42]=M,t[43]=N):N=t[43],N};function qn(e,t){return Array.isArray(e)?t:Dn(e.target,t)}var Jn=()=>{let e=(0,Q.c)(40),{ref:n,height:i}=nt(),a=i===void 0?500:i,[o,c]=t(vt),l=r(x).length,u=s(`storage`),d;bb0:{if(!o.hasUserInteracted&&l>0){if(o.openSections.includes(`remote-storage`)){d=o.openSections;break bb0}let t;e[0]===o.openSections?t=e[1]:(t=[...o.openSections,`remote-storage`],e[0]=o.openSections,e[1]=t),d=t;break bb0}d=o.openSections}let f=d,p;e[2]===c?p=e[3]:(p=e=>{c({openSections:e,hasUserInteracted:!0})},e[2]=c,e[3]=p);let m=p,h=a-66,g;e[4]===f?g=e[5]:(g=f.includes(`remote-storage`),e[4]=f,e[5]=g);let _=g,v=u.length>0,y;e[6]!==f||e[7]!==_?(y=_&&f.includes(`files`),e[6]=f,e[7]=_,e[8]=y):y=e[8];let b=y,S;e[9]!==h||e[10]!==b?(S=b?Math.round(h*.4):h,e[9]=h,e[10]=b,e[11]=S):S=e[11];let C=S,w=Math.max(200,b?h-C:h),T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ce,{className:`w-4 h-4`}),e[12]=T):T=e[12];let E;e[13]===l?E=e[14]:(E=l>0&&(0,$.jsx)(ct,{children:l}),e[13]=l,e[14]=E);let D;e[15]!==u.length||e[16]!==v?(D=v&&(0,$.jsx)(mt,{count:u.length,type:`storage`}),e[15]=u.length,e[16]=v,e[17]=D):D=e[17];let O;e[18]!==E||e[19]!==D?(O=(0,$.jsxs)(lt,{children:[T,` Remote storage`,E,D]}),e[18]=E,e[19]=D,e[20]=O):O=e[20];let k;e[21]===C?k=e[22]:(k={maxHeight:C},e[21]=C,e[22]=k);let A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(nn,{}),e[23]=A):A=e[23];let j;e[24]===k?j=e[25]:(j=(0,$.jsx)(ut,{className:`overflow-auto`,style:k,children:A}),e[24]=k,e[25]=j);let M;e[26]!==j||e[27]!==O?(M=(0,$.jsxs)(ft,{value:`remote-storage`,children:[O,j]}),e[26]=j,e[27]=O,e[28]=M):M=e[28];let P;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsxs)(lt,{children:[(0,$.jsx)(Se,{className:`w-4 h-4`}),`Files`]}),e[29]=P):P=e[29];let F;e[30]===w?F=e[31]:(F=(0,$.jsxs)(ft,{value:`files`,children:[P,(0,$.jsx)(ut,{children:(0,$.jsx)(Kn,{height:w})})]}),e[30]=w,e[31]=F);let I;e[32]!==m||e[33]!==f||e[34]!==M||e[35]!==F?(I=(0,$.jsxs)(N,{type:`multiple`,value:f,onValueChange:m,children:[M,F]}),e[32]=m,e[33]=f,e[34]=M,e[35]=F,e[36]=I):I=e[36];let L;return e[37]!==n||e[38]!==I?(L=(0,$.jsx)(`div`,{ref:n,className:`h-full overflow-auto`,children:I}),e[37]=n,e[38]=I,e[39]=L):L=e[39],L};export{Jn as default,qn as getUploadDestinationForEvent};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i}from"./useEvent-xfs0Sn4r.js";import{t as a}from"./react-CBDbhulC.js";import{At as o,Cn as s,Co as c,D as l,Dt as u,Et as d,Mt as f,Ot as p,Sn as m,Tt as h,Wt as g,ii as _,jt as v,kn as y,kt as b,oa as x,vn as S,yo as C}from"./cells-yuYDzbAy.js";import{t as w}from"./compiler-runtime-CYIjoINj.js";import{g as T,p as E}from"./utils-CUZQNAWJ.js";import{g as D}from"./useEventListener-D27Dii_l.js";import{t as O}from"./invariant-Ci2dTZ72.js";import{N as k,r as A}from"./config-DaNyNpZL.js";import{t as j}from"./cn-ldLVeaqm.js";import{t as M}from"./jsx-runtime-B74pBk57.js";import{r as N}from"./config-Cl3eMWxb.js";import{o as P}from"./alert-dialog-BVi_GyOB.js";import{a as F,c as I,p as L,r as R,t as z}from"./dropdown-menu-CqNabM1f.js";import{Pt as B,a as V,h as H,i as U,o as W,s as G}from"./JsonOutput-CUJlEdsN.js";import{c as K,n as ee,r as te}from"./download-D1crMjD8.js";import{t as q}from"./tooltip-D7dq6bnc.js";import{t as J}from"./button-Btj6GXNy.js";import{Tt as ne}from"./dist-PIe1xcZo.js";import{n as Y,r as re,t as ie}from"./requests-C6_IaFh7.js";import{t as X}from"./createLucideIcon-B7HeEoG2.js";import{t as ae}from"./arrow-left-DrqK6gPp.js";import{n as oe}from"./LazyAnyLanguageCodeMirror-zSwE3dvU.js";import{r as se}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as ce,i as le,n as ue,r as de,t as fe}from"./tree-actions-Bh-Nnaub.js";import{a as pe}from"./markdown-renderer-BgUTGtM0.js";import{u as me}from"./toDate-hGYJX0Ha.js";import{t as he}from"./copy-BMXKNElG.js";import{t as ge}from"./external-link-Bp3BxyRA.js";import{a as _e,i as ve,n as ye,r as be,t as xe}from"./file-icons-Dx3v6lMu.js";import{t as Se}from"./file-DF8n85RA.js";import{n as Ce,t as we}from"./components-ib4asSo7.js";import{b as Te}from"./write-secret-modal-lNU_7c2x.js";import{n as Ee,t as De}from"./spinner-Ck-Hgfvj.js";import{a as Oe,c as ke,d as Ae,f as je,i as Me,l as Ne,n as Pe,r as Fe,t as Ie,u as Le}from"./file-name-input-DzL8D_7x.js";import{t as Re}from"./refresh-cw-Bf-rx_aV.js";import{t as ze}from"./save-BybsbOKz.js";import{t as Be}from"./triangle-alert-MihykDYG.js";import{n as Ve,t as He}from"./es-BuMFDpR4.js";import{t as Ue}from"./use-toast-DpWHUGuF.js";import{n as We,t as Ge}from"./paths-zcL04qUW.js";import{t as Ke}from"./context-Do8M9TDF.js";import{n as qe}from"./useAsyncData-Buhk-UgR.js";import{n as Je}from"./copy-Cg05mM3C.js";import{t as Ye}from"./copy-icon-CRxVZTJ9.js";import{t as Xe}from"./blob-yxfhyyvD.js";import{a as Ze}from"./errors-DzO-nXy-.js";import{n as Qe,t as $e}from"./alert-dmKwNsrp.js";import{n as et}from"./error-banner-BYN8YUMe.js";import{a as tt}from"./renderShortcut-CS4ccH3x.js";import{t as nt}from"./bundle.esm-DzY74mzC.js";import{t as rt}from"./useAddCell-_JRYhAFd.js";import{n as it}from"./pathUtils-Cryrlpma.js";import{n as at}from"./semaphore-BjoL5P0h.js";import{t as ot}from"./empty-state-kWyb5dCS.js";import{t as st}from"./formatting-BJlT1s_3.js";import{a as ct,i as lt,n as ut,o as dt,r as ft,s as pt,t as mt}from"./components-ByyAzQxP.js";import{n as ht,t as gt}from"./marimo-icons-C3KxMV9A.js";import{t as _t}from"./links-DPh7yoP-.js";import{n as vt}from"./panel-accordion-state-vpqEc3Kd.js";var yt=X(`book-plus`,[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),bt=X(`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`}]]),xt=X(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),St=X(`file-symlink`,[[`path`,{d:`M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7`,key:`huwfnr`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 18 3-3-3-3`,key:`18f6ys`}]]),Ct=X(`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`}]]),wt=X(`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`}]]),Tt=X(`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`}]]),Et=X(`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`}]]),Z=e(a(),1),Q=w(),$=M(),Dt=e=>{let t=(0,Q.c)(17),{filename:n,filenameIcon:r,onBack:i,onRefresh:a,onDownload:o,actions:s}=e,c;t[0]===i?c=t[1]:(c=i&&(0,$.jsx)(q,{content:`Back to file list`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:i,children:(0,$.jsx)(ae,{className:`h-4 w-4`})})}),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=n?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate`,children:[r,n]}):(0,$.jsx)(`span`,{className:`flex-1`}),t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]===a?u=t[6]:(u=a&&(0,$.jsx)(q,{content:`Refresh`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:a,children:(0,$.jsx)(Re,{className:`h-3.5 w-3.5`})})}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o&&(0,$.jsx)(q,{content:`Download`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:o,children:(0,$.jsx)(B,{className:`h-3.5 w-3.5`})})}),t[7]=o,t[8]=d);let f;t[9]!==s||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[u,s,d]}),t[9]=s,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center shrink-0 border-b px-1 gap-1`,children:[c,l,f]}),t[13]=c,t[14]=l,t[15]=f,t[16]=p):p=t[16],p},Ot=new Set([`http`,`file`,`in-memory`]);function kt(e){return JSON.stringify(e).slice(1,-1)}var At=new Set([`datasets`,`spaces`,`buckets`]);function jt(e){let t=e.split(`/`).filter(Boolean);return t[0]===`datasets`&&t.length>=4?{repoType:`dataset`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t[0]===`spaces`&&t.length>=4?{repoType:`space`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t.length>=3&&!At.has(t[0])?{repoType:`model`,repoId:`${t[0]}/${t[1]}`,filename:t.slice(2).join(`/`)}:null}function Mt(e){return`from huggingface_hub import hf_hub_download\n\nlocal_path = hf_hub_download(\n repo_id="${kt(e.repoId)}",\n filename="${kt(e.filename)}",\n repo_type="${kt(e.repoType)}",\n)`}var Nt=[{id:`read-file`,label:`Insert read snippet`,icon:yt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=kt(e.entry.path);if(e.backendType===`huggingface`){let t=jt(e.entry.path);return t?`${Mt(t)}\n\nwith open(local_path, "rb") as f:\n _data = f.read()\n_data`:null}return e.backendType===`obstore`?`_data = ${e.variableName}.get("${t}").bytes()\n_data`:`_data = ${e.variableName}.cat_file("${t}")\n_data`}},{id:`download-file`,label:`Insert download snippet`,icon:St,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=kt(e.entry.path);if(e.backendType===`huggingface`){let t=jt(e.entry.path);return t?`${Mt(t)}\nlocal_path`:null}if(e.backendType===`obstore`)return Ot.has(e.protocol)?null:`from datetime import timedelta\nfrom obstore import sign\n\nsigned_url = sign(\n ${e.variableName}, "GET", "${t}",\n expires_in=timedelta(hours=1),\n)\nsigned_url`;let n=kt(e.entry.path.split(`/`).pop()||`download`);return`${e.variableName}.get("${t}", "${n}")`}}],Pt=104857600;function Ft(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}var It=e=>{let t=(0,Q.c)(83),{entry:n,namespace:r,protocol:i,backendType:a,onBack:o}=e,{locale:s}=Ke(),c=rt(),l;t[0]===n.path?l=t[1]:(l=Ft(n.path),t[0]=n.path,t[1]=l);let u=l,d=n.mimeType||`text/plain`,p;t[2]===d?p=t[3]:(p=G(d),t[2]=d,t[3]=p);let m=p,h=m&&n.size>Pt&&n.size>0,g,_;t[4]!==n.path||t[5]!==m||t[6]!==r||t[7]!==h?(g=async()=>{if(h)return null;let e=await f.request({namespace:r,path:n.path,preview:!m});if(e.error)throw Error(e.error);if(!e.url)throw Error(`No URL returned`);if(m)return{type:`media`,url:e.url};let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to fetch preview: ${t.statusText}`);return{type:`text`,content:await t.text()}},_=[r,n.path,m,h],t[4]=n.path,t[5]=m,t[6]=r,t[7]=h,t[8]=g,t[9]=_):(g=t[8],_=t[9]);let{data:v,isPending:y,error:b,refetch:x}=qe(g,_),S;t[10]!==n.path||t[11]!==u||t[12]!==r?(S=async()=>{try{let e=await f.request({namespace:r,path:n.path});if(e.error){Ue({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&te(e.url,e.filename??u)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),Ue({title:`Download failed`,description:String(t),variant:`danger`})}},t[10]=n.path,t[11]=u,t[12]=r,t[13]=S):S=t[13];let C=S,w;t[14]!==c||t[15]!==a||t[16]!==n||t[17]!==r||t[18]!==i?(w=Nt.map(e=>{let t=e.getCode({variableName:r,protocol:i,entry:n,backendType:a});if(t===null)return null;let o=e.icon;return(0,$.jsx)(q,{content:e.label,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:()=>c(t),"aria-label":e.label,children:(0,$.jsx)(o,{className:`h-3.5 w-3.5`})})},e.id)}),t[14]=c,t[15]=a,t[16]=n,t[17]=r,t[18]=i,t[19]=w):w=t[19];let T=w,E;t[20]===u?E=t[21]:(E=ve(u),t[20]=u,t[21]=E);let O;t[22]!==C||t[23]!==u||t[24]!==o||t[25]!==T||t[26]!==E?(O=(0,$.jsx)(Dt,{filename:u,filenameIcon:E,onBack:o,onDownload:C,actions:T}),t[22]=C,t[23]=u,t[24]=o,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k=O,A;t[28]!==n.lastModified||t[29]!==n.path||t[30]!==n.size||t[31]!==s||t[32]!==d?(A=e=>{let{includeMime:t}=e,r=t!==void 0&&t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),(0,$.jsxs)(`div`,{className:`truncate flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[11px]`,children:n.path}),(0,$.jsx)(Ye,{value:n.path,className:`h-3 w-3`})]}),r&&(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),r&&(0,$.jsx)(`span`,{children:d}),n.size>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:st(n.size,s)})]}),n.lastModified!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Modified`}),(0,$.jsx)(`span`,{children:new Date(n.lastModified*1e3).toLocaleString()})]})]})},t[28]=n.lastModified,t[29]=n.path,t[30]=n.size,t[31]=s,t[32]=d,t[33]=A):A=t[33];let j=A;if(h){let e;t[34]===j?e=t[35]:(e=j({includeMime:!0}),t[34]=j,t[35]=e);let r;t[36]!==n.size||t[37]!==s?(r=st(n.size,s),t[36]=n.size,t[37]=s,t[38]=r):r=t[38];let i;t[39]===r?i=t[40]:(i=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-muted-foreground italic`,children:[`File is too large to preview (`,r,`).`]}),t[39]=r,t[40]=i);let a;return t[41]!==k||t[42]!==e||t[43]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[41]=k,t[42]=e,t[43]=i,t[44]=a):a=t[44],a}if(y){let e;t[45]===j?e=t[46]:(e=j({}),t[45]=j,t[46]=e);let n;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24`,children:[(0,$.jsx)(Ee,{className:`h-4 w-4 animate-spin`}),`Loading preview...`]}),t[47]=n):n=t[47];let r;return t[48]!==k||t[49]!==e?(r=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n]}),t[48]=k,t[49]=e,t[50]=r):r=t[50],r}if(b){let e;t[51]===j?e=t[52]:(e=j({includeMime:!0}),t[51]=j,t[52]=e);let n;t[53]===b.message?n=t[54]:(n=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-destructive`,children:[`Failed to load preview: `,b.message]}),t[53]=b.message,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Re,{className:`h-3 w-3 mr-1`}),t[55]=r):r=t[55];let i;t[56]===x?i=t[57]:(i=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:(0,$.jsxs)(J,{variant:`secondary`,size:`xs`,onClick:x,children:[r,`Retry`]})}),t[56]=x,t[57]=i);let a;return t[58]!==k||t[59]!==e||t[60]!==n||t[61]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n,i]}),t[58]=k,t[59]=e,t[60]=n,t[61]=i,t[62]=a):a=t[62],a}if(v){let e;t[63]===j?e=t[64]:(e=j({}),t[63]=j,t[64]=e);let n=v.type===`text`?v.content:void 0,r;t[65]!==v.type||t[66]!==v.url?(r=v.type===`media`?{url:v.url}:void 0,t[65]=v.type,t[66]=v.url,t[67]=r):r=t[67];let i;t[68]!==d||t[69]!==u||t[70]!==n||t[71]!==r?(i=(0,$.jsx)(U,{mimeType:d,filename:u,contents:n,mediaSource:r}),t[68]=d,t[69]=u,t[70]=n,t[71]=r,t[72]=i):i=t[72];let a;return t[73]!==k||t[74]!==e||t[75]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[73]=k,t[74]=e,t[75]=i,t[76]=a):a=t[76],a}let M;t[77]===j?M=t[78]:(M=j({includeMime:!0}),t[77]=j,t[78]=M);let N;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(`div`,{className:`p-4 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Se,{className:`h-4 w-4`}),`Preview not available for this file type.`]}),t[79]=N):N=t[79];let P;return t[80]!==k||t[81]!==M?(P=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,M,N]}),t[80]=k,t[81]=M,t[82]=P):P=t[82],P},Lt=16;function Rt(e){return{paddingLeft:e*Lt}}function zt(e,t){return new Date(e*1e3).toLocaleDateString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Bt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}function Vt(e){return e.endsWith(`/`)?e:`${e}/`}function Ht(e,t){let n=e.metadata?.id;return typeof n==`string`&&n.length>0?n:`${e.path}::${t}`}function Ut(e,{namespace:t,searchValue:n,entriesByPath:r}){let i=n.trim().toLowerCase(),a=e.path.toLowerCase();if(Bt(e.path).toLowerCase().includes(i)||a.includes(i))return!0;if(e.kind===`directory`){let i=r.get(v(t,Vt(e.path)));if(i)return i.some(e=>Ut(e,{namespace:t,searchValue:n,entriesByPath:r}))}return!1}function Wt(e,t){return t.searchValue.trim()?e.filter(e=>Ut(e,t)):e}var Gt=5;function Kt(e){return{query:e,status:`idle`}}function qt(e){return e.status===`idle`||e.status===`error`||e.status===`capped`}function Jt(e,t,n){return t.get(e)===void 0||n.get(e)?.nextPageToken!=null}function Yt({hasSearch:e,hasLoadedMatches:t,isPending:n,remoteSearch:r,searchKey:i,entriesByPath:a,pageMetadataByPath:o}){return!e||t||n||!qt(r)?!1:Jt(i,a,o)}function Xt(e){let t=e.trim(),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n+1)}function Zt(e,t){let n=t.trim().toLowerCase();return!n||e.path.toLowerCase().includes(n)||Bt(e.path).toLowerCase().includes(n)}var Qt=e=>{let t=(0,Q.c)(15),{depth:n,isLoading:r,error:i,onLoadMore:a}=e,o;t[0]===n?o=t[1]:(o=Rt(n),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,$.jsx)(Ee,{className:`h-3 w-3 mr-1 animate-spin`}),t[2]=r,t[3]=s);let c=r?`Loading...`:`Load more`,l;t[4]!==r||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(J,{variant:`text`,size:`xs`,className:`h-6 px-0 hover:text-blue-600`,disabled:r,onClick:a,children:[s,c]}),t[4]=r,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=i&&(0,$.jsxs)(`span`,{className:`ml-2 text-destructive`,children:[`Failed to load: `,i.message]}),t[9]=i,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`div`,{className:`py-px text-xs`,style:o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d},$t=e=>{let t=(0,Q.c)(44),{namespace:n,protocol:r,rootPath:i,backendType:a,prefix:o,depth:s,locale:c,searchValue:l,onOpenFile:d}=e,{entriesByPath:f}=u(),{entries:p,isPending:m,error:h,hasMore:g,loadMore:_,isLoadingMore:v,loadMoreError:y}=b(n,o);if(m){let e;t[0]===s?e=t[1]:(e=Rt(s),t[0]=s,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Ee,{className:`h-3 w-3 animate-spin`}),t[2]=n):n=t[2];let r;return t[3]===e?r=t[4]:(r=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 py-1 text-xs text-muted-foreground`,style:e,children:[n,`Loading...`]}),t[3]=e,t[4]=r),r}if(h){let e;t[5]===s?e=t[6]:(e=Rt(s),t[5]=s,t[6]=e);let n;return t[7]!==h.message||t[8]!==e?(n=(0,$.jsxs)(`div`,{className:`py-1 text-xs text-destructive`,style:e,children:[`Failed to load: `,h.message]}),t[7]=h.message,t[8]=e,t[9]=n):n=t[9],n}if(p.length===0){let e;t[10]===s?e=t[11]:(e=Rt(s),t[10]=s,t[11]=e);let n;return t[12]===e?n=t[13]:(n=(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:e,children:`Empty`}),t[12]=e,t[13]=n),n}let x;if(t[14]!==a||t[15]!==p||t[16]!==s||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==d||t[21]!==r||t[22]!==i||t[23]!==l){let e=Wt(p,{namespace:n,searchValue:l,entriesByPath:f}),o;t[25]!==a||t[26]!==p||t[27]!==s||t[28]!==c||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==i||t[33]!==l?(o=e=>{let t=Ht(e,p.indexOf(e));return(0,$.jsx)(en,{rowKey:t,entry:e,namespace:n,protocol:r,rootPath:i,backendType:a,depth:s,locale:c,searchValue:l,onOpenFile:d},t)},t[25]=a,t[26]=p,t[27]=s,t[28]=c,t[29]=n,t[30]=d,t[31]=r,t[32]=i,t[33]=l,t[34]=o):o=t[34],x=e.map(o),t[14]=a,t[15]=p,t[16]=s,t[17]=f,t[18]=c,t[19]=n,t[20]=d,t[21]=r,t[22]=i,t[23]=l,t[24]=x}else x=t[24];let S;t[35]!==s||t[36]!==g||t[37]!==v||t[38]!==_||t[39]!==y?(S=g&&(0,$.jsx)(Qt,{depth:s,isLoading:v,error:y,onLoadMore:_}),t[35]=s,t[36]=g,t[37]=v,t[38]=_,t[39]=y,t[40]=S):S=t[40];let C;return t[41]!==x||t[42]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[41]=x,t[42]=S,t[43]=C):C=t[43],C},en=e=>{let t=(0,Q.c)(115),{entry:n,rowKey:r,namespace:i,protocol:a,rootPath:o,backendType:c,depth:l,locale:d,searchValue:p,onOpenFile:m}=e,[h,g]=(0,Z.useState)(!1),{entriesByPath:_}=u(),y=rt(),b=n.kind===`directory`,x,S,C,w,T,E,O,k,A,M,N;if(t[0]!==c||t[1]!==l||t[2]!==_||t[3]!==n||t[4]!==b||t[5]!==h||t[6]!==i||t[7]!==m||t[8]!==a||t[9]!==r||t[10]!==p){w=Bt(n.path);let e;t[22]===p?e=t[23]:(e=p.trim(),t[22]=p,t[23]=e);let o=!!e;T=b&&o&&w.toLowerCase().includes(p.trim().toLowerCase());let u;t[24]!==_||t[25]!==n.path||t[26]!==o||t[27]!==b||t[28]!==i||t[29]!==p?(u=b&&o&&!!_.get(v(i,Vt(n.path)))?.some(e=>Ut(e,{namespace:i,searchValue:p,entriesByPath:_})),t[24]=_,t[25]=n.path,t[26]=o,t[27]=b,t[28]=i,t[29]=p,t[30]=u):u=t[30],S=h||u;let d;t[31]!==n.path||t[32]!==i?(d=async()=>{try{let e=await f.request({namespace:i,path:n.path});if(e.error){Ue({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&te(e.url,e.filename??`download`)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),Ue({title:`Download failed`,description:String(t),variant:`danger`})}},t[31]=n.path,t[32]=i,t[33]=d):d=t[33],C=d,x=s;let y=b&&`font-medium`;t[34]===y?E=t[35]:(E=j(`text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5`,y),t[34]=y,t[35]=E),t[36]===l?O=t[37]:(O=Rt(l),t[36]=l,t[37]=O),k=`${i}:${r}`,t[38]!==c||t[39]!==S||t[40]!==n||t[41]!==b||t[42]!==i||t[43]!==m||t[44]!==a?(A=()=>{b?g(!S):m({entry:n,namespace:i,protocol:a,backendType:c})},t[38]=c,t[39]=S,t[40]=n,t[41]=b,t[42]=i,t[43]=m,t[44]=a,t[45]=A):A=t[45],t[46]!==S||t[47]!==b?(M=b?(0,$.jsx)(le,{isExpanded:S,className:`h-3 w-3`}):(0,$.jsx)(`span`,{className:`w-3 shrink-0`}),t[46]=S,t[47]=b,t[48]=M):M=t[48],N=b?(0,$.jsx)(_e,{className:j(`h-3.5 w-3.5 shrink-0`,ye.directory)}):ve(w),t[0]=c,t[1]=l,t[2]=_,t[3]=n,t[4]=b,t[5]=h,t[6]=i,t[7]=m,t[8]=a,t[9]=r,t[10]=p,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=O,t[18]=k,t[19]=A,t[20]=M,t[21]=N}else x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],O=t[17],k=t[18],A=t[19],M=t[20],N=t[21];let P;t[49]===w?P=t[50]:(P=(0,$.jsx)(`span`,{className:`truncate flex-1 text-left`,children:w}),t[49]=w,t[50]=P);let V;t[51]!==n.size||t[52]!==d?(V=n.size>0&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums`,children:st(n.size,d)}),t[51]=n.size,t[52]=d,t[53]=V):V=t[53];let H;t[54]!==n.lastModified||t[55]!==d?(H=n.lastModified!=null&&(0,$.jsx)(q,{content:`Last modified: ${new Date(n.lastModified*1e3).toLocaleString()}`,children:(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap`,children:zt(n.lastModified,d)})}),t[54]=n.lastModified,t[55]=d,t[56]=H):H=t[56];let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(ue,{iconClassName:`h-3 w-3`,onClick:rn})}),t[57]=U):U=t[57];let W;t[58]!==c||t[59]!==n||t[60]!==b||t[61]!==i||t[62]!==m||t[63]!==a?(W=!b&&(0,$.jsxs)(F,{onSelect:()=>m({entry:n,namespace:i,protocol:a,backendType:c}),children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`View`]}),t[58]=c,t[59]=n,t[60]=b,t[61]=i,t[62]=m,t[63]=a,t[64]=W):W=t[64];let G;t[65]===n.path?G=t[66]:(G=async()=>{await Je(n.path),Ue({title:`Copied to clipboard`})},t[65]=n.path,t[66]=G);let K;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(he,{className:fe}),t[67]=K):K=t[67];let ee;t[68]===G?ee=t[69]:(ee=(0,$.jsxs)(F,{onSelect:G,children:[K,`Copy path`]}),t[68]=G,t[69]=ee);let J;t[70]!==C||t[71]!==b?(J=!b&&(0,$.jsxs)(F,{onSelect:()=>C(),children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[70]=C,t[71]=b,t[72]=J):J=t[72];let ne;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(I,{}),t[73]=ne):ne=t[73];let Y;t[74]!==y||t[75]!==c||t[76]!==n||t[77]!==i||t[78]!==a?(Y=Nt.map(e=>{let t=e.getCode({variableName:i,protocol:a,entry:n,backendType:c});if(t===null)return null;let r=e.icon;return(0,$.jsxs)(F,{onSelect:()=>y(t),children:[(0,$.jsx)(r,{className:fe}),e.label]},e.id)}),t[74]=y,t[75]=c,t[76]=n,t[77]=i,t[78]=a,t[79]=Y):Y=t[79];let re;t[80]!==W||t[81]!==ee||t[82]!==J||t[83]!==Y?(re=(0,$.jsxs)(z,{children:[U,(0,$.jsxs)(R,{align:`end`,onClick:an,onCloseAutoFocus:on,children:[W,ee,J,ne,Y]})]}),t[80]=W,t[81]=ee,t[82]=J,t[83]=Y,t[84]=re):re=t[84];let ie;t[85]!==re||t[86]!==V||t[87]!==H?(ie=(0,$.jsxs)(`div`,{className:`flex items-center`,children:[V,H,re]}),t[85]=re,t[86]=V,t[87]=H,t[88]=ie):ie=t[88];let X;t[89]!==x||t[90]!==E||t[91]!==ie||t[92]!==O||t[93]!==k||t[94]!==A||t[95]!==M||t[96]!==N||t[97]!==P?(X=(0,$.jsxs)(x,{className:E,style:O,value:k,onSelect:A,children:[M,N,P,ie]}),t[89]=x,t[90]=E,t[91]=ie,t[92]=O,t[93]=k,t[94]=A,t[95]=M,t[96]=N,t[97]=P,t[98]=X):X=t[98];let ae;t[99]!==c||t[100]!==l||t[101]!==S||t[102]!==n.path||t[103]!==b||t[104]!==d||t[105]!==i||t[106]!==m||t[107]!==a||t[108]!==o||t[109]!==p||t[110]!==T?(ae=b&&S&&(0,$.jsx)($t,{namespace:i,protocol:a,rootPath:o,backendType:c,prefix:Vt(n.path),depth:l+1,locale:d,searchValue:T?``:p,onOpenFile:m}),t[99]=c,t[100]=l,t[101]=S,t[102]=n.path,t[103]=b,t[104]=d,t[105]=i,t[106]=m,t[107]=a,t[108]=o,t[109]=p,t[110]=T,t[111]=ae):ae=t[111];let oe;return t[112]!==X||t[113]!==ae?(oe=(0,$.jsxs)($.Fragment,{children:[X,ae]}),t[112]=X,t[113]=ae,t[114]=oe):oe=t[114],oe},tn=e=>{let t=(0,Q.c)(66),{namespace:n,locale:r,searchValue:i,remoteSearch:a,onContinueRemoteSearch:o,onOpenFile:c}=e,[l,d]=(0,Z.useState)(!0),{entriesByPath:f,pageMetadataByPath:m}=u(),{clearNamespaceCache:h}=p(),g=n.name??n.displayName,{entries:_,isPending:y,error:x,hasMore:S,loadMore:C,isLoadingMore:w,loadMoreError:T,refetch:E}=b(g),D;t[0]!==h||t[1]!==g||t[2]!==E?(D=e=>{e.stopPropagation(),h(g),E()},t[0]=h,t[1]=g,t[2]=E,t[3]=D):D=t[3];let O=D,k=y?n.storageEntries:_,A;if(t[4]!==k||t[5]!==f||t[6]!==x||t[7]!==O||t[8]!==S||t[9]!==l||t[10]!==w||t[11]!==y||t[12]!==C||t[13]!==T||t[14]!==r||t[15]!==n.backendType||t[16]!==n.displayName||t[17]!==n.name||t[18]!==n.protocol||t[19]!==n.rootPath||t[20]!==g||t[21]!==o||t[22]!==c||t[23]!==m||t[24]!==a||t[25]!==i){let e=Wt(k,{namespace:g,searchValue:i,entriesByPath:f}),u=Xt(i),p=v(g,u),h=u===``?[]:f.get(p)??[],_=Wt(h,{namespace:g,searchValue:i,entriesByPath:f}),b;t[27]===i?b=t[28]:(b=i.trim(),t[27]=i,t[28]=b);let E=!!b,D=e.length>0||_.length>0,j=u!==``&&Yt({hasSearch:E,hasLoadedMatches:D,isPending:y,remoteSearch:a,searchKey:p,entriesByPath:f,pageMetadataByPath:m}),M=E&&e.length===0,N;bb0:{if(y&&k.length===0){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ee,{className:`h-3 w-3 animate-spin`}),`Loading...`]}),t[29]=e):e=t[29],N=e;break bb0}if(a.status===`searching`){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ee,{className:`h-3 w-3 animate-spin`}),`Searching more entries...`]}),t[30]=e):e=t[30],N=e;break bb0}if(a.status===`error`){let e;t[31]===a.error.message?e=t[32]:(e=(0,$.jsxs)(`span`,{className:`text-destructive`,children:[`Search failed: `,a.error.message]}),t[31]=a.error.message,t[32]=e),N=e;break bb0}if(a.status===`capped`){let e;t[33]===o?e=t[34]:(e=(0,$.jsx)(J,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Continue searching`}),t[33]=o,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[35]=n):n=t[35];let r;t[36]===e?r=t[37]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Searched more entries.`,e,n]}),t[36]=e,t[37]=r),N=r;break bb0}if(a.status===`exhausted`&&!D){N=`No matches`;break bb0}if(!E&&!y&&k.length===0){N=`No entries`;break bb0}if(j){let e;t[38]===o?e=t[39]:(e=(0,$.jsx)(J,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Search more entries`}),t[38]=o,t[39]=e);let n;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[40]=n):n=t[40];let r;t[41]===e?r=t[42]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`No loaded matches.`,e,n]}),t[41]=e,t[42]=r),N=r;break bb0}if(E&&!D&&k.length>0){N=`No matches`;break bb0}N=null}let P=N,F;t[43]===l?F=t[44]:(F=()=>d(!l),t[43]=l,t[44]=F);let I;t[45]===l?I=t[46]:(I=(0,$.jsx)(le,{isExpanded:l,className:`h-3 w-3`}),t[45]=l,t[46]=I);let L;t[47]===n.protocol?L=t[48]:(L=(0,$.jsx)(we,{protocol:n.protocol}),t[47]=n.protocol,t[48]=L);let R;t[49]===n.displayName?R=t[50]:(R=(0,$.jsx)(`span`,{children:n.displayName}),t[49]=n.displayName,t[50]=R);let z;t[51]===n.name?z=t[52]:(z=n.name&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-normal`,children:[`(`,(0,$.jsx)(pt,{variableName:n.name}),`)`]}),t[51]=n.name,t[52]=z);let B;t[53]===O?B=t[54]:(B=(0,$.jsx)(de,{onClick:O,tooltip:`Refresh storage connection`,className:`p-0`,iconClassName:`h-3 w-3`}),t[53]=O,t[54]=B);let V=n.rootPath||`(root)`,U;t[55]===V?U=t[56]:(U=(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-normal tabular-nums ml-auto`,children:V}),t[55]=V,t[56]=U);let W;t[57]!==n.name||t[58]!==B||t[59]!==U||t[60]!==F||t[61]!==I||t[62]!==L||t[63]!==R||t[64]!==z?(W=(0,$.jsxs)(s,{value:n.name,onSelect:F,className:`flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none`,children:[I,L,R,z,B,U]}),t[57]=n.name,t[58]=B,t[59]=U,t[60]=F,t[61]=I,t[62]=L,t[63]=R,t[64]=z,t[65]=W):W=t[65],A=(0,$.jsxs)($.Fragment,{children:[W,l&&(0,$.jsxs)($.Fragment,{children:[x&&k.length===0&&(0,$.jsx)(H,{error:x,style:Rt(1),className:`py-1 text-xs h-auto overflow-auto max-h-32 items-start`,showIcon:!1}),!x&&P&&(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:Rt(1),children:P}),e.map(e=>{let t=Ht(e,k.indexOf(e));return(0,$.jsx)(en,{rowKey:t,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},t)}),M&&_.map(e=>{let t=Ht(e,h.indexOf(e));return(0,$.jsx)(en,{rowKey:`remote-search:${t}`,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},`remote-search:${t}`)}),S&&!j&&(0,$.jsx)(Qt,{depth:1,isLoading:w,error:T,onLoadMore:C})]})]}),t[4]=k,t[5]=f,t[6]=x,t[7]=O,t[8]=S,t[9]=l,t[10]=w,t[11]=y,t[12]=C,t[13]=T,t[14]=r,t[15]=n.backendType,t[16]=n.displayName,t[17]=n.name,t[18]=n.protocol,t[19]=n.rootPath,t[20]=g,t[21]=o,t[22]=c,t[23]=m,t[24]=a,t[25]=i,t[26]=A}else A=t[26];return A},nn=()=>{let e=(0,Q.c)(63),{namespaces:t,entriesByPath:n,pageMetadataByPath:r}=u(),{locale:i}=Ke(),[a,s]=(0,Z.useState)(``),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[l,d]=(0,Z.useState)(c),[f,p]=(0,Z.useState)(null),h=o(),g;e[1]===a?g=e[2]:(g=a.trim(),e[1]=a,e[2]=g);let _=!!g,b;e[3]===a?b=e[4]:(b=a.trim(),e[3]=a,e[4]=b);let x=b,C;e[5]!==x||e[6]!==l?(C=e=>{let t=l[e];return t?.query===x?t:Kt(x)},e[5]=x,e[6]=l,e[7]=C):C=e[7];let w=C,T;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{d(n=>({...n,[e]:t}))},e[8]=T):T=e[8];let E=T,D;e[9]!==x||e[10]!==n||e[11]!==r||e[12]!==w?(D=e=>{if(!x)return!1;let t=e.name??e.displayName,i=Xt(x);if(i===``||!qt(w(t))||Wt(n.get(v(t,``))??e.storageEntries,{namespace:t,searchValue:x,entriesByPath:n}).length>0)return!1;let a=v(t,i);return Wt(n.get(a)??[],{namespace:t,searchValue:x,entriesByPath:n}).length>0?!1:Jt(a,n,r)},e[9]=x,e[10]=n,e[11]=r,e[12]=w,e[13]=D):D=e[13];let O=D,k;e[14]!==O||e[15]!==x||e[16]!==n||e[17]!==h||e[18]!==r?(k=async e=>{if(!O(e))return;let t=x,i=e.name??e.displayName,a=Xt(t),o=v(i,a),s=n.get(o),c=r.get(o)?.nextPageToken??null,l=s!==void 0;E(i,{query:t,status:`searching`});try{for(let e=0;e<Gt;e++){let e=!l||c!==null,n=[];if(e){let e=await h({namespace:i,prefix:a,pageToken:c,append:l});n=e.entries,c=e.next_page_token??null,l=!0}if((e?n:s??[]).some(e=>Zt(e,t))){E(i,{query:t,status:`found`});return}if(c===null){E(i,{query:t,status:`exhausted`});return}}E(i,{query:t,status:`capped`})}catch(e){let n=e;E(i,{query:t,status:`error`,error:n instanceof Error?n:Error(String(n))})}},e[14]=O,e[15]=x,e[16]=n,e[17]=h,e[18]=r,e[19]=k):k=e[19];let A=k,M;e[20]!==O||e[21]!==A||e[22]!==t?(M=()=>{let e=t.filter(O);for(let t of e)A(t)},e[20]=O,e[21]=A,e[22]=t,e[23]=M):M=e[23];let N=M;if(t.length===0){let t;return e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ot,{title:`No storage connected`,description:(0,$.jsxs)(`span`,{children:[`Create an obstore or fsspec connection in your notebook. See the`,` `,(0,$.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`}),`.`]}),action:(0,$.jsx)(dt,{group:`storage`,label:`Add remote storage`,variant:`outline`,size:`sm`}),icon:(0,$.jsx)(Ce,{className:`h-8 w-8`})}),e[24]=t):t=e[24],t}let P;e[25]===f?P=e[26]:(P=f&&(0,$.jsx)(It,{entry:f.entry,namespace:f.namespace,protocol:f.protocol,backendType:f.backendType,onBack:()=>p(null)}),e[25]=f,e[26]=P);let F=f&&`hidden`,I;e[27]===F?I=e[28]:(I=j(`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin`,F),e[27]=F,e[28]=I);let L;e[29]!==O||e[30]!==N||e[31]!==t?(L=e=>{e.key===`Enter`&&t.some(O)&&(e.preventDefault(),N())},e[29]=O,e[30]=N,e[31]=t,e[32]=L):L=e[32];let R;e[33]!==a||e[34]!==L?(R=(0,$.jsx)(m,{placeholder:`Search entries...`,className:`h-6 m-1`,value:a,onValueChange:s,onKeyDown:L,rootClassName:`flex-1 border-b-0`}),e[33]=a,e[34]=L,e[35]=R):R=e[35];let z;e[36]===_?z=e[37]:(z=_&&(0,$.jsx)(J,{variant:`text`,size:`xs`,className:`float-right border-none px-2 m-0 h-full`,onClick:()=>s(``),children:(0,$.jsx)(se,{className:`h-4 w-4`})}),e[36]=_,e[37]=z);let B,V;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(q,{content:`Search by file name within loaded entries, or by prefix (e.g. 'folder/x') for backend search. Press Enter to fetch more results.`,delayDuration:200,children:(0,$.jsx)(me,{className:`h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2`})}),V=(0,$.jsx)(dt,{group:`storage`,label:`Add remote storage`,compact:!0,variant:`ghost`,size:`sm`,className:`px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0`}),e[38]=B,e[39]=V):(B=e[38],V=e[39]);let H;e[40]!==R||e[41]!==z?(H=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[R,z,B,V]}),e[40]=R,e[41]=z,e[42]=H):H=e[42];let U;if(e[43]!==A||e[44]!==i||e[45]!==t||e[46]!==w||e[47]!==a){let n;e[49]!==A||e[50]!==i||e[51]!==w||e[52]!==a?(n=e=>{let t=e.name??e.displayName;return(0,$.jsx)(tn,{namespace:e,locale:i,searchValue:a,remoteSearch:w(t),onContinueRemoteSearch:()=>void A(e),onOpenFile:p},t)},e[49]=A,e[50]=i,e[51]=w,e[52]=a,e[53]=n):n=e[53],U=t.map(n),e[43]=A,e[44]=i,e[45]=t,e[46]=w,e[47]=a,e[48]=U}else U=e[48];let W;e[54]===U?W=e[55]:(W=(0,$.jsx)(y,{className:`flex flex-col`,children:U}),e[54]=U,e[55]=W);let G;e[56]!==I||e[57]!==H||e[58]!==W?(G=(0,$.jsxs)(S,{className:I,shouldFilter:!1,children:[H,W]}),e[56]=I,e[57]=H,e[58]=W,e[59]=G):G=e[59];let K;return e[60]!==G||e[61]!==P?(K=(0,$.jsxs)(`div`,{className:`h-full flex flex-col`,children:[P,G]}),e[60]=G,e[61]=P,e[62]=K):K=e[62],K};function rn(e){return e.stopPropagation()}function an(e){return e.stopPropagation()}function on(e){return e.preventDefault()}var sn=(0,Z.createContext)(null);function cn(){return(0,Z.useContext)(sn)??void 0}var ln=e=>{let t=(0,Q.c)(3),{children:n}=e,r=Ae(),i;return t[0]!==n||t[1]!==r?(i=(0,$.jsx)(sn.Provider,{value:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},un=e=>{let t=(0,Q.c)(5),{children:n}=e,[r,i]=(0,Z.useState)(null),a;t[0]!==n||t[1]!==r?(a=r&&(0,$.jsx)(je,{backend:Le,options:{rootElement:r},children:(0,$.jsx)(ln,{children:n})}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]===a?o=t[4]:(o=(0,$.jsx)(`div`,{ref:i,className:`contents`,children:a}),t[3]=a,t[4]=o),o};async function dn(e,t){if(!k()){let n=A().formatNavigableHttpURL(`api/files/download`,new URLSearchParams({path:e}));te(n.toString(),t);return}let n=await ie().sendFileDetails({path:e});if(n.isBase64&&n.contents){let e=Xe(pe(n.contents,n.mimeType||`application/octet-stream`));ee(e,t)}else ee(new Blob([n.contents||``],{type:n.mimeType||`application/octet-stream`}),t)}var fn=e=>{let t=(0,Q.c)(21),{file:n,mimeType:r,message:i,onDownload:a}=e,{locale:o}=Ke(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),t[0]=s):s=t[0];let c;t[1]===n.path?c=t[2]:(c=(0,$.jsx)(`span`,{className:`font-mono text-xs break-all`,children:n.path}),t[1]=n.path,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),t[3]=l):l=t[3];let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{children:r}),t[4]=r,t[5]=u);let d;t[6]!==n.size||t[7]!==o?(d=n.size!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:st(n.size,o)})]}),t[6]=n.size,t[7]=o,t[8]=d):d=t[8];let f;t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2`,children:[s,c,l,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(`div`,{className:`mt-4 text-muted-foreground italic`,children:i}),t[13]=i,t[14]=p);let m;t[15]===a?m=t[16]:(m=a&&(0,$.jsxs)(J,{variant:`outline`,size:`sm`,className:`mt-4`,onClick:a,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[15]=a,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`p-4 text-sm`,children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h};function pn(e,t){let n=e||`text/plain`;return G(n)?`media`:t?`unsupported`:n===`text/csv`?`csv`:n.startsWith(`text/`)||n!=="default"&&n in V||e==null?`text`:`unsupported`}var mn=10485760,hn=new Map,gn=({file:e,onOpenNotebook:t})=>{let{sendFileDetails:n,sendUpdateFile:i}=re(),a=r(T),o=r(E),s=r(C),[c,l]=(0,Z.useState)(``),{data:u,isPending:d,error:f,setData:p,refetch:m}=qe(async()=>{let t=await n({path:e.path,maxBytes:mn}),r=pn(t.mimeType,t.isBase64);if(!t.isTooLarge&&r===`text`){let n=t.contents||``;l(hn.get(e.path)??n)}return t},[e.path]),h=async()=>{c!==u?.contents&&await i({path:e.path,contents:c}).then(e=>{e.success&&(p(e=>({...e,contents:c})),l(c))})},g=(0,Z.useRef)(c);if(g.current=c,(0,Z.useEffect)(()=>()=>{if(u?.contents==null||u.isTooLarge||pn(u.mimeType,u.isBase64)!==`text`)return;let t=g.current;t===u.contents?hn.delete(e.path):hn.set(e.path,t)},[e.path,u?.contents,u?.isTooLarge,u?.mimeType,u?.isBase64]),f)return(0,$.jsx)(et,{error:f});if(d||!u)return null;let _=u.mimeType||`text/plain`,v=pn(u.mimeType,u.isBase64),y=v===`text`,b=v===`csv`,x=v===`media`,S=s&&u.file.isMarimoFile&&(e.path===s||e.path.endsWith(`/${s}`)),w=async()=>{await dn(e.path,u.file.name)},D=ne.of([{key:a.getHotkey(`global.save`).key,stopPropagation:!0,run:()=>c!==u.contents&&(h(),!0)}]),O=(0,$.jsx)(Dt,{filename:u.file.name,onRefresh:m,onDownload:o?void 0:w,actions:(0,$.jsxs)($.Fragment,{children:[e.isMarimoFile&&!k()&&(0,$.jsx)(q,{content:`Open notebook`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:e=>t(e),children:(0,$.jsx)(ge,{className:`h-3.5 w-3.5`})})}),y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{content:`Copy contents to clipboard`,children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:async()=>{await Je(c)},children:(0,$.jsx)(he,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(q,{content:tt(`global.save`),children:(0,$.jsx)(J,{variant:`text`,size:`xs`,onClick:h,disabled:c===u.contents,children:(0,$.jsx)(ze,{className:`h-3.5 w-3.5`})})})]})]})});if(u.isTooLarge||v===`unsupported`)return(0,$.jsxs)($.Fragment,{children:[O,(0,$.jsx)(fn,{file:u.file,mimeType:_,message:u.isTooLarge?`File is too large to preview.`:`This file type cannot be previewed.`,onDownload:o?void 0:w})]});let A=y&&S&&(0,$.jsxs)($e,{variant:`warning`,className:`rounded-none`,children:[(0,$.jsx)(Be,{className:`h-4 w-4`}),(0,$.jsx)(Qe,{children:`Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution.`})]}),j=x&&u.contents?W({contents:u.contents,mimeType:_,isBase64:u.isBase64??!1}):void 0;return(0,$.jsxs)($.Fragment,{children:[O,A,(0,$.jsx)(U,{mimeType:_,filename:u.file.name,contents:y?c:b?u.contents??void 0:void 0,mediaSource:j,readOnly:!y,onChange:y?l:void 0,extensions:y?[D]:[]})]})},_n=n(e=>{let t=e(Y);return O(t,`no requestClientAtom set`),new ke({listFiles:t.sendListFiles,createFileOrFolder:t.sendCreateFileOrFolder,deleteFileOrFolder:t.sendDeleteFileOrFolder,copyFileOrFolder:t.sendCopyFileOrFolder,renameFileOrFolder:t.sendRenameFileOrFolder})}),vn=n({}),yn=` `,bn={directory:e=>`os.listdir("${e}")`,python:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,json:e=>`with open("${e}", "r") as _f:\n${yn}_data = json.load(_f)\n`,code:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,text:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,image:e=>`mo.image("${e}")`,audio:e=>`mo.audio("${e}")`,video:e=>`mo.video("${e}")`,pdf:e=>`with open("${e}", "rb") as _f:\n${yn}...\n`,zip:e=>`with open("${e}", "rb") as _f:\n${yn}...\n`,data:e=>`with open("${e}", "r") as _f:\n${yn}...\n`,unknown:e=>`with open("${e}", "r") as _f:\n${yn}...\n`},xn=104857600,Sn=5,Cn=`data-file-explorer-directory-path`;function wn(e){let{destinationPath:t,getDestinationLabel:n=e=>e,onUploadStart:r,refreshDestination:i,...a}=e,{sendCreateFileOrFolder:o}=re();return He({multiple:!0,maxSize:xn,...a,onError:e=>{D.error(e),Ue({title:`File upload failed`,description:e.message,variant:`danger`})},onDropRejected:e=>{Ue({title:`File upload failed`,description:(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,$.jsxs)(`div`,{children:[e.file.name,` (`,e.errors.map(e=>e.message).join(`, `),`)`]},e.file.name))}),variant:`danger`})},onDrop:async(e,a,s)=>{if(e.length===0)return;let c=typeof t==`function`?t(s):t,l=n(c),u=e.length===1?`Uploading file to ${l}...`:`Uploading files to ${l}...`;r?.(c,e);let d;try{d=await K(u,async t=>(t.addTotal(e.length),Tn({files:e,destinationPath:c,createFile:o,onFileProcessed:()=>t.increment(1)})))}catch{await i(c);return}await i(c),On(d,l)}})}async function Tn({files:e,destinationPath:t,createFile:n,onFileProcessed:r}){let i=await at(e,Sn,async e=>{try{return{file:e,response:await n({path:En({destinationPath:t,filePath:An(kn(e))}),type:`file`,name:e.name,file:e})}}catch(t){return{file:e,response:{success:!1,message:Ze(t)}}}finally{r?.()}});return{successful:i.filter(({response:e})=>e.success),failed:i.filter(({response:e})=>!e.success)}}function En({destinationPath:e,filePath:t}){if(!t)return e;if(We.isAbsolute(t))throw Error(`Upload path must be relative: ${t}`);let n=t.split(/[\\/]+/).slice(0,-1).filter(Boolean);if(n.includes(`..`))throw Error(`Upload path cannot contain parent traversal: ${t}`);let r=n.filter(e=>e!==`.`);if(r.length===0)return e;let i=Ge.guessDeliminator(e),a=r.join(i.deliminator);return i.join(e,a)}function Dn(e,t){return e instanceof Element&&e.closest(`[${Cn}]`)?.getAttribute(Cn)||t}function On(e,t){let n=e.successful.length+e.failed.length;if(e.failed.length>0){let r;r=e.successful.length===0?n===1?`File upload failed`:`Files failed to upload`:`${e.successful.length} of ${n} files uploaded`,Ue({title:r,description:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Destination: `,t,`.`]}),e.failed.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,`:`,` `,t.message||`The server rejected the upload.`]},`${e.name}-${n}`))]}),variant:`danger`});return}let r=e.successful.filter(({file:e,response:t})=>t.info?.name&&t.info.name!==e.name);Ue({title:n===1?`File uploaded`:`${n} files uploaded`,description:r.length===0?`Uploaded to ${t}.`:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Uploaded to `,t,`.`]}),r.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,` was saved as `,t.info?.name,`.`]},`${e.name}-${n}`))]})})}function kn(e){if(e.webkitRelativePath)return e.webkitRelativePath;if(`path`in e&&typeof e.path==`string`)return e.path;if(`relativePath`in e&&typeof e.relativePath==`string`)return e.relativePath}function An(e){if(e)return e.replace(/^\/+/,``)}var jn=c(`marimo:showHiddenFiles`,!0,_,{getOnInit:!0}),Mn=Z.createContext(null),Nn=e=>{let n=(0,Q.c)(107),{height:r,externalDropDestinationPath:a}=e,o=a===void 0?null:a,s=(0,Z.useRef)(null),c=cn(),[l]=t(_n),u;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[0]=u):u=n[0];let[d,f]=(0,Z.useState)(u),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[_,v]=t(jn),[y,b]=t(vn),x;n[1]===l?x=n[2]:(x=e=>l.refreshPath(e),n[1]=l,n[2]=x);let S=i(x),C=(0,Z.useRef)(``),w;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>C.current,n[3]=w):w=n[3];let T;n[4]===l?T=n[5]:(T=e=>Bn(l,e),n[4]=l,n[5]=T);let E;n[6]!==S||n[7]!==T?(E={noClick:!0,noDrag:!0,noKeyboard:!0,destinationPath:w,getDestinationLabel:T,refreshDestination:S},n[6]=S,n[7]=T,n[8]=E):E=n[8];let{getInputProps:D,open:O}=wn(E),k;n[9]===O?k=n[10]:(k=e=>{C.current=e,O()},n[9]=O,n[10]=k);let A=i(k),{openPrompt:j}=Te(),M;n[11]===l?M=n[12]:(M=()=>l.initialize(f),n[11]=l,n[12]=M);let N;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],n[13]=N):N=n[13];let{isPending:P,error:F}=qe(M,N),I;n[14]!==y||n[15]!==l?(I=()=>l.refreshAll(Object.keys(y).filter(e=>y[e])),n[14]=y,n[15]=l,n[16]=I):I=n[16];let L=i(I),R;n[17]!==v||n[18]!==_?(R=()=>{v(!_)},n[17]=v,n[18]=_,n[19]=R):R=n[19];let z=i(R),B;n[20]!==j||n[21]!==l?(B=async()=>{j({title:`Folder name`,onConfirm:async e=>{l.createFolder(e,null)}})},n[20]=j,n[21]=l,n[22]=B):B=n[22];let V=i(B),H;n[23]!==j||n[24]!==l?(H=async()=>{j({title:`File name`,onConfirm:async e=>{l.createFile({name:e,parentId:null})}})},n[23]=j,n[24]=l,n[25]=H):H=n[25];let U=i(H),W;n[26]!==j||n[27]!==l?(W=async()=>{j({title:`Notebook name`,onConfirm:async e=>{l.createFile({name:e,parentId:null,type:`notebook`})}})},n[26]=j,n[27]=l,n[28]=W):W=n[28];let G=i(W),K;n[29]===b?K=n[30]:(K=()=>{s.current?.closeAll(),b({})},n[29]=b,n[30]=K);let ee=i(K),te;n[31]!==d||n[32]!==_?(te=Vn(d,_),n[31]=d,n[32]=_,n[33]=te):te=n[33];let q=te,ne,Y;n[34]!==h||n[35]!==q?(ne=()=>{h&&!Un(q,h)&&g(null)},Y=[h,q],n[34]=h,n[35]=q,n[36]=ne,n[37]=Y):(ne=n[36],Y=n[37]),Z.useEffect(ne,Y);let re;n[38]!==o||n[39]!==A||n[40]!==l?(re={tree:l,uploadFiles:A,externalDropDestinationPath:o},n[38]=o,n[39]=A,n[40]=l,n[41]=re):re=n[41];let ie=re;if(P){let e;return n[42]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(De,{size:`medium`,centered:!0}),n[42]=e):e=n[42],e}if(F){let e;return n[43]===F?e=n[44]:(e=(0,$.jsx)(et,{error:F}),n[43]=F,n[44]=e),e}if(p){let e;n[45]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>m(null),n[45]=e):e=n[45];let t;n[46]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(J,{onClick:e,"data-testid":`file-explorer-back-button`,variant:`text`,size:`xs`,className:`mb-0`,children:(0,$.jsx)(ae,{size:16})}),n[46]=t):t=n[46];let r;n[47]===p.name?r=n[48]:(r=(0,$.jsxs)(`div`,{className:`flex items-center pl-1 pr-3 shrink-0 border-b justify-between`,children:[t,(0,$.jsx)(`span`,{className:`font-bold`,children:p.name})]}),n[47]=p.name,n[48]=r);let i;n[49]!==p.path||n[50]!==l?(i=e=>zn(e,l.relativeFromRoot(p.path)),n[49]=p.path,n[50]=l,n[51]=i):i=n[51];let a;n[52]!==p||n[53]!==i?(a=(0,$.jsx)(Z.Suspense,{children:(0,$.jsx)(gn,{onOpenNotebook:i,file:p})}),n[52]=p,n[53]=i,n[54]=a):a=n[54];let o;return n[55]!==r||n[56]!==a?(o=(0,$.jsxs)($.Fragment,{children:[r,a]}),n[55]=r,n[56]=a,n[57]=o):o=n[57],o}let X;n[58]===D?X=n[59]:(X=D(),n[58]=D,n[59]=X);let oe;n[60]===X?oe=n[61]:(oe=(0,$.jsx)(`input`,{"data-testid":`file-explorer-upload-input`,...X}),n[60]=X,n[61]=oe);let se;n[62]!==h||n[63]!==l?(se=h??l.getRootPath(),n[62]=h,n[63]=l,n[64]=se):se=n[64];let ce;n[65]!==h||n[66]!==l?(ce=h??l.getRootPath(),n[65]=h,n[66]=l,n[67]=ce):ce=n[67];let le;n[68]!==ce||n[69]!==l?(le=Bn(l,ce),n[68]=ce,n[69]=l,n[70]=le):le=n[70];let ue;n[71]!==ee||n[72]!==U||n[73]!==V||n[74]!==G||n[75]!==z||n[76]!==L||n[77]!==A||n[78]!==_||n[79]!==se||n[80]!==le?(ue=(0,$.jsx)(Fn,{onRefresh:L,onHidden:z,showHiddenFiles:_,onCreateFile:U,onCreateNotebook:G,onCreateFolder:V,onCollapseAll:ee,uploadDestinationPath:se,uploadDestinationLabel:le,onUpload:A}),n[71]=ee,n[72]=U,n[73]=V,n[74]=G,n[75]=z,n[76]=L,n[77]=A,n[78]=_,n[79]=se,n[80]=le,n[81]=ue):ue=n[81];let de=r-33,fe,pe,me;n[82]===l?(fe=n[83],pe=n[84],me=n[85]):(fe=async e=>{let{ids:t}=e;for(let e of t)await l.delete(e)},pe=async e=>{let{id:t,name:n}=e;await l.rename(t,n)},me=async e=>{let{dragIds:t,parentId:n}=e;await l.move(t,n)},n[82]=l,n[83]=fe,n[84]=pe,n[85]=me);let he;n[86]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>{let t=e[0];if(!t){g(null);return}if(t.data.isDirectory){g(t.data.path);return}g(null),m(t.data)},n[86]=he):he=n[86];let ge;n[87]!==y||n[88]!==b||n[89]!==l?(ge=async e=>{if(await l.expand(e)){let t=y[e]??!1;b({...y,[e]:!t})}},n[87]=y,n[88]=b,n[89]=l,n[90]=ge):ge=n[90];let _e;n[91]!==c||n[92]!==y||n[93]!==de||n[94]!==fe||n[95]!==pe||n[96]!==me||n[97]!==ge||n[98]!==q?(_e=(0,$.jsx)(Ne,{width:`100%`,ref:s,height:de,className:`h-full`,data:q,initialOpenState:y,openByDefault:!1,dndManager:c,renderCursor:Wn,disableDrop:Gn,onDelete:fe,onRename:pe,onMove:me,onSelect:he,onToggle:ge,padding:15,rowHeight:30,indent:Pn,overscanCount:1e3,disableMultiSelection:!0,children:Ln}),n[91]=c,n[92]=y,n[93]=de,n[94]=fe,n[95]=pe,n[96]=me,n[97]=ge,n[98]=q,n[99]=_e):_e=n[99];let ve;n[100]!==ie||n[101]!==_e?(ve=(0,$.jsx)(Mn,{value:ie,children:_e}),n[100]=ie,n[101]=_e,n[102]=ve):ve=n[102];let ye;return n[103]!==oe||n[104]!==ue||n[105]!==ve?(ye=(0,$.jsxs)($.Fragment,{children:[oe,ue,ve]}),n[103]=oe,n[104]=ue,n[105]=ve,n[106]=ye):ye=n[106],ye},Pn=15,Fn=e=>{let t=(0,Q.c)(35),{onRefresh:n,onHidden:r,showHiddenFiles:i,onCreateFile:a,onCreateNotebook:o,onCreateFolder:s,onCollapseAll:c,uploadDestinationPath:l,uploadDestinationLabel:u,onUpload:d}=e,f=`Upload files to ${u}`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ht,{size:16}),t[0]=p):p=t[0];let m;t[1]===o?m=t[2]:(m=(0,$.jsx)(q,{content:`Add notebook`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-add-notebook-button`,onClick:o,variant:`text`,size:`xs`,children:p})}),t[1]=o,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(xt,{size:16}),t[3]=h):h=t[3];let g;t[4]===a?g=t[5]:(g=(0,$.jsx)(q,{content:`Add file`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-add-file-button`,onClick:a,variant:`text`,size:`xs`,children:h})}),t[4]=a,t[5]=g);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ct,{size:16}),t[6]=_):_=t[6];let v;t[7]===s?v=t[8]:(v=(0,$.jsx)(q,{content:`Add folder`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-add-folder-button`,onClick:s,variant:`text`,size:`xs`,children:_})}),t[7]=s,t[8]=v);let y;t[9]!==d||t[10]!==l?(y=()=>d(l),t[9]=d,t[10]=l,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Ve,{size:16}),t[12]=b):b=t[12];let x;t[13]!==y||t[14]!==f?(x=(0,$.jsx)(J,{"data-testid":`file-explorer-upload-button`,"aria-label":f,onClick:y,variant:`text`,size:`xs`,children:b}),t[13]=y,t[14]=f,t[15]=x):x=t[15];let S;t[16]!==x||t[17]!==f?(S=(0,$.jsx)(q,{content:f,children:x}),t[16]=x,t[17]=f,t[18]=S):S=t[18];let C;t[19]===n?C=t[20]:(C=(0,$.jsx)(de,{"data-testid":`file-explorer-refresh-button`,onClick:n}),t[19]=n,t[20]=C);let w;t[21]!==r||t[22]!==i?(w=(0,$.jsx)(ce,{"data-testid":`file-explorer-hidden-files-button`,isVisible:i,onToggle:r,showTooltip:`Show hidden files`,hideTooltip:`Hide hidden files`}),t[21]=r,t[22]=i,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(bt,{size:16}),t[24]=T):T=t[24];let E;t[25]===c?E=t[26]:(E=(0,$.jsx)(q,{content:`Collapse all folders`,children:(0,$.jsx)(J,{"data-testid":`file-explorer-collapse-button`,onClick:c,variant:`text`,size:`xs`,children:T})}),t[25]=c,t[26]=E);let D;return t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==E||t[31]!==m||t[32]!==g||t[33]!==v?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-end px-2 shrink-0 border-b`,children:[m,g,v,S,C,w,E]}),t[27]=S,t[28]=C,t[29]=w,t[30]=E,t[31]=m,t[32]=g,t[33]=v,t[34]=D):D=t[34],D},In=e=>{let t=(0,Q.c)(9),{node:n,onOpenMarimoFile:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=i);let a;t[2]!==n.data.isMarimoFile||t[3]!==r?(a=n.data.isMarimoFile&&!k()&&(0,$.jsxs)(`span`,{"data-testid":`file-explorer-open-marimo-button`,className:`shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline`,onClick:r,children:[`open `,(0,$.jsx)(ge,{className:`inline ml-1`,size:12})]}),t[2]=n.data.isMarimoFile,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==n.data.name||t[6]!==i||t[7]!==a?(o=(0,$.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,onClick:i,children:[n.data.name,a]}),t[5]=n.data.name,t[6]=i,t[7]=a,t[8]=o):o=t[8],o},Ln=e=>{let t=(0,Q.c)(123),{node:n,style:a,dragHandle:o}=e,{openFile:s}=re(),c=r(E),u;t[0]!==n.data.isDirectory||t[1]!==n.data.name?(u=n.data.isDirectory?`directory`:be(n.data.name),t[0]=n.data.isDirectory,t[1]=n.data.name,t[2]=u):u=t[2];let d=u,f=xe[d],{openConfirm:p,openPrompt:m}=Te(),{createNewCell:h}=l(),_=g(),v;t[3]!==h||t[4]!==_?(v=e=>{h({code:e,before:!1,cellId:_??`__end__`})},t[3]=h,t[4]=_,t[5]=v):v=t[5];let y=v,b=(0,Z.use)(Mn),S=b?.tree,C=n.data.isDirectory&&b?.externalDropDestinationPath===n.data.path,w;t[6]!==n.data.path||t[7]!==S?(w=async e=>{zn(e,S?S.relativeFromRoot(n.data.path):n.data.path)},t[6]=n.data.path,t[7]=S,t[8]=w):w=t[8];let T=w,D;t[9]!==n.data.name||t[10]!==n.id||t[11]!==n.tree||t[12]!==p?(D=async e=>{e.stopPropagation(),e.preventDefault(),p({title:`Delete file`,description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,$.jsx)(P,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":`Confirm`,children:`Delete`})})},t[9]=n.data.name,t[10]=n.id,t[11]=n.tree,t[12]=p,t[13]=D):D=t[13];let O=D,A;t[14]!==n||t[15]!==m||t[16]!==S?(A=async()=>{n.open(),m({title:`Folder name`,onConfirm:async e=>{S?.createFolder(e,n.id)}})},t[14]=n,t[15]=m,t[16]=S,t[17]=A):A=t[17];let M=i(A),N;t[18]!==n||t[19]!==m||t[20]!==S?(N=async()=>{n.open(),m({title:`File name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id})}})},t[18]=n,t[19]=m,t[20]=S,t[21]=N):N=t[21];let L=i(N),R;t[22]!==n||t[23]!==m||t[24]!==S?(R=async()=>{n.open(),m({title:`Notebook name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id,type:`notebook`})}})},t[22]=n,t[23]=m,t[24]=S,t[25]=R):R=t[25];let z=i(R),V;t[26]!==n.data.name||t[27]!==n.id||t[28]!==S?(V=async()=>{S&&await S.copy(n.id,it(n.data.name))},t[26]=n.data.name,t[27]=n.id,t[28]=S,t[29]=V):V=t[29];let H=i(V),U;t[30]!==n.data.isDirectory||t[31]!==n.data.path?(U=n.data.isDirectory?{[Cn]:n.data.path}:{},t[30]=n.data.isDirectory,t[31]=n.data.path,t[32]=U):U=t[32];let W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(W=j(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group`),t[33]=W):W=t[33];let G,K;t[34]===n?(G=t[35],K=t[36]):(G=e=>{e.stopPropagation(),n.data.isDirectory&&(n.select(),n.toggle())},K=(0,$.jsx)(Rn,{node:n}),t[34]=n,t[35]=G,t[36]=K);let ee=n.willReceiveDrop&&n.data.isDirectory&&`bg-accent/80 hover:bg-accent/80 text-accent-foreground`,te=n.isSelected&&`bg-accent/60 hover:bg-accent/60 text-accent-foreground`,q=C&&`bg-primary/15 hover:bg-primary/15 text-accent-foreground ring-1 ring-inset ring-primary`,J;t[37]!==ee||t[38]!==te||t[39]!==q?(J=j(`flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group`,ee,te,q),t[37]=ee,t[38]=te,t[39]=q,t[40]=J):J=t[40];let ne;t[41]!==f||t[42]!==d||t[43]!==n.data.isMarimoFile?(ne=n.data.isMarimoFile?(0,$.jsx)(gt,{className:`w-5 h-5 shrink-0 mr-2`,strokeWidth:1.5}):(0,$.jsx)(f,{className:j(`w-5 h-5 shrink-0 mr-2`,ye[d]),strokeWidth:1.5}),t[41]=f,t[42]=d,t[43]=n.data.isMarimoFile,t[44]=ne):ne=t[44];let Y;t[45]!==T||t[46]!==n?(Y=n.isEditing?(0,$.jsx)(Ie,{node:n}):(0,$.jsx)(In,{node:n,onOpenMarimoFile:T}),t[45]=T,t[46]=n,t[47]=Y):Y=t[47];let ie;t[48]===n?ie=t[49]:(ie=!n.data.isDirectory&&(0,$.jsxs)(F,{onSelect:()=>n.select(),"data-testid":`file-explorer-open-file-menu-item`,children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`Open file`]}),t[48]=n,t[49]=ie);let X;t[50]!==n.data.isDirectory||t[51]!==n.data.path||t[52]!==s?(X=!n.data.isDirectory&&!k()&&(0,$.jsxs)(F,{onSelect:()=>{s({path:n.data.path})},"data-testid":`file-explorer-open-external-menu-item`,children:[(0,$.jsx)(ge,{className:`h-3.5 w-3.5 mr-2`}),`Open file in external editor`]}),t[50]=n.data.isDirectory,t[51]=n.data.path,t[52]=s,t[53]=X):X=t[53];let ae;t[54]!==b||t[55]!==L||t[56]!==M||t[57]!==z||t[58]!==n.data.isDirectory||t[59]!==n.data.path?(ae=n.data.isDirectory&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{onSelect:()=>z(),"data-testid":`file-explorer-create-notebook-menu-item`,children:[(0,$.jsx)(ht,{className:`h-3.5 w-3.5 mr-2`}),`Create notebook`]}),(0,$.jsxs)(F,{onSelect:()=>L(),"data-testid":`file-explorer-create-file-menu-item`,children:[(0,$.jsx)(xt,{className:`h-3.5 w-3.5 mr-2`}),`Create file`]}),(0,$.jsxs)(F,{onSelect:()=>M(),"data-testid":`file-explorer-create-folder-menu-item`,children:[(0,$.jsx)(Ct,{className:`h-3.5 w-3.5 mr-2`}),`Create folder`]}),(0,$.jsxs)(F,{onSelect:()=>b?.uploadFiles(n.data.path),"data-testid":`file-explorer-upload-files-menu-item`,children:[(0,$.jsx)(Ve,{className:`h-3.5 w-3.5 mr-2`}),`Upload files here`]}),(0,$.jsx)(I,{})]}),t[54]=b,t[55]=L,t[56]=M,t[57]=z,t[58]=n.data.isDirectory,t[59]=n.data.path,t[60]=ae):ae=t[60];let se;t[61]===n?se=t[62]:(se=(0,$.jsx)(Oe,{onSelect:()=>n.edit(),testId:`file-explorer-rename-menu-item`}),t[61]=n,t[62]=se);let ce;t[63]===H?ce=t[64]:(ce=(0,$.jsx)(Fe,{onSelect:H,testId:`file-explorer-duplicate-menu-item`}),t[63]=H,t[64]=ce);let le;t[65]===n.data.path?le=t[66]:(le=async()=>{await Je(n.data.path),Ue({title:`Copied to clipboard`})},t[65]=n.data.path,t[66]=le);let ue;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(wt,{className:fe}),t[67]=ue):ue=t[67];let de;t[68]===le?de=t[69]:(de=(0,$.jsxs)(F,{onSelect:le,"data-testid":`file-explorer-copy-path-menu-item`,children:[ue,`Copy path`]}),t[68]=le,t[69]=de);let pe;t[70]!==n.data.path||t[71]!==S?(pe=S&&(0,$.jsxs)(F,{onSelect:async()=>{await Je(S.relativeFromRoot(n.data.path)),Ue({title:`Copied to clipboard`})},"data-testid":`file-explorer-copy-relative-path-menu-item`,children:[(0,$.jsx)(wt,{className:`h-3.5 w-3.5 mr-2`}),`Copy relative path`]}),t[70]=n.data.path,t[71]=S,t[72]=pe):pe=t[72];let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(I,{}),t[73]=me):me=t[73];let he;t[74]!==d||t[75]!==y||t[76]!==n.data?(he=()=>{let{path:e}=n.data,t=bn[d](e);y(t)},t[74]=d,t[75]=y,t[76]=n.data,t[77]=he):he=t[77];let _e;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(oe,{className:fe}),t[78]=_e):_e=t[78];let ve;t[79]===he?ve=t[80]:(ve=(0,$.jsxs)(F,{onSelect:he,"data-testid":`file-explorer-insert-snippet-menu-item`,children:[_e,`Insert snippet for reading file`]}),t[79]=he,t[80]=ve);let Se;t[81]!==d||t[82]!==n.data?(Se=async()=>{Ue({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:e}=n.data,t=bn[d](e);await Je(t)},t[81]=d,t[82]=n.data,t[83]=Se):Se=t[83];let Ce;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(x,{className:fe}),t[84]=Ce):Ce=t[84];let we;t[85]===Se?we=t[86]:(we=(0,$.jsxs)(F,{onSelect:Se,"data-testid":`file-explorer-copy-snippet-menu-item`,children:[Ce,`Copy snippet for reading file`]}),t[85]=Se,t[86]=we);let Ee;t[87]!==T||t[88]!==n.data.isMarimoFile?(Ee=n.data.isMarimoFile&&!k()&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:T,"data-testid":`file-explorer-open-notebook-menu-item`,children:[(0,$.jsx)(Tt,{className:`h-3.5 w-3.5 mr-2`}),`Open notebook`]})]}),t[87]=T,t[88]=n.data.isMarimoFile,t[89]=Ee):Ee=t[89];let De;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,$.jsx)(I,{}),t[90]=De):De=t[90];let ke;t[91]!==c||t[92]!==n.data.isDirectory||t[93]!==n.data.name||t[94]!==n.data.path?(ke=!n.data.isDirectory&&!c&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{onSelect:async()=>{await dn(n.data.path,n.data.name)},"data-testid":`file-explorer-download-menu-item`,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),(0,$.jsx)(I,{})]}),t[91]=c,t[92]=n.data.isDirectory,t[93]=n.data.name,t[94]=n.data.path,t[95]=ke):ke=t[95];let Ae;t[96]===O?Ae=t[97]:(Ae=(0,$.jsx)(Pe,{onSelect:O,testId:`file-explorer-delete-menu-item`}),t[96]=O,t[97]=Ae);let je;t[98]!==ie||t[99]!==X||t[100]!==ae||t[101]!==se||t[102]!==ce||t[103]!==de||t[104]!==pe||t[105]!==ve||t[106]!==we||t[107]!==Ee||t[108]!==ke||t[109]!==Ae?(je=(0,$.jsxs)(Me,{testId:`file-explorer-more-button`,iconClassName:`w-5 h-5`,children:[ie,X,ae,se,ce,de,pe,me,ve,we,Ee,De,ke,Ae]}),t[98]=ie,t[99]=X,t[100]=ae,t[101]=se,t[102]=ce,t[103]=de,t[104]=pe,t[105]=ve,t[106]=we,t[107]=Ee,t[108]=ke,t[109]=Ae,t[110]=je):je=t[110];let Ne;t[111]!==J||t[112]!==ne||t[113]!==Y||t[114]!==je?(Ne=(0,$.jsxs)(`span`,{className:J,children:[ne,Y,je]}),t[111]=J,t[112]=ne,t[113]=Y,t[114]=je,t[115]=Ne):Ne=t[115];let Le;return t[116]!==o||t[117]!==a||t[118]!==G||t[119]!==K||t[120]!==Ne||t[121]!==U?(Le=(0,$.jsxs)(`div`,{style:a,ref:o,...U,className:W,draggable:!0,onClick:G,children:[K,Ne]}),t[116]=o,t[117]=a,t[118]=G,t[119]=K,t[120]=Ne,t[121]=U,t[122]=Le):Le=t[122],Le},Rn=e=>{let t=(0,Q.c)(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`w-4 h-4 shrink-0`}),t[0]=e):e=t[0],e}let r;return t[1]===n.isOpen?r=t[2]:(r=(0,$.jsx)(le,{isExpanded:n.isOpen,className:`w-4 h-4`}),t[1]=n.isOpen,t[2]=r),r};function zn(e,t){e.stopPropagation(),e.preventDefault(),_t(t)}function Bn(e,t){return t===e.getRootPath()?`workspace root`:e.relativeFromRoot(t)}function Vn(e,t){if(t)return e;let n=[];for(let r of e){if(Hn(r.name))continue;let e=r;if(r.children){let n=Vn(r.children,t);n!==r.children&&(e={...r,children:n})}n.push(e)}return n}function Hn(e){return!!e.startsWith(`.`)}function Un(e,t){return e.some(e=>e.path===t||(e.children?Un(e.children,t):!1))}function Wn(){return null}function Gn(e){let{parentNode:t}=e;return!t.data.isDirectory}var Kn=e=>{let t=(0,Q.c)(44),{height:n}=e,i=r(_n),[a,o]=(0,Z.useState)(null),s;t[0]===i?s=t[1]:(s=e=>qn(e,i.getRootPath()),t[0]=i,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=e=>i.refreshPath(e),t[2]=i,t[3]=l);let u=l,d;t[4]===i?d=t[5]:(d=e=>Bn(i,e),t[4]=i,t[5]=d);let f,p;t[6]===c?(f=t[7],p=t[8]):(f=e=>o(c(e)),p=e=>o(c(e)),t[6]=c,t[7]=f,t[8]=p);let m,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o(null),h=()=>o(null),t[9]=m,t[10]=h):(m=t[9],h=t[10]);let g;t[11]!==c||t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(g={noClick:!0,noKeyboard:!0,destinationPath:c,getDestinationLabel:d,refreshDestination:u,onDragEnter:f,onDragOver:p,onDragLeave:m,onUploadStart:h},t[11]=c,t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=g):g=t[16];let{getRootProps:_,getInputProps:v,isDragActive:y}=wn(g),b;t[17]!==a||t[18]!==i?(b=a??i.getRootPath(),t[17]=a,t[18]=i,t[19]=b):b=t[19];let x=b,S;t[20]!==x||t[21]!==i?(S=Bn(i,x),t[20]=x,t[21]=i,t[22]=S):S=t[22];let C=S,w;t[23]===_?w=t[24]:(w=_(),t[23]=_,t[24]=w);let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=j(`flex flex-col overflow-hidden relative`),t[25]=T):T=t[25];let E;t[26]===n?E=t[27]:(E={height:n},t[26]=n,t[27]=E);let D;t[28]===v?D=t[29]:(D=v(),t[28]=v,t[29]=D);let O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`input`,{...D}),t[30]=D,t[31]=O);let k;t[32]!==C||t[33]!==y?(k=y&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-start justify-center pt-3 bg-accent/20 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none`,children:(0,$.jsxs)(`span`,{className:`px-3 py-1.5 rounded-md bg-background/95 border shadow-sm text-sm font-semibold text-primary`,children:[`Drop files into `,C]})}),t[32]=C,t[33]=y,t[34]=k):k=t[34];let A=y?x:null,M;t[35]!==n||t[36]!==A?(M=(0,$.jsx)(Nn,{height:n,externalDropDestinationPath:A}),t[35]=n,t[36]=A,t[37]=M):M=t[37];let N;return t[38]!==w||t[39]!==E||t[40]!==O||t[41]!==k||t[42]!==M?(N=(0,$.jsx)(un,{children:(0,$.jsxs)(`div`,{...w,className:T,style:E,children:[O,k,M]})}),t[38]=w,t[39]=E,t[40]=O,t[41]=k,t[42]=M,t[43]=N):N=t[43],N};function qn(e,t){return Array.isArray(e)?t:Dn(e.target,t)}var Jn=()=>{let e=(0,Q.c)(40),{ref:n,height:i}=nt(),a=i===void 0?500:i,[o,s]=t(vt),c=r(d).length,l=h(`storage`),u;bb0:{if(!o.hasUserInteracted&&c>0){if(o.openSections.includes(`remote-storage`)){u=o.openSections;break bb0}let t;e[0]===o.openSections?t=e[1]:(t=[...o.openSections,`remote-storage`],e[0]=o.openSections,e[1]=t),u=t;break bb0}u=o.openSections}let f=u,p;e[2]===s?p=e[3]:(p=e=>{s({openSections:e,hasUserInteracted:!0})},e[2]=s,e[3]=p);let m=p,g=a-66,_;e[4]===f?_=e[5]:(_=f.includes(`remote-storage`),e[4]=f,e[5]=_);let v=_,y=l.length>0,b;e[6]!==f||e[7]!==v?(b=v&&f.includes(`files`),e[6]=f,e[7]=v,e[8]=b):b=e[8];let x=b,S;e[9]!==g||e[10]!==x?(S=x?Math.round(g*.4):g,e[9]=g,e[10]=x,e[11]=S):S=e[11];let C=S,w=Math.max(200,x?g-C:g),T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ce,{className:`w-4 h-4`}),e[12]=T):T=e[12];let E;e[13]===c?E=e[14]:(E=c>0&&(0,$.jsx)(ct,{children:c}),e[13]=c,e[14]=E);let D;e[15]!==l.length||e[16]!==y?(D=y&&(0,$.jsx)(mt,{count:l.length,type:`storage`}),e[15]=l.length,e[16]=y,e[17]=D):D=e[17];let O;e[18]!==E||e[19]!==D?(O=(0,$.jsxs)(lt,{children:[T,` Remote storage`,E,D]}),e[18]=E,e[19]=D,e[20]=O):O=e[20];let k;e[21]===C?k=e[22]:(k={maxHeight:C},e[21]=C,e[22]=k);let A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(nn,{}),e[23]=A):A=e[23];let j;e[24]===k?j=e[25]:(j=(0,$.jsx)(ut,{className:`overflow-auto`,style:k,children:A}),e[24]=k,e[25]=j);let M;e[26]!==j||e[27]!==O?(M=(0,$.jsxs)(ft,{value:`remote-storage`,children:[O,j]}),e[26]=j,e[27]=O,e[28]=M):M=e[28];let P;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsxs)(lt,{children:[(0,$.jsx)(Se,{className:`w-4 h-4`}),`Files`]}),e[29]=P):P=e[29];let F;e[30]===w?F=e[31]:(F=(0,$.jsxs)(ft,{value:`files`,children:[P,(0,$.jsx)(ut,{children:(0,$.jsx)(Kn,{height:w})})]}),e[30]=w,e[31]=F);let I;e[32]!==m||e[33]!==f||e[34]!==M||e[35]!==F?(I=(0,$.jsxs)(N,{type:`multiple`,value:f,onValueChange:m,children:[M,F]}),e[32]=m,e[33]=f,e[34]=M,e[35]=F,e[36]=I):I=e[36];let L;return e[37]!==n||e[38]!==I?(L=(0,$.jsx)(`div`,{ref:n,className:`h-full overflow-auto`,children:I}),e[37]=n,e[38]=I,e[39]=L):L=e[39],L};export{Jn as default,qn as getUploadDestinationForEvent};
@@ -1 +1 @@
1
- import{Xi as e}from"./cells-C6lBv8kg.js";import{t}from"./cn-ldLVeaqm.js";import{t as n}from"./jsx-runtime-B74pBk57.js";import{t as r}from"./createLucideIcon-B7HeEoG2.js";import{n as i,t as a}from"./file-headphone-rFCxFRI8.js";import{t as o}from"./file-DF8n85RA.js";import{t as s}from"./image-ab13yGv4.js";var c=r(`file-code`,[[`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:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),l=r(`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`}]]),u=r(`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`}]]),d=r(`folder-archive`,[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 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 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]),f=r(`folder`,[[`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`}]]),p=n(),m={py:`python`,txt:`text`,md:`text`,qmd:`text`,log:`text`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,svg:`image`,webp:`image`,csv:`data`,parquet:`data`,arrow:`data`,xlsx:`data`,json:`json`,js:`code`,ts:`code`,tsx:`code`,html:`code`,css:`code`,toml:`code`,yaml:`code`,yml:`code`,wasm:`code`,mp3:`audio`,m4a:`audio`,ogg:`audio`,wav:`audio`,mp4:`video`,m4v:`video`,mpeg:`video`,webm:`video`,mkv:`video`,pdf:`pdf`,zip:`zip`,tar:`zip`,gz:`zip`};function h(e){let t=e.split(`.`).pop()?.toLowerCase();return t?m[t]??`unknown`:`unknown`}var g={directory:f,python:c,code:c,json:i,text:e,image:s,audio:a,video:l,data:u,pdf:e,zip:d,unknown:o},_={directory:`text-amber-500`,python:`text-blue-500`,code:`text-blue-500`,json:`text-blue-500`,text:`text-muted-foreground`,image:`text-purple-500`,audio:`text-orange-500`,video:`text-orange-500`,data:`text-green-500`,pdf:`text-red-500`,zip:`text-muted-foreground`,unknown:`text-muted-foreground`};function v(e,n){let r=h(e),i=g[r],a=_[r];return(0,p.jsx)(i,{className:t(`h-3.5 w-3.5 shrink-0`,a,n)})}export{f as a,v as i,_ as n,h as r,g as t};
1
+ import{Qi as e}from"./cells-yuYDzbAy.js";import{t}from"./cn-ldLVeaqm.js";import{t as n}from"./jsx-runtime-B74pBk57.js";import{t as r}from"./createLucideIcon-B7HeEoG2.js";import{n as i,t as a}from"./file-headphone-rFCxFRI8.js";import{t as o}from"./file-DF8n85RA.js";import{t as s}from"./image-ab13yGv4.js";var c=r(`file-code`,[[`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:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),l=r(`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`}]]),u=r(`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`}]]),d=r(`folder-archive`,[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 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 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]),f=r(`folder`,[[`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`}]]),p=n(),m={py:`python`,txt:`text`,md:`text`,qmd:`text`,log:`text`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,svg:`image`,webp:`image`,csv:`data`,parquet:`data`,arrow:`data`,xlsx:`data`,json:`json`,js:`code`,ts:`code`,tsx:`code`,html:`code`,css:`code`,toml:`code`,yaml:`code`,yml:`code`,wasm:`code`,mp3:`audio`,m4a:`audio`,ogg:`audio`,wav:`audio`,mp4:`video`,m4v:`video`,mpeg:`video`,webm:`video`,mkv:`video`,pdf:`pdf`,zip:`zip`,tar:`zip`,gz:`zip`};function h(e){let t=e.split(`.`).pop()?.toLowerCase();return t?m[t]??`unknown`:`unknown`}var g={directory:f,python:c,code:c,json:i,text:e,image:s,audio:a,video:l,data:u,pdf:e,zip:d,unknown:o},_={directory:`text-amber-500`,python:`text-blue-500`,code:`text-blue-500`,json:`text-blue-500`,text:`text-muted-foreground`,image:`text-purple-500`,audio:`text-orange-500`,video:`text-orange-500`,data:`text-green-500`,pdf:`text-red-500`,zip:`text-muted-foreground`,unknown:`text-muted-foreground`};function v(e,n){let r=h(e),i=g[r],a=_[r];return(0,p.jsx)(i,{className:t(`h-3.5 w-3.5 shrink-0`,a,n)})}export{f as a,v as i,_ as n,h as r,g as t};