@marimo-team/frontend 0.18.5-dev201 → 0.18.5-dev202

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 (70) hide show
  1. package/dist/assets/{CellStatus-Bo1x1B6n.js → CellStatus-CJVmn-JU.js} +1 -1
  2. package/dist/assets/{JsonOutput-BCHaEg3R.js → JsonOutput-BLd1jTNA.js} +1 -1
  3. package/dist/assets/{MarimoErrorOutput-BIIhR96K.js → MarimoErrorOutput-Orp0blpZ.js} +2 -2
  4. package/dist/assets/{RenderHTML-BUhX0rkG.js → RenderHTML-BzGWfPTJ.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-CLrEdPGH.js → add-cell-with-ai-Dx5UA23s.js} +1 -1
  6. package/dist/assets/{add-database-form-DkSxzOXk.js → add-database-form-MNQmbAaT.js} +1 -1
  7. package/dist/assets/{agent-panel-Bz7HLWO3.js → agent-panel-BS2q53WX.js} +2 -2
  8. package/dist/assets/{ai-model-dropdown-ea-cOLAL.js → ai-model-dropdown-DZ7evAGU.js} +1 -1
  9. package/dist/assets/{app-config-button-BFjdAlTt.js → app-config-button-CsABtw-A.js} +1 -1
  10. package/dist/assets/{cell-editor-B-NH54Cv.js → cell-editor-D4tKLHiP.js} +4 -4
  11. package/dist/assets/{cell-link-DNVmmRzI.js → cell-link-BoUpLV2S.js} +1 -1
  12. package/dist/assets/{cells-Dk_j8HX9.js → cells-D_SkyFDn.js} +47 -47
  13. package/dist/assets/{chat-components-BMWBGknq.js → chat-components-6dWNbFjV.js} +1 -1
  14. package/dist/assets/{chat-display-CEYX5MXY.js → chat-display-Cfg38gMM.js} +1 -1
  15. package/dist/assets/{chat-panel-DmUjYxAt.js → chat-panel-CofEklYU.js} +1 -1
  16. package/dist/assets/{client-D08Rbi3p.js → client-BUus2uot.js} +1 -1
  17. package/dist/assets/{column-preview-MV5ZRt10.js → column-preview-9nPwQyJZ.js} +1 -1
  18. package/dist/assets/{command-gUA-HncX.js → command-Qt3ng7cb.js} +1 -1
  19. package/dist/assets/{command-palette-Dt43cGFk.js → command-palette-ptrGtoIl.js} +1 -1
  20. package/dist/assets/{common-BWR26KIv.js → common-DE3UmpZO.js} +1 -1
  21. package/dist/assets/{datasource-i415crE1.js → datasource-CR_zEq5o.js} +1 -1
  22. package/dist/assets/{dependency-graph-panel-BwaKuCE7.js → dependency-graph-panel-Dy8lj02R.js} +1 -1
  23. package/dist/assets/{documentation-panel-C4aTmugE.js → documentation-panel-C0769uWv.js} +1 -1
  24. package/dist/assets/{download-Dsuja3On.js → download-CITws1-y.js} +1 -1
  25. package/dist/assets/{edit-page-DIpr3pNk.js → edit-page-BC3j4y4f.js} +6 -6
  26. package/dist/assets/{error-panel-DCozbyWc.js → error-panel-B-EvbVVc.js} +1 -1
  27. package/dist/assets/{es-DjCjT1hB.js → es-CEEVxHsX.js} +1 -1
  28. package/dist/assets/{file-explorer-panel-BvRpCXWv.js → file-explorer-panel-BqkMxs-d.js} +1 -1
  29. package/dist/assets/{floating-outline-DYdnwTX9.js → floating-outline-p0aHdM2W.js} +1 -1
  30. package/dist/assets/{focus-U1ePwk4d.js → focus-D18AHojc.js} +1 -1
  31. package/dist/assets/{form-D8BW7hlS.js → form-DEraWoX5.js} +1 -1
  32. package/dist/assets/{globals-BBskDqJi.js → globals-D3SeIm1j.js} +1 -1
  33. package/dist/assets/{home-page-c43aYnLs.js → home-page-9rDRaLCP.js} +1 -1
  34. package/dist/assets/{index-MoQWZ3Gl.js → index-BReVmpoy.js} +3 -3
  35. package/dist/assets/{kiosk-mode-lhqhA8En.js → kiosk-mode-DL9UBacr.js} +1 -1
  36. package/dist/assets/{layout-DenYhPfS.js → layout-Bd6wzfjT.js} +1 -1
  37. package/dist/assets/{logs-panel-CmImbuAp.js → logs-panel-C7VsvCHz.js} +1 -1
  38. package/dist/assets/{markdown-renderer-COkLQ1b5.js → markdown-renderer-C_xfLXiO.js} +1 -1
  39. package/dist/assets/{mode-BOijHAOc.js → mode-BFwdGSZ7.js} +1 -1
  40. package/dist/assets/{name-cell-input-Cf2CUXDm.js → name-cell-input-CsDYsdH3.js} +1 -1
  41. package/dist/assets/{outline-panel-CdaUT0TE.js → outline-panel-BlhMaZpZ.js} +1 -1
  42. package/dist/assets/{packages-panel-CghFsvM0.js → packages-panel-YNB3ay32.js} +1 -1
  43. package/dist/assets/{panels-CymS0QU-.js → panels-DfOJ05Sp.js} +1 -1
  44. package/dist/assets/{process-output-BAfpcew-.js → process-output-4w8xDO0j.js} +1 -1
  45. package/dist/assets/{readonly-python-code-B8gfuyX1.js → readonly-python-code-DjP4vjBQ.js} +1 -1
  46. package/dist/assets/{run-page-rr9Ilre7.js → run-page-DRgXZvWr.js} +1 -1
  47. package/dist/assets/{scratchpad-panel-DWsu0wnU.js → scratchpad-panel-BYCWZWFJ.js} +1 -1
  48. package/dist/assets/{session-panel-BJRncUge.js → session-panel-C0b1PCJc.js} +1 -1
  49. package/dist/assets/{snippets-panel-Dv7eGWsB.js → snippets-panel-CpjS6w9M.js} +1 -1
  50. package/dist/assets/{state-DWEWL_KV.js → state-BTRRCWOH.js} +1 -1
  51. package/dist/assets/{state-HUtu_wpA.js → state-kFdt1US2.js} +1 -1
  52. package/dist/assets/{switch-Cd5iA-KH.js → switch-C9iBa4rX.js} +1 -1
  53. package/dist/assets/{textarea-jTWtOsHe.js → textarea-D2hGxqGj.js} +1 -1
  54. package/dist/assets/{tracing-CDJRdFd4.js → tracing-CKdq5KMT.js} +1 -1
  55. package/dist/assets/{tracing-panel-BrBmQCJr.js → tracing-panel-DXjACxb_.js} +2 -2
  56. package/dist/assets/{types-CiMSegk1.js → types-VzFAm7Cv.js} +1 -1
  57. package/dist/assets/{useAddCell-FisWjOQO.js → useAddCell-CVfRv5mq.js} +1 -1
  58. package/dist/assets/{useCellActionButton-DLwn_yx9.js → useCellActionButton-Woqd9LSB.js} +1 -1
  59. package/dist/assets/{useDeleteCell-CFtiNna2.js → useDeleteCell-GHwc6J4l.js} +1 -1
  60. package/dist/assets/{useDependencyPanelTab-DWfKzMhf.js → useDependencyPanelTab-B0ZsFCYF.js} +1 -1
  61. package/dist/assets/{useNotebookActions-B4HR9n-p.js → useNotebookActions-DQW0wwU6.js} +1 -1
  62. package/dist/assets/{useRunCells-DLQFWY1L.js → useRunCells-BZ_OFvV4.js} +1 -1
  63. package/dist/assets/{useSplitCell-DDFoE9WM.js → useSplitCell-BnJiHHep.js} +1 -1
  64. package/dist/assets/{utilities.esm-DlnAwGsz.js → utilities.esm-FYD46c3d.js} +1 -1
  65. package/dist/index.html +31 -31
  66. package/package.json +1 -1
  67. package/src/components/editor/chrome/state.ts +3 -3
  68. package/src/components/editor/chrome/types.ts +5 -3
  69. package/src/components/editor/chrome/wrapper/app-chrome.tsx +11 -4
  70. package/src/components/editor/chrome/wrapper/sidebar.tsx +11 -4
