@marimo-team/frontend 0.23.9-dev3 → 0.23.9-dev4

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 (108) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-D-boDGAP.js → ConnectedDataExplorerComponent-B-cElX-s.js} +1 -1
  2. package/dist/assets/{ImperativeModal-DEC1mXgV.js → ImperativeModal-BeQmePpG.js} +1 -1
  3. package/dist/assets/JsonOutput-BbkJ4c02.js +53 -0
  4. package/dist/assets/{MarimoErrorOutput-XWqnhvJ6.js → MarimoErrorOutput-ciRhjJM2.js} +1 -1
  5. package/dist/assets/{RSPContexts-Bk1r00gJ.js → RSPContexts-Clr6RnG2.js} +1 -1
  6. package/dist/assets/{RunButton-Dbak5hfa.js → RunButton-DySeQPd2.js} +1 -1
  7. package/dist/assets/{add-cell-with-ai-BbZkMqv2.js → add-cell-with-ai-DKUeTe86.js} +1 -1
  8. package/dist/assets/{add-connection-dialog-CzxRpS5F.js → add-connection-dialog-DwDtRq10.js} +1 -1
  9. package/dist/assets/{agent-panel-zPhlhkYL.js → agent-panel-C8Oqvdr5.js} +1 -1
  10. package/dist/assets/{ai-model-dropdown-CjhUqXgj.js → ai-model-dropdown-Cv4r0gqY.js} +1 -1
  11. package/dist/assets/{app-config-button-CCs8Jepz.js → app-config-button-rS9K4BOr.js} +1 -1
  12. package/dist/assets/{cache-panel-VL13fWgF.js → cache-panel-BSlEbX4w.js} +1 -1
  13. package/dist/assets/{cell-editor-ODyJXDT8.js → cell-editor-DnLtTvEM.js} +3 -3
  14. package/dist/assets/{cell-link-PQYiMZw1.js → cell-link-f3ZU0MzW.js} +1 -1
  15. package/dist/assets/{chat-display-DetTBnqK.js → chat-display-B7QE6C2q.js} +1 -1
  16. package/dist/assets/{chat-panel-CEgw_vg0.js → chat-panel-D11B2Q4F.js} +1 -1
  17. package/dist/assets/{chat-ui-D-Y7p_cT.js → chat-ui-BwVhfsq2.js} +1 -1
  18. package/dist/assets/{chunk-5FQGJX7Z-BSzccEgu.js → chunk-5FQGJX7Z-CbuGydc8.js} +3 -3
  19. package/dist/assets/{code-block-37QAKDTI-U2R1jyOo.js → code-block-37QAKDTI-BwYRrSJW.js} +1 -1
  20. package/dist/assets/{column-preview-BLIWbdOX.js → column-preview-8cXBINr1.js} +1 -1
  21. package/dist/assets/command-DUeag2QH.js +1 -0
  22. package/dist/assets/{command-palette-CeDe63_W.js → command-palette-BlX5QV4R.js} +1 -1
  23. package/dist/assets/{common-BaBE_ygg.js → common-DAjN54-N.js} +1 -1
  24. package/dist/assets/dates-DS_7IZoI.js +1 -0
  25. package/dist/assets/{dependency-graph-panel-ClI5byUa.js → dependency-graph-panel-C7UdKk5P.js} +1 -1
  26. package/dist/assets/{dist-CW3rweKM.js → dist-DFHp_ZJR.js} +1 -1
  27. package/dist/assets/{download-B1QFVDP-.js → download-eMMt69Hd.js} +1 -1
  28. package/dist/assets/{edit-page-ZFpn8-WM.js → edit-page-DoGaZtlD.js} +6 -6
  29. package/dist/assets/{error-panel-iXznkJZ1.js → error-panel-CkKXrRna.js} +1 -1
  30. package/dist/assets/{field-DNlzfMKW.js → field-B4CdIHa9.js} +1 -1
  31. package/dist/assets/{file-explorer-panel-BVBKF1SH.js → file-explorer-panel-BA0aI_q7.js} +3 -3
  32. package/dist/assets/{file-name-input-g2H2sY2h.js → file-name-input-BpDnZMOs.js} +1 -1
  33. package/dist/assets/{form-BjUJP6PJ.js → form-z4S7B_rP.js} +1 -1
  34. package/dist/assets/{gallery-page-MrZHjySE.js → gallery-page-BXZHpNqZ.js} +1 -1
  35. package/dist/assets/{glide-data-editor-4Wql6uq7.js → glide-data-editor-C5d_9QYv.js} +1 -1
  36. package/dist/assets/{home-page-De1W6q6f.js → home-page-Cv2KTtQj.js} +1 -1
  37. package/dist/assets/{hooks-jWLD3t7P.js → hooks-DeuLZEyD.js} +1 -1
  38. package/dist/assets/{index-ZA7t2ThT.js → index-B5z1LmJ1.js} +19 -19
  39. package/dist/assets/index-Cn0RBoFD.css +2 -0
  40. package/dist/assets/{input-CVE-gIjt.js → input-TSilD7AA.js} +1 -1
  41. package/dist/assets/{layout-DEU6lX-9.js → layout-Dpf6l72t.js} +3 -3
  42. package/dist/assets/{logs-panel-BMAfoMJg.js → logs-panel-D6VqVLlw.js} +1 -1
  43. package/dist/assets/{markdown-renderer-BQ-BQLiJ.js → markdown-renderer-l3qZKrTC.js} +3 -3
  44. package/dist/assets/mermaid-4DMBBIKO-BlSTFoRU.js +1 -0
  45. package/dist/assets/{mermaid-CZhfODkT.js → mermaid-BpEU2haB.js} +1 -1
  46. package/dist/assets/{name-cell-input-bwfAyC0i.js → name-cell-input-BmJb1jcI.js} +1 -1
  47. package/dist/assets/{packages-panel-B3dRYuRM.js → packages-panel-BQJiodre.js} +1 -1
  48. package/dist/assets/{panels-DWhhEgv4.js → panels-EIGgrBT7.js} +1 -1
  49. package/dist/assets/{radio-group-rsi1ibXY.js → radio-group-BE0Xe9G9.js} +1 -1
  50. package/dist/assets/{readonly-python-code-BKYj8PNf.js → readonly-python-code-D3NHaVFs.js} +1 -1
  51. package/dist/assets/{reveal-component-DNpBzX6F.js → reveal-component-Cy-Nz7JR.js} +1 -1
  52. package/dist/assets/{run-page-CO2X6wso.js → run-page-IrSzOAx3.js} +1 -1
  53. package/dist/assets/{scratchpad-panel-CWfddArs.js → scratchpad-panel-DVSB-2ZU.js} +1 -1
  54. package/dist/assets/{secrets-panel-DqHGq3V8.js → secrets-panel-EMyfZ0xi.js} +1 -1
  55. package/dist/assets/{session-panel-BP0QxaoM.js → session-panel-BSP3VdpL.js} +1 -1
  56. package/dist/assets/{snippets-panel-DFJd1ui5.js → snippets-panel-WZ7ZOs2t.js} +1 -1
  57. package/dist/assets/{state-dx303w7J.js → state-CcAGAozT.js} +1 -1
  58. package/dist/assets/{state-BXNNuw9g.js → state-KI8ENp1g.js} +1 -1
  59. package/dist/assets/{tracing-BQU8fBDM.js → tracing-CXaM8i7_.js} +1 -1
  60. package/dist/assets/{tracing-panel-DEVpyGX3.js → tracing-panel-DcR9ni3B.js} +2 -2
  61. package/dist/assets/{useCellActionButton-QaDO24oW.js → useCellActionButton-p6Ij9yyu.js} +1 -1
  62. package/dist/assets/{useDependencyPanelTab-BB_XeSAg.js → useDependencyPanelTab-KDzMTAUI.js} +1 -1
  63. package/dist/assets/{useNotebookActions-CJEicFed.js → useNotebookActions-COhd0Ld9.js} +1 -1
  64. package/dist/assets/{vega-component-C9fDGx86.js → vega-component-BGC-ewWV.js} +1 -1
  65. package/dist/assets/{write-secret-modal-Liv_9MXS.js → write-secret-modal-DcmyNRRr.js} +1 -1
  66. package/dist/index.html +27 -27
  67. package/package.json +1 -1
  68. package/src/components/data-table/__tests__/column-header.test.tsx +110 -277
  69. package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +33 -0
  70. package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +75 -38
  71. package/src/components/data-table/__tests__/filter-pills.test.tsx +287 -0
  72. package/src/components/data-table/__tests__/filter-test-utils.ts +47 -0
  73. package/src/components/data-table/__tests__/filters.test.ts +5 -5
  74. package/src/components/data-table/add-filter-button.tsx +85 -0
  75. package/src/components/data-table/column-header.tsx +92 -691
  76. package/src/components/data-table/context-menu.tsx +26 -12
  77. package/src/components/data-table/data-table.tsx +89 -57
  78. package/src/components/data-table/date-filter-inputs.tsx +13 -10
  79. package/src/components/data-table/filter-by-values-picker.tsx +13 -19
  80. package/src/components/data-table/filter-editor-context.tsx +34 -0
  81. package/src/components/data-table/filter-pill-editor.tsx +152 -175
  82. package/src/components/data-table/filter-pills.tsx +190 -153
  83. package/src/components/data-table/filters/builders.ts +102 -0
  84. package/src/components/data-table/filters/defaults.ts +31 -0
  85. package/src/components/data-table/filters/format.ts +131 -0
  86. package/src/components/data-table/filters/guards.ts +51 -0
  87. package/src/components/data-table/filters/index.ts +7 -0
  88. package/src/components/data-table/filters/operators.ts +76 -0
  89. package/src/components/data-table/filters/serialize.ts +186 -0
  90. package/src/components/data-table/filters/types.ts +33 -0
  91. package/src/components/data-table/header-items.tsx +6 -83
  92. package/src/components/data-table/value-chips.tsx +52 -0
  93. package/src/components/ui/number-field.tsx +13 -1
  94. package/src/utils/dates.ts +39 -0
  95. package/dist/assets/JsonOutput-05-R3eil.js +0 -53
  96. package/dist/assets/command-2NPJCYDa.js +0 -1
  97. package/dist/assets/dates-DI1TvEEK.js +0 -1
  98. package/dist/assets/index-B30qjBZM.css +0 -2
  99. package/dist/assets/mermaid-4DMBBIKO-C0OyyVdo.js +0 -1
  100. package/src/components/data-table/__tests__/column-header.test.ts +0 -65
  101. package/src/components/data-table/filters.ts +0 -386
  102. /package/dist/assets/{focus-BaOnnMs-.js → focus-BLb-92ed.js} +0 -0
  103. /package/dist/assets/{formats-BRq458WH.js → formats-DP_z0P-n.js} +0 -0
  104. /package/dist/assets/{html-to-image-D6SgvARi.js → html-to-image-Ctd6Wpty.js} +0 -0
  105. /package/dist/assets/{micromark-factory-space-BUQpMdx2.js → micromark-factory-space-bqhKsQDn.js} +0 -0
  106. /package/dist/assets/{react-resizable-panels.browser.esm-Ce2ksurd.js → react-resizable-panels.browser.esm-BdtIs0E-.js} +0 -0
  107. /package/dist/assets/{table-DQE9hQzM.js → table-Bgc-inJs.js} +0 -0
  108. /package/dist/assets/{useAsyncData-C5i0IRVM.js → useAsyncData-Dg8E_bPh.js} +0 -0
