@marimo-team/frontend 0.23.17-dev5 → 0.23.17-dev50

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 (326) hide show
  1. package/dist/assets/{CellStatus-DIW20_Z8.js → CellStatus-XlxL4ctu.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-C4zEgCZh.js → ConnectedDataExplorerComponent-BF5CJvB2.js} +1 -1
  3. package/dist/assets/{ErrorBoundary-DzTD8LVq.js → ErrorBoundary-BfMsWVQU.js} +1 -1
  4. package/dist/assets/ImageComparisonComponent-CukPDP1p.js +1 -0
  5. package/dist/assets/{ImperativeModal-fY-ZfT0b.js → ImperativeModal-Ci0icDPt.js} +1 -1
  6. package/dist/assets/{JsonOutput-Bk2exFh0.js → JsonOutput-W3f6H6VQ.js} +13 -13
  7. package/dist/assets/{LazyAnyLanguageCodeMirror-A-Ant1Ad.js → LazyAnyLanguageCodeMirror-Dcvy_p3-.js} +2 -2
  8. package/dist/assets/{MarimoErrorOutput-L_o2Knzo.js → MarimoErrorOutput-COZo8cfk.js} +5 -5
  9. package/dist/assets/{RSPContexts-WiCgGm__.js → RSPContexts-IrDQoFki.js} +1 -1
  10. package/dist/assets/{RenderHTML-BTDLQMKg.js → RenderHTML-CQC8I348.js} +1 -1
  11. package/dist/assets/{RunButton-DiHX9YjB.js → RunButton-DRxV8u_T.js} +1 -1
  12. package/dist/assets/add-cell-with-ai-CuLILhtV.js +107 -0
  13. package/dist/assets/{add-connection-dialog-BZaJAQCM.js → add-connection-dialog-Dld_PDdZ.js} +31 -31
  14. package/dist/assets/{agent-panel-CRxiqCgP.js → agent-panel-3Ta5EPgw.js} +6 -6
  15. package/dist/assets/ai-model-dropdown-CIqhiHxf.js +5 -0
  16. package/dist/assets/{alert-dialog-Bb8Lz8ko.js → alert-dialog-DMh8_LWc.js} +1 -1
  17. package/dist/assets/{any-language-editor-BIeaxtdD.js → any-language-editor-DUQN91an.js} +1 -1
  18. package/dist/assets/{app-config-button-BS4LSo1l.js → app-config-button-EyzXs1Nt.js} +1 -1
  19. package/dist/assets/{blob-B9eg-RfN.js → blob-BzgGkt3B.js} +1 -1
  20. package/dist/assets/{button-DDGiD1NW.js → button-BB1AV4Rb.js} +1 -1
  21. package/dist/assets/{cache-panel-B2B1ePao.js → cache-panel-hpL5o4Y7.js} +1 -1
  22. package/dist/assets/{capabilities-DoEg0XwL.js → capabilities-LI6_PoMn.js} +1 -1
  23. package/dist/assets/{cell-editor-OC7h_nZ3.js → cell-editor-C5qD14SG.js} +11 -11
  24. package/dist/assets/{cell-link-D0aELsL_.js → cell-link-uPmFMRTh.js} +1 -1
  25. package/dist/assets/cells-BE1kpmPF.css +2 -0
  26. package/dist/assets/{cells-DLYs3NiJ.js → cells-DxL32Atg.js} +60 -60
  27. package/dist/assets/chat-display-CBpsXLHT.js +1 -0
  28. package/dist/assets/chat-panel-Dzq-QTrj.js +4 -0
  29. package/dist/assets/chat-ui-BcI4PAQ1.js +4 -0
  30. package/dist/assets/{column-preview-CnqeJb-x.js → column-preview-Dxxs9Brz.js} +1 -1
  31. package/dist/assets/{command-Dqxie4gq.js → command-CPFHYoYk.js} +1 -1
  32. package/dist/assets/command-palette-B1EO8oVR.js +1 -0
  33. package/dist/assets/{common-D_beLbpm.js → common-aHaDUD0-.js} +1 -1
  34. package/dist/assets/components-Bm1d4vm9.js +1 -0
  35. package/dist/assets/{components-CxEGXaTB.js → components-RV25kGIW.js} +1 -1
  36. package/dist/assets/config-BVfo0E1-.js +1 -0
  37. package/dist/assets/config-Bm5B9wGP.js +1 -0
  38. package/dist/assets/{copy-Bxb1_Gtw.js → copy-B-LLR1Yy.js} +1 -1
  39. package/dist/assets/{copy-icon-neDQUo4Q.js → copy-icon-DWG8Y-xW.js} +1 -1
  40. package/dist/assets/{createReducer-DGx5Af-C.js → createReducer-DNehfY0t.js} +1 -1
  41. package/dist/assets/{datasource-Bfg8PKXp.js → datasource-D0eBPOXe.js} +2 -2
  42. package/dist/assets/{dates-C2LWzsCZ.js → dates-BzOh4kS_.js} +1 -1
  43. package/dist/assets/defaultLocale-t77eoiwF.js +1 -0
  44. package/dist/assets/{dependency-graph-panel-CB5ie0zu.js → dependency-graph-panel-BKWUzXHX.js} +2 -2
  45. package/dist/assets/{diagram-PSM6KHXK-DIXxW5au.js → diagram-PSM6KHXK-CrTUa1Xy.js} +1 -1
  46. package/dist/assets/{dialog-BCVepWLJ.js → dialog-88bLE398.js} +1 -1
  47. package/dist/assets/{dist-CPjTeT8p.js → dist-6qzebh8f.js} +1 -1
  48. package/dist/assets/dist-BLqRx0W-.js +1 -0
  49. package/dist/assets/{dist-BP4hpPAE.js → dist-BVr4HQPR.js} +1 -1
  50. package/dist/assets/{dist-DnjsPBRJ.js → dist-BWXIz8tq.js} +1 -1
  51. package/dist/assets/{dist-Cros4IAo.js → dist-BWbS__vR.js} +1 -1
  52. package/dist/assets/dist-BZehnCk2.js +1 -0
  53. package/dist/assets/dist-BaRgF7DU.js +1 -0
  54. package/dist/assets/{dist-DYEuVkEX.js → dist-BblMEWTQ.js} +1 -1
  55. package/dist/assets/dist-BlMeFaGB.js +1 -0
  56. package/dist/assets/{dist-CrKffqgx.js → dist-BmYa2llD.js} +1 -1
  57. package/dist/assets/{dist-9o0Xjd5v.js → dist-Btp8vRFr.js} +1 -1
  58. package/dist/assets/{dist-C-3FVUQA.js → dist-BvMWjDxm.js} +1 -1
  59. package/dist/assets/{dist-DeJBvhAc.js → dist-ByfZ_2N7.js} +1 -1
  60. package/dist/assets/dist-C-g2AKOo.js +1 -0
  61. package/dist/assets/{dist-DQl27SFq.js → dist-C52BqSeO.js} +1 -1
  62. package/dist/assets/{dist-CiVShZKM.js → dist-C7rDfTPJ.js} +1 -1
  63. package/dist/assets/{dist-BKgHjzML.js → dist-C830fIIj.js} +1 -1
  64. package/dist/assets/{dist-fLBYOt9R.js → dist-CHN_sQZw.js} +1 -1
  65. package/dist/assets/dist-CLFhXj8x.js +1 -0
  66. package/dist/assets/{dist-D47O3FBX.js → dist-CLQWOmD7.js} +1 -1
  67. package/dist/assets/dist-CO4dulTL.js +1 -0
  68. package/dist/assets/dist-CPw3iq_l.js +1 -0
  69. package/dist/assets/dist-CQtN-vVI.js +1 -0
  70. package/dist/assets/dist-CZE9FE_5.js +1 -0
  71. package/dist/assets/dist-CexuM4NA.js +1 -0
  72. package/dist/assets/{dist-DJuRuTXr.js → dist-CfiLpZZj.js} +1 -1
  73. package/dist/assets/dist-CjSt6gRp.js +1 -0
  74. package/dist/assets/dist-Cr4q2U0d.js +1 -0
  75. package/dist/assets/{dist-C6_DArtj.js → dist-CxaoIFrU.js} +1 -1
  76. package/dist/assets/{dist-aRc_dRed.js → dist-D5nYeU7Q.js} +1 -1
  77. package/dist/assets/{dist-BJZAIIze.js → dist-DX04AOlt.js} +1 -1
  78. package/dist/assets/dist-DkZos4_s.js +1 -0
  79. package/dist/assets/{dist-DI1-Z60I.js → dist-DmCNk9gq.js} +1 -1
  80. package/dist/assets/{dist-kLs0VbW_.js → dist-DmjT6iaH.js} +1 -1
  81. package/dist/assets/{dist-CvWC93qL.js → dist-DrY8fZeD.js} +1 -1
  82. package/dist/assets/{dist-l4RTzHX-.js → dist-Drexw1Ir.js} +1 -1
  83. package/dist/assets/{dist-DrBqBDHF.js → dist-DtNSqHzW.js} +1 -1
  84. package/dist/assets/dist-DxQA7Dn1.js +1 -0
  85. package/dist/assets/{dist-BLN8PNJV.js → dist-Dza6FJtV.js} +1 -1
  86. package/dist/assets/{dist-8SH6SWEG.js → dist-HrXjBuXP.js} +1 -1
  87. package/dist/assets/dist-J00F7mRY.js +1 -0
  88. package/dist/assets/{dist-DcwTQG1A.js → dist-Jbd9zUbK.js} +1 -1
  89. package/dist/assets/{dist-CZvbHnyT.js → dist-bvfx5OQE.js} +1 -1
  90. package/dist/assets/{dist-12S8I4CH.js → dist-gUHullA_.js} +11 -11
  91. package/dist/assets/dist-nYKCNtEX.js +1 -0
  92. package/dist/assets/dist-oK8dffBy.js +1 -0
  93. package/dist/assets/{documentation-panel-Dii7ouzj.js → documentation-panel-DotG4o5W.js} +1 -1
  94. package/dist/assets/{download-DenADH0w.js → download-Tklnz6pn.js} +3 -3
  95. package/dist/assets/{dropdown-menu-dHmZR8bI.js → dropdown-menu-BGBlPKNz.js} +1 -1
  96. package/dist/assets/{edit-page-B0EhuiM-.js → edit-page-HdLqqfXC.js} +6 -6
  97. package/dist/assets/{error-banner-BSxEOIn2.js → error-banner-BkIr-0dH.js} +1 -1
  98. package/dist/assets/{error-entries-4XYBryls.js → error-entries-BvUR_22-.js} +3 -3
  99. package/dist/assets/{error-panel-xYZ4lX0A.js → error-panel-v0YdlA0h.js} +1 -1
  100. package/dist/assets/{errors-PgHhDa-M.js → errors-DCPV979Q.js} +1 -1
  101. package/dist/assets/{es-gYgfF8y5.js → es-Dl2xAwTv.js} +1 -1
  102. package/dist/assets/{esm-B30N1GS0.js → esm-Bmzgrl_5.js} +1 -1
  103. package/dist/assets/{esm-BDGraAqp.js → esm-Nb9m4lqg.js} +1 -1
  104. package/dist/assets/{field-BsxD35VE.js → field-BFgvUZyh.js} +1 -1
  105. package/dist/assets/file-explorer-panel-DSZY0Q7h.js +37 -0
  106. package/dist/assets/{file-icons-mgXTzM1c.js → file-icons-NkObNkr_.js} +1 -1
  107. package/dist/assets/{file-name-input-Dq7Z_QmU.js → file-name-input-BQJ9U9lU.js} +1 -1
  108. package/dist/assets/{floating-outline-ypOHt2wD.js → floating-outline-BHmregl1.js} +1 -1
  109. package/dist/assets/{focus-0L1nX7M9.js → focus-BBiJct2G.js} +1 -1
  110. package/dist/assets/{form-oz4Z280Z.js → form-BGoLLcgk.js} +1 -1
  111. package/dist/assets/{form-BsW7zr4t.js → form-BIUQB1NI.js} +1 -1
  112. package/dist/assets/{formats-DzmLpc9A.js → formats-DNYtnQk7.js} +1 -1
  113. package/dist/assets/{formatting-COz4XEaB.js → formatting-qNOrQYRN.js} +1 -1
  114. package/dist/assets/{fullscreen-CTDqNQr6.js → fullscreen-B51geQ_6.js} +1 -1
  115. package/dist/assets/{gallery-page-DbuxknAw.js → gallery-page-DBHHOraF.js} +1 -1
  116. package/dist/assets/{ganttDiagram-JELNMOA3-DaS60lKW.js → ganttDiagram-JELNMOA3-C9KBLmAA.js} +1 -1
  117. package/dist/assets/{glide-data-editor-CejKKgnN.js → glide-data-editor-CHN4-xUu.js} +1 -1
  118. package/dist/assets/{home-page-BOP1dDcM.js → home-page-DLeE6pH_.js} +2 -2
  119. package/dist/assets/{html-to-image-D_C-hjtC.js → html-to-image-ChNWEUlR.js} +1 -1
  120. package/dist/assets/index-BxVymcMs.js +38 -0
  121. package/dist/assets/index-WoaGtlKd.css +2 -0
  122. package/dist/assets/{input-JxFwu-3G.js → input-_AaMXWgD.js} +1 -1
  123. package/dist/assets/{kiosk-mode-BvKMuigM.js → kiosk-mode-RTwj6XH4.js} +1 -1
  124. package/dist/assets/{label-CqjrpwRC.js → label-DUD3SZnk.js} +1 -1
  125. package/dist/assets/{layout-yfmf2ZBx.js → layout-QkEddeXT.js} +4 -4
  126. package/dist/assets/{linear-BPv4krGt.js → linear-B1ROUUtm.js} +1 -1
  127. package/dist/assets/{links-ClNQSIal.js → links-DBc28bsl.js} +1 -1
  128. package/dist/assets/{logs-panel-OMd1Z9CL.js → logs-panel-Cdcjc_fq.js} +1 -1
  129. package/dist/assets/markdown-export-CNu5ZTPR.js +1 -0
  130. package/dist/assets/{markdown-renderer-BfLNJGNj.js → markdown-renderer-DpskAUxO.js} +1 -1
  131. package/dist/assets/{menu-items-CCi6aOPm.js → menu-items-Db-bgz92.js} +1 -1
  132. package/dist/assets/{mermaid-B8gNHyGy.js → mermaid-OU2hLna0.js} +3 -3
  133. package/dist/assets/{name-cell-input-COtjRghz.js → name-cell-input-DoxL2EXI.js} +1 -1
  134. package/dist/assets/{numbers-rmawRqQP.js → numbers-D9g2ArIv.js} +1 -1
  135. package/dist/assets/{outline-panel-CIGf4SLb.js → outline-panel-BxjI-YSj.js} +1 -1
  136. package/dist/assets/{packages-panel-DLuMuNuG.js → packages-panel-CiKYP9Ij.js} +1 -1
  137. package/dist/assets/{pair-with-agent-modal-C5OhJ8rX.js → pair-with-agent-modal-1b5Eh8Xo.js} +1 -1
  138. package/dist/assets/{panel-accordion-state-D1UP17Lk.js → panel-accordion-state-BkWYwckU.js} +1 -1
  139. package/dist/assets/{panels-B0w23XJS.js → panels-Swk0l08v.js} +2 -2
  140. package/dist/assets/{popover-Bcz1Zikb.js → popover-DHbixh3D.js} +1 -1
  141. package/dist/assets/{precisionRound-i2ImZxgc.js → precisionRound-DORAUfVY.js} +1 -1
  142. package/dist/assets/process-output-DJonUYp2.js +1 -0
  143. package/dist/assets/{quadrantDiagram-AYHSOK5B-DJuGB95-.js → quadrantDiagram-AYHSOK5B-Duf8sGaa.js} +1 -1
  144. package/dist/assets/{radio-group-BGXYy3u5.js → radio-group-ByLzIKjm.js} +1 -1
  145. package/dist/assets/react-vega-J-J2akIt.js +191 -0
  146. package/dist/assets/{readonly-code-display-DdABj8tH.js → readonly-code-display-B_ZHScA7.js} +1 -1
  147. package/dist/assets/{readonly-python-code-DUjqXwhi.js → readonly-python-code-C4GeGU7O.js} +1 -1
  148. package/dist/assets/{renderShortcut-Bl8_FVn8.js → renderShortcut-DnqsU4zj.js} +1 -1
  149. package/dist/assets/{reveal-component-BjgfnO81.js → reveal-component-De_cjq3p.js} +2 -2
  150. package/dist/assets/{run-page-DDty5GvQ.js → run-page-DmXT_-MQ.js} +1 -1
  151. package/dist/assets/{runs-s9t2f_Tg.js → runs-C6avq6Gi.js} +1 -1
  152. package/dist/assets/scratchpad-panel-BtGHIRdJ.js +1 -0
  153. package/dist/assets/{scroll-to-bottom-button-C8yfT4wq.js → scroll-to-bottom-button-CRMPUjYZ.js} +1 -1
  154. package/dist/assets/{secrets-panel-Cz17_MLf.js → secrets-panel-DmAwH7vI.js} +1 -1
  155. package/dist/assets/{select-BP75_5jJ.js → select-Clmc8Hw2.js} +1 -1
  156. package/dist/assets/{session-BmukRjSi.js → session-BtBr2zr3.js} +1 -1
  157. package/dist/assets/{session-panel-aMoQPTCB.js → session-panel-kBLydN0h.js} +1 -1
  158. package/dist/assets/{share-852X_cqy.js → share-DSOv_SvY.js} +1 -1
  159. package/dist/assets/{skeleton-CPuDx7yn.js → skeleton-CJymG2v3.js} +1 -1
  160. package/dist/assets/{snippets-panel-DBDXr-XP.js → snippets-panel-l_HnIWUj.js} +1 -1
  161. package/dist/assets/{spec-C7opZZRp.js → spec-CdDzA5ef.js} +1 -1
  162. package/dist/assets/{state-DCtLlFJq.js → state-B4lC29et.js} +1 -1
  163. package/dist/assets/{state-C4kiwedg.js → state-BkoVfBqt.js} +1 -1
  164. package/dist/assets/{state-hlEqpZfH.js → state-D9xpDCxa.js} +2 -2
  165. package/dist/assets/state-DDimGh2o.js +1 -0
  166. package/dist/assets/{strings--BknHX9C.js → strings-DMKwTex-.js} +1 -1
  167. package/dist/assets/{swiper-component-DXW8snlt.js → swiper-component-pSAP3cRf.js} +1 -1
  168. package/dist/assets/switch-8FxRs-OU.js +1 -0
  169. package/dist/assets/{terminal-CaHTVNrz.js → terminal-DPQJ6hNg.js} +1 -1
  170. package/dist/assets/{textarea-DtCcemo9.js → textarea-BzWvGIrJ.js} +1 -1
  171. package/dist/assets/{time-p47i6wvp.js → time-BO-naW1O.js} +1 -1
  172. package/dist/assets/tooltip-BMi4WFDl.js +61 -0
  173. package/dist/assets/{tooltip-4bZlU7jl.js → tooltip-BcgbFR7q.js} +1 -1
  174. package/dist/assets/{tracing-CStM7RGI.js → tracing-DCuWLKnk.js} +1 -1
  175. package/dist/assets/{tracing-panel-BTLzu8L-.js → tracing-panel-dVtThkzL.js} +2 -2
  176. package/dist/assets/{tree-actions-BwwVyp3l.js → tree-actions-o2iyMmKN.js} +1 -1
  177. package/dist/assets/{useBoolean-DIi7jQLa.js → useBoolean-sASJEpGA.js} +1 -1
  178. package/dist/assets/{useCellActionButton-uxVyv3JK.js → useCellActionButton-n2-2xb-5.js} +1 -1
  179. package/dist/assets/{useDeleteCell-Cy23OP4e.js → useDeleteCell-DH0weyin.js} +1 -1
  180. package/dist/assets/{useDependencyPanelTab-DNfjp_-X.js → useDependencyPanelTab-DQZmbkd-.js} +1 -1
  181. package/dist/assets/{useEventListener-C0195JsF.js → useEventListener-B_wSLgFR.js} +1 -1
  182. package/dist/assets/{useHotkey-DLZvrRZT.js → useHotkey-DJyYmk5P.js} +1 -1
  183. package/dist/assets/{useIframeCapabilities-j6fR_dBA.js → useIframeCapabilities-D_6fB_8O.js} +1 -1
  184. package/dist/assets/{useInstallPackage-WiYBwhUO.js → useInstallPackage-DyNrAhrx.js} +1 -1
  185. package/dist/assets/{useInterval-CnQfyMa9.js → useInterval-CjGsg4ie.js} +1 -1
  186. package/dist/assets/useNotebookActions-BUQta3nX.js +12 -0
  187. package/dist/assets/useRunCells-8xYRh7wH.js +1 -0
  188. package/dist/assets/{useSplitCell-BK5mnkkL.js → useSplitCell-BvgvIZaz.js} +1 -1
  189. package/dist/assets/{useTheme-Bxv9B31g.js → useTheme-BR31Gjbc.js} +1 -1
  190. package/dist/assets/utils-C5VWChv9.js +1 -0
  191. package/dist/assets/{vega-component-BGiCExka.js → vega-component-DG9G1qk2.js} +1 -1
  192. package/dist/assets/{vega-embed-container-DxSqUOCK.js → vega-embed-container-BJRQVehC.js} +1 -1
  193. package/dist/assets/vega-loader.browser-CAfmqKEc.js +6 -0
  194. package/dist/assets/{write-secret-modal-Dtm66yVf.js → write-secret-modal-DwCUuNRy.js} +1 -1
  195. package/dist/assets/{xychartDiagram-PRI3JC2R-B8A0hi-Q.js → xychartDiagram-PRI3JC2R-ClPpSFDI.js} +1 -1
  196. package/dist/assets/{zod-H_cgTO0M.js → zod-CIOjj3iA.js} +5 -5
  197. package/dist/index.html +87 -87
  198. package/package.json +7 -7
  199. package/src/__mocks__/requests.ts +5 -0
  200. package/src/components/ai/ai-model-dropdown.tsx +2 -2
  201. package/src/components/app-config/user-config-form.tsx +26 -0
  202. package/src/components/chat/__tests__/capabilities-popover.test.tsx +38 -0
  203. package/src/components/chat/__tests__/chat-abort.test.ts +51 -0
  204. package/src/components/chat/__tests__/use-chat-controller-id.test.tsx +39 -0
  205. package/src/components/chat/capabilities-popover.tsx +68 -0
  206. package/src/components/chat/chat-abort.ts +44 -0
  207. package/src/components/chat/chat-display.tsx +17 -0
  208. package/src/components/chat/chat-panel.tsx +107 -50
  209. package/src/components/chat/chat-utils.ts +1 -1
  210. package/src/components/chat/use-chat-controller-id.ts +24 -0
  211. package/src/components/data-table/charts/__tests__/schemas.test.ts +35 -0
  212. package/src/components/data-table/charts/schemas.ts +5 -2
  213. package/src/components/databases/icons/huggingface.svg +8 -0
  214. package/src/components/datasets/__tests__/icons.test.ts +21 -0
  215. package/src/components/datasets/icons.tsx +10 -0
  216. package/src/components/datasources/__tests__/components.test.tsx +29 -0
  217. package/src/components/datasources/components.tsx +8 -3
  218. package/src/components/editor/actions/export-dialog/__tests__/export-dialog.test.tsx +35 -0
  219. package/src/components/editor/actions/export-dialog/__tests__/state.test.ts +61 -0
  220. package/src/components/editor/actions/export-dialog/export-command.ts +4 -9
  221. package/src/components/editor/actions/export-dialog/export-dialog.tsx +27 -23
  222. package/src/components/editor/actions/export-dialog/format-notice.tsx +28 -0
  223. package/src/components/editor/actions/export-dialog/state.ts +23 -5
  224. package/src/components/editor/actions/export-dialog/use-export-dialog.ts +7 -15
  225. package/src/components/editor/actions/useConfigActions.tsx +24 -0
  226. package/src/components/editor/ai/add-cell-with-ai.tsx +2 -2
  227. package/src/components/editor/ai/ai-completion-editor.tsx +2 -2
  228. package/src/components/editor/chrome/panels/outline/__tests__/useActiveOutline.test.ts +26 -0
  229. package/src/components/editor/chrome/wrapper/useOpenAiAssistant.ts +2 -2
  230. package/src/components/editor/code/__tests__/readonly-python-code.test.tsx +114 -2
  231. package/src/components/editor/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap +14 -0
  232. package/src/components/editor/connections/storage/__tests__/as-code.test.ts +20 -0
  233. package/src/components/editor/connections/storage/add-storage-form.tsx +10 -0
  234. package/src/components/editor/connections/storage/as-code.ts +19 -1
  235. package/src/components/editor/connections/storage/schemas.ts +19 -0
  236. package/src/components/storage/__tests__/storage-snippets.test.ts +88 -0
  237. package/src/components/storage/components.tsx +2 -0
  238. package/src/components/storage/storage-snippets.ts +58 -0
  239. package/src/core/__tests__/mode.test.ts +85 -0
  240. package/src/core/ai/__tests__/config.test.tsx +96 -0
  241. package/src/core/ai/config.ts +16 -22
  242. package/src/core/ai/constants.ts +7 -0
  243. package/src/core/ai/staged-cells.ts +3 -0
  244. package/src/core/ai/state.ts +10 -0
  245. package/src/core/codemirror/__tests__/setup.test.ts +1 -1
  246. package/src/core/codemirror/cm.ts +2 -2
  247. package/src/core/codemirror/code-lens/__tests__/extension.test.ts +4 -5
  248. package/src/core/codemirror/code-lens/extension.ts +3 -3
  249. package/src/core/codemirror/find-replace/search-highlight.ts +8 -3
  250. package/src/core/codemirror/language/languages/sql/__tests__/renderers.test.tsx +44 -0
  251. package/src/core/codemirror/language/languages/sql/renderers.tsx +3 -3
  252. package/src/core/codemirror/theme/__tests__/light.test.ts +59 -123
  253. package/src/core/codemirror/theme/dark.ts +6 -5
  254. package/src/core/codemirror/theme/light.ts +6 -4
  255. package/src/core/config/__tests__/config-schema.test.ts +2 -0
  256. package/src/core/config/config-schema.ts +1 -0
  257. package/src/core/config/feature-flag.tsx +0 -2
  258. package/src/core/dom/outline.ts +25 -2
  259. package/src/core/hotkeys/hotkeys.ts +2 -0
  260. package/src/core/mode.ts +11 -9
  261. package/src/core/network/__tests__/api.test.ts +132 -17
  262. package/src/core/network/__tests__/export-filename.test.ts +43 -0
  263. package/src/core/network/__tests__/requests-lazy.test.ts +1 -0
  264. package/src/core/network/api.ts +47 -12
  265. package/src/core/network/export-filename.ts +37 -0
  266. package/src/core/network/markdown-export.ts +19 -0
  267. package/src/core/network/requests-network.ts +29 -5
  268. package/src/core/network/types.ts +4 -0
  269. package/src/core/storage/types.ts +1 -0
  270. package/src/css/app/codemirror.css +11 -7
  271. package/src/css/globals.css +8 -0
  272. package/src/plugins/impl/DataEditorPlugin.tsx +2 -9
  273. package/src/plugins/impl/__tests__/DataEditorPlugin.test.ts +18 -0
  274. package/src/plugins/impl/chat/chat-ui.tsx +51 -3
  275. package/src/plugins/impl/data-frames/__tests__/schema.test.ts +30 -0
  276. package/src/plugins/impl/data-frames/schema.ts +4 -1
  277. package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +20 -1
  278. package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +58 -0
  279. package/src/stories/theme.stories.tsx +71 -1
  280. package/dist/assets/ImageComparisonComponent-COvcNAUu.js +0 -1
  281. package/dist/assets/add-cell-with-ai-BU5EDuHt.js +0 -107
  282. package/dist/assets/ai-model-dropdown-CLCa-gsg.js +0 -5
  283. package/dist/assets/cells-BVzo2MHf.css +0 -2
  284. package/dist/assets/chat-display-7CzBSZRm.js +0 -1
  285. package/dist/assets/chat-panel-Dd5WiR1a.js +0 -4
  286. package/dist/assets/chat-ui-CYqqqoSC.js +0 -4
  287. package/dist/assets/command-palette-BBlSC8AZ.js +0 -1
  288. package/dist/assets/components-K_Mi0vdC.js +0 -1
  289. package/dist/assets/config-BJVx3eBW.js +0 -1
  290. package/dist/assets/config-DAL-jiRM.js +0 -1
  291. package/dist/assets/defaultLocale-DOVIEEPN.js +0 -1
  292. package/dist/assets/dist-B99-E4qp.js +0 -1
  293. package/dist/assets/dist-Bfm9U3vp.js +0 -1
  294. package/dist/assets/dist-BiwuSVkx.js +0 -1
  295. package/dist/assets/dist-BrZjJXDA.js +0 -1
  296. package/dist/assets/dist-CaZf6AoY.js +0 -1
  297. package/dist/assets/dist-Cgoy5550.js +0 -1
  298. package/dist/assets/dist-Csf5i4KY.js +0 -1
  299. package/dist/assets/dist-D6Iobl3P.js +0 -1
  300. package/dist/assets/dist-D6WgndTj.js +0 -1
  301. package/dist/assets/dist-DcXy-1eJ.js +0 -1
  302. package/dist/assets/dist-DsfPGbgk.js +0 -1
  303. package/dist/assets/dist-DtbtRAqz.js +0 -1
  304. package/dist/assets/dist-I3qeQWuP.js +0 -1
  305. package/dist/assets/dist-aeKlrIMv.js +0 -1
  306. package/dist/assets/dist-gDi2I7IJ.js +0 -1
  307. package/dist/assets/dist-miDa4-cz.js +0 -1
  308. package/dist/assets/dist-nDEBxpL6.js +0 -1
  309. package/dist/assets/dist-oUL4XFdB.js +0 -1
  310. package/dist/assets/file-explorer-panel-4h-BKKaM.js +0 -26
  311. package/dist/assets/house-DS0r7dNZ.js +0 -1
  312. package/dist/assets/index-BXlfeAku.js +0 -38
  313. package/dist/assets/index-DYycoCjG.css +0 -2
  314. package/dist/assets/process-output-Cm_vuKBw.js +0 -1
  315. package/dist/assets/react-vega-BLc5RhC7.js +0 -188
  316. package/dist/assets/scratchpad-panel-DJkO5OrI.js +0 -1
  317. package/dist/assets/state-Brswj8bD.js +0 -1
  318. package/dist/assets/switch-CONP-vq2.js +0 -1
  319. package/dist/assets/tooltip-B7U4xkIN.js +0 -61
  320. package/dist/assets/useNotebookActions-BHaEvPEM.js +0 -12
  321. package/dist/assets/useRunCells-kmbsc2R5.js +0 -1
  322. package/dist/assets/utils-BWBBpCkT.js +0 -1
  323. package/dist/assets/vega-loader.browser-Dun7Qe4B.js +0 -6
  324. /package/dist/assets/{bundle.esm-D0TWQ6iT.js → bundle.esm-CvMga-X6.js} +0 -0
  325. /package/dist/assets/{icons-CIPE8AIY.js → icons-NFYKylj6.js} +0 -0
  326. /package/dist/assets/{useDeepCompareMemoize-CSMoa-ga.js → useDeepCompareMemoize-BLRnan2Y.js} +0 -0
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./any-language-editor-BIeaxtdD.js","./copy-icon-neDQUo4Q.js","./button-DDGiD1NW.js","./useEventListener-C0195JsF.js","./objects-BlG0ZrO0.js","./compiler-runtime-B3qBwwSJ.js","./react-Bj1aDYRI.js","./chunk-LvLJmgfZ.js","./jsx-runtime-Blw4afVn.js","./cn-DYvqRARy.js","./clsx-XrBBnd7s.js","./tooltip-4bZlU7jl.js","./fullscreen-CTDqNQr6.js","./react-dom-CSu739Rf.js","./dist-BLN8PNJV.js","./use-toast-BwJoaaDM.js","./copy-Bxb1_Gtw.js","./check-rzLRd0j9.js","./createLucideIcon-w-Qo9n0R.js","./copy-3iHFdt22.js","./error-banner-BSxEOIn2.js","./alert-dialog-Bb8Lz8ko.js","./errors-PgHhDa-M.js","./zod-H_cgTO0M.js","./dist-CZvbHnyT.js","./dist-12S8I4CH.js","./dist-BJZAIIze.js","./dist-C-3FVUQA.js","./dist-DYEuVkEX.js","./dist-DnjsPBRJ.js","./dist-aRc_dRed.js","./dist-l4RTzHX-.js","./dist-fLBYOt9R.js","./dist-DcwTQG1A.js","./dist-DJuRuTXr.js","./dist-CPjTeT8p.js","./dist-BKgHjzML.js","./dist-kLs0VbW_.js","./dist-D47O3FBX.js","./dist-DQl27SFq.js","./esm-B30N1GS0.js","./extends-B9D0JO9U.js","./objectWithoutPropertiesLoose-CboCOq4o.js","./dist-CiVShZKM.js","./esm-BDGraAqp.js","./dist-DeJBvhAc.js","./dist-BP4hpPAE.js","./dist-C6_DArtj.js","./dist-DI1-Z60I.js","./dist-Cros4IAo.js","./dist-8SH6SWEG.js","./apl-Cp4QYSh2.js","./asciiarmor-BUxo-e6o.js","./asn1-Cp_b5sxr.js","./brainfuck-DmRCaE-Q.js","./clike--wVFVJzz.js","./clojure-xvpMtcD1.js","./cmake-ChD_WVwL.js","./cobol-B5K8KXv5.js","./coffeescript-EMaA6sFP.js","./commonlisp-BTUt7Wms.js","./crystal-CaYGQjnj.js","./css-Ci5CSFmt.js","./cypher-Bt0cHBYq.js","./d-Y6y0yT7l.js","./diff-DWzGHZfz.js","./dtd-CkphQXbR.js","./dylan-CPyS5Usd.js","./ecl-Dy8k_w5N.js","./eiffel-DZMtnEo6.js","./elm-CkuOc7z-.js","./erlang-CSyJ5dU6.js","./factor-xSp9WnN7.js","./simple-mode-lTjyt9i9.js","./forth-HHM4VU-4.js","./fortran-D_hdoGUs.js","./gas-DwXUGevO.js","./gherkin-6UjduaeQ.js","./groovy-BMSTiLIi.js","./haskell-CwQPWeas.js","./haxe-BwgB7edi.js","./idl-DaVQAS85.js","./javascript-DgYFgf02.js","./julia-ZzackTsi.js","./livescript-fyjJd0Zu.js","./lua-Cx9isc8d.js","./mathematica-BJvaPi1-.js","./mbox-43z3jriT.js","./mirc-B1ZSd8Bn.js","./mllike-DZwCuWJi.js","./modelica-DJJ2ie2z.js","./mscgen-CKYpxNp_.js","./mumps-DYGlTYd1.js","./nsis-SCfsPq8M.js","./ntriples-DizNPLuO.js","./octave-DdwI7gwd.js","./oz-DMPAJRti.js","./pascal-Do0zihr_.js","./perl-t4XY-5wj.js","./pig-CgweiC6M.js","./powershell-OQGwpWeH.js","./properties-BU4KenKz.js","./protobuf--IbBPde2.js","./pug-D81S7inS.js","./puppet-DkR_zpq4.js","./python-PdpM9cxt.js","./q-BmGsZsKc.js","./r-D1cPebaP.js","./rpm-CG3vlu2-.js","./ruby-BU2XuRQM.js","./sas-ig9j_2iC.js","./scheme-9DZXzBKN.js","./shell-BtigxJqY.js","./sieve-DJ-mn8HY.js","./smalltalk-Bn53uNk6.js","./sparql-mdFRPSSw.js","./stex-FMMSUPAS.js","./stylus-CUXYXPeL.js","./swift-BgwlI0GN.js","./tcl-B8Khjzwl.js","./textile-DmfgOrXO.js","./toml-CPrwnn25.js","./troff-Cb-2hp0t.js","./ttcn-cfg-O0cle81j.js","./ttcn-mp3DV9SP.js","./turtle-Bo_IjRT-.js","./vb-B84py4l9.js","./vbscript-DCWGTF8B.js","./velocity-COls9qbE.js","./verilog-Dn4JRpb3.js","./vhdl-DxQ-aNCu.js","./webidl-IlD_Nbdp.js","./xquery-DwkwsYYE.js","./yacas-CR27GINL.js","./z80-DDujbhXi.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as o}from"./createLucideIcon-w-Qo9n0R.js";import{t as m}from"./preload-helper-TXkS1QI3.js";let r,a,s=(async()=>{r=o("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),a=(0,e(i(),1).lazy)(()=>m(()=>import("./any-language-editor-BIeaxtdD.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134]),import.meta.url))})();export{s as __tla,r as n,a as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./any-language-editor-DUQN91an.js","./copy-icon-DWG8Y-xW.js","./button-BB1AV4Rb.js","./useEventListener-B_wSLgFR.js","./objects-BlG0ZrO0.js","./compiler-runtime-B3qBwwSJ.js","./react-Bj1aDYRI.js","./chunk-LvLJmgfZ.js","./jsx-runtime-Blw4afVn.js","./cn-DYvqRARy.js","./clsx-XrBBnd7s.js","./tooltip-BcgbFR7q.js","./fullscreen-B51geQ_6.js","./react-dom-CSu739Rf.js","./dist-Dza6FJtV.js","./use-toast-BwJoaaDM.js","./copy-B-LLR1Yy.js","./check-rzLRd0j9.js","./createLucideIcon-w-Qo9n0R.js","./copy-3iHFdt22.js","./error-banner-BkIr-0dH.js","./alert-dialog-DMh8_LWc.js","./errors-DCPV979Q.js","./zod-CIOjj3iA.js","./dist-bvfx5OQE.js","./dist-gUHullA_.js","./dist-DX04AOlt.js","./dist-BvMWjDxm.js","./dist-BblMEWTQ.js","./dist-BWXIz8tq.js","./dist-D5nYeU7Q.js","./dist-Drexw1Ir.js","./dist-CHN_sQZw.js","./dist-Jbd9zUbK.js","./dist-CfiLpZZj.js","./dist-6qzebh8f.js","./dist-C830fIIj.js","./dist-DmjT6iaH.js","./dist-CLQWOmD7.js","./dist-C52BqSeO.js","./esm-Bmzgrl_5.js","./extends-B9D0JO9U.js","./objectWithoutPropertiesLoose-CboCOq4o.js","./dist-C7rDfTPJ.js","./esm-Nb9m4lqg.js","./dist-ByfZ_2N7.js","./dist-BVr4HQPR.js","./dist-CxaoIFrU.js","./dist-DmCNk9gq.js","./dist-BWbS__vR.js","./dist-HrXjBuXP.js","./apl-Cp4QYSh2.js","./asciiarmor-BUxo-e6o.js","./asn1-Cp_b5sxr.js","./brainfuck-DmRCaE-Q.js","./clike--wVFVJzz.js","./clojure-xvpMtcD1.js","./cmake-ChD_WVwL.js","./cobol-B5K8KXv5.js","./coffeescript-EMaA6sFP.js","./commonlisp-BTUt7Wms.js","./crystal-CaYGQjnj.js","./css-Ci5CSFmt.js","./cypher-Bt0cHBYq.js","./d-Y6y0yT7l.js","./diff-DWzGHZfz.js","./dtd-CkphQXbR.js","./dylan-CPyS5Usd.js","./ecl-Dy8k_w5N.js","./eiffel-DZMtnEo6.js","./elm-CkuOc7z-.js","./erlang-CSyJ5dU6.js","./factor-xSp9WnN7.js","./simple-mode-lTjyt9i9.js","./forth-HHM4VU-4.js","./fortran-D_hdoGUs.js","./gas-DwXUGevO.js","./gherkin-6UjduaeQ.js","./groovy-BMSTiLIi.js","./haskell-CwQPWeas.js","./haxe-BwgB7edi.js","./idl-DaVQAS85.js","./javascript-DgYFgf02.js","./julia-ZzackTsi.js","./livescript-fyjJd0Zu.js","./lua-Cx9isc8d.js","./mathematica-BJvaPi1-.js","./mbox-43z3jriT.js","./mirc-B1ZSd8Bn.js","./mllike-DZwCuWJi.js","./modelica-DJJ2ie2z.js","./mscgen-CKYpxNp_.js","./mumps-DYGlTYd1.js","./nsis-SCfsPq8M.js","./ntriples-DizNPLuO.js","./octave-DdwI7gwd.js","./oz-DMPAJRti.js","./pascal-Do0zihr_.js","./perl-t4XY-5wj.js","./pig-CgweiC6M.js","./powershell-OQGwpWeH.js","./properties-BU4KenKz.js","./protobuf--IbBPde2.js","./pug-D81S7inS.js","./puppet-DkR_zpq4.js","./python-PdpM9cxt.js","./q-BmGsZsKc.js","./r-D1cPebaP.js","./rpm-CG3vlu2-.js","./ruby-BU2XuRQM.js","./sas-ig9j_2iC.js","./scheme-9DZXzBKN.js","./shell-BtigxJqY.js","./sieve-DJ-mn8HY.js","./smalltalk-Bn53uNk6.js","./sparql-mdFRPSSw.js","./stex-FMMSUPAS.js","./stylus-CUXYXPeL.js","./swift-BgwlI0GN.js","./tcl-B8Khjzwl.js","./textile-DmfgOrXO.js","./toml-CPrwnn25.js","./troff-Cb-2hp0t.js","./ttcn-cfg-O0cle81j.js","./ttcn-mp3DV9SP.js","./turtle-Bo_IjRT-.js","./vb-B84py4l9.js","./vbscript-DCWGTF8B.js","./velocity-COls9qbE.js","./verilog-Dn4JRpb3.js","./vhdl-DxQ-aNCu.js","./webidl-IlD_Nbdp.js","./xquery-DwkwsYYE.js","./yacas-CR27GINL.js","./z80-DDujbhXi.js"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as o}from"./createLucideIcon-w-Qo9n0R.js";import{t as m}from"./preload-helper-TXkS1QI3.js";let r,a,s=(async()=>{r=o("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),a=(0,e(i(),1).lazy)(()=>m(()=>import("./any-language-editor-DUQN91an.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134]),import.meta.url))})();export{s as __tla,r as n,a as t};
@@ -1,11 +1,11 @@
1
- import{s as le}from"./chunk-LvLJmgfZ.js";import{d as ae,f as ie,i as Qe,l as oe,n as He,p as Re,u as ce}from"./useEvent-D91BmmQi.js";import{t as Ve}from"./react-Bj1aDYRI.js";import{$n as de,Ar as Ke,Bn as me,E as Ge,Hi as Je,Kn as Y,Pr as Xe,Ui as pe,it as Ye,na as Z,y as Ze}from"./cells-DLYs3NiJ.js";import{t as A}from"./compiler-runtime-B3qBwwSJ.js";import{g as et,p as tt}from"./useEventListener-C0195JsF.js";import{t as st}from"./invariant-CkiqGLcK.js";import{a as rt,i as nt,x as lt}from"./utils-BWBBpCkT.js";import{t as ue}from"./cn-DYvqRARy.js";import{t as at}from"./jsx-runtime-Blw4afVn.js";import{a as it,i as ot,o as ct,r as dt,t as mt}from"./config-BJVx3eBW.js";import{a as pt,p as ut,r as xt,t as ht}from"./dropdown-menu-dHmZR8bI.js";import{t as Q}from"./tooltip-4bZlU7jl.js";import{r as xe,t as P}from"./button-DDGiD1NW.js";import{n as ft}from"./strings--BknHX9C.js";import{t as he}from"./createLucideIcon-w-Qo9n0R.js";import{t as gt}from"./check-rzLRd0j9.js";import{r as fe}from"./x-C-Eq0ag8.js";import{t as jt}from"./chevron-right-BS_NcSch.js";import{t as yt}from"./hat-glasses-BttHlyvs.js";import{t as bt}from"./package-Bxz_8e44.js";import{t as vt}from"./sparkles-DUCpRFlS.js";import{l as ge,r as Nt}from"./datasource-Bfg8PKXp.js";import{a as It}from"./dist-CPjTeT8p.js";import{t as wt}from"./uuid-ImXS-885.js";import{t as kt}from"./use-toast-BwJoaaDM.js";import{t as $t}from"./RenderHTML-BTDLQMKg.js";import{t as je}from"./kbd-C5HnBH5U.js";import{t as q}from"./links-wcQA1Np1.js";import{r as _t,t as At}from"./alert-jlwhGxSb.js";import{o as Tt,t as Ft}from"./useInstallPackage-WiYBwhUO.js";import{a as St,n as Ct}from"./state-Brswj8bD.js";import{n as $}from"./cell-link-D0aELsL_.js";var L=he("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),ye=he("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),be=String.raw`_cell_([^\W_][\w-]*?)(_\w*)`,ve=String.raw`(?<!_)${be}`;`${be}`;var Mt=new RegExp(ve),ee=new RegExp(ve,"g");function Ne(t){let e=[];ee.lastIndex=0;let n=0,r=ee.exec(t);for(;r!==null;)r.index>n&&e.push(t.slice(n,r.index)),e.push({cellId:r[1],name:r[2]}),n=r.index+r[0].length,r=ee.exec(t);return n<t.length&&e.push(t.slice(n)),e}function Pt(t){return Mt.test(t)}function Et(t){let e=null,n=t.cursor();do n.name==="ExpressionStatement"&&(e=n.node);while(n.next());return e}function zt(t){let e=t.split(`
2
- `),n=" ",r=Et(It.parse(t));if(!r)return["def _():",...te(e,n),`${n}return`,"","","_()"].join(`
1
+ import{s as le}from"./chunk-LvLJmgfZ.js";import{d as ae,f as ie,i as Qe,l as oe,n as Re,p as Ve,u as ce}from"./useEvent-D91BmmQi.js";import{t as He}from"./react-Bj1aDYRI.js";import{$n as de,Bn as me,E as Ke,Fr as Ge,Kn as Y,Ui as Je,Wi as pe,it as Xe,jr as Ye,ra as Z,y as Ze}from"./cells-DxL32Atg.js";import{t as A}from"./compiler-runtime-B3qBwwSJ.js";import{g as et,p as tt}from"./useEventListener-B_wSLgFR.js";import{t as st}from"./invariant-CkiqGLcK.js";import{a as rt,i as nt,x as lt}from"./utils-C5VWChv9.js";import{t as ue}from"./cn-DYvqRARy.js";import{t as at}from"./jsx-runtime-Blw4afVn.js";import{a as it,i as ot,o as ct,r as dt,t as mt}from"./config-BVfo0E1-.js";import{a as pt,p as ut,r as xt,t as ht}from"./dropdown-menu-BGBlPKNz.js";import{t as Q}from"./tooltip-BcgbFR7q.js";import{r as xe,t as E}from"./button-BB1AV4Rb.js";import{n as ft}from"./strings-DMKwTex-.js";import{t as he}from"./createLucideIcon-w-Qo9n0R.js";import{t as gt}from"./check-rzLRd0j9.js";import{r as fe}from"./x-C-Eq0ag8.js";import{t as jt}from"./chevron-right-BS_NcSch.js";import{t as yt}from"./hat-glasses-BttHlyvs.js";import{t as bt}from"./package-Bxz_8e44.js";import{t as vt}from"./sparkles-DUCpRFlS.js";import{l as ge,r as Nt}from"./datasource-D0eBPOXe.js";import{a as It}from"./dist-6qzebh8f.js";import{t as wt}from"./uuid-ImXS-885.js";import{t as kt}from"./use-toast-BwJoaaDM.js";import{t as $t}from"./RenderHTML-CQC8I348.js";import{t as je}from"./kbd-C5HnBH5U.js";import{t as q}from"./links-wcQA1Np1.js";import{r as _t,t as At}from"./alert-jlwhGxSb.js";import{o as Tt,t as Ft}from"./useInstallPackage-DyNrAhrx.js";import{n as St,o as Ct}from"./state-DDimGh2o.js";import{n as $}from"./cell-link-uPmFMRTh.js";var W=he("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),ye=he("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),be=String.raw`_cell_([^\W_][\w-]*?)(_\w*)`,ve=String.raw`(?<!_)${be}`;`${be}`;var Mt=new RegExp(ve),ee=new RegExp(ve,"g");function Ne(t){let e=[];ee.lastIndex=0;let n=0,r=ee.exec(t);for(;r!==null;)r.index>n&&e.push(t.slice(n,r.index)),e.push({cellId:r[1],name:r[2]}),n=r.index+r[0].length,r=ee.exec(t);return n<t.length&&e.push(t.slice(n)),e}function Et(t){return Mt.test(t)}function Pt(t){let e=null,n=t.cursor();do n.name==="ExpressionStatement"&&(e=n.node);while(n.next());return e}function zt(t){let e=t.split(`
2
+ `),n=" ",r=Pt(It.parse(t));if(!r)return["def _():",...te(e,n),`${n}return`,"","","_()"].join(`
3
3
  `);let a=t.slice(0,r.from).trim(),l=t.slice(r.from).trim(),o=a.split(`
4
4
  `),i=l.split(`
5
5
  `);return["def _():",...te(o,n),`${n}return ${i[0]}`,...te(i.slice(1),n),"","","_()"].join(`
6
- `)}function te(t,e){if(t.length===1&&t[0]==="")return[];let n=[];for(let r of t)r===""?n.push(""):n.push(e+r);return n}function qt(t,e){var n;if(t.type==="multiple-defs")return[{title:"Fix: Wrap in a function",description:"Make this cell's variables local by wrapping the cell in a function.",fixType:"manual",onFix:async r=>{st(r.editor,"Editor is null");let a=zt(r.editor.state.doc.toString());r.editor.dispatch({changes:{from:0,to:r.editor.state.doc.length,insert:a}})}}];if(t.type==="exception"&&t.exception_type==="NameError"){let r=(n=t.msg.match(/name '(.+)' is not defined/))==null?void 0:n[1];if(!r||!(r in Ie))return[];let a=Lt(r);return[{title:`Fix: Add '${a}'`,description:"Add a new cell for the missing import",fixType:"manual",onFix:async l=>{l.addCodeBelow(a)}}]}return t.type==="sql-error"&&e.aiEnabled?[{title:"Fix with AI",description:"Fix the SQL statement",fixType:"ai",onFix:async r=>{var o;let a=Nt(r.cellId,Qe),l=`Fix the SQL statement: ${t.msg}.`;a&&(l+=`
7
- Database schema: ${a}`),(o=r.aiFix)==null||o.setAiCompletionCell({cellId:r.cellId,initialPrompt:l,triggerImmediately:r.aiFix.triggerFix})}}]:[]}function Lt(t){let e=Ie[t];return e===t?`import ${e}`:`import ${e} as ${t}`}var Ie={mo:"marimo",alt:"altair",bokeh:"bokeh",dask:"dask",np:"numpy",pd:"pandas",pl:"polars",plotly:"plotly",plt:"matplotlib.pyplot",px:"plotly.express",scipy:"scipy",sk:"sklearn",sns:"seaborn",stats:"scipy.stats",tf:"tensorflow",torch:"torch",xr:"xarray",dt:"datetime",json:"json",math:"math",os:"os",re:"re",sys:"sys"},we=1;const H=Z("marimo:acp:sessions:v1",{sessions:[],activeTabId:null},Y),Wt=Re(t=>{let e=t(H);return e.activeTabId&&e.sessions.find(n=>n.tabId===e.activeTabId)||null},(t,e,n)=>{e(H,r=>({...r,activeTabId:n}))});function Dt(){return`tab_${wt()}`}function ke(t,e=20){return t.length<=e?t:`${t.slice(0,e-3)}...`}function Ut(t,e){let n=$e(e.agentId),r=Date.now(),a=e.firstMessage?ke(e.firstMessage.trim()):`New ${e.agentId} session`,l=Dt();if(n==="single"){let o=t.sessions.filter(c=>c.agentId===e.agentId),i=t.sessions.filter(c=>c.agentId!==e.agentId);if(o.length>0){let c=o[0],d={agentId:e.agentId,title:a,createdAt:r,lastUsedAt:r,tabId:c.tabId,externalAgentSessionId:null,selectedModel:e.model??c.selectedModel??null};return{...t,sessions:[...i.slice(0,we-1),d],activeTabId:d.tabId}}}return{...t,sessions:[...t.sessions.slice(0,we-1),{agentId:e.agentId,tabId:l,title:a,createdAt:r,lastUsedAt:r,externalAgentSessionId:null,selectedModel:e.model??null}],activeTabId:l}}function Bt(t,e){let n=t.sessions.filter(r=>r.tabId!==e);return{sessions:n,activeTabId:t.activeTabId===e?n.length>0?n[n.length-1].tabId:null:t.activeTabId}}function Ot(t,e){let n=t.activeTabId;return n?{...t,sessions:t.sessions.map(r=>r.tabId===n?{...r,title:ke(e)}:r)}:t}function Qt(t,e){return{...t,sessions:t.sessions.map(n=>n.tabId===e?{...n,lastUsedAt:Date.now()}:n)}}function Ht(t,e){let n=t.activeTabId;return n?{...t,sessions:t.sessions.map(r=>r.tabId===n?{...r,externalAgentSessionId:e,lastUsedAt:Date.now()}:r)}:t}function Rt(){return["claude","gemini","codex","opencode","cursor"]}function Vt(t){return ft(t)}function Kt(t){let e=R[t].port,n=window.location.hostname;return`${window.location.protocol==="https:"?"wss:":"ws:"}//${n}:${e}/message`}var R={claude:{port:3017,command:"npx @zed-industries/claude-code-acp",sessionSupport:"single"},gemini:{port:3019,command:"npx @google/gemini-cli --experimental-acp",sessionSupport:"single"},codex:{port:3021,command:"npx @zed-industries/codex-acp",sessionSupport:"single"},opencode:{port:3023,command:"npx opencode-ai acp",sessionSupport:"single"},cursor:{port:3025,command:"agent acp",sessionSupport:"single"}};function $e(t){return R[t].sessionSupport}function Gt(t){let e=R[t].port,n=R[t].command;return`npx stdio-to-ws "${tt()?`cmd /c ${n}`:n}" --port ${e}`}var Jt=A();const _e=Z("marimo:chrome:ai-panel-tab","chat",Y);function Ae(){let t=(0,Jt.c)(3),[e,n]=oe(_e),r;return t[0]!==e||t[1]!==n?(r={aiPanelTab:e,setAiPanelTab:n},t[0]=e,t[1]=n,t[2]=r):r=t[2],r}var Xt=A(),Yt="code_mode";function Zt(t,e){return t||(de("external_agents")?e:"chat")}function Te(){let t=(0,Xt.c)(6),{openApplication:e}=me(),{setAiPanelTab:n}=Ae(),{saveModeChange:r}=mt(),a=ae(St),l=ie(),o;return t[0]!==e||t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==l?(o=async i=>{let c=Zt(i.panel,l.get(_e)),d=l.get(rt),p=de("external_agents")&&l.get(H).sessions.length>0;if(!(c==="agents"?p:d)){kt({title:c==="agents"?"No agent session":"AI not configured",description:c==="agents"?"Start an agent session or switch to the chat panel.":"Configure an AI provider and chat model to fix with AI.",variant:"danger"});return}i.panel&&n(i.panel),c==="chat"&&await r(Yt).catch(es),a({prompt:i.prompt,submit:i.submit??!1}),e("ai")},t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=l,t[5]=o):o=t[5],He(o)}function es(){return et.error("Failed to save mode change")}var ts=A(),ss=Z("marimo:ai-autofix-mode","autofix",Y);function rs(){let t=(0,ts.c)(3),[e,n]=oe(ss),r;return t[0]!==e||t[1]!==n?(r={fixMode:e,setFixMode:n},t[0]=e,t[1]=n,t[2]=r):r=t[2],r}var se=A(),s=le(at(),1);function Fe(t,e){if(t!=null)return`@error://${t}
6
+ `)}function te(t,e){if(t.length===1&&t[0]==="")return[];let n=[];for(let r of t)r===""?n.push(""):n.push(e+r);return n}function qt(t,e){var n;if(t.type==="multiple-defs")return[{title:"Fix: Wrap in a function",description:"Make this cell's variables local by wrapping the cell in a function.",fixType:"manual",onFix:async r=>{st(r.editor,"Editor is null");let a=zt(r.editor.state.doc.toString());r.editor.dispatch({changes:{from:0,to:r.editor.state.doc.length,insert:a}})}}];if(t.type==="exception"&&t.exception_type==="NameError"){let r=(n=t.msg.match(/name '(.+)' is not defined/))==null?void 0:n[1];if(!r||!(r in Ie))return[];let a=Wt(r);return[{title:`Fix: Add '${a}'`,description:"Add a new cell for the missing import",fixType:"manual",onFix:async l=>{l.addCodeBelow(a)}}]}return t.type==="sql-error"&&e.aiEnabled?[{title:"Fix with AI",description:"Fix the SQL statement",fixType:"ai",onFix:async r=>{var o;let a=Nt(r.cellId,Qe),l=`Fix the SQL statement: ${t.msg}.`;a&&(l+=`
7
+ Database schema: ${a}`),(o=r.aiFix)==null||o.setAiCompletionCell({cellId:r.cellId,initialPrompt:l,triggerImmediately:r.aiFix.triggerFix})}}]:[]}function Wt(t){let e=Ie[t];return e===t?`import ${e}`:`import ${e} as ${t}`}var Ie={mo:"marimo",alt:"altair",bokeh:"bokeh",dask:"dask",np:"numpy",pd:"pandas",pl:"polars",plotly:"plotly",plt:"matplotlib.pyplot",px:"plotly.express",scipy:"scipy",sk:"sklearn",sns:"seaborn",stats:"scipy.stats",tf:"tensorflow",torch:"torch",xr:"xarray",dt:"datetime",json:"json",math:"math",os:"os",re:"re",sys:"sys"},we=1;const R=Z("marimo:acp:sessions:v1",{sessions:[],activeTabId:null},Y),Lt=Ve(t=>{let e=t(R);return e.activeTabId&&e.sessions.find(n=>n.tabId===e.activeTabId)||null},(t,e,n)=>{e(R,r=>({...r,activeTabId:n}))});function Dt(){return`tab_${wt()}`}function ke(t,e=20){return t.length<=e?t:`${t.slice(0,e-3)}...`}function Ut(t,e){let n=$e(e.agentId),r=Date.now(),a=e.firstMessage?ke(e.firstMessage.trim()):`New ${e.agentId} session`,l=Dt();if(n==="single"){let o=t.sessions.filter(c=>c.agentId===e.agentId),i=t.sessions.filter(c=>c.agentId!==e.agentId);if(o.length>0){let c=o[0],d={agentId:e.agentId,title:a,createdAt:r,lastUsedAt:r,tabId:c.tabId,externalAgentSessionId:null,selectedModel:e.model??c.selectedModel??null};return{...t,sessions:[...i.slice(0,we-1),d],activeTabId:d.tabId}}}return{...t,sessions:[...t.sessions.slice(0,we-1),{agentId:e.agentId,tabId:l,title:a,createdAt:r,lastUsedAt:r,externalAgentSessionId:null,selectedModel:e.model??null}],activeTabId:l}}function Bt(t,e){let n=t.sessions.filter(r=>r.tabId!==e);return{sessions:n,activeTabId:t.activeTabId===e?n.length>0?n[n.length-1].tabId:null:t.activeTabId}}function Ot(t,e){let n=t.activeTabId;return n?{...t,sessions:t.sessions.map(r=>r.tabId===n?{...r,title:ke(e)}:r)}:t}function Qt(t,e){return{...t,sessions:t.sessions.map(n=>n.tabId===e?{...n,lastUsedAt:Date.now()}:n)}}function Rt(t,e){let n=t.activeTabId;return n?{...t,sessions:t.sessions.map(r=>r.tabId===n?{...r,externalAgentSessionId:e,lastUsedAt:Date.now()}:r)}:t}function Vt(){return["claude","gemini","codex","opencode","cursor"]}function Ht(t){return ft(t)}function Kt(t){let e=V[t].port,n=window.location.hostname;return`${window.location.protocol==="https:"?"wss:":"ws:"}//${n}:${e}/message`}var V={claude:{port:3017,command:"npx @zed-industries/claude-code-acp",sessionSupport:"single"},gemini:{port:3019,command:"npx @google/gemini-cli --experimental-acp",sessionSupport:"single"},codex:{port:3021,command:"npx @zed-industries/codex-acp",sessionSupport:"single"},opencode:{port:3023,command:"npx opencode-ai acp",sessionSupport:"single"},cursor:{port:3025,command:"agent acp",sessionSupport:"single"}};function $e(t){return V[t].sessionSupport}function Gt(t){let e=V[t].port,n=V[t].command;return`npx stdio-to-ws "${tt()?`cmd /c ${n}`:n}" --port ${e}`}var Jt=A();const _e=Z("marimo:chrome:ai-panel-tab","chat",Y);function Ae(){let t=(0,Jt.c)(3),[e,n]=oe(_e),r;return t[0]!==e||t[1]!==n?(r={aiPanelTab:e,setAiPanelTab:n},t[0]=e,t[1]=n,t[2]=r):r=t[2],r}var Xt=A(),Yt="code_mode";function Zt(t,e){return t||(de("external_agents")?e:"chat")}function Te(){let t=(0,Xt.c)(6),{openApplication:e}=me(),{setAiPanelTab:n}=Ae(),{saveModeChange:r}=mt(),a=ae(Ct),l=ie(),o;return t[0]!==e||t[1]!==r||t[2]!==n||t[3]!==a||t[4]!==l?(o=async i=>{let c=Zt(i.panel,l.get(_e)),d=l.get(rt),p=de("external_agents")&&l.get(R).sessions.length>0;if(!(c==="agents"?p:d)){kt({title:c==="agents"?"No agent session":"AI not configured",description:c==="agents"?"Start an agent session or switch to the chat panel.":"Configure an AI provider and chat model to fix with AI.",variant:"danger"});return}i.panel&&n(i.panel),c==="chat"&&await r(Yt).catch(es),a({prompt:i.prompt,submit:i.submit??!1}),e("ai")},t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=l,t[5]=o):o=t[5],Re(o)}function es(){return et.error("Failed to save mode change")}var ts=A(),ss=Z("marimo:ai-autofix-mode","autofix",Y);function rs(){let t=(0,ts.c)(3),[e,n]=oe(ss),r;return t[0]!==e||t[1]!==n?(r={fixMode:e,setFixMode:n},t[0]=e,t[1]=n,t[2]=r):r=t[2],r}var se=A(),s=le(at(),1);function Fe(t,e){if(t!=null)return`@error://${t}
8
8
 
9
9
  Please fix this error.`;let n=e==null?void 0:e.trim();return n?`My code gives the following error. Please fix it:
10
10
 
11
- ${n}`:"Please fix this error."}const w=t=>{let e=(0,se.c)(25),{errors:n,cellId:r,className:a}=t,l=ie(),{createNewCell:o}=Ge(),i=ce(nt),c;if(e[0]!==i||e[1]!==n){let v;e[3]===i?v=e[4]:(v=k=>qt(k,{aiEnabled:i}),e[3]=i,e[4]=v),c=n.flatMap(v),e[0]=i,e[1]=n,e[2]=c}else c=e[2];let d=c,p=ae(Ct),u=Te();if(d.length===0)return null;let m=d[0],x;e[5]!==r||e[6]!==o||e[7]!==m||e[8]!==p||e[9]!==l?(x=v=>{var S;let k=(S=l.get(Ze).cellHandles[r].current)==null?void 0:S.editorView;m.onFix({addCodeBelow:E=>{o({cellId:r,autoFocus:!1,before:!1,code:E})},editor:k,cellId:r,aiFix:{setAiCompletionCell:p,triggerFix:v}}),k==null||k.focus()},e[5]=r,e[6]=o,e[7]=m,e[8]=p,e[9]=l,e[10]=x):x=e[10];let g=x,h;e[11]!==r||e[12]!==u?(h=()=>{u({prompt:Fe(r)})},e[11]=r,e[12]=u,e[13]=h):h=e[13];let y=h,j;e[14]===a?j=e[15]:(j=ue("my-2",a),e[14]=a,e[15]=j);let b;e[16]!==m.description||e[17]!==m.fixType||e[18]!==m.title||e[19]!==g||e[20]!==y?(b=m.fixType==="ai"?(0,s.jsx)(Ce,{tooltip:m.description,openPrompt:()=>g(!1),applyAutofix:()=>g(!0),openChat:y}):(0,s.jsx)(Q,{content:m.description,align:"start",children:(0,s.jsxs)(P,{size:"xs",variant:"outline",className:"font-normal",onClick:()=>g(!1),children:[(0,s.jsx)(ge,{className:"h-3 w-3 mr-2"}),m.title]})}),e[16]=m.description,e[17]=m.fixType,e[18]=m.title,e[19]=g,e[20]=y,e[21]=b):b=e[21];let N;return e[22]!==j||e[23]!==b?(N=(0,s.jsx)("div",{className:j,children:b}),e[22]=j,e[23]=b,e[24]=N):N=e[24],N};var Se={autofix:{Icon:ge,title:"Inline AI Fix",description:"Apply AI fixes inline in the cell"},chat:{Icon:yt,title:"Fix with AI assistant",description:"Open the AI sidebar to fix"},prompt:{Icon:vt,title:"Suggest a prompt",description:"Edit the prompt before applying"}},ns=["autofix","prompt","chat"];const Ce=t=>{let e=(0,se.c)(18),{tooltip:n,openPrompt:r,applyAutofix:a,openChat:l}=t,{fixMode:o,setFixMode:i}=rs(),c=r;o==="chat"?c=l:o==="autofix"&&(c=a);let{Icon:d,title:p}=Se[o],u;e[0]===d?u=e[1]:(u=(0,s.jsx)(d,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=d,e[1]=u);let m;e[2]!==c||e[3]!==u||e[4]!==p?(m=(0,s.jsxs)(P,{size:"xs",variant:"outline",className:"font-normal rounded-r-none border-r-0",onClick:c,children:[u,p]}),e[2]=c,e[3]=u,e[4]=p,e[5]=m):m=e[5];let x;e[6]!==m||e[7]!==n?(x=(0,s.jsx)(Q,{content:n,align:"start",children:m}),e[6]=m,e[7]=n,e[8]=x):x=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=(0,s.jsx)(ut,{asChild:!0,children:(0,s.jsx)(P,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,s.jsx)(fe,{className:"h-3 w-3"})})}),e[9]=g):g=e[9];let h;e[10]!==o||e[11]!==i?(h=ns.map(b=>(0,s.jsx)(pt,{className:"flex items-center gap-2",onClick:()=>i(b),children:(0,s.jsx)(ls,{mode:b,selected:b===o})},b)),e[10]=o,e[11]=i,e[12]=h):h=e[12];let y;e[13]===h?y=e[14]:(y=(0,s.jsxs)(ht,{children:[g,(0,s.jsx)(xt,{align:"end",className:"w-56",children:h})]}),e[13]=h,e[14]=y);let j;return e[15]!==x||e[16]!==y?(j=(0,s.jsxs)("div",{className:"flex",children:[x,y]}),e[15]=x,e[16]=y,e[17]=j):j=e[17],j};var ls=t=>{let e=(0,se.c)(15),{mode:n,selected:r}=t,{Icon:a,title:l,description:o}=Se[n],i;e[0]===a?i=e[1]:(i=(0,s.jsx)(a,{className:"h-4 w-4 shrink-0"}),e[0]=a,e[1]=i);let c;e[2]===l?c=e[3]:(c=(0,s.jsx)("span",{className:"font-medium",children:l}),e[2]=l,e[3]=c);let d;e[4]===o?d=e[5]:(d=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=d);let p;e[6]!==c||e[7]!==d?(p=(0,s.jsxs)("div",{className:"flex flex-col",children:[c,d]}),e[6]=c,e[7]=d,e[8]=p):p=e[8];let u;e[9]===r?u=e[10]:(u=r&&(0,s.jsx)(gt,{className:"h-4 w-4 ml-auto shrink-0"}),e[9]=r,e[10]=u);let m;return e[11]!==i||e[12]!==p||e[13]!==u?(m=(0,s.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[i,p,u]}),e[11]=i,e[12]=p,e[13]=u,e[14]=m):m=e[14],m},Me=A();const as=t=>{let e=(0,Me.c)(12),{local:n}=t,r;e[0]===n.name?r=e[1]:(r=(0,s.jsx)("span",{className:"font-code",children:n.name}),e[0]=n.name,e[1]=r);let a;e[2]===n.cellId?a=e[3]:(a=(0,s.jsx)($,{cellId:n.cellId}),e[2]=n.cellId,e[3]=a);let l;e[4]!==r||e[5]!==a?(l=(0,s.jsxs)("div",{className:"max-w-xs",children:["Local variable ",r," in cell"," ",a,"."]}),e[4]=r,e[5]=a,e[6]=l):l=e[6];let o=l,i;e[7]===n.name?i=e[8]:(i=(0,s.jsx)("span",{className:"font-code cursor-help",children:n.name}),e[7]=n.name,e[8]=i);let c;return e[9]!==i||e[10]!==o?(c=(0,s.jsx)(Q,{content:o,children:i}),e[9]=i,e[10]=o,e[11]=c):c=e[11],c},Pe=t=>{let e=(0,Me.c)(4),{segments:n}=t,r;e[0]===n?r=e[1]:(r=n.map(is),e[0]=n,e[1]=r);let a;return e[2]===r?a=e[3]:(a=(0,s.jsx)(s.Fragment,{children:r}),e[2]=r,e[3]=a),a};function is(t,e){return typeof t=="string"?(0,s.jsx)("span",{children:t},e):(0,s.jsx)(as,{local:t},e)}var Ee=/(https?:\/\/\S+)/,os=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,ze=/^data:image\//i,cs=["avatars.githubusercontent.com"];function qe(t){return ze.test(t)?[{type:"image",url:t}]:t.split(Ee).filter(e=>e!=="").map(e=>Ee.test(e)?os.test(e)||ze.test(e)||cs.some(n=>e.includes(n))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var Le=A(),W=le(Ve(),1),ds=new Ye;const re=t=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return t.replaceAll(e,"")};var We=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function ms(t){We.lastIndex=0;let e=We.exec(t);if(!e)return null;let n=e.index+e[0].length,r=t.slice(n).split(/\s+/),a="",l=0;for(let i of r){let c=i.trim();if(!c)continue;if(c.startsWith("-")){l+=c.length+1;continue}let d=c.match(/^[\w,.[\]-]+/);if(d){a=d[0];break}break}if(!a)return null;let o=n+l+a.length;return{package:a,endIndex:o}}function T(t,e=""){if(!t)return null;if(!/https?:\/\//.test(t))return t;let n=qe(t);return n.length===1&&n[0].type==="text"?t:(0,s.jsx)(s.Fragment,{children:n.map((r,a)=>{let l=e?`${e}-${a}`:a;if(r.type==="url"){let o=re(r.url);return(0,s.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",onClick:xe.stopPropagation(),className:"text-link hover:underline",children:o},l)}if(r.type==="image"){let o=re(r.url);return(0,s.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",onClick:xe.stopPropagation(),className:"text-link hover:underline",children:o},l)}return(0,s.jsx)(W.Fragment,{children:r.value},l)})})}var ps=t=>{let e=(0,Le.c)(6),{packages:n,children:r}=t,{handleInstallPackages:a}=Ft(),l;e[0]!==a||e[1]!==n?(l=i=>{a(n),i.preventDefault()},e[0]=a,e[1]=n,e[2]=l):l=e[2];let o;return e[3]!==r||e[4]!==l?(o=(0,s.jsx)("button",{onClick:l,className:"text-link hover:underline",type:"button",children:r}),e[3]=r,e[4]=l,e[5]=o):o=e[5],o};const us=t=>{if(!(t instanceof pe.Text))return;let e=re(t.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(e))return;let n=[],r=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,a;for(;(a=r.exec(e))!==null;){let i=a.index,c=ms(e.slice(i));c&&n.push({match:a,result:c})}if(n.length===0)return;let l=[],o=0;if(n.forEach((i,c)=>{let{match:d,result:p}=i,u=d.index,m=u+p.endIndex;if(o<u){let g=e.slice(o,u);l.push((0,s.jsx)(W.Fragment,{children:T(g,`before-${c}`)},`before-${c}`))}let x=e.slice(u,m);l.push((0,s.jsx)(ps,{packages:[p.package],children:x},`install-${c}`)),o=m}),o<e.length){let i=e.slice(o);l.push((0,s.jsx)(W.Fragment,{children:T(i,"after")},"after"))}return(0,s.jsx)(s.Fragment,{children:l})},xs=t=>{if(!(t instanceof pe.Text))return;let e=t.data;if(!/https?:\/\//.test(e))return;let n=T(e);if(typeof n!="string")return(0,s.jsx)(s.Fragment,{children:n})},hs=(...t)=>e=>{for(let n of t){let r=n(e);if(r!==void 0)return r}},fs=(t,e)=>(0,s.jsx)("span",{children:Je(ds.ansi_to_html(t),{replace:n=>e(n)})}),gs=t=>{let e=(0,Le.c)(4),{text:n}=t,r;e[0]===n?r=e[1]:(r=fs(n,hs(us,xs)),e[0]=n,e[1]=r);let a=r,l;return e[2]===a?l=e[3]:(l=(0,s.jsx)(s.Fragment,{children:a}),e[2]=a,e[3]=l),l};var ne=A(),De=t=>{let e=(0,ne.c)(16),{traceback:n}=t,[r,a]=(0,W.useState)(!0),l;e[0]===r?l=e[1]:(l=()=>a(!r),e[0]=r,e[1]=l);let o=r?"Collapse traceback":"Expand traceback",i;e[2]===r?i=e[3]:(i=r?(0,s.jsx)(fe,{className:"h-3 w-3"}):(0,s.jsx)(jt,{className:"h-3 w-3"}),e[2]=r,e[3]=i);let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)("span",{className:"text-[0.6875rem] uppercase tracking-wider",children:"Traceback"}),e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==l||e[7]!==o||e[8]!==i?(d=(0,s.jsxs)("button",{type:"button",onClick:l,"aria-expanded":r,"aria-label":o,className:"flex items-center gap-1 text-muted-foreground/70 hover:text-muted-foreground transition-colors",children:[i,c]}),e[5]=r,e[6]=l,e[7]=o,e[8]=i,e[9]=d):d=e[9];let p;e[10]!==r||e[11]!==n?(p=r&&(0,s.jsx)("div",{className:"font-code text-sm mt-1 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text",children:$t({html:n})}),e[10]=r,e[11]=n,e[12]=p):p=e[12];let u;return e[13]!==d||e[14]!==p?(u=(0,s.jsxs)("div",{className:"mt-2",children:[d,p]}),e[13]=d,e[14]=p,e[15]=u):u=e[15],u},F=t=>{let e=(0,ne.c)(10),n=t.title??"Tip",r;e[0]===n?r=e[1]:(r=(0,s.jsx)(ct,{className:"pt-2 pb-0 font-normal",children:n}),e[0]=n,e[1]=r);let a;e[2]===t.children?a=e[3]:(a=(0,s.jsx)(ot,{className:"mr-24 text-[0.84375rem]",wrapperClassName:"pt-0 pb-2",children:t.children}),e[2]=t.children,e[3]=a);let l;e[4]!==r||e[5]!==a?(l=(0,s.jsxs)(it,{value:"item-1",className:"text-muted-foreground",children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6];let o;return e[7]!==t.className||e[8]!==l?(o=(0,s.jsx)(dt,{type:"single",collapsible:!0,className:t.className,children:l}),e[7]=t.className,e[8]=l,e[9]=o):o=e[9],o};const js=t=>{let e=(0,ne.c)(38),{errors:n,cellId:r,className:a}=t,l=me(),o=ce(lt).display.cell_output==="above",i="This cell wasn't run because it has errors",c="destructive",d="text-error",p=null;if(n.some(ys))i="Interrupted";else if(n.some(bs))i="An internal error occurred";else if(n.some(vs))i="Ancestor prevented from running",c="default",d="text-secondary-foreground";else if(n.some(Ns))i="Ancestor stopped",c="default",d="text-secondary-foreground";else if(n.some(Is))i="SQL error";else if(n.some(ws))i=null,p="Cell not run";else{let N;e[0]===n?N=e[1]:(N=n.find(ks),e[0]=n,e[1]=N);let v=N;v&&"exception_type"in v&&(i=v.exception_type)}let u,m,x,g,h,y;if(e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==a||e[6]!==n||e[7]!==o||e[8]!==p||e[9]!==d||e[10]!==i){let N=n.filter($s),v=n.filter(_s),k=n.filter(As),S=n.filter(Ts),E=n.filter(Fs),D=n.filter(Ss),U=n.filter(Cs),V=n.filter(Ms),K=n.filter(Ps),G=n.filter(Es),z=n.filter(zs),J=n.filter(qs),X=n.filter(Ls),B;e[17]===l?B=e[18]:(B=()=>{l.openApplication("scratchpad")},e[17]=l,e[18]=B);let Ue=B,Be=()=>{let I=[];if(z.length>0||J.length>0){let f=z.some(Ws),_=!f&&z.some(Ds);I.push((0,s.jsxs)("div",{children:[z.map(Us),J.map(Bs),f&&(0,s.jsxs)(P,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Tt(l),children:[(0,s.jsx)(bt,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,s.jsx)("span",{children:"Open package manager"})]}),_&&(0,s.jsxs)(P,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openApplication("terminal"),children:[(0,s.jsx)(ye,{className:"h-3.5 w-3.5 mr-1.5"}),(0,s.jsx)("span",{children:"Open terminal"})]}),r&&(0,s.jsx)(w,{errors:[...z,...J],cellId:r})]},"syntax-unknown"))}if(N.length>0&&I.push((0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground font-medium",children:"The setup cell cannot be run because it has references."}),(0,s.jsx)("ul",{className:"list-disc",children:N.flatMap(Os)}),r&&(0,s.jsx)(w,{errors:N,cellId:r}),(0,s.jsxs)(F,{title:"Why can't the setup cell have references?",className:"mb-2",children:[(0,s.jsx)("p",{className:"pb-2",children:"The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables."}),(0,s.jsx)("p",{className:"py-2",children:"Try simplifying the setup cell to only contain only necessary variables."}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,s.jsx)(L,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"setup-refs")),v.length>0&&I.push((0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell is in a cycle."}),(0,s.jsx)("ul",{className:"list-disc",children:v.flatMap(Qs)}),r&&(0,s.jsx)(w,{errors:v,cellId:r}),(0,s.jsxs)(F,{title:"What are cycles and how do I resolve them?",className:"mb-2",children:[(0,s.jsx)("p",{className:"pb-2",children:"An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug."}),(0,s.jsx)("p",{className:"py-2",children:"Try merging these cells into a single cell to eliminate the cycle."}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,s.jsx)(L,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"cycle")),k.length>0){let f=k[0].name;I.push((0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell redefines variables from other cells."}),k.map(Rs),r&&(0,s.jsx)(w,{errors:k,cellId:r}),(0,s.jsxs)(F,{title:"Why can't I redefine variables?",children:[(0,s.jsx)("p",{className:"pb-2",children:"marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more."}),(0,s.jsxs)("p",{className:"py-2",children:["Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., ",(0,s.jsxs)(je,{className:"inline",children:["_",f]}),"). to make them private to this cell."]}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,s.jsx)(L,{size:"0.75rem",className:"inline"})]}),"."]})]}),(0,s.jsx)(F,{title:"Need a scratchpad?",children:(0,s.jsxs)("div",{className:"flex flex-row gap-2 items-center",children:[(0,s.jsxs)(P,{size:"xs",variant:"link",className:"my-2 font-normal mx-0 px-0",onClick:Ue,children:[(0,s.jsx)(Ke,{className:"h-3"}),(0,s.jsx)("span",{children:"Try the scratchpad"})]}),(0,s.jsx)("span",{children:"to experiment without restrictions on variable names."})]})})]},"multiple-defs"))}return S.length>0&&I.push((0,s.jsxs)("div",{children:[S.map(Vs),r&&(0,s.jsx)(w,{errors:S,cellId:r}),(0,s.jsxs)(F,{title:"Why can't I use `import *`?",children:[(0,s.jsx)("p",{className:"pb-2",children:"Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution."}),(0,s.jsx)("p",{className:"py-2",children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,s.jsx)("p",{className:"py-2",children:"Star imports would also silently add names to globals, which would be incompatible with reactive execution."}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,s.jsx)(L,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),E.length>0&&I.push((0,s.jsxs)("div",{children:[E.map(Ks),r&&(0,s.jsx)(w,{errors:E,cellId:r})]},"interruption")),D.length>0&&I.push((0,s.jsxs)("ul",{children:[D.map((f,_)=>f.exception_type==="NameError"&&f.msg.startsWith("name 'mo'")?(0,s.jsx)("li",{className:"my-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground",children:"name 'mo' is not defined."}),(0,s.jsxs)("p",{className:"text-muted-foreground mt-2",children:["The marimo module (imported as"," ",(0,s.jsx)(je,{className:"inline",children:"mo"}),") is required for Markdown, SQL, and UI elements."]})]})},`exception-${_}`):f.exception_type==="NameError"&&f.msg.startsWith("name '_")?(0,s.jsx)("li",{className:"my-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground",children:(0,s.jsx)(Pe,{segments:Ne(f.msg)})}),(0,s.jsxs)("p",{className:"text-muted-foreground mt-2",children:["Variables prefixed with an underscore are local to a cell"," ","(",(0,s.jsxs)(q,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,s.jsx)(L,{size:"0.75rem",className:"inline"})]}),")."]}),o&&(0,s.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]})},`exception-${_}`):(0,s.jsx)("li",{className:"my-2",children:f.raising_cell==null?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground",children:T(f.msg,`exception-${_}`)}),"traceback"in f&&f.traceback?(0,s.jsx)(De,{traceback:f.traceback}):o&&(0,s.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]}):(0,s.jsxs)("div",{children:[T(f.msg,`exception-${_}`),(0,s.jsx)($,{cellId:f.raising_cell}),"traceback"in f&&f.traceback&&(0,s.jsx)(De,{traceback:f.traceback})]})},`exception-${_}`)),D.some(Gs)&&(0,s.jsx)(F,{children:"Fix the error in the mentioned cells, or handle the exceptions with try/except blocks."}),r&&(0,s.jsx)(w,{errors:D,cellId:r})]},"exception")),U.length>0&&I.push((0,s.jsxs)("ul",{children:[U.map(Js),r&&(0,s.jsx)(w,{errors:U,cellId:r}),(0,s.jsx)(F,{children:U.some(Xs)?"Ensure that the referenced cells define the required variables, or turn off strict execution.":"Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution."})]},"strict-exception")),V.length>0&&I.push((0,s.jsxs)("div",{children:[V.map(Ys),r&&(0,s.jsx)(w,{errors:V,cellId:r})]},"internal")),K.length>0&&I.push((0,s.jsxs)("div",{children:[K.map(Zs),r&&(0,s.jsx)(w,{errors:K,cellId:r})]},"ancestor-prevented")),G.length>0&&I.push((0,s.jsxs)("div",{children:[G.map(er),r&&(0,s.jsx)(w,{errors:G,cellId:r})]},"ancestor-stopped")),X.length>0&&I.push((0,s.jsxs)("div",{children:[X.map(tr),r&&(0,s.jsx)(w,{errors:X,cellId:r,className:"mt-2.5"})]},"sql-errors")),I},C;e[19]===p?C=e[20]:(C=p&&(0,s.jsxs)("div",{className:"flex items-center gap-1 font-code text-[0.6875rem] uppercase tracking-wider text-muted-foreground/70",children:[p,(0,s.jsx)(Q,{content:"marimo didn't run this cell because it detected an error.",delayDuration:200,children:(0,s.jsx)(Xe,{className:"size-3 cursor-help"})})]}),e[19]=p,e[20]=C);let M;e[21]!==d||e[22]!==i?(M=i&&(0,s.jsx)(_t,{className:`font-code font-medium ${d}`,children:i}),e[21]=d,e[22]=i,e[23]=M):M=e[23];let O;e[24]!==C||e[25]!==M?(O=(0,s.jsxs)("div",{className:"space-y-0.5",children:[C,M]}),e[24]=C,e[25]=M,e[26]=O):O=e[26];let Oe=O;u=At,g=c,e[27]===a?h=e[28]:(h=ue("border-none font-code text-sm text-[0.84375rem] p-0 text-muted-foreground normal has-[svg]:pl-0 space-y-2",a),e[27]=a,e[28]=h),y=Oe,m="flex flex-col gap-4",x=Be(),e[2]=c,e[3]=r,e[4]=l,e[5]=a,e[6]=n,e[7]=o,e[8]=p,e[9]=d,e[10]=i,e[11]=u,e[12]=m,e[13]=x,e[14]=g,e[15]=h,e[16]=y}else u=e[11],m=e[12],x=e[13],g=e[14],h=e[15],y=e[16];let j;e[29]!==m||e[30]!==x?(j=(0,s.jsx)("div",{className:m,children:x}),e[29]=m,e[30]=x,e[31]=j):j=e[31];let b;return e[32]!==u||e[33]!==g||e[34]!==h||e[35]!==y||e[36]!==j?(b=(0,s.jsxs)(u,{variant:g,className:h,children:[y,j]}),e[32]=u,e[33]=g,e[34]=h,e[35]=y,e[36]=j,e[37]=b):b=e[37],b};function ys(t){return t.type==="interruption"}function bs(t){return t.type==="internal"}function vs(t){return t.type==="ancestor-prevented"}function Ns(t){return t.type==="ancestor-stopped"}function Is(t){return t.type==="sql-error"}function ws(t){return t.type==="multiple-defs"||t.type==="cycle"||t.type==="setup-refs"||t.type==="import-star"}function ks(t){return t.type==="exception"}function $s(t){return t.type==="setup-refs"}function _s(t){return t.type==="cycle"}function As(t){return t.type==="multiple-defs"}function Ts(t){return t.type==="import-star"}function Fs(t){return t.type==="interruption"}function Ss(t){return t.type==="exception"}function Cs(t){return t.type==="strict-exception"}function Ms(t){return t.type==="internal"}function Ps(t){return t.type==="ancestor-prevented"}function Es(t){return t.type==="ancestor-stopped"}function zs(t){return t.type==="syntax"}function qs(t){return t.type==="unknown"}function Ls(t){return t.type==="sql-error"}function Ws(t){return t.msg.includes("!pip")}function Ds(t){return t.msg.includes("use os.subprocess")}function Us(t,e){return(0,s.jsx)("pre",{children:T(t.msg,`syntax-${e}`)},`syntax-${e}`)}function Bs(t,e){return(0,s.jsx)("pre",{children:T(t.msg,`unknown-${e}`)},`unknown-${e}`)}function Os(t,e){return t.edges_with_vars.map((n,r)=>(0,s.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,s.jsx)($,{cellId:n[0]}),(0,s.jsxs)("span",{className:"text-muted-foreground",children:[": "," ",n[1].length===1?n[1][0]:n[1].join(", ")]})]},`setup-refs-${e}-${r}`))}function Qs(t,e){return t.edges_with_vars.map((n,r)=>(0,s.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,s.jsx)($,{cellId:n[0]}),(0,s.jsxs)("span",{className:"text-muted-foreground",children:[" -> ",n[1].length===1?n[1][0]:n[1].join(", ")," -> "]}),(0,s.jsx)($,{cellId:n[2]})]},`cycle-${e}-${r}`))}function Hs(t,e){return(0,s.jsx)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:(0,s.jsx)($,{cellId:t})},`cell-${e}`)}function Rs(t,e){return(0,s.jsxs)(W.Fragment,{children:[(0,s.jsx)("p",{className:"text-muted-foreground mt-2",children:`'${t.name}' was also defined by:`}),(0,s.jsx)("ul",{className:"list-disc",children:t.cells.map(Hs)})]},`multiple-defs-${e}`)}function Vs(t,e){return(0,s.jsx)("p",{className:"text-muted-foreground",children:t.msg},`import-star-${e}`)}function Ks(t,e){return(0,s.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Gs(t){return t.raising_cell!=null}function Js(t,e){return(0,s.jsx)("li",{className:"my-2",children:t.blamed_cell==null?(0,s.jsx)("p",{children:t.msg}):(0,s.jsxs)("div",{children:[t.msg,(0,s.jsx)($,{cellId:t.blamed_cell})]})},`strict-exception-${e}`)}function Xs(t){return t.blamed_cell!=null}function Ys(t,e){return(0,s.jsx)("p",{children:t.msg},`internal-${e}`)}function Zs(t,e){return(0,s.jsxs)("div",{children:[t.msg,t.blamed_cell==null?(0,s.jsxs)("span",{children:["(",(0,s.jsx)($,{cellId:t.raising_cell}),")"]}):(0,s.jsxs)("span",{children:["(",(0,s.jsx)($,{cellId:t.raising_cell}),"\xA0blames\xA0",(0,s.jsx)($,{cellId:t.blamed_cell}),")"]})]},`ancestor-prevented-${e}`)}function er(t,e){return(0,s.jsxs)("div",{children:[t.msg,(0,s.jsx)($,{cellId:t.raising_cell})]},`ancestor-stopped-${e}`)}function tr(t,e){return(0,s.jsx)("div",{className:"space-y-2 mt-2",children:(0,s.jsx)("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.msg})},`sql-error-${e}`)}export{ye as C,Ne as S,Wt as _,Ce as a,Ot as b,Ae as c,Gt as d,Vt as f,Bt as g,Rt as h,Pe as i,Ut as l,Kt as m,gs as n,Fe as o,$e as p,qe as r,Te as s,js as t,H as u,Ht as v,Pt as x,Qt as y};
11
+ ${n}`:"Please fix this error."}const w=t=>{let e=(0,se.c)(25),{errors:n,cellId:r,className:a}=t,l=ie(),{createNewCell:o}=Ke(),i=ce(nt),c;if(e[0]!==i||e[1]!==n){let v;e[3]===i?v=e[4]:(v=k=>qt(k,{aiEnabled:i}),e[3]=i,e[4]=v),c=n.flatMap(v),e[0]=i,e[1]=n,e[2]=c}else c=e[2];let d=c,p=ae(St),u=Te();if(d.length===0)return null;let m=d[0],x;e[5]!==r||e[6]!==o||e[7]!==m||e[8]!==p||e[9]!==l?(x=v=>{var S;let k=(S=l.get(Ze).cellHandles[r].current)==null?void 0:S.editorView;m.onFix({addCodeBelow:P=>{o({cellId:r,autoFocus:!1,before:!1,code:P})},editor:k,cellId:r,aiFix:{setAiCompletionCell:p,triggerFix:v}}),k==null||k.focus()},e[5]=r,e[6]=o,e[7]=m,e[8]=p,e[9]=l,e[10]=x):x=e[10];let g=x,h;e[11]!==r||e[12]!==u?(h=()=>{u({prompt:Fe(r)})},e[11]=r,e[12]=u,e[13]=h):h=e[13];let y=h,j;e[14]===a?j=e[15]:(j=ue("my-2",a),e[14]=a,e[15]=j);let b;e[16]!==m.description||e[17]!==m.fixType||e[18]!==m.title||e[19]!==g||e[20]!==y?(b=m.fixType==="ai"?(0,s.jsx)(Ce,{tooltip:m.description,openPrompt:()=>g(!1),applyAutofix:()=>g(!0),openChat:y}):(0,s.jsx)(Q,{content:m.description,align:"start",children:(0,s.jsxs)(E,{size:"xs",variant:"outline",className:"font-normal",onClick:()=>g(!1),children:[(0,s.jsx)(ge,{className:"h-3 w-3 mr-2"}),m.title]})}),e[16]=m.description,e[17]=m.fixType,e[18]=m.title,e[19]=g,e[20]=y,e[21]=b):b=e[21];let N;return e[22]!==j||e[23]!==b?(N=(0,s.jsx)("div",{className:j,children:b}),e[22]=j,e[23]=b,e[24]=N):N=e[24],N};var Se={autofix:{Icon:ge,title:"Inline AI Fix",description:"Apply AI fixes inline in the cell"},chat:{Icon:yt,title:"Fix with AI assistant",description:"Open the AI sidebar to fix"},prompt:{Icon:vt,title:"Suggest a prompt",description:"Edit the prompt before applying"}},ns=["autofix","prompt","chat"];const Ce=t=>{let e=(0,se.c)(18),{tooltip:n,openPrompt:r,applyAutofix:a,openChat:l}=t,{fixMode:o,setFixMode:i}=rs(),c=r;o==="chat"?c=l:o==="autofix"&&(c=a);let{Icon:d,title:p}=Se[o],u;e[0]===d?u=e[1]:(u=(0,s.jsx)(d,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=d,e[1]=u);let m;e[2]!==c||e[3]!==u||e[4]!==p?(m=(0,s.jsxs)(E,{size:"xs",variant:"outline",className:"font-normal rounded-r-none border-r-0",onClick:c,children:[u,p]}),e[2]=c,e[3]=u,e[4]=p,e[5]=m):m=e[5];let x;e[6]!==m||e[7]!==n?(x=(0,s.jsx)(Q,{content:n,align:"start",children:m}),e[6]=m,e[7]=n,e[8]=x):x=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=(0,s.jsx)(ut,{asChild:!0,children:(0,s.jsx)(E,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,s.jsx)(fe,{className:"h-3 w-3"})})}),e[9]=g):g=e[9];let h;e[10]!==o||e[11]!==i?(h=ns.map(b=>(0,s.jsx)(pt,{className:"flex items-center gap-2",onClick:()=>i(b),children:(0,s.jsx)(ls,{mode:b,selected:b===o})},b)),e[10]=o,e[11]=i,e[12]=h):h=e[12];let y;e[13]===h?y=e[14]:(y=(0,s.jsxs)(ht,{children:[g,(0,s.jsx)(xt,{align:"end",className:"w-56",children:h})]}),e[13]=h,e[14]=y);let j;return e[15]!==x||e[16]!==y?(j=(0,s.jsxs)("div",{className:"flex",children:[x,y]}),e[15]=x,e[16]=y,e[17]=j):j=e[17],j};var ls=t=>{let e=(0,se.c)(15),{mode:n,selected:r}=t,{Icon:a,title:l,description:o}=Se[n],i;e[0]===a?i=e[1]:(i=(0,s.jsx)(a,{className:"h-4 w-4 shrink-0"}),e[0]=a,e[1]=i);let c;e[2]===l?c=e[3]:(c=(0,s.jsx)("span",{className:"font-medium",children:l}),e[2]=l,e[3]=c);let d;e[4]===o?d=e[5]:(d=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=d);let p;e[6]!==c||e[7]!==d?(p=(0,s.jsxs)("div",{className:"flex flex-col",children:[c,d]}),e[6]=c,e[7]=d,e[8]=p):p=e[8];let u;e[9]===r?u=e[10]:(u=r&&(0,s.jsx)(gt,{className:"h-4 w-4 ml-auto shrink-0"}),e[9]=r,e[10]=u);let m;return e[11]!==i||e[12]!==p||e[13]!==u?(m=(0,s.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[i,p,u]}),e[11]=i,e[12]=p,e[13]=u,e[14]=m):m=e[14],m},Me=A();const as=t=>{let e=(0,Me.c)(12),{local:n}=t,r;e[0]===n.name?r=e[1]:(r=(0,s.jsx)("span",{className:"font-code",children:n.name}),e[0]=n.name,e[1]=r);let a;e[2]===n.cellId?a=e[3]:(a=(0,s.jsx)($,{cellId:n.cellId}),e[2]=n.cellId,e[3]=a);let l;e[4]!==r||e[5]!==a?(l=(0,s.jsxs)("div",{className:"max-w-xs",children:["Local variable ",r," in cell"," ",a,"."]}),e[4]=r,e[5]=a,e[6]=l):l=e[6];let o=l,i;e[7]===n.name?i=e[8]:(i=(0,s.jsx)("span",{className:"font-code cursor-help",children:n.name}),e[7]=n.name,e[8]=i);let c;return e[9]!==i||e[10]!==o?(c=(0,s.jsx)(Q,{content:o,children:i}),e[9]=i,e[10]=o,e[11]=c):c=e[11],c},Ee=t=>{let e=(0,Me.c)(4),{segments:n}=t,r;e[0]===n?r=e[1]:(r=n.map(is),e[0]=n,e[1]=r);let a;return e[2]===r?a=e[3]:(a=(0,s.jsx)(s.Fragment,{children:r}),e[2]=r,e[3]=a),a};function is(t,e){return typeof t=="string"?(0,s.jsx)("span",{children:t},e):(0,s.jsx)(as,{local:t},e)}var Pe=/(https?:\/\/\S+)/,os=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,ze=/^data:image\//i,cs=["avatars.githubusercontent.com"];function qe(t){return ze.test(t)?[{type:"image",url:t}]:t.split(Pe).filter(e=>e!=="").map(e=>Pe.test(e)?os.test(e)||ze.test(e)||cs.some(n=>e.includes(n))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var We=A(),L=le(He(),1),ds=new Xe;const re=t=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return t.replaceAll(e,"")};var Le=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function ms(t){Le.lastIndex=0;let e=Le.exec(t);if(!e)return null;let n=e.index+e[0].length,r=t.slice(n).split(/\s+/),a="",l=0;for(let i of r){let c=i.trim();if(!c)continue;if(c.startsWith("-")){l+=c.length+1;continue}let d=c.match(/^[\w,.[\]-]+/);if(d){a=d[0];break}break}if(!a)return null;let o=n+l+a.length;return{package:a,endIndex:o}}function T(t,e=""){if(!t)return null;if(!/https?:\/\//.test(t))return t;let n=qe(t);return n.length===1&&n[0].type==="text"?t:(0,s.jsx)(s.Fragment,{children:n.map((r,a)=>{let l=e?`${e}-${a}`:a;if(r.type==="url"){let o=re(r.url);return(0,s.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",onClick:xe.stopPropagation(),className:"text-link hover:underline",children:o},l)}if(r.type==="image"){let o=re(r.url);return(0,s.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",onClick:xe.stopPropagation(),className:"text-link hover:underline",children:o},l)}return(0,s.jsx)(L.Fragment,{children:r.value},l)})})}var ps=t=>{let e=(0,We.c)(6),{packages:n,children:r}=t,{handleInstallPackages:a}=Ft(),l;e[0]!==a||e[1]!==n?(l=i=>{a(n),i.preventDefault()},e[0]=a,e[1]=n,e[2]=l):l=e[2];let o;return e[3]!==r||e[4]!==l?(o=(0,s.jsx)("button",{onClick:l,className:"text-link hover:underline",type:"button",children:r}),e[3]=r,e[4]=l,e[5]=o):o=e[5],o};const us=t=>{if(!(t instanceof pe.Text))return;let e=re(t.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(e))return;let n=[],r=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,a;for(;(a=r.exec(e))!==null;){let i=a.index,c=ms(e.slice(i));c&&n.push({match:a,result:c})}if(n.length===0)return;let l=[],o=0;if(n.forEach((i,c)=>{let{match:d,result:p}=i,u=d.index,m=u+p.endIndex;if(o<u){let g=e.slice(o,u);l.push((0,s.jsx)(L.Fragment,{children:T(g,`before-${c}`)},`before-${c}`))}let x=e.slice(u,m);l.push((0,s.jsx)(ps,{packages:[p.package],children:x},`install-${c}`)),o=m}),o<e.length){let i=e.slice(o);l.push((0,s.jsx)(L.Fragment,{children:T(i,"after")},"after"))}return(0,s.jsx)(s.Fragment,{children:l})},xs=t=>{if(!(t instanceof pe.Text))return;let e=t.data;if(!/https?:\/\//.test(e))return;let n=T(e);if(typeof n!="string")return(0,s.jsx)(s.Fragment,{children:n})},hs=(...t)=>e=>{for(let n of t){let r=n(e);if(r!==void 0)return r}},fs=(t,e)=>(0,s.jsx)("span",{children:Je(ds.ansi_to_html(t),{replace:n=>e(n)})}),gs=t=>{let e=(0,We.c)(4),{text:n}=t,r;e[0]===n?r=e[1]:(r=fs(n,hs(us,xs)),e[0]=n,e[1]=r);let a=r,l;return e[2]===a?l=e[3]:(l=(0,s.jsx)(s.Fragment,{children:a}),e[2]=a,e[3]=l),l};var ne=A(),De=t=>{let e=(0,ne.c)(16),{traceback:n}=t,[r,a]=(0,L.useState)(!0),l;e[0]===r?l=e[1]:(l=()=>a(!r),e[0]=r,e[1]=l);let o=r?"Collapse traceback":"Expand traceback",i;e[2]===r?i=e[3]:(i=r?(0,s.jsx)(fe,{className:"h-3 w-3"}):(0,s.jsx)(jt,{className:"h-3 w-3"}),e[2]=r,e[3]=i);let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)("span",{className:"text-[0.6875rem] uppercase tracking-wider",children:"Traceback"}),e[4]=c):c=e[4];let d;e[5]!==r||e[6]!==l||e[7]!==o||e[8]!==i?(d=(0,s.jsxs)("button",{type:"button",onClick:l,"aria-expanded":r,"aria-label":o,className:"flex items-center gap-1 text-muted-foreground/70 hover:text-muted-foreground transition-colors",children:[i,c]}),e[5]=r,e[6]=l,e[7]=o,e[8]=i,e[9]=d):d=e[9];let p;e[10]!==r||e[11]!==n?(p=r&&(0,s.jsx)("div",{className:"font-code text-sm mt-1 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text",children:$t({html:n})}),e[10]=r,e[11]=n,e[12]=p):p=e[12];let u;return e[13]!==d||e[14]!==p?(u=(0,s.jsxs)("div",{className:"mt-2",children:[d,p]}),e[13]=d,e[14]=p,e[15]=u):u=e[15],u},F=t=>{let e=(0,ne.c)(10),n=t.title??"Tip",r;e[0]===n?r=e[1]:(r=(0,s.jsx)(ct,{className:"pt-2 pb-0 font-normal",children:n}),e[0]=n,e[1]=r);let a;e[2]===t.children?a=e[3]:(a=(0,s.jsx)(ot,{className:"mr-24 text-[0.84375rem]",wrapperClassName:"pt-0 pb-2",children:t.children}),e[2]=t.children,e[3]=a);let l;e[4]!==r||e[5]!==a?(l=(0,s.jsxs)(it,{value:"item-1",className:"text-muted-foreground",children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6];let o;return e[7]!==t.className||e[8]!==l?(o=(0,s.jsx)(dt,{type:"single",collapsible:!0,className:t.className,children:l}),e[7]=t.className,e[8]=l,e[9]=o):o=e[9],o};const js=t=>{let e=(0,ne.c)(38),{errors:n,cellId:r,className:a}=t,l=me(),o=ce(lt).display.cell_output==="above",i="This cell wasn't run because it has errors",c="destructive",d="text-error",p=null;if(n.some(ys))i="Interrupted";else if(n.some(bs))i="An internal error occurred";else if(n.some(vs))i="Ancestor prevented from running",c="default",d="text-secondary-foreground";else if(n.some(Ns))i="Ancestor stopped",c="default",d="text-secondary-foreground";else if(n.some(Is))i="SQL error";else if(n.some(ws))i=null,p="Cell not run";else{let N;e[0]===n?N=e[1]:(N=n.find(ks),e[0]=n,e[1]=N);let v=N;v&&"exception_type"in v&&(i=v.exception_type)}let u,m,x,g,h,y;if(e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==a||e[6]!==n||e[7]!==o||e[8]!==p||e[9]!==d||e[10]!==i){let N=n.filter($s),v=n.filter(_s),k=n.filter(As),S=n.filter(Ts),P=n.filter(Fs),D=n.filter(Ss),U=n.filter(Cs),H=n.filter(Ms),K=n.filter(Es),G=n.filter(Ps),z=n.filter(zs),J=n.filter(qs),X=n.filter(Ws),B;e[17]===l?B=e[18]:(B=()=>{l.openApplication("scratchpad")},e[17]=l,e[18]=B);let Ue=B,Be=()=>{let I=[];if(z.length>0||J.length>0){let f=z.some(Ls),_=!f&&z.some(Ds);I.push((0,s.jsxs)("div",{children:[z.map(Us),J.map(Bs),f&&(0,s.jsxs)(E,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Tt(l),children:[(0,s.jsx)(bt,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,s.jsx)("span",{children:"Open package manager"})]}),_&&(0,s.jsxs)(E,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openApplication("terminal"),children:[(0,s.jsx)(ye,{className:"h-3.5 w-3.5 mr-1.5"}),(0,s.jsx)("span",{children:"Open terminal"})]}),r&&(0,s.jsx)(w,{errors:[...z,...J],cellId:r})]},"syntax-unknown"))}if(N.length>0&&I.push((0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground font-medium",children:"The setup cell cannot be run because it has references."}),(0,s.jsx)("ul",{className:"list-disc",children:N.flatMap(Os)}),r&&(0,s.jsx)(w,{errors:N,cellId:r}),(0,s.jsxs)(F,{title:"Why can't the setup cell have references?",className:"mb-2",children:[(0,s.jsx)("p",{className:"pb-2",children:"The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables."}),(0,s.jsx)("p",{className:"py-2",children:"Try simplifying the setup cell to only contain only necessary variables."}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,s.jsx)(W,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"setup-refs")),v.length>0&&I.push((0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell is in a cycle."}),(0,s.jsx)("ul",{className:"list-disc",children:v.flatMap(Qs)}),r&&(0,s.jsx)(w,{errors:v,cellId:r}),(0,s.jsxs)(F,{title:"What are cycles and how do I resolve them?",className:"mb-2",children:[(0,s.jsx)("p",{className:"pb-2",children:"An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug."}),(0,s.jsx)("p",{className:"py-2",children:"Try merging these cells into a single cell to eliminate the cycle."}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,s.jsx)(W,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"cycle")),k.length>0){let f=k[0].name;I.push((0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell redefines variables from other cells."}),k.map(Vs),r&&(0,s.jsx)(w,{errors:k,cellId:r}),(0,s.jsxs)(F,{title:"Why can't I redefine variables?",children:[(0,s.jsx)("p",{className:"pb-2",children:"marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more."}),(0,s.jsxs)("p",{className:"py-2",children:["Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., ",(0,s.jsxs)(je,{className:"inline",children:["_",f]}),"). to make them private to this cell."]}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,s.jsx)(W,{size:"0.75rem",className:"inline"})]}),"."]})]}),(0,s.jsx)(F,{title:"Need a scratchpad?",children:(0,s.jsxs)("div",{className:"flex flex-row gap-2 items-center",children:[(0,s.jsxs)(E,{size:"xs",variant:"link",className:"my-2 font-normal mx-0 px-0",onClick:Ue,children:[(0,s.jsx)(Ye,{className:"h-3"}),(0,s.jsx)("span",{children:"Try the scratchpad"})]}),(0,s.jsx)("span",{children:"to experiment without restrictions on variable names."})]})})]},"multiple-defs"))}return S.length>0&&I.push((0,s.jsxs)("div",{children:[S.map(Hs),r&&(0,s.jsx)(w,{errors:S,cellId:r}),(0,s.jsxs)(F,{title:"Why can't I use `import *`?",children:[(0,s.jsx)("p",{className:"pb-2",children:"Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution."}),(0,s.jsx)("p",{className:"py-2",children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,s.jsx)("p",{className:"py-2",children:"Star imports would also silently add names to globals, which would be incompatible with reactive execution."}),(0,s.jsxs)("p",{className:"py-2",children:[(0,s.jsxs)(q,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,s.jsx)(W,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),P.length>0&&I.push((0,s.jsxs)("div",{children:[P.map(Ks),r&&(0,s.jsx)(w,{errors:P,cellId:r})]},"interruption")),D.length>0&&I.push((0,s.jsxs)("ul",{children:[D.map((f,_)=>f.exception_type==="NameError"&&f.msg.startsWith("name 'mo'")?(0,s.jsx)("li",{className:"my-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground",children:"name 'mo' is not defined."}),(0,s.jsxs)("p",{className:"text-muted-foreground mt-2",children:["The marimo module (imported as"," ",(0,s.jsx)(je,{className:"inline",children:"mo"}),") is required for Markdown, SQL, and UI elements."]})]})},`exception-${_}`):f.exception_type==="NameError"&&f.msg.startsWith("name '_")?(0,s.jsx)("li",{className:"my-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground",children:(0,s.jsx)(Ee,{segments:Ne(f.msg)})}),(0,s.jsxs)("p",{className:"text-muted-foreground mt-2",children:["Variables prefixed with an underscore are local to a cell"," ","(",(0,s.jsxs)(q,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,s.jsx)(W,{size:"0.75rem",className:"inline"})]}),")."]}),o&&(0,s.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]})},`exception-${_}`):(0,s.jsx)("li",{className:"my-2",children:f.raising_cell==null?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-muted-foreground",children:T(f.msg,`exception-${_}`)}),"traceback"in f&&f.traceback?(0,s.jsx)(De,{traceback:f.traceback}):o&&(0,s.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]}):(0,s.jsxs)("div",{children:[T(f.msg,`exception-${_}`),(0,s.jsx)($,{cellId:f.raising_cell}),"traceback"in f&&f.traceback&&(0,s.jsx)(De,{traceback:f.traceback})]})},`exception-${_}`)),D.some(Gs)&&(0,s.jsx)(F,{children:"Fix the error in the mentioned cells, or handle the exceptions with try/except blocks."}),r&&(0,s.jsx)(w,{errors:D,cellId:r})]},"exception")),U.length>0&&I.push((0,s.jsxs)("ul",{children:[U.map(Js),r&&(0,s.jsx)(w,{errors:U,cellId:r}),(0,s.jsx)(F,{children:U.some(Xs)?"Ensure that the referenced cells define the required variables, or turn off strict execution.":"Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution."})]},"strict-exception")),H.length>0&&I.push((0,s.jsxs)("div",{children:[H.map(Ys),r&&(0,s.jsx)(w,{errors:H,cellId:r})]},"internal")),K.length>0&&I.push((0,s.jsxs)("div",{children:[K.map(Zs),r&&(0,s.jsx)(w,{errors:K,cellId:r})]},"ancestor-prevented")),G.length>0&&I.push((0,s.jsxs)("div",{children:[G.map(er),r&&(0,s.jsx)(w,{errors:G,cellId:r})]},"ancestor-stopped")),X.length>0&&I.push((0,s.jsxs)("div",{children:[X.map(tr),r&&(0,s.jsx)(w,{errors:X,cellId:r,className:"mt-2.5"})]},"sql-errors")),I},C;e[19]===p?C=e[20]:(C=p&&(0,s.jsxs)("div",{className:"flex items-center gap-1 font-code text-[0.6875rem] uppercase tracking-wider text-muted-foreground/70",children:[p,(0,s.jsx)(Q,{content:"marimo didn't run this cell because it detected an error.",delayDuration:200,children:(0,s.jsx)(Ge,{className:"size-3 cursor-help"})})]}),e[19]=p,e[20]=C);let M;e[21]!==d||e[22]!==i?(M=i&&(0,s.jsx)(_t,{className:`font-code font-medium ${d}`,children:i}),e[21]=d,e[22]=i,e[23]=M):M=e[23];let O;e[24]!==C||e[25]!==M?(O=(0,s.jsxs)("div",{className:"space-y-0.5",children:[C,M]}),e[24]=C,e[25]=M,e[26]=O):O=e[26];let Oe=O;u=At,g=c,e[27]===a?h=e[28]:(h=ue("border-none font-code text-sm text-[0.84375rem] p-0 text-muted-foreground normal has-[svg]:pl-0 space-y-2",a),e[27]=a,e[28]=h),y=Oe,m="flex flex-col gap-4",x=Be(),e[2]=c,e[3]=r,e[4]=l,e[5]=a,e[6]=n,e[7]=o,e[8]=p,e[9]=d,e[10]=i,e[11]=u,e[12]=m,e[13]=x,e[14]=g,e[15]=h,e[16]=y}else u=e[11],m=e[12],x=e[13],g=e[14],h=e[15],y=e[16];let j;e[29]!==m||e[30]!==x?(j=(0,s.jsx)("div",{className:m,children:x}),e[29]=m,e[30]=x,e[31]=j):j=e[31];let b;return e[32]!==u||e[33]!==g||e[34]!==h||e[35]!==y||e[36]!==j?(b=(0,s.jsxs)(u,{variant:g,className:h,children:[y,j]}),e[32]=u,e[33]=g,e[34]=h,e[35]=y,e[36]=j,e[37]=b):b=e[37],b};function ys(t){return t.type==="interruption"}function bs(t){return t.type==="internal"}function vs(t){return t.type==="ancestor-prevented"}function Ns(t){return t.type==="ancestor-stopped"}function Is(t){return t.type==="sql-error"}function ws(t){return t.type==="multiple-defs"||t.type==="cycle"||t.type==="setup-refs"||t.type==="import-star"}function ks(t){return t.type==="exception"}function $s(t){return t.type==="setup-refs"}function _s(t){return t.type==="cycle"}function As(t){return t.type==="multiple-defs"}function Ts(t){return t.type==="import-star"}function Fs(t){return t.type==="interruption"}function Ss(t){return t.type==="exception"}function Cs(t){return t.type==="strict-exception"}function Ms(t){return t.type==="internal"}function Es(t){return t.type==="ancestor-prevented"}function Ps(t){return t.type==="ancestor-stopped"}function zs(t){return t.type==="syntax"}function qs(t){return t.type==="unknown"}function Ws(t){return t.type==="sql-error"}function Ls(t){return t.msg.includes("!pip")}function Ds(t){return t.msg.includes("use os.subprocess")}function Us(t,e){return(0,s.jsx)("pre",{children:T(t.msg,`syntax-${e}`)},`syntax-${e}`)}function Bs(t,e){return(0,s.jsx)("pre",{children:T(t.msg,`unknown-${e}`)},`unknown-${e}`)}function Os(t,e){return t.edges_with_vars.map((n,r)=>(0,s.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,s.jsx)($,{cellId:n[0]}),(0,s.jsxs)("span",{className:"text-muted-foreground",children:[": "," ",n[1].length===1?n[1][0]:n[1].join(", ")]})]},`setup-refs-${e}-${r}`))}function Qs(t,e){return t.edges_with_vars.map((n,r)=>(0,s.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,s.jsx)($,{cellId:n[0]}),(0,s.jsxs)("span",{className:"text-muted-foreground",children:[" -> ",n[1].length===1?n[1][0]:n[1].join(", ")," -> "]}),(0,s.jsx)($,{cellId:n[2]})]},`cycle-${e}-${r}`))}function Rs(t,e){return(0,s.jsx)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:(0,s.jsx)($,{cellId:t})},`cell-${e}`)}function Vs(t,e){return(0,s.jsxs)(L.Fragment,{children:[(0,s.jsx)("p",{className:"text-muted-foreground mt-2",children:`'${t.name}' was also defined by:`}),(0,s.jsx)("ul",{className:"list-disc",children:t.cells.map(Rs)})]},`multiple-defs-${e}`)}function Hs(t,e){return(0,s.jsx)("p",{className:"text-muted-foreground",children:t.msg},`import-star-${e}`)}function Ks(t,e){return(0,s.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Gs(t){return t.raising_cell!=null}function Js(t,e){return(0,s.jsx)("li",{className:"my-2",children:t.blamed_cell==null?(0,s.jsx)("p",{children:t.msg}):(0,s.jsxs)("div",{children:[t.msg,(0,s.jsx)($,{cellId:t.blamed_cell})]})},`strict-exception-${e}`)}function Xs(t){return t.blamed_cell!=null}function Ys(t,e){return(0,s.jsx)("p",{children:t.msg},`internal-${e}`)}function Zs(t,e){return(0,s.jsxs)("div",{children:[t.msg,t.blamed_cell==null?(0,s.jsxs)("span",{children:["(",(0,s.jsx)($,{cellId:t.raising_cell}),")"]}):(0,s.jsxs)("span",{children:["(",(0,s.jsx)($,{cellId:t.raising_cell}),"\xA0blames\xA0",(0,s.jsx)($,{cellId:t.blamed_cell}),")"]})]},`ancestor-prevented-${e}`)}function er(t,e){return(0,s.jsxs)("div",{children:[t.msg,(0,s.jsx)($,{cellId:t.raising_cell})]},`ancestor-stopped-${e}`)}function tr(t,e){return(0,s.jsx)("div",{className:"space-y-2 mt-2",children:(0,s.jsx)("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.msg})},`sql-error-${e}`)}export{ye as C,Ne as S,Lt as _,Ce as a,Ot as b,Ae as c,Gt as d,Ht as f,Bt as g,Vt as h,Ee as i,Ut as l,Kt as m,gs as n,Fe as o,$e as p,qe as r,Te as s,js as t,R as u,Rt as v,Et as x,Qt as y};
@@ -1 +1 @@
1
- import{s as Ce}from"./chunk-LvLJmgfZ.js";import{t as ye}from"./react-Bj1aDYRI.js";import{$ as Se,Y as ke,et as _e}from"./input-JxFwu-3G.js";import{D as Le,F as xe,I as v,L as Me,N as w,P as S,T as Fe,V as R,c as Ie,j as k,k as Pe,l as We,p as Ae,w as Ke,x as ne}from"./usePress-5hBv4sjD.js";import{t as He}from"./context-BFPaAUK_.js";var Be=class{get currentNode(){return this._currentNode}set currentNode(e){if(!k(this.root,e))throw Error("Cannot set currentNode to a node that is not contained by the root node.");let t=[],r=e,n=e;for(this._currentNode=e;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let i=r,l=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});t.push(l),l.currentNode=n,this._currentSetFor.add(l),r=n=i.host}else r=r.parentNode;let o=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(o),o.currentNode=n,this._currentSetFor.add(o),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return k(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){var t;let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let r;if(typeof this.filter=="function"?r=this.filter(e):(t=this.filter)!=null&&t.acceptNode&&(r=this.filter.acceptNode(e)),r===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let r=this.nextNode();return r&&(this.currentNode=r),r}else return null}previousNode(){var r;let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let n;if(typeof this.filter=="function"?n=this.filter(t):(r=this.filter)!=null&&r.acceptNode&&(n=this.filter.acceptNode(t)),n===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let o=this.lastChild();return o&&(this.currentNode=o),o}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(e,t,r,n){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=i=>{var l;if(i.nodeType===Node.ELEMENT_NODE){let a=i.shadowRoot;if(a){let d=this._doc.createTreeWalker(a,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(d),NodeFilter.FILTER_ACCEPT}else{if(typeof this.filter=="function")return this.filter(i);if((l=this.filter)!=null&&l.acceptNode)return this.filter.acceptNode(i);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=n??null,this.whatToShow=r??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,r,this._acceptNode));let o=t.shadowRoot;if(o){let i=this._doc.createTreeWalker(o,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(i)}}};function oe(e,t,r,n){return xe()?new Be(e,t,r,n):e.createTreeWalker(t,r,n)}var h=Ce(ye(),1);function De(e,t){let r=(0,h.useRef)(!0),n=(0,h.useRef)(null),o=Ae(e);(0,h.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]),(0,h.useEffect)(()=>{let i=n.current;r.current?r.current=!1:(!i||t.some((l,a)=>!Object.is(l,i[a])))&&o(),n.current=t},t)}function z(e,t){if(!e)return!1;let r=window.getComputedStyle(e),n=document.scrollingElement||document.documentElement,o=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return e===n&&r.overflow!=="hidden"&&(o=!0),o&&t&&(o=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),o}function Oe(e,t){let r=e;for(z(r,t)&&(r=r.parentElement);r&&!z(r,t);)r=r.parentElement;return r||document.scrollingElement||document.documentElement}function ie(e,t){let r=[],n=document.scrollingElement||document.documentElement;do z(e,t)&&r.push(e),e=e.parentElement;while(e&&e!==n);return r}function je(e){return Ke()?e.metaKey:e.ctrlKey}var ze=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ve(e){return e instanceof HTMLInputElement&&!ze.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var qe=0,q=new Map;function Ue(e){let[t,r]=(0,h.useState)();return R(()=>{if(!e)return;let n=q.get(e);if(n)r(n.element.id);else{let o=`react-aria-description-${qe++}`;r(o);let i=document.createElement("div");i.id=o,i.style.display="none",i.textContent=e,document.body.appendChild(i),n={refCount:0,element:i},q.set(e,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),q.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}function U(e,t,r={}){let{block:n="nearest",inline:o="nearest"}=r;if(e===t)return;let i=e.scrollTop,l=e.scrollLeft,a=t.getBoundingClientRect(),d=e.getBoundingClientRect(),c=window.getComputedStyle(t),s=window.getComputedStyle(e),f=document.scrollingElement||document.documentElement,u=e===f?0:d.top,N=e===f?e.clientHeight:d.bottom,b=e===f?0:d.left,P=e===f?e.clientWidth:d.right,_=parseInt(c.scrollMarginTop,10)||0,pe=parseInt(c.scrollMarginBottom,10)||0,Ne=parseInt(c.scrollMarginLeft,10)||0,me=parseInt(c.scrollMarginRight,10)||0,be=parseInt(s.scrollPaddingTop,10)||0,ve=parseInt(s.scrollPaddingBottom,10)||0,Ee=parseInt(s.scrollPaddingLeft,10)||0,ge=parseInt(s.scrollPaddingRight,10)||0,Q=parseInt(s.borderTopWidth,10)||0,Z=parseInt(s.borderBottomWidth,10)||0,ee=parseInt(s.borderLeftWidth,10)||0,te=parseInt(s.borderRightWidth,10)||0,W=a.top-_,A=a.bottom+pe,K=a.left-Ne,H=a.right+me,Te=e===f?0:ee+te,we=e===f?0:Q+Z,re=e.offsetWidth-e.clientWidth-Te,Re=e.offsetHeight-e.clientHeight-we,B=u+Q+be,D=N-Z-ve-Re,L=b+ee+Ee,x=P-te-ge;s.direction==="rtl"&&!Le()?L+=re:x-=re;let O=W<B||A>D,j=K<L||H>x;if(O&&n==="start")i+=W-B;else if(O&&n==="center")i+=(W+A)/2-(B+D)/2;else if(O&&n==="end")i+=A-D;else if(O&&n==="nearest"){let M=W-B,F=A-D;i+=Math.abs(M)<=Math.abs(F)?M:F}if(j&&o==="start")l+=K-L;else if(j&&o==="center")l+=(K+H)/2-(L+x)/2;else if(j&&o==="end")l+=H-x;else if(j&&o==="nearest"){let M=K-L,F=H-x;l+=Math.abs(M)<=Math.abs(F)?M:F}e.scrollTo({left:l,top:i})}function $e(e,t={}){let{containingElement:r}=t;if(e&&e.isConnected){let l=document.scrollingElement||document.documentElement;if(window.getComputedStyle(l).overflow!=="hidden"&&!ne()){var n;let{left:a,top:d}=e.getBoundingClientRect();e==null||(n=e.scrollIntoView)==null||n.call(e,{block:"nearest"});let{left:c,top:s}=e.getBoundingClientRect();if(Math.abs(a-c)>1||Math.abs(d-s)>1){var o,i;r==null||(o=r.scrollIntoView)==null||o.call(r,{block:"center",inline:"center"}),(i=e.scrollIntoView)==null||i.call(e,{block:"nearest"})}}else{let{left:a,top:d}=e.getBoundingClientRect(),c=ie(e,!0);for(let u of c)U(u,e);let{left:s,top:f}=e.getBoundingClientRect();if(Math.abs(a-s)>1||Math.abs(d-f)>1){c=r?ie(r,!0):[];for(let u of c)U(u,r,{block:"center",inline:"center"})}}}}var $=new Map;function Ye(e){let{locale:t}=He(),r=t+(e?Object.entries(e).sort((o,i)=>o[0]<i[0]?-1:1).join():"");if($.has(r))return $.get(r);let n=new Intl.Collator(t,e);return $.set(r,n),n}var le=h.createContext(null),Y="react-aria-focus-scope-restore",p=null;function Ge(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,i=(0,h.useRef)(null),l=(0,h.useRef)(null),a=(0,h.useRef)([]),{parentNode:d}=(0,h.useContext)(le)||{},c=(0,h.useMemo)(()=>new X({scopeRef:a}),[a]);R(()=>{let u=d||m.root;if(m.getTreeNode(u.scopeRef)&&p&&!V(p,u.scopeRef)){let N=m.getTreeNode(p);N&&(u=N)}u.addChild(c),m.addNode(c)},[c,d]),R(()=>{let u=m.getTreeNode(a);u&&(u.contain=!!r)},[r]),R(()=>{var P;let u=(P=i.current)==null?void 0:P.nextSibling,N=[],b=_=>_.stopPropagation();for(;u&&u!==l.current;)N.push(u),u.addEventListener(Y,b),u=u.nextSibling;return a.current=N,()=>{for(let _ of N)_.removeEventListener(Y,b)}},[t]),rt(a,n,r),Ze(a,r),nt(a,n,r),tt(a,o),(0,h.useEffect)(()=>{let u=w(v(a.current?a.current[0]:void 0)),N=null;if(T(u,a.current)){for(let b of m.traverse())b.scopeRef&&T(u,b.scopeRef.current)&&(N=b);N===m.getTreeNode(a)&&(p=N.scopeRef)}},[a]),R(()=>()=>{var N,b;let u=((b=(N=m.getTreeNode(a))==null?void 0:N.parent)==null?void 0:b.scopeRef)??null;(a===p||V(a,p))&&(!u||m.getTreeNode(u))&&(p=u),m.removeTreeNode(a)},[a]);let s=(0,h.useMemo)(()=>Je(a),[]),f=(0,h.useMemo)(()=>({focusManager:s,parentNode:c}),[c,s]);return h.createElement(le.Provider,{value:f},h.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,h.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:l}))}function Je(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[0].previousElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.nextNode();return!s&&i&&(c.currentNode=d,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[r.length-1].nextElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.previousNode();return!s&&i&&(c.currentNode=d,s=c.previousNode()),s&&E(s,!0),s},focusFirst(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[0].previousElementSibling;let l=i.nextNode();return l&&E(l,!0),l},focusLast(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[r.length-1].nextElementSibling;let l=i.previousNode();return l&&E(l,!0),l}}}function y(e){return e[0].parentElement}function I(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Xe(e){if(!e.form)return Array.from(v(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(n=>!n.form);let t=e.form.elements.namedItem(e.name),r=Me(e);return t instanceof r.RadioNodeList?Array.from(t).filter(n=>n instanceof r.HTMLInputElement):t instanceof r.HTMLInputElement?[t]:[]}function Qe(e){if(e.checked)return!0;let t=Xe(e);return t.length>0&&!t.some(r=>r.checked)}function Ze(e,t){let r=(0,h.useRef)(void 0),n=(0,h.useRef)(void 0);R(()=>{let o=e.current;if(!t){n.current&&(n.current=(cancelAnimationFrame(n.current),void 0));return}let i=v(o?o[0]:void 0),l=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!I(e)||c.isComposing)return;let s=w(i),f=e.current;if(!f||!T(s,f))return;let u=g(y(f),{tabbable:!0},f);if(!s)return;u.currentNode=s;let N=c.shiftKey?u.previousNode():u.nextNode();N||(N=(u.currentNode=c.shiftKey?f[f.length-1].nextElementSibling:f[0].previousElementSibling,c.shiftKey?u.previousNode():u.nextNode())),c.preventDefault(),N&&E(N,!0)},a=c=>{(!p||V(p,e))&&T(S(c),e.current)?(p=e,r.current=S(c)):I(e)&&!C(S(c),e)?r.current?r.current.focus():p&&p.current&&G(p.current):I(e)&&(r.current=S(c))},d=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let s=_e(),f=(s==="virtual"||s===null)&&Fe()&&ne(),u=w(i);if(!f&&u&&I(e)&&!C(u,e)){p=e;let b=S(c);if(b&&b.isConnected){var N;r.current=b,(N=r.current)==null||N.focus()}else p.current&&G(p.current)}})};return i.addEventListener("keydown",l,!1),i.addEventListener("focusin",a,!1),o==null||o.forEach(c=>c.addEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.addEventListener("focusout",d,!1)),()=>{i.removeEventListener("keydown",l,!1),i.removeEventListener("focusin",a,!1),o==null||o.forEach(c=>c.removeEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.removeEventListener("focusout",d,!1))}},[e,t]),R(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function ce(e){return C(e)}function T(e,t){return!e||!t?!1:t.some(r=>k(r,e))}function C(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of m.traverse(m.getTreeNode(t)))if(r&&T(e,r.current))return!0;return!1}function et(e){return C(e,p)}function V(e,t){var n;let r=(n=m.getTreeNode(t))==null?void 0:n.parent;for(;r;){if(r.scopeRef===e)return!0;r=r.parent}return!1}function E(e,t=!1){if(e!=null&&!t)try{Se(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function se(e,t=!0){let r=e[0].previousElementSibling,n=y(e),o=g(n,{tabbable:t},e);o.currentNode=r;let i=o.nextNode();return t&&!i&&(n=y(e),o=g(n,{tabbable:!1},e),o.currentNode=r,i=o.nextNode()),i}function G(e,t=!0){E(se(e,t))}function tt(e,t){let r=h.useRef(t);(0,h.useEffect)(()=>{r.current&&(p=e,!T(w(v(e.current?e.current[0]:void 0)),p.current)&&e.current&&G(e.current)),r.current=!1},[e])}function rt(e,t,r){R(()=>{if(t||r)return;let n=e.current,o=v(n?n[0]:void 0),i=l=>{let a=S(l);T(a,e.current)?p=e:ce(a)||(p=null)};return o.addEventListener("focusin",i,!1),n==null||n.forEach(l=>l.addEventListener("focusin",i,!1)),()=>{o.removeEventListener("focusin",i,!1),n==null||n.forEach(l=>l.removeEventListener("focusin",i,!1))}},[e,t,r])}function ae(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function nt(e,t,r){let n=(0,h.useRef)(typeof document<"u"?w(v(e.current?e.current[0]:void 0)):null);R(()=>{let o=e.current,i=v(o?o[0]:void 0);if(!t||r)return;let l=()=>{(!p||V(p,e))&&T(w(i),e.current)&&(p=e)};return i.addEventListener("focusin",l,!1),o==null||o.forEach(a=>a.addEventListener("focusin",l,!1)),()=>{i.removeEventListener("focusin",l,!1),o==null||o.forEach(a=>a.removeEventListener("focusin",l,!1))}},[e,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!I(e)||l.isComposing)return;let a=o.activeElement;if(!C(a,e)||!ae(e))return;let d=m.getTreeNode(e);if(!d)return;let c=d.nodeToRestore,s=g(o.body,{tabbable:!0});s.currentNode=a;let f=l.shiftKey?s.previousNode():s.nextNode();if((!c||!c.isConnected||c===o.body)&&(c=void 0,d.nodeToRestore=void 0),(!f||!C(f,e))&&c){s.currentNode=c;do f=l.shiftKey?s.previousNode():s.nextNode();while(C(f,e));l.preventDefault(),l.stopPropagation(),f?E(f,!0):ce(c)?E(c,!0):a.blur()}};return r||o.addEventListener("keydown",i,!0),()=>{r||o.removeEventListener("keydown",i,!0)}},[e,t,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=m.getTreeNode(e);if(i)return i.nodeToRestore=n.current??void 0,()=>{let l=m.getTreeNode(e);if(!l)return;let a=l.nodeToRestore,d=w(o);if(t&&a&&(d&&C(d,e)||d===o.body&&ae(e))){let c=m.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let s=c.getTreeNode(e);for(;s;){if(s.nodeToRestore&&s.nodeToRestore.isConnected){ue(s.nodeToRestore);return}s=s.parent}for(s=c.getTreeNode(e);s;){if(s.scopeRef&&s.scopeRef.current&&m.getTreeNode(s.scopeRef)){ue(se(s.scopeRef.current,!0));return}s=s.parent}}})}}},[e,t])}function ue(e){e.dispatchEvent(new CustomEvent(Y,{bubbles:!0,cancelable:!0}))&&E(e)}function g(e,t,r){let n=t!=null&&t.tabbable?We:Ie,o=v((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null),i=oe(o,e||o,NodeFilter.SHOW_ELEMENT,{acceptNode(l){return k(t==null?void 0:t.from,l)||t!=null&&t.tabbable&&l.tagName==="INPUT"&&l.getAttribute("type")==="radio"&&(!Qe(l)||i.currentNode.tagName==="INPUT"&&i.currentNode.type==="radio"&&i.currentNode.name===l.name)?NodeFilter.FILTER_REJECT:n(l)&&(!r||T(l,r))&&(!(t!=null&&t.accept)||t.accept(l))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(i.currentNode=t.from),i}function ot(e,t={}){return{focusNext(r={}){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});k(n,d)&&(c.currentNode=d);let s=c.nextNode();return!s&&l&&(c.currentNode=n,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(r=t){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});if(k(n,d))c.currentNode=d;else{let f=J(c);return f&&E(f,!0),f??null}let s=c.previousNode();if(!s&&l){c.currentNode=n;let f=J(c);if(!f)return null;s=f}return s&&E(s,!0),s??null},focusFirst(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=g(n,{tabbable:o,accept:i}).nextNode();return l&&E(l,!0),l},focusLast(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=J(g(n,{tabbable:o,accept:i}));return l&&E(l,!0),l??null}}}function J(e){let t,r;do r=e.lastChild(),r&&(t=r);while(r);return t}var it=class he{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let o=this.fastMap.get(r??null);if(!o)return;let i=new X({scopeRef:t});o.addChild(i),i.parent=o,this.fastMap.set(t,i),n&&(i.nodeToRestore=n)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let n=r.parent;for(let i of this.traverse())i!==r&&r.nodeToRestore&&i.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&T(i.nodeToRestore,r.scopeRef.current)&&(i.nodeToRestore=r.nodeToRestore);let o=r.children;n&&(n.removeChild(r),o.size>0&&o.forEach(i=>n&&n.addChild(i))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var r;let t=new he;for(let n of this.traverse())t.addTreeNode(n.scopeRef,((r=n.parent)==null?void 0:r.scopeRef)??null,n.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new X({scopeRef:null}),this.fastMap.set(null,this.root)}},X=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}},m=new it,de={border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"};function fe(e={}){let{style:t,isFocusable:r}=e,[n,o]=(0,h.useState)(!1),{focusWithinProps:i}=ke({isDisabled:!r,onFocusWithinChange:a=>o(a)}),l=(0,h.useMemo)(()=>n?t:t?{...de,...t}:de,[n]);return{visuallyHiddenProps:{...i,style:l}}}function lt(e){let{children:t,elementType:r="div",isFocusable:n,style:o,...i}=e,{visuallyHiddenProps:l}=fe(e);return h.createElement(r,Pe(i,l),t)}var ct=(0,h.createContext)(null);(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null);var st=(0,h.createContext)({}),at=(0,h.createContext)(null);(0,h.createContext)(null);export{z as _,fe as a,g as c,U as d,$e as f,Oe as g,Ve as h,lt as i,ot as l,je as m,at as n,et as o,Ue as p,st as r,Ge as s,ct as t,Ye as u,De as v,oe as y};
1
+ import{s as Ce}from"./chunk-LvLJmgfZ.js";import{t as ye}from"./react-Bj1aDYRI.js";import{$ as Se,Y as ke,et as _e}from"./input-_AaMXWgD.js";import{D as Le,F as xe,I as v,L as Me,N as w,P as S,T as Fe,V as R,c as Ie,j as k,k as Pe,l as We,p as Ae,w as Ke,x as ne}from"./usePress-5hBv4sjD.js";import{t as He}from"./context-BFPaAUK_.js";var Be=class{get currentNode(){return this._currentNode}set currentNode(e){if(!k(this.root,e))throw Error("Cannot set currentNode to a node that is not contained by the root node.");let t=[],r=e,n=e;for(this._currentNode=e;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let i=r,l=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});t.push(l),l.currentNode=n,this._currentSetFor.add(l),r=n=i.host}else r=r.parentNode;let o=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(o),o.currentNode=n,this._currentSetFor.add(o),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return k(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){var t;let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let r;if(typeof this.filter=="function"?r=this.filter(e):(t=this.filter)!=null&&t.acceptNode&&(r=this.filter.acceptNode(e)),r===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let r=this.nextNode();return r&&(this.currentNode=r),r}else return null}previousNode(){var r;let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let n;if(typeof this.filter=="function"?n=this.filter(t):(r=this.filter)!=null&&r.acceptNode&&(n=this.filter.acceptNode(t)),n===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let o=this.lastChild();return o&&(this.currentNode=o),o}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let n=this.previousNode();return n&&(this.currentNode=n),n}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(e,t,r,n){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=i=>{var l;if(i.nodeType===Node.ELEMENT_NODE){let a=i.shadowRoot;if(a){let d=this._doc.createTreeWalker(a,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(d),NodeFilter.FILTER_ACCEPT}else{if(typeof this.filter=="function")return this.filter(i);if((l=this.filter)!=null&&l.acceptNode)return this.filter.acceptNode(i);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=n??null,this.whatToShow=r??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,r,this._acceptNode));let o=t.shadowRoot;if(o){let i=this._doc.createTreeWalker(o,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(i)}}};function oe(e,t,r,n){return xe()?new Be(e,t,r,n):e.createTreeWalker(t,r,n)}var h=Ce(ye(),1);function De(e,t){let r=(0,h.useRef)(!0),n=(0,h.useRef)(null),o=Ae(e);(0,h.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]),(0,h.useEffect)(()=>{let i=n.current;r.current?r.current=!1:(!i||t.some((l,a)=>!Object.is(l,i[a])))&&o(),n.current=t},t)}function z(e,t){if(!e)return!1;let r=window.getComputedStyle(e),n=document.scrollingElement||document.documentElement,o=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return e===n&&r.overflow!=="hidden"&&(o=!0),o&&t&&(o=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),o}function Oe(e,t){let r=e;for(z(r,t)&&(r=r.parentElement);r&&!z(r,t);)r=r.parentElement;return r||document.scrollingElement||document.documentElement}function ie(e,t){let r=[],n=document.scrollingElement||document.documentElement;do z(e,t)&&r.push(e),e=e.parentElement;while(e&&e!==n);return r}function je(e){return Ke()?e.metaKey:e.ctrlKey}var ze=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ve(e){return e instanceof HTMLInputElement&&!ze.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var qe=0,q=new Map;function Ue(e){let[t,r]=(0,h.useState)();return R(()=>{if(!e)return;let n=q.get(e);if(n)r(n.element.id);else{let o=`react-aria-description-${qe++}`;r(o);let i=document.createElement("div");i.id=o,i.style.display="none",i.textContent=e,document.body.appendChild(i),n={refCount:0,element:i},q.set(e,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),q.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}function U(e,t,r={}){let{block:n="nearest",inline:o="nearest"}=r;if(e===t)return;let i=e.scrollTop,l=e.scrollLeft,a=t.getBoundingClientRect(),d=e.getBoundingClientRect(),c=window.getComputedStyle(t),s=window.getComputedStyle(e),f=document.scrollingElement||document.documentElement,u=e===f?0:d.top,N=e===f?e.clientHeight:d.bottom,b=e===f?0:d.left,P=e===f?e.clientWidth:d.right,_=parseInt(c.scrollMarginTop,10)||0,pe=parseInt(c.scrollMarginBottom,10)||0,Ne=parseInt(c.scrollMarginLeft,10)||0,me=parseInt(c.scrollMarginRight,10)||0,be=parseInt(s.scrollPaddingTop,10)||0,ve=parseInt(s.scrollPaddingBottom,10)||0,Ee=parseInt(s.scrollPaddingLeft,10)||0,ge=parseInt(s.scrollPaddingRight,10)||0,Q=parseInt(s.borderTopWidth,10)||0,Z=parseInt(s.borderBottomWidth,10)||0,ee=parseInt(s.borderLeftWidth,10)||0,te=parseInt(s.borderRightWidth,10)||0,W=a.top-_,A=a.bottom+pe,K=a.left-Ne,H=a.right+me,Te=e===f?0:ee+te,we=e===f?0:Q+Z,re=e.offsetWidth-e.clientWidth-Te,Re=e.offsetHeight-e.clientHeight-we,B=u+Q+be,D=N-Z-ve-Re,L=b+ee+Ee,x=P-te-ge;s.direction==="rtl"&&!Le()?L+=re:x-=re;let O=W<B||A>D,j=K<L||H>x;if(O&&n==="start")i+=W-B;else if(O&&n==="center")i+=(W+A)/2-(B+D)/2;else if(O&&n==="end")i+=A-D;else if(O&&n==="nearest"){let M=W-B,F=A-D;i+=Math.abs(M)<=Math.abs(F)?M:F}if(j&&o==="start")l+=K-L;else if(j&&o==="center")l+=(K+H)/2-(L+x)/2;else if(j&&o==="end")l+=H-x;else if(j&&o==="nearest"){let M=K-L,F=H-x;l+=Math.abs(M)<=Math.abs(F)?M:F}e.scrollTo({left:l,top:i})}function $e(e,t={}){let{containingElement:r}=t;if(e&&e.isConnected){let l=document.scrollingElement||document.documentElement;if(window.getComputedStyle(l).overflow!=="hidden"&&!ne()){var n;let{left:a,top:d}=e.getBoundingClientRect();e==null||(n=e.scrollIntoView)==null||n.call(e,{block:"nearest"});let{left:c,top:s}=e.getBoundingClientRect();if(Math.abs(a-c)>1||Math.abs(d-s)>1){var o,i;r==null||(o=r.scrollIntoView)==null||o.call(r,{block:"center",inline:"center"}),(i=e.scrollIntoView)==null||i.call(e,{block:"nearest"})}}else{let{left:a,top:d}=e.getBoundingClientRect(),c=ie(e,!0);for(let u of c)U(u,e);let{left:s,top:f}=e.getBoundingClientRect();if(Math.abs(a-s)>1||Math.abs(d-f)>1){c=r?ie(r,!0):[];for(let u of c)U(u,r,{block:"center",inline:"center"})}}}}var $=new Map;function Ye(e){let{locale:t}=He(),r=t+(e?Object.entries(e).sort((o,i)=>o[0]<i[0]?-1:1).join():"");if($.has(r))return $.get(r);let n=new Intl.Collator(t,e);return $.set(r,n),n}var le=h.createContext(null),Y="react-aria-focus-scope-restore",p=null;function Ge(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,i=(0,h.useRef)(null),l=(0,h.useRef)(null),a=(0,h.useRef)([]),{parentNode:d}=(0,h.useContext)(le)||{},c=(0,h.useMemo)(()=>new X({scopeRef:a}),[a]);R(()=>{let u=d||m.root;if(m.getTreeNode(u.scopeRef)&&p&&!V(p,u.scopeRef)){let N=m.getTreeNode(p);N&&(u=N)}u.addChild(c),m.addNode(c)},[c,d]),R(()=>{let u=m.getTreeNode(a);u&&(u.contain=!!r)},[r]),R(()=>{var P;let u=(P=i.current)==null?void 0:P.nextSibling,N=[],b=_=>_.stopPropagation();for(;u&&u!==l.current;)N.push(u),u.addEventListener(Y,b),u=u.nextSibling;return a.current=N,()=>{for(let _ of N)_.removeEventListener(Y,b)}},[t]),rt(a,n,r),Ze(a,r),nt(a,n,r),tt(a,o),(0,h.useEffect)(()=>{let u=w(v(a.current?a.current[0]:void 0)),N=null;if(T(u,a.current)){for(let b of m.traverse())b.scopeRef&&T(u,b.scopeRef.current)&&(N=b);N===m.getTreeNode(a)&&(p=N.scopeRef)}},[a]),R(()=>()=>{var N,b;let u=((b=(N=m.getTreeNode(a))==null?void 0:N.parent)==null?void 0:b.scopeRef)??null;(a===p||V(a,p))&&(!u||m.getTreeNode(u))&&(p=u),m.removeTreeNode(a)},[a]);let s=(0,h.useMemo)(()=>Je(a),[]),f=(0,h.useMemo)(()=>({focusManager:s,parentNode:c}),[c,s]);return h.createElement(le.Provider,{value:f},h.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,h.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:l}))}function Je(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[0].previousElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.nextNode();return!s&&i&&(c.currentNode=d,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(t={}){let r=e.current,{from:n,tabbable:o,wrap:i,accept:l}=t,a=n||w(v(r[0]??void 0)),d=r[r.length-1].nextElementSibling,c=g(y(r),{tabbable:o,accept:l},r);c.currentNode=T(a,r)?a:d;let s=c.previousNode();return!s&&i&&(c.currentNode=d,s=c.previousNode()),s&&E(s,!0),s},focusFirst(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[0].previousElementSibling;let l=i.nextNode();return l&&E(l,!0),l},focusLast(t={}){let r=e.current,{tabbable:n,accept:o}=t,i=g(y(r),{tabbable:n,accept:o},r);i.currentNode=r[r.length-1].nextElementSibling;let l=i.previousNode();return l&&E(l,!0),l}}}function y(e){return e[0].parentElement}function I(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Xe(e){if(!e.form)return Array.from(v(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(n=>!n.form);let t=e.form.elements.namedItem(e.name),r=Me(e);return t instanceof r.RadioNodeList?Array.from(t).filter(n=>n instanceof r.HTMLInputElement):t instanceof r.HTMLInputElement?[t]:[]}function Qe(e){if(e.checked)return!0;let t=Xe(e);return t.length>0&&!t.some(r=>r.checked)}function Ze(e,t){let r=(0,h.useRef)(void 0),n=(0,h.useRef)(void 0);R(()=>{let o=e.current;if(!t){n.current&&(n.current=(cancelAnimationFrame(n.current),void 0));return}let i=v(o?o[0]:void 0),l=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!I(e)||c.isComposing)return;let s=w(i),f=e.current;if(!f||!T(s,f))return;let u=g(y(f),{tabbable:!0},f);if(!s)return;u.currentNode=s;let N=c.shiftKey?u.previousNode():u.nextNode();N||(N=(u.currentNode=c.shiftKey?f[f.length-1].nextElementSibling:f[0].previousElementSibling,c.shiftKey?u.previousNode():u.nextNode())),c.preventDefault(),N&&E(N,!0)},a=c=>{(!p||V(p,e))&&T(S(c),e.current)?(p=e,r.current=S(c)):I(e)&&!C(S(c),e)?r.current?r.current.focus():p&&p.current&&G(p.current):I(e)&&(r.current=S(c))},d=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let s=_e(),f=(s==="virtual"||s===null)&&Fe()&&ne(),u=w(i);if(!f&&u&&I(e)&&!C(u,e)){p=e;let b=S(c);if(b&&b.isConnected){var N;r.current=b,(N=r.current)==null||N.focus()}else p.current&&G(p.current)}})};return i.addEventListener("keydown",l,!1),i.addEventListener("focusin",a,!1),o==null||o.forEach(c=>c.addEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.addEventListener("focusout",d,!1)),()=>{i.removeEventListener("keydown",l,!1),i.removeEventListener("focusin",a,!1),o==null||o.forEach(c=>c.removeEventListener("focusin",a,!1)),o==null||o.forEach(c=>c.removeEventListener("focusout",d,!1))}},[e,t]),R(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function ce(e){return C(e)}function T(e,t){return!e||!t?!1:t.some(r=>k(r,e))}function C(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of m.traverse(m.getTreeNode(t)))if(r&&T(e,r.current))return!0;return!1}function et(e){return C(e,p)}function V(e,t){var n;let r=(n=m.getTreeNode(t))==null?void 0:n.parent;for(;r;){if(r.scopeRef===e)return!0;r=r.parent}return!1}function E(e,t=!1){if(e!=null&&!t)try{Se(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function se(e,t=!0){let r=e[0].previousElementSibling,n=y(e),o=g(n,{tabbable:t},e);o.currentNode=r;let i=o.nextNode();return t&&!i&&(n=y(e),o=g(n,{tabbable:!1},e),o.currentNode=r,i=o.nextNode()),i}function G(e,t=!0){E(se(e,t))}function tt(e,t){let r=h.useRef(t);(0,h.useEffect)(()=>{r.current&&(p=e,!T(w(v(e.current?e.current[0]:void 0)),p.current)&&e.current&&G(e.current)),r.current=!1},[e])}function rt(e,t,r){R(()=>{if(t||r)return;let n=e.current,o=v(n?n[0]:void 0),i=l=>{let a=S(l);T(a,e.current)?p=e:ce(a)||(p=null)};return o.addEventListener("focusin",i,!1),n==null||n.forEach(l=>l.addEventListener("focusin",i,!1)),()=>{o.removeEventListener("focusin",i,!1),n==null||n.forEach(l=>l.removeEventListener("focusin",i,!1))}},[e,t,r])}function ae(e){let t=m.getTreeNode(p);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function nt(e,t,r){let n=(0,h.useRef)(typeof document<"u"?w(v(e.current?e.current[0]:void 0)):null);R(()=>{let o=e.current,i=v(o?o[0]:void 0);if(!t||r)return;let l=()=>{(!p||V(p,e))&&T(w(i),e.current)&&(p=e)};return i.addEventListener("focusin",l,!1),o==null||o.forEach(a=>a.addEventListener("focusin",l,!1)),()=>{i.removeEventListener("focusin",l,!1),o==null||o.forEach(a=>a.removeEventListener("focusin",l,!1))}},[e,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!I(e)||l.isComposing)return;let a=o.activeElement;if(!C(a,e)||!ae(e))return;let d=m.getTreeNode(e);if(!d)return;let c=d.nodeToRestore,s=g(o.body,{tabbable:!0});s.currentNode=a;let f=l.shiftKey?s.previousNode():s.nextNode();if((!c||!c.isConnected||c===o.body)&&(c=void 0,d.nodeToRestore=void 0),(!f||!C(f,e))&&c){s.currentNode=c;do f=l.shiftKey?s.previousNode():s.nextNode();while(C(f,e));l.preventDefault(),l.stopPropagation(),f?E(f,!0):ce(c)?E(c,!0):a.blur()}};return r||o.addEventListener("keydown",i,!0),()=>{r||o.removeEventListener("keydown",i,!0)}},[e,t,r]),R(()=>{let o=v(e.current?e.current[0]:void 0);if(!t)return;let i=m.getTreeNode(e);if(i)return i.nodeToRestore=n.current??void 0,()=>{let l=m.getTreeNode(e);if(!l)return;let a=l.nodeToRestore,d=w(o);if(t&&a&&(d&&C(d,e)||d===o.body&&ae(e))){let c=m.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let s=c.getTreeNode(e);for(;s;){if(s.nodeToRestore&&s.nodeToRestore.isConnected){ue(s.nodeToRestore);return}s=s.parent}for(s=c.getTreeNode(e);s;){if(s.scopeRef&&s.scopeRef.current&&m.getTreeNode(s.scopeRef)){ue(se(s.scopeRef.current,!0));return}s=s.parent}}})}}},[e,t])}function ue(e){e.dispatchEvent(new CustomEvent(Y,{bubbles:!0,cancelable:!0}))&&E(e)}function g(e,t,r){let n=t!=null&&t.tabbable?We:Ie,o=v((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE?e:null),i=oe(o,e||o,NodeFilter.SHOW_ELEMENT,{acceptNode(l){return k(t==null?void 0:t.from,l)||t!=null&&t.tabbable&&l.tagName==="INPUT"&&l.getAttribute("type")==="radio"&&(!Qe(l)||i.currentNode.tagName==="INPUT"&&i.currentNode.type==="radio"&&i.currentNode.name===l.name)?NodeFilter.FILTER_REJECT:n(l)&&(!r||T(l,r))&&(!(t!=null&&t.accept)||t.accept(l))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(i.currentNode=t.from),i}function ot(e,t={}){return{focusNext(r={}){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});k(n,d)&&(c.currentNode=d);let s=c.nextNode();return!s&&l&&(c.currentNode=n,s=c.nextNode()),s&&E(s,!0),s},focusPrevious(r=t){let n=e.current;if(!n)return null;let{from:o,tabbable:i=t.tabbable,wrap:l=t.wrap,accept:a=t.accept}=r,d=o||w(v(n)),c=g(n,{tabbable:i,accept:a});if(k(n,d))c.currentNode=d;else{let f=J(c);return f&&E(f,!0),f??null}let s=c.previousNode();if(!s&&l){c.currentNode=n;let f=J(c);if(!f)return null;s=f}return s&&E(s,!0),s??null},focusFirst(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=g(n,{tabbable:o,accept:i}).nextNode();return l&&E(l,!0),l},focusLast(r=t){let n=e.current;if(!n)return null;let{tabbable:o=t.tabbable,accept:i=t.accept}=r,l=J(g(n,{tabbable:o,accept:i}));return l&&E(l,!0),l??null}}}function J(e){let t,r;do r=e.lastChild(),r&&(t=r);while(r);return t}var it=class he{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let o=this.fastMap.get(r??null);if(!o)return;let i=new X({scopeRef:t});o.addChild(i),i.parent=o,this.fastMap.set(t,i),n&&(i.nodeToRestore=n)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let n=r.parent;for(let i of this.traverse())i!==r&&r.nodeToRestore&&i.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&T(i.nodeToRestore,r.scopeRef.current)&&(i.nodeToRestore=r.nodeToRestore);let o=r.children;n&&(n.removeChild(r),o.size>0&&o.forEach(i=>n&&n.addChild(i))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var r;let t=new he;for(let n of this.traverse())t.addTreeNode(n.scopeRef,((r=n.parent)==null?void 0:r.scopeRef)??null,n.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new X({scopeRef:null}),this.fastMap.set(null,this.root)}},X=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}},m=new it,de={border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"};function fe(e={}){let{style:t,isFocusable:r}=e,[n,o]=(0,h.useState)(!1),{focusWithinProps:i}=ke({isDisabled:!r,onFocusWithinChange:a=>o(a)}),l=(0,h.useMemo)(()=>n?t:t?{...de,...t}:de,[n]);return{visuallyHiddenProps:{...i,style:l}}}function lt(e){let{children:t,elementType:r="div",isFocusable:n,style:o,...i}=e,{visuallyHiddenProps:l}=fe(e);return h.createElement(r,Pe(i,l),t)}var ct=(0,h.createContext)(null);(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null),(0,h.createContext)(null);var st=(0,h.createContext)({}),at=(0,h.createContext)(null);(0,h.createContext)(null);export{z as _,fe as a,g as c,U as d,$e as f,Oe as g,Ve as h,lt as i,ot as l,je as m,at as n,et as o,Ue as p,st as r,Ge as s,ct as t,Ye as u,De as v,oe as y};
@@ -1 +1 @@
1
- import{s as v}from"./chunk-LvLJmgfZ.js";import{i as E,p as T,u as C}from"./useEvent-D91BmmQi.js";import{t as H}from"./react-Bj1aDYRI.js";import{En as M,Fn as S,Hi as F,Ui as f,mt as I,p as L}from"./cells-DLYs3NiJ.js";import{t as g}from"./compiler-runtime-B3qBwwSJ.js";import{g as j}from"./useEventListener-C0195JsF.js";import{c as w}from"./utils-BWBBpCkT.js";import{E as _}from"./config-DAL-jiRM.js";import{t as N}from"./jsx-runtime-Blw4afVn.js";import{t as V}from"./tooltip-4bZlU7jl.js";import{t as $}from"./copy-icon-neDQUo4Q.js";import{t as A}from"./usePress-5hBv4sjD.js";import{n as O}from"./useDebounce-JDKr83KO.js";import{t as k}from"./useRunCells-kmbsc2R5.js";var W=g(),m=v(H(),1),l=v(N(),1);const q=e=>{let t=(0,W.c)(16),r,n,i;t[0]===e?(r=t[1],n=t[2],i=t[3]):({href:n,children:r,...i}=e,t[0]=e,t[1]=r,t[2]=n,t[3]=i);let a=(0,m.useRef)(null),o;t[4]===n?o=t[5]:(o=()=>{let h=new URL(globalThis.location.href);h.hash=n,globalThis.history.pushState({},"",h.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let R=n.slice(1),x=document.getElementById(R);x&&x.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=o);let s=o,c;t[6]===s?c=t[7]:(c={onPress:()=>{s()}},t[6]=s,t[7]=c);let{pressProps:d}=A(c),u;t[8]===s?u=t[9]:(u=h=>{h.preventDefault(),s()},t[8]=s,t[9]=u);let b=u,p;return t[10]!==r||t[11]!==b||t[12]!==n||t[13]!==d||t[14]!==i?(p=(0,l.jsx)("a",{ref:a,href:n,...d,onClick:b,...i,children:r}),t[10]=r,t[11]=b,t[12]=n,t[13]=d,t[14]=i,t[15]=p):p=t[15],p};async function z(e){let t=L().inOrderIds.at(0);if(t)try{let r=await M.request({document:e,cellId:t});if(!r||r.options.length===0)return;let n=e.split(".").pop()??e,i=r.options[0],a=r.options.find(o=>o.name===n)??i;a!=null&&a.completion_info&&E.set(S,{documentation:a.completion_info})}catch(r){j.debug(`Doc lookup failed for "${e}"`,r)}}var P=g();const D=e=>{let t=(0,P.c)(8),{qualifiedName:r,children:n}=e,i;t[0]===r?i=t[1]:(i=()=>{z(r)},t[0]=r,t[1]=i);let a=O(i,100),o;t[2]===a?o=t[3]:(o=()=>a.cancel(),t[2]=a,t[3]=o);let s;return t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,l.jsx)("span",{onMouseEnter:a,onMouseLeave:o,children:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7],s};function U(e){if(typeof e!="object"||!e)return!1;let t=e;return!(t.trusted!==!0||t.notebookCode!==void 0&&typeof t.notebookCode!="string")}function B(){let e=window==null?void 0:window.__MARIMO_EXPORT_CONTEXT__;return U(e)?e:void 0}function y(){var e;return((e=B())==null?void 0:e.trusted)===!0}function X(){if(E.get(k)||y()||E.get(w))return!0;try{if(_()==="read")return!0}catch{}return!1}var G=T(e=>{let t=e(k),r=e(w);if(t||r||y())return!1;let n=!0;try{n=_()==="read"}catch{return!0}return!n});function J(){return C(G)}var K=g(),Y=e=>{if(e instanceof f.Element&&!/^[A-Za-z][\w-]*$/.test(e.name))return m.createElement(m.Fragment)},Z=(e,t)=>{if(t instanceof f.Element&&t.name==="body"){if((0,m.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},Q=(e,t)=>{if(t instanceof f.Element&&t.name==="html"){if((0,m.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},tt=e=>{if(e instanceof f.Element&&e.attribs&&e.name==="iframe"){let t=document.createElement("iframe");return Object.entries(e.attribs).forEach(([r,n])=>{r.startsWith('"')&&r.endsWith('"')&&(r=r.slice(1,-1)),t.setAttribute(r,n)}),(0,l.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},et=e=>{if(e instanceof f.Element&&e.name==="script"){let t=e.attribs.src;if(!t)return;if(!X())return j.warn(`[RenderHTML] refusing <script src> in untrusted context: ${t}`),(0,l.jsx)(l.Fragment,{});if(![...document.querySelectorAll("script[src]")].some(r=>r.getAttribute("src")===t)){let r=document.createElement("script");r.src=t,document.head.append(r)}return(0,l.jsx)(l.Fragment,{})}},rt=(e,t)=>{if(t instanceof f.Element&&t.name==="a"){let r=t.attribs.href;if(r!=null&&r.startsWith("#")&&!r.startsWith("#code/")){let n=null;return(0,m.isValidElement)(e)&&"props"in e&&(n=e.props.children),(0,l.jsx)(q,{href:r,...t.attribs,children:n})}}},nt=(e,t,r)=>{var n,i;if(t instanceof f.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,l.jsx)(lt,{children:e},r)},it=(e,t,r)=>{var i;if(!(t instanceof f.Element)||t.name!=="img")return;let n=(i=t.attribs)==null?void 0:i.src;if(!(!n||!(0,m.isValidElement)(e))&&!/^data:/i.test(n))return(0,m.cloneElement)(e,{key:`${n}-${r}`})},at=(e,t,r)=>{var n;if(!(!(t instanceof f.Element)||t.name!=="input")&&((n=t.attribs)==null?void 0:n.type)==="checkbox"&&(0,m.isValidElement)(e))return(0,m.cloneElement)(e,{key:`checkbox-${r}-${"checked"in t.attribs}`})},ot=(e,t)=>{var r;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,l.jsx)(D,{qualifiedName:n,children:e})}},st=(e,t)=>{var r,n;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-tooltip"])){if((((n=t.name)==null?void 0:n.toLowerCase())??"").startsWith("marimo-"))return;let i=t.attribs["data-tooltip"];return(0,l.jsx)(V,{content:i,children:e})}},lt=e=>{let t=(0,K.c)(3),{children:r}=e,n=(0,m.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,l.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,l.jsx)($,{tooltip:!1,className:"p-1",value:()=>{var s;let o=(s=n.current)==null?void 0:s.firstChild;return o&&o.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,l.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[r,i]}),t[1]=r,t[2]=a),a};const ct=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r=!0})=>(0,l.jsx)(mt,{html:e,alwaysSanitizeHtml:r,additionalReplacements:t});var mt=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r})=>{let n=J();return ft({html:(0,m.useMemo)(()=>r||n?I(e):e,[e,r,n]),additionalReplacements:t})};function ft({html:e,additionalReplacements:t=[]}){let r=[Y,tt,et,...t],n=[nt,rt,ot,st,Z,Q],i=[it,at];return F(e,{replace:(a,o)=>{for(let s of r){let c=s(a,o);if(c)return c}return a},transform:(a,o,s)=>{let c=a;for(let d of n){let u=d(c,o,s);if(u){c=u;break}}for(let d of i){let u=d(c,o,s);u&&(c=u)}return c}})}export{y as n,ct as t};
1
+ import{s as v}from"./chunk-LvLJmgfZ.js";import{i as E,p as T,u as C}from"./useEvent-D91BmmQi.js";import{t as M}from"./react-Bj1aDYRI.js";import{En as S,Fn as H,Ui as F,Wi as f,mt as I,p as L}from"./cells-DxL32Atg.js";import{t as g}from"./compiler-runtime-B3qBwwSJ.js";import{g as j}from"./useEventListener-B_wSLgFR.js";import{c as w}from"./utils-C5VWChv9.js";import{E as _}from"./config-Bm5B9wGP.js";import{t as N}from"./jsx-runtime-Blw4afVn.js";import{t as V}from"./tooltip-BcgbFR7q.js";import{t as W}from"./copy-icon-DWG8Y-xW.js";import{t as $}from"./usePress-5hBv4sjD.js";import{n as A}from"./useDebounce-JDKr83KO.js";import{t as k}from"./useRunCells-8xYRh7wH.js";var O=g(),m=v(M(),1),l=v(N(),1);const q=e=>{let t=(0,O.c)(16),r,n,i;t[0]===e?(r=t[1],n=t[2],i=t[3]):({href:n,children:r,...i}=e,t[0]=e,t[1]=r,t[2]=n,t[3]=i);let a=(0,m.useRef)(null),o;t[4]===n?o=t[5]:(o=()=>{let h=new URL(globalThis.location.href);h.hash=n,globalThis.history.pushState({},"",h.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let R=n.slice(1),x=document.getElementById(R);x&&x.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=o);let s=o,c;t[6]===s?c=t[7]:(c={onPress:()=>{s()}},t[6]=s,t[7]=c);let{pressProps:d}=$(c),u;t[8]===s?u=t[9]:(u=h=>{h.preventDefault(),s()},t[8]=s,t[9]=u);let b=u,p;return t[10]!==r||t[11]!==b||t[12]!==n||t[13]!==d||t[14]!==i?(p=(0,l.jsx)("a",{ref:a,href:n,...d,onClick:b,...i,children:r}),t[10]=r,t[11]=b,t[12]=n,t[13]=d,t[14]=i,t[15]=p):p=t[15],p};async function z(e){let t=L().inOrderIds.at(0);if(t)try{let r=await S.request({document:e,cellId:t});if(!r||r.options.length===0)return;let n=e.split(".").pop()??e,i=r.options[0],a=r.options.find(o=>o.name===n)??i;a!=null&&a.completion_info&&E.set(H,{documentation:a.completion_info})}catch(r){j.debug(`Doc lookup failed for "${e}"`,r)}}var P=g();const D=e=>{let t=(0,P.c)(8),{qualifiedName:r,children:n}=e,i;t[0]===r?i=t[1]:(i=()=>{z(r)},t[0]=r,t[1]=i);let a=A(i,100),o;t[2]===a?o=t[3]:(o=()=>a.cancel(),t[2]=a,t[3]=o);let s;return t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,l.jsx)("span",{onMouseEnter:a,onMouseLeave:o,children:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7],s};function U(e){if(typeof e!="object"||!e)return!1;let t=e;return!(t.trusted!==!0||t.notebookCode!==void 0&&typeof t.notebookCode!="string")}function B(){let e=window==null?void 0:window.__MARIMO_EXPORT_CONTEXT__;return U(e)?e:void 0}function y(){var e;return((e=B())==null?void 0:e.trusted)===!0}function X(){if(E.get(k)||y()||E.get(w))return!0;try{if(_()==="read")return!0}catch{}return!1}var G=T(e=>{let t=e(k),r=e(w);if(t||r||y())return!1;let n=!0;try{n=_()==="read"}catch{return!0}return!n});function J(){return C(G)}var K=g(),Y=e=>{if(e instanceof f.Element&&!/^[A-Za-z][\w-]*$/.test(e.name))return m.createElement(m.Fragment)},Z=(e,t)=>{if(t instanceof f.Element&&t.name==="body"){if((0,m.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},Q=(e,t)=>{if(t instanceof f.Element&&t.name==="html"){if((0,m.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},tt=e=>{if(e instanceof f.Element&&e.attribs&&e.name==="iframe"){let t=document.createElement("iframe");return Object.entries(e.attribs).forEach(([r,n])=>{r.startsWith('"')&&r.endsWith('"')&&(r=r.slice(1,-1)),t.setAttribute(r,n)}),(0,l.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},et=e=>{if(e instanceof f.Element&&e.name==="script"){let t=e.attribs.src;if(!t)return;if(!X())return j.warn(`[RenderHTML] refusing <script src> in untrusted context: ${t}`),(0,l.jsx)(l.Fragment,{});if(![...document.querySelectorAll("script[src]")].some(r=>r.getAttribute("src")===t)){let r=document.createElement("script");r.src=t,document.head.append(r)}return(0,l.jsx)(l.Fragment,{})}},rt=(e,t)=>{if(t instanceof f.Element&&t.name==="a"){let r=t.attribs.href;if(r!=null&&r.startsWith("#")&&!r.startsWith("#code/")){let n=null;return(0,m.isValidElement)(e)&&"props"in e&&(n=e.props.children),(0,l.jsx)(q,{href:r,...t.attribs,children:n})}}},nt=(e,t,r)=>{var n,i;if(t instanceof f.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,l.jsx)(lt,{children:e},r)},it=(e,t,r)=>{var i;if(!(t instanceof f.Element)||t.name!=="img")return;let n=(i=t.attribs)==null?void 0:i.src;if(!(!n||!(0,m.isValidElement)(e))&&!/^data:/i.test(n))return(0,m.cloneElement)(e,{key:`${n}-${r}`})},at=(e,t,r)=>{var n;if(!(!(t instanceof f.Element)||t.name!=="input")&&((n=t.attribs)==null?void 0:n.type)==="checkbox"&&(0,m.isValidElement)(e))return(0,m.cloneElement)(e,{key:`checkbox-${r}-${"checked"in t.attribs}`})},ot=(e,t)=>{var r;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,l.jsx)(D,{qualifiedName:n,children:e})}},st=(e,t)=>{var r,n;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-tooltip"])){if((((n=t.name)==null?void 0:n.toLowerCase())??"").startsWith("marimo-"))return;let i=t.attribs["data-tooltip"];return(0,l.jsx)(V,{content:i,children:e})}},lt=e=>{let t=(0,K.c)(3),{children:r}=e,n=(0,m.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,l.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,l.jsx)(W,{tooltip:!1,className:"p-1",value:()=>{var s;let o=(s=n.current)==null?void 0:s.firstChild;return o&&o.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,l.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[r,i]}),t[1]=r,t[2]=a),a};const ct=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r=!0})=>(0,l.jsx)(mt,{html:e,alwaysSanitizeHtml:r,additionalReplacements:t});var mt=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r})=>{let n=J();return ft({html:(0,m.useMemo)(()=>r||n?I(e):e,[e,r,n]),additionalReplacements:t})};function ft({html:e,additionalReplacements:t=[]}){let r=[Y,tt,et,...t],n=[nt,rt,ot,st,Z,Q],i=[it,at];return F(e,{replace:(a,o)=>{for(let s of r){let c=s(a,o);if(c)return c}return a},transform:(a,o,s)=>{let c=a;for(let d of n){let u=d(c,o,s);if(u){c=u;break}}for(let d of i){let u=d(c,o,s);u&&(c=u)}return c}})}export{y as n,ct as t};
@@ -1 +1 @@
1
- import{s as S}from"./chunk-LvLJmgfZ.js";import{t as D}from"./react-Bj1aDYRI.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{_ as M}from"./useEventListener-C0195JsF.js";import{h as w,u as q}from"./config-DAL-jiRM.js";import{n as E,t as T}from"./cn-DYvqRARy.js";import{t as F}from"./jsx-runtime-Blw4afVn.js";import{t as O}from"./tooltip-4bZlU7jl.js";import{r as W}from"./button-DDGiD1NW.js";import{r as L}from"./requests-9-v2bhoi.js";import{t as V}from"./createLucideIcon-w-Qo9n0R.js";import{i as N}from"./useDeleteCell-Cy23OP4e.js";import{C as B,O as I,ut as P,w as K}from"./input-JxFwu-3G.js";import{t as U}from"./square-DFICx2Qv.js";import{N as H,P as C,V as G,j as _,k as J}from"./usePress-5hBv4sjD.js";import{l as Q}from"./RSPContexts-WiCgGm__.js";import{t as X}from"./context-BFPaAUK_.js";import{a as z}from"./renderShortcut-Bl8_FVn8.js";var Y=V("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"}]]),y=S(D(),1);function Z(n,e){let{"aria-label":t,"aria-labelledby":a,orientation:r="horizontal"}=n,[o,c]=(0,y.useState)(!1);G(()=>{var i;c(!!(e.current&&((i=e.current.parentElement)!=null&&i.closest('[role="toolbar"]'))))});let{direction:u}=X(),m=u==="rtl"&&r==="horizontal",f=Q(e),l=i=>{if(_(i.currentTarget,C(i))){if(r==="horizontal"&&i.key==="ArrowRight"||r==="vertical"&&i.key==="ArrowDown")m?f.focusPrevious():f.focusNext();else if(r==="horizontal"&&i.key==="ArrowLeft"||r==="vertical"&&i.key==="ArrowUp")m?f.focusNext():f.focusPrevious();else if(i.key==="Tab"){i.stopPropagation(),s.current=H(),i.shiftKey?f.focusFirst():f.focusLast();return}else return;i.stopPropagation(),i.preventDefault()}},s=(0,y.useRef)(null),b=i=>{!_(i.currentTarget,i.relatedTarget)&&!s.current&&(s.current=C(i))},p=i=>{if(s.current&&!_(i.currentTarget,i.relatedTarget)&&_(e.current,C(i))){var h;(h=s.current)==null||h.focus(),s.current=null}};return{toolbarProps:{...P(n,{labelable:!0}),role:o?"group":"toolbar","aria-orientation":r,"aria-label":t,"aria-labelledby":t==null?a:void 0,onKeyDownCapture:o?void 0:l,onFocusCapture:o?void 0:p,onBlurCapture:o?void 0:b}}}var $=(0,y.createContext)({}),ee=(0,y.forwardRef)(function(n,e){[n,e]=B(n,e,$);let{toolbarProps:t}=Z(n,e),a=K({...n,values:{orientation:n.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=P(n,{global:!0});return delete r.id,y.createElement(I.div,{...J(r,a,t),ref:e,slot:n.slot||void 0,"data-orientation":n.orientation||"horizontal"},a.children)}),te=x(),re=200;function R(n){let e=(0,te.c)(3),[t,a]=(0,y.useState)(!1),r,o;return e[0]===n?(r=e[1],o=e[2]):(r=()=>{if(!n)return;a(!1);let c=setTimeout(()=>{a(!0)},re);return()=>clearTimeout(c)},o=[n],e[0]=n,e[1]=r,e[2]=o),(0,y.useEffect)(r,o),n&&t}var A=x(),g=S(F(),1),oe=E("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"}});const k=n=>{let e=(0,A.c)(18),t,a,r,o,c,u,m;if(e[0]!==n){let{children:s,tooltip:b,disabled:p,variant:i,...h}=n;t=s,m=b;let d=p===void 0?!1:p;a=d,r=h,o=v=>{var j;d||((j=h.onClick)==null||j.call(h,v))},c=W.preventFocus,u=T(oe({variant:i}),h.className),e[0]=n,e[1]=t,e[2]=a,e[3]=r,e[4]=o,e[5]=c,e[6]=u,e[7]=m}else t=e[1],a=e[2],r=e[3],o=e[4],c=e[5],u=e[6],m=e[7];let f;e[8]!==t||e[9]!==a||e[10]!==r||e[11]!==o||e[12]!==c||e[13]!==u?(f=(0,g.jsx)("button",{disabled:a,...r,onClick:o,onMouseDown:c,className:u,children:t}),e[8]=t,e[9]=a,e[10]=r,e[11]=o,e[12]=c,e[13]=u,e[14]=f):f=e[14];let l=f;if(m){let s;return e[15]!==l||e[16]!==m?(s=(0,g.jsx)(O,{content:m,side:"top",delayDuration:200,usePortal:!1,children:l}),e[15]=l,e[16]=m,e[17]=s):s=e[17],s}return l},ae=n=>{let e=(0,A.c)(5),{children:t,className:a}=n,r;e[0]===a?r=e[1]:(r=T("flex items-center gap-1 bg-background m-[2px] rounded-full",a),e[0]=a,e[1]=r);let o;return e[2]!==t||e[3]!==r?(o=(0,g.jsx)(ee,{className:r,children:t}),e[2]=t,e[3]=r,e[4]=o):o=e[4],o};var ne=x();const ie=n=>{let e=(0,ne.c)(9),{connectionState:t,status:a}=n,{sendInterrupt:r}=L(),o=R(a==="running"),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=z("global.interrupt"),e[0]=c):c=e[0];let u;e[1]!==t||e[2]!==o?(u=w(t)||!o,e[1]=t,e[2]=o,e[3]=u):u=e[3];let m=o?r:M.NOOP,f=o?"stale":"disabled",l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=(0,g.jsx)(U,{strokeWidth:1.5}),e[4]=l):l=e[4];let s;return e[5]!==u||e[6]!==m||e[7]!==f?(s=(0,g.jsx)(k,{tooltip:c,disabled:u,onClick:m,variant:f,"data-testid":"run-button",children:l}),e[5]=u,e[6]=m,e[7]=f,e[8]=s):s=e[8],s};var le=x();function se({connectionState:n,needsRun:e,loading:t,inactive:a}){return w(n)?"disabled":e&&!t?"stale":t||a?"disabled":"green"}const de=n=>{let e=(0,le.c)(27),{onClick:t,connectionState:a,needsRun:r,status:o,config:c,edited:u}=n,m=o==="disabled-transitively",f=o==="running"||o==="queued",l,s;e[0]!==m||e[1]!==c.disabled||e[2]!==a||e[3]!==u||e[4]!==f||e[5]!==r?(l=w(a)||f||!c.disabled&&m&&!u,s=se({connectionState:a,needsRun:r,loading:f,inactive:l}),e[0]=m,e[1]=c.disabled,e[2]=a,e[3]=u,e[4]=f,e[5]=r,e[6]=l,e[7]=s):(l=e[6],s=e[7]);let b=s;if(c.disabled){let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(Y,{}),e[8]=d):d=e[8];let v;return e[9]!==l||e[10]!==t||e[11]!==b?(v=(0,g.jsx)(k,{tooltip:"Add code to notebook",disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:d}),e[9]=l,e[10]=t,e[11]=b,e[12]=v):v=e[12],v}if(!c.disabled&&m&&!u){let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(N,{strokeWidth:1.2}),e[13]=d):d=e[13];let v;return e[14]!==l||e[15]!==t||e[16]!==b?(v=(0,g.jsx)(k,{disabled:l,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:t,variant:b,"data-testid":"run-button",children:d}),e[14]=l,e[15]=t,e[16]=b,e[17]=v):v=e[17],v}let p;if(w(a)){let d;e[18]===a?d=e[19]:(d=q(a),e[18]=a,e[19]=d),p=d}else if(o==="queued")p="This cell is already queued to run";else if(o==="running")p="This cell is already running.";else{let d;e[20]===Symbol.for("react.memo_cache_sentinel")?(d=z("cell.run"),e[20]=d):d=e[20],p=d}let i;e[21]===Symbol.for("react.memo_cache_sentinel")?(i=(0,g.jsx)(N,{strokeWidth:1.2}),e[21]=i):i=e[21];let h;return e[22]!==l||e[23]!==t||e[24]!==p||e[25]!==b?(h=(0,g.jsx)(k,{tooltip:p,disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:i}),e[22]=l,e[23]=t,e[24]=p,e[25]=b,e[26]=h):h=e[26],h};export{R as a,k as i,ie as n,ae as r,de as t};
1
+ import{s as S}from"./chunk-LvLJmgfZ.js";import{t as D}from"./react-Bj1aDYRI.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{_ as M}from"./useEventListener-B_wSLgFR.js";import{h as w,u as q}from"./config-Bm5B9wGP.js";import{n as E,t as T}from"./cn-DYvqRARy.js";import{t as F}from"./jsx-runtime-Blw4afVn.js";import{t as O}from"./tooltip-BcgbFR7q.js";import{r as W}from"./button-BB1AV4Rb.js";import{r as L}from"./requests-9-v2bhoi.js";import{t as V}from"./createLucideIcon-w-Qo9n0R.js";import{i as N}from"./useDeleteCell-DH0weyin.js";import{C as B,O as I,ut as P,w as K}from"./input-_AaMXWgD.js";import{t as U}from"./square-DFICx2Qv.js";import{N as H,P as C,V as G,j as _,k as J}from"./usePress-5hBv4sjD.js";import{l as Q}from"./RSPContexts-IrDQoFki.js";import{t as X}from"./context-BFPaAUK_.js";import{a as z}from"./renderShortcut-DnqsU4zj.js";var Y=V("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"}]]),y=S(D(),1);function Z(n,e){let{"aria-label":t,"aria-labelledby":a,orientation:r="horizontal"}=n,[o,c]=(0,y.useState)(!1);G(()=>{var i;c(!!(e.current&&((i=e.current.parentElement)!=null&&i.closest('[role="toolbar"]'))))});let{direction:u}=X(),m=u==="rtl"&&r==="horizontal",f=Q(e),l=i=>{if(_(i.currentTarget,C(i))){if(r==="horizontal"&&i.key==="ArrowRight"||r==="vertical"&&i.key==="ArrowDown")m?f.focusPrevious():f.focusNext();else if(r==="horizontal"&&i.key==="ArrowLeft"||r==="vertical"&&i.key==="ArrowUp")m?f.focusNext():f.focusPrevious();else if(i.key==="Tab"){i.stopPropagation(),s.current=H(),i.shiftKey?f.focusFirst():f.focusLast();return}else return;i.stopPropagation(),i.preventDefault()}},s=(0,y.useRef)(null),b=i=>{!_(i.currentTarget,i.relatedTarget)&&!s.current&&(s.current=C(i))},p=i=>{if(s.current&&!_(i.currentTarget,i.relatedTarget)&&_(e.current,C(i))){var h;(h=s.current)==null||h.focus(),s.current=null}};return{toolbarProps:{...P(n,{labelable:!0}),role:o?"group":"toolbar","aria-orientation":r,"aria-label":t,"aria-labelledby":t==null?a:void 0,onKeyDownCapture:o?void 0:l,onFocusCapture:o?void 0:p,onBlurCapture:o?void 0:b}}}var $=(0,y.createContext)({}),ee=(0,y.forwardRef)(function(n,e){[n,e]=B(n,e,$);let{toolbarProps:t}=Z(n,e),a=K({...n,values:{orientation:n.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=P(n,{global:!0});return delete r.id,y.createElement(I.div,{...J(r,a,t),ref:e,slot:n.slot||void 0,"data-orientation":n.orientation||"horizontal"},a.children)}),te=x(),re=200;function R(n){let e=(0,te.c)(3),[t,a]=(0,y.useState)(!1),r,o;return e[0]===n?(r=e[1],o=e[2]):(r=()=>{if(!n)return;a(!1);let c=setTimeout(()=>{a(!0)},re);return()=>clearTimeout(c)},o=[n],e[0]=n,e[1]=r,e[2]=o),(0,y.useEffect)(r,o),n&&t}var A=x(),g=S(F(),1),oe=E("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"}});const k=n=>{let e=(0,A.c)(18),t,a,r,o,c,u,m;if(e[0]!==n){let{children:s,tooltip:b,disabled:p,variant:i,...h}=n;t=s,m=b;let d=p===void 0?!1:p;a=d,r=h,o=v=>{var j;d||((j=h.onClick)==null||j.call(h,v))},c=W.preventFocus,u=T(oe({variant:i}),h.className),e[0]=n,e[1]=t,e[2]=a,e[3]=r,e[4]=o,e[5]=c,e[6]=u,e[7]=m}else t=e[1],a=e[2],r=e[3],o=e[4],c=e[5],u=e[6],m=e[7];let f;e[8]!==t||e[9]!==a||e[10]!==r||e[11]!==o||e[12]!==c||e[13]!==u?(f=(0,g.jsx)("button",{disabled:a,...r,onClick:o,onMouseDown:c,className:u,children:t}),e[8]=t,e[9]=a,e[10]=r,e[11]=o,e[12]=c,e[13]=u,e[14]=f):f=e[14];let l=f;if(m){let s;return e[15]!==l||e[16]!==m?(s=(0,g.jsx)(O,{content:m,side:"top",delayDuration:200,usePortal:!1,children:l}),e[15]=l,e[16]=m,e[17]=s):s=e[17],s}return l},ae=n=>{let e=(0,A.c)(5),{children:t,className:a}=n,r;e[0]===a?r=e[1]:(r=T("flex items-center gap-1 bg-background m-[2px] rounded-full",a),e[0]=a,e[1]=r);let o;return e[2]!==t||e[3]!==r?(o=(0,g.jsx)(ee,{className:r,children:t}),e[2]=t,e[3]=r,e[4]=o):o=e[4],o};var ne=x();const ie=n=>{let e=(0,ne.c)(9),{connectionState:t,status:a}=n,{sendInterrupt:r}=L(),o=R(a==="running"),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=z("global.interrupt"),e[0]=c):c=e[0];let u;e[1]!==t||e[2]!==o?(u=w(t)||!o,e[1]=t,e[2]=o,e[3]=u):u=e[3];let m=o?r:M.NOOP,f=o?"stale":"disabled",l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=(0,g.jsx)(U,{strokeWidth:1.5}),e[4]=l):l=e[4];let s;return e[5]!==u||e[6]!==m||e[7]!==f?(s=(0,g.jsx)(k,{tooltip:c,disabled:u,onClick:m,variant:f,"data-testid":"run-button",children:l}),e[5]=u,e[6]=m,e[7]=f,e[8]=s):s=e[8],s};var le=x();function se({connectionState:n,needsRun:e,loading:t,inactive:a}){return w(n)?"disabled":e&&!t?"stale":t||a?"disabled":"green"}const de=n=>{let e=(0,le.c)(27),{onClick:t,connectionState:a,needsRun:r,status:o,config:c,edited:u}=n,m=o==="disabled-transitively",f=o==="running"||o==="queued",l,s;e[0]!==m||e[1]!==c.disabled||e[2]!==a||e[3]!==u||e[4]!==f||e[5]!==r?(l=w(a)||f||!c.disabled&&m&&!u,s=se({connectionState:a,needsRun:r,loading:f,inactive:l}),e[0]=m,e[1]=c.disabled,e[2]=a,e[3]=u,e[4]=f,e[5]=r,e[6]=l,e[7]=s):(l=e[6],s=e[7]);let b=s;if(c.disabled){let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(Y,{}),e[8]=d):d=e[8];let v;return e[9]!==l||e[10]!==t||e[11]!==b?(v=(0,g.jsx)(k,{tooltip:"Add code to notebook",disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:d}),e[9]=l,e[10]=t,e[11]=b,e[12]=v):v=e[12],v}if(!c.disabled&&m&&!u){let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(N,{strokeWidth:1.2}),e[13]=d):d=e[13];let v;return e[14]!==l||e[15]!==t||e[16]!==b?(v=(0,g.jsx)(k,{disabled:l,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:t,variant:b,"data-testid":"run-button",children:d}),e[14]=l,e[15]=t,e[16]=b,e[17]=v):v=e[17],v}let p;if(w(a)){let d;e[18]===a?d=e[19]:(d=q(a),e[18]=a,e[19]=d),p=d}else if(o==="queued")p="This cell is already queued to run";else if(o==="running")p="This cell is already running.";else{let d;e[20]===Symbol.for("react.memo_cache_sentinel")?(d=z("cell.run"),e[20]=d):d=e[20],p=d}let i;e[21]===Symbol.for("react.memo_cache_sentinel")?(i=(0,g.jsx)(N,{strokeWidth:1.2}),e[21]=i):i=e[21];let h;return e[22]!==l||e[23]!==t||e[24]!==p||e[25]!==b?(h=(0,g.jsx)(k,{tooltip:p,disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:i}),e[22]=l,e[23]=t,e[24]=p,e[25]=b,e[26]=h):h=e[26],h};export{R as a,k as i,ie as n,ae as r,de as t};