@marimo-team/frontend 0.19.3-dev49 → 0.19.3-dev50

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.
@@ -1 +1 @@
1
- import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as N,l as Ie,p as Te,u as J}from"./useEvent-DlWF5OMa.js";import{t as He}from"./react-BGmjiNul.js";import{Dt as Le,Ft as ie,Pt as qe,Vn as Re,Wn as Ve,Yn as Oe,an as Be,dn as Ue,g as Ye,hr as Fe,m as ne,on as $e,sn as Ge,t as Ke,ti as Q,w as se,zn as Je}from"./cells-BNQUQiDS.js";import{t as W}from"./compiler-runtime-DeeZ7FnK.js";import{i as Qe}from"./useLifecycle-CmDXEyIC.js";import{a as le}from"./type-BdyvjzTI.js";import{n as Xe}from"./add-database-form-CgkV0MRs.js";import{a as re,d as P}from"./hotkeys-uKX61F1_.js";import{v as Ze}from"./utils-pfqq9IdB.js";import{n as _,t as de}from"./constants-Bkp4R3bQ.js";import{A as et,f as tt,j as ce,w as at}from"./config-D6nhy4FA.js";import{t as ot}from"./jsx-runtime-DN_bIXfG.js";import{r as it,t as X}from"./button-B8cGZzP5.js";import{r as D}from"./requests-C0HaHO6a.js";import{t as c}from"./createLucideIcon-CW2xpJ57.js";import{a as he,f as nt,i as pe,m as st,p as me,u as ue}from"./layout-DT91GUei.js";import{t as fe}from"./check-CrAQug3q.js";import{a as lt,c as rt,i as dt,n as ct,r as ht,s as pt,t as mt}from"./select-D9lTzMzP.js";import{i as ye,r as ut,t as be}from"./download-B6EJS7Ar.js";import{f as ft}from"./maps-s2pQkyf5.js";import{r as yt}from"./useCellActionButton-D5Zt1dDz.js";import{t as bt}from"./copy-gBVL4NN-.js";import{d as kt,t as xt}from"./state-BTHUBVxX.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{n as _t,t as At}from"./house-CncUa_LL.js";import{n as St}from"./play-BJDBXApx.js";import{t as Nt}from"./link-54sBkoQp.js";import{r as Pt}from"./input-B80Yt1uu.js";import{t as Dt}from"./settings-MTlHVxz3.js";import{y as Et}from"./textarea-Di1KKcL4.js";import{t as It}from"./square-leQTJTJJ.js";import{t as j}from"./use-toast-Bzf3rpev.js";import{t as Tt}from"./tooltip-CvjcEpZC.js";import{a as ke,i as Ht,r as Lt}from"./mode-Dq8MKjNR.js";import{o as qt}from"./alert-dialog-jcHA5geR.js";import{a as Rt,c as Vt,i as Ot,n as Bt,r as Ut}from"./dialog-CF5DtF1E.js";import{n as Z}from"./ImperativeModal-DVhvP4lH.js";import{r as Yt,t as Ft}from"./share-CXQVxivL.js";import{t as V}from"./copy-DRhpWiOq.js";import{r as $t}from"./useRunCells-CKEmgeKM.js";import{a as Gt}from"./cell-link-Dqj_nfXA.js";import{a as xe}from"./renderShortcut-eU5Hsfml.js";import{t as Kt}from"./icons-D4lB4En9.js";import{t as Jt}from"./links-D529u6GQ.js";import{t as we}from"./types-BLEgJ92v.js";var Qt=c("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Xt=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"}]]),Zt=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"}]]),ea=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"}]]),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),O="https://static.marimo.app";const sa=e=>{let t=(0,We.c)(25),{onClose:i}=e,[o,s]=(0,ee.useState)(""),{exportAsHTML:r}=D(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,n=`${O}/static/${l}`,d;t[0]!==r||t[1]!==i||t[2]!==l?(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(`${O}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:l})}).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]=l,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Vt,{children:"Share static notebook"}),t[4]=p):p=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsxs)(Rt,{children:[p,(0,a.jsxs)(Ut,{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:O,target:"_blank",children:O}),"."]})]}),t[5]=x):x=t[5];let w;t[6]===Symbol.for("react.memo_cache_sentinel")?(w=v=>{s(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)(Pt,{"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)(la,{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 b;t[16]===n?b=t[17]:(b=(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]=b);let k;t[18]!==y||t[19]!==b?(k=(0,a.jsxs)(Ot,{children:[y,b]}),t[18]=y,t[19]=b,t[20]=k):k=t[20];let g;return t[21]!==d||t[22]!==k||t[23]!==f?(g=(0,a.jsx)(Bt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[x,f,k]})}),t[21]=d,t[22]=k,t[23]=f,t[24]=g):g=t[24],g};var la=e=>{let t=(0,We.c)(8),[i,o]=ee.useState(!1),s;t[0]===e.text?s=t[1]:(s=it.stopPropagation(async p=>{p.preventDefault(),await V(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),t[2]=l):l=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:l}),t[3]=r,t[4]=n);let d;return t[5]!==i||t[6]!==n?(d=(0,a.jsx)(Tt,{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){P.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:Q.parse(o.id)}}}return P.warn("No visible output area found for scroll anchor"),null}function ca(e){if(!e){P.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(Q.create(e.cellId));if(!t){P.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${de.outputArea}`)){P.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(ke),i;return e[0]===t?i=e[1]:(i=()=>{let o=da();t(s=>({mode:Ht(s.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()&&!Ue("wasm_layouts"))return null;let o;e[0]===i?o=e[1]:(o=n=>i(n),e[0]=i,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(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]=s):s=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)(lt,{children:"View as"}),we.map(ua)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(mt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};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),It}}function Ne(e){return le(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:s}=D(),r;return t[0]!==o||t[1]!==i||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=qe.guessDeliminator(e);i({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ie.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{let d=l.join(ie.dirname(e),n);s({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]=s,t[3]=e,t[4]=r):r=t[4],r}const ba=()=>{let{updateCellConfig:e}=se(),{saveCellConfig:t}=D();return(0,ee.useCallback)(async()=>{let i=new Le,o=ne(),s=o.cellIds.inOrderIds,r={};for(let n of s){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 l=re.entries(r);if(l.length!==0){await t({configs:r});for(let[n,d]of l)e({cellId:n,config:d})}},[e])};var ka=W();function Pe(){let e=(0,ka.c)(4),{openConfirm:t}=Z(),i=N(at),{sendRestart:o}=D(),s;return e[0]!==t||e[1]!==o||e[2]!==i?(s=()=>{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)(qt,{onClick:async()=>{i({state:et.CLOSING}),await o(),Yt()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=i,e[3]=s):s=e[3],s}var xa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function wa(){var te,ae;let e=(0,xa.c)(36),t=Gt(),{openModal:i,closeModal:o}=Z(),{toggleApplication:s}=Be(),{selectedPanel:r}=$e(),[l]=Ie(ke),n=J(Lt),d=ba(),[p]=Ze(),{updateCellConfig:x,undoDeleteCell:w,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=se(),b=Pe(),k=$t(),g=ya(t),v=N(Ae),A=N(xt),z=N(kt),{exportAsMarkdown:B,readCode:S,saveCellConfig:U}=D(),Y=J(Ye),F=J(Ke),{selectedLayout:$}=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,De=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]!==F||e[6]!==m||e[7]!==o||e[8]!==f||e[9]!==g||e[10]!==y||e[11]!==B||e[12]!==t||e[13]!==Y||e[14]!==d||e[15]!==n||e[16]!==i||e[17]!==S||e[18]!==b||e[19]!==k||e[20]!==U||e[21]!==$||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]!==s||e[31]!==I||e[32]!==w||e[33]!==x||e[34]!==l.mode?(R=[{icon:L,label:"Download",handle:E,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)(Kt,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let h=await B({download:!1});be(new Blob([h],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let h=await S();be(new Blob([h.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.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:l.mode!=="present",tooltip:l.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:E,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)(sa,{onClose:o}))}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!H,handle:async()=>{await V(Ft({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:E,dropdown:Ge.flatMap(h=>{let{type:C,Icon:K,hidden:Ee}=h;return Ee?[]:{label:le(C),rightElement:De(r===C),icon:(0,a.jsx)(K,{size:14,strokeWidth:1.5}),handle:()=>s(C)}})},{icon:(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Et,{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 K=Se(h);return{divider:C===0,label:Ne(h),icon:(0,a.jsx)(K,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:$===h&&(0,a.jsx)(fe,{size:14})}),handle:()=>{G(h),l.mode==="edit"&&I()}}})]},{icon:(0,a.jsx)(ea,{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(ne());await U({configs:re.fromEntries(h.map(Ea))});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)(Re,{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:!F||n,handle:()=>{w()}},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(Ve,{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)(Xt,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(Qt,{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(Da)},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Pa)},{icon:(0,a.jsx)(Dt,{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:E,dropdown:[{icon:(0,a.jsx)(Oe,{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)(Je,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ma}]},{divider:!0,icon:(0,a.jsx)(At,{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]=F,e[6]=m,e[7]=o,e[8]=f,e[9]=g,e[10]=y,e[11]=B,e[12]=t,e[13]=Y,e[14]=d,e[15]=n,e[16]=i,e[17]=S,e[18]=b,e[19]=k,e[20]=U,e[21]=$,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]=s,e[31]=I,e[32]=w,e[33]=x,e[34]=l.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=tt();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 Pa(e){return!e}function Da(e){return!e}function Ea(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,Pe 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 J}from"./useEvent-DlWF5OMa.js";import{t as He}from"./react-BGmjiNul.js";import{Dt as Le,Ft as ie,Pt as qe,Vn as Re,Wn as Ve,Yn as Oe,an as Be,dn as Ue,g as Ye,hr as Fe,m as ne,on as $e,sn as Ge,t as Ke,ti as Q,w as se,zn as Je}from"./cells-BNQUQiDS.js";import{t as W}from"./compiler-runtime-DeeZ7FnK.js";import{i as Qe}from"./useLifecycle-CmDXEyIC.js";import{a as le}from"./type-BdyvjzTI.js";import{n as Xe}from"./add-database-form-CgkV0MRs.js";import{a as re,d as P}from"./hotkeys-uKX61F1_.js";import{v as Ze}from"./utils-pfqq9IdB.js";import{n as _,t as de}from"./constants-Bkp4R3bQ.js";import{A as et,f as tt,j as ce,w as at}from"./config-D6nhy4FA.js";import{t as ot}from"./jsx-runtime-DN_bIXfG.js";import{r as it,t as X}from"./button-B8cGZzP5.js";import{r as D}from"./requests-C0HaHO6a.js";import{t as c}from"./createLucideIcon-CW2xpJ57.js";import{a as he,f as nt,i as pe,m as st,p as me,u as ue}from"./layout-DT91GUei.js";import{t as fe}from"./check-CrAQug3q.js";import{a as lt,c as rt,i as dt,n as ct,r as ht,s as pt,t as mt}from"./select-D9lTzMzP.js";import{i as ye,r as ut,t as be}from"./download-B6EJS7Ar.js";import{f as ft}from"./maps-s2pQkyf5.js";import{r as yt}from"./useCellActionButton-D5Zt1dDz.js";import{t as bt}from"./copy-gBVL4NN-.js";import{d as kt,t as xt}from"./state-JzO-Ni5T.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{n as _t,t as At}from"./house-CncUa_LL.js";import{n as St}from"./play-BJDBXApx.js";import{t as Nt}from"./link-54sBkoQp.js";import{r as Pt}from"./input-B80Yt1uu.js";import{t as Dt}from"./settings-MTlHVxz3.js";import{y as Et}from"./textarea-Di1KKcL4.js";import{t as It}from"./square-leQTJTJJ.js";import{t as j}from"./use-toast-Bzf3rpev.js";import{t as Tt}from"./tooltip-CvjcEpZC.js";import{a as ke,i as Ht,r as Lt}from"./mode-Dq8MKjNR.js";import{o as qt}from"./alert-dialog-jcHA5geR.js";import{a as Rt,c as Vt,i as Ot,n as Bt,r as Ut}from"./dialog-CF5DtF1E.js";import{n as Z}from"./ImperativeModal-DVhvP4lH.js";import{r as Yt,t as Ft}from"./share-CXQVxivL.js";import{t as V}from"./copy-DRhpWiOq.js";import{r as $t}from"./useRunCells-CKEmgeKM.js";import{a as Gt}from"./cell-link-Dqj_nfXA.js";import{a as xe}from"./renderShortcut-eU5Hsfml.js";import{t as Kt}from"./icons-D4lB4En9.js";import{t as Jt}from"./links-D529u6GQ.js";import{t as we}from"./types-BLEgJ92v.js";var Qt=c("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Xt=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"}]]),Zt=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"}]]),ea=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"}]]),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),O="https://static.marimo.app";const sa=e=>{let t=(0,We.c)(25),{onClose:i}=e,[o,s]=(0,ee.useState)(""),{exportAsHTML:r}=D(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,n=`${O}/static/${l}`,d;t[0]!==r||t[1]!==i||t[2]!==l?(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(`${O}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:l})}).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]=l,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Vt,{children:"Share static notebook"}),t[4]=p):p=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsxs)(Rt,{children:[p,(0,a.jsxs)(Ut,{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:O,target:"_blank",children:O}),"."]})]}),t[5]=x):x=t[5];let w;t[6]===Symbol.for("react.memo_cache_sentinel")?(w=v=>{s(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)(Pt,{"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)(la,{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 b;t[16]===n?b=t[17]:(b=(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]=b);let k;t[18]!==y||t[19]!==b?(k=(0,a.jsxs)(Ot,{children:[y,b]}),t[18]=y,t[19]=b,t[20]=k):k=t[20];let g;return t[21]!==d||t[22]!==k||t[23]!==f?(g=(0,a.jsx)(Bt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[x,f,k]})}),t[21]=d,t[22]=k,t[23]=f,t[24]=g):g=t[24],g};var la=e=>{let t=(0,We.c)(8),[i,o]=ee.useState(!1),s;t[0]===e.text?s=t[1]:(s=it.stopPropagation(async p=>{p.preventDefault(),await V(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(bt,{size:14,strokeWidth:1.5}),t[2]=l):l=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:l}),t[3]=r,t[4]=n);let d;return t[5]!==i||t[6]!==n?(d=(0,a.jsx)(Tt,{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){P.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:Q.parse(o.id)}}}return P.warn("No visible output area found for scroll anchor"),null}function ca(e){if(!e){P.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(Q.create(e.cellId));if(!t){P.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${de.outputArea}`)){P.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(ke),i;return e[0]===t?i=e[1]:(i=()=>{let o=da();t(s=>({mode:Ht(s.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()&&!Ue("wasm_layouts"))return null;let o;e[0]===i?o=e[1]:(o=n=>i(n),e[0]=i,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(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]=s):s=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)(lt,{children:"View as"}),we.map(ua)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(mt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};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),It}}function Ne(e){return le(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:s}=D(),r;return t[0]!==o||t[1]!==i||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=qe.guessDeliminator(e);i({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ie.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{let d=l.join(ie.dirname(e),n);s({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]=s,t[3]=e,t[4]=r):r=t[4],r}const ba=()=>{let{updateCellConfig:e}=se(),{saveCellConfig:t}=D();return(0,ee.useCallback)(async()=>{let i=new Le,o=ne(),s=o.cellIds.inOrderIds,r={};for(let n of s){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 l=re.entries(r);if(l.length!==0){await t({configs:r});for(let[n,d]of l)e({cellId:n,config:d})}},[e])};var ka=W();function Pe(){let e=(0,ka.c)(4),{openConfirm:t}=Z(),i=N(at),{sendRestart:o}=D(),s;return e[0]!==t||e[1]!==o||e[2]!==i?(s=()=>{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)(qt,{onClick:async()=>{i({state:et.CLOSING}),await o(),Yt()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=i,e[3]=s):s=e[3],s}var xa=W(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function wa(){var te,ae;let e=(0,xa.c)(36),t=Gt(),{openModal:i,closeModal:o}=Z(),{toggleApplication:s}=Be(),{selectedPanel:r}=$e(),[l]=Ie(ke),n=J(Lt),d=ba(),[p]=Ze(),{updateCellConfig:x,undoDeleteCell:w,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=se(),b=Pe(),k=$t(),g=ya(t),v=N(Ae),A=N(xt),z=N(kt),{exportAsMarkdown:B,readCode:S,saveCellConfig:U}=D(),Y=J(Ye),F=J(Ke),{selectedLayout:$}=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,De=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]!==F||e[6]!==m||e[7]!==o||e[8]!==f||e[9]!==g||e[10]!==y||e[11]!==B||e[12]!==t||e[13]!==Y||e[14]!==d||e[15]!==n||e[16]!==i||e[17]!==S||e[18]!==b||e[19]!==k||e[20]!==U||e[21]!==$||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]!==s||e[31]!==I||e[32]!==w||e[33]!==x||e[34]!==l.mode?(R=[{icon:L,label:"Download",handle:E,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)(Kt,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let h=await B({download:!1});be(new Blob([h],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let h=await S();be(new Blob([h.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.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:l.mode!=="present",tooltip:l.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:E,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)(sa,{onClose:o}))}},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!H,handle:async()=>{await V(Ft({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:E,dropdown:Ge.flatMap(h=>{let{type:C,Icon:K,hidden:Ee}=h;return Ee?[]:{label:le(C),rightElement:De(r===C),icon:(0,a.jsx)(K,{size:14,strokeWidth:1.5}),handle:()=>s(C)}})},{icon:(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Et,{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 K=Se(h);return{divider:C===0,label:Ne(h),icon:(0,a.jsx)(K,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:$===h&&(0,a.jsx)(fe,{size:14})}),handle:()=>{G(h),l.mode==="edit"&&I()}}})]},{icon:(0,a.jsx)(ea,{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(ne());await U({configs:re.fromEntries(h.map(Ea))});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)(Re,{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:!F||n,handle:()=>{w()}},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(Zt,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(Ve,{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)(Xt,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(Qt,{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(Da)},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(Pa)},{icon:(0,a.jsx)(Dt,{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:E,dropdown:[{icon:(0,a.jsx)(Oe,{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)(Je,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ma}]},{divider:!0,icon:(0,a.jsx)(At,{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]=F,e[6]=m,e[7]=o,e[8]=f,e[9]=g,e[10]=y,e[11]=B,e[12]=t,e[13]=Y,e[14]=d,e[15]=n,e[16]=i,e[17]=S,e[18]=b,e[19]=k,e[20]=U,e[21]=$,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]=s,e[31]=I,e[32]=w,e[33]=x,e[34]=l.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=tt();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 Pa(e){return!e}function Da(e){return!e}function Ea(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,Pe as n,Me as o,pa as r,Ce as s,wa as t,ge as u};
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-CNxk2zVN.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-CBMqMxiq.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">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.19.3-dev49",
3
+ "version": "0.19.3-dev50",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1399,7 +1399,9 @@ export const AiModelDisplayConfig: React.FC<AiConfigProps> = ({
1399
1399
  ? currentDisplayedModels.filter((id) => id !== modelId)
1400
1400
  : [...currentDisplayedModels, modelId];
1401
1401
 
1402
- form.setValue("ai.models.displayed_models", newModels);
1402
+ form.setValue("ai.models.displayed_models", newModels, {
1403
+ shouldDirty: true,
1404
+ });
1403
1405
  onSubmit(form.getValues());
1404
1406
  });
