@marimo-team/islands 0.25.3-dev2 → 0.25.3-dev200

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 (690) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CNSxdKyJ.js → ConnectedDataExplorerComponent-BsWiIPFk.js} +22 -20
  2. package/dist/{ErrorBoundary-DWEpirf3.js → ErrorBoundary-UWARECs-.js} +19 -19
  3. package/dist/{abnfDiagram-VCTEODGH-DQDjNXt3.js → abnfDiagram-VCTEODGH-I2x4Yu25.js} +2 -2
  4. package/dist/any-language-editor-BVFHDDQ3.js +75 -0
  5. package/dist/{architectureDiagram-5GKGNRK7-Nmls7Wxn.js → architectureDiagram-5GKGNRK7-1bSQMKzK.js} +1 -1
  6. package/dist/{arrays-CN1djC4k.js → arrays-DoQ-AILx.js} +15 -27
  7. package/dist/assets/__vite-browser-external-BCJsx8QS.js +1 -0
  8. package/dist/assets/worker-DodjWT_Z.js +113 -0
  9. package/dist/{button-CvjkwdSk.js → button-BQRdqQi1.js} +199 -192
  10. package/dist/{capabilities-CQ5IjhzL.js → capabilities-C2QUNRXi.js} +2 -2
  11. package/dist/{chat-ui-BDpymeoe.js → chat-ui-DXDoSuS4.js} +667 -667
  12. package/dist/{check-EDwSwP89.js → check-C9Mp9eCK.js} +1 -1
  13. package/dist/{chunk-IMKFNOWR-CoIFEo-1.js → chunk-IMKFNOWR-fsCGAJ9G.js} +1 -1
  14. package/dist/{chunk-SHT3W25Y-lHiGx3ZC.js → chunk-SHT3W25Y-D2STW4hj.js} +1 -1
  15. package/dist/{chunk-SVP7TREG-BvsHIrY_.js → chunk-SVP7TREG-CiY7cQG-.js} +1 -1
  16. package/dist/{chunk-TICWLB2K-BC8YIm_n.js → chunk-TICWLB2K-C_t5RBp9.js} +1 -1
  17. package/dist/{chunk-YOKDWASO-DPZk8vhS.js → chunk-YOKDWASO-DKplTrBY.js} +20 -20
  18. package/dist/{classDiagram-ZZMXUADV-Bt98lkkv.js → classDiagram-ZZMXUADV-B2JvZAP4.js} +2 -2
  19. package/dist/{classDiagram-v2-VYDZK3BY-D9bfbcC3.js → classDiagram-v2-VYDZK3BY-L8VsZG5A.js} +2 -2
  20. package/dist/{code-visibility-CLNfgCjd.js → code-visibility-33fxfX1p.js} +45 -49
  21. package/dist/{common-fyD_6mT2.js → common-D09oJJ8Z.js} +7354 -6884
  22. package/dist/{copy-icon-Ft7t9bqz.js → copy-icon-De584pZ4.js} +3 -3
  23. package/dist/{cynefinDiagram-5FMLGOSQ-CgWra7wt.js → cynefinDiagram-5FMLGOSQ-DdllC264.js} +1 -1
  24. package/dist/{dagre-GXQ25YYZ-CFZ8-35c.js → dagre-GXQ25YYZ-BaWHw4_f.js} +1 -1
  25. package/dist/{data-grid-overlay-editor-BmqASKep.js → data-grid-overlay-editor-lGsInXfR.js} +5 -5
  26. package/dist/{data-grid-types-BH_r7g7l.js → data-grid-types-0PJ-9N5n.js} +1 -1
  27. package/dist/{diagram-S7CK7UJ4-lCNQrW7d.js → diagram-S7CK7UJ4-pFt-tUDe.js} +1 -1
  28. package/dist/{diagram-UQ7AKVKN-CQPQ6pP_.js → diagram-UQ7AKVKN-DqGJiBp4.js} +1 -1
  29. package/dist/{diagram-VX7I27RA-Cf3b0llz.js → diagram-VX7I27RA-Dr-yzMjf.js} +1 -1
  30. package/dist/{diagram-Z3DM3KII-Bt4QLrpn.js → diagram-Z3DM3KII-8xzJzv-w.js} +1 -1
  31. package/dist/{dialog-CEBFZNyc.js → dialog-DVRfQuhD.js} +25 -25
  32. package/dist/{dist-F8Ep36rk.js → dist-B1M0bGO3.js} +1 -1
  33. package/dist/{dist-D6d86eNJ.js → dist-BA13RJj5.js} +1 -1
  34. package/dist/{dist-Bvs24R_E.js → dist-BJtmSgcE.js} +48 -48
  35. package/dist/{dist-CN_BeG2I.js → dist-Ba2VIn1K.js} +53 -53
  36. package/dist/{dist-PXYI_yuP.js → dist-Bj4bmwUm.js} +12 -12
  37. package/dist/{dist-DoE4XJBC.js → dist-BmS-ZGjl.js} +8626 -8626
  38. package/dist/{dist-BorMD-uX.js → dist-Bzogh7CW.js} +87 -87
  39. package/dist/{dist-CN8zI-XC.js → dist-CThPVKaP.js} +1385 -1382
  40. package/dist/{dist-DiDibOYr.js → dist-CTi5FTiV.js} +87 -87
  41. package/dist/{dist-diIx5qJW.js → dist-Ck_C32ye.js} +2 -2
  42. package/dist/{dist-BLfKmR-l.js → dist-D1fnFp1J.js} +1 -1
  43. package/dist/{dist-OR1OnN-y.js → dist-D3x9__Fu.js} +46 -46
  44. package/dist/{dist-BMQf5zIS.js → dist-D7mrh5sO.js} +36 -36
  45. package/dist/{dist-CSJ0MDRw.js → dist-D9Q3xjiP.js} +1 -1
  46. package/dist/{dist-BuaRHxOc.js → dist-DP60Ubh8.js} +2 -2
  47. package/dist/{dist-CSbh1PNP.js → dist-DTv9KkpW.js} +12 -12
  48. package/dist/{dist-D-wwqlzJ.js → dist-DVVwOfrD.js} +109 -109
  49. package/dist/{dist-C8fAKSH1.js → dist-DYXM73-k.js} +36 -36
  50. package/dist/{dist-DBtSl3sf.js → dist-DjeybPOb.js} +1 -1
  51. package/dist/{dist-CrSP_H1M.js → dist-DtGn9N4h.js} +197 -197
  52. package/dist/{dist-CLdpGQVr.js → dist-KN80qWCP.js} +2 -2
  53. package/dist/{dist-DpBpA_n1.js → dist-Lm-D-Vr6.js} +3 -3
  54. package/dist/{dist-Cg7gzw-a.js → dist-O0qFpEJh.js} +56 -56
  55. package/dist/{dist-CkTTIdBe.js → dist-OUle2RT7.js} +207 -207
  56. package/dist/{dist-BK4Oj99o.js → dist-T5rh6JvL.js} +1 -1
  57. package/dist/{dropdown-menu-CP_qCYHC.js → dropdown-menu-NlnsmNA6.js} +1481 -1433
  58. package/dist/{ebnfDiagram-PWID7BFC-D3NAyPFY.js → ebnfDiagram-PWID7BFC-Br04Wy-E.js} +2 -2
  59. package/dist/{erDiagram-RLTQ6QDP-Tlu09_Nm.js → erDiagram-RLTQ6QDP-D5-XVgvv.js} +1 -1
  60. package/dist/{error-banner-Da600cwz.js → error-banner-DxJ3s8YO.js} +89 -84
  61. package/dist/{cells-C8iCYvLU.js → error-entries-C2Ux0Fjt.js} +7970 -8605
  62. package/dist/{esm-D2gTsXEV.js → esm-Bbw_Njjx.js} +575 -575
  63. package/dist/{esm-AMFssoNp.js → esm-mDQNEFe_.js} +354 -354
  64. package/dist/feedback-button-B0CMhVv7.js +374 -0
  65. package/dist/{flowDiagram-HODETNUW-CAYbpJmV.js → flowDiagram-HODETNUW-CVl2kREF.js} +2 -2
  66. package/dist/{formats-BGh2thRc.js → formats-BCYthwyc.js} +3 -3
  67. package/dist/{ganttDiagram-EL5Y4UJY-BQT16JSc.js → ganttDiagram-EL5Y4UJY-Dh_4cBJZ.js} +2 -2
  68. package/dist/{glide-data-editor-BkjP14aq.js → glide-data-editor-CL535A5q.js} +370 -368
  69. package/dist/{glide-utils-DJyqh0EM.js → glide-utils-D98laidb.js} +16 -16
  70. package/dist/{globals-BN2O0F8N.js → globals-Bsr6T2yD.js} +3 -3
  71. package/dist/{highlighted-body-KPVGNVTW-zwjq21tf.js → highlighted-body-KPVGNVTW-3Ziwfz-V.js} +2 -2
  72. package/dist/{html-to-image-CZY1pIZH.js → html-to-image-CkH7vdBZ.js} +478 -381
  73. package/dist/{infoDiagram-27XIBGKW-XrDxhr0x.js → infoDiagram-27XIBGKW-BJ4vNcZE.js} +1 -1
  74. package/dist/{ishikawaDiagram-5VMMS53U-CD1muzov.js → ishikawaDiagram-5VMMS53U-B_Jy1Dsm.js} +1 -1
  75. package/dist/{kanban-definition-UXKFOSKX-Dg9W142_.js → kanban-definition-UXKFOSKX-C6MkS9vw.js} +1 -1
  76. package/dist/{label-BDKF3Afc.js → label-Qvw1E97W.js} +3 -3
  77. package/dist/{linear-Cnaq3Tfb.js → linear-DWERh7eI.js} +121 -73
  78. package/dist/{loader-BQOfjTIJ.js → loader-DOVB0Syl.js} +12 -12
  79. package/dist/main.js +9706 -7708
  80. package/dist/{mermaid-CiAXjLpA.js → mermaid-Bh918qrq.js} +52 -52
  81. package/dist/mermaid-HWGCJPDP-Du3-HPQA.js +2 -0
  82. package/dist/{mindmap-definition-YA3MSWOX-DgCidgYJ.js → mindmap-definition-YA3MSWOX-BP3ZTuir.js} +1 -1
  83. package/dist/{number-overlay-editor-BEBWJnbL.js → number-overlay-editor-CzbkG4E2.js} +3 -3
  84. package/dist/{objects-CzUgoMIF.js → objects-DCmMvZtn.js} +1 -3
  85. package/dist/{once-BtE-wKRL.js → once-NnpX_HnX.js} +1 -1
  86. package/dist/{pegDiagram-XKGWAZYB-coOYYKB6.js → pegDiagram-XKGWAZYB-nNGOQtnt.js} +2 -2
  87. package/dist/{pieDiagram-E7YTZNPT-BnXTc3bj.js → pieDiagram-E7YTZNPT-CpRz5BZz.js} +1 -1
  88. package/dist/precisionRound-DhAzeRcm.js +49 -0
  89. package/dist/{process-output-e4jj9Ijt.js → process-output-OujAtFW4.js} +4 -4
  90. package/dist/{quadrantDiagram-AXDQQJYC-Ccw0xMjN.js → quadrantDiagram-AXDQQJYC-Blrm7V7_.js} +1 -1
  91. package/dist/{railroadDiagram-O6MQD6OU-B28-u83n.js → railroadDiagram-O6MQD6OU-BqOEN4I0.js} +2 -2
  92. package/dist/{react-vega-BED0DjiB.js → react-vega-C4T9Rb_w.js} +12284 -12270
  93. package/dist/{requirementDiagram-BXWQKSXE-CdYCTMu0.js → requirementDiagram-BXWQKSXE-CEfg6vu9.js} +1 -1
  94. package/dist/{reveal-component-DK69bOki.js → reveal-component-CbEK0sNX.js} +733 -710
  95. package/dist/{select-BButFi-d.js → select-2KOiReNY.js} +536 -457
  96. package/dist/{sequenceDiagram-WJ2MYXX4-CM3aRAe_.js → sequenceDiagram-WJ2MYXX4-IOmpQcOi.js} +1 -1
  97. package/dist/{spec-BwarBpUJ.js → spec-Dkp64vVQ.js} +41 -11
  98. package/dist/{stateDiagram-D77RDMKH-DOZUMVj8.js → stateDiagram-D77RDMKH-tgU-EY9_.js} +2 -2
  99. package/dist/{stateDiagram-v2-MP3YSRHH-CISYxma6.js → stateDiagram-v2-MP3YSRHH-BofhG6q1.js} +2 -2
  100. package/dist/style.css +1 -1
  101. package/dist/{swimlanes-42K2YHIH-BkSppxp8.js → swimlanes-42K2YHIH-DW4vWDBd.js} +1 -1
  102. package/dist/{swimlanesDiagram-VR7AAH4N-c8G5pGxC.js → swimlanesDiagram-VR7AAH4N-BJcrqUJr.js} +2 -2
  103. package/dist/{swiper-component-DKntyn8p.js → swiper-component-BVfnhbnt.js} +2 -2
  104. package/dist/{time-BieKwdYS.js → time-BaMbJs4z.js} +18 -18
  105. package/dist/{timeline-definition-24CTP7MA-CaMQayqK.js → timeline-definition-24CTP7MA-D_QU3NGs.js} +1 -1
  106. package/dist/{toDate-BNJf01u1.js → toDate-BNDEXbfV.js} +77 -74
  107. package/dist/{toast-B9UMEi8u.js → toast-B5t9o6s_.js} +219 -201
  108. package/dist/{tooltip-BO1REbqs.js → tooltip-s4zZxwKe.js} +325 -301
  109. package/dist/{use-restore-focus-BEM7sFWl.js → use-restore-focus-BgDTd2tc.js} +1482 -1433
  110. package/dist/{useAsyncData-Deh5kszT.js → useAsyncData-ASDni9vH.js} +15 -14
  111. package/dist/{useDateFormatter-D8XruNGG.js → useDateFormatter-D3Tkfzej.js} +2 -2
  112. package/dist/{useDeepCompareMemoize-DXwzRINI.js → useDeepCompareMemoize-B1Ogyf53.js} +1 -1
  113. package/dist/{useIframeCapabilities-DBETvvPl.js → useIframeCapabilities-6a_yDNXp.js} +1 -1
  114. package/dist/{useLifecycle-j7D9uD1o.js → useLifecycle-Bfpa2m7k.js} +28 -25
  115. package/dist/{useTheme-CRnjkku0.js → useTheme-5TwyOh3B.js} +522 -314
  116. package/dist/{vega-component-DG29TAB7.js → vega-component-BHS9UOtC.js} +158 -158
  117. package/dist/{vega-embed-container-BNHE18G9.js → vega-embed-container--LYZqguO.js} +2 -2
  118. package/dist/{vega-loader.browser-DNST6uVf.js → vega-loader.browser-B9Pz0EGP.js} +298 -507
  119. package/dist/{vennDiagram-4TSXK5OY-CF8pfaK3.js → vennDiagram-4TSXK5OY-YFYsNIAh.js} +1 -1
  120. package/dist/{wardleyDiagram-VM6X3IG4-dGPu39d-.js → wardleyDiagram-VM6X3IG4-i_n8mAWC.js} +1 -1
  121. package/dist/{xychartDiagram-S5SC5T6Z-CP6-9q56.js → xychartDiagram-S5SC5T6Z-BYGN95wW.js} +2 -2
  122. package/package.json +16 -16
  123. package/src/__mocks__/document.tsx +63 -0
  124. package/src/__mocks__/notebook.ts +3 -4
  125. package/src/__mocks__/partial.ts +26 -0
  126. package/src/__mocks__/requests.ts +0 -3
  127. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  128. package/src/__tests__/main.test.tsx +24 -1
  129. package/src/__tests__/module-entry.test.ts +44 -0
  130. package/src/__tests__/mount.test.ts +9 -9
  131. package/src/__tests__/{host-imports.test.ts → replica-imports.test.ts} +12 -11
  132. package/src/components/ai/__tests__/ai-model-dropdown.test.tsx +63 -0
  133. package/src/components/ai/ai-model-dropdown.tsx +11 -6
  134. package/src/components/app-config/ai-config.tsx +7 -2
  135. package/src/components/app-config/app-config-form.tsx +5 -9
  136. package/src/components/app-config/user-config-form.tsx +35 -0
  137. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  138. package/src/components/chat/__tests__/notebook-access-selector.test.tsx +64 -0
  139. package/src/components/chat/acp/__tests__/session-tabs.test.tsx +43 -0
  140. package/src/components/chat/acp/__tests__/state.test.ts +2 -2
  141. package/src/components/chat/acp/blocks.tsx +3 -2
  142. package/src/components/chat/acp/session-tabs.tsx +8 -3
  143. package/src/components/chat/chat-components.tsx +2 -0
  144. package/src/components/chat/chat-panel.tsx +20 -101
  145. package/src/components/chat/chat-utils.ts +4 -8
  146. package/src/components/chat/notebook-access-selector.stories.tsx +22 -0
  147. package/src/components/chat/notebook-access-selector.tsx +100 -0
  148. package/src/components/data-table/TableBottomBar.tsx +4 -1
  149. package/src/components/data-table/TableTopBar.tsx +2 -0
  150. package/src/components/data-table/__tests__/chart-spec-model.test.ts +195 -195
  151. package/src/components/data-table/__tests__/column-explorer.test.tsx +27 -1
  152. package/src/components/data-table/__tests__/columns.test.tsx +105 -0
  153. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  154. package/src/components/data-table/__tests__/context-menu.test.ts +176 -0
  155. package/src/components/data-table/__tests__/data-table.test.tsx +1 -0
  156. package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +24 -1
  157. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  158. package/src/components/data-table/__tests__/export-actions.test.tsx +434 -6
  159. package/src/components/data-table/__tests__/keyboard-selection.test.tsx +188 -0
  160. package/src/components/data-table/__tests__/pagination.test.tsx +28 -1
  161. package/src/components/data-table/__tests__/search-highlight.test.tsx +109 -0
  162. package/src/components/data-table/__tests__/url-detector.test.tsx +74 -0
  163. package/src/components/data-table/cell-selection/feature.ts +2 -2
  164. package/src/components/data-table/cell-selection/types.ts +2 -2
  165. package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
  166. package/src/components/data-table/charts/__tests__/spec-snapshot.test.ts +20 -20
  167. package/src/components/data-table/charts/__tests__/spec.test.ts +78 -52
  168. package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
  169. package/src/components/data-table/charts/chart-spec/spec.ts +68 -43
  170. package/src/components/data-table/charts/charts.tsx +40 -30
  171. package/src/components/data-table/charts/storage.ts +16 -5
  172. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
  173. package/src/components/data-table/column-summary/chart-spec-model.tsx +23 -16
  174. package/src/components/data-table/column-summary/column-summary.tsx +2 -4
  175. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  176. package/src/components/data-table/columns.tsx +45 -46
  177. package/src/components/data-table/context-menu.tsx +161 -46
  178. package/src/components/data-table/data-table.tsx +17 -1
  179. package/src/components/data-table/date-filter-inputs.tsx +15 -42
  180. package/src/components/data-table/date-popover.tsx +6 -4
  181. package/src/components/data-table/export-actions.tsx +267 -163
  182. package/src/components/data-table/pagination.tsx +44 -33
  183. package/src/components/data-table/range-focus/atoms.ts +4 -6
  184. package/src/components/data-table/range-focus/use-cell-range-selection.ts +65 -38
  185. package/src/components/data-table/range-focus/use-scroll-into-view.ts +21 -2
  186. package/src/components/data-table/renderers.tsx +16 -7
  187. package/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx +24 -1
  188. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +4 -4
  189. package/src/components/data-table/schemas.ts +14 -36
  190. package/src/components/data-table/search-highlight.tsx +79 -0
  191. package/src/components/data-table/types.ts +1 -0
  192. package/src/components/data-table/url-detector.tsx +49 -9
  193. package/src/components/data-table/utils.ts +18 -0
  194. package/src/components/datasources/__tests__/column-actions.test.tsx +97 -0
  195. package/src/components/datasources/__tests__/column-preview.test.tsx +96 -5
  196. package/src/components/datasources/__tests__/datasources-interactions.test.tsx +181 -0
  197. package/src/components/datasources/__tests__/table-list.test.tsx +118 -0
  198. package/src/components/datasources/__tests__/utils.test.ts +57 -6
  199. package/src/components/datasources/column-preview.tsx +17 -12
  200. package/src/components/datasources/datasources.tsx +56 -43
  201. package/src/components/datasources/utils.ts +32 -23
  202. package/src/components/debugger/debugger-code.tsx +5 -0
  203. package/src/components/dependency-graph/custom-node.tsx +1 -1
  204. package/src/components/dependency-graph/dependency-graph-tree.tsx +8 -8
  205. package/src/components/dependency-graph/elements.ts +24 -21
  206. package/src/components/dependency-graph/minimap-content.tsx +13 -19
  207. package/src/components/dependency-graph/panels.tsx +4 -2
  208. package/src/components/dependency-graph/utils/__tests__/layout.test.ts +18 -11
  209. package/src/components/editor/Output.tsx +9 -2
  210. package/src/components/editor/SortableCell.tsx +1 -3
  211. package/src/components/editor/__tests__/Output.test.tsx +50 -32
  212. package/src/components/editor/__tests__/agent-toast.test.tsx +58 -0
  213. package/src/components/editor/__tests__/data-attributes.test.tsx +28 -14
  214. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
  215. package/src/components/editor/__tests__/output-persistence.test.tsx +6 -2
  216. package/src/components/editor/__tests__/package-alert.test.tsx +22 -1
  217. package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +69 -0
  218. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  219. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +218 -40
  220. package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +2 -6
  221. package/src/components/editor/actions/name-cell-input.tsx +4 -3
  222. package/src/components/editor/actions/pair-with-agent-commands.ts +44 -53
  223. package/src/components/editor/actions/pair-with-agent-modal.tsx +101 -38
  224. package/src/components/editor/actions/useCellActionButton.tsx +26 -31
  225. package/src/components/editor/actions/useConfigActions.tsx +3 -4
  226. package/src/components/editor/actions/useNotebookActions.tsx +19 -23
  227. package/src/components/editor/actions/useRestartKernel.tsx +1 -1
  228. package/src/components/editor/actions/useSetCodeVisibility.ts +11 -12
  229. package/src/components/editor/actions/useSetOutputsExpanded.ts +14 -19
  230. package/src/components/editor/agent-toast.ts +15 -0
  231. package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
  232. package/src/components/editor/ai/ai-completion-editor.tsx +1 -0
  233. package/src/components/editor/alerts/__tests__/connection-notice.test.tsx +1 -1
  234. package/src/components/editor/alerts/connection-notice.tsx +1 -1
  235. package/src/components/editor/alerts/startup-logs-alert.tsx +1 -0
  236. package/src/components/editor/alerts/stdin-blocking-alert.tsx +1 -1
  237. package/src/components/editor/app-container.tsx +1 -1
  238. package/src/components/editor/boundary/__tests__/ErrorBoundary.test.tsx +1 -1
  239. package/src/components/editor/cell/CreateCellButton.tsx +15 -21
  240. package/src/components/editor/cell/DeleteButton.tsx +3 -2
  241. package/src/components/editor/cell/RunButton.tsx +2 -2
  242. package/src/components/editor/cell/StagedAICell.tsx +10 -2
  243. package/src/components/editor/cell/StopButton.tsx +2 -2
  244. package/src/components/editor/cell/__tests__/StagedAICell.test.tsx +3 -1
  245. package/src/components/editor/cell/__tests__/useShouldShowInterrupt.test.ts +39 -0
  246. package/src/components/editor/cell/cell-actions.tsx +12 -1
  247. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +54 -0
  248. package/src/components/editor/cell/code/cell-editor.tsx +36 -43
  249. package/src/components/editor/cell/code/language-toggle.tsx +8 -7
  250. package/src/components/editor/cell/collapse.tsx +11 -4
  251. package/src/components/editor/cell/useAddCell.ts +4 -8
  252. package/src/components/editor/cell/useDeleteCell.tsx +10 -36
  253. package/src/components/editor/cell/useRunCells.ts +2 -5
  254. package/src/components/editor/cell/useShouldShowInterrupt.ts +2 -12
  255. package/src/components/editor/cell/useSplitCell.tsx +10 -6
  256. package/src/components/editor/chrome/components/__tests__/feedback-button.test.tsx +1 -1
  257. package/src/components/editor/chrome/components/feedback-button.tsx +2 -8
  258. package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +31 -2
  259. package/src/components/editor/chrome/panels/__tests__/runtime-details.test.tsx +1 -1
  260. package/src/components/editor/chrome/panels/__tests__/sandbox-recovery.test.tsx +1 -1
  261. package/src/components/editor/chrome/panels/cache-panel.tsx +1 -0
  262. package/src/components/editor/chrome/panels/dependency-graph-panel.tsx +1 -1
  263. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  264. package/src/components/editor/chrome/panels/logs-panel.tsx +2 -1
  265. package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +84 -0
  266. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +39 -14
  267. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +3 -2
  268. package/src/components/editor/chrome/panels/packages-panel.tsx +4 -7
  269. package/src/components/editor/chrome/panels/secrets-panel.tsx +1 -0
  270. package/src/components/editor/chrome/panels/session-panel.tsx +1 -1
  271. package/src/components/editor/chrome/panels/snippets-panel.tsx +10 -12
  272. package/src/components/editor/chrome/panels/variable-panel.tsx +1 -5
  273. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +363 -0
  274. package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +92 -0
  275. package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +61 -2
  276. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  277. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
  278. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
  279. package/src/components/editor/chrome/wrapper/footer-items/document-sync-status.tsx +54 -0
  280. package/src/components/editor/chrome/wrapper/footer-items/lsp-status.tsx +1 -1
  281. package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +1 -1
  282. package/src/components/editor/chrome/wrapper/footer-items/runtime-settings.tsx +1 -7
  283. package/src/components/editor/chrome/wrapper/footer.tsx +4 -0
  284. package/src/components/editor/chrome/wrapper/minimap-state.ts +1 -1
  285. package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +12 -2
  286. package/src/components/editor/chrome/wrapper/storage.ts +1 -1
  287. package/src/components/editor/columns/__tests__/cell-column.test.tsx +1 -1
  288. package/src/components/editor/columns/cell-column.tsx +1 -1
  289. package/src/components/editor/columns/sortable-column.tsx +2 -2
  290. package/src/components/editor/connections/components.tsx +5 -10
  291. package/src/components/editor/controls/Controls.tsx +4 -4
  292. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  293. package/src/components/editor/controls/__tests__/keyboard-shortcuts.test.tsx +61 -0
  294. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +10 -4
  295. package/src/components/editor/controls/command-palette.tsx +22 -10
  296. package/src/components/editor/controls/keyboard-shortcuts.tsx +14 -5
  297. package/src/components/editor/documentation.css +34 -11
  298. package/src/components/editor/dynamic-favicon.tsx +21 -40
  299. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +536 -0
  300. package/src/components/editor/errors/auto-fix.tsx +4 -8
  301. package/src/components/editor/errors/send-error-report-button.tsx +66 -0
  302. package/src/components/editor/file-tree/__tests__/file-explorer-interactions.test.tsx +6 -0
  303. package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +47 -0
  304. package/src/components/editor/file-tree/__tests__/use-file-search.test.tsx +91 -0
  305. package/src/components/editor/file-tree/file-explorer.tsx +48 -15
  306. package/src/components/editor/file-tree/file-name-input.tsx +1 -0
  307. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  308. package/src/components/editor/file-tree/use-file-search.ts +35 -21
  309. package/src/components/editor/header/__tests__/status.test.tsx +5 -3
  310. package/src/components/editor/header/app-header.tsx +1 -1
  311. package/src/components/editor/header/status.tsx +40 -20
  312. package/src/components/editor/links/__tests__/cell-link.test.tsx +148 -0
  313. package/src/components/editor/links/cell-link-list.tsx +1 -1
  314. package/src/components/editor/links/cell-link.tsx +17 -7
  315. package/src/components/editor/navigation/__tests__/clipboard.test.ts +60 -38
  316. package/src/components/editor/navigation/__tests__/navigation.test.ts +108 -85
  317. package/src/components/editor/navigation/__tests__/selection.test.ts +43 -21
  318. package/src/components/editor/navigation/clipboard.ts +17 -14
  319. package/src/components/editor/navigation/focus-utils.ts +23 -4
  320. package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +17 -33
  321. package/src/components/editor/navigation/navigation.ts +71 -70
  322. package/src/components/editor/navigation/selection.ts +30 -29
  323. package/src/components/editor/notebook-banner.tsx +1 -0
  324. package/src/components/editor/notebook-cell.tsx +29 -31
  325. package/src/components/editor/output/MarimoErrorOutput.tsx +23 -6
  326. package/src/components/editor/output/MarimoTracebackOutput.tsx +54 -37
  327. package/src/components/editor/output/Outputs.css +8 -0
  328. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  329. package/src/components/editor/output/__tests__/traceback.test.tsx +27 -1
  330. package/src/components/editor/output/ansi-reduce.ts +36 -17
  331. package/src/components/editor/output/console/ConsoleOutput.tsx +19 -25
  332. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +125 -69
  333. package/src/components/editor/package-alert.tsx +14 -7
  334. package/src/components/editor/renderers/cell-array.tsx +22 -33
  335. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +12 -6
  336. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -1
  337. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +1 -1
  338. package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +4 -4
  339. package/src/components/editor/renderers/vertical-layout/sidebar/toggle.tsx +7 -1
  340. package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +1 -1
  341. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
  342. package/src/components/editor/stdin-blocking-alert.tsx +1 -1
  343. package/src/components/home/components.tsx +17 -31
  344. package/src/components/icons/__tests__/large-spinner.test.tsx +39 -0
  345. package/src/components/icons/large-spinner.tsx +3 -14
  346. package/src/components/icons/spinner.tsx +1 -1
  347. package/src/components/markdown/markdown-renderer.tsx +4 -8
  348. package/src/components/mcp/mcp-status-indicator.tsx +1 -1
  349. package/src/components/pages/__tests__/home-page.test.tsx +116 -0
  350. package/src/components/pages/edit-page.tsx +19 -17
  351. package/src/components/pages/home-page.tsx +164 -91
  352. package/src/components/scratchpad/scratchpad.test.tsx +97 -0
  353. package/src/components/scratchpad/scratchpad.tsx +20 -11
  354. package/src/components/slides/__tests__/minimap-actions.test.tsx +22 -29
  355. package/src/components/slides/__tests__/minimap.test.ts +38 -19
  356. package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +37 -0
  357. package/src/components/slides/minimap.tsx +17 -12
  358. package/src/components/slides/reveal-component.tsx +58 -26
  359. package/src/components/slides/reveal-slides.css +5 -4
  360. package/src/components/slides/slide-cell-view.tsx +4 -5
  361. package/src/components/slides/slide-form.tsx +1 -0
  362. package/src/components/slides/slide-scroll-hint.tsx +3 -1
  363. package/src/components/sort/SortableCellsProvider.tsx +8 -25
  364. package/src/components/tracing/tracing-keyboard.test.tsx +85 -0
  365. package/src/components/tracing/tracing.tsx +46 -42
  366. package/src/components/ui/__tests__/draggable-popover.test.tsx +24 -0
  367. package/src/components/ui/__tests__/range-slider.test.tsx +165 -0
  368. package/src/components/ui/alert-dialog.tsx +1 -1
  369. package/src/components/ui/draggable-popover.tsx +24 -2
  370. package/src/components/ui/range-slider.tsx +22 -9
  371. package/src/core/MarimoApp.tsx +1 -1
  372. package/src/core/ai/__tests__/staged-cells.test.ts +27 -26
  373. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +8 -12
  374. package/src/core/ai/context/providers/cell-output.ts +2 -2
  375. package/src/core/ai/context/providers/datasource.ts +6 -2
  376. package/src/core/ai/staged-cells.ts +15 -18
  377. package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +40 -88
  378. package/src/core/ai/tools/__tests__/registry.test.ts +17 -0
  379. package/src/core/ai/tools/base.ts +18 -15
  380. package/src/core/ai/tools/edit-notebook-tool.ts +86 -80
  381. package/src/core/ai/tools/registry.ts +13 -10
  382. package/src/core/ai/tools/sample-tool.ts +6 -7
  383. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +4 -37
  384. package/src/core/cells/__tests__/actions.test.ts +624 -35
  385. package/src/core/cells/__tests__/add-missing-import.test.ts +7 -8
  386. package/src/core/cells/__tests__/arrange.test.ts +432 -0
  387. package/src/core/cells/__tests__/cell.test.ts +39 -0
  388. package/src/core/cells/__tests__/cells.test.ts +256 -2477
  389. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +54 -0
  390. package/src/core/cells/__tests__/document.test.ts +341 -0
  391. package/src/core/cells/__tests__/editor.test.ts +57 -0
  392. package/src/core/cells/__tests__/error-report.test.ts +139 -0
  393. package/src/core/cells/__tests__/flush-document.test.ts +40 -0
  394. package/src/core/cells/__tests__/harness.ts +106 -0
  395. package/src/core/cells/__tests__/layout.test.ts +177 -0
  396. package/src/core/cells/__tests__/notebook-outline.test.ts +120 -0
  397. package/src/core/cells/__tests__/outputs.test.tsx +71 -53
  398. package/src/core/cells/__tests__/session.test.ts +493 -210
  399. package/src/core/cells/__tests__/utils.test.ts +9 -108
  400. package/src/core/cells/__tests__/with-document-save.test.ts +67 -0
  401. package/src/core/cells/actions.ts +636 -6
  402. package/src/core/cells/add-missing-import.ts +47 -43
  403. package/src/core/cells/arrange.ts +529 -0
  404. package/src/core/cells/cell.ts +14 -3
  405. package/src/core/cells/cells.ts +120 -1337
  406. package/src/core/cells/columns.ts +38 -0
  407. package/src/core/cells/document.ts +289 -0
  408. package/src/core/cells/edit.ts +30 -0
  409. package/src/core/cells/editor.ts +82 -0
  410. package/src/core/cells/error-report.ts +63 -0
  411. package/src/core/cells/layout.ts +221 -0
  412. package/src/core/cells/outputs.ts +12 -28
  413. package/src/core/cells/pending-delete-service.ts +3 -7
  414. package/src/core/cells/session.ts +104 -54
  415. package/src/core/cells/types.ts +22 -6
  416. package/src/core/cells/utils.ts +10 -8
  417. package/src/core/codemirror/__tests__/setup.test.ts +29 -29
  418. package/src/core/codemirror/ai/__tests__/resources.test.ts +117 -0
  419. package/src/core/codemirror/ai/resources.ts +1 -1
  420. package/src/core/codemirror/cells/__tests__/extensions.test.ts +42 -1
  421. package/src/core/codemirror/cells/extensions.ts +27 -9
  422. package/src/core/codemirror/cells/state.ts +1 -1
  423. package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +6 -7
  424. package/src/core/codemirror/copilot/getCodes.ts +2 -2
  425. package/src/core/codemirror/format.ts +6 -5
  426. package/src/core/codemirror/keymaps/vim.ts +4 -8
  427. package/src/core/codemirror/language/__tests__/sql.test.ts +22 -20
  428. package/src/core/codemirror/language/__tests__/utils.test.ts +187 -15
  429. package/src/core/codemirror/language/cell-code.ts +114 -0
  430. package/src/core/codemirror/language/extension.ts +52 -35
  431. package/src/core/codemirror/language/languages/markdown.ts +8 -6
  432. package/src/core/codemirror/language/languages/python.ts +16 -10
  433. package/src/core/codemirror/language/languages/sql/sql.ts +16 -24
  434. package/src/core/codemirror/language/panel/panel.tsx +1 -0
  435. package/src/core/codemirror/language/types.ts +7 -7
  436. package/src/core/codemirror/language/utils.ts +9 -39
  437. package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +1 -2
  438. package/src/core/codemirror/lsp/notebook-lsp.ts +6 -5
  439. package/src/core/codemirror/lsp/utils.ts +1 -1
  440. package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
  441. package/src/core/codemirror/readonly/extension.ts +2 -2
  442. package/src/core/codemirror/rtc/extension.ts +24 -13
  443. package/src/core/codemirror/rtc/loro/awareness.ts +34 -19
  444. package/src/core/codemirror/rtc/loro/sync.ts +1 -0
  445. package/src/core/codemirror/utils.ts +1 -0
  446. package/src/core/config/__tests__/app-config.test.ts +64 -0
  447. package/src/core/config/__tests__/config-schema.test.ts +13 -6
  448. package/src/core/config/config-schema.ts +13 -3
  449. package/src/core/config/config.ts +26 -12
  450. package/src/core/config/pair.ts +5 -3
  451. package/src/core/datasets/__tests__/data-source-discovery.test.ts +5 -5
  452. package/src/core/datasets/data-source-discovery.ts +4 -6
  453. package/src/core/documentation/doc-lookup.ts +1 -1
  454. package/src/core/edit-app.tsx +21 -28
  455. package/src/core/errors/error-entries.ts +4 -1
  456. package/src/core/export/hooks.ts +1 -1
  457. package/src/core/export/layout.ts +2 -2
  458. package/src/core/hotkeys/actions.ts +2 -4
  459. package/src/core/islands/__tests__/bootstrap.test.ts +69 -17
  460. package/src/core/islands/__tests__/bridge.test.ts +72 -25
  461. package/src/core/islands/bootstrap.ts +46 -53
  462. package/src/core/islands/bridge.ts +74 -23
  463. package/src/core/islands/components/__tests__/IslandControls.test.tsx +7 -5
  464. package/src/core/islands/components/web-components.tsx +1 -1
  465. package/src/core/islands/worker/__tests__/controller.test.ts +62 -4
  466. package/src/core/islands/worker/controller.ts +4 -10
  467. package/src/core/islands/worker/worker.tsx +33 -33
  468. package/src/core/kernel/__tests__/RuntimeState.test.ts +1 -1
  469. package/src/core/kernel/__tests__/handlers.test.ts +7 -153
  470. package/src/core/kernel/handlers.ts +19 -72
  471. package/src/core/meta/__tests__/code-visibility.test.tsx +78 -70
  472. package/src/core/meta/code-visibility.ts +18 -9
  473. package/src/core/network/__tests__/connection.test.ts +1 -1
  474. package/src/core/network/__tests__/requests-lazy.test.ts +1 -3
  475. package/src/core/network/connection-notice.ts +1 -1
  476. package/src/core/network/connection.ts +5 -3
  477. package/src/core/network/requests-lazy.ts +1 -4
  478. package/src/core/network/requests-network.ts +0 -25
  479. package/src/core/network/requests-static.ts +0 -3
  480. package/src/core/network/requests-toasting.tsx +0 -3
  481. package/src/core/network/types.ts +0 -12
  482. package/src/core/network/useConnectionNotice.ts +8 -2
  483. package/src/core/notebook/__tests__/operations.test.ts +51 -0
  484. package/src/core/notebook/attachments.ts +38 -0
  485. package/src/core/notebook/document/__tests__/codemirror.test.ts +586 -0
  486. package/src/core/notebook/document/__tests__/draft.test.ts +363 -0
  487. package/src/core/notebook/document/__tests__/fixtures.ts +92 -0
  488. package/src/core/notebook/document/__tests__/hold.test.ts +88 -0
  489. package/src/core/notebook/document/__tests__/hooks.test.tsx +391 -0
  490. package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +61 -0
  491. package/src/core/notebook/document/__tests__/model.test.ts +247 -0
  492. package/src/core/notebook/document/__tests__/protocol-fixtures.ts +38 -0
  493. package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +230 -0
  494. package/src/core/notebook/document/__tests__/scenario-fixture.ts +43 -0
  495. package/src/core/notebook/document/__tests__/scenarios.test.ts +205 -0
  496. package/src/core/notebook/document/__tests__/state.test.ts +459 -0
  497. package/src/core/notebook/document/__tests__/submission.test.ts +203 -0
  498. package/src/core/notebook/document/__tests__/test-host.test.ts +92 -0
  499. package/src/core/notebook/document/__tests__/test-host.ts +247 -0
  500. package/src/core/notebook/document/__tests__/test-notebook.ts +149 -0
  501. package/src/core/notebook/document/__tests__/user.ts +61 -0
  502. package/src/core/notebook/document/codemirror.ts +216 -0
  503. package/src/core/notebook/document/draft.ts +502 -0
  504. package/src/core/notebook/document/hooks.tsx +118 -0
  505. package/src/core/notebook/document/index.ts +24 -0
  506. package/src/core/notebook/document/model.ts +105 -0
  507. package/src/core/notebook/document/select.ts +41 -0
  508. package/src/core/notebook/document/state.ts +378 -0
  509. package/src/core/notebook/document/sync.ts +418 -0
  510. package/src/core/notebook/index.ts +19 -0
  511. package/src/core/notebook/operations.ts +30 -0
  512. package/src/core/notebook/replica/AGENTS.md +11 -0
  513. package/src/core/notebook/replica/__tests__/attachments.test.ts +56 -0
  514. package/src/core/notebook/replica/__tests__/document.test.ts +126 -0
  515. package/src/core/notebook/replica/__tests__/fixtures.ts +79 -0
  516. package/src/core/notebook/replica/__tests__/replica.test.ts +550 -0
  517. package/src/core/notebook/replica/backend.ts +19 -0
  518. package/src/core/{websocket/types.ts → notebook/replica/connection.ts} +10 -15
  519. package/src/core/notebook/replica/index.ts +13 -0
  520. package/src/core/notebook/replica/replica.ts +286 -0
  521. package/src/core/notebook/replica/resources/attachments.ts +22 -0
  522. package/src/core/notebook/replica/resources/document.ts +101 -0
  523. package/src/core/packages/__tests__/useSandboxController.test.tsx +1 -1
  524. package/src/core/packages/useSandboxController.ts +1 -1
  525. package/src/core/run-app.tsx +48 -51
  526. package/src/core/runtime/__tests__/adapter.test.ts +1 -1
  527. package/src/core/runtime/__tests__/createWsUrl.test.ts +77 -7
  528. package/src/core/runtime/__tests__/runtime.test.ts +33 -15
  529. package/src/core/runtime/adapter.ts +1 -1
  530. package/src/core/runtime/config.ts +2 -2
  531. package/src/core/runtime/runtime.ts +39 -30
  532. package/src/core/saving/__tests__/state.test.ts +111 -0
  533. package/src/core/saving/__tests__/useAutoSave.test.tsx +67 -0
  534. package/src/core/saving/filename.ts +1 -1
  535. package/src/core/saving/save-component.tsx +28 -36
  536. package/src/core/saving/state.ts +38 -39
  537. package/src/core/saving/useAutoSave.ts +17 -53
  538. package/src/core/session/__tests__/backend.test.ts +236 -0
  539. package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +184 -0
  540. package/src/core/{websocket/__tests__/useMarimoKernelConnection.hook.test.tsx → session/__tests__/useNotebookSession.hook.test.tsx} +252 -185
  541. package/src/core/session/active-notebook.ts +22 -0
  542. package/src/core/session/backend.ts +123 -0
  543. package/src/core/session/embedded.ts +7 -0
  544. package/src/core/session/types.ts +17 -0
  545. package/src/core/session/useNotebookReplica.ts +74 -0
  546. package/src/core/{websocket/useMarimoKernelConnection.tsx → session/useNotebookSession.tsx} +120 -273
  547. package/src/core/state/__tests__/jotai.test.tsx +108 -0
  548. package/src/core/state/jotai.ts +1 -1
  549. package/src/core/static/__tests__/files.test.ts +38 -10
  550. package/src/core/static/files.ts +2 -0
  551. package/src/core/{websocket/__tests__/useMarimoKernelConnection.test.ts → transports/__tests__/connection-state.test.ts} +16 -30
  552. package/src/core/transports/__tests__/server.test.ts +408 -0
  553. package/src/core/transports/__tests__/static.test.ts +306 -0
  554. package/src/core/transports/__tests__/wasm.test.ts +166 -0
  555. package/src/core/transports/connection-state.ts +63 -0
  556. package/src/core/transports/server.ts +152 -0
  557. package/src/core/transports/static.ts +166 -0
  558. package/src/core/transports/wasm.ts +97 -0
  559. package/src/core/wasm/__tests__/bridge.test.ts +214 -50
  560. package/src/core/wasm/__tests__/worker.test.ts +187 -0
  561. package/src/core/wasm/bridge.ts +75 -69
  562. package/src/core/wasm/rpc.ts +15 -3
  563. package/src/core/wasm/store.ts +3 -3
  564. package/src/core/wasm/worker/bootstrap.ts +55 -51
  565. package/src/core/wasm/worker/getMarimoWheel.ts +1 -1
  566. package/src/core/wasm/worker/save-worker.ts +9 -10
  567. package/src/core/wasm/worker/types.ts +29 -18
  568. package/src/core/wasm/worker/worker.ts +88 -44
  569. package/src/css/globals.css +66 -22
  570. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  571. package/src/hooks/__tests__/useDebounce.test.tsx +51 -0
  572. package/src/hooks/__tests__/useDeepCompareMemoize.test.tsx +39 -0
  573. package/src/hooks/__tests__/useDelayElapsed.test.tsx +28 -0
  574. package/src/hooks/__tests__/useInternalStateWithSync.test.tsx +20 -0
  575. package/src/hooks/__tests__/useScript.test.tsx +77 -0
  576. package/src/hooks/__tests__/useStateForKey.test.tsx +257 -0
  577. package/src/hooks/useAsyncData.ts +3 -3
  578. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  579. package/src/hooks/useDebounce.ts +6 -10
  580. package/src/hooks/useDeepCompareMemoize.ts +1 -1
  581. package/src/hooks/useDelayElapsed.ts +14 -10
  582. package/src/hooks/useElapsedTime.ts +3 -3
  583. package/src/hooks/useEventListener.ts +1 -2
  584. package/src/hooks/useInputHistory.ts +4 -7
  585. package/src/hooks/useInternalStateWithSync.ts +6 -6
  586. package/src/hooks/useResizeObserver.ts +4 -7
  587. package/src/hooks/useScript.ts +67 -70
  588. package/src/hooks/useStateForKey.ts +93 -0
  589. package/src/mount.tsx +23 -14
  590. package/src/plugins/__tests__/plugin-object-schemas.test.ts +104 -0
  591. package/src/plugins/core/registerReactComponent.tsx +1 -1
  592. package/src/plugins/impl/CodeEditorPlugin.tsx +1 -1
  593. package/src/plugins/impl/DataEditorPlugin.tsx +1 -1
  594. package/src/plugins/impl/DataTablePlugin.tsx +69 -37
  595. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  596. package/src/plugins/impl/FileBrowserPlugin.tsx +4 -16
  597. package/src/plugins/impl/FormPlugin.tsx +1 -1
  598. package/src/plugins/impl/RangeSliderPlugin.tsx +16 -2
  599. package/src/plugins/impl/RefreshPlugin.tsx +1 -0
  600. package/src/plugins/impl/SliderPlugin.tsx +6 -8
  601. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +471 -1
  602. package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +45 -0
  603. package/src/plugins/impl/__tests__/RangeSliderPlugin.test.tsx +109 -0
  604. package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +24 -3
  605. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +153 -0
  606. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  607. package/src/plugins/impl/anywidget/model.ts +3 -1
  608. package/src/plugins/impl/anywidget/registry.ts +18 -14
  609. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  610. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  611. package/src/plugins/impl/chat/__tests__/chat-prompts.test.tsx +93 -0
  612. package/src/plugins/impl/chat/chat-ui.tsx +14 -11
  613. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  614. package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
  615. package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
  616. package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +1 -1
  617. package/src/plugins/impl/data-explorer/components/column-summary.tsx +4 -2
  618. package/src/plugins/impl/data-explorer/state/reducer.ts +1 -1
  619. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +1 -2
  620. package/src/plugins/impl/data-frames/__tests__/sidebar.test.tsx +160 -0
  621. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +66 -66
  622. package/src/plugins/impl/data-frames/panel.tsx +43 -16
  623. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  624. package/src/plugins/impl/panel/PanelPlugin.tsx +16 -17
  625. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  626. package/src/plugins/impl/panel/utils.ts +17 -0
  627. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +2 -5
  628. package/src/plugins/impl/plotly/selection.ts +25 -19
  629. package/src/plugins/impl/vega/VegaPlugin.tsx +2 -3
  630. package/src/plugins/impl/vega/make-selectable.ts +4 -7
  631. package/src/plugins/layout/RoutesPlugin.tsx +1 -1
  632. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  633. package/src/stories/button.stories.tsx +1 -0
  634. package/src/stories/cell.stories.tsx +2 -5
  635. package/src/stories/data-table.stories.tsx +31 -0
  636. package/src/stories/editor.stories.tsx +24 -17
  637. package/src/stories/form-wrapper.stories.tsx +2 -2
  638. package/src/stories/layout/vertical/one-column.stories.tsx +2 -5
  639. package/src/stories/runtime-story.tsx +23 -17
  640. package/src/stories/select.stories.tsx +2 -2
  641. package/src/stories/switchable-multi-select.stories.tsx +1 -1
  642. package/src/utils/__tests__/arrays.test.ts +35 -0
  643. package/src/utils/__tests__/batch-requests.test.ts +3 -3
  644. package/src/utils/__tests__/{createReducer.test.ts → createReducer.test.tsx} +29 -0
  645. package/src/utils/__tests__/dates.test.ts +116 -0
  646. package/src/utils/__tests__/numbers.test.ts +105 -1
  647. package/src/utils/__tests__/objects.test.ts +21 -0
  648. package/src/utils/arrays.ts +11 -2
  649. package/src/utils/blob.ts +1 -1
  650. package/src/utils/createReducer.ts +53 -26
  651. package/src/utils/dates.ts +94 -0
  652. package/src/utils/maps.ts +0 -3
  653. package/src/utils/numbers.ts +79 -18
  654. package/src/utils/objects.ts +4 -9
  655. package/src/utils/once.ts +19 -19
  656. package/src/utils/tracer.ts +9 -5
  657. package/src/utils/zod-utils.ts +1 -3
  658. package/dist/any-language-editor-B9REGlD9.js +0 -76
  659. package/dist/assets/__vite-browser-external-BXYkiFsk.js +0 -1
  660. package/dist/assets/worker-HPY9fbhz.js +0 -114
  661. package/dist/error-entries-CzoYkIQZ.js +0 -56
  662. package/dist/feedback-button-fND8YT59.js +0 -380
  663. package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +0 -2
  664. package/dist/precisionRound-DMIVQrt2.js +0 -97
  665. package/src/components/editor/navigation/__tests__/state.test.ts +0 -81
  666. package/src/components/editor/navigation/state.ts +0 -65
  667. package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +0 -656
  668. package/src/core/ai/tools/run-cells-tool.ts +0 -303
  669. package/src/core/cells/__tests__/apply-transaction.test.ts +0 -991
  670. package/src/core/cells/__tests__/document-changes.test.ts +0 -1140
  671. package/src/core/cells/__tests__/document-roundtrip.test.ts +0 -392
  672. package/src/core/cells/document-changes.ts +0 -944
  673. package/src/core/host/AGENTS.md +0 -6
  674. package/src/core/host/__tests__/protocol.test.ts +0 -214
  675. package/src/core/host/protocol.ts +0 -1943
  676. package/src/core/state/__tests__/jotai.test.ts +0 -25
  677. package/src/core/wasm/worker/message-buffer.ts +0 -33
  678. package/src/core/websocket/__tests__/useWebSocket.test.ts +0 -49
  679. package/src/core/websocket/transports/__tests__/basic.test.ts +0 -275
  680. package/src/core/websocket/transports/__tests__/sse.test.ts +0 -338
  681. package/src/core/websocket/transports/__tests__/transport.test.ts +0 -308
  682. package/src/core/websocket/transports/__tests__/ws.test.ts +0 -125
  683. package/src/core/websocket/transports/basic.ts +0 -102
  684. package/src/core/websocket/transports/sse.ts +0 -308
  685. package/src/core/websocket/transports/transport.ts +0 -61
  686. package/src/core/websocket/transports/ws.ts +0 -98
  687. package/src/core/websocket/useWebSocket.tsx +0 -88
  688. package/src/utils/__tests__/id-tree.test.ts +0 -2145
  689. package/src/utils/id-tree.tsx +0 -1134
  690. /package/src/core/{websocket → session}/connection-utils.ts +0 -0
