@marimo-team/frontend 0.23.14-dev25 → 0.23.14-dev30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/assets/{cell-editor-3PkTaSur.js → cell-editor-DeAW5cIb.js} +1 -1
  2. package/dist/assets/{command-palette-D2gzhCzl.js → command-palette-DuB4v96S.js} +1 -1
  3. package/dist/assets/{edit-page-BU3ek7Rt.js → edit-page-C2hff1e_.js} +4 -4
  4. package/dist/assets/{hooks-Q3y983ON.js → hooks-BtDf7O9d.js} +1 -1
  5. package/dist/assets/{index-Co7t4LPQ.js → index-C9lIEelG.js} +15 -15
  6. package/dist/assets/layout-CIuQ8Vb3.js +9 -0
  7. package/dist/assets/{panels-ClMIloyA.js → panels-ntqecwQW.js} +1 -1
  8. package/dist/assets/{reveal-component-BMfGxbyk.js → reveal-component-CSNvXKBK.js} +54 -54
  9. package/dist/assets/{run-page-D_AovSqt.js → run-page-DSYUUqE5.js} +1 -1
  10. package/dist/assets/{scratchpad-panel-BpvYuSq5.js → scratchpad-panel-r1Y1r0ML.js} +1 -1
  11. package/dist/assets/{useNotebookActions-C2TVewtT.js → useNotebookActions-C4iWpqNG.js} +1 -1
  12. package/dist/index.html +1 -1
  13. package/package.json +1 -1
  14. package/src/components/data-table/charts/__tests__/merge-index-fields.test.ts +33 -0
  15. package/src/components/data-table/charts/charts.tsx +24 -1
  16. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +7 -2
  17. package/src/components/slides/__tests__/slide.test.tsx +33 -0
  18. package/src/components/slides/minimap.tsx +7 -1
  19. package/src/components/slides/reveal-component.tsx +3 -0
  20. package/src/components/slides/slide-cell-view.tsx +3 -0
  21. package/src/components/slides/slide.tsx +16 -13
  22. package/src/plugins/impl/DataTablePlugin.tsx +1 -0
  23. package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +53 -2
  24. package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +52 -2
  25. package/dist/assets/layout-CoL1gz3N.js +0 -9
