@marimo-team/frontend 0.15.4 → 0.16.0-dev96986

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/dist/assets/ConnectedDataExplorerComponent-CNLoZkWr.js +19 -0
  2. package/dist/assets/{ImageComparisonComponent-CEXMKKA4.js → ImageComparisonComponent-SX7fDaTK.js} +1 -1
  3. package/dist/assets/{VegaLite-Bt14Ds9k.js → VegaLite-MJUW3b7C.js} +6 -6
  4. package/dist/assets/_baseEach-9_logFrf.js +1 -0
  5. package/dist/assets/_baseMap-NzEbKt5c.js +1 -0
  6. package/dist/assets/_baseUniq-C5LFcyNC.js +1 -0
  7. package/dist/assets/_createAggregator-ZRm2b6Zm.js +1 -0
  8. package/dist/assets/agent-panel-BBd11wNX.js +287 -0
  9. package/dist/assets/agent-panel-D92Mfy1i.css +1 -0
  10. package/dist/assets/{any-language-editor-DiwNT6zp.js → any-language-editor-DwAaEQfS.js} +1 -1
  11. package/dist/assets/architectureDiagram-W76B3OCA-BJmVXUoW.js +36 -0
  12. package/dist/assets/{between-horizontal-start-FyewyCGn.js → between-horizontal-start-KiwU-a3C.js} +1 -1
  13. package/dist/assets/{blockDiagram-QIGZ2CNN-BrOkAf_c.js → blockDiagram-QIGZ2CNN-DzxZjE7B.js} +1 -1
  14. package/dist/assets/{c4Diagram-FPNF74CW-BHPzDxE2.js → c4Diagram-FPNF74CW-DjmldG_J.js} +5 -5
  15. package/dist/assets/channel-DHcKBVM4.js +1 -0
  16. package/dist/assets/chat-panel-DgJZr0eS.js +3 -0
  17. package/dist/assets/{chunk-4BX2VUAB-DLxaCNYh.js → chunk-4BX2VUAB-EUTQThiZ.js} +1 -1
  18. package/dist/assets/{chunk-55IACEB6-DdzvO3HR.js → chunk-55IACEB6-DZAiDJxy.js} +1 -1
  19. package/dist/assets/{chunk-FMBD7UC4-R5o-nSiG.js → chunk-FMBD7UC4-Bd0Czs-J.js} +1 -1
  20. package/dist/assets/{chunk-K7UQS3LO-DxaMrGgG.js → chunk-K7UQS3LO-DEKMIknX.js} +1 -1
  21. package/dist/assets/{chunk-QN33PNHL-DqS9-FYm.js → chunk-QN33PNHL-E0jwHU_n.js} +1 -1
  22. package/dist/assets/{chunk-QZHKN3VN-BZ-TzajS.js → chunk-QZHKN3VN-BzaIHJbq.js} +1 -1
  23. package/dist/assets/{chunk-TVAH2DTR-BsgP2dyv.js → chunk-TVAH2DTR-CZFYvqnm.js} +1 -1
  24. package/dist/assets/{chunk-TZMSLE5B-D-h3ahXI.js → chunk-TZMSLE5B-BNqnFjtv.js} +1 -1
  25. package/dist/assets/{circle-play-CQtRZ-rT.js → circle-play-D3J_mYrF.js} +1 -1
  26. package/dist/assets/classDiagram-KNZD7YFC-D-xwLnlX.js +1 -0
  27. package/dist/assets/classDiagram-v2-RKCZMP56-D-xwLnlX.js +1 -0
  28. package/dist/assets/{clear-button-BY6Z_ViL.js → clear-button-ifzRuAR3.js} +1 -1
  29. package/dist/assets/clone-CSxIll62.js +1 -0
  30. package/dist/assets/command-palette-D2fdVSET.js +1 -0
  31. package/dist/assets/common-Ku-cF_2J.js +1 -0
  32. package/dist/assets/{compile-Ct_jzdKr.js → compile-BgZlHW1c.js} +1 -1
  33. package/dist/assets/cose-bilkent-S5V4N54A-CVM83SqK.js +1 -0
  34. package/dist/assets/dagre-5GWH7T2D-ouQPkxT3.js +4 -0
  35. package/dist/assets/{data-grid-overlay-editor-BN_wulc3.js → data-grid-overlay-editor-B47j5GJJ.js} +1 -1
  36. package/dist/assets/datasources-panel-Bt41Zir-.js +1 -0
  37. package/dist/assets/{dependency-graph-panel-BOmSCZf7.js → dependency-graph-panel-CZC_B7pK.js} +4 -4
  38. package/dist/assets/diagram-N5W7TBWH-CQ817ZdR.js +24 -0
  39. package/dist/assets/diagram-QEK2KX5R-DOK_psUO.js +43 -0
  40. package/dist/assets/diagram-S2PKOQOG-CVljmOW8.js +24 -0
  41. package/dist/assets/{documentation-panel-BxjJO_Gw.js → documentation-panel-C7yIvGg1.js} +1 -1
  42. package/dist/assets/edit-page-CyTMQV2u.js +129 -0
  43. package/dist/assets/{ellipsis-vertical-UHbmjI2n.js → ellipsis-vertical-C7FjlUsY.js} +1 -1
  44. package/dist/assets/{empty-state-BIBXzY_0.js → empty-state-DIOGM_CU.js} +1 -1
  45. package/dist/assets/{erDiagram-AWTI2OKA-E84mAle_.js → erDiagram-AWTI2OKA-DYu8cEdc.js} +1 -1
  46. package/dist/assets/{error-panel-MEvQ6K7h.js → error-panel-Ddb8RkFG.js} +1 -1
  47. package/dist/assets/file-explorer-panel-Oy9DbyFP.js +1 -0
  48. package/dist/assets/{flowDiagram-PVAE7QVJ-DfbIRSAW.js → flowDiagram-PVAE7QVJ-CmvW5iTb.js} +1 -1
  49. package/dist/assets/{ganttDiagram-OWAHRB6G-DR4HZ1z_.js → ganttDiagram-OWAHRB6G-BaKQlCaT.js} +4 -4
  50. package/dist/assets/gitGraphDiagram-NY62KEGX-CWO24eP6.js +65 -0
  51. package/dist/assets/{glide-data-editor-nNmo1lPq.js → glide-data-editor-CNDLEJ9a.js} +11 -11
  52. package/dist/assets/graph-BZKTtxsc.js +1 -0
  53. package/dist/assets/home-page-Bvwppn9N.js +9 -0
  54. package/dist/assets/{index-VPWqq2Pg.js → index-0XOUPdwT.js} +1 -1
  55. package/dist/assets/{index-uacyUula.js → index-BH7f3aiU.js} +1 -1
  56. package/dist/assets/{index-Dt9UWeWn.js → index-BJVyzkx5.js} +1 -1
  57. package/dist/assets/{index-BAH034Ue.js → index-B_d_JZGI.js} +1 -1
  58. package/dist/assets/{index-CB2pnVQG.js → index-BgXbBA39.js} +1 -1
  59. package/dist/assets/{index-B8llrTSo.js → index-Brf2DwUM.js} +1 -1
  60. package/dist/assets/{index-BLu5CX6z.js → index-CXrWwFX6.js} +1 -1
  61. package/dist/assets/{index-DyLSuOH1.js → index-CZaurnA9.js} +1 -1
  62. package/dist/assets/{index-BFSnz7iM.js → index-CerjupfZ.js} +1 -1
  63. package/dist/assets/{index-B7yXbrLa.js → index-D-tZfElD.js} +1 -1
  64. package/dist/assets/{index-c6If577Q.js → index-D3PqGupX.js} +1 -1
  65. package/dist/assets/{index-CSgxTUzD.js → index-DCkzth56.js} +1 -1
  66. package/dist/assets/{index-DWOaniGT.js → index-DFrGFNW1.js} +1 -1
  67. package/dist/assets/{index-CPN7TRA1.js → index-DZhOPkOB.js} +1 -1
  68. package/dist/assets/index-DadI618h.css +1 -0
  69. package/dist/assets/{index-DqzMPAC8.js → index-DkntzpX4.js} +2 -2
  70. package/dist/assets/{index-B1_GXGaP.js → index-DmgwT3sx.js} +1 -1
  71. package/dist/assets/index-PmY0x4Zd.js +578 -0
  72. package/dist/assets/{index-Bq516OmX.js → index-WXJFkQHg.js} +1 -1
  73. package/dist/assets/{index-DSU75csX.js → index-qE8lHQ-N.js} +1 -1
  74. package/dist/assets/{index-DMomwMcN.js → index-zrSUQXha.js} +1 -1
  75. package/dist/assets/infoDiagram-STP46IZ2-CAuVVehw.js +2 -0
  76. package/dist/assets/isEmpty-D1t7Gran.js +1 -0
  77. package/dist/assets/{journeyDiagram-BIP6EPQ6-BBiFyygf.js → journeyDiagram-BIP6EPQ6-D4Rp6H_h.js} +1 -1
  78. package/dist/assets/{kanban-definition-6OIFK2YF-DhgA6Nt6.js → kanban-definition-6OIFK2YF-DFt9DftA.js} +4 -4
  79. package/dist/assets/layout-D8WXi2_g.js +1 -0
  80. package/dist/assets/linear-BwY8e5hA.js +1 -0
  81. package/dist/assets/links-4B6ldZ5P.js +7 -0
  82. package/dist/assets/{logs-panel-B9SmTZAW.js → logs-panel-Dxiyt7dO.js} +1 -1
  83. package/dist/assets/{agent-panel-DpQ6muj-.css → markdown-renderer-ClyzDMmG.css} +1 -1
  84. package/dist/assets/markdown-renderer-VDu-NBKB.js +263 -0
  85. package/dist/assets/mermaid-B-O-Puyi.js +1 -0
  86. package/dist/assets/{mermaid.core-4nVOEVX3.js → mermaid.core-BFFCqfOn.js} +41 -41
  87. package/dist/assets/min-DtVSfYKl.js +1 -0
  88. package/dist/assets/{mindmap-definition-Q6HEUPPD-CVLQNn1q.js → mindmap-definition-Q6HEUPPD-kyvIY8Dg.js} +2 -2
  89. package/dist/assets/{number-overlay-editor-CzRzXLcd.js → number-overlay-editor-GjLB2UK4.js} +1 -1
  90. package/dist/assets/outline-panel-CMJjOoN7.js +1 -0
  91. package/dist/assets/packages-panel-nfXB-bKW.js +1 -0
  92. package/dist/assets/{pieDiagram-ADFJNKIX-C5IQ5DBZ.js → pieDiagram-ADFJNKIX-D8JFQcWR.js} +3 -3
  93. package/dist/assets/{quadrantDiagram-LMRXKWRM-CFXFnQxx.js → quadrantDiagram-LMRXKWRM-Nf8GzxXG.js} +1 -1
  94. package/dist/assets/{react-plotly-mzdv02_Y.js → react-plotly-CnW9p7ZA.js} +1 -1
  95. package/dist/assets/{requirementDiagram-4UW4RH46-D9bPC89T.js → requirementDiagram-4UW4RH46-CCUxF8BZ.js} +1 -1
  96. package/dist/assets/run-page-Bl4p3AbZ.js +1 -0
  97. package/dist/assets/sankeyDiagram-GR3RE2ED-Sr8kDwP1.js +10 -0
  98. package/dist/assets/scratchpad-panel-Ja1Mu-W3.js +1 -0
  99. package/dist/assets/secrets-panel-B-3fcSyP.js +1 -0
  100. package/dist/assets/{sequenceDiagram-C3RYC4MD-6N7_hY4k.js → sequenceDiagram-C3RYC4MD-CBJ152Q3.js} +4 -4
  101. package/dist/assets/{slides-component-DMjQomc3.css → slides-component-C-LoGC1U.css} +1 -1
  102. package/dist/assets/{slides-component-EcjC8sDK.js → slides-component-DGtsVP5o.js} +1 -1
  103. package/dist/assets/snippets-panel-ClNnwKBM.js +1 -0
  104. package/dist/assets/sortBy-D47H6Vyl.js +1 -0
  105. package/dist/assets/state-B_RCHTH5.js +1 -0
  106. package/dist/assets/stateDiagram-KXAO66HF-BlBFSAZr.js +1 -0
  107. package/dist/assets/stateDiagram-v2-UMBNRL4Z-DbA-iToo.js +1 -0
  108. package/dist/assets/storage-BNcWOH3-.js +26 -0
  109. package/dist/assets/terminal-CATzv5Hd.js +10 -0
  110. package/dist/assets/time-CsYqILfB.js +1 -0
  111. package/dist/assets/{timeline-definition-XQNQX7LJ-BEaynAiY.js → timeline-definition-XQNQX7LJ-CGrhjuAs.js} +1 -1
  112. package/dist/assets/tracing-DUbJtOyq.js +2 -0
  113. package/dist/assets/{tracing-panel-BmuHLPrY.js → tracing-panel-DmzqPUtc.js} +2 -2
  114. package/dist/assets/{trash-UBqfK4mR.js → trash-rxdjLzkf.js} +1 -1
  115. package/dist/assets/{tree-XiEycetl.js → tree-C2Ul1h1C.js} +1 -1
  116. package/dist/assets/{treemap-75Q7IDZK-CnuVFbBG.js → treemap-75Q7IDZK-N9hyUpyj.js} +20 -20
  117. package/dist/assets/{ts-tags-CloPe9IY.js → ts-tags-DxCDHihD.js} +1 -1
  118. package/dist/assets/variable-panel-BbgupOdG.js +1 -0
  119. package/dist/assets/{vega-component-DsTH4tuX.js → vega-component-CR_MHOBT.js} +1 -1
  120. package/dist/assets/worker-fHbtoWvT.js +1 -0
  121. package/dist/assets/{xychartDiagram-6GGTOJPD-Dcz3O-A3.js → xychartDiagram-6GGTOJPD-jdLZsMb2.js} +1 -1
  122. package/dist/index.html +2 -2
  123. package/package.json +10 -5
  124. package/src/__tests__/mocks.ts +43 -0
  125. package/src/components/app-config/user-config-form.tsx +78 -1
  126. package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +116 -65
  127. package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
  128. package/src/components/chat/acp/__tests__/context-utils.test.ts +222 -0
  129. package/src/components/chat/acp/__tests__/prompt.test.ts +1 -1
  130. package/src/components/chat/acp/__tests__/state.test.ts +38 -42
  131. package/src/components/chat/acp/agent-docs.tsx +33 -6
  132. package/src/components/chat/acp/agent-panel.css +0 -18
  133. package/src/components/chat/acp/agent-panel.tsx +394 -72
  134. package/src/components/chat/acp/agent-selector.tsx +7 -1
  135. package/src/components/chat/acp/blocks.tsx +40 -10
  136. package/src/components/chat/acp/common.tsx +10 -2
  137. package/src/components/chat/acp/context-utils.ts +127 -0
  138. package/src/components/chat/acp/prompt.ts +96 -53
  139. package/src/components/chat/acp/state.ts +1 -1
  140. package/src/components/chat/acp/types.ts +8 -0
  141. package/src/components/chat/chat-panel.tsx +28 -89
  142. package/src/components/chat/chat-utils.ts +127 -1
  143. package/src/components/chat/markdown-renderer.css +39 -0
  144. package/src/components/chat/markdown-renderer.tsx +12 -47
  145. package/src/components/chat/tool-call-accordion.tsx +148 -26
  146. package/src/components/data-table/SearchBar.tsx +8 -7
  147. package/src/components/data-table/__tests__/column_formatting.test.ts +50 -35
  148. package/src/components/data-table/__tests__/data-table.test.tsx +39 -1
  149. package/src/components/data-table/cell-hover-template/feature.ts +14 -0
  150. package/src/components/data-table/cell-hover-template/types.ts +11 -0
  151. package/src/components/data-table/charts/components/form-fields.tsx +41 -37
  152. package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
  153. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +5 -2
  154. package/src/components/data-table/column-formatting/feature.ts +62 -29
  155. package/src/components/data-table/column-formatting/types.ts +1 -0
  156. package/src/components/data-table/column-header.tsx +3 -1
  157. package/src/components/data-table/column-summary/chart-spec-model.tsx +24 -7
  158. package/src/components/data-table/column-summary/column-summary.tsx +18 -9
  159. package/src/components/data-table/columns.tsx +42 -18
  160. package/src/components/data-table/data-table.tsx +10 -2
  161. package/src/components/data-table/date-popover.tsx +85 -75
  162. package/src/components/data-table/filter-pills.tsx +14 -9
  163. package/src/components/data-table/header-items.tsx +5 -1
  164. package/src/components/data-table/pagination.tsx +20 -13
  165. package/src/components/data-table/renderers.tsx +28 -0
  166. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +10 -8
  167. package/src/components/datasources/column-preview.tsx +6 -2
  168. package/src/components/datasources/datasources.tsx +8 -12
  169. package/src/components/editor/Cell.tsx +6 -0
  170. package/src/components/editor/actions/name-cell-input.tsx +6 -1
  171. package/src/components/editor/actions/useCellActionButton.tsx +3 -1
  172. package/src/components/editor/ai/__tests__/completion-utils.test.ts +178 -1
  173. package/src/components/editor/ai/add-cell-with-ai.tsx +68 -66
  174. package/src/components/editor/ai/ai-completion-editor.tsx +29 -26
  175. package/src/components/editor/ai/completion-handlers.tsx +44 -6
  176. package/src/components/editor/ai/completion-utils.ts +92 -0
  177. package/src/components/editor/ai/transport/chat-transport.tsx +39 -0
  178. package/src/components/editor/cell/CellStatus.tsx +23 -20
  179. package/src/components/editor/cell/CreateCellButton.tsx +3 -4
  180. package/src/components/editor/cell/StagedAICell.tsx +51 -0
  181. package/src/components/editor/cell/cell-actions.tsx +2 -1
  182. package/src/components/editor/cell/code/language-toggle.tsx +3 -4
  183. package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +39 -28
  184. package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
  185. package/src/components/editor/file-tree/requesting-tree.tsx +14 -8
  186. package/src/components/editor/renderers/CellArray.tsx +3 -4
  187. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
  188. package/src/components/editor/renderers/slides-layout/types.ts +1 -0
  189. package/src/components/pages/home-page.tsx +4 -1
  190. package/src/components/slides/slides-component.tsx +1 -1
  191. package/src/components/slides/slides.css +6 -0
  192. package/src/components/terminal/__tests__/state.test.ts +207 -0
  193. package/src/components/terminal/hooks.ts +41 -0
  194. package/src/components/terminal/state.ts +75 -0
  195. package/src/components/terminal/terminal.tsx +334 -13
  196. package/src/components/terminal/theme.tsx +57 -0
  197. package/src/components/tracing/tracing-spec.ts +5 -4
  198. package/src/components/ui/range-slider.tsx +4 -2
  199. package/src/components/ui/slider.tsx +3 -1
  200. package/src/components/variables/variables-table.tsx +3 -0
  201. package/src/core/MarimoApp.tsx +9 -6
  202. package/src/core/ai/__tests__/staged-cells.test.ts +356 -0
  203. package/src/core/ai/context/__tests__/registry.test.ts +6 -4
  204. package/src/core/ai/context/providers/cell-output.ts +3 -2
  205. package/src/core/ai/context/providers/error.ts +3 -1
  206. package/src/core/ai/context/providers/file.ts +7 -2
  207. package/src/core/ai/context/providers/tables.ts +3 -2
  208. package/src/core/ai/context/providers/variable.ts +6 -4
  209. package/src/core/ai/staged-cells.ts +208 -0
  210. package/src/core/cells/cells.ts +1 -1
  211. package/src/core/cells/logs.ts +1 -1
  212. package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
  213. package/src/core/codemirror/language/LanguageAdapters.ts +9 -3
  214. package/src/core/codemirror/lsp/federated-lsp.ts +1 -1
  215. package/src/core/codemirror/lsp/notebook-lsp.ts +8 -2
  216. package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
  217. package/src/core/codemirror/rtc/loro/awareness.ts +52 -17
  218. package/src/core/codemirror/rtc/loro/sync.ts +12 -4
  219. package/src/core/config/config-schema.ts +1 -0
  220. package/src/core/config/config.ts +4 -0
  221. package/src/core/hotkeys/hotkeys.ts +8 -4
  222. package/src/core/i18n/__tests__/locale-provider.test.tsx +176 -0
  223. package/src/core/i18n/locale-provider.tsx +35 -0
  224. package/src/core/i18n/with-locale.tsx +12 -0
  225. package/src/core/islands/components/web-components.tsx +13 -10
  226. package/src/core/islands/main.ts +2 -2
  227. package/src/core/kernel/RuntimeState.ts +4 -1
  228. package/src/core/kernel/messages.ts +8 -12
  229. package/src/core/network/DeferredRequestRegistry.ts +16 -4
  230. package/src/core/runtime/runtime.ts +5 -4
  231. package/src/core/saving/__tests__/filename.test.ts +37 -0
  232. package/src/core/static/__tests__/download-html.test.ts +43 -1
  233. package/src/core/wasm/bridge.ts +5 -1
  234. package/src/core/wasm/store.ts +4 -1
  235. package/src/core/wasm/worker/message-buffer.ts +3 -2
  236. package/src/core/websocket/types.ts +22 -16
  237. package/src/core/websocket/useMarimoWebSocket.tsx +2 -2
  238. package/src/css/app/Cell.css +11 -0
  239. package/src/hooks/useFormatting.ts +97 -0
  240. package/src/hooks/useTimer.ts +8 -5
  241. package/src/plugins/core/RenderHTML.tsx +36 -2
  242. package/src/plugins/core/__test__/RenderHTML.test.ts +72 -0
  243. package/src/plugins/core/registerReactComponent.tsx +44 -10
  244. package/src/plugins/impl/DataTablePlugin.tsx +4 -0
  245. package/src/plugins/impl/FileBrowserPlugin.tsx +8 -2
  246. package/src/plugins/impl/RangeSliderPlugin.tsx +5 -3
  247. package/src/plugins/impl/SliderPlugin.tsx +3 -1
  248. package/src/plugins/impl/anywidget/model.ts +16 -5
  249. package/src/plugins/impl/data-editor/types.ts +7 -5
  250. package/src/plugins/impl/data-explorer/components/column-summary.tsx +20 -13
  251. package/src/plugins/impl/panel/utils.ts +6 -4
  252. package/src/plugins/layout/OutlinePlugin.tsx +69 -0
  253. package/src/plugins/layout/StatPlugin.tsx +4 -1
  254. package/src/plugins/plugins.ts +2 -0
  255. package/src/stories/cell.stories.tsx +1 -1
  256. package/src/stories/layout/vertical/one-column.stories.tsx +1 -1
  257. package/src/utils/__tests__/cell-urls.test.ts +29 -0
  258. package/src/utils/__tests__/dates.test.ts +45 -24
  259. package/src/utils/__tests__/filenames.test.ts +18 -0
  260. package/src/utils/__tests__/numbers.test.ts +42 -30
  261. package/src/utils/__tests__/once.test.ts +187 -0
  262. package/src/utils/__tests__/path.test.ts +38 -0
  263. package/src/utils/__tests__/urls.test.ts +56 -1
  264. package/src/utils/dates.ts +15 -10
  265. package/src/utils/edit-distance.ts +8 -6
  266. package/src/utils/errors.ts +9 -0
  267. package/src/utils/id-tree.tsx +21 -10
  268. package/src/utils/localStorage.ts +13 -4
  269. package/src/utils/numbers.ts +11 -11
  270. package/src/utils/once.ts +32 -0
  271. package/src/utils/paths.ts +4 -1
  272. package/src/utils/pluralize.ts +12 -5
  273. package/src/utils/python-poet/poet.ts +30 -15
  274. package/src/utils/time.ts +5 -1
  275. package/dist/assets/ConnectedDataExplorerComponent-Cn5-l2X1.js +0 -19
  276. package/dist/assets/_baseEach-C1FLm7WW.js +0 -1
  277. package/dist/assets/_baseMap-DBVArUYD.js +0 -1
  278. package/dist/assets/_baseUniq-Dk7ZPJ3N.js +0 -1
  279. package/dist/assets/_createAggregator-Bn38fDd3.js +0 -1
  280. package/dist/assets/agent-panel-COUYnuIK.js +0 -475
  281. package/dist/assets/architectureDiagram-W76B3OCA-DBzWQKKu.js +0 -36
  282. package/dist/assets/channel-CjhbjOv4.js +0 -1
  283. package/dist/assets/chat-panel-BPXKoTnZ.js +0 -7
  284. package/dist/assets/chat-panel-Brrs_eeH.css +0 -1
  285. package/dist/assets/classDiagram-KNZD7YFC-DHs5cFzy.js +0 -1
  286. package/dist/assets/classDiagram-v2-RKCZMP56-DHs5cFzy.js +0 -1
  287. package/dist/assets/clone-DM1YNjEn.js +0 -1
  288. package/dist/assets/command-palette-S0bzQp7v.js +0 -1
  289. package/dist/assets/common-B8U9k2Ly.js +0 -1
  290. package/dist/assets/cose-bilkent-S5V4N54A-wz1Sfx7j.js +0 -1
  291. package/dist/assets/dagre-5GWH7T2D-BfpcVBgq.js +0 -4
  292. package/dist/assets/datasources-panel-DfuURLJw.js +0 -1
  293. package/dist/assets/diagram-N5W7TBWH-Bf0oqqQh.js +0 -24
  294. package/dist/assets/diagram-QEK2KX5R-ZTc3qikh.js +0 -43
  295. package/dist/assets/diagram-S2PKOQOG-tLScBy7Z.js +0 -24
  296. package/dist/assets/edit-page-DJ8kJZ9w.js +0 -129
  297. package/dist/assets/file-explorer-panel-CzNUJ63G.js +0 -1
  298. package/dist/assets/gitGraphDiagram-NY62KEGX-C1t6QtVa.js +0 -65
  299. package/dist/assets/graph-CssCVWIq.js +0 -1
  300. package/dist/assets/home-page-9eW6qida.js +0 -9
  301. package/dist/assets/index-CknhX2Vy.css +0 -1
  302. package/dist/assets/index-DcCIe7np.js +0 -28
  303. package/dist/assets/index-OC46250R.js +0 -570
  304. package/dist/assets/infoDiagram-STP46IZ2-CwiAoz9f.js +0 -2
  305. package/dist/assets/layout-DpQrxGW-.js +0 -1
  306. package/dist/assets/linear-NsreOeBF.js +0 -1
  307. package/dist/assets/links-CbvGxbsJ.js +0 -7
  308. package/dist/assets/mermaid-DSt0r6IQ.js +0 -1
  309. package/dist/assets/min-D259kI3t.js +0 -1
  310. package/dist/assets/outline-panel-uvsS-YEQ.js +0 -1
  311. package/dist/assets/packages-panel-xMz9W2hW.js +0 -1
  312. package/dist/assets/run-page-Bb68qdhQ.js +0 -1
  313. package/dist/assets/sankeyDiagram-GR3RE2ED-BSJOau8E.js +0 -10
  314. package/dist/assets/scratchpad-panel-BF4BO-U4.js +0 -1
  315. package/dist/assets/secrets-panel-CdIX44dQ.js +0 -1
  316. package/dist/assets/snippets-panel-Dco9h0rb.js +0 -1
  317. package/dist/assets/sortBy-aLGA-PGK.js +0 -1
  318. package/dist/assets/stateDiagram-KXAO66HF-Bd68WT3b.js +0 -1
  319. package/dist/assets/stateDiagram-v2-UMBNRL4Z-BXz_GSwb.js +0 -1
  320. package/dist/assets/storage-CGlP4lCF.js +0 -26
  321. package/dist/assets/terminal-CxkHubcu.js +0 -9
  322. package/dist/assets/time-D2nr1UgQ.js +0 -1
  323. package/dist/assets/tracing-kTqHxa7q.js +0 -2
  324. package/dist/assets/variable-panel-noTnH-AQ.js +0 -1
  325. 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-CxkHubcu.js","./index-OC46250R.js","./index-CknhX2Vy.css","./terminal-B3isKKSk.css","./chat-panel-BPXKoTnZ.js","./links-CbvGxbsJ.js","./links-5Ym3a_OV.css","./empty-state-BIBXzY_0.js","./storage-CGlP4lCF.js","./index-Dt9UWeWn.js","./index-BAH034Ue.js","./index-DqzMPAC8.js","./index-DSU75csX.js","./index-CSgxTUzD.js","./index-BLu5CX6z.js","./index-B8llrTSo.js","./index-CPN7TRA1.js","./index-BFSnz7iM.js","./index-Bq516OmX.js","./index-CB2pnVQG.js","./index-DWOaniGT.js","./index-c6If577Q.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-DMomwMcN.js","./trash-UBqfK4mR.js","./storage-B3Gax9mZ.css","./index-DcCIe7np.js","./between-horizontal-start-FyewyCGn.js","./_createAggregator-Bn38fDd3.js","./_baseEach-C1FLm7WW.js","./loro_wasm_bg-C1ks32Vm.js","./chat-panel-Brrs_eeH.css","./agent-panel-COUYnuIK.js","./katex-LV4FpwlL.js","./agent-panel-DpQ6muj-.css","./dependency-graph-panel-BOmSCZf7.js","./transform-D9VCJYws.js","./timer-Bqd5yn_a.js","./zoom-COrs4lFh.js","./common-B8U9k2Ly.js","./ellipsis-vertical-UHbmjI2n.js","./dependency-graph-panel-YfRlmuld.css","./datasources-panel-DfuURLJw.js","./sortBy-aLGA-PGK.js","./_baseMap-DBVArUYD.js","./documentation-panel-BxjJO_Gw.js","./error-panel-MEvQ6K7h.js","./file-explorer-panel-CzNUJ63G.js","./icon-32x32-DHZerVul.js","./tree-XiEycetl.js","./index-VPWqq2Pg.js","./logs-panel-B9SmTZAW.js","./clear-button-BY6Z_ViL.js","./outline-panel-uvsS-YEQ.js","./outline-panel-CJw2eR3G.css","./packages-panel-xMz9W2hW.js","./scratchpad-panel-BF4BO-U4.js","./secrets-panel-CdIX44dQ.js","./snippets-panel-Dco9h0rb.js","./snippets-panel-B4N-3dTw.css","./tracing-panel-BmuHLPrY.js","./variable-panel-noTnH-AQ.js","./command-palette-S0bzQp7v.js"])))=>i.map(i=>d[i]);
2
- var Xw=Object.defineProperty;var mp=nt=>{throw TypeError(nt)};var Qw=(nt,$e,gt)=>$e in nt?Xw(nt,$e,{enumerable:!0,configurable:!0,writable:!0,value:gt}):nt[$e]=gt;var P=(nt,$e,gt)=>Qw(nt,typeof $e!="symbol"?$e+"":$e,gt),Zw=(nt,$e,gt)=>$e.has(nt)||mp("Cannot "+gt);var fp=(nt,$e,gt)=>(Zw(nt,$e,"read from private field"),gt?gt.call(nt):$e.get(nt)),pp=(nt,$e,gt)=>$e.has(nt)?mp("Cannot add the same private member more than once"):$e instanceof WeakSet?$e.add(nt):$e.set(nt,gt);import{c as de,jV as oo,jW as ek,jX as Sl,jY as tk,jZ as nk,j_ as gp,j$ as bp,k0 as qs,r as S,i0 as ok,id as rk,gH as xp,k1 as sk,gD as ak,gG as ik,d as me,gB as El,k2 as ro,k3 as Dt,k4 as Hs,k5 as tt,v as Yt,iX as $t,eK as Vt,k6 as Te,k7 as So,p as Se,j5 as Sn,a as z,al as We,S as Be,j as i,aJ as Xt,aR as so,aQ as vr,aS as wr,bF as ao,aO as xe,Q as Eo,bI as Js,aP as io,aw as Fn,$ as yp,ap as pe,am as Ct,gR as _l,cB as Ks,k8 as lk,cA as je,H as Ve,k9 as ck,hF as Mt,ka as vp,kb as wp,kc as Il,kd as kp,L as Je,bT as jp,ba as _o,dT as dk,M as Cp,ao as Qt,ke as uk,bV as Ys,kf as Xs,aj as Bt,f_ as Pe,g7 as Io,g1 as Ge,kg as fe,g0 as Oe,kh as Al,ki as hk,kj as Tl,kk as qe,kl as Np,eh as Dl,ee as Ml,gp as Ol,e2 as Rl,ec as Ll,dd as Ao,iT as Fl,cD as Bn,b as kr,N as Pn,iJ as Sp,iL as Ep,iM as mk,iR as fk,iN as _p,km as Ip,I as he,hg as pk,cX as zn,cV as Un,cY as Wn,cU as lo,eV as En,kn as Ap,iP as Tp,ko as gk,aN as bk,aM as xk,kp as yk,iH as Dp,iI as Mp,bn as vk,e3 as Op,bg as wk,jA as kk,kq as jk,ef as Ck,gs as Bl,bx as Pl,el as zl,eN as Nk,dg as Ot,dR as Qs,ch as Ul,hS as Nt,d7 as Sk,gS as ht,hc as Ek,aK as Wl,kr as jr,ks as Zs,cd as _n,B as le,hx as To,ak as ea,kt as _k,ku as Ik,kv as Rp,aL as Ak,aT as $l,ht as Lp,cR as ta,cC as St,cS as Tk,aU as Dk,jg as Fp,_ as Vl,kw as Mk,kx as Gl,eq as Ok,d6 as Rk,hE as Bp,d9 as Lk,ky as Fk,kz as Pp,jQ as Bk,jO as Pk,jR as zk,jS as Uk,kA as ql,eP as Zt,kB as Wk,a$ as Me,kC as na,kD as Do,kE as Mo,ci as Hl,kF as $k,cg as Jl,jb as st,kG as Kl,cq as Vk,bc as Gt,kH as Gk,iA as Yl,cm as zp,bJ as Up,br as Xl,d4 as qk,d5 as Hk,kI as Jk,bb as Wp,ae as Ql,be as $p,bB as Zl,ac as oa,hG as ec,kJ as Kk,gQ as Pt,kK as Vp,kL as Cr,kM as Gp,kN as tc,kO as qp,kP as Hp,kQ as Jp,gj as Kp,cy as Yp,kR as Yk,kS as en,kT as ra,kU as Xp,kV as sa,gq as nc,b0 as Qp,jK as oc,kW as aa,aZ as Zp,kX as e1,kY as ia,au as $n,eY as rc,hD as t1,bu as n1,kZ as Nr,k_ as Sr,k$ as la,l0 as Vn,l1 as o1,l2 as In,l3 as Oo,l4 as sc,l5 as Er,l6 as Ro,l7 as ac,l8 as ic,l9 as r1,la as ca,lb as Xk,bU as _r,lc as Ir,ld as Qk,gP as da,le as Zk,lf as lc,lg as e4,lh as t4,li as ua,da as Lo,gX as n4,cx as s1,lj as o4,jo as a1,eE as i1,lk as cc,iS as l1,hs as c1,ll as d1,lm as ha,ln as u1,lo as ma,lp as dc,lq as Fo,lr as Ar,ls as Tr,lt as r4,jl as uc,lu as hc,lv as fa,hb as s4,jm as a4,lw as i4,lx as l4,ly as c4,lz as d4,x as u4,lA as h4,lB as m4,lC as f4,i_ as p4,lD as g4,lE as h1,t as v,lF as b4,lG as x4,lH as y4,lI as v4,lJ as w4,lK as k4,lL as j4,lM as C4,lN as N4,lO as S4,lP as E4,lQ as _4,lR as I4,lS as A4,lT as T4,lU as D4,lV as M4,lW as O4,lX as R4,lY as L4,lZ as F4,l_ as B4,l$ as Dr,m0 as P4,m1 as z4,m2 as U4,m3 as W4,m4 as $4,m5 as V4,m6 as G4,m7 as q4,m8 as mc,bi as fc,m9 as m1,ma as H4,mb as J4,dI as K4,mc as Y4,dJ as X4,dL as Mr,md as Q4,me as Z4,mf as e3,mg as t3,mh as n3,mi as o3,mj as r3,mk as s3,ml as a3,mm as i3,dM as l3,mn as c3,mo as d3,mp as u3,mq as f1,gU as h3,mr as m3,ms as p1,gY as f3,mt as pa,mu as p3,mv as g3,mw as b3,mx as x3,V as pc,b8 as gc,bs as Gn,dQ as bc,my as g1,cF as y3,dZ as xc,bm as b1,mz as v3,mA as Or,hh as yc,mB as co,mC as w3,h6 as x1,av as ga,mD as k3,mE as j3,mF as C3,cj as N3,mG as y1,cl as S3,bd as E3,ad as vc,mH as _3,mI as I3,mJ as A3,mK as Rr,mL as Lr,hC as wc,mM as T3,j3 as D3,db as M3,a0 as mt,mN as v1,mO as O3,mP as R3,mQ as kc,mR as jc,mS as L3,mT as w1,mU as k1,mV as ba,iW as F3,aF as j1,gJ as B3,mW as C1,gx as Ke,mX as Fr,mY as Bo,mZ as P3,m_ as z3,m$ as U3,n0 as W3,e4 as N1,n1 as $3,u as S1,ed as V3,n2 as G3,e9 as q3,n3 as H3,dY as E1,n4 as J3,en as K3,ej as Y3,ei as X3,dc as Q3,d3 as Z3,n5 as ej,n6 as tj,n7 as nj,g3 as oj,n8 as _1,n9 as I1,na as A1,nb as rj,co as Cc,nc as T1,nd as D1,b2 as xa,ne as sj,nf as M1,ng as aj,nh as ij,ni as O1,aG as ya,nj as lj,de as cj,nk as dj,K as uj,nl as hj,nm as Br,nn as R1,hB as L1,ga as va,eb as F1,ar as B1,cE as Nc,hf as Sc,no as mj,hz as P1,np as fj,nq as z1,g2 as pj,g4 as gj,jH as bj,iK as xj,iO as Ec,jI as yj,nr as U1,cc as vj,fM as wj,ns as kj,nt as jj,nu as Cj,U as wa,hi as Nj,nv as Sj,nw as Ej,nx as W1,F as _j,gu as $1,ny as Ij,ab as _c,nz as Aj,nA as Tj,nB as Dj,cN as Mj,nC as Oj,nD as Rj,nE as Lj,aD as Fj,nF as ka,hT as Bj,d_ as Pj,d$ as zj,j4 as Uj,jr as Wj,nG as $j,bE as Vj,nH as Gj,nI as qj,bS as Hj,aV as ja,nJ as V1,nK as G1,aX as q1,aW as Jj,gO as Kj,__tla as Yj}from"./index-OC46250R.js";import{B as Ca,A as Xj,G as Qj,o as Zj,s as eC,k as tC,L as H1,a as J1,b as nC,M as oC,Y as rC,e as tn,c as Pr,C as sC,S as aC,K as iC,f as lC,i as cC,h as K1,j as dC,l as uC,u as Y1,P as zr,m as X1,n as hC,p as mC,q as fC,D as Po}from"./links-CbvGxbsJ.js";import{V as Q1,S as pC,j as Z1,k as eg,L as tg,l as ng,F as og,I as Ic,M as gC,m as rg,n as bC,h as zo,E as Na,o as sg,p as ag,N as ig,q as xC,s as Ac,i as lg,t as yC,v as vC,w as wC,x as kC,y as jC,z as CC,a as NC,C as SC,R as cg,A as EC,b as _C,c as IC,P as AC,__tla as TC}from"./storage-CGlP4lCF.js";import{c as DC}from"./_createAggregator-Bn38fDd3.js";import{_ as dg,a as ug,i as MC,w as OC,L as hg,A as RC,C as mg,b as Tc,c as fg,__tla as LC}from"./loro_wasm_bg-C1ks32Vm.js";let pg,Sa,Ea,Dc,_a,Mc,Oc,Rc,Lc,Fc,Bc,Pc,zc,Uc,Ia,Aa,Ta,Uo,gg,Da,Wc,$c,Vc,bg,Gc,Ma,FC=Promise.all([(()=>{try{return Yj}catch{}})(),(()=>{try{return TC}catch{}})(),(()=>{try{return LC}catch{}})()]).then(async()=>{var Vs,hp;var nt=DC(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});let $e,gt,Oa,qc,Hc,Ur,Ra,Jc,Wr,Kc,La,Yc,Xc,Qc,Zc,ed,td,nd,od,rd,sd,ad,Fa,id,ld,cd,dd,ud,hd,md,Ba,fd,Pa,pd,za,gd,bd,xd,yd,vd,wd,kd,Ua,jd,Cd,Et,_t;Wc=de("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Vc=de("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),$e=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"}]]),Oa=de("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Sa=de("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),qc=de("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Hc=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"}]]),Ra=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"}]]),Jc=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"}]]),Kc=de("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),La=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"}]]),Yc=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"}]]),Xc=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"}]]),Qc=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"}]]),Dc=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"}]]),Zc=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"}]]),ed=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"}]]),td=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"}]]),nd=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"}]]),od=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"}]]),rd=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"}]]),sd=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"}]]),Mc=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"}]]),ad=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"}]]),Fa=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"}]]),id=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"}]]),ld=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"}]]),cd=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"}]]),dd=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"}]]),ud=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"}]]),Oc=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"}]]),hd=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"}]]),md=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"}]]),Ba=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"}]]),fd=de("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Pa=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"}]]),pd=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"}]]),Lc=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"}]]),Da=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"}]]),za=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"}]]),Fc=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"}]]),gd=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"}]]),bd=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"}]]),xd=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"}]]),yd=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"}]]),vd=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"}]]),wd=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"}]]),kd=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"}]]),Bc=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"}]]),Ua=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"}]]),jd=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"}]]),Cd=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"}]]),zc=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 xg(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 yg(t,e,n){const[o,r,s]=Sl(n==null?void 0:n.in,t,t,e),a=$r(r,s),l=Math.abs((function(u,h,m){const[f,b]=Sl(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;xg(o)&&l===1&&$r(o,s)===1&&(c=!1);const d=a*(l-+c);return d===0?0:d}function vg(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 wg(t,e){return(function(n,o,r){const s=tk(),a=(r==null?void 0:r.locale)??s.locale??nk,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]=Sl(r==null?void 0:r.in,...l>0?[o,n]:[n,o]),h=vg(u,d),m=(gp(u)-gp(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<bp){const x=Math.round(f/60);return a.formatDistance("aboutXHours",x,c)}if(f<2520)return a.formatDistance("xDays",1,c);if(f<qs){const x=Math.round(f/bp);return a.formatDistance("xDays",x,c)}if(f<2*qs)return b=Math.round(f/qs),a.formatDistance("aboutXMonths",b,c);if(b=yg(u,d),b<12){const x=Math.round(f/qs);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 ek(n,Date.now())})(t),e)}const kg=S.createContext({}),jg=S.forwardRef(function(t,e){[t,e]=ak(t,e,kg);let{toolbarProps:n}=(function(s,a){const{"aria-label":l,"aria-labelledby":c,orientation:d="horizontal"}=s;let[u,h]=S.useState(!1);ok(()=>{var p;h(!(!a.current||!(!((p=a.current.parentElement)===null||p===void 0)&&p.closest('[role="toolbar"]'))))});const{direction:m}=rk(),f=m==="rtl"&&d==="horizontal";let b=sk(a);const x=S.useRef(null);return{toolbarProps:{...xp(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=ik({...t,values:{orientation:t.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=xp(t,{global:!0});return delete r.id,me.createElement("div",{...El(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=>Hs(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(),Nd=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(),Sd=Dt.define({create:()=>!1,update(t,e){for(const n of e.effects)if(n.is(uo))return n.value;return t}}),Ed=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},_d=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),Id=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)},Cg="\u2318",Ng="\u229E Win",Sg="Ctrl";function Wa(t){return t.replace("Mod",navigator.platform.startsWith("Mac")?Cg:navigator.platform.startsWith("Win")?Ng:Sg).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 Eg extends So{constructor(n){super();P(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 _g{constructor(e){P(this,"cache",new Map);P(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 Ig=(t,e)=>$t.fromClass(class{constructor(){P(this,"abortController",null);P(this,"cache");this.cache=new _g(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()}}),Ag=$t.fromClass(class{constructor(){P(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 Eg(r),side:1});return a.push(l.range(s)),Te.set(a)})(t.view,e):Te.none}},{decorations:t=>t.decorations}),Ad=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($a);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},Tg=Vt.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($a);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:Ad}]),$a=ro.define({combine:t=>t.at(-1)});function Td(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,$a.of(t),Ig(o,t),Ag,n?Tg:[]]}const Dg=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 Mg(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">${Wa(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(),Ed(t)}),o}const Va=ro.define({combine:t=>Hs(t,{render:Mg,hideOnBlur:!1})}),Og=$t.fromClass((hp=class{constructor(t){P(this,"view");P(this,"suppress");P(this,"dom");P(this,"mousedown",()=>{this.suppress=!0});P(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});P(this,"scroll",()=>{this.display(this.view)});P(this,"windowScroll",()=>{this.display(this.view)});pp(this,Vs,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(Va);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(Va).hideOnBlur&&!t.hasFocus)return this.dom.style.display="none",void this.dom.setAttribute("aria-hidden","true");t.requestMeasure({read:fp(this,Vs)})}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()}},Vs=new WeakMap,hp)),Rg=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 Lg extends So{constructor(n){super();P(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">${Wa(l.acceptEdit)}</span> Accept`,c.setAttribute("aria-label","Accept changes"),c.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),_d(n)});const d=bt("button","cm-floating-button cm-floating-reject");return d.innerHTML=`<span class="hotkey">${Wa(l.rejectEdit)}</span> Reject`,d.setAttribute("aria-label","Reject changes"),d.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),n.focus(),Id(n)}),s.append(c,d),o.append(r,s),o}updateDOM(n,o){return!0}}class Fg extends So{constructor(n){super();P(this,"complete");P(this,"abortController",null);P(this,"dom",null);P(this,"input",null);P(this,"loadingContainer",null);P(this,"helpInfo",null);P(this,"inputContainer",null);P(this,"form",null);P(this,"view",null);P(this,"onKeyDown",async n=>{n.key!=="Enter"||n.shiftKey?n.key==="Escape"&&this.onCancel():(n.preventDefault(),await this.handleSubmit())});P(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())});P(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(Nd),r=n.state.field(Sd),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 Bg(t){if(!t.prompt)throw new Error("prompt function is required");const e={...Vr,...t.keymaps};return[Wo.of(t),Hn,Nd,Go,Sd,[Og,Rg],Dg,Vt.of([{key:e.showInput,run:Ed}]),Sn.highest([Vt.of([{key:e.acceptEdit,run:_d},{key:e.rejectEdit,run:Id}])]),Pg,zg,Ug,Wg]}const Pg=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})]})}),zg=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}),Ug=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 Fg(n.prompt),side:-1}).range(l))}}return Te.set(o)}),Wg=Dt.define({create:t=>Te.none,update(t,e){const n=e.state.field(Go);return n?Te.set([Te.widget({widget:new Lg(n.oldCode),block:!0}).range(n.from)]):Te.none},provide:t=>Se.decorations.from(t)}),Jr="https://static.marimo.app",$g=t=>{const e=z.c(25),{onClose:n}=t,[o,r]=S.useState(""),{exportAsHTML:s}=We(),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 k=await s({download:!1,includeCode:!0,files:Q1.INSTANCE.filenames()}),N=Be({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Jr}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:k,path:a})}).catch(()=>{N.dismiss(),Be({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(),Be({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(vr,{children:[d,i.jsxs(wr,{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 k=w.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,"");r(k)},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(Vg,{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(xe,{"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(xe,{"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(Js,{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},Vg=t=>{const e=z.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(yp,{size:14,strokeWidth:1.5}),e[2]=a):a=e[2],e[3]!==s?(l=i.jsx(xe,{"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 Dd(){const t=z.c(2),e=Ct(_l);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=Ks.parse(a.parentNode.id);break}}e(a=>({mode:lk(a.mode),cellAnchor:s})),requestAnimationFrame(()=>{var a;s!==null&&((a=document.getElementById(Ks.create(s)))==null||a.scrollIntoView())})},t[0]=e,t[1]=n):n=t[1],n}function Ga(t){const e=z.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],je(o)}function Md(){const t=z.c(2),e=qo();let n;return t[0]!==e?(n=()=>e(vp(Mt())),t[0]=e,t[1]=n):n=t[1],je(n)}function qo(){const t=z.c(3),{prepareForRun:e}=Ve(),{sendRun:n}=We();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?(wp(m)!=="markdown"&&Il(m),f=kp(m)):f=((d=a[u])==null?void 0:d.code)||"",l.push(f),e({cellId:u})}await n({cellIds:r,codes:l}).catch(Gg)},t[0]=e,t[1]=n,t[2]=o):o=t[2],je(o)}function Gg(t){Je.error(t)}let Kr;Kr=[{type:"files",Icon:ed,tooltip:"View files",position:"sidebar"},{type:"variables",Icon:jp,tooltip:"Explore variables",position:"sidebar"},{type:"datasources",Icon:_o,tooltip:"Explore data sources",position:"sidebar"},{type:"dependencies",Icon:Oc,tooltip:"Explore dependencies",position:"sidebar"},{type:"packages",Icon:Ca,tooltip:"Manage packages",position:"sidebar"},{type:"outline",Icon:Fc,tooltip:"View outline",position:"sidebar"},{type:"chat",Icon:dk,tooltip:"Chat with AI",position:"sidebar"},{type:"agents",Icon:od,tooltip:"Agents",position:"sidebar",hidden:!Xs("external_agents")},{type:"documentation",Icon:Bc,tooltip:"View live docs",position:"sidebar"},{type:"logs",Icon:Cp,tooltip:"Notebook logs",position:"sidebar"},{type:"tracing",Icon:Xj,tooltip:"Tracing",position:"sidebar"},{type:"snippets",Icon:xd,tooltip:"Snippets",position:"sidebar"},{type:"secrets",Icon:sd,tooltip:"Secrets",hidden:Qt(),position:"sidebar"},{type:"scratchpad",Icon:uk,tooltip:"Scratchpad",position:"sidebar"},{type:"errors",Icon:Ys,tooltip:"View errors",position:"footer"}],Ia=Bt(!1);function Jn(){return Oe().optional().describe(fe.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Od(){return Oe().optional().describe(fe.of({label:"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"}))}function Yr(){return Oe().optional().describe(fe.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function Rd(){return Oe().optional().describe(fe.of({label:"URI",optionRegex:".*uri.*"}))}function Kn(){return Oe().nonempty().describe(fe.of({label:"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function nn(){return Oe().describe(fe.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function Yn(){return Oe().nonempty().describe(fe.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function Xn(t){const e=hk.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 Ld(){return Io().default(!1).describe(fe.of({label:"Read Only"}))}const Fd=Pe({type:Ge("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"})),Bd=Pe({type:Ge("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"})),Pd=Pe({type:Ge("sqlite"),database:nn().describe(fe.of({label:"Database Path"}))}).describe(fe.of({direction:"two-columns"})),zd=Pe({type:Ge("duckdb"),database:nn().describe(fe.of({label:"Database Path"})),read_only:Ld()}).describe(fe.of({direction:"two-columns"})),Ud=Pe({type:Ge("motherduck"),database:nn().default("my_db").describe(fe.of({label:"Database Name"})),token:Od()}).describe(fe.of({direction:"two-columns"})),Wd=Pe({type:Ge("snowflake"),account:Oe().nonempty().describe(fe.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:Oe().optional().describe(fe.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:nn(),schema:Oe().optional().describe(fe.of({label:"Schema",optionRegex:".*snowflake.*"})),username:Yn(),password:Jn(),role:Oe().optional().describe(fe.of({label:"Role"}))}).describe(fe.of({direction:"two-columns"})),$d=Pe({type:Ge("bigquery"),project:Oe().nonempty().describe(fe.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:Oe().nonempty().describe(fe.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:Oe().describe(fe.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(fe.of({direction:"two-columns"})),Vd=Pe({type:Ge("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"})),Gd=Pe({type:Ge("timeplus"),host:Kn().default("localhost"),port:Xn(8123).optional(),username:Yn().default("default"),password:Jn().default("")}).describe(fe.of({direction:"two-columns"})),qd=Pe({type:Ge("chdb"),database:nn().describe(fe.of({label:"Database Path"})),read_only:Ld()}).describe(fe.of({direction:"two-columns"})),Hd=Pe({type:Ge("trino"),host:Kn(),port:Xn(8080),database:nn(),schema:Oe().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"})),Jd=Pe({type:Ge("iceberg"),name:Oe().describe(fe.of({label:"Catalog Name"})),catalog:Al("type",[Pe({type:Ge("REST"),warehouse:Yr(),uri:Oe().optional().describe(fe.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Od()}),Pe({type:Ge("SQL"),warehouse:Yr(),uri:Oe().optional().describe(fe.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),Pe({type:Ge("Hive"),warehouse:Yr(),uri:Rd()}),Pe({type:Ge("Glue"),warehouse:Yr(),uri:Rd()}),Pe({type:Ge("DynamoDB"),"dynamodb.profile-name":Oe().optional().describe(fe.of({label:"Profile Name"})),"dynamodb.region":Oe().optional().describe(fe.of({label:"Region"})),"dynamodb.access-key-id":Oe().optional().describe(fe.of({label:"Access Key ID"})),"dynamodb.secret-access-key":Oe().optional().describe(fe.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":Oe().optional().describe(fe.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST"}).describe(fe.of({special:"tabs"}))}),Kd=Pe({type:Ge("datafusion"),sessionContext:Io().optional().describe(fe.of({label:"Use Session Context"}))}),Yd=Pe({type:Ge("pyspark"),host:Kn().optional(),port:Xn().optional()}),Xd=Pe({type:Ge("redshift"),host:Kn(),port:Xn(5439),connectionType:Al("type",[Pe({type:Ge("IAM credentials"),region:Oe().describe(fe.of({label:"Region"})),aws_access_key_id:Oe().nonempty().describe(fe.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:Oe().nonempty().describe(fe.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:Oe().optional().describe(fe.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),Pe({type:Ge("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"})),qg=Al("type",[Fd,Bd,Pd,zd,Ud,Wd,$d,Vd,Gd,qd,Hd,Jd,Kd,Yd,Xd]),qa="env:";function Xr(t){return typeof t=="string"&&t.startsWith(qa)}function Ha(t){return`${qa}${t}`}const Qd={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 Hg{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(qa,""),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 Jg 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 qe(`
5
- DATABASE_URL = f"postgresql://${o}:${n}@${r}:${s}/${a}"
6
- engine = ${this.orm}.create_engine(DATABASE_URL${e})
7
- `)}}class Kg 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 qe(`
8
- DATABASE_URL = f"mysql+pymysql://${r}:${n}@${s}:${a}/${o}"
9
- engine = ${this.orm}.create_engine(DATABASE_URL${e})
10
- `)}}class Yg 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 qe(`
11
- ${n}
12
- engine = ${this.orm}.create_engine(DATABASE_URL)
13
- `)}}class Xg 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 qe(`
14
- engine = ${this.orm}.create_engine(
15
- URL(
16
- ${Qr(n,o=>` ${o}`)},
17
- )
18
- )
19
- `)}}class Qg 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 qe(`
20
- credentials = json.loads("""${this.connection.credentials_json}""")
21
- engine = ${this.orm}.create_engine(f"bigquery://${e}/${n}", credentials_info=credentials)
22
- `)}}class Zg extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database||":memory:");return qe(`
23
- DATABASE_URL = "${e}"
24
- engine = ${this.orm}.connect(DATABASE_URL, read_only=${ho(this.connection.read_only)})
25
- `)}}class e0 extends xt{generateImports(){return[]}generateConnectionCode(){const e=this.secrets.printInFString("database",this.connection.database);if(!this.connection.token)return qe(`
26
- conn = duckdb.connect("md:${e}")
27
- `);const n=this.secrets.printPassword(this.connection.token,"MOTHERDUCK_TOKEN",!1);return qe(`
28
- conn = duckdb.connect("md:${e}", config={"motherduck_token": ${n}})
29
- `)}}class t0 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 qe(`
30
- engine = ${this.orm}.get_client(
31
- ${Qr(n,o=>` ${o}`)},
32
- )
33
- `)}}class n0 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 qe(`
34
- DATABASE_URL = f"timeplus://${n}:${e}@${o}:${r}"
35
- engine = ${this.orm}.create_engine(DATABASE_URL)
36
- `)}}class o0 extends xt{generateImports(){return["import chdb"]}generateConnectionCode(){const e=this.secrets.print("database",this.connection.database)||'""';return qe(`
37
- engine = ${this.orm}.connect(${e}, read_only=${ho(this.connection.read_only)})
38
- `)}}class r0 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 qe(`
39
- engine = ${this.orm}.create_engine(f"${e}://${o}:${l}@${r}:${s}/${a}${n}")
40
- `)}}class s0 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:Tl(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 qe(`
42
- catalog = RestCatalog(
43
- ${s},
44
- **{
45
- ${n}
46
- },
47
- )
48
- `);case"SQL":return qe(`
49
- catalog = SqlCatalog(
50
- ${s},
51
- **{
52
- ${n}
53
- },
54
- )
55
- `);case"Hive":return qe(`
56
- catalog = HiveCatalog(
57
- ${s},
58
- **{
59
- ${n}
60
- },
61
- )
62
- `);case"Glue":return qe(`
63
- catalog = GlueCatalog(
64
- ${s},
65
- **{
66
- ${n}
67
- },
68
- )
69
- `);case"DynamoDB":return qe(`
70
- catalog = DynamoDBCatalog(
71
- ${s},
72
- **{
73
- ${n}
74
- },
75
- )
76
- `);default:Tl(this.connection.catalog)}}}class a0 extends xt{generateImports(){return["import ibis","from datafusion import SessionContext"]}generateConnectionCode(){return this.connection.sessionContext?qe(`
77
- ctx = SessionContext()
78
- # Sample table
79
- _ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
80
-
81
- con = ibis.datafusion.connect(ctx)
82
- `):qe(`
83
- con = ibis.datafusion.connect()
84
- `)}}class i0 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 qe(`
85
- session = SparkSession.builder.remote(f"sc://${e}:${n}").getOrCreate()
86
- con = ibis.pyspark.connect(session)
87
- `)}return qe(`
88
- con = ibis.pyspark.connect()
89
- `)}}class l0 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 qe(`
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 qe(`
94
- con = redshift_connector.connect(
95
- ${Qr(a,l=>` ${l}`)},
96
- )
97
- `)}}class c0{constructor(){this.secrets=new Hg}createGenerator(e,n){switch(e.type){case"postgres":return new Jg(e,n,this.secrets);case"mysql":return new Kg(e,n,this.secrets);case"sqlite":return new Yg(e,n,this.secrets);case"snowflake":return new Xg(e,n,this.secrets);case"bigquery":return new Qg(e,n,this.secrets);case"duckdb":return new Zg(e,n,this.secrets);case"motherduck":return new e0(e,n,this.secrets);case"clickhouse_connect":return new t0(e,n,this.secrets);case"timeplus":return new n0(e,n,this.secrets);case"chdb":return new o0(e,n,this.secrets);case"trino":return new r0(e,n,this.secrets);case"iceberg":return new s0(e,n,this.secrets);case"datafusion":return new a0(e,n,this.secrets);case"pyspark":return new i0(e,n,this.secrets);case"redshift":return new l0(e,n,this.secrets);default:Tl(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
- `)}Gc=function(t){return t.sort((e,n)=>e.provider==="env"?1:n.provider==="env"?-1:0)},Pc=t=>{const e=z.c(43),{providerNames:n,onClose:o,onSuccess:r}=t,{writeSecret:s}=We(),[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}),Be({title:"Secret created",description:"The secret has been created successfully."}),r(a)}catch{Be({title:"Error",description:"Failed to create secret. Please try again.",variant:"danger"})}else Be({title:"Error",description:"Please fill in all fields.",variant:"danger"});else Be({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,k,N,j,C,_,E,A,I,F,D;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsxs(vr,{children:[i.jsx(so,{children:"Add Secret"}),i.jsx(wr,{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?(k=i.jsx(ao,{id:"value",type:"text",value:c,onChange:w,required:!0,autoComplete:"off"}),e[13]=c,e[14]=k):k=e[14],e[15]===Symbol.for("react.memo_cache_sentinel")?(N=window.location.href.startsWith("http://")&&i.jsx(Np,{children:"Note: You are sending this key over http."}),e[15]=N):N=e[15],e[16]!==k?(j=i.jsxs("div",{className:"grid gap-2",children:[y,k,N]}),e[16]=k,e[17]=j):j=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ao,{htmlFor:"location",children:"Location"}),e[18]=C):C=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(Dl,{value:u,onValueChange:T=>h(T),children:[i.jsx(Ml,{children:i.jsx(Ol,{placeholder:"Select a provider"})}),i.jsx(Rl,{children:n.map(d0)})]}),e[21]=u,e[22]=n,e[23]=E):E=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsxs(Np,{children:["You can configure the location by setting the"," ",i.jsx(Fl,{href:"https://links.marimo.app/dotenv",children:"dotenv configuration"}),"."]}),e[24]=A):A=e[24],e[25]!==_||e[26]!==E?(I=i.jsxs("div",{className:"grid gap-2",children:[C,_,E,A]}),e[25]=_,e[26]=E,e[27]=I):I=e[27],e[28]!==j||e[29]!==I||e[30]!==g?(F=i.jsxs("div",{className:"grid gap-4 py-4",children:[g,j,I]}),e[28]=j,e[29]=I,e[30]=g,e[31]=F):F=e[31],e[32]!==o?(D=i.jsx(xe,{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,U;return e[34]!==M?(O=i.jsx(xe,{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(Js,{children:[D,O]}),e[36]=D,e[37]=O,e[38]=R):R=e[38],e[39]!==f||e[40]!==F||e[41]!==R?(U=i.jsx(io,{children:i.jsxs("form",{onSubmit:f,children:[b,F,R]})}),e[39]=f,e[40]=F,e[41]=R,e[42]=U):U=e[42],U};function d0(t){return i.jsx(Ll,{value:t,children:t},t)}const Zd=S.createContext({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Bn.NOOP}),u0=t=>{const e=z.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}=kr(p0,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(Zd,{value:u,children:n}),e[11]=n,e[12]=u,e[13]=h):h=e[13],h};function h0(t){return t.provider!=="env"}function m0(t){return t.name}function f0(t){return t.keys}async function p0(){const t=await pC.request({}),e=Gc(t.secrets).filter(h0).map(m0);return{secretKeys:t.secrets.flatMap(f0).sort(),providerNames:e}}let Ja,Ka,eu,tu,nu,ou,Ya;Ja=[{name:"PostgreSQL",schema:Fd,color:"#336791",logo:"postgres",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"MySQL",schema:Bd,color:"#00758F",logo:"mysql",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"SQLite",schema:Pd,color:"#003B57",logo:"sqlite",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DuckDB",schema:zd,color:"#FFD700",logo:"duckdb",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"MotherDuck",schema:Ud,color:"#ff9538",logo:"motherduck",connectionLibraries:{libraries:["duckdb"],preferred:"duckdb"}},{name:"Snowflake",schema:Wd,color:"#29B5E8",logo:"snowflake",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse",schema:Vd,color:"#2C2C1D",logo:"clickhouse",connectionLibraries:{libraries:["clickhouse_connect"],preferred:"clickhouse_connect"}},{name:"Timeplus",schema:Gd,color:"#B83280",logo:"timeplus",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"BigQuery",schema:$d,color:"#4285F4",logo:"bigquery",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"ClickHouse Embedded",schema:qd,color:"#f2b611",logo:"clickhouse",connectionLibraries:{libraries:["chdb"],preferred:"chdb"}},{name:"Trino",schema:Hd,color:"#d466b6",logo:"trino",connectionLibraries:{libraries:["sqlalchemy","sqlmodel"],preferred:"sqlalchemy"}},{name:"DataFusion",schema:Kd,color:"#202A37",logo:"datafusion",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"PySpark",schema:Yd,color:"#1C5162",logo:"pyspark",connectionLibraries:{libraries:["ibis"],preferred:"ibis"}},{name:"Redshift",schema:Xd,color:"#522BAE",logo:"redshift",connectionLibraries:{libraries:["redshift"],preferred:"redshift"}}],Ka=[{name:"Iceberg",schema:Jd,color:"#000000",logo:"iceberg",connectionLibraries:{libraries:["pyiceberg"],preferred:"pyiceberg"}}],eu=t=>{const e=z.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(wk,{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=Ja.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=Ka.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},tu=[{isMatch:t=>{if(t instanceof Ip||t instanceof gk){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(Zd),{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(Sp,{control:e.control,name:n,render:({field:f})=>i.jsxs(Ep,{children:[i.jsx(mk,{children:c}),i.jsx(fk,{children:d}),i.jsx(_p,{children:i.jsxs("div",{className:"flex gap-2",children:[t instanceof Ip?i.jsx(ao,{...f,value:f.value,onChange:f.onChange,className:he("flex-1")}):i.jsx(pk,{...f,value:f.value,onChange:f.onChange,className:"flex-1"}),i.jsxs(zn,{children:[i.jsx(Un,{asChild:!0,children:i.jsx(xe,{variant:"outline",size:"icon",className:he(Xr(f.value)&&"bg-accent"),children:i.jsx(Mc,{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(Pc,{providerNames:r,onSuccess:b=>{s(),f.onChange(Ha(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(Ap,{children:"Recommended"})]}),h.map(b=>i.jsx(lo,{onSelect:()=>f.onChange(Ha(b)),children:b},b)),m.length>0&&i.jsx(En,{}),m.map(b=>i.jsx(lo,{onSelect:()=>f.onChange(Ha(b)),children:b},b))]})]})]})}),i.jsx(Tp,{})]})})}}],nu=t=>{var V;const e=z.c(49),{schema:n,onSubmit:o,onBack:r}=t;let s,a,l;e[0]!==n?(s=yk(n),e[0]=n,e[1]=s):s=e[1],e[2]!==n?(a=Dp(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=Mp(l),d=(V=[...Ja,...Ka].find($=>$.schema===n))==null?void 0:V.connectionLibraries,[u,h]=S.useState((d==null?void 0:d.preferred)??"sqlalchemy"),{createNewCell:m}=Ve(),f=vk();let b;e[7]!==m||e[8]!==f?(b=$=>{m({code:$,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=$=>{x((function(B,K){if(!(K in Qd))throw new Error(`Unsupported library: ${K}`);qg.parse(B);const te=new c0,Y=te.createGenerator(B,K),J=Y.generateConnectionCode(),G=te.secrets,q=[...new Set([...G.imports,...Y.imports])].sort();q.push("");const W=G.formatSecrets();return W&&q.push(W),q.push(J.trim()),q.join(`
99
- `)})($,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,k;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsx(kk,{}),e[17]=w):w=e[17],e[18]!==c||e[19]!==n?(k=i.jsx(u0,{children:i.jsx(jk,{schema:n,form:c,renderers:tu,children:w})}),e[18]=c,e[19]=n,e[20]=k):k=e[20];let N;e[21]!==r?(N=i.jsx(xe,{type:"button",variant:"outline",onClick:r,children:"Back"}),e[21]=r,e[22]=N):N=e[22];const j=!c.formState.isValid;let C,_;e[23]!==j?(C=i.jsx(xe,{type:"submit",disabled:j,children:"Add"}),e[23]=j,e[24]=C):C=e[24],e[25]!==N||e[26]!==C?(_=i.jsxs("div",{className:"flex gap-2",children:[N,C]}),e[25]=N,e[26]=C,e[27]=_):_=e[27];const E=Dl;let A,I;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=$=>h($),e[28]=A):A=e[28],e[29]===Symbol.for("react.memo_cache_sentinel")?(I=i.jsxs("div",{className:"flex flex-col gap-1 items-end",children:[i.jsx(Ml,{children:i.jsx(Ol,{placeholder:"Select a library"})}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"Preferred connection library"})]}),e[29]=I):I=e[29];const F=Rl,D=Op,M=d==null?void 0:d.libraries.map(g0);let O,R,U,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]!==A||e[39]!==I||e[40]!==R?(U=i.jsx("div",{children:i.jsxs(E,{value:u,onValueChange:A,children:[I,R]})}),e[36]=E,e[37]=u,e[38]=A,e[39]=I,e[40]=R,e[41]=U):U=e[41],e[42]!==_||e[43]!==U?(T=i.jsxs("div",{className:"flex gap-2 justify-between",children:[_,U]}),e[42]=_,e[43]=U,e[44]=T):T=e[44],e[45]!==T||e[46]!==y||e[47]!==k?(L=i.jsxs("form",{onSubmit:y,className:"space-y-4",children:[k,T]}),e[45]=T,e[46]=y,e[47]=k,e[48]=L):L=e[48],L},ou=t=>{const e=z.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(eu,{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(nu,{schema:o,onSubmit:n,onBack:s}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a},pg=t=>{const e=z.c(6),{children:n}=t,[o,r]=S.useState(!1);let s,a,l;return e[0]!==n?(s=i.jsx(bk,{asChild:!0,children:n}),e[0]=n,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(Ya,{onClose:()=>r(!1)}),e[2]=a):a=e[2],e[3]!==o||e[4]!==s?(l=i.jsxs(xk,{open:o,onOpenChange:r,children:[s,a]}),e[3]=o,e[4]=s,e[5]=l):l=e[5],l},Ya=t=>{const e=z.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(vr,{className:"mb-4",children:[o,i.jsxs(wr,{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(Fl,{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(ou,{onSubmit:()=>n()})]}),e[2]=n,e[3]=s):s=e[3],s};function g0(t){return i.jsx(Ll,{value:t,children:Qd[t]},t)}const b0=()=>{const t=z.c(7),{selectedLayout:e}=Z1(),{setLayoutView:n}=eg();if(Qt()&&!Xs("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(Ml,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:i.jsx(Ol,{placeholder:"Select a view"})}),t[2]=r):r=t[2],t[3]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx(Rl,{children:i.jsxs(Op,{children:[i.jsx(Ck,{children:"View as"}),tg.map(y0)]})}),t[3]=s):s=t[3],t[4]!==e||t[5]!==o?(a=i.jsxs(Dl,{"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 x0(t){const e=ru(t);return i.jsx(e,{className:"h-4 w-4"})}function ru(t){switch(t){case"vertical":return id;case"grid":return Qj;case"slides":return Pa;default:return Pl(t),zl}}function su(t){return Bl(t)}function y0(t){return i.jsx(Ll,{value:t,children:i.jsxs("div",{className:"flex items-center gap-1.5 leading-5",children:[x0(t),i.jsx("span",{children:su(t)})]})},t)}function au(){const t=z.c(4),{openConfirm:e}=Pn(),n=Ct(Nt),{sendRestart:o}=We();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(Sk,{onClick:async()=>{n({state:ht.CLOSING}),await o(),Ek()},"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()};Uc=function(){var te,Y;const t=z.c(39),e=Wl(),{openModal:n,closeModal:o}=Pn(),{toggleApplication:r}=jr(),{selectedPanel:s}=Zs(),[a]=_n(_l),l=le(To),c=(()=>{const{updateCellConfig:J}=Ve(),{saveCellConfig:G}=We();return S.useCallback(async()=>{const q=new Qs,W=Mt(),ne=W.cellIds.inOrderIds,X={};for(const oe of ne){if(W.cellData[oe]===void 0)continue;const{code:se,config:ae}=W.cellData[oe];ae.hide_code||q.isSupported(se)&&(X[oe]={hide_code:!0})}const Z=Ul.entries(X);if(Z.length!==0){await G({configs:X});for(const[oe,se]of Z)J({cellId:oe,config:se})}},[J])})(),[d]=ea(),{updateCellConfig:u,undoDeleteCell:h,clearAllCellOutputs:m,upsertSetupCell:f,collapseAllCells:b,expandAllCells:x}=Ve(),p=au(),g=Md(),y=(function(J){const G=z.c(5),{openPrompt:q,closeModal:W}=Pn(),{sendCopy:ne}=We();let X;return G[0]!==W||G[1]!==q||G[2]!==ne||G[3]!==J?(X=()=>{if(!J)return null;const Z=Nk.guessDeliminator(J),oe=Ot.basename(J);q({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${oe}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:se=>{const ae=Z.join(Ot.dirname(J),se);ne({source:J,destination:ae}).then(()=>{W(),Be({title:"Notebook copied",description:"A copy of the notebook has been created."}),Zj(ae)})}})},G[0]=W,G[1]=q,G[2]=ne,G[3]=J,G[4]=X):X=G[4],X})(e),w=Ct(Ia),k=Ct(eC),N=Ct(tC),{exportAsMarkdown:j,readCode:C,saveCellConfig:_}=We(),E=le(_k),A=le(Ik),I=le(Rp),{selectedLayout:F}=Z1(),{setLayoutView:D}=eg(),M=Dd(),O=((te=d.sharing)==null?void 0:te.html)??!0,R=((Y=d.sharing)==null?void 0:Y.wasm)??!0,U=P0;let T;t[0]===Symbol.for("react.memo_cache_sentinel")?(T=i.jsx(gd,{size:14,strokeWidth:1.5}),t[0]=T):T=t[0];const L=!O&&!R;let V;t[1]===Symbol.for("react.memo_cache_sentinel")?(V=i.jsx(Fk,{size:14,strokeWidth:1.5}),t[1]=V):V=t[1];const $=!O;let B,K;return t[2]!==o||t[3]!==n?(B=async()=>{n(i.jsx($g,{onClose:o}))},t[2]=o,t[3]=n,t[4]=B):B=t[4],t[5]!==I||t[6]!==m||t[7]!==o||t[8]!==b||t[9]!==y||t[10]!==x||t[11]!==j||t[12]!==e||t[13]!==E||t[14]!==A||t[15]!==c||t[16]!==l||t[17]!==n||t[18]!==C||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]!==k||t[28]!==R||t[29]!==L||t[30]!==$||t[31]!==B||t[32]!==r||t[33]!==M||t[34]!==h||t[35]!==u||t[36]!==f||t[37]!==a.mode?(K=[{icon:T,label:"Share",handle:Ho,hidden:L,dropdown:[{icon:V,label:"Publish HTML to web",hidden:$,handle:B},{icon:i.jsx(H1,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!R,handle:async()=>{const J=await C(),G=Ak({code:J.contents});await Eo(G),Be({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:i.jsx(Dk,{size:14,strokeWidth:1.5}),label:"Download",handle:Ho,dropdown:[{icon:i.jsx(og,{size:14,strokeWidth:1.5}),label:"Download as HTML",handle:async()=>{e?await ng({filename:e,includeCode:!0}):Be({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:i.jsx(og,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{e?await ng({filename:e,includeCode:!1}):Be({variant:"danger",title:"Error",description:"Notebooks must be named to be exported."})}},{icon:i.jsx(ta,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{const J=await j({download:!1});$l(new Blob([J],{type:"text/plain"}),Lp.toMarkdown(document.title))}},{icon:i.jsx(Kc,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{const J=await C();$l(new Blob([J.contents],{type:"text/plain"}),Lp.toPY(document.title))}},{divider:!0,icon:i.jsx(Ic,{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:B0},{icon:i.jsx(Tk,{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:L0}]},{divider:!0,icon:i.jsx(fd,{size:14,strokeWidth:1.5}),label:"Helper panel",handle:Ho,dropdown:Kr.flatMap(J=>{const{type:G,Icon:q,hidden:W}=J;return W?[]:{label:Bl(G),rightElement:U(s===G),icon:i.jsx(q,{size:14,strokeWidth:1.5}),handle:()=>r(G)}})},{icon:i.jsx(Pa,{size:14,strokeWidth:1.5}),label:"Present as",handle:Ho,dropdown:[{icon:a.mode==="present"?i.jsx(Fp,{size:14,strokeWidth:1.5}):i.jsx(Fa,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{M()}},...tg.map((J,G)=>{const q=ru(J);return{divider:G===0,label:su(J),icon:i.jsx(q,{size:14,strokeWidth:1.5}),rightElement:i.jsx("div",{className:"w-8 flex justify-end",children:F===J&&i.jsx(Vl,{size:14})}),handle:()=>{D(J),a.mode==="edit"&&M()}}})]},{icon:i.jsx(Zc,{size:14,strokeWidth:1.5}),label:"Create notebook copy",hidden:!e||Qt(),handle:y},{icon:i.jsx(Ra,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{const J=await C();await Eo(J.contents),Be({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 J=Mt(),G=Mk(J),q=Ul.fromEntries(G.map(R0));await _({configs:q});for(const W of G)u({cellId:W,config:{disabled:!1}})}},{icon:i.jsx(Et,{size:14,strokeWidth:1.5}),label:"Disable all cells",hidden:!A||l,handle:async()=>{const J=Mt(),G=vp(J),q=Ul.fromEntries(G.map(O0));await _({configs:q});for(const W of G)u({cellId:W,config:{disabled:!0}})}},{icon:i.jsx(Gl,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:c},{icon:i.jsx(Hc,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:b},{icon:i.jsx(qc,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x},{icon:i.jsx(Yc,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({code:"# Initialization code that runs before all other cells"})}},{icon:i.jsx(Ys,{size:14,strokeWidth:1.5}),label:"Clear all outputs",handle:()=>{m()}},{icon:i.jsx(Xc,{size:14,strokeWidth:1.5}),label:"Re-run all cells",hotkey:"global.runAll",handle:async()=>{g()}},{icon:i.jsx(Ua,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!I||l,handle:()=>{h()}},{icon:i.jsx(_o,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n(i.jsx(Ya,{onClose:o}))}},{divider:!0,icon:i.jsx(La,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>w(M0)},{icon:i.jsx(Ok,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>k(D0)},{icon:i.jsx(ad,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>N(T0)},{icon:i.jsx(J1,{size:14,strokeWidth:1.5}),label:"Open documentation",handle:A0},{icon:i.jsx(Rk,{size:14,strokeWidth:1.5}),label:"Resources",handle:Ho,dropdown:[{icon:i.jsx(J1,{size:14,strokeWidth:1.5}),label:"Documentation",handle:I0},{icon:i.jsx(nC,{size:14,strokeWidth:1.5}),label:"GitHub",handle:_0},{icon:i.jsx(oC,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:E0},{icon:i.jsx(rC,{size:14,strokeWidth:1.5}),label:"YouTube",handle:S0},{icon:i.jsx(Cp,{size:14,strokeWidth:1.5}),label:"Changelog",handle:N0}]},{divider:!0,icon:i.jsx(rd,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:C0},{icon:i.jsx(Dc,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:j0},{icon:i.jsx(vd,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:p}].filter(k0).map(v0),t[5]=I,t[6]=m,t[7]=o,t[8]=b,t[9]=y,t[10]=x,t[11]=j,t[12]=e,t[13]=E,t[14]=A,t[15]=c,t[16]=l,t[17]=n,t[18]=C,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]=k,t[28]=R,t[29]=L,t[30]=$,t[31]=B,t[32]=r,t[33]=M,t[34]=h,t[35]=u,t[36]=f,t[37]=a.mode,t[38]=K):K=t[38],K};function v0(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(w0)}:t}function w0(t){return!t.hidden}function k0(t){return!t.hidden}function j0(){const t=Lk();window.open(t,"_blank")}function C0(){const t=document.baseURI.split("?")[0];window.open(t,"_self")}function N0(){window.open(Xt.releasesPage,"_blank")}function S0(){window.open(Xt.youtube,"_blank")}function E0(){window.open(Xt.discordLink,"_blank")}function _0(){window.open(Xt.githubPage,"_blank")}function I0(){window.open(Xt.docsPage,"_blank")}function A0(){window.open(Xt.docsPage,"_blank")}function T0(t){return!t}function D0(t){return!t}function M0(t){return!t}function O0(t){return[t,{disabled:!0}]}function R0(t){return[t,{disabled:!1}]}async function L0(){const t=new Event("export-beforeprint"),e=new Event("export-afterprint");window.dispatchEvent(t),setTimeout(F0,0),setTimeout(()=>window.dispatchEvent(e),0)}function F0(){return window.print()}async function B0(){const t=document.getElementById("App");t&&await Bp(t,document.title)}function P0(t){return i.jsx("div",{className:"w-8 flex justify-end",children:t&&i.jsx(Vl,{size:14})})}const z0=t=>{const e=z.c(28),{disabled:n,tooltip:o}=t,r=n!==void 0&&n,s=o===void 0?"Actions":o,a=Uc();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(gC,{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=U0;let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=E=>{const A=i.jsx(lo,{variant:E.variant,disabled:E.disabled,onSelect:I=>E.handle(I),"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:A})},E.label):A},e[14]=g):g=e[14];const y=g;let w,k,N,j,C,_;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=A=>A.hidden?null:A.dropdown?i.jsxs(Bk,{children:[i.jsx(Pk,{"data-testid":`notebook-menu-dropdown-${A.label}`,children:p(A)}),i.jsx(zk,{children:i.jsx(Uk,{children:A.dropdown.map(I=>i.jsxs(me.Fragment,{children:[I.divider&&i.jsx(En,{}),y(I)]},I.label))})})]},A.label):i.jsxs(me.Fragment,{children:[A.divider&&i.jsx(En,{}),y(A)]},A.label),e[20]=E):E=e[20],k=a.map(E),e[18]=a,e[19]=k}else k=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")?(j=i.jsx("div",{className:"flex-1 px-2 text-xs text-muted-foreground",children:i.jsxs("span",{children:["Version: ",Pp()]})}),e[22]=j):j=e[22],e[23]!==k?(C=i.jsxs(Wn,{align:"end",className:"no-print w-[240px]",children:[k,N,j]}),e[23]=k,e[24]=C):C=e[24],e[25]!==w||e[26]!==C?(_=i.jsxs(zn,{modal:!1,children:[w,C]}),e[25]=w,e[26]=C,e[27]=_):_=e[27],_};function U0(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(ql,{shortcut:t.hotkey,className:"ml-4"}),t.rightElement]})}function Xa(t){return Zt("create"in t,'Expected query to have a "create" method'),t}const ft=Wk({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 iu(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?(Me.set(ft,{type:"setFind",find:n}),Me.set(ft,{type:"setCurrentView",view:t,range:{from:e.from,to:e.to}})):Me.set(ft,{type:"setCurrentView",view:t,range:{from:0,to:0}})}return Me.get(ft).isOpen?(Me.set(ft,{type:"setIsOpen",isOpen:!1}),requestAnimationFrame(()=>{Me.set(ft,{type:"setIsOpen",isOpen:!0})}),!0):(Me.set(ft,{type:"setIsOpen",isOpen:!0}),!0)}function W0(){return!!Me.get(ft).isOpen&&(Me.set(ft,{type:"setIsOpen",isOpen:!1}),!0)}function Zr(t){return()=>{const e=Me.get(ft),n=new na({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord});return!!n.valid&&t({query:Xa(n).create(),search:n})}}const lu=t=>Zr(({query:e})=>{const n=Do(),o=Me.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"}),Me.set(ft,{type:"setCurrentView",view:l,range:{from:c.from,to:c.to}}),c}return!1}),Qa=lu("next"),cu=lu("prev"),$0=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()}}),V0=Zr(({query:t})=>{const e=Do(),n=Me.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"}),Qa()}return!1}),G0=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}}),Za=tt.define();function du(){const t=Do();for(const e of t)e.state.readOnly||e.dispatch({effects:Za.of(new na({search:""}))})}const es=Dt.define({create(){const t=Me.get(ft);return Xa(new na({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(Za)&&(t=Xa(n.value).create());return t}}),q0=Te.mark({class:"cm-searchMatch"}),H0=Te.mark({class:"cm-searchMatch cm-searchMatch-selected"}),J0=$t.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?H0:q0)})}return n.finish()}},{decorations:t=>t.decorations}),K0=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"}}),ts=t=>{const e=z.c(7);let n,o;e[0]!==t?(n=l=>{var c;(l.ctrlKey||l.metaKey)&&l.key==="z"&&(l.preventDefault(),l.stopPropagation(),(c=t.onClick)==null||c.call(t,l))},e[0]=t,e[1]=n):n=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(o={capture:!0},e[2]=o):o=e[2],Hl(window,"keydown",n,o);const r=t.children??"Undo";let s,a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx($k,{className:"ml-2",shortcut:"cmd-z"}),e[3]=s):s=e[3],e[4]!==r||e[5]!==t?(a=i.jsxs(xe,{"data-testid":"undo-button",size:"sm",variant:"outline",...t,children:[r," ",s]}),e[4]=r,e[5]=t,e[6]=a):a=e[6],a},Y0=()=>{var ve;const t=z.c(102),[e,n]=S.useState(!1),[o,r]=_n(ft),[s,a]=S.useState(),l=S.useRef(null),c=le(Jl);let d,u;t[0]!==e||t[1]!==o.isOpen?(d=()=>(!e||!o.isOpen)&&iu(),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=G0();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 du();h(),(function(){const be=Me.get(ft),et=Do();for(const rt of et)rt.state.readOnly||rt.dispatch({effects:Za.of(new na({search:be.findText,caseSensitive:be.caseSensitive,regexp:be.regexp,replace:be.replaceText,wholeWord:be.wholeWord}))})})()}else du()},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,k,N,j,C,_,E,A,I,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")?(k=()=>n(!1),t[20]=k):k=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?(j=()=>r({type:"setIsOpen",isOpen:!1}),t[23]=r,t[24]=j):j=t[24],t[25]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Gt,{className:"w-4 h-4"}),t[25]=C):C=t[25],t[26]!==j?(_=i.jsx("div",{className:"absolute top-0 right-0",children:i.jsx(xe,{"data-testid":"close-find-replace-button",onClick:j,size:"xs",variant:"text",children:C})}),t[26]=j,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?(A=i.jsx(ao,{ref:l,"data-testid":"find-input",value:o.findText,autoFocus:!0,className:"mr-2 mb-0",placeholder:"Find",onKeyDown:Q0,onChange:E}),t[30]=o.findText,t[31]=E,t[32]=A):A=t[32],t[33]!==r?(I=be=>{r({type:"setReplace",replace:be.target.value})},t[33]=r,t[34]=I):I=t[34],t[35]!==o.replaceText||t[36]!==I?(F=i.jsx(ao,{"data-testid":"replace-input",value:o.replaceText,placeholder:"Replace",onChange:I}),t[35]=o.replaceText,t[36]=I,t[37]=F):F=t[37],t[38]!==A||t[39]!==F?(D=i.jsxs("div",{className:"flex flex-col flex-2 gap-2 w-[55%]",children:[A,F]}),t[38]=A,t[39]=F,t[40]=D):D=t[40];const M=o.caseSensitive?"on":"off";let O,R,U;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(Gk,{className:"w-4 h-4"}),t[43]=R):R=t[43],t[44]!==o.caseSensitive||t[45]!==M||t[46]!==O?(U=i.jsx(pe,{content:"Case Sensitive",children:i.jsx(Kl,{size:"sm",pressed:o.caseSensitive,"data-state":M,onPressedChange:O,children:R})}),t[44]=o.caseSensitive,t[45]=M,t[46]=O,t[47]=U):U=t[47];const T=o.wholeWord?"on":"off";let L,V,$;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")?(V=i.jsx(Cd,{className:"w-4 h-4"}),t[50]=V):V=t[50],t[51]!==o.wholeWord||t[52]!==T||t[53]!==L?($=i.jsx(pe,{content:"Match Whole Word",children:i.jsx(Kl,{size:"sm",pressed:o.wholeWord,"data-state":T,onPressedChange:L,children:V})}),t[51]=o.wholeWord,t[52]=T,t[53]=L,t[54]=$):$=t[54];const B=o.regexp?"on":"off";let K,te,Y,J,G;t[55]!==r?(K=be=>r({type:"setRegex",regexp:be}),t[55]=r,t[56]=K):K=t[56],t[57]===Symbol.for("react.memo_cache_sentinel")?(te=i.jsx(pd,{className:"w-4 h-4"}),t[57]=te):te=t[57],t[58]!==o.regexp||t[59]!==B||t[60]!==K?(Y=i.jsx(pe,{content:"Use Regular Expression",children:i.jsx(Kl,{size:"sm",pressed:o.regexp,"data-state":B,onPressedChange:K,children:te})}),t[58]=o.regexp,t[59]=B,t[60]=K,t[61]=Y):Y=t[61],t[62]!==U||t[63]!==$||t[64]!==Y?(J=i.jsxs("div",{className:"flex items-center gap-[2px]",children:[U,$,Y]}),t[62]=U,t[63]=$,t[64]=Y,t[65]=J):J=t[65],t[66]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{V0()&&h()},t[66]=G):G=t[66];const q=o.findText==="";let W,ne;t[67]!==q?(W=i.jsx(xe,{"data-testid":"replace-next-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:G,disabled:q,children:"Replace Next"}),t[67]=q,t[68]=W):W=t[68],t[69]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>{const be=$0();if(!be)return;h();const{dismiss:et}=Be({title:"Replaced all occurrences",action:i.jsx(ts,{"data-testid":"undo-replace-all-button",onClick:()=>{be(),rt()}})}),rt=et},t[69]=ne):ne=t[69];const X=o.findText==="";let Z,oe,se,ae,ee,_e,ue,we,ke,ge,Ee,Re;return t[70]!==X?(Z=i.jsx(xe,{"data-testid":"replace-all-button",size:"xs",variant:"outline",className:"h-6 text-xs",onClick:ne,disabled:X,children:"Replace All"}),t[70]=X,t[71]=Z):Z=t[71],t[72]!==W||t[73]!==Z?(oe=i.jsxs("div",{className:"flex items-center gap-[2px]",children:[W,Z]}),t[72]=W,t[73]=Z,t[74]=oe):oe=t[74],t[75]!==J||t[76]!==oe?(se=i.jsxs("div",{className:"flex flex-col gap-2",children:[J,oe]}),t[75]=J,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")?(ee=i.jsx(pe,{content:"Find Previous",children:i.jsx(xe,{"data-testid":"find-prev-button",size:"xs",variant:"secondary",onClick:Z0,children:i.jsx(Wc,{className:"w-4 h-4"})})}),t[81]=ee):ee=t[81],t[82]===Symbol.for("react.memo_cache_sentinel")?(_e=i.jsx(pe,{content:"Find Next",children:i.jsx(xe,{"data-testid":"find-next-button",size:"xs",variant:"secondary",onClick:eb,children:i.jsx(Vc,{className:"w-4 h-4"})})}),t[82]=_e):_e=t[82],t[83]!==y||t[84]!==s?(ue=s!=null&&y==null&&i.jsxs("span",{className:"text-sm",children:[s.count," matches"]}),t[83]=y,t[84]=s,t[85]=ue):ue=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]!==ue||t[90]!==we?(ke=i.jsxs("div",{className:"flex items-center gap-2",children:[ee,_e,ue,we]}),t[89]=ue,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(Vk,{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?(Re=i.jsx(Yl,{restoreFocus:!0,autoFocus:!0,children:i.jsxs("div",{onFocus:w,onClick:X0,onBlur:k,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]=Re):Re=t[101],Re};function X0(t){t.stopPropagation(),t.preventDefault()}function Q0(t){t.key==="Enter"&&(t.shiftKey?cu():Qa())}function Z0(){return cu()}function eb(){return Qa()}const uu=t=>{const e=z.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}=We(),[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),k=S.useRef(!1);let N,j,C;e[1]!==d?(N=()=>{f(d)},j=[d],e[1]=d,e[2]=N,e[3]=j):(N=e[2],j=e[3]),S.useEffect(N,j),e[4]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{y(!0)},e[4]=C):C=e[4];const _=C;let E;e[5]!==d||e[6]!==c?(E=X=>{var Z;(Z=X.relatedTarget)!=null&&Z.closest(".filename-input")||(y(!1),c&&f(d))},e[5]=d,e[6]=c,e[7]=E):E=e[7];const A=E;let I;e[8]!==m?(I=Ot.dirname(m||""),e[8]=m,e[9]=I):I=e[9];const F=I,D=Ot.basename(m||""),M=x.filter(X=>Ot.basename(X.path).startsWith(D));let O,R;e[10]!==F||e[11]!==g||e[12]!==h?(O=async()=>{if(!g)return void p([]);const X=await h({path:F});p(X.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:U}=kr(O,R),T=(function(X,Z,oe){if(X&&!X.endsWith("/")&&((Xs("markdown")?new Set(["py","md","markdown","qmd"]):new Set(["py"])).has(Ot.extension(X))||(X=X.endsWith(".")?`${X}py`:X.endsWith(".p")?`${X}y`:`${X}.py`),!Z.some(se=>se.path===X||Ot.basename(se.path)===X)&&!(oe&&(oe===X||Ot.basename(oe)===X))))return X})(m,x,d),L=(T||M.length>0)&&i.jsxs(zp,{className:"font-mono",children:[!U&&i.jsx(Up,{children:"No files"}),T&&i.jsxs(Xl,{variant:"success",className:"py-2 px-3",onSelect:()=>{var X;T&&(k.current=!0,a(T),(X=w.current)==null||X.blur())},children:[i.jsx(Qc,{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(X=>{const Z=X.isDirectory?"directory":qk(X.path),oe=Hk[Z];return i.jsxs(Xl,{variant:X.isDirectory?"default":"muted",className:"py-2 px-3",onSelect:()=>{X.isDirectory?f(`${X.path}/`):f(X.path)},children:[i.jsx(oe,{className:"w-4 h-4 mr-2"})," ",Ot.basename(X.path)]},X.path)})]}),V=10*Math.max(20,(m==null?void 0:m.length)||(o==null?void 0:o.length)||0),$=g?m||"":d||"";let B,K,te;e[17]!==u||e[18]!==V?(B=u?{maxWidth:V}:void 0,e[17]=u,e[18]=V,e[19]=B):B=e[19],e[20]!==l?(K=he(l,"w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60"),e[20]=l,e[21]=K):K=e[21],e[22]!==o||e[23]!==$||e[24]!==B||e[25]!==K?(te=i.jsx(Jk,{children:i.jsx(Wp,{"data-testid":"dir-completion-input",tabIndex:-1,rootClassName:"border-none justify-center px-1",spellCheck:"false",value:$,onKeyDown:tb,icon:null,ref:w,onValueChange:f,placeholder:o,autoComplete:"off",style:B,className:K})}),e[22]=o,e[23]=$,e[24]=B,e[25]=K,e[26]=te):te=e[26];const Y=L&&"group-focus-within:block";let J,G,q,W,ne;return e[27]!==Y?(J=he("p-0 w-full min-w-80 max-w-80vw hidden",Y),e[27]=Y,e[28]=J):J=e[28],e[29]!==L||e[30]!==J?(G=i.jsx(Ql,{side:"bottom",className:J,portal:!1,children:L}),e[29]=L,e[30]=J,e[31]=G):G=e[31],e[32]!==te||e[33]!==G?(q=i.jsxs(zp,{children:[te,G]}),e[32]=te,e[33]=G,e[34]=q):q=e[34],e[35]!==A||e[36]!==q?(W=i.jsx($p,{onFocus:_,onBlur:A,shouldFilter:!1,id:"filename-input",className:"bg-transparent group filename-input",children:q}),e[35]=A,e[36]=q,e[37]=W):W=e[37],e[38]!==g||e[39]!==W?(ne=i.jsx(Zl,{children:i.jsx(oa,{open:g,modal:!1,children:W})}),e[38]=g,e[39]=W,e[40]=ne):ne=e[40],ne};function tb(t){t.key==="Escape"&&t.currentTarget.blur()}const nb=t=>{const e=z.c(33),n=()=>{$l(new Blob([o()],{type:"text/plain"}),`${t.proposedName}.json`)},o=je(sb);let r,s,a,l,c,d,u,h,m,f,b,x,p,g,y,w,k;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(wr,{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(xe,{"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(xe,{"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(Js,{children:[g,y]}),e[26]=g,e[27]=w):w=e[27],e[28]!==r||e[29]!==s||e[30]!==p||e[31]!==w?(k=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]=k):k=e[32],k},ob=t=>{const e=z.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(nb,{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(Da,{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 rb(t){return{id:t.id,name:t.name,code:t.code,code_hash:null,config:{column:0,...t.config}}}function sb(){const t=Mt(),e=ec(t),n={version:"1",metadata:{marimo_version:Pp()},cells:e.map(rb)};return JSON.stringify(n,null,2)}const ei=5e3,ti=Bt(void 0),hu=Bt(t=>{const e=t(ti);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!(Vp(c,r.codes)&&Vp(u,r.names)&&Cr(d,r.configs)&&Cr(o.selectedLayout,r.layout.selectedLayout)&&Cr(o.layoutData,r.layout.layoutData))})({state:t(Pt),layout:t(rg),lastSavedNotebook:e})});function ab(t){return JSON.stringify(t)}const ib=t=>{const e=z.c(15),{kioskMode:n}=t,o=Wl(),r=le(hu),s=le(Nt).state===ht.CLOSED,{saveOrNameNotebook:a,saveIfNotebookIsPersistent:l}=ni();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=z.c(14),y=le(Hp),w=Yp(),[k]=_n(Nt),N=le(hu);let j,C;if(g[0]!==w){const F=ec(w);j=F.map(hb),C=F.map(ub),g[0]=w,g[1]=j,g[2]=C}else j=g[1],C=g[2];const _=C;let E;g[3]!==w?(E=qp(w),g[3]=w,g[4]=E):E=g[4];const A=E;let I;g[5]!==y||g[6]!==_||g[7]!==j||g[8]!==A||g[9]!==k||g[10]!==N||g[11]!==p.kioskMode||g[12]!==p.onSave?(I={onSave:p.onSave,needsSave:N,codes:j,cellConfigs:A,cellNames:_,connStatus:k,config:y,kioskMode:p.kioskMode},g[5]=y,g[6]=_,g[7]=j,g[8]=A,g[9]=k,g[10]=N,g[11]=p.kioskMode,g[12]=p.onSave,g[13]=I):I=g[13],(function(F){const D=z.c(21),{codes:M,cellConfigs:O,config:R,connStatus:U,cellNames:T,needsSave:L,kioskMode:V,onSave:$}=F,B=S.useRef(null);let K;D[0]!==M?(K=M.join(":"),D[0]=M,D[1]=K):K=D[1];const te=K;let Y;D[2]!==O?(Y=O.map(ab).join(":"),D[2]=O,D[3]=Y):Y=D[3];const J=Y;let G;D[4]!==T?(G=T.join(":"),D[4]=T,D[5]=G):G=D[5];const q=G;let W,ne;D[6]!==R||D[7]!==U.state||D[8]!==V||D[9]!==L||D[10]!==$?(W=()=>{if(!V)return R.autosave==="after_delay"&&(B.current!==null&&clearTimeout(B.current),L&&U.state===ht.OPEN&&(B.current=setTimeout($,R.autosave_delay))),()=>{B.current!==null&&clearTimeout(B.current)}},D[6]=R,D[7]=U.state,D[8]=V,D[9]=L,D[10]=$,D[11]=W):W=D[11],D[12]!==J||D[13]!==q||D[14]!==te||D[15]!==R||D[16]!==U.state||D[17]!==V||D[18]!==L||D[19]!==$?(ne=[te,J,q,R,U.state,$,V,L],D[12]=J,D[13]=q,D[14]=te,D[15]=R,D[16]=U.state,D[17]=V,D[18]=L,D[19]=$,D[20]=ne):ne=D[20],S.useEffect(W,ne)})(I)})(c),(function(){const p=z.c(12),g=le(Kk),{state:y}=le(Nt),w=g.auto_download.includes("markdown"),k=g.auto_download.includes("html"),N=g.auto_download.includes("ipynb"),j=!w||y!==ht.OPEN,C=!k||y!==ht.OPEN,_=!N||y!==ht.OPEN,{autoExportAsHTML:E,autoExportAsIPYNB:A,autoExportAsMarkdown:I}=We();let F,D,M,O,R,U;p[0]!==I?(F=async()=>{await I({download:!1})},p[0]=I,p[1]=F):F=p[1],p[2]!==j?(D={delayMs:ei,whenVisible:!0,disabled:j},p[2]=j,p[3]=D):D=p[3],Pr(F,D),p[4]!==E?(M=async()=>{await E({download:!1,includeCode:!0,files:Q1.INSTANCE.filenames()})},p[4]=E,p[5]=M):M=p[5],p[6]!==C?(O={delayMs:ei,whenVisible:!0,disabled:C},p[6]=C,p[7]=O):O=p[7],Pr(M,O),p[8]!==A?(R=async()=>{await A({download:!1})},p[8]=A,p[9]=R):R=p[9],p[10]!==_?(U={delayMs:ei,whenVisible:!0,disabled:_},p[10]=_,p[11]=U):U=p[11],Pr(R,U)})(),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],Hl(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(ob,{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(Da,{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 ni(){const t=z.c(20),{sendSave:e}=We(),{openModal:n,closeModal:o,openAlert:r}=Pn(),s=Ct(ti),a=Gp(),l=tc();let c;t[0]!==r||t[1]!==e||t[2]!==s||t[3]!==l?(c=(g,y)=>{const w=Mt(),k=ec(w),N=k.map(db),j=k.map(cb),C=k.map(lb),_=qp(w),E=l.get(Nt),A=l.get(Hp),I=l.get(rg);l.get(To)||j.length!==0&&(E.state===ht.OPEN?(Je.log("saving to ",g),e({cellIds:N,codes:j,names:C,filename:g,configs:_,layout:bC(),persist:!0}).then(()=>{y&&A.format_on_save&&Jp(),s({names:C,codes:j,configs:_,layout:I})})):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=je(c);let u;t[5]!==d||t[6]!==l?(u=g=>{const y=g!==void 0&&g,w=l.get(Kp),k=l.get(Nt);mu(w)&&k.state===ht.OPEN&&d(w,y)},t[5]=d,t[6]=l,t[7]=u):u=t[7];const h=je(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(Kp),y=l.get(Nt);h(!0),mu(g)||y.state===ht.CLOSED||n(i.jsx(mb,{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=je(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 lb(t){return t.name}function cb(t){return t.code}function db(t){return t.id}function mu(t){return t!==null&&!t.startsWith("/tmp")&&!t.startsWith("/var/folders")&&!t.includes("AppData\\Local\\Temp")}function ub(t){return t.name}function hb(t){return t.code}const mb=t=>{const e=z.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(uu,{onNameChange:l,placeholderText:"filename",className:"missing-filename"})]}),e[5]=l,e[6]=u):u=e[6],e[7]!==n?(h=i.jsx(xe,{"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(xe,{"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(Js,{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 fu(t){const e=z.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 pu,gu;_a=t=>{const{children:e}=t;return le(To)?null:e},pu=t=>{const{children:e}=t;return le(To)?e:null},gu=()=>{const t=z.c(6),e=Ct(Ia);let n;t[0]!==e?(n=()=>e(fb),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(La,{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 fb(t){return!t}const pb=t=>{const e=z.c(47),{presenting:n,onTogglePresenting:o,onInterrupt:r,onRun:s,connectionState:a,running:l,appConfig:c}=t,d=c.width,u=le(Rp),h=le(Yk),{undoDeleteCell:m}=Ve(),f=a===ht.CLOSED;let b,x=null;if(!f&&u){let L,V;e[0]===Symbol.for("react.memo_cache_sentinel")?(L=i.jsx(Ua,{size:16,strokeWidth:1.5}),e[0]=L):L=e[0],e[1]!==m?(V=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]=V):V=e[2],x=V}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,k;e[8]!==n?(w=!n&&i.jsx(Y0,{}),e[8]=n,e[9]=w):w=e[9],e[10]!==f||e[11]!==y||e[12]!==p||e[13]!==n?(k=!f&&i.jsxs("div",{className:xb,children:[n&&i.jsx(b0,{}),i.jsx(z0,{disabled:p,tooltip:y}),i.jsx(sC,{disabled:p,tooltip:y}),i.jsx(aC,{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]=k):k=e[14];const N=d==="compact"&&"xl:flex-row items-end";let j,C,_,E,A,I,F,D,M,O,R,U,T;return e[15]!==N?(j=he(yb,N),e[15]=N,e[16]=j):j=e[16],e[17]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(_a,{children:i.jsx(ib,{kioskMode:!1})}),e[17]=C):C=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(_=St("global.hideCode"),e[18]=_):_=e[18],e[19]!==n?(E=n?i.jsx(Fp,{strokeWidth:1.5,size:18}):i.jsx(Fa,{strokeWidth:1.5,size:18}),e[19]=n,e[20]=E):E=e[20],e[21]!==o||e[22]!==E?(A=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]=A):A=e[23],e[24]===Symbol.for("react.memo_cache_sentinel")?(I=i.jsx(gu,{}),F=i.jsx(iC,{}),D=i.jsx("div",{}),e[24]=I,e[25]=F,e[26]=D):(I=e[24],F=e[25],D=e[26]),e[27]!==f||e[28]!==r||e[29]!==l?(M=!f&&i.jsx(bb,{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(gb,{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(_a,{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]!==A||e[40]!==R||e[41]!==j?(U=i.jsxs("div",{className:j,children:[C,A,I,F,D,R]}),e[39]=A,e[40]=R,e[41]=j,e[42]=U):U=e[42],e[43]!==U||e[44]!==w||e[45]!==k?(T=i.jsxs(i.Fragment,{children:[w,k,U]}),e[43]=U,e[44]=w,e[45]=k,e[46]=T):T=e[46],T},gb=t=>{const e=z.c(8),{needsRun:n,onRun:o}=t,r=le(Xp);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},bb=t=>{const e=z.c(8),{running:n,onInterrupt:o}=t,r=fu(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=he(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(zl,{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},xb="absolute top-3 right-5 m-0 flex items-center gap-2 min-h-[28px] no-print pointer-events-auto z-30 print:hidden",yb="absolute bottom-5 right-5 flex flex-col gap-2 items-center no-print pointer-events-auto z-30 print:hidden",vb=t=>{const e=z.c(7),{filename:n}=t,o=Gp();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(uu,{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};function Jo(){const t=z.c(4),{deleteCell:e,undoDeleteCell:n}=Ve(),{sendDeleteCell:o}=We();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=s=>{var d;if(Me.get(sa))return;const{cellId:a}=s,l=Me.get(Pt),c=(((d=l.cellData[a])==null?void 0:d.code)??"").trim()==="";if(e({cellId:a}),o({cellId:a}).catch(()=>{n()}),!c){const{dismiss:u}=Be({title:"Cell deleted",description:"You can bring it back by clicking undo or through the command palette.",action:i.jsx(ts,{"data-testid":"undo-delete-button",onClick:()=>{n(),h()}})}),h=u}},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],je(r)}function Ko(){const t=z.c(4),{deleteCell:e,undoDeleteCell:n}=Ve(),{sendDeleteCell:o}=We();let r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=async s=>{if(Me.get(sa))return;const{cellIds:a}=s;for(const d of a)await o({cellId:d}).then(()=>{e({cellId:d})});const{dismiss:l}=Be({title:"Cells deleted",action:i.jsx(ts,{"data-testid":"undo-delete-button",onClick:()=>{for(const d of a)n();c()}})}),c=l},t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],je(r)}const oi=()=>({entries:new Map}),{valueAtom:bu,useActions:xu}=nc(oi,{submit:(t,e)=>{const{cellIds:n,deleteCell:o,deleteManyCells:r,store:s}=e,a=s.get(Pt),l=s.get(Qp),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)}),oi()):{...t,entries:d}},clear:()=>oi()});function Yo(){const t=tc(),{submit:e,clear:n}=xu(),{entries:o}=le(bu),r=Jo(),s=Ko();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 wb(t){return t.cellId}function yu(){return{selectionStart:null,selectionEnd:null,selected:new Set}}const{valueAtom:ri,useActions:kb}=nc(yu,{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:yu()});function ns(){return kb()}const jb=t=>{const e=z.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(Na,{size:13,strokeWidth:1.5}),e[0]=s):s=e[0],e[1]!==r?(a=i.jsx(Un,{asChild:!0,children:i.jsx(xe,{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(ql,{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 Cb(t){return t.length>0}function Nb(t){return t.filter(Sb)}function Sb(t){return!t.hidden}function Eb(t){return t.length>0}function _b(t){return t.filter(Ib)}function Ib(t){return!t.hidden}function Ab(t){const e={};t.forEach(n=>{const o=Zp(n);o&&(e[n]=o)}),e1(e)}const Tb=()=>{const t=z.c(4),e=le(ri);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(Mb,{cellIds:o}),i.jsx(Db,{cellIds:o})]}),t[2]=o,t[3]=r):r=t[3],r},si=()=>{const t=z.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},Db=t=>{const e=z.c(12),{cellIds:n}=t,o=Yo(),r=Ko(),s=ns();if(!o.shouldConfirmDelete)return null;let a,l,c,d,u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(oc,{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(xe,{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(xe,{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(Yl,{restoreFocus:!0,autoFocus:!0,children:i.jsxs("div",{className:"flex items-center gap-2 mt-3",onKeyDown:Ob,children:[c,d]})})]})]})})})}),e[9]=c,e[10]=d,e[11]=u):u=e[11],u},Mb=t=>{const e=z.c(23),{cellIds:n}=t,o=ns(),r=Yo(),{actions:s,moreActions:a}=(function(p){const g=z.c(31),{updateCellConfig:y,moveCell:w,clearCellOutput:k,sendToTop:N,sendToBottom:j}=Ve(),C=Ko(),_=le(sa),E=ns(),A=qo(),I=Yo(),F=le(aa),{saveCellConfig:D}=We(),M=p.length,O=!_||M<p.length;let R;g[0]!==C||g[1]!==I||g[2]!==E||g[3]!==F?(R=Z=>{I.idle&&F.keymap.destructive_delete?I.submit(Z):(C({cellIds:Z}),I.clear(),E.clear())},g[0]=C,g[1]=I,g[2]=E,g[3]=F,g[4]=R):R=g[4];const U=je(R);let T;g[5]!==w?(T=(Z,oe)=>{if(oe==="down"){const se=Z[Z.length-1];if(Me.get(Pt).cellIds.findWithId(se).last()===se)return}if(oe==="up"){const se=Z[0];if(Me.get(Pt).cellIds.findWithId(se).first()===se)return}(oe==="up"?Z:[...Z].reverse()).forEach(se=>{w({cellId:se,before:oe==="up"})})},g[5]=w,g[6]=T):T=g[6];const L=je(T);let V;g[7]!==N?(V=Z=>{[...Z].reverse().forEach(oe=>{N({cellId:oe})})},g[7]=N,g[8]=V):V=g[8];const $=je(V);let B;g[9]!==j?(B=Z=>{Z.forEach(oe=>{j({cellId:oe})})},g[9]=j,g[10]=B):B=g[10];const K=je(B),te=je(Ab);let Y;g[11]!==k?(Y=Z=>{Z.forEach(oe=>{k({cellId:oe})})},g[11]=k,g[12]=Y):Y=g[12];const J=je(Y);let G;g[13]!==D||g[14]!==y?(G=async(Z,oe,se)=>{const ae={};Z.forEach(ee=>{ae[ee]={[oe]:se}}),await D({configs:ae}),Z.forEach(ee=>{y({cellId:ee,config:ae[ee]})})},g[13]=D,g[14]=y,g[15]=G):G=g[15];const q=je(G);let W,ne,X;if(g[16]===Symbol.for("react.memo_cache_sentinel")?(W=i.jsx(zo,{size:13,strokeWidth:1.5}),g[16]=W):W=g[16],g[17]!==A?(ne=Z=>A(Z),g[17]=A,g[18]=ne):ne=g[18],g[19]!==O||g[20]!==J||g[21]!==U||g[22]!==te||g[23]!==L||g[24]!==K||g[25]!==$||g[26]!==ne||g[27]!==q){const Z=[[{icon:W,label:"Run cells",handle:ne,hotkey:"cell.run"}],[{icon:i.jsx(ia,{size:13,strokeWidth:1.5}),label:"Move up",handle:ee=>L(ee,"up"),hotkey:"cell.moveUp"},{icon:i.jsx($n,{size:13,strokeWidth:1.5}),label:"Move down",handle:ee=>L(ee,"down"),hotkey:"cell.moveDown"}],[{icon:i.jsx(rc,{size:13,strokeWidth:1.5}),label:"Delete cells",variant:"danger",hidden:!O,handle:U}]],oe=[[{icon:i.jsx(t1,{size:13,strokeWidth:1.5}),label:"Format cells",handle:te,hotkey:"cell.format"},{icon:i.jsx(Ys,{size:13,strokeWidth:1.5}),label:"Clear outputs",handle:J}],[{icon:i.jsx(Gl,{size:13,strokeWidth:1.5}),label:"Hide code",handle:ee=>q(ee,"hide_code",!0),hotkey:"cell.hideCode"},{icon:i.jsx(n1,{size:13,strokeWidth:1.5}),label:"Show code",handle:ee=>q(ee,"hide_code",!1),hotkey:"cell.hideCode"}],[{icon:i.jsx(ia,{size:13,strokeWidth:1.5}),label:"Move up",handle:ee=>L(ee,"up"),hotkey:"cell.moveUp"},{icon:i.jsx($n,{size:13,strokeWidth:1.5}),label:"Move down",handle:ee=>L(ee,"down"),hotkey:"cell.moveDown"},{icon:i.jsx(Oa,{size:13,strokeWidth:1.5}),label:"Send to top",handle:$,hotkey:"cell.sendToTop"},{icon:i.jsx(gt,{size:13,strokeWidth:1.5}),label:"Send to bottom",handle:K,hotkey:"cell.sendToBottom"}],[{icon:i.jsx(Et,{size:13,strokeWidth:1.5}),label:"Disable cells",handle:ee=>q(ee,"disabled",!0)},{icon:i.jsx(_t,{size:13,strokeWidth:1.5}),label:"Enable cells",handle:ee=>q(ee,"disabled",!1)}]],se=Z.map(_b);let ae;g[29]!==se?(ae=se.filter(Eb),g[29]=se,g[30]=ae):ae=g[30],X={actions:ae,moreActions:oe.map(Nb).filter(Cb)},g[19]=O,g[20]=J,g[21]=U,g[22]=te,g[23]=L,g[24]=K,g[25]=$,g[26]=ne,g[27]=q,g[28]=X}else X=g[28];return X})(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],Hl(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(si,{}),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(xe,{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(ql,{shortcut:w.hotkey})})]},w.label)),y<s.length-1&&i.jsx(si,{})]},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(si,{}),e[14]=f):f=e[14],e[15]!==n||e[16]!==d||e[17]!==a?(b=i.jsx(jb,{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 Ob(t){t.stopPropagation()}const Rb={display:"none"};function Lb(t){let{id:e,value:n}=t;return me.createElement("div",{id:e,style:Rb},n)}function Fb(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 vu=S.createContext(null),Bb={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
- `},Pb={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 zb(t){let{announcements:e=Pb,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=Bb}=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(vu);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(Lb,{id:o,value:r.draggable}),me.createElement(Fb,{id:l,announcement:a}));return n?_r.createPortal(u,n):u}var ot;function os(){}function wu(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 zt=Object.freeze({x:0,y:0});function ai(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ii(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return n-o}function Ub(t,e){let{data:{value:n}}=t,{data:{value:o}}=e;return o-n}function li(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 ci(t,e){if(!t||t.length===0)return null;const[n]=t;return e?n[e]:n}function ku(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 di=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:o}=t;const r=ku(e,e.left,e.top),s=[];for(const a of o){const{id:l}=a,c=n.get(l);if(c){const d=ai(ku(c),r);s.push({id:l,data:{droppableContainer:a,value:d}})}}return s.sort(ii)};function Wb(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 ju=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=Wb(l,e);c>0&&r.push({id:a,data:{droppableContainer:s,value:c}})}}return r.sort(Ub)};function $b(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 Cu(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:zt}function Vb(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 Gb=Vb(1),qb={ignoreTransform:!1};function mo(t,e){e===void 0&&(e=qb);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(C){if(C.startsWith("matrix3d(")){const _=C.slice(9,-1).split(/, /);return{x:+_[12],y:+_[13],scaleX:+_[0],scaleY:+_[5]}}if(C.startsWith("matrix(")){const _=C.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),k=h.top-y-(1-p)*parseFloat(f.slice(f.indexOf(" ")+1)),N=x?h.width/x:h.width,j=p?h.height/p:h.height;return{width:N,height:j,top:k,right:w+N,bottom:k+j,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 Nu(t){return mo(t,{ignoreTransform:!0})}function rs(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(!ca(r)||Xk(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 Su(t){const[e]=rs(t,1);return e??null}function ui(t){return ic&&t?lc(t)?t:e4(t)?r1(t)||t===Oo(t).scrollingElement?window:ca(t)?t:null:null:null}function Eu(t){return lc(t)?t.scrollX:t.scrollLeft}function _u(t){return lc(t)?t.scrollY:t.scrollTop}function hi(t){return{x:Eu(t),y:_u(t)}}var at;function Iu(t){return!(!ic||!t)&&t===document.scrollingElement}function Au(t){const e={x:0,y:0},n=Iu(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 Hb={x:.2,y:.2};function Jb(t,e,n,o,r){let{top:s,left:a,right:l,bottom:c}=n;o===void 0&&(o=10),r===void 0&&(r=Hb);const{isTop:d,isBottom:u,isLeft:h,isRight:m}=Au(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 Kb(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 Tu(t){return t.reduce((e,n)=>Ro(e,hi(n)),zt)}const Yb=[["x",["left","right"],function(t){return t.reduce((e,n)=>e+Eu(n),0)}],["y",["top","bottom"],function(t){return t.reduce((e,n)=>e+_u(n),0)}]];class mi{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=rs(n),r=Tu(o);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,a,l]of Yb)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 Xo{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 fi(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 Du(t){t.preventDefault()}function Xb(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 Mu={start:[Ae.Space,Ae.Enter],cancel:[Ae.Esc],end:[Ae.Space,Ae.Enter,Ae.Tab]},Qb=(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 pi{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 Xo(Oo(n)),this.windowListeners=new Xo(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);Su(r)&&(c<=0||d<=0||a>=window.innerHeight||l>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})})(o),n(zt)}handleKeyDown(e){if(sc(e)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=Mu,coordinateGetter:a=Qb,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}:zt;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:k,maxScroll:N,minScroll:j}=Au(x),C=Kb(x),_={x:Math.min(p===Ae.Right?C.right-C.width/2:C.right,Math.max(p===Ae.Right?C.left:C.left+C.width/2,h.x)),y:Math.min(p===Ae.Down?C.bottom-C.height/2:C.bottom,Math.max(p===Ae.Down?C.top:C.top+C.height/2,h.y))},E=p===Ae.Right&&!y||p===Ae.Left&&!w,A=p===Ae.Down&&!k||p===Ae.Up&&!g;if(E&&_.x!==h.x){const I=x.scrollLeft+m.x,F=p===Ae.Right&&I<=N.x||p===Ae.Left&&I>=j.x;if(F&&!m.y)return void x.scrollTo({left:I,behavior:l});f.x=F?x.scrollLeft-I:p===Ae.Right?x.scrollLeft-N.x:x.scrollLeft-j.x,f.x&&x.scrollBy({left:-f.x,behavior:l});break}if(A&&_.y!==h.y){const I=x.scrollTop+m.y,F=p===Ae.Down&&I<=N.y||p===Ae.Up&&I>=j.y;if(F&&!m.x)return void x.scrollTo({top:I,behavior:l});f.y=F?x.scrollTop-I:p===Ae.Down?x.scrollTop-N.y:x.scrollTop-j.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 Ou(t){return!!(t&&"distance"in t)}function Ru(t){return!!(t&&"delay"in t)}pi.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:o=Mu,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 gi{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 Xo(this.document),this.listeners=new Xo(o),this.windowListeners=new Xo(In(a)),this.initialCoordinates=(r=ac(s))!=null?r:zt,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,Du),this.windowListeners.add(Rt.VisibilityChange,this.handleCancel),this.windowListeners.add(Rt.ContextMenu,Du),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(Ru(n))return this.timeoutId=setTimeout(this.handleStart,n.delay),void this.handlePending(n);if(Ou(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,Xb,{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=ac(e))!=null?n:zt,d=Er(r,c);if(!o&&l){if(Ou(l)){if(l.tolerance!=null&&fi(d,l.tolerance))return this.handleCancel();if(fi(d,l.distance))return this.handleStart()}return Ru(l)&&fi(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 Zb={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class bi extends gi{constructor(e){const{event:n}=e,o=Oo(n.target);super(e,Zb,o)}}bi.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 ex={move:{name:"mousemove"},end:{name:"mouseup"}};var xi;(function(t){t[t.RightClick=2]="RightClick"})(xi||(xi={})),(class extends gi{constructor(t){super(t,ex,Oo(t.event.target))}}).activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:o}=e;return n.button!==xi.RightClick&&(o==null||o({event:n}),!0)}}];const yi={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Qo,ss;function tx(t){let{acceleration:e,activator:n=Qo.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:a=5,order:l=ss.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=t;const f=(function(j){let{delta:C,disabled:_}=j;const E=da(C);return Ir(A=>{if(_||!E||!A)return nx;const I={x:Math.sign(C.x-E.x),y:Math.sign(C.y-E.y)};return{x:{[at.Backward]:A.x[at.Backward]||I.x===-1,[at.Forward]:A.x[at.Forward]||I.x===1},y:{[at.Backward]:A.y[at.Backward]||I.y===-1,[at.Forward]:A.y[at.Forward]||I.y===1}}},[_,C,E])})({delta:h,disabled:!s}),[b,x]=Qk(),p=S.useRef({x:0,y:0}),g=S.useRef({x:0,y:0}),y=S.useMemo(()=>{switch(n){case Qo.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Qo.DraggableRect:return r}},[n,r,c]),w=S.useRef(null),k=S.useCallback(()=>{const j=w.current;if(!j)return;const C=p.current.x*g.current.x,_=p.current.y*g.current.y;j.scrollBy(C,_)},[]),N=S.useMemo(()=>l===ss.TreeOrder?[...d].reverse():d,[l,d]);S.useEffect(()=>{if(s&&d.length&&y){for(const j of N){if((o==null?void 0:o(j))===!1)continue;const C=d.indexOf(j),_=u[C];if(!_)continue;const{direction:E,speed:A}=Jb(j,_,y,e,m);for(const I of["x","y"])f[I][E[I]]||(A[I]=0,E[I]=0);if(A.x>0||A.y>0)return x(),w.current=j,b(k,a),p.current=A,void(g.current=E)}p.current={x:0,y:0},g.current={x:0,y:0},x()}else x()},[e,k,o,x,s,a,JSON.stringify(y),JSON.stringify(f),b,d,N,u,JSON.stringify(m)])}(class extends gi{constructor(t){super(t,yi)}static setup(){return window.addEventListener(yi.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(yi.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"})(Qo||(Qo={})),(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ss||(ss={}));const nx={x:{[at.Backward]:!1,[at.Forward]:!1},y:{[at.Backward]:!1,[at.Forward]:!1}};var Zo,vi;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Zo||(Zo={})),(function(t){t.Optimized="optimized"})(vi||(vi={}));const Lu=new Map;function Fu(t,e){return Ir(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function as(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 ox(t){return new mi(mo(t),t)}function Bu(t,e,n){e===void 0&&(e=ox);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=as({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 Pu=[];function zu(t,e){e===void 0&&(e=[]);const n=S.useRef(null);return S.useEffect(()=>{n.current=null},e),S.useEffect(()=>{const o=t!==zt;o&&!n.current&&(n.current=t),!o&&n.current&&(n.current=null)},[t]),n.current?Er(t,n.current):zt}function Uu(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 Wu=[];function rx(t){let{measure:e}=t;const[n,o]=S.useState(null),r=S.useCallback(d=>{for(const{target:u}of d)if(ca(u)){o(h=>{const m=e(u);return h?{...h,width:m.width,height:m.height}:m});break}},[e]),s=as({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 ca(m)?m:h})(d);s==null||s.disconnect(),u&&(s==null||s.observe(u)),o(u?e(u):null)},[e,s]),[l,c]=la(a);return S.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const sx=[{sensor:bi,options:{}},{sensor:pi,options:{}}],ax={current:{}},is={draggable:{measure:Nu},droppable:{measure:Nu,strategy:Zo.WhileDragging,frequency:vi.Optimized},dragOverlay:{measure:mo}};class er 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 ix={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new er,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:os},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:is,measureDroppableContainers:os,windowRect:null,measuringScheduled:!1},lx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:os,draggableNodes:new Map,over:null,measureDroppableContainers:os},ls=S.createContext(lx),$u=S.createContext(ix);function cx(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new er}}}function dx(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 er(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 er(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 er(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function ux(t){let{disabled:e}=t;const{active:n,activatorEvent:o,draggableNodes:r}=S.useContext(ls),s=da(o),a=da(n==null?void 0:n.id);return S.useEffect(()=>{if(!e&&!o&&s&&a!=null){if(!sc(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=Zk(u);if(h){h.focus();break}}})}},[o,e,r,a,s]),null}const Vu=S.createContext({...zt,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 hx=S.memo(function(t){var e,n,o,r;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:d=sx,collisionDetection:u=ju,measuring:h,modifiers:m,...f}=t;const b=S.useReducer(dx,void 0,cx),[x,p]=b,[g,y]=(function(){const[re]=S.useState(()=>new Set),ce=S.useCallback(ie=>(re.add(ie),()=>re.delete(ie)),[re]);return[S.useCallback(ie=>{let{type:Ce,event:Ne}=ie;re.forEach(ye=>{var De;return(De=ye[Ce])==null?void 0:De.call(ye,Ne)})},[re]),ce]})(),[w,k]=S.useState(An.Uninitialized),N=w===An.Initialized,{draggable:{active:j,nodes:C,translate:_},droppable:{containers:E}}=x,A=j!=null?C.get(j):null,I=S.useRef({initial:null,translated:null}),F=S.useMemo(()=>{var re;return j!=null?{id:j,data:(re=A==null?void 0:A.data)!=null?re:ax,rect:I}:null},[j,A]),D=S.useRef(null),[M,O]=S.useState(null),[R,U]=S.useState(null),T=Sr(f,Object.values(f)),L=Nr("DndDescribedBy",s),V=S.useMemo(()=>E.getEnabled(),[E]),$=(B=h,S.useMemo(()=>({draggable:{...is.draggable,...B==null?void 0:B.draggable},droppable:{...is.droppable,...B==null?void 0:B.droppable},dragOverlay:{...is.dragOverlay,...B==null?void 0:B.dragOverlay}}),[B==null?void 0:B.draggable,B==null?void 0:B.droppable,B==null?void 0:B.dragOverlay]));var B;const{droppableRects:K,measureDroppableContainers:te,measuringScheduled:Y}=(function(re,ce){let{dragging:ie,dependencies:Ce,config:Ne}=ce;const[ye,De]=S.useState(null),{frequency:Fe,measure:Ie,strategy:Le}=Ne,kt=S.useRef(re),jt=(function(){switch(Le){case Zo.Always:return!1;case Zo.BeforeDragging:return ie;default:return!ie}})(),Wt=Sr(jt),Tt=S.useCallback(function(Ln){Ln===void 0&&(Ln=[]),Wt.current||De(no=>no===null?Ln:no.concat(Ln.filter(Kt=>!no.includes(Kt))))},[Wt]),Nn=S.useRef(null),Gs=Ir(Ln=>{if(jt&&!ie)return Lu;if(!Ln||Ln===Lu||kt.current!==re||ye!=null){const no=new Map;for(let Kt of re){if(!Kt)continue;if(ye&&ye.length>0&&!ye.includes(Kt.id)&&Kt.rect.current){no.set(Kt.id,Kt.rect.current);continue}const Cl=Kt.node.current,Nl=Cl?new mi(Ie(Cl),Cl):null;Kt.rect.current=Nl,Nl&&no.set(Kt.id,Nl)}return no}return Ln},[re,ye,ie,jt,Ie]);return S.useEffect(()=>{kt.current=re},[re]),S.useEffect(()=>{jt||Tt()},[ie,jt]),S.useEffect(()=>{ye&&ye.length>0&&De(null)},[JSON.stringify(ye)]),S.useEffect(()=>{jt||typeof Fe!="number"||Nn.current!==null||(Nn.current=setTimeout(()=>{Tt(),Nn.current=null},Fe))},[Fe,jt,Tt,...Ce]),{droppableRects:Gs,measureDroppableContainers:Tt,measuringScheduled:ye!=null}})(V,{dragging:N,dependencies:[_.x,_.y],config:$.droppable}),J=(function(re,ce){const ie=ce!=null?re.get(ce):void 0,Ce=ie?ie.node.current:null;return Ir(Ne=>{var ye;return ce==null?null:(ye=Ce??Ne)!=null?ye:null},[Ce,ce])})(C,j),G=S.useMemo(()=>R?ac(R):null,[R]),q=(function(){const re=(M==null?void 0:M.autoScrollEnabled)===!1,ce=typeof l=="object"?l.enabled===!1:l===!1,ie=N&&!re&&!ce;return typeof l=="object"?{...l,enabled:ie}:{enabled:ie}})(),W=(function(re,ce){return Fu(re,ce)})(J,$.draggable.measure);(function(re){let{activeNode:ce,measure:ie,initialRect:Ce,config:Ne=!0}=re;const ye=S.useRef(!1),{x:De,y:Fe}=typeof Ne=="boolean"?{x:Ne,y:Ne}:Ne;Vn(()=>{if(!De&&!Fe||!ce)return void(ye.current=!1);if(ye.current||!Ce)return;const Ie=ce==null?void 0:ce.node.current;if(!Ie||Ie.isConnected===!1)return;const Le=Cu(ie(Ie),Ce);if(De||(Le.x=0),Fe||(Le.y=0),ye.current=!0,Math.abs(Le.x)>0||Math.abs(Le.y)>0){const kt=Su(Ie);kt&&kt.scrollBy({top:Le.y,left:Le.x})}},[ce,De,Fe,Ce,ie])})({activeNode:j!=null?C.get(j):null,config:q.layoutShiftCompensation,initialRect:W,measure:$.draggable.measure});const ne=Bu(J,$.draggable.measure,W),X=Bu(J?J.parentElement:null),Z=S.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=E.getNodeFor((e=Z.current.over)==null?void 0:e.id),se=rx({measure:$.dragOverlay.measure}),ae=(n=se.nodeRef.current)!=null?n:J,ee=N?(o=se.rect)!=null?o:ne:null,_e=!!(se.nodeRef.current&&se.rect),ue=Cu(we=_e?null:ne,Fu(we));var we;const ke=Uu(ae?In(ae):null),ge=(function(re){const ce=S.useRef(re),ie=Ir(Ce=>re?Ce&&Ce!==Pu&&re&&ce.current&&re.parentNode===ce.current.parentNode?Ce:rs(re):Pu,[re]);return S.useEffect(()=>{ce.current=re},[re]),ie})(N?oe??J:null),Ee=(function(re,ce){ce===void 0&&(ce=mo);const[ie]=re,Ce=Uu(ie?In(ie):null),[Ne,ye]=S.useState(Wu);function De(){ye(()=>re.length?re.map(Ie=>Iu(Ie)?Ce:new mi(ce(Ie),Ie)):Wu)}const Fe=as({callback:De});return Vn(()=>{Fe==null||Fe.disconnect(),De(),re.forEach(Ie=>Fe==null?void 0:Fe.observe(Ie))},[re]),Ne})(ge),Re=(function(re,ce){let{transform:ie,...Ce}=ce;return re!=null&&re.length?re.reduce((Ne,ye)=>ye({transform:Ne,...Ce}),ie):ie})(m,{transform:{x:_.x-ue.x,y:_.y-ue.y,scaleX:1,scaleY:1},activatorEvent:R,active:F,activeNodeRect:ne,containerNodeRect:X,draggingNodeRect:ee,over:Z.current.over,overlayNodeRect:se.rect,scrollableAncestors:ge,scrollableAncestorRects:Ee,windowRect:ke}),ve=G?Ro(G,_):null,be=(function(re){const[ce,ie]=S.useState(null),Ce=S.useRef(re),Ne=S.useCallback(ye=>{const De=ui(ye.target);De&&ie(Fe=>Fe?(Fe.set(De,hi(De)),new Map(Fe)):null)},[]);return S.useEffect(()=>{const ye=Ce.current;if(re!==ye){De(ye);const Fe=re.map(Ie=>{const Le=ui(Ie);return Le?(Le.addEventListener("scroll",Ne,{passive:!0}),[Le,hi(Le)]):null}).filter(Ie=>Ie!=null);ie(Fe.length?new Map(Fe):null),Ce.current=re}return()=>{De(re),De(ye)};function De(Fe){Fe.forEach(Ie=>{const Le=ui(Ie);Le==null||Le.removeEventListener("scroll",Ne)})}},[Ne,re]),S.useMemo(()=>re.length?ce?Array.from(ce.values()).reduce((ye,De)=>Ro(ye,De),zt):Tu(re):zt,[re,ce])})(ge),et=zu(be),rt=zu(be,[ne]),ct=Ro(Re,et),dt=ee?Gb(ee,Re):null,pt=F&&dt?u({active:F,collisionRect:dt,droppableRects:K,droppableContainers:V,pointerCoordinates:ve}):null,ut=ci(pt,"id"),[wt,Lt]=S.useState(null),On=(function(re,ce,ie){return{...re,scaleX:ce&&ie?ce.width/ie.width:1,scaleY:ce&&ie?ce.height/ie.height:1}})(_e?Re:Ro(Re,rt),(r=wt==null?void 0:wt.rect)!=null?r:null,ne),Jt=S.useRef(null),Ft=S.useCallback((re,ce)=>{let{sensor:ie,options:Ce}=ce;if(D.current==null)return;const Ne=C.get(D.current);if(!Ne)return;const ye=re.nativeEvent,De=new ie({active:D.current,activeNode:Ne,event:ye,options:Ce,context:Z,onAbort(Ie){if(!C.get(Ie))return;const{onDragAbort:Le}=T.current,kt={id:Ie};Le==null||Le(kt),g({type:"onDragAbort",event:kt})},onPending(Ie,Le,kt,jt){if(!C.get(Ie))return;const{onDragPending:Wt}=T.current,Tt={id:Ie,constraint:Le,initialCoordinates:kt,offset:jt};Wt==null||Wt(Tt),g({type:"onDragPending",event:Tt})},onStart(Ie){const Le=D.current;if(Le==null)return;const kt=C.get(Le);if(!kt)return;const{onDragStart:jt}=T.current,Wt={activatorEvent:ye,active:{id:Le,data:kt.data,rect:I}};_r.unstable_batchedUpdates(()=>{jt==null||jt(Wt),k(An.Initializing),p({type:ot.DragStart,initialCoordinates:Ie,active:Le}),g({type:"onDragStart",event:Wt}),O(Jt.current),U(ye)})},onMove(Ie){p({type:ot.DragMove,coordinates:Ie})},onEnd:Fe(ot.DragEnd),onCancel:Fe(ot.DragCancel)});function Fe(Ie){return async function(){const{active:Le,collisions:kt,over:jt,scrollAdjustedTranslate:Wt}=Z.current;let Tt=null;if(Le&&Wt){const{cancelDrop:Nn}=T.current;Tt={activatorEvent:ye,active:Le,collisions:kt,delta:Wt,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}),k(An.Uninitialized),Lt(null),O(null),U(null),Jt.current=null;const Nn=Ie===ot.DragEnd?"onDragEnd":"onDragCancel";if(Tt){const Gs=T.current[Nn];Gs==null||Gs(Tt),g({type:Nn,event:Tt})}})}}Jt.current=De},[C]),Ut=S.useCallback((re,ce)=>(ie,Ce)=>{const Ne=ie.nativeEvent,ye=C.get(Ce);if(D.current!==null||!ye||Ne.dndKit||Ne.defaultPrevented)return;const De={active:ye};re(ie,ce.options,De)===!0&&(Ne.dndKit={capturedBy:ce.sensor},D.current=Ce,Ft(ie,ce))},[C,Ft]),to=(function(re,ce){return S.useMemo(()=>re.reduce((ie,Ce)=>{const{sensor:Ne}=Ce;return[...ie,...Ne.activators.map(ye=>({eventName:ye.eventName,handler:ce(ye.handler,Ce)}))]},[]),[re,ce])})(d,Ut);(function(re){S.useEffect(()=>{if(!ic)return;const ce=re.map(ie=>{let{sensor:Ce}=ie;return Ce.setup==null?void 0:Ce.setup()});return()=>{for(const ie of ce)ie==null||ie()}},re.map(ce=>{let{sensor:ie}=ce;return ie}))})(d),Vn(()=>{ne&&w===An.Initializing&&k(An.Initialized)},[ne,w]),S.useEffect(()=>{const{onDragMove:re}=T.current,{active:ce,activatorEvent:ie,collisions:Ce,over:Ne}=Z.current;if(!ce||!ie)return;const ye={active:ce,activatorEvent:ie,collisions:Ce,delta:{x:ct.x,y:ct.y},over:Ne};_r.unstable_batchedUpdates(()=>{re==null||re(ye),g({type:"onDragMove",event:ye})})},[ct.x,ct.y]),S.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:ie,droppableContainers:Ce,scrollAdjustedTranslate:Ne}=Z.current;if(!re||D.current==null||!ce||!Ne)return;const{onDragOver:ye}=T.current,De=Ce.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:ie,delta:{x:Ne.x,y:Ne.y},over:Fe};_r.unstable_batchedUpdates(()=>{Lt(Fe),ye==null||ye(Ie),g({type:"onDragOver",event:Ie})})},[ut]),Vn(()=>{Z.current={activatorEvent:R,active:F,activeNode:J,collisionRect:dt,collisions:pt,droppableRects:K,draggableNodes:C,draggingNode:ae,draggingNodeRect:ee,droppableContainers:E,over:wt,scrollableAncestors:ge,scrollAdjustedTranslate:ct},I.current={initial:ee,translated:dt}},[F,J,pt,dt,C,ae,ee,K,E,wt,ge,ct]),tx({...q,delta:_,draggingRect:dt,pointerCoordinates:ve,scrollableAncestors:ge,scrollableAncestorRects:Ee});const Rn=S.useMemo(()=>({active:F,activeNode:J,activeNodeRect:ne,activatorEvent:R,collisions:pt,containerNodeRect:X,dragOverlay:se,draggableNodes:C,droppableContainers:E,droppableRects:K,over:wt,measureDroppableContainers:te,scrollableAncestors:ge,scrollableAncestorRects:Ee,measuringConfiguration:$,measuringScheduled:Y,windowRect:ke}),[F,J,ne,R,pt,X,se,C,E,K,wt,te,ge,Ee,$,Y,ke]),No=S.useMemo(()=>({activatorEvent:R,activators:to,active:F,activeNodeRect:ne,ariaDescribedById:{draggable:L},dispatch:p,draggableNodes:C,over:wt,measureDroppableContainers:te}),[R,to,F,ne,p,L,C,wt,te]);return me.createElement(vu.Provider,{value:y},me.createElement(ls.Provider,{value:No},me.createElement($u.Provider,{value:Rn},me.createElement(Vu.Provider,{value:On},c)),me.createElement(ux,{disabled:(a==null?void 0:a.restoreFocus)===!1})),me.createElement(zb,{...a,hiddenTextDescribedById:L}))}),mx=S.createContext(null),Gu="button";function fx(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(ls),{role:f=Gu,roleDescription:b="draggable",tabIndex:x=0}=r??{},p=(c==null?void 0:c.id)===e,g=S.useContext(p?Vu:mx),[y,w]=la(),[k,N]=la(),j=(function(_,E){return S.useMemo(()=>_.reduce((A,I)=>{let{eventName:F,handler:D}=I;return A[F]=M=>{D(M,E)},A},{}),[_,E])})(a,e),C=Sr(n);return Vn(()=>(h.set(e,{id:e,key:s,node:y,activatorNode:k,data:C}),()=>{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!==Gu)||void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[o,f,x,p,b,u.draggable]),isDragging:p,listeners:o?void 0:j,node:y,over:m,setNodeRef:w,setActivatorNodeRef:N,transform:g}}const px={timeout:25};function qu(t,e,n){const o=t.slice();return o.splice(n<0?o.length+n:n,0,o.splice(e,1)[0]),o}function gx(t,e){return t.reduce((n,o,r)=>{const s=e.get(o);return s&&(n[r]=s),n},Array(t.length))}function cs(t){return t!==null&&t>=0}const ds={scaleX:1,scaleY:1},bx=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,...ds}:null}return a>r&&a<=s?{x:-l.width-c,y:0,...ds}:a<r&&a>=s?{x:l.width+c,y:0,...ds}:{x:0,y:0,...ds}},Hu=t=>{let{rects:e,activeIndex:n,overIndex:o,index:r}=t;const s=qu(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},us={scaleX:1,scaleY:1},xx=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,...us}: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,...us}:r<n&&r>=a?{x:0,y:l.height+c,...us}:{x:0,y:0,...us}},Ju="Sortable",Ku=me.createContext({activeIndex:-1,containerId:Ju,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Hu,disabled:{draggable:!1,droppable:!1}});function Yu(t){let{children:e,id:n,items:o,strategy:r=Hu,disabled:s=!1}=t;const{active:a,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:u}=S.useContext($u),h=Nr(Ju,n),m=l.rect!==null,f=S.useMemo(()=>o.map(j=>typeof j=="object"&&"id"in j?j.id:j),[o]),b=a!=null,x=a?f.indexOf(a.id):-1,p=d?f.indexOf(d.id):-1,g=S.useRef(f),y=!(function(j,C){if(j===C)return!0;if(j.length!==C.length)return!1;for(let _=0;_<j.length;_++)if(j[_]!==C[_])return!1;return!0})(f,g.current),w=p!==-1&&x===-1||y,k=(function(j){return typeof j=="boolean"?{draggable:j,droppable:j}:j})(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:k,disableTransforms:w,items:f,overIndex:p,useDragOverlay:m,sortedRects:gx(f,c),strategy:r}),[x,h,k.draggable,k.droppable,w,f,p,c,m,r]);return me.createElement(Ku.Provider,{value:N},e)}const yx=t=>{let{id:e,items:n,activeIndex:o,overIndex:r}=t;return qu(n,o,r).indexOf(e)},vx=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)},wx={duration:200,easing:"ease"},Xu="transform",kx=ua.Transition.toString({property:Xu,duration:0,easing:"linear"}),jx={roleDescription:"sortable"};function Qu(t){let{animateLayoutChanges:e=vx,attributes:n,disabled:o,data:r,getNewIndex:s=yx,id:a,strategy:l,resizeObserverConfig:c,transition:d=wx}=t;const{items:u,containerId:h,activeIndex:m,disabled:f,disableTransforms:b,sortedRects:x,overIndex:p,useDragOverlay:g,strategy:y}=S.useContext(Ku),w=(function(oe,se){var ae,ee;return typeof oe=="boolean"?{draggable:oe,droppable:!1}:{draggable:(ae=oe==null?void 0:oe.draggable)!=null?ae:se.draggable,droppable:(ee=oe==null?void 0:oe.droppable)!=null?ee:se.droppable}})(o,f),k=u.indexOf(a),N=S.useMemo(()=>({sortable:{containerId:h,index:k,items:u},...r}),[h,r,k,u]),j=S.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:C,node:_,isOver:E,setNodeRef:A}=(function(oe){let{data:se,disabled:ae=!1,id:ee,resizeObserverConfig:_e}=oe;const ue=Nr("Droppable"),{active:we,dispatch:ke,over:ge,measureDroppableContainers:Ee}=S.useContext(ls),Re=S.useRef({disabled:ae}),ve=S.useRef(!1),be=S.useRef(null),et=S.useRef(null),{disabled:rt,updateMeasurementsFor:ct,timeout:dt}={...px,..._e},pt=Sr(ct??ee),ut=as({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,Ut)=>{ut&&(Ut&&(ut.unobserve(Ut),ve.current=!1),Ft&&ut.observe(Ft))},[ut]),[Lt,On]=la(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:ee,key:ue,disabled:ae,node:Lt,rect:be,data:Jt}}),()=>ke({type:ot.UnregisterDroppable,key:ue,id:ee})),[ee]),S.useEffect(()=>{ae!==Re.current.disabled&&(ke({type:ot.SetDroppableDisabled,id:ee,key:ue,disabled:ae}),Re.current.disabled=ae)},[ee,ue,ae,ke]),{active:we,rect:be,isOver:(ge==null?void 0:ge.id)===ee,node:Lt,over:ge,setNodeRef:On}})({id:a,data:N,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:I,activatorEvent:F,activeNodeRect:D,attributes:M,setNodeRef:O,listeners:R,isDragging:U,over:T,setActivatorNodeRef:L,transform:V}=fx({id:a,data:N,attributes:{...jx,...n},disabled:w.draggable}),$=t4(A,O),B=!!I,K=B&&!b&&cs(m)&&cs(p),te=!g&&U,Y=te&&K?V:null,J=K?Y??(l??y)({rects:x,activeNodeRect:D,activeIndex:m,overIndex:p,index:k}):null,G=cs(m)&&cs(p)?s({id:a,items:u,activeIndex:m,overIndex:p}):k,q=I==null?void 0:I.id,W=S.useRef({activeId:q,items:u,newIndex:G,containerId:h}),ne=u!==W.current.items,X=e({active:I,containerId:h,isDragging:U,isSorting:B,id:a,index:k,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:d,wasDragging:W.current.activeId!=null}),Z=(function(oe){let{disabled:se,index:ae,node:ee,rect:_e}=oe;const[ue,we]=S.useState(null),ke=S.useRef(ae);return Vn(()=>{if(!se&&ae!==ke.current&&ee.current){const ge=_e.current;if(ge){const Ee=mo(ee.current,{ignoreTransform:!0}),Re={x:ge.left-Ee.left,y:ge.top-Ee.top,scaleX:ge.width/Ee.width,scaleY:ge.height/Ee.height};(Re.x||Re.y)&&we(Re)}}ae!==ke.current&&(ke.current=ae)},[se,ae,ee,_e]),S.useEffect(()=>{ue&&we(null)},[ue]),ue})({disabled:!X,index:k,node:_,rect:C});return S.useEffect(()=>{B&&W.current.newIndex!==G&&(W.current.newIndex=G),h!==W.current.containerId&&(W.current.containerId=h),u!==W.current.items&&(W.current.items=u)},[B,G,h,u]),S.useEffect(()=>{if(q===W.current.activeId)return;if(q!=null&&W.current.activeId==null)return void(W.current.activeId=q);const oe=setTimeout(()=>{W.current.activeId=q},50);return()=>clearTimeout(oe)},[q]),{active:I,activeIndex:m,attributes:M,data:N,rect:C,index:k,newIndex:G,items:u,isOver:E,isSorting:B,isDragging:U,listeners:R,node:_,overIndex:p,over:T,setNodeRef:$,setActivatorNodeRef:L,setDroppableNodeRef:A,setDraggableNodeRef:O,transform:Z??J,transition:(function(){if(Z||ne&&W.current.newIndex===k)return kx;if(!(te&&!sc(F)||!d)&&(B||X))return ua.Transition.toString({...d,property:Xu})})()}}function hs(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 Cx=[Ae.Down,Ae.Right,Ae.Up,Ae.Left],Nx=(t,e)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:s,over:a,scrollableAncestors:l}}=e;if(Cx.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=li(m),p=[];for(const g of b){const{id:y}=g,w=f.get(y);if(w){const k=li(w),N=x.reduce((C,_,E)=>C+ai(k[E],_),0),j=Number((N/4).toFixed(4));p.push({id:y,data:{droppableContainer:g,value:j}})}}return p.sort(ii)})({collisionRect:o,droppableRects:r,droppableContainers:c});let u=ci(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=rs(b).some((k,N)=>l[N]!==k),p=Zu(h,m),g=(function(k,N){return!hs(k)||!hs(N)||!Zu(k,N)?!1:k.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 Zu(t,e){return!(!hs(t)||!hs(e))&&t.data.current.sortable.containerId===e.data.current.sortable.containerId}const Sx=()=>{const t=z.c(21),{startupLogsAlert:e}=sg(),{clearStartupLogsAlert:n}=ag(),[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=je(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(Ca,{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(Gt,{className:"w-5 h-5"}),t[10]=x):x=t[10],t[11]!==l?(p=i.jsx(xe,{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,k;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?(k=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]=k):k=t[20],k},Ex=n4("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"}}),tr=t=>{const e=z.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=he(Ex({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},_x=t=>{const e=z.c(5),{children:n,className:o}=t;let r,s;return e[0]!==o?(r=he("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(jg,{className:r,children:n}),e[2]=n,e[3]=r,e[4]=s):s=e[4],s},Ix=t=>{const e=z.c(9),{connectionState:n,status:o}=t,{sendInterrupt:r}=We(),s=fu(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(zl,{strokeWidth:1.5}),e[4]=u):u=e[4],e[5]!==l||e[6]!==c||e[7]!==d?(h=i.jsx(tr,{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},nr=Bt(null),Ax=s1("marimo:ai:includeOtherCells",!0);function Tx(t){const e=new Map;for(const[n,o]of t.entries()){if(o.messages.length===0)continue;const r=o4(o.messages,s=>s.id);e.set(n,{...o,messages:r})}return e}Ta=s1("marimo:ai:chatState:v5",{chats:new Map,activeChatId:null},(wi={toSerializable:t=>({chats:[...Tx(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 wi.fromSerializable(o)}catch(n){return Je.warn(`Error getting ${t} from storage`,n),e}},setItem:(t,e)=>{localStorage.setItem(t,JSON.stringify(wi.toSerializable(e)))},removeItem:t=>{localStorage.removeItem(t)}}));var wi;gg=Bt(t=>{const e=t(Ta);return e.activeChatId?e.chats.get(e.activeChatId):null},(t,e,n)=>{e(Ta,o=>({...o,activeChatId:n}))});let eh;Rc="packages-install-input",eh=["%alias","%cd","%clear","%debug","%env","%load","%load_ext","%lsmagic","%matplotlib","%pwd","%who_ls","%system","%%time","%%timeit","%%writefile","%%capture","%%html","%%latex"];let ki;function Dx(){const t=async r=>{const s=Me.get(aa),{saveUserConfig:a}=c1(),l={...s,runtime:{...s.runtime,auto_reload:r}};await a({config:l}).then(()=>Me.set(aa,l))},e=()=>{requestAnimationFrame(()=>{const r=document.getElementById(Rc);r&&r.focus()})},n=[{match:"!pip install",onMatch:()=>{Me.set(cc,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:()=>{Me.set(cc,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:()=>{Me.set(cc,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."]})},...eh.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(),ki?ki.upsert({title:d.title,description:d.description}):ki=Be({title:d.title,description:d.description}))}})}const Mx=new Set(["Escape","Alt-`"]);function Ox(){const t=d1.filter(e=>!Mx.has(e.key));return Sn.highest(Vt.of([...t,{key:"Ctrl-y",run:e=>!!ha(e)&&u1(e)},{key:"Ctrl-n",run:e=>!!ha(e)&&ma(!0)(e)},{key:"Ctrl-p",run:e=>!!ha(e)&&ma(!1)(e)}]))}const ji=tt.define(),Ci=tt.define(),Ni=tt.define();function He(t,e){if(!t)throw new Error(e)}function ms(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 Si(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 th(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 nh=Symbol("@bufbuild/protobuf/enum-type");function Rx(t){const e=t[nh];return He(e,"missing enum type on enum object"),e}function oh(t,e,n,o){t[nh]=rh(e,n.map(r=>({no:r.no,name:r.name,localName:t[r.no]})))}function rh(t,e,n){const o=Object.create(null),r=Object.create(null),s=[];for(const a of e){const l=sh(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 Lx(t,e,n){const o={};for(const r of e){const s=sh(r);o[s.localName]=s.no,o[s.no]=s.localName}return oh(o,t,e),o}function sh(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 Fx(){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 Ei(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 fs=4294967296;function ah(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>=fs&&(r+=o/fs|0,o%=fs)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?lh(o,r):_i(o,r)}function ih(t,e){if({lo:t,hi:e}=(function(c,d){return{lo:c>>>0,hi:d>>>0}})(t,e),e<=2097151)return String(fs*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()+ch(s)+ch(r)}function _i(t,e){return{lo:0|t,hi:0|e}}function lh(t,e){return e=~e,t?t=1+~t:e+=1,_i(t,e)}const ch=t=>{const e=String(t);return"0000000".slice(e.length)+e};function dh(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 Bx(){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 Px={};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"||Px.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=>He(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),n=o=>He(/^[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),ah(o)),uEnc:o=>(typeof o!="string"&&(o=o.toString()),n(o),ah(o)),dec:(o,r)=>(function(s,a){let l=_i(s,a);const c=2147483648&l.hi;c&&(l=lh(l.lo,l.hi));const d=ih(l.lo,l.hi);return c?"-"+d:d})(o,r),uDec:(o,r)=>ih(o,r)}})();var H,Tn,Ye;function Dn(t,e,n){if(e===n)return!0;if(t==H.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 H.UINT64:case H.FIXED64:case H.INT64:case H.SFIXED64:case H.SINT64:return e==n}return!1}function fo(t,e){switch(t){case H.BOOL:return!1;case H.UINT64:case H.FIXED64:case H.INT64:case H.SFIXED64:case H.SINT64:return e==0?Ue.zero:"0";case H.DOUBLE:case H.FLOAT:return 0;case H.BYTES:return new Uint8Array(0);case H.STRING:return"";default:return 0}}function uh(t,e){switch(t){case H.BOOL:return e===!1;case H.STRING:return e==="";case H.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"})(H||(H={})),(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"})(Ye||(Ye={}));class zx{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(Si(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return ms(e),dh(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){th(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){Si(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){ms(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return ms(e),dh(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 Ei(n.lo,n.hi,this.buf),this}sint64(e){let n=Ue.enc(e),o=n.hi>>31;return Ei(n.lo<<1^o,(n.hi<<1|n.lo>>>31)^o,this.buf),this}uint64(e){let n=Ue.uEnc(e);return Ei(n.lo,n.hi,this.buf),this}}class Ux{constructor(e,n){this.varint64=Fx,this.uint32=Bx,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 Ye.Varint:for(;128&this.buf[this.pos++];);break;case Ye.Bit64:this.pos+=4;case Ye.Bit32:this.pos+=4;break;case Ye.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Ye.StartGroup:for(;;){const[s,a]=this.tag();if(a===Ye.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 hh(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(""),ps=[];for(let t=0;t<on.length;t++)ps[on[t].charCodeAt(0)]=t;ps[45]=on.indexOf("+"),ps[95]=on.indexOf("/");const gs={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=ps[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 Wx(t,e,n){fh(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]=hh(e);for(const l of r)e.runtime.bin.readField(s,o.readerFactory(l.data),e.field,l.wireType,o);return a()}function $x(t,e,n,o){fh(e,t);const r=e.runtime.bin.makeReadOptions(o),s=e.runtime.bin.makeWriteOptions(o);if(mh(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 mh(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 fh(t,e){He(t.extendee.typeName==e.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function ph(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:!uh(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function gh(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 bh(t,e){return rn(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}H.DOUBLE,H.FLOAT,H.INT64,H.UINT64,H.INT32,H.UINT32,H.BOOL,H.STRING,H.BYTES;const xh={ignoreUnknownFields:!1},yh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Vx(t){return t?Object.assign(Object.assign({},xh),t):xh}function Gx(t){return t?Object.assign(Object.assign({},yh),t):yh}const bs=Symbol(),xs=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 vh(t,e,n,o,r){let s=n.localName;if(n.repeated){if(He(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=Ii(n.T,l,o.ignoreUnknownFields,!0);c!==xs&&a.push(c);break;case"scalar":try{a.push(or(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=qx(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=Ii(n.V.T,c,o.ignoreUnknownFields,!0);u!==xs&&(a[d]=u);break;case"scalar":try{a[d]=or(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=Ii(n.T,e,o.ignoreUnknownFields,!1);switch(c){case bs:gh(n,t);break;case xs:break;default:t[s]=c}break;case"scalar":try{const d=or(n.T,e,n.L,!1);d===bs?gh(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 qx(t,e){if(t===H.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1}return or(t,e,Tn.BIGINT,!0).toString()}function or(t,e,n,o){if(e===null)return o?fo(t,n):bs;switch(t){case H.DOUBLE:case H.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==H.FLOAT&&th(r),r;case H.INT32:case H.FIXED32:case H.SFIXED32:case H.SINT32:case H.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==H.UINT32||t==H.FIXED32?Si(s):ms(s),s;case H.INT64:case H.SFIXED64:case H.SINT64:if(typeof e!="number"&&typeof e!="string")break;const a=Ue.parse(e);return n?a.toString():a;case H.FIXED64:case H.UINT64:if(typeof e!="number"&&typeof e!="string")break;const l=Ue.uParse(e);return n?l.toString():l;case H.BOOL:if(typeof e!="boolean")break;return e;case H.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case H.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return gs.dec(e)}throw new Error}function Ii(t,e,n,o){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:o?t.values[0].no:bs;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 xs}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${qt(e)}`)}function Hx(t){return!(!t.repeated&&t.kind!="map")||!t.oneof&&t.kind!="message"&&!t.opt&&!t.req}function wh(t,e,n){if(t.kind=="map"){He(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()]=ys(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()]=Ai(s,l,n.enumAsInteger)}return n.emitDefaultValues||r.length>0?o:void 0}if(t.repeated){He(Array.isArray(e));const o=[];switch(t.kind){case"scalar":for(let r=0;r<e.length;r++)o.push(ys(t.T,e[r]));break;case"enum":for(let r=0;r<e.length;r++)o.push(Ai(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 ys(t.T,e);case"enum":return Ai(t.T,e,n.enumAsInteger);case"message":return bh(t.T,e).toJson(n)}}function Ai(t,e,n){var o;if(He(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 ys(t,e){switch(t){case H.INT32:case H.SFIXED32:case H.SINT32:case H.FIXED32:case H.UINT32:return He(typeof e=="number"),e;case H.FLOAT:case H.DOUBLE:return He(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case H.STRING:return He(typeof e=="string"),e;case H.BOOL:return He(typeof e=="boolean"),e;case H.UINT64:case H.FIXED64:case H.INT64:case H.SFIXED64:case H.SINT64:return He(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case H.BYTES:return He(e instanceof Uint8Array),gs.enc(e)}}const po=Symbol("@bufbuild/protobuf/unknown-fields"),kh={readUnknownFields:!0,readerFactory:t=>new Ux(t)},jh={writeUnknownFields:!0,writerFactory:()=>new zx};function Jx(t){return t?Object.assign(Object.assign({},kh),t):kh}function Kx(t){return t?Object.assign(Object.assign({},jh),t):jh}function Ch(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"?H.INT32:n.T;let c=ws;if(n.kind=="scalar"&&n.L>0&&(c=Yx),s){let m=t[a];if(o==Ye.LengthDelimited&&l!=H.STRING&&l!=H.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(vs(e,new d,r,n)):rn(t[a])?vs(e,t[a],r,n):(t[a]=vs(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=ws(f,m.K);break;case 2:switch(m.V.kind){case"scalar":y=ws(f,m.V.T);break;case"enum":y=f.int32();break;case"message":y=vs(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 vs(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 Yx(t,e){const n=ws(t,e);return typeof n=="bigint"?n.toString():n}function ws(t,e){switch(e){case H.STRING:return t.string();case H.BOOL:return t.bool();case H.DOUBLE:return t.double();case H.FLOAT:return t.float();case H.INT32:return t.int32();case H.INT64:return t.int64();case H.UINT64:return t.uint64();case H.FIXED64:return t.fixed64();case H.BYTES:return t.bytes();case H.FIXED32:return t.fixed32();case H.SFIXED32:return t.sfixed32();case H.SFIXED64:return t.sfixed64();case H.SINT64:return t.sint64();case H.UINT32:return t.uint32();case H.SINT32:return t.sint32()}}function Nh(t,e,n,o){He(e!==void 0);const r=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?H.INT32:t.T;if(r)if(He(Array.isArray(e)),t.packed)(function(a,l,c,d){if(!d.length)return;a.tag(c,Ye.LengthDelimited).fork();let[,u]=Eh(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)rr(n,s,t.no,a);else rr(n,s,t.no,e);break;case"message":if(r){He(Array.isArray(e));for(const a of e)Sh(n,o,t,a)}else Sh(n,o,t,e);break;case"map":He(typeof e=="object"&&e!=null);for(const[a,l]of Object.entries(e))Xx(n,o,t,a,l)}}function Xx(t,e,n,o,r){t.tag(n.no,Ye.LengthDelimited),t.fork();let s=o;switch(n.K){case H.INT32:case H.FIXED32:case H.UINT32:case H.SFIXED32:case H.SINT32:s=Number.parseInt(o);break;case H.BOOL:He(o=="true"||o=="false"),s=o=="true"}switch(rr(t,n.K,1,s),n.V.kind){case"scalar":rr(t,n.V.T,2,r);break;case"enum":rr(t,H.INT32,2,r);break;case"message":He(r!==void 0),t.tag(2,Ye.LengthDelimited).bytes(r.toBinary(e))}t.join()}function Sh(t,e,n,o){const r=bh(n.T,o);n.delimited?t.tag(n.no,Ye.StartGroup).raw(r.toBinary(e)).tag(n.no,Ye.EndGroup):t.tag(n.no,Ye.LengthDelimited).bytes(r.toBinary(e))}function rr(t,e,n,o){He(o!==void 0);let[r,s]=Eh(e);t.tag(n,r)[s](o)}function Eh(t){let e=Ye.Varint;switch(t){case H.BYTES:case H.STRING:e=Ye.LengthDelimited;break;case H.DOUBLE:case H.FIXED64:case H.SFIXED64:e=Ye.Bit64;break;case H.FIXED32:case H.SFIXED32:case H.FLOAT:e=Ye.Bit32}return[e,H[t].toLowerCase()]}function ks(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 sr(t){return t instanceof Uint8Array?t:new Uint8Array(t)}class Qx{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 _h(t,e){const n=Ih(t);return e?n:o2(n2(n))}const Zx=Ih;function Ih(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 e2=new Set(["constructor","toString","toJSON","valueOf"]),t2=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),Ah=t=>`${t}$`,n2=t=>t2.has(t)?Ah(t):t,o2=t=>e2.has(t)?Ah(t):t;class r2{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=_h(e,!1)}addField(e){He(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 Q=(Th=t=>new Qx(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=_h(h.name,h.oneof!==void 0),m.jsonName=(o=h.jsonName)!==null&&o!==void 0?o:Zx(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!=H.BYTES&&h.T!=H.STRING),h.oneof!==void 0){const f=typeof h.oneof=="string"?h.oneof:h.oneof.name;u&&u.name==f||(u=new r2(f)),m.oneof=u,u.addField(m)}d.push(m)}return d})(e)),Dh=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:Vx,makeWriteOptions:Gx,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)}vh(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]=hh(u);vh(h,l,u.field,n,u),$x(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(!ph(r,t)){if(r.req)throw"required field not set";if(!e.emitDefaultValues||!Hx(r))continue}const a=wh(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&&mh(t,l)){const c=Wx(t,l,e),d=wh(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)=>or(t,e,n??Tn.BIGINT,!0),writeScalar(t,e,n){if(e!==void 0)return n||uh(t,e)?ys(t,e):void 0},debug:qt},bin:{makeReadOptions:Jx,makeWriteOptions:Kx,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!=Ye.EndGroup);){const d=s.fields.find(l);if(!d){const u=e.skip(c,l);o.readUnknownFields&&this.onUnknownField(t,l,c,u);continue}Ch(t,e,d,c,o)}if(r&&(c!=Ye.EndGroup||l!==n))throw new Error("invalid end group tag")},readField:Ch,writeMessage(t,e,n){const o=t.getType();for(const r of o.fields.byNumber())if(ph(r,t))Nh(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&&Nh(t,e,n,o)}},util:Object.assign(Object.assign({},{setEnumType:oh,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===H.BYTES&&(d=sr(d)),s[r]={case:l,value:d};break;case"scalar":case"enum":let u=a[r];o.T===H.BYTES&&(u=o.repeated?u.map(sr):sr(u)),s[r]=u;break;case"map":switch(o.V.kind){case"scalar":case"enum":if(o.V.T===H.BYTES)for(const[f,b]of Object.entries(a[r]))s[r][f]=sr(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]=sr(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(H.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(H.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(H.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(H.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(ks);else if(r.kind=="map"){a=o[r.localName];for(const[l,c]of Object.entries(s))a[l]=ks(c)}else a=r.kind=="oneof"?r.findField(s.case)?{case:s.case,value:ks(s.value)}:{case:void 0}:ks(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:Th,initFields:Dh}),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:Lx,makeEnumType:rh,getEnumType:Rx,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 Th,Dh,It,Ti,js,ar,Cs,ir,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"})(Ti||(Ti={})),(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.JUPYTER_FORMAT=77]="JUPYTER_FORMAT"})(js||(js={})),Q.util.setEnumType(js,"exa.codeium_common_pb.ExperimentKey",[{no:0,name:"UNSPECIFIED"},{no:77,name:"JUPYTER_FORMAT"}]),(function(t){t[t.CODEIUM=0]="CODEIUM"})(ar||(ar={})),Q.util.setEnumType(ar,"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"})(Cs||(Cs={})),Q.util.setEnumType(Cs,"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"})(ir||(ir={})),Q.util.setEnumType(ir,"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={})),Q.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();P(this,"completionId","");P(this,"text","");P(this,"prefix","");P(this,"stop","");P(this,"score",0);P(this,"tokens",[]);P(this,"decodedTokens",[]);P(this,"probabilities",[]);P(this,"adjustedProbabilities",[]);P(this,"generatedLength",Ue.zero);Q.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 Q.util.equals(an,n,o)}};P(an,"runtime",Q),P(an,"typeName","exa.codeium_common_pb.Completion"),P(an,"fields",Q.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 Di=an;const ln=class ln extends Xe{constructor(n){super();P(this,"ideName","");P(this,"ideVersion","");P(this,"extensionName","");P(this,"extensionVersion","");P(this,"apiKey","");P(this,"locale","");P(this,"sessionId","");P(this,"requestId",Ue.zero);P(this,"userAgent","");P(this,"url","");P(this,"authSource",ar.CODEIUM);Q.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 Q.util.equals(ln,n,o)}};P(ln,"runtime",Q),P(ln,"typeName","exa.codeium_common_pb.Metadata"),P(ln,"fields",Q.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:Q.getEnumType(ar)}]));let Ns=ln;const cn=class cn extends Xe{constructor(n){super();P(this,"tabSize",Ue.zero);P(this,"insertSpaces",!1);Q.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 Q.util.equals(cn,n,o)}};P(cn,"runtime",Q),P(cn,"typeName","exa.codeium_common_pb.EditorOptions"),P(cn,"fields",Q.util.newFieldList(()=>[{no:1,name:"tab_size",kind:"scalar",T:4},{no:2,name:"insert_spaces",kind:"scalar",T:8}]));let Mi=cn;Q.util.newFieldList(()=>[{no:1,name:"event_type",kind:"enum",T:Q.getEnumType(Cs)},{no:2,name:"event_json",kind:"scalar",T:9},{no:3,name:"timestamp_unix_ms",kind:"scalar",T:3}]);class s2 extends So{constructor(n,o){super();P(this,"index");P(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 Ss=ro.define({combine:t=>Hs(t,{language:Mn.TYPESCRIPT,timeout:150,widgetClass:s2,alwaysOn:!0},{})}),Mh=ro.define({combine:t=>Hs(t,{override:()=>[]},{})}),a2=Te.mark({class:"cm-ghostText"}),Qn=Dt.define({create:t=>null,update(t,e){var o;const n=e.state.facet(Ss);for(const r of e.effects){if(r.is(ji)){const{changeSpecs:s,index:a}=r.value,l=s[a].map(d=>a2.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(Ci)||r.is(Ni))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=dc.define(),Es=dc.define();var ze;function Oi(t){const e=ze[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}let _s;(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"})(ze||(ze={}));class Qe extends Error{constructor(e,n=ze.Unknown,o,r,s){super((function(a,l){return a.length?`[${Oi(l)}] ${a}`:`[${Oi(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=ze.Unknown){return e instanceof Qe?e:e instanceof Error?e.name=="AbortError"?new Qe(e.message,ze.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 i2=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)})}}},lr=function(t){return this instanceof lr?(this.v=t,this):new lr(t)},l2=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 lr?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])}},c2=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:lr(t[r](a)),done:!1}:s?s(a):a}:s}},Oh=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)},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:bo(t[r](a)),done:!1}:s?s(a):a}:s}},u2=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 h2(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 Rh(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 l2(this,arguments,function*(){yield lr(yield*c2(i2(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=Oh(b.message);!(c=(g=await w.next()).done);y=!0)h=g.value,y=!1,x=h,p++}catch(k){d={error:k}}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",ze.Unimplemented);if(p>1)throw new Qe("protocol error: received extra messages for client streaming method",ze.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 Rh(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 Rh(t,e){const n=(function(){return u2(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*d2(Oh(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 Lh(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 Fh(){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 Bh(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 Ph(t,e){return e instanceof t?e:new t(e)}function m2(t,e){function n(o){return o.done===!0?o:{done:o.done,value:Ph(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 zh(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 Uh(t){var e;const n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function Wh(t,e,n,o){const r=e?$h(t.I,o):Vh(t.I,n);return{parse:(e?$h(t.O,o):Vh(t.O,n)).parse,serialize:r.serialize}}function $h(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}`,ze.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}`,ze.Internal)}}}}function Vh(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=Uh(e);return{parse(l){try{const c=s.decode(l);return t.fromJsonString(c,a)}catch(c){throw Qe.from(c,ze.InvalidArgument)}},serialize(l){try{const c=l.toJsonString(a);return r.encode(c)}catch(c){throw Qe.from(c,ze.Internal)}}}}const f2=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function Gh(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(!_s){_s={};for(const c of Object.values(ze))typeof c!="string"&&(_s[Oi(c)]=c)}return _s[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:gs.dec(l.value),debug:l.debug})}catch{throw n}}return a}function p2(t){const e=new Qe("invalid end stream",ze.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?Gh(n.error,o,e):void 0}}const Is="Content-Type",g2="Content-Length",qh="Content-Encoding",b2="Accept-Encoding",Hh="Connect-Protocol-Version";function Jh(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 Kh(t,e,n,o,r){const s=new Headers(o??{});return n!==void 0&&s.set("Connect-Timeout-Ms",`${n}`),s.set(Is,t==It.Unary?e?"application/proto":"application/json":e?"application/connect+proto":"application/connect+json"),s.set(Hh,"1"),s}function Yh(t,e,n,o){const r=o.get(Is),s=(function(c){const d=c==null?void 0:c.match(f2);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 ze.Internal;case 401:return ze.Unauthenticated;case 403:return ze.PermissionDenied;case 404:return ze.Unimplemented;case 429:case 502:case 503:case 504:return ze.Unavailable;default:return ze.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?ze.Unknown:ze.Internal,o);return{isUnaryError:!1}}const x2="application/";function y2(t,e,n){let o="?connect=v1";const r=t.header.get(Is);(r==null?void 0:r.indexOf(x2))===0&&(o+="&encoding="+encodeURIComponent(r.slice(12)));const s=t.header.get(qh);s!==null&&s!=="identity"&&(o+="&compression="+encodeURIComponent(s),n=!0),n&&(o+="&base64=1"),o+="&message="+(function(c,d){return d?gs.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[Hh,Is,g2,qh,b2].forEach(c=>l.delete(c)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:a,header:l})}function Xh(t){const{signal:e,cleanup:n}=(function(r){const s=new AbortController,a=()=>{s.abort(new Qe("the operation timed out",ze.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(Lh(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?Lh(e):r);return o.abort(s),n(),Promise.reject(s)},function(){n(),o.abort()}]}var cr,Ri,dr;(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"})(cr||(cr={})),Q.util.setEnumType(cr,"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"})(Ri||(Ri={})),Q.util.setEnumType(Ri,"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"})(dr||(dr={})),Q.util.setEnumType(dr,"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();P(this,"threshold",0);Q.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 Q.util.equals(dn,n,o)}};P(dn,"runtime",Q),P(dn,"typeName","exa.language_server_pb.MultilineConfig"),P(dn,"fields",Q.util.newFieldList(()=>[{no:1,name:"threshold",kind:"scalar",T:2}]));let Li=dn;const un=class un extends Xe{constructor(n){super();P(this,"metadata");P(this,"document");P(this,"editorOptions");P(this,"otherDocuments",[]);P(this,"experimentConfig");P(this,"modelName","");P(this,"multilineConfig");Q.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 Q.util.equals(un,n,o)}};P(un,"runtime",Q),P(un,"typeName","exa.language_server_pb.GetCompletionsRequest"),P(un,"fields",Q.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ns},{no:2,name:"document",kind:"message",T:As},{no:3,name:"editor_options",kind:"message",T:Mi},{no:5,name:"other_documents",kind:"message",T:As,repeated:!0},{no:7,name:"experiment_config",kind:"message",T:$i},{no:10,name:"model_name",kind:"scalar",T:9},{no:13,name:"multiline_config",kind:"message",T:Li}]));let Fi=un;const hn=class hn extends Xe{constructor(n){super();P(this,"state");P(this,"completionItems",[]);Q.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 Q.util.equals(hn,n,o)}};P(hn,"runtime",Q),P(hn,"typeName","exa.language_server_pb.GetCompletionsResponse"),P(hn,"fields",Q.util.newFieldList(()=>[{no:1,name:"state",kind:"message",T:Vi},{no:2,name:"completion_items",kind:"message",T:Ji,repeated:!0}]));let Bi=hn;const mn=class mn extends Xe{constructor(n){super();P(this,"metadata");P(this,"completionId","");Q.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 Q.util.equals(mn,n,o)}};P(mn,"runtime",Q),P(mn,"typeName","exa.language_server_pb.AcceptCompletionRequest"),P(mn,"fields",Q.util.newFieldList(()=>[{no:1,name:"metadata",kind:"message",T:Ns},{no:2,name:"completion_id",kind:"scalar",T:9}]));let Pi=mn;const fn=class fn extends Xe{constructor(e){super(),Q.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 Q.util.equals(fn,e,n)}};P(fn,"runtime",Q),P(fn,"typeName","exa.language_server_pb.AcceptCompletionResponse"),P(fn,"fields",Q.util.newFieldList(()=>[]));let zi=fn;const pn=class pn extends Xe{constructor(e){super(),Q.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 Q.util.equals(pn,e,n)}};P(pn,"runtime",Q),P(pn,"typeName","exa.language_server_pb.GetAuthTokenRequest"),P(pn,"fields",Q.util.newFieldList(()=>[]));let Ui=pn;const gn=class gn extends Xe{constructor(n){super();P(this,"authToken","");P(this,"uuid","");Q.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 Q.util.equals(gn,n,o)}};P(gn,"runtime",Q),P(gn,"typeName","exa.language_server_pb.GetAuthTokenResponse"),P(gn,"fields",Q.util.newFieldList(()=>[{no:1,name:"auth_token",kind:"scalar",T:9},{no:2,name:"uuid",kind:"scalar",T:9}]));let Wi=gn;const bn=class bn extends Xe{constructor(n){super();P(this,"row",Ue.zero);P(this,"col",Ue.zero);Q.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 Q.util.equals(bn,n,o)}};P(bn,"runtime",Q),P(bn,"typeName","exa.language_server_pb.DocumentPosition"),P(bn,"fields",Q.util.newFieldList(()=>[{no:1,name:"row",kind:"scalar",T:4},{no:2,name:"col",kind:"scalar",T:4}]));let ur=bn;const xn=class xn extends Xe{constructor(n){super();P(this,"absolutePath","");P(this,"relativePath","");P(this,"text","");P(this,"editorLanguage","");P(this,"language",Mn.UNSPECIFIED);P(this,"cursorOffset",Ue.zero);P(this,"cursorPosition");P(this,"lineEnding","");Q.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 Q.util.equals(xn,n,o)}};P(xn,"runtime",Q),P(xn,"typeName","exa.language_server_pb.Document"),P(xn,"fields",Q.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:Q.getEnumType(Mn)},{no:6,name:"cursor_offset",kind:"scalar",T:4},{no:8,name:"cursor_position",kind:"message",T:ur},{no:7,name:"line_ending",kind:"scalar",T:9}]));let As=xn;const yn=class yn extends Xe{constructor(n){super();P(this,"forceEnableExperiments",[]);Q.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 Q.util.equals(yn,n,o)}};P(yn,"runtime",Q),P(yn,"typeName","exa.language_server_pb.ExperimentConfig"),P(yn,"fields",Q.util.newFieldList(()=>[{no:1,name:"force_enable_experiments",kind:"enum",T:Q.getEnumType(js),repeated:!0}]));let $i=yn;const vn=class vn extends Xe{constructor(n){super();P(this,"state",cr.UNSPECIFIED);P(this,"message","");Q.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 Q.util.equals(vn,n,o)}};P(vn,"runtime",Q),P(vn,"typeName","exa.language_server_pb.State"),P(vn,"fields",Q.util.newFieldList(()=>[{no:1,name:"state",kind:"enum",T:Q.getEnumType(cr)},{no:2,name:"message",kind:"scalar",T:9}]));let Vi=vn;const wn=class wn extends Xe{constructor(n){super();P(this,"startOffset",Ue.zero);P(this,"endOffset",Ue.zero);P(this,"startPosition");P(this,"endPosition");Q.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 Q.util.equals(wn,n,o)}};P(wn,"runtime",Q),P(wn,"typeName","exa.language_server_pb.Range"),P(wn,"fields",Q.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:ur},{no:4,name:"end_position",kind:"message",T:ur}]));let Gi=wn;const kn=class kn extends Xe{constructor(n){super();P(this,"text","");P(this,"deltaCursorOffset",Ue.zero);Q.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 Q.util.equals(kn,n,o)}};P(kn,"runtime",Q),P(kn,"typeName","exa.language_server_pb.Suffix"),P(kn,"fields",Q.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"delta_cursor_offset",kind:"scalar",T:3}]));let qi=kn;const jn=class jn extends Xe{constructor(n){super();P(this,"text","");P(this,"offset",Ue.zero);P(this,"type",dr.UNSPECIFIED);P(this,"prefix","");P(this,"line",Ue.zero);Q.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 Q.util.equals(jn,n,o)}};P(jn,"runtime",Q),P(jn,"typeName","exa.language_server_pb.CompletionPart"),P(jn,"fields",Q.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:Q.getEnumType(dr)},{no:4,name:"prefix",kind:"scalar",T:9},{no:5,name:"line",kind:"scalar",T:4}]));let Hi=jn;const Cn=class Cn extends Xe{constructor(n){super();P(this,"completion");P(this,"suffix");P(this,"range");P(this,"source",ir.UNSPECIFIED);P(this,"completionParts",[]);Q.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 Q.util.equals(Cn,n,o)}};P(Cn,"runtime",Q),P(Cn,"typeName","exa.language_server_pb.CompletionItem"),P(Cn,"fields",Q.util.newFieldList(()=>[{no:1,name:"completion",kind:"message",T:Di},{no:5,name:"suffix",kind:"message",T:qi},{no:2,name:"range",kind:"message",T:Gi},{no:3,name:"source",kind:"enum",T:Q.getEnumType(ir)},{no:8,name:"completion_parts",kind:"message",T:Hi,repeated:!0}]));let Ji=Cn;const v2={typeName:"exa.language_server_pb.LanguageServerService",methods:{getCompletions:{name:"GetCompletions",I:Fi,O:Bi,kind:It.Unary},acceptCompletion:{name:"AcceptCompletion",I:Pi,O:zi,kind:It.Unary},getAuthToken:{name:"GetAuthToken",I:Ui,O:Wi,kind:It.Unary}}};var hr=function(t){return this instanceof hr?(this.v=t,this):new hr(t)},w2=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 hr?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 k2=(function(t,e){return h2(t,e)})(v2,(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}=Wh(r,n,t.jsonOptions,t.binaryOptions);return a=a===void 0?t.defaultTimeoutMs:a<=0?void 0:a,await(function(f){const b=zh(f.next,f.interceptors),[x,p,g]=Xh(f);return b(Object.assign(Object.assign({},f.req),{message:Ph(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:Bh(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:Kh(r.kind,n,a,l),contextValues:d??Fh(),message:c},next:async f=>{var b;let x=null;t.useHttpGet===!0&&r.idempotency===Ti.NoSideEffects?f=y2(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}=Yh(r.kind,n,g.status,g.headers);if(y)throw Gh(await g.json(),(function(...j){const C=new Headers;for(const _ of j)_.forEach((E,A)=>{C.append(A,E)});return C})(...Jh(g.headers)),w);const[k,N]=Jh(g.headers);return{stream:!1,service:o,method:r,header:k,message:n?m(new Uint8Array(await g.arrayBuffer())):r.O.fromJson(await g.json(),Uh(t.jsonOptions)),trailer:N}}})},async stream(o,r,s,a,l,c,d){var u;const{serialize:h,parse:m}=Wh(r,n,t.jsonOptions,t.binaryOptions);function f(x,p,g,y){return w2(this,arguments,function*(){const w=(function(N){let j,C=new Uint8Array(0);function _(E){const A=new Uint8Array(C.length+E.length);A.set(C),A.set(E,C.length),C=A}return new ReadableStream({start(){j=N.getReader()},async pull(E){let A;for(;;){if(A===void 0&&C.byteLength>=5){let D=0;for(let M=1;M<5;M++)D=(D<<8)+C[M];A={flags:C[0],length:D}}if(A!==void 0&&C.byteLength>=A.length+5)break;const F=await j.read();if(F.done)break;_(F.value)}if(A===void 0)return C.byteLength==0?void E.close():void E.error(new Qe("premature end of stream",ze.DataLoss));const I=C.subarray(5,5+A.length);C=C.subarray(5+A.length),E.enqueue({flags:A.flags,data:I})}})})(x).getReader();let k=!1;for(;;){const N=yield hr(w.read());if(N.done)break;const{flags:j,data:C}=N.value;if(!(1&~j))throw new Qe("protocol error: received unsupported compressed output",ze.Internal);if(!(2&~j)){k=!0;const _=p2(C);if(_.error){const E=_.error;throw g.forEach((A,I)=>{E.metadata.append(I,A)}),E}_.metadata.forEach((E,A)=>p.set(A,E));continue}yield yield hr(m(C))}if("throwIfAborted"in y&&y.throwIfAborted(),!k)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 k=new DataView(w.buffer,w.byteOffset,w.byteLength);return k.setUint8(0,g),k.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=zh(x.next,x.interceptors),[g,y,w]=Xh(x),k=Object.assign(Object.assign({},x.req),{message:m2(x.req.method.I,x.req.message),signal:g});let N=!1;return g.addEventListener("abort",function(){var j,C;const _=x.req.message[Symbol.asyncIterator]();N||(j=_.throw)===null||j===void 0||j.call(_,this.reason).catch(()=>{}),(C=_.return)===null||C===void 0||C.call(_).catch(()=>{})}),p(k).then(j=>Object.assign(Object.assign({},j),{message:{[Symbol.asyncIterator](){const C=j.message[Symbol.asyncIterator]();return{next:()=>C.next().then(_=>(_.done==1&&(N=!0,w()),_),y)}}}}),y)})({interceptors:t.interceptors,timeoutMs:a,signal:s,req:{stream:!0,service:o,method:r,url:Bh(t.baseUrl,o,r),init:{method:"POST",credentials:(u=t.credentials)!==null&&u!==void 0?u:"same-origin",redirect:"error",mode:"cors"},header:Kh(r.kind,n,a,l),contextValues:d??Fh(),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(Yh(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 Ts;try{Ts=crypto.randomUUID()}catch{Ts="10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>+t/4).toString(16))}async function j2(t,e){const n=t.state.facet(Ss),{override:o}=t.state.facet(Mh),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 k2.getCompletions({metadata:{ideName:"web",ideVersion:"0.0.5",extensionName:"@valtown/codemirror-codeium",extensionVersion:"1.0.0",apiKey:p.apiKey,sessionId:Ts,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}-${Ts}`}})})({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:ji.of({index:u,reverseChangeSet:f,changeSpecs:d}),annotations:[Es.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 C2(){let t=null,e=0;return Se.updateListener.of(n=>{const o=n.view.state.facet(Ss);if(!o.alwaysOn||!(function(s){return s.docChanged&&!s.transactions.some(a=>a.effects.some(l=>l.is(Ci)||l.is(Ni)))})(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 r4(n.view.state,r,!1))||(t=setTimeout(async()=>{r===e&&await j2(n.view,e)},o.timeout),e=r)})}function Qh(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:Ci.of(null),annotations:[Es.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 Zh=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:ji.of({index:r,reverseChangeSet:c,changeSpecs:o}),annotations:[Es.of(null),go.of(null),Tr.addToHistory.of(!1)]}),!0};function Ki(t){const e=t.state.field(Qn);return!!e&&(t.dispatch({changes:e.reverseChangeSet,effects:Ni.of(null),annotations:[Es.of(null),go.of(null),Tr.addToHistory.of(!1)]}),!1)}function N2(){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"?Qh(n):Ki(n))})(e,t.key),mouseup(t,e){const n=t.target;return n.nodeName==="BUTTON"&&n.dataset.action==="codeium-cycle"?(Zh(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)?Qh(e):Ki(e)}})}const S2=new hc,Yi=Je.get("@github/copilot-language-server"),em={delay:300,includeKeymap:!0,events:{shouldShowSuggestion:t=>t.hasFocus,beforeSuggestionFetch:t=>t.hasFocus}},E2=t=>{const e=[];return t.copilot==="codeium"&&t.codeium_api_key&&e.push((function(n){return[Ss.of(n),Qn,Sn.highest(Vt.of([{key:"Ctrl-]",run:Zh}])),Sn.highest(Se.updateListener.of(o=>{o.focusChanged&&Ki(o.view)})),Sn.high(N2()),C2()]})({apiKey:t.codeium_api_key,language:Mn.PYTHON}),Mh.of({override:async()=>[{text:uc(""),language:Mn.PYTHON,editorLanguage:"python"}]})),t.copilot==="github"&&e.push(Td({...em,fetchFn:async(n,o,r)=>{const s=n.selection.main.head;if(!cC()||!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://${dC}`,version:"replace_me"},position:b,context:{triggerKind:a4.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:u.tabSize,insertSpaces:!0}}})(n,uc(a)),c=await K1().getCompletion(l);return s!==r.state.selection.main.head?(Je.debug("ignoring response because of new position"),""):(function(u,h,m){if(!u)return Yi.debug("No response from copilot"),"";const f=Array.isArray(u)?u[0]:u.items[0];if(!f)return Yi.debug("No response from copilot"),"";const{insertText:b,range:x}=f,p=String(b);if(!x)return Yi.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 k=0;k<y.length;k++){const N=y.slice(k);if(w.startsWith(N))return y.slice(0,k)}return y})(c,l.position,n)}})),t.copilot==="custom"&&e.push(Td({...em,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(fa).type;let d=await s4.post("/ai/inline_completion",{prefix:a,suffix:l,language:c});return s!==r.state.selection.main.head?(Je.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(Vt.of([{key:"Escape",run:n=>{const o=Ad(n);return!ha(n)&&o}}])),S2.of(lC())]};function _2(t){return[Vt.of([{key:"Escape",preventDefault:!1,run:W0},{key:t.getHotkey("cell.selectNextOccurrence").key,preventDefault:!0,run:l4},{key:t.getHotkey("cell.findAndReplace").key,preventDefault:!0,run:iu}]),i4(),J0,es,K0]}const I2=Te.mark({class:"underline"}),tm=tt.define(),nm=tt.define(),om=tt.define(),A2=Dt.define({create:()=>Te.none,update(t,e){let n=t.map(e.changes);for(const o of e.effects)o.is(tm)?n=t.update({add:[I2.range(o.value.from,o.value.to)]}):o.is(nm)?n=t.update({add:[c4.range(o.value.from,o.value.to)]}):o.is(om)&&(n=Te.none);return n},provide:t=>Se.decorations.from(t)});class T2{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(d4,!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:nm.of(this.hoveredRange)}))}const l=u4(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:tm.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:om.of(null)}),this.hoveredRange=null)}}function D2(){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 k=w.split(`
110
- `);if(k.length===0)return"";const N=k.filter(_=>_.trim().length>0);if(N.length===0)return"";const j=/^\s*/,C=Math.min(...N.map(_=>{var E;return((E=_.match(j))==null?void 0:E[0].length)??Number.POSITIVE_INFINITY}));return C===0?w.trim():k.map(_=>_.slice(C)).join(`
111
- `).trim()})(c.join(`
112
- `))),c=[]}}for(const w of l){const k=w.trim();(k||d)&&(k.startsWith("@app.cell")?(y(),d=!0,u=1):u>0?(k.startsWith("def")&&k.includes("(")&&!k.includes("):")&&(h=!0,f=g(k)),u--):h?(f+=g(k),f===0&&(h=!1)):d&&(p.has(k[0])||k.startsWith("if __name__")?(y(),d=k.startsWith("@")):k.startsWith("return")?k.includes("(")&&!k.endsWith(")")&&(m=!0,f=g(k)):m?(f+=g(k),f===0&&(m=!1)):c.push(w)))}return y(),a})(n);return o.length===0?!1:(e.state.facet(p4).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=g4.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 M2=[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"}})],O2=[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 rm(t){const{showPlaceholder:e,enableAI:n}=t;return e?"marimo-import":n?"ai":"none"}const R2=t=>{const{cellId:e,keymapConfig:n,hotkeys:o,enableAI:r,cellActions:s,completionConfig:a,lspConfig:l,diagnosticsConfig:c,displayConfig:d}=t,u=rm(t);return[uC(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(),m4(f,b),!0;if(b!=null&&b.type.startsWith("image/"))return m.preventDefault(),f4(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()}})],D2(),Dx(),b4({completionConfig:a,hotkeys:o,placeholderType:u,lspConfig:l,diagnosticsConfig:c}),x4({cellId:e,hotkeys:o,cellActions:s}),L2(t),[A2,(h=(m,f)=>{h4(m,f)},$t.define(m=>new T2(m,h))),Se.baseTheme({".underline":{textDecoration:"underline",cursor:"pointer",color:"var(--link)"}})],c!=null&&c.enabled?y4():[],r&&Xs("inline_ai_tooltip")?[Bg({prompt:m=>(async function(f){var k,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=((k=f.selection.match(/^\s*/))==null?void 0:k[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:j,value:C}=await y.read();if(j)break;w+=new TextDecoder().decode(C)}return w.startsWith(g)||(w=g+w),w})({prompt:m.prompt,selection:m.selection,codeBefore:m.codeBefore,codeAfter:m.codeAfter,language:wp(m.editorView)})}),Va.of({hideOnBlur:!0})]:[],v4(Me),w4(e,d.reference_highlighting??!1)];var h},L2=t=>{const{theme:e,hotkeys:n,completionConfig:o,cellId:r,lspConfig:s,diagnosticsConfig:a}=t,l=rm(t);return[Se.lineWrapping,k4(),j4(),C4(),N4(),S4(),E4(),_4(),I4({position:"fixed",parent:document.querySelector("#App")??void 0}),A4(),e==="dark"?M2:O2,T4(s),E2(o),D4(),M4(),Ox(),Sn.high(Vt.of(P4)),O4(),R4(),L4.of(" "),h1(z4,{fallback:!0}),Vt.of(U4),F4({placeholderType:l,completionConfig:o,hotkeys:n,cellId:r,lspConfig:{...s,diagnostics:a}}),B4.of(W4()),Dr.allowMultipleSelections.of(!0),_2(n),Vt.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()!==""&&q4(d)})(c)||$4(c),preventDefault:!0},{key:n.getHotkey("completion.moveDown").key,run:c=>Fo(c.state)!==null&&(ma(!0)(c),!0),preventDefault:!0},{key:n.getHotkey("completion.moveUp").key,run:c=>Fo(c.state)!==null&&(ma(!1)(c),!0),preventDefault:!0}]),Vt.of([...V4,G4])]},F2={width:void 0,height:void 0};function sm(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 mr=t=>{const e=z.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 am,im,lm,cm;am=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),im=new Intl.DateTimeFormat("en-US",{month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,hour12:!0}),lm=t=>{const e=z.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(cm,{lastRanTime:m}):null,e[0]=m,e[1]=f):f=e[1];const b=f;if(r&&o==="running")return Je.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(mr,{children:[i.jsx($e,{className:"h-5 w-5",strokeWidth:1.5}),i.jsx(fc,{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($e,{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(mr,{layerTop:!0,children:[i.jsx(zc,{className:"h-5 w-5",strokeWidth:1.5}),i.jsx($e,{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(mr,{children:[i.jsx(fc,{className:"h-5 w-5",strokeWidth:1}),i.jsx($e,{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=mc.fromSeconds(d)||mc.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(B2,{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(Na,{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(Ea,{elapsedTime:p}):null,e[44]=c,e[45]=p,e[46]=g):g=e[46];const y=g;let w,k,N,j,C,_="";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")?(k=i.jsx("div",{className:"cell-status-stale","data-testid":"cell-status","data-status":"outdated",children:i.jsx(fc,{className:"h-5 w-5",strokeWidth:1.5})}),e[53]=k):k=e[53],e[54]!==w?(N=i.jsx(pe,{content:w,usePortal:!0,children:k}),e[54]=w,e[55]=N):N=e[55],e[56]!==c||e[57]!==p||e[58]!==b||e[59]!==_?(j=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]=j):j=e[60],e[61]!==N||e[62]!==j?(C=i.jsxs("div",{className:"cell-status-icon flex items-center gap-2",children:[N,j]}),e[61]=N,e[62]=j,e[63]=C):C=e[63],C}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(Ea,{elapsedTime:p}):null,e[66]=c,e[67]=p,e[68]=g):g=e[68];const y=g;let w,k,N,j;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?(k=i.jsxs("div",{className:"flex flex-col gap-1",children:[w,b]}),e[71]=b,e[72]=w,e[73]=k):k=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]!==k||e[77]!==N?(j=i.jsx(pe,{content:k,usePortal:!0,children:N}),e[76]=k,e[77]=N,e[78]=j):j=e[78],j}return null},Ea=t=>{const e=z.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},cm=t=>{const e=z.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()?am:im;a="Ran at",l=" ",c=i.jsx("strong",{className:"tracking-wide font-semibold",children:b.format(m)}),d=" ",o="text-muted-foreground",r="(",s=wg(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 B2=t=>{const e=z.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(mc.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 Xi="ContextMenu",[P2,BC]=K4(Xi,[m1]),yt=m1(),[z2,dm]=P2(Xi),um=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:o,dir:r,modal:s=!0}=t,[a,l]=S.useState(!1),c=yt(e),d=l3(o),u=S.useCallback(h=>{l(h),d(h)},[d]);return i.jsx(z2,{scope:e,open:a,onOpenChange:u,modal:s,children:i.jsx(c3,{...c,dir:r,open:a,onOpenChange:u,modal:s,children:n})})};um.displayName=Xi;var hm="ContextMenuTrigger",mm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:o=!1,...r}=t,s=dm(hm,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(Y4,{...a,virtualRef:c}),i.jsx(X4.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,Ds(m=>{u(),d.current=window.setTimeout(()=>h(m),700)})),onPointerMove:o?t.onPointerMove:Mr(t.onPointerMove,Ds(u)),onPointerCancel:o?t.onPointerCancel:Mr(t.onPointerCancel,Ds(u)),onPointerUp:o?t.onPointerUp:Mr(t.onPointerUp,Ds(u))})]})});mm.displayName=hm;var fm=t=>{const{__scopeContextMenu:e,...n}=t,o=yt(e);return i.jsx(d3,{...o,...n})};fm.displayName="ContextMenuPortal";var pm="ContextMenuContent",gm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=dm(pm,n),s=yt(n),a=S.useRef(!1);return i.jsx(Q4,{...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)"}})});gm.displayName=pm,S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(Z4,{...r,...o,ref:e})}).displayName="ContextMenuGroup";var bm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(e3,{...r,...o,ref:e})});bm.displayName="ContextMenuLabel";var xm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(J4,{...r,...o,ref:e})});xm.displayName="ContextMenuItem";var ym=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(t3,{...r,...o,ref:e})});ym.displayName="ContextMenuCheckboxItem",S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(n3,{...r,...o,ref:e})}).displayName="ContextMenuRadioGroup";var vm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(o3,{...r,...o,ref:e})});vm.displayName="ContextMenuRadioItem";var wm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(r3,{...r,...o,ref:e})});wm.displayName="ContextMenuItemIndicator";var km=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(H4,{...r,...o,ref:e})});km.displayName="ContextMenuSeparator",S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(s3,{...r,...o,ref:e})}).displayName="ContextMenuArrow";var jm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(a3,{...r,...o,ref:e})});jm.displayName="ContextMenuSubTrigger";var Cm=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...o}=t,r=yt(n);return i.jsx(i3,{...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 Ds(t){return e=>e.pointerType!=="mouse"?t(e):void 0}Cm.displayName="ContextMenuSubContent";var Nm=gm,Sm=bm,Em=xm,_m=ym,Im=vm,Am=wm,Tm=km,Dm=jm,Mm=Cm;const Om=um,Rm=mm,U2=h3(fm);S.forwardRef((t,e)=>{const n=z.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=m3({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(g3,{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(Dm,{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=Dm.displayName;const Lm="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=z.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=he(p1({subcontent:!0}),Lm,o),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=i.jsx(Mm,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a}).displayName=Mm.displayName;const Qi=S.forwardRef((t,e)=>{const n=z.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=he(p1(),Lm,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(U2,{children:i.jsx(f3,{children:i.jsx(Nm,{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});Qi.displayName=Nm.displayName;const fr=S.forwardRef((t,e)=>{const n=z.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(Em,{ref:e,className:l,...s}),n[9]=s,n[10]=e,n[11]=l,n[12]=c):c=n[12],c});fr.displayName=Em.displayName,S.forwardRef((t,e)=>{const n=z.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=pa({className:s}),n[5]=s,n[6]=l):l=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(c=pa(),n[7]=c):c=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("span",{className:c,children:i.jsx(Am,{children:i.jsx(b3,{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(_m,{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=_m.displayName,S.forwardRef((t,e)=>{const n=z.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=pa({className:r}),n[4]=r,n[5]=a):a=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(l=pa(),n[6]=l):l=n[6],n[7]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx("span",{className:l,children:i.jsx(Am,{children:i.jsx(x3,{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(Im,{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=Im.displayName,S.forwardRef((t,e)=>{const n=z.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=p3({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(Sm,{ref:e,className:a,...s}),n[7]=s,n[8]=e,n[9]=a,n[10]=l):l=n[10],l}).displayName=Sm.displayName;const Fm=S.forwardRef((t,e)=>{const n=z.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=he(u3({className:o})),n[3]=o,n[4]=s):s=n[4],n[5]!==r||n[6]!==e||n[7]!==s?(a=i.jsx(Tm,{ref:e,className:s,...r}),n[5]=r,n[6]=e,n[7]=s,n[8]=a):a=n[8],a});Fm.displayName=Tm.displayName;const Bm=t=>{const e=z.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=he("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(pc,{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(W2,{onClick:o,children:f}),e[17]=o,e[18]=f,e[19]=b):b=e[19],b},W2=t=>{const e=z.c(26),{children:n,onClick:o}=t,{createNewCell:r}=Ve();if(!o)return n;let s,a,l,c,d,u,h,m,f,b,x,p;return e[0]!==n?(s=i.jsx(Rm,{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(gc,{})}),e[4]=l):l=e[4],e[5]!==a?(c=i.jsxs(fr,{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 Qs().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(ta,{})}),e[10]=u):u=e[10],e[11]!==d?(h=i.jsxs(fr,{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 bc().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(fr,{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(Qi,{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(Om,{children:[s,x]}),e[23]=s,e[24]=x,e[25]=p):p=e[25],p};function Pm(t){return t!==y3&&!!(t&&t.trim().length>0)}function zm(){const t=z.c(3),{splitCell:e,undoSplitCell:n}=Ve();let o;return t[0]!==e||t[1]!==n?(o=r=>{const s=Zp(r.cellId);if(!s)return;const a=kp(s);e(r);const{dismiss:l}=Be({title:"Cell split",action:i.jsx(ts,{"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],je(o)}Ma=function(t){const e=z.c(51),{cell:n}=t,{createNewCell:o,updateCellConfig:r,updateCellName:s,moveCell:a,sendToTop:l,sendToBottom:c,addColumnBreakpoint:d,clearCellOutput:u}=Ve(),h=zm(),m=Ga(n==null?void 0:n.cellId),f=!le(sa),b=Jo(),{openModal:x}=Pn(),p=Ct(nr),g=le(xc),y=le(b1),w=le(To),k=le(v3),{saveCellConfig:N}=We();if(!n||w){let B;return e[0]===Symbol.for("react.memo_cache_sentinel")?(B=[],e[0]=B):B=e[0],B}const{cellId:j,config:C,getEditorView:_,name:E,hasOutput:A,hasConsoleOutput:I,status:F}=n;let D;e[1]!==j||e[2]!==C.disabled||e[3]!==N||e[4]!==r?(D=async()=>{const B={disabled:!C.disabled};await N({configs:{[j]:B}}),r({cellId:j,config:B})},e[1]=j,e[2]=C.disabled,e[3]=N,e[4]=r,e[5]=D):D=e[5];const M=D;let O;e[6]!==j||e[7]!==C.hide_code||e[8]!==_||e[9]!==N||e[10]!==r?(O=async()=>{const B={hide_code:!C.hide_code};await N({configs:{[j]:B}}),r({cellId:j,config:B});const K=_();K&&(B.hide_code?K.contentDOM.blur():K.focus())},e[6]=j,e[7]=C.hide_code,e[8]=_,e[9]=N,e[10]=r,e[11]=O):O=e[11];const R=O;let U,T,L,V,$;return e[12]===Symbol.for("react.memo_cache_sentinel")?(U=i.jsx(kd,{size:13,strokeWidth:1.5}),e[12]=U):U=e[12],e[13]!==j||e[14]!==E||e[15]!==x||e[16]!==s?(T=()=>{x(i.jsxs(io,{children:[i.jsx(vr,{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(ig,{placeholder:"cell name",value:E,onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),B.stopPropagation(),x(null))},onChange:B=>s({cellId:j,name:B})})]})]}))},e[13]=j,e[14]=E,e[15]=x,e[16]=s,e[17]=T):T=e[17],e[18]!==j||e[19]!==s?(L=B=>s({cellId:j,name:B}),e[18]=j,e[19]=s,e[20]=L):L=e[20],e[21]!==E||e[22]!==L?(V=i.jsx(ig,{placeholder:"cell name",value:E,onChange:L}),e[21]=E,e[22]=L,e[23]=V):V=e[23],e[24]!==d||e[25]!==g||e[26]!==k||e[27]!==y||e[28]!==f||e[29]!==j||e[30]!==u||e[31]!==C.disabled||e[32]!==C.hide_code||e[33]!==o||e[34]!==b||e[35]!==_||e[36]!==I||e[37]!==A||e[38]!==a||e[39]!==E||e[40]!==m||e[41]!==c||e[42]!==l||e[43]!==p||e[44]!==h||e[45]!==F||e[46]!==T||e[47]!==V||e[48]!==M||e[49]!==R?($=[[{icon:U,label:"Name",disableClick:!0,handle:q2,handleHeadless:T,rightElement:V},{icon:i.jsx(zo,{size:13,strokeWidth:1.5}),label:"Run cell",hotkey:"cell.run",hidden:F==="running"||F==="queued"||F==="disabled-transitively"||C.disabled,handle:()=>m()},{icon:i.jsx(Or,{size:13,strokeWidth:1.5}),label:"AI completion",hidden:!g,handle:()=>{p(B=>(B==null?void 0:B.cellId)===j?null:{cellId:j})},hotkey:"cell.aiCompletion"},{icon:i.jsx(za,{size:13,strokeWidth:1.5}),label:"Split cell",hotkey:"cell.splitCell",handle:()=>h({cellId:j})},{icon:i.jsx(Ic,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!A,handle:()=>(function(B){const K=document.getElementById(g1.create(B));K&&(K.classList.add("printing-output"),Bp(K,"result.png").finally(()=>{K.classList.remove("printing-output")}))})(j)},{icon:i.jsx(t1,{size:13,strokeWidth:1.5}),label:"Format cell",hotkey:"cell.format",handle:()=>{const B=_();B&&e1({[j]:B})}},{icon:C.hide_code?i.jsx(n1,{size:13,strokeWidth:1.5}):i.jsx(Gl,{size:13,strokeWidth:1.5}),label:C.hide_code?"Show code":"Hide code",handle:R,hotkey:"cell.hideCode"},{icon:C.disabled?i.jsx(Et,{size:13,strokeWidth:1.5}):i.jsx(_t,{size:13,strokeWidth:1.5}),label:"Reactive execution",rightElement:i.jsx(yc,{"data-testid":"cell-disable-switch",checked:!C.disabled,size:"sm",onCheckedChange:M}),handle:M},{icon:i.jsx(Ys,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(A||I),handle:()=>{u({cellId:j})}}],[{icon:i.jsx(ta,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:()=>{const B=_();B&&(Gn({autoInstantiate:y,createNewCell:o}),co(B,{language:"markdown",keepCodeAsIs:!1}))}},{icon:i.jsx(_o,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{const B=_();B&&(Gn({autoInstantiate:y,createNewCell:o}),co(B,{language:"sql",keepCodeAsIs:!1}))}},{icon:i.jsx(gc,{}),label:"Toggle as Python",handle:()=>{const B=_();B&&(Gn({autoInstantiate:y,createNewCell:o}),w3(B,"python",{force:!0}))}}],[{icon:i.jsxs(mr,{children:[i.jsx(Ur,{size:13,strokeWidth:1.5}),i.jsx(ia,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>o({cellId:j,before:!0})},{icon:i.jsxs(mr,{children:[i.jsx(Ur,{size:13,strokeWidth:1.5}),i.jsx($n,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>o({cellId:j,before:!1})},{icon:i.jsx(ia,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>a({cellId:j,before:!0})},{icon:i.jsx($n,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>a({cellId:j,before:!1})},{icon:i.jsx(x1,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>a({cellId:j,direction:"left"}),hidden:k!=="columns"},{icon:i.jsx(ga,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>a({cellId:j,direction:"right"}),hidden:k!=="columns"},{icon:i.jsx(Oa,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>l({cellId:j,scroll:!1})},{icon:i.jsx(gt,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>c({cellId:j,scroll:!1})},{icon:i.jsx(k3,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",hidden:k!=="columns",handle:()=>d({cellId:j})}],[{icon:i.jsx(H1,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!Pm(E),tooltip:Pm(E)?void 0:"Only named cells can be linked to",handle:async()=>{await Eo((function(B){const K=new URL(window.location.href);return K.hash=`scrollTo=${encodeURIComponent(B)}`,K.toString()})(E)),Be({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!f,variant:"danger",icon:i.jsx(rc,{size:13,strokeWidth:1.5}),handle:()=>{b({cellId:j})}}]].map(V2).filter($2),e[24]=d,e[25]=g,e[26]=k,e[27]=y,e[28]=f,e[29]=j,e[30]=u,e[31]=C.disabled,e[32]=C.hide_code,e[33]=o,e[34]=b,e[35]=_,e[36]=I,e[37]=A,e[38]=a,e[39]=E,e[40]=m,e[41]=c,e[42]=l,e[43]=p,e[44]=h,e[45]=F,e[46]=T,e[47]=V,e[48]=M,e[49]=R,e[50]=$):$=e[50],$};function $2(t){return t.length>0}function V2(t){return t.filter(G2)}function G2(t){return!t.hidden}function q2(t){t==null||t.stopPropagation(),t==null||t.preventDefault()}let Zi;Zi=me.memo(me.forwardRef((t,e)=>{const n=z.c(34);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]!==r?(d={cell:r},n[4]=r,n[5]=d):d=n[5];const u=Ma(d),h=C3();let m,f,b,x,p,g;if(n[6]===Symbol.for("react.memo_cache_sentinel")?(m=()=>({toggle:()=>c(H2)}),n[6]=m):m=n[6],S.useImperativeHandle(e,m),n[7]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(Wp,{placeholder:"Search actions...",className:"h-6 m-1"}),n[7]=f):f=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(Up,{children:"No results"}),n[8]=b):b=n[8],n[9]!==u){let _;n[11]!==u.length?(_=(E,A)=>i.jsxs(S.Fragment,{children:[i.jsx(N3,{children:E.map(I=>{let F=i.jsxs("div",{className:"flex items-center flex-1",children:[I.icon&&i.jsx("div",{className:"mr-2 w-5 text-muted-foreground",children:I.icon}),i.jsx("div",{className:"flex-1",children:I.label}),i.jsxs("div",{className:"shrink-0 text-sm",children:[I.hotkey&&y1(I.hotkey),I.rightElement]})]});return I.tooltip&&(F=i.jsx(pe,{content:I.tooltip,delayDuration:100,children:F})),i.jsx(Xl,{className:he(I.disabled&&"opacity-50!"),onSelect:()=>{I.disableClick||I.disabled||(I.handle(),c(!1))},variant:I.variant,children:F},I.label)})},A),A<u.length-1&&i.jsx(S3,{})]},A),n[11]=u.length,n[12]=_):_=n[12],x=u.map(_),n[9]=u,n[10]=x}else x=n[10];n[13]!==x?(p=i.jsxs($p,{children:[f,i.jsxs(E3,{children:[b,x]})]}),n[13]=x,n[14]=p):p=n[14],n[15]!==h||n[16]!==p?(g=i.jsx(Ql,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...h,children:p}),n[15]=h,n[16]=p,n[17]=g):g=n[17];const y=g;if(!a){let _,E;return n[18]!==o?(_=i.jsx(vc,{asChild:!0,children:o}),n[18]=o,n[19]=_):_=n[19],n[20]!==y||n[21]!==l||n[22]!==_?(E=i.jsxs(oa,{open:l,onOpenChange:c,children:[_,y]}),n[20]=y,n[21]=l,n[22]=_,n[23]=E):E=n[23],E}let w;n[24]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsx(_3,{tabIndex:-1,children:St("cell.cellActions")}),n[24]=w):w=n[24];const k=!l&&w;let N,j,C;return n[25]!==o?(N=i.jsx(I3,{children:i.jsx(vc,{className:"flex",children:o})}),n[25]=o,n[26]=N):N=n[26],n[27]!==k||n[28]!==N?(j=i.jsxs(A3,{delayDuration:200,disableHoverableContent:!0,children:[k,N]}),n[27]=k,n[28]=N,n[29]=j):j=n[29],n[30]!==y||n[31]!==l||n[32]!==j?(C=i.jsxs(oa,{open:l,onOpenChange:c,children:[j,y]}),n[30]=y,n[31]=l,n[32]=j,n[33]=C):C=n[33],C})),$c=me.memo(t=>{const e=z.c(5),{children:n,cellId:o}=t;let r;e[0]!==o?(r=j3(o),e[0]=o,e[1]=r):r=e[1];const s=le(r);if(!s)return null;let a;return e[2]!==n||e[3]!==s?(a=i.jsx(Zi,{showTooltip:!1,...s,children:n}),e[2]=n,e[3]=s,e[4]=a):a=e[4],a});function H2(t){return!t}$c.displayName="ConnectionCellActionsDropdown";const Um=t=>{const e=z.c(35),{children:n,cellId:o,getEditorView:r}=t,s=Rr(o),a=Lr(o),l=!wc(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=Ma(d),[h,m]=me.useState(),f=!!h;let b,x,p,g,y,w,k,N,j,C;if(e[8]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(yp,{size:13,strokeWidth:1.5}),e[8]=b):b=e[8],e[9]!==o?(x=async()=>{var A;if((A=window.getSelection())==null?void 0:A.toString())return void document.execCommand("copy");const E=document.getElementById(g1.create(o));E?await Eo(E.textContent??""):Je.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(za,{size:13,strokeWidth:1.5}),handle:J2},{label:"Paste",hidden:!!h,icon:i.jsx(Jc,{size:13,strokeWidth:1.5}),handle:async()=>{const A=r();if(A)try{const I=await navigator.clipboard.readText();if(I){const{from:F,to:D}=A.state.selection.main,M=A.state.update({changes:{from:F,to:D,insert:I}});A.dispatch(M)}}catch(I){const F=I;Je.error("Failed to paste from clipboard",F),T3({command:"paste"})}}},{label:"Copy image",hidden:!h,icon:i.jsx(Ra,{size:13,strokeWidth:1.5}),handle:async()=>{if(h){const A=await fetch(h.src),I=await A.blob(),F=new ClipboardItem({[I.type]:I});await navigator.clipboard.write([F]).then(K2).catch(Y2)}}},{icon:i.jsx(Ic,{size:13,strokeWidth:1.5}),label:"Download image",hidden:!h,handle:()=>{if(h){const A=document.createElement("a");A.download="image.png",A.href=h.src,A.click()}}},{label:"Go to Definition",icon:i.jsx(M3,{size:13,strokeWidth:1.5}),handle:()=>{const A=r();A&&D3(A)}}],...u];let E;g=Om,e[23]===Symbol.for("react.memo_cache_sentinel")?(E=A=>{A.target instanceof HTMLImageElement?m(A.target):m(void 0)},e[23]=E):E=e[23],e[24]!==n?(y=i.jsx(Rm,{onContextMenu:E,asChild:!0,children:n}),e[24]=n,e[25]=y):y=e[25],p=Qi,w="w-[300px]",k=!0,N=_.map((A,I)=>i.jsxs(S.Fragment,{children:[A.map(Q2),I<_.length-1&&i.jsx(Fm,{})]},I)),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]=k,e[22]=N}else p=e[17],g=e[18],y=e[19],w=e[20],k=e[21],N=e[22];return e[26]!==p||e[27]!==w||e[28]!==k||e[29]!==N?(j=i.jsx(p,{className:w,scrollable:k,children:N}),e[26]=p,e[27]=w,e[28]=k,e[29]=N,e[30]=j):j=e[30],e[31]!==g||e[32]!==y||e[33]!==j?(C=i.jsxs(g,{children:[y,j]}),e[31]=g,e[32]=y,e[33]=j,e[34]=C):C=e[34],C};function J2(){document.execCommand("cut")}function K2(){Be({title:"Copied image to clipboard"})}function Y2(t){Be({title:"Failed to copy image to clipboard. Try downloading instead.",description:t.message}),Je.error("Failed to copy image to clipboard",t)}function X2(t){t.stopPropagation()}function Q2(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:X2,children:e}):i.jsx(fr,{className:t.disabled?"opacity-50!":"",onSelect:n=>{t.disableClick||t.disabled||t.handle(n)},variant:t.variant,children:e})},t.label)}if(dg)ug(OC),dg();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);ug(new WebAssembly.Instance(t.default,{"./loro_wasm_bg.js":MC}).exports)}const Z2=["Map","Text","List","Tree","MovableList","Counter"];function Wm(t){if(typeof t!="object"||t==null)return!1;const e=Object.getPrototypeOf(t);return e!=null&&typeof e=="object"&&typeof e.kind=="function"&&Z2.includes(t.kind())}hg.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(Wm(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(Wm(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 ey=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"}}),pr=tt.define(),el=Dt.define({create:()=>({remoteCursors:new Map,isCheckout:!1}),update(t,e){for(const n of e.effects)if(n.is(pr))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}}),$m=t=>{const e=t.transactions.flatMap(n=>n.effects).filter(n=>n.is(pr));return t.docChanged||t.viewportChanged||e.length>0};class Ms{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=Ms.calculateAbsoluteCursorPosition(n,e);if(!s)return[];const a=e.scrollDOM.getBoundingClientRect(),l=(e.textDirection===R3.LTR?a.left:a.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,c=a.top-e.scrollDOM.scrollTop;return[new Ms(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 ty=(t,e,n,o)=>{const r=[],{updated:s,added:a}=n;for(const l of[...s,...a]){const c=Vm(t,e,l,o);c&&r.push(c)}return r},Vm=(t,e,n,o)=>{const r=e.getAllStates()[n];if(!r||n===t.peerIdStr||r.scopeId!==o)return;if(r.type==="delete")return pr.of({type:"delete",peer:r.uid,scopeId:r.scopeId});const s=mg.decode(r.cursor.anchor),a=t.getCursorPos(s).offset;let l=a;if(r.cursor.head){const c=mg.decode(r.cursor.head);l=t.getCursorPos(c).offset}return pr.of({type:"update",peer:r.uid,scopeId:r.scopeId,cursor:{anchor:a,head:l},user:r.user})};class ny{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=Vm(this.doc,this.awareness,u,this.scopeId);h&&d.push(h)}this.view.dispatch({effects:d})}else c.by==="checkout"&&this.view.dispatch({effects:[pr.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=ry({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 oy{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:ty(this.doc,this.awareness,a,this.scopeId)})};this._awarenessListener=s,this.awareness.addListener(s)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}}const ry=({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}},Os=["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)"],sy=(t,e,n)=>$t.define(o=>new ay(o,t,e,n)),xo=dc.define();class ay{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=Je.get("rtc"),Gm=vt.get("awareness").disabled(),tl="awareness:",yo=Bt(void 0),lt=new hg,Rs=new class{constructor(t,e=3e4){this.listeners=new Set,this.inner=new RC(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),nl=F3(()=>{vt.debug("creating websocket");const t=a1().getWsSyncURL(j1()).toString(),e=new xC(t,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await i1(),B3()==="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,tl)){const a=(function(l,c){return l.slice(c.length)})(s,tl);return Rs.apply(a),void Gm.debug("applied awareness update")}lt.import(s),vt.debug("imported doc change. new doc:",lt.toJSON()),Me.get(yo)!==lt&&Me.set(yo,lt)}),e.addEventListener("open",()=>{vt.debug("websocket open")}),e.addEventListener("close",n=>{vt.warn("websocket close",n),Me.get(yo)===lt&&Me.set(yo,void 0)}),e});function ol(t,e,n=""){if(Qt())return{extension:[],code:n};const o=lt.getByPath(`codes/${t}`)!==void 0,r=lt.getMap("codes").getOrCreateContainer(t,new Tc);o||(vt.log("initializing code for new cell",n),r.insert(0,n));const s={get name(){return Me.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 Os[Math.abs(l)%Os.length]}return Os[a%Os.length]})(this.name)}};return{code:n.toString(),extension:[iy(t),ly(t),cy(lt,Rs,s,()=>r,t),sy(lt,["codes",t],()=>r)]}}function iy(t){const e=(o,r)=>{const s=o.state.field(fa).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(jc),a=r.toJSON();Cr(s,a)||o.dispatch({effects:[w1.of(a)],annotations:[xo.of(!0)]})};return $t.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 Tc,"language type is not a LoroText");const a=lt.getByPath(`language_metadata/${t}`);a?(Zt(a instanceof fg,"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 ly(t){const e=lt.getMap("languages").getOrCreateContainer(t,new Tc),n=lt.getMap("language_metadata").getOrCreateContainer(t,new fg);return Se.updateListener.of(o=>{const r=e.toString()!=="";if(!o.docChanged&&r)return;if(!r){const a=kc(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(jc));const l=o.state.field(jc);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(L3)&&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&&lt.commit()})}function cy(t,e,n,o,r,s){const a=`loro:cell:${r}`;return[el,v1({above:!0,class:"loro-cursor-layer",update:$m,markers:l=>{const{remoteCursors:c,isCheckout:d}=l.state.field(el);return d?[]:[...c.values()].flatMap(u=>{var m,f;const h=Yt.cursor(u.cursor.anchor);return Ms.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:$m,markers:l=>{const{remoteCursors:c,isCheckout:d}=l.state.field(el);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 O3.forRange(l,`loro-selection ${((m=u.user)==null?void 0:m.colorClassName)||""}`,h)})}}),$t.define(l=>new ny(l,t,n,e,o,a,s)),$t.define(l=>new oy(l,t,e,a)),ey]}function Ls(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}ba()&&nl(),lt.subscribeLocalUpdates(t=>{vt.debug("local update, sending to server"),nl().send(t)}),Rs.addListener((t,e)=>{const n=[...t.added,...t.removed,...t.updated];e==="local"&&(Gm.debug("awareness changes",n),nl().send((function(o,r){const s=new TextEncoder().encode(o);return new Uint8Array([...s,...r])})(tl,Rs.encode(n))))});var qm={modified:{doc:""},original:{doc:""}},Hm=S.createContext(qm);function dy(t,e){return Ke({},t,e,{modified:Ke({},t.modified,e.modified),original:Ke({},t.original,e.original)})}var rl=()=>S.useContext(Hm),uy=t=>{var{children:e,theme:n}=t,[o,r]=S.useReducer(dy,Ke({},qm,{theme:n}));return S.useEffect(()=>r({theme:n}),[n]),i.jsx(Hm.Provider,{value:Ke({},o,{dispatch:r}),children:e})},hy=["extensions","value","selection","onChange"],Jm=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Fr(t,hy),{theme:a,dispatch:l}=rl(),c=Bo(Ke({},s,{theme:a}));return S.useEffect(()=>l({original:{doc:n,selection:o,extensions:[...c,...e]},originalExtension:{onChange:r,option:s,extension:[e]}}),[t]),null};Jm.displayName="CodeMirrorMerge.Original";var my=["extensions","value","selection","onChange"],Km=t=>{var{extensions:e=[],value:n,selection:o,onChange:r}=t,s=Fr(t,my),{theme:a,dispatch:l}=rl(),c=Bo(Ke({},s,{theme:a}));return S.useEffect(()=>{l({modified:{doc:n,selection:o,extensions:[...c,...e]},modifiedExtension:{onChange:r,option:s,extension:[e]}})},[t]),null};Km.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=ll(t,e,n,o,r,s),l=cl(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=Qm(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(gr<1e9&&Math.min(g,y)>16*gr||br>0&&Date.now()>br)return Math.min(g,y)>64*gr?[new Ze(m,f,x,p)]:Zm(h,m,f,b,x,p);let w=Math.ceil((g+y)/2);al.reset(w),il.reset(w);let k=(_,E)=>h.charCodeAt(m+_)==b.charCodeAt(x+E),N=(_,E)=>h.charCodeAt(f-_-1)==b.charCodeAt(p-E-1),j=(g-y)%2!=0?il:null,C=j?null:al;for(let _=0;_<w;_++){if(_>gr||br>0&&!(63&_)&&Date.now()>br)return Zm(h,m,f,b,x,p);let E=al.advance(_,g,y,w,j,!1,k)||il.advance(_,g,y,w,C,!0,N);if(E)return fy(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 gr=1e9,br=0,sl=!1;class Ym{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 al=new Ym,il=new Ym;function fy(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 Xm(t,e){let n=1,o=Math.min(t,e);for(;n<o;)n<<=1;return n}function ll(t,e,n,o,r,s){if(e==n||e==s||t.charCodeAt(e)!=o.charCodeAt(r))return 0;let a=Xm(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 cl(t,e,n,o,r,s){if(e==n||r==s||t.charCodeAt(n-1)!=o.charCodeAt(s-1))return 0;let a=Xm(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 dl(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=ll(t,h,n,o,r+f+m.length,s),x=cl(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 Qm(t,e,n,o,r,s){let a=n-e,l=s-r;if(a<l){let c=Qm(o,r,s,t,e,n);return c&&[c[1],c[0],c[2]]}return a<4||2*l<a?null:dl(t,e,n,o,r,s,Math.floor(a/4),-1)}function Zm(t,e,n,o,r,s){sl=!0;let a,l=n-e,c=s-r;if(l<c){let m=dl(o,r,s,t,e,n,Math.floor(l/6),50);a=m&&[m[1],m[0],m[2]]}else a=dl(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 ef(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 tf(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function nf(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?tf(n)?1:0:eo?df(n)&&e!=t.length-1?eo.test(t.slice(e,e+2))?2:0:eo.test(String.fromCharCode(n))?1:0:0}function of(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?tf(n)?1:0:eo?uf(n)&&e!=1?eo.test(t.slice(e-2,e))?2:0:eo.test(String.fromCharCode(n))?1:0:0}const rf=8;function sf(t,e,n){if(e==t.length||!of(t,e))return e;for(let o=e,r=e+n,s=0;s<rf;s++){let a=nf(t,o);if(!a||o+a>r)return o;o+=a}return e}function af(t,e,n){if(!e||!nf(t,e))return e;for(let o=e,r=e-n,s=0;s<rf;s++){let a=of(t,o);if(!a||o-a<r)return o;o-=a}return e}function lf(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function cf(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const df=t=>t>=55296&&t<=56319,uf=t=>t>=56320&&t<=57343;function vo(t,e){return!e||e==t.length||!df(t.charCodeAt(e-1))||!uf(t.charCodeAt(e))}function py(t,e,n){var o;return gr=((o=n==null?void 0:n.scanLimit)!==null&&o!==void 0?o:1e9)>>1,br=n!=null&&n.timeout?Date.now()+n.timeout:0,sl=!1,(function(r,s,a){for(;;){ef(a,1);let l=!1;for(let c=0;c<a.length;c++){let d,u,h=a[c];(d=ll(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=cl(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 hf(){return!sl}function mf(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=af(r,c.fromA,m),x=sf(r,c.toA,f),p=c.fromA-b,g=x-c.toA;if((!d||!u)&&p&&g){let y=Math.max(d,u),[w,k,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=sf(r,c.toA,h-c.toA)):y>g&&r.slice(c.toA,x)==w.slice(k,k+g)&&(c=o[l]=new Ze(x-d,x,c.fromB+g,c.toB+g),x=c.toA,b=af(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=cf(r,c.fromA,c.toA),k=w<0?-1:lf(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):k>-1&&(y=c.toA-k)<=m&&r.slice(c.fromA-y,c.fromA)==r.slice(k,c.toA)&&(c=o[l]=c.offset(-y))}}else{let y,w=cf(s,c.fromB,c.toB),k=w<0?-1:lf(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):k>-1&&(y=c.toB-k)<=m&&s.slice(c.fromB-y,c.fromB)==s.slice(k,c.toB)&&(c=o[l]=c.offset(-y))}}a=c.toA}return ef(o,3),o})(py(t,e,n),t,e)}const Ht=ro.define({combine:t=>t[0]}),ul=tt.define(),gy=ro.define(),wo=Dt.define({create:t=>null,update(t,e){for(let n of e.effects)n.is(ul)&&(t=n.value);for(let n of e.state.facet(gy))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 gf(mf(e.toString(),n.toString(),o),e,n,0,0,hf())}static updateA(e,n,o,r,s){return yf(xf(e,r,!0,o.length),e,n,o,s)}static updateB(e,n,o,r,s){return yf(xf(e,r,!1,n.length),e,n,o,s)}}function ff(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 pf(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 gf(t,e,n,o,r,s){let a=[];for(let l=0;l<t.length;l++){let c=t[l],[d,u]=ff(c.fromA+o,c.fromB+r,e,n),[h,m]=pf(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]=ff(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]=pf(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 Fs=1e3;function bf(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 xf(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>Fs&&([d,h]=bf(t,s-Fs,n,!0)),a<e.length-Fs&&([u,m]=bf(t,a+Fs,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 yf(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=mf(n.sliceString(h,f),o.sliceString(m,b),r);for(let p of gf(x,n,o,h,m,hf()))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 by={scanLimit:500},vf=$t.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=jf(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}=jf(t.view))}},{decorations:t=>t.deco}),Bs=Sn.low(z3({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(vf))===null||e===void 0?void 0:e.gutter)||U3.empty}})),wf=Te.line({class:"cm-changedLine"}),xy=Te.mark({class:"cm-changedText"}),yy=Te.mark({tagName:"ins",class:"cm-insertedLine"}),vy=Te.mark({tagName:"del",class:"cm-deletedLine"}),kf=new class extends W3{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function wy(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,wf),r.add(a,l,n?vy:yy),s&&s.add(a,a,kf);for(let d=e.iterRange(a,l-1),u=a;!d.next().done;){if(d.lineBreak){u++,r.add(u,u,wf),s&&s.add(u,u,kf);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,xy),!(b<h))break;c++}u=h}}}function jf(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)||wy(h,t.state.doc,a,o,l,c))}return{deco:l.finish(),gutter:c&&c.finish()}}class Ps 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 zs=tt.define({map:(t,e)=>t.map(e)}),xr=Dt.define({create:()=>Te.none,update:(t,e)=>{for(let n of e.effects)if(n.is(zs))return n.value;return t.map(e.changes)},provide:t=>Se.decorations.from(t)}),hl=.01;function Cf(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 ml=tt.define({map:(t,e)=>e.mapPos(t)});class ky 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:ml.of(r)});let{side:s,sibling:a}=e.state.facet(Ht);a&&a().dispatch({effects:ml.of(jy(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 jy(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 Cy=Dt.define({create:t=>Te.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(ml)&&(t=t.update({filter:o=>o!=n.value}));return t},provide:t=>Se.decorations.from(t)});function Nf({margin:t=3,minSize:e=4}){return Cy.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 ky(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 Ny=Se.styleModule.of(new P3({".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"}})),Sy=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"}}),Sf=new hc,Us=new hc;class Ef{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||by;let n=[Sn.low(vf),Sy,Ny,xr,Se.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(m=>m.effects.some(f=>f.is(zs)))&&this.measure()})],o=[Ht.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&o.push(Bs);let r=Dr.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Se.editorAttributes.of({class:"cm-merge-a"}),Us.of(o),n]}),s=[Ht.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(Bs);let a=Dr.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Se.editorAttributes.of({class:"cm-merge-b"}),Us.of(s),n]});this.chunks=ko.build(r.doc,a.doc,this.diffConf);let l=[wo.init(()=>this.chunks),Sf.of(e.collapseUnchanged?Nf(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:ul.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:ul.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(Us.reconfigure([Ht.of({side:"a",sibling:()=>this.b,highlightChanges:d,markGutter:c}),c?Bs:[]])),a.push(Us.reconfigure([Ht.of({side:"b",sibling:()=>this.a,highlightChanges:d,markGutter:c}),c?Bs:[]]))}if(r){let l=Sf.reconfigure(e.collapseUnchanged?Nf(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(xr).iter(),l=n.state.field(xr).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,k=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 Ps(-N),block:!0,side:-1}))):N>hl&&(h+=N,s.add(d,d,Te.widget({widget:new Ps(N),block:!0,side:-1})))}if(w>c+1e3&&c<m.from&&w>m.from&&d<f.from&&k>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<hl?r.add(e.state.doc.length,e.state.doc.length,Te.widget({widget:new Ps(-b),block:!0,side:1})):b>hl&&s.add(n.state.doc.length,n.state.doc.length,Te.widget({widget:new Ps(b),block:!0,side:1}));let x=r.finish(),p=s.finish();Cf(x,e.state.field(xr))||e.dispatch({effects:zs.of(x)}),Cf(p,n.state.field(xr))||n.dispatch({effects:zs.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=_f(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=_f(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 _f(t){let e=t.nextSibling;return t.remove(),e}var Ey=["className","children","orientation","revertControls","highlightChanges","gutter","collapseUnchanged","destroyRerender","renderRevertControl","diffConfig","root"],_y=["modified","modifiedExtension","original","originalExtension","theme","dispatch"],If=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,Ey),b=rl(),{modified:x,modifiedExtension:p,original:g,originalExtension:y,theme:w,dispatch:k}=b,N=Fr(b,_y),j=S.useRef(null),C=S.useRef(),_={orientation:r,revertControls:s,highlightChanges:a,gutter:l,collapseUnchanged:c,renderRevertControl:u,diffConfig:h,root:m};S.useImperativeHandle(e,()=>({container:j.current,view:C.current,modified:x,original:g,config:Ke({a:g,b:x,parent:j.current},_)}),[j,C,x,g,_]);var E=Se.updateListener.of(I=>{if(I.docChanged&&typeof(y==null?void 0:y.onChange)=="function"){var F=I.state.doc.toString();y==null||y.onChange(F,I)}}),A=Se.updateListener.of(I=>{if(I.docChanged&&typeof(p==null?void 0:p.onChange)=="function"){var F=I.state.doc.toString();p==null||p.onChange(F,I)}});return S.useEffect(()=>{!C.current&&j.current&&y&&p&&(C.current=new Ef(Ke({a:Ke({},g,{extensions:[...(y==null?void 0:y.extension)||[],...Bo(Ke({},y==null?void 0:y.option,{theme:w})),E]}),b:Ke({},x,{extensions:[...(p==null?void 0:p.extension)||[],...Bo(Ke({},p==null?void 0:p.option,{theme:w})),A]}),parent:j.current},_)),k({view:C.current}))},[C,j,y,p]),S.useEffect(()=>{if(g&&g.doc&&C.current){var I,F,D=(I=C.current)==null?void 0:I.a.state.doc.toString();D!==g.doc&&((F=C.current)==null||F.a.dispatch({changes:{from:0,to:D.length,insert:g.doc||""}}))}if(x&&x.doc&&C.current){var M,O,R=(M=C.current)==null?void 0:M.b.state.doc.toString();R!==x.doc&&((O=C.current)==null||O.b.dispatch({changes:{from:0,to:R.length,insert:x.doc||""}}))}if(d&&C.current){var U=C.current.a.state.selection.ranges[0].from,T=C.current.b.state.selection.ranges[0].from;C.current.destroy(),C.current=new Ef(Ke({a:Ke({},g,{extensions:[...(y==null?void 0:y.extension)||[],...Bo(Ke({},y==null?void 0:y.option,{theme:w}))]}),b:Ke({},x,{extensions:[...(p==null?void 0:p.extension)||[],...Bo(Ke({},p==null?void 0:p.option,{theme:w}))]}),parent:j.current},_)),U&&(C.current.a.focus(),C.current.a.dispatch({selection:{anchor:U,head:U}})),T&&(C.current.b.focus(),C.current.b.dispatch({selection:{anchor:T,head:T}}))}},[C,w,j.current,g,x,y,p,d]),S.useEffect(()=>()=>C.current&&C.current.destroy(),[]),S.useEffect(()=>{if(C.current){var I={};N.orientation!==r&&(I.orientation=r),N.revertControls!==s&&(I.revertControls=s),N.highlightChanges!==a&&(I.highlightChanges=a),N.gutter!==l&&(I.gutter=l),N.collapseUnchanged!==c&&(I.collapseUnchanged=c),N.renderRevertControl!==u&&(I.collapseUnchanged=c),Object.keys(I).length&&k&&C.current&&(C.current.reconfigure(Ke({},I)),k(Ke({},I)))}},[k,C,r,s,a,l,c,u]),i.jsx("div",Ke({ref:j,className:"cm-merge-theme"+(n?" "+n:"")},f,{children:o}))});If.displayName="CodeMirrorMerge.Internal";var Iy=["theme"],jo=me.forwardRef((t,e)=>{var{theme:n}=t,o=Fr(t,Iy);return i.jsx(uy,{theme:n,children:i.jsx(If,Ke({},o,{ref:e}))})});jo.Original=Jm,jo.Modified=Km,jo.displayName="CodeMirrorMerge";const Ay=jo.Original,Ty=jo.Modified,Af=[ej(),Se.lineWrapping],Dy=t=>{const e=z.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(Ax),p=S.useId(),g=N1(),{completion:y,input:w,stop:k,isLoading:N,setCompletion:j,setInput:C,handleSubmit:_}=$3({api:g.getAiURL("completion").toString(),headers:g.headers(),initialInput:r,streamProtocol:"text",experimental_throttle:100,body:{...m,includeOtherCode:b?uc(a):"",code:a,language:s},onError:My,onFinish:(q,W)=>{E(W.trimEnd())}}),E=j,A=me.useRef(null),I=y.trimEnd();let F,D,M,O;e[1]!==d?(F=()=>{var q;d&&(tj(()=>{const W=A.current;return!!(W!=null&&W.view)&&(W.view.focus(),!0)},{retries:3,delay:100,initialDelay:100}),nj((q=A.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]!==C?(M=()=>{d&&C(r||"")},O=[d,r,C],e[4]=d,e[5]=r,e[6]=C,e[7]=M,e[8]=O):(M=e[7],O=e[8]),S.useEffect(M,O);const{theme:R}=S1(),U=()=>{c(I),E("")},T=()=>{E("")};let L;e[9]!==n?(L=he("flex flex-col w-full rounded-[inherit]",n),e[9]=n,e[10]=L):L=e[10];const V=d&&"max-h-[400px] min-h-11 visible",$=!d&&"max-h-0 min-h-0 invisible";let B;e[11]!==V||e[12]!==$?(B=he("flex items-center gap-2 border-b px-3 transition-all rounded-[inherit] rounded-b-none duration-300",V,$),e[11]=V,e[12]=$,e[13]=B):B=e[13];const K=d&&i.jsxs(i.Fragment,{children:[i.jsx(Or,{className:"text-(--blue-10) shrink-0",size:16}),i.jsx(V3,{inputRef:A,className:"h-full my-0 py-2",onClose:()=>{l(),E("")},value:w,onChange:q=>{C(q),f(H3({input:q}))},onSubmit:()=>{var q;N||((q=A.current)!=null&&q.view&&q3(A.current.view),_())},onKeyDown:G3({handleAcceptCompletion:U,handleDeclineCompletion:T,isLoading:N,completion:I})}),N&&i.jsxs(xe,{"data-testid":"stop-completion-button",variant:"text",size:"xs",className:"mb-0",onClick:k,children:[i.jsx(E1,{className:"animate-spin mr-1",size:14}),"Stop"]}),I&&i.jsx(J3,{isLoading:N,onAccept:U,onDecline:T,size:"xs"}),i.jsxs("div",{className:"flex flex-row items-center gap-0.5 -ml-1.5 -mr-2",children:[i.jsx(pe,{content:"Add context",children:i.jsx(xe,{variant:"text",size:"icon",onClick:()=>K3(A),children:i.jsx(Y3,{className:"h-3 w-3"})})}),i.jsx(X3,{triggerClassName:"h-7",iconSize:"small",displayIconOnly:!0,forRole:"edit"})]}),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(Q3,{"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(xe,{"data-testid":"decline-completion-button",variant:"text",size:"icon",disabled:N,onClick:()=>{k(),l(),E("")},children:i.jsx(Gt,{className:"text-(--red-10)",size:16})})]});let te,Y;e[14]!==B||e[15]!==K?(te=i.jsx("div",{className:B,children:K}),e[14]=B,e[15]=K,e[16]=te):te=e[16],e[17]!==I||e[18]!==a||e[19]!==d||e[20]!==o||e[21]!==R?(Y=I&&d&&i.jsxs(jo,{className:"cm",theme:R,children:[i.jsx(Ay,{onChange:o,value:a,extensions:Af}),i.jsx(Ty,{value:I,editable:!1,readOnly:!0,extensions:Af})]}),e[17]=I,e[18]=a,e[19]=d,e[20]=o,e[21]=R,e[22]=Y):Y=e[22];const J=(!I||!d)&&u;let G;return e[23]!==te||e[24]!==Y||e[25]!==J||e[26]!==L?(G=i.jsxs("div",{className:L,children:[te,Y,J]}),e[23]=te,e[24]=Y,e[25]=J,e[26]=L,e[27]=G):G=e[27],G};function My(t){Be({title:"Completion failed",description:Z3(t)})}const fl="web application/x-marimo-cell",Oy=Pe({cells:oj(Pe({code:Oe()})),version:Ge("1.0")}),Tf=t=>{const e=t===1?"Cell":`${t} cells`;Be({title:`${e} copied`,description:`${e} ${t===1?"has":"have"} been copied to clipboard.`})},Ry=()=>{Be({title:"Copy failed",description:"Failed to copy cells to clipboard.",variant:"danger"})},Ly=()=>{Be({title:"Nothing to paste",description:"No cell or text found in clipboard.",variant:"danger"})},Fy=()=>{Be({title:"Paste failed",description:"Failed to read from clipboard",variant:"danger"})};class By{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):(Je.warn(`ClipboardItem does not support ${e}`),this)}build(){return new ClipboardItem(this.items)}}const{valueAtom:Py,useActions:Ws}=nc(()=>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 zy(t){const e=z.c(2);let n;return e[0]!==t?(n=(o=>Bt(r=>r(Py).has(o)))(t),e[0]=t,e[1]=n):n=e[1],le(n)}const yr=new WeakMap;function Df(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 Mf(t,e){const n=z.c(30),{canMoveX:o,editorView:r,cellActionDropdownRef:s}=e,{saveOrNameNotebook:a}=ni(),{saveCellConfig:l}=We(),c=Ct(nr),d=Ve(),u=tc(),h=Ws(),m=qo(),f=le(_1),{copyCells:b,pasteAtCell:x}=(function(){const M=Ve(),O=je(async U=>{const T=Mt(),L=U.map(V=>T.cellData[V]).filter(Boolean);if(L.length!==0)try{const V={cells:L.map(K=>({code:K.code})),version:"1.0"},$=L.map(K=>K.code).join(`
120
-
121
- `),B=new By().add(fl,V).add("text/plain",$).build();await navigator.clipboard.write([B]),Tf(L.length)}catch(V){Je.error("Failed to copy cells to clipboard",V);try{const $=L.map(B=>B.code).join(`
122
-
123
- `);await navigator.clipboard.writeText($),Tf(L.length)}catch{Ry()}}}),R=je(async(U,T)=>{const{before:L=!1}=T??{};try{const V=await navigator.clipboard.read();for(const B of V)if(B.types.includes(fl)){const K=await B.getType(fl),te=await K.text();try{const Y=Oy.parse(JSON.parse(te));if(Y.cells.length===0)break;const J=U,G=Y.cells.reverse();for(const q of G)M.createNewCell({cellId:J,before:L,code:q.code,autoFocus:!0});return}catch(Y){Je.warn("Failed to parse clipboard cell data",Y)}}const $=await navigator.clipboard.readText();$.trim()?M.createNewCell({cellId:U,before:L,code:$,autoFocus:!0}):Ly()}catch(V){Je.error("Failed to paste from clipboard",V),Fy()}});return{copyCells:O,pasteAtCell:R}})(),p=ns(),g=(function(M){const O=z.c(2);let R;return O[0]!==M?(R=Bt(U=>U(ri).selected.has(M)),O[0]=M,O[1]=R):R=O[1],le(R)})(t),y=Yo(),w=Ko(),k=le(aa);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 j=N,C=le(Jl);let _;n[3]!==C?(_=(M,O)=>Cc(C.getHotkey(M).key)(O.nativeEvent||O),n[3]=C,n[4]=_):_=n[4];const E=_,A=(function(M){const O=z.c(11),R=A1(),U=Ve(),T=Ws();let L,V,$;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]!==U||O[4]!==M||O[5]!==R||O[6]!==T?(V=()=>{T.remove(M),U.markTouched({cellId:M}),R.blurCell()},O[3]=U,O[4]=M,O[5]=R,O[6]=T,O[7]=V):V=O[7],O[8]!==L||O[9]!==V?($={onFocusWithin:L,onBlurWithin:V},O[8]=L,O[9]=V,O[10]=$):$=O[10];const{focusWithinProps:B}=rj($);return B})(t);let I;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]!==j||n[21]!==c||n[22]!==u||n[23]!==h||n[24]!==k?(I={onKeyDown:M=>{if(Fn.fromInput(M))return void M.continuePropagation();const O={"Mod+ArrowUp":()=>(d.focusTopCell(),j.clear(),!0),"Mod+ArrowDown":()=>(d.focusBottomCell(),j.clear(),!0),ArrowUp:()=>(d.focusCell({cellId:t,where:"before"}),j.clear(),!0),ArrowDown:()=>(d.focusCell({cellId:t,where:"after"}),j.clear(),!0),ArrowLeft:()=>{if(o){const T=u.get(Pt),L=T.cellIds.findWithId(t),V=T.cellIds.indexOf(L),$=T.cellIds.at(V-1);if($&&$.length>0){const B=Of(t,$);return d.focusCell({cellId:B,where:"exact"}),j.clear(),!0}}return!1},ArrowRight:()=>{if(o){const T=u.get(Pt),L=T.cellIds.findWithId(t),V=T.cellIds.indexOf(L),$=T.cellIds.at(V+1);if($&&$.length>0){const B=Of(t,$);return d.focusCell({cellId:B,where:"exact"}),j.clear(),!0}}return!1},"Shift+ArrowUp":()=>{const T=u.get(xa);j.extend({cellId:t,allCellIds:T});const L=T.findWithId(t).before(t);return L&&j.extend({cellId:L,allCellIds:T}),d.focusCell({cellId:t,where:"before"}),!0},"Shift+ArrowDown":()=>{const T=u.get(xa);j.extend({cellId:t,allCellIds:T});const L=T.findWithId(t).after(t);return L&&j.extend({cellId:L,allCellIds:T}),d.focusCell({cellId:t,where:"after"}),!0},Escape:()=>!!g&&(j.clear(),!0),Enter:()=>(h.add(t),D1(u,t),j.clear(),!0),s:()=>(a(),!0)};for(const[T,L]of Object.entries(O))if(Cc(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(Pt).cellIds.findWithId(L).first()!==L&&(T.forEach(V=>{d.moveCell({cellId:V,before:!0})}),!0)}),"cell.moveDown":sn(T=>{const L=T[T.length-1];return u.get(Pt).cellIds.findWithId(L).last()!==L&&([...T].reverse().forEach(V=>{d.moveCell({cellId:V,before:!1})}),!0)}),"cell.moveLeft":Df(T=>!!o&&(d.moveCell({cellId:T,direction:"left"}),!0)),"cell.moveRight":Df(T=>!!o&&(d.moveCell({cellId:T,direction:"right"}),!0)),"cell.hideCode":sn(T=>{var V;const L=!T.map($=>{var K;return((K=u.get(Pt).cellData[$])==null?void 0:K.config)||null}).every(Uy);l({configs:Object.fromEntries(T.map($=>[$,{hide_code:L}]))});for(const $ of T)d.updateCellConfig({cellId:$,config:{hide_code:L}});if(T.length===1){const $=T[0];d.focusCell({cellId:$,where:"after"}),L?((V=r.current)==null||V.contentDOM.blur(),T1($)):D1(u,$)}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 V;let L=!1;return c($=>($==null?void 0:$.cellId)===T?(L=!0,null):{cellId:T}),L&&((V=r.current)==null||V.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(!k.keymap.destructive_delete)return!1;const T=U.size>=2?[...U]:[t],L=u.get(Pt);return!T.some(V=>{const{status:$}=L.cellRuntime[V];return $==="running"||$==="queued"})&&(y.idle?(y.submit(T),!0):(w({cellIds:T}),y.clear(),!0))}},U=(function(T){return T.get(ri).selected})(u);if(f==="vim"&&(function(T,L){const V=(function(Y){if(Y.ctrlKey||Y.metaKey||Y.altKey)return"";const J=Y.key.toLowerCase();return Y.shiftKey?`shift+${J}`:J})(T),$=T.target;if(!V||!$)return!1;const B=yr.get($);let K=V;B!=null&&B.timeout&&clearTimeout(B.timeout),B&&(K=`${B.sequence} ${V}`);const te=L[K];if(te)return yr.delete($),te();if(!B){const Y=L[V];if(Y)return Y()}if(Object.keys(L).some(Y=>Y.startsWith(`${K} `))){const Y=window.setTimeout(()=>{yr.delete($)},500);return yr.set($,{sequence:K,timeout:Y}),!0}return yr.delete($),!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(U.size>=2?[...U]:[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(U.size>=2?L.bulkHandle([...U]):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]=j,n[21]=c,n[22]=u,n[23]=h,n[24]=k,n[25]=I):I=n[25];const{keyboardProps:F}=I1(I);let D;return n[26]!==A||n[27]!==g||n[28]!==F?(D=El(A,F,{"data-selected":g,className:"data-[selected=true]:ring-1 data-[selected=true]:ring-(--blue-8) data-[selected=true]:ring-offset-1"}),n[26]=A,n[27]=g,n[28]=F,n[29]=D):D=n[29],D}function Uy(t){return t==null?void 0:t.hide_code}function Of(t,e){const n=document.getElementById(Ks.create(t));if(!n)return e.first();const o=n.getBoundingClientRect();for(const r of e.topLevelIds){const s=document.getElementById(Ks.create(r));if(s){const a=s.getBoundingClientRect();if(o.top<=a.bottom&&o.bottom>=a.top)return r}}return e.last()}const Wy=t=>{const e=z.c(24),{editorView:n,code:o,currentLanguageAdapter:r,onAfterToggle:s}=t;let a;e[0]!==o?(a=new Qs().isSupported(o)||o.trim()==="",e[0]=o,e[1]=a):a=e[1];const l=a;let c;e[2]!==o?(c=new bc().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(pl,{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(ta,{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(pl,{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(gc,{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(pl,{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},pl=t=>{const e=z.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(xe,{"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},Rf=({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 J;const[y,w]=_n(nr),k=Jo(),{saveOrNameNotebook:N}=ni(),j=Yo(),{saveCellConfig:C}=We(),_=s==="running"||s==="queued",E=Ve(),A=zm(),I=x==="markdown",F=je(()=>!_&&(j.idle&&d.keymap.destructive_delete?(j.submit([n]),!0):(k({cellId:n}),!0))),D=je(()=>!_&&(c(),!0)),M=je(()=>{const G=!o.hide_code;return C({configs:{[n]:{hide_code:G}}}),E.updateCellConfig({cellId:n,config:{hide_code:G}}),G}),O=le(b1),R=je(()=>{Gn({autoInstantiate:O,createNewCell:E.createNewCell})}),U=sj(d),T=S.useMemo(()=>{const G=R2({cellId:n,showPlaceholder:e,enableAI:U,cellActions:{...E,afterToggleMarkdown:R,onRun:D,deleteCell:F,saveNotebook:N,createManyBelow:q=>{for(const W of[...q].reverse())E.createNewCell({code:W,before:!1,cellId:n,skipIfCodeExists:!0})},splitCell:A,toggleHideCode:M,aiCellCompletion:()=>{let q=!1;return w(W=>(W==null?void 0:W.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 G.push($t.define(q=>{const W=q.state.field(fa);return p(W.type),{update(ne){const X=ne.state.field(fa);p(X.type)}}}),Se.updateListener.of(q=>{q.selectionSet&&q.state.selection.ranges.some(W=>W.from!==W.to)&&b({focus:!1})}),Se.domEventHandlers({focus:()=>{b({focus:!1})}})),G},[n,d.keymap,d.completion,d.language_servers,d.display,d.diagnostics,U,t,e,E,A,M,F,D,w,R,p,b,N]),L=ba(),V=je(()=>{if(L){const q=ol(n,0,r);T.push(q.extension),r=q.code}const G=new Se({state:Dr.create({doc:r,extensions:T})});l(G),L||co(G,{language:kc(G.state).type})}),$=je(()=>{if(Zt(u.current!==null,"Editor view is not initialized"),L){const G=ol(n);T.push(G.extension)}u.current.dispatch({effects:[tt.reconfigure.of([T]),aj(u.current,{completionConfig:d.completion,hotkeysProvider:new M1(d.keymap.overrides??{}),lspConfig:{...d.language_servers,diagnostics:d.diagnostics}})]})}),B=je(()=>{if(Zt(a,"Editor view is not initialized"),L){const q=ol(n,0,r);T.push(q.extension),r=q.code}const G=new Se({state:Dr.fromJSON(a,{doc:r,extensions:T},{history:ij})});L||co(G,{language:kc(G.state).type}),l(G),E.clearSerializedEditorState({cellId:n})});S.useEffect(()=>{a===null?u.current===null?V():$():B(),u.current!==null&&h&&h.current!==null&&h.current.replaceChildren(u.current.dom)},[V,$,B,u,h,a,T]),S.useEffect(()=>{const G=u.current;return()=>{G==null||G.destroy()}},[u]);const K=(function(G,q){const W=z.c(12),ne=Ws(),X=le(_1),Z=le(Jl);let oe;if(W[0]!==Z){const ge=Z.getHotkey("command.vimEnterCommandMode");oe=Cc(ge.key),W[0]=Z,W[1]=oe}else oe=W[1];const se=oe;let ae;W[2]!==G||W[3]!==ne?(ae=()=>{ne.remove(G),T1(G)},W[2]=G,W[3]=ne,W[4]=ae):ae=W[4];const ee=ae;let _e;W[5]!==q||W[6]!==ee?(_e=()=>{if(!q.current)return void ee();const ge=q.current,Ee=ge.state;Ee.selection.main.empty?Fo(Ee)!==null?Il(ge):ee():ge.dispatch({selection:Yt.single(Ee.selection.main.from)})},W[5]=q,W[6]=ee,W[7]=_e):_e=W[7];const ue=_e;let we;W[8]!==ue||W[9]!==X||W[10]!==se?(we={onKeyDown:ge=>{X==="vim"?se(ge)&&ue():ge.key==="Escape"&&ue(),ge.continuePropagation()}},W[8]=ue,W[9]=X,W[10]=se,W[11]=we):we=W[11];const{keyboardProps:ke}=I1(we);return ke})(n,u),te=m&&!I||m&&I&&!f;let Y="";return I&&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(Dy,{enabled:(y==null?void 0:y.cellId)===n,initialPrompt:y==null?void 0:y.initialPrompt,currentCode:((J=u.current)==null?void 0:J.state.doc.toString())??r,currentLanguageAdapter:x,declineChange:je(()=>{var G;w(null),(G=u.current)==null||G.focus()}),onChange:je(G=>{var q;(q=u.current)==null||q.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:G}})}),acceptChange:je(G=>{var q,W;(q=u.current)==null||q.dispatch({changes:{from:0,to:u.current.state.doc.length,insert:G}}),(W=u.current)==null||W.focus(),w(null)}),children:i.jsxs("div",{className:"relative w-full",...K,children:[te&&i.jsx(O1,{tooltip:"Edit code",className:"absolute inset-0 z-10",onClick:b}),i.jsx(Lf,{className:Y,editorView:u.current,ref:h}),!m&&g&&i.jsx("div",{className:"absolute top-1 right-5",children:i.jsx(Wy,{code:r,editorView:u.current,currentLanguageAdapter:x,onAfterToggle:R})})]})})},Lf=me.forwardRef((t,e)=>{const n=z.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=he("cm mathjax_ignore",o),n[3]=o,n[4]=c):c=n[4],n[5]!==e?(d=h=>{e?Ls(e,s)(h):Ls(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});Lf.displayName="CellCodeMirrorEditor";let Ff,Bf,Pf,gl;Aa=ba()?(function(t){const e=n=>{const o=z.c(5),r=le(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(ya,{milliseconds:1e3,fallback:null,children:[c,i.jsx(xe,{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(Rf)):S.memo(Rf),Ff=t=>{const e=z.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},Bf=t=>{const e=z.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(Pf,{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(xe,{variant:"text",size:"icon",onClick:t.onClick,children:r}),e[5]=t.onClick,e[6]=r,e[7]=s):s=e[7],s},Pf=t=>{const e=z.c(2),{isCollapsed:n}=t;let o;return e[0]!==n?(o=n?i.jsx(ga,{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},gl=S.memo(t=>{const e=z.c(24),{onClick:n,count:o,cellId:r}=t,s=Yp();let a;e[0]!==r||e[1]!==s?(a=lj(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=he("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(dj,{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(hd,{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(cj,{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(Ff,{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}),gl.displayName="CollapsedCellBanner";const zf=t=>{const e=z.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 k=en(o);let N;if(k){let j;e[14]!==o?(j=ra(o),e[14]=o,e[15]=j):j=e[15],N=j}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=xe,c="ghost",d="icon",u=r,h="delete-button",m=Fn.preventFocus,f=he("hover:bg-transparent text-destructive/60 hover:text-destructive",(k||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(rc,{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},$y=t=>{const e=z.c(22),{cellId:n}=t,o=(function(g){const y=z.c(16),w=le(bu),k=xu(),N=Ko();let j;y[0]!==g||y[1]!==w.entries?(j=w.entries.get(g),y[0]=g,y[1]=w.entries,y[2]=j):j=y[2];const C=j;if(!C){let I;return y[3]===Symbol.for("react.memo_cache_sentinel")?(I={isPending:!1},y[3]=I):I=y[3],I}if(w.entries.size!==1){let I;return y[4]!==C?(I={isPending:!0,shouldConfirmDelete:!1,...C},y[4]=C,y[5]=I):I=y[5],I}let _,E,A;return y[6]!==k||y[7]!==N||y[8]!==w.entries?(_=()=>{N({cellIds:[...w.entries.values()].map(wb)}),k.clear()},y[6]=k,y[7]=N,y[8]=w.entries,y[9]=_):_=y[9],y[10]!==k?(E=()=>k.clear(),y[10]=k,y[11]=E):E=y[11],y[12]!==C||y[13]!==_||y[14]!==E?(A={isPending:!0,...C,shouldConfirmDelete:!0,confirm:_,cancel:E},y[12]=C,y[13]=_,y[14]=E,y[15]=A):A=y[15],A})(n);if(!o.isPending)return null;if(o.type==="simple"){let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=he("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,k;return e[1]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(oc,{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?(k=i.jsx("div",{className:g,"data-testid":y,children:w}),e[2]=y,e[3]=k):k=e[3],k}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=he("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(oc,{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(Gy),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(Yl,{autoFocus:!0,children:i.jsxs("div",{className:"flex items-center gap-2",onKeyDown:qy,children:[i.jsx(xe,{size:"xs",variant:"ghost",onClick:()=>o.cancel(),className:"text-(--amber-11) hover:bg-(--amber-4) hover:text-(--amber-11)",children:"Cancel"}),i.jsx(xe,{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 Vy(t){return i.jsx("li",{className:"my-0.5 ml-8 text-(--amber-11)/60",children:i.jsx(uj,{cellId:t})},t)}function Gy(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(Vy)})]},e)}function qy(t){t.stopPropagation()}const Hy=t=>{const e=z.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(nd,{}),e[8]=p):p=e[8],e[9]!==u||e[10]!==n||e[11]!==m?(g=i.jsx(tr,{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(tr,{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(tr,{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},Uf=me.createContext(null),Wf=S.memo(()=>S.use(Uf));Wf.displayName="DragHandle";const $f=me.forwardRef((t,e)=>{const n=z.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}=Qu(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(Vf,{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});$f.displayName="SortableCell";const Vf=me.forwardRef((t,e)=>{const n=z.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:k,isDragging:N,...j}=t;let C;o=x,n[10]!==b||n[11]!==w?(C=w?ua.Transform.toString({x:b?w.x:0,y:w.y,scaleX:1,scaleY:1}):void 0,n[10]=b,n[11]=w,n[12]=C):C=n[12];const _=N?2:void 0;let E,A,I;n[13]!==C||n[14]!==_||n[15]!==k?(E={transform:C,transition:k,zIndex:_,position:"relative"},n[13]=C,n[14]=_,n[15]=k,n[16]=E):E=n[16],s=E,n[17]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(td,{strokeWidth:1,size:20}),n[17]=A):A=n[17],n[18]!==p||n[19]!==g?(I=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:A}),n[18]=p,n[19]=g,n[20]=I):I=n[20],r=I;const F=!!w;a=-1,n[21]!==e||n[22]!==y?(l=D=>{Ls(e,y)(D)},n[21]=e,n[22]=y,n[23]=l):l=n[23],c=j,d=N,u=he(j.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(Uf.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 Gf(t,e){const n=z.c(9);let o;n[0]!==t||n[1]!==e?(o=c=>{t.current===null||t.current.contains(c.relatedTarget)||e.current===null||Il(e.current)},n[0]=t,n[1]=e,n[2]=o):o=n[2];const r=je(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=je(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 qf(t){const e=z.c(16),{cellId:n,cellConfig:o,languageAdapter:r,editorView:s}=t,a=zy(n),l=Ws();let c;e[0]!==n?(c=fj(n),e[0]=n,e[1]=c):c=e[1];const d=le(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 k;if(u)return;const w=(y==null?void 0:y.focus)??!0;l.add(n),w&&((k=s.current)==null||k.focus())},e[2]=n,e[3]=s,e[4]=u,e[5]=l,e[6]=f):f=e[6];const b=je(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=je(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}Vf.displayName="SortableCellInternal";const Hf=S.forwardRef((t,e)=>{var x;const n=z.c(18),{cellId:o}=t,r=Rr(o),s=Lr(o);let a;n[0]===Symbol.for("react.memo_cache_sentinel")?(a=va("marimo-cell","hover-actions-parent z-10",{published:!0}),n[0]=a):a=n[0];const l=a,c=L1((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=Ac(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=P1(s,r.edited),n[4]=r.edited,n[5]=s,n[6]=h):h=n[6],n[7]!==s.status?(m=Sc(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(Nc,{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});Hf.displayName="ReadonlyCellComponent";const Jy=({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=Ve(),g=le(Nt),y=Ct(nr),w=Jo(),k=Ga(n),{sendStdin:N}=We(),[j,C]=S.useState(),_=h.config.disabled||m.status==="disabled-transitively",E=R1({executionTime:m.runElapsedTimeMs??h.lastExecutionTime,status:m.status,errored:m.errored,interrupted:m.interrupted,stopped:m.stopped}),A=h.edited||m.interrupted||m.staleInputs&&!_,I=Sc(m.status),F=(m.status==="queued"||h.edited||m.staleInputs)&&!m.interrupted,D=S.useCallback(()=>c.current,[c]),{closeCompletionHandler:M,resumeCompletionHandler:O}=Gf(u,c),{isCellCodeShown:R,isMarkdown:U,isMarkdownCodeHidden:T,showHiddenCode:L,showHiddenCodeIfMarkdown:V}=qf({cellId:n,cellConfig:h.config,languageAdapter:j,editorView:c}),$=Mf(n,{canMoveX:l,editorView:c,cellActionDropdownRef:f}),B=mj(m.outline),K=!wc(m.output),te=m.consoleOutputs.length>0,Y=r.display.cell_output,J=K&&Y==="above",G=K&&Y==="below",[q,W]=S.useState(!1),[ne,X]=S.useState(!1);(function(ue){const{ref:we,box:ke="content-box",skip:ge}=ue,Ee=S.useRef({...F2}),Re=S.useRef(void 0);Re.current=ue.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=sm(be,et,"inlineSize"),ct=sm(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,Re.current&&Re.current(dt)}});return ve.observe(we.current,{box:ke}),()=>{ve.disconnect()}},[ke,we,ge])})({ref:x,skip:!U,onResize:ue=>{const we=ue.height&&ue.height<68,ke=T&&(we||Y==="below");W(ke),B&&ke?X(!0):ne&&X(!1)}});const Z=ue=>i.jsx(O1,{tooltip:"Edit markdown",className:he("z-20 relative",ue),onClick:L}),oe=K&&i.jsxs("div",{className:"relative",onDoubleClick:V,children:[i.jsx("div",{className:"absolute top-5 -left-8 z-10 print:hidden",children:i.jsx(Bf,{isCollapsed:s,onClick:()=>{s?p.expandCell({cellId:n}):p.collapseCell({cellId:n})},canCollapse:B})}),T&&G&&Z("top-3"),i.jsx(Nc,{allowExpand:!0,forceExpand:T,className:"output-area",cellId:n,output:m.output,stale:P1(m,h.edited),loading:Sc(m.status)}),T&&J&&Z("bottom-3")]}),se=va("marimo-cell","hover-actions-parent z-10",{interactive:!0,"needs-run":A,"has-error":m.errored,stopped:m.stopped,disabled:h.config.disabled,stale:m.status==="disabled-transitively",borderless:T&&K&&!$["data-selected"]}),ae=je(ue=>{y({cellId:n,initialPrompt:ue.prompt})}),ee=((_e=m.serialization)==null?void 0:_e.toLowerCase())==="valid";return i.jsx(F1,{children:i.jsx(Um,{cellId:n,getEditorView:D,children:i.jsxs($f,{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,...$,className:he(se,$.className,"focus:ring-1 focus:ring-(--blue-7) focus:ring-offset-0"),ref:x,...Ac(n,h.name),children:[Y==="above"&&oe,i.jsxs("div",{className:he("tray"),"data-hidden":T,children:[i.jsx("div",{className:"absolute right-2 -top-4 z-10",children:i.jsx(xl,{edited:h.edited,status:m.status,cellConfig:h.config,needsRun:A,hasOutput:K,hasConsoleOutput:te,cellActionDropdownRef:f,cellId:n,name:h.name,getEditorView:D,onRun:k})}),i.jsx(Jf,{cellId:n,className:he(T&&J&&"-top-7",T&&G&&"-bottom-8",T&&ne&&"-left-[3.8rem]"),actions:p}),i.jsx(Aa,{theme:t,showPlaceholder:e,id:n,code:h.code,config:h.config,status:m.status,serializedEditorState:h.serializedEditorState,runCell:k,setEditorView:d,userConfig:r,editorViewRef:c,editorViewParentRef:b,hidden:!R,hasOutput:K,showHiddenCode:L,languageAdapter:j,setLanguageAdapter:C}),i.jsx(bl,{className:he(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(zf,{status:m.status,connectionState:g.state,onClick:()=>{I||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:[ee&&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:ee?"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:ee?i.jsx("a",{href:"https://links.marimo.app/reusable-definitions",target:"_blank",rel:"noopener",children:i.jsx(jp,{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(B1,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})})]}),i.jsx(lg,{consoleOutputs:m.consoleOutputs,stale:F,cellName:m.serialization?"_":h.name,onRefactorWithAI:ae,onClear:()=>{p.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(ue,we)=>{p.setStdinResponse({cellId:n,response:ue,outputIndex:we}),N({text:ue})},cellId:n,debuggerActive:m.debuggerActive}),i.jsx($y,{cellId:n})]}),s&&i.jsx(gl,{onClick:()=>p.expandCell({cellId:n}),count:a,cellId:n})]})})})},bl=S.memo(t=>{const e=z.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(lm,{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=he("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(Wf,{}),e[12]=y):y=e[12];const w=a&&x;let k,N;return e[13]!==w?(k=i.jsxs("div",{className:"flex gap-2 items-end",children:[y,w]}),e[13]=w,e[14]=k):k=e[14],e[15]!==p||e[16]!==g||e[17]!==k?(N=i.jsxs("div",{className:p,children:[g,k]}),e[15]=p,e[16]=g,e[17]=k,e[18]=N):N=e[18],N});bl.displayName="CellRightSideActions";const Jf=S.memo(t=>{const e=z.c(21),n=le(Nt),{className:o,actions:r,cellId:s}=t;let a;e[0]!==r||e[1]!==s?(a=k=>{const N=k===void 0?{}:k;return r.createNewCell({cellId:s,before:!1,...N})},e[0]=r,e[1]=s,e[2]=a):a=e[2];const l=je(a);let c;e[3]!==r||e[4]!==s?(c=k=>{const N=k===void 0?{}:k;return r.createNewCell({cellId:s,before:!0,...N})},e[3]=r,e[4]=s,e[5]=c):c=e[5];const d=je(c),u=z1(n.state);let h,m;e[6]!==o?(h=he("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(Bm,{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(Bm,{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});Jf.displayName="CellLeftSideActions";const xl=S.memo(t=>{const e=z.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=le(Nt),p=z1(x.state),g=!s&&"hover-action";let y;e[0]!==g?(y=he(g),e[0]=g,e[1]=y):y=e[1];const w=p?c:Bn.NOOP;let k,N,j,C;return e[2]!==r||e[3]!==x.state||e[4]!==n||e[5]!==s||e[6]!==o||e[7]!==w?(k=i.jsx(Hy,{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]=k):k=e[8],e[9]!==x.state||e[10]!==o?(N=i.jsx(Ix,{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?(j=b&&i.jsx(Zi,{ref:d,cellId:u,status:o,getEditorView:h,name:m,config:r,hasOutput:a,hasConsoleOutput:l,children:i.jsx(tr,{variant:"green",tooltip:null,"data-testid":"cell-actions-button",children:i.jsx(Na,{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]=j):j=e[21],e[22]!==y||e[23]!==k||e[24]!==N||e[25]!==j?(C=i.jsxs(_x,{className:y,children:[k,N,j]}),e[22]=y,e[23]=k,e[24]=N,e[25]=j,e[26]=C):C=e[26],C});xl.displayName="CellToolbar";const Ky=({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=le(Nt),b=Ve(),x=We(),p=Jo(),g=Ct(nr),y=Ga(n),w=d.config.disabled||u.status==="disabled-transitively",k=R1({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,j=u.status==="running"||u.status==="queued",C=(u.status==="queued"||d.edited||u.staleInputs)&&!u.interrupted,_=S.useCallback(()=>a.current,[a]),{isCellCodeShown:E,showHiddenCode:A}=qf({cellId:n,cellConfig:d.config,languageAdapter:"python",editorView:a}),{closeCompletionHandler:I,resumeCompletionHandler:F}=Gf(c,a),D=Mf(n,{canMoveX:s,editorView:a,cellActionDropdownRef:h}),M=!wc(u.output),O=u.consoleOutputs.length>0,R=L1((L=u.output)==null?void 0:L.mimetype),U=va("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=je(V=>{g({cellId:n,initialPrompt:V.prompt})});return i.jsx(F1,{children:i.jsx(Um,{cellId:n,getEditorView:_,children:i.jsxs("div",{"data-status":u.status,ref:c,...El(D,{className:U,onBlur:I,onKeyDown:F}),...Ac(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:he("tray"),"data-hidden":!E,children:[i.jsx("div",{className:"absolute right-2 -top-4 z-10",children:i.jsx(xl,{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(Aa,{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:A,languageAdapter:"python",setLanguageAdapter:Bn.NOOP,showLanguageToggles:!1}),i.jsx(bl,{edited:d.edited,status:u.status,isCellStatusInline:!1,uninstantiated:k,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(zf,{connectionState:f.state,status:u.status,onClick:()=>{j||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(B1,{size:16,strokeWidth:1.5,className:"rounded-lg text-muted-foreground"})})]}),R&&i.jsx(Nc,{allowExpand:!0,forceExpand:!0,className:"output-area",cellId:n,output:u.output,stale:!1,loading:j}),i.jsx(lg,{consoleOutputs:u.consoleOutputs,stale:C,cellName:"_",onRefactorWithAI:T,onClear:()=>{b.clearCellConsoleOutput({cellId:n})},onSubmitDebugger:(V,$)=>{b.setStdinResponse({cellId:n,response:V,outputIndex:$}),x.sendStdin({text:V})},cellId:n,debuggerActive:u.debuggerActive})]})})})},Kf=S.memo(t=>{const{cellId:e,mode:n}=t,o=hj(e);Je.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(Ky,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}}):n==="edit"?i.jsx(Jy,{...t,cellId:e,editorView:r,setEditorView:s=>{r.current=s}}):i.jsx(Hf,{cellId:e})}),Yy=(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),Yf=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}),Xy=Pe({info:Pe({provides_extra:Oe().array().nullable()}),releases:pj(Oe(),gj())});function Xf(t){const e=z.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=Yf.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=Xy.transform(Qy).parse(await l.json());return Yf.set(o,c),c},s=[o],e[2]=o,e[3]=r,e[4]=s):(r=e[3],s=e[4]),kr(r,s)}function Qy(t){return{versions:Object.keys(t.releases).toSorted(Yy),extras:t.info.provides_extra??[]}}function Qf(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 Zy=()=>{const t=z.c(69),{packageAlert:e,packageLogs:n}=sg(),{clearPackageAlert:o}=ag(),[r]=ea();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(yC(e)){let m,f,b,x,p,g,y,w,k,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(Ba,{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(Gt,{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(xe,{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 j;t[15]!==a||t[16]!==h||t[17]!==d?(j=(C,_)=>{const E=Qf(C),A=d[C]||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(Ca,{size:"1rem"})}),i.jsx("td",{className:"pr-2 py-1 align-middle",children:i.jsx(ov,{packageName:E.name,selectedExtras:A,onExtrasChange:I=>u(F=>({...F,[C]:I}))})}),h&&i.jsx("td",{className:"pr-2 py-1 align-middle",children:i.jsx(rv,{value:a[C]??"latest",onChange:I=>l(F=>({...F,[C]:I})),packageName:E.name})})]},_)},t[15]=a,t[16]=h,t[17]=d,t[18]=j):j=t[18],g=e.packages.map(j),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(tv,{manager:r.package_management.manager,packages:e.packages.map(j=>{const C=Qf(j),_=d[j]||C.extras;return E=C.name,(A=_).length===0?E:`${E}[${A.join(",")}]`;var E,A}),versions:a,clearPackageAlert:()=>o(e.id)}),!Qt()&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"px-2 text-sm",children:"with"})," ",i.jsx(nv,{})]})]}):i.jsxs("p",{children:["If you set up a"," ",i.jsx(Fl,{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?(k=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]=k):k=t[31],t[32]!==k||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,k]})}),t[32]=k,t[33]=x,t[34]=N):N=t[34],N}if(vC(e)){let m;t[35]!==e.packages?(m=(function(O){const R=new Set(Object.values(O)),U=R.has("queued")||R.has("installing")?"installing":R.has("failed")?"failed":"installed";return U==="installing"?{status:"installing",title:"Installing packages",titleIcon:i.jsx(Wr,{className:"w-5 h-5 inline-block mr-2"}),description:"Installing packages:"}:U==="installed"?{status:"installed",title:"All packages installed!",titleIcon:i.jsx(md,{className:"w-5 h-5 inline-block mr-2"}),description:"Installed packages:"}:{status:"failed",title:"Some packages failed to install",titleIcon:i.jsx(Ba,{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,k,N,j;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")?(k=i.jsx(Gt,{className:"w-5 h-5"}),t[43]=k):k=t[43],t[44]!==w?(N=i.jsx(xe,{variant:"text","data-testid":"remove-banner-button",size:"icon",onClick:w,children:k}),t[44]=w,t[45]=N):N=t[45],t[46]!==y||t[47]!==N?(j=i.jsxs("div",{className:"flex justify-between",children:[y,N]}),t[46]=y,t[47]=N,t[48]=j):j=t[48];const C=f==="installed"&&"text-accent-foreground";let _,E,A,I,F,D,M;return t[49]!==C?(_=he("flex flex-col gap-4 justify-between items-start text-muted-foreground text-base",C),t[49]=C,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?(A=Object.entries(e.packages),t[53]=e.packages,t[54]=A):A=t[54],t[55]!==f||t[56]!==A?(I=i.jsx("ul",{className:"list-disc ml-2 mt-1",children:A.map((O,R)=>{const[U,T]=O;return i.jsxs("li",{className:he("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(ev,{status:T}),U]},R)})}),t[55]=f,t[56]=A,t[57]=I):I=t[57],t[58]!==n?(F=Object.keys(n).length>0&&i.jsx(sv,{packageLogs:n}),t[58]=n,t[59]=F):F=t[59],t[60]!==_||t[61]!==E||t[62]!==I||t[63]!==F?(D=i.jsxs("div",{className:_,children:[E,I,F]}),t[60]=_,t[61]=E,t[62]=I,t[63]=F,t[64]=D):D=t[64],t[65]!==D||t[66]!==g||t[67]!==j?(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:[j,D]})}),t[65]=D,t[66]=g,t[67]=j,t[68]=M):M=t[68],M}return Pl(e),null},ev=t=>{const e=z.c(4),{status:n}=t;switch(n){case"queued":{let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Ca,{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(Vl,{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(Gt,{size:"1rem"}),e[3]=o):o=e[3],o}default:return Pl(n),null}},tv=t=>{const e=z.c(10),{manager:n,packages:o,versions:r,clearPackageAlert:s}=t,{sendInstallMissingPackages:a}=We();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(av)},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(xe,{variant:"outline","data-testid":"install-packages-button",size:"sm",onClick:l,children:[c,d]}),e[8]=l,e[9]=u):u=e[9],u},nv=()=>{const t=z.c(17),[e,n]=ea(),{saveUserConfig:o}=We();let r,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=Dp(bj),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=Mp(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(Sp,{control:a.control,name:"package_management.manager",render:lv})}),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(xj,{...a,children:h}),t[14]=a,t[15]=h,t[16]=m):m=t[16],m},ov=t=>{const e=z.c(12),{packageName:n,selectedExtras:o,onExtrasChange:r}=t,[s,a]=S.useState(!1),{isPending:l,error:c,data:d}=Xf(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(cv);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(Gt,{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(U1,{checked:o.includes(p),onCheckedChange:g=>{h(p,g)},className:"font-mono text-sm",onSelect:dv,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:he("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(pc,{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(U1,{checked:o.includes(p),onCheckedChange:g=>{h(p,g)},className:"font-mono text-sm",onSelect:uv,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},rv=t=>{const e=z.c(16),{value:n,onChange:o,packageName:r}=t,{error:s,isPending:a,data:l}=Xf(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(Ec,{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(hv),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(Ec,{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},sv=t=>{const e=z.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(ga,{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(mv)}),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 av(t){Je.error(t)}function iv(t){return i.jsx("option",{value:t,children:t},t)}function lv(t){const{field:e}=t;return i.jsxs(Ep,{children:[i.jsx(_p,{children:i.jsx(Ec,{"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:yj.map(iv)})}),i.jsx(Tp,{})]})}function cv(t){return!/^(dev|test|testing)$/i.test(t)}function dv(t){return t.preventDefault()}function uv(t){return t.preventDefault()}function hv(t){return i.jsx("option",{value:t,children:t},t)}function mv(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 fv=t=>{let{transform:e}=t;return{...e,x:0}},pv={threshold:{x:0,y:.1}},gv=me.memo(t=>{const e=z.c(23),{children:n,multiColumn:o}=t,{dropCellOverCell:r,dropCellOverColumn:s,moveColumn:a,compactColumns:l}=Ve(),[c,d]=S.useState(null),[u,h]=S.useState(null),[m]=vj();let f;e:{if(m.width==="columns"){f=wj.EMPTY;break e}let M;e[0]===Symbol.for("react.memo_cache_sentinel")?(M=[fv],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:Nx},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(U=>U!=null),[...O])})(wu(bi,x),wu(pi,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=je(y);let k;e[4]!==u?(k=()=>{d(null),h(null)},e[4]=u,e[5]=k):k=e[5];const N=je(k);let j;e[6]!==c?(j=M=>{const O=M.droppableContainers.filter(bv);if(c&&Co(c))return di({...M,droppableContainers:O});const R=($=>{let{droppableContainers:B,droppableRects:K,pointerCoordinates:te}=$;if(!te)return[];const Y=[];for(const J of B){const{id:G}=J,q=K.get(G);if(q&&$b(te,q)){const W=li(q).reduce((X,Z)=>X+ai(te,Z),0),ne=Number((W/4).toFixed(4));Y.push({id:G,data:{droppableContainer:J,value:ne}})}}return Y.sort(ii)})({...M,droppableContainers:O}),U=ci(R.length>0?R:ju({...M,droppableContainers:O}),"id");if(!U)return[];Zt(Co(U),`Expected column id. Got: ${U}`);const T=Mt().cellIds.get(U);if(Zt(T,`Expected column. Got: ${U}`),T&&T.topLevelIds.length===0)return[{id:U}];const L=new Set(T.topLevelIds),V=di({...M,droppableContainers:M.droppableContainers.filter($=>$.id!==U&&L.has($.id))});if(V.length>0){const $=V[0].id;return Zt(yl($),`Expected cell id. Got: ${$}`),[{id:$}]}return[]},e[6]=c,e[7]=j):j=e[7];const C=j;let _;e[8]!==r||e[9]!==s||e[10]!==a?(_=M=>{const{active:O,over:R}=M,U=R==null?void 0:R.id;if(U!=null&&O.id!==U){if(yl(O.id)){if(Co(U))return void s({cellId:O.id,columnId:U});if(yl(U))return void r({cellId:O.id,overCellId:U})}Co(O.id)&&Co(U)&&a({column:O.id,overColumn:U})}},e[8]=r,e[9]=s,e[10]=a,e[11]=_):_=e[11];const E=je(_);let A;e[12]!==l?(A=M=>{const{active:O,over:R}=M;R!==null&&O.id!==R.id&&l()},e[12]=l,e[13]=A):A=e[13];const I=je(A),F=o?C:di;let D;return e[14]!==n||e[15]!==N||e[16]!==I||e[17]!==E||e[18]!==w||e[19]!==b||e[20]!==g||e[21]!==F?(D=i.jsx(hx,{autoScroll:pv,sensors:g,collisionDetection:F,modifiers:b,onDragEnd:I,onDragStart:w,onDragCancel:N,onDragOver:E,children:n}),e[14]=n,e[15]=N,e[16]=I,e[17]=E,e[18]=w,e[19]=b,e[20]=g,e[21]=F,e[22]=D):D=e[22],D});function yl(t){return typeof t=="string"&&!t.startsWith("tree_")}function Co(t){return typeof t=="string"&&t.startsWith("tree_")}function bv(t){return Co(t.id)}const xv=t=>{const e=z.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=va("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(kj,{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},Zf=t=>{const e=z.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(ya,{milliseconds:l,children:m}),e[8]=m,e[9]=l,e[10]=f):f=e[10],f},yv=()=>{const t=z.c(3),e=le(jj),n=le(Cj);let o;return t[0]!==n||t[1]!==e?(o=e&&i.jsxs(i.Fragment,{children:[i.jsx(ya,{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(xv,{size:5,className:"text-yellow-500"})})})})}),i.jsx(Zf,{show:e,delayMs:5e3,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(wa,{className:"h-4 w-4"}),i.jsx("p",{children:"Connecting to a marimo runtime ..."})]})})]})||n&&i.jsx(Zf,{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},ep=me.forwardRef((t,e)=>{const n=z.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}=Qu(d);let g;n[2]!==f?(g=f?ua.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 k=w,{deleteColumn:N,moveColumn:j,addColumn:C}=Ve(),_=wv;let E;n[8]!==o||n[9]!==j?(E=()=>j({column:o,overColumn:"_left_"}),n[8]=o,n[9]=j,n[10]=E):E=n[10];const A=!s;let I,F,D;n[11]===Symbol.for("react.memo_cache_sentinel")?(I=i.jsx(x1,{className:"size-4"}),n[11]=I):I=n[11],n[12]!==E||n[13]!==A?(F=i.jsx(pe,{content:"Move column left",side:"top",delayDuration:300,children:i.jsx(xe,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:E,disabled:A,children:I})}),n[12]=E,n[13]=A,n[14]=F):F=n[14],n[15]!==o||n[16]!==j?(D=()=>j({column:o,overColumn:"_right_"}),n[15]=o,n[16]=j,n[17]=D):D=n[17];const M=!a;let O,R,U,T,L,V;n[18]===Symbol.for("react.memo_cache_sentinel")?(O=i.jsx(ga,{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(xe,{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")?(U=i.jsx(Nj,{className:"size-4 opacity-0 group-hover:opacity-50 transition-opacity duration-200"}),n[22]=U):U=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:U}),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(xe,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",children:i.jsx(Na,{className:"size-4"})})}),n[26]=L):L=n[26],n[27]!==o||n[28]!==N?(V=()=>N({columnId:o}),n[27]=o,n[28]=N,n[29]=V):V=n[29];const $=!r;let B,K,te,Y,J,G;n[30]===Symbol.for("react.memo_cache_sentinel")?(B=i.jsx(Gt,{className:"mr-2 size-4"}),n[30]=B):B=n[30],n[31]!==V||n[32]!==$?(K=i.jsxs(zn,{children:[L,i.jsx(Wn,{align:"end",children:i.jsxs(lo,{onClick:V,disabled:$,children:[B,"Delete column"]})})]}),n[31]=V,n[32]=$,n[33]=K):K=n[33],n[34]!==C||n[35]!==o?(te=()=>{C({columnId:o}),requestAnimationFrame(_)},n[34]=C,n[35]=o,n[36]=te):te=n[36],n[37]===Symbol.for("react.memo_cache_sentinel")?(Y=i.jsx(pc,{className:"size-4"}),n[37]=Y):Y=n[37],n[38]!==te?(J=i.jsx(pe,{content:"Add column",side:"top",delayDuration:300,children:i.jsx(xe,{variant:"text",size:"xs",className:"hover:bg-(--gray-3) aspect-square p-0 w-7 h-7",onClick:te,children:Y})}),n[38]=te,n[39]=J):J=n[39],n[40]!==R||n[41]!==T||n[42]!==K||n[43]!==J||n[44]!==F?(G=i.jsxs("div",{className:"px-2 pt-3 pb-0 group flex items-center rounded-t-lg overflow-hidden",children:[F,R,T,K,J]}),n[40]=R,n[41]=T,n[42]=K,n[43]=J,n[44]=F,n[45]=G):G=n[45];const q=G;let W;n[46]!==e||n[47]!==m?(W=oe=>{Ls(e,m)(oe)},n[46]=e,n[47]=m,n[48]=W):W=n[48];const ne=he(x?"":c.className,x?"z-20":"z-1 hover:z-10 focus-within:z-10",p&&"bg-accent/20");let X,Z;return n[49]!==q||n[50]!==c.children?(X=i.jsxs("div",{className:"bg-(--slate-1) rounded-lg",children:[q,c.children]}),n[49]=q,n[50]=c.children,n[51]=X):X=n[51],n[52]!==l||n[53]!==x||n[54]!==c||n[55]!==k||n[56]!==W||n[57]!==ne||n[58]!==X?(Z=i.jsxs("div",{tabIndex:-1,ref:W,...c,style:k,"data-is-dragging":x,className:ne,children:[X,l]}),n[52]=l,n[53]=x,n[54]=c,n[55]=k,n[56]=W,n[57]=ne,n[58]=X,n[59]=Z):Z=n[59],Z});ep.displayName="SortableColumn";const vv=S.memo(ep);function wv(){const t=document.getElementById("App");t&&t.scrollTo({left:t.scrollLeft+1e3,behavior:"smooth"})}const{getColumnWidth:kv,saveColumnWidth:jv}=Sj,tp=S.memo(t=>{const e=z.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=kv(t.index),e[0]=t.index,e[1]=u):u=e[1],e[2]!==t.index?(h=b=>{jv(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(Cv,{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(vv,{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});tp.displayName="Column";const Cv=t=>{const e=z.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}=Ej(s),d=Nv;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 Nv(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 Sv=t=>{const e=z.c(10),{width:n}=t,{banners:o}=wC(),{removeBanner:r}=kC();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=he("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(W1,{className:"w-5 h-5 inline-block mr-2"}),u.title]}),i.jsx(xe,{"data-testid":"remove-banner-button",variant:"text",size:"icon",onClick:()=>r(u.id),children:i.jsx(Gt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex justify-between items-end",children:[i.jsx("span",{children:_j({html:u.description})}),u.action==="restart"&&i.jsx(Ev,{})]})]},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},Ev=()=>{const t=z.c(3),e=au();let n,o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(Lc,{className:"w-3 h-3 mr-2"}),t[0]=n):n=t[0],t[1]!==e?(o=i.jsxs(xe,{"data-testid":"restart-session-button",variant:"link",size:"xs",onClick:e,children:[n,"Restart"]}),t[1]=e,t[2]=o):o=t[2],o},_v=Bt(t=>{const e=t(Pt);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}),Iv=()=>{const t=z.c(3),e=Av;if(!le(_v))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(xe,{variant:"link",className:"h-auto font-normal",onClick:e,children:"Jump to the cell"})]})})})]})});r=i.jsx(ya,{milliseconds:2e3,children:s}),t[2]=r}else r=t[2];return r};function Av(){const t=document.querySelector("[data-stdin-blocking]");t?(t.scrollIntoView({behavior:"smooth",block:"center"}),requestAnimationFrame(()=>{t.focus()})):Je.error("No element with data-stdin-blocking found")}function Tv(){const t=setTimeout(Dv,100);return()=>clearTimeout(t)}function Dv(){requestAnimationFrame(Mv)}function Mv(){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(op)return;const n=document.querySelector(`[data-cell-name="${e}"]`);if(n){if(n.scrollIntoView({behavior:"smooth",block:"start"}),op=!0,n instanceof HTMLElement){n.focus();const{cellHandles:s}=Mt(),a=n.dataset.cellId;if(!a)return void Je.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 Je.warn(`Cannot focus cell with name ${e} because it was not found`),np()})(t);else try{np()}catch(e){const n=e;Je.warn("Error focusing first editor",n)}}function np(){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 op=!1;const Ov=t=>{const e=z.c(8),n=le(Ij),o=t.appConfig.width==="columns";let r,s,a;return e[0]!==t?(r=i.jsx(Rv,{...t}),e[0]=t,e[1]=r):r=e[1],e[2]!==n||e[3]!==r?(s=i.jsx(Yu,{id:"column-container",items:n,strategy:bx,children:r}),e[2]=n,e[3]=r,e[4]=s):s=e[4],e[5]!==o||e[6]!==s?(a=i.jsx(gv,{multiColumn:o,children:s}),e[5]=o,e[6]=s,e[7]=a):a=e[7],a},Rv=t=>{const e=z.c(28),{mode:n,userConfig:o,appConfig:r}=t,s=Ve(),{theme:a}=S1(),{toggleSidebarPanel:l}=jr();$1(Tv),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",Bv),st("cell.hideCode",Bn.NOOP),st("cell.format",Bn.NOOP);const c=_c(),d=Aj(),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=jC;let x,p,g,y,w;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(Zy,{}),p=i.jsx(Sx,{}),g=i.jsx(Iv,{}),y=i.jsx(yv,{}),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(Sv,{width:r.width}),e[11]=r.width,e[12]=w):w=e[12];const k=r.width==="columns"&&"grid grid-flow-col auto-cols-min gap-6";let N;e[13]!==k?(N=he(k),e[13]=k,e[14]=N):N=e[14];const j=u.map((A,I)=>i.jsx(Lv,{columnId:A,index:I,columnsLength:u.length,appConfig:r,mode:n,userConfig:o,theme:a},A));let C,_,E;return e[15]!==N||e[16]!==j?(C=i.jsx("div",{className:N,children:j}),e[15]=N,e[16]=j,e[17]=C):C=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(_=i.jsx(CC,{}),e[18]=_):_=e[18],e[19]!==b||e[20]!==r||e[21]!==w||e[22]!==C||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,C,_]}),e[19]=b,e[20]=r,e[21]=w,e[22]=C,e[23]=x,e[24]=p,e[25]=g,e[26]=y,e[27]=E):E=e[27],E},Lv=t=>{const e=z.c(54),{columnId:n,index:o,columnsLength:r,appConfig:s,mode:a,userConfig:l,theme:c}=t,d=_c();let u,h,m,f,b,x,p,g,y,w,k,N,j,C,_,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 A=d.get(n);let I;Zt(A,`Expected column for: ${n}`),e[22]!==d?(I=d.hasOnlyOneId(),e[22]=d,e[23]=I):I=e[23];const F=I;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=tp,k=n,N=o,j=o>0,C=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=he(O),e[26]=O,e[27]=R):R=e[27],e[28]!==n||e[29]!==R?(x=i.jsx(Fv,{columnId:n,className:R}),e[28]=n,e[29]=R,e[30]=x):x=e[30],u=Yu,m=`column-${o+1}`,p=A.topLevelIds,g=xx,e[31]!==M||e[32]!==o||e[33]!==a||e[34]!==c||e[35]!==l?(y=o===0&&M&&i.jsx(Kf,{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=A.topLevelIds.map(U=>U===Br?null:i.jsx(Kf,{cellId:U,theme:c,showPlaceholder:F,canDelete:!F,mode:a,userConfig:l,isCollapsed:A.isCollapsed(U),collapseCount:A.getCount(U),canMoveX:s.width==="columns"},U)),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]=k,e[19]=N,e[20]=j,e[21]=C}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],k=e[18],N=e[19],j=e[20],C=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]!==k||e[50]!==N||e[51]!==j||e[52]!==C?(E=i.jsx(h,{columnId:k,index:N,canMoveLeft:j,canMoveRight:C,width:f,canDelete:b,footer:x,children:_}),e[44]=h,e[45]=f,e[46]=b,e[47]=x,e[48]=_,e[49]=k,e[50]=N,e[51]=j,e[52]=C,e[53]=E):E=e[53],E},Fv=t=>{const e=z.c(17),{columnId:n,className:o}=t,{createNewCell:r}=Ve(),[s,a]=Tj(!1),l=le(xc),c=le(Xp);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=he("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(Dj,{onClose:a.toggle}):i.jsxs(i.Fragment,{children:[i.jsxs(xe,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>r({cellId:{type:"__end__",columnId:n},before:!1}),children:[i.jsx(bd,{className:"mr-2 size-4 shrink-0"}),"Python"]}),i.jsxs(xe,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{Gn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new Qs().defaultCode,hideCode:!0})},children:[i.jsx(yd,{className:"mr-2 size-4 shrink-0"}),"Markdown"]}),i.jsxs(xe,{className:u,variant:"text",size:"sm",disabled:!c,onClick:()=>{Gn({autoInstantiate:!0,createNewCell:r}),r({cellId:{type:"__end__",columnId:n},before:!1,code:new bc().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(xe,{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=he("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 Bv(){Jp()}const Pv=Mj(t=>c1().syncCellIds(t),400),zv=(t,e)=>{Me.get(To)||t.isEmpty()||e.isEmpty()||Cr(t.inOrderIds,e.inOrderIds)||Pv({cell_ids:t.inOrderIds})},rp=t=>{const e=z.c(70),{userConfig:n,appConfig:o,hideControls:r}=t,s=r!==void 0&&r;Oj(xa,zv);const{setCells:a,mergeAllColumns:l,collapseAllCells:c,expandAllCells:d}=Ve(),u=le(_l),h=le(Rj),m=le(Lj),f=Wl(),b=Ct(ti),{sendComponentValues:x,sendInterrupt:p}=We(),g=u.mode==="edit",y=u.mode==="present",w=le(Fj);let k,N;e[0]!==x?(k=()=>(cg.INSTANCE.start(x),Uv),e[0]=x,e[1]=k):k=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[2]=N):N=e[2],S.useEffect(k,N);const j=n.runtime.auto_instantiate;let C,_,E;e[3]!==a||e[4]!==b?(C=(ee,_e)=>{a(ee);const ue=ee.map(Wv),we=ee.map($v),ke=ee.map(Vv);b({names:ue,codes:we,configs:ke,layout:_e})},e[3]=a,e[4]=b,e[5]=C):C=e[5],e[6]===Symbol.for("react.memo_cache_sentinel")?(_=j1(),e[6]=_):_=e[6],e[7]!==C||e[8]!==n.runtime.auto_instantiate?(E={autoInstantiate:j,setCells:C,sessionId:_},e[7]=C,e[8]=n.runtime.auto_instantiate,e[9]=E):E=e[9];const{connection:A}=NC(E);let I,F;e[10]!==o.app_title||e[11]!==f?(I=()=>{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]=I,e[13]=F):(I=e[12],F=e[13]),S.useEffect(I,F);const D=da(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 ee=z.c(2),_e=qo();let ue;return ee[0]!==_e?(ue=()=>_e(ck(Mt())),ee[0]=_e,ee[1]=ue):ue=ee[1],je(ue)})(),U=Md(),T=Dd();let L,V,$,B,K,te,Y;e[23]!==R?(L=()=>{R()},e[23]=R,e[24]=L):L=e[24],st("global.runStale",L),e[25]!==p?(V=()=>{p()},e[25]=p,e[26]=V):V=e[26],st("global.interrupt",V),e[27]!==T?($=()=>{T()},e[27]=T,e[28]=$):$=e[28],st("global.hideCode",$),e[29]!==U?(B=()=>{U()},e[29]=U,e[30]=B):B=e[30],st("global.runAll",B),e[31]!==c?(K=()=>{c()},e[31]=c,e[32]=K):K=e[32],st("global.collapseAllSections",K),e[33]!==d?(te=()=>{d()},e[33]=d,e[34]=te):te=e[34],st("global.expandAllSections",te),e[35]!==o||e[36]!==n||e[37]!==u.mode?(Y=i.jsx(Ov,{mode:u.mode,userConfig:n,appConfig:o}),e[35]=o,e[36]=n,e[37]=u.mode,e[38]=Y):Y=e[38];const J=Y,G=o.width;let q,W,ne,X,Z,oe,se,ae;return e[39]===Symbol.for("react.memo_cache_sentinel")?(q=he("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?(W=g&&i.jsx("div",{className:"flex items-center justify-center container",children:i.jsx(vb,{filename:f})}),e[40]=f,e[41]=g,e[42]=W):W=e[42],e[43]!==A||e[44]!==W?(ne=i.jsx(EC,{connection:A,className:q,children:W}),e[43]=A,e[44]=W,e[45]=ne):ne=e[45],e[46]!==o||e[47]!==J||e[48]!==m||e[49]!==u.mode?(X=m&&i.jsx(SC,{appConfig:o,mode:u.mode,children:J}),e[46]=o,e[47]=J,e[48]=m,e[49]=u.mode,e[50]=X):X=e[50],e[51]!==o.width||e[52]!==A||e[53]!==w||e[54]!==ne||e[55]!==X?(Z=i.jsxs(_C,{connection:A,isRunning:w,width:G,children:[ne,X]}),e[51]=o.width,e[52]=A,e[53]=w,e[54]=ne,e[55]=X,e[56]=Z):Z=e[56],e[57]===Symbol.for("react.memo_cache_sentinel")?(oe=i.jsx(Tb,{}),e[57]=oe):oe=e[57],e[58]!==o||e[59]!==A||e[60]!==s||e[61]!==y||e[62]!==w||e[63]!==R||e[64]!==p||e[65]!==T?(se=!s&&i.jsx(ka,{children:i.jsx(pb,{presenting:y,onTogglePresenting:T,onInterrupt:p,onRun:R,connectionState:A.state,running:w,appConfig:o})}),e[58]=o,e[59]=A,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]!==Z||e[68]!==se?(ae=i.jsxs(i.Fragment,{children:[Z,oe,se]}),e[67]=Z,e[68]=se,e[69]=ae):ae=e[69],ae};function Uv(){cg.INSTANCE.stop()}function Wv(t){return t.name}function $v(t){return t.code}function Vv(t){return t.config}const sp=t=>le(Bj)[t.capability]?t.children:null,At=S.forwardRef((t,e)=>{const n=z.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=he("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 Gv=()=>{var f,b;const t=z.c(17),e=le(Pj),n=le(xc),o=((f=e==null?void 0:e.models)==null?void 0:f.chat_model)||zj,r=((b=e==null?void 0:e.models)==null?void 0:b.edit_model)||o,{handleClick:s}=Y1();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},qv=()=>{const t=z.c(26),e=le(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(k){const N=k;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}=kr(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=()=>[Bl(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(wa,{size:"small"}):e===ht.CLOSING?i.jsx(wa,{className:"text-destructive",size:"small"}):e===ht.OPEN?l!=null&&l.isHealthy?i.jsx(Sa,{className:"w-4 h-4 text-(--green-9)"}):l!=null&&l.lastChecked?i.jsx(W1,{className:"w-4 h-4 text-(--yellow-9)"}):i.jsx(Sa,{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},Hv=t=>{const e=z.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},Jv=Bt(t=>t(Uj).completion.copilot),Kv=()=>{const t=z.c(1);if(le(Jv)==="github"){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(Yv,{}),t[0]=e):e=t[0],e}return null},ap=Je.get("[copilot-status-bar]"),Yv=()=>{const t=le(X1),e=le(hC)!==null,{handleClick:n}=Y1(),o=()=>n("ai"),r=t?"Ready":"Not connected",s=Ct(X1),a=Ct(mC);return $1(()=>{const l=K1();let c=!0;return(async()=>{try{if(await l.initializePromise.catch(u=>{throw ap.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;ap.warn("Connection failed",d),s(!1),a("connectionError"),Be({title:"GitHub Copilot Connection Error",description:"Failed to connect to GitHub Copilot. Check settings and try again.",variant:"danger",action:i.jsx(xe,{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(wa,{className:"h-4 w-4"}):i.jsx(Hv,{className:he("h-4 w-4",!t&&"opacity-60")})})})},Xv=()=>{const t=z.c(18),[e,n]=S.useState(0),o=le(Nt),{getUsageStats:r}=We();let s,a,l,c;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>n(tw),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}=kr(l,c);let u,h,m,f;return t[8]!==d?(u=(d==null?void 0:d.gpu)&&d.gpu.length>0&&i.jsx(ew,{gpus:d.gpu}),t[8]=d,t[9]=u):u=t[9],t[10]!==d?(h=d&&i.jsx(Qv,{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(Zv,{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},Qv=t=>{const e=z.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,k;return e[3]!==h?(m=wl(h),e[3]=h,e[4]=m):m=e[4],e[5]!==a?(f=wl(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:"})," ",$s(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:"})," ",$s(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(cd,{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(vl,{percent:d,colorClassName:"bg-primary"})]}),e[20]=d,e[21]=w):w=e[21],e[22]!==w||e[23]!==g?(k=i.jsx(pe,{delayDuration:200,content:g,children:w}),e[22]=w,e[23]=g,e[24]=k):k=e[24],k},Zv=t=>{const e=z.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(fC,{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(vl,{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},ew=t=>{const e=z.c(12),{gpus:n}=t;let o;e[0]!==n?(o=Math.round(n.reduce(nw,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(ow),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(ud,{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(vl,{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},vl=t=>{const e=z.c(7),{percent:n,colorClassName:o}=t;let r;e[0]!==o?(r=he("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 $s(t){return t>1073741824?`${wl(t)} GB`:`${(function(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e/1048576)})(t)} MB`}function wl(t){return new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(t/1073741824)}function tw(t){return t+1}function nw(t,e){return t+e.memory.percent}function ow(t){return i.jsxs("span",{children:[i.jsxs("b",{children:["GPU ",t.index," (",t.name,"):"]})," ",$s(t.memory.used)," / ",$s(t.memory.total)," GB (",Math.round(t.memory.percent),"%)"]},t.index)}const ip=Bt(!1);function kl(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 kl(r,e,n))o.add(s)}return o}const rw=Bt(t=>{const e=t(xa),n=t(Qp);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:kl(u,m=>{var f;return((f=s.get(m))==null?void 0:f.parents)??new Set}),descendants:kl(u,m=>{var f;return((f=s.get(m))==null?void 0:f.children)??new Set})};return a})(e.inOrderIds,n)});function sw(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 aw=()=>{const t=z.c(6),[e,n]=_n(ip);let o,r,s;return t[0]!==n?(o=()=>n(iw),t[0]=n,t[1]=o):o=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(ld,{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 iw(t){return!t}const lw=()=>{const t=z.c(13),e=le(yo),[n,o]=_n(C1),[r,s]=S.useState(!1);if(!ba()||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(jd,{className:"w-4 h-4"}),t[0]=l):l=t[0],t[1]!==a?(c=i.jsx(vc,{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(Ql,{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(oa,{open:r,onOpenChange:s,children:[c,h]}),t[9]=r,t[10]=c,t[11]=h,t[12]=m):m=t[12],m},cw=t=>{const e=z.c(104),{className:n}=t,{saveUserConfig:o}=We(),[r,s]=Wj(),a=ea()[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=he("flex items-center",n),e[18]=n,e[19]=w):w=e[19];const k=a.runtime.auto_instantiate?"Disable autorun on startup":"Enable autorun on startup";let N,j,C;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")?(j=i.jsx("span",{children:"on startup: "}),e[23]=j):j=e[23],e[24]!==a.runtime.auto_instantiate?(C=a.runtime.auto_instantiate?i.jsx(_t,{size:14}):i.jsx(Et,{size:14}),e[24]=a.runtime.auto_instantiate,e[25]=C):C=e[25];const _=a.runtime.auto_instantiate?"autorun":"lazy";let E,A,I,F;e[26]!==_?(E=i.jsx("span",{children:_}),e[26]=_,e[27]=E):E=e[27],e[28]!==C||e[29]!==E?(A=i.jsxs("div",{className:"font-prose text-sm flex items-center gap-1 whitespace-nowrap",children:[j,C,E]}),e[28]=C,e[29]=E,e[30]=A):A=e[30],e[31]!==A||e[32]!==k||e[33]!==N?(I=i.jsx(Po,{name:"runtime.auto_instantiate",children:i.jsx(At,{tooltip:k,selected:!1,onClick:N,"data-testid":"footer-autorun-startup",children:A})}),e[31]=A,e[32]=k,e[33]=N,e[34]=I):I=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,U,T,L,V,$,B,K,te,Y,J;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?(U=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]=U):U=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]!==I||e[50]!==U||e[51]!==T?(L=i.jsxs("div",{className:"hidden md:flex md:items-center",children:[I,F,U,T]}),e[49]=I,e[50]=U,e[51]=T,e[52]=L):L=e[52],e[53]!==y?(V=y?i.jsx(Et,{size:16,className:"text-muted-foreground"}):i.jsx(_t,{size:16,className:"text-amber-500"}),e[53]=y,e[54]=V):V=e[54],e[55]===Symbol.for("react.memo_cache_sentinel")?($=i.jsx($n,{size:14}),e[55]=$):$=e[55],e[56]!==V?(B=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:[V,$]})})}),e[56]=V,e[57]=B):B=e[57],e[58]===Symbol.for("react.memo_cache_sentinel")?(K=i.jsx(Ap,{children:"Runtime reactivity"}),te=i.jsx(En,{}),e[58]=K,e[59]=te):(K=e[58],te=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")?(J=i.jsx("div",{className:"text-sm font-medium",children:"On startup"}),e[62]=J):J=e[62];const G=a.runtime.auto_instantiate?"autorun":"lazy";let q,W,ne,X,Z,oe,se,ae,ee;e[63]!==G?(q=i.jsxs("div",{children:[J,i.jsx("div",{className:"text-xs text-muted-foreground",children:G})]}),e[63]=G,e[64]=q):q=e[64],e[65]!==Y||e[66]!==q?(W=i.jsxs("div",{className:"flex items-center space-x-2",children:[Y,q]}),e[65]=Y,e[66]=q,e[67]=W):W=e[67],e[68]!==a.runtime.auto_instantiate||e[69]!==m?(ne=i.jsx(yc,{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]!==W||e[72]!==ne?(X=i.jsx(Po,{name:"runtime.auto_instantiate",children:i.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[W,ne]})}),e[71]=W,e[72]=ne,e[73]=X):X=e[73],e[74]===Symbol.for("react.memo_cache_sentinel")?(Z=i.jsx(En,{}),e[74]=Z):Z=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?(ee=i.jsxs("div",{className:"flex items-center space-x-2",children:[oe,ae]}),e[80]=oe,e[81]=ae,e[82]=ee):ee=e[82];const _e=a.runtime.on_cell_change==="autorun";let ue,we,ke,ge,Ee,Re;return e[83]!==b||e[84]!==_e?(ue=i.jsx(yc,{checked:_e,onCheckedChange:b,size:"sm"}),e[83]=b,e[84]=_e,e[85]=ue):ue=e[85],e[86]!==ee||e[87]!==ue?(we=i.jsx(Po,{name:"runtime.on_cell_change",children:i.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[ee,ue]})}),e[86]=ee,e[87]=ue,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:he("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]!==X||e[93]!==we||e[94]!==ke?(ge=i.jsxs(Wn,{align:"start",className:"w-64",children:[K,te,X,Z,we,ke]}),e[92]=X,e[93]=we,e[94]=ke,e[95]=ge):ge=e[95],e[96]!==l||e[97]!==B||e[98]!==ge?(Ee=i.jsx("div",{className:"flex md:hidden",children:i.jsxs(zn,{open:l,onOpenChange:c,children:[B,ge]})}),e[96]=l,e[97]=B,e[98]=ge,e[99]=Ee):Ee=e[99],e[100]!==L||e[101]!==Ee||e[102]!==w?(Re=i.jsxs("div",{className:w,children:[L,Ee]}),e[100]=L,e[101]=Ee,e[102]=w,e[103]=Re):Re=e[103],Re},dw=()=>{const t=z.c(24),{selectedPanel:e,isTerminalOpen:n}=Zs(),{toggleApplication:o,toggleTerminal:r}=jr(),s=le($j),a=uw,l=Kr.find(hw);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,k,N,j,C;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(wd,{className:"h-5 w-5"}),t[13]=g):g=t[13],t[14]!==n||t[15]!==p?(y=i.jsx(sp,{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(cw,{}),k=i.jsx("div",{className:"mx-auto"}),t[17]=w,t[18]=k):(w=t[17],k=t[18]),t[19]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(pu,{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")?(j=i.jsxs("div",{className:"flex items-center shrink-0 min-w-0",children:[i.jsx(Xv,{}),i.jsx(aw,{}),i.jsx(Gv,{}),i.jsx(Kv,{}),i.jsx(lw,{}),i.jsx(qv,{})]}),t[20]=j):j=t[20],t[21]!==y||t[22]!==x?(C=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,k,N,j]}),t[21]=y,t[22]=x,t[23]=C):C=t[23],C};function uw(t,e){const{Icon:n}=t;return i.jsx(n,{className:he("h-5 w-5",e)})}function hw(t){return t.type==="errors"}const mw=t=>{const e=z.c(6),{children:n}=t,{openModal:o,closeModal:r}=Pn();let s,a;return e[0]!==r||e[1]!==o?(s=()=>o(i.jsx(fw,{onClose:r})),e[0]=r,e[1]=o,e[2]=s):s=e[2],e[3]!==n||e[4]!==s?(a=i.jsx(Vj,{onClick:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a},fw=t=>{const e=z.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(),Be({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(vr,{children:[r,i.jsxs(wr,{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},pw=()=>{const t=z.c(10),{selectedPanel:e}=Zs(),{toggleApplication:n}=jr(),o=bw;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(xw).map(u=>i.jsx(lp,{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(mw,{children:i.jsx(lp,{tooltip:"Send feedback!",selected:!1,children:i.jsx(dd,{className:"h-5 w-5"})})}),l=i.jsx("div",{className:"flex-1"}),c=i.jsx(gw,{}),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},gw=()=>{const t=z.c(7),e=le(Gj);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(yw)}),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},lp=t=>{const e=z.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=he("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 bw(t,e){const{Icon:n}=t;return i.jsx(n,{className:he("h-5 w-5",e)})}function xw(t){return!t.hidden&&t.position==="sidebar"}function yw(t,e){return i.jsx("div",{className:"shrink-0 h-1 w-2 bg-(--grass-6) border border-(--grass-7)"},e.toString())}const vw=t=>{const e=z.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},ww=t=>{const e=z.c(38),n=le(qj),o=le(rw),r=Ve(),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,k;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=dp(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 A=f?"text-primary-foreground":"text-(--gray-8) hover:text-(--gray-9)";e[18]!==A?(y=he("group bg-transparent text-left w-full flex relative justify-between items-center","border-none rounded cursor-pointer","h-[21px] pl-[51px] font-inherit",A),e[18]=A,e[19]=y):y=e[19],w=E,k=Ew;const I=f&&"bg-primary group-hover:bg-primary";let F;e[20]!==I?(F=he("group-hover:bg-(--gray-2) flex h-full w-full px-0.5 items-center rounded",I),e[20]=I,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(Cw,{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=he("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&&!dp(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]=k}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],k=e[17];var N;let j,C,_;return e[22]!==h||e[23]!==m||e[24]!==f||e[25]!==t.cellPositions||e[26]!==b?(j=f?i.jsx(Nw,{cell:h,cellPositions:t.cellPositions,circleRadius:m}):i.jsx(Sw,{cell:h,selectedCell:b,circleRadius:m}),e[22]=h,e[23]=m,e[24]=f,e[25]=t.cellPositions,e[26]=b,e[27]=j):j=e[27],e[28]!==j||e[29]!==p?(C=i.jsx("svg",{className:p,width:"1",height:"1",children:j}),e[28]=j,e[29]=p,e[30]=C):C=e[30],e[31]!==x||e[32]!==C||e[33]!==g||e[34]!==y||e[35]!==w||e[36]!==k?(_=i.jsxs("button",{"data-node-id":g,className:y,onClick:w,onMouseDown:k,children:[x,C]}),e[31]=x,e[32]=C,e[33]=g,e[34]=y,e[35]=w,e[36]=k,e[37]=_):_=e[37],_},kw=t=>{const e=z.c(28),{open:n,setOpen:o}=t,r=_c();let s;e[0]!==r.inOrderIds?(s=Object.fromEntries(r.inOrderIds.map(_w)),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[k,N]of r.getColumns().entries())k>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=he("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(Gt,{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(xe,{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=(k,N)=>{const j=l.includes(N);return i.jsxs(S.Fragment,{children:[j&&i.jsx("div",{className:"absolute left-5 w-[36px] h-px bg-(--gray-4) pointer-events-none","aria-hidden":"true"}),i.jsx(ww,{cellId:k,cellPositions:a})]},k)},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},jw=()=>{const t=z.c(5),[e,n]=_n(ip);let o,r;return t[0]!==n?(o=()=>n(Iw),t[0]=n,t[1]=o):o=t[1],st("global.toggleMinimap",o),t[2]!==e||t[3]!==n?(r=i.jsx(kw,{open:e,setOpen:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r},Cw=t=>{const e=z.c(11),{cell:n,selectedCell:o}=t,r=Hj(),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:he({"font-bold":s,"text-foreground":o===void 0,"text-primary font-medium":!s&&sw(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},Nw=t=>{const e=z.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 Sw(t){const{cell:e,selectedCell:n,circleRadius:o}=t,r=e.graph.ancestors.size>0,s=e.graph.descendants.size>0;if(!n)return cp({circleRadius:o,leftWisker:r,rightWisker:s});const a=n.graph.ancestors.has(e.id),l=n.graph.descendants.has(e.id);return cp(a||l?{circleRadius:o,leftWisker:r,rightWisker:s,shift:a&&l?void 0:a?"left":"right"}:{circleRadius:o,leftWisker:!1,rightWisker:!1})}function cp(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 dp(t){return t.variables.length===0&&t.ancestors.size===0&&t.descendants.size===0}function Ew(t){return t.preventDefault()}function _w(t,e){return[t,e]}function Iw(t){return!t}const Aw=me.lazy(()=>mt(()=>import("./terminal-CxkHubcu.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),Tw=me.lazy(()=>mt(()=>import("./chat-panel-BPXKoTnZ.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([4,1,2,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,111,112,113,114]),import.meta.url)),Dw=me.lazy(()=>mt(()=>import("./agent-panel-COUYnuIK.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([115,1,2,109,116,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,111,112,113,117]),import.meta.url)),Mw=me.lazy(()=>mt(()=>import("./dependency-graph-panel-BOmSCZf7.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([118,1,2,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,119,120,121,122,123,5,6,111,112,113,124]),import.meta.url)),Ow=me.lazy(()=>mt(()=>import("./datasources-panel-DfuURLJw.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([125,1,2,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,7,126,112,127,5,6,111,113]),import.meta.url)),Rw=me.lazy(()=>mt(()=>import("./documentation-panel-BxjJO_Gw.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([128,1,2,7,5,6,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,111,112,113]),import.meta.url)),Lw=me.lazy(()=>mt(()=>import("./error-panel-MEvQ6K7h.js"),__vite__mapDeps([129,1,2,7]),import.meta.url)),Fw=me.lazy(()=>mt(()=>import("./file-explorer-panel-CzNUJ63G.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([130,1,2,5,6,131,132,133,123,110,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,111,112,113]),import.meta.url)),Bw=me.lazy(()=>mt(()=>import("./logs-panel-B9SmTZAW.js"),__vite__mapDeps([134,1,2,135,7]),import.meta.url)),Pw=me.lazy(()=>mt(()=>import("./outline-panel-uvsS-YEQ.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([136,1,2,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,5,6,111,112,113,137]),import.meta.url)),zw=me.lazy(()=>mt(()=>import("./packages-panel-xMz9W2hW.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([138,1,2,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,111,112,113]),import.meta.url)),Uw=me.lazy(()=>mt(()=>import("./scratchpad-panel-BF4BO-U4.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([139,1,2,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,110,5,6,111,112,113]),import.meta.url)),Ww=me.lazy(()=>mt(()=>import("./secrets-panel-CdIX44dQ.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([140,1,2,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,7,5,6,111,112,113]),import.meta.url)),$w=me.lazy(()=>mt(()=>import("./snippets-panel-Dco9h0rb.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([141,1,2,7,110,5,6,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,111,112,113,142]),import.meta.url)),Vw=me.lazy(()=>mt(()=>import("./tracing-panel-BmuHLPrY.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([143,1,2]),import.meta.url)),Gw=me.lazy(()=>mt(()=>import("./variable-panel-noTnH-AQ.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([144,1,2,122,126,112,127,7,5,6,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,111,113]),import.meta.url)),qw=t=>{const e=z.c(127),{children:n}=t,{isSidebarOpen:o,isTerminalOpen:r,selectedPanel:s}=Zs(),{setIsSidebarOpen:a,setIsTerminalOpen:l}=jr(),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 ie=c.current.isCollapsed();o&&ie&&c.current.expand(),o||ie||c.current.collapse(),requestAnimationFrame(Jw)},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 ie=d.current.isCollapsed();r&&ie&&d.current.expand(),r||ie||d.current.collapse(),requestAnimationFrame(Yw)},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(ja,{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,k;e[8]!==y?(w=he("border-border no-print z-10",y,"vertical"),e[8]=y,e[9]=w):w=e[9],e[10]!==w?(k=i.jsx(V1,{onDragging:G1,className:w}),e[10]=w,e[11]=k):k=e[11];const N=k,j=r?"resize-handle":"resize-handle-collapsed";let C,_;e[12]!==j?(C=he("border-border no-print z-20",j,"horizontal"),e[12]=j,e[13]=C):C=e[13],e[14]!==C?(_=i.jsx(V1,{onDragging:G1,className:C}),e[14]=C,e[15]=_):_=e[15];const E=_;let A,I,F,D,M,O,R,U,T,L,V,$,B,K,te,Y,J,G,q,W,ne,X;e[16]!==s?(A=i.jsx("div",{className:"text-sm text-(--slate-11) uppercase tracking-wide font-semibold flex-1",children:s}),e[16]=s,e[17]=A):A=e[17],e[18]!==a?(I=()=>a(!1),e[18]=a,e[19]=I):I=e[19],e[20]===Symbol.for("react.memo_cache_sentinel")?(F=i.jsx(Gt,{className:"w-4 h-4"}),e[20]=F):F=e[20],e[21]!==I?(D=i.jsx(xe,{"data-testid":"close-helper-pane",className:"m-0",size:"xs",variant:"text",onClick:I,children:F}),e[21]=I,e[22]=D):D=e[22],e[23]!==A||e[24]!==D?(M=i.jsxs("div",{className:"p-3 border-b flex justify-between items-center",children:[A,D]}),e[23]=A,e[24]=D,e[25]=M):M=e[25],e[26]!==s?(O=s==="files"&&i.jsx(Fw,{}),e[26]=s,e[27]=O):O=e[27],e[28]!==s?(R=s==="errors"&&i.jsx(Lw,{}),e[28]=s,e[29]=R):R=e[29],e[30]!==s?(U=s==="variables"&&i.jsx(Gw,{}),e[30]=s,e[31]=U):U=e[31],e[32]!==s?(T=s==="dependencies"&&i.jsx(Mw,{}),e[32]=s,e[33]=T):T=e[33],e[34]!==s?(L=s==="packages"&&i.jsx(zw,{}),e[34]=s,e[35]=L):L=e[35],e[36]!==s?(V=s==="outline"&&i.jsx(Pw,{}),e[36]=s,e[37]=V):V=e[37],e[38]!==s?($=s==="datasources"&&i.jsx(Ow,{}),e[38]=s,e[39]=$):$=e[39],e[40]!==s?(B=s==="documentation"&&i.jsx(Rw,{}),e[40]=s,e[41]=B):B=e[41],e[42]!==s?(K=s==="snippets"&&i.jsx($w,{}),e[42]=s,e[43]=K):K=e[43],e[44]!==s?(te=s==="scratchpad"&&i.jsx(Uw,{}),e[44]=s,e[45]=te):te=e[45],e[46]!==s?(Y=s==="chat"&&i.jsx(Tw,{}),e[46]=s,e[47]=Y):Y=e[47],e[48]!==s?(J=s==="agents"&&i.jsx(Dw,{}),e[48]=s,e[49]=J):J=e[49],e[50]!==s?(G=s==="logs"&&i.jsx(Bw,{}),e[50]=s,e[51]=G):G=e[51],e[52]!==s?(q=s==="tracing"&&i.jsx(Vw,{}),e[52]=s,e[53]=q):q=e[53],e[54]!==s?(W=s==="secrets"&&i.jsx(Ww,{}),e[54]=s,e[55]=W):W=e[55],e[56]!==O||e[57]!==R||e[58]!==U||e[59]!==T||e[60]!==L||e[61]!==V||e[62]!==$||e[63]!==B||e[64]!==K||e[65]!==te||e[66]!==Y||e[67]!==J||e[68]!==G||e[69]!==q||e[70]!==W?(ne=i.jsx(S.Suspense,{children:i.jsxs(ka,{children:[O,R,U,T,L,V,$,B,K,te,Y,J,G,q,W]})}),e[56]=O,e[57]=R,e[58]=U,e[59]=T,e[60]=L,e[61]=V,e[62]=$,e[63]=B,e[64]=K,e[65]=te,e[66]=Y,e[67]=J,e[68]=G,e[69]=q,e[70]=W,e[71]=ne):ne=e[71],e[72]!==M||e[73]!==ne?(X=i.jsx(Zl,{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]=X):X=e[74];const Z=X,oe=`helper-${u}`,se=o&&"border-r border-l border-(--slate-7)";let ae,ee,_e,ue,we,ke;e[75]!==se?(ae=he("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")?(ee=(ie,Ce)=>{var Ne;Ce===0&&ie===10&&((Ne=c.current)==null||Ne.resize(30))},e[77]=ee):ee=e[77],e[78]!==a?(_e=()=>a(!1),ue=()=>a(!0),e[78]=a,e[79]=_e,e[80]=ue):(_e=e[79],ue=e[80]),e[81]!==Z||e[82]!==N?(we=i.jsxs("span",{className:"flex flex-row h-full",children:[Z," ",N]}),e[81]=Z,e[82]=N,e[83]=we):we=e[83],e[84]!==oe||e[85]!==ae||e[86]!==_e||e[87]!==ue||e[88]!==we?(ke=i.jsx(ja,{ref:c,id:oe,"data-testid":"helper",collapsedSize:0,collapsible:!0,className:ae,minSize:10,defaultSize:0,maxSize:75,onResize:ee,onCollapse:_e,onExpand:ue,children:we},"helper"),e[84]=oe,e[85]=ae,e[86]=_e,e[87]=ue,e[88]=we,e[89]=ke):ke=e[89];const ge=ke,Ee=`terminal-${h}`,Re=r&&"border-(--slate-7)";let ve,be,et,rt,ct,dt,pt,ut,wt;e[90]!==Re?(ve=he("dark:bg-(--slate-1) no-print print:hidden hide-on-fullscreen",Re),e[90]=Re,e[91]=ve):ve=e[91],e[92]===Symbol.for("react.memo_cache_sentinel")?(be=(ie,Ce)=>{var Ne;Ce===0&&ie===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(Aw,{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(vw,{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(ja,{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,Ut,to,Rn,No,re,ce;return e[112]===Symbol.for("react.memo_cache_sentinel")?(On=IC(),e[112]=On):On=e[112],e[113]===Symbol.for("react.memo_cache_sentinel")?(Jt=i.jsx(ka,{children:i.jsx(pw,{})}),e[113]=Jt):Jt=e[113],e[114]!==Lt?(Ft=i.jsx(sp,{capability:"terminal",children:Lt}),e[114]=Lt,e[115]=Ft):Ft=e[115],e[116]!==g||e[117]!==Ft?(Ut=i.jsx(ja,{children:i.jsxs(q1,{autoSaveId:"marimo:chrome:v1:l1",direction:"vertical",children:[g,Ft]})}),e[116]=g,e[117]=Ft,e[118]=Ut):Ut=e[118],e[119]===Symbol.for("react.memo_cache_sentinel")?(to=i.jsx(Jj,{}),e[119]=to):to=e[119],e[120]!==ge||e[121]!==Ut?(Rn=i.jsxs(q1,{autoSaveId:"marimo:chrome:v1:l2",direction:"horizontal",storage:On,children:[Jt,ge,Ut,to]}),e[120]=ge,e[121]=Ut,e[122]=Rn):Rn=e[122],e[123]===Symbol.for("react.memo_cache_sentinel")?(No=i.jsx(jw,{}),e[123]=No):No=e[123],e[124]===Symbol.for("react.memo_cache_sentinel")?(re=i.jsx(Zl,{children:i.jsx(ka,{children:i.jsx(dw,{})})}),e[124]=re):re=e[124],e[125]!==Rn?(ce=i.jsxs(AC,{children:[Rn,No,re]}),e[125]=Rn,e[126]=ce):ce=e[126],ce};function Hw(){window.dispatchEvent(new Event("resize"))}function Jw(){requestAnimationFrame(Hw)}function Kw(){window.dispatchEvent(new Event("resize"))}function Yw(){requestAnimationFrame(Kw)}let jl,up;jl=S.lazy(()=>mt(()=>import("./command-palette-S0bzQp7v.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([145,1,2,5,6,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,111,112,113]),import.meta.url)),up=new URL(window.location.href).searchParams.get(Kj.showChrome)==="false",bg=Object.freeze(Object.defineProperty({__proto__:null,default:t=>{const e=z.c(10);if(up){let s,a,l;return e[0]!==t?(s=i.jsx(rp,{hideControls:!0,...t}),e[0]=t,e[1]=s):s=e[1],e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(jl,{}),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(rp,{...t}),e[5]=t,e[6]=n):n=e[6],e[7]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(jl,{}),e[7]=o):o=e[7],e[8]!==n?(r=i.jsxs(qw,{children:[n,o]}),e[8]=n,e[9]=r):r=e[9],r}},Symbol.toStringTag,{value:"Module"}))});export{pg as A,Sa as C,Ea as E,Dc as F,_a as H,Mc as K,Oc as N,Rc as P,Lc as R,Fc as S,Bc as T,Pc as W,FC as __tla,zc as a,Uc as b,Ia as c,Aa as d,Ta as e,Uo as f,gg as g,Da as h,Wc as i,$c as j,Vc as k,bg as l,Gc as s,Ma as u};