@marimo-team/frontend 0.19.8-dev37 → 0.19.8-dev39

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 (67) hide show
  1. package/dist/assets/{CellStatus-BjDayMOF.js → CellStatus-D-CCv4h6.js} +1 -1
  2. package/dist/assets/{JsonOutput-BUok9dqY.js → JsonOutput-CU0ad2LH.js} +1 -1
  3. package/dist/assets/{MarimoErrorOutput-Dxf6p5lw.js → MarimoErrorOutput-BydcsyYP.js} +1 -1
  4. package/dist/assets/{RenderHTML-BUCe3qCj.js → RenderHTML-3amWMGgo.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-J44RQi7o.js → add-cell-with-ai-B07D0AiE.js} +1 -1
  6. package/dist/assets/{add-database-form-mXHOy5uZ.js → add-database-form-BnEY6X5s.js} +1 -1
  7. package/dist/assets/{agent-panel-Cf8Ij8-7.js → agent-panel-C1O0Y8Bi.js} +1 -1
  8. package/dist/assets/{ai-model-dropdown-DC4t5PJE.js → ai-model-dropdown-Cugcw6NV.js} +4 -4
  9. package/dist/assets/{app-config-button-xVJ4tqzu.js → app-config-button-66OSct-U.js} +1 -1
  10. package/dist/assets/{cell-editor-DqRAVfCm.js → cell-editor-DZgQrVMs.js} +1 -1
  11. package/dist/assets/{cell-link-dnd6DfEI.js → cell-link-B37i0WNz.js} +1 -1
  12. package/dist/assets/{cells-CiFhRLUd.js → cells-B0XKj2oa.js} +1 -1
  13. package/dist/assets/{chat-components-C5FA1-Vu.js → chat-components-BNjAKvAv.js} +1 -1
  14. package/dist/assets/{chat-display-ChS1NL3o.js → chat-display-q9RdcWB-.js} +1 -1
  15. package/dist/assets/{chat-panel-Duk4139r.js → chat-panel-viPqlAXC.js} +1 -1
  16. package/dist/assets/{column-preview-BUTci9vI.js → column-preview-DrmYyyvE.js} +1 -1
  17. package/dist/assets/{command-MHa10zT2.js → command-DTFQw11F.js} +1 -1
  18. package/dist/assets/{command-palette-CV-A8WzZ.js → command-palette-CrOe4bpD.js} +1 -1
  19. package/dist/assets/{common-CR6DwVIy.js → common-C0Pspoza.js} +1 -1
  20. package/dist/assets/{datasource-C7Acf9BM.js → datasource-2_-ICoTV.js} +1 -1
  21. package/dist/assets/{dependency-graph-panel-n8clB1B4.js → dependency-graph-panel-z8kf8Tus.js} +1 -1
  22. package/dist/assets/{documentation-panel-B4SYV31-.js → documentation-panel-DIp1L-6Y.js} +1 -1
  23. package/dist/assets/{download-CUgZOA9O.js → download-CxmzcjnR.js} +1 -1
  24. package/dist/assets/{edit-page-DTcdRtOK.js → edit-page-Bo-t07GL.js} +3 -3
  25. package/dist/assets/{error-panel-Dp0gIK8O.js → error-panel-Cz3rrpG9.js} +1 -1
  26. package/dist/assets/{file-explorer-panel-BqVToUzC.js → file-explorer-panel-BJWXa6fg.js} +1 -1
  27. package/dist/assets/{floating-outline-CZzxqWyr.js → floating-outline-BSd7WV6r.js} +1 -1
  28. package/dist/assets/{focus-CtXToHnV.js → focus-CZLCQiuh.js} +1 -1
  29. package/dist/assets/{form-CvVbbh8Y.js → form-BQhIjeKF.js} +1 -1
  30. package/dist/assets/{globals-D1aM0aUX.js → globals-DvWD0xHx.js} +1 -1
  31. package/dist/assets/{home-page-DJMymeT8.js → home-page-BaZhe30b.js} +1 -1
  32. package/dist/assets/{hooks-STSuFYve.js → hooks-B2h7NTXb.js} +1 -1
  33. package/dist/assets/{html-to-image-BKGhRUqR.js → html-to-image-Cc7t14sm.js} +1 -1
  34. package/dist/assets/{index-GARjwpYQ.js → index-BSNJ0Y0E.js} +3 -3
  35. package/dist/assets/{kiosk-mode-B93ch1Yg.js → kiosk-mode-S90PbrZr.js} +1 -1
  36. package/dist/assets/{layout-DWzvYkJc.js → layout-BRVYycwo.js} +1 -1
  37. package/dist/assets/{logs-panel-Cqc-8g3U.js → logs-panel-DU1PTK6I.js} +1 -1
  38. package/dist/assets/{markdown-renderer-Dotqbx_q.js → markdown-renderer-Y3WEBmX7.js} +1 -1
  39. package/dist/assets/{mode-O-1bKZO6.js → mode-CTf4rB7H.js} +1 -1
  40. package/dist/assets/{name-cell-input-Bb4XgE9B.js → name-cell-input-Bmq-KdJ-.js} +1 -1
  41. package/dist/assets/{outline-panel-DvQn81N7.js → outline-panel-Cfpy5BTW.js} +1 -1
  42. package/dist/assets/{packages-panel-CFja8lcb.js → packages-panel-C2SNGD_P.js} +1 -1
  43. package/dist/assets/{panels-DkQNKTXx.js → panels-H6ZOifLe.js} +1 -1
  44. package/dist/assets/{process-output-B1EqjOGn.js → process-output-CdIpMer6.js} +1 -1
  45. package/dist/assets/{readonly-python-code-3nLIGqDx.js → readonly-python-code-o3TsTcFg.js} +1 -1
  46. package/dist/assets/{run-page-CyMNZt0d.js → run-page-C4QFxEzE.js} +1 -1
  47. package/dist/assets/{scratchpad-panel-eznTRPdo.js → scratchpad-panel-9Nh-KCKz.js} +1 -1
  48. package/dist/assets/{session-panel-y6latVrC.js → session-panel-9cibvZIi.js} +1 -1
  49. package/dist/assets/{snippets-panel-Exg8CrcD.js → snippets-panel-BLiaEg0s.js} +1 -1
  50. package/dist/assets/{state-CMAvJZxx.js → state-Q32Iqos3.js} +1 -1
  51. package/dist/assets/{switch-BF1BnESM.js → switch-D5W4wgWK.js} +1 -1
  52. package/dist/assets/{textarea-sdXkC92D.js → textarea-UfsPtSW1.js} +1 -1
  53. package/dist/assets/{tracing-BCW3BhkT.js → tracing-BqFhwuOc.js} +1 -1
  54. package/dist/assets/{tracing-panel-0nE7-znv.js → tracing-panel-R9i0TrmX.js} +2 -2
  55. package/dist/assets/{types-ChPQge47.js → types-DIb0tcCO.js} +1 -1
  56. package/dist/assets/{useAddCell-DQzBfMNz.js → useAddCell-CXRk4Ma4.js} +1 -1
  57. package/dist/assets/{useCellActionButton-ChlSq72t.js → useCellActionButton-Du-bZZ06.js} +1 -1
  58. package/dist/assets/{useDeleteCell-BocCAiDk.js → useDeleteCell-D0DAGwMP.js} +1 -1
  59. package/dist/assets/{useDependencyPanelTab-BUgnrQ1n.js → useDependencyPanelTab-CN5-nxOy.js} +1 -1
  60. package/dist/assets/{useNotebookActions-DuB13MhL.js → useNotebookActions--9xrGXss.js} +1 -1
  61. package/dist/assets/{useRunCells-CNmJhP6h.js → useRunCells-DaW_oMnr.js} +1 -1
  62. package/dist/assets/{useSplitCell-DwvRo6W7.js → useSplitCell-Cjr7nuBc.js} +1 -1
  63. package/dist/assets/{utilities.esm-OH_d3CNC.js → utilities.esm-Bfd1Y8aF.js} +1 -1
  64. package/dist/index.html +31 -31
  65. package/package.json +1 -1
  66. package/src/utils/__tests__/id-tree.test.ts +22 -7
  67. package/src/utils/id-tree.tsx +11 -19