@@ -1,1612 +1,1615 @@
1
- import { $ as e, A as t, At as n, Bt as r, D as i, Dt as a, E as o, Et as s, Ft as c, Gt as l, I as u, It as d, Kt as f, Mt as p, N as m, Q as ee, Rt as h, St as te, Tt as ne, Vt as g, W as _, Wt as re, Z as v, _t as ie, ct as ae, j as oe, mt as se, nt as ce, o as le, rt as ue, tt as de, wt as y, zt as fe } from "./dist-DoE4XJBC.js";
2
- //#region ../node_modules/.pnpm/@codemirror+commands@6.11.1/node_modules/@codemirror/commands/dist/index.js
3
- var pe = (e) => {
4
- let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r = x(e.state, n.from);
5
- return r.line ? me(e) : r.block ? ge(e) : !1;
6
- };
7
- function b(e, t) {
8
- return ({ state: n, dispatch: r }) => {
9
- if (n.readOnly) return !1;
10
- let i = e(t, n);
11
- return i ? (r(n.update(i)), !0) : !1;
12
- };
13
- }
14
- var me = /*@__PURE__*/ b(be, 0), he = /*@__PURE__*/ b(ye, 0), ge = /*@__PURE__*/ b((e, t) => ye(e, t, ve(t)), 0);
15
- function x(e, t) {
16
- let n = e.languageDataAt("commentTokens", t, 1);
17
- return n.length ? n[0] : {};
18
- }
19
- var S = 50;
20
- function _e(e, { open: t, close: n }, r, i) {
21
- let a = e.sliceDoc(r - S, r), o = e.sliceDoc(i, i + S), s = /\s*$/.exec(a)[0].length, c = /^\s*/.exec(o)[0].length, l = a.length - s;
22
- if (a.slice(l - t.length, l) == t && o.slice(c, c + n.length) == n) return {
23
- open: {
24
- pos: r - s,
25
- margin: s && 1
26
- },
27
- close: {
28
- pos: i + c,
29
- margin: c && 1
30
- }
31
- };
32
- let u, d;
33
- i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r + S), d = e.sliceDoc(i - S, i));
34
- let f = /^\s*/.exec(u)[0].length, p = /\s*$/.exec(d)[0].length, m = d.length - p - n.length;
35
- return u.slice(f, f + t.length) == t && d.slice(m, m + n.length) == n ? {
36
- open: {
37
- pos: r + f + t.length,
38
- margin: +!!/\s/.test(u.charAt(f + t.length))
39
- },
40
- close: {
41
- pos: i - p - n.length,
42
- margin: +!!/\s/.test(d.charAt(m - 1))
43
- }
44
- } : null;
45
- }
46
- function ve(e) {
47
- let t = [];
48
- for (let n of e.selection.ranges) {
49
- let r = e.doc.lineAt(n.from), i = n.to <= r.to ? r : e.doc.lineAt(n.to);
50
- i.from > r.from && i.from == n.to && (i = n.to == r.to + 1 ? r : e.doc.lineAt(n.to - 1));
51
- let a = t.length - 1;
52
- a >= 0 && t[a].to > r.from ? t[a].to = i.to : t.push({
53
- from: r.from + /^\s*/.exec(r.text)[0].length,
54
- to: i.to
55
- });
1
+ import { A as e, At as t, D as n, Dt as r, E as i, G as a, I as o, It as s, J as c, Lt as l, Mt as u, N as d, Nt as f, Ot as p, Rt as m, St as h, U as g, Vt as _, W as ee, Y as te, _t as ne, et as re, gt as v, j as ie, jt as ae, lt as oe, mt as se, o as ce, ot as le, q as ue, vt as de, wt as y, yt as fe } from "./dist-BmS-ZGjl.js";
2
+ //#region ../node_modules/.pnpm/@codemirror+lint@6.9.7/node_modules/@codemirror/lint/dist/index.js
3
+ var pe = class {
4
+ constructor(e, t, n) {
5
+ this.from = e, this.to = t, this.diagnostic = n;
56
6
  }
57
- return t;
58
- }
59
- function ye(e, t, n = t.selection.ranges) {
60
- let r = n.map((e) => x(t, e.from).block);
61
- if (!r.every((e) => e)) return null;
62
- let i = n.map((e, n) => _e(t, r[n], e.from, e.to));
63
- if (e != 2 && !i.every((e) => e)) return { changes: t.changes(n.map((e, t) => i[t] ? [] : [{
64
- from: e.from,
65
- insert: r[t].open + " "
66
- }, {
67
- from: e.to,
68
- insert: " " + r[t].close
69
- }])) };
70
- if (e != 1 && i.some((e) => e)) {
71
- let e = [];
72
- for (let t = 0, n; t < i.length; t++) if (n = i[t]) {
73
- let i = r[t], { open: a, close: o } = n;
74
- e.push({
75
- from: a.pos - i.open.length,
76
- to: a.pos + a.margin
77
- }, {
78
- from: o.pos - o.margin,
79
- to: o.pos + i.close.length
80
- });
81
- }
82
- return { changes: e };
7
+ }, b = class e {
8
+ constructor(e, t, n) {
9
+ this.diagnostics = e, this.panel = t, this.selected = n;
83
10
  }
84
- return null;
85
- }
86
- function be(e, t, n = t.selection.ranges) {
87
- let r = [], i = -1;
88
- ranges: for (let { from: e, to: a } of n) {
89
- let n = r.length, o = 1e9, s;
90
- for (let n = e; n <= a;) {
91
- let c = t.doc.lineAt(n);
92
- if (s == null && (s = x(t, c.from).line, !s)) continue ranges;
93
- if (c.from > i && (e == a || a > c.from)) {
94
- i = c.from;
95
- let e = /^\s*/.exec(c.text)[0].length, t = e == c.length, n = c.text.slice(e, e + s.length) == s ? e : -1;
96
- e < c.text.length && e < o && (o = e), r.push({
97
- line: c,
98
- comment: n,
99
- token: s,
100
- indent: e,
101
- empty: t,
102
- single: !1
103
- });
11
+ static init(t, n, r) {
12
+ let i = r.facet(T).markerFilter;
13
+ i && (t = i(t, r));
14
+ let a = t.slice().sort((e, t) => e.from - t.from || e.to - t.to), o = new p(), s = [], c = 0, l = r.doc.iter(), u = 0, d = r.doc.length;
15
+ for (let e = 0;;) {
16
+ let t = e == a.length ? null : a[e];
17
+ if (!t && !s.length) break;
18
+ let n, r;
19
+ if (s.length) n = c, r = s.reduce((e, t) => Math.min(e, t.to), t && t.from > n ? t.from : 1e8);
20
+ else {
21
+ if (n = t.from, n > d) break;
22
+ r = t.to, s.push(t), e++;
104
23
  }
105
- n = c.to + 1;
24
+ for (; e < a.length;) {
25
+ let t = a[e];
26
+ if (t.from == n && (t.to > t.from || t.to == n)) s.push(t), e++, r = Math.min(t.to, r);
27
+ else {
28
+ r = Math.min(t.from, r);
29
+ break;
30
+ }
31
+ }
32
+ r = Math.min(r, d);
33
+ let i = !1;
34
+ if (s.some((e) => e.from == n && (e.to == r || r == d)) && (i = n == r, !i && r - n < 10)) {
35
+ let e = n - (u + l.value.length);
36
+ e > 0 && (l.next(e), u = n);
37
+ for (let e = n;;) {
38
+ if (e >= r) {
39
+ i = !0;
40
+ break;
41
+ }
42
+ if (!l.lineBreak && u + l.value.length > e) break;
43
+ e = u + l.value.length, u += l.value.length, l.next();
44
+ }
45
+ }
46
+ let f = Fe(s);
47
+ if (i) o.add(n, n, g.widget({
48
+ widget: new Ae(f),
49
+ diagnostics: s.slice()
50
+ }));
51
+ else {
52
+ let e = s.reduce((e, t) => t.markClass ? e + " " + t.markClass : e, "");
53
+ o.add(n, r, g.mark({
54
+ class: "cm-lintRange cm-lintRange-" + f + e,
55
+ diagnostics: s.slice(),
56
+ inclusiveEnd: s.some((e) => e.to > r)
57
+ }));
58
+ }
59
+ if (c = r, c == d) break;
60
+ for (let e = 0; e < s.length; e++) s[e].to <= c && s.splice(e--, 1);
106
61
  }
107
- if (o < 1e9) for (let e = n; e < r.length; e++) r[e].indent < r[e].line.text.length && (r[e].indent = o);
108
- r.length == n + 1 && (r[n].single = !0);
109
- }
110
- if (e != 2 && r.some((e) => e.comment < 0 && (!e.empty || e.single))) {
111
- let e = [];
112
- for (let { line: t, token: n, indent: i, empty: a, single: o } of r) (o || !a) && e.push({
113
- from: t.from + i,
114
- insert: n + " "
115
- });
116
- let n = t.changes(e);
117
- return {
118
- changes: n,
119
- selection: t.selection.map(n, 1)
120
- };
62
+ let f = o.finish();
63
+ return new e(f, n, x(f));
121
64
  }
122
- if (e != 1 && r.some((e) => e.comment >= 0)) {
123
- let e = [];
124
- for (let { line: t, comment: n, token: i } of r) if (n >= 0) {
125
- let r = t.from + n, a = r + i.length;
126
- t.text[a - t.from] == " " && a++, e.push({
127
- from: r,
128
- to: a
129
- });
65
+ };
66
+ function x(e, t = null, n = 0) {
67
+ let r = null;
68
+ return e.between(n, 1e9, (e, n, { spec: i }) => {
69
+ if (!(t && i.diagnostics.indexOf(t) < 0)) {
70
+ if (!r) r = new pe(e, n, t || i.diagnostics[0]);
71
+ else if (i.diagnostics.indexOf(r.diagnostic) < 0) return !1;
72
+ else r = new pe(r.from, n, r.diagnostic);
130
73
  }
131
- return { changes: e };
132
- }
133
- return null;
74
+ }), r;
134
75
  }
135
- var C = /*@__PURE__*/ ne.define(), xe = /*@__PURE__*/ ne.define(), Se = /*@__PURE__*/ p.define(), Ce = /*@__PURE__*/ p.define({ combine(e) {
136
- return re(e, {
137
- minDepth: 100,
138
- newGroupDelay: 500,
139
- joinToEvent: (e, t) => t
140
- }, {
141
- minDepth: Math.max,
142
- newGroupDelay: Math.min,
143
- joinToEvent: (e, t) => (n, r) => e(n, r) || t(n, r)
144
- });
145
- } }), w = /*@__PURE__*/ fe.define({
76
+ function me(e, t) {
77
+ let n = t.pos, r = t.end || n, i = e.state.facet(T).hideOn(e, n, r);
78
+ if (i != null) return i;
79
+ let a = e.startState.doc.lineAt(t.pos);
80
+ return !!(e.effects.some((e) => e.is(S)) || e.changes.touchesRange(a.from, Math.max(a.to, r)));
81
+ }
82
+ function he(e, n) {
83
+ return e.field(w, !1) ? n : n.concat(t.appendConfig.of(Le));
84
+ }
85
+ function ge(e, t) {
86
+ return { effects: he(e, [S.of(t)]) };
87
+ }
88
+ var S = /*@__PURE__*/ t.define(), C = /*@__PURE__*/ t.define(), _e = /*@__PURE__*/ t.define(), w = /*@__PURE__*/ ae.define({
146
89
  create() {
147
- return j.empty;
90
+ return new b(g.none, null, null);
148
91
  },
149
92
  update(e, t) {
150
- let n = t.state.facet(Ce), r = t.annotation(C);
151
- if (r) {
152
- let i = D.fromTransaction(t, r.selection), a = r.side, o = a == 0 ? e.undone : e.done;
153
- return o = i ? O(o, o.length, n.minDepth, i) : Ne(o, t.startState.selection), new j(a == 0 ? r.rest : o, a == 0 ? o : r.rest);
93
+ if (t.docChanged && e.diagnostics.size) {
94
+ let n = e.diagnostics.map(t.changes), r = null, i = e.panel;
95
+ if (e.selected) {
96
+ let i = t.changes.mapPos(e.selected.from, 1);
97
+ r = x(n, e.selected.diagnostic, i) || x(n, null, i);
98
+ }
99
+ !n.size && i && t.state.facet(T).autoPanel && (i = null), e = new b(n, i, r);
154
100
  }
155
- let i = t.annotation(xe);
156
- if ((i == "full" || i == "before") && (e = e.isolate()), t.annotation(g.addToHistory) === !1) return t.changes.empty ? e : e.addMapping(t.changes.desc);
157
- let a = D.fromTransaction(t), o = t.annotation(g.time), s = t.annotation(g.userEvent);
158
- return a ? e = e.addChanges(a, o, s, n, t) : t.selection && (e = e.addSelection(t.startState.selection, o, s, n.newGroupDelay)), (i == "full" || i == "after") && (e = e.isolate()), e;
159
- },
160
- toJSON(e) {
161
- return {
162
- done: e.done.map((e) => e.toJSON()),
163
- undone: e.undone.map((e) => e.toJSON())
164
- };
101
+ for (let n of t.effects) if (n.is(S)) {
102
+ let r = t.state.facet(T).autoPanel ? n.value.length ? E.open : null : e.panel;
103
+ e = b.init(n.value, r, t.state);
104
+ } else n.is(C) ? e = new b(e.diagnostics, n.value ? E.open : null, e.selected) : n.is(_e) && (e = new b(e.diagnostics, e.panel, n.value));
105
+ return e;
165
106
  },
166
- fromJSON(e) {
167
- return new j(e.done.map(D.fromJSON), e.undone.map(D.fromJSON));
168
- }
169
- });
170
- function we(t = {}) {
171
- return [
172
- w,
173
- Ce.of(t),
174
- e.domEventHandlers({ beforeinput(e, t) {
175
- let n = e.inputType == "historyUndo" ? Ee : e.inputType == "historyRedo" ? E : null;
176
- return n ? (e.preventDefault(), n(t)) : !1;
177
- } })
178
- ];
107
+ provide: (e) => [se.from(e, (e) => e.panel), a.decorations.from(e, (e) => e.diagnostics)]
108
+ }), ve = /*@__PURE__*/ g.mark({ class: "cm-lintRange cm-lintRange-active" });
109
+ function ye(e, t, n) {
110
+ let { diagnostics: r } = e.state.field(w), i, a = -1, o = -1;
111
+ r.between(t - +(n < 0), t + +(n > 0), (e, r, { spec: s }) => {
112
+ if (t >= e && t <= r && (e == r || (t > e || n > 0) && (t < r || n < 0))) return i = s.diagnostics, a = e, o = r, !1;
113
+ });
114
+ let s = e.state.facet(T).tooltipFilter;
115
+ return i && s && (i = s(i, e.state)), i ? {
116
+ pos: a,
117
+ end: o,
118
+ above: !0,
119
+ create() {
120
+ return { dom: be(e, i) };
121
+ }
122
+ } : null;
179
123
  }
180
- var Te = w;
181
- function T(e, t) {
182
- return function({ state: n, dispatch: r }) {
183
- if (!t && n.readOnly) return !1;
184
- let i = n.field(w, !1);
185
- if (!i) return !1;
186
- let a = i.pop(e, n, t);
187
- return a ? (r(a), !0) : !1;
188
- };
124
+ function be(e, t) {
125
+ return v("ul", { class: "cm-tooltip-lint" }, t.map((t) => ke(e, t, !1)));
189
126
  }
190
- var Ee = /*@__PURE__*/ T(0, !1), E = /*@__PURE__*/ T(1, !1), De = /*@__PURE__*/ T(0, !0), Oe = /*@__PURE__*/ T(1, !0), D = class e {
191
- constructor(e, t, n, r, i) {
192
- this.changes = e, this.effects = t, this.mapped = n, this.startSelection = r, this.selectionsAfter = i;
127
+ var xe = (e) => {
128
+ let t = e.state.field(w, !1);
129
+ (!t || !t.panel) && e.dispatch({ effects: he(e.state, [C.of(!0)]) });
130
+ let n = re(e, E.open);
131
+ return n && n.dom.querySelector(".cm-panel-lint ul").focus(), !0;
132
+ }, Se = (e) => {
133
+ let t = e.state.field(w, !1);
134
+ return !t || !t.panel ? !1 : (e.dispatch({ effects: C.of(!1) }), !0);
135
+ }, Ce = [{
136
+ key: "Mod-Shift-m",
137
+ run: xe,
138
+ preventDefault: !0
139
+ }, {
140
+ key: "F8",
141
+ run: (e) => {
142
+ let t = e.state.field(w, !1);
143
+ if (!t) return !1;
144
+ let n = e.state.selection.main, r = x(t.diagnostics, null, n.to + 1);
145
+ return !r && (r = x(t.diagnostics, null, 0), !r || r.from == n.from && r.to == n.to) ? !1 : (e.dispatch({
146
+ selection: {
147
+ anchor: r.from,
148
+ head: r.to
149
+ },
150
+ scrollIntoView: !0
151
+ }), te(e, r.from, 1, {
152
+ tooltip: Ie,
153
+ until: (e) => e.docChanged || e.newSelection.main.head < r.from || e.newSelection.main.head > r.to
154
+ }), !0);
193
155
  }
194
- setSelAfter(t) {
195
- return new e(this.changes, this.effects, this.mapped, this.startSelection, t);
156
+ }], we = /*@__PURE__*/ ue.fromClass(class {
157
+ constructor(e) {
158
+ this.view = e, this.timeout = -1, this.set = !0;
159
+ let { delay: t } = e.state.facet(T);
160
+ this.lintTime = Date.now() + t, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, t);
196
161
  }
197
- toJSON() {
198
- return {
199
- changes: this.changes?.toJSON(),
200
- mapped: this.mapped?.toJSON(),
201
- startSelection: this.startSelection?.toJSON(),
202
- selectionsAfter: this.selectionsAfter.map((e) => e.toJSON())
203
- };
162
+ run() {
163
+ clearTimeout(this.timeout);
164
+ let e = Date.now();
165
+ if (e < this.lintTime - 10) this.timeout = setTimeout(this.run, this.lintTime - e);
166
+ else {
167
+ this.set = !1;
168
+ let { state: e } = this.view, { sources: t } = e.facet(T);
169
+ t.length && Te(t.map((e) => Promise.resolve(e(this.view))), (t) => {
170
+ this.view.state.doc == e.doc && this.view.dispatch(ge(this.view.state, t.reduce((e, t) => e.concat(t))));
171
+ }, (e) => {
172
+ oe(this.view.state, e);
173
+ });
174
+ }
204
175
  }
205
- static fromJSON(t) {
206
- return new e(t.changes && a.fromJSON(t.changes), [], t.mapped && s.fromJSON(t.mapped), t.startSelection && n.fromJSON(t.startSelection), t.selectionsAfter.map(n.fromJSON));
176
+ update(e) {
177
+ let t = e.state.facet(T);
178
+ (e.docChanged || t != e.startState.facet(T) || t.needsRefresh && t.needsRefresh(e)) && (this.lintTime = Date.now() + t.delay, this.set || (this.set = !0, this.timeout = setTimeout(this.run, t.delay)));
207
179
  }
208
- static fromTransaction(t, n) {
209
- let r = k;
210
- for (let e of t.startState.facet(Se)) {
211
- let n = e(t);
212
- n.length && (r = r.concat(n));
213
- }
214
- return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, k);
180
+ force() {
181
+ this.set && (this.lintTime = Date.now(), this.run());
215
182
  }
216
- static selection(t) {
217
- return new e(void 0, k, void 0, void 0, t);
183
+ destroy() {
184
+ clearTimeout(this.timeout);
218
185
  }
219
- };
220
- function O(e, t, n, r) {
221
- let i = t + 1 > n + 20 ? t - n - 1 : 0, a = e.slice(i, t);
222
- return a.push(r), a;
223
- }
224
- function ke(e, t) {
225
- let n = [], r = !1;
226
- return e.iterChangedRanges((e, t) => n.push(e, t)), t.iterChangedRanges((e, t, i, a) => {
227
- for (let e = 0; e < n.length;) {
228
- let t = n[e++], o = n[e++];
229
- a >= t && i <= o && (r = !0);
230
- }
231
- }), r;
232
- }
233
- function Ae(e, t) {
234
- return e.ranges.length == t.ranges.length && e.ranges.filter((e, n) => e.empty != t.ranges[n].empty).length === 0;
235
- }
236
- function je(e, t) {
237
- return e.length ? t.length ? e.concat(t) : e : t;
186
+ });
187
+ function Te(e, t, n) {
188
+ let r = [], i = -1;
189
+ for (let a of e) a.then((n) => {
190
+ r.push(n), clearTimeout(i), r.length == e.length ? t(r) : i = setTimeout(() => t(r), 200);
191
+ }, n);
238
192
  }
239
- var k = [], Me = 200;
240
- function Ne(e, t) {
241
- if (e.length) {
242
- let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length - Me));
243
- return r.length && r[r.length - 1].eq(t) ? e : (r.push(t), O(e, e.length - 1, 1e9, n.setSelAfter(r)));
244
- }
245
- return [D.selection([t])];
193
+ var T = /*@__PURE__*/ y.define({ combine(e) {
194
+ return {
195
+ sources: e.map((e) => e.source).filter((e) => e != null),
196
+ ...s(e.map((e) => e.config), {
197
+ delay: 750,
198
+ markerFilter: null,
199
+ tooltipFilter: null,
200
+ needsRefresh: null,
201
+ hideOn: () => null
202
+ }, {
203
+ delay: Math.max,
204
+ markerFilter: Ee,
205
+ tooltipFilter: Ee,
206
+ needsRefresh: (e, t) => e ? t ? (n) => e(n) || t(n) : e : t,
207
+ hideOn: (e, t) => e ? t ? (n, r, i) => e(n, r, i) || t(n, r, i) : e : t,
208
+ autoPanel: (e, t) => e || t
209
+ })
210
+ };
211
+ } });
212
+ function Ee(e, t) {
213
+ return e ? t ? (n, r) => t(e(n, r), r) : e : t;
246
214
  }
247
- function Pe(e) {
248
- let t = e[e.length - 1], n = e.slice();
249
- return n[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), n;
215
+ function De(e, t = {}) {
216
+ return [
217
+ T.of({
218
+ source: e,
219
+ config: t
220
+ }),
221
+ we,
222
+ Le
223
+ ];
250
224
  }
251
- function A(e, t) {
252
- if (!e.length) return e;
253
- let n = e.length, r = k;
254
- for (; n;) {
255
- let i = Fe(e[n - 1], t, r);
256
- if (i.changes && !i.changes.empty || i.effects.length) {
257
- let t = e.slice(0, n);
258
- return t[n - 1] = i, t;
225
+ function Oe(e) {
226
+ let t = [];
227
+ if (e) actions: for (let { name: n } of e) {
228
+ for (let e = 0; e < n.length; e++) {
229
+ let r = n[e];
230
+ if (/[a-zA-Z]/.test(r) && !t.some((e) => e.toLowerCase() == r.toLowerCase())) {
231
+ t.push(r);
232
+ continue actions;
233
+ }
259
234
  }
260
- t = i.mapped, n--, r = i.selectionsAfter;
235
+ t.push("");
261
236
  }
262
- return r.length ? [D.selection(r)] : k;
237
+ return t;
263
238
  }
264
- function Fe(e, t, n) {
265
- let r = je(e.selectionsAfter.length ? e.selectionsAfter.map((e) => e.map(t)) : k, n);
266
- if (!e.changes) return D.selection(r);
267
- let i = e.changes.map(t), a = t.mapDesc(e.changes, !0), o = e.mapped ? e.mapped.composeDesc(a) : a;
268
- return new D(i, h.mapEffects(e.effects, t), o, e.startSelection.map(a), r);
239
+ function ke(e, t, n) {
240
+ let r = n ? Oe(t.actions) : [];
241
+ return v("li", { class: "cm-diagnostic cm-diagnostic-" + t.severity }, v("span", { class: "cm-diagnosticText" }, t.renderMessage ? t.renderMessage(e) : t.message), t.actions?.map((n, i) => {
242
+ let a = !1, o = (r) => {
243
+ if (r.preventDefault(), a) return;
244
+ a = !0;
245
+ let i = x(e.state.field(w).diagnostics, t);
246
+ i && n.apply(e, i.from, i.to);
247
+ }, { name: s } = n, c = r[i] ? s.indexOf(r[i]) : -1, l = c < 0 ? s : [
248
+ s.slice(0, c),
249
+ v("u", s.slice(c, c + 1)),
250
+ s.slice(c + 1)
251
+ ], u = n.markClass ? " " + n.markClass : "";
252
+ return v("button", {
253
+ type: "button",
254
+ class: "cm-diagnosticAction" + u,
255
+ onclick: o,
256
+ onmousedown: o,
257
+ "aria-label": ` Action: ${s}${c < 0 ? "" : ` (access key "${r[i]})"`}.`
258
+ }, l);
259
+ }), t.source && v("div", { class: "cm-diagnosticSource" }, t.source));
269
260
  }
270
- var Ie = /^(input\.type|delete)($|\.)/, j = class e {
271
- constructor(e, t, n = 0, r = void 0) {
272
- this.done = e, this.undone = t, this.prevTime = n, this.prevUserEvent = r;
261
+ var Ae = class extends c {
262
+ constructor(e) {
263
+ super(), this.sev = e;
273
264
  }
274
- isolate() {
275
- return this.prevTime ? new e(this.done, this.undone) : this;
265
+ eq(e) {
266
+ return e.sev == this.sev;
276
267
  }
277
- addChanges(t, n, r, i, a) {
278
- let o = this.done, s = o[o.length - 1];
279
- return o = s && s.changes && !s.changes.empty && t.changes && (!r || Ie.test(r)) && (!s.selectionsAfter.length && n - this.prevTime < i.newGroupDelay && i.joinToEvent(a, ke(s.changes, t.changes)) || r == "input.type.compose") ? O(o, o.length - 1, i.minDepth, new D(t.changes.compose(s.changes), je(h.mapEffects(t.effects, s.changes), s.effects), s.mapped, s.startSelection, k)) : O(o, o.length, i.minDepth, t), new e(o, k, n, r);
268
+ toDOM() {
269
+ return v("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
280
270
  }
281
- addSelection(t, n, r, i) {
282
- let a = this.done.length ? this.done[this.done.length - 1].selectionsAfter : k;
283
- return a.length > 0 && n - this.prevTime < i && r == this.prevUserEvent && r && /^select($|\.)/.test(r) && Ae(a[a.length - 1], t) ? this : new e(Ne(this.done, t), this.undone, n, r);
271
+ }, je = class {
272
+ constructor(e, t) {
273
+ this.diagnostic = t, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = ke(e, t, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
284
274
  }
285
- addMapping(t) {
286
- return new e(A(this.done, t), A(this.undone, t), this.prevTime, this.prevUserEvent);
275
+ }, E = class e {
276
+ constructor(e) {
277
+ this.view = e, this.items = [];
278
+ let t = (t) => {
279
+ if (!(t.ctrlKey || t.altKey || t.metaKey)) {
280
+ if (t.keyCode == 27) Se(this.view), this.view.focus();
281
+ else if (t.keyCode == 38 || t.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
282
+ else if (t.keyCode == 40 || t.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
283
+ else if (t.keyCode == 36) this.moveSelection(0);
284
+ else if (t.keyCode == 35) this.moveSelection(this.items.length - 1);
285
+ else if (t.keyCode == 13) this.view.focus();
286
+ else if (t.keyCode >= 65 && t.keyCode <= 90 && this.selectedIndex >= 0) {
287
+ let { diagnostic: n } = this.items[this.selectedIndex], r = Oe(n.actions);
288
+ for (let i = 0; i < r.length; i++) if (r[i].toUpperCase().charCodeAt(0) == t.keyCode) {
289
+ let t = x(this.view.state.field(w).diagnostics, n);
290
+ t && n.actions[i].apply(e, t.from, t.to);
291
+ }
292
+ } else return;
293
+ t.preventDefault();
294
+ }
295
+ }, n = (e) => {
296
+ for (let t = 0; t < this.items.length; t++) this.items[t].dom.contains(e.target) && this.moveSelection(t);
297
+ };
298
+ this.list = v("ul", {
299
+ tabIndex: 0,
300
+ role: "listbox",
301
+ "aria-label": this.view.state.phrase("Diagnostics"),
302
+ onkeydown: t,
303
+ onclick: n
304
+ }), this.dom = v("div", { class: "cm-panel-lint" }, this.list, v("button", {
305
+ type: "button",
306
+ name: "close",
307
+ "aria-label": this.view.state.phrase("close"),
308
+ onclick: () => Se(this.view)
309
+ }, "×")), this.update();
287
310
  }
288
- pop(e, t, n) {
289
- let r = e == 0 ? this.done : this.undone;
290
- if (r.length == 0) return null;
291
- let i = r[r.length - 1], a = i.selectionsAfter[0] || (i.startSelection ? i.startSelection.map(i.changes.invertedDesc, 1) : t.selection);
292
- if (n && i.selectionsAfter.length) return t.update({
293
- selection: i.selectionsAfter[i.selectionsAfter.length - 1],
294
- annotations: C.of({
295
- side: e,
296
- rest: Pe(r),
297
- selection: a
311
+ get selectedIndex() {
312
+ let e = this.view.state.field(w).selected;
313
+ if (!e) return -1;
314
+ for (let t = 0; t < this.items.length; t++) if (this.items[t].diagnostic == e.diagnostic) return t;
315
+ return -1;
316
+ }
317
+ update() {
318
+ let { diagnostics: e, selected: t } = this.view.state.field(w), n = 0, r = !1, i = null, a = /* @__PURE__ */ new Set();
319
+ for (e.between(0, this.view.state.doc.length, (e, o, { spec: s }) => {
320
+ for (let e of s.diagnostics) {
321
+ if (a.has(e)) continue;
322
+ a.add(e);
323
+ let o = -1, s;
324
+ for (let t = n; t < this.items.length; t++) if (this.items[t].diagnostic == e) {
325
+ o = t;
326
+ break;
327
+ }
328
+ o < 0 ? (s = new je(this.view, e), this.items.splice(n, 0, s), r = !0) : (s = this.items[o], o > n && (this.items.splice(n, o - n), r = !0)), t && s.diagnostic == t.diagnostic ? s.dom.hasAttribute("aria-selected") || (s.dom.setAttribute("aria-selected", "true"), i = s) : s.dom.hasAttribute("aria-selected") && s.dom.removeAttribute("aria-selected"), n++;
329
+ }
330
+ }); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0);) r = !0, this.items.pop();
331
+ this.items.length == 0 && (this.items.push(new je(this.view, {
332
+ from: -1,
333
+ to: -1,
334
+ severity: "info",
335
+ message: this.view.state.phrase("No diagnostics")
336
+ })), r = !0), i ? (this.list.setAttribute("aria-activedescendant", i.id), this.view.requestMeasure({
337
+ key: this,
338
+ read: () => ({
339
+ sel: i.dom.getBoundingClientRect(),
340
+ panel: this.list.getBoundingClientRect()
298
341
  }),
299
- userEvent: e == 0 ? "select.undo" : "select.redo",
300
- scrollIntoView: !0
301
- });
302
- if (i.changes) {
303
- let n = r.length == 1 ? k : r.slice(0, r.length - 1);
304
- return i.mapped && (n = A(n, i.mapped)), t.update({
305
- changes: i.changes,
306
- selection: i.startSelection,
307
- effects: i.effects,
308
- annotations: C.of({
309
- side: e,
310
- rest: n,
311
- selection: a
312
- }),
313
- filter: !1,
314
- userEvent: e == 0 ? "undo" : "redo",
315
- scrollIntoView: !0
316
- });
342
+ write: ({ sel: e, panel: t }) => {
343
+ let n = t.height / this.list.offsetHeight;
344
+ e.top < t.top ? this.list.scrollTop -= (t.top - e.top) / n : e.bottom > t.bottom && (this.list.scrollTop += (e.bottom - t.bottom) / n);
345
+ }
346
+ })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), r && this.sync();
347
+ }
348
+ sync() {
349
+ let e = this.list.firstChild;
350
+ function t() {
351
+ let t = e;
352
+ e = t.nextSibling, t.remove();
317
353
  }
318
- return null;
354
+ for (let n of this.items) if (n.dom.parentNode == this.list) {
355
+ for (; e != n.dom;) t();
356
+ e = n.dom.nextSibling;
357
+ } else this.list.insertBefore(n.dom, e);
358
+ for (; e;) t();
359
+ }
360
+ moveSelection(e) {
361
+ if (this.selectedIndex < 0) return;
362
+ let t = x(this.view.state.field(w).diagnostics, this.items[e].diagnostic);
363
+ t && this.view.dispatch({
364
+ selection: {
365
+ anchor: t.from,
366
+ head: t.to
367
+ },
368
+ scrollIntoView: !0,
369
+ effects: _e.of(t)
370
+ });
371
+ }
372
+ static open(t) {
373
+ return new e(t);
319
374
  }
320
375
  };
321
- j.empty = /*@__PURE__*/ new j(k, k);
322
- var Le = [
323
- {
324
- key: "Mod-z",
325
- run: Ee,
326
- preventDefault: !0
376
+ function Me(e, t = "viewBox=\"0 0 40 40\"") {
377
+ return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`;
378
+ }
379
+ function D(e) {
380
+ return Me(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`, "width=\"6\" height=\"3\"");
381
+ }
382
+ var Ne = /*@__PURE__*/ a.baseTheme({
383
+ ".cm-diagnostic": {
384
+ padding: "3px 6px 3px 8px",
385
+ marginLeft: "-1px",
386
+ display: "block",
387
+ whiteSpace: "pre-wrap"
327
388
  },
328
- {
329
- key: "Mod-y",
330
- mac: "Mod-Shift-z",
331
- run: E,
332
- preventDefault: !0
389
+ ".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
390
+ ".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
391
+ ".cm-diagnostic-info": { borderLeft: "5px solid #999" },
392
+ ".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
393
+ ".cm-diagnosticAction": {
394
+ font: "inherit",
395
+ border: "none",
396
+ padding: "2px 4px",
397
+ backgroundColor: "#444",
398
+ color: "white",
399
+ borderRadius: "3px",
400
+ marginLeft: "8px",
401
+ cursor: "pointer"
333
402
  },
334
- {
335
- linux: "Ctrl-Shift-z",
336
- run: E,
337
- preventDefault: !0
403
+ ".cm-diagnosticSource": {
404
+ fontSize: "70%",
405
+ opacity: .7
338
406
  },
339
- {
340
- key: "Mod-u",
341
- run: De,
342
- preventDefault: !0
407
+ ".cm-lintRange": {
408
+ backgroundPosition: "left bottom",
409
+ backgroundRepeat: "repeat-x",
410
+ paddingBottom: "0.7px"
343
411
  },
344
- {
345
- key: "Alt-u",
346
- mac: "Mod-Shift-u",
347
- run: Oe,
348
- preventDefault: !0
349
- }
350
- ];
351
- function M(e, t) {
352
- return n.create(e.ranges.map(t), e.mainIndex);
353
- }
354
- function N(e, t) {
355
- return e.update({
356
- selection: t,
357
- scrollIntoView: !0,
358
- userEvent: "select"
359
- });
360
- }
361
- function P({ state: e, dispatch: t }, n) {
362
- let r = M(e.selection, n);
363
- return !r.eq(e.selection, !0) && (t(N(e, r)), !0);
364
- }
365
- function F(e, t) {
366
- return n.cursor(t ? e.to : e.from);
367
- }
368
- function Re(e, t) {
369
- return P(e, (n) => n.empty ? e.moveByChar(n, t) : F(n, t));
370
- }
371
- function I(e) {
372
- return e.textDirectionAt(e.state.selection.main.head) == ee.LTR;
373
- }
374
- var ze = (e) => Re(e, !I(e)), Be = (e) => Re(e, I(e));
375
- function Ve(e, t) {
376
- return P(e, (n) => n.empty ? e.moveByGroup(n, t) : F(n, t));
377
- }
378
- var He = (e) => Ve(e, !I(e)), Ue = (e) => Ve(e, I(e));
379
- typeof Intl < "u" && Intl.Segmenter;
380
- function We(e, t, n) {
381
- if (t.type.prop(n)) return !0;
382
- let r = t.to - t.from;
383
- return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
384
- }
385
- function L(e, t, r) {
386
- let i = u(e).resolveInner(t.head), a = r ? _.closedBy : _.openedBy;
387
- for (let n = t.head;;) {
388
- let t = r ? i.childAfter(n) : i.childBefore(n);
389
- if (!t) break;
390
- We(e, t, a) ? i = t : n = r ? t.to : t.from;
391
- }
392
- let o = i.type.prop(a), s, c;
393
- return c = o && (s = r ? m(e, i.from, 1) : m(e, i.to, -1)) && s.matched ? r ? s.end.to : s.end.from : r ? i.to : i.from, n.cursor(c, r ? -1 : 1);
394
- }
395
- var Ge = (e) => P(e, (t) => L(e.state, t, !I(e))), Ke = (e) => P(e, (t) => L(e.state, t, I(e)));
396
- function qe(e, t) {
397
- return P(e, (n) => {
398
- if (!n.empty) return F(n, t);
399
- let r = e.moveVertically(n, t);
400
- return r.head == n.head ? e.moveToLineBoundary(n, t) : r;
401
- });
402
- }
403
- var Je = (e) => qe(e, !1), Ye = (e) => qe(e, !0);
404
- function Xe(t) {
405
- let n = t.scrollDOM.clientHeight < t.scrollDOM.scrollHeight - 2, r = 0, i = 0, a;
406
- if (n) {
407
- for (let n of t.state.facet(e.scrollMargins)) {
408
- let e = n(t);
409
- e?.top && (r = Math.max(e?.top, r)), e?.bottom && (i = Math.max(e?.bottom, i));
412
+ ".cm-lintRange-error": { backgroundImage: /*@__PURE__*/ D("#f11") },
413
+ ".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/ D("orange") },
414
+ ".cm-lintRange-info": { backgroundImage: /*@__PURE__*/ D("#999") },
415
+ ".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/ D("#66d") },
416
+ ".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
417
+ ".cm-tooltip-lint": {
418
+ padding: 0,
419
+ margin: 0
420
+ },
421
+ ".cm-lintPoint": {
422
+ position: "relative",
423
+ "&:after": {
424
+ content: "\"\"",
425
+ position: "absolute",
426
+ bottom: 0,
427
+ left: "-2px",
428
+ borderLeft: "3px solid transparent",
429
+ borderRight: "3px solid transparent",
430
+ borderBottom: "4px solid #d11"
410
431
  }
411
- a = t.scrollDOM.clientHeight - r - i;
412
- } else a = (t.dom.ownerDocument.defaultView || window).innerHeight;
413
- return {
414
- marginTop: r,
415
- marginBottom: i,
416
- selfScroll: n,
417
- height: Math.max(t.defaultLineHeight, a - 5)
418
- };
419
- }
420
- function Ze(t, n) {
421
- let r = Xe(t), { state: i } = t, a = M(i.selection, (e) => e.empty ? t.moveVertically(e, n, r.height) : F(e, n));
422
- if (a.eq(i.selection)) return !1;
423
- let o;
424
- if (r.selfScroll) {
425
- let n = t.coordsAtPos(i.selection.main.head), s = t.scrollDOM.getBoundingClientRect(), c = s.top + r.marginTop, l = s.bottom - r.marginBottom;
426
- n && n.top > c && n.bottom < l && (o = e.scrollIntoView(a.main.head, {
427
- y: "start",
428
- yMargin: n.top - c
429
- }));
430
- }
431
- return t.dispatch(N(i, a), { effects: o }), !0;
432
+ },
433
+ ".cm-lintPoint-warning": { "&:after": { borderBottomColor: "orange" } },
434
+ ".cm-lintPoint-info": { "&:after": { borderBottomColor: "#999" } },
435
+ ".cm-lintPoint-hint": { "&:after": { borderBottomColor: "#66d" } },
436
+ ".cm-panel.cm-panel-lint": {
437
+ position: "relative",
438
+ "& ul": {
439
+ maxHeight: "100px",
440
+ overflowY: "auto",
441
+ "& [aria-selected]": {
442
+ backgroundColor: "#ddd",
443
+ "& u": { textDecoration: "underline" }
444
+ },
445
+ "&:focus [aria-selected]": {
446
+ background_fallback: "#bdf",
447
+ backgroundColor: "Highlight",
448
+ color_fallback: "white",
449
+ color: "HighlightText"
450
+ },
451
+ "& u": { textDecoration: "none" },
452
+ padding: 0,
453
+ margin: 0
454
+ },
455
+ "& [name=close]": {
456
+ position: "absolute",
457
+ top: "0",
458
+ right: "2px",
459
+ background: "inherit",
460
+ border: "none",
461
+ font: "inherit",
462
+ padding: 0,
463
+ margin: 0
464
+ }
465
+ },
466
+ "&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
467
+ "&dark .cm-panel.cm-panel-lint ul": { "& [aria-selected]": { backgroundColor: "#2e343e" } }
468
+ });
469
+ function Pe(e) {
470
+ return e == "error" ? 4 : e == "warning" ? 3 : e == "info" ? 2 : 1;
432
471
  }
433
- var Qe = (e) => Ze(e, !1), R = (e) => Ze(e, !0);
434
- function z(e, t, r) {
435
- let i = e.lineBlockAt(t.head), a = e.moveToLineBoundary(t, r);
436
- if (a.head == t.head && a.head != (r ? i.to : i.from) && (a = e.moveToLineBoundary(t, r, !1)), !r && a.head == i.from && i.length) {
437
- let r = /^\s*/.exec(e.state.sliceDoc(i.from, Math.min(i.from + 100, i.to)))[0].length;
438
- r && t.head != i.from + r && (a = n.cursor(i.from + r));
472
+ function Fe(e) {
473
+ let t = "hint", n = 1;
474
+ for (let r of e) {
475
+ let e = Pe(r.severity);
476
+ e > n && (n = e, t = r.severity);
439
477
  }
440
- return a;
441
- }
442
- var $e = (e) => P(e, (t) => z(e, t, !0)), et = (e) => P(e, (t) => z(e, t, !1)), tt = (e) => P(e, (t) => z(e, t, !I(e))), nt = (e) => P(e, (t) => z(e, t, I(e))), rt = (e) => P(e, (t) => e.moveToLineBoundary(t, !1, !1)), it = (e) => P(e, (t) => e.moveToLineBoundary(t, !0, !1));
443
- function at(e, t, r) {
444
- let i = !1, a = M(e.selection, (t) => {
445
- let a = m(e, t.head, -1) || m(e, t.head, 1) || t.head > 0 && m(e, t.head - 1, 1) || t.head < e.doc.length && m(e, t.head + 1, -1);
446
- if (!a || !a.end) return t;
447
- i = !0;
448
- let o = a.start.from == t.head ? a.end.to : a.end.from;
449
- return r ? n.range(t.anchor, o) : n.cursor(o);
450
- });
451
- return i ? (t(N(e, a)), !0) : !1;
452
- }
453
- var ot = ({ state: e, dispatch: t }) => at(e, t, !1);
454
- function B(e, t, r) {
455
- let i = M(e.state.selection, (e) => {
456
- e.undirectional && e.head >= e.anchor != t && (e = n.range(e.head, e.anchor));
457
- let i = r(e);
458
- return n.range(e.anchor, i.head, i.goalColumn, i.bidiLevel || void 0, i.assoc);
459
- });
460
- return !i.eq(e.state.selection) && (e.dispatch(N(e.state, i)), !0);
461
- }
462
- function st(e, t) {
463
- return B(e, t, (n) => e.moveByChar(n, t));
464
- }
465
- var ct = (e) => st(e, !I(e)), lt = (e) => st(e, I(e));
466
- function ut(e, t) {
467
- return B(e, t, (n) => e.moveByGroup(n, t));
468
- }
469
- var dt = (e) => ut(e, !I(e)), ft = (e) => ut(e, I(e)), pt = (e) => {
470
- let t = !I(e);
471
- return B(e, t, (n) => L(e.state, n, t));
472
- }, mt = (e) => {
473
- let t = I(e);
474
- return B(e, t, (n) => L(e.state, n, t));
475
- };
476
- function ht(e, t) {
477
- return B(e, t, (n) => e.moveVertically(n, t));
478
- }
479
- var gt = (e) => ht(e, !1), _t = (e) => ht(e, !0);
480
- function vt(e, t) {
481
- return B(e, t, (n) => e.moveVertically(n, t, Xe(e).height));
478
+ return t;
482
479
  }
483
- var yt = (e) => vt(e, !1), bt = (e) => vt(e, !0), xt = (e) => B(e, !0, (t) => z(e, t, !0)), St = (e) => B(e, !1, (t) => z(e, t, !1)), Ct = (e) => {
484
- let t = !I(e);
485
- return B(e, t, (n) => z(e, n, t));
486
- }, wt = (e) => {
487
- let t = I(e);
488
- return B(e, t, (n) => z(e, n, t));
489
- }, Tt = (e) => B(e, !1, (t) => n.cursor(e.lineBlockAt(t.head).from)), Et = (e) => B(e, !0, (t) => n.cursor(e.lineBlockAt(t.head).to)), Dt = ({ state: e, dispatch: t }) => (t(N(e, { anchor: 0 })), !0), Ot = ({ state: e, dispatch: t }) => (t(N(e, { anchor: e.doc.length })), !0), kt = ({ state: e, dispatch: t }) => (t(N(e, {
490
- anchor: e.selection.main.anchor,
491
- head: 0
492
- })), !0), At = ({ state: e, dispatch: t }) => (t(N(e, {
493
- anchor: e.selection.main.anchor,
494
- head: e.doc.length
495
- })), !0), jt = ({ state: e, dispatch: t }) => (t(e.update({
496
- selection: {
497
- anchor: 0,
498
- head: e.doc.length
499
- },
500
- userEvent: "select"
501
- })), !0), Mt = ({ state: e, dispatch: t }) => {
502
- let r = W(e).map(({ from: t, to: r }) => n.undirectionalRange(t, Math.min(r + 1, e.doc.length)));
503
- return t(e.update({
504
- selection: n.create(r),
505
- userEvent: "select"
506
- })), !0;
507
- }, Nt = ({ state: e, dispatch: t }) => {
508
- let r = M(e.selection, (t) => {
509
- let r = u(e), i = r.resolveStack(t.from, 1);
510
- if (t.empty) {
511
- let e = r.resolveStack(t.from, -1);
512
- e.node.from >= i.node.from && e.node.to <= i.node.to && (i = e);
513
- }
514
- for (let e = i; e; e = e.next) {
515
- let { node: r } = e;
516
- if ((r.from < t.from && r.to >= t.to || r.to > t.to && r.from <= t.from) && e.next) return n.undirectionalRange(r.from, r.to);
517
- }
518
- return t;
519
- });
520
- return !r.eq(e.selection) && (t(N(e, r)), !0);
521
- };
522
- function Pt(e, t) {
523
- let { state: r } = e, i = r.selection, a = r.selection.ranges.slice();
524
- for (let n of r.selection.ranges) {
525
- let i = r.doc.lineAt(n.head);
526
- if (t ? i.to < e.state.doc.length : i.from > 0) for (let r = n;;) {
527
- let n = e.moveVertically(r, t);
528
- if (n.head < i.from || n.head > i.to) {
529
- a.some((e) => e.head == n.head) || a.push(n);
530
- break;
531
- }
532
- if (n.head == r.head) break;
533
- r = n;
480
+ var Ie = /*@__PURE__*/ le(ye, { hideOn: me }), Le = [
481
+ w,
482
+ /*@__PURE__*/ a.decorations.compute([w], (e) => {
483
+ let { selected: t, panel: n } = e.field(w);
484
+ return !t || !n || t.from == t.to ? g.none : g.set([ve.range(t.from, t.to)]);
485
+ }),
486
+ Ie,
487
+ Ne
488
+ ];
489
+ function Re(e, t) {
490
+ let n = e.field(w, !1);
491
+ if (n && n.diagnostics.size) {
492
+ let e = [], i = [], a = -1;
493
+ for (let o = r.iter([n.diagnostics]);; o.next()) {
494
+ for (let n = 0; n < e.length; n++) (!o.value || o.value.spec.diagnostics.indexOf(e[n]) < 0) && (t(e[n], i[n], a), e.splice(n, 1), i.splice(n--, 1));
495
+ if (!o.value) break;
496
+ for (let t of o.value.spec.diagnostics) e.indexOf(t) < 0 && (e.push(t), i.push(o.from));
497
+ a = o.to;
534
498
  }
535
499
  }
536
- return a.length != i.ranges.length && (e.dispatch(N(r, n.create(a, a.length - 1))), !0);
537
500
  }
538
- var Ft = (e) => Pt(e, !1), It = (e) => Pt(e, !0), Lt = ({ state: e, dispatch: t }) => {
539
- let r = e.selection, i = null;
540
- return r.ranges.length > 1 ? i = n.create([r.main]) : r.main.empty || (i = n.create([n.cursor(r.main.head)])), i ? (t(N(e, i)), !0) : !1;
501
+ //#endregion
502
+ //#region ../node_modules/.pnpm/@codemirror+commands@6.11.1/node_modules/@codemirror/commands/dist/index.js
503
+ var ze = (e) => {
504
+ let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r = k(e.state, n.from);
505
+ return r.line ? Be(e) : r.block ? He(e) : !1;
541
506
  };
542
- function V(t, r) {
543
- if (t.state.readOnly) return !1;
544
- let i = "delete.selection", { state: a } = t, o = a.changeByRange((e) => {
545
- let { from: a, to: o } = e;
546
- if (a == o) {
547
- let n = r(e);
548
- n < a ? (i = "delete.backward", n = H(t, n, !1)) : n > a && (i = "delete.forward", n = H(t, n, !0)), a = Math.min(a, n), o = Math.max(o, n);
549
- } else a = H(t, a, !1), o = H(t, o, !0);
550
- return a == o ? { range: e } : {
551
- changes: {
552
- from: a,
553
- to: o
554
- },
555
- range: n.cursor(a, a < e.head ? -1 : 1)
556
- };
557
- });
558
- return !o.changes.empty && (t.dispatch(a.update(o, {
559
- scrollIntoView: !0,
560
- userEvent: i,
561
- effects: i == "delete.selection" ? e.announce.of(a.phrase("Selection deleted")) : void 0
562
- })), !0);
507
+ function O(e, t) {
508
+ return ({ state: n, dispatch: r }) => {
509
+ if (n.readOnly) return !1;
510
+ let i = e(t, n);
511
+ return i ? (r(n.update(i)), !0) : !1;
512
+ };
563
513
  }
564
- function H(t, n, r) {
565
- if (t instanceof e) for (let i of t.state.facet(e.atomicRanges).map((e) => e(t))) i.between(n, n, (e, t) => {
566
- e < n && t > n && (n = r ? t : e);
567
- });
568
- return n;
514
+ var Be = /*@__PURE__*/ O(Ke, 0), Ve = /*@__PURE__*/ O(Ge, 0), He = /*@__PURE__*/ O((e, t) => Ge(e, t, We(t)), 0);
515
+ function k(e, t) {
516
+ let n = e.languageDataAt("commentTokens", t, 1);
517
+ return n.length ? n[0] : {};
569
518
  }
570
- var Rt = (e, t, n) => V(e, (r) => {
571
- let i = r.from, { state: a } = e, s = a.doc.lineAt(i), c, u;
572
- if (n && !t && i > s.from && i < s.from + 200 && !/[^ \t]/.test(c = s.text.slice(0, i - s.from))) {
573
- if (c[c.length - 1] == " ") return i - 1;
574
- let e = l(c, a.tabSize) % o(a) || o(a);
575
- for (let t = 0; t < e && c[c.length - 1 - t] == " "; t++) i--;
576
- u = i;
577
- } else u = f(s.text, i - s.from, t, t) + s.from, u == i && s.number != (t ? a.doc.lines : 1) ? u += t ? 1 : -1 : !t && /[\ufe00-\ufe0f]/.test(s.text.slice(u - s.from, i - s.from)) && (u = f(s.text, u - s.from, !1, !1) + s.from);
578
- return u;
579
- }), U = (e) => Rt(e, !1, !0), zt = (e) => Rt(e, !0, !1), Bt = (e, t) => V(e, (n) => {
580
- let r = n.head, { state: i } = e, a = i.doc.lineAt(r), o = i.charCategorizer(r);
581
- for (let e = null;;) {
582
- if (r == (t ? a.to : a.from)) {
583
- r == n.head && a.number != (t ? i.doc.lines : 1) && (r += t ? 1 : -1);
584
- break;
519
+ var A = 50;
520
+ function Ue(e, { open: t, close: n }, r, i) {
521
+ let a = e.sliceDoc(r - A, r), o = e.sliceDoc(i, i + A), s = /\s*$/.exec(a)[0].length, c = /^\s*/.exec(o)[0].length, l = a.length - s;
522
+ if (a.slice(l - t.length, l) == t && o.slice(c, c + n.length) == n) return {
523
+ open: {
524
+ pos: r - s,
525
+ margin: s && 1
526
+ },
527
+ close: {
528
+ pos: i + c,
529
+ margin: c && 1
585
530
  }
586
- let s = f(a.text, r - a.from, t) + a.from, c = a.text.slice(Math.min(r, s) - a.from, Math.max(r, s) - a.from), l = o(c);
587
- if (e != null && l != e) break;
588
- (c != " " || r != n.head) && (e = l), r = s;
589
- }
590
- return r;
591
- }), Vt = (e) => Bt(e, !1), Ht = (e) => Bt(e, !0), Ut = (e) => V(e, (t) => {
592
- let n = e.lineBlockAt(t.head).to;
593
- return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
594
- }), Wt = (e) => V(e, (t) => {
595
- let n = e.moveToLineBoundary(t, !1).head;
596
- return t.head > n ? n : Math.max(0, t.head - 1);
597
- }), Gt = (e) => V(e, (t) => {
598
- let n = e.moveToLineBoundary(t, !0).head;
599
- return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
600
- }), Kt = ({ state: e, dispatch: t }) => {
601
- if (e.readOnly) return !1;
602
- let i = e.changeByRange((e) => ({
603
- changes: {
604
- from: e.from,
605
- to: e.to,
606
- insert: r.of(["", ""])
531
+ };
532
+ let u, d;
533
+ i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r + A), d = e.sliceDoc(i - A, i));
534
+ let f = /^\s*/.exec(u)[0].length, p = /\s*$/.exec(d)[0].length, m = d.length - p - n.length;
535
+ return u.slice(f, f + t.length) == t && d.slice(m, m + n.length) == n ? {
536
+ open: {
537
+ pos: r + f + t.length,
538
+ margin: +!!/\s/.test(u.charAt(f + t.length))
607
539
  },
608
- range: n.cursor(e.from)
609
- }));
610
- return t(e.update(i, {
611
- scrollIntoView: !0,
612
- userEvent: "input"
613
- })), !0;
614
- }, qt = ({ state: e, dispatch: t }) => {
615
- if (e.readOnly) return !1;
616
- let r = e.changeByRange((t) => {
617
- if (!t.empty || t.from == 0 || t.from == e.doc.length) return { range: t };
618
- let r = t.from, i = e.doc.lineAt(r), a = r == i.from ? r - 1 : f(i.text, r - i.from, !1) + i.from, o = r == i.to ? r + 1 : f(i.text, r - i.from, !0) + i.from;
619
- return {
620
- changes: {
621
- from: a,
622
- to: o,
623
- insert: e.doc.slice(r, o).append(e.doc.slice(a, r))
624
- },
625
- range: n.cursor(o)
626
- };
627
- });
628
- return !r.changes.empty && (t(e.update(r, {
629
- scrollIntoView: !0,
630
- userEvent: "move.character"
631
- })), !0);
632
- };
633
- function W(e) {
634
- let t = [], n = -1;
635
- for (let r of e.selection.ranges) {
636
- let i = e.doc.lineAt(r.from), a = e.doc.lineAt(r.to);
637
- if (!r.empty && r.to == a.from && (a = e.doc.lineAt(r.to - 1)), n >= i.number) {
638
- let e = t[t.length - 1];
639
- e.to = a.to, e.ranges.push(r);
640
- } else t.push({
641
- from: i.from,
642
- to: a.to,
643
- ranges: [r]
540
+ close: {
541
+ pos: i - p - n.length,
542
+ margin: +!!/\s/.test(d.charAt(m - 1))
543
+ }
544
+ } : null;
545
+ }
546
+ function We(e) {
547
+ let t = [];
548
+ for (let n of e.selection.ranges) {
549
+ let r = e.doc.lineAt(n.from), i = n.to <= r.to ? r : e.doc.lineAt(n.to);
550
+ i.from > r.from && i.from == n.to && (i = n.to == r.to + 1 ? r : e.doc.lineAt(n.to - 1));
551
+ let a = t.length - 1;
552
+ a >= 0 && t[a].to > r.from ? t[a].to = i.to : t.push({
553
+ from: r.from + /^\s*/.exec(r.text)[0].length,
554
+ to: i.to
644
555
  });
645
- n = a.number + 1;
646
556
  }
647
557
  return t;
648
558
  }
649
- function Jt(e, t, r) {
650
- if (e.readOnly) return !1;
651
- let i = [], a = [];
652
- for (let t of W(e)) {
653
- if (r ? t.to == e.doc.length : t.from == 0) continue;
654
- let o = e.doc.lineAt(r ? t.to + 1 : t.from - 1), s = o.length + 1;
655
- if (r) {
656
- i.push({
657
- from: t.to,
658
- to: o.to
659
- }, {
660
- from: t.from,
661
- insert: o.text + e.lineBreak
662
- });
663
- for (let r of t.ranges) a.push(n.range(Math.min(e.doc.length, r.anchor + s), Math.min(e.doc.length, r.head + s)));
664
- } else {
665
- i.push({
666
- from: o.from,
667
- to: t.from
559
+ function Ge(e, t, n = t.selection.ranges) {
560
+ let r = n.map((e) => k(t, e.from).block);
561
+ if (!r.every((e) => e)) return null;
562
+ let i = n.map((e, n) => Ue(t, r[n], e.from, e.to));
563
+ if (e != 2 && !i.every((e) => e)) return { changes: t.changes(n.map((e, t) => i[t] ? [] : [{
564
+ from: e.from,
565
+ insert: r[t].open + " "
566
+ }, {
567
+ from: e.to,
568
+ insert: " " + r[t].close
569
+ }])) };
570
+ if (e != 1 && i.some((e) => e)) {
571
+ let e = [];
572
+ for (let t = 0, n; t < i.length; t++) if (n = i[t]) {
573
+ let i = r[t], { open: a, close: o } = n;
574
+ e.push({
575
+ from: a.pos - i.open.length,
576
+ to: a.pos + a.margin
668
577
  }, {
669
- from: t.to,
670
- insert: e.lineBreak + o.text
578
+ from: o.pos - o.margin,
579
+ to: o.pos + i.close.length
671
580
  });
672
- for (let e of t.ranges) a.push(n.range(e.anchor - s, e.head - s));
673
581
  }
582
+ return { changes: e };
674
583
  }
675
- return i.length ? (t(e.update({
676
- changes: i,
677
- scrollIntoView: !0,
678
- selection: n.create(a, e.selection.mainIndex),
679
- userEvent: "move.line"
680
- })), !0) : !1;
681
- }
682
- var Yt = ({ state: e, dispatch: t }) => Jt(e, t, !1), Xt = ({ state: e, dispatch: t }) => Jt(e, t, !0);
683
- function Zt(e, t, n) {
684
- if (e.readOnly) return !1;
685
- let r = [];
686
- for (let t of W(e)) n ? r.push({
687
- from: t.from,
688
- insert: e.doc.slice(t.from, t.to) + e.lineBreak
689
- }) : r.push({
690
- from: t.to,
691
- insert: e.lineBreak + e.doc.slice(t.from, t.to)
692
- });
693
- let i = e.changes(r);
694
- return t(e.update({
695
- changes: i,
696
- selection: e.selection.map(i, n ? 1 : -1),
697
- scrollIntoView: !0,
698
- userEvent: "input.copyline"
699
- })), !0;
584
+ return null;
700
585
  }
701
- var Qt = ({ state: e, dispatch: t }) => Zt(e, t, !1), $t = ({ state: e, dispatch: t }) => Zt(e, t, !0), en = (e) => {
702
- if (e.state.readOnly) return !1;
703
- let { state: t } = e, n = t.changes(W(t).map(({ from: e, to: n }) => (e > 0 ? e-- : n < t.doc.length && n++, {
704
- from: e,
705
- to: n
706
- }))), r = M(t.selection, (t) => {
707
- let n;
708
- if (e.lineWrapping) {
709
- let r = e.lineBlockAt(t.head), i = e.coordsAtPos(t.head, t.assoc || 1);
710
- i && (n = r.bottom + e.documentTop - i.bottom + e.defaultLineHeight / 2);
586
+ function Ke(e, t, n = t.selection.ranges) {
587
+ let r = [], i = -1;
588
+ ranges: for (let { from: e, to: a } of n) {
589
+ let n = r.length, o = 1e9, s;
590
+ for (let n = e; n <= a;) {
591
+ let c = t.doc.lineAt(n);
592
+ if (s == null && (s = k(t, c.from).line, !s)) continue ranges;
593
+ if (c.from > i && (e == a || a > c.from)) {
594
+ i = c.from;
595
+ let e = /^\s*/.exec(c.text)[0].length, t = e == c.length, n = c.text.slice(e, e + s.length) == s ? e : -1;
596
+ e < c.text.length && e < o && (o = e), r.push({
597
+ line: c,
598
+ comment: n,
599
+ token: s,
600
+ indent: e,
601
+ empty: t,
602
+ single: !1
603
+ });
604
+ }
605
+ n = c.to + 1;
711
606
  }
712
- return e.moveVertically(t, !0, n);
713
- }).map(n);
714
- return e.dispatch({
715
- changes: n,
716
- selection: r,
717
- scrollIntoView: !0,
718
- userEvent: "delete.line"
719
- }), !0;
720
- };
721
- function tn(e, t) {
722
- if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1))) return {
723
- from: t,
724
- to: t
725
- };
726
- let n = u(e).resolveInner(t), r = n.childBefore(t), i = n.childAfter(t), a;
727
- return r && i && r.to <= t && i.from >= t && (a = r.type.prop(_.closedBy)) && a.indexOf(i.name) > -1 && e.doc.lineAt(r.to).from == e.doc.lineAt(i.from).from && !/\S/.test(e.sliceDoc(r.to, i.from)) ? {
728
- from: r.to,
729
- to: i.from
730
- } : null;
731
- }
732
- var nn = /*@__PURE__*/ an(!1), rn = /*@__PURE__*/ an(!0);
733
- function an(e) {
734
- return ({ state: a, dispatch: o }) => {
735
- if (a.readOnly) return !1;
736
- let s = a.changeByRange((o) => {
737
- let { from: s, to: c } = o, u = a.doc.lineAt(s), d = !e && s == c && tn(a, s);
738
- e && (s = c = (c <= u.to ? u : a.doc.lineAt(c)).to);
739
- let f = new le(a, {
740
- simulateBreak: s,
741
- simulateDoubleBreak: !!d
742
- }), p = i(f, s);
743
- for (p ??= l(/^\s*/.exec(a.doc.lineAt(s).text)[0], a.tabSize); c < u.to && /\s/.test(u.text[c - u.from]);) c++;
744
- d ? {from: s, to: c} = d : s > u.from && s < u.from + 100 && !/\S/.test(u.text.slice(0, s)) && (s = u.from);
745
- let m = ["", t(a, p)];
746
- return d && m.push(t(a, f.lineIndent(u.from, -1))), {
747
- changes: {
748
- from: s,
749
- to: c,
750
- insert: r.of(m)
751
- },
752
- range: n.cursor(s + 1 + m[1].length)
753
- };
607
+ if (o < 1e9) for (let e = n; e < r.length; e++) r[e].indent < r[e].line.text.length && (r[e].indent = o);
608
+ r.length == n + 1 && (r[n].single = !0);
609
+ }
610
+ if (e != 2 && r.some((e) => e.comment < 0 && (!e.empty || e.single))) {
611
+ let e = [];
612
+ for (let { line: t, token: n, indent: i, empty: a, single: o } of r) (o || !a) && e.push({
613
+ from: t.from + i,
614
+ insert: n + " "
754
615
  });
755
- return o(a.update(s, {
756
- scrollIntoView: !0,
757
- userEvent: "input"
758
- })), !0;
759
- };
760
- }
761
- function G(e, t) {
762
- let r = -1;
763
- return e.changeByRange((i) => {
764
- let a = [];
765
- for (let n = i.from; n <= i.to;) {
766
- let o = e.doc.lineAt(n);
767
- o.number > r && (i.empty || i.to > o.from) && (t(o, a, i), r = o.number), n = o.to + 1;
768
- }
769
- let o = e.changes(a);
616
+ let n = t.changes(e);
770
617
  return {
771
- changes: a,
772
- range: n.range(o.mapPos(i.anchor, 1), o.mapPos(i.head, 1))
618
+ changes: n,
619
+ selection: t.selection.map(n, 1)
773
620
  };
774
- });
621
+ }
622
+ if (e != 1 && r.some((e) => e.comment >= 0)) {
623
+ let e = [];
624
+ for (let { line: t, comment: n, token: i } of r) if (n >= 0) {
625
+ let r = t.from + n, a = r + i.length;
626
+ t.text[a - t.from] == " " && a++, e.push({
627
+ from: r,
628
+ to: a
629
+ });
630
+ }
631
+ return { changes: e };
632
+ }
633
+ return null;
775
634
  }
776
- var on = ({ state: e, dispatch: n }) => {
777
- if (e.readOnly) return !1;
778
- let r = Object.create(null), a = new le(e, { overrideIndentation: (e) => r[e] ?? -1 }), o = G(e, (n, o, s) => {
779
- let c = i(a, n.from);
780
- if (c == null) return;
781
- /\S/.test(n.text) || (c = 0);
782
- let l = /^\s*/.exec(n.text)[0], u = t(e, c);
783
- (l != u || s.from < n.from + l.length) && (r[n.from] = c, o.push({
784
- from: n.from,
785
- to: n.from + l.length,
786
- insert: u
787
- }));
788
- });
789
- return o.changes.empty || n(e.update(o, { userEvent: "indent" })), !0;
790
- }, K = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(G(e, (t, n) => {
791
- n.push({
792
- from: t.from,
793
- insert: e.facet(oe)
794
- });
795
- }), { userEvent: "input.indent" })), !0), sn = ({ state: e, dispatch: n }) => !e.readOnly && (n(e.update(G(e, (n, r) => {
796
- let i = /^\s*/.exec(n.text)[0];
797
- if (!i) return;
798
- let a = l(i, e.tabSize), s = 0, c = t(e, Math.max(0, a - o(e)));
799
- for (; s < i.length && s < c.length && i.charCodeAt(s) == c.charCodeAt(s);) s++;
800
- r.push({
801
- from: n.from + s,
802
- to: n.from + i.length,
803
- insert: c.slice(s)
635
+ var j = /*@__PURE__*/ ne.define(), qe = /*@__PURE__*/ ne.define(), Je = /*@__PURE__*/ y.define(), Ye = /*@__PURE__*/ y.define({ combine(e) {
636
+ return s(e, {
637
+ minDepth: 100,
638
+ newGroupDelay: 500,
639
+ joinToEvent: (e, t) => t
640
+ }, {
641
+ minDepth: Math.max,
642
+ newGroupDelay: Math.min,
643
+ joinToEvent: (e, t) => (n, r) => e(n, r) || t(n, r)
804
644
  });
805
- }), { userEvent: "delete.dedent" })), !0), cn = (e) => (e.setTabFocusMode(), !0), ln = ({ state: e, dispatch: t }) => e.selection.ranges.some((e) => !e.empty) ? K({
806
- state: e,
807
- dispatch: t
808
- }) : (t(e.update(e.replaceSelection(" "), {
809
- scrollIntoView: !0,
810
- userEvent: "input"
811
- })), !0), un = [
812
- {
813
- key: "Ctrl-b",
814
- run: ze,
815
- shift: ct,
816
- preventDefault: !0
817
- },
818
- {
819
- key: "Ctrl-f",
820
- run: Be,
821
- shift: lt
822
- },
823
- {
824
- key: "Ctrl-p",
825
- run: Je,
826
- shift: gt
827
- },
828
- {
829
- key: "Ctrl-n",
830
- run: Ye,
831
- shift: _t
832
- },
833
- {
834
- key: "Ctrl-a",
835
- run: rt,
836
- shift: Tt
837
- },
838
- {
839
- key: "Ctrl-e",
840
- run: it,
841
- shift: Et
645
+ } }), M = /*@__PURE__*/ ae.define({
646
+ create() {
647
+ return z.empty;
842
648
  },
843
- {
844
- key: "Ctrl-d",
845
- run: zt
649
+ update(e, t) {
650
+ let n = t.state.facet(Ye), r = t.annotation(j);
651
+ if (r) {
652
+ let i = F.fromTransaction(t, r.selection), a = r.side, o = a == 0 ? e.undone : e.done;
653
+ return o = i ? I(o, o.length, n.minDepth, i) : at(o, t.startState.selection), new z(a == 0 ? r.rest : o, a == 0 ? o : r.rest);
654
+ }
655
+ let i = t.annotation(qe);
656
+ if ((i == "full" || i == "before") && (e = e.isolate()), t.annotation(f.addToHistory) === !1) return t.changes.empty ? e : e.addMapping(t.changes.desc);
657
+ let a = F.fromTransaction(t), o = t.annotation(f.time), s = t.annotation(f.userEvent);
658
+ return a ? e = e.addChanges(a, o, s, n, t) : t.selection && (e = e.addSelection(t.startState.selection, o, s, n.newGroupDelay)), (i == "full" || i == "after") && (e = e.isolate()), e;
846
659
  },
847
- {
848
- key: "Ctrl-h",
849
- run: U
660
+ toJSON(e) {
661
+ return {
662
+ done: e.done.map((e) => e.toJSON()),
663
+ undone: e.undone.map((e) => e.toJSON())
664
+ };
850
665
  },
666
+ fromJSON(e) {
667
+ return new z(e.done.map(F.fromJSON), e.undone.map(F.fromJSON));
668
+ }
669
+ });
670
+ function Xe(e = {}) {
671
+ return [
672
+ M,
673
+ Ye.of(e),
674
+ a.domEventHandlers({ beforeinput(e, t) {
675
+ let n = e.inputType == "historyUndo" ? Qe : e.inputType == "historyRedo" ? P : null;
676
+ return n ? (e.preventDefault(), n(t)) : !1;
677
+ } })
678
+ ];
679
+ }
680
+ var Ze = M;
681
+ function N(e, t) {
682
+ return function({ state: n, dispatch: r }) {
683
+ if (!t && n.readOnly) return !1;
684
+ let i = n.field(M, !1);
685
+ if (!i) return !1;
686
+ let a = i.pop(e, n, t);
687
+ return a ? (r(a), !0) : !1;
688
+ };
689
+ }
690
+ var Qe = /*@__PURE__*/ N(0, !1), P = /*@__PURE__*/ N(1, !1), $e = /*@__PURE__*/ N(0, !0), et = /*@__PURE__*/ N(1, !0), F = class e {
691
+ constructor(e, t, n, r, i) {
692
+ this.changes = e, this.effects = t, this.mapped = n, this.startSelection = r, this.selectionsAfter = i;
693
+ }
694
+ setSelAfter(t) {
695
+ return new e(this.changes, this.effects, this.mapped, this.startSelection, t);
696
+ }
697
+ toJSON() {
698
+ return {
699
+ changes: this.changes?.toJSON(),
700
+ mapped: this.mapped?.toJSON(),
701
+ startSelection: this.startSelection?.toJSON(),
702
+ selectionsAfter: this.selectionsAfter.map((e) => e.toJSON())
703
+ };
704
+ }
705
+ static fromJSON(t) {
706
+ return new e(t.changes && fe.fromJSON(t.changes), [], t.mapped && de.fromJSON(t.mapped), t.startSelection && h.fromJSON(t.startSelection), t.selectionsAfter.map(h.fromJSON));
707
+ }
708
+ static fromTransaction(t, n) {
709
+ let r = L;
710
+ for (let e of t.startState.facet(Je)) {
711
+ let n = e(t);
712
+ n.length && (r = r.concat(n));
713
+ }
714
+ return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, L);
715
+ }
716
+ static selection(t) {
717
+ return new e(void 0, L, void 0, void 0, t);
718
+ }
719
+ };
720
+ function I(e, t, n, r) {
721
+ let i = t + 1 > n + 20 ? t - n - 1 : 0, a = e.slice(i, t);
722
+ return a.push(r), a;
723
+ }
724
+ function tt(e, t) {
725
+ let n = [], r = !1;
726
+ return e.iterChangedRanges((e, t) => n.push(e, t)), t.iterChangedRanges((e, t, i, a) => {
727
+ for (let e = 0; e < n.length;) {
728
+ let t = n[e++], o = n[e++];
729
+ a >= t && i <= o && (r = !0);
730
+ }
731
+ }), r;
732
+ }
733
+ function nt(e, t) {
734
+ return e.ranges.length == t.ranges.length && e.ranges.filter((e, n) => e.empty != t.ranges[n].empty).length === 0;
735
+ }
736
+ function rt(e, t) {
737
+ return e.length ? t.length ? e.concat(t) : e : t;
738
+ }
739
+ var L = [], it = 200;
740
+ function at(e, t) {
741
+ if (e.length) {
742
+ let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length - it));
743
+ return r.length && r[r.length - 1].eq(t) ? e : (r.push(t), I(e, e.length - 1, 1e9, n.setSelAfter(r)));
744
+ }
745
+ return [F.selection([t])];
746
+ }
747
+ function ot(e) {
748
+ let t = e[e.length - 1], n = e.slice();
749
+ return n[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), n;
750
+ }
751
+ function R(e, t) {
752
+ if (!e.length) return e;
753
+ let n = e.length, r = L;
754
+ for (; n;) {
755
+ let i = st(e[n - 1], t, r);
756
+ if (i.changes && !i.changes.empty || i.effects.length) {
757
+ let t = e.slice(0, n);
758
+ return t[n - 1] = i, t;
759
+ }
760
+ t = i.mapped, n--, r = i.selectionsAfter;
761
+ }
762
+ return r.length ? [F.selection(r)] : L;
763
+ }
764
+ function st(e, n, r) {
765
+ let i = rt(e.selectionsAfter.length ? e.selectionsAfter.map((e) => e.map(n)) : L, r);
766
+ if (!e.changes) return F.selection(i);
767
+ let a = e.changes.map(n), o = n.mapDesc(e.changes, !0), s = e.mapped ? e.mapped.composeDesc(o) : o;
768
+ return new F(a, t.mapEffects(e.effects, n), s, e.startSelection.map(o), i);
769
+ }
770
+ var ct = /^(input\.type|delete)($|\.)/, z = class e {
771
+ constructor(e, t, n = 0, r = void 0) {
772
+ this.done = e, this.undone = t, this.prevTime = n, this.prevUserEvent = r;
773
+ }
774
+ isolate() {
775
+ return this.prevTime ? new e(this.done, this.undone) : this;
776
+ }
777
+ addChanges(n, r, i, a, o) {
778
+ let s = this.done, c = s[s.length - 1];
779
+ return s = c && c.changes && !c.changes.empty && n.changes && (!i || ct.test(i)) && (!c.selectionsAfter.length && r - this.prevTime < a.newGroupDelay && a.joinToEvent(o, tt(c.changes, n.changes)) || i == "input.type.compose") ? I(s, s.length - 1, a.minDepth, new F(n.changes.compose(c.changes), rt(t.mapEffects(n.effects, c.changes), c.effects), c.mapped, c.startSelection, L)) : I(s, s.length, a.minDepth, n), new e(s, L, r, i);
780
+ }
781
+ addSelection(t, n, r, i) {
782
+ let a = this.done.length ? this.done[this.done.length - 1].selectionsAfter : L;
783
+ return a.length > 0 && n - this.prevTime < i && r == this.prevUserEvent && r && /^select($|\.)/.test(r) && nt(a[a.length - 1], t) ? this : new e(at(this.done, t), this.undone, n, r);
784
+ }
785
+ addMapping(t) {
786
+ return new e(R(this.done, t), R(this.undone, t), this.prevTime, this.prevUserEvent);
787
+ }
788
+ pop(e, t, n) {
789
+ let r = e == 0 ? this.done : this.undone;
790
+ if (r.length == 0) return null;
791
+ let i = r[r.length - 1], a = i.selectionsAfter[0] || (i.startSelection ? i.startSelection.map(i.changes.invertedDesc, 1) : t.selection);
792
+ if (n && i.selectionsAfter.length) return t.update({
793
+ selection: i.selectionsAfter[i.selectionsAfter.length - 1],
794
+ annotations: j.of({
795
+ side: e,
796
+ rest: ot(r),
797
+ selection: a
798
+ }),
799
+ userEvent: e == 0 ? "select.undo" : "select.redo",
800
+ scrollIntoView: !0
801
+ });
802
+ if (i.changes) {
803
+ let n = r.length == 1 ? L : r.slice(0, r.length - 1);
804
+ return i.mapped && (n = R(n, i.mapped)), t.update({
805
+ changes: i.changes,
806
+ selection: i.startSelection,
807
+ effects: i.effects,
808
+ annotations: j.of({
809
+ side: e,
810
+ rest: n,
811
+ selection: a
812
+ }),
813
+ filter: !1,
814
+ userEvent: e == 0 ? "undo" : "redo",
815
+ scrollIntoView: !0
816
+ });
817
+ }
818
+ return null;
819
+ }
820
+ };
821
+ z.empty = /*@__PURE__*/ new z(L, L);
822
+ var lt = [
851
823
  {
852
- key: "Ctrl-k",
853
- run: Ut
824
+ key: "Mod-z",
825
+ run: Qe,
826
+ preventDefault: !0
854
827
  },
855
828
  {
856
- key: "Ctrl-Alt-h",
857
- run: Vt
829
+ key: "Mod-y",
830
+ mac: "Mod-Shift-z",
831
+ run: P,
832
+ preventDefault: !0
858
833
  },
859
834
  {
860
- key: "Ctrl-o",
861
- run: Kt
835
+ linux: "Ctrl-Shift-z",
836
+ run: P,
837
+ preventDefault: !0
862
838
  },
863
839
  {
864
- key: "Ctrl-t",
865
- run: qt
840
+ key: "Mod-u",
841
+ run: $e,
842
+ preventDefault: !0
866
843
  },
867
844
  {
868
- key: "Ctrl-v",
869
- run: R
870
- }
871
- ], dn = /*@__PURE__*/ [
872
- {
873
- key: "ArrowLeft",
874
- run: ze,
875
- shift: ct,
845
+ key: "Alt-u",
846
+ mac: "Mod-Shift-u",
847
+ run: et,
876
848
  preventDefault: !0
849
+ }
850
+ ];
851
+ function B(e, t) {
852
+ return h.create(e.ranges.map(t), e.mainIndex);
853
+ }
854
+ function V(e, t) {
855
+ return e.update({
856
+ selection: t,
857
+ scrollIntoView: !0,
858
+ userEvent: "select"
859
+ });
860
+ }
861
+ function H({ state: e, dispatch: t }, n) {
862
+ let r = B(e.selection, n);
863
+ return !r.eq(e.selection, !0) && (t(V(e, r)), !0);
864
+ }
865
+ function U(e, t) {
866
+ return h.cursor(t ? e.to : e.from);
867
+ }
868
+ function ut(e, t) {
869
+ return H(e, (n) => n.empty ? e.moveByChar(n, t) : U(n, t));
870
+ }
871
+ function W(e) {
872
+ return e.textDirectionAt(e.state.selection.main.head) == ee.LTR;
873
+ }
874
+ var dt = (e) => ut(e, !W(e)), ft = (e) => ut(e, W(e));
875
+ function pt(e, t) {
876
+ return H(e, (n) => n.empty ? e.moveByGroup(n, t) : U(n, t));
877
+ }
878
+ var mt = (e) => pt(e, !W(e)), ht = (e) => pt(e, W(e));
879
+ typeof Intl < "u" && Intl.Segmenter;
880
+ function gt(e, t, n) {
881
+ if (t.type.prop(n)) return !0;
882
+ let r = t.to - t.from;
883
+ return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
884
+ }
885
+ function G(e, t, n) {
886
+ let r = o(e).resolveInner(t.head), i = n ? _.closedBy : _.openedBy;
887
+ for (let a = t.head;;) {
888
+ let t = n ? r.childAfter(a) : r.childBefore(a);
889
+ if (!t) break;
890
+ gt(e, t, i) ? r = t : a = n ? t.to : t.from;
891
+ }
892
+ let a = r.type.prop(i), s, c;
893
+ return c = a && (s = n ? d(e, r.from, 1) : d(e, r.to, -1)) && s.matched ? n ? s.end.to : s.end.from : n ? r.to : r.from, h.cursor(c, n ? -1 : 1);
894
+ }
895
+ var _t = (e) => H(e, (t) => G(e.state, t, !W(e))), vt = (e) => H(e, (t) => G(e.state, t, W(e)));
896
+ function yt(e, t) {
897
+ return H(e, (n) => {
898
+ if (!n.empty) return U(n, t);
899
+ let r = e.moveVertically(n, t);
900
+ return r.head == n.head ? e.moveToLineBoundary(n, t) : r;
901
+ });
902
+ }
903
+ var bt = (e) => yt(e, !1), xt = (e) => yt(e, !0);
904
+ function St(e) {
905
+ let t = e.scrollDOM.clientHeight < e.scrollDOM.scrollHeight - 2, n = 0, r = 0, i;
906
+ if (t) {
907
+ for (let t of e.state.facet(a.scrollMargins)) {
908
+ let i = t(e);
909
+ i?.top && (n = Math.max(i?.top, n)), i?.bottom && (r = Math.max(i?.bottom, r));
910
+ }
911
+ i = e.scrollDOM.clientHeight - n - r;
912
+ } else i = (e.dom.ownerDocument.defaultView || window).innerHeight;
913
+ return {
914
+ marginTop: n,
915
+ marginBottom: r,
916
+ selfScroll: t,
917
+ height: Math.max(e.defaultLineHeight, i - 5)
918
+ };
919
+ }
920
+ function Ct(e, t) {
921
+ let n = St(e), { state: r } = e, i = B(r.selection, (r) => r.empty ? e.moveVertically(r, t, n.height) : U(r, t));
922
+ if (i.eq(r.selection)) return !1;
923
+ let o;
924
+ if (n.selfScroll) {
925
+ let t = e.coordsAtPos(r.selection.main.head), s = e.scrollDOM.getBoundingClientRect(), c = s.top + n.marginTop, l = s.bottom - n.marginBottom;
926
+ t && t.top > c && t.bottom < l && (o = a.scrollIntoView(i.main.head, {
927
+ y: "start",
928
+ yMargin: t.top - c
929
+ }));
930
+ }
931
+ return e.dispatch(V(r, i), { effects: o }), !0;
932
+ }
933
+ var wt = (e) => Ct(e, !1), K = (e) => Ct(e, !0);
934
+ function q(e, t, n) {
935
+ let r = e.lineBlockAt(t.head), i = e.moveToLineBoundary(t, n);
936
+ if (i.head == t.head && i.head != (n ? r.to : r.from) && (i = e.moveToLineBoundary(t, n, !1)), !n && i.head == r.from && r.length) {
937
+ let n = /^\s*/.exec(e.state.sliceDoc(r.from, Math.min(r.from + 100, r.to)))[0].length;
938
+ n && t.head != r.from + n && (i = h.cursor(r.from + n));
939
+ }
940
+ return i;
941
+ }
942
+ var Tt = (e) => H(e, (t) => q(e, t, !0)), Et = (e) => H(e, (t) => q(e, t, !1)), Dt = (e) => H(e, (t) => q(e, t, !W(e))), Ot = (e) => H(e, (t) => q(e, t, W(e))), kt = (e) => H(e, (t) => e.moveToLineBoundary(t, !1, !1)), At = (e) => H(e, (t) => e.moveToLineBoundary(t, !0, !1));
943
+ function jt(e, t, n) {
944
+ let r = !1, i = B(e.selection, (t) => {
945
+ let i = d(e, t.head, -1) || d(e, t.head, 1) || t.head > 0 && d(e, t.head - 1, 1) || t.head < e.doc.length && d(e, t.head + 1, -1);
946
+ if (!i || !i.end) return t;
947
+ r = !0;
948
+ let a = i.start.from == t.head ? i.end.to : i.end.from;
949
+ return n ? h.range(t.anchor, a) : h.cursor(a);
950
+ });
951
+ return r ? (t(V(e, i)), !0) : !1;
952
+ }
953
+ var Mt = ({ state: e, dispatch: t }) => jt(e, t, !1);
954
+ function J(e, t, n) {
955
+ let r = B(e.state.selection, (e) => {
956
+ e.undirectional && e.head >= e.anchor != t && (e = h.range(e.head, e.anchor));
957
+ let r = n(e);
958
+ return h.range(e.anchor, r.head, r.goalColumn, r.bidiLevel || void 0, r.assoc);
959
+ });
960
+ return !r.eq(e.state.selection) && (e.dispatch(V(e.state, r)), !0);
961
+ }
962
+ function Nt(e, t) {
963
+ return J(e, t, (n) => e.moveByChar(n, t));
964
+ }
965
+ var Pt = (e) => Nt(e, !W(e)), Ft = (e) => Nt(e, W(e));
966
+ function It(e, t) {
967
+ return J(e, t, (n) => e.moveByGroup(n, t));
968
+ }
969
+ var Lt = (e) => It(e, !W(e)), Rt = (e) => It(e, W(e)), zt = (e) => {
970
+ let t = !W(e);
971
+ return J(e, t, (n) => G(e.state, n, t));
972
+ }, Bt = (e) => {
973
+ let t = W(e);
974
+ return J(e, t, (n) => G(e.state, n, t));
975
+ };
976
+ function Vt(e, t) {
977
+ return J(e, t, (n) => e.moveVertically(n, t));
978
+ }
979
+ var Ht = (e) => Vt(e, !1), Ut = (e) => Vt(e, !0);
980
+ function Wt(e, t) {
981
+ return J(e, t, (n) => e.moveVertically(n, t, St(e).height));
982
+ }
983
+ var Gt = (e) => Wt(e, !1), Kt = (e) => Wt(e, !0), qt = (e) => J(e, !0, (t) => q(e, t, !0)), Jt = (e) => J(e, !1, (t) => q(e, t, !1)), Yt = (e) => {
984
+ let t = !W(e);
985
+ return J(e, t, (n) => q(e, n, t));
986
+ }, Xt = (e) => {
987
+ let t = W(e);
988
+ return J(e, t, (n) => q(e, n, t));
989
+ }, Zt = (e) => J(e, !1, (t) => h.cursor(e.lineBlockAt(t.head).from)), Qt = (e) => J(e, !0, (t) => h.cursor(e.lineBlockAt(t.head).to)), $t = ({ state: e, dispatch: t }) => (t(V(e, { anchor: 0 })), !0), en = ({ state: e, dispatch: t }) => (t(V(e, { anchor: e.doc.length })), !0), tn = ({ state: e, dispatch: t }) => (t(V(e, {
990
+ anchor: e.selection.main.anchor,
991
+ head: 0
992
+ })), !0), nn = ({ state: e, dispatch: t }) => (t(V(e, {
993
+ anchor: e.selection.main.anchor,
994
+ head: e.doc.length
995
+ })), !0), rn = ({ state: e, dispatch: t }) => (t(e.update({
996
+ selection: {
997
+ anchor: 0,
998
+ head: e.doc.length
877
999
  },
1000
+ userEvent: "select"
1001
+ })), !0), an = ({ state: e, dispatch: t }) => {
1002
+ let n = Q(e).map(({ from: t, to: n }) => h.undirectionalRange(t, Math.min(n + 1, e.doc.length)));
1003
+ return t(e.update({
1004
+ selection: h.create(n),
1005
+ userEvent: "select"
1006
+ })), !0;
1007
+ }, on = ({ state: e, dispatch: t }) => {
1008
+ let n = B(e.selection, (t) => {
1009
+ let n = o(e), r = n.resolveStack(t.from, 1);
1010
+ if (t.empty) {
1011
+ let e = n.resolveStack(t.from, -1);
1012
+ e.node.from >= r.node.from && e.node.to <= r.node.to && (r = e);
1013
+ }
1014
+ for (let e = r; e; e = e.next) {
1015
+ let { node: n } = e;
1016
+ if ((n.from < t.from && n.to >= t.to || n.to > t.to && n.from <= t.from) && e.next) return h.undirectionalRange(n.from, n.to);
1017
+ }
1018
+ return t;
1019
+ });
1020
+ return !n.eq(e.selection) && (t(V(e, n)), !0);
1021
+ };
1022
+ function sn(e, t) {
1023
+ let { state: n } = e, r = n.selection, i = n.selection.ranges.slice();
1024
+ for (let r of n.selection.ranges) {
1025
+ let a = n.doc.lineAt(r.head);
1026
+ if (t ? a.to < e.state.doc.length : a.from > 0) for (let n = r;;) {
1027
+ let r = e.moveVertically(n, t);
1028
+ if (r.head < a.from || r.head > a.to) {
1029
+ i.some((e) => e.head == r.head) || i.push(r);
1030
+ break;
1031
+ }
1032
+ if (r.head == n.head) break;
1033
+ n = r;
1034
+ }
1035
+ }
1036
+ return i.length != r.ranges.length && (e.dispatch(V(n, h.create(i, i.length - 1))), !0);
1037
+ }
1038
+ var cn = (e) => sn(e, !1), ln = (e) => sn(e, !0), un = ({ state: e, dispatch: t }) => {
1039
+ let n = e.selection, r = null;
1040
+ return n.ranges.length > 1 ? r = h.create([n.main]) : n.main.empty || (r = h.create([h.cursor(n.main.head)])), r ? (t(V(e, r)), !0) : !1;
1041
+ };
1042
+ function Y(e, t) {
1043
+ if (e.state.readOnly) return !1;
1044
+ let n = "delete.selection", { state: r } = e, i = r.changeByRange((r) => {
1045
+ let { from: i, to: a } = r;
1046
+ if (i == a) {
1047
+ let o = t(r);
1048
+ o < i ? (n = "delete.backward", o = X(e, o, !1)) : o > i && (n = "delete.forward", o = X(e, o, !0)), i = Math.min(i, o), a = Math.max(a, o);
1049
+ } else i = X(e, i, !1), a = X(e, a, !0);
1050
+ return i == a ? { range: r } : {
1051
+ changes: {
1052
+ from: i,
1053
+ to: a
1054
+ },
1055
+ range: h.cursor(i, i < r.head ? -1 : 1)
1056
+ };
1057
+ });
1058
+ return !i.changes.empty && (e.dispatch(r.update(i, {
1059
+ scrollIntoView: !0,
1060
+ userEvent: n,
1061
+ effects: n == "delete.selection" ? a.announce.of(r.phrase("Selection deleted")) : void 0
1062
+ })), !0);
1063
+ }
1064
+ function X(e, t, n) {
1065
+ if (e instanceof a) for (let r of e.state.facet(a.atomicRanges).map((t) => t(e))) r.between(t, t, (e, r) => {
1066
+ e < t && r > t && (t = n ? r : e);
1067
+ });
1068
+ return t;
1069
+ }
1070
+ var dn = (e, t, n) => Y(e, (r) => {
1071
+ let a = r.from, { state: o } = e, s = o.doc.lineAt(a), c, u;
1072
+ if (n && !t && a > s.from && a < s.from + 200 && !/[^ \t]/.test(c = s.text.slice(0, a - s.from))) {
1073
+ if (c[c.length - 1] == " ") return a - 1;
1074
+ let e = l(c, o.tabSize) % i(o) || i(o);
1075
+ for (let t = 0; t < e && c[c.length - 1 - t] == " "; t++) a--;
1076
+ u = a;
1077
+ } else u = m(s.text, a - s.from, t, t) + s.from, u == a && s.number != (t ? o.doc.lines : 1) ? u += t ? 1 : -1 : !t && /[\ufe00-\ufe0f]/.test(s.text.slice(u - s.from, a - s.from)) && (u = m(s.text, u - s.from, !1, !1) + s.from);
1078
+ return u;
1079
+ }), Z = (e) => dn(e, !1, !0), fn = (e) => dn(e, !0, !1), pn = (e, t) => Y(e, (n) => {
1080
+ let r = n.head, { state: i } = e, a = i.doc.lineAt(r), o = i.charCategorizer(r);
1081
+ for (let e = null;;) {
1082
+ if (r == (t ? a.to : a.from)) {
1083
+ r == n.head && a.number != (t ? i.doc.lines : 1) && (r += t ? 1 : -1);
1084
+ break;
1085
+ }
1086
+ let s = m(a.text, r - a.from, t) + a.from, c = a.text.slice(Math.min(r, s) - a.from, Math.max(r, s) - a.from), l = o(c);
1087
+ if (e != null && l != e) break;
1088
+ (c != " " || r != n.head) && (e = l), r = s;
1089
+ }
1090
+ return r;
1091
+ }), mn = (e) => pn(e, !1), hn = (e) => pn(e, !0), gn = (e) => Y(e, (t) => {
1092
+ let n = e.lineBlockAt(t.head).to;
1093
+ return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
1094
+ }), _n = (e) => Y(e, (t) => {
1095
+ let n = e.moveToLineBoundary(t, !1).head;
1096
+ return t.head > n ? n : Math.max(0, t.head - 1);
1097
+ }), vn = (e) => Y(e, (t) => {
1098
+ let n = e.moveToLineBoundary(t, !0).head;
1099
+ return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
1100
+ }), yn = ({ state: e, dispatch: t }) => {
1101
+ if (e.readOnly) return !1;
1102
+ let n = e.changeByRange((e) => ({
1103
+ changes: {
1104
+ from: e.from,
1105
+ to: e.to,
1106
+ insert: u.of(["", ""])
1107
+ },
1108
+ range: h.cursor(e.from)
1109
+ }));
1110
+ return t(e.update(n, {
1111
+ scrollIntoView: !0,
1112
+ userEvent: "input"
1113
+ })), !0;
1114
+ }, bn = ({ state: e, dispatch: t }) => {
1115
+ if (e.readOnly) return !1;
1116
+ let n = e.changeByRange((t) => {
1117
+ if (!t.empty || t.from == 0 || t.from == e.doc.length) return { range: t };
1118
+ let n = t.from, r = e.doc.lineAt(n), i = n == r.from ? n - 1 : m(r.text, n - r.from, !1) + r.from, a = n == r.to ? n + 1 : m(r.text, n - r.from, !0) + r.from;
1119
+ return {
1120
+ changes: {
1121
+ from: i,
1122
+ to: a,
1123
+ insert: e.doc.slice(n, a).append(e.doc.slice(i, n))
1124
+ },
1125
+ range: h.cursor(a)
1126
+ };
1127
+ });
1128
+ return !n.changes.empty && (t(e.update(n, {
1129
+ scrollIntoView: !0,
1130
+ userEvent: "move.character"
1131
+ })), !0);
1132
+ };
1133
+ function Q(e) {
1134
+ let t = [], n = -1;
1135
+ for (let r of e.selection.ranges) {
1136
+ let i = e.doc.lineAt(r.from), a = e.doc.lineAt(r.to);
1137
+ if (!r.empty && r.to == a.from && (a = e.doc.lineAt(r.to - 1)), n >= i.number) {
1138
+ let e = t[t.length - 1];
1139
+ e.to = a.to, e.ranges.push(r);
1140
+ } else t.push({
1141
+ from: i.from,
1142
+ to: a.to,
1143
+ ranges: [r]
1144
+ });
1145
+ n = a.number + 1;
1146
+ }
1147
+ return t;
1148
+ }
1149
+ function xn(e, t, n) {
1150
+ if (e.readOnly) return !1;
1151
+ let r = [], i = [];
1152
+ for (let t of Q(e)) {
1153
+ if (n ? t.to == e.doc.length : t.from == 0) continue;
1154
+ let a = e.doc.lineAt(n ? t.to + 1 : t.from - 1), o = a.length + 1;
1155
+ if (n) {
1156
+ r.push({
1157
+ from: t.to,
1158
+ to: a.to
1159
+ }, {
1160
+ from: t.from,
1161
+ insert: a.text + e.lineBreak
1162
+ });
1163
+ for (let n of t.ranges) i.push(h.range(Math.min(e.doc.length, n.anchor + o), Math.min(e.doc.length, n.head + o)));
1164
+ } else {
1165
+ r.push({
1166
+ from: a.from,
1167
+ to: t.from
1168
+ }, {
1169
+ from: t.to,
1170
+ insert: e.lineBreak + a.text
1171
+ });
1172
+ for (let e of t.ranges) i.push(h.range(e.anchor - o, e.head - o));
1173
+ }
1174
+ }
1175
+ return r.length ? (t(e.update({
1176
+ changes: r,
1177
+ scrollIntoView: !0,
1178
+ selection: h.create(i, e.selection.mainIndex),
1179
+ userEvent: "move.line"
1180
+ })), !0) : !1;
1181
+ }
1182
+ var Sn = ({ state: e, dispatch: t }) => xn(e, t, !1), Cn = ({ state: e, dispatch: t }) => xn(e, t, !0);
1183
+ function wn(e, t, n) {
1184
+ if (e.readOnly) return !1;
1185
+ let r = [];
1186
+ for (let t of Q(e)) n ? r.push({
1187
+ from: t.from,
1188
+ insert: e.doc.slice(t.from, t.to) + e.lineBreak
1189
+ }) : r.push({
1190
+ from: t.to,
1191
+ insert: e.lineBreak + e.doc.slice(t.from, t.to)
1192
+ });
1193
+ let i = e.changes(r);
1194
+ return t(e.update({
1195
+ changes: i,
1196
+ selection: e.selection.map(i, n ? 1 : -1),
1197
+ scrollIntoView: !0,
1198
+ userEvent: "input.copyline"
1199
+ })), !0;
1200
+ }
1201
+ var Tn = ({ state: e, dispatch: t }) => wn(e, t, !1), En = ({ state: e, dispatch: t }) => wn(e, t, !0), Dn = (e) => {
1202
+ if (e.state.readOnly) return !1;
1203
+ let { state: t } = e, n = t.changes(Q(t).map(({ from: e, to: n }) => (e > 0 ? e-- : n < t.doc.length && n++, {
1204
+ from: e,
1205
+ to: n
1206
+ }))), r = B(t.selection, (t) => {
1207
+ let n;
1208
+ if (e.lineWrapping) {
1209
+ let r = e.lineBlockAt(t.head), i = e.coordsAtPos(t.head, t.assoc || 1);
1210
+ i && (n = r.bottom + e.documentTop - i.bottom + e.defaultLineHeight / 2);
1211
+ }
1212
+ return e.moveVertically(t, !0, n);
1213
+ }).map(n);
1214
+ return e.dispatch({
1215
+ changes: n,
1216
+ selection: r,
1217
+ scrollIntoView: !0,
1218
+ userEvent: "delete.line"
1219
+ }), !0;
1220
+ };
1221
+ function On(e, t) {
1222
+ if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1))) return {
1223
+ from: t,
1224
+ to: t
1225
+ };
1226
+ let n = o(e).resolveInner(t), r = n.childBefore(t), i = n.childAfter(t), a;
1227
+ return r && i && r.to <= t && i.from >= t && (a = r.type.prop(_.closedBy)) && a.indexOf(i.name) > -1 && e.doc.lineAt(r.to).from == e.doc.lineAt(i.from).from && !/\S/.test(e.sliceDoc(r.to, i.from)) ? {
1228
+ from: r.to,
1229
+ to: i.from
1230
+ } : null;
1231
+ }
1232
+ var kn = /*@__PURE__*/ jn(!1), An = /*@__PURE__*/ jn(!0);
1233
+ function jn(t) {
1234
+ return ({ state: r, dispatch: i }) => {
1235
+ if (r.readOnly) return !1;
1236
+ let a = r.changeByRange((i) => {
1237
+ let { from: a, to: o } = i, s = r.doc.lineAt(a), c = !t && a == o && On(r, a);
1238
+ t && (a = o = (o <= s.to ? s : r.doc.lineAt(o)).to);
1239
+ let d = new ce(r, {
1240
+ simulateBreak: a,
1241
+ simulateDoubleBreak: !!c
1242
+ }), f = n(d, a);
1243
+ for (f ??= l(/^\s*/.exec(r.doc.lineAt(a).text)[0], r.tabSize); o < s.to && /\s/.test(s.text[o - s.from]);) o++;
1244
+ c ? {from: a, to: o} = c : a > s.from && a < s.from + 100 && !/\S/.test(s.text.slice(0, a)) && (a = s.from);
1245
+ let p = ["", e(r, f)];
1246
+ return c && p.push(e(r, d.lineIndent(s.from, -1))), {
1247
+ changes: {
1248
+ from: a,
1249
+ to: o,
1250
+ insert: u.of(p)
1251
+ },
1252
+ range: h.cursor(a + 1 + p[1].length)
1253
+ };
1254
+ });
1255
+ return i(r.update(a, {
1256
+ scrollIntoView: !0,
1257
+ userEvent: "input"
1258
+ })), !0;
1259
+ };
1260
+ }
1261
+ function $(e, t) {
1262
+ let n = -1;
1263
+ return e.changeByRange((r) => {
1264
+ let i = [];
1265
+ for (let a = r.from; a <= r.to;) {
1266
+ let o = e.doc.lineAt(a);
1267
+ o.number > n && (r.empty || r.to > o.from) && (t(o, i, r), n = o.number), a = o.to + 1;
1268
+ }
1269
+ let a = e.changes(i);
1270
+ return {
1271
+ changes: i,
1272
+ range: h.range(a.mapPos(r.anchor, 1), a.mapPos(r.head, 1))
1273
+ };
1274
+ });
1275
+ }
1276
+ var Mn = ({ state: t, dispatch: r }) => {
1277
+ if (t.readOnly) return !1;
1278
+ let i = Object.create(null), a = new ce(t, { overrideIndentation: (e) => i[e] ?? -1 }), o = $(t, (r, o, s) => {
1279
+ let c = n(a, r.from);
1280
+ if (c == null) return;
1281
+ /\S/.test(r.text) || (c = 0);
1282
+ let l = /^\s*/.exec(r.text)[0], u = e(t, c);
1283
+ (l != u || s.from < r.from + l.length) && (i[r.from] = c, o.push({
1284
+ from: r.from,
1285
+ to: r.from + l.length,
1286
+ insert: u
1287
+ }));
1288
+ });
1289
+ return o.changes.empty || r(t.update(o, { userEvent: "indent" })), !0;
1290
+ }, Nn = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update($(e, (t, n) => {
1291
+ n.push({
1292
+ from: t.from,
1293
+ insert: e.facet(ie)
1294
+ });
1295
+ }), { userEvent: "input.indent" })), !0), Pn = ({ state: t, dispatch: n }) => !t.readOnly && (n(t.update($(t, (n, r) => {
1296
+ let a = /^\s*/.exec(n.text)[0];
1297
+ if (!a) return;
1298
+ let o = l(a, t.tabSize), s = 0, c = e(t, Math.max(0, o - i(t)));
1299
+ for (; s < a.length && s < c.length && a.charCodeAt(s) == c.charCodeAt(s);) s++;
1300
+ r.push({
1301
+ from: n.from + s,
1302
+ to: n.from + a.length,
1303
+ insert: c.slice(s)
1304
+ });
1305
+ }), { userEvent: "delete.dedent" })), !0), Fn = (e) => (e.setTabFocusMode(), !0), In = ({ state: e, dispatch: t }) => e.selection.ranges.some((e) => !e.empty) ? Nn({
1306
+ state: e,
1307
+ dispatch: t
1308
+ }) : (t(e.update(e.replaceSelection(" "), {
1309
+ scrollIntoView: !0,
1310
+ userEvent: "input"
1311
+ })), !0), Ln = [
878
1312
  {
879
- key: "Mod-ArrowLeft",
880
- mac: "Alt-ArrowLeft",
881
- run: He,
882
- shift: dt,
1313
+ key: "Ctrl-b",
1314
+ run: dt,
1315
+ shift: Pt,
883
1316
  preventDefault: !0
884
1317
  },
885
1318
  {
886
- mac: "Cmd-ArrowLeft",
887
- run: tt,
888
- shift: Ct,
889
- preventDefault: !0
1319
+ key: "Ctrl-f",
1320
+ run: ft,
1321
+ shift: Ft
890
1322
  },
891
1323
  {
892
- key: "ArrowRight",
893
- run: Be,
894
- shift: lt,
895
- preventDefault: !0
1324
+ key: "Ctrl-p",
1325
+ run: bt,
1326
+ shift: Ht
896
1327
  },
897
1328
  {
898
- key: "Mod-ArrowRight",
899
- mac: "Alt-ArrowRight",
900
- run: Ue,
901
- shift: ft,
902
- preventDefault: !0
1329
+ key: "Ctrl-n",
1330
+ run: xt,
1331
+ shift: Ut
903
1332
  },
904
1333
  {
905
- mac: "Cmd-ArrowRight",
906
- run: nt,
907
- shift: wt,
908
- preventDefault: !0
1334
+ key: "Ctrl-a",
1335
+ run: kt,
1336
+ shift: Zt
909
1337
  },
910
1338
  {
911
- key: "ArrowUp",
912
- run: Je,
913
- shift: gt,
914
- preventDefault: !0
1339
+ key: "Ctrl-e",
1340
+ run: At,
1341
+ shift: Qt
915
1342
  },
916
1343
  {
917
- mac: "Cmd-ArrowUp",
918
- run: Dt,
919
- shift: kt
1344
+ key: "Ctrl-d",
1345
+ run: fn
920
1346
  },
921
1347
  {
922
- mac: "Ctrl-ArrowUp",
923
- run: Qe,
924
- shift: yt
1348
+ key: "Ctrl-h",
1349
+ run: Z
925
1350
  },
926
1351
  {
927
- key: "ArrowDown",
928
- run: Ye,
929
- shift: _t,
930
- preventDefault: !0
1352
+ key: "Ctrl-k",
1353
+ run: gn
931
1354
  },
932
1355
  {
933
- mac: "Cmd-ArrowDown",
1356
+ key: "Ctrl-Alt-h",
1357
+ run: mn
1358
+ },
1359
+ {
1360
+ key: "Ctrl-o",
1361
+ run: yn
1362
+ },
1363
+ {
1364
+ key: "Ctrl-t",
1365
+ run: bn
1366
+ },
1367
+ {
1368
+ key: "Ctrl-v",
1369
+ run: K
1370
+ }
1371
+ ], Rn = /*@__PURE__*/ [
1372
+ {
1373
+ key: "ArrowLeft",
1374
+ run: dt,
1375
+ shift: Pt,
1376
+ preventDefault: !0
1377
+ },
1378
+ {
1379
+ key: "Mod-ArrowLeft",
1380
+ mac: "Alt-ArrowLeft",
1381
+ run: mt,
1382
+ shift: Lt,
1383
+ preventDefault: !0
1384
+ },
1385
+ {
1386
+ mac: "Cmd-ArrowLeft",
1387
+ run: Dt,
1388
+ shift: Yt,
1389
+ preventDefault: !0
1390
+ },
1391
+ {
1392
+ key: "ArrowRight",
1393
+ run: ft,
1394
+ shift: Ft,
1395
+ preventDefault: !0
1396
+ },
1397
+ {
1398
+ key: "Mod-ArrowRight",
1399
+ mac: "Alt-ArrowRight",
1400
+ run: ht,
1401
+ shift: Rt,
1402
+ preventDefault: !0
1403
+ },
1404
+ {
1405
+ mac: "Cmd-ArrowRight",
934
1406
  run: Ot,
935
- shift: At
1407
+ shift: Xt,
1408
+ preventDefault: !0
1409
+ },
1410
+ {
1411
+ key: "ArrowUp",
1412
+ run: bt,
1413
+ shift: Ht,
1414
+ preventDefault: !0
1415
+ },
1416
+ {
1417
+ mac: "Cmd-ArrowUp",
1418
+ run: $t,
1419
+ shift: tn
1420
+ },
1421
+ {
1422
+ mac: "Ctrl-ArrowUp",
1423
+ run: wt,
1424
+ shift: Gt
1425
+ },
1426
+ {
1427
+ key: "ArrowDown",
1428
+ run: xt,
1429
+ shift: Ut,
1430
+ preventDefault: !0
1431
+ },
1432
+ {
1433
+ mac: "Cmd-ArrowDown",
1434
+ run: en,
1435
+ shift: nn
936
1436
  },
937
1437
  {
938
1438
  mac: "Ctrl-ArrowDown",
939
- run: R,
940
- shift: bt
1439
+ run: K,
1440
+ shift: Kt
941
1441
  },
942
1442
  {
943
1443
  key: "PageUp",
944
- run: Qe,
945
- shift: yt
1444
+ run: wt,
1445
+ shift: Gt
946
1446
  },
947
1447
  {
948
1448
  key: "PageDown",
949
- run: R,
950
- shift: bt
1449
+ run: K,
1450
+ shift: Kt
951
1451
  },
952
1452
  {
953
1453
  key: "Home",
954
- run: et,
955
- shift: St,
1454
+ run: Et,
1455
+ shift: Jt,
956
1456
  preventDefault: !0
957
1457
  },
958
1458
  {
959
1459
  key: "Mod-Home",
960
- run: Dt,
961
- shift: kt
1460
+ run: $t,
1461
+ shift: tn
962
1462
  },
963
1463
  {
964
1464
  key: "End",
965
- run: $e,
966
- shift: xt,
1465
+ run: Tt,
1466
+ shift: qt,
967
1467
  preventDefault: !0
968
1468
  },
969
1469
  {
970
1470
  key: "Mod-End",
971
- run: Ot,
972
- shift: At
1471
+ run: en,
1472
+ shift: nn
973
1473
  },
974
1474
  {
975
1475
  key: "Enter",
976
- run: nn,
977
- shift: nn
1476
+ run: kn,
1477
+ shift: kn
978
1478
  },
979
1479
  {
980
1480
  key: "Mod-a",
981
- run: jt
1481
+ run: rn
982
1482
  },
983
1483
  {
984
1484
  key: "Backspace",
985
- run: U,
986
- shift: U,
1485
+ run: Z,
1486
+ shift: Z,
987
1487
  preventDefault: !0
988
1488
  },
989
1489
  {
990
1490
  key: "Delete",
991
- run: zt,
1491
+ run: fn,
992
1492
  preventDefault: !0
993
1493
  },
994
1494
  {
995
1495
  key: "Mod-Backspace",
996
1496
  mac: "Alt-Backspace",
997
- run: Vt,
1497
+ run: mn,
998
1498
  preventDefault: !0
999
1499
  },
1000
1500
  {
1001
1501
  key: "Mod-Delete",
1002
1502
  mac: "Alt-Delete",
1003
- run: Ht,
1503
+ run: hn,
1004
1504
  preventDefault: !0
1005
1505
  },
1006
1506
  {
1007
1507
  mac: "Mod-Backspace",
1008
- run: Wt,
1508
+ run: _n,
1009
1509
  preventDefault: !0
1010
1510
  },
1011
1511
  {
1012
1512
  mac: "Mod-Delete",
1013
- run: Gt,
1513
+ run: vn,
1014
1514
  preventDefault: !0
1015
1515
  }
1016
- ].concat(/*@__PURE__*/ un.map((e) => ({
1516
+ ].concat(/*@__PURE__*/ Ln.map((e) => ({
1017
1517
  mac: e.key,
1018
1518
  run: e.run,
1019
1519
  shift: e.shift
1020
- }))), fn = /*@__PURE__*/ [
1520
+ }))), zn = /*@__PURE__*/ [
1021
1521
  {
1022
1522
  key: "Alt-ArrowLeft",
1023
1523
  mac: "Ctrl-ArrowLeft",
1024
- run: Ge,
1025
- shift: pt
1524
+ run: _t,
1525
+ shift: zt
1026
1526
  },
1027
1527
  {
1028
1528
  key: "Alt-ArrowRight",
1029
1529
  mac: "Ctrl-ArrowRight",
1030
- run: Ke,
1031
- shift: mt
1530
+ run: vt,
1531
+ shift: Bt
1032
1532
  },
1033
1533
  {
1034
1534
  key: "Alt-ArrowUp",
1035
- run: Yt
1535
+ run: Sn
1036
1536
  },
1037
1537
  {
1038
1538
  key: "Shift-Alt-ArrowUp",
1039
- run: Qt
1539
+ run: Tn
1040
1540
  },
1041
1541
  {
1042
1542
  key: "Alt-ArrowDown",
1043
- run: Xt
1543
+ run: Cn
1044
1544
  },
1045
1545
  {
1046
1546
  key: "Shift-Alt-ArrowDown",
1047
- run: $t
1547
+ run: En
1048
1548
  },
1049
1549
  {
1050
1550
  key: "Mod-Alt-ArrowUp",
1051
- run: Ft
1551
+ run: cn
1052
1552
  },
1053
1553
  {
1054
1554
  key: "Mod-Alt-ArrowDown",
1055
- run: It
1555
+ run: ln
1056
1556
  },
1057
1557
  {
1058
1558
  key: "Escape",
1059
- run: Lt
1559
+ run: un
1060
1560
  },
1061
1561
  {
1062
1562
  key: "Mod-Enter",
1063
- run: rn
1563
+ run: An
1064
1564
  },
1065
1565
  {
1066
1566
  key: "Alt-l",
1067
1567
  mac: "Ctrl-l",
1068
- run: Mt
1568
+ run: an
1069
1569
  },
1070
1570
  {
1071
1571
  key: "Mod-i",
1072
- run: Nt,
1572
+ run: on,
1073
1573
  preventDefault: !0
1074
1574
  },
1075
1575
  {
1076
1576
  key: "Mod-[",
1077
- run: sn
1577
+ run: Pn
1078
1578
  },
1079
1579
  {
1080
1580
  key: "Mod-]",
1081
- run: K
1581
+ run: Nn
1082
1582
  },
1083
1583
  {
1084
1584
  key: "Mod-Alt-\\",
1085
- run: on
1585
+ run: Mn
1086
1586
  },
1087
1587
  {
1088
1588
  key: "Shift-Mod-k",
1089
- run: en
1589
+ run: Dn
1090
1590
  },
1091
1591
  {
1092
1592
  key: "Shift-Mod-\\",
1093
- run: ot
1593
+ run: Mt
1094
1594
  },
1095
1595
  {
1096
1596
  key: "Mod-/",
1097
- run: pe
1597
+ run: ze
1098
1598
  },
1099
1599
  {
1100
1600
  key: "Alt-A",
1101
1601
  mac: "Ctrl-A",
1102
- run: he
1602
+ run: Ve
1103
1603
  },
1104
1604
  {
1105
1605
  key: "Ctrl-m",
1106
1606
  mac: "Shift-Alt-m",
1107
- run: cn
1607
+ run: Fn
1108
1608
  }
1109
- ].concat(dn), pn = {
1609
+ ].concat(Rn), Bn = {
1110
1610
  key: "Tab",
1111
- run: K,
1112
- shift: sn
1113
- }, mn = class {
1114
- constructor(e, t, n) {
1115
- this.from = e, this.to = t, this.diagnostic = n;
1116
- }
1117
- }, q = class e {
1118
- constructor(e, t, n) {
1119
- this.diagnostics = e, this.panel = t, this.selected = n;
1120
- }
1121
- static init(t, n, r) {
1122
- let i = r.facet(Q).markerFilter;
1123
- i && (t = i(t, r));
1124
- let a = t.slice().sort((e, t) => e.from - t.from || e.to - t.to), o = new d(), s = [], c = 0, l = r.doc.iter(), u = 0, f = r.doc.length;
1125
- for (let e = 0;;) {
1126
- let t = e == a.length ? null : a[e];
1127
- if (!t && !s.length) break;
1128
- let n, r;
1129
- if (s.length) n = c, r = s.reduce((e, t) => Math.min(e, t.to), t && t.from > n ? t.from : 1e8);
1130
- else {
1131
- if (n = t.from, n > f) break;
1132
- r = t.to, s.push(t), e++;
1133
- }
1134
- for (; e < a.length;) {
1135
- let t = a[e];
1136
- if (t.from == n && (t.to > t.from || t.to == n)) s.push(t), e++, r = Math.min(t.to, r);
1137
- else {
1138
- r = Math.min(t.from, r);
1139
- break;
1140
- }
1141
- }
1142
- r = Math.min(r, f);
1143
- let i = !1;
1144
- if (s.some((e) => e.from == n && (e.to == r || r == f)) && (i = n == r, !i && r - n < 10)) {
1145
- let e = n - (u + l.value.length);
1146
- e > 0 && (l.next(e), u = n);
1147
- for (let e = n;;) {
1148
- if (e >= r) {
1149
- i = !0;
1150
- break;
1151
- }
1152
- if (!l.lineBreak && u + l.value.length > e) break;
1153
- e = u + l.value.length, u += l.value.length, l.next();
1154
- }
1155
- }
1156
- let d = Ln(s);
1157
- if (i) o.add(n, n, v.widget({
1158
- widget: new jn(d),
1159
- diagnostics: s.slice()
1160
- }));
1161
- else {
1162
- let e = s.reduce((e, t) => t.markClass ? e + " " + t.markClass : e, "");
1163
- o.add(n, r, v.mark({
1164
- class: "cm-lintRange cm-lintRange-" + d + e,
1165
- diagnostics: s.slice(),
1166
- inclusiveEnd: s.some((e) => e.to > r)
1167
- }));
1168
- }
1169
- if (c = r, c == f) break;
1170
- for (let e = 0; e < s.length; e++) s[e].to <= c && s.splice(e--, 1);
1171
- }
1172
- let p = o.finish();
1173
- return new e(p, n, J(p));
1174
- }
1175
- };
1176
- function J(e, t = null, n = 0) {
1177
- let r = null;
1178
- return e.between(n, 1e9, (e, n, { spec: i }) => {
1179
- if (!(t && i.diagnostics.indexOf(t) < 0)) {
1180
- if (!r) r = new mn(e, n, t || i.diagnostics[0]);
1181
- else if (i.diagnostics.indexOf(r.diagnostic) < 0) return !1;
1182
- else r = new mn(r.from, n, r.diagnostic);
1183
- }
1184
- }), r;
1185
- }
1186
- function hn(e, t) {
1187
- let n = t.pos, r = t.end || n, i = e.state.facet(Q).hideOn(e, n, r);
1188
- if (i != null) return i;
1189
- let a = e.startState.doc.lineAt(t.pos);
1190
- return !!(e.effects.some((e) => e.is(Y)) || e.changes.touchesRange(a.from, Math.max(a.to, r)));
1191
- }
1192
- function gn(e, t) {
1193
- return e.field(Z, !1) ? t : t.concat(h.appendConfig.of(zn));
1194
- }
1195
- function _n(e, t) {
1196
- return { effects: gn(e, [Y.of(t)]) };
1197
- }
1198
- var Y = /*@__PURE__*/ h.define(), X = /*@__PURE__*/ h.define(), vn = /*@__PURE__*/ h.define(), Z = /*@__PURE__*/ fe.define({
1199
- create() {
1200
- return new q(v.none, null, null);
1201
- },
1202
- update(e, t) {
1203
- if (t.docChanged && e.diagnostics.size) {
1204
- let n = e.diagnostics.map(t.changes), r = null, i = e.panel;
1205
- if (e.selected) {
1206
- let i = t.changes.mapPos(e.selected.from, 1);
1207
- r = J(n, e.selected.diagnostic, i) || J(n, null, i);
1208
- }
1209
- !n.size && i && t.state.facet(Q).autoPanel && (i = null), e = new q(n, i, r);
1210
- }
1211
- for (let n of t.effects) if (n.is(Y)) {
1212
- let r = t.state.facet(Q).autoPanel ? n.value.length ? Nn.open : null : e.panel;
1213
- e = q.init(n.value, r, t.state);
1214
- } else n.is(X) ? e = new q(e.diagnostics, n.value ? Nn.open : null, e.selected) : n.is(vn) && (e = new q(e.diagnostics, e.panel, n.value));
1215
- return e;
1216
- },
1217
- provide: (t) => [te.from(t, (e) => e.panel), e.decorations.from(t, (e) => e.diagnostics)]
1218
- }), yn = /*@__PURE__*/ v.mark({ class: "cm-lintRange cm-lintRange-active" });
1219
- function bn(e, t, n) {
1220
- let { diagnostics: r } = e.state.field(Z), i, a = -1, o = -1;
1221
- r.between(t - +(n < 0), t + +(n > 0), (e, r, { spec: s }) => {
1222
- if (t >= e && t <= r && (e == r || (t > e || n > 0) && (t < r || n < 0))) return i = s.diagnostics, a = e, o = r, !1;
1223
- });
1224
- let s = e.state.facet(Q).tooltipFilter;
1225
- return i && s && (i = s(i, e.state)), i ? {
1226
- pos: a,
1227
- end: o,
1228
- above: !0,
1229
- create() {
1230
- return { dom: xn(e, i) };
1231
- }
1232
- } : null;
1233
- }
1234
- function xn(e, t) {
1235
- return y("ul", { class: "cm-tooltip-lint" }, t.map((t) => An(e, t, !1)));
1236
- }
1237
- var Sn = (e) => {
1238
- let t = e.state.field(Z, !1);
1239
- (!t || !t.panel) && e.dispatch({ effects: gn(e.state, [X.of(!0)]) });
1240
- let n = ae(e, Nn.open);
1241
- return n && n.dom.querySelector(".cm-panel-lint ul").focus(), !0;
1242
- }, Cn = (e) => {
1243
- let t = e.state.field(Z, !1);
1244
- return !t || !t.panel ? !1 : (e.dispatch({ effects: X.of(!1) }), !0);
1245
- }, wn = [{
1246
- key: "Mod-Shift-m",
1247
- run: Sn,
1248
- preventDefault: !0
1249
- }, {
1250
- key: "F8",
1251
- run: (e) => {
1252
- let t = e.state.field(Z, !1);
1253
- if (!t) return !1;
1254
- let n = e.state.selection.main, r = J(t.diagnostics, null, n.to + 1);
1255
- return !r && (r = J(t.diagnostics, null, 0), !r || r.from == n.from && r.to == n.to) ? !1 : (e.dispatch({
1256
- selection: {
1257
- anchor: r.from,
1258
- head: r.to
1259
- },
1260
- scrollIntoView: !0
1261
- }), ue(e, r.from, 1, {
1262
- tooltip: Rn,
1263
- until: (e) => e.docChanged || e.newSelection.main.head < r.from || e.newSelection.main.head > r.to
1264
- }), !0);
1265
- }
1266
- }], Tn = /*@__PURE__*/ de.fromClass(class {
1267
- constructor(e) {
1268
- this.view = e, this.timeout = -1, this.set = !0;
1269
- let { delay: t } = e.state.facet(Q);
1270
- this.lintTime = Date.now() + t, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, t);
1271
- }
1272
- run() {
1273
- clearTimeout(this.timeout);
1274
- let e = Date.now();
1275
- if (e < this.lintTime - 10) this.timeout = setTimeout(this.run, this.lintTime - e);
1276
- else {
1277
- this.set = !1;
1278
- let { state: e } = this.view, { sources: t } = e.facet(Q);
1279
- t.length && En(t.map((e) => Promise.resolve(e(this.view))), (t) => {
1280
- this.view.state.doc == e.doc && this.view.dispatch(_n(this.view.state, t.reduce((e, t) => e.concat(t))));
1281
- }, (e) => {
1282
- ie(this.view.state, e);
1283
- });
1284
- }
1285
- }
1286
- update(e) {
1287
- let t = e.state.facet(Q);
1288
- (e.docChanged || t != e.startState.facet(Q) || t.needsRefresh && t.needsRefresh(e)) && (this.lintTime = Date.now() + t.delay, this.set || (this.set = !0, this.timeout = setTimeout(this.run, t.delay)));
1289
- }
1290
- force() {
1291
- this.set && (this.lintTime = Date.now(), this.run());
1292
- }
1293
- destroy() {
1294
- clearTimeout(this.timeout);
1295
- }
1296
- });
1297
- function En(e, t, n) {
1298
- let r = [], i = -1;
1299
- for (let a of e) a.then((n) => {
1300
- r.push(n), clearTimeout(i), r.length == e.length ? t(r) : i = setTimeout(() => t(r), 200);
1301
- }, n);
1302
- }
1303
- var Q = /*@__PURE__*/ p.define({ combine(e) {
1304
- return {
1305
- sources: e.map((e) => e.source).filter((e) => e != null),
1306
- ...re(e.map((e) => e.config), {
1307
- delay: 750,
1308
- markerFilter: null,
1309
- tooltipFilter: null,
1310
- needsRefresh: null,
1311
- hideOn: () => null
1312
- }, {
1313
- delay: Math.max,
1314
- markerFilter: Dn,
1315
- tooltipFilter: Dn,
1316
- needsRefresh: (e, t) => e ? t ? (n) => e(n) || t(n) : e : t,
1317
- hideOn: (e, t) => e ? t ? (n, r, i) => e(n, r, i) || t(n, r, i) : e : t,
1318
- autoPanel: (e, t) => e || t
1319
- })
1320
- };
1321
- } });
1322
- function Dn(e, t) {
1323
- return e ? t ? (n, r) => t(e(n, r), r) : e : t;
1324
- }
1325
- function On(e, t = {}) {
1326
- return [
1327
- Q.of({
1328
- source: e,
1329
- config: t
1330
- }),
1331
- Tn,
1332
- zn
1333
- ];
1334
- }
1335
- function kn(e) {
1336
- let t = [];
1337
- if (e) actions: for (let { name: n } of e) {
1338
- for (let e = 0; e < n.length; e++) {
1339
- let r = n[e];
1340
- if (/[a-zA-Z]/.test(r) && !t.some((e) => e.toLowerCase() == r.toLowerCase())) {
1341
- t.push(r);
1342
- continue actions;
1343
- }
1344
- }
1345
- t.push("");
1346
- }
1347
- return t;
1348
- }
1349
- function An(e, t, n) {
1350
- let r = n ? kn(t.actions) : [];
1351
- return y("li", { class: "cm-diagnostic cm-diagnostic-" + t.severity }, y("span", { class: "cm-diagnosticText" }, t.renderMessage ? t.renderMessage(e) : t.message), t.actions?.map((n, i) => {
1352
- let a = !1, o = (r) => {
1353
- if (r.preventDefault(), a) return;
1354
- a = !0;
1355
- let i = J(e.state.field(Z).diagnostics, t);
1356
- i && n.apply(e, i.from, i.to);
1357
- }, { name: s } = n, c = r[i] ? s.indexOf(r[i]) : -1, l = c < 0 ? s : [
1358
- s.slice(0, c),
1359
- y("u", s.slice(c, c + 1)),
1360
- s.slice(c + 1)
1361
- ], u = n.markClass ? " " + n.markClass : "";
1362
- return y("button", {
1363
- type: "button",
1364
- class: "cm-diagnosticAction" + u,
1365
- onclick: o,
1366
- onmousedown: o,
1367
- "aria-label": ` Action: ${s}${c < 0 ? "" : ` (access key "${r[i]})"`}.`
1368
- }, l);
1369
- }), t.source && y("div", { class: "cm-diagnosticSource" }, t.source));
1370
- }
1371
- var jn = class extends ce {
1372
- constructor(e) {
1373
- super(), this.sev = e;
1374
- }
1375
- eq(e) {
1376
- return e.sev == this.sev;
1377
- }
1378
- toDOM() {
1379
- return y("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
1380
- }
1381
- }, Mn = class {
1382
- constructor(e, t) {
1383
- this.diagnostic = t, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = An(e, t, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
1384
- }
1385
- }, Nn = class e {
1386
- constructor(e) {
1387
- this.view = e, this.items = [];
1388
- let t = (t) => {
1389
- if (!(t.ctrlKey || t.altKey || t.metaKey)) {
1390
- if (t.keyCode == 27) Cn(this.view), this.view.focus();
1391
- else if (t.keyCode == 38 || t.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
1392
- else if (t.keyCode == 40 || t.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
1393
- else if (t.keyCode == 36) this.moveSelection(0);
1394
- else if (t.keyCode == 35) this.moveSelection(this.items.length - 1);
1395
- else if (t.keyCode == 13) this.view.focus();
1396
- else if (t.keyCode >= 65 && t.keyCode <= 90 && this.selectedIndex >= 0) {
1397
- let { diagnostic: n } = this.items[this.selectedIndex], r = kn(n.actions);
1398
- for (let i = 0; i < r.length; i++) if (r[i].toUpperCase().charCodeAt(0) == t.keyCode) {
1399
- let t = J(this.view.state.field(Z).diagnostics, n);
1400
- t && n.actions[i].apply(e, t.from, t.to);
1401
- }
1402
- } else return;
1403
- t.preventDefault();
1404
- }
1405
- }, n = (e) => {
1406
- for (let t = 0; t < this.items.length; t++) this.items[t].dom.contains(e.target) && this.moveSelection(t);
1407
- };
1408
- this.list = y("ul", {
1409
- tabIndex: 0,
1410
- role: "listbox",
1411
- "aria-label": this.view.state.phrase("Diagnostics"),
1412
- onkeydown: t,
1413
- onclick: n
1414
- }), this.dom = y("div", { class: "cm-panel-lint" }, this.list, y("button", {
1415
- type: "button",
1416
- name: "close",
1417
- "aria-label": this.view.state.phrase("close"),
1418
- onclick: () => Cn(this.view)
1419
- }, "×")), this.update();
1420
- }
1421
- get selectedIndex() {
1422
- let e = this.view.state.field(Z).selected;
1423
- if (!e) return -1;
1424
- for (let t = 0; t < this.items.length; t++) if (this.items[t].diagnostic == e.diagnostic) return t;
1425
- return -1;
1426
- }
1427
- update() {
1428
- let { diagnostics: e, selected: t } = this.view.state.field(Z), n = 0, r = !1, i = null, a = /* @__PURE__ */ new Set();
1429
- for (e.between(0, this.view.state.doc.length, (e, o, { spec: s }) => {
1430
- for (let e of s.diagnostics) {
1431
- if (a.has(e)) continue;
1432
- a.add(e);
1433
- let o = -1, s;
1434
- for (let t = n; t < this.items.length; t++) if (this.items[t].diagnostic == e) {
1435
- o = t;
1436
- break;
1437
- }
1438
- o < 0 ? (s = new Mn(this.view, e), this.items.splice(n, 0, s), r = !0) : (s = this.items[o], o > n && (this.items.splice(n, o - n), r = !0)), t && s.diagnostic == t.diagnostic ? s.dom.hasAttribute("aria-selected") || (s.dom.setAttribute("aria-selected", "true"), i = s) : s.dom.hasAttribute("aria-selected") && s.dom.removeAttribute("aria-selected"), n++;
1439
- }
1440
- }); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0);) r = !0, this.items.pop();
1441
- this.items.length == 0 && (this.items.push(new Mn(this.view, {
1442
- from: -1,
1443
- to: -1,
1444
- severity: "info",
1445
- message: this.view.state.phrase("No diagnostics")
1446
- })), r = !0), i ? (this.list.setAttribute("aria-activedescendant", i.id), this.view.requestMeasure({
1447
- key: this,
1448
- read: () => ({
1449
- sel: i.dom.getBoundingClientRect(),
1450
- panel: this.list.getBoundingClientRect()
1451
- }),
1452
- write: ({ sel: e, panel: t }) => {
1453
- let n = t.height / this.list.offsetHeight;
1454
- e.top < t.top ? this.list.scrollTop -= (t.top - e.top) / n : e.bottom > t.bottom && (this.list.scrollTop += (e.bottom - t.bottom) / n);
1455
- }
1456
- })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), r && this.sync();
1457
- }
1458
- sync() {
1459
- let e = this.list.firstChild;
1460
- function t() {
1461
- let t = e;
1462
- e = t.nextSibling, t.remove();
1463
- }
1464
- for (let n of this.items) if (n.dom.parentNode == this.list) {
1465
- for (; e != n.dom;) t();
1466
- e = n.dom.nextSibling;
1467
- } else this.list.insertBefore(n.dom, e);
1468
- for (; e;) t();
1469
- }
1470
- moveSelection(e) {
1471
- if (this.selectedIndex < 0) return;
1472
- let t = J(this.view.state.field(Z).diagnostics, this.items[e].diagnostic);
1473
- t && this.view.dispatch({
1474
- selection: {
1475
- anchor: t.from,
1476
- head: t.to
1477
- },
1478
- scrollIntoView: !0,
1479
- effects: vn.of(t)
1480
- });
1481
- }
1482
- static open(t) {
1483
- return new e(t);
1484
- }
1611
+ run: Nn,
1612
+ shift: Pn
1485
1613
  };
1486
- function Pn(e, t = "viewBox=\"0 0 40 40\"") {
1487
- return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`;
1488
- }
1489
- function $(e) {
1490
- return Pn(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`, "width=\"6\" height=\"3\"");
1491
- }
1492
- var Fn = /*@__PURE__*/ e.baseTheme({
1493
- ".cm-diagnostic": {
1494
- padding: "3px 6px 3px 8px",
1495
- marginLeft: "-1px",
1496
- display: "block",
1497
- whiteSpace: "pre-wrap"
1498
- },
1499
- ".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
1500
- ".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
1501
- ".cm-diagnostic-info": { borderLeft: "5px solid #999" },
1502
- ".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
1503
- ".cm-diagnosticAction": {
1504
- font: "inherit",
1505
- border: "none",
1506
- padding: "2px 4px",
1507
- backgroundColor: "#444",
1508
- color: "white",
1509
- borderRadius: "3px",
1510
- marginLeft: "8px",
1511
- cursor: "pointer"
1512
- },
1513
- ".cm-diagnosticSource": {
1514
- fontSize: "70%",
1515
- opacity: .7
1516
- },
1517
- ".cm-lintRange": {
1518
- backgroundPosition: "left bottom",
1519
- backgroundRepeat: "repeat-x",
1520
- paddingBottom: "0.7px"
1521
- },
1522
- ".cm-lintRange-error": { backgroundImage: /*@__PURE__*/ $("#f11") },
1523
- ".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/ $("orange") },
1524
- ".cm-lintRange-info": { backgroundImage: /*@__PURE__*/ $("#999") },
1525
- ".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/ $("#66d") },
1526
- ".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
1527
- ".cm-tooltip-lint": {
1528
- padding: 0,
1529
- margin: 0
1530
- },
1531
- ".cm-lintPoint": {
1532
- position: "relative",
1533
- "&:after": {
1534
- content: "\"\"",
1535
- position: "absolute",
1536
- bottom: 0,
1537
- left: "-2px",
1538
- borderLeft: "3px solid transparent",
1539
- borderRight: "3px solid transparent",
1540
- borderBottom: "4px solid #d11"
1541
- }
1542
- },
1543
- ".cm-lintPoint-warning": { "&:after": { borderBottomColor: "orange" } },
1544
- ".cm-lintPoint-info": { "&:after": { borderBottomColor: "#999" } },
1545
- ".cm-lintPoint-hint": { "&:after": { borderBottomColor: "#66d" } },
1546
- ".cm-panel.cm-panel-lint": {
1547
- position: "relative",
1548
- "& ul": {
1549
- maxHeight: "100px",
1550
- overflowY: "auto",
1551
- "& [aria-selected]": {
1552
- backgroundColor: "#ddd",
1553
- "& u": { textDecoration: "underline" }
1554
- },
1555
- "&:focus [aria-selected]": {
1556
- background_fallback: "#bdf",
1557
- backgroundColor: "Highlight",
1558
- color_fallback: "white",
1559
- color: "HighlightText"
1560
- },
1561
- "& u": { textDecoration: "none" },
1562
- padding: 0,
1563
- margin: 0
1564
- },
1565
- "& [name=close]": {
1566
- position: "absolute",
1567
- top: "0",
1568
- right: "2px",
1569
- background: "inherit",
1570
- border: "none",
1571
- font: "inherit",
1572
- padding: 0,
1573
- margin: 0
1574
- }
1575
- },
1576
- "&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
1577
- "&dark .cm-panel.cm-panel-lint ul": { "& [aria-selected]": { backgroundColor: "#2e343e" } }
1578
- });
1579
- function In(e) {
1580
- return e == "error" ? 4 : e == "warning" ? 3 : e == "info" ? 2 : 1;
1581
- }
1582
- function Ln(e) {
1583
- let t = "hint", n = 1;
1584
- for (let r of e) {
1585
- let e = In(r.severity);
1586
- e > n && (n = e, t = r.severity);
1587
- }
1588
- return t;
1589
- }
1590
- var Rn = /*@__PURE__*/ se(bn, { hideOn: hn }), zn = [
1591
- Z,
1592
- /*@__PURE__*/ e.decorations.compute([Z], (e) => {
1593
- let { selected: t, panel: n } = e.field(Z);
1594
- return !t || !n || t.from == t.to ? v.none : v.set([yn.range(t.from, t.to)]);
1595
- }),
1596
- Rn,
1597
- Fn
1598
- ];
1599
- function Bn(e, t) {
1600
- let n = e.field(Z, !1);
1601
- if (n && n.diagnostics.size) {
1602
- let e = [], r = [], i = -1;
1603
- for (let a = c.iter([n.diagnostics]);; a.next()) {
1604
- for (let n = 0; n < e.length; n++) (!a.value || a.value.spec.diagnostics.indexOf(e[n]) < 0) && (t(e[n], r[n], i), e.splice(n, 1), r.splice(n--, 1));
1605
- if (!a.value) break;
1606
- for (let t of a.value.spec.diagnostics) e.indexOf(t) < 0 && (e.push(t), r.push(a.from));
1607
- i = a.to;
1608
- }
1609
- }
1610
- }
1611
1614
  //#endregion
1612
- export { fn as a, Le as c, _n as i, pn as l, wn as n, we as o, On as r, Te as s, Bn as t, ln as u };
1615
+ export { Bn as a, Ce as c, lt as i, De as l, Xe as n, In as o, Ze as r, Re as s, zn as t, ge as u };