@@ -1 +1 @@
1
- import{s as i}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as l}from"./react-Bj1aDYRI.js";import{A as a}from"./cells-Dnu4nDoy.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-eipL3i3Y.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-XWqnhvJ6.js";import"./dist-DCqxOggh.js";import"./dist-BZr6MMV-.js";import"./dist-BU26XwgJ.js";import"./dist-COs9gIu5.js";import"./dist-DkA__6UI.js";import"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import{n as f}from"./cell-link-PQYiMZw1.js";import{t as n}from"./empty-state-CcobJSnG.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{A as a}from"./cells-Dnu4nDoy.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-eipL3i3Y.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-ciRhjJM2.js";import"./dist-DCqxOggh.js";import"./dist-BZr6MMV-.js";import"./dist-BU26XwgJ.js";import"./dist-COs9gIu5.js";import"./dist-DkA__6UI.js";import"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import{n as f}from"./cell-link-f3ZU0MzW.js";import{t as n}from"./empty-state-CcobJSnG.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 +1 @@
1
- import{s as p}from"./chunk-LvLJmgfZ.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{n as u,t as l}from"./cn-DCUzRj2J.js";import{t as g}from"./jsx-runtime-BqBOg78p.js";import{u as v}from"./select-DZcFyKFQ.js";import{E as b,f as h,l as N,m as w,y as j}from"./input-CVE-gIjt.js";var d=x(),m=p(g(),1),y=u(["text-sm font-medium leading-none","data-disabled:cursor-not-allowed data-disabled:opacity-70","group-data-invalid:text-destructive"]),k=i=>{let t=(0,d.c)(8),a,e;t[0]===i?(a=t[1],e=t[2]):({className:a,...e}=i,t[0]=i,t[1]=a,t[2]=e);let s;t[3]===a?s=t[4]:(s=l(y(),a),t[3]=a,t[4]=s);let r;return t[5]!==e||t[6]!==s?(r=(0,m.jsx)(j,{className:s,...e}),t[5]=e,t[6]=s,t[7]=r):r=t[7],r},E=i=>{let t=(0,d.c)(8),a,e;t[0]===i?(a=t[1],e=t[2]):({className:a,...e}=i,t[0]=i,t[1]=a,t[2]=e);let s;t[3]===a?s=t[4]:(s=l("text-sm text-muted-foreground",a),t[3]=a,t[4]=s);let r;return t[5]!==e||t[6]!==s?(r=(0,m.jsx)(w,{className:s,...e,slot:"description"}),t[5]=e,t[6]=s,t[7]=r):r=t[7],r},V=i=>{let t=(0,d.c)(8),a,e;t[0]===i?(a=t[1],e=t[2]):({className:a,...e}=i,t[0]=i,t[1]=a,t[2]=e);let s;t[3]===a?s=t[4]:(s=l("text-sm font-medium text-destructive",a),t[3]=a,t[4]=s);let r;return t[5]!==e||t[6]!==s?(r=(0,m.jsx)(h,{className:s,...e}),t[5]=e,t[6]=s,t[7]=r):r=t[7],r},c=u("",{variants:{variant:{default:["relative flex w-full items-center overflow-hidden rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",v(),"data-focus-within:outline-hidden data-focus-within:ring-2 data-focus-within:ring-ring data-focus-within:ring-offset-2","data-disabled:opacity-50"],ghost:""}},defaultVariants:{variant:"default"}}),_=i=>{let t=(0,d.c)(12),a,e,s;t[0]===i?(a=t[1],e=t[2],s=t[3]):({className:a,variant:s,...e}=i,t[0]=i,t[1]=a,t[2]=e,t[3]=s);let r;t[4]===s?r=t[5]:(r=f=>l(c({variant:s}),f),t[4]=s,t[5]=r);let o;t[6]!==a||t[7]!==r?(o=b(a,r),t[6]=a,t[7]=r,t[8]=o):o=t[8];let n;return t[9]!==e||t[10]!==o?(n=(0,m.jsx)(N,{className:o,...e}),t[9]=e,t[10]=o,t[11]=n):n=t[11],n};export{c as a,k as i,_ as n,E as r,V as t};
1
+ import{s as p}from"./chunk-LvLJmgfZ.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{n as u,t as l}from"./cn-DCUzRj2J.js";import{t as g}from"./jsx-runtime-BqBOg78p.js";import{u as v}from"./select-DZcFyKFQ.js";import{E as b,f as h,l as N,m as w,y as j}from"./input-TSilD7AA.js";var d=x(),m=p(g(),1),y=u(["text-sm font-medium leading-none","data-disabled:cursor-not-allowed data-disabled:opacity-70","group-data-invalid:text-destructive"]),k=i=>{let t=(0,d.c)(8),a,e;t[0]===i?(a=t[1],e=t[2]):({className:a,...e}=i,t[0]=i,t[1]=a,t[2]=e);let s;t[3]===a?s=t[4]:(s=l(y(),a),t[3]=a,t[4]=s);let r;return t[5]!==e||t[6]!==s?(r=(0,m.jsx)(j,{className:s,...e}),t[5]=e,t[6]=s,t[7]=r):r=t[7],r},E=i=>{let t=(0,d.c)(8),a,e;t[0]===i?(a=t[1],e=t[2]):({className:a,...e}=i,t[0]=i,t[1]=a,t[2]=e);let s;t[3]===a?s=t[4]:(s=l("text-sm text-muted-foreground",a),t[3]=a,t[4]=s);let r;return t[5]!==e||t[6]!==s?(r=(0,m.jsx)(w,{className:s,...e,slot:"description"}),t[5]=e,t[6]=s,t[7]=r):r=t[7],r},V=i=>{let t=(0,d.c)(8),a,e;t[0]===i?(a=t[1],e=t[2]):({className:a,...e}=i,t[0]=i,t[1]=a,t[2]=e);let s;t[3]===a?s=t[4]:(s=l("text-sm font-medium text-destructive",a),t[3]=a,t[4]=s);let r;return t[5]!==e||t[6]!==s?(r=(0,m.jsx)(h,{className:s,...e}),t[5]=e,t[6]=s,t[7]=r):r=t[7],r},c=u("",{variants:{variant:{default:["relative flex w-full items-center overflow-hidden rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",v(),"data-focus-within:outline-hidden data-focus-within:ring-2 data-focus-within:ring-ring data-focus-within:ring-offset-2","data-disabled:opacity-50"],ghost:""}},defaultVariants:{variant:"default"}}),_=i=>{let t=(0,d.c)(12),a,e,s;t[0]===i?(a=t[1],e=t[2],s=t[3]):({className:a,variant:s,...e}=i,t[0]=i,t[1]=a,t[2]=e,t[3]=s);let r;t[4]===s?r=t[5]:(r=f=>l(c({variant:s}),f),t[4]=s,t[5]=r);let o;t[6]!==a||t[7]!==r?(o=b(a,r),t[6]=a,t[7]=r,t[8]=o):o=t[8];let n;return t[9]!==e||t[10]!==o?(n=(0,m.jsx)(N,{className:o,...e}),t[9]=e,t[10]=o,t[11]=n):n=t[11],n};export{c as a,k as i,_ as n,E as r,V as t};
@@ -1,4 +1,4 @@
1
- import{s as qe}from"./chunk-LvLJmgfZ.js";import{i as It,l as ke,n as ee,p as Ue,u as ye}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{D as Rt,Fn as We,Oi as Ge,vr as Et,wi as Ht,wr as Vt}from"./cells-Dnu4nDoy.js";import"./react-dom-CSu739Rf.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{_ as Me}from"./useEventListener-DvoEXWke.js";import{t as Lt}from"./invariant-BUdrueMv.js";import{p as Bt,u as Ke}from"./utils-Wvjk_Y4h.js";import{T as Fe}from"./config-C2lTvbuU.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as qt}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{n as Ut}from"./multi-map-CUuNtzHt.js";import{o as Wt}from"./alert-dialog-BqFLkbUc.js";import"./popover-Bz_0Vkyf.js";import{a as E,c as ue,p as Gt,r as Kt,t as Jt}from"./dropdown-menu-CR7cnzLX.js";import{St as De,a as Yt,i as Je,o as _e}from"./JsonOutput-05-R3eil.js";import{c as Xt,i as ze,r as Se}from"./download-B1QFVDP-.js";import{r as Ye}from"./radio-group-rsi1ibXY.js";import{t as H}from"./tooltip-DTV9tlSr.js";import{n as Zt,t as A}from"./button-BbCh-29a.js";import{St as Qt}from"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{n as ea,r as Pe}from"./requests-DIwGYs0l.js";import{t as re}from"./createLucideIcon-D5guW7EU.js";import{a as Xe,c as Ze,i as Qe,n as Ce,o as Te,r as ta,t as aa}from"./state-dx303w7J.js";import{n as na}from"./LazyAnyLanguageCodeMirror-GdhQ07zA.js";import{t as ra}from"./x-C-6liIBr.js";import{n as Oe}from"./markdown-renderer-BQ-BQLiJ.js";import{u as sa}from"./toDate-B5A0DFEz.js";import{t as et}from"./copy-BwrPA9zQ.js";import{t as $e}from"./external-link-BTNxSavU.js";import{t as la}from"./eye-off-BT-KOYV5.js";import{a as oa,i as tt,n as at,r as ia,t as ca}from"./file-icons-B6DaZdP0.js";import{t as nt}from"./file-HTLbeC2b.js";import{i as rt,r as da,t as st}from"./add-connection-dialog-CzxRpS5F.js";import{n as Ie,t as ma}from"./spinner-UuZAUjoP.js";import{a as pa,c as ha,d as xa,f as fa,i as ua,l as ya,n as ja,r as ga,t as ba,u as va}from"./file-name-input-g2H2sY2h.js";import{t as lt}from"./plus-CxkHs8QM.js";import{t as ot}from"./refresh-cw-a_9k9BK7.js";import{t as wa}from"./save-DZ5aail6.js";import{t as Na}from"./triangle-alert-CJ0ZIqcz.js";import{n as ka,t as Fa}from"./es-au8YY-8E.js";import"./dist-DCqxOggh.js";import"./dist-BZr6MMV-.js";import"./dist-BU26XwgJ.js";import"./dist-COs9gIu5.js";import"./dist-DkA__6UI.js";import{t as te}from"./use-toast-ERM44-k9.js";import{t as _a}from"./paths-SFhaqGlE.js";import"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import"./dates-DI1TvEEK.js";import{n as je}from"./copy-Ch48HVPK.js";import{t as Sa}from"./copy-icon-BdZPgXgo.js";import{t as it}from"./context-C1Tm_47t.js";import{n as ct}from"./ImperativeModal-DEC1mXgV.js";import{t as dt}from"./blob-3_FN0u9S.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{n as Ca,t as Ma}from"./alert-DrHguQlr.js";import{n as mt}from"./error-banner-CLO6LFll.js";import{n as Ae}from"./useAsyncData-C5i0IRVM.js";import{a as Da,o as pt,t as za,u as Pa}from"./command-2NPJCYDa.js";import"./chunk-5FQGJX7Z-BSzccEgu.js";import"./html-to-image-D6SgvARi.js";import{o as Ta}from"./focus-BaOnnMs-.js";import"./react-resizable-panels.browser.esm-Ce2ksurd.js";import{a as Oa}from"./renderShortcut-DK-VjfaX.js";import{t as $a}from"./bundle.esm-BXIlAZ6T.js";import{i as Re,n as Ia,r as ht,t as ge}from"./tree-actions-DY8FUp3V.js";import{a as Aa}from"./components-zB5yT_R8.js";import{n as Ra}from"./pathUtils-vgBYIo5B.js";import{n as Ea}from"./semaphore-X3ApuO41.js";import{t as Ha}from"./empty-state-CcobJSnG.js";import{t as Ee}from"./formatting-XTtGIhGk.js";import{a as Va,i as La,n as xt,r as ft,t as ut}from"./components-CvGaLA5d.js";import{n as yt,t as Ba}from"./marimo-icons-CUuBQ0ae.js";import{t as qa}from"./links-Av1BIe0O.js";var Ua=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"}]]),Wa=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"}]]),Ga=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"}]]),Ka=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"}]]),$=qe(At(),1),Ja=fe(),a=qe(qt(),1);const wt=t=>{let e=(0,Ja.c)(17),{filename:n,filenameIcon:i,onBack:o,onRefresh:r,onDownload:d,actions:c}=t,x;e[0]===o?x=e[1]:(x=o&&(0,a.jsx)(H,{content:"Back to file list",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:o,children:(0,a.jsx)(Ze,{className:"h-4 w-4"})})}),e[0]=o,e[1]=x);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)(H,{content:"Refresh",children:(0,a.jsx)(A,{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 m;e[7]===d?m=e[8]:(m=d&&(0,a.jsx)(H,{content:"Download",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:d,children:(0,a.jsx)(De,{className:"h-3.5 w-3.5"})})}),e[7]=d,e[8]=m);let f;e[9]!==c||e[10]!==y||e[11]!==m?(f=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[y,c,m]}),e[9]=c,e[10]=y,e[11]=m,e[12]=f):f=e[12];let u;return e[13]!==x||e[14]!==s||e[15]!==f?(u=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[x,s,f]}),e[13]=x,e[14]=s,e[15]=f,e[16]=u):u=e[16],u};var Ya=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:Ua,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 It,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{D as Rt,Fn as We,Oi as Ge,vr as Et,wi as Ht,wr as Vt}from"./cells-Dnu4nDoy.js";import"./react-dom-CSu739Rf.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{_ as Me}from"./useEventListener-DvoEXWke.js";import{t as Lt}from"./invariant-BUdrueMv.js";import{p as Bt,u as Ke}from"./utils-Wvjk_Y4h.js";import{T as Fe}from"./config-C2lTvbuU.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as qt}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{n as Ut}from"./multi-map-CUuNtzHt.js";import{o as Wt}from"./alert-dialog-BqFLkbUc.js";import"./popover-Bz_0Vkyf.js";import{a as E,c as ue,p as Gt,r as Kt,t as Jt}from"./dropdown-menu-CR7cnzLX.js";import{St as De,a as Yt,i as Je,o as _e}from"./JsonOutput-BbkJ4c02.js";import{c as Xt,i as ze,r as Se}from"./download-eMMt69Hd.js";import{r as Ye}from"./radio-group-BE0Xe9G9.js";import{t as H}from"./tooltip-DTV9tlSr.js";import{n as Zt,t as A}from"./button-BbCh-29a.js";import{St as Qt}from"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{n as ea,r as Pe}from"./requests-DIwGYs0l.js";import{t as re}from"./createLucideIcon-D5guW7EU.js";import{a as Xe,c as Ze,i as Qe,n as Ce,o as Te,r as ta,t as aa}from"./state-CcAGAozT.js";import{n as na}from"./LazyAnyLanguageCodeMirror-GdhQ07zA.js";import{t as ra}from"./x-C-6liIBr.js";import{n as Oe}from"./markdown-renderer-l3qZKrTC.js";import{u as sa}from"./toDate-B5A0DFEz.js";import{t as et}from"./copy-BwrPA9zQ.js";import{t as $e}from"./external-link-BTNxSavU.js";import{t as la}from"./eye-off-BT-KOYV5.js";import{a as oa,i as tt,n as at,r as ia,t as ca}from"./file-icons-B6DaZdP0.js";import{t as nt}from"./file-HTLbeC2b.js";import{i as rt,r as da,t as st}from"./add-connection-dialog-DwDtRq10.js";import{n as Ie,t as ma}from"./spinner-UuZAUjoP.js";import{a as pa,c as ha,d as xa,f as fa,i as ua,l as ya,n as ja,r as ga,t as ba,u as va}from"./file-name-input-BpDnZMOs.js";import{t as lt}from"./plus-CxkHs8QM.js";import{t as ot}from"./refresh-cw-a_9k9BK7.js";import{t as wa}from"./save-DZ5aail6.js";import{t as Na}from"./triangle-alert-CJ0ZIqcz.js";import{n as ka,t as Fa}from"./es-au8YY-8E.js";import"./dist-DCqxOggh.js";import"./dist-BZr6MMV-.js";import"./dist-BU26XwgJ.js";import"./dist-COs9gIu5.js";import"./dist-DkA__6UI.js";import{t as te}from"./use-toast-ERM44-k9.js";import{t as _a}from"./paths-SFhaqGlE.js";import"./session-DGdfs0bJ.js";import"./purify.es-DvRMX74T.js";import"./dates-DS_7IZoI.js";import{n as je}from"./copy-Ch48HVPK.js";import{t as Sa}from"./copy-icon-BdZPgXgo.js";import{t as it}from"./context-C1Tm_47t.js";import{n as ct}from"./ImperativeModal-BeQmePpG.js";import{t as dt}from"./blob-3_FN0u9S.js";import"./utils-DQRuLEof.js";import"./vega-loader.browser-xq8miGHn.js";import"./defaultLocale-DPBdGRrH.js";import"./defaultLocale-Lfi0pexn.js";import{n as Ca,t as Ma}from"./alert-DrHguQlr.js";import{n as mt}from"./error-banner-CLO6LFll.js";import"./chunk-5FQGJX7Z-CbuGydc8.js";import"./html-to-image-Ctd6Wpty.js";import{o as Da}from"./focus-BLb-92ed.js";import{n as Ae}from"./useAsyncData-Dg8E_bPh.js";import"./react-resizable-panels.browser.esm-BdtIs0E-.js";import{a as za,d as Pa,o as pt,t as Ta}from"./command-DUeag2QH.js";import{a as Oa}from"./renderShortcut-DK-VjfaX.js";import{t as $a}from"./bundle.esm-BXIlAZ6T.js";import{i as Re,n as Ia,r as ht,t as ge}from"./tree-actions-DY8FUp3V.js";import{a as Aa}from"./components-zB5yT_R8.js";import{n as Ra}from"./pathUtils-vgBYIo5B.js";import{n as Ea}from"./semaphore-X3ApuO41.js";import{t as Ha}from"./empty-state-CcobJSnG.js";import{t as Ee}from"./formatting-XTtGIhGk.js";import{a as Va,i as La,n as xt,r as ft,t as ut}from"./components-CvGaLA5d.js";import{n as yt,t as Ba}from"./marimo-icons-CUuBQ0ae.js";import{t as qa}from"./links-Av1BIe0O.js";var Ua=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"}]]),Wa=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"}]]),Ga=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"}]]),Ka=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"}]]),$=qe(At(),1),Ja=fe(),a=qe(qt(),1);const wt=t=>{let e=(0,Ja.c)(17),{filename:n,filenameIcon:i,onBack:o,onRefresh:r,onDownload:d,actions:c}=t,x;e[0]===o?x=e[1]:(x=o&&(0,a.jsx)(H,{content:"Back to file list",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:o,children:(0,a.jsx)(Ze,{className:"h-4 w-4"})})}),e[0]=o,e[1]=x);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)(H,{content:"Refresh",children:(0,a.jsx)(A,{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 m;e[7]===d?m=e[8]:(m=d&&(0,a.jsx)(H,{content:"Download",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:d,children:(0,a.jsx)(De,{className:"h-3.5 w-3.5"})})}),e[7]=d,e[8]=m);let f;e[9]!==c||e[10]!==y||e[11]!==m?(f=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[y,c,m]}),e[9]=c,e[10]=y,e[11]=m,e[12]=f):f=e[12];let u;return e[13]!==x||e[14]!==s||e[15]!==f?(u=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[x,s,f]}),e[13]=x,e[14]=s,e[15]=f,e[16]=u):u=e[16],u};var Ya=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:Ua,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:Ga,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);if(t.backendType==="obstore")return Ya.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 Xa=100*1024*1024;function Za(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Qa=({entry:t,namespace:e,protocol:n,backendType:i,onBack:o})=>{let{locale:r}=it(),d=Ye(),c=Za(t.path),x=t.mimeType||"text/plain",s=_e(x),y=s&&t.size>Xa&&t.size>0,{data:m,isPending:f,error:u,refetch:g}=Ae(async()=>{if(y)return null;let p=await Te.request({namespace:e,path:t.path,preview:!s});if(p.error)throw Error(p.error);if(!p.url)throw Error("No URL returned");if(s)return{type:"media",url:p.url};let b=await fetch(p.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,$.useCallback)(async()=>{try{let p=await Te.request({namespace:e,path:t.path});if(p.error){te({title:"Download failed",description:p.error,variant:"danger"});return}p.url&&ze(p.url,p.filename??c)}catch(p){Me.error("Failed to download storage entry",p),te({title:"Download failed",description:String(p),variant:"danger"})}},[e,t.path,c]),v=Nt.map(p=>{let b=p.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(b===null)return null;let h=p.icon;return(0,a.jsx)(H,{content:p.label,children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:()=>d(b),"aria-label":p.label,children:(0,a.jsx)(h,{className:"h-3.5 w-3.5"})})},p.id)}),l=(0,a.jsx)(wt,{filename:c,filenameIcon:tt(c),onBack:o,onDownload:w,actions:v}),j=({includeMime:p=!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)(Sa,{value:t.path,className:"h-3 w-3"})]}),p&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),p&&(0,a.jsx)("span",{children:x}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Ee(t.size,r)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Ee(t.size,r),")."]})]}):f?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Ie,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",u.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(A,{variant:"secondary",size:"xs",onClick:g,children:[(0,a.jsx)(ot,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):m?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsx)(Je,{mimeType:x,contents:m.type==="text"?m.content:void 0,mediaSource:m.type==="media"?{url:m.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(nt,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Ve=fe(),en=16;function se(t){return{paddingLeft:t*en}}function tn(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 Le(t,e,n,i){let o=n.toLowerCase();if(kt(t.path).toLowerCase().includes(o))return!0;if(t.kind==="directory"){let r=i.get(Xe(e,t.path));if(r)return r.some(d=>Le(d,e,n,i))}return!1}function Ft(t,e,n,i){return n.trim()?t.filter(o=>Le(o,e,n,i)):t}var an=t=>{let e=(0,Ve.c)(36),{namespace:n,protocol:i,rootPath:o,backendType:r,prefix:d,depth:c,locale:x,searchValue:s,onOpenFile:y}=t,{entriesByPath:m}=Ce(),{entries:f,isPending:u,error:g}=Qe(n,d);if(u){let l;e[0]===c?l=e[1]:(l=se(c),e[0]=c,e[1]=l);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),e[2]=j):j=e[2];let p;return e[3]===l?p=e[4]:(p=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:l,children:[j,"Loading..."]}),e[3]=l,e[4]=p),p}if(g){let l;e[5]===c?l=e[6]:(l=se(c),e[5]=c,e[6]=l);let j;return e[7]!==g.message||e[8]!==l?(j=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:l,children:["Failed to load: ",g.message]}),e[7]=g.message,e[8]=l,e[9]=j):j=e[9],j}if(f.length===0){let l;e[10]===c?l=e[11]:(l=se(c),e[10]=c,e[11]=l);let j;return e[12]===l?j=e[13]:(j=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:l,children:"Empty"}),e[12]=l,e[13]=j),j}let w;if(e[14]!==r||e[15]!==f||e[16]!==c||e[17]!==m||e[18]!==x||e[19]!==n||e[20]!==y||e[21]!==i||e[22]!==o||e[23]!==s){let l=Ft(f,n,s,m),j;e[25]!==r||e[26]!==c||e[27]!==x||e[28]!==n||e[29]!==y||e[30]!==i||e[31]!==o||e[32]!==s?(j=p=>(0,a.jsx)(_t,{entry:p,namespace:n,protocol:i,rootPath:o,backendType:r,depth:c,locale:x,searchValue:s,onOpenFile:y},p.path),e[25]=r,e[26]=c,e[27]=x,e[28]=n,e[29]=y,e[30]=i,e[31]=o,e[32]=s,e[33]=j):j=e[33],w=l.map(j),e[14]=r,e[15]=f,e[16]=c,e[17]=m,e[18]=x,e[19]=n,e[20]=y,e[21]=i,e[22]=o,e[23]=s,e[24]=w}else w=e[24];let v;return e[34]===w?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:w}),e[34]=w,e[35]=v),v},_t=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:o,depth:r,locale:d,searchValue:c,onOpenFile:x})=>{var b;let[s,y]=(0,$.useState)(!1),{entriesByPath:m}=Ce(),f=Ye(),u=t.kind==="directory",g=kt(t.path),w=!!c.trim(),v=u&&w&&g.toLowerCase().includes(c.trim().toLowerCase()),l=u&&w&&!!((b=m.get(Xe(e,t.path)))!=null&&b.some(h=>Le(h,e,c,m))),j=s||l,p=(0,$.useCallback)(async()=>{try{let h=await Te.request({namespace:e,path:t.path});if(h.error){te({title:"Download failed",description:h.error,variant:"danger"});return}h.url&&ze(h.url,h.filename??"download")}catch(h){Me.error("Failed to download storage entry",h),te({title:"Download failed",description:String(h),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(pt,{className:ie("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",u&&"font-medium"),style:se(r),value:`${e}:${t.path}`,onSelect:()=>{u?y(!j):x({entry:t,namespace:e,protocol:n,backendType:o})},children:[u?(0,a.jsx)(Re,{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",at.directory)}):tt(g),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:g}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Ee(t.size,d)}),t.lastModified!=null&&(0,a.jsx)(H,{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:tn(t.lastModified,d)})}),(0,a.jsxs)(Jt,{children:[(0,a.jsx)(Gt,{asChild:!0,children:(0,a.jsx)(Ia,{iconClassName:"h-3 w-3",onClick:h=>h.stopPropagation()})}),(0,a.jsxs)(Kt,{align:"end",onClick:h=>h.stopPropagation(),onCloseAutoFocus:h=>h.preventDefault(),children:[!u&&(0,a.jsxs)(E,{onSelect:()=>x({entry:t,namespace:e,protocol:n,backendType:o}),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(E,{onSelect:async()=>{await je(t.path),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(et,{className:ge}),"Copy path"]}),!u&&(0,a.jsxs)(E,{onSelect:()=>p(),children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Nt.map(h=>{let k=h.getCode({variableName:e,protocol:n,entry:t,backendType:o});if(k===null)return null;let F=h.icon;return(0,a.jsxs)(E,{onSelect:()=>f(k),children:[(0,a.jsx)(F,{className:ge}),h.label]},h.id)})]})]})]})]}),u&&j&&(0,a.jsx)(an,{namespace:e,protocol:n,rootPath:i,backendType:o,prefix:t.path,depth:r+1,locale:d,searchValue:v?"":c,onOpenFile:x})]})},nn=t=>{let e=(0,Ve.c)(43),{namespace:n,locale:i,searchValue:o,onOpenFile:r}=t,[d,c]=(0,$.useState)(!0),{entriesByPath:x}=Ce(),{clearNamespaceCache:s}=ta(),y=n.name??n.displayName,{entries:m,isPending:f,error:u,refetch:g}=Qe(y),w;e[0]!==s||e[1]!==y||e[2]!==g?(w=p=>{p.stopPropagation(),s(y),g()},e[0]=s,e[1]=y,e[2]=g,e[3]=w):w=e[3];let v=w,l=f?n.storageEntries:m,j;if(e[4]!==l||e[5]!==x||e[6]!==u||e[7]!==v||e[8]!==d||e[9]!==f||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]!==o){let p=Ft(l,y,o,x),b;e[20]===d?b=e[21]:(b=()=>c(!d),e[20]=d,e[21]=b);let h;e[22]===d?h=e[23]:(h=(0,a.jsx)(Re,{isExpanded:d,className:"h-3 w-3"}),e[22]=d,e[23]=h);let k;e[24]===n.protocol?k=e[25]:(k=(0,a.jsx)(da,{protocol:n.protocol}),e[24]=n.protocol,e[25]=k);let F;e[26]===n.displayName?F=e[27]:(F=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=F);let _;e[28]===n.name?_=e[29]:(_=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Va,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=_);let M;e[30]===v?M=e[31]:(M=(0,a.jsx)(ht,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=M);let D=n.rootPath||"(root)",S;e[32]===D?S=e[33]:(S=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:D}),e[32]=D,e[33]=S);let C;e[34]!==n.name||e[35]!==S||e[36]!==b||e[37]!==h||e[38]!==k||e[39]!==F||e[40]!==_||e[41]!==M?(C=(0,a.jsxs)(pt,{value:n.name,onSelect:b,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[h,k,F,_,M,S]}),e[34]=n.name,e[35]=S,e[36]=b,e[37]=h,e[38]=k,e[39]=F,e[40]=_,e[41]=M,e[42]=C):C=e[42],j=(0,a.jsxs)(a.Fragment,{children:[C,d&&(0,a.jsxs)(a.Fragment,{children:[f&&l.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:se(1),children:[(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),u&&l.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}),!f&&l.length===0&&!u&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No entries"}),o&&p.length===0&&l.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No matches"}),p.map(O=>(0,a.jsx)(_t,{entry:O,namespace:y,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:o,onOpenFile:r},O.path))]})]}),e[4]=l,e[5]=x,e[6]=u,e[7]=v,e[8]=d,e[9]=f,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]=o,e[19]=j}else j=e[19];return j};const rn=()=>{let t=(0,Ve.c)(31),{namespaces:e}=Ce(),{locale:n}=it(),[i,o]=(0,$.useState)(""),[r,d]=(0,$.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 h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(Ha,{title:"No storage connected",description:b,action:(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsxs)(A,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(lt,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(rt,{className:"h-8 w-8"})}),t[1]=h):h=t[1],h}let x;t[2]===r?x=t[3]:(x=r&&(0,a.jsx)(Qa,{entry:r.entry,namespace:r.namespace,protocol:r.protocol,backendType:r.backendType,onBack:()=>d(null)}),t[2]=r,t[3]=x);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 m;t[6]===i?m=t[7]:(m=(0,a.jsx)(Da,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:o,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=m);let f;t[8]===c?f=t[9]:(f=c&&(0,a.jsx)(A,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>o(""),children:(0,a.jsx)(ra,{className:"h-4 w-4"})}),t[8]=c,t[9]=f);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(H,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(sa,{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)(st,{defaultTab:"storage",children:(0,a.jsx)(A,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(lt,{className:"h-4 w-4"})})}),t[11]=g):g=t[11];let w;t[12]!==m||t[13]!==f?(w=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[m,f,u,g]}),t[12]=m,t[13]=f,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=h=>(0,a.jsx)(nn,{namespace:h,locale:n,searchValue:i,onOpenFile:d},h.name??h.displayName),t[19]=n,t[20]=i,t[21]=b):b=t[21],v=e.map(b),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let l;t[22]===v?l=t[23]:(l=(0,a.jsx)(Pa,{className:"flex flex-col",children:v}),t[22]=v,t[23]=l);let j;t[24]!==y||t[25]!==w||t[26]!==l?(j=(0,a.jsxs)(za,{className:y,shouldFilter:!1,children:[w,l]}),t[24]=y,t[25]=w,t[26]=l,t[27]=j):j=t[27];let p;return t[28]!==x||t[29]!==j?(p=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[x,j]}),t[28]=x,t[29]=j,t[30]=p):p=t[30],p};var St=fe(),Ct=(0,$.createContext)(null);function sn(){return(0,$.useContext)(Ct)??void 0}var ln=t=>{let e=(0,St.c)(3),{children:n}=t,i=xa(),o;return e[0]!==n||e[1]!==i?(o=(0,a.jsx)(Ct.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=o):o=e[2],o};const on=t=>{let e=(0,St.c)(5),{children:n}=t,[i,o]=(0,$.useState)(null),r;e[0]!==n||e[1]!==i?(r=i&&(0,a.jsx)(fa,{backend:va,options:{rootElement:i},children:(0,a.jsx)(ln,{children:n})}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let d;return e[3]===r?d=e[4]:(d=(0,a.jsx)("div",{ref:o,className:"contents",children:r}),e[3]=r,e[4]=d),d};var Be=new Map;const cn=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=Pe(),o=ye(Bt),r=ye(Ke),d=ye(Ht),[c,x]=(0,$.useState)(""),{data:s,isPending:y,error:m,setData:f,refetch:u}=Ae(async()=>{let k=await n({path:t.path}),F=k.contents||"";return x(Be.get(t.path)||F),k},[t.path]),g=async()=>{c!==(s==null?void 0:s.contents)&&await i({path:t.path,contents:c}).then(k=>{k.success&&(f(F=>({...F,contents:c})),x(c))})},w=(0,$.useRef)(c);if(w.current=c,(0,$.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]),m)return(0,a.jsx)(mt,{error:m});if(y||!s)return null;let v=s.mimeType||"text/plain",l=v in Yt,j=d&&s.file.isMarimoFile&&(t.path===d||t.path.endsWith(`/${d}`));if(!s.contents&&!l)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let p=(0,a.jsx)(wt,{filename:s.file.name,onRefresh:u,onDownload:r?void 0:()=>{if(s.isBase64&&s.contents){_e(v)?ze(Oe(s.contents,v),s.file.name):Se(dt(Oe(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Se(new Blob([s.contents||c],{type:v}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!Fe()&&(0,a.jsx)(H,{content:"Open notebook",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:k=>e(k),children:(0,a.jsx)($e,{className:"h-3.5 w-3.5"})})}),!_e(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(H,{content:"Copy contents to clipboard",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:async()=>{await je(c)},children:(0,a.jsx)(et,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(H,{content:Oa("global.save"),children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:g,disabled:c===s.contents,children:(0,a.jsx)(wa,{className:"h-3.5 w-3.5"})})})]})]})}),b=_e(v),h=!b&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[p,h&&j&&(0,a.jsxs)(Ma,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(Na,{className:"h-4 w-4"}),(0,a.jsx)(Ca,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Je,{mimeType:v,contents:b?void 0:h?c:s.contents??void 0,mediaSource:b?{base64:s.contents,mime:v}:void 0,readOnly:!h,onChange:x,extensions:[Qt.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===s.contents?!1:(g(),!0)}])]})]})},Mt=Ue(t=>{let e=t(ea);return Lt(e,"no requestClientAtom set"),new ha({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),dn=Ue({});async function mn(){await It.get(Mt).refreshAll([])}var le=" ";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 Xa=100*1024*1024;function Za(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Qa=({entry:t,namespace:e,protocol:n,backendType:i,onBack:o})=>{let{locale:r}=it(),d=Ye(),c=Za(t.path),x=t.mimeType||"text/plain",s=_e(x),y=s&&t.size>Xa&&t.size>0,{data:m,isPending:f,error:u,refetch:g}=Ae(async()=>{if(y)return null;let p=await Te.request({namespace:e,path:t.path,preview:!s});if(p.error)throw Error(p.error);if(!p.url)throw Error("No URL returned");if(s)return{type:"media",url:p.url};let b=await fetch(p.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,$.useCallback)(async()=>{try{let p=await Te.request({namespace:e,path:t.path});if(p.error){te({title:"Download failed",description:p.error,variant:"danger"});return}p.url&&ze(p.url,p.filename??c)}catch(p){Me.error("Failed to download storage entry",p),te({title:"Download failed",description:String(p),variant:"danger"})}},[e,t.path,c]),v=Nt.map(p=>{let b=p.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(b===null)return null;let h=p.icon;return(0,a.jsx)(H,{content:p.label,children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:()=>d(b),"aria-label":p.label,children:(0,a.jsx)(h,{className:"h-3.5 w-3.5"})})},p.id)}),l=(0,a.jsx)(wt,{filename:c,filenameIcon:tt(c),onBack:o,onDownload:w,actions:v}),j=({includeMime:p=!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)(Sa,{value:t.path,className:"h-3 w-3"})]}),p&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),p&&(0,a.jsx)("span",{children:x}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Ee(t.size,r)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Ee(t.size,r),")."]})]}):f?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Ie,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",u.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(A,{variant:"secondary",size:"xs",onClick:g,children:[(0,a.jsx)(ot,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):m?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsx)(Je,{mimeType:x,contents:m.type==="text"?m.content:void 0,mediaSource:m.type==="media"?{url:m.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(nt,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Ve=fe(),en=16;function se(t){return{paddingLeft:t*en}}function tn(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 Le(t,e,n,i){let o=n.toLowerCase();if(kt(t.path).toLowerCase().includes(o))return!0;if(t.kind==="directory"){let r=i.get(Xe(e,t.path));if(r)return r.some(d=>Le(d,e,n,i))}return!1}function Ft(t,e,n,i){return n.trim()?t.filter(o=>Le(o,e,n,i)):t}var an=t=>{let e=(0,Ve.c)(36),{namespace:n,protocol:i,rootPath:o,backendType:r,prefix:d,depth:c,locale:x,searchValue:s,onOpenFile:y}=t,{entriesByPath:m}=Ce(),{entries:f,isPending:u,error:g}=Qe(n,d);if(u){let l;e[0]===c?l=e[1]:(l=se(c),e[0]=c,e[1]=l);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),e[2]=j):j=e[2];let p;return e[3]===l?p=e[4]:(p=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:l,children:[j,"Loading..."]}),e[3]=l,e[4]=p),p}if(g){let l;e[5]===c?l=e[6]:(l=se(c),e[5]=c,e[6]=l);let j;return e[7]!==g.message||e[8]!==l?(j=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:l,children:["Failed to load: ",g.message]}),e[7]=g.message,e[8]=l,e[9]=j):j=e[9],j}if(f.length===0){let l;e[10]===c?l=e[11]:(l=se(c),e[10]=c,e[11]=l);let j;return e[12]===l?j=e[13]:(j=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:l,children:"Empty"}),e[12]=l,e[13]=j),j}let w;if(e[14]!==r||e[15]!==f||e[16]!==c||e[17]!==m||e[18]!==x||e[19]!==n||e[20]!==y||e[21]!==i||e[22]!==o||e[23]!==s){let l=Ft(f,n,s,m),j;e[25]!==r||e[26]!==c||e[27]!==x||e[28]!==n||e[29]!==y||e[30]!==i||e[31]!==o||e[32]!==s?(j=p=>(0,a.jsx)(_t,{entry:p,namespace:n,protocol:i,rootPath:o,backendType:r,depth:c,locale:x,searchValue:s,onOpenFile:y},p.path),e[25]=r,e[26]=c,e[27]=x,e[28]=n,e[29]=y,e[30]=i,e[31]=o,e[32]=s,e[33]=j):j=e[33],w=l.map(j),e[14]=r,e[15]=f,e[16]=c,e[17]=m,e[18]=x,e[19]=n,e[20]=y,e[21]=i,e[22]=o,e[23]=s,e[24]=w}else w=e[24];let v;return e[34]===w?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:w}),e[34]=w,e[35]=v),v},_t=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:o,depth:r,locale:d,searchValue:c,onOpenFile:x})=>{var b;let[s,y]=(0,$.useState)(!1),{entriesByPath:m}=Ce(),f=Ye(),u=t.kind==="directory",g=kt(t.path),w=!!c.trim(),v=u&&w&&g.toLowerCase().includes(c.trim().toLowerCase()),l=u&&w&&!!((b=m.get(Xe(e,t.path)))!=null&&b.some(h=>Le(h,e,c,m))),j=s||l,p=(0,$.useCallback)(async()=>{try{let h=await Te.request({namespace:e,path:t.path});if(h.error){te({title:"Download failed",description:h.error,variant:"danger"});return}h.url&&ze(h.url,h.filename??"download")}catch(h){Me.error("Failed to download storage entry",h),te({title:"Download failed",description:String(h),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(pt,{className:ie("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",u&&"font-medium"),style:se(r),value:`${e}:${t.path}`,onSelect:()=>{u?y(!j):x({entry:t,namespace:e,protocol:n,backendType:o})},children:[u?(0,a.jsx)(Re,{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",at.directory)}):tt(g),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:g}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Ee(t.size,d)}),t.lastModified!=null&&(0,a.jsx)(H,{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:tn(t.lastModified,d)})}),(0,a.jsxs)(Jt,{children:[(0,a.jsx)(Gt,{asChild:!0,children:(0,a.jsx)(Ia,{iconClassName:"h-3 w-3",onClick:h=>h.stopPropagation()})}),(0,a.jsxs)(Kt,{align:"end",onClick:h=>h.stopPropagation(),onCloseAutoFocus:h=>h.preventDefault(),children:[!u&&(0,a.jsxs)(E,{onSelect:()=>x({entry:t,namespace:e,protocol:n,backendType:o}),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(E,{onSelect:async()=>{await je(t.path),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(et,{className:ge}),"Copy path"]}),!u&&(0,a.jsxs)(E,{onSelect:()=>p(),children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Nt.map(h=>{let k=h.getCode({variableName:e,protocol:n,entry:t,backendType:o});if(k===null)return null;let F=h.icon;return(0,a.jsxs)(E,{onSelect:()=>f(k),children:[(0,a.jsx)(F,{className:ge}),h.label]},h.id)})]})]})]})]}),u&&j&&(0,a.jsx)(an,{namespace:e,protocol:n,rootPath:i,backendType:o,prefix:t.path,depth:r+1,locale:d,searchValue:v?"":c,onOpenFile:x})]})},nn=t=>{let e=(0,Ve.c)(43),{namespace:n,locale:i,searchValue:o,onOpenFile:r}=t,[d,c]=(0,$.useState)(!0),{entriesByPath:x}=Ce(),{clearNamespaceCache:s}=ta(),y=n.name??n.displayName,{entries:m,isPending:f,error:u,refetch:g}=Qe(y),w;e[0]!==s||e[1]!==y||e[2]!==g?(w=p=>{p.stopPropagation(),s(y),g()},e[0]=s,e[1]=y,e[2]=g,e[3]=w):w=e[3];let v=w,l=f?n.storageEntries:m,j;if(e[4]!==l||e[5]!==x||e[6]!==u||e[7]!==v||e[8]!==d||e[9]!==f||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]!==o){let p=Ft(l,y,o,x),b;e[20]===d?b=e[21]:(b=()=>c(!d),e[20]=d,e[21]=b);let h;e[22]===d?h=e[23]:(h=(0,a.jsx)(Re,{isExpanded:d,className:"h-3 w-3"}),e[22]=d,e[23]=h);let k;e[24]===n.protocol?k=e[25]:(k=(0,a.jsx)(da,{protocol:n.protocol}),e[24]=n.protocol,e[25]=k);let F;e[26]===n.displayName?F=e[27]:(F=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=F);let _;e[28]===n.name?_=e[29]:(_=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Va,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=_);let M;e[30]===v?M=e[31]:(M=(0,a.jsx)(ht,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=M);let D=n.rootPath||"(root)",S;e[32]===D?S=e[33]:(S=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:D}),e[32]=D,e[33]=S);let C;e[34]!==n.name||e[35]!==S||e[36]!==b||e[37]!==h||e[38]!==k||e[39]!==F||e[40]!==_||e[41]!==M?(C=(0,a.jsxs)(pt,{value:n.name,onSelect:b,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[h,k,F,_,M,S]}),e[34]=n.name,e[35]=S,e[36]=b,e[37]=h,e[38]=k,e[39]=F,e[40]=_,e[41]=M,e[42]=C):C=e[42],j=(0,a.jsxs)(a.Fragment,{children:[C,d&&(0,a.jsxs)(a.Fragment,{children:[f&&l.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:se(1),children:[(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),u&&l.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}),!f&&l.length===0&&!u&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No entries"}),o&&p.length===0&&l.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No matches"}),p.map(O=>(0,a.jsx)(_t,{entry:O,namespace:y,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:o,onOpenFile:r},O.path))]})]}),e[4]=l,e[5]=x,e[6]=u,e[7]=v,e[8]=d,e[9]=f,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]=o,e[19]=j}else j=e[19];return j};const rn=()=>{let t=(0,Ve.c)(31),{namespaces:e}=Ce(),{locale:n}=it(),[i,o]=(0,$.useState)(""),[r,d]=(0,$.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 h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(Ha,{title:"No storage connected",description:b,action:(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsxs)(A,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(lt,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(rt,{className:"h-8 w-8"})}),t[1]=h):h=t[1],h}let x;t[2]===r?x=t[3]:(x=r&&(0,a.jsx)(Qa,{entry:r.entry,namespace:r.namespace,protocol:r.protocol,backendType:r.backendType,onBack:()=>d(null)}),t[2]=r,t[3]=x);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 m;t[6]===i?m=t[7]:(m=(0,a.jsx)(za,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:o,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=m);let f;t[8]===c?f=t[9]:(f=c&&(0,a.jsx)(A,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>o(""),children:(0,a.jsx)(ra,{className:"h-4 w-4"})}),t[8]=c,t[9]=f);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(H,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(sa,{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)(st,{defaultTab:"storage",children:(0,a.jsx)(A,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(lt,{className:"h-4 w-4"})})}),t[11]=g):g=t[11];let w;t[12]!==m||t[13]!==f?(w=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[m,f,u,g]}),t[12]=m,t[13]=f,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=h=>(0,a.jsx)(nn,{namespace:h,locale:n,searchValue:i,onOpenFile:d},h.name??h.displayName),t[19]=n,t[20]=i,t[21]=b):b=t[21],v=e.map(b),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let l;t[22]===v?l=t[23]:(l=(0,a.jsx)(Pa,{className:"flex flex-col",children:v}),t[22]=v,t[23]=l);let j;t[24]!==y||t[25]!==w||t[26]!==l?(j=(0,a.jsxs)(Ta,{className:y,shouldFilter:!1,children:[w,l]}),t[24]=y,t[25]=w,t[26]=l,t[27]=j):j=t[27];let p;return t[28]!==x||t[29]!==j?(p=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[x,j]}),t[28]=x,t[29]=j,t[30]=p):p=t[30],p};var St=fe(),Ct=(0,$.createContext)(null);function sn(){return(0,$.useContext)(Ct)??void 0}var ln=t=>{let e=(0,St.c)(3),{children:n}=t,i=xa(),o;return e[0]!==n||e[1]!==i?(o=(0,a.jsx)(Ct.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=o):o=e[2],o};const on=t=>{let e=(0,St.c)(5),{children:n}=t,[i,o]=(0,$.useState)(null),r;e[0]!==n||e[1]!==i?(r=i&&(0,a.jsx)(fa,{backend:va,options:{rootElement:i},children:(0,a.jsx)(ln,{children:n})}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let d;return e[3]===r?d=e[4]:(d=(0,a.jsx)("div",{ref:o,className:"contents",children:r}),e[3]=r,e[4]=d),d};var Be=new Map;const cn=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=Pe(),o=ye(Bt),r=ye(Ke),d=ye(Ht),[c,x]=(0,$.useState)(""),{data:s,isPending:y,error:m,setData:f,refetch:u}=Ae(async()=>{let k=await n({path:t.path}),F=k.contents||"";return x(Be.get(t.path)||F),k},[t.path]),g=async()=>{c!==(s==null?void 0:s.contents)&&await i({path:t.path,contents:c}).then(k=>{k.success&&(f(F=>({...F,contents:c})),x(c))})},w=(0,$.useRef)(c);if(w.current=c,(0,$.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]),m)return(0,a.jsx)(mt,{error:m});if(y||!s)return null;let v=s.mimeType||"text/plain",l=v in Yt,j=d&&s.file.isMarimoFile&&(t.path===d||t.path.endsWith(`/${d}`));if(!s.contents&&!l)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let p=(0,a.jsx)(wt,{filename:s.file.name,onRefresh:u,onDownload:r?void 0:()=>{if(s.isBase64&&s.contents){_e(v)?ze(Oe(s.contents,v),s.file.name):Se(dt(Oe(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Se(new Blob([s.contents||c],{type:v}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!Fe()&&(0,a.jsx)(H,{content:"Open notebook",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:k=>e(k),children:(0,a.jsx)($e,{className:"h-3.5 w-3.5"})})}),!_e(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(H,{content:"Copy contents to clipboard",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:async()=>{await je(c)},children:(0,a.jsx)(et,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(H,{content:Oa("global.save"),children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:g,disabled:c===s.contents,children:(0,a.jsx)(wa,{className:"h-3.5 w-3.5"})})})]})]})}),b=_e(v),h=!b&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[p,h&&j&&(0,a.jsxs)(Ma,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(Na,{className:"h-4 w-4"}),(0,a.jsx)(Ca,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Je,{mimeType:v,contents:b?void 0:h?c:s.contents??void 0,mediaSource:b?{base64:s.contents,mime:v}:void 0,readOnly:!h,onChange:x,extensions:[Qt.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===s.contents?!1:(g(),!0)}])]})]})},Mt=Ue(t=>{let e=t(ea);return Lt(e,"no requestClientAtom set"),new ha({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),dn=Ue({});async function mn(){await It.get(Mt).refreshAll([])}var le=" ";const Dt={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
11
11
  ${le}...
12
12
  `,json:t=>`with open("${t}", "r") as _f:
13
13
  ${le}_data = json.load(_f)
@@ -23,4 +23,4 @@ ${le}...
23
23
  ${le}...
24
24
  `,unknown:t=>`with open("${t}", "r") as _f:
25
25
  ${le}...
26
- `};var pn=fe(),hn=1024*1024*100,xn=5;function zt(t){let e=(0,pn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:o}=Pe(),r;e[2]===o?r=e[3]:(r=async c=>{if(c.length===0)return;let x=c.length===1;await Xt(x?"Uploading file...":"Uploading files...",async s=>{s.addTotal(c.length),await Ea(c,xn,async y=>{let m=bn(gn(y)),f="";m&&(f=_a.guessDeliminator(m).dirname(m)),await o({path:f,type:"file",name:y.name,file:y}),s.increment(1)}),await mn()},{title:x?"File uploaded":`${c.length} files uploaded`})},e[2]=o,e[3]=r);let d;return e[4]!==i||e[5]!==r?(d={multiple:!0,maxSize:hn,onError:jn,onDropRejected:fn,onDrop:r,...i},e[4]=i,e[5]=r,e[6]=d):d=e[6],Fa(d)}function fn(t){te({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(un)}),variant:"danger"})}function un(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(yn).join(", "),")"]},t.file.name)}function yn(t){return t.message}function jn(t){Me.error(t),te({title:"File upload failed",description:t.message,variant:"danger"})}function gn(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 bn(t){if(t)return t.replace(/^\/+/,"")}var be=fe(),vn=Ge("marimo:showHiddenFiles",!0,We,{getOnInit:!0}),Pt=$.createContext(null);const wn=t=>{let e=(0,be.c)(73),{height:n}=t,i=(0,$.useRef)(null),o=sn(),[r]=ke(Mt),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,x]=(0,$.useState)(d),[s,y]=(0,$.useState)(null),[m,f]=ke(vn),{openPrompt:u}=ct(),[g,w]=ke(dn),v;e[1]===r?v=e[2]:(v=()=>r.initialize(x),e[1]=r,e[2]=v);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3];let{isPending:j,error:p}=Ae(v,l),b;e[4]!==g||e[5]!==r?(b=()=>r.refreshAll(Object.keys(g).filter(N=>g[N])),e[4]=g,e[5]=r,e[6]=b):b=e[6];let h=ee(b),k;e[7]!==f||e[8]!==m?(k=()=>{f(!m)},e[7]=f,e[8]=m,e[9]=k):k=e[9];let F=ee(k),_;e[10]!==u||e[11]!==r?(_=async()=>{u({title:"Folder name",onConfirm:async N=>{r.createFolder(N,null)}})},e[10]=u,e[11]=r,e[12]=_):_=e[12];let M=ee(_),D;e[13]!==u||e[14]!==r?(D=async()=>{u({title:"File name",onConfirm:async N=>{r.createFile({name:N,parentId:null})}})},e[13]=u,e[14]=r,e[15]=D):D=e[15];let S=ee(D),C;e[16]!==u||e[17]!==r?(C=async()=>{u({title:"Notebook name",onConfirm:async N=>{r.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=u,e[17]=r,e[18]=C):C=e[18];let O=ee(C),P;e[19]===w?P=e[20]:(P=()=>{var N;(N=i.current)==null||N.closeAll(),w({})},e[19]=w,e[20]=P);let R=ee(P),J;e[21]!==c||e[22]!==m?(J=Ot(c,m),e[21]=c,e[22]=m,e[23]=J):J=e[23];let oe=J;if(j){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(ma,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(p){let N;return e[25]===p?N=e[26]:(N=(0,a.jsx)(mt,{error:p}),e[25]=p,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 T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=(0,a.jsx)(A,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ze,{size:16})}),e[28]=T):T=e[28];let I;e[29]===s.name?I=e[30]:(I=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[T,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=I);let K;e[31]!==s.path||e[32]!==r?(K=ne=>Tt(ne,r.relativeFromRoot(s.path)),e[31]=s.path,e[32]=r,e[33]=K):K=e[33];let X;e[34]!==s||e[35]!==K?(X=(0,a.jsx)($.Suspense,{children:(0,a.jsx)(cn,{onOpenNotebook:K,file:s})}),e[34]=s,e[35]=K,e[36]=X):X=e[36];let Z;return e[37]!==I||e[38]!==X?(Z=(0,a.jsxs)(a.Fragment,{children:[I,X]}),e[37]=I,e[38]=X,e[39]=Z):Z=e[39],Z}let V;e[40]!==R||e[41]!==S||e[42]!==M||e[43]!==O||e[44]!==F||e[45]!==h||e[46]!==m||e[47]!==r?(V=(0,a.jsx)(kn,{onRefresh:h,onHidden:F,showHiddenFiles:m,onCreateFile:S,onCreateNotebook:O,onCreateFolder:M,onCollapseAll:R,tree:r}),e[40]=R,e[41]=S,e[42]=M,e[43]=O,e[44]=F,e[45]=h,e[46]=m,e[47]=r,e[48]=V):V=e[48];let Q=n-33,L,B,q;e[49]===r?(L=e[50],B=e[51],q=e[52]):(L=async N=>{let{ids:T}=N;for(let I of T)await r.delete(I)},B=async N=>{let{id:T,name:I}=N;await r.rename(T,I)},q=async N=>{let{dragIds:T,parentId:I}=N;await r.move(T,I)},e[49]=r,e[50]=L,e[51]=B,e[52]=q);let Y;e[53]===Symbol.for("react.memo_cache_sentinel")?(Y=N=>{let T=N[0];T&&(T.data.isDirectory||y(T.data))},e[53]=Y):Y=e[53];let U;e[54]!==g||e[55]!==w||e[56]!==r?(U=async N=>{if(await r.expand(N)){let T=g[N]??!1;w({...g,[N]:!T})}},e[54]=g,e[55]=w,e[56]=r,e[57]=U):U=e[57];let W;e[58]!==o||e[59]!==g||e[60]!==Q||e[61]!==L||e[62]!==B||e[63]!==q||e[64]!==U||e[65]!==oe?(W=(0,a.jsx)(ya,{width:"100%",ref:i,height:Q,className:"h-full",data:oe,initialOpenState:g,openByDefault:!1,dndManager:o,renderCursor:Mn,disableDrop:Dn,onDelete:L,onRename:B,onMove:q,onSelect:Y,onToggle:U,padding:15,rowHeight:30,indent:Nn,overscanCount:1e3,disableMultiSelection:!0,children:_n}),e[58]=o,e[59]=g,e[60]=Q,e[61]=L,e[62]=B,e[63]=q,e[64]=U,e[65]=oe,e[66]=W):W=e[66];let G;e[67]!==W||e[68]!==r?(G=(0,a.jsx)(Pt,{value:r,children:W}),e[67]=W,e[68]=r,e[69]=G):G=e[69];let ae;return e[70]!==V||e[71]!==G?(ae=(0,a.jsxs)(a.Fragment,{children:[V,G]}),e[70]=V,e[71]=G,e[72]=ae):ae=e[72],ae};var Nn=15,kn=t=>{let e=(0,be.c)(42),{onRefresh:n,onHidden:i,showHiddenFiles:o,onCreateFile:r,onCreateNotebook:d,onCreateFolder:c,onCollapseAll:x}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},e[0]=s):s=e[0];let{getRootProps:y,getInputProps:m}=zt(s),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(yt,{size:16}),e[1]=f):f=e[1];let u;e[2]===d?u=e[3]:(u=(0,a.jsx)(H,{content:"Add notebook",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-notebook-button",onClick:d,variant:"text",size:"xs",children:f})}),e[2]=d,e[3]=u);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(jt,{size:16}),e[4]=g):g=e[4];let w;e[5]===r?w=e[6]:(w=(0,a.jsx)(H,{content:"Add file",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-file-button",onClick:r,variant:"text",size:"xs",children:g})}),e[5]=r,e[6]=w);let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)(gt,{size:16}),e[7]=v):v=e[7];let l;e[8]===c?l=e[9]:(l=(0,a.jsx)(H,{content:"Add folder",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-folder-button",onClick:c,variant:"text",size:"xs",children:v})}),e[8]=c,e[9]=l);let j;e[10]===y?j=e[11]:(j=y({}),e[10]=y,e[11]=j);let p,b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=Zt({variant:"text",size:"xs"}),p=(0,a.jsx)(ka,{size:16}),e[12]=p,e[13]=b):(p=e[12],b=e[13]);let h;e[14]===j?h=e[15]:(h=(0,a.jsx)(H,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...j,className:b,children:p})}),e[14]=j,e[15]=h);let k;e[16]===m?k=e[17]:(k=m({}),e[16]=m,e[17]=k);let F;e[18]===k?F=e[19]:(F=(0,a.jsx)("input",{...k,type:"file"}),e[18]=k,e[19]=F);let _;e[20]===n?_=e[21]:(_=(0,a.jsx)(ht,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=_);let M=o?"Hide hidden files":"Show hidden files",D;e[22]===o?D=e[23]:(D=o?(0,a.jsx)(Et,{size:16,className:"text-primary"}):(0,a.jsx)(la,{size:16}),e[22]=o,e[23]=D);let S;e[24]!==i||e[25]!==D?(S=(0,a.jsx)(A,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:D}),e[24]=i,e[25]=D,e[26]=S):S=e[26];let C;e[27]!==M||e[28]!==S?(C=(0,a.jsx)(H,{content:M,children:S}),e[27]=M,e[28]=S,e[29]=C):C=e[29];let O;e[30]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(Wa,{size:16}),e[30]=O):O=e[30];let P;e[31]===x?P=e[32]:(P=(0,a.jsx)(H,{content:"Collapse all folders",children:(0,a.jsx)(A,{"data-testid":"file-explorer-collapse-button",onClick:x,variant:"text",size:"xs",children:O})}),e[31]=x,e[32]=P);let R;return e[33]!==h||e[34]!==F||e[35]!==_||e[36]!==C||e[37]!==P||e[38]!==u||e[39]!==w||e[40]!==l?(R=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[u,w,l,h,F,_,C,P]}),e[33]=h,e[34]=F,e[35]=_,e[36]=C,e[37]=P,e[38]=u,e[39]=w,e[40]=l,e[41]=R):R=e[41],R},Fn=t=>{let e=(0,be.c)(9),{node:n,onOpenMarimoFile:i}=t,o;e[0]===n?o=e[1]:(o=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=o);let r;e[2]!==n.data.isMarimoFile||e[3]!==i?(r=n.data.isMarimoFile&&!Fe()&&(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)($e,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=r):r=e[4];let d;return e[5]!==n.data.name||e[6]!==o||e[7]!==r?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:o,children:[n.data.name,r]}),e[5]=n.data.name,e[6]=o,e[7]=r,e[8]=d):d=e[8],d},_n=t=>{let e=(0,be.c)(116),{node:n,style:i,dragHandle:o}=t,{openFile:r,sendFileDetails:d}=Pe(),c=ye(Ke),x;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(x=n.data.isDirectory?"directory":ia(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=x):x=e[2];let s=x,y=ca[s],{openConfirm:m,openPrompt:f}=ct(),{createNewCell:u}=Rt(),g=Ta(),w;e[3]!==u||e[4]!==g?(w=z=>{u({code:z,before:!1,cellId:g??"__end__"})},e[3]=u,e[4]=g,e[5]=w):w=e[5];let v=w,l=(0,$.use)(Pt),j;e[6]!==n.data.path||e[7]!==l?(j=async z=>{Tt(z,l?l.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=l,e[8]=j):j=e[8];let p=j,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==m?(b=async z=>{z.stopPropagation(),z.preventDefault(),m({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,a.jsx)(Wt,{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]=m,e[13]=b):b=e[13];let h=b,k;e[14]!==n||e[15]!==f||e[16]!==l?(k=async()=>{n.open(),f({title:"Folder name",onConfirm:async z=>{l==null||l.createFolder(z,n.id)}})},e[14]=n,e[15]=f,e[16]=l,e[17]=k):k=e[17];let F=ee(k),_;e[18]!==n||e[19]!==f||e[20]!==l?(_=async()=>{n.open(),f({title:"File name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id})}})},e[18]=n,e[19]=f,e[20]=l,e[21]=_):_=e[21];let M=ee(_),D;e[22]!==n||e[23]!==f||e[24]!==l?(D=async()=>{n.open(),f({title:"Notebook name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id,type:"notebook"})}})},e[22]=n,e[23]=f,e[24]=l,e[25]=D):D=e[25];let S=ee(D),C;e[26]!==n.data.name||e[27]!==n.id||e[28]!==l?(C=async()=>{l&&await l.copy(n.id,Ra(n.data.name))},e[26]=n.data.name,e[27]=n.id,e[28]=l,e[29]=C):C=e[29];let O=ee(C),P;e[30]===Symbol.for("react.memo_cache_sentinel")?(P=ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=P):P=e[30];let R,J;e[31]===n?(R=e[32],J=e[33]):(R=z=>{z.stopPropagation(),n.data.isDirectory&&n.toggle()},J=(0,a.jsx)(Sn,{node:n}),e[31]=n,e[32]=R,e[33]=J);let oe=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",V;e[34]===oe?V=e[35]:(V=ie("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",oe),e[34]=oe,e[35]=V);let Q;e[36]!==y||e[37]!==s||e[38]!==n.data.isMarimoFile?(Q=n.data.isMarimoFile?(0,a.jsx)(Ba,{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",at[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]!==p||e[41]!==n?(L=n.isEditing?(0,a.jsx)(ba,{node:n}):(0,a.jsx)(Fn,{node:n,onOpenMarimoFile:p}),e[40]=p,e[41]=n,e[42]=L):L=e[42];let B;e[43]===n?B=e[44]:(B=!n.data.isDirectory&&(0,a.jsxs)(E,{onSelect:()=>n.select(),"data-testid":"file-explorer-open-file-menu-item",children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=n,e[44]=B);let q;e[45]!==n.data.isDirectory||e[46]!==n.data.path||e[47]!==r?(q=!n.data.isDirectory&&!Fe()&&(0,a.jsxs)(E,{onSelect:()=>{r({path:n.data.path})},"data-testid":"file-explorer-open-external-menu-item",children:[(0,a.jsx)($e,{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]=q):q=e[48];let Y;e[49]!==M||e[50]!==F||e[51]!==S||e[52]!==n.data.isDirectory?(Y=n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(E,{onSelect:()=>S(),"data-testid":"file-explorer-create-notebook-menu-item",children:[(0,a.jsx)(yt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(E,{onSelect:()=>M(),"data-testid":"file-explorer-create-file-menu-item",children:[(0,a.jsx)(jt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(E,{onSelect:()=>F(),"data-testid":"file-explorer-create-folder-menu-item",children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=M,e[50]=F,e[51]=S,e[52]=n.data.isDirectory,e[53]=Y):Y=e[53];let U;e[54]===n?U=e[55]:(U=(0,a.jsx)(pa,{onSelect:()=>n.edit(),testId:"file-explorer-rename-menu-item"}),e[54]=n,e[55]=U);let W;e[56]===O?W=e[57]:(W=(0,a.jsx)(ga,{onSelect:O,testId:"file-explorer-duplicate-menu-item"}),e[56]=O,e[57]=W);let G;e[58]===n.data.path?G=e[59]:(G=async()=>{await je(n.data.path),te({title:"Copied to clipboard"})},e[58]=n.data.path,e[59]=G);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]===G?N=e[62]:(N=(0,a.jsxs)(E,{onSelect:G,"data-testid":"file-explorer-copy-path-menu-item",children:[ae,"Copy path"]}),e[61]=G,e[62]=N);let T;e[63]!==n.data.path||e[64]!==l?(T=l&&(0,a.jsxs)(E,{onSelect:async()=>{await je(l.relativeFromRoot(n.data.path)),te({title:"Copied to clipboard"})},"data-testid":"file-explorer-copy-relative-path-menu-item",children:[(0,a.jsx)(bt,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=n.data.path,e[64]=l,e[65]=T):T=e[65];let I;e[66]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)(ue,{}),e[66]=I):I=e[66];let K;e[67]!==s||e[68]!==v||e[69]!==n.data?(K=()=>{let{path:z}=n.data;v(Dt[s](z))},e[67]=s,e[68]=v,e[69]=n.data,e[70]=K):K=e[70];let X;e[71]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(na,{className:ge}),e[71]=X):X=e[71];let Z;e[72]===K?Z=e[73]:(Z=(0,a.jsxs)(E,{onSelect:K,"data-testid":"file-explorer-insert-snippet-menu-item",children:[X,"Insert snippet for reading file"]}),e[72]=K,e[73]=Z);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:z}=n.data;await je(Dt[s](z))},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)(Vt,{className:ge}),e[77]=ve):ve=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(E,{onSelect:ne,"data-testid":"file-explorer-copy-snippet-menu-item",children:[ve,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==p||e[81]!==n.data.isMarimoFile?(de=n.data.isMarimoFile&&!Fe()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(E,{onSelect:p,"data-testid":"file-explorer-open-notebook-menu-item",children:[(0,a.jsx)(Ka,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=p,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 z=await d({path:n.data.path});z.isBase64&&z.contents?Se(dt(Oe(z.contents,z.mimeType||"application/octet-stream")),n.data.name):Se(new Blob([z.contents||""]),n.data.name)},"data-testid":"file-explorer-download-menu-item",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]===h?pe=e[91]:(pe=(0,a.jsx)(ja,{onSelect:h,testId:"file-explorer-delete-menu-item"}),e[90]=h,e[91]=pe);let he;e[92]!==B||e[93]!==q||e[94]!==Y||e[95]!==U||e[96]!==W||e[97]!==N||e[98]!==T||e[99]!==Z||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(ua,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[B,q,Y,U,W,N,T,I,Z,ce,de,we,me,pe]}),e[92]=B,e[93]=q,e[94]=Y,e[95]=U,e[96]=W,e[97]=N,e[98]=T,e[99]=Z,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==V||e[106]!==Q||e[107]!==L||e[108]!==he?(xe=(0,a.jsxs)("span",{className:V,children:[Q,L,he]}),e[105]=V,e[106]=Q,e[107]=L,e[108]=he,e[109]=xe):xe=e[109];let Ne;return e[110]!==o||e[111]!==i||e[112]!==R||e[113]!==J||e[114]!==xe?(Ne=(0,a.jsxs)("div",{style:i,ref:o,className:P,draggable:!0,onClick:R,children:[J,xe]}),e[110]=o,e[111]=i,e[112]=R,e[113]=J,e[114]=xe,e[115]=Ne):Ne=e[115],Ne},Sn=t=>{let e=(0,be.c)(3),{node:n}=t;if(!n.data.isDirectory){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=o):o=e[0],o}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Re,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Tt(t,e){t.stopPropagation(),t.preventDefault(),qa(e)}function Ot(t,e){if(e)return t;let n=[];for(let i of t){if(Cn(i.name))continue;let o=i;if(i.children){let r=Ot(i.children,e);r!==i.children&&(o={...i,children:r})}n.push(o)}return n}function Cn(t){return!!t.startsWith(".")}function Mn(){return null}function Dn(t){let{parentNode:e}=t;return!e.data.isDirectory}var $t=fe(),zn=Ge("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},We),Pn=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:o,getInputProps:r,isDragActive:d}=zt(i),c;e[1]===o?c=e[2]:(c=o(),e[1]=o,e[2]=c);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=ie("flex flex-col overflow-hidden relative"),e[3]=x):x=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 m;e[8]===y?m=e[9]:(m=(0,a.jsx)("input",{...y}),e[8]=y,e[9]=m);let f;e[10]===d?f=e[11]:(f=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]=f);let u;e[12]===n?u=e[13]:(u=(0,a.jsx)(wn,{height:n}),e[12]=n,e[13]=u);let g;return e[14]!==c||e[15]!==s||e[16]!==m||e[17]!==f||e[18]!==u?(g=(0,a.jsx)(on,{children:(0,a.jsxs)("div",{...c,className:x,style:s,children:[m,f,u]})}),e[14]=c,e[15]=s,e[16]=m,e[17]=f,e[18]=u,e[19]=g):g=e[19],g},Tn=33,On=()=>{let t=(0,$t.c)(36),{ref:e,height:n}=$a(),i=n===void 0?500:n,[o,r]=ke(zn),d=ye(aa).length,c;e:{if(!o.hasUserInteracted&&d>0){if(o.openSections.includes("remote-storage")){c=o.openSections;break e}let P;t[0]===o.openSections?P=t[1]:(P=[...o.openSections,"remote-storage"],t[0]=o.openSections,t[1]=P),c=P;break e}c=o.openSections}let x=c,s;t[2]===r?s=t[3]:(s=P=>{r({openSections:P,hasUserInteracted:!0})},t[2]=r,t[3]=s);let y=s,m=i-Tn*2,f;t[4]===x?f=t[5]:(f=x.includes("remote-storage"),t[4]=x,t[5]=f);let u=f,g;t[6]!==x||t[7]!==u?(g=u&&x.includes("files"),t[6]=x,t[7]=u,t[8]=g):g=t[8];let w=g,v;t[9]!==m||t[10]!==w?(v=w?Math.round(m*.4):m,t[9]=m,t[10]=w,t[11]=v):v=t[11];let l=v,j=Math.max(200,w?m-l:m),p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(rt,{className:"w-4 h-4"}),t[12]=p):p=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 h;t[15]===b?h=t[16]:(h=(0,a.jsxs)(ft,{children:[p," Remote storage",b]}),t[15]=b,t[16]=h);let k;t[17]===l?k=t[18]:(k={maxHeight:l},t[17]=l,t[18]=k);let F;t[19]===Symbol.for("react.memo_cache_sentinel")?(F=(0,a.jsx)(rn,{}),t[19]=F):F=t[19];let _;t[20]===k?_=t[21]:(_=(0,a.jsx)(ut,{className:"overflow-auto",style:k,children:F}),t[20]=k,t[21]=_);let M;t[22]!==_||t[23]!==h?(M=(0,a.jsxs)(xt,{value:"remote-storage",children:[h,_]}),t[22]=_,t[23]=h,t[24]=M):M=t[24];let D;t[25]===Symbol.for("react.memo_cache_sentinel")?(D=(0,a.jsxs)(ft,{children:[(0,a.jsx)(nt,{className:"w-4 h-4"}),"Files"]}),t[25]=D):D=t[25];let S;t[26]===j?S=t[27]:(S=(0,a.jsxs)(xt,{value:"files",children:[D,(0,a.jsx)(ut,{children:(0,a.jsx)(Pn,{height:j})})]}),t[26]=j,t[27]=S);let C;t[28]!==y||t[29]!==x||t[30]!==M||t[31]!==S?(C=(0,a.jsxs)(Ut,{type:"multiple",value:x,onValueChange:y,children:[M,S]}),t[28]=y,t[29]=x,t[30]=M,t[31]=S,t[32]=C):C=t[32];let O;return t[33]!==e||t[34]!==C?(O=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:C}),t[33]=e,t[34]=C,t[35]=O):O=t[35],O};export{On as default};
26
+ `};var pn=fe(),hn=1024*1024*100,xn=5;function zt(t){let e=(0,pn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:o}=Pe(),r;e[2]===o?r=e[3]:(r=async c=>{if(c.length===0)return;let x=c.length===1;await Xt(x?"Uploading file...":"Uploading files...",async s=>{s.addTotal(c.length),await Ea(c,xn,async y=>{let m=bn(gn(y)),f="";m&&(f=_a.guessDeliminator(m).dirname(m)),await o({path:f,type:"file",name:y.name,file:y}),s.increment(1)}),await mn()},{title:x?"File uploaded":`${c.length} files uploaded`})},e[2]=o,e[3]=r);let d;return e[4]!==i||e[5]!==r?(d={multiple:!0,maxSize:hn,onError:jn,onDropRejected:fn,onDrop:r,...i},e[4]=i,e[5]=r,e[6]=d):d=e[6],Fa(d)}function fn(t){te({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(un)}),variant:"danger"})}function un(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(yn).join(", "),")"]},t.file.name)}function yn(t){return t.message}function jn(t){Me.error(t),te({title:"File upload failed",description:t.message,variant:"danger"})}function gn(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 bn(t){if(t)return t.replace(/^\/+/,"")}var be=fe(),vn=Ge("marimo:showHiddenFiles",!0,We,{getOnInit:!0}),Pt=$.createContext(null);const wn=t=>{let e=(0,be.c)(73),{height:n}=t,i=(0,$.useRef)(null),o=sn(),[r]=ke(Mt),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,x]=(0,$.useState)(d),[s,y]=(0,$.useState)(null),[m,f]=ke(vn),{openPrompt:u}=ct(),[g,w]=ke(dn),v;e[1]===r?v=e[2]:(v=()=>r.initialize(x),e[1]=r,e[2]=v);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3];let{isPending:j,error:p}=Ae(v,l),b;e[4]!==g||e[5]!==r?(b=()=>r.refreshAll(Object.keys(g).filter(N=>g[N])),e[4]=g,e[5]=r,e[6]=b):b=e[6];let h=ee(b),k;e[7]!==f||e[8]!==m?(k=()=>{f(!m)},e[7]=f,e[8]=m,e[9]=k):k=e[9];let F=ee(k),_;e[10]!==u||e[11]!==r?(_=async()=>{u({title:"Folder name",onConfirm:async N=>{r.createFolder(N,null)}})},e[10]=u,e[11]=r,e[12]=_):_=e[12];let M=ee(_),D;e[13]!==u||e[14]!==r?(D=async()=>{u({title:"File name",onConfirm:async N=>{r.createFile({name:N,parentId:null})}})},e[13]=u,e[14]=r,e[15]=D):D=e[15];let S=ee(D),C;e[16]!==u||e[17]!==r?(C=async()=>{u({title:"Notebook name",onConfirm:async N=>{r.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=u,e[17]=r,e[18]=C):C=e[18];let O=ee(C),P;e[19]===w?P=e[20]:(P=()=>{var N;(N=i.current)==null||N.closeAll(),w({})},e[19]=w,e[20]=P);let R=ee(P),J;e[21]!==c||e[22]!==m?(J=Ot(c,m),e[21]=c,e[22]=m,e[23]=J):J=e[23];let oe=J;if(j){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(ma,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(p){let N;return e[25]===p?N=e[26]:(N=(0,a.jsx)(mt,{error:p}),e[25]=p,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 T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=(0,a.jsx)(A,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ze,{size:16})}),e[28]=T):T=e[28];let I;e[29]===s.name?I=e[30]:(I=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[T,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=I);let K;e[31]!==s.path||e[32]!==r?(K=ne=>Tt(ne,r.relativeFromRoot(s.path)),e[31]=s.path,e[32]=r,e[33]=K):K=e[33];let X;e[34]!==s||e[35]!==K?(X=(0,a.jsx)($.Suspense,{children:(0,a.jsx)(cn,{onOpenNotebook:K,file:s})}),e[34]=s,e[35]=K,e[36]=X):X=e[36];let Z;return e[37]!==I||e[38]!==X?(Z=(0,a.jsxs)(a.Fragment,{children:[I,X]}),e[37]=I,e[38]=X,e[39]=Z):Z=e[39],Z}let V;e[40]!==R||e[41]!==S||e[42]!==M||e[43]!==O||e[44]!==F||e[45]!==h||e[46]!==m||e[47]!==r?(V=(0,a.jsx)(kn,{onRefresh:h,onHidden:F,showHiddenFiles:m,onCreateFile:S,onCreateNotebook:O,onCreateFolder:M,onCollapseAll:R,tree:r}),e[40]=R,e[41]=S,e[42]=M,e[43]=O,e[44]=F,e[45]=h,e[46]=m,e[47]=r,e[48]=V):V=e[48];let Q=n-33,L,B,q;e[49]===r?(L=e[50],B=e[51],q=e[52]):(L=async N=>{let{ids:T}=N;for(let I of T)await r.delete(I)},B=async N=>{let{id:T,name:I}=N;await r.rename(T,I)},q=async N=>{let{dragIds:T,parentId:I}=N;await r.move(T,I)},e[49]=r,e[50]=L,e[51]=B,e[52]=q);let Y;e[53]===Symbol.for("react.memo_cache_sentinel")?(Y=N=>{let T=N[0];T&&(T.data.isDirectory||y(T.data))},e[53]=Y):Y=e[53];let U;e[54]!==g||e[55]!==w||e[56]!==r?(U=async N=>{if(await r.expand(N)){let T=g[N]??!1;w({...g,[N]:!T})}},e[54]=g,e[55]=w,e[56]=r,e[57]=U):U=e[57];let W;e[58]!==o||e[59]!==g||e[60]!==Q||e[61]!==L||e[62]!==B||e[63]!==q||e[64]!==U||e[65]!==oe?(W=(0,a.jsx)(ya,{width:"100%",ref:i,height:Q,className:"h-full",data:oe,initialOpenState:g,openByDefault:!1,dndManager:o,renderCursor:Mn,disableDrop:Dn,onDelete:L,onRename:B,onMove:q,onSelect:Y,onToggle:U,padding:15,rowHeight:30,indent:Nn,overscanCount:1e3,disableMultiSelection:!0,children:_n}),e[58]=o,e[59]=g,e[60]=Q,e[61]=L,e[62]=B,e[63]=q,e[64]=U,e[65]=oe,e[66]=W):W=e[66];let G;e[67]!==W||e[68]!==r?(G=(0,a.jsx)(Pt,{value:r,children:W}),e[67]=W,e[68]=r,e[69]=G):G=e[69];let ae;return e[70]!==V||e[71]!==G?(ae=(0,a.jsxs)(a.Fragment,{children:[V,G]}),e[70]=V,e[71]=G,e[72]=ae):ae=e[72],ae};var Nn=15,kn=t=>{let e=(0,be.c)(42),{onRefresh:n,onHidden:i,showHiddenFiles:o,onCreateFile:r,onCreateNotebook:d,onCreateFolder:c,onCollapseAll:x}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},e[0]=s):s=e[0];let{getRootProps:y,getInputProps:m}=zt(s),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(yt,{size:16}),e[1]=f):f=e[1];let u;e[2]===d?u=e[3]:(u=(0,a.jsx)(H,{content:"Add notebook",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-notebook-button",onClick:d,variant:"text",size:"xs",children:f})}),e[2]=d,e[3]=u);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(jt,{size:16}),e[4]=g):g=e[4];let w;e[5]===r?w=e[6]:(w=(0,a.jsx)(H,{content:"Add file",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-file-button",onClick:r,variant:"text",size:"xs",children:g})}),e[5]=r,e[6]=w);let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)(gt,{size:16}),e[7]=v):v=e[7];let l;e[8]===c?l=e[9]:(l=(0,a.jsx)(H,{content:"Add folder",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-folder-button",onClick:c,variant:"text",size:"xs",children:v})}),e[8]=c,e[9]=l);let j;e[10]===y?j=e[11]:(j=y({}),e[10]=y,e[11]=j);let p,b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=Zt({variant:"text",size:"xs"}),p=(0,a.jsx)(ka,{size:16}),e[12]=p,e[13]=b):(p=e[12],b=e[13]);let h;e[14]===j?h=e[15]:(h=(0,a.jsx)(H,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...j,className:b,children:p})}),e[14]=j,e[15]=h);let k;e[16]===m?k=e[17]:(k=m({}),e[16]=m,e[17]=k);let F;e[18]===k?F=e[19]:(F=(0,a.jsx)("input",{...k,type:"file"}),e[18]=k,e[19]=F);let _;e[20]===n?_=e[21]:(_=(0,a.jsx)(ht,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=_);let M=o?"Hide hidden files":"Show hidden files",D;e[22]===o?D=e[23]:(D=o?(0,a.jsx)(Et,{size:16,className:"text-primary"}):(0,a.jsx)(la,{size:16}),e[22]=o,e[23]=D);let S;e[24]!==i||e[25]!==D?(S=(0,a.jsx)(A,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:D}),e[24]=i,e[25]=D,e[26]=S):S=e[26];let C;e[27]!==M||e[28]!==S?(C=(0,a.jsx)(H,{content:M,children:S}),e[27]=M,e[28]=S,e[29]=C):C=e[29];let O;e[30]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(Wa,{size:16}),e[30]=O):O=e[30];let P;e[31]===x?P=e[32]:(P=(0,a.jsx)(H,{content:"Collapse all folders",children:(0,a.jsx)(A,{"data-testid":"file-explorer-collapse-button",onClick:x,variant:"text",size:"xs",children:O})}),e[31]=x,e[32]=P);let R;return e[33]!==h||e[34]!==F||e[35]!==_||e[36]!==C||e[37]!==P||e[38]!==u||e[39]!==w||e[40]!==l?(R=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[u,w,l,h,F,_,C,P]}),e[33]=h,e[34]=F,e[35]=_,e[36]=C,e[37]=P,e[38]=u,e[39]=w,e[40]=l,e[41]=R):R=e[41],R},Fn=t=>{let e=(0,be.c)(9),{node:n,onOpenMarimoFile:i}=t,o;e[0]===n?o=e[1]:(o=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=o);let r;e[2]!==n.data.isMarimoFile||e[3]!==i?(r=n.data.isMarimoFile&&!Fe()&&(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)($e,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=r):r=e[4];let d;return e[5]!==n.data.name||e[6]!==o||e[7]!==r?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:o,children:[n.data.name,r]}),e[5]=n.data.name,e[6]=o,e[7]=r,e[8]=d):d=e[8],d},_n=t=>{let e=(0,be.c)(116),{node:n,style:i,dragHandle:o}=t,{openFile:r,sendFileDetails:d}=Pe(),c=ye(Ke),x;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(x=n.data.isDirectory?"directory":ia(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=x):x=e[2];let s=x,y=ca[s],{openConfirm:m,openPrompt:f}=ct(),{createNewCell:u}=Rt(),g=Da(),w;e[3]!==u||e[4]!==g?(w=z=>{u({code:z,before:!1,cellId:g??"__end__"})},e[3]=u,e[4]=g,e[5]=w):w=e[5];let v=w,l=(0,$.use)(Pt),j;e[6]!==n.data.path||e[7]!==l?(j=async z=>{Tt(z,l?l.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=l,e[8]=j):j=e[8];let p=j,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==m?(b=async z=>{z.stopPropagation(),z.preventDefault(),m({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,a.jsx)(Wt,{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]=m,e[13]=b):b=e[13];let h=b,k;e[14]!==n||e[15]!==f||e[16]!==l?(k=async()=>{n.open(),f({title:"Folder name",onConfirm:async z=>{l==null||l.createFolder(z,n.id)}})},e[14]=n,e[15]=f,e[16]=l,e[17]=k):k=e[17];let F=ee(k),_;e[18]!==n||e[19]!==f||e[20]!==l?(_=async()=>{n.open(),f({title:"File name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id})}})},e[18]=n,e[19]=f,e[20]=l,e[21]=_):_=e[21];let M=ee(_),D;e[22]!==n||e[23]!==f||e[24]!==l?(D=async()=>{n.open(),f({title:"Notebook name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id,type:"notebook"})}})},e[22]=n,e[23]=f,e[24]=l,e[25]=D):D=e[25];let S=ee(D),C;e[26]!==n.data.name||e[27]!==n.id||e[28]!==l?(C=async()=>{l&&await l.copy(n.id,Ra(n.data.name))},e[26]=n.data.name,e[27]=n.id,e[28]=l,e[29]=C):C=e[29];let O=ee(C),P;e[30]===Symbol.for("react.memo_cache_sentinel")?(P=ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=P):P=e[30];let R,J;e[31]===n?(R=e[32],J=e[33]):(R=z=>{z.stopPropagation(),n.data.isDirectory&&n.toggle()},J=(0,a.jsx)(Sn,{node:n}),e[31]=n,e[32]=R,e[33]=J);let oe=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",V;e[34]===oe?V=e[35]:(V=ie("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",oe),e[34]=oe,e[35]=V);let Q;e[36]!==y||e[37]!==s||e[38]!==n.data.isMarimoFile?(Q=n.data.isMarimoFile?(0,a.jsx)(Ba,{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",at[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]!==p||e[41]!==n?(L=n.isEditing?(0,a.jsx)(ba,{node:n}):(0,a.jsx)(Fn,{node:n,onOpenMarimoFile:p}),e[40]=p,e[41]=n,e[42]=L):L=e[42];let B;e[43]===n?B=e[44]:(B=!n.data.isDirectory&&(0,a.jsxs)(E,{onSelect:()=>n.select(),"data-testid":"file-explorer-open-file-menu-item",children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=n,e[44]=B);let q;e[45]!==n.data.isDirectory||e[46]!==n.data.path||e[47]!==r?(q=!n.data.isDirectory&&!Fe()&&(0,a.jsxs)(E,{onSelect:()=>{r({path:n.data.path})},"data-testid":"file-explorer-open-external-menu-item",children:[(0,a.jsx)($e,{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]=q):q=e[48];let Y;e[49]!==M||e[50]!==F||e[51]!==S||e[52]!==n.data.isDirectory?(Y=n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(E,{onSelect:()=>S(),"data-testid":"file-explorer-create-notebook-menu-item",children:[(0,a.jsx)(yt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(E,{onSelect:()=>M(),"data-testid":"file-explorer-create-file-menu-item",children:[(0,a.jsx)(jt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(E,{onSelect:()=>F(),"data-testid":"file-explorer-create-folder-menu-item",children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=M,e[50]=F,e[51]=S,e[52]=n.data.isDirectory,e[53]=Y):Y=e[53];let U;e[54]===n?U=e[55]:(U=(0,a.jsx)(pa,{onSelect:()=>n.edit(),testId:"file-explorer-rename-menu-item"}),e[54]=n,e[55]=U);let W;e[56]===O?W=e[57]:(W=(0,a.jsx)(ga,{onSelect:O,testId:"file-explorer-duplicate-menu-item"}),e[56]=O,e[57]=W);let G;e[58]===n.data.path?G=e[59]:(G=async()=>{await je(n.data.path),te({title:"Copied to clipboard"})},e[58]=n.data.path,e[59]=G);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]===G?N=e[62]:(N=(0,a.jsxs)(E,{onSelect:G,"data-testid":"file-explorer-copy-path-menu-item",children:[ae,"Copy path"]}),e[61]=G,e[62]=N);let T;e[63]!==n.data.path||e[64]!==l?(T=l&&(0,a.jsxs)(E,{onSelect:async()=>{await je(l.relativeFromRoot(n.data.path)),te({title:"Copied to clipboard"})},"data-testid":"file-explorer-copy-relative-path-menu-item",children:[(0,a.jsx)(bt,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=n.data.path,e[64]=l,e[65]=T):T=e[65];let I;e[66]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)(ue,{}),e[66]=I):I=e[66];let K;e[67]!==s||e[68]!==v||e[69]!==n.data?(K=()=>{let{path:z}=n.data;v(Dt[s](z))},e[67]=s,e[68]=v,e[69]=n.data,e[70]=K):K=e[70];let X;e[71]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(na,{className:ge}),e[71]=X):X=e[71];let Z;e[72]===K?Z=e[73]:(Z=(0,a.jsxs)(E,{onSelect:K,"data-testid":"file-explorer-insert-snippet-menu-item",children:[X,"Insert snippet for reading file"]}),e[72]=K,e[73]=Z);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:z}=n.data;await je(Dt[s](z))},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)(Vt,{className:ge}),e[77]=ve):ve=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(E,{onSelect:ne,"data-testid":"file-explorer-copy-snippet-menu-item",children:[ve,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==p||e[81]!==n.data.isMarimoFile?(de=n.data.isMarimoFile&&!Fe()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(E,{onSelect:p,"data-testid":"file-explorer-open-notebook-menu-item",children:[(0,a.jsx)(Ka,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=p,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 z=await d({path:n.data.path});z.isBase64&&z.contents?Se(dt(Oe(z.contents,z.mimeType||"application/octet-stream")),n.data.name):Se(new Blob([z.contents||""]),n.data.name)},"data-testid":"file-explorer-download-menu-item",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]===h?pe=e[91]:(pe=(0,a.jsx)(ja,{onSelect:h,testId:"file-explorer-delete-menu-item"}),e[90]=h,e[91]=pe);let he;e[92]!==B||e[93]!==q||e[94]!==Y||e[95]!==U||e[96]!==W||e[97]!==N||e[98]!==T||e[99]!==Z||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(ua,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[B,q,Y,U,W,N,T,I,Z,ce,de,we,me,pe]}),e[92]=B,e[93]=q,e[94]=Y,e[95]=U,e[96]=W,e[97]=N,e[98]=T,e[99]=Z,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==V||e[106]!==Q||e[107]!==L||e[108]!==he?(xe=(0,a.jsxs)("span",{className:V,children:[Q,L,he]}),e[105]=V,e[106]=Q,e[107]=L,e[108]=he,e[109]=xe):xe=e[109];let Ne;return e[110]!==o||e[111]!==i||e[112]!==R||e[113]!==J||e[114]!==xe?(Ne=(0,a.jsxs)("div",{style:i,ref:o,className:P,draggable:!0,onClick:R,children:[J,xe]}),e[110]=o,e[111]=i,e[112]=R,e[113]=J,e[114]=xe,e[115]=Ne):Ne=e[115],Ne},Sn=t=>{let e=(0,be.c)(3),{node:n}=t;if(!n.data.isDirectory){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=o):o=e[0],o}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Re,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Tt(t,e){t.stopPropagation(),t.preventDefault(),qa(e)}function Ot(t,e){if(e)return t;let n=[];for(let i of t){if(Cn(i.name))continue;let o=i;if(i.children){let r=Ot(i.children,e);r!==i.children&&(o={...i,children:r})}n.push(o)}return n}function Cn(t){return!!t.startsWith(".")}function Mn(){return null}function Dn(t){let{parentNode:e}=t;return!e.data.isDirectory}var $t=fe(),zn=Ge("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},We),Pn=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:o,getInputProps:r,isDragActive:d}=zt(i),c;e[1]===o?c=e[2]:(c=o(),e[1]=o,e[2]=c);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=ie("flex flex-col overflow-hidden relative"),e[3]=x):x=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 m;e[8]===y?m=e[9]:(m=(0,a.jsx)("input",{...y}),e[8]=y,e[9]=m);let f;e[10]===d?f=e[11]:(f=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]=f);let u;e[12]===n?u=e[13]:(u=(0,a.jsx)(wn,{height:n}),e[12]=n,e[13]=u);let g;return e[14]!==c||e[15]!==s||e[16]!==m||e[17]!==f||e[18]!==u?(g=(0,a.jsx)(on,{children:(0,a.jsxs)("div",{...c,className:x,style:s,children:[m,f,u]})}),e[14]=c,e[15]=s,e[16]=m,e[17]=f,e[18]=u,e[19]=g):g=e[19],g},Tn=33,On=()=>{let t=(0,$t.c)(36),{ref:e,height:n}=$a(),i=n===void 0?500:n,[o,r]=ke(zn),d=ye(aa).length,c;e:{if(!o.hasUserInteracted&&d>0){if(o.openSections.includes("remote-storage")){c=o.openSections;break e}let P;t[0]===o.openSections?P=t[1]:(P=[...o.openSections,"remote-storage"],t[0]=o.openSections,t[1]=P),c=P;break e}c=o.openSections}let x=c,s;t[2]===r?s=t[3]:(s=P=>{r({openSections:P,hasUserInteracted:!0})},t[2]=r,t[3]=s);let y=s,m=i-Tn*2,f;t[4]===x?f=t[5]:(f=x.includes("remote-storage"),t[4]=x,t[5]=f);let u=f,g;t[6]!==x||t[7]!==u?(g=u&&x.includes("files"),t[6]=x,t[7]=u,t[8]=g):g=t[8];let w=g,v;t[9]!==m||t[10]!==w?(v=w?Math.round(m*.4):m,t[9]=m,t[10]=w,t[11]=v):v=t[11];let l=v,j=Math.max(200,w?m-l:m),p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(rt,{className:"w-4 h-4"}),t[12]=p):p=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 h;t[15]===b?h=t[16]:(h=(0,a.jsxs)(ft,{children:[p," Remote storage",b]}),t[15]=b,t[16]=h);let k;t[17]===l?k=t[18]:(k={maxHeight:l},t[17]=l,t[18]=k);let F;t[19]===Symbol.for("react.memo_cache_sentinel")?(F=(0,a.jsx)(rn,{}),t[19]=F):F=t[19];let _;t[20]===k?_=t[21]:(_=(0,a.jsx)(ut,{className:"overflow-auto",style:k,children:F}),t[20]=k,t[21]=_);let M;t[22]!==_||t[23]!==h?(M=(0,a.jsxs)(xt,{value:"remote-storage",children:[h,_]}),t[22]=_,t[23]=h,t[24]=M):M=t[24];let D;t[25]===Symbol.for("react.memo_cache_sentinel")?(D=(0,a.jsxs)(ft,{children:[(0,a.jsx)(nt,{className:"w-4 h-4"}),"Files"]}),t[25]=D):D=t[25];let S;t[26]===j?S=t[27]:(S=(0,a.jsxs)(xt,{value:"files",children:[D,(0,a.jsx)(ut,{children:(0,a.jsx)(Pn,{height:j})})]}),t[26]=j,t[27]=S);let C;t[28]!==y||t[29]!==x||t[30]!==M||t[31]!==S?(C=(0,a.jsxs)(Ut,{type:"multiple",value:x,onValueChange:y,children:[M,S]}),t[28]=y,t[29]=x,t[30]=M,t[31]=S,t[32]=C):C=t[32];let O;return t[33]!==e||t[34]!==C?(O=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:C}),t[33]=e,t[34]=C,t[35]=O):O=t[35],O};export{On as default};