@marimo-team/islands 0.25.3-dev34 → 0.25.3-dev348

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 (1055) hide show
  1. package/dist/{ConnectedDataExplorerComponent-7EaP9VWb.js → ConnectedDataExplorerComponent-xliyyXNO.js} +188 -212
  2. package/dist/{ErrorBoundary-CkPa08Bb.js → ErrorBoundary-CIimOpqs.js} +79 -85
  3. package/dist/{ImageComparisonComponent-uU8FSKZE.js → ImageComparisonComponent-CoiwlCwG.js} +20 -20
  4. package/dist/{Plot-DdYOe1UK.js → Plot-BHJLG4xm.js} +2474 -3107
  5. package/dist/_baseSet-Bd5zh2yg.js +327 -0
  6. package/dist/{abnfDiagram-VCTEODGH-z_OSynK8.js → abnfDiagram-VCTEODGH-Dl9Nrtbf.js} +5 -5
  7. package/dist/any-language-editor-CBHhdCC0.js +75 -0
  8. package/dist/{apl-GEW9-ZP1.js → apl-stFrI2NB.js} +1 -1
  9. package/dist/{arc-7ra3iNdN.js → arc-4W6H62B5.js} +1 -1
  10. package/dist/architecture-7GRP2DOG-GlkXha5_.js +2 -0
  11. package/dist/{architectureDiagram-5GKGNRK7-Cs8J8BZr.js → architectureDiagram-5GKGNRK7-DTg032fQ.js} +48 -64
  12. package/dist/{arrays-CN1djC4k.js → arrays-DoQ-AILx.js} +15 -27
  13. package/dist/{asciiarmor-BWNxzkG7.js → asciiarmor-DHwFuaIC.js} +1 -1
  14. package/dist/{asn1-Bcn2QutK.js → asn1-KIH4fwAq.js} +1 -1
  15. package/dist/assertNever-ie77PjMn.js +507 -0
  16. package/dist/assets/__vite-browser-external-Ci3vRqC9.js +1 -0
  17. package/dist/assets/worker-D9NGcZWK.js +171 -0
  18. package/dist/{blockDiagram-I7D4REHJ-Cg25UrxT.js → blockDiagram-I7D4REHJ-BoCyD5KO.js} +28 -39
  19. package/dist/{brainfuck-BQCYDheZ.js → brainfuck-UPAij4U9.js} +1 -1
  20. package/dist/{button-CvjkwdSk.js → button-qQhINE7z.js} +64 -64
  21. package/dist/{c4Diagram-7LVT6UL2-BxFgrnNV.js → c4Diagram-7LVT6UL2-DmcTtm4p.js} +8 -8
  22. package/dist/{capabilities-CQ5IjhzL.js → capabilities-DKqMqBzm.js} +2 -2
  23. package/dist/{channel-CPObtJXj.js → channel-B9eaiezW.js} +1 -1
  24. package/dist/{chat-ui-BeKQyQQI.js → chat-ui-BV0qyfru.js} +2551 -2390
  25. package/dist/{check-BMKBBrdc.js → check-DTIv5ZZ3.js} +1 -1
  26. package/dist/{chunk-4HAMMTFA-D4eFPyFh.js → chunk-4HAMMTFA-qKgadZwy.js} +6 -6
  27. package/dist/{chunk-75Z2AOVW-D7gxIs2Q.js → chunk-75Z2AOVW-76L6My3P.js} +4 -4
  28. package/dist/{chunk-YOKDWASO-DKplTrBY.js → chunk-7TTQLYRW-DBSfUUe5.js} +6253 -5835
  29. package/dist/{chunk-DU6HZSFF-BwiyaNpg.js → chunk-DU6HZSFF-4SDIhUTY.js} +14 -22
  30. package/dist/{chunk-F27PBJKO-ufseIn5y.js → chunk-F27PBJKO-COH2t-FO.js} +3 -3
  31. package/dist/{chunk-FOHPRMQF-BpYR8RqP.js → chunk-FOHPRMQF-ezmr_yWy.js} +49 -58
  32. package/dist/{chunk-GMAD6QVW-BhaJx0X3.js → chunk-GMAD6QVW-BJGF8QZL.js} +16 -75
  33. package/dist/{chunk-GVQU2GXP-Cwbt-lF0.js → chunk-GVQU2GXP-BkolpSXU.js} +3 -3
  34. package/dist/{chunk-IMKFNOWR-aoSFasqF.js → chunk-IMKFNOWR-CsFB-2LW.js} +8 -8
  35. package/dist/{chunk-L3NEJ4N5-n-zgIVSy.js → chunk-L3NEJ4N5-B-BFQp9t.js} +6 -6
  36. package/dist/{chunk-OSK3NFVY-DXa-Cxbn.js → chunk-OSK3NFVY-BzfZ4VBG.js} +8 -8
  37. package/dist/{chunk-P2QGCYS3-B_Zd3-X0.js → chunk-P2QGCYS3-DJApLVdt.js} +1 -1
  38. package/dist/{chunk-POPQ4Y6H-hYOXbYH_.js → chunk-POPQ4Y6H-BFSZel4w.js} +2 -2
  39. package/dist/{chunk-PWAF6VOD-CQw5qATZ.js → chunk-PWAF6VOD-CRu_RGP2.js} +2 -2
  40. package/dist/{chunk-SHT3W25Y-CMaybO3O.js → chunk-SHT3W25Y-ByuJHeBL.js} +10 -10
  41. package/dist/{chunk-SVP7TREG-BNBrTAw1.js → chunk-SVP7TREG-9oBZhbrr.js} +3 -3
  42. package/dist/{chunk-TICWLB2K-DXNxvUJn.js → chunk-TICWLB2K-Bx4m0cJ1.js} +10 -10
  43. package/dist/{chunk-XXDRQBXY-Dnl5VBqG.js → chunk-XXDRQBXY-BM-YIt-_.js} +1 -1
  44. package/dist/classDiagram-ZZMXUADV-Cms37-C9.js +30 -0
  45. package/dist/classDiagram-v2-VYDZK3BY-qAom4Bi7.js +30 -0
  46. package/dist/{clike-CxK9W55Z.js → clike-xU8sCVU1.js} +2 -6
  47. package/dist/{clojure-Dzcvwpxk.js → clojure-psoSEo36.js} +1 -1
  48. package/dist/{cmake-DYr-71zp.js → cmake-DDHBwlE7.js} +1 -1
  49. package/dist/{cobol-DC3g37Kq.js → cobol-C4qjDcIq.js} +1 -1
  50. package/dist/code-visibility-_-8-dvb4.js +130 -0
  51. package/dist/{coffeescript-C-eFwH5N.js → coffeescript-D6UgrGgo.js} +1 -1
  52. package/dist/{common-DCeV59yz.js → common-CNXuhphD.js} +11323 -10613
  53. package/dist/{commonlisp-CyaNXrJR.js → commonlisp-B0ChVjnu.js} +1 -1
  54. package/dist/{compiler-runtime-CldRdSsv.js → compiler-runtime-C5KHtL5D.js} +3 -3
  55. package/dist/config-CvBnR945.js +618 -0
  56. package/dist/{copy-icon-BgUO8jsi.js → copy-icon-DmtNidSa.js} +21 -22
  57. package/dist/{cose-bilkent-JH36ORCC-_LyRKVqm.js → cose-bilkent-JH36ORCC-B_Oz4vMP.js} +58 -71
  58. package/dist/createReducer-BxBCTvKn.js +67 -0
  59. package/dist/{crystal-ih5ax5tQ.js → crystal-DZsc9Ue0.js} +1 -1
  60. package/dist/{css-CN_wP7_R.js → css-DkYRnQ9U.js} +1 -1
  61. package/dist/{cubic-OaEBhQPK.js → cubic-CA80xY_e.js} +6 -7
  62. package/dist/cynefin-OW5HDTMX-0-HehVvH.js +2 -0
  63. package/dist/{cynefinDiagram-5FMLGOSQ-DWHuKJs8.js → cynefinDiagram-5FMLGOSQ-BjJZwMEz.js} +5 -5
  64. package/dist/{cypher-CqGRcmZo.js → cypher-CpWPqgvy.js} +1 -1
  65. package/dist/{cytoscape.esm-jJhXJpLB.js → cytoscape.esm-BbeMznK5.js} +411 -512
  66. package/dist/{d-Cj0sOW2z.js → d-Bx2ggfYO.js} +1 -1
  67. package/dist/{dagre-BGSfXNEb.js → dagre-CpjuekF1.js} +550 -700
  68. package/dist/{dagre-GXQ25YYZ-DYLu-OCU.js → dagre-GXQ25YYZ-Bohu7_09.js} +14 -16
  69. package/dist/{data-grid-overlay-editor-DOGpF5cl.js → data-grid-overlay-editor--4Gk_rwA.js} +8 -8
  70. package/dist/{data-grid-types-0PJ-9N5n.js → data-grid-types-DIX_pCco.js} +2 -2
  71. package/dist/{debounce-C3jyATpc.js → debounce-DrhhziJv.js} +2 -2
  72. package/dist/{diagram-S7CK7UJ4-PwwcUOHP.js → diagram-S7CK7UJ4-Chl0n835.js} +7 -15
  73. package/dist/{diagram-UQ7AKVKN-CvJbL_IM.js → diagram-UQ7AKVKN-DHx8nzy7.js} +5 -5
  74. package/dist/{diagram-VSXAHHWV-BJWcVVJY.js → diagram-VSXAHHWV-LXjisZoM.js} +6 -6
  75. package/dist/{diagram-VX7I27RA-B5RkqnzN.js → diagram-VX7I27RA-CKdpv1U4.js} +7 -7
  76. package/dist/{diagram-Z3DM3KII-CyijwTR2.js → diagram-Z3DM3KII-sY-sI--2.js} +5 -5
  77. package/dist/{dialog-Cc479ZEH.js → dialog-Cqu5Hp5U.js} +32 -32
  78. package/dist/{diff-B_hUkiat.js → diff-DNXaJS8v.js} +1 -1
  79. package/dist/{dist-D6d86eNJ.js → dist-B-Id1kt3.js} +48 -47
  80. package/dist/{dist-DiDibOYr.js → dist-BDw9g6PC.js} +152 -151
  81. package/dist/{dist-diIx5qJW.js → dist-B_EswY8r.js} +33 -32
  82. package/dist/{dist-DoE4XJBC.js → dist-B_xgcU0N.js} +9800 -10654
  83. package/dist/{dist-CLdpGQVr.js → dist-BcGGwW1q.js} +119 -121
  84. package/dist/dist-BdZQUzPS.js +850 -0
  85. package/dist/{dist-CN_BeG2I.js → dist-Bj8s59mu.js} +59 -58
  86. package/dist/{dist-CkTTIdBe.js → dist-C3dYgyiI.js} +337 -337
  87. package/dist/{dist-PXYI_yuP.js → dist-C6ttp2Iy.js} +24 -23
  88. package/dist/{dist-DUAh96QY.js → dist-CB9MzCXv.js} +1 -1
  89. package/dist/{dist-CSbh1PNP.js → dist-CCYz0qJ2.js} +24 -23
  90. package/dist/{dist-BMQf5zIS.js → dist-CDjivQ67.js} +124 -123
  91. package/dist/{dist-D-wwqlzJ.js → dist-CNT4u03u.js} +159 -158
  92. package/dist/{dist-Lm-D-Vr6.js → dist-CiSkXlAO.js} +3 -3
  93. package/dist/{dist-F8Ep36rk.js → dist-DVVzH9mP.js} +60 -59
  94. package/dist/{dist-OR1OnN-y.js → dist-DlniJvh2.js} +32 -31
  95. package/dist/{dist-CSJ0MDRw.js → dist-Dq-hanx8.js} +57 -56
  96. package/dist/{dist-C8fAKSH1.js → dist-FakvNY2e.js} +54 -53
  97. package/dist/{dist-BuaRHxOc.js → dist-K-qmZv0f.js} +45 -44
  98. package/dist/{dist-Cg7gzw-a.js → dist-NPImE_g9.js} +79 -78
  99. package/dist/{dist-CN8zI-XC.js → dist-PKX4HaX5.js} +239 -239
  100. package/dist/{dist-CrSP_H1M.js → dist-U4WlxEDL.js} +243 -243
  101. package/dist/{dist-BK4Oj99o.js → dist-UKKHsqHo.js} +19 -18
  102. package/dist/{dist-Bvs24R_E.js → dist-VRN9rDqa.js} +32 -31
  103. package/dist/{dist-BorMD-uX.js → dist-f1h5p-fp.js} +76 -75
  104. package/dist/{dist-BLfKmR-l.js → dist-h8Te4SvD.js} +17 -16
  105. package/dist/{dist-DBtSl3sf.js → dist-ymIUQ4tH.js} +48 -50
  106. package/dist/dropdown-menu-DXEYk99S.js +5982 -0
  107. package/dist/{dtd-B8FGSWWe.js → dtd-D1YZQCVT.js} +1 -1
  108. package/dist/{dylan-DbIBYIrw.js → dylan-CxbG-PUm.js} +2 -2
  109. package/dist/{ebnfDiagram-PWID7BFC-DG90ELFp.js → ebnfDiagram-PWID7BFC-CD0P2xeH.js} +5 -5
  110. package/dist/{ecl-DBmkdWAd.js → ecl-DIXH6vul.js} +1 -1
  111. package/dist/{eiffel-CcWSDDzK.js → eiffel-D0de-eQr.js} +1 -1
  112. package/dist/{elm-MC-b8a6C.js → elm-DrQrn4VD.js} +1 -1
  113. package/dist/{erDiagram-RLTQ6QDP-FMo_SpyX.js → erDiagram-RLTQ6QDP-BaKQuYxC.js} +14 -14
  114. package/dist/{erlang-AdO1-xtV.js → erlang-2KpKpfC7.js} +1 -1
  115. package/dist/{error-banner-CFPHFw4h.js → error-banner-DUB_qUeL.js} +140 -140
  116. package/dist/error-entries-CTb_cxXY.js +2651 -0
  117. package/dist/{esm-G4Fhsgng.js → esm-DQtHTnHn.js} +640 -660
  118. package/dist/{esm-AMFssoNp.js → esm-Dc_RPXvZ.js} +335 -335
  119. package/dist/{esm-D2gTsXEV.js → esm-wKplZtOX.js} +580 -581
  120. package/dist/eventmodeling-NTZA5JFV-DoBvB4Lj.js +2 -0
  121. package/dist/{factor-Ys-13HOP.js → factor-Bwu3ZGOk.js} +1 -1
  122. package/dist/{feedback-button-HmgYHka9.js → feedback-button-BaA4r2dl.js} +105 -114
  123. package/dist/flowDiagram-HODETNUW-BcCpHh7-.js +15 -0
  124. package/dist/{formats-DRHUWwSK.js → formats-hF6fETr6.js} +9 -9
  125. package/dist/{forth-DiMuIXFe.js → forth-DYatDpr6.js} +2 -3
  126. package/dist/{fortran-hkrF2eM4.js → fortran-n8mcQPkL.js} +1 -1
  127. package/dist/{ganttDiagram-EL5Y4UJY-Dh_4cBJZ.js → ganttDiagram-EL5Y4UJY-YzTghq1V.js} +17 -17
  128. package/dist/{gas-DlhqN9k8.js → gas-BUZOHBVw.js} +1 -1
  129. package/dist/{gherkin-0SlhEZ3t.js → gherkin-CrSjX26K.js} +1 -1
  130. package/dist/gitGraph-4MIJSDKK-Ch7kj-d2.js +2 -0
  131. package/dist/{gitGraphDiagram-WWUBYQGX-D5nSIzdE.js → gitGraphDiagram-WWUBYQGX-CK66dT35.js} +4 -4
  132. package/dist/{glide-data-editor-ChLxq3bk.js → glide-data-editor-CRn3KXyR.js} +6732 -2978
  133. package/dist/{glide-utils-pisbYVjH.js → glide-utils-Bnd_k48H.js} +109 -78
  134. package/dist/{globals-CP_-MiOh.js → globals-_FmD97Ui.js} +3 -3
  135. package/dist/{graphlib-BmY_CCV9.js → graphlib-nlwT3Wvy.js} +177 -220
  136. package/dist/{groovy-YhcTMyvX.js → groovy-IgGNjeU9.js} +1 -1
  137. package/dist/hasIn-C20JsQ2m.js +28 -0
  138. package/dist/{haskell-CodLxrtT.js → haskell-Bs1k3a9s.js} +1 -1
  139. package/dist/{haxe-CiRWNFkH.js → haxe-CQ8Yb3XF.js} +1 -1
  140. package/dist/highlighted-body-JLMTFACH-yt0ZZn80.js +42 -0
  141. package/dist/{error-entries-CnqKxhU9.js → html-to-image-Bbl0PeC7.js} +26184 -26482
  142. package/dist/{idl-DZgBq75I.js → idl-DjnxoAWx.js} +1 -1
  143. package/dist/info-A6RAGUB7-DCz_Egh9.js +2 -0
  144. package/dist/{infoDiagram-27XIBGKW-CRSDtRrd.js → infoDiagram-27XIBGKW-DWltseIa.js} +4 -4
  145. package/dist/isArrayLikeObject-B-HXCsex.js +626 -0
  146. package/dist/isEmpty-CdX7MTE1.js +14 -0
  147. package/dist/{ishikawaDiagram-5VMMS53U-DxLEUldB.js → ishikawaDiagram-5VMMS53U-DHgepBPo.js} +5 -7
  148. package/dist/{javascript-BfNytHiM.js → javascript-BQtCoAFy.js} +2 -2
  149. package/dist/{journeyDiagram-3NMN7TZE-BaLqn-dZ.js → journeyDiagram-3NMN7TZE-CYXsL3IE.js} +4 -4
  150. package/dist/{jsx-runtime-3BD1kT0s.js → jsx-runtime-D8btoEHk.js} +2 -2
  151. package/dist/{julia--tLIAG7q.js → julia-BfgtHJE5.js} +1 -1
  152. package/dist/{kanban-definition-UXKFOSKX-BLhvu8o4.js → kanban-definition-UXKFOSKX-B2_BIjBq.js} +10 -10
  153. package/dist/{katex-BIdZGsyO.js → katex-wAapZGrX.js} +793 -724
  154. package/dist/linear-TJTTbHM9.js +203 -0
  155. package/dist/{livescript-CVPfYnY_.js → livescript-gIdRPKtg.js} +1 -1
  156. package/dist/{loader-BPdQhmlq.js → loader-Bin_dutt.js} +13 -13
  157. package/dist/{lua-4Fa-T-qq.js → lua-CxFpWvnv.js} +2 -2
  158. package/dist/main.js +10930 -8473
  159. package/dist/{mathematica-CtYAy6GG.js → mathematica-QSveeEoW.js} +1 -1
  160. package/dist/{mbox-D0w9Ah1C.js → mbox-2JtaCPNT.js} +1 -1
  161. package/dist/{mermaid-Bjm6C1qN.js → mermaid--2K0cmt9.js} +170 -176
  162. package/dist/mermaid-WFAXDIZX-DHB2z13u.js +1 -0
  163. package/dist/{mermaid-parser.core-DxuSfYwJ.js → mermaid-parser.core-DtOnl7m4.js} +19 -25
  164. package/dist/{mhchem-CdWPJK6g.js → mhchem-CX8M7Ktl.js} +1 -1
  165. package/dist/{micromark-factory-space-DGxAzmw8.js → micromark-factory-space-C5soVmaM.js} +1 -1
  166. package/dist/{mindmap-definition-YA3MSWOX-g2LwxnYQ.js → mindmap-definition-YA3MSWOX-DNebycIP.js} +13 -13
  167. package/dist/{mirc-De9aSAZM.js → mirc-BqD6ade4.js} +1 -1
  168. package/dist/{mllike-BbugeaY_.js → mllike-CT0hgEOO.js} +1 -1
  169. package/dist/{modelica-BjJwWw1F.js → modelica-DKKebcvq.js} +1 -1
  170. package/dist/{mscgen-DwiRH5ma.js → mscgen-BJCCsWjR.js} +1 -1
  171. package/dist/{mumps--plbDM9o.js → mumps-DVQAXZkU.js} +1 -1
  172. package/dist/{nginx-C4Df7REc.js → nginx-AP4LH2NN.js} +1 -1
  173. package/dist/{node-sql-parser-BiZOJ-FS.js → node-sql-parser-C9dndbfr.js} +7184 -7195
  174. package/dist/{now-jM8-M7IR.js → now-BKZCLE5P.js} +12 -13
  175. package/dist/{nsis-fiiOqLc3.js → nsis-Cah9xkdT.js} +1 -1
  176. package/dist/{ntriples-jV77I4k8.js → ntriples-CQoaLOV6.js} +2 -2
  177. package/dist/{number-overlay-editor-CCm8xv1J.js → number-overlay-editor-Bcg25qrp.js} +17 -22
  178. package/dist/{objects-CzUgoMIF.js → objects-DCmMvZtn.js} +1 -3
  179. package/dist/{octave-Cztd01tF.js → octave-CeDj2bTn.js} +1 -1
  180. package/dist/{once-BtE-wKRL.js → once-NnpX_HnX.js} +1 -1
  181. package/dist/{oz-Bl8o3BDl.js → oz-BksQrg3k.js} +1 -1
  182. package/dist/packet-AYTQ26CC-DEMHgLPq.js +2 -0
  183. package/dist/{pascal-BO5JqysR.js → pascal-BKL17mpl.js} +1 -1
  184. package/dist/{pegDiagram-XKGWAZYB-CpMAt3Qs.js → pegDiagram-XKGWAZYB-CH4U3II-.js} +5 -5
  185. package/dist/pencil-MMnw1YQh.js +10 -0
  186. package/dist/{perl-Drlh9s6m.js → perl-CacqJ-Ss.js} +1 -1
  187. package/dist/pick-DgpAbcwP.js +35 -0
  188. package/dist/pie-WAS4IAKB-DMjTEeHd.js +2 -0
  189. package/dist/{pieDiagram-E7YTZNPT-CVTthoZo.js → pieDiagram-E7YTZNPT-pfcrdUCa.js} +7 -7
  190. package/dist/{pig-BWGR8wZw.js → pig-CXSGZ_K9.js} +1 -1
  191. package/dist/{powershell-DT99xlz_.js → powershell-DY_yIxBM.js} +3 -6
  192. package/dist/precisionRound-DMIVQrt2.js +97 -0
  193. package/dist/{process-output-DgQrilBD.js → process-output-Dw_sI4Xp.js} +6 -6
  194. package/dist/{properties-Q-rkxld0.js → properties-Om0IDE07.js} +1 -1
  195. package/dist/{protobuf-DKyWZbs7.js → protobuf-B8nxxb4Q.js} +1 -1
  196. package/dist/{pug-42ZJUbEC.js → pug-lkUBPvVS.js} +3 -7
  197. package/dist/{puppet-B4UozHhh.js → puppet-DMkXsi4d.js} +1 -1
  198. package/dist/purify.es-DmnrIjg4.js +877 -0
  199. package/dist/{python-DREjAV__.js → python-JQVycMgr.js} +1 -1
  200. package/dist/{q-Bi63IpBO.js → q-DqE__nNB.js} +1 -1
  201. package/dist/{quadrantDiagram-AXDQQJYC-Blrm7V7_.js → quadrantDiagram-AXDQQJYC-nGFBFig7.js} +3 -3
  202. package/dist/{r-DSwXWKMR.js → r-Cbliap7Q.js} +1 -1
  203. package/dist/radar-RG4KPBEZ-9PwdCvai.js +2 -0
  204. package/dist/railroad-74A4TZTK-8N9kF5jl.js +2 -0
  205. package/dist/railroad-abnf-HS5TGJTU-Sg6YmzlR.js +2 -0
  206. package/dist/railroad-ebnf-LZEXJU2U-CYwp2Oee.js +2 -0
  207. package/dist/railroad-peg-WCYAUIDC-BfDkAuQ3.js +2 -0
  208. package/dist/{railroadDiagram-O6MQD6OU-ao8cqqFB.js → railroadDiagram-O6MQD6OU-BZKpAbNG.js} +5 -5
  209. package/dist/{react-sHtZdjeP.js → react-Bgs_wQh3.js} +3 -3
  210. package/dist/{react-dom-DUmH0GXv.js → react-dom-DdqGVp5N.js} +5 -5
  211. package/dist/{react-vega-BDpbvBCb.js → react-vega-CGgQEf0O.js} +13800 -17236
  212. package/dist/{requirementDiagram-BXWQKSXE--J8vyfm-.js → requirementDiagram-BXWQKSXE-DnyfIHe3.js} +13 -13
  213. package/dist/{reveal-component-C3tSBdGZ.js → reveal-component-BVC491am.js} +1172 -1285
  214. package/dist/{rolldown-runtime-Cb76FRpK.js → rolldown-runtime-BPCzCO3I.js} +1 -1
  215. package/dist/{rpm-DPb1DeKM.js → rpm-DmT_LNpE.js} +1 -1
  216. package/dist/{ruby-U7fZA4DP.js → ruby-BHVZTtLW.js} +1 -1
  217. package/dist/{sankeyDiagram-P5KCCOFB-ELvOcnZH.js → sankeyDiagram-P5KCCOFB-CrOfyc2n.js} +2 -2
  218. package/dist/{sas-CLk1JpTn.js → sas-CrG5N1he.js} +1 -1
  219. package/dist/{scheme-CT-2k2Tl.js → scheme-BHUnz-IB.js} +1 -1
  220. package/dist/select-suaAxFuo.js +1200 -0
  221. package/dist/{semaphore-89jsoHtS.js → semaphore-8KhQouXt.js} +4 -5
  222. package/dist/{sequenceDiagram-WJ2MYXX4-CiQbn62x.js → sequenceDiagram-WJ2MYXX4-BeYuWX7N.js} +6 -6
  223. package/dist/{shell-BLO7fcsk.js → shell-C5IBmRU5.js} +1 -1
  224. package/dist/{sieve-nG3C7WNH.js → sieve-BzCnt_E6.js} +2 -2
  225. package/dist/{sizeCapture-INFHLROL-Dx5SpkQF.js → sizeCapture-INFHLROL-DBeZ20mI.js} +1 -1
  226. package/dist/{smalltalk-BROcZybA.js → smalltalk-DQFAQul3.js} +1 -1
  227. package/dist/{solr-mVltHNc5.js → solr-BiapYPCk.js} +1 -1
  228. package/dist/{sparql-Cv1Ksr4v.js → sparql-BcUKO1is.js} +1 -1
  229. package/dist/{spec-D_u2ipzF.js → spec-BQNx2-D7.js} +42 -12
  230. package/dist/{src-CA_m4ONl.js → src-D5uZaZib.js} +8 -14
  231. package/dist/{stateDiagram-D77RDMKH-DVEeGs5b.js → stateDiagram-D77RDMKH-B8FxwAM2.js} +18 -18
  232. package/dist/stateDiagram-v2-MP3YSRHH-CzWLBqm1.js +30 -0
  233. package/dist/static-state-Al_hmf1n.js +68 -0
  234. package/dist/{stex-Btf3omL8.js → stex-CQ_aCGTF.js} +1 -1
  235. package/dist/style.css +1 -1
  236. package/dist/{stylus-Dt4VvLXL.js → stylus-D4gHF5lg.js} +1 -1
  237. package/dist/{swift-DHsn_CVI.js → swift-CnvIBnbt.js} +1 -1
  238. package/dist/{swimlanes-42K2YHIH-CqkGoGqn.js → swimlanes-42K2YHIH-CzKmGMts.js} +37 -59
  239. package/dist/swimlanesDiagram-VR7AAH4N-DnWIUN_9.js +30 -0
  240. package/dist/{swiper-component-DKntyn8p.js → swiper-component-DTdNB9wg.js} +45 -78
  241. package/dist/{tcl-CV0OLBOl.js → tcl-DkOjjZYO.js} +1 -1
  242. package/dist/{textile-D320oKVM.js → textile-DgzBVSEW.js} +1 -1
  243. package/dist/{tiki-BF2aDPlB.js → tiki-MighF8A_.js} +1 -1
  244. package/dist/{time-BaMbJs4z.js → time-BlOl70lB.js} +19 -19
  245. package/dist/{timeline-definition-24CTP7MA-DLRUNVAx.js → timeline-definition-24CTP7MA-Czf2QN2R.js} +5 -5
  246. package/dist/toast-CsJa1nGj.js +491 -0
  247. package/dist/{toml-CaUN7UHo.js → toml-B0B7UAba.js} +1 -1
  248. package/dist/{tooltip-CtBZ5q8p.js → tooltip-BVbJPkcl.js} +321 -297
  249. package/dist/treeView-Q6P3EWNA-BQywp0E1.js +2 -0
  250. package/dist/treemap-WGGIJYW6-P2ZJnldw.js +2 -0
  251. package/dist/{troff-DQUFcClZ.js → troff-B4IRX71y.js} +1 -1
  252. package/dist/{ttcn-CQL1duJS.js → ttcn-B4tpvdJD.js} +1 -1
  253. package/dist/{ttcn-cfg-BMmEFJPu.js → ttcn-cfg-pfE-1FV8.js} +1 -1
  254. package/dist/{turtle-C3esgsRr.js → turtle-Bc97ufp6.js} +1 -1
  255. package/dist/use-restore-focus-tPmARo1Q.js +7641 -0
  256. package/dist/{use-vega-container-remeasure-Bz4PZMtt.js → use-vega-container-remeasure-BrUpWQfF.js} +4 -8
  257. package/dist/{useAsyncData-BneN349z.js → useAsyncData-P5-Oovhq.js} +21 -20
  258. package/dist/{useDateFormatter-DkajGwwd.js → useDateFormatter-B4ygYuUU.js} +5 -5
  259. package/dist/{useDeepCompareMemoize-Z_7R8wTt.js → useDeepCompareMemoize-Bcu0DkCS.js} +3 -3
  260. package/dist/useEvent-BoN7U38T.js +19 -0
  261. package/dist/{useIframeCapabilities-DBETvvPl.js → useIframeCapabilities-HTZiVlGV.js} +2 -2
  262. package/dist/useLifecycle-MTdtnR3-.js +112 -0
  263. package/dist/{vb-RK1eDXRl.js → vb-C5kpOY_q.js} +1 -1
  264. package/dist/{vbscript-BCOeM0de.js → vbscript-Ck0hgOg5.js} +1 -1
  265. package/dist/{vega-component-1lFfDE_8.js → vega-component-BhBbP4S7.js} +167 -172
  266. package/dist/{vega-embed-container-BgKnsDbB.js → vega-embed-container-DgpACsCB.js} +7 -7
  267. package/dist/{vega-loader.browser-CpbZAXub.js → vega-loader.browser-Co9gYE8Z.js} +638 -295
  268. package/dist/{velocity-CZKOFbOI.js → velocity-2Doc6dgJ.js} +1 -1
  269. package/dist/{vennDiagram-4TSXK5OY-CypgoBVZ.js → vennDiagram-4TSXK5OY-BrHqWB1U.js} +4 -4
  270. package/dist/{verilog-DqQTzVn8.js → verilog-CmZmYe4R.js} +2 -2
  271. package/dist/{vhdl-vQr2bfmi.js → vhdl-esMnUHZm.js} +1 -1
  272. package/dist/wardley-WFR3VGLG-CIBJ6O2G.js +2 -0
  273. package/dist/{wardleyDiagram-VM6X3IG4-B6xjiQ_g.js → wardleyDiagram-VM6X3IG4-Cms1K_3v.js} +5 -5
  274. package/dist/{webidl-DzX7N40e.js → webidl-G_RlXG7G.js} +1 -1
  275. package/dist/{xquery-Cw_Q_hGR.js → xquery-IUQpMoMl.js} +1 -1
  276. package/dist/{xychartDiagram-S5SC5T6Z-e0PefDVs.js → xychartDiagram-S5SC5T6Z-_kUiODzS.js} +8 -8
  277. package/dist/{yacas-DiC4jJBE.js → yacas-ObL0t2h9.js} +1 -1
  278. package/dist/{z80-CUOQDEJO.js → z80-jyuJhy0k.js} +1 -1
  279. package/package.json +37 -42
  280. package/src/__mocks__/document.tsx +63 -0
  281. package/src/__mocks__/executions.ts +219 -0
  282. package/src/__mocks__/notebook.ts +3 -7
  283. package/src/__mocks__/partial.ts +26 -0
  284. package/src/__mocks__/requests.ts +1 -7
  285. package/src/__tests__/CellStatus.test.tsx +25 -26
  286. package/src/__tests__/fixtures/pair-config.ts +1 -1
  287. package/src/__tests__/main.test.tsx +24 -1
  288. package/src/__tests__/module-entry.test.ts +44 -0
  289. package/src/__tests__/mount.test.ts +17 -78
  290. package/src/__tests__/{host-imports.test.ts → replica-imports.test.ts} +12 -11
  291. package/src/components/ai/__tests__/ai-model-dropdown.test.tsx +63 -0
  292. package/src/components/ai/__tests__/ai-utils.test.ts +8 -0
  293. package/src/components/ai/ai-model-dropdown.tsx +11 -6
  294. package/src/components/app-config/__tests__/state.test.tsx +50 -0
  295. package/src/components/app-config/ai-config.tsx +154 -150
  296. package/src/components/app-config/app-config-button.tsx +6 -5
  297. package/src/components/app-config/app-config-form.tsx +5 -9
  298. package/src/components/app-config/common.tsx +7 -9
  299. package/src/components/app-config/data-form.tsx +113 -116
  300. package/src/components/app-config/get-dirty-values.ts +4 -4
  301. package/src/components/app-config/mcp-config.tsx +30 -53
  302. package/src/components/app-config/user-config-form.css +91 -0
  303. package/src/components/app-config/user-config-form.tsx +266 -349
  304. package/src/components/chat/__tests__/capabilities-popover.test.tsx +0 -1
  305. package/src/components/chat/__tests__/chat-display.test.tsx +196 -0
  306. package/src/components/chat/__tests__/chat-markdown.test.tsx +43 -0
  307. package/src/components/chat/__tests__/chat-utils.test.ts +93 -1
  308. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  309. package/src/components/chat/__tests__/notebook-access-selector.test.tsx +64 -0
  310. package/src/components/chat/__tests__/notebook-context.test.ts +199 -0
  311. package/src/components/chat/__tests__/turn-timing.test.ts +84 -0
  312. package/src/components/chat/__tests__/use-assistant-turn.test.ts +95 -0
  313. package/src/components/chat/__tests__/user-message.test.tsx +27 -0
  314. package/src/components/chat/acp/__tests__/agent-panel-initialization.test.tsx +1 -1
  315. package/src/components/chat/acp/__tests__/agent-panel.test.tsx +22 -17
  316. package/src/components/chat/acp/__tests__/session-tabs.test.tsx +43 -0
  317. package/src/components/chat/acp/__tests__/state.test.ts +2 -2
  318. package/src/components/chat/acp/agent-panel.tsx +6 -3
  319. package/src/components/chat/acp/blocks.tsx +13 -12
  320. package/src/components/chat/acp/common.tsx +4 -5
  321. package/src/components/chat/acp/model-selector.tsx +1 -1
  322. package/src/components/chat/acp/session-tabs.tsx +8 -3
  323. package/src/components/chat/agent-activity.tsx +132 -0
  324. package/src/components/chat/capabilities-popover.tsx +2 -11
  325. package/src/components/chat/chat-components.tsx +9 -4
  326. package/src/components/chat/chat-display.tsx +131 -57
  327. package/src/components/chat/chat-history-popover.tsx +6 -1
  328. package/src/components/chat/chat-markdown.tsx +15 -0
  329. package/src/components/chat/chat-panel.tsx +249 -309
  330. package/src/components/chat/chat-typography.css +108 -0
  331. package/src/components/chat/chat-utils.ts +24 -35
  332. package/src/components/chat/notebook-access-selector.stories.tsx +22 -0
  333. package/src/components/chat/notebook-access-selector.tsx +100 -0
  334. package/src/components/chat/notebook-context.ts +80 -0
  335. package/src/components/chat/tool-call/__tests__/tool-labels.test.ts +76 -0
  336. package/src/components/chat/tool-call/__tests__/tool-step.test.tsx +57 -0
  337. package/src/components/chat/tool-call/shared.ts +6 -0
  338. package/src/components/chat/tool-call/tool-call-view.tsx +22 -76
  339. package/src/components/chat/tool-call/tool-labels.ts +172 -0
  340. package/src/components/chat/tool-call/tool-result.tsx +1 -1
  341. package/src/components/chat/tool-call/tool-step.tsx +145 -0
  342. package/src/components/chat/turn-timing.ts +73 -0
  343. package/src/components/chat/use-assistant-turn.ts +65 -0
  344. package/src/components/chat/use-chat-generation.ts +20 -0
  345. package/src/components/chat/user-message.tsx +145 -0
  346. package/src/components/data-table/TableBottomBar.tsx +4 -1
  347. package/src/components/data-table/TableTopBar.tsx +2 -0
  348. package/src/components/data-table/__tests__/chart-spec-model.test.ts +195 -195
  349. package/src/components/data-table/__tests__/column-explorer.test.tsx +27 -1
  350. package/src/components/data-table/__tests__/columns.test.tsx +105 -0
  351. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  352. package/src/components/data-table/__tests__/data-table.test.tsx +1 -0
  353. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  354. package/src/components/data-table/__tests__/export-actions.test.tsx +105 -0
  355. package/src/components/data-table/__tests__/keyboard-selection.test.tsx +188 -0
  356. package/src/components/data-table/__tests__/pagination.test.tsx +28 -1
  357. package/src/components/data-table/__tests__/search-highlight.test.tsx +109 -0
  358. package/src/components/data-table/__tests__/url-detector.test.tsx +74 -0
  359. package/src/components/data-table/cell-selection/feature.ts +2 -2
  360. package/src/components/data-table/cell-selection/types.ts +2 -2
  361. package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
  362. package/src/components/data-table/charts/__tests__/spec-snapshot.test.ts +20 -20
  363. package/src/components/data-table/charts/__tests__/spec.test.ts +78 -52
  364. package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
  365. package/src/components/data-table/charts/chart-spec/spec.ts +68 -43
  366. package/src/components/data-table/charts/charts.tsx +40 -30
  367. package/src/components/data-table/charts/storage.ts +16 -5
  368. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
  369. package/src/components/data-table/column-formatting/types.ts +1 -2
  370. package/src/components/data-table/column-summary/chart-spec-model.tsx +23 -16
  371. package/src/components/data-table/column-summary/column-summary.tsx +2 -4
  372. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  373. package/src/components/data-table/columns.tsx +45 -46
  374. package/src/components/data-table/context-menu.tsx +36 -20
  375. package/src/components/data-table/data-table.tsx +17 -1
  376. package/src/components/data-table/date-popover.tsx +6 -4
  377. package/src/components/data-table/export-actions.tsx +76 -48
  378. package/src/components/data-table/pagination.tsx +44 -33
  379. package/src/components/data-table/range-focus/atoms.ts +4 -6
  380. package/src/components/data-table/range-focus/use-cell-range-selection.ts +65 -38
  381. package/src/components/data-table/range-focus/use-scroll-into-view.ts +21 -2
  382. package/src/components/data-table/renderers.tsx +16 -7
  383. package/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx +24 -1
  384. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +4 -4
  385. package/src/components/data-table/search-highlight.tsx +79 -0
  386. package/src/components/data-table/types.ts +1 -0
  387. package/src/components/data-table/url-detector.tsx +49 -9
  388. package/src/components/datasources/__tests__/column-actions.test.tsx +97 -0
  389. package/src/components/datasources/__tests__/column-preview.test.tsx +96 -5
  390. package/src/components/datasources/__tests__/datasources-interactions.test.tsx +181 -0
  391. package/src/components/datasources/__tests__/table-list.test.tsx +118 -0
  392. package/src/components/datasources/__tests__/utils.test.ts +57 -6
  393. package/src/components/datasources/column-preview.tsx +17 -12
  394. package/src/components/datasources/datasources.tsx +56 -43
  395. package/src/components/datasources/utils.ts +32 -23
  396. package/src/components/debugger/debugger-code.tsx +5 -0
  397. package/src/components/dependency-graph/custom-node.tsx +1 -1
  398. package/src/components/dependency-graph/dependency-graph-tree.tsx +8 -8
  399. package/src/components/dependency-graph/elements.ts +24 -21
  400. package/src/components/dependency-graph/minimap-content.tsx +15 -20
  401. package/src/components/dependency-graph/panels.tsx +4 -2
  402. package/src/components/dependency-graph/utils/__tests__/layout.test.ts +18 -11
  403. package/src/components/editor/SortableCell.tsx +1 -3
  404. package/src/components/editor/__tests__/Output.test.tsx +50 -32
  405. package/src/{core/attachments/__tests__/toast.test.tsx → components/editor/__tests__/agent-toast.test.tsx} +1 -1
  406. package/src/components/editor/__tests__/data-attributes.test.tsx +38 -26
  407. package/src/components/editor/__tests__/output-persistence.test.tsx +28 -9
  408. package/src/components/editor/__tests__/package-alert.test.tsx +22 -1
  409. package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +69 -0
  410. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +21 -40
  411. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +41 -14
  412. package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +6 -24
  413. package/src/components/editor/actions/__tests__/useCellActionButton.test.tsx +131 -0
  414. package/src/components/editor/actions/__tests__/useSetOutputsExpanded.test.ts +2 -1
  415. package/src/components/editor/actions/name-cell-input.tsx +4 -3
  416. package/src/components/editor/actions/pair-with-agent-commands.ts +10 -7
  417. package/src/components/editor/actions/pair-with-agent-modal.tsx +29 -30
  418. package/src/components/editor/actions/pair-with-agent.tsx +16 -39
  419. package/src/components/editor/actions/useCellActionButton.tsx +47 -35
  420. package/src/components/editor/actions/useConfigActions.tsx +3 -4
  421. package/src/components/editor/actions/useNotebookActions.tsx +25 -29
  422. package/src/components/editor/actions/useRestartKernel.tsx +0 -5
  423. package/src/components/editor/actions/useSetCodeVisibility.ts +11 -12
  424. package/src/components/editor/actions/useSetOutputsExpanded.ts +15 -23
  425. package/src/components/editor/ai/ai-completion-editor.tsx +2 -1
  426. package/src/components/editor/ai/completion-handlers.tsx +0 -37
  427. package/src/components/editor/ai/prompt-input.tsx +189 -0
  428. package/src/components/editor/alerts/__tests__/connection-notice.test.tsx +1 -1
  429. package/src/components/editor/alerts/connection-notice.tsx +1 -1
  430. package/src/components/editor/alerts/startup-logs-alert.tsx +1 -0
  431. package/src/components/editor/alerts/stdin-blocking-alert.tsx +4 -2
  432. package/src/components/editor/app-container.tsx +1 -1
  433. package/src/components/editor/boundary/__tests__/ErrorBoundary.test.tsx +1 -1
  434. package/src/components/editor/cell/CellStatus.tsx +28 -23
  435. package/src/components/editor/cell/CreateCellButton.tsx +15 -21
  436. package/src/components/editor/cell/DeleteButton.tsx +3 -2
  437. package/src/components/editor/cell/RunButton.tsx +18 -8
  438. package/src/components/editor/cell/StagedAICell.tsx +52 -137
  439. package/src/components/editor/cell/StopButton.tsx +5 -5
  440. package/src/components/editor/cell/__tests__/useRunCells.test.tsx +151 -0
  441. package/src/components/editor/cell/__tests__/useShouldShowInterrupt.test.ts +39 -0
  442. package/src/components/editor/cell/cell-actions.tsx +12 -1
  443. package/src/components/editor/cell/cell-context-menu.tsx +22 -3
  444. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +91 -0
  445. package/src/components/editor/cell/code/cell-editor.tsx +67 -170
  446. package/src/components/editor/cell/code/language-toggle.tsx +14 -11
  447. package/src/components/editor/cell/collapse.tsx +16 -6
  448. package/src/components/editor/cell/useAddCell.ts +4 -8
  449. package/src/components/editor/cell/useDeleteCell.tsx +10 -36
  450. package/src/components/editor/cell/useRunCells.ts +72 -58
  451. package/src/components/editor/cell/useShouldShowInterrupt.ts +2 -12
  452. package/src/components/editor/cell/useSplitCell.tsx +10 -6
  453. package/src/components/editor/chrome/components/__tests__/feedback-button.test.tsx +1 -1
  454. package/src/components/editor/chrome/components/feedback-button.tsx +2 -8
  455. package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +31 -2
  456. package/src/components/editor/chrome/panels/__tests__/runtime-details.test.tsx +1 -1
  457. package/src/components/editor/chrome/panels/__tests__/sandbox-recovery.test.tsx +1 -1
  458. package/src/components/editor/chrome/panels/cache-panel.tsx +1 -0
  459. package/src/components/editor/chrome/panels/dependency-graph-panel.tsx +1 -1
  460. package/src/components/editor/chrome/panels/logs-panel.tsx +2 -1
  461. package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +84 -0
  462. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +39 -14
  463. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +3 -2
  464. package/src/components/editor/chrome/panels/packages-panel.tsx +4 -7
  465. package/src/components/editor/chrome/panels/panel-header.tsx +13 -0
  466. package/src/components/editor/chrome/panels/secrets-panel.tsx +1 -0
  467. package/src/components/editor/chrome/panels/session-panel.tsx +1 -1
  468. package/src/components/editor/chrome/panels/snippets-panel.tsx +10 -12
  469. package/src/components/editor/chrome/panels/variable-panel.tsx +1 -5
  470. package/src/components/editor/chrome/types.ts +1 -1
  471. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +7 -9
  472. package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +95 -0
  473. package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +265 -37
  474. package/src/components/editor/chrome/wrapper/__tests__/useAskAiAboutCell.test.tsx +58 -0
  475. package/src/components/editor/chrome/wrapper/app-chrome.tsx +91 -74
  476. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +4 -4
  477. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +3 -17
  478. package/src/components/editor/chrome/wrapper/footer-items/document-sync-status.tsx +54 -0
  479. package/src/components/editor/chrome/wrapper/footer-items/lsp-status.tsx +1 -1
  480. package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +1 -1
  481. package/src/components/editor/chrome/wrapper/footer-items/runtime-settings.tsx +1 -7
  482. package/src/components/editor/chrome/wrapper/footer.tsx +2 -2
  483. package/src/components/editor/chrome/wrapper/minimap-state.ts +1 -1
  484. package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +143 -72
  485. package/src/components/editor/chrome/wrapper/pending-ai-changes-badge.tsx +25 -0
  486. package/src/components/editor/chrome/wrapper/sidebar.tsx +8 -4
  487. package/src/components/editor/chrome/wrapper/storage.ts +1 -1
  488. package/src/components/editor/chrome/wrapper/useAskAiAboutCell.ts +36 -0
  489. package/src/components/editor/columns/__tests__/cell-column.test.tsx +1 -1
  490. package/src/components/editor/columns/cell-column.tsx +1 -1
  491. package/src/components/editor/columns/sortable-column.tsx +2 -2
  492. package/src/components/editor/connections/components.tsx +5 -10
  493. package/src/components/editor/controls/Controls.tsx +4 -4
  494. package/src/components/editor/controls/__tests__/keyboard-shortcuts.test.tsx +61 -0
  495. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +10 -4
  496. package/src/components/editor/controls/keyboard-shortcuts.tsx +14 -5
  497. package/src/components/editor/documentation.css +34 -11
  498. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +26 -22
  499. package/src/components/editor/errors/auto-fix.tsx +4 -8
  500. package/src/components/editor/errors/send-error-report-button.tsx +3 -6
  501. package/src/components/editor/file-tree/__tests__/file-explorer-interactions.test.tsx +6 -0
  502. package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +47 -0
  503. package/src/components/editor/file-tree/__tests__/use-file-search.test.tsx +91 -0
  504. package/src/components/editor/file-tree/file-explorer.tsx +48 -15
  505. package/src/components/editor/file-tree/file-name-input.tsx +1 -0
  506. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  507. package/src/components/editor/file-tree/use-file-search.ts +35 -21
  508. package/src/components/editor/header/__tests__/filename-form.test.tsx +1 -4
  509. package/src/components/editor/header/__tests__/status.test.tsx +5 -3
  510. package/src/components/editor/header/app-header.tsx +1 -1
  511. package/src/components/editor/header/filename-form.tsx +1 -1
  512. package/src/components/editor/header/status.tsx +44 -22
  513. package/src/components/editor/links/__tests__/cell-link.test.tsx +148 -0
  514. package/src/components/editor/links/cell-link-list.tsx +1 -1
  515. package/src/components/editor/links/cell-link.tsx +21 -11
  516. package/src/components/editor/navigation/__tests__/clipboard.test.ts +60 -38
  517. package/src/components/editor/navigation/__tests__/navigation.test.ts +109 -85
  518. package/src/components/editor/navigation/__tests__/selection.test.ts +43 -21
  519. package/src/components/editor/navigation/clipboard.ts +17 -14
  520. package/src/components/editor/navigation/focus-utils.ts +23 -4
  521. package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +17 -33
  522. package/src/components/editor/navigation/navigation.ts +74 -72
  523. package/src/components/editor/navigation/selection.ts +30 -29
  524. package/src/components/editor/notebook-banner.tsx +1 -0
  525. package/src/components/editor/notebook-cell.tsx +158 -172
  526. package/src/components/editor/output/MarimoErrorOutput.tsx +41 -4
  527. package/src/components/editor/output/MarimoTracebackOutput.tsx +19 -17
  528. package/src/components/editor/output/Outputs.css +8 -0
  529. package/src/components/editor/output/VideoOutput.tsx +6 -0
  530. package/src/components/editor/output/__tests__/VideoOutput.test.tsx +131 -0
  531. package/src/components/editor/output/__tests__/traceback.test.tsx +27 -1
  532. package/src/components/editor/output/ansi-reduce.ts +40 -20
  533. package/src/components/editor/output/console/ConsoleOutput.tsx +19 -25
  534. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +125 -69
  535. package/src/components/editor/package-alert.tsx +14 -7
  536. package/src/components/editor/renderers/__tests__/add-cell-buttons.test.tsx +18 -0
  537. package/src/components/editor/renderers/cell-array.tsx +31 -102
  538. package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +75 -0
  539. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +28 -22
  540. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -4
  541. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +1 -1
  542. package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +4 -4
  543. package/src/components/editor/renderers/vertical-layout/sidebar/toggle.tsx +7 -1
  544. package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +1 -1
  545. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -37
  546. package/src/components/editor/stdin-blocking-alert.tsx +4 -2
  547. package/src/components/home/components.tsx +17 -31
  548. package/src/components/icons/__tests__/large-spinner.test.tsx +39 -0
  549. package/src/components/icons/large-spinner.tsx +3 -14
  550. package/src/components/icons/spinner.tsx +1 -1
  551. package/src/components/markdown/__tests__/markdown-renderer.test.tsx +32 -2
  552. package/src/components/markdown/markdown-renderer.tsx +43 -28
  553. package/src/components/mcp/mcp-status-indicator.tsx +18 -14
  554. package/src/components/pages/__tests__/home-page.test.tsx +116 -0
  555. package/src/components/pages/edit-page.tsx +19 -17
  556. package/src/components/pages/home-page.tsx +164 -91
  557. package/src/components/scratchpad/scratchpad.test.tsx +89 -0
  558. package/src/components/scratchpad/scratchpad.tsx +47 -33
  559. package/src/components/scratchpad/state.ts +7 -0
  560. package/src/components/slides/__tests__/minimap-actions.test.tsx +22 -29
  561. package/src/components/slides/__tests__/minimap.test.ts +38 -19
  562. package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +37 -0
  563. package/src/components/slides/minimap.tsx +22 -14
  564. package/src/components/slides/reveal-component.tsx +73 -36
  565. package/src/components/slides/reveal-slides.css +5 -4
  566. package/src/components/slides/slide-cell-view.tsx +39 -35
  567. package/src/components/slides/slide-form.tsx +1 -0
  568. package/src/components/slides/slide-scroll-hint.tsx +3 -1
  569. package/src/components/slides/slide.tsx +3 -4
  570. package/src/components/sort/SortableCellsProvider.tsx +8 -25
  571. package/src/components/static-html/__tests__/static-banner.test.tsx +1 -1
  572. package/src/components/tracing/tracing-keyboard.test.tsx +85 -0
  573. package/src/components/tracing/tracing.tsx +46 -42
  574. package/src/components/ui/__tests__/draggable-popover.test.tsx +24 -0
  575. package/src/components/ui/__tests__/fullscreen.test.tsx +99 -2
  576. package/src/components/ui/__tests__/range-slider.test.tsx +165 -0
  577. package/src/components/ui/alert-dialog.tsx +1 -1
  578. package/src/components/ui/draggable-popover.tsx +24 -2
  579. package/src/components/ui/fullscreen.tsx +43 -3
  580. package/src/components/ui/range-slider.tsx +22 -9
  581. package/src/components/ui/slider.tsx +6 -2
  582. package/src/components/ui/toast.tsx +1 -1
  583. package/src/core/MarimoApp.tsx +3 -1
  584. package/src/core/ai/__tests__/staged-cells.test.ts +90 -609
  585. package/src/core/ai/context/context.ts +2 -0
  586. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +8 -12
  587. package/src/core/ai/context/providers/__tests__/cell.test.ts +49 -0
  588. package/src/core/ai/context/providers/cell-output.ts +2 -2
  589. package/src/core/ai/context/providers/cell.ts +54 -0
  590. package/src/core/ai/context/providers/datasource.ts +6 -2
  591. package/src/core/ai/staged-cells.ts +56 -323
  592. package/src/core/ai/state.ts +3 -0
  593. package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +47 -91
  594. package/src/core/ai/tools/__tests__/registry.test.ts +17 -0
  595. package/src/core/ai/tools/base.ts +18 -15
  596. package/src/core/ai/tools/edit-notebook-tool.ts +86 -80
  597. package/src/core/ai/tools/registry.ts +13 -10
  598. package/src/core/ai/tools/sample-tool.ts +6 -7
  599. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +6 -529
  600. package/src/core/cells/__tests__/actions.test.ts +623 -35
  601. package/src/core/cells/__tests__/add-missing-import.test.ts +7 -8
  602. package/src/core/cells/__tests__/arrange.test.ts +432 -0
  603. package/src/core/cells/__tests__/cell.test.ts +148 -150
  604. package/src/core/cells/__tests__/cells.test.ts +384 -2930
  605. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +69 -0
  606. package/src/core/cells/__tests__/document.test.ts +158 -0
  607. package/src/core/cells/__tests__/editor.test.ts +57 -0
  608. package/src/core/cells/__tests__/flush-document.test.ts +40 -0
  609. package/src/core/cells/__tests__/harness.ts +109 -0
  610. package/src/core/cells/__tests__/layout.test.ts +176 -0
  611. package/src/core/cells/__tests__/logs.test.ts +0 -13
  612. package/src/core/cells/__tests__/notebook-outline.test.ts +23 -14
  613. package/src/core/cells/__tests__/outputs.test.tsx +71 -53
  614. package/src/core/cells/__tests__/pending-delete-service.test.tsx +11 -20
  615. package/src/core/cells/__tests__/session.test.ts +546 -211
  616. package/src/core/cells/__tests__/utils.test.ts +135 -337
  617. package/src/core/cells/actions.ts +677 -6
  618. package/src/core/cells/add-missing-import.ts +48 -47
  619. package/src/core/cells/arrange.ts +529 -0
  620. package/src/core/cells/cell.ts +79 -146
  621. package/src/core/cells/cells.ts +106 -1459
  622. package/src/core/cells/columns.ts +38 -0
  623. package/src/core/cells/document.ts +167 -0
  624. package/src/core/cells/edit.ts +30 -0
  625. package/src/core/cells/editor.ts +82 -0
  626. package/src/core/cells/focus.ts +27 -6
  627. package/src/core/cells/layout.ts +221 -0
  628. package/src/core/cells/outputs.ts +12 -28
  629. package/src/core/cells/pending-delete-service.ts +8 -14
  630. package/src/core/cells/scrollCellIntoView.ts +6 -0
  631. package/src/core/cells/session.ts +166 -68
  632. package/src/core/cells/types.ts +21 -51
  633. package/src/core/cells/utils.ts +85 -87
  634. package/src/core/codemirror/__tests__/format.test.ts +4 -35
  635. package/src/core/codemirror/__tests__/setup.test.ts +67 -33
  636. package/src/core/codemirror/ai/__tests__/resources.test.ts +117 -0
  637. package/src/core/codemirror/ai/resources.ts +1 -1
  638. package/src/core/codemirror/cells/__tests__/extensions.test.ts +2 -6
  639. package/src/core/codemirror/cells/extensions.ts +18 -30
  640. package/src/core/codemirror/cells/state.ts +2 -6
  641. package/src/core/codemirror/cm.ts +5 -1
  642. package/src/core/codemirror/config/types.ts +1 -1
  643. package/src/core/codemirror/copilot/__tests__/completion-integration.test.ts +4 -0
  644. package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +13 -10
  645. package/src/core/codemirror/copilot/getCodes.ts +3 -3
  646. package/src/core/codemirror/format.ts +6 -23
  647. package/src/core/codemirror/keymaps/vim.ts +4 -8
  648. package/src/core/codemirror/language/__tests__/extension.test.ts +7 -3
  649. package/src/core/codemirror/language/__tests__/sql.test.ts +22 -20
  650. package/src/core/codemirror/language/__tests__/utils.test.ts +194 -17
  651. package/src/core/codemirror/language/cell-code.ts +114 -0
  652. package/src/core/codemirror/language/extension.ts +52 -35
  653. package/src/core/codemirror/language/languages/markdown.ts +8 -6
  654. package/src/core/codemirror/language/languages/python.ts +19 -13
  655. package/src/core/codemirror/language/languages/sql/sql.ts +16 -24
  656. package/src/core/codemirror/language/panel/panel.tsx +1 -0
  657. package/src/core/codemirror/language/types.ts +7 -7
  658. package/src/core/codemirror/language/utils.ts +9 -39
  659. package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +1 -2
  660. package/src/core/codemirror/lsp/notebook-lsp.ts +6 -5
  661. package/src/core/codemirror/lsp/utils.ts +1 -1
  662. package/src/core/codemirror/misc/__tests__/paste.test.ts +3 -1
  663. package/src/core/codemirror/misc/paste.ts +1 -1
  664. package/src/core/codemirror/placeholder/__tests__/extensions.test.ts +75 -0
  665. package/src/core/codemirror/placeholder/extensions.ts +80 -19
  666. package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
  667. package/src/core/codemirror/readonly/extension.ts +2 -2
  668. package/src/core/codemirror/utils.ts +1 -0
  669. package/src/core/config/__tests__/app-config.test.ts +64 -0
  670. package/src/core/config/__tests__/config-schema.test.ts +177 -17
  671. package/src/core/config/config-schema.ts +116 -18
  672. package/src/core/config/config.ts +65 -20
  673. package/src/core/config/feature-flag.tsx +0 -2
  674. package/src/core/datasets/__tests__/data-source-discovery.test.ts +5 -5
  675. package/src/core/datasets/data-source-discovery.ts +4 -6
  676. package/src/core/documentation/doc-lookup.ts +1 -1
  677. package/src/core/dom/outline.ts +4 -1
  678. package/src/core/edit-app.tsx +28 -38
  679. package/src/core/errors/__tests__/error-entries.test.ts +40 -1
  680. package/src/core/errors/error-entries.ts +6 -4
  681. package/src/core/executions/__tests__/atoms.test.ts +282 -0
  682. package/src/core/executions/__tests__/freshness.test.ts +482 -0
  683. package/src/core/executions/__tests__/hooks.test.tsx +150 -0
  684. package/src/core/executions/__tests__/input.test.ts +86 -0
  685. package/src/core/executions/__tests__/interrupt.test.ts +200 -0
  686. package/src/core/executions/__tests__/output.test.ts +266 -0
  687. package/src/core/executions/__tests__/run.test.ts +387 -0
  688. package/src/core/executions/__tests__/select.test.ts +343 -0
  689. package/src/core/executions/atoms.ts +378 -0
  690. package/src/core/executions/freshness.ts +171 -0
  691. package/src/core/executions/hooks.ts +86 -0
  692. package/src/core/executions/index.ts +50 -0
  693. package/src/core/executions/input.ts +55 -0
  694. package/src/core/executions/interrupt.ts +49 -0
  695. package/src/core/executions/output.ts +242 -0
  696. package/src/core/executions/run.ts +107 -0
  697. package/src/core/executions/select.ts +210 -0
  698. package/src/core/export/__tests__/hooks.test.ts +0 -5
  699. package/src/core/export/hooks.ts +1 -1
  700. package/src/core/export/layout.ts +2 -2
  701. package/src/core/hotkeys/actions.ts +2 -4
  702. package/src/core/hotkeys/hotkeys.ts +2 -1
  703. package/src/core/islands/__tests__/bootstrap.test.ts +69 -17
  704. package/src/core/islands/__tests__/bridge.test.ts +104 -65
  705. package/src/core/islands/bootstrap.ts +53 -55
  706. package/src/core/islands/bridge.ts +88 -43
  707. package/src/core/islands/components/IslandControls.tsx +15 -7
  708. package/src/core/islands/components/__tests__/IslandControls.test.tsx +36 -51
  709. package/src/core/islands/components/__tests__/web-components.test.tsx +63 -0
  710. package/src/core/islands/components/output-wrapper.tsx +5 -5
  711. package/src/core/islands/components/web-components.tsx +12 -1
  712. package/src/core/islands/worker/__tests__/controller.test.ts +62 -4
  713. package/src/core/islands/worker/controller.ts +4 -10
  714. package/src/core/islands/worker/worker.tsx +78 -52
  715. package/src/core/kernel/__tests__/RuntimeState.test.ts +1 -1
  716. package/src/core/kernel/__tests__/handlers.test.ts +7 -157
  717. package/src/core/kernel/handlers.ts +13 -79
  718. package/src/core/kernel/state.ts +0 -15
  719. package/src/core/lifecycle/render-policy.ts +12 -26
  720. package/src/core/meta/__tests__/code-visibility.test.tsx +78 -70
  721. package/src/core/meta/code-visibility.ts +18 -9
  722. package/src/core/network/__tests__/connection.test.ts +1 -1
  723. package/src/core/network/__tests__/requests-network.test.ts +0 -16
  724. package/src/core/network/__tests__/requests-toasting.test.tsx +7 -7
  725. package/src/core/network/connection-notice.ts +1 -1
  726. package/src/core/network/connection.ts +1 -6
  727. package/src/core/network/requests-network.ts +5 -55
  728. package/src/core/network/requests-static.ts +1 -7
  729. package/src/core/network/requests-toasting.tsx +2 -56
  730. package/src/core/network/resolve.ts +1 -5
  731. package/src/core/network/types.ts +6 -19
  732. package/src/core/network/useConnectionNotice.ts +8 -2
  733. package/src/core/notebook/__tests__/operations.test.ts +51 -0
  734. package/src/core/notebook/attachments.ts +38 -0
  735. package/src/core/notebook/document/__tests__/codemirror.test.ts +765 -0
  736. package/src/core/notebook/document/__tests__/draft.test.ts +363 -0
  737. package/src/core/notebook/document/__tests__/fixtures.ts +92 -0
  738. package/src/core/notebook/document/__tests__/hooks.test.tsx +391 -0
  739. package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +61 -0
  740. package/src/core/notebook/document/__tests__/model.test.ts +247 -0
  741. package/src/core/notebook/document/__tests__/protocol-fixtures.ts +38 -0
  742. package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +230 -0
  743. package/src/core/notebook/document/__tests__/scenario-fixture.ts +43 -0
  744. package/src/core/notebook/document/__tests__/scenarios.test.ts +205 -0
  745. package/src/core/notebook/document/__tests__/state.test.ts +459 -0
  746. package/src/core/notebook/document/__tests__/submission.test.ts +203 -0
  747. package/src/core/notebook/document/__tests__/test-host.test.ts +92 -0
  748. package/src/core/notebook/document/__tests__/test-host.ts +243 -0
  749. package/src/core/notebook/document/__tests__/test-notebook.ts +150 -0
  750. package/src/core/notebook/document/__tests__/user.ts +61 -0
  751. package/src/core/notebook/document/codemirror.ts +216 -0
  752. package/src/core/notebook/document/draft.ts +502 -0
  753. package/src/core/notebook/document/hooks.tsx +118 -0
  754. package/src/core/notebook/document/index.ts +24 -0
  755. package/src/core/notebook/document/model.ts +102 -0
  756. package/src/core/notebook/document/select.ts +41 -0
  757. package/src/core/notebook/document/state.ts +378 -0
  758. package/src/core/notebook/document/sync.ts +376 -0
  759. package/src/core/notebook/index.ts +19 -0
  760. package/src/core/notebook/operations.ts +30 -0
  761. package/src/core/notebook/replica/AGENTS.md +11 -0
  762. package/src/core/{host → notebook/replica}/__tests__/attachments.test.ts +9 -10
  763. package/src/core/{host → notebook/replica}/__tests__/document.test.ts +18 -16
  764. package/src/core/notebook/replica/__tests__/executions.test.ts +200 -0
  765. package/src/core/notebook/replica/__tests__/fixtures.ts +103 -0
  766. package/src/core/notebook/replica/__tests__/replica.test.ts +559 -0
  767. package/src/core/notebook/replica/__tests__/results.test.ts +193 -0
  768. package/src/core/notebook/replica/__tests__/runtime.test.ts +78 -0
  769. package/src/core/notebook/replica/backend.ts +21 -0
  770. package/src/core/notebook/replica/connection.ts +38 -0
  771. package/src/core/notebook/replica/index.ts +20 -0
  772. package/src/core/notebook/replica/replica.ts +336 -0
  773. package/src/core/{host → notebook/replica}/resources/attachments.ts +6 -3
  774. package/src/core/{host → notebook/replica}/resources/document.ts +3 -3
  775. package/src/core/notebook/replica/resources/executions.ts +157 -0
  776. package/src/core/notebook/replica/resources/results.ts +48 -0
  777. package/src/core/notebook/replica/resources/runtime.ts +14 -0
  778. package/src/core/packages/__tests__/useSandboxController.test.tsx +1 -1
  779. package/src/core/packages/useSandboxController.ts +1 -1
  780. package/src/core/run-app.tsx +49 -51
  781. package/src/core/runtime/__tests__/adapter.test.ts +4 -4
  782. package/src/core/runtime/__tests__/createWsUrl.test.ts +70 -12
  783. package/src/core/runtime/__tests__/runtime.test.ts +82 -198
  784. package/src/core/runtime/adapter.ts +6 -13
  785. package/src/core/runtime/config.ts +4 -24
  786. package/src/core/runtime/runtime.ts +35 -58
  787. package/src/core/runtime/types.ts +0 -7
  788. package/src/core/saving/__tests__/document.test.tsx +123 -0
  789. package/src/core/saving/__tests__/state.test.ts +111 -0
  790. package/src/core/saving/__tests__/useAutoSave.test.tsx +67 -0
  791. package/src/core/saving/document.ts +33 -0
  792. package/src/core/saving/filename.ts +1 -1
  793. package/src/core/saving/save-component.tsx +39 -60
  794. package/src/core/saving/state.ts +38 -39
  795. package/src/core/saving/useAutoSave.ts +17 -53
  796. package/src/core/session/__tests__/backend.test.ts +236 -0
  797. package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +186 -0
  798. package/src/core/{websocket → session}/__tests__/useNotebookSession.hook.test.tsx +354 -275
  799. package/src/core/session/active-notebook.ts +28 -0
  800. package/src/core/session/backend.ts +123 -0
  801. package/src/core/{websocket → session}/connection-utils.ts +2 -14
  802. package/src/core/session/embedded.ts +7 -0
  803. package/src/core/{websocket → session}/types.ts +2 -2
  804. package/src/core/session/useNotebookReplica.ts +74 -0
  805. package/src/core/{websocket → session}/useNotebookSession.tsx +97 -77
  806. package/src/core/state/__tests__/jotai.test.tsx +108 -0
  807. package/src/core/state/jotai.ts +1 -1
  808. package/src/core/static/__tests__/files.test.ts +38 -10
  809. package/src/core/static/files.ts +2 -0
  810. package/src/core/{websocket → transports}/__tests__/connection-state.test.ts +1 -13
  811. package/src/core/transports/__tests__/server.test.ts +408 -0
  812. package/src/core/transports/__tests__/static.test.ts +340 -0
  813. package/src/core/transports/__tests__/wasm.test.ts +166 -0
  814. package/src/core/{websocket → transports}/connection-state.ts +9 -16
  815. package/src/core/transports/server.ts +152 -0
  816. package/src/core/transports/static.ts +180 -0
  817. package/src/core/transports/wasm.ts +95 -0
  818. package/src/core/vscode/__tests__/vscode-bindings.test.ts +125 -0
  819. package/src/core/vscode/vscode-bindings.ts +14 -2
  820. package/src/core/wasm/__tests__/bridge.test.ts +354 -64
  821. package/src/core/wasm/__tests__/worker.test.ts +191 -0
  822. package/src/core/wasm/bridge.ts +167 -92
  823. package/src/core/wasm/rpc.ts +15 -3
  824. package/src/core/wasm/store.ts +3 -3
  825. package/src/core/wasm/worker/bootstrap.ts +55 -51
  826. package/src/core/wasm/worker/getMarimoWheel.ts +1 -1
  827. package/src/core/wasm/worker/save-worker.ts +9 -10
  828. package/src/core/wasm/worker/types.ts +31 -19
  829. package/src/core/wasm/worker/worker.ts +120 -72
  830. package/src/css/app/Cell.css +7 -36
  831. package/src/css/app/codemirror.css +1 -1
  832. package/src/css/common.css +1 -1
  833. package/src/css/globals.css +72 -24
  834. package/src/css/katex.min.css +1 -1
  835. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  836. package/src/hooks/__tests__/useDebounce.test.tsx +51 -0
  837. package/src/hooks/__tests__/useDeepCompareMemoize.test.tsx +39 -0
  838. package/src/hooks/__tests__/useDelayElapsed.test.tsx +28 -0
  839. package/src/hooks/__tests__/useInternalStateWithSync.test.tsx +20 -0
  840. package/src/hooks/__tests__/useScript.test.tsx +77 -0
  841. package/src/hooks/__tests__/useStateForKey.test.tsx +257 -0
  842. package/src/hooks/useAsyncData.ts +3 -3
  843. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  844. package/src/hooks/useDebounce.ts +6 -10
  845. package/src/hooks/useDeepCompareMemoize.ts +1 -1
  846. package/src/hooks/useDelayElapsed.ts +14 -10
  847. package/src/hooks/useElapsedTime.ts +3 -3
  848. package/src/hooks/useEventListener.ts +1 -2
  849. package/src/hooks/useInputHistory.ts +4 -7
  850. package/src/hooks/useInternalStateWithSync.ts +6 -6
  851. package/src/hooks/useResizeObserver.ts +4 -7
  852. package/src/hooks/useScript.ts +67 -70
  853. package/src/hooks/useStateForKey.ts +93 -0
  854. package/src/mount.tsx +22 -23
  855. package/src/plugins/__tests__/plugin-object-schemas.test.ts +104 -0
  856. package/src/plugins/core/RenderHTML.tsx +3 -5
  857. package/src/plugins/core/__test__/PluginSlot.test.tsx +202 -0
  858. package/src/plugins/core/__test__/RenderHTML-copy.test.tsx +60 -0
  859. package/src/plugins/core/__test__/registerReactComponent.test.ts +45 -0
  860. package/src/plugins/core/__test__/sanitize.test.ts +8 -0
  861. package/src/plugins/core/registerReactComponent.tsx +29 -29
  862. package/src/plugins/core/sanitize-html.ts +6 -0
  863. package/src/plugins/impl/CodeEditorPlugin.tsx +1 -1
  864. package/src/plugins/impl/DataEditorPlugin.tsx +60 -28
  865. package/src/plugins/impl/DataTablePlugin.tsx +69 -37
  866. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  867. package/src/plugins/impl/FileBrowserPlugin.tsx +4 -16
  868. package/src/plugins/impl/FormPlugin.tsx +1 -1
  869. package/src/plugins/impl/RangeSliderPlugin.tsx +16 -2
  870. package/src/plugins/impl/RefreshPlugin.tsx +1 -0
  871. package/src/plugins/impl/SliderPlugin.tsx +41 -11
  872. package/src/plugins/impl/__test__/slider-labels.test.tsx +30 -0
  873. package/src/plugins/impl/__tests__/DataEditorPlugin.test.ts +190 -10
  874. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +387 -1
  875. package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +45 -0
  876. package/src/plugins/impl/__tests__/RangeSliderPlugin.test.tsx +109 -0
  877. package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +64 -3
  878. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +153 -0
  879. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  880. package/src/plugins/impl/anywidget/model.ts +3 -1
  881. package/src/plugins/impl/anywidget/registry.ts +18 -14
  882. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  883. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  884. package/src/plugins/impl/chat/__tests__/chat-prompts.test.tsx +93 -0
  885. package/src/plugins/impl/chat/chat-ui.tsx +17 -15
  886. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  887. package/src/plugins/impl/common/error-banner.tsx +5 -3
  888. package/src/plugins/impl/data-editor/__tests__/column-types.test.ts +42 -0
  889. package/src/plugins/impl/data-editor/__tests__/editor-state.test.ts +52 -1
  890. package/src/plugins/impl/data-editor/__tests__/glide-data-editor.test.tsx +278 -7
  891. package/src/plugins/impl/data-editor/__tests__/glide-utils.test.ts +116 -0
  892. package/src/plugins/impl/data-editor/column-types.ts +55 -0
  893. package/src/plugins/impl/data-editor/editor-state.ts +18 -2
  894. package/src/plugins/impl/data-editor/glide-data-editor.tsx +104 -22
  895. package/src/plugins/impl/data-editor/glide-portal.tsx +5 -3
  896. package/src/plugins/impl/data-editor/glide-utils.ts +39 -38
  897. package/src/plugins/impl/data-editor/types.ts +5 -0
  898. package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +1 -1
  899. package/src/plugins/impl/data-explorer/components/column-summary.tsx +4 -2
  900. package/src/plugins/impl/data-explorer/functions/types.ts +1 -5
  901. package/src/plugins/impl/data-explorer/state/reducer.ts +1 -1
  902. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +1 -2
  903. package/src/plugins/impl/data-frames/__tests__/sidebar.test.tsx +160 -0
  904. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +66 -66
  905. package/src/plugins/impl/data-frames/panel.tsx +44 -16
  906. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  907. package/src/plugins/impl/panel/PanelPlugin.tsx +16 -17
  908. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  909. package/src/plugins/impl/panel/utils.ts +17 -0
  910. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +2 -5
  911. package/src/plugins/impl/plotly/selection.ts +25 -19
  912. package/src/plugins/impl/vega/VegaPlugin.tsx +2 -3
  913. package/src/plugins/impl/vega/make-selectable.ts +4 -7
  914. package/src/plugins/layout/AccordionPlugin.tsx +2 -1
  915. package/src/plugins/layout/DownloadPlugin.tsx +7 -11
  916. package/src/plugins/layout/LazyPlugin.tsx +7 -4
  917. package/src/plugins/layout/RoutesPlugin.tsx +1 -1
  918. package/src/plugins/layout/TexPlugin.tsx +0 -1
  919. package/src/plugins/layout/__test__/DownloadPlugin.test.tsx +205 -0
  920. package/src/plugins/layout/__tests__/AccordionPlugin.test.tsx +21 -0
  921. package/src/plugins/layout/__tests__/LazyPlugin.test.tsx +98 -0
  922. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  923. package/src/stories/button.stories.tsx +1 -0
  924. package/src/stories/cell-status.stories.tsx +29 -24
  925. package/src/stories/cell.stories.tsx +46 -46
  926. package/src/stories/data-table.stories.tsx +31 -0
  927. package/src/stories/editor.stories.tsx +28 -17
  928. package/src/stories/form-wrapper.stories.tsx +2 -2
  929. package/src/stories/layout/vertical/one-column.stories.tsx +28 -42
  930. package/src/stories/runtime-story.tsx +23 -17
  931. package/src/stories/select.stories.tsx +2 -2
  932. package/src/stories/switchable-multi-select.stories.tsx +1 -1
  933. package/src/stories/theme.stories.tsx +4 -1
  934. package/src/theme/__tests__/islands-theme.test.tsx +276 -0
  935. package/src/theme/namespace.tsx +4 -3
  936. package/src/theme/useTheme.ts +71 -41
  937. package/src/utils/__tests__/arrays.test.ts +35 -0
  938. package/src/utils/__tests__/batch-requests.test.ts +3 -3
  939. package/src/utils/__tests__/{createReducer.test.ts → createReducer.test.tsx} +127 -1
  940. package/src/utils/__tests__/download.test.tsx +183 -23
  941. package/src/utils/__tests__/numbers.test.ts +105 -1
  942. package/src/utils/__tests__/objects.test.ts +21 -0
  943. package/src/utils/arrays.ts +11 -2
  944. package/src/utils/blob.ts +1 -1
  945. package/src/utils/createReducer.ts +115 -79
  946. package/src/utils/download.ts +67 -6
  947. package/src/utils/errors.ts +0 -7
  948. package/src/utils/maps.ts +0 -3
  949. package/src/utils/numbers.ts +79 -18
  950. package/src/utils/objects.ts +4 -9
  951. package/src/utils/time.ts +10 -0
  952. package/src/utils/tracer.ts +9 -5
  953. package/src/utils/zod-utils.ts +1 -3
  954. package/dist/_baseMerge-BiGRwuqv.js +0 -165
  955. package/dist/any-language-editor-D4q-IFcM.js +0 -76
  956. package/dist/architecture-7GRP2DOG-BWLylgiA.js +0 -3
  957. package/dist/assets/__vite-browser-external-BXYkiFsk.js +0 -1
  958. package/dist/assets/worker-HPY9fbhz.js +0 -114
  959. package/dist/classDiagram-ZZMXUADV-DXdCCDOg.js +0 -30
  960. package/dist/classDiagram-v2-VYDZK3BY-DyZqrtLP.js +0 -30
  961. package/dist/code-visibility-A6NQ-XVM.js +0 -138
  962. package/dist/cynefin-OW5HDTMX-obq-i80l.js +0 -3
  963. package/dist/dropdown-menu-BuE2b8Yb.js +0 -4678
  964. package/dist/eventmodeling-NTZA5JFV-D7nP7Uyu.js +0 -3
  965. package/dist/flowDiagram-HODETNUW-DQ4JuadE.js +0 -16
  966. package/dist/gitGraph-4MIJSDKK-Dy9uQXGh.js +0 -3
  967. package/dist/hasIn-o2Us0uVx.js +0 -132
  968. package/dist/highlighted-body-KPVGNVTW-3Ziwfz-V.js +0 -38
  969. package/dist/html-to-image-BsG_zyNW.js +0 -3251
  970. package/dist/info-A6RAGUB7-DKoayiHY.js +0 -3
  971. package/dist/isArrayLikeObject-BZl-15ir.js +0 -450
  972. package/dist/isEmpty-BSZ1LaUo.js +0 -35
  973. package/dist/isSymbol-kQcfYbNX.js +0 -8
  974. package/dist/label-DoysmLMW.js +0 -281
  975. package/dist/linear-DWERh7eI.js +0 -252
  976. package/dist/mermaid-HWGCJPDP-Du3-HPQA.js +0 -2
  977. package/dist/packet-AYTQ26CC-Yw7ajchJ.js +0 -3
  978. package/dist/pick-CJeoxYOS.js +0 -51
  979. package/dist/pie-WAS4IAKB-BKdKOAkL.js +0 -3
  980. package/dist/precisionRound-DhAzeRcm.js +0 -49
  981. package/dist/purify.es-DMv5zIkJ.js +0 -866
  982. package/dist/radar-RG4KPBEZ-ScR_D_Ts.js +0 -3
  983. package/dist/railroad-74A4TZTK-DQvPSdo5.js +0 -3
  984. package/dist/railroad-abnf-HS5TGJTU-CsJQG2O8.js +0 -3
  985. package/dist/railroad-ebnf-LZEXJU2U-BgEobkSn.js +0 -3
  986. package/dist/railroad-peg-WCYAUIDC-DjLAjofI.js +0 -3
  987. package/dist/select-DemoKT4G.js +0 -1344
  988. package/dist/stateDiagram-v2-MP3YSRHH-1OQRe6iA.js +0 -30
  989. package/dist/swimlanesDiagram-VR7AAH4N-CszjkrKo.js +0 -30
  990. package/dist/toDate-gyi35XS2.js +0 -1185
  991. package/dist/toast-PkdZraM8.js +0 -1830
  992. package/dist/treeView-Q6P3EWNA-DuRV97YF.js +0 -3
  993. package/dist/treemap-WGGIJYW6-AsLq-uwC.js +0 -3
  994. package/dist/use-restore-focus-CKjfFjLM.js +0 -6369
  995. package/dist/useLifecycle-Dfq8UD-b.js +0 -169
  996. package/dist/useTheme-Bu5bBgrh.js +0 -904
  997. package/dist/wardley-WFR3VGLG-Na-tFhQJ.js +0 -3
  998. package/src/components/chat/reasoning-accordion.tsx +0 -61
  999. package/src/components/chat/tool-call/tool-error-card.tsx +0 -81
  1000. package/src/components/chat/tool-call/tool-history-row.tsx +0 -174
  1001. package/src/components/editor/ai/__tests__/staged-cell-submission.test.ts +0 -106
  1002. package/src/components/editor/ai/add-cell-with-ai.tsx +0 -506
  1003. package/src/components/editor/ai/staged-cell-submission.ts +0 -46
  1004. package/src/components/editor/alerts/connecting-alert.tsx +0 -27
  1005. package/src/components/editor/cell/__tests__/StagedAICell.test.tsx +0 -64
  1006. package/src/components/editor/cell/code/__tests__/rtc-editor-config.test.ts +0 -50
  1007. package/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx +0 -65
  1008. package/src/components/editor/navigation/__tests__/state.test.ts +0 -81
  1009. package/src/components/editor/navigation/state.ts +0 -65
  1010. package/src/components/icons/loading-ellipsis.tsx +0 -46
  1011. package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +0 -656
  1012. package/src/core/ai/tools/run-cells-tool.ts +0 -303
  1013. package/src/core/attachments/state.ts +0 -18
  1014. package/src/core/cells/__tests__/apply-transaction.test.ts +0 -991
  1015. package/src/core/cells/__tests__/document-changes.test.ts +0 -1140
  1016. package/src/core/cells/__tests__/document-roundtrip.test.ts +0 -392
  1017. package/src/core/cells/document-changes.ts +0 -944
  1018. package/src/core/codemirror/rtc/extension.ts +0 -453
  1019. package/src/core/codemirror/rtc/loro/__tests__/sync.test.ts +0 -52
  1020. package/src/core/codemirror/rtc/loro/awareness.ts +0 -531
  1021. package/src/core/codemirror/rtc/loro/colors.ts +0 -38
  1022. package/src/core/codemirror/rtc/loro/sync.ts +0 -168
  1023. package/src/core/host/AGENTS.md +0 -11
  1024. package/src/core/host/__tests__/events.test.ts +0 -46
  1025. package/src/core/host/__tests__/fixtures.ts +0 -39
  1026. package/src/core/host/__tests__/notebook-client.test.ts +0 -433
  1027. package/src/core/host/__tests__/protocol.test.ts +0 -229
  1028. package/src/core/host/__tests__/stream.test.ts +0 -209
  1029. package/src/core/host/connection.ts +0 -81
  1030. package/src/core/host/events.ts +0 -61
  1031. package/src/core/host/notebook-client.ts +0 -290
  1032. package/src/core/host/protocol.ts +0 -1948
  1033. package/src/core/host/resources/resource.ts +0 -47
  1034. package/src/core/host/stream.ts +0 -211
  1035. package/src/core/network/__tests__/requests-lazy.test.ts +0 -334
  1036. package/src/core/network/requests-lazy.ts +0 -226
  1037. package/src/core/rtc/state.ts +0 -34
  1038. package/src/core/state/__tests__/jotai.test.ts +0 -25
  1039. package/src/core/wasm/worker/message-buffer.ts +0 -33
  1040. package/src/core/websocket/__tests__/createConnectionTransport.test.ts +0 -49
  1041. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +0 -170
  1042. package/src/core/websocket/state.ts +0 -7
  1043. package/src/core/websocket/transports/__tests__/basic.test.ts +0 -275
  1044. package/src/core/websocket/transports/__tests__/sse.test.ts +0 -335
  1045. package/src/core/websocket/transports/__tests__/transport.test.ts +0 -308
  1046. package/src/core/websocket/transports/__tests__/ws.test.ts +0 -125
  1047. package/src/core/websocket/transports/basic.ts +0 -102
  1048. package/src/core/websocket/transports/create.ts +0 -31
  1049. package/src/core/websocket/transports/sse.ts +0 -308
  1050. package/src/core/websocket/transports/transport.ts +0 -50
  1051. package/src/core/websocket/transports/ws.ts +0 -98
  1052. package/src/core/websocket/useNotebookClient.ts +0 -88
  1053. package/src/utils/__tests__/id-tree.test.ts +0 -2145
  1054. package/src/utils/id-tree.tsx +0 -1134
  1055. /package/src/{core/attachments/toast.ts → components/editor/agent-toast.ts} +0 -0
