@marimo-team/frontend 0.16.0 → 0.16.1
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/ConnectedDataExplorerComponent-2wVcyvDj.js +19 -0
- package/dist/assets/{ImageComparisonComponent-fTHv1Ih0.js → ImageComparisonComponent-D2j6i0hv.js} +1 -1
- package/dist/assets/{VegaLite-Bdi-TyfY.js → VegaLite-BckFaf2D.js} +1 -1
- package/dist/assets/_baseEach-CvTX9w0Y.js +1 -0
- package/dist/assets/_baseMap-CtlwA90f.js +1 -0
- package/dist/assets/_baseUniq-BKktIGQ1.js +1 -0
- package/dist/assets/{_createAggregator-DcD0kTA5.js → _createAggregator-C5CVY-0t.js} +1 -1
- package/dist/assets/{agent-panel-Crv430aI.js → agent-panel-RGLNjkYe.js} +76 -57
- package/dist/assets/{any-language-editor-CQh552Wu.js → any-language-editor-DjuXwGCA.js} +1 -1
- package/dist/assets/{architectureDiagram-W76B3OCA-BAJeBxzt.js → architectureDiagram-W76B3OCA-Dyj4ds_R.js} +1 -1
- package/dist/assets/{between-horizontal-start-Boxgxbt_.js → between-horizontal-start-Dt2aKpPf.js} +1 -1
- package/dist/assets/{blockDiagram-QIGZ2CNN-CL-1svEK.js → blockDiagram-QIGZ2CNN-o-i7DDvN.js} +1 -1
- package/dist/assets/{c4Diagram-FPNF74CW-BbEqbCTl.js → c4Diagram-FPNF74CW-DGHEwWrx.js} +1 -1
- package/dist/assets/channel-Co6iMgWq.js +1 -0
- package/dist/assets/chat-panel-9alr8FS4.js +3 -0
- package/dist/assets/{chunk-4BX2VUAB-C--8TXeE.js → chunk-4BX2VUAB-BJecb-Ri.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-Bj00HDqq.js → chunk-55IACEB6-CAATkc4w.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-C-lhB6hN.js → chunk-FMBD7UC4-DPuNbQ-f.js} +1 -1
- package/dist/assets/{chunk-K7UQS3LO-B-pGTXPt.js → chunk-K7UQS3LO-C8TWVLiH.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-DqUzGhvm.js → chunk-QN33PNHL-DiZZ09q4.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-TntJHfSk.js → chunk-QZHKN3VN-BIUM7usu.js} +1 -1
- package/dist/assets/{chunk-TVAH2DTR-HUJb1psV.js → chunk-TVAH2DTR-vGTArPBG.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-BK3C__t3.js → chunk-TZMSLE5B-D2KRqp_x.js} +1 -1
- package/dist/assets/{circle-play-DBLOv1Yu.js → circle-play-cjeNez0N.js} +1 -1
- package/dist/assets/classDiagram-KNZD7YFC-BbJ0rY3y.js +1 -0
- package/dist/assets/classDiagram-v2-RKCZMP56-BbJ0rY3y.js +1 -0
- package/dist/assets/{clear-button-BeoFbEKH.js → clear-button-C97JtAez.js} +1 -1
- package/dist/assets/clone-BMP0PsTa.js +1 -0
- package/dist/assets/{command-palette-CXZiSv0I.js → command-palette-B93Pjcky.js} +1 -1
- package/dist/assets/{common-C7oJcmCT.js → common-Du9rSOwD.js} +1 -1
- package/dist/assets/{compile-7L0MwhyI.js → compile-CZXqyOxa.js} +1 -1
- package/dist/assets/{cose-bilkent-S5V4N54A-BMkGLcVC.js → cose-bilkent-S5V4N54A-CqUN5Y9b.js} +1 -1
- package/dist/assets/{dagre-5GWH7T2D-BJtRienS.js → dagre-5GWH7T2D-RJqTI9DM.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-DBkmGtNs.js → data-grid-overlay-editor-DZN0q1LV.js} +1 -1
- package/dist/assets/datasources-panel-v7H3cR0p.js +1 -0
- package/dist/assets/{dependency-graph-panel-DEdOxp2X.js → dependency-graph-panel-CEog_O7V.js} +1 -1
- package/dist/assets/{diagram-N5W7TBWH-CmECY3nb.js → diagram-N5W7TBWH-D-l4zZ9d.js} +1 -1
- package/dist/assets/{diagram-QEK2KX5R-DMOVSNKD.js → diagram-QEK2KX5R-CCOmBUt-.js} +1 -1
- package/dist/assets/{diagram-S2PKOQOG-BiJ96PNQ.js → diagram-S2PKOQOG-C_I_9jnZ.js} +1 -1
- package/dist/assets/{documentation-panel-xULhaEv3.js → documentation-panel-C1BtMZ3M.js} +1 -1
- package/dist/assets/edit-page-B-oevUZ9.js +129 -0
- package/dist/assets/{ellipsis-vertical-BBqXIlc2.js → ellipsis-vertical-BEb-J8z6.js} +1 -1
- package/dist/assets/{empty-state-B3dA3G5P.js → empty-state-C99UyDE3.js} +1 -1
- package/dist/assets/{erDiagram-AWTI2OKA-MP1DiFRo.js → erDiagram-AWTI2OKA-BePOLi5M.js} +1 -1
- package/dist/assets/{error-panel-Cc1sv-Ag.js → error-panel-Bs34jXFh.js} +1 -1
- package/dist/assets/file-explorer-panel-Ck6UL861.js +1 -0
- package/dist/assets/{flowDiagram-PVAE7QVJ-BX7caPp7.js → flowDiagram-PVAE7QVJ-BgjFu5l7.js} +1 -1
- package/dist/assets/{ganttDiagram-OWAHRB6G-B462g4Yf.js → ganttDiagram-OWAHRB6G-YOPb3XSV.js} +4 -4
- package/dist/assets/{gitGraphDiagram-NY62KEGX-CGgvZ9-9.js → gitGraphDiagram-NY62KEGX-CGhqaDTy.js} +1 -1
- package/dist/assets/{glide-data-editor-C0gUFZON.js → glide-data-editor-9QUH6iso.js} +11 -11
- package/dist/assets/{graph-CHRVBzY5.js → graph-DQQFGrho.js} +1 -1
- package/dist/assets/home-page-DRKpPCrF.js +9 -0
- package/dist/assets/{index-C1v_Z9et.js → index-2252nrk6.js} +1 -1
- package/dist/assets/{index-CQDrxQ0j.js → index-Aeo6WiK7.js} +1 -1
- package/dist/assets/{index-C4Tn5NvJ.js → index-B8jXZ12t.js} +1 -1
- package/dist/assets/{index-DoRmcrKM.js → index-BAbIIxHU.js} +1 -1
- package/dist/assets/{index-BY93Ejhl.js → index-BJNCMUmG.js} +1 -1
- package/dist/assets/{index-CpTPJo4k.js → index-BW3k9Gss.js} +1 -1
- package/dist/assets/{index-D1vmG6DS.js → index-BjgnbONl.js} +1 -1
- package/dist/assets/{index-z9bohSQJ.js → index-BprjMYH5.js} +1 -1
- package/dist/assets/{index-BVgAenPd.js → index-C1ez98sk.js} +1 -1
- package/dist/assets/{index-D9UKkrr2.js → index-C2MD0vgD.js} +1 -1
- package/dist/assets/index-C7CoaNFb.js +578 -0
- package/dist/assets/{index-C-GhZ7ti.js → index-CFKO7WXI.js} +1 -1
- package/dist/assets/{index-lYa_leQE.js → index-CUFv_thQ.js} +1 -1
- package/dist/assets/{index-vmICa5KN.js → index-C_tkBKNO.js} +1 -1
- package/dist/assets/{index-C77h_TXN.js → index-CfaDbEdi.js} +1 -1
- package/dist/assets/{index-DEQvTChO.js → index-ClzeQrN7.js} +1 -1
- package/dist/assets/index-DadI618h.css +1 -0
- package/dist/assets/{index-DRMm6SNo.js → index-DdnKZNxM.js} +1 -1
- package/dist/assets/{index-CWMgowgL.js → index-G5QZppK2.js} +1 -1
- package/dist/assets/{index-Clbi_Yaq.js → index-SGLNXrGP.js} +1 -1
- package/dist/assets/{index-C-8WADat.js → index-aE43R74q.js} +1 -1
- package/dist/assets/infoDiagram-STP46IZ2-CJLOpSAf.js +2 -0
- package/dist/assets/{isEmpty-DU_ogP_D.js → isEmpty-D-4c7sMv.js} +1 -1
- package/dist/assets/{journeyDiagram-BIP6EPQ6-C6EgLP_Q.js → journeyDiagram-BIP6EPQ6-C94u3Mv3.js} +1 -1
- package/dist/assets/{kanban-definition-6OIFK2YF-BXzYO1yj.js → kanban-definition-6OIFK2YF-BEXYFzz7.js} +1 -1
- package/dist/assets/{layout-jihVw5-i.js → layout-Bz2BJ2ru.js} +1 -1
- package/dist/assets/{linear-C4blANlC.js → linear-D8s7K76e.js} +1 -1
- package/dist/assets/links-BpXlz1GG.js +7 -0
- package/dist/assets/{logs-panel-D401qzZh.js → logs-panel-DC7wpmPz.js} +1 -1
- package/dist/assets/{markdown-renderer-Cd9eYyaL.js → markdown-renderer-DRdSWR9X.js} +20 -20
- package/dist/assets/{mermaid-BEVuRz_O.js → mermaid-Y3x4hmD0.js} +1 -1
- package/dist/assets/{mermaid.core-CaSnaLH0.js → mermaid.core-DzthE35Y.js} +4 -4
- package/dist/assets/min-BBO3-1Hg.js +1 -0
- package/dist/assets/{mindmap-definition-Q6HEUPPD-BXUM5MT2.js → mindmap-definition-Q6HEUPPD-DktvuLe1.js} +1 -1
- package/dist/assets/{number-overlay-editor-4uWXGlPG.js → number-overlay-editor-BEfwI1IT.js} +1 -1
- package/dist/assets/outline-panel-CdsnAy2w.js +1 -0
- package/dist/assets/{packages-panel-CJL0MVlj.js → packages-panel-DiTA-d_D.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-Dxt5PVNo.js → pieDiagram-ADFJNKIX-DQDNQ-de.js} +1 -1
- package/dist/assets/{quadrantDiagram-LMRXKWRM-D4pUaA31.js → quadrantDiagram-LMRXKWRM-0kgIXc2-.js} +1 -1
- package/dist/assets/{react-plotly-cJZ0VWBq.js → react-plotly-DJqqfM7c.js} +1 -1
- package/dist/assets/{requirementDiagram-4UW4RH46-DVRTjgas.js → requirementDiagram-4UW4RH46-B5rb0ypd.js} +1 -1
- package/dist/assets/{run-page-BUEnMC9w.js → run-page-CFmLrv1R.js} +1 -1
- package/dist/assets/{sankeyDiagram-GR3RE2ED-CVFnD9C-.js → sankeyDiagram-GR3RE2ED-Dom7IlnF.js} +1 -1
- package/dist/assets/{scratchpad-panel-BIgRENkI.js → scratchpad-panel-CuHWpHO8.js} +1 -1
- package/dist/assets/{secrets-panel-xY5-V_BD.js → secrets-panel-CfHc5YD0.js} +1 -1
- package/dist/assets/{sequenceDiagram-C3RYC4MD-_lY4ZN_S.js → sequenceDiagram-C3RYC4MD-PNJWXQbw.js} +1 -1
- package/dist/assets/{slides-component-DMjQomc3.css → slides-component-C-LoGC1U.css} +1 -1
- package/dist/assets/{slides-component-Xjymwj7X.js → slides-component-CJgaTRZ0.js} +1 -1
- package/dist/assets/snippets-panel-B2EC1txM.js +1 -0
- package/dist/assets/sortBy-DZnlX29-.js +1 -0
- package/dist/assets/{state-C4NiC9tO.js → state-CWict9RU.js} +1 -1
- package/dist/assets/{stateDiagram-KXAO66HF-Da0JQWCn.js → stateDiagram-KXAO66HF-BE58aJnr.js} +1 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-CdThjimL.js +1 -0
- package/dist/assets/storage-DRaR04wR.js +26 -0
- package/dist/assets/{terminal-BPwTkXae.js → terminal-BX3Su5q7.js} +1 -1
- package/dist/assets/{time-Dv5_Ouz_.js → time-hUzZfpNE.js} +1 -1
- package/dist/assets/{timeline-definition-XQNQX7LJ-Dxh5Zu2e.js → timeline-definition-XQNQX7LJ-CqQP9t51.js} +1 -1
- package/dist/assets/tracing-B10Q1n-L.js +2 -0
- package/dist/assets/{tracing-panel-DAzrzNmm.js → tracing-panel-Du8WCnno.js} +2 -2
- package/dist/assets/{trash-Dc6DSjz_.js → trash-B81GTiv6.js} +1 -1
- package/dist/assets/{tree-jheoerAX.js → tree-6vW2ogkh.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-IgpxeGaf.js → treemap-75Q7IDZK-CdwDwwsz.js} +27 -27
- package/dist/assets/variable-panel-D5qgJI7k.js +1 -0
- package/dist/assets/{vega-component-BpfpiPKI.js → vega-component-DJaJWMJM.js} +1 -1
- package/dist/assets/worker-fHbtoWvT.js +1 -0
- package/dist/assets/{xychartDiagram-6GGTOJPD-CmNigJ31.js → xychartDiagram-6GGTOJPD-WFtXqaM9.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +3 -2
- package/src/components/app-config/user-config-form.tsx +46 -1
- package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +62 -43
- package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
- package/src/components/chat/acp/__tests__/state.test.ts +36 -36
- package/src/components/chat/acp/agent-panel.tsx +24 -27
- package/src/components/chat/acp/blocks.tsx +6 -6
- package/src/components/chat/acp/prompt.ts +62 -43
- package/src/components/chat/chat-panel.tsx +5 -1
- package/src/components/chat/markdown-renderer.tsx +6 -10
- package/src/components/chat/tool-call-accordion.tsx +52 -20
- package/src/components/data-table/SearchBar.tsx +8 -7
- package/src/components/data-table/__tests__/column_formatting.test.ts +50 -35
- package/src/components/data-table/__tests__/data-table.test.tsx +39 -1
- package/src/components/data-table/cell-hover-template/feature.ts +14 -0
- package/src/components/data-table/cell-hover-template/types.ts +11 -0
- package/src/components/data-table/charts/components/form-fields.tsx +41 -37
- package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +5 -2
- package/src/components/data-table/column-formatting/feature.ts +62 -29
- package/src/components/data-table/column-formatting/types.ts +1 -0
- package/src/components/data-table/column-header.tsx +3 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +24 -7
- package/src/components/data-table/column-summary/column-summary.tsx +18 -9
- package/src/components/data-table/columns.tsx +42 -18
- package/src/components/data-table/data-table.tsx +10 -2
- package/src/components/data-table/date-popover.tsx +85 -75
- package/src/components/data-table/filter-pills.tsx +14 -9
- package/src/components/data-table/header-items.tsx +5 -1
- package/src/components/data-table/pagination.tsx +20 -13
- package/src/components/data-table/renderers.tsx +28 -0
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +10 -8
- package/src/components/datasources/column-preview.tsx +6 -2
- package/src/components/datasources/datasources.tsx +8 -12
- package/src/components/editor/ai/transport/chat-transport.tsx +4 -1
- package/src/components/editor/cell/CellStatus.tsx +23 -20
- package/src/components/editor/cell/CreateCellButton.tsx +3 -4
- package/src/components/editor/cell/code/language-toggle.tsx +3 -4
- package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +39 -28
- package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
- package/src/components/editor/file-tree/requesting-tree.tsx +14 -8
- package/src/components/editor/renderers/CellArray.tsx +3 -4
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
- package/src/components/editor/renderers/slides-layout/types.ts +1 -0
- package/src/components/pages/home-page.tsx +4 -1
- package/src/components/slides/slides-component.tsx +1 -1
- package/src/components/slides/slides.css +6 -0
- package/src/components/terminal/theme.tsx +1 -0
- package/src/components/tracing/tracing-spec.ts +5 -4
- package/src/components/ui/range-slider.tsx +4 -2
- package/src/components/ui/slider.tsx +3 -1
- package/src/components/variables/variables-table.tsx +3 -0
- package/src/core/MarimoApp.tsx +9 -6
- package/src/core/ai/context/__tests__/registry.test.ts +6 -4
- package/src/core/ai/context/providers/cell-output.ts +3 -2
- package/src/core/ai/context/providers/error.ts +3 -1
- package/src/core/ai/context/providers/file.ts +7 -2
- package/src/core/ai/context/providers/tables.ts +3 -2
- package/src/core/ai/context/providers/variable.ts +6 -4
- package/src/core/ai/staged-cells.ts +34 -1
- package/src/core/cells/__tests__/add-missing-import.test.ts +67 -22
- package/src/core/cells/add-missing-import.ts +24 -7
- package/src/core/cells/cells.ts +26 -27
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
- package/src/core/codemirror/language/LanguageAdapters.ts +9 -3
- package/src/core/codemirror/lsp/notebook-lsp.ts +8 -2
- package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/rtc/loro/awareness.ts +52 -17
- package/src/core/codemirror/rtc/loro/sync.ts +12 -4
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/config/config.ts +4 -0
- package/src/core/hotkeys/hotkeys.ts +8 -4
- package/src/core/i18n/__tests__/locale-provider.test.tsx +176 -0
- package/src/core/i18n/locale-provider.tsx +35 -0
- package/src/core/i18n/with-locale.tsx +12 -0
- package/src/core/islands/components/web-components.tsx +13 -10
- package/src/core/kernel/RuntimeState.ts +4 -1
- package/src/core/kernel/messages.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +16 -4
- package/src/core/runtime/runtime.ts +5 -4
- package/src/core/wasm/bridge.ts +5 -1
- package/src/core/wasm/store.ts +4 -1
- package/src/core/wasm/worker/message-buffer.ts +3 -2
- package/src/core/websocket/types.ts +22 -16
- package/src/hooks/useFormatting.ts +97 -0
- package/src/hooks/useTimer.ts +8 -5
- package/src/plugins/core/registerReactComponent.tsx +16 -10
- package/src/plugins/impl/DataTablePlugin.tsx +4 -0
- package/src/plugins/impl/RangeSliderPlugin.tsx +5 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -1
- package/src/plugins/impl/anywidget/model.ts +16 -5
- package/src/plugins/impl/data-editor/types.ts +7 -5
- package/src/plugins/impl/data-explorer/components/column-summary.tsx +20 -13
- package/src/plugins/impl/panel/utils.ts +6 -4
- package/src/plugins/layout/OutlinePlugin.tsx +69 -0
- package/src/plugins/layout/StatPlugin.tsx +4 -1
- package/src/plugins/plugins.ts +2 -0
- package/src/utils/__tests__/dates.test.ts +45 -24
- package/src/utils/__tests__/numbers.test.ts +42 -30
- package/src/utils/__tests__/once.test.ts +187 -0
- package/src/utils/dates.ts +15 -10
- package/src/utils/edit-distance.ts +8 -6
- package/src/utils/errors.ts +1 -1
- package/src/utils/id-tree.tsx +21 -10
- package/src/utils/localStorage.ts +13 -4
- package/src/utils/numbers.ts +11 -11
- package/src/utils/once.ts +32 -0
- package/src/utils/paths.ts +4 -1
- package/src/utils/pluralize.ts +12 -5
- package/src/utils/python-poet/poet.ts +30 -15
- package/src/utils/time.ts +5 -1
- package/dist/assets/ConnectedDataExplorerComponent-BErMbWvG.js +0 -19
- package/dist/assets/_baseEach-CNBxBxvS.js +0 -1
- package/dist/assets/_baseMap-D1WHjKrd.js +0 -1
- package/dist/assets/_baseUniq-CCgDNtZb.js +0 -1
- package/dist/assets/channel-_2eNSz0n.js +0 -1
- package/dist/assets/chat-panel-CXh5Wl6C.js +0 -3
- package/dist/assets/classDiagram-KNZD7YFC-BGmh9POF.js +0 -1
- package/dist/assets/classDiagram-v2-RKCZMP56-BGmh9POF.js +0 -1
- package/dist/assets/clone-BFDSPAj3.js +0 -1
- package/dist/assets/datasources-panel-B7FbYLiy.js +0 -1
- package/dist/assets/edit-page-BrYda9VE.js +0 -129
- package/dist/assets/file-explorer-panel-Bw59Kva1.js +0 -1
- package/dist/assets/home-page-Fb2osjys.js +0 -9
- package/dist/assets/index-Cx0bsY1w.css +0 -1
- package/dist/assets/index-DKEudB02.js +0 -578
- package/dist/assets/infoDiagram-STP46IZ2-CVyrdLc8.js +0 -2
- package/dist/assets/links-D59GIweI.js +0 -7
- package/dist/assets/min-DUMu_zeK.js +0 -1
- package/dist/assets/outline-panel-DIzkvm2I.js +0 -1
- package/dist/assets/snippets-panel-CTPYW41n.js +0 -1
- package/dist/assets/sortBy-BNZKwiq_.js +0 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-D5lYZOOt.js +0 -1
- package/dist/assets/storage-CMdLzB_c.js +0 -26
- package/dist/assets/tracing-BCIurUfa.js +0 -2
- package/dist/assets/variable-panel-DYAiLBmF.js +0 -1
- package/dist/assets/worker-X5rxzQGQ.js +0 -1
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./terminal-BPwTkXae.js","./index-DKEudB02.js","./index-Cx0bsY1w.css","./state-C4NiC9tO.js","./links-D59GIweI.js","./links-5Ym3a_OV.css","./storage-CMdLzB_c.js","./index-CQDrxQ0j.js","./index-C77h_TXN.js","./index-D1vmG6DS.js","./index-lYa_leQE.js","./index-DRMm6SNo.js","./index-vmICa5KN.js","./index-BY93Ejhl.js","./index-C-GhZ7ti.js","./index-C-8WADat.js","./index-DoRmcrKM.js","./index-DEQvTChO.js","./index-CWMgowgL.js","./index-D9UKkrr2.js","./apl-CXdQSnD-.js","./asciiarmor-D5V0T9Cu.js","./asn1-DWPaVWf6.js","./brainfuck-CtZaYBKt.js","./cobol-stawOqaz.js","./clike-BgBwzOhw.js","./clojure-DiuoqK-z.js","./css-ZjFoif2m.js","./cmake-DXn5xaP-.js","./coffeescript-BTDxI-eT.js","./commonlisp-vq6DHwts.js","./cypher-gJDei3ni.js","./python-DD-Q2bae.js","./crystal-CRzZ78HM.js","./d-BShv7fp-.js","./diff-UJJ5BM9S.js","./dtd-DI9Herc-.js","./dylan-DkEP81N9.js","./ecl-DPFc0Uaf.js","./eiffel-DR5c0IrL.js","./elm-DompmV0j.js","./erlang-BuqgqA5h.js","./factor-CFXhaUWb.js","./simple-mode-C3vEBAcb.js","./forth-POgR1ypr.js","./fortran-DL7KluxX.js","./mllike-3c2dg9RT.js","./gas-bV0CklSb.js","./gherkin-B6X1vGSW.js","./groovy-DnIzCrpZ.js","./haskell-CLQs6EAM.js","./haxe-D25e-2l-.js","./idl-pcmmZuaN.js","./javascript-BpzJj0-u.js","./jinja2-DhgKlfW7.js","./julia-DjdwvFuI.js","./livescript-HO6ttBFx.js","./lua-8DXOpKDz.js","./mirc-DkvFAiy5.js","./mathematica-IIbmv7SK.js","./modelica-DSrSSXCg.js","./mumps-zvxmGV4l.js","./mbox-z_N2Mo3d.js","./nsis-BvKfQ9lQ.js","./ntriples-BSwWqoLa.js","./octave-C4hdQ5Hf.js","./oz-qQq7irPq.js","./pascal-CafrKXZF.js","./perl-tdMlh9QA.js","./pig-CwGJVRC4.js","./powershell-D1ly3AHC.js","./properties-_nPj978X.js","./protobuf-B4y9do6W.js","./pug-BTvK5tSS.js","./puppet-Bc-yJKzi.js","./q-B0kTJ4cI.js","./r-BA4EbLKE.js","./rpm-DI_rRufH.js","./ruby-CR-u2WLS.js","./sas-Bqaci40L.js","./scheme-qjP0V5Ag.js","./shell-BLav31RL.js","./sieve-r025o_jW.js","./smalltalk-C7J3IyEP.js","./sparql-BRLJFz69.js","./stylus-Bdo_Aemu.js","./swift-B_XXVlXX.js","./verilog-B4LBqg_1.js","./tcl-B2fODqDH.js","./textile-BuVhTOzU.js","./toml-wcPdHu67.js","./troff-Ce85hlLp.js","./ttcn-BxnYHtq8.js","./ttcn-cfg-CKJxb-l2.js","./turtle-BkSuIpt-.js","./webidl-CGwyPRYs.js","./vb-BHgjm0DN.js","./vbscript-Dawdd5GZ.js","./velocity-BdD_26Jv.js","./vhdl-CWWH2SUo.js","./xquery-CVDBqZPY.js","./yacas-I8QjZlxf.js","./z80-D8p3gKXp.js","./mscgen-B2igx18G.js","./index-BVgAenPd.js","./trash-Dc6DSjz_.js","./storage-B3Gax9mZ.css","./_createAggregator-DcD0kTA5.js","./_baseEach-CNBxBxvS.js","./loro_wasm_bg-C1ks32Vm.js","./terminal-B3isKKSk.css","./chat-panel-CXh5Wl6C.js","./empty-state-B3dA3G5P.js","./markdown-renderer-Cd9eYyaL.js","./katex-LV4FpwlL.js","./between-horizontal-start-Boxgxbt_.js","./markdown-renderer-ClyzDMmG.css","./isEmpty-DU_ogP_D.js","./agent-panel-Crv430aI.js","./agent-panel-D92Mfy1i.css","./dependency-graph-panel-DEdOxp2X.js","./transform-D9VCJYws.js","./timer-Bqd5yn_a.js","./zoom-COrs4lFh.js","./common-C7oJcmCT.js","./ellipsis-vertical-BBqXIlc2.js","./dependency-graph-panel-YfRlmuld.css","./datasources-panel-B7FbYLiy.js","./sortBy-BNZKwiq_.js","./_baseMap-D1WHjKrd.js","./documentation-panel-xULhaEv3.js","./error-panel-Cc1sv-Ag.js","./file-explorer-panel-Bw59Kva1.js","./icon-32x32-DHZerVul.js","./tree-jheoerAX.js","./index-C4Tn5NvJ.js","./logs-panel-D401qzZh.js","./clear-button-BeoFbEKH.js","./outline-panel-DIzkvm2I.js","./outline-panel-CJw2eR3G.css","./packages-panel-CJL0MVlj.js","./scratchpad-panel-BIgRENkI.js","./secrets-panel-xY5-V_BD.js","./snippets-panel-CTPYW41n.js","./snippets-panel-B4N-3dTw.css","./tracing-panel-DAzrzNmm.js","./variable-panel-DYAiLBmF.js","./command-palette-CXZiSv0I.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var ek=Object.defineProperty;var dp=nt=>{throw TypeError(nt)};var tk=(nt,We,gt)=>We in nt?ek(nt,We,{enumerable:!0,configurable:!0,writable:!0,value:gt}):nt[We]=gt;var B=(nt,We,gt)=>tk(nt,typeof We!="symbol"?We+"":We,gt),nk=(nt,We,gt)=>We.has(nt)||dp("Cannot "+gt);var up=(nt,We,gt)=>(nk(nt,We,"read from private field"),gt?gt.call(nt):We.get(nt)),hp=(nt,We,gt)=>We.has(nt)?dp("Cannot add the same private member more than once"):We instanceof WeakSet?We.add(nt):We.set(nt,gt);import{c as de,j_ as oo,j$ as ok,k0 as Nl,k1 as rk,k2 as sk,k3 as mp,k4 as fp,k5 as Gs,r as S,i3 as ak,ih as ik,gL as pp,k6 as lk,gH as ck,gK as dk,d as me,gF as Sl,k7 as ro,k8 as Dt,k9 as qs,ka as tt,v as Yt,i$ as Wt,eV as $t,kb as Te,kc as So,p as Se,j9 as Sn,a as P,au as qe,a0 as ze,j as i,aS as Xt,a_ as so,aZ as xr,a$ as yr,bN as ao,aX as ye,$ as Eo,bQ as Hs,aY as io,aF as Fn,a8 as gp,ay as pe,av as Ct,gV as El,cJ as Js,kd as uk,cI as Ce,S as Ye,ke as hk,hJ as Mt,kf as bp,kg as xp,kh as _l,ki as yp,L as He,b$ as vp,bi as _o,cZ as mk,W as wp,ax as Qt,kj as fk,c1 as Ks,kk as Ys,as as Bt,d1 as Be,d4 as Io,fQ as $e,kl as fe,d2 as Me,km as Il,kn as pk,ko as Al,kp as Ve,kq as kp,ds as Tl,dp as Dl,gu as Ml,dd as Ol,dk as Rl,eb as Ao,iW as Ll,cL as Bn,b as vr,X as Pn,iM as jp,iO as Cp,iP as gk,iU as bk,iQ as Np,kr as Sp,T as ue,hk as xk,dX as zn,dV as Un,dY as Wn,dU as lo,f4 as En,ks as Ep,iS as _p,kt as yk,aW as vk,aV as wk,ku as kk,iK as Ip,iL as Ap,bv as jk,de as Tp,bo as Ck,jE as Nk,kv as Sk,dq as Ek,gw as Fl,bF as Bl,dw as Pl,eY as _k,ee as Ot,hD as Xs,cp as zl,hW as Nt,e5 as Ik,gW as ht,hg as Ak,aT as Ul,fY as wr,kw as Qs,cl as _n,K as ie,hA as To,at as Zs,kx as Tk,ky as Dk,kz as Dp,aU as Mk,b0 as Wl,hx as Mp,dR as ea,cK as St,dS as Ok,b1 as Rk,jk as Op,a7 as $l,kA as Lk,kB as Vl,dE as Fk,e4 as Bk,hI as Rp,e7 as Pk,kC as zk,kD as Lp,jS as Uk,jQ as Wk,jT as $k,jU as Vk,kE as Gl,e_ as Zt,kF as Gk,b7 as Le,kG as ta,kH as Do,kI as Mo,co as ql,jf as st,kJ as Hl,cy as qk,bk as Vt,kK as Hk,kL as Fp,iD as Jl,cu as Bp,bR as Pp,bz as Kl,e2 as Jk,e3 as Kk,kM as Yk,bj as zp,an as Yl,bm as Up,bJ as Xl,al as na,hK as Ql,kN as Xk,gU as Gt,kO as Wp,kP as kr,kQ as $p,kR as oa,kS as Vp,kT as Gp,kU as qp,g1 as Hp,cq as Jp,cG as Kp,kV as Qk,kW as en,kX as ra,kY as Yp,M as Zl,kZ as jr,k_ as Cr,b8 as Xp,jN as ec,k$ as Qp,l0 as sa,b5 as Zp,l1 as e1,l2 as aa,aD as $n,f7 as tc,hH as t1,bC as n1,l3 as Nr,l4 as Sr,l5 as ia,l6 as Vn,l7 as o1,l8 as In,l9 as Oo,la as nc,lb as Er,lc as Ro,ld as oc,le as rc,lf as r1,lg as la,lh as Zk,c0 as _r,li as Ir,lj as e4,gT as ca,lk as t4,ll as sc,lm as n4,ln as o4,lo as da,e8 as Lo,g$ as r4,cF as s1,lp as s4,js as a1,fn as i1,lq as ac,iV as l1,hw as c1,lr as d1,ls as ua,lt as u1,lu as ha,lv as ic,lw as Fo,lx as Ar,ly as Tr,lz as a4,jp as lc,lA as cc,lB as ma,hf as i4,jq as l4,lC as c4,lD as d4,lE as u4,lF as h4,x as m4,lG as f4,lH as p4,lI as g4,j2 as b4,lJ as x4,lK as h1,t as v,lL as y4,lM as v4,lN as w4,lO as k4,lP as j4,lQ as C4,lR as N4,lS as S4,lT as E4,lU as _4,lV as I4,lW as A4,lX as T4,lY as D4,lZ as M4,l_ as O4,l$ as R4,m0 as L4,m1 as F4,m2 as B4,m3 as P4,m4 as z4,m5 as Dr,m6 as U4,m7 as W4,m8 as $4,m9 as V4,ma as G4,mb as q4,mc as H4,md as J4,me as dc,bq as uc,mf as m1,mg as K4,mh as Y4,cR as X4,mi as Q4,cS as Z4,cU as Mr,mj as e3,mk as t3,ml as n3,mm as o3,mn as r3,mo as s3,mp as a3,mq as i3,mr as l3,ms as c3,cV as d3,mt as u3,mu as h3,mv as m3,mw as f1,gY as f3,mx as p3,my as p1,h0 as g3,mz as fa,mA as b3,mB as x3,mC as y3,mD as v3,a2 as hc,bg as mc,bA as Gn,jZ as fc,mE as g1,cN as w3,d8 as pc,bu as b1,mF as k3,mG as Or,hl as gc,mH as co,mI as j3,ha as x1,aE as pa,mJ as C3,mK as N3,mL as S3,cr as E3,mM as y1,ct as _3,bl as I3,am as bc,mN as A3,mO as T3,mP as D3,mQ as Rr,mR as Lr,hG as xc,mS as M3,j7 as O3,e9 as R3,a9 as mt,mT as v1,mU as L3,mV as F3,mW as yc,mX as vc,mY as B3,mZ as w1,m_ as k1,m$ as ga,i_ as P3,aO as j1,gN as z3,n0 as C1,gB as Je,n1 as Fr,n2 as Bo,n3 as U3,n4 as W3,n5 as $3,n6 as V3,df as N1,n7 as G3,u as S1,dn as q3,n8 as H3,dC as J3,n9 as K3,d6 as E1,dz as Y3,du as X3,dt as Q3,na as Z3,ea as ej,e1 as tj,nb as nj,nc as oj,nd as rj,fO as sj,ne as _1,nf as I1,ng as A1,nh as aj,cw as wc,ni as T1,nj as D1,ba,nk as ij,nl as M1,nm as lj,nn as cj,no as O1,aP as xa,np as dj,ec as uj,nq as hj,V as mj,nr as R1,ns as fj,nt as pj,nu as gj,nv as Br,nw as L1,hF as F1,iY as ya,dy as B1,aA as P1,cM as kc,hj as jc,nx as bj,hC as z1,ny as xj,nz as U1,fL as yj,fM as vj,jK as wj,iN as kj,iR as Cc,jL as jj,nA as W1,ck as Cj,gc as Nj,nB as Sj,nC as Ej,nD as _j,a1 as va,hm as Ij,nE as Aj,nF as Tj,nG as $1,P as Dj,gy as V1,nH as Mj,ak as Nc,nI as Oj,nJ as Rj,nK as Lj,dN as Fj,nL as Bj,nM as Pj,nN as zj,aM as Uj,nO as wa,fZ as Wj,d9 as $j,da as Vj,j8 as Gj,jv as qj,nP as Hj,bM as Jj,nQ as Kj,nR as Yj,b_ as Xj,b2 as ka,nS as G1,nT as q1,b4 as H1,b3 as Qj,gS as Zj,__tla as eC}from"./index-DKEudB02.js";import{B as ja,A as tC,G as nC,o as oC,s as rC,k as sC,L as J1,a as K1,b as aC,M as iC,Y as lC,e as tn,c as Pr,d as cC,S as dC,K as uC,f as hC,i as mC,h as Y1,j as fC,l as pC,u as X1,P as zr,m as Q1,n as gC,p as bC,q as xC,D as Po}from"./links-D59GIweI.js";import{V as Z1,S as yC,j as eg,k as tg,L as ng,l as og,F as rg,I as Sc,M as vC,m as sg,n as wC,h as zo,E as Ca,o as ag,p as ig,N as lg,q as kC,s as Ec,i as cg,t as jC,v as CC,w as NC,x as SC,y as EC,z as _C,a as IC,C as AC,R as dg,A as TC,b as DC,c as MC,P as OC,__tla as RC}from"./storage-CMdLzB_c.js";import{c as LC}from"./_createAggregator-DcD0kTA5.js";import{_ as ug,a as hg,i as FC,w as BC,L as mg,A as PC,C as fg,b as _c,c as pg,__tla as zC}from"./loro_wasm_bg-C1ks32Vm.js";let gg,Na,Sa,Ic,Ea,Ac,Tc,Dc,Mc,Oc,Rc,Lc,Fc,Bc,_a,Ia,Aa,Uo,bg,Ta,Pc,zc,Uc,Wc,$c,xg,Vc,Da,UC=Promise.all([(()=>{try{return eC}catch{}})(),(()=>{try{return RC}catch{}})(),(()=>{try{return zC}catch{}})()]).then(async()=>{var $s,cp;var nt=LC(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let We,gt,Ma,Gc,qc,Ur,Oa,Wr,Hc,Ra,Jc,Kc,Yc,Xc,Qc,Zc,ed,td,nd,od,rd,La,sd,ad,id,ld,cd,dd,ud,Fa,hd,Ba,md,Pa,fd,pd,gd,bd,xd,yd,za,vd,wd,Et,_t;Pc=de("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),$c=de("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),We=de("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),gt=de("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Ma=de("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Na=de("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Gc=de("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),qc=de("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ur=de("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Oa=de("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"}]]),zc=de("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),Wr=de("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"}]]),Hc=de("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Ra=de("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"}]]),Jc=de("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"}]]),Kc=de("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"}]]),Yc=de("file-pen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]),Ic=de("file-plus-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),Xc=de("files",[["path",{d:"M15 2a2 2 0 0 1 1.414.586l4 4A2 2 0 0 1 21 8v7a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z",key:"1vo8kb"}],["path",{d:"M15 2v4a2 2 0 0 0 2 2h4",key:"sud9ri"}],["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"}]]),Qc=de("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),Zc=de("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),ed=de("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),td=de("hat-glasses",[["path",{d:"M14 18a2 2 0 0 0-4 0",key:"1v8fkw"}],["path",{d:"m19 11-2.11-6.657a2 2 0 0 0-2.752-1.148l-1.276.61A2 2 0 0 1 12 4H8.5a2 2 0 0 0-1.925 1.456L5 11",key:"1fkr7p"}],["path",{d:"M2 11h20",key:"3eubbj"}],["circle",{cx:"17",cy:"18",r:"3",key:"82mm0e"}],["circle",{cx:"7",cy:"18",r:"3",key:"lvkj7j"}]]),nd=de("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),od=de("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),Ac=de("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),rd=de("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"}]]),La=de("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"}]]),sd=de("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),ad=de("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),id=de("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),ld=de("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"}]]),cd=de("microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]),Tc=de("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),dd=de("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),ud=de("package-check",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),Fa=de("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]),hd=de("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ba=de("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"}]]),md=de("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]),Mc=de("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Ta=de("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Pa=de("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Oc=de("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),fd=de("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"}]]),pd=de("square-code",[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),gd=de("square-dashed-bottom-code",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]),bd=de("square-m",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]),xd=de("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"}]]),Uc=de("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),yd=de("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),Rc=de("text-search",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),za=de("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"}]]),vd=de("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),wd=de("whole-word",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]),Fc=de("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),Et=de("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),_t=de("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function $r(t,e){const n=+oo(t)-+oo(e);return n<0?-1:n>0?1:n}function yg(t,e){const n=oo(t,e==null?void 0:e.in);return+(function(o,r){const s=oo(o,r==null?void 0:r.in);return s.setHours(23,59,59,999),s})(n,e)==+(function(o,r){const s=oo(o,r==null?void 0:r.in),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s})(n,e)}function vg(t,e,n){const[o,r,s]=Nl(n==null?void 0:n.in,t,t,e),a=$r(r,s),l=Math.abs((function(u,h,m){const[f,b]=Nl(m==null?void 0:m.in,u,h);return 12*(f.getFullYear()-b.getFullYear())+(f.getMonth()-b.getMonth())})(r,s));if(l<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*l);let c=$r(r,s)===-a;yg(o)&&l===1&&$r(o,s)===1&&(c=!1);const d=a*(l-+c);return d===0?0:d}function wg(t,e,n){const o=(function(r,s){return+oo(r)-+oo(s)})(t,e)/1e3;return(r=>{const s=(0,Math.trunc)(r);return s===0?0:s})(o)}function kg(t,e){return(function(n,o,r){const s=rk(),a=(r==null?void 0:r.locale)??s.locale??sk,l=$r(n,o);if(isNaN(l))throw new RangeError("Invalid time value");const c=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:l}),[d,u]=Nl(r==null?void 0:r.in,...l>0?[o,n]:[n,o]),h=wg(u,d),m=(mp(u)-mp(d))/1e3,f=Math.round((h-m)/60);let b;if(f<2)return f===0?a.formatDistance("lessThanXMinutes",1,c):a.formatDistance("xMinutes",f,c);if(f<45)return a.formatDistance("xMinutes",f,c);if(f<90)return a.formatDistance("aboutXHours",1,c);if(f<fp){const x=Math.round(f/60);return a.formatDistance("aboutXHours",x,c)}if(f<2520)return a.formatDistance("xDays",1,c);if(f<Gs){const x=Math.round(f/fp);return a.formatDistance("xDays",x,c)}if(f<2*Gs)return b=Math.round(f/Gs),a.formatDistance("aboutXMonths",b,c);if(b=vg(u,d),b<12){const x=Math.round(f/Gs);return a.formatDistance("xMonths",x,c)}{const x=b%12,p=Math.trunc(b/12);return x<3?a.formatDistance("aboutXYears",p,c):x<9?a.formatDistance("overXYears",p,c):a.formatDistance("almostXYears",p+1,c)}})(t,(function(n){return ok(n,Date.now())})(t),e)}const jg=S.createContext({}),Cg=S.forwardRef(function(t,e){[t,e]=ck(t,e,jg);let{toolbarProps:n}=(function(s,a){const{"aria-label":l,"aria-labelledby":c,orientation:d="horizontal"}=s;let[u,h]=S.useState(!1);ak(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:m}=ik(),f=m==="rtl"&&d==="horizontal";let b=lk(a);const x=S.useRef(null);return{toolbarProps:{...pp(s,{labelable:!0}),role:u?"group":"toolbar","aria-orientation":d,"aria-label":l,"aria-labelledby":l==null?c:void 0,onKeyDownCapture:u?void 0:p=>{if(p.currentTarget.contains(p.target)){if(d==="horizontal"&&p.key==="ArrowRight"||d==="vertical"&&p.key==="ArrowDown")f?b.focusPrevious():b.focusNext();else{if(!(d==="horizontal"&&p.key==="ArrowLeft"||d==="vertical"&&p.key==="ArrowUp"))return p.key==="Tab"?(p.stopPropagation(),x.current=document.activeElement,void(p.shiftKey?b.focusFirst():b.focusLast())):void 0;f?b.focusNext():b.focusPrevious()}p.stopPropagation(),p.preventDefault()}},onFocusCapture:u?void 0:p=>{var g,y;x.current&&!p.currentTarget.contains(p.relatedTarget)&&(!((g=a.current)===null||g===void 0)&&g.contains(p.target))&&((y=x.current)===null||y===void 0||y.focus(),x.current=null)},onBlurCapture:u?void 0:p=>{p.currentTarget.contains(p.relatedTarget)||x.current||(x.current=p.target)}}}})(t,e),o=dk({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=pp(t,{global:!0});return delete r.id,me.createElement("div",{...Sl(r,o,n),ref:e,slot:t.slot||void 0,"data-orientation":t.orientation||"horizontal"},o.children)}),Vr={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"},Wo=ro.define({combine:t=>qs(t,{onError:console.error,inputDebounceTime:300,keymaps:Vr},{onError:(e,n)=>e&&n,inputDebounceTime:(e,n)=>e&&n,keymaps:(e,n)=>e&&n})}),qn=tt.define(),Hn=Dt.define({create:()=>({show:!1,lineFrom:0,lineTo:0}),update(t,e){for(const n of e.effects)if(n.is(qn))return n.value;return t}}),$o=tt.define(),Vo=tt.define(),kd=Dt.define({create:()=>({shouldFocus:!1,inputValue:""}),update(t,e){let n=t;for(const o of e.effects)o.is($o)&&(n={...n,inputValue:o.value}),o.is(Vo)&&(n={...n,shouldFocus:o.value});return n}}),Gr=tt.define(),Go=Dt.define({create:()=>null,update(t,e){for(const n of e.effects)if(n.is(Gr))return n.value;return t}}),uo=tt.define(),jd=Dt.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(uo))return n.value;return t}}),Cd=t=>{const{state:e}=t,n=e.selection.main;if(n.empty)return!1;const o=e.doc,r=o.lineAt(n.from),s=o.lineAt(n.to);if(e.sliceDoc(r.from,s.to).trim().length<1)return!1;const a=Math.max(1,Math.min(r.number,o.lines)),l=Math.max(1,Math.min(s.number,o.lines));return t.dispatch({effects:[qn.of({show:!0,lineFrom:a,lineTo:l}),Vo.of(!0),$o.of("")],selection:Yt.cursor(r.from)}),!0},Nd=t=>!!t.state.field(Go)&&(t.dispatch({effects:[Gr.of(null),qn.of({show:!1,lineFrom:0,lineTo:0}),Vo.of(!1),$o.of(""),uo.of(!1)]}),!0),Sd=t=>{const e=t.state.field(Go);return!!e&&(t.dispatch({changes:{from:e.from,to:e.to,insert:e.oldCode},effects:[Gr.of(null),qn.of({show:!1,lineFrom:0,lineTo:0}),Vo.of(!1),$o.of(""),uo.of(!1)]}),!0)},Ng="\u2318",Sg="\u229E Win",Eg="Ctrl";function Ua(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?Ng:navigator.platform.startsWith("Win")?Sg:Eg).replace("-"," ").toUpperCase()}function bt(t,e){const n=document.createElement(t);return n.className=e,n}const qr=Dt.define({create:()=>({suggestion:null}),update(t,e){const n=e.effects.find(o=>o.is(Hr));return e.docChanged||n||e.selection?n&&e.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}:t}}),Hr=tt.define();class _g extends So{constructor(n){super();B(this,"suggestion");this.suggestion=n}toDOM(){const n=document.createElement("span");return n.style.opacity="0.4",n.className="cm-inline-suggestion",n.textContent=this.suggestion,n.setAttribute("role","suggestion"),n.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),n}get lineBreaks(){return this.suggestion.split(`
|
|
3
|
-
`).length-1}}class Ig{constructor(e){B(this,"cache",new Map);B(this,"timeout");this.timeout=e}get(e){const n=this.cache.get(e);return n?Date.now()-n.timestamp>this.timeout?(this.cache.delete(e),null):n.result:null}set(e,n){this.cache.set(e,{result:n,timestamp:Date.now()})}}const Ag=(t,e)=>Wt.fromClass(class{constructor(){B(this,"abortController",null);B(this,"cache");this.cache=new Ig(e.cacheTimeout??1e3)}async update(n){var a,l,c,d,u;if(!n.docChanged||((l=(a=e.events)==null?void 0:a.beforeSuggestionFetch)==null?void 0:l.call(a,n.view))===!1)return;(c=this.abortController)==null||c.abort(),this.abortController=new AbortController;const o=n.state.doc,r=o.toString(),s=this.cache.get(r);if(s)n.view.dispatch({effects:Hr.of({text:s,doc:o})});else try{const h=await t(n.state,this.abortController.signal,n.view);if(this.abortController.signal.aborted||((u=(d=e.events)==null?void 0:d.shouldShowSuggestion)==null?void 0:u.call(d,n.view,h))===!1)return;this.cache.set(r,h),n.view.dispatch({effects:Hr.of({text:h,doc:o})})}catch(h){h instanceof Error&&h.name!=="AbortError"&&console.error("Suggestion fetch error:",h)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),Tg=Wt.fromClass(class{constructor(){B(this,"decorations");this.decorations=Te.none}update(t){var n;const e=(n=t.state.field(qr))==null?void 0:n.suggestion;this.decorations=e?(function(o,r){const s=o.state.selection.main.head,a=[],l=Te.widget({widget:new _g(r),side:1});return a.push(l.range(s)),Te.set(a)})(t.view,e):Te.none}},{decorations:t=>t.decorations}),Ed=t=>{var o,r,s;const e=(o=t.state.field(qr))==null?void 0:o.suggestion;if(!e)return!1;const n=t.state.facet(Wa);return t.dispatch({effects:Hr.of({text:null,doc:t.state.doc})}),(s=(r=n.events)==null?void 0:r.onSuggestionRejected)==null||s.call(r,t,e),!0},Dg=$t.of([{key:"Tab",run:t=>{var l,c,d;const e=(l=t.state.field(qr))==null?void 0:l.suggestion;if(!e)return!1;const n=t.state.facet(Wa);var o,r,s,a;return t.dispatch({...(o=t.state,r=e,s=t.state.selection.main.head,a=t.state.selection.main.head,{...o.changeByRange(u=>{if(u===o.selection.main)return{changes:{from:s,to:a,insert:r},range:Yt.cursor(s+r.length)};const h=a-s;return!u.empty||h&&o.sliceDoc(u.from-h,u.from)!==o.sliceDoc(s,a)?{range:u}:{changes:{from:u.from-h,to:u.from,insert:r},range:Yt.cursor(u.from-h+r.length)}}),userEvent:"input.complete"})}),(d=(c=n.events)==null?void 0:c.onSuggestionAccepted)==null||d.call(c,t,e),!0}},{key:"Escape",run:Ed}]),Wa=ro.define({combine:t=>t.at(-1)});function _d(t){const{delay:e=500,includeKeymap:n=!0}=t,o=(function(r,s,a){let l=()=>{};return(...c)=>(l(),new Promise((d,u)=>{const h=setTimeout(()=>d(r(...c)),s);l=()=>{clearTimeout(h),a!==void 0&&u(a)}}))})(t.fetchFn,e);return[qr,Wa.of(t),Ag(o,t),Tg,n?Dg:[]]}const Mg=Se.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}});function Og(t){var r,s;const e=t.state.facet(Wo),n={...Vr,...e.keymaps},o=bt("div","cm-ai-tooltip").appendChild(bt("div","cm-ai-tooltip-button"));return o.innerHTML=`<span>Edit <span class="hotkey">${Ua(n.showInput)}</span></span>`,(r=o.querySelector("span"))==null||r.addEventListener("mousedown",a=>{a.stopPropagation(),a.button===0&&a.preventDefault()}),(s=o.querySelector("span"))==null||s.addEventListener("click",a=>{a.preventDefault(),Cd(t)}),o}const $a=ro.define({combine:t=>qs(t,{render:Og,hideOnBlur:!1})}),Rg=Wt.fromClass((cp=class{constructor(t){B(this,"view");B(this,"suppress");B(this,"dom");B(this,"mousedown",()=>{this.suppress=!0});B(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});B(this,"scroll",()=>{this.display(this.view)});B(this,"windowScroll",()=>{this.display(this.view)});hp(this,$s,t=>{var n;const e=t.state.selection.ranges.find(o=>!o.empty);if(e&&!this.suppress){const o=t.coordsAtPos(e.from);if(!o)return;const r=t.dom.getBoundingClientRect(),s=(n=t.dom.parentElement)==null?void 0:n.getBoundingClientRect(),a=o.top>=r.top&&o.top<=r.bottom&&o.left>=r.left&&o.left<=r.right,l=!s||o.top>=s.top&&o.top<=s.bottom&&o.left>=s.left&&o.left<=s.right;if(!a||!l)return this.dom.style.display="none",void this.dom.setAttribute("aria-hidden","true");this.dom.style.display="flex",this.dom.setAttribute("aria-hidden","false");const c=this.dom.getBoundingClientRect(),d=r.width-c.width,u=Math.min(o.left,d);let h=o.top-c.height;h=s?Math.max(s.y,h):h,this.dom.style.left=`${u}px`,this.dom.style.top=`${h}px`,requestAnimationFrame(()=>{this.dom&&this.dom.setAttribute("aria-hidden","false")})}else this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true")});this.view=t;const e=t.state.facet($a);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup),t.scrollDOM.addEventListener("scroll",this.scroll),window.addEventListener("scroll",this.windowScroll,!0);const n=e.render(t);t.dom.appendChild(n),this.dom=n}update(t){this.display(t.view)}docViewUpdate(t){this.display(t)}display(t){if(t.state.field(Hn).show)return void(this.dom.style.display="none");if(t.state.facet($a).hideOnBlur&&!t.hasFocus)return this.dom.style.display="none",void this.dom.setAttribute("aria-hidden","true");t.requestMeasure({read:up(this,$s)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.view.scrollDOM.removeEventListener("scroll",this.scroll),window.removeEventListener("scroll",this.windowScroll,!0),this.dom.remove()}},$s=new WeakMap,cp)),Lg=Se.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});class Fg extends So{constructor(n){super();B(this,"oldCode");this.oldCode=n}toDOM(n){const o=bt("div","cm-old-code-container");o.setAttribute("role","region"),o.setAttribute("aria-label","Previous code version");const r=bt("div","cm-old-code cm-line");r.textContent=this.oldCode;const s=bt("div","cm-floating-buttons"),a=n.state.facet(Wo),l={...Vr,...a.keymaps},c=bt("button","cm-floating-button cm-floating-accept");c.innerHTML=`<span class="hotkey">${Ua(l.acceptEdit)}</span> Accept`,c.setAttribute("aria-label","Accept changes"),c.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),Nd(n)});const d=bt("button","cm-floating-button cm-floating-reject");return d.innerHTML=`<span class="hotkey">${Ua(l.rejectEdit)}</span> Reject`,d.setAttribute("aria-label","Reject changes"),d.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),Sd(n)}),s.append(c,d),o.append(r,s),o}updateDOM(n,o){return!0}}class Bg extends So{constructor(n){super();B(this,"complete");B(this,"abortController",null);B(this,"dom",null);B(this,"input",null);B(this,"loadingContainer",null);B(this,"helpInfo",null);B(this,"inputContainer",null);B(this,"form",null);B(this,"view",null);B(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});B(this,"onCancel",()=>{this.cleanup();const n=this.view;n&&(n.dispatch({effects:[qn.of({show:!1,lineFrom:0,lineTo:0}),uo.of(!1)]}),n.focus())});B(this,"handleSubmit",async n=>{var x;const o=this.view;if(!o)return;const r=o.state.facet(Wo);n==null||n.stopPropagation();const s=o.state.field(Hn),{input:a}=this;if(!a)return;const l=a.value.trim();if(!s.show||!l)return;const c=o.state.doc.line(s.lineFrom),d=o.state.doc.line(s.lineTo),u=c.from,h=d.to,m=o.state.sliceDoc(u,h),f=o.state.sliceDoc(0,u),b=o.state.sliceDoc(h);this.abortController=new AbortController,o.dispatch({effects:uo.of(!0)}),this.toggleLoading(!0);try{const p=await this.complete({prompt:l,selection:m,codeBefore:f,codeAfter:b,editorView:o,signal:this.abortController.signal});if(!o.state.field(Hn).show)return;if(!p||typeof p!="string")throw new Error("Invalid completion result");o.dispatch({changes:{from:u,to:h,insert:p},effects:[qn.of({show:!1,lineFrom:0,lineTo:0}),Gr.of({from:u,to:u+p.length,oldCode:m,newCode:p}),uo.of(!1)]})}catch(p){if(p instanceof DOMException&&p.name==="AbortError")return;(x=r.onError)==null||x.call(r,p)}finally{this.cleanup(),this.toggleLoading(!1),o.focus()}});this.complete=n}toDOM(n){if(this.dom)return this.dom;this.view=n;const o=n.state.field(kd),r=n.state.field(jd),s=bt("div","cm-ai-input-container");this.inputContainer=s,this.dom=s;const a=bt("form","cm-ai-input-form");this.form=a,a.setAttribute("role","search"),a.setAttribute("aria-label","AI editing instructions"),a.addEventListener("submit",p=>p.preventDefault());const l=bt("input","cm-ai-input");this.input=l,a.append(l),l.placeholder="Editing instructions...",l.setAttribute("aria-label","AI editing instructions"),l.setAttribute("autocomplete","off"),l.setAttribute("spellcheck","true"),l.value=o.inputValue;const c=bt("div","cm-ai-loading-container");this.loadingContainer=c;const d=bt("div","cm-ai-loading-indicator");d.setAttribute("role","status"),d.setAttribute("aria-live","polite"),d.textContent="Generating";const u=bt("button","cm-ai-cancel-button");u.textContent="Cancel",u.setAttribute("aria-label","Cancel code generation"),u.addEventListener("click",this.onCancel),c.append(u,d);const h=bt("div","cm-ai-help-info");this.helpInfo=h;const m=h.appendChild(document.createElement("button"));m.className="cm-ai-help-info-button",m.textContent="Esc to close",m.addEventListener("click",this.onCancel);const f=bt("button","cm-ai-generate-button");function b(p){h.replaceChildren(p?f:m)}f.textContent="\u23CE Generate",f.setAttribute("aria-label","Generate code"),f.addEventListener("click",this.handleSubmit),this.toggleLoading(r),o.shouldFocus&&requestAnimationFrame(()=>{l.value=o.inputValue,l.focus(),n.dispatch({effects:Vo.of(!1)})}),b(l.value),l.addEventListener("input",function(){n.dispatch({effects:$o.of(l.value)});const p=l.value.trim();p!==x&&(x=p,b(p))}),l.addEventListener("keydown",this.onKeyDown);let x="";return s}toggleLoading(n){var o;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((o=this.inputContainer)==null||o.replaceChildren(this.form,n?this.loadingContainer:this.helpInfo))}updateDOM(n,o){return this.dom=n,this.input=n.querySelector(".cm-ai-input"),!0}cleanup(){var n,o,r;(n=this.abortController)==null||n.abort(),this.abortController=null,(o=this.dom)==null||o.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}}function Pg(t){if(!t.prompt)throw new Error("prompt function is required");const e={...Vr,...t.keymaps};return[Wo.of(t),Hn,kd,Go,jd,[Rg,Lg],Mg,$t.of([{key:e.showInput,run:Cd}]),Sn.highest([$t.of([{key:e.acceptEdit,run:Nd},{key:e.rejectEdit,run:Sd}])]),zg,Ug,Wg,$g]}const zg=Se.updateListener.of(t=>{const e=t.state.field(Hn);if(!e.show||!t.docChanged)return;let{lineFrom:n,lineTo:o}=e,r=!1;t.changes.iterChanges((s,a,l,c)=>{const d=t.state.doc.lineAt(s).number;if(d<n){const u=t.state.doc.lineAt(c).number-t.state.doc.lineAt(l).number;n+=u,o+=u,r=!0}else if(d<=o){const u=t.state.doc.lineAt(c).number-t.state.doc.lineAt(l).number;o+=u,r=!0}}),r&&t.view.dispatch({effects:[qn.of({show:!0,lineFrom:n,lineTo:o})]})}),Ug=Se.decorations.of(t=>{const e=t.state.field(Go);return e?Te.set([Te.mark({class:"cm-new-code-line"}).range(e.from,e.to)]):Te.none}),Wg=Se.decorations.compute([Hn],t=>{const e=t.field(Hn),n=t.facet(Wo),o=[];if(e.show){const r=e.lineFrom,s=e.lineTo;for(let a=r;a<=s;a++){const l=t.doc.line(a).from;o.push(Te.line({class:"cm-ai-selection"}).range(l)),a===r&&o.push(Te.widget({widget:new Bg(n.prompt),side:-1}).range(l))}}return Te.set(o)}),$g=Dt.define({create:t=>Te.none,update(t,e){const n=e.state.field(Go);return n?Te.set([Te.widget({widget:new Fg(n.oldCode),block:!0}).range(n.from)]):Te.none},provide:t=>Se.decorations.from(t)}),Jr="https://static.marimo.app",Vg=t=>{const e=P.c(25),{onClose:n}=t,[o,r]=S.useState(""),{exportAsHTML:s}=qe(),a=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${Jr}/static/${a}`;let c,d,u,h,m,f,b,x,p,g,y;return e[0]!==s||e[1]!==n||e[2]!==a?(c=async w=>{w.preventDefault(),n();const j=await s({download:!1,includeCode:!0,files:Z1.INSTANCE.filenames()}),N=ze({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Jr}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:j,path:a})}).catch(()=>{N.dismiss(),ze({title:"Error uploading static page",description:i.jsxs("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",i.jsx("a",{href:Xt.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),N.dismiss(),ze({title:"Static page uploaded!",description:i.jsxs("div",{children:["The URL has been copied to your clipboard.",i.jsx("br",{}),"You can share it with anyone."]})})},e[0]=s,e[1]=n,e[2]=a,e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(so,{children:"Share static notebook"}),e[4]=d):d=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsxs(xr,{children:[d,i.jsxs(yr,{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"," ",i.jsx("a",{href:Jr,target:"_blank",children:Jr}),"."]})]}),e[5]=u):u=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(h=w=>{const j=w.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(j)},e[6]=h):h=e[6],e[7]!==o?(m=i.jsx(ao,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:h,required:!0,autoComplete:"off"}),e[7]=o,e[8]=m):m=e[8],e[9]!==l?(f=i.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:",i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Gg,{text:l}),i.jsx("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=f):f=e[10],e[11]!==m||e[12]!==f?(b=i.jsxs("div",{className:"flex flex-col gap-6 py-4",children:[m,f]}),e[11]=m,e[12]=f,e[13]=b):b=e[13],e[14]!==n?(x=i.jsx(ye,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=x):x=e[15],e[16]!==l?(p=i.jsx(ye,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Eo(l)},children:"Create"}),e[16]=l,e[17]=p):p=e[17],e[18]!==x||e[19]!==p?(g=i.jsxs(Hs,{children:[x,p]}),e[18]=x,e[19]=p,e[20]=g):g=e[20],e[21]!==c||e[22]!==g||e[23]!==b?(y=i.jsx(io,{className:"w-fit",children:i.jsxs("form",{onSubmit:c,children:[u,b,g]})}),e[21]=c,e[22]=g,e[23]=b,e[24]=y):y=e[24],y},Gg=t=>{const e=P.c(8),[n,o]=me.useState(!1);let r;e[0]!==t.text?(r=Fn.stopPropagation(async d=>{d.preventDefault(),await Eo(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=r):r=e[1];const s=r;let a,l,c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(gp,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(l=i.jsx(ye,{"data-testid":"copy-static-notebook-url-button",onClick:s,size:"xs",variant:"secondary",children:a}),e[3]=s,e[4]=l):l=e[4],e[5]!==n||e[6]!==l?(c=i.jsx(pe,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=c):c=e[7],c};function Id(){const t=P.c(2),e=Ct(El);let n;return t[0]!==e?(n=()=>{const o=document.getElementsByClassName("output-area"),r=window.innerHeight||document.documentElement.clientHeight;let s=null;for(const a of Array.from(o)){const l=a.getBoundingClientRect();if(l.top>=0&&l.top<=r||l.bottom>=0&&l.bottom<=r){s=Js.parse(a.parentNode.id);break}}e(a=>({mode:uk(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(Js.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function Va(t){const e=P.c(3),n=qo();let o;return e[0]!==t||e[1]!==n?(o=()=>{t!==void 0&&n([t])},e[0]=t,e[1]=n,e[2]=o):o=e[2],Ce(o)}function Ad(){const t=P.c(2),e=qo();let n;return t[0]!==e?(n=()=>e(bp(Mt())),t[0]=e,t[1]=n):n=t[1],Ce(n)}function qo(){const t=P.c(3),{prepareForRun:e}=Ye(),{sendRun:n}=qe();let o;return t[0]!==e||t[1]!==n?(o=async r=>{var c,d;if(r.length===0)return;const{cellHandles:s,cellData:a}=Mt(),l=[];for(const u of r){const h=s[u],m=(c=h==null?void 0:h.current)==null?void 0:c.editorView;let f;m?(xp(m)!=="markdown"&&_l(m),f=yp(m)):f=((d=a[u])==null?void 0:d.code)||"",l.push(f),e({cellId:u})}await n({cellIds:r,codes:l}).catch(qg)},t[0]=e,t[1]=n,t[2]=o):o=t[2],Ce(o)}function qg(t){He.error(t)}let Kr;Kr=[{type:"files",Icon:Qc,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:vp,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:_o,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Tc,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:ja,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Oc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:mk,tooltip:"Chat with AI",position:"sidebar"},{type:"agents",Icon:td,tooltip:"Agents",position:"sidebar",hidden:!Ys("external_agents")},{type:"documentation",Icon:Rc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:wp,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:tC,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:gd,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:od,tooltip:"Secrets",hidden:Qt(),position:"sidebar"},{type:"scratchpad",Icon:fk,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Ks,tooltip:"View errors",position:"footer"}],_a=Bt(!1);function Jn(){return Me().optional().describe(fe.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Td(){return Me().optional().describe(fe.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Yr(){return Me().optional().describe(fe.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Dd(){return Me().optional().describe(fe.of({label:"URI",optionRegex:".*uri.*"}))}function Kn(){return Me().nonempty().describe(fe.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function nn(){return Me().describe(fe.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Yn(){return Me().nonempty().describe(fe.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Xn(t){const e=pk.string().describe(fe.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(n=>n>=0&&n<=65535,{message:"Port must be between 0 and 65535"});return t!==void 0?e.default(t.toString()):e}function Md(){return Io().default(!1).describe(fe.of({label:"Read Only"}))}const Od=Be({type:$e("postgres"),host:Kn(),port:Xn(5432).optional(),database:nn(),username:Yn(),password:Jn(),ssl:Io().default(!1).describe(fe.of({label:"Use SSL"}))}).describe(fe.of({direction:"two-columns"})),Rd=Be({type:$e("mysql"),host:Kn(),port:Xn(3306),database:nn(),username:Yn(),password:Jn(),ssl:Io().default(!1).describe(fe.of({label:"Use SSL"}))}).describe(fe.of({direction:"two-columns"})),Ld=Be({type:$e("sqlite"),database:nn().describe(fe.of({label:"Database Path"}))}).describe(fe.of({direction:"two-columns"})),Fd=Be({type:$e("duckdb"),database:nn().describe(fe.of({label:"Database Path"})),read_only:Md()}).describe(fe.of({direction:"two-columns"})),Bd=Be({type:$e("motherduck"),database:nn().default("my_db").describe(fe.of({label:"Database Name"})),token:Td()}).describe(fe.of({direction:"two-columns"})),Pd=Be({type:$e("snowflake"),account:Me().nonempty().describe(fe.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Me().optional().describe(fe.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:nn(),schema:Me().optional().describe(fe.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Yn(),password:Jn(),role:Me().optional().describe(fe.of({label:"Role"}))}).describe(fe.of({direction:"two-columns"})),zd=Be({type:$e("bigquery"),project:Me().nonempty().describe(fe.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Me().nonempty().describe(fe.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Me().describe(fe.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(fe.of({direction:"two-columns"})),Ud=Be({type:$e("clickhouse_connect"),host:Kn(),port:Xn(8123).optional(),username:Yn(),password:Jn(),secure:Io().default(!1).describe(fe.of({label:"Use HTTPs"}))}).describe(fe.of({direction:"two-columns"})),Wd=Be({type:$e("timeplus"),host:Kn().default("localhost"),port:Xn(8123).optional(),username:Yn().default("default"),password:Jn().default("")}).describe(fe.of({direction:"two-columns"})),$d=Be({type:$e("chdb"),database:nn().describe(fe.of({label:"Database Path"})),read_only:Md()}).describe(fe.of({direction:"two-columns"})),Vd=Be({type:$e("trino"),host:Kn(),port:Xn(8080),database:nn(),schema:Me().describe(fe.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"})).optional(),username:Yn(),password:Jn(),async_support:Io().default(!1).describe(fe.of({label:"Async Support"}))}).describe(fe.of({direction:"two-columns"})),Gd=Be({type:$e("iceberg"),name:Me().describe(fe.of({label:"Catalog Name"})),catalog:Il("type",[Be({type:$e("REST"),warehouse:Yr(),uri:Me().optional().describe(fe.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Td()}),Be({type:$e("SQL"),warehouse:Yr(),uri:Me().optional().describe(fe.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Be({type:$e("Hive"),warehouse:Yr(),uri:Dd()}),Be({type:$e("Glue"),warehouse:Yr(),uri:Dd()}),Be({type:$e("DynamoDB"),"dynamodb.profile-name":Me().optional().describe(fe.of({label:"Profile Name"})),"dynamodb.region":Me().optional().describe(fe.of({label:"Region"})),"dynamodb.access-key-id":Me().optional().describe(fe.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Me().optional().describe(fe.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Me().optional().describe(fe.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(fe.of({special:"tabs"}))}),qd=Be({type:$e("datafusion"),sessionContext:Io().optional().describe(fe.of({label:"Use Session Context"}))}),Hd=Be({type:$e("pyspark"),host:Kn().optional(),port:Xn().optional()}),Jd=Be({type:$e("redshift"),host:Kn(),port:Xn(5439),connectionType:Il("type",[Be({type:$e("IAM credentials"),region:Me().describe(fe.of({label:"Region"})),aws_access_key_id:Me().nonempty().describe(fe.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Me().nonempty().describe(fe.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Me().optional().describe(fe.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Be({type:$e("DB credentials"),user:Yn(),password:Jn()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:nn()}).describe(fe.of({direction:"two-columns"})),Hg=Il("type",[Od,Rd,Ld,Fd,Bd,Pd,zd,Ud,Wd,$d,Vd,Gd,qd,Hd,Jd]),Ga="env:";function Xr(t){return typeof t=="string"&&t.startsWith(Ga)}function qa(t){return`${Ga}${t}`}const Kd={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift"};class xt{constructor(e,n,o){this.connection=void 0,this.orm=void 0,this.secrets=void 0,this.connection=e,this.orm=n,this.secrets=o}get imports(){const e=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":e.add("import sqlalchemy");break;case"sqlmodel":e.add("import sqlmodel");break;case"duckdb":e.add("import duckdb")}return e}}class Jg{constructor(){this.secrets={}}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(e,n,o){if(e=`_${e}`,Xr(n)){const r=n.replace(Ga,""),s=o?`os.environ.get("${r}", "${o}")`:`os.environ.get("${r}")`;return this.secrets[e]=s,e}if(o!=null){const r=`os.environ.get("${n}", "${o}")`;return this.secrets[e]=r,e}return typeof n=="number"||typeof n=="number"?`${n}`:typeof n=="boolean"?ho(n):n?`"${n}"`:""}printInFString(e,n,o){if(n===void 0)return"";if(typeof n=="number")return`${n}`;if(typeof n=="boolean")return ho(n);const r=this.print(e,n,o);return r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):`{${r}}`}printPassword(e,n,o){const r=o?this.printInFString.bind(this):this.print.bind(this);return Xr(e)?r("password",e):r("password",n,e)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([e,n])=>`${e} = ${n}`).join(`
|
|
4
|
-
`)}}class Kg extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",n=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0),o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),a=this.secrets.printInFString("database",this.connection.database);return Ve(`
|
|
5
|
-
DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${a}"
|
|
6
|
-
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
|
7
|
-
`)}}class Yg extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.ssl?", connect_args={'ssl': {'ssl-mode': 'preferred'}}":"",n=this.secrets.printPassword(this.connection.password,"MYSQL_PASSWORD",!0),o=this.secrets.printInFString("database",this.connection.database),r=this.secrets.printInFString("username",this.connection.username),s=this.secrets.printInFString("host",this.connection.host),a=this.secrets.printInFString("port",this.connection.port);return Ve(`
|
|
8
|
-
DATABASE_URL = f"mysql+pymysql://${r}:${n}@${s}:${a}/${o}"
|
|
9
|
-
engine = ${this.orm}.create_engine(DATABASE_URL${e})
|
|
10
|
-
`)}}class Xg extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.connection.database?this.secrets.printInFString("database",this.connection.database):"",n=e.startsWith("{")&&e.endsWith("}")?`DATABASE_URL = f"sqlite:///${e}"`:`DATABASE_URL = "sqlite:///${e}"`;return Ve(`
|
|
11
|
-
${n}
|
|
12
|
-
engine = ${this.orm}.create_engine(DATABASE_URL)
|
|
13
|
-
`)}}class Qg extends xt{generateImports(){return["from snowflake.sqlalchemy import URL"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"SNOWFLAKE_PASSWORD",!1),n={account:this.secrets.print("account",this.connection.account),user:this.secrets.print("user",this.connection.username),database:this.secrets.print("database",this.connection.database),warehouse:this.connection.warehouse?this.secrets.print("warehouse",this.connection.warehouse):void 0,schema:this.connection.schema?this.secrets.print("schema",this.connection.schema):void 0,role:this.connection.role?this.secrets.print("role",this.connection.role):void 0,password:e};return Ve(`
|
|
14
|
-
engine = ${this.orm}.create_engine(
|
|
15
|
-
URL(
|
|
16
|
-
${Qr(n,o=>` ${o}`)},
|
|
17
|
-
)
|
|
18
|
-
)
|
|
19
|
-
`)}}class Zg extends xt{generateImports(){return["import json"]}generateConnectionCode(){const e=this.secrets.printInFString("project",this.connection.project),n=this.secrets.printInFString("dataset",this.connection.dataset);return Ve(`
|
|
20
|
-
credentials = json.loads("""${this.connection.credentials_json}""")
|
|
21
|
-
engine = ${this.orm}.create_engine(f"bigquery://${e}/${n}", credentials_info=credentials)
|
|
22
|
-
`)}}class e0 extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database||":memory:");return Ve(`
|
|
23
|
-
DATABASE_URL = "${e}"
|
|
24
|
-
engine = ${this.orm}.connect(DATABASE_URL, read_only=${ho(this.connection.read_only)})
|
|
25
|
-
`)}}class t0 extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database);if(!this.connection.token)return Ve(`
|
|
26
|
-
conn = duckdb.connect("md:${e}")
|
|
27
|
-
`);const n=this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1);return Ve(`
|
|
28
|
-
conn = duckdb.connect("md:${e}", config={"motherduck_token": ${n}})
|
|
29
|
-
`)}}class n0 extends xt{generateImports(){return["import clickhouse_connect"]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"CLICKHOUSE_PASSWORD",!1),n={host:this.secrets.print("host",this.connection.host),user:this.secrets.print("user",this.connection.username),secure:this.secrets.print("secure",this.connection.secure),port:this.connection.port?this.secrets.print("port",this.connection.port):void 0,password:this.connection.password?e:void 0};return Ve(`
|
|
30
|
-
engine = ${this.orm}.get_client(
|
|
31
|
-
${Qr(n,o=>` ${o}`)},
|
|
32
|
-
)
|
|
33
|
-
`)}}class o0 extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printPassword(this.connection.password,"TIMEPLUS_PASSWORD",!0),n=this.secrets.printInFString("username",this.connection.username),o=this.secrets.printInFString("host",this.connection.host),r=this.secrets.printInFString("port",this.connection.port);return Ve(`
|
|
34
|
-
DATABASE_URL = f"timeplus://${n}:${e}@${o}:${r}"
|
|
35
|
-
engine = ${this.orm}.create_engine(DATABASE_URL)
|
|
36
|
-
`)}}class r0 extends xt{generateImports(){return["import chdb"]}generateConnectionCode(){const e=this.secrets.print("database",this.connection.database)||'""';return Ve(`
|
|
37
|
-
engine = ${this.orm}.connect(${e}, read_only=${ho(this.connection.read_only)})
|
|
38
|
-
`)}}class s0 extends xt{generateImports(){return this.connection.async_support?["import aiotrino"]:["import trino.sqlalchemy"]}generateConnectionCode(){const e=this.connection.async_support?"aiotrino":"trino",n=this.connection.schema?`/${this.connection.schema}`:"",o=this.secrets.printInFString("username",this.connection.username),r=this.secrets.printInFString("host",this.connection.host),s=this.secrets.printInFString("port",this.connection.port),a=this.secrets.printInFString("database",this.connection.database),l=this.secrets.printPassword(this.connection.password,"TRINO_PASSWORD",!0);return Ve(`
|
|
39
|
-
engine = ${this.orm}.create_engine(f"${e}://${o}:${l}@${r}:${s}/${a}${n}")
|
|
40
|
-
`)}}class a0 extends xt{generateImports(){switch(this.connection.catalog.type){case"REST":return["from pyiceberg.catalog.rest import RestCatalog"];case"SQL":return["from pyiceberg.catalog.sql import SqlCatalog"];case"Hive":return["from pyiceberg.catalog.hive import HiveCatalog"];case"Glue":return["from pyiceberg.catalog.glue import GlueCatalog"];case"DynamoDB":return["from pyiceberg.catalog.dynamodb import DynamoDBCatalog"];default:Al(this.connection.catalog)}}generateConnectionCode(){let e={...this.connection.catalog};e=Object.fromEntries(Object.entries(e).filter(([a,l])=>l!=null&&l!==""&&a!=="type"));for(const[a,l]of Object.entries(e))Xr(l)?e[a]=this.secrets.print(a,l):typeof l=="string"&&(e[a]=`"${l}"`);const n=(o=e,r=a=>` ${a}`,Object.entries(o).filter(([,a])=>a!=null&&a!=="").map(([a,l])=>{const c=`"${a}"`;return r(typeof l=="boolean"?`${c}: ${ho(l)}`:`${c}: ${l}`)}).join(`,
|
|
41
|
-
`));var o,r;const s=`"${this.connection.name}"`;switch(this.connection.catalog.type){case"REST":return Ve(`
|
|
42
|
-
catalog = RestCatalog(
|
|
43
|
-
${s},
|
|
44
|
-
**{
|
|
45
|
-
${n}
|
|
46
|
-
},
|
|
47
|
-
)
|
|
48
|
-
`);case"SQL":return Ve(`
|
|
49
|
-
catalog = SqlCatalog(
|
|
50
|
-
${s},
|
|
51
|
-
**{
|
|
52
|
-
${n}
|
|
53
|
-
},
|
|
54
|
-
)
|
|
55
|
-
`);case"Hive":return Ve(`
|
|
56
|
-
catalog = HiveCatalog(
|
|
57
|
-
${s},
|
|
58
|
-
**{
|
|
59
|
-
${n}
|
|
60
|
-
},
|
|
61
|
-
)
|
|
62
|
-
`);case"Glue":return Ve(`
|
|
63
|
-
catalog = GlueCatalog(
|
|
64
|
-
${s},
|
|
65
|
-
**{
|
|
66
|
-
${n}
|
|
67
|
-
},
|
|
68
|
-
)
|
|
69
|
-
`);case"DynamoDB":return Ve(`
|
|
70
|
-
catalog = DynamoDBCatalog(
|
|
71
|
-
${s},
|
|
72
|
-
**{
|
|
73
|
-
${n}
|
|
74
|
-
},
|
|
75
|
-
)
|
|
76
|
-
`);default:Al(this.connection.catalog)}}}class i0 extends xt{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?Ve(`
|
|
77
|
-
ctx = SessionContext()
|
|
78
|
-
# Sample table
|
|
79
|
-
_ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
|
|
80
|
-
|
|
81
|
-
con = ibis.datafusion.connect(ctx)
|
|
82
|
-
`):Ve(`
|
|
83
|
-
con = ibis.datafusion.connect()
|
|
84
|
-
`)}}class l0 extends xt{generateImports(){return["import ibis","from pyspark.sql import SparkSession"]}generateConnectionCode(){if(this.connection.host||this.connection.port){const e=this.secrets.printInFString("host",this.connection.host),n=this.secrets.printInFString("port",this.connection.port);return Ve(`
|
|
85
|
-
session = SparkSession.builder.remote(f"sc://${e}:${n}").getOrCreate()
|
|
86
|
-
con = ibis.pyspark.connect(session)
|
|
87
|
-
`)}return Ve(`
|
|
88
|
-
con = ibis.pyspark.connect()
|
|
89
|
-
`)}}class c0 extends xt{generateImports(){return["import redshift_connector"]}generateConnectionCode(){const e=this.secrets.print("host",this.connection.host),n=this.secrets.print("port",this.connection.port),o=this.secrets.print("database",this.connection.database);if(this.connection.connectionType.type==="IAM credentials"){const l=this.secrets.print("aws_access_key_id",this.connection.connectionType.aws_access_key_id),c=this.secrets.print("aws_secret_access_key",this.connection.connectionType.aws_secret_access_key),d=this.connection.connectionType.aws_session_token?this.secrets.print("aws_session_token",this.connection.connectionType.aws_session_token):void 0,u={iam:!0,host:e,port:n,region:`"${this.connection.connectionType.region}"`,database:o,access_key_id:l,secret_access_key:c,...d&&{session_token:d}};return Ve(`
|
|
90
|
-
con = redshift_connector.connect(
|
|
91
|
-
${Qr(u,h=>` ${h}`)},
|
|
92
|
-
)
|
|
93
|
-
`)}const r=this.connection.connectionType.user?this.secrets.print("user",this.connection.connectionType.user):void 0,s=this.connection.connectionType.password?this.secrets.printPassword(this.connection.connectionType.password,"REDSHIFT_PASSWORD",!1):void 0,a={host:e,port:n,database:o,...r&&{user:r},...s&&{password:s}};return Ve(`
|
|
94
|
-
con = redshift_connector.connect(
|
|
95
|
-
${Qr(a,l=>` ${l}`)},
|
|
96
|
-
)
|
|
97
|
-
`)}}class d0{constructor(){this.secrets=new Jg}createGenerator(e,n){switch(e.type){case"postgres":return new Kg(e,n,this.secrets);case"mysql":return new Yg(e,n,this.secrets);case"sqlite":return new Xg(e,n,this.secrets);case"snowflake":return new Qg(e,n,this.secrets);case"bigquery":return new Zg(e,n,this.secrets);case"duckdb":return new e0(e,n,this.secrets);case"motherduck":return new t0(e,n,this.secrets);case"clickhouse_connect":return new n0(e,n,this.secrets);case"timeplus":return new o0(e,n,this.secrets);case"chdb":return new r0(e,n,this.secrets);case"trino":return new s0(e,n,this.secrets);case"iceberg":return new a0(e,n,this.secrets);case"datafusion":return new i0(e,n,this.secrets);case"pyspark":return new l0(e,n,this.secrets);case"redshift":return new c0(e,n,this.secrets);default:Al(e)}}}function ho(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function Qr(t,e){return Object.entries(t).filter(([,n])=>n!=null&&n!=="").map(([n,o])=>e(typeof o=="boolean"?`${n}=${ho(o)}`:`${n}=${o}`)).join(`,
|
|
98
|
-
`)}Vc=function(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)},Lc=t=>{const e=P.c(43),{providerNames:n,onClose:o,onSuccess:r}=t,{writeSecret:s}=qe(),[a,l]=me.useState(""),[c,d]=me.useState(""),[u,h]=me.useState(n[0]);let m;e[0]!==a||e[1]!==u||e[2]!==r||e[3]!==c||e[4]!==s?(m=async T=>{if(T.preventDefault(),u)if(a&&c&&u)try{await s({key:a,value:c,provider:"dotenv",name:u}),ze({title:"Secret created",description:"The secret has been created successfully."}),r(a)}catch{ze({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else ze({title:"Error",description:"Please fill in all fields.",variant:"danger"});else ze({title:"Error",description:"No location selected for the secret.",variant:"danger"})},e[0]=a,e[1]=u,e[2]=r,e[3]=c,e[4]=s,e[5]=m):m=e[5];const f=m;let b,x,p,g,y,w,j,N,C,k,_,E,I,A,F,D;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsxs(xr,{children:[i.jsx(so,{children:"Add Secret"}),i.jsx(yr,{children:"Add a new secret to your environment variables."})]}),e[6]=b):b=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(Ao,{htmlFor:"key",children:"Key"}),e[7]=x):x=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(p=T=>{l(T.target.value.replaceAll(/\W/g,"_"))},e[8]=p):p=e[8],e[9]!==a?(g=i.jsxs("div",{className:"grid gap-2",children:[x,i.jsx(ao,{id:"key",value:a,onChange:p,placeholder:"MY_SECRET_KEY",required:!0})]}),e[9]=a,e[10]=g):g=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(Ao,{htmlFor:"value",children:"Value"}),e[11]=y):y=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(w=T=>d(T.target.value),e[12]=w):w=e[12],e[13]!==c?(j=i.jsx(ao,{id:"value",type:"text",value:c,onChange:w,required:!0,autoComplete:"off"}),e[13]=c,e[14]=j):j=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(N=window.location.href.startsWith("http://")&&i.jsx(kp,{children:"Note: You are sending this key over http."}),e[15]=N):N=e[15],e[16]!==j?(C=i.jsxs("div",{className:"grid gap-2",children:[y,j,N]}),e[16]=j,e[17]=C):C=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(Ao,{htmlFor:"location",children:"Location"}),e[18]=k):k=e[18],e[19]!==n.length?(_=n.length===0&&i.jsx("p",{className:"text-sm text-muted-foreground",children:"No dotenv locations configured."}),e[19]=n.length,e[20]=_):_=e[20],e[21]!==u||e[22]!==n?(E=n.length>0&&i.jsxs(Tl,{value:u,onValueChange:T=>h(T),children:[i.jsx(Dl,{children:i.jsx(Ml,{placeholder:"Select a provider"})}),i.jsx(Ol,{children:n.map(u0)})]}),e[21]=u,e[22]=n,e[23]=E):E=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(I=i.jsxs(kp,{children:["You can configure the location by setting the"," ",i.jsx(Ll,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[24]=I):I=e[24],e[25]!==_||e[26]!==E?(A=i.jsxs("div",{className:"grid gap-2",children:[k,_,E,I]}),e[25]=_,e[26]=E,e[27]=A):A=e[27],e[28]!==C||e[29]!==A||e[30]!==g?(F=i.jsxs("div",{className:"grid gap-4 py-4",children:[g,C,A]}),e[28]=C,e[29]=A,e[30]=g,e[31]=F):F=e[31],e[32]!==o?(D=i.jsx(ye,{type:"button",variant:"outline",onClick:o,children:"Cancel"}),e[32]=o,e[33]=D):D=e[33];const M=!a||!c||!u;let O,R,z;return e[34]!==M?(O=i.jsx(ye,{type:"submit",disabled:M,children:"Add Secret"}),e[34]=M,e[35]=O):O=e[35],e[36]!==D||e[37]!==O?(R=i.jsxs(Hs,{children:[D,O]}),e[36]=D,e[37]=O,e[38]=R):R=e[38],e[39]!==f||e[40]!==F||e[41]!==R?(z=i.jsx(io,{children:i.jsxs("form",{onSubmit:f,children:[b,F,R]})}),e[39]=f,e[40]=F,e[41]=R,e[42]=z):z=e[42],z};function u0(t){return i.jsx(Rl,{value:t,children:t},t)}const Yd=S.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Bn.NOOP}),h0=t=>{const e=P.c(14),{children:n}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];const{data:r,isPending:s,error:a,refetch:l}=vr(g0,o);let c,d,u,h;return e[1]!==(r==null?void 0:r.secretKeys)?(c=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=c):c=e[2],e[3]!==(r==null?void 0:r.providerNames)?(d=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=d):d=e[4],e[5]!==a||e[6]!==s||e[7]!==l||e[8]!==c||e[9]!==d?(u={secretKeys:c,providerNames:d,loading:s,error:a,refreshSecrets:l},e[5]=a,e[6]=s,e[7]=l,e[8]=c,e[9]=d,e[10]=u):u=e[10],e[11]!==n||e[12]!==u?(h=i.jsx(Yd,{value:u,children:n}),e[11]=n,e[12]=u,e[13]=h):h=e[13],h};function m0(t){return t.provider!=="env"}function f0(t){return t.name}function p0(t){return t.keys}async function g0(){const t=await yC.request({}),e=Vc(t.secrets).filter(m0).map(f0);return{secretKeys:t.secrets.flatMap(p0).sort(),providerNames:e}}let Ha,Ja,Xd,Qd,Zd,eu,Ka;Ha=[{name:"PostgreSQL",schema:Od,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:Rd,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:Ld,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:Fd,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:Bd,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:Pd,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:Ud,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Wd,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:zd,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:$d,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:Vd,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:qd,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:Hd,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:Jd,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Ja=[{name:"Iceberg",schema:Gd,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],Xd=t=>{const e=P.c(14),{onSelect:n}=t;let o;e[0]!==n?(o=h=>{const{name:m,schema:f,color:b,logo:x}=h;return i.jsxs("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:{backgroundColor:b},onClick:()=>n(f),children:[i.jsx(Ck,{name:x,className:"w-8 h-8 text-white brightness-0 invert dark:invert"}),i.jsx("span",{className:"text-white font-medium text-lg",children:m})]},m)},e[0]=n,e[1]=o):o=e[1];const r=o;let s,a,l,c,d,u;return e[2]!==r?(s=Ha.map(r),e[2]=r,e[3]=s):s=e[3],e[4]!==s?(a=i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[4]=s,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsxs("h4",{className:"font-semibold text-muted-foreground text-lg flex items-center gap-4",children:["Data Catalogs",i.jsx("hr",{className:"flex-1"})]}),e[6]=l):l=e[6],e[7]!==r?(c=Ja.map(r),e[7]=r,e[8]=c):c=e[8],e[9]!==c?(d=i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:c}),e[9]=c,e[10]=d):d=e[10],e[11]!==a||e[12]!==d?(u=i.jsxs(i.Fragment,{children:[a,l,d]}),e[11]=a,e[12]=d,e[13]=u):u=e[13],u},Qd=[{isMatch:t=>{if(t instanceof Sp||t instanceof yk){const{optionRegex:e}=fe.parse(t._def.description||"");return!!e}return!1},Component:({schema:t,form:e,path:n})=>{const{secretKeys:o,providerNames:r,refreshSecrets:s}=S.use(Yd),{openModal:a,closeModal:l}=Pn(),{label:c,description:d,optionRegex:u=""}=fe.parse(t._def.description||""),[h,m]=nt(o,f=>new RegExp(u,"i").test(f));return i.jsx(jp,{control:e.control,name:n,render:({field:f})=>i.jsxs(Cp,{children:[i.jsx(gk,{children:c}),i.jsx(bk,{children:d}),i.jsx(Np,{children:i.jsxs("div",{className:"flex gap-2",children:[t instanceof Sp?i.jsx(ao,{...f,value:f.value,onChange:f.onChange,className:ue("flex-1")}):i.jsx(xk,{...f,value:f.value,onChange:f.onChange,className:"flex-1"}),i.jsxs(zn,{children:[i.jsx(Un,{asChild:!0,children:i.jsx(ye,{variant:"outline",size:"icon",className:ue(Xr(f.value)&&"bg-accent"),children:i.jsx(Ac,{className:"h-3 w-3"})})}),i.jsxs(Wn,{align:"end",className:"max-h-60 overflow-y-auto",children:[i.jsxs(lo,{onSelect:()=>{a(i.jsx(Lc,{providerNames:r,onSuccess:b=>{s(),f.onChange(qa(b)),l()},onClose:l}))},children:[i.jsx(Ur,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),h.length>0&&i.jsxs(i.Fragment,{children:[i.jsx(En,{}),i.jsx(Ep,{children:"Recommended"})]}),h.map(b=>i.jsx(lo,{onSelect:()=>f.onChange(qa(b)),children:b},b)),m.length>0&&i.jsx(En,{}),m.map(b=>i.jsx(lo,{onSelect:()=>f.onChange(qa(b)),children:b},b))]})]})]})}),i.jsx(_p,{})]})})}}],Zd=t=>{var $;const e=P.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,a,l;e[0]!==n?(s=kk(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(a=Ip(n),e[2]=n,e[3]=a):a=e[3],e[4]!==s||e[5]!==a?(l={defaultValues:s,resolver:a,reValidateMode:"onChange"},e[4]=s,e[5]=a,e[6]=l):l=e[6];const c=Ap(l),d=($=[...Ha,...Ja].find(W=>W.schema===n))==null?void 0:$.connectionLibraries,[u,h]=S.useState((d==null?void 0:d.preferred)??"sqlalchemy"),{createNewCell:m}=Ye(),f=jk();let b;e[7]!==m||e[8]!==f?(b=W=>{m({code:W,before:!1,cellId:f??"__end__",skipIfCodeExists:!0})},e[7]=m,e[8]=f,e[9]=b):b=e[9];const x=b;let p;e[10]!==x||e[11]!==o||e[12]!==u?(p=W=>{x((function(G,X){if(!(X in Kd))throw new Error(`Unsupported library: ${X}`);Hg.parse(G);const H=new d0,Y=H.createGenerator(G,X),K=Y.generateConnectionCode(),V=H.secrets,q=[...new Set([...V.imports,...Y.imports])].sort();q.push("");const U=V.formatSecrets();return U&&q.push(U),q.push(K.trim()),q.join(`
|
|
99
|
-
`)})(W,u)),o()},e[10]=x,e[11]=o,e[12]=u,e[13]=p):p=e[13];const g=p;let y;e[14]!==c||e[15]!==g?(y=c.handleSubmit(g),e[14]=c,e[15]=g,e[16]=y):y=e[16];let w,j;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsx(Nk,{}),e[17]=w):w=e[17],e[18]!==c||e[19]!==n?(j=i.jsx(h0,{children:i.jsx(Sk,{schema:n,form:c,renderers:Qd,children:w})}),e[18]=c,e[19]=n,e[20]=j):j=e[20];let N;e[21]!==r?(N=i.jsx(ye,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=N):N=e[22];const C=!c.formState.isValid;let k,_;e[23]!==C?(k=i.jsx(ye,{type:"submit",disabled:C,children:"Add"}),e[23]=C,e[24]=k):k=e[24],e[25]!==N||e[26]!==k?(_=i.jsxs("div",{className:"flex gap-2",children:[N,k]}),e[25]=N,e[26]=k,e[27]=_):_=e[27];const E=Tl;let I,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(I=W=>h(W),e[28]=I):I=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[i.jsx(Dl,{children:i.jsx(Ml,{placeholder:"Select a library"})}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=A):A=e[29];const F=Ol,D=Tp,M=d==null?void 0:d.libraries.map(b0);let O,R,z,T,L;return e[30]!==D||e[31]!==M?(O=i.jsx(D,{children:M}),e[30]=D,e[31]=M,e[32]=O):O=e[32],e[33]!==F||e[34]!==O?(R=i.jsx(F,{children:O}),e[33]=F,e[34]=O,e[35]=R):R=e[35],e[36]!==E||e[37]!==u||e[38]!==I||e[39]!==A||e[40]!==R?(z=i.jsx("div",{children:i.jsxs(E,{value:u,onValueChange:I,children:[A,R]})}),e[36]=E,e[37]=u,e[38]=I,e[39]=A,e[40]=R,e[41]=z):z=e[41],e[42]!==_||e[43]!==z?(T=i.jsxs("div",{className:"flex gap-2 justify-between",children:[_,z]}),e[42]=_,e[43]=z,e[44]=T):T=e[44],e[45]!==T||e[46]!==y||e[47]!==j?(L=i.jsxs("form",{onSubmit:y,className:"space-y-4",children:[j,T]}),e[45]=T,e[46]=y,e[47]=j,e[48]=L):L=e[48],L},eu=t=>{const e=P.c(5),{onSubmit:n}=t,[o,r]=S.useState(null);if(!o){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(Xd,{onSelect:r}),e[0]=l):l=e[0],l}let s,a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>r(null),e[1]=s):s=e[1],e[2]!==n||e[3]!==o?(a=i.jsx(Zd,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a},gg=t=>{const e=P.c(6),{children:n}=t,[o,r]=S.useState(!1);let s,a,l;return e[0]!==n?(s=i.jsx(vk,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(Ka,{onClose:()=>r(!1)}),e[2]=a):a=e[2],e[3]!==o||e[4]!==s?(l=i.jsxs(wk,{open:o,onOpenChange:r,children:[s,a]}),e[3]=o,e[4]=s,e[5]=l):l=e[5],l},Ka=t=>{const e=P.c(4),{onClose:n}=t;let o,r,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(so,{children:"Add Connection"}),e[0]=o):o=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsxs(xr,{className:"mb-4",children:[o,i.jsxs(yr,{children:["Connect to your database or data catalog to query data directly from your notebook. Learn more about how to connect to your database in our"," ",i.jsx(Ll,{href:"https://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database",children:"docs."})]})]}),e[1]=r):r=e[1],e[2]!==n?(s=i.jsxs(io,{className:"max-h-[75vh] overflow-y-auto",children:[r,i.jsx(eu,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function b0(t){return i.jsx(Rl,{value:t,children:Kd[t]},t)}const x0=()=>{const t=P.c(7),{selectedLayout:e}=eg(),{setLayoutView:n}=tg();if(Qt()&&!Ys("wasm_layouts"))return null;let o,r,s,a;return t[0]!==n?(o=l=>n(l),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(Dl,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:i.jsx(Ml,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(Ol,{children:i.jsxs(Tp,{children:[i.jsx(Ek,{children:"View as"}),ng.map(v0)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(a=i.jsxs(Tl,{"data-testid":"layout-select",value:e,onValueChange:o,children:[r,s]}),t[4]=e,t[5]=o,t[6]=a):a=t[6],a};function y0(t){const e=tu(t);return i.jsx(e,{className:"h-4 w-4"})}function tu(t){switch(t){case"vertical":return sd;case"grid":return nC;case"slides":return Ba;default:return Bl(t),Pl}}function nu(t){return Fl(t)}function v0(t){return i.jsx(Rl,{value:t,children:i.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[y0(t),i.jsx("span",{children:nu(t)})]})},t)}function ou(){const t=P.c(4),{openConfirm:e}=Pn(),n=Ct(Nt),{sendRestart:o}=qe();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=()=>{e({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:i.jsx(Ik,{onClick:async()=>{n({state:ht.CLOSING}),await o(),Ak()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],r}const Ho=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};Bc=function(){var H,Y;const t=P.c(39),e=Ul(),{openModal:n,closeModal:o}=Pn(),{toggleApplication:r}=wr(),{selectedPanel:s}=Qs(),[a]=_n(El),l=ie(To),c=(()=>{const{updateCellConfig:K}=Ye(),{saveCellConfig:V}=qe();return S.useCallback(async()=>{const q=new Xs,U=Mt(),ne=U.cellIds.inOrderIds,Q={};for(const oe of ne){if(U.cellData[oe]===void 0)continue;const{code:se,config:ae}=U.cellData[oe];ae.hide_code||q.isSupported(se)&&(Q[oe]={hide_code:!0})}const ee=zl.entries(Q);if(ee.length!==0){await V({configs:Q});for(const[oe,se]of ee)K({cellId:oe,config:se})}},[K])})(),[d]=Zs(),{updateCellConfig:u,undoDeleteCell:h,clearAllCellOutputs:m,upsertSetupCell:f,collapseAllCells:b,expandAllCells:x}=Ye(),p=ou(),g=Ad(),y=(function(K){const V=P.c(5),{openPrompt:q,closeModal:U}=Pn(),{sendCopy:ne}=qe();let Q;return V[0]!==U||V[1]!==q||V[2]!==ne||V[3]!==K?(Q=()=>{if(!K)return null;const ee=_k.guessDeliminator(K),oe=Ot.basename(K);q({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${oe}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:se=>{const ae=ee.join(Ot.dirname(K),se);ne({source:K,destination:ae}).then(()=>{U(),ze({title:"Notebook copied",description:"A copy of the notebook has been created."}),oC(ae)})}})},V[0]=U,V[1]=q,V[2]=ne,V[3]=K,V[4]=Q):Q=V[4],Q})(e),w=Ct(_a),j=Ct(rC),N=Ct(sC),{exportAsMarkdown:C,readCode:k,saveCellConfig:_}=qe(),E=ie(Tk),I=ie(Dk),A=ie(Dp),{selectedLayout:F}=eg(),{setLayoutView:D}=tg(),M=Id(),O=((H=d.sharing)==null?void 0:H.html)??!0,R=((Y=d.sharing)==null?void 0:Y.wasm)??!0,z=z0;let T;t[0]===Symbol.for("react.memo_cache_sentinel")?(T=i.jsx(fd,{size:14,strokeWidth:1.5}),t[0]=T):T=t[0];const L=!O&&!R;let $;t[1]===Symbol.for("react.memo_cache_sentinel")?($=i.jsx(zk,{size:14,strokeWidth:1.5}),t[1]=$):$=t[1];const W=!O;let G,X;return t[2]!==o||t[3]!==n?(G=async()=>{n(i.jsx(Vg,{onClose:o}))},t[2]=o,t[3]=n,t[4]=G):G=t[4],t[5]!==A||t[6]!==m||t[7]!==o||t[8]!==b||t[9]!==y||t[10]!==x||t[11]!==C||t[12]!==e||t[13]!==E||t[14]!==I||t[15]!==c||t[16]!==l||t[17]!==n||t[18]!==k||t[19]!==p||t[20]!==g||t[21]!==_||t[22]!==F||t[23]!==s||t[24]!==w||t[25]!==N||t[26]!==D||t[27]!==j||t[28]!==R||t[29]!==L||t[30]!==W||t[31]!==G||t[32]!==r||t[33]!==M||t[34]!==h||t[35]!==u||t[36]!==f||t[37]!==a.mode?(X=[{icon:T,label:"Share",handle:Ho,hidden:L,dropdown:[{icon:$,label:"Publish HTML to web",hidden:W,handle:G},{icon:i.jsx(J1,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!R,handle:async()=>{const K=await k(),V=Mk({code:K.contents});await Eo(V),ze({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:i.jsx(Rk,{size:14,strokeWidth:1.5}),label:"Download",handle:Ho,dropdown:[{icon:i.jsx(rg,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await og({filename:e,includeCode:!0}):ze({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:i.jsx(rg,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await og({filename:e,includeCode:!1}):ze({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:i.jsx(ea,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const K=await C({download:!1});Wl(new Blob([K],{type:"text/plain"}),Mp.toMarkdown(document.title))}},{icon:i.jsx(Hc,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const K=await k();Wl(new Blob([K.contents],{type:"text/plain"}),Mp.toPY(document.title))}},{divider:!0,icon:i.jsx(Sc,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:a.mode!=="present",tooltip:a.mode==="present"?void 0:i.jsxs("span",{children:["Only available in app view. ",i.jsx("br",{}),"Toggle with: ",St("global.hideCode",!1)]}),handle:P0},{icon:i.jsx(Ok,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:a.mode!=="present",tooltip:a.mode==="present"?void 0:i.jsxs("span",{children:["Only available in app view. ",i.jsx("br",{}),"Toggle with: ",St("global.hideCode",!1)]}),handle:F0}]},{divider:!0,icon:i.jsx(hd,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Ho,dropdown:Kr.flatMap(K=>{const{type:V,Icon:q,hidden:U}=K;return U?[]:{label:Fl(V),rightElement:z(s===V),icon:i.jsx(q,{size:14,strokeWidth:1.5}),handle:()=>r(V)}})},{icon:i.jsx(Ba,{size:14,strokeWidth:1.5}),label:"Present as",handle:Ho,dropdown:[{icon:a.mode==="present"?i.jsx(Op,{size:14,strokeWidth:1.5}):i.jsx(La,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{M()}},...ng.map((K,V)=>{const q=tu(K);return{divider:V===0,label:nu(K),icon:i.jsx(q,{size:14,strokeWidth:1.5}),rightElement:i.jsx("div",{className:"w-8 flex justify-end",children:F===K&&i.jsx($l,{size:14})}),handle:()=>{D(K),a.mode==="edit"&&M()}}})]},{icon:i.jsx(Xc,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||Qt(),handle:y},{icon:i.jsx(Oa,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const K=await k();await Eo(K.contents),ze({title:"Copied",description:"Code copied to clipboard."})}},{icon:i.jsx(_t,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!E||l,handle:async()=>{const K=Mt(),V=Lk(K),q=zl.fromEntries(V.map(L0));await _({configs:q});for(const U of V)u({cellId:U,config:{disabled:!1}})}},{icon:i.jsx(Et,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!I||l,handle:async()=>{const K=Mt(),V=bp(K),q=zl.fromEntries(V.map(R0));await _({configs:q});for(const U of V)u({cellId:U,config:{disabled:!0}})}},{icon:i.jsx(Vl,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:c},{icon:i.jsx(qc,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:b},{icon:i.jsx(Gc,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x},{icon:i.jsx(Jc,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({code:"# Initialization code that runs before all other cells"})}},{icon:i.jsx(Ks,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{m()}},{icon:i.jsx(Kc,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{g()}},{icon:i.jsx(za,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!A||l,handle:()=>{h()}},{icon:i.jsx(_o,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(i.jsx(Ka,{onClose:o}))}},{divider:!0,icon:i.jsx(Ra,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>w(O0)},{icon:i.jsx(Fk,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>j(M0)},{icon:i.jsx(rd,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>N(D0)},{icon:i.jsx(K1,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:T0},{icon:i.jsx(Bk,{size:14,strokeWidth:1.5}),label:"Resources",handle:Ho,dropdown:[{icon:i.jsx(K1,{size:14,strokeWidth:1.5}),label:"Documentation",handle:A0},{icon:i.jsx(aC,{size:14,strokeWidth:1.5}),label:"GitHub",handle:I0},{icon:i.jsx(iC,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:_0},{icon:i.jsx(lC,{size:14,strokeWidth:1.5}),label:"YouTube",handle:E0},{icon:i.jsx(wp,{size:14,strokeWidth:1.5}),label:"Changelog",handle:S0}]},{divider:!0,icon:i.jsx(nd,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:N0},{icon:i.jsx(Ic,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:C0},{icon:i.jsx(xd,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(j0).map(w0),t[5]=A,t[6]=m,t[7]=o,t[8]=b,t[9]=y,t[10]=x,t[11]=C,t[12]=e,t[13]=E,t[14]=I,t[15]=c,t[16]=l,t[17]=n,t[18]=k,t[19]=p,t[20]=g,t[21]=_,t[22]=F,t[23]=s,t[24]=w,t[25]=N,t[26]=D,t[27]=j,t[28]=R,t[29]=L,t[30]=W,t[31]=G,t[32]=r,t[33]=M,t[34]=h,t[35]=u,t[36]=f,t[37]=a.mode,t[38]=X):X=t[38],X};function w0(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(k0)}:t}function k0(t){return!t.hidden}function j0(t){return!t.hidden}function C0(){const t=Pk();window.open(t,"_blank")}function N0(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function S0(){window.open(Xt.releasesPage,"_blank")}function E0(){window.open(Xt.youtube,"_blank")}function _0(){window.open(Xt.discordLink,"_blank")}function I0(){window.open(Xt.githubPage,"_blank")}function A0(){window.open(Xt.docsPage,"_blank")}function T0(){window.open(Xt.docsPage,"_blank")}function D0(t){return!t}function M0(t){return!t}function O0(t){return!t}function R0(t){return[t,{disabled:!0}]}function L0(t){return[t,{disabled:!1}]}async function F0(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(B0,0),setTimeout(()=>window.dispatchEvent(e),0)}function B0(){return window.print()}async function P0(){const t=document.getElementById("App");t&&await Rp(t,document.title)}function z0(t){return i.jsx("div",{className:"w-8 flex justify-end",children:t&&i.jsx($l,{size:14})})}const U0=t=>{const e=P.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,a=Bc();let l,c,d;e[0]!==s?(l=i.jsx("div",{children:s}),e[0]=s,e[1]=l):l=e[1],e[2]!==r?(c=!r&&i.jsxs("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border flex items-center gap-2",children:[i.jsx("span",{children:"Open command palette"}),St("global.commandPalette",!1)]}),e[2]=r,e[3]=c):c=e[3],e[4]!==l||e[5]!==c?(d=i.jsxs("div",{className:"flex flex-col gap-2",children:[l,c]}),e[4]=l,e[5]=c,e[6]=d):d=e[6];const u=d,h=r?"disabled":"hint-green";let m,f,b;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(vC,{strokeWidth:1.8}),e[7]=m):m=e[7],e[8]!==u?(f=i.jsx(pe,{content:u,children:m}),e[8]=u,e[9]=f):f=e[9],e[10]!==r||e[11]!==h||e[12]!==f?(b=i.jsx(tn,{"aria-label":"Config",shape:"circle",size:"small",className:"h-[27px] w-[27px]","data-testid":"notebook-menu-dropdown",disabled:r,color:h,children:f}),e[10]=r,e[11]=h,e[12]=f,e[13]=b):b=e[13];const x=b,p=W0;let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=E=>{const I=i.jsx(lo,{variant:E.variant,disabled:E.disabled,onSelect:A=>E.handle(A),"data-testid":`notebook-menu-dropdown-${E.label}`,children:p(E)},E.label);return E.tooltip?i.jsx(pe,{content:E.tooltip,side:"left",delayDuration:100,children:i.jsx("span",{children:I})},E.label):I},e[14]=g):g=e[14];const y=g;let w,j,N,C,k,_;if(e[15]!==x||e[16]!==r?(w=i.jsx(Un,{asChild:!0,disabled:r,children:x}),e[15]=x,e[16]=r,e[17]=w):w=e[17],e[18]!==a){let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=I=>I.hidden?null:I.dropdown?i.jsxs(Uk,{children:[i.jsx(Wk,{"data-testid":`notebook-menu-dropdown-${I.label}`,children:p(I)}),i.jsx($k,{children:i.jsx(Vk,{children:I.dropdown.map(A=>i.jsxs(me.Fragment,{children:[A.divider&&i.jsx(En,{}),y(A)]},A.label))})})]},I.label):i.jsxs(me.Fragment,{children:[I.divider&&i.jsx(En,{}),y(I)]},I.label),e[20]=E):E=e[20],j=a.map(E),e[18]=a,e[19]=j}else j=e[19];return e[21]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(En,{}),e[21]=N):N=e[21],e[22]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:i.jsxs("span",{children:["Version: ",Lp()]})}),e[22]=C):C=e[22],e[23]!==j?(k=i.jsxs(Wn,{align:"end",className:"no-print w-[240px]",children:[j,N,C]}),e[23]=j,e[24]=k):k=e[24],e[25]!==w||e[26]!==k?(_=i.jsxs(zn,{modal:!1,children:[w,k]}),e[25]=w,e[26]=k,e[27]=_):_=e[27],_};function W0(t){return i.jsxs(i.Fragment,{children:[t.icon&&i.jsx("span",{className:"flex-0 mr-2",children:t.icon}),i.jsx("span",{className:"flex-1",children:t.labelElement||t.label}),t.hotkey&&i.jsx(Gl,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function Ya(t){return Zt("create"in t,'Expected query to have a "create" method'),t}const ft=Gk({findText:"",replaceText:"",caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(t,e)=>{if(e===void 0)return t;switch(e.type){case"setFind":return{...t,findText:e.find};case"setReplace":return{...t,replaceText:e.replace};case"setCaseSensitive":return{...t,caseSensitive:e.caseSensitive};case"setWholeWord":return{...t,wholeWord:e.wholeWord};case"setRegex":return{...t,regexp:e.regexp};case"setIsOpen":return{...t,isOpen:e.isOpen};case"setCurrentView":return{...t,currentView:{view:e.view,range:e.range}};case"clearCurrentView":return{...t,currentView:void 0}}});function ru(t){if([...document.querySelectorAll('[role="dialog"][data-state="open"]')].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(t){const e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);n?(Le.set(ft,{type:"setFind",find:n}),Le.set(ft,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):Le.set(ft,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return Le.get(ft).isOpen?(Le.set(ft,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{Le.set(ft,{type:"setIsOpen",isOpen:!0})}),!0):(Le.set(ft,{type:"setIsOpen",isOpen:!0}),!0)}function $0(){return!!Le.get(ft).isOpen&&(Le.set(ft,{type:"setIsOpen",isOpen:!1}),!0)}function Zr(t){return()=>{const e=Le.get(ft),n=new ta({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:Ya(n).create(),search:n})}}const su=t=>Zr(({query:e})=>{const n=Do(),o=Le.get(ft).currentView||{view:n[0],range:{from:0,to:0}};let r=o.range.to;t==="prev"&&(n.reverse(),r=o.range.from);let s=n.indexOf(o.view);s<0&&(s=0);const a=[...n,...n].slice(s);for(const l of a){const c=t==="next"?e.nextMatch(l.state,0,r??0):e.prevMatch(l.state,r??l.state.doc.length,l.state.doc.length);if(!c){r=null,l.dispatch({selection:Yt.single(0)});continue}const d=Yt.single(c.from,c.to);return l.dispatch({selection:d,effects:[Se.scrollIntoView(d.main,{y:"center"})],userEvent:"select.search"}),Le.set(ft,{type:"setCurrentView",view:l,range:{from:c.from,to:c.to}}),c}return!1}),Xa=su("next"),au=su("prev"),V0=Zr(({query:t})=>{var o;const e=Do(),n=[];for(const r of e){if(r.state.readOnly)continue;const s=(o=t.matchAll(r.state,1e9))==null?void 0:o.map(l=>{const{from:c,to:d}=l;return{from:c,to:d,insert:t.getReplacement(l)}});if(!s||s.length===0)continue;const a=r.state.doc.toString();n.push(()=>{r.dispatch({changes:[{from:0,to:r.state.doc.length,insert:a}],userEvent:"input.replace.all"})}),r.dispatch({changes:s,userEvent:"input.replace.all"})}return()=>{for(const r of n)r()}}),G0=Zr(({query:t})=>{const e=Do(),n=Le.get(ft).currentView||{view:e[0],range:{from:0}};let o=n.range.from,r=e.indexOf(n.view);r<0&&(r=0);const s=[...e,...e].slice(r);for(const a of s){const l=t.nextMatch(a.state,0,o??0);if(!l){o=null,a.dispatch({selection:Yt.single(0)});continue}const c=a.state.toText(t.getReplacement(l));return a.dispatch({changes:[{from:l.from,to:l.to,insert:c}],userEvent:"input.replace"}),Xa()}return!1}),q0=Zr(({query:t})=>{const e=Do();let n=0;const o=new Map;for(const r of e){const s=t.matchAll(r.state,1e9)||[];for(const a of s){const{from:l,to:c}=a,d=o.get(r)||new Map;d.set(`${l}:${c}`,n++),o.set(r,d)}}return{count:n,position:o}}),Qa=tt.define();function iu(){const t=Do();for(const e of t)e.state.readOnly||e.dispatch({effects:Qa.of(new ta({search:""}))})}const es=Dt.define({create(){const t=Le.get(ft);return Ya(new ta({search:t.findText,caseSensitive:t.caseSensitive,regexp:t.regexp,replace:t.replaceText,wholeWord:t.wholeWord})).create()},update(t,e){for(const n of e.effects)n.is(Qa)&&(t=Ya(n.value).create());return t}}),H0=Te.mark({class:"cm-searchMatch"}),J0=Te.mark({class:"cm-searchMatch cm-searchMatch-selected"}),K0=Wt.fromClass(class{constructor(t){this.view=t,this.decorations=void 0,this.decorations=this.highlight(t.state.field(es))}update(t){const e=t.state.field(es);(e!==t.startState.field(es)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight(t){if(!t.spec.valid)return Te.none;const{view:e}=this,n=new Mo,o=e.visibleRanges,r=o.length;for(let s=0;s<r;s++){let{to:a}=o[s];const{from:l}=o[s];for(;s<r-1&&a>o[s+1].from-500;)a=o[++s].to;t.highlight(e.state,l,a,(c,d)=>{const u=e.state.selection.ranges.some(h=>h.from===c&&h.to===d);n.add(c,d,u?J0:H0)})}return n.finish()}},{decorations:t=>t.decorations}),Y0=Se.baseTheme({"&light .cm-searchMatch":{backgroundColor:"#99ff7780"},"&dark .cm-searchMatch":{backgroundColor:"#22bb0070"},"&light .cm-searchMatch-selected":{backgroundColor:"transparent"},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff88 !important"}}),X0=()=>{var ve;const t=P.c(102),[e,n]=S.useState(!1),[o,r]=_n(ft),[s,a]=S.useState(),l=S.useRef(null),c=ie(ql);let d,u;t[0]!==e||t[1]!==o.isOpen?(d=()=>(!e||!o.isOpen)&&ru(),t[0]=e,t[1]=o.isOpen,t[2]=d):d=t[2],st("cell.findAndReplace",d),t[3]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{const be=q0();a(be===!1?void 0:be)},t[3]=u):u=t[3];const h=u;let m,f,b,x;if(t[4]!==o.isOpen?(m=()=>{o.isOpen&&l.current&&(l.current.focus(),l.current.select())},f=[o.isOpen],t[4]=o.isOpen,t[5]=m,t[6]=f):(m=t[5],f=t[6]),S.useEffect(m,f),t[7]!==o.findText||t[8]!==o.isOpen?(b=()=>{if(o.isOpen){if(o.findText==="")return a(void 0),void iu();h(),(function(){const be=Le.get(ft),et=Do();for(const rt of et)rt.state.readOnly||rt.dispatch({effects:Qa.of(new ta({search:be.findText,caseSensitive:be.caseSensitive,regexp:be.regexp,replace:be.replaceText,wholeWord:be.wholeWord}))})})()}else iu()},t[7]=o.findText,t[8]=o.isOpen,t[9]=b):b=t[9],t[10]!==o.caseSensitive||t[11]!==o.findText||t[12]!==o.isOpen||t[13]!==o.regexp||t[14]!==o.wholeWord?(x=[o.findText,o.isOpen,o.caseSensitive,o.regexp,o.wholeWord],t[10]=o.caseSensitive,t[11]=o.findText,t[12]=o.isOpen,t[13]=o.regexp,t[14]=o.wholeWord,t[15]=x):x=t[15],S.useEffect(b,x),!o.isOpen)return null;const p=o.currentView;let g;t[16]!==s||t[17]!==p?(g=p&&s?(ve=s.position.get(p.view))==null?void 0:ve.get(`${p.range.from}:${p.range.to}`):void 0,t[16]=s,t[17]=p,t[18]=g):g=t[18];const y=g;let w,j,N,C,k,_,E,I,A,F,D;t[19]===Symbol.for("react.memo_cache_sentinel")?(w=()=>n(!0),t[19]=w):w=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(j=()=>n(!1),t[20]=j):j=t[20],t[21]!==r?(N=be=>{be.key==="Escape"&&r({type:"setIsOpen",isOpen:!1})},t[21]=r,t[22]=N):N=t[22],t[23]!==r?(C=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=C):C=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(Vt,{className:"w-4 h-4"}),t[25]=k):k=t[25],t[26]!==C?(_=i.jsx("div",{className:"absolute top-0 right-0",children:i.jsx(ye,{"data-testid":"close-find-replace-button",onClick:C,size:"xs",variant:"text",children:k})}),t[26]=C,t[27]=_):_=t[27],t[28]!==r?(E=be=>{r({type:"setFind",find:be.target.value})},t[28]=r,t[29]=E):E=t[29],t[30]!==o.findText||t[31]!==E?(I=i.jsx(ao,{ref:l,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:Z0,onChange:E}),t[30]=o.findText,t[31]=E,t[32]=I):I=t[32],t[33]!==r?(A=be=>{r({type:"setReplace",replace:be.target.value})},t[33]=r,t[34]=A):A=t[34],t[35]!==o.replaceText||t[36]!==A?(F=i.jsx(ao,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:A}),t[35]=o.replaceText,t[36]=A,t[37]=F):F=t[37],t[38]!==I||t[39]!==F?(D=i.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[I,F]}),t[38]=I,t[39]=F,t[40]=D):D=t[40];const M=o.caseSensitive?"on":"off";let O,R,z;t[41]!==r?(O=be=>r({type:"setCaseSensitive",caseSensitive:be}),t[41]=r,t[42]=O):O=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(R=i.jsx(Hk,{className:"w-4 h-4"}),t[43]=R):R=t[43],t[44]!==o.caseSensitive||t[45]!==M||t[46]!==O?(z=i.jsx(pe,{content:"Case Sensitive",children:i.jsx(Hl,{size:"sm",pressed:o.caseSensitive,"data-state":M,onPressedChange:O,children:R})}),t[44]=o.caseSensitive,t[45]=M,t[46]=O,t[47]=z):z=t[47];const T=o.wholeWord?"on":"off";let L,$,W;t[48]!==r?(L=be=>r({type:"setWholeWord",wholeWord:be}),t[48]=r,t[49]=L):L=t[49],t[50]===Symbol.for("react.memo_cache_sentinel")?($=i.jsx(wd,{className:"w-4 h-4"}),t[50]=$):$=t[50],t[51]!==o.wholeWord||t[52]!==T||t[53]!==L?(W=i.jsx(pe,{content:"Match Whole Word",children:i.jsx(Hl,{size:"sm",pressed:o.wholeWord,"data-state":T,onPressedChange:L,children:$})}),t[51]=o.wholeWord,t[52]=T,t[53]=L,t[54]=W):W=t[54];const G=o.regexp?"on":"off";let X,H,Y,K,V;t[55]!==r?(X=be=>r({type:"setRegex",regexp:be}),t[55]=r,t[56]=X):X=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(H=i.jsx(md,{className:"w-4 h-4"}),t[57]=H):H=t[57],t[58]!==o.regexp||t[59]!==G||t[60]!==X?(Y=i.jsx(pe,{content:"Use Regular Expression",children:i.jsx(Hl,{size:"sm",pressed:o.regexp,"data-state":G,onPressedChange:X,children:H})}),t[58]=o.regexp,t[59]=G,t[60]=X,t[61]=Y):Y=t[61],t[62]!==z||t[63]!==W||t[64]!==Y?(K=i.jsxs("div",{className:"flex items-center gap-[2px]",children:[z,W,Y]}),t[62]=z,t[63]=W,t[64]=Y,t[65]=K):K=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{G0()&&h()},t[66]=V):V=t[66];const q=o.findText==="";let U,ne;t[67]!==q?(U=i.jsx(ye,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:V,disabled:q,children:"Replace Next"}),t[67]=q,t[68]=U):U=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>{const be=V0();if(!be)return;h();const{dismiss:et}=ze({title:"Replaced all occurrences",action:i.jsx(Fp,{"data-testid":"undo-replace-all-button",onClick:()=>{be(),rt()}})}),rt=et},t[69]=ne):ne=t[69];const Q=o.findText==="";let ee,oe,se,ae,te,_e,he,we,ke,ge,Ee,Oe;return t[70]!==Q?(ee=i.jsx(ye,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:ne,disabled:Q,children:"Replace All"}),t[70]=Q,t[71]=ee):ee=t[71],t[72]!==U||t[73]!==ee?(oe=i.jsxs("div",{className:"flex items-center gap-[2px]",children:[U,ee]}),t[72]=U,t[73]=ee,t[74]=oe):oe=t[74],t[75]!==K||t[76]!==oe?(se=i.jsxs("div",{className:"flex flex-col gap-2",children:[K,oe]}),t[75]=K,t[76]=oe,t[77]=se):se=t[77],t[78]!==D||t[79]!==se?(ae=i.jsxs("div",{className:"flex items-center gap-3",children:[D,se]}),t[78]=D,t[79]=se,t[80]=ae):ae=t[80],t[81]===Symbol.for("react.memo_cache_sentinel")?(te=i.jsx(pe,{content:"Find Previous",children:i.jsx(ye,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:eb,children:i.jsx(Pc,{className:"w-4 h-4"})})}),t[81]=te):te=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(_e=i.jsx(pe,{content:"Find Next",children:i.jsx(ye,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:tb,children:i.jsx($c,{className:"w-4 h-4"})})}),t[82]=_e):_e=t[82],t[83]!==y||t[84]!==s?(he=s!=null&&y==null&&i.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=y,t[84]=s,t[85]=he):he=t[85],t[86]!==y||t[87]!==s?(we=s!=null&&y!=null&&i.jsxs("span",{className:"text-sm",children:[y+1," of ",s.count]}),t[86]=y,t[87]=s,t[88]=we):we=t[88],t[89]!==he||t[90]!==we?(ke=i.jsxs("div",{className:"flex items-center gap-2",children:[te,_e,he,we]}),t[89]=he,t[90]=we,t[91]=ke):ke=t[91],t[92]!==c?(ge=c.getHotkey("cell.findAndReplace"),t[92]=c,t[93]=ge):ge=t[93],t[94]!==ge.key?(Ee=i.jsxs("div",{className:"text-xs text-muted-foreground flex gap-1 mt-2",children:["Press"," ",i.jsx(qk,{shortcut:ge.key})," ","again to open the native browser search."]}),t[94]=ge.key,t[95]=Ee):Ee=t[95],t[96]!==_||t[97]!==ae||t[98]!==ke||t[99]!==Ee||t[100]!==N?(Oe=i.jsx(Jl,{restoreFocus:!0,autoFocus:!0,children:i.jsxs("div",{onFocus:w,onClick:Q0,onBlur:j,className:"fixed top-0 right-0 w-[500px] flex flex-col bg-(--sage-1) p-4 z-50 mt-2 mr-3 rounded-md shadow-lg border gap-2 print:hidden",onKeyDown:N,children:[_,ae,ke,Ee]})}),t[96]=_,t[97]=ae,t[98]=ke,t[99]=Ee,t[100]=N,t[101]=Oe):Oe=t[101],Oe};function Q0(t){t.stopPropagation(),t.preventDefault()}function Z0(t){t.key==="Enter"&&(t.shiftKey?au():Xa())}function eb(){return au()}function tb(){return Xa()}const lu=t=>{const e=P.c(41),{resetOnBlur:n,placeholderText:o,initialValue:r,flexibleWidth:s,onNameChange:a,className:l}=t,c=n!==void 0&&n,d=r===void 0?null:r,u=s!==void 0&&s,{sendListFiles:h}=qe(),[m,f]=S.useState(d);let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=[],e[0]=b):b=e[0];const[x,p]=S.useState(b),[g,y]=S.useState(!1),w=S.useRef(null),j=S.useRef(!1);let N,C,k;e[1]!==d?(N=()=>{f(d)},C=[d],e[1]=d,e[2]=N,e[3]=C):(N=e[2],C=e[3]),S.useEffect(N,C),e[4]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{y(!0)},e[4]=k):k=e[4];const _=k;let E;e[5]!==d||e[6]!==c?(E=Q=>{var ee;(ee=Q.relatedTarget)!=null&&ee.closest(".filename-input")||(y(!1),c&&f(d))},e[5]=d,e[6]=c,e[7]=E):E=e[7];const I=E;let A;e[8]!==m?(A=Ot.dirname(m||""),e[8]=m,e[9]=A):A=e[9];const F=A,D=Ot.basename(m||""),M=x.filter(Q=>Ot.basename(Q.path).startsWith(D));let O,R;e[10]!==F||e[11]!==g||e[12]!==h?(O=async()=>{if(!g)return void p([]);const Q=await h({path:F});p(Q.files)},e[10]=F,e[11]=g,e[12]=h,e[13]=O):O=e[13],e[14]!==F||e[15]!==g?(R=[F,g],e[14]=F,e[15]=g,e[16]=R):R=e[16];const{isPending:z}=vr(O,R),T=(function(Q,ee,oe){if(Q&&!Q.endsWith("/")&&((Ys("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(Ot.extension(Q))||(Q=Q.endsWith(".")?`${Q}py`:Q.endsWith(".p")?`${Q}y`:`${Q}.py`),!ee.some(se=>se.path===Q||Ot.basename(se.path)===Q)&&!(oe&&(oe===Q||Ot.basename(oe)===Q))))return Q})(m,x,d),L=(T||M.length>0)&&i.jsxs(Bp,{className:"font-mono",children:[!z&&i.jsx(Pp,{children:"No files"}),T&&i.jsxs(Kl,{variant:"success",className:"py-2 px-3",onSelect:()=>{var Q;T&&(j.current=!0,a(T),(Q=w.current)==null||Q.blur())},children:[i.jsx(Yc,{className:"w-4 h-4 mr-2"})," ",i.jsxs("span",{className:"text-sm",children:[d?"Rename to: ":"Save as: ",i.jsx("span",{className:"font-medium text-sm",children:Ot.basename(T)})]})]},"_rename_"),M.map(Q=>{const ee=Q.isDirectory?"directory":Jk(Q.path),oe=Kk[ee];return i.jsxs(Kl,{variant:Q.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{Q.isDirectory?f(`${Q.path}/`):f(Q.path)},children:[i.jsx(oe,{className:"w-4 h-4 mr-2"})," ",Ot.basename(Q.path)]},Q.path)})]}),$=10*Math.max(20,(m==null?void 0:m.length)||(o==null?void 0:o.length)||0),W=g?m||"":d||"";let G,X,H;e[17]!==u||e[18]!==$?(G=u?{maxWidth:$}:void 0,e[17]=u,e[18]=$,e[19]=G):G=e[19],e[20]!==l?(X=ue(l,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[20]=l,e[21]=X):X=e[21],e[22]!==o||e[23]!==W||e[24]!==G||e[25]!==X?(H=i.jsx(Yk,{children:i.jsx(zp,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:W,onKeyDown:nb,icon:null,ref:w,onValueChange:f,placeholder:o,autoComplete:"off",style:G,className:X})}),e[22]=o,e[23]=W,e[24]=G,e[25]=X,e[26]=H):H=e[26];const Y=L&&"group-focus-within:block";let K,V,q,U,ne;return e[27]!==Y?(K=ue("p-0 w-full min-w-80 max-w-80vw hidden",Y),e[27]=Y,e[28]=K):K=e[28],e[29]!==L||e[30]!==K?(V=i.jsx(Yl,{side:"bottom",className:K,portal:!1,children:L}),e[29]=L,e[30]=K,e[31]=V):V=e[31],e[32]!==H||e[33]!==V?(q=i.jsxs(Bp,{children:[H,V]}),e[32]=H,e[33]=V,e[34]=q):q=e[34],e[35]!==I||e[36]!==q?(U=i.jsx(Up,{onFocus:_,onBlur:I,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:q}),e[35]=I,e[36]=q,e[37]=U):U=e[37],e[38]!==g||e[39]!==U?(ne=i.jsx(Xl,{children:i.jsx(na,{open:g,modal:!1,children:U})}),e[38]=g,e[39]=U,e[40]=ne):ne=e[40],ne};function nb(t){t.key==="Escape"&&t.currentTarget.blur()}const ob=t=>{const e=P.c(33),n=()=>{Wl(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=Ce(ab);let r,s,a,l,c,d,u,h,m,f,b,x,p,g,y,w,j;return e[0]!==n||e[1]!==t?(r=N=>{N.preventDefault(),n(),t.closeModal()},e[0]=n,e[1]=t,e[2]=r):r=e[2],e[3]!==t?(s=N=>{N.key==="Escape"&&t.closeModal()},e[3]=t,e[4]=s):s=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(so,{className:"text-accent-foreground mb-6",children:"Download unsaved changes?"}),e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l={wordBreak:"break-word"},e[6]=l):l=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx("p",{children:"This app has unsaved changes. To recover:"}),d={paddingBottom:"10px"},e[7]=c,e[8]=d):(c=e[7],d=e[8]),e[9]!==t.proposedName?(u=i.jsxs("li",{style:d,children:['Click the "Download" button. This will download a file called\xA0',i.jsxs("code",{children:[t.proposedName,".json"]}),". This file contains your code."]}),e[9]=t.proposedName,e[10]=u):u=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(h={paddingBottom:"10px"},e[11]=h):h=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(m={display:"block",padding:"10px"},e[12]=m):m=e[12],e[13]!==t.proposedName?(f=i.jsxs("code",{style:m,children:["marimo recover ",t.proposedName,".json ",">"," ",t.proposedName,".py"]}),e[13]=t.proposedName,e[14]=f):f=e[14],e[15]!==t.proposedName?(b=i.jsxs("code",{children:[t.proposedName,".py"]}),e[15]=t.proposedName,e[16]=b):b=e[16],e[17]!==b||e[18]!==f?(x=i.jsxs("li",{style:h,children:["In your terminal, type",f,"to overwrite ",b," with the recovered changes."]}),e[17]=b,e[18]=f,e[19]=x):x=e[19],e[20]!==x||e[21]!==u?(p=i.jsx(yr,{className:"markdown break-words",style:l,children:i.jsxs("div",{className:"prose dark:prose-invert",children:[c,i.jsxs("ol",{children:[u,x]})]})}),e[20]=x,e[21]=u,e[22]=p):p=e[22],e[23]!==t.closeModal?(g=i.jsx(ye,{"aria-label":"Cancel",variant:"secondary","data-testid":"cancel-recovery-button",onClick:t.closeModal,children:"Cancel"}),e[23]=t.closeModal,e[24]=g):g=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(ye,{"data-testid":"download-recovery-button","aria-label":"Download",variant:"default",type:"submit",children:"Download"}),e[25]=y):y=e[25],e[26]!==g?(w=i.jsxs(Hs,{children:[g,y]}),e[26]=g,e[27]=w):w=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==w?(j=i.jsx(io,{className:"w-fit",children:i.jsxs("form",{onSubmit:r,onKeyDown:s,children:[a,p,w]})}),e[28]=r,e[29]=s,e[30]=p,e[31]=w,e[32]=j):j=e[32],j},rb=t=>{const e=P.c(12),{filename:n,needsSave:o}=t,{openModal:r,closeModal:s}=Pn();let a;e[0]!==n?(a=n===null?"app":Ot.basename(n).split(".")[0],e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==s||e[3]!==o||e[4]!==r||e[5]!==l?(c=()=>{o&&r(i.jsx(ob,{proposedName:l,closeModal:s}))},e[2]=s,e[3]=o,e[4]=r,e[5]=l,e[6]=c):c=e[6];const d=c;let u;st("global.save",d),e[7]===Symbol.for("react.memo_cache_sentinel")?(u=St("global.save"),e[7]=u):u=e[7];const h=o?"yellow":"gray";let m,f;return e[8]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ta,{strokeWidth:1.5,size:18}),e[8]=m):m=e[8],e[9]!==d||e[10]!==h?(f=i.jsx(pe,{content:u,children:i.jsx(tn,{onClick:d,id:"save-button","aria-label":"Save",className:"rectangle",color:h,children:m})}),e[9]=d,e[10]=h,e[11]=f):f=e[11],f};function sb(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function ab(){const t=Mt(),e=Ql(t),n={version:"1",metadata:{marimo_version:Lp()},cells:e.map(sb)};return JSON.stringify(n,null,2)}const Za=5e3,ei=Bt(void 0),cu=Bt(t=>{const e=t(ei);return(function({state:n,layout:o,lastSavedNotebook:r}){if(!r)return!1;const{cellIds:s,cellData:a}=n,l=s.inOrderIds.map(h=>a[h]),c=l.map(h=>h.code),d=l.map(h=>h.config),u=l.map(h=>h.name);return!(Wp(c,r.codes)&&Wp(u,r.names)&&kr(d,r.configs)&&kr(o.selectedLayout,r.layout.selectedLayout)&&kr(o.layoutData,r.layout.layoutData))})({state:t(Gt),layout:t(sg),lastSavedNotebook:e})});function ib(t){return JSON.stringify(t)}const lb=t=>{const e=P.c(15),{kioskMode:n}=t,o=Ul(),r=ie(cu),s=ie(Nt).state===ht.CLOSED,{saveOrNameNotebook:a,saveIfNotebookIsPersistent:l}=ti();let c,d,u;e[0]!==n||e[1]!==l?(c={onSave:l,kioskMode:n},e[0]=n,e[1]=l,e[2]=c):c=e[2],(function(p){const g=P.c(14),y=ie(Gp),w=Kp(),[j]=_n(Nt),N=ie(cu);let C,k;if(g[0]!==w){const F=Ql(w);C=F.map(mb),k=F.map(hb),g[0]=w,g[1]=C,g[2]=k}else C=g[1],k=g[2];const _=k;let E;g[3]!==w?(E=Vp(w),g[3]=w,g[4]=E):E=g[4];const I=E;let A;g[5]!==y||g[6]!==_||g[7]!==C||g[8]!==I||g[9]!==j||g[10]!==N||g[11]!==p.kioskMode||g[12]!==p.onSave?(A={onSave:p.onSave,needsSave:N,codes:C,cellConfigs:I,cellNames:_,connStatus:j,config:y,kioskMode:p.kioskMode},g[5]=y,g[6]=_,g[7]=C,g[8]=I,g[9]=j,g[10]=N,g[11]=p.kioskMode,g[12]=p.onSave,g[13]=A):A=g[13],(function(F){const D=P.c(21),{codes:M,cellConfigs:O,config:R,connStatus:z,cellNames:T,needsSave:L,kioskMode:$,onSave:W}=F,G=S.useRef(null);let X;D[0]!==M?(X=M.join(":"),D[0]=M,D[1]=X):X=D[1];const H=X;let Y;D[2]!==O?(Y=O.map(ib).join(":"),D[2]=O,D[3]=Y):Y=D[3];const K=Y;let V;D[4]!==T?(V=T.join(":"),D[4]=T,D[5]=V):V=D[5];const q=V;let U,ne;D[6]!==R||D[7]!==z.state||D[8]!==$||D[9]!==L||D[10]!==W?(U=()=>{if(!$)return R.autosave==="after_delay"&&(G.current!==null&&clearTimeout(G.current),L&&z.state===ht.OPEN&&(G.current=setTimeout(W,R.autosave_delay))),()=>{G.current!==null&&clearTimeout(G.current)}},D[6]=R,D[7]=z.state,D[8]=$,D[9]=L,D[10]=W,D[11]=U):U=D[11],D[12]!==K||D[13]!==q||D[14]!==H||D[15]!==R||D[16]!==z.state||D[17]!==$||D[18]!==L||D[19]!==W?(ne=[H,K,q,R,z.state,W,$,L],D[12]=K,D[13]=q,D[14]=H,D[15]=R,D[16]=z.state,D[17]=$,D[18]=L,D[19]=W,D[20]=ne):ne=D[20],S.useEffect(U,ne)})(A)})(c),(function(){const p=P.c(12),g=ie(Xk),{state:y}=ie(Nt),w=g.auto_download.includes("markdown"),j=g.auto_download.includes("html"),N=g.auto_download.includes("ipynb"),C=!w||y!==ht.OPEN,k=!j||y!==ht.OPEN,_=!N||y!==ht.OPEN,{autoExportAsHTML:E,autoExportAsIPYNB:I,autoExportAsMarkdown:A}=qe();let F,D,M,O,R,z;p[0]!==A?(F=async()=>{await A({download:!1})},p[0]=A,p[1]=F):F=p[1],p[2]!==C?(D={delayMs:Za,whenVisible:!0,disabled:C},p[2]=C,p[3]=D):D=p[3],Pr(F,D),p[4]!==E?(M=async()=>{await E({download:!1,includeCode:!0,files:Z1.INSTANCE.filenames()})},p[4]=E,p[5]=M):M=p[5],p[6]!==k?(O={delayMs:Za,whenVisible:!0,disabled:k},p[6]=k,p[7]=O):O=p[7],Pr(M,O),p[8]!==I?(R=async()=>{await I({download:!1})},p[8]=I,p[9]=R):R=p[9],p[10]!==_?(z={delayMs:Za,whenVisible:!0,disabled:_},p[10]=_,p[11]=z):z=p[11],Pr(R,z)})(),e[3]!==r?(d=p=>{if(r)return p.preventDefault(),p.returnValue="You have unsaved changes. Are you sure you want to leave?",p.returnValue},e[3]=r,e[4]=d):d=e[4],Jp(window,"beforeunload",d),e[5]!==a?(u=p=>{p.preventDefault(),p.stopPropagation(),a()},e[5]=a,e[6]=u):u=e[6];const h=u;if(st("global.save",a),s){let p;return e[7]!==o||e[8]!==r?(p=i.jsx(rb,{filename:o,needsSave:r}),e[7]=o,e[8]=r,e[9]=p):p=e[9],p}let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=St("global.save"),e[10]=m):m=e[10];const f=r?"yellow":"hint-green";let b,x;return e[11]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(Ta,{strokeWidth:1.5,size:18}),e[11]=b):b=e[11],e[12]!==h||e[13]!==f?(x=i.jsx(pe,{content:m,children:i.jsx(tn,{"data-testid":"save-button",id:"save-button",shape:"rectangle",color:f,onClick:h,children:b})}),e[12]=h,e[13]=f,e[14]=x):x=e[14],x};function ti(){const t=P.c(20),{sendSave:e}=qe(),{openModal:n,closeModal:o,openAlert:r}=Pn(),s=Ct(ei),a=$p(),l=oa();let c;t[0]!==r||t[1]!==e||t[2]!==s||t[3]!==l?(c=(g,y)=>{const w=Mt(),j=Ql(w),N=j.map(ub),C=j.map(db),k=j.map(cb),_=Vp(w),E=l.get(Nt),I=l.get(Gp),A=l.get(sg);l.get(To)||C.length!==0&&(E.state===ht.OPEN?(He.log("saving to ",g),e({cellIds:N,codes:C,names:k,filename:g,configs:_,layout:wC(),persist:!0}).then(()=>{y&&I.format_on_save&&qp(),s({names:k,codes:C,configs:_,layout:A})})):r("Failed to save notebook: not connected to a kernel."))},t[0]=r,t[1]=e,t[2]=s,t[3]=l,t[4]=c):c=t[4];const d=Ce(c);let u;t[5]!==d||t[6]!==l?(u=g=>{const y=g!==void 0&&g,w=l.get(Hp),j=l.get(Nt);du(w)&&j.state===ht.OPEN&&d(w,y)},t[5]=d,t[6]=l,t[7]=u):u=t[7];const h=Ce(u);let m;t[8]!==d||t[9]!==a?(m=g=>{a(g).then(y=>{y!==null&&d(y,!0)})},t[8]=d,t[9]=a,t[10]=m):m=t[10];const f=m;let b;t[11]!==o||t[12]!==f||t[13]!==n||t[14]!==h||t[15]!==l?(b=()=>{const g=l.get(Hp),y=l.get(Nt);h(!0),du(g)||y.state===ht.CLOSED||n(i.jsx(fb,{onClose:o,onSave:f}))},t[11]=o,t[12]=f,t[13]=n,t[14]=h,t[15]=l,t[16]=b):b=t[16];const x=Ce(b);let p;return t[17]!==h||t[18]!==x?(p={saveOrNameNotebook:x,saveIfNotebookIsPersistent:h},t[17]=h,t[18]=x,t[19]=p):p=t[19],p}function cb(t){return t.name}function db(t){return t.code}function ub(t){return t.id}function du(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function hb(t){return t.name}function mb(t){return t.code}const fb=t=>{const e=P.c(17),{onClose:n,onSave:o}=t,[r,s]=S.useState();let a;e[0]!==n||e[1]!==o?(a=p=>{s(p),p.trim()&&(o(p),n())},e[0]=n,e[1]=o,e[2]=a):a=e[2];const l=a;let c,d,u,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(so,{children:"Save notebook"}),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(Ao,{className:"text-md pt-6 px-1",children:"Save as"}),e[4]=d):d=e[4],e[5]!==l?(u=i.jsxs("div",{className:"flex flex-col",children:[d,i.jsx(lu,{onNameChange:l,placeholderText:"filename",className:"missing-filename"})]}),e[5]=l,e[6]=u):u=e[6],e[7]!==n?(h=i.jsx(ye,{"data-testid":"cancel-save-dialog-button","aria-label":"Cancel",variant:"secondary",onClick:n,children:"Cancel"}),e[7]=n,e[8]=h):h=e[8];const m=!r;let f,b,x;return e[9]!==m?(f=i.jsx(ye,{"data-testid":"submit-save-dialog-button","aria-label":"Save",variant:"default",disabled:m,type:"submit",children:"Save"}),e[9]=m,e[10]=f):f=e[10],e[11]!==h||e[12]!==f?(b=i.jsxs(Hs,{children:[h,f]}),e[11]=h,e[12]=f,e[13]=b):b=e[13],e[14]!==u||e[15]!==b?(x=i.jsxs(io,{children:[c,u,b]}),e[14]=u,e[15]=b,e[16]=x):x=e[16],x};function uu(t){const e=P.c(3),[n,o]=S.useState(!1);let r,s;return e[0]!==t?(r=()=>{if(!t)return;o(!1);const a=setTimeout(()=>{o(!0)},200);return()=>clearTimeout(a)},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),S.useEffect(r,s),t&&n}let hu,mu;Ea=t=>{const{children:e}=t;return ie(To)?null:e},hu=t=>{const{children:e}=t;return ie(To)?e:null},mu=()=>{const t=P.c(6),e=Ct(_a);let n;t[0]!==e?(n=()=>e(pb),t[0]=e,t[1]=n):n=t[1];const o=n;let r,s,a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=St("global.commandPalette"),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(Ra,{strokeWidth:1.5,size:18}),t[3]=s):s=t[3],t[4]!==o?(a=i.jsx(pe,{content:r,children:i.jsx(tn,{"data-testid":"command-palette-button",onClick:o,shape:"rectangle",color:"hint-green",children:s})}),t[4]=o,t[5]=a):a=t[5],a};function pb(t){return!t}const gb=t=>{const e=P.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:a,running:l,appConfig:c}=t,d=c.width,u=ie(Dp),h=ie(Qk),{undoDeleteCell:m}=Ye(),f=a===ht.CLOSED;let b,x=null;if(!f&&u){let L,$;e[0]===Symbol.for("react.memo_cache_sentinel")?(L=i.jsx(za,{size:16,strokeWidth:1.5}),e[0]=L):L=e[0],e[1]!==m?($=i.jsx(pe,{content:"Undo cell deletion",children:i.jsx(tn,{"data-testid":"undo-delete-cell",size:"medium",color:"hint-green",shape:"circle",onClick:m,children:L})}),e[1]=m,e[2]=$):$=e[2],x=$}e[3]!==a?(b=en(a),e[3]=a,e[4]=b):b=e[4];const p=b;let g;e[5]!==a||e[6]!==p?(g=p?ra(a):void 0,e[5]=a,e[6]=p,e[7]=g):g=e[7];const y=g;let w,j;e[8]!==n?(w=!n&&i.jsx(X0,{}),e[8]=n,e[9]=w):w=e[9],e[10]!==f||e[11]!==y||e[12]!==p||e[13]!==n?(j=!f&&i.jsxs("div",{className:yb,children:[n&&i.jsx(x0,{}),i.jsx(U0,{disabled:p,tooltip:y}),i.jsx(cC,{disabled:p,tooltip:y}),i.jsx(dC,{description:"This will terminate the Python kernel. You'll lose all data that's in memory.",disabled:p,tooltip:y})]}),e[10]=f,e[11]=y,e[12]=p,e[13]=n,e[14]=j):j=e[14];const N=d==="compact"&&"xl:flex-row items-end";let C,k,_,E,I,A,F,D,M,O,R,z,T;return e[15]!==N?(C=ue(vb,N),e[15]=N,e[16]=C):C=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx(Ea,{children:i.jsx(lb,{kioskMode:!1})}),e[17]=k):k=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(_=St("global.hideCode"),e[18]=_):_=e[18],e[19]!==n?(E=n?i.jsx(Op,{strokeWidth:1.5,size:18}):i.jsx(La,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=E):E=e[20],e[21]!==o||e[22]!==E?(I=i.jsx(pe,{content:_,children:i.jsx(tn,{"data-testid":"hide-code-button",id:"preview-button",shape:"rectangle",color:"hint-green",onClick:o,children:E})}),e[21]=o,e[22]=E,e[23]=I):I=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(mu,{}),F=i.jsx(uC,{}),D=i.jsx("div",{}),e[24]=A,e[25]=F,e[26]=D):(A=e[24],F=e[25],D=e[26]),e[27]!==f||e[28]!==r||e[29]!==l?(M=!f&&i.jsx(xb,{running:l,onInterrupt:r}),e[27]=f,e[28]=r,e[29]=l,e[30]=M):M=e[30],e[31]!==f||e[32]!==h||e[33]!==s?(O=!f&&i.jsx(bb,{needsRun:h,onRun:s}),e[31]=f,e[32]=h,e[33]=s,e[34]=O):O=e[34],e[35]!==M||e[36]!==O||e[37]!==x?(R=i.jsx(Ea,{children:i.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[x,M,O]})}),e[35]=M,e[36]=O,e[37]=x,e[38]=R):R=e[38],e[39]!==I||e[40]!==R||e[41]!==C?(z=i.jsxs("div",{className:C,children:[k,I,A,F,D,R]}),e[39]=I,e[40]=R,e[41]=C,e[42]=z):z=e[42],e[43]!==z||e[44]!==w||e[45]!==j?(T=i.jsxs(i.Fragment,{children:[w,j,z]}),e[43]=z,e[44]=w,e[45]=j,e[46]=T):T=e[46],T},bb=t=>{const e=P.c(8),{needsRun:n,onRun:o}=t,r=ie(Yp);if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=St("global.runStale"),e[0]=c):c=e[0];const d=r?o:void 0,u=!r;let h,m;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(zo,{strokeWidth:1.5,size:16}),e[1]=h):h=e[1],e[2]!==d||e[3]!==u?(m=i.jsx(pe,{content:c,children:i.jsx(tn,{"data-testid":"run-button",size:"medium",color:"yellow",shape:"circle",onClick:d,disabled:u,children:h})}),e[2]=d,e[3]=u,e[4]=m):m=e[4],m}const s=!r;let a,l;return e[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(zo,{strokeWidth:1.5,size:16}),e[5]=a):a=e[5],e[6]!==s?(l=i.jsx(pe,{content:"Nothing to run",children:i.jsx(tn,{"data-testid":"run-button",className:"inactive-button",color:"disabled",size:"medium",shape:"circle",disabled:s,children:a})}),e[6]=s,e[7]=l):l=e[7],l},xb=t=>{const e=P.c(8),{running:n,onInterrupt:o}=t,r=uu(n);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=St("global.interrupt"),e[0]=s):s=e[0];const a=!r&&"inactive-button active:shadow-xs-solid";let l;e[1]!==a?(l=ue(a),e[1]=a,e[2]=l):l=e[2];const c=r?"yellow":"disabled",d=r?o:Bn.NOOP;let u,h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Pl,{strokeWidth:1.5,size:16}),e[3]=u):u=e[3],e[4]!==l||e[5]!==c||e[6]!==d?(h=i.jsx(pe,{content:s,children:i.jsx(tn,{className:l,"data-testid":"interrupt-button",size:"medium",color:c,shape:"circle",onClick:d,children:u})}),e[4]=l,e[5]=c,e[6]=d,e[7]=h):h=e[7],h},yb="absolute top-3 right-5 m-0 flex items-center gap-2 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",vb="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",wb=t=>{const e=P.c(7),{filename:n}=t,o=$p();let r;e[0]!==n?(r=n?Ot.basename(n):"untitled marimo notebook",e[0]=n,e[1]=r):r=e[1];const s=n===null?"missing-filename":"filename";let a;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==s?(a=i.jsx(lu,{placeholderText:r,initialValue:n,onNameChange:o,flexibleWidth:!0,resetOnBlur:!0,"data-testid":"filename-input",className:s}),e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=a):a=e[6],a},ni=()=>({entries:new Map}),{valueAtom:fu,useActions:pu}=Zl(ni,{submit:(t,e)=>{const{cellIds:n,deleteCell:o,deleteManyCells:r,store:s}=e,a=s.get(Gt),l=s.get(Xp),c=new Set(a.cellIds.inOrderIds.filter(h=>a.cellData[h].code.trim()==="")),d=new Map;for(const h of n){if(c.has(h)){d.set(h,{cellId:h,type:"simple"});continue}const m=a.cellRuntime[h],f=new Map;for(const x of Object.values(l)){const p=x.declaredBy.includes(h),g=x.usedBy.some(y=>!c.has(y));p&&g&&f.set(x.name,x.usedBy)}let b;m!=null&&m.runElapsedTimeMs&&m.runElapsedTimeMs>2e3&&(b=m.runElapsedTimeMs),f.size===0&&b===void 0?d.set(h,{cellId:h,type:"simple"}):d.set(h,{cellId:h,type:"expensive",executionDurationMs:b,defs:f})}const u=[...d.values()].every(h=>h.type==="simple");return d.size>0&&u?(d.size===1?o({cellId:[...d.values()][0].cellId}):r({cellIds:[...d.values()].map(h=>h.cellId)}),ni()):{...t,entries:d}},clear:()=>ni()});function Jo(){const t=oa(),{submit:e,clear:n}=pu(),{entries:o}=ie(fu),r=jr(),s=Cr();return S.useMemo(()=>({submit:a=>{e({cellIds:a,deleteCell:r,deleteManyCells:s,store:t})},clear:n,get idle(){return o.size===0},get shouldConfirmDelete(){return o.size>1}}),[t,e,n,o,r,s])}function kb(t){return t.cellId}function gu(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:oi,useActions:jb}=Zl(gu,{select:(t,e)=>({selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])}),extend:(t,e)=>{if(!t.selectionStart)return{selectionStart:e.cellId,selectionEnd:e.cellId,selected:new Set([e.cellId])};const{cellId:n,allCellIds:o}=e;try{const r=o.findWithId(t.selectionStart),s=r.indexOfOrThrow(t.selectionStart),a=r.indexOfOrThrow(n),[l,c]=s<a?[s,a]:[a,s],d=r.slice(l,c+1);return{selectionStart:t.selectionStart,selectionEnd:n,selected:new Set(d)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:t=>t.selected.size===0?t:gu()});function ts(){return jb()}const Cb=t=>{const e=P.c(14),{actions:n,cellIds:o,disabled:r}=t;let s,a,l,c,d;if(e[0]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(Ca,{size:13,strokeWidth:1.5}),e[0]=s):s=e[0],e[1]!==r?(a=i.jsx(Un,{asChild:!0,children:i.jsx(ye,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",title:"More actions",disabled:r,children:s})}),e[1]=r,e[2]=a):a=e[2],e[3]!==n||e[4]!==o){let u;e[6]!==n.length||e[7]!==o?(u=(h,m)=>{const f=h.map(b=>i.jsx(lo,{onSelect:()=>b.handle(o),className:"flex items-center gap-2",children:i.jsxs("div",{className:"flex items-center flex-1",children:[b.icon&&i.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:b.icon}),i.jsx("div",{className:"flex-1",children:b.label}),b.hotkey&&i.jsx(Gl,{shortcut:b.hotkey,className:"ml-4"})]})},b.label));return i.jsxs(me.Fragment,{children:[f,m<n.length-1&&i.jsx(En,{})]},m)},e[6]=n.length,e[7]=o,e[8]=u):u=e[8],l=n.flatMap(u),e[3]=n,e[4]=o,e[5]=l}else l=e[5];return e[9]!==l?(c=i.jsx(Wn,{align:"start","data-keep-cell-selection":!0,children:l}),e[9]=l,e[10]=c):c=e[10],e[11]!==a||e[12]!==c?(d=i.jsxs(zn,{children:[a,c]}),e[11]=a,e[12]=c,e[13]=d):d=e[13],d};function Nb(t){return t.length>0}function Sb(t){return t.filter(Eb)}function Eb(t){return!t.hidden}function _b(t){return t.length>0}function Ib(t){return t.filter(Ab)}function Ab(t){return!t.hidden}function Tb(t){const e={};t.forEach(n=>{const o=Zp(n);o&&(e[n]=o)}),e1(e)}const Db=()=>{const t=P.c(4),e=ie(oi);let n;t[0]!==e.selected?(n=[...e.selected],t[0]=e.selected,t[1]=n):n=t[1];const o=n;if(o.length<2)return null;let r;return t[2]!==o?(r=i.jsxs(i.Fragment,{children:[i.jsx(Ob,{cellIds:o}),i.jsx(Mb,{cellIds:o})]}),t[2]=o,t[3]=r):r=t[3],r},ri=()=>{const t=P.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"h-4 w-px bg-border mx-1"}),t[0]=e):e=t[0],e},Mb=t=>{const e=P.c(12),{cellIds:n}=t,o=Jo(),r=Cr(),s=ts();if(!o.shouldConfirmDelete)return null;let a,l,c,d,u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(ec,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[0]=a):a=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[i.jsx("p",{className:"text-(--amber-11) font-medium",children:"Some cells in selection may contain expensive operations."}),i.jsx("p",{className:"text-(--amber-11) mt-1",children:"Are you sure you want to delete?"})]}),e[1]=l):l=e[1],e[2]!==o?(c=i.jsx(ye,{size:"xs",variant:"ghost",onClick:()=>o.clear(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),e[2]=o,e[3]=c):c=e[3],e[4]!==n||e[5]!==r||e[6]!==o||e[7]!==s?(d=i.jsx(ye,{size:"xs",variant:"secondary",onClick:()=>{r({cellIds:n}),o.clear(),s.clear()},className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"}),e[4]=n,e[5]=r,e[6]=o,e[7]=s,e[8]=d):d=e[8],e[9]!==c||e[10]!==d?(u=i.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:i.jsx("div",{className:"mx-20",children:i.jsx("div",{className:"bg-(--amber-2) border border-(--amber-6) rounded-lg shadow-lg mt-14 px-4 py-3 animate-in slide-in-from-top-2 duration-200",children:i.jsxs("div",{className:"flex items-start gap-3",children:[a,i.jsxs("div",{className:"flex-1",children:[l,i.jsx(Jl,{restoreFocus:!0,autoFocus:!0,children:i.jsxs("div",{className:"flex items-center gap-2 mt-3",onKeyDown:Rb,children:[c,d]})})]})]})})})}),e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Ob=t=>{const e=P.c(23),{cellIds:n}=t,o=ts(),r=Jo(),{actions:s,moreActions:a}=(function(p){const g=P.c(31),{updateCellConfig:y,moveCell:w,clearCellOutput:j,sendToTop:N,sendToBottom:C}=Ye(),k=Cr(),_=ie(Qp),E=ts(),I=qo(),A=Jo(),F=ie(sa),{saveCellConfig:D}=qe(),M=p.length,O=!_||M<p.length;let R;g[0]!==k||g[1]!==A||g[2]!==E||g[3]!==F?(R=ee=>{A.idle&&F.keymap.destructive_delete?A.submit(ee):(k({cellIds:ee}),A.clear(),E.clear())},g[0]=k,g[1]=A,g[2]=E,g[3]=F,g[4]=R):R=g[4];const z=Ce(R);let T;g[5]!==w?(T=(ee,oe)=>{if(oe==="down"){const se=ee[ee.length-1];if(Le.get(Gt).cellIds.findWithId(se).last()===se)return}if(oe==="up"){const se=ee[0];if(Le.get(Gt).cellIds.findWithId(se).first()===se)return}(oe==="up"?ee:[...ee].reverse()).forEach(se=>{w({cellId:se,before:oe==="up"})})},g[5]=w,g[6]=T):T=g[6];const L=Ce(T);let $;g[7]!==N?($=ee=>{[...ee].reverse().forEach(oe=>{N({cellId:oe})})},g[7]=N,g[8]=$):$=g[8];const W=Ce($);let G;g[9]!==C?(G=ee=>{ee.forEach(oe=>{C({cellId:oe})})},g[9]=C,g[10]=G):G=g[10];const X=Ce(G),H=Ce(Tb);let Y;g[11]!==j?(Y=ee=>{ee.forEach(oe=>{j({cellId:oe})})},g[11]=j,g[12]=Y):Y=g[12];const K=Ce(Y);let V;g[13]!==D||g[14]!==y?(V=async(ee,oe,se)=>{const ae={};ee.forEach(te=>{ae[te]={[oe]:se}}),await D({configs:ae}),ee.forEach(te=>{y({cellId:te,config:ae[te]})})},g[13]=D,g[14]=y,g[15]=V):V=g[15];const q=Ce(V);let U,ne,Q;if(g[16]===Symbol.for("react.memo_cache_sentinel")?(U=i.jsx(zo,{size:13,strokeWidth:1.5}),g[16]=U):U=g[16],g[17]!==I?(ne=ee=>I(ee),g[17]=I,g[18]=ne):ne=g[18],g[19]!==O||g[20]!==K||g[21]!==z||g[22]!==H||g[23]!==L||g[24]!==X||g[25]!==W||g[26]!==ne||g[27]!==q){const ee=[[{icon:U,label:"Run cells",handle:ne,hotkey:"cell.run"}],[{icon:i.jsx(aa,{size:13,strokeWidth:1.5}),label:"Move up",handle:te=>L(te,"up"),hotkey:"cell.moveUp"},{icon:i.jsx($n,{size:13,strokeWidth:1.5}),label:"Move down",handle:te=>L(te,"down"),hotkey:"cell.moveDown"}],[{icon:i.jsx(tc,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!O,handle:z}]],oe=[[{icon:i.jsx(t1,{size:13,strokeWidth:1.5}),label:"Format cells",handle:H,hotkey:"cell.format"},{icon:i.jsx(Ks,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:K}],[{icon:i.jsx(Vl,{size:13,strokeWidth:1.5}),label:"Hide code",handle:te=>q(te,"hide_code",!0),hotkey:"cell.hideCode"},{icon:i.jsx(n1,{size:13,strokeWidth:1.5}),label:"Show code",handle:te=>q(te,"hide_code",!1),hotkey:"cell.hideCode"}],[{icon:i.jsx(aa,{size:13,strokeWidth:1.5}),label:"Move up",handle:te=>L(te,"up"),hotkey:"cell.moveUp"},{icon:i.jsx($n,{size:13,strokeWidth:1.5}),label:"Move down",handle:te=>L(te,"down"),hotkey:"cell.moveDown"},{icon:i.jsx(Ma,{size:13,strokeWidth:1.5}),label:"Send to top",handle:W,hotkey:"cell.sendToTop"},{icon:i.jsx(gt,{size:13,strokeWidth:1.5}),label:"Send to bottom",handle:X,hotkey:"cell.sendToBottom"}],[{icon:i.jsx(Et,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:te=>q(te,"disabled",!0)},{icon:i.jsx(_t,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:te=>q(te,"disabled",!1)}]],se=ee.map(Ib);let ae;g[29]!==se?(ae=se.filter(_b),g[29]=se,g[30]=ae):ae=g[30],Q={actions:ae,moreActions:oe.map(Sb).filter(Nb)},g[19]=O,g[20]=K,g[21]=z,g[22]=H,g[23]=L,g[24]=X,g[25]=W,g[26]=ne,g[27]=q,g[28]=Q}else Q=g[28];return Q})(n),l=n.length;let c;e[0]!==r||e[1]!==o?(c=p=>{(p.target instanceof HTMLElement||p.target instanceof SVGElement)&&p.target.closest("[data-keep-cell-selection]")!==null||p.target instanceof HTMLHtmlElement||(r.clear(),o.clear())},e[0]=r,e[1]=o,e[2]=c):c=e[2],Jp(window,"mousedown",c);const d=!r.idle;let u,h,m,f,b,x;if(e[3]!==l?(u=i.jsxs("span",{className:"text-sm font-medium text-muted-foreground px-2 shrink-0",children:[l," cells selected"]}),e[3]=l,e[4]=u):u=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(ri,{}),e[5]=h):h=e[5],e[6]!==s||e[7]!==n||e[8]!==d){let p;e[10]!==s.length||e[11]!==n||e[12]!==d?(p=(g,y)=>i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[g.map(w=>i.jsxs(ye,{variant:w.variant==="danger"?"linkDestructive":"ghost",size:"sm",onClick:()=>w.handle(n),className:"h-8 px-2 gap-1 shrink-0 flex items-center",title:w.label,disabled:d&&w.label!=="Delete cells",children:[w.icon,i.jsx("span",{className:"text-xs",children:w.label}),w.hotkey&&i.jsx("div",{className:"ml-1 border bg-muted rounded-md px-1",children:i.jsx(Gl,{shortcut:w.hotkey})})]},w.label)),y<s.length-1&&i.jsx(ri,{})]},y),e[10]=s.length,e[11]=n,e[12]=d,e[13]=p):p=e[13],m=s.map(p),e[6]=s,e[7]=n,e[8]=d,e[9]=m}else m=e[9];return e[14]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(ri,{}),e[14]=f):f=e[14],e[15]!==n||e[16]!==d||e[17]!==a?(b=i.jsx(Cb,{actions:a,cellIds:n,disabled:d}),e[15]=n,e[16]=d,e[17]=a,e[18]=b):b=e[18],e[19]!==u||e[20]!==m||e[21]!==b?(x=i.jsx("div",{className:"absolute top-12 justify-center flex w-full left-0 right-0 z-50","data-keep-cell-selection":!0,children:i.jsx("div",{className:"bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 border border-(--slate-7) rounded-lg shadow-lg p-2 overflow-x-auto overflow-y-hidden mx-20 scrollbar-thin",children:i.jsxs("div",{className:"flex items-center gap-1",children:[u,h,m,f,b]})})}),e[19]=u,e[20]=m,e[21]=b,e[22]=x):x=e[22],x};function Rb(t){t.stopPropagation()}const Lb={display:"none"};function Fb(t){let{id:e,value:n}=t;return me.createElement("div",{id:e,style:Lb},n)}function Bb(t){let{id:e,announcement:n,ariaLiveType:o="assertive"}=t;return me.createElement("div",{id:e,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const bu=S.createContext(null),Pb={draggable:`
|
|
100
|
-
To pick up a draggable item, press the space bar.
|
|
101
|
-
While dragging, use the arrow keys to move the item.
|
|
102
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
103
|
-
`},zb={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function Ub(t){let{announcements:e=zb,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=Pb}=t;const{announce:s,announcement:a}=(function(){const[h,m]=S.useState("");return{announce:S.useCallback(f=>{f!=null&&m(f)},[]),announcement:h}})(),l=Nr("DndLiveRegion"),[c,d]=S.useState(!1);if(S.useEffect(()=>{d(!0)},[]),(function(h){const m=S.useContext(bu);S.useEffect(()=>{if(!m)throw new Error("useDndMonitor must be used within a children of <DndContext>");return m(h)},[h,m])})(S.useMemo(()=>({onDragStart(h){let{active:m}=h;s(e.onDragStart({active:m}))},onDragMove(h){let{active:m,over:f}=h;e.onDragMove&&s(e.onDragMove({active:m,over:f}))},onDragOver(h){let{active:m,over:f}=h;s(e.onDragOver({active:m,over:f}))},onDragEnd(h){let{active:m,over:f}=h;s(e.onDragEnd({active:m,over:f}))},onDragCancel(h){let{active:m,over:f}=h;s(e.onDragCancel({active:m,over:f}))}}),[s,e])),!c)return null;const u=me.createElement(me.Fragment,null,me.createElement(Fb,{id:o,value:r.draggable}),me.createElement(Bb,{id:l,announcement:a}));return n?_r.createPortal(u,n):u}var ot;function ns(){}function xu(t,e){return S.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(ot||(ot={}));const Pt=Object.freeze({x:0,y:0});function si(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ai(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function Wb(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function ii(t){let{left:e,top:n,height:o,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+o},{x:e+r,y:n+o}]}function li(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function yu(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+.5*t.width,y:n+.5*t.height}}const ci=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=yu(e,e.left,e.top),s=[];for(const a of o){const{id:l}=a,c=n.get(l);if(c){const d=si(yu(c),r);s.push({id:l,data:{droppableContainer:a,value:d}})}}return s.sort(ai)};function $b(t,e){const n=Math.max(e.top,t.top),o=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),a=r-o,l=s-n;if(o<r&&n<s){const c=e.width*e.height,d=t.width*t.height,u=a*l;return Number((u/(c+d-u)).toFixed(4))}return 0}const vu=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=[];for(const s of o){const{id:a}=s,l=n.get(a);if(l){const c=$b(l,e);c>0&&r.push({id:a,data:{droppableContainer:s,value:c}})}}return r.sort(Wb)};function Vb(t,e){const{top:n,left:o,bottom:r,right:s}=e;return n<=t.y&&t.y<=r&&o<=t.x&&t.x<=s}function wu(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Pt}function Gb(t){return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((s,a)=>({...s,top:s.top+t*a.y,bottom:s.bottom+t*a.y,left:s.left+t*a.x,right:s.right+t*a.x}),{...e})}}const qb=Gb(1),Hb={ignoreTransform:!1};function mo(t,e){e===void 0&&(e=Hb);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:u}=In(t).getComputedStyle(t);d&&(n=(function(h,m,f){const b=(function(k){if(k.startsWith("matrix3d(")){const _=k.slice(9,-1).split(/, /);return{x:+_[12],y:+_[13],scaleX:+_[0],scaleY:+_[5]}}if(k.startsWith("matrix(")){const _=k.slice(7,-1).split(/, /);return{x:+_[4],y:+_[5],scaleX:+_[0],scaleY:+_[3]}}return null})(m);if(!b)return h;const{scaleX:x,scaleY:p,x:g,y}=b,w=h.left-g-(1-x)*parseFloat(f),j=h.top-y-(1-p)*parseFloat(f.slice(f.indexOf(" ")+1)),N=x?h.width/x:h.width,C=p?h.height/p:h.height;return{width:N,height:C,top:j,right:w+N,bottom:j+C,left:w}})(n,d,u))}const{top:o,left:r,width:s,height:a,bottom:l,right:c}=n;return{top:o,left:r,width:s,height:a,bottom:l,right:c}}function ku(t){return mo(t,{ignoreTransform:!0})}function os(t,e){const n=[];return t?(function o(r){if(e!=null&&n.length>=e||!r)return n;if(r1(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!la(r)||Zk(r)||n.includes(r))return n;const s=In(t).getComputedStyle(r);return r!==t&&(function(a,l){l===void 0&&(l=In(a).getComputedStyle(a));const c=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(d=>{const u=l[d];return typeof u=="string"&&c.test(u)})})(r,s)&&n.push(r),(function(a,l){return l===void 0&&(l=In(a).getComputedStyle(a)),l.position==="fixed"})(r,s)?n:o(r.parentNode)})(t):n}function ju(t){const[e]=os(t,1);return e??null}function di(t){return rc&&t?sc(t)?t:n4(t)?r1(t)||t===Oo(t).scrollingElement?window:la(t)?t:null:null:null}function Cu(t){return sc(t)?t.scrollX:t.scrollLeft}function Nu(t){return sc(t)?t.scrollY:t.scrollTop}function ui(t){return{x:Cu(t),y:Nu(t)}}var at;function Su(t){return!(!rc||!t)&&t===document.scrollingElement}function Eu(t){const e={x:0,y:0},n=Su(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height};return{isTop:t.scrollTop<=e.y,isLeft:t.scrollLeft<=e.x,isBottom:t.scrollTop>=o.y,isRight:t.scrollLeft>=o.x,maxScroll:o,minScroll:e}}(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(at||(at={}));const Jb={x:.2,y:.2};function Kb(t,e,n,o,r){let{top:s,left:a,right:l,bottom:c}=n;o===void 0&&(o=10),r===void 0&&(r=Jb);const{isTop:d,isBottom:u,isLeft:h,isRight:m}=Eu(t),f={x:0,y:0},b={x:0,y:0},x=e.height*r.y,p=e.width*r.x;return!d&&s<=e.top+x?(f.y=at.Backward,b.y=o*Math.abs((e.top+x-s)/x)):!u&&c>=e.bottom-x&&(f.y=at.Forward,b.y=o*Math.abs((e.bottom-x-c)/x)),!m&&l>=e.right-p?(f.x=at.Forward,b.x=o*Math.abs((e.right-p-l)/p)):!h&&a<=e.left+p&&(f.x=at.Backward,b.x=o*Math.abs((e.left+p-a)/p)),{direction:f,speed:b}}function Yb(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:e,left:n,right:o,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:o,bottom:r,width:t.clientWidth,height:t.clientHeight}}function _u(t){return t.reduce((e,n)=>Ro(e,ui(n)),Pt)}const Xb=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+Cu(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+Nu(n),0)}]];class hi{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=os(n),r=_u(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,a,l]of Xb)for(const c of a)Object.defineProperty(this,c,{get:()=>{const d=l(o),u=r[s]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ko{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=e}add(e,n,o){var r;(r=this.target)==null||r.addEventListener(e,n,o),this.listeners.push([e,n,o])}}function mi(t,e){const n=Math.abs(t.x),o=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+o**2)>e:"x"in e&&"y"in e?n>e.x&&o>e.y:"x"in e?n>e.x:"y"in e&&o>e.y}var Rt,Ae;function Iu(t){t.preventDefault()}function Qb(t){t.stopPropagation()}(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Rt||(Rt={})),(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Ae||(Ae={}));const Au={start:[Ae.Space,Ae.Enter],cancel:[Ae.Esc],end:[Ae.Space,Ae.Enter,Ae.Tab]},Zb=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Ae.Right:return{...n,x:n.x+25};case Ae.Left:return{...n,x:n.x-25};case Ae.Down:return{...n,y:n.y+25};case Ae.Up:return{...n,y:n.y-25}}};class fi{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Ko(Oo(n)),this.windowListeners=new Ko(In(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Rt.Resize,this.handleCancel),this.windowListeners.add(Rt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Rt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,o=e.node.current;o&&(function(r,s){if(s===void 0&&(s=mo),!r)return;const{top:a,left:l,bottom:c,right:d}=s(r);ju(r)&&(c<=0||d<=0||a>=window.innerHeight||l>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})})(o),n(Pt)}handleKeyDown(e){if(nc(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=Au,coordinateGetter:a=Zb,scrollBehavior:l="smooth"}=r,{code:c}=e;if(s.end.includes(c))return void this.handleEnd(e);if(s.cancel.includes(c))return void this.handleCancel(e);const{collisionRect:d}=o.current,u=d?{x:d.left,y:d.top}:Pt;this.referenceCoordinates||(this.referenceCoordinates=u);const h=a(e,{active:n,context:o.current,currentCoordinates:u});if(h){const m=Er(h,u),f={x:0,y:0},{scrollableAncestors:b}=o.current;for(const x of b){const p=e.code,{isTop:g,isRight:y,isLeft:w,isBottom:j,maxScroll:N,minScroll:C}=Eu(x),k=Yb(x),_={x:Math.min(p===Ae.Right?k.right-k.width/2:k.right,Math.max(p===Ae.Right?k.left:k.left+k.width/2,h.x)),y:Math.min(p===Ae.Down?k.bottom-k.height/2:k.bottom,Math.max(p===Ae.Down?k.top:k.top+k.height/2,h.y))},E=p===Ae.Right&&!y||p===Ae.Left&&!w,I=p===Ae.Down&&!j||p===Ae.Up&&!g;if(E&&_.x!==h.x){const A=x.scrollLeft+m.x,F=p===Ae.Right&&A<=N.x||p===Ae.Left&&A>=C.x;if(F&&!m.y)return void x.scrollTo({left:A,behavior:l});f.x=F?x.scrollLeft-A:p===Ae.Right?x.scrollLeft-N.x:x.scrollLeft-C.x,f.x&&x.scrollBy({left:-f.x,behavior:l});break}if(I&&_.y!==h.y){const A=x.scrollTop+m.y,F=p===Ae.Down&&A<=N.y||p===Ae.Up&&A>=C.y;if(F&&!m.x)return void x.scrollTo({top:A,behavior:l});f.y=F?x.scrollTop-A:p===Ae.Down?x.scrollTop-N.y:x.scrollTop-C.y,f.y&&x.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(e,Ro(Er(h,this.referenceCoordinates),f))}}}handleMove(e,n){const{onMove:o}=this.props;e.preventDefault(),o(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Tu(t){return!!(t&&"distance"in t)}function Du(t){return!!(t&&"delay"in t)}fi.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=Au,onActivation:r}=e,{active:s}=n;const{code:a}=t.nativeEvent;if(o.start.includes(a)){const l=s.activatorNode.current;return(!l||t.target===l)&&(t.preventDefault(),r==null||r({event:t.nativeEvent}),!0)}return!1}}];class pi{constructor(e,n,o){var r;o===void 0&&(o=(function(l){const{EventTarget:c}=In(l);return l instanceof c?l:Oo(l)})(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:a}=s;this.props=e,this.events=n,this.document=Oo(a),this.documentListeners=new Ko(this.document),this.listeners=new Ko(o),this.windowListeners=new Ko(In(a)),this.initialCoordinates=(r=oc(s))!=null?r:Pt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Rt.Resize,this.handleCancel),this.windowListeners.add(Rt.DragStart,Iu),this.windowListeners.add(Rt.VisibilityChange,this.handleCancel),this.windowListeners.add(Rt.ContextMenu,Iu),this.documentListeners.add(Rt.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Du(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if(Tu(n))return void this.handlePending(n)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:o,onPending:r}=this.props;r(o,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Rt.Click,Qb,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Rt.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:a,options:{activationConstraint:l}}=s;if(!r)return;const c=(n=oc(e))!=null?n:Pt,d=Er(r,c);if(!o&&l){if(Tu(l)){if(l.tolerance!=null&&mi(d,l.tolerance))return this.handleCancel();if(mi(d,l.distance))return this.handleStart()}return Du(l)&&mi(d,l.tolerance)?this.handleCancel():void this.handlePending(l,d)}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===Ae.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const ex={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class gi extends pi{constructor(e){const{event:n}=e,o=Oo(n.target);super(e,ex,o)}}gi.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return!(!n.isPrimary||n.button!==0)&&(o==null||o({event:n}),!0)}}];const tx={move:{name:"mousemove"},end:{name:"mouseup"}};var bi;(function(t){t[t.RightClick=2]="RightClick"})(bi||(bi={})),(class extends pi{constructor(t){super(t,tx,Oo(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==bi.RightClick&&(o==null||o({event:n}),!0)}}];const xi={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Yo,rs;function nx(t){let{acceleration:e,activator:n=Yo.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:a=5,order:l=rs.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=t;const f=(function(C){let{delta:k,disabled:_}=C;const E=ca(k);return Ir(I=>{if(_||!E||!I)return ox;const A={x:Math.sign(k.x-E.x),y:Math.sign(k.y-E.y)};return{x:{[at.Backward]:I.x[at.Backward]||A.x===-1,[at.Forward]:I.x[at.Forward]||A.x===1},y:{[at.Backward]:I.y[at.Backward]||A.y===-1,[at.Forward]:I.y[at.Forward]||A.y===1}}},[_,k,E])})({delta:h,disabled:!s}),[b,x]=e4(),p=S.useRef({x:0,y:0}),g=S.useRef({x:0,y:0}),y=S.useMemo(()=>{switch(n){case Yo.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Yo.DraggableRect:return r}},[n,r,c]),w=S.useRef(null),j=S.useCallback(()=>{const C=w.current;if(!C)return;const k=p.current.x*g.current.x,_=p.current.y*g.current.y;C.scrollBy(k,_)},[]),N=S.useMemo(()=>l===rs.TreeOrder?[...d].reverse():d,[l,d]);S.useEffect(()=>{if(s&&d.length&&y){for(const C of N){if((o==null?void 0:o(C))===!1)continue;const k=d.indexOf(C),_=u[k];if(!_)continue;const{direction:E,speed:I}=Kb(C,_,y,e,m);for(const A of["x","y"])f[A][E[A]]||(I[A]=0,E[A]=0);if(I.x>0||I.y>0)return x(),w.current=C,b(j,a),p.current=I,void(g.current=E)}p.current={x:0,y:0},g.current={x:0,y:0},x()}else x()},[e,j,o,x,s,a,JSON.stringify(y),JSON.stringify(f),b,d,N,u,JSON.stringify(m)])}(class extends pi{constructor(t){super(t,xi)}static setup(){return window.addEventListener(xi.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(xi.move.name,t)};function t(){}}}).activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;const{touches:r}=n;return!(r.length>1)&&(o==null||o({event:n}),!0)}}],(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Yo||(Yo={})),(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(rs||(rs={}));const ox={x:{[at.Backward]:!1,[at.Forward]:!1},y:{[at.Backward]:!1,[at.Forward]:!1}};var Xo,yi;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Xo||(Xo={})),(function(t){t.Optimized="optimized"})(yi||(yi={}));const Mu=new Map;function Ou(t,e){return Ir(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function ss(t){let{callback:e,disabled:n}=t;const o=o1(e),r=S.useMemo(()=>{if(n||typeof window>"u"||window.ResizeObserver===void 0)return;const{ResizeObserver:s}=window;return new s(o)},[n]);return S.useEffect(()=>()=>r==null?void 0:r.disconnect(),[r]),r}function rx(t){return new hi(mo(t),t)}function Ru(t,e,n){e===void 0&&(e=rx);const[o,r]=S.useState(null);function s(){r(c=>{if(!t)return null;var d;if(t.isConnected===!1)return(d=c??n)!=null?d:null;const u=e(t);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const a=(function(c){let{callback:d,disabled:u}=c;const h=o1(d),m=S.useMemo(()=>{if(u||typeof window>"u"||window.MutationObserver===void 0)return;const{MutationObserver:f}=window;return new f(h)},[h,u]);return S.useEffect(()=>()=>m==null?void 0:m.disconnect(),[m]),m})({callback(c){if(t)for(const d of c){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),l=ss({callback:s});return Vn(()=>{s(),t?(l==null||l.observe(t),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[t]),o}const Lu=[];function Fu(t,e){e===void 0&&(e=[]);const n=S.useRef(null);return S.useEffect(()=>{n.current=null},e),S.useEffect(()=>{const o=t!==Pt;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?Er(t,n.current):Pt}function Bu(t){return S.useMemo(()=>t?(function(e){const n=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}})(t):null,[t])}const Pu=[];function sx(t){let{measure:e}=t;const[n,o]=S.useState(null),r=S.useCallback(d=>{for(const{target:u}of d)if(la(u)){o(h=>{const m=e(u);return h?{...h,width:m.width,height:m.height}:m});break}},[e]),s=ss({callback:r}),a=S.useCallback(d=>{const u=(function(h){if(!h)return null;if(h.children.length>1)return h;const m=h.children[0];return la(m)?m:h})(d);s==null||s.disconnect(),u&&(s==null||s.observe(u)),o(u?e(u):null)},[e,s]),[l,c]=ia(a);return S.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ax=[{sensor:gi,options:{}},{sensor:fi,options:{}}],ix={current:{}},as={draggable:{measure:ku},droppable:{measure:ku,strategy:Xo.WhileDragging,frequency:yi.Optimized},dragOverlay:{measure:mo}};class Qo extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,o;return(n=(o=this.get(e))==null?void 0:o.node.current)!=null?n:void 0}}const lx={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ns},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:as,measureDroppableContainers:ns,windowRect:null,measuringScheduled:!1},cx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ns,draggableNodes:new Map,over:null,measureDroppableContainers:ns},is=S.createContext(cx),zu=S.createContext(lx);function dx(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qo}}}function ux(t,e){switch(e.type){case ot.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ot.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case ot.DragEnd:case ot.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ot.RegisterDroppable:{const{element:n}=e,{id:o}=n,r=new Qo(t.droppable.containers);return r.set(o,n),{...t,droppable:{...t.droppable,containers:r}}}case ot.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=e,s=t.droppable.containers.get(n);if(!s||o!==s.key)return t;const a=new Qo(t.droppable.containers);return a.set(n,{...s,disabled:r}),{...t,droppable:{...t.droppable,containers:a}}}case ot.UnregisterDroppable:{const{id:n,key:o}=e,r=t.droppable.containers.get(n);if(!r||o!==r.key)return t;const s=new Qo(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function hx(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=S.useContext(is),s=ca(o),a=ca(n==null?void 0:n.id);return S.useEffect(()=>{if(!e&&!o&&s&&a!=null){if(!nc(s)||document.activeElement===s.target)return;const l=r.get(a);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const h=t4(u);if(h){h.focus();break}}})}},[o,e,r,a,s]),null}const Uu=S.createContext({...Pt,scaleX:1,scaleY:1});var An;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(An||(An={}));const mx=S.memo(function(t){var e,n,o,r;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:d=ax,collisionDetection:u=vu,measuring:h,modifiers:m,...f}=t;const b=S.useReducer(ux,void 0,dx),[x,p]=b,[g,y]=(function(){const[re]=S.useState(()=>new Set),ce=S.useCallback(le=>(re.add(le),()=>re.delete(le)),[re]);return[S.useCallback(le=>{let{type:je,event:Ne}=le;re.forEach(xe=>{var De;return(De=xe[je])==null?void 0:De.call(xe,Ne)})},[re]),ce]})(),[w,j]=S.useState(An.Uninitialized),N=w===An.Initialized,{draggable:{active:C,nodes:k,translate:_},droppable:{containers:E}}=x,I=C!=null?k.get(C):null,A=S.useRef({initial:null,translated:null}),F=S.useMemo(()=>{var re;return C!=null?{id:C,data:(re=I==null?void 0:I.data)!=null?re:ix,rect:A}:null},[C,I]),D=S.useRef(null),[M,O]=S.useState(null),[R,z]=S.useState(null),T=Sr(f,Object.values(f)),L=Nr("DndDescribedBy",s),$=S.useMemo(()=>E.getEnabled(),[E]),W=(G=h,S.useMemo(()=>({draggable:{...as.draggable,...G==null?void 0:G.draggable},droppable:{...as.droppable,...G==null?void 0:G.droppable},dragOverlay:{...as.dragOverlay,...G==null?void 0:G.dragOverlay}}),[G==null?void 0:G.draggable,G==null?void 0:G.droppable,G==null?void 0:G.dragOverlay]));var G;const{droppableRects:X,measureDroppableContainers:H,measuringScheduled:Y}=(function(re,ce){let{dragging:le,dependencies:je,config:Ne}=ce;const[xe,De]=S.useState(null),{frequency:Fe,measure:Ie,strategy:Re}=Ne,kt=S.useRef(re),jt=(function(){switch(Re){case Xo.Always:return!1;case Xo.BeforeDragging:return le;default:return!le}})(),Ut=Sr(jt),Tt=S.useCallback(function(Ln){Ln===void 0&&(Ln=[]),Ut.current||De(no=>no===null?Ln:no.concat(Ln.filter(Kt=>!no.includes(Kt))))},[Ut]),Nn=S.useRef(null),Vs=Ir(Ln=>{if(jt&&!le)return Mu;if(!Ln||Ln===Mu||kt.current!==re||xe!=null){const no=new Map;for(let Kt of re){if(!Kt)continue;if(xe&&xe.length>0&&!xe.includes(Kt.id)&&Kt.rect.current){no.set(Kt.id,Kt.rect.current);continue}const jl=Kt.node.current,Cl=jl?new hi(Ie(jl),jl):null;Kt.rect.current=Cl,Cl&&no.set(Kt.id,Cl)}return no}return Ln},[re,xe,le,jt,Ie]);return S.useEffect(()=>{kt.current=re},[re]),S.useEffect(()=>{jt||Tt()},[le,jt]),S.useEffect(()=>{xe&&xe.length>0&&De(null)},[JSON.stringify(xe)]),S.useEffect(()=>{jt||typeof Fe!="number"||Nn.current!==null||(Nn.current=setTimeout(()=>{Tt(),Nn.current=null},Fe))},[Fe,jt,Tt,...je]),{droppableRects:Vs,measureDroppableContainers:Tt,measuringScheduled:xe!=null}})($,{dragging:N,dependencies:[_.x,_.y],config:W.droppable}),K=(function(re,ce){const le=ce!=null?re.get(ce):void 0,je=le?le.node.current:null;return Ir(Ne=>{var xe;return ce==null?null:(xe=je??Ne)!=null?xe:null},[je,ce])})(k,C),V=S.useMemo(()=>R?oc(R):null,[R]),q=(function(){const re=(M==null?void 0:M.autoScrollEnabled)===!1,ce=typeof l=="object"?l.enabled===!1:l===!1,le=N&&!re&&!ce;return typeof l=="object"?{...l,enabled:le}:{enabled:le}})(),U=(function(re,ce){return Ou(re,ce)})(K,W.draggable.measure);(function(re){let{activeNode:ce,measure:le,initialRect:je,config:Ne=!0}=re;const xe=S.useRef(!1),{x:De,y:Fe}=typeof Ne=="boolean"?{x:Ne,y:Ne}:Ne;Vn(()=>{if(!De&&!Fe||!ce)return void(xe.current=!1);if(xe.current||!je)return;const Ie=ce==null?void 0:ce.node.current;if(!Ie||Ie.isConnected===!1)return;const Re=wu(le(Ie),je);if(De||(Re.x=0),Fe||(Re.y=0),xe.current=!0,Math.abs(Re.x)>0||Math.abs(Re.y)>0){const kt=ju(Ie);kt&&kt.scrollBy({top:Re.y,left:Re.x})}},[ce,De,Fe,je,le])})({activeNode:C!=null?k.get(C):null,config:q.layoutShiftCompensation,initialRect:U,measure:W.draggable.measure});const ne=Ru(K,W.draggable.measure,U),Q=Ru(K?K.parentElement:null),ee=S.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=E.getNodeFor((e=ee.current.over)==null?void 0:e.id),se=sx({measure:W.dragOverlay.measure}),ae=(n=se.nodeRef.current)!=null?n:K,te=N?(o=se.rect)!=null?o:ne:null,_e=!!(se.nodeRef.current&&se.rect),he=wu(we=_e?null:ne,Ou(we));var we;const ke=Bu(ae?In(ae):null),ge=(function(re){const ce=S.useRef(re),le=Ir(je=>re?je&&je!==Lu&&re&&ce.current&&re.parentNode===ce.current.parentNode?je:os(re):Lu,[re]);return S.useEffect(()=>{ce.current=re},[re]),le})(N?oe??K:null),Ee=(function(re,ce){ce===void 0&&(ce=mo);const[le]=re,je=Bu(le?In(le):null),[Ne,xe]=S.useState(Pu);function De(){xe(()=>re.length?re.map(Ie=>Su(Ie)?je:new hi(ce(Ie),Ie)):Pu)}const Fe=ss({callback:De});return Vn(()=>{Fe==null||Fe.disconnect(),De(),re.forEach(Ie=>Fe==null?void 0:Fe.observe(Ie))},[re]),Ne})(ge),Oe=(function(re,ce){let{transform:le,...je}=ce;return re!=null&&re.length?re.reduce((Ne,xe)=>xe({transform:Ne,...je}),le):le})(m,{transform:{x:_.x-he.x,y:_.y-he.y,scaleX:1,scaleY:1},activatorEvent:R,active:F,activeNodeRect:ne,containerNodeRect:Q,draggingNodeRect:te,over:ee.current.over,overlayNodeRect:se.rect,scrollableAncestors:ge,scrollableAncestorRects:Ee,windowRect:ke}),ve=V?Ro(V,_):null,be=(function(re){const[ce,le]=S.useState(null),je=S.useRef(re),Ne=S.useCallback(xe=>{const De=di(xe.target);De&&le(Fe=>Fe?(Fe.set(De,ui(De)),new Map(Fe)):null)},[]);return S.useEffect(()=>{const xe=je.current;if(re!==xe){De(xe);const Fe=re.map(Ie=>{const Re=di(Ie);return Re?(Re.addEventListener("scroll",Ne,{passive:!0}),[Re,ui(Re)]):null}).filter(Ie=>Ie!=null);le(Fe.length?new Map(Fe):null),je.current=re}return()=>{De(re),De(xe)};function De(Fe){Fe.forEach(Ie=>{const Re=di(Ie);Re==null||Re.removeEventListener("scroll",Ne)})}},[Ne,re]),S.useMemo(()=>re.length?ce?Array.from(ce.values()).reduce((xe,De)=>Ro(xe,De),Pt):_u(re):Pt,[re,ce])})(ge),et=Fu(be),rt=Fu(be,[ne]),ct=Ro(Oe,et),dt=te?qb(te,Oe):null,pt=F&&dt?u({active:F,collisionRect:dt,droppableRects:X,droppableContainers:$,pointerCoordinates:ve}):null,ut=li(pt,"id"),[wt,Lt]=S.useState(null),On=(function(re,ce,le){return{...re,scaleX:ce&&le?ce.width/le.width:1,scaleY:ce&&le?ce.height/le.height:1}})(_e?Oe:Ro(Oe,rt),(r=wt==null?void 0:wt.rect)!=null?r:null,ne),Jt=S.useRef(null),Ft=S.useCallback((re,ce)=>{let{sensor:le,options:je}=ce;if(D.current==null)return;const Ne=k.get(D.current);if(!Ne)return;const xe=re.nativeEvent,De=new le({active:D.current,activeNode:Ne,event:xe,options:je,context:ee,onAbort(Ie){if(!k.get(Ie))return;const{onDragAbort:Re}=T.current,kt={id:Ie};Re==null||Re(kt),g({type:"onDragAbort",event:kt})},onPending(Ie,Re,kt,jt){if(!k.get(Ie))return;const{onDragPending:Ut}=T.current,Tt={id:Ie,constraint:Re,initialCoordinates:kt,offset:jt};Ut==null||Ut(Tt),g({type:"onDragPending",event:Tt})},onStart(Ie){const Re=D.current;if(Re==null)return;const kt=k.get(Re);if(!kt)return;const{onDragStart:jt}=T.current,Ut={activatorEvent:xe,active:{id:Re,data:kt.data,rect:A}};_r.unstable_batchedUpdates(()=>{jt==null||jt(Ut),j(An.Initializing),p({type:ot.DragStart,initialCoordinates:Ie,active:Re}),g({type:"onDragStart",event:Ut}),O(Jt.current),z(xe)})},onMove(Ie){p({type:ot.DragMove,coordinates:Ie})},onEnd:Fe(ot.DragEnd),onCancel:Fe(ot.DragCancel)});function Fe(Ie){return async function(){const{active:Re,collisions:kt,over:jt,scrollAdjustedTranslate:Ut}=ee.current;let Tt=null;if(Re&&Ut){const{cancelDrop:Nn}=T.current;Tt={activatorEvent:xe,active:Re,collisions:kt,delta:Ut,over:jt},Ie===ot.DragEnd&&typeof Nn=="function"&&await Promise.resolve(Nn(Tt))&&(Ie=ot.DragCancel)}D.current=null,_r.unstable_batchedUpdates(()=>{p({type:Ie}),j(An.Uninitialized),Lt(null),O(null),z(null),Jt.current=null;const Nn=Ie===ot.DragEnd?"onDragEnd":"onDragCancel";if(Tt){const Vs=T.current[Nn];Vs==null||Vs(Tt),g({type:Nn,event:Tt})}})}}Jt.current=De},[k]),zt=S.useCallback((re,ce)=>(le,je)=>{const Ne=le.nativeEvent,xe=k.get(je);if(D.current!==null||!xe||Ne.dndKit||Ne.defaultPrevented)return;const De={active:xe};re(le,ce.options,De)===!0&&(Ne.dndKit={capturedBy:ce.sensor},D.current=je,Ft(le,ce))},[k,Ft]),to=(function(re,ce){return S.useMemo(()=>re.reduce((le,je)=>{const{sensor:Ne}=je;return[...le,...Ne.activators.map(xe=>({eventName:xe.eventName,handler:ce(xe.handler,je)}))]},[]),[re,ce])})(d,zt);(function(re){S.useEffect(()=>{if(!rc)return;const ce=re.map(le=>{let{sensor:je}=le;return je.setup==null?void 0:je.setup()});return()=>{for(const le of ce)le==null||le()}},re.map(ce=>{let{sensor:le}=ce;return le}))})(d),Vn(()=>{ne&&w===An.Initializing&&j(An.Initialized)},[ne,w]),S.useEffect(()=>{const{onDragMove:re}=T.current,{active:ce,activatorEvent:le,collisions:je,over:Ne}=ee.current;if(!ce||!le)return;const xe={active:ce,activatorEvent:le,collisions:je,delta:{x:ct.x,y:ct.y},over:Ne};_r.unstable_batchedUpdates(()=>{re==null||re(xe),g({type:"onDragMove",event:xe})})},[ct.x,ct.y]),S.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:je,scrollAdjustedTranslate:Ne}=ee.current;if(!re||D.current==null||!ce||!Ne)return;const{onDragOver:xe}=T.current,De=je.get(ut),Fe=De&&De.rect.current?{id:De.id,rect:De.rect.current,data:De.data,disabled:De.disabled}:null,Ie={active:re,activatorEvent:ce,collisions:le,delta:{x:Ne.x,y:Ne.y},over:Fe};_r.unstable_batchedUpdates(()=>{Lt(Fe),xe==null||xe(Ie),g({type:"onDragOver",event:Ie})})},[ut]),Vn(()=>{ee.current={activatorEvent:R,active:F,activeNode:K,collisionRect:dt,collisions:pt,droppableRects:X,draggableNodes:k,draggingNode:ae,draggingNodeRect:te,droppableContainers:E,over:wt,scrollableAncestors:ge,scrollAdjustedTranslate:ct},A.current={initial:te,translated:dt}},[F,K,pt,dt,k,ae,te,X,E,wt,ge,ct]),nx({...q,delta:_,draggingRect:dt,pointerCoordinates:ve,scrollableAncestors:ge,scrollableAncestorRects:Ee});const Rn=S.useMemo(()=>({active:F,activeNode:K,activeNodeRect:ne,activatorEvent:R,collisions:pt,containerNodeRect:Q,dragOverlay:se,draggableNodes:k,droppableContainers:E,droppableRects:X,over:wt,measureDroppableContainers:H,scrollableAncestors:ge,scrollableAncestorRects:Ee,measuringConfiguration:W,measuringScheduled:Y,windowRect:ke}),[F,K,ne,R,pt,Q,se,k,E,X,wt,H,ge,Ee,W,Y,ke]),No=S.useMemo(()=>({activatorEvent:R,activators:to,active:F,activeNodeRect:ne,ariaDescribedById:{draggable:L},dispatch:p,draggableNodes:k,over:wt,measureDroppableContainers:H}),[R,to,F,ne,p,L,k,wt,H]);return me.createElement(bu.Provider,{value:y},me.createElement(is.Provider,{value:No},me.createElement(zu.Provider,{value:Rn},me.createElement(Uu.Provider,{value:On},c)),me.createElement(hx,{disabled:(a==null?void 0:a.restoreFocus)===!1})),me.createElement(Ub,{...a,hiddenTextDescribedById:L}))}),fx=S.createContext(null),Wu="button";function px(t){let{id:e,data:n,disabled:o=!1,attributes:r}=t;const s=Nr("Draggable"),{activators:a,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:m}=S.useContext(is),{role:f=Wu,roleDescription:b="draggable",tabIndex:x=0}=r??{},p=(c==null?void 0:c.id)===e,g=S.useContext(p?Uu:fx),[y,w]=ia(),[j,N]=ia(),C=(function(_,E){return S.useMemo(()=>_.reduce((I,A)=>{let{eventName:F,handler:D}=A;return I[F]=M=>{D(M,E)},I},{}),[_,E])})(a,e),k=Sr(n);return Vn(()=>(h.set(e,{id:e,key:s,node:y,activatorNode:j,data:k}),()=>{const _=h.get(e);_&&_.key===s&&h.delete(e)}),[h,e]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:S.useMemo(()=>({role:f,tabIndex:x,"aria-disabled":o,"aria-pressed":!(!p||f!==Wu)||void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[o,f,x,p,b,u.draggable]),isDragging:p,listeners:o?void 0:C,node:y,over:m,setNodeRef:w,setActivatorNodeRef:N,transform:g}}const gx={timeout:25};function $u(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function bx(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function ls(t){return t!==null&&t>=0}const cs={scaleX:1,scaleY:1},xx=t=>{var e;let{rects:n,activeNodeRect:o,activeIndex:r,overIndex:s,index:a}=t;const l=(e=n[r])!=null?e:o;if(!l)return null;const c=(function(d,u,h){const m=d[u],f=d[u-1],b=d[u+1];return!m||!f&&!b?0:h<u?f?m.left-(f.left+f.width):b.left-(m.left+m.width):b?b.left-(m.left+m.width):m.left-(f.left+f.width)})(n,a,r);if(a===r){const d=n[s];return d?{x:r<s?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...cs}:null}return a>r&&a<=s?{x:-l.width-c,y:0,...cs}:a<r&&a>=s?{x:l.width+c,y:0,...cs}:{x:0,y:0,...cs}},Vu=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=$u(e,o,n),a=e[r],l=s[r];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},ds={scaleX:1,scaleY:1},yx=t=>{var e;let{activeIndex:n,activeNodeRect:o,index:r,rects:s,overIndex:a}=t;const l=(e=s[n])!=null?e:o;if(!l)return null;if(r===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(l.top+l.height):d.top-l.top,...ds}:null}const c=(function(d,u,h){const m=d[u],f=d[u-1],b=d[u+1];return m?h<u?f?m.top-(f.top+f.height):b?b.top-(m.top+m.height):0:b?b.top-(m.top+m.height):f?m.top-(f.top+f.height):0:0})(s,r,n);return r>n&&r<=a?{x:0,y:-l.height-c,...ds}:r<n&&r>=a?{x:0,y:l.height+c,...ds}:{x:0,y:0,...ds}},Gu="Sortable",qu=me.createContext({activeIndex:-1,containerId:Gu,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vu,disabled:{draggable:!1,droppable:!1}});function Hu(t){let{children:e,id:n,items:o,strategy:r=Vu,disabled:s=!1}=t;const{active:a,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:u}=S.useContext(zu),h=Nr(Gu,n),m=l.rect!==null,f=S.useMemo(()=>o.map(C=>typeof C=="object"&&"id"in C?C.id:C),[o]),b=a!=null,x=a?f.indexOf(a.id):-1,p=d?f.indexOf(d.id):-1,g=S.useRef(f),y=!(function(C,k){if(C===k)return!0;if(C.length!==k.length)return!1;for(let _=0;_<C.length;_++)if(C[_]!==k[_])return!1;return!0})(f,g.current),w=p!==-1&&x===-1||y,j=(function(C){return typeof C=="boolean"?{draggable:C,droppable:C}:C})(s);Vn(()=>{y&&b&&u(f)},[y,f,b,u]),S.useEffect(()=>{g.current=f},[f]);const N=S.useMemo(()=>({activeIndex:x,containerId:h,disabled:j,disableTransforms:w,items:f,overIndex:p,useDragOverlay:m,sortedRects:bx(f,c),strategy:r}),[x,h,j.draggable,j.droppable,w,f,p,c,m,r]);return me.createElement(qu.Provider,{value:N},e)}const vx=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return $u(n,o,r).indexOf(e)},wx=t=>{let{containerId:e,isSorting:n,wasDragging:o,index:r,items:s,newIndex:a,previousItems:l,previousContainerId:c,transition:d}=t;return!(!d||!o)&&(l===s||r!==a)&&(!!n||a!==r&&e===c)},kx={duration:200,easing:"ease"},Ju="transform",jx=da.Transition.toString({property:Ju,duration:0,easing:"linear"}),Cx={roleDescription:"sortable"};function Ku(t){let{animateLayoutChanges:e=wx,attributes:n,disabled:o,data:r,getNewIndex:s=vx,id:a,strategy:l,resizeObserverConfig:c,transition:d=kx}=t;const{items:u,containerId:h,activeIndex:m,disabled:f,disableTransforms:b,sortedRects:x,overIndex:p,useDragOverlay:g,strategy:y}=S.useContext(qu),w=(function(oe,se){var ae,te;return typeof oe=="boolean"?{draggable:oe,droppable:!1}:{draggable:(ae=oe==null?void 0:oe.draggable)!=null?ae:se.draggable,droppable:(te=oe==null?void 0:oe.droppable)!=null?te:se.droppable}})(o,f),j=u.indexOf(a),N=S.useMemo(()=>({sortable:{containerId:h,index:j,items:u},...r}),[h,r,j,u]),C=S.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:k,node:_,isOver:E,setNodeRef:I}=(function(oe){let{data:se,disabled:ae=!1,id:te,resizeObserverConfig:_e}=oe;const he=Nr("Droppable"),{active:we,dispatch:ke,over:ge,measureDroppableContainers:Ee}=S.useContext(is),Oe=S.useRef({disabled:ae}),ve=S.useRef(!1),be=S.useRef(null),et=S.useRef(null),{disabled:rt,updateMeasurementsFor:ct,timeout:dt}={...gx,..._e},pt=Sr(ct??te),ut=ss({callback:S.useCallback(()=>{ve.current?(et.current!=null&&clearTimeout(et.current),et.current=setTimeout(()=>{Ee(Array.isArray(pt.current)?pt.current:[pt.current]),et.current=null},dt)):ve.current=!0},[dt]),disabled:rt||!we}),wt=S.useCallback((Ft,zt)=>{ut&&(zt&&(ut.unobserve(zt),ve.current=!1),Ft&&ut.observe(Ft))},[ut]),[Lt,On]=ia(wt),Jt=Sr(se);return S.useEffect(()=>{ut&&Lt.current&&(ut.disconnect(),ve.current=!1,ut.observe(Lt.current))},[Lt,ut]),S.useEffect(()=>(ke({type:ot.RegisterDroppable,element:{id:te,key:he,disabled:ae,node:Lt,rect:be,data:Jt}}),()=>ke({type:ot.UnregisterDroppable,key:he,id:te})),[te]),S.useEffect(()=>{ae!==Oe.current.disabled&&(ke({type:ot.SetDroppableDisabled,id:te,key:he,disabled:ae}),Oe.current.disabled=ae)},[te,he,ae,ke]),{active:we,rect:be,isOver:(ge==null?void 0:ge.id)===te,node:Lt,over:ge,setNodeRef:On}})({id:a,data:N,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:A,activatorEvent:F,activeNodeRect:D,attributes:M,setNodeRef:O,listeners:R,isDragging:z,over:T,setActivatorNodeRef:L,transform:$}=px({id:a,data:N,attributes:{...Cx,...n},disabled:w.draggable}),W=o4(I,O),G=!!A,X=G&&!b&&ls(m)&&ls(p),H=!g&&z,Y=H&&X?$:null,K=X?Y??(l??y)({rects:x,activeNodeRect:D,activeIndex:m,overIndex:p,index:j}):null,V=ls(m)&&ls(p)?s({id:a,items:u,activeIndex:m,overIndex:p}):j,q=A==null?void 0:A.id,U=S.useRef({activeId:q,items:u,newIndex:V,containerId:h}),ne=u!==U.current.items,Q=e({active:A,containerId:h,isDragging:z,isSorting:G,id:a,index:j,items:u,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:d,wasDragging:U.current.activeId!=null}),ee=(function(oe){let{disabled:se,index:ae,node:te,rect:_e}=oe;const[he,we]=S.useState(null),ke=S.useRef(ae);return Vn(()=>{if(!se&&ae!==ke.current&&te.current){const ge=_e.current;if(ge){const Ee=mo(te.current,{ignoreTransform:!0}),Oe={x:ge.left-Ee.left,y:ge.top-Ee.top,scaleX:ge.width/Ee.width,scaleY:ge.height/Ee.height};(Oe.x||Oe.y)&&we(Oe)}}ae!==ke.current&&(ke.current=ae)},[se,ae,te,_e]),S.useEffect(()=>{he&&we(null)},[he]),he})({disabled:!Q,index:j,node:_,rect:k});return S.useEffect(()=>{G&&U.current.newIndex!==V&&(U.current.newIndex=V),h!==U.current.containerId&&(U.current.containerId=h),u!==U.current.items&&(U.current.items=u)},[G,V,h,u]),S.useEffect(()=>{if(q===U.current.activeId)return;if(q!=null&&U.current.activeId==null)return void(U.current.activeId=q);const oe=setTimeout(()=>{U.current.activeId=q},50);return()=>clearTimeout(oe)},[q]),{active:A,activeIndex:m,attributes:M,data:N,rect:k,index:j,newIndex:V,items:u,isOver:E,isSorting:G,isDragging:z,listeners:R,node:_,overIndex:p,over:T,setNodeRef:W,setActivatorNodeRef:L,setDroppableNodeRef:I,setDraggableNodeRef:O,transform:ee??K,transition:(function(){if(ee||ne&&U.current.newIndex===j)return jx;if(!(H&&!nc(F)||!d)&&(G||Q))return da.Transition.toString({...d,property:Ju})})()}}function us(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Nx=[Ae.Down,Ae.Right,Ae.Up,Ae.Left],Sx=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:a,scrollableAncestors:l}}=e;if(Nx.includes(t.code)){if(t.preventDefault(),!n||!o)return;const c=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const m=r.get(h.id);if(m)switch(t.code){case Ae.Down:o.top<m.top&&c.push(h);break;case Ae.Up:o.top>m.top&&c.push(h);break;case Ae.Left:o.left>m.left&&c.push(h);break;case Ae.Right:o.left<m.left&&c.push(h)}});const d=(h=>{let{collisionRect:m,droppableRects:f,droppableContainers:b}=h;const x=ii(m),p=[];for(const g of b){const{id:y}=g,w=f.get(y);if(w){const j=ii(w),N=x.reduce((k,_,E)=>k+si(j[E],_),0),C=Number((N/4).toFixed(4));p.push({id:y,data:{droppableContainer:g,value:C}})}}return p.sort(ai)})({collisionRect:o,droppableRects:r,droppableContainers:c});let u=li(d,"id");if(u===(a==null?void 0:a.id)&&d.length>1&&(u=d[1].id),u!=null){const h=s.get(n.id),m=s.get(u),f=m?r.get(m.id):null,b=m==null?void 0:m.node.current;if(b&&f&&h&&m){const x=os(b).some((j,N)=>l[N]!==j),p=Yu(h,m),g=(function(j,N){return!us(j)||!us(N)||!Yu(j,N)?!1:j.data.current.sortable.index<N.data.current.sortable.index})(h,m),y=x||!p?{x:0,y:0}:{x:g?o.width-f.width:0,y:g?o.height-f.height:0},w={x:f.left,y:f.top};return y.x&&y.y?w:Er(w,y)}}}};function Yu(t,e){return!(!us(t)||!us(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}const Ex=()=>{const t=P.c(21),{startupLogsAlert:e}=ag(),{clearStartupLogsAlert:n}=ig(),[o,r]=S.useState(!1),s=e==null?void 0:e.status;let a;t[0]!==n?(a=()=>{n(),r(!0)},t[0]=n,t[1]=a):a=t[1];const l=Ce(a),c=s==="done",d=s==="start"||s==="append";let u,h,m;if(t[2]!==l||t[3]!==c?(u=()=>{let N;return c&&(N=window.setTimeout(()=>l(),5e3)),()=>{N&&window.clearTimeout(N)}},t[2]=l,t[3]=c,t[4]=u):u=t[4],t[5]!==c?(h=[c],t[5]=c,t[6]=h):h=t[6],S.useEffect(u,h),e===null||o)return null;t[7]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(ja,{className:"w-5 h-5 inline-block mr-2"}),t[7]=m):m=t[7];const f=d?"Initializing...":"Initialized";let b,x,p,g;t[8]!==f?(b=i.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[m,f]}),t[8]=f,t[9]=b):b=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(Vt,{className:"w-5 h-5"}),t[10]=x):x=t[10],t[11]!==l?(p=i.jsx(ye,{variant:"text","data-testid":"remove-startup-logs-button",size:"icon",onClick:l,children:x}),t[11]=l,t[12]=p):p=t[12],t[13]!==b||t[14]!==p?(g=i.jsxs("div",{className:"flex justify-between",children:[b,p]}),t[13]=b,t[14]=p,t[15]=g):g=t[15];const y=e.content||"Starting startup script...";let w,j;return t[16]!==y?(w=i.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:i.jsx("div",{className:"w-full",children:i.jsx("pre",{className:"bg-muted p-3 rounded text-sm font-mono overflow-auto max-h-64 whitespace-pre-wrap",children:y})})}),t[16]=y,t[17]=w):w=t[17],t[18]!==w||t[19]!==g?(j=i.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] max-w-[600px] z-200 opacity-95",children:i.jsxs(Lo,{kind:"info",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left",children:[g,w]})}),t[18]=w,t[19]=g,t[20]=j):j=t[20],j},_x=r4("rounded-full shadow-xs-solid border p-[5px] transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-(--yellow-3) hover:bg-(--yellow-4) text-(--yellow-11)",green:"hover:bg-(--grass-2) hover:text-(--grass-11) hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-(--red-3) hover:text-(--red-11)"}},defaultVariants:{variant:"default"}}),Zo=t=>{const e=P.c(18);let n,o,r,s,a,l,c,d;if(e[0]!==t){const{children:h,tooltip:m,disabled:f,variant:b,...x}=t;n=h,c=m;const p=f!==void 0&&f;o=p,r=x,s=g=>{var y;p||((y=x.onClick)==null||y.call(x,g))},a=Fn.preventFocus,l=ue(_x({variant:b}),x.className),e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=a,e[6]=l,e[7]=c}else n=e[1],o=e[2],r=e[3],s=e[4],a=e[5],l=e[6],c=e[7];e[8]!==n||e[9]!==o||e[10]!==r||e[11]!==s||e[12]!==a||e[13]!==l?(d=i.jsx("button",{disabled:o,...r,onClick:s,onMouseDown:a,className:l,children:n}),e[8]=n,e[9]=o,e[10]=r,e[11]=s,e[12]=a,e[13]=l,e[14]=d):d=e[14];const u=d;if(c){let h;return e[15]!==u||e[16]!==c?(h=i.jsx(pe,{content:c,side:"top",delayDuration:200,usePortal:!1,children:u}),e[15]=u,e[16]=c,e[17]=h):h=e[17],h}return u},Ix=t=>{const e=P.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=ue("flex items-center gap-1 bg-background m-[2px] rounded-full",o),e[0]=o,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=i.jsx(Cg,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},Ax=t=>{const e=P.c(9),{connectionState:n,status:o}=t,{sendInterrupt:r}=qe(),s=uu(o==="running");let a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=St("global.interrupt"),e[0]=a):a=e[0],e[1]!==n||e[2]!==s?(l=en(n)||!s,e[1]=n,e[2]=s,e[3]=l):l=e[3];const c=s?r:Bn.NOOP,d=s?"stale":"disabled";let u,h;return e[4]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Pl,{strokeWidth:1.5}),e[4]=u):u=e[4],e[5]!==l||e[6]!==c||e[7]!==d?(h=i.jsx(Zo,{tooltip:a,disabled:l,onClick:c,variant:d,"data-testid":"run-button",children:u}),e[5]=l,e[6]=c,e[7]=d,e[8]=h):h=e[8],h},er=Bt(null),Tx=s1("marimo:ai:includeOtherCells",!0);function Dx(t){const e=new Map;for(const[n,o]of t.entries()){if(o.messages.length===0)continue;const r=s4(o.messages,s=>s.id);e.set(n,{...o,messages:r})}return e}Aa=s1("marimo:ai:chatState:v5",{chats:new Map,activeChatId:null},(vi={toSerializable:t=>({chats:[...Dx(t.chats).entries()],activeChatId:t.activeChatId}),fromSerializable:t=>({chats:new Map(t.chats),activeChatId:t.activeChatId})},{getItem(t,e){try{const n=localStorage.getItem(t);if(!n)return e;const o=JSON.parse(n);return vi.fromSerializable(o)}catch(n){return He.warn(`Error getting ${t} from storage`,n),e}},setItem:(t,e)=>{localStorage.setItem(t,JSON.stringify(vi.toSerializable(e)))},removeItem:t=>{localStorage.removeItem(t)}}));var vi;bg=Bt(t=>{const e=t(Aa);return e.activeChatId?e.chats.get(e.activeChatId):null},(t,e,n)=>{e(Aa,o=>({...o,activeChatId:n}))});let Xu;Dc="packages-install-input",Xu=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let wi;function Mx(){const t=async r=>{const s=Le.get(sa),{saveUserConfig:a}=c1(),l={...s,runtime:{...s.runtime,auto_reload:r}};await a({config:l}).then(()=>Le.set(sa,l))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(Dc);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{Le.set(ac,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:i.jsxs(i.Fragment,{children:["The package manager sidebar has been opened.",i.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv pip install",onMatch:()=>{Le.set(ac,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:i.jsxs(i.Fragment,{children:["The package manager sidebar has been opened.",i.jsx("br",{}),"Install packages directly from there instead."]})},{match:"!uv add",onMatch:()=>{Le.set(ac,r=>({...r,isSidebarOpen:!0,selectedPanel:"packages"})),e()},title:"Package Installation",description:i.jsxs(i.Fragment,{children:["The package manager sidebar has been opened.",i.jsx("br",{}),"Install packages directly from there instead."]})},{match:"%autoreload 2",onMatch:async()=>{await t("autorun")},title:"Module reload",description:i.jsxs(i.Fragment,{children:["Module reload mode set to ",i.jsx("b",{children:"autorun"})," - module changes will re-run the cells that import them."]})},{match:"%autoreload 1",onMatch:async()=>{await t("lazy")},title:"Module reload",description:i.jsxs(i.Fragment,{children:["Module reload mode set to ",i.jsx("b",{children:"lazy"})," - module changes will mark the cells that import them as stale."]})},{match:"%autoreload 0",onMatch:async()=>{await t("off")},title:"Module reload",description:i.jsx(i.Fragment,{children:"Module reload disabled - module changes will not be detected."})},{match:"!ls",onMatch:()=>{},title:"Listing files",description:i.jsxs(i.Fragment,{children:["Shell commands are not directly supported.",i.jsx("br",{}),"Use ",i.jsx("code",{children:"import subprocess; subprocess.run(['ls'])"})," instead."]})},...Xu.map(r=>({match:r,onMatch:()=>{},title:i.jsx(l1,{className:"inline",children:r}),description:i.jsxs(i.Fragment,{children:["Magic commands are not supported in marimo. Read more about replacements in the"," ",i.jsx("a",{href:"https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands",target:"_blank",className:"text-link underline cursor-pointer",rel:"noopener noreferrer",children:"documentation"}),"."]})}))],o=new Map(n.map(r=>[r.match,r]));return Se.updateListener.of(r=>{if(r.docChanged){const s=r.state.selection.main,a=r.state.doc,l=a.lineAt(s.head),c=a.sliceString(l.from,s.anchor).trim(),d=o.get(c);d&&(d.onMatch(),wi?wi.upsert({title:d.title,description:d.description}):wi=ze({title:d.title,description:d.description}))}})}const Ox=new Set(["Escape","Alt-`"]);function Rx(){const t=d1.filter(e=>!Ox.has(e.key));return Sn.highest($t.of([...t,{key:"Ctrl-y",run:e=>!!ua(e)&&u1(e)},{key:"Ctrl-n",run:e=>!!ua(e)&&ha(!0)(e)},{key:"Ctrl-p",run:e=>!!ua(e)&&ha(!1)(e)}]))}const ki=tt.define(),ji=tt.define(),Ci=tt.define();function Ge(t,e){if(!t)throw new Error(e)}function hs(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int 32: "+t)}function Ni(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint 32: "+t)}function Qu(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>3402823466385289e23||t<-3402823466385289e23))throw new Error("invalid float 32: "+t)}const Zu=Symbol("@bufbuild/protobuf/enum-type");function Lx(t){const e=t[Zu];return Ge(e,"missing enum type on enum object"),e}function eh(t,e,n,o){t[Zu]=th(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function th(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const a of e){const l=nh(a);s.push(l),o[a.name]=l,r[a.no]=l}return{typeName:t,values:s,findName:a=>o[a],findNumber:a=>r[a]}}function Fx(t,e,n){const o={};for(const r of e){const s=nh(r);o[s.localName]=s.no,o[s.no]=s.localName}return eh(o,t,e),o}function nh(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Xe{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const o=this.getType().runtime.bin,r=o.makeReadOptions(n);return o.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,n){const o=this.getType(),r=o.runtime.json,s=r.makeReadOptions(n);return r.readMessage(o,e,s,this),this}fromJsonString(e,n){let o;try{o=JSON.parse(e)}catch(r){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${r instanceof Error?r.message:String(r)}`)}return this.fromJson(o,n)}toBinary(e){const n=this.getType().runtime.bin,o=n.makeWriteOptions(e),r=o.writerFactory();return n.writeMessage(this,r,o),r.finish()}toJson(e){const n=this.getType().runtime.json,o=n.makeWriteOptions(e);return n.writeMessage(this,o)}toJsonString(e){var n;const o=this.toJson(e);return JSON.stringify(o,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function Bx(){let t=0,e=0;for(let o=0;o<28;o+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let o=3;o<=31;o+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<o,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function Si(t,e,n){for(let s=0;s<28;s+=7){const a=t>>>s,l=!(!(a>>>7)&&e==0),c=255&(l?128|a:a);if(n.push(c),!l)return}const o=t>>>28&15|(7&e)<<4,r=!!(e>>3);if(n.push(255&(r?128|o:o)),r){for(let s=3;s<31;s+=7){const a=e>>>s,l=!!(a>>>7),c=255&(l?128|a:a);if(n.push(c),!l)return}n.push(e>>>31&1)}}const ms=4294967296;function oh(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let o=0,r=0;function s(a,l){const c=Number(t.slice(a,l));r*=n,o=o*n+c,o>=ms&&(r+=o/ms|0,o%=ms)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?sh(o,r):Ei(o,r)}function rh(t,e){if({lo:t,hi:e}=(function(c,d){return{lo:c>>>0,hi:d>>>0}})(t,e),e<=2097151)return String(ms*e+t);const n=16777215&(t>>>24|e<<8),o=e>>16&65535;let r=(16777215&t)+6777216*n+6710656*o,s=n+8147497*o,a=2*o;const l=1e7;return r>=l&&(s+=Math.floor(r/l),r%=l),s>=l&&(a+=Math.floor(s/l),s%=l),a.toString()+ah(s)+ah(r)}function Ei(t,e){return{lo:0|t,hi:0|e}}function sh(t,e){return e=~e,t?t=1+~t:e+=1,Ei(t,e)}const ah=t=>{const e=String(t);return"0000000".slice(e.length)+e};function ih(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function Px(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let n=5;128&t&&n<10;n++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var zx={};const Ue=(function(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||zx.BUF_BIGINT_DISABLE!=="1")){const o=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>r||c<o)throw new Error(`int64 invalid: ${l}`);return c},uParse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>a||c<s)throw new Error(`uint64 invalid: ${l}`);return c},enc(l){return t.setBigInt64(0,this.parse(l),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(l){return t.setBigInt64(0,this.uParse(l),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(l,c)=>(t.setInt32(0,l,!0),t.setInt32(4,c,!0),t.getBigInt64(0,!0)),uDec:(l,c)=>(t.setInt32(0,l,!0),t.setInt32(4,c,!0),t.getBigUint64(0,!0))}}const e=o=>Ge(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>Ge(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse:o=>(typeof o!="string"&&(o=o.toString()),e(o),o),uParse:o=>(typeof o!="string"&&(o=o.toString()),n(o),o),enc:o=>(typeof o!="string"&&(o=o.toString()),e(o),oh(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),oh(o)),dec:(o,r)=>(function(s,a){let l=Ei(s,a);const c=2147483648&l.hi;c&&(l=sh(l.lo,l.hi));const d=rh(l.lo,l.hi);return c?"-"+d:d})(o,r),uDec:(o,r)=>rh(o,r)}})();var J,Tn,Ke;function Dn(t,e,n){if(e===n)return!0;if(t==J.BYTES){if(!(e instanceof Uint8Array&&n instanceof Uint8Array)||e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}switch(t){case J.UINT64:case J.FIXED64:case J.INT64:case J.SFIXED64:case J.SINT64:return e==n}return!1}function fo(t,e){switch(t){case J.BOOL:return!1;case J.UINT64:case J.FIXED64:case J.INT64:case J.SFIXED64:case J.SINT64:return e==0?Ue.zero:"0";case J.DOUBLE:case J.FLOAT:return 0;case J.BYTES:return new Uint8Array(0);case J.STRING:return"";default:return 0}}function lh(t,e){switch(t){case J.BOOL:return e===!1;case J.STRING:return e==="";case J.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(J||(J={})),(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(Tn||(Tn={})),(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(Ke||(Ke={}));class Ux{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let n=new Uint8Array(e),o=0;for(let r=0;r<this.chunks.length;r++)n.set(this.chunks[r],o),o+=this.chunks[r].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Ni(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return hs(e),ih(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){Qu(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){Ni(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){hs(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return hs(e),ih(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=Ue.enc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),o=new DataView(n.buffer),r=Ue.uEnc(e);return o.setInt32(0,r.lo,!0),o.setInt32(4,r.hi,!0),this.raw(n)}int64(e){let n=Ue.enc(e);return Si(n.lo,n.hi,this.buf),this}sint64(e){let n=Ue.enc(e),o=n.hi>>31;return Si(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=Ue.uEnc(e);return Si(n.lo,n.hi,this.buf),this}}class Wx{constructor(e,n){this.varint64=Bx,this.uint32=Px,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,o=7&e;if(n<=0||o<0||o>5)throw new Error("illegal tag: field no "+n+" wire type "+o);return[n,o]}skip(e,n){let o=this.pos;switch(e){case Ke.Varint:for(;128&this.buf[this.pos++];);break;case Ke.Bit64:this.pos+=4;case Ke.Bit32:this.pos+=4;break;case Ke.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Ke.StartGroup:for(;;){const[s,a]=this.tag();if(a===Ke.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(a,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(o,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return Ue.dec(...this.varint64())}uint64(){return Ue.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),o=-(1&e);return e=(e>>>1|(1&n)<<31)^o,n=n>>>1^o,Ue.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ue.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ue.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function ch(t){const e=t.field.localName,n=Object.create(null);return n[e]=(function(o){const r=o.field;if(r.repeated)return[];if(r.default!==void 0)return r.default;switch(r.kind){case"enum":return r.T.values[0].no;case"scalar":return fo(r.T,r.L);case"message":const s=r.T,a=new s;return s.fieldWrapper?s.fieldWrapper.unwrapField(a):a;case"map":throw"map fields are not allowed to be extensions"}})(t),[n,()=>n[e]]}let on="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),fs=[];for(let t=0;t<on.length;t++)fs[on[t].charCodeAt(0)]=t;fs[45]=on.indexOf("+"),fs[95]=on.indexOf("/");const ps={dec(t){let e=3*t.length/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n,o=new Uint8Array(e),r=0,s=0,a=0;for(let l=0;l<t.length;l++){if(n=fs[t.charCodeAt(l)],n===void 0)switch(t[l]){case"=":s=0;case`
|
|
104
|
-
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:a=n,s=1;break;case 1:o[r++]=a<<2|(48&n)>>4,a=n,s=2;break;case 2:o[r++]=(15&a)<<4|(60&n)>>2,a=n,s=3;break;case 3:o[r++]=(3&a)<<6|n,s=0}}if(s==1)throw Error("invalid base64 string.");return o.subarray(0,r)},enc(t){let e,n="",o=0,r=0;for(let s=0;s<t.length;s++)switch(e=t[s],o){case 0:n+=on[e>>2],r=(3&e)<<4,o=1;break;case 1:n+=on[r|e>>4],r=(15&e)<<2,o=2;break;case 2:n+=on[r|e>>6],n+=on[63&e],o=0}return o&&(n+=on[r],n+="=",o==1&&(n+="=")),n}};function $x(t,e,n){uh(e,t);const o=e.runtime.bin.makeReadOptions(n),r=(function(l,c){if(!c.repeated&&(c.kind=="enum"||c.kind=="scalar")){for(let d=l.length-1;d>=0;--d)if(l[d].no==c.no)return[l[d]];return[]}return l.filter(d=>d.no===c.no)})(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,a]=ch(e);for(const l of r)e.runtime.bin.readField(s,o.readerFactory(l.data),e.field,l.wireType,o);return a()}function Vx(t,e,n,o){uh(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(dh(t,e)){const d=t.getType().runtime.bin.listUnknownFields(t).filter(u=>u.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const u of d)t.getType().runtime.bin.onUnknownField(t,u.no,u.wireType,u.data)}const a=s.writerFactory();let l=e.field;l.opt||l.repeated||l.kind!="enum"&&l.kind!="scalar"||(l=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(l,n,a,s);const c=r.readerFactory(a.finish());for(;c.pos<c.len;){const[d,u]=c.tag(),h=c.skip(u,d);t.getType().runtime.bin.onUnknownField(t,d,u,h)}}function dh(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(o=>o.no==e.field.no)}function uh(t,e){Ge(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function hh(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!lh(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function mh(t,e){const n=t.localName,o=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=o?t.T.values[0].no:void 0;break;case"scalar":e[n]=o?fo(t.T,t.L):void 0;break;case"message":e[n]=void 0}}function rn(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Xe.prototype).every(o=>o in t&&typeof t[o]=="function"))return!1;const n=t.getType();return n!==null&&typeof n=="function"&&"typeName"in n&&typeof n.typeName=="string"&&(e===void 0||n.typeName==e.typeName)}function fh(t,e){return rn(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}J.DOUBLE,J.FLOAT,J.INT64,J.UINT64,J.INT32,J.UINT32,J.BOOL,J.STRING,J.BYTES;const ph={ignoreUnknownFields:!1},gh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Gx(t){return t?Object.assign(Object.assign({},ph),t):ph}function qx(t){return t?Object.assign(Object.assign({},gh),t):gh}const gs=Symbol(),bs=Symbol();function qt(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function bh(t,e,n,o,r){let s=n.localName;if(n.repeated){if(Ge(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${qt(e)}`);const a=t[s];for(const l of e){if(l===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${qt(l)}`);switch(n.kind){case"message":a.push(n.T.fromJson(l,o));break;case"enum":const c=_i(n.T,l,o.ignoreUnknownFields,!0);c!==bs&&a.push(c);break;case"scalar":try{a.push(tr(n.T,l,n.L,!0))}catch(d){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${qt(l)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: ${qt(e)}`);const a=t[s];for(const[l,c]of Object.entries(e)){if(c===null)throw new Error(`cannot decode field ${r.typeName}.${n.name} from JSON: map value null`);let d;try{d=Hx(n.K,l)}catch(u){let h=`cannot decode map key for field ${r.typeName}.${n.name} from JSON: ${qt(e)}`;throw u instanceof Error&&u.message.length>0&&(h+=`: ${u.message}`),new Error(h)}switch(n.V.kind){case"message":a[d]=n.V.T.fromJson(c,o);break;case"enum":const u=_i(n.V.T,c,o.ignoreUnknownFields,!0);u!==bs&&(a[d]=u);break;case"scalar":try{a[d]=tr(n.V.T,c,Tn.BIGINT,!0)}catch(h){let m=`cannot decode map value for field ${r.typeName}.${n.name} from JSON: ${qt(e)}`;throw h instanceof Error&&h.message.length>0&&(m+=`: ${h.message}`),new Error(m)}}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const a=n.T;if(e===null&&a.typeName!="google.protobuf.Value")return;let l=t[s];rn(l)?l.fromJson(e,o):(t[s]=l=a.fromJson(e,o),a.fieldWrapper&&!n.oneof&&(t[s]=a.fieldWrapper.unwrapField(l)));break;case"enum":const c=_i(n.T,e,o.ignoreUnknownFields,!1);switch(c){case gs:mh(n,t);break;case bs:break;default:t[s]=c}break;case"scalar":try{const d=tr(n.T,e,n.L,!1);d===gs?mh(n,t):t[s]=d}catch(d){let u=`cannot decode field ${r.typeName}.${n.name} from JSON: ${qt(e)}`;throw d instanceof Error&&d.message.length>0&&(u+=`: ${d.message}`),new Error(u)}}}function Hx(t,e){if(t===J.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return tr(t,e,Tn.BIGINT,!0).toString()}function tr(t,e,n,o){if(e===null)return o?fo(t,n):gs;switch(t){case J.DOUBLE:case J.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==J.FLOAT&&Qu(r),r;case J.INT32:case J.FIXED32:case J.SFIXED32:case J.SINT32:case J.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==J.UINT32||t==J.FIXED32?Ni(s):hs(s),s;case J.INT64:case J.SFIXED64:case J.SINT64:if(typeof e!="number"&&typeof e!="string")break;const a=Ue.parse(e);return n?a.toString():a;case J.FIXED64:case J.UINT64:if(typeof e!="number"&&typeof e!="string")break;const l=Ue.uParse(e);return n?l.toString():l;case J.BOOL:if(typeof e!="boolean")break;return e;case J.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case J.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return ps.dec(e)}throw new Error}function _i(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:gs;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const r=t.findName(e);if(r!==void 0)return r.no;if(n)return bs}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${qt(e)}`)}function Jx(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function xh(t,e,n){if(t.kind=="map"){Ge(typeof e=="object"&&e!=null);const o={},r=Object.entries(e);switch(t.V.kind){case"scalar":for(const[a,l]of r)o[a.toString()]=xs(t.V.T,l);break;case"message":for(const[a,l]of r)o[a.toString()]=l.toJson(n);break;case"enum":const s=t.V.T;for(const[a,l]of r)o[a.toString()]=Ii(s,l,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){Ge(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(xs(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Ii(t.T,e[r],n.enumAsInteger));break;case"message":for(let r=0;r<e.length;r++)o.push(e[r].toJson(n))}return n.emitDefaultValues||o.length>0?o:void 0}switch(t.kind){case"scalar":return xs(t.T,e);case"enum":return Ii(t.T,e,n.enumAsInteger);case"message":return fh(t.T,e).toJson(n)}}function Ii(t,e,n){var o;if(Ge(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const r=t.findNumber(e);return(o=r==null?void 0:r.name)!==null&&o!==void 0?o:e}function xs(t,e){switch(t){case J.INT32:case J.SFIXED32:case J.SINT32:case J.FIXED32:case J.UINT32:return Ge(typeof e=="number"),e;case J.FLOAT:case J.DOUBLE:return Ge(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case J.STRING:return Ge(typeof e=="string"),e;case J.BOOL:return Ge(typeof e=="boolean"),e;case J.UINT64:case J.FIXED64:case J.INT64:case J.SFIXED64:case J.SINT64:return Ge(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case J.BYTES:return Ge(e instanceof Uint8Array),ps.enc(e)}}const po=Symbol("@bufbuild/protobuf/unknown-fields"),yh={readUnknownFields:!0,readerFactory:t=>new Wx(t)},vh={writeUnknownFields:!0,writerFactory:()=>new Ux};function Kx(t){return t?Object.assign(Object.assign({},yh),t):yh}function Yx(t){return t?Object.assign(Object.assign({},vh),t):vh}function wh(t,e,n,o,r){let{repeated:s,localName:a}=n;switch(n.oneof&&((t=t[n.oneof.localName]).case!=a&&delete t.value,t.case=a,a="value"),n.kind){case"scalar":case"enum":const l=n.kind=="enum"?J.INT32:n.T;let c=vs;if(n.kind=="scalar"&&n.L>0&&(c=Xx),s){let m=t[a];if(o==Ke.LengthDelimited&&l!=J.STRING&&l!=J.BYTES){let f=e.uint32()+e.pos;for(;e.pos<f;)m.push(c(e,l))}else m.push(c(e,l))}else t[a]=c(e,l);break;case"message":const d=n.T;s?t[a].push(ys(e,new d,r,n)):rn(t[a])?ys(e,t[a],r,n):(t[a]=ys(e,new d,r,n),!d.fieldWrapper||n.oneof||n.repeated||(t[a]=d.fieldWrapper.unwrapField(t[a])));break;case"map":let[u,h]=(function(m,f,b){const x=f.uint32(),p=f.pos+x;let g,y;for(;f.pos<p;){const[w]=f.tag();switch(w){case 1:g=vs(f,m.K);break;case 2:switch(m.V.kind){case"scalar":y=vs(f,m.V.T);break;case"enum":y=f.int32();break;case"message":y=ys(f,new m.V.T,b,void 0)}}}if(g===void 0&&(g=fo(m.K,Tn.BIGINT)),typeof g!="string"&&typeof g!="number"&&(g=g.toString()),y===void 0)switch(m.V.kind){case"scalar":y=fo(m.V.T,Tn.BIGINT);break;case"enum":y=m.V.T.values[0].no;break;case"message":y=new m.V.T}return[g,y]})(n,e,r);t[a][u]=h}}function ys(t,e,n,o){const r=e.getType().runtime.bin,s=o==null?void 0:o.delimited;return r.readMessage(e,t,s?o.no:t.uint32(),n,s),e}function Xx(t,e){const n=vs(t,e);return typeof n=="bigint"?n.toString():n}function vs(t,e){switch(e){case J.STRING:return t.string();case J.BOOL:return t.bool();case J.DOUBLE:return t.double();case J.FLOAT:return t.float();case J.INT32:return t.int32();case J.INT64:return t.int64();case J.UINT64:return t.uint64();case J.FIXED64:return t.fixed64();case J.BYTES:return t.bytes();case J.FIXED32:return t.fixed32();case J.SFIXED32:return t.sfixed32();case J.SFIXED64:return t.sfixed64();case J.SINT64:return t.sint64();case J.UINT32:return t.uint32();case J.SINT32:return t.sint32()}}function kh(t,e,n,o){Ge(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?J.INT32:t.T;if(r)if(Ge(Array.isArray(e)),t.packed)(function(a,l,c,d){if(!d.length)return;a.tag(c,Ke.LengthDelimited).fork();let[,u]=Ch(l);for(let h=0;h<d.length;h++)a[u](d[h]);a.join()})(n,s,t.no,e);else for(const a of e)nr(n,s,t.no,a);else nr(n,s,t.no,e);break;case"message":if(r){Ge(Array.isArray(e));for(const a of e)jh(n,o,t,a)}else jh(n,o,t,e);break;case"map":Ge(typeof e=="object"&&e!=null);for(const[a,l]of Object.entries(e))Qx(n,o,t,a,l)}}function Qx(t,e,n,o,r){t.tag(n.no,Ke.LengthDelimited),t.fork();let s=o;switch(n.K){case J.INT32:case J.FIXED32:case J.UINT32:case J.SFIXED32:case J.SINT32:s=Number.parseInt(o);break;case J.BOOL:Ge(o=="true"||o=="false"),s=o=="true"}switch(nr(t,n.K,1,s),n.V.kind){case"scalar":nr(t,n.V.T,2,r);break;case"enum":nr(t,J.INT32,2,r);break;case"message":Ge(r!==void 0),t.tag(2,Ke.LengthDelimited).bytes(r.toBinary(e))}t.join()}function jh(t,e,n,o){const r=fh(n.T,o);n.delimited?t.tag(n.no,Ke.StartGroup).raw(r.toBinary(e)).tag(n.no,Ke.EndGroup):t.tag(n.no,Ke.LengthDelimited).bytes(r.toBinary(e))}function nr(t,e,n,o){Ge(o!==void 0);let[r,s]=Ch(e);t.tag(n,r)[s](o)}function Ch(t){let e=Ke.Varint;switch(t){case J.BYTES:case J.STRING:e=Ke.LengthDelimited;break;case J.DOUBLE:case J.FIXED64:case J.SFIXED64:e=Ke.Bit64;break;case J.FIXED32:case J.SFIXED32:case J.FLOAT:e=Ke.Bit32}return[e,J[t].toLowerCase()]}function ws(t){if(t===void 0)return t;if(rn(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function or(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class Zx{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const o of this.list())n[o.jsonName]=n[o.name]=o;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const o of this.list())n[o.no]=o;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const o of this.list())o.oneof?o.oneof!==n&&(n=o.oneof,e.push(n)):e.push(o)}return this.members}}function Nh(t,e){const n=Sh(t);return e?n:r2(o2(n))}const e2=Sh;function Sh(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){let r=t.charAt(o);switch(r){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(r),e=!1;break;default:e&&(e=!1,r=r.toUpperCase()),n.push(r)}}return n.join("")}const t2=new Set(["constructor","toString","toJSON","valueOf"]),n2=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Eh=t=>`${t}$`,o2=t=>n2.has(t)?Eh(t):t,r2=t=>t2.has(t)?Eh(t):t;class s2{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Nh(e,!1)}addField(e){Ge(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}const Z=(_h=t=>new Zx(t,e=>(function(n){var o,r,s,a,l,c;const d=[];let u;for(const h of typeof n=="function"?n():n){const m=h;if(m.localName=Nh(h.name,h.oneof!==void 0),m.jsonName=(o=h.jsonName)!==null&&o!==void 0?o:e2(h.name),m.repeated=(r=h.repeated)!==null&&r!==void 0&&r,h.kind=="scalar"&&(m.L=(s=h.L)!==null&&s!==void 0?s:Tn.BIGINT),m.delimited=(a=h.delimited)!==null&&a!==void 0&&a,m.req=(l=h.req)!==null&&l!==void 0&&l,m.opt=(c=h.opt)!==null&&c!==void 0&&c,h.packed===void 0&&(m.packed=h.kind=="enum"||h.kind=="scalar"&&h.T!=J.BYTES&&h.T!=J.STRING),h.oneof!==void 0){const f=typeof h.oneof=="string"?h.oneof:h.oneof.name;u&&u.name==f||(u=new s2(f)),m.oneof=u,u.addField(m)}d.push(m)}return d})(e)),Ih=t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,o=t;if(e.repeated)o[n]=[];else switch(e.kind){case"oneof":o[n]={case:void 0};break;case"enum":o[n]=0;break;case"map":o[n]={};break;case"scalar":o[n]=fo(e.T,e.L)}}},{syntax:"proto3",json:{makeReadOptions:Gx,makeWriteOptions:qx,readMessage(t,e,n,o){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.typeName} from JSON: ${qt(e)}`);o=o??new t;const r=new Map,s=n.typeRegistry;for(const[a,l]of Object.entries(e)){const c=t.fields.findJsonName(a);if(c){if(c.oneof){if(l===null&&c.kind=="scalar")continue;const d=r.get(c.oneof);if(d!==void 0)throw new Error(`cannot decode message ${t.typeName} from JSON: multiple keys for oneof "${c.oneof.name}" present: "${d}", "${a}"`);r.set(c.oneof,a)}bh(o,l,c,n,t)}else{let d=!1;if(s!=null&&s.findExtension&&a.startsWith("[")&&a.endsWith("]")){const u=s.findExtension(a.substring(1,a.length-1));if(u&&u.extendee.typeName==t.typeName){d=!0;const[h,m]=ch(u);bh(h,l,u.field,n,u),Vx(o,u,m(),n)}}if(!d&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${t.typeName} from JSON: key "${a}" is unknown`)}}return o},writeMessage(t,e){const n=t.getType(),o={};let r;try{for(r of n.fields.byNumber()){if(!hh(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!Jx(r))continue}const a=xh(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e);a!==void 0&&(o[e.useProtoFieldName?r.name:r.jsonName]=a)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const a of n.runtime.bin.listUnknownFields(t)){const l=s.findExtensionFor(n.typeName,a.no);if(l&&dh(t,l)){const c=$x(t,l,e),d=xh(l.field,c,e);d!==void 0&&(o[l.field.jsonName]=d)}}}catch(s){const a=r?`cannot encode field ${n.typeName}.${r.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,l=s instanceof Error?s.message:String(s);throw new Error(a+(l.length>0?`: ${l}`:""))}return o},readScalar:(t,e,n)=>tr(t,e,n??Tn.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||lh(t,e)?xs(t,e):void 0},debug:qt},bin:{makeReadOptions:Kx,makeWriteOptions:Yx,listUnknownFields(t){var e;return(e=t[po])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[po]},writeUnknownFields(t,e){const n=t[po];if(n)for(const o of n)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,o){const r=t;Array.isArray(r[po])||(r[po]=[]),r[po].push({no:e,wireType:n,data:o})},readMessage(t,e,n,o,r){const s=t.getType(),a=r?e.len:e.pos+n;let l,c;for(;e.pos<a&&([l,c]=e.tag(),r!==!0||c!=Ke.EndGroup);){const d=s.fields.find(l);if(!d){const u=e.skip(c,l);o.readUnknownFields&&this.onUnknownField(t,l,c,u);continue}wh(t,e,d,c,o)}if(r&&(c!=Ke.EndGroup||l!==n))throw new Error("invalid end group tag")},readField:wh,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(hh(r,t))kh(r,r.oneof?t[r.oneof.localName].value:t[r.localName],e,n);else if(r.req)throw new Error(`cannot encode field ${o.typeName}.${r.name} to binary: required field not set`);return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,o){e!==void 0&&kh(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:eh,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const o of n.fields.byMember()){const r=o.localName,s=e,a=t;if(a[r]!=null)switch(o.kind){case"oneof":const l=a[r].case;if(l===void 0)continue;const c=o.findField(l);let d=a[r].value;c&&c.kind=="message"&&!rn(d,c.T)?d=new c.T(d):c&&c.kind==="scalar"&&c.T===J.BYTES&&(d=or(d)),s[r]={case:l,value:d};break;case"scalar":case"enum":let u=a[r];o.T===J.BYTES&&(u=o.repeated?u.map(or):or(u)),s[r]=u;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===J.BYTES)for(const[f,b]of Object.entries(a[r]))s[r][f]=or(b);else Object.assign(s[r],a[r]);break;case"message":const m=o.V.T;for(const f of Object.keys(a[r])){let b=a[r][f];m.fieldWrapper||(b=new m(b)),s[r][f]=b}}break;case"message":const h=o.T;if(o.repeated)s[r]=a[r].map(m=>rn(m,h)?m:new h(m));else{const m=a[r];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?s[r]=or(m):s[r]=m:s[r]=rn(m,h)?m:new h(m)}}}},equals:(t,e,n)=>e===n||!(!e||!n)&&t.fields.byMember().every(o=>{const r=e[o.localName],s=n[o.localName];if(o.repeated){if(r.length!==s.length)return!1;switch(o.kind){case"message":return r.every((a,l)=>o.T.equals(a,s[l]));case"scalar":return r.every((a,l)=>Dn(o.T,a,s[l]));case"enum":return r.every((a,l)=>Dn(J.INT32,a,s[l]))}throw new Error(`repeated cannot contain ${o.kind}`)}switch(o.kind){case"message":let a=r,l=s;return o.T.fieldWrapper&&(a===void 0||rn(a)||(a=o.T.fieldWrapper.wrapField(a)),l===void 0||rn(l)||(l=o.T.fieldWrapper.wrapField(l))),o.T.equals(a,l);case"enum":return Dn(J.INT32,r,s);case"scalar":return Dn(o.T,r,s);case"oneof":if(r.case!==s.case)return!1;const c=o.findField(r.case);if(c===void 0)return!0;switch(c.kind){case"message":return c.T.equals(r.value,s.value);case"enum":return Dn(J.INT32,r.value,s.value);case"scalar":return Dn(c.T,r.value,s.value)}throw new Error(`oneof cannot contain ${c.kind}`);case"map":const d=Object.keys(r).concat(Object.keys(s));switch(o.V.kind){case"message":const u=o.V.T;return d.every(m=>u.equals(r[m],s[m]));case"enum":return d.every(m=>Dn(J.INT32,r[m],s[m]));case"scalar":const h=o.V.T;return d.every(m=>Dn(h,r[m],s[m]))}}}),clone(t){const e=t.getType(),n=new e,o=n;for(const r of e.fields.byMember()){const s=t[r.localName];let a;if(r.repeated)a=s.map(ws);else if(r.kind=="map"){a=o[r.localName];for(const[l,c]of Object.entries(s))a[l]=ws(c)}else a=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:ws(s.value)}:{case:void 0}:ws(s);o[r.localName]=a}for(const r of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(o,r.no,r.wireType,r.data);return n}}),{newFieldList:_h,initFields:Ih}),makeMessageType(t,e,n){return(function(o,r,s,a){var l;const c=(l=a==null?void 0:a.localName)!==null&&l!==void 0?l:r.substring(r.lastIndexOf(".")+1),d={[c]:function(u){o.util.initFields(this),o.util.initPartial(u,this)}}[c];return Object.setPrototypeOf(d.prototype,new Xe),Object.assign(d,{runtime:o,typeName:r,fields:o.util.newFieldList(s),fromBinary:(u,h)=>new d().fromBinary(u,h),fromJson:(u,h)=>new d().fromJson(u,h),fromJsonString:(u,h)=>new d().fromJsonString(u,h),equals:(u,h)=>o.util.equals(d,u,h)}),d})(this,t,e,n)},makeEnum:Fx,makeEnumType:th,getEnumType:Lx,makeExtension(t,e,n){return(function(o,r,s,a){let l;return{typeName:r,extendee:s,get field(){if(!l){const c=typeof a=="function"?a():a;c.name=r.split(".").pop(),c.jsonName=`[${r}]`,l=o.util.newFieldList([c]).list()[0]}return l},runtime:o}})(this,t,e,n)}});var _h,Ih,It,Ai,ks,rr,js,sr,Mn;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(It||(It={})),(function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"})(Ai||(Ai={})),(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"})(ks||(ks={})),Z.util.setEnumType(ks,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),(function(t){t[t.CODEIUM=0]="CODEIUM"})(rr||(rr={})),Z.util.setEnumType(rr,"exa.codeium_common_pb.AuthSource",[{no:0,name:"AUTH_SOURCE_CODEIUM"}]),(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ENABLE_CODEIUM=1]="ENABLE_CODEIUM",t[t.DISABLE_CODEIUM=2]="DISABLE_CODEIUM",t[t.SHOW_PREVIOUS_COMPLETION=3]="SHOW_PREVIOUS_COMPLETION",t[t.SHOW_NEXT_COMPLETION=4]="SHOW_NEXT_COMPLETION"})(js||(js={})),Z.util.setEnumType(js,"exa.codeium_common_pb.EventType",[{no:0,name:"EVENT_TYPE_UNSPECIFIED"},{no:1,name:"EVENT_TYPE_ENABLE_CODEIUM"},{no:2,name:"EVENT_TYPE_DISABLE_CODEIUM"},{no:3,name:"EVENT_TYPE_SHOW_PREVIOUS_COMPLETION"},{no:4,name:"EVENT_TYPE_SHOW_NEXT_COMPLETION"}]),(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TYPING_AS_SUGGESTED=1]="TYPING_AS_SUGGESTED",t[t.CACHE=2]="CACHE",t[t.NETWORK=3]="NETWORK"})(sr||(sr={})),Z.util.setEnumType(sr,"exa.codeium_common_pb.CompletionSource",[{no:0,name:"COMPLETION_SOURCE_UNSPECIFIED"},{no:1,name:"COMPLETION_SOURCE_TYPING_AS_SUGGESTED"},{no:2,name:"COMPLETION_SOURCE_CACHE"},{no:3,name:"COMPLETION_SOURCE_NETWORK"}]),(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.C=1]="C",t[t.CLOJURE=2]="CLOJURE",t[t.COFFEESCRIPT=3]="COFFEESCRIPT",t[t.CPP=4]="CPP",t[t.CSHARP=5]="CSHARP",t[t.CSS=6]="CSS",t[t.CUDACPP=7]="CUDACPP",t[t.DOCKERFILE=8]="DOCKERFILE",t[t.GO=9]="GO",t[t.GROOVY=10]="GROOVY",t[t.HANDLEBARS=11]="HANDLEBARS",t[t.HASKELL=12]="HASKELL",t[t.HCL=13]="HCL",t[t.HTML=14]="HTML",t[t.INI=15]="INI",t[t.JAVA=16]="JAVA",t[t.JAVASCRIPT=17]="JAVASCRIPT",t[t.JSON=18]="JSON",t[t.JULIA=19]="JULIA",t[t.KOTLIN=20]="KOTLIN",t[t.LATEX=21]="LATEX",t[t.LESS=22]="LESS",t[t.LUA=23]="LUA",t[t.MAKEFILE=24]="MAKEFILE",t[t.MARKDOWN=25]="MARKDOWN",t[t.OBJECTIVEC=26]="OBJECTIVEC",t[t.OBJECTIVECPP=27]="OBJECTIVECPP",t[t.PERL=28]="PERL",t[t.PHP=29]="PHP",t[t.PLAINTEXT=30]="PLAINTEXT",t[t.PROTOBUF=31]="PROTOBUF",t[t.PBTXT=32]="PBTXT",t[t.PYTHON=33]="PYTHON",t[t.R=34]="R",t[t.RUBY=35]="RUBY",t[t.RUST=36]="RUST",t[t.SASS=37]="SASS",t[t.SCALA=38]="SCALA",t[t.SCSS=39]="SCSS",t[t.SHELL=40]="SHELL",t[t.SQL=41]="SQL",t[t.STARLARK=42]="STARLARK",t[t.SWIFT=43]="SWIFT",t[t.TSX=44]="TSX",t[t.TYPESCRIPT=45]="TYPESCRIPT",t[t.VISUALBASIC=46]="VISUALBASIC",t[t.VUE=47]="VUE",t[t.XML=48]="XML",t[t.XSL=49]="XSL",t[t.YAML=50]="YAML",t[t.SVELTE=51]="SVELTE",t[t.TOML=52]="TOML",t[t.DART=53]="DART",t[t.RST=54]="RST",t[t.OCAML=55]="OCAML",t[t.CMAKE=56]="CMAKE",t[t.PASCAL=57]="PASCAL",t[t.ELIXIR=58]="ELIXIR",t[t.FSHARP=59]="FSHARP",t[t.LISP=60]="LISP",t[t.MATLAB=61]="MATLAB",t[t.POWERSHELL=62]="POWERSHELL",t[t.SOLIDITY=63]="SOLIDITY",t[t.ADA=64]="ADA",t[t.OCAML_INTERFACE=65]="OCAML_INTERFACE"})(Mn||(Mn={})),Z.util.setEnumType(Mn,"exa.codeium_common_pb.Language",[{no:0,name:"LANGUAGE_UNSPECIFIED"},{no:1,name:"LANGUAGE_C"},{no:2,name:"LANGUAGE_CLOJURE"},{no:3,name:"LANGUAGE_COFFEESCRIPT"},{no:4,name:"LANGUAGE_CPP"},{no:5,name:"LANGUAGE_CSHARP"},{no:6,name:"LANGUAGE_CSS"},{no:7,name:"LANGUAGE_CUDACPP"},{no:8,name:"LANGUAGE_DOCKERFILE"},{no:9,name:"LANGUAGE_GO"},{no:10,name:"LANGUAGE_GROOVY"},{no:11,name:"LANGUAGE_HANDLEBARS"},{no:12,name:"LANGUAGE_HASKELL"},{no:13,name:"LANGUAGE_HCL"},{no:14,name:"LANGUAGE_HTML"},{no:15,name:"LANGUAGE_INI"},{no:16,name:"LANGUAGE_JAVA"},{no:17,name:"LANGUAGE_JAVASCRIPT"},{no:18,name:"LANGUAGE_JSON"},{no:19,name:"LANGUAGE_JULIA"},{no:20,name:"LANGUAGE_KOTLIN"},{no:21,name:"LANGUAGE_LATEX"},{no:22,name:"LANGUAGE_LESS"},{no:23,name:"LANGUAGE_LUA"},{no:24,name:"LANGUAGE_MAKEFILE"},{no:25,name:"LANGUAGE_MARKDOWN"},{no:26,name:"LANGUAGE_OBJECTIVEC"},{no:27,name:"LANGUAGE_OBJECTIVECPP"},{no:28,name:"LANGUAGE_PERL"},{no:29,name:"LANGUAGE_PHP"},{no:30,name:"LANGUAGE_PLAINTEXT"},{no:31,name:"LANGUAGE_PROTOBUF"},{no:32,name:"LANGUAGE_PBTXT"},{no:33,name:"LANGUAGE_PYTHON"},{no:34,name:"LANGUAGE_R"},{no:35,name:"LANGUAGE_RUBY"},{no:36,name:"LANGUAGE_RUST"},{no:37,name:"LANGUAGE_SASS"},{no:38,name:"LANGUAGE_SCALA"},{no:39,name:"LANGUAGE_SCSS"},{no:40,name:"LANGUAGE_SHELL"},{no:41,name:"LANGUAGE_SQL"},{no:42,name:"LANGUAGE_STARLARK"},{no:43,name:"LANGUAGE_SWIFT"},{no:44,name:"LANGUAGE_TSX"},{no:45,name:"LANGUAGE_TYPESCRIPT"},{no:46,name:"LANGUAGE_VISUALBASIC"},{no:47,name:"LANGUAGE_VUE"},{no:48,name:"LANGUAGE_XML"},{no:49,name:"LANGUAGE_XSL"},{no:50,name:"LANGUAGE_YAML"},{no:51,name:"LANGUAGE_SVELTE"},{no:52,name:"LANGUAGE_TOML"},{no:53,name:"LANGUAGE_DART"},{no:54,name:"LANGUAGE_RST"},{no:55,name:"LANGUAGE_OCAML"},{no:56,name:"LANGUAGE_CMAKE"},{no:57,name:"LANGUAGE_PASCAL"},{no:58,name:"LANGUAGE_ELIXIR"},{no:59,name:"LANGUAGE_FSHARP"},{no:60,name:"LANGUAGE_LISP"},{no:61,name:"LANGUAGE_MATLAB"},{no:62,name:"LANGUAGE_POWERSHELL"},{no:63,name:"LANGUAGE_SOLIDITY"},{no:64,name:"LANGUAGE_ADA"},{no:65,name:"LANGUAGE_OCAML_INTERFACE"}]);const an=class an extends Xe{constructor(n){super();B(this,"completionId","");B(this,"text","");B(this,"prefix","");B(this,"stop","");B(this,"score",0);B(this,"tokens",[]);B(this,"decodedTokens",[]);B(this,"probabilities",[]);B(this,"adjustedProbabilities",[]);B(this,"generatedLength",Ue.zero);Z.util.initPartial(n,this)}static fromBinary(n,o){return new an().fromBinary(n,o)}static fromJson(n,o){return new an().fromJson(n,o)}static fromJsonString(n,o){return new an().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(an,n,o)}};B(an,"runtime",Z),B(an,"typeName","exa.codeium_common_pb.Completion"),B(an,"fields",Z.util.newFieldList(()=>[{no:1,name:"completion_id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"prefix",kind:"scalar",T:9},{no:4,name:"stop",kind:"scalar",T:9},{no:5,name:"score",kind:"scalar",T:1},{no:6,name:"tokens",kind:"scalar",T:4,repeated:!0},{no:7,name:"decoded_tokens",kind:"scalar",T:9,repeated:!0},{no:8,name:"probabilities",kind:"scalar",T:1,repeated:!0},{no:9,name:"adjusted_probabilities",kind:"scalar",T:1,repeated:!0},{no:10,name:"generated_length",kind:"scalar",T:4}]));let Ti=an;const ln=class ln extends Xe{constructor(n){super();B(this,"ideName","");B(this,"ideVersion","");B(this,"extensionName","");B(this,"extensionVersion","");B(this,"apiKey","");B(this,"locale","");B(this,"sessionId","");B(this,"requestId",Ue.zero);B(this,"userAgent","");B(this,"url","");B(this,"authSource",rr.CODEIUM);Z.util.initPartial(n,this)}static fromBinary(n,o){return new ln().fromBinary(n,o)}static fromJson(n,o){return new ln().fromJson(n,o)}static fromJsonString(n,o){return new ln().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(ln,n,o)}};B(ln,"runtime",Z),B(ln,"typeName","exa.codeium_common_pb.Metadata"),B(ln,"fields",Z.util.newFieldList(()=>[{no:1,name:"ide_name",kind:"scalar",T:9},{no:7,name:"ide_version",kind:"scalar",T:9},{no:12,name:"extension_name",kind:"scalar",T:9},{no:2,name:"extension_version",kind:"scalar",T:9},{no:3,name:"api_key",kind:"scalar",T:9},{no:4,name:"locale",kind:"scalar",T:9},{no:10,name:"session_id",kind:"scalar",T:9},{no:9,name:"request_id",kind:"scalar",T:4},{no:13,name:"user_agent",kind:"scalar",T:9},{no:14,name:"url",kind:"scalar",T:9},{no:15,name:"auth_source",kind:"enum",T:Z.getEnumType(rr)}]));let Cs=ln;const cn=class cn extends Xe{constructor(n){super();B(this,"tabSize",Ue.zero);B(this,"insertSpaces",!1);Z.util.initPartial(n,this)}static fromBinary(n,o){return new cn().fromBinary(n,o)}static fromJson(n,o){return new cn().fromJson(n,o)}static fromJsonString(n,o){return new cn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(cn,n,o)}};B(cn,"runtime",Z),B(cn,"typeName","exa.codeium_common_pb.EditorOptions"),B(cn,"fields",Z.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let Di=cn;Z.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:Z.getEnumType(js)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class a2 extends So{constructor(n,o){super();B(this,"index");B(this,"total");this.index=n,this.total=o}toDOM(){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="cm-codeium-cycle";const o=n.appendChild(document.createElement("span"));o.className="cm-codeium-cycle-explanation",o.innerText=`${this.index+1}/${this.total}`;const r=n.appendChild(document.createElement("button"));return r.className="cm-codeium-cycle-key",r.innerText="\u2192 (Ctrl ])",r.dataset.action="codeium-cycle",n}ignoreEvent(){return!1}}const Ns=ro.define({combine:t=>qs(t,{language:Mn.TYPESCRIPT,timeout:150,widgetClass:a2,alwaysOn:!0},{})}),Ah=ro.define({combine:t=>qs(t,{override:()=>[]},{})}),i2=Te.mark({class:"cm-ghostText"}),Qn=Dt.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Ns);for(const r of e.effects){if(r.is(ki)){const{changeSpecs:s,index:a}=r.value,l=s[a].map(d=>i2.range(d.absoluteStartPos,d.absoluteEndPos)),c=(o=l.at(-1))==null?void 0:o.to;return{index:a,decorations:Te.set([...l,...c!==void 0&&s.length>1&&n.widgetClass?[Te.widget({widget:new n.widgetClass(a,s.length),side:1}).range(c)]:[]]),changeSpecs:s,reverseChangeSet:r.value.reverseChangeSet}}if(r.is(ji)||r.is(Ci))return null}return t&&{...t,decorations:t.decorations.map(e.changes),reverseChangeSet:t.reverseChangeSet.map(e.changes)}},provide:t=>Se.decorations.from(t,e=>(e==null?void 0:e.decorations)||Te.none)}),go=ic.define(),Ss=ic.define();var Pe;function Mi(t){const e=Pe[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let Es;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(Pe||(Pe={}));class Qe extends Error{constructor(e,n=Pe.Unknown,o,r,s){super((function(a,l){return a.length?`[${Mi(l)}] ${a}`:`[${Mi(l)}]`})(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(o??{}),this.details=r??[],this.cause=s}static from(e,n=Pe.Unknown){return e instanceof Qe?e:e instanceof Error?e.name=="AbortError"?new Qe(e.message,Pe.Canceled):new Qe(e.message,n,void 0,void 0,e):new Qe(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Qe.prototype||e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e)}findDetails(e){const n="typeName"in e?{findMessage:r=>r===e.typeName?e:void 0}:e,o=[];for(const r of this.details){if("getType"in r){n.findMessage(r.getType().typeName)&&o.push(r);continue}const s=n.findMessage(r.type);if(s)try{o.push(s.fromBinary(r.value))}catch{}}return o}}var l2=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(a,l){(function(c,d,u,h){Promise.resolve(h).then(function(m){c({value:m,done:u})},d)})(a,l,(s=t[r](s)).done,s.value)})}}},ar=function(t){return this instanceof ar?(this.v=t,this):new ar(t)},c2=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(m){return Promise.resolve(m).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,m){r[h]&&(o[h]=function(f){return new Promise(function(b,x){s.push([h,f,b,x])>1||l(h,f)})},m&&(o[h]=m(o[h])))}function l(h,m){try{(f=r[h](m)).value instanceof ar?Promise.resolve(f.value.v).then(c,d):u(s[0][2],f)}catch(b){u(s[0][3],b)}var f}function c(h){l("next",h)}function d(h){l("throw",h)}function u(h,m){h(m),s.shift(),s.length&&l(s[0][0],s[0][1])}},d2=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(a){return(n=!n)?{value:ar(t[r](a)),done:!1}:s?s(a):a}:s}},Th=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(r){e[r]=t[r]&&function(s){return new Promise(function(a,l){(function(c,d,u,h){Promise.resolve(h).then(function(m){c({value:m,done:u})},d)})(a,l,(s=t[r](s)).done,s.value)})}}},bo=function(t){return this instanceof bo?(this.v=t,this):new bo(t)},u2=function(t){var e,n;return e={},o("next"),o("throw",function(r){throw r}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(r,s){e[r]=t[r]?function(a){return(n=!n)?{value:bo(t[r](a)),done:!1}:s?s(a):a}:s}},h2=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(m){return Promise.resolve(m).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,m){r[h]&&(o[h]=function(f){return new Promise(function(b,x){s.push([h,f,b,x])>1||l(h,f)})},m&&(o[h]=m(o[h])))}function l(h,m){try{(f=r[h](m)).value instanceof bo?Promise.resolve(f.value.v).then(c,d):u(s[0][2],f)}catch(b){u(s[0][3],b)}var f}function c(h){l("next",h)}function d(h){l("throw",h)}function u(h,m){h(m),s.shift(),s.length&&l(s[0][0],s[0][1])}};function m2(t,e){return(function(n,o){const r={};for(const[s,a]of Object.entries(n.methods)){const l=o(Object.assign(Object.assign({},a),{localName:s,service:n}));l!=null&&(r[s]=l)}return r})(t,n=>{switch(n.kind){case It.Unary:return(function(o,r,s){return async function(a,l){var c,d;const u=await o.unary(r,s,l==null?void 0:l.signal,l==null?void 0:l.timeoutMs,l==null?void 0:l.headers,a,l==null?void 0:l.contextValues);return(c=l==null?void 0:l.onHeader)===null||c===void 0||c.call(l,u.header),(d=l==null?void 0:l.onTrailer)===null||d===void 0||d.call(l,u.trailer),u.message}})(e,t,n);case It.ServerStreaming:return(function(o,r,s){return function(a,l){return Dh(o.stream(r,s,l==null?void 0:l.signal,l==null?void 0:l.timeoutMs,l==null?void 0:l.headers,(function(c){return c2(this,arguments,function*(){yield ar(yield*d2(l2(c)))})})([a]),l==null?void 0:l.contextValues),l)}})(e,t,n);case It.ClientStreaming:return(function(o,r,s){return async function(a,l){var c,d,u,h,m,f;const b=await o.stream(r,s,l==null?void 0:l.signal,l==null?void 0:l.timeoutMs,l==null?void 0:l.headers,a,l==null?void 0:l.contextValues);let x;(m=l==null?void 0:l.onHeader)===null||m===void 0||m.call(l,b.header);let p=0;try{for(var g,y=!0,w=Th(b.message);!(c=(g=await w.next()).done);y=!0)h=g.value,y=!1,x=h,p++}catch(j){d={error:j}}finally{try{y||c||!(u=w.return)||await u.call(w)}finally{if(d)throw d.error}}if(!x)throw new Qe("protocol error: missing response message",Pe.Unimplemented);if(p>1)throw new Qe("protocol error: received extra messages for client streaming method",Pe.Unimplemented);return(f=l==null?void 0:l.onTrailer)===null||f===void 0||f.call(l,b.trailer),x}})(e,t,n);case It.BiDiStreaming:return(function(o,r,s){return function(a,l){return Dh(o.stream(r,s,l==null?void 0:l.signal,l==null?void 0:l.timeoutMs,l==null?void 0:l.headers,a,l==null?void 0:l.contextValues),l)}})(e,t,n);default:return null}})}function Dh(t,e){const n=(function(){return h2(this,arguments,function*(){var o,r;const s=yield bo(t);(o=e==null?void 0:e.onHeader)===null||o===void 0||o.call(e,s.header),yield bo(yield*u2(Th(s.message))),(r=e==null?void 0:e.onTrailer)===null||r===void 0||r.call(e,s.trailer)})})()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function Mh(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;const e=new Error("This operation was aborted");return e.name="AbortError",e}function Oh(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function Rh(t,e,n){const o=typeof e=="string"?e:e.typeName,r=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${o}/${r}`)}function Lh(t,e){return e instanceof t?e:new t(e)}function f2(t,e){function n(o){return o.done===!0?o:{done:o.done,value:Lh(t,o.value)}}return{[Symbol.asyncIterator](){const o=e[Symbol.asyncIterator](),r={next:()=>o.next().then(n)};return o.throw!==void 0&&(r.throw=s=>o.throw(s).then(n)),o.return!==void 0&&(r.return=s=>o.return(s).then(n)),r}}}function Fh(t,e){var n;return(n=e==null?void 0:e.concat().reverse().reduce((o,r)=>r(o),t))!==null&&n!==void 0?n:t}function Bh(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function Ph(t,e,n,o){const r=e?zh(t.I,o):Uh(t.I,n);return{parse:(e?zh(t.O,o):Uh(t.O,n)).parse,serialize:r.serialize}}function zh(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Qe(`parse binary: ${r}`,Pe.Internal)}},serialize(n){try{return n.toBinary(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new Qe(`serialize binary: ${r}`,Pe.Internal)}}}}function Uh(t,e){var n,o;const r=(n=e==null?void 0:e.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(o=e==null?void 0:e.textDecoder)!==null&&o!==void 0?o:new TextDecoder,a=Bh(e);return{parse(l){try{const c=s.decode(l);return t.fromJsonString(c,a)}catch(c){throw Qe.from(c,Pe.InvalidArgument)}},serialize(l){try{const c=l.toJsonString(a);return r.encode(c)}catch(c){throw Qe.from(c,Pe.Internal)}}}}const p2=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function Wh(t,e,n){var o;if(e&&new Headers(e).forEach((l,c)=>n.metadata.append(c,l)),typeof t!="object"||t==null||Array.isArray(t))throw n;let r=n.code;"code"in t&&typeof t.code=="string"&&(r=(o=(function(l){if(!Es){Es={};for(const c of Object.values(Pe))typeof c!="string"&&(Es[Mi(c)]=c)}return Es[l]})(t.code))!==null&&o!==void 0?o:r);const s=t.message;if(s!=null&&typeof s!="string")throw n;const a=new Qe(s??"",r,e);if("details"in t&&Array.isArray(t.details))for(const l of t.details){if(l===null||typeof l!="object"||Array.isArray(l)||typeof l.type!="string"||typeof l.value!="string")throw n;try{a.details.push({type:l.type,value:ps.dec(l.value),debug:l.debug})}catch{throw n}}return a}function g2(t){const e=new Qe("invalid end stream",Pe.Unknown);let n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;const o=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(const[r,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(a=>typeof a!="string"))throw e;for(const a of s)o.append(r,a)}}return{metadata:o,error:"error"in n&&n.error!=null?Wh(n.error,o,e):void 0}}const _s="Content-Type",b2="Content-Length",$h="Content-Encoding",x2="Accept-Encoding",Vh="Connect-Protocol-Version";function Gh(t){const e=new Headers,n=new Headers;return t.forEach((o,r)=>{r.toLowerCase().startsWith("trailer-")?n.append(r.substring(8),o):e.append(r,o)}),[e,n]}function qh(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(_s,t==It.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(Vh,"1"),s}function Hh(t,e,n,o){const r=o.get(_s),s=(function(c){const d=c==null?void 0:c.match(p2);if(d)return{stream:!!d[1],binary:!!d[3]}})(r);if(n!==200){const c=new Qe(`HTTP ${n}`,(function(d){switch(d){case 400:return Pe.Internal;case 401:return Pe.Unauthenticated;case 403:return Pe.PermissionDenied;case 404:return Pe.Unimplemented;case 429:case 502:case 503:case 504:return Pe.Unavailable;default:return Pe.Unknown}})(n),o);if(t==It.Unary&&s&&!s.binary)return{isUnaryError:!0,unaryError:c};throw c}const a=e,l=t!==It.Unary;if((s==null?void 0:s.binary)!==a||s.stream!==l)throw new Qe(`unsupported content type ${r}`,s===void 0?Pe.Unknown:Pe.Internal,o);return{isUnaryError:!1}}const y2="application/";function v2(t,e,n){let o="?connect=v1";const r=t.header.get(_s);(r==null?void 0:r.indexOf(y2))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get($h);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+(function(c,d){return d?ps.enc(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(c))})(e,n);const a=t.url+o,l=new Headers(t.header);return[Vh,_s,b2,$h,x2].forEach(c=>l.delete(c)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:a,header:l})}function Jh(t){const{signal:e,cleanup:n}=(function(r){const s=new AbortController,a=()=>{s.abort(new Qe("the operation timed out",Pe.DeadlineExceeded))};let l;return r!==void 0&&(r<=0?a():l=setTimeout(a,r)),{signal:s.signal,cleanup:()=>clearTimeout(l)}})(t.timeoutMs),o=(function(...r){const s=new AbortController,a=r.filter(c=>c!==void 0).concat(s.signal);for(const c of a){if(c.aborted){l.apply(c);break}c.addEventListener("abort",l)}function l(){s.signal.aborted||s.abort(Mh(this));for(const c of a)c.removeEventListener("abort",l)}return s})(t.signal,e);return[o.signal,function(r){const s=Qe.from(e.aborted?Mh(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var ir,Oi,lr;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INACTIVE=1]="INACTIVE",t[t.PROCESSING=2]="PROCESSING",t[t.SUCCESS=3]="SUCCESS",t[t.WARNING=4]="WARNING",t[t.ERROR=5]="ERROR"})(ir||(ir={})),Z.util.setEnumType(ir,"exa.language_server_pb.CodeiumState",[{no:0,name:"CODEIUM_STATE_UNSPECIFIED"},{no:1,name:"CODEIUM_STATE_INACTIVE"},{no:2,name:"CODEIUM_STATE_PROCESSING"},{no:3,name:"CODEIUM_STATE_SUCCESS"},{no:4,name:"CODEIUM_STATE_WARNING"},{no:5,name:"CODEIUM_STATE_ERROR"}]),(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SINGLE=1]="SINGLE",t[t.MULTI=2]="MULTI"})(Oi||(Oi={})),Z.util.setEnumType(Oi,"exa.language_server_pb.LineType",[{no:0,name:"LINE_TYPE_UNSPECIFIED"},{no:1,name:"LINE_TYPE_SINGLE"},{no:2,name:"LINE_TYPE_MULTI"}]),(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.INLINE=1]="INLINE",t[t.BLOCK=2]="BLOCK",t[t.INLINE_MASK=3]="INLINE_MASK"})(lr||(lr={})),Z.util.setEnumType(lr,"exa.language_server_pb.CompletionPartType",[{no:0,name:"COMPLETION_PART_TYPE_UNSPECIFIED"},{no:1,name:"COMPLETION_PART_TYPE_INLINE"},{no:2,name:"COMPLETION_PART_TYPE_BLOCK"},{no:3,name:"COMPLETION_PART_TYPE_INLINE_MASK"}]);const dn=class dn extends Xe{constructor(n){super();B(this,"threshold",0);Z.util.initPartial(n,this)}static fromBinary(n,o){return new dn().fromBinary(n,o)}static fromJson(n,o){return new dn().fromJson(n,o)}static fromJsonString(n,o){return new dn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(dn,n,o)}};B(dn,"runtime",Z),B(dn,"typeName","exa.language_server_pb.MultilineConfig"),B(dn,"fields",Z.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let Ri=dn;const un=class un extends Xe{constructor(n){super();B(this,"metadata");B(this,"document");B(this,"editorOptions");B(this,"otherDocuments",[]);B(this,"experimentConfig");B(this,"modelName","");B(this,"multilineConfig");Z.util.initPartial(n,this)}static fromBinary(n,o){return new un().fromBinary(n,o)}static fromJson(n,o){return new un().fromJson(n,o)}static fromJsonString(n,o){return new un().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(un,n,o)}};B(un,"runtime",Z),B(un,"typeName","exa.language_server_pb.GetCompletionsRequest"),B(un,"fields",Z.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Cs},{no:2,name:"document",kind:"message",T:Is},{no:3,name:"editor_options",kind:"message",T:Di},{no:5,name:"other_documents",kind:"message",T:Is,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:Wi},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Ri}]));let Li=un;const hn=class hn extends Xe{constructor(n){super();B(this,"state");B(this,"completionItems",[]);Z.util.initPartial(n,this)}static fromBinary(n,o){return new hn().fromBinary(n,o)}static fromJson(n,o){return new hn().fromJson(n,o)}static fromJsonString(n,o){return new hn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(hn,n,o)}};B(hn,"runtime",Z),B(hn,"typeName","exa.language_server_pb.GetCompletionsResponse"),B(hn,"fields",Z.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:$i},{no:2,name:"completion_items",kind:"message",T:Hi,repeated:!0}]));let Fi=hn;const mn=class mn extends Xe{constructor(n){super();B(this,"metadata");B(this,"completionId","");Z.util.initPartial(n,this)}static fromBinary(n,o){return new mn().fromBinary(n,o)}static fromJson(n,o){return new mn().fromJson(n,o)}static fromJsonString(n,o){return new mn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(mn,n,o)}};B(mn,"runtime",Z),B(mn,"typeName","exa.language_server_pb.AcceptCompletionRequest"),B(mn,"fields",Z.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Cs},{no:2,name:"completion_id",kind:"scalar",T:9}]));let Bi=mn;const fn=class fn extends Xe{constructor(e){super(),Z.util.initPartial(e,this)}static fromBinary(e,n){return new fn().fromBinary(e,n)}static fromJson(e,n){return new fn().fromJson(e,n)}static fromJsonString(e,n){return new fn().fromJsonString(e,n)}static equals(e,n){return Z.util.equals(fn,e,n)}};B(fn,"runtime",Z),B(fn,"typeName","exa.language_server_pb.AcceptCompletionResponse"),B(fn,"fields",Z.util.newFieldList(()=>[]));let Pi=fn;const pn=class pn extends Xe{constructor(e){super(),Z.util.initPartial(e,this)}static fromBinary(e,n){return new pn().fromBinary(e,n)}static fromJson(e,n){return new pn().fromJson(e,n)}static fromJsonString(e,n){return new pn().fromJsonString(e,n)}static equals(e,n){return Z.util.equals(pn,e,n)}};B(pn,"runtime",Z),B(pn,"typeName","exa.language_server_pb.GetAuthTokenRequest"),B(pn,"fields",Z.util.newFieldList(()=>[]));let zi=pn;const gn=class gn extends Xe{constructor(n){super();B(this,"authToken","");B(this,"uuid","");Z.util.initPartial(n,this)}static fromBinary(n,o){return new gn().fromBinary(n,o)}static fromJson(n,o){return new gn().fromJson(n,o)}static fromJsonString(n,o){return new gn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(gn,n,o)}};B(gn,"runtime",Z),B(gn,"typeName","exa.language_server_pb.GetAuthTokenResponse"),B(gn,"fields",Z.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let Ui=gn;const bn=class bn extends Xe{constructor(n){super();B(this,"row",Ue.zero);B(this,"col",Ue.zero);Z.util.initPartial(n,this)}static fromBinary(n,o){return new bn().fromBinary(n,o)}static fromJson(n,o){return new bn().fromJson(n,o)}static fromJsonString(n,o){return new bn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(bn,n,o)}};B(bn,"runtime",Z),B(bn,"typeName","exa.language_server_pb.DocumentPosition"),B(bn,"fields",Z.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let cr=bn;const xn=class xn extends Xe{constructor(n){super();B(this,"absolutePath","");B(this,"relativePath","");B(this,"text","");B(this,"editorLanguage","");B(this,"language",Mn.UNSPECIFIED);B(this,"cursorOffset",Ue.zero);B(this,"cursorPosition");B(this,"lineEnding","");Z.util.initPartial(n,this)}static fromBinary(n,o){return new xn().fromBinary(n,o)}static fromJson(n,o){return new xn().fromJson(n,o)}static fromJsonString(n,o){return new xn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(xn,n,o)}};B(xn,"runtime",Z),B(xn,"typeName","exa.language_server_pb.Document"),B(xn,"fields",Z.util.newFieldList(()=>[{no:1,name:"absolute_path",kind:"scalar",T:9},{no:2,name:"relative_path",kind:"scalar",T:9},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"editor_language",kind:"scalar",T:9},{no:5,name:"language",kind:"enum",T:Z.getEnumType(Mn)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:cr},{no:7,name:"line_ending",kind:"scalar",T:9}]));let Is=xn;const yn=class yn extends Xe{constructor(n){super();B(this,"forceEnableExperiments",[]);Z.util.initPartial(n,this)}static fromBinary(n,o){return new yn().fromBinary(n,o)}static fromJson(n,o){return new yn().fromJson(n,o)}static fromJsonString(n,o){return new yn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(yn,n,o)}};B(yn,"runtime",Z),B(yn,"typeName","exa.language_server_pb.ExperimentConfig"),B(yn,"fields",Z.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:Z.getEnumType(ks),repeated:!0}]));let Wi=yn;const vn=class vn extends Xe{constructor(n){super();B(this,"state",ir.UNSPECIFIED);B(this,"message","");Z.util.initPartial(n,this)}static fromBinary(n,o){return new vn().fromBinary(n,o)}static fromJson(n,o){return new vn().fromJson(n,o)}static fromJsonString(n,o){return new vn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(vn,n,o)}};B(vn,"runtime",Z),B(vn,"typeName","exa.language_server_pb.State"),B(vn,"fields",Z.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:Z.getEnumType(ir)},{no:2,name:"message",kind:"scalar",T:9}]));let $i=vn;const wn=class wn extends Xe{constructor(n){super();B(this,"startOffset",Ue.zero);B(this,"endOffset",Ue.zero);B(this,"startPosition");B(this,"endPosition");Z.util.initPartial(n,this)}static fromBinary(n,o){return new wn().fromBinary(n,o)}static fromJson(n,o){return new wn().fromJson(n,o)}static fromJsonString(n,o){return new wn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(wn,n,o)}};B(wn,"runtime",Z),B(wn,"typeName","exa.language_server_pb.Range"),B(wn,"fields",Z.util.newFieldList(()=>[{no:1,name:"start_offset",kind:"scalar",T:4},{no:2,name:"end_offset",kind:"scalar",T:4},{no:3,name:"start_position",kind:"message",T:cr},{no:4,name:"end_position",kind:"message",T:cr}]));let Vi=wn;const kn=class kn extends Xe{constructor(n){super();B(this,"text","");B(this,"deltaCursorOffset",Ue.zero);Z.util.initPartial(n,this)}static fromBinary(n,o){return new kn().fromBinary(n,o)}static fromJson(n,o){return new kn().fromJson(n,o)}static fromJsonString(n,o){return new kn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(kn,n,o)}};B(kn,"runtime",Z),B(kn,"typeName","exa.language_server_pb.Suffix"),B(kn,"fields",Z.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let Gi=kn;const jn=class jn extends Xe{constructor(n){super();B(this,"text","");B(this,"offset",Ue.zero);B(this,"type",lr.UNSPECIFIED);B(this,"prefix","");B(this,"line",Ue.zero);Z.util.initPartial(n,this)}static fromBinary(n,o){return new jn().fromBinary(n,o)}static fromJson(n,o){return new jn().fromJson(n,o)}static fromJsonString(n,o){return new jn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(jn,n,o)}};B(jn,"runtime",Z),B(jn,"typeName","exa.language_server_pb.CompletionPart"),B(jn,"fields",Z.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"offset",kind:"scalar",T:4},{no:3,name:"type",kind:"enum",T:Z.getEnumType(lr)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let qi=jn;const Cn=class Cn extends Xe{constructor(n){super();B(this,"completion");B(this,"suffix");B(this,"range");B(this,"source",sr.UNSPECIFIED);B(this,"completionParts",[]);Z.util.initPartial(n,this)}static fromBinary(n,o){return new Cn().fromBinary(n,o)}static fromJson(n,o){return new Cn().fromJson(n,o)}static fromJsonString(n,o){return new Cn().fromJsonString(n,o)}static equals(n,o){return Z.util.equals(Cn,n,o)}};B(Cn,"runtime",Z),B(Cn,"typeName","exa.language_server_pb.CompletionItem"),B(Cn,"fields",Z.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:Ti},{no:5,name:"suffix",kind:"message",T:Gi},{no:2,name:"range",kind:"message",T:Vi},{no:3,name:"source",kind:"enum",T:Z.getEnumType(sr)},{no:8,name:"completion_parts",kind:"message",T:qi,repeated:!0}]));let Hi=Cn;const w2={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Li,O:Fi,kind:It.Unary},acceptCompletion:{name:"AcceptCompletion",I:Bi,O:Pi,kind:It.Unary},getAuthToken:{name:"GetAuthToken",I:zi,O:Ui,kind:It.Unary}}};var dr=function(t){return this instanceof dr?(this.v=t,this):new dr(t)},k2=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),s=[];return o={},a("next"),a("throw"),a("return",function(h){return function(m){return Promise.resolve(m).then(h,d)}}),o[Symbol.asyncIterator]=function(){return this},o;function a(h,m){r[h]&&(o[h]=function(f){return new Promise(function(b,x){s.push([h,f,b,x])>1||l(h,f)})},m&&(o[h]=m(o[h])))}function l(h,m){try{(f=r[h](m)).value instanceof dr?Promise.resolve(f.value.v).then(c,d):u(s[0][2],f)}catch(b){u(s[0][3],b)}var f}function c(h){l("next",h)}function d(h){l("throw",h)}function u(h,m){h(m),s.shift(),s.length&&l(s[0][0],s[0][1])}};const j2=(function(t,e){return m2(t,e)})(w2,(function(t){var e;(function(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}})();const n=(e=t.useBinaryFormat)!==null&&e!==void 0&&e;return{async unary(o,r,s,a,l,c,d){var u;const{serialize:h,parse:m}=Ph(r,n,t.jsonOptions,t.binaryOptions);return a=a===void 0?t.defaultTimeoutMs:a<=0?void 0:a,await(function(f){const b=Fh(f.next,f.interceptors),[x,p,g]=Jh(f);return b(Object.assign(Object.assign({},f.req),{message:Lh(f.req.method.I,f.req.message),signal:x})).then(y=>(g(),y),p)})({interceptors:t.interceptors,signal:s,timeoutMs:a,req:{stream:!1,service:o,method:r,url:Rh(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:qh(r.kind,n,a,l),contextValues:d??Oh(),message:c},next:async f=>{var b;let x=null;t.useHttpGet===!0&&r.idempotency===Ai.NoSideEffects?f=v2(f,h(f.message),n):x=h(f.message);const p=(b=t.fetch)!==null&&b!==void 0?b:globalThis.fetch,g=await p(f.url,Object.assign(Object.assign({},f.init),{headers:f.header,signal:f.signal,body:x})),{isUnaryError:y,unaryError:w}=Hh(r.kind,n,g.status,g.headers);if(y)throw Wh(await g.json(),(function(...C){const k=new Headers;for(const _ of C)_.forEach((E,I)=>{k.append(I,E)});return k})(...Gh(g.headers)),w);const[j,N]=Gh(g.headers);return{stream:!1,service:o,method:r,header:j,message:n?m(new Uint8Array(await g.arrayBuffer())):r.O.fromJson(await g.json(),Bh(t.jsonOptions)),trailer:N}}})},async stream(o,r,s,a,l,c,d){var u;const{serialize:h,parse:m}=Ph(r,n,t.jsonOptions,t.binaryOptions);function f(x,p,g,y){return k2(this,arguments,function*(){const w=(function(N){let C,k=new Uint8Array(0);function _(E){const I=new Uint8Array(k.length+E.length);I.set(k),I.set(E,k.length),k=I}return new ReadableStream({start(){C=N.getReader()},async pull(E){let I;for(;;){if(I===void 0&&k.byteLength>=5){let D=0;for(let M=1;M<5;M++)D=(D<<8)+k[M];I={flags:k[0],length:D}}if(I!==void 0&&k.byteLength>=I.length+5)break;const F=await C.read();if(F.done)break;_(F.value)}if(I===void 0)return k.byteLength==0?void E.close():void E.error(new Qe("premature end of stream",Pe.DataLoss));const A=k.subarray(5,5+I.length);k=k.subarray(5+I.length),E.enqueue({flags:I.flags,data:A})}})})(x).getReader();let j=!1;for(;;){const N=yield dr(w.read());if(N.done)break;const{flags:C,data:k}=N.value;if(!(1&~C))throw new Qe("protocol error: received unsupported compressed output",Pe.Internal);if(!(2&~C)){j=!0;const _=g2(k);if(_.error){const E=_.error;throw g.forEach((I,A)=>{E.metadata.append(A,I)}),E}_.metadata.forEach((E,I)=>p.set(I,E));continue}yield yield dr(m(k))}if("throwIfAborted"in y&&y.throwIfAborted(),!j)throw"missing EndStreamResponse"})}async function b(x){if(r.kind!=It.ServerStreaming)throw"The fetch API does not support streaming request bodies";const p=await x[Symbol.asyncIterator]().next();if(p.done==1)throw"missing request message";return(function(g,y){const w=new Uint8Array(y.length+5);w.set(y,5);const j=new DataView(w.buffer,w.byteOffset,w.byteLength);return j.setUint8(0,g),j.setUint32(1,y.length),w})(0,h(p.value))}return a=a===void 0?t.defaultTimeoutMs:a<=0?void 0:a,await(function(x){const p=Fh(x.next,x.interceptors),[g,y,w]=Jh(x),j=Object.assign(Object.assign({},x.req),{message:f2(x.req.method.I,x.req.message),signal:g});let N=!1;return g.addEventListener("abort",function(){var C,k;const _=x.req.message[Symbol.asyncIterator]();N||(C=_.throw)===null||C===void 0||C.call(_,this.reason).catch(()=>{}),(k=_.return)===null||k===void 0||k.call(_).catch(()=>{})}),p(j).then(C=>Object.assign(Object.assign({},C),{message:{[Symbol.asyncIterator](){const k=C.message[Symbol.asyncIterator]();return{next:()=>k.next().then(_=>(_.done==1&&(N=!0,w()),_),y)}}}}),y)})({interceptors:t.interceptors,timeoutMs:a,signal:s,req:{stream:!0,service:o,method:r,url:Rh(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:qh(r.kind,n,a,l),contextValues:d??Oh(),message:c},next:async x=>{var p;const g=(p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch,y=await g(x.url,Object.assign(Object.assign({},x.init),{headers:x.header,signal:x.signal,body:await b(x.message)}));if(Hh(r.kind,n,y.status,y.headers),y.body===null)throw"missing response body";const w=new Headers;return Object.assign(Object.assign({},x),{header:y.headers,trailer:w,message:f(y.body,w,y.headers,x.signal)})}})}}})({baseUrl:"https://web-backend.codeium.com",useBinaryFormat:!0}));let As;try{As=crypto.randomUUID()}catch{As="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function C2(t,e){const n=t.state.facet(Ns),{override:o}=t.state.facet(Ah),r=await o(),s=t.state,a=s.selection.main.head,l=s.doc.toString();try{const c=await(async function({text:b,cursorOffset:x,config:p,otherDocuments:g}){return await j2.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:p.apiKey,sessionId:As,authSource:p.authSource},document:{text:b,cursorOffset:BigInt(x),language:p.language,editorLanguage:"typescript",lineEnding:`
|
|
105
|
-
`},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:g,multilineConfig:void 0},{headers:{Authorization:`Basic ${p.apiKey}-${As}`}})})({text:l,cursorOffset:a,config:n,otherDocuments:r});if(!c||c.completionItems.length===0||e!==void 0&&a!==e||Fo(t.state)==="active"||!t.hasFocus)return;const d=c.completionItems.map(b=>{let x=0;return b.completionParts.filter(p=>p.type!==3).map(p=>{const g=Number(p.offset),y=p.type===2?`
|
|
106
|
-
${p.text}`:p.text,w={absoluteStartPos:x+g,absoluteEndPos:x+g+y.length,from:g,to:g,insert:y};return x+=y.length,w})}),u=0,h=d.at(u);if(!h)return;const m=Ar.of(h,s.doc.length),f=m.invert(s.doc);t.dispatch({changes:m,effects:ki.of({index:u,reverseChangeSet:f,changeSpecs:d}),annotations:[Ss.of(null),go.of(null),Tr.addToHistory.of(!1)]})}catch(c){console.warn("copilot completion failed",c),await new Promise(d=>setTimeout(d,300))}}function N2(){let t=null,e=0;return Se.updateListener.of(n=>{const o=n.view.state.facet(Ns);if(!o.alwaysOn||!(function(s){return s.docChanged&&!s.transactions.some(a=>a.effects.some(l=>l.is(ji)||l.is(Ci)))})(n)||(t&&clearTimeout(t),(function(s){if(!s.view.hasFocus||s.state.field(Qn)||Fo(s.state)==="active")return!0;for(const a of s.transactions)if(a.annotation(go)!==void 0)return!0})(n)))return;const r=n.state.selection.main.head;o.shouldComplete&&!o.shouldComplete(new a4(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await C2(n.view,e)},o.timeout),e=r)})}function Kh(t){var r;const e=t.state.field(Qn);if(!e)return!1;const n=(r=e.reverseChangeSet)==null?void 0:r.invert(t.state.doc);t.dispatch({changes:e.reverseChangeSet,effects:ji.of(null),annotations:[Ss.of(null),go.of(null),Tr.addToHistory.of(!1)]});let o=0;return n==null||n.iterChangedRanges((s,a,l,c)=>{o=c}),t.dispatch({changes:n,selection:Yt.cursor(o),annotations:[go.of(null),Tr.addToHistory.of(!0)]}),!0}const Yh=t=>{const{state:e}=t,n=e.field(Qn);if(!n)return!1;const{changeSpecs:o}=n;if(o.length<2)return!1;const r=(n.index+1)%o.length,s=o.at(r);if(!s)return!1;const a=n.reverseChangeSet.apply(e.doc),l=Ar.of(n.reverseChangeSet,e.doc.length).compose(Ar.of(s,a.length)),c=Ar.of(s,a.length).invert(a);return t.dispatch({changes:l,effects:ki.of({index:r,reverseChangeSet:c,changeSpecs:o}),annotations:[Ss.of(null),go.of(null),Tr.addToHistory.of(!1)]}),!0};function Ji(t){const e=t.state.field(Qn);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Ci.of(null),annotations:[Ss.of(null),go.of(null),Tr.addToHistory.of(!1)]}),!1)}function S2(){return Se.domEventHandlers({keydown:(t,e)=>(t.key!=="]"||!t.ctrlKey)&&t.key!=="Shift"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Meta"&&(function(n,o){return!!n.state.field(Qn)&&(o==="Tab"?Kh(n):Ji(n))})(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(Yh(e),t.stopPropagation(),t.preventDefault(),!0):(function(o){var l,c;let r=!1;const s=(l=o.state.selection.asSingle().ranges.at(0))==null?void 0:l.head,a=o.state.field(Qn);return!(s===void 0||!a)&&((c=a.decorations)==null||c.between(s,s,()=>{r=!0}),r)})(e)?Kh(e):Ji(e)}})}const E2=new cc,Ki=He.get("@github/copilot-language-server"),Xh={delay:300,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},_2=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push((function(n){return[Ns.of(n),Qn,Sn.highest($t.of([{key:"Ctrl-]",run:Yh}])),Sn.highest(Se.updateListener.of(o=>{o.focusChanged&&Ji(o.view)})),Sn.high(S2()),N2()]})({apiKey:t.codeium_api_key,language:Mn.PYTHON}),Ah.of({override:async()=>[{text:lc(""),language:Mn.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(_d({...Xh,fetchFn:async(n,o,r)=>{const s=n.selection.main.head;if(!mC()||!r.hasFocus||n.doc.length===0)return"";await new Promise(u=>setTimeout(u,20));const a=n.doc.toString(),l=(function(u,h){const m=u.doc.toString(),f=h.split(`
|
|
107
|
-
`).length-m.split(`
|
|
108
|
-
`).length,b=(function(x,p){const g=x.lineAt(p);return{line:g.number-1,character:p-g.from}})(u.doc,u.selection.main.head);return b.line+=f,{textDocument:{uri:`file://${fC}`,version:"replace_me"},position:b,context:{triggerKind:l4.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:u.tabSize,insertSpaces:!0}}})(n,lc(a)),c=await Y1().getCompletion(l);return s!==r.state.selection.main.head?(He.debug("ignoring response because of new position"),""):(function(u,h,m){if(!u)return Ki.debug("No response from copilot"),"";const f=Array.isArray(u)?u[0]:u.items[0];if(!f)return Ki.debug("No response from copilot"),"";const{insertText:b,range:x}=f,p=String(b);if(!x)return Ki.error("No range from copilot"),p;const g=x.start.character-h.character,y=g<0?p.slice(-g):p,w=m.doc.sliceString(m.selection.main.head,m.doc.length);for(let j=0;j<y.length;j++){const N=y.slice(j);if(w.startsWith(N))return y.slice(0,j)}return y})(c,l.position,n)}})),t.copilot==="custom"&&e.push(_d({...Xh,fetchFn:async(n,o,r)=>{const s=n.selection.main.head;if(n.doc.length===0||!r.hasFocus)return"";const a=n.doc.sliceString(0,n.selection.main.head),l=n.doc.sliceString(n.selection.main.head,n.doc.length);if(a.length===0)return"";const c=n.field(ma).type;let d=await i4.post("/ai/inline_completion",{prefix:a,suffix:l,language:c});return s!==r.state.selection.main.head?(He.debug("ignoring response because of new position"),""):(d=(function({response:u,prefix:h,suffix:m}){if(!u)return u;let f=u;return h&&f.startsWith(h)&&(f=f.slice(h.length)),m&&f.endsWith(m)&&(f=f.slice(0,-m.length)),f})({response:d,prefix:a,suffix:l}),d)}})),[...e,Sn.highest($t.of([{key:"Escape",run:n=>{const o=Ed(n);return!ua(n)&&o}}])),E2.of(hC())]};function I2(t){return[$t.of([{key:"Escape",preventDefault:!1,run:$0},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:d4},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:ru}]),c4(),K0,es,Y0]}const A2=Te.mark({class:"underline"}),Qh=tt.define(),Zh=tt.define(),em=tt.define(),T2=Dt.define({create:()=>Te.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(Qh)?n=t.update({add:[A2.range(o.value.from,o.value.to)]}):o.is(Zh)?n=t.update({add:[u4.range(o.value.from,o.value.to)]}):o.is(em)&&(n=Te.none);return n},provide:t=>Se.decorations.from(t)});class D2{constructor(e,n){this.view=void 0,this.commandClickMode=void 0,this.hoveredRange=void 0,this.onClick=void 0,this.keydown=o=>{o.key!=="Meta"&&o.key!=="Control"||(this.commandClickMode=!0,this.view.dom.addEventListener("mousemove",this.mousemove),this.view.dom.addEventListener("click",this.click))},this.keyup=o=>{o.key!=="Meta"&&o.key!=="Control"||this.exitCommandClickMode()},this.windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()},this.mousemove=o=>{if(!o.metaKey&&!o.ctrlKey)return void this.exitCommandClickMode();if(!this.commandClickMode)return void this.clearUnderline();const r=this.view.posAtCoords({x:o.clientX,y:o.clientY});if(r==null)return void this.clearUnderline();const s=this.view.state.field(h4,!1),a=s==null?void 0:s.ranges.find(c=>r>=c.from&&r<=c.to);if(a){const{from:c,to:d}=a;return this.hoveredRange&&this.hoveredRange.from===c&&this.hoveredRange.to===d?void 0:(this.clearUnderline(),this.hoveredRange={from:c,to:d,position:r},void this.view.dispatch({effects:Zh.of(this.hoveredRange)}))}const l=m4(this.view.state).cursorAt(r);if(l.name==="VariableName"){const{from:c,to:d}=l;if(this.hoveredRange&&this.hoveredRange.from===c&&this.hoveredRange.to===d)return;this.clearUnderline(),this.hoveredRange={from:c,to:d,position:r},this.view.dispatch({effects:Qh.of(this.hoveredRange)})}else this.clearUnderline()},this.click=o=>{if(this.hoveredRange){const r=this.view.state.doc.sliceString(this.hoveredRange.from,this.hoveredRange.to);o.preventDefault(),o.stopPropagation(),this.onClick(this.view,r),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}})}},this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=n,window.addEventListener("keydown",this.keydown),window.addEventListener("keyup",this.keyup),window.addEventListener("blur",this.windowBlur),window.addEventListener("mouseleave",this.windowBlur)}update(e){}destroy(){window.removeEventListener("keydown",this.keydown),window.removeEventListener("keyup",this.keyup),window.removeEventListener("blur",this.windowBlur),window.removeEventListener("mouseleave",this.windowBlur),this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click)}exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener("mousemove",this.mousemove),this.view.dom.removeEventListener("click",this.click),this.clearUnderline()}clearUnderline(){this.hoveredRange&&(this.view.dispatch({effects:em.of(null)}),this.hoveredRange=null)}}function M2(){return[Se.domEventHandlers({paste:(t,e)=>{var r;const n=(r=t.clipboardData)==null?void 0:r.getData("text/plain");if(!(n!=null&&n.includes("@app.cell")))return!1;const o=(function(s){if(!s.includes("@app.cell"))return[];const a=[],l=s.split(`
|
|
109
|
-
`);let c=[],d=!1,u=0,h=!1,m=!1,f=0;const b=/\(/g,x=/\)/g,p=new Set(["@"]);function g(w){return(w.match(b)||[]).length-(w.match(x)||[]).length}function y(){if(c.length!==0){for(;c.length>0&&c[c.length-1].trim().startsWith("return");)c.pop();c.some(w=>w.trim()!=="")&&a.push((function(w){const j=w.split(`
|
|
110
|
-
`);if(j.length===0)return"";const N=j.filter(_=>_.trim().length>0);if(N.length===0)return"";const C=/^\s*/,k=Math.min(...N.map(_=>{var E;return((E=_.match(C))==null?void 0:E[0].length)??Number.POSITIVE_INFINITY}));return k===0?w.trim():j.map(_=>_.slice(k)).join(`
|
|
111
|
-
`).trim()})(c.join(`
|
|
112
|
-
`))),c=[]}}for(const w of l){const j=w.trim();(j||d)&&(j.startsWith("@app.cell")?(y(),d=!0,u=1):u>0?(j.startsWith("def")&&j.includes("(")&&!j.includes("):")&&(h=!0,f=g(j)),u--):h?(f+=g(j),f===0&&(h=!1)):d&&(p.has(j[0])||j.startsWith("if __name__")?(y(),d=j.startsWith("@")):j.startsWith("return")?j.includes("(")&&!j.endsWith(")")&&(m=!0,f=g(j)):m?(f+=g(j),f===0&&(m=!1)):c.push(w)))}return y(),a})(n);return o.length===0?!1:(e.state.facet(b4).createManyBelow(o),!0)}})]}const it=({variant:t,settings:e,styles:n})=>{const o=Se.theme({"&":{backgroundColor:e.background,color:e.foreground},".cm-content":{caretColor:e.caret},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.caret},"&.cm-focused .cm-selectionBackgroundm .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-activeLine":{backgroundColor:e.lineHighlight},".cm-gutters":{backgroundColor:e.gutterBackground,color:e.gutterForeground},".cm-activeLineGutter":{backgroundColor:e.lineHighlight}},{dark:t==="dark"}),r=x4.define(n);return[o,h1(r)]};it({variant:"dark",settings:{background:"#200020",foreground:"#D0D0FF",caret:"#7070FF",selection:"#80000080",gutterBackground:"#200020",gutterForeground:"#C080C0",lineHighlight:"#80000040"},styles:[{tag:v.comment,color:"#404080"},{tag:[v.string,v.regexp],color:"#999999"},{tag:v.number,color:"#7090B0"},{tag:[v.bool,v.null],color:"#8080A0"},{tag:[v.punctuation,v.derefOperator],color:"#805080"},{tag:v.keyword,color:"#60B0FF"},{tag:v.definitionKeyword,color:"#B0FFF0"},{tag:v.moduleKeyword,color:"#60B0FF"},{tag:v.operator,color:"#A0A0FF"},{tag:[v.variableName,v.self],color:"#008080"},{tag:v.operatorKeyword,color:"#A0A0FF"},{tag:v.controlKeyword,color:"#80A0FF"},{tag:v.className,color:"#70E080"},{tag:[v.function(v.propertyName),v.propertyName],color:"#50A0A0"},{tag:v.tagName,color:"#009090"},{tag:v.modifier,color:"#B0FFF0"},{tag:[v.squareBracket,v.attributeName],color:"#D0D0FF"}]}),it({variant:"light",settings:{background:"#fcfcfc",foreground:"#5c6166",caret:"#ffaa33",selection:"#036dd626",gutterBackground:"#fcfcfc",gutterForeground:"#8a919966",lineHighlight:"#8a91991a"},styles:[{tag:v.comment,color:"#787b8099"},{tag:v.string,color:"#86b300"},{tag:v.regexp,color:"#4cbf99"},{tag:[v.number,v.bool,v.null],color:"#ffaa33"},{tag:v.variableName,color:"#5c6166"},{tag:[v.definitionKeyword,v.modifier],color:"#fa8d3e"},{tag:[v.keyword,v.special(v.brace)],color:"#fa8d3e"},{tag:v.operator,color:"#ed9366"},{tag:v.separator,color:"#5c6166b3"},{tag:v.punctuation,color:"#5c6166"},{tag:[v.definition(v.propertyName),v.function(v.variableName)],color:"#f2ae49"},{tag:[v.className,v.definition(v.typeName)],color:"#22a4e6"},{tag:[v.tagName,v.typeName,v.self,v.labelName],color:"#55b4d4"},{tag:v.angleBracket,color:"#55b4d480"},{tag:v.attributeName,color:"#f2ae49"}]}),it({variant:"dark",settings:{background:"#15191EFA",foreground:"#EEF2F7",caret:"#C4C4C4",selection:"#90B2D557",gutterBackground:"#15191EFA",gutterForeground:"#aaaaaa95",lineHighlight:"#57575712"},styles:[{tag:v.comment,color:"#6E6E6E"},{tag:[v.string,v.regexp,v.special(v.brace)],color:"#5C81B3"},{tag:v.number,color:"#C1E1B8"},{tag:v.bool,color:"#53667D"},{tag:[v.definitionKeyword,v.modifier,v.function(v.propertyName)],color:"#A3D295",fontWeight:"bold"},{tag:[v.keyword,v.moduleKeyword,v.operatorKeyword,v.operator],color:"#697A8E",fontWeight:"bold"},{tag:[v.variableName,v.attributeName],color:"#708E67"},{tag:[v.function(v.variableName),v.definition(v.propertyName),v.derefOperator],color:"#fff"},{tag:v.tagName,color:"#A3D295"}]}),it({variant:"dark",settings:{background:"#2e241d",foreground:"#BAAE9E",caret:"#A7A7A7",selection:"#DDF0FF33",gutterBackground:"#28211C",gutterForeground:"#BAAE9E90",lineHighlight:"#FFFFFF08"},styles:[{tag:v.comment,color:"#666666"},{tag:[v.string,v.special(v.brace)],color:"#54BE0D"},{tag:v.regexp,color:"#E9C062"},{tag:v.number,color:"#CF6A4C"},{tag:[v.keyword,v.operator],color:"#5EA6EA"},{tag:v.variableName,color:"#7587A6"},{tag:[v.definitionKeyword,v.modifier],color:"#F9EE98"},{tag:[v.propertyName,v.function(v.variableName)],color:"#937121"},{tag:[v.typeName,v.angleBracket,v.tagName],color:"#9B859D"}]}),it({variant:"dark",settings:{background:"#3b2627",foreground:"#E6E1C4",caret:"#E6E1C4",selection:"#16120E",gutterBackground:"#3b2627",gutterForeground:"#E6E1C490",lineHighlight:"#1F1611"},styles:[{tag:v.comment,color:"#6B4E32"},{tag:[v.keyword,v.operator,v.derefOperator],color:"#EF5D32"},{tag:v.className,color:"#EFAC32",fontWeight:"bold"},{tag:[v.typeName,v.propertyName,v.function(v.variableName),v.definition(v.variableName)],color:"#EFAC32"},{tag:v.definition(v.typeName),color:"#EFAC32",fontWeight:"bold"},{tag:v.labelName,color:"#EFAC32",fontWeight:"bold"},{tag:[v.number,v.bool],color:"#6C99BB"},{tag:[v.variableName,v.self],color:"#7DAF9C"},{tag:[v.string,v.special(v.brace),v.regexp],color:"#D9D762"},{tag:[v.angleBracket,v.tagName,v.attributeName],color:"#EFCB43"}]}),it({variant:"dark",settings:{background:"#000205",foreground:"#FFFFFF",caret:"#E60065",selection:"#E60C6559",gutterBackground:"#000205",gutterForeground:"#ffffff90",lineHighlight:"#4DD7FC1A"},styles:[{tag:v.comment,color:"#404040"},{tag:[v.string,v.special(v.brace),v.regexp],color:"#00D8FF"},{tag:v.number,color:"#E62286"},{tag:[v.variableName,v.attributeName,v.self],color:"#E62286",fontWeight:"bold"},{tag:v.function(v.variableName),color:"#fff",fontWeight:"bold"}]}),it({variant:"light",settings:{background:"#fff",foreground:"#000",caret:"#000",selection:"#BDD5FC",gutterBackground:"#fff",gutterForeground:"#00000070",lineHighlight:"#FFFBD1"},styles:[{tag:v.comment,color:"#BCC8BA"},{tag:[v.string,v.special(v.brace),v.regexp],color:"#5D90CD"},{tag:[v.number,v.bool,v.null],color:"#46A609"},{tag:v.keyword,color:"#AF956F"},{tag:[v.definitionKeyword,v.modifier],color:"#C52727"},{tag:[v.angleBracket,v.tagName,v.attributeName],color:"#606060"},{tag:v.self,color:"#000"}]}),it({variant:"dark",settings:{background:"#00254b",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#B36539BF",gutterBackground:"#00254b",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},styles:[{tag:v.comment,color:"#0088FF"},{tag:v.string,color:"#3AD900"},{tag:v.regexp,color:"#80FFC2"},{tag:[v.number,v.bool,v.null],color:"#FF628C"},{tag:[v.definitionKeyword,v.modifier],color:"#FFEE80"},{tag:v.variableName,color:"#CCCCCC"},{tag:v.self,color:"#FF80E1"},{tag:[v.className,v.definition(v.propertyName),v.function(v.variableName),v.definition(v.typeName),v.labelName],color:"#FFDD00"},{tag:[v.keyword,v.operator],color:"#FF9D00"},{tag:[v.propertyName,v.typeName],color:"#80FFBB"},{tag:v.special(v.brace),color:"#EDEF7D"},{tag:v.attributeName,color:"#9EFFFF"},{tag:v.derefOperator,color:"#fff"}]}),it({variant:"dark",settings:{background:"#060521",foreground:"#E0E0E0",caret:"#FFFFFFA6",selection:"#122BBB",gutterBackground:"#060521",gutterForeground:"#E0E0E090",lineHighlight:"#FFFFFF0F"},styles:[{tag:v.comment,color:"#AEAEAE"},{tag:[v.string,v.special(v.brace),v.regexp],color:"#8DFF8E"},{tag:[v.className,v.definition(v.propertyName),v.function(v.variableName),v.function(v.definition(v.variableName)),v.definition(v.typeName)],color:"#A3EBFF"},{tag:[v.number,v.bool,v.null],color:"#62E9BD"},{tag:[v.keyword,v.operator],color:"#2BF1DC"},{tag:[v.definitionKeyword,v.modifier],color:"#F8FBB1"},{tag:[v.variableName,v.self],color:"#B683CA"},{tag:[v.angleBracket,v.tagName,v.typeName,v.propertyName],color:"#60A4F1"},{tag:v.derefOperator,color:"#E0E0E0"},{tag:v.attributeName,color:"#7BACCA"}]}),it({variant:"dark",settings:{background:"#2d2f3f",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"#44475a",gutterBackground:"#282a36",gutterForeground:"rgb(144, 145, 148)",lineHighlight:"#44475a"},styles:[{tag:v.comment,color:"#6272a4"},{tag:[v.string,v.special(v.brace)],color:"#f1fa8c"},{tag:[v.number,v.self,v.bool,v.null],color:"#bd93f9"},{tag:[v.keyword,v.operator],color:"#ff79c6"},{tag:[v.definitionKeyword,v.typeName],color:"#8be9fd"},{tag:v.definition(v.typeName),color:"#f8f8f2"},{tag:[v.className,v.definition(v.propertyName),v.function(v.variableName),v.attributeName],color:"#50fa7b"}]}),it({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#80C7FF",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#C1E2F8"},styles:[{tag:v.comment,color:"#AAAAAA"},{tag:[v.keyword,v.operator,v.typeName,v.tagName,v.propertyName],color:"#2F6F9F",fontWeight:"bold"},{tag:[v.attributeName,v.definition(v.propertyName)],color:"#4F9FD0"},{tag:[v.className,v.string,v.special(v.brace)],color:"#CF4F5F"},{tag:v.number,color:"#CF4F5F",fontWeight:"bold"},{tag:v.variableName,fontWeight:"bold"}]}),it({variant:"light",settings:{background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#e1def3"},styles:[{tag:v.comment,color:"#9995b7"},{tag:v.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[v.definitionKeyword,v.modifier],color:"#ff5792"},{tag:[v.className,v.tagName,v.definition(v.typeName)],color:"#0094f0"},{tag:[v.number,v.bool,v.null,v.special(v.brace)],color:"#5842ff"},{tag:[v.definition(v.propertyName),v.function(v.variableName)],color:"#0095a8"},{tag:v.typeName,color:"#b3694d"},{tag:[v.propertyName,v.variableName],color:"#fa8900"},{tag:v.operator,color:"#ff5792"},{tag:v.self,color:"#e64100"},{tag:[v.string,v.regexp],color:"#00b368"},{tag:[v.paren,v.bracket],color:"#0431fa"},{tag:v.labelName,color:"#00bdd6"},{tag:v.attributeName,color:"#e64100"},{tag:v.angleBracket,color:"#9995b7"}]}),it({variant:"light",settings:{background:"#faf4ed",foreground:"#575279",caret:"#575279",selection:"#6e6a8614",gutterBackground:"#faf4ed",gutterForeground:"#57527970",lineHighlight:"#6e6a860d"},styles:[{tag:v.comment,color:"#9893a5"},{tag:[v.bool,v.null],color:"#286983"},{tag:v.number,color:"#d7827e"},{tag:v.className,color:"#d7827e"},{tag:[v.angleBracket,v.tagName,v.typeName],color:"#56949f"},{tag:v.attributeName,color:"#907aa9"},{tag:v.punctuation,color:"#797593"},{tag:[v.keyword,v.modifier],color:"#286983"},{tag:[v.string,v.regexp],color:"#ea9d34"},{tag:v.variableName,color:"#d7827e"}]}),it({variant:"light",settings:{background:"#FFFFFF",foreground:"#000000",caret:"#000000",selection:"#FFFD0054",gutterBackground:"#FFFFFF",gutterForeground:"#00000070",lineHighlight:"#00000008"},styles:[{tag:v.comment,color:"#CFCFCF"},{tag:[v.number,v.bool,v.null],color:"#E66C29"},{tag:[v.className,v.definition(v.propertyName),v.function(v.variableName),v.labelName,v.definition(v.typeName)],color:"#2EB43B"},{tag:v.keyword,color:"#D8B229"},{tag:v.operator,color:"#4EA44E",fontWeight:"bold"},{tag:[v.definitionKeyword,v.modifier],color:"#925A47"},{tag:v.string,color:"#704D3D"},{tag:v.typeName,color:"#2F8996"},{tag:[v.variableName,v.propertyName],color:"#77ACB0"},{tag:v.self,color:"#77ACB0",fontWeight:"bold"},{tag:v.regexp,color:"#E3965E"},{tag:[v.tagName,v.angleBracket],color:"#BAA827"},{tag:v.attributeName,color:"#B06520"},{tag:v.derefOperator,color:"#000"}]}),it({variant:"light",settings:{background:"#fef7e5",foreground:"#586E75",caret:"#000000",selection:"#073642",gutterBackground:"#fef7e5",gutterForeground:"#586E7580",lineHighlight:"#EEE8D5"},styles:[{tag:v.comment,color:"#93A1A1"},{tag:v.string,color:"#2AA198"},{tag:v.regexp,color:"#D30102"},{tag:v.number,color:"#D33682"},{tag:v.variableName,color:"#268BD2"},{tag:[v.keyword,v.operator,v.punctuation],color:"#859900"},{tag:[v.definitionKeyword,v.modifier],color:"#073642",fontWeight:"bold"},{tag:[v.className,v.self,v.definition(v.propertyName)],color:"#268BD2"},{tag:v.function(v.variableName),color:"#268BD2"},{tag:[v.bool,v.null],color:"#B58900"},{tag:v.tagName,color:"#268BD2",fontWeight:"bold"},{tag:v.angleBracket,color:"#93A1A1"},{tag:v.attributeName,color:"#93A1A1"},{tag:v.typeName,color:"#859900"}]}),it({variant:"light",settings:{background:"#FFFFFF",foreground:"#4D4D4C",caret:"#AEAFAD",selection:"#D6D6D6",gutterBackground:"#FFFFFF",gutterForeground:"#4D4D4C80",lineHighlight:"#EFEFEF"},styles:[{tag:v.comment,color:"#8E908C"},{tag:[v.variableName,v.self,v.propertyName,v.attributeName,v.regexp],color:"#C82829"},{tag:[v.number,v.bool,v.null],color:"#F5871F"},{tag:[v.className,v.typeName,v.definition(v.typeName)],color:"#C99E00"},{tag:[v.string,v.special(v.brace)],color:"#718C00"},{tag:v.operator,color:"#3E999F"},{tag:[v.definition(v.propertyName),v.function(v.variableName)],color:"#4271AE"},{tag:v.keyword,color:"#8959A8"},{tag:v.derefOperator,color:"#4D4D4C"}]});const O2=[it({variant:"dark",settings:{background:"var(--cm-background)",foreground:"#abb2bf",caret:"#528bff",selection:"#3E4451",lineHighlight:"#2c313c",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:v.comment,color:"#5c6370"},{tag:v.variableName,color:"#abb2bf"},{tag:[v.string,v.special(v.brace)],color:"#98c379"},{tag:v.number,color:"#d19a66"},{tag:v.bool,color:"#d19a66"},{tag:v.null,color:"#d19a66"},{tag:v.keyword,color:"#c678dd",fontWeight:500},{tag:v.className,color:"#61afef"},{tag:v.definition(v.typeName),color:"#61afef"},{tag:v.typeName,color:"#56b6c2"},{tag:v.angleBracket,color:"#abb2bf"},{tag:v.tagName,color:"#e06c75"},{tag:v.attributeName,color:"#d19a66"},{tag:v.operator,color:"#56b6c2",fontWeight:500},{tag:[v.function(v.variableName)],color:"#61afef"},{tag:[v.propertyName],color:"#e5c07b"}]}),Se.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#2a7aa5",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px",borderBottomColor:"#4a90a5"}})],R2=[it({variant:"light",settings:{background:"#ffffff",foreground:"#000000",caret:"#000000",selection:"#d7d4f0",lineHighlight:"#cceeff44",gutterBackground:"var(--color-background)",gutterForeground:"var(--gray-10)"},styles:[{tag:v.comment,color:"#708090"},{tag:v.variableName,color:"#000000"},{tag:[v.string,v.special(v.brace)],color:"#a11"},{tag:v.number,color:"#164"},{tag:v.bool,color:"#219"},{tag:v.null,color:"#219"},{tag:v.keyword,color:"#708",fontWeight:500},{tag:v.className,color:"#00f"},{tag:v.definition(v.typeName),color:"#00f"},{tag:v.typeName,color:"#085"},{tag:v.angleBracket,color:"#000000"},{tag:v.tagName,color:"#170"},{tag:v.attributeName,color:"#00c"},{tag:v.operator,color:"#a2f",fontWeight:500},{tag:[v.function(v.variableName)],color:"#00c"},{tag:[v.propertyName],color:"#05a"}]}),Se.theme({".mo-cm-reactive-reference":{fontWeight:"400",color:"#005f87",borderBottom:"2px solid #bad3de"},".mo-cm-reactive-reference-hover":{cursor:"pointer",borderBottomWidth:"3px"}})];function tm(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const L2=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:a,lspConfig:l,diagnosticsConfig:c,displayConfig:d}=t,u=tm(t);return[pC(n,o),[Se.domEventHandlers({drop:(m,f)=>{var p,g;const b=(p=m.dataTransfer)==null?void 0:p.files[0];if(b!=null&&b.type.startsWith("text/"))return m.preventDefault(),p4(f,b),!0;if(b!=null&&b.type.startsWith("image/"))return m.preventDefault(),g4(f,b),!0;const x=(g=m.dataTransfer)==null?void 0:g.getData("text/plain");if(x){m.preventDefault();const y=f.posAtCoords({x:m.clientX,y:m.clientY});return y!==null&&f.dispatch({changes:{from:y,to:y,insert:x},scrollIntoView:!0}),!0}return!1},dragover:m=>{m.preventDefault()}})],M2(),Mx(),y4({completionConfig:a,hotkeys:o,placeholderType:u,lspConfig:l,diagnosticsConfig:c}),v4({cellId:e,hotkeys:o,cellActions:s}),F2(t),[T2,(h=(m,f)=>{f4(m,f)},Wt.define(m=>new D2(m,h))),Se.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],c!=null&&c.enabled?w4():[],r&&Ys("inline_ai_tooltip")?[Pg({prompt:m=>(async function(f){var j,N;const b=`
|
|
113
|
-
${f.codeBefore}
|
|
114
|
-
<rewrite_this>
|
|
115
|
-
${f.selection}
|
|
116
|
-
</rewrite_this>
|
|
117
|
-
${f.codeAfter}
|
|
118
|
-
`.trim(),x=a1();await i1();const p=await fetch(x.getAiURL("completion").toString(),{method:"POST",headers:x.headers(),body:JSON.stringify({prompt:f.prompt,code:b,selectedText:f.selection,includeOtherCode:"",language:f.language})}),g=((j=f.selection.match(/^\s*/))==null?void 0:j[0])||"",y=(N=p.body)==null?void 0:N.getReader();if(!y)throw new Error("Failed to get response reader");let w="";for(;;){const{done:C,value:k}=await y.read();if(C)break;w+=new TextDecoder().decode(k)}return w.startsWith(g)||(w=g+w),w})({prompt:m.prompt,selection:m.selection,codeBefore:m.codeBefore,codeAfter:m.codeAfter,language:xp(m.editorView)})}),$a.of({hideOnBlur:!0})]:[],k4(Le),j4(e,d.reference_highlighting??!1)];var h},F2=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:a}=t,l=tm(t);return[Se.lineWrapping,C4(),N4(),S4(),E4(),_4(),I4(),A4(),T4({position:"fixed",parent:document.querySelector("#App")??void 0}),D4(),e==="dark"?O2:R2,M4(s),_2(o),O4(),R4(),Rx(),Sn.high($t.of(U4)),L4(),F4(),B4.of(" "),h1(W4,{fallback:!0}),$t.of($4),P4({placeholderType:l,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:a}}),z4.of(V4()),Dr.allowMultipleSelections.of(!0),I2(n),$t.of([{key:"Tab",run:c=>u1(c)||(d=>{const{from:u,to:h}=d.state.selection.main;if(u!==h)return!1;const m=d.state.doc.lineAt(h);return m.text.slice(0,h-m.from).trim()!==""&&J4(d)})(c)||G4(c),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:c=>Fo(c.state)!==null&&(ha(!0)(c),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:c=>Fo(c.state)!==null&&(ha(!1)(c),!0),preventDefault:!0}]),$t.of([...q4,H4])]},B2={width:void 0,height:void 0};function nm(t,e,n){return t[e]?Array.isArray(t[e])?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}const ur=t=>{const e=P.c(8),{children:n,layerTop:o}=t,r=o!==void 0&&o;let s;e[0]!==n?(s=me.Children.toArray(n),e[0]=n,e[1]=s):s=e[1];const[a,l]=s,c=`second-icon absolute ${r?"top-[-2px] left-[-2px]":"bottom-[-2px] right-[-2px]"} rounded-full`;let d,u;return e[2]!==l||e[3]!==c?(d=i.jsx("div",{className:c,children:l}),e[2]=l,e[3]=c,e[4]=d):d=e[4],e[5]!==a||e[6]!==d?(u=i.jsxs("div",{className:"multi-icon relative w-fit",children:[a,d]}),e[5]=a,e[6]=d,e[7]=u):u=e[7],u};let om,rm,sm,am;om=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),rm=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),sm=t=>{const e=P.c(79),{editing:n,status:o,disabled:r,staleInputs:s,edited:a,interrupted:l,elapsedTime:c,runStartTimestamp:d,lastRunStartTimestamp:u,uninstantiated:h}=t;if(!n)return null;const m=d??u;let f;e[0]!==m?(f=m?i.jsx(am,{lastRanTime:m}):null,e[0]=m,e[1]=f):f=e[1];const b=f;if(r&&o==="running")return He.error("CellStatusComponent: disabled and running"),null;if(r&&s){let x,p,g,y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("span",{children:"This cell is stale, but it's disabled and can't be run"}),e[2]=x):x=e[2],e[3]!==b?(p=i.jsxs("div",{className:"flex flex-col gap-1",children:[x,b]}),e[3]=b,e[4]=p):p=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:i.jsxs(ur,{children:[i.jsx(We,{className:"h-5 w-5",strokeWidth:1.5}),i.jsx(uc,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[5]=g):g=e[5],e[6]!==p?(y=i.jsx(pe,{content:p,usePortal:!0,children:g}),e[6]=p,e[7]=y):y=e[7],y}if(r){let x,p,g,y;return e[8]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("span",{children:"This cell is disabled"}),e[8]=x):x=e[8],e[9]!==b?(p=i.jsxs("div",{className:"flex flex-col gap-1",children:[x,b]}),e[9]=b,e[10]=p):p=e[10],e[11]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx("div",{className:"cell-status-icon cell-status-disabled","data-testid":"cell-status","data-status":"disabled",children:i.jsx(We,{className:"h-5 w-5",strokeWidth:1.5})}),e[11]=g):g=e[11],e[12]!==p?(y=i.jsx(pe,{content:p,usePortal:!0,children:g}),e[12]=p,e[13]=y):y=e[13],y}if(!s&&o==="disabled-transitively"){let x,p,g,y;return e[14]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("span",{children:"An ancestor of this cell is disabled, so it can't be run"}),e[14]=x):x=e[14],e[15]!==b?(p=i.jsxs("div",{className:"flex flex-col gap-1",children:[x,b]}),e[15]=b,e[16]=p):p=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"disabled-transitively",children:i.jsxs(ur,{layerTop:!0,children:[i.jsx(Fc,{className:"h-5 w-5",strokeWidth:1.5}),i.jsx(We,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[17]=g):g=e[17],e[18]!==p?(y=i.jsx(pe,{content:p,usePortal:!0,children:g}),e[18]=p,e[19]=y):y=e[19],y}if(s&&o==="disabled-transitively"){let x,p,g,y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("span",{children:"This cell is stale, but an ancestor is disabled so it can't be run"}),e[20]=x):x=e[20],e[21]!==b?(p=i.jsxs("div",{className:"flex flex-col gap-1",children:[x,b]}),e[21]=b,e[22]=p):p=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx("div",{className:"cell-status-icon cell-status-stale","data-testid":"cell-status","data-status":"stale",children:i.jsxs(ur,{children:[i.jsx(uc,{className:"h-5 w-5",strokeWidth:1}),i.jsx(We,{className:"h-3 w-3",strokeWidth:2.5})]})}),e[23]=g):g=e[23],e[24]!==p?(y=i.jsx(pe,{content:p,usePortal:!0,children:g}),e[24]=p,e[25]=y):y=e[25],y}if(o==="running"){let x,p,g,y,w;return e[26]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("span",{children:"This cell is running"}),e[26]=x):x=e[26],e[27]!==b?(p=i.jsxs("div",{className:"flex flex-col gap-1",children:[x,b]}),e[27]=b,e[28]=p):p=e[28],e[29]!==d?(g=dc.fromSeconds(d)||dc.now(),e[29]=d,e[30]=g):g=e[30],e[31]!==g?(y=i.jsx("div",{className:"cell-status-icon elapsed-time running","data-testid":"cell-status","data-status":"running",children:i.jsx(P2,{startTime:g})}),e[31]=g,e[32]=y):y=e[32],e[33]!==p||e[34]!==y?(w=i.jsx(pe,{content:p,usePortal:!0,children:y}),e[33]=p,e[34]=y,e[35]=w):w=e[35],w}if(o==="queued"){let x,p,g,y;return e[36]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("span",{children:"This cell is queued to run"}),e[36]=x):x=e[36],e[37]!==b?(p=i.jsxs("div",{className:"flex flex-col gap-1",children:[x,b]}),e[37]=b,e[38]=p):p=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx("div",{className:"cell-status-icon cell-status-queued","data-testid":"cell-status","data-status":"queued",children:i.jsx(Ca,{className:"h-5 w-5",strokeWidth:1.5})}),e[39]=g):g=e[39],e[40]!==p?(y=i.jsx(pe,{content:p,usePortal:!0,children:g}),e[40]=p,e[41]=y):y=e[41],y}if(a||l||s||h){let x;e[42]!==c?(x=Uo(c),e[42]=c,e[43]=x):x=e[43];const p=x;let g;e[44]!==c||e[45]!==p?(g=c?i.jsx(Sa,{elapsedTime:p}):null,e[44]=c,e[45]=p,e[46]=g):g=e[46];const y=g;let w,j,N,C,k,_="";if(h)w="This cell has not yet been run";else if(l){let E;w="This cell was interrupted when it was last run",e[47]!==y?(E=i.jsxs("span",{children:["This cell ran for ",y," before being interrupted"]}),e[47]=y,e[48]=E):E=e[48],_=E}else if(a){let E;w="This cell has been modified since it was last run",e[49]!==y?(E=i.jsxs("span",{children:["This cell took ",y," to run"]}),e[49]=y,e[50]=E):E=e[50],_=E}else{let E;w="This cell has not been run with the latest inputs",e[51]!==y?(E=i.jsxs("span",{children:["This cell took ",y," to run"]}),e[51]=y,e[52]=E):E=e[52],_=E}return e[53]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:i.jsx(uc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=j):j=e[53],e[54]!==w?(N=i.jsx(pe,{content:w,usePortal:!0,children:j}),e[54]=w,e[55]=N):N=e[55],e[56]!==c||e[57]!==p||e[58]!==b||e[59]!==_?(C=c&&i.jsx(pe,{content:i.jsxs("div",{className:"flex flex-col gap-1",children:[_,b]}),usePortal:!0,children:i.jsx("div",{className:"elapsed-time hover-action","data-testid":"cell-status","data-status":"outdated",children:i.jsx("span",{children:p})})}),e[56]=c,e[57]=p,e[58]=b,e[59]=_,e[60]=C):C=e[60],e[61]!==N||e[62]!==C?(k=i.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[N,C]}),e[61]=N,e[62]=C,e[63]=k):k=e[63],k}if(c!==null){let x;e[64]!==c?(x=Uo(c),e[64]=c,e[65]=x):x=e[65];const p=x;let g;e[66]!==c||e[67]!==p?(g=c?i.jsx(Sa,{elapsedTime:p}):null,e[66]=c,e[67]=p,e[68]=g):g=e[68];const y=g;let w,j,N,C;return e[69]!==y?(w=i.jsxs("span",{children:["This cell took ",y," to run"]}),e[69]=y,e[70]=w):w=e[70],e[71]!==b||e[72]!==w?(j=i.jsxs("div",{className:"flex flex-col gap-1",children:[w,b]}),e[71]=b,e[72]=w,e[73]=j):j=e[73],e[74]!==p?(N=i.jsx("div",{className:"cell-status-icon elapsed-time hover-action","data-testid":"cell-status","data-status":"idle",children:i.jsx("span",{children:p})}),e[74]=p,e[75]=N):N=e[75],e[76]!==j||e[77]!==N?(C=i.jsx(pe,{content:j,usePortal:!0,children:N}),e[76]=j,e[77]=N,e[78]=C):C=e[78],C}return null},Sa=t=>{const e=P.c(2);let n;return e[0]!==t.elapsedTime?(n=i.jsx("span",{className:"tracking-wide font-semibold",children:t.elapsedTime}),e[0]=t.elapsedTime,e[1]=n):n=e[1],n},am=t=>{const e=P.c(18),n=1e3*t.lastRanTime;let o,r,s,a,l,c,d,u,h;if(e[0]!==n){const m=new Date(n),f=new Date,b=m.toDateString()===f.toDateString()?om:rm;a="Ran at",l=" ",c=i.jsx("strong",{className:"tracking-wide font-semibold",children:b.format(m)}),d=" ",o="text-muted-foreground",r="(",s=kg(m),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=d}else o=e[1],r=e[2],s=e[3],a=e[4],l=e[5],c=e[6],d=e[7];return e[8]!==o||e[9]!==r||e[10]!==s?(u=i.jsxs("span",{className:o,children:[r,s," ago)"]}),e[8]=o,e[9]=r,e[10]=s,e[11]=u):u=e[11],e[12]!==a||e[13]!==l||e[14]!==c||e[15]!==d||e[16]!==u?(h=i.jsxs("span",{children:[a,l,c,d,u]}),e[12]=a,e[13]=l,e[14]=c,e[15]=d,e[16]=u,e[17]=h):h=e[17],h},Uo=function(t){if(t===null)return"";const e=t,n=e/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${e.toFixed(0).toString()}ms`};const P2=t=>{const e=P.c(6);let n;e[0]!==t.startTime?(n=t.startTime.toMilliseconds(),e[0]=t.startTime,e[1]=n):n=e[1];const o=(function(a){const l=S.useRef(a),[c,d]=S.useState(a);return S.useEffect(()=>{const u=setInterval(()=>{d(dc.now().toMilliseconds())},17);return()=>clearInterval(u)},[]),c-l.current})(n);let r,s;return e[2]!==o?(r=Uo(o),e[2]=o,e[3]=r):r=e[3],e[4]!==r?(s=i.jsx("span",{children:r}),e[4]=r,e[5]=s):s=e[5],s};var Yi="ContextMenu",[z2,WC]=X4(Yi,[m1]),yt=m1(),[U2,im]=z2(Yi),lm=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[a,l]=S.useState(!1),c=yt(e),d=d3(o),u=S.useCallback(h=>{l(h),d(h)},[d]);return i.jsx(U2,{scope:e,open:a,onOpenChange:u,modal:s,children:i.jsx(u3,{...c,dir:r,open:a,onOpenChange:u,modal:s,children:n})})};lm.displayName=Yi;var cm="ContextMenuTrigger",dm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=im(cm,n),a=yt(n),l=S.useRef({x:0,y:0}),c=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=S.useRef(0),u=S.useCallback(()=>window.clearTimeout(d.current),[]),h=m=>{l.current={x:m.clientX,y:m.clientY},s.onOpenChange(!0)};return S.useEffect(()=>u,[u]),S.useEffect(()=>{o&&u()},[o,u]),i.jsxs(i.Fragment,{children:[i.jsx(Q4,{...a,virtualRef:c}),i.jsx(Z4.span,{"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:o?t.onContextMenu:Mr(t.onContextMenu,m=>{u(),h(m),m.preventDefault()}),onPointerDown:o?t.onPointerDown:Mr(t.onPointerDown,Ts(m=>{u(),d.current=window.setTimeout(()=>h(m),700)})),onPointerMove:o?t.onPointerMove:Mr(t.onPointerMove,Ts(u)),onPointerCancel:o?t.onPointerCancel:Mr(t.onPointerCancel,Ts(u)),onPointerUp:o?t.onPointerUp:Mr(t.onPointerUp,Ts(u))})]})});dm.displayName=cm;var um=t=>{const{__scopeContextMenu:e,...n}=t,o=yt(e);return i.jsx(h3,{...o,...n})};um.displayName="ContextMenuPortal";var hm="ContextMenuContent",mm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=im(hm,n),s=yt(n),a=S.useRef(!1);return i.jsx(e3,{...s,...o,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=t.onCloseAutoFocus)==null||c.call(t,l),!l.defaultPrevented&&a.current&&l.preventDefault(),a.current=!1},onInteractOutside:l=>{var c;(c=t.onInteractOutside)==null||c.call(t,l),l.defaultPrevented||r.modal||(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});mm.displayName=hm,S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(t3,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var fm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(n3,{...r,...o,ref:e})});fm.displayName="ContextMenuLabel";var pm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(Y4,{...r,...o,ref:e})});pm.displayName="ContextMenuItem";var gm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(o3,{...r,...o,ref:e})});gm.displayName="ContextMenuCheckboxItem",S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(r3,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var bm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(s3,{...r,...o,ref:e})});bm.displayName="ContextMenuRadioItem";var xm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(a3,{...r,...o,ref:e})});xm.displayName="ContextMenuItemIndicator";var ym=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(K4,{...r,...o,ref:e})});ym.displayName="ContextMenuSeparator",S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(i3,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var vm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(l3,{...r,...o,ref:e})});vm.displayName="ContextMenuSubTrigger";var wm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(c3,{...r,...o,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function Ts(t){return e=>e.pointerType!=="mouse"?t(e):void 0}wm.displayName="ContextMenuSubContent";var km=mm,jm=fm,Cm=pm,Nm=gm,Sm=bm,Em=xm,_m=ym,Im=vm,Am=wm;const Tm=lm,Dm=dm,W2=f3(um);S.forwardRef((t,e)=>{const n=P.c(14);let o,r,s,a,l,c,d;return n[0]!==t?({className:r,inset:s,children:o,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==r||n[6]!==s?(l=p3({className:r,inset:s}),n[5]=r,n[6]=s,n[7]=l):l=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(x3,{className:"ml-auto h-4 w-4"}),n[8]=c):c=n[8],n[9]!==o||n[10]!==a||n[11]!==e||n[12]!==l?(d=i.jsxs(Im,{ref:e,className:l,...a,children:[o,c]}),n[9]=o,n[10]=a,n[11]=e,n[12]=l,n[13]=d):d=n[13],d}).displayName=Im.displayName;const Mm="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";S.forwardRef((t,e)=>{const n=P.c(9);let o,r,s,a;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=ue(p1({subcontent:!0}),Mm,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=i.jsx(Am,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a}).displayName=Am.displayName;const Xi=S.forwardRef((t,e)=>{const n=P.c(15);let o,r,s;n[0]!==t?({className:o,scrollable:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const a=s===void 0||s;let l;n[4]!==o||n[5]!==a?(l=ue(p1(),Mm,a&&"overflow-auto",o),n[4]=o,n[5]=a,n[6]=l):l=n[6];const c=a?"calc(var(--radix-context-menu-content-available-height) - 30px)":void 0;let d,u;return n[7]!==r.style||n[8]!==c?(d={...r.style,maxHeight:c},n[7]=r.style,n[8]=c,n[9]=d):d=n[9],n[10]!==r||n[11]!==e||n[12]!==l||n[13]!==d?(u=i.jsx(W2,{children:i.jsx(g3,{children:i.jsx(km,{ref:e,className:l,style:d,...r})})}),n[10]=r,n[11]=e,n[12]=l,n[13]=d,n[14]=u):u=n[14],u});Xi.displayName=km.displayName;const hr=S.forwardRef((t,e)=>{const n=P.c(13);let o,r,s,a,l,c;return n[0]!==t?({className:o,inset:r,variant:a,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==o||n[6]!==r||n[7]!==a?(l=f1({className:o,inset:r,variant:a}),n[5]=o,n[6]=r,n[7]=a,n[8]=l):l=n[8],n[9]!==s||n[10]!==e||n[11]!==l?(c=i.jsx(Cm,{ref:e,className:l,...s}),n[9]=s,n[10]=e,n[11]=l,n[12]=c):c=n[12],c});hr.displayName=Cm.displayName,S.forwardRef((t,e)=>{const n=P.c(15);let o,r,s,a,l,c,d,u;return n[0]!==t?({className:s,children:r,checked:o,...a}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a):(o=n[1],r=n[2],s=n[3],a=n[4]),n[5]!==s?(l=fa({className:s}),n[5]=s,n[6]=l):l=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(c=fa(),n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("span",{className:c,children:i.jsx(Em,{children:i.jsx(y3,{className:"h-4 w-4"})})}),n[8]=d):d=n[8],n[9]!==o||n[10]!==r||n[11]!==a||n[12]!==e||n[13]!==l?(u=i.jsxs(Nm,{ref:e,className:l,checked:o,...a,children:[d,r]}),n[9]=o,n[10]=r,n[11]=a,n[12]=e,n[13]=l,n[14]=u):u=n[14],u}).displayName=Nm.displayName,S.forwardRef((t,e)=>{const n=P.c(13);let o,r,s,a,l,c,d;return n[0]!==t?({className:r,children:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(a=fa({className:r}),n[4]=r,n[5]=a):a=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(l=fa(),n[6]=l):l=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx("span",{className:l,children:i.jsx(Em,{children:i.jsx(v3,{className:"h-4 w-4 fill-current"})})}),n[7]=c):c=n[7],n[8]!==o||n[9]!==s||n[10]!==e||n[11]!==a?(d=i.jsxs(Sm,{ref:e,className:a,...s,children:[c,o]}),n[8]=o,n[9]=s,n[10]=e,n[11]=a,n[12]=d):d=n[12],d}).displayName=Sm.displayName,S.forwardRef((t,e)=>{const n=P.c(11);let o,r,s,a,l;return n[0]!==t?({className:o,inset:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==o||n[5]!==r?(a=b3({className:o,inset:r}),n[4]=o,n[5]=r,n[6]=a):a=n[6],n[7]!==s||n[8]!==e||n[9]!==a?(l=i.jsx(jm,{ref:e,className:a,...s}),n[7]=s,n[8]=e,n[9]=a,n[10]=l):l=n[10],l}).displayName=jm.displayName;const Om=S.forwardRef((t,e)=>{const n=P.c(9);let o,r,s,a;return n[0]!==t?({className:o,...r}=t,n[0]=t,n[1]=o,n[2]=r):(o=n[1],r=n[2]),n[3]!==o?(s=ue(m3({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=i.jsx(_m,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a});Om.displayName=_m.displayName;const Rm=t=>{const e=P.c(20),{connectionState:n,onClick:o,tooltipContent:r}=t;let s;e[0]!==n||e[1]!==r?(s=ra(n)||r,e[0]=n,e[1]=r,e[2]=s):s=e[2];const a=s;let l;e[3]!==a||e[4]!==n?(l=en(n)?a:i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsx("div",{children:a}),i.jsx("div",{className:"text-xs text-muted-foreground font-medium pt-1 -mt-2 border-t border-border",children:"Right-click for cell types"})]}),e[3]=a,e[4]=n,e[5]=l):l=e[5];const c=l;let d,u,h,m,f,b;return e[6]!==o?(d=()=>o==null?void 0:o({code:""}),e[6]=o,e[7]=d):d=e[7],e[8]!==n?(u=ue("shoulder-button hover-action",en(n)&&" inactive-button"),e[8]=n,e[9]=u):u=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(hc,{strokeWidth:1.8}),e[10]=h):h=e[10],e[11]!==d||e[12]!==u?(m=i.jsx(tn,{onClick:d,className:u,onMouseDown:Fn.preventFocus,shape:"circle",size:"small",color:"hint-green","data-testid":"create-cell-button",children:h}),e[11]=d,e[12]=u,e[13]=m):m=e[13],e[14]!==c||e[15]!==m?(f=i.jsx(pe,{content:c,children:m}),e[14]=c,e[15]=m,e[16]=f):f=e[16],e[17]!==o||e[18]!==f?(b=i.jsx($2,{onClick:o,children:f}),e[17]=o,e[18]=f,e[19]=b):b=e[19],b},$2=t=>{const e=P.c(26),{children:n,onClick:o}=t,{createNewCell:r}=Ye();if(!o)return n;let s,a,l,c,d,u,h,m,f,b,x,p;return e[0]!==n?(s=i.jsx(Dm,{children:n}),e[0]=n,e[1]=s):s=e[1],e[2]!==o?(a=g=>{g.stopPropagation(),o({code:""})},e[2]=o,e[3]=a):a=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx("div",{className:"mr-3 text-muted-foreground",children:i.jsx(mc,{})}),e[4]=l):l=e[4],e[5]!==a?(c=i.jsxs(hr,{onSelect:a,children:[l,"Python cell"]},"python"),e[5]=a,e[6]=c):c=e[6],e[7]!==r||e[8]!==o?(d=g=>{g.stopPropagation(),Gn({autoInstantiate:!0,createNewCell:r}),o({code:new Xs().defaultCode,hideCode:!0})},e[7]=r,e[8]=o,e[9]=d):d=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx("div",{className:"mr-3 text-muted-foreground",children:i.jsx(ea,{})}),e[10]=u):u=e[10],e[11]!==d?(h=i.jsxs(hr,{onSelect:d,children:[u,"Markdown cell"]},"markdown"),e[11]=d,e[12]=h):h=e[12],e[13]!==r||e[14]!==o?(m=g=>{g.stopPropagation(),Gn({autoInstantiate:!0,createNewCell:r}),o({code:new fc().defaultCode})},e[13]=r,e[14]=o,e[15]=m):m=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx("div",{className:"mr-3 text-muted-foreground",children:i.jsx(_o,{size:13,strokeWidth:1.5})}),e[16]=f):f=e[16],e[17]!==m?(b=i.jsxs(hr,{onSelect:m,children:[f,"SQL cell"]},"sql"),e[17]=m,e[18]=b):b=e[18],e[19]!==c||e[20]!==h||e[21]!==b?(x=i.jsxs(Xi,{children:[c,h,b]}),e[19]=c,e[20]=h,e[21]=b,e[22]=x):x=e[22],e[23]!==s||e[24]!==x?(p=i.jsxs(Tm,{children:[s,x]}),e[23]=s,e[24]=x,e[25]=p):p=e[25],p};function Lm(t){return t!==w3&&!!(t&&t.trim().length>0)}function Fm(){const t=P.c(3),{splitCell:e,undoSplitCell:n}=Ye();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Zp(r.cellId);if(!s)return;const a=yp(s);e(r);const{dismiss:l}=ze({title:"Cell split",action:i.jsx(Fp,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{n({...r,snapshot:a}),c()},children:"Undo"})}),c=l},t[0]=e,t[1]=n,t[2]=o):o=t[2],Ce(o)}Da=function(t){const e=P.c(54),{cell:n,closePopover:o}=t,{createNewCell:r,updateCellConfig:s,updateCellName:a,moveCell:l,sendToTop:c,sendToBottom:d,addColumnBreakpoint:u,clearCellOutput:h}=Ye(),m=Fm(),f=Va(n==null?void 0:n.cellId),b=!ie(Qp),x=jr(),{openModal:p}=Pn(),g=Ct(er),y=ie(pc),w=ie(b1),j=ie(To),N=ie(k3),{saveCellConfig:C}=qe();if(!n||j){let H;return e[0]===Symbol.for("react.memo_cache_sentinel")?(H=[],e[0]=H):H=e[0],H}const{cellId:k,config:_,getEditorView:E,name:I,hasOutput:A,hasConsoleOutput:F,status:D}=n;let M;e[1]!==k||e[2]!==_.disabled||e[3]!==C||e[4]!==s?(M=async()=>{const H={disabled:!_.disabled};await C({configs:{[k]:H}}),s({cellId:k,config:H})},e[1]=k,e[2]=_.disabled,e[3]=C,e[4]=s,e[5]=M):M=e[5];const O=M;let R;e[6]!==k||e[7]!==_.hide_code||e[8]!==E||e[9]!==C||e[10]!==s?(R=async()=>{const H={hide_code:!_.hide_code};await C({configs:{[k]:H}}),s({cellId:k,config:H});const Y=E();Y&&(H.hide_code?Y.contentDOM.blur():Y.focus())},e[6]=k,e[7]=_.hide_code,e[8]=E,e[9]=C,e[10]=s,e[11]=R):R=e[11];const z=R;let T,L,$,W,G,X;return e[12]===Symbol.for("react.memo_cache_sentinel")?(T=i.jsx(yd,{size:13,strokeWidth:1.5}),e[12]=T):T=e[12],e[13]!==k||e[14]!==I||e[15]!==p||e[16]!==a?(L=()=>{p(i.jsxs(io,{children:[i.jsx(xr,{children:i.jsx(so,{children:"Rename cell"})}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Ao,{htmlFor:"cell-name",children:"Cell name"}),i.jsx(lg,{placeholder:"cell name",value:I,onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),H.stopPropagation(),p(null))},onChange:H=>a({cellId:k,name:H})})]})]}))},e[13]=k,e[14]=I,e[15]=p,e[16]=a,e[17]=L):L=e[17],e[18]!==k||e[19]!==a?($=H=>a({cellId:k,name:H}),e[18]=k,e[19]=a,e[20]=$):$=e[20],e[21]!==o?(W=()=>o==null?void 0:o(),e[21]=o,e[22]=W):W=e[22],e[23]!==I||e[24]!==$||e[25]!==W?(G=i.jsx(lg,{placeholder:"cell name",value:I,onChange:$,onEnterKey:W}),e[23]=I,e[24]=$,e[25]=W,e[26]=G):G=e[26],e[27]!==u||e[28]!==y||e[29]!==N||e[30]!==w||e[31]!==b||e[32]!==k||e[33]!==h||e[34]!==_.disabled||e[35]!==_.hide_code||e[36]!==r||e[37]!==x||e[38]!==E||e[39]!==F||e[40]!==A||e[41]!==l||e[42]!==I||e[43]!==f||e[44]!==d||e[45]!==c||e[46]!==g||e[47]!==m||e[48]!==D||e[49]!==L||e[50]!==G||e[51]!==O||e[52]!==z?(X=[[{icon:T,label:"Name",disableClick:!0,handle:H2,handleHeadless:L,rightElement:G},{icon:i.jsx(zo,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:D==="running"||D==="queued"||D==="disabled-transitively"||_.disabled,handle:()=>f()},{icon:i.jsx(Or,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!y,handle:()=>{g(H=>(H==null?void 0:H.cellId)===k?null:{cellId:k})},hotkey:"cell.aiCompletion"},{icon:i.jsx(Pa,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>m({cellId:k})},{icon:i.jsx(Sc,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!A,handle:()=>(function(H){const Y=document.getElementById(g1.create(H));Y&&(Y.classList.add("printing-output"),Rp(Y,"result.png").finally(()=>{Y.classList.remove("printing-output")}))})(k)},{icon:i.jsx(t1,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const H=E();H&&e1({[k]:H})}},{icon:_.hide_code?i.jsx(n1,{size:13,strokeWidth:1.5}):i.jsx(Vl,{size:13,strokeWidth:1.5}),label:_.hide_code?"Show code":"Hide code",handle:z,hotkey:"cell.hideCode"},{icon:_.disabled?i.jsx(Et,{size:13,strokeWidth:1.5}):i.jsx(_t,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:i.jsx(gc,{"data-testid":"cell-disable-switch",checked:!_.disabled,size:"sm",onCheckedChange:O}),handle:O},{icon:i.jsx(Ks,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(A||F),handle:()=>{h({cellId:k})}}],[{icon:i.jsx(ea,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const H=E();H&&(Gn({autoInstantiate:w,createNewCell:r}),co(H,{language:"markdown",keepCodeAsIs:!1}))}},{icon:i.jsx(_o,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const H=E();H&&(Gn({autoInstantiate:w,createNewCell:r}),co(H,{language:"sql",keepCodeAsIs:!1}))}},{icon:i.jsx(mc,{}),label:"Toggle as Python",handle:()=>{const H=E();H&&(Gn({autoInstantiate:w,createNewCell:r}),j3(H,"python",{force:!0}))}}],[{icon:i.jsxs(ur,{children:[i.jsx(Ur,{size:13,strokeWidth:1.5}),i.jsx(aa,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>r({cellId:k,before:!0})},{icon:i.jsxs(ur,{children:[i.jsx(Ur,{size:13,strokeWidth:1.5}),i.jsx($n,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>r({cellId:k,before:!1})},{icon:i.jsx(aa,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>l({cellId:k,before:!0})},{icon:i.jsx($n,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>l({cellId:k,before:!1})},{icon:i.jsx(x1,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>l({cellId:k,direction:"left"}),hidden:N!=="columns"},{icon:i.jsx(pa,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>l({cellId:k,direction:"right"}),hidden:N!=="columns"},{icon:i.jsx(Ma,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>c({cellId:k,scroll:!1})},{icon:i.jsx(gt,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>d({cellId:k,scroll:!1})},{icon:i.jsx(C3,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:N!=="columns",handle:()=>u({cellId:k})}],[{icon:i.jsx(J1,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Lm(I),tooltip:Lm(I)?void 0:"Only named cells can be linked to",handle:async()=>{await Eo((function(H){const Y=new URL(window.location.href);return Y.hash=`scrollTo=${encodeURIComponent(H)}`,Y.toString()})(I)),ze({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!b,variant:"danger",icon:i.jsx(tc,{size:13,strokeWidth:1.5}),handle:()=>{x({cellId:k})}}]].map(G2).filter(V2),e[27]=u,e[28]=y,e[29]=N,e[30]=w,e[31]=b,e[32]=k,e[33]=h,e[34]=_.disabled,e[35]=_.hide_code,e[36]=r,e[37]=x,e[38]=E,e[39]=F,e[40]=A,e[41]=l,e[42]=I,e[43]=f,e[44]=d,e[45]=c,e[46]=g,e[47]=m,e[48]=D,e[49]=L,e[50]=G,e[51]=O,e[52]=z,e[53]=X):X=e[53],X};function V2(t){return t.length>0}function G2(t){return t.filter(q2)}function q2(t){return!t.hidden}function H2(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}let Qi;Qi=me.memo(me.forwardRef((t,e)=>{const n=P.c(35);let o,r,s;n[0]!==t?({children:o,showTooltip:s,...r}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]);const a=s===void 0||s,[l,c]=S.useState(!1);let d;n[4]===Symbol.for("react.memo_cache_sentinel")?(d=()=>c(!1),n[4]=d):d=n[4];const u=d;let h;n[5]!==r?(h={cell:r,closePopover:u},n[5]=r,n[6]=h):h=n[6];const m=Da(h),f=S3();let b,x,p,g,y,w;if(n[7]===Symbol.for("react.memo_cache_sentinel")?(b=()=>({toggle:()=>c(J2)}),n[7]=b):b=n[7],S.useImperativeHandle(e,b),n[8]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(zp,{placeholder:"Search actions...",className:"h-6 m-1"}),n[8]=x):x=n[8],n[9]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Pp,{children:"No results"}),n[9]=p):p=n[9],n[10]!==m){let I;n[12]!==m.length?(I=(A,F)=>i.jsxs(S.Fragment,{children:[i.jsx(E3,{children:A.map(D=>{let M=i.jsxs("div",{className:"flex items-center flex-1",children:[D.icon&&i.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:D.icon}),i.jsx("div",{className:"flex-1",children:D.label}),i.jsxs("div",{className:"shrink-0 text-sm",children:[D.hotkey&&y1(D.hotkey),D.rightElement]})]});return D.tooltip&&(M=i.jsx(pe,{content:D.tooltip,delayDuration:100,children:M})),i.jsx(Kl,{className:ue(D.disabled&&"opacity-50!"),onSelect:()=>{D.disableClick||D.disabled||(D.handle(),c(!1))},variant:D.variant,children:M},D.label)})},F),F<m.length-1&&i.jsx(_3,{})]},F),n[12]=m.length,n[13]=I):I=n[13],g=m.map(I),n[10]=m,n[11]=g}else g=n[11];n[14]!==g?(y=i.jsxs(Up,{children:[x,i.jsxs(I3,{children:[p,g]})]}),n[14]=g,n[15]=y):y=n[15],n[16]!==f||n[17]!==y?(w=i.jsx(Yl,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...f,children:y}),n[16]=f,n[17]=y,n[18]=w):w=n[18];const j=w;if(!a){let I,A;return n[19]!==o?(I=i.jsx(bc,{asChild:!0,children:o}),n[19]=o,n[20]=I):I=n[20],n[21]!==j||n[22]!==l||n[23]!==I?(A=i.jsxs(na,{open:l,onOpenChange:c,children:[I,j]}),n[21]=j,n[22]=l,n[23]=I,n[24]=A):A=n[24],A}let N;n[25]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(A3,{tabIndex:-1,children:St("cell.cellActions")}),n[25]=N):N=n[25];const C=!l&&N;let k,_,E;return n[26]!==o?(k=i.jsx(T3,{children:i.jsx(bc,{className:"flex",children:o})}),n[26]=o,n[27]=k):k=n[27],n[28]!==C||n[29]!==k?(_=i.jsxs(D3,{delayDuration:200,disableHoverableContent:!0,children:[C,k]}),n[28]=C,n[29]=k,n[30]=_):_=n[30],n[31]!==j||n[32]!==l||n[33]!==_?(E=i.jsxs(na,{open:l,onOpenChange:c,children:[_,j]}),n[31]=j,n[32]=l,n[33]=_,n[34]=E):E=n[34],E})),Wc=me.memo(t=>{const e=P.c(5),{children:n,cellId:o}=t;let r;e[0]!==o?(r=N3(o),e[0]=o,e[1]=r):r=e[1];const s=ie(r);if(!s)return null;let a;return e[2]!==n||e[3]!==s?(a=i.jsx(Qi,{showTooltip:!1,...s,children:n}),e[2]=n,e[3]=s,e[4]=a):a=e[4],a});function J2(t){return!t}Wc.displayName="ConnectionCellActionsDropdown";const Bm=t=>{const e=P.c(35),{children:n,cellId:o,getEditorView:r}=t,s=Rr(o),a=Lr(o),l=!xc(a.output),c=a.consoleOutputs.length>0;let d;e[0]!==s.config||e[1]!==s.name||e[2]!==o||e[3]!==a.status||e[4]!==r||e[5]!==l||e[6]!==c?(d={cell:{cellId:o,name:s.name,config:s.config,status:a.status,hasOutput:l,hasConsoleOutput:c,getEditorView:r}},e[0]=s.config,e[1]=s.name,e[2]=o,e[3]=a.status,e[4]=r,e[5]=l,e[6]=c,e[7]=d):d=e[7];const u=Da(d),[h,m]=me.useState(),f=!!h;let b,x,p,g,y,w,j,N,C,k;if(e[8]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(gp,{size:13,strokeWidth:1.5}),e[8]=b):b=e[8],e[9]!==o?(x=async()=>{var I;if((I=window.getSelection())==null?void 0:I.toString())return void document.execCommand("copy");const E=document.getElementById(g1.create(o));E?await Eo(E.textContent??""):He.warn("cell-context-menu: output not found")},e[9]=o,e[10]=x):x=e[10],e[11]!==u||e[12]!==n||e[13]!==r||e[14]!==h||e[15]!==f||e[16]!==x){const _=[[{label:"Copy",hidden:f,icon:b,handle:x},{label:"Cut",hidden:!!h,icon:i.jsx(Pa,{size:13,strokeWidth:1.5}),handle:K2},{label:"Paste",hidden:!!h,icon:i.jsx(zc,{size:13,strokeWidth:1.5}),handle:async()=>{const I=r();if(I)try{const A=await navigator.clipboard.readText();if(A){const{from:F,to:D}=I.state.selection.main,M=I.state.update({changes:{from:F,to:D,insert:A}});I.dispatch(M)}}catch(A){const F=A;He.error("Failed to paste from clipboard",F),M3({command:"paste"})}}},{label:"Copy image",hidden:!h,icon:i.jsx(Oa,{size:13,strokeWidth:1.5}),handle:async()=>{if(h){const I=await fetch(h.src),A=await I.blob(),F=new ClipboardItem({[A.type]:A});await navigator.clipboard.write([F]).then(Y2).catch(X2)}}},{icon:i.jsx(Sc,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!h,handle:()=>{if(h){const I=document.createElement("a");I.download="image.png",I.href=h.src,I.click()}}},{label:"Go to Definition",icon:i.jsx(R3,{size:13,strokeWidth:1.5}),handle:()=>{const I=r();I&&O3(I)}}],...u];let E;g=Tm,e[23]===Symbol.for("react.memo_cache_sentinel")?(E=I=>{I.target instanceof HTMLImageElement?m(I.target):m(void 0)},e[23]=E):E=e[23],e[24]!==n?(y=i.jsx(Dm,{onContextMenu:E,asChild:!0,children:n}),e[24]=n,e[25]=y):y=e[25],p=Xi,w="w-[300px]",j=!0,N=_.map((I,A)=>i.jsxs(S.Fragment,{children:[I.map(Z2),A<_.length-1&&i.jsx(Om,{})]},A)),e[11]=u,e[12]=n,e[13]=r,e[14]=h,e[15]=f,e[16]=x,e[17]=p,e[18]=g,e[19]=y,e[20]=w,e[21]=j,e[22]=N}else p=e[17],g=e[18],y=e[19],w=e[20],j=e[21],N=e[22];return e[26]!==p||e[27]!==w||e[28]!==j||e[29]!==N?(C=i.jsx(p,{className:w,scrollable:j,children:N}),e[26]=p,e[27]=w,e[28]=j,e[29]=N,e[30]=C):C=e[30],e[31]!==g||e[32]!==y||e[33]!==C?(k=i.jsxs(g,{children:[y,C]}),e[31]=g,e[32]=y,e[33]=C,e[34]=k):k=e[34],k};function K2(){document.execCommand("cut")}function Y2(){ze({title:"Copied image to clipboard"})}function X2(t){ze({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),He.error("Failed to copy image to clipboard",t)}function Q2(t){t.stopPropagation()}function Z2(t){if(t.hidden)return null;let e=i.jsxs("div",{className:"flex items-center flex-1",children:[t.icon&&i.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),i.jsx("div",{className:"flex-1",children:t.label}),i.jsxs("div",{className:"shrink-0 text-sm",children:[t.hotkey&&y1(t.hotkey),t.rightElement]})]});return t.tooltip&&(e=i.jsx(pe,{delayDuration:100,content:t.tooltip,children:e})),i.jsx(S.Fragment,{children:t.disableClick?i.jsx("div",{className:f1({className:t.disabled?"opacity-50!":"",variant:t.variant}),onKeyDown:Q2,children:e}):i.jsx(hr,{className:t.disabled?"opacity-50!":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e})},t.label)}if(ug)hg(BC),ug();else if(!("Bun"in globalThis)){const t=await mt(()=>import("./loro_wasm_bg-C1ks32Vm.js").then(async e=>(await e.__tla,e)).then(e=>e.w),[],import.meta.url);hg(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":FC}).exports)}const ey=["Map","Text","List","Tree","MovableList","Counter"];function Pm(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&ey.includes(t.kind())}mg.prototype.toJsonWithReplacer=function(t){const e=new Set,n=this,o=(a,l)=>{if(typeof l=="string"&&l.startsWith("cid:")&&!e.has(l)){e.add(l);const d=n.getContainerById(l);if(d==null)throw new Error(`ContainerID not found: ${l}`);const u=t(a,d);if(u===d){const h=d.getShallowValue();return typeof h=="object"?r(h):h}if(Pm(u))throw new Error("Using new container is not allowed in toJsonWithReplacer");return typeof u=="object"&&u!=null?r(u):u}if(typeof l=="object"&&l!=null)return r(l);const c=t(a,l);if(Pm(c))throw new Error("Using new container is not allowed in toJsonWithReplacer");return c},r=a=>{if(Array.isArray(a))return a.map((c,d)=>o(d,c)).filter(c=>c!==void 0);const l={};for(const[c,d]of Object.entries(a)){const u=o(c,d);u!==void 0&&(l[c]=u)}return l},s=n.getShallowValue();return r(s)};const ty=Se.baseTheme({".loro-cursor":{position:"absolute",width:"2px",display:"inline-block",height:"1.2em"},".loro-cursor::before":{position:"absolute",top:"1.3em",left:"0",content:"var(--rtc-name)",padding:"2px 6px",fontSize:"12px",borderRadius:"3px",whiteSpace:"nowrap",userSelect:"none",backgroundColor:"inherit",opacity:"0.7"},".loro-selection":{opacity:"0.5"}}),mr=tt.define(),Zi=Dt.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(mr))switch(n.value.type){case"update":{const{peer:o,user:r,cursor:s}=n.value;t.remoteCursors.set(o,{uid:o,cursor:s,user:r});break}case"delete":t.remoteCursors.delete(n.value.peer);break;case"checkout":t.isCheckout=n.value.checkout}return t}}),zm=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(mr));return t.docChanged||t.viewportChanged||e.length>0};class Ds{constructor(e,n,o,r,s){this.left=e,this.top=n,this.height=o,this.name=r,this.colorClassName=s}draw(){const e=document.createElement("div");return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty("--rtc-name",`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(e,n,o,r){const s=Ds.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const a=e.scrollDOM.getBoundingClientRect(),l=(e.textDirection===F3.LTR?a.left:a.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,c=a.top-e.scrollDOM.scrollTop;return[new Ds(s.left-l,s.top-c,s.bottom-s.top,o,r)]}static calculateAbsoluteCursorPosition(e,n){const o=Math.max(0,Math.min(n.state.doc.length,e.anchor));return n.coordsAtPos(o,e.assoc||1)}}const ny=(t,e,n,o)=>{const r=[],{updated:s,added:a}=n;for(const l of[...s,...a]){const c=Um(t,e,l,o);c&&r.push(c)}return r},Um=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return mr.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=fg.decode(r.cursor.anchor),a=t.getCursorPos(s).offset;let l=a;if(r.cursor.head){const c=fg.decode(r.cursor.head);l=t.getCursorPos(c).offset}return mr.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:a,head:l},user:r.user})};class oy{constructor(e,n,o,r,s,a,l){this.view=e,this.doc=n,this.user=o,this.awareness=r,this.getTextFromDoc=s,this.scopeId=a,this.getUserId=l,this.sub=void 0,this.sub=this.doc.subscribe(c=>{if(c.by==="local"){const d=[];for(const u of this.awareness.peers()){const h=Um(this.doc,this.awareness,u,this.scopeId);h&&d.push(h)}this.view.dispatch({effects:d})}else c.by==="checkout"&&this.view.dispatch({effects:[mr.of({type:"checkout",checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;const n=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){const o=sy({doc:this.doc,getTextFromDoc:this.getTextFromDoc,anchor:n.anchor,head:n.head});this.awareness.setLocalState({type:"update",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:o,user:this.user})}else this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){var e;(e=this.sub)==null||e.call(this),this.awareness.setLocalState({type:"delete",uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}}class ry{constructor(e,n,o,r){this.view=e,this.doc=n,this.awareness=o,this.scopeId=r,this._awarenessListener=void 0;const s=async(a,l)=>{l!=="local"&&this.view.dispatch({effects:ny(this.doc,this.awareness,a,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const sy=({doc:t,getTextFromDoc:e,anchor:n,head:o})=>{var a,l;n===o&&(o=void 0);const r=(a=e(t).getCursor(n))==null?void 0:a.encode();if(!r)throw new Error("cursor head not found");let s;return o!==void 0&&(s=(l=e(t).getCursor(o))==null?void 0:l.encode()),{anchor:r,head:s}},Ms=["bg-(--amber-6)","bg-(--blue-6)","bg-(--crimson-6)","bg-(--cyan-6)","bg-(--grass-6)","bg-(--gray-6)","bg-(--green-6)","bg-(--lime-6)","bg-(--orange-6)","bg-(--purple-6)","bg-(--red-6)","bg-(--sage-6)","bg-(--sky-6)","bg-(--slate-6)"],ay=(t,e,n)=>Wt.define(o=>new iy(o,t,e,n)),xo=ic.define();class iy{constructor(e,n,o,r){this.view=e,this.doc=n,this.docPath=o,this.getTextFromDoc=r,this.sub=void 0,this.isInitDispatch=!1,this.onRemoteUpdate=s=>{if(s.by!=="local")if(s.by!=="checkout"){if(s.by==="import"){const a=[];let l=0;for(const{diff:c,path:d}of s.events){if(d.join("/")!==this.docPath.join("/")||c.type!=="text")continue;const u=c.diff;for(const h of u)h.insert?a.push({from:l,to:l,insert:h.insert}):h.delete?(a.push({from:l,to:l+h.delete}),l+=h.delete):h.retain!=null&&(l+=h.retain);a.length>0&&this.view.dispatch({changes:a,annotations:[xo.of(this)]})}}}else this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[xo.of(this)]})},this.sub=n.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;const s=this.view.state.doc.toString(),a=this.getTextFromDoc(this.doc);s!==a.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:a.toString()}]})})}update(e){if(this.isInitDispatch)return void(this.isInitDispatch=!1);if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(xo)===this||e.transactions[0].annotation(xo)==="undo"))return;let n=0;e.changes.iterChanges((o,r,s,a,l)=>{const c=l.sliceString(0,l.length,`
|
|
119
|
-
`);o!==r&&this.getTextFromDoc(this.doc).delete(o+n,r-o),c.length>0&&this.getTextFromDoc(this.doc).insert(o+n,c),n+=c.length-(r-o)}),this.doc.commit()}destroy(){var e;(e=this.sub)==null||e.call(this),this.sub=void 0}}const vt=He.get("rtc"),Wm=vt.get("awareness").disabled(),el="awareness:",yo=Bt(void 0),lt=new mg,Os=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new PC(t,e),this.peer=t,this.timeout=e}apply(t,e="remote"){const{updated:n,added:o}=this.inner.apply(t);this.listeners.forEach(r=>{r({updated:n,added:o,removed:[]},e)}),this.startTimerIfNotEmpty()}setLocalState(t){const e=this.inner.getState(this.peer)==null;this.inner.setLocalState(t),e?this.listeners.forEach(n=>{n({updated:[],added:[this.inner.peer()],removed:[]},"local")}):this.listeners.forEach(n=>{n({updated:[this.inner.peer()],added:[],removed:[]},"local")}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(t){return this.inner.encode(t)}encodeAll(){return this.inner.encodeAll()}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{const t=this.inner.removeOutdated();t.length>0&&this.listeners.forEach(e=>{e({updated:[],added:[],removed:t},"timeout")}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}}(lt.peerIdStr),tl=P3(()=>{vt.debug("creating websocket");const t=a1().getWsSyncURL(j1()).toString(),e=new kC(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await i1(),z3()==="edit"&&e.reconnect()}),e.addEventListener("message",async n=>{const o=n.data,r=await o.arrayBuffer(),s=new Uint8Array(r);if((function(a,l){return new TextDecoder().decode(a.slice(0,l.length))===l})(s,el)){const a=(function(l,c){return l.slice(c.length)})(s,el);return Os.apply(a),void Wm.debug("applied awareness update")}lt.import(s),vt.debug("imported doc change. new doc:",lt.toJSON()),Le.get(yo)!==lt&&Le.set(yo,lt)}),e.addEventListener("open",()=>{vt.debug("websocket open")}),e.addEventListener("close",n=>{vt.warn("websocket close",n),Le.get(yo)===lt&&Le.set(yo,void 0)}),e});function nl(t,e,n=""){if(Qt())return{extension:[],code:n};const o=lt.getByPath(`codes/${t}`)!==void 0,r=lt.getMap("codes").getOrCreateContainer(t,new _c);o||(vt.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return Le.get(C1)||"Anonymous"},get colorClassName(){return(a=>{if(typeof a=="string"){let l=0;for(let c=0;c<a.length;c++)l=(l<<5)-l+a.charCodeAt(c),l=Math.trunc(l);return Ms[Math.abs(l)%Ms.length]}return Ms[a%Ms.length]})(this.name)}};return{code:n.toString(),extension:[ly(t),cy(t),dy(lt,Os,s,()=>r,t),ay(lt,["codes",t],()=>r)]}}function ly(t){const e=(o,r)=>{const s=o.state.field(ma).type,a=r.toString();a&&a!==s&&(vt.debug(`[incoming] setting language type: ${s} -> ${a}`),co(o,{language:a,keepCodeAsIs:!0}))},n=(o,r)=>{const s=o.state.field(vc),a=r.toJSON();kr(s,a)||o.dispatch({effects:[w1.of(a)],annotations:[xo.of(!0)]})};return Wt.define(o=>{let r;return Promise.resolve().then(()=>{const s=lt.getByPath(`languages/${t}`);if(!s)return void vt.error("no language container found for cell",t);Zt(s instanceof _c,"language type is not a LoroText");const a=lt.getByPath(`language_metadata/${t}`);a?(Zt(a instanceof pg,"language metadata is not a LoroMap"),e(o,s),n(o,a),r=lt.subscribe(l=>{if(l.origin==="local")return;const c=l.events.some(u=>u.target===s.id),d=l.events.some(u=>u.target===a.id);c&&e(o,s),d&&n(o,a)})):vt.error("no language metadata container found for cell",t)}),{destroy(){r()}}})}function cy(t){const e=lt.getMap("languages").getOrCreateContainer(t,new _c),n=lt.getMap("language_metadata").getOrCreateContainer(t,new pg);return Se.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const a=yc(o.state).type;co(o.view,{language:a}),vt.debug("no initial language, setting default to",a),e.delete(0,e.length),e.insert(0,a),vt.debug("no initial language metadata, setting default to",o.state.field(vc));const l=o.state.field(vc);for(const c of Object.keys(l))n.set(c,l[c]);return void lt.commit()}let s=!1;for(const a of o.transactions)if(!a.annotation(xo)){for(const l of a.effects)if(l.is(B3)&&e.toString()!==l.value.type&&(vt.debug(`[outgoing] language change: ${e} -> ${l.value.type}`),e.delete(0,e.length),e.insert(0,l.value.type),s=!0),l.is(w1)||l.is(k1)){const c=l.value;l.is(k1)?(vt.debug("[outgoing] setting language metadata: ",c),n.clear()):vt.debug("[outgoing] updating language metadata: ",c);for(const d of Object.keys(c))n.set(d,c[d]);s=!0}}s&<.commit()})}function dy(t,e,n,o,r,s){const a=`loro:cell:${r}`;return[Zi,v1({above:!0,class:"loro-cursor-layer",update:zm,markers:l=>{const{remoteCursors:c,isCheckout:d}=l.state.field(Zi);return d?[]:[...c.values()].flatMap(u=>{var m,f;const h=Yt.cursor(u.cursor.anchor);return Ds.createCursor(l,h,((m=u.user)==null?void 0:m.name)||"unknown",((f=u.user)==null?void 0:f.colorClassName)||"")})}}),v1({above:!1,class:"loro-selection-layer",update:zm,markers:l=>{const{remoteCursors:c,isCheckout:d}=l.state.field(Zi);return d?[]:[...c.entries()].filter(([,u])=>u.cursor.head!==void 0&&u.cursor.anchor!==u.cursor.head).flatMap(([,u])=>{var m;const h=Yt.range(u.cursor.anchor,u.cursor.head);return L3.forRange(l,`loro-selection ${((m=u.user)==null?void 0:m.colorClassName)||""}`,h)})}}),Wt.define(l=>new oy(l,t,n,e,o,a,s)),Wt.define(l=>new ry(l,t,e,a)),ty]}function Rs(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}ga()&&tl(),lt.subscribeLocalUpdates(t=>{vt.debug("local update, sending to server"),tl().send(t)}),Os.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Wm.debug("awareness changes",n),tl().send((function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])})(el,Os.encode(n))))});var $m={modified:{doc:""},original:{doc:""}},Vm=S.createContext($m);function uy(t,e){return Je({},t,e,{modified:Je({},t.modified,e.modified),original:Je({},t.original,e.original)})}var ol=()=>S.useContext(Vm),hy=t=>{var{children:e,theme:n}=t,[o,r]=S.useReducer(uy,Je({},$m,{theme:n}));return S.useEffect(()=>r({theme:n}),[n]),i.jsx(Vm.Provider,{value:Je({},o,{dispatch:r}),children:e})},my=["extensions","value","selection","onChange"],Gm=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Fr(t,my),{theme:a,dispatch:l}=ol(),c=Bo(Je({},s,{theme:a}));return S.useEffect(()=>l({original:{doc:n,selection:o,extensions:[...c,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Gm.displayName="CodeMirrorMerge.Original";var fy=["extensions","value","selection","onChange"],qm=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Fr(t,fy),{theme:a,dispatch:l}=ol(),c=Bo(Je({},s,{theme:a}));return S.useEffect(()=>{l({modified:{doc:n,selection:o,extensions:[...c,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};qm.displayName="CodeMirrorMerge.Modified";class Ze{constructor(e,n,o,r){this.fromA=e,this.toA=n,this.fromB=o,this.toB=r}offset(e,n=e){return new Ze(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function Zn(t,e,n,o,r,s){if(t==o)return[];let a=il(t,e,n,o,r,s),l=ll(t,e+a,n,o,r+a,s),c=(n-=l)-(e+=a),d=(s-=l)-(r+=a);if(!c||!d)return[new Ze(e,n,r,s)];if(c>d){let h=t.slice(e,n).indexOf(o.slice(r,s));if(h>-1)return[new Ze(e,e+h,r,r),new Ze(e+h+d,n,s,s)]}else if(d>c){let h=o.slice(r,s).indexOf(t.slice(e,n));if(h>-1)return[new Ze(e,e,r,r+h),new Ze(n,n,r+h+c,s)]}if(c==1||d==1)return[new Ze(e,n,r,s)];let u=Km(t,e,n,o,r,s);if(u){let[h,m,f]=u;return Zn(t,e,h,o,r,m).concat(Zn(t,h+f,n,o,m+f,s))}return(function(h,m,f,b,x,p){let g=f-m,y=p-x;if(fr<1e9&&Math.min(g,y)>16*fr||pr>0&&Date.now()>pr)return Math.min(g,y)>64*fr?[new Ze(m,f,x,p)]:Ym(h,m,f,b,x,p);let w=Math.ceil((g+y)/2);sl.reset(w),al.reset(w);let j=(_,E)=>h.charCodeAt(m+_)==b.charCodeAt(x+E),N=(_,E)=>h.charCodeAt(f-_-1)==b.charCodeAt(p-E-1),C=(g-y)%2!=0?al:null,k=C?null:sl;for(let _=0;_<w;_++){if(_>fr||pr>0&&!(63&_)&&Date.now()>pr)return Ym(h,m,f,b,x,p);let E=sl.advance(_,g,y,w,C,!1,j)||al.advance(_,g,y,w,k,!0,N);if(E)return py(h,m,f,m+E[0],b,x,p,x+E[1])}return[new Ze(m,f,x,p)]})(t,e,n,o,r,s)}let fr=1e9,pr=0,rl=!1;class Hm{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,o,r,s,a,l){for(let c=-e+this.start;c<=e-this.end;c+=2){let d=r+c,u=c==-e||c!=e&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,h=u-c;for(;u<n&&h<o&&l(u,h);)u++,h++;if(this.vec[d]=u,u>n)this.end+=2;else if(h>o)this.start+=2;else if(s){let m=r+(n-o)-c;if(m>=0&&m<this.len&&s.vec[m]!=-1){if(a){let f=s.vec[m];if(f>=n-u)return[f,r+f-m]}else if(u>=n-s.vec[m])return[u,h]}}}return null}}const sl=new Hm,al=new Hm;function py(t,e,n,o,r,s,a,l){let c=!1;return vo(t,o)||++o!=n||(c=!0),vo(r,l)||++l!=a||(c=!0),c?[new Ze(e,n,s,a)]:Zn(t,e,o,r,s,l).concat(Zn(t,o,n,r,l,a))}function Jm(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function il(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let a=Jm(n-e,s-r);for(let l=e,c=r;;){let d=l+a,u=c+a;if(d>n||u>s||t.slice(l,d)!=o.slice(c,u)){if(a==1)return l-e-(vo(t,l)?0:1);a>>=1}else{if(d==n||u==s)return d-e;l=d,c=u}}}function ll(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let a=Jm(n-e,s-r);for(let l=n,c=s;;){let d=l-a,u=c-a;if(d<e||u<r||t.slice(d,l)!=o.slice(u,c)){if(a==1)return n-l-(vo(t,l)?0:1);a>>=1}else{if(d==e||u==r)return n-d;l=d,c=u}}}function cl(t,e,n,o,r,s,a,l){let c=o.slice(r,s),d=null;for(;;){if(d||a<l)return d;for(let u=e+a;;){vo(t,u)||u++;let h=u+a;if(vo(t,h)||(h+=h==u+1?1:-1),h>=n)break;let m=t.slice(u,h),f=-1;for(;(f=c.indexOf(m,f+1))!=-1;){let b=il(t,h,n,o,r+f+m.length,s),x=ll(t,e,u,o,r,r+f),p=m.length+b+x;(!d||d[2]<p)&&(d=[u-x,r+f-x,p])}u=h}if(l<0)return d;a>>=1}}function Km(t,e,n,o,r,s){let a=n-e,l=s-r;if(a<l){let c=Km(o,r,s,t,e,n);return c&&[c[1],c[0],c[2]]}return a<4||2*l<a?null:cl(t,e,n,o,r,s,Math.floor(a/4),-1)}function Ym(t,e,n,o,r,s){rl=!0;let a,l=n-e,c=s-r;if(l<c){let m=cl(o,r,s,t,e,n,Math.floor(l/6),50);a=m&&[m[1],m[0],m[2]]}else a=cl(t,e,n,o,r,s,Math.floor(c/6),50);if(!a)return[new Ze(e,n,r,s)];let[d,u,h]=a;return Zn(t,e,d,o,r,u).concat(Zn(t,d+h,n,o,u+h,s))}function Xm(t,e){for(let n=1;n<t.length;n++){let o=t[n-1],r=t[n];o.toA>r.fromA-e&&o.toB>r.fromB-e&&(t[n-1]=new Ze(o.fromA,r.toA,o.fromB,r.toB),t.splice(n--,1))}}let eo;try{eo=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Qm(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function Zm(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Qm(n)?1:0:eo?af(n)&&e!=t.length-1?eo.test(t.slice(e,e+2))?2:0:eo.test(String.fromCharCode(n))?1:0:0}function ef(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Qm(n)?1:0:eo?lf(n)&&e!=1?eo.test(t.slice(e-2,e))?2:0:eo.test(String.fromCharCode(n))?1:0:0}const tf=8;function nf(t,e,n){if(e==t.length||!ef(t,e))return e;for(let o=e,r=e+n,s=0;s<tf;s++){let a=Zm(t,o);if(!a||o+a>r)return o;o+=a}return e}function of(t,e,n){if(!e||!Zm(t,e))return e;for(let o=e,r=e-n,s=0;s<tf;s++){let a=ef(t,o);if(!a||o-a<r)return o;o-=a}return e}function rf(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function sf(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const af=t=>t>=55296&&t<=56319,lf=t=>t>=56320&&t<=57343;function vo(t,e){return!e||e==t.length||!af(t.charCodeAt(e-1))||!lf(t.charCodeAt(e))}function gy(t,e,n){var o;return fr=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,pr=n!=null&&n.timeout?Date.now()+n.timeout:0,rl=!1,(function(r,s,a){for(;;){Xm(a,1);let l=!1;for(let c=0;c<a.length;c++){let d,u,h=a[c];(d=il(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=a[c]=new Ze(h.fromA+d,h.toA,h.fromB+d,h.toB)),(u=ll(r,h.fromA,h.toA,s,h.fromB,h.toB))&&(h=a[c]=new Ze(h.fromA,h.toA-u,h.fromB,h.toB-u));let m=h.toA-h.fromA,f=h.toB-h.fromB;if(m&&f)continue;let b=h.fromA-(c?a[c-1].toA:0),x=(c<a.length-1?a[c+1].fromA:r.length)-h.toA;if(!b||!x)continue;let p=m?r.slice(h.fromA,h.toA):s.slice(h.fromB,h.toB);b<=p.length&&r.slice(h.fromA-b,h.fromA)==p.slice(p.length-b)?(a[c]=new Ze(h.fromA-b,h.toA-b,h.fromB-b,h.toB-b),l=!0):x<=p.length&&r.slice(h.toA,h.toA+x)==p.slice(0,x)&&(a[c]=new Ze(h.fromA+x,h.toA+x,h.fromB+x,h.toB+x),l=!0)}if(!l)break}return a})(t,e,Zn(t,0,t.length,e,0,e.length))}function cf(){return!rl}function df(t,e,n){return(function(o,r,s){for(let a=0,l=0;l<o.length;l++){let c=o[l],d=c.toA-c.fromA,u=c.toB-c.fromB;if(d&&u||d>3||u>3){let h=l==o.length-1?r.length:o[l+1].fromA,m=c.fromA-a,f=h-c.toA,b=of(r,c.fromA,m),x=nf(r,c.toA,f),p=c.fromA-b,g=x-c.toA;if((!d||!u)&&p&&g){let y=Math.max(d,u),[w,j,N]=d?[r,c.fromA,c.toA]:[s,c.fromB,c.toB];y>p&&r.slice(b,c.fromA)==w.slice(N-p,N)?(c=o[l]=new Ze(b,b+d,c.fromB-p,c.toB-p),b=c.fromA,x=nf(r,c.toA,h-c.toA)):y>g&&r.slice(c.toA,x)==w.slice(j,j+g)&&(c=o[l]=new Ze(x-d,x,c.fromB+g,c.toB+g),x=c.toA,b=of(r,c.fromA,c.fromA-a)),p=c.fromA-b,g=x-c.toA}if(p||g)c=o[l]=new Ze(c.fromA-p,c.toA+g,c.fromB-p,c.toB+g);else if(d){if(!u){let y,w=sf(r,c.fromA,c.toA),j=w<0?-1:rf(r,c.toA,c.fromA);w>-1&&(y=w-c.fromA)<=f&&r.slice(c.fromA,w)==r.slice(c.toA,c.toA+y)?c=o[l]=c.offset(y):j>-1&&(y=c.toA-j)<=m&&r.slice(c.fromA-y,c.fromA)==r.slice(j,c.toA)&&(c=o[l]=c.offset(-y))}}else{let y,w=sf(s,c.fromB,c.toB),j=w<0?-1:rf(s,c.toB,c.fromB);w>-1&&(y=w-c.fromB)<=f&&s.slice(c.fromB,w)==s.slice(c.toB,c.toB+y)?c=o[l]=c.offset(y):j>-1&&(y=c.toB-j)<=m&&s.slice(c.fromB-y,c.fromB)==s.slice(j,c.toB)&&(c=o[l]=c.offset(-y))}}a=c.toA}return Xm(o,3),o})(gy(t,e,n),t,e)}const Ht=ro.define({combine:t=>t[0]}),dl=tt.define(),by=ro.define(),wo=Dt.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(dl)&&(t=n.value);for(let n of e.state.facet(by))t=n(t,e);return t}});class ko{constructor(e,n,o,r,s,a=!0){this.changes=e,this.fromA=n,this.toA=o,this.fromB=r,this.toB=s,this.precise=a}offset(e,n){return e||n?new ko(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,o){return mf(df(e.toString(),n.toString(),o),e,n,0,0,cf())}static updateA(e,n,o,r,s){return gf(pf(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return gf(pf(e,r,!1,n.length),e,n,o,s)}}function uf(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.to==t&&s.to==e&&t<n.length&&e<o.length?[t+1,e+1]:[r.from,s.from]}function hf(t,e,n,o){let r=n.lineAt(t),s=o.lineAt(e);return r.from==t&&s.from==e?[t,e]:[r.to+1,s.to+1]}function mf(t,e,n,o,r,s){let a=[];for(let l=0;l<t.length;l++){let c=t[l],[d,u]=uf(c.fromA+o,c.fromB+r,e,n),[h,m]=hf(c.toA+o,c.toB+r,e,n),f=[c.offset(-d+o,-u+r)];for(;l<t.length-1;){let b=t[l+1],[x,p]=uf(b.fromA+o,b.fromB+r,e,n);if(x>h+1&&p>m+1)break;f.push(b.offset(-d+o,-u+r)),[h,m]=hf(b.toA+o,b.toB+r,e,n),l++}a.push(new ko(f,d,Math.max(d,h),u,Math.max(u,m),s))}return a}const Ls=1e3;function ff(t,e,n,o){let r=0,s=t.length;for(;;){if(r==s){let u=0,h=0;r&&({toA:u,toB:h}=t[r-1]);let m=e-(n?u:h);return[u+m,h+m]}let a=r+s>>1,l=t[a],[c,d]=n?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>e)s=a;else{if(!(d<=e))return o?[l.fromA,l.fromB]:[l.toA,l.toB];r=a+1}}}function pf(t,e,n,o){let r=[];return e.iterChangedRanges((s,a,l,c)=>{let d=0,u=n?e.length:o,h=0,m=n?o:e.length;s>Ls&&([d,h]=ff(t,s-Ls,n,!0)),a<e.length-Ls&&([u,m]=ff(t,a+Ls,n,!1));let f,b=c-l-(a-s),[x,p]=n?[b,0]:[0,b];r.length&&(f=r[r.length-1]).toA>=d?r[r.length-1]={fromA:f.fromA,fromB:f.fromB,toA:u,toB:m,diffA:f.diffA+x,diffB:f.diffB+p}:r.push({fromA:d,toA:u,fromB:h,toB:m,diffA:x,diffB:p})}),r}function gf(t,e,n,o,r){if(!t.length)return e;let s=[];for(let a=0,l=0,c=0,d=0;;a++){let u=a==t.length?null:t[a],h=u?u.fromA+l:n.length,m=u?u.fromB+c:o.length;for(;d<e.length;){let p=e[d];if(p.toA+l>h||p.toB+c>m)break;s.push(p.offset(l,c)),d++}if(!u)break;let f=u.toA+l+u.diffA,b=u.toB+c+u.diffB,x=df(n.sliceString(h,f),o.sliceString(m,b),r);for(let p of mf(x,n,o,h,m,cf()))s.push(p);for(l+=u.diffA,c+=u.diffB;d<e.length;){let p=e[d];if(p.fromA+l>f&&p.fromB+c>b)break;d++}}return s}const xy={scanLimit:500},bf=Wt.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=vf(t))}update(t){var e,n;(t.docChanged||t.viewportChanged||(e=t.startState,n=t.state,e.field(wo,!1)!=n.field(wo,!1))||(function(o,r){return o.facet(Ht)!=r.facet(Ht)})(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=vf(t.view))}},{decorations:t=>t.deco}),Fs=Sn.low(W3({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(bf))===null||e===void 0?void 0:e.gutter)||$3.empty}})),xf=Te.line({class:"cm-changedLine"}),yy=Te.mark({class:"cm-changedText"}),vy=Te.mark({tagName:"ins",class:"cm-insertedLine"}),wy=Te.mark({tagName:"del",class:"cm-deletedLine"}),yf=new class extends V3{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function ky(t,e,n,o,r,s){let a=n?t.fromA:t.fromB,l=n?t.toA:t.toB,c=0;if(a!=l){r.add(a,a,xf),r.add(a,l,n?wy:vy),s&&s.add(a,a,yf);for(let d=e.iterRange(a,l-1),u=a;!d.next().done;){if(d.lineBreak){u++,r.add(u,u,xf),s&&s.add(u,u,yf);continue}let h=u+d.value.length;if(o)for(;c<t.changes.length;){let m=t.changes[c],f=a+(n?m.fromA:m.fromB),b=a+(n?m.toA:m.toB),x=Math.max(u,f),p=Math.min(h,b);if(x<p&&r.add(x,p,yy),!(b<h))break;c++}u=h}}}function vf(t){let e=t.state.field(wo),{side:n,highlightChanges:o,markGutter:r,overrideChunk:s}=t.state.facet(Ht),a=n=="a",l=new Mo,c=r?new Mo:null,{from:d,to:u}=t.viewport;for(let h of e){if((a?h.fromA:h.fromB)>=u)break;(a?h.toA:h.toB)>d&&(s&&s(t.state,h,l,c)||ky(h,t.state.doc,a,o,l,c))}return{deco:l.finish(),gutter:c&&c.finish()}}class Bs extends So{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const Ps=tt.define({map:(t,e)=>t.map(e)}),gr=Dt.define({create:()=>Te.none,update:(t,e)=>{for(let n of e.effects)if(n.is(Ps))return n.value;return t.map(e.changes)},provide:t=>Se.decorations.from(t)}),ul=.01;function wf(t,e){if(t.size!=e.size)return!1;let n=t.iter(),o=e.iter();for(;n.value;){if(n.from!=o.from||Math.abs(n.value.spec.widget.height-o.value.spec.widget.height)>1)return!1;n.next(),o.next()}return!0}const hl=tt.define({map:(t,e)=>e.mapPos(t)});class jy extends So{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",o=>{let r=e.posAtDOM(o.target);e.dispatch({effects:hl.of(r)});let{side:s,sibling:a}=e.state.facet(Ht);a&&a().dispatch({effects:hl.of(Cy(r,e.state.field(wo),s=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Cy(t,e,n){let o=0,r=0;for(let s=0;;s++){let a=s<e.length?e[s]:null;if(!a||(n?a.fromA:a.fromB)>=t)return r+(t-o);[o,r]=n?[a.toA,a.toB]:[a.toB,a.toA]}}const Ny=Dt.define({create:t=>Te.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(hl)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>Se.decorations.from(t)});function kf({margin:t=3,minSize:e=4}){return Ny.init(n=>(function(o,r,s){let a=new Mo,l=o.facet(Ht).side=="a",c=o.field(wo),d=1;for(let u=0;;u++){let h=u<c.length?c[u]:null,m=u?d+r:1,f=h?o.doc.lineAt(l?h.fromA:h.fromB).number-1-r:o.doc.lines,b=f-m+1;if(b>=s&&a.add(o.doc.line(m).from,o.doc.line(f).to,Te.replace({widget:new jy(b),block:!0})),!h)break;d=o.doc.lineAt(Math.min(o.doc.length,l?h.toA:h.toB)).number}return a.finish()})(n,t,e))}const Sy=Se.styleModule.of(new U3({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),Ey=Se.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),jf=new cc,zs=new cc;class Cf{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||xy;let n=[Sn.low(bf),Ey,Sy,gr,Se.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(m=>m.effects.some(f=>f.is(Ps)))&&this.measure()})],o=[Ht.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(Fs);let r=Dr.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Se.editorAttributes.of({class:"cm-merge-a"}),zs.of(o),n]}),s=[Ht.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(Fs);let a=Dr.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Se.editorAttributes.of({class:"cm-merge-b"}),zs.of(s),n]});this.chunks=ko.build(r.doc,a.doc,this.diffConf);let l=[wo.init(()=>this.chunks),jf.of(e.collapseUnchanged?kf(e.collapseUnchanged):[])];r=r.update({effects:tt.appendConfig.of(l)}).state,a=a.update({effects:tt.appendConfig.of(l)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let c=e.orientation||"a-b",d=document.createElement("div");d.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(c=="a-b"?d:u),this.editorDOM.appendChild(c=="a-b"?u:d),this.a=new Se({state:r,parent:d,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new Se({state:a,parent:u,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(o=>o.docChanged)){let o=e[e.length-1],r=e.reduce((a,l)=>a.compose(l.changes),Ar.empty(e[0].startState.doc.length));this.chunks=n==this.a?ko.updateA(this.chunks,o.newDoc,this.b.state.doc,r,this.diffConf):ko.updateB(this.chunks,this.a.state.doc,o.newDoc,r,this.diffConf),n.update([...e,o.state.update({effects:dl.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:dl.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let a=this.a.dom.parentNode,l=this.b.dom.parentNode;a.remove(),l.remove(),this.editorDOM.insertBefore(s?a:l,this.editorDOM.firstChild),this.editorDOM.appendChild(s?l:a),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,a=this.revertToA,l=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,a=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(l=e.renderRevertControl),this.setupRevertControls(s,a,l)}let n="highlightChanges"in e,o="gutter"in e,r="collapseUnchanged"in e;if(n||o||r){let s=[],a=[];if(n||o){let l=this.a.state.facet(Ht),c=o?e.gutter!==!1:l.markGutter,d=n?e.highlightChanges!==!1:l.highlightChanges;s.push(zs.reconfigure([Ht.of({side:"a",sibling:()=>this.b,highlightChanges:d,markGutter:c}),c?Fs:[]])),a.push(zs.reconfigure([Ht.of({side:"b",sibling:()=>this.a,highlightChanges:d,markGutter:c}),c?Fs:[]]))}if(r){let l=jf.reconfigure(e.collapseUnchanged?kf(e.collapseUnchanged):[]);s.push(l),a.push(l)}this.a.dispatch({effects:s}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,n,o){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=o,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",r=>this.revertClicked(r)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){(function(e,n,o){let r=new Mo,s=new Mo,a=e.state.field(gr).iter(),l=n.state.field(gr).iter(),c=0,d=0,u=0,h=0,m=e.viewport,f=n.viewport;for(let g=0;;g++){let y=g<o.length?o[g]:null,w=y?y.fromA:e.state.doc.length,j=y?y.fromB:n.state.doc.length;if(c<w){let N=e.lineBlockAt(c).top+u-(n.lineBlockAt(d).top+h);N<-.01?(u-=N,r.add(c,c,Te.widget({widget:new Bs(-N),block:!0,side:-1}))):N>ul&&(h+=N,s.add(d,d,Te.widget({widget:new Bs(N),block:!0,side:-1})))}if(w>c+1e3&&c<m.from&&w>m.from&&d<f.from&&j>f.from){let N=Math.min(m.from-c,f.from-d);c+=N,d+=N,g--}else{if(!y)break;c=y.toA,d=y.toB}for(;a.value&&a.from<c;)u-=a.value.spec.widget.height,a.next();for(;l.value&&l.from<d;)h-=l.value.spec.widget.height,l.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;l.value;)h-=l.value.spec.widget.height,l.next();let b=e.contentHeight+u-(n.contentHeight+h);b<ul?r.add(e.state.doc.length,e.state.doc.length,Te.widget({widget:new Bs(-b),block:!0,side:1})):b>ul&&s.add(n.state.doc.length,n.state.doc.length,Te.widget({widget:new Bs(b),block:!0,side:1}));let x=r.finish(),p=s.finish();wf(x,e.state.field(gr))||e.dispatch({effects:Ps.of(x)}),wf(p,n.state.field(gr))||n.dispatch({effects:Ps.of(p)})})(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,o=this.a.viewport,r=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let a=this.chunks[s];if(a.fromA>o.to||a.fromB>r.to)break;if(a.fromA<o.from||a.fromB<r.from)continue;let l=this.a.lineBlockAt(a.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=Nf(n);n&&n.dataset.chunk==String(s)?(n.style.top!=l&&(n.style.top=l),n=n.nextSibling):e.insertBefore(this.renderRevertButton(l,s),n)}for(;n;)n=Nf(n)}renderRevertButton(e,n){let o;if(this.renderRevert)o=this.renderRevert();else{o=document.createElement("button");let r=this.a.state.phrase("Revert this chunk");o.setAttribute("aria-label",r),o.setAttribute("title",r),o.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return o.style.top=e,o.setAttribute("data-chunk",String(n)),o}revertClicked(e){let n,o=e.target;for(;o&&o.parentNode!=this.revertDOM;)o=o.parentNode;if(o&&(n=this.chunks[o.dataset.chunk])){let[r,s,a,l,c,d]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],u=r.state.sliceDoc(a,Math.max(a,l-1));a!=l&&d<=s.state.doc.length&&(u+=r.state.lineBreak),s.dispatch({changes:{from:c,to:Math.min(s.state.doc.length,d),insert:u},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Nf(t){let e=t.nextSibling;return t.remove(),e}var _y=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig","root"],Iy=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],Sf=me.forwardRef((t,e)=>{var{className:n,children:o,orientation:r,revertControls:s,highlightChanges:a,gutter:l,collapseUnchanged:c,destroyRerender:d=!0,renderRevertControl:u,diffConfig:h,root:m}=t,f=Fr(t,_y),b=ol(),{modified:x,modifiedExtension:p,original:g,originalExtension:y,theme:w,dispatch:j}=b,N=Fr(b,Iy),C=S.useRef(null),k=S.useRef(),_={orientation:r,revertControls:s,highlightChanges:a,gutter:l,collapseUnchanged:c,renderRevertControl:u,diffConfig:h,root:m};S.useImperativeHandle(e,()=>({container:C.current,view:k.current,modified:x,original:g,config:Je({a:g,b:x,parent:C.current},_)}),[C,k,x,g,_]);var E=Se.updateListener.of(A=>{if(A.docChanged&&typeof(y==null?void 0:y.onChange)=="function"){var F=A.state.doc.toString();y==null||y.onChange(F,A)}}),I=Se.updateListener.of(A=>{if(A.docChanged&&typeof(p==null?void 0:p.onChange)=="function"){var F=A.state.doc.toString();p==null||p.onChange(F,A)}});return S.useEffect(()=>{!k.current&&C.current&&y&&p&&(k.current=new Cf(Je({a:Je({},g,{extensions:[...(y==null?void 0:y.extension)||[],...Bo(Je({},y==null?void 0:y.option,{theme:w})),E]}),b:Je({},x,{extensions:[...(p==null?void 0:p.extension)||[],...Bo(Je({},p==null?void 0:p.option,{theme:w})),I]}),parent:C.current},_)),j({view:k.current}))},[k,C,y,p]),S.useEffect(()=>{if(g&&g.doc&&k.current){var A,F,D=(A=k.current)==null?void 0:A.a.state.doc.toString();D!==g.doc&&((F=k.current)==null||F.a.dispatch({changes:{from:0,to:D.length,insert:g.doc||""}}))}if(x&&x.doc&&k.current){var M,O,R=(M=k.current)==null?void 0:M.b.state.doc.toString();R!==x.doc&&((O=k.current)==null||O.b.dispatch({changes:{from:0,to:R.length,insert:x.doc||""}}))}if(d&&k.current){var z=k.current.a.state.selection.ranges[0].from,T=k.current.b.state.selection.ranges[0].from;k.current.destroy(),k.current=new Cf(Je({a:Je({},g,{extensions:[...(y==null?void 0:y.extension)||[],...Bo(Je({},y==null?void 0:y.option,{theme:w}))]}),b:Je({},x,{extensions:[...(p==null?void 0:p.extension)||[],...Bo(Je({},p==null?void 0:p.option,{theme:w}))]}),parent:C.current},_)),z&&(k.current.a.focus(),k.current.a.dispatch({selection:{anchor:z,head:z}})),T&&(k.current.b.focus(),k.current.b.dispatch({selection:{anchor:T,head:T}}))}},[k,w,C.current,g,x,y,p,d]),S.useEffect(()=>()=>k.current&&k.current.destroy(),[]),S.useEffect(()=>{if(k.current){var A={};N.orientation!==r&&(A.orientation=r),N.revertControls!==s&&(A.revertControls=s),N.highlightChanges!==a&&(A.highlightChanges=a),N.gutter!==l&&(A.gutter=l),N.collapseUnchanged!==c&&(A.collapseUnchanged=c),N.renderRevertControl!==u&&(A.collapseUnchanged=c),Object.keys(A).length&&j&&k.current&&(k.current.reconfigure(Je({},A)),j(Je({},A)))}},[j,k,r,s,a,l,c,u]),i.jsx("div",Je({ref:C,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});Sf.displayName="CodeMirrorMerge.Internal";var Ay=["theme"],jo=me.forwardRef((t,e)=>{var{theme:n}=t,o=Fr(t,Ay);return i.jsx(hy,{theme:n,children:i.jsx(Sf,Je({},o,{ref:e}))})});jo.Original=Gm,jo.Modified=qm,jo.displayName="CodeMirrorMerge";const Ty=jo.Original,Dy=jo.Modified,Ef=[nj(),Se.lineWrapping],My=t=>{const e=P.c(28),{className:n,onChange:o,initialPrompt:r,currentLanguageAdapter:s,currentCode:a,declineChange:l,acceptChange:c,enabled:d,children:u}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={},e[0]=h):h=e[0];const[m,f]=S.useState(h),[b,x]=_n(Tx),p=S.useId(),g=N1(),{completion:y,input:w,stop:j,isLoading:N,setCompletion:C,setInput:k,handleSubmit:_}=G3({api:g.getAiURL("completion").toString(),headers:g.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...m,includeOtherCode:b?lc(a):"",code:a,language:s},onError:Oy,onFinish:(q,U)=>{E(U.trimEnd())}}),E=C,I=me.useRef(null),A=y.trimEnd();let F,D,M,O;e[1]!==d?(F=()=>{var q;d&&(oj(()=>{const U=I.current;return!!(U!=null&&U.view)&&(U.view.focus(),!0)},{retries:3,delay:100,initialDelay:100}),rj((q=I.current)==null?void 0:q.view))},D=[d],e[1]=d,e[2]=F,e[3]=D):(F=e[2],D=e[3]),S.useEffect(F,D),e[4]!==d||e[5]!==r||e[6]!==k?(M=()=>{d&&k(r||"")},O=[d,r,k],e[4]=d,e[5]=r,e[6]=k,e[7]=M,e[8]=O):(M=e[7],O=e[8]),S.useEffect(M,O);const{theme:R}=S1(),z=()=>{c(A),E("")},T=()=>{E("")};let L;e[9]!==n?(L=ue("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=L):L=e[10];const $=d&&"max-h-[400px] min-h-11 visible",W=!d&&"max-h-0 min-h-0 invisible";let G;e[11]!==$||e[12]!==W?(G=ue("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",$,W),e[11]=$,e[12]=W,e[13]=G):G=e[13];const X=d&&i.jsxs(i.Fragment,{children:[i.jsx(Or,{className:"text-(--blue-10) shrink-0",size:16}),i.jsx(q3,{inputRef:I,className:"h-full my-0 py-2 flex items-center",onClose:()=>{l(),E("")},value:w,onChange:q=>{k(q),f(K3({input:q}))},onSubmit:()=>{var q;N||((q=I.current)!=null&&q.view&&J3(I.current.view),_())},onKeyDown:H3({handleAcceptCompletion:z,handleDeclineCompletion:T,isLoading:N,hasCompletion:A.trim().length>0})}),N&&i.jsxs(ye,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:j,children:[i.jsx(E1,{className:"animate-spin mr-1",size:14}),"Stop"]}),i.jsxs("div",{className:"-mr-1.5 py-1.5",children:[i.jsxs("div",{className:"flex flex-row items-center justify-end gap-0.5",children:[i.jsx(pe,{content:"Add context",children:i.jsx(ye,{variant:"text",size:"icon",onClick:()=>Y3(I),children:i.jsx(X3,{className:"h-3 w-3"})})}),i.jsx(Q3,{triggerClassName:"h-7 text-xs w-24",iconSize:"small",forRole:"edit"})]}),A&&i.jsx("div",{className:"-mb-1.5",children:i.jsx(Z3,{isLoading:N,onAccept:z,onDecline:T,size:"xs"})})]}),i.jsx("div",{className:"h-full w-px bg-border mx-2"}),i.jsx(pe,{content:"Include code from other cells",children:i.jsxs("div",{className:"flex flex-row items-start gap-1 overflow-hidden",children:[i.jsx(ej,{"data-testid":"include-other-cells-checkbox",id:p,checked:b,onCheckedChange:q=>x(!!q)}),i.jsx(Ao,{htmlFor:p,className:"text-muted-foreground text-xs whitespace-nowrap ellipsis",children:"Include all code"})]})}),i.jsx(ye,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:N,onClick:()=>{j(),l(),E("")},children:i.jsx(Vt,{className:"text-(--red-10)",size:16})})]});let H,Y;e[14]!==G||e[15]!==X?(H=i.jsx("div",{className:G,children:X}),e[14]=G,e[15]=X,e[16]=H):H=e[16],e[17]!==A||e[18]!==a||e[19]!==d||e[20]!==o||e[21]!==R?(Y=A&&d&&i.jsxs(jo,{className:"cm",theme:R,children:[i.jsx(Ty,{onChange:o,value:a,extensions:Ef}),i.jsx(Dy,{value:A,editable:!1,readOnly:!0,extensions:Ef})]}),e[17]=A,e[18]=a,e[19]=d,e[20]=o,e[21]=R,e[22]=Y):Y=e[22];const K=(!A||!d)&&u;let V;return e[23]!==H||e[24]!==Y||e[25]!==K||e[26]!==L?(V=i.jsxs("div",{className:L,children:[H,Y,K]}),e[23]=H,e[24]=Y,e[25]=K,e[26]=L,e[27]=V):V=e[27],V};function Oy(t){ze({title:"Completion failed",description:tj(t)})}const ml="web application/x-marimo-cell",Ry=Be({cells:sj(Be({code:Me()})),version:$e("1.0")}),_f=t=>{const e=t===1?"Cell":`${t} cells`;ze({title:`${e} copied`,description:`${e} ${t===1?"has":"have"} been copied to clipboard.`})},Ly=()=>{ze({title:"Copy failed",description:"Failed to copy cells to clipboard.",variant:"danger"})},Fy=()=>{ze({title:"Nothing to paste",description:"No cell or text found in clipboard.",variant:"danger"})},By=()=>{ze({title:"Paste failed",description:"Failed to read from clipboard",variant:"danger"})};class Py{constructor(){this.items={}}add(e,n){return ClipboardItem.supports(e)?typeof n=="string"?(this.items[e]=new Blob([n],{type:e}),this):(this.items[e]=new Blob([JSON.stringify(n)],{type:e}),this):(He.warn(`ClipboardItem does not support ${e}`),this)}build(){return new ClipboardItem(this.items)}}const{valueAtom:zy,useActions:Us}=Zl(()=>new Set,{add:(t,e)=>{const n=new Set(t);return n.add(e),n},remove:(t,e)=>{const n=new Set(t);return n.delete(e),n}});function Uy(t){const e=P.c(2);let n;return e[0]!==t?(n=(o=>Bt(r=>r(zy).has(o)))(t),e[0]=t,e[1]=n):n=e[1],ie(n)}const br=new WeakMap;function If(t){return{handle:e=>t(e),bulkHandle:e=>{let n=!0;try{for(const o of e)n=n&&t(o);return n}catch{return!1}}}}function sn(t){return{handle:e=>t([e]),bulkHandle:e=>t(e)}}function Af(t,e){const n=P.c(30),{canMoveX:o,editorView:r,cellActionDropdownRef:s}=e,{saveOrNameNotebook:a}=ti(),{saveCellConfig:l}=qe(),c=Ct(er),d=Ye(),u=oa(),h=Us(),m=qo(),f=ie(_1),{copyCells:b,pasteAtCell:x}=(function(){const M=Ye(),O=Ce(async z=>{const T=Mt(),L=z.map($=>T.cellData[$]).filter(Boolean);if(L.length!==0)try{const $={cells:L.map(X=>({code:X.code})),version:"1.0"},W=L.map(X=>X.code).join(`
|
|
120
|
-
|
|
121
|
-
`),G=new Py().add(ml,$).add("text/plain",W).build();await navigator.clipboard.write([G]),_f(L.length)}catch($){He.error("Failed to copy cells to clipboard",$);try{const W=L.map(G=>G.code).join(`
|
|
122
|
-
|
|
123
|
-
`);await navigator.clipboard.writeText(W),_f(L.length)}catch{Ly()}}}),R=Ce(async(z,T)=>{const{before:L=!1}=T??{};try{const $=await navigator.clipboard.read();for(const G of $)if(G.types.includes(ml)){const X=await G.getType(ml),H=await X.text();try{const Y=Ry.parse(JSON.parse(H));if(Y.cells.length===0)break;const K=z,V=Y.cells.reverse();for(const q of V)M.createNewCell({cellId:K,before:L,code:q.code,autoFocus:!0});return}catch(Y){He.warn("Failed to parse clipboard cell data",Y)}}const W=await navigator.clipboard.readText();W.trim()?M.createNewCell({cellId:z,before:L,code:W,autoFocus:!0}):Fy()}catch($){He.error("Failed to paste from clipboard",$),By()}});return{copyCells:O,pasteAtCell:R}})(),p=ts(),g=(function(M){const O=P.c(2);let R;return O[0]!==M?(R=Bt(z=>z(oi).selected.has(M)),O[0]=M,O[1]=R):R=O[1],ie(R)})(t),y=Jo(),w=Cr(),j=ie(sa);let N;n[0]!==y||n[1]!==p?(N={clear:()=>{y.clear(),p.clear()},extend:M=>{y.clear(),p.extend(M)},select:M=>{y.clear(),p.select(M)}},n[0]=y,n[1]=p,n[2]=N):N=n[2];const C=N,k=ie(ql);let _;n[3]!==k?(_=(M,O)=>wc(k.getHotkey(M).key)(O.nativeEvent||O),n[3]=k,n[4]=_):_=n[4];const E=_,I=(function(M){const O=P.c(11),R=A1(),z=Ye(),T=Us();let L,$,W;O[0]!==M||O[1]!==R?(L=()=>{R.focusCell({cellId:M})},O[0]=M,O[1]=R,O[2]=L):L=O[2],O[3]!==z||O[4]!==M||O[5]!==R||O[6]!==T?($=()=>{T.remove(M),z.markTouched({cellId:M}),R.blurCell()},O[3]=z,O[4]=M,O[5]=R,O[6]=T,O[7]=$):$=O[7],O[8]!==L||O[9]!==$?(W={onFocusWithin:L,onBlurWithin:$},O[8]=L,O[9]=$,O[10]=W):W=O[10];const{focusWithinProps:G}=aj(W);return G})(t);let A;n[5]!==d||n[6]!==o||n[7]!==s||n[8]!==t||n[9]!==b||n[10]!==w||n[11]!==r||n[12]!==g||n[13]!==E||n[14]!==f||n[15]!==x||n[16]!==y||n[17]!==m||n[18]!==l||n[19]!==a||n[20]!==C||n[21]!==c||n[22]!==u||n[23]!==h||n[24]!==j?(A={onKeyDown:M=>{if(Fn.fromInput(M))return void M.continuePropagation();const O={"Mod+ArrowUp":()=>(d.focusTopCell(),C.clear(),!0),"Mod+ArrowDown":()=>(d.focusBottomCell(),C.clear(),!0),ArrowUp:()=>(d.focusCell({cellId:t,where:"before"}),C.clear(),!0),ArrowDown:()=>(d.focusCell({cellId:t,where:"after"}),C.clear(),!0),ArrowLeft:()=>{if(o){const T=u.get(Gt),L=T.cellIds.findWithId(t),$=T.cellIds.indexOf(L),W=T.cellIds.at($-1);if(W&&W.length>0){const G=Tf(t,W);return d.focusCell({cellId:G,where:"exact"}),C.clear(),!0}}return!1},ArrowRight:()=>{if(o){const T=u.get(Gt),L=T.cellIds.findWithId(t),$=T.cellIds.indexOf(L),W=T.cellIds.at($+1);if(W&&W.length>0){const G=Tf(t,W);return d.focusCell({cellId:G,where:"exact"}),C.clear(),!0}}return!1},"Shift+ArrowUp":()=>{const T=u.get(ba);C.extend({cellId:t,allCellIds:T});const L=T.findWithId(t).before(t);return L&&C.extend({cellId:L,allCellIds:T}),d.focusCell({cellId:t,where:"before"}),!0},"Shift+ArrowDown":()=>{const T=u.get(ba);C.extend({cellId:t,allCellIds:T});const L=T.findWithId(t).after(t);return L&&C.extend({cellId:L,allCellIds:T}),d.focusCell({cellId:t,where:"after"}),!0},Escape:()=>!!g&&(C.clear(),!0),Enter:()=>(h.add(t),D1(u,t),C.clear(),!0),s:()=>(a(),!0)};for(const[T,L]of Object.entries(O))if(wc(T)(M)&&L())return void M.preventDefault();const R={"cell.run":sn(T=>(m(T),!0)),"cell.runAndNewBelow":sn(T=>{m(T);const L=T[T.length-1];return d.moveToNextCell({cellId:L,before:!1}),!0}),"cell.runAndNewAbove":sn(T=>{m(T);const L=T[0];return d.moveToNextCell({cellId:L,before:!0}),!0}),"cell.createAbove":T=>(d.createNewCell({cellId:T,before:!0}),!0),"cell.createBelow":T=>(d.createNewCell({cellId:T,before:!1}),!0),"cell.moveUp":sn(T=>{const L=T[0];return u.get(Gt).cellIds.findWithId(L).first()!==L&&(T.forEach($=>{d.moveCell({cellId:$,before:!0})}),!0)}),"cell.moveDown":sn(T=>{const L=T[T.length-1];return u.get(Gt).cellIds.findWithId(L).last()!==L&&([...T].reverse().forEach($=>{d.moveCell({cellId:$,before:!1})}),!0)}),"cell.moveLeft":If(T=>!!o&&(d.moveCell({cellId:T,direction:"left"}),!0)),"cell.moveRight":If(T=>!!o&&(d.moveCell({cellId:T,direction:"right"}),!0)),"cell.hideCode":sn(T=>{var $;const L=!T.map(W=>{var X;return((X=u.get(Gt).cellData[W])==null?void 0:X.config)||null}).every(Wy);l({configs:Object.fromEntries(T.map(W=>[W,{hide_code:L}]))});for(const W of T)d.updateCellConfig({cellId:W,config:{hide_code:L}});if(T.length===1){const W=T[0];d.focusCell({cellId:W,where:"after"}),L?(($=r.current)==null||$.contentDOM.blur(),T1(W)):D1(u,W)}return!0}),"cell.focusDown":T=>(d.focusCell({cellId:T,where:"after"}),!0),"cell.focusUp":T=>(d.focusCell({cellId:T,where:"before"}),!0),"cell.sendToBottom":sn(T=>(T.forEach(L=>{d.sendToBottom({cellId:L})}),!0)),"cell.sendToTop":sn(T=>([...T].reverse().forEach(L=>{d.sendToTop({cellId:L})}),!0)),"cell.aiCompletion":T=>{var $;let L=!1;return c(W=>(W==null?void 0:W.cellId)===T?(L=!0,null):{cellId:T}),L&&(($=r.current)==null||$.focus()),!0},"cell.cellActions":()=>{var T;return(T=s.current)==null||T.toggle(),!0},"command.copyCell":sn(T=>(b(T),!0)),"command.pasteCell":T=>(x(T),!0),"command.createCellBefore":T=>!Fn.hasModifier(M)&&(d.createNewCell({cellId:T,before:!0,autoFocus:!0}),!0),"command.createCellAfter":T=>!Fn.hasModifier(M)&&(d.createNewCell({cellId:T,before:!1,autoFocus:!0}),!0),"cell.delete":()=>{if(!j.keymap.destructive_delete)return!1;const T=z.size>=2?[...z]:[t],L=u.get(Gt);return!T.some($=>{const{status:W}=L.cellRuntime[$];return W==="running"||W==="queued"})&&(y.idle?(y.submit(T),!0):(w({cellIds:T}),y.clear(),!0))}},z=(function(T){return T.get(oi).selected})(u);if(f==="vim"&&(function(T,L){const $=(function(Y){if(Y.ctrlKey||Y.metaKey||Y.altKey)return"";const K=Y.key.toLowerCase();return Y.shiftKey?`shift+${K}`:K})(T),W=T.target;if(!$||!W)return!1;const G=br.get(W);let X=$;G!=null&&G.timeout&&clearTimeout(G.timeout),G&&(X=`${G.sequence} ${$}`);const H=L[X];if(H)return br.delete(W),H();if(!G){const Y=L[$];if(Y)return Y()}if(Object.keys(L).some(Y=>Y.startsWith(`${X} `))){const Y=window.setTimeout(()=>{br.delete(W)},500);return br.set(W,{sequence:X,timeout:Y}),!0}return br.delete(W),!1})(M.nativeEvent||M,{j:O.ArrowDown,k:O.ArrowUp,h:O.ArrowLeft,l:O.ArrowRight,i:O.Enter,"shift+j":O["Shift+ArrowDown"],"shift+k":O["Shift+ArrowUp"],"g g":O["Mod+ArrowUp"],"shift+g":O["Mod+ArrowDown"],"d d":()=>R["cell.delete"](),"y y":()=>(b(z.size>=2?[...z]:[t]),!0),p:()=>(x(t,{before:!1}),!0),"shift+p":()=>(x(t,{before:!0}),!0),o:()=>(d.createNewCell({cellId:t,before:!1,autoFocus:!0}),!0),"shift+o":()=>(d.createNewCell({cellId:t,before:!0,autoFocus:!0}),!0),u:()=>(d.undoDeleteCell(),!0)}))M.preventDefault();else{for(const[T,L]of Object.entries(R))if(E(T,M)){if(L instanceof Function){if(L(t))return void M.preventDefault()}else if(z.size>=2?L.bulkHandle([...z]):L.handle(t))return void M.preventDefault();return}M.continuePropagation()}}},n[5]=d,n[6]=o,n[7]=s,n[8]=t,n[9]=b,n[10]=w,n[11]=r,n[12]=g,n[13]=E,n[14]=f,n[15]=x,n[16]=y,n[17]=m,n[18]=l,n[19]=a,n[20]=C,n[21]=c,n[22]=u,n[23]=h,n[24]=j,n[25]=A):A=n[25];const{keyboardProps:F}=I1(A);let D;return n[26]!==I||n[27]!==g||n[28]!==F?(D=Sl(I,F,{"data-selected":g,className:"data-[selected=true]:ring-1 data-[selected=true]:ring-(--blue-8) data-[selected=true]:ring-offset-1"}),n[26]=I,n[27]=g,n[28]=F,n[29]=D):D=n[29],D}function Wy(t){return t==null?void 0:t.hide_code}function Tf(t,e){const n=document.getElementById(Js.create(t));if(!n)return e.first();const o=n.getBoundingClientRect();for(const r of e.topLevelIds){const s=document.getElementById(Js.create(r));if(s){const a=s.getBoundingClientRect();if(o.top<=a.bottom&&o.bottom>=a.top)return r}}return e.last()}const $y=t=>{const e=P.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let a;e[0]!==o?(a=new Xs().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1];const l=a;let c;e[2]!==o?(c=new fc().isSupported(o)||o.trim()==="",e[2]=o,e[3]=c):c=e[3];const d=c&&r==="python";let u,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(_o,{color:"var(--sky-11)",strokeWidth:2.5,className:"w-4 h-4"}),e[4]=u):u=e[4],e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==d?(h=i.jsx(fl,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:d,icon:u,toType:"sql",displayName:"SQL",onAfterToggle:s}),e[5]=r,e[6]=n,e[7]=s,e[8]=d,e[9]=h):h=e[9];const m=l&&r==="python";let f,b,x,p,g;return e[10]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(ea,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[10]=f):f=e[10],e[11]!==r||e[12]!==n||e[13]!==s||e[14]!==m?(b=i.jsx(fl,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:m,icon:f,toType:"markdown",displayName:"Markdown",onAfterToggle:s}),e[11]=r,e[12]=n,e[13]=s,e[14]=m,e[15]=b):b=e[15],e[16]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(mc,{fill:"var(--sky-11)",color:"black",className:"w-4 h-4"}),e[16]=x):x=e[16],e[17]!==r||e[18]!==n?(p=i.jsx(fl,{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:!0,icon:x,toType:"python",displayName:"Python",onAfterToggle:Bn.NOOP}),e[17]=r,e[18]=n,e[19]=p):p=e[19],e[20]!==p||e[21]!==h||e[22]!==b?(g=i.jsxs("div",{className:"absolute right-3 top-2 z-20 flex hover-action gap-1",children:[h,b,p]}),e[20]=p,e[21]=h,e[22]=b,e[23]=g):g=e[23],g},fl=t=>{const e=P.c(10),{editorView:n,currentLanguageAdapter:o,canSwitchToLanguage:r,icon:s,toType:a,displayName:l,onAfterToggle:c}=t;let d;e[0]!==n||e[1]!==c||e[2]!==a?(d=()=>{n&&(co(n,{language:a}),c())},e[0]=n,e[1]=c,e[2]=a,e[3]=d):d=e[3];const u=d;if(!r||o===a)return null;const h=`View as ${l}`;let m,f;return e[4]!==u||e[5]!==s?(m=i.jsx(ye,{"data-testid":"language-toggle-button",variant:"text",size:"xs",className:"opacity-80 px-1",onClick:u,children:s}),e[4]=u,e[5]=s,e[6]=m):m=e[6],e[7]!==h||e[8]!==m?(f=i.jsx(pe,{content:h,children:m}),e[7]=h,e[8]=m,e[9]=f):f=e[9],f},Df=({theme:t,showPlaceholder:e,id:n,config:o,code:r,status:s,serializedEditorState:a,setEditorView:l,runCell:c,userConfig:d,editorViewRef:u,editorViewParentRef:h,hidden:m,hasOutput:f,showHiddenCode:b,languageAdapter:x,setLanguageAdapter:p,showLanguageToggles:g=!0})=>{var K;const[y,w]=_n(er),j=jr(),{saveOrNameNotebook:N}=ti(),C=Jo(),{saveCellConfig:k}=qe(),_=s==="running"||s==="queued",E=Ye(),I=Fm(),A=x==="markdown",F=Ce(()=>!_&&(C.idle&&d.keymap.destructive_delete?(C.submit([n]),!0):(j({cellId:n}),!0))),D=Ce(()=>!_&&(c(),!0)),M=Ce(()=>{const V=!o.hide_code;return k({configs:{[n]:{hide_code:V}}}),E.updateCellConfig({cellId:n,config:{hide_code:V}}),V}),O=ie(b1),R=Ce(()=>{Gn({autoInstantiate:O,createNewCell:E.createNewCell})}),z=ij(d),T=S.useMemo(()=>{const V=L2({cellId:n,showPlaceholder:e,enableAI:z,cellActions:{...E,afterToggleMarkdown:R,onRun:D,deleteCell:F,saveNotebook:N,createManyBelow:q=>{for(const U of[...q].reverse())E.createNewCell({code:U,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:I,toggleHideCode:M,aiCellCompletion:()=>{let q=!1;return w(U=>(U==null?void 0:U.cellId)===n?(q=!0,null):{cellId:n}),q}},completionConfig:d.completion,keymapConfig:d.keymap,lspConfig:d.language_servers,theme:t,hotkeys:new M1(d.keymap.overrides??{}),diagnosticsConfig:d.diagnostics,displayConfig:d.display});return V.push(Wt.define(q=>{const U=q.state.field(ma);return p(U.type),{update(ne){const Q=ne.state.field(ma);p(Q.type)}}}),Se.updateListener.of(q=>{q.selectionSet&&q.state.selection.ranges.some(U=>U.from!==U.to)&&b({focus:!1})}),Se.domEventHandlers({focus:()=>{b({focus:!1})}})),V},[n,d.keymap,d.completion,d.language_servers,d.display,d.diagnostics,z,t,e,E,I,M,F,D,w,R,p,b,N]),L=ga(),$=Ce(()=>{if(L){const q=nl(n,0,r);T.push(q.extension),r=q.code}const V=new Se({state:Dr.create({doc:r,extensions:T})});l(V),L||co(V,{language:yc(V.state).type})}),W=Ce(()=>{if(Zt(u.current!==null,"Editor view is not initialized"),L){const V=nl(n);T.push(V.extension)}u.current.dispatch({effects:[tt.reconfigure.of([T]),lj(u.current,{completionConfig:d.completion,hotkeysProvider:new M1(d.keymap.overrides??{}),lspConfig:{...d.language_servers,diagnostics:d.diagnostics}})]})}),G=Ce(()=>{if(Zt(a,"Editor view is not initialized"),L){const q=nl(n,0,r);T.push(q.extension),r=q.code}const V=new Se({state:Dr.fromJSON(a,{doc:r,extensions:T},{history:cj})});L||co(V,{language:yc(V.state).type}),l(V),E.clearSerializedEditorState({cellId:n})});S.useEffect(()=>{a===null?u.current===null?$():W():G(),u.current!==null&&h&&h.current!==null&&h.current.replaceChildren(u.current.dom)},[$,W,G,u,h,a,T]),S.useEffect(()=>{const V=u.current;return()=>{V==null||V.destroy()}},[u]);const X=(function(V,q){const U=P.c(12),ne=Us(),Q=ie(_1),ee=ie(ql);let oe;if(U[0]!==ee){const ge=ee.getHotkey("command.vimEnterCommandMode");oe=wc(ge.key),U[0]=ee,U[1]=oe}else oe=U[1];const se=oe;let ae;U[2]!==V||U[3]!==ne?(ae=()=>{ne.remove(V),T1(V)},U[2]=V,U[3]=ne,U[4]=ae):ae=U[4];const te=ae;let _e;U[5]!==q||U[6]!==te?(_e=()=>{if(!q.current)return void te();const ge=q.current,Ee=ge.state;Ee.selection.main.empty?Fo(Ee)!==null?_l(ge):te():ge.dispatch({selection:Yt.single(Ee.selection.main.from)})},U[5]=q,U[6]=te,U[7]=_e):_e=U[7];const he=_e;let we;U[8]!==he||U[9]!==Q||U[10]!==se?(we={onKeyDown:ge=>{Q==="vim"?se(ge)&&he():ge.key==="Escape"&&he(),ge.continuePropagation()}},U[8]=he,U[9]=Q,U[10]=se,U[11]=we):we=U[11];const{keyboardProps:ke}=I1(we);return ke})(n,u),H=m&&!A||m&&A&&!f;let Y="";return A&&m&&f?Y="h-0 overflow-hidden":m&&(Y="opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden [&_.cm-panels]:hidden"),i.jsx(My,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((K=u.current)==null?void 0:K.state.doc.toString())??r,currentLanguageAdapter:x,declineChange:Ce(()=>{var V;w(null),(V=u.current)==null||V.focus()}),onChange:Ce(V=>{var q;(q=u.current)==null||q.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:V}})}),acceptChange:Ce(V=>{var q,U;(q=u.current)==null||q.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:V}}),(U=u.current)==null||U.focus(),w(null)}),children:i.jsxs("div",{className:"relative w-full",...X,children:[H&&i.jsx(O1,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:b}),i.jsx(Mf,{className:Y,editorView:u.current,ref:h}),!m&&g&&i.jsx("div",{className:"absolute top-1 right-5",children:i.jsx($y,{code:r,editorView:u.current,currentLanguageAdapter:x,onAfterToggle:R})})]})})},Mf=me.forwardRef((t,e)=>{const n=P.c(10),{className:o,editorView:r}=t,s=S.useRef(null);let a,l,c,d,u;return n[0]!==r?(a=()=>{r!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(r.dom)},l=[r,s],n[0]=r,n[1]=a,n[2]=l):(a=n[1],l=n[2]),S.useEffect(a,l),n[3]!==o?(c=ue("cm mathjax_ignore",o),n[3]=o,n[4]=c):c=n[4],n[5]!==e?(d=h=>{e?Rs(e,s)(h):Rs(s)(h)},n[5]=e,n[6]=d):d=n[6],n[7]!==c||n[8]!==d?(u=i.jsx("div",{className:c,ref:d,"data-testid":"cell-editor"}),n[7]=c,n[8]=d,n[9]=u):u=n[9],u});Mf.displayName="CellCodeMirrorEditor";let Of,Rf,Lf,pl;Ia=ga()?(function(t){const e=n=>{const o=P.c(5),r=ie(Nt),[s,a]=_n(yo);if(r.state===ht.CONNECTING||s===void 0){let c,d;return o[0]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx("span",{children:"Waiting for real-time collaboration connection..."}),o[0]=c):c=o[0],o[1]!==a?(d=i.jsx("div",{className:"flex h-full w-full items-baseline p-4",children:i.jsxs(xa,{milliseconds:1e3,fallback:null,children:[c,i.jsx(ye,{variant:"link",onClick:()=>{a("disabled")},children:"Turn off real-time collaboration"})]})}),o[1]=a,o[2]=d):d=o[2],d}let l;return o[3]!==n?(l=i.jsx(t,{...n}),o[3]=n,o[4]=l):l=o[4],l};return e.displayName=`WithWaitUntilConnected(${t.displayName})`,e})(S.memo(Df)):S.memo(Df),Of=t=>{const e=P.c(10);let n,o,r,s;return e[0]!==t.left?(n=i.jsx("div",{className:"flex-1 flex item-center gap-2",children:t.left}),e[0]=t.left,e[1]=n):n=e[1],e[2]!==t.center?(o=i.jsx("div",{className:"flex-1 flex item-center gap-2 justify-center",children:t.center}),e[2]=t.center,e[3]=o):o=e[3],e[4]!==t.right?(r=i.jsx("div",{className:"flex-1 flex item-center gap-2 justify-end",children:t.right}),e[4]=t.right,e[5]=r):r=e[5],e[6]!==n||e[7]!==o||e[8]!==r?(s=i.jsxs("div",{className:"flex items-center gap-2 w-full px-3",children:[n,o,r]}),e[6]=n,e[7]=o,e[8]=r,e[9]=s):s=e[9],s},Rf=t=>{const e=P.c(8);if(!t.canCollapse&&!t.isCollapsed)return null;const n=t.isCollapsed?"Expand":"Collapse";let o,r,s;return e[0]!==t.isCollapsed?(o=i.jsx("span",{children:i.jsx(Lf,{isCollapsed:t.isCollapsed})}),e[0]=t.isCollapsed,e[1]=o):o=e[1],e[2]!==n||e[3]!==o?(r=i.jsx(pe,{content:n,children:o}),e[2]=n,e[3]=o,e[4]=r):r=e[4],e[5]!==t.onClick||e[6]!==r?(s=i.jsx(ye,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},Lf=t=>{const e=P.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?i.jsx(pa,{className:"w-5 h-5 shrink-0"}):i.jsx($n,{className:"w-5 h-5 shrink-0"}),e[0]=n,e[1]=o):o=e[1],o},pl=S.memo(t=>{const e=P.c(24),{onClick:n,count:o,cellId:r}=t,s=Kp();let a;e[0]!==r||e[1]!==s?(a=dj(s,r),e[0]=r,e[1]=s,e[2]=a):a=e[2];const l=a;let c,d;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=ue("flex items-center justify-between w-[calc(100%-2rem)] h-9 bg-muted rounded-b mx-4 opacity-80 hover:opacity-100 cursor-pointer"),e[3]=c):c=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(hj,{className:"w-4 h-4 shrink-0"}),e[4]=d):d=e[4];const u=o===1?"cell":"cells";let h,m,f,b,x,p,g;return e[5]!==o||e[6]!==u?(h=i.jsxs(i.Fragment,{children:[d,i.jsxs("span",{className:"text-sm text-gray-500",children:[o," ",u," collapsed"]})]}),e[5]=o,e[6]=u,e[7]=h):h=e[7],e[8]!==l.errored?(m=l.errored&&i.jsx(pe,{content:"Has errors",delayDuration:100,children:i.jsx(dd,{className:"w-4 h-4 shrink-0 text-destructive"})}),e[8]=l.errored,e[9]=m):m=e[9],e[10]!==l.stale?(f=l.stale&&i.jsx(pe,{content:"Has stale cells",delayDuration:100,children:i.jsx(uj,{className:"w-4 h-4 shrink-0 text-(--yellow-11)"})}),e[10]=l.stale,e[11]=f):f=e[11],e[12]!==l.runningOrQueued?(b=l.runningOrQueued&&i.jsx(pe,{content:"Running",delayDuration:100,children:i.jsx(E1,{className:"w-4 h-4 shrink-0 animate-spin"})}),e[12]=l.runningOrQueued,e[13]=b):b=e[13],e[14]!==m||e[15]!==f||e[16]!==b?(x=i.jsxs(i.Fragment,{children:[m,f,b]}),e[14]=m,e[15]=f,e[16]=b,e[17]=x):x=e[17],e[18]!==h||e[19]!==x?(p=i.jsx(Of,{center:h,right:x}),e[18]=h,e[19]=x,e[20]=p):p=e[20],e[21]!==n||e[22]!==p?(g=i.jsx("div",{onClick:n,className:c,children:p}),e[21]=n,e[22]=p,e[23]=g):g=e[23],g}),pl.displayName="CollapsedCellBanner";const Ff=t=>{const e=P.c(31),{status:n,connectionState:o,onClick:r}=t,s=n==="running"||n==="queued";let a,l,c,d,u,h,m,f,b,x,p,g,y,w;if(e[0]!==o||e[1]!==s||e[2]!==r||e[3]!==n){const j=en(o);let N;if(j){let C;e[14]!==o?(C=ra(o),e[14]=o,e[15]=C):C=e[15],N=C}else N=n==="running"?"A cell can't be deleted when it's running":n==="queued"?"A cell can't be deleted when it's queued to run":"Delete";l=pe,b=N,x=!1,a=ye,c="ghost",d="icon",u=r,h="delete-button",m=Fn.preventFocus,f=ue("hover:bg-transparent text-destructive/60 hover:text-destructive",(j||s)&&"inactive-button"),e[0]=o,e[1]=s,e[2]=r,e[3]=n,e[4]=a,e[5]=l,e[6]=c,e[7]=d,e[8]=u,e[9]=h,e[10]=m,e[11]=f,e[12]=b,e[13]=x}else a=e[4],l=e[5],c=e[6],d=e[7],u=e[8],h=e[9],m=e[10],f=e[11],b=e[12],x=e[13];return e[16]===Symbol.for("react.memo_cache_sentinel")?(p={boxShadow:"none"},g=i.jsx(tc,{size:14}),e[16]=p,e[17]=g):(p=e[16],g=e[17]),e[18]!==a||e[19]!==c||e[20]!==d||e[21]!==u||e[22]!==h||e[23]!==m||e[24]!==f?(y=i.jsx(a,{variant:c,size:d,onClick:u,"data-testid":h,onMouseDown:m,className:f,style:p,children:g}),e[18]=a,e[19]=c,e[20]=d,e[21]=u,e[22]=h,e[23]=m,e[24]=f,e[25]=y):y=e[25],e[26]!==l||e[27]!==y||e[28]!==b||e[29]!==x?(w=i.jsx(l,{content:b,usePortal:x,children:y}),e[26]=l,e[27]=y,e[28]=b,e[29]=x,e[30]=w):w=e[30],w},Vy=t=>{const e=P.c(22),{cellId:n}=t,o=(function(g){const y=P.c(16),w=ie(fu),j=pu(),N=Cr();let C;y[0]!==g||y[1]!==w.entries?(C=w.entries.get(g),y[0]=g,y[1]=w.entries,y[2]=C):C=y[2];const k=C;if(!k){let A;return y[3]===Symbol.for("react.memo_cache_sentinel")?(A={isPending:!1},y[3]=A):A=y[3],A}if(w.entries.size!==1){let A;return y[4]!==k?(A={isPending:!0,shouldConfirmDelete:!1,...k},y[4]=k,y[5]=A):A=y[5],A}let _,E,I;return y[6]!==j||y[7]!==N||y[8]!==w.entries?(_=()=>{N({cellIds:[...w.entries.values()].map(kb)}),j.clear()},y[6]=j,y[7]=N,y[8]=w.entries,y[9]=_):_=y[9],y[10]!==j?(E=()=>j.clear(),y[10]=j,y[11]=E):E=y[11],y[12]!==k||y[13]!==_||y[14]!==E?(I={isPending:!0,...k,shouldConfirmDelete:!0,confirm:_,cancel:E},y[12]=k,y[13]=_,y[14]=E,y[15]=I):I=y[15],I})(n);if(!o.isPending)return null;if(o.type==="simple"){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=ue("px-3 py-1.5","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[0]=g):g=e[0];const y=`pending-delete-${n}`;let w,j;return e[1]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ec,{className:"w-3 h-3 text-(--amber-11) shrink-0"}),i.jsx("span",{className:"text-(--amber-11) text-xs",children:"Pending deletion"})]}),e[1]=w):w=e[1],e[2]!==y?(j=i.jsx("div",{className:g,"data-testid":y,children:w}),e[2]=y,e[3]=j):j=e[3],j}const r=o.executionDurationMs!==void 0,s=o.defs.size>0,a=Uo(o.executionDurationMs??0);let l,c="Pending deletion";r&&s?c=`This cell took ${a} to run and contains variables referenced by other cells.`:r?c=`This cell took ${a} to run.`:s&&(c="This cell contains variables referenced by other cells."),e[4]===Symbol.for("react.memo_cache_sentinel")?(l=ue("px-4 py-3","bg-(--amber-2) border-t border-(--amber-6)","animate-in slide-in-from-top-2 duration-200"),e[4]=l):l=e[4];const d=`pending-delete-${n}`;let u,h,m,f,b,x,p;return e[5]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(ec,{className:"w-4 h-4 text-(--amber-11) mt-0.5 shrink-0"}),e[5]=u):u=e[5],e[6]!==c?(h=i.jsx("p",{className:"text-(--amber-11) font-medium",children:c}),e[6]=c,e[7]=h):h=e[7],e[8]!==s||e[9]!==o.defs?(m=s&&[...o.defs.entries()].map(qy),e[8]=s,e[9]=o.defs,e[10]=m):m=e[10],e[11]!==h||e[12]!==m?(f=i.jsxs("div",{className:"font-code text-sm text-[0.84375rem]",children:[h,m]}),e[11]=h,e[12]=m,e[13]=f):f=e[13],e[14]!==o?(b=o.shouldConfirmDelete&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-(--amber-11) mt-2 mb-3",children:"Are you sure you want to delete?"}),i.jsx(Jl,{autoFocus:!0,children:i.jsxs("div",{className:"flex items-center gap-2",onKeyDown:Hy,children:[i.jsx(ye,{size:"xs",variant:"ghost",onClick:()=>o.cancel(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),i.jsx(ye,{size:"xs",variant:"secondary",onClick:()=>o.confirm(),className:"bg-(--amber-11) hover:bg-(--amber-12) text-white border-(--amber-11)",children:"Delete"})]})})]}),e[14]=o,e[15]=b):b=e[15],e[16]!==f||e[17]!==b?(x=i.jsxs("div",{className:"flex items-start gap-3",children:[u,i.jsxs("div",{className:"flex-1",children:[f,b]})]}),e[16]=f,e[17]=b,e[18]=x):x=e[18],e[19]!==d||e[20]!==x?(p=i.jsx("div",{className:l,"data-testid":d,children:x}),e[19]=d,e[20]=x,e[21]=p):p=e[21],p};function Gy(t){return i.jsx("li",{className:"my-0.5 ml-8 text-(--amber-11)/60",children:i.jsx(mj,{cellId:t})},t)}function qy(t){const[e,n]=t;return i.jsxs("div",{children:[i.jsxs("p",{className:"text-(--amber-11) mt-2",children:["'",i.jsx("span",{className:"font-mono",children:e}),"' is referenced by:"]}),i.jsx("ul",{className:"list-disc",children:n.map(Gy)})]},e)}function Hy(t){t.stopPropagation()}const Jy=t=>{const e=P.c(27),{onClick:n,connectionState:o,needsRun:r,status:s,config:a,edited:l}=t,c=s==="disabled-transitively",d=s==="running"||s==="queued";let u,h;e[0]!==c||e[1]!==a.disabled||e[2]!==o||e[3]!==l||e[4]!==d||e[5]!==r?(u=en(o)||d||!a.disabled&&c&&!l,h=(function({connectionState:p,needsRun:g,loading:y,inactive:w}){return en(p)?"disabled":g&&!y?"stale":y||w?"disabled":"green"})({connectionState:o,needsRun:r,loading:d,inactive:u}),e[0]=c,e[1]=a.disabled,e[2]=o,e[3]=l,e[4]=d,e[5]=r,e[6]=u,e[7]=h):(u=e[6],h=e[7]);const m=h;if(a.disabled){let p,g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(ed,{}),e[8]=p):p=e[8],e[9]!==u||e[10]!==n||e[11]!==m?(g=i.jsx(Zo,{tooltip:"Add code to notebook",disabled:u,onClick:n,variant:m,"data-testid":"run-button",children:p}),e[9]=u,e[10]=n,e[11]=m,e[12]=g):g=e[12],g}if(!a.disabled&&c&&!l){let p,g;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(zo,{strokeWidth:1.2}),e[13]=p):p=e[13],e[14]!==u||e[15]!==n||e[16]!==m?(g=i.jsx(Zo,{disabled:u,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:n,variant:m,"data-testid":"run-button",children:p}),e[14]=u,e[15]=n,e[16]=m,e[17]=g):g=e[17],g}let f,b,x;if(en(o)){let p;e[18]!==o?(p=ra(o),e[18]=o,e[19]=p):p=e[19],f=p}else if(s==="queued")f="This cell is already queued to run";else if(s==="running")f="This cell is already running.";else{let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=St("cell.run"),e[20]=p):p=e[20],f=p}return e[21]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(zo,{strokeWidth:1.2}),e[21]=b):b=e[21],e[22]!==u||e[23]!==n||e[24]!==f||e[25]!==m?(x=i.jsx(Zo,{tooltip:f,disabled:u,onClick:n,variant:m,"data-testid":"run-button",children:b}),e[22]=u,e[23]=n,e[24]=f,e[25]=m,e[26]=x):x=e[26],x},Ky=t=>{const e=P.c(4),{cellId:n,className:o}=t;if(!ie(R1).has(n))return null;let r,s;return e[0]!==o?(r=ue("mo-ai-generated-cell",o),e[0]=o,e[1]=r):r=e[1],e[2]!==r?(s=i.jsx("div",{className:r}),e[2]=r,e[3]=s):s=e[3],s},Yy=t=>{const e=P.c(9),{cellId:n}=t,o=oa(),r=ie(R1),{deleteStagedCell:s,removeStagedCell:a}=fj(o);if(!r.has(n))return null;let l;e[0]!==n||e[1]!==a?(l=()=>{a(n)},e[0]=n,e[1]=a,e[2]=l):l=e[2];const c=l;let d;e[3]!==n||e[4]!==s?(d=()=>{s(n)},e[3]=n,e[4]=s,e[5]=d):d=e[5];const u=d;let h;return e[6]!==c||e[7]!==u?(h=i.jsx("div",{className:"flex items-center justify-end gap-1.5 w-full pb-1 pt-2",children:i.jsx(pj,{isLoading:!1,onAccept:c,onDecline:u,size:"xs"})}),e[6]=c,e[7]=u,e[8]=h):h=e[8],h},Bf=me.createContext(null),Pf=S.memo(()=>S.use(Bf));Pf.displayName="DragHandle";const zf=me.forwardRef((t,e)=>{const n=P.c(21);let o,r,s,a,l;n[0]!==t?({cellId:r,canMoveX:o,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s):(o=n[1],r=n[2],s=n[3]),n[4]!==r?(a=r.toString(),n[4]=r,n[5]=a):a=n[5],n[6]!==a?(l={id:a},n[6]=a,n[7]=l):l=n[7];const{attributes:c,listeners:d,setNodeRef:u,transform:h,transition:m,isDragging:f}=Ku(l);let b;n[8]!==h?(b=(function(y){return!y||y.x===0&&y.y===0&&y.scaleX===1&&y.scaleY===1})(h)?null:h,n[8]=h,n[9]=b):b=n[9];const x=b,p=x==null?void 0:m;let g;return n[10]!==c||n[11]!==o||n[12]!==r||n[13]!==f||n[14]!==d||n[15]!==s||n[16]!==e||n[17]!==u||n[18]!==x||n[19]!==p?(g=i.jsx(Uf,{ref:e,cellId:r,canMoveX:o,...s,attributes:c,listeners:d,setNodeRef:u,transform:x,transition:p,isDragging:f}),n[10]=c,n[11]=o,n[12]=r,n[13]=f,n[14]=d,n[15]=s,n[16]=e,n[17]=u,n[18]=x,n[19]=p,n[20]=g):g=n[20],g});zf.displayName="SortableCell";const Uf=me.forwardRef((t,e)=>{const n=P.c(35);let o,r,s,a,l,c,d,u,h,m;if(n[0]!==e||n[1]!==t){const{cellId:f,canMoveX:b,children:x,attributes:p,listeners:g,setNodeRef:y,transform:w,transition:j,isDragging:N,...C}=t;let k;o=x,n[10]!==b||n[11]!==w?(k=w?da.Transform.toString({x:b?w.x:0,y:w.y,scaleX:1,scaleY:1}):void 0,n[10]=b,n[11]=w,n[12]=k):k=n[12];const _=N?2:void 0;let E,I,A;n[13]!==k||n[14]!==_||n[15]!==j?(E={transform:k,transition:j,zIndex:_,position:"relative"},n[13]=k,n[14]=_,n[15]=j,n[16]=E):E=n[16],s=E,n[17]===Symbol.for("react.memo_cache_sentinel")?(I=i.jsx(Zc,{strokeWidth:1,size:20}),n[17]=I):I=n[17],n[18]!==p||n[19]!==g?(A=i.jsx("div",{...p,...g,onMouseDown:Fn.preventFocus,"data-testid":"drag-button",className:"py-px cursor-grab opacity-50 hover:opacity-100 hover-action hover:bg-muted rounded border border-transparent hover:border-border active:bg-accent",children:I}),n[18]=p,n[19]=g,n[20]=A):A=n[20],r=A;const F=!!w;a=-1,n[21]!==e||n[22]!==y?(l=D=>{Rs(e,y)(D)},n[21]=e,n[22]=y,n[23]=l):l=n[23],c=C,d=N,u=ue(C.className,F&&"is-moving","outline-hidden rounded-lg"),n[0]=e,n[1]=t,n[2]=o,n[3]=r,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=d,n[9]=u}else o=n[2],r=n[3],s=n[4],a=n[5],l=n[6],c=n[7],d=n[8],u=n[9];return n[24]!==o||n[25]!==r?(h=i.jsx(Bf.Provider,{value:r,children:o}),n[24]=o,n[25]=r,n[26]=h):h=n[26],n[27]!==s||n[28]!==a||n[29]!==l||n[30]!==c||n[31]!==d||n[32]!==u||n[33]!==h?(m=i.jsx("div",{tabIndex:a,ref:l,...c,"data-is-dragging":d,className:u,style:s,children:h}),n[27]=s,n[28]=a,n[29]=l,n[30]=c,n[31]=d,n[32]=u,n[33]=h,n[34]=m):m=n[34],m});function Wf(t,e){const n=P.c(9);let o;n[0]!==t||n[1]!==e?(o=c=>{t.current===null||t.current.contains(c.relatedTarget)||e.current===null||_l(e.current)},n[0]=t,n[1]=e,n[2]=o):o=n[2];const r=Ce(o);let s;n[3]!==t||n[4]!==e?(s=c=>{if(t.current===document.activeElement&&e.current!==null&&Fo(e.current.state)==="active"){for(const d of d1)if(c.key===d.key&&d.run){d.run(e.current),c.preventDefault(),c.stopPropagation();break}e.current.focus()}},n[3]=t,n[4]=e,n[5]=s):s=n[5];const a=Ce(s);let l;return n[6]!==r||n[7]!==a?(l={closeCompletionHandler:r,resumeCompletionHandler:a},n[6]=r,n[7]=a,n[8]=l):l=n[8],l}function $f(t){const e=P.c(16),{cellId:n,cellConfig:o,languageAdapter:r,editorView:s}=t,a=Uy(n),l=Us();let c;e[0]!==n?(c=xj(n),e[0]=n,e[1]=c):c=e[1];const d=ie(c),u=!o.hide_code||a||d,h=r==="markdown",m=h&&!u;let f;e[2]!==n||e[3]!==s||e[4]!==u||e[5]!==l?(f=y=>{var j;if(u)return;const w=(y==null?void 0:y.focus)??!0;l.add(n),w&&((j=s.current)==null||j.focus())},e[2]=n,e[3]=s,e[4]=u,e[5]=l,e[6]=f):f=e[6];const b=Ce(f);let x;e[7]!==m||e[8]!==b?(x=()=>{m&&b({focus:!0})},e[7]=m,e[8]=b,e[9]=x):x=e[9];const p=Ce(x);let g;return e[10]!==u||e[11]!==h||e[12]!==m||e[13]!==b||e[14]!==p?(g={isCellCodeShown:u,isMarkdown:h,isMarkdownCodeHidden:m,showHiddenCode:b,showHiddenCodeIfMarkdown:p},e[10]=u,e[11]=h,e[12]=m,e[13]=b,e[14]=p,e[15]=g):g=e[15],g}Uf.displayName="SortableCellInternal";const Vf=S.forwardRef((t,e)=>{var x;const n=P.c(18),{cellId:o}=t,r=Rr(o),s=Lr(o);let a;n[0]===Symbol.for("react.memo_cache_sentinel")?(a=ya("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=a):a=n[0];const l=a,c=F1((x=s.output)==null?void 0:x.mimetype);if(s.errored||s.interrupted||s.stopped||c)return null;let d;n[1]!==r.name||n[2]!==o?(d=Ec(o,r.name),n[1]=r.name,n[2]=o,n[3]=d):d=n[3];const u=s.output;let h,m,f,b;return n[4]!==r.edited||n[5]!==s?(h=z1(s,r.edited),n[4]=r.edited,n[5]=s,n[6]=h):h=n[6],n[7]!==s.status?(m=jc(s.status),n[7]=s.status,n[8]=m):m=n[8],n[9]!==o||n[10]!==s.output||n[11]!==h||n[12]!==m?(f=i.jsx(kc,{allowExpand:!1,forceExpand:!0,className:"output-area",cellId:o,output:u,stale:h,loading:m}),n[9]=o,n[10]=s.output,n[11]=h,n[12]=m,n[13]=f):f=n[13],n[14]!==e||n[15]!==d||n[16]!==f?(b=i.jsx("div",{tabIndex:-1,ref:e,className:l,...d,children:f}),n[14]=e,n[15]=d,n[16]=f,n[17]=b):b=n[17],b});Vf.displayName="ReadonlyCellComponent";const Xy=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,isCollapsed:s,collapseCount:a,canMoveX:l,editorView:c,setEditorView:d})=>{var _e;const u=S.useRef(null),h=Rr(n),m=Lr(n),f=S.useRef(null),b=S.useRef(null),x=S.useRef(null),p=Ye(),g=ie(Nt),y=Ct(er),w=jr(),j=Va(n),{sendStdin:N}=qe(),[C,k]=S.useState(),_=h.config.disabled||m.status==="disabled-transitively",E=L1({executionTime:m.runElapsedTimeMs??h.lastExecutionTime,status:m.status,errored:m.errored,interrupted:m.interrupted,stopped:m.stopped}),I=h.edited||m.interrupted||m.staleInputs&&!_,A=jc(m.status),F=(m.status==="queued"||h.edited||m.staleInputs)&&!m.interrupted,D=S.useCallback(()=>c.current,[c]),{closeCompletionHandler:M,resumeCompletionHandler:O}=Wf(u,c),{isCellCodeShown:R,isMarkdown:z,isMarkdownCodeHidden:T,showHiddenCode:L,showHiddenCodeIfMarkdown:$}=$f({cellId:n,cellConfig:h.config,languageAdapter:C,editorView:c}),W=Af(n,{canMoveX:l,editorView:c,cellActionDropdownRef:f}),G=bj(m.outline),X=!xc(m.output),H=m.consoleOutputs.length>0,Y=r.display.cell_output,K=X&&Y==="above",V=X&&Y==="below",[q,U]=S.useState(!1),[ne,Q]=S.useState(!1);(function(he){const{ref:we,box:ke="content-box",skip:ge}=he,Ee=S.useRef({...B2}),Oe=S.useRef(void 0);Oe.current=he.onResize,S.useEffect(()=>{if(!we.current||ge||typeof window>"u"||!("ResizeObserver"in window))return;const ve=new ResizeObserver(([be])=>{const et=ke==="border-box"?"borderBoxSize":ke==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",rt=nm(be,et,"inlineSize"),ct=nm(be,et,"blockSize");if(Ee.current.width!==rt||Ee.current.height!==ct){const dt={width:rt,height:ct};Ee.current.width=rt,Ee.current.height=ct,Oe.current&&Oe.current(dt)}});return ve.observe(we.current,{box:ke}),()=>{ve.disconnect()}},[ke,we,ge])})({ref:x,skip:!z,onResize:he=>{const we=he.height&&he.height<68,ke=T&&(we||Y==="below");U(ke),G&&ke?Q(!0):ne&&Q(!1)}});const ee=he=>i.jsx(O1,{tooltip:"Edit markdown",className:ue("z-20 relative",he),onClick:L}),oe=X&&i.jsxs("div",{className:"relative",onDoubleClick:$,children:[i.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:i.jsx(Rf,{isCollapsed:s,onClick:()=>{s?p.expandCell({cellId:n}):p.collapseCell({cellId:n})},canCollapse:G})}),T&&V&&ee("top-3"),i.jsx(kc,{allowExpand:!0,forceExpand:T,className:"output-area",cellId:n,output:m.output,stale:z1(m,h.edited),loading:jc(m.status)}),T&&K&&ee("bottom-3")]}),se=ya("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":I,"has-error":m.errored,stopped:m.stopped,disabled:h.config.disabled,stale:m.status==="disabled-transitively",borderless:T&&X&&!W["data-selected"]}),ae=Ce(he=>{y({cellId:n,initialPrompt:he.prompt})}),te=((_e=m.serialization)==null?void 0:_e.toLowerCase())==="valid";return i.jsx(B1,{children:i.jsx(Bm,{cellId:n,getEditorView:D,children:i.jsxs(zf,{tabIndex:-1,ref:u,"data-status":m.status,onBlur:M,onKeyDown:O,cellId:n,canMoveX:l,title:h.config.disabled?"This cell is disabled":m.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,children:[i.jsxs("div",{tabIndex:-1,...W,className:ue(se,W.className,"focus:ring-1 focus:ring-(--blue-7) focus:ring-offset-0"),ref:x,...Ec(n,h.name),children:[Y==="above"&&oe,i.jsxs("div",{className:ue("tray"),"data-hidden":T,children:[i.jsx(Ky,{cellId:n}),i.jsx("div",{className:"absolute right-2 -top-4 z-10",children:i.jsx(bl,{edited:h.edited,status:m.status,cellConfig:h.config,needsRun:I,hasOutput:X,hasConsoleOutput:H,cellActionDropdownRef:f,cellId:n,name:h.name,getEditorView:D,onRun:j})}),i.jsx(Gf,{cellId:n,className:ue(T&&K&&"-top-7",T&&V&&"-bottom-8",T&&ne&&"-left-[3.8rem]"),actions:p}),i.jsx(Ia,{theme:t,showPlaceholder:e,id:n,code:h.code,config:h.config,status:m.status,serializedEditorState:h.serializedEditorState,runCell:j,setEditorView:d,userConfig:r,editorViewRef:c,editorViewParentRef:b,hidden:!R,hasOutput:X,showHiddenCode:L,languageAdapter:C,setLanguageAdapter:k}),i.jsx(gl,{className:ue(T&&Y==="below"&&"top-14"),edited:h.edited,status:m.status,isCellStatusInline:q,uninstantiated:E,disabled:h.config.disabled,runElapsedTimeMs:m.runElapsedTimeMs,runStartTimestamp:m.runStartTimestamp,lastRunStartTimestamp:m.lastRunStartTimestamp,staleInputs:m.staleInputs,interrupted:m.interrupted}),i.jsx("div",{className:"shoulder-bottom hover-action",children:o&&R&&i.jsx(Ff,{status:m.status,connectionState:g.state,onClick:()=>{A||en(g.state)||w({cellId:n})}})})]}),Y==="below"&&oe,m.serialization&&i.jsxs("div",{className:"py-1 px-2 flex items-center justify-end gap-2 last:rounded-b",children:[te&&i.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",className:"hover:underline text-muted-foreground text-xs font-bold",rel:"noopener",children:"reusable"}),i.jsx(pe,{content:i.jsx("span",{className:"max-w-16 text-xs",children:te?"This function or class can be imported into other Python notebooks or modules.":i.jsxs(i.Fragment,{children:["This definition can't be reused in other Python modules:",i.jsx("br",{}),i.jsx("br",{}),i.jsx("pre",{children:m.serialization}),i.jsx("br",{}),"Click this icon to learn more."]})}),children:te?i.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:i.jsx(vp,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})}):i.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:i.jsx(P1,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})})]}),i.jsx(cg,{consoleOutputs:m.consoleOutputs,stale:F,cellName:m.serialization?"_":h.name,onRefactorWithAI:ae,onClear:()=>{p.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(he,we)=>{p.setStdinResponse({cellId:n,response:he,outputIndex:we}),N({text:he})},cellId:n,debuggerActive:m.debuggerActive}),i.jsx(Vy,{cellId:n})]}),i.jsx(Yy,{cellId:n}),s&&i.jsx(pl,{onClick:()=>p.expandCell({cellId:n}),count:a,cellId:n})]})})})},gl=S.memo(t=>{const e=P.c(19),{className:n,disabled:o,edited:r,interrupted:s,isCellStatusInline:a,lastRunStartTimestamp:l,runElapsedTimeMs:c,runStartTimestamp:d,staleInputs:u,status:h,uninstantiated:m}=t,f=o!==void 0&&o;let b;e[0]!==f||e[1]!==r||e[2]!==s||e[3]!==l||e[4]!==c||e[5]!==d||e[6]!==u||e[7]!==h||e[8]!==m?(b=i.jsx(sm,{status:h,staleInputs:u,interrupted:s,editing:!0,edited:r,disabled:f,elapsedTime:c,runStartTimestamp:d,uninstantiated:m,lastRunStartTimestamp:l}),e[0]=f,e[1]=r,e[2]=s,e[3]=l,e[4]=c,e[5]=d,e[6]=u,e[7]=h,e[8]=m,e[9]=b):b=e[9];const x=b;let p;e[10]!==n?(p=ue("shoulder-right z-20",n),e[10]=n,e[11]=p):p=e[11];const g=!a&&x;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(Pf,{}),e[12]=y):y=e[12];const w=a&&x;let j,N;return e[13]!==w?(j=i.jsxs("div",{className:"flex gap-2 items-end",children:[y,w]}),e[13]=w,e[14]=j):j=e[14],e[15]!==p||e[16]!==g||e[17]!==j?(N=i.jsxs("div",{className:p,children:[g,j]}),e[15]=p,e[16]=g,e[17]=j,e[18]=N):N=e[18],N});gl.displayName="CellRightSideActions";const Gf=S.memo(t=>{const e=P.c(21),n=ie(Nt),{className:o,actions:r,cellId:s}=t;let a;e[0]!==r||e[1]!==s?(a=j=>{const N=j===void 0?{}:j;return r.createNewCell({cellId:s,before:!1,...N})},e[0]=r,e[1]=s,e[2]=a):a=e[2];const l=Ce(a);let c;e[3]!==r||e[4]!==s?(c=j=>{const N=j===void 0?{}:j;return r.createNewCell({cellId:s,before:!0,...N})},e[3]=r,e[4]=s,e[5]=c):c=e[5];const d=Ce(c),u=U1(n.state);let h,m;e[6]!==o?(h=ue("absolute flex flex-col gap-[2px] justify-center h-full left-[-34px] z-20",o),e[6]=o,e[7]=h):h=e[7],e[8]===Symbol.for("react.memo_cache_sentinel")?(m=St("cell.createAbove"),e[8]=m):m=e[8];const f=u?d:void 0;let b,x,p;e[9]!==n.state||e[10]!==f?(b=i.jsx(Rm,{tooltipContent:m,connectionState:n.state,onClick:f}),e[9]=n.state,e[10]=f,e[11]=b):b=e[11],e[12]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx("div",{className:"flex-1"}),e[12]=x):x=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(p=St("cell.createBelow"),e[13]=p):p=e[13];const g=u?l:void 0;let y,w;return e[14]!==n.state||e[15]!==g?(y=i.jsx(Rm,{tooltipContent:p,connectionState:n.state,onClick:g}),e[14]=n.state,e[15]=g,e[16]=y):y=e[16],e[17]!==h||e[18]!==b||e[19]!==y?(w=i.jsxs("div",{className:h,children:[b,x,y]}),e[17]=h,e[18]=b,e[19]=y,e[20]=w):w=e[20],w});Gf.displayName="CellLeftSideActions";const bl=S.memo(t=>{const e=P.c(27),{edited:n,status:o,cellConfig:r,needsRun:s,hasOutput:a,hasConsoleOutput:l,onRun:c,cellActionDropdownRef:d,cellId:u,getEditorView:h,name:m,includeCellActions:f}=t,b=f===void 0||f,x=ie(Nt),p=U1(x.state),g=!s&&"hover-action";let y;e[0]!==g?(y=ue(g),e[0]=g,e[1]=y):y=e[1];const w=p?c:Bn.NOOP;let j,N,C,k;return e[2]!==r||e[3]!==x.state||e[4]!==n||e[5]!==s||e[6]!==o||e[7]!==w?(j=i.jsx(Jy,{edited:n,onClick:w,connectionState:x.state,status:o,config:r,needsRun:s}),e[2]=r,e[3]=x.state,e[4]=n,e[5]=s,e[6]=o,e[7]=w,e[8]=j):j=e[8],e[9]!==x.state||e[10]!==o?(N=i.jsx(Ax,{status:o,connectionState:x.state}),e[9]=x.state,e[10]=o,e[11]=N):N=e[11],e[12]!==d||e[13]!==r||e[14]!==u||e[15]!==h||e[16]!==l||e[17]!==a||e[18]!==b||e[19]!==m||e[20]!==o?(C=b&&i.jsx(Qi,{ref:d,cellId:u,status:o,getEditorView:h,name:m,config:r,hasOutput:a,hasConsoleOutput:l,children:i.jsx(Zo,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:i.jsx(Ca,{strokeWidth:1.5})})}),e[12]=d,e[13]=r,e[14]=u,e[15]=h,e[16]=l,e[17]=a,e[18]=b,e[19]=m,e[20]=o,e[21]=C):C=e[21],e[22]!==y||e[23]!==j||e[24]!==N||e[25]!==C?(k=i.jsxs(Ix,{className:y,children:[j,N,C]}),e[22]=y,e[23]=j,e[24]=N,e[25]=C,e[26]=k):k=e[26],k});bl.displayName="CellToolbar";const Qy=({theme:t,showPlaceholder:e,cellId:n,canDelete:o,userConfig:r,canMoveX:s,editorView:a,setEditorView:l})=>{var L;const c=S.useRef(null),d=Rr(n),u=Lr(n),h=S.useRef(null),m=S.useRef(null),f=ie(Nt),b=Ye(),x=qe(),p=jr(),g=Ct(er),y=Va(n),w=d.config.disabled||u.status==="disabled-transitively",j=L1({executionTime:u.runElapsedTimeMs??d.lastExecutionTime,status:u.status,errored:u.errored,interrupted:u.interrupted,stopped:u.stopped}),N=d.edited||u.interrupted||u.staleInputs&&!w,C=u.status==="running"||u.status==="queued",k=(u.status==="queued"||d.edited||u.staleInputs)&&!u.interrupted,_=S.useCallback(()=>a.current,[a]),{isCellCodeShown:E,showHiddenCode:I}=$f({cellId:n,cellConfig:d.config,languageAdapter:"python",editorView:a}),{closeCompletionHandler:A,resumeCompletionHandler:F}=Wf(c,a),D=Af(n,{canMoveX:s,editorView:a,cellActionDropdownRef:h}),M=!xc(u.output),O=u.consoleOutputs.length>0,R=F1((L=u.output)==null?void 0:L.mimetype),z=ya("marimo-cell","hover-actions-parent z-10 border shadow-sm","border-(--blue-5)! rounded-sm!",{"needs-run":N,"has-error":u.errored,stopped:u.stopped}),T=Ce($=>{g({cellId:n,initialPrompt:$.prompt})});return i.jsx(B1,{children:i.jsx(Bm,{cellId:n,getEditorView:_,children:i.jsxs("div",{"data-status":u.status,ref:c,...Sl(D,{className:z,onBlur:A,onKeyDown:F}),...Ec(n,d.name),title:d.config.disabled?"This cell is disabled":u.status==="disabled-transitively"?"This cell has a disabled ancestor":void 0,"data-setup-cell":!0,children:[i.jsxs("div",{className:ue("tray"),"data-hidden":!E,children:[i.jsx("div",{className:"absolute right-2 -top-4 z-10",children:i.jsx(bl,{edited:d.edited,status:u.status,cellConfig:d.config,needsRun:N,hasOutput:M,hasConsoleOutput:O,cellActionDropdownRef:h,cellId:n,name:d.name,getEditorView:_,onRun:y,includeCellActions:!0})}),i.jsx(Ia,{theme:t,showPlaceholder:e,id:n,code:d.code,config:d.config,status:u.status,serializedEditorState:d.serializedEditorState,runCell:y,setEditorView:l,userConfig:r,editorViewRef:a,editorViewParentRef:m,hidden:!E,hasOutput:M,showHiddenCode:I,languageAdapter:"python",setLanguageAdapter:Bn.NOOP,showLanguageToggles:!1}),i.jsx(gl,{edited:d.edited,status:u.status,isCellStatusInline:!1,uninstantiated:j,disabled:d.config.disabled,runElapsedTimeMs:u.runElapsedTimeMs,runStartTimestamp:u.runStartTimestamp,lastRunStartTimestamp:u.lastRunStartTimestamp,staleInputs:u.staleInputs,interrupted:u.interrupted}),i.jsx("div",{className:"shoulder-bottom hover-action",children:o&&i.jsx(Ff,{connectionState:f.state,status:u.status,onClick:()=>{C||en(f.state)||p({cellId:n})}})})]}),i.jsxs("div",{className:"py-1 px-2 flex justify-end gap-2 last:rounded-b",children:[i.jsx("span",{className:"text-muted-foreground text-xs font-bold",children:"setup cell"}),i.jsx(pe,{content:i.jsxs("span",{className:"max-w-16",children:["This ",i.jsx("b",{children:"setup cell"})," is guaranteed to run before all other cells. Include ",i.jsx("br",{}),"initialization or imports and constants required by top-level functions."]}),children:i.jsx(P1,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),R&&i.jsx(kc,{allowExpand:!0,forceExpand:!0,className:"output-area",cellId:n,output:u.output,stale:!1,loading:C}),i.jsx(cg,{consoleOutputs:u.consoleOutputs,stale:k,cellName:"_",onRefactorWithAI:T,onClear:()=>{b.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:($,W)=>{b.setStdinResponse({cellId:n,response:$,outputIndex:W}),x.sendStdin({text:$})},cellId:n,debuggerActive:u.debuggerActive})]})})})},qf=S.memo(t=>{const{cellId:e,mode:n}=t,o=gj(e);He.debug("Rendering Cell",e);const r=S.useRef(null);return S.useImperativeHandle(o,()=>({get editorView(){return(function(s){const a=s.current;if(a===null)throw new ReferenceError("Attempting to dereference null object.");return a})(r)},get editorViewOrNull(){return r.current}}),[r]),e===Br?i.jsx(Qy,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}}):n==="edit"?i.jsx(Xy,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}}):i.jsx(Vf,{cellId:e})}),Zy=(t,e)=>(function(n,o){const r=/^(\d+)\.(\d+)\.(\d+)(?:-([\w.-]+))?(?:\+([\w.-]+))?$/,s=a=>{const l=a.match(r);if(!l)return null;const[,c,d,u,h]=l;return{major:Number.parseInt(c,10),minor:Number.parseInt(d,10),patch:Number.parseInt(u,10),preRelease:h||""}};try{const a=s(n),l=s(o);return a&&l?a.major!==l.major?a.major-l.major:a.minor!==l.minor?a.minor-l.minor:a.patch!==l.patch?a.patch-l.patch:a.preRelease===""&&l.preRelease!==""?1:a.preRelease!==""&&l.preRelease===""?-1:a.preRelease.localeCompare(l.preRelease):n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}catch{return n.localeCompare(o,void 0,{numeric:!0,sensitivity:"base"})}})(e,t),Hf=new class{constructor(t){this.ttl=void 0,this.cache=new Map,this.ttl=t.ttl}cleanupExpiredEntries(){const t=Date.now();for(const[e,n]of this.cache.entries())t-n.timestamp>this.ttl&&this.cache.delete(e)}get(t){this.cleanupExpiredEntries();const e=this.cache.get(t);if(e){if(!(Date.now()-e.timestamp>this.ttl))return e.data;this.cache.delete(t)}}set(t,e){this.cache.set(t,{data:e,timestamp:Date.now()})}clear(){this.cache.clear()}}({ttl:3e5}),ev=Be({info:Be({provides_extra:Me().array().nullable()}),releases:yj(Me(),vj())});function Jf(t){const e=P.c(5);let n;e[0]!==t?(n=t.replaceAll(/\[.*]/g,"").trim(),e[0]=t,e[1]=n):n=e[1];const o=n;let r,s;return e[2]!==o?(r=async()=>{const a=Hf.get(o);if(a)return a;const l=await fetch(`https://pypi.org/pypi/${o}/json`,{method:"GET"});if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);const c=ev.transform(tv).parse(await l.json());return Hf.set(o,c),c},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),vr(r,s)}function tv(t){return{versions:Object.keys(t.releases).toSorted(Zy),extras:t.info.provides_extra??[]}}function Kf(t){const e=t.match(/^([^[]+)(?:\[([^\]]+)])?$/);if(!e)return{name:t,extras:[]};const[,n,o]=e;return{name:n,extras:o?o.split(",").map(r=>r.trim()):[]}}const nv=()=>{const t=P.c(69),{packageAlert:e,packageLogs:n}=ag(),{clearPackageAlert:o}=ig(),[r]=Zs();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={},t[0]=s):s=t[0];const[a,l]=S.useState(s);let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={},t[1]=c):c=t[1];const[d,u]=S.useState(c);if(e===null)return null;const h=r.package_management.manager!=="pixi";if(jC(e)){let m,f,b,x,p,g,y,w,j,N;if(t[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[i.jsx(Fa,{className:"w-5 h-5 inline-block mr-2"}),"Missing packages"]}),t[2]=m):m=t[2],t[3]!==o||t[4]!==e.id?(f=()=>o(e.id),t[3]=o,t[4]=e.id,t[5]=f):f=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(Vt,{className:"w-5 h-5"}),t[6]=b):b=t[6],t[7]!==f?(x=i.jsxs("div",{className:"flex justify-between",children:[m,i.jsx(ye,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:f,children:b})]}),t[7]=f,t[8]=x):x=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx("p",{children:"The following packages were not found:"}),t[9]=p):p=t[9],t[10]!==a||t[11]!==h||t[12]!==e.packages||t[13]!==d){let C;t[15]!==a||t[16]!==h||t[17]!==d?(C=(k,_)=>{const E=Kf(k),I=d[k]||E.extras;return i.jsxs("tr",{className:"font-mono text-sm",children:[i.jsx("td",{className:"pr-2 py-1 align-middle",children:i.jsx(ja,{size:"1rem"})}),i.jsx("td",{className:"pr-2 py-1 align-middle",children:i.jsx(av,{packageName:E.name,selectedExtras:I,onExtrasChange:A=>u(F=>({...F,[k]:A}))})}),h&&i.jsx("td",{className:"pr-2 py-1 align-middle",children:i.jsx(iv,{value:a[k]??"latest",onChange:A=>l(F=>({...F,[k]:A})),packageName:E.name})})]},_)},t[15]=a,t[16]=h,t[17]=d,t[18]=C):C=t[18],g=e.packages.map(C),t[10]=a,t[11]=h,t[12]=e.packages,t[13]=d,t[14]=g}else g=t[14];return t[19]!==g?(y=i.jsxs("div",{children:[p,i.jsx("table",{className:"list-disc ml-2 mt-1",children:g})]}),t[19]=g,t[20]=y):y=t[20],t[21]!==o||t[22]!==a||t[23]!==e.id||t[24]!==e.isolated||t[25]!==e.packages||t[26]!==d||t[27]!==r.package_management.manager?(w=i.jsx("div",{className:"ml-auto flex flex-row items-baseline",children:e.isolated?i.jsxs(i.Fragment,{children:[i.jsx(rv,{manager:r.package_management.manager,packages:e.packages.map(C=>{const k=Kf(C),_=d[C]||k.extras;return E=k.name,(I=_).length===0?E:`${E}[${I.join(",")}]`;var E,I}),versions:a,clearPackageAlert:()=>o(e.id)}),!Qt()&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"px-2 text-sm",children:"with"})," ",i.jsx(sv,{})]})]}):i.jsxs("p",{children:["If you set up a"," ",i.jsx(Ll,{href:"https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments",children:"virtual environment"}),", marimo can install these packages for you."]})}),t[21]=o,t[22]=a,t[23]=e.id,t[24]=e.isolated,t[25]=e.packages,t[26]=d,t[27]=r.package_management.manager,t[28]=w):w=t[28],t[29]!==y||t[30]!==w?(j=i.jsxs("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:[y,w]}),t[29]=y,t[30]=w,t[31]=j):j=t[31],t[32]!==j||t[33]!==x?(N=i.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95 max-w-[600px]",children:i.jsxs(Lo,{kind:"danger",className:"flex flex-col rounded py-3 px-5 animate-in slide-in-from-left overflow-auto max-h-[80vh] scrollbar-thin",children:[x,j]})}),t[32]=j,t[33]=x,t[34]=N):N=t[34],N}if(CC(e)){let m;t[35]!==e.packages?(m=(function(O){const R=new Set(Object.values(O)),z=R.has("queued")||R.has("installing")?"installing":R.has("failed")?"failed":"installed";return z==="installing"?{status:"installing",title:"Installing packages",titleIcon:i.jsx(Wr,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:z==="installed"?{status:"installed",title:"All packages installed!",titleIcon:i.jsx(ud,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:i.jsx(Fa,{className:"w-5 h-5 inline-block mr-2"}),description:"See error logs."}})(e.packages),t[35]=e.packages,t[36]=m):m=t[36];const{status:f,title:b,titleIcon:x,description:p}=m;f==="installed"&&setTimeout(()=>o(e.id),1e4);const g=f==="failed"?"danger":"info";let y,w,j,N,C;t[37]!==b||t[38]!==x?(y=i.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[x,b]}),t[37]=b,t[38]=x,t[39]=y):y=t[39],t[40]!==o||t[41]!==e.id?(w=()=>o(e.id),t[40]=o,t[41]=e.id,t[42]=w):w=t[42],t[43]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsx(Vt,{className:"w-5 h-5"}),t[43]=j):j=t[43],t[44]!==w?(N=i.jsx(ye,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:w,children:j}),t[44]=w,t[45]=N):N=t[45],t[46]!==y||t[47]!==N?(C=i.jsxs("div",{className:"flex justify-between",children:[y,N]}),t[46]=y,t[47]=N,t[48]=C):C=t[48];const k=f==="installed"&&"text-accent-foreground";let _,E,I,A,F,D,M;return t[49]!==k?(_=ue("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",k),t[49]=k,t[50]=_):_=t[50],t[51]!==p?(E=i.jsx("p",{children:p}),t[51]=p,t[52]=E):E=t[52],t[53]!==e.packages?(I=Object.entries(e.packages),t[53]=e.packages,t[54]=I):I=t[54],t[55]!==f||t[56]!==I?(A=i.jsx("ul",{className:"list-disc ml-2 mt-1",children:I.map((O,R)=>{const[z,T]=O;return i.jsxs("li",{className:ue("flex items-center gap-1 font-mono text-sm",T==="installing"&&"font-semibold",T==="failed"&&"text-destructive",T==="installed"&&"text-accent-foreground",T==="installed"&&f==="failed"&&"text-muted-foreground"),children:[i.jsx(ov,{status:T}),z]},R)})}),t[55]=f,t[56]=I,t[57]=A):A=t[57],t[58]!==n?(F=Object.keys(n).length>0&&i.jsx(lv,{packageLogs:n}),t[58]=n,t[59]=F):F=t[59],t[60]!==_||t[61]!==E||t[62]!==A||t[63]!==F?(D=i.jsxs("div",{className:_,children:[E,A,F]}),t[60]=_,t[61]=E,t[62]=A,t[63]=F,t[64]=D):D=t[64],t[65]!==D||t[66]!==g||t[67]!==C?(M=i.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-12 min-w-[400px] z-200 opacity-95 max-w-[600px] ",children:i.jsxs(Lo,{kind:g,className:"flex flex-col rounded pt-3 pb-4 px-5 overflow-auto max-h-[80vh] scrollbar-thin",children:[C,D]})}),t[65]=D,t[66]=g,t[67]=C,t[68]=M):M=t[68],M}return Bl(e),null},ov=t=>{const e=P.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(ja,{size:"1rem"}),e[0]=o):o=e[0],o}case"installing":{let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Wr,{size:"1rem"}),e[1]=o):o=e[1],o}case"installed":{let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx($l,{size:"1rem"}),e[2]=o):o=e[2],o}case"failed":{let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Vt,{size:"1rem"}),e[3]=o):o=e[3],o}default:return Bl(n),null}},rv=t=>{const e=P.c(10),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t,{sendInstallMissingPackages:a}=qe();let l,c,d,u;return e[0]!==s||e[1]!==n||e[2]!==o||e[3]!==a||e[4]!==r?(l=async()=>{s();const h={...r};for(const m of o)h[m]=h[m]??"";await a({manager:n,versions:h}).catch(cv)},e[0]=s,e[1]=n,e[2]=o,e[3]=a,e[4]=r,e[5]=l):l=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(Wr,{className:"w-4 h-4 mr-2"}),d=i.jsx("span",{className:"font-semibold",children:"Install"}),e[6]=c,e[7]=d):(c=e[6],d=e[7]),e[8]!==l?(u=i.jsxs(ye,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:l,children:[c,d]}),e[8]=l,e[9]=u):u=e[9],u},sv=()=>{const t=P.c(17),[e,n]=Zs(),{saveUserConfig:o}=qe();let r,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ip(wj),t[0]=r):r=t[0],t[1]!==e?(s={resolver:r,defaultValues:e},t[1]=e,t[2]=s):s=t[2];const a=Ap(s);let l;t[3]!==o||t[4]!==n?(l=async f=>{await o({config:f}).then(()=>{n(f)})},t[3]=o,t[4]=n,t[5]=l):l=t[5];const c=l;let d,u,h,m;return t[6]!==a||t[7]!==c?(d=a.handleSubmit(c),t[6]=a,t[7]=c,t[8]=d):d=t[8],t[9]!==a.control?(u=i.jsx("div",{className:"flex flex-col gap-3",children:i.jsx(jp,{control:a.control,name:"package_management.manager",render:uv})}),t[9]=a.control,t[10]=u):u=t[10],t[11]!==d||t[12]!==u?(h=i.jsx("form",{onChange:d,className:"flex flex-col gap-5",children:u}),t[11]=d,t[12]=u,t[13]=h):h=t[13],t[14]!==a||t[15]!==h?(m=i.jsx(kj,{...a,children:h}),t[14]=a,t[15]=h,t[16]=m):m=t[16],m},av=t=>{const e=P.c(12),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,a]=S.useState(!1),{isPending:l,error:c,data:d}=Jf(n);let u;e[0]!==r||e[1]!==o?(u=(b,x)=>{r(x?[...o,b]:o.filter(p=>p!==b))},e[0]=r,e[1]=o,e[2]=u):u=e[2];const h=u,m=!l&&!c;let f;if(e[3]!==m||e[4]!==h||e[5]!==s||e[6]!==n||e[7]!==(d==null?void 0:d.extras)||e[8]!==o){const b=((d==null?void 0:d.extras)??[]).filter(hv);let x;e[10]!==n?(x=i.jsx("span",{className:"shrink-0 flex-1",children:n}),e[10]=n,e[11]=x):x=e[11],f=i.jsxs("div",{className:"flex items-center max-w-72",children:[x,o.length>0?i.jsxs("span",{className:"flex items-center min-w-0 flex-1",children:[i.jsx("span",{className:"shrink-0",children:"["}),i.jsxs(zn,{open:s&&m,onOpenChange:p=>{m&&a(p)},children:[i.jsx(Un,{asChild:!0,children:i.jsx("button",{className:"hover:bg-muted/50 rounded text-sm px-1 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 min-w-0 flex-1 truncate text-left",title:`Selected extras: ${o.join(", ")}`,children:o.join(",")})}),i.jsxs(Wn,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[o.length>0&&i.jsx("div",{className:"p-2 bg-popover border-b border-border",children:i.jsx("div",{className:"flex flex-wrap gap-1 p-1 min-h-[24px]",children:o.map(p=>i.jsxs("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 text-sm font-mono border border-muted-foreground/30 hover:border-muted-foreground/60 rounded-sm cursor-pointer group transition-colors",onClick:()=>h(p,!1),children:[p,i.jsx(Vt,{className:"w-3 h-3 opacity-60 group-hover:opacity-100"})]},p))})}),i.jsx("div",{className:"overflow-y-auto flex-1",children:b.map(p=>i.jsx(W1,{checked:o.includes(p),onCheckedChange:g=>{h(p,g)},className:"font-mono text-sm",onSelect:mv,children:p},p))})]})]}),i.jsx("span",{className:"shrink-0",children:"]"})]}):b.length>0?i.jsxs(zn,{open:s&&m,onOpenChange:p=>{m&&a(p)},children:[i.jsx(Un,{asChild:!0,children:i.jsx("button",{disabled:!m,className:ue("hover:bg-muted/50 rounded text-sm ml-2 transition-colors border border-muted-foreground/30 hover:border-muted-foreground/60 h-5 w-5 flex items-center justify-center p-0",!m&&"opacity-50 cursor-not-allowed"),title:m?"Add extras":"Loading extras...",children:i.jsx(hc,{className:"w-3 h-3 shrink-0"})})}),i.jsxs(Wn,{align:"start",className:"w-64 p-0 max-h-96 flex flex-col",children:[i.jsx("div",{className:"p-2 bg-popover border-b border-border",children:i.jsx("span",{className:"text-muted-foreground italic text-sm",children:"Package extras"})}),i.jsx("div",{className:"overflow-y-auto flex-1",children:b.map(p=>i.jsx(W1,{checked:o.includes(p),onCheckedChange:g=>{h(p,g)},className:"font-mono text-sm",onSelect:fv,children:p},p))})]})]}):null]}),e[3]=m,e[4]=h,e[5]=s,e[6]=n,e[7]=d==null?void 0:d.extras,e[8]=o,e[9]=f}else f=e[9];return f},iv=t=>{const e=P.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:a,data:l}=Jf(r);if(s){let h,m,f;return e[0]!==o?(h=b=>o(b.target.value),e[0]=o,e[1]=h):h=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx("option",{value:"latest",children:"latest"}),e[2]=m):m=e[2],e[3]!==h||e[4]!==n?(f=i.jsx(pe,{content:"Failed to fetch package versions",children:i.jsx(Cc,{value:n,onChange:h,disabled:!0,className:"inline-flex ml-2 w-24 text-ellipsis",children:m})}),e[3]=h,e[4]=n,e[5]=f):f=e[5],f}let c,d,u;return e[6]!==o?(c=h=>o(h.target.value),e[6]=o,e[7]=c):c=e[7],e[8]!==a||e[9]!==l?(d=a?i.jsx("option",{value:"latest",children:"latest"}):["latest",...l.versions.slice(0,100)].map(pv),e[8]=a,e[9]=l,e[10]=d):d=e[10],e[11]!==a||e[12]!==c||e[13]!==d||e[14]!==n?(u=i.jsx(Cc,{value:n,onChange:c,disabled:a,className:"inline-flex ml-2 w-24 text-ellipsis",children:d}),e[11]=a,e[12]=c,e[13]=d,e[14]=n,e[15]=u):u=e[15],u},lv=t=>{const e=P.c(13),{packageLogs:n}=t,[o,r]=S.useState(!0);if(Object.keys(n).length===0)return null;let s,a,l,c,d;return e[0]!==o?(s=()=>r(!o),e[0]=o,e[1]=s):s=e[1],e[2]!==o?(a=o?i.jsx($n,{className:"w-4 h-4"}):i.jsx(pa,{className:"w-4 h-4"}),e[2]=o,e[3]=a):a=e[3],e[4]!==s||e[5]!==a?(l=i.jsxs("button",{onClick:s,className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:[a,"Installation logs"]}),e[4]=s,e[5]=a,e[6]=l):l=e[6],e[7]!==o||e[8]!==n?(c=o&&i.jsx("div",{className:"mt-3 space-y-3 w-full",children:Object.entries(n).map(gv)}),e[7]=o,e[8]=n,e[9]=c):c=e[9],e[10]!==l||e[11]!==c?(d=i.jsxs("div",{className:"mt-4 border-t border-border pt-4 w-full",children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d};function cv(t){He.error(t)}function dv(t){return i.jsx("option",{value:t,children:t},t)}function uv(t){const{field:e}=t;return i.jsxs(Cp,{children:[i.jsx(Np,{children:i.jsx(Cc,{"data-testid":"install-package-manager-select",onChange:n=>e.onChange(n.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:jj.map(dv)})}),i.jsx(_p,{})]})}function hv(t){return!/^(dev|test|testing)$/i.test(t)}function mv(t){return t.preventDefault()}function fv(t){return t.preventDefault()}function pv(t){return i.jsx("option",{value:t,children:t},t)}function gv(t){const[e,n]=t;return i.jsxs("div",{className:"w-full",children:[i.jsx("h4",{className:"font-mono text-sm font-medium mb-2 text-foreground",children:e}),i.jsx("div",{className:"border border-border rounded w-full",children:i.jsx("pre",{className:"p-3 text-xs font-mono bg-background max-h-64 overflow-y-auto text-muted-foreground whitespace-pre-wrap scrollbar-thin",children:n||"No logs available"})})]},e)}const bv=t=>{let{transform:e}=t;return{...e,x:0}},xv={threshold:{x:0,y:.1}},yv=me.memo(t=>{const e=P.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:a,compactColumns:l}=Ye(),[c,d]=S.useState(null),[u,h]=S.useState(null),[m]=Cj();let f;e:{if(m.width==="columns"){f=Nj.EMPTY;break e}let M;e[0]===Symbol.for("react.memo_cache_sentinel")?(M=[bv],e[0]=M):M=e[0],f=M}const b=f;let x,p;e[1]===Symbol.for("react.memo_cache_sentinel")?(x={activationConstraint:{distance:8}},e[1]=x):x=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(p={coordinateGetter:Sx},e[2]=p):p=e[2];const g=(function(){for(var M=arguments.length,O=new Array(M),R=0;R<M;R++)O[R]=arguments[R];return S.useMemo(()=>[...O].filter(z=>z!=null),[...O])})(xu(gi,x),xu(fi,p));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=M=>{d(M.active.id);const O=Mt();h(O.cellIds)},e[3]=y):y=e[3];const w=Ce(y);let j;e[4]!==u?(j=()=>{d(null),h(null)},e[4]=u,e[5]=j):j=e[5];const N=Ce(j);let C;e[6]!==c?(C=M=>{const O=M.droppableContainers.filter(vv);if(c&&Co(c))return ci({...M,droppableContainers:O});const R=(W=>{let{droppableContainers:G,droppableRects:X,pointerCoordinates:H}=W;if(!H)return[];const Y=[];for(const K of G){const{id:V}=K,q=X.get(V);if(q&&Vb(H,q)){const U=ii(q).reduce((Q,ee)=>Q+si(H,ee),0),ne=Number((U/4).toFixed(4));Y.push({id:V,data:{droppableContainer:K,value:ne}})}}return Y.sort(ai)})({...M,droppableContainers:O}),z=li(R.length>0?R:vu({...M,droppableContainers:O}),"id");if(!z)return[];Zt(Co(z),`Expected column id. Got: ${z}`);const T=Mt().cellIds.get(z);if(Zt(T,`Expected column. Got: ${z}`),T&&T.topLevelIds.length===0)return[{id:z}];const L=new Set(T.topLevelIds),$=ci({...M,droppableContainers:M.droppableContainers.filter(W=>W.id!==z&&L.has(W.id))});if($.length>0){const W=$[0].id;return Zt(xl(W),`Expected cell id. Got: ${W}`),[{id:W}]}return[]},e[6]=c,e[7]=C):C=e[7];const k=C;let _;e[8]!==r||e[9]!==s||e[10]!==a?(_=M=>{const{active:O,over:R}=M,z=R==null?void 0:R.id;if(z!=null&&O.id!==z){if(xl(O.id)){if(Co(z))return void s({cellId:O.id,columnId:z});if(xl(z))return void r({cellId:O.id,overCellId:z})}Co(O.id)&&Co(z)&&a({column:O.id,overColumn:z})}},e[8]=r,e[9]=s,e[10]=a,e[11]=_):_=e[11];const E=Ce(_);let I;e[12]!==l?(I=M=>{const{active:O,over:R}=M;R!==null&&O.id!==R.id&&l()},e[12]=l,e[13]=I):I=e[13];const A=Ce(I),F=o?k:ci;let D;return e[14]!==n||e[15]!==N||e[16]!==A||e[17]!==E||e[18]!==w||e[19]!==b||e[20]!==g||e[21]!==F?(D=i.jsx(mx,{autoScroll:xv,sensors:g,collisionDetection:F,modifiers:b,onDragEnd:A,onDragStart:w,onDragCancel:N,onDragOver:E,children:n}),e[14]=n,e[15]=N,e[16]=A,e[17]=E,e[18]=w,e[19]=b,e[20]=g,e[21]=F,e[22]=D):D=e[22],D});function xl(t){return typeof t=="string"&&!t.startsWith("tree_")}function Co(t){return typeof t=="string"&&t.startsWith("tree_")}function vv(t){return Co(t.id)}const wv=t=>{const e=P.c(13),{className:n,size:o,gap:r,durationMs:s}=t,a=o===void 0?8:o,l=r===void 0?"gap-1":r,c=s===void 0?1200:s,d=`${c}ms`;let u;e[0]!==d?(u={animationDuration:d},e[0]=d,e[1]=u):u=e[1];const h=u;let m,f,b,x;return e[2]!==n||e[3]!==l?(m=ya("flex",l,n),e[2]=n,e[3]=l,e[4]=m):m=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(f=[0,1,2],e[5]=f):f=e[5],e[6]!==h||e[7]!==c||e[8]!==a?(b=f.map(p=>i.jsx(Sj,{width:a,height:a,className:"fill-current text-current animate-ellipsis-dot",style:{...h,animationDelay:c/3*p+"ms"}},p)),e[6]=h,e[7]=c,e[8]=a,e[9]=b):b=e[9],e[10]!==m||e[11]!==b?(x=i.jsx("div",{className:m,"aria-label":"Loading",children:b}),e[10]=m,e[11]=b,e[12]=x):x=e[12],x},Yf=t=>{const e=P.c(11),{title:n,children:o,show:r,delayMs:s,kind:a}=t,l=s===void 0?2e3:s,c=a===void 0?"info":a;if(!r)return null;let d,u,h;e[0]!==n?(d=n&&i.jsx("div",{className:"flex justify-between",children:i.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:n})}),e[0]=n,e[1]=d):d=e[1],e[2]!==o?(u=i.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:i.jsx("div",{children:o})}),e[2]=o,e[3]=u):u=e[3],e[4]!==c||e[5]!==d||e[6]!==u?(h=i.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:i.jsxs(Lo,{kind:c,className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[d,u]})}),e[4]=c,e[5]=d,e[6]=u,e[7]=h):h=e[7];const m=h;let f;return e[8]!==m||e[9]!==l?(f=i.jsx(xa,{milliseconds:l,children:m}),e[8]=m,e[9]=l,e[10]=f):f=e[10],f},kv=()=>{const t=P.c(3),e=ie(Ej),n=ie(_j);let o;return t[0]!==n||t[1]!==e?(o=e&&i.jsxs(i.Fragment,{children:[i.jsx(xa,{milliseconds:1e3,children:i.jsx("div",{className:"absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-200 ",children:i.jsx(pe,{content:"Connecting to a marimo runtime",children:i.jsx("div",{className:"flex items-center",children:i.jsx(wv,{size:5,className:"text-yellow-500"})})})})}),i.jsx(Yf,{show:e,delayMs:5e3,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(va,{className:"h-4 w-4"}),i.jsx("p",{children:"Connecting to a marimo runtime ..."})]})})]})||n&&i.jsx(Yf,{show:n,kind:"danger",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("p",{children:"Failed to connect."})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o},Xf=me.forwardRef((t,e)=>{const n=P.c(60),{columnId:o,canDelete:r,canMoveLeft:s,canMoveRight:a,footer:l,...c}=t;let d;n[0]!==o?(d={id:o},n[0]=o,n[1]=d):d=n[1];const{attributes:u,listeners:h,setNodeRef:m,transform:f,transition:b,isDragging:x,isOver:p}=Ku(d);let g;n[2]!==f?(g=f?da.Transform.toString({x:f.x,y:0,scaleX:1,scaleY:1}):void 0,n[2]=f,n[3]=g):g=n[3];const y=x?2:void 0;let w;n[4]!==g||n[5]!==y||n[6]!==b?(w={transform:g,transition:b,zIndex:y,position:"relative","--gutter-width":"50px"},n[4]=g,n[5]=y,n[6]=b,n[7]=w):w=n[7];const j=w,{deleteColumn:N,moveColumn:C,addColumn:k}=Ye(),_=Cv;let E;n[8]!==o||n[9]!==C?(E=()=>C({column:o,overColumn:"_left_"}),n[8]=o,n[9]=C,n[10]=E):E=n[10];const I=!s;let A,F,D;n[11]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(x1,{className:"size-4"}),n[11]=A):A=n[11],n[12]!==E||n[13]!==I?(F=i.jsx(pe,{content:"Move column left",side:"top",delayDuration:300,children:i.jsx(ye,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:E,disabled:I,children:A})}),n[12]=E,n[13]=I,n[14]=F):F=n[14],n[15]!==o||n[16]!==C?(D=()=>C({column:o,overColumn:"_right_"}),n[15]=o,n[16]=C,n[17]=D):D=n[17];const M=!a;let O,R,z,T,L,$;n[18]===Symbol.for("react.memo_cache_sentinel")?(O=i.jsx(pa,{className:"size-4"}),n[18]=O):O=n[18],n[19]!==M||n[20]!==D?(R=i.jsx(pe,{content:"Move column right",side:"top",delayDuration:300,children:i.jsx(ye,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:D,disabled:M,children:O})}),n[19]=M,n[20]=D,n[21]=R):R=n[21],n[22]===Symbol.for("react.memo_cache_sentinel")?(z=i.jsx(Ij,{className:"size-4 opacity-0 group-hover:opacity-50 transition-opacity duration-200"}),n[22]=z):z=n[22],n[23]!==u||n[24]!==h?(T=i.jsx("div",{className:"flex gap-2 h-full grow cursor-grab active:cursor-grabbing items-center justify-center","data-testid":"column-drag-spacer",...u,...h,children:z}),n[23]=u,n[24]=h,n[25]=T):T=n[25],n[26]===Symbol.for("react.memo_cache_sentinel")?(L=i.jsx(Un,{asChild:!0,children:i.jsx(ye,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",children:i.jsx(Ca,{className:"size-4"})})}),n[26]=L):L=n[26],n[27]!==o||n[28]!==N?($=()=>N({columnId:o}),n[27]=o,n[28]=N,n[29]=$):$=n[29];const W=!r;let G,X,H,Y,K,V;n[30]===Symbol.for("react.memo_cache_sentinel")?(G=i.jsx(Vt,{className:"mr-2 size-4"}),n[30]=G):G=n[30],n[31]!==$||n[32]!==W?(X=i.jsxs(zn,{children:[L,i.jsx(Wn,{align:"end",children:i.jsxs(lo,{onClick:$,disabled:W,children:[G,"Delete column"]})})]}),n[31]=$,n[32]=W,n[33]=X):X=n[33],n[34]!==k||n[35]!==o?(H=()=>{k({columnId:o}),requestAnimationFrame(_)},n[34]=k,n[35]=o,n[36]=H):H=n[36],n[37]===Symbol.for("react.memo_cache_sentinel")?(Y=i.jsx(hc,{className:"size-4"}),n[37]=Y):Y=n[37],n[38]!==H?(K=i.jsx(pe,{content:"Add column",side:"top",delayDuration:300,children:i.jsx(ye,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:H,children:Y})}),n[38]=H,n[39]=K):K=n[39],n[40]!==R||n[41]!==T||n[42]!==X||n[43]!==K||n[44]!==F?(V=i.jsxs("div",{className:"px-2 pt-3 pb-0 group flex items-center rounded-t-lg overflow-hidden",children:[F,R,T,X,K]}),n[40]=R,n[41]=T,n[42]=X,n[43]=K,n[44]=F,n[45]=V):V=n[45];const q=V;let U;n[46]!==e||n[47]!==m?(U=oe=>{Rs(e,m)(oe)},n[46]=e,n[47]=m,n[48]=U):U=n[48];const ne=ue(x?"":c.className,x?"z-20":"z-1 hover:z-10 focus-within:z-10",p&&"bg-accent/20");let Q,ee;return n[49]!==q||n[50]!==c.children?(Q=i.jsxs("div",{className:"bg-(--slate-1) rounded-lg",children:[q,c.children]}),n[49]=q,n[50]=c.children,n[51]=Q):Q=n[51],n[52]!==l||n[53]!==x||n[54]!==c||n[55]!==j||n[56]!==U||n[57]!==ne||n[58]!==Q?(ee=i.jsxs("div",{tabIndex:-1,ref:U,...c,style:j,"data-is-dragging":x,className:ne,children:[Q,l]}),n[52]=l,n[53]=x,n[54]=c,n[55]=j,n[56]=U,n[57]=ne,n[58]=Q,n[59]=ee):ee=n[59],ee});Xf.displayName="SortableColumn";const jv=S.memo(Xf);function Cv(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:Nv,saveColumnWidth:Sv}=Aj,Qf=S.memo(t=>{const e=P.c(20),n=S.useRef(null);if(t.width==="columns"){const s=t.canDelete,a=t.columnId,l=t.canMoveLeft,c=t.canMoveRight,d=t.footer;let u,h,m,f;return e[0]!==t.index?(u=Nv(t.index),e[0]=t.index,e[1]=u):u=e[1],e[2]!==t.index?(h=b=>{Sv(t.index,b)},e[2]=t.index,e[3]=h):h=e[3],e[4]!==t.children||e[5]!==u||e[6]!==h?(m=i.jsx(Ev,{startingWidth:u,onResize:h,children:t.children}),e[4]=t.children,e[5]=u,e[6]=h,e[7]=m):m=e[7],e[8]!==t.canDelete||e[9]!==t.canMoveLeft||e[10]!==t.canMoveRight||e[11]!==t.columnId||e[12]!==t.footer||e[13]!==m?(f=i.jsx(jv,{tabIndex:-1,ref:n,canDelete:s,columnId:a,canMoveLeft:l,canMoveRight:c,className:"group/column",footer:d,children:m}),e[8]=t.canDelete,e[9]=t.canMoveLeft,e[10]=t.canMoveRight,e[11]=t.columnId,e[12]=t.footer,e[13]=m,e[14]=f):f=e[14],f}let o,r;return e[15]!==t.children?(o=i.jsx("div",{"data-testid":"cell-column",className:"flex flex-col gap-5",children:t.children}),e[15]=t.children,e[16]=o):o=e[16],e[17]!==t.footer||e[18]!==o?(r=i.jsxs(i.Fragment,{children:[o,t.footer]}),e[17]=t.footer,e[18]=o,e[19]=r):r=e[19],r});Qf.displayName="Column";const Ev=t=>{const e=P.c(15),{startingWidth:n,onResize:o,children:r}=t;let s;e[0]!==o||e[1]!==n?(s={startingWidth:n,onResize:o},e[0]=o,e[1]=n,e[2]=s):s=e[2];const{resizableDivRef:a,handleRefs:l,style:c}=Tj(s),d=_v;let u,h,m,f;return e[3]!==l.left?(u=d(l.left),e[3]=l.left,e[4]=u):u=e[4],e[5]!==r||e[6]!==a||e[7]!==c?(h=i.jsx("div",{ref:a,className:"flex flex-col gap-5 box-content min-h-[100px] px-11 pt-3 pb-6 min-w-[500px] z-1",style:c,children:r}),e[5]=r,e[6]=a,e[7]=c,e[8]=h):h=e[8],e[9]!==l.right?(m=d(l.right),e[9]=l.right,e[10]=m):m=e[10],e[11]!==u||e[12]!==h||e[13]!==m?(f=i.jsxs("div",{className:"flex flex-row",children:[u,h,m]}),e[11]=u,e[12]=h,e[13]=m,e[14]=f):f=e[14],f};function _v(t){return i.jsx("div",{ref:t,className:`w-[3px] cursor-col-resize transition-colors duration-200 z-100
|
|
124
|
-
relative before:content-[''] before:absolute before:inset-y-0 before:-left-[3px]
|
|
125
|
-
before:right-[-3px] before:w-[9px] before:z-[-1]
|
|
126
|
-
hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
|
|
127
|
-
hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`})}const Iv=t=>{const e=P.c(10),{width:n}=t,{banners:o}=NC(),{removeBanner:r}=SC();if(o.length===0)return null;const s=n==="columns"&&"sticky left-12 w-full max-w-[80vw]";let a,l,c;if(e[0]!==s?(a=ue("flex flex-col gap-4 mb-5 print:hidden",s),e[0]=s,e[1]=a):a=e[1],e[2]!==o||e[3]!==r){let d;e[5]!==r?(d=u=>i.jsxs(Lo,{kind:u.variant||"info",className:"flex flex-col rounded p-3",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsxs("span",{className:"font-bold text-lg flex items-center mb-2",children:[i.jsx($1,{className:"w-5 h-5 inline-block mr-2"}),u.title]}),i.jsx(ye,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(u.id),children:i.jsx(Vt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex justify-between items-end",children:[i.jsx("span",{children:Dj({html:u.description})}),u.action==="restart"&&i.jsx(Av,{})]})]},u.id),e[5]=r,e[6]=d):d=e[6],l=o.map(d),e[2]=o,e[3]=r,e[4]=l}else l=e[4];return e[7]!==a||e[8]!==l?(c=i.jsx("div",{className:a,children:l}),e[7]=a,e[8]=l,e[9]=c):c=e[9],c},Av=()=>{const t=P.c(3),e=ou();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(Mc,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=i.jsxs(ye,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},Tv=Bt(t=>{const e=t(Gt);for(const n of e.cellIds.inOrderIds){const o=e.cellRuntime[n];if(o.status==="idle"&&o.consoleOutputs.some(r=>r.channel==="stdin"&&r.response===void 0))return!0}return!1}),Dv=()=>{const t=P.c(3),e=Mv;if(!ie(Tv))return null;let n,o,r;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("div",{className:"flex justify-between",children:i.jsx("span",{className:"font-bold text-lg flex items-center mb-1",children:"Program waiting for input"})}),t[0]=n):n=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(l1,{className:"inline",children:"stdin"}),t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")){const s=i.jsx("div",{className:"flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-200 opacity-95",children:i.jsxs(Lo,{kind:"info",className:"flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit",children:[n,i.jsx("div",{className:"flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",children:i.jsx("div",{children:i.jsxs("p",{children:["The program is still running, but blocked on"," ",o,".",i.jsx(ye,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=i.jsx(xa,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function Mv(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):He.error("No element with data-stdin-blocking found")}function Ov(){const t=setTimeout(Rv,100);return()=>clearTimeout(t)}function Rv(){requestAnimationFrame(Lv)}function Lv(){const t=(function(e){const n=e.match(/scrollTo=([^&]+)/),o=n==null?void 0:n[1];return o?decodeURIComponent(o.split("&")[0]):null})(window.location.hash);if(t)(function(e){var o,r;if(ep)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),ep=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=Mt(),a=n.dataset.cellId;if(!a)return void He.error(`Missing cellId for cell with name ${e}`);const l=(r=(o=s[a])==null?void 0:o.current)==null?void 0:r.editorView;l&&l.focus()}}else He.warn(`Cannot focus cell with name ${e} because it was not found`),Zf()})(t);else try{Zf()}catch(e){const n=e;He.warn("Error focusing first editor",n)}}function Zf(){var o,r;const{cellIds:t,cellData:e,cellHandles:n}=Mt();for(const s of t.iterateTopLevelIds){const a=n[s];if(!((o=e[s])==null?void 0:o.config.hide_code)&&((r=a==null?void 0:a.current)!=null&&r.editorView))return void a.current.editorView.focus()}}let ep=!1;const Fv=t=>{const e=P.c(8),n=ie(Mj),o=t.appConfig.width==="columns";let r,s,a;return e[0]!==t?(r=i.jsx(Bv,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=i.jsx(Hu,{id:"column-container",items:n,strategy:xx,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(a=i.jsx(yv,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=a):a=e[7],a},Bv=t=>{const e=P.c(28),{mode:n,userConfig:o,appConfig:r}=t,s=Ye(),{theme:a}=S1(),{toggleSidebarPanel:l}=wr();V1(Ov),st("global.focusTop",s.focusTopCell),st("global.focusBottom",s.focusBottomCell),st("global.toggleSidebar",l),st("global.foldCode",s.foldAll),st("global.unfoldCode",s.unfoldAll),st("global.formatAll",Uv),st("cell.hideCode",Bn.NOOP),st("cell.format",Bn.NOOP);const c=Nc(),d=Oj(),u=c.getColumnIds(),h=s.scrollToTarget;let m,f;e[0]!==d||e[1]!==h?(m=()=>{d!==null&&h()},e[0]=d,e[1]=h,e[2]=m):m=e[2],e[3]!==c||e[4]!==d||e[5]!==h?(f=[c,d,h],e[3]=c,e[4]=d,e[5]=h,e[6]=f):f=e[6],S.useEffect(m,f);const b=EC;let x,p,g,y,w;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(nv,{}),p=i.jsx(Ex,{}),g=i.jsx(Dv,{}),y=i.jsx(kv,{}),e[7]=x,e[8]=p,e[9]=g,e[10]=y):(x=e[7],p=e[8],g=e[9],y=e[10]),e[11]!==r.width?(w=i.jsx(Iv,{width:r.width}),e[11]=r.width,e[12]=w):w=e[12];const j=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";let N;e[13]!==j?(N=ue(j),e[13]=j,e[14]=N):N=e[14];const C=u.map((I,A)=>i.jsx(Pv,{columnId:I,index:A,columnsLength:u.length,appConfig:r,mode:n,userConfig:o,theme:a},I));let k,_,E;return e[15]!==N||e[16]!==C?(k=i.jsx("div",{className:N,children:C}),e[15]=N,e[16]=C,e[17]=k):k=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(_=i.jsx(_C,{}),e[18]=_):_=e[18],e[19]!==b||e[20]!==r||e[21]!==w||e[22]!==k||e[23]!==x||e[24]!==p||e[25]!==g||e[26]!==y?(E=i.jsxs(b,{className:"pb-[40vh]",invisible:!1,appConfig:r,innerClassName:"pr-4",children:[x,p,g,y,w,k,_]}),e[19]=b,e[20]=r,e[21]=w,e[22]=k,e[23]=x,e[24]=p,e[25]=g,e[26]=y,e[27]=E):E=e[27],E},Pv=t=>{const e=P.c(54),{columnId:n,index:o,columnsLength:r,appConfig:s,mode:a,userConfig:l,theme:c}=t,d=Nc();let u,h,m,f,b,x,p,g,y,w,j,N,C,k,_,E;if(e[0]!==s.width||e[1]!==d||e[2]!==n||e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==c||e[7]!==l){const I=d.get(n);let A;Zt(I,`Expected column for: ${n}`),e[22]!==d?(A=d.hasOnlyOneId(),e[22]=d,e[23]=A):A=e[23];const F=A;let D;e[24]!==d.inOrderIds?(D=d.inOrderIds.includes(Br),e[24]=d.inOrderIds,e[25]=D):D=e[25];const M=D;h=Qf,j=n,N=o,C=o>0,k=o<r-1,f=s.width,b=r>1;const O=s.width==="columns"&&"opacity-0 group-hover/column:opacity-100";let R;e[26]!==O?(R=ue(O),e[26]=O,e[27]=R):R=e[27],e[28]!==n||e[29]!==R?(x=i.jsx(zv,{columnId:n,className:R}),e[28]=n,e[29]=R,e[30]=x):x=e[30],u=Hu,m=`column-${o+1}`,p=I.topLevelIds,g=yx,e[31]!==M||e[32]!==o||e[33]!==a||e[34]!==c||e[35]!==l?(y=o===0&&M&&i.jsx(qf,{cellId:Br,theme:c,showPlaceholder:!1,canDelete:!0,mode:a,userConfig:l,isCollapsed:!1,collapseCount:0,canMoveX:!1},Br),e[31]=M,e[32]=o,e[33]=a,e[34]=c,e[35]=l,e[36]=y):y=e[36],w=I.topLevelIds.map(z=>z===Br?null:i.jsx(qf,{cellId:z,theme:c,showPlaceholder:F,canDelete:!F,mode:a,userConfig:l,isCollapsed:I.isCollapsed(z),collapseCount:I.getCount(z),canMoveX:s.width==="columns"},z)),e[0]=s.width,e[1]=d,e[2]=n,e[3]=r,e[4]=o,e[5]=a,e[6]=c,e[7]=l,e[8]=u,e[9]=h,e[10]=m,e[11]=f,e[12]=b,e[13]=x,e[14]=p,e[15]=g,e[16]=y,e[17]=w,e[18]=j,e[19]=N,e[20]=C,e[21]=k}else u=e[8],h=e[9],m=e[10],f=e[11],b=e[12],x=e[13],p=e[14],g=e[15],y=e[16],w=e[17],j=e[18],N=e[19],C=e[20],k=e[21];return e[37]!==u||e[38]!==m||e[39]!==p||e[40]!==g||e[41]!==y||e[42]!==w?(_=i.jsxs(u,{id:m,items:p,strategy:g,children:[y,w]}),e[37]=u,e[38]=m,e[39]=p,e[40]=g,e[41]=y,e[42]=w,e[43]=_):_=e[43],e[44]!==h||e[45]!==f||e[46]!==b||e[47]!==x||e[48]!==_||e[49]!==j||e[50]!==N||e[51]!==C||e[52]!==k?(E=i.jsx(h,{columnId:j,index:N,canMoveLeft:C,canMoveRight:k,width:f,canDelete:b,footer:x,children:_}),e[44]=h,e[45]=f,e[46]=b,e[47]=x,e[48]=_,e[49]=j,e[50]=N,e[51]=C,e[52]=k,e[53]=E):E=e[53],E},zv=t=>{const e=P.c(17),{columnId:n,className:o}=t,{createNewCell:r}=Ye(),[s,a]=Rj(!1),l=ie(pc),c=ie(Yp);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=ue("mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap","hover:bg-accent hover:text-accent-foreground font-semibold uppercase text-xs"),e[0]=d):d=e[0];const u=d;let h;e[1]!==l||e[2]!==n||e[3]!==r||e[4]!==s||e[5]!==a.toggle||e[6]!==c?(h=()=>s?i.jsx(Lj,{onClose:a.toggle}):i.jsxs(i.Fragment,{children:[i.jsxs(ye,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[i.jsx(pd,{className:"mr-2 size-4 shrink-0"}),"Python"]}),i.jsxs(ye,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{Gn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Xs().defaultCode,hideCode:!0})},children:[i.jsx(bd,{className:"mr-2 size-4 shrink-0"}),"Markdown"]}),i.jsxs(ye,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{Gn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new fc().defaultCode})},children:[i.jsx(_o,{className:"mr-2 size-4 shrink-0"}),"SQL"]}),i.jsx(pe,{content:l?null:i.jsx("span",{children:"Enable via settings under AI Assist"}),delayDuration:100,asChild:!1,children:i.jsxs(ye,{className:u,variant:"text",size:"sm",disabled:!l||!c,onClick:a.toggle,children:[i.jsx(Or,{className:"mr-2 size-4 shrink-0"}),"Generate with AI"]})})]}),e[1]=l,e[2]=n,e[3]=r,e[4]=s,e[5]=a.toggle,e[6]=c,e[7]=h):h=e[7];const m=h,f=!s&&"w-fit",b=s&&"opacity-100 w-full max-w-4xl shadow-lg shadow-(color:--blue-3)";let x,p,g;return e[8]!==o||e[9]!==f||e[10]!==b?(x=ue("shadow-sm border border-border rounded transition-all duration-200 overflow-hidden divide-x divide-border flex",f,b,o),e[8]=o,e[9]=f,e[10]=b,e[11]=x):x=e[11],e[12]!==m?(p=m(),e[12]=m,e[13]=p):p=e[13],e[14]!==x||e[15]!==p?(g=i.jsx("div",{className:"flex justify-center mt-4 pt-6 pb-32 group gap-4 w-full print:hidden",children:i.jsx("div",{className:x,children:p})}),e[14]=x,e[15]=p,e[16]=g):g=e[16],g};function Uv(){qp()}const Wv=Fj(t=>c1().syncCellIds(t),400),$v=(t,e)=>{Le.get(To)||t.isEmpty()||e.isEmpty()||kr(t.inOrderIds,e.inOrderIds)||Wv({cell_ids:t.inOrderIds})},tp=t=>{const e=P.c(70),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;Bj(ba,$v);const{setCells:a,mergeAllColumns:l,collapseAllCells:c,expandAllCells:d}=Ye(),u=ie(El),h=ie(Pj),m=ie(zj),f=Ul(),b=Ct(ei),{sendComponentValues:x,sendInterrupt:p}=qe(),g=u.mode==="edit",y=u.mode==="present",w=ie(Uj);let j,N;e[0]!==x?(j=()=>(dg.INSTANCE.start(x),Vv),e[0]=x,e[1]=j):j=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[2]=N):N=e[2],S.useEffect(j,N);const C=n.runtime.auto_instantiate;let k,_,E;e[3]!==a||e[4]!==b?(k=(te,_e)=>{a(te);const he=te.map(Gv),we=te.map(qv),ke=te.map(Hv);b({names:he,codes:we,configs:ke,layout:_e})},e[3]=a,e[4]=b,e[5]=k):k=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=j1(),e[6]=_):_=e[6],e[7]!==k||e[8]!==n.runtime.auto_instantiate?(E={autoInstantiate:C,setCells:k,sessionId:_},e[7]=k,e[8]=n.runtime.auto_instantiate,e[9]=E):E=e[9];const{connection:I}=IC(E);let A,F;e[10]!==o.app_title||e[11]!==f?(A=()=>{document.title=o.app_title||Ot.basename(f??"")||"Untitled Notebook"},F=[o.app_title,f],e[10]=o.app_title,e[11]=f,e[12]=A,e[13]=F):(A=e[12],F=e[13]),S.useEffect(A,F);const D=ca(o.width);let M,O;e[14]!==o.width||e[15]!==l||e[16]!==D?(M=()=>{D==="columns"&&o.width!=="columns"&&l()},e[14]=o.width,e[15]=l,e[16]=D,e[17]=M):M=e[17],e[18]!==o.width||e[19]!==l||e[20]!==h||e[21]!==D?(O=[o.width,D,l,h],e[18]=o.width,e[19]=l,e[20]=h,e[21]=D,e[22]=O):O=e[22],S.useEffect(M,O);const R=(function(){const te=P.c(2),_e=qo();let he;return te[0]!==_e?(he=()=>_e(hk(Mt())),te[0]=_e,te[1]=he):he=te[1],Ce(he)})(),z=Ad(),T=Id();let L,$,W,G,X,H,Y;e[23]!==R?(L=()=>{R()},e[23]=R,e[24]=L):L=e[24],st("global.runStale",L),e[25]!==p?($=()=>{p()},e[25]=p,e[26]=$):$=e[26],st("global.interrupt",$),e[27]!==T?(W=()=>{T()},e[27]=T,e[28]=W):W=e[28],st("global.hideCode",W),e[29]!==z?(G=()=>{z()},e[29]=z,e[30]=G):G=e[30],st("global.runAll",G),e[31]!==c?(X=()=>{c()},e[31]=c,e[32]=X):X=e[32],st("global.collapseAllSections",X),e[33]!==d?(H=()=>{d()},e[33]=d,e[34]=H):H=e[34],st("global.expandAllSections",H),e[35]!==o||e[36]!==n||e[37]!==u.mode?(Y=i.jsx(Fv,{mode:u.mode,userConfig:n,appConfig:o}),e[35]=o,e[36]=n,e[37]=u.mode,e[38]=Y):Y=e[38];const K=Y,V=o.width;let q,U,ne,Q,ee,oe,se,ae;return e[39]===Symbol.for("react.memo_cache_sentinel")?(q=ue("pt-4 sm:pt-12 pb-2 mb-4 print:hidden z-50","sticky left-0"),e[39]=q):q=e[39],e[40]!==f||e[41]!==g?(U=g&&i.jsx("div",{className:"flex items-center justify-center container",children:i.jsx(wb,{filename:f})}),e[40]=f,e[41]=g,e[42]=U):U=e[42],e[43]!==I||e[44]!==U?(ne=i.jsx(TC,{connection:I,className:q,children:U}),e[43]=I,e[44]=U,e[45]=ne):ne=e[45],e[46]!==o||e[47]!==K||e[48]!==m||e[49]!==u.mode?(Q=m&&i.jsx(AC,{appConfig:o,mode:u.mode,children:K}),e[46]=o,e[47]=K,e[48]=m,e[49]=u.mode,e[50]=Q):Q=e[50],e[51]!==o.width||e[52]!==I||e[53]!==w||e[54]!==ne||e[55]!==Q?(ee=i.jsxs(DC,{connection:I,isRunning:w,width:V,children:[ne,Q]}),e[51]=o.width,e[52]=I,e[53]=w,e[54]=ne,e[55]=Q,e[56]=ee):ee=e[56],e[57]===Symbol.for("react.memo_cache_sentinel")?(oe=i.jsx(Db,{}),e[57]=oe):oe=e[57],e[58]!==o||e[59]!==I||e[60]!==s||e[61]!==y||e[62]!==w||e[63]!==R||e[64]!==p||e[65]!==T?(se=!s&&i.jsx(wa,{children:i.jsx(gb,{presenting:y,onTogglePresenting:T,onInterrupt:p,onRun:R,connectionState:I.state,running:w,appConfig:o})}),e[58]=o,e[59]=I,e[60]=s,e[61]=y,e[62]=w,e[63]=R,e[64]=p,e[65]=T,e[66]=se):se=e[66],e[67]!==ee||e[68]!==se?(ae=i.jsxs(i.Fragment,{children:[ee,oe,se]}),e[67]=ee,e[68]=se,e[69]=ae):ae=e[69],ae};function Vv(){dg.INSTANCE.stop()}function Gv(t){return t.name}function qv(t){return t.code}function Hv(t){return t.config}const np=t=>ie(Wj)[t.capability]?t.children:null,At=S.forwardRef((t,e)=>{const n=P.c(18);let o,r,s,a,l;n[0]!==t?({children:o,tooltip:l,selected:a,className:r,...s}=t,n[0]=t,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=l):(o=n[1],r=n[2],s=n[3],a=n[4],l=n[5]);const c=!a&&"hover:bg-(--sage-3)",d=a&&"bg-(--sage-4)";let u,h;n[6]!==r||n[7]!==c||n[8]!==d?(u=ue("h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",c,d,r),n[6]=r,n[7]=c,n[8]=d,n[9]=u):u=n[9],n[10]!==o||n[11]!==e||n[12]!==s||n[13]!==u?(h=i.jsx("div",{ref:e,className:u,...s,children:o}),n[10]=o,n[11]=e,n[12]=s,n[13]=u,n[14]=h):h=n[14];const m=h;if(l){let f;return n[15]!==m||n[16]!==l?(f=i.jsx(pe,{content:l,side:"top",delayDuration:200,children:m}),n[15]=m,n[16]=l,n[17]=f):f=n[17],f}return m});At.displayName="FooterItem";const Jv=()=>{var f,b;const t=P.c(17),e=ie($j),n=ie(pc),o=((f=e==null?void 0:e.models)==null?void 0:f.chat_model)||Vj,r=((b=e==null?void 0:e.models)==null?void 0:b.edit_model)||o,{handleClick:s}=X1();if(!n){let x,p,g;return t[0]!==s?(x=()=>s("ai"),t[0]=s,t[1]=x):x=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Or,{className:"h-4 w-4 opacity-60"}),t[2]=p):p=t[2],t[3]!==x?(g=i.jsx(At,{tooltip:"Assist is disabled",selected:!1,onClick:x,"data-testid":"footer-ai-disabled",children:p}),t[3]=x,t[4]=g):g=t[4],g}let a,l,c,d,u,h,m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx("b",{children:"Chat model:"}),t[5]=a):a=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx("br",{}),c=i.jsx("b",{children:"Edit model:"}),t[6]=l,t[7]=c):(l=t[6],c=t[7]),t[8]!==o||t[9]!==r?(d=i.jsxs(i.Fragment,{children:[a," ",o,l,c," ",r]}),t[8]=o,t[9]=r,t[10]=d):d=t[10],t[11]!==s?(u=()=>s("ai"),t[11]=s,t[12]=u):u=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx(Or,{className:"h-4 w-4"}),t[13]=h):h=t[13],t[14]!==d||t[15]!==u?(m=i.jsx(At,{tooltip:d,onClick:u,selected:!1,"data-testid":"footer-ai-enabled",children:h}),t[14]=d,t[15]=u,t[16]=m):m=t[16],m},Kv=()=>{const t=P.c(26),e=ie(Nt).state,n=N1();let o,r;t[0]!==e||t[1]!==n?(o=async()=>{if(e===ht.OPEN){if(Qt())return{isHealthy:!0,lastChecked:new Date,error:void 0};try{return{isHealthy:await n.isHealthy(),lastChecked:new Date,error:void 0}}catch(j){const N=j;return{isHealthy:!1,lastChecked:new Date,error:N instanceof Error?N.message:"Unknown error"}}}},r=[n,e],t[0]=e,t[1]=n,t[2]=o,t[3]=r):(o=t[2],r=t[3]);const{isFetching:s,error:a,data:l,refetch:c}=vr(o,r),d=e===ht.OPEN?3e4:null;let u,h;t[4]!==d?(u={delayMs:d,whenVisible:!0},t[4]=d,t[5]=u):u=t[5],Pr(c,u),t[6]!==e||t[7]!==l||t[8]!==a?(h=()=>[Fl(e.toLowerCase()),l!=null&&l.lastChecked?l.isHealthy?"\u2713 Healthy":"\u2717 Unhealthy":"Health: Unknown",a?`Error: ${a}`:""].filter(Boolean).join(`
|
|
128
|
-
`),t[6]=e,t[7]=l,t[8]=a,t[9]=h):h=t[9];const m=h;let f;t[10]!==e||t[11]!==(l==null?void 0:l.isHealthy)||t[12]!==(l==null?void 0:l.lastChecked)||t[13]!==s?(f=()=>s||e===ht.CONNECTING?i.jsx(va,{size:"small"}):e===ht.CLOSING?i.jsx(va,{className:"text-destructive",size:"small"}):e===ht.OPEN?l!=null&&l.isHealthy?i.jsx(Na,{className:"w-4 h-4 text-(--green-9)"}):l!=null&&l.lastChecked?i.jsx($1,{className:"w-4 h-4 text-(--yellow-9)"}):i.jsx(Na,{className:"w-4 h-4"}):i.jsx(zr,{className:"w-4 h-4 text-red-500"}),t[10]=e,t[11]=l==null?void 0:l.isHealthy,t[12]=l==null?void 0:l.lastChecked,t[13]=s,t[14]=f):f=t[14];const b=f,x=m();let p,g,y,w;return t[15]!==e?(p=e===ht.OPEN&&i.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Click to refresh health status"}),t[15]=e,t[16]=p):p=t[16],t[17]!==x||t[18]!==p?(g=i.jsxs("div",{className:"text-sm whitespace-pre-line",children:[x,p]}),t[17]=x,t[18]=p,t[19]=g):g=t[19],t[20]!==b?(y=b(),t[20]=b,t[21]=y):y=t[21],t[22]!==c||t[23]!==g||t[24]!==y?(w=i.jsx(At,{tooltip:g,selected:!1,onClick:c,"data-testid":"footer-backend-status",children:y}),t[22]=c,t[23]=g,t[24]=y,t[25]=w):w=t[25],w},Yv=t=>{const e=P.c(3);let n,o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("path",{d:"M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48"}),e[0]=n):n=e[0],e[1]!==t?(o=i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1.24em",height:"1em",viewBox:"0 0 256 208",fill:"currentColor",...t,children:n}),e[1]=t,e[2]=o):o=e[2],o},Xv=Bt(t=>t(Gj).completion.copilot),Qv=()=>{const t=P.c(1);if(ie(Xv)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(Zv,{}),t[0]=e):e=t[0],e}return null},op=He.get("[copilot-status-bar]"),Zv=()=>{const t=ie(Q1),e=ie(gC)!==null,{handleClick:n}=X1(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Ct(Q1),a=Ct(bC);return V1(()=>{const l=Y1();let c=!0;return(async()=>{try{if(await l.initializePromise.catch(u=>{throw op.error("Failed to initialize",u),l.close(),u}),!c)return;const d=await l.signedIn();if(!c)return;s(d),a(d?"signedIn":"signedOut")}catch(d){if(!c)return;op.warn("Connection failed",d),s(!1),a("connectionError"),ze({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:i.jsx(ye,{variant:"link",onClick:o,children:"Settings"})})}})(),()=>{c=!1}}),i.jsx(At,{tooltip:i.jsxs(i.Fragment,{children:[i.jsx("b",{children:"GitHub Copilot:"})," ",r]}),selected:!1,onClick:o,"data-testid":"footer-copilot-status",children:i.jsx("span",{children:e?i.jsx(va,{className:"h-4 w-4"}):i.jsx(Yv,{className:ue("h-4 w-4",!t&&"opacity-60")})})})},ew=()=>{const t=P.c(18),[e,n]=S.useState(0),o=ie(Nt),{getUsageStats:r}=qe();let s,a,l,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>n(rw),a={delayMs:1e4,whenVisible:!0},t[0]=s,t[1]=a):(s=t[0],a=t[1]),Pr(s,a),t[2]!==o.state||t[3]!==r?(l=async()=>Qt()||o.state!==ht.OPEN?null:r(),t[2]=o.state,t[3]=r,t[4]=l):l=t[4],t[5]!==o.state||t[6]!==e?(c=[e,o.state],t[5]=o.state,t[6]=e,t[7]=c):c=t[7];const{data:d}=vr(l,c);let u,h,m,f;return t[8]!==d?(u=(d==null?void 0:d.gpu)&&d.gpu.length>0&&i.jsx(ow,{gpus:d.gpu}),t[8]=d,t[9]=u):u=t[9],t[10]!==d?(h=d&&i.jsx(tw,{memory:d.memory,kernel:d.kernel,server:d.server}),t[10]=d,t[11]=h):h=t[11],t[12]!==d?(m=d&&i.jsx(nw,{cpu:d.cpu}),t[12]=d,t[13]=m):m=t[13],t[14]!==u||t[15]!==h||t[16]!==m?(f=i.jsxs("div",{className:"flex gap-2 items-center px-1",children:[u,h,m]}),t[14]=u,t[15]=h,t[16]=m,t[17]=f):f=t[17],f},tw=t=>{const e=P.c(25),{memory:n,kernel:o,server:r}=t,{percent:s,total:a,available:l}=n;let c;e[0]!==s?(c=Math.round(s),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx("b",{children:"computer memory:"}),e[2]=u):u=e[2];const h=a-l;let m,f,b,x,p,g,y,w,j;return e[3]!==h?(m=vl(h),e[3]=h,e[4]=m):m=e[4],e[5]!==a?(f=vl(a),e[5]=a,e[6]=f):f=e[6],e[7]!==d||e[8]!==m||e[9]!==f?(b=i.jsxs("span",{children:[u," ",m," / ",f," GB (",d,"%)"]}),e[7]=d,e[8]=m,e[9]=f,e[10]=b):b=e[10],e[11]!==r?(x=(r==null?void 0:r.memory)&&i.jsxs("span",{children:[i.jsx("b",{children:"marimo server:"})," ",Ws(r.memory)]}),e[11]=r,e[12]=x):x=e[12],e[13]!==o?(p=(o==null?void 0:o.memory)&&i.jsxs("span",{children:[i.jsx("b",{children:"kernel:"})," ",Ws(o.memory)]}),e[13]=o,e[14]=p):p=e[14],e[15]!==b||e[16]!==x||e[17]!==p?(g=i.jsxs("div",{className:"flex flex-col gap-1",children:[b,x,p]}),e[15]=b,e[16]=x,e[17]=p,e[18]=g):g=e[18],e[19]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(id,{className:"w-4 h-4"}),e[19]=y):y=e[19],e[20]!==d?(w=i.jsxs("div",{className:"flex items-center gap-1","data-testid":"memory-usage-bar",children:[y,i.jsx(yl,{percent:d,colorClassName:"bg-primary"})]}),e[20]=d,e[21]=w):w=e[21],e[22]!==w||e[23]!==g?(j=i.jsx(pe,{delayDuration:200,content:g,children:w}),e[22]=w,e[23]=g,e[24]=j):j=e[24],j},nw=t=>{const e=P.c(11),{cpu:n}=t,{percent:o}=n;let r;e[0]!==o?(r=Math.round(o),e[0]=o,e[1]=r):r=e[1];const s=r;let a,l,c,d,u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx("b",{children:"CPU:"}),e[2]=a):a=e[2],e[3]!==s?(l=i.jsxs("span",{children:[a," ",s,"%"]}),e[3]=s,e[4]=l):l=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(xC,{className:"w-4 h-4"}),e[5]=c):c=e[5],e[6]!==s?(d=i.jsxs("div",{className:"flex items-center gap-1","data-testid":"cpu-bar",children:[c,i.jsx(yl,{percent:s,colorClassName:"bg-primary"})]}),e[6]=s,e[7]=d):d=e[7],e[8]!==l||e[9]!==d?(u=i.jsx(pe,{delayDuration:200,content:l,children:d}),e[8]=l,e[9]=d,e[10]=u):u=e[10],u},ow=t=>{const e=P.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(sw,0)/n.length),e[0]=n,e[1]=o):o=e[1];const r=o;let s,a,l,c,d;return e[2]!==n?(s=n.map(aw),e[2]=n,e[3]=s):s=e[3],e[4]!==s?(a=i.jsx("div",{className:"flex flex-col gap-1",children:s}),e[4]=s,e[5]=a):a=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(cd,{className:"w-4 h-4"}),e[6]=l):l=e[6],e[7]!==r?(c=i.jsxs("div",{className:"flex items-center gap-1","data-testid":"gpu-bar",children:[l,i.jsx(yl,{percent:r,colorClassName:"bg-(--grass-9)"})]}),e[7]=r,e[8]=c):c=e[8],e[9]!==a||e[10]!==c?(d=i.jsx(pe,{delayDuration:200,content:a,children:c}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d},yl=t=>{const e=P.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=ue("h-full bg-primary",o),e[0]=o,e[1]=r):r=e[1];const s=`${n}%`;let a,l;return e[2]!==s?(a={width:s},e[2]=s,e[3]=a):a=e[3],e[4]!==r||e[5]!==a?(l=i.jsx("div",{className:"h-3 w-20 bg-(--slate-4) rounded-lg overflow-hidden border",children:i.jsx("div",{className:r,style:a})}),e[4]=r,e[5]=a,e[6]=l):l=e[6],l};function Ws(t){return t>1073741824?`${vl(t)} GB`:`${(function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)})(t)} MB`}function vl(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function rw(t){return t+1}function sw(t,e){return t+e.memory.percent}function aw(t){return i.jsxs("span",{children:[i.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",Ws(t.memory.used)," / ",Ws(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const rp=Bt(!1);function wl(t,e,n=new Set){if(n.has(t))return new Set;n.add(t);const o=new Set;for(const r of e(t)){o.add(r);for(const s of wl(r,e,n))o.add(s)}return o}const iw=Bt(t=>{const e=t(ba),n=t(Xp);return(function(o,r){var l,c,d;const s=new Map;for(const u of o)s.set(u,{variables:new Set,parents:new Set,children:new Set});for(const u of Object.values(r))if(u.dataType!=="module")for(const h of u.declaredBy){(l=s.get(h))==null||l.variables.add(u.name);for(const m of u.usedBy)h!==m&&((c=s.get(m))==null||c.parents.add(h),(d=s.get(h))==null||d.children.add(m))}const a={};for(const[u,h]of s.entries())a[u]={parents:h.parents,children:h.children,variables:[...h.variables],ancestors:wl(u,m=>{var f;return((f=s.get(m))==null?void 0:f.parents)??new Set}),descendants:wl(u,m=>{var f;return((f=s.get(m))==null?void 0:f.children)??new Set})};return a})(e.inOrderIds,n)});function lw(t,e){return e?t.usedBy.includes(e.id)||t.declaredBy.includes(e.id)?!0:t.declaredBy.some(n=>e.graph.parents.has(n))?t.usedBy.some(n=>e.graph.parents.has(n)):!!t.declaredBy.some(n=>e.graph.children.has(n)):!1}const cw=()=>{const t=P.c(6),[e,n]=_n(rp);let o,r,s;return t[0]!==n?(o=()=>n(dw),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(ad,{className:"h-4 w-4"}),t[2]=r):r=t[2],t[3]!==e||t[4]!==o?(s=i.jsx(At,{tooltip:"Toggle Minimap",selected:e,onClick:o,"data-testid":"footer-minimap",children:r}),t[3]=e,t[4]=o,t[5]=s):s=t[5],s};function dw(t){return!t}const uw=()=>{const t=P.c(13),e=ie(yo),[n,o]=_n(C1),[r,s]=S.useState(!1);if(!ga()||e==="disabled")return null;const a=e?"Real-time collaboration active":"Connecting to real-time collaboration";let l,c,d,u,h,m;return t[0]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(vd,{className:"w-4 h-4"}),t[0]=l):l=t[0],t[1]!==a?(c=i.jsx(bc,{asChild:!0,children:i.jsx(At,{tooltip:a,selected:!1,"data-testid":"footer-rtc-status",children:l})}),t[1]=a,t[2]=c):c=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"font-medium leading-none",children:"Username"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Set your username for real-time collaboration"})]}),t[3]=d):d=t[3],t[4]!==o?(u=f=>o(f.target.value),t[4]=o,t[5]=u):u=t[5],t[6]!==u||t[7]!==n?(h=i.jsx(Yl,{className:"w-80",children:i.jsxs("div",{className:"space-y-4",children:[d,i.jsx(ao,{value:n,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",onChange:u,placeholder:"Enter your username"})]})}),t[6]=u,t[7]=n,t[8]=h):h=t[8],t[9]!==r||t[10]!==c||t[11]!==h?(m=i.jsxs(na,{open:r,onOpenChange:s,children:[c,h]}),t[9]=r,t[10]=c,t[11]=h,t[12]=m):m=t[12],m},hw=t=>{const e=P.c(104),{className:n}=t,{saveUserConfig:o}=qe(),[r,s]=qj(),a=Zs()[0],[l,c]=S.useState(!1);let d,u,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const ve=window.matchMedia("(min-width: 768px)"),be=()=>{ve.matches&&c(!1)};return ve.addEventListener("change",be),()=>ve.removeEventListener("change",be)},u=[],e[0]=d,e[1]=u):(d=e[0],u=e[1]),S.useEffect(d,u),e[2]!==a||e[3]!==o||e[4]!==s?(h=async ve=>{const be={...a,runtime:{...a.runtime,auto_instantiate:ve}};await o({config:be}).then(()=>s(be))},e[2]=a,e[3]=o,e[4]=s,e[5]=h):h=e[5];const m=h;let f;e[6]!==o||e[7]!==s||e[8]!==r?(f=async ve=>{const be={...r,runtime:{...r.runtime,on_cell_change:ve?"autorun":"lazy"}};await o({config:be}).then(()=>s(be))},e[6]=o,e[7]=s,e[8]=r,e[9]=f):f=e[9];const b=f;let x;e[10]!==o||e[11]!==s||e[12]!==r?(x=async ve=>{const be={...r,runtime:{...r.runtime,auto_reload:ve}};await o({config:be}).then(()=>s(be))},e[10]=o,e[11]=s,e[12]=r,e[13]=x):x=e[13];const p=x;let g;e[14]!==a.runtime.auto_instantiate||e[15]!==a.runtime.auto_reload||e[16]!==a.runtime.on_cell_change?(g=!a.runtime.auto_instantiate&&a.runtime.on_cell_change==="lazy"&&(Qt()||a.runtime.auto_reload!=="autorun"),e[14]=a.runtime.auto_instantiate,e[15]=a.runtime.auto_reload,e[16]=a.runtime.on_cell_change,e[17]=g):g=e[17];const y=g;let w;e[18]!==n?(w=ue("flex items-center",n),e[18]=n,e[19]=w):w=e[19];const j=a.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let N,C,k;e[20]!==a.runtime.auto_instantiate||e[21]!==m?(N=()=>m(!a.runtime.auto_instantiate),e[20]=a.runtime.auto_instantiate,e[21]=m,e[22]=N):N=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx("span",{children:"on startup: "}),e[23]=C):C=e[23],e[24]!==a.runtime.auto_instantiate?(k=a.runtime.auto_instantiate?i.jsx(_t,{size:14}):i.jsx(Et,{size:14}),e[24]=a.runtime.auto_instantiate,e[25]=k):k=e[25];const _=a.runtime.auto_instantiate?"autorun":"lazy";let E,I,A,F;e[26]!==_?(E=i.jsx("span",{children:_}),e[26]=_,e[27]=E):E=e[27],e[28]!==k||e[29]!==E?(I=i.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[C,k,E]}),e[28]=k,e[29]=E,e[30]=I):I=e[30],e[31]!==I||e[32]!==j||e[33]!==N?(A=i.jsx(Po,{name:"runtime.auto_instantiate",children:i.jsx(At,{tooltip:j,selected:!1,onClick:N,"data-testid":"footer-autorun-startup",children:I})}),e[31]=I,e[32]=j,e[33]=N,e[34]=A):A=e[34],e[35]===Symbol.for("react.memo_cache_sentinel")?(F=i.jsx("div",{className:"border-r border-border h-6 mx-1"}),e[35]=F):F=e[35];const D=a.runtime.on_cell_change==="autorun"?"Disable autorun":"Enable autorun";let M,O,R,z,T,L,$,W,G,X,H,Y,K;e[36]!==a.runtime.on_cell_change||e[37]!==b?(M=()=>b(a.runtime.on_cell_change!=="autorun"),e[36]=a.runtime.on_cell_change,e[37]=b,e[38]=M):M=e[38],e[39]===Symbol.for("react.memo_cache_sentinel")?(O=i.jsx("span",{children:"on cell change: "}),e[39]=O):O=e[39],e[40]!==a.runtime.on_cell_change?(R=i.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[O,a.runtime.on_cell_change==="autorun"?i.jsx(_t,{size:14}):i.jsx(Et,{size:14}),i.jsx("span",{children:a.runtime.on_cell_change})]}),e[40]=a.runtime.on_cell_change,e[41]=R):R=e[41],e[42]!==D||e[43]!==M||e[44]!==R?(z=i.jsx(Po,{name:"runtime.on_cell_change",children:i.jsx(At,{tooltip:D,selected:!1,onClick:M,"data-testid":"footer-autorun-cell-change",children:R})}),e[42]=D,e[43]=M,e[44]=R,e[45]=z):z=e[45],e[46]!==a.runtime.auto_reload||e[47]!==p?(T=!Qt()&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"border-r border-border h-6 mx-1"}),i.jsx(Po,{name:"runtime.auto_reload",children:i.jsx(At,{tooltip:null,selected:!1,"data-testid":"footer-module-reload",children:i.jsxs(zn,{children:[i.jsxs(Un,{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[i.jsx("span",{children:"on module change: "}),a.runtime.auto_reload==="off"&&i.jsx(zr,{size:14}),a.runtime.auto_reload==="lazy"&&i.jsx(Et,{size:14}),a.runtime.auto_reload==="autorun"&&i.jsx(_t,{size:14}),i.jsx("span",{children:a.runtime.auto_reload}),i.jsx($n,{size:14})]}),i.jsx(Wn,{children:["off","lazy","autorun"].map(ve=>i.jsxs(lo,{onClick:()=>p(ve),children:[ve==="off"&&i.jsx(zr,{size:14,className:"mr-2 text-muted-foreground"}),ve==="lazy"&&i.jsx(Et,{size:14,className:"mr-2 text-muted-foreground"}),ve==="autorun"&&i.jsx(_t,{size:14,className:"mr-2 text-muted-foreground"}),ve]},ve))})]})})})]}),e[46]=a.runtime.auto_reload,e[47]=p,e[48]=T):T=e[48],e[49]!==A||e[50]!==z||e[51]!==T?(L=i.jsxs("div",{className:"hidden md:flex md:items-center",children:[A,F,z,T]}),e[49]=A,e[50]=z,e[51]=T,e[52]=L):L=e[52],e[53]!==y?($=y?i.jsx(Et,{size:16,className:"text-muted-foreground"}):i.jsx(_t,{size:16,className:"text-amber-500"}),e[53]=y,e[54]=$):$=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?(W=i.jsx($n,{size:14}),e[55]=W):W=e[55],e[56]!==$?(G=i.jsx(Un,{asChild:!0,children:i.jsx(At,{tooltip:"Runtime reactivity",selected:!1,"data-testid":"footer-runtime-settings",children:i.jsxs("div",{className:"flex items-center gap-1",children:[$,W]})})}),e[56]=$,e[57]=G):G=e[57],e[58]===Symbol.for("react.memo_cache_sentinel")?(X=i.jsx(Ep,{children:"Runtime reactivity"}),H=i.jsx(En,{}),e[58]=X,e[59]=H):(X=e[58],H=e[59]),e[60]!==a.runtime.auto_instantiate?(Y=a.runtime.auto_instantiate?i.jsx(_t,{size:14,className:"text-amber-500"}):i.jsx(Et,{size:14,className:"text-muted-foreground"}),e[60]=a.runtime.auto_instantiate,e[61]=Y):Y=e[61],e[62]===Symbol.for("react.memo_cache_sentinel")?(K=i.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[62]=K):K=e[62];const V=a.runtime.auto_instantiate?"autorun":"lazy";let q,U,ne,Q,ee,oe,se,ae,te;e[63]!==V?(q=i.jsxs("div",{children:[K,i.jsx("div",{className:"text-xs text-muted-foreground",children:V})]}),e[63]=V,e[64]=q):q=e[64],e[65]!==Y||e[66]!==q?(U=i.jsxs("div",{className:"flex items-center space-x-2",children:[Y,q]}),e[65]=Y,e[66]=q,e[67]=U):U=e[67],e[68]!==a.runtime.auto_instantiate||e[69]!==m?(ne=i.jsx(gc,{checked:a.runtime.auto_instantiate,onCheckedChange:m,size:"sm"}),e[68]=a.runtime.auto_instantiate,e[69]=m,e[70]=ne):ne=e[70],e[71]!==U||e[72]!==ne?(Q=i.jsx(Po,{name:"runtime.auto_instantiate",children:i.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[U,ne]})}),e[71]=U,e[72]=ne,e[73]=Q):Q=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(ee=i.jsx(En,{}),e[74]=ee):ee=e[74],e[75]!==a.runtime.on_cell_change?(oe=a.runtime.on_cell_change==="autorun"?i.jsx(_t,{size:14,className:"text-amber-500"}):i.jsx(Et,{size:14,className:"text-muted-foreground"}),e[75]=a.runtime.on_cell_change,e[76]=oe):oe=e[76],e[77]===Symbol.for("react.memo_cache_sentinel")?(se=i.jsx("div",{className:"text-sm font-medium",children:"On cell change"}),e[77]=se):se=e[77],e[78]!==a.runtime.on_cell_change?(ae=i.jsxs("div",{children:[se,i.jsx("div",{className:"text-xs text-muted-foreground",children:a.runtime.on_cell_change})]}),e[78]=a.runtime.on_cell_change,e[79]=ae):ae=e[79],e[80]!==oe||e[81]!==ae?(te=i.jsxs("div",{className:"flex items-center space-x-2",children:[oe,ae]}),e[80]=oe,e[81]=ae,e[82]=te):te=e[82];const _e=a.runtime.on_cell_change==="autorun";let he,we,ke,ge,Ee,Oe;return e[83]!==b||e[84]!==_e?(he=i.jsx(gc,{checked:_e,onCheckedChange:b,size:"sm"}),e[83]=b,e[84]=_e,e[85]=he):he=e[85],e[86]!==te||e[87]!==he?(we=i.jsx(Po,{name:"runtime.on_cell_change",children:i.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[te,he]})}),e[86]=te,e[87]=he,e[88]=we):we=e[88],e[89]!==a.runtime.auto_reload||e[90]!==p?(ke=!Qt()&&i.jsxs(i.Fragment,{children:[i.jsx(En,{}),i.jsx(Po,{name:"runtime.auto_reload",children:i.jsxs("div",{className:"px-2 py-1",children:[i.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[a.runtime.auto_reload==="off"&&i.jsx(zr,{size:14,className:"text-muted-foreground"}),a.runtime.auto_reload==="lazy"&&i.jsx(Et,{size:14,className:"text-muted-foreground"}),a.runtime.auto_reload==="autorun"&&i.jsx(_t,{size:14,className:"text-amber-500"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm font-medium",children:"On module change"}),i.jsx("div",{className:"text-xs text-muted-foreground",children:a.runtime.auto_reload})]})]}),i.jsx("div",{className:"space-y-1",children:["off","lazy","autorun"].map(ve=>i.jsxs("button",{onClick:()=>p(ve),className:ue("w-full flex items-center px-2 py-1 text-sm rounded hover:bg-accent",ve===a.runtime.auto_reload&&"bg-accent"),children:[ve==="off"&&i.jsx(zr,{size:12,className:"mr-2"}),ve==="lazy"&&i.jsx(Et,{size:12,className:"mr-2"}),ve==="autorun"&&i.jsx(_t,{size:12,className:"mr-2"}),i.jsx("span",{className:"capitalize",children:ve}),ve===a.runtime.auto_reload&&i.jsx("span",{className:"ml-auto",children:"\u2713"})]},ve))})]})})]}),e[89]=a.runtime.auto_reload,e[90]=p,e[91]=ke):ke=e[91],e[92]!==Q||e[93]!==we||e[94]!==ke?(ge=i.jsxs(Wn,{align:"start",className:"w-64",children:[X,H,Q,ee,we,ke]}),e[92]=Q,e[93]=we,e[94]=ke,e[95]=ge):ge=e[95],e[96]!==l||e[97]!==G||e[98]!==ge?(Ee=i.jsx("div",{className:"flex md:hidden",children:i.jsxs(zn,{open:l,onOpenChange:c,children:[G,ge]})}),e[96]=l,e[97]=G,e[98]=ge,e[99]=Ee):Ee=e[99],e[100]!==L||e[101]!==Ee||e[102]!==w?(Oe=i.jsxs("div",{className:w,children:[L,Ee]}),e[100]=L,e[101]=Ee,e[102]=w,e[103]=Oe):Oe=e[103],Oe},mw=()=>{const t=P.c(24),{selectedPanel:e,isTerminalOpen:n}=Qs(),{toggleApplication:o,toggleTerminal:r}=wr(),s=ie(Hj),a=fw,l=Kr.find(pw);let c;Zt(l,"Error panel not found"),t[0]!==r?(c=()=>{r()},t[0]=r,t[1]=c):c=t[1],st("global.toggleTerminal",c);const d=At,u=l.tooltip,h=e===l.type,m=()=>o(l.type),f=a(l,s>0?"text-destructive":"");let b,x,p,g,y,w,j,N,C,k;return t[2]!==s?(b=i.jsx("span",{className:"ml-1 font-mono mt-0.5",children:s}),t[2]=s,t[3]=b):b=t[3],t[4]!==d||t[5]!==l||t[6]!==h||t[7]!==m||t[8]!==f||t[9]!==b?(x=i.jsxs(d,{tooltip:u,selected:h,onClick:m,"data-testid":"footer-errors",children:[f,b]}),t[4]=d,t[5]=l,t[6]=h,t[7]=m,t[8]=f,t[9]=b,t[10]=x):x=t[10],t[11]!==r?(p=()=>r(),t[11]=r,t[12]=p):p=t[12],t[13]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx(Uc,{className:"h-5 w-5"}),t[13]=g):g=t[13],t[14]!==n||t[15]!==p?(y=i.jsx(np,{capability:"terminal",children:i.jsx(At,{tooltip:"Open terminal",selected:n,onClick:p,"data-testid":"footer-terminal",children:g})}),t[14]=n,t[15]=p,t[16]=y):y=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsx(hw,{}),j=i.jsx("div",{className:"mx-auto"}),t[17]=w,t[18]=j):(w=t[17],j=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(hu,{children:i.jsx(pe,{content:i.jsx("div",{className:"w-[200px]",children:"Kiosk mode is enabled. This allows you to view the outputs of the cells without the ability to edit them."}),children:i.jsx("span",{className:"text-muted-foreground text-sm mr-4",children:"kiosk mode"})})}),t[19]=N):N=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsxs("div",{className:"flex items-center shrink-0 min-w-0",children:[i.jsx(ew,{}),i.jsx(cw,{}),i.jsx(Jv,{}),i.jsx(Qv,{}),i.jsx(uw,{}),i.jsx(Kv,{})]}),t[20]=C):C=t[20],t[21]!==y||t[22]!==x?(k=i.jsxs("footer",{className:"h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-1 border-t border-border select-none no-print text-sm shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] z-50 print:hidden hide-on-fullscreen overflow-x-auto overflow-y-hidden scrollbar-thin",children:[x,y,w,j,N,C]}),t[21]=y,t[22]=x,t[23]=k):k=t[23],k};function fw(t,e){const{Icon:n}=t;return i.jsx(n,{className:ue("h-5 w-5",e)})}function pw(t){return t.type==="errors"}const gw=t=>{const e=P.c(6),{children:n}=t,{openModal:o,closeModal:r}=Pn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(i.jsx(bw,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=i.jsx(Jj,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},bw=t=>{const e=P.c(9),{onClose:n}=t;let o,r,s,a,l,c,d;return e[0]!==n?(o=async u=>{u.preventDefault();const h=new FormData(u.target),m=h.get("rating"),f=h.get("message");fetch("https://marimo.io/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:m,message:f})}),n(),ze({title:"Feedback sent!",description:"Thank you for your feedback!"})},e[0]=n,e[1]=o):o=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(so,{children:"Send Feedback"}),e[2]=r):r=e[2],e[3]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We want to hear from you \u2014 from minor bug reports to wishlist features and everything in between. Here are some ways you can get in touch:"}),e[3]=s):s=e[3],e[4]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsxs("li",{className:"my-0",children:["Take our"," ",i.jsx("a",{href:Xt.feedbackForm,target:"_blank",className:"underline",children:"two-minute survey."})]}),e[4]=a):a=e[4],e[5]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsxs("li",{className:"my-0",children:["File a"," ",i.jsx("a",{href:Xt.issuesPage,target:"_blank",className:"underline",children:"GitHub issue."})]}),e[5]=l):l=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsxs(xr,{children:[r,i.jsxs(yr,{children:[s,i.jsxs("ul",{className:"list-disc ml-8 my-2 prose dark:prose-invert",children:[a,l,i.jsxs("li",{className:"my-0",children:["Chat with us on"," ",i.jsx("a",{href:Xt.discordLink,target:"_blank",className:"underline",children:"Discord."})]})]}),i.jsx("p",{className:"my-2 prose dark:prose-invert",children:"We're excited you're here as we build the future of Python data tooling. Thanks for being part of our community!"})]})]}),e[6]=c):c=e[6],e[7]!==o?(d=i.jsx(io,{className:"w-fit",children:i.jsx("form",{onSubmit:o,children:c})}),e[7]=o,e[8]=d):d=e[8],d},xw=()=>{const t=P.c(10),{selectedPanel:e}=Qs(),{toggleApplication:n}=wr(),o=vw;let r,s,a,l,c,d;return t[0]!==e||t[1]!==n?(r="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen",s=Kr.filter(ww).map(u=>i.jsx(sp,{tooltip:u.tooltip,selected:e===u.type,onClick:()=>n(u.type),children:o(u)},u.type)),t[0]=e,t[1]=n,t[2]=r,t[3]=s):(r=t[2],s=t[3]),t[4]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(gw,{children:i.jsx(sp,{tooltip:"Send feedback!",selected:!1,children:i.jsx(ld,{className:"h-5 w-5"})})}),l=i.jsx("div",{className:"flex-1"}),c=i.jsx(yw,{}),t[4]=a,t[5]=l,t[6]=c):(a=t[4],l=t[5],c=t[6]),t[7]!==r||t[8]!==s?(d=i.jsxs("div",{className:r,children:[s,a,l,c]}),t[7]=r,t[8]=s,t[9]=d):d=t[9],d},yw=()=>{const t=P.c(7),e=ie(Kj);let n,o,r;return t[0]!==e?(n=e>0?i.jsxs("span",{children:[e," cell",e>1?"s":""," queued or running"]}):"No cells queued or running",t[0]=e,t[1]=n):n=t[1],t[2]!==e?(o=i.jsx("div",{className:"flex flex-col-reverse gap-px overflow-hidden",children:Array.from({length:e}).map(kw)}),t[2]=e,t[3]=o):o=t[3],t[4]!==n||t[5]!==o?(r=i.jsx(pe,{content:n,side:"right",delayDuration:200,children:o}),t[4]=n,t[5]=o,t[6]=r):r=t[6],r},sp=t=>{const e=P.c(17);let n,o,r,s,a;e[0]!==t?({children:n,tooltip:a,selected:s,className:o,...r}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=r,e[4]=s,e[5]=a):(n=e[1],o=e[2],r=e[3],s=e[4],a=e[5]);const l=!s&&"hover:bg-(--sage-3)",c=s&&"bg-(--sage-4)";let d,u,h;return e[6]!==o||e[7]!==l||e[8]!==c?(d=ue("flex items-center p-2 text-sm mx-px shadow-inset font-mono cursor-pointer rounded",l,c,o),e[6]=o,e[7]=l,e[8]=c,e[9]=d):d=e[9],e[10]!==n||e[11]!==r||e[12]!==d?(u=i.jsx("button",{className:d,...r,children:n}),e[10]=n,e[11]=r,e[12]=d,e[13]=u):u=e[13],e[14]!==u||e[15]!==a?(h=i.jsx(pe,{content:a,side:"right",delayDuration:200,children:u}),e[14]=u,e[15]=a,e[16]=h):h=e[16],h};function vw(t,e){const{Icon:n}=t;return i.jsx(n,{className:ue("h-5 w-5",e)})}function ww(t){return!t.hidden&&t.position==="sidebar"}function kw(t,e){return i.jsx("div",{className:"shrink-0 h-1 w-2 bg-(--grass-6) border border-(--grass-7)"},e.toString())}const jw=t=>{const e=P.c(4),{isOpen:n,children:o}=t,[r,s]=me.useState(!1);let a,l;return e[0]!==r||e[1]!==n?(a=()=>{n&&!r&&s(!0)},l=[n,r],e[0]=r,e[1]=n,e[2]=a,e[3]=l):(a=e[2],l=e[3]),me.useEffect(a,l),r?o:null},Cw=t=>{const e=P.c(38),n=ie(Yj),o=ie(iw),r=Ye(),s=A1(),a=t.cellId,l=o[t.cellId],c=Rr(t.cellId),d=c.code,u=Lr(t.cellId);let h,m,f,b,x,p,g,y,w,j;if(e[0]!==r||e[1]!==s||e[2]!==n.focusedCellId||e[3]!==o||e[4]!==t.cellId||e[5]!==l||e[6]!==c.code||e[7]!==u.errored){h={id:a,graph:l,code:d,hasError:u.errored},n.focusedCellId&&o[n.focusedCellId]&&(b={id:n.focusedCellId,graph:o[n.focusedCellId]}),f=(b==null?void 0:b.id)===h.id,m=ip(h.graph)?1.5:3;const E=()=>{f?s.blurCell():(r.focusCell({cellId:h.id,where:"exact"}),s.focusCell({cellId:h.id}))};g=h.id;const I=f?"text-primary-foreground":"text-(--gray-8) hover:text-(--gray-9)";e[18]!==I?(y=ue("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",I),e[18]=I,e[19]=y):y=e[19],w=E,j=Aw;const A=f&&"bg-primary group-hover:bg-primary";let F;e[20]!==A?(F=ue("group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",A),e[20]=A,e[21]=F):F=e[21],x=i.jsx("div",{className:F,children:i.jsx("div",{className:"truncate px-1 font-mono text-sm flex gap-1",title:h.code,children:h.graph.variables.length>0?i.jsx(Ew,{cell:h,selectedCell:b}):i.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap max-w-full",children:(N=h.code,(N.split(`
|
|
129
|
-
`)[0].trim()||void 0)??i.jsx("span",{className:"italic",children:"empty"}))})})}),p=ue("absolute overflow-visible top-[10.5px] left-[calc(var(--spacing-extra-small,8px)+17px)] pointer-events-none",f?"z-30":"z-20",(function({cell:D,selectedCell:M}){return D.hasError?"text-destructive":!M&&!ip(D.graph)?"text-foreground":(M==null?void 0:M.id)===D.id||M!=null&&M.graph.parents.has(D.id)||M!=null&&M.graph.children.has(D.id)?"text-primary":"text-(--gray-8)"})({cell:h,selectedCell:b})),e[0]=r,e[1]=s,e[2]=n.focusedCellId,e[3]=o,e[4]=t.cellId,e[5]=l,e[6]=c.code,e[7]=u.errored,e[8]=h,e[9]=m,e[10]=f,e[11]=b,e[12]=x,e[13]=p,e[14]=g,e[15]=y,e[16]=w,e[17]=j}else h=e[8],m=e[9],f=e[10],b=e[11],x=e[12],p=e[13],g=e[14],y=e[15],w=e[16],j=e[17];var N;let C,k,_;return e[22]!==h||e[23]!==m||e[24]!==f||e[25]!==t.cellPositions||e[26]!==b?(C=f?i.jsx(_w,{cell:h,cellPositions:t.cellPositions,circleRadius:m}):i.jsx(Iw,{cell:h,selectedCell:b,circleRadius:m}),e[22]=h,e[23]=m,e[24]=f,e[25]=t.cellPositions,e[26]=b,e[27]=C):C=e[27],e[28]!==C||e[29]!==p?(k=i.jsx("svg",{className:p,width:"1",height:"1",children:C}),e[28]=C,e[29]=p,e[30]=k):k=e[30],e[31]!==x||e[32]!==k||e[33]!==g||e[34]!==y||e[35]!==w||e[36]!==j?(_=i.jsxs("button",{"data-node-id":g,className:y,onClick:w,onMouseDown:j,children:[x,k]}),e[31]=x,e[32]=k,e[33]=g,e[34]=y,e[35]=w,e[36]=j,e[37]=_):_=e[37],_},Nw=t=>{const e=P.c(28),{open:n,setOpen:o}=t,r=Nc();let s;e[0]!==r.inOrderIds?(s=Object.fromEntries(r.inOrderIds.map(Tw)),e[0]=r.inOrderIds,e[1]=s):s=e[1];const a=s;let l;if(e[2]!==r){l=[];let w=0;for(const[j,N]of r.getColumns().entries())j>0&&l.push(w),w+=N.inOrderIds.length;e[2]=r,e[3]=l}else l=e[3];const c=n?"translate-x-0":"translate-x-[calc(100%+20px)]";let d,u,h,m,f,b,x,p,g,y;if(e[4]!==c?(d=ue("fixed top-14 right-5 z-50 bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60 rounded-lg border shadow-lg w-64 flex flex-col max-h-[58vh]","motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",c),e[4]=c,e[5]=d):d=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx("span",{className:"text-sm font-semibold",children:"Minimap"}),e[6]=u):u=e[6],e[7]!==o?(h=()=>o(!1),e[7]=o,e[8]=h):h=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Vt,{className:"h-4 w-4"}),e[9]=m):m=e[9],e[10]!==h?(f=i.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[u,i.jsx(ye,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:h,children:m})]}),e[10]=h,e[11]=f):f=e[11],e[12]!==r.inOrderIds||e[13]!==a||e[14]!==l){let w;e[16]!==a||e[17]!==l?(w=(j,N)=>{const C=l.includes(N);return i.jsxs(S.Fragment,{children:[C&&i.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-(--gray-4) pointer-events-none","aria-hidden":"true"}),i.jsx(Cw,{cellId:j,cellPositions:a})]},j)},e[16]=a,e[17]=l,e[18]=w):w=e[18],b=r.inOrderIds.map(w),e[12]=r.inOrderIds,e[13]=a,e[14]=l,e[15]=b}else b=e[15];return e[19]!==b?(x=i.jsx("div",{className:"py-3 pl-3 pr-4 relative min-h-full",children:b}),e[19]=b,e[20]=x):x=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx("div",{className:"h-0 overflow-hidden","aria-hidden":"true"}),e[21]=p):p=e[21],e[22]!==x?(g=i.jsxs("div",{className:"overflow-y-auto overflow-x-hidden flex-1 scrollbar-none",children:[x,p]}),e[22]=x,e[23]=g):g=e[23],e[24]!==g||e[25]!==d||e[26]!==f?(y=i.jsxs("div",{className:d,children:[f,g]}),e[24]=g,e[25]=d,e[26]=f,e[27]=y):y=e[27],y},Sw=()=>{const t=P.c(5),[e,n]=_n(rp);let o,r;return t[0]!==n?(o=()=>n(Dw),t[0]=n,t[1]=o):o=t[1],st("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=i.jsx(Nw,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r},Ew=t=>{const e=P.c(11),{cell:n,selectedCell:o}=t,r=Xj(),s=n.id===(o==null?void 0:o.id);let a,l;if(e[0]!==n.graph.variables||e[1]!==s||e[2]!==o||e[3]!==r){let c;e[5]!==s||e[6]!==o||e[7]!==r?(c=(d,u)=>{const h=r[d];return i.jsxs(S.Fragment,{children:[u>0&&", ",i.jsx("span",{className:ue({"font-bold":s,"text-foreground":o===void 0,"text-primary font-medium":!s&&lw(h,o)}),children:d})]},d)},e[5]=s,e[6]=o,e[7]=r,e[8]=c):c=e[8],a=n.graph.variables.map(c),e[0]=n.graph.variables,e[1]=s,e[2]=o,e[3]=r,e[4]=a}else a=e[4];return e[9]!==a?(l=i.jsx(i.Fragment,{children:a}),e[9]=a,e[10]=l):l=e[10],l},_w=t=>{const e=P.c(12),{cell:n,cellPositions:o,circleRadius:r}=t;let s,a,l,c;if(e[0]!==n.graph.children||e[1]!==n.graph.parents||e[2]!==n.id||e[3]!==o){s=[];const d=o[n.id]??0,u=new Set;for(const h of n.graph.parents)n.graph.children.has(h)&&u.add(h);for(const h of u){const m=o[h];if(m!==void 0){const f=21*(m-d);s.push(i.jsx("path",{d:`M -3 0 H -7 v ${f} h 14 v ${-f} H 3`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-cycle-${h}`))}}for(const h of n.graph.parents){if(u.has(h))continue;const m=o[h];if(m!==void 0){const f=21*(m-d);s.push(i.jsx("path",{d:`M -3 0 H -7 v ${f} h -4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-up-${h}`))}}for(const h of n.graph.children){if(u.has(h))continue;const m=o[h];if(m!==void 0){const f=21*(m-d);s.push(i.jsx("path",{d:`M 3 0 H 7 v ${f} h 4`,fill:"none",strokeWidth:"2",stroke:"currentColor"},`${n.id}-down-${h}`))}}e[0]=n.graph.children,e[1]=n.graph.parents,e[2]=n.id,e[3]=o,e[4]=s}else s=e[4];return e[5]!==r?(a=i.jsx("circle",{r,fill:"currentColor",className:"pointer-events-auto"}),e[5]=r,e[6]=a):a=e[6],e[7]!==s?(l=i.jsx("g",{className:"pen pointer-events-auto",children:s}),e[7]=s,e[8]=l):l=e[8],e[9]!==a||e[10]!==l?(c=i.jsxs("g",{transform:"translate(0, 0)",children:[a,l]}),e[9]=a,e[10]=l,e[11]=c):c=e[11],c};function Iw(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return ap({circleRadius:o,leftWisker:r,rightWisker:s});const a=n.graph.ancestors.has(e.id),l=n.graph.descendants.has(e.id);return ap(a||l?{circleRadius:o,leftWisker:r,rightWisker:s,shift:a&&l?void 0:a?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function ap(t){const{circleRadius:e,leftWisker:n,rightWisker:o,shift:r}=t,s=r===void 0?0:r==="left"?-14:14;return i.jsxs("g",{transform:`translate(${s}, 0)`,children:[i.jsxs("g",{children:[n&&i.jsx("path",{d:"M 0 0 h -8",fill:"none",strokeWidth:"2",stroke:"currentColor"}),o&&i.jsx("path",{d:"M 0 0 h 8",fill:"none",strokeWidth:"2",stroke:"currentColor"})]}),i.jsx("circle",{r:e,fill:"currentColor",className:"pointer-events-auto"})]})}function ip(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function Aw(t){return t.preventDefault()}function Tw(t,e){return[t,e]}function Dw(t){return!t}const Mw=me.lazy(()=>mt(()=>import("./terminal-BPwTkXae.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110]),import.meta.url)),Ow=me.lazy(()=>mt(()=>import("./chat-panel-CXh5Wl6C.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([111,1,2,4,5,112,113,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,114,115,116,117,107,108,109]),import.meta.url)),Rw=me.lazy(()=>mt(()=>import("./agent-panel-Crv430aI.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([118,1,2,113,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,114,115,116,4,5,112,3,107,108,109,119]),import.meta.url)),Lw=me.lazy(()=>mt(()=>import("./dependency-graph-panel-DEdOxp2X.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([120,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,121,122,123,124,125,4,5,107,108,109,126]),import.meta.url)),Fw=me.lazy(()=>mt(()=>import("./datasources-panel-B7FbYLiy.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([127,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,112,128,108,129,4,5,107,109]),import.meta.url)),Bw=me.lazy(()=>mt(()=>import("./documentation-panel-xULhaEv3.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([130,1,2,112,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109]),import.meta.url)),Pw=me.lazy(()=>mt(()=>import("./error-panel-Cc1sv-Ag.js"),__vite__mapDeps([131,1,2,112]),import.meta.url)),zw=me.lazy(()=>mt(()=>import("./file-explorer-panel-Bw59Kva1.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([132,1,2,4,5,133,134,135,125,115,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109]),import.meta.url)),Uw=me.lazy(()=>mt(()=>import("./logs-panel-D401qzZh.js"),__vite__mapDeps([136,1,2,137,112]),import.meta.url)),Ww=me.lazy(()=>mt(()=>import("./outline-panel-DIzkvm2I.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([138,1,2,112,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,4,5,107,108,109,139]),import.meta.url)),$w=me.lazy(()=>mt(()=>import("./packages-panel-CJL0MVlj.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([140,1,2,4,5,112,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109]),import.meta.url)),Vw=me.lazy(()=>mt(()=>import("./scratchpad-panel-BIgRENkI.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([141,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,115,4,5,107,108,109]),import.meta.url)),Gw=me.lazy(()=>mt(()=>import("./secrets-panel-xY5-V_BD.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([142,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,112,4,5,107,108,109]),import.meta.url)),qw=me.lazy(()=>mt(()=>import("./snippets-panel-CTPYW41n.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([143,1,2,112,115,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,144]),import.meta.url)),Hw=me.lazy(()=>mt(()=>import("./tracing-panel-DAzrzNmm.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([145,1,2]),import.meta.url)),Jw=me.lazy(()=>mt(()=>import("./variable-panel-DYAiLBmF.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([146,1,2,124,128,108,129,112,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,109]),import.meta.url)),Kw=t=>{const e=P.c(127),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=Qs(),{setIsSidebarOpen:a,setIsTerminalOpen:l}=wr(),c=me.useRef(null),d=me.useRef(null),u=S.useId(),h=S.useId();let m,f,b,x,p;e[0]!==o?(m=()=>{if(!c.current)return;const le=c.current.isCollapsed();o&&le&&c.current.expand(),o||le||c.current.collapse(),requestAnimationFrame(Xw)},f=[o],e[0]=o,e[1]=m,e[2]=f):(m=e[1],f=e[2]),S.useEffect(m,f),e[3]!==r?(b=()=>{if(!d.current)return;const le=d.current.isCollapsed();r&&le&&d.current.expand(),r||le||d.current.collapse(),requestAnimationFrame(Zw)},x=[r],e[3]=r,e[4]=b,e[5]=x):(b=e[4],x=e[5]),S.useEffect(b,x),e[6]!==n?(p=i.jsx(ka,{id:"app",className:"relative h-full",children:i.jsx(S.Suspense,{children:n})},"app"),e[6]=n,e[7]=p):p=e[7];const g=p,y=o?"resize-handle":"resize-handle-collapsed";let w,j;e[8]!==y?(w=ue("border-border no-print z-10",y,"vertical"),e[8]=y,e[9]=w):w=e[9],e[10]!==w?(j=i.jsx(G1,{onDragging:q1,className:w}),e[10]=w,e[11]=j):j=e[11];const N=j,C=r?"resize-handle":"resize-handle-collapsed";let k,_;e[12]!==C?(k=ue("border-border no-print z-20",C,"horizontal"),e[12]=C,e[13]=k):k=e[13],e[14]!==k?(_=i.jsx(G1,{onDragging:q1,className:k}),e[14]=k,e[15]=_):_=e[15];const E=_;let I,A,F,D,M,O,R,z,T,L,$,W,G,X,H,Y,K,V,q,U,ne,Q;e[16]!==s?(I=i.jsx("div",{className:"text-sm text-(--slate-11) uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=I):I=e[17],e[18]!==a?(A=()=>a(!1),e[18]=a,e[19]=A):A=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(F=i.jsx(Vt,{className:"w-4 h-4"}),e[20]=F):F=e[20],e[21]!==A?(D=i.jsx(ye,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:A,children:F}),e[21]=A,e[22]=D):D=e[22],e[23]!==I||e[24]!==D?(M=i.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[I,D]}),e[23]=I,e[24]=D,e[25]=M):M=e[25],e[26]!==s?(O=s==="files"&&i.jsx(zw,{}),e[26]=s,e[27]=O):O=e[27],e[28]!==s?(R=s==="errors"&&i.jsx(Pw,{}),e[28]=s,e[29]=R):R=e[29],e[30]!==s?(z=s==="variables"&&i.jsx(Jw,{}),e[30]=s,e[31]=z):z=e[31],e[32]!==s?(T=s==="dependencies"&&i.jsx(Lw,{}),e[32]=s,e[33]=T):T=e[33],e[34]!==s?(L=s==="packages"&&i.jsx($w,{}),e[34]=s,e[35]=L):L=e[35],e[36]!==s?($=s==="outline"&&i.jsx(Ww,{}),e[36]=s,e[37]=$):$=e[37],e[38]!==s?(W=s==="datasources"&&i.jsx(Fw,{}),e[38]=s,e[39]=W):W=e[39],e[40]!==s?(G=s==="documentation"&&i.jsx(Bw,{}),e[40]=s,e[41]=G):G=e[41],e[42]!==s?(X=s==="snippets"&&i.jsx(qw,{}),e[42]=s,e[43]=X):X=e[43],e[44]!==s?(H=s==="scratchpad"&&i.jsx(Vw,{}),e[44]=s,e[45]=H):H=e[45],e[46]!==s?(Y=s==="chat"&&i.jsx(Ow,{}),e[46]=s,e[47]=Y):Y=e[47],e[48]!==s?(K=s==="agents"&&i.jsx(Rw,{}),e[48]=s,e[49]=K):K=e[49],e[50]!==s?(V=s==="logs"&&i.jsx(Uw,{}),e[50]=s,e[51]=V):V=e[51],e[52]!==s?(q=s==="tracing"&&i.jsx(Hw,{}),e[52]=s,e[53]=q):q=e[53],e[54]!==s?(U=s==="secrets"&&i.jsx(Gw,{}),e[54]=s,e[55]=U):U=e[55],e[56]!==O||e[57]!==R||e[58]!==z||e[59]!==T||e[60]!==L||e[61]!==$||e[62]!==W||e[63]!==G||e[64]!==X||e[65]!==H||e[66]!==Y||e[67]!==K||e[68]!==V||e[69]!==q||e[70]!==U?(ne=i.jsx(S.Suspense,{children:i.jsxs(wa,{children:[O,R,z,T,L,$,W,G,X,H,Y,K,V,q,U]})}),e[56]=O,e[57]=R,e[58]=z,e[59]=T,e[60]=L,e[61]=$,e[62]=W,e[63]=G,e[64]=X,e[65]=H,e[66]=Y,e[67]=K,e[68]=V,e[69]=q,e[70]=U,e[71]=ne):ne=e[71],e[72]!==M||e[73]!==ne?(Q=i.jsx(Xl,{children:i.jsxs("div",{className:"flex flex-col h-full flex-1 overflow-hidden mr-[-4px]",children:[M,ne]})}),e[72]=M,e[73]=ne,e[74]=Q):Q=e[74];const ee=Q,oe=`helper-${u}`,se=o&&"border-r border-l border-(--slate-7)";let ae,te,_e,he,we,ke;e[75]!==se?(ae=ue("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",se),e[75]=se,e[76]=ae):ae=e[76],e[77]===Symbol.for("react.memo_cache_sentinel")?(te=(le,je)=>{var Ne;je===0&&le===10&&((Ne=c.current)==null||Ne.resize(30))},e[77]=te):te=e[77],e[78]!==a?(_e=()=>a(!1),he=()=>a(!0),e[78]=a,e[79]=_e,e[80]=he):(_e=e[79],he=e[80]),e[81]!==ee||e[82]!==N?(we=i.jsxs("span",{className:"flex flex-row h-full",children:[ee," ",N]}),e[81]=ee,e[82]=N,e[83]=we):we=e[83],e[84]!==oe||e[85]!==ae||e[86]!==_e||e[87]!==he||e[88]!==we?(ke=i.jsx(ka,{ref:c,id:oe,"data-testid":"helper",collapsedSize:0,collapsible:!0,className:ae,minSize:10,defaultSize:0,maxSize:75,onResize:te,onCollapse:_e,onExpand:he,children:we},"helper"),e[84]=oe,e[85]=ae,e[86]=_e,e[87]=he,e[88]=we,e[89]=ke):ke=e[89];const ge=ke,Ee=`terminal-${h}`,Oe=r&&"border-(--slate-7)";let ve,be,et,rt,ct,dt,pt,ut,wt;e[90]!==Oe?(ve=ue("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",Oe),e[90]=Oe,e[91]=ve):ve=e[91],e[92]===Symbol.for("react.memo_cache_sentinel")?(be=(le,je)=>{var Ne;je===0&&le===10&&((Ne=d.current)==null||Ne.resize(30))},e[92]=be):be=e[92],e[93]!==l?(et=()=>l(!1),rt=()=>l(!0),e[93]=l,e[94]=et,e[95]=rt):(et=e[94],rt=e[95]),e[96]===Symbol.for("react.memo_cache_sentinel")?(ct=i.jsx("div",{}),e[96]=ct):ct=e[96],e[97]!==l?(dt=()=>l(!1),e[97]=l,e[98]=dt):dt=e[98],e[99]!==r||e[100]!==dt?(pt=i.jsx(S.Suspense,{fallback:ct,children:i.jsx(Mw,{visible:r,onClose:dt})}),e[99]=r,e[100]=dt,e[101]=pt):pt=e[101],e[102]!==r||e[103]!==pt?(ut=i.jsx(jw,{isOpen:r,children:pt}),e[102]=r,e[103]=pt,e[104]=ut):ut=e[104],e[105]!==Ee||e[106]!==ve||e[107]!==et||e[108]!==rt||e[109]!==ut||e[110]!==E?(wt=i.jsxs(ka,{ref:d,id:Ee,"data-testid":"terminal",collapsedSize:0,collapsible:!0,className:ve,minSize:10,defaultSize:0,maxSize:75,onResize:be,onCollapse:et,onExpand:rt,children:[E,ut]},"terminal"),e[105]=Ee,e[106]=ve,e[107]=et,e[108]=rt,e[109]=ut,e[110]=E,e[111]=wt):wt=e[111];const Lt=wt;let On,Jt,Ft,zt,to,Rn,No,re,ce;return e[112]===Symbol.for("react.memo_cache_sentinel")?(On=MC(),e[112]=On):On=e[112],e[113]===Symbol.for("react.memo_cache_sentinel")?(Jt=i.jsx(wa,{children:i.jsx(xw,{})}),e[113]=Jt):Jt=e[113],e[114]!==Lt?(Ft=i.jsx(np,{capability:"terminal",children:Lt}),e[114]=Lt,e[115]=Ft):Ft=e[115],e[116]!==g||e[117]!==Ft?(zt=i.jsx(ka,{children:i.jsxs(H1,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Ft]})}),e[116]=g,e[117]=Ft,e[118]=zt):zt=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(to=i.jsx(Qj,{}),e[119]=to):to=e[119],e[120]!==ge||e[121]!==zt?(Rn=i.jsxs(H1,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:On,children:[Jt,ge,zt,to]}),e[120]=ge,e[121]=zt,e[122]=Rn):Rn=e[122],e[123]===Symbol.for("react.memo_cache_sentinel")?(No=i.jsx(Sw,{}),e[123]=No):No=e[123],e[124]===Symbol.for("react.memo_cache_sentinel")?(re=i.jsx(Xl,{children:i.jsx(wa,{children:i.jsx(mw,{})})}),e[124]=re):re=e[124],e[125]!==Rn?(ce=i.jsxs(OC,{children:[Rn,No,re]}),e[125]=Rn,e[126]=ce):ce=e[126],ce};function Yw(){window.dispatchEvent(new Event("resize"))}function Xw(){requestAnimationFrame(Yw)}function Qw(){window.dispatchEvent(new Event("resize"))}function Zw(){requestAnimationFrame(Qw)}let kl,lp;kl=S.lazy(()=>mt(()=>import("./command-palette-CXZiSv0I.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([147,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109]),import.meta.url)),lp=new URL(window.location.href).searchParams.get(Zj.showChrome)==="false",xg=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=P.c(10);if(lp){let s,a,l;return e[0]!==t?(s=i.jsx(tp,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(kl,{}),e[2]=a):a=e[2],e[3]!==s?(l=i.jsxs(i.Fragment,{children:[s,a]}),e[3]=s,e[4]=l):l=e[4],l}let n,o,r;return e[5]!==t?(n=i.jsx(tp,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(kl,{}),e[7]=o):o=e[7],e[8]!==n?(r=i.jsxs(Kw,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{gg as A,Na as C,Sa as E,Ic as F,Ea as H,Ac as K,Tc as N,Dc as P,Mc as R,Oc as S,Rc as T,Lc as W,UC as __tla,Fc as a,Bc as b,_a as c,Ia as d,Aa as e,Uo as f,bg as g,Ta as h,Pc as i,zc as j,Uc as k,Wc as l,$c as m,xg as n,Vc as s,Da as u};
|