@marimo-team/frontend 0.24.1-dev109 → 0.24.1-dev110

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 (27) hide show
  1. package/dist/assets/{JsonOutput-DflXi8WP.js → JsonOutput-BYSpdF43.js} +10 -10
  2. package/dist/assets/{agent-panel-CvylOk8N.js → agent-panel-CIGDXQtn.js} +1 -1
  3. package/dist/assets/{cell-editor-B2FYa_r2.js → cell-editor-D7fjZc8_.js} +2 -2
  4. package/dist/assets/{column-preview-4ZtjRVCL.js → column-preview-Bnrq4bEC.js} +1 -1
  5. package/dist/assets/{command-palette-_ZYa5wz-.js → command-palette-CYaDy4p2.js} +1 -1
  6. package/dist/assets/{edit-page-DhK8zpUw.js → edit-page-DvStrWEF.js} +6 -6
  7. package/dist/assets/{file-explorer-panel-CBi7IrTJ.js → file-explorer-panel-CC4C9SnN.js} +1 -1
  8. package/dist/assets/index-BHZDiHTq.js +29 -0
  9. package/dist/assets/{layout-B1OYn1x9.js → layout-BBzwwt8g.js} +5 -5
  10. package/dist/assets/{panels-Bpc7gKzJ.js → panels-BTHaPtUZ.js} +1 -1
  11. package/dist/assets/{reveal-component-C-5eIjh7.js → reveal-component-CawytCeQ.js} +1 -1
  12. package/dist/assets/{run-page-Jmrd4hPR.js → run-page-DrxVLavD.js} +1 -1
  13. package/dist/assets/{scratchpad-panel-B37VTDcH.js → scratchpad-panel-DUioP0f7.js} +1 -1
  14. package/dist/assets/session-panel-DiKPWSPU.js +1 -0
  15. package/dist/assets/{skeleton-BOqU4fSS.js → skeleton-BDmfpU3X.js} +1 -1
  16. package/dist/assets/{useNotebookActions-Bh1LWIwk.js → useNotebookActions-AeYQuSXc.js} +2 -2
  17. package/dist/index.html +3 -3
  18. package/package.json +1 -1
  19. package/src/components/data-table/__tests__/column-explorer.test.tsx +61 -2
  20. package/src/components/data-table/__tests__/column-visibility-dropdown.test.tsx +130 -1
  21. package/src/components/data-table/__tests__/useColumnVisibility.test.ts +153 -1
  22. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +54 -25
  23. package/src/components/data-table/column-visibility-dropdown.tsx +62 -14
  24. package/src/components/data-table/hooks/use-column-visibility.ts +76 -0
  25. package/src/components/data-table/show-only-column-button.tsx +58 -0
  26. package/dist/assets/index-PQMiMaaL.js +0 -29
  27. package/dist/assets/session-panel-DNhueSlc.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-xfs0Sn4r.js";import{t as o}from"./react-CBDbhulC.js";import{$i as s,$r as c,Co as l,D as u,E as d,Hi as f,Jr as p,Kn as m,La as h,Po as g,Qi as _,Qr as v,Rt as y,Tt as b,Vi as x,_ as S,aa as C,b as w,di as T,dn as E,ea as D,ei as ee,h as te,la as ne,mo as O,ni as k,or as A,ra as j,ri as M,t as re,un as N,yo as P}from"./cells-qgj2MHef.js";import{Cn as F,kt as I,vt as L}from"./schemas-aTUejmFi.js";import{t as R}from"./compiler-runtime-CYIjoINj.js";import{r as ie,w as z}from"./utils-B-_Wem_I.js";import{C as B,n as V,r as H}from"./ai-model-dropdown-BDhRgfa7.js";import{g as U,n as W}from"./useEventListener-92uWqz-P.js";import{t as ae}from"./objects-snlMn4yk.js";import{n as G,t as K}from"./constants-BDbGiS7O.js";import{A as q,M as oe,N as J,O as se,T as ce,j as le,k as ue,v as de}from"./config-BRRSKtP3.js";import{t as fe}from"./switch-qLxqA0gx.js";import{g as pe,h as me,m as he,y as ge}from"./readonly-python-code-C-Iv7xif.js";import{t as _e}from"./cn-ldLVeaqm.js";import{t as ve}from"./jsx-runtime-B74pBk57.js";import{o as ye}from"./alert-dialog-D_btUJmY.js";import{i as be,n as xe,r as Se,t as Ce}from"./tabs-CIEoDqa7.js";import{a as we,c as Te,i as Ee,n as De,r as Oe,s as ke,t as Ae}from"./select-4UL7AAMx.js";import{Pt as je,X as Me}from"./JsonOutput-DflXi8WP.js";import{a as Ne,c as Pe,o as Fe,p as Ie,t as Le}from"./download-BenVNUUc.js";import{t as Re}from"./tooltip-BO5vfMvm.js";import{n as ze,r as Be,t as Ve}from"./button-MlJ5qApt.js";import{i as He,r as Ue,t as We}from"./strings-CReV1AYG.js";import{r as Ge}from"./requests-C6_IaFh7.js";import{t as Y}from"./createLucideIcon-B7HeEoG2.js";import{L as Ke,R as qe,c as Je,l as Ye,t as Xe,z as Ze}from"./layout-B1OYn1x9.js";import{t as Qe}from"./check-BoA6XBpj.js";import{r as $e}from"./useCellActionButton-BkFPMNO9.js";import{t as et}from"./code-CF0HKE9K.js";import{t as tt}from"./copy-BMXKNElG.js";import{t as nt}from"./eye-off-CFuPxa9F.js";import{t as rt}from"./external-link-Bp3BxyRA.js";import{t as it}from"./file-DF8n85RA.js";import{t as at}from"./globe-BQf75qV_.js";import{n as ot,r as st,t as ct}from"./youtube-DCJ-ihUU.js";import{n as lt}from"./components-DAhqHptJ.js";import{i as ut,n as dt,r as ft}from"./markdown-export-0rLbaq8b.js";import{t as pt}from"./image-ab13yGv4.js";import{D as mt,E as ht,O as gt,T as _t,b as vt,j as yt}from"./write-secret-modal-DgqX3xEF.js";import{t as bt}from"./link-Cap-MZiw.js";import{t as xt}from"./spinner-Ck-Hgfvj.js";import{r as St}from"./input-Ddnr8OdM.js";import{t as Ct}from"./settings-C-cYas75.js";import{t as wt}from"./square-B58Ib8Ir.js";import{t as Tt}from"./triangle-alert-MihykDYG.js";import{t as Et}from"./use-toast-DpWHUGuF.js";import{n as Dt,t as Ot}from"./paths-zcL04qUW.js";import{o as kt}from"./session-Sz5nSFku.js";import{n as At}from"./useAsyncData-Buhk-UgR.js";import{n as jt}from"./copy-DlEomWzI.js";import{t as Mt}from"./copy-icon-zfaCsLjV.js";import{r as Nt}from"./useRunCells-B0cXvtXO.js";import{r as Pt,t as Ft}from"./share-CPtBiNgr.js";import{n as It,t as Lt}from"./alert-dmKwNsrp.js";import{a as Rt}from"./cell-link-RjRAdD7j.js";import{t as zt}from"./icons-CjLa9BiH.js";import{i as Bt,n as Vt}from"./error-entries-VeWh8139.js";import{t as Ht}from"./shell-DLpUCctE.js";import{t as Ut}from"./pair-with-agent-modal-B--3Xpp8.js";import{i as Wt,n as Gt,r as Kt}from"./add-connection-dialog-CFI3g7Qq.js";import{t as qt}from"./github-YRgb6LMu.js";import{n as Jt}from"./marimo-icons-C3KxMV9A.js";import{t as Yt}from"./links-DLvOXyO_.js";import{i as Xt,n as Zt,t as Qt}from"./skeleton-BOqU4fSS.js";var $t=Y(`circle-chevron-down`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 10-4 4-4-4`,key:`894hmk`}]]),en=Y(`circle-chevron-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m10 8 4 4-4 4`,key:`1wy4r4`}]]),tn=Y(`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`}]]),nn=Y(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),rn=Y(`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`}]]),an=Y(`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`}]]),on=Y(`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`}]]),sn=Y(`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`}]]),cn=Y(`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`}]]),ln=Y(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),un=Y(`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`}]]),dn=Y(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),fn=Y(`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`}]]),pn=Y(`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`}]]),mn=Y(`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`}]]),hn=Y(`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`}]]),X=ve(),Z=R(),Q=e(o(),1);function gn(e,t){let n=(0,Z.c)(11),r;n[0]===t?r=n[1]:(r=new O(t),n[0]=t,n[1]=r);let i=r,a;n[2]!==e||n[3]!==i?(a=()=>i.get(e),n[2]=e,n[3]=i,n[4]=a):a=n[4];let[o,s]=(0,Q.useState)(a),c;n[5]!==e||n[6]!==i?(c=t=>{s(t),i.set(e,t)},n[5]=e,n[6]=i,n[7]=c):c=n[7];let l=c,u;return n[8]!==l||n[9]!==o?(u=[o,l],n[8]=l,n[9]=o,n[10]=u):u=n[10],u}function _n(e,t){return{...e,Binaries:{...e.Binaries,Browser:t}}}function vn(e,t,n,r){return{marimo:e,Locale:n||void 0,Binaries:{Browser:t},"Environment Collection Error":r}}function yn(e,t){let n=Math.max(2,...Array.from(t.matchAll(/`+/g),e=>e[0].length)),r="`".repeat(n+1);return`${r}${e}\n${t}\n${r}`}function bn(e,t){let n=e.includes(`?`)?`&`:`?`,r=[],i=e,a=0;for(let[e,o]of Object.entries(t)){if(o.length===0)continue;let t=`${e}=${encodeURIComponent(o)}`,s=`${i}${a===0?n:`&`}${t}`;if(s.length>6e3){r.push(e);continue}i=s,a+=1}return{url:i,omitted:r}}function xn(e,t){return[`<details>`,`<summary>${We.htmlEscape(e)??``}</summary>`,``,t,``,`</details>`].join(`
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r as i,u as a}from"./useEvent-xfs0Sn4r.js";import{t as o}from"./react-CBDbhulC.js";import{$i as s,$r as c,Co as l,D as u,E as d,Hi as f,Jr as p,Kn as m,La as h,Po as g,Qi as _,Qr as v,Rt as y,Tt as b,Vi as x,_ as S,aa as C,b as w,di as T,dn as E,ea as D,ei as ee,h as te,la as ne,mo as O,ni as k,or as A,ra as j,ri as M,t as re,un as N,yo as P}from"./cells-qgj2MHef.js";import{Cn as F,kt as I,vt as L}from"./schemas-aTUejmFi.js";import{t as R}from"./compiler-runtime-CYIjoINj.js";import{r as ie,w as z}from"./utils-B-_Wem_I.js";import{C as B,n as V,r as H}from"./ai-model-dropdown-BDhRgfa7.js";import{g as U,n as W}from"./useEventListener-92uWqz-P.js";import{t as ae}from"./objects-snlMn4yk.js";import{n as G,t as K}from"./constants-BDbGiS7O.js";import{A as q,M as oe,N as J,O as se,T as ce,j as le,k as ue,v as de}from"./config-BRRSKtP3.js";import{t as fe}from"./switch-qLxqA0gx.js";import{g as pe,h as me,m as he,y as ge}from"./readonly-python-code-C-Iv7xif.js";import{t as _e}from"./cn-ldLVeaqm.js";import{t as ve}from"./jsx-runtime-B74pBk57.js";import{o as ye}from"./alert-dialog-D_btUJmY.js";import{i as be,n as xe,r as Se,t as Ce}from"./tabs-CIEoDqa7.js";import{a as we,c as Te,i as Ee,n as De,r as Oe,s as ke,t as Ae}from"./select-4UL7AAMx.js";import{$ as je,Lt as Me}from"./JsonOutput-BYSpdF43.js";import{a as Ne,c as Pe,o as Fe,p as Ie,t as Le}from"./download-BenVNUUc.js";import{t as Re}from"./tooltip-BO5vfMvm.js";import{n as ze,r as Be,t as Ve}from"./button-MlJ5qApt.js";import{i as He,r as Ue,t as We}from"./strings-CReV1AYG.js";import{r as Ge}from"./requests-C6_IaFh7.js";import{t as Y}from"./createLucideIcon-B7HeEoG2.js";import{L as Ke,R as qe,c as Je,l as Ye,t as Xe,z as Ze}from"./layout-BBzwwt8g.js";import{t as Qe}from"./check-BoA6XBpj.js";import{r as $e}from"./useCellActionButton-BkFPMNO9.js";import{t as et}from"./code-CF0HKE9K.js";import{t as tt}from"./copy-BMXKNElG.js";import{t as nt}from"./eye-off-CFuPxa9F.js";import{t as rt}from"./external-link-Bp3BxyRA.js";import{t as it}from"./file-DF8n85RA.js";import{t as at}from"./globe-BQf75qV_.js";import{n as ot,r as st,t as ct}from"./youtube-DCJ-ihUU.js";import{n as lt}from"./components-DAhqHptJ.js";import{i as ut,n as dt,r as ft}from"./markdown-export-0rLbaq8b.js";import{t as pt}from"./image-ab13yGv4.js";import{D as mt,E as ht,O as gt,T as _t,b as vt,j as yt}from"./write-secret-modal-DgqX3xEF.js";import{t as bt}from"./link-Cap-MZiw.js";import{t as xt}from"./spinner-Ck-Hgfvj.js";import{r as St}from"./input-Ddnr8OdM.js";import{t as Ct}from"./settings-C-cYas75.js";import{t as wt}from"./square-B58Ib8Ir.js";import{t as Tt}from"./triangle-alert-MihykDYG.js";import{t as Et}from"./use-toast-DpWHUGuF.js";import{n as Dt,t as Ot}from"./paths-zcL04qUW.js";import{o as kt}from"./session-Sz5nSFku.js";import{n as At}from"./useAsyncData-Buhk-UgR.js";import{n as jt}from"./copy-DlEomWzI.js";import{t as Mt}from"./copy-icon-zfaCsLjV.js";import{r as Nt}from"./useRunCells-B0cXvtXO.js";import{r as Pt,t as Ft}from"./share-CPtBiNgr.js";import{n as It,t as Lt}from"./alert-dmKwNsrp.js";import{a as Rt}from"./cell-link-RjRAdD7j.js";import{t as zt}from"./icons-CjLa9BiH.js";import{i as Bt,n as Vt}from"./error-entries-VeWh8139.js";import{t as Ht}from"./shell-DLpUCctE.js";import{t as Ut}from"./pair-with-agent-modal-B--3Xpp8.js";import{i as Wt,n as Gt,r as Kt}from"./add-connection-dialog-CFI3g7Qq.js";import{t as qt}from"./github-YRgb6LMu.js";import{n as Jt}from"./marimo-icons-C3KxMV9A.js";import{t as Yt}from"./links-DLvOXyO_.js";import{i as Xt,n as Zt,t as Qt}from"./skeleton-BDmfpU3X.js";var $t=Y(`circle-chevron-down`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 10-4 4-4-4`,key:`894hmk`}]]),en=Y(`circle-chevron-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m10 8 4 4-4 4`,key:`1wy4r4`}]]),tn=Y(`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`}]]),nn=Y(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),rn=Y(`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`}]]),an=Y(`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`}]]),on=Y(`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`}]]),sn=Y(`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`}]]),cn=Y(`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`}]]),ln=Y(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),un=Y(`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`}]]),dn=Y(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),fn=Y(`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`}]]),pn=Y(`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`}]]),mn=Y(`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`}]]),hn=Y(`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`}]]),X=ve(),Z=R(),Q=e(o(),1);function gn(e,t){let n=(0,Z.c)(11),r;n[0]===t?r=n[1]:(r=new O(t),n[0]=t,n[1]=r);let i=r,a;n[2]!==e||n[3]!==i?(a=()=>i.get(e),n[2]=e,n[3]=i,n[4]=a):a=n[4];let[o,s]=(0,Q.useState)(a),c;n[5]!==e||n[6]!==i?(c=t=>{s(t),i.set(e,t)},n[5]=e,n[6]=i,n[7]=c):c=n[7];let l=c,u;return n[8]!==l||n[9]!==o?(u=[o,l],n[8]=l,n[9]=o,n[10]=u):u=n[10],u}function _n(e,t){return{...e,Binaries:{...e.Binaries,Browser:t}}}function vn(e,t,n,r){return{marimo:e,Locale:n||void 0,Binaries:{Browser:t},"Environment Collection Error":r}}function yn(e,t){let n=Math.max(2,...Array.from(t.matchAll(/`+/g),e=>e[0].length)),r="`".repeat(n+1);return`${r}${e}\n${t}\n${r}`}function bn(e,t){let n=e.includes(`?`)?`&`:`?`,r=[],i=e,a=0;for(let[e,o]of Object.entries(t)){if(o.length===0)continue;let t=`${e}=${encodeURIComponent(o)}`,s=`${i}${a===0?n:`&`}${t}`;if(s.length>6e3){r.push(e);continue}i=s,a+=1}return{url:i,omitted:r}}function xn(e,t){return[`<details>`,`<summary>${We.htmlEscape(e)??``}</summary>`,``,t,``,`</details>`].join(`
2
2
  `)}function Sn(e){return xn(`Environment`,yn(`json`,JSON.stringify(e,null,2)))}function Cn(e){return xn(`Errors`,yn(`text`,e.map(Vt).join(`
3
3
 
4
4
  ---
@@ -7,4 +7,4 @@ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,r
7
7
 
8
8
  ---
9
9
 
10
- `)})]}),e[71]=C,e[72]=se);let le;e[73]===C?le=e[74]:(le=C&&u.length===0&&(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No errors detected.`}),e[73]=C,e[74]=le);let ue;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,X.jsx)(`a`,{href:G.feedbackForm,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`two-minute survey`}),e[75]=ue):ue=e[75];let fe;e[76]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(`div`,{className:`border-t pt-3`,children:(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Other feedback? Take our`,` `,ue,` `,`or chat with us on`,` `,(0,X.jsx)(`a`,{href:G.discordLink,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Discord`}),`.`]})}),e[76]=fe):fe=e[76];let pe;return e[77]!==K||e[78]!==q||e[79]!==oe||e[80]!==J||e[81]!==se||e[82]!==le?(pe=(0,X.jsxs)(_t,{className:`w-[540px] max-w-[90vw]`,children:[A,(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto`,children:[K,q,oe,J,se,le,fe]})]}),e[77]=K,e[78]=q,e[79]=oe,e[80]=J,e[81]=se,e[82]=le,e[83]=pe):pe=e[83],pe};function kn(e){return!e}function An(e){return e===`bug-description`?`errors`:e===`reproduction-code`?`code`:e}var jn=`https://static.marimo.app`,Mn=e=>{let t=(0,Z.c)(26),{onClose:n}=e,[r,i]=(0,Q.useState)(``),{exportAsHTML:a}=Ge(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Math.random().toString(36).slice(2,6),t[0]=o):o=t[0];let s=`${r}-${o}`,c=`${jn}/static/${s}`,l;t[1]!==a||t[2]!==n||t[3]!==s?(l=async e=>{e.preventDefault(),n();let{contents:t}=await a({download:!1,includeCode:!0,files:Je.INSTANCE.filenames(),layout:await Xe()}),r=Et({title:`Uploading static notebook...`,description:`Please wait.`});await fetch(`${jn}/api/static`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({html:t,path:s})}).catch(()=>{r.dismiss(),Et({title:`Error uploading static page`,description:(0,X.jsxs)(`div`,{children:[`Please try again later. If the problem persists, please file a bug report on`,` `,(0,X.jsx)(`a`,{href:G.issuesPage,target:`_blank`,className:`underline`,children:`GitHub`}),`.`]})})}),r.dismiss(),Et({title:`Static page uploaded!`,description:(0,X.jsxs)(`div`,{children:[`The URL has been copied to your clipboard.`,(0,X.jsx)(`br`,{}),`You can share it with anyone.`]})})},t[1]=a,t[2]=n,t[3]=s,t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(yt,{children:`Share static notebook`}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(gt,{children:[u,(0,X.jsxs)(ht,{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,X.jsx)(`a`,{href:jn,target:`_blank`,children:jn}),`.`]})]}),t[6]=d):d=t[6];let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{let t=e.target.value.toLowerCase().replaceAll(/\s/g,`-`).replaceAll(/[^\da-z-]/g,``);i(t)},t[7]=f):f=t[7];let p;t[8]===r?p=t[9]:(p=(0,X.jsx)(St,{"data-testid":`slug-input`,id:`slug`,autoFocus:!0,value:r,placeholder:`Notebook slug`,onChange:f,required:!0,autoComplete:`off`}),t[8]=r,t[9]=p);let m;t[10]===c?m=t[11]:(m=(0,X.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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Nn,{text:c}),(0,X.jsx)(`span`,{className:`text-primary`,children:c})]})]}),t[10]=c,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col gap-6 py-4`,children:[p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===n?g=t[16]:(g=(0,X.jsx)(Ve,{"data-testid":`cancel-share-static-notebook-button`,variant:`secondary`,onClick:n,children:`Cancel`}),t[15]=n,t[16]=g);let _;t[17]===c?_=t[18]:(_=(0,X.jsx)(Ve,{"data-testid":`share-static-notebook-button`,"aria-label":`Save`,variant:`default`,type:`submit`,onClick:async()=>{await jt(c)},children:`Create`}),t[17]=c,t[18]=_);let v;t[19]!==_||t[20]!==g?(v=(0,X.jsxs)(mt,{children:[g,_]}),t[19]=_,t[20]=g,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==l||t[24]!==h?(y=(0,X.jsx)(_t,{className:`w-fit`,children:(0,X.jsxs)(`form`,{onSubmit:l,children:[d,h,v]})}),t[22]=v,t[23]=l,t[24]=h,t[25]=y):y=t[25],y},Nn=e=>{let t=(0,Z.c)(8),[n,r]=Q.useState(!1),i;t[0]===e.text?i=t[1]:(i=Be.stopPropagation(async t=>{t.preventDefault(),await jt(e.text),r(!0),setTimeout(()=>r(!1),2e3)}),t[0]=e.text,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(tt,{size:14,strokeWidth:1.5}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,X.jsx)(Ve,{"data-testid":`copy-static-notebook-url-button`,onClick:a,size:`xs`,variant:`secondary`,children:o}),t[3]=a,t[4]=s);let c;return t[5]!==n||t[6]!==s?(c=(0,X.jsx)(Re,{content:`Copied!`,open:n,children:s}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c};function Pn(){let e=document.getElementsByClassName(K.outputArea);for(let t of e){let e=t.getBoundingClientRect();if(e.bottom>0&&e.top<window.innerHeight){let e=g.findElement(t);if(!e){U.warn(`Could not find HTMLCellId for visible output area`,t);continue}return{cellId:g.parse(e.id)}}}return U.warn(`No visible output area found for scroll anchor`),null}function Fn(e){if(!e){U.warn(`No scroll anchor provided to restore scroll position`);return}let t=document.getElementById(g.create(e.cellId));if(!t){U.warn(`Could not find cell element to restore scroll position`,e.cellId);return}if(!t.querySelector(`.${K.outputArea}`)){U.warn(`Could not find output area to restore scroll position`,e.cellId);return}t.scrollIntoView({block:`start`,behavior:`auto`})}function In(){let e=(0,Z.c)(2),t=a(oe),n;return e[0]===t?n=e[1]:(n=()=>{let e=Pn();t(t=>({mode:q(t.mode),cellAnchor:e?.cellId??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Fn(e)})})},e[0]=t,e[1]=n),n}var Ln=n(!1),Rn=()=>{let e=(0,Z.c)(7),{selectedLayout:t}=me(),{setLayoutView:n}=he();if(J()&&!T(`wasm_layouts`))return null;let r;e[0]===n?r=e[1]:(r=e=>n(e),e[0]=n,e[1]=r);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(ke,{className:`min-w-[110px] border-border bg-background`,"data-testid":`layout-select`,children:(0,X.jsx)(Te,{placeholder:`Select a view`})}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(De,{children:(0,X.jsxs)(Oe,{children:[(0,X.jsx)(we,{children:`View as`}),pe.map(Hn)]})}),e[3]=a):a=e[3];let o;return e[4]!==t||e[5]!==r?(o=(0,X.jsxs)(Ae,{"data-testid":`layout-select`,value:t,onValueChange:r,children:[i,a]}),e[4]=t,e[5]=r,e[6]=o):o=e[6],o};function zn(e){let t=Bn(e);return(0,X.jsx)(t,{className:`h-4 w-4`})}function Bn(e){switch(e){case`vertical`:return cn;case`grid`:return st;case`slides`:return fn;default:return He(e),wt}}function Vn(e){return We.startCase(e)}function Hn(e){return(0,X.jsx)(Ee,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 leading-5`,children:[zn(e),(0,X.jsx)(`span`,{children:Vn(e)})]})},e)}var Un=[`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],Wn=[`pymdown`,`qmd`,`mystmd`,`mdx`],Gn=[`topological`,`top-down`],Kn=[`document`,`slides`],qn=[`source`,`flat`];function Jn(e){return typeof e==`string`&&Un.some(t=>t===e)}var $={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:`topological`,includeOutputs:!1},pdf:{preset:`document`,includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:`source`}};function Yn(e,t){return e.default(t).catch(t)}function Xn(e){return F(e).optional().catch(void 0)}var Zn=F({html:Xn({includeCode:Yn(I(),$.html.includeCode)}),markdown:Xn({flavor:Yn(L(Wn).nullable(),$.markdown.flavor)}),ipynb:Xn({sortMode:Yn(L(Gn),$.ipynb.sortMode),includeOutputs:Yn(I(),$.ipynb.includeOutputs)}),pdf:Xn({preset:Yn(L(Kn),$.pdf.preset),includeInputs:Yn(I(),$.pdf.includeInputs),includeOutputs:Yn(I(),$.pdf.includeOutputs),webpdf:Yn(I(),$.pdf.webpdf)}),script:Xn({type:Yn(L(qn),$.script.type)})}).catch({});function Qn(e,t){let n={...e},r=r=>{n[r]={...e[r],...t[r]}};for(let e of Object.keys(t))r(e);return n}function $n(e){return Qn($,Zn.parse(e))}var er=M({toSerializable:e=>e,fromSerializable:$n}),tr=l(`marimo:export:options:v1`,$,er,{getOnInit:!0}),nr=l(`marimo:export:last-format:v1`,`html`,M({toSerializable:e=>e,fromSerializable:e=>Jn(e)?e:`html`}),{getOnInit:!0}),rr={html:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},markdown:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},ipynb:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},pdf:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},script:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1},png:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1}};function ir(e,t){return e===`wasm`&&t===`pdf`}function ar({format:e,options:t,runtime:n,filename:r,availability:i}){let a=e===`script`&&t.script.type===`source`?{...rr.script,requiresNamedNotebookOnServer:!0}:rr[e],o=ir(n,e);if(n===`wasm`&&a.requiresServerRuntime)return{available:o,reason:{type:`wasm-runtime`}};if(n===`server`&&a.requiresNamedNotebookOnServer&&!r)return{available:!1,reason:{type:`notebook-must-be-named`}};if(n===`wasm`||!a.checksServerAvailability)return{available:!0};if(i.status===`pending`)return{available:!1,reason:{type:`checking-requirements`}};if(i.status===`error`||!i.data)return{available:!0,availabilityCheckFailed:!0};let s=i.data.formats.find(t=>t.format===e);return s?s.dependenciesAvailable?{available:!0}:s.missingPackages.length>0?{available:!1,reason:{type:`missing-packages`,packages:s.missingPackages}}:s.missingSetup.length>0?{available:!1,reason:{type:`missing-setup`,requirements:s.missingSetup}}:{available:!0,availabilityCheckFailed:!0}:{available:!0,availabilityCheckFailed:!0}}function or(e,t){return e.map(e=>({value:e,...t[e]}))}var sr=or([`automatic`,...Wn],{automatic:{label:`Automatic`,description:`Chooses a format from the notebook filename. Defaults to Markdown (.md).`},pymdown:{label:`Markdown (.md)`,description:`Creates a .md file with Python code blocks.`},qmd:{label:`Quarto (.qmd)`,description:`Creates a .qmd file for Quarto.`},mystmd:{label:`MyST (.myst.md)`,description:`Creates a .myst.md file for MyST.`},mdx:{label:`MDX (.mdx)`,description:`Creates a .mdx file for MDX.`}}),cr=or(Gn,{"top-down":{label:`Top to bottom`,description:`Keeps cells in the same order as this notebook.`},topological:{label:`Dependency order`,description:`Reorders cells so each cell appears after the cells it depends on.`}}),lr=or(Kn,{document:{label:`Document`,description:`Creates pages for reading or printing.`},slides:{label:`Slides`,description:`Creates presentation slides from the notebook.`}}),ur=or([`browser`,`latex`],{browser:{label:`Browser`,description:`Uses browser rendering to preserve the notebook's visual output.`},latex:{label:`LaTeX first`,description:`Uses Pandoc and TeX when available, then falls back to browser rendering.`}}),dr=or(qn,{source:{label:`Notebook source`,description:`Downloads the saved notebook source for continued editing in marimo.`},flat:{label:`Flat script`,description:`Reorders cells so the Python script runs from top to bottom.`}}),fr={html:{label:`HTML`,actionLabel:`Export HTML`,description:`Save the current notebook as an HTML page.`,Icon:at,Options:pr},markdown:{label:`Markdown`,actionLabel:`Export Markdown`,description:`Save code and text in a Markdown-based file. Cell outputs are not included.`,Icon:_,Options:mr},ipynb:{label:`Jupyter`,actionLabel:`Export Jupyter notebook`,description:`Open the notebook in Jupyter and other compatible tools.`,Icon:un,Options:hr},pdf:{label:`PDF`,actionLabel:`Export PDF`,description:`Save the notebook as a PDF for printing or sharing.`,Icon:it,Options:gr},script:{label:`Python`,actionLabel:`Export flat script`,description:`Save the notebook as a Python file.`,Icon:et,Options:_r},png:{label:`PNG`,actionLabel:`Export PNG`,description:`Capture the current app view as an image.`,Icon:pt,Options:vr}};function pr(e){let t=(0,Z.c)(7),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={checked:`Includes code cells in the webpage.`,unchecked:`Leaves code cells out of the webpage.`},t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(`html`,{includeCode:e}),t[1]=r,t[2]=o);let s;return t[3]!==i||t[4]!==n.html.includeCode||t[5]!==o?(s=(0,X.jsx)(yr,{children:(0,X.jsx)(br,{label:`Include code`,descriptions:a,checked:n.html.includeCode,disabled:i,onCheckedChange:o})}),t[3]=i,t[4]=n.html.includeCode,t[5]=o,t[6]=s):s=t[6],s}function mr(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a=n.markdown.flavor??`automatic`,o;t[0]===r?o=t[1]:(o=e=>r(`markdown`,{flavor:e===`automatic`?null:e}),t[0]=r,t[1]=o);let s;return t[2]!==i||t[3]!==a||t[4]!==o?(s=(0,X.jsx)(yr,{children:(0,X.jsx)(Cr,{label:`Format`,value:a,disabled:i,onValueChange:o,options:sr})}),t[2]=i,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function hr(e){let t=(0,Z.c)(16),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`ipynb`,{sortMode:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.ipynb.sortMode||t[4]!==a?(o=(0,X.jsx)(xr,{label:`Cell order`,value:n.ipynb.sortMode,disabled:i,onValueChange:a,options:cr}),t[2]=i,t[3]=n.ipynb.sortMode,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Keeps the outputs currently shown in the notebook.`,unchecked:`Leaves cell outputs out of the Jupyter notebook.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`ipynb`,{includeOutputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.ipynb.includeOutputs||t[11]!==c?(l=(0,X.jsx)(br,{label:`Include outputs`,descriptions:s,checked:n.ipynb.includeOutputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.ipynb.includeOutputs,t[11]=c,t[12]=l):l=t[12];let u;return t[13]!==o||t[14]!==l?(u=(0,X.jsxs)(yr,{children:[o,l]}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function gr(e){let t=(0,Z.c)(30),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`pdf`,{preset:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.pdf.preset||t[4]!==a?(o=(0,X.jsx)(xr,{label:`Layout`,value:n.pdf.preset,disabled:i,onValueChange:a,options:lr}),t[2]=i,t[3]=n.pdf.preset,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Includes code cells in the PDF.`,unchecked:`Leaves code cells out of the PDF.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`pdf`,{includeInputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.pdf.includeInputs||t[11]!==c?(l=(0,X.jsx)(br,{label:`Include code`,descriptions:s,checked:n.pdf.includeInputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.pdf.includeInputs,t[11]=c,t[12]=l):l=t[12];let u;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u={checked:`Keeps the outputs currently shown in the notebook.`,unchecked:`Leaves cell outputs out of the PDF.`},t[13]=u):u=t[13];let d;t[14]===r?d=t[15]:(d=e=>r(`pdf`,{includeOutputs:e}),t[14]=r,t[15]=d);let f;t[16]!==i||t[17]!==n.pdf.includeOutputs||t[18]!==d?(f=(0,X.jsx)(br,{label:`Include outputs`,descriptions:u,checked:n.pdf.includeOutputs,disabled:i,onCheckedChange:d}),t[16]=i,t[17]=n.pdf.includeOutputs,t[18]=d,t[19]=f):f=t[19];let p;t[20]!==i||t[21]!==n.pdf.preset||t[22]!==n.pdf.webpdf||t[23]!==r?(p=n.pdf.preset===`document`?(0,X.jsx)(xr,{label:`Method`,value:n.pdf.webpdf?`browser`:`latex`,disabled:i,onValueChange:e=>r(`pdf`,{webpdf:e===`browser`}),options:ur}):null,t[20]=i,t[21]=n.pdf.preset,t[22]=n.pdf.webpdf,t[23]=r,t[24]=p):p=t[24];let m;return t[25]!==o||t[26]!==l||t[27]!==f||t[28]!==p?(m=(0,X.jsxs)(yr,{children:[o,l,f,p]}),t[25]=o,t[26]=l,t[27]=f,t[28]=p,t[29]=m):m=t[29],m}function _r(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`script`,{type:e}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n.script.type||t[4]!==a?(o=(0,X.jsx)(yr,{children:(0,X.jsx)(xr,{label:`Format`,value:n.script.type,disabled:i,onValueChange:a,options:dr})}),t[2]=i,t[3]=n.script.type,t[4]=a,t[5]=o):o=t[5],o}function vr(){return null}function yr(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`divide-y rounded-md border`,children:n}),t[0]=n,t[1]=r),r}function br(e){let t=(0,Z.c)(26),{label:n,descriptions:r,descriptionOverride:i,checked:a,disabled:o,onCheckedChange:s}=e,c=(0,Q.useId)(),l=`${c}-description`,u=i??(a?r.checked:r.unchecked),d;t[0]===i?d=t[1]:(d=i?[i]:[],t[0]=i,t[1]=d);let f;t[2]!==r.checked||t[3]!==r.unchecked||t[4]!==d?(f=[r.checked,r.unchecked,...d],t[2]=r.checked,t[3]=r.unchecked,t[4]=d,t[5]=f):f=t[5];let p=f,m;t[6]!==c||t[7]!==n?(m=(0,X.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium leading-5`,children:n}),t[6]=c,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==u||t[10]!==l||t[11]!==p?(h=(0,X.jsx)(Er,{id:l,description:u,possibleDescriptions:p}),t[9]=u,t[10]=l,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==m||t[14]!==h?(g=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==a||t[17]!==l||t[18]!==o||t[19]!==c||t[20]!==n||t[21]!==s?(_=(0,X.jsx)(fe,{id:c,size:`sm`,checked:a,disabled:o,onCheckedChange:s,"aria-label":n,"aria-describedby":l}),t[16]=a,t[17]=l,t[18]=o,t[19]=c,t[20]=n,t[21]=s,t[22]=_):_=t[22];let v;return t[23]!==g||t[24]!==_?(v=(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-4 px-3 py-2`,children:[g,_]}),t[23]=g,t[24]=_,t[25]=v):v=t[25],v}function xr(e){let t=(0,Z.c)(31),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]===n?d=t[4]:(d=(0,X.jsx)(`div`,{className:`text-sm font-medium leading-5`,children:n}),t[3]=n,t[4]=d);let f=u??``,p;t[5]===o?p=t[6]:(p=o.map(Sr),t[5]=o,t[6]=p);let m;t[7]!==c||t[8]!==f||t[9]!==p?(m=(0,X.jsx)(Er,{id:c,description:f,possibleDescriptions:p}),t[7]=c,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==d||t[12]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[11]=d,t[12]=m,t[13]=h):h=t[13];let g;t[14]===a?g=t[15]:(g=e=>a(e),t[14]=a,t[15]=g);let _;if(t[16]!==s||t[17]!==o){let e;t[19]===s?e=t[20]:(e=(e,t)=>{let n=`${s}-${t}`;return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(E,{id:n,value:e.value}),(0,X.jsx)(`label`,{htmlFor:n,className:`text-sm`,children:e.label})]},e.value)},t[19]=s,t[20]=e),_=o.map(e),t[16]=s,t[17]=o,t[18]=_}else _=t[18];let v;t[21]!==c||t[22]!==i||t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==r?(v=(0,X.jsx)(N,{value:r,onValueChange:g,className:`flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end`,"aria-label":n,"aria-describedby":c,disabled:i,children:_}),t[21]=c,t[22]=i,t[23]=n,t[24]=g,t[25]=_,t[26]=r,t[27]=v):v=t[27];let y;return t[28]!==h||t[29]!==v?(y=(0,X.jsxs)(`div`,{className:`flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[h,v]}),t[28]=h,t[29]=v,t[30]=y):y=t[30],y}function Sr(e){return e.description}function Cr(e){let t=(0,Z.c)(34),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==s||t[4]!==n?(d=(0,X.jsx)(`label`,{htmlFor:s,className:`text-sm font-medium leading-5`,children:n}),t[3]=s,t[4]=n,t[5]=d):d=t[5];let f=u??``,p;t[6]===o?p=t[7]:(p=o.map(Tr),t[6]=o,t[7]=p);let m;t[8]!==c||t[9]!==f||t[10]!==p?(m=(0,X.jsx)(Er,{id:c,description:f,possibleDescriptions:p}),t[8]=c,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==d||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[12]=d,t[13]=m,t[14]=h):h=t[14];let g;t[15]===a?g=t[16]:(g=e=>a(e),t[15]=a,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(Te,{}),t[17]=_):_=t[17];let v;t[18]!==c||t[19]!==s?(v=(0,X.jsx)(ke,{id:s,"aria-describedby":c,className:`h-8 w-full shrink-0 sm:w-44`,children:_}),t[18]=c,t[19]=s,t[20]=v):v=t[20];let y;t[21]===o?y=t[22]:(y=o.map(wr),t[21]=o,t[22]=y);let b;t[23]===y?b=t[24]:(b=(0,X.jsx)(De,{children:y}),t[23]=y,t[24]=b);let x;t[25]!==i||t[26]!==b||t[27]!==g||t[28]!==v||t[29]!==r?(x=(0,X.jsxs)(Ae,{value:r,disabled:i,onValueChange:g,children:[v,b]}),t[25]=i,t[26]=b,t[27]=g,t[28]=v,t[29]=r,t[30]=x):x=t[30];let S;return t[31]!==x||t[32]!==h?(S=(0,X.jsxs)(`div`,{className:`flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[h,x]}),t[31]=x,t[32]=h,t[33]=S):S=t[33],S}function wr(e){return(0,X.jsx)(Ee,{value:e.value,children:e.label},e.value)}function Tr(e){return e.description}function Er(e){let t=(0,Z.c)(15),{id:n,description:r,possibleDescriptions:i}=e,a;t[0]===i?a=t[1]:(a=new Set(i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=[...a],t[2]=a,t[3]=o);let s;t[4]!==r||t[5]!==o?(s=o.filter(e=>e!==r),t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l;t[7]!==r||t[8]!==n?(l=(0,X.jsx)(`p`,{id:n,"aria-live":`polite`,className:`col-start-1 row-start-1`,children:r}),t[7]=r,t[8]=n,t[9]=l):l=t[9];let u;t[10]===c?u=t[11]:(u=c.map(Dr),t[10]=c,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`div`,{className:`mt-0.5 grid text-xs leading-4 text-muted-foreground`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function Dr(e){return(0,X.jsx)(`p`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:e},e)}var Or={"playwright-chromium":{description:`PDF export requires Playwright Chromium.`}};function kr(e){let t=(0,Z.c)(10),{status:n}=e;if(n.available&&!n.availabilityCheckFailed)return null;if(n.reason?.type===`checking-requirements`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[(0,X.jsx)(xt,{size:`small`,className:`size-3`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Checking requirements`})]}),t[0]=e):e=t[0],e}let r=n.availabilityCheckFailed?`Requirements unknown`:`Unavailable`,i=n.availabilityCheckFailed?`text-muted-foreground`:`text-(--yellow-11)`,a;t[1]===i?a=t[2]:(a=_e(`size-3`,i),t[1]=i,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,X.jsx)(C,{className:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=(0,X.jsx)(`span`,{className:`sr-only`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Ar(e){let t=(0,Z.c)(7),{format:n,formatLabel:r,status:i,onInstall:a,isInstalling:o}=e,s=o!==void 0&&o;if(i.availabilityCheckFailed){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(jr,{children:`Couldn't check whether this export is available. You can still try it.`})}),t[0]=e):e=t[0],e}if(!i.reason)return null;let c;return t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==i.reason?(c=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(Mr,{format:n,formatLabel:r,reason:i.reason,onInstall:a,isInstalling:s})}),t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=i.reason,t[6]=c):c=t[6],c}function jr(e){let t=(0,Z.c)(9),{children:n,onInstall:r,isInstalling:i}=e,a=i!==void 0&&i,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(C,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[1]=n,t[2]=s);let c;t[3]!==a||t[4]!==r?(c=r?(0,X.jsxs)(Ve,{type:`button`,variant:`outline`,size:`xs`,className:`shrink-0 border-input bg-background text-foreground hover:border-input hover:bg-muted hover:text-foreground`,disabled:a,"aria-busy":a,onClick:r,children:[a?(0,X.jsx)(xt,{size:`small`,className:`mr-1.5 size-3.5`}):(0,X.jsx)(nn,{className:`mr-1.5 size-3.5`}),`Install`]}):null,t[3]=a,t[4]=r,t[5]=c):c=t[5];let l;return t[6]!==s||t[7]!==c?(l=(0,X.jsxs)(Lt,{variant:`warning`,className:`flex items-center gap-2.5 px-3 py-2 text-(--yellow-12) has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0`,children:[o,(0,X.jsxs)(It,{className:`flex min-w-0 flex-1 items-center gap-3 text-sm leading-5`,children:[s,c]})]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function Mr(e){let t=(0,Z.c)(22),{format:n,formatLabel:r,reason:i,onInstall:a,isInstalling:o}=e;switch(i.type){case`checking-requirements`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(xt,{className:`size-4 shrink-0`,size:`small`}),t[0]=e):e=t[0];let n;return t[1]===r?n=t[2]:(n=(0,X.jsxs)(Lt,{role:`status`,variant:`info`,className:`flex items-center gap-2.5 p-3 has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0`,children:[e,(0,X.jsxs)(It,{className:`min-w-0 flex-1 text-sm leading-5`,children:[`Checking `,r,` requirements…`]})]}),t[1]=r,t[2]=n),n}case`notebook-must-be-named`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(jr,{children:`Name and save this notebook before exporting.`}),t[3]=e):e=t[3],e}case`missing-packages`:{let e;t[4]===i.packages?e=t[5]:(e=i.packages.join(`, `),t[4]=i.packages,t[5]=e);let n;t[6]===e?n=t[7]:(n=(0,X.jsx)(`code`,{className:`break-words font-mono`,children:e}),t[6]=e,t[7]=n);let s;return t[8]!==r||t[9]!==o||t[10]!==a||t[11]!==n?(s=(0,X.jsxs)(jr,{onInstall:a,isInstalling:o,children:[r,` export requires`,` `,n,`.`]}),t[8]=r,t[9]=o,t[10]=a,t[11]=n,t[12]=s):s=t[12],s}case`missing-setup`:{let e;t[13]!==a||t[14]!==i.requirements?(e=a?i.requirements.map(Pr).join(` `):(0,X.jsx)(`span`,{className:`block min-w-0`,children:i.requirements.map(Nr)}),t[13]=a,t[14]=i.requirements,t[15]=e):e=t[15];let n;return t[16]!==o||t[17]!==a||t[18]!==e?(n=(0,X.jsx)(jr,{onInstall:a,isInstalling:o,children:e}),t[16]=o,t[17]=a,t[18]=e,t[19]=n):n=t[19],n}case`wasm-runtime`:{let e=n===`pdf`?`Use your browser's print dialog to save the current app view as a PDF.`:`Open this notebook in a local marimo session to use this export.`,r;return t[20]===e?r=t[21]:(r=(0,X.jsx)(jr,{children:e}),t[20]=e,t[21]=r),r}default:Ue(i)}}function Nr(e){let t=Or[e.name];return(0,X.jsxs)(`span`,{className:`block`,children:[t.description,(0,X.jsx)(`code`,{className:`mt-1 block break-all font-mono`,children:e.command})]},e.name)}function Pr(e){return Or[e.name].description}function Fr(e){return e.endsWith(`.myst.md`)?`mystmd`:e.endsWith(`.qmd`)?`qmd`:e.endsWith(`.mdx`)?`mdx`:`pymdown`}function Ir(e,t){let n=t??Fr(e),r=dt[n],i=ft.find(t=>e.endsWith(t)),a=Ie.withoutExtension(e);i&&(a=e.slice(0,-i.length));let o=`${a}.${r}`;return o===e?`${e.slice(0,-(r.length+1))}.export.${r}`:o}function Lr(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:t===!0?[`--${e}`]:t===!1?[`--no-${e}`]:[`--${e}=${t}`])}function Rr(e){return e.preset===`document`?e.webpdf:null}var zr={html:{subcommand:`html`,flags:({html:e})=>({"include-code":e.includeCode}),outputFilename:e=>Ie.toHTML(e)},markdown:{subcommand:`md`,flags:({markdown:e})=>({flavor:e.flavor}),outputFilename:(e,{markdown:t})=>Ir(e,t.flavor)},ipynb:{subcommand:`ipynb`,flags:({ipynb:e})=>({sort:e.sortMode,"include-outputs":e.includeOutputs}),outputFilename:e=>Ie.toIPYNB(e)},pdf:{subcommand:`pdf`,flags:({pdf:e})=>({as:e.preset,"include-inputs":e.includeInputs,"include-outputs":e.includeOutputs,webpdf:Rr(e)}),outputFilename:e=>Ie.toPDF(e)},script:{subcommand:`script`,flags:()=>({}),outputFilename:e=>`${Ie.withoutExtension(e)}.script.py`}};function Br({format:e,filename:t,options:n}){if(e===`png`||e===`script`&&n.script.type===`source`||!t)return null;let r=zr[e];return[`marimo`,`export`,r.subcommand,Ht(t),...Lr(r.flags(n)),`-o`,Ht(r.outputFilename(t,n))].join(` `)}async function Vr(e){let{exportOptions:t,captureOutputs:n,downloadPDF:r}=e;t.includeOutputs&&await n(),await r(t)}async function Hr({format:e,options:t,requests:n,sourceFilename:r,htmlFiles:i,getLayout:a,captureOutputs:o,capturePNG:s,downloadFile:c}){switch(e){case`html`:c(await n.exportAsHTML({download:!1,files:i,includeCode:t.html.includeCode,layout:await a()}));return;case`markdown`:c(await n.exportAsMarkdown({download:!1,flavor:t.markdown.flavor}));return;case`ipynb`:t.ipynb.includeOutputs&&await o(),c(await n.exportAsIPYNB({download:!1,sortMode:t.ipynb.sortMode,includeOutputs:t.ipynb.includeOutputs}));return;case`pdf`:await Vr({exportOptions:t.pdf,captureOutputs:o,downloadPDF:async e=>{c(await n.exportAsPDF(e))}});return;case`script`:if(t.script.type===`source`){c({contents:(await n.readCode()).contents,filename:r,mediaType:`text/plain`});return}c(await n.exportAsScript({download:!1}));return;case`png`:await s();return;default:Ue(e)}}var Ur={source:{actionLabel:`Export notebook source`,progressLabel:`notebook source`},flat:{actionLabel:`Export flat script`,progressLabel:`flat script`}};function Wr(e,t){if(e===`wasm`)return{status:`success`,data:null};switch(t.status){case`pending`:case`loading`:return{status:`pending`};case`error`:return{status:`error`};case`success`:return{status:`success`,data:t.data}}}function Gr(e,t){return e===`server`&&t?Dt.basename(t):Ie.toPY(document.title)}function Kr({usesBrowserPrint:e,hasCommand:t,format:n,isNotebookSource:r}){return e?`Uses the browser's print settings for page size and filename.`:t?`Uses the current session state. The copied command exports the saved notebook.`:n!==`png`&&!r?`Save the notebook to copy an equivalent shell command.`:null}function qr(e){let n=Rt(),[r,i]=t(tr),[a,o]=t(nr),[s,c]=(0,Q.useState)(e??a),l=J()?`wasm`:`server`,u=Ge(),d=le(),[f,p]=(0,Q.useState)(!1),m=At(async()=>l===`wasm`?null:u.getExportAvailability(),[l,u]),h=Wr(l,m),g=e=>ar({format:e,options:r,runtime:l,filename:n,availability:h}),_=g(s),v=d&&(_.reason?.type===`missing-packages`||_.reason?.type===`missing-setup`),y=Un.map(e=>({format:e,status:g(e)})),b=ir(l,s),x=fr[s],S=s===`script`&&r.script.type===`source`,{actionLabel:C,progressLabel:w}=s===`script`?Ur[r.script.type]:{actionLabel:x.actionLabel,progressLabel:x.label},T=b?null:Br({format:s,filename:n,options:r}),E=Kr({usesBrowserPrint:b,hasCommand:!!T,format:s,isNotebookSource:S});return(0,Q.useEffect)(()=>{e&&o(e)},[e,o]),{formats:y,options:r,selected:{format:s,status:_,usesBrowserPrint:b,actionLabel:C,command:T,footerDescription:E},exportRequest:{format:s,options:r,sourceFilename:Gr(l,n),available:_.available,usesBrowserPrint:b,progressLabel:w},selectFormat:e=>{Jn(e)&&(c(e),o(e))},updateOptions:(e,t)=>{i(n=>{let r={...n};return r[e]={...n[e],...t},r})},canInstall:v,isInstalling:f,installRequirements:async()=>{if(!(!v||f||s===`png`)){p(!0);try{let e=await u.installExportRequirements({format:s});m.setData(e)}catch{}finally{p(!1)}}}}}async function Jr(e){let t=document.getElementById(`App`);if(!t){let e=`The current app view could not be captured.`;throw Et({title:`Failed to download as PNG`,description:e,variant:`danger`}),Error(e)}let n=e?.style.visibility,r=e?.classList.contains(`print:hidden`);if(!await Fe({element:t,filename:document.title,prepare:()=>{let t=Le();return e&&(e.classList.add(`print:hidden`),e.style.visibility=`hidden`),()=>{t(),e&&(r||e.classList.remove(`print:hidden`),e.style.visibility=n??``)}}}))throw Error(`Failed to capture the current app view.`)}function Yr(e){e(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function Xr({format:e,options:t,sourceFilename:n,available:r,usesBrowserPrint:i,progressLabel:a,onClose:o}){let s=Ge(),c=Xt(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=async e=>{await Zt({takeScreenshots:()=>c({progress:e}),updateCellOutputs:s.updateCellOutputs})},m=async()=>{await ue(()=>Jr(d.current?.parentElement??null))};return{dialogRef:d,isExporting:l,submit:async()=>{if(!(!r||l)){if(i){Yr(o);return}u(!0);try{await Pe(`Exporting ${a}…`,async r=>{await Hr({format:e,options:t,requests:s,sourceFilename:n,htmlFiles:Je.INSTANCE.filenames(),getLayout:Xe,captureOutputs:()=>p(r),capturePNG:m,downloadFile:Ne})}),f.current&&o()}catch(e){U.error(`Export failed`,e)}finally{f.current&&u(!1)}}}}}function Zr(e){let t=(0,Z.c)(15),{initialFormat:n,onClose:r}=e,i=qr(n),a,o,s;t[0]===i?(a=t[1],o=t[2],s=t[3]):({exportRequest:a,selectFormat:o,...s}=i,t[0]=i,t[1]=a,t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==r?(c={...a,onClose:r},t[4]=a,t[5]=r,t[6]=c):c=t[6];let l=Xr(c),u;t[7]!==l||t[8]!==o||t[9]!==s?(u=e=>{!l.isExporting&&!s.isInstalling&&o(e)},t[7]=l,t[8]=o,t[9]=s,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==s||t[13]!==u?(d={...s,...l,selectFormat:u},t[11]=l,t[12]=s,t[13]=u,t[14]=d):d=t[14],d}var Qr=`(min-width: 640px)`,$r=e=>{let t=(0,Z.c)(75),{initialFormat:n,onClose:r,returnFocusRef:i}=e,a;t[0]!==n||t[1]!==r?(a={initialFormat:n,onClose:r},t[0]=n,t[1]=r,t[2]=a):a=t[2];let{dialogRef:o,isExporting:s,isInstalling:c,canInstall:l,formats:u,options:d,selected:f,selectFormat:p,updateOptions:m,installRequirements:h,submit:g}=Zr(a),_=s||c,v=Me(Qr),{format:y,status:b,usesBrowserPrint:x,actionLabel:S,command:C,footerDescription:w}=f,T=fr[y],E=T.Options,D;t[3]===i?D=t[4]:(D=i?{onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()}}:{},t[3]=i,t[4]=D);let ee=D,te;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsxs)(gt,{className:`border-b px-5 py-4 pr-12`,children:[(0,X.jsx)(yt,{children:`Export notebook`}),(0,X.jsx)(ht,{children:`Choose a format and adjust its options.`})]}),t[5]=te):te=t[5];let ne=v?`vertical`:`horizontal`,O;if(t[6]!==u||t[7]!==_){let e;t[9]===_?e=t[10]:(e=e=>{let{format:t,status:n}=e,r=fr[t];return(0,X.jsxs)(be,{value:t,disabled:_,className:`min-w-0 justify-start gap-2 px-2.5 py-2 text-xs data-[state=active]:shadow-xs sm:w-full sm:text-sm`,"data-testid":`export-format-${t}`,children:[(0,X.jsx)(r.Icon,{className:`size-3.5 shrink-0`,strokeWidth:1.5}),(0,X.jsx)(`span`,{className:`truncate`,children:r.label}),(0,X.jsx)(kr,{status:n})]},t)},t[9]=_,t[10]=e),O=u.map(e),t[6]=u,t[7]=_,t[8]=O}else O=t[8];let k;t[11]===O?k=t[12]:(k=(0,X.jsx)(Se,{"aria-label":`Export format`,className:`grid max-h-none shrink-0 grid-cols-2 items-stretch justify-start gap-1 overflow-auto rounded-none border-b bg-muted/20 p-2 min-[360px]:grid-cols-3 sm:flex sm:h-full sm:flex-col sm:border-b-0 sm:border-r`,children:O}),t[11]=O,t[12]=k);let A;if(t[13]!==E||t[14]!==l||t[15]!==T.description||t[16]!==T.label||t[17]!==y||t[18]!==u||t[19]!==h||t[20]!==_||t[21]!==c||t[22]!==d||t[23]!==b||t[24]!==m||t[25]!==x){let e;t[27]!==E||t[28]!==l||t[29]!==T.description||t[30]!==T.label||t[31]!==y||t[32]!==h||t[33]!==_||t[34]!==c||t[35]!==d||t[36]!==b||t[37]!==m||t[38]!==x?(e=e=>{let{format:t}=e;return(0,X.jsxs)(xe,{value:t,className:`mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`mb-3`,children:[(0,X.jsx)(`h3`,{className:`text-base font-semibold`,children:T.label}),(0,X.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:T.description})]}),(0,X.jsx)(Ar,{format:y,formatLabel:T.label,status:b,onInstall:l?h:void 0,isInstalling:c}),x?null:(0,X.jsx)(E,{options:d,updateOptions:m,disabled:_})]},t)},t[27]=E,t[28]=l,t[29]=T.description,t[30]=T.label,t[31]=y,t[32]=h,t[33]=_,t[34]=c,t[35]=d,t[36]=b,t[37]=m,t[38]=x,t[39]=e):e=t[39],A=u.map(e),t[13]=E,t[14]=l,t[15]=T.description,t[16]=T.label,t[17]=y,t[18]=u,t[19]=h,t[20]=_,t[21]=c,t[22]=d,t[23]=b,t[24]=m,t[25]=x,t[26]=A}else A=t[26];let j;t[40]!==y||t[41]!==p||t[42]!==ne||t[43]!==k||t[44]!==A?(j=(0,X.jsxs)(Ce,{value:y,onValueChange:p,orientation:ne,className:`flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]`,children:[k,A]}),t[40]=y,t[41]=p,t[42]=ne,t[43]=k,t[44]=A,t[45]=j):j=t[45];let M;t[46]===C?M=t[47]:(M=C?(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border bg-background px-2.5 py-2 font-mono text-xs`,children:[(0,X.jsx)(`span`,{className:`select-none text-muted-foreground`,"aria-hidden":!0,children:`$`}),(0,X.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto whitespace-nowrap`,"data-testid":`export-cli-command`,"aria-label":`Equivalent POSIX shell command`,children:C}),(0,X.jsx)(Mt,{value:C,className:`size-3.5`,buttonClassName:_e(ze({variant:`ghost`,size:`icon`}),`shrink-0`),tooltip:`Copy POSIX shell command`,ariaLabel:`Copy POSIX shell command`,toastTitle:`Command copied`})]}):null,t[46]=C,t[47]=M);let re=C&&`mt-3`,N;t[48]===re?N=t[49]:(N=_e(`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,re),t[48]=re,t[49]=N);let P;t[50]===w?P=t[51]:(P=w?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:w}):null,t[50]=w,t[51]=P);let F=!b.available||_,I=!w&&`sm:ml-auto`,L;t[52]===I?L=t[53]:(L=_e(`border-(--blue-11) bg-(--blue-11) hover:border-(--blue-12) hover:bg-(--blue-12) sm:min-w-36 dark:border-(--blue-7) dark:bg-(--blue-5) dark:text-(--blue-12) dark:hover:border-(--blue-8) dark:hover:bg-(--blue-6)`,I),t[52]=I,t[53]=L);let R;t[54]===s?R=t[55]:(R=s&&(0,X.jsx)(xt,{size:`small`,className:`mr-2`,"aria-hidden":!0}),t[54]=s,t[55]=R);let ie=x?`Print to PDF`:S,z;t[56]!==s||t[57]!==g||t[58]!==F||t[59]!==L||t[60]!==R||t[61]!==ie?(z=(0,X.jsxs)(Ve,{type:`button`,disabled:F,"aria-busy":s,onClick:g,className:L,"data-testid":`export-submit`,children:[R,ie]}),t[56]=s,t[57]=g,t[58]=F,t[59]=L,t[60]=R,t[61]=ie,t[62]=z):z=t[62];let B;t[63]!==N||t[64]!==P||t[65]!==z?(B=(0,X.jsxs)(`div`,{className:N,children:[P,z]}),t[63]=N,t[64]=P,t[65]=z,t[66]=B):B=t[66];let V;t[67]!==B||t[68]!==M?(V=(0,X.jsxs)(`footer`,{className:`min-w-0 border-t bg-muted/20 px-4 py-3`,children:[M,B]}),t[67]=B,t[68]=M,t[69]=V):V=t[69];let H;return t[70]!==o||t[71]!==ee||t[72]!==V||t[73]!==j?(H=(0,X.jsxs)(_t,{ref:o,className:`grid h-dvh max-h-[760px] min-w-0 w-[calc(100vw-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:top-[5vh] sm:h-[90vh] sm:max-h-[640px] sm:max-w-3xl`,"data-testid":`export-dialog`,...ee,children:[te,j,V]}),t[70]=o,t[71]=ee,t[72]=V,t[73]=j,t[74]=H):H=t[74],H};function ei(e){let t=(0,Z.c)(5),{openPrompt:n,closeModal:r}=vt(),{sendCopy:i}=Ge(),a;return t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==e?(a=()=>{if(!e)return null;let t=Ot.guessDeliminator(e),a=Dt.basename(e);n({title:`Copy notebook`,description:`Enter a new filename for the notebook copy.`,defaultValue:`_${a}`,confirmText:`Copy notebook`,spellCheck:!1,onConfirm:n=>{let a=t.join(Dt.dirname(e),n);i({source:e,destination:a}).then(()=>{r(),Et({title:`Notebook copied`,description:`A copy of the notebook has been created.`}),Yt(a)})}})},t[0]=r,t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}function ti(){let e=(0,Z.c)(4),{openConfirm:t}=vt(),n=a(de),{sendRestart:r}=Ge(),i;return e[0]!==t||e[1]!==r||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,X.jsx)(ye,{onClick:async()=>{n({state:ce.CLOSING}),await r(),Pt()},"aria-label":`Confirm Restart`,children:`Restart`})})},e[0]=t,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}var ni=new A,ri=e=>ni.isSupported(e)?`markdown`:`code`,ii=()=>{let e=(0,Z.c)(3),{updateCellConfig:t}=u(),{saveCellConfig:n}=Ge(),r;return e[0]!==n||e[1]!==t?(r=async(e,r)=>{let i=te(),a={};for(let t of i.cellIds.inOrderIds){let n=i.cellData[t];n!==void 0&&n.config.hide_code!==e&&ri(n.code)===r&&(a[t]={hide_code:e})}let o=ae.entries(a);if(o.length!==0){await n({configs:a});for(let[e,n]of o)t({cellId:e,config:n})}},e[0]=n,e[1]=t,e[2]=r):r=e[2],r},ai=e=>{e?.preventDefault(),e?.stopPropagation()};function oi(e){let n=(0,Z.c)(43),i;n[0]===e?i=n[1]:(i=e===void 0?{}:e,n[0]=e,n[1]=i);let{exportDialogReturnFocusRef:o}=i,l=Rt(),{openModal:m,closeModal:g}=vt(),{toggleApplication:C}=v(),{selectedPanel:w}=c(),[T]=t(oe),E=r(se),O=ii(),[A]=z(),M=r(p),N=r(ie),{updateCellConfig:P,undoDeleteCell:F,clearAllCellOutputs:I,addSetupCellIfDoesntExist:L,collapseAllCells:R,expandAllCells:U}=u(),W=ti(),K=Nt(),q=ei(l),ce=a(Ln),le=a(V),{handleClick:ue}=H(),de=a(B),fe=a(tr),{readCode:ge,saveCellConfig:_e}=Ge(),ve=b(`database`),ye=b(`storage`),be=y(),xe=r(S),Se=r(re),Ce=r(d),{selectedLayout:we}=me(),{setLayoutView:Te}=he(),Ee=In(),De=A.sharing?.html??!0,Oe=A.sharing?.wasm??!0,ke=A.sharing?.molab??!0,Ae=we===`slides`,Me;if(n[2]!==be||n[3]!==L||n[4]!==N||n[5]!==Se||n[6]!==M||n[7]!==I||n[8]!==g||n[9]!==R||n[10]!==q||n[11]!==ve||n[12]!==ye||n[13]!==U||n[14]!==o||n[15]!==l||n[16]!==xe||n[17]!==Ae||n[18]!==E||n[19]!==m||n[20]!==ue||n[21]!==ge||n[22]!==W||n[23]!==K||n[24]!==_e||n[25]!==we||n[26]!==w||n[27]!==O||n[28]!==ce||n[29]!==fe||n[30]!==de||n[31]!==Te||n[32]!==le||n[33]!==De||n[34]!==ke||n[35]!==Oe||n[36]!==C||n[37]!==Ee||n[38]!==F||n[39]!==Ce||n[40]!==P||n[41]!==T.mode){let e=[`db`,`sql`,...Wt],t=[`bucket`,`object storage`,...Kt],r=xi,i=(e,t)=>{t&&fe(e=>Qn(e,t)),m((0,X.jsx)($r,{initialFormat:e,onClose:g,returnFocusRef:o}))};Me=[{icon:(0,X.jsx)(je,{size:14,strokeWidth:1.5}),label:`Export…`,additionalKeywords:[`download`,`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],handle:()=>i()},{icon:(0,X.jsx)(je,{size:14,strokeWidth:1.5}),label:`Download`,redundant:!0,handle:ai,dropdown:[{icon:(0,X.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Download as HTML`,handle:()=>i(`html`,{html:{includeCode:!0}})},{icon:(0,X.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Download as HTML (exclude code)`,handle:()=>i(`html`,{html:{includeCode:!1}})},{icon:(0,X.jsx)(zt,{strokeWidth:1.5,style:{width:14,height:14}}),label:`Download as Markdown`,handle:()=>i(`markdown`)},{icon:(0,X.jsx)(un,{size:14,strokeWidth:1.5}),label:`Download as ipynb`,handle:()=>i(`ipynb`)},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Download notebook source`,handle:()=>i(`script`,{script:{type:`source`}})},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Download flat script`,handle:()=>i(`script`,{script:{type:`flat`}})},{divider:!0,icon:(0,X.jsx)(pt,{size:14,strokeWidth:1.5}),label:`Download as PNG`,handle:()=>i(`png`)},Ae?{divider:!0,icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:ai,dropdown:[{icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Document Layout`,handle:()=>i(`pdf`,{pdf:{preset:`document`}})},{icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Slides Layout`,hidden:J(),rightElement:(0,X.jsx)(`span`,{className:`ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700`,children:`Recommended`}),handle:()=>i(`pdf`,{pdf:{preset:`slides`}})}]}:{divider:!0,icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:()=>i(`pdf`,{pdf:{preset:`document`}})}]},{icon:(0,X.jsx)(f,{size:14,strokeWidth:1.5}),label:`Pair with an agent`,hidden:J(),handle:async()=>{m((0,X.jsx)(Ut,{onClose:g}))}},{icon:(0,X.jsx)(pn,{size:14,strokeWidth:1.5}),label:`Share`,handle:ai,hidden:!De&&!Oe&&!ke,dropdown:[{icon:(0,X.jsx)(at,{size:14,strokeWidth:1.5}),label:`Publish HTML to web`,hidden:!De,handle:async()=>{m((0,X.jsx)(Mn,{onClose:g}))}},{icon:(0,X.jsx)(bt,{size:14,strokeWidth:1.5}),label:`Create WebAssembly link`,hidden:!Oe,handle:async()=>{let e=await ge(),t=Ft({code:e.contents});await jt(t),Et({title:`Copied`,description:`Link copied to clipboard.`})}},{icon:(0,X.jsx)(Jt,{size:14,strokeWidth:1.5}),label:`Create molab notebook`,hidden:!ke,handle:async()=>{let e=await ge(),t=Ft({code:e.contents,baseUrl:`${G.molab}/new`});window.open(t,`_blank`)}}]},{icon:(0,X.jsx)(dn,{size:14,strokeWidth:1.5}),label:`Helper panel`,redundant:!0,handle:ai,dropdown:ee.flatMap(e=>{let t=e.type===`ai`&&!N;if(k({panel:e,capabilities:M,aiEnabled:N})&&!t)return[];let{type:n,Icon:i,additionalKeywords:a}=e;return{label:We.startCase(n),rightElement:r(w===n),icon:(0,X.jsx)(i,{size:14,strokeWidth:1.5}),handle:()=>{if(t){ue(`ai`,`ai-features`);return}C(n)},additionalKeywords:a}})},{icon:(0,X.jsx)(fn,{size:14,strokeWidth:1.5}),label:`Present as`,handle:ai,dropdown:[{icon:T.mode===`present`?(0,X.jsx)(x,{size:14,strokeWidth:1.5}):(0,X.jsx)(Ke,{size:14,strokeWidth:1.5}),label:`Toggle app view`,hotkey:`global.hideCode`,handle:()=>{Ee()}},...pe.map((e,t)=>{let n=Bn(e);return{divider:t===0,label:Vn(e),icon:(0,X.jsx)(n,{size:14,strokeWidth:1.5}),rightElement:(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:we===e&&(0,X.jsx)(Qe,{size:14})}),handle:()=>{Te(e),T.mode===`edit`&&Ee()}}})]},{icon:(0,X.jsx)(sn,{size:14,strokeWidth:1.5}),label:`Duplicate notebook`,hidden:!l||J(),handle:q},{icon:(0,X.jsx)(tn,{size:14,strokeWidth:1.5}),label:`Copy code to clipboard`,hidden:!l,handle:async()=>{let e=await ge();await jt(e.contents),Et({title:`Copied`,description:`Code copied to clipboard.`})}},{icon:(0,X.jsx)($e,{size:14,strokeWidth:1.5}),label:`Enable all cells`,hidden:!xe||E,handle:async()=>{let e=te(),t=h(e),n=ae.fromEntries(t.map(bi));await _e({configs:n});for(let e of t)P({cellId:e,config:{disabled:!1}})}},{divider:!0,icon:(0,X.jsx)(an,{size:14,strokeWidth:1.5}),label:`Add setup cell`,handle:()=>{L({})}},{icon:(0,X.jsx)(D,{size:14,strokeWidth:1.5}),label:`Add database connection`,additionalKeywords:e,handle:()=>{m((0,X.jsx)(Gt,{onClose:g}))},dropdown:ve.length===0?void 0:[...ve.map(e=>({icon:(0,X.jsx)(f,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>be(e)})),{divider:!0,icon:(0,X.jsx)(D,{size:14,strokeWidth:1.5}),label:`Browse all connections`,additionalKeywords:e,handle:()=>{m((0,X.jsx)(Gt,{onClose:g}))}}]},{icon:(0,X.jsx)(lt,{size:14,strokeWidth:1.5}),label:`Add remote storage`,additionalKeywords:t,handle:()=>{m((0,X.jsx)(Gt,{defaultTab:`storage`,onClose:g}))},dropdown:ye.length===0?void 0:[...ye.map(e=>({icon:(0,X.jsx)(f,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>be(e)})),{divider:!0,icon:(0,X.jsx)(lt,{size:14,strokeWidth:1.5}),label:`Browse all connections`,additionalKeywords:t,handle:()=>{m((0,X.jsx)(Gt,{defaultTab:`storage`,onClose:g}))}}]},{icon:(0,X.jsx)(hn,{size:14,strokeWidth:1.5}),label:Ce,hidden:!Se||E,handle:()=>{F()}},{icon:(0,X.jsx)(mn,{size:14,strokeWidth:1.5}),label:`Restart kernel`,variant:`danger`,handle:W,additionalKeywords:[`reset`,`reload`,`restart`]},{icon:(0,X.jsx)(on,{size:14,strokeWidth:1.5}),label:`Re-run all cells`,redundant:!0,hotkey:`global.runAll`,handle:async()=>{K()}},{icon:(0,X.jsx)(j,{size:14,strokeWidth:1.5}),label:`Clear all outputs`,redundant:!0,handle:()=>{I()}},{icon:(0,X.jsx)(s,{size:14,strokeWidth:1.5}),label:`Show all code`,hotkey:`global.showAllCode`,handle:()=>O(!1,`code`),redundant:!0},{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Hide all code`,hotkey:`global.hideAllCode`,handle:()=>O(!0,`code`),redundant:!0},{icon:(0,X.jsx)(s,{size:14,strokeWidth:1.5}),label:`Show all markdown code`,hotkey:`global.showAllMarkdownCode`,handle:()=>O(!1,`markdown`),redundant:!0},{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Hide all markdown code`,hotkey:`global.hideAllMarkdownCode`,handle:()=>O(!0,`markdown`),redundant:!0},{icon:(0,X.jsx)(en,{size:14,strokeWidth:1.5}),label:`Collapse all sections`,hotkey:`global.collapseAllSections`,handle:R,redundant:!0},{icon:(0,X.jsx)($t,{size:14,strokeWidth:1.5}),label:`Expand all sections`,hotkey:`global.expandAllSections`,handle:U,redundant:!0},{divider:!0,icon:(0,X.jsx)(rn,{size:14,strokeWidth:1.5}),label:`Command palette`,hotkey:`global.commandPalette`,handle:()=>ce(yi)},{icon:(0,X.jsx)(qe,{size:14,strokeWidth:1.5}),label:`Keyboard shortcuts`,hotkey:`global.showHelp`,handle:()=>de(vi)},{icon:(0,X.jsx)(Ct,{size:14,strokeWidth:1.5}),label:`User settings`,handle:()=>le(_i),redundant:!0,additionalKeywords:[`preferences`,`options`,`configuration`]},{icon:(0,X.jsx)(ln,{size:14,strokeWidth:1.5}),label:`Report an issue`,additionalKeywords:[`feedback`,`bug`,`issue`,`report`,`diagnostics`],handle:()=>m((0,X.jsx)(On,{onClose:g}))},{icon:(0,X.jsx)(rt,{size:14,strokeWidth:1.5}),label:`Resources`,handle:ai,dropdown:[{icon:(0,X.jsx)(ne,{size:14,strokeWidth:1.5}),label:`Documentation`,handle:gi},{icon:(0,X.jsx)(qt,{className:`h-3.5 w-3.5`}),label:`GitHub`,handle:hi},{icon:(0,X.jsx)(ot,{size:14,strokeWidth:1.5}),label:`Discord Community`,handle:mi},{icon:(0,X.jsx)(ct,{className:`h-3.5 w-3.5`}),label:`YouTube`,handle:pi},{icon:(0,X.jsx)(_,{size:14,strokeWidth:1.5}),label:`Changelog`,handle:fi}]},{divider:!0,icon:(0,X.jsx)(ut,{size:14,strokeWidth:1.5}),label:`Open home`,hidden:!location.search.includes(`file`),handle:di},{icon:(0,X.jsx)(Jt,{size:14,strokeWidth:1.5}),label:`New notebook`,hidden:!location.search.includes(`file`),handle:ui}].filter(li).map(si),n[2]=be,n[3]=L,n[4]=N,n[5]=Se,n[6]=M,n[7]=I,n[8]=g,n[9]=R,n[10]=q,n[11]=ve,n[12]=ye,n[13]=U,n[14]=o,n[15]=l,n[16]=xe,n[17]=Ae,n[18]=E,n[19]=m,n[20]=ue,n[21]=ge,n[22]=W,n[23]=K,n[24]=_e,n[25]=we,n[26]=w,n[27]=O,n[28]=ce,n[29]=fe,n[30]=de,n[31]=Te,n[32]=le,n[33]=De,n[34]=ke,n[35]=Oe,n[36]=C,n[37]=Ee,n[38]=F,n[39]=Ce,n[40]=P,n[41]=T.mode,n[42]=Me}else Me=n[42];return Me}function si(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ci)}:e}function ci(e){return!e.hidden}function li(e){return!e.hidden}function ui(){let e=kt();window.open(e,`_blank`)}function di(){let e=document.baseURI.split(`?`)[0];window.open(e,`_blank`,`noopener`)}function fi(){window.open(G.releasesPage,`_blank`)}function pi(){window.open(G.youtube,`_blank`)}function mi(){window.open(G.discordLink,`_blank`)}function hi(){window.open(G.githubPage,`_blank`)}function gi(){window.open(G.docsPage,`_blank`)}function _i(e){return!e}function vi(e){return!e}function yi(e){return!e}function bi(e){return[e,{disabled:!1}]}function xi(e){return(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:e&&(0,X.jsx)(Qe,{size:14})})}export{Ln as a,gn as c,an as d,rn as f,Rn as i,hn as l,tn as m,ii as n,In as o,nn as p,ti as r,Dn as s,oi as t,ln as u};
10
+ `)})]}),e[71]=C,e[72]=se);let le;e[73]===C?le=e[74]:(le=C&&u.length===0&&(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No errors detected.`}),e[73]=C,e[74]=le);let ue;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,X.jsx)(`a`,{href:G.feedbackForm,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`two-minute survey`}),e[75]=ue):ue=e[75];let fe;e[76]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,X.jsx)(`div`,{className:`border-t pt-3`,children:(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Other feedback? Take our`,` `,ue,` `,`or chat with us on`,` `,(0,X.jsx)(`a`,{href:G.discordLink,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Discord`}),`.`]})}),e[76]=fe):fe=e[76];let pe;return e[77]!==K||e[78]!==q||e[79]!==oe||e[80]!==J||e[81]!==se||e[82]!==le?(pe=(0,X.jsxs)(_t,{className:`w-[540px] max-w-[90vw]`,children:[A,(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto`,children:[K,q,oe,J,se,le,fe]})]}),e[77]=K,e[78]=q,e[79]=oe,e[80]=J,e[81]=se,e[82]=le,e[83]=pe):pe=e[83],pe};function kn(e){return!e}function An(e){return e===`bug-description`?`errors`:e===`reproduction-code`?`code`:e}var jn=`https://static.marimo.app`,Mn=e=>{let t=(0,Z.c)(26),{onClose:n}=e,[r,i]=(0,Q.useState)(``),{exportAsHTML:a}=Ge(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Math.random().toString(36).slice(2,6),t[0]=o):o=t[0];let s=`${r}-${o}`,c=`${jn}/static/${s}`,l;t[1]!==a||t[2]!==n||t[3]!==s?(l=async e=>{e.preventDefault(),n();let{contents:t}=await a({download:!1,includeCode:!0,files:Je.INSTANCE.filenames(),layout:await Xe()}),r=Et({title:`Uploading static notebook...`,description:`Please wait.`});await fetch(`${jn}/api/static`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({html:t,path:s})}).catch(()=>{r.dismiss(),Et({title:`Error uploading static page`,description:(0,X.jsxs)(`div`,{children:[`Please try again later. If the problem persists, please file a bug report on`,` `,(0,X.jsx)(`a`,{href:G.issuesPage,target:`_blank`,className:`underline`,children:`GitHub`}),`.`]})})}),r.dismiss(),Et({title:`Static page uploaded!`,description:(0,X.jsxs)(`div`,{children:[`The URL has been copied to your clipboard.`,(0,X.jsx)(`br`,{}),`You can share it with anyone.`]})})},t[1]=a,t[2]=n,t[3]=s,t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(yt,{children:`Share static notebook`}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(gt,{children:[u,(0,X.jsxs)(ht,{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,X.jsx)(`a`,{href:jn,target:`_blank`,children:jn}),`.`]})]}),t[6]=d):d=t[6];let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{let t=e.target.value.toLowerCase().replaceAll(/\s/g,`-`).replaceAll(/[^\da-z-]/g,``);i(t)},t[7]=f):f=t[7];let p;t[8]===r?p=t[9]:(p=(0,X.jsx)(St,{"data-testid":`slug-input`,id:`slug`,autoFocus:!0,value:r,placeholder:`Notebook slug`,onChange:f,required:!0,autoComplete:`off`}),t[8]=r,t[9]=p);let m;t[10]===c?m=t[11]:(m=(0,X.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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Nn,{text:c}),(0,X.jsx)(`span`,{className:`text-primary`,children:c})]})]}),t[10]=c,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`flex flex-col gap-6 py-4`,children:[p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===n?g=t[16]:(g=(0,X.jsx)(Ve,{"data-testid":`cancel-share-static-notebook-button`,variant:`secondary`,onClick:n,children:`Cancel`}),t[15]=n,t[16]=g);let _;t[17]===c?_=t[18]:(_=(0,X.jsx)(Ve,{"data-testid":`share-static-notebook-button`,"aria-label":`Save`,variant:`default`,type:`submit`,onClick:async()=>{await jt(c)},children:`Create`}),t[17]=c,t[18]=_);let v;t[19]!==_||t[20]!==g?(v=(0,X.jsxs)(mt,{children:[g,_]}),t[19]=_,t[20]=g,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==l||t[24]!==h?(y=(0,X.jsx)(_t,{className:`w-fit`,children:(0,X.jsxs)(`form`,{onSubmit:l,children:[d,h,v]})}),t[22]=v,t[23]=l,t[24]=h,t[25]=y):y=t[25],y},Nn=e=>{let t=(0,Z.c)(8),[n,r]=Q.useState(!1),i;t[0]===e.text?i=t[1]:(i=Be.stopPropagation(async t=>{t.preventDefault(),await jt(e.text),r(!0),setTimeout(()=>r(!1),2e3)}),t[0]=e.text,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(tt,{size:14,strokeWidth:1.5}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,X.jsx)(Ve,{"data-testid":`copy-static-notebook-url-button`,onClick:a,size:`xs`,variant:`secondary`,children:o}),t[3]=a,t[4]=s);let c;return t[5]!==n||t[6]!==s?(c=(0,X.jsx)(Re,{content:`Copied!`,open:n,children:s}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c};function Pn(){let e=document.getElementsByClassName(K.outputArea);for(let t of e){let e=t.getBoundingClientRect();if(e.bottom>0&&e.top<window.innerHeight){let e=g.findElement(t);if(!e){U.warn(`Could not find HTMLCellId for visible output area`,t);continue}return{cellId:g.parse(e.id)}}}return U.warn(`No visible output area found for scroll anchor`),null}function Fn(e){if(!e){U.warn(`No scroll anchor provided to restore scroll position`);return}let t=document.getElementById(g.create(e.cellId));if(!t){U.warn(`Could not find cell element to restore scroll position`,e.cellId);return}if(!t.querySelector(`.${K.outputArea}`)){U.warn(`Could not find output area to restore scroll position`,e.cellId);return}t.scrollIntoView({block:`start`,behavior:`auto`})}function In(){let e=(0,Z.c)(2),t=a(oe),n;return e[0]===t?n=e[1]:(n=()=>{let e=Pn();t(t=>({mode:q(t.mode),cellAnchor:e?.cellId??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Fn(e)})})},e[0]=t,e[1]=n),n}var Ln=n(!1),Rn=()=>{let e=(0,Z.c)(7),{selectedLayout:t}=me(),{setLayoutView:n}=he();if(J()&&!T(`wasm_layouts`))return null;let r;e[0]===n?r=e[1]:(r=e=>n(e),e[0]=n,e[1]=r);let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(ke,{className:`min-w-[110px] border-border bg-background`,"data-testid":`layout-select`,children:(0,X.jsx)(Te,{placeholder:`Select a view`})}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(De,{children:(0,X.jsxs)(Oe,{children:[(0,X.jsx)(we,{children:`View as`}),pe.map(Hn)]})}),e[3]=a):a=e[3];let o;return e[4]!==t||e[5]!==r?(o=(0,X.jsxs)(Ae,{"data-testid":`layout-select`,value:t,onValueChange:r,children:[i,a]}),e[4]=t,e[5]=r,e[6]=o):o=e[6],o};function zn(e){let t=Bn(e);return(0,X.jsx)(t,{className:`h-4 w-4`})}function Bn(e){switch(e){case`vertical`:return cn;case`grid`:return st;case`slides`:return fn;default:return He(e),wt}}function Vn(e){return We.startCase(e)}function Hn(e){return(0,X.jsx)(Ee,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 leading-5`,children:[zn(e),(0,X.jsx)(`span`,{children:Vn(e)})]})},e)}var Un=[`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],Wn=[`pymdown`,`qmd`,`mystmd`,`mdx`],Gn=[`topological`,`top-down`],Kn=[`document`,`slides`],qn=[`source`,`flat`];function Jn(e){return typeof e==`string`&&Un.some(t=>t===e)}var $={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:`topological`,includeOutputs:!1},pdf:{preset:`document`,includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:`source`}};function Yn(e,t){return e.default(t).catch(t)}function Xn(e){return F(e).optional().catch(void 0)}var Zn=F({html:Xn({includeCode:Yn(I(),$.html.includeCode)}),markdown:Xn({flavor:Yn(L(Wn).nullable(),$.markdown.flavor)}),ipynb:Xn({sortMode:Yn(L(Gn),$.ipynb.sortMode),includeOutputs:Yn(I(),$.ipynb.includeOutputs)}),pdf:Xn({preset:Yn(L(Kn),$.pdf.preset),includeInputs:Yn(I(),$.pdf.includeInputs),includeOutputs:Yn(I(),$.pdf.includeOutputs),webpdf:Yn(I(),$.pdf.webpdf)}),script:Xn({type:Yn(L(qn),$.script.type)})}).catch({});function Qn(e,t){let n={...e},r=r=>{n[r]={...e[r],...t[r]}};for(let e of Object.keys(t))r(e);return n}function $n(e){return Qn($,Zn.parse(e))}var er=M({toSerializable:e=>e,fromSerializable:$n}),tr=l(`marimo:export:options:v1`,$,er,{getOnInit:!0}),nr=l(`marimo:export:last-format:v1`,`html`,M({toSerializable:e=>e,fromSerializable:e=>Jn(e)?e:`html`}),{getOnInit:!0}),rr={html:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},markdown:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!1,checksServerAvailability:!1},ipynb:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},pdf:{requiresNamedNotebookOnServer:!0,requiresServerRuntime:!0,checksServerAvailability:!0},script:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1},png:{requiresNamedNotebookOnServer:!1,requiresServerRuntime:!1,checksServerAvailability:!1}};function ir(e,t){return e===`wasm`&&t===`pdf`}function ar({format:e,options:t,runtime:n,filename:r,availability:i}){let a=e===`script`&&t.script.type===`source`?{...rr.script,requiresNamedNotebookOnServer:!0}:rr[e],o=ir(n,e);if(n===`wasm`&&a.requiresServerRuntime)return{available:o,reason:{type:`wasm-runtime`}};if(n===`server`&&a.requiresNamedNotebookOnServer&&!r)return{available:!1,reason:{type:`notebook-must-be-named`}};if(n===`wasm`||!a.checksServerAvailability)return{available:!0};if(i.status===`pending`)return{available:!1,reason:{type:`checking-requirements`}};if(i.status===`error`||!i.data)return{available:!0,availabilityCheckFailed:!0};let s=i.data.formats.find(t=>t.format===e);return s?s.dependenciesAvailable?{available:!0}:s.missingPackages.length>0?{available:!1,reason:{type:`missing-packages`,packages:s.missingPackages}}:s.missingSetup.length>0?{available:!1,reason:{type:`missing-setup`,requirements:s.missingSetup}}:{available:!0,availabilityCheckFailed:!0}:{available:!0,availabilityCheckFailed:!0}}function or(e,t){return e.map(e=>({value:e,...t[e]}))}var sr=or([`automatic`,...Wn],{automatic:{label:`Automatic`,description:`Chooses a format from the notebook filename. Defaults to Markdown (.md).`},pymdown:{label:`Markdown (.md)`,description:`Creates a .md file with Python code blocks.`},qmd:{label:`Quarto (.qmd)`,description:`Creates a .qmd file for Quarto.`},mystmd:{label:`MyST (.myst.md)`,description:`Creates a .myst.md file for MyST.`},mdx:{label:`MDX (.mdx)`,description:`Creates a .mdx file for MDX.`}}),cr=or(Gn,{"top-down":{label:`Top to bottom`,description:`Keeps cells in the same order as this notebook.`},topological:{label:`Dependency order`,description:`Reorders cells so each cell appears after the cells it depends on.`}}),lr=or(Kn,{document:{label:`Document`,description:`Creates pages for reading or printing.`},slides:{label:`Slides`,description:`Creates presentation slides from the notebook.`}}),ur=or([`browser`,`latex`],{browser:{label:`Browser`,description:`Uses browser rendering to preserve the notebook's visual output.`},latex:{label:`LaTeX first`,description:`Uses Pandoc and TeX when available, then falls back to browser rendering.`}}),dr=or(qn,{source:{label:`Notebook source`,description:`Downloads the saved notebook source for continued editing in marimo.`},flat:{label:`Flat script`,description:`Reorders cells so the Python script runs from top to bottom.`}}),fr={html:{label:`HTML`,actionLabel:`Export HTML`,description:`Save the current notebook as an HTML page.`,Icon:at,Options:pr},markdown:{label:`Markdown`,actionLabel:`Export Markdown`,description:`Save code and text in a Markdown-based file. Cell outputs are not included.`,Icon:_,Options:mr},ipynb:{label:`Jupyter`,actionLabel:`Export Jupyter notebook`,description:`Open the notebook in Jupyter and other compatible tools.`,Icon:un,Options:hr},pdf:{label:`PDF`,actionLabel:`Export PDF`,description:`Save the notebook as a PDF for printing or sharing.`,Icon:it,Options:gr},script:{label:`Python`,actionLabel:`Export flat script`,description:`Save the notebook as a Python file.`,Icon:et,Options:_r},png:{label:`PNG`,actionLabel:`Export PNG`,description:`Capture the current app view as an image.`,Icon:pt,Options:vr}};function pr(e){let t=(0,Z.c)(7),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={checked:`Includes code cells in the webpage.`,unchecked:`Leaves code cells out of the webpage.`},t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(`html`,{includeCode:e}),t[1]=r,t[2]=o);let s;return t[3]!==i||t[4]!==n.html.includeCode||t[5]!==o?(s=(0,X.jsx)(yr,{children:(0,X.jsx)(br,{label:`Include code`,descriptions:a,checked:n.html.includeCode,disabled:i,onCheckedChange:o})}),t[3]=i,t[4]=n.html.includeCode,t[5]=o,t[6]=s):s=t[6],s}function mr(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a=n.markdown.flavor??`automatic`,o;t[0]===r?o=t[1]:(o=e=>r(`markdown`,{flavor:e===`automatic`?null:e}),t[0]=r,t[1]=o);let s;return t[2]!==i||t[3]!==a||t[4]!==o?(s=(0,X.jsx)(yr,{children:(0,X.jsx)(Cr,{label:`Format`,value:a,disabled:i,onValueChange:o,options:sr})}),t[2]=i,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function hr(e){let t=(0,Z.c)(16),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`ipynb`,{sortMode:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.ipynb.sortMode||t[4]!==a?(o=(0,X.jsx)(xr,{label:`Cell order`,value:n.ipynb.sortMode,disabled:i,onValueChange:a,options:cr}),t[2]=i,t[3]=n.ipynb.sortMode,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Keeps the outputs currently shown in the notebook.`,unchecked:`Leaves cell outputs out of the Jupyter notebook.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`ipynb`,{includeOutputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.ipynb.includeOutputs||t[11]!==c?(l=(0,X.jsx)(br,{label:`Include outputs`,descriptions:s,checked:n.ipynb.includeOutputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.ipynb.includeOutputs,t[11]=c,t[12]=l):l=t[12];let u;return t[13]!==o||t[14]!==l?(u=(0,X.jsxs)(yr,{children:[o,l]}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function gr(e){let t=(0,Z.c)(30),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`pdf`,{preset:e}),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n.pdf.preset||t[4]!==a?(o=(0,X.jsx)(xr,{label:`Layout`,value:n.pdf.preset,disabled:i,onValueChange:a,options:lr}),t[2]=i,t[3]=n.pdf.preset,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={checked:`Includes code cells in the PDF.`,unchecked:`Leaves code cells out of the PDF.`},t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=e=>r(`pdf`,{includeInputs:e}),t[7]=r,t[8]=c);let l;t[9]!==i||t[10]!==n.pdf.includeInputs||t[11]!==c?(l=(0,X.jsx)(br,{label:`Include code`,descriptions:s,checked:n.pdf.includeInputs,disabled:i,onCheckedChange:c}),t[9]=i,t[10]=n.pdf.includeInputs,t[11]=c,t[12]=l):l=t[12];let u;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u={checked:`Keeps the outputs currently shown in the notebook.`,unchecked:`Leaves cell outputs out of the PDF.`},t[13]=u):u=t[13];let d;t[14]===r?d=t[15]:(d=e=>r(`pdf`,{includeOutputs:e}),t[14]=r,t[15]=d);let f;t[16]!==i||t[17]!==n.pdf.includeOutputs||t[18]!==d?(f=(0,X.jsx)(br,{label:`Include outputs`,descriptions:u,checked:n.pdf.includeOutputs,disabled:i,onCheckedChange:d}),t[16]=i,t[17]=n.pdf.includeOutputs,t[18]=d,t[19]=f):f=t[19];let p;t[20]!==i||t[21]!==n.pdf.preset||t[22]!==n.pdf.webpdf||t[23]!==r?(p=n.pdf.preset===`document`?(0,X.jsx)(xr,{label:`Method`,value:n.pdf.webpdf?`browser`:`latex`,disabled:i,onValueChange:e=>r(`pdf`,{webpdf:e===`browser`}),options:ur}):null,t[20]=i,t[21]=n.pdf.preset,t[22]=n.pdf.webpdf,t[23]=r,t[24]=p):p=t[24];let m;return t[25]!==o||t[26]!==l||t[27]!==f||t[28]!==p?(m=(0,X.jsxs)(yr,{children:[o,l,f,p]}),t[25]=o,t[26]=l,t[27]=f,t[28]=p,t[29]=m):m=t[29],m}function _r(e){let t=(0,Z.c)(6),{options:n,updateOptions:r,disabled:i}=e,a;t[0]===r?a=t[1]:(a=e=>r(`script`,{type:e}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n.script.type||t[4]!==a?(o=(0,X.jsx)(yr,{children:(0,X.jsx)(xr,{label:`Format`,value:n.script.type,disabled:i,onValueChange:a,options:dr})}),t[2]=i,t[3]=n.script.type,t[4]=a,t[5]=o):o=t[5],o}function vr(){return null}function yr(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`divide-y rounded-md border`,children:n}),t[0]=n,t[1]=r),r}function br(e){let t=(0,Z.c)(26),{label:n,descriptions:r,descriptionOverride:i,checked:a,disabled:o,onCheckedChange:s}=e,c=(0,Q.useId)(),l=`${c}-description`,u=i??(a?r.checked:r.unchecked),d;t[0]===i?d=t[1]:(d=i?[i]:[],t[0]=i,t[1]=d);let f;t[2]!==r.checked||t[3]!==r.unchecked||t[4]!==d?(f=[r.checked,r.unchecked,...d],t[2]=r.checked,t[3]=r.unchecked,t[4]=d,t[5]=f):f=t[5];let p=f,m;t[6]!==c||t[7]!==n?(m=(0,X.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium leading-5`,children:n}),t[6]=c,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==u||t[10]!==l||t[11]!==p?(h=(0,X.jsx)(Er,{id:l,description:u,possibleDescriptions:p}),t[9]=u,t[10]=l,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==m||t[14]!==h?(g=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==a||t[17]!==l||t[18]!==o||t[19]!==c||t[20]!==n||t[21]!==s?(_=(0,X.jsx)(fe,{id:c,size:`sm`,checked:a,disabled:o,onCheckedChange:s,"aria-label":n,"aria-describedby":l}),t[16]=a,t[17]=l,t[18]=o,t[19]=c,t[20]=n,t[21]=s,t[22]=_):_=t[22];let v;return t[23]!==g||t[24]!==_?(v=(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-4 px-3 py-2`,children:[g,_]}),t[23]=g,t[24]=_,t[25]=v):v=t[25],v}function xr(e){let t=(0,Z.c)(31),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]===n?d=t[4]:(d=(0,X.jsx)(`div`,{className:`text-sm font-medium leading-5`,children:n}),t[3]=n,t[4]=d);let f=u??``,p;t[5]===o?p=t[6]:(p=o.map(Sr),t[5]=o,t[6]=p);let m;t[7]!==c||t[8]!==f||t[9]!==p?(m=(0,X.jsx)(Er,{id:c,description:f,possibleDescriptions:p}),t[7]=c,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==d||t[12]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[11]=d,t[12]=m,t[13]=h):h=t[13];let g;t[14]===a?g=t[15]:(g=e=>a(e),t[14]=a,t[15]=g);let _;if(t[16]!==s||t[17]!==o){let e;t[19]===s?e=t[20]:(e=(e,t)=>{let n=`${s}-${t}`;return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(E,{id:n,value:e.value}),(0,X.jsx)(`label`,{htmlFor:n,className:`text-sm`,children:e.label})]},e.value)},t[19]=s,t[20]=e),_=o.map(e),t[16]=s,t[17]=o,t[18]=_}else _=t[18];let v;t[21]!==c||t[22]!==i||t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==r?(v=(0,X.jsx)(N,{value:r,onValueChange:g,className:`flex shrink-0 flex-wrap gap-x-5 gap-y-2 sm:justify-end`,"aria-label":n,"aria-describedby":c,disabled:i,children:_}),t[21]=c,t[22]=i,t[23]=n,t[24]=g,t[25]=_,t[26]=r,t[27]=v):v=t[27];let y;return t[28]!==h||t[29]!==v?(y=(0,X.jsxs)(`div`,{className:`flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[h,v]}),t[28]=h,t[29]=v,t[30]=y):y=t[30],y}function Sr(e){return e.description}function Cr(e){let t=(0,Z.c)(34),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,Q.useId)(),c=`${s}-description`,l;t[0]!==o||t[1]!==r?(l=o.find(e=>e.value===r)?.description,t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==s||t[4]!==n?(d=(0,X.jsx)(`label`,{htmlFor:s,className:`text-sm font-medium leading-5`,children:n}),t[3]=s,t[4]=n,t[5]=d):d=t[5];let f=u??``,p;t[6]===o?p=t[7]:(p=o.map(Tr),t[6]=o,t[7]=p);let m;t[8]!==c||t[9]!==f||t[10]!==p?(m=(0,X.jsx)(Er,{id:c,description:f,possibleDescriptions:p}),t[8]=c,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==d||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[12]=d,t[13]=m,t[14]=h):h=t[14];let g;t[15]===a?g=t[16]:(g=e=>a(e),t[15]=a,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(Te,{}),t[17]=_):_=t[17];let v;t[18]!==c||t[19]!==s?(v=(0,X.jsx)(ke,{id:s,"aria-describedby":c,className:`h-8 w-full shrink-0 sm:w-44`,children:_}),t[18]=c,t[19]=s,t[20]=v):v=t[20];let y;t[21]===o?y=t[22]:(y=o.map(wr),t[21]=o,t[22]=y);let b;t[23]===y?b=t[24]:(b=(0,X.jsx)(De,{children:y}),t[23]=y,t[24]=b);let x;t[25]!==i||t[26]!==b||t[27]!==g||t[28]!==v||t[29]!==r?(x=(0,X.jsxs)(Ae,{value:r,disabled:i,onValueChange:g,children:[v,b]}),t[25]=i,t[26]=b,t[27]=g,t[28]=v,t[29]=r,t[30]=x):x=t[30];let S;return t[31]!==x||t[32]!==h?(S=(0,X.jsxs)(`div`,{className:`flex min-h-14 flex-col items-stretch gap-2 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[h,x]}),t[31]=x,t[32]=h,t[33]=S):S=t[33],S}function wr(e){return(0,X.jsx)(Ee,{value:e.value,children:e.label},e.value)}function Tr(e){return e.description}function Er(e){let t=(0,Z.c)(15),{id:n,description:r,possibleDescriptions:i}=e,a;t[0]===i?a=t[1]:(a=new Set(i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=[...a],t[2]=a,t[3]=o);let s;t[4]!==r||t[5]!==o?(s=o.filter(e=>e!==r),t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l;t[7]!==r||t[8]!==n?(l=(0,X.jsx)(`p`,{id:n,"aria-live":`polite`,className:`col-start-1 row-start-1`,children:r}),t[7]=r,t[8]=n,t[9]=l):l=t[9];let u;t[10]===c?u=t[11]:(u=c.map(Dr),t[10]=c,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,X.jsxs)(`div`,{className:`mt-0.5 grid text-xs leading-4 text-muted-foreground`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function Dr(e){return(0,X.jsx)(`p`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:e},e)}var Or={"playwright-chromium":{description:`PDF export requires Playwright Chromium.`}};function kr(e){let t=(0,Z.c)(10),{status:n}=e;if(n.available&&!n.availabilityCheckFailed)return null;if(n.reason?.type===`checking-requirements`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[(0,X.jsx)(xt,{size:`small`,className:`size-3`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Checking requirements`})]}),t[0]=e):e=t[0],e}let r=n.availabilityCheckFailed?`Requirements unknown`:`Unavailable`,i=n.availabilityCheckFailed?`text-muted-foreground`:`text-(--yellow-11)`,a;t[1]===i?a=t[2]:(a=_e(`size-3`,i),t[1]=i,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,X.jsx)(C,{className:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=(0,X.jsx)(`span`,{className:`sr-only`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Ar(e){let t=(0,Z.c)(7),{format:n,formatLabel:r,status:i,onInstall:a,isInstalling:o}=e,s=o!==void 0&&o;if(i.availabilityCheckFailed){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(jr,{children:`Couldn't check whether this export is available. You can still try it.`})}),t[0]=e):e=t[0],e}if(!i.reason)return null;let c;return t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==i.reason?(c=(0,X.jsx)(`div`,{className:`mb-2.5`,children:(0,X.jsx)(Mr,{format:n,formatLabel:r,reason:i.reason,onInstall:a,isInstalling:s})}),t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=i.reason,t[6]=c):c=t[6],c}function jr(e){let t=(0,Z.c)(9),{children:n,onInstall:r,isInstalling:i}=e,a=i!==void 0&&i,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(C,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[1]=n,t[2]=s);let c;t[3]!==a||t[4]!==r?(c=r?(0,X.jsxs)(Ve,{type:`button`,variant:`outline`,size:`xs`,className:`shrink-0 border-input bg-background text-foreground hover:border-input hover:bg-muted hover:text-foreground`,disabled:a,"aria-busy":a,onClick:r,children:[a?(0,X.jsx)(xt,{size:`small`,className:`mr-1.5 size-3.5`}):(0,X.jsx)(nn,{className:`mr-1.5 size-3.5`}),`Install`]}):null,t[3]=a,t[4]=r,t[5]=c):c=t[5];let l;return t[6]!==s||t[7]!==c?(l=(0,X.jsxs)(Lt,{variant:`warning`,className:`flex items-center gap-2.5 px-3 py-2 text-(--yellow-12) has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0`,children:[o,(0,X.jsxs)(It,{className:`flex min-w-0 flex-1 items-center gap-3 text-sm leading-5`,children:[s,c]})]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function Mr(e){let t=(0,Z.c)(22),{format:n,formatLabel:r,reason:i,onInstall:a,isInstalling:o}=e;switch(i.type){case`checking-requirements`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(xt,{className:`size-4 shrink-0`,size:`small`}),t[0]=e):e=t[0];let n;return t[1]===r?n=t[2]:(n=(0,X.jsxs)(Lt,{role:`status`,variant:`info`,className:`flex items-center gap-2.5 p-3 has-[svg]:pl-3 [&>svg]:static [&>svg+div]:translate-y-0`,children:[e,(0,X.jsxs)(It,{className:`min-w-0 flex-1 text-sm leading-5`,children:[`Checking `,r,` requirements…`]})]}),t[1]=r,t[2]=n),n}case`notebook-must-be-named`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(jr,{children:`Name and save this notebook before exporting.`}),t[3]=e):e=t[3],e}case`missing-packages`:{let e;t[4]===i.packages?e=t[5]:(e=i.packages.join(`, `),t[4]=i.packages,t[5]=e);let n;t[6]===e?n=t[7]:(n=(0,X.jsx)(`code`,{className:`break-words font-mono`,children:e}),t[6]=e,t[7]=n);let s;return t[8]!==r||t[9]!==o||t[10]!==a||t[11]!==n?(s=(0,X.jsxs)(jr,{onInstall:a,isInstalling:o,children:[r,` export requires`,` `,n,`.`]}),t[8]=r,t[9]=o,t[10]=a,t[11]=n,t[12]=s):s=t[12],s}case`missing-setup`:{let e;t[13]!==a||t[14]!==i.requirements?(e=a?i.requirements.map(Pr).join(` `):(0,X.jsx)(`span`,{className:`block min-w-0`,children:i.requirements.map(Nr)}),t[13]=a,t[14]=i.requirements,t[15]=e):e=t[15];let n;return t[16]!==o||t[17]!==a||t[18]!==e?(n=(0,X.jsx)(jr,{onInstall:a,isInstalling:o,children:e}),t[16]=o,t[17]=a,t[18]=e,t[19]=n):n=t[19],n}case`wasm-runtime`:{let e=n===`pdf`?`Use your browser's print dialog to save the current app view as a PDF.`:`Open this notebook in a local marimo session to use this export.`,r;return t[20]===e?r=t[21]:(r=(0,X.jsx)(jr,{children:e}),t[20]=e,t[21]=r),r}default:Ue(i)}}function Nr(e){let t=Or[e.name];return(0,X.jsxs)(`span`,{className:`block`,children:[t.description,(0,X.jsx)(`code`,{className:`mt-1 block break-all font-mono`,children:e.command})]},e.name)}function Pr(e){return Or[e.name].description}function Fr(e){return e.endsWith(`.myst.md`)?`mystmd`:e.endsWith(`.qmd`)?`qmd`:e.endsWith(`.mdx`)?`mdx`:`pymdown`}function Ir(e,t){let n=t??Fr(e),r=dt[n],i=ft.find(t=>e.endsWith(t)),a=Ie.withoutExtension(e);i&&(a=e.slice(0,-i.length));let o=`${a}.${r}`;return o===e?`${e.slice(0,-(r.length+1))}.export.${r}`:o}function Lr(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:t===!0?[`--${e}`]:t===!1?[`--no-${e}`]:[`--${e}=${t}`])}function Rr(e){return e.preset===`document`?e.webpdf:null}var zr={html:{subcommand:`html`,flags:({html:e})=>({"include-code":e.includeCode}),outputFilename:e=>Ie.toHTML(e)},markdown:{subcommand:`md`,flags:({markdown:e})=>({flavor:e.flavor}),outputFilename:(e,{markdown:t})=>Ir(e,t.flavor)},ipynb:{subcommand:`ipynb`,flags:({ipynb:e})=>({sort:e.sortMode,"include-outputs":e.includeOutputs}),outputFilename:e=>Ie.toIPYNB(e)},pdf:{subcommand:`pdf`,flags:({pdf:e})=>({as:e.preset,"include-inputs":e.includeInputs,"include-outputs":e.includeOutputs,webpdf:Rr(e)}),outputFilename:e=>Ie.toPDF(e)},script:{subcommand:`script`,flags:()=>({}),outputFilename:e=>`${Ie.withoutExtension(e)}.script.py`}};function Br({format:e,filename:t,options:n}){if(e===`png`||e===`script`&&n.script.type===`source`||!t)return null;let r=zr[e];return[`marimo`,`export`,r.subcommand,Ht(t),...Lr(r.flags(n)),`-o`,Ht(r.outputFilename(t,n))].join(` `)}async function Vr(e){let{exportOptions:t,captureOutputs:n,downloadPDF:r}=e;t.includeOutputs&&await n(),await r(t)}async function Hr({format:e,options:t,requests:n,sourceFilename:r,htmlFiles:i,getLayout:a,captureOutputs:o,capturePNG:s,downloadFile:c}){switch(e){case`html`:c(await n.exportAsHTML({download:!1,files:i,includeCode:t.html.includeCode,layout:await a()}));return;case`markdown`:c(await n.exportAsMarkdown({download:!1,flavor:t.markdown.flavor}));return;case`ipynb`:t.ipynb.includeOutputs&&await o(),c(await n.exportAsIPYNB({download:!1,sortMode:t.ipynb.sortMode,includeOutputs:t.ipynb.includeOutputs}));return;case`pdf`:await Vr({exportOptions:t.pdf,captureOutputs:o,downloadPDF:async e=>{c(await n.exportAsPDF(e))}});return;case`script`:if(t.script.type===`source`){c({contents:(await n.readCode()).contents,filename:r,mediaType:`text/plain`});return}c(await n.exportAsScript({download:!1}));return;case`png`:await s();return;default:Ue(e)}}var Ur={source:{actionLabel:`Export notebook source`,progressLabel:`notebook source`},flat:{actionLabel:`Export flat script`,progressLabel:`flat script`}};function Wr(e,t){if(e===`wasm`)return{status:`success`,data:null};switch(t.status){case`pending`:case`loading`:return{status:`pending`};case`error`:return{status:`error`};case`success`:return{status:`success`,data:t.data}}}function Gr(e,t){return e===`server`&&t?Dt.basename(t):Ie.toPY(document.title)}function Kr({usesBrowserPrint:e,hasCommand:t,format:n,isNotebookSource:r}){return e?`Uses the browser's print settings for page size and filename.`:t?`Uses the current session state. The copied command exports the saved notebook.`:n!==`png`&&!r?`Save the notebook to copy an equivalent shell command.`:null}function qr(e){let n=Rt(),[r,i]=t(tr),[a,o]=t(nr),[s,c]=(0,Q.useState)(e??a),l=J()?`wasm`:`server`,u=Ge(),d=le(),[f,p]=(0,Q.useState)(!1),m=At(async()=>l===`wasm`?null:u.getExportAvailability(),[l,u]),h=Wr(l,m),g=e=>ar({format:e,options:r,runtime:l,filename:n,availability:h}),_=g(s),v=d&&(_.reason?.type===`missing-packages`||_.reason?.type===`missing-setup`),y=Un.map(e=>({format:e,status:g(e)})),b=ir(l,s),x=fr[s],S=s===`script`&&r.script.type===`source`,{actionLabel:C,progressLabel:w}=s===`script`?Ur[r.script.type]:{actionLabel:x.actionLabel,progressLabel:x.label},T=b?null:Br({format:s,filename:n,options:r}),E=Kr({usesBrowserPrint:b,hasCommand:!!T,format:s,isNotebookSource:S});return(0,Q.useEffect)(()=>{e&&o(e)},[e,o]),{formats:y,options:r,selected:{format:s,status:_,usesBrowserPrint:b,actionLabel:C,command:T,footerDescription:E},exportRequest:{format:s,options:r,sourceFilename:Gr(l,n),available:_.available,usesBrowserPrint:b,progressLabel:w},selectFormat:e=>{Jn(e)&&(c(e),o(e))},updateOptions:(e,t)=>{i(n=>{let r={...n};return r[e]={...n[e],...t},r})},canInstall:v,isInstalling:f,installRequirements:async()=>{if(!(!v||f||s===`png`)){p(!0);try{let e=await u.installExportRequirements({format:s});m.setData(e)}catch{}finally{p(!1)}}}}}async function Jr(e){let t=document.getElementById(`App`);if(!t){let e=`The current app view could not be captured.`;throw Et({title:`Failed to download as PNG`,description:e,variant:`danger`}),Error(e)}let n=e?.style.visibility,r=e?.classList.contains(`print:hidden`);if(!await Fe({element:t,filename:document.title,prepare:()=>{let t=Le();return e&&(e.classList.add(`print:hidden`),e.style.visibility=`hidden`),()=>{t(),e&&(r||e.classList.remove(`print:hidden`),e.style.visibility=n??``)}}}))throw Error(`Failed to capture the current app view.`)}function Yr(e){e(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function Xr({format:e,options:t,sourceFilename:n,available:r,usesBrowserPrint:i,progressLabel:a,onClose:o}){let s=Ge(),c=Xt(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=async e=>{await Zt({takeScreenshots:()=>c({progress:e}),updateCellOutputs:s.updateCellOutputs})},m=async()=>{await ue(()=>Jr(d.current?.parentElement??null))};return{dialogRef:d,isExporting:l,submit:async()=>{if(!(!r||l)){if(i){Yr(o);return}u(!0);try{await Pe(`Exporting ${a}…`,async r=>{await Hr({format:e,options:t,requests:s,sourceFilename:n,htmlFiles:Je.INSTANCE.filenames(),getLayout:Xe,captureOutputs:()=>p(r),capturePNG:m,downloadFile:Ne})}),f.current&&o()}catch(e){U.error(`Export failed`,e)}finally{f.current&&u(!1)}}}}}function Zr(e){let t=(0,Z.c)(15),{initialFormat:n,onClose:r}=e,i=qr(n),a,o,s;t[0]===i?(a=t[1],o=t[2],s=t[3]):({exportRequest:a,selectFormat:o,...s}=i,t[0]=i,t[1]=a,t[2]=o,t[3]=s);let c;t[4]!==a||t[5]!==r?(c={...a,onClose:r},t[4]=a,t[5]=r,t[6]=c):c=t[6];let l=Xr(c),u;t[7]!==l||t[8]!==o||t[9]!==s?(u=e=>{!l.isExporting&&!s.isInstalling&&o(e)},t[7]=l,t[8]=o,t[9]=s,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==s||t[13]!==u?(d={...s,...l,selectFormat:u},t[11]=l,t[12]=s,t[13]=u,t[14]=d):d=t[14],d}var Qr=`(min-width: 640px)`,$r=e=>{let t=(0,Z.c)(75),{initialFormat:n,onClose:r,returnFocusRef:i}=e,a;t[0]!==n||t[1]!==r?(a={initialFormat:n,onClose:r},t[0]=n,t[1]=r,t[2]=a):a=t[2];let{dialogRef:o,isExporting:s,isInstalling:c,canInstall:l,formats:u,options:d,selected:f,selectFormat:p,updateOptions:m,installRequirements:h,submit:g}=Zr(a),_=s||c,v=je(Qr),{format:y,status:b,usesBrowserPrint:x,actionLabel:S,command:C,footerDescription:w}=f,T=fr[y],E=T.Options,D;t[3]===i?D=t[4]:(D=i?{onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()}}:{},t[3]=i,t[4]=D);let ee=D,te;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,X.jsxs)(gt,{className:`border-b px-5 py-4 pr-12`,children:[(0,X.jsx)(yt,{children:`Export notebook`}),(0,X.jsx)(ht,{children:`Choose a format and adjust its options.`})]}),t[5]=te):te=t[5];let ne=v?`vertical`:`horizontal`,O;if(t[6]!==u||t[7]!==_){let e;t[9]===_?e=t[10]:(e=e=>{let{format:t,status:n}=e,r=fr[t];return(0,X.jsxs)(be,{value:t,disabled:_,className:`min-w-0 justify-start gap-2 px-2.5 py-2 text-xs data-[state=active]:shadow-xs sm:w-full sm:text-sm`,"data-testid":`export-format-${t}`,children:[(0,X.jsx)(r.Icon,{className:`size-3.5 shrink-0`,strokeWidth:1.5}),(0,X.jsx)(`span`,{className:`truncate`,children:r.label}),(0,X.jsx)(kr,{status:n})]},t)},t[9]=_,t[10]=e),O=u.map(e),t[6]=u,t[7]=_,t[8]=O}else O=t[8];let k;t[11]===O?k=t[12]:(k=(0,X.jsx)(Se,{"aria-label":`Export format`,className:`grid max-h-none shrink-0 grid-cols-2 items-stretch justify-start gap-1 overflow-auto rounded-none border-b bg-muted/20 p-2 min-[360px]:grid-cols-3 sm:flex sm:h-full sm:flex-col sm:border-b-0 sm:border-r`,children:O}),t[11]=O,t[12]=k);let A;if(t[13]!==E||t[14]!==l||t[15]!==T.description||t[16]!==T.label||t[17]!==y||t[18]!==u||t[19]!==h||t[20]!==_||t[21]!==c||t[22]!==d||t[23]!==b||t[24]!==m||t[25]!==x){let e;t[27]!==E||t[28]!==l||t[29]!==T.description||t[30]!==T.label||t[31]!==y||t[32]!==h||t[33]!==_||t[34]!==c||t[35]!==d||t[36]!==b||t[37]!==m||t[38]!==x?(e=e=>{let{format:t}=e;return(0,X.jsxs)(xe,{value:t,className:`mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`mb-3`,children:[(0,X.jsx)(`h3`,{className:`text-base font-semibold`,children:T.label}),(0,X.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:T.description})]}),(0,X.jsx)(Ar,{format:y,formatLabel:T.label,status:b,onInstall:l?h:void 0,isInstalling:c}),x?null:(0,X.jsx)(E,{options:d,updateOptions:m,disabled:_})]},t)},t[27]=E,t[28]=l,t[29]=T.description,t[30]=T.label,t[31]=y,t[32]=h,t[33]=_,t[34]=c,t[35]=d,t[36]=b,t[37]=m,t[38]=x,t[39]=e):e=t[39],A=u.map(e),t[13]=E,t[14]=l,t[15]=T.description,t[16]=T.label,t[17]=y,t[18]=u,t[19]=h,t[20]=_,t[21]=c,t[22]=d,t[23]=b,t[24]=m,t[25]=x,t[26]=A}else A=t[26];let j;t[40]!==y||t[41]!==p||t[42]!==ne||t[43]!==k||t[44]!==A?(j=(0,X.jsxs)(Ce,{value:y,onValueChange:p,orientation:ne,className:`flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]`,children:[k,A]}),t[40]=y,t[41]=p,t[42]=ne,t[43]=k,t[44]=A,t[45]=j):j=t[45];let M;t[46]===C?M=t[47]:(M=C?(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border bg-background px-2.5 py-2 font-mono text-xs`,children:[(0,X.jsx)(`span`,{className:`select-none text-muted-foreground`,"aria-hidden":!0,children:`$`}),(0,X.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto whitespace-nowrap`,"data-testid":`export-cli-command`,"aria-label":`Equivalent POSIX shell command`,children:C}),(0,X.jsx)(Mt,{value:C,className:`size-3.5`,buttonClassName:_e(ze({variant:`ghost`,size:`icon`}),`shrink-0`),tooltip:`Copy POSIX shell command`,ariaLabel:`Copy POSIX shell command`,toastTitle:`Command copied`})]}):null,t[46]=C,t[47]=M);let re=C&&`mt-3`,N;t[48]===re?N=t[49]:(N=_e(`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,re),t[48]=re,t[49]=N);let P;t[50]===w?P=t[51]:(P=w?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:w}):null,t[50]=w,t[51]=P);let F=!b.available||_,I=!w&&`sm:ml-auto`,L;t[52]===I?L=t[53]:(L=_e(`border-(--blue-11) bg-(--blue-11) hover:border-(--blue-12) hover:bg-(--blue-12) sm:min-w-36 dark:border-(--blue-7) dark:bg-(--blue-5) dark:text-(--blue-12) dark:hover:border-(--blue-8) dark:hover:bg-(--blue-6)`,I),t[52]=I,t[53]=L);let R;t[54]===s?R=t[55]:(R=s&&(0,X.jsx)(xt,{size:`small`,className:`mr-2`,"aria-hidden":!0}),t[54]=s,t[55]=R);let ie=x?`Print to PDF`:S,z;t[56]!==s||t[57]!==g||t[58]!==F||t[59]!==L||t[60]!==R||t[61]!==ie?(z=(0,X.jsxs)(Ve,{type:`button`,disabled:F,"aria-busy":s,onClick:g,className:L,"data-testid":`export-submit`,children:[R,ie]}),t[56]=s,t[57]=g,t[58]=F,t[59]=L,t[60]=R,t[61]=ie,t[62]=z):z=t[62];let B;t[63]!==N||t[64]!==P||t[65]!==z?(B=(0,X.jsxs)(`div`,{className:N,children:[P,z]}),t[63]=N,t[64]=P,t[65]=z,t[66]=B):B=t[66];let V;t[67]!==B||t[68]!==M?(V=(0,X.jsxs)(`footer`,{className:`min-w-0 border-t bg-muted/20 px-4 py-3`,children:[M,B]}),t[67]=B,t[68]=M,t[69]=V):V=t[69];let H;return t[70]!==o||t[71]!==ee||t[72]!==V||t[73]!==j?(H=(0,X.jsxs)(_t,{ref:o,className:`grid h-dvh max-h-[760px] min-w-0 w-[calc(100vw-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:top-[5vh] sm:h-[90vh] sm:max-h-[640px] sm:max-w-3xl`,"data-testid":`export-dialog`,...ee,children:[te,j,V]}),t[70]=o,t[71]=ee,t[72]=V,t[73]=j,t[74]=H):H=t[74],H};function ei(e){let t=(0,Z.c)(5),{openPrompt:n,closeModal:r}=vt(),{sendCopy:i}=Ge(),a;return t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==e?(a=()=>{if(!e)return null;let t=Ot.guessDeliminator(e),a=Dt.basename(e);n({title:`Copy notebook`,description:`Enter a new filename for the notebook copy.`,defaultValue:`_${a}`,confirmText:`Copy notebook`,spellCheck:!1,onConfirm:n=>{let a=t.join(Dt.dirname(e),n);i({source:e,destination:a}).then(()=>{r(),Et({title:`Notebook copied`,description:`A copy of the notebook has been created.`}),Yt(a)})}})},t[0]=r,t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}function ti(){let e=(0,Z.c)(4),{openConfirm:t}=vt(),n=a(de),{sendRestart:r}=Ge(),i;return e[0]!==t||e[1]!==r||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,X.jsx)(ye,{onClick:async()=>{n({state:ce.CLOSING}),await r(),Pt()},"aria-label":`Confirm Restart`,children:`Restart`})})},e[0]=t,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}var ni=new A,ri=e=>ni.isSupported(e)?`markdown`:`code`,ii=()=>{let e=(0,Z.c)(3),{updateCellConfig:t}=u(),{saveCellConfig:n}=Ge(),r;return e[0]!==n||e[1]!==t?(r=async(e,r)=>{let i=te(),a={};for(let t of i.cellIds.inOrderIds){let n=i.cellData[t];n!==void 0&&n.config.hide_code!==e&&ri(n.code)===r&&(a[t]={hide_code:e})}let o=ae.entries(a);if(o.length!==0){await n({configs:a});for(let[e,n]of o)t({cellId:e,config:n})}},e[0]=n,e[1]=t,e[2]=r):r=e[2],r},ai=e=>{e?.preventDefault(),e?.stopPropagation()};function oi(e){let n=(0,Z.c)(43),i;n[0]===e?i=n[1]:(i=e===void 0?{}:e,n[0]=e,n[1]=i);let{exportDialogReturnFocusRef:o}=i,l=Rt(),{openModal:m,closeModal:g}=vt(),{toggleApplication:C}=v(),{selectedPanel:w}=c(),[T]=t(oe),E=r(se),O=ii(),[A]=z(),M=r(p),N=r(ie),{updateCellConfig:P,undoDeleteCell:F,clearAllCellOutputs:I,addSetupCellIfDoesntExist:L,collapseAllCells:R,expandAllCells:U}=u(),W=ti(),K=Nt(),q=ei(l),ce=a(Ln),le=a(V),{handleClick:ue}=H(),de=a(B),fe=a(tr),{readCode:ge,saveCellConfig:_e}=Ge(),ve=b(`database`),ye=b(`storage`),be=y(),xe=r(S),Se=r(re),Ce=r(d),{selectedLayout:we}=me(),{setLayoutView:Te}=he(),Ee=In(),De=A.sharing?.html??!0,Oe=A.sharing?.wasm??!0,ke=A.sharing?.molab??!0,Ae=we===`slides`,je;if(n[2]!==be||n[3]!==L||n[4]!==N||n[5]!==Se||n[6]!==M||n[7]!==I||n[8]!==g||n[9]!==R||n[10]!==q||n[11]!==ve||n[12]!==ye||n[13]!==U||n[14]!==o||n[15]!==l||n[16]!==xe||n[17]!==Ae||n[18]!==E||n[19]!==m||n[20]!==ue||n[21]!==ge||n[22]!==W||n[23]!==K||n[24]!==_e||n[25]!==we||n[26]!==w||n[27]!==O||n[28]!==ce||n[29]!==fe||n[30]!==de||n[31]!==Te||n[32]!==le||n[33]!==De||n[34]!==ke||n[35]!==Oe||n[36]!==C||n[37]!==Ee||n[38]!==F||n[39]!==Ce||n[40]!==P||n[41]!==T.mode){let e=[`db`,`sql`,...Wt],t=[`bucket`,`object storage`,...Kt],r=xi,i=(e,t)=>{t&&fe(e=>Qn(e,t)),m((0,X.jsx)($r,{initialFormat:e,onClose:g,returnFocusRef:o}))};je=[{icon:(0,X.jsx)(Me,{size:14,strokeWidth:1.5}),label:`Export…`,additionalKeywords:[`download`,`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],handle:()=>i()},{icon:(0,X.jsx)(Me,{size:14,strokeWidth:1.5}),label:`Download`,redundant:!0,handle:ai,dropdown:[{icon:(0,X.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Download as HTML`,handle:()=>i(`html`,{html:{includeCode:!0}})},{icon:(0,X.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Download as HTML (exclude code)`,handle:()=>i(`html`,{html:{includeCode:!1}})},{icon:(0,X.jsx)(zt,{strokeWidth:1.5,style:{width:14,height:14}}),label:`Download as Markdown`,handle:()=>i(`markdown`)},{icon:(0,X.jsx)(un,{size:14,strokeWidth:1.5}),label:`Download as ipynb`,handle:()=>i(`ipynb`)},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Download notebook source`,handle:()=>i(`script`,{script:{type:`source`}})},{icon:(0,X.jsx)(et,{size:14,strokeWidth:1.5}),label:`Download flat script`,handle:()=>i(`script`,{script:{type:`flat`}})},{divider:!0,icon:(0,X.jsx)(pt,{size:14,strokeWidth:1.5}),label:`Download as PNG`,handle:()=>i(`png`)},Ae?{divider:!0,icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:ai,dropdown:[{icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Document Layout`,handle:()=>i(`pdf`,{pdf:{preset:`document`}})},{icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Slides Layout`,hidden:J(),rightElement:(0,X.jsx)(`span`,{className:`ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700`,children:`Recommended`}),handle:()=>i(`pdf`,{pdf:{preset:`slides`}})}]}:{divider:!0,icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:()=>i(`pdf`,{pdf:{preset:`document`}})}]},{icon:(0,X.jsx)(f,{size:14,strokeWidth:1.5}),label:`Pair with an agent`,hidden:J(),handle:async()=>{m((0,X.jsx)(Ut,{onClose:g}))}},{icon:(0,X.jsx)(pn,{size:14,strokeWidth:1.5}),label:`Share`,handle:ai,hidden:!De&&!Oe&&!ke,dropdown:[{icon:(0,X.jsx)(at,{size:14,strokeWidth:1.5}),label:`Publish HTML to web`,hidden:!De,handle:async()=>{m((0,X.jsx)(Mn,{onClose:g}))}},{icon:(0,X.jsx)(bt,{size:14,strokeWidth:1.5}),label:`Create WebAssembly link`,hidden:!Oe,handle:async()=>{let e=await ge(),t=Ft({code:e.contents});await jt(t),Et({title:`Copied`,description:`Link copied to clipboard.`})}},{icon:(0,X.jsx)(Jt,{size:14,strokeWidth:1.5}),label:`Create molab notebook`,hidden:!ke,handle:async()=>{let e=await ge(),t=Ft({code:e.contents,baseUrl:`${G.molab}/new`});window.open(t,`_blank`)}}]},{icon:(0,X.jsx)(dn,{size:14,strokeWidth:1.5}),label:`Helper panel`,redundant:!0,handle:ai,dropdown:ee.flatMap(e=>{let t=e.type===`ai`&&!N;if(k({panel:e,capabilities:M,aiEnabled:N})&&!t)return[];let{type:n,Icon:i,additionalKeywords:a}=e;return{label:We.startCase(n),rightElement:r(w===n),icon:(0,X.jsx)(i,{size:14,strokeWidth:1.5}),handle:()=>{if(t){ue(`ai`,`ai-features`);return}C(n)},additionalKeywords:a}})},{icon:(0,X.jsx)(fn,{size:14,strokeWidth:1.5}),label:`Present as`,handle:ai,dropdown:[{icon:T.mode===`present`?(0,X.jsx)(x,{size:14,strokeWidth:1.5}):(0,X.jsx)(Ke,{size:14,strokeWidth:1.5}),label:`Toggle app view`,hotkey:`global.hideCode`,handle:()=>{Ee()}},...pe.map((e,t)=>{let n=Bn(e);return{divider:t===0,label:Vn(e),icon:(0,X.jsx)(n,{size:14,strokeWidth:1.5}),rightElement:(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:we===e&&(0,X.jsx)(Qe,{size:14})}),handle:()=>{Te(e),T.mode===`edit`&&Ee()}}})]},{icon:(0,X.jsx)(sn,{size:14,strokeWidth:1.5}),label:`Duplicate notebook`,hidden:!l||J(),handle:q},{icon:(0,X.jsx)(tn,{size:14,strokeWidth:1.5}),label:`Copy code to clipboard`,hidden:!l,handle:async()=>{let e=await ge();await jt(e.contents),Et({title:`Copied`,description:`Code copied to clipboard.`})}},{icon:(0,X.jsx)($e,{size:14,strokeWidth:1.5}),label:`Enable all cells`,hidden:!xe||E,handle:async()=>{let e=te(),t=h(e),n=ae.fromEntries(t.map(bi));await _e({configs:n});for(let e of t)P({cellId:e,config:{disabled:!1}})}},{divider:!0,icon:(0,X.jsx)(an,{size:14,strokeWidth:1.5}),label:`Add setup cell`,handle:()=>{L({})}},{icon:(0,X.jsx)(D,{size:14,strokeWidth:1.5}),label:`Add database connection`,additionalKeywords:e,handle:()=>{m((0,X.jsx)(Gt,{onClose:g}))},dropdown:ve.length===0?void 0:[...ve.map(e=>({icon:(0,X.jsx)(f,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>be(e)})),{divider:!0,icon:(0,X.jsx)(D,{size:14,strokeWidth:1.5}),label:`Browse all connections`,additionalKeywords:e,handle:()=>{m((0,X.jsx)(Gt,{onClose:g}))}}]},{icon:(0,X.jsx)(lt,{size:14,strokeWidth:1.5}),label:`Add remote storage`,additionalKeywords:t,handle:()=>{m((0,X.jsx)(Gt,{defaultTab:`storage`,onClose:g}))},dropdown:ye.length===0?void 0:[...ye.map(e=>({icon:(0,X.jsx)(f,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>be(e)})),{divider:!0,icon:(0,X.jsx)(lt,{size:14,strokeWidth:1.5}),label:`Browse all connections`,additionalKeywords:t,handle:()=>{m((0,X.jsx)(Gt,{defaultTab:`storage`,onClose:g}))}}]},{icon:(0,X.jsx)(hn,{size:14,strokeWidth:1.5}),label:Ce,hidden:!Se||E,handle:()=>{F()}},{icon:(0,X.jsx)(mn,{size:14,strokeWidth:1.5}),label:`Restart kernel`,variant:`danger`,handle:W,additionalKeywords:[`reset`,`reload`,`restart`]},{icon:(0,X.jsx)(on,{size:14,strokeWidth:1.5}),label:`Re-run all cells`,redundant:!0,hotkey:`global.runAll`,handle:async()=>{K()}},{icon:(0,X.jsx)(j,{size:14,strokeWidth:1.5}),label:`Clear all outputs`,redundant:!0,handle:()=>{I()}},{icon:(0,X.jsx)(s,{size:14,strokeWidth:1.5}),label:`Show all code`,hotkey:`global.showAllCode`,handle:()=>O(!1,`code`),redundant:!0},{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Hide all code`,hotkey:`global.hideAllCode`,handle:()=>O(!0,`code`),redundant:!0},{icon:(0,X.jsx)(s,{size:14,strokeWidth:1.5}),label:`Show all markdown code`,hotkey:`global.showAllMarkdownCode`,handle:()=>O(!1,`markdown`),redundant:!0},{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Hide all markdown code`,hotkey:`global.hideAllMarkdownCode`,handle:()=>O(!0,`markdown`),redundant:!0},{icon:(0,X.jsx)(en,{size:14,strokeWidth:1.5}),label:`Collapse all sections`,hotkey:`global.collapseAllSections`,handle:R,redundant:!0},{icon:(0,X.jsx)($t,{size:14,strokeWidth:1.5}),label:`Expand all sections`,hotkey:`global.expandAllSections`,handle:U,redundant:!0},{divider:!0,icon:(0,X.jsx)(rn,{size:14,strokeWidth:1.5}),label:`Command palette`,hotkey:`global.commandPalette`,handle:()=>ce(yi)},{icon:(0,X.jsx)(qe,{size:14,strokeWidth:1.5}),label:`Keyboard shortcuts`,hotkey:`global.showHelp`,handle:()=>de(vi)},{icon:(0,X.jsx)(Ct,{size:14,strokeWidth:1.5}),label:`User settings`,handle:()=>le(_i),redundant:!0,additionalKeywords:[`preferences`,`options`,`configuration`]},{icon:(0,X.jsx)(ln,{size:14,strokeWidth:1.5}),label:`Report an issue`,additionalKeywords:[`feedback`,`bug`,`issue`,`report`,`diagnostics`],handle:()=>m((0,X.jsx)(On,{onClose:g}))},{icon:(0,X.jsx)(rt,{size:14,strokeWidth:1.5}),label:`Resources`,handle:ai,dropdown:[{icon:(0,X.jsx)(ne,{size:14,strokeWidth:1.5}),label:`Documentation`,handle:gi},{icon:(0,X.jsx)(qt,{className:`h-3.5 w-3.5`}),label:`GitHub`,handle:hi},{icon:(0,X.jsx)(ot,{size:14,strokeWidth:1.5}),label:`Discord Community`,handle:mi},{icon:(0,X.jsx)(ct,{className:`h-3.5 w-3.5`}),label:`YouTube`,handle:pi},{icon:(0,X.jsx)(_,{size:14,strokeWidth:1.5}),label:`Changelog`,handle:fi}]},{divider:!0,icon:(0,X.jsx)(ut,{size:14,strokeWidth:1.5}),label:`Open home`,hidden:!location.search.includes(`file`),handle:di},{icon:(0,X.jsx)(Jt,{size:14,strokeWidth:1.5}),label:`New notebook`,hidden:!location.search.includes(`file`),handle:ui}].filter(li).map(si),n[2]=be,n[3]=L,n[4]=N,n[5]=Se,n[6]=M,n[7]=I,n[8]=g,n[9]=R,n[10]=q,n[11]=ve,n[12]=ye,n[13]=U,n[14]=o,n[15]=l,n[16]=xe,n[17]=Ae,n[18]=E,n[19]=m,n[20]=ue,n[21]=ge,n[22]=W,n[23]=K,n[24]=_e,n[25]=we,n[26]=w,n[27]=O,n[28]=ce,n[29]=fe,n[30]=de,n[31]=Te,n[32]=le,n[33]=De,n[34]=ke,n[35]=Oe,n[36]=C,n[37]=Ee,n[38]=F,n[39]=Ce,n[40]=P,n[41]=T.mode,n[42]=je}else je=n[42];return je}function si(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ci)}:e}function ci(e){return!e.hidden}function li(e){return!e.hidden}function ui(){let e=kt();window.open(e,`_blank`)}function di(){let e=document.baseURI.split(`?`)[0];window.open(e,`_blank`,`noopener`)}function fi(){window.open(G.releasesPage,`_blank`)}function pi(){window.open(G.youtube,`_blank`)}function mi(){window.open(G.discordLink,`_blank`)}function hi(){window.open(G.githubPage,`_blank`)}function gi(){window.open(G.docsPage,`_blank`)}function _i(e){return!e}function vi(e){return!e}function yi(e){return!e}function bi(e){return[e,{disabled:!1}]}function xi(e){return(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:e&&(0,X.jsx)(Qe,{size:14})})}export{Ln as a,gn as c,an as d,rn as f,Rn as i,hn as l,tn as m,ii as n,In as o,nn as p,ti as r,Dn as s,oi as t,ln 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-PQMiMaaL.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-BHZDiHTq.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-B0Z9INg1.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/react-CBDbhulC.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/compiler-runtime-CYIjoINj.js">
@@ -205,7 +205,7 @@
205
205
  <link rel="modulepreload" crossorigin href="./assets/formats-C6s96nu2.js">
206
206
  <link rel="modulepreload" crossorigin href="./assets/table-DmqOOjfe.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-BSRAHC4P.js">
208
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-DflXi8WP.js">
208
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BYSpdF43.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-ChZdjJhj.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/square-function-DkZweMAs.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/spec-DKsAmLTi.js">
@@ -221,7 +221,7 @@
221
221
  <link rel="modulepreload" crossorigin href="./assets/markdown-export-0rLbaq8b.js">
222
222
  <link rel="modulepreload" crossorigin href="./assets/data-grid-types-DgHVN_Zz.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/glide-utils-UGsrRHYj.js">
224
- <link rel="modulepreload" crossorigin href="./assets/column-preview-4ZtjRVCL.js">
224
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-Bnrq4bEC.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/square-B58Ib8Ir.js">
226
226
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-MihykDYG.js">
227
227
  <link rel="modulepreload" crossorigin href="./assets/prop-types-Djf4O40e.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.24.1-dev109",
3
+ "version": "0.24.1-dev110",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -5,7 +5,7 @@ import {
5
5
  getCoreRowModel,
6
6
  useReactTable,
7
7
  } from "@tanstack/react-table";
8
- import { fireEvent, render, screen } from "@testing-library/react";
8
+ import { fireEvent, render, screen, within } from "@testing-library/react";
9
9
  import { beforeAll, describe, expect, it, vi } from "vitest";
10
10
  import { TooltipProvider } from "@/components/ui/tooltip";
11
11
  import { ColumnExplorerPanel } from "../column-explorer-panel/column-explorer";
@@ -46,7 +46,7 @@ function PanelHarness({
46
46
  columns: TEST_COLUMNS,
47
47
  getCoreRowModel: getCoreRowModel(),
48
48
  locale: "en-US",
49
- state: {
49
+ initialState: {
50
50
  columnVisibility: Object.fromEntries(
51
51
  initiallyHidden.map((id) => [id, false]),
52
52
  ),
@@ -76,6 +76,20 @@ function getSearchInput() {
76
76
  return screen.getByPlaceholderText("Search columns...");
77
77
  }
78
78
 
79
+ function getColumnRow(columnName: string): HTMLElement {
80
+ const row = screen.getByText(columnName).closest('[role="option"]');
81
+ if (!row) {
82
+ throw new Error(`No row for column ${columnName}`);
83
+ }
84
+ return row as HTMLElement;
85
+ }
86
+
87
+ function getShowOnlyButton(columnName: string): HTMLElement {
88
+ return within(getColumnRow(columnName)).getByRole("button", {
89
+ name: "Show only this column",
90
+ });
91
+ }
92
+
79
93
  describe("ColumnExplorerPanel search", () => {
80
94
  it("shows all columns when search is empty", () => {
81
95
  renderPanel();
@@ -150,4 +164,49 @@ describe("ColumnExplorerPanel visibility actions", () => {
150
164
  expect(showAll()).toBeEnabled();
151
165
  expect(hideAll()).toBeEnabled();
152
166
  });
167
+
168
+ it("show-only icon isolates one column", () => {
169
+ renderPanel();
170
+ fireEvent.click(getShowOnlyButton("customer_name"));
171
+
172
+ expect(
173
+ within(getColumnRow("customer_name")).getByRole("button", {
174
+ name: "Hide column",
175
+ }),
176
+ ).toBeInTheDocument();
177
+ expect(
178
+ within(getColumnRow("cust_age")).getByRole("button", {
179
+ name: "Show column",
180
+ }),
181
+ ).toBeInTheDocument();
182
+ expect(
183
+ within(getColumnRow("order_total")).getByRole("button", {
184
+ name: "Show column",
185
+ }),
186
+ ).toBeInTheDocument();
187
+ });
188
+
189
+ it("disables show-only icon when the column is already alone", () => {
190
+ renderPanel({
191
+ initiallyHidden: ["cust_age", "order_total"],
192
+ });
193
+ expect(getShowOnlyButton("customer_name")).toHaveAttribute(
194
+ "aria-disabled",
195
+ "true",
196
+ );
197
+ });
198
+
199
+ it("disabled show-only icon does not toggle explorer row expansion", () => {
200
+ renderPanel({
201
+ initiallyHidden: ["cust_age", "order_total"],
202
+ });
203
+ const row = getColumnRow("customer_name");
204
+ expect(row.querySelector(".lucide-chevron-down")).not.toBeNull();
205
+
206
+ const button = getShowOnlyButton("customer_name");
207
+ fireEvent.pointerDown(button, { pointerId: 1, bubbles: true });
208
+ fireEvent.click(button, { bubbles: true });
209
+
210
+ expect(row.querySelector(".lucide-chevron-down")).not.toBeNull();
211
+ });
153
212
  });
@@ -7,6 +7,7 @@ import {
7
7
  } from "@tanstack/react-table";
8
8
  import { fireEvent, render, screen } from "@testing-library/react";
9
9
  import { beforeAll, describe, expect, it } from "vitest";
10
+ import { TooltipProvider } from "@/components/ui/tooltip";
10
11
  import { ColumnVisibilityDropdown } from "../column-visibility-dropdown";
11
12
  import { INDEX_COLUMN_NAME, SELECT_COLUMN_ID } from "../types";
12
13
 
@@ -70,11 +71,25 @@ function Harness({ initiallyHidden = [], nonHideable = [] }: HarnessProps) {
70
71
  }
71
72
 
72
73
  function renderAndOpen(props?: HarnessProps) {
73
- const result = render(<Harness {...(props ?? {})} />);
74
+ const result = render(
75
+ <TooltipProvider>
76
+ <Harness {...(props ?? {})} />
77
+ </TooltipProvider>,
78
+ );
74
79
  fireEvent.click(screen.getByTestId("column-visibility-trigger"));
75
80
  return result;
76
81
  }
77
82
 
83
+ function getShowOnlyButton(columnName: string): HTMLElement {
84
+ const button = getColumnOption(columnName).querySelector(
85
+ '[aria-label="Show only this column"]',
86
+ );
87
+ if (!button) {
88
+ throw new Error(`No show-only button for column ${columnName}`);
89
+ }
90
+ return button as HTMLElement;
91
+ }
92
+
78
93
  function getOptionTexts(): string[] {
79
94
  return screen.getAllByRole("option").map((el) => el.textContent ?? "");
80
95
  }
@@ -270,10 +285,124 @@ describe("ColumnVisibilityDropdown", () => {
270
285
  it("offers both bulk actions when matches are mixed", () => {
271
286
  renderAndOpen({ initiallyHidden: ["cust_age"] });
272
287
  fireEvent.change(getSearchInput(), { target: { value: "cust" } });
288
+ expect(screen.getByText(/Show only 2 matching/)).toBeInTheDocument();
273
289
  expect(screen.getByText(/Hide 1 matching/)).toBeInTheDocument();
274
290
  expect(screen.getByText(/Show 1 matching/)).toBeInTheDocument();
275
291
  });
276
292
 
293
+ it("lists show-only before hide and show bulk actions while searching", () => {
294
+ renderAndOpen({ initiallyHidden: ["cust_age"] });
295
+ fireEvent.change(getSearchInput(), { target: { value: "cust" } });
296
+ expect(getOptionTexts().slice(0, 3)).toEqual([
297
+ "Show only 2 matching",
298
+ "Hide 1 matching",
299
+ "Show 1 matching",
300
+ ]);
301
+ });
302
+
303
+ it("'Show only N matching' isolates matching columns", () => {
304
+ renderAndOpen({ initiallyHidden: ["cust_age"] });
305
+ fireEvent.change(getSearchInput(), { target: { value: "cust" } });
306
+ fireEvent.click(getColumnOption("Show only 2 matching"));
307
+ fireEvent.change(getSearchInput(), { target: { value: "" } });
308
+
309
+ expect(
310
+ getColumnOption("customer_name").querySelector(".lucide-eye-off"),
311
+ ).toBeNull();
312
+ expect(
313
+ getColumnOption("cust_age").querySelector(".lucide-eye-off"),
314
+ ).toBeNull();
315
+ expect(
316
+ getColumnOption("order_total").querySelector(".lucide-eye-off"),
317
+ ).not.toBeNull();
318
+ fireEvent.change(getSearchInput(), { target: { value: "cust" } });
319
+ expect(getColumnOption("Show only 2 matching")).toHaveAttribute(
320
+ "aria-disabled",
321
+ "true",
322
+ );
323
+ });
324
+
325
+ it("disables 'Show only N matching' when already showing only matches", () => {
326
+ renderAndOpen({
327
+ initiallyHidden: ["order_total"],
328
+ });
329
+ fireEvent.change(getSearchInput(), { target: { value: "cust" } });
330
+ expect(getColumnOption("Show only 2 matching")).toHaveAttribute(
331
+ "aria-disabled",
332
+ "true",
333
+ );
334
+ });
335
+
336
+ it("omits 'Show only N matching' without search text", () => {
337
+ renderAndOpen();
338
+ expect(
339
+ screen.queryByText(/Show only \d+ matching/),
340
+ ).not.toBeInTheDocument();
341
+ });
342
+
343
+ it("omits search bulk actions when only non-hideable columns match", () => {
344
+ renderAndOpen({ nonHideable: ["customer_name"] });
345
+ fireEvent.change(getSearchInput(), { target: { value: "customer" } });
346
+ expect(screen.getByText("customer_name")).toBeInTheDocument();
347
+ expect(
348
+ screen.queryByText(/Show only \d+ matching/),
349
+ ).not.toBeInTheDocument();
350
+ expect(screen.queryByText(/Hide \d+ matching/)).not.toBeInTheDocument();
351
+ expect(screen.queryByText(/Show \d+ matching/)).not.toBeInTheDocument();
352
+ });
353
+
354
+ it("show-only icon isolates one column without clearing search", () => {
355
+ renderAndOpen();
356
+ fireEvent.change(getSearchInput(), { target: { value: "cust" } });
357
+ fireEvent.click(getShowOnlyButton("customer_name"));
358
+ expect(getSearchInput()).toHaveValue("cust");
359
+ fireEvent.change(getSearchInput(), { target: { value: "" } });
360
+
361
+ expect(
362
+ getColumnOption("customer_name").querySelector(".lucide-eye-off"),
363
+ ).toBeNull();
364
+ expect(
365
+ getColumnOption("cust_age").querySelector(".lucide-eye-off"),
366
+ ).not.toBeNull();
367
+ expect(
368
+ getColumnOption("order_total").querySelector(".lucide-eye-off"),
369
+ ).not.toBeNull();
370
+ });
371
+
372
+ it("show-only icon does not toggle the row visibility", () => {
373
+ renderAndOpen();
374
+ fireEvent.click(getShowOnlyButton("customer_name"));
375
+
376
+ expect(
377
+ getColumnOption("customer_name").querySelector(".lucide-eye-off"),
378
+ ).toBeNull();
379
+ });
380
+
381
+ it("disables show-only icon when the column is already alone", () => {
382
+ renderAndOpen({
383
+ initiallyHidden: ["cust_age", "order_total"],
384
+ });
385
+ expect(getShowOnlyButton("customer_name")).toHaveAttribute(
386
+ "aria-disabled",
387
+ "true",
388
+ );
389
+ });
390
+
391
+ it("disabled show-only icon blocks pointer activation of the row", () => {
392
+ renderAndOpen({
393
+ initiallyHidden: ["cust_age", "order_total"],
394
+ });
395
+ const button = getShowOnlyButton("customer_name");
396
+ expect(button).toHaveAttribute("aria-disabled", "true");
397
+
398
+ fireEvent.pointerDown(button, { pointerId: 1, bubbles: true });
399
+ fireEvent.click(button, { bubbles: true });
400
+
401
+ expect(
402
+ getColumnOption("customer_name").querySelector(".lucide-eye-off"),
403
+ ).toBeNull();
404
+ });
405
+
277
406
  it("renders non-hideable columns disabled and without an eye toggle", () => {
278
407
  renderAndOpen({ nonHideable: ["customer_name"] });
279
408
  const option = getColumnOption("customer_name");