@marimo-team/frontend 0.23.4-dev0 → 0.23.4-dev1

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 (80) hide show
  1. package/dist/assets/{CellStatus-BTL_sgUY.js → CellStatus-PIeZtHEl.js} +1 -1
  2. package/dist/assets/JsonOutput-BVAcY5xS.js +49 -0
  3. package/dist/assets/{MarimoErrorOutput-BBD405a6.js → MarimoErrorOutput-B9_RO5eX.js} +2 -2
  4. package/dist/assets/{RenderHTML-BT9obKLc.js → RenderHTML-DR6lqJGS.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-qEfAzC8R.js → add-cell-with-ai-DjfY8mF1.js} +9 -9
  6. package/dist/assets/{add-connection-dialog-HCShSlr3.js → add-connection-dialog-gd2yD9Qo.js} +2 -2
  7. package/dist/assets/{agent-panel-CoBHxHpJ.js → agent-panel-TetMUXWP.js} +3 -3
  8. package/dist/assets/{ai-model-dropdown-CYx9ZfdS.js → ai-model-dropdown-By4Ohb0R.js} +3 -3
  9. package/dist/assets/{app-config-button-DC5UlXZA.js → app-config-button-YS8lpoUa.js} +1 -1
  10. package/dist/assets/{cell-editor-BMjfXh0J.js → cell-editor-C6vZfKyj.js} +10 -10
  11. package/dist/assets/{cell-link-BA7Demf0.js → cell-link-d38hFEon.js} +1 -1
  12. package/dist/assets/{cells-CJlo_hG2.js → cells-A-ljPpuj.js} +55 -55
  13. package/dist/assets/{chat-display-DbztpRD4.js → chat-display-Be0U92hE.js} +1 -1
  14. package/dist/assets/{chat-panel-H-xFzATI.js → chat-panel-BEz970S3.js} +1 -1
  15. package/dist/assets/{chat-ui-CFqAy2ck.js → chat-ui-CdW7awFa.js} +1 -1
  16. package/dist/assets/{column-preview-DzN2QumC.js → column-preview-_5uYiy74.js} +1 -1
  17. package/dist/assets/{command-DbT_zkRP.js → command-CzIDL1VI.js} +1 -1
  18. package/dist/assets/{command-palette-DSSR50KF.js → command-palette-DfotChyr.js} +1 -1
  19. package/dist/assets/{common-CquNY-ok.js → common-DC9LEIym.js} +1 -1
  20. package/dist/assets/{components-BXKuiPiF.js → components-BDnRtsA5.js} +1 -1
  21. package/dist/assets/{components-BiBOcq1x.js → components-FepcpFGL.js} +1 -1
  22. package/dist/assets/{datasource-BKDU-4D5.js → datasource-BCnGIjqn.js} +2 -2
  23. package/dist/assets/{dependency-graph-panel-ayo-Mm2j.js → dependency-graph-panel-Yk1Ch_Gj.js} +1 -1
  24. package/dist/assets/{documentation-panel-ph6755dz.js → documentation-panel-BMrGuByB.js} +1 -1
  25. package/dist/assets/{download-mzsKQgiy.js → download-Iyng0xCz.js} +4 -4
  26. package/dist/assets/{edit-page-Bxa5DWoE.js → edit-page-C-LIP5uT.js} +6 -6
  27. package/dist/assets/{error-panel-BfG_JeMA.js → error-panel-CHSsnRFF.js} +1 -1
  28. package/dist/assets/{file-explorer-panel-D7-d0Puf.js → file-explorer-panel-Dlwspu2Y.js} +3 -3
  29. package/dist/assets/{file-icons-BNrh8MRG.js → file-icons-DTNZv05h.js} +1 -1
  30. package/dist/assets/{floating-outline-BMB4_phA.js → floating-outline-CSNGDMAm.js} +1 -1
  31. package/dist/assets/{focus-BX3gXJxx.js → focus-Baz7rlo0.js} +1 -1
  32. package/dist/assets/form-Dr-_EXr8.js +2 -0
  33. package/dist/assets/{home-page-B1ELDhn8.js → home-page-QvO22-4u.js} +1 -1
  34. package/dist/assets/{hooks-b3J1eFE-.js → hooks-CNPv5U-N.js} +1 -1
  35. package/dist/assets/{html-to-image-Cz8lDF-Y.js → html-to-image-tbPEMBJg.js} +1 -1
  36. package/dist/assets/{index-BjiE1T38.js → index-BFivsT-R.js} +8 -8
  37. package/dist/assets/index-DH5UUBE4.css +2 -0
  38. package/dist/assets/{kiosk-mode-Dxbs5i5g.js → kiosk-mode-cWTXpegb.js} +1 -1
  39. package/dist/assets/{layout-lxwMDUgI.js → layout-DDh3d8oW.js} +5 -5
  40. package/dist/assets/{logs-panel-BW6S5AI1.js → logs-panel-Dgkr6V7q.js} +1 -1
  41. package/dist/assets/{markdown-renderer-CeHY2KoQ.js → markdown-renderer-CFrgiLqu.js} +1 -1
  42. package/dist/assets/{name-cell-input-B1BCybeo.js → name-cell-input-C5LXTI3T.js} +1 -1
  43. package/dist/assets/{outline-panel-DgMz83Mx.js → outline-panel-0lyts6z4.js} +1 -1
  44. package/dist/assets/{packages-panel-CbjavFh2.js → packages-panel-BhI1lbfw.js} +1 -1
  45. package/dist/assets/{panels-BPzk3EbR.js → panels-CbRenLjk.js} +1 -1
  46. package/dist/assets/{process-output-CggRIZ6s.js → process-output-BwZ5VxXO.js} +1 -1
  47. package/dist/assets/{readonly-python-code-Ccd8HM-7.js → readonly-python-code-B0nrQE3U.js} +1 -1
  48. package/dist/assets/{reveal-component-BamXsTkr.js → reveal-component-CLjsFHmT.js} +1 -1
  49. package/dist/assets/{run-page-C5cZvltI.js → run-page-C1Wd8dr8.js} +1 -1
  50. package/dist/assets/{scratchpad-panel-PMFH4Ktp.js → scratchpad-panel-DpqODhZ3.js} +1 -1
  51. package/dist/assets/{session-panel-CUTSr9rt.js → session-panel-BvCIuxgU.js} +1 -1
  52. package/dist/assets/{slide-form-Bi8ZYBHP.js → slide-form-CXqvfwGg.js} +1 -1
  53. package/dist/assets/{snippets-panel-CdhDsAII.js → snippets-panel-COBTGJcr.js} +1 -1
  54. package/dist/assets/{state-C5AUgyZT.js → state-Bsz477is.js} +1 -1
  55. package/dist/assets/{state-DHlRrwyY.js → state-LyvUXW6A.js} +2 -2
  56. package/dist/assets/{textarea-BXPC1-kb.js → textarea-Dd0InTQJ.js} +1 -1
  57. package/dist/assets/{tracing-wSufGcF9.js → tracing-DjZGgWTo.js} +1 -1
  58. package/dist/assets/{tracing-panel-BO6MMAXa.js → tracing-panel-8eFzEjG0.js} +2 -2
  59. package/dist/assets/{useAddCell-CqBbGhrY.js → useAddCell-De9xD63_.js} +1 -1
  60. package/dist/assets/{useCellActionButton-DYwx4pGE.js → useCellActionButton-Bjxun3wK.js} +1 -1
  61. package/dist/assets/{useDeleteCell-BJlGbsbV.js → useDeleteCell-C2Stbb6Q.js} +1 -1
  62. package/dist/assets/{useDependencyPanelTab-rkAIQ6zL.js → useDependencyPanelTab-DFZNQ3a8.js} +1 -1
  63. package/dist/assets/{useNotebookActions-Dga3qEHF.js → useNotebookActions-F5fGMe9N.js} +1 -1
  64. package/dist/assets/{useRunCells-B531RIUE.js → useRunCells-DU1tawR-.js} +1 -1
  65. package/dist/assets/{useSplitCell-BnuJW5uo.js → useSplitCell-BZPuhd8z.js} +1 -1
  66. package/dist/index.html +25 -25
  67. package/package.json +1 -1
  68. package/src/components/data-table/data-table.tsx +11 -2
  69. package/src/components/data-table/filter-by-values-picker.tsx +238 -0
  70. package/src/components/data-table/filter-pill-editor.tsx +470 -0
  71. package/src/components/data-table/filter-pills.tsx +177 -41
  72. package/src/components/ui/checkbox.tsx +8 -4
  73. package/src/components/ui/combobox.tsx +3 -0
  74. package/src/css/app/Cell.css +4 -0
  75. package/src/plugins/impl/DataTablePlugin.tsx +1 -0
  76. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +15 -15
  77. package/src/utils/sets.ts +13 -0
  78. package/dist/assets/JsonOutput-DXnOS_Hk.js +0 -49
  79. package/dist/assets/form-CPDlIjdV.js +0 -2
  80. package/dist/assets/index-BYLYJcAY.css +0 -2