@@ -1 +1 @@
1
- import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as S,l as Ie,p as Te,u as K}from"./useEvent-DlWF5OMa.js";import{t as He}from"./react-BGmjiNul.js";import{Bn as Le,C as ie,Et as qe,Jn as Re,Nt as Ve,Pt as ne,Rn as Be,Un as Oe,an as Ue,ei as Q,h as Ye,in as $e,ln as Fe,mr as Ge,p as le,rn as Je,t as Ke}from"./cells-Dk_j8HX9.js";import{t as W}from"./compiler-runtime-DeeZ7FnK.js";import{i as Qe}from"./useLifecycle-CmDXEyIC.js";import{a as se}from"./type-BdyvjzTI.js";import{n as Xe}from"./add-database-form-DkSxzOXk.js";import{a as re,d as E}from"./hotkeys-uKX61F1_.js";import{v as Ze}from"./utils-CJJIceVn.js";import{n as _,t as de}from"./constants-Bkp4R3bQ.js";import{M as ce,f as et,j as tt,w as at}from"./config-babG4OBR.js";import{t as ot}from"./jsx-runtime-DN_bIXfG.js";import{r as it,t as X}from"./button-DuYGqRtX.js";import{r as P}from"./requests-C0HaHO6a.js";import{t as c}from"./createLucideIcon-CW2xpJ57.js";import{a as he,f as nt,i as pe,m as lt,p as me,u as ue}from"./layout-DenYhPfS.js";import{t as fe}from"./check-CrAQug3q.js";import{a as st,c as rt,i as dt,n as ct,r as ht,s as pt,t as mt}from"./select-D0g5GnIs.js";import{i as ye,r as ut,t as ke}from"./download-Dsuja3On.js";import{f as ft}from"./maps-s2pQkyf5.js";import{r as yt}from"./useCellActionButton-DLwn_yx9.js";import{t as kt}from"./copy-gBVL4NN-.js";import{d as bt,t as xt}from"./state-DWEWL_KV.js";import{t as wt}from"./download-DobaYJPt.js";import{t as gt}from"./eye-off-D9zAYqG9.js";import{t as jt}from"./file-plus-corner-BO_uS88s.js";import{t as vt}from"./file-BnFXtaZZ.js";import{i as Ct,n as zt,r as Mt,t as Wt}from"./youtube-BJQRl2JC.js";import{t as _t}from"./globe-CY9im410.js";import{n as At}from"./play-BJDBXApx.js";import{t as Nt}from"./link-54sBkoQp.js";import{r as St}from"./input-CaEtLL8p.js";import{t as Et}from"./settings-MTlHVxz3.js";import{y as Pt}from"./textarea-jTWtOsHe.js";import{t as Dt}from"./square-leQTJTJJ.js";import{t as j}from"./use-toast-Bzf3rpev.js";import{t as It}from"./tooltip-CvjcEpZC.js";import{a as be,i as Tt,r as Ht}from"./mode-BOijHAOc.js";import{o as Lt}from"./alert-dialog-k5KxevGr.js";import{a as qt,c as Rt,i as Vt,n as Bt,r as Ot}from"./dialog-DUEuLcT2.js";import{n as Z}from"./ImperativeModal-q6QlC2aZ.js";import{r as Ut,t as Yt}from"./share-CXQVxivL.js";import{t as V}from"./copy-DRhpWiOq.js";import{r as $t}from"./useRunCells-DLQFWY1L.js";import{a as Ft}from"./cell-link-DNVmmRzI.js";import{a as xe}from"./renderShortcut-D0Pei-OA.js";import{t as Gt}from"./icons-D4lB4En9.js";import{t as Jt}from"./links-ENMiP32L.js";import{t as we}from"./types-BLEgJ92v.js";var Kt=c("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Qt=c("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ge=c("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"}]]),je=c("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"}]]),ve=c("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"}]]),Xt=c("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"}]]),Zt=c("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"}]]),ea=c("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]),ta=c("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"}]]),Ce=c("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"}]]),aa=c("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"}]]),oa=c("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),ze=c("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"}]]),ia=c("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"}]]),na=c("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"}]]),Me=c("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"}]]),We=W(),ee=oe(He(),1),a=oe(ot(),1),B="https://static.marimo.app";const la=e=>{let t=(0,We.c)(25),{onClose:i}=e,[o,l]=(0,ee.useState)(""),{exportAsHTML:r}=P(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,n=`${B}/static/${s}`,d;t[0]!==r||t[1]!==i||t[2]!==s?(d=async v=>{v.preventDefault(),i();let A=await r({download:!1,includeCode:!0,files:nt.INSTANCE.filenames()}),z=j({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${B}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:s})}).catch(()=>{z.dismiss(),j({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(),j({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]=i,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Rt,{children:"Share static notebook"}),t[4]=p):p=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsxs)(qt,{children:[p,(0,a.jsxs)(Ot,{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:B,target:"_blank",children:B}),"."]})]}),t[5]=x):x=t[5];let w;t[6]===Symbol.for("react.memo_cache_sentinel")?(w=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=w):w=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(St,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:w,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===n?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)(sa,{text:n}),(0,a.jsx)("span",{className:"text-primary",children:n})]})]}),t[9]=n,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]===i?y=t[15]:(y=(0,a.jsx)(X,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:i,children:"Cancel"}),t[14]=i,t[15]=y);let k;t[16]===n?k=t[17]:(k=(0,a.jsx)(X,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await V(n)},children:"Create"}),t[16]=n,t[17]=k);let b;t[18]!==y||t[19]!==k?(b=(0,a.jsxs)(Vt,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=b):b=t[20];let g;return t[21]!==d||t[22]!==b||t[23]!==f?(g=(0,a.jsx)(Bt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[x,f,b]})}),t[21]=d,t[22]=b,t[23]=f,t[24]=g):g=t[24],g};var sa=e=>{let t=(0,We.c)(8),[i,o]=ee.useState(!1),l;t[0]===e.text?l=t[1]:(l=it.stopPropagation(async p=>{p.preventDefault(),await V(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)(kt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let n;t[3]===r?n=t[4]:(n=(0,a.jsx)(X,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=n);let d;return t[5]!==i||t[6]!==n?(d=(0,a.jsx)(It,{content:"Copied!",open:i,children:n}),t[5]=i,t[6]=n,t[7]=d):d=t[7],d},ra=W();function da(){let e=document.getElementsByClassName(de.outputArea);for(let t of e){let i=t.getBoundingClientRect();if(i.bottom>0&&i.top<window.innerHeight){let o=Q.findElement(t);if(!o){E.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:Q.parse(o.id)}}}return E.warn("No visible output area found for scroll anchor"),null}function ca(e){if(!e){E.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(Q.create(e.cellId));if(!t){E.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${de.outputArea}`)){E.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function _e(){let e=(0,ra.c)(2),t=S(be),i;return e[0]===t?i=e[1]:(i=()=>{let o=da();t(l=>({mode:Tt(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ca(o)})})},e[0]=t,e[1]=i),i}const Ae=Te(!1);var ha=W();const pa=()=>{let e=(0,ha.c)(7),{selectedLayout:t}=he(),{setLayoutView:i}=pe();if(ce()&&!Fe("wasm_layouts"))return null;let o;e[0]===i?o=e[1]:(o=n=>i(n),e[0]=i,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(pt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(rt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(ct,{children:(0,a.jsxs)(ht,{children:[(0,a.jsx)(st,{children:"View as"}),we.map(ua)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(mt,{"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 ma(e){return(0,a.jsx)(Ne(e),{className:"h-4 w-4"})}function Ne(e){switch(e){case"vertical":return aa;case"grid":return Mt;case"slides":return ze;default:return Qe(e),Dt}}function Se(e){return se(e)}function ua(e){return(0,a.jsx)(dt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[ma(e),(0,a.jsx)("span",{children:Se(e)})]})},e)}var fa=W();function ya(e){let t=(0,fa.c)(5),{openPrompt:i,closeModal:o}=Z(),{sendCopy:l}=P(),r;return t[0]!==o||t[1]!==i||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Ve.guessDeliminator(e);i({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ne.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{let d=s.join(ne.dirname(e),n);l({source:e,destination:d}).then(()=>{o(),j({title:"Notebook copied",description:"A copy of the notebook has been created."}),Jt(d)})}})},t[0]=o,t[1]=i,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const ka=()=>{let{updateCellConfig:e}=ie(),{saveCellConfig:t}=P();return(0,ee.useCallback)(async()=>{let i=new qe,o=le(),l=o.cellIds.inOrderIds,r={};for(let n of l){if(o.cellData[n]===void 0)continue;let{code:d,config:p}=o.cellData[n];p.hide_code||i.isSupported(d)&&(r[n]={hide_code:!0})}let s=re.entries(r);if(s.length!==0){await t({configs:r});for(let[n,d]of s)e({cellId:n,config:d})}},[e])};var ba=W();function Ee(){let e=(0,ba.c)(4),{openConfirm:t}=Z(),i=S(at),{sendRestart:o}=P(),l;return e[0]!==t||e[1]!==o||e[2]!==i?(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)(Lt,{onClick:async()=>{i({state:tt.CLOSING}),await o(),Ut()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=i,e[3]=l):l=e[3],l}var xa=W(),D=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function wa(){var te,ae;let e=(0,xa.c)(36),t=Ft(),{openModal:i,closeModal:o}=Z(),{toggleApplication:l}=Je(),{selectedPanel:r}=$e(),[s]=Ie(be),n=K(Ht),d=ka(),[p]=Ze(),{updateCellConfig:x,undoDeleteCell:w,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=ie(),k=Ee(),b=$t(),g=ya(t),v=S(Ae),A=S(xt),z=S(bt),{exportAsMarkdown:O,readCode:N,saveCellConfig:U}=P(),Y=K(Ye),$=K(Ke),{selectedLayout:F}=he(),{setLayoutView:G}=pe(),I=_e(),T=((te=p.sharing)==null?void 0:te.html)??!0,H=((ae=p.sharing)==null?void 0:ae.wasm)??!0,Pe=La,L;e[0]===Symbol.for("react.memo_cache_sentinel")?(L=(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),e[0]=L):L=e[0];let q;e[1]===Symbol.for("react.memo_cache_sentinel")?(q=(0,a.jsx)(me,{size:14,strokeWidth:1.5}),e[1]=q):q=e[1];let M;e[2]===t?M=e[3]:(M=async()=>{if(!t){j({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."});return}await ue({filename:t,includeCode:!0})},e[2]=t,e[3]=M);let R;return e[4]!==u||e[5]!==$||e[6]!==m||e[7]!==o||e[8]!==f||e[9]!==g||e[10]!==y||e[11]!==O||e[12]!==t||e[13]!==Y||e[14]!==d||e[15]!==n||e[16]!==i||e[17]!==N||e[18]!==k||e[19]!==b||e[20]!==U||e[21]!==F||e[22]!==r||e[23]!==v||e[24]!==z||e[25]!==G||e[26]!==A||e[27]!==T||e[28]!==H||e[29]!==M||e[30]!==l||e[31]!==I||e[32]!==w||e[33]!==x||e[34]!==s.mode?(R=[{icon:L,label:"Download",handle:D,dropdown:[{icon:q,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(me,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){j({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."});return}await ue({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(Gt,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let h=await O({download:!1});ke(new Blob([h],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(lt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let h=await N();ke(new Blob([h.contents],{type:"text/plain"}),ye.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: ",xe("global.hideCode",!1)]}),handle:Ha},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download as PDF",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: ",xe("global.hideCode",!1)]}),handle:Ia}]},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Share",handle:D,hidden:!T&&!H,dropdown:[{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!T,handle:async()=>{i((0,a.jsx)(la,{onClose:o}))}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!H,handle:async()=>{await V(Yt({code:(await N()).contents})),j({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:D,dropdown:Ue.flatMap(h=>{let{type:C,Icon:J,hidden:De}=h;return De?[]:{label:se(C),rightElement:Pe(r===C),icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),handle:()=>l(C)}})},{icon:(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),label:"Present as",handle:D,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{I()}},...we.map((h,C)=>{let J=Ne(h);return{divider:C===0,label:Se(h),icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:F===h&&(0,a.jsx)(fe,{size:14})}),handle:()=>{G(h),s.mode==="edit"&&I()}}})]},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ce(),handle:g},{icon:(0,a.jsx)(ge,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await V((await N()).contents),j({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(yt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!Y||n,handle:async()=>{let h=Ge(le());await U({configs:re.fromEntries(h.map(Da))});for(let C of h)x({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(ve,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{i((0,a.jsx)(Xe,{onClose:o}))}},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!$||n,handle:()=>{w()}},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{b()}},{icon:(0,a.jsx)(Oe,{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)(Qt,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(je,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Pa)},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ea)},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A(Sa),redundant:!0},{icon:(0,a.jsx)(ft,{size:14,strokeWidth:1.5}),label:"Resources",handle:D,dropdown:[{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Na},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Aa},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:_a},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Wa},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ma}]},{divider:!0,icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:za},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ca}].filter(va).map(ga),e[4]=u,e[5]=$,e[6]=m,e[7]=o,e[8]=f,e[9]=g,e[10]=y,e[11]=O,e[12]=t,e[13]=Y,e[14]=d,e[15]=n,e[16]=i,e[17]=N,e[18]=k,e[19]=b,e[20]=U,e[21]=F,e[22]=r,e[23]=v,e[24]=z,e[25]=G,e[26]=A,e[27]=T,e[28]=H,e[29]=M,e[30]=l,e[31]=I,e[32]=w,e[33]=x,e[34]=s.mode,e[35]=R):R=e[35],R}function ga(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ja)}:e}function ja(e){return!e.hidden}function va(e){return!e.hidden}function Ca(){let e=et();window.open(e,"_blank")}function za(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ma(){window.open(_.releasesPage,"_blank")}function Wa(){window.open(_.youtube,"_blank")}function _a(){window.open(_.discordLink,"_blank")}function Aa(){window.open(_.githubPage,"_blank")}function Na(){window.open(_.docsPage,"_blank")}function Sa(e){return!e}function Ea(e){return!e}function Pa(e){return!e}function Da(e){return[e,{disabled:!1}]}async function Ia(){let e=new Event("export-beforeprint"),t=new Event("export-afterprint");(function(){window.dispatchEvent(e),setTimeout(Ta,0),setTimeout(()=>window.dispatchEvent(t),0)})()}function Ta(){return window.print()}async function Ha(){let e=document.getElementById("App");e&&await ut(e,document.title)}function La(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(fe,{size:14})})}export{_e as a,ve as c,Ae as i,je as l,Ee as n,Me as o,pa as r,Ce as s,wa as t,ge as u};
1
+ import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as N,l as Ie,p as Te,u as K}from"./useEvent-DlWF5OMa.js";import{t as He}from"./react-BGmjiNul.js";import{Bn as Le,C as ie,Et as qe,Jn as Re,Nt as Ve,Pt as ne,Rn as Be,Un as Oe,an as Ue,ei as Q,h as Ye,in as $e,mr as Fe,on as Ge,p as le,t as Je,un as Ke}from"./cells-D_SkyFDn.js";import{t as W}from"./compiler-runtime-DeeZ7FnK.js";import{i as Qe}from"./useLifecycle-CmDXEyIC.js";import{a as se}from"./type-BdyvjzTI.js";import{n as Xe}from"./add-database-form-MNQmbAaT.js";import{a as re,d as E}from"./hotkeys-uKX61F1_.js";import{v as Ze}from"./utils-CJJIceVn.js";import{n as _,t as de}from"./constants-Bkp4R3bQ.js";import{M as ce,f as et,j as tt,w as at}from"./config-babG4OBR.js";import{t as ot}from"./jsx-runtime-DN_bIXfG.js";import{r as it,t as X}from"./button-DuYGqRtX.js";import{r as P}from"./requests-C0HaHO6a.js";import{t as c}from"./createLucideIcon-CW2xpJ57.js";import{a as he,f as nt,i as pe,m as lt,p as me,u as ue}from"./layout-Bd6wzfjT.js";import{t as fe}from"./check-CrAQug3q.js";import{a as st,c as rt,i as dt,n as ct,r as ht,s as pt,t as mt}from"./select-D0g5GnIs.js";import{i as ye,r as ut,t as ke}from"./download-CITws1-y.js";import{f as ft}from"./maps-s2pQkyf5.js";import{r as yt}from"./useCellActionButton-Woqd9LSB.js";import{t as kt}from"./copy-gBVL4NN-.js";import{d as bt,t as xt}from"./state-BTRRCWOH.js";import{t as wt}from"./download-DobaYJPt.js";import{t as gt}from"./eye-off-D9zAYqG9.js";import{t as jt}from"./file-plus-corner-BO_uS88s.js";import{t as vt}from"./file-BnFXtaZZ.js";import{i as Ct,n as zt,r as Mt,t as Wt}from"./youtube-BJQRl2JC.js";import{t as _t}from"./globe-CY9im410.js";import{n as At}from"./play-BJDBXApx.js";import{t as St}from"./link-54sBkoQp.js";import{r as Nt}from"./input-CaEtLL8p.js";import{t as Et}from"./settings-MTlHVxz3.js";import{y as Pt}from"./textarea-D2hGxqGj.js";import{t as Dt}from"./square-leQTJTJJ.js";import{t as j}from"./use-toast-Bzf3rpev.js";import{t as It}from"./tooltip-CvjcEpZC.js";import{a as be,i as Tt,r as Ht}from"./mode-BFwdGSZ7.js";import{o as Lt}from"./alert-dialog-k5KxevGr.js";import{a as qt,c as Rt,i as Vt,n as Bt,r as Ot}from"./dialog-DUEuLcT2.js";import{n as Z}from"./ImperativeModal-q6QlC2aZ.js";import{r as Ut,t as Yt}from"./share-CXQVxivL.js";import{t as V}from"./copy-DRhpWiOq.js";import{r as $t}from"./useRunCells-BZ_OFvV4.js";import{a as Ft}from"./cell-link-BoUpLV2S.js";import{a as xe}from"./renderShortcut-D0Pei-OA.js";import{t as Gt}from"./icons-D4lB4En9.js";import{t as Jt}from"./links-ENMiP32L.js";import{t as we}from"./types-BLEgJ92v.js";var Kt=c("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Qt=c("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ge=c("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"}]]),je=c("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"}]]),ve=c("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"}]]),Xt=c("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"}]]),Zt=c("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"}]]),ea=c("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]),ta=c("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"}]]),Ce=c("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"}]]),aa=c("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"}]]),oa=c("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),ze=c("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"}]]),ia=c("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"}]]),na=c("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"}]]),Me=c("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"}]]),We=W(),ee=oe(He(),1),a=oe(ot(),1),B="https://static.marimo.app";const la=e=>{let t=(0,We.c)(25),{onClose:i}=e,[o,l]=(0,ee.useState)(""),{exportAsHTML:r}=P(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,n=`${B}/static/${s}`,d;t[0]!==r||t[1]!==i||t[2]!==s?(d=async v=>{v.preventDefault(),i();let A=await r({download:!1,includeCode:!0,files:nt.INSTANCE.filenames()}),z=j({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${B}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:s})}).catch(()=>{z.dismiss(),j({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(),j({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]=i,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Rt,{children:"Share static notebook"}),t[4]=p):p=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsxs)(qt,{children:[p,(0,a.jsxs)(Ot,{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:B,target:"_blank",children:B}),"."]})]}),t[5]=x):x=t[5];let w;t[6]===Symbol.for("react.memo_cache_sentinel")?(w=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=w):w=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Nt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:w,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===n?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)(sa,{text:n}),(0,a.jsx)("span",{className:"text-primary",children:n})]})]}),t[9]=n,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]===i?y=t[15]:(y=(0,a.jsx)(X,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:i,children:"Cancel"}),t[14]=i,t[15]=y);let k;t[16]===n?k=t[17]:(k=(0,a.jsx)(X,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await V(n)},children:"Create"}),t[16]=n,t[17]=k);let b;t[18]!==y||t[19]!==k?(b=(0,a.jsxs)(Vt,{children:[y,k]}),t[18]=y,t[19]=k,t[20]=b):b=t[20];let g;return t[21]!==d||t[22]!==b||t[23]!==f?(g=(0,a.jsx)(Bt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[x,f,b]})}),t[21]=d,t[22]=b,t[23]=f,t[24]=g):g=t[24],g};var sa=e=>{let t=(0,We.c)(8),[i,o]=ee.useState(!1),l;t[0]===e.text?l=t[1]:(l=it.stopPropagation(async p=>{p.preventDefault(),await V(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)(kt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let n;t[3]===r?n=t[4]:(n=(0,a.jsx)(X,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=n);let d;return t[5]!==i||t[6]!==n?(d=(0,a.jsx)(It,{content:"Copied!",open:i,children:n}),t[5]=i,t[6]=n,t[7]=d):d=t[7],d},ra=W();function da(){let e=document.getElementsByClassName(de.outputArea);for(let t of e){let i=t.getBoundingClientRect();if(i.bottom>0&&i.top<window.innerHeight){let o=Q.findElement(t);if(!o){E.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:Q.parse(o.id)}}}return E.warn("No visible output area found for scroll anchor"),null}function ca(e){if(!e){E.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(Q.create(e.cellId));if(!t){E.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${de.outputArea}`)){E.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function _e(){let e=(0,ra.c)(2),t=N(be),i;return e[0]===t?i=e[1]:(i=()=>{let o=da();t(l=>({mode:Tt(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ca(o)})})},e[0]=t,e[1]=i),i}const Ae=Te(!1);var ha=W();const pa=()=>{let e=(0,ha.c)(7),{selectedLayout:t}=he(),{setLayoutView:i}=pe();if(ce()&&!Ke("wasm_layouts"))return null;let o;e[0]===i?o=e[1]:(o=n=>i(n),e[0]=i,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(pt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(rt,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(ct,{children:(0,a.jsxs)(ht,{children:[(0,a.jsx)(st,{children:"View as"}),we.map(ua)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(mt,{"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 ma(e){return(0,a.jsx)(Se(e),{className:"h-4 w-4"})}function Se(e){switch(e){case"vertical":return aa;case"grid":return Mt;case"slides":return ze;default:return Qe(e),Dt}}function Ne(e){return se(e)}function ua(e){return(0,a.jsx)(dt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[ma(e),(0,a.jsx)("span",{children:Ne(e)})]})},e)}var fa=W();function ya(e){let t=(0,fa.c)(5),{openPrompt:i,closeModal:o}=Z(),{sendCopy:l}=P(),r;return t[0]!==o||t[1]!==i||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Ve.guessDeliminator(e);i({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ne.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{let d=s.join(ne.dirname(e),n);l({source:e,destination:d}).then(()=>{o(),j({title:"Notebook copied",description:"A copy of the notebook has been created."}),Jt(d)})}})},t[0]=o,t[1]=i,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const ka=()=>{let{updateCellConfig:e}=ie(),{saveCellConfig:t}=P();return(0,ee.useCallback)(async()=>{let i=new qe,o=le(),l=o.cellIds.inOrderIds,r={};for(let n of l){if(o.cellData[n]===void 0)continue;let{code:d,config:p}=o.cellData[n];p.hide_code||i.isSupported(d)&&(r[n]={hide_code:!0})}let s=re.entries(r);if(s.length!==0){await t({configs:r});for(let[n,d]of s)e({cellId:n,config:d})}},[e])};var ba=W();function Ee(){let e=(0,ba.c)(4),{openConfirm:t}=Z(),i=N(at),{sendRestart:o}=P(),l;return e[0]!==t||e[1]!==o||e[2]!==i?(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)(Lt,{onClick:async()=>{i({state:tt.CLOSING}),await o(),Ut()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=i,e[3]=l):l=e[3],l}var xa=W(),D=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function wa(){var te,ae;let e=(0,xa.c)(36),t=Ft(),{openModal:i,closeModal:o}=Z(),{toggleApplication:l}=$e(),{selectedPanel:r}=Ue(),[s]=Ie(be),n=K(Ht),d=ka(),[p]=Ze(),{updateCellConfig:x,undoDeleteCell:w,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=ie(),k=Ee(),b=$t(),g=ya(t),v=N(Ae),A=N(xt),z=N(bt),{exportAsMarkdown:O,readCode:S,saveCellConfig:U}=P(),Y=K(Ye),$=K(Je),{selectedLayout:F}=he(),{setLayoutView:G}=pe(),I=_e(),T=((te=p.sharing)==null?void 0:te.html)??!0,H=((ae=p.sharing)==null?void 0:ae.wasm)??!0,Pe=La,L;e[0]===Symbol.for("react.memo_cache_sentinel")?(L=(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),e[0]=L):L=e[0];let q;e[1]===Symbol.for("react.memo_cache_sentinel")?(q=(0,a.jsx)(me,{size:14,strokeWidth:1.5}),e[1]=q):q=e[1];let M;e[2]===t?M=e[3]:(M=async()=>{if(!t){j({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."});return}await ue({filename:t,includeCode:!0})},e[2]=t,e[3]=M);let R;return e[4]!==u||e[5]!==$||e[6]!==m||e[7]!==o||e[8]!==f||e[9]!==g||e[10]!==y||e[11]!==O||e[12]!==t||e[13]!==Y||e[14]!==d||e[15]!==n||e[16]!==i||e[17]!==S||e[18]!==k||e[19]!==b||e[20]!==U||e[21]!==F||e[22]!==r||e[23]!==v||e[24]!==z||e[25]!==G||e[26]!==A||e[27]!==T||e[28]!==H||e[29]!==M||e[30]!==l||e[31]!==I||e[32]!==w||e[33]!==x||e[34]!==s.mode?(R=[{icon:L,label:"Download",handle:D,dropdown:[{icon:q,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(me,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){j({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."});return}await ue({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(Gt,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let h=await O({download:!1});ke(new Blob([h],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(lt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let h=await S();ke(new Blob([h.contents],{type:"text/plain"}),ye.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: ",xe("global.hideCode",!1)]}),handle:Ha},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download as PDF",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: ",xe("global.hideCode",!1)]}),handle:Ia}]},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Share",handle:D,hidden:!T&&!H,dropdown:[{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!T,handle:async()=>{i((0,a.jsx)(la,{onClose:o}))}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!H,handle:async()=>{await V(Yt({code:(await S()).contents})),j({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:D,dropdown:Ge.flatMap(h=>{let{type:C,Icon:J,hidden:De}=h;return De?[]:{label:se(C),rightElement:Pe(r===C),icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),handle:()=>l(C)}})},{icon:(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),label:"Present as",handle:D,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Ce,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{I()}},...we.map((h,C)=>{let J=Se(h);return{divider:C===0,label:Ne(h),icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:F===h&&(0,a.jsx)(fe,{size:14})}),handle:()=>{G(h),s.mode==="edit"&&I()}}})]},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ce(),handle:g},{icon:(0,a.jsx)(ge,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await V((await S()).contents),j({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(yt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!Y||n,handle:async()=>{let h=Fe(le());await U({configs:re.fromEntries(h.map(Da))});for(let C of h)x({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(ve,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{i((0,a.jsx)(Xe,{onClose:o}))}},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!$||n,handle:()=>{w()}},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{b()}},{icon:(0,a.jsx)(Oe,{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)(Qt,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(je,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Pa)},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Ea)},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A(Na),redundant:!0},{icon:(0,a.jsx)(ft,{size:14,strokeWidth:1.5}),label:"Resources",handle:D,dropdown:[{icon:(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Sa},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Aa},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:_a},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Wa},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ma}]},{divider:!0,icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:za},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ca}].filter(va).map(ga),e[4]=u,e[5]=$,e[6]=m,e[7]=o,e[8]=f,e[9]=g,e[10]=y,e[11]=O,e[12]=t,e[13]=Y,e[14]=d,e[15]=n,e[16]=i,e[17]=S,e[18]=k,e[19]=b,e[20]=U,e[21]=F,e[22]=r,e[23]=v,e[24]=z,e[25]=G,e[26]=A,e[27]=T,e[28]=H,e[29]=M,e[30]=l,e[31]=I,e[32]=w,e[33]=x,e[34]=s.mode,e[35]=R):R=e[35],R}function ga(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ja)}:e}function ja(e){return!e.hidden}function va(e){return!e.hidden}function Ca(){let e=et();window.open(e,"_blank")}function za(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ma(){window.open(_.releasesPage,"_blank")}function Wa(){window.open(_.youtube,"_blank")}function _a(){window.open(_.discordLink,"_blank")}function Aa(){window.open(_.githubPage,"_blank")}function Sa(){window.open(_.docsPage,"_blank")}function Na(e){return!e}function Ea(e){return!e}function Pa(e){return!e}function Da(e){return[e,{disabled:!1}]}async function Ia(){let e=new Event("export-beforeprint"),t=new Event("export-afterprint");(function(){window.dispatchEvent(e),setTimeout(Ta,0),setTimeout(()=>window.dispatchEvent(t),0)})()}function Ta(){return window.print()}async function Ha(){let e=document.getElementById("App");e&&await ut(e,document.title)}function La(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(fe,{size:14})})}export{_e as a,ve as c,Ae as i,je as l,Ee as n,Me as o,pa as r,Ce as s,wa as t,ge as u};
@@ -1 +1 @@
1
- import{d as g,n as i,p as k}from"./useEvent-DlWF5OMa.js";import{C as v,_n as w,hr as F,p as f,rt as b,yr as _}from"./cells-Dk_j8HX9.js";import{t as x}from"./compiler-runtime-DeeZ7FnK.js";import{d as C}from"./hotkeys-uKX61F1_.js";import{o as D}from"./dist-DKNOF5xd.js";import{r as H}from"./requests-C0HaHO6a.js";var u=x();const y=k(!1);function V(){let r=(0,u.c)(2),n=p(),t;return r[0]===n?t=r[1]:(t=()=>n(_(f())),r[0]=n,r[1]=t),i(t)}function j(r){let n=(0,u.c)(3),t=p(),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=p(),t;return r[0]===n?t=r[1]:(t=()=>n(F(f())),r[0]=n,r[1]=t),i(t)}function p(){let r=(0,u.c)(4),{prepareForRun:n}=v(),{sendRun:t}=H(),e=g(y),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=f();return e(!0),I({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 I({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,h,R;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(h=(m=o[a])==null?void 0:m.current)==null?void 0:h.editorView,d;l?(w(l)!=="markdown"&&D(l),d=b(l)):d=((R=s[a])==null?void 0:R.code)||"",c.push(d),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{C.error(a)})}export{p as a,j as i,I as n,V as o,q as r,y as t};
1
+ import{d as g,n as i,p as k}from"./useEvent-DlWF5OMa.js";import{C as v,_n as w,hr as F,p as f,rt as b,yr as _}from"./cells-D_SkyFDn.js";import{t as x}from"./compiler-runtime-DeeZ7FnK.js";import{d as C}from"./hotkeys-uKX61F1_.js";import{o as D}from"./dist-DKNOF5xd.js";import{r as H}from"./requests-C0HaHO6a.js";var u=x();const y=k(!1);function V(){let r=(0,u.c)(2),n=p(),t;return r[0]===n?t=r[1]:(t=()=>n(_(f())),r[0]=n,r[1]=t),i(t)}function j(r){let n=(0,u.c)(3),t=p(),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=p(),t;return r[0]===n?t=r[1]:(t=()=>n(F(f())),r[0]=n,r[1]=t),i(t)}function p(){let r=(0,u.c)(4),{prepareForRun:n}=v(),{sendRun:t}=H(),e=g(y),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=f();return e(!0),I({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 I({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,h,R;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(h=(m=o[a])==null?void 0:m.current)==null?void 0:h.editorView,d;l?(w(l)!=="markdown"&&D(l),d=b(l)):d=((R=s[a])==null?void 0:R.code)||"",c.push(d),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{C.error(a)})}export{p as a,j as i,I as n,V as o,q as r,y as t};
@@ -1 +1 @@
1
- import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-DlWF5OMa.js";import{C as d,d as f,rt as u}from"./cells-Dk_j8HX9.js";import{t as c}from"./compiler-runtime-DeeZ7FnK.js";import{t as C}from"./jsx-runtime-DN_bIXfG.js";import{t as h}from"./use-toast-Bzf3rpev.js";import{r as v}from"./useDeleteCell-CFtiNna2.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:r,undoSplitCell:i}=d(),o;return t[0]!==r||t[1]!==i?(o=s=>{let l=f(s.cellId);if(!l)return;let a=u(l);r(s);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{i({...s,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=r,t[1]=i,t[2]=o):o=t[2],p(o)}export{j as t};
1
+ import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-DlWF5OMa.js";import{C as d,d as f,rt as u}from"./cells-D_SkyFDn.js";import{t as c}from"./compiler-runtime-DeeZ7FnK.js";import{t as C}from"./jsx-runtime-DN_bIXfG.js";import{t as h}from"./use-toast-Bzf3rpev.js";import{r as v}from"./useDeleteCell-GHwc6J4l.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:r,undoSplitCell:i}=d(),o;return t[0]!==r||t[1]!==i?(o=s=>{let l=f(s.cellId);if(!l)return;let a=u(l);r(s);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{i({...s,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=r,t[1]=i,t[2]=o):o=t[2],p(o)}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,o as ot,p as P}from"./useEvent-DlWF5OMa.js";import{t as lt}from"./react-BGmjiNul.js";import{Gr as ut,Xr as ct,Zr as z,v as dt,y as ft,zr as mt}from"./cells-Dk_j8HX9.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-Cg4WLWh2.js";import{t as pe}from"./compiler-runtime-DeeZ7FnK.js";import{t as bt}from"./get-CyLJYAfP.js";import{r as wt}from"./useLifecycle-CmDXEyIC.js";import{t as vt}from"./debounce-BbFlGgjv.js";import{t as xt}from"./_baseSet-6FYvpjrm.js";import{d as E,p as y}from"./hotkeys-uKX61F1_.js";import{t as Et}from"./invariant-C6yE60hi.js";import{x as _t}from"./utils-CJJIceVn.js";import{M as Ct}from"./config-babG4OBR.js";import{a as kt}from"./switch-Cd5iA-KH.js";import{n as he}from"./globals-BBskDqJi.js";import{t as ge}from"./ErrorBoundary-Drf1manw.js";import{t as Rt}from"./jsx-runtime-DN_bIXfG.js";import{t as Ft}from"./button-DuYGqRtX.js";import{t as Nt}from"./cn-C1rgT0yh.js";import{Z as St}from"./JsonOutput-BCHaEg3R.js";import{t as ye}from"./requests-C0HaHO6a.js";import{t as be}from"./createLucideIcon-CW2xpJ57.js";import{h as qt}from"./select-D0g5GnIs.js";import{c as Pt,i as Mt,l as jt,r as Tt,u as It}from"./markdown-renderer-COkLQ1b5.js";import{t as At}from"./DeferredRequestRegistry-B3BENoUa.js";import{t as K}from"./Deferred-DzyBMRsy.js";import{t as Lt}from"./uuid-ClFZlR7U.js";import{t as Ut}from"./use-toast-Bzf3rpev.js";import{t as we}from"./tooltip-CvjcEpZC.js";import{t as ve}from"./mode-BOijHAOc.js";import{n as zt,r as Ot,t as Wt}from"./share-CXQVxivL.js";import{r as Dt,t as Ht}from"./react-resizable-panels.browser.esm-BqxQegSf.js";import{t as xe}from"./toggle-G1t0cQyf.js";function Bt(t,e,n){return t==null?t:xt(t,e,n)}var H=Bt,Vt=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"}]]),Xt=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 $t(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),Z=(0,u.createContext)(null),Yt=t=>{let{controller:e}=(0,u.useContext)(Z),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},Gt=Object.defineProperty,Qt=(t,e,n)=>e in t?Gt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ee=(t,e,n)=>(Qt(t,typeof e=="symbol"?e:e+"",n),n),_e=console,Kt=class{constructor(t){Ee(this,"_bus"),Ee(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)}},Zt=Object.defineProperty,Jt=(t,e,n)=>e in t?Zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,en=(t,e,n)=>(Jt(t,typeof e=="symbol"?e:e+"",n),n),Ce=class{constructor(){en(this,"bus",$t())}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 tn(t){let e=t||new Ce;return{controller:e,manager:new Kt(e.bus)}}var nn=({controller:t,children:e})=>{let[n]=u.useState(()=>{let r=tn(t);return r.manager.mount(),r});return u.useEffect(()=>()=>{n.manager.unmount()},[]),u.createElement(Z.Provider,{value:n},e)};function J(t,e){let[n,r]=(0,u.useState)([]),{manager:s}=(0,u.useContext)(Z);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 ke=t=>{let e=J(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 rn=new Ce,B={SIDEBAR:"sidebar",CONTEXT_AWARE_PANEL:"context-aware-panel"};var sn=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)}},Re=class ue{constructor(e){a(this,"subscriptions",new sn);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)}},an=1e10,on=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 ln(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=on}=t;t.transport&&s(t.transport),t.requestHandler&&d(t.requestHandler),t._debugHooks&&n(t._debugHooks);let p=0;function b(){return p<=an?++p:p=0}let x=new Map,w=new Map;function _(o,...f){let g=f[0];return new Promise((c,h)=>{var I;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)),(I=e.onSend)==null||I.call(e,M),r.send(M)})}let F=new Proxy(_,{get:(o,f,g)=>f in o?Reflect.get(o,f,g):c=>_(f,c)}),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 T(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(I){if(!(I instanceof Error))throw I;M={type:"response",id:c,success:!1,error:I.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:C,send:R,sendProxy:v,addMessageListener:T,removeMessageListener:L,proxy:{send:v,request:C},_setDebugHooks:n}}function un(t){return ln(t)}var Fe="[transport-id]";function cn(t,e){let{transportId:n}=e;return n==null?t:{[Fe]:n,data:t}}function dn(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[Fe]!==n)return[!0];i=t.data}return s===!1?[!0]:[!1,i]}function fn(t,e={}){let{transportId:n,filter:r,remotePort:s}=e,i=t,d=s??t,l;return{send(p){d.postMessage(cn(p,{transportId:n}))},registerHandler(p){l=b=>{let x=b.data,[w,_]=dn(x,{transportId:n,filter:()=>r==null?void 0:r(b)});w||p(_)},i.addEventListener("message",l)},unregisterHandler(){l&&i.removeEventListener("message",l)}}}function mn(t,e){return fn(t,e)}function Ne(t){return un({transport:mn(t,{transportId:"marimo-transport"}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{E.debug("[rpc] Parent -> Worker",e)},onReceive:e=>{E.debug("[rpc] Worker -> Parent",e)}}})}const Se=P("Initializing..."),pn=P(t=>{let e=t(dt),n=Object.values(e.cellRuntime);return n.some(r=>!It(r.output))?!0:n.every(r=>r.status==="idle")});var qe=zt(),Pe="marimo:file",Me=new mt(null);const hn={saveFile(t){Me.set(Pe,t)},readFile(){return Me.get(Pe)}};var gn={saveFile(t){z.setCodeForHash((0,qe.compressToEncodedURIComponent)(t))},readFile(){let t=z.getCodeFromHash()||z.getCodeFromSearchParam();return t?(0,qe.decompressFromEncodedURIComponent)(t):null}};const yn={saveFile(t){},readFile(){let t=document.querySelector("marimo-code");return t?decodeURIComponent(t.textContent||"").trim():null}};var bn={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)}},wn={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,o as ot,p as P}from"./useEvent-DlWF5OMa.js";import{t as lt}from"./react-BGmjiNul.js";import{Gr as ut,Xr as ct,Zr as z,v as dt,y as ft,zr as mt}from"./cells-D_SkyFDn.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-Cg4WLWh2.js";import{t as pe}from"./compiler-runtime-DeeZ7FnK.js";import{t as bt}from"./get-CyLJYAfP.js";import{r as wt}from"./useLifecycle-CmDXEyIC.js";import{t as vt}from"./debounce-BbFlGgjv.js";import{t as xt}from"./_baseSet-6FYvpjrm.js";import{d as E,p as y}from"./hotkeys-uKX61F1_.js";import{t as Et}from"./invariant-C6yE60hi.js";import{x as _t}from"./utils-CJJIceVn.js";import{M as Ct}from"./config-babG4OBR.js";import{a as kt}from"./switch-C9iBa4rX.js";import{n as he}from"./globals-D3SeIm1j.js";import{t as ge}from"./ErrorBoundary-Drf1manw.js";import{t as Rt}from"./jsx-runtime-DN_bIXfG.js";import{t as Ft}from"./button-DuYGqRtX.js";import{t as Nt}from"./cn-C1rgT0yh.js";import{Z as St}from"./JsonOutput-BLd1jTNA.js";import{t as ye}from"./requests-C0HaHO6a.js";import{t as be}from"./createLucideIcon-CW2xpJ57.js";import{h as qt}from"./select-D0g5GnIs.js";import{c as Pt,i as Mt,l as jt,r as Tt,u as It}from"./markdown-renderer-C_xfLXiO.js";import{t as At}from"./DeferredRequestRegistry-B3BENoUa.js";import{t as K}from"./Deferred-DzyBMRsy.js";import{t as Lt}from"./uuid-ClFZlR7U.js";import{t as Ut}from"./use-toast-Bzf3rpev.js";import{t as we}from"./tooltip-CvjcEpZC.js";import{t as ve}from"./mode-BFwdGSZ7.js";import{n as zt,r as Ot,t as Wt}from"./share-CXQVxivL.js";import{r as Dt,t as Ht}from"./react-resizable-panels.browser.esm-BqxQegSf.js";import{t as xe}from"./toggle-G1t0cQyf.js";function Bt(t,e,n){return t==null?t:xt(t,e,n)}var H=Bt,Vt=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"}]]),Xt=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 $t(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),Z=(0,u.createContext)(null),Yt=t=>{let{controller:e}=(0,u.useContext)(Z),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},Gt=Object.defineProperty,Qt=(t,e,n)=>e in t?Gt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ee=(t,e,n)=>(Qt(t,typeof e=="symbol"?e:e+"",n),n),_e=console,Kt=class{constructor(t){Ee(this,"_bus"),Ee(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)}},Zt=Object.defineProperty,Jt=(t,e,n)=>e in t?Zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,en=(t,e,n)=>(Jt(t,typeof e=="symbol"?e:e+"",n),n),Ce=class{constructor(){en(this,"bus",$t())}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 tn(t){let e=t||new Ce;return{controller:e,manager:new Kt(e.bus)}}var nn=({controller:t,children:e})=>{let[n]=u.useState(()=>{let r=tn(t);return r.manager.mount(),r});return u.useEffect(()=>()=>{n.manager.unmount()},[]),u.createElement(Z.Provider,{value:n},e)};function J(t,e){let[n,r]=(0,u.useState)([]),{manager:s}=(0,u.useContext)(Z);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 ke=t=>{let e=J(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 rn=new Ce,B={SIDEBAR:"sidebar",CONTEXT_AWARE_PANEL:"context-aware-panel"};var sn=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)}},Re=class ue{constructor(e){a(this,"subscriptions",new sn);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)}},an=1e10,on=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 ln(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=on}=t;t.transport&&s(t.transport),t.requestHandler&&d(t.requestHandler),t._debugHooks&&n(t._debugHooks);let p=0;function b(){return p<=an?++p:p=0}let x=new Map,w=new Map;function _(o,...f){let g=f[0];return new Promise((c,h)=>{var I;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)),(I=e.onSend)==null||I.call(e,M),r.send(M)})}let F=new Proxy(_,{get:(o,f,g)=>f in o?Reflect.get(o,f,g):c=>_(f,c)}),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 T(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(I){if(!(I instanceof Error))throw I;M={type:"response",id:c,success:!1,error:I.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:C,send:R,sendProxy:v,addMessageListener:T,removeMessageListener:L,proxy:{send:v,request:C},_setDebugHooks:n}}function un(t){return ln(t)}var Fe="[transport-id]";function cn(t,e){let{transportId:n}=e;return n==null?t:{[Fe]:n,data:t}}function dn(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[Fe]!==n)return[!0];i=t.data}return s===!1?[!0]:[!1,i]}function fn(t,e={}){let{transportId:n,filter:r,remotePort:s}=e,i=t,d=s??t,l;return{send(p){d.postMessage(cn(p,{transportId:n}))},registerHandler(p){l=b=>{let x=b.data,[w,_]=dn(x,{transportId:n,filter:()=>r==null?void 0:r(b)});w||p(_)},i.addEventListener("message",l)},unregisterHandler(){l&&i.removeEventListener("message",l)}}}function mn(t,e){return fn(t,e)}function Ne(t){return un({transport:mn(t,{transportId:"marimo-transport"}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{E.debug("[rpc] Parent -> Worker",e)},onReceive:e=>{E.debug("[rpc] Worker -> Parent",e)}}})}const Se=P("Initializing..."),pn=P(t=>{let e=t(dt),n=Object.values(e.cellRuntime);return n.some(r=>!It(r.output))?!0:n.every(r=>r.status==="idle")});var qe=zt(),Pe="marimo:file",Me=new mt(null);const hn={saveFile(t){Me.set(Pe,t)},readFile(){return Me.get(Pe)}};var gn={saveFile(t){z.setCodeForHash((0,qe.compressToEncodedURIComponent)(t))},readFile(){let t=z.getCodeFromHash()||z.getCodeFromSearchParam();return t?(0,qe.decompressFromEncodedURIComponent)(t):null}};const yn={saveFile(t){},readFile(){let t=document.querySelector("marimo-code");return t?decodeURIComponent(t.textContent||"").trim():null}};var bn={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)}},wn={saveFile(t){},readFile(){return["import marimo","app = marimo.App()","","@app.cell","def __():"," return","",'if __name__ == "__main__":'," app.run()"].join(`
2
2
  `)}},je=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 X=new je([yn,gn]),ee=new je([hn,bn,wn]);var Te=class rt{constructor(){a(this,"initialized",new K);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&&(X.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&&(X.saveFile(e.contents),ee.saveFile(e.contents)),Ot(),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=Wt({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:Lt()}),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,"autoExportAsHTML",y);a(this,"autoExportAsMarkdown",y);a(this,"autoExportAsIPYNB",y);a(this,"writeSecret",y);a(this,"invokeAiTool",y);a(this,"clearCache",y);a(this,"getCacheInfo",y);Ct()&&(this.rpc=Ne(new Worker(new URL(""+new URL("worker-CUL1lW-N.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(Se,e)}),this.rpc.addMessageListener("initializedError",({error:e})=>{this.initialized.status==="resolved"&&(E.error(e),Ut({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 ve()==="read"?(E.debug("Skipping SaveWorker in read-mode"),{readFile:y,readNotebook:y,saveNotebook:y}):Ne(new Worker(new URL(""+new URL("save-worker-DtF6B3PS.js",import.meta.url).href,""+import.meta.url),{type:"module",name:he()})).proxy.request}async startSession(){let e=await X.readFile(),n=await ee.readFile(),r=z.getFilename(),s=Q.get(_t),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:ve()==="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 vn(){return Re.withProducerCallback(t=>{Te.INSTANCE.attachMessageConsumer(t)})}const Ie=P({isInstantiated:!1,error:null});function xn(){return ot(Ie,t=>t.isInstantiated)}function $(t){return()=>({TYPE:t,is(e){return e.type===t},create(e){return new CustomEvent(t,e)}})}const Ae=$("marimo-value-input")(),Le=$("marimo-value-update")(),Ue=$("marimo-value-ready")(),ze=$("marimo-incoming-message")();function En(t,e){return Ae.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:ct(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 _n=Oe.INSTANCE,Cn=new At("function-call-result",async(t,e)=>{await ye().sendFunctionRequest({functionCallId:t,...e})}),kn="68px";var Rn="288px";const Fn=t=>t?/^\d+$/.test(t)?`${t}px`:t:Rn,Nn=ut({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 Sn(t){return jt(Tt(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))}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=Sn(d);r.push(l),s.push(i),H(n,i,l)}}return{state:n,buffers:r,bufferPaths:s}}function qn(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}if(typeof l=="string"){let p=Mt(Pt(l));H(s,d,new DataView(p.buffer))}else 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 K,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 K,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 Pn(t){return t==null?!1:He.safeParse(t).success}async function Mn({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:_}=ne(b);ye().sendModelValue({modelId:t,message:{state:x,bufferPaths:_},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),jn=P(null),Ve=P(!1),Tn=P(!1),Xe=P(!1);var In=pe();const $e=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 C=d.current,k=l.current,R=p.current;if(!C||!k&&!R)return;let v=Number.parseInt(window.getComputedStyle(C).width,10),N=0,q=!1,T=null,L=c=>{if(!C||!q||!T)return;let h=c.clientX-N;N=c.clientX,v=T==="left"?v-h:v+h,s&&(v=Math.max(s,v)),i&&(v=Math.min(i,v)),C.style.width=`${v}px`},U=()=>{q&&(n==null||n(v),q=!1,T=null),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",U)},o=(c,h)=>{c.preventDefault(),q=!0,T=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 _=r==="contentWidth"?"var(--content-width-medium)":`${r}px`,F;return e[6]===_?F=e[7]:(F={resizableDivRef:d,handleRefs:w,style:{width:_}},e[6]=_,e[7]=F),F};function Ye(t){t||window.dispatchEvent(new Event("resize"))}var Ge=pe(),m=ce(Rt(),1);const An=()=>{let t=(0,Ge.c)(16),[e,n]=D(Be),[r,s]=D(Ve),[i,d]=D(Tn),[l,p]=D(Xe),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(J(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)(we,{content:i?"Unpin panel":"Pin panel",children:(0,m.jsx)(xe,{size:"xs",onPressedChange:()=>d(!i),pressed:i,"aria-label":i?"Unpin panel":"Pin panel",children:i?(0,m.jsx)(Xt,{className:"w-4 h-4"}):(0,m.jsx)(St,{className:"w-4 h-4"})})}),(0,m.jsx)(we,{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)(xe,{size:"xs",onPressedChange:()=>p(!l),pressed:l,"aria-label":l?"Follow focused cell":"Fixed",children:(0,m.jsx)(Vt,{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 _=w,F;t[8]!==x||t[9]!==_?(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:[_(),(0,m.jsx)(Ft,{variant:"linkDestructive",size:"icon",onClick:x,"aria-label":"Close selection panel",children:(0,m.jsx)(qt,{className:"w-4 h-4"})})]}),(0,m.jsx)(ge,{children:(0,m.jsx)(ke,{name:B.CONTEXT_AWARE_PANEL})})]}),t[8]=x,t[9]=_,t[10]=F):F=t[10];let C=F;if(!i){let v;return t[11]===C?v=t[12]:(v=(0,m.jsx)(Un,{children:C()}),t[11]=C,t[12]=v),v}let k;t[13]===Symbol.for("react.memo_cache_sentinel")?(k=(0,m.jsx)(Dt,{onDragging:Ye,className:"resize-handle border-border z-20 no-print border-l"}),t[13]=k):k=t[13];let R;return t[14]===C?R=t[15]:(R=(0,m.jsxs)(m.Fragment,{children:[k,(0,m.jsx)(Ht,{defaultSize:20,minSize:15,maxSize:80,children:C()})]}),t[14]=C,t[15]=R),R},Ln=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)(Yt,{name:B.CONTEXT_AWARE_PANEL,children:n})}),e[0]=n,e[1]=r),r};var Un=({children:t})=>{let{resizableDivRef:e,handleRefs:n,style:r}=$e({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 zn(){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 A(t){var e;return t?G(t)?t:ae(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window:window}function Ke(t){let{Document:e}=A(t);return t instanceof e}function Ze(t){return G(t)?!1:t instanceof A(t).HTMLElement}function Je(t){return t instanceof A(t).SVGElement}function On(t){return t?G(t)?t.document:ae(t)?Ke(t)?t:Ze(t)||Je(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 Wn(){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 Dn(t,e){e===void 0&&(e=[t]);let n=(0,u.useRef)(t);return ie(()=>{n.current!==t&&(n.current=t)},e),n}function Hn(t,e){let n=(0,u.useRef)();return(0,u.useMemo)(()=>{let r=t(n.current);return n.current=r,r},[...e])}function Bn(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 Vn(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 $n=tt(1),Yn=tt(-1);function Gn(t){return"clientX"in t&&"clientY"in t}function Qn(t){if(!t)return!1;let{KeyboardEvent:e}=A(t.target);return e&&t instanceof e}function Kn(t){if(!t)return!1;let{TouchEvent:e}=A(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 Gn(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 Jn(t){return t.matches(nt)?t:t.querySelector(nt)}export{vn as $,jn as A,Fn as B,Xn as C,$e as D,Ye as E,Pn as F,ze as G,Cn as H,Y as I,Le as J,Ae as K,qn as L,We as M,De as N,Ve as O,Mn as P,Te as Q,ne as R,Vn as S,Ln as T,Oe as U,Nn as V,_n as W,Ie as X,En as Y,xn as Z,Wn as _,Zn as a,rn as at,Hn as b,Ke as c,J as ct,ae as d,X as et,Je as f,et as g,zn as h,Jn as i,B as it,Xe as j,Be as k,Ze as l,H as lt,Yn as m,$n as n,Se as nt,On as o,nn as ot,G as p,Ue as q,Qe as r,Re as rt,A as s,ke as st,le as t,pn as tt,Qn as u,ie as v,An as w,Bn as x,Dn as y,kn 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-MoQWZ3Gl.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-BReVmpoy.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/hotkeys-uKX61F1_.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-BLUna9fQ.js">
@@ -136,7 +136,7 @@
136
136
  <link rel="modulepreload" crossorigin href="./assets/toInteger-CDcO32Gx.js">
137
137
  <link rel="modulepreload" crossorigin href="./assets/database-zap-CaVvnK_o.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/main-CwSdzVhm.js">
139
- <link rel="modulepreload" crossorigin href="./assets/cells-Dk_j8HX9.js">
139
+ <link rel="modulepreload" crossorigin href="./assets/cells-D_SkyFDn.js">
140
140
  <link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-Drf1manw.js">
141
141
  <link rel="modulepreload" crossorigin href="./assets/kbd-Czc5z_04.js">
142
142
  <link rel="modulepreload" crossorigin href="./assets/useInstallPackage-RldLPyJs.js">
@@ -150,33 +150,33 @@
150
150
  <link rel="modulepreload" crossorigin href="./assets/usePress-C2LPFxyv.js">
151
151
  <link rel="modulepreload" crossorigin href="./assets/input-CaEtLL8p.js">
152
152
  <link rel="modulepreload" crossorigin href="./assets/ImperativeModal-q6QlC2aZ.js">
153
- <link rel="modulepreload" crossorigin href="./assets/cell-link-DNVmmRzI.js">
153
+ <link rel="modulepreload" crossorigin href="./assets/cell-link-BoUpLV2S.js">
154
154
  <link rel="modulepreload" crossorigin href="./assets/multi-map-fjX9ImVF.js">
155
155
  <link rel="modulepreload" crossorigin href="./assets/alert-BEdExd6A.js">
156
156
  <link rel="modulepreload" crossorigin href="./assets/chevron-right-CqEd11Di.js">
157
157
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-BP4_BZLr.js">
158
158
  <link rel="modulepreload" crossorigin href="./assets/links-DNmjkr65.js">
159
- <link rel="modulepreload" crossorigin href="./assets/datasource-i415crE1.js">
160
- <link rel="modulepreload" crossorigin href="./assets/state-HUtu_wpA.js">
161
- <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-BIIhR96K.js">
159
+ <link rel="modulepreload" crossorigin href="./assets/datasource-CR_zEq5o.js">
160
+ <link rel="modulepreload" crossorigin href="./assets/state-kFdt1US2.js">
161
+ <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-Orp0blpZ.js">
162
162
  <link rel="modulepreload" crossorigin href="./assets/copy-DRhpWiOq.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/copy-gBVL4NN-.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/copy-icon-B69c-352.js">
165
165
  <link rel="modulepreload" crossorigin href="./assets/spinner-C1czjtp7.js">
166
- <link rel="modulepreload" crossorigin href="./assets/es-DjCjT1hB.js">
167
- <link rel="modulepreload" crossorigin href="./assets/focus-U1ePwk4d.js">
166
+ <link rel="modulepreload" crossorigin href="./assets/es-CEEVxHsX.js">
167
+ <link rel="modulepreload" crossorigin href="./assets/focus-D18AHojc.js">
168
168
  <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-jpEDlD0M.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/katex-AwOI3EvM.js">
170
170
  <link rel="modulepreload" crossorigin href="./assets/marked.esm-CHnOtnr3.js">
171
171
  <link rel="modulepreload" crossorigin href="./assets/chunk-OGVTOU66-CjNLT2C3.js">
172
- <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-COkLQ1b5.js">
172
+ <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-C_xfLXiO.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/dist-DOFFh6Ii.js">
174
- <link rel="modulepreload" crossorigin href="./assets/command-gUA-HncX.js">
174
+ <link rel="modulepreload" crossorigin href="./assets/command-Qt3ng7cb.js">
175
175
  <link rel="modulepreload" crossorigin href="./assets/popover-DtnzNVk-.js">
176
- <link rel="modulepreload" crossorigin href="./assets/useRunCells-DLQFWY1L.js">
177
- <link rel="modulepreload" crossorigin href="./assets/mode-BOijHAOc.js">
176
+ <link rel="modulepreload" crossorigin href="./assets/useRunCells-BZ_OFvV4.js">
177
+ <link rel="modulepreload" crossorigin href="./assets/mode-BFwdGSZ7.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/purify.es-N-2faAGj.js">
179
- <link rel="modulepreload" crossorigin href="./assets/RenderHTML-BUhX0rkG.js">
179
+ <link rel="modulepreload" crossorigin href="./assets/RenderHTML-BzGWfPTJ.js">
180
180
  <link rel="modulepreload" crossorigin href="./assets/table--_20dwBZ.js">
181
181
  <link rel="modulepreload" crossorigin href="./assets/tabs-Ctk4D03n.js">
182
182
  <link rel="modulepreload" crossorigin href="./assets/useAsyncData-BJJJOr9W.js">
@@ -186,7 +186,7 @@
186
186
  <link rel="modulepreload" crossorigin href="./assets/en-US-DhMN8sxe.js">
187
187
  <link rel="modulepreload" crossorigin href="./assets/isValid-DhzaK-Y1.js">
188
188
  <link rel="modulepreload" crossorigin href="./assets/dates-CdsE1R40.js">
189
- <link rel="modulepreload" crossorigin href="./assets/download-Dsuja3On.js">
189
+ <link rel="modulepreload" crossorigin href="./assets/download-CITws1-y.js">
190
190
  <link rel="modulepreload" crossorigin href="./assets/maps-s2pQkyf5.js">
191
191
  <link rel="modulepreload" crossorigin href="./assets/extends-B9D0JO9U.js">
192
192
  <link rel="modulepreload" crossorigin href="./assets/emotion-is-prop-valid.esm-lG8j6oqk.js">
@@ -194,47 +194,47 @@
194
194
  <link rel="modulepreload" crossorigin href="./assets/range-sshwVRcP.js">
195
195
  <link rel="modulepreload" crossorigin href="./assets/capitalize-DQeWKRGx.js">
196
196
  <link rel="modulepreload" crossorigin href="./assets/table-BLx7B_us.js">
197
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BCHaEg3R.js">
197
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BLd1jTNA.js">
198
198
  <link rel="modulepreload" crossorigin href="./assets/file-BnFXtaZZ.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/play-BJDBXApx.js">
200
- <link rel="modulepreload" crossorigin href="./assets/chat-components-BMWBGknq.js">
200
+ <link rel="modulepreload" crossorigin href="./assets/chat-components-6dWNbFjV.js">
201
201
  <link rel="modulepreload" crossorigin href="./assets/isEmpty-DIxUV1UR.js">
202
202
  <link rel="modulepreload" crossorigin href="./assets/circle-check-big-OIMTUpe6.js">
203
- <link rel="modulepreload" crossorigin href="./assets/chat-display-CEYX5MXY.js">
204
- <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-ea-cOLAL.js">
203
+ <link rel="modulepreload" crossorigin href="./assets/chat-display-Cfg38gMM.js">
204
+ <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-DZ7evAGU.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/renderShortcut-D0Pei-OA.js">
206
- <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-CFtiNna2.js">
206
+ <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-GHwc6J4l.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/icons-D4lB4En9.js">
208
- <link rel="modulepreload" crossorigin href="./assets/process-output-BAfpcew-.js">
208
+ <link rel="modulepreload" crossorigin href="./assets/process-output-4w8xDO0j.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/blob-Dg_vNTSs.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-CboCOq4o.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/esm-B3JckBtM.js">
212
- <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-CLrEdPGH.js">
212
+ <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-Dx5UA23s.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-D42sFB6d.js">
214
214
  <link rel="modulepreload" crossorigin href="./assets/square-function-DxXFdbn8.js">
215
215
  <link rel="modulepreload" crossorigin href="./assets/spec-qp_XZeSS.js">
216
- <link rel="modulepreload" crossorigin href="./assets/column-preview-MV5ZRt10.js">
217
- <link rel="modulepreload" crossorigin href="./assets/switch-Cd5iA-KH.js">
216
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-9nPwQyJZ.js">
217
+ <link rel="modulepreload" crossorigin href="./assets/switch-C9iBa4rX.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/toggle-G1t0cQyf.js">
219
- <link rel="modulepreload" crossorigin href="./assets/globals-BBskDqJi.js">
219
+ <link rel="modulepreload" crossorigin href="./assets/globals-D3SeIm1j.js">
220
220
  <link rel="modulepreload" crossorigin href="./assets/share-CXQVxivL.js">
221
221
  <link rel="modulepreload" crossorigin href="./assets/memoize-DN0TMY36.js">
222
222
  <link rel="modulepreload" crossorigin href="./assets/get-CyLJYAfP.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/_baseSet-6FYvpjrm.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-BqxQegSf.js">
225
- <link rel="modulepreload" crossorigin href="./assets/utilities.esm-DlnAwGsz.js">
226
- <link rel="modulepreload" crossorigin href="./assets/floating-outline-DYdnwTX9.js">
227
- <link rel="modulepreload" crossorigin href="./assets/useAddCell-FisWjOQO.js">
225
+ <link rel="modulepreload" crossorigin href="./assets/utilities.esm-FYD46c3d.js">
226
+ <link rel="modulepreload" crossorigin href="./assets/floating-outline-p0aHdM2W.js">
227
+ <link rel="modulepreload" crossorigin href="./assets/useAddCell-CVfRv5mq.js">
228
228
  <link rel="modulepreload" crossorigin href="./assets/eye-off-D9zAYqG9.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/plus-CHesBJpY.js">
230
- <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-B8gfuyX1.js">
230
+ <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-DjP4vjBQ.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/file-video-camera-CZUg-nFA.js">
232
- <link rel="modulepreload" crossorigin href="./assets/types-CiMSegk1.js">
232
+ <link rel="modulepreload" crossorigin href="./assets/types-VzFAm7Cv.js">
233
233
  <link rel="modulepreload" crossorigin href="./assets/label-qwandMoh.js">
234
- <link rel="modulepreload" crossorigin href="./assets/textarea-jTWtOsHe.js">
234
+ <link rel="modulepreload" crossorigin href="./assets/textarea-D2hGxqGj.js">
235
235
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DbW1_PHb.js">
236
236
  <link rel="modulepreload" crossorigin href="./assets/trash-2-C-lF7BNB.js">
237
- <link rel="modulepreload" crossorigin href="./assets/form-D8BW7hlS.js">
237
+ <link rel="modulepreload" crossorigin href="./assets/form-DEraWoX5.js">
238
238
  <link rel="modulepreload" crossorigin href="./assets/field-DDKGFzpC.js">
239
239
  <link rel="modulepreload" crossorigin href="./assets/useBoolean-5kuXz69O.js">
240
240
  <link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-gzLRYatP.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.18.5-dev201",
3
+ "version": "0.18.5-dev202",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -8,7 +8,7 @@ import { createReducerAndAtoms } from "@/utils/createReducer";
8
8
  import { jotaiJsonStorage } from "@/utils/storage/jotai";
9
9
  import { ZodLocalStorage } from "@/utils/storage/typed";
10
10
  import type { PanelSection, PanelType } from "./types";
11
- import { isPanelHidden, PANELS } from "./types";
11
+ import { PANELS } from "./types";
12
12
 
13
13
  export interface ChromeState {
14
14
  selectedPanel: PanelType | undefined;
@@ -28,10 +28,10 @@ export interface PanelLayout {
28
28
 
29
29
  const DEFAULT_PANEL_LAYOUT: PanelLayout = {
30
30
  sidebar: PANELS.filter(
31
- (p) => !isPanelHidden(p) && p.defaultSection === "sidebar",
31
+ (p) => !p.hidden && p.defaultSection === "sidebar",
32
32
  ).map((p) => p.type),
33
33
  developerPanel: PANELS.filter(
34
- (p) => !isPanelHidden(p) && p.defaultSection === "developer-panel",
34
+ (p) => !p.hidden && p.defaultSection === "developer-panel",
35
35
  ).map((p) => p.type),
36
36
  };
37
37
 
@@ -18,7 +18,6 @@ import {
18
18
  VariableIcon,
19
19
  XCircleIcon,
20
20
  } from "lucide-react";
21
- import { hasCapability } from "@/core/config/capabilities";
22
21
  import { getFeatureFlag } from "@/core/config/feature-flag";
23
22
  import type { Capabilities } from "@/core/kernel/messages";
24
23
  import { isWasm } from "@/core/wasm/utils";
@@ -188,12 +187,15 @@ export const PANEL_MAP = new Map<PanelType, PanelDescriptor>(
188
187
  * Check if a panel should be hidden based on its `hidden` property
189
188
  * and `requiredCapability`.
190
189
  */
191
- export function isPanelHidden(panel: PanelDescriptor): boolean {
190
+ export function isPanelHidden(
191
+ panel: PanelDescriptor,
192
+ capabilities: Capabilities,
193
+ ): boolean {
192
194
  if (panel.hidden) {
193
195
  return true;
194
196
  }
195
197
  if (panel.requiredCapability) {
196
- if (!hasCapability(panel.requiredCapability)) {
198
+ if (!capabilities[panel.requiredCapability]) {
197
199
  return true;
198
200
  }
199
201
  }
@@ -22,6 +22,7 @@ import { ReorderableList } from "@/components/ui/reorderable-list";
22
22
  import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
23
23
  import { LazyMount } from "@/components/utils/lazy-mount";
24
24
  import { cellErrorCount } from "@/core/cells/cells";
25
+ import { capabilitiesAtom } from "@/core/config/capabilities";
25
26
  import { getFeatureFlag } from "@/core/config/feature-flag";
26
27
  import { cn } from "@/utils/cn";
27
28
  import { ErrorBoundary } from "../../boundary/ErrorBoundary";
@@ -83,14 +84,20 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
83
84
  const { dependencyPanelTab, setDependencyPanelTab } = useDependencyPanelTab();
84
85
  const errorCount = useAtomValue(cellErrorCount);
85
86
  const [panelLayout, setPanelLayout] = useAtom(panelLayoutAtom);
87
+ // Subscribe to capabilities to re-render when they change (e.g., terminal capability)
88
+ const capabilities = useAtomValue(capabilitiesAtom);
86
89
 
87
90
  // Convert current developer panel items to PanelDescriptors
91
+ // Filter out hidden panels (e.g., terminal when capability is not available)
88
92
  const devPanelItems = useMemo(() => {
89
93
  return panelLayout.developerPanel.flatMap((id) => {
90
94
  const panel = PANEL_MAP.get(id);
91
- return panel ? [panel] : [];
95
+ if (!panel || isPanelHidden(panel, capabilities)) {
96
+ return [];
97
+ }
98
+ return [panel];
92
99
  });
93
- }, [panelLayout.developerPanel]);
100
+ }, [panelLayout.developerPanel, capabilities]);
94
101
 
95
102
  const handleSetDevPanelItems = (items: PanelDescriptor[]) => {
96
103
  setPanelLayout((prev) => ({
@@ -127,7 +134,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
127
134
  const availableDevPanels = useMemo(() => {
128
135
  const sidebarIds = new Set(panelLayout.sidebar);
129
136
  return PANELS.filter((p) => {
130
- if (isPanelHidden(p)) {
137
+ if (isPanelHidden(p, capabilities)) {
131
138
  return false;
132
139
  }
133
140
  // Exclude panels that are in the sidebar
@@ -136,7 +143,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
136
143
  }
137
144
  return true;
138
145
  });
139
- }, [panelLayout.sidebar]);
146
+ }, [panelLayout.sidebar, capabilities]);
140
147
 
141
148
  // sync sidebar
142
149
  useEffect(() => {
@@ -11,6 +11,7 @@ import {
11
11
  cellErrorCount,
12
12
  notebookQueuedOrRunningCountAtom,
13
13
  } from "@/core/cells/cells";
14
+ import { capabilitiesAtom } from "@/core/config/capabilities";
14
15
  import { cn } from "@/utils/cn";
15
16
  import { FeedbackButton } from "../components/feedback-button";
16
17
  import { panelLayoutAtom, useChromeActions, useChromeState } from "../state";
@@ -25,6 +26,8 @@ export const Sidebar: React.FC = () => {
25
26
  const { selectedPanel, selectedDeveloperPanelTab } = useChromeState();
26
27
  const { toggleApplication, openApplication } = useChromeActions();
27
28
  const [panelLayout, setPanelLayout] = useAtom(panelLayoutAtom);
29
+ // Subscribe to capabilities to re-render when they change
30
+ const capabilities = useAtomValue(capabilitiesAtom);
28
31
 
29
32
  const renderIcon = ({ Icon }: PanelDescriptor, className?: string) => {
30
33
  return <Icon className={cn("h-5 w-5", className)} />;
@@ -35,7 +38,7 @@ export const Sidebar: React.FC = () => {
35
38
  const availableSidebarPanels = useMemo(() => {
36
39
  const devPanelIds = new Set(panelLayout.developerPanel);
37
40
  return PANELS.filter((p) => {
38
- if (isPanelHidden(p)) {
41
+ if (isPanelHidden(p, capabilities)) {
39
42
  return false;
40
43
  }
41
44
  // Exclude panels that are in the developer panel
@@ -44,15 +47,19 @@ export const Sidebar: React.FC = () => {
44
47
  }
45
48
  return true;
46
49
  });
47
- }, [panelLayout.developerPanel]);
50
+ }, [panelLayout.developerPanel, capabilities]);
48
51
 
49
52
  // Convert current sidebar items to PanelDescriptors
53
+ // Filter out hidden panels (e.g., when capability is not available)
50
54
  const sidebarItems = useMemo(() => {
51
55
  return panelLayout.sidebar.flatMap((id) => {
52
56
  const panel = PANEL_MAP.get(id);
53
- return panel ? [panel] : [];
57
+ if (!panel || isPanelHidden(panel, capabilities)) {
58
+ return [];
59
+ }
60
+ return [panel];
54
61
  });
55
- }, [panelLayout.sidebar]);
62
+ }, [panelLayout.sidebar, capabilities]);
56
63
 
57
64
  const handleSetSidebarItems = (items: PanelDescriptor[]) => {
58
65
  setPanelLayout((prev) => ({