@@ -1 +1 @@
1
- import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ne,u as x}from"./useEvent-BhXAndur.js";import{Hn as ie,Kn as de,Un as se,Wn as re,_ as ce,ai as he,dt as K,w as me,wn as pe,xn as ke}from"./cells-CiFhRLUd.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{a as ue,o as ye,r as be}from"./utils-YqBXNpsM.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as je}from"./requests-B4FYHTZl.js";import{t as f}from"./createLucideIcon-BCdY6lG5.js";import{n as V,r as G}from"./x-ZP5cObgf.js";import{a as ve,m as Ce}from"./download-CUgZOA9O.js";import{t as ge}from"./chevron-right--18M_6o9.js";import{t as Q}from"./circle-plus-haI9GLDP.js";import{t as we}from"./code-xml-CgN_Yig7.js";import{t as Ie}from"./eye-off-AK_9uodG.js";import{n as ze,t as We}from"./play-GLWQQs7F.js";import{t as Me}from"./link-DxicfMbs.js";import{a as _e,n as Se}from"./state-CMAvJZxx.js";import{t as Te}from"./trash-2-B8SQYdQq.js";import{t as Ae}from"./use-toast-T0_cQDma.js";import{r as Ne}from"./mode-O-1bKZO6.js";import{a as De,c as He,n as Re}from"./dialog-tQELcltn.js";import{n as Be}from"./ImperativeModal-DZr52ffu.js";import{t as Ee}from"./copy-BaRrAFL-.js";import{i as Ue}from"./useRunCells-CNmJhP6h.js";import{r as F}from"./html-to-image-BKGhRUqR.js";import{t as Oe}from"./label-C--1sWU6.js";import{t as Pe}from"./useDeleteCell-BocCAiDk.js";import{n as qe,t as Le}from"./icons-DjR3qLG_.js";import{n as $}from"./name-cell-input-Bb4XgE9B.js";import{t as J}from"./multi-icon-BWLbAXq5.js";import{t as Fe}from"./useSplitCell-DwvRo6W7.js";var X=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Ke=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ve(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ge(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Qe=fe(),l=ae(xe(),1);function $e(a){let e=(0,Qe.c)(47),{cell:c,closePopover:u}=a,{createNewCell:h,updateCellConfig:d,updateCellName:j,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:S,markUntouched:T}=me(),A=Fe(),N=Ue(c==null?void 0:c.cellId),D=!x(ce),H=Pe(),{openModal:v}=Be(),R=ne(Se),B=x(be),y=x(ye),oe=x(Ne),b=x(ue),{saveCellConfig:s}=je();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:n,getEditorView:r,name:m,hasOutput:C,hasConsoleOutput:E,status:U}=c,g;e[1]!==o||e[2]!==n.disabled||e[3]!==s||e[4]!==d?(g=async()=>{let t={disabled:!n.disabled};await s({configs:{[o]:t}}),d({cellId:o,config:t})},e[1]=o,e[2]=n.disabled,e[3]=s,e[4]=d,e[5]=g):g=e[5];let O=g,w;e[6]!==o||e[7]!==n.hide_code||e[8]!==r||e[9]!==s||e[10]!==d?(w=async()=>{let t={hide_code:!n.hide_code};await s({configs:{[o]:t}}),d({cellId:o,config:t});let L=r();L&&(t.hide_code?L.contentDOM.blur():L.focus())},e[6]=o,e[7]=n.hide_code,e[8]=r,e[9]=s,e[10]=d,e[11]=w):w=e[11];let P=w,i=o===he,I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(We,{size:13,strokeWidth:1.5}),e[12]=I):I=e[12];let q=U==="running"||U==="queued"||U==="disabled-transitively"||n.disabled,k;e[13]===N?k=e[14]:(k=()=>N(),e[13]=N,e[14]=k);let z;return e[15]!==_||e[16]!==B||e[17]!==b||e[18]!==y||e[19]!==D||e[20]!==o||e[21]!==S||e[22]!==u||e[23]!==n.disabled||e[24]!==n.hide_code||e[25]!==h||e[26]!==H||e[27]!==r||e[28]!==E||e[29]!==C||e[30]!==i||e[31]!==T||e[32]!==p||e[33]!==m||e[34]!==v||e[35]!==s||e[36]!==M||e[37]!==W||e[38]!==R||e[39]!==A||e[40]!==q||e[41]!==k||e[42]!==O||e[43]!==P||e[44]!==d||e[45]!==j?(z=[[{icon:I,label:"Run cell",hotkey:"cell.run",hidden:q,redundant:!0,handle:k},{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!B,handle:()=>{R(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>A({cellId:o})},{icon:(0,l.jsx)(we,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=r();t&&pe({[o]:t})}},{icon:n.hide_code?(0,l.jsx)(ie,{size:13,strokeWidth:1.5}):(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:n.hide_code?"Show code":"Hide code",handle:P,hotkey:"cell.hideCode"},{icon:n.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:n.disabled?"Enable execution":"Disable execution",handle:O,hidden:i}],[{icon:(0,l.jsx)(Le,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"markdown",keepCodeAsIs:!1}),n.hide_code||(await s({configs:{[o]:{hide_code:!0}}}),d({cellId:o,config:{hide_code:!0}}),T({cellId:o})))},hidden:i},{icon:(0,l.jsx)(se,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"sql",keepCodeAsIs:!1}))},hidden:i},{icon:(0,l.jsx)(qe,{}),label:"Toggle as Python",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),ke(t,"python",{force:!0}))},hidden:i}],[{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>h({cellId:o,before:!0}),hidden:i,redundant:!0},{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(G,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>h({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:i},{icon:(0,l.jsx)(G,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:i},{icon:(0,l.jsx)(Ce,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:b!=="columns"||i},{icon:(0,l.jsx)(ge,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:b!=="columns"||i},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:i},{icon:(0,l.jsx)(X,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:i},{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:b!=="columns"||i}],[{icon:(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>ve(o,"result")},{icon:(0,l.jsx)(de,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||E),handle:()=>{S({cellId:o})}}],[{icon:(0,l.jsx)(Ke,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:Ze,handleHeadless:()=>{v((0,l.jsxs)(Re,{children:[(0,l.jsx)(De,{children:(0,l.jsx)(He,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Oe,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)($,{placeholder:"cell name",value:m,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),v(null))},onChange:t=>j({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)($,{placeholder:"cell name",value:m,onChange:t=>j({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:i},{icon:(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(m),tooltip:te(m)?void 0:"Only named cells can be linked to",handle:async()=>{await Ee(Ve(m)),Ae({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!D,variant:"danger",icon:(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),handle:()=>{H({cellId:o})}}]].map(Xe).filter(Je),e[15]=_,e[16]=B,e[17]=b,e[18]=y,e[19]=D,e[20]=o,e[21]=S,e[22]=u,e[23]=n.disabled,e[24]=n.hide_code,e[25]=h,e[26]=H,e[27]=r,e[28]=E,e[29]=C,e[30]=i,e[31]=T,e[32]=p,e[33]=m,e[34]=v,e[35]=s,e[36]=M,e[37]=W,e[38]=R,e[39]=A,e[40]=q,e[41]=k,e[42]=O,e[43]=P,e[44]=d,e[45]=j,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Xe(a){return a.filter(Ye)}function Ye(a){return!a.hidden}function Ze(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ge as n,Y as o,le as r,X as s,$e as t};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ne,u as x}from"./useEvent-BhXAndur.js";import{Hn as ie,Kn as de,Un as se,Wn as re,_ as ce,ai as he,dt as K,w as me,wn as pe,xn as ke}from"./cells-B0XKj2oa.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{a as ue,o as ye,r as be}from"./utils-YqBXNpsM.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as je}from"./requests-B4FYHTZl.js";import{t as f}from"./createLucideIcon-BCdY6lG5.js";import{n as V,r as G}from"./x-ZP5cObgf.js";import{a as ve,m as Ce}from"./download-CxmzcjnR.js";import{t as ge}from"./chevron-right--18M_6o9.js";import{t as Q}from"./circle-plus-haI9GLDP.js";import{t as we}from"./code-xml-CgN_Yig7.js";import{t as Ie}from"./eye-off-AK_9uodG.js";import{n as ze,t as We}from"./play-GLWQQs7F.js";import{t as Me}from"./link-DxicfMbs.js";import{a as _e,n as Se}from"./state-Q32Iqos3.js";import{t as Te}from"./trash-2-B8SQYdQq.js";import{t as Ae}from"./use-toast-T0_cQDma.js";import{r as Ne}from"./mode-CTf4rB7H.js";import{a as De,c as He,n as Re}from"./dialog-tQELcltn.js";import{n as Be}from"./ImperativeModal-DZr52ffu.js";import{t as Ee}from"./copy-BaRrAFL-.js";import{i as Ue}from"./useRunCells-DaW_oMnr.js";import{r as F}from"./html-to-image-Cc7t14sm.js";import{t as Oe}from"./label-C--1sWU6.js";import{t as Pe}from"./useDeleteCell-D0DAGwMP.js";import{n as qe,t as Le}from"./icons-DjR3qLG_.js";import{n as $}from"./name-cell-input-Bmq-KdJ-.js";import{t as J}from"./multi-icon-BWLbAXq5.js";import{t as Fe}from"./useSplitCell-Cjr7nuBc.js";var X=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Ke=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ve(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ge(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Qe=fe(),l=ae(xe(),1);function $e(a){let e=(0,Qe.c)(47),{cell:c,closePopover:u}=a,{createNewCell:h,updateCellConfig:d,updateCellName:j,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:S,markUntouched:T}=me(),A=Fe(),N=Ue(c==null?void 0:c.cellId),D=!x(ce),H=Pe(),{openModal:v}=Be(),R=ne(Se),B=x(be),y=x(ye),oe=x(Ne),b=x(ue),{saveCellConfig:s}=je();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:n,getEditorView:r,name:m,hasOutput:C,hasConsoleOutput:E,status:U}=c,g;e[1]!==o||e[2]!==n.disabled||e[3]!==s||e[4]!==d?(g=async()=>{let t={disabled:!n.disabled};await s({configs:{[o]:t}}),d({cellId:o,config:t})},e[1]=o,e[2]=n.disabled,e[3]=s,e[4]=d,e[5]=g):g=e[5];let O=g,w;e[6]!==o||e[7]!==n.hide_code||e[8]!==r||e[9]!==s||e[10]!==d?(w=async()=>{let t={hide_code:!n.hide_code};await s({configs:{[o]:t}}),d({cellId:o,config:t});let L=r();L&&(t.hide_code?L.contentDOM.blur():L.focus())},e[6]=o,e[7]=n.hide_code,e[8]=r,e[9]=s,e[10]=d,e[11]=w):w=e[11];let P=w,i=o===he,I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(We,{size:13,strokeWidth:1.5}),e[12]=I):I=e[12];let q=U==="running"||U==="queued"||U==="disabled-transitively"||n.disabled,k;e[13]===N?k=e[14]:(k=()=>N(),e[13]=N,e[14]=k);let z;return e[15]!==_||e[16]!==B||e[17]!==b||e[18]!==y||e[19]!==D||e[20]!==o||e[21]!==S||e[22]!==u||e[23]!==n.disabled||e[24]!==n.hide_code||e[25]!==h||e[26]!==H||e[27]!==r||e[28]!==E||e[29]!==C||e[30]!==i||e[31]!==T||e[32]!==p||e[33]!==m||e[34]!==v||e[35]!==s||e[36]!==M||e[37]!==W||e[38]!==R||e[39]!==A||e[40]!==q||e[41]!==k||e[42]!==O||e[43]!==P||e[44]!==d||e[45]!==j?(z=[[{icon:I,label:"Run cell",hotkey:"cell.run",hidden:q,redundant:!0,handle:k},{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!B,handle:()=>{R(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>A({cellId:o})},{icon:(0,l.jsx)(we,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=r();t&&pe({[o]:t})}},{icon:n.hide_code?(0,l.jsx)(ie,{size:13,strokeWidth:1.5}):(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:n.hide_code?"Show code":"Hide code",handle:P,hotkey:"cell.hideCode"},{icon:n.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:n.disabled?"Enable execution":"Disable execution",handle:O,hidden:i}],[{icon:(0,l.jsx)(Le,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"markdown",keepCodeAsIs:!1}),n.hide_code||(await s({configs:{[o]:{hide_code:!0}}}),d({cellId:o,config:{hide_code:!0}}),T({cellId:o})))},hidden:i},{icon:(0,l.jsx)(se,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"sql",keepCodeAsIs:!1}))},hidden:i},{icon:(0,l.jsx)(qe,{}),label:"Toggle as Python",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),ke(t,"python",{force:!0}))},hidden:i}],[{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>h({cellId:o,before:!0}),hidden:i,redundant:!0},{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(G,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>h({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:i},{icon:(0,l.jsx)(G,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:i},{icon:(0,l.jsx)(Ce,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:b!=="columns"||i},{icon:(0,l.jsx)(ge,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:b!=="columns"||i},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:i},{icon:(0,l.jsx)(X,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:i},{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:b!=="columns"||i}],[{icon:(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>ve(o,"result")},{icon:(0,l.jsx)(de,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||E),handle:()=>{S({cellId:o})}}],[{icon:(0,l.jsx)(Ke,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:Ze,handleHeadless:()=>{v((0,l.jsxs)(Re,{children:[(0,l.jsx)(De,{children:(0,l.jsx)(He,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Oe,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)($,{placeholder:"cell name",value:m,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),v(null))},onChange:t=>j({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)($,{placeholder:"cell name",value:m,onChange:t=>j({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:i},{icon:(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(m),tooltip:te(m)?void 0:"Only named cells can be linked to",handle:async()=>{await Ee(Ve(m)),Ae({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!D,variant:"danger",icon:(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),handle:()=>{H({cellId:o})}}]].map(Xe).filter(Je),e[15]=_,e[16]=B,e[17]=b,e[18]=y,e[19]=D,e[20]=o,e[21]=S,e[22]=u,e[23]=n.disabled,e[24]=n.hide_code,e[25]=h,e[26]=H,e[27]=r,e[28]=E,e[29]=C,e[30]=i,e[31]=T,e[32]=p,e[33]=m,e[34]=v,e[35]=s,e[36]=M,e[37]=W,e[38]=R,e[39]=A,e[40]=q,e[41]=k,e[42]=O,e[43]=P,e[44]=d,e[45]=j,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Xe(a){return a.filter(Ye)}function Ye(a){return!a.hidden}function Ze(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ge as n,Y as o,le as r,X as s,$e as t};
@@ -1 +1 @@
1
- import{s as D}from"./chunk-LvLJmgfZ.js";import{i as m,n as u}from"./useEvent-BhXAndur.js";import{_ as p,w as h,y as I}from"./cells-CiFhRLUd.js";import{t as C}from"./compiler-runtime-B3qBwwSJ.js";import{t as _}from"./useEventListener-Cb-RVVEn.js";import{t as v}from"./jsx-runtime-ZmTK25f3.js";import{t as w}from"./button-CZ3Cs4qb.js";import{r as y}from"./requests-B4FYHTZl.js";import{t as b}from"./use-toast-T0_cQDma.js";import{n as x}from"./renderShortcut-Xr6z-RjZ.js";var j=C(),d=D(v(),1);const f=e=>{let t=(0,j.c)(7),l;t[0]===e?l=t[1]:(l=a=>{var s;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(s=e.onClick)==null||s.call(e,a))},t[0]=e,t[1]=l);let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r={capture:!0},t[2]=r):r=t[2],_(window,"keydown",l,r);let o=e.children??"Undo",i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,d.jsx)(x,{className:"ml-2",shortcut:"cmd-z"}),t[3]=i):i=t[3];let n;return t[4]!==o||t[5]!==e?(n=(0,d.jsxs)(w,{"data-testid":"undo-button",size:"sm",variant:"outline",...e,children:[o," ",i]}),t[4]=o,t[5]=e,t[6]=n):n=t[6],n};var g=C();function z(){let e=(0,g.c)(4),{deleteCell:t,undoDeleteCell:l}=h(),{sendDeleteCell:r}=y(),o;return e[0]!==t||e[1]!==r||e[2]!==l?(o=i=>{var s;if(m.get(p))return;let{cellId:n}=i,a=(((s=m.get(I).cellData[n])==null?void 0:s.code)??"").trim()==="";if(t({cellId:n}),r({cellId:n}).catch(()=>{l()}),!a){let{dismiss:c}=b({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:(0,d.jsx)(f,{"data-testid":"undo-delete-button",onClick:()=>{l(),k()}})}),k=c}},e[0]=t,e[1]=r,e[2]=l,e[3]=o):o=e[3],u(o)}function K(){let e=(0,g.c)(4),{deleteCell:t,undoDeleteCell:l}=h(),{sendDeleteCell:r}=y(),o;return e[0]!==t||e[1]!==r||e[2]!==l?(o=async i=>{if(m.get(p))return;let{cellIds:n}=i;for(let c of n)await r({cellId:c}).then(()=>{t({cellId:c})});let{dismiss:a}=b({title:"Cells deleted",action:(0,d.jsx)(f,{"data-testid":"undo-delete-button",onClick:()=>{for(let c of n)l();s()}})}),s=a},e[0]=t,e[1]=r,e[2]=l,e[3]=o):o=e[3],u(o)}export{K as n,f as r,z as t};
1
+ import{s as D}from"./chunk-LvLJmgfZ.js";import{i as m,n as u}from"./useEvent-BhXAndur.js";import{_ as p,w as h,y as I}from"./cells-B0XKj2oa.js";import{t as C}from"./compiler-runtime-B3qBwwSJ.js";import{t as _}from"./useEventListener-Cb-RVVEn.js";import{t as v}from"./jsx-runtime-ZmTK25f3.js";import{t as w}from"./button-CZ3Cs4qb.js";import{r as y}from"./requests-B4FYHTZl.js";import{t as b}from"./use-toast-T0_cQDma.js";import{n as x}from"./renderShortcut-Xr6z-RjZ.js";var j=C(),d=D(v(),1);const f=e=>{let t=(0,j.c)(7),l;t[0]===e?l=t[1]:(l=a=>{var s;(a.ctrlKey||a.metaKey)&&a.key==="z"&&(a.preventDefault(),a.stopPropagation(),(s=e.onClick)==null||s.call(e,a))},t[0]=e,t[1]=l);let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r={capture:!0},t[2]=r):r=t[2],_(window,"keydown",l,r);let o=e.children??"Undo",i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,d.jsx)(x,{className:"ml-2",shortcut:"cmd-z"}),t[3]=i):i=t[3];let n;return t[4]!==o||t[5]!==e?(n=(0,d.jsxs)(w,{"data-testid":"undo-button",size:"sm",variant:"outline",...e,children:[o," ",i]}),t[4]=o,t[5]=e,t[6]=n):n=t[6],n};var g=C();function z(){let e=(0,g.c)(4),{deleteCell:t,undoDeleteCell:l}=h(),{sendDeleteCell:r}=y(),o;return e[0]!==t||e[1]!==r||e[2]!==l?(o=i=>{var s;if(m.get(p))return;let{cellId:n}=i,a=(((s=m.get(I).cellData[n])==null?void 0:s.code)??"").trim()==="";if(t({cellId:n}),r({cellId:n}).catch(()=>{l()}),!a){let{dismiss:c}=b({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:(0,d.jsx)(f,{"data-testid":"undo-delete-button",onClick:()=>{l(),k()}})}),k=c}},e[0]=t,e[1]=r,e[2]=l,e[3]=o):o=e[3],u(o)}function K(){let e=(0,g.c)(4),{deleteCell:t,undoDeleteCell:l}=h(),{sendDeleteCell:r}=y(),o;return e[0]!==t||e[1]!==r||e[2]!==l?(o=async i=>{if(m.get(p))return;let{cellIds:n}=i;for(let c of n)await r({cellId:c}).then(()=>{t({cellId:c})});let{dismiss:a}=b({title:"Cells deleted",action:(0,d.jsx)(f,{"data-testid":"undo-delete-button",onClick:()=>{for(let c of n)l();s()}})}),s=a},e[0]=t,e[1]=r,e[2]=l,e[3]=o):o=e[3],u(o)}export{K as n,f as r,z as t};
@@ -1 +1 @@
1
- import{s as U}from"./chunk-LvLJmgfZ.js";import{d as Y,l as Z,n as V,p as $,u as ee}from"./useEvent-BhXAndur.js";import{t as te}from"./react-Bj1aDYRI.js";import{U as le,gt as re}from"./cells-CiFhRLUd.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{t as se}from"./jsx-runtime-ZmTK25f3.js";import{t as ae}from"./cn-BKtXLv3a.js";import{t as ne}from"./createLucideIcon-BCdY6lG5.js";import{t as oe}from"./useCellActionButton-ChlSq72t.js";import{a as ie,n as ce,o as me,t as de}from"./tooltip-C_WgOOcZ.js";import{d as he}from"./alert-dialog-Ctz24SMn.js";import{i as G,r as pe,t as J}from"./popover-B-131r4d.js";import{a as fe,c as ue,i as xe,o as je,r as be,t as ye,u as ve}from"./command-MHa10zT2.js";import{n as ge}from"./focus-CtXToHnV.js";import{a as Ne,i as we}from"./renderShortcut-Xr6z-RjZ.js";var ke=ne("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),K=B(),p=U(te(),1),t=U(se(),1);const L=p.memo(p.forwardRef((n,l)=>{let e=(0,K.c)(46),{children:r,showTooltip:m,...d}=n,f=m===void 0?!0:m,[h,o]=(0,p.useState)(!1),k;e[0]===o?k=e[1]:(k=()=>o(!1),e[0]=o,e[1]=k);let X=k,A=(0,p.useRef)(null),u=oe({cell:d,closePopover:X}),F=he(),C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{le(()=>{A.current&&A.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[2]=C):C=e[2];let H=V(C),S;e[3]!==H||e[4]!==o?(S=s=>{o(c=>{let w=typeof s=="function"?s(c):s;return w&&H(),w})},e[3]=H,e[4]=o,e[5]=S):S=e[5];let i=V(S),_;e[6]===i?_=e[7]:(_=()=>({toggle:()=>i(Ce)}),e[6]=i,e[7]=_),(0,p.useImperativeHandle)(l,_);let M=pe,O=ye,R=fe,q=re(d.cellId),x;e[8]!==R||e[9]!==q?(x=(0,t.jsx)(R,{placeholder:"Search actions...",className:"h-6 m-1",...q}),e[8]=R,e[9]=q,e[10]=x):x=e[10];let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(be,{children:"No results"}),e[11]=I):I=e[11];let j;if(e[12]!==u||e[13]!==o){let s;e[15]!==u.length||e[16]!==o?(s=(c,w)=>(0,t.jsxs)(p.Fragment,{children:[(0,t.jsx)(xe,{children:c.map(a=>{if(a.redundant)return null;let E=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[a.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:a.icon}),(0,t.jsx)("div",{className:"flex-1",children:a.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[a.hotkey&&we(a.hotkey),a.rightElement]})]});return a.tooltip&&(E=(0,t.jsx)(de,{content:a.tooltip,delayDuration:100,children:E})),(0,t.jsx)(je,{className:ae(a.disabled&&"opacity-50!"),onSelect:()=>{a.disableClick||a.disabled||(a.handle(),o(!1))},variant:a.variant,children:E},a.label)})},w),w<u.length-1&&(0,t.jsx)(ue,{})]},w),e[15]=u.length,e[16]=o,e[17]=s):s=e[17],j=u.map(s),e[12]=u,e[13]=o,e[14]=j}else j=e[14];let b;e[18]===j?b=e[19]:(b=(0,t.jsxs)(ve,{children:[I,j]}),e[18]=j,e[19]=b);let y;e[20]!==O||e[21]!==x||e[22]!==b?(y=(0,t.jsxs)(O,{children:[x,b]}),e[20]=O,e[21]=x,e[22]=b,e[23]=y):y=e[23];let T;e[24]!==M||e[25]!==F||e[26]!==y?(T=(0,t.jsx)(M,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...F,children:y}),e[24]=M,e[25]=F,e[26]=y,e[27]=T):T=e[27];let v=T;if(!f){let s;e[28]===r?s=e[29]:(s=(0,t.jsx)(G,{asChild:!0,children:r}),e[28]=r,e[29]=s);let c;return e[30]!==v||e[31]!==i||e[32]!==h||e[33]!==s?(c=(0,t.jsxs)(J,{open:h,onOpenChange:i,children:[s,v]}),e[30]=v,e[31]=i,e[32]=h,e[33]=s,e[34]=c):c=e[34],c}let D;e[35]===Symbol.for("react.memo_cache_sentinel")?(D=(0,t.jsx)(ce,{tabIndex:-1,children:Ne("cell.cellActions")}),e[35]=D):D=e[35];let z=!h&&D,g;e[36]===r?g=e[37]:(g=(0,t.jsx)(me,{ref:A,children:(0,t.jsx)(G,{className:"flex",children:r})}),e[36]=r,e[37]=g);let N;e[38]!==z||e[39]!==g?(N=(0,t.jsxs)(ie,{delayDuration:200,disableHoverableContent:!0,children:[z,g]}),e[38]=z,e[39]=g,e[40]=N):N=e[40];let P;return e[41]!==v||e[42]!==i||e[43]!==h||e[44]!==N?(P=(0,t.jsxs)(J,{open:h,onOpenChange:i,children:[N,v]}),e[41]=v,e[42]=i,e[43]=h,e[44]=N,e[45]=P):P=e[45],P})),Q=p.memo(n=>{let l=(0,K.c)(5),{children:e,cellId:r}=n,m;l[0]===r?m=l[1]:(m=ge(r),l[0]=r,l[1]=m);let d=ee(m);if(!d)return null;let f;return l[2]!==e||l[3]!==d?(f=(0,t.jsx)(L,{showTooltip:!1,...d,children:e}),l[2]=e,l[3]=d,l[4]=f):f=l[4],f});Q.displayName="ConnectionCellActionsDropdown";function Ce(n){return!n}var Se=B();const W=$("minimap");function _e(){let n=(0,Se.c)(3),[l,e]=Z(W),r;return n[0]!==l||n[1]!==e?(r={dependencyPanelTab:l,setDependencyPanelTab:e},n[0]=l,n[1]=e,n[2]=r):r=n[2],r}function Ie(){return Y(W)}export{ke as a,Q as i,Ie as n,L as r,_e as t};
1
+ import{s as U}from"./chunk-LvLJmgfZ.js";import{d as Y,l as Z,n as V,p as $,u as ee}from"./useEvent-BhXAndur.js";import{t as te}from"./react-Bj1aDYRI.js";import{U as le,gt as re}from"./cells-B0XKj2oa.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{t as se}from"./jsx-runtime-ZmTK25f3.js";import{t as ae}from"./cn-BKtXLv3a.js";import{t as ne}from"./createLucideIcon-BCdY6lG5.js";import{t as oe}from"./useCellActionButton-Du-bZZ06.js";import{a as ie,n as ce,o as me,t as de}from"./tooltip-C_WgOOcZ.js";import{d as he}from"./alert-dialog-Ctz24SMn.js";import{i as G,r as pe,t as J}from"./popover-B-131r4d.js";import{a as fe,c as ue,i as xe,o as je,r as be,t as ye,u as ve}from"./command-DTFQw11F.js";import{n as ge}from"./focus-CZLCQiuh.js";import{a as Ne,i as we}from"./renderShortcut-Xr6z-RjZ.js";var ke=ne("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),K=B(),p=U(te(),1),t=U(se(),1);const L=p.memo(p.forwardRef((n,l)=>{let e=(0,K.c)(46),{children:r,showTooltip:m,...d}=n,f=m===void 0?!0:m,[h,o]=(0,p.useState)(!1),k;e[0]===o?k=e[1]:(k=()=>o(!1),e[0]=o,e[1]=k);let X=k,A=(0,p.useRef)(null),u=oe({cell:d,closePopover:X}),F=he(),C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{le(()=>{A.current&&A.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[2]=C):C=e[2];let H=V(C),S;e[3]!==H||e[4]!==o?(S=s=>{o(c=>{let w=typeof s=="function"?s(c):s;return w&&H(),w})},e[3]=H,e[4]=o,e[5]=S):S=e[5];let i=V(S),_;e[6]===i?_=e[7]:(_=()=>({toggle:()=>i(Ce)}),e[6]=i,e[7]=_),(0,p.useImperativeHandle)(l,_);let M=pe,O=ye,R=fe,q=re(d.cellId),x;e[8]!==R||e[9]!==q?(x=(0,t.jsx)(R,{placeholder:"Search actions...",className:"h-6 m-1",...q}),e[8]=R,e[9]=q,e[10]=x):x=e[10];let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(be,{children:"No results"}),e[11]=I):I=e[11];let j;if(e[12]!==u||e[13]!==o){let s;e[15]!==u.length||e[16]!==o?(s=(c,w)=>(0,t.jsxs)(p.Fragment,{children:[(0,t.jsx)(xe,{children:c.map(a=>{if(a.redundant)return null;let E=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[a.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:a.icon}),(0,t.jsx)("div",{className:"flex-1",children:a.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[a.hotkey&&we(a.hotkey),a.rightElement]})]});return a.tooltip&&(E=(0,t.jsx)(de,{content:a.tooltip,delayDuration:100,children:E})),(0,t.jsx)(je,{className:ae(a.disabled&&"opacity-50!"),onSelect:()=>{a.disableClick||a.disabled||(a.handle(),o(!1))},variant:a.variant,children:E},a.label)})},w),w<u.length-1&&(0,t.jsx)(ue,{})]},w),e[15]=u.length,e[16]=o,e[17]=s):s=e[17],j=u.map(s),e[12]=u,e[13]=o,e[14]=j}else j=e[14];let b;e[18]===j?b=e[19]:(b=(0,t.jsxs)(ve,{children:[I,j]}),e[18]=j,e[19]=b);let y;e[20]!==O||e[21]!==x||e[22]!==b?(y=(0,t.jsxs)(O,{children:[x,b]}),e[20]=O,e[21]=x,e[22]=b,e[23]=y):y=e[23];let T;e[24]!==M||e[25]!==F||e[26]!==y?(T=(0,t.jsx)(M,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...F,children:y}),e[24]=M,e[25]=F,e[26]=y,e[27]=T):T=e[27];let v=T;if(!f){let s;e[28]===r?s=e[29]:(s=(0,t.jsx)(G,{asChild:!0,children:r}),e[28]=r,e[29]=s);let c;return e[30]!==v||e[31]!==i||e[32]!==h||e[33]!==s?(c=(0,t.jsxs)(J,{open:h,onOpenChange:i,children:[s,v]}),e[30]=v,e[31]=i,e[32]=h,e[33]=s,e[34]=c):c=e[34],c}let D;e[35]===Symbol.for("react.memo_cache_sentinel")?(D=(0,t.jsx)(ce,{tabIndex:-1,children:Ne("cell.cellActions")}),e[35]=D):D=e[35];let z=!h&&D,g;e[36]===r?g=e[37]:(g=(0,t.jsx)(me,{ref:A,children:(0,t.jsx)(G,{className:"flex",children:r})}),e[36]=r,e[37]=g);let N;e[38]!==z||e[39]!==g?(N=(0,t.jsxs)(ie,{delayDuration:200,disableHoverableContent:!0,children:[z,g]}),e[38]=z,e[39]=g,e[40]=N):N=e[40];let P;return e[41]!==v||e[42]!==i||e[43]!==h||e[44]!==N?(P=(0,t.jsxs)(J,{open:h,onOpenChange:i,children:[N,v]}),e[41]=v,e[42]=i,e[43]=h,e[44]=N,e[45]=P):P=e[45],P})),Q=p.memo(n=>{let l=(0,K.c)(5),{children:e,cellId:r}=n,m;l[0]===r?m=l[1]:(m=ge(r),l[0]=r,l[1]=m);let d=ee(m);if(!d)return null;let f;return l[2]!==e||l[3]!==d?(f=(0,t.jsx)(L,{showTooltip:!1,...d,children:e}),l[2]=e,l[3]=d,l[4]=f):f=l[4],f});Q.displayName="ConnectionCellActionsDropdown";function Ce(n){return!n}var Se=B();const W=$("minimap");function _e(){let n=(0,Se.c)(3),[l,e]=Z(W),r;return n[0]!==l||n[1]!==e?(r={dependencyPanelTab:l,setDependencyPanelTab:e},n[0]=l,n[1]=e,n[2]=r):r=n[2],r}function Ie(){return Y(W)}export{ke as a,Q as i,Ie as n,L as r,_e as t};
@@ -1 +1 @@
1
- import{s as de}from"./chunk-LvLJmgfZ.js";import{d as D,l as Oe,p as Be,u as ee}from"./useEvent-BhXAndur.js";import{t as Ue}from"./react-Bj1aDYRI.js";import{Kn as Ye,Mt as $e,Un as Fe,Vn as Ge,Zn as Ke,_r as Je,cn as Ze,g as Xe,ln as Qe,m as ce,pn as he,ri as te,t as et,un as tt,w as pe}from"./cells-CiFhRLUd.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as at}from"./assertNever-CBU83Y6o.js";import{s as me}from"./useLifecycle-ClI_npeg.js";import{n as ot}from"./add-database-form-mXHOy5uZ.js";import{n as nt,x as it}from"./ai-model-dropdown-DC4t5PJE.js";import{a as ue,d as I}from"./hotkeys-BHHWjLlp.js";import{y as lt}from"./utils-YqBXNpsM.js";import{n as _,t as fe}from"./constants-B6Cb__3x.js";import{S as ye,h as st,x as rt}from"./config-D2-Bw6QC.js";import{t as dt}from"./jsx-runtime-ZmTK25f3.js";import{r as ct,t as ae}from"./button-CZ3Cs4qb.js";import{r as P}from"./requests-B4FYHTZl.js";import{t as h}from"./createLucideIcon-BCdY6lG5.js";import{a as be,f as ht,i as ke,m as pt,p as xe,u as we}from"./layout-DWzvYkJc.js";import{t as ge}from"./check-Dr3SxUsb.js";import{c as mt,d as je,n as ut,o as ft,r as ve,t as yt}from"./download-CUgZOA9O.js";import{f as bt}from"./maps-D2_Mq1pZ.js";import{r as kt}from"./useCellActionButton-ChlSq72t.js";import{t as xt}from"./copy-D-8y6iMN.js";import{t as wt}from"./download-Dg7clfkc.js";import{t as gt}from"./eye-off-AK_9uodG.js";import{t as jt}from"./file-plus-corner-CvAy4H5W.js";import{t as vt}from"./file-Ch78NKWp.js";import{i as Ct,n as zt,r as Mt,t as Wt}from"./youtube--tNPNRy6.js";import{n as _t,t as St}from"./house-BI81AWSn.js";import{n as At}from"./play-GLWQQs7F.js";import{t as Nt}from"./link-DxicfMbs.js";import{r as Dt}from"./input-DHHmNa19.js";import{t as It}from"./settings-OBbrbhij.js";import{y as Pt}from"./textarea-sdXkC92D.js";import{t as Et}from"./square-DPZjfUaq.js";import{t as C}from"./use-toast-T0_cQDma.js";import{n as Ce,t as Tt}from"./paths-Dfii2bN8.js";import{o as Ht}from"./session-fBtIbMpB.js";import{a as Lt,c as qt,i as Rt,n as Vt,r as Ot,s as Bt,t as Ut}from"./select-B7bfltkI.js";import{t as Yt}from"./tooltip-C_WgOOcZ.js";import{a as ze,i as $t,r as Ft}from"./mode-O-1bKZO6.js";import{o as Gt}from"./alert-dialog-Ctz24SMn.js";import{a as Kt,c as Jt,i as Zt,n as Xt,r as Qt}from"./dialog-tQELcltn.js";import{n as oe}from"./ImperativeModal-DZr52ffu.js";import{r as ea,t as ta}from"./share-rXkgGlhr.js";import{t as U}from"./copy-BaRrAFL-.js";import{r as aa}from"./useRunCells-CNmJhP6h.js";import{a as oa}from"./cell-link-dnd6DfEI.js";import{a as Me}from"./renderShortcut-Xr6z-RjZ.js";import{t as na}from"./icons-DjR3qLG_.js";import{t as ia}from"./links-DgZx-VxW.js";import{r as la,t as sa}from"./hooks-STSuFYve.js";import{t as We}from"./types-DZmRsGZN.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),_e=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Se=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ae=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),ca=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),ha=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),pa=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Ne=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ma=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),De=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),fa=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ya=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ie=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Pe=W(),ne=de(Ue(),1),a=de(dt(),1),Y="https://static.marimo.app";const ba=e=>{let t=(0,Pe.c)(25),{onClose:n}=e,[o,l]=(0,ne.useState)(""),{exportAsHTML:r}=P(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Y}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let S=await r({download:!1,includeCode:!0,files:ht.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Y}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:S,path:s})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Jt,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Kt,{children:[p,(0,a.jsxs)(Qt,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:Y,target:"_blank",children:Y}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Dt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===i?u=t[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ka,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=u);let f;t[11]!==m||t[12]!==u?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,u]}),t[11]=m,t[12]=u,t[13]=f):f=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(ae,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await U(i)},children:"Create"}),t[16]=i,t[17]=b);let k;t[18]!==y||t[19]!==b?(k=(0,a.jsxs)(Zt,{children:[y,b]}),t[18]=y,t[19]=b,t[20]=k):k=t[20];let j;return t[21]!==d||t[22]!==k||t[23]!==f?(j=(0,a.jsx)(Xt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,f,k]})}),t[21]=d,t[22]=k,t[23]=f,t[24]=j):j=t[24],j};var ka=e=>{let t=(0,Pe.c)(8),[n,o]=ne.useState(!1),l;t[0]===e.text?l=t[1]:(l=ct.stopPropagation(async p=>{p.preventDefault(),await U(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ae,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Yt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},xa=W();function wa(){let e=document.getElementsByClassName(fe.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=te.findElement(t);if(!o){I.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:te.parse(o.id)}}}return I.warn("No visible output area found for scroll anchor"),null}function ga(e){if(!e){I.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(te.create(e.cellId));if(!t){I.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${fe.outputArea}`)){I.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ee(){let e=(0,xa.c)(2),t=D(ze),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:$t(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const Te=Be(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=be(),{setLayoutView:n}=ke();if(ye()&&!he("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(qt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Vt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)(Lt,{children:"View as"}),We.map(za)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(Ut,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function Ca(e){return(0,a.jsx)(He(e),{className:"h-4 w-4"})}function He(e){switch(e){case"vertical":return ma;case"grid":return Mt;case"slides":return De;default:return at(e),Et}}function Le(e){return me(e)}function za(e){return(0,a.jsx)(Rt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Le(e)})]})},e)}var Ma=W();function Wa(e){let t=(0,Ma.c)(5),{openPrompt:n,closeModal:o}=oe(),{sendCopy:l}=P(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Tt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ce.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(Ce.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ia(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const _a=()=>{let{updateCellConfig:e}=pe(),{saveCellConfig:t}=P();return(0,ne.useCallback)(async()=>{let n=new $e,o=ce(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=ue.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Sa=W();function qe(){let e=(0,Sa.c)(4),{openConfirm:t}=oe(),n=D(st),{sendRestart:o}=P(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Gt,{onClick:async()=>{n({state:rt.CLOSING}),await o(),ea()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Aa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var se,re;let e=(0,Aa.c)(40),t=oa(),{openModal:n,closeModal:o}=oe(),{toggleApplication:l}=Ze(),{selectedPanel:r}=Qe(),[s]=Oe(ze),i=ee(Ft),d=_a(),[p]=lt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=pe(),b=qe(),k=aa(),j=Wa(t),v=D(Te),S=D(nt),z=D(it),{exportAsMarkdown:$,readCode:A,saveCellConfig:F,updateCellOutputs:G}=P(),K=ee(Xe),J=ee(et),{selectedLayout:Z}=be(),{setLayoutView:X}=ke(),T=Ee(),Q=la(),H=((se=p.sharing)==null?void 0:se.html)??!0,L=((re=p.sharing)==null?void 0:re.wasm)??!0,q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q=he("server_side_pdf_export"),e[0]=q):q=e[0];let le=q,R=le||s.mode==="present",Re=Ga,V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),e[1]=V):V=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),e[2]=O):O=e[2];let M;e[3]===t?M=e[4]:(M=async()=>{if(!t){ie();return}await we({filename:t,includeCode:!0})},e[3]=t,e[4]=M);let B;return e[5]!==u||e[6]!==J||e[7]!==m||e[8]!==o||e[9]!==f||e[10]!==j||e[11]!==y||e[12]!==$||e[13]!==t||e[14]!==K||e[15]!==d||e[16]!==i||e[17]!==n||e[18]!==R||e[19]!==A||e[20]!==b||e[21]!==k||e[22]!==F||e[23]!==Z||e[24]!==r||e[25]!==v||e[26]!==z||e[27]!==X||e[28]!==S||e[29]!==H||e[30]!==L||e[31]!==M||e[32]!==Q||e[33]!==l||e[34]!==T||e[35]!==g||e[36]!==w||e[37]!==G||e[38]!==s.mode?(B=[{icon:V,label:"Download",handle:E,dropdown:[{icon:O,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ie();return}await we({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(na,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await $({download:!1});ve(new Blob([c],{type:"text/plain"}),je.toMarkdown(document.title))}},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await A();ve(new Blob([c.contents],{type:"text/plain"}),je.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:Fa},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:!R,tooltip:R?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:async()=>{if(le){if(!t){ie();return}await mt("Downloading PDF...",async N=>{await sa({takeScreenshots:()=>Q({progress:N}),updateCellOutputs:G}),await ut({filename:t,webpdf:!1})});return}let c=new Event("export-beforeprint"),x=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout($a,0),setTimeout(()=>window.dispatchEvent(x),0)})()}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!H&&!L,dropdown:[{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!H,handle:async()=>{n((0,a.jsx)(ba,{onClose:o}))}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!L,handle:async()=>{await U(ta({code:(await A()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:tt.flatMap(c=>{let{type:x,Icon:N,hidden:Ve}=c;return Ve?[]:{label:me(x),rightElement:Re(r===x),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),handle:()=>l(x)}})},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{T()}},...We.map((c,x)=>{let N=He(c);return{divider:x===0,label:Le(c),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:Z===c&&(0,a.jsx)(ge,{size:14})}),handle:()=>{X(c),s.mode==="edit"&&T()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ye(),handle:j},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await U((await A()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!K||i,handle:async()=>{let c=Je(ce());await F({configs:ue.fromEntries(c.map(Ya))});for(let x of c)w({cellId:x,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ot,{onClose:o}))}},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!J||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Se,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ba)},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>S(Oa),redundant:!0},{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ra},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:qa},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:La},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ta},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ea}].filter(Pa).map(Da),e[5]=u,e[6]=J,e[7]=m,e[8]=o,e[9]=f,e[10]=j,e[11]=y,e[12]=$,e[13]=t,e[14]=K,e[15]=d,e[16]=i,e[17]=n,e[18]=R,e[19]=A,e[20]=b,e[21]=k,e[22]=F,e[23]=Z,e[24]=r,e[25]=v,e[26]=z,e[27]=X,e[28]=S,e[29]=H,e[30]=L,e[31]=M,e[32]=Q,e[33]=l,e[34]=T,e[35]=g,e[36]=w,e[37]=G,e[38]=s.mode,e[39]=B):B=e[39],B}function Da(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ia)}:e}function Ia(e){return!e.hidden}function Pa(e){return!e.hidden}function Ea(){let e=Ht();window.open(e,"_blank")}function Ta(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function La(){window.open(_.youtube,"_blank")}function qa(){window.open(_.discordLink,"_blank")}function Ra(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Oa(e){return!e}function Ba(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Fa(){let e=document.getElementById("App");e&&await ft({element:e,filename:document.title,prepare:yt})}function Ga(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(ge,{size:14})})}function ie(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ee as a,Ae as c,Te as i,Se as l,qe as n,Ie as o,va as r,Ne as s,Na as t,_e as u};
1
+ import{s as de}from"./chunk-LvLJmgfZ.js";import{d as D,l as Oe,p as Be,u as ee}from"./useEvent-BhXAndur.js";import{t as Ue}from"./react-Bj1aDYRI.js";import{Kn as Ye,Mt as $e,Un as Fe,Vn as Ge,Zn as Ke,_r as Je,cn as Ze,g as Xe,ln as Qe,m as ce,pn as he,ri as te,t as et,un as tt,w as pe}from"./cells-B0XKj2oa.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{n as at}from"./assertNever-CBU83Y6o.js";import{s as me}from"./useLifecycle-ClI_npeg.js";import{n as ot}from"./add-database-form-BnEY6X5s.js";import{n as nt,x as it}from"./ai-model-dropdown-Cugcw6NV.js";import{a as ue,d as I}from"./hotkeys-BHHWjLlp.js";import{y as lt}from"./utils-YqBXNpsM.js";import{n as _,t as fe}from"./constants-B6Cb__3x.js";import{S as ye,h as st,x as rt}from"./config-D2-Bw6QC.js";import{t as dt}from"./jsx-runtime-ZmTK25f3.js";import{r as ct,t as ae}from"./button-CZ3Cs4qb.js";import{r as P}from"./requests-B4FYHTZl.js";import{t as h}from"./createLucideIcon-BCdY6lG5.js";import{a as be,f as ht,i as ke,m as pt,p as xe,u as we}from"./layout-BRVYycwo.js";import{t as ge}from"./check-Dr3SxUsb.js";import{c as mt,d as je,n as ut,o as ft,r as ve,t as yt}from"./download-CxmzcjnR.js";import{f as bt}from"./maps-D2_Mq1pZ.js";import{r as kt}from"./useCellActionButton-Du-bZZ06.js";import{t as xt}from"./copy-D-8y6iMN.js";import{t as wt}from"./download-Dg7clfkc.js";import{t as gt}from"./eye-off-AK_9uodG.js";import{t as jt}from"./file-plus-corner-CvAy4H5W.js";import{t as vt}from"./file-Ch78NKWp.js";import{i as Ct,n as zt,r as Mt,t as Wt}from"./youtube--tNPNRy6.js";import{n as _t,t as St}from"./house-BI81AWSn.js";import{n as At}from"./play-GLWQQs7F.js";import{t as Nt}from"./link-DxicfMbs.js";import{r as Dt}from"./input-DHHmNa19.js";import{t as It}from"./settings-OBbrbhij.js";import{y as Pt}from"./textarea-UfsPtSW1.js";import{t as Et}from"./square-DPZjfUaq.js";import{t as C}from"./use-toast-T0_cQDma.js";import{n as Ce,t as Tt}from"./paths-Dfii2bN8.js";import{o as Ht}from"./session-fBtIbMpB.js";import{a as Lt,c as qt,i as Rt,n as Vt,r as Ot,s as Bt,t as Ut}from"./select-B7bfltkI.js";import{t as Yt}from"./tooltip-C_WgOOcZ.js";import{a as ze,i as $t,r as Ft}from"./mode-CTf4rB7H.js";import{o as Gt}from"./alert-dialog-Ctz24SMn.js";import{a as Kt,c as Jt,i as Zt,n as Xt,r as Qt}from"./dialog-tQELcltn.js";import{n as oe}from"./ImperativeModal-DZr52ffu.js";import{r as ea,t as ta}from"./share-rXkgGlhr.js";import{t as U}from"./copy-BaRrAFL-.js";import{r as aa}from"./useRunCells-DaW_oMnr.js";import{a as oa}from"./cell-link-B37i0WNz.js";import{a as Me}from"./renderShortcut-Xr6z-RjZ.js";import{t as na}from"./icons-DjR3qLG_.js";import{t as ia}from"./links-DgZx-VxW.js";import{r as la,t as sa}from"./hooks-B2h7NTXb.js";import{t as We}from"./types-DZmRsGZN.js";var ra=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),da=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),_e=h("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Se=h("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ae=h("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),ca=h("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),ha=h("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),pa=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Ne=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ma=h("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),ua=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),De=h("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),fa=h("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ya=h("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Ie=h("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Pe=W(),ne=de(Ue(),1),a=de(dt(),1),Y="https://static.marimo.app";const ba=e=>{let t=(0,Pe.c)(25),{onClose:n}=e,[o,l]=(0,ne.useState)(""),{exportAsHTML:r}=P(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Y}/static/${s}`,d;t[0]!==r||t[1]!==n||t[2]!==s?(d=async v=>{v.preventDefault(),n();let S=await r({download:!1,includeCode:!0,files:ht.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Y}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:S,path:s})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:_.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Jt,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Kt,{children:[p,(0,a.jsxs)(Qt,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:Y,target:"_blank",children:Y}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Dt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===i?u=t[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ka,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=u);let f;t[11]!==m||t[12]!==u?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,u]}),t[11]=m,t[12]=u,t[13]=f):f=t[13];let y;t[14]===n?y=t[15]:(y=(0,a.jsx)(ae,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=y);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(ae,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await U(i)},children:"Create"}),t[16]=i,t[17]=b);let k;t[18]!==y||t[19]!==b?(k=(0,a.jsxs)(Zt,{children:[y,b]}),t[18]=y,t[19]=b,t[20]=k):k=t[20];let j;return t[21]!==d||t[22]!==k||t[23]!==f?(j=(0,a.jsx)(Xt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,f,k]})}),t[21]=d,t[22]=k,t[23]=f,t[24]=j):j=t[24],j};var ka=e=>{let t=(0,Pe.c)(8),[n,o]=ne.useState(!1),l;t[0]===e.text?l=t[1]:(l=ct.stopPropagation(async p=>{p.preventDefault(),await U(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(ae,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(Yt,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},xa=W();function wa(){let e=document.getElementsByClassName(fe.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=te.findElement(t);if(!o){I.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:te.parse(o.id)}}}return I.warn("No visible output area found for scroll anchor"),null}function ga(e){if(!e){I.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(te.create(e.cellId));if(!t){I.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${fe.outputArea}`)){I.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ee(){let e=(0,xa.c)(2),t=D(ze),n;return e[0]===t?n=e[1]:(n=()=>{let o=wa();t(l=>({mode:$t(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ga(o)})})},e[0]=t,e[1]=n),n}const Te=Be(!1);var ja=W();const va=()=>{let e=(0,ja.c)(7),{selectedLayout:t}=be(),{setLayoutView:n}=ke();if(ye()&&!he("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(qt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Vt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)(Lt,{children:"View as"}),We.map(za)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(Ut,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function Ca(e){return(0,a.jsx)(He(e),{className:"h-4 w-4"})}function He(e){switch(e){case"vertical":return ma;case"grid":return Mt;case"slides":return De;default:return at(e),Et}}function Le(e){return me(e)}function za(e){return(0,a.jsx)(Rt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ca(e),(0,a.jsx)("span",{children:Le(e)})]})},e)}var Ma=W();function Wa(e){let t=(0,Ma.c)(5),{openPrompt:n,closeModal:o}=oe(),{sendCopy:l}=P(),r;return t[0]!==o||t[1]!==n||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Tt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ce.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=s.join(Ce.dirname(e),i);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ia(d)})}})},t[0]=o,t[1]=n,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const _a=()=>{let{updateCellConfig:e}=pe(),{saveCellConfig:t}=P();return(0,ne.useCallback)(async()=>{let n=new $e,o=ce(),l=o.cellIds.inOrderIds,r={};for(let i of l){if(o.cellData[i]===void 0)continue;let{code:d,config:p}=o.cellData[i];p.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let s=ue.entries(r);if(s.length!==0){await t({configs:r});for(let[i,d]of s)e({cellId:i,config:d})}},[e])};var Sa=W();function qe(){let e=(0,Sa.c)(4),{openConfirm:t}=oe(),n=D(st),{sendRestart:o}=P(),l;return e[0]!==t||e[1]!==o||e[2]!==n?(l=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Gt,{onClick:async()=>{n({state:rt.CLOSING}),await o(),ea()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=l):l=e[3],l}var Aa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Na(){var se,re;let e=(0,Aa.c)(40),t=oa(),{openModal:n,closeModal:o}=oe(),{toggleApplication:l}=Ze(),{selectedPanel:r}=Qe(),[s]=Oe(ze),i=ee(Ft),d=_a(),[p]=lt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=pe(),b=qe(),k=aa(),j=Wa(t),v=D(Te),S=D(nt),z=D(it),{exportAsMarkdown:$,readCode:A,saveCellConfig:F,updateCellOutputs:G}=P(),K=ee(Xe),J=ee(et),{selectedLayout:Z}=be(),{setLayoutView:X}=ke(),T=Ee(),Q=la(),H=((se=p.sharing)==null?void 0:se.html)??!0,L=((re=p.sharing)==null?void 0:re.wasm)??!0,q;e[0]===Symbol.for("react.memo_cache_sentinel")?(q=he("server_side_pdf_export"),e[0]=q):q=e[0];let le=q,R=le||s.mode==="present",Re=Ga,V;e[1]===Symbol.for("react.memo_cache_sentinel")?(V=(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),e[1]=V):V=e[1];let O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),e[2]=O):O=e[2];let M;e[3]===t?M=e[4]:(M=async()=>{if(!t){ie();return}await we({filename:t,includeCode:!0})},e[3]=t,e[4]=M);let B;return e[5]!==u||e[6]!==J||e[7]!==m||e[8]!==o||e[9]!==f||e[10]!==j||e[11]!==y||e[12]!==$||e[13]!==t||e[14]!==K||e[15]!==d||e[16]!==i||e[17]!==n||e[18]!==R||e[19]!==A||e[20]!==b||e[21]!==k||e[22]!==F||e[23]!==Z||e[24]!==r||e[25]!==v||e[26]!==z||e[27]!==X||e[28]!==S||e[29]!==H||e[30]!==L||e[31]!==M||e[32]!==Q||e[33]!==l||e[34]!==T||e[35]!==g||e[36]!==w||e[37]!==G||e[38]!==s.mode?(B=[{icon:V,label:"Download",handle:E,dropdown:[{icon:O,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ie();return}await we({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(na,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await $({download:!1});ve(new Blob([c],{type:"text/plain"}),je.toMarkdown(document.title))}},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await A();ve(new Blob([c.contents],{type:"text/plain"}),je.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:Fa},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:!R,tooltip:R?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Me("global.hideCode",!1)]}),handle:async()=>{if(le){if(!t){ie();return}await mt("Downloading PDF...",async N=>{await sa({takeScreenshots:()=>Q({progress:N}),updateCellOutputs:G}),await ut({filename:t,webpdf:!1})});return}let c=new Event("export-beforeprint"),x=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout($a,0),setTimeout(()=>window.dispatchEvent(x),0)})()}}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!H&&!L,dropdown:[{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!H,handle:async()=>{n((0,a.jsx)(ba,{onClose:o}))}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!L,handle:async()=>{await U(ta({code:(await A()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:tt.flatMap(c=>{let{type:x,Icon:N,hidden:Ve}=c;return Ve?[]:{label:me(x),rightElement:Re(r===x),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),handle:()=>l(x)}})},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ne,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{T()}},...We.map((c,x)=>{let N=He(c);return{divider:x===0,label:Le(c),icon:(0,a.jsx)(N,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:Z===c&&(0,a.jsx)(ge,{size:14})}),handle:()=>{X(c),s.mode==="edit"&&T()}}})]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ye(),handle:j},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await U((await A()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!K||i,handle:async()=>{let c=Je(ce());await F({configs:ue.fromEntries(c.map(Ya))});for(let x of c)w({cellId:x,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ot,{onClose:o}))}},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!J||i,handle:()=>{g()}},{icon:(0,a.jsx)(ya,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Se,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ua)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ba)},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>S(Oa),redundant:!0},{icon:(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Va},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ra},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:qa},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:La},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ha}]},{divider:!0,icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ta},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ea}].filter(Pa).map(Da),e[5]=u,e[6]=J,e[7]=m,e[8]=o,e[9]=f,e[10]=j,e[11]=y,e[12]=$,e[13]=t,e[14]=K,e[15]=d,e[16]=i,e[17]=n,e[18]=R,e[19]=A,e[20]=b,e[21]=k,e[22]=F,e[23]=Z,e[24]=r,e[25]=v,e[26]=z,e[27]=X,e[28]=S,e[29]=H,e[30]=L,e[31]=M,e[32]=Q,e[33]=l,e[34]=T,e[35]=g,e[36]=w,e[37]=G,e[38]=s.mode,e[39]=B):B=e[39],B}function Da(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ia)}:e}function Ia(e){return!e.hidden}function Pa(e){return!e.hidden}function Ea(){let e=Ht();window.open(e,"_blank")}function Ta(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ha(){window.open(_.releasesPage,"_blank")}function La(){window.open(_.youtube,"_blank")}function qa(){window.open(_.discordLink,"_blank")}function Ra(){window.open(_.githubPage,"_blank")}function Va(){window.open(_.docsPage,"_blank")}function Oa(e){return!e}function Ba(e){return!e}function Ua(e){return!e}function Ya(e){return[e,{disabled:!1}]}function $a(){return window.print()}async function Fa(){let e=document.getElementById("App");e&&await ft({element:e,filename:document.title,prepare:yt})}function Ga(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(ge,{size:14})})}function ie(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ee as a,Ae as c,Te as i,Se as l,qe as n,Ie as o,va as r,Ne as s,Na as t,_e as u};
@@ -1 +1 @@
1
- import{d as I,n as i,p as b}from"./useEvent-BhXAndur.js";import{Sr as g,bn as k,it as y,m as p,vr as F,w as x}from"./cells-CiFhRLUd.js";import{t as D}from"./compiler-runtime-B3qBwwSJ.js";import{d as H}from"./hotkeys-BHHWjLlp.js";import{o as S}from"./dist-ChS0Dc_R.js";import{r as V}from"./requests-B4FYHTZl.js";var u=D();const v=b(!1);function _(){let r=(0,u.c)(2),n=d(),t;return r[0]===n?t=r[1]:(t=()=>n(g(p())),r[0]=n,r[1]=t),i(t)}function j(r){let n=(0,u.c)(3),t=d(),e;return n[0]!==r||n[1]!==t?(e=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=e):e=n[2],i(e)}function q(){let r=(0,u.c)(2),n=d(),t;return r[0]===n?t=r[1]:(t=()=>n(F(p())),r[0]=n,r[1]=t),i(t)}function d(){let r=(0,u.c)(4),{prepareForRun:n}=x(),{sendRun:t}=V(),e=I(v),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=p();return e(!0),w({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=e,r[3]=o):o=r[3],i(o)}async function w({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,R,h;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(R=(m=o[a])==null?void 0:m.current)==null?void 0:R.editorView,f;l?(k(l)!=="markdown"&&S(l),f=y(l)):f=((h=s[a])==null?void 0:h.code)||"",c.push(f),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{H.error(a)})}export{d as a,j as i,w as n,_ as o,q as r,v as t};
1
+ import{d as I,n as i,p as b}from"./useEvent-BhXAndur.js";import{Sr as g,bn as k,it as y,m as p,vr as F,w as x}from"./cells-B0XKj2oa.js";import{t as D}from"./compiler-runtime-B3qBwwSJ.js";import{d as H}from"./hotkeys-BHHWjLlp.js";import{o as S}from"./dist-ChS0Dc_R.js";import{r as V}from"./requests-B4FYHTZl.js";var u=D();const v=b(!1);function _(){let r=(0,u.c)(2),n=d(),t;return r[0]===n?t=r[1]:(t=()=>n(g(p())),r[0]=n,r[1]=t),i(t)}function j(r){let n=(0,u.c)(3),t=d(),e;return n[0]!==r||n[1]!==t?(e=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=e):e=n[2],i(e)}function q(){let r=(0,u.c)(2),n=d(),t;return r[0]===n?t=r[1]:(t=()=>n(F(p())),r[0]=n,r[1]=t),i(t)}function d(){let r=(0,u.c)(4),{prepareForRun:n}=x(),{sendRun:t}=V(),e=I(v),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=p();return e(!0),w({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=e,r[3]=o):o=r[3],i(o)}async function w({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,R,h;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(R=(m=o[a])==null?void 0:m.current)==null?void 0:R.editorView,f;l?(k(l)!=="markdown"&&S(l),f=y(l)):f=((h=s[a])==null?void 0:h.code)||"",c.push(f),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{H.error(a)})}export{d as a,j as i,w as n,_ as o,q as r,v as t};
@@ -1 +1 @@
1
- import{s as n}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-BhXAndur.js";import{f as d,it as f,w as u}from"./cells-CiFhRLUd.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-ZmTK25f3.js";import{t as h}from"./use-toast-T0_cQDma.js";import{r as v}from"./useDeleteCell-BocCAiDk.js";var x=c(),b=n(C(),1);function j(){let t=(0,x.c)(3),{splitCell:o,undoSplitCell:r}=u(),i;return t[0]!==o||t[1]!==r?(i=s=>{let l=d(s.cellId);if(!l)return;let a=f(l);o(s);let{dismiss:e}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{r({...s,snapshot:a}),m()},children:"Undo"})}),m=e},t[0]=o,t[1]=r,t[2]=i):i=t[2],p(i)}export{j as t};
1
+ import{s as n}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-BhXAndur.js";import{f as d,it as f,w as u}from"./cells-B0XKj2oa.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-ZmTK25f3.js";import{t as h}from"./use-toast-T0_cQDma.js";import{r as v}from"./useDeleteCell-D0DAGwMP.js";var x=c(),b=n(C(),1);function j(){let t=(0,x.c)(3),{splitCell:o,undoSplitCell:r}=u(),i;return t[0]!==o||t[1]!==r?(i=s=>{let l=d(s.cellId);if(!l)return;let a=f(l);o(s);let{dismiss:e}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{r({...s,snapshot:a}),m()},children:"Undo"})}),m=e},t[0]=o,t[1]=r,t[2]=i):i=t[2],p(i)}export{j as t};
@@ -1,3 +1,3 @@
1
- var at=Object.defineProperty;var it=(t,e,n)=>e in t?at(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e,n)=>it(t,typeof e!="symbol"?e+"":e,n);var j;import{s as ce}from"./chunk-LvLJmgfZ.js";import{i as Q,l as D,p as P,u as ot}from"./useEvent-BhXAndur.js";import{t as lt}from"./react-Bj1aDYRI.js";import{$r as ut,Hr as ct,Jr as dt,b as ft,ei as z,y as mt}from"./cells-CiFhRLUd.js";import{B as pt,C as de,D as ht,I as gt,N as yt,P as O,R as fe,k as W,w as me}from"./zod-H_cgTO0M.js";import{t as pe}from"./compiler-runtime-B3qBwwSJ.js";import{t as bt}from"./get-6uJrSKbw.js";import{t as wt}from"./assertNever-CBU83Y6o.js";import{t as vt}from"./debounce-B3mjKxHe.js";import{t as xt}from"./_baseSet-5Rdwpmr3.js";import{d as E,p as y}from"./hotkeys-BHHWjLlp.js";import{t as Et}from"./invariant-CAG_dYON.js";import{S as Ct}from"./utils-YqBXNpsM.js";import{S as _t}from"./config-D2-Bw6QC.js";import{a as kt}from"./switch-BF1BnESM.js";import{n as he}from"./globals-D1aM0aUX.js";import{t as ge}from"./ErrorBoundary-B9Ifj8Jf.js";import{t as Rt}from"./jsx-runtime-ZmTK25f3.js";import{t as Ft}from"./button-CZ3Cs4qb.js";import{t as Nt}from"./cn-BKtXLv3a.js";import{Z as St}from"./JsonOutput-BUok9dqY.js";import{t as qt}from"./createReducer-B3rBsy4P.js";import{t as ye}from"./requests-B4FYHTZl.js";import{t as be}from"./createLucideIcon-BCdY6lG5.js";import{t as Pt}from"./x-ZP5cObgf.js";import{a as Mt,l as jt,r as At}from"./markdown-renderer-Dotqbx_q.js";import{t as Tt}from"./DeferredRequestRegistry-tv0PqJZ0.js";import{t as J}from"./Deferred-CrO5-0RA.js";import{t as we}from"./uuid-DercMavo.js";import{t as It}from"./use-toast-T0_cQDma.js";import{t as ve}from"./tooltip-C_WgOOcZ.js";import{t as xe}from"./mode-O-1bKZO6.js";import{n as Lt,r as Ut,t as zt}from"./share-rXkgGlhr.js";import{r as Ot,t as Wt}from"./react-resizable-panels.browser.esm-Mq45xjWt.js";import{t as Ee}from"./toggle-CriARMQK.js";function Dt(t,e,n){return t==null?t:xt(t,e,n)}var H=Dt,Ht=be("crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]),Bt=be("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);function Vt(t){return{all:t||(t=new Map),on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(s){s(n)}),(r=t.get("*"))&&r.slice().map(function(s){s(e,n)})}}}var u=ce(lt(),1),K=(0,u.createContext)(null),$t=t=>{let{controller:e}=(0,u.useContext)(K),n=u.useRef(Symbol("fill"));return(0,u.useEffect)(()=>(e.mount({name:t.name,ref:n.current,children:t.children}),()=>{e.unmount({name:t.name,ref:n.current})}),[]),(0,u.useEffect)(()=>{e.update({name:t.name,ref:n.current,children:t.children})}),null},Xt=Object.defineProperty,Yt=(t,e,n)=>e in t?Xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ce=(t,e,n)=>(Yt(t,typeof e=="symbol"?e:e+"",n),n),_e=console,Gt=class{constructor(t){Ce(this,"_bus"),Ce(this,"_db"),this._bus=t,this.handleFillMount=this.handleFillMount.bind(this),this.handleFillUpdated=this.handleFillUpdated.bind(this),this.handleFillUnmount=this.handleFillUnmount.bind(this),this._db={byName:new Map,byFill:new Map}}mount(){this._bus.on("fill-mount",this.handleFillMount),this._bus.on("fill-updated",this.handleFillUpdated),this._bus.on("fill-unmount",this.handleFillUnmount)}unmount(){this._bus.off("fill-mount",this.handleFillMount),this._bus.off("fill-updated",this.handleFillUpdated),this._bus.off("fill-unmount",this.handleFillUnmount)}handleFillMount({fill:t}){let e=u.Children.toArray(t.children),n=t.name,r={fill:t,children:e,name:n},s=this._db.byName.get(n);s?(s.components.push(r),s.listeners.forEach(i=>i([...s.components]))):this._db.byName.set(n,{listeners:[],components:[r]}),this._db.byFill.set(t.ref,r)}handleFillUpdated({fill:t}){let e=this._db.byFill.get(t.ref),n=u.Children.toArray(t.children);if(e){e.children=n;let r=this._db.byName.get(e.name);if(r)r.listeners.forEach(s=>s([...r.components]));else throw Error("registration was expected to be defined")}else{_e.error("[handleFillUpdated] component was expected to be defined");return}}handleFillUnmount({fill:t}){let e=this._db.byFill.get(t.ref);if(!e){_e.error("[handleFillUnmount] component was expected to be defined");return}let n=e.name,r=this._db.byName.get(n);if(!r)throw Error("registration was expected to be defined");r.components=r.components.filter(s=>s!==e),this._db.byFill.delete(t.ref),r.listeners.length===0&&r.components.length===0?this._db.byName.delete(n):r.listeners.forEach(s=>s([...r.components]))}onComponentsChange(t,e){let n=this._db.byName.get(t);n?(n.listeners.push(e),e(n.components)):(this._db.byName.set(t,{listeners:[e],components:[]}),e([]))}getFillsByName(t){let e=this._db.byName.get(t);return e?e.components.map(n=>n.fill):[]}getChildrenByName(t){let e=this._db.byName.get(t);return e?e.components.map(n=>n.children).reduce((n,r)=>n.concat(r),[]):[]}removeOnComponentsChange(t,e){let n=this._db.byName.get(t);if(!n)throw Error("expected registration to be defined");let r=n.listeners;r.splice(r.indexOf(e),1)}},Qt=Object.defineProperty,Jt=(t,e,n)=>e in t?Qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kt=(t,e,n)=>(Jt(t,typeof e=="symbol"?e:e+"",n),n),ke=class{constructor(){Kt(this,"bus",Vt())}mount(t){this.bus.emit("fill-mount",{fill:t})}unmount(t){this.bus.emit("fill-unmount",{fill:t})}update(t){this.bus.emit("fill-updated",{fill:t})}};function Zt(t){let e=t||new ke;return{controller:e,manager:new Gt(e.bus)}}var en=({controller:t,children:e})=>{let[n]=u.useState(()=>{let r=Zt(t);return r.manager.mount(),r});return u.useEffect(()=>()=>{n.manager.unmount()},[]),u.createElement(K.Provider,{value:n},e)};function Z(t,e){let[n,r]=(0,u.useState)([]),{manager:s}=(0,u.useContext)(K);return(0,u.useEffect)(()=>(s.onComponentsChange(t,r),()=>{s.removeOnComponentsChange(t,r)}),[t]),n.flatMap((i,d)=>{let{children:l}=i;return l.map((p,b)=>{if(typeof p=="number"||typeof p=="string")throw Error("Only element children will work here");return u.cloneElement(p,{key:d.toString()+b.toString(),...e})})})}var Re=t=>{let e=Z(t.name,t.childProps);if(typeof t.children=="function"){let n=t.children(e);if(u.isValidElement(n)||n===null)return n;throw Error("Slot rendered with function must return a valid React Element.")}return e};const tn=P(null);var{valueAtom:nn,useActions:rn}=qt(()=>({banners:[]}),{addBanner:(t,e)=>({...t,banners:[...t.banners,{...e,id:we()}]}),removeBanner:(t,e)=>({...t,banners:t.banners.filter(n=>n.id!==e)}),clearBanners:t=>({...t,banners:[]})});const sn=()=>ot(nn);function an(){return rn()}const on=new ke,B={SIDEBAR:"sidebar",CONTEXT_AWARE_PANEL:"context-aware-panel"};var ln=class{constructor(){a(this,"subscriptions",new Map)}addSubscription(t,e){var n;this.subscriptions.has(t)||this.subscriptions.set(t,new Set),(n=this.subscriptions.get(t))==null||n.add(e)}removeSubscription(t,e){var n;(n=this.subscriptions.get(t))==null||n.delete(e)}notify(t,e){for(let n of this.subscriptions.get(t)??[])n(e)}},Fe=class ue{constructor(e){a(this,"subscriptions",new ln);this.producer=e}static withProducerCallback(e){return new ue(e)}static empty(){return new ue}startProducer(){this.producer&&this.producer(e=>{this.subscriptions.notify("message",e)})}connect(){return new Promise(e=>setTimeout(e,0)).then(()=>{this.subscriptions.notify("open",new Event("open"))})}get readyState(){return WebSocket.OPEN}reconnect(e,n){this.close(),this.connect()}close(){this.subscriptions.notify("close",new Event("close"))}send(e){return this.subscriptions.notify("message",new MessageEvent("message",{data:e})),Promise.resolve()}addEventListener(e,n){this.subscriptions.addSubscription(e,n),e==="open"&&n(new Event("open")),e==="message"&&this.startProducer()}removeEventListener(e,n){this.subscriptions.removeSubscription(e,n)}},un=1e10,cn=1e3;function V(t,e){let n=t.map(r=>`"${r}"`).join(", ");return Error(`This RPC instance cannot ${e} because the transport did not provide one or more of these methods: ${n}`)}function dn(t={}){let e={};function n(o){e=o}let r={};function s(o){var f;r.unregisterHandler&&r.unregisterHandler(),r=o,(f=r.registerHandler)==null||f.call(r,U)}let i;function d(o){if(typeof o=="function"){i=o;return}i=(f,g)=>{let c=o[f];if(c)return c(g);let h=o._;if(!h)throw Error(`The requested method has no handler: ${f}`);return h(f,g)}}let{maxRequestTime:l=cn}=t;t.transport&&s(t.transport),t.requestHandler&&d(t.requestHandler),t._debugHooks&&n(t._debugHooks);let p=0;function b(){return p<=un?++p:p=0}let x=new Map,w=new Map;function C(o,...f){let g=f[0];return new Promise((c,h)=>{var T;if(!r.send)throw V(["send"],"make requests");let S=b(),M={type:"request",id:S,method:o,params:g};x.set(S,{resolve:c,reject:h}),l!==1/0&&w.set(S,setTimeout(()=>{w.delete(S),h(Error("RPC request timed out."))},l)),(T=e.onSend)==null||T.call(e,M),r.send(M)})}let F=new Proxy(C,{get:(o,f,g)=>f in o?Reflect.get(o,f,g):c=>C(f,c)}),_=F;function k(o,...f){var h;let g=f[0];if(!r.send)throw V(["send"],"send messages");let c={type:"message",id:o,payload:g};(h=e.onSend)==null||h.call(e,c),r.send(c)}let R=new Proxy(k,{get:(o,f,g)=>f in o?Reflect.get(o,f,g):c=>k(f,c)}),v=R,N=new Map,q=new Set;function A(o,f){var g;if(!r.registerHandler)throw V(["registerHandler"],"register message listeners");if(o==="*"){q.add(f);return}N.has(o)||N.set(o,new Set),(g=N.get(o))==null||g.add(f)}function L(o,f){var g,c;if(o==="*"){q.delete(f);return}(g=N.get(o))==null||g.delete(f),((c=N.get(o))==null?void 0:c.size)===0&&N.delete(o)}async function U(o){var f,g;if((f=e.onReceive)==null||f.call(e,o),!("type"in o))throw Error("Message does not contain a type.");if(o.type==="request"){if(!r.send||!i)throw V(["send","requestHandler"],"handle requests");let{id:c,method:h,params:S}=o,M;try{M={type:"response",id:c,success:!0,payload:await i(h,S)}}catch(T){if(!(T instanceof Error))throw T;M={type:"response",id:c,success:!1,error:T.message}}(g=e.onSend)==null||g.call(e,M),r.send(M);return}if(o.type==="response"){let c=w.get(o.id);c!=null&&clearTimeout(c);let{resolve:h,reject:S}=x.get(o.id)??{};o.success?h==null||h(o.payload):S==null||S(Error(o.error));return}if(o.type==="message"){for(let h of q)h(o.id,o.payload);let c=N.get(o.id);if(!c)return;for(let h of c)h(o.payload);return}throw Error(`Unexpected RPC message type: ${o.type}`)}return{setTransport:s,setRequestHandler:d,request:F,requestProxy:_,send:R,sendProxy:v,addMessageListener:A,removeMessageListener:L,proxy:{send:v,request:_},_setDebugHooks:n}}function fn(t){return dn(t)}var Ne="[transport-id]";function mn(t,e){let{transportId:n}=e;return n==null?t:{[Ne]:n,data:t}}function pn(t,e){let{transportId:n,filter:r}=e,s=r==null?void 0:r();if(n!=null&&s!=null)throw Error("Cannot use both `transportId` and `filter` at the same time");let i=t;if(n){if(t[Ne]!==n)return[!0];i=t.data}return s===!1?[!0]:[!1,i]}function hn(t,e={}){let{transportId:n,filter:r,remotePort:s}=e,i=t,d=s??t,l;return{send(p){d.postMessage(mn(p,{transportId:n}))},registerHandler(p){l=b=>{let x=b.data,[w,C]=pn(x,{transportId:n,filter:()=>r==null?void 0:r(b)});w||p(C)},i.addEventListener("message",l)},unregisterHandler(){l&&i.removeEventListener("message",l)}}}function gn(t,e){return hn(t,e)}function Se(t){return fn({transport:gn(t,{transportId:"marimo-transport"}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{E.debug("[rpc] Parent -> Worker",e)},onReceive:e=>{E.debug("[rpc] Worker -> Parent",e)}}})}const qe=P("Initializing..."),yn=P(t=>{let e=t(mt),n=Object.values(e.cellRuntime);return n.some(r=>!jt(r.output))?!0:n.every(r=>r.status==="idle")});var Pe=Lt(),Me="marimo:file",je=new ct(null);const bn={saveFile(t){je.set(Me,t)},readFile(){return je.get(Me)}};var wn={saveFile(t){z.setCodeForHash((0,Pe.compressToEncodedURIComponent)(t))},readFile(){let t=z.getCodeFromHash()||z.getCodeFromSearchParam();return t?(0,Pe.decompressFromEncodedURIComponent)(t):null}};const vn={saveFile(t){},readFile(){let t=document.querySelector("marimo-code");return t?decodeURIComponent(t.textContent||"").trim():null}};var xn={saveFile(t){},readFile(){if(window.location.hostname!=="marimo.app")return null;let t=new URL("files/wasm-intro.py",document.baseURI);return fetch(t.toString()).then(e=>e.ok?e.text():null).catch(()=>null)}},En={saveFile(t){},readFile(){return["import marimo","app = marimo.App()","","@app.cell","def __():"," return","",'if __name__ == "__main__":'," app.run()"].join(`
1
+ var at=Object.defineProperty;var it=(t,e,n)=>e in t?at(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e,n)=>it(t,typeof e!="symbol"?e+"":e,n);var j;import{s as ce}from"./chunk-LvLJmgfZ.js";import{i as Q,l as D,p as P,u as ot}from"./useEvent-BhXAndur.js";import{t as lt}from"./react-Bj1aDYRI.js";import{$r as ut,Hr as ct,Jr as dt,b as ft,ei as z,y as mt}from"./cells-B0XKj2oa.js";import{B as pt,C as de,D as ht,I as gt,N as yt,P as O,R as fe,k as W,w as me}from"./zod-H_cgTO0M.js";import{t as pe}from"./compiler-runtime-B3qBwwSJ.js";import{t as bt}from"./get-6uJrSKbw.js";import{t as wt}from"./assertNever-CBU83Y6o.js";import{t as vt}from"./debounce-B3mjKxHe.js";import{t as xt}from"./_baseSet-5Rdwpmr3.js";import{d as E,p as y}from"./hotkeys-BHHWjLlp.js";import{t as Et}from"./invariant-CAG_dYON.js";import{S as Ct}from"./utils-YqBXNpsM.js";import{S as _t}from"./config-D2-Bw6QC.js";import{a as kt}from"./switch-D5W4wgWK.js";import{n as he}from"./globals-DvWD0xHx.js";import{t as ge}from"./ErrorBoundary-B9Ifj8Jf.js";import{t as Rt}from"./jsx-runtime-ZmTK25f3.js";import{t as Ft}from"./button-CZ3Cs4qb.js";import{t as Nt}from"./cn-BKtXLv3a.js";import{Z as St}from"./JsonOutput-CU0ad2LH.js";import{t as qt}from"./createReducer-B3rBsy4P.js";import{t as ye}from"./requests-B4FYHTZl.js";import{t as be}from"./createLucideIcon-BCdY6lG5.js";import{t as Pt}from"./x-ZP5cObgf.js";import{a as Mt,l as jt,r as At}from"./markdown-renderer-Y3WEBmX7.js";import{t as Tt}from"./DeferredRequestRegistry-tv0PqJZ0.js";import{t as J}from"./Deferred-CrO5-0RA.js";import{t as we}from"./uuid-DercMavo.js";import{t as It}from"./use-toast-T0_cQDma.js";import{t as ve}from"./tooltip-C_WgOOcZ.js";import{t as xe}from"./mode-CTf4rB7H.js";import{n as Lt,r as Ut,t as zt}from"./share-rXkgGlhr.js";import{r as Ot,t as Wt}from"./react-resizable-panels.browser.esm-Mq45xjWt.js";import{t as Ee}from"./toggle-CriARMQK.js";function Dt(t,e,n){return t==null?t:xt(t,e,n)}var H=Dt,Ht=be("crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]),Bt=be("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);function Vt(t){return{all:t||(t=new Map),on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(s){s(n)}),(r=t.get("*"))&&r.slice().map(function(s){s(e,n)})}}}var u=ce(lt(),1),K=(0,u.createContext)(null),$t=t=>{let{controller:e}=(0,u.useContext)(K),n=u.useRef(Symbol("fill"));return(0,u.useEffect)(()=>(e.mount({name:t.name,ref:n.current,children:t.children}),()=>{e.unmount({name:t.name,ref:n.current})}),[]),(0,u.useEffect)(()=>{e.update({name:t.name,ref:n.current,children:t.children})}),null},Xt=Object.defineProperty,Yt=(t,e,n)=>e in t?Xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ce=(t,e,n)=>(Yt(t,typeof e=="symbol"?e:e+"",n),n),_e=console,Gt=class{constructor(t){Ce(this,"_bus"),Ce(this,"_db"),this._bus=t,this.handleFillMount=this.handleFillMount.bind(this),this.handleFillUpdated=this.handleFillUpdated.bind(this),this.handleFillUnmount=this.handleFillUnmount.bind(this),this._db={byName:new Map,byFill:new Map}}mount(){this._bus.on("fill-mount",this.handleFillMount),this._bus.on("fill-updated",this.handleFillUpdated),this._bus.on("fill-unmount",this.handleFillUnmount)}unmount(){this._bus.off("fill-mount",this.handleFillMount),this._bus.off("fill-updated",this.handleFillUpdated),this._bus.off("fill-unmount",this.handleFillUnmount)}handleFillMount({fill:t}){let e=u.Children.toArray(t.children),n=t.name,r={fill:t,children:e,name:n},s=this._db.byName.get(n);s?(s.components.push(r),s.listeners.forEach(i=>i([...s.components]))):this._db.byName.set(n,{listeners:[],components:[r]}),this._db.byFill.set(t.ref,r)}handleFillUpdated({fill:t}){let e=this._db.byFill.get(t.ref),n=u.Children.toArray(t.children);if(e){e.children=n;let r=this._db.byName.get(e.name);if(r)r.listeners.forEach(s=>s([...r.components]));else throw Error("registration was expected to be defined")}else{_e.error("[handleFillUpdated] component was expected to be defined");return}}handleFillUnmount({fill:t}){let e=this._db.byFill.get(t.ref);if(!e){_e.error("[handleFillUnmount] component was expected to be defined");return}let n=e.name,r=this._db.byName.get(n);if(!r)throw Error("registration was expected to be defined");r.components=r.components.filter(s=>s!==e),this._db.byFill.delete(t.ref),r.listeners.length===0&&r.components.length===0?this._db.byName.delete(n):r.listeners.forEach(s=>s([...r.components]))}onComponentsChange(t,e){let n=this._db.byName.get(t);n?(n.listeners.push(e),e(n.components)):(this._db.byName.set(t,{listeners:[e],components:[]}),e([]))}getFillsByName(t){let e=this._db.byName.get(t);return e?e.components.map(n=>n.fill):[]}getChildrenByName(t){let e=this._db.byName.get(t);return e?e.components.map(n=>n.children).reduce((n,r)=>n.concat(r),[]):[]}removeOnComponentsChange(t,e){let n=this._db.byName.get(t);if(!n)throw Error("expected registration to be defined");let r=n.listeners;r.splice(r.indexOf(e),1)}},Qt=Object.defineProperty,Jt=(t,e,n)=>e in t?Qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kt=(t,e,n)=>(Jt(t,typeof e=="symbol"?e:e+"",n),n),ke=class{constructor(){Kt(this,"bus",Vt())}mount(t){this.bus.emit("fill-mount",{fill:t})}unmount(t){this.bus.emit("fill-unmount",{fill:t})}update(t){this.bus.emit("fill-updated",{fill:t})}};function Zt(t){let e=t||new ke;return{controller:e,manager:new Gt(e.bus)}}var en=({controller:t,children:e})=>{let[n]=u.useState(()=>{let r=Zt(t);return r.manager.mount(),r});return u.useEffect(()=>()=>{n.manager.unmount()},[]),u.createElement(K.Provider,{value:n},e)};function Z(t,e){let[n,r]=(0,u.useState)([]),{manager:s}=(0,u.useContext)(K);return(0,u.useEffect)(()=>(s.onComponentsChange(t,r),()=>{s.removeOnComponentsChange(t,r)}),[t]),n.flatMap((i,d)=>{let{children:l}=i;return l.map((p,b)=>{if(typeof p=="number"||typeof p=="string")throw Error("Only element children will work here");return u.cloneElement(p,{key:d.toString()+b.toString(),...e})})})}var Re=t=>{let e=Z(t.name,t.childProps);if(typeof t.children=="function"){let n=t.children(e);if(u.isValidElement(n)||n===null)return n;throw Error("Slot rendered with function must return a valid React Element.")}return e};const tn=P(null);var{valueAtom:nn,useActions:rn}=qt(()=>({banners:[]}),{addBanner:(t,e)=>({...t,banners:[...t.banners,{...e,id:we()}]}),removeBanner:(t,e)=>({...t,banners:t.banners.filter(n=>n.id!==e)}),clearBanners:t=>({...t,banners:[]})});const sn=()=>ot(nn);function an(){return rn()}const on=new ke,B={SIDEBAR:"sidebar",CONTEXT_AWARE_PANEL:"context-aware-panel"};var ln=class{constructor(){a(this,"subscriptions",new Map)}addSubscription(t,e){var n;this.subscriptions.has(t)||this.subscriptions.set(t,new Set),(n=this.subscriptions.get(t))==null||n.add(e)}removeSubscription(t,e){var n;(n=this.subscriptions.get(t))==null||n.delete(e)}notify(t,e){for(let n of this.subscriptions.get(t)??[])n(e)}},Fe=class ue{constructor(e){a(this,"subscriptions",new ln);this.producer=e}static withProducerCallback(e){return new ue(e)}static empty(){return new ue}startProducer(){this.producer&&this.producer(e=>{this.subscriptions.notify("message",e)})}connect(){return new Promise(e=>setTimeout(e,0)).then(()=>{this.subscriptions.notify("open",new Event("open"))})}get readyState(){return WebSocket.OPEN}reconnect(e,n){this.close(),this.connect()}close(){this.subscriptions.notify("close",new Event("close"))}send(e){return this.subscriptions.notify("message",new MessageEvent("message",{data:e})),Promise.resolve()}addEventListener(e,n){this.subscriptions.addSubscription(e,n),e==="open"&&n(new Event("open")),e==="message"&&this.startProducer()}removeEventListener(e,n){this.subscriptions.removeSubscription(e,n)}},un=1e10,cn=1e3;function V(t,e){let n=t.map(r=>`"${r}"`).join(", ");return Error(`This RPC instance cannot ${e} because the transport did not provide one or more of these methods: ${n}`)}function dn(t={}){let e={};function n(o){e=o}let r={};function s(o){var f;r.unregisterHandler&&r.unregisterHandler(),r=o,(f=r.registerHandler)==null||f.call(r,U)}let i;function d(o){if(typeof o=="function"){i=o;return}i=(f,g)=>{let c=o[f];if(c)return c(g);let h=o._;if(!h)throw Error(`The requested method has no handler: ${f}`);return h(f,g)}}let{maxRequestTime:l=cn}=t;t.transport&&s(t.transport),t.requestHandler&&d(t.requestHandler),t._debugHooks&&n(t._debugHooks);let p=0;function b(){return p<=un?++p:p=0}let x=new Map,w=new Map;function C(o,...f){let g=f[0];return new Promise((c,h)=>{var T;if(!r.send)throw V(["send"],"make requests");let S=b(),M={type:"request",id:S,method:o,params:g};x.set(S,{resolve:c,reject:h}),l!==1/0&&w.set(S,setTimeout(()=>{w.delete(S),h(Error("RPC request timed out."))},l)),(T=e.onSend)==null||T.call(e,M),r.send(M)})}let F=new Proxy(C,{get:(o,f,g)=>f in o?Reflect.get(o,f,g):c=>C(f,c)}),_=F;function k(o,...f){var h;let g=f[0];if(!r.send)throw V(["send"],"send messages");let c={type:"message",id:o,payload:g};(h=e.onSend)==null||h.call(e,c),r.send(c)}let R=new Proxy(k,{get:(o,f,g)=>f in o?Reflect.get(o,f,g):c=>k(f,c)}),v=R,N=new Map,q=new Set;function A(o,f){var g;if(!r.registerHandler)throw V(["registerHandler"],"register message listeners");if(o==="*"){q.add(f);return}N.has(o)||N.set(o,new Set),(g=N.get(o))==null||g.add(f)}function L(o,f){var g,c;if(o==="*"){q.delete(f);return}(g=N.get(o))==null||g.delete(f),((c=N.get(o))==null?void 0:c.size)===0&&N.delete(o)}async function U(o){var f,g;if((f=e.onReceive)==null||f.call(e,o),!("type"in o))throw Error("Message does not contain a type.");if(o.type==="request"){if(!r.send||!i)throw V(["send","requestHandler"],"handle requests");let{id:c,method:h,params:S}=o,M;try{M={type:"response",id:c,success:!0,payload:await i(h,S)}}catch(T){if(!(T instanceof Error))throw T;M={type:"response",id:c,success:!1,error:T.message}}(g=e.onSend)==null||g.call(e,M),r.send(M);return}if(o.type==="response"){let c=w.get(o.id);c!=null&&clearTimeout(c);let{resolve:h,reject:S}=x.get(o.id)??{};o.success?h==null||h(o.payload):S==null||S(Error(o.error));return}if(o.type==="message"){for(let h of q)h(o.id,o.payload);let c=N.get(o.id);if(!c)return;for(let h of c)h(o.payload);return}throw Error(`Unexpected RPC message type: ${o.type}`)}return{setTransport:s,setRequestHandler:d,request:F,requestProxy:_,send:R,sendProxy:v,addMessageListener:A,removeMessageListener:L,proxy:{send:v,request:_},_setDebugHooks:n}}function fn(t){return dn(t)}var Ne="[transport-id]";function mn(t,e){let{transportId:n}=e;return n==null?t:{[Ne]:n,data:t}}function pn(t,e){let{transportId:n,filter:r}=e,s=r==null?void 0:r();if(n!=null&&s!=null)throw Error("Cannot use both `transportId` and `filter` at the same time");let i=t;if(n){if(t[Ne]!==n)return[!0];i=t.data}return s===!1?[!0]:[!1,i]}function hn(t,e={}){let{transportId:n,filter:r,remotePort:s}=e,i=t,d=s??t,l;return{send(p){d.postMessage(mn(p,{transportId:n}))},registerHandler(p){l=b=>{let x=b.data,[w,C]=pn(x,{transportId:n,filter:()=>r==null?void 0:r(b)});w||p(C)},i.addEventListener("message",l)},unregisterHandler(){l&&i.removeEventListener("message",l)}}}function gn(t,e){return hn(t,e)}function Se(t){return fn({transport:gn(t,{transportId:"marimo-transport"}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{E.debug("[rpc] Parent -> Worker",e)},onReceive:e=>{E.debug("[rpc] Worker -> Parent",e)}}})}const qe=P("Initializing..."),yn=P(t=>{let e=t(mt),n=Object.values(e.cellRuntime);return n.some(r=>!jt(r.output))?!0:n.every(r=>r.status==="idle")});var Pe=Lt(),Me="marimo:file",je=new ct(null);const bn={saveFile(t){je.set(Me,t)},readFile(){return je.get(Me)}};var wn={saveFile(t){z.setCodeForHash((0,Pe.compressToEncodedURIComponent)(t))},readFile(){let t=z.getCodeFromHash()||z.getCodeFromSearchParam();return t?(0,Pe.decompressFromEncodedURIComponent)(t):null}};const vn={saveFile(t){},readFile(){let t=document.querySelector("marimo-code");return t?decodeURIComponent(t.textContent||"").trim():null}};var xn={saveFile(t){},readFile(){if(window.location.hostname!=="marimo.app")return null;let t=new URL("files/wasm-intro.py",document.baseURI);return fetch(t.toString()).then(e=>e.ok?e.text():null).catch(()=>null)}},En={saveFile(t){},readFile(){return["import marimo","app = marimo.App()","","@app.cell","def __():"," return","",'if __name__ == "__main__":'," app.run()"].join(`
2
2
  `)}},Ae=class{constructor(t){this.stores=t}insert(t,e){this.stores.splice(t,0,e)}saveFile(t){this.stores.forEach(e=>e.saveFile(t))}readFile(){for(let t of this.stores){let e=t.readFile();if(e)return e}return null}};const $=new Ae([vn,wn]),ee=new Ae([bn,xn,En]);var Te=class rt{constructor(){a(this,"initialized",new J);a(this,"sendRename",async({filename:e})=>(e===null||(z.setFilename(e),await this.rpc.proxy.request.bridge({functionName:"rename_file",payload:e})),null));a(this,"sendSave",async e=>{if(!this.saveRpc)return E.warn("Save RPC not initialized"),null;await this.saveRpc.saveNotebook(e);let n=await this.readCode();return n.contents&&($.saveFile(n.contents),ee.saveFile(n.contents)),this.rpc.proxy.request.saveNotebook(e).catch(r=>{E.error(r)}),null});a(this,"sendCopy",async()=>{y()});a(this,"sendStdin",async e=>(await this.rpc.proxy.request.bridge({functionName:"put_input",payload:e.text}),null));a(this,"sendPdb",async()=>{y()});a(this,"sendRun",async e=>(await this.rpc.proxy.request.loadPackages(e.codes.join(`
3
3
  `)),await this.putControlRequest({type:"execute-cells",...e}),null));a(this,"sendRunScratchpad",async e=>(await this.rpc.proxy.request.loadPackages(e.code),await this.putControlRequest({type:"execute-scratchpad",...e}),null));a(this,"sendInterrupt",async()=>(this.interruptBuffer!==void 0&&(this.interruptBuffer[0]=2),null));a(this,"sendShutdown",async()=>(window.close(),null));a(this,"sendFormat",async e=>await this.rpc.proxy.request.bridge({functionName:"format",payload:e}));a(this,"sendDeleteCell",async e=>(await this.putControlRequest({type:"delete-cell",...e}),null));a(this,"sendInstallMissingPackages",async e=>(this.putControlRequest({type:"install-packages",...e}),null));a(this,"sendCodeCompletionRequest",async e=>(Q.get(ft)||await this.rpc.proxy.request.bridge({functionName:"code_complete",payload:e}),null));a(this,"saveUserConfig",async e=>(await this.rpc.proxy.request.bridge({functionName:"save_user_config",payload:e}),kt.post("/kernel/save_user_config",e,{baseUrl:"/"}).catch(n=>(E.error(n),null))));a(this,"saveAppConfig",async e=>(await this.rpc.proxy.request.bridge({functionName:"save_app_config",payload:e}),null));a(this,"saveCellConfig",async e=>(await this.putControlRequest({type:"update-cell-config",...e}),null));a(this,"sendRestart",async()=>{let e=await this.readCode();return e.contents&&($.saveFile(e.contents),ee.saveFile(e.contents)),Ut(),null});a(this,"readCode",async()=>this.saveRpc?{contents:await this.saveRpc.readNotebook()}:(E.warn("Save RPC not initialized"),{contents:""}));a(this,"readSnippets",async()=>await this.rpc.proxy.request.bridge({functionName:"read_snippets",payload:void 0}));a(this,"openFile",async({path:e})=>{let n=zt({code:null,baseUrl:window.location.origin});return window.open(n,"_blank"),null});a(this,"sendListFiles",async e=>await this.rpc.proxy.request.bridge({functionName:"list_files",payload:e}));a(this,"sendSearchFiles",async e=>await this.rpc.proxy.request.bridge({functionName:"search_files",payload:e}));a(this,"sendComponentValues",async e=>(await this.putControlRequest({type:"update-ui-element",...e,token:we()}),null));a(this,"sendInstantiate",async e=>null);a(this,"sendFunctionRequest",async e=>(await this.putControlRequest({type:"invoke-function",...e}),null));a(this,"sendCreateFileOrFolder",async e=>await this.rpc.proxy.request.bridge({functionName:"create_file_or_directory",payload:e}));a(this,"sendDeleteFileOrFolder",async e=>await this.rpc.proxy.request.bridge({functionName:"delete_file_or_directory",payload:e}));a(this,"sendRenameFileOrFolder",async e=>await this.rpc.proxy.request.bridge({functionName:"move_file_or_directory",payload:e}));a(this,"sendUpdateFile",async e=>await this.rpc.proxy.request.bridge({functionName:"update_file",payload:e}));a(this,"sendFileDetails",async e=>await this.rpc.proxy.request.bridge({functionName:"file_details",payload:e}));a(this,"exportAsHTML",async e=>await this.rpc.proxy.request.bridge({functionName:"export_html",payload:e}));a(this,"exportAsMarkdown",async e=>await this.rpc.proxy.request.bridge({functionName:"export_markdown",payload:e}));a(this,"previewDatasetColumn",async e=>(await this.putControlRequest({type:"preview-dataset-column",...e}),null));a(this,"previewSQLTable",async e=>(await this.putControlRequest({type:"preview-sql-table",...e}),null));a(this,"previewSQLTableList",async e=>(await this.putControlRequest({type:"list-sql-tables",...e}),null));a(this,"previewDataSourceConnection",async e=>(await this.putControlRequest({type:"list-data-source-connection",...e}),null));a(this,"validateSQL",async e=>(await this.putControlRequest({type:"validate-sql",...e}),null));a(this,"sendModelValue",async e=>(await this.putControlRequest({type:"update-widget-model",...e}),null));a(this,"syncCellIds",()=>Promise.resolve(null));a(this,"addPackage",async e=>this.rpc.proxy.request.addPackage(e));a(this,"removePackage",async e=>this.rpc.proxy.request.removePackage(e));a(this,"getPackageList",async()=>await this.rpc.proxy.request.listPackages());a(this,"getDependencyTree",async()=>({tree:{dependencies:[],name:"",tags:[],version:null}}));a(this,"listSecretKeys",async e=>(await this.putControlRequest({type:"list-secret-keys",...e}),null));a(this,"getUsageStats",y);a(this,"openTutorial",y);a(this,"getRecentFiles",y);a(this,"getWorkspaceFiles",y);a(this,"getRunningNotebooks",y);a(this,"shutdownSession",y);a(this,"exportAsPDF",y);a(this,"autoExportAsHTML",y);a(this,"autoExportAsMarkdown",y);a(this,"autoExportAsIPYNB",y);a(this,"updateCellOutputs",y);a(this,"writeSecret",y);a(this,"invokeAiTool",y);a(this,"clearCache",y);a(this,"getCacheInfo",y);_t()&&(this.rpc=Se(new Worker(new URL(""+new URL("worker-CyCdlLVf.js",import.meta.url).href,""+import.meta.url),{type:"module",name:he()})),this.rpc.addMessageListener("ready",()=>{this.startSession()}),this.rpc.addMessageListener("initialized",()=>{this.saveRpc=this.getSaveWorker(),this.setInterruptBuffer(),this.initialized.resolve()}),this.rpc.addMessageListener("initializingMessage",({message:e})=>{Q.set(qe,e)}),this.rpc.addMessageListener("initializedError",({error:e})=>{this.initialized.status==="resolved"&&(E.error(e),It({title:"Error initializing",description:e,variant:"danger"})),this.initialized.reject(Error(e))}),this.rpc.addMessageListener("kernelMessage",({message:e})=>{var n;(n=this.messageConsumer)==null||n.call(this,new MessageEvent("message",{data:e}))}))}static get INSTANCE(){let e="_marimo_private_PyodideBridge";return window[e]||(window[e]=new rt),window[e]}getSaveWorker(){return xe()==="read"?(E.debug("Skipping SaveWorker in read-mode"),{readFile:y,readNotebook:y,saveNotebook:y}):Se(new Worker(new URL(""+new URL("save-worker-CtJsIYIM.js",import.meta.url).href,""+import.meta.url),{type:"module",name:he()})).proxy.request}async startSession(){let e=await $.readFile(),n=await ee.readFile(),r=z.getFilename(),s=Q.get(Ct),i={},d=new URLSearchParams(window.location.search);for(let l of d.keys()){let p=d.getAll(l);i[l]=p.length===1?p[0]:p}await this.rpc.proxy.request.startSession({queryParameters:i,code:e||n||"",filename:r,userConfig:{...s,runtime:{...s.runtime,auto_instantiate:xe()==="read"?!0:s.runtime.auto_instantiate}}})}setInterruptBuffer(){crossOriginIsolated?(this.interruptBuffer=new Uint8Array(new SharedArrayBuffer(1)),this.rpc.proxy.request.setInterruptBuffer(this.interruptBuffer)):E.warn("Not running in a secure context; interrupts are not available.")}attachMessageConsumer(e){this.messageConsumer=e,this.rpc.proxy.send.consumerReady({})}async putControlRequest(e){await this.rpc.proxy.request.bridge({functionName:"put_control_request",payload:e})}};function Cn(){return Fe.withProducerCallback(t=>{Te.INSTANCE.attachMessageConsumer(t)})}function X(t){return()=>({TYPE:t,is(e){return e.type===t},create(e){return new CustomEvent(t,e)}})}const Ie=X("marimo-value-input")(),Le=X("marimo-value-update")(),Ue=X("marimo-value-ready")(),ze=X("marimo-incoming-message")();function _n(t,e){return Ie.create({bubbles:!0,composed:!0,detail:{value:t,element:e}})}var Oe=class st{static get INSTANCE(){let e="_marimo_private_UIElementRegistry";return window[e]||(window[e]=new st),window[e]}constructor(){this.entries=new Map}has(e){return this.entries.has(e)}set(e,n){if(this.entries.has(e))throw Error(`UIElement ${e} already registered`);this.entries.set(e,{objectId:e,value:n,elements:new Set})}registerInstance(e,n){let r=this.entries.get(e);r===void 0?this.entries.set(e,{objectId:e,value:ut(n,this),elements:new Set([n])}):r.elements.add(n)}removeInstance(e,n){let r=this.entries.get(e);r!=null&&r.elements.has(n)&&r.elements.delete(n)}removeElementsByCell(e){[...this.entries.keys()].filter(n=>n.startsWith(`${e}-`)).forEach(n=>{this.entries.delete(n)})}lookupValue(e){let n=this.entries.get(e);return n===void 0?void 0:n.value}broadcastMessage(e,n,r){let s=this.entries.get(e);s===void 0?E.warn("UIElementRegistry missing entry",e):s.elements.forEach(i=>{i.dispatchEvent(ze.create({bubbles:!1,composed:!0,detail:{objectId:e,message:n,buffers:r}}))})}broadcastValueUpdate(e,n,r){let s=this.entries.get(n);s===void 0?E.warn("UIElementRegistry missing entry",n):(s.value=r,s.elements.forEach(i=>{i!==e&&i.dispatchEvent(Le.create({bubbles:!1,composed:!0,detail:{value:r,element:i}}))}),document.dispatchEvent(Ue.create({bubbles:!0,composed:!0,detail:{objectId:n}})))}};const kn=Oe.INSTANCE,Rn=new Tt("function-call-result",async(t,e)=>{await ye().sendFunctionRequest({functionCallId:t,...e})}),Fn="68px";var Nn="288px";const Sn=t=>t?/^\d+$/.test(t)?`${t}px`:t:Nn,qn=dt({isOpen:!0},(t,e)=>{if(!e)return t;switch(e.type){case"toggle":return{...t,isOpen:e.isOpen??t.isOpen};case"setWidth":return{...t,width:e.width};default:return t}});function te(t,e=[]){let n=[];if(t instanceof DataView)n.push(e);else if(Array.isArray(t))for(let[r,s]of t.entries())n.push(...te(s,[...e,r]));else if(typeof t=="object"&&t)for(let[r,s]of Object.entries(t))n.push(...te(s,[...e,r]));return n}function ne(t){let e=te(t);if(e.length===0)return{state:t,buffers:[],bufferPaths:[]};let n=structuredClone(t),r=[],s=[];for(let i of e){let d=bt(t,i);if(d instanceof DataView){let l=Mt(d);r.push(l),s.push(i),H(n,i,l)}}return{state:n,buffers:r,bufferPaths:s}}function Pn(t){return typeof t=="object"&&!!t&&"state"in t&&"bufferPaths"in t&&"buffers"in t}function Y(t){let{state:e,bufferPaths:n,buffers:r}=t;if(!n||n.length===0)return e;r&&Et(r.length===n.length,"Buffers and buffer paths not the same length");let s=structuredClone(e);for(let[i,d]of n.entries()){let l=r==null?void 0:r[i];if(l==null){E.warn("[anywidget] Could not find buffer at path",d);continue}typeof l=="string"?H(s,d,At(l)):H(s,d,l)}return s}const We=new class{constructor(t=1e4){a(this,"models",new Map);this.timeout=t}get(t){let e=this.models.get(t);return e||(e=new J,this.models.set(t,e),setTimeout(()=>{e.status==="pending"&&(e.reject(Error(`Model not found for key: ${t}`)),this.models.delete(t))},this.timeout)),e.promise}set(t,e){let n=this.models.get(t);n||(n=new J,this.models.set(t,n)),n.resolve(e)}delete(t){this.models.delete(t)}};var De=(j=class{constructor(e,n,r,s){a(this,"ANY_CHANGE_EVENT","change");a(this,"listeners",{});a(this,"widget_manager",{async get_model(e){let n=await j._modelManager.get(e);if(!n)throw Error(`Model not found with id: ${e}. This is likely because the model was not registered.`);return n}});a(this,"emitAnyChange",vt(()=>{var e;(e=this.listeners[this.ANY_CHANGE_EVENT])==null||e.forEach(n=>n())},0));this.data=e,this.onChange=n,this.sendToWidget=r,this.dirtyFields=new Map([...s].map(i=>[i,this.data[i]]))}off(e,n){var r;if(!e){this.listeners={};return}if(!n){this.listeners[e]=new Set;return}(r=this.listeners[e])==null||r.delete(n)}send(e,n,r){let{state:s,bufferPaths:i,buffers:d}=ne(e);this.sendToWidget({content:{state:s,bufferPaths:i},buffers:d}).then(n)}get(e){return this.data[e]}set(e,n){this.data={...this.data,[e]:n},this.dirtyFields.set(e,n),this.emit(`change:${e}`,n),this.emitAnyChange()}save_changes(){if(this.dirtyFields.size===0)return;let e=Object.fromEntries(this.dirtyFields.entries());this.dirtyFields.clear(),this.onChange(e)}updateAndEmitDiffs(e){e!=null&&Object.keys(e).forEach(n=>{let r=n;this.data[r]!==e[r]&&this.set(r,e[r])})}receiveCustomMessage(e,n=[]){var s;let r=He.safeParse(e);if(r.success){let i=r.data;switch(i.method){case"update":this.updateAndEmitDiffs(Y({state:i.state,bufferPaths:i.buffer_paths??[],buffers:n}));break;case"custom":(s=this.listeners["msg:custom"])==null||s.forEach(d=>d(i.content,n));break;case"open":this.updateAndEmitDiffs(Y({state:i.state,bufferPaths:i.buffer_paths??[],buffers:n}));break;case"echo_update":break;default:E.error("[anywidget] Unknown message method",i.method);break}}else E.error("Failed to parse message",r.error),E.error("Message",e)}on(e,n){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(n)}emit(e,n){this.listeners[e]&&this.listeners[e].forEach(r=>r(n))}},a(j,"_modelManager",We),j),re=me(me(pt([fe(),yt()]))),se=gt(fe(),de()),He=ht("method",[O({method:W("open"),state:se,buffer_paths:re.optional()}),O({method:W("update"),state:se,buffer_paths:re.optional()}),O({method:W("custom"),content:de()}),O({method:W("echo_update"),buffer_paths:re,state:se}),O({method:W("close")})]);function Mn(t){return t==null?!1:He.safeParse(t).success}async function jn({modelId:t,msg:e,buffers:n,modelManager:r}){if(e.method==="echo_update")return;if(e.method==="custom"){(await r.get(t)).receiveCustomMessage(e,n);return}if(e.method==="close"){r.delete(t);return}let{method:s,state:i,buffer_paths:d=[]}=e,l=Y({state:i,bufferPaths:d,buffers:n});if(s==="open"){let p=new De(l,b=>{let{state:x,buffers:w,bufferPaths:C}=ne(b);ye().sendModelValue({modelId:t,message:{state:x,bufferPaths:C},buffers:w})},y,new Set);r.set(t,p);return}if(s==="update"){(await r.get(t)).updateAndEmitDiffs(l);return}wt(s)}const Be=P(null),An=P(null),Ve=P(!1),Tn=P(!1),$e=P(!1);var In=pe();const Xe=t=>{let e=(0,In.c)(8),{onResize:n,startingWidth:r,minWidth:s,maxWidth:i}=t,d=(0,u.useRef)(null),l=(0,u.useRef)(null),p=(0,u.useRef)(null),b,x;e[0]!==i||e[1]!==s||e[2]!==n?(b=()=>{let _=d.current,k=l.current,R=p.current;if(!_||!k&&!R)return;let v=Number.parseInt(window.getComputedStyle(_).width,10),N=0,q=!1,A=null,L=c=>{if(!_||!q||!A)return;let h=c.clientX-N;N=c.clientX,v=A==="left"?v-h:v+h,s&&(v=Math.max(s,v)),i&&(v=Math.min(i,v)),_.style.width=`${v}px`},U=()=>{q&&(n==null||n(v),q=!1,A=null),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",U)},o=(c,h)=>{c.preventDefault(),q=!0,A=h,N=c.clientX,document.addEventListener("mousemove",L),document.addEventListener("mouseup",U)},f=c=>o(c,"left"),g=c=>o(c,"right");return k&&k.addEventListener("mousedown",f),R&&R.addEventListener("mousedown",g),()=>{k&&k.removeEventListener("mousedown",f),R&&R.removeEventListener("mousedown",g),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",U)}},x=[s,i,n],e[0]=i,e[1]=s,e[2]=n,e[3]=b,e[4]=x):(b=e[3],x=e[4]),(0,u.useEffect)(b,x);let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w={left:l,right:p},e[5]=w):w=e[5];let C=r==="contentWidth"?"var(--content-width-medium)":`${r}px`,F;return e[6]===C?F=e[7]:(F={resizableDivRef:d,handleRefs:w,style:{width:C}},e[6]=C,e[7]=F),F};function Ye(t){t||window.dispatchEvent(new Event("resize"))}var Ge=pe(),m=ce(Rt(),1);const Ln=()=>{let t=(0,Ge.c)(16),[e,n]=D(Be),[r,s]=D(Ve),[i,d]=D(Tn),[l,p]=D($e),b;t[0]!==s||t[1]!==n?(b=()=>{n(null),s(!1)},t[0]=s,t[1]=n,t[2]=b):b=t[2];let x=b;if(Z(B.CONTEXT_AWARE_PANEL).length===0||!e||!r)return null;let w;t[3]!==l||t[4]!==i||t[5]!==p||t[6]!==d?(w=()=>(0,m.jsxs)("div",{className:"flex flex-row items-center gap-3",children:[(0,m.jsx)(ve,{content:i?"Unpin panel":"Pin panel",children:(0,m.jsx)(Ee,{size:"xs",onPressedChange:()=>d(!i),pressed:i,"aria-label":i?"Unpin panel":"Pin panel",children:i?(0,m.jsx)(Bt,{className:"w-4 h-4"}):(0,m.jsx)(St,{className:"w-4 h-4"})})}),(0,m.jsx)(ve,{content:l?(0,m.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,m.jsx)("span",{children:"Follow focused table"}),(0,m.jsx)("span",{className:"text-xs text-muted-foreground w-64",children:"The panel updates as cells that output tables are focused. Click to fix to the current cell."})]}):(0,m.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,m.jsx)("span",{children:"Focus on current table"}),(0,m.jsx)("span",{className:"text-xs text-muted-foreground w-64",children:"The panel is focused on the current table. Click to update based on which cell is focused."})]}),children:(0,m.jsx)(Ee,{size:"xs",onPressedChange:()=>p(!l),pressed:l,"aria-label":l?"Follow focused cell":"Fixed",children:(0,m.jsx)(Ht,{className:Nt("w-4 h-4",l&&"text-primary")})})})]}),t[3]=l,t[4]=i,t[5]=p,t[6]=d,t[7]=w):w=t[7];let C=w,F;t[8]!==x||t[9]!==C?(F=()=>(0,m.jsxs)("div",{className:"mt-2 pb-7 mb-4 h-full overflow-auto",children:[(0,m.jsxs)("div",{className:"flex flex-row justify-between items-center mx-2",children:[C(),(0,m.jsx)(Ft,{variant:"linkDestructive",size:"icon",onClick:x,"aria-label":"Close selection panel",children:(0,m.jsx)(Pt,{className:"w-4 h-4"})})]}),(0,m.jsx)(ge,{children:(0,m.jsx)(Re,{name:B.CONTEXT_AWARE_PANEL})})]}),t[8]=x,t[9]=C,t[10]=F):F=t[10];let _=F;if(!i){let v;return t[11]===_?v=t[12]:(v=(0,m.jsx)(zn,{children:_()}),t[11]=_,t[12]=v),v}let k;t[13]===Symbol.for("react.memo_cache_sentinel")?(k=(0,m.jsx)(Ot,{onDragging:Ye,className:"resize-handle border-border z-20 print:hidden border-l"}),t[13]=k):k=t[13];let R;return t[14]===_?R=t[15]:(R=(0,m.jsxs)(m.Fragment,{children:[k,(0,m.jsx)(Wt,{defaultSize:20,minSize:15,maxSize:80,children:_()})]}),t[14]=_,t[15]=R),R},Un=t=>{let e=(0,Ge.c)(2),{children:n}=t,r;return e[0]===n?r=e[1]:(r=(0,m.jsx)(ge,{children:(0,m.jsx)($t,{name:B.CONTEXT_AWARE_PANEL,children:n})}),e[0]=n,e[1]=r),r};var zn=({children:t})=>{let{resizableDivRef:e,handleRefs:n,style:r}=Xe({startingWidth:400,minWidth:300,maxWidth:1500});return(0,m.jsxs)("div",{className:"absolute z-40 right-0 h-full bg-background flex flex-row",children:[(0,m.jsx)("div",{ref:n.left,className:"w-1 h-full cursor-col-resize border-l"}),(0,m.jsx)("div",{ref:e,style:r,children:t})]})};function On(){var t=[...arguments];return(0,u.useMemo)(()=>e=>{t.forEach(n=>n(e))},t)}var Qe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0;function G(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function ae(t){return"nodeType"in t}function I(t){var e;return t?G(t)?t:ae(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window:window}function Je(t){let{Document:e}=I(t);return t instanceof e}function Ke(t){return G(t)?!1:t instanceof I(t).HTMLElement}function Ze(t){return t instanceof I(t).SVGElement}function Wn(t){return t?G(t)?t.document:ae(t)?Je(t)?t:Ke(t)||Ze(t)?t.ownerDocument:document:document:document}var ie=Qe?u.useLayoutEffect:u.useEffect;function et(t){let e=(0,u.useRef)(t);return ie(()=>{e.current=t}),(0,u.useCallback)(function(){var n=[...arguments];return e.current==null?void 0:e.current(...n)},[])}function Dn(){let t=(0,u.useRef)(null);return[(0,u.useCallback)((e,n)=>{t.current=setInterval(e,n)},[]),(0,u.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[])]}function Hn(t,e){e===void 0&&(e=[t]);let n=(0,u.useRef)(t);return ie(()=>{n.current!==t&&(n.current=t)},e),n}function Bn(t,e){let n=(0,u.useRef)();return(0,u.useMemo)(()=>{let r=t(n.current);return n.current=r,r},[...e])}function Vn(t){let e=et(t),n=(0,u.useRef)(null);return[n,(0,u.useCallback)(r=>{r!==n.current&&(e==null||e(r,n.current)),n.current=r},[])]}function $n(t){let e=(0,u.useRef)();return(0,u.useEffect)(()=>{e.current=t},[t]),e.current}var oe={};function Xn(t,e){return(0,u.useMemo)(()=>{if(e)return e;let n=oe[t]==null?0:oe[t]+1;return oe[t]=n,t+"-"+n},[t,e])}function tt(t){return function(e){return[...arguments].slice(1).reduce((n,r)=>{let s=Object.entries(r);for(let[i,d]of s){let l=n[i];l!=null&&(n[i]=l+t*d)}return n},{...e})}}var Yn=tt(1),Gn=tt(-1);function Qn(t){return"clientX"in t&&"clientY"in t}function Jn(t){if(!t)return!1;let{KeyboardEvent:e}=I(t.target);return e&&t instanceof e}function Kn(t){if(!t)return!1;let{TouchEvent:e}=I(t.target);return e&&t instanceof e}function Zn(t){if(Kn(t)){if(t.touches&&t.touches.length){let{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){let{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Qn(t)?{x:t.clientX,y:t.clientY}:null}var le=Object.freeze({Translate:{toString(t){if(!t)return;let{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;let{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[le.Translate.toString(t),le.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),nt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function er(t){return t.matches(nt)?t:t.querySelector(nt)}export{yn as $,An as A,Sn as B,Xn as C,Xe as D,Ye as E,Mn as F,ze as G,Rn as H,Y as I,Le as J,Ie as K,Pn as L,We as M,De as N,Ve as O,jn as P,$ as Q,ne as R,$n as S,Un as T,Oe as U,qn as V,kn as W,Te as X,_n as Y,Cn as Z,Dn as _,Zn as a,sn as at,Bn as b,Je as c,Re as ct,ae as d,qe as et,Ze as f,et as g,On as h,er as i,tn as it,$e as j,Be as k,Ke as l,Z as lt,Gn as m,Yn as n,B as nt,Wn as o,an as ot,G as p,Ue as q,Qe as r,on as rt,I as s,en as st,le as t,Fe as tt,Jn as u,H as ut,ie as v,Ln as w,Vn as x,Hn as y,Fn as z};
package/dist/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-GARjwpYQ.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-BSNJ0Y0E.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-DItdS47A.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/clsx-D8GwTfvk.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/cn-BKtXLv3a.js">
@@ -133,7 +133,7 @@
133
133
  <link rel="modulepreload" crossorigin href="./assets/toInteger-CDcO32Gx.js">
134
134
  <link rel="modulepreload" crossorigin href="./assets/database-zap-k4ePIFAU.js">
135
135
  <link rel="modulepreload" crossorigin href="./assets/main-U5Goe76G.js">
136
- <link rel="modulepreload" crossorigin href="./assets/cells-CiFhRLUd.js">
136
+ <link rel="modulepreload" crossorigin href="./assets/cells-B0XKj2oa.js">
137
137
  <link rel="modulepreload" crossorigin href="./assets/spinner-DA8-7wQv.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/chevron-right--18M_6o9.js">
139
139
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-BUgFWmX1.js">
@@ -147,7 +147,7 @@
147
147
  <link rel="modulepreload" crossorigin href="./assets/dist-BMEHQAhk.js">
148
148
  <link rel="modulepreload" crossorigin href="./assets/label-C--1sWU6.js">
149
149
  <link rel="modulepreload" crossorigin href="./assets/useDebounce-B28kFfrM.js">
150
- <link rel="modulepreload" crossorigin href="./assets/textarea-sdXkC92D.js">
150
+ <link rel="modulepreload" crossorigin href="./assets/textarea-UfsPtSW1.js">
151
151
  <link rel="modulepreload" crossorigin href="./assets/numbers-UHLm3mA-.js">
152
152
  <link rel="modulepreload" crossorigin href="./assets/SSRProvider-DrpctNAg.js">
153
153
  <link rel="modulepreload" crossorigin href="./assets/context-Ga_vV5mE.js">
@@ -156,9 +156,9 @@
156
156
  <link rel="modulepreload" crossorigin href="./assets/input-DHHmNa19.js">
157
157
  <link rel="modulepreload" crossorigin href="./assets/links-fh_IXIKE.js">
158
158
  <link rel="modulepreload" crossorigin href="./assets/popover-B-131r4d.js">
159
- <link rel="modulepreload" crossorigin href="./assets/switch-BF1BnESM.js">
159
+ <link rel="modulepreload" crossorigin href="./assets/switch-D5W4wgWK.js">
160
160
  <link rel="modulepreload" crossorigin href="./assets/table-BOsFCeLh.js">
161
- <link rel="modulepreload" crossorigin href="./assets/mode-O-1bKZO6.js">
161
+ <link rel="modulepreload" crossorigin href="./assets/mode-CTf4rB7H.js">
162
162
  <link rel="modulepreload" crossorigin href="./assets/useAsyncData-CgmD3hjw.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/errors-CPlNr33a.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/error-banner-w4pz2qUB.js">
@@ -171,7 +171,7 @@
171
171
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-Dx8TEWFP.js">
172
172
  <link rel="modulepreload" crossorigin href="./assets/trash-2-B8SQYdQq.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-U93NZYDl.js">
174
- <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-DC4t5PJE.js">
174
+ <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-Cugcw6NV.js">
175
175
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-YteS-k_t.js">
176
176
  <link rel="modulepreload" crossorigin href="./assets/precisionRound-C3fmBb6j.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-B6z1Qyqt.js">
@@ -180,22 +180,22 @@
180
180
  <link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-B9Ifj8Jf.js">
181
181
  <link rel="modulepreload" crossorigin href="./assets/useInstallPackage-Co79H1lQ.js">
182
182
  <link rel="modulepreload" crossorigin href="./assets/ImperativeModal-DZr52ffu.js">
183
- <link rel="modulepreload" crossorigin href="./assets/cell-link-dnd6DfEI.js">
184
- <link rel="modulepreload" crossorigin href="./assets/datasource-C7Acf9BM.js">
185
- <link rel="modulepreload" crossorigin href="./assets/state-CMAvJZxx.js">
186
- <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-Dxf6p5lw.js">
183
+ <link rel="modulepreload" crossorigin href="./assets/cell-link-B37i0WNz.js">
184
+ <link rel="modulepreload" crossorigin href="./assets/datasource-2_-ICoTV.js">
185
+ <link rel="modulepreload" crossorigin href="./assets/state-Q32Iqos3.js">
186
+ <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-BydcsyYP.js">
187
187
  <link rel="modulepreload" crossorigin href="./assets/copy-icon-C9v8EtBA.js">
188
- <link rel="modulepreload" crossorigin href="./assets/html-to-image-BKGhRUqR.js">
189
- <link rel="modulepreload" crossorigin href="./assets/focus-CtXToHnV.js">
188
+ <link rel="modulepreload" crossorigin href="./assets/html-to-image-Cc7t14sm.js">
189
+ <link rel="modulepreload" crossorigin href="./assets/focus-CZLCQiuh.js">
190
190
  <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-BqosdyZU.js">
191
191
  <link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-T2jyw7ZD.js">
192
192
  <link rel="modulepreload" crossorigin href="./assets/katex-CbllUrnh.js">
193
- <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-Dotqbx_q.js">
194
- <link rel="modulepreload" crossorigin href="./assets/command-MHa10zT2.js">
195
- <link rel="modulepreload" crossorigin href="./assets/download-CUgZOA9O.js">
196
- <link rel="modulepreload" crossorigin href="./assets/useRunCells-CNmJhP6h.js">
193
+ <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-Y3WEBmX7.js">
194
+ <link rel="modulepreload" crossorigin href="./assets/command-DTFQw11F.js">
195
+ <link rel="modulepreload" crossorigin href="./assets/download-CxmzcjnR.js">
196
+ <link rel="modulepreload" crossorigin href="./assets/useRunCells-DaW_oMnr.js">
197
197
  <link rel="modulepreload" crossorigin href="./assets/purify.es-B-nzWya6.js">
198
- <link rel="modulepreload" crossorigin href="./assets/RenderHTML-BUCe3qCj.js">
198
+ <link rel="modulepreload" crossorigin href="./assets/RenderHTML-3amWMGgo.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-CC8VH6kZ.js">
200
200
  <link rel="modulepreload" crossorigin href="./assets/formats-DGZwRUPy.js">
201
201
  <link rel="modulepreload" crossorigin href="./assets/en-US-DU2jJCpg.js">
@@ -207,37 +207,37 @@
207
207
  <link rel="modulepreload" crossorigin href="./assets/useDateFormatter-CieT0-H-.js">
208
208
  <link rel="modulepreload" crossorigin href="./assets/range-D2UKkEg-.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/table-CfDbAm78.js">
210
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BUok9dqY.js">
210
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-CU0ad2LH.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/file-Ch78NKWp.js">
212
212
  <link rel="modulepreload" crossorigin href="./assets/play-GLWQQs7F.js">
213
- <link rel="modulepreload" crossorigin href="./assets/chat-components-C5FA1-Vu.js">
213
+ <link rel="modulepreload" crossorigin href="./assets/chat-components-BNjAKvAv.js">
214
214
  <link rel="modulepreload" crossorigin href="./assets/isEmpty-CgX_-6Mt.js">
215
- <link rel="modulepreload" crossorigin href="./assets/chat-display-ChS1NL3o.js">
216
- <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-BocCAiDk.js">
215
+ <link rel="modulepreload" crossorigin href="./assets/chat-display-q9RdcWB-.js">
216
+ <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-D0DAGwMP.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/icons-DjR3qLG_.js">
218
- <link rel="modulepreload" crossorigin href="./assets/process-output-B1EqjOGn.js">
218
+ <link rel="modulepreload" crossorigin href="./assets/process-output-CdIpMer6.js">
219
219
  <link rel="modulepreload" crossorigin href="./assets/blob-Bgnx1kuY.js">
220
220
  <link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-DoKw85w0.js">
221
221
  <link rel="modulepreload" crossorigin href="./assets/esm-BK6tLEHQ.js">
222
- <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-J44RQi7o.js">
222
+ <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-B07D0AiE.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-qvVRjhv1.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/square-function-B6mgCeFJ.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/spec-Ch0xnJY4.js">
226
- <link rel="modulepreload" crossorigin href="./assets/column-preview-BUTci9vI.js">
226
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-DrmYyyvE.js">
227
227
  <link rel="modulepreload" crossorigin href="./assets/toggle-CriARMQK.js">
228
- <link rel="modulepreload" crossorigin href="./assets/globals-D1aM0aUX.js">
228
+ <link rel="modulepreload" crossorigin href="./assets/globals-DvWD0xHx.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/share-rXkgGlhr.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/_baseSet-5Rdwpmr3.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-Mq45xjWt.js">
232
- <link rel="modulepreload" crossorigin href="./assets/utilities.esm-OH_d3CNC.js">
233
- <link rel="modulepreload" crossorigin href="./assets/floating-outline-CZzxqWyr.js">
234
- <link rel="modulepreload" crossorigin href="./assets/useAddCell-DQzBfMNz.js">
232
+ <link rel="modulepreload" crossorigin href="./assets/utilities.esm-Bfd1Y8aF.js">
233
+ <link rel="modulepreload" crossorigin href="./assets/floating-outline-BSd7WV6r.js">
234
+ <link rel="modulepreload" crossorigin href="./assets/useAddCell-CXRk4Ma4.js">
235
235
  <link rel="modulepreload" crossorigin href="./assets/eye-off-AK_9uodG.js">
236
- <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-3nLIGqDx.js">
236
+ <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-o3TsTcFg.js">
237
237
  <link rel="modulepreload" crossorigin href="./assets/file-video-camera-C3wGzBnE.js">
238
- <link rel="modulepreload" crossorigin href="./assets/types-ChPQge47.js">
238
+ <link rel="modulepreload" crossorigin href="./assets/types-DIb0tcCO.js">
239
239
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DN_xCV6A.js">
240
- <link rel="modulepreload" crossorigin href="./assets/form-CvVbbh8Y.js">
240
+ <link rel="modulepreload" crossorigin href="./assets/form-BQhIjeKF.js">
241
241
  <link rel="modulepreload" crossorigin href="./assets/field-D9jE8HEt.js">
242
242
  <link rel="modulepreload" crossorigin href="./assets/useBoolean-IZsSX_XF.js">
243
243
  <link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-CFtQU7An.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.19.8-dev37",
3
+ "version": "0.19.8-dev39",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -214,16 +214,19 @@ describe("CollapsibleTree", () => {
214
214
  `);
215
215
  });
216
216
 
217
- it("fails to expand", () => {
217
+ it("fails to expand when node not found", () => {
218
218
  expect(() => tree.expand("five")).toThrowErrorMatchingInlineSnapshot(
219
219
  "[Error: Node five not found in tree. Valid ids: one,two,three,four]",
220
220
  );
221
- expect(() => {
222
- tree.expand("one");
223
- tree.expand("one");
224
- }).toThrowErrorMatchingInlineSnapshot(
225
- "[Error: Node one is already expanded]",
226
- );
221
+ });
222
+
223
+ it("expand on already expanded node is a no-op", () => {
224
+ // Expanding an already expanded node should return the same tree (no-op)
225
+ const result = tree.expand("one");
226
+ expect(result).toBe(tree);
227
+ // Can call multiple times without error
228
+ const result2 = tree.expand("one");
229
+ expect(result2).toBe(tree);
227
230
  });
228
231
 
229
232
  it("moves nodes correctly", () => {
@@ -378,6 +381,18 @@ describe("CollapsibleTree", () => {
378
381
  `);
379
382
  });
380
383
 
384
+ it("can delete non-collapsed nodes without throwing", () => {
385
+ // Deleting a non-collapsed node should not throw
386
+ // (previously this would throw "Node is already expanded" internally)
387
+ const result = tree.deleteAtIndex(1);
388
+ expect(result.toString()).toMatchInlineSnapshot(`
389
+ "one
390
+ three
391
+ four
392
+ "
393
+ `);
394
+ });
395
+
381
396
  it("fails to delete nodes", () => {
382
397
  expect(() => tree.deleteAtIndex(5)).toThrowErrorMatchingInlineSnapshot(
383
398
  "[Error: Node at index 5 not found in tree]",