@@ -1 +1 @@
1
- import{s as i}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as l}from"./react-Bj1aDYRI.js";import{k as a}from"./cells-CJlo_hG2.js";import"./react-dom-CSu739Rf.js";import{t as s}from"./compiler-runtime-B3qBwwSJ.js";import{t as c}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{t as d}from"./createLucideIcon-D5guW7EU.js";import{t as h}from"./MarimoErrorOutput-BBD405a6.js";import"./dist-Ds4ite_2.js";import"./dist-CEysMnMQ.js";import"./dist-DGxytjtv.js";import"./dist-DZ2qbK2N.js";import"./dist-CRPTyqAT.js";import"./session-nmTRerwF.js";import"./purify.es-DC4RGS9t.js";import{n as f}from"./cell-link-BA7Demf0.js";import{t as n}from"./empty-state-CsVQSqKA.js";var x=d("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"}]]),y=s();l();var r=i(c(),1),k=()=>{let t=(0,y.c)(5),m=a();if(m.length===0){let p;return t[0]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)(n,{title:"No errors!",icon:(0,r.jsx)(x,{})}),t[0]=p):p=t[0],p}let o;t[1]===m?o=t[2]:(o=m.map(u),t[1]=m,t[2]=o);let e;return t[3]===o?e=t[4]:(e=(0,r.jsx)("div",{className:"flex flex-col h-full overflow-auto",children:o}),t[3]=o,t[4]=e),e};function u(t){return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:(0,r.jsx)(f,{cellId:t.cellId})}),(0,r.jsx)("div",{className:"px-2",children:(0,r.jsx)(h,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}export{k as default};
1
+ import{s as i}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as l}from"./react-Bj1aDYRI.js";import{k as a}from"./cells-A-ljPpuj.js";import"./react-dom-CSu739Rf.js";import{t as s}from"./compiler-runtime-B3qBwwSJ.js";import{t as c}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{t as d}from"./createLucideIcon-D5guW7EU.js";import{t as h}from"./MarimoErrorOutput-B9_RO5eX.js";import"./dist-Ds4ite_2.js";import"./dist-CEysMnMQ.js";import"./dist-DGxytjtv.js";import"./dist-DZ2qbK2N.js";import"./dist-CRPTyqAT.js";import"./session-nmTRerwF.js";import"./purify.es-DC4RGS9t.js";import{n as f}from"./cell-link-d38hFEon.js";import{t as n}from"./empty-state-CsVQSqKA.js";var x=d("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"}]]),y=s();l();var r=i(c(),1),k=()=>{let t=(0,y.c)(5),m=a();if(m.length===0){let p;return t[0]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)(n,{title:"No errors!",icon:(0,r.jsx)(x,{})}),t[0]=p):p=t[0],p}let o;t[1]===m?o=t[2]:(o=m.map(u),t[1]=m,t[2]=o);let e;return t[3]===o?e=t[4]:(e=(0,r.jsx)("div",{className:"flex flex-col h-full overflow-auto",children:o}),t[3]=o,t[4]=e),e};function u(t){return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:(0,r.jsx)(f,{cellId:t.cellId})}),(0,r.jsx)("div",{className:"px-2",children:(0,r.jsx)(h,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}export{k as default};
@@ -1,4 +1,4 @@
1
- import{s as qe}from"./chunk-LvLJmgfZ.js";import{i as Rt,l as ke,n as ee,p as Ue,u as ye}from"./useEvent-D91BmmQi.js";import{t as Et}from"./react-Bj1aDYRI.js";import{E as At,Nn as We,gr as It,mi as Ht,vi as Ge}from"./cells-CJlo_hG2.js";import"./react-dom-CSu739Rf.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{_ as Me}from"./useEventListener-BR0C1MaI.js";import{t as Lt}from"./invariant-BUdrueMv.js";import{p as Vt,u as Je}from"./utils-DIGrmLDO.js";import{S as _e}from"./config-ChCHm539.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as Bt}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import{n as qt}from"./multi-map-rafH3cg3.js";import{o as Ut}from"./alert-dialog-BGBdrcqJ.js";import"./popover-UExmgBsf.js";import{a as A,c as ue,p as Wt,r as Gt,t as Jt}from"./dropdown-menu-D1A3cFC8.js";import{a as Kt,i as Ke,o as Ce,vt as De}from"./JsonOutput-DXnOS_Hk.js";import{c as Yt,i as ze,r as Fe}from"./download-mzsKQgiy.js";import{t as I}from"./tooltip-Gcwqb_SK.js";import{n as Xt,t as $}from"./button-D9nb17Rw.js";import{St as Zt}from"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{n as Qt,r as Pe}from"./requests-DIwGYs0l.js";import{t as re}from"./createLucideIcon-D5guW7EU.js";import{a as Ye,c as Xe,i as Ze,n as Se,o as Te,r as ea,t as ta}from"./state-svfaehZt.js";import{n as aa}from"./LazyAnyLanguageCodeMirror-0gZO1asr.js";import{t as na}from"./x-C-6liIBr.js";import{n as Oe}from"./maps-C48Oksn0.js";import{n as $e}from"./markdown-renderer-CeHY2KoQ.js";import{u as ra}from"./toDate-B5A0DFEz.js";import{t as Qe}from"./copy-Dk_3y0H-.js";import{t as sa}from"./eye-off-BT-KOYV5.js";import{a as oa,i as et,n as tt,r as la,t as ia}from"./file-icons-BNrh8MRG.js";import{t as at}from"./file-HTLbeC2b.js";import{i as nt,r as ca,t as rt}from"./add-connection-dialog-HCShSlr3.js";import{n as Re,t as da}from"./spinner-Bhir8k53.js";import{a as ma,c as pa,d as ha,f as xa,i as fa,l as ua,n as ya,r as ja,t as ga,u as ba}from"./file-name-input-CLlFR7p-.js";import{t as st}from"./plus-BgB18UzY.js";import{t as ot}from"./refresh-cw-DHwG4Mac.js";import{t as va}from"./save-Clg5dMoP.js";import{t as wa}from"./triangle-alert-DBoAWWKA.js";import{n as Na,t as ka}from"./es-YQvzKo5h.js";import"./dist-Ds4ite_2.js";import"./dist-CEysMnMQ.js";import"./dist-DGxytjtv.js";import"./dist-DZ2qbK2N.js";import"./dist-CRPTyqAT.js";import{t as te}from"./use-toast-BDYuj3zG.js";import{t as _a}from"./paths-CXng2XQv.js";import"./session-nmTRerwF.js";import"./purify.es-DC4RGS9t.js";import"./dates-DhByPWH5.js";import{n as je}from"./copy-B5qyZn5s.js";import{t as Ca}from"./copy-icon-C67c9EwB.js";import{t as lt}from"./context-DGqo1TbK.js";import{n as it}from"./ImperativeModal-BBqcKmmk.js";import{n as Fa,t as ct}from"./blob-CTort_or.js";import"./utils-Bq5kLQ87.js";import"./vega-loader.browser-DXARUlxo.js";import"./defaultLocale-JieDVWC_.js";import"./defaultLocale-BLne0bXb.js";import{n as Sa,t as Ma}from"./alert-cDholnQq.js";import{n as dt}from"./error-banner-CTBwdcdk.js";import{n as Ee}from"./useAsyncData-dS4Ne6pU.js";import{a as Da,o as mt,t as za,u as Pa}from"./command-DbT_zkRP.js";import"./chunk-5FQGJX7Z-B4RvNAGm.js";import"./html-to-image-Cz8lDF-Y.js";import{o as Ta}from"./focus-BX3gXJxx.js";import"./react-resizable-panels.browser.esm-Bcm5njwd.js";import{a as Oa}from"./renderShortcut-CkNNAheg.js";import{t as $a}from"./bundle.esm-DU-4isVC.js";import{t as pt}from"./useAddCell-CqBbGhrY.js";import{i as Ae,n as Ra,r as ht,t as ge}from"./tree-actions-oMCx6WNc.js";import{a as Ea}from"./components-BiBOcq1x.js";import{n as Aa}from"./pathUtils-CSrNy17a.js";import{t as Ia}from"./empty-state-CsVQSqKA.js";import{t as Ie}from"./formatting-Cncf6ptO.js";import{a as Ha,i as La,n as xt,r as ft,t as ut}from"./components-BXKuiPiF.js";import{n as yt,t as Va}from"./marimo-icons-BSB-Z_W3.js";import{t as Ba}from"./links-BHtUMVOq.js";var qa=re("book-plus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]),Ua=re("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),jt=re("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]),Wa=re("file-symlink",[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"huwfnr"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}]]),gt=re("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),bt=re("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]),Ga=re("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}]]),vt=re("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),T=qe(Et(),1),Ja=fe(),a=qe(Bt(),1);const wt=t=>{let e=(0,Ja.c)(17),{filename:n,filenameIcon:i,onBack:l,onRefresh:r,onDownload:d,actions:c}=t,h;e[0]===l?h=e[1]:(h=l&&(0,a.jsx)(I,{content:"Back to file list",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:l,children:(0,a.jsx)(Xe,{className:"h-4 w-4"})})}),e[0]=l,e[1]=h);let s;e[2]!==n||e[3]!==i?(s=n?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[i,n]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=n,e[3]=i,e[4]=s):s=e[4];let y;e[5]===r?y=e[6]:(y=r&&(0,a.jsx)(I,{content:"Refresh",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(ot,{className:"h-3.5 w-3.5"})})}),e[5]=r,e[6]=y);let x;e[7]===d?x=e[8]:(x=d&&(0,a.jsx)(I,{content:"Download",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:d,children:(0,a.jsx)(De,{className:"h-3.5 w-3.5"})})}),e[7]=d,e[8]=x);let p;e[9]!==c||e[10]!==y||e[11]!==x?(p=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[y,c,x]}),e[9]=c,e[10]=y,e[11]=x,e[12]=p):p=e[12];let u;return e[13]!==h||e[14]!==s||e[15]!==p?(u=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[h,s,p]}),e[13]=h,e[14]=s,e[15]=p,e[16]=u):u=e[16],u};var Ka=new Set(["http","file","in-memory"]);function He(t){return JSON.stringify(t).slice(1,-1)}const Nt=[{id:"read-file",label:"Insert read snippet",icon:qa,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);return t.backendType==="obstore"?`_data = ${t.variableName}.get("${e}").bytes()
1
+ import{s as qe}from"./chunk-LvLJmgfZ.js";import{i as Rt,l as ke,n as ee,p as Ue,u as ye}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{E as Et,Nn as We,_r as It,hi as Ht,yi as Ge}from"./cells-A-ljPpuj.js";import"./react-dom-CSu739Rf.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{_ as Me}from"./useEventListener-BR0C1MaI.js";import{t as Lt}from"./invariant-BUdrueMv.js";import{p as Vt,u as Je}from"./utils-DIGrmLDO.js";import{S as _e}from"./config-ChCHm539.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as Bt}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import{n as qt}from"./multi-map-rafH3cg3.js";import{o as Ut}from"./alert-dialog-BGBdrcqJ.js";import"./popover-UExmgBsf.js";import{a as E,c as ue,p as Wt,r as Gt,t as Jt}from"./dropdown-menu-D1A3cFC8.js";import{a as Kt,bt as De,i as Ke,o as Ce}from"./JsonOutput-BVAcY5xS.js";import{c as Yt,i as ze,r as Fe}from"./download-Iyng0xCz.js";import{t as I}from"./tooltip-Gcwqb_SK.js";import{n as Xt,t as $}from"./button-D9nb17Rw.js";import{St as Zt}from"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{n as Qt,r as Pe}from"./requests-DIwGYs0l.js";import{t as re}from"./createLucideIcon-D5guW7EU.js";import{a as Ye,c as Xe,i as Ze,n as Se,o as Te,r as ea,t as ta}from"./state-svfaehZt.js";import{n as aa}from"./LazyAnyLanguageCodeMirror-0gZO1asr.js";import{t as na}from"./x-C-6liIBr.js";import{n as Oe}from"./maps-C48Oksn0.js";import{n as $e}from"./markdown-renderer-CFrgiLqu.js";import{u as ra}from"./toDate-B5A0DFEz.js";import{t as Qe}from"./copy-Dk_3y0H-.js";import{t as sa}from"./eye-off-BT-KOYV5.js";import{a as oa,i as et,n as tt,r as la,t as ia}from"./file-icons-DTNZv05h.js";import{t as at}from"./file-HTLbeC2b.js";import{i as nt,r as ca,t as rt}from"./add-connection-dialog-gd2yD9Qo.js";import{n as Re,t as da}from"./spinner-Bhir8k53.js";import{a as ma,c as pa,d as ha,f as xa,i as fa,l as ua,n as ya,r as ja,t as ga,u as ba}from"./file-name-input-CLlFR7p-.js";import{t as st}from"./plus-BgB18UzY.js";import{t as ot}from"./refresh-cw-DHwG4Mac.js";import{t as va}from"./save-Clg5dMoP.js";import{t as wa}from"./triangle-alert-DBoAWWKA.js";import{n as Na,t as ka}from"./es-YQvzKo5h.js";import"./dist-Ds4ite_2.js";import"./dist-CEysMnMQ.js";import"./dist-DGxytjtv.js";import"./dist-DZ2qbK2N.js";import"./dist-CRPTyqAT.js";import{t as te}from"./use-toast-BDYuj3zG.js";import{t as _a}from"./paths-CXng2XQv.js";import"./session-nmTRerwF.js";import"./purify.es-DC4RGS9t.js";import"./dates-DhByPWH5.js";import{n as je}from"./copy-B5qyZn5s.js";import{t as Ca}from"./copy-icon-C67c9EwB.js";import{t as lt}from"./context-DGqo1TbK.js";import{n as it}from"./ImperativeModal-BBqcKmmk.js";import{n as Fa,t as ct}from"./blob-CTort_or.js";import"./utils-Bq5kLQ87.js";import"./vega-loader.browser-DXARUlxo.js";import"./defaultLocale-JieDVWC_.js";import"./defaultLocale-BLne0bXb.js";import{n as Sa,t as Ma}from"./alert-cDholnQq.js";import{n as dt}from"./error-banner-CTBwdcdk.js";import{n as Ae}from"./useAsyncData-dS4Ne6pU.js";import{a as Da,d as za,o as mt,t as Pa}from"./command-CzIDL1VI.js";import"./chunk-5FQGJX7Z-B4RvNAGm.js";import"./html-to-image-tbPEMBJg.js";import{o as Ta}from"./focus-Baz7rlo0.js";import"./react-resizable-panels.browser.esm-Bcm5njwd.js";import{a as Oa}from"./renderShortcut-CkNNAheg.js";import{t as $a}from"./bundle.esm-DU-4isVC.js";import{t as pt}from"./useAddCell-De9xD63_.js";import{i as Ee,n as Ra,r as ht,t as ge}from"./tree-actions-oMCx6WNc.js";import{a as Aa}from"./components-FepcpFGL.js";import{n as Ea}from"./pathUtils-CSrNy17a.js";import{t as Ia}from"./empty-state-CsVQSqKA.js";import{t as Ie}from"./formatting-Cncf6ptO.js";import{a as Ha,i as La,n as xt,r as ft,t as ut}from"./components-BDnRtsA5.js";import{n as yt,t as Va}from"./marimo-icons-BSB-Z_W3.js";import{t as Ba}from"./links-BHtUMVOq.js";var qa=re("book-plus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]),Ua=re("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),jt=re("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]),Wa=re("file-symlink",[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"huwfnr"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}]]),gt=re("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),bt=re("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]),Ga=re("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}]]),vt=re("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),T=qe(At(),1),Ja=fe(),a=qe(Bt(),1);const wt=t=>{let e=(0,Ja.c)(17),{filename:n,filenameIcon:i,onBack:l,onRefresh:r,onDownload:d,actions:c}=t,h;e[0]===l?h=e[1]:(h=l&&(0,a.jsx)(I,{content:"Back to file list",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:l,children:(0,a.jsx)(Xe,{className:"h-4 w-4"})})}),e[0]=l,e[1]=h);let s;e[2]!==n||e[3]!==i?(s=n?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[i,n]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=n,e[3]=i,e[4]=s):s=e[4];let y;e[5]===r?y=e[6]:(y=r&&(0,a.jsx)(I,{content:"Refresh",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(ot,{className:"h-3.5 w-3.5"})})}),e[5]=r,e[6]=y);let x;e[7]===d?x=e[8]:(x=d&&(0,a.jsx)(I,{content:"Download",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:d,children:(0,a.jsx)(De,{className:"h-3.5 w-3.5"})})}),e[7]=d,e[8]=x);let p;e[9]!==c||e[10]!==y||e[11]!==x?(p=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[y,c,x]}),e[9]=c,e[10]=y,e[11]=x,e[12]=p):p=e[12];let u;return e[13]!==h||e[14]!==s||e[15]!==p?(u=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[h,s,p]}),e[13]=h,e[14]=s,e[15]=p,e[16]=u):u=e[16],u};var Ka=new Set(["http","file","in-memory"]);function He(t){return JSON.stringify(t).slice(1,-1)}const Nt=[{id:"read-file",label:"Insert read snippet",icon:qa,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);return t.backendType==="obstore"?`_data = ${t.variableName}.get("${e}").bytes()
2
2
  _data`:`_data = ${t.variableName}.cat_file("${e}")
3
3
  _data`}},{id:"download-file",label:"Insert download snippet",icon:Wa,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);if(t.backendType==="obstore")return Ka.has(t.protocol)?null:`from datetime import timedelta
4
4
  from obstore import sign
@@ -7,7 +7,7 @@ signed_url = sign(
7
7
  ${t.variableName}, "GET", "${e}",
8
8
  expires_in=timedelta(hours=1),
9
9
  )
10
- signed_url`;let n=He(t.entry.path.split("/").pop()||"download");return`${t.variableName}.get("${e}", "${n}")`}}];var Ya=100*1024*1024;function Xa(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Za=({entry:t,namespace:e,protocol:n,backendType:i,onBack:l})=>{let{locale:r}=lt(),d=pt(),c=Xa(t.path),h=t.mimeType||"text/plain",s=Ce(h),y=s&&t.size>Ya&&t.size>0,{data:x,isPending:p,error:u,refetch:g}=Ee(async()=>{if(y)return null;let m=await Te.request({namespace:e,path:t.path,preview:!s});if(m.error)throw Error(m.error);if(!m.url)throw Error("No URL returned");if(s)return{type:"media",url:m.url};let b=await fetch(m.url);if(!b.ok)throw Error(`Failed to fetch preview: ${b.statusText}`);return{type:"text",content:await b.text()}},[e,t.path,s,y]),w=(0,T.useCallback)(async()=>{try{let m=await Te.request({namespace:e,path:t.path});if(m.error){te({title:"Download failed",description:m.error,variant:"danger"});return}m.url&&ze(m.url,m.filename??c)}catch(m){Me.error("Failed to download storage entry",m),te({title:"Download failed",description:String(m),variant:"danger"})}},[e,t.path,c]),v=Nt.map(m=>{let b=m.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(b===null)return null;let f=m.icon;return(0,a.jsx)(I,{content:m.label,children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:()=>d(b),"aria-label":m.label,children:(0,a.jsx)(f,{className:"h-3.5 w-3.5"})})},m.id)}),o=(0,a.jsx)(wt,{filename:c,filenameIcon:et(c),onBack:l,onDownload:w,actions:v}),j=({includeMime:m=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)(Ca,{value:t.path,className:"h-3 w-3"})]}),m&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),m&&(0,a.jsx)("span",{children:h}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Ie(t.size,r)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Ie(t.size,r),")."]})]}):p?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Re,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",u.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)($,{variant:"secondary",size:"xs",onClick:g,children:[(0,a.jsx)(ot,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):x?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({}),(0,a.jsx)(Ke,{mimeType:h,contents:x.type==="text"?x.content:void 0,mediaSource:x.type==="media"?{url:x.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(at,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Le=fe(),Qa=16;function se(t){return{paddingLeft:t*Qa}}function en(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function kt(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}function Ve(t,e,n,i){let l=n.toLowerCase();if(kt(t.path).toLowerCase().includes(l))return!0;if(t.kind==="directory"){let r=i.get(Ye(e,t.path));if(r)return r.some(d=>Ve(d,e,n,i))}return!1}function _t(t,e,n,i){return n.trim()?t.filter(l=>Ve(l,e,n,i)):t}var tn=t=>{let e=(0,Le.c)(36),{namespace:n,protocol:i,rootPath:l,backendType:r,prefix:d,depth:c,locale:h,searchValue:s,onOpenFile:y}=t,{entriesByPath:x}=Se(),{entries:p,isPending:u,error:g}=Ze(n,d);if(u){let o;e[0]===c?o=e[1]:(o=se(c),e[0]=c,e[1]=o);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Re,{className:"h-3 w-3 animate-spin"}),e[2]=j):j=e[2];let m;return e[3]===o?m=e[4]:(m=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:o,children:[j,"Loading..."]}),e[3]=o,e[4]=m),m}if(g){let o;e[5]===c?o=e[6]:(o=se(c),e[5]=c,e[6]=o);let j;return e[7]!==g.message||e[8]!==o?(j=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:o,children:["Failed to load: ",g.message]}),e[7]=g.message,e[8]=o,e[9]=j):j=e[9],j}if(p.length===0){let o;e[10]===c?o=e[11]:(o=se(c),e[10]=c,e[11]=o);let j;return e[12]===o?j=e[13]:(j=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:o,children:"Empty"}),e[12]=o,e[13]=j),j}let w;if(e[14]!==r||e[15]!==p||e[16]!==c||e[17]!==x||e[18]!==h||e[19]!==n||e[20]!==y||e[21]!==i||e[22]!==l||e[23]!==s){let o=_t(p,n,s,x),j;e[25]!==r||e[26]!==c||e[27]!==h||e[28]!==n||e[29]!==y||e[30]!==i||e[31]!==l||e[32]!==s?(j=m=>(0,a.jsx)(Ct,{entry:m,namespace:n,protocol:i,rootPath:l,backendType:r,depth:c,locale:h,searchValue:s,onOpenFile:y},m.path),e[25]=r,e[26]=c,e[27]=h,e[28]=n,e[29]=y,e[30]=i,e[31]=l,e[32]=s,e[33]=j):j=e[33],w=o.map(j),e[14]=r,e[15]=p,e[16]=c,e[17]=x,e[18]=h,e[19]=n,e[20]=y,e[21]=i,e[22]=l,e[23]=s,e[24]=w}else w=e[24];let v;return e[34]===w?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:w}),e[34]=w,e[35]=v),v},Ct=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:l,depth:r,locale:d,searchValue:c,onOpenFile:h})=>{var b;let[s,y]=(0,T.useState)(!1),{entriesByPath:x}=Se(),p=pt(),u=t.kind==="directory",g=kt(t.path),w=!!c.trim(),v=u&&w&&g.toLowerCase().includes(c.trim().toLowerCase()),o=u&&w&&!!((b=x.get(Ye(e,t.path)))!=null&&b.some(f=>Ve(f,e,c,x))),j=s||o,m=(0,T.useCallback)(async()=>{try{let f=await Te.request({namespace:e,path:t.path});if(f.error){te({title:"Download failed",description:f.error,variant:"danger"});return}f.url&&ze(f.url,f.filename??"download")}catch(f){Me.error("Failed to download storage entry",f),te({title:"Download failed",description:String(f),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(mt,{className:ie("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",u&&"font-medium"),style:se(r),value:`${e}:${t.path}`,onSelect:()=>{u?y(!j):h({entry:t,namespace:e,protocol:n,backendType:l})},children:[u?(0,a.jsx)(Ae,{isExpanded:j,className:"h-3 w-3"}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),u?(0,a.jsx)(oa,{className:ie("h-3.5 w-3.5 shrink-0",tt.directory)}):et(g),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:g}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Ie(t.size,d)}),t.lastModified!=null&&(0,a.jsx)(I,{content:`Last modified: ${new Date(t.lastModified*1e3).toLocaleString()}`,children:(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:en(t.lastModified,d)})}),(0,a.jsxs)(Jt,{children:[(0,a.jsx)(Wt,{asChild:!0,children:(0,a.jsx)(Ra,{iconClassName:"h-3 w-3",onClick:f=>f.stopPropagation()})}),(0,a.jsxs)(Gt,{align:"end",onClick:f=>f.stopPropagation(),onCloseAutoFocus:f=>f.preventDefault(),children:[!u&&(0,a.jsxs)(A,{onSelect:()=>h({entry:t,namespace:e,protocol:n,backendType:l}),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(A,{onSelect:async()=>{await je(t.path),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(Qe,{className:ge}),"Copy path"]}),!u&&(0,a.jsxs)(A,{onSelect:()=>m(),children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Nt.map(f=>{let k=f.getCode({variableName:e,protocol:n,entry:t,backendType:l});if(k===null)return null;let _=f.icon;return(0,a.jsxs)(A,{onSelect:()=>p(k),children:[(0,a.jsx)(_,{className:ge}),f.label]},f.id)})]})]})]})]}),u&&j&&(0,a.jsx)(tn,{namespace:e,protocol:n,rootPath:i,backendType:l,prefix:t.path,depth:r+1,locale:d,searchValue:v?"":c,onOpenFile:h})]})},an=t=>{let e=(0,Le.c)(43),{namespace:n,locale:i,searchValue:l,onOpenFile:r}=t,[d,c]=(0,T.useState)(!0),{entriesByPath:h}=Se(),{clearNamespaceCache:s}=ea(),y=n.name??n.displayName,{entries:x,isPending:p,error:u,refetch:g}=Ze(y),w;e[0]!==s||e[1]!==y||e[2]!==g?(w=m=>{m.stopPropagation(),s(y),g()},e[0]=s,e[1]=y,e[2]=g,e[3]=w):w=e[3];let v=w,o=p?n.storageEntries:x,j;if(e[4]!==o||e[5]!==h||e[6]!==u||e[7]!==v||e[8]!==d||e[9]!==p||e[10]!==i||e[11]!==n.backendType||e[12]!==n.displayName||e[13]!==n.name||e[14]!==n.protocol||e[15]!==n.rootPath||e[16]!==y||e[17]!==r||e[18]!==l){let m=_t(o,y,l,h),b;e[20]===d?b=e[21]:(b=()=>c(!d),e[20]=d,e[21]=b);let f;e[22]===d?f=e[23]:(f=(0,a.jsx)(Ae,{isExpanded:d,className:"h-3 w-3"}),e[22]=d,e[23]=f);let k;e[24]===n.protocol?k=e[25]:(k=(0,a.jsx)(ca,{protocol:n.protocol}),e[24]=n.protocol,e[25]=k);let _;e[26]===n.displayName?_=e[27]:(_=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=_);let C;e[28]===n.name?C=e[29]:(C=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Ha,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=C);let F;e[30]===v?F=e[31]:(F=(0,a.jsx)(ht,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=F);let z=n.rootPath||"(root)",S;e[32]===z?S=e[33]:(S=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:z}),e[32]=z,e[33]=S);let M;e[34]!==n.name||e[35]!==S||e[36]!==b||e[37]!==f||e[38]!==k||e[39]!==_||e[40]!==C||e[41]!==F?(M=(0,a.jsxs)(mt,{value:n.name,onSelect:b,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[f,k,_,C,F,S]}),e[34]=n.name,e[35]=S,e[36]=b,e[37]=f,e[38]=k,e[39]=_,e[40]=C,e[41]=F,e[42]=M):M=e[42],j=(0,a.jsxs)(a.Fragment,{children:[M,d&&(0,a.jsxs)(a.Fragment,{children:[p&&o.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:se(1),children:[(0,a.jsx)(Re,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),u&&o.length===0&&(0,a.jsx)(Ea,{error:u,style:se(1),className:"py-1 text-xs h-auto overflow-auto max-h-32 items-start",showIcon:!1}),!p&&o.length===0&&!u&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No entries"}),l&&m.length===0&&o.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No matches"}),m.map(E=>(0,a.jsx)(Ct,{entry:E,namespace:y,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:l,onOpenFile:r},E.path))]})]}),e[4]=o,e[5]=h,e[6]=u,e[7]=v,e[8]=d,e[9]=p,e[10]=i,e[11]=n.backendType,e[12]=n.displayName,e[13]=n.name,e[14]=n.protocol,e[15]=n.rootPath,e[16]=y,e[17]=r,e[18]=l,e[19]=j}else j=e[19];return j};const nn=()=>{let t=(0,Le.c)(31),{namespaces:e}=Se(),{locale:n}=lt(),[i,l]=(0,T.useState)(""),[r,d]=(0,T.useState)(null),c=!!i.trim();if(e.length===0){let b;t[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsxs)("span",{children:["Create an obstore or fsspec connection in your notebook. See the"," ",(0,a.jsx)("a",{className:"text-link",href:"https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start",target:"_blank",rel:"noopener noreferrer",children:"docs"}),"."]}),t[0]=b):b=t[0];let f;return t[1]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(Ia,{title:"No storage connected",description:b,action:(0,a.jsx)(rt,{defaultTab:"storage",children:(0,a.jsxs)($,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(st,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(nt,{className:"h-8 w-8"})}),t[1]=f):f=t[1],f}let h;t[2]===r?h=t[3]:(h=r&&(0,a.jsx)(Za,{entry:r.entry,namespace:r.namespace,protocol:r.protocol,backendType:r.backendType,onBack:()=>d(null)}),t[2]=r,t[3]=h);let s=r&&"hidden",y;t[4]===s?y=t[5]:(y=ie("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",s),t[4]=s,t[5]=y);let x;t[6]===i?x=t[7]:(x=(0,a.jsx)(Da,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:l,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=x);let p;t[8]===c?p=t[9]:(p=c&&(0,a.jsx)($,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>l(""),children:(0,a.jsx)(na,{className:"h-4 w-4"})}),t[8]=c,t[9]=p);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(I,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(ra,{className:"h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2"})}),t[10]=u):u=t[10];let g;t[11]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(rt,{defaultTab:"storage",children:(0,a.jsx)($,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(st,{className:"h-4 w-4"})})}),t[11]=g):g=t[11];let w;t[12]!==x||t[13]!==p?(w=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[x,p,u,g]}),t[12]=x,t[13]=p,t[14]=w):w=t[14];let v;if(t[15]!==n||t[16]!==e||t[17]!==i){let b;t[19]!==n||t[20]!==i?(b=f=>(0,a.jsx)(an,{namespace:f,locale:n,searchValue:i,onOpenFile:d},f.name??f.displayName),t[19]=n,t[20]=i,t[21]=b):b=t[21],v=e.map(b),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let o;t[22]===v?o=t[23]:(o=(0,a.jsx)(Pa,{className:"flex flex-col",children:v}),t[22]=v,t[23]=o);let j;t[24]!==y||t[25]!==w||t[26]!==o?(j=(0,a.jsxs)(za,{className:y,shouldFilter:!1,children:[w,o]}),t[24]=y,t[25]=w,t[26]=o,t[27]=j):j=t[27];let m;return t[28]!==h||t[29]!==j?(m=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[h,j]}),t[28]=h,t[29]=j,t[30]=m):m=t[30],m};var Ft=fe(),St=(0,T.createContext)(null);function rn(){return(0,T.useContext)(St)??void 0}var sn=t=>{let e=(0,Ft.c)(3),{children:n}=t,i=ha(),l;return e[0]!==n||e[1]!==i?(l=(0,a.jsx)(St.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=l):l=e[2],l};const on=t=>{let e=(0,Ft.c)(5),{children:n}=t,[i,l]=(0,T.useState)(null),r;e[0]!==n||e[1]!==i?(r=i&&(0,a.jsx)(xa,{backend:ba,options:{rootElement:i},children:(0,a.jsx)(sn,{children:n})}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let d;return e[3]===r?d=e[4]:(d=(0,a.jsx)("div",{ref:l,className:"contents",children:r}),e[3]=r,e[4]=d),d};var Be=new Map;const ln=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=Pe(),l=ye(Vt),r=ye(Je),d=ye(Ht),[c,h]=(0,T.useState)(""),{data:s,isPending:y,error:x,setData:p,refetch:u}=Ee(async()=>{let k=await n({path:t.path}),_=k.contents||"";return h(Be.get(t.path)||_),k},[t.path]),g=async()=>{c!==(s==null?void 0:s.contents)&&await i({path:t.path,contents:c}).then(k=>{k.success&&(p(_=>({..._,contents:c})),h(c))})},w=(0,T.useRef)(c);if(w.current=c,(0,T.useEffect)(()=>()=>{if(!(s!=null&&s.contents))return;let k=w.current;k===s.contents?Be.delete(t.path):Be.set(t.path,k)},[t.path,s==null?void 0:s.contents]),x)return(0,a.jsx)(dt,{error:x});if(y||!s)return null;let v=s.mimeType||"text/plain",o=v in Kt,j=d&&s.file.isMarimoFile&&(t.path===d||t.path.endsWith(`/${d}`));if(!s.contents&&!o)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let m=(0,a.jsx)(wt,{filename:s.file.name,onRefresh:u,onDownload:r?void 0:()=>{if(s.isBase64&&s.contents){Ce(v)?ze($e(s.contents,v),s.file.name):Fe(ct($e(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Fe(new Blob([s.contents||c],{type:v}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!_e()&&(0,a.jsx)(I,{content:"Open notebook",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:k=>e(k),children:(0,a.jsx)(Oe,{className:"h-3.5 w-3.5"})})}),!Ce(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(I,{content:"Copy contents to clipboard",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:async()=>{await je(c)},children:(0,a.jsx)(Qe,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(I,{content:Oa("global.save"),children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:g,disabled:c===s.contents,children:(0,a.jsx)(va,{className:"h-3.5 w-3.5"})})})]})]})}),b=Ce(v),f=!b&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[m,f&&j&&(0,a.jsxs)(Ma,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(wa,{className:"h-4 w-4"}),(0,a.jsx)(Sa,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Ke,{mimeType:v,contents:b?void 0:f?c:s.contents??void 0,mediaSource:b?{base64:s.contents,mime:v}:void 0,readOnly:!f,onChange:h,extensions:[Zt.of([{key:l.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===s.contents?!1:(g(),!0)}])]})]})},Mt=Ue(t=>{let e=t(Qt);return Lt(e,"no requestClientAtom set"),new pa({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),cn=Ue({});async function dn(){await Rt.get(Mt).refreshAll([])}var oe=" ";const Dt={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
10
+ signed_url`;let n=He(t.entry.path.split("/").pop()||"download");return`${t.variableName}.get("${e}", "${n}")`}}];var Ya=100*1024*1024;function Xa(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Za=({entry:t,namespace:e,protocol:n,backendType:i,onBack:l})=>{let{locale:r}=lt(),d=pt(),c=Xa(t.path),h=t.mimeType||"text/plain",s=Ce(h),y=s&&t.size>Ya&&t.size>0,{data:x,isPending:p,error:u,refetch:g}=Ae(async()=>{if(y)return null;let m=await Te.request({namespace:e,path:t.path,preview:!s});if(m.error)throw Error(m.error);if(!m.url)throw Error("No URL returned");if(s)return{type:"media",url:m.url};let b=await fetch(m.url);if(!b.ok)throw Error(`Failed to fetch preview: ${b.statusText}`);return{type:"text",content:await b.text()}},[e,t.path,s,y]),w=(0,T.useCallback)(async()=>{try{let m=await Te.request({namespace:e,path:t.path});if(m.error){te({title:"Download failed",description:m.error,variant:"danger"});return}m.url&&ze(m.url,m.filename??c)}catch(m){Me.error("Failed to download storage entry",m),te({title:"Download failed",description:String(m),variant:"danger"})}},[e,t.path,c]),v=Nt.map(m=>{let b=m.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(b===null)return null;let f=m.icon;return(0,a.jsx)(I,{content:m.label,children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:()=>d(b),"aria-label":m.label,children:(0,a.jsx)(f,{className:"h-3.5 w-3.5"})})},m.id)}),o=(0,a.jsx)(wt,{filename:c,filenameIcon:et(c),onBack:l,onDownload:w,actions:v}),j=({includeMime:m=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)(Ca,{value:t.path,className:"h-3 w-3"})]}),m&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),m&&(0,a.jsx)("span",{children:h}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Ie(t.size,r)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Ie(t.size,r),")."]})]}):p?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Re,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",u.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)($,{variant:"secondary",size:"xs",onClick:g,children:[(0,a.jsx)(ot,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):x?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({}),(0,a.jsx)(Ke,{mimeType:h,contents:x.type==="text"?x.content:void 0,mediaSource:x.type==="media"?{url:x.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[o,j({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(at,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Le=fe(),Qa=16;function se(t){return{paddingLeft:t*Qa}}function en(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function kt(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}function Ve(t,e,n,i){let l=n.toLowerCase();if(kt(t.path).toLowerCase().includes(l))return!0;if(t.kind==="directory"){let r=i.get(Ye(e,t.path));if(r)return r.some(d=>Ve(d,e,n,i))}return!1}function _t(t,e,n,i){return n.trim()?t.filter(l=>Ve(l,e,n,i)):t}var tn=t=>{let e=(0,Le.c)(36),{namespace:n,protocol:i,rootPath:l,backendType:r,prefix:d,depth:c,locale:h,searchValue:s,onOpenFile:y}=t,{entriesByPath:x}=Se(),{entries:p,isPending:u,error:g}=Ze(n,d);if(u){let o;e[0]===c?o=e[1]:(o=se(c),e[0]=c,e[1]=o);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Re,{className:"h-3 w-3 animate-spin"}),e[2]=j):j=e[2];let m;return e[3]===o?m=e[4]:(m=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:o,children:[j,"Loading..."]}),e[3]=o,e[4]=m),m}if(g){let o;e[5]===c?o=e[6]:(o=se(c),e[5]=c,e[6]=o);let j;return e[7]!==g.message||e[8]!==o?(j=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:o,children:["Failed to load: ",g.message]}),e[7]=g.message,e[8]=o,e[9]=j):j=e[9],j}if(p.length===0){let o;e[10]===c?o=e[11]:(o=se(c),e[10]=c,e[11]=o);let j;return e[12]===o?j=e[13]:(j=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:o,children:"Empty"}),e[12]=o,e[13]=j),j}let w;if(e[14]!==r||e[15]!==p||e[16]!==c||e[17]!==x||e[18]!==h||e[19]!==n||e[20]!==y||e[21]!==i||e[22]!==l||e[23]!==s){let o=_t(p,n,s,x),j;e[25]!==r||e[26]!==c||e[27]!==h||e[28]!==n||e[29]!==y||e[30]!==i||e[31]!==l||e[32]!==s?(j=m=>(0,a.jsx)(Ct,{entry:m,namespace:n,protocol:i,rootPath:l,backendType:r,depth:c,locale:h,searchValue:s,onOpenFile:y},m.path),e[25]=r,e[26]=c,e[27]=h,e[28]=n,e[29]=y,e[30]=i,e[31]=l,e[32]=s,e[33]=j):j=e[33],w=o.map(j),e[14]=r,e[15]=p,e[16]=c,e[17]=x,e[18]=h,e[19]=n,e[20]=y,e[21]=i,e[22]=l,e[23]=s,e[24]=w}else w=e[24];let v;return e[34]===w?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:w}),e[34]=w,e[35]=v),v},Ct=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:l,depth:r,locale:d,searchValue:c,onOpenFile:h})=>{var b;let[s,y]=(0,T.useState)(!1),{entriesByPath:x}=Se(),p=pt(),u=t.kind==="directory",g=kt(t.path),w=!!c.trim(),v=u&&w&&g.toLowerCase().includes(c.trim().toLowerCase()),o=u&&w&&!!((b=x.get(Ye(e,t.path)))!=null&&b.some(f=>Ve(f,e,c,x))),j=s||o,m=(0,T.useCallback)(async()=>{try{let f=await Te.request({namespace:e,path:t.path});if(f.error){te({title:"Download failed",description:f.error,variant:"danger"});return}f.url&&ze(f.url,f.filename??"download")}catch(f){Me.error("Failed to download storage entry",f),te({title:"Download failed",description:String(f),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(mt,{className:ie("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",u&&"font-medium"),style:se(r),value:`${e}:${t.path}`,onSelect:()=>{u?y(!j):h({entry:t,namespace:e,protocol:n,backendType:l})},children:[u?(0,a.jsx)(Ee,{isExpanded:j,className:"h-3 w-3"}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),u?(0,a.jsx)(oa,{className:ie("h-3.5 w-3.5 shrink-0",tt.directory)}):et(g),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:g}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Ie(t.size,d)}),t.lastModified!=null&&(0,a.jsx)(I,{content:`Last modified: ${new Date(t.lastModified*1e3).toLocaleString()}`,children:(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:en(t.lastModified,d)})}),(0,a.jsxs)(Jt,{children:[(0,a.jsx)(Wt,{asChild:!0,children:(0,a.jsx)(Ra,{iconClassName:"h-3 w-3",onClick:f=>f.stopPropagation()})}),(0,a.jsxs)(Gt,{align:"end",onClick:f=>f.stopPropagation(),onCloseAutoFocus:f=>f.preventDefault(),children:[!u&&(0,a.jsxs)(E,{onSelect:()=>h({entry:t,namespace:e,protocol:n,backendType:l}),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(E,{onSelect:async()=>{await je(t.path),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(Qe,{className:ge}),"Copy path"]}),!u&&(0,a.jsxs)(E,{onSelect:()=>m(),children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Nt.map(f=>{let k=f.getCode({variableName:e,protocol:n,entry:t,backendType:l});if(k===null)return null;let _=f.icon;return(0,a.jsxs)(E,{onSelect:()=>p(k),children:[(0,a.jsx)(_,{className:ge}),f.label]},f.id)})]})]})]})]}),u&&j&&(0,a.jsx)(tn,{namespace:e,protocol:n,rootPath:i,backendType:l,prefix:t.path,depth:r+1,locale:d,searchValue:v?"":c,onOpenFile:h})]})},an=t=>{let e=(0,Le.c)(43),{namespace:n,locale:i,searchValue:l,onOpenFile:r}=t,[d,c]=(0,T.useState)(!0),{entriesByPath:h}=Se(),{clearNamespaceCache:s}=ea(),y=n.name??n.displayName,{entries:x,isPending:p,error:u,refetch:g}=Ze(y),w;e[0]!==s||e[1]!==y||e[2]!==g?(w=m=>{m.stopPropagation(),s(y),g()},e[0]=s,e[1]=y,e[2]=g,e[3]=w):w=e[3];let v=w,o=p?n.storageEntries:x,j;if(e[4]!==o||e[5]!==h||e[6]!==u||e[7]!==v||e[8]!==d||e[9]!==p||e[10]!==i||e[11]!==n.backendType||e[12]!==n.displayName||e[13]!==n.name||e[14]!==n.protocol||e[15]!==n.rootPath||e[16]!==y||e[17]!==r||e[18]!==l){let m=_t(o,y,l,h),b;e[20]===d?b=e[21]:(b=()=>c(!d),e[20]=d,e[21]=b);let f;e[22]===d?f=e[23]:(f=(0,a.jsx)(Ee,{isExpanded:d,className:"h-3 w-3"}),e[22]=d,e[23]=f);let k;e[24]===n.protocol?k=e[25]:(k=(0,a.jsx)(ca,{protocol:n.protocol}),e[24]=n.protocol,e[25]=k);let _;e[26]===n.displayName?_=e[27]:(_=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=_);let C;e[28]===n.name?C=e[29]:(C=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Ha,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=C);let F;e[30]===v?F=e[31]:(F=(0,a.jsx)(ht,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=F);let z=n.rootPath||"(root)",S;e[32]===z?S=e[33]:(S=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:z}),e[32]=z,e[33]=S);let M;e[34]!==n.name||e[35]!==S||e[36]!==b||e[37]!==f||e[38]!==k||e[39]!==_||e[40]!==C||e[41]!==F?(M=(0,a.jsxs)(mt,{value:n.name,onSelect:b,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[f,k,_,C,F,S]}),e[34]=n.name,e[35]=S,e[36]=b,e[37]=f,e[38]=k,e[39]=_,e[40]=C,e[41]=F,e[42]=M):M=e[42],j=(0,a.jsxs)(a.Fragment,{children:[M,d&&(0,a.jsxs)(a.Fragment,{children:[p&&o.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:se(1),children:[(0,a.jsx)(Re,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),u&&o.length===0&&(0,a.jsx)(Aa,{error:u,style:se(1),className:"py-1 text-xs h-auto overflow-auto max-h-32 items-start",showIcon:!1}),!p&&o.length===0&&!u&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No entries"}),l&&m.length===0&&o.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No matches"}),m.map(A=>(0,a.jsx)(Ct,{entry:A,namespace:y,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:l,onOpenFile:r},A.path))]})]}),e[4]=o,e[5]=h,e[6]=u,e[7]=v,e[8]=d,e[9]=p,e[10]=i,e[11]=n.backendType,e[12]=n.displayName,e[13]=n.name,e[14]=n.protocol,e[15]=n.rootPath,e[16]=y,e[17]=r,e[18]=l,e[19]=j}else j=e[19];return j};const nn=()=>{let t=(0,Le.c)(31),{namespaces:e}=Se(),{locale:n}=lt(),[i,l]=(0,T.useState)(""),[r,d]=(0,T.useState)(null),c=!!i.trim();if(e.length===0){let b;t[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsxs)("span",{children:["Create an obstore or fsspec connection in your notebook. See the"," ",(0,a.jsx)("a",{className:"text-link",href:"https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start",target:"_blank",rel:"noopener noreferrer",children:"docs"}),"."]}),t[0]=b):b=t[0];let f;return t[1]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(Ia,{title:"No storage connected",description:b,action:(0,a.jsx)(rt,{defaultTab:"storage",children:(0,a.jsxs)($,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(st,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(nt,{className:"h-8 w-8"})}),t[1]=f):f=t[1],f}let h;t[2]===r?h=t[3]:(h=r&&(0,a.jsx)(Za,{entry:r.entry,namespace:r.namespace,protocol:r.protocol,backendType:r.backendType,onBack:()=>d(null)}),t[2]=r,t[3]=h);let s=r&&"hidden",y;t[4]===s?y=t[5]:(y=ie("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",s),t[4]=s,t[5]=y);let x;t[6]===i?x=t[7]:(x=(0,a.jsx)(Da,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:l,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=x);let p;t[8]===c?p=t[9]:(p=c&&(0,a.jsx)($,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>l(""),children:(0,a.jsx)(na,{className:"h-4 w-4"})}),t[8]=c,t[9]=p);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(I,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(ra,{className:"h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2"})}),t[10]=u):u=t[10];let g;t[11]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(rt,{defaultTab:"storage",children:(0,a.jsx)($,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(st,{className:"h-4 w-4"})})}),t[11]=g):g=t[11];let w;t[12]!==x||t[13]!==p?(w=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[x,p,u,g]}),t[12]=x,t[13]=p,t[14]=w):w=t[14];let v;if(t[15]!==n||t[16]!==e||t[17]!==i){let b;t[19]!==n||t[20]!==i?(b=f=>(0,a.jsx)(an,{namespace:f,locale:n,searchValue:i,onOpenFile:d},f.name??f.displayName),t[19]=n,t[20]=i,t[21]=b):b=t[21],v=e.map(b),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let o;t[22]===v?o=t[23]:(o=(0,a.jsx)(za,{className:"flex flex-col",children:v}),t[22]=v,t[23]=o);let j;t[24]!==y||t[25]!==w||t[26]!==o?(j=(0,a.jsxs)(Pa,{className:y,shouldFilter:!1,children:[w,o]}),t[24]=y,t[25]=w,t[26]=o,t[27]=j):j=t[27];let m;return t[28]!==h||t[29]!==j?(m=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[h,j]}),t[28]=h,t[29]=j,t[30]=m):m=t[30],m};var Ft=fe(),St=(0,T.createContext)(null);function rn(){return(0,T.useContext)(St)??void 0}var sn=t=>{let e=(0,Ft.c)(3),{children:n}=t,i=ha(),l;return e[0]!==n||e[1]!==i?(l=(0,a.jsx)(St.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=l):l=e[2],l};const on=t=>{let e=(0,Ft.c)(5),{children:n}=t,[i,l]=(0,T.useState)(null),r;e[0]!==n||e[1]!==i?(r=i&&(0,a.jsx)(xa,{backend:ba,options:{rootElement:i},children:(0,a.jsx)(sn,{children:n})}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let d;return e[3]===r?d=e[4]:(d=(0,a.jsx)("div",{ref:l,className:"contents",children:r}),e[3]=r,e[4]=d),d};var Be=new Map;const ln=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=Pe(),l=ye(Vt),r=ye(Je),d=ye(Ht),[c,h]=(0,T.useState)(""),{data:s,isPending:y,error:x,setData:p,refetch:u}=Ae(async()=>{let k=await n({path:t.path}),_=k.contents||"";return h(Be.get(t.path)||_),k},[t.path]),g=async()=>{c!==(s==null?void 0:s.contents)&&await i({path:t.path,contents:c}).then(k=>{k.success&&(p(_=>({..._,contents:c})),h(c))})},w=(0,T.useRef)(c);if(w.current=c,(0,T.useEffect)(()=>()=>{if(!(s!=null&&s.contents))return;let k=w.current;k===s.contents?Be.delete(t.path):Be.set(t.path,k)},[t.path,s==null?void 0:s.contents]),x)return(0,a.jsx)(dt,{error:x});if(y||!s)return null;let v=s.mimeType||"text/plain",o=v in Kt,j=d&&s.file.isMarimoFile&&(t.path===d||t.path.endsWith(`/${d}`));if(!s.contents&&!o)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let m=(0,a.jsx)(wt,{filename:s.file.name,onRefresh:u,onDownload:r?void 0:()=>{if(s.isBase64&&s.contents){Ce(v)?ze($e(s.contents,v),s.file.name):Fe(ct($e(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Fe(new Blob([s.contents||c],{type:v}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!_e()&&(0,a.jsx)(I,{content:"Open notebook",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:k=>e(k),children:(0,a.jsx)(Oe,{className:"h-3.5 w-3.5"})})}),!Ce(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(I,{content:"Copy contents to clipboard",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:async()=>{await je(c)},children:(0,a.jsx)(Qe,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(I,{content:Oa("global.save"),children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:g,disabled:c===s.contents,children:(0,a.jsx)(va,{className:"h-3.5 w-3.5"})})})]})]})}),b=Ce(v),f=!b&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[m,f&&j&&(0,a.jsxs)(Ma,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(wa,{className:"h-4 w-4"}),(0,a.jsx)(Sa,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Ke,{mimeType:v,contents:b?void 0:f?c:s.contents??void 0,mediaSource:b?{base64:s.contents,mime:v}:void 0,readOnly:!f,onChange:h,extensions:[Zt.of([{key:l.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===s.contents?!1:(g(),!0)}])]})]})},Mt=Ue(t=>{let e=t(Qt);return Lt(e,"no requestClientAtom set"),new pa({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),cn=Ue({});async function dn(){await Rt.get(Mt).refreshAll([])}var oe=" ";const Dt={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
11
11
  ${oe}...
