@marimo-team/frontend 0.24.3-dev3 → 0.24.3-dev4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CellStatus-LoTwk7fR.js → CellStatus-0QNZS4By.js} +1 -1
- package/dist/assets/{JsonOutput-CzIGPEZQ.js → JsonOutput-D2ZWLZs4.js} +7 -7
- package/dist/assets/{MarimoErrorOutput-DqpoYOvw.js → MarimoErrorOutput-BlmIJ9WY.js} +2 -2
- package/dist/assets/{RenderHTML-DwhMAd9l.js → RenderHTML-DnPB4qpJ.js} +1 -1
- package/dist/assets/{RunButton-BlpbweyH.js → RunButton-C7TxE07w.js} +1 -1
- package/dist/assets/{add-cell-with-ai-R-3DS79K.js → add-cell-with-ai-OQ4sSXg4.js} +12 -12
- package/dist/assets/{add-connection-dialog-BGfpw5lC.js → add-connection-dialog-MTOC2ycO.js} +73 -73
- package/dist/assets/{agent-panel-Cgt_K0tD.js → agent-panel-BdEDIHdc.js} +4 -4
- package/dist/assets/ai-model-dropdown-CmJEEhSC.js +3 -0
- package/dist/assets/app-config-button-W8Pytgb5.js +1 -0
- package/dist/assets/{blob-B2d_dHwI.js → blob-BrVH7IJp.js} +1 -1
- package/dist/assets/{cell-editor-Dw09J9yD.js → cell-editor-C7IiingQ.js} +8 -8
- package/dist/assets/{cell-link-6burT2XF.js → cell-link-CbHXmrt8.js} +1 -1
- package/dist/assets/{cells-Cp-G34Rz.js → cells-BBhW3FXj.js} +1 -1
- package/dist/assets/{chat-display-Bu405iyc.js → chat-display-CIpYPLlF.js} +1 -1
- package/dist/assets/{chat-panel-BlUwNY5j.js → chat-panel-CK3X_KPy.js} +2 -2
- package/dist/assets/{chat-ui-DGiVDzNh.js → chat-ui-BJwtx1SR.js} +4 -4
- package/dist/assets/{column-preview-riSXbYe_.js → column-preview-Coa5PyHk.js} +1 -1
- package/dist/assets/{command-palette-CCVzJcyf.js → command-palette-_xpwMniA.js} +1 -1
- package/dist/assets/{common-CHR7w7aQ.js → common-KqtqJsml.js} +1 -1
- package/dist/assets/{components-C7mWrmXr.js → components-Cpv2z-yV.js} +1 -1
- package/dist/assets/{datasource-DrODSIs0.js → datasource-B3qF2oaW.js} +2 -2
- package/dist/assets/{dependency-graph-panel-AY5BEVH2.js → dependency-graph-panel-Av1CMZ61.js} +3 -3
- package/dist/assets/{documentation-panel-CaJF7e-j.js → documentation-panel-BEz3Hjfu.js} +1 -1
- package/dist/assets/{download-DMxOzI7b.js → download-BgO9EN-W.js} +1 -1
- package/dist/assets/edit-page-DslcxB67.js +9 -0
- package/dist/assets/error-entries-BFzSRy80.js +5 -0
- package/dist/assets/{error-panel-Bhlvt6_H.js → error-panel-BtLTJDUq.js} +1 -1
- package/dist/assets/{file-explorer-panel-s0ohSG_L.js → file-explorer-panel-DEyChgqS.js} +1 -1
- package/dist/assets/{file-icons-DdGYuADJ.js → file-icons-BhotQqrU.js} +1 -1
- package/dist/assets/{file-name-input-K4MKESI_.js → file-name-input-CH-hNP6F.js} +1 -1
- package/dist/assets/{floating-outline-DaUHnl_e.js → floating-outline-Cmk3XDJi.js} +1 -1
- package/dist/assets/{home-page-BLd6rnbk.js → home-page-CUBuu5Go.js} +1 -1
- package/dist/assets/index-C5h1aWhw.js +29 -0
- package/dist/assets/{layout-DWnrxIo2.js → layout-CsLuqwD3.js} +5 -5
- package/dist/assets/{logs-panel-BGS2v3ba.js → logs-panel-BV4VZ_uH.js} +1 -1
- package/dist/assets/{markdown-renderer-BZKlbm2Q.js → markdown-renderer-751VNlrQ.js} +1 -1
- package/dist/assets/{name-cell-input-BMCdK-el.js → name-cell-input-DexJ7ZIH.js} +1 -1
- package/dist/assets/{outline-panel-Dr5u73V6.js → outline-panel-QU3nj1VW.js} +1 -1
- package/dist/assets/packages-panel-D7oDuI6v.js +1 -0
- package/dist/assets/panel-accordion-state-Dl0VcB79.js +1 -0
- package/dist/assets/panels-nM4QKfEI.js +4 -0
- package/dist/assets/process-output-CPUOlFhp.js +1 -0
- package/dist/assets/readonly-code-display-DP7DxRA1.js +1 -0
- package/dist/assets/{readonly-python-code-DpIyjHqY.js → readonly-python-code-CAYyabaV.js} +1 -1
- package/dist/assets/{reveal-component-nZIAapoD.js → reveal-component-D9DygPds.js} +2 -2
- package/dist/assets/rotate-cw-CESctpLh.js +1 -0
- package/dist/assets/{run-page-9pl8qhQR.js → run-page-CzO-uMUn.js} +1 -1
- package/dist/assets/{scratchpad-panel-BleGt2KM.js → scratchpad-panel-7YBL6E95.js} +1 -1
- package/dist/assets/session-panel-hnFaUP0Y.js +1 -0
- package/dist/assets/share-BZW3tzEX.js +1 -0
- package/dist/assets/{skeleton-BKeh8hf3.js → skeleton-CM7HxSva.js} +1 -1
- package/dist/assets/{snippets-panel-D5yy7kj0.js → snippets-panel-AdjuR23O.js} +1 -1
- package/dist/assets/state-DOrY1Jyf.js +1 -0
- package/dist/assets/state-DQHafeTV.js +3 -0
- package/dist/assets/{tracing-DNk3gmWv.js → tracing-CUlvXr_H.js} +1 -1
- package/dist/assets/{tracing-panel-Yqazr6w_.js → tracing-panel-CjyayE-l.js} +2 -2
- package/dist/assets/{tree-actions-CG5g7aUQ.js → tree-actions-mfuAcK1x.js} +1 -1
- package/dist/assets/{useAddCell-DdB_uBif.js → useAddCell-BR8kYnb6.js} +1 -1
- package/dist/assets/{useCellActionButton-B31neI3m.js → useCellActionButton-BhREXvvn.js} +1 -1
- package/dist/assets/{useDeleteCell-Bz49_cFj.js → useDeleteCell-DwaN6KAw.js} +1 -1
- package/dist/assets/useDependencyPanelTab-I-7B78cW.js +1 -0
- package/dist/assets/useInstallPackage-IUt497GC.js +1 -0
- package/dist/assets/useNotebookActions-D5_YLR42.js +10 -0
- package/dist/assets/useRunCells-BMQuitYY.js +1 -0
- package/dist/assets/{useSplitCell-Dy2_DmJR.js → useSplitCell-B7AvHoya.js} +1 -1
- package/dist/index.html +22 -22
- package/package.json +1 -1
- package/src/__mocks__/requests.ts +7 -2
- package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +143 -0
- package/src/components/editor/chrome/panels/packages-panel.tsx +145 -51
- package/src/components/editor/package-alert.tsx +25 -1
- package/src/core/packages/__tests__/useInstallPackage.test.tsx +47 -1
- package/src/core/packages/toast-components.tsx +26 -0
- package/src/core/packages/useInstallPackage.ts +7 -2
- package/src/core/wasm/bridge.ts +1 -0
- package/dist/assets/ai-model-dropdown-DCmiuk7x.js +0 -3
- package/dist/assets/app-config-button-DUJC6b6x.js +0 -1
- package/dist/assets/edit-page-xlMlcLnI.js +0 -9
- package/dist/assets/error-entries-Cv2m1yhc.js +0 -5
- package/dist/assets/index-4n22QjCD.js +0 -29
- package/dist/assets/packages-panel-BdpRg9tX.js +0 -1
- package/dist/assets/panel-accordion-state-DjUTN7i5.js +0 -1
- package/dist/assets/panels-CWn0Yh1D.js +0 -4
- package/dist/assets/process-output-Ck7-P_xp.js +0 -1
- package/dist/assets/readonly-code-display--S2daDa6.js +0 -1
- package/dist/assets/session-panel-DRGPlL5J.js +0 -1
- package/dist/assets/share-CPtBiNgr.js +0 -1
- package/dist/assets/state-B6AklCzD.js +0 -1
- package/dist/assets/state-Di9TbuV9.js +0 -3
- package/dist/assets/useDependencyPanelTab-C_ps0r--.js +0 -1
- package/dist/assets/useInstallPackage-DsD08SLK.js +0 -1
- package/dist/assets/useNotebookActions-CQtbk9CB.js +0 -10
- package/dist/assets/useRunCells-CX7oW5zy.js +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
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,D as l,E as u,Et as d,Fo as f,Hi as p,Ra as m,Ui as h,Yr as g,_,b as v,bo as y,dn as b,ea as x,ei as ee,fi as S,fn as C,h as w,ho as T,ia as E,ii as D,oa as O,qn as te,ri as k,sr as A,t as j,ta as M,ti as N,ua as ne,wo as P,zt as F}from"./cells-BBhW3FXj.js";import{Cn as I,kt as L,vt as R}from"./schemas-aTUejmFi.js";import{t as z}from"./compiler-runtime-CYIjoINj.js";import{r as re,w as B}from"./utils-D5Ywm7-q.js";import{C as V,n as H,r as U}from"./ai-model-dropdown-CmJEEhSC.js";import{g as W,n as ie}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-BlNM0caL.js";import{t as fe}from"./switch-DjXr9Y9D.js";import{g as pe,h as me,m as he,y as ge}from"./readonly-python-code-CAYyabaV.js";import{t as _e}from"./cn-ldLVeaqm.js";import{t as ve}from"./jsx-runtime-B74pBk57.js";import{i as ye,n as be,r as xe,t as Se}from"./tabs-Cy1qXLzH.js";import{a as Ce,c as we,i as Te,n as Ee,r as De,s as Oe,t as ke}from"./select-nLt2y0Sw.js";import{$ as Ae,Lt as je}from"./JsonOutput-D2ZWLZs4.js";import{a as Me,c as Ne,o as Pe,p as Fe,t as Ie}from"./download-BgO9EN-W.js";import{t as Le}from"./tooltip-BUtPzKB4.js";import{n as Re,r as ze,t as Be}from"./button-Dh8EwhsF.js";import{i as Ve,r as He,t as Ue}from"./strings-CReV1AYG.js";import{r as We}from"./requests-C6_IaFh7.js";import{t as Y}from"./createLucideIcon-B7HeEoG2.js";import{L as Ge,R as Ke,c as qe,l as Je,t as Ye,z as Xe}from"./layout-CsLuqwD3.js";import{t as Ze}from"./check-BoA6XBpj.js";import{r as Qe}from"./useCellActionButton-BhREXvvn.js";import{t as $e}from"./code-CF0HKE9K.js";import{t as et}from"./copy-BMXKNElG.js";import{t as tt}from"./eye-off-CFuPxa9F.js";import{t as nt}from"./external-link-Bp3BxyRA.js";import{t as rt}from"./file-DF8n85RA.js";import{t as it}from"./globe-BQf75qV_.js";import{n as at,r as ot,t as st}from"./youtube-DCJ-ihUU.js";import{n as ct}from"./components-DUYCXngU.js";import{i as lt,n as ut,r as dt}from"./markdown-export-0rLbaq8b.js";import{t as ft}from"./image-ab13yGv4.js";import{D as pt,E as mt,O as ht,T as gt,b as _t,j as vt}from"./write-secret-modal-D6zoZgLY.js";import{t as yt}from"./link-Cap-MZiw.js";import{t as bt}from"./spinner-Ck-Hgfvj.js";import{r as xt}from"./input-DEbY281O.js";import{t as St}from"./settings-C-cYas75.js";import{t as Ct}from"./square-B58Ib8Ir.js";import{t as wt}from"./triangle-alert-MihykDYG.js";import{t as Tt}from"./use-toast-DpWHUGuF.js";import{n as Et,t as Dt}from"./paths-zcL04qUW.js";import{o as Ot}from"./session-Sz5nSFku.js";import{n as kt}from"./useAsyncData-Buhk-UgR.js";import{n as At}from"./copy-DlEomWzI.js";import{t as jt}from"./copy-icon-z8fuTE3w.js";import{r as Mt}from"./useRunCells-BMQuitYY.js";import{o as Nt}from"./useInstallPackage-IUt497GC.js";import{t as Pt}from"./share-BZW3tzEX.js";import{n as Ft,t as It}from"./alert-dmKwNsrp.js";import{a as Lt}from"./cell-link-CbHXmrt8.js";import{t as Rt}from"./icons-CjLa9BiH.js";import{i as zt,n as Bt}from"./error-entries-BFzSRy80.js";import{t as Vt}from"./shell-DLpUCctE.js";import{t as Ht}from"./pair-with-agent-modal-CbUFKJHP.js";import{i as Ut,n as Wt,r as Gt}from"./add-connection-dialog-MTOC2ycO.js";import{t as Kt}from"./github-YRgb6LMu.js";import{n as qt}from"./marimo-icons-C3KxMV9A.js";import{t as Jt}from"./links-DLvOXyO_.js";import{i as Yt,n as Xt,t as Zt}from"./skeleton-CM7HxSva.js";var Qt=Y(`circle-chevron-down`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 10-4 4-4-4`,key:`894hmk`}]]),$t=Y(`circle-chevron-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m10 8 4 4-4 4`,key:`1wy4r4`}]]),en=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`}]]),tn=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`}]]),nn=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`}]]),rn=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`}]]),an=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`}]]),on=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`}]]),sn=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`}]]),cn=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`}]]),ln=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`}]]),un=Y(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),dn=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`}]]),fn=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`}]]),pn=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`}]]),mn=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=z(),Q=e(o(),1);function hn(e,t){let n=(0,Z.c)(11),r;n[0]===t?r=n[1]:(r=new T(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 gn(e,t){return{...e,Binaries:{...e.Binaries,Browser:t}}}function _n(e,t,n,r){return{marimo:e,Locale:n||void 0,Binaries:{Browser:t},"Environment Collection Error":r}}function vn(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 yn(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 bn(e,t){return[`<details>`,`<summary>${Ue.htmlEscape(e)??``}</summary>`,``,t,``,`</details>`].join(`
|
|
2
|
+
`)}function xn(e){return bn(`Environment`,vn(`json`,JSON.stringify(e,null,2)))}function Sn(e){return bn(`Errors`,vn(`text`,e.map(Bt).join(`
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`)))}function Cn(e){return bn(`Code`,vn(`python`,e))}var wn=ie,Tn=e=>{let t=(0,Z.c)(16),{content:n}=e,[r,i]=(0,Q.useState)(!1),a=!r&&`max-h-24 overflow-hidden`,o;t[0]===a?o=t[1]:(o=_e(`text-xs bg-muted rounded p-2 overflow-x-auto whitespace-pre-wrap`,a),t[0]=a,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,X.jsx)(`pre`,{className:o,children:n}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=!r&&(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 rounded-b bg-gradient-to-b from-transparent to-muted`}),t[5]=r,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,X.jsxs)(`div`,{className:`relative`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>i(On),t[10]=u):u=t[10];let d=r?`Show less`:`Show more`,f;t[11]===d?f=t[12]:(f=(0,X.jsx)(Be,{type:`button`,variant:`link`,size:`xs`,className:`self-start`,onClick:u,children:d}),t[11]=d,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p},En=e=>{let t=(0,Z.c)(6),{children:n}=e,{openModal:r,closeModal:i}=_t(),a;t[0]!==i||t[1]!==r?(a=()=>r((0,X.jsx)(Dn,{onClose:i})),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,X.jsx)(wn,{onClick:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o},Dn=()=>{let e=(0,Z.c)(84),{getEnvironmentInfo:t,readCode:n}=We(),a,o;e[0]===t?(a=e[1],o=e[2]):(a=async()=>t(),o=[t],e[0]=t,e[1]=a,e[2]=o);let s=kt(a,o),c=r(v),l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=zt(i),e[3]=l):l=e[3];let u=l,d;if(e[4]!==c.cellData||e[5]!==c.cellIds.inOrderIds){let t;e[7]===c.cellData?t=e[8]:(t=e=>c.cellData[e],e[7]=c.cellData,e[8]=t),d=c.cellIds.inOrderIds.map(t),e[4]=c.cellData,e[5]=c.cellIds.inOrderIds,e[6]=d}else d=e[6];let f=Je(d),p=r(y),m=r(de),h=p!==null&&f&&m.state===ce.OPEN,g=h?void 0:p===null?`Save the notebook first.`:f?`Connect the notebook to include its source.`:`Notebook source is hidden in this view.`,[_,b]=hn(`marimo:issue-report:include-errors`,!1),[x,ee]=hn(`marimo:issue-report:include-code`,!1),S;e[9]!==s.data||e[10]!==s.status?(S=s.data?gn(s.data,navigator.userAgent):s.status===`error`?_n(ge(),navigator.userAgent,navigator.language,`Server environment information unavailable`):void 0,e[9]=s.data,e[10]=s.status,e[11]=S):S=e[11];let C=S,w,T;e[12]!==x||e[13]!==h||e[14]!==n?(w=async()=>{if(!x||!h)return;let{contents:e}=await n();return e},T=[x,h,n],e[12]=x,e[13]=h,e[14]=n,e[15]=w,e[16]=T):(w=e[15],T=e[16]);let E=kt(w,T),D;bb0:{if(!C){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[17]=t):t=e[17];let n;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(n={url:G.bugReportUrl,omitted:t},e[18]=n):n=e[18],D=n;break bb0}let t;if(e[19]!==E.data||e[20]!==C||e[21]!==x||e[22]!==_){let n={env:xn(C)};_&&u.length>0&&(n[`bug-description`]=Sn(u)),x&&E.data&&(n[`reproduction-code`]=Cn(E.data)),t=yn(G.bugReportUrl,n),e[19]=E.data,e[20]=C,e[21]=x,e[22]=_,e[23]=t}else t=e[23];D=t}let{url:O,omitted:k}=D,A;e[24]===k?A=e[25]:(A=k.map(kn).join(`, `),e[24]=k,e[25]=A);let j=A,M;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsxs)(ht,{children:[(0,X.jsx)(vt,{children:`Report an issue`}),(0,X.jsx)(mt,{children:`Open a GitHub bug report prefilled with your environment, and optionally your current errors and notebook code. Nothing is uploaded automatically; review the details before posting.`})]}),e[26]=M):M=e[26];let N;e[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(nt,{className:`w-4 h-4 mr-2`}),e[27]=N):N=e[27];let ne;e[28]===O?ne=e[29]:(ne=(0,X.jsx)(Be,{type:`button`,variant:`default`,size:`xs`,asChild:!0,className:`self-start`,children:(0,X.jsxs)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,children:[N,`Open GitHub issue`]})}),e[28]=O,e[29]=ne);let P;e[30]===b?P=e[31]:(P=e=>b(e===!0),e[30]=b,e[31]=P);let F;e[32]!==_||e[33]!==P?(F=(0,X.jsx)(te,{id:`issue-include-errors`,checked:_,disabled:u.length===0,onCheckedChange:P,"aria-label":`Include errors`}),e[32]=_,e[33]=P,e[34]=F):F=e[34];let I;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(`label`,{htmlFor:`issue-include-errors`,children:`Include errors`}),e[35]=I):I=e[35];let L;e[36]===F?L=e[37]:(L=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[F,I]}),e[36]=F,e[37]=L);let R=!h,z;e[38]===ee?z=e[39]:(z=e=>ee(e===!0),e[38]=ee,e[39]=z);let re;e[40]!==x||e[41]!==R||e[42]!==z?(re=(0,X.jsx)(te,{id:`issue-include-code`,checked:x,disabled:R,onCheckedChange:z,"aria-label":`Include notebook code`}),e[40]=x,e[41]=R,e[42]=z,e[43]=re):re=e[43];let B;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(`label`,{htmlFor:`issue-include-code`,children:`Include notebook code`}),e[44]=B):B=e[44];let V;e[45]===re?V=e[46]:(V=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[re,B]}),e[45]=re,e[46]=V);let H;e[47]===g?H=e[48]:(H=g&&(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground ml-6`,children:g}),e[47]=g,e[48]=H);let U;e[49]!==E.status||e[50]!==x?(U=x&&E.status===`error`&&(0,X.jsx)(`span`,{className:`text-xs text-(--red-11) ml-6`,children:`Notebook source could not be loaded.`}),e[49]=E.status,e[50]=x,e[51]=U):U=e[51];let W;e[52]!==V||e[53]!==H||e[54]!==U?(W=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[V,H,U]}),e[52]=V,e[53]=H,e[54]=U,e[55]=W):W=e[55];let ie;e[56]!==L||e[57]!==W?(ie=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[L,W]}),e[56]=L,e[57]=W,e[58]=ie):ie=e[58];let ae;e[59]===j?ae=e[60]:(ae=j?(0,X.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-(--yellow-11)`,children:[(0,X.jsx)(wt,{className:`w-3.5 h-3.5 shrink-0 mt-0.5`}),(0,X.jsxs)(`span`,{children:[`Too large to prefill and left out of the link: `,j,`. Paste them into the issue manually.`]})]}):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Your environment is always included.`}),e[59]=j,e[60]=ae);let K;e[61]!==ne||e[62]!==ie||e[63]!==ae?(K=(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[ne,ie,ae]}),e[61]=ne,e[62]=ie,e[63]=ae,e[64]=K):K=e[64];let q;e[65]===s.status?q=e[66]:(q=s.status===`pending`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading environment details…`}),(0,X.jsx)(Zt,{className:`h-4 w-full`}),(0,X.jsx)(Zt,{className:`h-4 w-3/4`}),(0,X.jsx)(Zt,{className:`h-4 w-1/2`})]}),e[65]=s.status,e[66]=q);let oe;e[67]===s?oe=e[68]:(oe=s.status===`error`&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,X.jsx)(wt,{className:`w-4 h-4 text-(--yellow-11) shrink-0`}),(0,X.jsx)(`span`,{children:`Server environment information unavailable`}),(0,X.jsx)(Be,{type:`button`,variant:`link`,size:`xs`,onClick:()=>s.refetch(),children:`Retry`})]}),e[67]=s,e[68]=oe);let J;e[69]===C?J=e[70]:(J=C&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`Environment details`}),(0,X.jsx)(jt,{className:`w-3.5 h-3.5`,value:JSON.stringify(C,null,2),ariaLabel:`Copy environment JSON`,toastTitle:`Environment details copied`})]}),(0,X.jsx)(Tn,{content:JSON.stringify(C,null,2)})]}),e[69]=C,e[70]=J);let se;e[71]===C?se=e[72]:(se=C&&u.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`Errors`}),(0,X.jsx)(jt,{className:`w-3.5 h-3.5`,value:Sn(u),ariaLabel:`Copy errors`,toastTitle:`Errors copied`})]}),(0,X.jsx)(Tn,{content:u.map(Bt).join(`
|
|
7
|
+
|
|
8
|
+
---
|
|
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)(gt,{className:`w-[540px] max-w-[90vw]`,children:[M,(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 On(e){return!e}function kn(e){return e===`bug-description`?`errors`:e===`reproduction-code`?`code`:e}var An=`https://static.marimo.app`,jn=e=>{let t=(0,Z.c)(26),{onClose:n}=e,[r,i]=(0,Q.useState)(``),{exportAsHTML:a}=We(),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=`${An}/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:qe.INSTANCE.filenames(),layout:await Ye()}),r=Tt({title:`Uploading static notebook...`,description:`Please wait.`});await fetch(`${An}/api/static`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({html:t,path:s})}).catch(()=>{r.dismiss(),Tt({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(),Tt({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)(vt,{children:`Share static notebook`}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(ht,{children:[u,(0,X.jsxs)(mt,{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:An,target:`_blank`,children:An}),`.`]})]}),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)(xt,{"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)(Mn,{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)(Be,{"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)(Be,{"data-testid":`share-static-notebook-button`,"aria-label":`Save`,variant:`default`,type:`submit`,onClick:async()=>{await At(c)},children:`Create`}),t[17]=c,t[18]=_);let v;t[19]!==_||t[20]!==g?(v=(0,X.jsxs)(pt,{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)(gt,{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},Mn=e=>{let t=(0,Z.c)(8),[n,r]=Q.useState(!1),i;t[0]===e.text?i=t[1]:(i=ze.stopPropagation(async t=>{t.preventDefault(),await At(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)(et,{size:14,strokeWidth:1.5}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,X.jsx)(Be,{"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)(Le,{content:`Copied!`,open:n,children:s}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c};function Nn(){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=f.findElement(t);if(!e){W.warn(`Could not find HTMLCellId for visible output area`,t);continue}return{cellId:f.parse(e.id)}}}return W.warn(`No visible output area found for scroll anchor`),null}function Pn(e){if(!e){W.warn(`No scroll anchor provided to restore scroll position`);return}let t=document.getElementById(f.create(e.cellId));if(!t){W.warn(`Could not find cell element to restore scroll position`,e.cellId);return}if(!t.querySelector(`.${K.outputArea}`)){W.warn(`Could not find output area to restore scroll position`,e.cellId);return}t.scrollIntoView({block:`start`,behavior:`auto`})}function Fn(){let e=(0,Z.c)(2),t=a(oe),n;return e[0]===t?n=e[1]:(n=()=>{let e=Nn();t(t=>({mode:q(t.mode),cellAnchor:e?.cellId??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Pn(e)})})},e[0]=t,e[1]=n),n}var In=n(!1),Ln=()=>{let e=(0,Z.c)(7),{selectedLayout:t}=me(),{setLayoutView:n}=he();if(J()&&!S(`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)(Oe,{className:`min-w-[110px] border-border bg-background`,"data-testid":`layout-select`,children:(0,X.jsx)(we,{placeholder:`Select a view`})}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Ee,{children:(0,X.jsxs)(De,{children:[(0,X.jsx)(Ce,{children:`View as`}),pe.map(Vn)]})}),e[3]=a):a=e[3];let o;return e[4]!==t||e[5]!==r?(o=(0,X.jsxs)(ke,{"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 Rn(e){let t=zn(e);return(0,X.jsx)(t,{className:`h-4 w-4`})}function zn(e){switch(e){case`vertical`:return sn;case`grid`:return ot;case`slides`:return dn;default:return Ve(e),Ct}}function Bn(e){return Ue.startCase(e)}function Vn(e){return(0,X.jsx)(Te,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 leading-5`,children:[Rn(e),(0,X.jsx)(`span`,{children:Bn(e)})]})},e)}var Hn=[`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],Un=[`pymdown`,`qmd`,`mystmd`,`mdx`],Wn=[`topological`,`top-down`],Gn=[`document`,`slides`],Kn=[`source`,`flat`];function qn(e){return typeof e==`string`&&Hn.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 Jn(e,t){return e.default(t).catch(t)}function Yn(e){return I(e).optional().catch(void 0)}var Xn=I({html:Yn({includeCode:Jn(L(),$.html.includeCode)}),markdown:Yn({flavor:Jn(R(Un).nullable(),$.markdown.flavor)}),ipynb:Yn({sortMode:Jn(R(Wn),$.ipynb.sortMode),includeOutputs:Jn(L(),$.ipynb.includeOutputs)}),pdf:Yn({preset:Jn(R(Gn),$.pdf.preset),includeInputs:Jn(L(),$.pdf.includeInputs),includeOutputs:Jn(L(),$.pdf.includeOutputs),webpdf:Jn(L(),$.pdf.webpdf)}),script:Yn({type:Jn(R(Kn),$.script.type)})}).catch({});function Zn(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 Qn(e){return Zn($,Xn.parse(e))}var $n=D({toSerializable:e=>e,fromSerializable:Qn}),er=P(`marimo:export:options:v1`,$,$n,{getOnInit:!0}),tr=P(`marimo:export:last-format:v1`,`html`,D({toSerializable:e=>e,fromSerializable:e=>qn(e)?e:`html`}),{getOnInit:!0}),nr={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 rr(e,t){return e===`wasm`&&t===`pdf`}function ir({format:e,options:t,runtime:n,filename:r,availability:i}){let a=e===`script`&&t.script.type===`source`?{...nr.script,requiresNamedNotebookOnServer:!0}:nr[e],o=rr(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 ar(e,t){return e.map(e=>({value:e,...t[e]}))}var or=ar([`automatic`,...Un],{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.`}}),sr=ar(Wn,{"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.`}}),cr=ar(Gn,{document:{label:`Document`,description:`Creates pages for reading or printing.`},slides:{label:`Slides`,description:`Creates presentation slides from the notebook.`}}),lr=ar([`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.`}}),ur=ar(Kn,{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.`}}),dr={html:{label:`HTML`,actionLabel:`Export HTML`,description:`Save the current notebook as an HTML page.`,Icon:it,Options:fr},markdown:{label:`Markdown`,actionLabel:`Export Markdown`,description:`Save code and text in a Markdown-based file. Cell outputs are not included.`,Icon:s,Options:pr},ipynb:{label:`Jupyter`,actionLabel:`Export Jupyter notebook`,description:`Open the notebook in Jupyter and other compatible tools.`,Icon:ln,Options:mr},pdf:{label:`PDF`,actionLabel:`Export PDF`,description:`Save the notebook as a PDF for printing or sharing.`,Icon:rt,Options:hr},script:{label:`Python`,actionLabel:`Export flat script`,description:`Save the notebook as a Python file.`,Icon:$e,Options:gr},png:{label:`PNG`,actionLabel:`Export PNG`,description:`Capture the current app view as an image.`,Icon:ft,Options:_r}};function fr(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)(vr,{children:(0,X.jsx)(yr,{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 pr(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)(vr,{children:(0,X.jsx)(Sr,{label:`Format`,value:a,disabled:i,onValueChange:o,options:or})}),t[2]=i,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function mr(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)(br,{label:`Cell order`,value:n.ipynb.sortMode,disabled:i,onValueChange:a,options:sr}),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)(yr,{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)(vr,{children:[o,l]}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function hr(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)(br,{label:`Layout`,value:n.pdf.preset,disabled:i,onValueChange:a,options:cr}),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)(yr,{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)(yr,{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)(br,{label:`Method`,value:n.pdf.webpdf?`browser`:`latex`,disabled:i,onValueChange:e=>r(`pdf`,{webpdf:e===`browser`}),options:lr}):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)(vr,{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 gr(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)(vr,{children:(0,X.jsx)(br,{label:`Format`,value:n.script.type,disabled:i,onValueChange:a,options:ur})}),t[2]=i,t[3]=n.script.type,t[4]=a,t[5]=o):o=t[5],o}function _r(){return null}function vr(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 yr(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)(Tr,{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 br(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(xr),t[5]=o,t[6]=p);let m;t[7]!==c||t[8]!==f||t[9]!==p?(m=(0,X.jsx)(Tr,{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)(C,{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)(b,{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 xr(e){return e.description}function Sr(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(wr),t[6]=o,t[7]=p);let m;t[8]!==c||t[9]!==f||t[10]!==p?(m=(0,X.jsx)(Tr,{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)(we,{}),t[17]=_):_=t[17];let v;t[18]!==c||t[19]!==s?(v=(0,X.jsx)(Oe,{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(Cr),t[21]=o,t[22]=y);let b;t[23]===y?b=t[24]:(b=(0,X.jsx)(Ee,{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)(ke,{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 ee;return t[31]!==x||t[32]!==h?(ee=(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]=ee):ee=t[33],ee}function Cr(e){return(0,X.jsx)(Te,{value:e.value,children:e.label},e.value)}function wr(e){return e.description}function Tr(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(Er),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 Er(e){return(0,X.jsx)(`p`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:e},e)}var Dr={"playwright-chromium":{description:`PDF export requires Playwright Chromium.`}};function Or(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)(bt,{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)(O,{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 kr(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)(Ar,{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)(jr,{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 Ar(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)(O,{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)(Be,{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)(bt,{size:`small`,className:`mr-1.5 size-3.5`}):(0,X.jsx)(tn,{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)(It,{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)(Ft,{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 jr(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)(bt,{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)(It,{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)(Ft,{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)(Ar,{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)(Ar,{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(Nr).join(` `):(0,X.jsx)(`span`,{className:`block min-w-0`,children:i.requirements.map(Mr)}),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)(Ar,{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)(Ar,{children:e}),t[20]=e,t[21]=r),r}default:He(i)}}function Mr(e){let t=Dr[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 Nr(e){return Dr[e.name].description}function Pr(e){return e.endsWith(`.myst.md`)?`mystmd`:e.endsWith(`.qmd`)?`qmd`:e.endsWith(`.mdx`)?`mdx`:`pymdown`}function Fr(e,t){let n=t??Pr(e),r=ut[n],i=dt.find(t=>e.endsWith(t)),a=Fe.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 Ir(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:t===!0?[`--${e}`]:t===!1?[`--no-${e}`]:[`--${e}=${t}`])}function Lr(e){return e.preset===`document`?e.webpdf:null}var Rr={html:{subcommand:`html`,flags:({html:e})=>({"include-code":e.includeCode}),outputFilename:e=>Fe.toHTML(e)},markdown:{subcommand:`md`,flags:({markdown:e})=>({flavor:e.flavor}),outputFilename:(e,{markdown:t})=>Fr(e,t.flavor)},ipynb:{subcommand:`ipynb`,flags:({ipynb:e})=>({sort:e.sortMode,"include-outputs":e.includeOutputs}),outputFilename:e=>Fe.toIPYNB(e)},pdf:{subcommand:`pdf`,flags:({pdf:e})=>({as:e.preset,"include-inputs":e.includeInputs,"include-outputs":e.includeOutputs,webpdf:Lr(e)}),outputFilename:e=>Fe.toPDF(e)},script:{subcommand:`script`,flags:()=>({}),outputFilename:e=>`${Fe.withoutExtension(e)}.script.py`}};function zr({format:e,filename:t,options:n}){if(e===`png`||e===`script`&&n.script.type===`source`||!t)return null;let r=Rr[e];return[`marimo`,`export`,r.subcommand,Vt(t),...Ir(r.flags(n)),`-o`,Vt(r.outputFilename(t,n))].join(` `)}async function Br(e){let{exportOptions:t,captureOutputs:n,downloadPDF:r}=e;t.includeOutputs&&await n(),await r(t)}async function Vr({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 Br({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:He(e)}}var Hr={source:{actionLabel:`Export notebook source`,progressLabel:`notebook source`},flat:{actionLabel:`Export flat script`,progressLabel:`flat script`}};function Ur(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 Wr(e,t){return e===`server`&&t?Et.basename(t):Fe.toPY(document.title)}function Gr({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 Kr(e){let n=Lt(),[r,i]=t(er),[a,o]=t(tr),[s,c]=(0,Q.useState)(e??a),l=J()?`wasm`:`server`,u=We(),d=le(),[f,p]=(0,Q.useState)(!1),m=kt(async()=>l===`wasm`?null:u.getExportAvailability(),[l,u]),h=Ur(l,m),g=e=>ir({format:e,options:r,runtime:l,filename:n,availability:h}),_=g(s),v=d&&(_.reason?.type===`missing-packages`||_.reason?.type===`missing-setup`),y=Hn.map(e=>({format:e,status:g(e)})),b=rr(l,s),x=dr[s],ee=s===`script`&&r.script.type===`source`,{actionLabel:S,progressLabel:C}=s===`script`?Hr[r.script.type]:{actionLabel:x.actionLabel,progressLabel:x.label},w=b?null:zr({format:s,filename:n,options:r}),T=Gr({usesBrowserPrint:b,hasCommand:!!w,format:s,isNotebookSource:ee});return(0,Q.useEffect)(()=>{e&&o(e)},[e,o]),{formats:y,options:r,selected:{format:s,status:_,usesBrowserPrint:b,actionLabel:S,command:w,footerDescription:T},exportRequest:{format:s,options:r,sourceFilename:Wr(l,n),available:_.available,usesBrowserPrint:b,progressLabel:C},selectFormat:e=>{qn(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 qr(e){let t=document.getElementById(`App`);if(!t){let e=`The current app view could not be captured.`;throw Tt({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 Pe({element:t,filename:document.title,prepare:()=>{let t=Ie();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 Jr(e){e(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function Yr({format:e,options:t,sourceFilename:n,available:r,usesBrowserPrint:i,progressLabel:a,onClose:o}){let s=We(),c=Yt(),[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 Xt({takeScreenshots:()=>c({progress:e}),updateCellOutputs:s.updateCellOutputs})},m=async()=>{await ue(()=>qr(d.current?.parentElement??null))};return{dialogRef:d,isExporting:l,submit:async()=>{if(!(!r||l)){if(i){Jr(o);return}u(!0);try{await Ne(`Exporting ${a}…`,async r=>{await Vr({format:e,options:t,requests:s,sourceFilename:n,htmlFiles:qe.INSTANCE.filenames(),getLayout:Ye,captureOutputs:()=>p(r),capturePNG:m,downloadFile:Me})}),f.current&&o()}catch(e){W.error(`Export failed`,e)}finally{f.current&&u(!1)}}}}}function Xr(e){let t=(0,Z.c)(15),{initialFormat:n,onClose:r}=e,i=Kr(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=Yr(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 Zr=`(min-width: 640px)`,Qr=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}=Xr(a),_=s||c,v=Ae(Zr),{format:y,status:b,usesBrowserPrint:x,actionLabel:ee,command:S,footerDescription:C}=f,w=dr[y],T=w.Options,E;t[3]===i?E=t[4]:(E=i?{onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()}}:{},t[3]=i,t[4]=E);let D=E,O;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsxs)(ht,{className:`border-b px-5 py-4 pr-12`,children:[(0,X.jsx)(vt,{children:`Export notebook`}),(0,X.jsx)(mt,{children:`Choose a format and adjust its options.`})]}),t[5]=O):O=t[5];let te=v?`vertical`:`horizontal`,k;if(t[6]!==u||t[7]!==_){let e;t[9]===_?e=t[10]:(e=e=>{let{format:t,status:n}=e,r=dr[t];return(0,X.jsxs)(ye,{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)(Or,{status:n})]},t)},t[9]=_,t[10]=e),k=u.map(e),t[6]=u,t[7]=_,t[8]=k}else k=t[8];let A;t[11]===k?A=t[12]:(A=(0,X.jsx)(xe,{"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:k}),t[11]=k,t[12]=A);let j;if(t[13]!==T||t[14]!==l||t[15]!==w.description||t[16]!==w.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]!==T||t[28]!==l||t[29]!==w.description||t[30]!==w.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)(be,{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:w.label}),(0,X.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:w.description})]}),(0,X.jsx)(kr,{format:y,formatLabel:w.label,status:b,onInstall:l?h:void 0,isInstalling:c}),x?null:(0,X.jsx)(T,{options:d,updateOptions:m,disabled:_})]},t)},t[27]=T,t[28]=l,t[29]=w.description,t[30]=w.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],j=u.map(e),t[13]=T,t[14]=l,t[15]=w.description,t[16]=w.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]=j}else j=t[26];let M;t[40]!==y||t[41]!==p||t[42]!==te||t[43]!==A||t[44]!==j?(M=(0,X.jsxs)(Se,{value:y,onValueChange:p,orientation:te,className:`flex min-h-0 min-w-0 flex-col overflow-hidden sm:grid sm:grid-cols-[168px_minmax(0,1fr)]`,children:[A,j]}),t[40]=y,t[41]=p,t[42]=te,t[43]=A,t[44]=j,t[45]=M):M=t[45];let N;t[46]===S?N=t[47]:(N=S?(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:S}),(0,X.jsx)(jt,{value:S,className:`size-3.5`,buttonClassName:_e(Re({variant:`ghost`,size:`icon`}),`shrink-0`),tooltip:`Copy POSIX shell command`,ariaLabel:`Copy POSIX shell command`,toastTitle:`Command copied`})]}):null,t[46]=S,t[47]=N);let ne=S&&`mt-3`,P;t[48]===ne?P=t[49]:(P=_e(`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,ne),t[48]=ne,t[49]=P);let F;t[50]===C?F=t[51]:(F=C?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:C}):null,t[50]=C,t[51]=F);let I=!b.available||_,L=!C&&`sm:ml-auto`,R;t[52]===L?R=t[53]:(R=_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)`,L),t[52]=L,t[53]=R);let z;t[54]===s?z=t[55]:(z=s&&(0,X.jsx)(bt,{size:`small`,className:`mr-2`,"aria-hidden":!0}),t[54]=s,t[55]=z);let re=x?`Print to PDF`:ee,B;t[56]!==s||t[57]!==g||t[58]!==I||t[59]!==R||t[60]!==z||t[61]!==re?(B=(0,X.jsxs)(Be,{type:`button`,disabled:I,"aria-busy":s,onClick:g,className:R,"data-testid":`export-submit`,children:[z,re]}),t[56]=s,t[57]=g,t[58]=I,t[59]=R,t[60]=z,t[61]=re,t[62]=B):B=t[62];let V;t[63]!==P||t[64]!==F||t[65]!==B?(V=(0,X.jsxs)(`div`,{className:P,children:[F,B]}),t[63]=P,t[64]=F,t[65]=B,t[66]=V):V=t[66];let H;t[67]!==V||t[68]!==N?(H=(0,X.jsxs)(`footer`,{className:`min-w-0 border-t bg-muted/20 px-4 py-3`,children:[N,V]}),t[67]=V,t[68]=N,t[69]=H):H=t[69];let U;return t[70]!==o||t[71]!==D||t[72]!==H||t[73]!==M?(U=(0,X.jsxs)(gt,{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`,...D,children:[O,M,H]}),t[70]=o,t[71]=D,t[72]=H,t[73]=M,t[74]=U):U=t[74],U};function $r(e){let t=(0,Z.c)(5),{openPrompt:n,closeModal:r}=_t(),{sendCopy:i}=We(),a;return t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==e?(a=()=>{if(!e)return null;let t=Dt.guessDeliminator(e),a=Et.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(Et.dirname(e),n);i({source:e,destination:a}).then(()=>{r(),Tt({title:`Notebook copied`,description:`A copy of the notebook has been created.`}),Jt(a)})}})},t[0]=r,t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}var ei=new A,ti=e=>ei.isSupported(e)?`markdown`:`code`,ni=()=>{let e=(0,Z.c)(3),{updateCellConfig:t}=l(),{saveCellConfig:n}=We(),r;return e[0]!==n||e[1]!==t?(r=async(e,r)=>{let i=w(),a={};for(let t of i.cellIds.inOrderIds){let n=i.cellData[t];n!==void 0&&n.config.hide_code!==e&&ti(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},ri=e=>{e?.preventDefault(),e?.stopPropagation()};function ii(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,f=Lt(),{openModal:v,closeModal:y}=_t(),{toggleApplication:b}=c(),{selectedPanel:S}=ee(),[C]=t(oe),T=r(se),D=ni(),[O]=B(),te=r(g),A=r(re),{updateCellConfig:P,undoDeleteCell:I,clearAllCellOutputs:L,addSetupCellIfDoesntExist:R,collapseAllCells:z,expandAllCells:W}=l(),ie=Nt(),K=Mt(),q=$r(f),ce=a(In),le=a(H),{handleClick:ue}=U(),de=a(V),fe=a(er),{readCode:ge,saveCellConfig:_e}=We(),ve=d(`database`),ye=d(`storage`),be=F(),xe=r(_),Se=r(j),Ce=r(u),{selectedLayout:we}=me(),{setLayoutView:Te}=he(),Ee=Fn(),De=O.sharing?.html??!0,Oe=O.sharing?.wasm??!0,ke=O.sharing?.molab??!0,Ae=we===`slides`,Me;if(n[2]!==be||n[3]!==R||n[4]!==A||n[5]!==Se||n[6]!==te||n[7]!==L||n[8]!==y||n[9]!==z||n[10]!==q||n[11]!==ve||n[12]!==ye||n[13]!==W||n[14]!==o||n[15]!==f||n[16]!==xe||n[17]!==Ae||n[18]!==T||n[19]!==v||n[20]!==ue||n[21]!==ge||n[22]!==ie||n[23]!==K||n[24]!==_e||n[25]!==we||n[26]!==S||n[27]!==D||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]!==b||n[37]!==Ee||n[38]!==I||n[39]!==Ce||n[40]!==P||n[41]!==C.mode){let e=[`db`,`sql`,...Ut],t=[`bucket`,`object storage`,...Gt],r=yi,i=(e,t)=>{t&&fe(e=>Zn(e,t)),v((0,X.jsx)(Qr,{initialFormat:e,onClose:y,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:ri,dropdown:[{icon:(0,X.jsx)(Xe,{size:14,strokeWidth:1.5}),label:`Download as HTML`,handle:()=>i(`html`,{html:{includeCode:!0}})},{icon:(0,X.jsx)(Xe,{size:14,strokeWidth:1.5}),label:`Download as HTML (exclude code)`,handle:()=>i(`html`,{html:{includeCode:!1}})},{icon:(0,X.jsx)(Rt,{strokeWidth:1.5,style:{width:14,height:14}}),label:`Download as Markdown`,handle:()=>i(`markdown`)},{icon:(0,X.jsx)(ln,{size:14,strokeWidth:1.5}),label:`Download as ipynb`,handle:()=>i(`ipynb`)},{icon:(0,X.jsx)($e,{size:14,strokeWidth:1.5}),label:`Download notebook source`,handle:()=>i(`script`,{script:{type:`source`}})},{icon:(0,X.jsx)($e,{size:14,strokeWidth:1.5}),label:`Download flat script`,handle:()=>i(`script`,{script:{type:`flat`}})},{divider:!0,icon:(0,X.jsx)(ft,{size:14,strokeWidth:1.5}),label:`Download as PNG`,handle:()=>i(`png`)},Ae?{divider:!0,icon:(0,X.jsx)(rt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:ri,dropdown:[{icon:(0,X.jsx)(rt,{size:14,strokeWidth:1.5}),label:`Document Layout`,handle:()=>i(`pdf`,{pdf:{preset:`document`}})},{icon:(0,X.jsx)(rt,{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)(rt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:()=>i(`pdf`,{pdf:{preset:`document`}})}]},{icon:(0,X.jsx)(h,{size:14,strokeWidth:1.5}),label:`Pair with an agent`,hidden:J(),handle:async()=>{v((0,X.jsx)(Ht,{onClose:y}))}},{icon:(0,X.jsx)(fn,{size:14,strokeWidth:1.5}),label:`Share`,handle:ri,hidden:!De&&!Oe&&!ke,dropdown:[{icon:(0,X.jsx)(it,{size:14,strokeWidth:1.5}),label:`Publish HTML to web`,hidden:!De,handle:async()=>{v((0,X.jsx)(jn,{onClose:y}))}},{icon:(0,X.jsx)(yt,{size:14,strokeWidth:1.5}),label:`Create WebAssembly link`,hidden:!Oe,handle:async()=>{let e=await ge(),t=Pt({code:e.contents});await At(t),Tt({title:`Copied`,description:`Link copied to clipboard.`})}},{icon:(0,X.jsx)(qt,{size:14,strokeWidth:1.5}),label:`Create molab notebook`,hidden:!ke,handle:async()=>{let e=await ge(),t=Pt({code:e.contents,baseUrl:`${G.molab}/new`});window.open(t,`_blank`)}}]},{icon:(0,X.jsx)(un,{size:14,strokeWidth:1.5}),label:`Helper panel`,redundant:!0,handle:ri,dropdown:N.flatMap(e=>{let t=e.type===`ai`&&!A;if(k({panel:e,capabilities:te,aiEnabled:A})&&!t)return[];let{type:n,Icon:i,additionalKeywords:a}=e;return{label:Ue.startCase(n),rightElement:r(S===n),icon:(0,X.jsx)(i,{size:14,strokeWidth:1.5}),handle:()=>{if(t){ue(`ai`,`ai-features`);return}b(n)},additionalKeywords:a}})},{icon:(0,X.jsx)(dn,{size:14,strokeWidth:1.5}),label:`Present as`,handle:ri,dropdown:[{icon:C.mode===`present`?(0,X.jsx)(p,{size:14,strokeWidth:1.5}):(0,X.jsx)(Ge,{size:14,strokeWidth:1.5}),label:`Toggle app view`,hotkey:`global.hideCode`,handle:()=>{Ee()}},...pe.map((e,t)=>{let n=zn(e);return{divider:t===0,label:Bn(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)(Ze,{size:14})}),handle:()=>{Te(e),C.mode===`edit`&&Ee()}}})]},{icon:(0,X.jsx)(on,{size:14,strokeWidth:1.5}),label:`Duplicate notebook`,hidden:!f||J(),handle:q},{icon:(0,X.jsx)(en,{size:14,strokeWidth:1.5}),label:`Copy code to clipboard`,hidden:!f,handle:async()=>{let e=await ge();await At(e.contents),Tt({title:`Copied`,description:`Code copied to clipboard.`})}},{icon:(0,X.jsx)(Qe,{size:14,strokeWidth:1.5}),label:`Enable all cells`,hidden:!xe||T,handle:async()=>{let e=w(),t=m(e),n=ae.fromEntries(t.map(vi));await _e({configs:n});for(let e of t)P({cellId:e,config:{disabled:!1}})}},{divider:!0,icon:(0,X.jsx)(rn,{size:14,strokeWidth:1.5}),label:`Add setup cell`,handle:()=>{R({})}},{icon:(0,X.jsx)(M,{size:14,strokeWidth:1.5}),label:`Add database connection`,additionalKeywords:e,handle:()=>{v((0,X.jsx)(Wt,{onClose:y}))},dropdown:ve.length===0?void 0:[...ve.map(e=>({icon:(0,X.jsx)(h,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>be(e)})),{divider:!0,icon:(0,X.jsx)(M,{size:14,strokeWidth:1.5}),label:`Browse all connections`,additionalKeywords:e,handle:()=>{v((0,X.jsx)(Wt,{onClose:y}))}}]},{icon:(0,X.jsx)(ct,{size:14,strokeWidth:1.5}),label:`Add remote storage`,additionalKeywords:t,handle:()=>{v((0,X.jsx)(Wt,{defaultTab:`storage`,onClose:y}))},dropdown:ye.length===0?void 0:[...ye.map(e=>({icon:(0,X.jsx)(h,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>be(e)})),{divider:!0,icon:(0,X.jsx)(ct,{size:14,strokeWidth:1.5}),label:`Browse all connections`,additionalKeywords:t,handle:()=>{v((0,X.jsx)(Wt,{defaultTab:`storage`,onClose:y}))}}]},{icon:(0,X.jsx)(mn,{size:14,strokeWidth:1.5}),label:Ce,hidden:!Se||T,handle:()=>{I()}},{icon:(0,X.jsx)(pn,{size:14,strokeWidth:1.5}),label:`Restart kernel`,variant:`danger`,handle:ie,additionalKeywords:[`reset`,`reload`,`restart`]},{icon:(0,X.jsx)(an,{size:14,strokeWidth:1.5}),label:`Re-run all cells`,redundant:!0,hotkey:`global.runAll`,handle:async()=>{K()}},{icon:(0,X.jsx)(E,{size:14,strokeWidth:1.5}),label:`Clear all outputs`,redundant:!0,handle:()=>{L()}},{icon:(0,X.jsx)(x,{size:14,strokeWidth:1.5}),label:`Show all code`,hotkey:`global.showAllCode`,handle:()=>D(!1,`code`),redundant:!0},{icon:(0,X.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Hide all code`,hotkey:`global.hideAllCode`,handle:()=>D(!0,`code`),redundant:!0},{icon:(0,X.jsx)(x,{size:14,strokeWidth:1.5}),label:`Show all markdown code`,hotkey:`global.showAllMarkdownCode`,handle:()=>D(!1,`markdown`),redundant:!0},{icon:(0,X.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Hide all markdown code`,hotkey:`global.hideAllMarkdownCode`,handle:()=>D(!0,`markdown`),redundant:!0},{icon:(0,X.jsx)($t,{size:14,strokeWidth:1.5}),label:`Collapse all sections`,hotkey:`global.collapseAllSections`,handle:z,redundant:!0},{icon:(0,X.jsx)(Qt,{size:14,strokeWidth:1.5}),label:`Expand all sections`,hotkey:`global.expandAllSections`,handle:W,redundant:!0},{divider:!0,icon:(0,X.jsx)(nn,{size:14,strokeWidth:1.5}),label:`Command palette`,hotkey:`global.commandPalette`,handle:()=>ce(_i)},{icon:(0,X.jsx)(Ke,{size:14,strokeWidth:1.5}),label:`Keyboard shortcuts`,hotkey:`global.showHelp`,handle:()=>de(gi)},{icon:(0,X.jsx)(St,{size:14,strokeWidth:1.5}),label:`User settings`,handle:()=>le(hi),redundant:!0,additionalKeywords:[`preferences`,`options`,`configuration`]},{icon:(0,X.jsx)(cn,{size:14,strokeWidth:1.5}),label:`Report an issue`,additionalKeywords:[`feedback`,`bug`,`issue`,`report`,`diagnostics`],handle:()=>v((0,X.jsx)(Dn,{onClose:y}))},{icon:(0,X.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Resources`,handle:ri,dropdown:[{icon:(0,X.jsx)(ne,{size:14,strokeWidth:1.5}),label:`Documentation`,handle:mi},{icon:(0,X.jsx)(Kt,{className:`h-3.5 w-3.5`}),label:`GitHub`,handle:pi},{icon:(0,X.jsx)(at,{size:14,strokeWidth:1.5}),label:`Discord Community`,handle:fi},{icon:(0,X.jsx)(st,{className:`h-3.5 w-3.5`}),label:`YouTube`,handle:di},{icon:(0,X.jsx)(s,{size:14,strokeWidth:1.5}),label:`Changelog`,handle:ui}]},{divider:!0,icon:(0,X.jsx)(lt,{size:14,strokeWidth:1.5}),label:`Open home`,hidden:!location.search.includes(`file`),handle:li},{icon:(0,X.jsx)(qt,{size:14,strokeWidth:1.5}),label:`New notebook`,hidden:!location.search.includes(`file`),handle:ci}].filter(si).map(ai),n[2]=be,n[3]=R,n[4]=A,n[5]=Se,n[6]=te,n[7]=L,n[8]=y,n[9]=z,n[10]=q,n[11]=ve,n[12]=ye,n[13]=W,n[14]=o,n[15]=f,n[16]=xe,n[17]=Ae,n[18]=T,n[19]=v,n[20]=ue,n[21]=ge,n[22]=ie,n[23]=K,n[24]=_e,n[25]=we,n[26]=S,n[27]=D,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]=b,n[37]=Ee,n[38]=I,n[39]=Ce,n[40]=P,n[41]=C.mode,n[42]=Me}else Me=n[42];return Me}function ai(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(oi)}:e}function oi(e){return!e.hidden}function si(e){return!e.hidden}function ci(){let e=Ot();window.open(e,`_blank`)}function li(){let e=document.baseURI.split(`?`)[0];window.open(e,`_blank`,`noopener`)}function ui(){window.open(G.releasesPage,`_blank`)}function di(){window.open(G.youtube,`_blank`)}function fi(){window.open(G.discordLink,`_blank`)}function pi(){window.open(G.githubPage,`_blank`)}function mi(){window.open(G.docsPage,`_blank`)}function hi(e){return!e}function gi(e){return!e}function _i(e){return!e}function vi(e){return[e,{disabled:!1}]}function yi(e){return(0,X.jsx)(`div`,{className:`w-8 flex justify-end`,children:e&&(0,X.jsx)(Ze,{size:14})})}export{Fn as a,mn as c,nn as d,tn as f,In as i,cn as l,ni as n,En as o,en as p,Ln as r,hn as s,ii as t,rn as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,t,u as n}from"./useEvent-xfs0Sn4r.js";import{D as r,Ka as i,h as a,ui as o,vt as s,za as c}from"./cells-BBhW3FXj.js";import{t as l}from"./compiler-runtime-CYIjoINj.js";import{g as u}from"./useEventListener-92uWqz-P.js";import{o as d}from"./dist-DiYjQAhI.js";import{r as f}from"./requests-C6_IaFh7.js";var p=l(),m=e(!1);function h(){let e=(0,p.c)(2),n=v(),r;return e[0]===n?r=e[1]:(r=()=>n(i(a())),e[0]=n,e[1]=r),t(r)}function g(e){let n=(0,p.c)(3),r=v(),i;return n[0]!==e||n[1]!==r?(i=()=>{e!==void 0&&r([e])},n[0]=e,n[1]=r,n[2]=i):i=n[2],t(i)}function _(){let e=(0,p.c)(2),n=v(),r;return e[0]===n?r=e[1]:(r=()=>n(c(a())),e[0]=n,e[1]=r),t(r)}function v(){let e=(0,p.c)(4),{prepareForRun:i}=r(),{sendRun:o}=f(),s=n(m),c;return e[0]!==i||e[1]!==o||e[2]!==s?(c=async e=>{if(e.length===0)return;let t=a();return s(!0),y({cellIds:e,sendRun:o,prepareForRun:i,notebook:t})},e[0]=i,e[1]=o,e[2]=s,e[3]=c):c=e[3],t(c)}async function y({cellIds:e,sendRun:t,prepareForRun:n,notebook:r}){if(e.length===0)return;let{cellHandles:i,cellData:a}=r,c=[];for(let t of e){let e=i[t]?.current?.editorView,r;e?(o(e)!==`markdown`&&d(e),r=s(e)):r=a[t]?.code||``,c.push(r),n({cellId:t})}await t({cellIds:e,codes:c}).catch(e=>{u.error(e)})}export{v as a,g as i,y as n,h as o,_ as r,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./useEvent-xfs0Sn4r.js";import{D as t,
|
|
1
|
+
import{t as e}from"./useEvent-xfs0Sn4r.js";import{D as t,f as n,vt as r}from"./cells-BBhW3FXj.js";import{t as i}from"./compiler-runtime-CYIjoINj.js";import{t as a}from"./jsx-runtime-B74pBk57.js";import{r as o}from"./useDeleteCell-DwaN6KAw.js";import{t as s}from"./use-toast-DpWHUGuF.js";var c=i(),l=a();function u(){let i=(0,c.c)(3),{splitCell:a,undoSplitCell:u}=t(),d;return i[0]!==a||i[1]!==u?(d=e=>{let t=n(e.cellId);if(!t)return;let i=r(t);a(e);let{dismiss:c}=s({title:`Cell split`,action:(0,l.jsx)(o,{"data-testid":`undo-split-button`,size:`sm`,variant:`outline`,onClick:()=>{u({...e,snapshot:i}),d()},children:`Undo`})}),d=c},i[0]=a,i[1]=u,i[2]=d):d=i[2],e(d)}export{u as t};
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-C5h1aWhw.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">
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
<link rel="modulepreload" crossorigin href="./assets/useTheme-C-ri8BtY.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-Buhk-UgR.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/purify.es-DrVcFY1Q.js">
|
|
141
|
-
<link rel="modulepreload" crossorigin href="./assets/cells-
|
|
141
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-BBhW3FXj.js">
|
|
142
142
|
<link rel="modulepreload" crossorigin href="./assets/get-DjNf4SIX.js">
|
|
143
143
|
<link rel="modulepreload" crossorigin href="./assets/_hasPath-BmRQipI0.js">
|
|
144
144
|
<link rel="modulepreload" crossorigin href="./assets/hasIn-yw4sIeJR.js">
|
|
@@ -151,42 +151,42 @@
|
|
|
151
151
|
<link rel="modulepreload" crossorigin href="./assets/copy-DlEomWzI.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/extends-CvVTau-c.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/esm-BHMOvJzM.js">
|
|
154
|
-
<link rel="modulepreload" crossorigin href="./assets/useAddCell-
|
|
155
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
154
|
+
<link rel="modulepreload" crossorigin href="./assets/useAddCell-BR8kYnb6.js">
|
|
155
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-CAYyabaV.js">
|
|
156
156
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-LboTfNDv.js">
|
|
157
157
|
<link rel="modulepreload" crossorigin href="./assets/micromark-factory-space-D9Dr-k4J.js">
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-CRg4xQWg.js">
|
|
159
|
-
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-
|
|
159
|
+
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-751VNlrQ.js">
|
|
160
160
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-z8fuTE3w.js">
|
|
161
|
-
<link rel="modulepreload" crossorigin href="./assets/useRunCells-
|
|
162
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
163
|
-
<link rel="modulepreload" crossorigin href="./assets/blob-
|
|
164
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
161
|
+
<link rel="modulepreload" crossorigin href="./assets/useRunCells-BMQuitYY.js">
|
|
162
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-DnPB4qpJ.js">
|
|
163
|
+
<link rel="modulepreload" crossorigin href="./assets/blob-BrVH7IJp.js">
|
|
164
|
+
<link rel="modulepreload" crossorigin href="./assets/kbd-Cwh96ZBE.js">
|
|
165
|
+
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-IUt497GC.js">
|
|
166
|
+
<link rel="modulepreload" crossorigin href="./assets/share-BZW3tzEX.js">
|
|
165
167
|
<link rel="modulepreload" crossorigin href="./assets/events-CbeVJ6OD.js">
|
|
166
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
168
|
+
<link rel="modulepreload" crossorigin href="./assets/state-DQHafeTV.js">
|
|
167
169
|
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-CDVGFYfr.js">
|
|
168
170
|
<link rel="modulepreload" crossorigin href="./assets/config-B-r81uZ6.js">
|
|
169
171
|
<link rel="modulepreload" crossorigin href="./assets/tabs-Cy1qXLzH.js">
|
|
170
172
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-CKA5zVsM.js">
|
|
171
173
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-C40jM9o4.js">
|
|
172
174
|
<link rel="modulepreload" crossorigin href="./assets/html-to-image-D6GUC5q6.js">
|
|
173
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
175
|
+
<link rel="modulepreload" crossorigin href="./assets/download-BgO9EN-W.js">
|
|
174
176
|
<link rel="modulepreload" crossorigin href="./assets/table-CUK1W5bI.js">
|
|
175
177
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-Bf-rx_aV.js">
|
|
176
|
-
<link rel="modulepreload" crossorigin href="./assets/tree-actions-
|
|
178
|
+
<link rel="modulepreload" crossorigin href="./assets/tree-actions-mfuAcK1x.js">
|
|
177
179
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-Dfik_tuW.js">
|
|
178
180
|
<link rel="modulepreload" crossorigin href="./assets/external-link-Bp3BxyRA.js">
|
|
179
181
|
<link rel="modulepreload" crossorigin href="./assets/spinner-Ck-Hgfvj.js">
|
|
180
182
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-BQB1AIAg.js">
|
|
181
183
|
<link rel="modulepreload" crossorigin href="./assets/hat-glasses-C8LSY3HT.js">
|
|
182
184
|
<link rel="modulepreload" crossorigin href="./assets/package-DPlscLzt.js">
|
|
183
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
184
|
-
<link rel="modulepreload" crossorigin href="./assets/kbd-Cwh96ZBE.js">
|
|
185
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-B3qF2oaW.js">
|
|
185
186
|
<link rel="modulepreload" crossorigin href="./assets/alert-dmKwNsrp.js">
|
|
186
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
187
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
188
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
189
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-DqpoYOvw.js">
|
|
187
|
+
<link rel="modulepreload" crossorigin href="./assets/state-DOrY1Jyf.js">
|
|
188
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-CbHXmrt8.js">
|
|
189
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-BlmIJ9WY.js">
|
|
190
190
|
<link rel="modulepreload" crossorigin href="./assets/VisuallyHidden-CBMDmozt.js">
|
|
191
191
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-BiqAQ-zI.js">
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/en-US-yTIMUO13.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-
|
|
208
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-D2ZWLZs4.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">
|
|
@@ -216,12 +216,12 @@
|
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/file-headphone-rFCxFRI8.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/file-DF8n85RA.js">
|
|
218
218
|
<link rel="modulepreload" crossorigin href="./assets/image-ab13yGv4.js">
|
|
219
|
-
<link rel="modulepreload" crossorigin href="./assets/file-icons-
|
|
219
|
+
<link rel="modulepreload" crossorigin href="./assets/file-icons-BhotQqrU.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/globe-BQf75qV_.js">
|
|
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-
|
|
224
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-Coa5PyHk.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">
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/icons-CjLa9BiH.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-CLytDdMl.js">
|
|
233
233
|
<link rel="modulepreload" crossorigin href="./assets/pathUtils-Cryrlpma.js">
|
|
234
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
234
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-Cmk3XDJi.js">
|
|
235
235
|
<link rel="stylesheet" crossorigin href="./assets/cells-D-c15Ks-.css">
|
|
236
236
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-B7zTpxjS.css">
|
|
237
237
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-BQtz7-np.css">
|
package/package.json
CHANGED
|
@@ -136,8 +136,13 @@ export const MockRequestClient = {
|
|
|
136
136
|
updateCellOutputs: vi.fn().mockResolvedValue({}),
|
|
137
137
|
addPackage: vi.fn().mockResolvedValue({}),
|
|
138
138
|
removePackage: vi.fn().mockResolvedValue({}),
|
|
139
|
-
getPackageList: vi.fn().mockResolvedValue({
|
|
140
|
-
|
|
139
|
+
getPackageList: vi.fn().mockResolvedValue({
|
|
140
|
+
packages: [],
|
|
141
|
+
}),
|
|
142
|
+
getDependencyTree: vi.fn().mockResolvedValue({
|
|
143
|
+
tree: null,
|
|
144
|
+
context: { kind: "package-manager", name: "pip" },
|
|
145
|
+
}),
|
|
141
146
|
listSecretKeys: vi.fn().mockResolvedValue({ keys: [] }),
|
|
142
147
|
writeSecret: vi.fn().mockResolvedValue({}),
|
|
143
148
|
invokeAiTool: vi.fn().mockResolvedValue({}),
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
4
|
+
import { Provider } from "jotai";
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { MockRequestClient } from "@/__mocks__/requests";
|
|
7
|
+
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
8
|
+
import { requestClientAtom } from "@/core/network/requests";
|
|
9
|
+
import type {
|
|
10
|
+
DependencyTreeNode,
|
|
11
|
+
DependencyTreeResponse,
|
|
12
|
+
} from "@/core/network/types";
|
|
13
|
+
import { store } from "@/core/state/jotai";
|
|
14
|
+
import PackagesPanel from "../packages-panel";
|
|
15
|
+
|
|
16
|
+
const { openSettings } = vi.hoisted(() => ({
|
|
17
|
+
openSettings: vi.fn(),
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
vi.mock("@/components/app-config/state", () => ({
|
|
21
|
+
useOpenSettingsToTab: () => ({ handleClick: openSettings }),
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
const emptyTree: DependencyTreeNode = {
|
|
25
|
+
name: "<root>",
|
|
26
|
+
version: null,
|
|
27
|
+
tags: [],
|
|
28
|
+
dependencies: [],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const populatedTree: DependencyTreeNode = {
|
|
32
|
+
...emptyTree,
|
|
33
|
+
dependencies: [
|
|
34
|
+
{
|
|
35
|
+
name: "polars",
|
|
36
|
+
version: "1.44.1",
|
|
37
|
+
tags: [],
|
|
38
|
+
dependencies: [
|
|
39
|
+
{
|
|
40
|
+
name: "numpy",
|
|
41
|
+
version: "2.5.2",
|
|
42
|
+
tags: [{ kind: "dedupe", value: "true" }],
|
|
43
|
+
dependencies: [],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
function renderPanel(
|
|
51
|
+
context: DependencyTreeResponse["context"],
|
|
52
|
+
tree: DependencyTreeNode = emptyTree,
|
|
53
|
+
) {
|
|
54
|
+
const getPackageList = vi.fn().mockResolvedValue({ packages: [] });
|
|
55
|
+
store.set(
|
|
56
|
+
requestClientAtom,
|
|
57
|
+
MockRequestClient.create({
|
|
58
|
+
getPackageList,
|
|
59
|
+
getDependencyTree: vi.fn().mockResolvedValue({ tree, context }),
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
getPackageList,
|
|
65
|
+
...render(
|
|
66
|
+
<Provider store={store}>
|
|
67
|
+
<TooltipProvider>
|
|
68
|
+
<PackagesPanel />
|
|
69
|
+
</TooltipProvider>
|
|
70
|
+
</Provider>,
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe("PackagesPanel", () => {
|
|
76
|
+
beforeEach(() => {
|
|
77
|
+
vi.clearAllMocks();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it.each(["pixi", "uv"] as const)(
|
|
81
|
+
"shows the effective %s sandbox backend as a fixed context",
|
|
82
|
+
async (backend) => {
|
|
83
|
+
const { getPackageList } = renderPanel({ kind: "sandbox", backend });
|
|
84
|
+
|
|
85
|
+
expect(
|
|
86
|
+
await screen.findByPlaceholderText(
|
|
87
|
+
`Add packages to ${backend} sandbox...`,
|
|
88
|
+
),
|
|
89
|
+
).toBeInTheDocument();
|
|
90
|
+
expect(screen.getByText(`${backend} sandbox`)).toBeInTheDocument();
|
|
91
|
+
expect(
|
|
92
|
+
screen.queryByRole("button", { name: "Change package manager" }),
|
|
93
|
+
).not.toBeInTheDocument();
|
|
94
|
+
expect(
|
|
95
|
+
screen.queryByRole("button", { name: "List" }),
|
|
96
|
+
).not.toBeInTheDocument();
|
|
97
|
+
expect(
|
|
98
|
+
screen.queryByRole("button", { name: "Tree" }),
|
|
99
|
+
).not.toBeInTheDocument();
|
|
100
|
+
expect(getPackageList).not.toHaveBeenCalled();
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
it("explains the filtered empty state for a Pixi sandbox", async () => {
|
|
105
|
+
renderPanel({ kind: "sandbox", backend: "pixi" });
|
|
106
|
+
|
|
107
|
+
expect(await screen.findByText("No PyPI dependencies")).toBeInTheDocument();
|
|
108
|
+
expect(
|
|
109
|
+
screen.getByText("Conda dependencies are not shown in this panel."),
|
|
110
|
+
).toBeInTheDocument();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("labels a dependency whose subtree was already displayed", async () => {
|
|
114
|
+
renderPanel({ kind: "sandbox", backend: "pixi" }, populatedTree);
|
|
115
|
+
|
|
116
|
+
fireEvent.click(await screen.findByRole("treeitem", { name: /polars/ }));
|
|
117
|
+
|
|
118
|
+
expect(screen.getByText("already in tree")).toBeInTheDocument();
|
|
119
|
+
expect(screen.queryByText("cycle")).not.toBeInTheDocument();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("keeps the configured package manager changeable outside a sandbox", async () => {
|
|
123
|
+
const { getPackageList } = renderPanel({
|
|
124
|
+
kind: "package-manager",
|
|
125
|
+
name: "pip",
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
expect(
|
|
129
|
+
await screen.findByPlaceholderText("Install packages with pip..."),
|
|
130
|
+
).toBeInTheDocument();
|
|
131
|
+
const changeManager = screen.getByRole("button", {
|
|
132
|
+
name: "Change package manager",
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
fireEvent.click(changeManager);
|
|
136
|
+
|
|
137
|
+
expect(openSettings).toHaveBeenCalledWith("packageManagementAndData");
|
|
138
|
+
expect(screen.getByText("environment")).toBeInTheDocument();
|
|
139
|
+
expect(screen.getByRole("button", { name: "List" })).toBeInTheDocument();
|
|
140
|
+
expect(screen.getByRole("button", { name: "Tree" })).toBeInTheDocument();
|
|
141
|
+
expect(getPackageList).toHaveBeenCalledOnce();
|
|
142
|
+
});
|
|
143
|
+
});
|