@marimo-team/frontend 0.21.2-dev37 → 0.21.2-dev40
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-DYdGvia_.js → CellStatus-IHJk0CT8.js} +1 -1
- package/dist/assets/{JsonOutput-CN6rPeEV.js → JsonOutput-BIbkaOuk.js} +9 -9
- package/dist/assets/{MarimoErrorOutput-BhfAlCn4.js → MarimoErrorOutput-hYOXA8Ml.js} +5 -5
- package/dist/assets/{RenderHTML-BS4HOKgA.js → RenderHTML-DduaBOBv.js} +1 -1
- package/dist/assets/{add-cell-with-ai-pEba6oGB.js → add-cell-with-ai-Cbktc1B0.js} +9 -9
- package/dist/assets/{add-connection-dialog-9odisycO.js → add-connection-dialog-BewAq3li.js} +23 -23
- package/dist/assets/{agent-panel-BSEF-vxf.js → agent-panel-CtAqa-P9.js} +5 -5
- package/dist/assets/{ai-model-dropdown-CBQHQst1.js → ai-model-dropdown-DgMZ5T_L.js} +3 -3
- package/dist/assets/{app-config-button-XC0eJuj1.js → app-config-button-BLGBmcfT.js} +1 -1
- package/dist/assets/{azure-Cl-hv4CT.js → azure-BeB26UeM.js} +1 -1
- package/dist/assets/{cell-editor-CtnuCOtA.js → cell-editor-Ti3F6axu.js} +12 -13
- package/dist/assets/{cell-link-D8ZUYcpP.js → cell-link-BEnixmCb.js} +1 -1
- package/dist/assets/{cells-DZyIQGyJ.js → cells-DqKJsMUm.js} +79 -78
- package/dist/assets/{chat-display-CvRHSFG6.js → chat-display-B0hV2K6L.js} +1 -1
- package/dist/assets/{chat-panel-BAGhr_FT.js → chat-panel-CNGIGWIs.js} +2 -2
- package/dist/assets/{column-preview-BuB6sz5V.js → column-preview-CVqBaB8R.js} +1 -1
- package/dist/assets/{command-DxWyVVPx.js → command-DpusMohg.js} +1 -1
- package/dist/assets/{command-palette-BjbqAF2r.js → command-palette-BfuIslSf.js} +1 -1
- package/dist/assets/{common-DJx7lN8H.js → common-CYWtZYKm.js} +1 -1
- package/dist/assets/{components-ENebof0d.js → components-C4dDqD7U.js} +1 -1
- package/dist/assets/{components-DSj55gbq.js → components-DZQ7ndNS.js} +1 -1
- package/dist/assets/{context-aware-panel-C4GJI0g0.js → context-aware-panel-DEVrXLoa.js} +3 -3
- package/dist/assets/{datasource-Be25L0nm.js → datasource-Bo8w993m.js} +2 -2
- package/dist/assets/{dependency-graph-panel-DwIVdeIJ.js → dependency-graph-panel-u9oPy09H.js} +4 -4
- package/dist/assets/{documentation-panel-78VOc9_O.js → documentation-panel-BQRmNRb_.js} +1 -1
- package/dist/assets/{download-BlNsDzA2.js → download-DtyAt8iO.js} +1 -1
- package/dist/assets/{edit-page-vExGqsee.js → edit-page-Cqvk7zWH.js} +7 -7
- package/dist/assets/{error-panel-D8Yl4tpB.js → error-panel-DclemF57.js} +1 -1
- package/dist/assets/{file-explorer-panel-CbIYi1SW.js → file-explorer-panel-D706RRJ-.js} +3 -3
- package/dist/assets/{file-icons-zgA9qh-d.js → file-icons-D4HcGlr_.js} +1 -1
- package/dist/assets/{floating-outline-vyq-JnTK.js → floating-outline-B86gVj23.js} +1 -1
- package/dist/assets/{focus-Cnr-VB8o.js → focus-B85PAbhR.js} +1 -1
- package/dist/assets/{form-LO1BJ8WB.js → form--K3o18rQ.js} +2 -2
- package/dist/assets/{globals-3fE4PBWj.js → globals-C_t1YYpc.js} +1 -1
- package/dist/assets/{home-page-DFcaf-s1.js → home-page-C5LO1JXE.js} +1 -1
- package/dist/assets/{hooks-NxoY-x2K.js → hooks-W-qT5c6l.js} +1 -1
- package/dist/assets/{html-to-image-DDWA96Ex.js → html-to-image-CoMmxXBd.js} +1 -1
- package/dist/assets/{index-OH-GH0bF.js → index-BSzIstPK.js} +14 -14
- package/dist/assets/{kiosk-mode-D4FbpWVp.js → kiosk-mode-zv0zIGqw.js} +1 -1
- package/dist/assets/{layout-qNHT912R.js → layout-C_JVKYrz.js} +3 -3
- package/dist/assets/{logs-panel-14Cp2UUn.js → logs-panel-DowtOCA5.js} +1 -1
- package/dist/assets/{markdown-renderer-CH1ffrUG.js → markdown-renderer-CNaYgTOF.js} +1 -1
- package/dist/assets/{mode-OBdgd6Zz.js → mode-Bn_XF6AW.js} +1 -1
- package/dist/assets/{name-cell-input-BmkGdvnh.js → name-cell-input-CVt9kv6F.js} +1 -1
- package/dist/assets/{outline-panel-Bn1SN1eu.js → outline-panel-ClI23gcy.js} +1 -1
- package/dist/assets/{packages-panel-Cyb4BUmM.js → packages-panel-BW2m-sNe.js} +1 -1
- package/dist/assets/{panels-DfEUpHpA.js → panels-B2DAaT1E.js} +1 -1
- package/dist/assets/{process-output-CC4VhdkC.js → process-output-BewZuQwI.js} +1 -1
- package/dist/assets/{readonly-python-code-Cq9EKL61.js → readonly-python-code-BgTK_w0H.js} +1 -1
- package/dist/assets/{run-page-Df9bi2J7.js → run-page-DMpRvHgf.js} +1 -1
- package/dist/assets/{scratchpad-panel-vKbONRfT.js → scratchpad-panel-ClDi2sdV.js} +1 -1
- package/dist/assets/{session-panel-DPoC2CoL.js → session-panel-C-RbWN-G.js} +1 -1
- package/dist/assets/{snippets-panel-D7W6PE7E.js → snippets-panel-DCdeI2hB.js} +1 -1
- package/dist/assets/{state-Br7baqTT.js → state-CJ2HIW-e.js} +1 -1
- package/dist/assets/{switch-Cds8TleW.js → switch-O_7alg7G.js} +1 -1
- package/dist/assets/tracing-BxcUfhUv.js +1 -0
- package/dist/assets/{tracing-panel-BpKr5n4H.js → tracing-panel-DK4YfdoZ.js} +2 -2
- package/dist/assets/{useAddCell-XcxY_cZw.js → useAddCell-BpBkEpP6.js} +1 -1
- package/dist/assets/{useBoolean-0C18DvVA.js → useBoolean-Cb23qnhy.js} +1 -1
- package/dist/assets/{useCellActionButton-DFNSBzoc.js → useCellActionButton-fJ6SGX-Z.js} +1 -1
- package/dist/assets/{useDeleteCell-DLdqnODD.js → useDeleteCell-B4nKRnTM.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-_E0t8nfy.js → useDependencyPanelTab-BUjZxWnG.js} +1 -1
- package/dist/assets/{useNotebookActions-DlbYUPWD.js → useNotebookActions-CooxVonM.js} +1 -1
- package/dist/assets/{useRunCells-YR_s_yuq.js → useRunCells-D5wCIJdU.js} +1 -1
- package/dist/assets/{useSplitCell-BNkvoKCq.js → useSplitCell-D8kqiCTS.js} +1 -1
- package/dist/index.html +32 -32
- package/package.json +1 -1
- package/src/__mocks__/notebook.ts +9 -9
- package/src/__tests__/branded.ts +20 -0
- package/src/components/data-table/charts/__tests__/storage.test.ts +7 -7
- package/src/components/editor/__tests__/data-attributes.test.tsx +8 -8
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +15 -15
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +2 -2
- package/src/components/editor/navigation/__tests__/selection.test.ts +7 -6
- package/src/components/editor/navigation/__tests__/state.test.ts +8 -7
- package/src/components/editor/output/MarimoErrorOutput.tsx +7 -7
- package/src/components/editor/output/__tests__/traceback.test.tsx +4 -4
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +4 -4
- package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +8 -1
- package/src/components/storage/storage-inspector.tsx +1 -2
- package/src/components/tracing/tracing.tsx +3 -1
- package/src/core/ai/__tests__/staged-cells.test.ts +9 -8
- package/src/core/ai/context/providers/__tests__/cell-output.test.ts +31 -31
- package/src/core/ai/context/providers/__tests__/datasource.test.ts +3 -3
- package/src/core/ai/context/providers/__tests__/tables.test.ts +3 -2
- package/src/core/ai/context/providers/__tests__/variable.test.ts +84 -63
- package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +10 -9
- package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +6 -6
- package/src/core/ai/tools/edit-notebook-tool.ts +3 -3
- package/src/core/cells/__tests__/add-missing-import.test.ts +3 -3
- package/src/core/cells/__tests__/cells.test.ts +192 -135
- package/src/core/cells/__tests__/focus.test.ts +5 -4
- package/src/core/cells/__tests__/logs.test.ts +13 -12
- package/src/core/cells/__tests__/pending-delete-service.test.tsx +3 -3
- package/src/core/cells/__tests__/runs.test.ts +22 -21
- package/src/core/cells/__tests__/scrollCellIntoView.test.ts +8 -7
- package/src/core/cells/__tests__/session.test.ts +23 -22
- package/src/core/cells/cells.ts +1 -1
- package/src/core/cells/ids.ts +5 -5
- package/src/core/cells/logs.ts +2 -2
- package/src/core/cells/runs.ts +6 -8
- package/src/core/codemirror/__tests__/format.test.ts +34 -36
- package/src/core/codemirror/__tests__/setup.test.ts +2 -2
- package/src/core/codemirror/cells/__tests__/extensions.test.ts +114 -0
- package/src/core/codemirror/cells/__tests__/traceback-decorations.test.ts +33 -32
- package/src/core/codemirror/cells/extensions.ts +66 -23
- package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +12 -13
- package/src/core/codemirror/language/__tests__/utils.test.ts +3 -3
- package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +7 -8
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +4 -3
- package/src/core/codemirror/reactive-references/__tests__/analyzer.test.ts +7 -6
- package/src/core/codemirror/reactive-references/analyzer.ts +2 -2
- package/src/core/codemirror/rtc/loro/__tests__/sync.test.ts +52 -0
- package/src/core/codemirror/rtc/loro/sync.ts +1 -0
- package/src/core/datasets/__tests__/data-source.test.ts +5 -6
- package/src/core/datasets/state.ts +1 -1
- package/src/core/errors/__tests__/errors.test.ts +2 -1
- package/src/core/export/__tests__/hooks.test.ts +37 -36
- package/src/core/islands/main.ts +2 -7
- package/src/core/kernel/__tests__/handlers.test.ts +5 -4
- package/src/core/kernel/handlers.ts +7 -4
- package/src/core/network/DeferredRequestRegistry.ts +2 -2
- package/src/core/network/__tests__/CachingRequestRegistry.test.ts +9 -10
- package/src/core/network/__tests__/DeferredRequestRegistry.test.ts +4 -6
- package/src/core/static/__tests__/virtual-file-tracker.test.ts +8 -8
- package/src/core/static/virtual-file-tracker.ts +1 -1
- package/src/core/storage/__tests__/state.test.ts +31 -21
- package/src/core/storage/state.ts +1 -1
- package/src/core/variables/__tests__/state.test.ts +6 -6
- package/src/core/variables/types.ts +2 -2
- package/src/core/wasm/__tests__/state.test.ts +8 -8
- package/src/core/websocket/useMarimoKernelConnection.tsx +12 -15
- package/src/plugins/impl/anywidget/model.ts +1 -2
- package/src/stories/cell.stories.tsx +8 -8
- package/src/stories/layout/vertical/one-column.stories.tsx +9 -8
- package/src/stories/log-viewer.stories.tsx +8 -8
- package/src/stories/variables.stories.tsx +2 -2
- package/src/utils/__tests__/download.test.tsx +19 -18
- package/src/utils/json/base64.ts +3 -3
- package/src/utils/traceback.ts +5 -3
- package/dist/assets/tracing-DFGiZoMP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Ze,p as Xe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{Cr as tt,E as ge,Ft as at,Qn as ot,Yn as nt,_ as it,dn as st,fn as lt,gn as rt,h as je,li as ce,pn as dt,qn as ct,rr as ht,t as pt}from"./cells-DZyIQGyJ.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as mt}from"./assertNever-DWSyoPEi.js";import{s as ve}from"./useLifecycle-DA9DjSPo.js";import{i as ut,n as Ce}from"./add-connection-dialog-9odisycO.js";import{n as ft,x as yt}from"./ai-model-dropdown-CBQHQst1.js";import{c as ze,m as H}from"./useEventListener-Dy81QR4n.js";import{y as kt}from"./utils-tNbLd14P.js";import{n as A,t as Me}from"./constants-Rz_lD4HK.js";import{S as he,h as bt,x as xt}from"./config-3Aq84phF.js";import{t as wt}from"./jsx-runtime-icT_Ltz2.js";import{r as gt,t as pe}from"./button-Ej3vmCIF.js";import{r as T}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as We,f as jt,i as Se,m as vt,p as De,u as _e}from"./layout-qNHT912R.js";import{t as Ae}from"./check-BE0hEwVo.js";import{c as Ne,d as me,n as Ct,o as zt,r as ue,t as Mt}from"./download-BlNsDzA2.js";import{f as Wt}from"./maps-OKerBHH8.js";import{r as St}from"./useCellActionButton-DFNSBzoc.js";import{t as Dt}from"./copy-CkudG0Ej.js";import{t as _t}from"./download-DBW9RXtT.js";import{t as At}from"./eye-off-vwi9L975.js";import{t as Nt}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Pt}from"./github-BVtI-3F1.js";import{m as It}from"./form-LO1BJ8WB.js";import{n as Et,r as Lt,t as Ht}from"./youtube-DE-Ej6FR.js";import{n as Tt,t as qt}from"./square-CxAsQQ77.js";import{t as Rt}from"./image-DXfkah9d.js";import{t as Bt}from"./link-Cf10mh3t.js";import{r as Ft}from"./input-CUwqpKjd.js";import{t as Vt}from"./settings-CzQUw9rV.js";import{x as Yt}from"./azure-Cl-hv4CT.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Pe,t as Ot}from"./paths-D2lG83Oh.js";import{o as Kt}from"./session-BrEm7qNv.js";import{a as Ut,c as $t,i as Gt,n as Jt,r as Qt,s as Zt,t as Xt}from"./select-CxT2Geqr.js";import{t as ea}from"./tooltip-D9723Brr.js";import{a as Ie,i as ta,r as aa}from"./mode-OBdgd6Zz.js";import{o as oa}from"./alert-dialog-9WfvUF7e.js";import{a as na,c as ia,i as sa,n as la,r as ra}from"./dialog-CVN1lcMF.js";import{n as fe}from"./ImperativeModal-qEtcJ95s.js";import{r as da,t as ca}from"./share-BdH_5I58.js";import{n as Q}from"./copy-CA4fP28I.js";import{r as ha}from"./useRunCells-YR_s_yuq.js";import{a as pa}from"./cell-link-D8ZUYcpP.js";import{a as ma}from"./renderShortcut-CnD1Dah5.js";import{t as ua}from"./icons-CrUXojcA.js";import{t as fa}from"./links-CIQwYQ48.js";import{r as ya,t as Ee}from"./hooks-NxoY-x2K.js";import{t as Le}from"./types-BfP_kuAY.js";var ka=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ba=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),He=h("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"}]]),Te=h("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"}]]),qe=h("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"}]]),xa=h("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"}]]),wa=h("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"}]]),ga=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Re=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ja=h("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"}]]),va=h("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"}]]),Ca=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Be=h("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"}]]),za=h("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"}]]),Ma=h("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"}]]),Fe=h("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"}]]),Ve=_(),ye=we(et(),1),a=we(wt(),1),Z="https://static.marimo.app";const Wa=e=>{let t=(0,Ve.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=T(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Z}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let P=await r({download:!1,includeCode:!0,files:jt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Z}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:P,path:l})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:A.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ia,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(na,{children:[m,(0,a.jsxs)(ra,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:Z,target:"_blank",children:Z}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Ft,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Sa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Q(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(sa,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(la,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Sa=e=>{let t=(0,Ve.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=gt.stopPropagation(async m=>{m.preventDefault(),await Q(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(pe,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(ea,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Da=_();function _a(){let e=document.getElementsByClassName(Me.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=ce.findElement(t);if(!o){H.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){H.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){H.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${Me.outputArea}`)){H.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ye(){let e=(0,Da.c)(2),t=L(Ie),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ta(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Oe=Xe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=We(),{setLayoutView:n}=Se();if(he()&&!rt("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Zt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Jt,{children:(0,a.jsxs)(Qt,{children:[(0,a.jsx)(Ut,{children:"View as"}),Le.map(Ea)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Xt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ia(e){return(0,a.jsx)(Ke(e),{className:"h-4 w-4"})}function Ke(e){switch(e){case"vertical":return ja;case"grid":return Lt;case"slides":return Be;default:return mt(e),qt}}function Ue(e){return ve(e)}function Ea(e){return(0,a.jsx)(Gt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ia(e),(0,a.jsx)("span",{children:Ue(e)})]})},e)}async function La(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ha=_();function Ta(e){let t=(0,Ha.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=T(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Pe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Pe.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),fa(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const qa=()=>{let{updateCellConfig:e}=ge(),{saveCellConfig:t}=T();return(0,ye.useCallback)(async()=>{let n=new at,o=je(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=ze.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ra=_();function $e(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(bt),{sendRestart:o}=T(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(oa,{onClick:async()=>{n({state:xt.CLOSING}),await o(),da()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ba=_(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Fa(){var be,xe;let e=(0,Ba.c)(51),t=pa(),{openModal:n,closeModal:o}=fe(),{toggleApplication:s}=st(),{selectedPanel:r}=lt(),[l]=Ze(Ie),i=de(aa),d=qa(),[m]=kt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=$e(),x=ha(),j=Ta(t),v=L(Oe),P=L(ft),z=L(yt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=T(),W=ya(),oe=de(it),ne=de(pt),{selectedLayout:q}=We(),{setLayoutView:ie}=Se(),R=Ye(),B=((be=m.sharing)==null?void 0:be.html)??!0,F=((xe=m.sharing)==null?void 0:xe.wasm)??!0,ke=!he(),se=q==="slides",Ge=so,Je=io,V;e[0]!==t||e[1]!==W||e[2]!==M?(V=async c=>{let{preset:p,title:E}=c;if(!t){X();return}await Ne(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Ct})})},e[0]=t,e[1]=W,e[2]=M,e[3]=V):V=e[3];let S=V,Y;e[4]===S?Y=e[5]:(Y=async()=>{if(ke){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(no,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=Y);let O=Y,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){X();return}await Ne("Downloading IPYNB...",async c=>{await Ee({takeScreenshots:()=>W({progress:c}),updateCellOutputs:M});let p=await ee({download:!1});ue(new Blob([p],{type:"application/x-ipynb+json"}),me.toIPYNB(document.title))})},e[6]=ee,e[7]=t,e[8]=W,e[9]=M,e[10]=K):K=e[10];let le=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let $;e[12]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(De,{size:14,strokeWidth:1.5}),e[12]=$):$=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){X();return}await _e({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let G;return e[15]!==f||e[16]!==ne||e[17]!==u||e[18]!==o||e[19]!==y||e[20]!==j||e[21]!==S||e[22]!==k||e[23]!==te||e[24]!==t||e[25]!==O||e[26]!==le||e[27]!==oe||e[28]!==d||e[29]!==se||e[30]!==i||e[31]!==n||e[32]!==I||e[33]!==b||e[34]!==x||e[35]!==ae||e[36]!==q||e[37]!==r||e[38]!==v||e[39]!==z||e[40]!==ie||e[41]!==P||e[42]!==B||e[43]!==F||e[44]!==D||e[45]!==s||e[46]!==R||e[47]!==g||e[48]!==w||e[49]!==l.mode?(G=[{icon:U,label:"Download",handle:N,dropdown:[{icon:$,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){X();return}await _e({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ua,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await te({download:!1});ue(new Blob([c],{type:"text/plain"}),me.toMarkdown(document.title))}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:le},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await I();ue(new Blob([c.contents],{type:"text/plain"}),me.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ma("global.hideCode",!1)]}),handle:oo},se?{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:O},{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Je(!0),hidden:!ke,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:O}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Wa,{onClose:o}))}},{icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await Q(ca({code:(await I()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:dt.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Qe}=c;return re?[]:{label:ve(p),rightElement:Ge(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Qe}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Yt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Le.map((c,p)=>{let E=Ke(c);return{divider:p===0,label:Ue(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:q===c&&(0,a.jsx)(Ae,{size:14})}),handle:()=>{ie(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||he(),handle:j},{icon:(0,a.jsx)(He,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await Q((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=tt(je());await ae({configs:ze.fromEntries(c.map(ao))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Ce,{onClose:o}))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Ce,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ne||i,handle:()=>{g()}},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(to)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(eo)},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Xa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Za},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Qa},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ga},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Changelog",handle:$a}]},{divider:!0,icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Oa).map(Va),e[15]=f,e[16]=ne,e[17]=u,e[18]=o,e[19]=y,e[20]=j,e[21]=S,e[22]=k,e[23]=te,e[24]=t,e[25]=O,e[26]=le,e[27]=oe,e[28]=d,e[29]=se,e[30]=i,e[31]=n,e[32]=I,e[33]=b,e[34]=x,e[35]=ae,e[36]=q,e[37]=r,e[38]=v,e[39]=z,e[40]=ie,e[41]=P,e[42]=B,e[43]=F,e[44]=D,e[45]=s,e[46]=R,e[47]=g,e[48]=w,e[49]=l.mode,e[50]=G):G=e[50],G}function Va(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ya)}:e}function Ya(e){return!e.hidden}function Oa(e){return!e.hidden}function Ka(){let e=Kt();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function $a(){window.open(A.releasesPage,"_blank")}function Ga(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Qa(){window.open(A.githubPage,"_blank")}function Za(){window.open(A.docsPage,"_blank")}function Xa(e){return!e}function eo(e){return!e}function to(e){return!e}function ao(e){return[e,{disabled:!1}]}async function oo(){let e=document.getElementById("App");e&&await zt({element:e,filename:document.title,prepare:Mt})}function no(){return window.print()}function io(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function so(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ae,{size:14})})}function X(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ye as a,qe as c,Oe as i,Te as l,$e as n,Fe as o,Pa as r,Re as s,Fa as t,He as u};
|
|
1
|
+
import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Qe,p as Xe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{E as ge,Ft as tt,Tr as at,Yn as ot,Zn as nt,_ as it,ar as st,di as ce,dn as lt,er as rt,fn as dt,gn as ct,h as je,pn as ht,t as pt}from"./cells-DqKJsMUm.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as mt}from"./assertNever-DWSyoPEi.js";import{s as ve}from"./useLifecycle-DA9DjSPo.js";import{i as ut,n as Ce}from"./add-connection-dialog-BewAq3li.js";import{n as ft,x as yt}from"./ai-model-dropdown-DgMZ5T_L.js";import{c as ze,m as T}from"./useEventListener-Dy81QR4n.js";import{y as kt}from"./utils-tNbLd14P.js";import{n as A,t as Me}from"./constants-Rz_lD4HK.js";import{S as he,h as bt,x as xt}from"./config-3Aq84phF.js";import{t as wt}from"./jsx-runtime-icT_Ltz2.js";import{r as gt,t as pe}from"./button-Ej3vmCIF.js";import{r as H}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as We,f as jt,i as Se,m as vt,p as De,u as _e}from"./layout-C_JVKYrz.js";import{t as Ae}from"./check-BE0hEwVo.js";import{c as Ne,d as me,n as Ct,o as zt,r as ue,t as Mt}from"./download-DtyAt8iO.js";import{f as Wt}from"./maps-OKerBHH8.js";import{r as St}from"./useCellActionButton-fJ6SGX-Z.js";import{t as Dt}from"./copy-CkudG0Ej.js";import{t as _t}from"./download-DBW9RXtT.js";import{t as At}from"./eye-off-vwi9L975.js";import{t as Nt}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Pt}from"./github-BVtI-3F1.js";import{m as It}from"./form--K3o18rQ.js";import{n as Et,r as Lt,t as Tt}from"./youtube-DE-Ej6FR.js";import{n as Ht,t as qt}from"./square-CxAsQQ77.js";import{t as Rt}from"./image-DXfkah9d.js";import{t as Bt}from"./link-Cf10mh3t.js";import{r as Ft}from"./input-CUwqpKjd.js";import{t as Vt}from"./settings-CzQUw9rV.js";import{x as Yt}from"./azure-BeB26UeM.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Pe,t as Ot}from"./paths-D2lG83Oh.js";import{o as Kt}from"./session-BrEm7qNv.js";import{a as Ut,c as $t,i as Gt,n as Jt,r as Zt,s as Qt,t as Xt}from"./select-CxT2Geqr.js";import{t as ea}from"./tooltip-D9723Brr.js";import{a as Ie,i as ta,r as aa}from"./mode-Bn_XF6AW.js";import{o as oa}from"./alert-dialog-9WfvUF7e.js";import{a as na,c as ia,i as sa,n as la,r as ra}from"./dialog-CVN1lcMF.js";import{n as fe}from"./ImperativeModal-qEtcJ95s.js";import{r as da,t as ca}from"./share-BdH_5I58.js";import{n as Z}from"./copy-CA4fP28I.js";import{r as ha}from"./useRunCells-D5wCIJdU.js";import{a as pa}from"./cell-link-BEnixmCb.js";import{a as ma}from"./renderShortcut-CnD1Dah5.js";import{t as ua}from"./icons-CrUXojcA.js";import{t as fa}from"./links-CIQwYQ48.js";import{r as ya,t as Ee}from"./hooks-W-qT5c6l.js";import{t as Le}from"./types-BfP_kuAY.js";var ka=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ba=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Te=h("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"}]]),He=h("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"}]]),qe=h("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"}]]),xa=h("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"}]]),wa=h("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"}]]),ga=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Re=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ja=h("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"}]]),va=h("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"}]]),Ca=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Be=h("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"}]]),za=h("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"}]]),Ma=h("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"}]]),Fe=h("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"}]]),Ve=_(),ye=we(et(),1),a=we(wt(),1),Q="https://static.marimo.app";const Wa=e=>{let t=(0,Ve.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Q}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let P=await r({download:!1,includeCode:!0,files:jt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Q}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:P,path:l})}).catch(()=>{z.dismiss(),C({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:A.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ia,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(na,{children:[m,(0,a.jsxs)(ra,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:Q,target:"_blank",children:Q}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Ft,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Sa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Z(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(sa,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(la,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Sa=e=>{let t=(0,Ve.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=gt.stopPropagation(async m=>{m.preventDefault(),await Z(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(pe,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(ea,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Da=_();function _a(){let e=document.getElementsByClassName(Me.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=ce.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${Me.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ye(){let e=(0,Da.c)(2),t=L(Ie),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ta(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Oe=Xe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=We(),{setLayoutView:n}=Se();if(he()&&!ct("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Qt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Jt,{children:(0,a.jsxs)(Zt,{children:[(0,a.jsx)(Ut,{children:"View as"}),Le.map(Ea)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Xt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ia(e){return(0,a.jsx)(Ke(e),{className:"h-4 w-4"})}function Ke(e){switch(e){case"vertical":return ja;case"grid":return Lt;case"slides":return Be;default:return mt(e),qt}}function Ue(e){return ve(e)}function Ea(e){return(0,a.jsx)(Gt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ia(e),(0,a.jsx)("span",{children:Ue(e)})]})},e)}async function La(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ta=_();function Ha(e){let t=(0,Ta.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Pe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Pe.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),fa(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const qa=()=>{let{updateCellConfig:e}=ge(),{saveCellConfig:t}=H();return(0,ye.useCallback)(async()=>{let n=new tt,o=je(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=ze.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ra=_();function $e(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(bt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(oa,{onClick:async()=>{n({state:xt.CLOSING}),await o(),da()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ba=_(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Fa(){var be,xe;let e=(0,Ba.c)(51),t=pa(),{openModal:n,closeModal:o}=fe(),{toggleApplication:s}=lt(),{selectedPanel:r}=dt(),[l]=Qe(Ie),i=de(aa),d=qa(),[m]=kt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=$e(),x=ha(),j=Ha(t),v=L(Oe),P=L(ft),z=L(yt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=H(),W=ya(),oe=de(it),ne=de(pt),{selectedLayout:q}=We(),{setLayoutView:ie}=Se(),R=Ye(),B=((be=m.sharing)==null?void 0:be.html)??!0,F=((xe=m.sharing)==null?void 0:xe.wasm)??!0,ke=!he(),se=q==="slides",Ge=so,Je=io,V;e[0]!==t||e[1]!==W||e[2]!==M?(V=async c=>{let{preset:p,title:E}=c;if(!t){X();return}await Ne(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Ct})})},e[0]=t,e[1]=W,e[2]=M,e[3]=V):V=e[3];let S=V,Y;e[4]===S?Y=e[5]:(Y=async()=>{if(ke){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(no,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=Y);let O=Y,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){X();return}await Ne("Downloading IPYNB...",async c=>{await Ee({takeScreenshots:()=>W({progress:c}),updateCellOutputs:M});let p=await ee({download:!1});ue(new Blob([p],{type:"application/x-ipynb+json"}),me.toIPYNB(document.title))})},e[6]=ee,e[7]=t,e[8]=W,e[9]=M,e[10]=K):K=e[10];let le=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let $;e[12]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(De,{size:14,strokeWidth:1.5}),e[12]=$):$=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){X();return}await _e({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let G;return e[15]!==f||e[16]!==ne||e[17]!==u||e[18]!==o||e[19]!==y||e[20]!==j||e[21]!==S||e[22]!==k||e[23]!==te||e[24]!==t||e[25]!==O||e[26]!==le||e[27]!==oe||e[28]!==d||e[29]!==se||e[30]!==i||e[31]!==n||e[32]!==I||e[33]!==b||e[34]!==x||e[35]!==ae||e[36]!==q||e[37]!==r||e[38]!==v||e[39]!==z||e[40]!==ie||e[41]!==P||e[42]!==B||e[43]!==F||e[44]!==D||e[45]!==s||e[46]!==R||e[47]!==g||e[48]!==w||e[49]!==l.mode?(G=[{icon:U,label:"Download",handle:N,dropdown:[{icon:$,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){X();return}await _e({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ua,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await te({download:!1});ue(new Blob([c],{type:"text/plain"}),me.toMarkdown(document.title))}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:le},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await I();ue(new Blob([c.contents],{type:"text/plain"}),me.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ma("global.hideCode",!1)]}),handle:oo},se?{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:O},{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Je(!0),hidden:!ke,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:O}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Wa,{onClose:o}))}},{icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await Z(ca({code:(await I()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:ht.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Ze}=c;return re?[]:{label:ve(p),rightElement:Ge(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Ze}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Yt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Le.map((c,p)=>{let E=Ke(c);return{divider:p===0,label:Ue(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:q===c&&(0,a.jsx)(Ae,{size:14})}),handle:()=>{ie(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||he(),handle:j},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await Z((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=at(je());await ae({configs:ze.fromEntries(c.map(ao))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Ce,{onClose:o}))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Ce,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ne||i,handle:()=>{g()}},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(rt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(He,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(to)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(eo)},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Xa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Qa},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Za},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ga},{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:"Changelog",handle:$a}]},{divider:!0,icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Oa).map(Va),e[15]=f,e[16]=ne,e[17]=u,e[18]=o,e[19]=y,e[20]=j,e[21]=S,e[22]=k,e[23]=te,e[24]=t,e[25]=O,e[26]=le,e[27]=oe,e[28]=d,e[29]=se,e[30]=i,e[31]=n,e[32]=I,e[33]=b,e[34]=x,e[35]=ae,e[36]=q,e[37]=r,e[38]=v,e[39]=z,e[40]=ie,e[41]=P,e[42]=B,e[43]=F,e[44]=D,e[45]=s,e[46]=R,e[47]=g,e[48]=w,e[49]=l.mode,e[50]=G):G=e[50],G}function Va(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ya)}:e}function Ya(e){return!e.hidden}function Oa(e){return!e.hidden}function Ka(){let e=Kt();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function $a(){window.open(A.releasesPage,"_blank")}function Ga(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Za(){window.open(A.githubPage,"_blank")}function Qa(){window.open(A.docsPage,"_blank")}function Xa(e){return!e}function eo(e){return!e}function to(e){return!e}function ao(e){return[e,{disabled:!1}]}async function oo(){let e=document.getElementById("App");e&&await zt({element:e,filename:document.title,prepare:Mt})}function no(){return window.print()}function io(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function so(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ae,{size:14})})}function X(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ye as a,qe as c,Oe as i,He as l,$e as n,Fe as o,Pa as r,Re as s,Fa as t,Te as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as g,n as i,p as k}from"./useEvent-O0nX5vok.js";import{
|
|
1
|
+
import{d as g,n as i,p as k}from"./useEvent-O0nX5vok.js";import{Ar as v,E as y,Er as F,h as d,st as b,wn as E}from"./cells-DqKJsMUm.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{m as A}from"./useEventListener-Dy81QR4n.js";import{o as D}from"./dist-D0Vj4Kqc.js";import{r as H}from"./requests-Bgjtqo_1.js";var u=x();const w=k(!1);function V(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(v(d())),r[0]=n,r[1]=t),i(t)}function _(r){let n=(0,u.c)(3),t=f(),e;return n[0]!==r||n[1]!==t?(e=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=e):e=n[2],i(e)}function j(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(F(d())),r[0]=n,r[1]=t),i(t)}function f(){let r=(0,u.c)(4),{prepareForRun:n}=y(),{sendRun:t}=H(),e=g(w),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=d();return e(!0),I({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=e,r[3]=o):o=r[3],i(o)}async function I({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,h,R;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(h=(m=o[a])==null?void 0:m.current)==null?void 0:h.editorView,p;l?(E(l)!=="markdown"&&D(l),p=b(l)):p=((R=s[a])==null?void 0:R.code)||"",c.push(p),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{A.error(a)})}export{f as a,_ as i,I as n,V as o,j as r,w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-O0nX5vok.js";import{E as d,f,st as u}from"./cells-
|
|
1
|
+
import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-O0nX5vok.js";import{E as d,f,st as u}from"./cells-DqKJsMUm.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-icT_Ltz2.js";import{t as h}from"./use-toast-Hc8CXlvz.js";import{r as v}from"./useDeleteCell-B4nKRnTM.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:s,undoSplitCell:i}=d(),o;return t[0]!==s||t[1]!==i?(o=r=>{let l=f(r.cellId);if(!l)return;let a=u(l);s(r);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{i({...r,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=s,t[1]=i,t[2]=o):o=t[2],p(o)}export{j 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-BSzIstPK.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/clsx-BDxNtGmi.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/cn-BoaCR37F.js">
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
<link rel="modulepreload" crossorigin href="./assets/toInteger-CO3ppIfA.js">
|
|
135
135
|
<link rel="modulepreload" crossorigin href="./assets/database-zap-DTWCDKdn.js">
|
|
136
136
|
<link rel="modulepreload" crossorigin href="./assets/main-DrBRErTM.js">
|
|
137
|
-
<link rel="modulepreload" crossorigin href="./assets/cells-
|
|
137
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-DqKJsMUm.js">
|
|
138
138
|
<link rel="modulepreload" crossorigin href="./assets/spinner-C5JoisA7.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-D0GQBpTb.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-DdPu5Kfu.js">
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
<link rel="modulepreload" crossorigin href="./assets/dist-BhNN2V5a.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/label-TNNaT1M9.js">
|
|
150
150
|
<link rel="modulepreload" crossorigin href="./assets/useDebounce-B0dx2Gp0.js">
|
|
151
|
-
<link rel="modulepreload" crossorigin href="./assets/azure-
|
|
151
|
+
<link rel="modulepreload" crossorigin href="./assets/azure-BeB26UeM.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/numbers-CYnquDho.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/SSRProvider-DC7ElCZZ.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/context-CIAP2NOh.js">
|
|
@@ -157,9 +157,9 @@
|
|
|
157
157
|
<link rel="modulepreload" crossorigin href="./assets/input-CUwqpKjd.js">
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/links-DzgPOFJ-.js">
|
|
159
159
|
<link rel="modulepreload" crossorigin href="./assets/popover-BPGG2gPG.js">
|
|
160
|
-
<link rel="modulepreload" crossorigin href="./assets/switch-
|
|
160
|
+
<link rel="modulepreload" crossorigin href="./assets/switch-O_7alg7G.js">
|
|
161
161
|
<link rel="modulepreload" crossorigin href="./assets/table-BhH-Mm8O.js">
|
|
162
|
-
<link rel="modulepreload" crossorigin href="./assets/mode-
|
|
162
|
+
<link rel="modulepreload" crossorigin href="./assets/mode-Bn_XF6AW.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-D-4ifFXh.js">
|
|
164
164
|
<link rel="modulepreload" crossorigin href="./assets/errors-Bfogio62.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="./assets/error-banner-BRG6IPhC.js">
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-CHAHPgkx.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-CAoNMkjq.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-qZo1ox6x.js">
|
|
175
|
-
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-
|
|
175
|
+
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-DgMZ5T_L.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-OkOxlkkM.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/precisionRound-BOmLQIKI.js">
|
|
178
178
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-DK1MWd7f.js">
|
|
@@ -181,21 +181,21 @@
|
|
|
181
181
|
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-Ba0LbbH4.js">
|
|
182
182
|
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-C9V-on2J.js">
|
|
183
183
|
<link rel="modulepreload" crossorigin href="./assets/ImperativeModal-qEtcJ95s.js">
|
|
184
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
185
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
186
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
187
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
184
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-BEnixmCb.js">
|
|
185
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-Bo8w993m.js">
|
|
186
|
+
<link rel="modulepreload" crossorigin href="./assets/state-CJ2HIW-e.js">
|
|
187
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-hYOXA8Ml.js">
|
|
188
188
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-C6n2vWSW.js">
|
|
189
|
-
<link rel="modulepreload" crossorigin href="./assets/html-to-image-
|
|
190
|
-
<link rel="modulepreload" crossorigin href="./assets/focus-
|
|
189
|
+
<link rel="modulepreload" crossorigin href="./assets/html-to-image-CoMmxXBd.js">
|
|
190
|
+
<link rel="modulepreload" crossorigin href="./assets/focus-B85PAbhR.js">
|
|
191
191
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-Dmh6kfiy.js">
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-CM1a_K7I.js">
|
|
193
193
|
<link rel="modulepreload" crossorigin href="./assets/katex-rvFxOCU-.js">
|
|
194
|
-
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-
|
|
195
|
-
<link rel="modulepreload" crossorigin href="./assets/command-
|
|
196
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
197
|
-
<link rel="modulepreload" crossorigin href="./assets/useRunCells-
|
|
198
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
194
|
+
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-CNaYgTOF.js">
|
|
195
|
+
<link rel="modulepreload" crossorigin href="./assets/command-DpusMohg.js">
|
|
196
|
+
<link rel="modulepreload" crossorigin href="./assets/download-DtyAt8iO.js">
|
|
197
|
+
<link rel="modulepreload" crossorigin href="./assets/useRunCells-D5wCIJdU.js">
|
|
198
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-DduaBOBv.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-DTN9kFDq.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/formats-rhOJovGE.js">
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/en-US-BO8E69bZ.js">
|
|
@@ -207,42 +207,42 @@
|
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-CpE7XQLs.js">
|
|
208
208
|
<link rel="modulepreload" crossorigin href="./assets/range-CJeRXUtp.js">
|
|
209
209
|
<link rel="modulepreload" crossorigin href="./assets/table-BCnp9gKC.js">
|
|
210
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
211
|
-
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-
|
|
210
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-BIbkaOuk.js">
|
|
211
|
+
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-B4nKRnTM.js">
|
|
212
212
|
<link rel="modulepreload" crossorigin href="./assets/icons-CrUXojcA.js">
|
|
213
|
-
<link rel="modulepreload" crossorigin href="./assets/process-output-
|
|
213
|
+
<link rel="modulepreload" crossorigin href="./assets/process-output-BewZuQwI.js">
|
|
214
214
|
<link rel="modulepreload" crossorigin href="./assets/blob-CObhN-9g.js">
|
|
215
215
|
<link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-DP4vAkvg.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/esm-CBkHtTOV.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/file-DzHkbIdO.js">
|
|
218
218
|
<link rel="modulepreload" crossorigin href="./assets/image-DXfkah9d.js">
|
|
219
219
|
<link rel="modulepreload" crossorigin href="./assets/play-DKSqmedg.js">
|
|
220
|
-
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-
|
|
220
|
+
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-Cbktc1B0.js">
|
|
221
221
|
<link rel="modulepreload" crossorigin href="./assets/isEmpty-CfmnKtgL.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/bot-message-square-CK6eoGWy.js">
|
|
223
|
-
<link rel="modulepreload" crossorigin href="./assets/chat-display-
|
|
223
|
+
<link rel="modulepreload" crossorigin href="./assets/chat-display-B0hV2K6L.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-DV8gdCvH.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/square-function-B006EYFX.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/spec-DbmSqx09.js">
|
|
227
227
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-CAB7tdza.js">
|
|
228
|
-
<link rel="modulepreload" crossorigin href="./assets/components-
|
|
229
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
228
|
+
<link rel="modulepreload" crossorigin href="./assets/components-C4dDqD7U.js">
|
|
229
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-CVqBaB8R.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/toggle-RCwU-rnE.js">
|
|
231
|
-
<link rel="modulepreload" crossorigin href="./assets/globals-
|
|
231
|
+
<link rel="modulepreload" crossorigin href="./assets/globals-C_t1YYpc.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/share-BdH_5I58.js">
|
|
233
233
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-D5BgdrnX.js">
|
|
234
234
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-DDRqG5ui.js">
|
|
235
|
-
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-
|
|
236
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
237
|
-
<link rel="modulepreload" crossorigin href="./assets/useAddCell-
|
|
235
|
+
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-DEVrXLoa.js">
|
|
236
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-B86gVj23.js">
|
|
237
|
+
<link rel="modulepreload" crossorigin href="./assets/useAddCell-BpBkEpP6.js">
|
|
238
238
|
<link rel="modulepreload" crossorigin href="./assets/eye-off-vwi9L975.js">
|
|
239
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
239
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-BgTK_w0H.js">
|
|
240
240
|
<link rel="modulepreload" crossorigin href="./assets/file-headphone-B5q2Ow55.js">
|
|
241
|
-
<link rel="modulepreload" crossorigin href="./assets/file-icons-
|
|
241
|
+
<link rel="modulepreload" crossorigin href="./assets/file-icons-D4HcGlr_.js">
|
|
242
242
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DLpfIr8v.js">
|
|
243
|
-
<link rel="modulepreload" crossorigin href="./assets/form
|
|
243
|
+
<link rel="modulepreload" crossorigin href="./assets/form--K3o18rQ.js">
|
|
244
244
|
<link rel="modulepreload" crossorigin href="./assets/field-B1jGbQlH.js">
|
|
245
|
-
<link rel="modulepreload" crossorigin href="./assets/useBoolean-
|
|
245
|
+
<link rel="modulepreload" crossorigin href="./assets/useBoolean-Cb23qnhy.js">
|
|
246
246
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-yyiB9aJX.js">
|
|
247
247
|
<link rel="modulepreload" crossorigin href="./assets/types-C1RN112u.js">
|
|
248
248
|
<link rel="modulepreload" crossorigin href="./assets/prop-types-RrUi-pOT.js">
|
package/package.json
CHANGED
|
@@ -22,16 +22,16 @@ export const MockNotebook = {
|
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
notebookState: (opts?: {
|
|
25
|
-
cellData: Record<
|
|
26
|
-
cellRuntime?: Record<
|
|
25
|
+
cellData: Record<CellId, Partial<CellData>>;
|
|
26
|
+
cellRuntime?: Record<CellId, Partial<CellRuntimeState>>;
|
|
27
27
|
}): NotebookState => {
|
|
28
|
-
const cellData = opts?.cellData
|
|
29
|
-
const cellRuntime = opts?.cellRuntime
|
|
28
|
+
const cellData = opts?.cellData ?? {};
|
|
29
|
+
const cellRuntime = opts?.cellRuntime ?? {};
|
|
30
30
|
return {
|
|
31
|
-
cellData: Objects.mapValues(cellData, (data,
|
|
32
|
-
id:
|
|
31
|
+
cellData: Objects.mapValues(cellData, (data, cid) => ({
|
|
32
|
+
id: cid,
|
|
33
33
|
code: "",
|
|
34
|
-
name: `cell-${
|
|
34
|
+
name: `cell-${cid}`,
|
|
35
35
|
config: {
|
|
36
36
|
hide_code: false,
|
|
37
37
|
disabled: false,
|
|
@@ -45,8 +45,8 @@ export const MockNotebook = {
|
|
|
45
45
|
...data,
|
|
46
46
|
})),
|
|
47
47
|
cellIds: MultiColumn.from([Object.keys(cellData) as CellId[]]),
|
|
48
|
-
cellRuntime: Objects.mapValues(cellData, (_data,
|
|
49
|
-
createCellRuntimeState({ ...cellRuntime[
|
|
48
|
+
cellRuntime: Objects.mapValues(cellData, (_data, cid) =>
|
|
49
|
+
createCellRuntimeState({ ...cellRuntime[cid] }),
|
|
50
50
|
),
|
|
51
51
|
cellHandles: Objects.mapValues(cellData, (_data) => createRef()),
|
|
52
52
|
cellLogs: [],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Test-only helpers for constructing branded ID types from plain strings.
|
|
5
|
+
*
|
|
6
|
+
* In production code, branded types flow from the API (via codegen) or
|
|
7
|
+
* from designated creation points (e.g. CellId.create()). Tests need to
|
|
8
|
+
* construct these from string literals, which requires a cast. These
|
|
9
|
+
* helpers centralise that cast so test files don't scatter `as CellId`
|
|
10
|
+
* everywhere.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { CellId, UIElementId } from "@/core/cells/ids";
|
|
14
|
+
import type { RequestId } from "@/core/network/DeferredRequestRegistry";
|
|
15
|
+
import type { VariableName } from "@/core/variables/types";
|
|
16
|
+
|
|
17
|
+
export const cellId = (s: string) => s as CellId;
|
|
18
|
+
export const variableName = (s: string) => s as VariableName;
|
|
19
|
+
export const requestId = (s: string) => s as RequestId;
|
|
20
|
+
export const uiElementId = (s: string) => s as UIElementId;
|
|
@@ -12,7 +12,7 @@ vi.mock("@/utils/storage/storage", () => ({
|
|
|
12
12
|
},
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import { cellId } from "@/__tests__/branded";
|
|
16
16
|
import { availableStorage } from "@/utils/storage/storage";
|
|
17
17
|
import { ChartSchema } from "../schemas";
|
|
18
18
|
import type { TabName } from "../storage";
|
|
@@ -37,7 +37,7 @@ describe("Chart Transforms Storage", () => {
|
|
|
37
37
|
|
|
38
38
|
it("should store and retrieve tab data", () => {
|
|
39
39
|
const store = getDefaultStore();
|
|
40
|
-
const
|
|
40
|
+
const cid = cellId("cell-1");
|
|
41
41
|
const tabData = {
|
|
42
42
|
tabName: "Tab 1" as TabName,
|
|
43
43
|
chartType: ChartType.LINE,
|
|
@@ -51,17 +51,17 @@ describe("Chart Transforms Storage", () => {
|
|
|
51
51
|
|
|
52
52
|
// Set the atom value
|
|
53
53
|
const newMap = new Map();
|
|
54
|
-
newMap.set(
|
|
54
|
+
newMap.set(cid, [tabData]);
|
|
55
55
|
store.set(tabsStorageAtom, newMap);
|
|
56
56
|
|
|
57
57
|
// Verify the value was set
|
|
58
58
|
const retrievedValue = store.get(tabsStorageAtom);
|
|
59
|
-
expect(retrievedValue.get(
|
|
59
|
+
expect(retrievedValue.get(cid)).toEqual([tabData]);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it("should handle multiple tabs for the same cell", () => {
|
|
63
63
|
const store = getDefaultStore();
|
|
64
|
-
const
|
|
64
|
+
const cid = cellId("cell-1");
|
|
65
65
|
const tabData1 = {
|
|
66
66
|
tabName: "Tab 1" as TabName,
|
|
67
67
|
chartType: ChartType.LINE,
|
|
@@ -85,12 +85,12 @@ describe("Chart Transforms Storage", () => {
|
|
|
85
85
|
|
|
86
86
|
// Set the atom value
|
|
87
87
|
const newMap = new Map();
|
|
88
|
-
newMap.set(
|
|
88
|
+
newMap.set(cid, [tabData1, tabData2]);
|
|
89
89
|
store.set(tabsStorageAtom, newMap);
|
|
90
90
|
|
|
91
91
|
// Verify the value was set
|
|
92
92
|
const retrievedValue = store.get(tabsStorageAtom);
|
|
93
|
-
expect(retrievedValue.get(
|
|
93
|
+
expect(retrievedValue.get(cid)).toEqual([tabData1, tabData2]);
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
|
|
@@ -5,9 +5,9 @@ import { beforeAll, describe, expect, it } from "vitest";
|
|
|
5
5
|
import { SetupMocks } from "@/__mocks__/common";
|
|
6
6
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
7
7
|
import { MockRequestClient } from "@/__mocks__/requests";
|
|
8
|
+
import { cellId } from "@/__tests__/branded";
|
|
8
9
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
9
10
|
import { notebookAtom } from "@/core/cells/cells";
|
|
10
|
-
import type { CellId } from "@/core/cells/ids";
|
|
11
11
|
import { createCellRuntimeState } from "@/core/cells/types";
|
|
12
12
|
import type { UserConfig } from "@/core/config/config-schema";
|
|
13
13
|
import type { OutputMessage } from "@/core/kernel/messages";
|
|
@@ -39,7 +39,7 @@ describe("Cell data attributes", () => {
|
|
|
39
39
|
"present",
|
|
40
40
|
])("should render cell with data-cell-id and data-cell-name in %s mode", (mode) => {
|
|
41
41
|
const { store, wrapper } = createTestWrapper();
|
|
42
|
-
const
|
|
42
|
+
const cid = cellId("test");
|
|
43
43
|
const cellName = "test_cell";
|
|
44
44
|
|
|
45
45
|
const userConfig: UserConfig = {
|
|
@@ -83,7 +83,7 @@ describe("Cell data attributes", () => {
|
|
|
83
83
|
|
|
84
84
|
const notebook = MockNotebook.notebookState({
|
|
85
85
|
cellData: {
|
|
86
|
-
[
|
|
86
|
+
[cid]: {
|
|
87
87
|
code: "",
|
|
88
88
|
name: cellName,
|
|
89
89
|
edited: false,
|
|
@@ -97,7 +97,7 @@ describe("Cell data attributes", () => {
|
|
|
97
97
|
},
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
notebook.cellRuntime[
|
|
100
|
+
notebook.cellRuntime[cid] = createCellRuntimeState({
|
|
101
101
|
status: "idle",
|
|
102
102
|
output: null,
|
|
103
103
|
consoleOutputs: [],
|
|
@@ -117,7 +117,7 @@ describe("Cell data attributes", () => {
|
|
|
117
117
|
const { container } = render(
|
|
118
118
|
<TooltipProvider>
|
|
119
119
|
<Cell
|
|
120
|
-
cellId={
|
|
120
|
+
cellId={cid}
|
|
121
121
|
mode={mode as AppMode}
|
|
122
122
|
canDelete={true}
|
|
123
123
|
userConfig={userConfig}
|
|
@@ -131,7 +131,7 @@ describe("Cell data attributes", () => {
|
|
|
131
131
|
{ wrapper },
|
|
132
132
|
);
|
|
133
133
|
|
|
134
|
-
const cellElement = container.querySelector(`[data-cell-id="${
|
|
134
|
+
const cellElement = container.querySelector(`[data-cell-id="${cid}"]`);
|
|
135
135
|
expect(cellElement).toBeTruthy();
|
|
136
136
|
expect(cellElement?.getAttribute("data-cell-name")).toBe(cellName);
|
|
137
137
|
});
|
|
@@ -139,7 +139,7 @@ describe("Cell data attributes", () => {
|
|
|
139
139
|
|
|
140
140
|
describe("Output data attributes", () => {
|
|
141
141
|
it("should render output with data-cell-role", () => {
|
|
142
|
-
const
|
|
142
|
+
const cid = cellId("test");
|
|
143
143
|
const output: OutputMessage = {
|
|
144
144
|
channel: "output",
|
|
145
145
|
mimetype: "text/plain",
|
|
@@ -151,7 +151,7 @@ describe("Output data attributes", () => {
|
|
|
151
151
|
<TooltipProvider>
|
|
152
152
|
<OutputArea
|
|
153
153
|
output={output}
|
|
154
|
-
cellId={
|
|
154
|
+
cellId={cid}
|
|
155
155
|
stale={false}
|
|
156
156
|
loading={false}
|
|
157
157
|
allowExpand={true}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
import { beforeEach, describe, expect, it, type Mock, vi } from "vitest";
|
|
3
|
+
import { variableName } from "@/__tests__/branded";
|
|
3
4
|
import { getCodes } from "@/core/codemirror/copilot/getCodes";
|
|
4
5
|
import { dataSourceConnectionsAtom } from "@/core/datasets/data-source-connections";
|
|
5
6
|
import { DUCKDB_ENGINE } from "@/core/datasets/engines";
|
|
@@ -7,7 +8,6 @@ import { datasetsAtom } from "@/core/datasets/state";
|
|
|
7
8
|
import type { DatasetsState } from "@/core/datasets/types";
|
|
8
9
|
import { store } from "@/core/state/jotai";
|
|
9
10
|
import { variablesAtom } from "@/core/variables/state";
|
|
10
|
-
import type { Variable, VariableName } from "@/core/variables/types";
|
|
11
11
|
import { codeToCells, getAICompletionBody } from "../completion-utils";
|
|
12
12
|
|
|
13
13
|
// Mock getCodes function
|
|
@@ -205,16 +205,16 @@ describe("getAICompletionBody", () => {
|
|
|
205
205
|
|
|
206
206
|
it("should return the correct completion body with mentioned variables", () => {
|
|
207
207
|
// Set up test data in the Jotai store
|
|
208
|
-
const testVariables
|
|
209
|
-
["var1"
|
|
210
|
-
name: "var1"
|
|
208
|
+
const testVariables = {
|
|
209
|
+
[variableName("var1")]: {
|
|
210
|
+
name: variableName("var1"),
|
|
211
211
|
value: "string value",
|
|
212
212
|
dataType: "string",
|
|
213
213
|
declaredBy: [],
|
|
214
214
|
usedBy: [],
|
|
215
215
|
},
|
|
216
|
-
["var2"
|
|
217
|
-
name: "var2"
|
|
216
|
+
[variableName("var2")]: {
|
|
217
|
+
name: variableName("var2"),
|
|
218
218
|
value: "42",
|
|
219
219
|
dataType: "number",
|
|
220
220
|
declaredBy: [],
|
|
@@ -253,9 +253,9 @@ describe("getAICompletionBody", () => {
|
|
|
253
253
|
];
|
|
254
254
|
store.set(datasetsAtom, { tables: testDatasets } as DatasetsState);
|
|
255
255
|
|
|
256
|
-
const testVariables
|
|
257
|
-
["var1"
|
|
258
|
-
name: "var1"
|
|
256
|
+
const testVariables = {
|
|
257
|
+
[variableName("var1")]: {
|
|
258
|
+
name: variableName("var1"),
|
|
259
259
|
value: "string value",
|
|
260
260
|
dataType: "string",
|
|
261
261
|
declaredBy: [],
|
|
@@ -285,9 +285,9 @@ describe("getAICompletionBody", () => {
|
|
|
285
285
|
|
|
286
286
|
it("should handle non-existent variables", () => {
|
|
287
287
|
// Set up test data in the Jotai store
|
|
288
|
-
const testVariables
|
|
289
|
-
["existingVar"
|
|
290
|
-
name: "existingVar"
|
|
288
|
+
const testVariables = {
|
|
289
|
+
[variableName("existingVar")]: {
|
|
290
|
+
name: variableName("existingVar"),
|
|
291
291
|
value: "string value",
|
|
292
292
|
dataType: "string",
|
|
293
293
|
declaredBy: [],
|
|
@@ -322,9 +322,9 @@ describe("getAICompletionBody", () => {
|
|
|
322
322
|
];
|
|
323
323
|
store.set(datasetsAtom, { tables: testDatasets } as DatasetsState);
|
|
324
324
|
|
|
325
|
-
const testVariables
|
|
326
|
-
["conflict"
|
|
327
|
-
name: "conflict"
|
|
325
|
+
const testVariables = {
|
|
326
|
+
[variableName("conflict")]: {
|
|
327
|
+
name: variableName("conflict"),
|
|
328
328
|
value: "string value",
|
|
329
329
|
dataType: "string",
|
|
330
330
|
declaredBy: [],
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { act, renderHook } from "@testing-library/react";
|
|
5
5
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
6
|
import { asMock, MockModules, Mocks, SetupMocks } from "@/__mocks__/common";
|
|
7
|
+
import { cellId } from "@/__tests__/branded";
|
|
7
8
|
import type { CellActions, NotebookState } from "@/core/cells/cells";
|
|
8
|
-
import type { CellId } from "@/core/cells/ids";
|
|
9
9
|
import { useCellClipboard } from "../clipboard";
|
|
10
10
|
|
|
11
11
|
// Mock dependencies
|
|
@@ -179,7 +179,7 @@ describe("useCellClipboard", () => {
|
|
|
179
179
|
});
|
|
180
180
|
|
|
181
181
|
it("should filter out non-existent cells", async () => {
|
|
182
|
-
const nonExistentCellId = "non-existent"
|
|
182
|
+
const nonExistentCellId = cellId("non-existent");
|
|
183
183
|
|
|
184
184
|
const { result } = renderHook(() => useCellClipboard());
|
|
185
185
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
2
3
|
import { beforeEach, describe, expect, it } from "vitest";
|
|
3
|
-
import
|
|
4
|
+
import { cellId } from "@/__tests__/branded";
|
|
4
5
|
import { MultiColumn } from "@/utils/id-tree";
|
|
5
6
|
import type { CellSelectionState } from "../selection";
|
|
6
7
|
import { exportedForTesting } from "../selection";
|
|
@@ -8,11 +9,11 @@ import { exportedForTesting } from "../selection";
|
|
|
8
9
|
const { initialState, reducer, createActions } = exportedForTesting;
|
|
9
10
|
|
|
10
11
|
const CellIds = {
|
|
11
|
-
a: "a"
|
|
12
|
-
b: "b"
|
|
13
|
-
c: "c"
|
|
14
|
-
d: "d"
|
|
15
|
-
e: "e"
|
|
12
|
+
a: cellId("a"),
|
|
13
|
+
b: cellId("b"),
|
|
14
|
+
c: cellId("c"),
|
|
15
|
+
d: cellId("d"),
|
|
16
|
+
e: cellId("e"),
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
describe("cell selection reducer", () => {
|