@marimo-team/frontend 0.23.17-dev5 → 0.23.17-dev7
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.
- package/dist/assets/{command-palette-BBlSC8AZ.js → command-palette-Gv6eCNJQ.js} +1 -1
- package/dist/assets/{edit-page-B0EhuiM-.js → edit-page-D3D1nnC5.js} +3 -3
- package/dist/assets/{index-BXlfeAku.js → index-BTVjfrRP.js} +2 -2
- package/dist/assets/useNotebookActions-D0VcNpNG.js +12 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/editor/actions/export-dialog/export-dialog.tsx +27 -23
- package/src/components/editor/actions/export-dialog/use-export-dialog.ts +4 -2
- package/dist/assets/useNotebookActions-BHaEvPEM.js +0 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{s as Ke}from"./chunk-LvLJmgfZ.js";import{d as re,i as ua,l as _e,p as ma,u as Q}from"./useEvent-D91BmmQi.js";import{t as pa}from"./react-Bj1aDYRI.js";import{$n as ha,Bn as fa,Br as ba,E as Je,Fr as Ye,Gn as Xe,Gr as xa,Hn as ya,In as ka,Ir as Qe,Jt as va,Lr as ga,Nt as Ze,Qi as wa,T as ja,Vn as Ca,Vr as et,Wn as Na,g as Sa,m as tt,na as at,qi as za,t as Ma,ua as Fe,y as Oa,yi as _a}from"./cells-DLYs3NiJ.js";import{P as st,T as pe,b as ge}from"./zod-H_cgTO0M.js";import{t as T}from"./compiler-runtime-B3qBwwSJ.js";import{n as Fa,r as Ia,x as La}from"./ai-model-dropdown-CLCa-gsg.js";import{g as de,n as Pa}from"./useEventListener-C0195JsF.js";import{t as nt}from"./objects-BlG0ZrO0.js";import{C as Wa,r as Aa}from"./utils-BWBBpCkT.js";import{n as K,t as ot}from"./constants-CDyU_g2F.js";import{A as Ea,M as we,N as he,O as Da,T as rt,k as qa,v as it}from"./config-DAL-jiRM.js";import{t as Ta}from"./switch-CONP-vq2.js";import{c as Ra}from"./readonly-python-code-DUjqXwhi.js";import{t as fe}from"./cn-DYvqRARy.js";import{t as $a}from"./jsx-runtime-Blw4afVn.js";import{o as Ha}from"./alert-dialog-Bb8Lz8ko.js";import{a as Ba,c as Va,o as Ua,s as Ga}from"./popover-Bcz1Zikb.js";import{a as Ka,c as lt,i as dt,n as ct,r as Ja,s as ut,t as mt}from"./select-BP75_5jJ.js";import{$ as Ya,Lt as pt}from"./JsonOutput-Bk2exFh0.js";import{a as Xa,c as Qa,d as ce,o as Za,t as es}from"./download-DenADH0w.js";import{n as ts,t as as}from"./radio-group-BGXYy3u5.js";import{t as ss}from"./tooltip-4bZlU7jl.js";import{n as ns,r as os,t as ie}from"./button-DDGiD1NW.js";import{i as rs,r as ht,t as Ie}from"./strings--BknHX9C.js";import{r as ne}from"./requests-9-v2bhoi.js";import{t as A}from"./createLucideIcon-w-Qo9n0R.js";import{F as is,I as ls,L as ft,P as bt,a as xt,i as yt,u as ds}from"./layout-yfmf2ZBx.js";import{t as kt}from"./check-rzLRd0j9.js";import{r as cs}from"./useCellActionButton-uxVyv3JK.js";import{t as Le}from"./code-B2aKtXoe.js";import{t as us}from"./copy-3iHFdt22.js";import{t as vt}from"./eye-off-BOZA7gbn.js";import{t as gt}from"./external-link-BOlXZUla.js";import{t as be}from"./file-CJH9JNGH.js";import{t as wt}from"./globe-Dwo3iXzC.js";import{n as ms,r as ps,t as hs}from"./youtube-OwaksuQt.js";import{n as fs}from"./components-K_Mi0vdC.js";import{t as bs}from"./house-DS0r7dNZ.js";import{t as jt}from"./image-5XI2VU-q.js";import{t as xs}from"./link-CHdiBDr5.js";import{t as Pe}from"./spinner-D-V4psAa.js";import{r as ys}from"./input-JxFwu-3G.js";import{t as ks}from"./settings-D_PiwXwo.js";import{t as vs}from"./sparkles-DUCpRFlS.js";import{g as gs}from"./form-BsW7zr4t.js";import{t as ws}from"./square-DFICx2Qv.js";import{t as Ct}from"./triangle-alert-BL4YVsPy.js";import{t as le}from"./use-toast-BwJoaaDM.js";import{n as We,t as js}from"./paths-BKO-pHK6.js";import{o as Cs}from"./session-BmukRjSi.js";import{n as je}from"./copy-Bxb1_Gtw.js";import{t as Ae}from"./copy-icon-neDQUo4Q.js";import{r as Ns}from"./useRunCells-kmbsc2R5.js";import{a as Ee,c as De,i as Ss,n as qe,r as Te}from"./dialog-BCVepWLJ.js";import{n as Ce}from"./ImperativeModal-fY-ZfT0b.js";import{r as zs,t as Nt}from"./share-852X_cqy.js";import{n as St,t as zt}from"./alert-jlwhGxSb.js";import{a as Mt}from"./cell-link-D0aELsL_.js";import{n as Re}from"./useAsyncData-Bg5iAViP.js";import{t as Ms}from"./icons-CIPE8AIY.js";import{i as Os,n as Ot}from"./error-entries-4XYBryls.js";import{n as _t,t as _s}from"./pair-with-agent-modal-C5OhJ8rX.js";import{n as Ft}from"./add-connection-dialog-BZaJAQCM.js";import{t as Fs}from"./github-A_zUd4Uj.js";import{n as It}from"./marimo-icons-yD_pAOm9.js";import{t as Is}from"./links-ClNQSIal.js";import{i as Ls,n as Ps,t as $e}from"./skeleton-CPuDx7yn.js";import{t as Lt}from"./types-Bn-E0Dh-.js";var Ws=A("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),As=A("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Pt=A("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"}]]),Wt=A("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"}]]),At=A("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"}]]),Es=A("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"}]]),Ds=A("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"}]]),qs=A("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"}]]),Et=A("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Dt=A("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ts=A("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),qt=A("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"}]]),Rs=A("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"}]]),$s=A("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"}]]),Tt=A("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"}]]),Hs=T(),E=Ke(pa(),1);function He(t,e){let s=(0,Hs.c)(11),n;s[0]===e?n=s[1]:(n=new za(e),s[0]=e,s[1]=n);let r=n,i;s[2]!==t||s[3]!==r?(i=()=>r.get(t),s[2]=t,s[3]=r,s[4]=i):i=s[4];let[o,l]=(0,E.useState)(i),d;s[5]!==t||s[6]!==r?(d=m=>{l(m),r.set(t,m)},s[5]=t,s[6]=r,s[7]=d):d=s[7];let c=d,u;return s[8]!==c||s[9]!==o?(u=[o,c],s[8]=c,s[9]=o,s[10]=u):u=s[10],u}function Bs(t,e){return{...t,Binaries:{...t.Binaries,Browser:e}}}function Vs(t,e,s,n){return{marimo:t,Locale:s||void 0,Binaries:{Browser:e},"Environment Collection Error":n}}function Be(t,e){let s=Math.max(2,...Array.from(e.matchAll(/`+/g),r=>r[0].length)),n="`".repeat(s+1);return`${n}${t}
|
|
2
|
+
${e}
|
|
3
|
+
${n}`}function Us(t,e){let s=t.includes("?")?"&":"?",n=[],r=t,i=0;for(let[o,l]of Object.entries(e)){if(l.length===0)continue;let d=`${o}=${encodeURIComponent(l)}`,c=`${r}${i===0?s:"&"}${d}`;if(c.length>6e3){n.push(o);continue}r=c,i+=1}return{url:r,omitted:n}}function Ve(t,e){return["<details>",`<summary>${Ie.htmlEscape(t)??""}</summary>`,"",e,"","</details>"].join(`
|
|
4
|
+
`)}function Gs(t){return Ve("Environment",Be("json",JSON.stringify(t,null,2)))}function Rt(t){return Ve("Errors",Be("text",t.map(Ot).join(`
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`)))}function Ks(t){return Ve("Code",Be("python",t))}var $t=T(),a=Ke($a(),1),Js=Pa,Ht=t=>{let e=(0,$t.c)(16),{content:s}=t,[n,r]=(0,E.useState)(!1),i=!n&&"max-h-24 overflow-hidden",o;e[0]===i?o=e[1]:(o=fe("text-xs bg-muted rounded p-2 overflow-x-auto whitespace-pre-wrap",i),e[0]=i,e[1]=o);let l;e[2]!==s||e[3]!==o?(l=(0,a.jsx)("pre",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let d;e[5]===n?d=e[6]:(d=!n&&(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-10 rounded-b bg-gradient-to-b from-transparent to-muted"}),e[5]=n,e[6]=d);let c;e[7]!==l||e[8]!==d?(c=(0,a.jsxs)("div",{className:"relative",children:[l,d]}),e[7]=l,e[8]=d,e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=()=>r(Xs),e[10]=u):u=e[10];let m=n?"Show less":"Show more",h;e[11]===m?h=e[12]:(h=(0,a.jsx)(ie,{type:"button",variant:"link",size:"xs",className:"self-start",onClick:u,children:m}),e[11]=m,e[12]=h);let x;return e[13]!==c||e[14]!==h?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[c,h]}),e[13]=c,e[14]=h,e[15]=x):x=e[15],x};const Ys=t=>{let e=(0,$t.c)(6),{children:s}=t,{openModal:n,closeModal:r}=Ce(),i;e[0]!==r||e[1]!==n?(i=()=>n((0,a.jsx)(Bt,{onClose:r})),e[0]=r,e[1]=n,e[2]=i):i=e[2];let o;return e[3]!==s||e[4]!==i?(o=(0,a.jsx)(Js,{onClick:i,children:s}),e[3]=s,e[4]=i,e[5]=o):o=e[5],o},Bt=()=>{let{getEnvironmentInfo:t,readCode:e}=ne(),s=Re(async()=>t(),[t]),n=Q(Oa),r=(0,E.useMemo)(()=>Os(ua),[n]),i=ds(n.cellIds.inOrderIds.map(y=>n.cellData[y])),o=Q(wa),l=Q(it),d=o!==null&&i&&l.state===rt.OPEN,c=d?void 0:o===null?"Save the notebook first.":i?"Connect the notebook to include its source.":"Notebook source is hidden in this view.",[u,m]=He("marimo:issue-report:include-errors",!1),[h,x]=He("marimo:issue-report:include-code",!1),p=s.data?Bs(s.data,navigator.userAgent):s.status==="error"?Vs(Ra(),navigator.userAgent,navigator.language,"Server environment information unavailable"):void 0,f=Re(async()=>{if(!h||!d)return;let{contents:y}=await e();return y},[h,d,e]),{url:v,omitted:b}=(0,E.useMemo)(()=>{if(!p)return{url:K.bugReportUrl,omitted:[]};let y={env:Gs(p)};return u&&r.length>0&&(y["bug-description"]=Rt(r)),h&&f.data&&(y["reproduction-code"]=Ks(f.data)),Us(K.bugReportUrl,y)},[p,r,u,h,f.data]),g=b.map(y=>y==="bug-description"?"errors":y==="reproduction-code"?"code":y).join(", ");return(0,a.jsxs)(qe,{className:"w-[540px] max-w-[90vw]",children:[(0,a.jsxs)(Ee,{children:[(0,a.jsx)(De,{children:"Report an issue"}),(0,a.jsx)(Te,{children:"Open a GitHub bug report prefilled with your environment, and optionally your current errors and notebook code. Nothing is uploaded automatically; review the details before posting."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4 max-h-[60vh] overflow-y-auto",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(ie,{type:"button",variant:"default",size:"xs",asChild:!0,className:"self-start",children:(0,a.jsxs)("a",{href:v,target:"_blank",rel:"noreferrer",children:[(0,a.jsx)(gt,{className:"w-4 h-4 mr-2"}),"Open GitHub issue"]})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(Ze,{id:"issue-include-errors",checked:u,disabled:r.length===0,onCheckedChange:y=>m(y===!0),"aria-label":"Include errors"}),(0,a.jsx)("label",{htmlFor:"issue-include-errors",children:"Include errors"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(Ze,{id:"issue-include-code",checked:h,disabled:!d,onCheckedChange:y=>x(y===!0),"aria-label":"Include notebook code"}),(0,a.jsx)("label",{htmlFor:"issue-include-code",children:"Include notebook code"})]}),c&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground ml-6",children:c}),h&&f.status==="error"&&(0,a.jsx)("span",{className:"text-xs text-(--red-11) ml-6",children:"Notebook source could not be loaded."})]})]}),g?(0,a.jsxs)("div",{className:"flex items-start gap-2 text-xs text-(--yellow-11)",children:[(0,a.jsx)(Ct,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),(0,a.jsxs)("span",{children:["Too large to prefill and left out of the link: ",g,". Paste them into the issue manually."]})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your environment is always included."})]}),s.status==="pending"&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading environment details\u2026"}),(0,a.jsx)($e,{className:"h-4 w-full"}),(0,a.jsx)($e,{className:"h-4 w-3/4"}),(0,a.jsx)($e,{className:"h-4 w-1/2"})]}),s.status==="error"&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(Ct,{className:"w-4 h-4 text-(--yellow-11) shrink-0"}),(0,a.jsx)("span",{children:"Server environment information unavailable"}),(0,a.jsx)(ie,{type:"button",variant:"link",size:"xs",onClick:()=>s.refetch(),children:"Retry"})]}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Environment details"}),(0,a.jsx)(Ae,{className:"w-3.5 h-3.5",value:JSON.stringify(p,null,2),ariaLabel:"Copy environment JSON",toastTitle:"Environment details copied"})]}),(0,a.jsx)(Ht,{content:JSON.stringify(p,null,2)})]}),p&&r.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Errors"}),(0,a.jsx)(Ae,{className:"w-3.5 h-3.5",value:Rt(r),ariaLabel:"Copy errors",toastTitle:"Errors copied"})]}),(0,a.jsx)(Ht,{content:r.map(Ot).join(`
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
`)})]}),p&&r.length===0&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"No errors detected."}),(0,a.jsx)("div",{className:"border-t pt-3",children:(0,a.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Other feedback? Take our"," ",(0,a.jsx)("a",{href:K.feedbackForm,target:"_blank",rel:"noreferrer",className:"underline",children:"two-minute survey"})," ","or chat with us on"," ",(0,a.jsx)("a",{href:K.discordLink,target:"_blank",rel:"noreferrer",className:"underline",children:"Discord"}),"."]})})]})]})};function Xs(t){return!t}var Vt=T(),Ne="https://static.marimo.app";const Qs=t=>{let e=(0,Vt.c)(25),{onClose:s}=t,[n,r]=(0,E.useState)(""),{exportAsHTML:i}=ne(),o=`${n}-${Math.random().toString(36).slice(2,6)}`,l=`${Ne}/static/${o}`,d;e[0]!==i||e[1]!==s||e[2]!==o?(d=async y=>{y.preventDefault(),s();let{contents:w}=await i({download:!1,includeCode:!0,files:bt.INSTANCE.filenames()}),k=le({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Ne}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:o})}).catch(()=>{k.dismiss(),le({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:K.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),k.dismiss(),le({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."]})})},e[0]=i,e[1]=s,e[2]=o,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(De,{children:"Share static notebook"}),e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(Ee,{children:[c,(0,a.jsxs)(Te,{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:Ne,target:"_blank",children:Ne}),"."]})]}),e[5]=u):u=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=y=>{r(y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=m):m=e[6];let h;e[7]===n?h=e[8]:(h=(0,a.jsx)(ys,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:n,placeholder:"Notebook slug",onChange:m,required:!0,autoComplete:"off"}),e[7]=n,e[8]=h);let x;e[9]===l?x=e[10]:(x=(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)(Zs,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=x);let p;e[11]!==h||e[12]!==x?(p=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,x]}),e[11]=h,e[12]=x,e[13]=p):p=e[13];let f;e[14]===s?f=e[15]:(f=(0,a.jsx)(ie,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:s,children:"Cancel"}),e[14]=s,e[15]=f);let v;e[16]===l?v=e[17]:(v=(0,a.jsx)(ie,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await je(l)},children:"Create"}),e[16]=l,e[17]=v);let b;e[18]!==f||e[19]!==v?(b=(0,a.jsxs)(Ss,{children:[f,v]}),e[18]=f,e[19]=v,e[20]=b):b=e[20];let g;return e[21]!==d||e[22]!==b||e[23]!==p?(g=(0,a.jsx)(qe,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[u,p,b]})}),e[21]=d,e[22]=b,e[23]=p,e[24]=g):g=e[24],g};var Zs=t=>{let e=(0,Vt.c)(8),[s,n]=E.useState(!1),r;e[0]===t.text?r=e[1]:(r=os.stopPropagation(async c=>{c.preventDefault(),await je(t.text),n(!0),setTimeout(()=>n(!1),2e3)}),e[0]=t.text,e[1]=r);let i=r,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)(us,{size:14,strokeWidth:1.5}),e[2]=o):o=e[2];let l;e[3]===i?l=e[4]:(l=(0,a.jsx)(ie,{"data-testid":"copy-static-notebook-url-button",onClick:i,size:"xs",variant:"secondary",children:o}),e[3]=i,e[4]=l);let d;return e[5]!==s||e[6]!==l?(d=(0,a.jsx)(ss,{content:"Copied!",open:s,children:l}),e[5]=s,e[6]=l,e[7]=d):d=e[7],d},en=T();function tn(){let t=document.getElementsByClassName(ot.outputArea);for(let e of t){let s=e.getBoundingClientRect();if(s.bottom>0&&s.top<window.innerHeight){let n=Fe.findElement(e);if(!n){de.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:Fe.parse(n.id)}}}return de.warn("No visible output area found for scroll anchor"),null}function an(t){if(!t){de.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(Fe.create(t.cellId));if(!e){de.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${ot.outputArea}`)){de.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function Ut(){let t=(0,en.c)(2),e=re(we),s;return t[0]===e?s=t[1]:(s=()=>{let n=tn();e(r=>({mode:Ea(r.mode),cellAnchor:(n==null?void 0:n.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{an(n)})})},t[0]=e,t[1]=s),s}const Gt=ma(!1);var sn=T();const nn=()=>{let t=(0,sn.c)(7),{selectedLayout:e}=xt(),{setLayoutView:s}=yt();if(he()&&!ha("wasm_layouts"))return null;let n;t[0]===s?n=t[1]:(n=l=>s(l),t[0]=s,t[1]=n);let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(ut,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(lt,{placeholder:"Select a view"})}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(ct,{children:(0,a.jsxs)(Ja,{children:[(0,a.jsx)(Ka,{children:"View as"}),Lt.map(rn)]})}),t[3]=i):i=t[3];let o;return t[4]!==e||t[5]!==n?(o=(0,a.jsxs)(mt,{"data-testid":"layout-select",value:e,onValueChange:n,children:[r,i]}),t[4]=e,t[5]=n,t[6]=o):o=t[6],o};function on(t){return(0,a.jsx)(Kt(t),{className:"h-4 w-4"})}function Kt(t){switch(t){case"vertical":return qs;case"grid":return ps;case"slides":return qt;default:return rs(t),ws}}function Jt(t){return Ie.startCase(t)}function rn(t){return(0,a.jsx)(dt,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[on(t),(0,a.jsx)("span",{children:Jt(t)})]})},t)}const Yt=["html","markdown","ipynb","pdf","script","png"],Xt=["pymdown","qmd","mystmd","mdx"],Qt=["topological","top-down"],Zt=["document","slides"],ea=["source","flat"];function ta(t){return typeof t=="string"&&Yt.some(e=>e===t)}const J={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:"topological",includeOutputs:!1},pdf:{preset:"document",includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:"source"}};function te(t,e){return t.default(e).catch(e)}function xe(t){return st(t).optional().catch(void 0)}var ln=st({html:xe({includeCode:te(pe(),J.html.includeCode)}),markdown:xe({flavor:te(ge(Xt).nullable(),J.markdown.flavor)}),ipynb:xe({sortMode:te(ge(Qt),J.ipynb.sortMode),includeOutputs:te(pe(),J.ipynb.includeOutputs)}),pdf:xe({preset:te(ge(Zt),J.pdf.preset),includeInputs:te(pe(),J.pdf.includeInputs),includeOutputs:te(pe(),J.pdf.includeOutputs),webpdf:te(pe(),J.pdf.webpdf)}),script:xe({type:te(ge(ea),J.script.type)})}).catch({});function aa(t,e){let s={...t},n=r=>{s[r]={...t[r],...e[r]}};for(let r of Object.keys(e))n(r);return s}function dn(t){return aa(J,ln.parse(t))}const sa=at("marimo:export:options:v1",J,Xe({toSerializable:t=>t,fromSerializable:dn}),{getOnInit:!0}),cn=at("marimo:export:last-format:v1","html",Xe({toSerializable:t=>t,fromSerializable:t=>ta(t)?t:"html"}),{getOnInit:!0});var na={html:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},markdown:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},ipynb:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},pdf:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},script:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1},png:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1}};function oa(t,e){return t==="wasm"&&e==="pdf"}function un({format:t,options:e,runtime:s,filename:n,availability:r}){let i=t==="script"&&e.script.type==="source"?{...na.script,requiresNamedNotebookOnServer:!0}:na[t],o=oa(s,t);if(s==="wasm"&&i.requiresServerRuntime)return{available:o,reason:{type:"wasm-runtime"}};if(s==="server"&&i.requiresNamedNotebookOnServer&&!n)return{available:!1,reason:{type:"notebook-must-be-named"}};if(s==="wasm"||!i.checksServerAvailability)return{available:!0};if(r.status==="pending")return{available:!1,reason:{type:"checking-requirements"}};if(r.status==="error"||!r.data)return{available:!0,availabilityCheckFailed:!0};let l=r.data.formats.find(d=>d.format===t);return l?l.dependenciesAvailable?{available:!0}:{available:!1,reason:{type:"missing-packages",packages:l.missingPackages}}:{available:!0,availabilityCheckFailed:!0}}var Z=T();function ye(t,e){return t.map(s=>({value:s,...e[s]}))}var mn=ye(["automatic",...Xt],{automatic:{label:"Automatic",description:"Chooses a format from the notebook filename. Defaults to Markdown (.md)."},pymdown:{label:"Markdown (.md)",description:"Creates a .md file with Python code blocks."},qmd:{label:"Quarto (.qmd)",description:"Creates a .qmd file for Quarto."},mystmd:{label:"MyST (.myst.md)",description:"Creates a .myst.md file for MyST."},mdx:{label:"MDX (.mdx)",description:"Creates a .mdx file for MDX."}}),pn=ye(Qt,{"top-down":{label:"Top to bottom",description:"Keeps cells in the same order as this notebook."},topological:{label:"Dependency order",description:"Reorders cells so each cell appears after the cells it depends on."}}),hn=ye(Zt,{document:{label:"Document",description:"Creates pages for reading or printing."},slides:{label:"Slides",description:"Creates presentation slides from the notebook."}}),fn=ye(["browser","latex"],{browser:{label:"Browser",description:"Uses browser rendering to preserve the notebook's visual output."},latex:{label:"LaTeX first",description:"Uses Pandoc and TeX when available, then falls back to browser rendering."}}),bn=ye(ea,{source:{label:"Notebook source",description:"Downloads the saved notebook source for continued editing in marimo."},flat:{label:"Flat script",description:"Reorders cells so the Python script runs from top to bottom."}});const Ue={html:{label:"HTML",actionLabel:"Export HTML",description:"Save the current notebook as an HTML page.",Icon:wt,Options:xn},markdown:{label:"Markdown",actionLabel:"Export Markdown",description:"Save code and text in a Markdown-based file. Cell outputs are not included.",Icon:Ye,Options:yn},ipynb:{label:"Jupyter",actionLabel:"Export Jupyter notebook",description:"Open the notebook in Jupyter and other compatible tools.",Icon:Dt,Options:kn},pdf:{label:"PDF",actionLabel:"Export PDF",description:"Save the notebook as a PDF for printing or sharing.",Icon:be,Options:vn},script:{label:"Python",actionLabel:"Export flat script",description:"Save the notebook as a Python file.",Icon:Le,Options:gn},png:{label:"PNG",actionLabel:"Export PNG",description:"Capture the current app view as an image.",Icon:jt,Options:wn}};function xn(t){let e=(0,Z.c)(7),{options:s,updateOptions:n,disabled:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={checked:"Includes code cells in the webpage.",unchecked:"Leaves code cells out of the webpage."},e[0]=i):i=e[0];let o;e[1]===n?o=e[2]:(o=d=>n("html",{includeCode:d}),e[1]=n,e[2]=o);let l;return e[3]!==r||e[4]!==s.html.includeCode||e[5]!==o?(l=(0,a.jsx)(ke,{children:(0,a.jsx)(Se,{label:"Include code",descriptions:i,checked:s.html.includeCode,disabled:r,onCheckedChange:o})}),e[3]=r,e[4]=s.html.includeCode,e[5]=o,e[6]=l):l=e[6],l}function yn(t){let e=(0,Z.c)(6),{options:s,updateOptions:n,disabled:r}=t,i=s.markdown.flavor??"automatic",o;e[0]===n?o=e[1]:(o=d=>n("markdown",{flavor:d==="automatic"?null:d}),e[0]=n,e[1]=o);let l;return e[2]!==r||e[3]!==i||e[4]!==o?(l=(0,a.jsx)(ke,{children:(0,a.jsx)(Cn,{label:"Format",value:i,disabled:r,onValueChange:o,options:mn})}),e[2]=r,e[3]=i,e[4]=o,e[5]=l):l=e[5],l}function kn(t){let e=(0,Z.c)(16),{options:s,updateOptions:n,disabled:r}=t,i;e[0]===n?i=e[1]:(i=m=>n("ipynb",{sortMode:m}),e[0]=n,e[1]=i);let o;e[2]!==r||e[3]!==s.ipynb.sortMode||e[4]!==i?(o=(0,a.jsx)(ze,{label:"Cell order",value:s.ipynb.sortMode,disabled:r,onValueChange:i,options:pn}),e[2]=r,e[3]=s.ipynb.sortMode,e[4]=i,e[5]=o):o=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the Jupyter notebook."},e[6]=l):l=e[6];let d;e[7]===n?d=e[8]:(d=m=>n("ipynb",{includeOutputs:m}),e[7]=n,e[8]=d);let c;e[9]!==r||e[10]!==s.ipynb.includeOutputs||e[11]!==d?(c=(0,a.jsx)(Se,{label:"Include outputs",descriptions:l,checked:s.ipynb.includeOutputs,disabled:r,onCheckedChange:d}),e[9]=r,e[10]=s.ipynb.includeOutputs,e[11]=d,e[12]=c):c=e[12];let u;return e[13]!==o||e[14]!==c?(u=(0,a.jsxs)(ke,{children:[o,c]}),e[13]=o,e[14]=c,e[15]=u):u=e[15],u}function vn(t){let e=(0,Z.c)(30),{options:s,updateOptions:n,disabled:r}=t,i;e[0]===n?i=e[1]:(i=f=>n("pdf",{preset:f}),e[0]=n,e[1]=i);let o;e[2]!==r||e[3]!==s.pdf.preset||e[4]!==i?(o=(0,a.jsx)(ze,{label:"Layout",value:s.pdf.preset,disabled:r,onValueChange:i,options:hn}),e[2]=r,e[3]=s.pdf.preset,e[4]=i,e[5]=o):o=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l={checked:"Includes code cells in the PDF.",unchecked:"Leaves code cells out of the PDF."},e[6]=l):l=e[6];let d;e[7]===n?d=e[8]:(d=f=>n("pdf",{includeInputs:f}),e[7]=n,e[8]=d);let c;e[9]!==r||e[10]!==s.pdf.includeInputs||e[11]!==d?(c=(0,a.jsx)(Se,{label:"Include code",descriptions:l,checked:s.pdf.includeInputs,disabled:r,onCheckedChange:d}),e[9]=r,e[10]=s.pdf.includeInputs,e[11]=d,e[12]=c):c=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the PDF."},e[13]=u):u=e[13];let m;e[14]===n?m=e[15]:(m=f=>n("pdf",{includeOutputs:f}),e[14]=n,e[15]=m);let h;e[16]!==r||e[17]!==s.pdf.includeOutputs||e[18]!==m?(h=(0,a.jsx)(Se,{label:"Include outputs",descriptions:u,checked:s.pdf.includeOutputs,disabled:r,onCheckedChange:m}),e[16]=r,e[17]=s.pdf.includeOutputs,e[18]=m,e[19]=h):h=e[19];let x;e[20]!==r||e[21]!==s.pdf.preset||e[22]!==s.pdf.webpdf||e[23]!==n?(x=s.pdf.preset==="document"?(0,a.jsx)(ze,{label:"Method",value:s.pdf.webpdf?"browser":"latex",disabled:r,onValueChange:f=>n("pdf",{webpdf:f==="browser"}),options:fn}):null,e[20]=r,e[21]=s.pdf.preset,e[22]=s.pdf.webpdf,e[23]=n,e[24]=x):x=e[24];let p;return e[25]!==o||e[26]!==c||e[27]!==h||e[28]!==x?(p=(0,a.jsxs)(ke,{children:[o,c,h,x]}),e[25]=o,e[26]=c,e[27]=h,e[28]=x,e[29]=p):p=e[29],p}function gn(t){let e=(0,Z.c)(6),{options:s,updateOptions:n,disabled:r}=t,i;e[0]===n?i=e[1]:(i=l=>n("script",{type:l}),e[0]=n,e[1]=i);let o;return e[2]!==r||e[3]!==s.script.type||e[4]!==i?(o=(0,a.jsx)(ke,{children:(0,a.jsx)(ze,{label:"Format",value:s.script.type,disabled:r,onValueChange:i,options:bn})}),e[2]=r,e[3]=s.script.type,e[4]=i,e[5]=o):o=e[5],o}function wn(){return null}function ke(t){let e=(0,Z.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,a.jsx)("div",{className:"divide-y rounded-md border",children:s}),e[0]=s,e[1]=n),n}function Se(t){let e=(0,Z.c)(26),{label:s,descriptions:n,descriptionOverride:r,checked:i,disabled:o,onCheckedChange:l}=t,d=(0,E.useId)(),c=`${d}-description`,u=r??(i?n.checked:n.unchecked),m;e[0]===r?m=e[1]:(m=r?[r]:[],e[0]=r,e[1]=m);let h;e[2]!==n.checked||e[3]!==n.unchecked||e[4]!==m?(h=[n.checked,n.unchecked,...m],e[2]=n.checked,e[3]=n.unchecked,e[4]=m,e[5]=h):h=e[5];let x=h,p;e[6]!==d||e[7]!==s?(p=(0,a.jsx)("label",{htmlFor:d,className:"text-sm font-medium leading-5",children:s}),e[6]=d,e[7]=s,e[8]=p):p=e[8];let f;e[9]!==u||e[10]!==c||e[11]!==x?(f=(0,a.jsx)(Ge,{id:c,description:u,possibleDescriptions:x}),e[9]=u,e[10]=c,e[11]=x,e[12]=f):f=e[12];let v;e[13]!==p||e[14]!==f?(v=(0,a.jsxs)("div",{className:"min-w-0",children:[p,f]}),e[13]=p,e[14]=f,e[15]=v):v=e[15];let b;e[16]!==i||e[17]!==c||e[18]!==o||e[19]!==d||e[20]!==s||e[21]!==l?(b=(0,a.jsx)(Ta,{id:d,size:"sm",checked:i,disabled:o,onCheckedChange:l,"aria-label":s,"aria-describedby":c}),e[16]=i,e[17]=c,e[18]=o,e[19]=d,e[20]=s,e[21]=l,e[22]=b):b=e[22];let g;return e[23]!==v||e[24]!==b?(g=(0,a.jsxs)("div",{className:"flex min-h-14 items-center justify-between gap-4 px-3 py-2",children:[v,b]}),e[23]=v,e[24]=b,e[25]=g):g=e[25],g}function ze(t){var w;let e=(0,Z.c)(31),{label:s,value:n,disabled:r,onValueChange:i,options:o}=t,l=(0,E.useId)(),d=`${l}-description`,c;e[0]!==o||e[1]!==n?(c=(w=o.find(k=>k.value===n))==null?void 0:w.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]===s?m=e[4]:(m=(0,a.jsx)("div",{className:"text-sm font-medium leading-5",children:s}),e[3]=s,e[4]=m);let h=u??"",x;e[5]===o?x=e[6]:(x=o.map(jn),e[5]=o,e[6]=x);let p;e[7]!==d||e[8]!==h||e[9]!==x?(p=(0,a.jsx)(Ge,{id:d,description:h,possibleDescriptions:x}),e[7]=d,e[8]=h,e[9]=x,e[10]=p):p=e[10];let f;e[11]!==m||e[12]!==p?(f=(0,a.jsxs)("div",{className:"min-w-0",children:[m,p]}),e[11]=m,e[12]=p,e[13]=f):f=e[13];let v;e[14]===i?v=e[15]:(v=k=>i(k),e[14]=i,e[15]=v);let b;if(e[16]!==l||e[17]!==o){let k;e[19]===l?k=e[20]:(k=(C,M)=>{let S=`${l}-${M}`;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ts,{id:S,value:C.value}),(0,a.jsx)("label",{htmlFor:S,className:"text-sm",children:C.label})]},C.value)},e[19]=l,e[20]=k),b=o.map(k),e[16]=l,e[17]=o,e[18]=b}else b=e[18];let g;e[21]!==d||e[22]!==r||e[23]!==s||e[24]!==v||e[25]!==b||e[26]!==n?(g=(0,a.jsx)(as,{value:n,onValueChange:v,className:"flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end","aria-label":s,"aria-describedby":d,disabled:r,children:b}),e[21]=d,e[22]=r,e[23]=s,e[24]=v,e[25]=b,e[26]=n,e[27]=g):g=e[27];let y;return e[28]!==f||e[29]!==g?(y=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[f,g]}),e[28]=f,e[29]=g,e[30]=y):y=e[30],y}function jn(t){return t.description}function Cn(t){var M;let e=(0,Z.c)(34),{label:s,value:n,disabled:r,onValueChange:i,options:o}=t,l=(0,E.useId)(),d=`${l}-description`,c;e[0]!==o||e[1]!==n?(c=(M=o.find(S=>S.value===n))==null?void 0:M.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]!==l||e[4]!==s?(m=(0,a.jsx)("label",{htmlFor:l,className:"text-sm font-medium leading-5",children:s}),e[3]=l,e[4]=s,e[5]=m):m=e[5];let h=u??"",x;e[6]===o?x=e[7]:(x=o.map(Sn),e[6]=o,e[7]=x);let p;e[8]!==d||e[9]!==h||e[10]!==x?(p=(0,a.jsx)(Ge,{id:d,description:h,possibleDescriptions:x}),e[8]=d,e[9]=h,e[10]=x,e[11]=p):p=e[11];let f;e[12]!==m||e[13]!==p?(f=(0,a.jsxs)("div",{className:"min-w-0",children:[m,p]}),e[12]=m,e[13]=p,e[14]=f):f=e[14];let v;e[15]===i?v=e[16]:(v=S=>i(S),e[15]=i,e[16]=v);let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsx)(lt,{}),e[17]=b):b=e[17];let g;e[18]!==d||e[19]!==l?(g=(0,a.jsx)(ut,{id:l,"aria-describedby":d,className:"h-8 w-full shrink-0 sm:w-44",children:b}),e[18]=d,e[19]=l,e[20]=g):g=e[20];let y;e[21]===o?y=e[22]:(y=o.map(Nn),e[21]=o,e[22]=y);let w;e[23]===y?w=e[24]:(w=(0,a.jsx)(ct,{children:y}),e[23]=y,e[24]=w);let k;e[25]!==r||e[26]!==w||e[27]!==v||e[28]!==g||e[29]!==n?(k=(0,a.jsxs)(mt,{value:n,disabled:r,onValueChange:v,children:[g,w]}),e[25]=r,e[26]=w,e[27]=v,e[28]=g,e[29]=n,e[30]=k):k=e[30];let C;return e[31]!==k||e[32]!==f?(C=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[f,k]}),e[31]=k,e[32]=f,e[33]=C):C=e[33],C}function Nn(t){return(0,a.jsx)(dt,{value:t.value,children:t.label},t.value)}function Sn(t){return t.description}function Ge(t){let e=(0,Z.c)(15),{id:s,description:n,possibleDescriptions:r}=t,i;e[0]===r?i=e[1]:(i=new Set(r),e[0]=r,e[1]=i);let o;e[2]===i?o=e[3]:(o=[...i],e[2]=i,e[3]=o);let l;e[4]!==n||e[5]!==o?(l=o.filter(h=>h!==n),e[4]=n,e[5]=o,e[6]=l):l=e[6];let d=l,c;e[7]!==n||e[8]!==s?(c=(0,a.jsx)("p",{id:s,"aria-live":"polite",className:"col-start-1 row-start-1",children:n}),e[7]=n,e[8]=s,e[9]=c):c=e[9];let u;e[10]===d?u=e[11]:(u=d.map(zn),e[10]=d,e[11]=u);let m;return e[12]!==c||e[13]!==u?(m=(0,a.jsxs)("div",{className:"mt-0.5 grid text-xs leading-4 text-muted-foreground",children:[c,u]}),e[12]=c,e[13]=u,e[14]=m):m=e[14],m}function zn(t){return(0,a.jsx)("p",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:t},t)}var Me=T();function Mn(t){var c;let e=(0,Me.c)(10),{status:s}=t;if(s.available&&!s.availabilityCheckFailed)return null;if(((c=s.reason)==null?void 0:c.type)==="checking-requirements"){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[(0,a.jsx)(Pe,{size:"small",className:"size-3"}),(0,a.jsx)("span",{className:"sr-only",children:"Checking requirements"})]}),e[0]=u):u=e[0],u}let n=s.availabilityCheckFailed?"Requirements unknown":"Unavailable",r=s.availabilityCheckFailed?"text-muted-foreground":"text-(--yellow-11)",i;e[1]===r?i=e[2]:(i=fe("size-3",r),e[1]=r,e[2]=i);let o;e[3]===i?o=e[4]:(o=(0,a.jsx)(et,{className:i}),e[3]=i,e[4]=o);let l;e[5]===n?l=e[6]:(l=(0,a.jsx)("span",{className:"sr-only",children:n}),e[5]=n,e[6]=l);let d;return e[7]!==o||e[8]!==l?(d=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[o,l]}),e[7]=o,e[8]=l,e[9]=d):d=e[9],d}function On(t){let e=(0,Me.c)(5),{format:s,formatLabel:n,status:r}=t;if(r.availabilityCheckFailed){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(Oe,{children:"Couldn't check whether this export is available. You can still try it."})}),e[0]=o):o=e[0],o}if(!r.reason)return null;let i;return e[1]!==s||e[2]!==n||e[3]!==r.reason?(i=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(_n,{format:s,formatLabel:n,reason:r.reason})}),e[1]=s,e[2]=n,e[3]=r.reason,e[4]=i):i=e[4],i}function Oe(t){let e=(0,Me.c)(3),{children:s}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,a.jsx)(et,{className:"mt-0.5 size-4 shrink-0 sm:mt-0"}),e[0]=n):n=e[0];let r;return e[1]===s?r=e[2]:(r=(0,a.jsxs)(zt,{variant:"warning",className:"flex items-start gap-2.5 p-3 text-(--yellow-12) has-[svg]:pl-3 sm:items-center [&>svg]:static [&>svg+div]:translate-y-0",children:[n,(0,a.jsx)(St,{className:"min-w-0 flex-1 text-sm leading-5",children:s})]}),e[1]=s,e[2]=r),r}function _n(t){let e=(0,Me.c)(10),{format:s,formatLabel:n,reason:r}=t;switch(r.type){case"checking-requirements":{let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(Pe,{className:"size-4 shrink-0",size:"small"}),e[0]=i):i=e[0];let o;return e[1]===n?o=e[2]:(o=(0,a.jsxs)(zt,{role:"status",variant:"info",className:"flex items-center gap-2.5 p-3 has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0",children:[i,(0,a.jsxs)(St,{className:"min-w-0 flex-1 text-sm leading-5",children:["Checking ",n," requirements\u2026"]})]}),e[1]=n,e[2]=o),o}case"notebook-must-be-named":{let i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(Oe,{children:"Name and save this notebook before exporting."}),e[3]=i):i=e[3],i}case"missing-packages":{let i;e[4]===r.packages?i=e[5]:(i=r.packages.join(", "),e[4]=r.packages,e[5]=i);let o;return e[6]===i?o=e[7]:(o=(0,a.jsxs)(Oe,{children:["Install"," ",(0,a.jsx)("code",{className:"break-words font-mono",children:i})," ","where marimo is running to use this export."]}),e[6]=i,e[7]=o),o}case"wasm-runtime":{let i=s==="pdf"?"Use your browser's print dialog to save the current app view as a PDF.":"Open this notebook in a local marimo session to use this export.",o;return e[8]===i?o=e[9]:(o=(0,a.jsx)(Oe,{children:i}),e[8]=i,e[9]=o),o}default:ht(r)}}var Fn={pymdown:"md",qmd:"qmd",mystmd:"myst.md",mdx:"mdx"},In=[".myst.md",".markdown",".qmd",".mdx",".md"];function Ln(t){return t.endsWith(".myst.md")?"mystmd":t.endsWith(".qmd")?"qmd":t.endsWith(".mdx")?"mdx":"pymdown"}function Pn(t,e){let s=Fn[e??Ln(t)],n=In.find(o=>t.endsWith(o)),r=ce.withoutExtension(t);n&&(r=t.slice(0,-n.length));let i=`${r}.${s}`;return i===t?`${t.slice(0,-(s.length+1))}.export.${s}`:i}function Wn(t){return Object.entries(t).flatMap(([e,s])=>s===null?[]:s===!0?[`--${e}`]:s===!1?[`--no-${e}`]:[`--${e}=${s}`])}function An(t){return t.preset==="document"?t.webpdf:null}var En={html:{subcommand:"html",flags:({html:t})=>({"include-code":t.includeCode}),outputFilename:t=>ce.toHTML(t)},markdown:{subcommand:"md",flags:({markdown:t})=>({flavor:t.flavor}),outputFilename:(t,{markdown:e})=>Pn(t,e.flavor)},ipynb:{subcommand:"ipynb",flags:({ipynb:t})=>({sort:t.sortMode,"include-outputs":t.includeOutputs}),outputFilename:t=>ce.toIPYNB(t)},pdf:{subcommand:"pdf",flags:({pdf:t})=>({as:t.preset,"include-inputs":t.includeInputs,"include-outputs":t.includeOutputs,webpdf:An(t)}),outputFilename:t=>ce.toPDF(t)},script:{subcommand:"script",flags:()=>({}),outputFilename:t=>`${ce.withoutExtension(t)}.script.py`}};function Dn({format:t,filename:e,options:s}){if(t==="png"||t==="script"&&s.script.type==="source"||!e)return null;let n=En[t];return["marimo","export",n.subcommand,_t(e),...Wn(n.flags(s)),"-o",_t(n.outputFilename(e,s))].join(" ")}async function qn(t){let{exportOptions:e,captureOutputs:s,downloadPDF:n}=t;e.includeOutputs&&await s(),await n(e)}async function Tn({format:t,options:e,requests:s,sourceFilename:n,htmlFiles:r,captureOutputs:i,capturePNG:o,downloadFile:l}){switch(t){case"html":l(await s.exportAsHTML({download:!1,files:r,includeCode:e.html.includeCode}));return;case"markdown":l(await s.exportAsMarkdown({download:!1,flavor:e.markdown.flavor}));return;case"ipynb":e.ipynb.includeOutputs&&await i(),l(await s.exportAsIPYNB({download:!1,sortMode:e.ipynb.sortMode,includeOutputs:e.ipynb.includeOutputs}));return;case"pdf":await qn({exportOptions:e.pdf,captureOutputs:i,downloadPDF:async d=>{l(await s.exportAsPDF(d))}});return;case"script":if(e.script.type==="source"){l({contents:(await s.readCode()).contents,filename:n,mediaType:"text/plain"});return}l(await s.exportAsScript({download:!1}));return;case"png":await o();return;default:ht(t)}}var ra=T(),Rn={source:{actionLabel:"Export notebook source",progressLabel:"notebook source"},flat:{actionLabel:"Export flat script",progressLabel:"flat script"}};function $n(t,e){if(t==="wasm")return{status:"success",data:null};switch(e.status){case"pending":case"loading":return{status:"pending"};case"error":return{status:"error"};case"success":return{status:"success",data:e.data}}}function Hn(t,e){return t==="server"&&e?We.basename(e):ce.toPY(document.title)}function Bn({usesBrowserPrint:t,hasCommand:e,format:s,isNotebookSource:n}){return t?"Uses the browser's print settings for page size and filename.":e?"Uses the current session state. The copied command exports the saved notebook.":s!=="png"&&!n?"Save the notebook to copy an equivalent shell command.":null}function Vn(t){let e=(0,ra.c)(52),s=Mt(),[n,r]=_e(sa),[i,o]=_e(cn),[l,d]=(0,E.useState)(t??i),c=he()?"wasm":"server",u=ne(),m,h;e[0]===u?(m=e[1],h=e[2]):(m=async()=>c==="wasm"?null:u.getExportAvailability(),h=[c,u],e[0]=u,e[1]=m,e[2]=h);let x=Re(m,h),p,f;if(e[3]!==x||e[4]!==s||e[5]!==l||e[6]!==n){let j=$n(c,x),O=N=>un({format:N,options:n,runtime:c,filename:s,availability:j});p=O(l),f=Yt.map(N=>({format:N,status:O(N)})),e[3]=x,e[4]=s,e[5]=l,e[6]=n,e[7]=p,e[8]=f}else p=e[7],f=e[8];let v=f,b,g,y,w,k;if(e[9]!==s||e[10]!==l||e[11]!==n){k=oa(c,l);let j=Ue[l],O=l==="script"&&n.script.type==="source",N;e[17]!==j||e[18]!==l||e[19]!==n?(N=l==="script"?Rn[n.script.type]:{actionLabel:j.actionLabel,progressLabel:j.label},e[17]=j,e[18]=l,e[19]=n,e[20]=N):N=e[20],{actionLabel:b,progressLabel:y}=N,g=k?null:Dn({format:l,filename:s,options:n}),w=Bn({usesBrowserPrint:k,hasCommand:!!g,format:l,isNotebookSource:O}),e[9]=s,e[10]=l,e[11]=n,e[12]=b,e[13]=g,e[14]=y,e[15]=w,e[16]=k}else b=e[12],g=e[13],y=e[14],w=e[15],k=e[16];let C=w,M,S;e[21]!==t||e[22]!==o?(M=()=>{t&&o(t)},S=[t,o],e[21]=t,e[22]=o,e[23]=M,e[24]=S):(M=e[23],S=e[24]),(0,E.useEffect)(M,S);let q;e[25]===o?q=e[26]:(q=j=>{ta(j)&&(d(j),o(j))},e[25]=o,e[26]=q);let $=q,P;e[27]===r?P=e[28]:(P=(j,O)=>{r(N=>{let H={...N};return H[j]={...N[j],...O},H})},e[27]=r,e[28]=P);let D=P,z;e[29]!==b||e[30]!==g||e[31]!==C||e[32]!==l||e[33]!==p||e[34]!==k?(z={format:l,status:p,usesBrowserPrint:k,actionLabel:b,command:g,footerDescription:C},e[29]=b,e[30]=g,e[31]=C,e[32]=l,e[33]=p,e[34]=k,e[35]=z):z=e[35];let F;e[36]===s?F=e[37]:(F=Hn(c,s),e[36]=s,e[37]=F);let I;e[38]!==l||e[39]!==n||e[40]!==y||e[41]!==p.available||e[42]!==F||e[43]!==k?(I={format:l,options:n,sourceFilename:F,available:p.available,usesBrowserPrint:k,progressLabel:y},e[38]=l,e[39]=n,e[40]=y,e[41]=p.available,e[42]=F,e[43]=k,e[44]=I):I=e[44];let R;return e[45]!==v||e[46]!==n||e[47]!==$||e[48]!==I||e[49]!==z||e[50]!==D?(R={formats:v,options:n,selected:z,exportRequest:I,selectFormat:$,updateOptions:D},e[45]=v,e[46]=n,e[47]=$,e[48]=I,e[49]=z,e[50]=D,e[51]=R):R=e[51],R}async function Un(t){let e=document.getElementById("App");if(!e){let r="The current app view could not be captured.";throw le({title:"Failed to download as PNG",description:r,variant:"danger"}),Error(r)}let s=t==null?void 0:t.style.visibility,n=t==null?void 0:t.classList.contains("print:hidden");if(!await Za({element:e,filename:document.title,prepare:()=>{let r=es();return t&&(t.classList.add("print:hidden"),t.style.visibility="hidden"),()=>{r(),t&&(n||t.classList.remove("print:hidden"),t.style.visibility=s??"")}}}))throw Error("Failed to capture the current app view.")}function Gn(t){t(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function Kn({format:t,options:e,sourceFilename:s,available:n,usesBrowserPrint:r,progressLabel:i,onClose:o}){let l=ne(),d=Ls(),c=Q(we),u=re(we),[m,h]=(0,E.useState)(!1),x=(0,E.useRef)(null),p=(0,E.useRef)(!0);(0,E.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let f=async b=>{await Ps({takeScreenshots:()=>d({progress:b}),updateCellOutputs:l.updateCellOutputs})},v=async()=>{let b=()=>{var g;return Un(((g=x.current)==null?void 0:g.parentElement)??null)};if(c.mode!=="edit"){await b();return}try{await qa(b)}finally{u(c)}};return{dialogRef:x,isExporting:m,submit:async()=>{if(!(!n||m)){if(r){Gn(o);return}h(!0);try{await Qa(`Exporting ${i}\u2026`,async b=>{await Tn({format:t,options:e,requests:l,sourceFilename:s,htmlFiles:bt.INSTANCE.filenames(),captureOutputs:()=>f(b),capturePNG:v,downloadFile:Xa})}),p.current&&o()}catch(b){de.error("Export failed",b)}finally{p.current&&h(!1)}}}}}function Jn(t){let e=(0,ra.c)(14),{initialFormat:s,onClose:n}=t,r=Vn(s),i,o,l;e[0]===r?(i=e[1],o=e[2],l=e[3]):({exportRequest:i,selectFormat:o,...l}=r,e[0]=r,e[1]=i,e[2]=o,e[3]=l);let d;e[4]!==i||e[5]!==n?(d={...i,onClose:n},e[4]=i,e[5]=n,e[6]=d):d=e[6];let c=Kn(d),u;e[7]!==c||e[8]!==o?(u=h=>{c.isExporting||o(h)},e[7]=c,e[8]=o,e[9]=u):u=e[9];let m;return e[10]!==c||e[11]!==l||e[12]!==u?(m={...l,...c,selectFormat:u},e[10]=c,e[11]=l,e[12]=u,e[13]=m):m=e[13],m}var Yn=T(),Xn="(min-width: 640px)";const Qn=t=>{let e=(0,Yn.c)(69),{initialFormat:s,onClose:n,returnFocusRef:r}=t,i;e[0]!==s||e[1]!==n?(i={initialFormat:s,onClose:n},e[0]=s,e[1]=n,e[2]=i):i=e[2];let{dialogRef:o,isExporting:l,formats:d,options:c,selected:u,selectFormat:m,updateOptions:h,submit:x}=Jn(i),p=Ya(Xn),{format:f,status:v,usesBrowserPrint:b,actionLabel:g,command:y,footerDescription:w}=u,k=Ue[f],C=k.Options,M;e[3]===r?M=e[4]:(M=r?{onCloseAutoFocus:L=>{var G;L.preventDefault(),(G=r.current)==null||G.focus()}}:{},e[3]=r,e[4]=M);let S=M,q;e[5]===Symbol.for("react.memo_cache_sentinel")?(q=(0,a.jsxs)(Ee,{className:"border-b px-5 py-4 pr-12",children:[(0,a.jsx)(De,{children:"Export notebook"}),(0,a.jsx)(Te,{children:"Choose a format and adjust its options."})]}),e[5]=q):q=e[5];let $=p?"vertical":"horizontal",P;if(e[6]!==d||e[7]!==l){let L;e[9]===l?L=e[10]:(L=G=>{let{format:X,status:ve}=G,me=Ue[X];return(0,a.jsxs)(Va,{value:X,disabled:l,className:"min-w-0 justify-start gap-2 px-2.5 py-2 text-xs data-[state=active]:shadow-xs sm:w-full sm:text-sm","data-testid":`export-format-${X}`,children:[(0,a.jsx)(me.Icon,{className:"size-3.5 shrink-0",strokeWidth:1.5}),(0,a.jsx)("span",{className:"truncate",children:me.label}),(0,a.jsx)(Mn,{status:ve})]},X)},e[9]=l,e[10]=L),P=d.map(L),e[6]=d,e[7]=l,e[8]=P}else P=e[8];let D;e[11]===P?D=e[12]:(D=(0,a.jsx)(Ga,{"aria-label":"Export format",className:"grid max-h-none shrink-0 grid-cols-2 items-stretch justify-start gap-1 overflow-auto rounded-none border-b bg-muted/20 p-2 min-[360px]:grid-cols-3 sm:flex sm:h-full sm:flex-col sm:border-b-0 sm:border-r",children:P}),e[11]=P,e[12]=D);let z;if(e[13]!==C||e[14]!==k.description||e[15]!==k.label||e[16]!==f||e[17]!==d||e[18]!==l||e[19]!==c||e[20]!==v||e[21]!==h||e[22]!==b){let L;e[24]!==C||e[25]!==k.description||e[26]!==k.label||e[27]!==f||e[28]!==l||e[29]!==c||e[30]!==v||e[31]!==h||e[32]!==b?(L=G=>{let{format:X}=G;return(0,a.jsxs)(Ua,{value:X,className:"mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3",children:[(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"text-base font-semibold",children:k.label}),(0,a.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:k.description})]}),(0,a.jsx)(On,{format:f,formatLabel:k.label,status:v}),b?null:(0,a.jsx)(C,{options:c,updateOptions:h,disabled:l})]},X)},e[24]=C,e[25]=k.description,e[26]=k.label,e[27]=f,e[28]=l,e[29]=c,e[30]=v,e[31]=h,e[32]=b,e[33]=L):L=e[33],z=d.map(L),e[13]=C,e[14]=k.description,e[15]=k.label,e[16]=f,e[17]=d,e[18]=l,e[19]=c,e[20]=v,e[21]=h,e[22]=b,e[23]=z}else z=e[23];let F;e[34]!==f||e[35]!==m||e[36]!==$||e[37]!==D||e[38]!==z?(F=(0,a.jsxs)(Ba,{value:f,onValueChange:m,orientation:$,className:"flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]",children:[D,z]}),e[34]=f,e[35]=m,e[36]=$,e[37]=D,e[38]=z,e[39]=F):F=e[39];let I;e[40]===y?I=e[41]:(I=y?(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-background px-2.5 py-2 font-mono text-xs",children:[(0,a.jsx)("span",{className:"select-none text-muted-foreground","aria-hidden":!0,children:"$"}),(0,a.jsx)("code",{className:"min-w-0 flex-1 overflow-x-auto whitespace-nowrap","data-testid":"export-cli-command","aria-label":"Equivalent POSIX shell command",children:y}),(0,a.jsx)(Ae,{value:y,className:"size-3.5",buttonClassName:fe(ns({variant:"ghost",size:"icon"}),"shrink-0"),tooltip:"Copy POSIX shell command",ariaLabel:"Copy POSIX shell command",toastTitle:"Command copied"})]}):null,e[40]=y,e[41]=I);let R=y&&"mt-3",j;e[42]===R?j=e[43]:(j=fe("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",R),e[42]=R,e[43]=j);let O;e[44]===w?O=e[45]:(O=w?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:w}):null,e[44]=w,e[45]=O);let N=!v.available||l,H=!w&&"sm:ml-auto",B;e[46]===H?B=e[47]:(B=fe("border-(--blue-11) bg-(--blue-11) hover:border-(--blue-12) hover:bg-(--blue-12) sm:min-w-36 dark:border-(--blue-7) dark:bg-(--blue-5) dark:text-(--blue-12) dark:hover:border-(--blue-8) dark:hover:bg-(--blue-6)",H),e[46]=H,e[47]=B);let V;e[48]===l?V=e[49]:(V=l&&(0,a.jsx)(Pe,{size:"small",className:"mr-2","aria-hidden":!0}),e[48]=l,e[49]=V);let ae=b?"Print to PDF":g,Y;e[50]!==l||e[51]!==x||e[52]!==N||e[53]!==B||e[54]!==V||e[55]!==ae?(Y=(0,a.jsxs)(ie,{type:"button",disabled:N,"aria-busy":l,onClick:x,className:B,"data-testid":"export-submit",children:[V,ae]}),e[50]=l,e[51]=x,e[52]=N,e[53]=B,e[54]=V,e[55]=ae,e[56]=Y):Y=e[56];let se;e[57]!==j||e[58]!==O||e[59]!==Y?(se=(0,a.jsxs)("div",{className:j,children:[O,Y]}),e[57]=j,e[58]=O,e[59]=Y,e[60]=se):se=e[60];let U;e[61]!==se||e[62]!==I?(U=(0,a.jsxs)("footer",{className:"min-w-0 border-t bg-muted/20 px-4 py-3",children:[I,se]}),e[61]=se,e[62]=I,e[63]=U):U=e[63];let _;return e[64]!==o||e[65]!==S||e[66]!==U||e[67]!==F?(_=(0,a.jsxs)(qe,{ref:o,className:"grid h-dvh max-h-[760px] min-w-0 w-[calc(100vw-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:top-[5vh] sm:h-[90vh] sm:max-h-[640px] sm:max-w-3xl","data-testid":"export-dialog",...S,children:[q,F,U]}),e[64]=o,e[65]=S,e[66]=U,e[67]=F,e[68]=_):_=e[68],_};var Zn=T();function eo(t){let e=(0,Zn.c)(5),{openPrompt:s,closeModal:n}=Ce(),{sendCopy:r}=ne(),i;return e[0]!==n||e[1]!==s||e[2]!==r||e[3]!==t?(i=()=>{if(!t)return null;let o=js.guessDeliminator(t);s({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${We.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=o.join(We.dirname(t),l);r({source:t,destination:d}).then(()=>{n(),le({title:"Notebook copied",description:"A copy of the notebook has been created."}),Is(d)})}})},e[0]=n,e[1]=s,e[2]=r,e[3]=t,e[4]=i):i=e[4],i}var to=T();function ia(){let t=(0,to.c)(4),{openConfirm:e}=Ce(),s=re(it),{sendRestart:n}=ne(),r;return t[0]!==e||t[1]!==n||t[2]!==s?(r=()=>{e({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)(Ha,{onClick:async()=>{s({state:rt.CLOSING}),await n(),zs()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=s,t[3]=r):r=t[3],r}var ao=T(),so=new va,no=t=>so.isSupported(t)?"markdown":"code";const la=()=>{let t=(0,ao.c)(3),{updateCellConfig:e}=Je(),{saveCellConfig:s}=ne(),n;return t[0]!==s||t[1]!==e?(n=async(r,i)=>{let o=tt(),l={};for(let c of o.cellIds.inOrderIds){let u=o.cellData[c];u===void 0||u.config.hide_code===r||no(u.code)===i&&(l[c]={hide_code:r})}let d=nt.entries(l);if(d.length!==0){await s({configs:l});for(let[c,u]of d)e({cellId:c,config:u})}},t[0]=s,t[1]=e,t[2]=n):n=t[2],n};var oo=T(),ue=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function ro(t){var X,ve,me;let e=(0,oo.c)(45),s;e[0]===t?s=e[1]:(s=t===void 0?{}:t,e[0]=t,e[1]=s);let{exportDialogReturnFocusRef:n}=s,r=Mt(),{openModal:i,closeModal:o}=Ce(),{toggleApplication:l}=fa(),{selectedPanel:d}=Ca(),[c]=_e(we),u=Q(Da),m=la(),[h]=Wa(),x=Q(ka),p=Q(Aa),{updateCellConfig:f,undoDeleteCell:v,clearAllCellOutputs:b,addSetupCellIfDoesntExist:g,collapseAllCells:y,expandAllCells:w}=Je(),k=ia(),C=Ns(),M=eo(r),S=re(Gt),q=re(Fa),{handleClick:$}=Ia(),P=re(La),D=re(sa),{readCode:z,saveCellConfig:F}=ne(),I=Q(Sa),R=Q(Ma),j=Q(ja),{selectedLayout:O}=xt(),{setLayoutView:N}=yt(),H=Ut(),B=((X=h.sharing)==null?void 0:X.html)??!0,V=((ve=h.sharing)==null?void 0:ve.wasm)??!0,ae=((me=h.sharing)==null?void 0:me.molab)??!0,Y=O==="slides",se=wo,U;e[2]!==o||e[3]!==n||e[4]!==i||e[5]!==D?(U=(W,ee)=>{ee&&D(oe=>aa(oe,ee)),i((0,a.jsx)(Qn,{initialFormat:W,onClose:o,returnFocusRef:n}))},e[2]=o,e[3]=n,e[4]=i,e[5]=D,e[6]=U):U=e[6];let _=U,L;e[7]===Symbol.for("react.memo_cache_sentinel")?(L=(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),e[7]=L):L=e[7];let G;return e[8]!==g||e[9]!==p||e[10]!==R||e[11]!==x||e[12]!==b||e[13]!==o||e[14]!==y||e[15]!==M||e[16]!==w||e[17]!==r||e[18]!==I||e[19]!==Y||e[20]!==u||e[21]!==_||e[22]!==i||e[23]!==$||e[24]!==z||e[25]!==k||e[26]!==C||e[27]!==F||e[28]!==O||e[29]!==d||e[30]!==m||e[31]!==S||e[32]!==P||e[33]!==N||e[34]!==q||e[35]!==B||e[36]!==ae||e[37]!==V||e[38]!==l||e[39]!==H||e[40]!==v||e[41]!==j||e[42]!==f||e[43]!==c.mode?(G=[{icon:L,label:"Export\u2026",additionalKeywords:["download","html","markdown","ipynb","pdf","script","png"],handle:()=>_()},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Download",handle:ue,dropdown:[{icon:(0,a.jsx)(ft,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:()=>_("html",{html:{includeCode:!0}})},{icon:(0,a.jsx)(ft,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:()=>_("html",{html:{includeCode:!1}})},{icon:(0,a.jsx)(Ms,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:()=>_("markdown")},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:()=>_("ipynb")},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Download notebook source",handle:()=>_("script",{script:{type:"source"}})},{icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),label:"Download flat script",handle:()=>_("script",{script:{type:"flat"}})},{divider:!0,icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Download as PNG",handle:()=>_("png")},Y?{divider:!0,icon:(0,a.jsx)(be,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:ue,dropdown:[{icon:(0,a.jsx)(be,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:()=>_("pdf",{pdf:{preset:"document"}})},{icon:(0,a.jsx)(be,{size:14,strokeWidth:1.5}),label:"Slides Layout",hidden:he(),rightElement:(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}),handle:()=>_("pdf",{pdf:{preset:"slides"}})}]}:{divider:!0,icon:(0,a.jsx)(be,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:()=>_("pdf",{pdf:{preset:"document"}})}]},{icon:(0,a.jsx)(vs,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:he(),handle:async()=>{i((0,a.jsx)(_s,{onClose:o}))}},{icon:(0,a.jsx)(Rs,{size:14,strokeWidth:1.5}),label:"Share",handle:ue,hidden:!B&&!V&&!ae,dropdown:[{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{i((0,a.jsx)(Qs,{onClose:o}))}},{icon:(0,a.jsx)(xs,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!V,handle:async()=>{await je(Nt({code:(await z()).contents})),le({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!ae,handle:async()=>{let W=Nt({code:(await z()).contents,baseUrl:`${K.molab}/new`});window.open(W,"_blank")}}]},{icon:(0,a.jsx)(Ts,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:ue,dropdown:ya.flatMap(W=>{let ee=W.type==="ai"&&!p;if(Na({panel:W,capabilities:x,aiEnabled:p})&&!ee)return[];let{type:oe,Icon:da,additionalKeywords:ca}=W;return{label:Ie.startCase(oe),rightElement:se(d===oe),icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),handle:()=>{if(ee){$("ai","ai-features");return}l(oe)},additionalKeywords:ca}})},{icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Present as",handle:ue,dropdown:[{icon:c.mode==="present"?(0,a.jsx)(gs,{size:14,strokeWidth:1.5}):(0,a.jsx)(is,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{H()}},...Lt.map((W,ee)=>{let oe=Kt(W);return{divider:ee===0,label:Jt(W),icon:(0,a.jsx)(oe,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:O===W&&(0,a.jsx)(kt,{size:14})}),handle:()=>{N(W),c.mode==="edit"&&H()}}})]},{icon:(0,a.jsx)(Ds,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!r||he(),handle:M},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!r,handle:async()=>{await je((await z()).contents),le({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(cs,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!I||u,handle:async()=>{let W=_a(tt());await F({configs:nt.fromEntries(W.map(go))});for(let ee of W)f({cellId:ee,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{g({})}},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{i((0,a.jsx)(Ft,{onClose:o}))}},{icon:(0,a.jsx)(fs,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{i((0,a.jsx)(Ft,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:j,hidden:!R||u,handle:()=>{v()}},{icon:(0,a.jsx)($s,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Es,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{C()}},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{b()}},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>m(!1,"code"),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>m(!0,"code"),redundant:!0},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>m(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>m(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(As,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(Ws,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>S(vo)},{icon:(0,a.jsx)(ls,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>P(ko)},{icon:(0,a.jsx)(ks,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>q(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Report an issue",additionalKeywords:["feedback","bug","issue","report","diagnostics"],handle:()=>i((0,a.jsx)(Bt,{onClose:o}))},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Resources",handle:ue,dropdown:[{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Documentation",handle:xo},{icon:(0,a.jsx)(Fs,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:bo},{icon:(0,a.jsx)(ms,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(hs,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:ho},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(bs,{size:14,strokeWidth:1.5}),label:"Open home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:uo}].filter(co).map(io),e[8]=g,e[9]=p,e[10]=R,e[11]=x,e[12]=b,e[13]=o,e[14]=y,e[15]=M,e[16]=w,e[17]=r,e[18]=I,e[19]=Y,e[20]=u,e[21]=_,e[22]=i,e[23]=$,e[24]=z,e[25]=k,e[26]=C,e[27]=F,e[28]=O,e[29]=d,e[30]=m,e[31]=S,e[32]=P,e[33]=N,e[34]=q,e[35]=B,e[36]=ae,e[37]=V,e[38]=l,e[39]=H,e[40]=v,e[41]=j,e[42]=f,e[43]=c.mode,e[44]=G):G=e[44],G}function io(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(lo)}:t}function lo(t){return!t.hidden}function co(t){return!t.hidden}function uo(){let t=Cs();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_blank","noopener")}function po(){window.open(K.releasesPage,"_blank")}function ho(){window.open(K.youtube,"_blank")}function fo(){window.open(K.discordLink,"_blank")}function bo(){window.open(K.githubPage,"_blank")}function xo(){window.open(K.docsPage,"_blank")}function yo(t){return!t}function ko(t){return!t}function vo(t){return!t}function go(t){return[t,{disabled:!1}]}function wo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(kt,{size:14})})}export{Gt as a,He as c,At as d,Wt as f,nn as i,Tt as l,la as n,Ut as o,Pt as p,ia as r,Ys as s,ro as t,Et 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-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-BTVjfrRP.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-TXkS1QI3.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/objects-BlG0ZrO0.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
|
package/package.json
CHANGED
|
@@ -101,31 +101,35 @@ export const ExportDialog: React.FC<{
|
|
|
101
101
|
})}
|
|
102
102
|
</TabsList>
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
formatLabel={definition.label}
|
|
118
|
-
status={status}
|
|
119
|
-
/>
|
|
104
|
+
{/* One panel per tab so each trigger's aria-controls resolves. */}
|
|
105
|
+
{formats.map(({ format: candidate }) => (
|
|
106
|
+
<TabsContent
|
|
107
|
+
key={candidate}
|
|
108
|
+
value={candidate}
|
|
109
|
+
className="mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3"
|
|
110
|
+
>
|
|
111
|
+
<div className="mb-3">
|
|
112
|
+
<h3 className="text-base font-semibold">{definition.label}</h3>
|
|
113
|
+
<p className="mt-0.5 text-sm text-muted-foreground">
|
|
114
|
+
{definition.description}
|
|
115
|
+
</p>
|
|
116
|
+
</div>
|
|
120
117
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
disabled={isExporting}
|
|
118
|
+
<FormatNotice
|
|
119
|
+
format={format}
|
|
120
|
+
formatLabel={definition.label}
|
|
121
|
+
status={status}
|
|
126
122
|
/>
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
|
|
124
|
+
{usesBrowserPrint ? null : (
|
|
125
|
+
<FormatOptions
|
|
126
|
+
options={options}
|
|
127
|
+
updateOptions={updateOptions}
|
|
128
|
+
disabled={isExporting}
|
|
129
|
+
/>
|
|
130
|
+
)}
|
|
131
|
+
</TabsContent>
|
|
132
|
+
))}
|
|
129
133
|
</Tabs>
|
|
130
134
|
|
|
131
135
|
<footer className="min-w-0 border-t bg-muted/20 px-4 py-3">
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
withLoadingToast,
|
|
22
22
|
} from "@/utils/download";
|
|
23
23
|
import { Filenames } from "@/utils/filenames";
|
|
24
|
+
import { Logger } from "@/utils/Logger";
|
|
24
25
|
import { Paths } from "@/utils/paths";
|
|
25
26
|
import { getExportCommand } from "./export-command";
|
|
26
27
|
import { exportNotebook } from "./export-notebook";
|
|
@@ -342,8 +343,9 @@ function useExportDialogAction({
|
|
|
342
343
|
if (mountedRef.current) {
|
|
343
344
|
onClose();
|
|
344
345
|
}
|
|
345
|
-
} catch {
|
|
346
|
-
//
|
|
346
|
+
} catch (error) {
|
|
347
|
+
// Most helpers toast actionable errors, but not all (e.g. updateCellOutputs).
|
|
348
|
+
Logger.error("Export failed", error);
|
|
347
349
|
} finally {
|
|
348
350
|
if (mountedRef.current) {
|
|
349
351
|
setIsExporting(false);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{s as Ye}from"./chunk-LvLJmgfZ.js";import{d as le,i as ua,l as Fe,p as ma,u as X}from"./useEvent-D91BmmQi.js";import{t as pa}from"./react-Bj1aDYRI.js";import{$n as ha,Bn as fa,Br as ba,E as Xe,Fr as Qe,Gn as Ze,Gr as xa,Hn as ya,In as ka,Ir as et,Jt as va,Lr as ga,Nt as tt,Qi as wa,T as ja,Vn as Ca,Vr as at,Wn as Na,g as Sa,m as st,na as nt,qi as za,t as Oa,ua as Ie,y as Ma,yi as _a}from"./cells-DLYs3NiJ.js";import{P as ot,T as pe,b as we}from"./zod-H_cgTO0M.js";import{t as $}from"./compiler-runtime-B3qBwwSJ.js";import{n as La,r as Fa,x as Ia}from"./ai-model-dropdown-CLCa-gsg.js";import{g as he,n as Pa}from"./useEventListener-C0195JsF.js";import{t as rt}from"./objects-BlG0ZrO0.js";import{C as Wa,r as Aa}from"./utils-BWBBpCkT.js";import{n as J,t as lt}from"./constants-CDyU_g2F.js";import{A as Da,M as je,N as fe,O as Ea,T as it,k as qa,v as dt}from"./config-DAL-jiRM.js";import{t as Ta}from"./switch-CONP-vq2.js";import{c as Ra}from"./readonly-python-code-DUjqXwhi.js";import{t as be}from"./cn-DYvqRARy.js";import{t as $a}from"./jsx-runtime-Blw4afVn.js";import{o as Ha}from"./alert-dialog-Bb8Lz8ko.js";import{a as Va,c as Ba,o as Ua,s as Ga}from"./popover-Bcz1Zikb.js";import{a as Ka,c as ct,i as ut,n as mt,r as Ja,s as pt,t as ht}from"./select-BP75_5jJ.js";import{$ as Ya,Lt as ft}from"./JsonOutput-Bk2exFh0.js";import{a as Xa,c as Qa,d as ce,o as Za,t as es}from"./download-DenADH0w.js";import{n as ts,t as as}from"./radio-group-BGXYy3u5.js";import{t as ss}from"./tooltip-4bZlU7jl.js";import{n as ns,r as os,t as ie}from"./button-DDGiD1NW.js";import{i as rs,r as bt,t as Pe}from"./strings--BknHX9C.js";import{r as ne}from"./requests-9-v2bhoi.js";import{t as A}from"./createLucideIcon-w-Qo9n0R.js";import{F as ls,I as is,L as xt,P as yt,a as kt,i as vt,u as ds}from"./layout-yfmf2ZBx.js";import{t as gt}from"./check-rzLRd0j9.js";import{r as cs}from"./useCellActionButton-uxVyv3JK.js";import{t as We}from"./code-B2aKtXoe.js";import{t as us}from"./copy-3iHFdt22.js";import{t as wt}from"./eye-off-BOZA7gbn.js";import{t as jt}from"./external-link-BOlXZUla.js";import{t as xe}from"./file-CJH9JNGH.js";import{t as Ct}from"./globe-Dwo3iXzC.js";import{n as ms,r as ps,t as hs}from"./youtube-OwaksuQt.js";import{n as fs}from"./components-K_Mi0vdC.js";import{t as bs}from"./house-DS0r7dNZ.js";import{t as Nt}from"./image-5XI2VU-q.js";import{t as xs}from"./link-CHdiBDr5.js";import{t as Ae}from"./spinner-D-V4psAa.js";import{r as ys}from"./input-JxFwu-3G.js";import{t as ks}from"./settings-D_PiwXwo.js";import{t as vs}from"./sparkles-DUCpRFlS.js";import{g as gs}from"./form-BsW7zr4t.js";import{t as ws}from"./square-DFICx2Qv.js";import{t as St}from"./triangle-alert-BL4YVsPy.js";import{t as de}from"./use-toast-BwJoaaDM.js";import{n as De,t as js}from"./paths-BKO-pHK6.js";import{o as Cs}from"./session-BmukRjSi.js";import{n as Ce}from"./copy-Bxb1_Gtw.js";import{t as Ee}from"./copy-icon-neDQUo4Q.js";import{r as Ns}from"./useRunCells-kmbsc2R5.js";import{a as qe,c as Te,i as Ss,n as Re,r as $e}from"./dialog-BCVepWLJ.js";import{n as Ne}from"./ImperativeModal-fY-ZfT0b.js";import{r as zs,t as zt}from"./share-852X_cqy.js";import{n as Ot,t as Mt}from"./alert-jlwhGxSb.js";import{a as _t}from"./cell-link-D0aELsL_.js";import{n as He}from"./useAsyncData-Bg5iAViP.js";import{t as Os}from"./icons-CIPE8AIY.js";import{i as Ms,n as Lt}from"./error-entries-4XYBryls.js";import{n as Ft,t as _s}from"./pair-with-agent-modal-C5OhJ8rX.js";import{n as It}from"./add-connection-dialog-BZaJAQCM.js";import{t as Ls}from"./github-A_zUd4Uj.js";import{n as Pt}from"./marimo-icons-yD_pAOm9.js";import{t as Fs}from"./links-ClNQSIal.js";import{i as Is,n as Ps,t as Ve}from"./skeleton-CPuDx7yn.js";import{t as Wt}from"./types-Bn-E0Dh-.js";var Ws=A("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),As=A("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),At=A("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"}]]),Dt=A("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"}]]),Et=A("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"}]]),Ds=A("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"}]]),Es=A("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"}]]),qs=A("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"}]]),qt=A("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Tt=A("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ts=A("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Rt=A("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"}]]),Rs=A("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"}]]),$s=A("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"}]]),$t=A("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"}]]),Hs=$(),D=Ye(pa(),1);function Be(t,e){let s=(0,Hs.c)(11),n;s[0]===e?n=s[1]:(n=new za(e),s[0]=e,s[1]=n);let r=n,l;s[2]!==t||s[3]!==r?(l=()=>r.get(t),s[2]=t,s[3]=r,s[4]=l):l=s[4];let[o,i]=(0,D.useState)(l),d;s[5]!==t||s[6]!==r?(d=m=>{i(m),r.set(t,m)},s[5]=t,s[6]=r,s[7]=d):d=s[7];let c=d,u;return s[8]!==c||s[9]!==o?(u=[o,c],s[8]=c,s[9]=o,s[10]=u):u=s[10],u}function Vs(t,e){return{...t,Binaries:{...t.Binaries,Browser:e}}}function Bs(t,e,s,n){return{marimo:t,Locale:s||void 0,Binaries:{Browser:e},"Environment Collection Error":n}}function Ue(t,e){let s=Math.max(2,...Array.from(e.matchAll(/`+/g),r=>r[0].length)),n="`".repeat(s+1);return`${n}${t}
|
|
2
|
-
${e}
|
|
3
|
-
${n}`}function Us(t,e){let s=t.includes("?")?"&":"?",n=[],r=t,l=0;for(let[o,i]of Object.entries(e)){if(i.length===0)continue;let d=`${o}=${encodeURIComponent(i)}`,c=`${r}${l===0?s:"&"}${d}`;if(c.length>6e3){n.push(o);continue}r=c,l+=1}return{url:r,omitted:n}}function Ge(t,e){return["<details>",`<summary>${Pe.htmlEscape(t)??""}</summary>`,"",e,"","</details>"].join(`
|
|
4
|
-
`)}function Gs(t){return Ge("Environment",Ue("json",JSON.stringify(t,null,2)))}function Ht(t){return Ge("Errors",Ue("text",t.map(Lt).join(`
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`)))}function Ks(t){return Ge("Code",Ue("python",t))}var Vt=$(),a=Ye($a(),1),Js=Pa,Bt=t=>{let e=(0,Vt.c)(16),{content:s}=t,[n,r]=(0,D.useState)(!1),l=!n&&"max-h-24 overflow-hidden",o;e[0]===l?o=e[1]:(o=be("text-xs bg-muted rounded p-2 overflow-x-auto whitespace-pre-wrap",l),e[0]=l,e[1]=o);let i;e[2]!==s||e[3]!==o?(i=(0,a.jsx)("pre",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4];let d;e[5]===n?d=e[6]:(d=!n&&(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-10 rounded-b bg-gradient-to-b from-transparent to-muted"}),e[5]=n,e[6]=d);let c;e[7]!==i||e[8]!==d?(c=(0,a.jsxs)("div",{className:"relative",children:[i,d]}),e[7]=i,e[8]=d,e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=()=>r(Xs),e[10]=u):u=e[10];let m=n?"Show less":"Show more",f;e[11]===m?f=e[12]:(f=(0,a.jsx)(ie,{type:"button",variant:"link",size:"xs",className:"self-start",onClick:u,children:m}),e[11]=m,e[12]=f);let b;return e[13]!==c||e[14]!==f?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[c,f]}),e[13]=c,e[14]=f,e[15]=b):b=e[15],b};const Ys=t=>{let e=(0,Vt.c)(6),{children:s}=t,{openModal:n,closeModal:r}=Ne(),l;e[0]!==r||e[1]!==n?(l=()=>n((0,a.jsx)(Ut,{onClose:r})),e[0]=r,e[1]=n,e[2]=l):l=e[2];let o;return e[3]!==s||e[4]!==l?(o=(0,a.jsx)(Js,{onClick:l,children:s}),e[3]=s,e[4]=l,e[5]=o):o=e[5],o},Ut=()=>{let{getEnvironmentInfo:t,readCode:e}=ne(),s=He(async()=>t(),[t]),n=X(Ma),r=(0,D.useMemo)(()=>Ms(ua),[n]),l=ds(n.cellIds.inOrderIds.map(y=>n.cellData[y])),o=X(wa),i=X(dt),d=o!==null&&l&&i.state===it.OPEN,c=d?void 0:o===null?"Save the notebook first.":l?"Connect the notebook to include its source.":"Notebook source is hidden in this view.",[u,m]=Be("marimo:issue-report:include-errors",!1),[f,b]=Be("marimo:issue-report:include-code",!1),p=s.data?Vs(s.data,navigator.userAgent):s.status==="error"?Bs(Ra(),navigator.userAgent,navigator.language,"Server environment information unavailable"):void 0,h=He(async()=>{if(!f||!d)return;let{contents:y}=await e();return y},[f,d,e]),{url:v,omitted:x}=(0,D.useMemo)(()=>{if(!p)return{url:J.bugReportUrl,omitted:[]};let y={env:Gs(p)};return u&&r.length>0&&(y["bug-description"]=Ht(r)),f&&h.data&&(y["reproduction-code"]=Ks(h.data)),Us(J.bugReportUrl,y)},[p,r,u,f,h.data]),g=x.map(y=>y==="bug-description"?"errors":y==="reproduction-code"?"code":y).join(", ");return(0,a.jsxs)(Re,{className:"w-[540px] max-w-[90vw]",children:[(0,a.jsxs)(qe,{children:[(0,a.jsx)(Te,{children:"Report an issue"}),(0,a.jsx)($e,{children:"Open a GitHub bug report prefilled with your environment, and optionally your current errors and notebook code. Nothing is uploaded automatically; review the details before posting."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4 max-h-[60vh] overflow-y-auto",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(ie,{type:"button",variant:"default",size:"xs",asChild:!0,className:"self-start",children:(0,a.jsxs)("a",{href:v,target:"_blank",rel:"noreferrer",children:[(0,a.jsx)(jt,{className:"w-4 h-4 mr-2"}),"Open GitHub issue"]})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(tt,{id:"issue-include-errors",checked:u,disabled:r.length===0,onCheckedChange:y=>m(y===!0),"aria-label":"Include errors"}),(0,a.jsx)("label",{htmlFor:"issue-include-errors",children:"Include errors"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(tt,{id:"issue-include-code",checked:f,disabled:!d,onCheckedChange:y=>b(y===!0),"aria-label":"Include notebook code"}),(0,a.jsx)("label",{htmlFor:"issue-include-code",children:"Include notebook code"})]}),c&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground ml-6",children:c}),f&&h.status==="error"&&(0,a.jsx)("span",{className:"text-xs text-(--red-11) ml-6",children:"Notebook source could not be loaded."})]})]}),g?(0,a.jsxs)("div",{className:"flex items-start gap-2 text-xs text-(--yellow-11)",children:[(0,a.jsx)(St,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),(0,a.jsxs)("span",{children:["Too large to prefill and left out of the link: ",g,". Paste them into the issue manually."]})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your environment is always included."})]}),s.status==="pending"&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading environment details\u2026"}),(0,a.jsx)(Ve,{className:"h-4 w-full"}),(0,a.jsx)(Ve,{className:"h-4 w-3/4"}),(0,a.jsx)(Ve,{className:"h-4 w-1/2"})]}),s.status==="error"&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(St,{className:"w-4 h-4 text-(--yellow-11) shrink-0"}),(0,a.jsx)("span",{children:"Server environment information unavailable"}),(0,a.jsx)(ie,{type:"button",variant:"link",size:"xs",onClick:()=>s.refetch(),children:"Retry"})]}),p&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Environment details"}),(0,a.jsx)(Ee,{className:"w-3.5 h-3.5",value:JSON.stringify(p,null,2),ariaLabel:"Copy environment JSON",toastTitle:"Environment details copied"})]}),(0,a.jsx)(Bt,{content:JSON.stringify(p,null,2)})]}),p&&r.length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Errors"}),(0,a.jsx)(Ee,{className:"w-3.5 h-3.5",value:Ht(r),ariaLabel:"Copy errors",toastTitle:"Errors copied"})]}),(0,a.jsx)(Bt,{content:r.map(Lt).join(`
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
`)})]}),p&&r.length===0&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"No errors detected."}),(0,a.jsx)("div",{className:"border-t pt-3",children:(0,a.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Other feedback? Take our"," ",(0,a.jsx)("a",{href:J.feedbackForm,target:"_blank",rel:"noreferrer",className:"underline",children:"two-minute survey"})," ","or chat with us on"," ",(0,a.jsx)("a",{href:J.discordLink,target:"_blank",rel:"noreferrer",className:"underline",children:"Discord"}),"."]})})]})]})};function Xs(t){return!t}var Gt=$(),Se="https://static.marimo.app";const Qs=t=>{let e=(0,Gt.c)(25),{onClose:s}=t,[n,r]=(0,D.useState)(""),{exportAsHTML:l}=ne(),o=`${n}-${Math.random().toString(36).slice(2,6)}`,i=`${Se}/static/${o}`,d;e[0]!==l||e[1]!==s||e[2]!==o?(d=async y=>{y.preventDefault(),s();let{contents:w}=await l({download:!1,includeCode:!0,files:yt.INSTANCE.filenames()}),k=de({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Se}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:w,path:o})}).catch(()=>{k.dismiss(),de({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:J.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),k.dismiss(),de({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."]})})},e[0]=l,e[1]=s,e[2]=o,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Te,{children:"Share static notebook"}),e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)(qe,{children:[c,(0,a.jsxs)($e,{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:Se,target:"_blank",children:Se}),"."]})]}),e[5]=u):u=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=y=>{r(y.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=m):m=e[6];let f;e[7]===n?f=e[8]:(f=(0,a.jsx)(ys,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:n,placeholder:"Notebook slug",onChange:m,required:!0,autoComplete:"off"}),e[7]=n,e[8]=f);let b;e[9]===i?b=e[10]:(b=(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)(Zs,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),e[9]=i,e[10]=b);let p;e[11]!==f||e[12]!==b?(p=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[f,b]}),e[11]=f,e[12]=b,e[13]=p):p=e[13];let h;e[14]===s?h=e[15]:(h=(0,a.jsx)(ie,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:s,children:"Cancel"}),e[14]=s,e[15]=h);let v;e[16]===i?v=e[17]:(v=(0,a.jsx)(ie,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Ce(i)},children:"Create"}),e[16]=i,e[17]=v);let x;e[18]!==h||e[19]!==v?(x=(0,a.jsxs)(Ss,{children:[h,v]}),e[18]=h,e[19]=v,e[20]=x):x=e[20];let g;return e[21]!==d||e[22]!==x||e[23]!==p?(g=(0,a.jsx)(Re,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[u,p,x]})}),e[21]=d,e[22]=x,e[23]=p,e[24]=g):g=e[24],g};var Zs=t=>{let e=(0,Gt.c)(8),[s,n]=D.useState(!1),r;e[0]===t.text?r=e[1]:(r=os.stopPropagation(async c=>{c.preventDefault(),await Ce(t.text),n(!0),setTimeout(()=>n(!1),2e3)}),e[0]=t.text,e[1]=r);let l=r,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)(us,{size:14,strokeWidth:1.5}),e[2]=o):o=e[2];let i;e[3]===l?i=e[4]:(i=(0,a.jsx)(ie,{"data-testid":"copy-static-notebook-url-button",onClick:l,size:"xs",variant:"secondary",children:o}),e[3]=l,e[4]=i);let d;return e[5]!==s||e[6]!==i?(d=(0,a.jsx)(ss,{content:"Copied!",open:s,children:i}),e[5]=s,e[6]=i,e[7]=d):d=e[7],d},en=$();function tn(){let t=document.getElementsByClassName(lt.outputArea);for(let e of t){let s=e.getBoundingClientRect();if(s.bottom>0&&s.top<window.innerHeight){let n=Ie.findElement(e);if(!n){he.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:Ie.parse(n.id)}}}return he.warn("No visible output area found for scroll anchor"),null}function an(t){if(!t){he.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(Ie.create(t.cellId));if(!e){he.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${lt.outputArea}`)){he.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function Kt(){let t=(0,en.c)(2),e=le(je),s;return t[0]===e?s=t[1]:(s=()=>{let n=tn();e(r=>({mode:Da(r.mode),cellAnchor:(n==null?void 0:n.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{an(n)})})},t[0]=e,t[1]=s),s}const Jt=ma(!1);var sn=$();const nn=()=>{let t=(0,sn.c)(7),{selectedLayout:e}=kt(),{setLayoutView:s}=vt();if(fe()&&!ha("wasm_layouts"))return null;let n;t[0]===s?n=t[1]:(n=i=>s(i),t[0]=s,t[1]=n);let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(pt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(ct,{placeholder:"Select a view"})}),t[2]=r):r=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(mt,{children:(0,a.jsxs)(Ja,{children:[(0,a.jsx)(Ka,{children:"View as"}),Wt.map(rn)]})}),t[3]=l):l=t[3];let o;return t[4]!==e||t[5]!==n?(o=(0,a.jsxs)(ht,{"data-testid":"layout-select",value:e,onValueChange:n,children:[r,l]}),t[4]=e,t[5]=n,t[6]=o):o=t[6],o};function on(t){return(0,a.jsx)(Yt(t),{className:"h-4 w-4"})}function Yt(t){switch(t){case"vertical":return qs;case"grid":return ps;case"slides":return Rt;default:return rs(t),ws}}function Xt(t){return Pe.startCase(t)}function rn(t){return(0,a.jsx)(ut,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[on(t),(0,a.jsx)("span",{children:Xt(t)})]})},t)}const Qt=["html","markdown","ipynb","pdf","script","png"],Zt=["pymdown","qmd","mystmd","mdx"],ea=["topological","top-down"],ta=["document","slides"],aa=["source","flat"];function sa(t){return typeof t=="string"&&Qt.some(e=>e===t)}const Y={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:"topological",includeOutputs:!1},pdf:{preset:"document",includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:"source"}};function te(t,e){return t.default(e).catch(e)}function ye(t){return ot(t).optional().catch(void 0)}var ln=ot({html:ye({includeCode:te(pe(),Y.html.includeCode)}),markdown:ye({flavor:te(we(Zt).nullable(),Y.markdown.flavor)}),ipynb:ye({sortMode:te(we(ea),Y.ipynb.sortMode),includeOutputs:te(pe(),Y.ipynb.includeOutputs)}),pdf:ye({preset:te(we(ta),Y.pdf.preset),includeInputs:te(pe(),Y.pdf.includeInputs),includeOutputs:te(pe(),Y.pdf.includeOutputs),webpdf:te(pe(),Y.pdf.webpdf)}),script:ye({type:te(we(aa),Y.script.type)})}).catch({});function na(t,e){let s={...t},n=r=>{s[r]={...t[r],...e[r]}};for(let r of Object.keys(e))n(r);return s}function dn(t){return na(Y,ln.parse(t))}const oa=nt("marimo:export:options:v1",Y,Ze({toSerializable:t=>t,fromSerializable:dn}),{getOnInit:!0}),cn=nt("marimo:export:last-format:v1","html",Ze({toSerializable:t=>t,fromSerializable:t=>sa(t)?t:"html"}),{getOnInit:!0});var ra={html:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},markdown:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},ipynb:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},pdf:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},script:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1},png:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1}};function la(t,e){return t==="wasm"&&e==="pdf"}function un({format:t,options:e,runtime:s,filename:n,availability:r}){let l=t==="script"&&e.script.type==="source"?{...ra.script,requiresNamedNotebookOnServer:!0}:ra[t],o=la(s,t);if(s==="wasm"&&l.requiresServerRuntime)return{available:o,reason:{type:"wasm-runtime"}};if(s==="server"&&l.requiresNamedNotebookOnServer&&!n)return{available:!1,reason:{type:"notebook-must-be-named"}};if(s==="wasm"||!l.checksServerAvailability)return{available:!0};if(r.status==="pending")return{available:!1,reason:{type:"checking-requirements"}};if(r.status==="error"||!r.data)return{available:!0,availabilityCheckFailed:!0};let i=r.data.formats.find(d=>d.format===t);return i?i.dependenciesAvailable?{available:!0}:{available:!1,reason:{type:"missing-packages",packages:i.missingPackages}}:{available:!0,availabilityCheckFailed:!0}}var Q=$();function ke(t,e){return t.map(s=>({value:s,...e[s]}))}var mn=ke(["automatic",...Zt],{automatic:{label:"Automatic",description:"Chooses a format from the notebook filename. Defaults to Markdown (.md)."},pymdown:{label:"Markdown (.md)",description:"Creates a .md file with Python code blocks."},qmd:{label:"Quarto (.qmd)",description:"Creates a .qmd file for Quarto."},mystmd:{label:"MyST (.myst.md)",description:"Creates a .myst.md file for MyST."},mdx:{label:"MDX (.mdx)",description:"Creates a .mdx file for MDX."}}),pn=ke(ea,{"top-down":{label:"Top to bottom",description:"Keeps cells in the same order as this notebook."},topological:{label:"Dependency order",description:"Reorders cells so each cell appears after the cells it depends on."}}),hn=ke(ta,{document:{label:"Document",description:"Creates pages for reading or printing."},slides:{label:"Slides",description:"Creates presentation slides from the notebook."}}),fn=ke(["browser","latex"],{browser:{label:"Browser",description:"Uses browser rendering to preserve the notebook's visual output."},latex:{label:"LaTeX first",description:"Uses Pandoc and TeX when available, then falls back to browser rendering."}}),bn=ke(aa,{source:{label:"Notebook source",description:"Downloads the saved notebook source for continued editing in marimo."},flat:{label:"Flat script",description:"Reorders cells so the Python script runs from top to bottom."}});const Ke={html:{label:"HTML",actionLabel:"Export HTML",description:"Save the current notebook as an HTML page.",Icon:Ct,Options:xn},markdown:{label:"Markdown",actionLabel:"Export Markdown",description:"Save code and text in a Markdown-based file. Cell outputs are not included.",Icon:Qe,Options:yn},ipynb:{label:"Jupyter",actionLabel:"Export Jupyter notebook",description:"Open the notebook in Jupyter and other compatible tools.",Icon:Tt,Options:kn},pdf:{label:"PDF",actionLabel:"Export PDF",description:"Save the notebook as a PDF for printing or sharing.",Icon:xe,Options:vn},script:{label:"Python",actionLabel:"Export flat script",description:"Save the notebook as a Python file.",Icon:We,Options:gn},png:{label:"PNG",actionLabel:"Export PNG",description:"Capture the current app view as an image.",Icon:Nt,Options:wn}};function xn(t){let e=(0,Q.c)(7),{options:s,updateOptions:n,disabled:r}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={checked:"Includes code cells in the webpage.",unchecked:"Leaves code cells out of the webpage."},e[0]=l):l=e[0];let o;e[1]===n?o=e[2]:(o=d=>n("html",{includeCode:d}),e[1]=n,e[2]=o);let i;return e[3]!==r||e[4]!==s.html.includeCode||e[5]!==o?(i=(0,a.jsx)(ve,{children:(0,a.jsx)(ze,{label:"Include code",descriptions:l,checked:s.html.includeCode,disabled:r,onCheckedChange:o})}),e[3]=r,e[4]=s.html.includeCode,e[5]=o,e[6]=i):i=e[6],i}function yn(t){let e=(0,Q.c)(6),{options:s,updateOptions:n,disabled:r}=t,l=s.markdown.flavor??"automatic",o;e[0]===n?o=e[1]:(o=d=>n("markdown",{flavor:d==="automatic"?null:d}),e[0]=n,e[1]=o);let i;return e[2]!==r||e[3]!==l||e[4]!==o?(i=(0,a.jsx)(ve,{children:(0,a.jsx)(Cn,{label:"Format",value:l,disabled:r,onValueChange:o,options:mn})}),e[2]=r,e[3]=l,e[4]=o,e[5]=i):i=e[5],i}function kn(t){let e=(0,Q.c)(16),{options:s,updateOptions:n,disabled:r}=t,l;e[0]===n?l=e[1]:(l=m=>n("ipynb",{sortMode:m}),e[0]=n,e[1]=l);let o;e[2]!==r||e[3]!==s.ipynb.sortMode||e[4]!==l?(o=(0,a.jsx)(Oe,{label:"Cell order",value:s.ipynb.sortMode,disabled:r,onValueChange:l,options:pn}),e[2]=r,e[3]=s.ipynb.sortMode,e[4]=l,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the Jupyter notebook."},e[6]=i):i=e[6];let d;e[7]===n?d=e[8]:(d=m=>n("ipynb",{includeOutputs:m}),e[7]=n,e[8]=d);let c;e[9]!==r||e[10]!==s.ipynb.includeOutputs||e[11]!==d?(c=(0,a.jsx)(ze,{label:"Include outputs",descriptions:i,checked:s.ipynb.includeOutputs,disabled:r,onCheckedChange:d}),e[9]=r,e[10]=s.ipynb.includeOutputs,e[11]=d,e[12]=c):c=e[12];let u;return e[13]!==o||e[14]!==c?(u=(0,a.jsxs)(ve,{children:[o,c]}),e[13]=o,e[14]=c,e[15]=u):u=e[15],u}function vn(t){let e=(0,Q.c)(30),{options:s,updateOptions:n,disabled:r}=t,l;e[0]===n?l=e[1]:(l=h=>n("pdf",{preset:h}),e[0]=n,e[1]=l);let o;e[2]!==r||e[3]!==s.pdf.preset||e[4]!==l?(o=(0,a.jsx)(Oe,{label:"Layout",value:s.pdf.preset,disabled:r,onValueChange:l,options:hn}),e[2]=r,e[3]=s.pdf.preset,e[4]=l,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i={checked:"Includes code cells in the PDF.",unchecked:"Leaves code cells out of the PDF."},e[6]=i):i=e[6];let d;e[7]===n?d=e[8]:(d=h=>n("pdf",{includeInputs:h}),e[7]=n,e[8]=d);let c;e[9]!==r||e[10]!==s.pdf.includeInputs||e[11]!==d?(c=(0,a.jsx)(ze,{label:"Include code",descriptions:i,checked:s.pdf.includeInputs,disabled:r,onCheckedChange:d}),e[9]=r,e[10]=s.pdf.includeInputs,e[11]=d,e[12]=c):c=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u={checked:"Keeps the outputs currently shown in the notebook.",unchecked:"Leaves cell outputs out of the PDF."},e[13]=u):u=e[13];let m;e[14]===n?m=e[15]:(m=h=>n("pdf",{includeOutputs:h}),e[14]=n,e[15]=m);let f;e[16]!==r||e[17]!==s.pdf.includeOutputs||e[18]!==m?(f=(0,a.jsx)(ze,{label:"Include outputs",descriptions:u,checked:s.pdf.includeOutputs,disabled:r,onCheckedChange:m}),e[16]=r,e[17]=s.pdf.includeOutputs,e[18]=m,e[19]=f):f=e[19];let b;e[20]!==r||e[21]!==s.pdf.preset||e[22]!==s.pdf.webpdf||e[23]!==n?(b=s.pdf.preset==="document"?(0,a.jsx)(Oe,{label:"Method",value:s.pdf.webpdf?"browser":"latex",disabled:r,onValueChange:h=>n("pdf",{webpdf:h==="browser"}),options:fn}):null,e[20]=r,e[21]=s.pdf.preset,e[22]=s.pdf.webpdf,e[23]=n,e[24]=b):b=e[24];let p;return e[25]!==o||e[26]!==c||e[27]!==f||e[28]!==b?(p=(0,a.jsxs)(ve,{children:[o,c,f,b]}),e[25]=o,e[26]=c,e[27]=f,e[28]=b,e[29]=p):p=e[29],p}function gn(t){let e=(0,Q.c)(6),{options:s,updateOptions:n,disabled:r}=t,l;e[0]===n?l=e[1]:(l=i=>n("script",{type:i}),e[0]=n,e[1]=l);let o;return e[2]!==r||e[3]!==s.script.type||e[4]!==l?(o=(0,a.jsx)(ve,{children:(0,a.jsx)(Oe,{label:"Format",value:s.script.type,disabled:r,onValueChange:l,options:bn})}),e[2]=r,e[3]=s.script.type,e[4]=l,e[5]=o):o=e[5],o}function wn(){return null}function ve(t){let e=(0,Q.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,a.jsx)("div",{className:"divide-y rounded-md border",children:s}),e[0]=s,e[1]=n),n}function ze(t){let e=(0,Q.c)(26),{label:s,descriptions:n,descriptionOverride:r,checked:l,disabled:o,onCheckedChange:i}=t,d=(0,D.useId)(),c=`${d}-description`,u=r??(l?n.checked:n.unchecked),m;e[0]===r?m=e[1]:(m=r?[r]:[],e[0]=r,e[1]=m);let f;e[2]!==n.checked||e[3]!==n.unchecked||e[4]!==m?(f=[n.checked,n.unchecked,...m],e[2]=n.checked,e[3]=n.unchecked,e[4]=m,e[5]=f):f=e[5];let b=f,p;e[6]!==d||e[7]!==s?(p=(0,a.jsx)("label",{htmlFor:d,className:"text-sm font-medium leading-5",children:s}),e[6]=d,e[7]=s,e[8]=p):p=e[8];let h;e[9]!==u||e[10]!==c||e[11]!==b?(h=(0,a.jsx)(Je,{id:c,description:u,possibleDescriptions:b}),e[9]=u,e[10]=c,e[11]=b,e[12]=h):h=e[12];let v;e[13]!==p||e[14]!==h?(v=(0,a.jsxs)("div",{className:"min-w-0",children:[p,h]}),e[13]=p,e[14]=h,e[15]=v):v=e[15];let x;e[16]!==l||e[17]!==c||e[18]!==o||e[19]!==d||e[20]!==s||e[21]!==i?(x=(0,a.jsx)(Ta,{id:d,size:"sm",checked:l,disabled:o,onCheckedChange:i,"aria-label":s,"aria-describedby":c}),e[16]=l,e[17]=c,e[18]=o,e[19]=d,e[20]=s,e[21]=i,e[22]=x):x=e[22];let g;return e[23]!==v||e[24]!==x?(g=(0,a.jsxs)("div",{className:"flex min-h-14 items-center justify-between gap-4 px-3 py-2",children:[v,x]}),e[23]=v,e[24]=x,e[25]=g):g=e[25],g}function Oe(t){var w;let e=(0,Q.c)(31),{label:s,value:n,disabled:r,onValueChange:l,options:o}=t,i=(0,D.useId)(),d=`${i}-description`,c;e[0]!==o||e[1]!==n?(c=(w=o.find(k=>k.value===n))==null?void 0:w.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]===s?m=e[4]:(m=(0,a.jsx)("div",{className:"text-sm font-medium leading-5",children:s}),e[3]=s,e[4]=m);let f=u??"",b;e[5]===o?b=e[6]:(b=o.map(jn),e[5]=o,e[6]=b);let p;e[7]!==d||e[8]!==f||e[9]!==b?(p=(0,a.jsx)(Je,{id:d,description:f,possibleDescriptions:b}),e[7]=d,e[8]=f,e[9]=b,e[10]=p):p=e[10];let h;e[11]!==m||e[12]!==p?(h=(0,a.jsxs)("div",{className:"min-w-0",children:[m,p]}),e[11]=m,e[12]=p,e[13]=h):h=e[13];let v;e[14]===l?v=e[15]:(v=k=>l(k),e[14]=l,e[15]=v);let x;if(e[16]!==i||e[17]!==o){let k;e[19]===i?k=e[20]:(k=(S,_)=>{let O=`${i}-${_}`;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ts,{id:O,value:S.value}),(0,a.jsx)("label",{htmlFor:O,className:"text-sm",children:S.label})]},S.value)},e[19]=i,e[20]=k),x=o.map(k),e[16]=i,e[17]=o,e[18]=x}else x=e[18];let g;e[21]!==d||e[22]!==r||e[23]!==s||e[24]!==v||e[25]!==x||e[26]!==n?(g=(0,a.jsx)(as,{value:n,onValueChange:v,className:"flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end","aria-label":s,"aria-describedby":d,disabled:r,children:x}),e[21]=d,e[22]=r,e[23]=s,e[24]=v,e[25]=x,e[26]=n,e[27]=g):g=e[27];let y;return e[28]!==h||e[29]!==g?(y=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[h,g]}),e[28]=h,e[29]=g,e[30]=y):y=e[30],y}function jn(t){return t.description}function Cn(t){var _;let e=(0,Q.c)(34),{label:s,value:n,disabled:r,onValueChange:l,options:o}=t,i=(0,D.useId)(),d=`${i}-description`,c;e[0]!==o||e[1]!==n?(c=(_=o.find(O=>O.value===n))==null?void 0:_.description,e[0]=o,e[1]=n,e[2]=c):c=e[2];let u=c,m;e[3]!==i||e[4]!==s?(m=(0,a.jsx)("label",{htmlFor:i,className:"text-sm font-medium leading-5",children:s}),e[3]=i,e[4]=s,e[5]=m):m=e[5];let f=u??"",b;e[6]===o?b=e[7]:(b=o.map(Sn),e[6]=o,e[7]=b);let p;e[8]!==d||e[9]!==f||e[10]!==b?(p=(0,a.jsx)(Je,{id:d,description:f,possibleDescriptions:b}),e[8]=d,e[9]=f,e[10]=b,e[11]=p):p=e[11];let h;e[12]!==m||e[13]!==p?(h=(0,a.jsxs)("div",{className:"min-w-0",children:[m,p]}),e[12]=m,e[13]=p,e[14]=h):h=e[14];let v;e[15]===l?v=e[16]:(v=O=>l(O),e[15]=l,e[16]=v);let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(ct,{}),e[17]=x):x=e[17];let g;e[18]!==d||e[19]!==i?(g=(0,a.jsx)(pt,{id:i,"aria-describedby":d,className:"h-8 w-full shrink-0 sm:w-44",children:x}),e[18]=d,e[19]=i,e[20]=g):g=e[20];let y;e[21]===o?y=e[22]:(y=o.map(Nn),e[21]=o,e[22]=y);let w;e[23]===y?w=e[24]:(w=(0,a.jsx)(mt,{children:y}),e[23]=y,e[24]=w);let k;e[25]!==r||e[26]!==w||e[27]!==v||e[28]!==g||e[29]!==n?(k=(0,a.jsxs)(ht,{value:n,disabled:r,onValueChange:v,children:[g,w]}),e[25]=r,e[26]=w,e[27]=v,e[28]=g,e[29]=n,e[30]=k):k=e[30];let S;return e[31]!==k||e[32]!==h?(S=(0,a.jsxs)("div",{className:"flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[h,k]}),e[31]=k,e[32]=h,e[33]=S):S=e[33],S}function Nn(t){return(0,a.jsx)(ut,{value:t.value,children:t.label},t.value)}function Sn(t){return t.description}function Je(t){let e=(0,Q.c)(15),{id:s,description:n,possibleDescriptions:r}=t,l;e[0]===r?l=e[1]:(l=new Set(r),e[0]=r,e[1]=l);let o;e[2]===l?o=e[3]:(o=[...l],e[2]=l,e[3]=o);let i;e[4]!==n||e[5]!==o?(i=o.filter(f=>f!==n),e[4]=n,e[5]=o,e[6]=i):i=e[6];let d=i,c;e[7]!==n||e[8]!==s?(c=(0,a.jsx)("p",{id:s,"aria-live":"polite",className:"col-start-1 row-start-1",children:n}),e[7]=n,e[8]=s,e[9]=c):c=e[9];let u;e[10]===d?u=e[11]:(u=d.map(zn),e[10]=d,e[11]=u);let m;return e[12]!==c||e[13]!==u?(m=(0,a.jsxs)("div",{className:"mt-0.5 grid text-xs leading-4 text-muted-foreground",children:[c,u]}),e[12]=c,e[13]=u,e[14]=m):m=e[14],m}function zn(t){return(0,a.jsx)("p",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:t},t)}var Me=$();function On(t){var c;let e=(0,Me.c)(10),{status:s}=t;if(s.available&&!s.availabilityCheckFailed)return null;if(((c=s.reason)==null?void 0:c.type)==="checking-requirements"){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[(0,a.jsx)(Ae,{size:"small",className:"size-3"}),(0,a.jsx)("span",{className:"sr-only",children:"Checking requirements"})]}),e[0]=u):u=e[0],u}let n=s.availabilityCheckFailed?"Requirements unknown":"Unavailable",r=s.availabilityCheckFailed?"text-muted-foreground":"text-(--yellow-11)",l;e[1]===r?l=e[2]:(l=be("size-3",r),e[1]=r,e[2]=l);let o;e[3]===l?o=e[4]:(o=(0,a.jsx)(at,{className:l}),e[3]=l,e[4]=o);let i;e[5]===n?i=e[6]:(i=(0,a.jsx)("span",{className:"sr-only",children:n}),e[5]=n,e[6]=i);let d;return e[7]!==o||e[8]!==i?(d=(0,a.jsxs)("span",{className:"ml-auto flex shrink-0",children:[o,i]}),e[7]=o,e[8]=i,e[9]=d):d=e[9],d}function Mn(t){let e=(0,Me.c)(5),{format:s,formatLabel:n,status:r}=t;if(r.availabilityCheckFailed){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(_e,{children:"Couldn't check whether this export is available. You can still try it."})}),e[0]=o):o=e[0],o}if(!r.reason)return null;let l;return e[1]!==s||e[2]!==n||e[3]!==r.reason?(l=(0,a.jsx)("div",{className:"mb-2.5",children:(0,a.jsx)(_n,{format:s,formatLabel:n,reason:r.reason})}),e[1]=s,e[2]=n,e[3]=r.reason,e[4]=l):l=e[4],l}function _e(t){let e=(0,Me.c)(3),{children:s}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,a.jsx)(at,{className:"mt-0.5 size-4 shrink-0 sm:mt-0"}),e[0]=n):n=e[0];let r;return e[1]===s?r=e[2]:(r=(0,a.jsxs)(Mt,{variant:"warning",className:"flex items-start gap-2.5 p-3 text-(--yellow-12) has-[svg]:pl-3 sm:items-center [&>svg]:static [&>svg+div]:translate-y-0",children:[n,(0,a.jsx)(Ot,{className:"min-w-0 flex-1 text-sm leading-5",children:s})]}),e[1]=s,e[2]=r),r}function _n(t){let e=(0,Me.c)(10),{format:s,formatLabel:n,reason:r}=t;switch(r.type){case"checking-requirements":{let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Ae,{className:"size-4 shrink-0",size:"small"}),e[0]=l):l=e[0];let o;return e[1]===n?o=e[2]:(o=(0,a.jsxs)(Mt,{role:"status",variant:"info",className:"flex items-center gap-2.5 p-3 has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0",children:[l,(0,a.jsxs)(Ot,{className:"min-w-0 flex-1 text-sm leading-5",children:["Checking ",n," requirements\u2026"]})]}),e[1]=n,e[2]=o),o}case"notebook-must-be-named":{let l;return e[3]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(_e,{children:"Name and save this notebook before exporting."}),e[3]=l):l=e[3],l}case"missing-packages":{let l;e[4]===r.packages?l=e[5]:(l=r.packages.join(", "),e[4]=r.packages,e[5]=l);let o;return e[6]===l?o=e[7]:(o=(0,a.jsxs)(_e,{children:["Install"," ",(0,a.jsx)("code",{className:"break-words font-mono",children:l})," ","where marimo is running to use this export."]}),e[6]=l,e[7]=o),o}case"wasm-runtime":{let l=s==="pdf"?"Use your browser's print dialog to save the current app view as a PDF.":"Open this notebook in a local marimo session to use this export.",o;return e[8]===l?o=e[9]:(o=(0,a.jsx)(_e,{children:l}),e[8]=l,e[9]=o),o}default:bt(r)}}var Ln={pymdown:"md",qmd:"qmd",mystmd:"myst.md",mdx:"mdx"},Fn=[".myst.md",".markdown",".qmd",".mdx",".md"];function In(t){return t.endsWith(".myst.md")?"mystmd":t.endsWith(".qmd")?"qmd":t.endsWith(".mdx")?"mdx":"pymdown"}function Pn(t,e){let s=Ln[e??In(t)],n=Fn.find(o=>t.endsWith(o)),r=ce.withoutExtension(t);n&&(r=t.slice(0,-n.length));let l=`${r}.${s}`;return l===t?`${t.slice(0,-(s.length+1))}.export.${s}`:l}function Wn(t){return Object.entries(t).flatMap(([e,s])=>s===null?[]:s===!0?[`--${e}`]:s===!1?[`--no-${e}`]:[`--${e}=${s}`])}function An(t){return t.preset==="document"?t.webpdf:null}var Dn={html:{subcommand:"html",flags:({html:t})=>({"include-code":t.includeCode}),outputFilename:t=>ce.toHTML(t)},markdown:{subcommand:"md",flags:({markdown:t})=>({flavor:t.flavor}),outputFilename:(t,{markdown:e})=>Pn(t,e.flavor)},ipynb:{subcommand:"ipynb",flags:({ipynb:t})=>({sort:t.sortMode,"include-outputs":t.includeOutputs}),outputFilename:t=>ce.toIPYNB(t)},pdf:{subcommand:"pdf",flags:({pdf:t})=>({as:t.preset,"include-inputs":t.includeInputs,"include-outputs":t.includeOutputs,webpdf:An(t)}),outputFilename:t=>ce.toPDF(t)},script:{subcommand:"script",flags:()=>({}),outputFilename:t=>`${ce.withoutExtension(t)}.script.py`}};function En({format:t,filename:e,options:s}){if(t==="png"||t==="script"&&s.script.type==="source"||!e)return null;let n=Dn[t];return["marimo","export",n.subcommand,Ft(e),...Wn(n.flags(s)),"-o",Ft(n.outputFilename(e,s))].join(" ")}async function qn(t){let{exportOptions:e,captureOutputs:s,downloadPDF:n}=t;e.includeOutputs&&await s(),await n(e)}async function Tn({format:t,options:e,requests:s,sourceFilename:n,htmlFiles:r,captureOutputs:l,capturePNG:o,downloadFile:i}){switch(t){case"html":i(await s.exportAsHTML({download:!1,files:r,includeCode:e.html.includeCode}));return;case"markdown":i(await s.exportAsMarkdown({download:!1,flavor:e.markdown.flavor}));return;case"ipynb":e.ipynb.includeOutputs&&await l(),i(await s.exportAsIPYNB({download:!1,sortMode:e.ipynb.sortMode,includeOutputs:e.ipynb.includeOutputs}));return;case"pdf":await qn({exportOptions:e.pdf,captureOutputs:l,downloadPDF:async d=>{i(await s.exportAsPDF(d))}});return;case"script":if(e.script.type==="source"){i({contents:(await s.readCode()).contents,filename:n,mediaType:"text/plain"});return}i(await s.exportAsScript({download:!1}));return;case"png":await o();return;default:bt(t)}}var ia=$(),Rn={source:{actionLabel:"Export notebook source",progressLabel:"notebook source"},flat:{actionLabel:"Export flat script",progressLabel:"flat script"}};function $n(t,e){if(t==="wasm")return{status:"success",data:null};switch(e.status){case"pending":case"loading":return{status:"pending"};case"error":return{status:"error"};case"success":return{status:"success",data:e.data}}}function Hn(t,e){return t==="server"&&e?De.basename(e):ce.toPY(document.title)}function Vn({usesBrowserPrint:t,hasCommand:e,format:s,isNotebookSource:n}){return t?"Uses the browser's print settings for page size and filename.":e?"Uses the current session state. The copied command exports the saved notebook.":s!=="png"&&!n?"Save the notebook to copy an equivalent shell command.":null}function Bn(t){let e=(0,ia.c)(52),s=_t(),[n,r]=Fe(oa),[l,o]=Fe(cn),[i,d]=(0,D.useState)(t??l),c=fe()?"wasm":"server",u=ne(),m,f;e[0]===u?(m=e[1],f=e[2]):(m=async()=>c==="wasm"?null:u.getExportAvailability(),f=[c,u],e[0]=u,e[1]=m,e[2]=f);let b=He(m,f),p,h;if(e[3]!==b||e[4]!==s||e[5]!==i||e[6]!==n){let j=$n(c,b),L=C=>un({format:C,options:n,runtime:c,filename:s,availability:j});p=L(i),h=Qt.map(C=>({format:C,status:L(C)})),e[3]=b,e[4]=s,e[5]=i,e[6]=n,e[7]=p,e[8]=h}else p=e[7],h=e[8];let v=h,x,g,y,w,k;if(e[9]!==s||e[10]!==i||e[11]!==n){k=la(c,i);let j=Ke[i],L=i==="script"&&n.script.type==="source",C;e[17]!==j||e[18]!==i||e[19]!==n?(C=i==="script"?Rn[n.script.type]:{actionLabel:j.actionLabel,progressLabel:j.label},e[17]=j,e[18]=i,e[19]=n,e[20]=C):C=e[20],{actionLabel:x,progressLabel:y}=C,g=k?null:En({format:i,filename:s,options:n}),w=Vn({usesBrowserPrint:k,hasCommand:!!g,format:i,isNotebookSource:L}),e[9]=s,e[10]=i,e[11]=n,e[12]=x,e[13]=g,e[14]=y,e[15]=w,e[16]=k}else x=e[12],g=e[13],y=e[14],w=e[15],k=e[16];let S=w,_,O;e[21]!==t||e[22]!==o?(_=()=>{t&&o(t)},O=[t,o],e[21]=t,e[22]=o,e[23]=_,e[24]=O):(_=e[23],O=e[24]),(0,D.useEffect)(_,O);let R;e[25]===o?R=e[26]:(R=j=>{sa(j)&&(d(j),o(j))},e[25]=o,e[26]=R);let V=R,P;e[27]===r?P=e[28]:(P=(j,L)=>{r(C=>{let q={...C};return q[j]={...C[j],...L},q})},e[27]=r,e[28]=P);let E=P,M;e[29]!==x||e[30]!==g||e[31]!==S||e[32]!==i||e[33]!==p||e[34]!==k?(M={format:i,status:p,usesBrowserPrint:k,actionLabel:x,command:g,footerDescription:S},e[29]=x,e[30]=g,e[31]=S,e[32]=i,e[33]=p,e[34]=k,e[35]=M):M=e[35];let F;e[36]===s?F=e[37]:(F=Hn(c,s),e[36]=s,e[37]=F);let I;e[38]!==i||e[39]!==n||e[40]!==y||e[41]!==p.available||e[42]!==F||e[43]!==k?(I={format:i,options:n,sourceFilename:F,available:p.available,usesBrowserPrint:k,progressLabel:y},e[38]=i,e[39]=n,e[40]=y,e[41]=p.available,e[42]=F,e[43]=k,e[44]=I):I=e[44];let W;return e[45]!==v||e[46]!==n||e[47]!==V||e[48]!==I||e[49]!==M||e[50]!==E?(W={formats:v,options:n,selected:M,exportRequest:I,selectFormat:V,updateOptions:E},e[45]=v,e[46]=n,e[47]=V,e[48]=I,e[49]=M,e[50]=E,e[51]=W):W=e[51],W}async function Un(t){let e=document.getElementById("App");if(!e){let r="The current app view could not be captured.";throw de({title:"Failed to download as PNG",description:r,variant:"danger"}),Error(r)}let s=t==null?void 0:t.style.visibility,n=t==null?void 0:t.classList.contains("print:hidden");if(!await Za({element:e,filename:document.title,prepare:()=>{let r=es();return t&&(t.classList.add("print:hidden"),t.style.visibility="hidden"),()=>{r(),t&&(n||t.classList.remove("print:hidden"),t.style.visibility=s??"")}}}))throw Error("Failed to capture the current app view.")}function Gn(t){t(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function Kn({format:t,options:e,sourceFilename:s,available:n,usesBrowserPrint:r,progressLabel:l,onClose:o}){let i=ne(),d=Is(),c=X(je),u=le(je),[m,f]=(0,D.useState)(!1),b=(0,D.useRef)(null),p=(0,D.useRef)(!0);(0,D.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let h=async x=>{await Ps({takeScreenshots:()=>d({progress:x}),updateCellOutputs:i.updateCellOutputs})},v=async()=>{let x=()=>{var g;return Un(((g=b.current)==null?void 0:g.parentElement)??null)};if(c.mode!=="edit"){await x();return}try{await qa(x)}finally{u(c)}};return{dialogRef:b,isExporting:m,submit:async()=>{if(!(!n||m)){if(r){Gn(o);return}f(!0);try{await Qa(`Exporting ${l}\u2026`,async x=>{await Tn({format:t,options:e,requests:i,sourceFilename:s,htmlFiles:yt.INSTANCE.filenames(),captureOutputs:()=>h(x),capturePNG:v,downloadFile:Xa})}),p.current&&o()}catch{}finally{p.current&&f(!1)}}}}}function Jn(t){let e=(0,ia.c)(14),{initialFormat:s,onClose:n}=t,r=Bn(s),l,o,i;e[0]===r?(l=e[1],o=e[2],i=e[3]):({exportRequest:l,selectFormat:o,...i}=r,e[0]=r,e[1]=l,e[2]=o,e[3]=i);let d;e[4]!==l||e[5]!==n?(d={...l,onClose:n},e[4]=l,e[5]=n,e[6]=d):d=e[6];let c=Kn(d),u;e[7]!==c||e[8]!==o?(u=f=>{c.isExporting||o(f)},e[7]=c,e[8]=o,e[9]=u):u=e[9];let m;return e[10]!==c||e[11]!==i||e[12]!==u?(m={...i,...c,selectFormat:u},e[10]=c,e[11]=i,e[12]=u,e[13]=m):m=e[13],m}var Yn=$(),Xn="(min-width: 640px)";const Qn=t=>{let e=(0,Yn.c)(70),{initialFormat:s,onClose:n,returnFocusRef:r}=t,l;e[0]!==s||e[1]!==n?(l={initialFormat:s,onClose:n},e[0]=s,e[1]=n,e[2]=l):l=e[2];let{dialogRef:o,isExporting:i,formats:d,options:c,selected:u,selectFormat:m,updateOptions:f,submit:b}=Jn(l),p=Ya(Xn),{format:h,status:v,usesBrowserPrint:x,actionLabel:g,command:y,footerDescription:w}=u,k=Ke[h],S=k.Options,_;e[3]===r?_=e[4]:(_=r?{onCloseAutoFocus:N=>{var T;N.preventDefault(),(T=r.current)==null||T.focus()}}:{},e[3]=r,e[4]=_);let O=_,R;e[5]===Symbol.for("react.memo_cache_sentinel")?(R=(0,a.jsxs)(qe,{className:"border-b px-5 py-4 pr-12",children:[(0,a.jsx)(Te,{children:"Export notebook"}),(0,a.jsx)($e,{children:"Choose a format and adjust its options."})]}),e[5]=R):R=e[5];let V=p?"vertical":"horizontal",P;if(e[6]!==d||e[7]!==i){let N;e[9]===i?N=e[10]:(N=T=>{let{format:H,status:Le}=T,ge=Ke[H];return(0,a.jsxs)(Ba,{value:H,disabled:i,className:"min-w-0 justify-start gap-2 px-2.5 py-2 text-xs data-[state=active]:shadow-xs sm:w-full sm:text-sm","data-testid":`export-format-${H}`,children:[(0,a.jsx)(ge.Icon,{className:"size-3.5 shrink-0",strokeWidth:1.5}),(0,a.jsx)("span",{className:"truncate",children:ge.label}),(0,a.jsx)(On,{status:Le})]},H)},e[9]=i,e[10]=N),P=d.map(N),e[6]=d,e[7]=i,e[8]=P}else P=e[8];let E;e[11]===P?E=e[12]:(E=(0,a.jsx)(Ga,{"aria-label":"Export format",className:"grid max-h-none shrink-0 grid-cols-2 items-stretch justify-start gap-1 overflow-auto rounded-none border-b bg-muted/20 p-2 min-[360px]:grid-cols-3 sm:flex sm:h-full sm:flex-col sm:border-b-0 sm:border-r",children:P}),e[11]=P,e[12]=E);let M;e[13]===k.label?M=e[14]:(M=(0,a.jsx)("h3",{className:"text-base font-semibold",children:k.label}),e[13]=k.label,e[14]=M);let F;e[15]===k.description?F=e[16]:(F=(0,a.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:k.description}),e[15]=k.description,e[16]=F);let I;e[17]!==M||e[18]!==F?(I=(0,a.jsxs)("div",{className:"mb-3",children:[M,F]}),e[17]=M,e[18]=F,e[19]=I):I=e[19];let W;e[20]!==k.label||e[21]!==h||e[22]!==v?(W=(0,a.jsx)(Mn,{format:h,formatLabel:k.label,status:v}),e[20]=k.label,e[21]=h,e[22]=v,e[23]=W):W=e[23];let j;e[24]!==S||e[25]!==i||e[26]!==c||e[27]!==f||e[28]!==x?(j=x?null:(0,a.jsx)(S,{options:c,updateOptions:f,disabled:i}),e[24]=S,e[25]=i,e[26]=c,e[27]=f,e[28]=x,e[29]=j):j=e[29];let L;e[30]!==h||e[31]!==W||e[32]!==j||e[33]!==I?(L=(0,a.jsxs)(Ua,{value:h,className:"mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3",children:[I,W,j]}),e[30]=h,e[31]=W,e[32]=j,e[33]=I,e[34]=L):L=e[34];let C;e[35]!==h||e[36]!==m||e[37]!==L||e[38]!==V||e[39]!==E?(C=(0,a.jsxs)(Va,{value:h,onValueChange:m,orientation:V,className:"flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]",children:[E,L]}),e[35]=h,e[36]=m,e[37]=L,e[38]=V,e[39]=E,e[40]=C):C=e[40];let q;e[41]===y?q=e[42]:(q=y?(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-background px-2.5 py-2 font-mono text-xs",children:[(0,a.jsx)("span",{className:"select-none text-muted-foreground","aria-hidden":!0,children:"$"}),(0,a.jsx)("code",{className:"min-w-0 flex-1 overflow-x-auto whitespace-nowrap","data-testid":"export-cli-command","aria-label":"Equivalent POSIX shell command",children:y}),(0,a.jsx)(Ee,{value:y,className:"size-3.5",buttonClassName:be(ns({variant:"ghost",size:"icon"}),"shrink-0"),tooltip:"Copy POSIX shell command",ariaLabel:"Copy POSIX shell command",toastTitle:"Command copied"})]}):null,e[41]=y,e[42]=q);let ae=y&&"mt-3",B;e[43]===ae?B=e[44]:(B=be("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",ae),e[43]=ae,e[44]=B);let U;e[45]===w?U=e[46]:(U=w?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:w}):null,e[45]=w,e[46]=U);let oe=!v.available||i,me=!w&&"sm:ml-auto",G;e[47]===me?G=e[48]:(G=be("border-(--blue-11) bg-(--blue-11) hover:border-(--blue-12) hover:bg-(--blue-12) sm:min-w-36 dark:border-(--blue-7) dark:bg-(--blue-5) dark:text-(--blue-12) dark:hover:border-(--blue-8) dark:hover:bg-(--blue-6)",me),e[47]=me,e[48]=G);let z;e[49]===i?z=e[50]:(z=i&&(0,a.jsx)(Ae,{size:"small",className:"mr-2","aria-hidden":!0}),e[49]=i,e[50]=z);let se=x?"Print to PDF":g,K;e[51]!==i||e[52]!==b||e[53]!==oe||e[54]!==G||e[55]!==z||e[56]!==se?(K=(0,a.jsxs)(ie,{type:"button",disabled:oe,"aria-busy":i,onClick:b,className:G,"data-testid":"export-submit",children:[z,se]}),e[51]=i,e[52]=b,e[53]=oe,e[54]=G,e[55]=z,e[56]=se,e[57]=K):K=e[57];let Z;e[58]!==B||e[59]!==U||e[60]!==K?(Z=(0,a.jsxs)("div",{className:B,children:[U,K]}),e[58]=B,e[59]=U,e[60]=K,e[61]=Z):Z=e[61];let ee;e[62]!==q||e[63]!==Z?(ee=(0,a.jsxs)("footer",{className:"min-w-0 border-t bg-muted/20 px-4 py-3",children:[q,Z]}),e[62]=q,e[63]=Z,e[64]=ee):ee=e[64];let re;return e[65]!==o||e[66]!==O||e[67]!==C||e[68]!==ee?(re=(0,a.jsxs)(Re,{ref:o,className:"grid h-dvh max-h-[760px] min-w-0 w-[calc(100vw-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:top-[5vh] sm:h-[90vh] sm:max-h-[640px] sm:max-w-3xl","data-testid":"export-dialog",...O,children:[R,C,ee]}),e[65]=o,e[66]=O,e[67]=C,e[68]=ee,e[69]=re):re=e[69],re};var Zn=$();function eo(t){let e=(0,Zn.c)(5),{openPrompt:s,closeModal:n}=Ne(),{sendCopy:r}=ne(),l;return e[0]!==n||e[1]!==s||e[2]!==r||e[3]!==t?(l=()=>{if(!t)return null;let o=js.guessDeliminator(t);s({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${De.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=o.join(De.dirname(t),i);r({source:t,destination:d}).then(()=>{n(),de({title:"Notebook copied",description:"A copy of the notebook has been created."}),Fs(d)})}})},e[0]=n,e[1]=s,e[2]=r,e[3]=t,e[4]=l):l=e[4],l}var to=$();function da(){let t=(0,to.c)(4),{openConfirm:e}=Ne(),s=le(dt),{sendRestart:n}=ne(),r;return t[0]!==e||t[1]!==n||t[2]!==s?(r=()=>{e({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)(Ha,{onClick:async()=>{s({state:it.CLOSING}),await n(),zs()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=n,t[2]=s,t[3]=r):r=t[3],r}var ao=$(),so=new va,no=t=>so.isSupported(t)?"markdown":"code";const ca=()=>{let t=(0,ao.c)(3),{updateCellConfig:e}=Xe(),{saveCellConfig:s}=ne(),n;return t[0]!==s||t[1]!==e?(n=async(r,l)=>{let o=st(),i={};for(let c of o.cellIds.inOrderIds){let u=o.cellData[c];u===void 0||u.config.hide_code===r||no(u.code)===l&&(i[c]={hide_code:r})}let d=rt.entries(i);if(d.length!==0){await s({configs:i});for(let[c,u]of d)e({cellId:c,config:u})}},t[0]=s,t[1]=e,t[2]=n):n=t[2],n};var oo=$(),ue=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function ro(t){var Z,ee,re;let e=(0,oo.c)(45),s;e[0]===t?s=e[1]:(s=t===void 0?{}:t,e[0]=t,e[1]=s);let{exportDialogReturnFocusRef:n}=s,r=_t(),{openModal:l,closeModal:o}=Ne(),{toggleApplication:i}=fa(),{selectedPanel:d}=Ca(),[c]=Fe(je),u=X(Ea),m=ca(),[f]=Wa(),b=X(ka),p=X(Aa),{updateCellConfig:h,undoDeleteCell:v,clearAllCellOutputs:x,addSetupCellIfDoesntExist:g,collapseAllCells:y,expandAllCells:w}=Xe(),k=da(),S=Ns(),_=eo(r),O=le(Jt),R=le(La),{handleClick:V}=Fa(),P=le(Ia),E=le(oa),{readCode:M,saveCellConfig:F}=ne(),I=X(Sa),W=X(Oa),j=X(ja),{selectedLayout:L}=kt(),{setLayoutView:C}=vt(),q=Kt(),ae=((Z=f.sharing)==null?void 0:Z.html)??!0,B=((ee=f.sharing)==null?void 0:ee.wasm)??!0,U=((re=f.sharing)==null?void 0:re.molab)??!0,oe=L==="slides",me=wo,G;e[2]!==o||e[3]!==n||e[4]!==l||e[5]!==E?(G=(N,T)=>{T&&E(H=>na(H,T)),l((0,a.jsx)(Qn,{initialFormat:N,onClose:o,returnFocusRef:n}))},e[2]=o,e[3]=n,e[4]=l,e[5]=E,e[6]=G):G=e[6];let z=G,se;e[7]===Symbol.for("react.memo_cache_sentinel")?(se=(0,a.jsx)(ft,{size:14,strokeWidth:1.5}),e[7]=se):se=e[7];let K;return e[8]!==g||e[9]!==p||e[10]!==W||e[11]!==b||e[12]!==x||e[13]!==o||e[14]!==y||e[15]!==_||e[16]!==w||e[17]!==r||e[18]!==I||e[19]!==oe||e[20]!==u||e[21]!==z||e[22]!==l||e[23]!==V||e[24]!==M||e[25]!==k||e[26]!==S||e[27]!==F||e[28]!==L||e[29]!==d||e[30]!==m||e[31]!==O||e[32]!==P||e[33]!==C||e[34]!==R||e[35]!==ae||e[36]!==U||e[37]!==B||e[38]!==i||e[39]!==q||e[40]!==v||e[41]!==j||e[42]!==h||e[43]!==c.mode?(K=[{icon:se,label:"Export\u2026",additionalKeywords:["download","html","markdown","ipynb","pdf","script","png"],handle:()=>z()},{icon:(0,a.jsx)(ft,{size:14,strokeWidth:1.5}),label:"Download",handle:ue,dropdown:[{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:()=>z("html",{html:{includeCode:!0}})},{icon:(0,a.jsx)(xt,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:()=>z("html",{html:{includeCode:!1}})},{icon:(0,a.jsx)(Os,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:()=>z("markdown")},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:()=>z("ipynb")},{icon:(0,a.jsx)(We,{size:14,strokeWidth:1.5}),label:"Download notebook source",handle:()=>z("script",{script:{type:"source"}})},{icon:(0,a.jsx)(We,{size:14,strokeWidth:1.5}),label:"Download flat script",handle:()=>z("script",{script:{type:"flat"}})},{divider:!0,icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"Download as PNG",handle:()=>z("png")},oe?{divider:!0,icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:ue,dropdown:[{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:()=>z("pdf",{pdf:{preset:"document"}})},{icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Slides Layout",hidden:fe(),rightElement:(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}),handle:()=>z("pdf",{pdf:{preset:"slides"}})}]}:{divider:!0,icon:(0,a.jsx)(xe,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:()=>z("pdf",{pdf:{preset:"document"}})}]},{icon:(0,a.jsx)(vs,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:fe(),handle:async()=>{l((0,a.jsx)(_s,{onClose:o}))}},{icon:(0,a.jsx)(Rs,{size:14,strokeWidth:1.5}),label:"Share",handle:ue,hidden:!ae&&!B&&!U,dropdown:[{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!ae,handle:async()=>{l((0,a.jsx)(Qs,{onClose:o}))}},{icon:(0,a.jsx)(xs,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!B,handle:async()=>{await Ce(zt({code:(await M()).contents})),de({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!U,handle:async()=>{let N=zt({code:(await M()).contents,baseUrl:`${J.molab}/new`});window.open(N,"_blank")}}]},{icon:(0,a.jsx)(Ts,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:ue,dropdown:ya.flatMap(N=>{let T=N.type==="ai"&&!p;if(Na({panel:N,capabilities:b,aiEnabled:p})&&!T)return[];let{type:H,Icon:Le,additionalKeywords:ge}=N;return{label:Pe.startCase(H),rightElement:me(d===H),icon:(0,a.jsx)(Le,{size:14,strokeWidth:1.5}),handle:()=>{if(T){V("ai","ai-features");return}i(H)},additionalKeywords:ge}})},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"Present as",handle:ue,dropdown:[{icon:c.mode==="present"?(0,a.jsx)(gs,{size:14,strokeWidth:1.5}):(0,a.jsx)(ls,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...Wt.map((N,T)=>{let H=Yt(N);return{divider:T===0,label:Xt(N),icon:(0,a.jsx)(H,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:L===N&&(0,a.jsx)(gt,{size:14})}),handle:()=>{C(N),c.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(Es,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!r||fe(),handle:_},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!r,handle:async()=>{await Ce((await M()).contents),de({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(cs,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!I||u,handle:async()=>{let N=_a(st());await F({configs:rt.fromEntries(N.map(go))});for(let T of N)h({cellId:T,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{g({})}},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{l((0,a.jsx)(It,{onClose:o}))}},{icon:(0,a.jsx)(fs,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{l((0,a.jsx)(It,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)($t,{size:14,strokeWidth:1.5}),label:j,hidden:!W||u,handle:()=>{v()}},{icon:(0,a.jsx)($s,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:k,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ds,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{S()}},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{x()}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>m(!1,"code"),redundant:!0},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>m(!0,"code"),redundant:!0},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>m(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>m(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(As,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(Ws,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>O(vo)},{icon:(0,a.jsx)(is,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>P(ko)},{icon:(0,a.jsx)(ks,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>R(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(qt,{size:14,strokeWidth:1.5}),label:"Report an issue",additionalKeywords:["feedback","bug","issue","report","diagnostics"],handle:()=>l((0,a.jsx)(Ut,{onClose:o}))},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Resources",handle:ue,dropdown:[{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Documentation",handle:xo},{icon:(0,a.jsx)(Ls,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:bo},{icon:(0,a.jsx)(ms,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(hs,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:ho},{icon:(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(bs,{size:14,strokeWidth:1.5}),label:"Open home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:uo}].filter(co).map(lo),e[8]=g,e[9]=p,e[10]=W,e[11]=b,e[12]=x,e[13]=o,e[14]=y,e[15]=_,e[16]=w,e[17]=r,e[18]=I,e[19]=oe,e[20]=u,e[21]=z,e[22]=l,e[23]=V,e[24]=M,e[25]=k,e[26]=S,e[27]=F,e[28]=L,e[29]=d,e[30]=m,e[31]=O,e[32]=P,e[33]=C,e[34]=R,e[35]=ae,e[36]=U,e[37]=B,e[38]=i,e[39]=q,e[40]=v,e[41]=j,e[42]=h,e[43]=c.mode,e[44]=K):K=e[44],K}function lo(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(io)}:t}function io(t){return!t.hidden}function co(t){return!t.hidden}function uo(){let t=Cs();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_blank","noopener")}function po(){window.open(J.releasesPage,"_blank")}function ho(){window.open(J.youtube,"_blank")}function fo(){window.open(J.discordLink,"_blank")}function bo(){window.open(J.githubPage,"_blank")}function xo(){window.open(J.docsPage,"_blank")}function yo(t){return!t}function ko(t){return!t}function vo(t){return!t}function go(t){return[t,{disabled:!1}]}function wo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(gt,{size:14})})}export{Jt as a,Be as c,Et as d,Dt as f,nn as i,$t as l,ca as n,Kt as o,At as p,da as r,Ys as s,ro as t,qt as u};
|