@@ -1 +1 @@
1
- import{s as E}from"./chunk-LvLJmgfZ.js";import{p as $,u as T}from"./useEvent-D91BmmQi.js";import{t as D}from"./react-Bj1aDYRI.js";import{E as L,b as W,h as q,ji as F}from"./cells-C3u7zgmc.js";import"./react-dom-CSu739Rf.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{x as M}from"./utils-Dev6I_Kv.js";import{n as z}from"./constants-B9JJ72XE.js";import{T as V,l as A,m as G,v as H}from"./config-3clPIEB9.js";import{t as J}from"./cn-X2M2usMq.js";import{t as K}from"./jsx-runtime-PbYoItBR.js";import"./fullscreen-BXI8V5i6.js";import"./popover-DMNO6Poc.js";import{It as Q,P as X}from"./JsonOutput-DWLzjQfH.js";import{r as Y}from"./download-CIPflXYw.js";import{n as Z,t as I}from"./button-BF7GSjhW.js";import"./dist-Dez1I5M9.js";import"./cjs-DXo9vDEJ.js";import"./main-DmhaVp6Y.js";import"./useNonce-0SWz6w4W.js";import{r as ee}from"./requests-KshNNAOp.js";import"./layout-CoL1gz3N.js";import{l as te}from"./state-MC8-jN2e.js";import"./markdown-renderer-D9OefDax.js";import{t as re}from"./copy-IBNGDypD.js";import{d as se,i as oe,l as ae,n as ie,r as O,t as ne,u as me}from"./panels-ClMIloyA.js";import{t as le}from"./spinner-BbI9qk88.js";import"./dist-DblYTes5.js";import"./dist-D-2yWcX9.js";import"./dist-CNKFZCiw.js";import"./dist-ZjSH4Z6x.js";import"./dist-BtrqKtvn.js";import{t as ce}from"./use-toast-kCNiuc-_.js";import{t as de}from"./session-CsT5Gg9j.js";import"./purify.es-DfJp_of2.js";import"./dates-D8uxHHPL.js";import{n as pe}from"./copy-D8MtpXgN.js";import{a as he,c as fe,l as xe,n as be,r as je,t as ue}from"./dialog-DkJmIrsG.js";import{t as ge}from"./share-DQjChRJG.js";import"./utils-DPvpQ891.js";import"./vega-loader.browser-CZV6_g2i.js";import"./defaultLocale-OkOxlkkM.js";import"./defaultLocale-DK1MWd7f.js";import{a as ye}from"./cell-link-k224YmrQ.js";import"./chunk-5FQGJX7Z-OScactr4.js";import"./html-to-image-CtinlkZr.js";import{n as ke,t as _e}from"./react-resizable-panels.browser.esm-Ce2ksurd.js";import"./esm-X3Tr2pur.js";import"./name-cell-input-DylPR-WK.js";import{n as Ne,t as ve}from"./marimo-icons-DuRILrB8.js";import"./ws-DSN-Rmiu.js";import"./dist-DU8gTNy9.js";import"./dist-DgBuTUso.js";import"./dist-RW5SS83Z.js";import"./dist-Ci66nyHs.js";import"./dist-DkYp4RmM.js";import"./dist-DlREAgj1.js";import"./dist-BbGE6FVk.js";import"./dist-qGjvyIZU.js";import"./dist-C6zQ57IZ.js";import"./esm-B_l4S2x_.js";var we=P(),Se=E(D(),1),t=E(K(),1),Ce=$(o=>o(q)||!G(o(H).state));const ze=o=>{let e=(0,we.c)(22),{appConfig:s}=o,{setCells:r}=L(),{sendComponentValues:l}=ee(),a;e[0]===l?a=e[1]:(a=()=>(O.INSTANCE.start(l),Ie),e[0]=l,e[1]=a);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[2]=i):i=e[2],(0,Se.useEffect)(a,i);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=de(),e[3]=c):c=e[3];let g;e[4]===r?g=e[5]:(g={autoInstantiate:!0,setCells:r,sessionId:c},e[4]=r,e[5]=g);let{connection:j,reconnect:k}=ie(g),u=T(W),d;e:{if(typeof window>"u"){d=null;break e}let b,m;if(e[6]===Symbol.for("react.memo_cache_sentinel")){if(m=new URL(window.location.href),!m.searchParams.has("file")){d=null;break e}m.searchParams.delete("file"),b=m.searchParams.toString(),e[6]=b,e[7]=m,e[8]=d}else b=e[6],m=e[7],d=e[8];let y=b;d=y?`${m.pathname}?${y}`:m.pathname}let _=d,p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=_&&(0,t.jsx)("div",{className:"flex items-center px-6 pt-4 sm:-mt-8",children:(0,t.jsxs)("a",{href:_,"aria-label":"Back to gallery",className:J(Z({variant:"text",size:"sm"}),"gap-2 px-0 text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(te,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"Back"})]})}),e[9]=p):p=e[9];let h;e[10]===j?h=e[11]:(h=(0,t.jsx)(se,{connection:j,className:"sm:pt-8",children:p}),e[10]=j,e[11]=h);let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(le,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}),e[12]=f):f=e[12];let n;e[13]===s?n=e[14]:(n=(0,t.jsx)(me,{requires:Ce,delay:2e3,fallback:f,children:(0,t.jsx)(oe,{appConfig:s,mode:"read"})}),e[13]=s,e[14]=n);let x;return e[15]!==s.width||e[16]!==j||e[17]!==u||e[18]!==k||e[19]!==h||e[20]!==n?(x=(0,t.jsxs)(ae,{connection:j,isRunning:u,width:s.width,onReconnect:k,children:[h,n]}),e[15]=s.width,e[16]=j,e[17]=u,e[18]=k,e[19]=h,e[20]=n,e[21]=x):x=e[21],x};function Ie(){O.INSTANCE.stop()}var B=P();const Pe=()=>{let o=(0,B.c)(3),e=T(F);if(!A()||!e)return null;let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),o[0]=s):s=o[0];let r;return o[1]===e?r=o[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm","data-testid":"static-notebook-banner",children:[s,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(Re,{code:e})})]}),o[1]=e,o[2]=r),r};var Re=o=>{var R;let e=(0,B.c)(36),{code:s}=o,r=ye()||"notebook.py",l=r.lastIndexOf("/");l!==-1&&(r=r.slice(l+1));let[a]=M(),i=((R=a.sharing)==null?void 0:R.molab)!==!1,c=window.location.href,g;e[0]===s?g=e[1]:(g=ge({code:s,baseUrl:`${z.molab}/new`}),e[0]=s,e[1]=g);let j=g,k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsx)(xe,{asChild:!0,children:(0,t.jsx)(I,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[2]=k):k=e[2];let u;e[3]===r?u=e[4]:(u=(0,t.jsx)(fe,{children:r}),e[3]=r,e[4]=u);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[5]=d):d=e[5];let _;e[6]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)("br",{}),e[6]=_):_=e[6];let p;e[7]===r?p=e[8]:(p=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",_,"marimo edit ",r]})}),e[7]=r,e[8]=p);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=!c.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==j?(f=i&&(0,t.jsxs)("div",{className:"pt-3 border-t flex gap-2 items-center",children:[(0,t.jsx)(I,{asChild:!0,variant:"outline",size:"xs",className:"shrink-0",children:(0,t.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(Ne,{size:12,strokeWidth:1.5,className:"mr-1.5 mt-px text-(--grass-11)"}),"Open in molab"]})}),(0,t.jsxs)("p",{className:"text-sm text-(--sky-12)",children:["Run this notebook in"," ",(0,t.jsx)("span",{className:"font-semibold",children:"molab"}),", marimo's cloud-hosted notebook platform."]})]}),e[10]=i,e[11]=j,e[12]=f):f=e[12];let n;e[13]!==p||e[14]!==f?(n=(0,t.jsxs)(je,{className:"pt-3 text-left space-y-3",children:[d,p,h,f]}),e[13]=p,e[14]=f,e[15]=n):n=e[15];let x;e[16]!==u||e[17]!==n?(x=(0,t.jsxs)(he,{children:[u,n]}),e[16]=u,e[17]=n,e[18]=x):x=e[18];let b;e[19]===s?b=e[20]:(b=async()=>{await pe(s),ce({title:"Copied to clipboard"})},e[19]=s,e[20]=b);let m;e[21]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(re,{className:"w-3 h-3 mr-2"}),e[21]=m):m=e[21];let y;e[22]===b?y=e[23]:(y=(0,t.jsxs)(I,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:b,children:[m,"Copy code"]}),e[22]=b,e[23]=y);let N;e[24]!==s||e[25]!==r?(N=()=>{Y(new Blob([s],{type:"text/plain"}),r)},e[24]=s,e[25]=r,e[26]=N):N=e[26];let S;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsx)(Q,{className:"w-3 h-3 mr-2"}),e[27]=S):S=e[27];let v;e[28]===N?v=e[29]:(v=(0,t.jsxs)(I,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:N,children:[S,"Download"]}),e[28]=N,e[29]=v);let w;e[30]!==y||e[31]!==v?(w=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[y,v]}),e[30]=y,e[31]=v,e[32]=w):w=e[32];let C;return e[33]!==x||e[34]!==w?(C=(0,t.jsxs)(ue,{children:[k,(0,t.jsxs)(be,{children:[x,w]})]}),e[33]=x,e[34]=w,e[35]=C):C=e[35],C},U=P(),Ee=V()||A(),Te=o=>{let e=(0,U.c)(9),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(Pe,{}),e[0]=s):s=e[0];let r;e[1]===o.appConfig?r=e[2]:(r=(0,t.jsx)(ze,{appConfig:o.appConfig}),e[1]=o.appConfig,e[2]=r);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Ee&&(0,t.jsx)(Ae,{}),e[3]=l):l=e[3];let a;e[4]===r?a=e[5]:(a=(0,t.jsxs)(_e,{children:[s,r,l]}),e[4]=r,e[5]=a);let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(X,{}),e[6]=i):i=e[6];let c;return e[7]===a?c=e[8]:(c=(0,t.jsx)(ne,{children:(0,t.jsxs)(ke,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[a,i]})}),e[7]=a,e[8]=c),c},Ae=()=>{let o=(0,U.c)(1),e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50 print:hidden","data-testid":"watermark",children:(0,t.jsxs)("a",{href:z.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)(ve,{className:"h-4 w-auto"})]})}),o[0]=e):e=o[0],e},Oe=Te;export{Oe as default};
1
+ import{s as E}from"./chunk-LvLJmgfZ.js";import{p as $,u as T}from"./useEvent-D91BmmQi.js";import{t as D}from"./react-Bj1aDYRI.js";import{E as L,b as W,h as q,ji as F}from"./cells-C3u7zgmc.js";import"./react-dom-CSu739Rf.js";import{t as P}from"./compiler-runtime-B3qBwwSJ.js";import{x as M}from"./utils-Dev6I_Kv.js";import{n as z}from"./constants-B9JJ72XE.js";import{T as V,l as A,m as G,v as H}from"./config-3clPIEB9.js";import{t as J}from"./cn-X2M2usMq.js";import{t as K}from"./jsx-runtime-PbYoItBR.js";import"./fullscreen-BXI8V5i6.js";import"./popover-DMNO6Poc.js";import{It as Q,P as X}from"./JsonOutput-DWLzjQfH.js";import{r as Y}from"./download-CIPflXYw.js";import{n as Z,t as I}from"./button-BF7GSjhW.js";import"./dist-Dez1I5M9.js";import"./cjs-DXo9vDEJ.js";import"./main-DmhaVp6Y.js";import"./useNonce-0SWz6w4W.js";import{r as ee}from"./requests-KshNNAOp.js";import"./layout-CIuQ8Vb3.js";import{l as te}from"./state-MC8-jN2e.js";import"./markdown-renderer-D9OefDax.js";import{t as re}from"./copy-IBNGDypD.js";import{d as se,i as oe,l as ae,n as ie,r as O,t as ne,u as me}from"./panels-ntqecwQW.js";import{t as le}from"./spinner-BbI9qk88.js";import"./dist-DblYTes5.js";import"./dist-D-2yWcX9.js";import"./dist-CNKFZCiw.js";import"./dist-ZjSH4Z6x.js";import"./dist-BtrqKtvn.js";import{t as ce}from"./use-toast-kCNiuc-_.js";import{t as de}from"./session-CsT5Gg9j.js";import"./purify.es-DfJp_of2.js";import"./dates-D8uxHHPL.js";import{n as pe}from"./copy-D8MtpXgN.js";import{a as he,c as fe,l as xe,n as be,r as je,t as ue}from"./dialog-DkJmIrsG.js";import{t as ge}from"./share-DQjChRJG.js";import"./utils-DPvpQ891.js";import"./vega-loader.browser-CZV6_g2i.js";import"./defaultLocale-OkOxlkkM.js";import"./defaultLocale-DK1MWd7f.js";import{a as ye}from"./cell-link-k224YmrQ.js";import"./chunk-5FQGJX7Z-OScactr4.js";import"./html-to-image-CtinlkZr.js";import{n as ke,t as _e}from"./react-resizable-panels.browser.esm-Ce2ksurd.js";import"./esm-X3Tr2pur.js";import"./name-cell-input-DylPR-WK.js";import{n as Ne,t as ve}from"./marimo-icons-DuRILrB8.js";import"./ws-DSN-Rmiu.js";import"./dist-DU8gTNy9.js";import"./dist-DgBuTUso.js";import"./dist-RW5SS83Z.js";import"./dist-Ci66nyHs.js";import"./dist-DkYp4RmM.js";import"./dist-DlREAgj1.js";import"./dist-BbGE6FVk.js";import"./dist-qGjvyIZU.js";import"./dist-C6zQ57IZ.js";import"./esm-B_l4S2x_.js";var we=P(),Se=E(D(),1),t=E(K(),1),Ce=$(o=>o(q)||!G(o(H).state));const ze=o=>{let e=(0,we.c)(22),{appConfig:s}=o,{setCells:r}=L(),{sendComponentValues:l}=ee(),a;e[0]===l?a=e[1]:(a=()=>(O.INSTANCE.start(l),Ie),e[0]=l,e[1]=a);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[2]=i):i=e[2],(0,Se.useEffect)(a,i);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=de(),e[3]=c):c=e[3];let g;e[4]===r?g=e[5]:(g={autoInstantiate:!0,setCells:r,sessionId:c},e[4]=r,e[5]=g);let{connection:j,reconnect:k}=ie(g),u=T(W),d;e:{if(typeof window>"u"){d=null;break e}let b,m;if(e[6]===Symbol.for("react.memo_cache_sentinel")){if(m=new URL(window.location.href),!m.searchParams.has("file")){d=null;break e}m.searchParams.delete("file"),b=m.searchParams.toString(),e[6]=b,e[7]=m,e[8]=d}else b=e[6],m=e[7],d=e[8];let y=b;d=y?`${m.pathname}?${y}`:m.pathname}let _=d,p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=_&&(0,t.jsx)("div",{className:"flex items-center px-6 pt-4 sm:-mt-8",children:(0,t.jsxs)("a",{href:_,"aria-label":"Back to gallery",className:J(Z({variant:"text",size:"sm"}),"gap-2 px-0 text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(te,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"Back"})]})}),e[9]=p):p=e[9];let h;e[10]===j?h=e[11]:(h=(0,t.jsx)(se,{connection:j,className:"sm:pt-8",children:p}),e[10]=j,e[11]=h);let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(le,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}),e[12]=f):f=e[12];let n;e[13]===s?n=e[14]:(n=(0,t.jsx)(me,{requires:Ce,delay:2e3,fallback:f,children:(0,t.jsx)(oe,{appConfig:s,mode:"read"})}),e[13]=s,e[14]=n);let x;return e[15]!==s.width||e[16]!==j||e[17]!==u||e[18]!==k||e[19]!==h||e[20]!==n?(x=(0,t.jsxs)(ae,{connection:j,isRunning:u,width:s.width,onReconnect:k,children:[h,n]}),e[15]=s.width,e[16]=j,e[17]=u,e[18]=k,e[19]=h,e[20]=n,e[21]=x):x=e[21],x};function Ie(){O.INSTANCE.stop()}var B=P();const Pe=()=>{let o=(0,B.c)(3),e=T(F);if(!A()||!e)return null;let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),o[0]=s):s=o[0];let r;return o[1]===e?r=o[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm","data-testid":"static-notebook-banner",children:[s,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(Re,{code:e})})]}),o[1]=e,o[2]=r),r};var Re=o=>{var R;let e=(0,B.c)(36),{code:s}=o,r=ye()||"notebook.py",l=r.lastIndexOf("/");l!==-1&&(r=r.slice(l+1));let[a]=M(),i=((R=a.sharing)==null?void 0:R.molab)!==!1,c=window.location.href,g;e[0]===s?g=e[1]:(g=ge({code:s,baseUrl:`${z.molab}/new`}),e[0]=s,e[1]=g);let j=g,k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsx)(xe,{asChild:!0,children:(0,t.jsx)(I,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[2]=k):k=e[2];let u;e[3]===r?u=e[4]:(u=(0,t.jsx)(fe,{children:r}),e[3]=r,e[4]=u);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[5]=d):d=e[5];let _;e[6]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)("br",{}),e[6]=_):_=e[6];let p;e[7]===r?p=e[8]:(p=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",_,"marimo edit ",r]})}),e[7]=r,e[8]=p);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=!c.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==j?(f=i&&(0,t.jsxs)("div",{className:"pt-3 border-t flex gap-2 items-center",children:[(0,t.jsx)(I,{asChild:!0,variant:"outline",size:"xs",className:"shrink-0",children:(0,t.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(Ne,{size:12,strokeWidth:1.5,className:"mr-1.5 mt-px text-(--grass-11)"}),"Open in molab"]})}),(0,t.jsxs)("p",{className:"text-sm text-(--sky-12)",children:["Run this notebook in"," ",(0,t.jsx)("span",{className:"font-semibold",children:"molab"}),", marimo's cloud-hosted notebook platform."]})]}),e[10]=i,e[11]=j,e[12]=f):f=e[12];let n;e[13]!==p||e[14]!==f?(n=(0,t.jsxs)(je,{className:"pt-3 text-left space-y-3",children:[d,p,h,f]}),e[13]=p,e[14]=f,e[15]=n):n=e[15];let x;e[16]!==u||e[17]!==n?(x=(0,t.jsxs)(he,{children:[u,n]}),e[16]=u,e[17]=n,e[18]=x):x=e[18];let b;e[19]===s?b=e[20]:(b=async()=>{await pe(s),ce({title:"Copied to clipboard"})},e[19]=s,e[20]=b);let m;e[21]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(re,{className:"w-3 h-3 mr-2"}),e[21]=m):m=e[21];let y;e[22]===b?y=e[23]:(y=(0,t.jsxs)(I,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:b,children:[m,"Copy code"]}),e[22]=b,e[23]=y);let N;e[24]!==s||e[25]!==r?(N=()=>{Y(new Blob([s],{type:"text/plain"}),r)},e[24]=s,e[25]=r,e[26]=N):N=e[26];let S;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsx)(Q,{className:"w-3 h-3 mr-2"}),e[27]=S):S=e[27];let v;e[28]===N?v=e[29]:(v=(0,t.jsxs)(I,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:N,children:[S,"Download"]}),e[28]=N,e[29]=v);let w;e[30]!==y||e[31]!==v?(w=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[y,v]}),e[30]=y,e[31]=v,e[32]=w):w=e[32];let C;return e[33]!==x||e[34]!==w?(C=(0,t.jsxs)(ue,{children:[k,(0,t.jsxs)(be,{children:[x,w]})]}),e[33]=x,e[34]=w,e[35]=C):C=e[35],C},U=P(),Ee=V()||A(),Te=o=>{let e=(0,U.c)(9),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(Pe,{}),e[0]=s):s=e[0];let r;e[1]===o.appConfig?r=e[2]:(r=(0,t.jsx)(ze,{appConfig:o.appConfig}),e[1]=o.appConfig,e[2]=r);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Ee&&(0,t.jsx)(Ae,{}),e[3]=l):l=e[3];let a;e[4]===r?a=e[5]:(a=(0,t.jsxs)(_e,{children:[s,r,l]}),e[4]=r,e[5]=a);let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(X,{}),e[6]=i):i=e[6];let c;return e[7]===a?c=e[8]:(c=(0,t.jsx)(ne,{children:(0,t.jsxs)(ke,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[a,i]})}),e[7]=a,e[8]=c),c},Ae=()=>{let o=(0,U.c)(1),e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50 print:hidden","data-testid":"watermark",children:(0,t.jsxs)("a",{href:z.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)(ve,{className:"h-4 w-auto"})]})}),o[0]=e):e=o[0],e},Oe=Te;export{Oe as default};
@@ -1 +1 @@
1
- import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{E as ke,F as ze,Gi as Ce,Ki as m,Li as Se,Ln as Oe,__tla as Ae}from"./cells-C3u7zgmc.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{v as se}from"./useEventListener-BakX-tnw.js";import{x as Ie}from"./utils-Dev6I_Kv.js";import{t as Le}from"./constants-B9JJ72XE.js";import{t as le}from"./cn-X2M2usMq.js";import{t as Ee}from"./jsx-runtime-PbYoItBR.js";import"./fullscreen-BXI8V5i6.js";import"./popover-DMNO6Poc.js";import{n as Me,__tla as Pe}from"./JsonOutput-DWLzjQfH.js";import"./download-CIPflXYw.js";import{t as z}from"./tooltip-CgQpRVyN.js";import{t as C}from"./button-BF7GSjhW.js";import"./dist-Dez1I5M9.js";import"./cjs-DXo9vDEJ.js";import"./main-DmhaVp6Y.js";import"./useNonce-0SWz6w4W.js";import{r as Re}from"./requests-KshNNAOp.js";import{t as ne}from"./createLucideIcon-BTp1tQDO.js";import{f as De,__tla as He}from"./layout-CoL1gz3N.js";import{n as Ve,t as qe,__tla as Ge}from"./LazyAnyLanguageCodeMirror-DpraoNlO.js";import{__tla as Te}from"./markdown-renderer-D9OefDax.js";import{u as Fe}from"./toDate-DCE7d2fN.js";import{t as Ke,__tla as Ue}from"./cell-editor-3PkTaSur.js";import{t as Be}from"./spinner-BbI9qk88.js";import{i as Je}from"./useDeleteCell-DnDf7cie.js";import"./dist-DblYTes5.js";import"./dist-D-2yWcX9.js";import"./dist-CNKFZCiw.js";import"./dist-ZjSH4Z6x.js";import"./dist-BtrqKtvn.js";import"./session-CsT5Gg9j.js";import{r as Qe}from"./useTheme-D_ZbTTJw.js";import"./purify.es-DfJp_of2.js";import"./dates-D8uxHHPL.js";import"./utils-DPvpQ891.js";import"./vega-loader.browser-CZV6_g2i.js";import"./defaultLocale-OkOxlkkM.js";import"./defaultLocale-DK1MWd7f.js";import{__tla as We}from"./chunk-5FQGJX7Z-OScactr4.js";import"./html-to-image-CtinlkZr.js";import{o as Xe}from"./focus-CAC_Hef8.js";import{n as Ye,r as Ze,t as me}from"./react-resizable-panels.browser.esm-Ce2ksurd.js";import{a as $e}from"./renderShortcut-LpVarhnQ.js";import"./esm-X3Tr2pur.js";import"./name-cell-input-DylPR-WK.js";import{n as et,r as tt}from"./panel-context-DC1vAeB3.js";import{__tla as rt}from"./loro_wasm_bg-BFCm9sQd.js";import"./ws-DSN-Rmiu.js";import"./Inputs-SmI80aJQ.js";import"./dist-DU8gTNy9.js";import"./dist-DgBuTUso.js";import"./dist-RW5SS83Z.js";import"./dist-Ci66nyHs.js";import"./dist-DkYp4RmM.js";import"./dist-DlREAgj1.js";import"./dist-BbGE6FVk.js";import"./dist-qGjvyIZU.js";import"./dist-C6zQ57IZ.js";import"./esm-B_l4S2x_.js";import{t as at}from"./kiosk-mode-B1YZ0mzO.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Ge}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ue}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=ne("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),he=ne("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),pe=ie(),q=ae(Ne(),1),ue=15;const G=Se("marimo:scratchpadHistory:v1",[],Oe),fe=oe(!1),xe=oe(null,(e,i,s)=>{if(s=s.trim(),!s)return;let n=e(G);i(G,[s,...n.filter(c=>c!==s)].slice(0,ue))});var t=ae(Ee(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),i=ze(),[s]=Ie(),{theme:n}=Qe(),c=(0,q.useRef)(null),T=Xe(),{createNewCell:F,updateCellCode:d}=ke(),{sendRunScratchpad:h}=Re(),S=et(),K=tt(),l=i.cellRuntime[m],U=l==null?void 0:l.output,O=l==null?void 0:l.status,B=l==null?void 0:l.consoleOutputs,r=((re=i.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[o,p]=ye(fe),u=we(G),A;e[0]!==J||e[1]!==r||e[2]!==h?(A=()=>{h({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=h,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==F||e[6]!==T?(I=()=>{r.trim()&&F({code:r,before:!1,cellId:T??"__end__"})},e[4]=r,e[5]=F,e[6]=T,e[7]=I):I=e[7];let Q=V(I),L;e[8]!==h||e[9]!==d?(L=()=>{d({cellId:m,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=L):L=e[10];let W=V(L),E;e[11]!==p||e[12]!==d?(E=a=>{p(!1),d({cellId:m,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=E):E=e[13];let X=V(E),[Y,ge]=(0,q.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==n?(M=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:n,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=n,e[18]=M):M=e[18];let Z=M,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Je,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Be,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Fe,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Ce.create(m),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=a=>{c.current=a},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==n||e[35]!==s?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ke,{theme:n,showPlaceholder:!1,id:m,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:s,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=n,e[35]=s,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(me,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===U?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:U,className:Le.outputArea,cellId:m,stale:!1,loading:!1})}),e[47]=U,e[48]=y);let w;e[49]===B?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:B,className:"overflow-auto",stale:!1,interrupted:!1,cellName:"_",onSubmitDebugger:se.NOOP,cellId:m,debuggerActive:!1})}),e[49]=B,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(me,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==K||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},K)}),e[54]=S,e[55]=K,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=ie(),ce=()=>{let e=(0,te.c)(1),i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(ve,{}),e[0]=i):i=e[0],i}});export{ot as __tla,ce as default};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-D91BmmQi.js";import{t as Ne}from"./react-Bj1aDYRI.js";import{E as ke,F as ze,Gi as Ce,Ki as m,Li as Se,Ln as Oe,__tla as Ae}from"./cells-C3u7zgmc.js";import"./react-dom-CSu739Rf.js";import{t as ie}from"./compiler-runtime-B3qBwwSJ.js";import{v as se}from"./useEventListener-BakX-tnw.js";import{x as Ie}from"./utils-Dev6I_Kv.js";import{t as Le}from"./constants-B9JJ72XE.js";import{t as le}from"./cn-X2M2usMq.js";import{t as Ee}from"./jsx-runtime-PbYoItBR.js";import"./fullscreen-BXI8V5i6.js";import"./popover-DMNO6Poc.js";import{n as Me,__tla as Pe}from"./JsonOutput-DWLzjQfH.js";import"./download-CIPflXYw.js";import{t as z}from"./tooltip-CgQpRVyN.js";import{t as C}from"./button-BF7GSjhW.js";import"./dist-Dez1I5M9.js";import"./cjs-DXo9vDEJ.js";import"./main-DmhaVp6Y.js";import"./useNonce-0SWz6w4W.js";import{r as Re}from"./requests-KshNNAOp.js";import{t as ne}from"./createLucideIcon-BTp1tQDO.js";import{f as De,__tla as He}from"./layout-CIuQ8Vb3.js";import{n as Ve,t as qe,__tla as Ge}from"./LazyAnyLanguageCodeMirror-DpraoNlO.js";import{__tla as Te}from"./markdown-renderer-D9OefDax.js";import{u as Fe}from"./toDate-DCE7d2fN.js";import{t as Ke,__tla as Ue}from"./cell-editor-DeAW5cIb.js";import{t as Be}from"./spinner-BbI9qk88.js";import{i as Je}from"./useDeleteCell-DnDf7cie.js";import"./dist-DblYTes5.js";import"./dist-D-2yWcX9.js";import"./dist-CNKFZCiw.js";import"./dist-ZjSH4Z6x.js";import"./dist-BtrqKtvn.js";import"./session-CsT5Gg9j.js";import{r as Qe}from"./useTheme-D_ZbTTJw.js";import"./purify.es-DfJp_of2.js";import"./dates-D8uxHHPL.js";import"./utils-DPvpQ891.js";import"./vega-loader.browser-CZV6_g2i.js";import"./defaultLocale-OkOxlkkM.js";import"./defaultLocale-DK1MWd7f.js";import{__tla as We}from"./chunk-5FQGJX7Z-OScactr4.js";import"./html-to-image-CtinlkZr.js";import{o as Xe}from"./focus-CAC_Hef8.js";import{n as Ye,r as Ze,t as me}from"./react-resizable-panels.browser.esm-Ce2ksurd.js";import{a as $e}from"./renderShortcut-LpVarhnQ.js";import"./esm-X3Tr2pur.js";import"./name-cell-input-DylPR-WK.js";import{n as et,r as tt}from"./panel-context-DC1vAeB3.js";import{__tla as rt}from"./loro_wasm_bg-BFCm9sQd.js";import"./ws-DSN-Rmiu.js";import"./Inputs-SmI80aJQ.js";import"./dist-DU8gTNy9.js";import"./dist-DgBuTUso.js";import"./dist-RW5SS83Z.js";import"./dist-Ci66nyHs.js";import"./dist-DkYp4RmM.js";import"./dist-DlREAgj1.js";import"./dist-BbGE6FVk.js";import"./dist-qGjvyIZU.js";import"./dist-C6zQ57IZ.js";import"./esm-B_l4S2x_.js";import{t as at}from"./kiosk-mode-B1YZ0mzO.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Ge}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ue}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=ne("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),he=ne("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),pe=ie(),q=ae(Ne(),1),ue=15;const G=Se("marimo:scratchpadHistory:v1",[],Oe),fe=oe(!1),xe=oe(null,(e,i,s)=>{if(s=s.trim(),!s)return;let n=e(G);i(G,[s,...n.filter(c=>c!==s)].slice(0,ue))});var t=ae(Ee(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,pe.c)(60),i=ze(),[s]=Ie(),{theme:n}=Qe(),c=(0,q.useRef)(null),T=Xe(),{createNewCell:F,updateCellCode:d}=ke(),{sendRunScratchpad:h}=Re(),S=et(),K=tt(),l=i.cellRuntime[m],U=l==null?void 0:l.output,O=l==null?void 0:l.status,B=l==null?void 0:l.consoleOutputs,r=((re=i.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[o,p]=ye(fe),u=we(G),A;e[0]!==J||e[1]!==r||e[2]!==h?(A=()=>{h({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=h,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==F||e[6]!==T?(I=()=>{r.trim()&&F({code:r,before:!1,cellId:T??"__end__"})},e[4]=r,e[5]=F,e[6]=T,e[7]=I):I=e[7];let Q=V(I),L;e[8]!==h||e[9]!==d?(L=()=>{d({cellId:m,code:"",formattingChange:!1}),h({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=h,e[9]=d,e[10]=L):L=e[10];let W=V(L),E;e[11]!==p||e[12]!==d?(E=a=>{p(!1),d({cellId:m,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=p,e[12]=d,e[13]=E):E=e[13];let X=V(E),[Y,ge]=(0,q.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==n?(M=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:n,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=n,e[18]=M):M=e[18];let Z=M,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==p||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Je,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Be,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>p(!o),disabled:u.length===0,children:(0,t.jsx)(he,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Fe,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=p,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Ce.create(m),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=a=>{c.current=a},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==n||e[35]!==s?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ke,{theme:n,showPlaceholder:!1,id:m,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:s,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:se.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=n,e[35]=s,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(me,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===U?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:U,className:Le.outputArea,cellId:m,stale:!1,loading:!1})}),e[47]=U,e[48]=y);let w;e[49]===B?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:B,className:"overflow-auto",stale:!1,interrupted:!1,cellName:"_",onSubmitDebugger:se.NOOP,cellId:m,debuggerActive:!1})}),e[49]=B,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(me,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==K||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},K)}),e[54]=S,e[55]=K,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=ie(),ce=()=>{let e=(0,te.c)(1),i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(ve,{}),e[0]=i):i=e[0],i}});export{ot as __tla,ce as default};
@@ -1 +1 @@
1
- import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as L,l as rt,p as dt,u as I}from"./useEvent-D91BmmQi.js";import{t as ct}from"./react-Bj1aDYRI.js";import{An as ht,E as We,En as pt,Gi as be,Nn as mt,Pn as ut,Qt as ft,T as bt,br as Me,ct as yt,g as kt,jn as wt,kn as xt,kr as gt,m as Ae,ri as jt,st as vt,t as Ct,ut as Se,wr as zt,xr as Wt,yr as Mt}from"./cells-C3u7zgmc.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,r as St,x as _t}from"./ai-model-dropdown-9Z73_iYD.js";import{_ as H,d as _e}from"./useEventListener-BakX-tnw.js";import{r as Dt,x as Nt}from"./utils-Dev6I_Kv.js";import{n as W,t as De}from"./constants-B9JJ72XE.js";import{T as X,v as Pt,w as It}from"./config-3clPIEB9.js";import{t as Et}from"./jsx-runtime-PbYoItBR.js";import{o as Tt}from"./alert-dialog-CC0gG4Av.js";import{a as Lt,c as Ht,i as qt,n as Ft,r as Rt,s as Bt,t as Ot}from"./select-Cjly7tmx.js";import{It as Vt}from"./JsonOutput-DWLzjQfH.js";import{c as Ne,d as ye,n as Yt,o as $t,r as ke,t as Kt}from"./download-CIPflXYw.js";import{t as Ut}from"./tooltip-CgQpRVyN.js";import{r as Gt,t as we}from"./button-BF7GSjhW.js";import{i as Jt,t as Pe}from"./strings-DvZlHYnD.js";import{r as q}from"./requests-KshNNAOp.js";import{t as m}from"./createLucideIcon-BTp1tQDO.js";import{F as Qt,I as Xt,L as Ie,P as Zt,a as Ee,i as Te,u as Le}from"./layout-CoL1gz3N.js";import{t as He}from"./check-DQmqoJgr.js";import{r as ea}from"./useCellActionButton-D82Xuv94.js";import{t as ta}from"./code-DP40S9ln.js";import{t as aa}from"./copy-IBNGDypD.js";import{t as qe}from"./eye-off-DI0EQXw0.js";import{t as oa}from"./external-link-BktyywYg.js";import{t as Z}from"./file-BvoBtS_V.js";import{u as na}from"./form-DL-na7MW.js";import{n as ia,r as sa,t as la}from"./youtube-NfBeYlaL.js";import{i as ra,n as Fe}from"./add-connection-dialog-WekDpd6a.js";import{t as da}from"./house-DHu4JLi3.js";import{t as ca}from"./image-BzUcK6ho.js";import{t as ha}from"./link-e5mRDDOC.js";import{r as pa}from"./input-DB2LiTiQ.js";import{t as ma}from"./settings-1WkYMLdR.js";import{t as ua}from"./sparkles-COaEc8Qn.js";import{y as fa}from"./textarea-DOzBgXd_.js";import{t as ba}from"./square-35tXIgiR.js";import{t as M}from"./use-toast-kCNiuc-_.js";import{n as Re,t as ya}from"./paths-DhuNSnZ_.js";import{o as ka}from"./session-CsT5Gg9j.js";import{n as ee}from"./copy-D8MtpXgN.js";import{r as wa}from"./useRunCells-B8rJ_Hwq.js";import{a as xa,c as ga,i as ja,n as va,r as Ca}from"./dialog-DkJmIrsG.js";import{n as xe}from"./ImperativeModal-B62Q6S9l.js";import{r as za,t as Be}from"./share-DQjChRJG.js";import{a as Wa}from"./cell-link-k224YmrQ.js";import{a as Ma}from"./renderShortcut-LpVarhnQ.js";import{t as Aa}from"./icons-avFV3lBF.js";import{t as Sa}from"./pair-with-agent-modal-Q9Od23Rh.js";import{t as _a}from"./github-DghuZBnj.js";import{n as Oe}from"./marimo-icons-DuRILrB8.js";import{t as Da}from"./links-Bof3pNQU.js";import{r as Na,t as Ve}from"./hooks-Q3y983ON.js";import{t as Ye}from"./types-D4wsSrXa.js";var Pa=m("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Ia=m("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),$e=m("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"}]]),Ke=m("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"}]]),Ue=m("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"}]]),Ea=m("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"}]]),Ta=m("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"}]]),La=m("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"}]]),Ha=m("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"}]]),qa=m("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ge=m("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Fa=m("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"}]]),Ra=m("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"}]]),Je=m("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"}]]),Qe=z(),Xe=ze(ct(),1),a=ze(Et(),1),te="https://static.marimo.app";const Ba=e=>{let t=(0,Qe.c)(25),{onClose:n}=e,[o,i]=(0,Xe.useState)(""),{exportAsHTML:d}=q(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,s=`${te}/static/${l}`,r;t[0]!==d||t[1]!==n||t[2]!==l?(r=async v=>{v.preventDefault(),n();let T=await d({download:!1,includeCode:!0,files:Zt.INSTANCE.filenames()}),A=M({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:T,path:l})}).catch(()=>{A.dismiss(),M({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:W.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),A.dismiss(),M({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=d,t[1]=n,t[2]=l,t[3]=r):r=t[3];let h;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(ga,{children:"Share static notebook"}),t[4]=h):h=t[4];let p;t[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(xa,{children:[h,(0,a.jsxs)(Ca,{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:te,target:"_blank",children:te}),"."]})]}),t[5]=p):p=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{i(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let f;t[7]===o?f=t[8]:(f=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=f);let b;t[9]===s?b=t[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)(Oa,{text:s}),(0,a.jsx)("span",{className:"text-primary",children:s})]})]}),t[9]=s,t[10]=b);let y;t[11]!==f||t[12]!==b?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[f,b]}),t[11]=f,t[12]=b,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(we,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let w;t[16]===s?w=t[17]:(w=(0,a.jsx)(we,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(s)},children:"Create"}),t[16]=s,t[17]=w);let x;t[18]!==k||t[19]!==w?(x=(0,a.jsxs)(ja,{children:[k,w]}),t[18]=k,t[19]=w,t[20]=x):x=t[20];let j;return t[21]!==r||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(va,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:r,children:[p,y,x]})}),t[21]=r,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Oa=e=>{let t=(0,Qe.c)(8),[n,o]=Xe.useState(!1),i;t[0]===e.text?i=t[1]:(i=Gt.stopPropagation(async h=>{h.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=i);let d=i,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let s;t[3]===d?s=t[4]:(s=(0,a.jsx)(we,{"data-testid":"copy-static-notebook-url-button",onClick:d,size:"xs",variant:"secondary",children:l}),t[3]=d,t[4]=s);let r;return t[5]!==n||t[6]!==s?(r=(0,a.jsx)(Ut,{content:"Copied!",open:n,children:s}),t[5]=n,t[6]=s,t[7]=r):r=t[7],r},Va=z();function Ya(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=be.findElement(t);if(!o){H.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:be.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function $a(e){if(!e){H.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(be.create(e.cellId));if(!t){H.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){H.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ze(){let e=(0,Va.c)(2),t=L(Se),n;return e[0]===t?n=e[1]:(n=()=>{let o=Ya();t(i=>({mode:yt(i.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{$a(o)})})},e[0]=t,e[1]=n),n}const et=dt(!1);var Ka=z();const Ua=()=>{let e=(0,Ka.c)(7),{selectedLayout:t}=Ee(),{setLayoutView:n}=Te();if(X()&&!ut("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=s=>n(s),e[0]=n,e[1]=o);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),e[2]=i):i=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(Ft,{children:(0,a.jsxs)(Rt,{children:[(0,a.jsx)(Lt,{children:"View as"}),Ye.map(Ja)]})}),e[3]=d):d=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Ot,{"data-testid":"layout-select",value:t,onValueChange:o,children:[i,d]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ga(e){return(0,a.jsx)(tt(e),{className:"h-4 w-4"})}function tt(e){switch(e){case"vertical":return La;case"grid":return sa;case"slides":return Ge;default:return Jt(e),ba}}function at(e){return Pe.startCase(e)}function Ja(e){return(0,a.jsx)(qt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ga(e),(0,a.jsx)("span",{children:at(e)})]})},e)}async function Qa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Xa=z();function Za(e){let t=(0,Xa.c)(5),{openPrompt:n,closeModal:o}=xe(),{sendCopy:i}=q(),d;return t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==e?(d=()=>{if(!e)return null;let l=ya.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Re.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:s=>{let r=l.join(Re.dirname(e),s);i({source:e,destination:r}).then(()=>{o(),M({title:"Notebook copied",description:"A copy of the notebook has been created."}),Da(r)})}})},t[0]=o,t[1]=n,t[2]=i,t[3]=e,t[4]=d):d=t[4],d}var eo=z();function ot(){let e=(0,eo.c)(4),{openConfirm:t}=xe(),n=L(Pt),{sendRestart:o}=q(),i;return e[0]!==t||e[1]!==o||e[2]!==n?(i=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Tt,{onClick:async()=>{n({state:It.CLOSING}),await o(),za()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=i):i=e[3],i}var to=z(),ao=new ft,oo=e=>ao.isSupported(e)?"markdown":"code";const nt=()=>{let e=(0,to.c)(3),{updateCellConfig:t}=We(),{saveCellConfig:n}=q(),o;return e[0]!==n||e[1]!==t?(o=async(i,d)=>{let l=Ae(),s={};for(let h of l.cellIds.inOrderIds){let p=l.cellData[h];p===void 0||p.config.hide_code===i||oo(p.code)===d&&(s[h]={hide_code:i})}let r=_e.entries(s);if(r.length!==0){await n({configs:s});for(let[h,p]of r)t({cellId:h,config:p})}},e[0]=n,e[1]=t,e[2]=o):o=e[2],o};var no=z(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function io(){var je,ve,Ce;let e=(0,no.c)(56),t=Wa(),{openModal:n,closeModal:o}=xe(),{toggleApplication:i}=xt(),{selectedPanel:d}=ht(),[l]=rt(Se),s=I(vt),r=nt(),[h]=Nt(),p=I(pt),g=I(Dt),{updateCellConfig:f,undoDeleteCell:b,clearAllCellOutputs:y,addSetupCellIfDoesntExist:k,collapseAllCells:w,expandAllCells:x}=We(),j=ot(),v=wa(),T=Za(t),A=L(et),oe=L(At),{handleClick:ne}=St(),ie=L(_t),{exportAsIPYNB:se,exportAsMarkdown:le,readCode:S,saveCellConfig:re,updateCellOutputs:_}=q(),D=Na(),de=I(kt),ce=I(Ct),he=I(bt),{selectedLayout:F}=Ee(),{setLayoutView:pe}=Te(),R=Ze(),B=((je=h.sharing)==null?void 0:je.html)??!0,O=((ve=h.sharing)==null?void 0:ve.wasm)??!0,V=((Ce=h.sharing)==null?void 0:Ce.molab)??!0,ge=!X(),me=F==="slides",it=Co,st=vo,Y;e[0]!==t||e[1]!==D||e[2]!==_?(Y=async c=>{let{preset:u,title:C}=c;if(!t){ae();return}await Ne(C,async fe=>{await Ve({takeScreenshots:()=>D({progress:fe}),updateCellOutputs:_}),await Qa({filename:t,preset:u,downloadPDF:Yt})})},e[0]=t,e[1]=D,e[2]=_,e[3]=Y):Y=e[3];let N=Y,$;e[4]===N?$=e[5]:($=async()=>{if(ge){await N({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),u=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(jo,0),setTimeout(()=>window.dispatchEvent(u),0)},e[4]=N,e[5]=$);let K=$,U;e[6]!==se||e[7]!==t||e[8]!==D||e[9]!==_?(U=async()=>{if(!t){ae();return}await Ne("Downloading IPYNB...",async c=>{await Ve({takeScreenshots:()=>D({progress:c}),updateCellOutputs:_});let u=await se({download:!1});ke(new Blob([u],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},e[6]=se,e[7]=t,e[8]=D,e[9]=_,e[10]=U):U=e[10];let ue=U,G;e[11]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),e[11]=G):G=e[11];let J;e[12]===Symbol.for("react.memo_cache_sentinel")?(J=(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),e[12]=J):J=e[12];let P;e[13]===t?P=e[14]:(P=async()=>{if(!t){ae();return}await Le({filename:t,includeCode:!0})},e[13]=t,e[14]=P);let Q;return e[15]!==k||e[16]!==g||e[17]!==ce||e[18]!==p||e[19]!==y||e[20]!==o||e[21]!==w||e[22]!==T||e[23]!==N||e[24]!==x||e[25]!==le||e[26]!==t||e[27]!==K||e[28]!==ue||e[29]!==de||e[30]!==me||e[31]!==s||e[32]!==n||e[33]!==ne||e[34]!==S||e[35]!==j||e[36]!==v||e[37]!==re||e[38]!==F||e[39]!==d||e[40]!==r||e[41]!==A||e[42]!==ie||e[43]!==pe||e[44]!==oe||e[45]!==B||e[46]!==V||e[47]!==O||e[48]!==P||e[49]!==i||e[50]!==R||e[51]!==b||e[52]!==he||e[53]!==f||e[54]!==l.mode?(Q=[{icon:G,label:"Download",handle:E,dropdown:[{icon:J,label:"Download as HTML",handle:P},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Le({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(Aa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await le({download:!1});ke(new Blob([c],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ha,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ue},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await S();ke(new Blob([c.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ma("global.hideCode",!1)]}),handle:go},me?{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:E,dropdown:[{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:K},{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:st(!0),hidden:!ge,handle:async()=>{await N({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:K}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:X(),handle:async()=>{n((0,a.jsx)(Sa,{onClose:o}))}},{icon:(0,a.jsx)(Fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!B&&!O&&!V,dropdown:[{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Ba,{onClose:o}))}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!O,handle:async()=>{await ee(Be({code:(await S()).contents})),M({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!V,handle:async()=>{let c=Be({code:(await S()).contents,baseUrl:`${W.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(qa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:wt.flatMap(c=>{let u=c.type==="ai"&&!g;if(mt({panel:c,capabilities:p,aiEnabled:g})&&!u)return[];let{type:C,Icon:fe,additionalKeywords:lt}=c;return{label:Pe.startCase(C),rightElement:it(d===C),icon:(0,a.jsx)(fe,{size:14,strokeWidth:1.5}),handle:()=>{if(u){ne("ai","ai-features");return}i(C)},additionalKeywords:lt}})},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(fa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qt,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Ye.map((c,u)=>{let C=tt(c);return{divider:u===0,label:at(c),icon:(0,a.jsx)(C,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:F===c&&(0,a.jsx)(He,{size:14})}),handle:()=>{pe(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||X(),handle:T},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await S()).contents),M({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!de||s,handle:async()=>{let c=jt(Ae());await re({configs:_e.fromEntries(c.map(xo))});for(let u of c)f({cellId:u,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ue,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{k({})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Fe,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Fe,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:he,hidden:!ce||s,handle:()=>{b()}},{icon:(0,a.jsx)(Ra,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:j,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{v()}},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{y()}},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>r(!1,"code"),redundant:!0},{icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>r(!0,"code"),redundant:!0},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>r(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>r(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:w,redundant:!0},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>A(wo)},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>ie(ko)},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>oe(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:bo},{icon:(0,a.jsx)(_a,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:uo},{icon:(0,a.jsx)(la,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:mo},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Open home",hidden:!location.search.includes("file"),handle:ho},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:co}].filter(ro).map(so),e[15]=k,e[16]=g,e[17]=ce,e[18]=p,e[19]=y,e[20]=o,e[21]=w,e[22]=T,e[23]=N,e[24]=x,e[25]=le,e[26]=t,e[27]=K,e[28]=ue,e[29]=de,e[30]=me,e[31]=s,e[32]=n,e[33]=ne,e[34]=S,e[35]=j,e[36]=v,e[37]=re,e[38]=F,e[39]=d,e[40]=r,e[41]=A,e[42]=ie,e[43]=pe,e[44]=oe,e[45]=B,e[46]=V,e[47]=O,e[48]=P,e[49]=i,e[50]=R,e[51]=b,e[52]=he,e[53]=f,e[54]=l.mode,e[55]=Q):Q=e[55],Q}function so(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(lo)}:e}function lo(e){return!e.hidden}function ro(e){return!e.hidden}function co(){let e=ka();window.open(e,"_blank")}function ho(){let e=document.baseURI.split("?")[0];window.open(e,"_blank","noopener")}function po(){window.open(W.releasesPage,"_blank")}function mo(){window.open(W.youtube,"_blank")}function uo(){window.open(W.discordLink,"_blank")}function fo(){window.open(W.githubPage,"_blank")}function bo(){window.open(W.docsPage,"_blank")}function yo(e){return!e}function ko(e){return!e}function wo(e){return!e}function xo(e){return[e,{disabled:!1}]}async function go(){let e=document.getElementById("App");e&&await $t({element:e,filename:document.title,prepare:Kt})}function jo(){return window.print()}function vo(e){return e?(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"}):null}function Co(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(He,{size:14})})}function ae(){M({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{et as a,Ue as c,Ua as i,Ke as l,nt as n,Ze as o,ot as r,Je as s,io as t,$e as u};
1
+ import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as L,l as rt,p as dt,u as I}from"./useEvent-D91BmmQi.js";import{t as ct}from"./react-Bj1aDYRI.js";import{An as ht,E as We,En as pt,Gi as be,Nn as mt,Pn as ut,Qt as ft,T as bt,br as Me,ct as yt,g as kt,jn as wt,kn as xt,kr as gt,m as Ae,ri as jt,st as vt,t as Ct,ut as Se,wr as zt,xr as Wt,yr as Mt}from"./cells-C3u7zgmc.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,r as St,x as _t}from"./ai-model-dropdown-9Z73_iYD.js";import{_ as H,d as _e}from"./useEventListener-BakX-tnw.js";import{r as Dt,x as Nt}from"./utils-Dev6I_Kv.js";import{n as W,t as De}from"./constants-B9JJ72XE.js";import{T as X,v as Pt,w as It}from"./config-3clPIEB9.js";import{t as Et}from"./jsx-runtime-PbYoItBR.js";import{o as Tt}from"./alert-dialog-CC0gG4Av.js";import{a as Lt,c as Ht,i as qt,n as Ft,r as Rt,s as Bt,t as Ot}from"./select-Cjly7tmx.js";import{It as Vt}from"./JsonOutput-DWLzjQfH.js";import{c as Ne,d as ye,n as Yt,o as $t,r as ke,t as Kt}from"./download-CIPflXYw.js";import{t as Ut}from"./tooltip-CgQpRVyN.js";import{r as Gt,t as we}from"./button-BF7GSjhW.js";import{i as Jt,t as Pe}from"./strings-DvZlHYnD.js";import{r as q}from"./requests-KshNNAOp.js";import{t as m}from"./createLucideIcon-BTp1tQDO.js";import{F as Qt,I as Xt,L as Ie,P as Zt,a as Ee,i as Te,u as Le}from"./layout-CIuQ8Vb3.js";import{t as He}from"./check-DQmqoJgr.js";import{r as ea}from"./useCellActionButton-D82Xuv94.js";import{t as ta}from"./code-DP40S9ln.js";import{t as aa}from"./copy-IBNGDypD.js";import{t as qe}from"./eye-off-DI0EQXw0.js";import{t as oa}from"./external-link-BktyywYg.js";import{t as Z}from"./file-BvoBtS_V.js";import{u as na}from"./form-DL-na7MW.js";import{n as ia,r as sa,t as la}from"./youtube-NfBeYlaL.js";import{i as ra,n as Fe}from"./add-connection-dialog-WekDpd6a.js";import{t as da}from"./house-DHu4JLi3.js";import{t as ca}from"./image-BzUcK6ho.js";import{t as ha}from"./link-e5mRDDOC.js";import{r as pa}from"./input-DB2LiTiQ.js";import{t as ma}from"./settings-1WkYMLdR.js";import{t as ua}from"./sparkles-COaEc8Qn.js";import{y as fa}from"./textarea-DOzBgXd_.js";import{t as ba}from"./square-35tXIgiR.js";import{t as M}from"./use-toast-kCNiuc-_.js";import{n as Re,t as ya}from"./paths-DhuNSnZ_.js";import{o as ka}from"./session-CsT5Gg9j.js";import{n as ee}from"./copy-D8MtpXgN.js";import{r as wa}from"./useRunCells-B8rJ_Hwq.js";import{a as xa,c as ga,i as ja,n as va,r as Ca}from"./dialog-DkJmIrsG.js";import{n as xe}from"./ImperativeModal-B62Q6S9l.js";import{r as za,t as Be}from"./share-DQjChRJG.js";import{a as Wa}from"./cell-link-k224YmrQ.js";import{a as Ma}from"./renderShortcut-LpVarhnQ.js";import{t as Aa}from"./icons-avFV3lBF.js";import{t as Sa}from"./pair-with-agent-modal-Q9Od23Rh.js";import{t as _a}from"./github-DghuZBnj.js";import{n as Oe}from"./marimo-icons-DuRILrB8.js";import{t as Da}from"./links-Bof3pNQU.js";import{r as Na,t as Ve}from"./hooks-BtDf7O9d.js";import{t as Ye}from"./types-D4wsSrXa.js";var Pa=m("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Ia=m("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),$e=m("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"}]]),Ke=m("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"}]]),Ue=m("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"}]]),Ea=m("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"}]]),Ta=m("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"}]]),La=m("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"}]]),Ha=m("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"}]]),qa=m("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ge=m("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Fa=m("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"}]]),Ra=m("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"}]]),Je=m("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"}]]),Qe=z(),Xe=ze(ct(),1),a=ze(Et(),1),te="https://static.marimo.app";const Ba=e=>{let t=(0,Qe.c)(25),{onClose:n}=e,[o,i]=(0,Xe.useState)(""),{exportAsHTML:d}=q(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,s=`${te}/static/${l}`,r;t[0]!==d||t[1]!==n||t[2]!==l?(r=async v=>{v.preventDefault(),n();let T=await d({download:!1,includeCode:!0,files:Zt.INSTANCE.filenames()}),A=M({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:T,path:l})}).catch(()=>{A.dismiss(),M({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:W.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),A.dismiss(),M({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=d,t[1]=n,t[2]=l,t[3]=r):r=t[3];let h;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(ga,{children:"Share static notebook"}),t[4]=h):h=t[4];let p;t[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(xa,{children:[h,(0,a.jsxs)(Ca,{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:te,target:"_blank",children:te}),"."]})]}),t[5]=p):p=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{i(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let f;t[7]===o?f=t[8]:(f=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=f);let b;t[9]===s?b=t[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)(Oa,{text:s}),(0,a.jsx)("span",{className:"text-primary",children:s})]})]}),t[9]=s,t[10]=b);let y;t[11]!==f||t[12]!==b?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[f,b]}),t[11]=f,t[12]=b,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(we,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let w;t[16]===s?w=t[17]:(w=(0,a.jsx)(we,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(s)},children:"Create"}),t[16]=s,t[17]=w);let x;t[18]!==k||t[19]!==w?(x=(0,a.jsxs)(ja,{children:[k,w]}),t[18]=k,t[19]=w,t[20]=x):x=t[20];let j;return t[21]!==r||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(va,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:r,children:[p,y,x]})}),t[21]=r,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Oa=e=>{let t=(0,Qe.c)(8),[n,o]=Xe.useState(!1),i;t[0]===e.text?i=t[1]:(i=Gt.stopPropagation(async h=>{h.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=i);let d=i,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let s;t[3]===d?s=t[4]:(s=(0,a.jsx)(we,{"data-testid":"copy-static-notebook-url-button",onClick:d,size:"xs",variant:"secondary",children:l}),t[3]=d,t[4]=s);let r;return t[5]!==n||t[6]!==s?(r=(0,a.jsx)(Ut,{content:"Copied!",open:n,children:s}),t[5]=n,t[6]=s,t[7]=r):r=t[7],r},Va=z();function Ya(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=be.findElement(t);if(!o){H.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:be.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function $a(e){if(!e){H.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(be.create(e.cellId));if(!t){H.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){H.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ze(){let e=(0,Va.c)(2),t=L(Se),n;return e[0]===t?n=e[1]:(n=()=>{let o=Ya();t(i=>({mode:yt(i.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{$a(o)})})},e[0]=t,e[1]=n),n}const et=dt(!1);var Ka=z();const Ua=()=>{let e=(0,Ka.c)(7),{selectedLayout:t}=Ee(),{setLayoutView:n}=Te();if(X()&&!ut("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=s=>n(s),e[0]=n,e[1]=o);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),e[2]=i):i=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(Ft,{children:(0,a.jsxs)(Rt,{children:[(0,a.jsx)(Lt,{children:"View as"}),Ye.map(Ja)]})}),e[3]=d):d=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Ot,{"data-testid":"layout-select",value:t,onValueChange:o,children:[i,d]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ga(e){return(0,a.jsx)(tt(e),{className:"h-4 w-4"})}function tt(e){switch(e){case"vertical":return La;case"grid":return sa;case"slides":return Ge;default:return Jt(e),ba}}function at(e){return Pe.startCase(e)}function Ja(e){return(0,a.jsx)(qt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ga(e),(0,a.jsx)("span",{children:at(e)})]})},e)}async function Qa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Xa=z();function Za(e){let t=(0,Xa.c)(5),{openPrompt:n,closeModal:o}=xe(),{sendCopy:i}=q(),d;return t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==e?(d=()=>{if(!e)return null;let l=ya.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Re.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:s=>{let r=l.join(Re.dirname(e),s);i({source:e,destination:r}).then(()=>{o(),M({title:"Notebook copied",description:"A copy of the notebook has been created."}),Da(r)})}})},t[0]=o,t[1]=n,t[2]=i,t[3]=e,t[4]=d):d=t[4],d}var eo=z();function ot(){let e=(0,eo.c)(4),{openConfirm:t}=xe(),n=L(Pt),{sendRestart:o}=q(),i;return e[0]!==t||e[1]!==o||e[2]!==n?(i=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Tt,{onClick:async()=>{n({state:It.CLOSING}),await o(),za()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=i):i=e[3],i}var to=z(),ao=new ft,oo=e=>ao.isSupported(e)?"markdown":"code";const nt=()=>{let e=(0,to.c)(3),{updateCellConfig:t}=We(),{saveCellConfig:n}=q(),o;return e[0]!==n||e[1]!==t?(o=async(i,d)=>{let l=Ae(),s={};for(let h of l.cellIds.inOrderIds){let p=l.cellData[h];p===void 0||p.config.hide_code===i||oo(p.code)===d&&(s[h]={hide_code:i})}let r=_e.entries(s);if(r.length!==0){await n({configs:s});for(let[h,p]of r)t({cellId:h,config:p})}},e[0]=n,e[1]=t,e[2]=o):o=e[2],o};var no=z(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function io(){var je,ve,Ce;let e=(0,no.c)(56),t=Wa(),{openModal:n,closeModal:o}=xe(),{toggleApplication:i}=xt(),{selectedPanel:d}=ht(),[l]=rt(Se),s=I(vt),r=nt(),[h]=Nt(),p=I(pt),g=I(Dt),{updateCellConfig:f,undoDeleteCell:b,clearAllCellOutputs:y,addSetupCellIfDoesntExist:k,collapseAllCells:w,expandAllCells:x}=We(),j=ot(),v=wa(),T=Za(t),A=L(et),oe=L(At),{handleClick:ne}=St(),ie=L(_t),{exportAsIPYNB:se,exportAsMarkdown:le,readCode:S,saveCellConfig:re,updateCellOutputs:_}=q(),D=Na(),de=I(kt),ce=I(Ct),he=I(bt),{selectedLayout:F}=Ee(),{setLayoutView:pe}=Te(),R=Ze(),B=((je=h.sharing)==null?void 0:je.html)??!0,O=((ve=h.sharing)==null?void 0:ve.wasm)??!0,V=((Ce=h.sharing)==null?void 0:Ce.molab)??!0,ge=!X(),me=F==="slides",it=Co,st=vo,Y;e[0]!==t||e[1]!==D||e[2]!==_?(Y=async c=>{let{preset:u,title:C}=c;if(!t){ae();return}await Ne(C,async fe=>{await Ve({takeScreenshots:()=>D({progress:fe}),updateCellOutputs:_}),await Qa({filename:t,preset:u,downloadPDF:Yt})})},e[0]=t,e[1]=D,e[2]=_,e[3]=Y):Y=e[3];let N=Y,$;e[4]===N?$=e[5]:($=async()=>{if(ge){await N({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),u=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(jo,0),setTimeout(()=>window.dispatchEvent(u),0)},e[4]=N,e[5]=$);let K=$,U;e[6]!==se||e[7]!==t||e[8]!==D||e[9]!==_?(U=async()=>{if(!t){ae();return}await Ne("Downloading IPYNB...",async c=>{await Ve({takeScreenshots:()=>D({progress:c}),updateCellOutputs:_});let u=await se({download:!1});ke(new Blob([u],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},e[6]=se,e[7]=t,e[8]=D,e[9]=_,e[10]=U):U=e[10];let ue=U,G;e[11]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),e[11]=G):G=e[11];let J;e[12]===Symbol.for("react.memo_cache_sentinel")?(J=(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),e[12]=J):J=e[12];let P;e[13]===t?P=e[14]:(P=async()=>{if(!t){ae();return}await Le({filename:t,includeCode:!0})},e[13]=t,e[14]=P);let Q;return e[15]!==k||e[16]!==g||e[17]!==ce||e[18]!==p||e[19]!==y||e[20]!==o||e[21]!==w||e[22]!==T||e[23]!==N||e[24]!==x||e[25]!==le||e[26]!==t||e[27]!==K||e[28]!==ue||e[29]!==de||e[30]!==me||e[31]!==s||e[32]!==n||e[33]!==ne||e[34]!==S||e[35]!==j||e[36]!==v||e[37]!==re||e[38]!==F||e[39]!==d||e[40]!==r||e[41]!==A||e[42]!==ie||e[43]!==pe||e[44]!==oe||e[45]!==B||e[46]!==V||e[47]!==O||e[48]!==P||e[49]!==i||e[50]!==R||e[51]!==b||e[52]!==he||e[53]!==f||e[54]!==l.mode?(Q=[{icon:G,label:"Download",handle:E,dropdown:[{icon:J,label:"Download as HTML",handle:P},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Le({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(Aa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await le({download:!1});ke(new Blob([c],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ha,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ue},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await S();ke(new Blob([c.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ma("global.hideCode",!1)]}),handle:go},me?{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:E,dropdown:[{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:K},{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:st(!0),hidden:!ge,handle:async()=>{await N({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:K}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:X(),handle:async()=>{n((0,a.jsx)(Sa,{onClose:o}))}},{icon:(0,a.jsx)(Fa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!B&&!O&&!V,dropdown:[{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Ba,{onClose:o}))}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!O,handle:async()=>{await ee(Be({code:(await S()).contents})),M({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!V,handle:async()=>{let c=Be({code:(await S()).contents,baseUrl:`${W.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(qa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:wt.flatMap(c=>{let u=c.type==="ai"&&!g;if(mt({panel:c,capabilities:p,aiEnabled:g})&&!u)return[];let{type:C,Icon:fe,additionalKeywords:lt}=c;return{label:Pe.startCase(C),rightElement:it(d===C),icon:(0,a.jsx)(fe,{size:14,strokeWidth:1.5}),handle:()=>{if(u){ne("ai","ai-features");return}i(C)},additionalKeywords:lt}})},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(fa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qt,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Ye.map((c,u)=>{let C=tt(c);return{divider:u===0,label:at(c),icon:(0,a.jsx)(C,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:F===c&&(0,a.jsx)(He,{size:14})}),handle:()=>{pe(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||X(),handle:T},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await S()).contents),M({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!de||s,handle:async()=>{let c=jt(Ae());await re({configs:_e.fromEntries(c.map(xo))});for(let u of c)f({cellId:u,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ue,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{k({})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Fe,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Fe,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:he,hidden:!ce||s,handle:()=>{b()}},{icon:(0,a.jsx)(Ra,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:j,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{v()}},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{y()}},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>r(!1,"code"),redundant:!0},{icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>r(!0,"code"),redundant:!0},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>r(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>r(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:w,redundant:!0},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>A(wo)},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>ie(ko)},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>oe(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:bo},{icon:(0,a.jsx)(_a,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:uo},{icon:(0,a.jsx)(la,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:mo},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Open home",hidden:!location.search.includes("file"),handle:ho},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:co}].filter(ro).map(so),e[15]=k,e[16]=g,e[17]=ce,e[18]=p,e[19]=y,e[20]=o,e[21]=w,e[22]=T,e[23]=N,e[24]=x,e[25]=le,e[26]=t,e[27]=K,e[28]=ue,e[29]=de,e[30]=me,e[31]=s,e[32]=n,e[33]=ne,e[34]=S,e[35]=j,e[36]=v,e[37]=re,e[38]=F,e[39]=d,e[40]=r,e[41]=A,e[42]=ie,e[43]=pe,e[44]=oe,e[45]=B,e[46]=V,e[47]=O,e[48]=P,e[49]=i,e[50]=R,e[51]=b,e[52]=he,e[53]=f,e[54]=l.mode,e[55]=Q):Q=e[55],Q}function so(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(lo)}:e}function lo(e){return!e.hidden}function ro(e){return!e.hidden}function co(){let e=ka();window.open(e,"_blank")}function ho(){let e=document.baseURI.split("?")[0];window.open(e,"_blank","noopener")}function po(){window.open(W.releasesPage,"_blank")}function mo(){window.open(W.youtube,"_blank")}function uo(){window.open(W.discordLink,"_blank")}function fo(){window.open(W.githubPage,"_blank")}function bo(){window.open(W.docsPage,"_blank")}function yo(e){return!e}function ko(e){return!e}function wo(e){return!e}function xo(e){return[e,{disabled:!1}]}async function go(){let e=document.getElementById("App");e&&await $t({element:e,filename:document.title,prepare:Kt})}function jo(){return window.print()}function vo(e){return e?(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"}):null}function Co(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(He,{size:14})})}function ae(){M({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{et as a,Ue as c,Ua as i,Ke as l,nt as n,Ze as o,ot as r,Je as s,io as t,$e 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-Co7t4LPQ.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-C9lIEelG.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.23.14-dev25",
3
+ "version": "0.23.14-dev30",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -0,0 +1,33 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { describe, expect, it } from "vitest";
4
+ import type { FieldTypesWithExternalType } from "@/components/data-table/types";
5
+ import { mergeIndexFields } from "../charts";
6
+
7
+ describe("mergeIndexFields", () => {
8
+ it("appends row-header (index) fields to field types", () => {
9
+ const fieldTypes: FieldTypesWithExternalType = [["v", ["number", "int64"]]];
10
+ const rowHeaders: FieldTypesWithExternalType = [
11
+ ["k", ["string", "object"]],
12
+ ];
13
+ expect(mergeIndexFields(fieldTypes, rowHeaders)).toEqual([
14
+ ["v", ["number", "int64"]],
15
+ ["k", ["string", "object"]],
16
+ ]);
17
+ });
18
+
19
+ it("de-dupes when an index name matches a column name", () => {
20
+ const fieldTypes: FieldTypesWithExternalType = [["k", ["number", "int64"]]];
21
+ const rowHeaders: FieldTypesWithExternalType = [
22
+ ["k", ["string", "object"]],
23
+ ];
24
+ expect(mergeIndexFields(fieldTypes, rowHeaders)).toEqual([
25
+ ["k", ["number", "int64"]],
26
+ ]);
27
+ });
28
+
29
+ it("returns field types unchanged when there are no row headers", () => {
30
+ const fieldTypes: FieldTypesWithExternalType = [["v", ["number", "int64"]]];
31
+ expect(mergeIndexFields(fieldTypes, [])).toEqual(fieldTypes);
32
+ });
33
+ });
@@ -54,6 +54,24 @@ const CHART_HEIGHT = 290;
54
54
  const CHART_MAX_ROWS = 50_000;
55
55
  const CHART_MAX_COLUMNS = 50;
56
56
 
57
+ /**
58
+ * Append row-header (index) fields to the chart field list, skipping any whose
59
+ * name already exists as a data column so the chart builder never offers the
60
+ * same axis twice.
61
+ */
62
+ export function mergeIndexFields(
63
+ fieldTypes: FieldTypesWithExternalType | null | undefined,
64
+ rowHeaders: FieldTypesWithExternalType | null | undefined,
65
+ ): FieldTypesWithExternalType {
66
+ const base = fieldTypes ?? [];
67
+ if (!rowHeaders || rowHeaders.length === 0) {
68
+ return base;
69
+ }
70
+ const seen = new Set(base.map(([name]) => name));
71
+ const indexFields = rowHeaders.filter(([name]) => !seen.has(name));
72
+ return [...base, ...indexFields];
73
+ }
74
+
57
75
  export interface TablePanelProps {
58
76
  cellId: CellId | null;
59
77
  data: unknown[];
@@ -64,6 +82,7 @@ export interface TablePanelProps {
64
82
  onCloseChartBuilder?: () => void;
65
83
  getDataUrl?: GetDataUrl;
66
84
  fieldTypes?: FieldTypesWithExternalType | null;
85
+ rowHeaders?: FieldTypesWithExternalType | null;
67
86
  }
68
87
 
69
88
  export const TablePanel: React.FC<TablePanelProps> = ({
@@ -74,6 +93,7 @@ export const TablePanel: React.FC<TablePanelProps> = ({
74
93
  columns,
75
94
  getDataUrl,
76
95
  fieldTypes,
96
+ rowHeaders,
77
97
  displayHeader,
78
98
  onCloseChartBuilder,
79
99
  }) => {
@@ -265,7 +285,10 @@ export const TablePanel: React.FC<TablePanelProps> = ({
265
285
  saveChart={saveChart}
266
286
  saveChartType={saveChartType}
267
287
  getDataUrl={getDataUrl}
268
- fieldTypes={fieldTypes ?? inferFieldTypes(dataTable.props.data)}
288
+ fieldTypes={mergeIndexFields(
289
+ fieldTypes ?? inferFieldTypes(dataTable.props.data),
290
+ rowHeaders,
291
+ )}
269
292
  isLargeDataset={isLargeDataset}
270
293
  />
271
294
  </TabsContent>
@@ -35,7 +35,7 @@ import {
35
35
  import { Label } from "@/components/ui/label";
36
36
  import { NumberField } from "@/components/ui/number-field";
37
37
  import { Switch } from "@/components/ui/switch";
38
- import { outputIsLoading } from "@/core/cells/cell";
38
+ import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
39
39
  import type { CellId } from "@/core/cells/ids";
40
40
  import type { AppMode } from "@/core/mode";
41
41
  import { useIsDragging } from "@/hooks/useIsDragging";
@@ -222,6 +222,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
222
222
  cellId={cell.id}
223
223
  output={cell.output}
224
224
  status={cell.status}
225
+ stale={outputIsStale(cell, false)}
225
226
  isScrollable={isScrollable}
226
227
  side={side}
227
228
  hidden={cell.errored || cell.interrupted || cell.stopped}
@@ -288,6 +289,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
288
289
  cellId={cell.id}
289
290
  output={cell.output}
290
291
  status={cell.status}
292
+ stale={outputIsStale(cell, false)}
291
293
  isScrollable={false}
292
294
  hidden={false}
293
295
  />
@@ -358,6 +360,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
358
360
  output={cell.output}
359
361
  isScrollable={false}
360
362
  status={cell.status}
363
+ stale={outputIsStale(cell, false)}
361
364
  hidden={false}
362
365
  />
363
366
  </div>
@@ -376,6 +379,7 @@ interface GridCellProps extends Pick<CellRuntimeState, "output" | "status"> {
376
379
  hidden: boolean;
377
380
  isScrollable: boolean;
378
381
  side?: GridLayoutCellSide;
382
+ stale: boolean;
379
383
  }
380
384
 
381
385
  const GridCell = memo(
@@ -389,6 +393,7 @@ const GridCell = memo(
389
393
  isScrollable,
390
394
  side,
391
395
  className,
396
+ stale,
392
397
  }: GridCellProps) => {
393
398
  const loading = outputIsLoading(status);
394
399
 
@@ -415,7 +420,7 @@ const GridCell = memo(
415
420
  allowExpand={false}
416
421
  output={output}
417
422
  cellId={cellId}
418
- stale={loading}
423
+ stale={stale}
419
424
  loading={loading}
420
425
  />
421
426
  </div>
@@ -0,0 +1,33 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { render } from "@testing-library/react";
4
+ import { describe, expect, it } from "vitest";
5
+ import type { CellId } from "@/core/cells/ids";
6
+ import type { OutputMessage } from "@/core/kernel/messages";
7
+ import type { Seconds } from "@/utils/time";
8
+ import { Slide } from "../slide";
9
+
10
+ const cellId = "cell-1" as CellId;
11
+
12
+ const output: OutputMessage = {
13
+ channel: "output",
14
+ mimetype: "text/plain",
15
+ data: "hello",
16
+ timestamp: 0 as Seconds,
17
+ };
18
+
19
+ describe("Slide", () => {
20
+ it("does not grey out the output when stale is false", () => {
21
+ const { container } = render(
22
+ <Slide cellId={cellId} status="running" output={output} stale={false} />,
23
+ );
24
+ expect(container.querySelector(".marimo-output-stale")).toBeNull();
25
+ });
26
+
27
+ it("greys out the output when stale is true", () => {
28
+ const { container } = render(
29
+ <Slide cellId={cellId} status="queued" output={output} stale={true} />,
30
+ );
31
+ expect(container.querySelector(".marimo-output-stale")).not.toBeNull();
32
+ });
33
+ });
@@ -1,6 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import { useDeleteCellCallback } from "@/components/editor/cell/useDeleteCell";
4
+ import { outputIsStale } from "@/core/cells/cell";
4
5
  import { useCellActions, useCellIds } from "@/core/cells/cells";
5
6
  import type { CellId } from "@/core/cells/ids";
6
7
  import type { CellColumnId } from "@/utils/id-tree";
@@ -670,7 +671,12 @@ const SlideThumbnailCard = ({
670
671
  {isNoOutput ? (
671
672
  <MiniCodePreview code={cell.code} />
672
673
  ) : (
673
- <Slide cellId={cell.id} status={cell.status} output={cell.output} />
674
+ <Slide
675
+ cellId={cell.id}
676
+ status={cell.status}
677
+ output={cell.output}
678
+ stale={outputIsStale(cell, false)}
679
+ />
674
680
  )}
675
681
  </div>
676
682
  )}
@@ -16,6 +16,7 @@ import { Slide as CellOutputSlide } from "@/components/slides/slide";
16
16
  import { Button } from "@/components/ui/button";
17
17
  import { useFullScreenElement } from "@/components/ui/fullscreen";
18
18
  import { Tooltip } from "@/components/ui/tooltip";
19
+ import { outputIsStale } from "@/core/cells/cell";
19
20
  import type { CellId } from "@/core/cells/ids";
20
21
  import type { RuntimeCell } from "@/core/cells/types";
21
22
  import type { RevealApi, RevealConfig } from "reveal.js";
@@ -333,6 +334,7 @@ const SubslideView = ({
333
334
  cellId={cell.id}
334
335
  status={cell.status}
335
336
  output={cell.output}
337
+ stale={outputIsStale(cell, false)}
336
338
  />
337
339
  );
338
340
  }
@@ -397,6 +399,7 @@ const ParkedPreviewContent = ({
397
399
  cellId={cell.id}
398
400
  status={cell.status}
399
401
  output={cell.output}
402
+ stale={outputIsStale(cell, false)}
400
403
  />
401
404
  );
402
405
  };
@@ -13,6 +13,7 @@ import { StopButton } from "@/components/editor/cell/StopButton";
13
13
  import { useRunCell } from "@/components/editor/cell/useRunCells";
14
14
  import { Slide as CellOutputSlide } from "@/components/slides/slide";
15
15
  import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
16
+ import { outputIsStale } from "@/core/cells/cell";
16
17
  import { useCellActions } from "@/core/cells/cells";
17
18
  import { autoInstantiateAtom, useUserConfig } from "@/core/config/config";
18
19
  import {
@@ -96,6 +97,7 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
96
97
  cellId={cell.id}
97
98
  status={cell.status}
98
99
  output={cell.output}
100
+ stale={outputIsStale(cell, false)}
99
101
  />
100
102
  );
101
103
 
@@ -195,6 +197,7 @@ export const SlideCellReadOnlyView = ({ cell }: { cell: RuntimeCell }) => {
195
197
  cellId={cell.id}
196
198
  status={cell.status}
197
199
  output={cell.output}
200
+ stale={outputIsStale(cell, false)}
198
201
  />
199
202
  );
200
203
 
@@ -11,19 +11,22 @@ interface SlideContentProps extends Pick<
11
11
  "output" | "status"
12
12
  > {
13
13
  cellId: CellId;
14
+ stale: boolean;
14
15
  }
15
16
 
16
- export const Slide = memo(({ output, cellId, status }: SlideContentProps) => {
17
- const loading = outputIsLoading(status);
18
- return (
19
- <OutputArea
20
- className="contents"
21
- allowExpand={false}
22
- output={output}
23
- cellId={cellId}
24
- stale={loading}
25
- loading={loading}
26
- />
27
- );
28
- });
17
+ export const Slide = memo(
18
+ ({ output, cellId, status, stale }: SlideContentProps) => {
19
+ const loading = outputIsLoading(status);
20
+ return (
21
+ <OutputArea
22
+ className="contents"
23
+ allowExpand={false}
24
+ output={output}
25
+ cellId={cellId}
26
+ stale={stale}
27
+ loading={loading}
28
+ />
29
+ );
30
+ },
31
+ );
29
32
  Slide.displayName = "Slide";
@@ -805,6 +805,7 @@ export const LoadingDataTableComponent = memo(
805
805
  dataTable={dataTable}
806
806
  getDataUrl={props.get_data_url}
807
807
  fieldTypes={props.fieldTypes}
808
+ rowHeaders={props.rowHeaders}
808
809
  cellId={cellId}
809
810
  />
810
811
  ) : (