@marimo-team/frontend 0.23.5-dev5 → 0.23.5-dev7

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 (283) hide show
  1. package/dist/assets/{CellStatus-PIeZtHEl.js → CellStatus-DKMrz26-.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-BPVOWDZX.js → ConnectedDataExplorerComponent-DNoHDaQW.js} +1 -1
  3. package/dist/assets/{DeferredRequestRegistry-DjHgMr3S.js → DeferredRequestRegistry-CUzZ0y7K.js} +1 -1
  4. package/dist/assets/{ImperativeModal-BBqcKmmk.js → ImperativeModal-D7lQ0Q7_.js} +1 -1
  5. package/dist/assets/{JsonOutput-CsshJCMI.js → JsonOutput-Bw-rSneQ.js} +7 -7
  6. package/dist/assets/{LazyAnyLanguageCodeMirror-0gZO1asr.js → LazyAnyLanguageCodeMirror-BF3xpDgO.js} +2 -2
  7. package/dist/assets/{MarimoErrorOutput-B9_RO5eX.js → MarimoErrorOutput-Dbk0HqOA.js} +2 -2
  8. package/dist/assets/{RSPContexts-BeHIgT4C.js → RSPContexts-CINae4Gg.js} +1 -1
  9. package/dist/assets/RenderHTML-8cI8zL5y.js +1 -0
  10. package/dist/assets/RunButton-DHxYW_jZ.js +1 -0
  11. package/dist/assets/{add-cell-with-ai-DjfY8mF1.js → add-cell-with-ai-DfniMbLM.js} +8 -8
  12. package/dist/assets/{add-connection-dialog-BY0poJft.js → add-connection-dialog-C14LN8_M.js} +6 -6
  13. package/dist/assets/{agent-panel-BvH5q5xP.js → agent-panel-CkK6oJn7.js} +3 -3
  14. package/dist/assets/{ai-model-dropdown-By4Ohb0R.js → ai-model-dropdown-BFTnsrTP.js} +4 -4
  15. package/dist/assets/{any-language-editor-uGTbJddl.js → any-language-editor-C9DM60EN.js} +1 -1
  16. package/dist/assets/{app-config-button-YS8lpoUa.js → app-config-button-c_2rVezv.js} +1 -1
  17. package/dist/assets/{architectureDiagram-VXUJARFQ-Bkuya2Lz.js → architectureDiagram-VXUJARFQ-JNogHSZh.js} +1 -1
  18. package/dist/assets/{blockDiagram-VD42YOAC-BypAXGhs.js → blockDiagram-VD42YOAC-Dy-_c6-H.js} +1 -1
  19. package/dist/assets/{c4Diagram-YG6GDRKO-C8Q7ceaK.js → c4Diagram-YG6GDRKO-DHRUX7S-.js} +1 -1
  20. package/dist/assets/{cache-panel-BHTrsFvx.js → cache-panel-B_zs00Q_.js} +1 -1
  21. package/dist/assets/{cell-editor-B43gqTef.js → cell-editor-F9uW-xZK.js} +10 -10
  22. package/dist/assets/{cell-link-d38hFEon.js → cell-link-BRdZl0OJ.js} +1 -1
  23. package/dist/assets/{cells-A-ljPpuj.js → cells-CcBfzJ1Z.js} +51 -51
  24. package/dist/assets/channel-CWEEnT6g.js +1 -0
  25. package/dist/assets/{chat-display-Be0U92hE.js → chat-display-NiFkPnNN.js} +1 -1
  26. package/dist/assets/{chat-panel-BEz970S3.js → chat-panel-C6V6gxrr.js} +1 -1
  27. package/dist/assets/{chat-ui-CdW7awFa.js → chat-ui-BLiRBYhk.js} +1 -1
  28. package/dist/assets/{chunk-5FQGJX7Z-B4RvNAGm.js → chunk-5FQGJX7Z-e_arGD4o.js} +3 -3
  29. package/dist/assets/{chunk-ABZYJK2D-X_7JfTbo.js → chunk-ABZYJK2D-BInZW7OW.js} +1 -1
  30. package/dist/assets/{chunk-ATLVNIR6-BvOe4C7U.js → chunk-ATLVNIR6-_9Zaw7IP.js} +1 -1
  31. package/dist/assets/{chunk-B4BG7PRW-DuJr4Vxg.js → chunk-B4BG7PRW-Bg43tpY1.js} +1 -1
  32. package/dist/assets/{chunk-DI55MBZ5-U7-ld--F.js → chunk-DI55MBZ5-DX01Gov5.js} +1 -1
  33. package/dist/assets/{chunk-EXTU4WIE-B7W_a4w2.js → chunk-EXTU4WIE-Cwo9-IiR.js} +1 -1
  34. package/dist/assets/{chunk-JA3XYJ7Z-EueUUcXO.js → chunk-JA3XYJ7Z-C6cvGHie.js} +1 -1
  35. package/dist/assets/{chunk-JZLCHNYA-Bx4SqpPS.js → chunk-JZLCHNYA-BM-e2D_8.js} +1 -1
  36. package/dist/assets/{chunk-N4CR4FBY-DlrBiMsl.js → chunk-N4CR4FBY-BREYOeLP.js} +2 -2
  37. package/dist/assets/{chunk-QN33PNHL-DQrYk9Fj.js → chunk-QN33PNHL-DwGffwWu.js} +1 -1
  38. package/dist/assets/{chunk-QXUST7PY-COkAFJCN.js → chunk-QXUST7PY-Q2jlSUop.js} +1 -1
  39. package/dist/assets/{chunk-S3R3BYOJ-GS_DuFun.js → chunk-S3R3BYOJ-DGKPoF4U.js} +1 -1
  40. package/dist/assets/{chunk-TZMSLE5B-uYzKNbMS.js → chunk-TZMSLE5B-Bfbjtd_W.js} +1 -1
  41. package/dist/assets/classDiagram-2ON5EDUG-CBbpzZPu.js +1 -0
  42. package/dist/assets/classDiagram-v2-WZHVMYZB-B0cWCuuo.js +1 -0
  43. package/dist/assets/{code-block-37QAKDTI-JYeq6pxz.js → code-block-37QAKDTI-CtU_48GW.js} +1 -1
  44. package/dist/assets/{column-preview-DUPpv2dz.js → column-preview-8uxaalCj.js} +1 -1
  45. package/dist/assets/{command-CXDOCJwp.js → command-CBCkexpx.js} +1 -1
  46. package/dist/assets/{command-palette-B5AX7Cgd.js → command-palette-DicMKinS.js} +1 -1
  47. package/dist/assets/{common-DC9LEIym.js → common-CHmdPmWi.js} +1 -1
  48. package/dist/assets/{components-FepcpFGL.js → components-DVKf_7RU.js} +1 -1
  49. package/dist/assets/{components-BDnRtsA5.js → components-HCInimq-.js} +1 -1
  50. package/dist/assets/{config-ChCHm539.js → config-DczIUz0b.js} +1 -1
  51. package/dist/assets/{context-DGqo1TbK.js → context-B3MsQb-b.js} +1 -1
  52. package/dist/assets/{copy-icon-C67c9EwB.js → copy-icon-BYNydU7b.js} +1 -1
  53. package/dist/assets/{dagre-6UL2VRFP-DYsFeXDU.js → dagre-6UL2VRFP-DWD6iJku.js} +1 -1
  54. package/dist/assets/{data-grid-overlay-editor-BXZECgKd.js → data-grid-overlay-editor-DvZ8PZ2g.js} +1 -1
  55. package/dist/assets/{datasource-BCnGIjqn.js → datasource-Czm_KBfK.js} +2 -2
  56. package/dist/assets/{dates-DhByPWH5.js → dates-CAlnO9QB.js} +1 -1
  57. package/dist/assets/{dependency-graph-panel-k1WQZ4m-.js → dependency-graph-panel-DPKylrlr.js} +4 -4
  58. package/dist/assets/{diagram-PSM6KHXK-B8hv9RHG.js → diagram-PSM6KHXK-B_Cc0ttH.js} +1 -1
  59. package/dist/assets/{diagram-QEK2KX5R-G6A7hdno.js → diagram-QEK2KX5R-DhI0d2dH.js} +1 -1
  60. package/dist/assets/{diagram-S2PKOQOG-iaflbF2c.js → diagram-S2PKOQOG-cc2LNQee.js} +1 -1
  61. package/dist/assets/{dist-gG4VZW46.js → dist-A6v5-U3i.js} +1 -1
  62. package/dist/assets/{dist-C46P-i95.js → dist-B96NwXcp.js} +1 -1
  63. package/dist/assets/dist-BVBYIAbx.js +1 -0
  64. package/dist/assets/{dist-BMfl634h.js → dist-C204e66A.js} +1 -1
  65. package/dist/assets/{dist-COpce3-f.js → dist-CEUFTp7U.js} +1 -1
  66. package/dist/assets/{dist-DmZscTVZ.js → dist-CGDn0y-i.js} +1 -1
  67. package/dist/assets/{dist-BMGjzUx5.js → dist-CmTrDl8w.js} +1 -1
  68. package/dist/assets/{dist-nYyvRYnq.js → dist-Cmcbyg5X.js} +1 -1
  69. package/dist/assets/dist-Cn0rcGlX.js +1 -0
  70. package/dist/assets/{dist-CVTRujA4.js → dist-CwZoXpmG.js} +1 -1
  71. package/dist/assets/{dist-D68AVdXh.js → dist-Cwcldbhl.js} +1 -1
  72. package/dist/assets/{dist-CEysMnMQ.js → dist-DBiqbYe-.js} +1 -1
  73. package/dist/assets/dist-DMSWEOfO.js +1 -0
  74. package/dist/assets/{dist-Ds4ite_2.js → dist-DQOq2Tf-.js} +1 -1
  75. package/dist/assets/dist-Dn_fCOGr.js +1 -0
  76. package/dist/assets/dist-Dq4wQg6C.js +1 -0
  77. package/dist/assets/{dist-DC5pDLoK.js → dist-Dw9UX7x1.js} +1 -1
  78. package/dist/assets/dist-R7_s36kw.js +1 -0
  79. package/dist/assets/{dist-b7WC6dxf.js → dist-RsQv8CvG.js} +1 -1
  80. package/dist/assets/{dist-OWcDq-O3.js → dist-_XomGjg6.js} +1 -1
  81. package/dist/assets/{dist-0xasIeT1.js → dist-_qPWf6sD.js} +1 -1
  82. package/dist/assets/{dist-BtG3xAGt.js → dist-rzeRelEY.js} +1 -1
  83. package/dist/assets/{documentation-panel-BMrGuByB.js → documentation-panel-DZkIKuPv.js} +1 -1
  84. package/dist/assets/{download-Iyng0xCz.js → download-YUQiaxS9.js} +3 -3
  85. package/dist/assets/edit-page-BiiE4rVw.js +9 -0
  86. package/dist/assets/{erDiagram-Q2GNP2WA-DyZONgFt.js → erDiagram-Q2GNP2WA-CPtVWZYn.js} +1 -1
  87. package/dist/assets/{error-banner-CTBwdcdk.js → error-banner-C6aBa98y.js} +1 -1
  88. package/dist/assets/{error-panel-CHSsnRFF.js → error-panel-C4UQHEjp.js} +1 -1
  89. package/dist/assets/{es-YQvzKo5h.js → es-DaYh1PsD.js} +1 -1
  90. package/dist/assets/{esm-CbD72kxC.js → esm-BRNC35J6.js} +1 -1
  91. package/dist/assets/{esm-G1JMtvxe.js → esm-BmrwxxCo.js} +1 -1
  92. package/dist/assets/{field-B8kJgr2A.js → field-BrLPDxsA.js} +1 -1
  93. package/dist/assets/file-explorer-panel-Bq320epN.js +26 -0
  94. package/dist/assets/{file-icons-DTNZv05h.js → file-icons-CMxkj_kV.js} +1 -1
  95. package/dist/assets/{file-name-input-CLlFR7p-.js → file-name-input-C70pv8AE.js} +2 -2
  96. package/dist/assets/{floating-outline-CSNGDMAm.js → floating-outline-BtNnv2IX.js} +1 -1
  97. package/dist/assets/{flowDiagram-NV44I4VS-Bo2Wh9OF.js → flowDiagram-NV44I4VS-LeaIbfPS.js} +1 -1
  98. package/dist/assets/{focus-Baz7rlo0.js → focus-CXQpR65O.js} +1 -1
  99. package/dist/assets/{form-0wZOuqB-.js → form-x5lqxs04.js} +2 -2
  100. package/dist/assets/{formats-BvyJSIqk.js → formats-Dsc8AdCp.js} +1 -1
  101. package/dist/assets/{formatting-Cncf6ptO.js → formatting-TmuwpwTs.js} +1 -1
  102. package/dist/assets/{gallery-page-Ddl87lwR.js → gallery-page-C4kMatxN.js} +1 -1
  103. package/dist/assets/{ganttDiagram-JELNMOA3-Cc_BiCCk.js → ganttDiagram-JELNMOA3-Bj-STLOZ.js} +1 -1
  104. package/dist/assets/{gitGraphDiagram-V2S2FVAM-CGySG6ni.js → gitGraphDiagram-V2S2FVAM-B9HDL4DZ.js} +1 -1
  105. package/dist/assets/{glide-data-editor-Cr2RvoIz.js → glide-data-editor-CxV4Ph39.js} +4 -4
  106. package/dist/assets/{globals-xVhZei_S.js → globals-B-ZMi0ZU.js} +1 -1
  107. package/dist/assets/{home-page-QvO22-4u.js → home-page-CaIONOO0.js} +2 -2
  108. package/dist/assets/{hooks-BZOcKMEB.js → hooks-Dj8Y1kvn.js} +1 -1
  109. package/dist/assets/{square-Dj2Cf4ne.js → house-mGK3v0Mm.js} +1 -1
  110. package/dist/assets/{html-to-image-tbPEMBJg.js → html-to-image-BHdf1t5J.js} +1 -1
  111. package/dist/assets/{index-D48a2kB0.js → index-C3mazXKw.js} +7 -7
  112. package/dist/assets/{infoDiagram-HS3SLOUP-Ci2MRh_P.js → infoDiagram-HS3SLOUP-BDcw9LMK.js} +1 -1
  113. package/dist/assets/{input-DyPS_GiK.js → input-BX98vgAu.js} +1 -1
  114. package/dist/assets/{journeyDiagram-XKPGCS4Q-C9-9zg54.js → journeyDiagram-XKPGCS4Q-D29tj64e.js} +1 -1
  115. package/dist/assets/{kanban-definition-3W4ZIXB7-D4ivIK0L.js → kanban-definition-3W4ZIXB7-DStZ4tGj.js} +1 -1
  116. package/dist/assets/{kiosk-mode-cWTXpegb.js → kiosk-mode-vHMq9vr1.js} +1 -1
  117. package/dist/assets/layout-D-cLXGXf.js +9 -0
  118. package/dist/assets/{linear-Bn2iRj5i.js → linear-Cof2JLCQ.js} +1 -1
  119. package/dist/assets/{links-BHtUMVOq.js → links-iy4RlM-h.js} +1 -1
  120. package/dist/assets/{logs-panel-Dgkr6V7q.js → logs-panel-DL9WeQsv.js} +1 -1
  121. package/dist/assets/{markdown-renderer-CFrgiLqu.js → markdown-renderer-DmnGXdCp.js} +3 -3
  122. package/dist/assets/mermaid-4DMBBIKO-gHC2PS1m.js +1 -0
  123. package/dist/assets/{mermaid-D5Aj1ujy.js → mermaid-CXmjgj4p.js} +3 -3
  124. package/dist/assets/{mermaid-parser.core-DP6UBthl.js → mermaid-parser.core-BQULBKwL.js} +1 -1
  125. package/dist/assets/{mindmap-definition-VGOIOE7T-BBFkIzCl.js → mindmap-definition-VGOIOE7T-Cy9nt356.js} +1 -1
  126. package/dist/assets/{name-cell-input-C5LXTI3T.js → name-cell-input-CHuLB3H7.js} +1 -1
  127. package/dist/assets/{number-overlay-editor-Cu1bME8q.js → number-overlay-editor-8-GuvfJX.js} +1 -1
  128. package/dist/assets/{outline-panel-0lyts6z4.js → outline-panel-JaSUHnmD.js} +1 -1
  129. package/dist/assets/{packages-panel-BhI1lbfw.js → packages-panel-BB5_Iu2c.js} +1 -1
  130. package/dist/assets/{panels-8fPdoW9_.js → panels-LnVrD2Ph.js} +1 -1
  131. package/dist/assets/{pathUtils-CSrNy17a.js → pathUtils-DOhgNpTR.js} +1 -1
  132. package/dist/assets/{pieDiagram-ADFJNKIX-BYGTzW8w.js → pieDiagram-ADFJNKIX-CqhovvcK.js} +1 -1
  133. package/dist/assets/{precisionRound-CU2C3Vxx.js → precisionRound-C3fmBb6j.js} +1 -1
  134. package/dist/assets/{process-output-BwZ5VxXO.js → process-output-hJso9ugZ.js} +1 -1
  135. package/dist/assets/{quadrantDiagram-AYHSOK5B-D8NZ19FM.js → quadrantDiagram-AYHSOK5B-BNyiC3hL.js} +1 -1
  136. package/dist/assets/radio-group-6t7ozlnG.js +1 -0
  137. package/dist/assets/react-vega-C1LnPwEN.js +1 -0
  138. package/dist/assets/{react-vega-BQXvtE5G.js → react-vega-SibldZnp.js} +1 -1
  139. package/dist/assets/readonly-python-code-JBCsN3-9.js +1 -0
  140. package/dist/assets/{renderShortcut-CkNNAheg.js → renderShortcut-DZpkrZaP.js} +1 -1
  141. package/dist/assets/{request-registry-D-jptgP0.js → request-registry-BwzANGxx.js} +1 -1
  142. package/dist/assets/{requirementDiagram-UZGBJVZJ-lUcxJMXj.js → requirementDiagram-UZGBJVZJ-U4CoEx7e.js} +1 -1
  143. package/dist/assets/{reveal-component-LHeN9pMI.css → reveal-component-CMD1_gk8.css} +1 -1
  144. package/dist/assets/reveal-component-DvnP8FBq.js +91 -0
  145. package/dist/assets/{run-page-x3v_5tzv.js → run-page-DMkxXk3G.js} +1 -1
  146. package/dist/assets/{sankeyDiagram-TZEHDZUN-BJExQFWg.js → sankeyDiagram-TZEHDZUN-BXgCc5j4.js} +1 -1
  147. package/dist/assets/scratchpad-panel-CpKz-ArR.js +1 -0
  148. package/dist/assets/{secrets-panel-DeNY3rAp.js → secrets-panel-DaR50P_m.js} +1 -1
  149. package/dist/assets/{sequenceDiagram-WL72ISMW-DcfyJdc2.js → sequenceDiagram-WL72ISMW-CB8apKmu.js} +1 -1
  150. package/dist/assets/session-panel-DF0m0wH3.js +1 -0
  151. package/dist/assets/{share-BXN2Sd1t.js → share-DIVpiHPe.js} +1 -1
  152. package/dist/assets/{snippets-panel-CnN632Ki.js → snippets-panel-CQKr-OMs.js} +1 -1
  153. package/dist/assets/square-DMaNzePN.js +1 -0
  154. package/dist/assets/{state-svfaehZt.js → state-B34hXjp9.js} +1 -1
  155. package/dist/assets/{state-CikXvgx3.js → state-CraSoEHI.js} +3 -3
  156. package/dist/assets/{state-Bsz477is.js → state-DCT6JLba.js} +1 -1
  157. package/dist/assets/{state-CoWk7q5y.js → state-Z-H4o98V.js} +1 -1
  158. package/dist/assets/{stateDiagram-FKZM4ZOC-D379CBmo.js → stateDiagram-FKZM4ZOC-3YqeHe0_.js} +1 -1
  159. package/dist/assets/stateDiagram-v2-4FDKWEC3-Dfvjjqh4.js +1 -0
  160. package/dist/assets/stex-D6sqtveI.js +1 -0
  161. package/dist/assets/{swiper-component-DLxR3y4N.js → swiper-component-B-P7FNP9.js} +1 -1
  162. package/dist/assets/{switch-DlgpDZMk.js → switch-ecwOrzz3.js} +1 -1
  163. package/dist/assets/{terminal-D8ZS2O18.js → terminal-CQZ69wrS.js} +1 -1
  164. package/dist/assets/{textarea-Dd0InTQJ.js → textarea-BI_mXP9w.js} +1 -1
  165. package/dist/assets/{time-yM1OtSdb.js → time-C12vLLcl.js} +1 -1
  166. package/dist/assets/{timeline-definition-IT6M3QCI-ChCqM1Sl.js → timeline-definition-IT6M3QCI-DZQqxPSn.js} +1 -1
  167. package/dist/assets/{tracing-BZPLfSlB.js → tracing-BF-ca60a.js} +1 -1
  168. package/dist/assets/{tracing-panel-DBaQBraG.js → tracing-panel-D1j7Fbvr.js} +2 -2
  169. package/dist/assets/{tree-actions-oMCx6WNc.js → tree-actions-Ci3CV3hN.js} +1 -1
  170. package/dist/assets/{useBoolean-CLFdHewv.js → useBoolean-B_vDzBHf.js} +1 -1
  171. package/dist/assets/useCellActionButton-CcXV09GQ.js +1 -0
  172. package/dist/assets/{useDateFormatter-BEz9SEXo.js → useDateFormatter-CgFoBhVq.js} +1 -1
  173. package/dist/assets/{useDeleteCell-C2Stbb6Q.js → useDeleteCell-BVX9aH-t.js} +1 -1
  174. package/dist/assets/{useDependencyPanelTab-8WaMRWbo.js → useDependencyPanelTab-CewdyAAy.js} +1 -1
  175. package/dist/assets/{useInstallPackage-afgh7PwB.js → useInstallPackage-D0NLybAx.js} +1 -1
  176. package/dist/assets/useNotebookActions-CTBSmORR.js +1 -0
  177. package/dist/assets/{useNumberFormatter-wQU1z0W_.js → useNumberFormatter-DtiQW2H_.js} +1 -1
  178. package/dist/assets/{usePress-CtfZXGno.js → usePress-CfcdTqJM.js} +1 -1
  179. package/dist/assets/useRunCells-CgXnbA14.js +1 -0
  180. package/dist/assets/{useSplitCell-BZPuhd8z.js → useSplitCell-_Q2wQXsQ.js} +1 -1
  181. package/dist/assets/{utils-Bq5kLQ87.js → utils-CGtUbqcR.js} +1 -1
  182. package/dist/assets/{vega-component-BnaMdpJB.js → vega-component-BDK4MwYT.js} +1 -1
  183. package/dist/assets/{vega-loader.browser-DXARUlxo.js → vega-loader.browser-BegSZk0G.js} +1 -1
  184. package/dist/assets/{write-secret-modal-BfflSuL6.js → write-secret-modal-BFLUPDlo.js} +1 -1
  185. package/dist/assets/{xychartDiagram-PRI3JC2R-DVMdJM5H.js → xychartDiagram-PRI3JC2R-CmNNcgCM.js} +1 -1
  186. package/dist/index.html +105 -105
  187. package/package.json +1 -1
  188. package/src/components/editor/file-tree/file-explorer.tsx +38 -8
  189. package/src/components/editor/file-tree/file-operations.tsx +19 -2
  190. package/src/components/editor/notebook-cell.tsx +33 -23
  191. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -5
  192. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +2 -17
  193. package/src/components/slides/reveal-component.tsx +159 -47
  194. package/src/components/slides/reveal-slides.css +8 -0
  195. package/src/components/slides/slide-cell-view.tsx +182 -0
  196. package/src/components/slides/slide-form.tsx +2 -0
  197. package/src/core/cells/utils.ts +45 -0
  198. package/src/core/islands/stubs/slide-cell-view.tsx +30 -0
  199. package/src/core/meta/__tests__/code-visibility.test.tsx +141 -0
  200. package/src/core/meta/code-visibility.ts +48 -0
  201. package/dist/assets/RenderHTML-DR6lqJGS.js +0 -1
  202. package/dist/assets/channel-BMMN1KqZ.js +0 -1
  203. package/dist/assets/classDiagram-2ON5EDUG-DDa_MJVI.js +0 -1
  204. package/dist/assets/classDiagram-v2-WZHVMYZB-dZzbS5Uq.js +0 -1
  205. package/dist/assets/dist-BN_qisx5.js +0 -1
  206. package/dist/assets/dist-Bzlk7AB1.js +0 -1
  207. package/dist/assets/dist-CPCp_PIz.js +0 -1
  208. package/dist/assets/dist-CPWl1X8t.js +0 -1
  209. package/dist/assets/dist-Cc_qFbl6.js +0 -1
  210. package/dist/assets/dist-Crt3qZze.js +0 -1
  211. package/dist/assets/edit-page-Lwy52pkS.js +0 -9
  212. package/dist/assets/file-explorer-panel-DSahRBWr.js +0 -26
  213. package/dist/assets/layout-DXt0aA4F.js +0 -9
  214. package/dist/assets/mermaid-4DMBBIKO-BqnaUv4V.js +0 -1
  215. package/dist/assets/radio-group-BtBoRbGH.js +0 -1
  216. package/dist/assets/react-vega-BVATzlrQ.js +0 -1
  217. package/dist/assets/readonly-python-code-B0nrQE3U.js +0 -1
  218. package/dist/assets/reveal-component-CgCn23Mw.js +0 -91
  219. package/dist/assets/scratchpad-panel-CHFYLvso.js +0 -1
  220. package/dist/assets/session-panel-DMaf7Upn.js +0 -1
  221. package/dist/assets/slide-form-Dmi4fzLs.js +0 -1
  222. package/dist/assets/stateDiagram-v2-4FDKWEC3-c0yeJ4is.js +0 -1
  223. package/dist/assets/stex-Dn4qnyVB.js +0 -1
  224. package/dist/assets/useAddCell-De9xD63_.js +0 -1
  225. package/dist/assets/useCellActionButton-Bjxun3wK.js +0 -1
  226. package/dist/assets/useNotebookActions-v4SgyM_0.js +0 -1
  227. package/dist/assets/useRunCells-DU1tawR-.js +0 -1
  228. /package/dist/assets/{Deferred-DxQeE5uh.js → Deferred-DMWKlZOV.js} +0 -0
  229. /package/dist/assets/{SSRProvider-D3zWcDme.js → SSRProvider-kyGHZp36.js} +0 -0
  230. /package/dist/assets/{alert-cDholnQq.js → alert-DvqcBMUv.js} +0 -0
  231. /package/dist/assets/{badge-ChrPsdTW.js → badge-C7-HR1IO.js} +0 -0
  232. /package/dist/assets/{blob-CTort_or.js → blob-D-eV0cU3.js} +0 -0
  233. /package/dist/assets/{bundle.esm-DU-4isVC.js → bundle.esm-BIoPrMH_.js} +0 -0
  234. /package/dist/assets/{copy-B5qyZn5s.js → copy-BCF-tANo.js} +0 -0
  235. /package/dist/assets/{copy-Dk_3y0H-.js → copy-BwrPA9zQ.js} +0 -0
  236. /package/dist/assets/{database-zap-BUVn5HoR.js → database-zap-kIkTfzTX.js} +0 -0
  237. /package/dist/assets/{defaultLocale-BLne0bXb.js → defaultLocale-B6z1Qyqt.js} +0 -0
  238. /package/dist/assets/{defaultLocale-JieDVWC_.js → defaultLocale-YteS-k_t.js} +0 -0
  239. /package/dist/assets/{dialog-EekxpBBM.js → dialog-Dj0qTFnG.js} +0 -0
  240. /package/dist/assets/{dist-CRPTyqAT.js → dist-B324sPca.js} +0 -0
  241. /package/dist/assets/{dist-DZ2qbK2N.js → dist-E6ttb8td.js} +0 -0
  242. /package/dist/assets/{dist-DGxytjtv.js → dist-VjDnmGCZ.js} +0 -0
  243. /package/dist/assets/{ellipsis-pk06Lq82.js → ellipsis-KAhMaCIV.js} +0 -0
  244. /package/dist/assets/{ellipsis-vertical-gxgNyR5G.js → ellipsis-vertical-CkwWkOQL.js} +0 -0
  245. /package/dist/assets/{emotion-is-prop-valid.esm-DYxi7n2b.js → emotion-is-prop-valid.esm-DD4AwVTU.js} +0 -0
  246. /package/dist/assets/{en-US-BqRooSzc.js → en-US-D_il4jD7.js} +0 -0
  247. /package/dist/assets/{errors-CZb6hI2x.js → errors-TZBmrJmc.js} +0 -0
  248. /package/dist/assets/{events-Qeh-bHlj.js → events-BRAWQiYK.js} +0 -0
  249. /package/dist/assets/{extends-Co37_JfG.js → extends-B2LJnKU3.js} +0 -0
  250. /package/dist/assets/{eye-off-BT-KOYV5.js → eye-off-n1Li95bE.js} +0 -0
  251. /package/dist/assets/{file-HTLbeC2b.js → file-BrdxGLRX.js} +0 -0
  252. /package/dist/assets/{file-headphone-B3fuktN0.js → file-headphone-BrQspHac.js} +0 -0
  253. /package/dist/assets/{github-raQvpeuZ.js → github-BKS_2Qwn.js} +0 -0
  254. /package/dist/assets/{icons-BRopQwI3.js → icons-D9TuFTJG.js} +0 -0
  255. /package/dist/assets/{isValid-bmSEa3HX.js → isValid-C8T5uJYI.js} +0 -0
  256. /package/dist/assets/{kbd-CGShmG7L.js → kbd-B3Breaz2.js} +0 -0
  257. /package/dist/assets/{links-C-rLiK3d.js → links-Dpap8NI2.js} +0 -0
  258. /package/dist/assets/{micromark-factory-space-WzovnJik.js → micromark-factory-space-DzSMahmM.js} +0 -0
  259. /package/dist/assets/{numbers-OHL_xBiC.js → numbers-CAW8yjzj.js} +0 -0
  260. /package/dist/assets/{objectWithoutPropertiesLoose-smPWkHxB.js → objectWithoutPropertiesLoose-DaPAPabU.js} +0 -0
  261. /package/dist/assets/{ordinal-DEaY__23.js → ordinal-K0JYqmCT.js} +0 -0
  262. /package/dist/assets/{paths-CXng2XQv.js → paths-BXWH6vv4.js} +0 -0
  263. /package/dist/assets/{preload-helper-D2MJg03u.js → preload-helper-DItdS47A.js} +0 -0
  264. /package/dist/assets/{prop-types-BFRDxSKF.js → prop-types-BiQYf0aU.js} +0 -0
  265. /package/dist/assets/{purify.es-DC4RGS9t.js → purify.es-DBmVz-Wl.js} +0 -0
  266. /package/dist/assets/{range-1DwpgXvM.js → range-7fnH_zLA.js} +0 -0
  267. /package/dist/assets/{react-icons.esm-BUYTQ32a.js → react-icons.esm-D9xfKaPZ.js} +0 -0
  268. /package/dist/assets/{react-resizable-panels.browser.esm-Bcm5njwd.js → react-resizable-panels.browser.esm-BUNcfKXO.js} +0 -0
  269. /package/dist/assets/{session-nmTRerwF.js → session-VtovaFBS.js} +0 -0
  270. /package/dist/assets/{stex-jWatZkll.js → stex-CtmkcLz7.js} +0 -0
  271. /package/dist/assets/{table-23NNA1s9.js → table-DPyRV1LT.js} +0 -0
  272. /package/dist/assets/{trash-2-D280Xiwg.js → trash-2-CKlZA04n.js} +0 -0
  273. /package/dist/assets/{trash-uYoPsR8D.js → trash-CdBDfa8x.js} +0 -0
  274. /package/dist/assets/{triangle-alert-DBoAWWKA.js → triangle-alert-B8l157gP.js} +0 -0
  275. /package/dist/assets/{use-toast-BDYuj3zG.js → use-toast-T0_cQDma.js} +0 -0
  276. /package/dist/assets/{useAsyncData-dS4Ne6pU.js → useAsyncData-BFC6lWG9.js} +0 -0
  277. /package/dist/assets/{useDebounce-BDIglWmG.js → useDebounce-CLMpJfhX.js} +0 -0
  278. /package/dist/assets/{useHotkey-Bx4wWQCL.js → useHotkey-Cm0DaHEJ.js} +0 -0
  279. /package/dist/assets/{useIframeCapabilities-CryCjoyY.js → useIframeCapabilities-BvE4n6hj.js} +0 -0
  280. /package/dist/assets/{useTheme-DEcgJENn.js → useTheme-Cb4Wekek.js} +0 -0
  281. /package/dist/assets/{uuid-DXdzqzcr.js → uuid-DercMavo.js} +0 -0
  282. /package/dist/assets/{workflow-DYcZF-oV.js → workflow-ClChd5xI.js} +0 -0
  283. /package/dist/assets/{youtube-3lRHw8NU.js → youtube-CbdpN8oL.js} +0 -0