@@ -0,0 +1,2651 @@
1
+ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
+ import { g as t, h as n, p as r } from "./button-qQhINE7z.js";
3
+ import { t as i } from "./react-Bgs_wQh3.js";
4
+ import { t as a } from "./compiler-runtime-C5KHtL5D.js";
5
+ import { i as o } from "./copy-icon-DmtNidSa.js";
6
+ import { f as s, h as c } from "./tooltip-BVbJPkcl.js";
7
+ import { t as l } from "./check-DTIv5ZZ3.js";
8
+ import { n as u, r as d } from "./assertNever-ie77PjMn.js";
9
+ import { t as f } from "./jsx-runtime-D8btoEHk.js";
10
+ import { Bt as p, Ct as m, Lt as h, Mt as g, Nt as _, Ot as v, Pt as y, Tt as b, bt as x, dn as S, f as ee, fn as te, gn as ne, hn as re, kt as ie, pn as C, wt as ae, xt as w } from "./use-restore-focus-tPmARo1Q.js";
11
+ import { n as oe } from "./toast-CsJa1nGj.js";
12
+ import { t as se } from "./objects-DCmMvZtn.js";
13
+ import { t as T } from "./invariant-DLmrl-hA.js";
14
+ import { t as ce } from "./purify.es-DmnrIjg4.js";
15
+ import { t as le } from "./createReducer-BxBCTvKn.js";
16
+ import { M as ue, N as de, V as fe, g as pe } from "./dist-B_xgcU0N.js";
17
+ import { a as me, i as he, l as ge, m as _e, u as ve } from "./static-state-Al_hmf1n.js";
18
+ import { t as ye } from "./capabilities-DKqMqBzm.js";
19
+ var be = c("external-link", [
20
+ ["path", {
21
+ d: "M15 3h6v6",
22
+ key: "1q9fwt"
23
+ }],
24
+ ["path", {
25
+ d: "M10 14 21 3",
26
+ key: "gplh6r"
27
+ }],
28
+ ["path", {
29
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
30
+ key: "a6xqqp"
31
+ }]
32
+ ]), xe = c("minus", [["path", {
33
+ d: "M5 12h14",
34
+ key: "1ays0h"
35
+ }]]), E = /* @__PURE__ */ e(i(), 1), D = f(), Se = Object.defineProperty, O = (e, t) => Se(e, "name", {
36
+ value: t,
37
+ configurable: !0
38
+ }), Ce = "Checkbox", [we, Te] = re(Ce), [Ee, De] = we(Ce);
39
+ function Oe(e) {
40
+ let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] = te({
41
+ prop: n,
42
+ defaultProp: i ?? !1,
43
+ onChange: c,
44
+ caller: Ce
45
+ }), [m, h] = E.useState(null), [g, _] = E.useState(null), [v, y] = E.useState(null), b = !m || !!o || !!m.closest("form"), x = {
46
+ checked: f,
47
+ disabled: a,
48
+ setChecked: p,
49
+ control: m,
50
+ setControl: h,
51
+ name: s,
52
+ form: o,
53
+ value: u,
54
+ userClick: v,
55
+ onUserClick: y,
56
+ required: l,
57
+ defaultChecked: !k(i) && i,
58
+ isFormControl: b,
59
+ bubbleInput: g,
60
+ setBubbleInput: _
61
+ };
62
+ return /* @__PURE__ */ (0, D.jsx)(Ee, {
63
+ scope: t,
64
+ ...x,
65
+ children: Ie(d) ? d(x) : r
66
+ });
67
+ }
68
+ O(Oe, "CheckboxProvider");
69
+ var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
70
+ let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = De(ke, e), g = r(a, d), _ = E.useRef(l);
71
+ return E.useEffect(() => {
72
+ let e = o?.form;
73
+ if (e) {
74
+ let t = /* @__PURE__ */ O(() => f(_.current), "reset");
75
+ return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
76
+ }
77
+ }, [o, f]), /* @__PURE__ */ (0, D.jsx)(ne.button, {
78
+ type: "button",
79
+ role: "checkbox",
80
+ "aria-checked": k(l) ? "mixed" : l,
81
+ "aria-required": u,
82
+ "data-state": Le(l),
83
+ "data-disabled": c ? "" : void 0,
84
+ disabled: c,
85
+ value: s,
86
+ ...i,
87
+ ref: g,
88
+ onKeyDown: C(t, (e) => {
89
+ e.key === "Enter" && e.preventDefault();
90
+ }),
91
+ onClick: C(n, (e) => {
92
+ let t = e.isPropagationStopped();
93
+ p({
94
+ requestedChecked: k(l) ? !0 : !l,
95
+ hasConsumerStoppedPropagation: t
96
+ }), f((e) => k(e) ? !0 : !e), h && m && (t || e.stopPropagation());
97
+ })
98
+ });
99
+ }, "CheckboxTrigger")), je = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
100
+ let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
101
+ return /* @__PURE__ */ (0, D.jsx)(Oe, {
102
+ __scopeCheckbox: n,
103
+ checked: i,
104
+ defaultChecked: a,
105
+ disabled: s,
106
+ required: o,
107
+ onCheckedChange: l,
108
+ name: r,
109
+ form: u,
110
+ value: c,
111
+ internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(Ae, {
112
+ ...d,
113
+ ref: t,
114
+ __scopeCheckbox: n
115
+ }), e && /* @__PURE__ */ (0, D.jsx)(Fe, { __scopeCheckbox: n })] })
116
+ });
117
+ }, "Checkbox")), Me = "CheckboxIndicator", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
118
+ let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = De(Me, n);
119
+ return /* @__PURE__ */ (0, D.jsx)(S, {
120
+ present: r || k(a.checked) || a.checked === !0,
121
+ children: /* @__PURE__ */ (0, D.jsx)(ne.span, {
122
+ "data-state": Le(a.checked),
123
+ "data-disabled": a.disabled ? "" : void 0,
124
+ ...i,
125
+ ref: t,
126
+ style: {
127
+ pointerEvents: "none",
128
+ ...e.style
129
+ }
130
+ })
131
+ });
132
+ }, "CheckboxIndicator")), Pe = "CheckboxBubbleInput", Fe = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
133
+ let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = De(Pe, e), _ = r(i, g), v = s(a), y = E.useRef(!1), b = E.useRef(c), x = E.useRef(o), S = E.useRef(null);
134
+ E.useEffect(() => {
135
+ let e = h;
136
+ if (!e) return;
137
+ let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
138
+ if (!n) return;
139
+ let r = b.current !== c;
140
+ b.current = c;
141
+ let i = o !== null && o !== x.current;
142
+ if (x.current = o, i) S.current = r ? null : o, r && (e.indeterminate = k(c), n.call(e, !k(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
143
+ else if (r) {
144
+ let t = S.current;
145
+ S.current = null;
146
+ let r = t?.requestedChecked === c;
147
+ y.current = !0, e.indeterminate = k(c), n.call(e, !k(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
148
+ }
149
+ }, [
150
+ h,
151
+ c,
152
+ o
153
+ ]);
154
+ let ee = E.useRef(!k(c) && c);
155
+ return /* @__PURE__ */ (0, D.jsx)(ne.input, {
156
+ type: "checkbox",
157
+ "aria-hidden": !0,
158
+ defaultChecked: l ?? ee.current,
159
+ required: u,
160
+ disabled: d,
161
+ name: f,
162
+ value: p,
163
+ form: m,
164
+ ...n,
165
+ tabIndex: -1,
166
+ ref: _,
167
+ onClick: C(t, (e) => {
168
+ y.current && e.stopPropagation();
169
+ }),
170
+ style: {
171
+ ...n.style,
172
+ ...v,
173
+ position: "absolute",
174
+ pointerEvents: "none",
175
+ opacity: 0,
176
+ margin: 0,
177
+ transform: "translateX(-100%)"
178
+ }
179
+ });
180
+ }, "CheckboxBubbleInput"));
181
+ function Ie(e) {
182
+ return typeof e == "function";
183
+ }
184
+ O(Ie, "isFunction");
185
+ function k(e) {
186
+ return e === "indeterminate";
187
+ }
188
+ O(k, "isIndeterminate");
189
+ function Le(e) {
190
+ return k(e) ? "indeterminate" : e ? "checked" : "unchecked";
191
+ }
192
+ O(Le, "getState");
193
+ //#endregion
194
+ //#region src/core/notebook/replica/connection.ts
195
+ var A = {
196
+ NOT_STARTED: "NOT_STARTED",
197
+ CONNECTING: "CONNECTING",
198
+ OPEN: "OPEN",
199
+ CLOSED: "CLOSED"
200
+ }, Re = {
201
+ KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
202
+ KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
203
+ }, ze = {
204
+ sourceChanged: !1,
205
+ inputsChanged: !1
206
+ };
207
+ function Be(e) {
208
+ let t = /* @__PURE__ */ new Map();
209
+ for (let n of e.executions.values()) for (let e of n.variables.values()) {
210
+ let n = t.get(e.name);
211
+ n === void 0 ? t.set(e.name, [e]) : n.push(e);
212
+ }
213
+ return t;
214
+ }
215
+ function Ve(e) {
216
+ let t = Be(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
217
+ function i(e, n) {
218
+ let i = new Set(n).add(e.id);
219
+ for (let [n, a] of Object.entries(e.depends_on)) {
220
+ let s = t.get(n) ?? [];
221
+ if (a === null) {
222
+ if (s.some((t) => {
223
+ let n = r(t.execution_id);
224
+ if (n === void 0) return !1;
225
+ if (n.runtime_id === e.runtime_id) return !0;
226
+ let i = n.completed_at ?? n.started_at;
227
+ return i !== null && e.completed_at !== null && Date.parse(i) > Date.parse(e.completed_at);
228
+ })) return !0;
229
+ continue;
230
+ }
231
+ let c = s.find((e) => e.revision.execution === a.execution);
232
+ if (c === void 0 || c.revision.update !== a.update) return !0;
233
+ let l = r(c.execution_id);
234
+ if (l === void 0 || !i.has(l.id) && o(l, i).inputsChanged) return !0;
235
+ }
236
+ return !1;
237
+ }
238
+ function a(t, n) {
239
+ let i = e.executions.latest.get(t.id), a = i === void 0 ? void 0 : r(i), o = a !== void 0 && a.status !== "completed" ? a : n;
240
+ return t.code_fingerprint !== o.code_fingerprint;
241
+ }
242
+ function o(t, r) {
243
+ let o = n.get(t.id);
244
+ if (o !== void 0) return o;
245
+ let s = t.cell_id === null ? void 0 : e.cells.get(t.cell_id), c = {
246
+ sourceChanged: s === void 0 || a(s, t),
247
+ inputsChanged: i(t, r)
248
+ };
249
+ return n.set(t.id, c), c;
250
+ }
251
+ return (t) => {
252
+ let n = e.results.get(t);
253
+ return n == null ? ze : o(n, /* @__PURE__ */ new Set());
254
+ };
255
+ }
256
+ //#endregion
257
+ //#region src/utils/time.ts
258
+ var He = class e {
259
+ ms;
260
+ static fromMilliseconds(t) {
261
+ return t == null ? null : new e(t);
262
+ }
263
+ static fromSeconds(t) {
264
+ return t == null ? null : new e(t * 1e3);
265
+ }
266
+ static now() {
267
+ return new e(Date.now());
268
+ }
269
+ static parse(t) {
270
+ return new e(Date.parse(t));
271
+ }
272
+ constructor(e) {
273
+ this.ms = e;
274
+ }
275
+ toMilliseconds() {
276
+ return this.ms;
277
+ }
278
+ since(e) {
279
+ return this.ms - e.ms;
280
+ }
281
+ toSeconds() {
282
+ return this.ms / 1e3;
283
+ }
284
+ };
285
+ //#endregion
286
+ //#region src/core/executions/select.ts
287
+ function Ue(e) {
288
+ let t = e.outcome;
289
+ return t === null ? null : t.kind;
290
+ }
291
+ function We(e) {
292
+ return e === null ? null : He.parse(e).toMilliseconds();
293
+ }
294
+ function Ge(e, t) {
295
+ let n = e.latest.get(t);
296
+ return n === void 0 ? null : e.executions.get(n) ?? null;
297
+ }
298
+ function Ke(e, t) {
299
+ let n = e.cells.get(t);
300
+ return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
301
+ }
302
+ function qe(e, t) {
303
+ if (!Ke(e, t)) return !1;
304
+ if (e.requested.has(t)) return !0;
305
+ let n = Ge(e.executions, t)?.record.run_id ?? e.results.get(t)?.run_id;
306
+ for (let r of e.executions.runs.values()) if (r.status !== "completed" && r.id !== n && r.cells.includes(t)) return !0;
307
+ return !1;
308
+ }
309
+ function Je(e, t) {
310
+ let n = Ge(e.executions, t), r = e.results.get(t) ?? null, i = "idle", a = r === null ? null : We(r.started_at), o = !1;
311
+ n !== null && n.record.status !== "completed" ? (i = n.record.status, a = We(n.record.started_at) ?? a, o = n.record.outcome !== null) : qe(e, t) && (i = "queued");
312
+ let s = i === "idle", c = s && r !== null && r.started_at !== null && r.completed_at !== null ? He.parse(r.completed_at).since(He.parse(r.started_at)) : null;
313
+ return {
314
+ status: i,
315
+ blocked: e.blocked.has(t),
316
+ outcome: s && r !== null ? Ue(r) : null,
317
+ startedAt: a,
318
+ duration: c,
319
+ rendered: o
320
+ };
321
+ }
322
+ function Ye(e) {
323
+ return [...e.executions.values()].filter((e) => e.record.status !== "completed");
324
+ }
325
+ function Xe(e) {
326
+ return Ye(e).some((e) => e.record.status === "running");
327
+ }
328
+ function Ze(e) {
329
+ let t = Ye(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
330
+ for (let t of e.executions.runs.values()) if (t.status !== "completed") for (let e of t.cells) r.add(e);
331
+ let i = 0;
332
+ for (let t of r) !n.has(t) && qe(e, t) && (i += 1);
333
+ return t.length + i;
334
+ }
335
+ //#endregion
336
+ //#region src/core/executions/atoms.ts
337
+ var Qe = {
338
+ runs: /* @__PURE__ */ new Map(),
339
+ executions: /* @__PURE__ */ new Map(),
340
+ latest: /* @__PURE__ */ new Map()
341
+ }, $e = /* @__PURE__ */ new Map(), et = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Set(), nt = /* @__PURE__ */ new Set(), rt = /* @__PURE__ */ new Set(), it = /* @__PURE__ */ new Map(), j = p(null), at = p(null);
342
+ function ot(e, t, n, r) {
343
+ return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
344
+ }
345
+ function st(e) {
346
+ let t = e.get(b), n = t === null ? null : e.get(t.notebookAtom);
347
+ return t === null || n === null ? null : {
348
+ replica: t,
349
+ id: n.id
350
+ };
351
+ }
352
+ function ct(e, t) {
353
+ let n = st(e);
354
+ return n === null ? null : {
355
+ notebook: n,
356
+ value: t
357
+ };
358
+ }
359
+ function lt(e, t) {
360
+ let n = e.get(b);
361
+ if (n !== t.notebook.replica) return !1;
362
+ let r = e.get(n.notebookAtom);
363
+ return r === null || r.id === t.notebook.id;
364
+ }
365
+ var ut = p((e) => {
366
+ let t = e(b), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = ot(e(j), t, n, tt);
367
+ return r.size === 0 ? nt : new Set([...r].flatMap((e) => e.cells));
368
+ }), M = p((e) => {
369
+ let t = e(b), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = t === null ? null : e(t.documentAtom);
370
+ return {
371
+ executions: t === null ? Qe : e(t.executionsAtom),
372
+ results: t === null ? $e : e(t.resultsAtom),
373
+ cells: r?.cells ?? et,
374
+ requested: e(ut),
375
+ blocked: ot(e(at), t, n, rt)
376
+ };
377
+ }), dt = p((e) => {
378
+ let t = e(b), n = t === null ? null : e(t.documentAtom);
379
+ return t === null || n === null ? {
380
+ cells: et,
381
+ executions: Qe,
382
+ results: $e
383
+ } : {
384
+ cells: n.cells,
385
+ executions: e(t.executionsAtom),
386
+ results: e(t.resultsAtom)
387
+ };
388
+ }), ft = p((e) => Ve(e(dt))), pt = p(null);
389
+ p((e) => {
390
+ let t = e(b), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
391
+ return {
392
+ executions: t === null ? Qe : e(t.executionsAtom),
393
+ results: t === null ? $e : e(t.resultsAtom),
394
+ cleared: ot(e(pt), t, n, it)
395
+ };
396
+ });
397
+ var mt = p((e) => {
398
+ let t = e(b);
399
+ return t === null ? null : e(t.runtimeAtom)?.status ?? null;
400
+ });
401
+ p((e) => Xe(e(M).executions)), p((e) => Ze(e(M)));
402
+ var ht = p((e) => {
403
+ let t = e(b);
404
+ if (t === null) return { refused: "No notebook is connected" };
405
+ if (e(t.connectionAtom).state === A.CLOSED) return { refused: "The notebook is disconnected" };
406
+ if (e(t.notebookAtom) === null) return "waiting";
407
+ let n = e(t.runtimeAtom);
408
+ if (n === null) return { refused: "The notebook has no runtime" };
409
+ switch (n.status) {
410
+ case "running": return "running";
411
+ case "failed": return { refused: n.message ?? "The runtime failed" };
412
+ default: return "waiting";
413
+ }
414
+ });
415
+ function gt(e) {
416
+ return new Promise((t, n) => {
417
+ let r = e.sub(ht, i);
418
+ function i() {
419
+ let i = e.get(ht);
420
+ i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
421
+ }
422
+ i();
423
+ });
424
+ }
425
+ function _t(e, t) {
426
+ let n = st(e);
427
+ if (n === null) return null;
428
+ let r = {
429
+ notebook: n,
430
+ cells: [...t]
431
+ }, i = e.get(j), a = i !== null && i.notebook.replica === n.replica && i.notebook.id === n.id ? i.value : tt;
432
+ return e.set(j, {
433
+ notebook: n,
434
+ value: new Set(a).add(r)
435
+ }), r;
436
+ }
437
+ function vt(e, t) {
438
+ let n = e.get(j);
439
+ if (n === null || !n.value.has(t)) return;
440
+ let r = new Set(n.value);
441
+ r.delete(t), e.set(j, {
442
+ notebook: n.notebook,
443
+ value: r
444
+ });
445
+ }
446
+ function yt(e, t, n) {
447
+ let { replica: r } = t.notebook, i = e.sub(r.executionsAtom, a);
448
+ function a() {
449
+ (!lt(e, t) || e.get(r.executionsAtom).runs.has(n.id)) && (i(), vt(e, t));
450
+ }
451
+ a();
452
+ }
453
+ function bt(e, t, n) {
454
+ let r = e.get(M).blocked;
455
+ if (r.has(t) === n) return;
456
+ let i = new Set(r);
457
+ n ? i.add(t) : i.delete(t), e.set(at, ct(e, i));
458
+ }
459
+ function xt(e, t) {
460
+ t.status != null && bt(e, t.cell_id, t.status === "disabled-transitively");
461
+ }
462
+ //#endregion
463
+ //#region src/plugins/core/sanitize-html.ts
464
+ var St = a(), Ct = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
465
+ if (typeof document < "u") {
466
+ let e = "data-temp-href-target";
467
+ ce.addHook("beforeSanitizeAttributes", (t) => {
468
+ t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
469
+ }), ce.addHook("afterSanitizeAttributes", (t) => {
470
+ t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
471
+ });
472
+ }
473
+ function wt(e) {
474
+ let t = {
475
+ USE_PROFILES: {
476
+ html: !0,
477
+ svg: !0,
478
+ mathMl: !0
479
+ },
480
+ ADD_TAGS: ["use"],
481
+ ADD_ATTR: ["href", "xlink:href"],
482
+ ALLOWED_URI_REGEXP: Ct,
483
+ FORCE_BODY: !0,
484
+ CUSTOM_ELEMENT_HANDLING: {
485
+ tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
486
+ attributeNameCheck: /^[A-Za-z][\w-]*$/
487
+ },
488
+ SAFE_FOR_XML: !e.includes("marimo-mermaid")
489
+ };
490
+ return ce.sanitize(e, t);
491
+ }
492
+ //#endregion
493
+ //#region src/core/dom/outline.ts
494
+ var Tt = [
495
+ "marimo-carousel",
496
+ "marimo-tabs",
497
+ "marimo-accordion",
498
+ "marimo-sidebar"
499
+ ], Et = "h1, h2, h3, h4, h5, h6";
500
+ function Dt(e) {
501
+ if (typeof DOMParser > "u") return null;
502
+ let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Et);
503
+ for (let e of Array.from(n)) {
504
+ let n = e.textContent;
505
+ if (Tt.some((t) => e.closest(t)) || !n) continue;
506
+ let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
507
+ name: n,
508
+ level: r,
509
+ by: kt(e)
510
+ };
511
+ i !== n && (a.html = wt(i)), t.push(a);
512
+ }
513
+ return { items: t };
514
+ }
515
+ function Ot(e) {
516
+ if (!e.includes("\"")) return `"${e}"`;
517
+ if (!e.includes("'")) return `'${e}'`;
518
+ let t = e.split("\""), n = [];
519
+ for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
520
+ return `concat(${n.join(", ")})`;
521
+ }
522
+ function kt(e) {
523
+ let t = e.id;
524
+ if (t) return { id: t };
525
+ let n = e.textContent ?? "";
526
+ return { path: `//${e.tagName}[contains(., ${Ot(n)})]` };
527
+ }
528
+ function At(e) {
529
+ return { items: e.filter(Boolean).flatMap((e) => e.items) };
530
+ }
531
+ function jt(e) {
532
+ if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
533
+ try {
534
+ return T(typeof e.data == "string", "expected string"), Dt(e.data);
535
+ } catch {
536
+ return t.error("Failed to parse outline"), null;
537
+ }
538
+ }
539
+ function Mt(e) {
540
+ return e != null && e.items.some((e) => e.level <= 3);
541
+ }
542
+ function Nt(e, n) {
543
+ let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
544
+ if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
545
+ let a = r(i), o = e + 1;
546
+ for (; o < n.length;) {
547
+ let t = n[o];
548
+ if (t && r(t) <= a) return [e, o - 1];
549
+ o++;
550
+ }
551
+ return [e, n.length - 1];
552
+ }
553
+ //#endregion
554
+ //#region src/core/codemirror/editing/commands.ts
555
+ function Pt(e) {
556
+ return (t) => {
557
+ let n = !1;
558
+ for (let r of t) r && (n = e(r) || n);
559
+ return n;
560
+ };
561
+ }
562
+ var Ft = Pt(pe), It = Pt(de);
563
+ //#endregion
564
+ //#region src/utils/schedule-task.ts
565
+ function Lt() {
566
+ let e = globalThis.scheduler;
567
+ if (typeof e?.postTask == "function") return (t) => {
568
+ e.postTask(t, { priority: "user-visible" }).catch((e) => {
569
+ setTimeout(() => {
570
+ throw e;
571
+ });
572
+ });
573
+ };
574
+ if (typeof MessageChannel == "function") {
575
+ let e = [], t = new MessageChannel();
576
+ return t.port1.onmessage = () => {
577
+ e.shift()?.();
578
+ }, (n) => {
579
+ e.push(n), t.port2.postMessage(null);
580
+ };
581
+ }
582
+ return (e) => {
583
+ setTimeout(e, 0);
584
+ };
585
+ }
586
+ var Rt = Lt();
587
+ //#endregion
588
+ //#region src/core/codemirror/editor-mount-scheduler.ts
589
+ function zt(e = Rt) {
590
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
591
+ function i() {
592
+ r || t.size === 0 || (r = !0, e(o));
593
+ }
594
+ function a() {
595
+ for (let e of n) {
596
+ if (t.has(e)) return e;
597
+ n.delete(e);
598
+ }
599
+ return t.keys().next().value;
600
+ }
601
+ function o() {
602
+ r = !1;
603
+ try {
604
+ let e = a();
605
+ if (e !== void 0) {
606
+ let r = t.get(e);
607
+ t.delete(e), n.delete(e), r?.();
608
+ }
609
+ } finally {
610
+ i();
611
+ }
612
+ }
613
+ return {
614
+ request(e, n) {
615
+ t.set(e, n), i();
616
+ },
617
+ promote(e) {
618
+ let r = t.get(e);
619
+ r && (t.delete(e), n.delete(e), r());
620
+ },
621
+ prioritize(e) {
622
+ t.has(e) && n.add(e);
623
+ },
624
+ deprioritize(e) {
625
+ n.delete(e);
626
+ },
627
+ cancel(e) {
628
+ t.delete(e), n.delete(e);
629
+ }
630
+ };
631
+ }
632
+ var Bt = zt();
633
+ //#endregion
634
+ //#region src/core/mime.ts
635
+ function Vt(e) {
636
+ return e === "application/vnd.marimo+error";
637
+ }
638
+ function N(e) {
639
+ return e === "application/vnd.marimo+traceback";
640
+ }
641
+ function P(e) {
642
+ return Vt(e) || N(e);
643
+ }
644
+ //#endregion
645
+ //#region src/components/editor/output/ansi-reduce.ts
646
+ var Ht = class e {
647
+ lines = [""];
648
+ cursor = {
649
+ row: 0,
650
+ col: 0
651
+ };
652
+ static ESCAPE_REGEX = new RegExp(String.raw`\u001B\[([0-9;]*)([A-DJKH])`, "u");
653
+ ensureLine(e) {
654
+ for (; this.lines.length <= e;) this.lines.push("");
655
+ }
656
+ moveCursor(e, t) {
657
+ this.cursor.row = Math.max(0, this.cursor.row + e), this.cursor.col = Math.max(0, this.cursor.col + t), this.ensureLine(this.cursor.row);
658
+ }
659
+ setCursor(e, t) {
660
+ this.cursor.row = Math.max(0, e), this.cursor.col = Math.max(0, t), this.ensureLine(this.cursor.row);
661
+ }
662
+ writeChar(e) {
663
+ this.ensureLine(this.cursor.row);
664
+ let t = this.lines[this.cursor.row].padEnd(this.cursor.col, " ");
665
+ this.lines[this.cursor.row] = t.slice(0, this.cursor.col) + e + t.slice(this.cursor.col + 1), this.cursor.col++;
666
+ }
667
+ writeString(e) {
668
+ if (e.length === 0) return;
669
+ this.ensureLine(this.cursor.row);
670
+ let t = this.lines[this.cursor.row].padEnd(this.cursor.col, " ");
671
+ this.lines[this.cursor.row] = t.slice(0, this.cursor.col) + e + t.slice(this.cursor.col + e.length), this.cursor.col += e.length;
672
+ }
673
+ control(e) {
674
+ switch (e) {
675
+ case "\n":
676
+ this.cursor.row++, this.cursor.col = 0, this.ensureLine(this.cursor.row);
677
+ break;
678
+ case "\r":
679
+ this.cursor.col = 0;
680
+ break;
681
+ case " ":
682
+ this.writeChar(" ");
683
+ break;
684
+ case "\b":
685
+ this.cursor.col = Math.max(0, this.cursor.col - 1);
686
+ break;
687
+ case "\v": this.cursor.row++, this.ensureLine(this.cursor.row);
688
+ }
689
+ }
690
+ handleEscape(t) {
691
+ let n = e.ESCAPE_REGEX.exec(t);
692
+ if (!n) {
693
+ this.writeString(t);
694
+ return;
695
+ }
696
+ let r = n[1].split(";").map((e) => e === "" ? 1 : Number.parseInt(e, 10));
697
+ switch (n[2]) {
698
+ case "A":
699
+ this.moveCursor(-r[0], 0);
700
+ break;
701
+ case "B":
702
+ this.moveCursor(r[0], 0);
703
+ break;
704
+ case "C":
705
+ this.moveCursor(0, r[0]);
706
+ break;
707
+ case "D":
708
+ this.moveCursor(0, -r[0]);
709
+ break;
710
+ case "H":
711
+ this.setCursor(r[0] - 1 || 0, r[1] - 1 || 0);
712
+ break;
713
+ case "J":
714
+ r[0] === 2 && (this.lines = [""], this.setCursor(0, 0));
715
+ break;
716
+ case "K":
717
+ switch (this.ensureLine(this.cursor.row), r[0]) {
718
+ case 0:
719
+ this.lines[this.cursor.row] = this.lines[this.cursor.row].slice(0, this.cursor.col);
720
+ break;
721
+ case 1: {
722
+ let e = this.lines[this.cursor.row].length;
723
+ this.lines[this.cursor.row] = " ".repeat(this.cursor.col) + this.lines[this.cursor.row].slice(this.cursor.col, e);
724
+ break;
725
+ }
726
+ case 2: this.lines[this.cursor.row] = "";
727
+ }
728
+ break;
729
+ default: this.writeString(t);
730
+ }
731
+ }
732
+ render() {
733
+ return this.lines.join("\n");
734
+ }
735
+ }, Ut = class {
736
+ ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
737
+ parse(e) {
738
+ let t = [], n = 0;
739
+ for (let r of e.matchAll(this.ESC_REGEX)) {
740
+ let i = r.index ?? 0;
741
+ i > n && t.push({
742
+ type: "text",
743
+ value: e.slice(n, i)
744
+ }), t.push({
745
+ type: "escape",
746
+ value: r[0]
747
+ }), n = i + r[0].length;
748
+ }
749
+ return n < e.length && t.push({
750
+ type: "text",
751
+ value: e.slice(n)
752
+ }), t;
753
+ }
754
+ }, Wt = class {
755
+ parser = new Ut();
756
+ buffer = new Ht();
757
+ reduce(e) {
758
+ return this.reset(), this.append(e), this.render();
759
+ }
760
+ append(e) {
761
+ let t = this.parser.parse(e);
762
+ if (t.length === 1 && t[0].type === "text") {
763
+ let e = t[0].value;
764
+ if (!this.hasControlChars(e)) {
765
+ this.buffer.writeString(e);
766
+ return;
767
+ }
768
+ }
769
+ for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
770
+ }
771
+ reset() {
772
+ this.buffer = new Ht();
773
+ }
774
+ render() {
775
+ return this.buffer.render();
776
+ }
777
+ hasControlChars(e) {
778
+ for (let t of e) if (t < " ") return !0;
779
+ return !1;
780
+ }
781
+ processText(e) {
782
+ let t = 0, n = e.length;
783
+ for (let r = 0; r < n; r++) {
784
+ let n = e[r];
785
+ if (n === "\n" || n === "\r" || n === " " || n === "\b" || n === "\v") {
786
+ if (r > t) {
787
+ let n = e.slice(t, r), i = this.filterControlChars(n);
788
+ i.length > 0 && this.buffer.writeString(i);
789
+ }
790
+ this.buffer.control(n), t = r + 1;
791
+ } else if (n < " ") {
792
+ if (r > t) {
793
+ let n = e.slice(t, r);
794
+ n.length > 0 && this.buffer.writeString(n);
795
+ }
796
+ t = r + 1;
797
+ }
798
+ }
799
+ if (t < n) {
800
+ let n = e.slice(t), r = this.filterControlChars(n);
801
+ r.length > 0 && this.buffer.writeString(r);
802
+ }
803
+ }
804
+ filterControlChars(e) {
805
+ let t = !1;
806
+ for (let n of e) if (n < " ") {
807
+ t = !0;
808
+ break;
809
+ }
810
+ if (!t) return e;
811
+ let n = "";
812
+ for (let t of e) t >= " " && (n += t);
813
+ return n;
814
+ }
815
+ }, F = class e {
816
+ mimetype;
817
+ channel;
818
+ timestamp;
819
+ code;
820
+ id;
821
+ input_id;
822
+ ansiReducer = new Wt();
823
+ _data;
824
+ get data() {
825
+ return this._data;
826
+ }
827
+ static create(t) {
828
+ let n = new Wt();
829
+ return n.append(t.data), new e({
830
+ mimetype: t.mimetype,
831
+ channel: t.channel,
832
+ timestamp: t.timestamp,
833
+ ansiReducer: n,
834
+ code: t.code,
835
+ id: t.id,
836
+ input_id: t.input_id
837
+ });
838
+ }
839
+ constructor({ mimetype: e, channel: t, timestamp: n, ansiReducer: r, code: i, id: a, input_id: o }) {
840
+ this.mimetype = e, this.channel = t, this.timestamp = n, this.code = i, this.id = a, this.input_id = o, this.ansiReducer = r, this._data = this.ansiReducer.render();
841
+ }
842
+ appendData(t) {
843
+ return this.ansiReducer.append(t), new e({
844
+ mimetype: this.mimetype,
845
+ channel: this.channel,
846
+ timestamp: this.timestamp,
847
+ ansiReducer: this.ansiReducer,
848
+ code: this.code,
849
+ id: this.id,
850
+ input_id: this.input_id
851
+ });
852
+ }
853
+ toJSON() {
854
+ return {
855
+ mimetype: this.mimetype,
856
+ channel: this.channel,
857
+ timestamp: this.timestamp,
858
+ data: this.data,
859
+ ...this.code === void 0 ? {} : { code: this.code }
860
+ };
861
+ }
862
+ };
863
+ //#endregion
864
+ //#region src/core/cells/collapseConsoleOutputs.tsx
865
+ function Gt(e, t = 5e3) {
866
+ let n = [...e];
867
+ if (n.length < 2) return Xt(n.map(qt), t);
868
+ let r = n[n.length - 1], i = n[n.length - 2];
869
+ return Kt(r, i) && (Yt(r), Yt(i), n[n.length - 2] = Jt(i, r), n.pop()), Xt(n, t);
870
+ }
871
+ function Kt(e, t) {
872
+ let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
873
+ if (!n) return !1;
874
+ let r = e.channel === t.channel, i = e.channel !== "stdin";
875
+ return n && r && i;
876
+ }
877
+ function qt(e) {
878
+ return e instanceof F ? e : typeof e.data == "string" ? F.create(e) : e;
879
+ }
880
+ function Jt(e, t) {
881
+ return e instanceof F ? e.appendData(t.data) : F.create(e).appendData(t.data);
882
+ }
883
+ function Yt(e) {
884
+ T(typeof e.data == "string", "expected string output");
885
+ }
886
+ function Xt(e, t) {
887
+ let n = 0, r;
888
+ for (r = e.length - 1; r >= 0 && n < t; r--) {
889
+ let t = e[r];
890
+ t.mimetype === "text/plain" ? (T(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
891
+ }
892
+ if (n < t) return e;
893
+ let i = r + 1, a = {
894
+ channel: "stderr",
895
+ mimetype: "text/html",
896
+ data: `<pre>Streaming output truncated to last ${t} lines.\n</pre>`,
897
+ timestamp: -1
898
+ }, o = e[i];
899
+ if (o == null) return [a, ...e.slice(i + 1)];
900
+ if (o.mimetype === "text/plain") {
901
+ T(typeof o.data == "string", "expected string");
902
+ let r = o.data.split("\n"), s = t - (n - r.length);
903
+ return [
904
+ a,
905
+ {
906
+ ...o,
907
+ data: r.slice(-s).join("\n")
908
+ },
909
+ ...e.slice(i + 1)
910
+ ];
911
+ }
912
+ return [a, ...e.slice(i + 1)];
913
+ }
914
+ //#endregion
915
+ //#region src/core/cells/cell.ts
916
+ function Zt(e) {
917
+ return (e.at(-1)?.id ?? 0) + 1;
918
+ }
919
+ function Qt(e) {
920
+ return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
921
+ }
922
+ function $t(e, t) {
923
+ let n = { ...e };
924
+ t.status === "queued" && (n.debuggerActive = !1), t.status === "running" && Qt(e.output).some((e) => e.includes("ancestor")) && (n.output = null), n.output = t.output ?? n.output, t.serialization !== void 0 && (n.serialization = t.serialization);
925
+ let r = Qt(t.output).includes("interruption"), i = e.consoleOutputs;
926
+ (r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
927
+ channel: e.channel,
928
+ mimetype: e.mimetype,
929
+ data: e.data,
930
+ timestamp: e.timestamp,
931
+ id: e.id,
932
+ input_id: e.input_id,
933
+ response: e.response ?? ""
934
+ } : e));
935
+ let a = t.console;
936
+ a != null && (i = Gt(Array.isArray(a) ? a.map((e, t) => ({
937
+ ...e,
938
+ id: t + 1
939
+ })) : [...i, {
940
+ ...a,
941
+ id: Zt(i)
942
+ }])), n.consoleOutputs = i, n.outline = jt(n.output);
943
+ let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
944
+ return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
945
+ }
946
+ function en(e) {
947
+ return e === "running" || e === "queued";
948
+ }
949
+ function tn(e, t, n) {
950
+ let { status: r, outcome: i, rendered: a } = e;
951
+ return en(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
952
+ }
953
+ //#endregion
954
+ //#region src/core/cells/columns.ts
955
+ function nn(e) {
956
+ let t = /* @__PURE__ */ new Map(), n = 0;
957
+ for (let r of e.order) {
958
+ let i = e.cells.get(r)?.config.column;
959
+ i != null && i >= 0 && (n = i), t.set(r, n);
960
+ }
961
+ return t;
962
+ }
963
+ function rn(e) {
964
+ let t = [[]];
965
+ for (let [n, r] of nn(e)) {
966
+ for (; t.length <= r;) t.push([]);
967
+ t[r].push(n);
968
+ }
969
+ return t;
970
+ }
971
+ //#endregion
972
+ //#region src/core/dom/ui-element-constants.ts
973
+ var an = "object-id", on = "random-id", sn = "abcdefghijklmnopqrstuvwxyz", cn = sn + sn.toUpperCase(), ln = /* @__PURE__ */ new Set(), I = "__scratch__", un = "setup", dn = { create() {
974
+ let e = 0, t;
975
+ do {
976
+ let n = "";
977
+ for (let e = 0; e < 4; e++) n += cn[Math.floor(Math.random() * 52)];
978
+ t = n, e++;
979
+ } while (ln.has(t) && e < 100);
980
+ if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
981
+ return ln.add(t), t;
982
+ } }, L = {
983
+ create(e) {
984
+ return T(e != null, "cellId is required"), `cell-${e}`;
985
+ },
986
+ parse(e) {
987
+ return e.slice(5);
988
+ },
989
+ findElement(e) {
990
+ return e.closest("div[id^=\"cell-\"]");
991
+ },
992
+ findElementThroughShadowDOMs(e) {
993
+ let t = e;
994
+ for (; t;) {
995
+ let e = L.findElement(t);
996
+ if (e) return e;
997
+ let n = t.getRootNode();
998
+ if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
999
+ }
1000
+ return null;
1001
+ }
1002
+ };
1003
+ function fn(e) {
1004
+ let t = null, n = L.findElementThroughShadowDOMs(e);
1005
+ return n && (t = L.parse(n.id)), t;
1006
+ }
1007
+ var pn = {
1008
+ parse(e) {
1009
+ return e.getAttribute(an);
1010
+ },
1011
+ parseOrThrow(e) {
1012
+ let t = pn.parse(e);
1013
+ return T(t, "<marimo-ui-element/> missing object-id attribute"), t;
1014
+ }
1015
+ }, mn = { create(e) {
1016
+ return `output-${e}`;
1017
+ } }, hn = p(/* @__PURE__ */ new Set()), R = p([]), z = p([]);
1018
+ function gn() {
1019
+ return `column-${dn.create()}`;
1020
+ }
1021
+ var _n = p(null, (e, t, n) => {
1022
+ let r = rn(n).length, i = e(R);
1023
+ if (i.length === r) return;
1024
+ let a = e(z), o = [...i, ...a].slice(0, r);
1025
+ for (; o.length < r;) o.push(gn());
1026
+ t(R, o), t(z, a.slice(Math.max(0, r - i.length)));
1027
+ });
1028
+ function vn(e, t, n) {
1029
+ return [...(e === null ? [[]] : rn(e)).map((e, n) => ({
1030
+ id: t[n] ?? `column-${n}`,
1031
+ ids: e
1032
+ })), ...n.map((e) => ({
1033
+ id: e,
1034
+ ids: []
1035
+ }))];
1036
+ }
1037
+ function yn(e, t, n) {
1038
+ let r = /* @__PURE__ */ new Map();
1039
+ return e.forEach((i, a) => {
1040
+ let o = t[a];
1041
+ if (!n.has(i) || !o || o.items.length === 0) return;
1042
+ let s = Nt(a, t);
1043
+ s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
1044
+ }), r;
1045
+ }
1046
+ function bn(e, t, n) {
1047
+ return { columns: e.map(({ id: e, ids: r }) => {
1048
+ let i = yn(r, r.map(t), n), a = new Set([...i.values()].flat());
1049
+ return {
1050
+ id: e,
1051
+ ids: r,
1052
+ visible: r.filter((e) => !a.has(e)),
1053
+ folds: i
1054
+ };
1055
+ }) };
1056
+ }
1057
+ var B = p((e) => {
1058
+ let t = e(ae), n = t === null ? null : e(t.documentAtom), r = e(yi);
1059
+ return bn(vn(n, e(R), e(z)), (e) => r[e] ?? null, e(hn));
1060
+ }), xn = () => h(B), Sn = p((e) => e(B).columns.length);
1061
+ function Cn(e, t) {
1062
+ return e.columns.find((e) => e.id === t);
1063
+ }
1064
+ function wn(e, t) {
1065
+ let n = e.columns.find((e) => e.ids.includes(t));
1066
+ if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
1067
+ return n;
1068
+ }
1069
+ function Tn(e, t) {
1070
+ for (let n of e.columns) {
1071
+ let e = n.folds.get(t);
1072
+ if (e !== void 0) return e;
1073
+ }
1074
+ }
1075
+ function En(e, t) {
1076
+ let n = e.columns.find((e) => e.ids.includes(t));
1077
+ return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
1078
+ }
1079
+ function Dn(e, t) {
1080
+ let n = En(e, t);
1081
+ return Tn(e, t) === void 0 ? n : [...n, t];
1082
+ }
1083
+ var On = /* @__PURE__ */ new Set(/* @__PURE__ */ "__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup".split("."));
1084
+ function kn(e, t = !0) {
1085
+ return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
1086
+ }
1087
+ function An(e, t) {
1088
+ let n = new Set(t), r = e, i = (e) => !n.has(e) && !On.has(e);
1089
+ if (i(e)) return e;
1090
+ let a = 1;
1091
+ for (; !i(r);) r = `${e}_${a}`, a++;
1092
+ return r;
1093
+ }
1094
+ function jn(e, t) {
1095
+ return Mn(e) ? `cell-${t}` : e;
1096
+ }
1097
+ function Mn(e) {
1098
+ return !e || e === "_" || e === "__";
1099
+ }
1100
+ //#endregion
1101
+ //#region src/core/cells/types.ts
1102
+ function Nn({ id: e, name: t = "_", code: n = "", config: r }) {
1103
+ return {
1104
+ id: e,
1105
+ config: r || {
1106
+ hide_code: !1,
1107
+ disabled: !1,
1108
+ column: null,
1109
+ expand_output: !1
1110
+ },
1111
+ name: t,
1112
+ code: n
1113
+ };
1114
+ }
1115
+ function Pn(e) {
1116
+ return {
1117
+ hide_code: !1,
1118
+ disabled: !1,
1119
+ column: null,
1120
+ expand_output: !1,
1121
+ ...e
1122
+ };
1123
+ }
1124
+ function V(e) {
1125
+ return {
1126
+ outline: null,
1127
+ output: null,
1128
+ consoleOutputs: [],
1129
+ debuggerActive: !1,
1130
+ ...e
1131
+ };
1132
+ }
1133
+ //#endregion
1134
+ //#region src/core/cells/document.ts
1135
+ function Fn(e, t) {
1136
+ let n = t.code ?? e.code, r = y(e.config, t.config) ? e.config : Pn(t.config);
1137
+ return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
1138
+ ...e,
1139
+ name: t.name,
1140
+ config: r
1141
+ } : {
1142
+ ...e,
1143
+ code: n,
1144
+ name: t.name,
1145
+ config: r
1146
+ };
1147
+ }
1148
+ function In(e, t) {
1149
+ let n = y(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
1150
+ for (let o of n) {
1151
+ let n = t.cells.get(o), s = e.cellData[o];
1152
+ if (n === void 0) continue;
1153
+ if (s === void 0) {
1154
+ r = {
1155
+ ...r,
1156
+ [o]: Nn({
1157
+ id: o,
1158
+ code: n.code ?? "",
1159
+ name: n.name,
1160
+ config: Pn(n.config)
1161
+ })
1162
+ }, i = {
1163
+ ...i,
1164
+ [o]: i[o] ?? V()
1165
+ }, a = {
1166
+ ...a,
1167
+ [o]: (0, E.createRef)()
1168
+ };
1169
+ continue;
1170
+ }
1171
+ let c = Fn(s, n);
1172
+ c !== s && (r = {
1173
+ ...r,
1174
+ [o]: c
1175
+ });
1176
+ }
1177
+ let o = new Set(n), s = e.cellIds.filter((e) => !o.has(e));
1178
+ if (s.length > 0) {
1179
+ let e = new Set(s), t = (t) => Object.fromEntries(Object.entries(t).filter(([t]) => !e.has(t)));
1180
+ r = t(r), i = t(i), a = t(a);
1181
+ }
1182
+ return n === e.cellIds && r === e.cellData && s.length === 0 ? e : {
1183
+ ...e,
1184
+ cellIds: n,
1185
+ cellData: r,
1186
+ cellRuntime: i,
1187
+ cellHandles: a
1188
+ };
1189
+ }
1190
+ function Ln({ store: e, model: t, reconcile: n, signal: r }) {
1191
+ let i = () => {
1192
+ let r = e.get(t.documentAtom);
1193
+ r !== null && (n(r), e.set(_n, r));
1194
+ }, a = e.sub(t.documentAtom, i);
1195
+ r.addEventListener("abort", a, { once: !0 }), i();
1196
+ }
1197
+ async function Rn() {
1198
+ let e = w.get(ae);
1199
+ e !== null && w.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
1200
+ }
1201
+ //#endregion
1202
+ //#region src/core/cells/editor.ts
1203
+ var H = p(/* @__PURE__ */ new Set());
1204
+ function zn(e, t, n) {
1205
+ return !!e && !t.has(n);
1206
+ }
1207
+ p(null, (e, t, { cellId: n }) => {
1208
+ t(H, (e) => /* @__PURE__ */ new Set([...e, n]));
1209
+ }), p(null, (e, t, { cellId: n }) => e(H).has(n) ? (t(H, (e) => {
1210
+ let t = new Set(e);
1211
+ return t.delete(n), t;
1212
+ }), !0) : !1);
1213
+ var Bn = p(/* @__PURE__ */ new Map());
1214
+ p(null, (e, t, { cellId: n }) => {
1215
+ t(Bn, (e) => {
1216
+ let t = new Map(e);
1217
+ return t.delete(n), t;
1218
+ });
1219
+ });
1220
+ //#endregion
1221
+ //#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
1222
+ function Vn(e, t) {
1223
+ return ve(e * 1e3, t?.in);
1224
+ }
1225
+ //#endregion
1226
+ //#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
1227
+ var U = function(e, t) {
1228
+ return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
1229
+ }, W;
1230
+ (function(e) {
1231
+ e[e.EOS = 0] = "EOS", e[e.Text = 1] = "Text", e[e.Incomplete = 2] = "Incomplete", e[e.ESC = 3] = "ESC", e[e.Unknown = 4] = "Unknown", e[e.SGR = 5] = "SGR", e[e.OSCURL = 6] = "OSCURL";
1232
+ })(W ||= {});
1233
+ var Hn = class {
1234
+ constructor() {
1235
+ this.VERSION = "6.0.6", this.setup_palettes(), this._use_classes = !1, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1, this.fg = this.bg = null, this._buffer = "", this._url_allowlist = {
1236
+ http: 1,
1237
+ https: 1
1238
+ }, this._escape_html = !0, this.boldStyle = "font-weight:bold", this.faintStyle = "opacity:0.7", this.italicStyle = "font-style:italic", this.underlineStyle = "text-decoration:underline";
1239
+ }
1240
+ set use_classes(e) {
1241
+ this._use_classes = e;
1242
+ }
1243
+ get use_classes() {
1244
+ return this._use_classes;
1245
+ }
1246
+ set url_allowlist(e) {
1247
+ this._url_allowlist = e;
1248
+ }
1249
+ get url_allowlist() {
1250
+ return this._url_allowlist;
1251
+ }
1252
+ set escape_html(e) {
1253
+ this._escape_html = e;
1254
+ }
1255
+ get escape_html() {
1256
+ return this._escape_html;
1257
+ }
1258
+ set boldStyle(e) {
1259
+ this._boldStyle = e;
1260
+ }
1261
+ get boldStyle() {
1262
+ return this._boldStyle;
1263
+ }
1264
+ set faintStyle(e) {
1265
+ this._faintStyle = e;
1266
+ }
1267
+ get faintStyle() {
1268
+ return this._faintStyle;
1269
+ }
1270
+ set italicStyle(e) {
1271
+ this._italicStyle = e;
1272
+ }
1273
+ get italicStyle() {
1274
+ return this._italicStyle;
1275
+ }
1276
+ set underlineStyle(e) {
1277
+ this._underlineStyle = e;
1278
+ }
1279
+ get underlineStyle() {
1280
+ return this._underlineStyle;
1281
+ }
1282
+ setup_palettes() {
1283
+ this.ansi_colors = [[
1284
+ {
1285
+ rgb: [
1286
+ 0,
1287
+ 0,
1288
+ 0
1289
+ ],
1290
+ class_name: "ansi-black"
1291
+ },
1292
+ {
1293
+ rgb: [
1294
+ 187,
1295
+ 0,
1296
+ 0
1297
+ ],
1298
+ class_name: "ansi-red"
1299
+ },
1300
+ {
1301
+ rgb: [
1302
+ 0,
1303
+ 187,
1304
+ 0
1305
+ ],
1306
+ class_name: "ansi-green"
1307
+ },
1308
+ {
1309
+ rgb: [
1310
+ 187,
1311
+ 187,
1312
+ 0
1313
+ ],
1314
+ class_name: "ansi-yellow"
1315
+ },
1316
+ {
1317
+ rgb: [
1318
+ 0,
1319
+ 0,
1320
+ 187
1321
+ ],
1322
+ class_name: "ansi-blue"
1323
+ },
1324
+ {
1325
+ rgb: [
1326
+ 187,
1327
+ 0,
1328
+ 187
1329
+ ],
1330
+ class_name: "ansi-magenta"
1331
+ },
1332
+ {
1333
+ rgb: [
1334
+ 0,
1335
+ 187,
1336
+ 187
1337
+ ],
1338
+ class_name: "ansi-cyan"
1339
+ },
1340
+ {
1341
+ rgb: [
1342
+ 255,
1343
+ 255,
1344
+ 255
1345
+ ],
1346
+ class_name: "ansi-white"
1347
+ }
1348
+ ], [
1349
+ {
1350
+ rgb: [
1351
+ 85,
1352
+ 85,
1353
+ 85
1354
+ ],
1355
+ class_name: "ansi-bright-black"
1356
+ },
1357
+ {
1358
+ rgb: [
1359
+ 255,
1360
+ 85,
1361
+ 85
1362
+ ],
1363
+ class_name: "ansi-bright-red"
1364
+ },
1365
+ {
1366
+ rgb: [
1367
+ 0,
1368
+ 255,
1369
+ 0
1370
+ ],
1371
+ class_name: "ansi-bright-green"
1372
+ },
1373
+ {
1374
+ rgb: [
1375
+ 255,
1376
+ 255,
1377
+ 85
1378
+ ],
1379
+ class_name: "ansi-bright-yellow"
1380
+ },
1381
+ {
1382
+ rgb: [
1383
+ 85,
1384
+ 85,
1385
+ 255
1386
+ ],
1387
+ class_name: "ansi-bright-blue"
1388
+ },
1389
+ {
1390
+ rgb: [
1391
+ 255,
1392
+ 85,
1393
+ 255
1394
+ ],
1395
+ class_name: "ansi-bright-magenta"
1396
+ },
1397
+ {
1398
+ rgb: [
1399
+ 85,
1400
+ 255,
1401
+ 255
1402
+ ],
1403
+ class_name: "ansi-bright-cyan"
1404
+ },
1405
+ {
1406
+ rgb: [
1407
+ 255,
1408
+ 255,
1409
+ 255
1410
+ ],
1411
+ class_name: "ansi-bright-white"
1412
+ }
1413
+ ]], this.palette_256 = [], this.ansi_colors.forEach((e) => {
1414
+ e.forEach((e) => {
1415
+ this.palette_256.push(e);
1416
+ });
1417
+ });
1418
+ let e = [
1419
+ 0,
1420
+ 95,
1421
+ 135,
1422
+ 175,
1423
+ 215,
1424
+ 255
1425
+ ];
1426
+ for (let t = 0; t < 6; ++t) for (let n = 0; n < 6; ++n) for (let r = 0; r < 6; ++r) {
1427
+ let i = {
1428
+ rgb: [
1429
+ e[t],
1430
+ e[n],
1431
+ e[r]
1432
+ ],
1433
+ class_name: "truecolor"
1434
+ };
1435
+ this.palette_256.push(i);
1436
+ }
1437
+ let t = 8;
1438
+ for (let e = 0; e < 24; ++e, t += 10) {
1439
+ let e = {
1440
+ rgb: [
1441
+ t,
1442
+ t,
1443
+ t
1444
+ ],
1445
+ class_name: "truecolor"
1446
+ };
1447
+ this.palette_256.push(e);
1448
+ }
1449
+ }
1450
+ escape_txt_for_html(e) {
1451
+ return this._escape_html ? e.replace(/[&<>"']/gm, (e) => {
1452
+ if (e === "&") return "&amp;";
1453
+ if (e === "<") return "&lt;";
1454
+ if (e === ">") return "&gt;";
1455
+ if (e === "\"") return "&quot;";
1456
+ if (e === "'") return "&#x27;";
1457
+ }) : e;
1458
+ }
1459
+ append_buffer(e) {
1460
+ var t = this._buffer + e;
1461
+ this._buffer = t;
1462
+ }
1463
+ get_next_packet() {
1464
+ var e = {
1465
+ kind: W.EOS,
1466
+ text: "",
1467
+ url: ""
1468
+ }, t = this._buffer.length;
1469
+ if (t == 0) return e;
1470
+ var n = this._buffer.indexOf("\x1B");
1471
+ if (n == -1) return e.kind = W.Text, e.text = this._buffer, this._buffer = "", e;
1472
+ if (n > 0) return e.kind = W.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
1473
+ if (n == 0) {
1474
+ if (t < 3) return e.kind = W.Incomplete, e;
1475
+ var r = this._buffer.charAt(1);
1476
+ if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1477
+ if (r == "[") {
1478
+ this._csi_regex ||= Un(Gn ||= U(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \x1B[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \x1B[ # CSI\n [ -~]* # anything legal\n ([\0-:]) # anything illegal\n )\n "], ["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]));
1479
+ let t = this._buffer.match(this._csi_regex);
1480
+ if (t === null) return e.kind = W.Incomplete, e;
1481
+ if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1482
+ e.kind = t[1] != "" || t[3] != "m" ? W.Unknown : W.SGR, e.text = t[2];
1483
+ var i = t[0].length;
1484
+ return this._buffer = this._buffer.slice(i), e;
1485
+ }
1486
+ if (r == "]") {
1487
+ if (t < 4) return e.kind = W.Incomplete, e;
1488
+ if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1489
+ this._osc_st ||= Wn(Kn ||= U(["\n (?: # legal sequence\n (\x1B\\) # ESC | # alternate\n (\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-] # anything illegal\n | # alternate\n [\b-] # anything illegal\n | # alternate\n [-] # anything illegal\n )\n "], ["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "])), this._osc_st.lastIndex = 0;
1490
+ {
1491
+ let t = this._osc_st.exec(this._buffer);
1492
+ if (t === null) return e.kind = W.Incomplete, e;
1493
+ if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1494
+ }
1495
+ {
1496
+ let t = this._osc_st.exec(this._buffer);
1497
+ if (t === null) return e.kind = W.Incomplete, e;
1498
+ if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1499
+ }
1500
+ this._osc_regex ||= Un(qn ||= U(["\n ^ # beginning of line\n #\n \x1B]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n \x1B]8;; # OSC Hyperlink End\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n "], ["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]));
1501
+ let n = this._buffer.match(this._osc_regex);
1502
+ if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1503
+ e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
1504
+ var i = n[0].length;
1505
+ return this._buffer = this._buffer.slice(i), e;
1506
+ }
1507
+ if (r == "(") return e.kind = W.Unknown, this._buffer = this._buffer.slice(3), e;
1508
+ }
1509
+ }
1510
+ ansi_to_html(e) {
1511
+ this.append_buffer(e);
1512
+ for (var t = [];;) {
1513
+ var n = this.get_next_packet();
1514
+ if (n.kind == W.EOS || n.kind == W.Incomplete) break;
1515
+ n.kind != W.ESC && n.kind != W.Unknown && (n.kind == W.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == W.SGR ? this.process_ansi(n) : n.kind == W.OSCURL && t.push(this.process_hyperlink(n)));
1516
+ }
1517
+ return t.join("");
1518
+ }
1519
+ with_state(e) {
1520
+ return {
1521
+ bold: this.bold,
1522
+ faint: this.faint,
1523
+ italic: this.italic,
1524
+ underline: this.underline,
1525
+ fg: this.fg,
1526
+ bg: this.bg,
1527
+ text: e.text
1528
+ };
1529
+ }
1530
+ process_ansi(e) {
1531
+ let t = e.text.split(";");
1532
+ for (; t.length > 0;) {
1533
+ let e = t.shift(), n = parseInt(e, 10);
1534
+ if (isNaN(n) || n === 0) this.fg = null, this.bg = null, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1;
1535
+ else if (n === 1) this.bold = !0;
1536
+ else if (n === 2) this.faint = !0;
1537
+ else if (n === 3) this.italic = !0;
1538
+ else if (n === 4) this.underline = !0;
1539
+ else if (n === 21) this.bold = !1;
1540
+ else if (n === 22) this.faint = !1, this.bold = !1;
1541
+ else if (n === 23) this.italic = !1;
1542
+ else if (n === 24) this.underline = !1;
1543
+ else if (n === 39) this.fg = null;
1544
+ else if (n === 49) this.bg = null;
1545
+ else if (n >= 30 && n < 38) this.fg = this.ansi_colors[0][n - 30];
1546
+ else if (n >= 40 && n < 48) this.bg = this.ansi_colors[0][n - 40];
1547
+ else if (n >= 90 && n < 98) this.fg = this.ansi_colors[1][n - 90];
1548
+ else if (n >= 100 && n < 108) this.bg = this.ansi_colors[1][n - 100];
1549
+ else if ((n === 38 || n === 48) && t.length > 0) {
1550
+ let e = n === 38, r = t.shift();
1551
+ if (r === "5" && t.length > 0) {
1552
+ let n = parseInt(t.shift(), 10);
1553
+ n >= 0 && n <= 255 && (e ? this.fg = this.palette_256[n] : this.bg = this.palette_256[n]);
1554
+ }
1555
+ if (r === "2" && t.length > 2) {
1556
+ let n = parseInt(t.shift(), 10), r = parseInt(t.shift(), 10), i = parseInt(t.shift(), 10);
1557
+ if (n >= 0 && n <= 255 && r >= 0 && r <= 255 && i >= 0 && i <= 255) {
1558
+ let t = {
1559
+ rgb: [
1560
+ n,
1561
+ r,
1562
+ i
1563
+ ],
1564
+ class_name: "truecolor"
1565
+ };
1566
+ e ? this.fg = t : this.bg = t;
1567
+ }
1568
+ }
1569
+ }
1570
+ }
1571
+ }
1572
+ transform_to_html(e) {
1573
+ let t = e.text;
1574
+ if (t.length === 0 || (t = this.escape_txt_for_html(t), !e.bold && !e.italic && !e.faint && !e.underline && e.fg === null && e.bg === null)) return t;
1575
+ let n = [], r = [], i = e.fg, a = e.bg;
1576
+ e.bold && n.push(this._boldStyle), e.faint && n.push(this._faintStyle), e.italic && n.push(this._italicStyle), e.underline && n.push(this._underlineStyle), this._use_classes ? (i && (i.class_name === "truecolor" ? n.push(`color:rgb(${i.rgb.join(",")})`) : r.push(`${i.class_name}-fg`)), a && (a.class_name === "truecolor" ? n.push(`background-color:rgb(${a.rgb.join(",")})`) : r.push(`${a.class_name}-bg`))) : (i && n.push(`color:rgb(${i.rgb.join(",")})`), a && n.push(`background-color:rgb(${a.rgb})`));
1577
+ let o = "", s = "";
1578
+ return r.length && (o = ` class="${r.join(" ")}"`), n.length && (s = ` style="${n.join(";")}"`), `<span${s}${o}>${t}</span>`;
1579
+ }
1580
+ process_hyperlink(e) {
1581
+ let t = e.url.split(":");
1582
+ return t.length < 1 || !this._url_allowlist[t[0]] ? "" : `<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`;
1583
+ }
1584
+ };
1585
+ function Un(e, ...t) {
1586
+ let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
1587
+ return new RegExp(n);
1588
+ }
1589
+ function Wn(e, ...t) {
1590
+ let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
1591
+ return new RegExp(n, "g");
1592
+ }
1593
+ var Gn, Kn, qn, Jn = new Hn();
1594
+ function G(e) {
1595
+ try {
1596
+ let t = document.createElement("div");
1597
+ return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
1598
+ } catch (n) {
1599
+ return t.error("Error parsing HTML content:", n), e;
1600
+ }
1601
+ }
1602
+ function Yn(e) {
1603
+ if (!e) return "";
1604
+ try {
1605
+ return G(Jn.ansi_to_html(e));
1606
+ } catch (n) {
1607
+ return t.error("Error converting ANSI to plain text:", n), e;
1608
+ }
1609
+ }
1610
+ //#endregion
1611
+ //#region src/core/errors/traceback-atom.ts
1612
+ var Xn = p(null);
1613
+ //#endregion
1614
+ //#region src/core/cells/logs.ts
1615
+ function Zn(e) {
1616
+ return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
1617
+ }
1618
+ var Qn = !1;
1619
+ function $n(e) {
1620
+ let t = [], n = [e.console].filter(Boolean).flat();
1621
+ for (let r of n) {
1622
+ let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
1623
+ if (n || i) {
1624
+ let n = r.channel === "stderr" || r.channel === "marimo-error";
1625
+ switch (r.channel) {
1626
+ case "stdout":
1627
+ case "stderr":
1628
+ case "marimo-error": {
1629
+ let a = d.asString(r.data), o = i ? G(a) : a;
1630
+ t.push({
1631
+ timestamp: r.timestamp || Date.now(),
1632
+ level: n ? "stderr" : "stdout",
1633
+ message: o,
1634
+ source: {
1635
+ type: "cell",
1636
+ cellId: e.cell_id
1637
+ }
1638
+ });
1639
+ break;
1640
+ }
1641
+ }
1642
+ }
1643
+ }
1644
+ if (t.forEach(er.log), n.length === 0 && P(e.output?.mimetype) && Array.isArray(e.output.data)) {
1645
+ e.output.data.forEach((t) => {
1646
+ er.log({
1647
+ level: "stderr",
1648
+ source: {
1649
+ type: "cell",
1650
+ cellId: e.cell_id
1651
+ },
1652
+ timestamp: e.timestamp ?? 0,
1653
+ message: JSON.stringify(t)
1654
+ });
1655
+ });
1656
+ let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = w.get(he) === "read";
1657
+ if (t.length > 0 && !Qn && n) {
1658
+ Qn = !0;
1659
+ let e = t.find((e) => e.traceback);
1660
+ o(e ? {
1661
+ title: "An internal error occurred",
1662
+ description: e.msg || "Click 'View' to see traceback",
1663
+ variant: "danger",
1664
+ action: E.createElement(oe, {
1665
+ altText: "View traceback",
1666
+ onClick: () => {
1667
+ w.set(Xn, {
1668
+ traceback: e.traceback,
1669
+ errorMessage: e.msg || "An internal error occurred"
1670
+ });
1671
+ }
1672
+ }, "View")
1673
+ } : {
1674
+ title: "An internal error occurred",
1675
+ description: "See console for details.",
1676
+ variant: "danger"
1677
+ });
1678
+ }
1679
+ }
1680
+ return t;
1681
+ }
1682
+ var er = { log: (e) => {
1683
+ let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
1684
+ console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${tr(e.timestamp)}]`, `(${Zn(e.source)}) ${e.message}`);
1685
+ } };
1686
+ function tr(e) {
1687
+ try {
1688
+ return Vn(e).toLocaleTimeString(void 0, {
1689
+ hour12: !0,
1690
+ hour: "numeric",
1691
+ minute: "numeric",
1692
+ second: "numeric"
1693
+ });
1694
+ } catch {
1695
+ return "";
1696
+ }
1697
+ }
1698
+ //#endregion
1699
+ //#region src/components/editor/navigation/focus-utils.ts
1700
+ function nr(e, n) {
1701
+ let r = document.getElementById(L.create(e));
1702
+ r ? ir(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
1703
+ }
1704
+ function rr() {
1705
+ return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
1706
+ }
1707
+ function ir(e, n) {
1708
+ try {
1709
+ e.focus(n);
1710
+ } catch {
1711
+ t.warn("[CellFocusManager] element may not be focusable", e);
1712
+ }
1713
+ }
1714
+ //#endregion
1715
+ //#region src/utils/timeout.ts
1716
+ function ar(e, n) {
1717
+ let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
1718
+ if (o < r) {
1719
+ try {
1720
+ if (e()) return;
1721
+ } catch (e) {
1722
+ t.error(`Error executing function on attempt ${o + 1}, retrying`, { error: e });
1723
+ }
1724
+ o++, setTimeout(s, i);
1725
+ }
1726
+ };
1727
+ a > 0 ? setTimeout(s, a) : s();
1728
+ }
1729
+ //#endregion
1730
+ //#region src/core/cells/utils.ts
1731
+ function or(e, t, n) {
1732
+ return fr(e, t, n).length > 0;
1733
+ }
1734
+ function sr(e) {
1735
+ return e.cellIds.map((t) => e.cellData[t]);
1736
+ }
1737
+ function cr(e) {
1738
+ let { cellIds: t, cellData: n } = e, r = [];
1739
+ for (let e of t) n[e].config.disabled && r.push(e);
1740
+ return r;
1741
+ }
1742
+ function lr(e) {
1743
+ let { cellIds: t, cellData: n } = e, r = [];
1744
+ for (let e of t) n[e].config.disabled || r.push(e);
1745
+ return r;
1746
+ }
1747
+ function ur(e) {
1748
+ return e.history.length > 0;
1749
+ }
1750
+ function dr(e) {
1751
+ let t = e.history[e.history.length - 1];
1752
+ return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
1753
+ }
1754
+ function fr(e, t, n) {
1755
+ let { cellIds: r, cellData: i } = e;
1756
+ return r.filter((e) => {
1757
+ let r = Je(t, e);
1758
+ return r.status === "idle" ? mr(r) || hr({
1759
+ freshness: n(e),
1760
+ interrupted: r.outcome === "interrupted",
1761
+ disabled: i[e].config.disabled,
1762
+ blocked: r.blocked
1763
+ }) : pr(t.executions, e) && n(e).sourceChanged;
1764
+ });
1765
+ }
1766
+ function pr(e, t) {
1767
+ let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
1768
+ return r !== void 0 && r.status !== "completed";
1769
+ }
1770
+ function mr({ status: e, outcome: t }) {
1771
+ return t === null && e !== "queued" && e !== "running";
1772
+ }
1773
+ function hr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
1774
+ return e.sourceChanged || t || e.inputsChanged && !(n || r);
1775
+ }
1776
+ function gr({ errored: e, stopped: t }) {
1777
+ return {
1778
+ published: !0,
1779
+ "has-error": e,
1780
+ stopped: t
1781
+ };
1782
+ }
1783
+ function _r({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
1784
+ let a = P(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
1785
+ return (e || t || n || a) && !o;
1786
+ }
1787
+ //#endregion
1788
+ //#region src/core/network/requests.ts
1789
+ var vr = p(null);
1790
+ function yr() {
1791
+ let e = h(vr);
1792
+ return T(e, "useRequestClient() requires setting requestClientAtom."), e;
1793
+ }
1794
+ function br() {
1795
+ let e = w.get(vr);
1796
+ return T(e, "getRequestClient() requires requestClientAtom to be set."), e;
1797
+ }
1798
+ //#endregion
1799
+ //#region src/utils/storage/storage.ts
1800
+ var xr = class {
1801
+ store = /* @__PURE__ */ new Map();
1802
+ get length() {
1803
+ return this.store.size;
1804
+ }
1805
+ clear() {
1806
+ this.store.clear();
1807
+ }
1808
+ getItem(e) {
1809
+ return this.store.get(e) || null;
1810
+ }
1811
+ key(e) {
1812
+ return [...this.store.keys()][e] || null;
1813
+ }
1814
+ removeItem(e) {
1815
+ this.store.delete(e);
1816
+ }
1817
+ setItem(e, t) {
1818
+ this.store.set(e, t);
1819
+ }
1820
+ };
1821
+ function Sr() {
1822
+ let { hasLocalStorage: e, hasSessionStorage: t } = ye();
1823
+ return e ? window.localStorage : t ? window.sessionStorage : new xr();
1824
+ }
1825
+ var Cr = Sr(), wr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Tr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Er = /^data:image\//i, Dr = ["avatars.githubusercontent.com"];
1826
+ function Or(e) {
1827
+ return Er.test(e) ? [{
1828
+ type: "image",
1829
+ url: e
1830
+ }] : e.split(wr).filter((e) => e !== "").map((e) => wr.test(e) ? Tr.test(e) || Er.test(e) || Dr.some((t) => e.includes(t)) ? {
1831
+ type: "image",
1832
+ url: e
1833
+ } : {
1834
+ type: "url",
1835
+ url: e
1836
+ } : {
1837
+ type: "text",
1838
+ value: e
1839
+ });
1840
+ }
1841
+ //#endregion
1842
+ //#region src/utils/json/json-parser.ts
1843
+ var kr = new RegExp(wr.source, "g");
1844
+ BigInt.prototype.toJSON = function() {
1845
+ return JSON.rawJSON(this.toString());
1846
+ };
1847
+ function Ar(e) {
1848
+ try {
1849
+ return JSON.parse(e, (e, t) => Pr(t));
1850
+ } catch {}
1851
+ if (e == null || e === "") return {};
1852
+ try {
1853
+ return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : Pr(t) : Pr(t));
1854
+ } catch {
1855
+ return {};
1856
+ }
1857
+ }
1858
+ function jr(e) {
1859
+ if (e.length === 0) return "";
1860
+ let t = Object.keys(e[0]);
1861
+ return [
1862
+ `| ${t.join(" | ")} |`,
1863
+ `|${t.map(() => "---").join("|")}|`,
1864
+ ...e.map((e) => `| ${t.map((t) => Mr(e[t])).join(" | ")} |`)
1865
+ ].join("\n");
1866
+ }
1867
+ function Mr(e) {
1868
+ if (e == null) return "";
1869
+ if (Array.isArray(e) || typeof e == "object") return Nr(JSON.stringify(e));
1870
+ let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
1871
+ t = t.replaceAll(n, (e) => {
1872
+ let t = `__MDLINK_${i++}__`;
1873
+ return r.set(t, e), t;
1874
+ }), t = t.replaceAll(kr, "[$1]($1)");
1875
+ for (let [e, n] of r) t = t.replace(e, n);
1876
+ return Nr(t);
1877
+ }
1878
+ function Nr(e) {
1879
+ return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
1880
+ }
1881
+ function Pr(e) {
1882
+ return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
1883
+ }
1884
+ var Fr = new class {
1885
+ getFilename() {
1886
+ return this.getSearchParam("filename");
1887
+ }
1888
+ setFilename(e) {
1889
+ this.setSearchParam("filename", e);
1890
+ }
1891
+ getCodeFromSearchParam() {
1892
+ return this.getSearchParam("code");
1893
+ }
1894
+ getCodeFromHash() {
1895
+ let e = window.location.hash;
1896
+ return e.startsWith("#code/") ? e.slice(6) : null;
1897
+ }
1898
+ setCodeForHash(e) {
1899
+ window.location.hash = `#code/${e}`;
1900
+ }
1901
+ setSearchParam(e, t) {
1902
+ let n = new URL(window.location.href);
1903
+ n.searchParams.set(e, t), window.history.replaceState({}, "", n.toString());
1904
+ }
1905
+ getSearchParam(e) {
1906
+ return new URL(window.location.href).searchParams.get(e);
1907
+ }
1908
+ }();
1909
+ //#endregion
1910
+ //#region src/core/dom/htmlUtils.ts
1911
+ function Ir(e) {
1912
+ return Ar(e ?? "");
1913
+ }
1914
+ function Lr(e) {
1915
+ return se.mapValues(e.dataset, (e) => typeof e == "string" ? Ir(e) : e);
1916
+ }
1917
+ function Rr(e, t) {
1918
+ let n = e.parentElement ? pn.parse(e.parentElement) : void 0;
1919
+ return n && t.has(n) ? t.lookupValue(n) : Ir(e.dataset.initialValue);
1920
+ }
1921
+ function zr() {
1922
+ if (ee()) return document.title || null;
1923
+ if (_e()) {
1924
+ let e = Fr.getFilename();
1925
+ if (e) return e;
1926
+ }
1927
+ let e = document.querySelector("marimo-filename");
1928
+ ge(e, "marimo-filename tag not found");
1929
+ let t = e.innerHTML;
1930
+ return t.length === 0 ? null : t;
1931
+ }
1932
+ //#endregion
1933
+ //#region src/core/saving/file-state.ts
1934
+ var K = p(zr());
1935
+ p(null);
1936
+ var Br = p(null);
1937
+ p(void 0);
1938
+ //#endregion
1939
+ //#region src/utils/storage/typed.ts
1940
+ var Vr = class {
1941
+ defaultValue;
1942
+ storage;
1943
+ constructor(e, t = Cr) {
1944
+ this.defaultValue = e, this.storage = t;
1945
+ }
1946
+ get(e) {
1947
+ try {
1948
+ let t = this.storage.getItem(e);
1949
+ return t ? JSON.parse(t) : this.defaultValue;
1950
+ } catch {
1951
+ return this.defaultValue;
1952
+ }
1953
+ }
1954
+ set(e, t) {
1955
+ this.storage.setItem(e, JSON.stringify(t));
1956
+ }
1957
+ remove(e) {
1958
+ this.storage.removeItem(e);
1959
+ }
1960
+ }, Hr = class {
1961
+ schema;
1962
+ getDefaultValue;
1963
+ storage;
1964
+ constructor(e, t, n = Cr) {
1965
+ this.schema = e, this.getDefaultValue = t, this.storage = n;
1966
+ }
1967
+ get(e) {
1968
+ try {
1969
+ let n = this.storage.getItem(e);
1970
+ if (n == null) return this.getDefaultValue();
1971
+ let r = this.schema.safeParse(JSON.parse(n));
1972
+ return r.success ? r.data : (t.warn("Error parsing zod local storage", r.error), this.getDefaultValue());
1973
+ } catch (e) {
1974
+ return t.warn("Error getting zod local storage", e), this.getDefaultValue();
1975
+ }
1976
+ }
1977
+ set(e, t) {
1978
+ this.storage.setItem(e, JSON.stringify(t));
1979
+ }
1980
+ remove(e) {
1981
+ this.storage.removeItem(e);
1982
+ }
1983
+ }, Ur = class extends Hr {
1984
+ filename;
1985
+ unsubscribeFromFilename;
1986
+ constructor(e, t, n) {
1987
+ let r = w.get(K);
1988
+ super(t, n), this.filename = r;
1989
+ try {
1990
+ this.unsubscribeFromFilename = w.sub(K, () => {
1991
+ let t = w.get(K);
1992
+ this.handleFilenameChange(e, t);
1993
+ });
1994
+ } catch {
1995
+ this.unsubscribeFromFilename = null;
1996
+ }
1997
+ }
1998
+ get(e) {
1999
+ return super.get(this.createScopedKey(e, this.filename));
2000
+ }
2001
+ set(e, t) {
2002
+ super.set(this.createScopedKey(e, this.filename), t);
2003
+ }
2004
+ remove(e) {
2005
+ super.remove(this.createScopedKey(e, this.filename));
2006
+ }
2007
+ createScopedKey(e, t) {
2008
+ return t ? `${e}:${t}` : e;
2009
+ }
2010
+ handleFilenameChange(e, t) {
2011
+ if (t && t !== this.filename) {
2012
+ let n = this.get(e);
2013
+ this.remove(e), this.filename = t, this.set(e, n);
2014
+ }
2015
+ }
2016
+ dispose() {
2017
+ this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
2018
+ }
2019
+ }, q = {
2020
+ VariableName: "VariableName",
2021
+ FunctionDefinition: "FunctionDefinition",
2022
+ ClassDefinition: "ClassDefinition",
2023
+ LambdaExpression: "LambdaExpression",
2024
+ ParamList: "ParamList",
2025
+ Decorator: "Decorator",
2026
+ AssignStatement: "AssignStatement",
2027
+ ForStatement: "ForStatement",
2028
+ ImportStatement: "ImportStatement",
2029
+ TryStatement: "TryStatement",
2030
+ WithStatement: "WithStatement",
2031
+ TupleExpression: "TupleExpression",
2032
+ ArrayExpression: "ArrayExpression",
2033
+ ParenthesizedExpression: "ParenthesizedExpression",
2034
+ CallExpression: "CallExpression",
2035
+ ArgList: "ArgList",
2036
+ AssignOp: "AssignOp",
2037
+ ArrayComprehensionExpression: "ArrayComprehensionExpression",
2038
+ SetComprehensionExpression: "SetComprehensionExpression",
2039
+ DictionaryComprehensionExpression: "DictionaryComprehensionExpression",
2040
+ ComprehensionExpression: "ComprehensionExpression",
2041
+ Comment: "Comment",
2042
+ String: "String",
2043
+ FormatString: "FormatString"
2044
+ }, J = {
2045
+ For: "for",
2046
+ In: "in",
2047
+ As: "as",
2048
+ Import: "import"
2049
+ }, Wr = /* @__PURE__ */ new Set([
2050
+ q.FunctionDefinition,
2051
+ q.LambdaExpression,
2052
+ q.ArrayComprehensionExpression,
2053
+ q.SetComprehensionExpression,
2054
+ q.DictionaryComprehensionExpression,
2055
+ q.ComprehensionExpression,
2056
+ q.ClassDefinition
2057
+ ]);
2058
+ q.Comment, q.String, q.FormatString;
2059
+ //#endregion
2060
+ //#region src/core/codemirror/utils.ts
2061
+ function Gr(e) {
2062
+ e && e.dispatch({ selection: {
2063
+ anchor: e.state.doc.length,
2064
+ head: e.state.doc.length
2065
+ } });
2066
+ }
2067
+ function Kr(e) {
2068
+ let t = e.dom.closest(".marimo-cell");
2069
+ t && requestAnimationFrame(() => {
2070
+ t.scrollIntoView({
2071
+ behavior: "instant",
2072
+ block: "nearest",
2073
+ inline: "nearest"
2074
+ });
2075
+ });
2076
+ }
2077
+ //#endregion
2078
+ //#region src/core/codemirror/go-to-definition/commands.ts
2079
+ var qr = /* @__PURE__ */ new Set([q.ClassDefinition]);
2080
+ function Jr(e, t) {
2081
+ requestAnimationFrame(() => {
2082
+ e.focus(), e.dispatch({
2083
+ selection: {
2084
+ anchor: t,
2085
+ head: t
2086
+ },
2087
+ effects: fe.scrollIntoView(t, { y: "center" })
2088
+ });
2089
+ }), Kr(e);
2090
+ }
2091
+ function Yr(e, t) {
2092
+ let n = ue(e), r = null;
2093
+ return n.iterate({ enter: (n) => {
2094
+ if (r !== null) return !1;
2095
+ if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
2096
+ if (n.name === q.Comment || n.name === q.String) return !1;
2097
+ } }), r;
2098
+ }
2099
+ function Xr(e, t) {
2100
+ let n = [], r = e.resolveInner(t, 0);
2101
+ for (; r;) Wr.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
2102
+ id: r.from,
2103
+ type: r.name
2104
+ })), r = r.parent;
2105
+ return n.push({
2106
+ id: -1,
2107
+ type: "global"
2108
+ }), n;
2109
+ }
2110
+ function Y(e, t, n) {
2111
+ e.push({
2112
+ scopeId: t,
2113
+ from: n
2114
+ });
2115
+ }
2116
+ function Zr(e, t) {
2117
+ if (e.firstChild()) do
2118
+ t(e.node);
2119
+ while (e.nextSibling());
2120
+ }
2121
+ function Qr(e, t) {
2122
+ let { state: n, variableName: r, scopeId: i, declarations: a } = t;
2123
+ switch (e.name) {
2124
+ case q.VariableName:
2125
+ n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
2126
+ break;
2127
+ case q.TupleExpression:
2128
+ case q.ArrayExpression: {
2129
+ let n = e.node.cursor();
2130
+ n.firstChild();
2131
+ do
2132
+ Qr(n, t);
2133
+ while (n.nextSibling());
2134
+ break;
2135
+ }
2136
+ }
2137
+ }
2138
+ function $r(e, t) {
2139
+ let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
2140
+ o.firstChild();
2141
+ do {
2142
+ if (o.name !== q.ParamList) continue;
2143
+ let e = o.node.cursor();
2144
+ e.firstChild();
2145
+ do
2146
+ e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
2147
+ while (e.nextSibling());
2148
+ } while (o.nextSibling());
2149
+ }
2150
+ function ei(e, t) {
2151
+ let n = e.cursor();
2152
+ n.firstChild();
2153
+ let r = !1;
2154
+ do
2155
+ if (n.name === J.For) r = !0;
2156
+ else if (r && n.name === J.In) break;
2157
+ else r && Qr(n, t);
2158
+ while (n.nextSibling());
2159
+ }
2160
+ function ti(e, t) {
2161
+ let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Wr.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
2162
+ switch (s) {
2163
+ case q.FunctionDefinition:
2164
+ case q.ClassDefinition: {
2165
+ let t = e.cursor();
2166
+ t.firstChild();
2167
+ do
2168
+ if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
2169
+ Y(a, i[i.length - 1] ?? -1, t.from);
2170
+ break;
2171
+ }
2172
+ while (t.nextSibling());
2173
+ s === q.FunctionDefinition && $r(e, {
2174
+ state: n,
2175
+ variableName: r,
2176
+ scopeId: c,
2177
+ declarations: a
2178
+ });
2179
+ break;
2180
+ }
2181
+ case q.LambdaExpression:
2182
+ $r(e, {
2183
+ state: n,
2184
+ variableName: r,
2185
+ scopeId: c,
2186
+ declarations: a
2187
+ });
2188
+ break;
2189
+ case q.ArrayComprehensionExpression:
2190
+ case q.DictionaryComprehensionExpression:
2191
+ case q.SetComprehensionExpression:
2192
+ case q.ComprehensionExpression:
2193
+ case q.ForStatement:
2194
+ ei(e, {
2195
+ state: n,
2196
+ variableName: r,
2197
+ scopeId: u,
2198
+ declarations: a
2199
+ });
2200
+ break;
2201
+ case q.AssignStatement: {
2202
+ let t = [], i = e.cursor();
2203
+ i.firstChild();
2204
+ do
2205
+ i.name === q.AssignOp && t.push(i.from);
2206
+ while (i.nextSibling());
2207
+ let o = t[t.length - 1];
2208
+ if (o === void 0) break;
2209
+ let s = e.cursor();
2210
+ s.firstChild();
2211
+ do
2212
+ s.from < o && Qr(s, {
2213
+ state: n,
2214
+ variableName: r,
2215
+ scopeId: u,
2216
+ declarations: a
2217
+ });
2218
+ while (s.nextSibling());
2219
+ break;
2220
+ }
2221
+ case q.ImportStatement: {
2222
+ let t = e.cursor();
2223
+ t.firstChild();
2224
+ let i = !1, o = null, s = () => {
2225
+ o?.matches && Y(a, u, o.from), o = null;
2226
+ };
2227
+ do
2228
+ t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
2229
+ from: t.from,
2230
+ matches: n.doc.sliceString(t.from, t.to) === r
2231
+ }) : t.name === "," && s());
2232
+ while (t.nextSibling());
2233
+ s();
2234
+ break;
2235
+ }
2236
+ case q.TryStatement:
2237
+ case q.WithStatement: {
2238
+ let t = e.cursor();
2239
+ t.firstChild();
2240
+ let i = !1;
2241
+ do
2242
+ t.name === J.As ? i = !0 : i && t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r && (Y(a, u, t.from), i = !1);
2243
+ while (t.nextSibling());
2244
+ break;
2245
+ }
2246
+ }
2247
+ Zr(o, (e) => {
2248
+ ti(e, {
2249
+ state: n,
2250
+ variableName: r,
2251
+ scopeStack: l,
2252
+ declarations: a
2253
+ });
2254
+ });
2255
+ }
2256
+ function ni(e, t, n) {
2257
+ let r = ue(e), i = [];
2258
+ ti(r, {
2259
+ state: e,
2260
+ variableName: t,
2261
+ scopeStack: [],
2262
+ declarations: i
2263
+ });
2264
+ let a = Math.max(0, Math.min(n, e.doc.length));
2265
+ for (let e of Xr(r, a)) {
2266
+ let t = i.filter((t) => t.scopeId === e.id).filter((t) => !qr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
2267
+ if (t) return t.from;
2268
+ }
2269
+ return null;
2270
+ }
2271
+ function ri(e, t, n) {
2272
+ let { state: r } = e, i = n === void 0 ? Yr(r, t) : ni(r, t, n);
2273
+ return i !== null && (Jr(e, i), !0);
2274
+ }
2275
+ function ii(e, t) {
2276
+ return Jr(e, e.state.doc.line(t).from), !0;
2277
+ }
2278
+ //#endregion
2279
+ //#region src/core/network/connection.ts
2280
+ var X = p({ state: A.NOT_STARTED });
2281
+ ie(null, (e, t) => t === null ? null : {
2282
+ phase: t.phase,
2283
+ logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
2284
+ });
2285
+ function ai() {
2286
+ return m(X, (e) => e.state === A.OPEN);
2287
+ }
2288
+ function oi() {
2289
+ return me() ? ai() : Promise.resolve();
2290
+ }
2291
+ p((e) => e(X).state === A.CONNECTING), p((e) => e(X).state === A.OPEN), p((e) => {
2292
+ let t = e(X);
2293
+ return t.state === A.OPEN || t.state === A.NOT_STARTED;
2294
+ }), p((e) => e(X).state === A.CLOSED);
2295
+ //#endregion
2296
+ //#region src/components/ui/checkbox.tsx
2297
+ var si = E.forwardRef((e, t) => {
2298
+ let r = (0, St.c)(13), i, a;
2299
+ r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
2300
+ let o;
2301
+ r[3] === i ? o = r[4] : (o = n("flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", i), r[3] = i, r[4] = o);
2302
+ let s;
2303
+ r[5] === Symbol.for("react.memo_cache_sentinel") ? (s = n("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), r[5] = s) : s = r[5];
2304
+ let c;
2305
+ r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, D.jsx)(Ne, {
2306
+ className: s,
2307
+ children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, D.jsx)(xe, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, D.jsx)(l, { className: "h-4 w-4" })
2308
+ }), r[6] = a.checked, r[7] = c);
2309
+ let u;
2310
+ return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, D.jsx)(je, {
2311
+ ref: t,
2312
+ className: o,
2313
+ ...a,
2314
+ children: c
2315
+ }), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
2316
+ });
2317
+ si.displayName = je.displayName;
2318
+ //#endregion
2319
+ //#region src/core/cells/scrollCellIntoView.ts
2320
+ function ci({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
2321
+ if (!n) return;
2322
+ let o = document.getElementById(L.create(e));
2323
+ if (!o) t.warn("scrollCellIntoView: element not found");
2324
+ else if (rr()) ir(o);
2325
+ else {
2326
+ if (r) ir(o);
2327
+ else {
2328
+ Bt.promote(e);
2329
+ let r = n.current?.editorView;
2330
+ if (!r) {
2331
+ t.warn("scrollCellIntoView: editor not found", e);
2332
+ return;
2333
+ }
2334
+ if (r.hasFocus || !document.hasFocus()) return;
2335
+ if (ar(() => (r.focus(), r.hasFocus), {
2336
+ retries: 5,
2337
+ delay: 20
2338
+ }), i === "top") r.dispatch({ selection: {
2339
+ anchor: 0,
2340
+ head: 0
2341
+ } });
2342
+ else if (i === "bottom") {
2343
+ let e = r.state.doc.line(r.state.doc.lines);
2344
+ r.dispatch({ selection: {
2345
+ anchor: e.from,
2346
+ head: e.from
2347
+ } });
2348
+ } else a && ri(r, a);
2349
+ }
2350
+ o.scrollIntoView({
2351
+ behavior: "smooth",
2352
+ block: "nearest"
2353
+ });
2354
+ }
2355
+ }
2356
+ function li() {
2357
+ let e = document.getElementById("App");
2358
+ e?.scrollTo({
2359
+ top: e.scrollHeight,
2360
+ behavior: "smooth"
2361
+ });
2362
+ }
2363
+ function ui() {
2364
+ document.getElementById("App")?.scrollTo({
2365
+ top: 0,
2366
+ behavior: "smooth"
2367
+ });
2368
+ }
2369
+ function di(e) {
2370
+ let t = document.getElementById(L.create(e));
2371
+ return t?.scrollIntoView({
2372
+ behavior: "smooth",
2373
+ block: "center"
2374
+ }), t;
2375
+ }
2376
+ //#endregion
2377
+ //#region src/core/cells/cells.ts
2378
+ function fi(e) {
2379
+ let t = {
2380
+ column: 0,
2381
+ hide_code: !1,
2382
+ disabled: !1,
2383
+ expand_output: !1
2384
+ };
2385
+ return {
2386
+ ...e,
2387
+ cellData: {
2388
+ [I]: Nn({
2389
+ id: I,
2390
+ config: t
2391
+ }),
2392
+ ...e.cellData
2393
+ },
2394
+ cellRuntime: {
2395
+ [I]: V(),
2396
+ ...e.cellRuntime
2397
+ },
2398
+ cellHandles: {
2399
+ [I]: (0, E.createRef)(),
2400
+ ...e.cellHandles
2401
+ }
2402
+ };
2403
+ }
2404
+ function pi() {
2405
+ return fi({
2406
+ cellIds: [],
2407
+ cellData: {},
2408
+ cellRuntime: {},
2409
+ cellHandles: {},
2410
+ history: [],
2411
+ scrollKey: null,
2412
+ cellLogs: []
2413
+ });
2414
+ }
2415
+ var { reducer: mi, createActions: hi, useActions: gi, valueAtom: Z } = le(pi, {
2416
+ prepareForRun: (e, t) => Q({
2417
+ state: e,
2418
+ cellId: t.cellId,
2419
+ cellReducer: (e) => ({
2420
+ ...e,
2421
+ debuggerActive: !1
2422
+ })
2423
+ }),
2424
+ handleCellMessage: (e, t) => {
2425
+ let n = t.cell_id, r = Q({
2426
+ state: e,
2427
+ cellId: n,
2428
+ cellReducer: (e) => $t(e, t)
2429
+ });
2430
+ return {
2431
+ ...r,
2432
+ cellLogs: [...r.cellLogs, ...$n(t)]
2433
+ };
2434
+ },
2435
+ addLogs: (e, t) => ({
2436
+ ...e,
2437
+ cellLogs: [...e.cellLogs, ...t.logs]
2438
+ }),
2439
+ reconcileDocument: (e, t) => {
2440
+ let n = In(e, t);
2441
+ for (let t of e.cellIds) t in n.cellData || ji(t);
2442
+ return n;
2443
+ },
2444
+ setStdinResponse: (e, n) => {
2445
+ let { cellId: r, response: i, outputIndex: a } = n;
2446
+ return Q({
2447
+ state: e,
2448
+ cellId: r,
2449
+ cellReducer: (e) => {
2450
+ let n = [...e.consoleOutputs], r = n[a];
2451
+ return r == null || r.channel !== "stdin" ? (t.warn("Expected stdin output"), e) : (n[a] = {
2452
+ channel: "stdin",
2453
+ mimetype: r.mimetype,
2454
+ data: r.data,
2455
+ timestamp: r.timestamp,
2456
+ id: r.id,
2457
+ input_id: r.input_id,
2458
+ response: r.mimetype === "text/password" ? "" : i
2459
+ }, {
2460
+ ...e,
2461
+ consoleOutputs: n
2462
+ });
2463
+ }
2464
+ });
2465
+ },
2466
+ resetCellRuntimes: (e) => {
2467
+ let t = _e(), n = { ...e.cellRuntime };
2468
+ for (let r of [...e.cellIds, I]) {
2469
+ let i = e.cellRuntime[r];
2470
+ n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : V();
2471
+ }
2472
+ return {
2473
+ ...e,
2474
+ cellRuntime: n
2475
+ };
2476
+ },
2477
+ scrollToTarget: (e) => {
2478
+ let t = e.scrollKey;
2479
+ if (t === null) return e;
2480
+ let n = t;
2481
+ return ci({
2482
+ cellId: n,
2483
+ cell: e.cellHandles[n],
2484
+ isCodeHidden: zn(e.cellData[n]?.config.hide_code, w.get(H), n),
2485
+ codeFocus: void 0,
2486
+ variableName: void 0
2487
+ }), {
2488
+ ...e,
2489
+ scrollKey: null
2490
+ };
2491
+ },
2492
+ foldAll: (e) => (Ft(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2493
+ unfoldAll: (e) => (It(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2494
+ clearLogs: (e) => ({
2495
+ ...e,
2496
+ cellLogs: []
2497
+ }),
2498
+ clearCellOutput: (e, t) => {
2499
+ let { cellId: n } = t;
2500
+ return Q({
2501
+ state: e,
2502
+ cellId: n,
2503
+ cellReducer: (e) => ({
2504
+ ...e,
2505
+ output: null,
2506
+ consoleOutputs: []
2507
+ })
2508
+ });
2509
+ },
2510
+ clearCellConsoleOutput: (e, t) => {
2511
+ let { cellId: n } = t;
2512
+ return Q({
2513
+ state: e,
2514
+ cellId: n,
2515
+ cellReducer: (e) => ({
2516
+ ...e,
2517
+ consoleOutputs: e.consoleOutputs.filter((e) => e.channel === "stdin" && e.response == null)
2518
+ })
2519
+ });
2520
+ },
2521
+ clearAllCellOutputs: (e) => {
2522
+ let t = { ...e.cellRuntime };
2523
+ for (let n of e.cellIds) t[n] = {
2524
+ ...t[n],
2525
+ output: null,
2526
+ consoleOutputs: []
2527
+ };
2528
+ return {
2529
+ ...e,
2530
+ cellRuntime: t
2531
+ };
2532
+ }
2533
+ });
2534
+ function Q({ state: e, cellId: n, cellReducer: r }) {
2535
+ return n in e.cellRuntime ? {
2536
+ ...e,
2537
+ cellRuntime: {
2538
+ ...e.cellRuntime,
2539
+ [n]: r(e.cellRuntime[n])
2540
+ }
2541
+ } : (t.warn(`Cell ${n} not found in state`), e);
2542
+ }
2543
+ var _i = hi((e) => {
2544
+ w.set(Z, (t) => mi(t, e));
2545
+ }).addLogs, $ = p((e) => e(Z).cellIds);
2546
+ p((e) => e($).length === 1), p((e) => cr(e(Z)).length > 0), p((e) => lr(e(Z)).length > 0), p((e) => ur(e(Z))), p((e) => dr(e(Z))), p((e) => or(e(Z), e(M), e(ft)));
2547
+ var vi = p((e) => {
2548
+ let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
2549
+ return t.map((e) => {
2550
+ let t = n[e], { name: i } = r[e];
2551
+ if (P(t.output?.mimetype)) {
2552
+ T(Array.isArray(t.output.data), "Expected array data");
2553
+ let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
2554
+ if (n.length > 0) return {
2555
+ output: {
2556
+ ...t.output,
2557
+ data: n
2558
+ },
2559
+ cellId: e,
2560
+ cellName: i
2561
+ };
2562
+ }
2563
+ return null;
2564
+ }).filter(Boolean);
2565
+ }), yi = x(p((e) => {
2566
+ let t = {};
2567
+ for (let [n, r] of se.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
2568
+ return t;
2569
+ })), bi = p((e) => {
2570
+ let t = e($), n = e(Di);
2571
+ return At(t.map((e) => n[e].outline));
2572
+ });
2573
+ p((e) => e(vi).length);
2574
+ var xi = x(p((e) => {
2575
+ let { cellIds: t, cellData: n } = e(Z);
2576
+ return se.fromEntries(t.map((e) => [e, n[e]?.name]));
2577
+ }));
2578
+ p((e) => e(Z).scrollKey);
2579
+ var Si = () => h($), Ci = () => h(xi), wi = () => w.get(Z), Ti = () => w.get(Z).cellIds, Ei = () => {
2580
+ let { cellIds: e, cellData: t } = w.get(Z);
2581
+ return e.map((e) => t[e]?.name).filter(Boolean);
2582
+ };
2583
+ _(g(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
2584
+ var Di = p((e) => e(Z).cellRuntime);
2585
+ p((e) => e(Z).cellIds.length > 0);
2586
+ var Oi = v((e) => p((t) => t(Z).cellData[e])), ki = v((e) => p((t) => t(Z).cellRuntime[e])), Ai = v((e) => p((t) => t(Z).cellHandles[e]));
2587
+ function ji(e) {
2588
+ Oi.remove(e), ki.remove(e), Ai.remove(e);
2589
+ }
2590
+ var Mi = (e) => {
2591
+ let { cellHandles: t } = w.get(Z);
2592
+ return t[e].current?.editorView;
2593
+ }, Ni = (e) => (Bt.promote(e), Mi(e));
2594
+ function Pi() {
2595
+ return gi();
2596
+ }
2597
+ //#endregion
2598
+ //#region src/core/errors/error-entries.ts
2599
+ function Fi(e) {
2600
+ if (Vt(e.mimetype)) {
2601
+ if (!Array.isArray(e.data)) return null;
2602
+ let t = e.data.filter((e) => !e.type.includes("ancestor"));
2603
+ return t.length === 0 ? null : { errorData: t };
2604
+ }
2605
+ return N(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
2606
+ errorData: [],
2607
+ tracebackHtml: e.data
2608
+ } : null;
2609
+ }
2610
+ function Ii(e) {
2611
+ return e.some((e) => "traceback" in e && e.traceback);
2612
+ }
2613
+ function Li(e) {
2614
+ let t = e?.find((e) => N(e.mimetype));
2615
+ if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
2616
+ }
2617
+ function Ri(e, t) {
2618
+ if (e.tracebackHtml) return e.tracebackHtml;
2619
+ if (!Ii(e.errorData)) return Li(t);
2620
+ }
2621
+ function zi(e) {
2622
+ let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
2623
+ for (let [e, a] of t.entries()) {
2624
+ let t = n[a], o = t.output;
2625
+ if (!o || !P(o.mimetype)) continue;
2626
+ let s = Fi(o);
2627
+ if (!s) continue;
2628
+ let c = jn(r[a].name, e), l = o.code ?? r[a].code;
2629
+ i.push({
2630
+ cellId: a,
2631
+ cellName: c,
2632
+ cellCode: l,
2633
+ errorData: s.errorData,
2634
+ tracebackHtml: Ri(s, t.consoleOutputs)
2635
+ });
2636
+ }
2637
+ return i;
2638
+ }
2639
+ function Bi(e) {
2640
+ return e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
2641
+ }
2642
+ function Vi(e) {
2643
+ let t = Bi(e);
2644
+ return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
2645
+ }
2646
+ function Hi(e) {
2647
+ let t = [e.cellName];
2648
+ return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Vi).join("\n\n")), t.join("\n\n");
2649
+ }
2650
+ //#endregion
2651
+ export { G as $, ii as A, on as At, Ar as B, lt as Bt, li as C, mn as Ct, X as D, pn as Dt, si as E, un as Et, K as F, kt as Ft, vr as G, vt as Gt, Or as H, _t as Ht, Br as I, wt as It, sr as J, A as Jt, yr as K, Je as Kt, Ir as L, yt as Lt, Ur as M, en as Mt, Vr as N, tn as Nt, ai as O, fn as Ot, Hr as P, Mt as Pt, Yn as Q, Lr as R, M as Rt, ci as S, dn as St, ui as T, I as Tt, Cr as U, mt as Ut, jr as V, xt as Vt, br as W, gt as Wt, _r as X, be as Xt, gr as Y, xe as Yt, nr as Z, mi as _, En as _t, _i as a, Ln as at, Ci as b, Sn as bt, hi as c, Mn as ct, Ei as d, R as dt, Hn as et, Ti as f, wn as ft, bi as g, Dn as gt, Z as h, Tn as ht, zi as i, Rn as it, Gr as j, nn as jt, oi as k, an as kt, Ni as l, kn as lt, pi as m, Cn as mt, Hi as n, Bn as nt, Oi as o, jn as ot, wi as p, z as pt, mr as q, Re as qt, Vi as r, H as rt, $ as s, An as st, Bi as t, zn as tt, Mi as u, hn as ut, ji as v, B as vt, di as w, L as wt, Pi as x, xn as xt, Si as y, gn as yt, Rr as z, ft as zt };