12
12
  `,json:t=>`with open("${t}", "r") as _f:
13
13
  ${oe}_data = json.load(_f)
@@ -23,4 +23,4 @@ ${oe}...
23
23
  ${oe}...
24
24
  `,unknown:t=>`with open("${t}", "r") as _f:
25
25
  ${oe}...
26
- `};var mn=fe(),pn=1024*1024*100;function zt(t){let e=(0,mn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:l}=Pe(),r;e[2]===l?r=e[3]:(r=async c=>{if(c.length===0)return;let h=c.length===1;await Yt(h?"Uploading file...":"Uploading files...",async s=>{s.addTotal(c.length);for(let y of c){let x=jn(yn(y)),p="";x&&(p=_a.guessDeliminator(x).dirname(x));let u=(await Fa(y)).split(",")[1];await l({path:p,type:"file",name:y.name,contents:u}),s.increment(1)}await dn()},{title:h?"File uploaded":`${c.length} files uploaded`})},e[2]=l,e[3]=r);let d;return e[4]!==i||e[5]!==r?(d={multiple:!0,maxSize:pn,onError:un,onDropRejected:hn,onDrop:r,...i},e[4]=i,e[5]=r,e[6]=d):d=e[6],ka(d)}function hn(t){te({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(xn)}),variant:"danger"})}function xn(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(fn).join(", "),")"]},t.file.name)}function fn(t){return t.message}function un(t){Me.error(t),te({title:"File upload failed",description:t.message,variant:"danger"})}function yn(t){if(t.webkitRelativePath)return t.webkitRelativePath;if("path"in t&&typeof t.path=="string")return t.path;if("relativePath"in t&&typeof t.relativePath=="string")return t.relativePath}function jn(t){if(t)return t.replace(/^\/+/,"")}var be=fe(),gn=Ge("marimo:showHiddenFiles",!0,We,{getOnInit:!0}),Pt=T.createContext(null);const bn=t=>{let e=(0,be.c)(72),{height:n}=t,i=(0,T.useRef)(null),l=rn(),[r]=ke(Mt),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,h]=(0,T.useState)(d),[s,y]=(0,T.useState)(null),[x,p]=ke(gn),{openPrompt:u}=it(),[g,w]=ke(cn),v;e[1]===r?v=e[2]:(v=()=>r.initialize(h),e[1]=r,e[2]=v);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[3]=o):o=e[3];let{isPending:j,error:m}=Ee(v,o),b;e[4]!==g||e[5]!==r?(b=()=>r.refreshAll(Object.keys(g).filter(N=>g[N])),e[4]=g,e[5]=r,e[6]=b):b=e[6];let f=ee(b),k;e[7]!==p||e[8]!==x?(k=()=>{p(!x)},e[7]=p,e[8]=x,e[9]=k):k=e[9];let _=ee(k),C;e[10]!==u||e[11]!==r?(C=async()=>{u({title:"Folder name",onConfirm:async N=>{r.createFolder(N,null)}})},e[10]=u,e[11]=r,e[12]=C):C=e[12];let F=ee(C),z;e[13]!==u||e[14]!==r?(z=async()=>{u({title:"File name",onConfirm:async N=>{r.createFile({name:N,parentId:null})}})},e[13]=u,e[14]=r,e[15]=z):z=e[15];let S=ee(z),M;e[16]!==u||e[17]!==r?(M=async()=>{u({title:"Notebook name",onConfirm:async N=>{r.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=u,e[17]=r,e[18]=M):M=e[18];let E=ee(M),R;e[19]===w?R=e[20]:(R=()=>{var N;(N=i.current)==null||N.closeAll(),w({})},e[19]=w,e[20]=R);let Z=ee(R),J;e[21]!==c||e[22]!==x?(J=Ot(c,x),e[21]=c,e[22]=x,e[23]=J):J=e[23];let le=J;if(j){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(da,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(m){let N;return e[25]===m?N=e[26]:(N=(0,a.jsx)(dt,{error:m}),e[25]=m,e[26]=N),N}if(s){let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=()=>y(null),e[27]=N):N=e[27];let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsx)($,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Xe,{size:16})}),e[28]=P):P=e[28];let O;e[29]===s.name?O=e[30]:(O=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[P,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=O);let G;e[31]!==s.path||e[32]!==r?(G=ne=>Tt(ne,r.relativeFromRoot(s.path)),e[31]=s.path,e[32]=r,e[33]=G):G=e[33];let Y;e[34]!==s||e[35]!==G?(Y=(0,a.jsx)(T.Suspense,{children:(0,a.jsx)(ln,{onOpenNotebook:G,file:s})}),e[34]=s,e[35]=G,e[36]=Y):Y=e[36];let X;return e[37]!==O||e[38]!==Y?(X=(0,a.jsxs)(a.Fragment,{children:[O,Y]}),e[37]=O,e[38]=Y,e[39]=X):X=e[39],X}let H;e[40]!==Z||e[41]!==S||e[42]!==F||e[43]!==E||e[44]!==_||e[45]!==f||e[46]!==r?(H=(0,a.jsx)(wn,{onRefresh:f,onHidden:_,onCreateFile:S,onCreateNotebook:E,onCreateFolder:F,onCollapseAll:Z,tree:r}),e[40]=Z,e[41]=S,e[42]=F,e[43]=E,e[44]=_,e[45]=f,e[46]=r,e[47]=H):H=e[47];let Q=n-33,L,V,B;e[48]===r?(L=e[49],V=e[50],B=e[51]):(L=async N=>{let{ids:P}=N;for(let O of P)await r.delete(O)},V=async N=>{let{id:P,name:O}=N;await r.rename(P,O)},B=async N=>{let{dragIds:P,parentId:O}=N;await r.move(P,O)},e[48]=r,e[49]=L,e[50]=V,e[51]=B);let K;e[52]===Symbol.for("react.memo_cache_sentinel")?(K=N=>{let P=N[0];P&&(P.data.isDirectory||y(P.data))},e[52]=K):K=e[52];let q;e[53]!==g||e[54]!==w||e[55]!==r?(q=async N=>{if(await r.expand(N)){let P=g[N]??!1;w({...g,[N]:!P})}},e[53]=g,e[54]=w,e[55]=r,e[56]=q):q=e[56];let U;e[57]!==l||e[58]!==g||e[59]!==Q||e[60]!==L||e[61]!==V||e[62]!==B||e[63]!==q||e[64]!==le?(U=(0,a.jsx)(ua,{width:"100%",ref:i,height:Q,className:"h-full",data:le,initialOpenState:g,openByDefault:!1,dndManager:l,renderCursor:Fn,disableDrop:Sn,onDelete:L,onRename:V,onMove:B,onSelect:K,onToggle:q,padding:15,rowHeight:30,indent:vn,overscanCount:1e3,disableMultiSelection:!0,children:kn}),e[57]=l,e[58]=g,e[59]=Q,e[60]=L,e[61]=V,e[62]=B,e[63]=q,e[64]=le,e[65]=U):U=e[65];let W;e[66]!==U||e[67]!==r?(W=(0,a.jsx)(Pt,{value:r,children:U}),e[66]=U,e[67]=r,e[68]=W):W=e[68];let ae;return e[69]!==H||e[70]!==W?(ae=(0,a.jsxs)(a.Fragment,{children:[H,W]}),e[69]=H,e[70]=W,e[71]=ae):ae=e[71],ae};var vn=15,wn=t=>{let e=(0,be.c)(37),{onRefresh:n,onHidden:i,onCreateFile:l,onCreateNotebook:r,onCreateFolder:d,onCollapseAll:c}=t,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={noDrag:!0,noDragEventsBubbling:!0},e[0]=h):h=e[0];let{getRootProps:s,getInputProps:y}=zt(h),x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(yt,{size:16}),e[1]=x):x=e[1];let p;e[2]===r?p=e[3]:(p=(0,a.jsx)(I,{content:"Add notebook",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-notebook-button",onClick:r,variant:"text",size:"xs",children:x})}),e[2]=r,e[3]=p);let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(jt,{size:16}),e[4]=u):u=e[4];let g;e[5]===l?g=e[6]:(g=(0,a.jsx)(I,{content:"Add file",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-file-button",onClick:l,variant:"text",size:"xs",children:u})}),e[5]=l,e[6]=g);let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsx)(gt,{size:16}),e[7]=w):w=e[7];let v;e[8]===d?v=e[9]:(v=(0,a.jsx)(I,{content:"Add folder",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-folder-button",onClick:d,variant:"text",size:"xs",children:w})}),e[8]=d,e[9]=v);let o;e[10]===s?o=e[11]:(o=s({}),e[10]=s,e[11]=o);let j,m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=Xt({variant:"text",size:"xs"}),j=(0,a.jsx)(Na,{size:16}),e[12]=j,e[13]=m):(j=e[12],m=e[13]);let b;e[14]===o?b=e[15]:(b=(0,a.jsx)(I,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...o,className:m,children:j})}),e[14]=o,e[15]=b);let f;e[16]===y?f=e[17]:(f=y({}),e[16]=y,e[17]=f);let k;e[18]===f?k=e[19]:(k=(0,a.jsx)("input",{...f,type:"file"}),e[18]=f,e[19]=k);let _;e[20]===n?_=e[21]:(_=(0,a.jsx)(ht,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=_);let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsx)(sa,{size:16}),e[22]=C):C=e[22];let F;e[23]===i?F=e[24]:(F=(0,a.jsx)(I,{content:"Toggle hidden files",children:(0,a.jsx)($,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:C})}),e[23]=i,e[24]=F);let z;e[25]===Symbol.for("react.memo_cache_sentinel")?(z=(0,a.jsx)(Ua,{size:16}),e[25]=z):z=e[25];let S;e[26]===c?S=e[27]:(S=(0,a.jsx)(I,{content:"Collapse all folders",children:(0,a.jsx)($,{"data-testid":"file-explorer-collapse-button",onClick:c,variant:"text",size:"xs",children:z})}),e[26]=c,e[27]=S);let M;return e[28]!==b||e[29]!==k||e[30]!==_||e[31]!==F||e[32]!==S||e[33]!==p||e[34]!==g||e[35]!==v?(M=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[p,g,v,b,k,_,F,S]}),e[28]=b,e[29]=k,e[30]=_,e[31]=F,e[32]=S,e[33]=p,e[34]=g,e[35]=v,e[36]=M):M=e[36],M},Nn=t=>{let e=(0,be.c)(9),{node:n,onOpenMarimoFile:i}=t,l;e[0]===n?l=e[1]:(l=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=l);let r;e[2]!==n.data.isMarimoFile||e[3]!==i?(r=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)("span",{"data-testid":"file-explorer-open-marimo-button",className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:i,children:["open ",(0,a.jsx)(Oe,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=r):r=e[4];let d;return e[5]!==n.data.name||e[6]!==l||e[7]!==r?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:l,children:[n.data.name,r]}),e[5]=n.data.name,e[6]=l,e[7]=r,e[8]=d):d=e[8],d},kn=t=>{let e=(0,be.c)(116),{node:n,style:i,dragHandle:l}=t,{openFile:r,sendFileDetails:d}=Pe(),c=ye(Je),h;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(h=n.data.isDirectory?"directory":la(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=h):h=e[2];let s=h,y=ia[s],{openConfirm:x,openPrompt:p}=it(),{createNewCell:u}=At(),g=Ta(),w;e[3]!==u||e[4]!==g?(w=D=>{u({code:D,before:!1,cellId:g??"__end__"})},e[3]=u,e[4]=g,e[5]=w):w=e[5];let v=w,o=(0,T.use)(Pt),j;e[6]!==n.data.path||e[7]!==o?(j=async D=>{Tt(D,o?o.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=o,e[8]=j):j=e[8];let m=j,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==x?(b=async D=>{D.stopPropagation(),D.preventDefault(),x({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,a.jsx)(Ut,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[9]=n.data.name,e[10]=n.id,e[11]=n.tree,e[12]=x,e[13]=b):b=e[13];let f=b,k;e[14]!==n||e[15]!==p||e[16]!==o?(k=async()=>{n.open(),p({title:"Folder name",onConfirm:async D=>{o==null||o.createFolder(D,n.id)}})},e[14]=n,e[15]=p,e[16]=o,e[17]=k):k=e[17];let _=ee(k),C;e[18]!==n||e[19]!==p||e[20]!==o?(C=async()=>{n.open(),p({title:"File name",onConfirm:async D=>{o==null||o.createFile({name:D,parentId:n.id})}})},e[18]=n,e[19]=p,e[20]=o,e[21]=C):C=e[21];let F=ee(C),z;e[22]!==n||e[23]!==p||e[24]!==o?(z=async()=>{n.open(),p({title:"Notebook name",onConfirm:async D=>{o==null||o.createFile({name:D,parentId:n.id,type:"notebook"})}})},e[22]=n,e[23]=p,e[24]=o,e[25]=z):z=e[25];let S=ee(z),M;e[26]!==n.data.name||e[27]!==n.id||e[28]!==o?(M=async()=>{o&&await o.copy(n.id,Aa(n.data.name))},e[26]=n.data.name,e[27]=n.id,e[28]=o,e[29]=M):M=e[29];let E=ee(M),R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=R):R=e[30];let Z,J;e[31]===n?(Z=e[32],J=e[33]):(Z=D=>{D.stopPropagation(),n.data.isDirectory&&n.toggle()},J=(0,a.jsx)(_n,{node:n}),e[31]=n,e[32]=Z,e[33]=J);let le=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",H;e[34]===le?H=e[35]:(H=ie("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",le),e[34]=le,e[35]=H);let Q;e[36]!==y||e[37]!==s||e[38]!==n.data.isMarimoFile?(Q=n.data.isMarimoFile?(0,a.jsx)(Va,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(y,{className:ie("w-5 h-5 shrink-0 mr-2",tt[s]),strokeWidth:1.5}),e[36]=y,e[37]=s,e[38]=n.data.isMarimoFile,e[39]=Q):Q=e[39];let L;e[40]!==m||e[41]!==n?(L=n.isEditing?(0,a.jsx)(ga,{node:n}):(0,a.jsx)(Nn,{node:n,onOpenMarimoFile:m}),e[40]=m,e[41]=n,e[42]=L):L=e[42];let V;e[43]===n?V=e[44]:(V=!n.data.isDirectory&&(0,a.jsxs)(A,{onSelect:()=>n.select(),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=n,e[44]=V);let B;e[45]!==n.data.isDirectory||e[46]!==n.data.path||e[47]!==r?(B=!n.data.isDirectory&&!_e()&&(0,a.jsxs)(A,{onSelect:()=>{r({path:n.data.path})},children:[(0,a.jsx)(Oe,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),e[45]=n.data.isDirectory,e[46]=n.data.path,e[47]=r,e[48]=B):B=e[48];let K;e[49]!==F||e[50]!==_||e[51]!==S||e[52]!==n.data.isDirectory?(K=n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A,{onSelect:()=>S(),children:[(0,a.jsx)(yt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(A,{onSelect:()=>F(),children:[(0,a.jsx)(jt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(A,{onSelect:()=>_(),children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=F,e[50]=_,e[51]=S,e[52]=n.data.isDirectory,e[53]=K):K=e[53];let q;e[54]===n?q=e[55]:(q=(0,a.jsx)(ma,{onSelect:()=>n.edit()}),e[54]=n,e[55]=q);let U;e[56]===E?U=e[57]:(U=(0,a.jsx)(ja,{onSelect:E}),e[56]=E,e[57]=U);let W;e[58]===n.data.path?W=e[59]:(W=async()=>{await je(n.data.path),te({title:"Copied to clipboard"})},e[58]=n.data.path,e[59]=W);let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=(0,a.jsx)(bt,{className:ge}),e[60]=ae):ae=e[60];let N;e[61]===W?N=e[62]:(N=(0,a.jsxs)(A,{onSelect:W,children:[ae,"Copy path"]}),e[61]=W,e[62]=N);let P;e[63]!==n.data.path||e[64]!==o?(P=o&&(0,a.jsxs)(A,{onSelect:async()=>{await je(o.relativeFromRoot(n.data.path)),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(bt,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=n.data.path,e[64]=o,e[65]=P):P=e[65];let O;e[66]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(ue,{}),e[66]=O):O=e[66];let G;e[67]!==s||e[68]!==v||e[69]!==n.data?(G=()=>{let{path:D}=n.data;v(Dt[s](D))},e[67]=s,e[68]=v,e[69]=n.data,e[70]=G):G=e[70];let Y;e[71]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,a.jsx)(aa,{className:ge}),e[71]=Y):Y=e[71];let X;e[72]===G?X=e[73]:(X=(0,a.jsxs)(A,{onSelect:G,children:[Y,"Insert snippet for reading file"]}),e[72]=G,e[73]=X);let ne;e[74]!==s||e[75]!==n.data?(ne=async()=>{te({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});let{path:D}=n.data;await je(Dt[s](D))},e[74]=s,e[75]=n.data,e[76]=ne):ne=e[76];let ve;e[77]===Symbol.for("react.memo_cache_sentinel")?(ve=(0,a.jsx)(It,{className:ge}),e[77]=ve):ve=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(A,{onSelect:ne,children:[ve,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==m||e[81]!==n.data.isMarimoFile?(de=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(A,{onSelect:m,children:[(0,a.jsx)(Ga,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=m,e[81]=n.data.isMarimoFile,e[82]=de):de=e[82];let we;e[83]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(ue,{}),e[83]=we):we=e[83];let me;e[84]!==c||e[85]!==n.data.isDirectory||e[86]!==n.data.name||e[87]!==n.data.path||e[88]!==d?(me=!n.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A,{onSelect:async()=>{let D=await d({path:n.data.path});D.isBase64&&D.contents?Fe(ct($e(D.contents,D.mimeType||"application/octet-stream")),n.data.name):Fe(new Blob([D.contents||""]),n.data.name)},children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{})]}),e[84]=c,e[85]=n.data.isDirectory,e[86]=n.data.name,e[87]=n.data.path,e[88]=d,e[89]=me):me=e[89];let pe;e[90]===f?pe=e[91]:(pe=(0,a.jsx)(ya,{onSelect:f}),e[90]=f,e[91]=pe);let he;e[92]!==V||e[93]!==B||e[94]!==K||e[95]!==q||e[96]!==U||e[97]!==N||e[98]!==P||e[99]!==X||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(fa,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[V,B,K,q,U,N,P,O,X,ce,de,we,me,pe]}),e[92]=V,e[93]=B,e[94]=K,e[95]=q,e[96]=U,e[97]=N,e[98]=P,e[99]=X,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==H||e[106]!==Q||e[107]!==L||e[108]!==he?(xe=(0,a.jsxs)("span",{className:H,children:[Q,L,he]}),e[105]=H,e[106]=Q,e[107]=L,e[108]=he,e[109]=xe):xe=e[109];let Ne;return e[110]!==l||e[111]!==i||e[112]!==Z||e[113]!==J||e[114]!==xe?(Ne=(0,a.jsxs)("div",{style:i,ref:l,className:R,draggable:!0,onClick:Z,children:[J,xe]}),e[110]=l,e[111]=i,e[112]=Z,e[113]=J,e[114]=xe,e[115]=Ne):Ne=e[115],Ne},_n=t=>{let e=(0,be.c)(3),{node:n}=t;if(!n.data.isDirectory){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=l):l=e[0],l}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Ae,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Tt(t,e){t.stopPropagation(),t.preventDefault(),Ba(e)}function Ot(t,e){if(e)return t;let n=[];for(let i of t){if(Cn(i.name))continue;let l=i;if(i.children){let r=Ot(i.children,e);r!==i.children&&(l={...i,children:r})}n.push(l)}return n}function Cn(t){return!!t.startsWith(".")}function Fn(){return null}function Sn(t){let{parentNode:e}=t;return!e.data.isDirectory}var $t=fe(),Mn=Ge("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},We),Dn=t=>{let e=(0,$t.c)(20),{height:n}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noClick:!0,noKeyboard:!0},e[0]=i):i=e[0];let{getRootProps:l,getInputProps:r,isDragActive:d}=zt(i),c;e[1]===l?c=e[2]:(c=l(),e[1]=l,e[2]=c);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=ie("flex flex-col overflow-hidden relative"),e[3]=h):h=e[3];let s;e[4]===n?s=e[5]:(s={height:n},e[4]=n,e[5]=s);let y;e[6]===r?y=e[7]:(y=r(),e[6]=r,e[7]=y);let x;e[8]===y?x=e[9]:(x=(0,a.jsx)("input",{...y}),e[8]=y,e[9]=x);let p;e[10]===d?p=e[11]:(p=d&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),e[10]=d,e[11]=p);let u;e[12]===n?u=e[13]:(u=(0,a.jsx)(bn,{height:n}),e[12]=n,e[13]=u);let g;return e[14]!==c||e[15]!==s||e[16]!==x||e[17]!==p||e[18]!==u?(g=(0,a.jsx)(on,{children:(0,a.jsxs)("div",{...c,className:h,style:s,children:[x,p,u]})}),e[14]=c,e[15]=s,e[16]=x,e[17]=p,e[18]=u,e[19]=g):g=e[19],g},zn=33,Pn=()=>{let t=(0,$t.c)(36),{ref:e,height:n}=$a(),i=n===void 0?500:n,[l,r]=ke(Mn),d=ye(ta).length,c;e:{if(!l.hasUserInteracted&&d>0){if(l.openSections.includes("remote-storage")){c=l.openSections;break e}let R;t[0]===l.openSections?R=t[1]:(R=[...l.openSections,"remote-storage"],t[0]=l.openSections,t[1]=R),c=R;break e}c=l.openSections}let h=c,s;t[2]===r?s=t[3]:(s=R=>{r({openSections:R,hasUserInteracted:!0})},t[2]=r,t[3]=s);let y=s,x=i-zn*2,p;t[4]===h?p=t[5]:(p=h.includes("remote-storage"),t[4]=h,t[5]=p);let u=p,g;t[6]!==h||t[7]!==u?(g=u&&h.includes("files"),t[6]=h,t[7]=u,t[8]=g):g=t[8];let w=g,v;t[9]!==x||t[10]!==w?(v=w?Math.round(x*.4):x,t[9]=x,t[10]=w,t[11]=v):v=t[11];let o=v,j=Math.max(200,w?x-o:x),m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(nt,{className:"w-4 h-4"}),t[12]=m):m=t[12];let b;t[13]===d?b=t[14]:(b=d>0&&(0,a.jsx)(La,{children:d}),t[13]=d,t[14]=b);let f;t[15]===b?f=t[16]:(f=(0,a.jsxs)(ft,{children:[m," Remote storage",b]}),t[15]=b,t[16]=f);let k;t[17]===o?k=t[18]:(k={maxHeight:o},t[17]=o,t[18]=k);let _;t[19]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)(nn,{}),t[19]=_):_=t[19];let C;t[20]===k?C=t[21]:(C=(0,a.jsx)(ut,{className:"overflow-auto",style:k,children:_}),t[20]=k,t[21]=C);let F;t[22]!==C||t[23]!==f?(F=(0,a.jsxs)(xt,{value:"remote-storage",children:[f,C]}),t[22]=C,t[23]=f,t[24]=F):F=t[24];let z;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=(0,a.jsxs)(ft,{children:[(0,a.jsx)(at,{className:"w-4 h-4"}),"Files"]}),t[25]=z):z=t[25];let S;t[26]===j?S=t[27]:(S=(0,a.jsxs)(xt,{value:"files",children:[z,(0,a.jsx)(ut,{children:(0,a.jsx)(Dn,{height:j})})]}),t[26]=j,t[27]=S);let M;t[28]!==y||t[29]!==h||t[30]!==F||t[31]!==S?(M=(0,a.jsxs)(qt,{type:"multiple",value:h,onValueChange:y,children:[F,S]}),t[28]=y,t[29]=h,t[30]=F,t[31]=S,t[32]=M):M=t[32];let E;return t[33]!==e||t[34]!==M?(E=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:M}),t[33]=e,t[34]=M,t[35]=E):E=t[35],E};export{Pn as default};
26
+ `};var mn=fe(),pn=1024*1024*100;function zt(t){let e=(0,mn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:l}=Pe(),r;e[2]===l?r=e[3]:(r=async c=>{if(c.length===0)return;let h=c.length===1;await Yt(h?"Uploading file...":"Uploading files...",async s=>{s.addTotal(c.length);for(let y of c){let x=jn(yn(y)),p="";x&&(p=_a.guessDeliminator(x).dirname(x));let u=(await Fa(y)).split(",")[1];await l({path:p,type:"file",name:y.name,contents:u}),s.increment(1)}await dn()},{title:h?"File uploaded":`${c.length} files uploaded`})},e[2]=l,e[3]=r);let d;return e[4]!==i||e[5]!==r?(d={multiple:!0,maxSize:pn,onError:un,onDropRejected:hn,onDrop:r,...i},e[4]=i,e[5]=r,e[6]=d):d=e[6],ka(d)}function hn(t){te({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(xn)}),variant:"danger"})}function xn(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(fn).join(", "),")"]},t.file.name)}function fn(t){return t.message}function un(t){Me.error(t),te({title:"File upload failed",description:t.message,variant:"danger"})}function yn(t){if(t.webkitRelativePath)return t.webkitRelativePath;if("path"in t&&typeof t.path=="string")return t.path;if("relativePath"in t&&typeof t.relativePath=="string")return t.relativePath}function jn(t){if(t)return t.replace(/^\/+/,"")}var be=fe(),gn=Ge("marimo:showHiddenFiles",!0,We,{getOnInit:!0}),Pt=T.createContext(null);const bn=t=>{let e=(0,be.c)(72),{height:n}=t,i=(0,T.useRef)(null),l=rn(),[r]=ke(Mt),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,h]=(0,T.useState)(d),[s,y]=(0,T.useState)(null),[x,p]=ke(gn),{openPrompt:u}=it(),[g,w]=ke(cn),v;e[1]===r?v=e[2]:(v=()=>r.initialize(h),e[1]=r,e[2]=v);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[3]=o):o=e[3];let{isPending:j,error:m}=Ae(v,o),b;e[4]!==g||e[5]!==r?(b=()=>r.refreshAll(Object.keys(g).filter(N=>g[N])),e[4]=g,e[5]=r,e[6]=b):b=e[6];let f=ee(b),k;e[7]!==p||e[8]!==x?(k=()=>{p(!x)},e[7]=p,e[8]=x,e[9]=k):k=e[9];let _=ee(k),C;e[10]!==u||e[11]!==r?(C=async()=>{u({title:"Folder name",onConfirm:async N=>{r.createFolder(N,null)}})},e[10]=u,e[11]=r,e[12]=C):C=e[12];let F=ee(C),z;e[13]!==u||e[14]!==r?(z=async()=>{u({title:"File name",onConfirm:async N=>{r.createFile({name:N,parentId:null})}})},e[13]=u,e[14]=r,e[15]=z):z=e[15];let S=ee(z),M;e[16]!==u||e[17]!==r?(M=async()=>{u({title:"Notebook name",onConfirm:async N=>{r.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=u,e[17]=r,e[18]=M):M=e[18];let A=ee(M),R;e[19]===w?R=e[20]:(R=()=>{var N;(N=i.current)==null||N.closeAll(),w({})},e[19]=w,e[20]=R);let Z=ee(R),J;e[21]!==c||e[22]!==x?(J=Ot(c,x),e[21]=c,e[22]=x,e[23]=J):J=e[23];let le=J;if(j){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(da,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(m){let N;return e[25]===m?N=e[26]:(N=(0,a.jsx)(dt,{error:m}),e[25]=m,e[26]=N),N}if(s){let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=()=>y(null),e[27]=N):N=e[27];let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsx)($,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Xe,{size:16})}),e[28]=P):P=e[28];let O;e[29]===s.name?O=e[30]:(O=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[P,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=O);let G;e[31]!==s.path||e[32]!==r?(G=ne=>Tt(ne,r.relativeFromRoot(s.path)),e[31]=s.path,e[32]=r,e[33]=G):G=e[33];let Y;e[34]!==s||e[35]!==G?(Y=(0,a.jsx)(T.Suspense,{children:(0,a.jsx)(ln,{onOpenNotebook:G,file:s})}),e[34]=s,e[35]=G,e[36]=Y):Y=e[36];let X;return e[37]!==O||e[38]!==Y?(X=(0,a.jsxs)(a.Fragment,{children:[O,Y]}),e[37]=O,e[38]=Y,e[39]=X):X=e[39],X}let H;e[40]!==Z||e[41]!==S||e[42]!==F||e[43]!==A||e[44]!==_||e[45]!==f||e[46]!==r?(H=(0,a.jsx)(wn,{onRefresh:f,onHidden:_,onCreateFile:S,onCreateNotebook:A,onCreateFolder:F,onCollapseAll:Z,tree:r}),e[40]=Z,e[41]=S,e[42]=F,e[43]=A,e[44]=_,e[45]=f,e[46]=r,e[47]=H):H=e[47];let Q=n-33,L,V,B;e[48]===r?(L=e[49],V=e[50],B=e[51]):(L=async N=>{let{ids:P}=N;for(let O of P)await r.delete(O)},V=async N=>{let{id:P,name:O}=N;await r.rename(P,O)},B=async N=>{let{dragIds:P,parentId:O}=N;await r.move(P,O)},e[48]=r,e[49]=L,e[50]=V,e[51]=B);let K;e[52]===Symbol.for("react.memo_cache_sentinel")?(K=N=>{let P=N[0];P&&(P.data.isDirectory||y(P.data))},e[52]=K):K=e[52];let q;e[53]!==g||e[54]!==w||e[55]!==r?(q=async N=>{if(await r.expand(N)){let P=g[N]??!1;w({...g,[N]:!P})}},e[53]=g,e[54]=w,e[55]=r,e[56]=q):q=e[56];let U;e[57]!==l||e[58]!==g||e[59]!==Q||e[60]!==L||e[61]!==V||e[62]!==B||e[63]!==q||e[64]!==le?(U=(0,a.jsx)(ua,{width:"100%",ref:i,height:Q,className:"h-full",data:le,initialOpenState:g,openByDefault:!1,dndManager:l,renderCursor:Fn,disableDrop:Sn,onDelete:L,onRename:V,onMove:B,onSelect:K,onToggle:q,padding:15,rowHeight:30,indent:vn,overscanCount:1e3,disableMultiSelection:!0,children:kn}),e[57]=l,e[58]=g,e[59]=Q,e[60]=L,e[61]=V,e[62]=B,e[63]=q,e[64]=le,e[65]=U):U=e[65];let W;e[66]!==U||e[67]!==r?(W=(0,a.jsx)(Pt,{value:r,children:U}),e[66]=U,e[67]=r,e[68]=W):W=e[68];let ae;return e[69]!==H||e[70]!==W?(ae=(0,a.jsxs)(a.Fragment,{children:[H,W]}),e[69]=H,e[70]=W,e[71]=ae):ae=e[71],ae};var vn=15,wn=t=>{let e=(0,be.c)(37),{onRefresh:n,onHidden:i,onCreateFile:l,onCreateNotebook:r,onCreateFolder:d,onCollapseAll:c}=t,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={noDrag:!0,noDragEventsBubbling:!0},e[0]=h):h=e[0];let{getRootProps:s,getInputProps:y}=zt(h),x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(yt,{size:16}),e[1]=x):x=e[1];let p;e[2]===r?p=e[3]:(p=(0,a.jsx)(I,{content:"Add notebook",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-notebook-button",onClick:r,variant:"text",size:"xs",children:x})}),e[2]=r,e[3]=p);let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(jt,{size:16}),e[4]=u):u=e[4];let g;e[5]===l?g=e[6]:(g=(0,a.jsx)(I,{content:"Add file",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-file-button",onClick:l,variant:"text",size:"xs",children:u})}),e[5]=l,e[6]=g);let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsx)(gt,{size:16}),e[7]=w):w=e[7];let v;e[8]===d?v=e[9]:(v=(0,a.jsx)(I,{content:"Add folder",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-folder-button",onClick:d,variant:"text",size:"xs",children:w})}),e[8]=d,e[9]=v);let o;e[10]===s?o=e[11]:(o=s({}),e[10]=s,e[11]=o);let j,m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=Xt({variant:"text",size:"xs"}),j=(0,a.jsx)(Na,{size:16}),e[12]=j,e[13]=m):(j=e[12],m=e[13]);let b;e[14]===o?b=e[15]:(b=(0,a.jsx)(I,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...o,className:m,children:j})}),e[14]=o,e[15]=b);let f;e[16]===y?f=e[17]:(f=y({}),e[16]=y,e[17]=f);let k;e[18]===f?k=e[19]:(k=(0,a.jsx)("input",{...f,type:"file"}),e[18]=f,e[19]=k);let _;e[20]===n?_=e[21]:(_=(0,a.jsx)(ht,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=_);let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsx)(sa,{size:16}),e[22]=C):C=e[22];let F;e[23]===i?F=e[24]:(F=(0,a.jsx)(I,{content:"Toggle hidden files",children:(0,a.jsx)($,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:C})}),e[23]=i,e[24]=F);let z;e[25]===Symbol.for("react.memo_cache_sentinel")?(z=(0,a.jsx)(Ua,{size:16}),e[25]=z):z=e[25];let S;e[26]===c?S=e[27]:(S=(0,a.jsx)(I,{content:"Collapse all folders",children:(0,a.jsx)($,{"data-testid":"file-explorer-collapse-button",onClick:c,variant:"text",size:"xs",children:z})}),e[26]=c,e[27]=S);let M;return e[28]!==b||e[29]!==k||e[30]!==_||e[31]!==F||e[32]!==S||e[33]!==p||e[34]!==g||e[35]!==v?(M=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[p,g,v,b,k,_,F,S]}),e[28]=b,e[29]=k,e[30]=_,e[31]=F,e[32]=S,e[33]=p,e[34]=g,e[35]=v,e[36]=M):M=e[36],M},Nn=t=>{let e=(0,be.c)(9),{node:n,onOpenMarimoFile:i}=t,l;e[0]===n?l=e[1]:(l=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=l);let r;e[2]!==n.data.isMarimoFile||e[3]!==i?(r=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)("span",{"data-testid":"file-explorer-open-marimo-button",className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:i,children:["open ",(0,a.jsx)(Oe,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=r):r=e[4];let d;return e[5]!==n.data.name||e[6]!==l||e[7]!==r?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:l,children:[n.data.name,r]}),e[5]=n.data.name,e[6]=l,e[7]=r,e[8]=d):d=e[8],d},kn=t=>{let e=(0,be.c)(116),{node:n,style:i,dragHandle:l}=t,{openFile:r,sendFileDetails:d}=Pe(),c=ye(Je),h;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(h=n.data.isDirectory?"directory":la(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=h):h=e[2];let s=h,y=ia[s],{openConfirm:x,openPrompt:p}=it(),{createNewCell:u}=Et(),g=Ta(),w;e[3]!==u||e[4]!==g?(w=D=>{u({code:D,before:!1,cellId:g??"__end__"})},e[3]=u,e[4]=g,e[5]=w):w=e[5];let v=w,o=(0,T.use)(Pt),j;e[6]!==n.data.path||e[7]!==o?(j=async D=>{Tt(D,o?o.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=o,e[8]=j):j=e[8];let m=j,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==x?(b=async D=>{D.stopPropagation(),D.preventDefault(),x({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,a.jsx)(Ut,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[9]=n.data.name,e[10]=n.id,e[11]=n.tree,e[12]=x,e[13]=b):b=e[13];let f=b,k;e[14]!==n||e[15]!==p||e[16]!==o?(k=async()=>{n.open(),p({title:"Folder name",onConfirm:async D=>{o==null||o.createFolder(D,n.id)}})},e[14]=n,e[15]=p,e[16]=o,e[17]=k):k=e[17];let _=ee(k),C;e[18]!==n||e[19]!==p||e[20]!==o?(C=async()=>{n.open(),p({title:"File name",onConfirm:async D=>{o==null||o.createFile({name:D,parentId:n.id})}})},e[18]=n,e[19]=p,e[20]=o,e[21]=C):C=e[21];let F=ee(C),z;e[22]!==n||e[23]!==p||e[24]!==o?(z=async()=>{n.open(),p({title:"Notebook name",onConfirm:async D=>{o==null||o.createFile({name:D,parentId:n.id,type:"notebook"})}})},e[22]=n,e[23]=p,e[24]=o,e[25]=z):z=e[25];let S=ee(z),M;e[26]!==n.data.name||e[27]!==n.id||e[28]!==o?(M=async()=>{o&&await o.copy(n.id,Ea(n.data.name))},e[26]=n.data.name,e[27]=n.id,e[28]=o,e[29]=M):M=e[29];let A=ee(M),R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=R):R=e[30];let Z,J;e[31]===n?(Z=e[32],J=e[33]):(Z=D=>{D.stopPropagation(),n.data.isDirectory&&n.toggle()},J=(0,a.jsx)(_n,{node:n}),e[31]=n,e[32]=Z,e[33]=J);let le=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",H;e[34]===le?H=e[35]:(H=ie("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",le),e[34]=le,e[35]=H);let Q;e[36]!==y||e[37]!==s||e[38]!==n.data.isMarimoFile?(Q=n.data.isMarimoFile?(0,a.jsx)(Va,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(y,{className:ie("w-5 h-5 shrink-0 mr-2",tt[s]),strokeWidth:1.5}),e[36]=y,e[37]=s,e[38]=n.data.isMarimoFile,e[39]=Q):Q=e[39];let L;e[40]!==m||e[41]!==n?(L=n.isEditing?(0,a.jsx)(ga,{node:n}):(0,a.jsx)(Nn,{node:n,onOpenMarimoFile:m}),e[40]=m,e[41]=n,e[42]=L):L=e[42];let V;e[43]===n?V=e[44]:(V=!n.data.isDirectory&&(0,a.jsxs)(E,{onSelect:()=>n.select(),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=n,e[44]=V);let B;e[45]!==n.data.isDirectory||e[46]!==n.data.path||e[47]!==r?(B=!n.data.isDirectory&&!_e()&&(0,a.jsxs)(E,{onSelect:()=>{r({path:n.data.path})},children:[(0,a.jsx)(Oe,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),e[45]=n.data.isDirectory,e[46]=n.data.path,e[47]=r,e[48]=B):B=e[48];let K;e[49]!==F||e[50]!==_||e[51]!==S||e[52]!==n.data.isDirectory?(K=n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(E,{onSelect:()=>S(),children:[(0,a.jsx)(yt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(E,{onSelect:()=>F(),children:[(0,a.jsx)(jt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(E,{onSelect:()=>_(),children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=F,e[50]=_,e[51]=S,e[52]=n.data.isDirectory,e[53]=K):K=e[53];let q;e[54]===n?q=e[55]:(q=(0,a.jsx)(ma,{onSelect:()=>n.edit()}),e[54]=n,e[55]=q);let U;e[56]===A?U=e[57]:(U=(0,a.jsx)(ja,{onSelect:A}),e[56]=A,e[57]=U);let W;e[58]===n.data.path?W=e[59]:(W=async()=>{await je(n.data.path),te({title:"Copied to clipboard"})},e[58]=n.data.path,e[59]=W);let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=(0,a.jsx)(bt,{className:ge}),e[60]=ae):ae=e[60];let N;e[61]===W?N=e[62]:(N=(0,a.jsxs)(E,{onSelect:W,children:[ae,"Copy path"]}),e[61]=W,e[62]=N);let P;e[63]!==n.data.path||e[64]!==o?(P=o&&(0,a.jsxs)(E,{onSelect:async()=>{await je(o.relativeFromRoot(n.data.path)),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(bt,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=n.data.path,e[64]=o,e[65]=P):P=e[65];let O;e[66]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(ue,{}),e[66]=O):O=e[66];let G;e[67]!==s||e[68]!==v||e[69]!==n.data?(G=()=>{let{path:D}=n.data;v(Dt[s](D))},e[67]=s,e[68]=v,e[69]=n.data,e[70]=G):G=e[70];let Y;e[71]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,a.jsx)(aa,{className:ge}),e[71]=Y):Y=e[71];let X;e[72]===G?X=e[73]:(X=(0,a.jsxs)(E,{onSelect:G,children:[Y,"Insert snippet for reading file"]}),e[72]=G,e[73]=X);let ne;e[74]!==s||e[75]!==n.data?(ne=async()=>{te({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});let{path:D}=n.data;await je(Dt[s](D))},e[74]=s,e[75]=n.data,e[76]=ne):ne=e[76];let ve;e[77]===Symbol.for("react.memo_cache_sentinel")?(ve=(0,a.jsx)(It,{className:ge}),e[77]=ve):ve=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(E,{onSelect:ne,children:[ve,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==m||e[81]!==n.data.isMarimoFile?(de=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(E,{onSelect:m,children:[(0,a.jsx)(Ga,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=m,e[81]=n.data.isMarimoFile,e[82]=de):de=e[82];let we;e[83]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(ue,{}),e[83]=we):we=e[83];let me;e[84]!==c||e[85]!==n.data.isDirectory||e[86]!==n.data.name||e[87]!==n.data.path||e[88]!==d?(me=!n.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(E,{onSelect:async()=>{let D=await d({path:n.data.path});D.isBase64&&D.contents?Fe(ct($e(D.contents,D.mimeType||"application/octet-stream")),n.data.name):Fe(new Blob([D.contents||""]),n.data.name)},children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{})]}),e[84]=c,e[85]=n.data.isDirectory,e[86]=n.data.name,e[87]=n.data.path,e[88]=d,e[89]=me):me=e[89];let pe;e[90]===f?pe=e[91]:(pe=(0,a.jsx)(ya,{onSelect:f}),e[90]=f,e[91]=pe);let he;e[92]!==V||e[93]!==B||e[94]!==K||e[95]!==q||e[96]!==U||e[97]!==N||e[98]!==P||e[99]!==X||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(fa,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[V,B,K,q,U,N,P,O,X,ce,de,we,me,pe]}),e[92]=V,e[93]=B,e[94]=K,e[95]=q,e[96]=U,e[97]=N,e[98]=P,e[99]=X,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==H||e[106]!==Q||e[107]!==L||e[108]!==he?(xe=(0,a.jsxs)("span",{className:H,children:[Q,L,he]}),e[105]=H,e[106]=Q,e[107]=L,e[108]=he,e[109]=xe):xe=e[109];let Ne;return e[110]!==l||e[111]!==i||e[112]!==Z||e[113]!==J||e[114]!==xe?(Ne=(0,a.jsxs)("div",{style:i,ref:l,className:R,draggable:!0,onClick:Z,children:[J,xe]}),e[110]=l,e[111]=i,e[112]=Z,e[113]=J,e[114]=xe,e[115]=Ne):Ne=e[115],Ne},_n=t=>{let e=(0,be.c)(3),{node:n}=t;if(!n.data.isDirectory){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=l):l=e[0],l}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Ee,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Tt(t,e){t.stopPropagation(),t.preventDefault(),Ba(e)}function Ot(t,e){if(e)return t;let n=[];for(let i of t){if(Cn(i.name))continue;let l=i;if(i.children){let r=Ot(i.children,e);r!==i.children&&(l={...i,children:r})}n.push(l)}return n}function Cn(t){return!!t.startsWith(".")}function Fn(){return null}function Sn(t){let{parentNode:e}=t;return!e.data.isDirectory}var $t=fe(),Mn=Ge("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},We),Dn=t=>{let e=(0,$t.c)(20),{height:n}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noClick:!0,noKeyboard:!0},e[0]=i):i=e[0];let{getRootProps:l,getInputProps:r,isDragActive:d}=zt(i),c;e[1]===l?c=e[2]:(c=l(),e[1]=l,e[2]=c);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=ie("flex flex-col overflow-hidden relative"),e[3]=h):h=e[3];let s;e[4]===n?s=e[5]:(s={height:n},e[4]=n,e[5]=s);let y;e[6]===r?y=e[7]:(y=r(),e[6]=r,e[7]=y);let x;e[8]===y?x=e[9]:(x=(0,a.jsx)("input",{...y}),e[8]=y,e[9]=x);let p;e[10]===d?p=e[11]:(p=d&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),e[10]=d,e[11]=p);let u;e[12]===n?u=e[13]:(u=(0,a.jsx)(bn,{height:n}),e[12]=n,e[13]=u);let g;return e[14]!==c||e[15]!==s||e[16]!==x||e[17]!==p||e[18]!==u?(g=(0,a.jsx)(on,{children:(0,a.jsxs)("div",{...c,className:h,style:s,children:[x,p,u]})}),e[14]=c,e[15]=s,e[16]=x,e[17]=p,e[18]=u,e[19]=g):g=e[19],g},zn=33,Pn=()=>{let t=(0,$t.c)(36),{ref:e,height:n}=$a(),i=n===void 0?500:n,[l,r]=ke(Mn),d=ye(ta).length,c;e:{if(!l.hasUserInteracted&&d>0){if(l.openSections.includes("remote-storage")){c=l.openSections;break e}let R;t[0]===l.openSections?R=t[1]:(R=[...l.openSections,"remote-storage"],t[0]=l.openSections,t[1]=R),c=R;break e}c=l.openSections}let h=c,s;t[2]===r?s=t[3]:(s=R=>{r({openSections:R,hasUserInteracted:!0})},t[2]=r,t[3]=s);let y=s,x=i-zn*2,p;t[4]===h?p=t[5]:(p=h.includes("remote-storage"),t[4]=h,t[5]=p);let u=p,g;t[6]!==h||t[7]!==u?(g=u&&h.includes("files"),t[6]=h,t[7]=u,t[8]=g):g=t[8];let w=g,v;t[9]!==x||t[10]!==w?(v=w?Math.round(x*.4):x,t[9]=x,t[10]=w,t[11]=v):v=t[11];let o=v,j=Math.max(200,w?x-o:x),m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(nt,{className:"w-4 h-4"}),t[12]=m):m=t[12];let b;t[13]===d?b=t[14]:(b=d>0&&(0,a.jsx)(La,{children:d}),t[13]=d,t[14]=b);let f;t[15]===b?f=t[16]:(f=(0,a.jsxs)(ft,{children:[m," Remote storage",b]}),t[15]=b,t[16]=f);let k;t[17]===o?k=t[18]:(k={maxHeight:o},t[17]=o,t[18]=k);let _;t[19]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)(nn,{}),t[19]=_):_=t[19];let C;t[20]===k?C=t[21]:(C=(0,a.jsx)(ut,{className:"overflow-auto",style:k,children:_}),t[20]=k,t[21]=C);let F;t[22]!==C||t[23]!==f?(F=(0,a.jsxs)(xt,{value:"remote-storage",children:[f,C]}),t[22]=C,t[23]=f,t[24]=F):F=t[24];let z;t[25]===Symbol.for("react.memo_cache_sentinel")?(z=(0,a.jsxs)(ft,{children:[(0,a.jsx)(at,{className:"w-4 h-4"}),"Files"]}),t[25]=z):z=t[25];let S;t[26]===j?S=t[27]:(S=(0,a.jsxs)(xt,{value:"files",children:[z,(0,a.jsx)(ut,{children:(0,a.jsx)(Dn,{height:j})})]}),t[26]=j,t[27]=S);let M;t[28]!==y||t[29]!==h||t[30]!==F||t[31]!==S?(M=(0,a.jsxs)(qt,{type:"multiple",value:h,onValueChange:y,children:[F,S]}),t[28]=y,t[29]=h,t[30]=F,t[31]=S,t[32]=M):M=t[32];let A;return t[33]!==e||t[34]!==M?(A=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:M}),t[33]=e,t[34]=M,t[35]=A):A=t[35],A};export{Pn as default};
@@ -1 +1 @@
1
- import{s as y}from"./chunk-LvLJmgfZ.js";import{lr as d}from"./cells-CJlo_hG2.js";import{t as f}from"./cn-DCUzRj2J.js";import{t as g}from"./jsx-runtime-BqBOg78p.js";import{t as e}from"./createLucideIcon-D5guW7EU.js";import{n as c,t as k}from"./file-headphone-B3fuktN0.js";import{t as l}from"./file-HTLbeC2b.js";import{t as u}from"./image-DQHXdEQn.js";var r=e("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"}]]),v=e("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"}]]),x=e("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"}]]),z=e("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"}]]),p=e("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"}]]),M=y(g(),1),j={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 i(o){var a;let t=(a=o.split(".").pop())==null?void 0:a.toLowerCase();return t?j[t]??"unknown":"unknown"}const m={directory:p,python:r,code:r,json:c,text:d,image:u,audio:k,video:v,data:x,pdf:d,zip:z,unknown:l},s={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 w(o,t){let a=i(o),h=m[a],n=s[a];return(0,M.jsx)(h,{className:f("h-3.5 w-3.5 shrink-0",n,t)})}export{p as a,w as i,s as n,i as r,m as t};
1
+ import{s as y}from"./chunk-LvLJmgfZ.js";import{ur as d}from"./cells-A-ljPpuj.js";import{t as f}from"./cn-DCUzRj2J.js";import{t as g}from"./jsx-runtime-BqBOg78p.js";import{t as e}from"./createLucideIcon-D5guW7EU.js";import{n as u,t as c}from"./file-headphone-B3fuktN0.js";import{t as k}from"./file-HTLbeC2b.js";import{t as v}from"./image-DQHXdEQn.js";var r=e("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=e("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"}]]),x=e("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"}]]),z=e("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"}]]),p=e("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"}]]),M=y(g(),1),j={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 i(o){var a;let t=(a=o.split(".").pop())==null?void 0:a.toLowerCase();return t?j[t]??"unknown":"unknown"}const m={directory:p,python:r,code:r,json:u,text:d,image:v,audio:c,video:l,data:x,pdf:d,zip:z,unknown:k},s={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 w(o,t){let a=i(o),h=m[a],n=s[a];return(0,M.jsx)(h,{className:f("h-3.5 w-3.5 shrink-0",n,t)})}export{p as a,w as i,s as n,i as r,m as t};
@@ -1 +1 @@
1
- import{s as _}from"./chunk-LvLJmgfZ.js";import{u as j}from"./useEvent-D91BmmQi.js";import{t as M}from"./react-Bj1aDYRI.js";import{S as H,_t as I,it as k}from"./cells-CJlo_hG2.js";import{t as S}from"./compiler-runtime-B3qBwwSJ.js";import{_ as $}from"./useEventListener-BR0C1MaI.js";import{t as x}from"./cn-DCUzRj2J.js";import{t as B}from"./jsx-runtime-BqBOg78p.js";var L=S(),g=_(M(),1);function T(){return k()==="edit"?document.getElementById("App"):void 0}function O(t){let e=(0,L.c)(7),[r,a]=(0,g.useState)(void 0),[o,s]=(0,g.useState)(void 0),l=(0,g.useRef)(null),n=(0,g.useRef)(null),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=new Map,e[0]=f):f=e[0];let u=(0,g.useRef)(f),i,m;e[1]===t?(i=e[2],m=e[3]):(i=()=>t.length===0?void 0:(l.current=new IntersectionObserver(d=>{let v=!1;if(d.forEach(h=>{let b=h.target;h.isIntersecting?(!n.current||b.getBoundingClientRect().top<n.current.getBoundingClientRect().top)&&(n.current=b,v=!0):b===n.current&&(n.current=null,v=!0)}),v&&n.current){let h=I(n.current);a("id"in h?h.id:h.path),s(u.current.get(n.current))}},{root:T(),rootMargin:"0px",threshold:0}),t.forEach(d=>{var v;if(d){let h=I(d[0]),b=t.map(D).filter(w=>"id"in h?w.id===h.id:w.textContent===d[0].textContent).indexOf(d[0]);u.current.set(d[0],b),(v=l.current)==null||v.observe(d[0])}}),()=>{l.current&&l.current.disconnect(),n.current=null}),m=[t],e[1]=t,e[2]=i,e[3]=m),(0,g.useEffect)(i,m);let c;return e[4]!==r||e[5]!==o?(c={activeHeaderId:r,activeOccurrences:o},e[4]=r,e[5]=o,e[6]=c):c=e[6],c}function D(t){let[e]=t;return e}function C(t){if(t.length===0)return[];let e=new Map;return t.map(r=>{let a="id"in r.by?r.by.id:r.by.path,o=e.get(a)??0;e.set(a,o+1);let s=N(r,o);return s?[s,a]:null}).filter(Boolean)}function E(t,e){let r=N(t,e);if(!r){$.warn("Could not find element for outline item",t);return}r.scrollIntoView({behavior:"smooth",block:"start"}),r.classList.add("outline-item-highlight"),setTimeout(()=>{r.classList.remove("outline-item-highlight")},3e3)}function N(t,e){return"id"in t.by?document.querySelectorAll(`[id="${CSS.escape(t.by.id)}"]`)[e]:document.evaluate(t.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}var y=S(),p=_(B(),1);const A=()=>{let t=(0,y.c)(19),{items:e}=j(H),r;t[0]===e?r=t[1]:(r=C(e),t[0]=e,t[1]=r);let{activeHeaderId:a,activeOccurrences:o}=O(r),[s,l]=g.useState(!1);if(e.length<2)return null;let n,f,u;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>l(!0),f=()=>l(!1),u=x("fixed top-[25vh] right-8 z-10000 print:hidden","hidden md:block"),t[2]=n,t[3]=f,t[4]=u):(n=t[2],f=t[3],u=t[4]);let i=s?"-left-[280px] opacity-100":"left-[300px] opacity-0",m;t[5]===i?m=t[6]:(m=x("-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border",i),t[5]=i,t[6]=m);let c;t[7]!==a||t[8]!==o||t[9]!==e||t[10]!==m?(c=(0,p.jsx)(R,{className:m,items:e,activeHeaderId:a,activeOccurrences:o}),t[7]=a,t[8]=o,t[9]=e,t[10]=m,t[11]=c):c=t[11];let d;t[12]!==a||t[13]!==o||t[14]!==e?(d=(0,p.jsx)(P,{items:e,activeHeaderId:a,activeOccurrences:o}),t[12]=a,t[13]=o,t[14]=e,t[15]=d):d=t[15];let v;return t[16]!==c||t[17]!==d?(v=(0,p.jsxs)("div",{onMouseEnter:n,onMouseLeave:f,className:u,children:[c,d]}),t[16]=c,t[17]=d,t[18]=v):v=t[18],v},P=t=>{let e=(0,y.c)(8),{items:r,activeHeaderId:a,activeOccurrences:o}=t,s,l;if(e[0]!==a||e[1]!==o||e[2]!==r){let f=new Map;s="flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden",l=r.map((u,i)=>{let m="id"in u.by?u.by.id:u.by.path,c=f.get(m)??0;return f.set(m,c+1),(0,p.jsx)("div",{className:x("h-[2px] bg-muted-foreground/60",u.level===1&&"w-5",u.level===2&&"w-4",u.level===3&&"w-3",u.level===4&&"w-2",c===o&&a===m&&"bg-foreground"),onClick:()=>E(u,c)},`${m}-${i}`)}),e[0]=a,e[1]=o,e[2]=r,e[3]=s,e[4]=l}else s=e[3],l=e[4];let n;return e[5]!==s||e[6]!==l?(n=(0,p.jsx)("div",{className:s,children:l}),e[5]=s,e[6]=l,e[7]=n):n=e[7],n},R=t=>{let e=(0,y.c)(11),{items:r,activeHeaderId:a,activeOccurrences:o,className:s}=t,l,n;if(e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==r){let u=new Map;e[6]===s?l=e[7]:(l=x("flex flex-col overflow-auto py-4 pl-2",s),e[6]=s,e[7]=l),n=r.map((i,m)=>{let c="id"in i.by?i.by.id:i.by.path,d=u.get(c)??0;u.set(c,d+1);let v=`${c}-${m}`,h={className:x("px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l",i.level===1&&"font-semibold",i.level===2&&"ml-3",i.level===3&&"ml-6",i.level===4&&"ml-9",d===o&&a===c&&"text-accent-foreground"),onClick:()=>E(i,d)};return i.html?(0,p.jsx)("div",{...h,dangerouslySetInnerHTML:{__html:i.html}},v):(0,p.jsx)("div",{...h,children:i.name},v)}),e[0]=a,e[1]=o,e[2]=s,e[3]=r,e[4]=l,e[5]=n}else l=e[4],n=e[5];let f;return e[8]!==l||e[9]!==n?(f=(0,p.jsx)("div",{className:l,children:n}),e[8]=l,e[9]=n,e[10]=f):f=e[10],f};export{O as i,R as n,C as r,A as t};
1
+ import{s as _}from"./chunk-LvLJmgfZ.js";import{u as j}from"./useEvent-D91BmmQi.js";import{t as M}from"./react-Bj1aDYRI.js";import{S as H,_t as I,it as k}from"./cells-A-ljPpuj.js";import{t as S}from"./compiler-runtime-B3qBwwSJ.js";import{_ as $}from"./useEventListener-BR0C1MaI.js";import{t as x}from"./cn-DCUzRj2J.js";import{t as B}from"./jsx-runtime-BqBOg78p.js";var L=S(),g=_(M(),1);function T(){return k()==="edit"?document.getElementById("App"):void 0}function O(t){let e=(0,L.c)(7),[r,a]=(0,g.useState)(void 0),[o,s]=(0,g.useState)(void 0),l=(0,g.useRef)(null),n=(0,g.useRef)(null),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=new Map,e[0]=f):f=e[0];let u=(0,g.useRef)(f),i,m;e[1]===t?(i=e[2],m=e[3]):(i=()=>t.length===0?void 0:(l.current=new IntersectionObserver(d=>{let v=!1;if(d.forEach(h=>{let b=h.target;h.isIntersecting?(!n.current||b.getBoundingClientRect().top<n.current.getBoundingClientRect().top)&&(n.current=b,v=!0):b===n.current&&(n.current=null,v=!0)}),v&&n.current){let h=I(n.current);a("id"in h?h.id:h.path),s(u.current.get(n.current))}},{root:T(),rootMargin:"0px",threshold:0}),t.forEach(d=>{var v;if(d){let h=I(d[0]),b=t.map(D).filter(w=>"id"in h?w.id===h.id:w.textContent===d[0].textContent).indexOf(d[0]);u.current.set(d[0],b),(v=l.current)==null||v.observe(d[0])}}),()=>{l.current&&l.current.disconnect(),n.current=null}),m=[t],e[1]=t,e[2]=i,e[3]=m),(0,g.useEffect)(i,m);let c;return e[4]!==r||e[5]!==o?(c={activeHeaderId:r,activeOccurrences:o},e[4]=r,e[5]=o,e[6]=c):c=e[6],c}function D(t){let[e]=t;return e}function C(t){if(t.length===0)return[];let e=new Map;return t.map(r=>{let a="id"in r.by?r.by.id:r.by.path,o=e.get(a)??0;e.set(a,o+1);let s=N(r,o);return s?[s,a]:null}).filter(Boolean)}function E(t,e){let r=N(t,e);if(!r){$.warn("Could not find element for outline item",t);return}r.scrollIntoView({behavior:"smooth",block:"start"}),r.classList.add("outline-item-highlight"),setTimeout(()=>{r.classList.remove("outline-item-highlight")},3e3)}function N(t,e){return"id"in t.by?document.querySelectorAll(`[id="${CSS.escape(t.by.id)}"]`)[e]:document.evaluate(t.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}var y=S(),p=_(B(),1);const A=()=>{let t=(0,y.c)(19),{items:e}=j(H),r;t[0]===e?r=t[1]:(r=C(e),t[0]=e,t[1]=r);let{activeHeaderId:a,activeOccurrences:o}=O(r),[s,l]=g.useState(!1);if(e.length<2)return null;let n,f,u;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>l(!0),f=()=>l(!1),u=x("fixed top-[25vh] right-8 z-10000 print:hidden","hidden md:block"),t[2]=n,t[3]=f,t[4]=u):(n=t[2],f=t[3],u=t[4]);let i=s?"-left-[280px] opacity-100":"left-[300px] opacity-0",m;t[5]===i?m=t[6]:(m=x("-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border",i),t[5]=i,t[6]=m);let c;t[7]!==a||t[8]!==o||t[9]!==e||t[10]!==m?(c=(0,p.jsx)(R,{className:m,items:e,activeHeaderId:a,activeOccurrences:o}),t[7]=a,t[8]=o,t[9]=e,t[10]=m,t[11]=c):c=t[11];let d;t[12]!==a||t[13]!==o||t[14]!==e?(d=(0,p.jsx)(P,{items:e,activeHeaderId:a,activeOccurrences:o}),t[12]=a,t[13]=o,t[14]=e,t[15]=d):d=t[15];let v;return t[16]!==c||t[17]!==d?(v=(0,p.jsxs)("div",{onMouseEnter:n,onMouseLeave:f,className:u,children:[c,d]}),t[16]=c,t[17]=d,t[18]=v):v=t[18],v},P=t=>{let e=(0,y.c)(8),{items:r,activeHeaderId:a,activeOccurrences:o}=t,s,l;if(e[0]!==a||e[1]!==o||e[2]!==r){let f=new Map;s="flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden",l=r.map((u,i)=>{let m="id"in u.by?u.by.id:u.by.path,c=f.get(m)??0;return f.set(m,c+1),(0,p.jsx)("div",{className:x("h-[2px] bg-muted-foreground/60",u.level===1&&"w-5",u.level===2&&"w-4",u.level===3&&"w-3",u.level===4&&"w-2",c===o&&a===m&&"bg-foreground"),onClick:()=>E(u,c)},`${m}-${i}`)}),e[0]=a,e[1]=o,e[2]=r,e[3]=s,e[4]=l}else s=e[3],l=e[4];let n;return e[5]!==s||e[6]!==l?(n=(0,p.jsx)("div",{className:s,children:l}),e[5]=s,e[6]=l,e[7]=n):n=e[7],n},R=t=>{let e=(0,y.c)(11),{items:r,activeHeaderId:a,activeOccurrences:o,className:s}=t,l,n;if(e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==r){let u=new Map;e[6]===s?l=e[7]:(l=x("flex flex-col overflow-auto py-4 pl-2",s),e[6]=s,e[7]=l),n=r.map((i,m)=>{let c="id"in i.by?i.by.id:i.by.path,d=u.get(c)??0;u.set(c,d+1);let v=`${c}-${m}`,h={className:x("px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l",i.level===1&&"font-semibold",i.level===2&&"ml-3",i.level===3&&"ml-6",i.level===4&&"ml-9",d===o&&a===c&&"text-accent-foreground"),onClick:()=>E(i,d)};return i.html?(0,p.jsx)("div",{...h,dangerouslySetInnerHTML:{__html:i.html}},v):(0,p.jsx)("div",{...h,children:i.name},v)}),e[0]=a,e[1]=o,e[2]=s,e[3]=r,e[4]=l,e[5]=n}else l=e[4],n=e[5];let f;return e[8]!==l||e[9]!==n?(f=(0,p.jsx)("div",{className:l,children:n}),e[8]=l,e[9]=n,e[10]=f):f=e[10],f};export{O as i,R as n,C as r,A as t};
@@ -1 +1 @@
1
- import{p as s,u as C}from"./useEvent-D91BmmQi.js";import{b as d}from"./cells-CJlo_hG2.js";import{t as m}from"./createReducer-1ePoj7v6.js";function p(){return{focusedCellId:null,lastFocusedCellId:null}}var{reducer:w,createActions:D,valueAtom:a,useActions:g}=m(p,{focusCell:(l,e)=>({...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId}),toggleCell:(l,e)=>l.focusedCellId===e.cellId?{...l,focusedCellId:null}:{...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId},blurCell:l=>({...l,focusedCellId:null})});const c=s(l=>l(a).lastFocusedCellId);function F(){return C(c)}const _=s(l=>{let e=l(c);return!e||e==="__scratch__"?null:r(e,l(d))});function h(l){return s(e=>r(l,e(d)))}function r(l,e){var o;let{cellData:i,cellHandles:f,cellRuntime:I}=e,u=i[l],t=I[l],n=(o=f[l])==null?void 0:o.current;return!u||!n?null:{cellId:l,name:u.name,config:u.config,status:t?t.status:"idle",getEditorView:()=>n.editorView,hasOutput:(t==null?void 0:t.output)!=null,hasConsoleOutput:(t==null?void 0:t.consoleOutputs)!=null}}export{g as a,c as i,h as n,F as o,_ as r,a as t};
1
+ import{p as s,u as C}from"./useEvent-D91BmmQi.js";import{b as d}from"./cells-A-ljPpuj.js";import{t as m}from"./createReducer-1ePoj7v6.js";function p(){return{focusedCellId:null,lastFocusedCellId:null}}var{reducer:w,createActions:V,valueAtom:a,useActions:g}=m(p,{focusCell:(l,e)=>({...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId}),toggleCell:(l,e)=>l.focusedCellId===e.cellId?{...l,focusedCellId:null}:{...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId},blurCell:l=>({...l,focusedCellId:null})});const c=s(l=>l(a).lastFocusedCellId);function F(){return C(c)}const O=s(l=>{let e=l(c);return!e||e==="__scratch__"?null:r(e,l(d))});function _(l){return s(e=>r(l,e(d)))}function r(l,e){var o;let{cellData:i,cellHandles:f,cellRuntime:I}=e,u=i[l],t=I[l],n=(o=f[l])==null?void 0:o.current;return!u||!n?null:{cellId:l,name:u.name,config:u.config,status:t?t.status:"idle",getEditorView:()=>n.editorView,hasOutput:(t==null?void 0:t.output)!=null,hasConsoleOutput:(t==null?void 0:t.consoleOutputs)!=null}}export{g as a,c as i,_ as n,F as o,O as r,a as t};
@@ -0,0 +1,2 @@
1
+ import{s as H}from"./chunk-LvLJmgfZ.js";import{t as fe}from"./react-Bj1aDYRI.js";import{Rt as xe}from"./cells-A-ljPpuj.js";import{_ as Q,c as ue,d as Z,f as F,g as je,h as I,l as ve,m as ge,o as be,p as E,s as ye,t as q,u as W,y as B}from"./zod-H_cgTO0M.js";import{t as X}from"./compiler-runtime-B3qBwwSJ.js";import{_ as we,d as Ce}from"./useEventListener-BR0C1MaI.js";import{t as K}from"./cn-DCUzRj2J.js";import{t as Ne}from"./jsx-runtime-BqBOg78p.js";import{c as Se,i as Y,l as ke,n as Oe,r as Ve,s as $e,t as Ae}from"./select-5i7URBEn.js";import{k as Le,v as ee,y as ne}from"./JsonOutput-BVAcY5xS.js";import{t as _e}from"./label-DTR8T0AE.js";import{n as ze,t as Ee}from"./radio-group-BtBoRbGH.js";import{t as Me}from"./tooltip-Gcwqb_SK.js";import{r as Pe,t as re}from"./button-D9nb17Rw.js";import{t as se}from"./strings-md4mFbOQ.js";import{t as Te}from"./createLucideIcon-D5guW7EU.js";import{t as De}from"./plus-BgB18UzY.js";import{t as Je}from"./refresh-ccw-C-n2VFP5.js";import{n as Ze,t as R}from"./input-DyPS_GiK.js";import{a as k,c as w,d as O,h as Fe,l as V,m as Ie,o as S,r as te,u as y,y as qe}from"./textarea-Dd0InTQJ.js";import{t as Be}from"./trash-2-D280Xiwg.js";var Ke=Te("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const A={of(r){return JSON.stringify(r)},parse(r){if(!r)return{};try{return JSON.parse(r)}catch{return{label:r}}}};function ae(){return Math.floor(Math.random()*1e5)}function Re(r){return r instanceof q.ZodArray}function le(r){return r instanceof q.ZodPipe}function Ue(r){return r instanceof q.ZodTuple}function ie(r){return"unwrap"in r?r.unwrap():r}function D(r){let e=t=>{if(t instanceof E){let a=[...t.values];return t.values.size===1?a[0]:a}if(t instanceof W){let a=t.def.defaultValue;return typeof a=="function"?a():a}if(le(t))return e(t.in);if(Ue(t))return t.def.items.map(a=>e(a));if("unwrap"in t)return e(ie(t))};return r instanceof B||r instanceof Z?e(r.options[0]):Re(r)?Ge(r)?[D(r.element)]:[]:r instanceof Q?"":r instanceof F?r.options[0]:r instanceof I?Object.fromEntries(Object.entries(r.shape).map(([t,a])=>[t,e(a)])):e(r)}function _(r){if(r instanceof E)return r;if(r instanceof I){let e=r.shape.type;if(e instanceof E)return e;throw Error("Invalid schema")}if(r instanceof B||r instanceof Z)return _(r.options[0]);throw we.warn(r),Error("Invalid schema")}function Ge(r){return!r.safeParse([]).success}var oe=X(),ce=H(fe(),1),n=H(Ne(),1),de=`
2
+ `;const pe=r=>{let e=(0,oe.c)(24),{value:t,options:a,onChange:l,className:d,placeholder:o,textAreaClassName:h,comboBoxClassName:m}=r,[s,i]=(0,ce.useState)(!1),p;e[0]===t?p=e[1]:(p=J(t),e[0]=t,e[1]=p);let f=p,x;e[2]!==m||e[3]!==l||e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==h||e[8]!==f?(x=()=>s?(0,n.jsx)(U,{value:f,className:h,onChange:l,placeholder:o?`${o}: one per line`:"One value per line"}):(0,n.jsx)(ee,{placeholder:o,displayValue:He,className:K("w-full max-w-[400px]",m),multiple:!0,value:f,onValueChange:l,keepPopoverOpenOnSelect:!0,chips:!0,chipsClassName:"flex-row flex-wrap min-w-[210px]",children:a.map(Qe)}),e[2]=m,e[3]=l,e[4]=a,e[5]=o,e[6]=s,e[7]=h,e[8]=f,e[9]=x):x=e[9];let c=x,v;e[10]===d?v=e[11]:(v=K("flex gap-1",d),e[10]=d,e[11]=v);let u;e[12]===c?u=e[13]:(u=c(),e[12]=c,e[13]=u);let g=s?"Switch to multi-select":"Switch to textarea",j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=(0,n.jsx)(qe,{className:"w-3 h-3"}),e[14]=j):j=e[14];let b;e[15]===s?b=e[16]:(b=(0,n.jsx)(Le,{size:"xs",onPressedChange:i,pressed:s,children:j}),e[15]=s,e[16]=b);let C;e[17]!==g||e[18]!==b?(C=(0,n.jsx)(Me,{content:g,children:b}),e[17]=g,e[18]=b,e[19]=C):C=e[19];let N;return e[20]!==v||e[21]!==u||e[22]!==C?(N=(0,n.jsxs)("div",{className:v,children:[u,C]}),e[20]=v,e[21]=u,e[22]=C,e[23]=N):N=e[23],N},U=r=>{let e=(0,oe.c)(11),{className:t,value:a,onChange:l,placeholder:d}=r,o,h;if(e[0]!==a){let p=J(a);o=te,h=p.join(de),e[0]=a,e[1]=o,e[2]=h}else o=e[1],h=e[2];let m;e[3]===l?m=e[4]:(m=p=>{if(p.target.value===""){l([]);return}l(p.target.value.split(de))},e[3]=l,e[4]=m);let s=d?`${d}: one per line`:"One value per line",i;return e[5]!==o||e[6]!==t||e[7]!==h||e[8]!==m||e[9]!==s?(i=(0,n.jsx)(o,{value:h,className:t,rows:4,onChange:m,placeholder:s}),e[5]=o,e[6]=t,e[7]=h,e[8]=m,e[9]=s,e[10]=i):i=e[10],i};function J(r){return r==null?[]:Array.isArray(r)?r:[r].filter(e=>e!=null||e!=="")}function He(r){return r}function Qe(r){return(0,n.jsx)(ne,{value:r,children:r},r)}var z=X();const We=r=>{let e=(0,z.c)(11),{schema:t,form:a,path:l,renderers:d,children:o}=r,h=l===void 0?"":l,m;e[0]===d?m=e[1]:(m=d===void 0?[]:d,e[0]=d,e[1]=m);let s=m,i;e[2]!==a||e[3]!==h||e[4]!==s||e[5]!==t?(i=$(t,a,h,s),e[2]=a,e[3]=h,e[4]=s,e[5]=t,e[6]=i):i=e[6];let p;return e[7]!==o||e[8]!==a||e[9]!==i?(p=(0,n.jsxs)(Ie,{...a,children:[o,i]}),e[7]=o,e[8]=a,e[9]=i,e[10]=p):p=e[10],p};function $(r,e,t,a){for(let s of a){let{isMatch:i,Component:p}=s;if(i(r))return(0,n.jsx)(p,{schema:r,form:e,path:t})}let{label:l,description:d,special:o,direction:h="column",minLength:m}=A.parse(r.description||"");if(r instanceof W){let s=r.unwrap();return s=!s.description&&r.description?s.describe(r.description):s,$(s,e,t,a)}if(r instanceof je){let s=r.unwrap();return s=!s.description&&r.description?s.describe(r.description):s,$(s,e,t,a)}if(r instanceof I)return(0,n.jsxs)("div",{className:K("flex",h==="row"?"flex-row gap-6 items-start":h==="two-columns"?"grid grid-cols-2 gap-y-6":"flex-col gap-6"),children:[(0,n.jsx)(y,{children:l}),Ce.entries(r.shape).map(([s,i])=>{let p=i instanceof E,f=$(i,e,rn(t,s),a);return p?(0,n.jsx)(ce.Fragment,{children:f},s):(0,n.jsx)("div",{className:"flex flex-row align-start",children:f},s)})]});if(r instanceof Q)return o==="time"?(0,n.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(R,{...s,onValueChange:s.onChange,type:"time",className:"my-0"})}),(0,n.jsx)(O,{})]})}):(0,n.jsx)(me,{schema:r,form:e,path:t});if(r instanceof ue)return(0,n.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(V,{children:[(0,n.jsxs)("div",{className:"flex flex-row items-start space-x-2",children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(xe,{"data-testid":"marimo-plugin-data-frames-boolean-checkbox",checked:s.value,onCheckedChange:s.onChange})})]}),(0,n.jsx)(O,{})]})});if(r instanceof ge)return o==="random_number_button"?(0,n.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(re,{size:"xs","data-testid":"marimo-plugin-data-frames-random-number-button",variant:"secondary",onClick:()=>{s.onChange(ae())},children:[(0,n.jsx)(Je,{className:"w-3.5 h-3.5 mr-1"}),l]})}):(0,n.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(Ze,{...s,className:"my-0",onValueChange:s.onChange})}),(0,n.jsx)(O,{})]})});if(r instanceof ve){let s=o==="datetime"?"datetime-local":o==="time"?"time":"date";return(0,n.jsx)(w,{control:e.control,name:t,render:({field:i})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(R,{...i,onValueChange:i.onChange,type:s,className:"my-0"})}),(0,n.jsx)(O,{})]})})}if(r instanceof be)return(0,n.jsx)(me,{schema:r,form:e,path:t});if(r instanceof F)return(0,n.jsx)(en,{schema:r,form:e,path:t,options:r.options.map(s=>s.toString())});if(r instanceof ye){if(o==="text_area_multiline")return(0,n.jsx)(Ye,{schema:r,form:e,path:t});let s=r.element;return s instanceof F?(0,n.jsx)(nn,{schema:r,form:e,path:t,itemLabel:l,options:s.options.map(i=>i.toString())}):(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)(_e,{children:l}),(0,n.jsx)(Xe,{schema:r.element,form:e,path:t,minLength:m,renderers:a},t)]})}if(r instanceof Z){let s=r.def,i=s.options,p=s.discriminator,f=x=>i.find(c=>_(c).value===x);return(0,n.jsx)(w,{control:e.control,name:t,render:({field:x})=>{let c=x.value,v=i.map(j=>_(j).value),u=c&&typeof c=="object"&&p in c?c[p]:v[0],g=f(u);return(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)("div",{className:"flex border-b mb-4 -mt-2",children:v.map(j=>(0,n.jsx)("button",{type:"button",className:`px-4 py-2 ${u===j?"border-b-2 border-primary font-medium":"text-muted-foreground"}`,onClick:()=>{let b=f(j);b?x.onChange(D(b)):x.onChange({[p]:j})},children:j},j))}),(0,n.jsx)("div",{className:"flex flex-col",children:g&&$(g,e,t,a)},u)]})}})}return r instanceof B?(0,n.jsx)(w,{control:e.control,name:t,render:({field:s})=>{let i=r.options,p=s.value,f=i.map(c=>_(c).value);p||(p=f[0]);let x=i.find(c=>_(c).value===p);return(0,n.jsxs)("div",{className:"flex flex-col mb-4 gap-1",children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(ke,{"data-testid":"marimo-plugin-data-frames-union-select",...s,children:f.map(c=>(0,n.jsx)("option",{value:c,children:c},c))}),x&&$(x,e,t,a)]})}}):r instanceof E?(0,n.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,n.jsx)("input",{...s,type:"hidden",value:String([...r.values][0]??"")})}):"unwrap"in r?$(ie(r),e,t,a):le(r)?$(r.in,e,t,a):(0,n.jsxs)("div",{children:["Unknown schema type"," ",r==null?t:JSON.stringify(r.type??r)]})}var Xe=r=>{let e=(0,z.c)(39),{schema:t,form:a,path:l,minLength:d,renderers:o}=r,h;e[0]===t.description?h=e[1]:(h=A.parse(t.description||""),e[0]=t.description,e[1]=h);let{label:m,description:s}=h,i=a.control,p;e[2]!==i||e[3]!==l?(p={control:i,name:l},e[2]=i,e[3]=l,e[4]=p):p=e[4];let{fields:f,append:x,remove:c}=Fe(p),v=d!=null&&f.length<d,u=d==null||f.length>d,g;e[5]===m?g=e[6]:(g=(0,n.jsx)(y,{children:m}),e[5]=m,e[6]=g);let j;e[7]===s?j=e[8]:(j=(0,n.jsx)(S,{children:s}),e[7]=s,e[8]=j);let b;if(e[9]!==u||e[10]!==f||e[11]!==a||e[12]!==l||e[13]!==c||e[14]!==o||e[15]!==t){let T;e[17]!==u||e[18]!==a||e[19]!==l||e[20]!==c||e[21]!==o||e[22]!==t?(T=(he,G)=>(0,n.jsxs)("div",{className:"flex flex-row pl-2 ml-2 border-l-2 border-disabled hover-actions-parent relative pr-5 pt-1 items-center w-fit",onKeyDown:Pe.onEnter(sn),children:[$(t,a,`${l}[${G}]`,o),u&&(0,n.jsx)(Be,{className:"w-4 h-4 ml-2 my-1 text-muted-foreground hover:text-destructive cursor-pointer absolute right-0 top-5",onClick:()=>{c(G)}})]},he.id),e[17]=u,e[18]=a,e[19]=l,e[20]=c,e[21]=o,e[22]=t,e[23]=T):T=e[23],b=f.map(T),e[9]=u,e[10]=f,e[11]=a,e[12]=l,e[13]=c,e[14]=o,e[15]=t,e[16]=b}else b=e[16];let C;e[24]!==v||e[25]!==d?(C=v&&(0,n.jsx)("div",{className:"text-destructive text-xs font-semibold",children:(0,n.jsxs)("div",{children:["At least ",d," required."]})}),e[24]=v,e[25]=d,e[26]=C):C=e[26];let N;e[27]!==x||e[28]!==t?(N=()=>{x(D(t))},e[27]=x,e[28]=t,e[29]=N):N=e[29];let M;e[30]===Symbol.for("react.memo_cache_sentinel")?(M=(0,n.jsx)(De,{className:"w-3.5 h-3.5 mr-1"}),e[30]=M):M=e[30];let L;e[31]===N?L=e[32]:(L=(0,n.jsx)("div",{children:(0,n.jsxs)(re,{size:"xs","data-testid":"marimo-plugin-data-frames-add-array-item",variant:"text",className:"hover:text-accent-foreground",onClick:N,children:[M,"Add"]})}),e[31]=N,e[32]=L);let P;return e[33]!==g||e[34]!==j||e[35]!==b||e[36]!==C||e[37]!==L?(P=(0,n.jsxs)("div",{className:"flex flex-col gap-2 min-w-[220px]",children:[g,j,b,C,L]}),e[33]=g,e[34]=j,e[35]=b,e[36]=C,e[37]=L,e[38]=P):P=e[38],P},me=r=>{let e=(0,z.c)(21),{schema:t,form:a,path:l}=r,d;e[0]===t.description?d=e[1]:(d=A.parse(t.description),e[0]=t.description,e[1]=d);let{label:o,description:h,placeholder:m,disabled:s,inputType:i}=d;if(i==="textarea"){let x;e[2]!==h||e[3]!==s||e[4]!==o||e[5]!==m?(x=v=>{let{field:u}=v;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:o}),(0,n.jsx)(S,{children:h}),(0,n.jsx)(k,{children:(0,n.jsx)(te,{...u,value:u.value,onChange:u.onChange,className:"my-0",placeholder:m,disabled:s})}),(0,n.jsx)(O,{})]})},e[2]=h,e[3]=s,e[4]=o,e[5]=m,e[6]=x):x=e[6];let c;return e[7]!==a.control||e[8]!==l||e[9]!==x?(c=(0,n.jsx)(w,{control:a.control,name:l,render:x}),e[7]=a.control,e[8]=l,e[9]=x,e[10]=c):c=e[10],c}let p;e[11]!==h||e[12]!==s||e[13]!==i||e[14]!==o||e[15]!==m?(p=x=>{let{field:c}=x;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:o}),(0,n.jsx)(S,{children:h}),(0,n.jsx)(k,{children:(0,n.jsx)(R,{...c,type:i,value:c.value,onValueChange:c.onChange,className:"my-0",placeholder:m,disabled:s})}),(0,n.jsx)(O,{})]})},e[11]=h,e[12]=s,e[13]=i,e[14]=o,e[15]=m,e[16]=p):p=e[16];let f;return e[17]!==a.control||e[18]!==l||e[19]!==p?(f=(0,n.jsx)(w,{control:a.control,name:l,render:p}),e[17]=a.control,e[18]=l,e[19]=p,e[20]=f):f=e[20],f},Ye=r=>{let e=(0,z.c)(10),{schema:t,form:a,path:l}=r,d;e[0]===t.description?d=e[1]:(d=A.parse(t.description),e[0]=t.description,e[1]=d);let{label:o,description:h,placeholder:m}=d,s;e[2]!==h||e[3]!==o||e[4]!==m?(s=p=>{let{field:f}=p;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:o}),(0,n.jsx)(S,{children:h}),(0,n.jsx)(k,{children:(0,n.jsx)(U,{...f,placeholder:m})}),(0,n.jsx)(O,{})]})},e[2]=h,e[3]=o,e[4]=m,e[5]=s):s=e[5];let i;return e[6]!==a.control||e[7]!==l||e[8]!==s?(i=(0,n.jsx)(w,{control:a.control,name:l,render:s}),e[6]=a.control,e[7]=l,e[8]=s,e[9]=i):i=e[9],i},en=r=>{let e=(0,z.c)(22),{schema:t,form:a,path:l,options:d,textTransform:o}=r,h;e[0]===t.description?h=e[1]:(h=A.parse(t.description),e[0]=t.description,e[1]=h);let{label:m,description:s,disabled:i,special:p}=h;if(p==="radio_group"){let c;e[2]!==s||e[3]!==m||e[4]!==d||e[5]!==l?(c=u=>{let{field:g}=u;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:m}),(0,n.jsx)(S,{children:s}),(0,n.jsx)(k,{children:(0,n.jsx)(Ee,{className:"flex flex-row gap-2 pt-1 items-center",value:g.value,onValueChange:g.onChange,children:d.map(j=>(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(ze,{value:j,id:`${l}-${j}`},j),(0,n.jsx)(y,{className:"whitespace-pre",htmlFor:`${l}-${j}`,children:se.startCase(j)})]},j))})}),(0,n.jsx)(O,{})]})},e[2]=s,e[3]=m,e[4]=d,e[5]=l,e[6]=c):c=e[6];let v;return e[7]!==i||e[8]!==a.control||e[9]!==l||e[10]!==c?(v=(0,n.jsx)(w,{control:a.control,name:l,disabled:i,render:c}),e[7]=i,e[8]=a.control,e[9]=l,e[10]=c,e[11]=v):v=e[11],v}let f;e[12]!==s||e[13]!==m||e[14]!==d||e[15]!==o?(f=c=>{let{field:v}=c;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{className:"whitespace-pre",children:m}),(0,n.jsx)(S,{children:s}),(0,n.jsx)(k,{children:(0,n.jsxs)(Ae,{"data-testid":"marimo-plugin-data-frames-select",value:v.value,onValueChange:v.onChange,children:[(0,n.jsx)($e,{className:"min-w-[180px]",children:(0,n.jsx)(Se,{placeholder:"--"})}),(0,n.jsx)(Oe,{children:(0,n.jsxs)(Ve,{children:[d.map(u=>(0,n.jsx)(Y,{value:u,children:(o==null?void 0:o(u))??u},u)),d.length===0&&(0,n.jsx)(Y,{disabled:!0,value:"--",children:"No options"})]})})]})}),(0,n.jsx)(O,{})]})},e[12]=s,e[13]=m,e[14]=d,e[15]=o,e[16]=f):f=e[16];let x;return e[17]!==i||e[18]!==a.control||e[19]!==l||e[20]!==f?(x=(0,n.jsx)(w,{control:a.control,name:l,disabled:i,render:f}),e[17]=i,e[18]=a.control,e[19]=l,e[20]=f,e[21]=x):x=e[21],x},nn=r=>{let e=(0,z.c)(15),{schema:t,form:a,path:l,options:d,itemLabel:o,showSwitchable:h}=r,m;e[0]===t.description?m=e[1]:(m=A.parse(t.description),e[0]=t.description,e[1]=m);let{label:s,description:i,placeholder:p}=m,f;e[2]!==o||e[3]!==p?(f=p??(o?`Select ${o==null?void 0:o.toLowerCase()}`:void 0),e[2]=o,e[3]=p,e[4]=f):f=e[4];let x=f,c;e[5]!==i||e[6]!==s||e[7]!==d||e[8]!==x||e[9]!==h?(c=u=>{let{field:g}=u,j=J(g.value);return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{className:"whitespace-pre",children:s}),(0,n.jsx)(S,{children:i}),(0,n.jsx)(k,{children:h?(0,n.jsx)(pe,{...g,value:j,options:d,placeholder:x}):(0,n.jsx)(ee,{className:"min-w-[180px]",placeholder:x,displayValue:tn,multiple:!0,chips:!0,keepPopoverOpenOnSelect:!0,value:j,onValueChange:g.onChange,children:d.map(an)})}),(0,n.jsx)(O,{})]})},e[5]=i,e[6]=s,e[7]=d,e[8]=x,e[9]=h,e[10]=c):c=e[10];let v;return e[11]!==a.control||e[12]!==l||e[13]!==c?(v=(0,n.jsx)(w,{control:a.control,name:l,render:c}),e[11]=a.control,e[12]=l,e[13]=c,e[14]=v):v=e[14],v};function rn(...r){return r.filter(e=>e!=="").join(".")}function sn(r){return r.preventDefault()}function tn(r){return se.startCase(r)}function an(r){return(0,n.jsx)(ne,{value:r,children:r},r)}export{J as a,A as c,U as i,ae as l,$ as n,D as o,pe as r,_ as s,We as t,Ke as u};
@@ -1,4 +1,4 @@
1
- import{s as re}from"./chunk-LvLJmgfZ.js";import{d as be,l as oe,n as ae}from"./useEvent-D91BmmQi.js";import{t as je}from"./react-Bj1aDYRI.js";import{Ii as ve,Nn as se,Rt as ke,br as we,dr as Ne,lr as ie,pr as _e,vi as le,yr as Se}from"./cells-CJlo_hG2.js";import"./react-dom-CSu739Rf.js";import{t as ne}from"./compiler-runtime-B3qBwwSJ.js";import{d as Ce,v as ce}from"./useEventListener-BR0C1MaI.js";import{n as H}from"./constants-DMpttj8Q.js";import{t as ze}from"./ErrorBoundary-DzYV_VeY.js";import{t as Me}from"./cn-DCUzRj2J.js";import{t as Ie}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import{o as Re}from"./alert-dialog-BGBdrcqJ.js";import"./popover-UExmgBsf.js";import{a as Pe,c as De,p as Oe,r as Te,t as We}from"./dropdown-menu-D1A3cFC8.js";import{t as Fe}from"./label-DTR8T0AE.js";import{t as Ae}from"./tooltip-Gcwqb_SK.js";import{t as B}from"./button-D9nb17Rw.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Y}from"./requests-DIwGYs0l.js";import{t as V}from"./createLucideIcon-D5guW7EU.js";import{t as Ue}from"./chart-no-axes-column-nqk474t8.js";import{r as $e}from"./x-C-6liIBr.js";import{t as Le}from"./chevron-right-CG5QYXYk.js";import{n as Q,r as He,t as me}from"./maps-C48Oksn0.js";import{t as Ve}from"./circle-play-CYXX2xu3.js";import{r as Ee,t as Be}from"./file-icons-BNrh8MRG.js";import{t as Ye}from"./file-HTLbeC2b.js";import{t as qe}from"./github-raQvpeuZ.js";import{n as Je,r as Ge,t as Qe}from"./youtube-3lRHw8NU.js";import{t as Ke}from"./link-CfEtM3Rl.js";import{t as K}from"./spinner-Bhir8k53.js";import{a as Xe,i as Ze,l as et,n as tt,o as rt,r as ot,s as at,t as st}from"./file-name-input-CLlFR7p-.js";import{n as it,r as lt,t as nt}from"./app-config-button-DC5UlXZA.js";import{t as ct}from"./refresh-ccw-C-n2VFP5.js";import{dt as mt,r as dt}from"./input-DyPS_GiK.js";import"./dist-Ds4ite_2.js";import"./dist-CEysMnMQ.js";import"./dist-DGxytjtv.js";import"./dist-DZ2qbK2N.js";import"./dist-CRPTyqAT.js";import{t as de}from"./use-toast-BDYuj3zG.js";import{n as he}from"./paths-CXng2XQv.js";import{c as pe,n as ht,o as pt,t as ft}from"./session-nmTRerwF.js";import"./purify.es-DC4RGS9t.js";import{i as ut}from"./dates-DhByPWH5.js";import{t as xt}from"./context-DGqo1TbK.js";import{n as gt}from"./ImperativeModal-BBqcKmmk.js";import{r as yt}from"./errors-CZb6hI2x.js";import{n as bt}from"./react-icons.esm-BUYTQ32a.js";import{t as fe}from"./error-banner-CTBwdcdk.js";import{n as X,t as jt}from"./useAsyncData-dS4Ne6pU.js";import{t as Z}from"./icons-BRopQwI3.js";import{n as vt}from"./marimo-icons-BSB-Z_W3.js";import{t as kt}from"./links-BHtUMVOq.js";import"./Inputs-BdyX096j.js";import{t as wt}from"./useInterval-CG264TRB.js";var Nt=V("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),_t=V("book-text",[["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:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]),St=V("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]),Ct=V("orbit",[["path",{d:"M20.341 6.484A10 10 0 0 1 10.266 21.85",key:"1enhxb"}],["path",{d:"M3.659 17.516A10 10 0 0 1 13.74 2.152",key:"1crzgf"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}]]),zt=V("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]),P=re(je(),1),ee=ne(),r=re(Ie(),1),Mt={intro:["Introduction",Nt,"Get started with marimo basics"],dataflow:["Dataflow",we,"Learn how cells interact with each other"],ui:["UI Elements",zt,"Create interactive UI components"],markdown:["Markdown",ie,"Format text with parameterized markdown"],plots:["Plots",Ue,"Create interactive visualizations"],sql:["SQL",Ne,"Query databases directly in marimo"],layout:["Layout",Ge,"Customize the layout of your cells' output"],fileformat:["File format",Ye,"Understand marimo's pure-Python file format"],"for-jupyter-users":["For Jupyter users",Ct,"Transiting from Jupyter to marimo"],"markdown-format":["Markdown format",Z,"Using marimo to edit markdown files"]};const It=()=>{let t=(0,ee.c)(6),{openTutorial:e}=Y(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(St,{className:"w-4 h-4 mr-2"}),t[0]=o):o=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(Oe,{asChild:!0,children:(0,r.jsxs)(B,{"data-testid":"open-tutorial-button",size:"xs",variant:"outline",children:[o,"Tutorials",(0,r.jsx)(bt,{className:"w-3 h-3 ml-1"})]})}),t[1]=s):s=t[1];let a;t[2]===e?a=t[3]:(a=Ce.entries(Mt).map(i=>{let[m,h]=i,[p,u,n]=h;return(0,r.jsxs)(Pe,{onSelect:async()=>{let c=await e({tutorialId:m});c&&kt(c.path)},children:[(0,r.jsx)(u,{strokeWidth:1.5,className:"w-4 h-4 mr-3 self-start mt-1.5 text-muted-foreground"}),(0,r.jsx)("div",{className:"flex items-center",children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{children:p}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground pr-1",children:n})]})})]},m)}),t[2]=e,t[3]=a);let l;return t[4]===a?l=t[5]:(l=(0,r.jsxs)(We,{children:[s,(0,r.jsx)(Te,{side:"bottom",align:"end",className:"print:hidden",children:a})]}),t[4]=a,t[5]=l),l};var Rt=[{title:"Documentation",description:"Official marimo documentation and API reference",icon:Se,url:H.docsPage},{title:"GitHub",description:"View source code, report issues, or contribute",icon:qe,url:H.githubPage},{title:"Community",description:"Join the marimo Discord community",icon:Je,url:H.discordLink},{title:"molab",description:"Run marimo notebooks in the cloud",icon:vt,url:H.molab},{title:"YouTube",description:"Watch tutorials and demos",icon:Qe,url:H.youtube},{title:"Changelog",description:"See what's new in marimo",icon:ie,url:H.releasesPage}];const Pt=()=>{let t=(0,ee.c)(2),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(q,{Icon:Ke,children:"Resources"}),t[0]=e):e=t[0];let o;return t[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[e,(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Rt.map(Dt)})]}),t[1]=o):o=t[1],o},q=t=>{let e=(0,ee.c)(8),{Icon:o,control:s,children:a}=t,l;e[0]===o?l=e[1]:(l=(0,r.jsx)(o,{className:"h-5 w-5"}),e[0]=o,e[1]=l);let i;e[2]!==a||e[3]!==l?(i=(0,r.jsxs)("h2",{className:"flex items-center gap-2 text-xl font-semibold text-muted-foreground select-none",children:[l,a]}),e[2]=a,e[3]=l,e[4]=i):i=e[4];let m;return e[5]!==s||e[6]!==i?(m=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[i,s]}),e[5]=s,e[6]=i,e[7]=m):m=e[7],m};function Dt(t){return(0,r.jsxs)("a",{href:t.url,target:"_blank",className:"flex items-start gap-3 py-3 px-3 rounded-lg border hover:bg-accent/20 transition-colors shadow-xs",children:[(0,r.jsx)(t.icon,{className:"w-5 h-5 mt-1.5 text-primary"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-medium",children:t.title}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.description})]})]},t.title)}const te=P.createContext({runningNotebooks:new Map,setRunningNotebooks:ce.NOOP}),J=P.createContext({root:"",refreshWorkspace:ce.NOOP}),Ot=le("marimo:home:include-markdown",!1,se,{getOnInit:!0}),ue=le("marimo:home:expanded-folders",{},se,{getOnInit:!0});var W=ne();function xe(t){return`${ft()}-${encodeURIComponent(t)}`}var Tt=()=>{let t=(0,W.c)(58),[e,o]=(0,P.useState)(0),{getRecentFiles:s,getRunningNotebooks:a}=Y(),l;t[0]===s?l=t[1]:(l=()=>s(),t[0]=s,t[1]=l);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[2]=i):i=t[2];let m=X(l,i),h,p;t[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(Bt)},p={delayMs:1e4,whenVisible:!0},t[3]=h,t[4]=p):(h=t[3],p=t[4]),wt(h,p);let u;t[5]===a?u=t[6]:(u=async()=>{let R=await a();return me.keyBy(R.files,Yt)},t[5]=a,t[6]=u);let n;t[7]===e?n=t[8]:(n=[e],t[7]=e,t[8]=n);let c=X(u,n),f,d,y,x,v,j,g,b,k,N,_,D,S;if(t[9]!==m||t[10]!==c){k=Symbol.for("react.early_return_sentinel");e:{let R=jt(m,c);if(R.error)throw R.error;let A=R.data;if(!A){let E;t[24]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsx)(K,{centered:!0,size:"xlarge"}),t[24]=E):E=t[24],k=E;break e}let[$,L]=A;x=$,y=P.Suspense,d=te,g={runningNotebooks:L,setRunningNotebooks:c.setData};let w,U;t[25]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(It,{}),U=(0,r.jsx)(nt,{showAppConfig:!1}),t[25]=w,t[26]=U):(w=t[25],U=t[26]);let G=`This will shutdown the notebook server and terminate all running notebooks (${L.size}). You'll lose all data that's in memory.`;t[27]===G?b=t[28]:(b=(0,r.jsxs)("div",{className:"absolute top-3 right-5 flex gap-3 z-50",children:[w,U,(0,r.jsx)(it,{description:G})]}),t[27]=G,t[28]=b),D="flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10",t[29]===Symbol.for("react.memo_cache_sentinel")?(S=(0,r.jsx)("img",{src:"logo.png",alt:"marimo logo",className:"w-48 mb-2"}),v=(0,r.jsx)(Vt,{}),j=(0,r.jsx)(Pt,{}),t[29]=v,t[30]=j,t[31]=S):(v=t[29],j=t[30],S=t[31]),f=ge,t[32]===Symbol.for("react.memo_cache_sentinel")?(N=(0,r.jsx)(q,{Icon:Ve,children:"Running notebooks"}),t[32]=N):N=t[32],_=[...L.values()]}t[9]=m,t[10]=c,t[11]=f,t[12]=d,t[13]=y,t[14]=x,t[15]=v,t[16]=j,t[17]=g,t[18]=b,t[19]=k,t[20]=N,t[21]=_,t[22]=D,t[23]=S}else f=t[11],d=t[12],y=t[13],x=t[14],v=t[15],j=t[16],g=t[17],b=t[18],k=t[19],N=t[20],_=t[21],D=t[22],S=t[23];if(k!==Symbol.for("react.early_return_sentinel"))return k;let C;t[33]!==f||t[34]!==N||t[35]!==_?(C=(0,r.jsx)(f,{header:N,files:_}),t[33]=f,t[34]=N,t[35]=_,t[36]=C):C=t[36];let F;t[37]===Symbol.for("react.memo_cache_sentinel")?(F=(0,r.jsx)(q,{Icon:_e,children:"Recent notebooks"}),t[37]=F):F=t[37];let z;t[38]===x.files?z=t[39]:(z=(0,r.jsx)(ge,{header:F,files:x.files}),t[38]=x.files,t[39]=z);let M;t[40]===m.refetch?M=t[41]:(M=(0,r.jsx)(ze,{children:(0,r.jsx)(Wt,{onRefreshRecents:m.refetch})}),t[40]=m.refetch,t[41]=M);let O;t[42]!==v||t[43]!==j||t[44]!==C||t[45]!==z||t[46]!==M||t[47]!==D||t[48]!==S?(O=(0,r.jsxs)("div",{className:D,children:[S,v,j,C,z,M]}),t[42]=v,t[43]=j,t[44]=C,t[45]=z,t[46]=M,t[47]=D,t[48]=S,t[49]=O):O=t[49];let I;t[50]!==d||t[51]!==g||t[52]!==b||t[53]!==O?(I=(0,r.jsxs)(d,{value:g,children:[b,O]}),t[50]=d,t[51]=g,t[52]=b,t[53]=O,t[54]=I):I=t[54];let T;return t[55]!==y||t[56]!==I?(T=(0,r.jsx)(y,{children:I}),t[55]=y,t[56]=I,t[57]=T):T=t[57],T},Wt=t=>{let e=(0,W.c)(54),{onRefreshRecents:o}=t,{getWorkspaceFiles:s}=Y(),[a,l]=oe(Ot),[i,m]=(0,P.useState)(""),h;e[0]!==s||e[1]!==a?(h=()=>s({includeMarkdown:a}),e[0]=s,e[1]=a,e[2]=h):h=e[2];let p;e[3]===a?p=e[4]:(p=[a],e[3]=a,e[4]=p);let{isPending:u,data:n,error:c,isFetching:f,refetch:d}=X(h,p),y;e[5]!==o||e[6]!==d?(y=()=>{d(),o()},e[5]=o,e[6]=d,e[7]=y):y=e[7];let x=ae(y);n==null||n.root;let v=(n==null?void 0:n.root)??"",j;e[8]!==x||e[9]!==v?(j={root:v,refreshWorkspace:x},e[8]=x,e[9]=v,e[10]=j):j=e[10];let g=j;if(u){let w;return e[11]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(K,{centered:!0,size:"xlarge",className:"mt-6"}),e[11]=w):w=e[11],w}if(c){let w;e[12]===c?w=e[13]:(w=yt(c),e[12]=c,e[13]=w);let U;return e[14]===w?U=e[15]:(U=(0,r.jsx)(fe,{kind:"danger",className:"rounded p-4",children:w}),e[14]=w,e[15]=U),U}let b;e[16]!==n.fileCount||e[17]!==n.hasMore?(b=n.hasMore&&(0,r.jsxs)(fe,{kind:"warn",className:"rounded p-4",children:["Showing first ",n.fileCount," files. Your workspace has more files."]}),e[16]=n.fileCount,e[17]=n.hasMore,e[18]=b):b=e[18];let k,N;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=(0,r.jsx)(mt,{size:13}),N=w=>m(w.target.value),e[19]=k,e[20]=N):(k=e[19],N=e[20]);let _;e[21]===i?_=e[22]:(_=(0,r.jsx)(dt,{id:"search",value:i,icon:k,onChange:N,placeholder:"Search",className:"mb-0 border-border"}),e[21]=i,e[22]=_);let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsx)(Ft,{}),e[23]=D):D=e[23];let S;e[24]===l?S=e[25]:(S=w=>l(!!w),e[24]=l,e[25]=S);let C;e[26]!==a||e[27]!==S?(C=(0,r.jsx)(ke,{"data-testid":"include-markdown-checkbox",id:"include-markdown",checked:a,onCheckedChange:S}),e[26]=a,e[27]=S,e[28]=C):C=e[28];let F;e[29]===Symbol.for("react.memo_cache_sentinel")?(F=(0,r.jsx)(Fe,{htmlFor:"include-markdown",children:"Include markdown"}),e[29]=F):F=e[29];let z;e[30]!==C||e[31]!==_?(z=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[_,D,C,F]}),e[30]=C,e[31]=_,e[32]=z):z=e[32];let M;e[33]===d?M=e[34]:(M=()=>d(),e[33]=d,e[34]=M);let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=(0,r.jsx)(ct,{className:"w-4 h-4"}),e[35]=O):O=e[35];let I;e[36]===M?I=e[37]:(I=(0,r.jsx)(B,{variant:"text",size:"icon",className:"w-4 h-4 ml-1 p-0 opacity-70 hover:opacity-100",onClick:M,"aria-label":"Refresh workspace",children:O}),e[36]=M,e[37]=I);let T;e[38]===f?T=e[39]:(T=f&&(0,r.jsx)(K,{size:"small"}),e[38]=f,e[39]=T);let R;e[40]!==z||e[41]!==I||e[42]!==T?(R=(0,r.jsxs)(q,{Icon:_t,control:z,children:["Workspace",I,T]}),e[40]=z,e[41]=I,e[42]=T,e[43]=R):R=e[43];let A;e[44]!==i||e[45]!==n.files?(A=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:(0,r.jsx)(At,{searchText:i,files:n.files})}),e[44]=i,e[45]=n.files,e[46]=A):A=e[46];let $;e[47]!==R||e[48]!==A||e[49]!==b?($=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[b,R,A]}),e[47]=R,e[48]=A,e[49]=b,e[50]=$):$=e[50];let L;return e[51]!==$||e[52]!==g?(L=(0,r.jsx)(J,{value:g,children:$}),e[51]=$,e[52]=g,e[53]=L):L=e[53],L},Ft=()=>{let t=(0,W.c)(5),e=be(ue),o;t[0]===e?o=t[1]:(o=()=>{e({})},t[0]=e,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(He,{className:"w-4 h-4 mr-1"}),t[2]=s):s=t[2];let a;return t[3]===o?a=t[4]:(a=(0,r.jsxs)(B,{variant:"text",size:"sm",className:"h-fit hidden sm:flex",onClick:o,children:[s,"Collapse all"]}),t[3]=o,t[4]=a),a},At=t=>{let e=(0,W.c)(20),{files:o,searchText:s}=t,[a,l]=oe(ue),i=Object.keys(a).length===0,m=(0,P.useRef)(void 0),{root:h,refreshWorkspace:p}=(0,P.use)(J),u;e[0]===h?u=e[1]:(u={root:h},e[0]=h,e[1]=u);let{renameFile:n}=rt(u),c,f;e[2]===i?(c=e[3],f=e[4]):(c=()=>{var g;i&&((g=m.current)==null||g.closeAll())},f=[i],e[2]=i,e[3]=c,e[4]=f),(0,P.useEffect)(c,f);let d;e[5]!==p||e[6]!==n?(d=async(g,b)=>{var N;let k=(N=m.current)==null?void 0:N.get(g);if(!k){de({title:"Failed",description:`Node with id ${g} not found in the tree`});return}await n(k.data,b)&&p()},e[5]=p,e[6]=n,e[7]=d):d=e[7];let y=ae(d);if(o.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(0,r.jsx)("div",{className:"flex flex-col px-5 py-10 items-center justify-center",children:(0,r.jsx)("p",{className:"text-center text-muted-foreground",children:"No files in this workspace"})}),e[8]=g):g=e[8],g}let x;e[9]!==a||e[10]!==l?(x=async g=>{let b=a[g]??!1;l({...a,[g]:!b})},e[9]=a,e[10]=l,e[11]=x):x=e[11];let v;e[12]===y?v=e[13]:(v=async g=>{let{id:b,name:k}=g;await y(b,k)},e[12]=y,e[13]=v);let j;return e[14]!==o||e[15]!==a||e[16]!==s||e[17]!==x||e[18]!==v?(j=(0,r.jsx)(et,{ref:m,width:"100%",height:500,searchTerm:s,className:"h-full",idAccessor:qt,data:o,openByDefault:!1,initialOpenState:a,onToggle:x,onRename:v,padding:5,rowHeight:35,indent:15,overscanCount:1e3,renderCursor:Jt,disableDrop:!0,disableDrag:!0,disableMultiSelection:!0,children:Ut}),e[14]=o,e[15]=a,e[16]=s,e[17]=x,e[18]=v,e[19]=j):j=e[19],j},Ut=t=>{let e=(0,W.c)(18),{node:o,style:s}=t,a=Be[o.data.isDirectory?"directory":Ee(o.data.name)],l;e[0]===a?l=e[1]:(l=(0,r.jsx)(a,{className:"w-5 h-5 shrink-0",strokeWidth:1.5}),e[0]=a,e[1]=l);let i=l,{root:m}=(0,P.use)(J),{runningNotebooks:h}=(0,P.use)(te),p;e[2]!==i||e[3]!==o||e[4]!==m||e[5]!==h?(p=()=>{if(o.isEditing)return(0,r.jsxs)("div",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,(0,r.jsx)(st,{node:o})]});if(o.data.isDirectory)return(0,r.jsxs)("span",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,o.data.name]});let x=o.data.path.startsWith(m)&&he.isAbsolute(o.data.path)?he.rest(o.data.path,m):o.data.path,v=x.endsWith(".md")||x.endsWith(".qmd"),j=h.has(x);return(0,r.jsxs)("a",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",href:pe(`?file=${encodeURIComponent(x)}`).toString(),target:xe(x),children:[i,(0,r.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",children:[o.data.name,v&&(0,r.jsx)(Z,{className:"ml-2 inline opacity-80"})]}),(0,r.jsx)($t,{node:o,isRunning:j}),(0,r.jsx)("div",{className:"w-8 h-8 flex items-center justify-center shrink-0",children:(0,r.jsx)(ye,{filePath:x})}),(0,r.jsx)(Q,{size:20,className:"group-hover:opacity-100 opacity-0 text-primary shrink-0"})]})},e[2]=i,e[3]=o,e[4]=m,e[5]=h,e[6]=p):p=e[6];let u=p,n;e[7]===Symbol.for("react.memo_cache_sentinel")?(n=Me("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group h-full"),e[7]=n):n=e[7];let c,f;e[8]===o?(c=e[9],f=e[10]):(c=x=>{x.stopPropagation(),o.data.isDirectory&&o.toggle()},f=(0,r.jsx)(Lt,{node:o}),e[8]=o,e[9]=c,e[10]=f);let d;e[11]===u?d=e[12]:(d=u(),e[11]=u,e[12]=d);let y;return e[13]!==s||e[14]!==c||e[15]!==f||e[16]!==d?(y=(0,r.jsxs)("div",{style:s,className:n,onClick:c,children:[f,d]}),e[13]=s,e[14]=c,e[15]=f,e[16]=d,e[17]=y):y=e[17],y},$t=t=>{let e=(0,W.c)(19),{node:o,isRunning:s}=t,{root:a,refreshWorkspace:l}=(0,P.use)(J),i;e[0]!==o||e[1]!==l||e[2]!==a?(i={node:o,root:a,onAfterChange:l},e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let{handleRename:m,handleDuplicate:h,handleDelete:p}=at(i),u=s?"Stop the notebook's kernel before renaming or deleting.":void 0,n;e[4]!==m||e[5]!==s||e[6]!==u?(n=(0,r.jsx)(Xe,{onSelect:m,disabled:s,title:u}),e[4]=m,e[5]=s,e[6]=u,e[7]=n):n=e[7];let c;e[8]===h?c=e[9]:(c=(0,r.jsx)(ot,{onSelect:h}),e[8]=h,e[9]=c);let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,r.jsx)(De,{}),e[10]=f):f=e[10];let d;e[11]!==p||e[12]!==s||e[13]!==u?(d=(0,r.jsx)(tt,{onSelect:p,disabled:s,title:u}),e[11]=p,e[12]=s,e[13]=u,e[14]=d):d=e[14];let y;return e[15]!==n||e[16]!==c||e[17]!==d?(y=(0,r.jsxs)(Ze,{testId:"workspace-more-button",buttonClassName:"w-8 h-8 p-0 shrink-0",contentClassName:"print:hidden w-fit min-w-[140px]",preventDefaultOnTrigger:!0,children:[n,c,f,d]}),e[15]=n,e[16]=c,e[17]=d,e[18]=y):y=e[18],y},Lt=t=>{let e=(0,W.c)(3),{node:o}=t;if(!o.data.isDirectory){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)("span",{className:"w-5 h-5 shrink-0"}),e[0]=a):a=e[0],a}let s;return e[1]===o.isOpen?s=e[2]:(s=o.isOpen?(0,r.jsx)($e,{className:"w-5 h-5 shrink-0"}):(0,r.jsx)(Le,{className:"w-5 h-5 shrink-0"}),e[1]=o.isOpen,e[2]=s),s},ge=t=>{let e=(0,W.c)(7),{header:o,files:s}=t;if(s.length===0)return null;let a;e[0]===s?a=e[1]:(a=s.map(Gt),e[0]=s,e[1]=a);let l;e[2]===a?l=e[3]:(l=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:a}),e[2]=a,e[3]=l);let i;return e[4]!==o||e[5]!==l?(i=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[o,l]}),e[4]=o,e[5]=l,e[6]=i):i=e[6],i},Ht=t=>{let e=(0,W.c)(41),{file:o}=t,{locale:s}=xt(),a;e[0]===o.path?a=e[1]:(a=ht(o.path),e[0]=o.path,e[1]=a);let l=a,i,m,h,p;if(e[2]!==o.initializationId||e[3]!==o.path||e[4]!==l){let N=pe(l?`?file=${encodeURIComponent(o.initializationId??o.path)}&session_id=${o.path}`:`?file=${encodeURIComponent(o.path)}`),_;e[9]===o.path?_=e[10]:(_=o.path.endsWith(".md"),e[9]=o.path,e[10]=_),i=_,m="py-1.5 px-4 hover:bg-(--blue-2) hover:text-primary transition-all duration-300 cursor-pointer group relative flex gap-4 items-center",h=o.path,p=N.toString(),e[2]=o.initializationId,e[3]=o.path,e[4]=l,e[5]=i,e[6]=m,e[7]=h,e[8]=p}else i=e[5],m=e[6],h=e[7],p=e[8];let u=o.initializationId||o.path,n;e[11]===u?n=e[12]:(n=xe(u),e[11]=u,e[12]=n);let c;e[13]===i?c=e[14]:(c=i&&(0,r.jsx)("span",{className:"opacity-80",children:(0,r.jsx)(Z,{})}),e[13]=i,e[14]=c);let f;e[15]!==o.name||e[16]!==c?(f=(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[o.name,c]}),e[15]=o.name,e[16]=c,e[17]=f):f=e[17];let d;e[18]===o.path?d=e[19]:(d=(0,r.jsx)("p",{title:o.path,className:"text-sm text-muted-foreground overflow-hidden whitespace-nowrap text-ellipsis",children:o.path}),e[18]=o.path,e[19]=d);let y;e[20]!==f||e[21]!==d?(y=(0,r.jsxs)("div",{className:"flex flex-col justify-between flex-1",children:[f,d]}),e[20]=f,e[21]=d,e[22]=y):y=e[22];let x;e[23]===o.path?x=e[24]:(x=(0,r.jsx)("div",{children:(0,r.jsx)(ye,{filePath:o.path})}),e[23]=o.path,e[24]=x);let v;e[25]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(Q,{size:20,className:"group-hover:opacity-100 opacity-0 transition-all duration-300 text-primary"}),e[25]=v):v=e[25];let j;e[26]===x?j=e[27]:(j=(0,r.jsxs)("div",{className:"flex gap-3 items-center",children:[x,v]}),e[26]=x,e[27]=j);let g;e[28]!==o.lastModified||e[29]!==s?(g=!!o.lastModified&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground opacity-80",children:ut(o.lastModified*1e3,s)}),e[28]=o.lastModified,e[29]=s,e[30]=g):g=e[30];let b;e[31]!==j||e[32]!==g?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[j,g]}),e[31]=j,e[32]=g,e[33]=b):b=e[33];let k;return e[34]!==y||e[35]!==b||e[36]!==m||e[37]!==h||e[38]!==p||e[39]!==n?(k=(0,r.jsxs)("a",{className:m,href:p,target:n,children:[y,b]},h),e[34]=y,e[35]=b,e[36]=m,e[37]=h,e[38]=p,e[39]=n,e[40]=k):k=e[40],k},ye=t=>{let e=(0,W.c)(10),{filePath:o}=t,{openConfirm:s,closeModal:a}=gt(),{shutdownSession:l}=Y(),{runningNotebooks:i,setRunningNotebooks:m}=(0,P.use)(te);if(!i.has(o))return null;let h;e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==i||e[4]!==m||e[5]!==l?(h=n=>{n.stopPropagation(),n.preventDefault(),s({title:"Shutdown",description:"This will terminate the Python kernel. You'll lose all data that's in memory.",variant:"destructive",confirmAction:(0,r.jsx)(Re,{onClick:()=>{let c=i.get(o);ve(c==null?void 0:c.sessionId),l({sessionId:c.sessionId}).then(f=>{m(me.keyBy(f.files,Qt))}),a(),de({description:"Notebook has been shutdown."})},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=a,e[1]=o,e[2]=s,e[3]=i,e[4]=m,e[5]=l,e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)(lt,{size:14}),e[7]=p):p=e[7];let u;return e[8]===h?u=e[9]:(u=(0,r.jsx)(Ae,{content:"Shutdown",children:(0,r.jsx)(B,{size:"icon",variant:"outline",className:"opacity-80 hover:opacity-100 hover:bg-accent text-destructive border-destructive hover:border-destructive hover:text-destructive bg-background hover:bg-(--red-1)",onClick:h,children:p})}),e[8]=h,e[9]=u),u},Vt=()=>{let t=(0,W.c)(3),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=pt(),t[0]=e):e=t[0];let o=e,s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Create a new notebook"}),t[1]=s):s=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsxs)("a",{className:`relative rounded-lg p-6 group
1
+ import{s as re}from"./chunk-LvLJmgfZ.js";import{d as be,l as oe,n as ae}from"./useEvent-D91BmmQi.js";import{t as je}from"./react-Bj1aDYRI.js";import{Li as ve,Nn as se,Rt as ke,br as we,fr as Ne,mr as _e,ur as ie,xr as Se,yi as le}from"./cells-A-ljPpuj.js";import"./react-dom-CSu739Rf.js";import{t as ne}from"./compiler-runtime-B3qBwwSJ.js";import{d as Ce,v as ce}from"./useEventListener-BR0C1MaI.js";import{n as H}from"./constants-DMpttj8Q.js";import{t as ze}from"./ErrorBoundary-DzYV_VeY.js";import{t as Me}from"./cn-DCUzRj2J.js";import{t as Ie}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-BDxedMYP.js";import{o as Re}from"./alert-dialog-BGBdrcqJ.js";import"./popover-UExmgBsf.js";import{a as Pe,c as De,p as Oe,r as Te,t as We}from"./dropdown-menu-D1A3cFC8.js";import{t as Fe}from"./label-DTR8T0AE.js";import{t as Ae}from"./tooltip-Gcwqb_SK.js";import{t as B}from"./button-D9nb17Rw.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{r as Y}from"./requests-DIwGYs0l.js";import{t as V}from"./createLucideIcon-D5guW7EU.js";import{t as Le}from"./chart-no-axes-column-nqk474t8.js";import{r as Ue}from"./x-C-6liIBr.js";import{t as $e}from"./chevron-right-CG5QYXYk.js";import{n as Q,r as He,t as me}from"./maps-C48Oksn0.js";import{t as Ve}from"./circle-play-CYXX2xu3.js";import{r as Ee,t as Be}from"./file-icons-DTNZv05h.js";import{t as Ye}from"./file-HTLbeC2b.js";import{t as qe}from"./github-raQvpeuZ.js";import{n as Je,r as Ge,t as Qe}from"./youtube-3lRHw8NU.js";import{t as Ke}from"./link-CfEtM3Rl.js";import{t as K}from"./spinner-Bhir8k53.js";import{a as Xe,i as Ze,l as et,n as tt,o as rt,r as ot,s as at,t as st}from"./file-name-input-CLlFR7p-.js";import{n as it,r as lt,t as nt}from"./app-config-button-YS8lpoUa.js";import{t as ct}from"./refresh-ccw-C-n2VFP5.js";import{dt as mt,r as dt}from"./input-DyPS_GiK.js";import"./dist-Ds4ite_2.js";import"./dist-CEysMnMQ.js";import"./dist-DGxytjtv.js";import"./dist-DZ2qbK2N.js";import"./dist-CRPTyqAT.js";import{t as de}from"./use-toast-BDYuj3zG.js";import{n as he}from"./paths-CXng2XQv.js";import{c as pe,n as ht,o as pt,t as ft}from"./session-nmTRerwF.js";import"./purify.es-DC4RGS9t.js";import{i as ut}from"./dates-DhByPWH5.js";import{t as xt}from"./context-DGqo1TbK.js";import{n as gt}from"./ImperativeModal-BBqcKmmk.js";import{r as yt}from"./errors-CZb6hI2x.js";import{n as bt}from"./react-icons.esm-BUYTQ32a.js";import{t as fe}from"./error-banner-CTBwdcdk.js";import{n as X,t as jt}from"./useAsyncData-dS4Ne6pU.js";import{t as Z}from"./icons-BRopQwI3.js";import{n as vt}from"./marimo-icons-BSB-Z_W3.js";import{t as kt}from"./links-BHtUMVOq.js";import"./Inputs-BdyX096j.js";import{t as wt}from"./useInterval-CG264TRB.js";var Nt=V("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),_t=V("book-text",[["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:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]),St=V("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]),Ct=V("orbit",[["path",{d:"M20.341 6.484A10 10 0 0 1 10.266 21.85",key:"1enhxb"}],["path",{d:"M3.659 17.516A10 10 0 0 1 13.74 2.152",key:"1crzgf"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}]]),zt=V("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]),P=re(je(),1),ee=ne(),r=re(Ie(),1),Mt={intro:["Introduction",Nt,"Get started with marimo basics"],dataflow:["Dataflow",Se,"Learn how cells interact with each other"],ui:["UI Elements",zt,"Create interactive UI components"],markdown:["Markdown",ie,"Format text with parameterized markdown"],plots:["Plots",Le,"Create interactive visualizations"],sql:["SQL",Ne,"Query databases directly in marimo"],layout:["Layout",Ge,"Customize the layout of your cells' output"],fileformat:["File format",Ye,"Understand marimo's pure-Python file format"],"for-jupyter-users":["For Jupyter users",Ct,"Transiting from Jupyter to marimo"],"markdown-format":["Markdown format",Z,"Using marimo to edit markdown files"]};const It=()=>{let t=(0,ee.c)(6),{openTutorial:e}=Y(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(St,{className:"w-4 h-4 mr-2"}),t[0]=o):o=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(Oe,{asChild:!0,children:(0,r.jsxs)(B,{"data-testid":"open-tutorial-button",size:"xs",variant:"outline",children:[o,"Tutorials",(0,r.jsx)(bt,{className:"w-3 h-3 ml-1"})]})}),t[1]=s):s=t[1];let a;t[2]===e?a=t[3]:(a=Ce.entries(Mt).map(i=>{let[m,h]=i,[p,u,n]=h;return(0,r.jsxs)(Pe,{onSelect:async()=>{let c=await e({tutorialId:m});c&&kt(c.path)},children:[(0,r.jsx)(u,{strokeWidth:1.5,className:"w-4 h-4 mr-3 self-start mt-1.5 text-muted-foreground"}),(0,r.jsx)("div",{className:"flex items-center",children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{children:p}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground pr-1",children:n})]})})]},m)}),t[2]=e,t[3]=a);let l;return t[4]===a?l=t[5]:(l=(0,r.jsxs)(We,{children:[s,(0,r.jsx)(Te,{side:"bottom",align:"end",className:"print:hidden",children:a})]}),t[4]=a,t[5]=l),l};var Rt=[{title:"Documentation",description:"Official marimo documentation and API reference",icon:we,url:H.docsPage},{title:"GitHub",description:"View source code, report issues, or contribute",icon:qe,url:H.githubPage},{title:"Community",description:"Join the marimo Discord community",icon:Je,url:H.discordLink},{title:"molab",description:"Run marimo notebooks in the cloud",icon:vt,url:H.molab},{title:"YouTube",description:"Watch tutorials and demos",icon:Qe,url:H.youtube},{title:"Changelog",description:"See what's new in marimo",icon:ie,url:H.releasesPage}];const Pt=()=>{let t=(0,ee.c)(2),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(q,{Icon:Ke,children:"Resources"}),t[0]=e):e=t[0];let o;return t[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[e,(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Rt.map(Dt)})]}),t[1]=o):o=t[1],o},q=t=>{let e=(0,ee.c)(8),{Icon:o,control:s,children:a}=t,l;e[0]===o?l=e[1]:(l=(0,r.jsx)(o,{className:"h-5 w-5"}),e[0]=o,e[1]=l);let i;e[2]!==a||e[3]!==l?(i=(0,r.jsxs)("h2",{className:"flex items-center gap-2 text-xl font-semibold text-muted-foreground select-none",children:[l,a]}),e[2]=a,e[3]=l,e[4]=i):i=e[4];let m;return e[5]!==s||e[6]!==i?(m=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[i,s]}),e[5]=s,e[6]=i,e[7]=m):m=e[7],m};function Dt(t){return(0,r.jsxs)("a",{href:t.url,target:"_blank",className:"flex items-start gap-3 py-3 px-3 rounded-lg border hover:bg-accent/20 transition-colors shadow-xs",children:[(0,r.jsx)(t.icon,{className:"w-5 h-5 mt-1.5 text-primary"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-medium",children:t.title}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.description})]})]},t.title)}const te=P.createContext({runningNotebooks:new Map,setRunningNotebooks:ce.NOOP}),J=P.createContext({root:"",refreshWorkspace:ce.NOOP}),Ot=le("marimo:home:include-markdown",!1,se,{getOnInit:!0}),ue=le("marimo:home:expanded-folders",{},se,{getOnInit:!0});var W=ne();function xe(t){return`${ft()}-${encodeURIComponent(t)}`}var Tt=()=>{let t=(0,W.c)(58),[e,o]=(0,P.useState)(0),{getRecentFiles:s,getRunningNotebooks:a}=Y(),l;t[0]===s?l=t[1]:(l=()=>s(),t[0]=s,t[1]=l);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[2]=i):i=t[2];let m=X(l,i),h,p;t[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(Bt)},p={delayMs:1e4,whenVisible:!0},t[3]=h,t[4]=p):(h=t[3],p=t[4]),wt(h,p);let u;t[5]===a?u=t[6]:(u=async()=>{let R=await a();return me.keyBy(R.files,Yt)},t[5]=a,t[6]=u);let n;t[7]===e?n=t[8]:(n=[e],t[7]=e,t[8]=n);let c=X(u,n),f,d,y,x,v,j,g,b,k,N,_,D,S;if(t[9]!==m||t[10]!==c){k=Symbol.for("react.early_return_sentinel");e:{let R=jt(m,c);if(R.error)throw R.error;let A=R.data;if(!A){let E;t[24]===Symbol.for("react.memo_cache_sentinel")?(E=(0,r.jsx)(K,{centered:!0,size:"xlarge"}),t[24]=E):E=t[24],k=E;break e}let[U,$]=A;x=U,y=P.Suspense,d=te,g={runningNotebooks:$,setRunningNotebooks:c.setData};let w,L;t[25]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(It,{}),L=(0,r.jsx)(nt,{showAppConfig:!1}),t[25]=w,t[26]=L):(w=t[25],L=t[26]);let G=`This will shutdown the notebook server and terminate all running notebooks (${$.size}). You'll lose all data that's in memory.`;t[27]===G?b=t[28]:(b=(0,r.jsxs)("div",{className:"absolute top-3 right-5 flex gap-3 z-50",children:[w,L,(0,r.jsx)(it,{description:G})]}),t[27]=G,t[28]=b),D="flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10",t[29]===Symbol.for("react.memo_cache_sentinel")?(S=(0,r.jsx)("img",{src:"logo.png",alt:"marimo logo",className:"w-48 mb-2"}),v=(0,r.jsx)(Vt,{}),j=(0,r.jsx)(Pt,{}),t[29]=v,t[30]=j,t[31]=S):(v=t[29],j=t[30],S=t[31]),f=ge,t[32]===Symbol.for("react.memo_cache_sentinel")?(N=(0,r.jsx)(q,{Icon:Ve,children:"Running notebooks"}),t[32]=N):N=t[32],_=[...$.values()]}t[9]=m,t[10]=c,t[11]=f,t[12]=d,t[13]=y,t[14]=x,t[15]=v,t[16]=j,t[17]=g,t[18]=b,t[19]=k,t[20]=N,t[21]=_,t[22]=D,t[23]=S}else f=t[11],d=t[12],y=t[13],x=t[14],v=t[15],j=t[16],g=t[17],b=t[18],k=t[19],N=t[20],_=t[21],D=t[22],S=t[23];if(k!==Symbol.for("react.early_return_sentinel"))return k;let C;t[33]!==f||t[34]!==N||t[35]!==_?(C=(0,r.jsx)(f,{header:N,files:_}),t[33]=f,t[34]=N,t[35]=_,t[36]=C):C=t[36];let F;t[37]===Symbol.for("react.memo_cache_sentinel")?(F=(0,r.jsx)(q,{Icon:_e,children:"Recent notebooks"}),t[37]=F):F=t[37];let z;t[38]===x.files?z=t[39]:(z=(0,r.jsx)(ge,{header:F,files:x.files}),t[38]=x.files,t[39]=z);let M;t[40]===m.refetch?M=t[41]:(M=(0,r.jsx)(ze,{children:(0,r.jsx)(Wt,{onRefreshRecents:m.refetch})}),t[40]=m.refetch,t[41]=M);let O;t[42]!==v||t[43]!==j||t[44]!==C||t[45]!==z||t[46]!==M||t[47]!==D||t[48]!==S?(O=(0,r.jsxs)("div",{className:D,children:[S,v,j,C,z,M]}),t[42]=v,t[43]=j,t[44]=C,t[45]=z,t[46]=M,t[47]=D,t[48]=S,t[49]=O):O=t[49];let I;t[50]!==d||t[51]!==g||t[52]!==b||t[53]!==O?(I=(0,r.jsxs)(d,{value:g,children:[b,O]}),t[50]=d,t[51]=g,t[52]=b,t[53]=O,t[54]=I):I=t[54];let T;return t[55]!==y||t[56]!==I?(T=(0,r.jsx)(y,{children:I}),t[55]=y,t[56]=I,t[57]=T):T=t[57],T},Wt=t=>{let e=(0,W.c)(54),{onRefreshRecents:o}=t,{getWorkspaceFiles:s}=Y(),[a,l]=oe(Ot),[i,m]=(0,P.useState)(""),h;e[0]!==s||e[1]!==a?(h=()=>s({includeMarkdown:a}),e[0]=s,e[1]=a,e[2]=h):h=e[2];let p;e[3]===a?p=e[4]:(p=[a],e[3]=a,e[4]=p);let{isPending:u,data:n,error:c,isFetching:f,refetch:d}=X(h,p),y;e[5]!==o||e[6]!==d?(y=()=>{d(),o()},e[5]=o,e[6]=d,e[7]=y):y=e[7];let x=ae(y);n==null||n.root;let v=(n==null?void 0:n.root)??"",j;e[8]!==x||e[9]!==v?(j={root:v,refreshWorkspace:x},e[8]=x,e[9]=v,e[10]=j):j=e[10];let g=j;if(u){let w;return e[11]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(K,{centered:!0,size:"xlarge",className:"mt-6"}),e[11]=w):w=e[11],w}if(c){let w;e[12]===c?w=e[13]:(w=yt(c),e[12]=c,e[13]=w);let L;return e[14]===w?L=e[15]:(L=(0,r.jsx)(fe,{kind:"danger",className:"rounded p-4",children:w}),e[14]=w,e[15]=L),L}let b;e[16]!==n.fileCount||e[17]!==n.hasMore?(b=n.hasMore&&(0,r.jsxs)(fe,{kind:"warn",className:"rounded p-4",children:["Showing first ",n.fileCount," files. Your workspace has more files."]}),e[16]=n.fileCount,e[17]=n.hasMore,e[18]=b):b=e[18];let k,N;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=(0,r.jsx)(mt,{size:13}),N=w=>m(w.target.value),e[19]=k,e[20]=N):(k=e[19],N=e[20]);let _;e[21]===i?_=e[22]:(_=(0,r.jsx)(dt,{id:"search",value:i,icon:k,onChange:N,placeholder:"Search",className:"mb-0 border-border"}),e[21]=i,e[22]=_);let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsx)(Ft,{}),e[23]=D):D=e[23];let S;e[24]===l?S=e[25]:(S=w=>l(!!w),e[24]=l,e[25]=S);let C;e[26]!==a||e[27]!==S?(C=(0,r.jsx)(ke,{"data-testid":"include-markdown-checkbox",id:"include-markdown",checked:a,onCheckedChange:S}),e[26]=a,e[27]=S,e[28]=C):C=e[28];let F;e[29]===Symbol.for("react.memo_cache_sentinel")?(F=(0,r.jsx)(Fe,{htmlFor:"include-markdown",children:"Include markdown"}),e[29]=F):F=e[29];let z;e[30]!==C||e[31]!==_?(z=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[_,D,C,F]}),e[30]=C,e[31]=_,e[32]=z):z=e[32];let M;e[33]===d?M=e[34]:(M=()=>d(),e[33]=d,e[34]=M);let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=(0,r.jsx)(ct,{className:"w-4 h-4"}),e[35]=O):O=e[35];let I;e[36]===M?I=e[37]:(I=(0,r.jsx)(B,{variant:"text",size:"icon",className:"w-4 h-4 ml-1 p-0 opacity-70 hover:opacity-100",onClick:M,"aria-label":"Refresh workspace",children:O}),e[36]=M,e[37]=I);let T;e[38]===f?T=e[39]:(T=f&&(0,r.jsx)(K,{size:"small"}),e[38]=f,e[39]=T);let R;e[40]!==z||e[41]!==I||e[42]!==T?(R=(0,r.jsxs)(q,{Icon:_t,control:z,children:["Workspace",I,T]}),e[40]=z,e[41]=I,e[42]=T,e[43]=R):R=e[43];let A;e[44]!==i||e[45]!==n.files?(A=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:(0,r.jsx)(At,{searchText:i,files:n.files})}),e[44]=i,e[45]=n.files,e[46]=A):A=e[46];let U;e[47]!==R||e[48]!==A||e[49]!==b?(U=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[b,R,A]}),e[47]=R,e[48]=A,e[49]=b,e[50]=U):U=e[50];let $;return e[51]!==U||e[52]!==g?($=(0,r.jsx)(J,{value:g,children:U}),e[51]=U,e[52]=g,e[53]=$):$=e[53],$},Ft=()=>{let t=(0,W.c)(5),e=be(ue),o;t[0]===e?o=t[1]:(o=()=>{e({})},t[0]=e,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(He,{className:"w-4 h-4 mr-1"}),t[2]=s):s=t[2];let a;return t[3]===o?a=t[4]:(a=(0,r.jsxs)(B,{variant:"text",size:"sm",className:"h-fit hidden sm:flex",onClick:o,children:[s,"Collapse all"]}),t[3]=o,t[4]=a),a},At=t=>{let e=(0,W.c)(20),{files:o,searchText:s}=t,[a,l]=oe(ue),i=Object.keys(a).length===0,m=(0,P.useRef)(void 0),{root:h,refreshWorkspace:p}=(0,P.use)(J),u;e[0]===h?u=e[1]:(u={root:h},e[0]=h,e[1]=u);let{renameFile:n}=rt(u),c,f;e[2]===i?(c=e[3],f=e[4]):(c=()=>{var g;i&&((g=m.current)==null||g.closeAll())},f=[i],e[2]=i,e[3]=c,e[4]=f),(0,P.useEffect)(c,f);let d;e[5]!==p||e[6]!==n?(d=async(g,b)=>{var N;let k=(N=m.current)==null?void 0:N.get(g);if(!k){de({title:"Failed",description:`Node with id ${g} not found in the tree`});return}await n(k.data,b)&&p()},e[5]=p,e[6]=n,e[7]=d):d=e[7];let y=ae(d);if(o.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(0,r.jsx)("div",{className:"flex flex-col px-5 py-10 items-center justify-center",children:(0,r.jsx)("p",{className:"text-center text-muted-foreground",children:"No files in this workspace"})}),e[8]=g):g=e[8],g}let x;e[9]!==a||e[10]!==l?(x=async g=>{let b=a[g]??!1;l({...a,[g]:!b})},e[9]=a,e[10]=l,e[11]=x):x=e[11];let v;e[12]===y?v=e[13]:(v=async g=>{let{id:b,name:k}=g;await y(b,k)},e[12]=y,e[13]=v);let j;return e[14]!==o||e[15]!==a||e[16]!==s||e[17]!==x||e[18]!==v?(j=(0,r.jsx)(et,{ref:m,width:"100%",height:500,searchTerm:s,className:"h-full",idAccessor:qt,data:o,openByDefault:!1,initialOpenState:a,onToggle:x,onRename:v,padding:5,rowHeight:35,indent:15,overscanCount:1e3,renderCursor:Jt,disableDrop:!0,disableDrag:!0,disableMultiSelection:!0,children:Lt}),e[14]=o,e[15]=a,e[16]=s,e[17]=x,e[18]=v,e[19]=j):j=e[19],j},Lt=t=>{let e=(0,W.c)(18),{node:o,style:s}=t,a=Be[o.data.isDirectory?"directory":Ee(o.data.name)],l;e[0]===a?l=e[1]:(l=(0,r.jsx)(a,{className:"w-5 h-5 shrink-0",strokeWidth:1.5}),e[0]=a,e[1]=l);let i=l,{root:m}=(0,P.use)(J),{runningNotebooks:h}=(0,P.use)(te),p;e[2]!==i||e[3]!==o||e[4]!==m||e[5]!==h?(p=()=>{if(o.isEditing)return(0,r.jsxs)("div",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,(0,r.jsx)(st,{node:o})]});if(o.data.isDirectory)return(0,r.jsxs)("span",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,o.data.name]});let x=o.data.path.startsWith(m)&&he.isAbsolute(o.data.path)?he.rest(o.data.path,m):o.data.path,v=x.endsWith(".md")||x.endsWith(".qmd"),j=h.has(x);return(0,r.jsxs)("a",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",href:pe(`?file=${encodeURIComponent(x)}`).toString(),target:xe(x),children:[i,(0,r.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",children:[o.data.name,v&&(0,r.jsx)(Z,{className:"ml-2 inline opacity-80"})]}),(0,r.jsx)(Ut,{node:o,isRunning:j}),(0,r.jsx)("div",{className:"w-8 h-8 flex items-center justify-center shrink-0",children:(0,r.jsx)(ye,{filePath:x})}),(0,r.jsx)(Q,{size:20,className:"group-hover:opacity-100 opacity-0 text-primary shrink-0"})]})},e[2]=i,e[3]=o,e[4]=m,e[5]=h,e[6]=p):p=e[6];let u=p,n;e[7]===Symbol.for("react.memo_cache_sentinel")?(n=Me("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group h-full"),e[7]=n):n=e[7];let c,f;e[8]===o?(c=e[9],f=e[10]):(c=x=>{x.stopPropagation(),o.data.isDirectory&&o.toggle()},f=(0,r.jsx)($t,{node:o}),e[8]=o,e[9]=c,e[10]=f);let d;e[11]===u?d=e[12]:(d=u(),e[11]=u,e[12]=d);let y;return e[13]!==s||e[14]!==c||e[15]!==f||e[16]!==d?(y=(0,r.jsxs)("div",{style:s,className:n,onClick:c,children:[f,d]}),e[13]=s,e[14]=c,e[15]=f,e[16]=d,e[17]=y):y=e[17],y},Ut=t=>{let e=(0,W.c)(19),{node:o,isRunning:s}=t,{root:a,refreshWorkspace:l}=(0,P.use)(J),i;e[0]!==o||e[1]!==l||e[2]!==a?(i={node:o,root:a,onAfterChange:l},e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let{handleRename:m,handleDuplicate:h,handleDelete:p}=at(i),u=s?"Stop the notebook's kernel before renaming or deleting.":void 0,n;e[4]!==m||e[5]!==s||e[6]!==u?(n=(0,r.jsx)(Xe,{onSelect:m,disabled:s,title:u}),e[4]=m,e[5]=s,e[6]=u,e[7]=n):n=e[7];let c;e[8]===h?c=e[9]:(c=(0,r.jsx)(ot,{onSelect:h}),e[8]=h,e[9]=c);let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,r.jsx)(De,{}),e[10]=f):f=e[10];let d;e[11]!==p||e[12]!==s||e[13]!==u?(d=(0,r.jsx)(tt,{onSelect:p,disabled:s,title:u}),e[11]=p,e[12]=s,e[13]=u,e[14]=d):d=e[14];let y;return e[15]!==n||e[16]!==c||e[17]!==d?(y=(0,r.jsxs)(Ze,{testId:"workspace-more-button",buttonClassName:"w-8 h-8 p-0 shrink-0",contentClassName:"print:hidden w-fit min-w-[140px]",preventDefaultOnTrigger:!0,children:[n,c,f,d]}),e[15]=n,e[16]=c,e[17]=d,e[18]=y):y=e[18],y},$t=t=>{let e=(0,W.c)(3),{node:o}=t;if(!o.data.isDirectory){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)("span",{className:"w-5 h-5 shrink-0"}),e[0]=a):a=e[0],a}let s;return e[1]===o.isOpen?s=e[2]:(s=o.isOpen?(0,r.jsx)(Ue,{className:"w-5 h-5 shrink-0"}):(0,r.jsx)($e,{className:"w-5 h-5 shrink-0"}),e[1]=o.isOpen,e[2]=s),s},ge=t=>{let e=(0,W.c)(7),{header:o,files:s}=t;if(s.length===0)return null;let a;e[0]===s?a=e[1]:(a=s.map(Gt),e[0]=s,e[1]=a);let l;e[2]===a?l=e[3]:(l=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:a}),e[2]=a,e[3]=l);let i;return e[4]!==o||e[5]!==l?(i=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[o,l]}),e[4]=o,e[5]=l,e[6]=i):i=e[6],i},Ht=t=>{let e=(0,W.c)(41),{file:o}=t,{locale:s}=xt(),a;e[0]===o.path?a=e[1]:(a=ht(o.path),e[0]=o.path,e[1]=a);let l=a,i,m,h,p;if(e[2]!==o.initializationId||e[3]!==o.path||e[4]!==l){let N=pe(l?`?file=${encodeURIComponent(o.initializationId??o.path)}&session_id=${o.path}`:`?file=${encodeURIComponent(o.path)}`),_;e[9]===o.path?_=e[10]:(_=o.path.endsWith(".md"),e[9]=o.path,e[10]=_),i=_,m="py-1.5 px-4 hover:bg-(--blue-2) hover:text-primary transition-all duration-300 cursor-pointer group relative flex gap-4 items-center",h=o.path,p=N.toString(),e[2]=o.initializationId,e[3]=o.path,e[4]=l,e[5]=i,e[6]=m,e[7]=h,e[8]=p}else i=e[5],m=e[6],h=e[7],p=e[8];let u=o.initializationId||o.path,n;e[11]===u?n=e[12]:(n=xe(u),e[11]=u,e[12]=n);let c;e[13]===i?c=e[14]:(c=i&&(0,r.jsx)("span",{className:"opacity-80",children:(0,r.jsx)(Z,{})}),e[13]=i,e[14]=c);let f;e[15]!==o.name||e[16]!==c?(f=(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[o.name,c]}),e[15]=o.name,e[16]=c,e[17]=f):f=e[17];let d;e[18]===o.path?d=e[19]:(d=(0,r.jsx)("p",{title:o.path,className:"text-sm text-muted-foreground overflow-hidden whitespace-nowrap text-ellipsis",children:o.path}),e[18]=o.path,e[19]=d);let y;e[20]!==f||e[21]!==d?(y=(0,r.jsxs)("div",{className:"flex flex-col justify-between flex-1",children:[f,d]}),e[20]=f,e[21]=d,e[22]=y):y=e[22];let x;e[23]===o.path?x=e[24]:(x=(0,r.jsx)("div",{children:(0,r.jsx)(ye,{filePath:o.path})}),e[23]=o.path,e[24]=x);let v;e[25]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(Q,{size:20,className:"group-hover:opacity-100 opacity-0 transition-all duration-300 text-primary"}),e[25]=v):v=e[25];let j;e[26]===x?j=e[27]:(j=(0,r.jsxs)("div",{className:"flex gap-3 items-center",children:[x,v]}),e[26]=x,e[27]=j);let g;e[28]!==o.lastModified||e[29]!==s?(g=!!o.lastModified&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground opacity-80",children:ut(o.lastModified*1e3,s)}),e[28]=o.lastModified,e[29]=s,e[30]=g):g=e[30];let b;e[31]!==j||e[32]!==g?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[j,g]}),e[31]=j,e[32]=g,e[33]=b):b=e[33];let k;return e[34]!==y||e[35]!==b||e[36]!==m||e[37]!==h||e[38]!==p||e[39]!==n?(k=(0,r.jsxs)("a",{className:m,href:p,target:n,children:[y,b]},h),e[34]=y,e[35]=b,e[36]=m,e[37]=h,e[38]=p,e[39]=n,e[40]=k):k=e[40],k},ye=t=>{let e=(0,W.c)(10),{filePath:o}=t,{openConfirm:s,closeModal:a}=gt(),{shutdownSession:l}=Y(),{runningNotebooks:i,setRunningNotebooks:m}=(0,P.use)(te);if(!i.has(o))return null;let h;e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==i||e[4]!==m||e[5]!==l?(h=n=>{n.stopPropagation(),n.preventDefault(),s({title:"Shutdown",description:"This will terminate the Python kernel. You'll lose all data that's in memory.",variant:"destructive",confirmAction:(0,r.jsx)(Re,{onClick:()=>{let c=i.get(o);ve(c==null?void 0:c.sessionId),l({sessionId:c.sessionId}).then(f=>{m(me.keyBy(f.files,Qt))}),a(),de({description:"Notebook has been shutdown."})},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=a,e[1]=o,e[2]=s,e[3]=i,e[4]=m,e[5]=l,e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)(lt,{size:14}),e[7]=p):p=e[7];let u;return e[8]===h?u=e[9]:(u=(0,r.jsx)(Ae,{content:"Shutdown",children:(0,r.jsx)(B,{size:"icon",variant:"outline",className:"opacity-80 hover:opacity-100 hover:bg-accent text-destructive border-destructive hover:border-destructive hover:text-destructive bg-background hover:bg-(--red-1)",onClick:h,children:p})}),e[8]=h,e[9]=u),u},Vt=()=>{let t=(0,W.c)(3),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=pt(),t[0]=e):e=t[0];let o=e,s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Create a new notebook"}),t[1]=s):s=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsxs)("a",{className:`relative rounded-lg p-6 group
2
2
  text-primary hover:bg-(--blue-2) shadow-md-solid shadow-accent border bg-(--blue-1)
3
3
  transition-all duration-300 cursor-pointer
4
4
  `,href:o,target:"_blank",rel:"noreferrer",children:[s,(0,r.jsx)("div",{className:"group-hover:opacity-100 opacity-0 absolute right-5 top-0 bottom-0 rounded-lg flex items-center justify-center transition-all duration-300",children:(0,r.jsx)(Q,{size:24})})]}),t[2]=a):a=t[2],a},Et=Tt;function Bt(t){return t+1}function Yt(t){return t.path}function qt(t){return t.path}function Jt(){return null}function Gt(t){return(0,r.jsx)(Ht,{file:t},t.path)}function Qt(t){return t.path}export{Et as default};
@@ -1 +1 @@
1
- var O=Object.defineProperty;var V=(t,e,i)=>e in t?O(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var b=(t,e,i)=>V(t,typeof e!="symbol"?e+"":e,i);import{u as k}from"./useEvent-D91BmmQi.js";import{o as j}from"./cells-CJlo_hG2.js";import{t as T}from"./compiler-runtime-B3qBwwSJ.js";import{_ as I,d as E}from"./useEventListener-BR0C1MaI.js";import{i as _}from"./utils-DIGrmLDO.js";import{h as N,x as P}from"./config-ChCHm539.js";import{s as z,u as D}from"./download-mzsKQgiy.js";import{r as $}from"./requests-DIwGYs0l.js";import{k as B}from"./layout-lxwMDUgI.js";import{t as H}from"./Deferred-DxQeE5uh.js";import{t as L}from"./use-toast-BDYuj3zG.js";import{t as x}from"./useInterval-CG264TRB.js";var R=class{constructor(){b(this,"capturedInputs",new Map);b(this,"inFlight",new Map)}cancelEntry(t){t.controller.abort(),t.deferred.status==="pending"&&t.deferred.resolve(void 0)}needsCapture(t,e){if(this.capturedInputs.get(t)===e)return!1;let i=this.inFlight.get(t);return!(i&&i.inputValue===e)}waitForInFlight(t,e){let i=this.inFlight.get(t);return i&&i.inputValue===e?i.deferred.promise:null}startCapture(t,e){let i=this.inFlight.get(t);i&&this.cancelEntry(i);let n=new AbortController,l=new H,u={controller:n,inputValue:e,deferred:l};return this.inFlight.set(t,u),{signal:n.signal,markCaptured:p=>{this.inFlight.get(t)===u&&(l.resolve(p),this.capturedInputs.set(t,e),this.inFlight.delete(t))},markFailed:()=>{this.inFlight.get(t)===u&&(l.resolve(void 0),this.inFlight.delete(t))}}}prune(t){for(let e of this.capturedInputs.keys())t.has(e)||this.capturedInputs.delete(e);for(let[e,i]of this.inFlight)t.has(e)||(this.cancelEntry(i),this.inFlight.delete(e))}get isCapturing(){return this.inFlight.size>0}abort(){for(let t of this.inFlight.values())this.cancelEntry(t);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},Y=T(),M=5e3;function q(){let t=(0,Y.c)(14),e=k(_),{state:i}=k(N),n=e.auto_download.includes("markdown"),l=e.auto_download.includes("html"),u=e.auto_download.includes("ipynb"),p=i===P.OPEN,m=!n||!p,d=!l||!p,h=!u||!p,{autoExportAsHTML:a,autoExportAsIPYNB:s,autoExportAsMarkdown:r,updateCellOutputs:o}=$(),c=S(),f;t[0]===r?f=t[1]:(f=async()=>{await r({download:!1})},t[0]=r,t[1]=f);let g;t[2]===m?g=t[3]:(g={delayMs:M,whenVisible:!0,disabled:m},t[2]=m,t[3]=g),x(f,g);let w;t[4]===a?w=t[5]:(w=async()=>{await a({download:!1,includeCode:!0,files:B.INSTANCE.filenames()})},t[4]=a,t[5]=w);let v;t[6]===d?v=t[7]:(v={delayMs:M,whenVisible:!0,disabled:d},t[6]=d,t[7]=v),x(w,v);let F;t[8]!==s||t[9]!==c||t[10]!==o?(F=async()=>{await A({takeScreenshots:()=>c({progress:D.indeterminate()}),updateCellOutputs:o}),await s({download:!1})},t[8]=s,t[9]=c,t[10]=o,t[11]=F):F=t[11];let y;t[12]===h?y=t[13]:(y={delayMs:M,whenVisible:!0,disabled:h,skipIfRunning:!0},t[12]=h,t[13]=y),x(F,y)}var G=new Set(["text/html","application/vnd.vegalite.v5+json","application/vnd.vega.v5+json","application/vnd.vegalite.v6+json","application/vnd.vega.v6+json"]);const C=new R;function S(){let t=k(j);return async e=>{var d,h;let{progress:i}=e,n=new Set(E.keys(t));C.prune(n);let l=[],u=[];for(let[a,s]of E.entries(t)){let r=(d=s.output)==null?void 0:d.data;if((h=s.output)!=null&&h.mimetype&&G.has(s.output.mimetype)&&r)if(C.needsCapture(a,r))l.push([a,r]);else{let o=C.waitForInFlight(a,r);o&&u.push({cellId:a,promise:o})}}if(l.length===0&&u.length===0)return{};l.length>0&&i.addTotal(l.length);let p={};for(let[a,s]of l){let r=C.startCapture(a,s);try{let o=await z(a);if(r.signal.aborted)continue;if(!o){I.error(`Failed to capture screenshot for cell ${a}`),r.markFailed();continue}let c=["image/png",o];p[a]=c,r.markCaptured(c)}catch(o){I.error(`Error screenshotting cell ${a}:`,o),r.markFailed()}finally{i.increment(1)}}let m=await Promise.allSettled(u.map(({promise:a})=>a));for(let[a,{cellId:s}]of u.entries()){let r=m[a];r.status==="fulfilled"&&r.value&&(p[s]=r.value)}return p}}async function A(t){let{takeScreenshots:e,updateCellOutputs:i}=t;try{let n=await e();E.size(n)>0&&await i({cellIdsToOutput:n})}catch(n){I.error("Error updating cell outputs with screenshots:",n),L({title:"Failed to capture cell outputs",description:"Some outputs may not appear in the PDF. Continuing with export.",variant:"danger"})}}export{q as n,S as r,A as t};
1
+ var O=Object.defineProperty;var V=(t,e,i)=>e in t?O(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var b=(t,e,i)=>V(t,typeof e!="symbol"?e+"":e,i);import{u as k}from"./useEvent-D91BmmQi.js";import{o as j}from"./cells-A-ljPpuj.js";import{t as T}from"./compiler-runtime-B3qBwwSJ.js";import{_ as I,d as E}from"./useEventListener-BR0C1MaI.js";import{i as _}from"./utils-DIGrmLDO.js";import{h as N,x as P}from"./config-ChCHm539.js";import{s as z,u as D}from"./download-Iyng0xCz.js";import{r as $}from"./requests-DIwGYs0l.js";import{k as B}from"./layout-DDh3d8oW.js";import{t as H}from"./Deferred-DxQeE5uh.js";import{t as L}from"./use-toast-BDYuj3zG.js";import{t as x}from"./useInterval-CG264TRB.js";var R=class{constructor(){b(this,"capturedInputs",new Map);b(this,"inFlight",new Map)}cancelEntry(t){t.controller.abort(),t.deferred.status==="pending"&&t.deferred.resolve(void 0)}needsCapture(t,e){if(this.capturedInputs.get(t)===e)return!1;let i=this.inFlight.get(t);return!(i&&i.inputValue===e)}waitForInFlight(t,e){let i=this.inFlight.get(t);return i&&i.inputValue===e?i.deferred.promise:null}startCapture(t,e){let i=this.inFlight.get(t);i&&this.cancelEntry(i);let n=new AbortController,l=new H,u={controller:n,inputValue:e,deferred:l};return this.inFlight.set(t,u),{signal:n.signal,markCaptured:p=>{this.inFlight.get(t)===u&&(l.resolve(p),this.capturedInputs.set(t,e),this.inFlight.delete(t))},markFailed:()=>{this.inFlight.get(t)===u&&(l.resolve(void 0),this.inFlight.delete(t))}}}prune(t){for(let e of this.capturedInputs.keys())t.has(e)||this.capturedInputs.delete(e);for(let[e,i]of this.inFlight)t.has(e)||(this.cancelEntry(i),this.inFlight.delete(e))}get isCapturing(){return this.inFlight.size>0}abort(){for(let t of this.inFlight.values())this.cancelEntry(t);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},Y=T(),M=5e3;function q(){let t=(0,Y.c)(14),e=k(_),{state:i}=k(N),n=e.auto_download.includes("markdown"),l=e.auto_download.includes("html"),u=e.auto_download.includes("ipynb"),p=i===P.OPEN,m=!n||!p,d=!l||!p,h=!u||!p,{autoExportAsHTML:a,autoExportAsIPYNB:s,autoExportAsMarkdown:r,updateCellOutputs:o}=$(),c=S(),f;t[0]===r?f=t[1]:(f=async()=>{await r({download:!1})},t[0]=r,t[1]=f);let g;t[2]===m?g=t[3]:(g={delayMs:M,whenVisible:!0,disabled:m},t[2]=m,t[3]=g),x(f,g);let w;t[4]===a?w=t[5]:(w=async()=>{await a({download:!1,includeCode:!0,files:B.INSTANCE.filenames()})},t[4]=a,t[5]=w);let v;t[6]===d?v=t[7]:(v={delayMs:M,whenVisible:!0,disabled:d},t[6]=d,t[7]=v),x(w,v);let F;t[8]!==s||t[9]!==c||t[10]!==o?(F=async()=>{await A({takeScreenshots:()=>c({progress:D.indeterminate()}),updateCellOutputs:o}),await s({download:!1})},t[8]=s,t[9]=c,t[10]=o,t[11]=F):F=t[11];let y;t[12]===h?y=t[13]:(y={delayMs:M,whenVisible:!0,disabled:h,skipIfRunning:!0},t[12]=h,t[13]=y),x(F,y)}var G=new Set(["text/html","application/vnd.vegalite.v5+json","application/vnd.vega.v5+json","application/vnd.vegalite.v6+json","application/vnd.vega.v6+json"]);const C=new R;function S(){let t=k(j);return async e=>{var d,h;let{progress:i}=e,n=new Set(E.keys(t));C.prune(n);let l=[],u=[];for(let[a,s]of E.entries(t)){let r=(d=s.output)==null?void 0:d.data;if((h=s.output)!=null&&h.mimetype&&G.has(s.output.mimetype)&&r)if(C.needsCapture(a,r))l.push([a,r]);else{let o=C.waitForInFlight(a,r);o&&u.push({cellId:a,promise:o})}}if(l.length===0&&u.length===0)return{};l.length>0&&i.addTotal(l.length);let p={};for(let[a,s]of l){let r=C.startCapture(a,s);try{let o=await z(a);if(r.signal.aborted)continue;if(!o){I.error(`Failed to capture screenshot for cell ${a}`),r.markFailed();continue}let c=["image/png",o];p[a]=c,r.markCaptured(c)}catch(o){I.error(`Error screenshotting cell ${a}:`,o),r.markFailed()}finally{i.increment(1)}}let m=await Promise.allSettled(u.map(({promise:a})=>a));for(let[a,{cellId:s}]of u.entries()){let r=m[a];r.status==="fulfilled"&&r.value&&(p[s]=r.value)}return p}}async function A(t){let{takeScreenshots:e,updateCellOutputs:i}=t;try{let n=await e();E.size(n)>0&&await i({cellIdsToOutput:n})}catch(n){I.error("Error updating cell outputs with screenshots:",n),L({title:"Failed to capture cell outputs",description:"Some outputs may not appear in the PDF. Continuing with export.",variant:"danger"})}}export{q as n,S as r,A as t};