@@ -1,4 +1,4 @@
1
- var xi=Object.defineProperty;var wi=(t,e,a)=>e in t?xi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>wi(t,typeof e!="symbol"?e+"":e,a);import{s as qa,t as ki}from"./chunk-LvLJmgfZ.js";import{f as Hr,i as Gr,l as Ci,n as Qr,o as Ei,u as Xr}from"./useEvent-D91BmmQi.js";import{t as Ti}from"./react-Bj1aDYRI.js";import{$t as Ii,E as es,Ei as Si,Gr as Oi,In as Ai,Jn as Ri,Jr as Ni,Nn as ji,Pt as Mi,Sr as Pi,Ti as ts,Tr as as,_i as $i,b as Qe,di as Li,f as Di,fr as Zi,i as Fi,qt as rs,ur as zi,wr as Ui,xt as Va,yi as qi}from"./cells-A-ljPpuj.js";import{B as fe,D as Vi,E as ss,H as Wi,I as ut,J as ns,L as Y,N as is,O as Bi,P as z,R as v,S as Ji,T as ue,V as ze,W as os,b as ua,k as O,w as Ue,x as ca}from"./zod-H_cgTO0M.js";import{t as Dt}from"./compiler-runtime-B3qBwwSJ.js";import{T as Ki,t as Yi}from"./ai-model-dropdown-By4Ohb0R.js";import{_ as se,p as Hi}from"./useEventListener-BR0C1MaI.js";import{n as Gi}from"./utils-DIGrmLDO.js";import{o as Qi}from"./config-ChCHm539.js";import{t as Wa}from"./cn-DCUzRj2J.js";import{t as Xi}from"./jsx-runtime-BqBOg78p.js";import{d as eo}from"./popover-UExmgBsf.js";import{a as ls,c as to,p as ao,r as ro,t as so}from"./dropdown-menu-D1A3cFC8.js";import{t as pa}from"./tooltip-Gcwqb_SK.js";import{t as Xe}from"./button-D9nb17Rw.js";import{Ht as no,Jt as ma,St as ha,Vt as io,Wt as ds,Yt as fa,Zt as oo,at as us,ct as lo,lt as cs,rt as Ba,xt as uo}from"./dist-BrR4M-k3.js";import{t as co}from"./createReducer-1ePoj7v6.js";import{h as po,n as mo,o as ho,r as fo}from"./dist-HlsDto3K.js";import{i as ps}from"./strings-md4mFbOQ.js";import{r as go,t as yo}from"./requests-DIwGYs0l.js";import{t as Ja}from"./createLucideIcon-D5guW7EU.js";import{r as vo,t as bo}from"./fileToBase64-Bzn96tYq.js";import{t as ms}from"./x-C-6liIBr.js";import{f as _o,l as hs,n as xo}from"./markdown-renderer-CFrgiLqu.js";import{t as fs}from"./file-HTLbeC2b.js";import{t as wo}from"./image-DQHXdEQn.js";import{t as ko}from"./spinner-Bhir8k53.js";import{t as Co}from"./play-C7DcCsoO.js";import{r as Eo}from"./input-DyPS_GiK.js";import{t as To}from"./sparkles-CZ5WmLPA.js";import{a as Zt,i as It,o as Ft,r as St,s as Io,t as So}from"./datasource-BCnGIjqn.js";import{a as Oo}from"./dist-Ds4ite_2.js";import{t as Ka}from"./use-toast-BDYuj3zG.js";import{r as Ao}from"./useTheme-DEcgJENn.js";import{n as Ro}from"./useRunCells-DU1tawR-.js";import{r as No}from"./errors-CZb6hI2x.js";import{t as jo}from"./blob-CTort_or.js";import{i as Ya}from"./cell-link-d38hFEon.js";import{r as Mo,t as Po}from"./html-to-image-tbPEMBJg.js";import{n as Ha}from"./renderShortcut-CkNNAheg.js";import{n as $o}from"./icons-BRopQwI3.js";import{r as Lo,t as Do}from"./esm-G1JMtvxe.js";import{t as Zo}from"./process-output-BwZ5VxXO.js";import{t as Fo}from"./useDeleteCell-C2Stbb6Q.js";var gs=Ja("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),ys=Ja("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),vs=Ja("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),bs="vercel.ai.error",zo=Symbol.for(bs),_s,xs,je=class pi extends(xs=Error,_s=zo,xs){constructor({name:e,message:a,cause:r}){super(a),this[_s]=!0,this.name=e,this.cause=r}static isInstance(e){return pi.hasMarker(e,bs)}static hasMarker(e,a){let r=Symbol.for(a);return typeof e=="object"&&!!e&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function ws(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ks="AI_InvalidArgumentError",Cs=`vercel.ai.error.${ks}`,Uo=Symbol.for(Cs),Es,Ts,qo=class extends(Ts=je,Es=Uo,Ts){constructor({message:t,cause:e,argument:a}){super({name:ks,message:t,cause:e}),this[Es]=!0,this.argument=a}static isInstance(t){return je.hasMarker(t,Cs)}},Is="AI_JSONParseError",Ss=`vercel.ai.error.${Is}`,Vo=Symbol.for(Ss),Os,As,Rs=class extends(As=je,Os=Vo,As){constructor({text:t,cause:e}){super({name:Is,message:`JSON parsing failed: Text: ${t}.
1
+ var xi=Object.defineProperty;var wi=(t,e,a)=>e in t?xi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>wi(t,typeof e!="symbol"?e+"":e,a);import{s as qa,t as ki}from"./chunk-LvLJmgfZ.js";import{f as Hr,i as Gr,l as Ci,n as Qr,o as Ei,u as Xr}from"./useEvent-D91BmmQi.js";import{t as Ti}from"./react-Bj1aDYRI.js";import{Cr as Ii,E as es,Er as ts,Ft as Si,Jr as Oi,Jt as as,Ln as Ai,Oi as rs,Pn as Ri,Si as Ni,Tr as ji,Yn as Mi,Zr as Pi,b as Qe,bi as $i,dr as Li,en as Di,f as Zi,i as Fi,ki as zi,mi as Ui,pr as qi,xt as Va}from"./cells-CcBfzJ1Z.js";import{B as fe,D as Vi,E as ss,H as Wi,I as ut,J as ns,L as Y,N as is,O as Bi,P as z,R as v,S as Ji,T as ue,V as ze,W as os,b as ua,k as O,w as Ue,x as ca}from"./zod-H_cgTO0M.js";import{t as Dt}from"./compiler-runtime-B3qBwwSJ.js";import{T as Ki,t as Yi}from"./ai-model-dropdown-BFTnsrTP.js";import{_ as se,p as Hi}from"./useEventListener-BR0C1MaI.js";import{n as Gi}from"./utils-DIGrmLDO.js";import{o as Qi}from"./config-DczIUz0b.js";import{t as Wa}from"./cn-DCUzRj2J.js";import{t as Xi}from"./jsx-runtime-BqBOg78p.js";import{d as eo}from"./popover-UExmgBsf.js";import{a as ls,c as to,p as ao,r as ro,t as so}from"./dropdown-menu-D1A3cFC8.js";import{t as pa}from"./tooltip-Gcwqb_SK.js";import{t as Xe}from"./button-D9nb17Rw.js";import{Ht as no,Jt as ma,St as ha,Vt as io,Wt as ds,Yt as fa,Zt as oo,at as us,ct as lo,lt as cs,rt as Ba,xt as uo}from"./dist-BrR4M-k3.js";import{t as co}from"./createReducer-1ePoj7v6.js";import{h as po,n as mo,o as ho,r as fo}from"./dist-HlsDto3K.js";import{i as ps}from"./strings-md4mFbOQ.js";import{r as go,t as yo}from"./requests-DIwGYs0l.js";import{t as Ja}from"./createLucideIcon-D5guW7EU.js";import{r as vo,t as bo}from"./fileToBase64-Bzn96tYq.js";import{t as ms}from"./x-C-6liIBr.js";import{f as _o,l as hs,n as xo}from"./markdown-renderer-DmnGXdCp.js";import{t as fs}from"./file-BrdxGLRX.js";import{t as wo}from"./image-DQHXdEQn.js";import{t as ko}from"./spinner-Bhir8k53.js";import{t as Co}from"./play-C7DcCsoO.js";import{r as Eo}from"./input-BX98vgAu.js";import{t as To}from"./sparkles-CZ5WmLPA.js";import{a as Zt,i as It,o as Ft,r as St,s as Io,t as So}from"./datasource-Czm_KBfK.js";import{a as Oo}from"./dist-DQOq2Tf-.js";import{t as Ka}from"./use-toast-T0_cQDma.js";import{r as Ao}from"./useTheme-Cb4Wekek.js";import{n as Ro}from"./useRunCells-CgXnbA14.js";import{r as No}from"./errors-TZBmrJmc.js";import{t as jo}from"./blob-D-eV0cU3.js";import{i as Ya}from"./cell-link-BRdZl0OJ.js";import{r as Mo,t as Po}from"./html-to-image-BHdf1t5J.js";import{n as Ha}from"./renderShortcut-DZpkrZaP.js";import{n as $o}from"./icons-D9TuFTJG.js";import{r as Lo,t as Do}from"./esm-BmrwxxCo.js";import{t as Zo}from"./process-output-hJso9ugZ.js";import{t as Fo}from"./useDeleteCell-BVX9aH-t.js";var gs=Ja("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),ys=Ja("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),vs=Ja("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),bs="vercel.ai.error",zo=Symbol.for(bs),_s,xs,je=class pi extends(xs=Error,_s=zo,xs){constructor({name:e,message:a,cause:r}){super(a),this[_s]=!0,this.name=e,this.cause=r}static isInstance(e){return pi.hasMarker(e,bs)}static hasMarker(e,a){let r=Symbol.for(a);return typeof e=="object"&&!!e&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function ws(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ks="AI_InvalidArgumentError",Cs=`vercel.ai.error.${ks}`,Uo=Symbol.for(Cs),Es,Ts,qo=class extends(Ts=je,Es=Uo,Ts){constructor({message:t,cause:e,argument:a}){super({name:ks,message:t,cause:e}),this[Es]=!0,this.argument=a}static isInstance(t){return je.hasMarker(t,Cs)}},Is="AI_JSONParseError",Ss=`vercel.ai.error.${Is}`,Vo=Symbol.for(Ss),Os,As,Rs=class extends(As=je,Os=Vo,As){constructor({text:t,cause:e}){super({name:Is,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${ws(e)}`,cause:e}),this[Os]=!0,this.text=t}static isInstance(t){return je.hasMarker(t,Ss)}},Ns="AI_TypeValidationError",js=`vercel.ai.error.${Ns}`,Wo=Symbol.for(js),Ms,Ps,Ot=class qr extends(Ps=je,Ms=Wo,Ps){constructor({value:e,cause:a,context:r}){let s="Type validation failed";if(r!=null&&r.field&&(s+=` for ${r.field}`),(r==null?void 0:r.entityName)||(r==null?void 0:r.entityId)){s+=" (";let n=[];r.entityName&&n.push(r.entityName),r.entityId&&n.push(`id: "${r.entityId}"`),s+=n.join(", "),s+=")"}super({name:Ns,message:`${s}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${ws(a)}`,cause:a}),this[Ms]=!0,this.value=e,this.context=r}static isInstance(e){return je.hasMarker(e,js)}static wrap({value:e,cause:a,context:r}){var s,n,o;return qr.isInstance(a)&&a.value===e&&((s=a.context)==null?void 0:s.field)===(r==null?void 0:r.field)&&((n=a.context)==null?void 0:n.entityName)===(r==null?void 0:r.entityName)&&((o=a.context)==null?void 0:o.entityId)===(r==null?void 0:r.entityId)?a:new qr({value:e,cause:a,context:r})}},q;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw Error()}t.assertNever=a,t.arrayToEnum=s=>{let n={};for(let o of s)n[o]=o;return n},t.getValidEnumValues=s=>{let n=t.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of n)o[i]=s[i];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(n){return s[n]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let n=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&n.push(o);return n},t.find=(s,n)=>{for(let o of s)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,n=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=r,t.jsonStringifyReplacer=(s,n)=>typeof n=="bigint"?n.toString():n})(q||(q={}));var Bo;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Bo||(Bo={}));const C=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),et=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}},y=q.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Me=class mi extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){let a=e||function(n){return n.message},r={_errors:[]},s=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(a(o));else{let i=r,l=0;for(;l<o.path.length;){let d=o.path[l];l===o.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(a(o))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};return s(this),r}static assert(e){if(!(e instanceof mi))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){let a=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let n=s.path[0];a[n]=a[n]||[],a[n].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}};Me.create=t=>new Me(t);var zt=(t,e)=>{let a;switch(t.code){case y.invalid_type:a=t.received===C.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,q.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:a=`Unrecognized key(s) in object: ${q.joinValues(t.keys,", ")}`;break;case y.invalid_union:a="Invalid input";break;case y.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${q.joinValues(t.options)}`;break;case y.invalid_enum_value:a=`Invalid enum value. Expected ${q.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:a="Invalid function arguments";break;case y.invalid_return_type:a="Invalid function return type";break;case y.invalid_date:a="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:q.assertNever(t.validation):a=t.validation==="regex"?"Invalid":`Invalid ${t.validation}`;break;case y.too_small:a=t.type==="array"?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"||t.type==="bigint"?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case y.too_big:a=t.type==="array"?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case y.custom:a="Invalid input";break;case y.invalid_intersection_types:a="Intersection results could not be merged";break;case y.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:a="Number must be finite";break;default:a=e.defaultError,q.assertNever(t)}return{message:a}},Jo=zt;function Ga(){return Jo}const Qa=t=>{let{data:e,path:a,errorMaps:r,issueData:s}=t,n=[...a,...s.path||[]],o={...s,path:n};if(s.message!==void 0)return{...s,path:n,message:s.message};let i="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)i=d(o,{data:e,defaultError:i}).message;return{...s,path:n,message:i}};function k(t,e){let a=Ga(),r=Qa({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===zt?void 0:zt].filter(s=>!!s)});t.common.issues.push(r)}var ye=class hi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){let r=[];for(let s of a){if(s.status==="aborted")return R;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,a){let r=[];for(let s of a){let n=await s.key,o=await s.value;r.push({key:n,value:o})}return hi.mergeObjectSync(e,r)}static mergeObjectSync(e,a){let r={};for(let s of a){let{key:n,value:o}=s;if(n.status==="aborted"||o.status==="aborted")return R;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(o.value!==void 0||s.alwaysSet)&&(r[n.value]=o.value)}return{status:e.value,value:r}}};const R=Object.freeze({status:"aborted"}),Xa=t=>({status:"dirty",value:t}),ge=t=>({status:"valid",value:t}),$s=t=>t.status==="aborted",Ls=t=>t.status==="dirty",At=t=>t.status==="valid",ga=t=>typeof Promise<"u"&&t instanceof Promise;var I;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(I||(I={}));var Pe=class{constructor(t,e,a,r){this._cachedPath=[],this.parent=t,this.data=e,this._path=a,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ds=(t,e)=>{if(At(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){return this._error||(this._error=new Me(t.common.issues)),this._error}}};function N(t){if(!t)return{};let{errorMap:e,invalid_type_error:a,required_error:r,description:s}=t;if(e&&(a||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(n,o)=>{let{message:i}=t;return n.code==="invalid_enum_value"?{message:i??o.defaultError}:o.data===void 0?{message:i??r??o.defaultError}:n.code==="invalid_type"?{message:i??a??o.defaultError}:{message:o.defaultError}},description:s}}var L=class{get description(){return this._def.description}_getType(t){return et(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ye,ctx:{common:t.parent.common,data:t.data,parsedType:et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(ga(e))throw Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let a=this.safeParse(t,e);if(a.success)return a.data;throw a.error}safeParse(t,e){let a={common:{issues:[],async:(e==null?void 0:e.async)??!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:et(t)};return Ds(a,this._parseSync({data:t,path:a.path,parent:a}))}"~validate"(t){var a,r;let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:et(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:e});return At(s)?{value:s.value}:{issues:e.common.issues}}catch(s){(r=(a=s==null?void 0:s.message)==null?void 0:a.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:e}).then(s=>At(s)?{value:s.value}:{issues:e.common.issues})}async parseAsync(t,e){let a=await this.safeParseAsync(t,e);if(a.success)return a.data;throw a.error}async safeParseAsync(t,e){let a={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:et(t)},r=this._parse({data:t,path:a.path,parent:a});return Ds(a,await(ga(r)?r:Promise.resolve(r)))}refine(t,e){let a=r=>typeof e=="string"||e===void 0?{message:e}:typeof e=="function"?e(r):e;return this._refinement((r,s)=>{let n=t(r),o=()=>s.addIssue({code:y.custom,...a(r)});return typeof Promise<"u"&&n instanceof Promise?n.then(i=>i?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(t,e){return this._refinement((a,r)=>t(a)?!0:(r.addIssue(typeof e=="function"?e(a,r):e),!1))}_refinement(t){return new qe({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Ve.create(this,this._def)}nullable(){return pt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return Ut.create(this,this._def)}or(t){return _a.create([this,t],this._def)}and(t){return xa.create(this,t,this._def)}transform(t){return new qe({...N(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new Ta({...N(this._def),innerType:this,defaultValue:e,typeName:b.ZodDefault})}brand(){return new qs({typeName:b.ZodBranded,type:this,...N(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new Ia({...N(this._def),innerType:this,catchValue:e,typeName:b.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return Vs.create(this,t)}readonly(){return Sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ko=/^c[^\s-]{8,}$/i,Yo=/^[0-9a-z]+$/,Ho=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Go=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Qo=/^[a-z0-9_-]{21}$/i,Xo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,el=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,al="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zs,rl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,nl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,il=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ol=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fs="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dl=RegExp(`^${Fs}$`);function zs(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision??(e=`${e}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function ul(t){return RegExp(`^${zs(t)}$`)}function cl(t){let e=`${Fs}T${zs(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,RegExp(`^${e}$`)}function pl(t,e){return!!((e==="v4"||!e)&&rl.test(t)||(e==="v6"||!e)&&nl.test(t))}function ml(t,e){if(!Xo.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||!s||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function hl(t,e){return!!((e==="v4"||!e)&&sl.test(t)||(e==="v6"||!e)&&il.test(t))}var ya=class aa extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.string,received:s.parsedType}),R}let a=new ye,r;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let n=e.data.length>s.value,o=e.data.length<s.value;(n||o)&&(r=this._getOrReturnCtx(e,r),n?k(r,{code:y.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&k(r,{code:y.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")tl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"email",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")Zs||(Zs=new RegExp(al,"u")),Zs.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"emoji",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")Go.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"uuid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")Qo.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"nanoid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")Ko.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")Yo.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid2",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")Ho.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"ulid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),k(r,{validation:"url",code:y.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"regex",code:y.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?cl(s).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?dl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?ul(s).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?el.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"duration",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?pl(e.data,s.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"ip",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?ml(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"jwt",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?hl(e.data,s.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cidr",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?ol.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?ll.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64url",code:y.invalid_string,message:s.message}),a.dirty()):q.assertNever(s);return{status:a.value,value:e.data}}_regex(e,a,r){return this.refinement(s=>e.test(s),{validation:a,code:y.invalid_string,...I.errToObj(r)})}_addCheck(e){return new aa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...I.errToObj(e)})}url(e){return this._addCheck({kind:"url",...I.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...I.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...I.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...I.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...I.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...I.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...I.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...I.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...I.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...I.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...I.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...I.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...I.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,...I.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...I.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...I.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...I.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...I.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...I.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...I.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...I.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...I.errToObj(a)})}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new aa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};ya.create=t=>new ya({checks:[],typeName:b.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});function fl(t,e){let a=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=a>r?a:r;return Number.parseInt(t.toFixed(s).replace(".",""))%Number.parseInt(e.toFixed(s).replace(".",""))/10**s}var er=class Vr extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.number,received:s.parsedType}),R}let a,r=new ye;for(let s of this._def.checks)s.kind==="int"?q.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:y.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?fl(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_finite,message:s.message}),r.dirty()):q.assertNever(s);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,I.toString(a))}gt(e,a){return this.setLimit("min",e,!1,I.toString(a))}lte(e,a){return this.setLimit("max",e,!0,I.toString(a))}lt(e,a){return this.setLimit("max",e,!1,I.toString(a))}setLimit(e,a,r,s){return new Vr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:I.toString(s)}]})}_addCheck(e){return new Vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:-(2**53-1),message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:2**53-1,message:I.toString(e)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&q.isInteger(e.value))}get isFinite(){let e=null,a=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(a===null||r.value>a)&&(a=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(a)&&Number.isFinite(e)}};er.create=t=>new er({checks:[],typeName:b.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});var tr=class Wr extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let a,r=new ye;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):q.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let a=this._getOrReturnCtx(e);return k(a,{code:y.invalid_type,expected:C.bigint,received:a.parsedType}),R}gte(e,a){return this.setLimit("min",e,!0,I.toString(a))}gt(e,a){return this.setLimit("min",e,!1,I.toString(a))}lte(e,a){return this.setLimit("max",e,!0,I.toString(a))}lt(e,a){return this.setLimit("max",e,!1,I.toString(a))}setLimit(e,a,r,s){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:I.toString(s)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(a)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};tr.create=t=>new tr({checks:[],typeName:b.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});var ar=class extends L{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==C.boolean){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.boolean,received:e.parsedType}),R}return ge(t.data)}};ar.create=t=>new ar({typeName:b.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});var rr=class fi extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.date,received:s.parsedType}),R}if(Number.isNaN(e.data.getTime()))return k(this._getOrReturnCtx(e),{code:y.invalid_date}),R;let a=new ye,r;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):q.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fi({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:I.toString(a)})}get minDate(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e==null?null:new Date(e)}};rr.create=t=>new rr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:b.ZodDate,...N(t)});var sr=class extends L{_parse(t){if(this._getType(t)!==C.symbol){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.symbol,received:e.parsedType}),R}return ge(t.data)}};sr.create=t=>new sr({typeName:b.ZodSymbol,...N(t)});var va=class extends L{_parse(t){if(this._getType(t)!==C.undefined){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.undefined,received:e.parsedType}),R}return ge(t.data)}};va.create=t=>new va({typeName:b.ZodUndefined,...N(t)});var ba=class extends L{_parse(t){if(this._getType(t)!==C.null){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.null,received:e.parsedType}),R}return ge(t.data)}};ba.create=t=>new ba({typeName:b.ZodNull,...N(t)});var nr=class extends L{constructor(){super(...arguments),this._any=!0}_parse(t){return ge(t.data)}};nr.create=t=>new nr({typeName:b.ZodAny,...N(t)});var Rt=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ge(t.data)}};Rt.create=t=>new Rt({typeName:b.ZodUnknown,...N(t)});var tt=class extends L{_parse(t){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.never,received:e.parsedType}),R}};tt.create=t=>new tt({typeName:b.ZodNever,...N(t)});var ir=class extends L{_parse(t){if(this._getType(t)!==C.undefined){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.void,received:e.parsedType}),R}return ge(t.data)}};ir.create=t=>new ir({typeName:b.ZodVoid,...N(t)});var Nt=class Da extends L{_parse(e){let{ctx:a,status:r}=this._processInputParams(e),s=this._def;if(a.parsedType!==C.array)return k(a,{code:y.invalid_type,expected:C.array,received:a.parsedType}),R;if(s.exactLength!==null){let o=a.data.length>s.exactLength.value,i=a.data.length<s.exactLength.value;(o||i)&&(k(a,{code:o?y.too_big:y.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&a.data.length<s.minLength.value&&(k(a,{code:y.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&a.data.length>s.maxLength.value&&(k(a,{code:y.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),a.common.async)return Promise.all([...a.data].map((o,i)=>s.type._parseAsync(new Pe(a,o,a.path,i)))).then(o=>ye.mergeArray(r,o));let n=[...a.data].map((o,i)=>s.type._parseSync(new Pe(a,o,a.path,i)));return ye.mergeArray(r,n)}get element(){return this._def.type}min(e,a){return new Da({...this._def,minLength:{value:e,message:I.toString(a)}})}max(e,a){return new Da({...this._def,maxLength:{value:e,message:I.toString(a)}})}length(e,a){return new Da({...this._def,exactLength:{value:e,message:I.toString(a)}})}nonempty(e){return this.min(1,e)}};Nt.create=(t,e)=>new Nt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...N(e)});function jt(t){if(t instanceof Ee){let e={};for(let a in t.shape){let r=t.shape[a];e[a]=Ve.create(jt(r))}return new Ee({...t._def,shape:()=>e})}else return t instanceof Nt?new Nt({...t._def,type:jt(t.element)}):t instanceof Ve?Ve.create(jt(t.unwrap())):t instanceof pt?pt.create(jt(t.unwrap())):t instanceof ct?ct.create(t.items.map(e=>jt(e))):t}var Ee=class Oe extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:q.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==C.object){let l=this._getOrReturnCtx(e);return k(l,{code:y.invalid_type,expected:C.object,received:l.parsedType}),R}let{status:a,ctx:r}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof tt&&this._def.unknownKeys==="strip"))for(let l in r.data)n.includes(l)||o.push(l);let i=[];for(let l of n){let d=s[l],u=r.data[l];i.push({key:{status:"valid",value:l},value:d._parse(new Pe(r,u,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof tt){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of o)i.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(l==="strict")o.length>0&&(k(r,{code:y.unrecognized_keys,keys:o}),a.dirty());else if(l!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of o){let u=r.data[d];i.push({key:{status:"valid",value:d},value:l._parse(new Pe(r,u,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of i){let u=await d.key,p=await d.value;l.push({key:u,value:p,alwaysSet:d.alwaysSet})}return l}).then(l=>ye.mergeObjectSync(a,l)):ye.mergeObjectSync(a,i)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new Oe({...this._def,unknownKeys:"strict",...e===void 0?{}:{errorMap:(a,r)=>{var n,o;let s=((o=(n=this._def).errorMap)==null?void 0:o.call(n,a,r).message)??r.defaultError;return a.code==="unrecognized_keys"?{message:I.errToObj(e).message??s}:{message:s}}}})}strip(){return new Oe({...this._def,unknownKeys:"strip"})}passthrough(){return new Oe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Oe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Oe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Oe({...this._def,catchall:e})}pick(e){let a={};for(let r of q.objectKeys(e))e[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new Oe({...this._def,shape:()=>a})}omit(e){let a={};for(let r of q.objectKeys(this.shape))e[r]||(a[r]=this.shape[r]);return new Oe({...this._def,shape:()=>a})}deepPartial(){return jt(this)}partial(e){let a={};for(let r of q.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?a[r]=s:a[r]=s.optional()}return new Oe({...this._def,shape:()=>a})}required(e){let a={};for(let r of q.objectKeys(this.shape))if(e&&!e[r])a[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ve;)s=s._def.innerType;a[r]=s}return new Oe({...this._def,shape:()=>a})}keyof(){return Us(q.objectKeys(this.shape))}};Ee.create=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strip",catchall:tt.create(),typeName:b.ZodObject,...N(e)}),Ee.strictCreate=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strict",catchall:tt.create(),typeName:b.ZodObject,...N(e)}),Ee.lazycreate=(t,e)=>new Ee({shape:t,unknownKeys:"strip",catchall:tt.create(),typeName:b.ZodObject,...N(e)});var _a=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a=this._def.options;function r(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return e.common.issues.push(...o.ctx.common.issues),o.result;let n=s.map(o=>new Me(o.ctx.common.issues));return k(e,{code:y.invalid_union,unionErrors:n}),R}if(e.common.async)return Promise.all(a.map(async s=>{let n={...e,common:{...e.common,issues:[]},parent:null};return{result:await s._parseAsync({data:e.data,path:e.path,parent:n}),ctx:n}})).then(r);{let s,n=[];for(let i of a){let l={...e,common:{...e.common,issues:[]},parent:null},d=i._parseSync({data:e.data,path:e.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:l}),l.common.issues.length&&n.push(l.common.issues)}if(s)return e.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map(i=>new Me(i));return k(e,{code:y.invalid_union,unionErrors:o}),R}}get options(){return this._def.options}};_a.create=(t,e)=>new _a({options:t,typeName:b.ZodUnion,...N(e)});var at=t=>t instanceof wa?at(t.schema):t instanceof qe?at(t.innerType()):t instanceof ka?[t.value]:t instanceof Ca?t.options:t instanceof Ea?q.objectValues(t.enum):t instanceof Ta?at(t._def.innerType):t instanceof va?[void 0]:t instanceof ba?[null]:t instanceof Ve?[void 0,...at(t.unwrap())]:t instanceof pt?[null,...at(t.unwrap())]:t instanceof qs||t instanceof Sa?at(t.unwrap()):t instanceof Ia?at(t._def.innerType):[],gl=class gi extends L{_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==C.object)return k(a,{code:y.invalid_type,expected:C.object,received:a.parsedType}),R;let r=this.discriminator,s=a.data[r],n=this.optionsMap.get(s);return n?a.common.async?n._parseAsync({data:a.data,path:a.path,parent:a}):n._parseSync({data:a.data,path:a.path,parent:a}):(k(a,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,r){let s=new Map;for(let n of a){let o=at(n.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,n)}}return new gi({typeName:b.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:s,...N(r)})}};function or(t,e){let a=et(t),r=et(e);if(t===e)return{valid:!0,data:t};if(a===C.object&&r===C.object){let s=q.objectKeys(e),n=q.objectKeys(t).filter(i=>s.indexOf(i)!==-1),o={...t,...e};for(let i of n){let l=or(t[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(a===C.array&&r===C.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],l=or(o,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return a===C.date&&r===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var xa=class extends L{_parse(t){let{status:e,ctx:a}=this._processInputParams(t),r=(s,n)=>{if($s(s)||$s(n))return R;let o=or(s.value,n.value);return o.valid?((Ls(s)||Ls(n))&&e.dirty(),{status:e.value,value:o.data}):(k(a,{code:y.invalid_intersection_types}),R)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,n])=>r(s,n)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};xa.create=(t,e,a)=>new xa({left:t,right:e,typeName:b.ZodIntersection,...N(a)});var ct=class yi extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return k(r,{code:y.invalid_type,expected:C.array,received:r.parsedType}),R;if(r.data.length<this._def.items.length)return k(r,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&r.data.length>this._def.items.length&&(k(r,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());let s=[...r.data].map((n,o)=>{let i=this._def.items[o]||this._def.rest;return i?i._parse(new Pe(r,n,r.path,o)):null}).filter(n=>!!n);return r.common.async?Promise.all(s).then(n=>ye.mergeArray(a,n)):ye.mergeArray(a,s)}get items(){return this._def.items}rest(e){return new yi({...this._def,rest:e})}};ct.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ct({items:t,typeName:b.ZodTuple,rest:null,...N(e)})};var yl=class Br extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return k(r,{code:y.invalid_type,expected:C.object,received:r.parsedType}),R;let s=[],n=this._def.keyType,o=this._def.valueType;for(let i in r.data)s.push({key:n._parse(new Pe(r,i,r.path,i)),value:o._parse(new Pe(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?ye.mergeObjectAsync(a,s):ye.mergeObjectSync(a,s)}get element(){return this._def.valueType}static create(e,a,r){return a instanceof L?new Br({keyType:e,valueType:a,typeName:b.ZodRecord,...N(r)}):new Br({keyType:ya.create(),valueType:e,typeName:b.ZodRecord,...N(a)})}},lr=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:a}=this._processInputParams(t);if(a.parsedType!==C.map)return k(a,{code:y.invalid_type,expected:C.map,received:a.parsedType}),R;let r=this._def.keyType,s=this._def.valueType,n=[...a.data.entries()].map(([o,i],l)=>({key:r._parse(new Pe(a,o,a.path,[l,"key"])),value:s._parse(new Pe(a,i,a.path,[l,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let i of n){let l=await i.key,d=await i.value;if(l.status==="aborted"||d.status==="aborted")return R;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),o.set(l.value,d.value)}return{status:e.value,value:o}})}else{let o=new Map;for(let i of n){let l=i.key,d=i.value;if(l.status==="aborted"||d.status==="aborted")return R;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),o.set(l.value,d.value)}return{status:e.value,value:o}}}};lr.create=(t,e,a)=>new lr({valueType:e,keyType:t,typeName:b.ZodMap,...N(a)});var dr=class Jr extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return k(r,{code:y.invalid_type,expected:C.set,received:r.parsedType}),R;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(k(r,{code:y.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),a.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(k(r,{code:y.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),a.dirty());let n=this._def.valueType;function o(l){let d=new Set;for(let u of l){if(u.status==="aborted")return R;u.status==="dirty"&&a.dirty(),d.add(u.value)}return{status:a.value,value:d}}let i=[...r.data.values()].map((l,d)=>n._parse(new Pe(r,l,r.path,d)));return r.common.async?Promise.all(i).then(l=>o(l)):o(i)}min(e,a){return new Jr({...this._def,minSize:{value:e,message:I.toString(a)}})}max(e,a){return new Jr({...this._def,maxSize:{value:e,message:I.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}};dr.create=(t,e)=>new dr({valueType:t,minSize:null,maxSize:null,typeName:b.ZodSet,...N(e)});var vl=class Za extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==C.function)return k(a,{code:y.invalid_type,expected:C.function,received:a.parsedType}),R;function r(i,l){return Qa({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Ga(),zt].filter(d=>!!d),issueData:{code:y.invalid_arguments,argumentsError:l}})}function s(i,l){return Qa({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Ga(),zt].filter(d=>!!d),issueData:{code:y.invalid_return_type,returnTypeError:l}})}let n={errorMap:a.common.contextualErrorMap},o=a.data;if(this._def.returns instanceof Ut){let i=this;return ge(async function(...l){let d=new Me([]),u=await i._def.args.parseAsync(l,n).catch(m=>{throw d.addIssue(r(l,m)),d}),p=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(p,n).catch(m=>{throw d.addIssue(s(p,m)),d})})}else{let i=this;return ge(function(...l){let d=i._def.args.safeParse(l,n);if(!d.success)throw new Me([r(l,d.error)]);let u=Reflect.apply(o,this,d.data),p=i._def.returns.safeParse(u,n);if(!p.success)throw new Me([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Za({...this._def,args:ct.create(e).rest(Rt.create())})}returns(e){return new Za({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,r){return new Za({args:e||ct.create([]).rest(Rt.create()),returns:a||Rt.create(),typeName:b.ZodFunction,...N(r)})}},wa=class extends L{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};wa.create=(t,e)=>new wa({getter:t,typeName:b.ZodLazy,...N(e)});var ka=class extends L{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return k(e,{received:e.data,code:y.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:t.data}}get value(){return this._def.value}};ka.create=(t,e)=>new ka({value:t,typeName:b.ZodLiteral,...N(e)});function Us(t,e){return new Ca({values:t,typeName:b.ZodEnum,...N(e)})}var Ca=class Kr extends L{_parse(e){if(typeof e.data!="string"){let a=this._getOrReturnCtx(e),r=this._def.values;return k(a,{expected:q.joinValues(r),received:a.parsedType,code:y.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let a=this._getOrReturnCtx(e),r=this._def.values;return k(a,{received:a.data,code:y.invalid_enum_value,options:r}),R}return ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let a of this._def.values)e[a]=a;return e}get Values(){let e={};for(let a of this._def.values)e[a]=a;return e}get Enum(){let e={};for(let a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Kr.create(e,{...this._def,...a})}exclude(e,a=this._def){return Kr.create(this.options.filter(r=>!e.includes(r)),{...this._def,...a})}};Ca.create=Us;var Ea=class extends L{_parse(t){let e=q.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==C.string&&a.parsedType!==C.number){let r=q.objectValues(e);return k(a,{expected:q.joinValues(r),received:a.parsedType,code:y.invalid_type}),R}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=q.objectValues(e);return k(a,{received:a.data,code:y.invalid_enum_value,options:r}),R}return ge(t.data)}get enum(){return this._def.values}};Ea.create=(t,e)=>new Ea({values:t,typeName:b.ZodNativeEnum,...N(e)});var Ut=class extends L{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);return e.parsedType!==C.promise&&e.common.async===!1?(k(e,{code:y.invalid_type,expected:C.promise,received:e.parsedType}),R):ge((e.parsedType===C.promise?e.data:Promise.resolve(e.data)).then(a=>this._def.type.parseAsync(a,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Ut.create=(t,e)=>new Ut({type:t,typeName:b.ZodPromise,...N(e)});var qe=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:a}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:n=>{k(a,n),n.fatal?e.abort():e.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let n=r.transform(a.data,s);if(a.common.async)return Promise.resolve(n).then(async o=>{if(e.value==="aborted")return R;let i=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return i.status==="aborted"?R:i.status==="dirty"||e.value==="dirty"?Xa(i.value):i});{if(e.value==="aborted")return R;let o=this._def.schema._parseSync({data:n,path:a.path,parent:a});return o.status==="aborted"?R:o.status==="dirty"||e.value==="dirty"?Xa(o.value):o}}if(r.type==="refinement"){let n=o=>{let i=r.refinement(o,s);if(a.common.async)return Promise.resolve(i);if(i instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?R:(o.status==="dirty"&&e.dirty(),n(o.value),{status:e.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?R:(o.status==="dirty"&&e.dirty(),n(o.value).then(()=>({status:e.value,value:o.value}))))}if(r.type==="transform")if(a.common.async===!1){let n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!At(n))return R;let o=r.transform(n.value,s);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(n=>At(n)?Promise.resolve(r.transform(n.value,s)).then(o=>({status:e.value,value:o})):R);q.assertNever(r)}};qe.create=(t,e,a)=>new qe({schema:t,typeName:b.ZodEffects,effect:e,...N(a)}),qe.createWithPreprocess=(t,e,a)=>new qe({schema:e,effect:{type:"preprocess",transform:t},typeName:b.ZodEffects,...N(a)});var Ve=class extends L{_parse(t){return this._getType(t)===C.undefined?ge(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ve.create=(t,e)=>new Ve({innerType:t,typeName:b.ZodOptional,...N(e)});var pt=class extends L{_parse(t){return this._getType(t)===C.null?ge(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};pt.create=(t,e)=>new pt({innerType:t,typeName:b.ZodNullable,...N(e)});var Ta=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a=e.data;return e.parsedType===C.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};Ta.create=(t,e)=>new Ta({innerType:t,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...N(e)});var Ia=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a={...e,common:{...e.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return ga(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Me(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Me(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Ia.create=(t,e)=>new Ia({innerType:t,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...N(e)});var ur=class extends L{_parse(t){if(this._getType(t)!==C.nan){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.nan,received:e.parsedType}),R}return{status:"valid",value:t.data}}};ur.create=t=>new ur({typeName:b.ZodNaN,...N(t)});var qs=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a=e.data;return this._def.type._parse({data:a,path:e.path,parent:e})}unwrap(){return this._def.type}},Vs=class vi extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?R:s.status==="dirty"?(a.dirty(),Xa(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?R:s.status==="dirty"?(a.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,a){return new vi({in:e,out:a,typeName:b.ZodPipeline})}},Sa=class extends L{_parse(t){let e=this._def.innerType._parse(t),a=r=>(At(r)&&(r.value=Object.freeze(r.value)),r);return ga(e)?e.then(r=>a(r)):a(e)}unwrap(){return this._def.innerType}};Sa.create=(t,e)=>new Sa({innerType:t,typeName:b.ZodReadonly,...N(e)}),Ee.lazycreate;var b;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(b||(b={})),ya.create,er.create,ur.create,tr.create,ar.create,rr.create,sr.create,va.create,ba.create,nr.create,Rt.create,tt.create,ir.create,Nt.create,Ee.create,Ee.strictCreate,_a.create,gl.create,xa.create,ct.create,yl.create,lr.create,dr.create,vl.create,wa.create,ka.create,Ca.create,Ea.create,Ut.create,qe.create,Ve.create,pt.create,qe.createWithPreprocess,Vs.create;var Ws=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}};function cr(t){}function bl(t){if(typeof t=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=cr,onError:a=cr,onRetry:r=cr,onComment:s}=t,n="",o=!0,i,l="",d="";function u(c){let g=o?c.replace(/^\xEF\xBB\xBF/,""):c,[h,x]=_l(`${n}${g}`);for(let w of h)p(w);n=x,o=!1}function p(c){if(c===""){f();return}if(c.startsWith(":")){s&&s(c.slice(c.startsWith(": ")?2:1));return}let g=c.indexOf(":");if(g!==-1){let h=c.slice(0,g),x=c[g+1]===" "?2:1;m(h,c.slice(g+x),c);return}m(c,"",c)}function m(c,g,h){switch(c){case"event":d=g;break;case"data":l=`${l}${g}
4
4
  `;break;case"id":i=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?r(parseInt(g,10)):a(new Ws(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:h}));break;default:a(new Ws(`Unknown field "${c.length>20?`${c.slice(0,20)}\u2026`:c}"`,{type:"unknown-field",field:c,value:g,line:h}));break}}function f(){l.length>0&&e({id:i,event:d||void 0,data:l.endsWith(`
@@ -17,15 +17,15 @@ ${n}
17
17
 
18
18
  `;return a.outputType==="text"&&a.processedContent?i+=`Output:
19
19
  ${a.processedContent}`:a.outputType==="media"&&(i+=`Media Output: Contains ${a.output.mimetype} content`,a.imageUrl&&(i+=`
20
- Image URL: ${a.imageUrl}`)),Zt({type:this.contextType,data:o,details:i})}async getAttachments(e){let a=e[0].data.cellId,r=e[0].data.cellName;return Pu(e.map(s=>s.data.cellOutput),a,r)}};async function Pu(t,e,a){let r=t.filter(n=>n.shouldDownloadImage&&n.outputType==="media");if(r.length===0)return[];let s=r.flatMap(n=>{let o=document.getElementById(Si.create(e));return o?{cellId:e,cellName:a,mimetype:n.output.mimetype,element:o}:(se.warn(`Output element not found for cell ${e}`),[])});try{return await Promise.all(s.map(async n=>({type:"file",filename:`${a}-output-screenshot`,mediaType:"image/png",url:await Po(n.element)})))}catch(n){return se.error("Error downloading cell output images:",n),[]}}function $n(t){if(hs(t))return null;let e=t.mimetype,a=ju(e,String(t.data))?"media":"text",r=Zo(t),s,n=!1;return a==="media"&&(typeof t.data=="string"&&t.data.startsWith("data:")||typeof t.data=="string"&&t.data.startsWith("http")?s=t.data:n=!0),{processedContent:r,imageUrl:s,shouldDownloadImage:n,outputType:a,output:t}}function Ln(t,e,a){let{includeConsoleOutput:r=!1}=a||{},s=e.cellRuntime[t],n=e.cellData[t],o=e.cellIds.inOrderIds.indexOf(t),i=Mi(n.name,o),l;r&&(l=s.consoleOutputs.map(p=>$n(p)).filter(p=>p!==null));let d,u=s.output;return u&&!hs(u)&&(d=$n(u)??void 0),{cellId:t,cellName:i,cellCode:n.code,cellOutput:d,consoleOutputs:l}}function $u(t){return t.type==="setup-refs"?"The setup cell cannot have references":t.type==="cycle"?"This cell is in a cycle":t.type==="multiple-defs"?`The variable '${t.name}' was defined by another cell`:t.type==="import-star"||t.type==="ancestor-stopped"||t.type==="ancestor-prevented"||t.type==="exception"||t.type==="strict-exception"?t.msg:t.type==="interruption"?"This cell was interrupted and needs to be re-run":t.type==="syntax"||t.type==="unknown"||t.type==="sql-error"?t.msg:t.type==="internal"?t.msg||"An internal error occurred":(ps(t),"Unknown error")}var Dn=new Ri("error","errors"),Lu=class extends Ft{constructor(e){super();$(this,"title","Errors");$(this,"mentionPrefix","@");$(this,"contextType","error");this.store=e}getItems(){let e=this.store.get(Fi);return e.length===0?[]:[{uri:this.asURI("all"),name:"Errors",type:this.contextType,data:{type:"all-errors",errors:e.map(a=>({cellId:a.cellId,cellName:a.cellName,errorData:a.output.data}))},description:"All errors in the notebook"}]}formatCompletion(e){return e.data.type==="all-errors"?{label:"@Errors",displayLabel:"Errors",detail:`${e.data.errors.length} ${Dn.pluralize(e.data.errors.length)}`,type:"error",apply:"@Errors",section:It.ERROR,info:()=>{let a=document.createElement("div");a.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let r=document.createElement("div");r.classList.add("flex","flex-col","gap-1");let s=document.createElement("div");s.classList.add("font-bold","text-base"),s.textContent="Errors",r.append(s);let n=document.createElement("div");return n.classList.add("text-sm","text-muted-foreground"),n.textContent=`${e.data.errors.length} ${Dn.pluralize(e.data.errors.length)}`,r.append(n),a.append(r),a}}:{label:"Error",displayLabel:"Error",section:It.ERROR}}formatContext(e){let{data:a}=e;return a.errors.map(r=>Zt({type:this.contextType,data:{name:r.cellName||`Cell ${r.cellId}`,description:r.errorData.map(s=>$u(s)).join(`
20
+ Image URL: ${a.imageUrl}`)),Zt({type:this.contextType,data:o,details:i})}async getAttachments(e){let a=e[0].data.cellId,r=e[0].data.cellName;return Pu(e.map(s=>s.data.cellOutput),a,r)}};async function Pu(t,e,a){let r=t.filter(n=>n.shouldDownloadImage&&n.outputType==="media");if(r.length===0)return[];let s=r.flatMap(n=>{let o=document.getElementById(zi.create(e));return o?{cellId:e,cellName:a,mimetype:n.output.mimetype,element:o}:(se.warn(`Output element not found for cell ${e}`),[])});try{return await Promise.all(s.map(async n=>({type:"file",filename:`${a}-output-screenshot`,mediaType:"image/png",url:await Po(n.element)})))}catch(n){return se.error("Error downloading cell output images:",n),[]}}function $n(t){if(hs(t))return null;let e=t.mimetype,a=ju(e,String(t.data))?"media":"text",r=Zo(t),s,n=!1;return a==="media"&&(typeof t.data=="string"&&t.data.startsWith("data:")||typeof t.data=="string"&&t.data.startsWith("http")?s=t.data:n=!0),{processedContent:r,imageUrl:s,shouldDownloadImage:n,outputType:a,output:t}}function Ln(t,e,a){let{includeConsoleOutput:r=!1}=a||{},s=e.cellRuntime[t],n=e.cellData[t],o=e.cellIds.inOrderIds.indexOf(t),i=Si(n.name,o),l;r&&(l=s.consoleOutputs.map(p=>$n(p)).filter(p=>p!==null));let d,u=s.output;return u&&!hs(u)&&(d=$n(u)??void 0),{cellId:t,cellName:i,cellCode:n.code,cellOutput:d,consoleOutputs:l}}function $u(t){return t.type==="setup-refs"?"The setup cell cannot have references":t.type==="cycle"?"This cell is in a cycle":t.type==="multiple-defs"?`The variable '${t.name}' was defined by another cell`:t.type==="import-star"||t.type==="ancestor-stopped"||t.type==="ancestor-prevented"||t.type==="exception"||t.type==="strict-exception"?t.msg:t.type==="interruption"?"This cell was interrupted and needs to be re-run":t.type==="syntax"||t.type==="unknown"||t.type==="sql-error"?t.msg:t.type==="internal"?t.msg||"An internal error occurred":(ps(t),"Unknown error")}var Dn=new Mi("error","errors"),Lu=class extends Ft{constructor(e){super();$(this,"title","Errors");$(this,"mentionPrefix","@");$(this,"contextType","error");this.store=e}getItems(){let e=this.store.get(Fi);return e.length===0?[]:[{uri:this.asURI("all"),name:"Errors",type:this.contextType,data:{type:"all-errors",errors:e.map(a=>({cellId:a.cellId,cellName:a.cellName,errorData:a.output.data}))},description:"All errors in the notebook"}]}formatCompletion(e){return e.data.type==="all-errors"?{label:"@Errors",displayLabel:"Errors",detail:`${e.data.errors.length} ${Dn.pluralize(e.data.errors.length)}`,type:"error",apply:"@Errors",section:It.ERROR,info:()=>{let a=document.createElement("div");a.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let r=document.createElement("div");r.classList.add("flex","flex-col","gap-1");let s=document.createElement("div");s.classList.add("font-bold","text-base"),s.textContent="Errors",r.append(s);let n=document.createElement("div");return n.classList.add("text-sm","text-muted-foreground"),n.textContent=`${e.data.errors.length} ${Dn.pluralize(e.data.errors.length)}`,r.append(n),a.append(r),a}}:{label:"Error",displayLabel:"Error",section:It.ERROR}}formatContext(e){let{data:a}=e;return a.errors.map(r=>Zt({type:this.contextType,data:{name:r.cellName||`Cell ${r.cellId}`,description:r.errorData.map(s=>$u(s)).join(`
21
21
  `)}})).join(`
22
22
 
23
- `)}};const Zn=Ni();var Du={maxDepth:3,maxResults:20,defaultResultsLimit:5,includeDirectories:!1},Zu=class extends Ft{constructor(e,a=Du){super();$(this,"title","Files");$(this,"mentionPrefix","#");$(this,"contextType","file");$(this,"searchFiles",async(e,a={})=>{let{maxDepth:r,maxResults:s,includeDirectories:n}={...this.config,...a};return(await this.apiRequests.sendSearchFiles({query:e,includeFiles:!0,includeDirectories:n,depth:r,limit:s})).files});this.apiRequests=e,this.config=a}createCompletionSource(){return async e=>{let a=e.matchBefore(/#[^\s#]*/);if(!a)return null;let r=a.text;if(!r.startsWith("#"))return null;let s=r.slice(1);if(s.length===0)return this.getDefaultCompletions(a);try{let n=(await this.searchFiles(s)||[]).map(o=>{let i={uri:this.asURI(o.path),name:o.name,type:this.contextType,description:o.isDirectory?"Directory":"File",data:{path:o.path,isDirectory:o.isDirectory}};return this.formatCompletion(i)});return{from:a.from,options:n}}catch(n){return se.error("Failed to search files:",n),null}}}async getDefaultCompletions(e){try{for(let a of["py","md","csv"])try{let r=await this.searchFiles(a,{maxDepth:1,maxResults:5});if(r&&r.length>0){let s=r.map(n=>{let o={uri:this.asURI(n.path),name:n.name,type:this.contextType,description:n.isDirectory?"Directory":"File",data:{path:n.path,isDirectory:n.isDirectory}};return this.formatCompletion(o)});return{from:e.from,options:s}}}catch(r){se.error("Failed to get default file completions:",r)}return{from:e.from,options:[]}}catch(a){return se.error("Failed to get default file completions:",a),null}}getItems(){return[]}formatCompletion(e){let{data:a,name:r}=e,s=a.isDirectory?"\u{1F4C1}":"\u{1F4C4}";return{...this.createBasicCompletion(e),type:"file",section:It.FILE,boost:a.isDirectory?St.MEDIUM:St.LOW,detail:a.path,displayLabel:`${s} ${r}`,apply:async(n,o,i,l)=>{var f;let d=(f=n.state.facet(Zn))==null?void 0:f.addAttachment;if(!d){se.warn("No addAttachment callback provided");return}let u=await this.apiRequests.sendFileDetails({path:a.path}).catch(_=>(Ka({title:"Failed to get file details",description:_.message}),null));if(!u)return;let p=u.mimeType||"text/plain",m;if(p.startsWith("text/")||p.includes("json")||p.includes("xml"))m=new Blob([u.contents||""],{type:p});else if(u.contents)try{m=jo(xo(u.contents,p))}catch{m=new Blob([u.contents],{type:p})}else m=new Blob([""],{type:p});d(new File([m],r,{type:p})),n.dispatch({changes:{from:i,to:l,insert:""}}),ho(n)},info:()=>{let n=document.createElement("div");n.classList.add("flex","flex-col","gap-1","p-2");let o=document.createElement("div");o.classList.add("font-bold"),o.textContent=r,n.append(o);let i=document.createElement("div");return i.classList.add("text-xs","text-muted-foreground"),i.textContent=a.path,n.append(i),n}}}formatContext(e){let{data:a,name:r}=e;return Zt({type:this.contextType,data:{name:r,path:a.path,isDirectory:a.isDirectory},details:a.isDirectory?"Directory containing files and subdirectories":"File"})}},Fu=class extends Ft{constructor(e){super();$(this,"title","Tables");$(this,"mentionPrefix","@");$(this,"contextType","data");this.tablesMap=e}getItems(){return[...this.tablesMap.entries()].map(([e,a])=>({uri:this.asURI(e),name:e,type:this.contextType,description:a.source==="memory"?"in-memory":a.source,data:a}))}formatContext(e){let{data:a}=e,{columns:r,source:s,num_rows:n,num_columns:o,name:i,variable_name:l}=a,d=[n==null?void 0:`${n} rows`,o==null?void 0:`${o} columns`].filter(Boolean).join(", "),u="";if(d&&(u+=`Shape: ${d}
23
+ `)}};const Zn=Pi();var Du={maxDepth:3,maxResults:20,defaultResultsLimit:5,includeDirectories:!1},Zu=class extends Ft{constructor(e,a=Du){super();$(this,"title","Files");$(this,"mentionPrefix","#");$(this,"contextType","file");$(this,"searchFiles",async(e,a={})=>{let{maxDepth:r,maxResults:s,includeDirectories:n}={...this.config,...a};return(await this.apiRequests.sendSearchFiles({query:e,includeFiles:!0,includeDirectories:n,depth:r,limit:s})).files});this.apiRequests=e,this.config=a}createCompletionSource(){return async e=>{let a=e.matchBefore(/#[^\s#]*/);if(!a)return null;let r=a.text;if(!r.startsWith("#"))return null;let s=r.slice(1);if(s.length===0)return this.getDefaultCompletions(a);try{let n=(await this.searchFiles(s)||[]).map(o=>{let i={uri:this.asURI(o.path),name:o.name,type:this.contextType,description:o.isDirectory?"Directory":"File",data:{path:o.path,isDirectory:o.isDirectory}};return this.formatCompletion(i)});return{from:a.from,options:n}}catch(n){return se.error("Failed to search files:",n),null}}}async getDefaultCompletions(e){try{for(let a of["py","md","csv"])try{let r=await this.searchFiles(a,{maxDepth:1,maxResults:5});if(r&&r.length>0){let s=r.map(n=>{let o={uri:this.asURI(n.path),name:n.name,type:this.contextType,description:n.isDirectory?"Directory":"File",data:{path:n.path,isDirectory:n.isDirectory}};return this.formatCompletion(o)});return{from:e.from,options:s}}}catch(r){se.error("Failed to get default file completions:",r)}return{from:e.from,options:[]}}catch(a){return se.error("Failed to get default file completions:",a),null}}getItems(){return[]}formatCompletion(e){let{data:a,name:r}=e,s=a.isDirectory?"\u{1F4C1}":"\u{1F4C4}";return{...this.createBasicCompletion(e),type:"file",section:It.FILE,boost:a.isDirectory?St.MEDIUM:St.LOW,detail:a.path,displayLabel:`${s} ${r}`,apply:async(n,o,i,l)=>{var f;let d=(f=n.state.facet(Zn))==null?void 0:f.addAttachment;if(!d){se.warn("No addAttachment callback provided");return}let u=await this.apiRequests.sendFileDetails({path:a.path}).catch(_=>(Ka({title:"Failed to get file details",description:_.message}),null));if(!u)return;let p=u.mimeType||"text/plain",m;if(p.startsWith("text/")||p.includes("json")||p.includes("xml"))m=new Blob([u.contents||""],{type:p});else if(u.contents)try{m=jo(xo(u.contents,p))}catch{m=new Blob([u.contents],{type:p})}else m=new Blob([""],{type:p});d(new File([m],r,{type:p})),n.dispatch({changes:{from:i,to:l,insert:""}}),ho(n)},info:()=>{let n=document.createElement("div");n.classList.add("flex","flex-col","gap-1","p-2");let o=document.createElement("div");o.classList.add("font-bold"),o.textContent=r,n.append(o);let i=document.createElement("div");return i.classList.add("text-xs","text-muted-foreground"),i.textContent=a.path,n.append(i),n}}}formatContext(e){let{data:a,name:r}=e;return Zt({type:this.contextType,data:{name:r,path:a.path,isDirectory:a.isDirectory},details:a.isDirectory?"Directory containing files and subdirectories":"File"})}},Fu=class extends Ft{constructor(e){super();$(this,"title","Tables");$(this,"mentionPrefix","@");$(this,"contextType","data");this.tablesMap=e}getItems(){return[...this.tablesMap.entries()].map(([e,a])=>({uri:this.asURI(e),name:e,type:this.contextType,description:a.source==="memory"?"in-memory":a.source,data:a}))}formatContext(e){let{data:a}=e,{columns:r,source:s,num_rows:n,num_columns:o,name:i,variable_name:l}=a,d=[n==null?void 0:`${n} rows`,o==null?void 0:`${o} columns`].filter(Boolean).join(", "),u="";if(d&&(u+=`Shape: ${d}
24
24
  `),l&&(u+=`Variable: ${l}
25
25
  `),r&&r.length>0){u+=`Columns:
26
26
  `;for(let p of r){let m=` ${p.name} (${p.type})`;if(p.sample_values&&p.sample_values.length>0){let f=p.sample_values.slice(0,3).map(_=>_===null?"null":String(_)).join(", ");m+=` - samples: [${f}]`}u+=`${m}
27
- `}}return Zt({type:this.contextType,data:{name:i,source:s??"unknown"},details:u.trim()})}formatCompletion(e){let a=e.data.name,r=e.data;return{label:`@${a}`,displayLabel:a,detail:r.source==="memory"?"in-memory":r.source,boost:r.source_type==="local"?St.LOCAL_TABLE:St.REMOTE_TABLE,type:as(r),apply:`@${a}`,section:{name:as(r)==="dataframe"?"Dataframe":"Table",rank:It.TABLE.rank},info:()=>this.createTableInfoElement(a,r)}}createTableInfoElement(e,a){let r=document.createElement("div");r.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let s=document.createElement("div");s.classList.add("flex","flex-col","gap-1");let n=document.createElement("div");if(n.classList.add("font-bold","text-base"),n.textContent=e,s.append(n),a.source){let i=document.createElement("div");i.classList.add("text-xs","text-muted-foreground"),i.textContent=`Source: ${a.source}`,s.append(i)}r.append(s);let o=[a.num_rows==null?void 0:`${a.num_rows} rows`,a.num_columns==null?void 0:`${a.num_columns} columns`].filter(Boolean).join(", ");if(o){let i=document.createElement("div");i.classList.add("text-xs","bg-muted","px-2","py-1","rounded"),i.textContent=o,r.append(i)}if(a.columns&&a.columns.length>0){let i=document.createElement("div");i.classList.add("overflow-auto","max-h-60");let l=document.createElement("table");l.classList.add("w-full","text-xs","border-collapse");let d=l.insertRow();d.classList.add("bg-muted");let u=d.insertCell();u.classList.add("p-2","font-medium","text-left"),u.textContent="Column";let p=d.insertCell();p.classList.add("p-2","font-medium","text-left"),p.textContent="Type";let m=a.columns.some(_=>this.getItemMetadata(a,_)!==void 0),f;m&&(f=d.insertCell(),f.classList.add("p-2","font-medium","text-left"),f.textContent="Metadata"),a.columns.forEach((_,c)=>{let g=l.insertRow();g.classList.add(c%2==0?"bg-background":"bg-muted/30");let h=g.insertCell();h.classList.add("p-2","font-mono"),h.textContent=_.name;let x=g.insertCell();if(x.classList.add("p-2","text-muted-foreground"),x.textContent=_.type,m){let w=g.insertCell();w.classList.add("p-2");let T=this.getItemMetadata(a,_);T&&w.append(T)}}),i.append(l),r.append(i)}return r}getItemMetadata(e,a){var n,o;let r=(n=e.primary_keys)==null?void 0:n.includes(a.name),s=(o=e.indexes)==null?void 0:o.includes(a.name);if(r||s){let i=document.createElement("span");i.textContent=r?"PK":"IDX";let l=r?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200";return i.classList.add("text-xs","px-1.5","py-0.5","rounded-full","font-medium",...l.split(" ")),i}}},zu=class extends Ft{constructor(e,a){super();$(this,"title","Variables");$(this,"mentionPrefix","@");$(this,"contextType","variable");this.variables=e,this.tablesMap=a}getItems(){let e=new Set(this.tablesMap.keys());return Object.entries(this.variables).flatMap(([a,r])=>e.has(a)?[]:[{uri:this.asURI(a),name:a,type:this.contextType,description:r.dataType??"",dataType:r.dataType,data:{variable:r}}])}formatCompletion(e){let{data:a}=e,{variable:r}=a;return{label:`@${r.name}`,displayLabel:r.name,detail:r.dataType??"",type:this.contextType,section:It.VARIABLE,info:()=>Ii(r)}}formatContext(e){let{data:a}=e,{variable:r}=a;return Zt({type:this.contextType,data:{name:r.name,dataType:r.dataType},details:r.value==null?void 0:JSON.stringify(r.value)})}};function yt(t){let e=t.get(Ui),a=t.get(Pi),r=t.get(Ai);return new Io().register(new Fu(a)).register(new zu(r,a)).register(new Lu(t)).register(new Mu(t)).register(new So(e.connectionsMap,a))}function Uu(){return new Zu(yo())}const qu="@";function Vu({input:t}){let e="";return t.includes("@")&&(e=Bu(t),se.debug("Included context",e)),{includeOtherCode:rs(""),context:{plainText:e,schema:[],variables:[]}}}async function Wu({input:t}){let e="",a=[];if(t.includes("@")){let r=yt(Gr),s=r.parseAllContextIds(t);e=r.formatContextForAI(s);try{a=await r.getAttachmentsForContext(s),se.debug("Included attachments",a.length)}catch(n){se.error("Error getting attachments:",n)}}return{body:{includeOtherCode:rs(""),context:{plainText:e,schema:[],variables:[]}},attachments:a}}function Bu(t){let e=yt(Gr),a=e.parseAllContextIds(t);return e.formatContextForAI(a)}function Ju(t,e=[]){return a=>{let r=t.map(s=>a.matchBefore(s)).find(Boolean);return!r||r&&r.from===r.to&&!a.explicit?null:{from:r==null?void 0:r.from,options:[...e]}}}function Fn(t){var e;if((e=t.current)!=null&&e.view){let a=t.current.view.state.selection.main.from;t.current.view.dispatch({changes:{from:a,to:a,insert:"@"},selection:{anchor:a+1,head:a+1}}),t.current.view.focus(),po(t.current.view)}}function Ku(t){if(t.trim().length===0)return[];if(!t.includes("```"))return[{language:"python",code:t}];let e=[],a=0,r=t.indexOf("```",a);for(;r!==-1;){let s=t.indexOf(`
28
- `,r);if(s===-1){let d=t.slice(r+3),u=d.indexOf(" "),p=u===-1?d:d.slice(0,u),m=p==="markdown"?"markdown":p==="sql"?"sql":"python",f=u===-1?"":d.slice(u+1);f.trim()&&e.push({language:m,code:f.trim()});break}let n=t.slice(r+3,s).trim()||"";n=n==="markdown"?"markdown":n==="sql"?"sql":"python";let o=s+1,i=t.indexOf("```",o);if(i===-1){let d=t.slice(o).replace(/\n+$/,"");d.trim()&&e.push({language:n,code:d});break}let l=t.slice(o,i).replace(/\n+$/,"");l.trim()&&e.push({language:n,code:l}),a=i+3,r=t.indexOf("```",a)}return e.length===0&&e.push({language:"python",code:t}),e}var Yu=Dt(),zn=()=>new Map,{valueAtom:Qt,useActions:Un,createActions:zp,reducer:Up}=co(zn,{addStagedCell:(t,e)=>{let{cellId:a,edit:r}=e;return new Map([...t,[a,r]])},removeStagedCell:(t,e)=>{let a=new Map(t);return a.delete(e),a},clearStagedCells:()=>zn()});function qn(t){let e=(0,Yu.c)(27),{addStagedCell:a,removeStagedCell:r,clearStagedCells:s}=Un(),{createNewCell:n,updateCellCode:o}=es(),i=Fo(),l=(0,A.useRef)(null),d;e[0]!==a||e[1]!==n?(d=T=>{let S=ts.create();return a({cellId:S,edit:{type:"add_cell"}}),n({cellId:"__end__",code:T,before:!1,newCellId:S}),S},e[0]=a,e[1]=n,e[2]=d):d=e[2];let u=d,p;e[3]!==t||e[4]!==o?(p=T=>{let{cellId:S,code:P}=T;if(!t.get(Qt).has(S)){se.error("Staged cell not found",{cellId:S});return}let Z=Di(S);Z?Va(Z,P):o({cellId:S,code:P,formattingChange:!1})},e[3]=t,e[4]=o,e[5]=p):p=e[5];let m=p,f;e[6]!==i||e[7]!==r?(f=T=>{r(T),i({cellId:T})},e[6]=i,e[7]=r,e[8]=f):f=e[8];let _=f,c;e[9]!==s||e[10]!==i||e[11]!==t?(c=()=>{let T=t.get(Qt);for(let S of T.keys())i({cellId:S});s()},e[9]=s,e[10]=i,e[11]=t,e[12]=c):c=e[12];let g=c,h;e[13]!==a||e[14]!==n||e[15]!==u||e[16]!==m?(h=T=>{e:switch(T.type){case"text-start":l.current=new Hu(u,m,a,n);break e;case"text-delta":if(!l.current){se.error("Cell creation stream not found");return}l.current.stream(T);break e;case"text-end":case"finish":if(!l.current){se.error("Cell creation stream not found");return}l.current.stop();break e;case"abort":case"error":case"tool-input-error":case"tool-output-error":se.error("Error",T.type,{chunk:T});break e;case"tool-approval-request":se.log("Tool approval request",{chunk:T});break e;case"tool-output-denied":se.error("Tool output denied",{chunk:T});break e;case"start":case"start-step":case"finish-step":case"data-reasoning-signature":break e;case"message-metadata":case"tool-input-available":case"tool-output-available":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"file":case"source-document":case"source-url":case"tool-input-start":case"tool-input-delta":se.debug(T.type,{chunk:T});break e;default:if(Gu(T)){se.debug("Data chunk",{chunk:T});break e}ps(T)}},e[13]=a,e[14]=n,e[15]=u,e[16]=m,e[17]=h):h=e[17];let x=h,w;return e[18]!==a||e[19]!==s||e[20]!==u||e[21]!==g||e[22]!==_||e[23]!==x||e[24]!==r||e[25]!==m?(w={createStagedCell:u,updateStagedCell:m,addStagedCell:a,removeStagedCell:r,clearStagedCells:s,deleteStagedCell:_,deleteAllStagedCells:g,onStream:x},e[18]=a,e[19]=s,e[20]=u,e[21]=g,e[22]=_,e[23]=x,e[24]=r,e[25]=m,e[26]=w):w=e[26],w}var Hu=class{constructor(t,e,a,r){$(this,"createdCells",[]);$(this,"buffer","");$(this,"hasMarimoImport",!1);this.onCreateCell=t,this.onUpdateCell=e,this.addStagedCell=a,this.createNewCell=r}stream(t){let e=t.delta;this.buffer+=e;let a=Ku(this.buffer);for(let[r,s]of a.entries())if(r<this.createdCells.length){this.addMarimoImport(s.language);let n=this.createdCells[r];this.createdCells[r]={...n,cell:s},this.onUpdateCell({cellId:n.cellId,code:s.code,language:s.language})}else{let n=this.onCreateCell(s.code);this.createdCells.push({cellId:n,cell:s})}}addMarimoImport(t){var a;if(this.hasMarimoImport||t==="python")return;let e=Mo({autoInstantiate:!1,createNewCell:this.createNewCell,fromCellId:(a=this.createdCells[0])==null?void 0:a.cellId,before:!0});e&&this.addStagedCell({cellId:e,edit:{type:"add_cell"}}),this.hasMarimoImport=!0}stop(){this.buffer=""}};function Gu(t){return t.type.startsWith("data-")}var Qu={baseDescription:"Perform editing operations on the current notebook. You should prefer to create new cells unless you need to edit existing cells. Call this tool multiple times to perform multiple edits. Separate code into logical individual cells to take advantage of the notebook's reactive execution model.",prerequisites:["If you are updating existing cells, you need the cellIds. If they are not known, call the lightweight_cell_map_tool to find out."],additionalInfo:`
27
+ `}}return Zt({type:this.contextType,data:{name:i,source:s??"unknown"},details:u.trim()})}formatCompletion(e){let a=e.data.name,r=e.data;return{label:`@${a}`,displayLabel:a,detail:r.source==="memory"?"in-memory":r.source,boost:r.source_type==="local"?St.LOCAL_TABLE:St.REMOTE_TABLE,type:ts(r),apply:`@${a}`,section:{name:ts(r)==="dataframe"?"Dataframe":"Table",rank:It.TABLE.rank},info:()=>this.createTableInfoElement(a,r)}}createTableInfoElement(e,a){let r=document.createElement("div");r.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let s=document.createElement("div");s.classList.add("flex","flex-col","gap-1");let n=document.createElement("div");if(n.classList.add("font-bold","text-base"),n.textContent=e,s.append(n),a.source){let i=document.createElement("div");i.classList.add("text-xs","text-muted-foreground"),i.textContent=`Source: ${a.source}`,s.append(i)}r.append(s);let o=[a.num_rows==null?void 0:`${a.num_rows} rows`,a.num_columns==null?void 0:`${a.num_columns} columns`].filter(Boolean).join(", ");if(o){let i=document.createElement("div");i.classList.add("text-xs","bg-muted","px-2","py-1","rounded"),i.textContent=o,r.append(i)}if(a.columns&&a.columns.length>0){let i=document.createElement("div");i.classList.add("overflow-auto","max-h-60");let l=document.createElement("table");l.classList.add("w-full","text-xs","border-collapse");let d=l.insertRow();d.classList.add("bg-muted");let u=d.insertCell();u.classList.add("p-2","font-medium","text-left"),u.textContent="Column";let p=d.insertCell();p.classList.add("p-2","font-medium","text-left"),p.textContent="Type";let m=a.columns.some(_=>this.getItemMetadata(a,_)!==void 0),f;m&&(f=d.insertCell(),f.classList.add("p-2","font-medium","text-left"),f.textContent="Metadata"),a.columns.forEach((_,c)=>{let g=l.insertRow();g.classList.add(c%2==0?"bg-background":"bg-muted/30");let h=g.insertCell();h.classList.add("p-2","font-mono"),h.textContent=_.name;let x=g.insertCell();if(x.classList.add("p-2","text-muted-foreground"),x.textContent=_.type,m){let w=g.insertCell();w.classList.add("p-2");let T=this.getItemMetadata(a,_);T&&w.append(T)}}),i.append(l),r.append(i)}return r}getItemMetadata(e,a){var n,o;let r=(n=e.primary_keys)==null?void 0:n.includes(a.name),s=(o=e.indexes)==null?void 0:o.includes(a.name);if(r||s){let i=document.createElement("span");i.textContent=r?"PK":"IDX";let l=r?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200";return i.classList.add("text-xs","px-1.5","py-0.5","rounded-full","font-medium",...l.split(" ")),i}}},zu=class extends Ft{constructor(e,a){super();$(this,"title","Variables");$(this,"mentionPrefix","@");$(this,"contextType","variable");this.variables=e,this.tablesMap=a}getItems(){let e=new Set(this.tablesMap.keys());return Object.entries(this.variables).flatMap(([a,r])=>e.has(a)?[]:[{uri:this.asURI(a),name:a,type:this.contextType,description:r.dataType??"",dataType:r.dataType,data:{variable:r}}])}formatCompletion(e){let{data:a}=e,{variable:r}=a;return{label:`@${r.name}`,displayLabel:r.name,detail:r.dataType??"",type:this.contextType,section:It.VARIABLE,info:()=>Di(r)}}formatContext(e){let{data:a}=e,{variable:r}=a;return Zt({type:this.contextType,data:{name:r.name,dataType:r.dataType},details:r.value==null?void 0:JSON.stringify(r.value)})}};function yt(t){let e=t.get(ji),a=t.get(Ii),r=t.get(Ai);return new Io().register(new Fu(a)).register(new zu(r,a)).register(new Lu(t)).register(new Mu(t)).register(new So(e.connectionsMap,a))}function Uu(){return new Zu(yo())}const qu="@";function Vu({input:t}){let e="";return t.includes("@")&&(e=Bu(t),se.debug("Included context",e)),{includeOtherCode:as(""),context:{plainText:e,schema:[],variables:[]}}}async function Wu({input:t}){let e="",a=[];if(t.includes("@")){let r=yt(Gr),s=r.parseAllContextIds(t);e=r.formatContextForAI(s);try{a=await r.getAttachmentsForContext(s),se.debug("Included attachments",a.length)}catch(n){se.error("Error getting attachments:",n)}}return{body:{includeOtherCode:as(""),context:{plainText:e,schema:[],variables:[]}},attachments:a}}function Bu(t){let e=yt(Gr),a=e.parseAllContextIds(t);return e.formatContextForAI(a)}function Ju(t,e=[]){return a=>{let r=t.map(s=>a.matchBefore(s)).find(Boolean);return!r||r&&r.from===r.to&&!a.explicit?null:{from:r==null?void 0:r.from,options:[...e]}}}function Fn(t){var e;if((e=t.current)!=null&&e.view){let a=t.current.view.state.selection.main.from;t.current.view.dispatch({changes:{from:a,to:a,insert:"@"},selection:{anchor:a+1,head:a+1}}),t.current.view.focus(),po(t.current.view)}}function Ku(t){if(t.trim().length===0)return[];if(!t.includes("```"))return[{language:"python",code:t}];let e=[],a=0,r=t.indexOf("```",a);for(;r!==-1;){let s=t.indexOf(`
28
+ `,r);if(s===-1){let d=t.slice(r+3),u=d.indexOf(" "),p=u===-1?d:d.slice(0,u),m=p==="markdown"?"markdown":p==="sql"?"sql":"python",f=u===-1?"":d.slice(u+1);f.trim()&&e.push({language:m,code:f.trim()});break}let n=t.slice(r+3,s).trim()||"";n=n==="markdown"?"markdown":n==="sql"?"sql":"python";let o=s+1,i=t.indexOf("```",o);if(i===-1){let d=t.slice(o).replace(/\n+$/,"");d.trim()&&e.push({language:n,code:d});break}let l=t.slice(o,i).replace(/\n+$/,"");l.trim()&&e.push({language:n,code:l}),a=i+3,r=t.indexOf("```",a)}return e.length===0&&e.push({language:"python",code:t}),e}var Yu=Dt(),zn=()=>new Map,{valueAtom:Qt,useActions:Un,createActions:zp,reducer:Up}=co(zn,{addStagedCell:(t,e)=>{let{cellId:a,edit:r}=e;return new Map([...t,[a,r]])},removeStagedCell:(t,e)=>{let a=new Map(t);return a.delete(e),a},clearStagedCells:()=>zn()});function qn(t){let e=(0,Yu.c)(27),{addStagedCell:a,removeStagedCell:r,clearStagedCells:s}=Un(),{createNewCell:n,updateCellCode:o}=es(),i=Fo(),l=(0,A.useRef)(null),d;e[0]!==a||e[1]!==n?(d=T=>{let S=rs.create();return a({cellId:S,edit:{type:"add_cell"}}),n({cellId:"__end__",code:T,before:!1,newCellId:S}),S},e[0]=a,e[1]=n,e[2]=d):d=e[2];let u=d,p;e[3]!==t||e[4]!==o?(p=T=>{let{cellId:S,code:P}=T;if(!t.get(Qt).has(S)){se.error("Staged cell not found",{cellId:S});return}let Z=Zi(S);Z?Va(Z,P):o({cellId:S,code:P,formattingChange:!1})},e[3]=t,e[4]=o,e[5]=p):p=e[5];let m=p,f;e[6]!==i||e[7]!==r?(f=T=>{r(T),i({cellId:T})},e[6]=i,e[7]=r,e[8]=f):f=e[8];let _=f,c;e[9]!==s||e[10]!==i||e[11]!==t?(c=()=>{let T=t.get(Qt);for(let S of T.keys())i({cellId:S});s()},e[9]=s,e[10]=i,e[11]=t,e[12]=c):c=e[12];let g=c,h;e[13]!==a||e[14]!==n||e[15]!==u||e[16]!==m?(h=T=>{e:switch(T.type){case"text-start":l.current=new Hu(u,m,a,n);break e;case"text-delta":if(!l.current){se.error("Cell creation stream not found");return}l.current.stream(T);break e;case"text-end":case"finish":if(!l.current){se.error("Cell creation stream not found");return}l.current.stop();break e;case"abort":case"error":case"tool-input-error":case"tool-output-error":se.error("Error",T.type,{chunk:T});break e;case"tool-approval-request":se.log("Tool approval request",{chunk:T});break e;case"tool-output-denied":se.error("Tool output denied",{chunk:T});break e;case"start":case"start-step":case"finish-step":case"data-reasoning-signature":break e;case"message-metadata":case"tool-input-available":case"tool-output-available":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"file":case"source-document":case"source-url":case"tool-input-start":case"tool-input-delta":se.debug(T.type,{chunk:T});break e;default:if(Gu(T)){se.debug("Data chunk",{chunk:T});break e}ps(T)}},e[13]=a,e[14]=n,e[15]=u,e[16]=m,e[17]=h):h=e[17];let x=h,w;return e[18]!==a||e[19]!==s||e[20]!==u||e[21]!==g||e[22]!==_||e[23]!==x||e[24]!==r||e[25]!==m?(w={createStagedCell:u,updateStagedCell:m,addStagedCell:a,removeStagedCell:r,clearStagedCells:s,deleteStagedCell:_,deleteAllStagedCells:g,onStream:x},e[18]=a,e[19]=s,e[20]=u,e[21]=g,e[22]=_,e[23]=x,e[24]=r,e[25]=m,e[26]=w):w=e[26],w}var Hu=class{constructor(t,e,a,r){$(this,"createdCells",[]);$(this,"buffer","");$(this,"hasMarimoImport",!1);this.onCreateCell=t,this.onUpdateCell=e,this.addStagedCell=a,this.createNewCell=r}stream(t){let e=t.delta;this.buffer+=e;let a=Ku(this.buffer);for(let[r,s]of a.entries())if(r<this.createdCells.length){this.addMarimoImport(s.language);let n=this.createdCells[r];this.createdCells[r]={...n,cell:s},this.onUpdateCell({cellId:n.cellId,code:s.code,language:s.language})}else{let n=this.onCreateCell(s.code);this.createdCells.push({cellId:n,cell:s})}}addMarimoImport(t){var a;if(this.hasMarimoImport||t==="python")return;let e=Mo({autoInstantiate:!1,createNewCell:this.createNewCell,fromCellId:(a=this.createdCells[0])==null?void 0:a.cellId,before:!0});e&&this.addStagedCell({cellId:e,edit:{type:"add_cell"}}),this.hasMarimoImport=!0}stop(){this.buffer=""}};function Gu(t){return t.type.startsWith("data-")}var Qu={baseDescription:"Perform editing operations on the current notebook. You should prefer to create new cells unless you need to edit existing cells. Call this tool multiple times to perform multiple edits. Separate code into logical individual cells to take advantage of the notebook's reactive execution model.",prerequisites:["If you are updating existing cells, you need the cellIds. If they are not known, call the lightweight_cell_map_tool to find out."],additionalInfo:`
29
29
  Args:
30
30
  edit (object): The editing operation to perform with the following structure:
31
31
  - type: One of "update_cell", "add_cell", or "delete_cell"
@@ -49,7 +49,7 @@ Image URL: ${a.imageUrl}`)),Zt({type:this.contextType,data:o,details:i})}async g
49
49
  - SQL cells: use mo.sql(f"""{content}""") function to insert content. If a database engine is specified, use mo.sql(f"""{content}""", engine=engine) instead.
50
50
 
51
51
  Returns:
52
- - A result object containing standard tool metadata.`},Xu=z({edit:z({type:ua(["update_cell","add_cell","delete_cell"]),code:v().optional(),position:z({type:ua(["relative","column_end","notebook_end"]).optional(),cellId:v().optional(),columnIndex:is().optional(),before:ue().optional()})})}),ec=class{constructor(){$(this,"name","edit_notebook_tool");$(this,"description",Qu);$(this,"schema",Xu);$(this,"outputSchema",Pn);$(this,"mode",["agent"]);$(this,"handler",async({edit:t},e)=>{let{addStagedCell:a,createNewCell:r,store:s}=e;switch(t.type){case"update_cell":{let{position:n,code:o}=t,i=n.cellId;if(i){if(!o)throw new we("Code is required for update_cell","CODE_REQUIRED_FOR_UPDATE_CELL",!0,"Provide the new code to update the cell")}else throw new we("Cell ID is required for update_cell","CELL_ID_REQUIRED_FOR_UPDATE_CELL",!0,"Provide a cell ID to update");let l=s.get(Qe);this.validateCellIdExists(i,l);let d=this.getCellEditorView(i,l);Ya(i);let u=s.get(Qt).get(i);if((u==null?void 0:u.type)==="add_cell"){Va(d,o);break}let p=d.state.doc.toString(),m=(u==null?void 0:u.previousCode)??p;if(o===m)break;a({cellId:i,edit:{type:"update_cell",previousCode:m}}),Va(d,o);break}case"add_cell":{let{position:n,code:o}=t,i="__end__",l=!1,d=ts.create(),u=s.get(Qe);switch(n.type){case"relative":{let p=n.cellId;if(!p)throw new we("Cell ID is required for add_cell with relative position","TOOL_ERROR",!0,"Provide a cell ID to add the cell before");if(n.before===void 0)throw new we("Before is required for add_cell with relative position","TOOL_ERROR",!0,`Provide a boolean value for before, true to add before cell ${p}, false to add after the cell`);this.validateCellIdExists(p,u),i=p,l=n.before;break}case"column_end":if(!n.columnIndex)throw new we("Column index is required for add_cell with column_end position","TOOL_ERROR",!0,"Provide a column index to add the cell at the end of");i={type:"__end__",columnId:this.getColumnId(n.columnIndex,u)};break;case"notebook_end":break}r({cellId:i,before:l,code:o,newCellId:d}),a({cellId:d,edit:{type:"add_cell"}}),Ya(d);break}case"delete_cell":{let{position:n}=t,o=n.cellId;if(!o)throw new we("Cell ID is required for delete_cell","CELL_ID_REQUIRED_FOR_DELETE_CELL",!0,"Provide a cell ID to delete");let i=s.get(Qe);this.validateCellIdExists(o,i),a({cellId:o,edit:{type:"delete_cell",previousCode:this.getCellEditorView(o,i).state.doc.toString()}}),Ya(o);break}}return{status:"success",next_steps:["If you need to perform more edits, call this tool again.","You should use the lint notebook tool to check for errors and lint issues. Fix them by editing the notebook.","You should use the run stale cells tool to run the cells that have been edited or newly added. This allows you to see the output of the cells and fix any errors."]}})}validateCellIdExists(t,e){if(!e.cellIds.getColumns().some(a=>a.idSet.has(t)))throw new we("Cell not found","CELL_NOT_FOUND",!1,"Check which cells exist in the notebook")}getColumnId(t,e){let a=e.cellIds.getColumns();if(t<0||t>=a.length)throw new we("Column index is out of range","COLUMN_INDEX_OUT_OF_RANGE",!0,"Choose a column index between 0 and the number of columns in the notebook (0-based)");return a[t].id}getCellEditorView(t,e){let a=e.cellHandles[t].current;if(!(a!=null&&a.editorView))throw new we("Cell editor not found","CELL_EDITOR_NOT_FOUND",!1,"Internal error, ask the user to report this error");return a.editorView}},tc=200,ac=3e4,Vn=2e3,rc=3e3,sc=4e4,nc={baseDescription:"Run cells in the current notebook that are stale. Stale cells are cells that have been edited or newly added. You can run this tool after editing the notebook or when requested. The output of the ran cells will be returned alongside metadata."},Wn=z({type:O("file"),url:v(),mediaType:v()}),ic=class{constructor(t){$(this,"name","run_stale_cells_tool");$(this,"description",nc);$(this,"schema",z({}));$(this,"outputSchema",Pn.extend({cellsToOutput:ut(v(),z({consoleOutput:v().optional(),cellOutput:v().optional(),consoleAttachments:Ue(Wn).optional(),cellAttachments:Ue(Wn).optional()}).nullable()).optional()}));$(this,"mode",["agent"]);$(this,"handler",async(t,e)=>{let{prepareForRun:a,sendRun:r,store:s}=e,n=s.get(Qe),o=Oi(n);if(o.length===0)return{status:"success",message:"No stale cells found."};if(await Ro({cellIds:o,sendRun:r,prepareForRun:a,notebook:n}),!await this.waitForCellsToFinish(s,o,ac,this.postExecutionDelay))return{status:"success",message:"No output was returned because some cells have not finished executing"};let i=s.get(Qe),l=new Map,d=!1,u=!1,p=0;for(let f of o){let _=Ln(f,i,{includeConsoleOutput:!0}),c=_.cellOutput,g=_.consoleOutputs,h=g&&g.length>0;if((c&&this.outputHasErrors(c)||h&&g.some(T=>this.outputHasErrors(T)))&&(d=!0),!c&&!h){l.set(f,null);continue}if(p>=sc){l.set(f,{cellOutput:"Cell executed (output omitted due to context limits)."});continue}let x,w;c&&(x=this.formatOutputString(c),p+=x.length),h&&(u=!0,w=g.map(T=>this.formatOutputString(T)).join(`
52
+ - A result object containing standard tool metadata.`},Xu=z({edit:z({type:ua(["update_cell","add_cell","delete_cell"]),code:v().optional(),position:z({type:ua(["relative","column_end","notebook_end"]).optional(),cellId:v().optional(),columnIndex:is().optional(),before:ue().optional()})})}),ec=class{constructor(){$(this,"name","edit_notebook_tool");$(this,"description",Qu);$(this,"schema",Xu);$(this,"outputSchema",Pn);$(this,"mode",["agent"]);$(this,"handler",async({edit:t},e)=>{let{addStagedCell:a,createNewCell:r,store:s}=e;switch(t.type){case"update_cell":{let{position:n,code:o}=t,i=n.cellId;if(i){if(!o)throw new we("Code is required for update_cell","CODE_REQUIRED_FOR_UPDATE_CELL",!0,"Provide the new code to update the cell")}else throw new we("Cell ID is required for update_cell","CELL_ID_REQUIRED_FOR_UPDATE_CELL",!0,"Provide a cell ID to update");let l=s.get(Qe);this.validateCellIdExists(i,l);let d=this.getCellEditorView(i,l);Ya(i);let u=s.get(Qt).get(i);if((u==null?void 0:u.type)==="add_cell"){Va(d,o);break}let p=d.state.doc.toString(),m=(u==null?void 0:u.previousCode)??p;if(o===m)break;a({cellId:i,edit:{type:"update_cell",previousCode:m}}),Va(d,o);break}case"add_cell":{let{position:n,code:o}=t,i="__end__",l=!1,d=rs.create(),u=s.get(Qe);switch(n.type){case"relative":{let p=n.cellId;if(!p)throw new we("Cell ID is required for add_cell with relative position","TOOL_ERROR",!0,"Provide a cell ID to add the cell before");if(n.before===void 0)throw new we("Before is required for add_cell with relative position","TOOL_ERROR",!0,`Provide a boolean value for before, true to add before cell ${p}, false to add after the cell`);this.validateCellIdExists(p,u),i=p,l=n.before;break}case"column_end":if(!n.columnIndex)throw new we("Column index is required for add_cell with column_end position","TOOL_ERROR",!0,"Provide a column index to add the cell at the end of");i={type:"__end__",columnId:this.getColumnId(n.columnIndex,u)};break;case"notebook_end":break}r({cellId:i,before:l,code:o,newCellId:d}),a({cellId:d,edit:{type:"add_cell"}}),Ya(d);break}case"delete_cell":{let{position:n}=t,o=n.cellId;if(!o)throw new we("Cell ID is required for delete_cell","CELL_ID_REQUIRED_FOR_DELETE_CELL",!0,"Provide a cell ID to delete");let i=s.get(Qe);this.validateCellIdExists(o,i),a({cellId:o,edit:{type:"delete_cell",previousCode:this.getCellEditorView(o,i).state.doc.toString()}}),Ya(o);break}}return{status:"success",next_steps:["If you need to perform more edits, call this tool again.","You should use the lint notebook tool to check for errors and lint issues. Fix them by editing the notebook.","You should use the run stale cells tool to run the cells that have been edited or newly added. This allows you to see the output of the cells and fix any errors."]}})}validateCellIdExists(t,e){if(!e.cellIds.getColumns().some(a=>a.idSet.has(t)))throw new we("Cell not found","CELL_NOT_FOUND",!1,"Check which cells exist in the notebook")}getColumnId(t,e){let a=e.cellIds.getColumns();if(t<0||t>=a.length)throw new we("Column index is out of range","COLUMN_INDEX_OUT_OF_RANGE",!0,"Choose a column index between 0 and the number of columns in the notebook (0-based)");return a[t].id}getCellEditorView(t,e){let a=e.cellHandles[t].current;if(!(a!=null&&a.editorView))throw new we("Cell editor not found","CELL_EDITOR_NOT_FOUND",!1,"Internal error, ask the user to report this error");return a.editorView}},tc=200,ac=3e4,Vn=2e3,rc=3e3,sc=4e4,nc={baseDescription:"Run cells in the current notebook that are stale. Stale cells are cells that have been edited or newly added. You can run this tool after editing the notebook or when requested. The output of the ran cells will be returned alongside metadata."},Wn=z({type:O("file"),url:v(),mediaType:v()}),ic=class{constructor(t){$(this,"name","run_stale_cells_tool");$(this,"description",nc);$(this,"schema",z({}));$(this,"outputSchema",Pn.extend({cellsToOutput:ut(v(),z({consoleOutput:v().optional(),cellOutput:v().optional(),consoleAttachments:Ue(Wn).optional(),cellAttachments:Ue(Wn).optional()}).nullable()).optional()}));$(this,"mode",["agent"]);$(this,"handler",async(t,e)=>{let{prepareForRun:a,sendRun:r,store:s}=e,n=s.get(Qe),o=Oi(n);if(o.length===0)return{status:"success",message:"No stale cells found."};if(await Ro({cellIds:o,sendRun:r,prepareForRun:a,notebook:n}),!await this.waitForCellsToFinish(s,o,ac,this.postExecutionDelay))return{status:"success",message:"No output was returned because some cells have not finished executing"};let i=s.get(Qe),l=new Map,d=!1,u=!1,p=0;for(let f of o){let _=Ln(f,i,{includeConsoleOutput:!0}),c=_.cellOutput,g=_.consoleOutputs,h=g&&g.length>0;if((c&&this.outputHasErrors(c)||h&&g.some(T=>this.outputHasErrors(T)))&&(d=!0),!c&&!h){l.set(f,null);continue}if(p>=sc){l.set(f,{cellOutput:"Cell executed (output omitted due to context limits)."});continue}let x,w;c&&(x=this.formatOutputString(c),p+=x.length),h&&(u=!0,w=g.map(T=>this.formatOutputString(T)).join(`
53
53
  `),w=this.truncateString(w,Vn),p+=w.length),l.set(f,{cellOutput:x,consoleOutput:w})}if(l.size===0)return{status:"success",message:"Stale cells have been run. No output was returned."};let m=["Review the output of the cells. The CellId is the key of the result object.",d?"There are errors in the cells. Please fix them by using the edit notebook tool and the given CellIds.":"You may edit the notebook further with the given CellIds."];return{status:"success",cellsToOutput:Object.fromEntries(l),message:u?"Console output represents the stdout or stderr of the cell (eg. print statements).":void 0,next_steps:m}});this.postExecutionDelay=(t==null?void 0:t.postExecutionDelay)??tc}outputHasErrors(t){return t.output.mimetype==="application/vnd.marimo+error"||t.output.mimetype==="application/vnd.marimo+traceback"}formatOutputString(t){let{outputType:e,processedContent:a,imageUrl:r,output:s}=t;if(e==="media"){let i=`Media Output: Contains ${s.mimetype} content`;return r?`${i}
54
54
  Image URL: ${r}`:i}if(s.mimetype==="text/html")return`HTML Output: text/html content (${(typeof s.data=="string"?s.data.length:JSON.stringify(s.data).length).toLocaleString()} chars). Full output visible in notebook UI.`;let n=this.outputHasErrors(t)?rc:Vn,o=a;return o||(o=typeof s.data=="string"?s.data:JSON.stringify(s.data)),`Output:
55
55
  ${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice(0,e)}
@@ -74,7 +74,7 @@ ${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice
74
74
 
75
75
  ## Additional info:
76
76
  - ${t.additionalInfo}`),e}var Bn,Xt;function lc(t,e,a,r,s){var n={};return Object.keys(r).forEach(function(o){n[o]=r[o]}),n.enumerable=!!n.enumerable,n.configurable=!!n.configurable,("value"in n||n.initializer)&&(n.writable=!0),n=a.slice().reverse().reduce(function(o,i){return i(t,e,o)||o},n),s&&n.initializer!==void 0&&(n.value=n.initializer?n.initializer.call(s):void 0,n.initializer=void 0),n.initializer===void 0?(Object.defineProperty(t,e,n),null):n}const Fr=new(Bn=$i(),Xt=class{constructor(t=[]){$(this,"tools",new Map);this.tools=new Map(t.map(e=>[e.name,e]))}has(t){return this.tools.has(t)}getToolOrThrow(t){let e=this.tools.get(t);if(!e)throw Error(`Tool ${t} not found`);return e}async invoke(t,e,a){var i;let r=this.getToolOrThrow(t),s=r.handler,n=r.schema,o=r.outputSchema;try{let l=await n.safeParseAsync(e);if(l.error)throw new we(`Tool ${t} returned invalid input: ${ns(l.error)}`,"INVALID_ARGUMENTS",!0,"Please check the arguments and try again.");let d=l.data,u=await s(d,a),p=await o.safeParseAsync(u);if(p.error){let m=ns(p.error);throw Error(`Tool ${t} returned invalid output: ${m}`)}return{tool_name:t,result:p.data,error:null}}catch(l){return l instanceof we?{tool_name:t,result:null,error:l.toStructuredString()}:{tool_name:t,result:null,error:new we(l instanceof Error?l.message:String(l),"TOOL_ERROR",!1,"Check the error message and try again with valid arguments.",{args:e,errorType:((i=l==null?void 0:l.constructor)==null?void 0:i.name)??typeof l}).toStructuredString()}}}getToolSchemas(t){return[...this.tools.values()].filter(e=>e.mode.includes(t)).map(e=>({name:e.name,description:oc(e.description),parameters:os(e.schema),source:"frontend",mode:e.mode}))}},lc(Xt.prototype,"getToolSchemas",[Bn],Object.getOwnPropertyDescriptor(Xt.prototype,"getToolSchemas"),Xt.prototype),Xt)([new ec,new ic]);var dc=Dt();const Jn=new Set(["openai","google","anthropic"]),uc=["image/*","text/*"];var cc=1024*1024*50;function pc(t){return t.length>50?`${t.slice(0,50)}...`:t}async function Kn(t){return await Promise.all(t.map(async e=>({type:"file",mediaType:e.type,filename:e.name,url:await bo(e,"dataUrl")})))}function mc(t){if(t.length===0)return!1;let e=t.at(-1);if(!e||e.role!=="assistant"||!e.parts)return!1;let a=e.parts;return a.length===0?!1:a[a.length-1].type==="reasoning"}function hc(t){return t.map(e=>e.type==="text"?e.text:"").join(`
77
- `)}async function Yn(t){let e=await Wu({input:hc(t.flatMap(r=>r.parts))});function a(r,s){return s?{...r,parts:[...r.parts,...e.attachments]}:r}return{...e.body,uiMessages:t.map((r,s)=>a(r,s===t.length-1))}}async function Hn({invokeAiTool:t,addToolOutput:e,toolCall:a,toolContext:r}){try{if(Fr.has(a.toolName)){let s=await Fr.invoke(a.toolName,a.input,r);e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}else{let s=await t({toolName:a.toolName,arguments:a.input??{}});e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}}catch(s){se.error("Tool call failed:",s),e({tool:a.toolName,toolCallId:a.toolCallId,output:`Error: ${s instanceof Error?s.message:String(s)}`})}}function fc(t){var i;if(t.length===0)return!1;let e=t[t.length-1],a=e.parts;if(a.length===0||e.role!=="assistant")return!1;let r=a.filter(l=>l.type.startsWith("tool-"));if(r.length===0)return!1;let s=r.every(l=>l.state==="output-available"),n=a[a.length-1],o=n.type==="text"&&((i=n.text)==null?void 0:i.trim().length)>0;return se.warn("All tool calls completed: %s",s),s&&!o}function Gn(){let t=(0,dc.c)(7),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];let[a,r]=(0,A.useState)(e),s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=p=>{if(p.length!==0){if(p.reduce(gc,0)>cc){Ka({title:"File size exceeded",description:"Attachments must be under 50 MB",variant:"danger"});return}r(m=>[...m,...p])}},t[1]=s):s=t[1];let n=Qr(s),o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=()=>r([]),t[2]=o):o=t[2];let i=o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=p=>r(m=>m.filter(f=>f!==p)),t[3]=l):l=t[3];let d=l,u;return t[4]!==n||t[5]!==a?(u={files:a,addFiles:n,clearFiles:i,removeFile:d},t[4]=n,t[5]=a,t[6]=u):u=t[6],u}function gc(t,e){return t+e.size}var ea=Dt(),E=qa(Xi(),1);const yc=t=>{var o;let e=(0,ea.c)(6),{attachment:a}=t;if((o=a.mediaType)!=null&&o.startsWith("image/")){let i=a.filename||"Attachment",l;return e[0]!==a.url||e[1]!==i?(l=(0,E.jsx)("img",{src:a.url,alt:i,className:"max-h-[100px] max-w-[100px] object-contain mb-1.5"}),e[0]=a.url,e[1]=i,e[2]=l):l=e[2],l}let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,E.jsx)(fs,{className:"h-3 w-3 mt-0.5"}),e[3]=r):r=e[3];let s=a.filename||"Attachment",n;return e[4]===s?n=e[5]:(n=(0,E.jsxs)("div",{className:"flex flex-row gap-1 items-center text-xs",children:[r,s]}),e[4]=s,e[5]=n),n},Qn=t=>{let e=(0,ea.c)(12),{file:a,className:r,onRemove:s}=t,[n,o]=(0,A.useState)(!1),i;e[0]===r?i=e[1]:(i=Wa("py-1 px-1.5 bg-muted rounded-md cursor-pointer flex flex-row gap-1 items-center text-xs",r),e[0]=r,e[1]=i);let l,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>o(!0),d=()=>o(!1),e[2]=l,e[3]=d):(l=e[2],d=e[3]);let u;e[4]!==a||e[5]!==n||e[6]!==s?(u=n?(0,E.jsx)(ms,{className:"h-3 w-3 mt-0.5",onClick:s}):vc(a),e[4]=a,e[5]=n,e[6]=s,e[7]=u):u=e[7];let p;return e[8]!==a.name||e[9]!==i||e[10]!==u?(p=(0,E.jsxs)("div",{className:i,onMouseEnter:l,onMouseLeave:d,children:[u,a.name]}),e[8]=a.name,e[9]=i,e[10]=u,e[11]=p):p=e[11],p},Xn=t=>{let e=(0,ea.c)(12),{isLoading:a,onStop:r,onSendClick:s,isEmpty:n,showStopLabel:o}=t,i=o===void 0?!1:o,l;e[0]===i?l=e[1]:(l=i?(0,E.jsxs)("div",{className:"flex flex-row items-center gap-1 px-1.5",children:[(0,E.jsx)("span",{className:"text-xs text-error",children:"Stop"}),(0,E.jsx)(ko,{size:"small"})]}):(0,E.jsx)(gs,{className:"size-4 text-error"}),e[0]=i,e[1]=l);let d=l,u=a?"Stop":"Submit",p=a?r:s,m=a?!1:n,f;e[2]!==a||e[3]!==d?(f=a?d:(0,E.jsx)(vs,{className:"h-3.5 w-3.5"}),e[2]=a,e[3]=d,e[4]=f):f=e[4];let _;e[5]!==p||e[6]!==m||e[7]!==f?(_=(0,E.jsx)(Xe,{variant:"text",size:"sm",className:"h-6 min-w-6 p-0 hover:bg-muted/30 cursor-pointer",onClick:p,disabled:m,children:f}),e[5]=p,e[6]=m,e[7]=f,e[8]=_):_=e[8];let c;return e[9]!==u||e[10]!==_?(c=(0,E.jsx)(pa,{content:u,children:_}),e[9]=u,e[10]=_,e[11]=c):c=e[11],c},ei=t=>{let e=(0,ea.c)(4),{handleAddContext:a,isLoading:r}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,E.jsx)(vo,{className:"h-3.5 w-3.5"}),e[0]=s):s=e[0];let n;return e[1]!==a||e[2]!==r?(n=(0,E.jsx)(pa,{content:"Add context",children:(0,E.jsx)(Xe,{variant:"text",size:"icon",onClick:a,disabled:r,children:s})}),e[1]=a,e[2]=r,e[3]=n):n=e[3],n},ti=t=>{let e=(0,ea.c)(15),{fileInputRef:a,isLoading:r,onAddFiles:s}=t,n;e[0]===a?n=e[1]:(n=()=>{var m;return(m=a.current)==null?void 0:m.click()},e[0]=a,e[1]=n);let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,E.jsx)(ys,{className:"h-3.5 w-3.5"}),e[2]=o):o=e[2];let i;e[3]!==r||e[4]!==n?(i=(0,E.jsx)(pa,{content:"Attach a file",children:(0,E.jsx)(Xe,{variant:"text",size:"icon",onClick:n,disabled:r,children:o})}),e[3]=r,e[4]=n,e[5]=i):i=e[5];let l;e[6]===s?l=e[7]:(l=m=>{m.target.files&&s([...m.target.files])},e[6]=s,e[7]=l);let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=uc.join(","),e[8]=d):d=e[8];let u;e[9]!==a||e[10]!==l?(u=(0,E.jsx)(Eo,{ref:a,type:"file",multiple:!0,hidden:!0,onChange:l,accept:d}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let p;return e[12]!==i||e[13]!==u?(p=(0,E.jsxs)(E.Fragment,{children:[i,u]}),e[12]=i,e[13]=u,e[14]=p):p=e[14],p};function vc(t){let e="h-3 w-3 mt-0.5";return t.type.startsWith("image/")?(0,E.jsx)(wo,{className:e}):t.type.startsWith("text/")?(0,E.jsx)(zi,{className:e}):(0,E.jsx)(fs,{className:e})}const zr=ma.define(),Je=fa.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(zr)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}}),bc=fa.define({create(){return{onResourceClick:void 0,onResourceMouseOver:void 0,onResourceMouseOut:void 0,onPromptSubmit:void 0}},update(t){return t}}),_c=ma.define();fa.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(_c)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}});const xc=(t,e)=>async a=>{let r=a.matchBefore(/@(\w+)?/);if(!r||r.from===r.to&&!a.explicit)return null;let s=await t();if(s.length===0)return null;let n=zr.of(new Map(s.map(i=>[i.uri,i])));a.view&&a.view.dispatch({effects:n});let o=s.map(i=>({label:`@${i.name}`,displayLabel:i.name,detail:i.uri,info:i.description||void 0,type:i.mimeType?"constant":"variable",boost:i.description?100:0,...e==null?void 0:e(i),apply:(l,d,u,p)=>{l.dispatch({changes:{from:u,to:p,insert:`@${i.uri} `}})}}));return{from:r.from,options:o}},wc=/@[\w-]+:\/\/(?!\/)[^\s]+/;function it(t){return t.matchAll(new RegExp(wc.source,"g"))}var kc=class extends cs{constructor(e,a){super();$(this,"resource");$(this,"view");this.resource=e,this.view=a}eq(e){return e.resource.uri===this.resource.uri}toDOM(){let e=document.createElement("span");e.className="cm-resource-widget",e.textContent=`@${this.resource.name}`;let a=this.view.state.field(bc,!1),r=a==null?void 0:a.onResourceClick,s=a==null?void 0:a.onResourceMouseOver,n=a==null?void 0:a.onResourceMouseOut;return r&&(e.style.cursor="pointer",e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),r(this.resource)})),s&&e.addEventListener("mouseover",o=>{o.preventDefault(),o.stopPropagation(),s(this.resource)}),n&&e.addEventListener("mouseout",o=>{o.preventDefault(),o.stopPropagation(),n(this.resource)}),e}},Cc=class extends cs{constructor(e,a){super();$(this,"uri");$(this,"view");this.uri=e,this.view=a}eq(e){return e.uri===this.uri}toDOM(){let e=document.createElement("span");return e.className="cm-not-found-resource-widget",e.textContent=`@${this.uri.split("://")[1]??this.uri}`,e}};function ai(t){let e=t.state.field(Je),a=[];for(let{from:r,to:s}of t.visibleRanges){let n=t.state.doc.sliceString(r,s);for(let o of it(n)){let i=r+o.index,l=o[0].slice(1),d=e.get(l);d?a.push(Ba.replace({widget:new kc(d,t)}).range(i,i+o[0].length)):a.push(Ba.replace({widget:new Cc(l,t)}).range(i,i+o[0].length))}}return Ba.set(a)}const Ec=lo.fromClass(class{constructor(t){$(this,"decorations");this.decorations=ai(t)}update(t){(t.docChanged||t.viewportChanged||t.transactions.some(e=>e.effects.some(a=>a.is(zr))))&&(this.decorations=ai(t.view))}},{decorations:t=>t.decorations});function Tc(t){let e=document.createElement("div");e.className="cm-tooltip-cursor";let a=document.createElement("div");if(a.className="cm-tooltip-cursor-title",a.textContent=`${t.name} (${t.uri})`,e.appendChild(a),t.description){let r=document.createElement("div");r.className="cm-tooltip-cursor-description",r.textContent=t.description,e.appendChild(r)}if(t.mimeType){let r=document.createElement("div");r.className="cm-tooltip-cursor-mimetype",r.textContent=t.mimeType,e.appendChild(r)}return{dom:e}}function Ic(t,e,a,r=0){for(let s of it(t)){let n=r+s.index,o=n+s[0].length;if(e>=n&&e<=o){let i=s[0].slice(1),l=a.get(i);if(l)return{resource:l,start:n,end:o}}}return null}function Sc(t){return uo((e,a)=>{let{from:r,text:s}=e.state.doc.lineAt(a),n=Ic(s,a,e.state.field(Je),r);return n?{pos:n.start,end:n.end,above:!0,create(){return(t.createTooltip??Tc)(n.resource)}}:null})}function Oc(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(it(n));if(o.length===0)return null;for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e===d&&a.has(u))return{from:l,to:d,uri:u}}return null}function Ac(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e).to,n=r.sliceString(e,s),o=Array.from(it(n));if(o.length===0)return null;let i=o[0];if(!i||i.index!==0)return null;let l=e,d=e+i[0].length,u=i[0].slice(1);return a.has(u)?{from:l,to:d,uri:u}:null}function ri(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(it(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e>l&&e<d&&a.has(u))return{from:l,to:d,uri:u}}return null}function Rc(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,e),o=Array.from(it(n)),i=null;for(let l of o){let d=s.from+l.index,u=d+l[0].length,p=l[0].slice(1);a.has(p)&&u<=e&&(e>u?i=u:e===u&&(i=d))}return i}function Nc(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(it(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(a.has(u)&&l>=e){if(e<l)return l;if(e===l)return d}}return null}const jc=io.transactionFilter.of(t=>{var r;let e=t.annotation(oo.userEvent);if(!e)return t;let a=t.startState.selection.main;if(!a.empty)return t;if(e==="input.type"||e.startsWith("input")){if(t.changes.empty)return t;let s=t.startState.field(Je),n=t.startState.doc,o=!1,i=0,l=[];if(t.changes.iterChanges((d,u,p,m,f)=>{let _=f.toString(),c=d;if(/^\s+$/.test(_)){l.push({from:d,to:u,insert:_});return}let g=n.lineAt(c),h=n.sliceString(g.from,g.to),x=Array.from(it(h)),w=!1,T=!1;for(let P of x){let Z=g.from+P.index,j=Z+P[0].length,G=P[0].slice(1);if(s.has(G)){if(c===Z){let M=c>0?n.sliceString(c-1,c):"";M!==""&&M!==" "&&M!==`
77
+ `)}async function Yn(t){let e=await Wu({input:hc(t.flatMap(r=>r.parts))});function a(r,s){return s?{...r,parts:[...r.parts,...e.attachments]}:r}return{...e.body,uiMessages:t.map((r,s)=>a(r,s===t.length-1))}}async function Hn({invokeAiTool:t,addToolOutput:e,toolCall:a,toolContext:r}){try{if(Fr.has(a.toolName)){let s=await Fr.invoke(a.toolName,a.input,r);e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}else{let s=await t({toolName:a.toolName,arguments:a.input??{}});e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}}catch(s){se.error("Tool call failed:",s),e({tool:a.toolName,toolCallId:a.toolCallId,output:`Error: ${s instanceof Error?s.message:String(s)}`})}}function fc(t){var i;if(t.length===0)return!1;let e=t[t.length-1],a=e.parts;if(a.length===0||e.role!=="assistant")return!1;let r=a.filter(l=>l.type.startsWith("tool-"));if(r.length===0)return!1;let s=r.every(l=>l.state==="output-available"),n=a[a.length-1],o=n.type==="text"&&((i=n.text)==null?void 0:i.trim().length)>0;return se.warn("All tool calls completed: %s",s),s&&!o}function Gn(){let t=(0,dc.c)(7),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];let[a,r]=(0,A.useState)(e),s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=p=>{if(p.length!==0){if(p.reduce(gc,0)>cc){Ka({title:"File size exceeded",description:"Attachments must be under 50 MB",variant:"danger"});return}r(m=>[...m,...p])}},t[1]=s):s=t[1];let n=Qr(s),o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=()=>r([]),t[2]=o):o=t[2];let i=o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=p=>r(m=>m.filter(f=>f!==p)),t[3]=l):l=t[3];let d=l,u;return t[4]!==n||t[5]!==a?(u={files:a,addFiles:n,clearFiles:i,removeFile:d},t[4]=n,t[5]=a,t[6]=u):u=t[6],u}function gc(t,e){return t+e.size}var ea=Dt(),E=qa(Xi(),1);const yc=t=>{var o;let e=(0,ea.c)(6),{attachment:a}=t;if((o=a.mediaType)!=null&&o.startsWith("image/")){let i=a.filename||"Attachment",l;return e[0]!==a.url||e[1]!==i?(l=(0,E.jsx)("img",{src:a.url,alt:i,className:"max-h-[100px] max-w-[100px] object-contain mb-1.5"}),e[0]=a.url,e[1]=i,e[2]=l):l=e[2],l}let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,E.jsx)(fs,{className:"h-3 w-3 mt-0.5"}),e[3]=r):r=e[3];let s=a.filename||"Attachment",n;return e[4]===s?n=e[5]:(n=(0,E.jsxs)("div",{className:"flex flex-row gap-1 items-center text-xs",children:[r,s]}),e[4]=s,e[5]=n),n},Qn=t=>{let e=(0,ea.c)(12),{file:a,className:r,onRemove:s}=t,[n,o]=(0,A.useState)(!1),i;e[0]===r?i=e[1]:(i=Wa("py-1 px-1.5 bg-muted rounded-md cursor-pointer flex flex-row gap-1 items-center text-xs",r),e[0]=r,e[1]=i);let l,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>o(!0),d=()=>o(!1),e[2]=l,e[3]=d):(l=e[2],d=e[3]);let u;e[4]!==a||e[5]!==n||e[6]!==s?(u=n?(0,E.jsx)(ms,{className:"h-3 w-3 mt-0.5",onClick:s}):vc(a),e[4]=a,e[5]=n,e[6]=s,e[7]=u):u=e[7];let p;return e[8]!==a.name||e[9]!==i||e[10]!==u?(p=(0,E.jsxs)("div",{className:i,onMouseEnter:l,onMouseLeave:d,children:[u,a.name]}),e[8]=a.name,e[9]=i,e[10]=u,e[11]=p):p=e[11],p},Xn=t=>{let e=(0,ea.c)(12),{isLoading:a,onStop:r,onSendClick:s,isEmpty:n,showStopLabel:o}=t,i=o===void 0?!1:o,l;e[0]===i?l=e[1]:(l=i?(0,E.jsxs)("div",{className:"flex flex-row items-center gap-1 px-1.5",children:[(0,E.jsx)("span",{className:"text-xs text-error",children:"Stop"}),(0,E.jsx)(ko,{size:"small"})]}):(0,E.jsx)(gs,{className:"size-4 text-error"}),e[0]=i,e[1]=l);let d=l,u=a?"Stop":"Submit",p=a?r:s,m=a?!1:n,f;e[2]!==a||e[3]!==d?(f=a?d:(0,E.jsx)(vs,{className:"h-3.5 w-3.5"}),e[2]=a,e[3]=d,e[4]=f):f=e[4];let _;e[5]!==p||e[6]!==m||e[7]!==f?(_=(0,E.jsx)(Xe,{variant:"text",size:"sm",className:"h-6 min-w-6 p-0 hover:bg-muted/30 cursor-pointer",onClick:p,disabled:m,children:f}),e[5]=p,e[6]=m,e[7]=f,e[8]=_):_=e[8];let c;return e[9]!==u||e[10]!==_?(c=(0,E.jsx)(pa,{content:u,children:_}),e[9]=u,e[10]=_,e[11]=c):c=e[11],c},ei=t=>{let e=(0,ea.c)(4),{handleAddContext:a,isLoading:r}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,E.jsx)(vo,{className:"h-3.5 w-3.5"}),e[0]=s):s=e[0];let n;return e[1]!==a||e[2]!==r?(n=(0,E.jsx)(pa,{content:"Add context",children:(0,E.jsx)(Xe,{variant:"text",size:"icon",onClick:a,disabled:r,children:s})}),e[1]=a,e[2]=r,e[3]=n):n=e[3],n},ti=t=>{let e=(0,ea.c)(15),{fileInputRef:a,isLoading:r,onAddFiles:s}=t,n;e[0]===a?n=e[1]:(n=()=>{var m;return(m=a.current)==null?void 0:m.click()},e[0]=a,e[1]=n);let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,E.jsx)(ys,{className:"h-3.5 w-3.5"}),e[2]=o):o=e[2];let i;e[3]!==r||e[4]!==n?(i=(0,E.jsx)(pa,{content:"Attach a file",children:(0,E.jsx)(Xe,{variant:"text",size:"icon",onClick:n,disabled:r,children:o})}),e[3]=r,e[4]=n,e[5]=i):i=e[5];let l;e[6]===s?l=e[7]:(l=m=>{m.target.files&&s([...m.target.files])},e[6]=s,e[7]=l);let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=uc.join(","),e[8]=d):d=e[8];let u;e[9]!==a||e[10]!==l?(u=(0,E.jsx)(Eo,{ref:a,type:"file",multiple:!0,hidden:!0,onChange:l,accept:d}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let p;return e[12]!==i||e[13]!==u?(p=(0,E.jsxs)(E.Fragment,{children:[i,u]}),e[12]=i,e[13]=u,e[14]=p):p=e[14],p};function vc(t){let e="h-3 w-3 mt-0.5";return t.type.startsWith("image/")?(0,E.jsx)(wo,{className:e}):t.type.startsWith("text/")?(0,E.jsx)(Li,{className:e}):(0,E.jsx)(fs,{className:e})}const zr=ma.define(),Je=fa.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(zr)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}}),bc=fa.define({create(){return{onResourceClick:void 0,onResourceMouseOver:void 0,onResourceMouseOut:void 0,onPromptSubmit:void 0}},update(t){return t}}),_c=ma.define();fa.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(_c)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}});const xc=(t,e)=>async a=>{let r=a.matchBefore(/@(\w+)?/);if(!r||r.from===r.to&&!a.explicit)return null;let s=await t();if(s.length===0)return null;let n=zr.of(new Map(s.map(i=>[i.uri,i])));a.view&&a.view.dispatch({effects:n});let o=s.map(i=>({label:`@${i.name}`,displayLabel:i.name,detail:i.uri,info:i.description||void 0,type:i.mimeType?"constant":"variable",boost:i.description?100:0,...e==null?void 0:e(i),apply:(l,d,u,p)=>{l.dispatch({changes:{from:u,to:p,insert:`@${i.uri} `}})}}));return{from:r.from,options:o}},wc=/@[\w-]+:\/\/(?!\/)[^\s]+/;function it(t){return t.matchAll(new RegExp(wc.source,"g"))}var kc=class extends cs{constructor(e,a){super();$(this,"resource");$(this,"view");this.resource=e,this.view=a}eq(e){return e.resource.uri===this.resource.uri}toDOM(){let e=document.createElement("span");e.className="cm-resource-widget",e.textContent=`@${this.resource.name}`;let a=this.view.state.field(bc,!1),r=a==null?void 0:a.onResourceClick,s=a==null?void 0:a.onResourceMouseOver,n=a==null?void 0:a.onResourceMouseOut;return r&&(e.style.cursor="pointer",e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),r(this.resource)})),s&&e.addEventListener("mouseover",o=>{o.preventDefault(),o.stopPropagation(),s(this.resource)}),n&&e.addEventListener("mouseout",o=>{o.preventDefault(),o.stopPropagation(),n(this.resource)}),e}},Cc=class extends cs{constructor(e,a){super();$(this,"uri");$(this,"view");this.uri=e,this.view=a}eq(e){return e.uri===this.uri}toDOM(){let e=document.createElement("span");return e.className="cm-not-found-resource-widget",e.textContent=`@${this.uri.split("://")[1]??this.uri}`,e}};function ai(t){let e=t.state.field(Je),a=[];for(let{from:r,to:s}of t.visibleRanges){let n=t.state.doc.sliceString(r,s);for(let o of it(n)){let i=r+o.index,l=o[0].slice(1),d=e.get(l);d?a.push(Ba.replace({widget:new kc(d,t)}).range(i,i+o[0].length)):a.push(Ba.replace({widget:new Cc(l,t)}).range(i,i+o[0].length))}}return Ba.set(a)}const Ec=lo.fromClass(class{constructor(t){$(this,"decorations");this.decorations=ai(t)}update(t){(t.docChanged||t.viewportChanged||t.transactions.some(e=>e.effects.some(a=>a.is(zr))))&&(this.decorations=ai(t.view))}},{decorations:t=>t.decorations});function Tc(t){let e=document.createElement("div");e.className="cm-tooltip-cursor";let a=document.createElement("div");if(a.className="cm-tooltip-cursor-title",a.textContent=`${t.name} (${t.uri})`,e.appendChild(a),t.description){let r=document.createElement("div");r.className="cm-tooltip-cursor-description",r.textContent=t.description,e.appendChild(r)}if(t.mimeType){let r=document.createElement("div");r.className="cm-tooltip-cursor-mimetype",r.textContent=t.mimeType,e.appendChild(r)}return{dom:e}}function Ic(t,e,a,r=0){for(let s of it(t)){let n=r+s.index,o=n+s[0].length;if(e>=n&&e<=o){let i=s[0].slice(1),l=a.get(i);if(l)return{resource:l,start:n,end:o}}}return null}function Sc(t){return uo((e,a)=>{let{from:r,text:s}=e.state.doc.lineAt(a),n=Ic(s,a,e.state.field(Je),r);return n?{pos:n.start,end:n.end,above:!0,create(){return(t.createTooltip??Tc)(n.resource)}}:null})}function Oc(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(it(n));if(o.length===0)return null;for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e===d&&a.has(u))return{from:l,to:d,uri:u}}return null}function Ac(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e).to,n=r.sliceString(e,s),o=Array.from(it(n));if(o.length===0)return null;let i=o[0];if(!i||i.index!==0)return null;let l=e,d=e+i[0].length,u=i[0].slice(1);return a.has(u)?{from:l,to:d,uri:u}:null}function ri(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(it(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e>l&&e<d&&a.has(u))return{from:l,to:d,uri:u}}return null}function Rc(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,e),o=Array.from(it(n)),i=null;for(let l of o){let d=s.from+l.index,u=d+l[0].length,p=l[0].slice(1);a.has(p)&&u<=e&&(e>u?i=u:e===u&&(i=d))}return i}function Nc(t,e){let a=t.field(Je),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(it(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(a.has(u)&&l>=e){if(e<l)return l;if(e===l)return d}}return null}const jc=io.transactionFilter.of(t=>{var r;let e=t.annotation(oo.userEvent);if(!e)return t;let a=t.startState.selection.main;if(!a.empty)return t;if(e==="input.type"||e.startsWith("input")){if(t.changes.empty)return t;let s=t.startState.field(Je),n=t.startState.doc,o=!1,i=0,l=[];if(t.changes.iterChanges((d,u,p,m,f)=>{let _=f.toString(),c=d;if(/^\s+$/.test(_)){l.push({from:d,to:u,insert:_});return}let g=n.lineAt(c),h=n.sliceString(g.from,g.to),x=Array.from(it(h)),w=!1,T=!1;for(let P of x){let Z=g.from+P.index,j=Z+P[0].length,G=P[0].slice(1);if(s.has(G)){if(c===Z){let M=c>0?n.sliceString(c-1,c):"";M!==""&&M!==" "&&M!==`
78
78
  `&&M!==" "&&(w=!0)}if(c===j){let M=c<n.length?n.sliceString(c,c+1):"";(M===""||M!==" "&&M!==`
79
79
  `&&M!==" ")&&(T=!0)}}}let S=_;w&&(S=` ${S}`,i+=1),T&&(S=` ${S}`,i+=1),S!==_&&(o=!0),l.push({from:d,to:u,insert:S})}),o)return[{changes:l,selection:t.selection?{anchor:t.selection.main.anchor+i,head:t.selection.main.head+i}:void 0,scrollIntoView:t.scrollIntoView}]}if(e==="delete.backward"||e==="delete.forward"){let s=null;return e==="delete.backward"?s=Oc(t.startState,a.head):e==="delete.forward"&&(s=Ac(t.startState,a.head)),s?[{changes:{from:s.from,to:s.to,insert:""},selection:{anchor:s.from},scrollIntoView:!0}]:t}if((r=t.selection)!=null&&r.main.empty&&a.empty&&!e.startsWith("input")&&e!=="input.type"){let s=a.head,n=t.selection.main.head,o=null;if(n<s){let i=ri(t.startState,s);o=i&&s>i.from?i.from:Rc(t.startState,s)}else if(n>s){let i=ri(t.startState,s);o=i&&s<i.to?i.to:Nc(t.startState,s)}if(o!==null&&o!==n)return[{selection:{anchor:o},scrollIntoView:!0}]}return t}),Mc=us.baseTheme({".cm-resource-widget":{background:"light-dark(rgba(86,156,214,0.08),rgba(86,156,214,0.18))",borderRadius:"4px",padding:"2px 4px",color:"light-dark(#2367a2,#7ecbff)",fontWeight:"500"},".cm-resource-widget:hover":{background:"light-dark(rgba(86,156,214,0.18),rgba(86,156,214,0.28))"},".cm-not-found-resource-widget":{background:"light-dark(rgba(151,151,151,0.08),rgba(151,151,151,0.18))",borderRadius:"4px",padding:"2px 4px",color:"light-dark(#b00020,#ff8080)",fontWeight:"500"}});var si="_none_",Pc=[{uri:"",name:"No resources",type:si,data:{}}],$c={info:"Variables, dataframes, and tables will appear here.",apply:()=>{}};function Lc(t){let{language:e,store:a,onAddFiles:r}=t;return[e.data.of({autocomplete:xc(async()=>{let s=yt(a).getAllItems();return s.length===0?Pc:s},s=>{var n;return s.type===si?$c:((n=yt(a).getProvider(s.type))==null?void 0:n.formatCompletion(s))||{}})}),ds.high(ha.of([{key:"Tab",preventDefault:!0,run:s=>mo(s)}])),Zn.of({addAttachment:s=>r==null?void 0:r([s])}),...r?[e.data.of({autocomplete:Uu().createCompletionSource()})]:[],Ec,jc,Je.init(()=>{let s=yt(a).getAllItems();return new Map(s.map(n=>[n.uri,n]))}),Mc,Sc({createTooltip:s=>{let n=yt(a).getProvider(s.type);if(!n)return se.warn("No provider found for resource",s),ta(s.description||s.name);let o=n.formatCompletion(s),i=s.description||s.name;if(!(o!=null&&o.info))return ta(i);if(typeof o.info=="string")return ta(o.info);let l=o.info(o);return l?"dom"in l?{dom:l.dom}:"then"in l?(se.warn("info is a promise. This is not supported",l),ta(i)):{dom:l}:ta(i)}})]}function ta(t){let e=document.createElement("div");return e.innerHTML=t,{dom:e}}var Ur=Dt();const ni=t=>{let{handleAcceptCompletion:e,handleDeclineCompletion:a,isLoading:r,hasCompletion:s}=t;return n=>{let o=Hi()?n.metaKey:n.ctrlKey;o&&n.key==="Enter"&&!r&&s&&e(),(n.key==="Delete"||n.key==="Backspace")&&o&&n.shiftKey&&(a(),n.preventDefault(),n.stopPropagation())}},Dc=t=>{let e=(0,Ur.c)(9),{isLoading:a,onAccept:r,onDecline:s,runCell:n}=t,o;e[0]!==a||e[1]!==r||e[2]!==n?(o=(0,E.jsx)(ii,{isLoading:a,onAccept:r,size:"xs",runCell:n}),e[0]=a,e[1]=r,e[2]=n,e[3]=o):o=e[3];let i;e[4]===s?i=e[5]:(i=(0,E.jsx)(oi,{onDecline:s,size:"xs"}),e[4]=s,e[5]=i);let l;return e[6]!==o||e[7]!==i?(l=(0,E.jsxs)(E.Fragment,{children:[o,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8],l},ii=t=>{let e=(0,Ur.c)(33),{isLoading:a,onAccept:r,multipleCompletions:s,size:n,buttonStyles:o,acceptShortcut:i,runCell:l,playButtonStyles:d,borderless:u}=t,p=s===void 0?!1:s,m=n===void 0?"sm":n,f=u===void 0?!1:u,_;e[0]!==r||e[1]!==l?(_=()=>{r(),l&&l()},e[0]=r,e[1]=l,e[2]=_):_=e[2];let c=_,g=p?"Accept all":"Accept";if(l){let T=`h-6 text-(--grass-11) bg-(--grass-3)/60
80
80
  hover:bg-(--grass-3) dark:bg-(--grass-4)/80 dark:hover:bg-(--grass-3) font-semibold
@@ -88,5 +88,5 @@ ${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice
88
88
  border-(--green-6) border hover:shadow-xs rounded px-3 ${o}`,x;e[24]===i?x=e[25]:(x=i&&(0,E.jsx)(Ha,{className:"ml-1 inline",shortcut:i}),e[24]=i,e[25]=x);let w;return e[26]!==a||e[27]!==r||e[28]!==m||e[29]!==h||e[30]!==x||e[31]!==g?(w=(0,E.jsxs)(Xe,{variant:"text",size:m,disabled:a,onClick:r,className:h,children:[g,x]}),e[26]=a,e[27]=r,e[28]=m,e[29]=h,e[30]=x,e[31]=g,e[32]=w):w=e[32],w},oi=t=>{let e=(0,Ur.c)(8),{onDecline:a,multipleCompletions:r,size:s,className:n,declineShortcut:o,borderless:i}=t,l=r===void 0?!1:r,d=s===void 0?"sm":s,u=`h-6 text-(--red-10) bg-(--red-3)/60 hover:bg-(--red-3)
89
89
  dark:bg-(--red-4)/80 dark:hover:bg-(--red-3) rounded px-3 font-semibold
90
90
  active:bg-(--red-5) dark:active:bg-(--red-4)
91
- border-(--red-6) border hover:shadow-xs ${(i===void 0?!1:i)&&"border-none rounded-md"} ${n}`,p=l&&" all",m;e[0]===o?m=e[1]:(m=o&&(0,E.jsx)(Ha,{className:"ml-1 inline",shortcut:o}),e[0]=o,e[1]=m);let f;return e[2]!==a||e[3]!==d||e[4]!==u||e[5]!==p||e[6]!==m?(f=(0,E.jsxs)(Xe,{variant:"text",size:d,onClick:a,className:u,children:["Reject",p,m]}),e[2]=a,e[3]=d,e[4]=u,e[5]=p,e[6]=m,e[7]=f):f=e[7],f};var Zc=class extends br{constructor(t,e){super(t),this.onChunkReceived=e}processResponseStream(t){let e=this.onChunkReceived;return super.processResponseStream(t).pipeThrough(new TransformStream({async transform(a,r){e(a),r.enqueue(a)}}))}},li=Dt(),Fc=qi("marimo:ai-language","python",ji),di="marimo:ai-prompt-history",ui=new Li(Ue(v()),()=>[]);const zc=t=>{var Yr;let e=(0,li.c)(98),{onClose:a}=t,r=Hr(),[s,n]=(0,A.useState)(""),{deleteAllStagedCells:o,clearStagedCells:i,onStream:l,addStagedCell:d}=qn(r),[u,p]=Ci(Fc),m=Qi(),{invokeAiTool:f,sendRun:_}=go(),c=Xr(Qt),g=(0,A.useRef)(null),h=(0,A.useRef)(null),{files:x,addFiles:w,removeFile:T}=Gn(),S=Xr(Gi),{createNewCell:P,prepareForRun:Z}=es(),j;e[0]!==d||e[1]!==P||e[2]!==Z||e[3]!==_||e[4]!==r?(j={store:r,addStagedCell:d,createNewCell:P,prepareForRun:Z,sendRun:_},e[0]=d,e[1]=P,e[2]=Z,e[3]=_,e[4]=r,e[5]=j):j=e[5];let G=j,M;if(e[6]!==u||e[7]!==l||e[8]!==m){let de;e[10]===m?de=e[11]:(de=()=>m.headers(),e[10]=m,e[11]=de);let Ne;e[12]!==u||e[13]!==m?(Ne=async da=>{let bi=await Yn(da.messages),_i={...da,...bi,code:"",prompt:"",language:u};return{api:m.getAiURL("completion").toString(),body:_i}},e[12]=u,e[13]=m,e[14]=Ne):Ne=e[14];let la;e[15]===l?la=e[16]:(la=da=>{l(da)},e[15]=l,e[16]=la),M=new Zc({api:m.getAiURL("completion").toString(),headers:de,prepareSendMessagesRequest:Ne},la),e[6]=u,e[7]=l,e[8]=m,e[9]=M}else M=e[9];let{sendMessage:K,stop:ee,status:ae,addToolOutput:re}=Nn({experimental_throttle:100,transport:M,onToolCall:async de=>{let{toolCall:Ne}=de;await Hn({invokeAiTool:f,addToolOutput:X,toolCall:{toolName:Ne.toolName,toolCallId:Ne.toolCallId,input:Ne.input},toolContext:G})},onError:Uc}),X=re,F=ae==="streaming"||ae==="submitted",oe=c.size>0,te=((Yr=S==null?void 0:S.models)==null?void 0:Yr.edit_model)||"openai/gpt-4o",Le;if(e[17]!==te){let de=Ki.parse(te).providerId;Le=Jn.has(de),e[17]=te,e[18]=Le}else Le=e[18];let Ae=Le,ke;e[19]!==o||e[20]!==x||e[21]!==s||e[22]!==F||e[23]!==K?(ke=async()=>{var de;F||((de=g.current)!=null&&de.view&&Mn(g.current.view),o(),K({text:s,files:x?await Kn(x):void 0}))},e[19]=o,e[20]=x,e[21]=s,e[22]=F,e[23]=K,e[24]=ke):ke=e[24];let he=ke,De;e[25]===Symbol.for("react.memo_cache_sentinel")?(De=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)($o,{className:"size-4 mr-2"}),"Python"]}),e[25]=De):De=e[25];let vt=De,Ze;e[26]===Symbol.for("react.memo_cache_sentinel")?(Ze=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Zi,{className:"size-4 mr-2"}),"SQL"]}),e[26]=Ze):Ze=e[26];let Lt=Ze,bt=u==="python"?vt:Lt,_t;e[27]===Symbol.for("react.memo_cache_sentinel")?(_t=(0,E.jsx)(_o,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),e[27]=_t):_t=e[27];let Ke;e[28]===bt?Ke=e[29]:(Ke=(0,E.jsxs)(ao,{className:"flex items-center justify-between h-7 text-xs px-2 py-0.5 border rounded-md hover:text-accent-foreground","data-testid":"language-button",children:[bt,_t]}),e[28]=bt,e[29]=Ke);let Re,ot;e[30]===Symbol.for("react.memo_cache_sentinel")?(Re=(0,E.jsx)("div",{className:"px-2 py-1 text-sm text-muted-foreground",children:"Select language"}),ot=(0,E.jsx)(to,{}),e[30]=Re,e[31]=ot):(Re=e[30],ot=e[31]);let V;e[32]===p?V=e[33]:(V=(0,E.jsx)(ls,{onClick:()=>p("python"),children:vt}),e[32]=p,e[33]=V);let W;e[34]===p?W=e[35]:(W=(0,E.jsx)(ls,{onClick:()=>p("sql"),children:Lt}),e[34]=p,e[35]=W);let Q;e[36]!==V||e[37]!==W?(Q=(0,E.jsxs)(ro,{align:"center",children:[Re,ot,V,W]}),e[36]=V,e[37]=W,e[38]=Q):Q=e[38];let B;e[39]!==Ke||e[40]!==Q?(B=(0,E.jsxs)(so,{modal:!1,children:[Ke,Q]}),e[39]=Ke,e[40]=Q,e[41]=B):B=e[41];let Ce=B,be;e[42]!==i||e[43]!==a?(be=()=>{i(),a()},e[42]=i,e[43]=a,e[44]=be):be=e[44];let le=be,ne;e[45]===o?ne=e[46]:(ne=()=>{o()},e[45]=o,e[46]=ne);let _e=ne,lt;e[47]===Symbol.for("react.memo_cache_sentinel")?(lt=(0,E.jsx)(To,{className:"size-4 text-(--blue-11) mr-2"}),e[47]=lt):lt=e[47];let Fe;e[48]!==o||e[49]!==a?(Fe=()=>{o(),a()},e[48]=o,e[49]=a,e[50]=Fe):Fe=e[50];let dt;e[51]===Symbol.for("react.memo_cache_sentinel")?(dt=de=>{n(de)},e[51]=dt):dt=e[51];let ie;e[52]!==le||e[53]!==_e||e[54]!==oe||e[55]!==F?(ie=ni({handleAcceptCompletion:le,handleDeclineCompletion:_e,isLoading:F,hasCompletion:oe}),e[52]=le,e[53]=_e,e[54]=oe,e[55]=F,e[56]=ie):ie=e[56];let ce;e[57]!==s||e[58]!==he||e[59]!==Fe||e[60]!==ie?(ce=(0,E.jsx)(ci,{inputRef:g,onClose:Fe,value:s,onChange:dt,onSubmit:he,onKeyDown:ie}),e[57]=s,e[58]=he,e[59]=Fe,e[60]=ie,e[61]=ce):ce=e[61];let Ye;e[62]===Symbol.for("react.memo_cache_sentinel")?(Ye=(0,E.jsx)(ms,{className:"size-4"}),e[62]=Ye):Ye=e[62];let He;e[63]===a?He=e[64]:(He=(0,E.jsx)(Xe,{variant:"text",size:"sm",className:"mb-0 px-1",onClick:a,children:Ye}),e[63]=a,e[64]=He);let Ge;e[65]!==ce||e[66]!==He?(Ge=(0,E.jsxs)("div",{className:"flex items-center px-3",children:[lt,ce,He]}),e[65]=ce,e[66]=He,e[67]=Ge):Ge=e[67];let Fa=Ge,ra;e[68]===Symbol.for("react.memo_cache_sentinel")?(ra=(0,E.jsx)(Yi,{triggerClassName:"h-7 text-xs max-w-64",iconSize:"small",forRole:"edit",showAddCustomModelDocs:!0}),e[68]=ra):ra=e[68];let xt;e[69]===Ce?xt=e[70]:(xt=(0,E.jsxs)("div",{className:"flex items-center gap-2",children:[ra,Ce]}),e[69]=Ce,e[70]=xt);let wt;e[71]!==x||e[72]!==T?(wt=x.length>0&&(0,E.jsx)("div",{className:"flex flex-row gap-1 flex-wrap pr-1",children:x==null?void 0:x.map((de,Ne)=>(0,E.jsx)(Qn,{file:de,onRemove:()=>T(de)},`${de.name}-${Ne}`))}),e[71]=x,e[72]=T,e[73]=wt):wt=e[73];let sa;e[74]===Symbol.for("react.memo_cache_sentinel")?(sa=()=>Fn(g),e[74]=sa):sa=e[74];let kt;e[75]===F?kt=e[76]:(kt=(0,E.jsx)(ei,{handleAddContext:sa,isLoading:F}),e[75]=F,e[76]=kt);let Ct;e[77]!==w||e[78]!==Ae||e[79]!==F?(Ct=Ae&&(0,E.jsx)(ti,{fileInputRef:h,isLoading:F,onAddFiles:w}),e[77]=w,e[78]=Ae,e[79]=F,e[80]=Ct):Ct=e[80];let za=!s.trim(),Et;e[81]!==F||e[82]!==ee||e[83]!==he||e[84]!==za?(Et=(0,E.jsx)(Xn,{isLoading:F,onStop:ee,onSendClick:he,isEmpty:za,showStopLabel:!0}),e[81]=F,e[82]=ee,e[83]=he,e[84]=za,e[85]=Et):Et=e[85];let Tt;e[86]!==wt||e[87]!==kt||e[88]!==Ct||e[89]!==Et?(Tt=(0,E.jsxs)("div",{className:"flex flex-row items-center",children:[wt,kt,Ct,Et]}),e[86]=wt,e[87]=kt,e[88]=Ct,e[89]=Et,e[90]=Tt):Tt=e[90];let na;e[91]!==xt||e[92]!==Tt?(na=(0,E.jsxs)("div",{className:"px-3 pt-1 flex flex-row items-center justify-between",children:[xt,Tt]}),e[91]=xt,e[92]=Tt,e[93]=na):na=e[93];let Ua=na,ia;e[94]===Symbol.for("react.memo_cache_sentinel")?(ia=Wa("flex flex-col w-full py-2"),e[94]=ia):ia=e[94];let oa;return e[95]!==Ua||e[96]!==Fa?(oa=(0,E.jsxs)("div",{className:ia,children:[Fa,Ua]}),e[95]=Ua,e[96]=Fa,e[97]=oa):oa=e[97],oa},ci=t=>{let e=(0,li.c)(35),{value:a,placeholder:r,inputRef:s,className:n,onChange:o,onSubmit:i,onKeyDown:l,onClose:d,onAddFiles:u,additionalCompletions:p,maxHeight:m}=t,f=i,_=d,c=Hr(),{theme:g}=Ao(),h;e[0]===p?h=e[1]:(h=oe=>p?Ju([p.triggerCompletionRegex],p.completions)(oe):null,e[0]=p,e[1]=h);let x=Qr(h),w,T,S,P;if(e[2]!==x||e[3]!==u||e[4]!==c){let oe=Oo();e[9]===Symbol.for("react.memo_cache_sentinel")?(w=fo({}),e[9]=w):w=e[9],T=oe,S=Lc({language:oe.language,store:c,onAddFiles:u}),P=oe.language.data.of({autocomplete:x}),e[2]=x,e[3]=u,e[4]=c,e[5]=w,e[6]=T,e[7]=S,e[8]=P}else w=e[5],T=e[6],S=e[7],P=e[8];let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=Nu({storage:{load:qc,save:Vc}}),e[10]=Z):Z=e[10];let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=Lo(),e[11]=j):j=e[11];let G;e[12]===f?G=e[13]:(G=ds.highest(ha.of([{preventDefault:!0,stopPropagation:!0,any:(oe,te)=>{let Le=te.metaKey||te.ctrlKey||te.shiftKey;if(te.key==="Enter"&&!Le)return f(te,oe.state.doc.toString()),te.preventDefault(),te.stopPropagation(),!0;if(te.key==="Enter"&&te.shiftKey){let Ae=oe.state.selection.main.from;return oe.dispatch({changes:{from:Ae,to:Ae,insert:`
91
+ border-(--red-6) border hover:shadow-xs ${(i===void 0?!1:i)&&"border-none rounded-md"} ${n}`,p=l&&" all",m;e[0]===o?m=e[1]:(m=o&&(0,E.jsx)(Ha,{className:"ml-1 inline",shortcut:o}),e[0]=o,e[1]=m);let f;return e[2]!==a||e[3]!==d||e[4]!==u||e[5]!==p||e[6]!==m?(f=(0,E.jsxs)(Xe,{variant:"text",size:d,onClick:a,className:u,children:["Reject",p,m]}),e[2]=a,e[3]=d,e[4]=u,e[5]=p,e[6]=m,e[7]=f):f=e[7],f};var Zc=class extends br{constructor(t,e){super(t),this.onChunkReceived=e}processResponseStream(t){let e=this.onChunkReceived;return super.processResponseStream(t).pipeThrough(new TransformStream({async transform(a,r){e(a),r.enqueue(a)}}))}},li=Dt(),Fc=Ni("marimo:ai-language","python",Ri),di="marimo:ai-prompt-history",ui=new Ui(Ue(v()),()=>[]);const zc=t=>{var Yr;let e=(0,li.c)(98),{onClose:a}=t,r=Hr(),[s,n]=(0,A.useState)(""),{deleteAllStagedCells:o,clearStagedCells:i,onStream:l,addStagedCell:d}=qn(r),[u,p]=Ci(Fc),m=Qi(),{invokeAiTool:f,sendRun:_}=go(),c=Xr(Qt),g=(0,A.useRef)(null),h=(0,A.useRef)(null),{files:x,addFiles:w,removeFile:T}=Gn(),S=Xr(Gi),{createNewCell:P,prepareForRun:Z}=es(),j;e[0]!==d||e[1]!==P||e[2]!==Z||e[3]!==_||e[4]!==r?(j={store:r,addStagedCell:d,createNewCell:P,prepareForRun:Z,sendRun:_},e[0]=d,e[1]=P,e[2]=Z,e[3]=_,e[4]=r,e[5]=j):j=e[5];let G=j,M;if(e[6]!==u||e[7]!==l||e[8]!==m){let de;e[10]===m?de=e[11]:(de=()=>m.headers(),e[10]=m,e[11]=de);let Ne;e[12]!==u||e[13]!==m?(Ne=async da=>{let bi=await Yn(da.messages),_i={...da,...bi,code:"",prompt:"",language:u};return{api:m.getAiURL("completion").toString(),body:_i}},e[12]=u,e[13]=m,e[14]=Ne):Ne=e[14];let la;e[15]===l?la=e[16]:(la=da=>{l(da)},e[15]=l,e[16]=la),M=new Zc({api:m.getAiURL("completion").toString(),headers:de,prepareSendMessagesRequest:Ne},la),e[6]=u,e[7]=l,e[8]=m,e[9]=M}else M=e[9];let{sendMessage:K,stop:ee,status:ae,addToolOutput:re}=Nn({experimental_throttle:100,transport:M,onToolCall:async de=>{let{toolCall:Ne}=de;await Hn({invokeAiTool:f,addToolOutput:X,toolCall:{toolName:Ne.toolName,toolCallId:Ne.toolCallId,input:Ne.input},toolContext:G})},onError:Uc}),X=re,F=ae==="streaming"||ae==="submitted",oe=c.size>0,te=((Yr=S==null?void 0:S.models)==null?void 0:Yr.edit_model)||"openai/gpt-4o",Le;if(e[17]!==te){let de=Ki.parse(te).providerId;Le=Jn.has(de),e[17]=te,e[18]=Le}else Le=e[18];let Ae=Le,ke;e[19]!==o||e[20]!==x||e[21]!==s||e[22]!==F||e[23]!==K?(ke=async()=>{var de;F||((de=g.current)!=null&&de.view&&Mn(g.current.view),o(),K({text:s,files:x?await Kn(x):void 0}))},e[19]=o,e[20]=x,e[21]=s,e[22]=F,e[23]=K,e[24]=ke):ke=e[24];let he=ke,De;e[25]===Symbol.for("react.memo_cache_sentinel")?(De=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)($o,{className:"size-4 mr-2"}),"Python"]}),e[25]=De):De=e[25];let vt=De,Ze;e[26]===Symbol.for("react.memo_cache_sentinel")?(Ze=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(qi,{className:"size-4 mr-2"}),"SQL"]}),e[26]=Ze):Ze=e[26];let Lt=Ze,bt=u==="python"?vt:Lt,_t;e[27]===Symbol.for("react.memo_cache_sentinel")?(_t=(0,E.jsx)(_o,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),e[27]=_t):_t=e[27];let Ke;e[28]===bt?Ke=e[29]:(Ke=(0,E.jsxs)(ao,{className:"flex items-center justify-between h-7 text-xs px-2 py-0.5 border rounded-md hover:text-accent-foreground","data-testid":"language-button",children:[bt,_t]}),e[28]=bt,e[29]=Ke);let Re,ot;e[30]===Symbol.for("react.memo_cache_sentinel")?(Re=(0,E.jsx)("div",{className:"px-2 py-1 text-sm text-muted-foreground",children:"Select language"}),ot=(0,E.jsx)(to,{}),e[30]=Re,e[31]=ot):(Re=e[30],ot=e[31]);let V;e[32]===p?V=e[33]:(V=(0,E.jsx)(ls,{onClick:()=>p("python"),children:vt}),e[32]=p,e[33]=V);let W;e[34]===p?W=e[35]:(W=(0,E.jsx)(ls,{onClick:()=>p("sql"),children:Lt}),e[34]=p,e[35]=W);let Q;e[36]!==V||e[37]!==W?(Q=(0,E.jsxs)(ro,{align:"center",children:[Re,ot,V,W]}),e[36]=V,e[37]=W,e[38]=Q):Q=e[38];let B;e[39]!==Ke||e[40]!==Q?(B=(0,E.jsxs)(so,{modal:!1,children:[Ke,Q]}),e[39]=Ke,e[40]=Q,e[41]=B):B=e[41];let Ce=B,be;e[42]!==i||e[43]!==a?(be=()=>{i(),a()},e[42]=i,e[43]=a,e[44]=be):be=e[44];let le=be,ne;e[45]===o?ne=e[46]:(ne=()=>{o()},e[45]=o,e[46]=ne);let _e=ne,lt;e[47]===Symbol.for("react.memo_cache_sentinel")?(lt=(0,E.jsx)(To,{className:"size-4 text-(--blue-11) mr-2"}),e[47]=lt):lt=e[47];let Fe;e[48]!==o||e[49]!==a?(Fe=()=>{o(),a()},e[48]=o,e[49]=a,e[50]=Fe):Fe=e[50];let dt;e[51]===Symbol.for("react.memo_cache_sentinel")?(dt=de=>{n(de)},e[51]=dt):dt=e[51];let ie;e[52]!==le||e[53]!==_e||e[54]!==oe||e[55]!==F?(ie=ni({handleAcceptCompletion:le,handleDeclineCompletion:_e,isLoading:F,hasCompletion:oe}),e[52]=le,e[53]=_e,e[54]=oe,e[55]=F,e[56]=ie):ie=e[56];let ce;e[57]!==s||e[58]!==he||e[59]!==Fe||e[60]!==ie?(ce=(0,E.jsx)(ci,{inputRef:g,onClose:Fe,value:s,onChange:dt,onSubmit:he,onKeyDown:ie}),e[57]=s,e[58]=he,e[59]=Fe,e[60]=ie,e[61]=ce):ce=e[61];let Ye;e[62]===Symbol.for("react.memo_cache_sentinel")?(Ye=(0,E.jsx)(ms,{className:"size-4"}),e[62]=Ye):Ye=e[62];let He;e[63]===a?He=e[64]:(He=(0,E.jsx)(Xe,{variant:"text",size:"sm",className:"mb-0 px-1",onClick:a,children:Ye}),e[63]=a,e[64]=He);let Ge;e[65]!==ce||e[66]!==He?(Ge=(0,E.jsxs)("div",{className:"flex items-center px-3",children:[lt,ce,He]}),e[65]=ce,e[66]=He,e[67]=Ge):Ge=e[67];let Fa=Ge,ra;e[68]===Symbol.for("react.memo_cache_sentinel")?(ra=(0,E.jsx)(Yi,{triggerClassName:"h-7 text-xs max-w-64",iconSize:"small",forRole:"edit",showAddCustomModelDocs:!0}),e[68]=ra):ra=e[68];let xt;e[69]===Ce?xt=e[70]:(xt=(0,E.jsxs)("div",{className:"flex items-center gap-2",children:[ra,Ce]}),e[69]=Ce,e[70]=xt);let wt;e[71]!==x||e[72]!==T?(wt=x.length>0&&(0,E.jsx)("div",{className:"flex flex-row gap-1 flex-wrap pr-1",children:x==null?void 0:x.map((de,Ne)=>(0,E.jsx)(Qn,{file:de,onRemove:()=>T(de)},`${de.name}-${Ne}`))}),e[71]=x,e[72]=T,e[73]=wt):wt=e[73];let sa;e[74]===Symbol.for("react.memo_cache_sentinel")?(sa=()=>Fn(g),e[74]=sa):sa=e[74];let kt;e[75]===F?kt=e[76]:(kt=(0,E.jsx)(ei,{handleAddContext:sa,isLoading:F}),e[75]=F,e[76]=kt);let Ct;e[77]!==w||e[78]!==Ae||e[79]!==F?(Ct=Ae&&(0,E.jsx)(ti,{fileInputRef:h,isLoading:F,onAddFiles:w}),e[77]=w,e[78]=Ae,e[79]=F,e[80]=Ct):Ct=e[80];let za=!s.trim(),Et;e[81]!==F||e[82]!==ee||e[83]!==he||e[84]!==za?(Et=(0,E.jsx)(Xn,{isLoading:F,onStop:ee,onSendClick:he,isEmpty:za,showStopLabel:!0}),e[81]=F,e[82]=ee,e[83]=he,e[84]=za,e[85]=Et):Et=e[85];let Tt;e[86]!==wt||e[87]!==kt||e[88]!==Ct||e[89]!==Et?(Tt=(0,E.jsxs)("div",{className:"flex flex-row items-center",children:[wt,kt,Ct,Et]}),e[86]=wt,e[87]=kt,e[88]=Ct,e[89]=Et,e[90]=Tt):Tt=e[90];let na;e[91]!==xt||e[92]!==Tt?(na=(0,E.jsxs)("div",{className:"px-3 pt-1 flex flex-row items-center justify-between",children:[xt,Tt]}),e[91]=xt,e[92]=Tt,e[93]=na):na=e[93];let Ua=na,ia;e[94]===Symbol.for("react.memo_cache_sentinel")?(ia=Wa("flex flex-col w-full py-2"),e[94]=ia):ia=e[94];let oa;return e[95]!==Ua||e[96]!==Fa?(oa=(0,E.jsxs)("div",{className:ia,children:[Fa,Ua]}),e[95]=Ua,e[96]=Fa,e[97]=oa):oa=e[97],oa},ci=t=>{let e=(0,li.c)(35),{value:a,placeholder:r,inputRef:s,className:n,onChange:o,onSubmit:i,onKeyDown:l,onClose:d,onAddFiles:u,additionalCompletions:p,maxHeight:m}=t,f=i,_=d,c=Hr(),{theme:g}=Ao(),h;e[0]===p?h=e[1]:(h=oe=>p?Ju([p.triggerCompletionRegex],p.completions)(oe):null,e[0]=p,e[1]=h);let x=Qr(h),w,T,S,P;if(e[2]!==x||e[3]!==u||e[4]!==c){let oe=Oo();e[9]===Symbol.for("react.memo_cache_sentinel")?(w=fo({}),e[9]=w):w=e[9],T=oe,S=Lc({language:oe.language,store:c,onAddFiles:u}),P=oe.language.data.of({autocomplete:x}),e[2]=x,e[3]=u,e[4]=c,e[5]=w,e[6]=T,e[7]=S,e[8]=P}else w=e[5],T=e[6],S=e[7],P=e[8];let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=Nu({storage:{load:qc,save:Vc}}),e[10]=Z):Z=e[10];let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=Lo(),e[11]=j):j=e[11];let G;e[12]===f?G=e[13]:(G=ds.highest(ha.of([{preventDefault:!0,stopPropagation:!0,any:(oe,te)=>{let Le=te.metaKey||te.ctrlKey||te.shiftKey;if(te.key==="Enter"&&!Le)return f(te,oe.state.doc.toString()),te.preventDefault(),te.stopPropagation(),!0;if(te.key==="Enter"&&te.shiftKey){let Ae=oe.state.selection.main.from;return oe.dispatch({changes:{from:Ae,to:Ae,insert:`
92
92
  `},selection:{anchor:Ae+1,head:Ae+1}}),te.preventDefault(),te.stopPropagation(),!0}return!1}}])),e[12]=f,e[13]=G);let M;e[14]===_?M=e[15]:(M=ha.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(_(),!0)}]),e[14]=_,e[15]=M);let K;e[16]!==w||e[17]!==T||e[18]!==S||e[19]!==P||e[20]!==G||e[21]!==M?(K=[w,T,S,P,Z,us.lineWrapping,j,G,M],e[16]=w,e[17]=T,e[18]=S,e[19]=P,e[20]=G,e[21]=M,e[22]=K):K=e[22];let ee=K,ae;e[23]===n?ae=e[24]:(ae=Wa("flex-1 font-sans overflow-auto my-1",n),e[23]=n,e[24]=ae);let re=g==="dark"?"dark":"light",X=r||"Generate with AI, @ to include context",F;return e[25]!==ee||e[26]!==s||e[27]!==m||e[28]!==o||e[29]!==l||e[30]!==ae||e[31]!==re||e[32]!==X||e[33]!==a?(F=(0,E.jsx)(Do,{ref:s,className:ae,width:"100%",maxHeight:m,value:a,basicSetup:!1,extensions:ee,onChange:o,onKeyDown:l,theme:re,placeholder:X}),e[25]=ee,e[26]=s,e[27]=m,e[28]=o,e[29]=l,e[30]=ae,e[31]=re,e[32]=X,e[33]=a,e[34]=F):F=e[34],F};function Uc(t){Ka({title:"Generate with AI failed",description:No(t)})}function qc(){return ui.get(di)}function Vc(t){return ui.set(di,t)}export{Iu as A,qn as C,yt as D,Vu as E,gs as F,zd as M,vs as N,Mn as O,ys as P,Un as S,Fn as T,fc as _,oi as a,Fr as b,ti as c,Xn as d,Jn as f,Hn as g,pc as h,Dc as i,br as j,Nn as k,yc as l,Kn as m,ci as n,ni as o,Yn as p,ii as r,ei as s,zc as t,Qn as u,mc as v,qu as w,Qt as x,Gn as y};