1405
1407
 
@@ -1416,14 +1418,18 @@ export const AiModelDisplayConfig: React.FC<AiConfigProps> = ({
1416
1418
  ? [...new Set([...currentDisplayedModels, ...qualifiedModelIds])]
1417
1419
  : currentDisplayedModels.filter((id) => !qualifiedModelIds.has(id));
1418
1420
 
1419
- form.setValue("ai.models.displayed_models", newModels);
1421
+ form.setValue("ai.models.displayed_models", newModels, {
1422
+ shouldDirty: true,
1423
+ });
1420
1424
  onSubmit(form.getValues());
1421
1425
  },
1422
1426
  );
1423
1427
 
1424
1428
  const deleteModel = useEvent((modelId: QualifiedModelId) => {
1425
1429
  const newModels = customModels.filter((id) => id !== modelId);
1426
- form.setValue("ai.models.custom_models", newModels);
1430
+ form.setValue("ai.models.custom_models", newModels, {
1431
+ shouldDirty: true,
1432
+ });
1427
1433
  onSubmit(form.getValues());
1428
1434
  });
1429
1435
 
@@ -1500,7 +1506,9 @@ export const AddModelForm: React.FC<{
1500
1506
  modelName as ShortModelId,
1501
1507
  );
1502
1508
 
1503
- form.setValue("ai.models.custom_models", [newModel.id, ...customModels]);
1509
+ form.setValue("ai.models.custom_models", [newModel.id, ...customModels], {
1510
+ shouldDirty: true,
1511
+ });
1504
1512
  onSubmit(form.getValues());
1505
1513
  resetForm();
1506
1514