@marimo-team/frontend 0.24.1-dev67 → 0.24.1-dev68
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-BWCtP3qQ.js → CellStatus-Bfn_Ysig.js} +1 -1
- package/dist/assets/JsonOutput-DbggWGpx.js +50 -0
- package/dist/assets/{MarimoErrorOutput-ZJ6XQKr0.js → MarimoErrorOutput-CQSjUfZF.js} +2 -2
- package/dist/assets/{RenderHTML-B2NEp3vg.js → RenderHTML-Di-OdQjY.js} +1 -1
- package/dist/assets/{RunButton-L0fRxWhe.js → RunButton-r21rSvYz.js} +1 -1
- package/dist/assets/{add-cell-with-ai-6sxiY1Qo.js → add-cell-with-ai-BC7x_dY9.js} +17 -17
- package/dist/assets/{add-connection-dialog-BKzXoKZ7.js → add-connection-dialog-Bce8iA2c.js} +3 -3
- package/dist/assets/{agent-panel-DLDrzioR.js → agent-panel-C0p-gnTV.js} +3 -3
- package/dist/assets/{ai-model-dropdown-C6a5WwzK.js → ai-model-dropdown-D7nJTvh4.js} +2 -2
- package/dist/assets/{app-config-button-CGcz18YO.js → app-config-button-C0IsSBiP.js} +1 -1
- package/dist/assets/{blob-D0bOT_Rc.js → blob-CoNcP6Xv.js} +1 -1
- package/dist/assets/cell-editor-BydF2GRM.js +21 -0
- package/dist/assets/{cell-link-BqUCel0u.js → cell-link-Z8JrraTv.js} +1 -1
- package/dist/assets/{cells-CWhmlx33.js → cells-CD9Jbpoa.js} +47 -47
- package/dist/assets/{chat-display-hii8QeG4.js → chat-display-N4S1Zb7o.js} +1 -1
- package/dist/assets/{chat-panel-DayIrT-i.js → chat-panel-1kGOrgeB.js} +1 -1
- package/dist/assets/{chat-ui-BqpUPlJ1.js → chat-ui-DCeuQxLd.js} +1 -1
- package/dist/assets/{column-preview-Cya1--h1.js → column-preview-BjbhARJS.js} +1 -1
- package/dist/assets/{command-palette-DJBJACGv.js → command-palette-CcK9Jbe4.js} +1 -1
- package/dist/assets/{common-B5rT3jZs.js → common-Bb2s_Imb.js} +1 -1
- package/dist/assets/{components-CvZ-6CVz.js → components-D5125bx8.js} +1 -1
- package/dist/assets/{datasource-BhCWw0_C.js → datasource-DTtEQWz7.js} +2 -2
- package/dist/assets/{dependency-graph-panel-DueUeSqZ.js → dependency-graph-panel-DiMc1DOt.js} +4 -4
- package/dist/assets/{documentation-panel-BecxeHyy.js → documentation-panel-ChEa8OHk.js} +1 -1
- package/dist/assets/{download-DUFyna0J.js → download-BKMVrvLm.js} +1 -1
- package/dist/assets/{edit-page-C2RLzDPf.js → edit-page-lHmhni_I.js} +6 -6
- package/dist/assets/{error-entries-BcjSsPlF.js → error-entries-DI864MPn.js} +1 -1
- package/dist/assets/{error-panel-DV40UknQ.js → error-panel-BfIYO7rp.js} +1 -1
- package/dist/assets/{file-explorer-panel-sk8Cp5Qc.js → file-explorer-panel-DEEbRIPG.js} +1 -1
- package/dist/assets/{file-icons-DuifYpwL.js → file-icons-CmmWEUGv.js} +1 -1
- package/dist/assets/{file-name-input-itW22sME.js → file-name-input-9sqInamo.js} +1 -1
- package/dist/assets/{floating-outline-CnooYKtT.js → floating-outline-BxMKEygY.js} +1 -1
- package/dist/assets/{home-page-DXqlCga0.js → home-page-G9DBo7dA.js} +1 -1
- package/dist/assets/index-92CZ7TtR.js +29 -0
- package/dist/assets/{layout-uW1Q3GLe.js → layout-ChLz9pEr.js} +5 -5
- package/dist/assets/{logs-panel-D_fd3qTo.js → logs-panel-DaLUKPBX.js} +1 -1
- package/dist/assets/{markdown-renderer-KEQXCdvc.js → markdown-renderer-Bnm85dXD.js} +1 -1
- package/dist/assets/{name-cell-input-CG5ADThI.js → name-cell-input-D0M2lddE.js} +1 -1
- package/dist/assets/{outline-panel-6jBFNPsH.js → outline-panel-UDArUDGw.js} +1 -1
- package/dist/assets/{packages-panel-CFqdSgRx.js → packages-panel-DYReU_PY.js} +1 -1
- package/dist/assets/panel-accordion-state-COnGLerF.js +1 -0
- package/dist/assets/panels-CXwc78ca.js +4 -0
- package/dist/assets/{process-output-cqRA_sBO.js → process-output-CUf8H__q.js} +1 -1
- package/dist/assets/{readonly-code-display-2lCZh8OV.js → readonly-code-display-Bof9MzZO.js} +1 -1
- package/dist/assets/{readonly-python-code-BGVVx228.js → readonly-python-code-GMl_IocT.js} +1 -1
- package/dist/assets/{reveal-component-B47F3y30.js → reveal-component-DST7JT-p.js} +1 -1
- package/dist/assets/run-page-Tazc0WbN.js +1 -0
- package/dist/assets/{scratchpad-panel-Da0wZ5MH.js → scratchpad-panel-lmvw64jd.js} +1 -1
- package/dist/assets/session-panel-0Osfbw8k.js +1 -0
- package/dist/assets/{skeleton-C7Qu8B6J.js → skeleton-C6rYNT3l.js} +1 -1
- package/dist/assets/{snippets-panel-p0q9pZIi.js → snippets-panel-njDHc9qT.js} +1 -1
- package/dist/assets/{state-DRoa41ur.js → state-BFemFLAq.js} +3 -3
- package/dist/assets/state-mneM4Ao8.js +1 -0
- package/dist/assets/{tracing-CwHJq7-L.js → tracing-CGZCxvWG.js} +1 -1
- package/dist/assets/{tracing-panel-CzmxtGrv.js → tracing-panel-4lmoUwoQ.js} +2 -2
- package/dist/assets/{tree-actions-BoQfkAEN.js → tree-actions-Bjyy0vFK.js} +1 -1
- package/dist/assets/{useAddCell-BNQmZTYq.js → useAddCell-h4OWLK5y.js} +1 -1
- package/dist/assets/{useCellActionButton-kd62cHep.js → useCellActionButton-BvuYvLCr.js} +1 -1
- package/dist/assets/{useDeleteCell-y9IxNAXA.js → useDeleteCell-Buwee6vZ.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-COHrXfiU.js → useDependencyPanelTab-CLR1fyXm.js} +1 -1
- package/dist/assets/useNotebookActions-gLHJWcWB.js +10 -0
- package/dist/assets/useRunCells-C6416Qeo.js +1 -0
- package/dist/assets/{useSplitCell-BQY-H_fr.js → useSplitCell-Ip3d7gP0.js} +1 -1
- package/dist/index.html +19 -19
- package/package.json +1 -1
- package/src/components/variables/__tests__/variables-table.test.tsx +110 -0
- package/src/components/variables/variables-table.tsx +2 -3
- package/src/core/cells/cells.ts +11 -0
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +48 -0
- package/src/core/codemirror/go-to-definition/utils.ts +2 -8
- package/dist/assets/JsonOutput-DWHV2eQE.js +0 -50
- package/dist/assets/cell-editor-AhmjxpbF.js +0 -21
- package/dist/assets/index-Chf7uq-1.js +0 -29
- package/dist/assets/panel-accordion-state-Bjtuw5KJ.js +0 -1
- package/dist/assets/panels-CF5ptsti.js +0 -4
- package/dist/assets/run-page-BrNnwMqh.js +0 -1
- package/dist/assets/session-panel-eEygRlFN.js +0 -1
- package/dist/assets/state-CfUWx1Rb.js +0 -1
- package/dist/assets/useNotebookActions-Ct-6_c0d.js +0 -10
- package/dist/assets/useRunCells-DpiI4EUr.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{Bi as s,Ct as c,D as l,E as u,Fa as d,It as f,Kr as p,Mo as m,Qi as h,Qr as g,Wn as _,Xi as v,Xr as y,Zi as b,Zr as x,_ as ee,_o as S,b as te,cn as C,ei as w,fo as T,h as E,ir as D,li as O,ln as k,ra as A,sa as j,t as M,ta as N,ti as P,xo as F,zi as I}from"./cells-CD9Jbpoa.js";import{Cn as L,kt as R,vt as z}from"./schemas-aTUejmFi.js";import{t as B}from"./compiler-runtime-CYIjoINj.js";import{r as ne,w as V}from"./utils-CUZQNAWJ.js";import{C as H,n as U,r as re}from"./ai-model-dropdown-D7nJTvh4.js";import{g as W,n as ie}from"./useEventListener-D27Dii_l.js";import{t as ae}from"./objects-snlMn4yk.js";import{n as G,t as K}from"./constants-BDbGiS7O.js";import{A as oe,M as se,N as q,O as ce,T as le,j as ue,k as de,v as fe}from"./config-DaNyNpZL.js";import{t as pe}from"./switch-Gl6cozkm.js";import{c as me}from"./readonly-python-code-GMl_IocT.js";import{t as J}from"./cn-ldLVeaqm.js";import{t as he}from"./jsx-runtime-B74pBk57.js";import{o as ge}from"./alert-dialog-BVi_GyOB.js";import{i as _e,n as ve,r as ye,t as be}from"./tabs-c6mpccpH.js";import{a as xe,c as Se,i as Ce,n as we,r as Te,s as Ee,t as De}from"./select-czJLm6jf.js";import{Pt as Oe,X as ke}from"./JsonOutput-DbggWGpx.js";import{a as Ae,c as Y,o as je,p as Me,t as Ne}from"./download-BKMVrvLm.js";import{t as Pe}from"./tooltip-D7dq6bnc.js";import{n as Fe,r as Ie,t as Le}from"./button-Btj6GXNy.js";import{i as Re,r as ze,t as Be}from"./strings-CpYReX2Q.js";import{r as Ve}from"./requests-C6_IaFh7.js";import{t as X}from"./createLucideIcon-B7HeEoG2.js";import{F as He,I as Ue,L as We,P as Ge,a as Ke,i as qe,u as Je}from"./layout-ChLz9pEr.js";import{t as Ye}from"./check-BoA6XBpj.js";import{r as Xe}from"./useCellActionButton-BvuYvLCr.js";import{t as Ze}from"./code-CF0HKE9K.js";import{t as Qe}from"./copy-BMXKNElG.js";import{t as $e}from"./eye-off-CFuPxa9F.js";import{t as et}from"./external-link-Bp3BxyRA.js";import{t as tt}from"./file-DF8n85RA.js";import{t as nt}from"./globe-BQf75qV_.js";import{n as rt,r as it,t as at}from"./youtube-DCJ-ihUU.js";import{n as ot}from"./components-ib4asSo7.js";import{i as st,n as ct,r as lt}from"./markdown-export-0rLbaq8b.js";import{t as ut}from"./image-ab13yGv4.js";import{D as dt,E as ft,O as pt,T as mt,b as ht,j as gt}from"./write-secret-modal-lNU_7c2x.js";import{t as _t}from"./link-Cap-MZiw.js";import{t as vt}from"./spinner-Ck-Hgfvj.js";import{r as yt}from"./input-Daz6sk8l.js";import{t as bt}from"./settings-C-cYas75.js";import{t as xt}from"./square-B58Ib8Ir.js";import{t as St}from"./triangle-alert-MihykDYG.js";import{t as Ct}from"./use-toast-DpWHUGuF.js";import{n as wt,t as Tt}from"./paths-zcL04qUW.js";import{o as Et}from"./session-CEdta5_Q.js";import{n as Dt}from"./useAsyncData-Buhk-UgR.js";import{n as Ot}from"./copy-Cg05mM3C.js";import{t as kt}from"./copy-icon-CRxVZTJ9.js";import{r as At}from"./useRunCells-C6416Qeo.js";import{r as jt,t as Mt}from"./share-C2MPy_VX.js";import{n as Nt,t as Pt}from"./alert-dmKwNsrp.js";import{a as Ft}from"./cell-link-Z8JrraTv.js";import{t as It}from"./icons-CjLa9BiH.js";import{i as Lt,n as Rt}from"./error-entries-DI864MPn.js";import{n as zt,t as Bt}from"./pair-with-agent-modal-Gg8MZHWW.js";import{n as Vt}from"./add-connection-dialog-Bce8iA2c.js";import{t as Ht}from"./github-YRgb6LMu.js";import{n as Ut}from"./marimo-icons-C3KxMV9A.js";import{t as Wt}from"./links-DPh7yoP-.js";import{i as Gt,n as Kt,t as qt}from"./skeleton-C6rYNT3l.js";import{t as Jt}from"./types-CoHi_MQq.js";var Yt=X(`circle-chevron-down`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 10-4 4-4-4`,key:`894hmk`}]]),Xt=X(`circle-chevron-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m10 8 4 4-4 4`,key:`1wy4r4`}]]),Zt=X(`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`}]]),Qt=X(`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`}]]),$t=X(`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`}]]),en=X(`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`}]]),tn=X(`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`}]]),nn=X(`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`}]]),rn=X(`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`}]]),an=X(`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`}]]),on=X(`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`}]]),sn=X(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),cn=X(`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`}]]),ln=X(`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`}]]),un=X(`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`}]]),dn=X(`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`}]]),Z=he(),Q=B(),$=e(o(),1);function fn(e,t){let n=(0,Q.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,$.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 pn(e,t){return{...e,Binaries:{...e.Binaries,Browser:t}}}function mn(e,t,n,r){return{marimo:e,Locale:n||void 0,Binaries:{Browser:t},"Environment Collection Error":r}}function hn(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 gn(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 _n(e,t){return[`<details>`,`<summary>${Be.htmlEscape(e)??``}</summary>`,``,t,``,`</details>`].join(`
|
|
2
|
+
`)}function vn(e){return _n(`Environment`,hn(`json`,JSON.stringify(e,null,2)))}function yn(e){return _n(`Errors`,hn(`text`,e.map(Rt).join(`
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`)))}function bn(e){return _n(`Code`,hn(`python`,e))}var xn=ie,Sn=e=>{let t=(0,Q.c)(16),{content:n}=e,[r,i]=(0,$.useState)(!1),a=!r&&`max-h-24 overflow-hidden`,o;t[0]===a?o=t[1]:(o=J(`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,Z.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,Z.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,Z.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(Tn),t[10]=u):u=t[10];let d=r?`Show less`:`Show more`,f;t[11]===d?f=t[12]:(f=(0,Z.jsx)(Le,{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,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p},Cn=e=>{let t=(0,Q.c)(6),{children:n}=e,{openModal:r,closeModal:i}=ht(),a;t[0]!==i||t[1]!==r?(a=()=>r((0,Z.jsx)(wn,{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,Z.jsx)(xn,{onClick:a,children:n}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o},wn=()=>{let e=(0,Q.c)(84),{getEnvironmentInfo:t,readCode:n}=Ve(),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=Dt(a,o),c=r(te),l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=Lt(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(S),m=r(fe),h=p!==null&&f&&m.state===le.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.`,[v,y]=fn(`marimo:issue-report:include-errors`,!1),[b,x]=fn(`marimo:issue-report:include-code`,!1),ee;e[9]!==s.data||e[10]!==s.status?(ee=s.data?pn(s.data,navigator.userAgent):s.status===`error`?mn(me(),navigator.userAgent,navigator.language,`Server environment information unavailable`):void 0,e[9]=s.data,e[10]=s.status,e[11]=ee):ee=e[11];let C=ee,w,T;e[12]!==b||e[13]!==h||e[14]!==n?(w=async()=>{if(!b||!h)return;let{contents:e}=await n();return e},T=[b,h,n],e[12]=b,e[13]=h,e[14]=n,e[15]=w,e[16]=T):(w=e[15],T=e[16]);let E=Dt(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]!==b||e[22]!==v){let n={env:vn(C)};v&&u.length>0&&(n[`bug-description`]=yn(u)),b&&E.data&&(n[`reproduction-code`]=bn(E.data)),t=gn(G.bugReportUrl,n),e[19]=E.data,e[20]=C,e[21]=b,e[22]=v,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(En).join(`, `),e[24]=k,e[25]=A);let j=A,M;e[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(gt,{children:`Report an issue`}),(0,Z.jsx)(ft,{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,Z.jsx)(et,{className:`w-4 h-4 mr-2`}),e[27]=N):N=e[27];let P;e[28]===O?P=e[29]:(P=(0,Z.jsx)(Le,{type:`button`,variant:`default`,size:`xs`,asChild:!0,className:`self-start`,children:(0,Z.jsxs)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,children:[N,`Open GitHub issue`]})}),e[28]=O,e[29]=P);let F;e[30]===y?F=e[31]:(F=e=>y(e===!0),e[30]=y,e[31]=F);let I;e[32]!==v||e[33]!==F?(I=(0,Z.jsx)(_,{id:`issue-include-errors`,checked:v,disabled:u.length===0,onCheckedChange:F,"aria-label":`Include errors`}),e[32]=v,e[33]=F,e[34]=I):I=e[34];let L;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`label`,{htmlFor:`issue-include-errors`,children:`Include errors`}),e[35]=L):L=e[35];let R;e[36]===I?R=e[37]:(R=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[I,L]}),e[36]=I,e[37]=R);let z=!h,B;e[38]===x?B=e[39]:(B=e=>x(e===!0),e[38]=x,e[39]=B);let ne;e[40]!==b||e[41]!==z||e[42]!==B?(ne=(0,Z.jsx)(_,{id:`issue-include-code`,checked:b,disabled:z,onCheckedChange:B,"aria-label":`Include notebook code`}),e[40]=b,e[41]=z,e[42]=B,e[43]=ne):ne=e[43];let V;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`label`,{htmlFor:`issue-include-code`,children:`Include notebook code`}),e[44]=V):V=e[44];let H;e[45]===ne?H=e[46]:(H=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[ne,V]}),e[45]=ne,e[46]=H);let U;e[47]===g?U=e[48]:(U=g&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground ml-6`,children:g}),e[47]=g,e[48]=U);let re;e[49]!==E.status||e[50]!==b?(re=b&&E.status===`error`&&(0,Z.jsx)(`span`,{className:`text-xs text-(--red-11) ml-6`,children:`Notebook source could not be loaded.`}),e[49]=E.status,e[50]=b,e[51]=re):re=e[51];let W;e[52]!==H||e[53]!==U||e[54]!==re?(W=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[H,U,re]}),e[52]=H,e[53]=U,e[54]=re,e[55]=W):W=e[55];let ie;e[56]!==R||e[57]!==W?(ie=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[R,W]}),e[56]=R,e[57]=W,e[58]=ie):ie=e[58];let ae;e[59]===j?ae=e[60]:(ae=j?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-(--yellow-11)`,children:[(0,Z.jsx)(St,{className:`w-3.5 h-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`span`,{children:[`Too large to prefill and left out of the link: `,j,`. Paste them into the issue manually.`]})]}):(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Your environment is always included.`}),e[59]=j,e[60]=ae);let K;e[61]!==P||e[62]!==ie||e[63]!==ae?(K=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[P,ie,ae]}),e[61]=P,e[62]=ie,e[63]=ae,e[64]=K):K=e[64];let oe;e[65]===s.status?oe=e[66]:(oe=s.status===`pending`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading environment details…`}),(0,Z.jsx)(qt,{className:`h-4 w-full`}),(0,Z.jsx)(qt,{className:`h-4 w-3/4`}),(0,Z.jsx)(qt,{className:`h-4 w-1/2`})]}),e[65]=s.status,e[66]=oe);let se;e[67]===s?se=e[68]:(se=s.status===`error`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Z.jsx)(St,{className:`w-4 h-4 text-(--yellow-11) shrink-0`}),(0,Z.jsx)(`span`,{children:`Server environment information unavailable`}),(0,Z.jsx)(Le,{type:`button`,variant:`link`,size:`xs`,onClick:()=>s.refetch(),children:`Retry`})]}),e[67]=s,e[68]=se);let q;e[69]===C?q=e[70]:(q=C&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:`Environment details`}),(0,Z.jsx)(kt,{className:`w-3.5 h-3.5`,value:JSON.stringify(C,null,2),ariaLabel:`Copy environment JSON`,toastTitle:`Environment details copied`})]}),(0,Z.jsx)(Sn,{content:JSON.stringify(C,null,2)})]}),e[69]=C,e[70]=q);let ce;e[71]===C?ce=e[72]:(ce=C&&u.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:`Errors`}),(0,Z.jsx)(kt,{className:`w-3.5 h-3.5`,value:yn(u),ariaLabel:`Copy errors`,toastTitle:`Errors copied`})]}),(0,Z.jsx)(Sn,{content:u.map(Rt).join(`
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
`)})]}),e[71]=C,e[72]=ce);let ue;e[73]===C?ue=e[74]:(ue=C&&u.length===0&&(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No errors detected.`}),e[73]=C,e[74]=ue);let de;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(`a`,{href:G.feedbackForm,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`two-minute survey`}),e[75]=de):de=e[75];let pe;e[76]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(`div`,{className:`border-t pt-3`,children:(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Other feedback? Take our`,` `,de,` `,`or chat with us on`,` `,(0,Z.jsx)(`a`,{href:G.discordLink,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Discord`}),`.`]})}),e[76]=pe):pe=e[76];let J;return e[77]!==K||e[78]!==oe||e[79]!==se||e[80]!==q||e[81]!==ce||e[82]!==ue?(J=(0,Z.jsxs)(mt,{className:`w-[540px] max-w-[90vw]`,children:[M,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 max-h-[60vh] overflow-y-auto`,children:[K,oe,se,q,ce,ue,pe]})]}),e[77]=K,e[78]=oe,e[79]=se,e[80]=q,e[81]=ce,e[82]=ue,e[83]=J):J=e[83],J};function Tn(e){return!e}function En(e){return e===`bug-description`?`errors`:e===`reproduction-code`?`code`:e}var Dn=`https://static.marimo.app`,On=e=>{let t=(0,Q.c)(26),{onClose:n}=e,[r,i]=(0,$.useState)(``),{exportAsHTML:a}=Ve(),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=`${Dn}/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:Ge.INSTANCE.filenames()}),r=Ct({title:`Uploading static notebook...`,description:`Please wait.`});await fetch(`${Dn}/api/static`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({html:t,path:s})}).catch(()=>{r.dismiss(),Ct({title:`Error uploading static page`,description:(0,Z.jsxs)(`div`,{children:[`Please try again later. If the problem persists, please file a bug report on`,` `,(0,Z.jsx)(`a`,{href:G.issuesPage,target:`_blank`,className:`underline`,children:`GitHub`}),`.`]})})}),r.dismiss(),Ct({title:`Static page uploaded!`,description:(0,Z.jsxs)(`div`,{children:[`The URL has been copied to your clipboard.`,(0,Z.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,Z.jsx)(gt,{children:`Share static notebook`}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(pt,{children:[u,(0,Z.jsxs)(ft,{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,Z.jsx)(`a`,{href:Dn,target:`_blank`,children:Dn}),`.`]})]}),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,Z.jsx)(yt,{"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,Z.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,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(kn,{text:c}),(0,Z.jsx)(`span`,{className:`text-primary`,children:c})]})]}),t[10]=c,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,Z.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,Z.jsx)(Le,{"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,Z.jsx)(Le,{"data-testid":`share-static-notebook-button`,"aria-label":`Save`,variant:`default`,type:`submit`,onClick:async()=>{await Ot(c)},children:`Create`}),t[17]=c,t[18]=_);let v;t[19]!==_||t[20]!==g?(v=(0,Z.jsxs)(dt,{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,Z.jsx)(mt,{className:`w-fit`,children:(0,Z.jsxs)(`form`,{onSubmit:l,children:[d,h,v]})}),t[22]=v,t[23]=l,t[24]=h,t[25]=y):y=t[25],y},kn=e=>{let t=(0,Q.c)(8),[n,r]=$.useState(!1),i;t[0]===e.text?i=t[1]:(i=Ie.stopPropagation(async t=>{t.preventDefault(),await Ot(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,Z.jsx)(Qe,{size:14,strokeWidth:1.5}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,Z.jsx)(Le,{"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,Z.jsx)(Pe,{content:`Copied!`,open:n,children:s}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c};function An(){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=m.findElement(t);if(!e){W.warn(`Could not find HTMLCellId for visible output area`,t);continue}return{cellId:m.parse(e.id)}}}return W.warn(`No visible output area found for scroll anchor`),null}function jn(e){if(!e){W.warn(`No scroll anchor provided to restore scroll position`);return}let t=document.getElementById(m.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 Mn(){let e=(0,Q.c)(2),t=a(se),n;return e[0]===t?n=e[1]:(n=()=>{let e=An();t(t=>({mode:oe(t.mode),cellAnchor:e?.cellId??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{jn(e)})})},e[0]=t,e[1]=n),n}var Nn=n(!1),Pn=()=>{let e=(0,Q.c)(7),{selectedLayout:t}=Ke(),{setLayoutView:n}=qe();if(q()&&!O(`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,Z.jsx)(Ee,{className:`min-w-[110px] border-border bg-background`,"data-testid":`layout-select`,children:(0,Z.jsx)(Se,{placeholder:`Select a view`})}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(we,{children:(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(xe,{children:`View as`}),Jt.map(Rn)]})}),e[3]=a):a=e[3];let o;return e[4]!==t||e[5]!==r?(o=(0,Z.jsxs)(De,{"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 Fn(e){let t=In(e);return(0,Z.jsx)(t,{className:`h-4 w-4`})}function In(e){switch(e){case`vertical`:return rn;case`grid`:return it;case`slides`:return cn;default:return Re(e),xt}}function Ln(e){return Be.startCase(e)}function Rn(e){return(0,Z.jsx)(Ce,{value:e,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 leading-5`,children:[Fn(e),(0,Z.jsx)(`span`,{children:Ln(e)})]})},e)}var zn=[`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],Bn=[`pymdown`,`qmd`,`mystmd`,`mdx`],Vn=[`topological`,`top-down`],Hn=[`document`,`slides`],Un=[`source`,`flat`];function Wn(e){return typeof e==`string`&&zn.some(t=>t===e)}var Gn={html:{includeCode:!0},markdown:{flavor:null},ipynb:{sortMode:`topological`,includeOutputs:!1},pdf:{preset:`document`,includeInputs:!0,includeOutputs:!0,webpdf:!0},script:{type:`source`}};function Kn(e,t){return e.default(t).catch(t)}function qn(e){return L(e).optional().catch(void 0)}var Jn=L({html:qn({includeCode:Kn(R(),Gn.html.includeCode)}),markdown:qn({flavor:Kn(z(Bn).nullable(),Gn.markdown.flavor)}),ipynb:qn({sortMode:Kn(z(Vn),Gn.ipynb.sortMode),includeOutputs:Kn(R(),Gn.ipynb.includeOutputs)}),pdf:qn({preset:Kn(z(Hn),Gn.pdf.preset),includeInputs:Kn(R(),Gn.pdf.includeInputs),includeOutputs:Kn(R(),Gn.pdf.includeOutputs),webpdf:Kn(R(),Gn.pdf.webpdf)}),script:qn({type:Kn(z(Un),Gn.script.type)})}).catch({});function Yn(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 Xn(e){return Yn(Gn,Jn.parse(e))}var Zn=P({toSerializable:e=>e,fromSerializable:Xn}),Qn=F(`marimo:export:options:v1`,Gn,Zn,{getOnInit:!0}),$n=F(`marimo:export:last-format:v1`,`html`,P({toSerializable:e=>e,fromSerializable:e=>Wn(e)?e:`html`}),{getOnInit:!0}),er={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 tr(e,t){return e===`wasm`&&t===`pdf`}function nr({format:e,options:t,runtime:n,filename:r,availability:i}){let a=e===`script`&&t.script.type===`source`?{...er.script,requiresNamedNotebookOnServer:!0}:er[e],o=tr(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 rr(e,t){return e.map(e=>({value:e,...t[e]}))}var ir=rr([`automatic`,...Bn],{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.`}}),ar=rr(Vn,{"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.`}}),or=rr(Hn,{document:{label:`Document`,description:`Creates pages for reading or printing.`},slides:{label:`Slides`,description:`Creates presentation slides from the notebook.`}}),sr=rr([`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.`}}),cr=rr(Un,{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.`}}),lr={html:{label:`HTML`,actionLabel:`Export HTML`,description:`Save the current notebook as an HTML page.`,Icon:nt,Options:ur},markdown:{label:`Markdown`,actionLabel:`Export Markdown`,description:`Save code and text in a Markdown-based file. Cell outputs are not included.`,Icon:v,Options:dr},ipynb:{label:`Jupyter`,actionLabel:`Export Jupyter notebook`,description:`Open the notebook in Jupyter and other compatible tools.`,Icon:on,Options:fr},pdf:{label:`PDF`,actionLabel:`Export PDF`,description:`Save the notebook as a PDF for printing or sharing.`,Icon:tt,Options:pr},script:{label:`Python`,actionLabel:`Export flat script`,description:`Save the notebook as a Python file.`,Icon:Ze,Options:mr},png:{label:`PNG`,actionLabel:`Export PNG`,description:`Capture the current app view as an image.`,Icon:ut,Options:hr}};function ur(e){let t=(0,Q.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,Z.jsx)(gr,{children:(0,Z.jsx)(_r,{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 dr(e){let t=(0,Q.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,Z.jsx)(gr,{children:(0,Z.jsx)(br,{label:`Format`,value:a,disabled:i,onValueChange:o,options:ir})}),t[2]=i,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function fr(e){let t=(0,Q.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,Z.jsx)(vr,{label:`Cell order`,value:n.ipynb.sortMode,disabled:i,onValueChange:a,options:ar}),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,Z.jsx)(_r,{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,Z.jsxs)(gr,{children:[o,l]}),t[13]=o,t[14]=l,t[15]=u):u=t[15],u}function pr(e){let t=(0,Q.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,Z.jsx)(vr,{label:`Layout`,value:n.pdf.preset,disabled:i,onValueChange:a,options:or}),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,Z.jsx)(_r,{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,Z.jsx)(_r,{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,Z.jsx)(vr,{label:`Method`,value:n.pdf.webpdf?`browser`:`latex`,disabled:i,onValueChange:e=>r(`pdf`,{webpdf:e===`browser`}),options:sr}):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,Z.jsxs)(gr,{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 mr(e){let t=(0,Q.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,Z.jsx)(gr,{children:(0,Z.jsx)(vr,{label:`Format`,value:n.script.type,disabled:i,onValueChange:a,options:cr})}),t[2]=i,t[3]=n.script.type,t[4]=a,t[5]=o):o=t[5],o}function hr(){return null}function gr(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`divide-y rounded-md border`,children:n}),t[0]=n,t[1]=r),r}function _r(e){let t=(0,Q.c)(26),{label:n,descriptions:r,descriptionOverride:i,checked:a,disabled:o,onCheckedChange:s}=e,c=(0,$.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,Z.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,Z.jsx)(Cr,{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,Z.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,Z.jsx)(pe,{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,Z.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 vr(e){let t=(0,Q.c)(31),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,$.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,Z.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(yr),t[5]=o,t[6]=p);let m;t[7]!==c||t[8]!==f||t[9]!==p?(m=(0,Z.jsx)(Cr,{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,Z.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,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(k,{id:n,value:e.value}),(0,Z.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,Z.jsx)(C,{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,Z.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 yr(e){return e.description}function br(e){let t=(0,Q.c)(34),{label:n,value:r,disabled:i,onValueChange:a,options:o}=e,s=(0,$.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,Z.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(Sr),t[6]=o,t[7]=p);let m;t[8]!==c||t[9]!==f||t[10]!==p?(m=(0,Z.jsx)(Cr,{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,Z.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,Z.jsx)(Se,{}),t[17]=_):_=t[17];let v;t[18]!==c||t[19]!==s?(v=(0,Z.jsx)(Ee,{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(xr),t[21]=o,t[22]=y);let b;t[23]===y?b=t[24]:(b=(0,Z.jsx)(we,{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,Z.jsxs)(De,{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,Z.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 xr(e){return(0,Z.jsx)(Ce,{value:e.value,children:e.label},e.value)}function Sr(e){return e.description}function Cr(e){let t=(0,Q.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,Z.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(wr),t[10]=c,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.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 wr(e){return(0,Z.jsx)(`p`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:e},e)}var Tr={"playwright-chromium":{description:`PDF export requires Playwright Chromium.`}};function Er(e){let t=(0,Q.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,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0`,children:[(0,Z.jsx)(vt,{size:`small`,className:`size-3`}),(0,Z.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=J(`size-3`,i),t[1]=i,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,Z.jsx)(A,{className:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=(0,Z.jsx)(`span`,{className:`sr-only`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,Z.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 Dr(e){let t=(0,Q.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,Z.jsx)(`div`,{className:`mb-2.5`,children:(0,Z.jsx)(Or,{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,Z.jsx)(`div`,{className:`mb-2.5`,children:(0,Z.jsx)(kr,{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 Or(e){let t=(0,Q.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,Z.jsx)(A,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,Z.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,Z.jsxs)(Le,{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,Z.jsx)(vt,{size:`small`,className:`mr-1.5 size-3.5`}):(0,Z.jsx)(Qt,{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,Z.jsxs)(Pt,{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,Z.jsxs)(Nt,{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 kr(e){let t=(0,Q.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,Z.jsx)(vt,{className:`size-4 shrink-0`,size:`small`}),t[0]=e):e=t[0];let n;return t[1]===r?n=t[2]:(n=(0,Z.jsxs)(Pt,{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,Z.jsxs)(Nt,{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,Z.jsx)(Or,{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,Z.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,Z.jsxs)(Or,{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(jr).join(` `):(0,Z.jsx)(`span`,{className:`block min-w-0`,children:i.requirements.map(Ar)}),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,Z.jsx)(Or,{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,Z.jsx)(Or,{children:e}),t[20]=e,t[21]=r),r}default:ze(i)}}function Ar(e){let t=Tr[e.name];return(0,Z.jsxs)(`span`,{className:`block`,children:[t.description,(0,Z.jsx)(`code`,{className:`mt-1 block break-all font-mono`,children:e.command})]},e.name)}function jr(e){return Tr[e.name].description}function Mr(e){return e.endsWith(`.myst.md`)?`mystmd`:e.endsWith(`.qmd`)?`qmd`:e.endsWith(`.mdx`)?`mdx`:`pymdown`}function Nr(e,t){let n=t??Mr(e),r=ct[n],i=lt.find(t=>e.endsWith(t)),a=Me.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 Pr(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:t===!0?[`--${e}`]:t===!1?[`--no-${e}`]:[`--${e}=${t}`])}function Fr(e){return e.preset===`document`?e.webpdf:null}var Ir={html:{subcommand:`html`,flags:({html:e})=>({"include-code":e.includeCode}),outputFilename:e=>Me.toHTML(e)},markdown:{subcommand:`md`,flags:({markdown:e})=>({flavor:e.flavor}),outputFilename:(e,{markdown:t})=>Nr(e,t.flavor)},ipynb:{subcommand:`ipynb`,flags:({ipynb:e})=>({sort:e.sortMode,"include-outputs":e.includeOutputs}),outputFilename:e=>Me.toIPYNB(e)},pdf:{subcommand:`pdf`,flags:({pdf:e})=>({as:e.preset,"include-inputs":e.includeInputs,"include-outputs":e.includeOutputs,webpdf:Fr(e)}),outputFilename:e=>Me.toPDF(e)},script:{subcommand:`script`,flags:()=>({}),outputFilename:e=>`${Me.withoutExtension(e)}.script.py`}};function Lr({format:e,filename:t,options:n}){if(e===`png`||e===`script`&&n.script.type===`source`||!t)return null;let r=Ir[e];return[`marimo`,`export`,r.subcommand,zt(t),...Pr(r.flags(n)),`-o`,zt(r.outputFilename(t,n))].join(` `)}async function Rr(e){let{exportOptions:t,captureOutputs:n,downloadPDF:r}=e;t.includeOutputs&&await n(),await r(t)}async function zr({format:e,options:t,requests:n,sourceFilename:r,htmlFiles:i,captureOutputs:a,capturePNG:o,downloadFile:s}){switch(e){case`html`:s(await n.exportAsHTML({download:!1,files:i,includeCode:t.html.includeCode}));return;case`markdown`:s(await n.exportAsMarkdown({download:!1,flavor:t.markdown.flavor}));return;case`ipynb`:t.ipynb.includeOutputs&&await a(),s(await n.exportAsIPYNB({download:!1,sortMode:t.ipynb.sortMode,includeOutputs:t.ipynb.includeOutputs}));return;case`pdf`:await Rr({exportOptions:t.pdf,captureOutputs:a,downloadPDF:async e=>{s(await n.exportAsPDF(e))}});return;case`script`:if(t.script.type===`source`){s({contents:(await n.readCode()).contents,filename:r,mediaType:`text/plain`});return}s(await n.exportAsScript({download:!1}));return;case`png`:await o();return;default:ze(e)}}var Br={source:{actionLabel:`Export notebook source`,progressLabel:`notebook source`},flat:{actionLabel:`Export flat script`,progressLabel:`flat script`}};function Vr(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 Hr(e,t){return e===`server`&&t?wt.basename(t):Me.toPY(document.title)}function Ur({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 Wr(e){let n=Ft(),[r,i]=t(Qn),[a,o]=t($n),[s,c]=(0,$.useState)(e??a),l=q()?`wasm`:`server`,u=Ve(),d=ue(),[f,p]=(0,$.useState)(!1),m=Dt(async()=>l===`wasm`?null:u.getExportAvailability(),[l,u]),h=Vr(l,m),g=e=>nr({format:e,options:r,runtime:l,filename:n,availability:h}),_=g(s),v=d&&(_.reason?.type===`missing-packages`||_.reason?.type===`missing-setup`),y=zn.map(e=>({format:e,status:g(e)})),b=tr(l,s),x=lr[s],ee=s===`script`&&r.script.type===`source`,{actionLabel:S,progressLabel:te}=s===`script`?Br[r.script.type]:{actionLabel:x.actionLabel,progressLabel:x.label},C=b?null:Lr({format:s,filename:n,options:r}),w=Ur({usesBrowserPrint:b,hasCommand:!!C,format:s,isNotebookSource:ee});return(0,$.useEffect)(()=>{e&&o(e)},[e,o]),{formats:y,options:r,selected:{format:s,status:_,usesBrowserPrint:b,actionLabel:S,command:C,footerDescription:w},exportRequest:{format:s,options:r,sourceFilename:Hr(l,n),available:_.available,usesBrowserPrint:b,progressLabel:te},selectFormat:e=>{Wn(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 Gr(e){let t=document.getElementById(`App`);if(!t){let e=`The current app view could not be captured.`;throw Ct({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 je({element:t,filename:document.title,prepare:()=>{let t=Ne();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 Kr(e){e(),requestAnimationFrame(()=>{setTimeout(()=>{window.print()},0)})}function qr({format:e,options:t,sourceFilename:n,available:r,usesBrowserPrint:i,progressLabel:a,onClose:o}){let s=Ve(),c=Gt(),[l,u]=(0,$.useState)(!1),d=(0,$.useRef)(null),f=(0,$.useRef)(!0);(0,$.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=async e=>{await Kt({takeScreenshots:()=>c({progress:e}),updateCellOutputs:s.updateCellOutputs})},m=async()=>{await de(()=>Gr(d.current?.parentElement??null))};return{dialogRef:d,isExporting:l,submit:async()=>{if(!(!r||l)){if(i){Kr(o);return}u(!0);try{await Y(`Exporting ${a}…`,async r=>{await zr({format:e,options:t,requests:s,sourceFilename:n,htmlFiles:Ge.INSTANCE.filenames(),captureOutputs:()=>p(r),capturePNG:m,downloadFile:Ae})}),f.current&&o()}catch(e){W.error(`Export failed`,e)}finally{f.current&&u(!1)}}}}}function Jr(e){let t=(0,Q.c)(15),{initialFormat:n,onClose:r}=e,i=Wr(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=qr(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 Yr=`(min-width: 640px)`,Xr=e=>{let t=(0,Q.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}=Jr(a),_=s||c,v=ke(Yr),{format:y,status:b,usesBrowserPrint:x,actionLabel:ee,command:S,footerDescription:te}=f,C=lr[y],w=C.Options,T;t[3]===i?T=t[4]:(T=i?{onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()}}:{},t[3]=i,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(pt,{className:`border-b px-5 py-4 pr-12`,children:[(0,Z.jsx)(gt,{children:`Export notebook`}),(0,Z.jsx)(ft,{children:`Choose a format and adjust its options.`})]}),t[5]=D):D=t[5];let O=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=lr[t];return(0,Z.jsxs)(_e,{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,Z.jsx)(r.Icon,{className:`size-3.5 shrink-0`,strokeWidth:1.5}),(0,Z.jsx)(`span`,{className:`truncate`,children:r.label}),(0,Z.jsx)(Er,{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,Z.jsx)(ye,{"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]!==w||t[14]!==l||t[15]!==C.description||t[16]!==C.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]!==w||t[28]!==l||t[29]!==C.description||t[30]!==C.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,Z.jsxs)(ve,{value:t,className:`mt-0 min-h-0 min-w-0 overflow-y-auto px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`mb-3`,children:[(0,Z.jsx)(`h3`,{className:`text-base font-semibold`,children:C.label}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:C.description})]}),(0,Z.jsx)(Dr,{format:y,formatLabel:C.label,status:b,onInstall:l?h:void 0,isInstalling:c}),x?null:(0,Z.jsx)(w,{options:d,updateOptions:m,disabled:_})]},t)},t[27]=w,t[28]=l,t[29]=C.description,t[30]=C.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]=w,t[14]=l,t[15]=C.description,t[16]=C.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]!==O||t[43]!==A||t[44]!==j?(M=(0,Z.jsxs)(be,{value:y,onValueChange:p,orientation:O,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]=O,t[43]=A,t[44]=j,t[45]=M):M=t[45];let N;t[46]===S?N=t[47]:(N=S?(0,Z.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,Z.jsx)(`span`,{className:`select-none text-muted-foreground`,"aria-hidden":!0,children:`$`}),(0,Z.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,Z.jsx)(kt,{value:S,className:`size-3.5`,buttonClassName:J(Fe({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 P=S&&`mt-3`,F;t[48]===P?F=t[49]:(F=J(`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,P),t[48]=P,t[49]=F);let I;t[50]===te?I=t[51]:(I=te?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:te}):null,t[50]=te,t[51]=I);let L=!b.available||_,R=!te&&`sm:ml-auto`,z;t[52]===R?z=t[53]:(z=J(`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)`,R),t[52]=R,t[53]=z);let B;t[54]===s?B=t[55]:(B=s&&(0,Z.jsx)(vt,{size:`small`,className:`mr-2`,"aria-hidden":!0}),t[54]=s,t[55]=B);let ne=x?`Print to PDF`:ee,V;t[56]!==s||t[57]!==g||t[58]!==L||t[59]!==z||t[60]!==B||t[61]!==ne?(V=(0,Z.jsxs)(Le,{type:`button`,disabled:L,"aria-busy":s,onClick:g,className:z,"data-testid":`export-submit`,children:[B,ne]}),t[56]=s,t[57]=g,t[58]=L,t[59]=z,t[60]=B,t[61]=ne,t[62]=V):V=t[62];let H;t[63]!==F||t[64]!==I||t[65]!==V?(H=(0,Z.jsxs)(`div`,{className:F,children:[I,V]}),t[63]=F,t[64]=I,t[65]=V,t[66]=H):H=t[66];let U;t[67]!==H||t[68]!==N?(U=(0,Z.jsxs)(`footer`,{className:`min-w-0 border-t bg-muted/20 px-4 py-3`,children:[N,H]}),t[67]=H,t[68]=N,t[69]=U):U=t[69];let re;return t[70]!==o||t[71]!==E||t[72]!==U||t[73]!==M?(re=(0,Z.jsxs)(mt,{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`,...E,children:[D,M,U]}),t[70]=o,t[71]=E,t[72]=U,t[73]=M,t[74]=re):re=t[74],re};function Zr(e){let t=(0,Q.c)(5),{openPrompt:n,closeModal:r}=ht(),{sendCopy:i}=Ve(),a;return t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==e?(a=()=>{if(!e)return null;let t=Tt.guessDeliminator(e),a=wt.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(wt.dirname(e),n);i({source:e,destination:a}).then(()=>{r(),Ct({title:`Notebook copied`,description:`A copy of the notebook has been created.`}),Wt(a)})}})},t[0]=r,t[1]=n,t[2]=i,t[3]=e,t[4]=a):a=t[4],a}function Qr(){let e=(0,Q.c)(4),{openConfirm:t}=ht(),n=a(fe),{sendRestart:r}=Ve(),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,Z.jsx)(ge,{onClick:async()=>{n({state:le.CLOSING}),await r(),jt()},"aria-label":`Confirm Restart`,children:`Restart`})})},e[0]=t,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}var $r=new D,ei=e=>$r.isSupported(e)?`markdown`:`code`,ti=()=>{let e=(0,Q.c)(3),{updateCellConfig:t}=l(),{saveCellConfig:n}=Ve(),r;return e[0]!==n||e[1]!==t?(r=async(e,r)=>{let i=E(),a={};for(let t of i.cellIds.inOrderIds){let n=i.cellData[t];n!==void 0&&n.config.hide_code!==e&&ei(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},ni=e=>{e?.preventDefault(),e?.stopPropagation()};function ri(e){let n=(0,Q.c)(48),i;n[0]===e?i=n[1]:(i=e===void 0?{}:e,n[0]=e,n[1]=i);let{exportDialogReturnFocusRef:o}=i,m=Ft(),{openModal:_,closeModal:S}=ht(),{toggleApplication:te}=y(),{selectedPanel:C}=x(),[T]=t(se),D=r(ce),O=ti(),[k]=V(),A=r(p),P=r(ne),{updateCellConfig:F,undoDeleteCell:L,clearAllCellOutputs:R,addSetupCellIfDoesntExist:z,collapseAllCells:B,expandAllCells:W}=l(),ie=Qr(),K=At(),oe=Zr(m),le=a(Nn),ue=a(U),{handleClick:de}=re(),fe=a(H),pe=a(Qn),{readCode:me,saveCellConfig:J}=Ve(),he=c(`database`),ge=c(`storage`),_e=f(),ve=r(ee),ye=r(M),be=r(u),{selectedLayout:xe}=Ke(),{setLayoutView:Se}=qe(),Ce=Mn(),we=k.sharing?.html??!0,Te=k.sharing?.wasm??!0,Ee=k.sharing?.molab??!0,De=xe===`slides`,ke=vi,Ae;n[2]!==S||n[3]!==o||n[4]!==_||n[5]!==pe?(Ae=(e,t)=>{t&&pe(e=>Yn(e,t)),_((0,Z.jsx)(Xr,{initialFormat:e,onClose:S,returnFocusRef:o}))},n[2]=S,n[3]=o,n[4]=_,n[5]=pe,n[6]=Ae):Ae=n[6];let Y=Ae,je;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(Oe,{size:14,strokeWidth:1.5}),n[7]=je):je=n[7];let Me;return n[8]!==_e||n[9]!==z||n[10]!==P||n[11]!==ye||n[12]!==A||n[13]!==R||n[14]!==S||n[15]!==B||n[16]!==oe||n[17]!==he||n[18]!==ge||n[19]!==W||n[20]!==m||n[21]!==ve||n[22]!==De||n[23]!==D||n[24]!==Y||n[25]!==_||n[26]!==de||n[27]!==me||n[28]!==ie||n[29]!==K||n[30]!==J||n[31]!==xe||n[32]!==C||n[33]!==O||n[34]!==le||n[35]!==fe||n[36]!==Se||n[37]!==ue||n[38]!==we||n[39]!==Ee||n[40]!==Te||n[41]!==te||n[42]!==Ce||n[43]!==L||n[44]!==be||n[45]!==F||n[46]!==T.mode?(Me=[{icon:je,label:`Export…`,additionalKeywords:[`download`,`html`,`markdown`,`ipynb`,`pdf`,`script`,`png`],handle:()=>Y()},{icon:(0,Z.jsx)(Oe,{size:14,strokeWidth:1.5}),label:`Download`,redundant:!0,handle:ni,dropdown:[{icon:(0,Z.jsx)(We,{size:14,strokeWidth:1.5}),label:`Download as HTML`,handle:()=>Y(`html`,{html:{includeCode:!0}})},{icon:(0,Z.jsx)(We,{size:14,strokeWidth:1.5}),label:`Download as HTML (exclude code)`,handle:()=>Y(`html`,{html:{includeCode:!1}})},{icon:(0,Z.jsx)(It,{strokeWidth:1.5,style:{width:14,height:14}}),label:`Download as Markdown`,handle:()=>Y(`markdown`)},{icon:(0,Z.jsx)(on,{size:14,strokeWidth:1.5}),label:`Download as ipynb`,handle:()=>Y(`ipynb`)},{icon:(0,Z.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Download notebook source`,handle:()=>Y(`script`,{script:{type:`source`}})},{icon:(0,Z.jsx)(Ze,{size:14,strokeWidth:1.5}),label:`Download flat script`,handle:()=>Y(`script`,{script:{type:`flat`}})},{divider:!0,icon:(0,Z.jsx)(ut,{size:14,strokeWidth:1.5}),label:`Download as PNG`,handle:()=>Y(`png`)},De?{divider:!0,icon:(0,Z.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:ni,dropdown:[{icon:(0,Z.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Document Layout`,handle:()=>Y(`pdf`,{pdf:{preset:`document`}})},{icon:(0,Z.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Slides Layout`,hidden:q(),rightElement:(0,Z.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:()=>Y(`pdf`,{pdf:{preset:`slides`}})}]}:{divider:!0,icon:(0,Z.jsx)(tt,{size:14,strokeWidth:1.5}),label:`Download as PDF`,handle:()=>Y(`pdf`,{pdf:{preset:`document`}})}]},{icon:(0,Z.jsx)(s,{size:14,strokeWidth:1.5}),label:`Pair with an agent`,hidden:q(),handle:async()=>{_((0,Z.jsx)(Bt,{onClose:S}))}},{icon:(0,Z.jsx)(ln,{size:14,strokeWidth:1.5}),label:`Share`,handle:ni,hidden:!we&&!Te&&!Ee,dropdown:[{icon:(0,Z.jsx)(nt,{size:14,strokeWidth:1.5}),label:`Publish HTML to web`,hidden:!we,handle:async()=>{_((0,Z.jsx)(On,{onClose:S}))}},{icon:(0,Z.jsx)(_t,{size:14,strokeWidth:1.5}),label:`Create WebAssembly link`,hidden:!Te,handle:async()=>{let e=await me(),t=Mt({code:e.contents});await Ot(t),Ct({title:`Copied`,description:`Link copied to clipboard.`})}},{icon:(0,Z.jsx)(Ut,{size:14,strokeWidth:1.5}),label:`Create molab notebook`,hidden:!Ee,handle:async()=>{let e=await me(),t=Mt({code:e.contents,baseUrl:`${G.molab}/new`});window.open(t,`_blank`)}}]},{icon:(0,Z.jsx)(sn,{size:14,strokeWidth:1.5}),label:`Helper panel`,redundant:!0,handle:ni,dropdown:g.flatMap(e=>{let t=e.type===`ai`&&!P;if(w({panel:e,capabilities:A,aiEnabled:P})&&!t)return[];let{type:n,Icon:r,additionalKeywords:i}=e;return{label:Be.startCase(n),rightElement:ke(C===n),icon:(0,Z.jsx)(r,{size:14,strokeWidth:1.5}),handle:()=>{if(t){de(`ai`,`ai-features`);return}te(n)},additionalKeywords:i}})},{icon:(0,Z.jsx)(cn,{size:14,strokeWidth:1.5}),label:`Present as`,handle:ni,dropdown:[{icon:T.mode===`present`?(0,Z.jsx)(I,{size:14,strokeWidth:1.5}):(0,Z.jsx)(He,{size:14,strokeWidth:1.5}),label:`Toggle app view`,hotkey:`global.hideCode`,handle:()=>{Ce()}},...Jt.map((e,t)=>{let n=In(e);return{divider:t===0,label:Ln(e),icon:(0,Z.jsx)(n,{size:14,strokeWidth:1.5}),rightElement:(0,Z.jsx)(`div`,{className:`w-8 flex justify-end`,children:xe===e&&(0,Z.jsx)(Ye,{size:14})}),handle:()=>{Se(e),T.mode===`edit`&&Ce()}}})]},{icon:(0,Z.jsx)(nn,{size:14,strokeWidth:1.5}),label:`Duplicate notebook`,hidden:!m||q(),handle:oe},{icon:(0,Z.jsx)(Zt,{size:14,strokeWidth:1.5}),label:`Copy code to clipboard`,hidden:!m,handle:async()=>{let e=await me();await Ot(e.contents),Ct({title:`Copied`,description:`Code copied to clipboard.`})}},{icon:(0,Z.jsx)(Xe,{size:14,strokeWidth:1.5}),label:`Enable all cells`,hidden:!ve||D,handle:async()=>{let e=E(),t=d(e),n=ae.fromEntries(t.map(_i));await J({configs:n});for(let e of t)F({cellId:e,config:{disabled:!1}})}},{divider:!0,icon:(0,Z.jsx)(en,{size:14,strokeWidth:1.5}),label:`Add setup cell`,handle:()=>{z({})}},{icon:(0,Z.jsx)(h,{size:14,strokeWidth:1.5}),label:`Add database connection`,handle:()=>{_((0,Z.jsx)(Vt,{onClose:S}))},dropdown:he.length===0?void 0:[...he.map(e=>({icon:(0,Z.jsx)(s,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>_e(e)})),{divider:!0,icon:(0,Z.jsx)(h,{size:14,strokeWidth:1.5}),label:`Browse all connections`,handle:()=>{_((0,Z.jsx)(Vt,{onClose:S}))}}]},{icon:(0,Z.jsx)(ot,{size:14,strokeWidth:1.5}),label:`Add remote storage`,handle:()=>{_((0,Z.jsx)(Vt,{defaultTab:`storage`,onClose:S}))},dropdown:ge.length===0?void 0:[...ge.map(e=>({icon:(0,Z.jsx)(s,{size:14,strokeWidth:1.5}),label:`Add ${e.displayName}`,description:`Detected in your environment`,handle:()=>_e(e)})),{divider:!0,icon:(0,Z.jsx)(ot,{size:14,strokeWidth:1.5}),label:`Browse all connections`,handle:()=>{_((0,Z.jsx)(Vt,{defaultTab:`storage`,onClose:S}))}}]},{icon:(0,Z.jsx)(dn,{size:14,strokeWidth:1.5}),label:be,hidden:!ye||D,handle:()=>{L()}},{icon:(0,Z.jsx)(un,{size:14,strokeWidth:1.5}),label:`Restart kernel`,variant:`danger`,handle:ie,additionalKeywords:[`reset`,`reload`,`restart`]},{icon:(0,Z.jsx)(tn,{size:14,strokeWidth:1.5}),label:`Re-run all cells`,redundant:!0,hotkey:`global.runAll`,handle:async()=>{K()}},{icon:(0,Z.jsx)(N,{size:14,strokeWidth:1.5}),label:`Clear all outputs`,redundant:!0,handle:()=>{R()}},{icon:(0,Z.jsx)(b,{size:14,strokeWidth:1.5}),label:`Show all code`,hotkey:`global.showAllCode`,handle:()=>O(!1,`code`),redundant:!0},{icon:(0,Z.jsx)($e,{size:14,strokeWidth:1.5}),label:`Hide all code`,hotkey:`global.hideAllCode`,handle:()=>O(!0,`code`),redundant:!0},{icon:(0,Z.jsx)(b,{size:14,strokeWidth:1.5}),label:`Show all markdown code`,hotkey:`global.showAllMarkdownCode`,handle:()=>O(!1,`markdown`),redundant:!0},{icon:(0,Z.jsx)($e,{size:14,strokeWidth:1.5}),label:`Hide all markdown code`,hotkey:`global.hideAllMarkdownCode`,handle:()=>O(!0,`markdown`),redundant:!0},{icon:(0,Z.jsx)(Xt,{size:14,strokeWidth:1.5}),label:`Collapse all sections`,hotkey:`global.collapseAllSections`,handle:B,redundant:!0},{icon:(0,Z.jsx)(Yt,{size:14,strokeWidth:1.5}),label:`Expand all sections`,hotkey:`global.expandAllSections`,handle:W,redundant:!0},{divider:!0,icon:(0,Z.jsx)($t,{size:14,strokeWidth:1.5}),label:`Command palette`,hotkey:`global.commandPalette`,handle:()=>le(gi)},{icon:(0,Z.jsx)(Ue,{size:14,strokeWidth:1.5}),label:`Keyboard shortcuts`,hotkey:`global.showHelp`,handle:()=>fe(hi)},{icon:(0,Z.jsx)(bt,{size:14,strokeWidth:1.5}),label:`User settings`,handle:()=>ue(mi),redundant:!0,additionalKeywords:[`preferences`,`options`,`configuration`]},{icon:(0,Z.jsx)(an,{size:14,strokeWidth:1.5}),label:`Report an issue`,additionalKeywords:[`feedback`,`bug`,`issue`,`report`,`diagnostics`],handle:()=>_((0,Z.jsx)(wn,{onClose:S}))},{icon:(0,Z.jsx)(et,{size:14,strokeWidth:1.5}),label:`Resources`,handle:ni,dropdown:[{icon:(0,Z.jsx)(j,{size:14,strokeWidth:1.5}),label:`Documentation`,handle:pi},{icon:(0,Z.jsx)(Ht,{className:`h-3.5 w-3.5`}),label:`GitHub`,handle:fi},{icon:(0,Z.jsx)(rt,{size:14,strokeWidth:1.5}),label:`Discord Community`,handle:di},{icon:(0,Z.jsx)(at,{className:`h-3.5 w-3.5`}),label:`YouTube`,handle:ui},{icon:(0,Z.jsx)(v,{size:14,strokeWidth:1.5}),label:`Changelog`,handle:li}]},{divider:!0,icon:(0,Z.jsx)(st,{size:14,strokeWidth:1.5}),label:`Open home`,hidden:!location.search.includes(`file`),handle:ci},{icon:(0,Z.jsx)(Ut,{size:14,strokeWidth:1.5}),label:`New notebook`,hidden:!location.search.includes(`file`),handle:si}].filter(oi).map(ii),n[8]=_e,n[9]=z,n[10]=P,n[11]=ye,n[12]=A,n[13]=R,n[14]=S,n[15]=B,n[16]=oe,n[17]=he,n[18]=ge,n[19]=W,n[20]=m,n[21]=ve,n[22]=De,n[23]=D,n[24]=Y,n[25]=_,n[26]=de,n[27]=me,n[28]=ie,n[29]=K,n[30]=J,n[31]=xe,n[32]=C,n[33]=O,n[34]=le,n[35]=fe,n[36]=Se,n[37]=ue,n[38]=we,n[39]=Ee,n[40]=Te,n[41]=te,n[42]=Ce,n[43]=L,n[44]=be,n[45]=F,n[46]=T.mode,n[47]=Me):Me=n[47],Me}function ii(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(ai)}:e}function ai(e){return!e.hidden}function oi(e){return!e.hidden}function si(){let e=Et();window.open(e,`_blank`)}function ci(){let e=document.baseURI.split(`?`)[0];window.open(e,`_blank`,`noopener`)}function li(){window.open(G.releasesPage,`_blank`)}function ui(){window.open(G.youtube,`_blank`)}function di(){window.open(G.discordLink,`_blank`)}function fi(){window.open(G.githubPage,`_blank`)}function pi(){window.open(G.docsPage,`_blank`)}function mi(e){return!e}function hi(e){return!e}function gi(e){return!e}function _i(e){return[e,{disabled:!1}]}function vi(e){return(0,Z.jsx)(`div`,{className:`w-8 flex justify-end`,children:e&&(0,Z.jsx)(Ye,{size:14})})}export{Nn as a,fn as c,en as d,$t as f,Pn as i,dn as l,Zt as m,ti as n,Mn as o,Qt as p,Qr as r,Cn as s,ri as t,an as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,t,u as n}from"./useEvent-xfs0Sn4r.js";import{D as r,Ia as i,Ua as a,h as o,ht as s,si as c}from"./cells-CD9Jbpoa.js";import{t as l}from"./compiler-runtime-CYIjoINj.js";import{g as u}from"./useEventListener-D27Dii_l.js";import{o as d}from"./dist-Dz_04liz.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(a(o())),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(i(o())),e[0]=n,e[1]=r),t(r)}function v(){let e=(0,p.c)(4),{prepareForRun:i}=r(),{sendRun:a}=f(),s=n(m),c;return e[0]!==i||e[1]!==a||e[2]!==s?(c=async e=>{if(e.length===0)return;let t=o();return s(!0),y({cellIds:e,sendRun:a,prepareForRun:i,notebook:t})},e[0]=i,e[1]=a,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,o=[];for(let t of e){let e=i[t]?.current?.editorView,r;e?(c(e)!==`markdown`&&d(e),r=s(e)):r=a[t]?.code||``,o.push(r),n({cellId:t})}await t({cellIds:e,codes:o}).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{
|
|
1
|
+
import{t as e}from"./useEvent-xfs0Sn4r.js";import{D as t,f as n,ht as r}from"./cells-CD9Jbpoa.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-Buwee6vZ.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-92CZ7TtR.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-D3zvxdF3.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-CD9Jbpoa.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-Cg05mM3C.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/extends-CvVTau-c.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/esm-Dw0vvSg2.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-h4OWLK5y.js">
|
|
155
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-GMl_IocT.js">
|
|
156
156
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-zSwE3dvU.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-Bnm85dXD.js">
|
|
160
160
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-CRxVZTJ9.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-
|
|
161
|
+
<link rel="modulepreload" crossorigin href="./assets/useRunCells-C6416Qeo.js">
|
|
162
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-Di-OdQjY.js">
|
|
163
|
+
<link rel="modulepreload" crossorigin href="./assets/blob-CoNcP6Xv.js">
|
|
164
164
|
<link rel="modulepreload" crossorigin href="./assets/share-C2MPy_VX.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="./assets/events-CbeVJ6OD.js">
|
|
166
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
166
|
+
<link rel="modulepreload" crossorigin href="./assets/state-BFemFLAq.js">
|
|
167
167
|
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-npvnLp9x.js">
|
|
168
168
|
<link rel="modulepreload" crossorigin href="./assets/config-Cl3eMWxb.js">
|
|
169
169
|
<link rel="modulepreload" crossorigin href="./assets/tabs-c6mpccpH.js">
|
|
170
170
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-CKA5zVsM.js">
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CqNabM1f.js">
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/html-to-image-DMn_7CCA.js">
|
|
173
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
173
|
+
<link rel="modulepreload" crossorigin href="./assets/download-BKMVrvLm.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/table-CUK1W5bI.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-Bf-rx_aV.js">
|
|
176
|
-
<link rel="modulepreload" crossorigin href="./assets/tree-actions-
|
|
176
|
+
<link rel="modulepreload" crossorigin href="./assets/tree-actions-Bjyy0vFK.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-Dfik_tuW.js">
|
|
178
178
|
<link rel="modulepreload" crossorigin href="./assets/external-link-Bp3BxyRA.js">
|
|
179
179
|
<link rel="modulepreload" crossorigin href="./assets/spinner-Ck-Hgfvj.js">
|
|
180
180
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-BQB1AIAg.js">
|
|
181
181
|
<link rel="modulepreload" crossorigin href="./assets/hat-glasses-C8LSY3HT.js">
|
|
182
182
|
<link rel="modulepreload" crossorigin href="./assets/package-DPlscLzt.js">
|
|
183
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
183
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-DTtEQWz7.js">
|
|
184
184
|
<link rel="modulepreload" crossorigin href="./assets/kbd-Cwh96ZBE.js">
|
|
185
185
|
<link rel="modulepreload" crossorigin href="./assets/alert-dmKwNsrp.js">
|
|
186
186
|
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-Bq7SlWgN.js">
|
|
187
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
188
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
189
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
187
|
+
<link rel="modulepreload" crossorigin href="./assets/state-mneM4Ao8.js">
|
|
188
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-Z8JrraTv.js">
|
|
189
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-CQSjUfZF.js">
|
|
190
190
|
<link rel="modulepreload" crossorigin href="./assets/VisuallyHidden-SChAyKIQ.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-DSzGCKeO.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-DbggWGpx.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-CUFquO6R.js">
|
|
@@ -216,11 +216,11 @@
|
|
|
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-CmmWEUGv.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/types-BflGgckY.js">
|
|
223
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
223
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-BjbhARJS.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/square-B58Ib8Ir.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-MihykDYG.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/prop-types-Djf4O40e.js">
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/icons-CjLa9BiH.js">
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-CLytDdMl.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/pathUtils-Cryrlpma.js">
|
|
233
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
233
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-BxMKEygY.js">
|
|
234
234
|
<link rel="stylesheet" crossorigin href="./assets/cells-D-c15Ks-.css">
|
|
235
235
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-CU2Wa_Bt.css">
|
|
236
236
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-BQtz7-np.css">
|
package/package.json
CHANGED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { python } from "@codemirror/lang-python";
|
|
4
|
+
import { EditorState } from "@codemirror/state";
|
|
5
|
+
import { EditorView } from "@codemirror/view";
|
|
6
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
7
|
+
import { Provider } from "jotai";
|
|
8
|
+
import { afterEach, describe, expect, test } from "vitest";
|
|
9
|
+
import { MockNotebook } from "@/__mocks__/notebook";
|
|
10
|
+
import { cellId, variableName } from "@/__tests__/branded";
|
|
11
|
+
import type { CellHandle } from "@/components/editor/notebook-cell";
|
|
12
|
+
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
13
|
+
import { initialNotebookState, notebookAtom } from "@/core/cells/cells";
|
|
14
|
+
import { HTMLCellId } from "@/core/cells/ids";
|
|
15
|
+
import { editorMountScheduler } from "@/core/codemirror/editor-mount-scheduler";
|
|
16
|
+
import { store } from "@/core/state/jotai";
|
|
17
|
+
import type { Variables } from "@/core/variables/types";
|
|
18
|
+
import { VariableTable } from "../variables-table";
|
|
19
|
+
|
|
20
|
+
async function tick(): Promise<void> {
|
|
21
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const views: EditorView[] = [];
|
|
25
|
+
const elements: HTMLElement[] = [];
|
|
26
|
+
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
for (const view of views.splice(0)) {
|
|
29
|
+
view.destroy();
|
|
30
|
+
}
|
|
31
|
+
for (const element of elements.splice(0)) {
|
|
32
|
+
element.remove();
|
|
33
|
+
}
|
|
34
|
+
store.set(notebookAtom, initialNotebookState());
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("VariableTable cell links", () => {
|
|
38
|
+
test("declared-by click builds the queued editor and highlights the variable", async () => {
|
|
39
|
+
const usageCell = cellId("usage");
|
|
40
|
+
const definingCell = cellId("defining");
|
|
41
|
+
const definingCode = "y = 1\nx = 42";
|
|
42
|
+
|
|
43
|
+
const definingView = new EditorView({
|
|
44
|
+
state: EditorState.create({
|
|
45
|
+
doc: definingCode,
|
|
46
|
+
extensions: [python()],
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
views.push(definingView);
|
|
50
|
+
|
|
51
|
+
const notebook = MockNotebook.notebookState({
|
|
52
|
+
cellData: {
|
|
53
|
+
[usageCell]: { name: "usage_cell" },
|
|
54
|
+
[definingCell]: { name: "defining_cell" },
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
// The defining cell's editor build still waits in the mount queue, the
|
|
58
|
+
// state right after a large notebook opens.
|
|
59
|
+
const handle: { current: CellHandle | null } = { current: null };
|
|
60
|
+
notebook.cellHandles[definingCell] = handle;
|
|
61
|
+
editorMountScheduler.request(definingCell, () => {
|
|
62
|
+
handle.current = {
|
|
63
|
+
editorView: definingView,
|
|
64
|
+
editorViewOrNull: definingView,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
store.set(notebookAtom, notebook);
|
|
68
|
+
|
|
69
|
+
// The link's click handler requires the target cell's element on the page.
|
|
70
|
+
const cellElement = document.createElement("div");
|
|
71
|
+
cellElement.id = HTMLCellId.create(definingCell);
|
|
72
|
+
document.body.append(cellElement);
|
|
73
|
+
elements.push(cellElement);
|
|
74
|
+
|
|
75
|
+
const variables: Variables = {
|
|
76
|
+
[variableName("x")]: {
|
|
77
|
+
dataType: "int",
|
|
78
|
+
declaredBy: [definingCell],
|
|
79
|
+
name: variableName("x"),
|
|
80
|
+
usedBy: [usageCell],
|
|
81
|
+
value: "42",
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
render(
|
|
86
|
+
<Provider store={store}>
|
|
87
|
+
<TooltipProvider>
|
|
88
|
+
<VariableTable
|
|
89
|
+
cellIds={[usageCell, definingCell]}
|
|
90
|
+
variables={variables}
|
|
91
|
+
/>
|
|
92
|
+
</TooltipProvider>
|
|
93
|
+
</Provider>,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
expect(handle.current).toBeNull();
|
|
97
|
+
|
|
98
|
+
fireEvent.click(screen.getByText("defining_cell"));
|
|
99
|
+
// First frame: the link's click callback runs and builds the queued
|
|
100
|
+
// editor synchronously.
|
|
101
|
+
await tick();
|
|
102
|
+
expect(handle.current?.editorView).toBe(definingView);
|
|
103
|
+
expect(cellElement.classList.contains("focus-outline")).toBe(true);
|
|
104
|
+
// Second frame: the jump dispatches the selection.
|
|
105
|
+
await tick();
|
|
106
|
+
expect(definingView.state.selection.main.head).toBe(
|
|
107
|
+
definingCode.indexOf("x = 42"),
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -15,7 +15,7 @@ import { SquareEqualIcon, WorkflowIcon } from "lucide-react";
|
|
|
15
15
|
import React, { memo, useMemo } from "react";
|
|
16
16
|
import { useLocale } from "react-aria";
|
|
17
17
|
import { CellLink } from "@/components/editor/links/cell-link";
|
|
18
|
-
import {
|
|
18
|
+
import { ensureCellEditorView, useCellNames } from "@/core/cells/cells";
|
|
19
19
|
import type { CellId } from "@/core/cells/ids";
|
|
20
20
|
import { isInternalCellName } from "@/core/cells/names";
|
|
21
21
|
import { goToVariableDefinition } from "@/core/codemirror/go-to-definition/commands";
|
|
@@ -135,9 +135,8 @@ const COLUMNS = [
|
|
|
135
135
|
cell: ({ getValue }) => {
|
|
136
136
|
const [declaredBy, usedBy, name] = getValue();
|
|
137
137
|
|
|
138
|
-
// Highlight the variable in the cell editor
|
|
139
138
|
const highlightInCell = (cellId: CellId) => {
|
|
140
|
-
const editorView =
|
|
139
|
+
const editorView = ensureCellEditorView(cellId);
|
|
141
140
|
if (editorView) {
|
|
142
141
|
goToVariableDefinition(editorView, name);
|
|
143
142
|
}
|
package/src/core/cells/cells.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { Objects } from "@/utils/objects";
|
|
|
19
19
|
import { extractAllTracebackInfo, type TracebackInfo } from "@/utils/traceback";
|
|
20
20
|
import { createReducerAndAtoms } from "../../utils/createReducer";
|
|
21
21
|
import { foldAllBulk, unfoldAllBulk } from "../codemirror/editing/commands";
|
|
22
|
+
import { editorMountScheduler } from "../codemirror/editor-mount-scheduler";
|
|
22
23
|
import {
|
|
23
24
|
splitEditor,
|
|
24
25
|
updateEditorCodeFromPython,
|
|
@@ -1919,6 +1920,16 @@ export const getCellEditorView = (cellId: CellId) => {
|
|
|
1919
1920
|
return cellHandles[cellId].current?.editorView;
|
|
1920
1921
|
};
|
|
1921
1922
|
|
|
1923
|
+
/**
|
|
1924
|
+
* Get the cell's editor view. When the view's build is still queued in the
|
|
1925
|
+
* progressive-mount scheduler, build it synchronously first. This lets user
|
|
1926
|
+
* actions target a cell whose editor is not mounted yet.
|
|
1927
|
+
*/
|
|
1928
|
+
export const ensureCellEditorView = (cellId: CellId) => {
|
|
1929
|
+
editorMountScheduler.promote(cellId);
|
|
1930
|
+
return getCellEditorView(cellId);
|
|
1931
|
+
};
|
|
1932
|
+
|
|
1922
1933
|
export function flattenTopLevelNotebookCells(
|
|
1923
1934
|
state: NotebookState,
|
|
1924
1935
|
): (CellData & CellRuntimeState)[] {
|
|
@@ -5,7 +5,9 @@ import { EditorState } from "@codemirror/state";
|
|
|
5
5
|
import { EditorView, keymap } from "@codemirror/view";
|
|
6
6
|
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
7
7
|
import { cellId, variableName } from "@/__tests__/branded";
|
|
8
|
+
import type { CellHandle } from "@/components/editor/notebook-cell";
|
|
8
9
|
import { initialNotebookState, notebookAtom } from "@/core/cells/cells";
|
|
10
|
+
import { editorMountScheduler } from "@/core/codemirror/editor-mount-scheduler";
|
|
9
11
|
import { store } from "@/core/state/jotai";
|
|
10
12
|
import { variablesAtom } from "@/core/variables/state";
|
|
11
13
|
import {
|
|
@@ -184,6 +186,52 @@ print(mymodule)`;
|
|
|
184
186
|
moduleCode.indexOf("mymodule"),
|
|
185
187
|
);
|
|
186
188
|
});
|
|
189
|
+
|
|
190
|
+
test("builds the defining cell's queued editor before jumping", async () => {
|
|
191
|
+
const definingCell = cellId("queued-defining-cell");
|
|
192
|
+
const usageCell = cellId("usage-cell");
|
|
193
|
+
const definingCode = "a = 10";
|
|
194
|
+
const usageCode = "print(a)";
|
|
195
|
+
|
|
196
|
+
const definingView = createEditor(definingCode, definingCode.length);
|
|
197
|
+
const usageView = createEditor(usageCode, usageCode.indexOf("a"));
|
|
198
|
+
views.push(definingView, usageView);
|
|
199
|
+
|
|
200
|
+
// The defining cell's editor build still waits in the mount queue, the
|
|
201
|
+
// state right after a large notebook opens.
|
|
202
|
+
const handle: { current: CellHandle | null } = { current: null };
|
|
203
|
+
editorMountScheduler.request(definingCell, () => {
|
|
204
|
+
handle.current = {
|
|
205
|
+
editorView: definingView,
|
|
206
|
+
editorViewOrNull: definingView,
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const notebook = initialNotebookState();
|
|
211
|
+
notebook.cellHandles[definingCell] = handle;
|
|
212
|
+
notebook.cellHandles[usageCell] = {
|
|
213
|
+
current: { editorView: usageView, editorViewOrNull: usageView },
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
store.set(notebookAtom, notebook);
|
|
217
|
+
store.set(variablesAtom, {
|
|
218
|
+
[variableName("a")]: {
|
|
219
|
+
dataType: "int",
|
|
220
|
+
declaredBy: [definingCell],
|
|
221
|
+
name: variableName("a"),
|
|
222
|
+
usedBy: [usageCell],
|
|
223
|
+
value: "10",
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const result = goToDefinitionAtCursorPosition(usageView);
|
|
228
|
+
|
|
229
|
+
expect(result).toBe(true);
|
|
230
|
+
// The jump built the queued editor synchronously.
|
|
231
|
+
expect(handle.current?.editorView).toBe(definingView);
|
|
232
|
+
await tick();
|
|
233
|
+
expect(definingView.state.selection.main.head).toBe(0);
|
|
234
|
+
});
|
|
187
235
|
});
|
|
188
236
|
|
|
189
237
|
describe("goToDefinitionWithLspFallback", () => {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@codemirror/view";
|
|
11
11
|
import type { CellId } from "@/core/cells/ids";
|
|
12
12
|
import { hotkeysAtom, platformAtom } from "../../config/config";
|
|
13
|
-
import {
|
|
13
|
+
import { ensureCellEditorView } from "../../cells/cells";
|
|
14
14
|
import { store } from "../../state/jotai";
|
|
15
15
|
import { variablesAtom } from "../../variables/state";
|
|
16
16
|
import type { VariableName, Variables } from "../../variables/types";
|
|
@@ -181,12 +181,6 @@ function getEditorForVariable(
|
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
/**
|
|
185
|
-
* Go to the given line number in the editor view.
|
|
186
|
-
* @param view The editor view to go to.
|
|
187
|
-
* @param line The line number to go to.
|
|
188
|
-
*/
|
|
189
184
|
function getEditorForCell(cellId: CellId): EditorView | null {
|
|
190
|
-
|
|
191
|
-
return notebookState.cellHandles[cellId].current?.editorView ?? null;
|
|
185
|
+
return ensureCellEditorView(cellId) ?? null;
|
|
192
186
|
}
|