dorkos 0.124.0 → 0.125.0

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 (344) hide show
  1. package/dist/bin/cli.js +2319 -1483
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-BH8Ndn3e.js → AboutPage-GdrU2Z3k.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-K5Mew9EX.js → ActivityErrorState-D1T74VJE.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-BB20L5HU.js → ActivityPage-7GXGUwd1.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-C5O7rnmS.js → ActivityRow-C-8dACWp.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Bmybvrzb.js → AdapterIcon-CRRs6yil.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-CkdV7Hhh.js → AdapterSetupWizard-K6DsejqG.js} +2 -2
  10. package/dist/client/assets/{AgentOptionRow-BA2cDa7r.js → AgentOptionRow-CF5XZmBx.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-CsIIPGZJ.js → AgentPicker-BXes2ymU.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-0fOxvaoe.js → AgentRequestCard-BuXVpWfb.js} +4 -4
  13. package/dist/client/assets/{AppearancePage-XOjkkoli.js → AppearancePage-DoqoCU4j.js} +1 -1
  14. package/dist/client/assets/ApplyToOverridesDialog-By8jgPX3.js +1 -0
  15. package/dist/client/assets/AttentionSignalRow-CgGyTDmT.js +1 -0
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-9TVHyRPJ.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BzDxZ-G5.js} +3 -3
  17. package/dist/client/assets/{BindingDialog-DLoAQauL.js → BindingDialog-BXfjFGvP.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-CYHsXAcY.js → BlintzCanvas-C-dobEns.js} +4 -4
  19. package/dist/client/assets/{CanvasCsvContent--Gr7Fe_U.js → CanvasCsvContent-ClMFJX7T.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-BoDE2jjA.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-fnWc0B7B.js +2 -0
  22. package/dist/client/assets/ChannelComposer-DIRPjyyf.js +44 -0
  23. package/dist/client/assets/{ChatAppsOff-D4L1zJVN.js → ChatAppsOff-DlCWmwEz.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-DY_6ju-z.js → CodeMirrorDiff-COsbYyNC.js} +2 -2
  25. package/dist/client/assets/{CodeMirrorEditor-BUoDBsBv.js → CodeMirrorEditor-n3l14rY7.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-wDkcVP9c.js → CommitmentList-S2O_hvwR.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-CzSM6b8R.js → CommitmentsPage-COOCQFpL.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-cERD9H2L.js → ComputerResourceView-PA9T4FZP.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-rMcfbk2_.js → ComputerViewer-CnYUWQBS.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-f7QeQbQo.js → ConnectionAccessLists-C1ZJtNl-.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-BmjtA6pw.js → ConnectionsPage-BBpWiN4-.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-CH-ah6nI.js → ConventionPage-sa0Yn2uq.js} +3 -3
  33. package/dist/client/assets/{ExtensionPageRoute-CJIxa6ST.js → ExtensionPageRoute-BztrmZNp.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BP7EJ2JL.js → FloatingTanStackRouterDevtools-CqogiFob-CJrqr29-.js} +1 -1
  35. package/dist/client/assets/HandlePage-tZidnrlt.js +1 -0
  36. package/dist/client/assets/{HeartbeatPage-BUsf-qrU.js → HeartbeatPage-BkyUpdZt.js} +1 -1
  37. package/dist/client/assets/{KeyEntry-C2kWdN8q.js → KeyEntry-DAMr1NNY.js} +1 -1
  38. package/dist/client/assets/{LexicalField-CR8ulsI_.js → LexicalField-Cnzrh08A.js} +2 -2
  39. package/dist/client/assets/{ManagesPage-DTtsIOGi.js → ManagesPage-EAbQtygH.js} +1 -1
  40. package/dist/client/assets/{Marketplace-iaV5XAzv.js → Marketplace-BfADALGd.js} +2 -2
  41. package/dist/client/assets/{MarketplaceSourcesView-6tgzUfFj.js → MarketplaceSourcesView-u1WKUk-p.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-C7eYYdI9.js → McpAppFrame-Cz-Ttlqr.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-BDyGbJ7I.js → McpSigninBody-CkOBUhOz.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-BujDNuVS.js → Model3dViewer-CvLaSO7V.js} +1 -1
  45. package/dist/client/assets/NamePage-BS-oN_Hi.js +1 -0
  46. package/dist/client/assets/{NewDirectMessageMenu-D4e-z2Jt.js → NewDirectMessageMenu-Be_4mBPd.js} +1 -1
  47. package/dist/client/assets/{NotificationsPage-CkDeTaJp.js → NotificationsPage-GCk9gfsW.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-CtbOt3r5.js → OpenMeshSwitch-BBzgYSUc.js} +2 -2
  49. package/dist/client/assets/{OperatorIdentityForm-Vr4qZnmM.js → OperatorIdentityForm-ZAbJ4FJn.js} +1 -1
  50. package/dist/client/assets/PermissionHistory-DgmFpdJK.js +1 -0
  51. package/dist/client/assets/{PermissionsPage-f4QaX8oM.js → PermissionsPage-DHFt_34a.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-BkZruwF-.js → PersonalityPopover-CobRy95S.js} +1 -1
  53. package/dist/client/assets/PhotoPage-BmFypD13.js +1 -0
  54. package/dist/client/assets/{PreviewRefusedNotice-BXC2K0tx.js → PreviewRefusedNotice-Ux5sq2Om.js} +1 -1
  55. package/dist/client/assets/ProfileFields-kBzeRPfc.js +1 -0
  56. package/dist/client/assets/{ProfilePanelContainer-DZoL65zQ.js → ProfilePanelContainer-CREt4ZC3.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-D9H7wsuT.js → ProfileRolePicker-hQbo8P6M.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-B5fDmc-g.js → PromptSuggestionChips-CmW1lIso.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-uVYhSqj7.js → ReportsToPopover-Dpa-_NsO.js} +1 -1
  60. package/dist/client/assets/RoomSurface-BQhgKnIE.js +1 -0
  61. package/dist/client/assets/{RoomsPage-yflYFulU.js → RoomsPage-BHUDRYzJ.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-DtGrX1Vq.js → RunsOnPopover-bGZ6VJoF.js} +1 -1
  63. package/dist/client/assets/RuntimeConnectFlow-DN2ElvcH.js +1 -0
  64. package/dist/client/assets/{RuntimeSetupDialog-Cr4GRi8c.js → RuntimeSetupDialog-CUFie4LV.js} +1 -1
  65. package/dist/client/assets/SeenDevices-D_FnsL7V.js +19 -0
  66. package/dist/client/assets/{SessionsPage-BWu-en78.js → SessionsPage-1uOPUCP9.js} +1 -1
  67. package/dist/client/assets/SettingsDialog-AbwEHDG8.js +12 -0
  68. package/dist/client/assets/{SkillsPage-BdUb9SZy.js → SkillsPage-BEobBuAr.js} +1 -1
  69. package/dist/client/assets/TaskDialogWrapper-BAFSmT-z.js +1 -0
  70. package/dist/client/assets/{TasksEmptyState-Bgcg9vxF.js → TasksEmptyState-BFw2ODM-.js} +2 -2
  71. package/dist/client/assets/{TasksPage-Ch5W2WQS.js → TasksPage-C0CMgSFx.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-CPwSIMRw.js → TeamComputerEntry-BpjxLA1n.js} +1 -1
  73. package/dist/client/assets/ToolsPage-dx-rQ2F1.js +2 -0
  74. package/dist/client/assets/TopologyGraph-LpxkBhGK.js +30 -0
  75. package/dist/client/assets/{TourHost-BPaSwh9I.js → TourHost--UYZoKlJ.js} +1 -1
  76. package/dist/client/assets/{UnlinkDialog-BUWZUu5P.js → UnlinkDialog-BN2odbqD.js} +1 -1
  77. package/dist/client/assets/UnreadDivider-LbVIAoxM.js +1 -0
  78. package/dist/client/assets/{WidgetErrorCard-cS8yMCxU.js → WidgetErrorCard-CAUx4KUI.js} +7 -7
  79. package/dist/client/assets/WorkView-DVx4WoVI.js +63 -0
  80. package/dist/client/assets/_shell-D7Jp6t6_.js +80 -0
  81. package/dist/client/assets/{_shell._home-DCA5k-jb.js → _shell._home-uuqgFA3M.js} +1 -1
  82. package/dist/client/assets/{_shell._home.activity-BX4nFLna.js → _shell._home.activity-CiMsy7bF.js} +1 -1
  83. package/dist/client/assets/_shell._home.index-0Zm5q3-G.js +3 -0
  84. package/dist/client/assets/{_shell._home.tasks-BgUeEvhK.js → _shell._home.tasks-BClPai4g.js} +1 -1
  85. package/dist/client/assets/{_shell._home.workspaces-BPBdnkRt.js → _shell._home.workspaces-DH4BgLT0.js} +1 -1
  86. package/dist/client/assets/{_shell.channels-CX4kki7G.js → _shell.channels-BGXkXPhY.js} +4 -4
  87. package/dist/client/assets/{_shell.connections-0vP7g7E4.js → _shell.connections-BwjXkgi1.js} +1 -1
  88. package/dist/client/assets/{_shell.feedback-requests-TsuaO4eR.js → _shell.feedback-requests-j7gTBF5b.js} +1 -1
  89. package/dist/client/assets/_shell.marketplace-6JRXJ9gt.js +1 -0
  90. package/dist/client/assets/_shell.marketplace_.sources-DriHXfBM.js +1 -0
  91. package/dist/client/assets/_shell.session-BXSWGdwi.js +1 -0
  92. package/dist/client/assets/{_shell.team-Bm6cOBhR.js → _shell.team-BgJu1gDa.js} +5 -5
  93. package/dist/client/assets/_shell.threads-C1IJJzcf.js +1 -0
  94. package/dist/client/assets/_shell.x._extensionId-BNgicBXG.js +1 -0
  95. package/dist/client/assets/_shell.x._extensionId_._-BNgicBXG.js +1 -0
  96. package/dist/client/assets/{abnfDiagram-WEYOIA3C-CrvoN15x.js → abnfDiagram-WEYOIA3C-BuEHMh0D.js} +1 -1
  97. package/dist/client/assets/{access-copy-B3yNZ7Gz.js → access-copy-BZNjpw9v.js} +1 -1
  98. package/dist/client/assets/{arc-CuT6QA_y.js → arc-BbGU9Ctb.js} +1 -1
  99. package/dist/client/assets/{architectureDiagram-ZHVYKT53-CPXCZ9H4.js → architectureDiagram-ZHVYKT53-CdRG5sTM.js} +2 -2
  100. package/dist/client/assets/{banner-DRumuw3F.js → banner-C7kHJJGz.js} +2 -2
  101. package/dist/client/assets/{blockDiagram-RJAE7QA3-CM0rka9p.js → blockDiagram-RJAE7QA3-CBQ6YXoI.js} +1 -1
  102. package/dist/client/assets/{c4Diagram-XDPPPE54-D4j2cXRy.js → c4Diagram-XDPPPE54-DavNcKCF.js} +1 -1
  103. package/dist/client/assets/{card-B3CtfC3R.js → card-D4ek-VvX.js} +1 -1
  104. package/dist/client/assets/channel-ClNeQ2PQ.js +1 -0
  105. package/dist/client/assets/{chunk-2E7WHVMD-KGyqhVpO.js → chunk-2E7WHVMD-ClO15ze9.js} +1 -1
  106. package/dist/client/assets/{chunk-2Q5K7J3B-Dl0BHoqK.js → chunk-2Q5K7J3B-DsLDzf_i.js} +1 -1
  107. package/dist/client/assets/{chunk-4EMNKR2T-Da7vH6Kv.js → chunk-4EMNKR2T-D20fXIIK.js} +1 -1
  108. package/dist/client/assets/{chunk-55XCU76K-DgBUEROO.js → chunk-55XCU76K-no_S5sRX.js} +1 -1
  109. package/dist/client/assets/{chunk-5VM5RSS4-BQ4mn-_I.js → chunk-5VM5RSS4-D5xWEZ2p.js} +1 -1
  110. package/dist/client/assets/{chunk-JWPE2WC7-8LPR3mXf.js → chunk-JWPE2WC7-CnsdZOv0.js} +1 -1
  111. package/dist/client/assets/{chunk-VQ5W62QI-BkIVXi4W.js → chunk-VQ5W62QI-DxYg8tsH.js} +1 -1
  112. package/dist/client/assets/{chunk-XXDRQBXY-DQXJx06h.js → chunk-XXDRQBXY-7CQ-MKdC.js} +1 -1
  113. package/dist/client/assets/{chunk-ZCHMQSOR-DzCE7qlD.js → chunk-ZCHMQSOR-Ca7Jh42b.js} +2 -2
  114. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-C_cZra7c.js → classDiagram-v2-4MYWR3UA-BvZXavcI.js} +1 -1
  115. package/dist/client/assets/{command-CDKbyppr.js → command-srO4Wv-5.js} +1 -1
  116. package/dist/client/assets/{cose-bilkent-JH36ORCC-DlXHdGwT.js → cose-bilkent-JH36ORCC-1NCiJaHv.js} +1 -1
  117. package/dist/client/assets/{cpu-B7xLO7jn.js → cpu-CFIu4JtK.js} +1 -1
  118. package/dist/client/assets/{cynefin-EF2NZ3EQ-HhP4ArLc.js → cynefin-EF2NZ3EQ-DgZeohG3.js} +1 -1
  119. package/dist/client/assets/{cynefinDiagram-WF24UDRP-D4GgWnZV.js → cynefinDiagram-WF24UDRP-MQB2xbJK.js} +1 -1
  120. package/dist/client/assets/{dagre-NK4GIZVX-SZ_OI2Zi.js → dagre-NK4GIZVX-BFHk_Y44.js} +1 -1
  121. package/dist/client/assets/{diagram-CBK3MWTC-BN-_Ja5m.js → diagram-CBK3MWTC-CloEvZfp.js} +1 -1
  122. package/dist/client/assets/{diagram-I5XIIV2D-t7AK6xnL.js → diagram-I5XIIV2D-9nzUtfKI.js} +1 -1
  123. package/dist/client/assets/{diagram-ODIL2UCW-C1V7szSc.js → diagram-ODIL2UCW-DVdnelgu.js} +1 -1
  124. package/dist/client/assets/{diagram-PFBEJUXE-DPtraQ2g.js → diagram-PFBEJUXE-tTEeiAHa.js} +1 -1
  125. package/dist/client/assets/{diagram-RJA3I4VV-D2XNRB2b.js → diagram-RJA3I4VV-QFehV9_1.js} +1 -1
  126. package/dist/client/assets/{diagram-TYUNFSNR-BieaRy38.js → diagram-TYUNFSNR-CYU5li-4.js} +1 -1
  127. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bwki86UY.js → ebnfDiagram-V4P3TTPT-Cn040Beg.js} +1 -1
  128. package/dist/client/assets/{elk-QONTBCTQ-WEXSAyHB.js → elk-QONTBCTQ-tBbnwcb3.js} +1 -1
  129. package/dist/client/assets/{empty-state-J-UJ0BUU.js → empty-state-Bxfi7_ss.js} +1 -1
  130. package/dist/client/assets/{erDiagram-KYQIGQAA-DIKASnoc.js → erDiagram-KYQIGQAA-DAA0fFlD.js} +1 -1
  131. package/dist/client/assets/{execution-config-ILQiJAmy.js → execution-config-afKaYukD.js} +1 -1
  132. package/dist/client/assets/{file-D40js1Zx.js → file-C-ooqbRY.js} +1 -1
  133. package/dist/client/assets/{file-exclamation-point-Dg3ZpiAe.js → file-exclamation-point-BWWgLsMF.js} +1 -1
  134. package/dist/client/assets/{file-text-DgdvRfMk.js → file-text-BJt8biPY.js} +1 -1
  135. package/dist/client/assets/{find-latest-widget-fence-D4kBWC_1.js → find-latest-widget-fence-DPQimlUD.js} +2 -2
  136. package/dist/client/assets/{flowDiagram-IUGLLWBU-CoavNw0M.js → flowDiagram-IUGLLWBU-vYI6TodS.js} +1 -1
  137. package/dist/client/assets/{form-DlPwEgQH.js → form-LJ2Rf9ny.js} +1 -1
  138. package/dist/client/assets/{format-cron-BrK8RzgT.js → format-cron-DrUISrHj.js} +1 -1
  139. package/dist/client/assets/{ganttDiagram-R7GPNTJY-DccKAz7f.js → ganttDiagram-R7GPNTJY-DLYpSX7r.js} +3 -3
  140. package/dist/client/assets/{git-branch-BpxhecMq.js → git-branch-D5xr7U5P.js} +1 -1
  141. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DEbo_dgQ.js → gitGraphDiagram-PDYL7XHY-DNIbVOaY.js} +1 -1
  142. package/dist/client/assets/{graph-DROgI3M3.js → graph-DNjxkUSL.js} +1 -1
  143. package/dist/client/assets/{heart-c7u4Ezxt.js → heart-DnR_GX4I.js} +1 -1
  144. package/dist/client/assets/{highlighted-body-KPVGNVTW-CrATNdTR.js → highlighted-body-KPVGNVTW-L_Jd2uei.js} +1 -1
  145. package/dist/client/assets/image-lightbox-DZIhMyF3.js +1 -0
  146. package/dist/client/assets/{image-off-BExgZjfM.js → image-off-DdvvVxmq.js} +2 -2
  147. package/dist/client/assets/index-5eNHb7up.js +1 -0
  148. package/dist/client/assets/{index-BVqSmajJ.js → index-5hCWBj-r.js} +1 -1
  149. package/dist/client/assets/{index-Be0OJLWK.js → index-9GoQjBFo.js} +1 -1
  150. package/dist/client/assets/{index-DswGXheF.js → index-ANmu61E0.js} +1 -1
  151. package/dist/client/assets/{index-dyAahqKe.js → index-B0jt7Nng.js} +1 -1
  152. package/dist/client/assets/index-B1gC3xYN.js +1 -0
  153. package/dist/client/assets/{index-DDgOoXP1.js → index-B2wx4J9U.js} +1 -1
  154. package/dist/client/assets/{index-DksjixUS.js → index-BAIKz_P0.js} +1 -1
  155. package/dist/client/assets/{index-CT_pFeX_.js → index-BFecX5dC.js} +1 -1
  156. package/dist/client/assets/{index-CqPRAM_6.js → index-BWQfqbbe.js} +1 -1
  157. package/dist/client/assets/{index-BlyoyIck.js → index-BYeyKNKj.js} +1 -1
  158. package/dist/client/assets/{index-CD8aw6Jb.js → index-Ba9q2CoQ.js} +1 -1
  159. package/dist/client/assets/{index-DeRDq7bD.js → index-Blhsfk7u.js} +1 -1
  160. package/dist/client/assets/{index-mwf7ZNk2.js → index-Bpwvxz0c.js} +1 -1
  161. package/dist/client/assets/{index-CYy1cjtq.js → index-BqKjnd_r.js} +1 -1
  162. package/dist/client/assets/{index-2wezsLA_.js → index-Bri5bZfv.js} +1 -1
  163. package/dist/client/assets/{index-CZmqtJWZ.js → index-BsHyymmC.js} +1 -1
  164. package/dist/client/assets/index-BsmR2hi4.js +23 -0
  165. package/dist/client/assets/index-By-VWzSF.js +43 -0
  166. package/dist/client/assets/{index-D150FXCC.js → index-By8pKNSM.js} +1 -1
  167. package/dist/client/assets/{index-B3eeEDWj.js → index-BzKkoaB1.js} +3 -3
  168. package/dist/client/assets/{index-DaZ1I8s-.js → index-CDGWl8qL.js} +1 -1
  169. package/dist/client/assets/{index-J3Hh1MnL.js → index-CDo6TA8n.js} +1 -1
  170. package/dist/client/assets/{index-DINk1YfD.js → index-CLQIvYHP.js} +1 -1
  171. package/dist/client/assets/{index-D3YeRrne.js → index-CLbs0fcq.js} +1 -1
  172. package/dist/client/assets/{index-DxiRRZRo.js → index-CQ2atcs_.js} +1 -1
  173. package/dist/client/assets/index-CSqz4B0v.js +1 -0
  174. package/dist/client/assets/{index-BizvylBV.js → index-CXWlrRzK.js} +1 -1
  175. package/dist/client/assets/{index-CbHCZsbE.js → index-D-Q7CW4p.js} +1 -1
  176. package/dist/client/assets/index-D0ujPZdD.js +1 -0
  177. package/dist/client/assets/index-D1kQ19Gb.css +1 -0
  178. package/dist/client/assets/index-DHi8-3w0.js +1 -0
  179. package/dist/client/assets/index-DKTd8X7n.js +1053 -0
  180. package/dist/client/assets/{index-D0eJtRlK.js → index-DTuNXPGU.js} +1 -1
  181. package/dist/client/assets/{index-Ccf1XBTs.js → index-DXWsH2Ep.js} +1 -1
  182. package/dist/client/assets/index-DjFFFMc-.js +2 -0
  183. package/dist/client/assets/{index-C7B3eSOP.js → index-DqCxUalt.js} +1 -1
  184. package/dist/client/assets/{index-C5or4L_3.js → index-Ixk2o7yl.js} +1 -1
  185. package/dist/client/assets/{index-AzyLwYS_.js → index-ZYbeRA5f.js} +3 -3
  186. package/dist/client/assets/index-a6ojvFqI.js +1 -0
  187. package/dist/client/assets/{index-DT7pv2iW.js → index-adYd35CJ.js} +1 -1
  188. package/dist/client/assets/{index-DhHobJd3.js → index-ld6lMfGU.js} +1 -1
  189. package/dist/client/assets/{index-DNGNMW3c.js → index-r0stHl-2.js} +1 -1
  190. package/dist/client/assets/index-uIonuakd.js +1 -0
  191. package/dist/client/assets/{index-BEkYBuOq.js → index-xfRcAp50.js} +1 -1
  192. package/dist/client/assets/{index.esm-BFJ9SG0n.js → index.esm-j5KQ_b6S.js} +1 -1
  193. package/dist/client/assets/{infoDiagram-MVDRKAX5-VL8q5pKx.js → infoDiagram-MVDRKAX5-DjvSkTas.js} +1 -1
  194. package/dist/client/assets/{inline-code-BE9ckzPs.js → inline-code-DlVYFFW7.js} +1 -1
  195. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BLKkPYF-.js → ishikawaDiagram-HPEHV2GE-BBivrI5n.js} +1 -1
  196. package/dist/client/assets/{journeyDiagram-BOSHW7O7-CSYpRobu.js → journeyDiagram-BOSHW7O7-DKdhbtdx.js} +1 -1
  197. package/dist/client/assets/{kanban-definition-FNSA4HC5-HilAqtZo.js → kanban-definition-FNSA4HC5-CkgAodR5.js} +1 -1
  198. package/dist/client/assets/{layers-Cm7coqdo.js → layers-CzyhuVSM.js} +1 -1
  199. package/dist/client/assets/{lightbulb-DqdWS75d.js → lightbulb-DwGE7s99.js} +1 -1
  200. package/dist/client/assets/{link-2-CDJapTSa.js → link-2-CljREnN9.js} +1 -1
  201. package/dist/client/assets/{list-runtime-types-CP82p1u4.js → list-runtime-types-D5ZO30FL.js} +1 -1
  202. package/dist/client/assets/{markdown-content-m_qereFc.js → markdown-content-CN_dGlgE.js} +1 -1
  203. package/dist/client/assets/{mention-pill-DV5HIG5Q.js → mention-pill-C6OT4gx4.js} +1 -1
  204. package/dist/client/assets/{mermaid.core-zxW6MBr-.js → mermaid.core-DNuzxE7q.js} +4 -4
  205. package/dist/client/assets/{message-square-off-YVtpbaJ0.js → message-square-off-DlkAPJdd.js} +1 -1
  206. package/dist/client/assets/{mindmap-definition-6OY57UG3-IAYemvOg.js → mindmap-definition-6OY57UG3-f9ygKKO1.js} +1 -1
  207. package/dist/client/assets/{more-details-ReA2ZFBn.js → more-details-DRPervoL.js} +1 -1
  208. package/dist/client/assets/{owner-notice-M4hn_1ep.js → owner-notice-C-Q9ySA7.js} +1 -1
  209. package/dist/client/assets/{package-CUuTl39E.js → package-BVNiaGrb.js} +1 -1
  210. package/dist/client/assets/{page-container-BnmNikNZ.js → page-container-D03bhclt.js} +1 -1
  211. package/dist/client/assets/pane-resize-handle-CZ9rHhNr.js +1 -0
  212. package/dist/client/assets/{paperclip-C6fYq5Zf.js → paperclip-DQQVX5tJ.js} +1 -1
  213. package/dist/client/assets/{path-input-DHn9-XaE.js → path-input-CQ16nhYd.js} +1 -1
  214. package/dist/client/assets/{pegDiagram-ECIUJNBX-CojaUwe7.js → pegDiagram-ECIUJNBX-CZ_YkcKh.js} +1 -1
  215. package/dist/client/assets/{pieDiagram-GNMPY74T-CjP3pw6V.js → pieDiagram-GNMPY74T-DLHSPEH7.js} +1 -1
  216. package/dist/client/assets/{plug-DHQcxt7N.js → plug-CadJyjTp.js} +1 -1
  217. package/dist/client/assets/primer-trigger-DH4xfrlM.js +3 -0
  218. package/dist/client/assets/profile-errors-DSnHlauU.js +1 -0
  219. package/dist/client/assets/{progress-4FQQfnS6.js → progress-BB97hlmb.js} +1 -1
  220. package/dist/client/assets/{quadrantDiagram-D57K4MC3-OP0Z8zcR.js → quadrantDiagram-D57K4MC3-BWcUu48x.js} +1 -1
  221. package/dist/client/assets/{query-error-state-BkUdxenP.js → query-error-state-B456s96E.js} +1 -1
  222. package/dist/client/assets/{radio-ta5Bw763.js → radio-DrpN3x3S.js} +1 -1
  223. package/dist/client/assets/{railroadDiagram-Y72NRBL7-CT3NCb9b.js → railroadDiagram-Y72NRBL7-C2VRM83h.js} +1 -1
  224. package/dist/client/assets/registry-DRvQ3ChB.js +1 -0
  225. package/dist/client/assets/{relay-trace-schemas-DwUuyxao.js → relay-trace-schemas-BYCaGsVJ.js} +2 -2
  226. package/dist/client/assets/repeat-DPzic7-j.js +11 -0
  227. package/dist/client/assets/{requirementDiagram-EQYSW5RA-tde4lYGp.js → requirementDiagram-EQYSW5RA-B1bpdcM7.js} +1 -1
  228. package/dist/client/assets/{room-files-source-CZWhaaOy.js → room-files-source-aN4p_kDV.js} +2 -2
  229. package/dist/client/assets/{rotate-ccw-clock-RfbbgUa4.js → rotate-ccw-clock-gqBy98sI.js} +1 -1
  230. package/dist/client/assets/{rotate-cw-B3rB_YSw.js → rotate-cw-mHsqEte-.js} +1 -1
  231. package/dist/client/assets/{sankeyDiagram-SY24JHO5-sdCzIA7-.js → sankeyDiagram-SY24JHO5-QCGTTh9k.js} +1 -1
  232. package/dist/client/assets/{scroll-area-B4WB7Q40.js → scroll-area-DVd6ctli.js} +1 -1
  233. package/dist/client/assets/{search-x-DCUmWW2_.js → search-x-CzgTzL0z.js} +2 -2
  234. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-DvzTJcKu.js → sequenceDiagram-BLEHNHQU-kiR1gX_u.js} +1 -1
  235. package/dist/client/assets/{shield-x-CANziVLc.js → shield-x-Btfd3Xnx.js} +1 -1
  236. package/dist/client/assets/{signed-in-DctJ2IWe.js → signed-in-gS3tMpTW.js} +1 -1
  237. package/dist/client/assets/{sizeCapture-INFHLROL-DuDA7TKE.js → sizeCapture-INFHLROL-Da56aMj0.js} +1 -1
  238. package/dist/client/assets/{soul-file-Co_8f1qw.js → soul-file-C7zd1yXt.js} +1 -1
  239. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BJPX5JTC.js → stateDiagram-v2-A6IESKWZ-BZ3qlQWl.js} +1 -1
  240. package/dist/client/assets/{swimlanes-B3ENRKFQ-CiLSffGv.js → swimlanes-B3ENRKFQ-B-wp91_T.js} +1 -1
  241. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Drg_8k1s.js +8 -0
  242. package/dist/client/assets/{table-BSAvOYPp.js → table-BIdFvzBs.js} +1 -1
  243. package/dist/client/assets/{timeline-definition-JXYKGLGB-5oq8sl82.js → timeline-definition-JXYKGLGB-CQojjy-8.js} +1 -1
  244. package/dist/client/assets/{trust-posture-D-Yjm6ot.js → trust-posture-DszobEjt.js} +1 -1
  245. package/dist/client/assets/{unplug-Bq_1WdV7.js → unplug-xlfZ61jC.js} +1 -1
  246. package/dist/client/assets/{unverified-catalog-notice-CEzu54YH.js → unverified-catalog-notice-DymrAwtm.js} +1 -1
  247. package/dist/client/assets/{use-adapter-catalog-Tn3ZbPAj.js → use-adapter-catalog-CytBTafV.js} +1 -1
  248. package/dist/client/assets/{use-bindings-Bz9YRgO7.js → use-bindings-BPNK3sUh.js} +1 -1
  249. package/dist/client/assets/{use-composer-prefs-D9oKJSQN.js → use-composer-prefs-DMQT0qiv.js} +1 -1
  250. package/dist/client/assets/{use-connector-management-CLYFraXN.js → use-connector-management-PDVdWccW.js} +1 -1
  251. package/dist/client/assets/{use-deep-link-scroll-DkS713kG.js → use-deep-link-scroll-CwapSmGj.js} +1 -1
  252. package/dist/client/assets/{use-delete-binding-CukKpHBK.js → use-delete-binding-CgTwS83G.js} +1 -1
  253. package/dist/client/assets/{use-dev-links-DQ32IcGe.js → use-dev-links-BoZCIc4h.js} +1 -1
  254. package/dist/client/assets/use-direct-message-panel-Cs4I6669.js +1 -0
  255. package/dist/client/assets/{use-external-adapter-catalog-D-FO_XW6.js → use-external-adapter-catalog-PBrsasQ8.js} +1 -1
  256. package/dist/client/assets/{use-full-activity-feed-BNxcyb1j.js → use-full-activity-feed-C2seN-V1.js} +1 -1
  257. package/dist/client/assets/use-is-below-desktop-pvzUlnxh.js +1 -0
  258. package/dist/client/assets/use-is-hub-CvEPWuj0.js +1 -0
  259. package/dist/client/assets/{use-local-browser-xg7WXAVK.js → use-local-browser-CF0uGQ6e.js} +1 -1
  260. package/dist/client/assets/{use-mesh-topology-BgCSFw8s.js → use-mesh-topology-CnCeK4gS.js} +1 -1
  261. package/dist/client/assets/{use-mounted-ref-qRbdZfOU.js → use-mounted-ref-BtAb14HI.js} +1 -1
  262. package/dist/client/assets/{use-notification-prefs-B-4kZR7I.js → use-notification-prefs-B8LHpZTt.js} +1 -1
  263. package/dist/client/assets/{use-panel-tab-placements-CCq-mZlY.js → use-panel-tab-placements-DOXj0Pii.js} +1 -1
  264. package/dist/client/assets/use-pending-read-DBaC7e8N.js +1 -0
  265. package/dist/client/assets/{use-personality-commit-DwSisUfF.js → use-personality-commit-YV9FVC-a.js} +1 -1
  266. package/dist/client/assets/{use-promo-activation-Botoso6l.js → use-promo-activation-CjtGhz_3.js} +3 -3
  267. package/dist/client/assets/{use-promo-dismissals-RJXp-r_J.js → use-promo-dismissals-4rbLgSDG.js} +1 -1
  268. package/dist/client/assets/{use-pulse-freshness-B3390hGg.js → use-pulse-freshness-CGqANpVO.js} +1 -1
  269. package/dist/client/assets/{use-relay-config-BV0xcLwS.js → use-relay-config-CvU_70WJ.js} +1 -1
  270. package/dist/client/assets/{use-room-follow-claim-Du4hKHIJ.js → use-room-follow-claim-Doq_lWjk.js} +1 -1
  271. package/dist/client/assets/use-room-sessions-CoEIaBRt.js +1 -0
  272. package/dist/client/assets/{use-roving-tab-list-g2hO6Ruz.js → use-roving-tab-list-BzsrpjWV.js} +1 -1
  273. package/dist/client/assets/use-session-canvas-DQ9ND8il.js +27 -0
  274. package/dist/client/assets/use-status-budget-AnHroEO0.js +16 -0
  275. package/dist/client/assets/{use-unclaimed-chats-B92om889.js → use-unclaimed-chats-DzOLK27i.js} +1 -1
  276. package/dist/client/assets/use-update-config-NRkQbxae.js +1 -0
  277. package/dist/client/assets/{useMutationState-DdOGdpjP.js → useMutationState-BAU_J-u3.js} +1 -1
  278. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Di5pJvcw.js → usecaseDiagram-WPOLBNNX-BrHN0c6G.js} +1 -1
  279. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-K7KAf26T.js → vennDiagram-Q3Y3IDCW-CbeP0Pbp.js} +1 -1
  280. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DVTaxQt9.js → wardleyDiagram-IVAIDKWA-mn5ebFhs.js} +1 -1
  281. package/dist/client/assets/{xychartDiagram-4URNHDU4-x-lSJm_B.js → xychartDiagram-4URNHDU4-C8fXRQEv.js} +1 -1
  282. package/dist/client/index.html +2 -2
  283. package/dist/drizzle/20261019185620_dor3037_wifi_holds.sql +8 -0
  284. package/dist/drizzle/20261020142444_read_cursor_room_thread.sql +17 -0
  285. package/dist/drizzle/20261021004938_dor3203_settle_turn_holds.sql +7 -0
  286. package/dist/drizzle/20261021153328_dor3175_person_chat_mode.sql +1 -0
  287. package/dist/drizzle/meta/20261019185620_snapshot.json +14079 -0
  288. package/dist/drizzle/meta/20261020142444_snapshot.json +14079 -0
  289. package/dist/drizzle/meta/20261021004938_snapshot.json +14079 -0
  290. package/dist/drizzle/meta/20261021153328_snapshot.json +14086 -0
  291. package/dist/drizzle/meta/_journal.json +28 -0
  292. package/dist/server/extension-child.cjs +45 -3
  293. package/dist/server/index.js +61358 -29913
  294. package/dist/server/index.js.map +2 -2
  295. package/package.json +9 -9
  296. package/dist/client/assets/ApplyToOverridesDialog-CoO6V1G4.js +0 -1
  297. package/dist/client/assets/AttentionSignalRow-CjjZobp7.js +0 -1
  298. package/dist/client/assets/CanvasFileContent-estXyAbr.js +0 -2
  299. package/dist/client/assets/CanvasModel3dContent-CkOo930M.js +0 -2
  300. package/dist/client/assets/HandlePage-Cg8H3mQS.js +0 -1
  301. package/dist/client/assets/NamePage-Bx8T98OF.js +0 -1
  302. package/dist/client/assets/PermissionHistory-DzU1rf2B.js +0 -1
  303. package/dist/client/assets/PhotoPage-CmrOIRjf.js +0 -1
  304. package/dist/client/assets/ProfileFields-BebX5oiv.js +0 -1
  305. package/dist/client/assets/RoomSurface-Bg5WV4Ep.js +0 -44
  306. package/dist/client/assets/RuntimeConnectFlow-DjReuQ-T.js +0 -1
  307. package/dist/client/assets/SeenDevices-SPWkdzoK.js +0 -19
  308. package/dist/client/assets/SettingsDialog-_dEXUhHe.js +0 -12
  309. package/dist/client/assets/TaskDialogWrapper-qYJPEoSR.js +0 -1
  310. package/dist/client/assets/ToolsPage-Idimrn3o.js +0 -2
  311. package/dist/client/assets/TopologyGraph-I4_mkMHM.js +0 -30
  312. package/dist/client/assets/_shell-ClVN2pUj.js +0 -80
  313. package/dist/client/assets/_shell._home.index-C8t8cw72.js +0 -3
  314. package/dist/client/assets/_shell.marketplace-CiL6YRbl.js +0 -1
  315. package/dist/client/assets/_shell.marketplace_.sources-C0sI8e21.js +0 -1
  316. package/dist/client/assets/_shell.session-_hhBvFc6.js +0 -63
  317. package/dist/client/assets/_shell.x._extensionId-BWy5v1YE.js +0 -1
  318. package/dist/client/assets/_shell.x._extensionId_._-BWy5v1YE.js +0 -1
  319. package/dist/client/assets/channel-DjBlTcCV.js +0 -1
  320. package/dist/client/assets/image-lightbox-DE_fHkw-.js +0 -1
  321. package/dist/client/assets/index-7jby-RRg.js +0 -1
  322. package/dist/client/assets/index-BGqvci3k.js +0 -1
  323. package/dist/client/assets/index-BkoMsjtM.js +0 -2
  324. package/dist/client/assets/index-BqIHtiaE.js +0 -1
  325. package/dist/client/assets/index-Cga0qx1T.js +0 -1033
  326. package/dist/client/assets/index-Ct4At33X.js +0 -1
  327. package/dist/client/assets/index-DCJQGDZk.js +0 -1
  328. package/dist/client/assets/index-DITPwUa9.js +0 -38
  329. package/dist/client/assets/index-DUZrTFYD.css +0 -1
  330. package/dist/client/assets/index-F-vqXYqa.js +0 -1
  331. package/dist/client/assets/index-InEBtYxw.js +0 -23
  332. package/dist/client/assets/primer-trigger-BmV5wjek.js +0 -3
  333. package/dist/client/assets/profile-errors-BSCuj3rT.js +0 -1
  334. package/dist/client/assets/registry-Dc102rws.js +0 -1
  335. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Dv1-QS9J.js +0 -8
  336. package/dist/client/assets/terminal-6CdY-T1V.js +0 -6
  337. package/dist/client/assets/use-is-below-desktop-gTvJDvw4.js +0 -1
  338. package/dist/client/assets/use-is-hub-B1vPpkYU.js +0 -1
  339. package/dist/client/assets/use-jump-back-in-Bibj5tVk.js +0 -11
  340. package/dist/client/assets/use-pending-read-C8L_v4Zw.js +0 -1
  341. package/dist/client/assets/use-session-canvas-i30oMO_Q.js +0 -25
  342. package/dist/client/assets/use-session-diagnostics-a4b83F5J.js +0 -16
  343. package/dist/client/assets/use-update-config-Tbn3SodN.js +0 -1
  344. /package/dist/client/assets/{_shell-DIs3GY4I.css → WorkView-DIs3GY4I.css} +0 -0
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-zxW6MBr-.js","assets/index-Cga0qx1T.js","assets/index-DUZrTFYD.css","assets/transform-BqqRT-Iy.js"])))=>i.map(i=>d[i]);
2
- var E7=Object.defineProperty;var S1=r=>{throw TypeError(r)};var D7=(r,e,t)=>e in r?E7(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ce=(r,e,t)=>D7(r,typeof e!="symbol"?e+"":e,t),nd=(r,e,t)=>e.has(r)||S1("Cannot "+t);var C=(r,e,t)=>(nd(r,e,"read from private field"),t?t.call(r):e.get(r)),_=(r,e,t)=>e.has(r)?S1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(nd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Wi=(r,e,t)=>(nd(r,e,"access private method"),t);import{pl as C1,pm as O7,pn as _2,po as gh,pp as R7,pq as I7,pr as z7,r as R,R as j2,e6 as bc,ps as yh,pt as vh,pu as $s,pv as M1,pw as V2,px as L7,py as ol,pz as al,pA as T1,pB as es,pC as B7,pD as P7,pE as F7,pF as f0,pG as W2,pH as Ua,gI as $7,pI as q7,pJ as ns,pK as Tr,pL as Ui,pM as Hc,pN as je,ep as H7,pO as _7,pP as j7,pQ as Wr,pR as tu,pS as Mi,pT as U2,pU as A1,j as L,gH as V7,G as W7,aX as U7}from"./index-Cga0qx1T.js";import{p as zf}from"./index-DksjixUS.js";import{aw as K7,ax as G7,ab as J7,ac as Y7,ad as X7,ae as Z7,af as Q7,ag as K2,ah as eb,q as p0,ai as tb,aj as G2,ar as rb,ak as nb,al as ib,am as sb,an as ob,ao as ab,ap as lb,aq as cb,Z as Lf,a4 as ub,a5 as J2,a6 as db,a7 as hb,a8 as fb,a9 as pb,aa as mb,m as gb,a as yb,ay as vb,E as Fa,as as bb,t as ht,n as wb,at as kb,C as N1,az as xb}from"./index-AzyLwYS_.js";const Sb={}.hasOwnProperty;function Y2(r,e){let t=-1,n;if(e.extensions)for(;++t<e.extensions.length;)Y2(r,e.extensions[t]);for(n in e)if(Sb.call(e,n))switch(n){case"extensions":break;case"unsafe":{E1(r[n],e[n]);break}case"join":{E1(r[n],e[n]);break}case"handlers":{Cb(r[n],e[n]);break}default:r.options[n]=e[n]}return r}function E1(r,e){e&&r.push(...e)}function Cb(r,e){e&&Object.assign(r,e)}const Mb=[Tb];function Tb(r,e,t,n){if(e.type==="code"&&C1(e,n)&&(r.type==="list"||r.type===e.type&&C1(r,n)))return!1;if("spread"in t&&typeof t.spread=="boolean")return r.type==="paragraph"&&(r.type===e.type||e.type==="definition"||e.type==="heading"&&O7(e,n))?void 0:t.spread?1:0}const Ki=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Ab=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DNuzxE7q.js","assets/index-DKTd8X7n.js","assets/index-D1kQ19Gb.css","assets/transform-BqqRT-Iy.js"])))=>i.map(i=>d[i]);
2
+ var E7=Object.defineProperty;var S1=r=>{throw TypeError(r)};var D7=(r,e,t)=>e in r?E7(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ce=(r,e,t)=>D7(r,typeof e!="symbol"?e+"":e,t),nd=(r,e,t)=>e.has(r)||S1("Cannot "+t);var C=(r,e,t)=>(nd(r,e,"read from private field"),t?t.call(r):e.get(r)),_=(r,e,t)=>e.has(r)?S1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(nd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Wi=(r,e,t)=>(nd(r,e,"access private method"),t);import{pF as C1,pG as O7,pH as _2,pI as gh,pJ as R7,pK as I7,pL as z7,r as R,R as j2,ez as bc,pM as yh,pN as vh,pO as $s,pP as M1,pQ as V2,pR as L7,pS as ol,pT as al,pU as T1,pV as es,pW as B7,pX as P7,pY as F7,pZ as f0,p_ as W2,p$ as Ua,h1 as $7,q0 as q7,q1 as ns,q2 as Tr,q3 as Ui,q4 as Hc,q5 as je,eR as H7,q6 as _7,q7 as j7,q8 as Wr,q9 as tu,qa as Mi,qb as U2,qc as A1,j as L,hB as V7,G as W7,aZ as U7}from"./index-DKTd8X7n.js";import{p as zf}from"./index-BAIKz_P0.js";import{aw as K7,ax as G7,ab as J7,ac as Y7,ad as X7,ae as Z7,af as Q7,ag as K2,ah as eb,q as p0,ai as tb,aj as G2,ar as rb,ak as nb,al as ib,am as sb,an as ob,ao as ab,ap as lb,aq as cb,Z as Lf,a4 as ub,a5 as J2,a6 as db,a7 as hb,a8 as fb,a9 as pb,aa as mb,m as gb,a as yb,ay as vb,E as Fa,as as bb,t as ht,n as wb,at as kb,C as N1,az as xb}from"./index-ZYbeRA5f.js";const Sb={}.hasOwnProperty;function Y2(r,e){let t=-1,n;if(e.extensions)for(;++t<e.extensions.length;)Y2(r,e.extensions[t]);for(n in e)if(Sb.call(e,n))switch(n){case"extensions":break;case"unsafe":{E1(r[n],e[n]);break}case"join":{E1(r[n],e[n]);break}case"handlers":{Cb(r[n],e[n]);break}default:r.options[n]=e[n]}return r}function E1(r,e){e&&r.push(...e)}function Cb(r,e){e&&Object.assign(r,e)}const Mb=[Tb];function Tb(r,e,t,n){if(e.type==="code"&&C1(e,n)&&(r.type==="list"||r.type===e.type&&C1(r,n)))return!1;if("spread"in t&&typeof t.spread=="boolean")return r.type==="paragraph"&&(r.type===e.type||e.type==="definition"||e.type==="heading"&&O7(e,n))?void 0:t.spread?1:0}const Ki=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Ab=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
3
3
  `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:Ki},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
4
4
  ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:Ki},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
5
5
  *])`},{character:"*",inConstruct:"phrasing",notInConstruct:Ki},{atBreak:!0,character:"+",after:`(?:[ \r
@@ -29,7 +29,7 @@ var E7=Object.defineProperty;var S1=r=>{throw TypeError(r)};var D7=(r,e,t)=>e in
29
29
  `))),0,0),r.someProp("transformPasted",h=>{a=h(a,r,!0)}),a;let d=r.someProp("clipboardTextParser",h=>h(e,i,n,r));if(d)a=d;else{let h=i.marks(),{schema:f}=r.state,m=qs.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let b=o.appendChild(document.createElement("p"));y&&b.appendChild(m.serializeNode(f.text(y,h)))})}}else r.someProp("transformPastedHTML",d=>{t=d(t,r)}),o=Gw(t),xc&&Jw(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(r.someProp("clipboardParser")||r.someProp("domParser")||Is.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Ww.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Yw(pg(a,+u[1],+u[2]),u[4]);else if(a=re.maxOpen(Uw(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=pg(a,d,h)}return r.someProp("transformPasted",d=>{a=d(a,r,l)}),a}const Ww=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Uw(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&t5(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=r5(o[o.length-1],s.length));let u=e5(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return V.from(o)}return r}function e5(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,V.from(r));return r}function t5(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=t5(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(V.from(e5(t,r,i+1))))}}function r5(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,r5(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(V.empty,!0);return r.copy(t.append(n))}function Bh(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,a=o.content;return r.childCount>1&&(s=0),i<n-1&&(a=Bh(a,e,t,n,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(V.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function pg(r,e,t){return e<r.openStart&&(r=new re(Bh(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new re(Bh(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const n5={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function i5(){return document.implementation.createHTMLDocument("title")}let Ia=null;function Kw(r){let e=window.trustedTypes;if(!e)return r;if(!Ia){if(Ia=e.defaultPolicy)try{return Ia.createHTML(r)}catch{}Ia=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return Ia.createHTML(r)}function Gw(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=i5(),n=t.body,i=/<([a-z][^>\s]+)/i.exec(r),s;if((s=i&&n5[i[1].toLowerCase()])&&(r=s.map(o=>"<"+o+">").join("")+r+s.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=Kw(r),s)for(let o=0;o<s.length;o++)n=n.querySelector(s[o])||n;for(let o=0;o<t.styleSheets.length;o++){let a=t.styleSheets[o];for(let l=0;l<a.rules.length;l++){let c=a.rules[l];if(c instanceof CSSStyleRule){let u=n.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return n}function Jw(r){let e=r.querySelectorAll(vt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function Yw(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let a=n.length-2;a>=0;a-=2){let l=t.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;try{l.checkAttrs(n[a+1])}catch{break}i=V.from(l.create(n[a+1],i)),s++,o++}return new re(i,s,o)}const qt={},Ht={},Xw={touchstart:!0,touchmove:!0};class Zw{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Qw(r){for(let e in qt){let t=qt[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{tk(r,n)&&!Vf(r,n)&&(r.editable||!(n.type in Ht))&&t(r,n)},Xw[e]?{passive:!0}:void 0)}Et&&r.dom.addEventListener("input",()=>null),Ph(r)}function Ln(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function ek(r){r.input.mouseDown&&r.input.mouseDown.done(),r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function Ph(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>Vf(r,n))})}function Vf(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function tk(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function rk(r,e){!Vf(r,e)&&qt[e.type]&&(r.editable||!(e.type in Ht))&&qt[e.type](r,e)}Ht.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!l5(r)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(zn&&vt&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),la&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,ts(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||Vw(r,t)?t.preventDefault():Ln(r,"key")};Ht.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};Ht.keypress=(r,e)=>{let t=e;if(l5(r)||!t.charCode||t.ctrlKey&&!t.altKey||Sr&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof se)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function Cc(r){return{left:r.clientX,top:r.clientY}}function nk(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function Wf(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,a=>o>s.depth?a(r,t,s.nodeAfter,s.before(o),i,!0):a(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Mc(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function ik(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&ae.isSelectable(n)?(Mc(r,new ae(t)),!0):!1}function sk(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof ae&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ae.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Mc(r,ae.create(r.state.doc,i)),!0):!1}function ok(r,e,t,n,i){return Wf(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?sk(r,t):ik(r,t))}function ak(r,e,t,n){return Wf(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function lk(r,e,t,n){return Wf(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||ck(r,t,n)}function ck(r,e,t){if(t.button!=0)return!1;let n=s5(r,e,!0),i=r.state.doc;return n?(Mc(r,n),n instanceof se&&i.eq(r.state.doc)&&(r.input.mouseDown=new dk(r,n)),!0):!1}function s5(r,e,t){let n=r.state.doc;if(e==-1)return n.inlineContent?se.create(n,0,n.content.size):null;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)return se.create(n,a+1,a+1+o.content.size);if(t&&ae.isSelectable(o))return ae.create(n,a)}return null}function Uf(r){return B0(r)}const o5=Sr?"metaKey":"ctrlKey";qt.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=Uf(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&nk(t,r.input.lastClick)&&!t[o5]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button},r.input.mouseDown&&r.input.mouseDown.done();let o=r.posAtCoords(Cc(t));o&&(s=="singleClick"?r.input.mouseDown=new uk(r,o,t,!!n):(s=="doubleClick"?ak:lk)(r,o.pos,o.inside,t)?t.preventDefault():Ln(r,"pointer"))};class a5{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class uk extends a5{constructor(e,t,n,i){super(e),this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[o5],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof ae&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Nr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),Ln(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||qn(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Cc(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ln(this.view,"pointer"):ok(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Et&&this.mightDrag&&!this.mightDrag.node.isAtom||vt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Mc(this.view,pe.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ln(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ln(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class dk extends a5{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Ln(this.view,"pointer");let t=this.view.posAtCoords(Cc(e)),n=t&&s5(this.view,t.inside,!1);if(!n)return;let{doc:i}=this.view.state,s=this.startSelection,[o,a]=n.from<s.from?[s.to,n.from]:[s.from,n.to];Mc(this.view,se.create(i,o,a))}}qt.touchstart=r=>{r.input.lastTouch=Date.now(),Uf(r),Ln(r,"pointer")};qt.touchmove=r=>{r.input.lastTouch=Date.now(),Ln(r,"pointer")};qt.contextmenu=r=>Uf(r);function l5(r,e){return r.composing?!0:Et&&Math.abs(Date.now()-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const hk=zn?5e3:-1;Ht.compositionstart=Ht.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof se&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||vt&&Py&&fk(r)))r.markCursor=r.state.storedMarks||t.marks(),B0(r,!0),r.markCursor=null;else if(B0(r,!e.selection.empty),Nr&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=r.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}c5(r,hk)};function fk(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}Ht.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now(),r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.badSafariComposition?r.domObserver.forceFlush():r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,c5(r,20))};function c5(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>B0(r),e))}function u5(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function pk(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=sw(e.focusNode,e.focusOffset),n=ow(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function B0(r,e=!1){if(!(zn&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),u5(r),e||r.docView&&r.docView.dirty){let t=Hf(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function mk(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const fl=Xt&&bi<15||la&&uw<604;qt.copy=Ht.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=fl?null:t.clipboardData,o=n.content(),{dom:a,text:l}=jf(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):mk(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function gk(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function yk(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?pl(r,n.value,null,i,e):pl(r,n.textContent,n.innerHTML,i,e)},50)}function pl(r,e,t,n,i){let s=Qy(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||re.empty)))return!0;if(!s)return!1;let o=gk(s),a=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function d5(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Ht.paste=(r,e)=>{let t=e;if(r.composing&&!zn)return;let n=fl?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&pl(r,d5(n),n.getData("text/html"),i,t)?t.preventDefault():yk(r,t)};class h5{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const vk=Sr?"altKey":"ctrlKey";function f5(r,e){let t;return r.someProp("dragCopies",n=>{t=t||n(e)}),t!=null?!t:!e[vk]}qt.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(Cc(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ae?i.to-1:i.to))){if(n&&n.mightDrag)o=ae.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=r.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=r.docView&&(o=ae.create(r.state.doc,d.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:c,slice:u}=jf(r,a);(!t.dataTransfer.files.length||!vt||By>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(fl?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",fl||t.dataTransfer.setData("text/plain",c),r.dragging=new h5(u,f5(r,t),o)};qt.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};Ht.dragover=Ht.dragenter=(r,e)=>e.preventDefault();Ht.drop=(r,e)=>{try{bk(r,e,r.dragging)}finally{r.dragging=null}};function bk(r,e,t){if(!e.dataTransfer)return;let n=r.posAtCoords(Cc(e));if(!n)return;let i=r.state.doc.resolve(n.pos),s=t&&t.slice;s?r.someProp("transformPasted",f=>{s=f(s,r,!1)}):s=Qy(r,d5(e.dataTransfer),fl?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&f5(r,e));if(r.someProp("handleDrop",f=>f(r,e,s||re.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?K8(r.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=r.state.tr;if(o){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&ae.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new ae(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,y,b,v)=>f=v),l.setSelection(_f(r,h,l.doc.resolve(f)))}r.focus(),r.dispatch(l.setMeta("uiEvent","drop"))}qt.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&qn(r)},20))};qt.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};qt.beforeinput=(r,e)=>{if(zn&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,ts(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in Ht)qt[r]=Ht[r];function ml(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class P0{constructor(e,t){this.toDOM=e,this.spec=t||Ss,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ze(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof P0&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ml(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xi{constructor(e,t){this.attrs=e,this.spec=t||Ss}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new Ze(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof xi&&ml(this.attrs,e.attrs)&&ml(this.spec,e.spec)}static is(e){return e.type instanceof xi}destroy(){}}class Kf{constructor(e,t){this.attrs=e,this.spec=t||Ss}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Ze(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Kf&&ml(this.attrs,e.attrs)&&ml(this.spec,e.spec)}destroy(){}}class Ze{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Ze(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Ze(e,e,new P0(t,n))}static inline(e,t,n,i){return new Ze(e,t,new xi(n,i))}static node(e,t,n,i){return new Ze(e,t,new Kf(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof xi}get widget(){return this.type instanceof P0}}const oo=[],Ss={};class $e{constructor(e,t){this.local=e.length?e:oo,this.children=t.length?t:oo}static create(e,t){return t.length?F0(t,e,0,Ss):Mt}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,s)}}map(e,t,n){return this==Mt||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Ss)}mapInner(e,t,n,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?wk(this.children,o||[],e,t,n,i,s):o?new $e(o.sort(Cs),oo):Mt}add(e,t){return t.length?this==Mt?$e.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((a,l)=>{let c=l+n,u;if(u=m5(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,F0(u,a,c+1,Ss)),s+=3}});let o=p5(s?g5(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new $e(o.length?this.local.concat(o).sort(Cs):this.local,i||this.children)}remove(e){return e.length==0||this==Mt?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,a=n[s]+t,l=n[s+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;n==this.children&&(n=this.children.slice());let c=n[s+2].removeInner(o,a+1);c!=Mt?n[s+2]=c:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new $e(i,n):Mt}forChild(e,t){if(this==Mt)return this;if(t.isLeaf)return $e.empty;let n,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof xi){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new $e(i.sort(Cs),oo);return n?new li([a,n]):a}return n||Mt}eq(e){if(this==e)return!0;if(!(e instanceof $e)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Gf(this.localsInner(e))}localsInner(e){if(this==Mt)return oo;if(e.inlineContent||!this.local.some(xi.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof xi||t.push(this.local[n]);return t}forEachSet(e){e(this)}}$e.empty=new $e([],[]);$e.removeOverlap=Gf;const Mt=$e.empty;class li{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,Ss));return li.from(n)}forChild(e,t){if(t.isLeaf)return $e.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Mt&&(s instanceof li?n=n.concat(s.members):n.push(s))}return li.from(n)}eq(e){if(!(e instanceof li)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Gf(n?t:t.sort(Cs)):oo}static from(e){switch(e.length){case 0:return Mt;case 1:return e[0];default:return new li(e.every(t=>t instanceof $e)?e:e.reduce((t,n)=>t.concat(n instanceof $e?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function wk(r,e,t,n,i,s,o){let a=r.slice();for(let c=0,u=s;c<t.maps.length;c++){let d=0;t.maps[c].forEach((h,f,m,y)=>{let b=y-m-(f-h);for(let v=0;v<a.length;v+=3){let k=a[v+1];if(k<0||h>k+u-d)continue;let M=a[v]+u-d;f>=M?a[v+1]=h<=M?-2:-1:h>=u&&b&&(a[v]+=b,a[v+1]+=b)}d+=b}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(r[c]+s),d=u-i;if(d<0||d>=n.content.size){l=!0;continue}let h=t.map(r[c+1]+s,-1),f=h-i,{index:m,offset:y}=n.content.findIndex(d),b=n.maybeChild(m);if(b&&y==d&&y+b.nodeSize==f){let v=a[c+2].mapInner(t,b,u+1,r[c]+s+1,o);v!=Mt?(a[c]=d,a[c+1]=f,a[c+2]=v):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=kk(a,r,e,t,i,s,o),u=F0(c,n,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new $e(e.sort(Cs),a)}function p5(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new Ze(i.from+e,i.to+e,i.type))}return t}function kk(r,e,t,n,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(n,i,c);d?t.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&a(r[l+2],e[l]+s+1);return t}function m5(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function g5(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function F0(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let c=m5(r,a,l+t);if(c){s=!0;let u=F0(c,a,t+l+1,n);u!=Mt&&i.push(l,l+a.nodeSize,u)}});let o=p5(s?g5(r):r,-t).sort(Cs);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(n.onRemove&&n.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new $e(o,i):Mt}function Cs(r,e){return r.from-e.from||r.to-e.to}function Gf(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),mg(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),mg(e,i,n.copy(s.from,n.to)));break}}}return e}function mg(r,e,t){for(;e<r.length&&Cs(t,r[e])>0;)e++;r.splice(e,0,t)}function fd(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=Mt&&e.push(n)}),r.cursorWrapper&&e.push($e.create(r.state.doc,[r.cursorWrapper.deco])),li.from(e)}const xk={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Sk=Xt&&bi<=11;class Ck{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Mk{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ck,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);Xt&&bi<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Et&&e.composing&&n.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Sk&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,xk)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(lg(this.view)){if(this.suppressingSelectionUpdates)return qn(this.view);if(Xt&&bi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ls(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let s=e.focusNode;s;s=aa(s))t.add(s);for(let s=e.anchorNode;s;s=aa(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&lg(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||vt&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Nr&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||Nk(e,d)!=f)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&lu(n)&&(c=Hf(e))&&c.eq(pe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qn(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Tk(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Ek(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||qn(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Xt&&bi<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?yt(i)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?yt(s):e.target.childNodes.length,c=n.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let gg=new WeakMap,yg=!1;function Tk(r){if(!gg.has(r)&&(gg.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Nr,yg)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),yg=!0}}function vg(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return Ls(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function Ak(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return vg(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?vg(r,t):null}function Nk(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function Ek(r,e){var t;let{focusNode:n,focusOffset:i}=r.domSelectionRange();for(let s of e)if(((t=s.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),n==s&&r.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function Dk(r,e,t,n){let{node:i,fromOffset:s,toOffset:o,from:a,to:l}=r.docView.parseRange(e,t),c=r.domSelectionRange(),u,d=c.anchorNode;if(d&&r.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],lu(c)||u.push({node:c.focusNode,offset:c.focusOffset})),vt&&r.input.lastKeyCode===8)for(let v=o;v>s;v--){let k=i.childNodes[v-1],M=k.pmViewDesc;if(k.nodeName=="BR"&&!M){o=v;break}if(!M||M.size)break}let h=r.state.doc,f=r.someProp("domParser")||Is.fromSchema(r.state.schema),m=h.resolve(a),y=null,b=f.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:s,to:o,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Ok(n),context:m});if(u&&u[0].pos!=null){let v=u[0].pos,k=u[1]&&u[1].pos;k==null&&(k=v),y={anchor:v+a,head:k+a}}return{doc:b,sel:y,from:a,to:l}}const Ok=r=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(r);if(e.nodeName=="BR"&&e.parentNode){if(Et&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Et&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},Rk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ik(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let T=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,B=Hf(r,T);if(B&&!r.state.selection.eq(B)){if(vt&&zn&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",q=>q(r,ts(13,"Enter"))))return;let N=r.state.tr.setSelection(B);T=="pointer"?N.setMeta("pointer",!0):T=="key"&&N.scrollIntoView(),s&&N.setMeta("composition",s),r.dispatch(N)}return}let o=r.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=r.state.doc.resolve(t).after(a+1);let l=r.state.selection,c=Dk(r,e,t,i),u=r.state.doc,d=u.slice(c.from,c.to),h,f;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(h=r.state.selection.to,f="end"):(h=r.state.selection.from,f="start"),r.input.lastKeyCode=null;let m=Bk(d.content,c.doc.content,c.from,h,f);if(m&&r.input.domChangeCount++,(la&&r.input.lastIOSEnter>Date.now()-225||zn)&&i.some(T=>T.nodeType==1&&!Rk.test(T.nodeName))&&(!m||m.endA>=m.endB)&&r.someProp("handleKeyDown",T=>T(r,ts(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof se&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let T=bg(r,r.state.doc,c.sel);if(T&&!T.eq(r.state.selection)){let B=r.state.tr.setSelection(T);s&&B.setMeta("composition",s),r.dispatch(B)}}return}r.state.selection.from<r.state.selection.to&&m.start==m.endB&&r.state.selection instanceof se&&(m.start>r.state.selection.from&&m.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?m.start=r.state.selection.from:m.endA<r.state.selection.to&&m.endA>=r.state.selection.to-2&&r.state.selection.to<=c.to&&(m.endB+=r.state.selection.to-m.endA,m.endA=r.state.selection.to)),Xt&&bi<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),b=c.doc.resolveNoCache(m.endB-c.from),v=u.resolve(m.start),k=y.sameParent(b)&&y.parent.inlineContent&&v.end()>=m.endA;if((la&&r.input.lastIOSEnter>Date.now()-225&&(!k||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!k&&y.pos<c.doc.content.size&&(!y.sameParent(b)||!y.parent.inlineContent)&&y.pos<b.pos&&!/\S/.test(c.doc.textBetween(y.pos,b.pos,"","")))&&r.someProp("handleKeyDown",T=>T(r,ts(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>m.start&&Lk(u,m.start,m.endA,y,b)&&r.someProp("handleKeyDown",T=>T(r,ts(8,"Backspace")))){zn&&vt&&r.domObserver.suppressSelectionUpdates();return}vt&&m.endB==m.start&&(r.input.lastChromeDelete=Date.now()),zn&&!k&&y.start()!=b.start()&&b.parentOffset==0&&y.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,b=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(T){return T(r,ts(13,"Enter"))})},20));let M=m.start,D=m.endA,O=T=>{let B=T||r.state.tr.replace(M,D,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let N=bg(r,B.doc,c.sel);N&&!(vt&&r.composing&&N.empty&&(m.start!=m.endB||r.input.lastChromeDelete<Date.now()-100)&&(N.head==M||N.head==B.mapping.map(D)-1)||Xt&&N.empty&&N.head==M)&&B.setSelection(N)}return s&&B.setMeta("composition",s),B.scrollIntoView()},z;if(k)if(y.pos==b.pos){Xt&&bi<=11&&y.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>qn(r),20));let T=O(r.state.tr.delete(M,D)),B=u.resolve(m.start).marksAcross(u.resolve(m.endA));B&&T.ensureMarks(B),r.dispatch(T)}else if(m.endA==m.endB&&(z=zk(y.parent.content.cut(y.parentOffset,b.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let T=O(r.state.tr);z.type=="add"?T.addMark(M,D,z.mark):T.removeMark(M,D,z.mark),r.dispatch(T)}else if(y.parent.child(y.index()).isText&&y.index()==b.index()-(b.textOffset?0:1)){let T=y.parent.textBetween(y.parentOffset,b.parentOffset),B=()=>O(r.state.tr.insertText(T,M,D));r.someProp("handleTextInput",N=>N(r,M,D,T,B))||r.dispatch(B())}else r.dispatch(O());else r.dispatch(O())}function bg(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:_f(r,e.resolve(t.anchor),e.resolve(t.head))}function zk(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,a,l;for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(V.from(c).eq(r))return{mark:a,type:o}}function Lk(r,e,t,n,i){if(t-e<=i.pos-n.pos||pd(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(pd(s,!0,!0));return!o.parent.isTextblock||o.pos>t||pd(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function pd(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Bk(r,e,t,n,i){let s=r.findDiffStart(e,t),o=t+r.size,a=t+e.size;if(s==null)return null;let{a:l,b:c}=r.findDiffEnd(e,o,a);if(i=="end"){let u=Math.max(0,s-Math.min(l,c));n-=l+u-s}if(l<s&&o<a){let u=n<=s&&n>=l?s-n:0;s-=u,c=s+(c-l),l=s}else if(c<s){let u=n<=s&&n>=c?s-n:0;s-=u,l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}class y5{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Zw,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Cg),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=xg(this),kg(this),this.nodeViews=Sg(this),this.docView=rg(this.state.doc,wg(this),fd(this),this.dom,this),this.domObserver=new Mk(this,(n,i,s,o)=>Ik(this,n,i,s,o)),this.domObserver.start(),Qw(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ph(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Cg),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(u5(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Sg(this);Fk(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ph(this),this.editable=xg(this),kg(this);let l=fd(this),c=wg(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&fw(this);if(o){this.domObserver.stop();let f=d&&(Xt||vt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Pk(i.selection,e.selection);if(d){let y=vt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=pk(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=rg(e.doc,c,l,this.dom,this)),y&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}let m=this.input.mouseDown;f||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Pw(this)&&m.delaySelUpdate())?qn(this,f):(Yy(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&pw(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ae){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&X1(this,t.getBoundingClientRect(),e)}else X1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new h5(e.slice,e.move,i<0?void 0:ae.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(Xt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&mw(this.dom),qn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ww(this,e)}coordsAtPos(e,t=1){return _y(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Mw(this,t||this.state,e)}pasteHTML(e,t){return pl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return pl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return jf(this,e)}destroy(){this.docView&&(ek(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,nw())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return rk(this,e)}domSelectionRange(){let e=this.domSelection();return e?Et&&this.root.nodeType===11&&lw(this.dom.ownerDocument)==this.dom&&Ak(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}y5.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function wg(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[Ze.node(0,r.state.doc.content.size,e)]}function kg(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:Ze.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function xg(r){return!r.someProp("editable",e=>e(r.state)===!1)}function Pk(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function Sg(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function Fk(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function Cg(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const $k=R.createContext({contentRef:()=>{},view:null,mark:null}),qk=R.createContext(r=>{throw new Error("No ProsemirrorAdapterProvider detected, maybe you need to wrap the component with the Editor with ProsemirrorAdapterProvider?")});var Hk=class extends t8{constructor(...r){super(...r),this.context={contentRef:this.contentRef,view:this.view,mark:this.mark},this.updateContext=()=>{Object.assign(this.context,{mark:this.mark})}}},_k=class extends Hk{constructor(...r){super(...r),this.render=()=>{const e=this.component;return bc.createPortal(R.createElement($k.Provider,{value:this.context},R.createElement(e,null)),this.dom,this.key)}}};function jk(r,e,t){return function(i){return function(o,a,l){const c=new t({mark:o,view:a,inline:l,options:{...i,destroy(){var u;(u=i.destroy)==null||u.call(i),e(c)}}});return r(c,!1),c}}}function Vk(r,e){return R.useMemo(()=>jk(r,e,_k),[r,e])}const v5=R.createContext({contentRef:()=>{},view:null,getPos:()=>0,setAttrs:()=>{},node:null,selected:!1,decorations:[],innerDecorations:null}),Ii=()=>R.useContext(v5),b5=R.createContext(r=>{throw new Error("No ProsemirrorAdapterProvider detected, maybe you need to wrap the component with the Editor with ProsemirrorAdapterProvider?")}),Wk=()=>R.useContext(b5);var Uk=class extends r8{constructor(...r){super(...r),this.context={contentRef:this.contentRef,view:this.view,getPos:this.getPos,setAttrs:this.setAttrs,node:this.node,selected:this.selected,decorations:this.decorations,innerDecorations:this.innerDecorations},this.updateContext=()=>{Object.assign(this.context,{node:this.node,selected:this.selected,decorations:this.decorations,innerDecorations:this.innerDecorations})}}},Kk=class extends Uk{constructor(...r){super(...r),this.render=()=>{const e=this.component;return bc.createPortal(R.createElement(v5.Provider,{value:this.context},R.createElement(e,null)),this.dom,this.key)}}};function Gk(r,e,t){return function(i){return function(o,a,l,c,u){const d=new t({node:o,view:a,getPos:l,decorations:c,innerDecorations:u,options:{...i,onUpdate(){var h;(h=i.onUpdate)==null||h.call(i),r(d)},selectNode(){var h;(h=i.selectNode)==null||h.call(i),r(d)},deselectNode(){var h;(h=i.deselectNode)==null||h.call(i),r(d)},destroy(){var h;(h=i.destroy)==null||h.call(i),e(d)}}});return r(d,!1),d}}}function Jk(r,e){return R.useMemo(()=>Gk(r,e,Kk),[r,e])}const w5=R.createContext({view:null}),k5=()=>R.useContext(w5),x5=R.createContext(r=>{throw new Error("out of scope")}),Yk=()=>R.useContext(x5);var Xk=class extends n8{constructor(...r){super(...r),this.context={view:this.view,prevState:this.prevState},this.updateContext=()=>{Object.assign(this.context,{view:this.view,prevState:this.prevState})},this.render=()=>{const e=this.component;return bc.createPortal(R.createElement(w5.Provider,{value:this.context},R.createElement(e,null)),this.root,this.key)}}};function Zk(r,e){return R.useCallback(t=>n=>{const i=new Xk({view:n,options:{...t,update:(s,o)=>{var a;(a=t.update)==null||a.call(t,s,o),r(i)},destroy:()=>{var s;(s=t.destroy)==null||s.call(t),e(i)}}});return r(i,!1),i},[e,r])}function Qk(r,e){const[t,n]=r,i=e.key,s=R.createElement(R.Fragment,{key:i},e.render()),o=t.indexOf(i);if(o===-1)return[[...t,i],[...n,s]];{const a=[...n];return a[o]=s,[t,a]}}function ex(r,e){const[t,n]=r,i=t.indexOf(e.key);if(i===-1)return r;const s=[...t],o=[...n];return s.splice(i,1),o.splice(i,1),[s,o]}function tx(){const[r,e]=R.useState([[],[]]),t=R.useRef(!1);R.useLayoutEffect(()=>(t.current=!0,()=>{t.current=!1}),[]);const n=R.useCallback(i=>{t.current?bc.flushSync(i):i()},[]);return{render:()=>r[1],renderReactRenderer:R.useCallback((i,s=!0)=>{n(()=>(s&&i.updateContext(),e(o=>Qk(o,i))))},[n]),removeReactRenderer:R.useCallback(i=>{n(()=>e(s=>ex(s,i)))},[n])}}const rx=R.createContext({view:null,getPos:()=>{}}),nx=R.createContext(r=>{throw new Error("out of scope")});var ix=class extends i8{constructor(...r){super(...r),this.context={view:this.view,getPos:this.getPos,spec:this.spec},this.updateContext=()=>{Object.assign(this.context,{view:this.view,getPos:this.getPos,spec:this.spec})},this.render=()=>{const e=this.component;return bc.createPortal(R.createElement(rx.Provider,{value:this.context},R.createElement(e,null)),this.dom,this.key)}}};function sx(r,e){return R.useCallback(t=>(n,i={})=>{const s=new ix({pos:n,options:t}),o={...i,destroy:a=>{var l;(l=i.destroy)==null||l.call(i,a),e(s)}};return s.spec=o,Ze.widget(n,(a,l)=>(s.bind(a,l),r(s),s.dom),o)},[e,r])}const ox=({children:r})=>{const{renderReactRenderer:e,removeReactRenderer:t,render:n}=tx(),i=Jk(e,t),s=Vk(e,t),o=Zk(e,t),a=sx(e,t);return R.createElement(b5.Provider,{value:i},R.createElement(qk.Provider,{value:s},R.createElement(x5.Provider,{value:o},R.createElement(nx.Provider,{value:a},R.createElement(R.Fragment,{key:1},r),R.createElement(R.Fragment,{key:2},n())))))};var fr=(function(r){return r.docTypeError="docTypeError",r.contextNotFound="contextNotFound",r.timerNotFound="timerNotFound",r.ctxCallOutOfScope="ctxCallOutOfScope",r.createNodeInParserFail="createNodeInParserFail",r.stackOverFlow="stackOverFlow",r.parserMatchError="parserMatchError",r.serializerMatchError="serializerMatchError",r.getAtomFromSchemaFail="getAtomFromSchemaFail",r.expectDomTypeError="expectDomTypeError",r.callCommandBeforeEditorView="callCommandBeforeEditorView",r.missingRootElement="missingRootElement",r.missingNodeInSchema="missingNodeInSchema",r.missingMarkInSchema="missingMarkInSchema",r.ctxNotBind="ctxNotBind",r.missingYjsDoc="missingYjsDoc",r.aiProviderError="aiProviderError",r.aiBuildContextError="aiBuildContextError",r})({}),pr=class extends Error{constructor(r,e,t){super(e,t),this.name="MilkdownError",this.code=r,(t==null?void 0:t.cause)!==void 0&&(this.cause=t.cause)}},ax=(r,e)=>typeof e=="function"?"[Function]":e,uu=r=>JSON.stringify(r,ax);function lx(r){return new pr(fr.docTypeError,`Doc type error, unsupported type: ${uu(r)}`)}function cx(r){return new pr(fr.contextNotFound,`Context "${r}" not found, do you forget to inject it?`)}function ux(r){return new pr(fr.timerNotFound,`Timer "${r}" not found, do you forget to record it?`)}function du(){return new pr(fr.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function dx(r,e,t){const n=`Cannot create node for ${"name"in r?r.name:r}`,i=o=>{if(o==null)return"null";if(Array.isArray(o))return`[${o.map(i).join(", ")}]`;if(typeof o=="object")return"toJSON"in o&&typeof o.toJSON=="function"?JSON.stringify(o.toJSON()):"spec"in o?JSON.stringify(o.spec):JSON.stringify(o);if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return JSON.stringify(o);if(typeof o=="function")return`[Function: ${o.name||"anonymous"}]`;try{return String(o)}catch{return"[Unserializable]"}},s=[["[Description]",n],["[Attributes]",e],["[Content]",(t??[]).map(o=>o?typeof o=="object"&&"type"in o?`${o}`:i(o):"null")]].reduce((o,[a,l])=>{const c=`${a}: ${i(l)}.`;return o.concat(c)},[]);return new pr(fr.createNodeInParserFail,s.join(`
30
30
  `))}function S5(){return new pr(fr.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function hx(r){return new pr(fr.parserMatchError,`Cannot match target parser for node: ${uu(r)}.`)}function fx(r){return new pr(fr.serializerMatchError,`Cannot match target serializer for node: ${uu(r)}.`)}function px(r,e){return new pr(fr.getAtomFromSchemaFail,`Cannot get ${r}: ${e} from schema.`)}function dn(r){return new pr(fr.expectDomTypeError,`Expect to be a dom, but get: ${uu(r)}.`)}function md(){return new pr(fr.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function C5(r){return new pr(fr.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${r}" in schema.`)}function mx(r){return new pr(fr.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${r}" in schema.`)}var M5=class{constructor(){this.sliceMap=new Map,this.get=r=>{const e=typeof r=="string"?[...this.sliceMap.values()].find(t=>t.type.name===r):this.sliceMap.get(r.id);if(!e){const t=typeof r=="string"?r:r.name;throw cx(t)}return e},this.remove=r=>{const e=typeof r=="string"?[...this.sliceMap.values()].find(t=>t.type.name===r):this.sliceMap.get(r.id);e&&this.sliceMap.delete(e.type.id)},this.has=r=>typeof r=="string"?[...this.sliceMap.values()].some(e=>e.type.name===r):this.sliceMap.has(r.id)}},Br,Mn,So,I2,gx=(I2=class{constructor(r,e,t){_(this,Br);_(this,Mn);_(this,So);F(this,Br,[]),F(this,So,()=>{C(this,Br).forEach(n=>n(C(this,Mn)))}),this.set=n=>{F(this,Mn,n),C(this,So).call(this)},this.get=()=>C(this,Mn),this.update=n=>{F(this,Mn,n(C(this,Mn))),C(this,So).call(this)},this.type=t,F(this,Mn,e),r.set(t.id,this)}on(r){return C(this,Br).push(r),()=>{F(this,Br,C(this,Br).filter(e=>e!==r))}}once(r){const e=this.on(t=>{r(t),e()});return e}off(r){F(this,Br,C(this,Br).filter(e=>e!==r))}offAll(){F(this,Br,[])}},Br=new WeakMap,Mn=new WeakMap,So=new WeakMap,I2),yx=class{constructor(r,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=r,this._typeInfo=()=>{throw du()}}create(r,e=this._defaultValue){return new gx(r,e,this)}},Se=(r,e)=>new yx(r,e),Rl,Il,zl,ls,Co,ui,Mo,To,Ao,z2,vx=(z2=class{constructor(r,e,t){_(this,Rl);_(this,Il);_(this,zl);_(this,ls);_(this,Co);_(this,ui);_(this,Mo);_(this,To);_(this,Ao);F(this,ls,new Set),F(this,Co,new Set),F(this,ui,new Map),F(this,Mo,new Map),this.read=()=>({metadata:C(this,Rl),injectedSlices:[...C(this,ls)].map(n=>({name:typeof n=="string"?n:n.name,value:C(this,To).call(this,n)})),consumedSlices:[...C(this,Co)].map(n=>({name:typeof n=="string"?n:n.name,value:C(this,To).call(this,n)})),recordedTimers:[...C(this,ui)].map(([n,{duration:i}])=>({name:n.name,duration:i,status:C(this,Ao).call(this,n)})),waitTimers:[...C(this,Mo)].map(([n,{duration:i}])=>({name:n.name,duration:i,status:C(this,Ao).call(this,n)}))}),this.onRecord=n=>{C(this,ui).set(n,{start:Date.now(),duration:0})},this.onClear=n=>{C(this,ui).delete(n)},this.onDone=n=>{const i=C(this,ui).get(n);i&&(i.duration=Date.now()-i.start)},this.onWait=(n,i)=>{const s=Date.now();i.finally(()=>{C(this,Mo).set(n,{duration:Date.now()-s})}).catch(console.error)},this.onInject=n=>{C(this,ls).add(n)},this.onRemove=n=>{C(this,ls).delete(n)},this.onUse=n=>{C(this,Co).add(n)},F(this,To,n=>C(this,Il).get(n).get()),F(this,Ao,n=>C(this,zl).get(n).status),F(this,Il,r),F(this,zl,e),F(this,Rl,t)}},Rl=new WeakMap,Il=new WeakMap,zl=new WeakMap,ls=new WeakMap,Co=new WeakMap,ui=new WeakMap,Mo=new WeakMap,To=new WeakMap,Ao=new WeakMap,z2),Tn,An,Ll,kr,No,bx=(No=class{constructor(e,t,n){_(this,Tn);_(this,An);_(this,Ll);_(this,kr);this.produce=i=>i&&Object.keys(i).length?new No(C(this,Tn),C(this,An),{...i}):this,this.inject=(i,s)=>{var a;const o=i.create(C(this,Tn).sliceMap);return s!=null&&o.set(s),(a=C(this,kr))==null||a.onInject(i),this},this.remove=i=>{var s;return C(this,Tn).remove(i),(s=C(this,kr))==null||s.onRemove(i),this},this.record=i=>{var s;return i.create(C(this,An).store),(s=C(this,kr))==null||s.onRecord(i),this},this.clearTimer=i=>{var s;return C(this,An).remove(i),(s=C(this,kr))==null||s.onClear(i),this},this.isInjected=i=>C(this,Tn).has(i),this.isRecorded=i=>C(this,An).has(i),this.use=i=>{var s;return(s=C(this,kr))==null||s.onUse(i),C(this,Tn).get(i)},this.get=i=>this.use(i).get(),this.set=(i,s)=>this.use(i).set(s),this.update=(i,s)=>this.use(i).update(s),this.timer=i=>C(this,An).get(i),this.done=i=>{var s;this.timer(i).done(),(s=C(this,kr))==null||s.onDone(i)},this.wait=i=>{var o;const s=this.timer(i).start();return(o=C(this,kr))==null||o.onWait(i,s),s},this.waitTimers=async i=>{await Promise.all(this.get(i).map(s=>this.wait(s)))},F(this,Tn,e),F(this,An,t),F(this,Ll,n),n&&F(this,kr,new vx(e,t,n))}get meta(){return C(this,Ll)}get inspector(){return C(this,kr)}},Tn=new WeakMap,An=new WeakMap,Ll=new WeakMap,kr=new WeakMap,No),wx=class{constructor(){this.store=new Map,this.get=r=>{const e=this.store.get(r.id);if(!e)throw ux(r.name);return e},this.remove=r=>{this.store.delete(r.id)},this.has=r=>this.store.has(r.id)}},Eo,di,Do,Nn,Oo,Bl,L2,kx=(L2=class{constructor(r,e){_(this,Eo);_(this,di);_(this,Do);_(this,Nn);_(this,Oo);_(this,Bl);F(this,Eo,null),F(this,di,null),F(this,Nn,"pending"),this.start=()=>(C(this,Eo)??F(this,Eo,new Promise((t,n)=>{F(this,di,i=>{i instanceof CustomEvent&&i.detail.id===C(this,Do)&&(F(this,Nn,"resolved"),C(this,Oo).call(this),i.stopImmediatePropagation(),t())}),C(this,Bl).call(this,()=>{C(this,Nn)==="pending"&&F(this,Nn,"rejected"),C(this,Oo).call(this),n(new Error(`Timing ${this.type.name} timeout.`))}),F(this,Nn,"pending"),addEventListener(this.type.name,C(this,di))})),C(this,Eo)),this.done=()=>{const t=new CustomEvent(this.type.name,{detail:{id:C(this,Do)}});dispatchEvent(t)},F(this,Oo,()=>{C(this,di)&&removeEventListener(this.type.name,C(this,di))}),F(this,Bl,t=>{setTimeout(()=>{t()},this.type.timeout)}),F(this,Do,Symbol(e.name)),this.type=e,r.set(e.id,this)}get status(){return C(this,Nn)}},Eo=new WeakMap,di=new WeakMap,Do=new WeakMap,Nn=new WeakMap,Oo=new WeakMap,Bl=new WeakMap,L2),xx=class{constructor(r,e=3e3){this.create=t=>new kx(t,this),this.id=Symbol(`Timer-${r}`),this.name=r,this.timeout=e}},Ur=(r,e=3e3)=>new xx(r,e);function Fh(r){const e=this;e.compiler=t;function t(n){return Fb(n,{...e.data("settings"),...r,extensions:e.data("toMarkdownExtensions")||[]})}}const Jf=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function T5(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const A5=(r,e,t)=>{let n=T5(r,t);if(!n)return!1;let i=Yf(n);if(!i){let o=n.blockRange(),a=o&&su(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(O5(r,i,e,-1))return!0;if(n.parent.content.size==0&&(ca(s,"end")||ae.isSelectable(s)))for(let o=n.depth;;o--){let a=ou(r.doc,n.before(o),n.after(o),re.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(ca(s,"end")?pe.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ae.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Sx=(r,e,t)=>{let n=T5(r,t);if(!n)return!1;let i=Yf(n);return i?Cx(r,i,e):!1};function Cx(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=ou(r.doc,s,l,re.empty);if(!c||c.from!=s||c instanceof rt&&c.slice.size>=l-s)return!1;if(t){let u=r.tr.step(c);u.setSelection(se.create(u.doc,s)),t(u.scrollIntoView())}return!0}function ca(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const N5=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=Yf(n)}let o=s&&s.nodeBefore;return!o||!ae.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Yf(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Mx(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const Tx=(r,e,t)=>{let n=Mx(r,t);if(!n)return!1;let i=E5(n);if(!i)return!1;let s=i.nodeAfter;if(O5(r,i,e,1))return!0;if(n.parent.content.size==0&&(ca(s,"start")||ae.isSelectable(s))){let o=ou(r.doc,n.before(),n.after(),re.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(ca(s,"start")?pe.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ae.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Ax=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=E5(n)}let o=s&&s.nodeAfter;return!o||!ae.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,s.pos)).scrollIntoView()),!0)};function E5(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const Nx=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
31
31
  `).scrollIntoView()),!0)};function Xf(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const D5=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Xf(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=r.tr.replaceWith(a,a,o.createAndFill());l.setSelection(pe.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Ex=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof Yt||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=Xf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,a=r.tr.insert(o,s.createAndFill());a.setSelection(se.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Dx=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ja(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&su(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function Ox(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof ae&&e.selection.node.isBlock)return!n.parentOffset||!Ja(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=n.depth;;f--)if(n.node(f).isBlock){l=n.end(f)==n.pos+(n.depth-f),c=n.start(f)==n.pos-(n.depth-f),a=Xf(n.node(f-1).contentMatchAt(n.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof se||e.selection instanceof Yt)&&u.deleteSelection();let d=u.mapping.map(n.pos),h=Ja(u.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=Ja(u.doc,d,s.length,s)),!h)return!1;if(u.split(d,s.length,s),!l&&c&&n.node(o).type!=a){let f=u.mapping.map(n.before(o)),m=u.doc.resolve(f);a&&n.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(n.before(o)),a)}return t&&t(u.scrollIntoView()),!0}}const Rx=Ox(),Ix=(r,e)=>(e&&e(r.tr.setSelection(new Yt(r.doc))),!0);function zx(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||wc(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function O5(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&zx(r,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let f=e.pos+s.nodeSize,m=V.empty;for(let v=o.length-1;v>=0;v--)m=V.from(o[v].create(null,m));m=V.from(i.copy(m));let y=r.tr.step(new At(e.pos-1,f,e.pos,f,new re(m,1,0),o.length,!0)),b=y.doc.resolve(f+2*o.length);b.nodeAfter&&b.nodeAfter.type==i.type&&wc(y.doc,b.pos)&&y.join(b.pos),t(y.scrollIntoView())}return!0}let u=s.type.spec.isolating||n>0&&l?null:pe.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&su(d);if(h!=null&&h>=e.depth)return t&&t(r.tr.lift(d,h).scrollIntoView()),!0;if(c&&ca(s,"start",!0)&&ca(i,"end")){let f=i,m=[];for(;m.push(f),!f.isTextblock;)f=f.lastChild;let y=s,b=1;for(;!y.isTextblock;y=y.firstChild)b++;if(f.canReplace(f.childCount,f.childCount,y.content)){if(t){let v=V.empty;for(let M=m.length-1;M>=0;M--)v=V.from(m[M].copy(v));let k=r.tr.step(new At(e.pos-m.length,e.pos+s.nodeSize,e.pos+b,e.pos+s.nodeSize-b,new re(v,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function R5(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(se.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const Lx=R5(-1),Bx=R5(1);function Zf(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Ff(o,r,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function gl(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,r,e)}n(s.scrollIntoView())}return!0}}function Px(r,e,t,n){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],a=s.depth==0?r.inlineContent&&r.type.allowsMarkType(t):!1;if(r.nodesBetween(s.pos,o.pos,(l,c)=>{if(a)return!1;a=l.inlineContent&&l.type.allowsMarkType(t)}),a)return!0}return!1}function hu(r,e=null,t){return function(n,i){let{empty:s,$cursor:o,ranges:a}=n.selection;if(s&&!o||!Px(n.doc,a,r))return!1;if(i)if(o)r.isInSet(n.storedMarks||o.marks())?i(n.tr.removeStoredMark(r)):i(n.tr.addStoredMark(r.create(e)));else{let l,c=n.tr;l=!a.some(u=>n.doc.rangeHasMark(u.$from.pos,u.$to.pos,r));for(let u=0;u<a.length;u++){let{$from:d,$to:h}=a[u];if(!l)c.removeMark(d.pos,h.pos,r);else{let f=d.pos,m=h.pos,y=d.nodeAfter,b=h.nodeBefore,v=y&&y.isText?/^\s*/.exec(y.text)[0].length:0,k=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;f+v<m&&(f+=v,m-=k),c.addMark(f,m,r.create(e))}}i(c.scrollIntoView())}return!0}}function ga(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}let gd=ga(Jf,A5,N5),Mg=ga(Jf,Tx,Ax);const Sn={Enter:ga(Nx,Ex,Dx,Rx),"Mod-Enter":D5,Backspace:gd,"Mod-Backspace":gd,"Shift-Backspace":gd,Delete:Mg,"Mod-Delete":Mg,"Mod-a":Ix},I5={"Ctrl-h":Sn.Backspace,"Alt-Backspace":Sn["Mod-Backspace"],"Ctrl-d":Sn.Delete,"Ctrl-Alt-Backspace":Sn["Mod-Delete"],"Alt-Delete":Sn["Mod-Delete"],"Alt-d":Sn["Mod-Delete"],"Ctrl-a":Lx,"Ctrl-e":Bx};for(let r in Sn)I5[r]=Sn[r];const Fx=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,$x=Fx?I5:Sn;class _t{constructor(e,t,n={}){this.match=e,this.match=e,this.handler=typeof t=="string"?qx(t):t,this.undoable=n.undoable!==!1,this.inCode=n.inCode||!1,this.inCodeMark=n.inCodeMark!==!1}}function qx(r){return function(e,t,n,i){let s=r;if(t[1]){let o=t[0].lastIndexOf(t[1]);s+=t[0].slice(o+t[1].length),n+=o;let a=n-i;a>0&&(s=t[0].slice(o-a,o)+s,n=i)}return e.tr.insertText(s,n,i)}}const Hx=(r,e)=>{let t=r.plugins;for(let n=0;n<t.length;n++){let i=t[n],s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){let o=r.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l--)o.step(a.steps[l].invert(a.docs[l]));if(s.text){let l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,l))}else o.delete(s.from,s.to);e(o)}return!0}}return!1};new _t(/--$/,"—",{inCodeMark:!1});new _t(/\.\.\.$/,"…",{inCodeMark:!1});new _t(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new _t(/"$/,"”",{inCodeMark:!1});new _t(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new _t(/'$/,"’",{inCodeMark:!1});function Qf(r,e,t=null,n){return new _t(r,(i,s,o,a)=>{let l=t instanceof Function?t(s):t,c=i.tr.delete(o,a),u=c.doc.resolve(o),d=u.blockRange(),h=d&&Ff(d,e,l);if(!h)return null;c.wrap(d,h);let f=c.doc.resolve(o-1).nodeBefore;return f&&f.type==e&&wc(c.doc,o-1)&&(!n||n(s,f))&&c.join(o-1),c})}function ep(r,e,t=null){return new _t(r,(n,i,s,o)=>{let a=n.doc.resolve(s),l=t instanceof Function?t(i):t;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e)?n.tr.delete(s,o).setBlockType(s,s,e,l):null})}const Ti=typeof navigator<"u"?navigator:null,Tg=typeof document<"u"?document:null,zi=Ti&&Ti.userAgent||"",$h=/Edge\/(\d+)/.exec(zi),z5=/MSIE \d/.exec(zi),qh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zi),fu=!!(z5||qh||$h),_x=z5?document.documentMode:qh?+qh[1]:$h?+$h[1]:0,L5=!fu&&/gecko\/(\d+)/i.test(zi),jx=L5&&+(/Firefox\/(\d+)/.exec(zi)||[0,0])[1],Hh=!fu&&/Chrome\/(\d+)/.exec(zi),B5=!!Hh,Vx=Hh?+Hh[1]:0,P5=!fu&&!!Ti&&/Apple Computer/.test(Ti.vendor),F5=P5&&(/Mobile\/\w+/.test(zi)||!!Ti&&Ti.maxTouchPoints>2),Wx=F5||(Ti?/Mac/.test(Ti.platform):!1),$5=/Android \d/.test(zi),q5=!!Tg&&"webkitFontSmoothing"in Tg.documentElement.style,Ux=q5?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var Kc=Object.freeze({__proto__:null,android:$5,chrome:B5,chrome_version:Vx,gecko:L5,gecko_version:jx,ie:fu,ie_version:_x,ios:F5,mac:Wx,safari:P5,webkit:q5,webkit_version:Ux});function yd(r,e,t,n,i,s){if(r.composing)return!1;const o=r.state,a=o.doc.resolve(e);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+n;for(let c of i){const u=c,d=u.match.exec(l),h=d&&d[0]&&u.handler(o,d,e-(d[0].length-n.length),t);if(h)return u.undoable!==!1&&h.setMeta(s,{transform:h,from:e,to:t,text:n}),r.dispatch(h),!0}return!1}const Kx=new De("MILKDOWN_CUSTOM_INPUTRULES");function Gx({rules:r}){const e=new Ae({key:Kx,isInputRules:!0,state:{init(){return null},apply(t,n){const i=t.getMeta(this);return i||(t.selectionSet||t.docChanged?null:n)}},props:{handleTextInput(t,n,i,s){return yd(t,n,i,s,r,e)},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:n}=t.state.selection;n&&yd(t,n.pos,n.pos,"",r,e)}),!1),keydown:(t,n)=>!($5&&B5&&n.key==="Enter")||t.composing?!1:t.someProp("handleKeyDown",i=>i(t,n))?(n.preventDefault(),!0):!1},handleKeyDown(t,n){if(n.key!=="Enter")return!1;const{$cursor:i}=t.state.selection;return i?yd(t,i.pos,i.pos,`
32
- `,r,e):!1}}});return e}function H5(r){return r.some(e=>e.type.spec.code)}function Ag(r,e,t){if(e>=t)return!1;let n=!1;return r.doc.nodesBetween(e,t,i=>(i.isInline&&H5(i.marks)&&(n=!0),!n)),n}function Jx(r,e){var t;return H5((t=r.storedMarks)!=null?t:r.doc.resolve(e).marks())}function Tc(r,e,t={}){return new _t(r,(n,i,s,o)=>{var a,l,c,u;const{tr:d}=n,h=i.length;let f=i[h-1],m=i[0],y=[],b;const v={group:f,fullMatch:m,start:s,end:o},k=(a=t.updateCaptured)==null?void 0:a.call(t,v);if(Object.assign(v,k),{group:f,fullMatch:m,start:s,end:o}=v,m===null||(f==null?void 0:f.trim())==="")return null;if(f){const M=m.search(/\S/),D=s+m.indexOf(f),O=D+f.length,z=Ag(n,s+M,D),T=O<o&&Ag(n,O,o);if(z||T||Jx(n,o))return null;y=(l=d.storedMarks)!=null?l:[],O<o&&d.delete(O,o),D>s&&d.delete(s+M,D),b=s+M+f.length;const B=(c=t.getAttr)==null?void 0:c.call(t,i);d.addMark(s,b,e.create(B)),d.setStoredMarks(y),(u=t.beforeDispatch)==null||u.call(t,{match:i,start:s,end:o,tr:d})}return d})}function Yx(r,e,t={}){return new _t(r,(n,i,s,o)=>{var a,l,c;const{tr:u}=n;let d=i[1],h=i[0];const f={group:d,fullMatch:h,start:s,end:o},m=(a=t.updateCaptured)==null?void 0:a.call(t,f);if(Object.assign(f,m),{group:d,fullMatch:h,start:s,end:o}=f,h===null||!d||d.trim()==="")return null;const y=(l=t.getAttr)==null?void 0:l.call(t,i),b=e.createAndFill(y);return b&&(u.replaceRangeWith(e.isBlock?u.doc.resolve(s).before():s,o,b),(c=t.beforeDispatch)==null||c.call(t,{match:[h,d],start:s,end:o,tr:u})),u})}var Xx=Object.defineProperty,Zx=Object.defineProperties,Qx=Object.getOwnPropertyDescriptors,Ng=Object.getOwnPropertySymbols,e9=Object.prototype.hasOwnProperty,t9=Object.prototype.propertyIsEnumerable,Eg=(r,e,t)=>e in r?Xx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,r9=(r,e)=>{for(var t in e||(e={}))e9.call(e,t)&&Eg(r,t,e[t]);if(Ng)for(var t of Ng(e))t9.call(e,t)&&Eg(r,t,e[t]);return r},n9=(r,e)=>Zx(r,Qx(e));function Dg(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function pu(r,e,t){const i=r.state.doc.content.size,s=Dg(e,0,i),o=Dg(t,0,i),a=r.coordsAtPos(s),l=r.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,m=u-c,v={top:c,bottom:u,left:d,right:h,width:f,height:m,x:d,y:c};return n9(r9({},v),{toJSON:()=>v})}function _5(r){return Object.assign(Object.create(r),r).setTime(Date.now())}function i9(r,e){return Array.isArray(r)&&r.includes(e.type)||e.type===r}function s9(r){if(r.content.childCount===1){const e=r.content.firstChild;if((e==null?void 0:e.type.name)==="text"&&e.marks.length===0)return e;if((e==null?void 0:e.type.name)==="paragraph"&&e.childCount===1){const t=e.firstChild;if((t==null?void 0:t.type.name)==="text"&&t.marks.length===0)return t}}return!1}function ln(r){return e=>{for(let t=e.depth;t>0;t-=1){const n=e.node(t);if(r(n)){const i=e.before(t),s=e.after(t);return{from:i,to:s,node:n}}}}}function o9(r,e){return ln(t=>t.type===e)(r)}function a9(r,e){const t=e.nodes[r];if(!t)throw px("node",r);return t}function j5(r){return e=>{for(let t=e.depth;t>0;t--){const n=e.node(t);if(r(n))return{pos:e.before(t),start:e.start(t),depth:t,node:n}}}}function l9(r){return e=>j5(r)(e.$from)}function c9(r,e){if(!(r instanceof ae))return;const{node:t,$from:n}=r;if(i9(e,t))return{node:t,pos:n.pos,start:n.start(n.depth),depth:n.depth}}const V5=(r,e)=>{const{selection:t,doc:n}=r;if(t instanceof ae)return{hasNode:t.node.type===e,pos:t.from,target:t.node};const{from:i,to:s}=t;let o=!1,a=-1,l=null;return n.nodesBetween(i,s,(c,u)=>l?!1:c.type===e?(o=!0,a=u,l=c,!1):!0),{hasNode:o,pos:a,target:l}},u9=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),d9=typeof navigator<"u"&&/Win/.test(navigator.platform);function h9(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))u9?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function f9(r){let e=Object.create(null);for(let t in r)e[h9(t)]=r[t];return e}function vd(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function W5(r){return new Ae({props:{handleKeyDown:tp(r)}})}function tp(r){let e=f9(r);return function(t,n){let i=K7(n),s,o=e[vd(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[vd(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(d9&&n.ctrlKey&&n.altKey)&&(s=G7[n.keyCode])&&s!=i){let a=e[vd(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var U5=class{},K5=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=r=>{var e;(e=this.top())==null||e.push(r)},this.open=r=>{this.elements.push(r)},this.close=()=>{const r=this.elements.pop();if(!r)throw S5();return r}}},p9=class G5 extends U5{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new G5(e,t,n)}},Pr,Ro,Pl,Fl,$l,Io,zo,Es,J5=(Es=class extends K5{constructor(t){super();_(this,Pr);_(this,Ro);_(this,Pl);_(this,Fl);_(this,$l);_(this,Io);_(this,zo);F(this,Pr,ke.none),F(this,Ro,n=>n.isText),F(this,Pl,(n,i)=>{if(C(this,Ro).call(this,n)&&C(this,Ro).call(this,i)&&ke.sameSet(n.marks,i.marks))return this.schema.text(n.text+i.text,n.marks)}),F(this,Fl,n=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(s=>s.spec.parseMarkdown.match(n));if(!i)throw hx(n);return i}),F(this,$l,n=>{const i=C(this,Fl).call(this,n);i.spec.parseMarkdown.runner(this,n,i)}),this.injectRoot=(n,i,s)=>(this.openNode(i,s),this.next(n.children),this),this.openNode=(n,i)=>(this.open(p9.create(n,[],i)),this),F(this,Io,()=>{F(this,Pr,ke.none);const n=this.close();return C(this,zo).call(this,n.type,n.attrs,n.content)}),this.closeNode=()=>{try{C(this,Io).call(this)}catch(n){console.error(n)}return this},F(this,zo,(n,i,s)=>{const o=n.createAndFill(i,s,C(this,Pr));if(!o)throw dx(n,i,s);return this.push(o),o}),this.addNode=(n,i,s)=>{try{C(this,zo).call(this,n,i,s)}catch(o){console.error(o)}return this},this.openMark=(n,i)=>{const s=n.create(i);return F(this,Pr,s.addToSet(C(this,Pr))),this},this.closeMark=n=>(F(this,Pr,n.removeFromSet(C(this,Pr))),this),this.addText=n=>{try{const i=this.top();if(!i)throw S5();const s=i.pop(),o=this.schema.text(n,C(this,Pr));if(!s)return i.push(o),this;const a=C(this,Pl).call(this,s,o);return a?(i.push(a),this):(i.push(s,o),this)}catch(i){return console.error(i),this}},this.build=()=>{let n;do n=C(this,Io).call(this);while(this.size());return n},this.next=(n=[])=>([n].flat().forEach(i=>C(this,$l).call(this,i)),this),this.toDoc=()=>this.build(),this.run=(n,i)=>{const s=n.runSync(n.parse(i),i);return this.next(s),this},this.schema=t}},Pr=new WeakMap,Ro=new WeakMap,Pl=new WeakMap,Fl=new WeakMap,$l=new WeakMap,Io=new WeakMap,zo=new WeakMap,Es.create=(t,n)=>{const i=new Es(t);return s=>(i.run(n,s),i.toDoc())},Es),Ds,Og=(Ds=class extends U5{constructor(e,t,n,i={}){super(),this.type=e,this.children=t,this.value=n,this.props=i,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>{var s;return(s=this.children)==null?void 0:s.pop()}}},Ds.create=(e,t,n,i={})=>new Ds(e,t,n,i),Ds),m9=r=>Object.prototype.hasOwnProperty.call(r,"size"),Lt,Lo,ql,Hl,_l,jl,Bo,Po,Vl,Wl,cs,hi,Ul,Fo,Os,g9=(Os=class extends K5{constructor(t){super();_(this,Lt);_(this,Lo);_(this,ql);_(this,Hl);_(this,_l);_(this,jl);_(this,Bo);_(this,Po);_(this,Vl);_(this,Wl);_(this,cs);_(this,hi);_(this,Ul);_(this,Fo);F(this,Lt,[]),F(this,Lo,n=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(s=>s.spec.toMarkdown.match(n));if(!i)throw fx(n.type);return i}),F(this,ql,n=>C(this,Lo).call(this,n).spec.toMarkdown.runner(this,n)),F(this,Hl,(n,i)=>C(this,Lo).call(this,n).spec.toMarkdown.runner(this,n,i)),F(this,_l,n=>{const i=a=>a.type.spec.priority??50,s=[...n].sort((a,l)=>i(a)-i(l)),o=[];return C(this,Lt).forEach(({mark:a})=>{const l=s.findIndex(c=>c.eq(a));l>=0&&o.push(...s.splice(l,1))}),o.concat(s)}),F(this,jl,n=>{const i=n==null?void 0:n.marks;let s=0;for(;s<C(this,Lt).length;){const{mark:o,spanning:a}=C(this,Lt)[s];if(a&&(i!=null&&i.some(l=>l.eq(o))))s++;else break}for(let o=C(this,Lt).length-1;o>=s;o--)C(this,Fo).call(this,C(this,Lt)[o].mark)}),F(this,Bo,(n,i)=>{C(this,_l).call(this,n.marks).every(s=>!C(this,Hl).call(this,s,n))&&C(this,ql).call(this,n),C(this,jl).call(this,i)}),F(this,Po,n=>{const{children:i}=n;return i&&(n.children=i.reduce((s,o,a)=>{if(a===0)return[o];const l=s.at(-1);if(l&&l.isMark&&o.isMark){const{children:c,...u}=o,{children:d,...h}=l;if(o.type===l.type&&c&&d&&JSON.stringify(u)===JSON.stringify(h)){const f={...h,children:[...d,...c]};return s.slice(0,-1).concat(C(this,Po).call(this,f))}}return s.concat(o)},[])),n}),F(this,Vl,n=>{const i={...n.props,type:n.type};return n.children&&(i.children=n.children),n.value&&(i.value=n.value),i}),this.openNode=(n,i,s)=>(this.open(Og.create(n,void 0,i,s)),this),F(this,Wl,(n,i)=>{let s="",o="";const a=n.children;if(a){const c=a[0],u=a.at(-1);if(u&&u.type==="text"&&u.value.endsWith(" ")){const d=u.value,h=d.trimEnd();o=d.slice(h.length),u.value=h}if(c&&c.type==="text"&&c.value.startsWith(" ")){const d=c.value,h=d.trimStart();s=d.slice(0,d.length-h.length),c.value=h}}s.length&&C(this,hi).call(this,"text",void 0,s);const l=i();return o.length&&C(this,hi).call(this,"text",void 0,o),l}),F(this,cs,(n=!1)=>{const i=this.close(),s=()=>C(this,hi).call(this,i.type,i.children,i.value,i.props);return n?C(this,Wl).call(this,i,s):s()}),this.closeNode=()=>(C(this,cs).call(this),this),F(this,hi,(n,i,s,o)=>{const a=Og.create(n,i,s,o),l=C(this,Po).call(this,C(this,Vl).call(this,a));return this.push(l),l}),this.addNode=(n,i,s,o)=>(C(this,hi).call(this,n,i,s,o),this),F(this,Ul,(n,i,s,o)=>C(this,Lt).some(a=>a.mark.eq(n))?this:(C(this,Lt).push({mark:n,spanning:s==null}),this.openNode(i,s,{...o,isMark:!0}))),F(this,Fo,n=>{let i=-1;for(let s=C(this,Lt).length-1;s>=0;s--)if(C(this,Lt)[s].mark.eq(n)){i=s;break}i<0||(C(this,Lt).splice(i,1),C(this,cs).call(this,!0))}),this.withMark=(n,i,s,o)=>(C(this,Ul).call(this,n,i,s,o),this),this.closeMark=n=>(C(this,Fo).call(this,n),this),this.build=()=>{let n=null;do n=C(this,cs).call(this);while(this.size());return n},this.next=n=>m9(n)?(n.forEach((i,s,o)=>{C(this,Bo).call(this,i,n.maybeChild(o+1)??void 0)}),this):(C(this,Bo).call(this,n),this),this.toString=n=>n.stringify(this.build()),this.run=n=>(F(this,Lt,[]),this.next(n),this),this.schema=t}},Lt=new WeakMap,Lo=new WeakMap,ql=new WeakMap,Hl=new WeakMap,_l=new WeakMap,jl=new WeakMap,Bo=new WeakMap,Po=new WeakMap,Vl=new WeakMap,Wl=new WeakMap,cs=new WeakMap,hi=new WeakMap,Ul=new WeakMap,Fo=new WeakMap,Os.create=(t,n)=>{const i=new Os(t);return s=>(i.run(s),i.toString(n))},Os);function Vn(r,e){return r.meta={package:"@milkdown/core",group:"System",...e},r}var Y5={text:(r,e,t,n)=>{const i=r.value;return/^[^*_\\]*\s+$/.test(i)?i:t.safe(i,{...n,encode:[]})},strong:(r,e,t,n)=>{const i=r.marker||t.options.strong||"*",s=t.enter("strong"),o=t.createTracker(n);let a=o.move(i+i);return a+=o.move(t.containerPhrasing(r,{before:a,after:i,...o.current()})),a+=o.move(i+i),s(),a},emphasis:(r,e,t,n)=>{const i=r.marker||t.options.emphasis||"*",s=t.enter("emphasis"),o=t.createTracker(n);let a=o.move(i);return a+=o.move(t.containerPhrasing(r,{before:a,after:i,...o.current()})),a+=o.move(i),s(),a}},Me=Se({},"editorView"),_a=Se({},"editorState"),bd=Se([],"initTimer"),_h=Se({},"editor"),yl=Se([],"inputRules"),ur=Se([],"prosePlugins"),vl=Se([],"remarkPlugins"),bl=Se([],"nodeView"),wl=Se([],"markView"),Si=Se(yh().use(vh).use(Fh),"remark"),Za=Se({handlers:Y5,encode:[]},"remarkStringifyOptions"),y0=Ur("ConfigReady");function y9(r){const e=t=>(t.record(y0),async()=>(await r(t),t.done(y0),()=>{t.clearTimer(y0)}));return Vn(e,{displayName:"Config"}),e}var Ms=Ur("InitReady");function v9(r){const e=t=>(t.inject(_h,r).inject(ur,[]).inject(vl,[]).inject(yl,[]).inject(bl,[]).inject(wl,[]).inject(Za,{handlers:Y5,encode:[]}).inject(Si,yh().use(vh).use(Fh)).inject(bd,[y0]).record(Ms),async()=>{await t.waitTimers(bd);const n=t.get(Za);return t.set(Si,yh().use(vh).use(Fh,n)),t.done(Ms),()=>{t.remove(_h).remove(ur).remove(vl).remove(yl).remove(bl).remove(wl).remove(Za).remove(Si).remove(bd).clearTimer(Ms)}});return Vn(e,{displayName:"Init"}),e}var bt=Ur("SchemaReady"),wd=Se([],"schemaTimer"),Zt=Se({},"schema"),Ci=Se([],"nodes"),Qa=Se([],"marks");function Rg(r){var e;return{...r,parseDOM:(e=r.parseDOM)==null?void 0:e.map(t=>({priority:r.priority,...t}))}}var X5=r=>(r.inject(Zt,{}).inject(Ci,[]).inject(Qa,[]).inject(wd,[Ms]).record(bt),async()=>{await r.waitTimers(wd);const e=r.get(Si),t=r.get(vl).reduce((o,a)=>o.use(a.plugin,a.options),e);r.set(Si,t);const n=Object.fromEntries(r.get(Ci).map(([o,a])=>[o,Rg(a)])),i=Object.fromEntries(r.get(Qa).map(([o,a])=>[o,Rg(a)])),s=new x8({nodes:n,marks:i});return r.set(Zt,s),r.done(bt),()=>{r.remove(Zt).remove(Ci).remove(Qa).remove(wd).clearTimer(bt)}});Vn(X5,{displayName:"Schema"});var us,xr,B2,Z5=(B2=class{constructor(){_(this,us);_(this,xr);F(this,us,new M5),F(this,xr,null),this.setCtx=r=>{F(this,xr,r)},this.chain=()=>{if(C(this,xr)==null)throw md();const r=C(this,xr),e=[],t=this.get.bind(this),n={run:()=>{const s=ga(...e),o=r.get(Me);return s(o.state,o.dispatch,o)},inline:s=>(e.push(s),n),pipe:i.bind(this)};function i(s,o){const a=t(s);return e.push(a(o)),n}return n}}get ctx(){return C(this,xr)}create(r,e){const t=r.create(C(this,us).sliceMap);return t.set(e),t}get(r){return C(this,us).get(r).get()}remove(r){return C(this,us).remove(r)}call(r,e){if(C(this,xr)==null)throw md();const t=this.get(r)(e),n=C(this,xr).get(Me);return t(n.state,n.dispatch,n)}inline(r){if(C(this,xr)==null)throw md();const e=C(this,xr).get(Me);return r(e.state,e.dispatch,e)}},us=new WeakMap,xr=new WeakMap,B2);function b9(r="cmdKey"){return Se((()=>()=>!1),r)}var oe=Se(new Z5,"commands"),kd=Se([bt],"commandsTimer"),el=Ur("CommandsReady"),Q5=r=>{const e=new Z5;return e.setCtx(r),r.inject(oe,e).inject(kd,[bt]).record(el),async()=>(await r.waitTimers(kd),r.done(el),()=>{r.remove(oe).remove(kd).clearTimer(el)})};Vn(Q5,{displayName:"Commands"});function w9(r){return r.Backspace=ga(Hx,Jf,Sx,N5),r}var ds,Wt,P2,e3=(P2=class{constructor(){_(this,ds);_(this,Wt);F(this,ds,null),F(this,Wt,[]),this.setCtx=r=>{F(this,ds,r)},this.add=r=>(C(this,Wt).push(r),()=>{F(this,Wt,C(this,Wt).filter(e=>e!==r))}),this.addObjectKeymap=r=>{const e=[];return Object.entries(r).forEach(([t,n])=>{if(typeof n=="function"){const i={key:t,onRun:()=>n};C(this,Wt).push(i),e.push(()=>{F(this,Wt,C(this,Wt).filter(s=>s!==i))})}else C(this,Wt).push(n),e.push(()=>{F(this,Wt,C(this,Wt).filter(i=>i!==n))})}),()=>{e.forEach(t=>t())}},this.addBaseKeymap=()=>{const r=w9($x);return this.addObjectKeymap(r)},this.build=()=>{const r={};return C(this,Wt).forEach(e=>{r[e.key]=[...r[e.key]||[],e]}),Object.fromEntries(Object.entries(r).map(([e,t])=>{const n=t.sort((s,o)=>(o.priority??50)-(s.priority??50));return[e,(s,o,a)=>{const l=C(this,ds);if(l==null)throw du();const c=n.map(u=>u.onRun(l));return ga(...c)(s,o,a)}]}))}}get ctx(){return C(this,ds)}},ds=new WeakMap,Wt=new WeakMap,P2),$0=Se(new e3,"keymap"),xd=Se([bt],"keymapTimer"),tl=Ur("KeymapReady"),k9=r=>{const e=new e3;return e.setCtx(r),r.inject($0,e).inject(xd,[bt]).record(tl),async()=>(await r.waitTimers(xd),r.done(tl),()=>{r.remove($0).remove(xd).clearTimer(tl)})},rl=Ur("ParserReady"),t3=(()=>{throw du()}),Ts=Se(t3,"parser"),Sd=Se([],"parserTimer"),r3=r=>(r.inject(Ts,t3).inject(Sd,[bt]).record(rl),async()=>{await r.waitTimers(Sd);const e=r.get(Si),t=r.get(Zt);return r.set(Ts,J5.create(t,e)),r.done(rl),()=>{r.remove(Ts).remove(Sd).clearTimer(rl)}});Vn(r3,{displayName:"Parser"});var nl=Ur("SerializerReady"),Cd=Se([],"serializerTimer"),n3=(()=>{throw du()}),bo=Se(n3,"serializer"),i3=r=>(r.inject(bo,n3).inject(Cd,[bt]).record(nl),async()=>{await r.waitTimers(Cd);const e=r.get(Si),t=r.get(Zt);return r.set(bo,g9.create(t,e)),r.done(nl),()=>{r.remove(bo).remove(Cd).clearTimer(nl)}});Vn(i3,{displayName:"Serializer"});var v0=Se("","defaultValue"),Md=Se(r=>r,"stateOptions"),b0=Se([],"editorStateTimer"),w0=Ur("EditorStateReady");function x9(r,e,t){if(typeof r=="string")return e(r);if(r.type==="html")return Is.fromSchema(t).parse(r.dom);if(r.type==="json")return $n.fromJSON(t,r.value);throw lx(r)}var S9=new De("MILKDOWN_STATE_TRACKER"),s3=r=>(r.inject(v0,"").inject(_a,{}).inject(Md,e=>e).inject(b0,[rl,nl,el,tl]).record(w0),async()=>{await r.waitTimers(b0);const e=r.get(Zt),t=r.get(Ts),n=r.get(yl),i=r.get(Md),s=r.get(ur),o=x9(r.get(v0),t,e),a=r.get($0),l=a.addBaseKeymap(),c=[...s,new Ae({key:S9,state:{init:()=>{},apply:(h,f,m,y)=>{r.set(_a,y)}}}),Gx({rules:n}),W5(a.build())];r.set(ur,c);const u=i({schema:e,doc:o,plugins:c}),d=mo.create(u);return r.set(_a,d),r.done(w0),()=>{l(),r.remove(v0).remove(_a).remove(Md).remove(b0).clearTimer(w0)}});Vn(s3,{displayName:"EditorState"});var kl=Se([],"pasteRule"),Td=Se([bt],"pasteRuleTimer"),k0=Ur("PasteRuleReady"),o3=r=>(r.inject(kl,[]).inject(Td,[bt]).record(k0),async()=>(await r.waitTimers(Td),r.done(k0),()=>{r.remove(kl).remove(Td).clearTimer(k0)}));Vn(o3,{displayName:"PasteRule"});var x0=Ur("EditorViewReady"),Ad=Se([],"editorViewTimer"),il=Se({},"editorViewOptions"),S0=Se(null,"root"),jh=Se(null,"rootDOM"),Vh=Se({},"rootAttrs");function C9(r,e){const t=document.createElement("div");t.className="milkdown",r.appendChild(t),e.set(jh,t);const n=e.get(Vh);return Object.entries(n).forEach(([i,s])=>t.setAttribute(i,s)),t}function M9(r){r.classList.add("editor"),r.setAttribute("role","textbox")}var T9=new De("MILKDOWN_VIEW_CLEAR"),a3=r=>(r.inject(S0,document.body).inject(Me,{}).inject(il,{}).inject(jh,null).inject(Vh,{}).inject(Ad,[w0,k0]).record(x0),async()=>{await r.wait(Ms);const e=r.get(S0)||document.body,t=typeof e=="string"?document.querySelector(e):e;r.update(ur,l=>[new Ae({key:T9,view:c=>{const u=t?C9(t,r):void 0;return(()=>{if(u&&t){const h=c.dom;t.replaceChild(u,h),u.appendChild(h)}})(),{destroy:()=>{u!=null&&u.parentNode&&(u==null||u.parentNode.replaceChild(c.dom,u)),u==null||u.remove()}}}}),...l]),await r.waitTimers(Ad);const n=r.get(_a),i=r.get(il),s=Object.fromEntries(r.get(bl)),o=Object.fromEntries(r.get(wl)),a=new y5(t,{state:n,nodeViews:s,markViews:o,transformPasted:(l,c,u)=>(r.get(kl).sort((d,h)=>(h.priority??50)-(d.priority??50)).map(d=>d.run).forEach(d=>{l=d(l,c,u)}),l),...i});return M9(a.dom),r.set(Me,a),r.done(x0),()=>{a==null||a.destroy(),r.remove(S0).remove(Me).remove(il).remove(jh).remove(Vh).remove(Ad).clearTimer(x0)}});Vn(a3,{displayName:"EditorView"});var A9=(function(r){return r.Idle="Idle",r.OnCreate="OnCreate",r.Created="Created",r.OnDestroy="OnDestroy",r.Destroyed="Destroyed",r})({}),hs,ar,En,$o,Kl,Gl,Ut,Dn,fs,Jl,ps,qo,Yl,fi,Ho,_o,N9=(_o=class{constructor(){_(this,hs);_(this,ar);_(this,En);_(this,$o);_(this,Kl);_(this,Gl);_(this,Ut);_(this,Dn);_(this,fs);_(this,Jl);_(this,ps);_(this,qo);_(this,Yl);_(this,fi);_(this,Ho);F(this,hs,!1),F(this,ar,"Idle"),F(this,En,[]),F(this,$o,()=>{}),F(this,Kl,new M5),F(this,Gl,new wx),F(this,Ut,new Map),F(this,Dn,new Map),F(this,fs,new bx(C(this,Kl),C(this,Gl))),F(this,Jl,()=>{const e=y9(async n=>{await Promise.all(C(this,En).map(i=>Promise.resolve(i(n))))}),t=[X5,r3,i3,Q5,k9,o3,s3,a3,v9(this),e];C(this,ps).call(this,t,C(this,Dn))}),F(this,ps,(e,t)=>{e.forEach(n=>{const i=C(this,fs).produce(C(this,hs)?n.meta:void 0),s=n(i);t.set(n,{ctx:i,handler:s,cleanup:void 0})})}),F(this,qo,(e,t=!1)=>Promise.all([e].flat().map(async n=>{var s;const i=(s=C(this,Ut).get(n))==null?void 0:s.cleanup;return t?C(this,Ut).delete(n):C(this,Ut).set(n,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i}))),F(this,Yl,async()=>{await Promise.all([...C(this,Dn).entries()].map(async([e,{cleanup:t}])=>typeof t=="function"?t():t)),C(this,Dn).clear()}),F(this,fi,e=>{F(this,ar,e),C(this,$o).call(this,e)}),F(this,Ho,e=>[...e.entries()].map(async([t,n])=>{const{ctx:i,handler:s}=n;if(!s)return;const o=await s();e.set(t,{ctx:i,handler:s,cleanup:o})})),this.enableInspector=(e=!0)=>(F(this,hs,e),this),this.onStatusChange=e=>(F(this,$o,e),this),this.config=e=>(C(this,En).push(e),this),this.removeConfig=e=>(F(this,En,C(this,En).filter(t=>t!==e)),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(n=>{C(this,Ut).set(n,{ctx:void 0,handler:void 0,cleanup:void 0})}),C(this,ar)==="Created"&&C(this,ps).call(this,t,C(this,Ut)),this},this.remove=async e=>C(this,ar)==="OnCreate"?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await C(this,qo).call(this,[e].flat(),!0),this),this.create=async()=>C(this,ar)==="OnCreate"?this:(C(this,ar)==="Created"&&await this.destroy(),C(this,fi).call(this,"OnCreate"),C(this,Jl).call(this),C(this,ps).call(this,[...C(this,Ut).keys()],C(this,Ut)),await Promise.all([C(this,Ho).call(this,C(this,Dn)),C(this,Ho).call(this,C(this,Ut))].flat()),C(this,fi).call(this,"Created"),this),this.destroy=async(e=!1)=>C(this,ar)==="Destroyed"||C(this,ar)==="OnDestroy"?this:C(this,ar)==="OnCreate"?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&F(this,En,[]),C(this,fi).call(this,"OnDestroy"),await C(this,qo).call(this,[...C(this,Ut).keys()],e),await C(this,Yl).call(this),C(this,fi).call(this,"Destroyed"),this),this.action=e=>e(C(this,fs)),this.inspect=()=>C(this,hs)?[...C(this,Dn).values(),...C(this,Ut).values()].map(({ctx:e})=>{var t;return(t=e==null?void 0:e.inspector)==null?void 0:t.read()}).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new _o}get ctx(){return C(this,fs)}get status(){return C(this,ar)}},hs=new WeakMap,ar=new WeakMap,En=new WeakMap,$o=new WeakMap,Kl=new WeakMap,Gl=new WeakMap,Ut=new WeakMap,Dn=new WeakMap,fs=new WeakMap,Jl=new WeakMap,ps=new WeakMap,qo=new WeakMap,Yl=new WeakMap,fi=new WeakMap,Ho=new WeakMap,_o);function l3(r,e,t){const n=r.findIndex(([s])=>s===e);if(n===-1)return[...r,t];const i=r.slice();return i[n]=t,i}function fe(r,e){const t=b9(r),n=i=>async()=>{n.key=t,await i.wait(el);const s=e(i);return i.get(oe).create(t,s),n.run=o=>i.get(oe).call(r,o),()=>{i.get(oe).remove(t)}};return n}function wt(r){const e=t=>async()=>{await t.wait(bt);const n=r(t);return t.update(yl,i=>[...i,n]),e.inputRule=n,()=>{t.update(yl,i=>i.filter(s=>s!==n))}};return e}function E9(r){const e=t=>async()=>{await t.wait(bt);const n=r(t);return t.update(kl,i=>[...i,n]),e.pasteRule=n,()=>{t.update(kl,i=>i.filter(s=>s!==n))}};return e}function D9(r,e){const t=n=>async()=>{const i=e(n);return n.update(Qa,s=>l3(s,r,[r,i])),t.id=r,t.schema=i,()=>{n.update(Qa,s=>s.filter(([o])=>o!==r))}};return t.type=n=>{const i=n.get(Zt).marks[r];if(!i)throw mx(r);return i},t}function rp(r,e){const t=n=>async()=>{const i=e(n);return n.update(Ci,s=>l3(s,r,[r,i])),t.id=r,t.schema=i,()=>{n.update(Ci,s=>s.filter(([o])=>o!==r))}};return t.type=n=>{const i=n.get(Zt).nodes[r];if(!i)throw C5(r);return i},t}function qe(r){let e;const t=n=>async()=>(await n.wait(bt),e=r(n),n.update(ur,i=>[...i,e]),()=>{n.update(ur,i=>i.filter(s=>s!==e))});return t.plugin=()=>e,t.key=()=>e.spec.key,t}function c3(r){const e=t=>async()=>{await t.wait(tl);const n=t.get($0),i=r(t),s=n.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function Ai(r,e){const t=n=>async()=>{await n.wait(bt);const i=e(n);return r.type(n)instanceof I0?n.update(bl,s=>[...s,[r.id,i]]):n.update(wl,s=>[...s,[r.id,i]]),t.view=i,t.type=r,()=>{r.type(n)instanceof I0?n.update(bl,s=>s.filter(o=>o[0]!==r.id)):n.update(wl,s=>s.filter(o=>o[0]!==r.id))}};return t}function Ne(r,e){const t=Se(r,e),n=i=>(i.inject(t),()=>()=>{i.remove(t)});return n.key=t,n}function Ve(r,e){const t=Ne(e,r),n=rp(r,s=>s.get(t.key)(s)),i=[t,n];return i.id=n.id,i.node=n,i.type=s=>n.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>Ve(r,s(e)),i}function ya(r,e){const t=Ne(e,r),n=D9(r,s=>s.get(t.key)(s)),i=[t,n];return i.id=n.id,i.mark=n,i.type=s=>n.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>ya(r,s(e)),i}function Qt(r,e){const t=Ne(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:o,priority:a}])=>[s,{shortcuts:o,priority:a}])),`${r}Keymap`),n=c3(s=>{const o=s.get(t.key),a=Object.entries(e).flatMap(([l,{command:c}])=>{const u=o[l],d=[u.shortcuts].flat(),h=u.priority;return d.map(f=>[f,{key:f,onRun:c,priority:h}])});return Object.fromEntries(a)}),i=[t,n];return i.ctx=t,i.shortcuts=n,i.key=t.key,i.keymap=n.keymap,i}var Kr=(r,e=()=>({}))=>Ne(e,`${r}Attr`),Ac=(r,e=()=>({}))=>Ne(e,`${r}Attr`);function er(r,e,t){const n=Ne(t??{},r),i=o=>async()=>{await o.wait(Ms);const a={plugin:e(o),options:o.get(n.key)};return o.update(vl,l=>[...l,a]),()=>{o.update(vl,l=>l.filter(c=>c!==a))}},s=[n,i];return s.id=r,s.plugin=i,s.options=n,s}let Wh,Uh;if(typeof WeakMap<"u"){let r=new WeakMap;Wh=e=>r.get(e),Uh=(e,t)=>(r.set(e,t),t)}else{const r=[];let t=0;Wh=n=>{for(let i=0;i<r.length;i+=2)if(r[i]==n)return r[i+1]},Uh=(n,i)=>(t==10&&(t=0),r[t++]=n,r[t++]=i)}var Be=class{constructor(r,e,t,n){this.width=r,this.height=e,this.map=t,this.problems=n}findCell(r){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=r)continue;const n=e%this.width,i=e/this.width|0;let s=n+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==t;a++)o++;return{left:n,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${r} found`)}colCount(r){for(let e=0;e<this.map.length;e++)if(this.map[e]==r)return e%this.width;throw new RangeError(`No cell with offset ${r} found`)}nextCell(r,e,t){const{left:n,right:i,top:s,bottom:o}=this.findCell(r);return e=="horiz"?(t<0?n==0:i==this.width)?null:this.map[s*this.width+(t<0?n-1:i)]:(t<0?s==0:o==this.height)?null:this.map[n+this.width*(t<0?s-1:o)]}rectBetween(r,e){const{left:t,right:n,top:i,bottom:s}=this.findCell(r),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,l),right:Math.max(n,a),bottom:Math.max(s,c)}}cellsInRect(r){const e=[],t={};for(let n=r.top;n<r.bottom;n++)for(let i=r.left;i<r.right;i++){const s=n*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==r.left&&i&&this.map[s-1]==o||n==r.top&&n&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(r,e,t){for(let n=0,i=0;;n++){const s=i+t.child(n).nodeSize;if(n==r){let o=e+r*this.width;const a=(r+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(r){return Wh(r)||Uh(r,O9(r))}};function O9(r){if(r.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+r.type.name);const e=R9(r),t=r.childCount,n=[];let i=0,s=null;const o=[];for(let c=0,u=e*t;c<u;c++)n[c]=0;for(let c=0,u=0;c<t;c++){const d=r.child(c);u++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==d.childCount)break;const y=d.child(m),{colspan:b,rowspan:v,colwidth:k}=y.attrs;for(let M=0;M<v;M++){if(M+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:v-M});break}const D=i+M*e;for(let O=0;O<b;O++){n[D+O]==0?n[D+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:b-O});const z=k&&k[O];if(z){const T=(D+O)%e*2,B=o[T];B==null||B!=z&&o[T+1]==1?(o[T]=z,o[T+1]=1):B==z&&o[T+1]++}}}i+=b,u+=y.nodeSize}const h=(c+1)*e;let f=0;for(;i<h;)n[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Be(e,t,n,s);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&I9(a,o,r),a}function R9(r){let e=-1,t=!1;for(let n=0;n<r.childCount;n++){const i=r.child(n);let s=0;if(t)for(let o=0;o<n;o++){const a=r.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>n&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function I9(r,e,t){r.problems||(r.problems=[]);const n={};for(let i=0;i<r.map.length;i++){const s=r.map[i];if(n[s])continue;n[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=e[(i+c)%r.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=z9(l)))[c]=u)}a&&r.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function z9(r){if(r.colwidth)return r.colwidth.slice();const e=[];for(let t=0;t<r.colspan;t++)e.push(0);return e}function Ig(r,e){if(typeof r=="string")return{};const t=r.getAttribute("data-colwidth"),n=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(o=>Number(o)):null,i=Number(r.getAttribute("colspan")||1),s={colspan:i,rowspan:Number(r.getAttribute("rowspan")||1),colwidth:n&&n.length==i?n:null};for(const o in e){const a=e[o].getFromDOM,l=a&&a(r);l!=null&&(s[o]=l)}return s}function zg(r,e){const t={};r.attrs.colspan!=1&&(t.colspan=r.attrs.colspan),r.attrs.rowspan!=1&&(t.rowspan=r.attrs.rowspan),r.attrs.colwidth&&(t["data-colwidth"]=r.attrs.colwidth.join(","));for(const n in e){const i=e[n].setDOMAttr;i&&i(r.attrs[n],t)}return t}function L9(r){if(r!==null){if(!Array.isArray(r))throw new TypeError("colwidth must be null or an array");for(const e of r)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function B9(r){const e=r.cellAttributes||{},t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:L9}};for(const n in e)t[n]={default:e[n].default,validate:e[n].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:r.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:r.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:n=>Ig(n,e)}],toDOM(n){return["td",zg(n,e),0]}},table_header:{content:r.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:n=>Ig(n,e)}],toDOM(n){return["th",zg(n,e),0]}}}}function Dr(r){let e=r.cached.tableNodeTypes;if(!e){e=r.cached.tableNodeTypes={};for(const t in r.nodes){const n=r.nodes[t],i=n.spec.tableRole;i&&(e[i]=n)}}return e}const ci=new De("selectingCells");function ua(r){for(let e=r.depth-1;e>0;e--)if(r.node(e).type.spec.tableRole=="row")return r.node(0).resolve(r.before(e+1));return null}function Ir(r){const e=r.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function mu(r){const e=r.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=ua(e.$head)||P9(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function P9(r){for(let e=r.nodeAfter,t=r.pos;e;e=e.firstChild,t++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t)}for(let e=r.nodeBefore,t=r.pos;e;e=e.lastChild,t--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t-e.nodeSize)}}function Kh(r){return r.parent.type.spec.tableRole=="row"&&!!r.nodeAfter}function F9(r){return r.node(0).resolve(r.pos+r.nodeAfter.nodeSize)}function np(r,e){return r.depth==e.depth&&r.pos>=e.start(-1)&&r.pos<=e.end(-1)}function u3(r,e,t){const n=r.node(-1),i=Be.get(n),s=r.start(-1),o=i.nextCell(r.pos-s,e,t);return o==null?null:r.node(0).resolve(s+o)}function Bs(r,e,t=1){const n={...r,colspan:r.colspan-t};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,t),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}function $9(r,e,t=1){const n={...r,colspan:r.colspan+t};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let i=0;i<t;i++)n.colwidth.splice(e,0,0)}return n}function q9(r,e,t){const n=Dr(e.type.schema).header_cell;for(let i=0;i<r.height;i++)if(e.nodeAt(r.map[t+i*r.width]).type!=n)return!1;return!0}var He=class kn extends pe{constructor(e,t=e){const n=e.node(-1),i=Be.get(n),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(u=>u!=t.pos-s);l.unshift(t.pos-s);const c=l.map(u=>{const d=n.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new Ry(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Kh(n)&&Kh(i)&&np(n,i)){const s=this.$anchorCell.node(-1)!=n.node(-1);return s&&this.isRowSelection()?kn.rowSelection(n,i):s&&this.isColSelection()?kn.colSelection(n,i):new kn(n,i)}return se.between(n,i)}content(){const e=this.$anchorCell.node(-1),t=Be.get(e),n=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),s={},o=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let u=l*t.width+i.left,d=i.left;d<i.right;d++,u++){const h=t.map[u];if(s[h])continue;s[h]=!0;const f=t.findCell(h);let m=e.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const y=i.left-f.left,b=f.right-i.right;if(y>0||b>0){let v=m.attrs;if(y>0&&(v=Bs(v,0,y)),b>0&&(v=Bs(v,v.colspan-b,b)),f.left<i.left){if(m=m.type.createAndFill(v),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(v)}`)}else m=m.type.create(v,m.content)}if(f.top<i.top||f.bottom>i.bottom){const v={...m.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?m=m.type.createAndFill(v):m=m.type.create(v,m.content)}c.push(m)}o.push(e.child(l).copy(V.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new re(V.from(a),1,1)}replace(e,t=re.empty){const n=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],c=e.mapping.slice(n);e.replace(c.map(a.pos),c.map(l.pos),o?re.empty:t)}const s=pe.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new re(V.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=Be.get(t),i=this.$anchorCell.start(-1),s=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),i=Be.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(t=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new kn(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Be.get(e),n=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-n),s=t.colCount(this.$headCell.pos-n);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==t.width}eq(e){return e instanceof kn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),i=Be.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(t=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(t=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new kn(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new kn(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new kn(e.resolve(t),e.resolve(n))}getBookmark(){return new H9(this.$anchorCell.pos,this.$headCell.pos)}};He.prototype.visible=!1;pe.jsonID("cell",He);var H9=class d3{constructor(e,t){this.anchor=e,this.head=t}map(e){return new d3(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&np(t,n)?new He(t,n):pe.near(n,1)}};function _9(r){if(!(r.selection instanceof He))return null;const e=[];return r.selection.forEachCell((t,n)=>{e.push(Ze.node(n,n+t.nodeSize,{class:"selectedCell"}))}),$e.create(r.doc,e)}function j9({$from:r,$to:e}){if(r.pos==e.pos||r.pos<e.pos-6)return!1;let t=r.pos,n=e.pos,i=r.depth;for(;i>=0&&!(r.after(i+1)<r.end(i));i--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,n--);return t==n&&/row|table/.test(r.node(i).type.spec.tableRole)}function V9({$from:r,$to:e}){let t,n;for(let i=r.depth;i>0;i--){const s=r.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}return t!==n&&e.parentOffset===0}function W9(r,e,t){const n=(e||r).selection,i=(e||r).doc;let s,o;if(n instanceof ae&&(o=n.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=He.create(i,n.from);else if(o=="row"){const a=i.resolve(n.from+1);s=He.rowSelection(a,a)}else if(!t){const a=Be.get(n.node),l=n.from+1,c=l+a.map[a.width*a.height-1];s=He.create(i,l+1,c)}}else n instanceof se&&j9(n)?s=se.create(i,n.from):n instanceof se&&V9(n)&&(s=se.create(i,n.$from.start(),n.$from.end()));return s&&(e||(e=r.tr)).setSelection(s),e}const U9=new De("fix-tables");function h3(r,e,t,n){const i=r.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const l=e.child(o);for(let c=a,u=Math.min(i,o+3);c<u;c++)if(r.child(c)==l){a=c+1,t+=l.nodeSize;continue e}n(l,t),a<i&&r.child(a).sameMarkup(l)?h3(r.child(a),l,t+1,n):l.nodesBetween(0,l.content.size,n,t+1),t+=l.nodeSize}}function K9(r,e){let t;const n=(i,s)=>{i.type.spec.tableRole=="table"&&(t=G9(r,i,s,t))};return e?e.doc!=r.doc&&h3(e.doc,r.doc,0,n):r.doc.descendants(n),t}function G9(r,e,t,n){const i=Be.get(e);if(!i.problems)return n;n||(n=r.tr);const s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){const c=i.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;n.setNodeMarkup(n.mapping.map(t+1+c.pos),null,Bs(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=n.mapping.map(t);n.delete(u,u+e.nodeSize)}}let o,a;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),a=l);for(let l=0,c=t+1;l<i.height;l++){const u=e.child(l),d=c+u.nodeSize,h=s[l];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<h;b++){const v=Dr(r.schema)[f].createAndFill();v&&m.push(v)}const y=(l==0||o==l-1)&&a==l?c+1:d-1;n.insert(n.mapping.map(y),m)}c=d}return n.setMeta(U9,{fixTables:!0})}function f3(r){const e=Be.get(r),t=[],n=e.height,i=e.width;for(let s=0;s<n;s++){const o=[];for(let a=0;a<i;a++){const l=s*i+a,c=e.map[l];if(s>0){const u=l-i;if(c===e.map[u]){o.push(null);continue}}if(a>0){const u=l-1;if(c===e.map[u]){o.push(null);continue}}o.push(r.nodeAt(c))}t.push(o)}return t}function p3(r,e){const t=[],n=Be.get(r),i=n.height,s=n.width;for(let o=0;o<i;o++){const a=r.child(o),l=[];for(let u=0;u<s;u++){const d=e[o][u];if(!d)continue;const h=n.map[o*n.width+u],f=r.nodeAt(h);if(!f)continue;const m=f.type.createChecked(d.attrs,d.content,d.marks);l.push(m)}const c=a.type.createChecked(a.attrs,l,a.marks);t.push(c)}return r.type.createChecked(r.attrs,t,r.marks)}function m3(r,e,t,n){const i=e[0]>t[0]?-1:1,s=r.splice(e[0],e.length),o=s.length%2===0?1:0;let a;return a=i===-1?t[0]:t[t.length-1]-o,r.splice(a,0,...s),r}function va(r){return J9(e=>e.type.spec.tableRole==="table",r)}function J9(r,e){for(let t=e.depth;t>=0;t-=1){const n=e.node(t);if(r(n))return{node:n,pos:t===0?0:e.before(t),start:e.start(t),depth:t}}return null}function ao(r,e){const t=va(e.$from);if(!t)return;const n=Be.get(t.node);if(!(r<0||r>n.width-1))return n.cellsInRect({left:r,right:r+1,top:0,bottom:n.height}).map(i=>{const s=t.node.nodeAt(i),o=i+t.start;return{pos:o,start:o+1,node:s,depth:t.depth+2}})}function lo(r,e){const t=va(e.$from);if(!t)return;const n=Be.get(t.node);if(!(r<0||r>n.height-1))return n.cellsInRect({left:0,right:n.width,top:r,bottom:r+1}).map(i=>{const s=t.node.nodeAt(i),o=i+t.start;return{pos:o,start:o+1,node:s,depth:t.depth+2}})}function Lg(r,e,t=e){let n=e,i=t;for(let u=e;u>=0;u--){const d=ao(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.colspan+u-1;f>=n&&(n=u),f>i&&(i=f)})}for(let u=e;u<=i;u++){const d=ao(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.colspan+u-1;h.node.attrs.colspan>1&&f>i&&(i=f)})}const s=[];for(let u=n;u<=i;u++){const d=ao(u,r.selection);d&&d.length>0&&s.push(u)}n=s[0],i=s[s.length-1];const o=ao(n,r.selection),a=lo(0,r.selection);if(!o||!a)return;const l=r.doc.resolve(o[o.length-1].pos);let c;for(let u=i;u>=n;u--){const d=ao(u,r.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:r.doc.resolve(c.pos),indexes:s}}function Bg(r,e,t=e){let n=e,i=t;for(let u=e;u>=0;u--){const d=lo(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.rowspan+u-1;f>=n&&(n=u),f>i&&(i=f)})}for(let u=e;u<=i;u++){const d=lo(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.rowspan+u-1;h.node.attrs.rowspan>1&&f>i&&(i=f)})}const s=[];for(let u=n;u<=i;u++){const d=lo(u,r.selection);d&&d.length>0&&s.push(u)}n=s[0],i=s[s.length-1];const o=lo(n,r.selection),a=ao(0,r.selection);if(!o||!a)return;const l=r.doc.resolve(o[o.length-1].pos);let c;for(let u=i;u>=n;u--){const d=lo(u,r.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:r.doc.resolve(c.pos),indexes:s}}function Pg(r){return r[0].map((e,t)=>r.map(n=>n[t]))}function Y9(r){var e,t;const{tr:n,originIndex:i,targetIndex:s,select:o,pos:a}=r,l=va(n.doc.resolve(a));if(!l)return!1;const c=(e=Lg(n,i))===null||e===void 0?void 0:e.indexes,u=(t=Lg(n,s))===null||t===void 0?void 0:t.indexes;if(!c||!u||c.includes(s))return!1;const d=X9(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!o)return!0;const h=Be.get(d),f=l.start,m=s,y=h.positionAt(h.height-1,m,d),b=n.doc.resolve(f+y),v=h.positionAt(0,m,d),k=n.doc.resolve(f+v);return n.setSelection(He.colSelection(b,k)),!0}function X9(r,e,t,n){let i=Pg(f3(r));return i=m3(i,e,t),i=Pg(i),p3(r,i)}function Z9(r){var e,t;const{tr:n,originIndex:i,targetIndex:s,select:o,pos:a}=r,l=va(n.doc.resolve(a));if(!l)return!1;const c=(e=Bg(n,i))===null||e===void 0?void 0:e.indexes,u=(t=Bg(n,s))===null||t===void 0?void 0:t.indexes;if(!c||!u||c.includes(s))return!1;const d=Q9(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!o)return!0;const h=Be.get(d),f=l.start,m=s,y=h.positionAt(m,h.width-1,d),b=n.doc.resolve(f+y),v=h.positionAt(m,0,d),k=n.doc.resolve(f+v);return n.setSelection(He.rowSelection(b,k)),!0}function Q9(r,e,t,n){let i=f3(r);return i=m3(i,e,t),p3(r,i)}function Li(r){const e=r.selection,t=mu(r),n=t.node(-1),i=t.start(-1),s=Be.get(n);return{...e instanceof He?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:n}}function g3(r,{map:e,tableStart:t,table:n},i){let s=i>0?-1:0;q9(e,n,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=n.nodeAt(l);r.setNodeMarkup(r.mapping.map(t+l),null,$9(c.attrs,i-e.colCount(l))),o+=c.attrs.rowspan-1}else{const l=s==null?Dr(n.type.schema).cell:n.nodeAt(e.map[a+s]).type,c=e.positionAt(o,i,n);r.insert(r.mapping.map(t+c),l.createAndFill())}}return r}function eS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r);e(g3(r.tr,t,t.left))}return!0}function tS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r);e(g3(r.tr,t,t.right))}return!0}function rS(r,{map:e,table:t,tableStart:n},i){const s=r.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,l=e.map[a],c=t.nodeAt(l),u=c.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)r.setNodeMarkup(r.mapping.slice(s).map(n+l),null,Bs(u,i-e.colCount(l)));else{const d=r.mapping.slice(s).map(n+l);r.delete(d,d+c.nodeSize)}o+=u.rowspan}}function nS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r),n=r.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;rS(n,t,i),i!=t.left;i--){const s=t.tableStart?n.doc.nodeAt(t.tableStart-1):n.doc;if(!s)throw new RangeError("No table found");t.table=s,t.map=Be.get(s)}e(n)}return!0}function iS(r,{map:e,table:t,tableStart:n},i){let s=0;for(let c=0;c<i;c++)s+=t.child(c).nodeSize;const o=s+t.child(i).nodeSize,a=r.mapping.maps.length;r.delete(s+n,o+n);const l=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[u-e.width]){const h=t.nodeAt(d).attrs;r.setNodeMarkup(r.mapping.slice(a).map(d+n),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const h=t.nodeAt(d),f=h.attrs,m=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),y=e.positionAt(i+1,c,t);r.insert(r.mapping.slice(a).map(n+y),m),c+=f.colspan-1}}}}function sS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r),n=r.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;iS(n,t,i),i!=t.top;i--){const s=t.tableStart?n.doc.nodeAt(t.tableStart-1):n.doc;if(!s)throw new RangeError("No table found");t.table=s,t.map=Be.get(t.table)}e(n)}return!0}function oS(r,e){return function(t,n){if(!Ir(t))return!1;const i=mu(t);if(i.nodeAfter.attrs[r]===e)return!1;if(n){const s=t.tr;t.selection instanceof He?t.selection.forEachCell((o,a)=>{o.attrs[r]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[r]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[r]:e}),n(s)}return!0}}function aS(r){return function(e,t){if(!Ir(e))return!1;if(t){const n=Dr(e.schema),i=Li(e),s=e.tr,o=i.map.cellsInRect(r=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:r=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==n.header_cell&&s.setNodeMarkup(i.tableStart+o[l],n.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],n.header_cell,a[l].attrs);t(s)}return!0}}function Fg(r,e,t){const n=e.map.cellsInRect({left:0,top:0,right:r=="row"?e.map.width:1,bottom:r=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const s=e.table.nodeAt(n[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function ip(r,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?aS(r):function(t,n){if(!Ir(t))return!1;if(n){const i=Dr(t.schema),s=Li(t),o=t.tr,a=Fg("row",s,i),l=Fg("column",s,i),c=(r==="column"?a:r==="row"&&l)?1:0,u=r=="column"?{left:0,top:c,right:1,bottom:s.map.height}:r=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=r=="column"?l?i.cell:i.header_cell:r=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,m=o.doc.nodeAt(f);m&&o.setNodeMarkup(f,d,m.attrs)}),n(o)}return!0}}ip("row",{useDeprecatedLogic:!0});ip("column",{useDeprecatedLogic:!0});ip("cell",{useDeprecatedLogic:!0});function lS(r,e){if(e<0){const t=r.nodeBefore;if(t)return r.pos-t.nodeSize;for(let n=r.index(-1)-1,i=r.before();n>=0;n--){const s=r.node(-1).child(n),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(r.index()<r.parent.childCount-1)return r.pos+r.nodeAfter.nodeSize;const t=r.node(-1);for(let n=r.indexAfter(-1),i=r.after();n<t.childCount;n++){const s=t.child(n);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function y3(r){return function(e,t){if(!Ir(e))return!1;const n=lS(mu(e),r);if(n==null)return!1;if(t){const i=e.doc.resolve(n);t(e.tr.setSelection(se.between(i,F9(i))).scrollIntoView())}return!0}}function cS(r,e){const t=r.selection.$anchor;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="table")return e&&e(r.tr.delete(t.before(n),t.after(n)).scrollIntoView()),!0;return!1}function Gc(r,e){const t=r.selection;if(!(t instanceof He))return!1;if(e){const n=r.tr,i=Dr(r.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||n.replace(n.mapping.map(o+1),n.mapping.map(o+s.nodeSize-1),new re(i,0,0))}),n.docChanged&&e(n)}return!0}function uS(r){return(e,t)=>{const{from:n,to:i,select:s=!0,pos:o=e.selection.from}=r,a=e.tr;return Z9({tr:a,originIndex:n,targetIndex:i,select:s,pos:o})?(t==null||t(a),!0):!1}}function dS(r){return(e,t)=>{const{from:n,to:i,select:s=!0,pos:o=e.selection.from}=r,a=e.tr;return Y9({tr:a,originIndex:n,targetIndex:i,select:s,pos:o})?(t==null||t(a),!0):!1}}function hS(r){if(r.size===0)return null;let{content:e,openStart:t,openEnd:n}=r;for(;e.childCount==1&&(t>0&&n>0||e.child(0).type.spec.tableRole=="table");)t--,n--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,t-1),d=l<e.childCount-1?0:Math.max(0,n-1);(u||d)&&(c=Gh(Dr(o).row,new re(c,u,d)).content),a.push(c)}else if(s=="cell"||s=="header_cell")a.push(t||n?Gh(Dr(o).row,new re(e,t,n)).content:e);else return null;return fS(o,a)}function fS(r,e){const t=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let c=i;c<i+a;c++)t[c]=(t[c]||0)+l}}let n=0;for(let i=0;i<t.length;i++)n=Math.max(n,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(V.empty),t[i]<n){const s=Dr(r).cell.createAndFill(),o=[];for(let a=t[i];a<n;a++)o.push(s);e[i]=e[i].append(V.from(o))}return{height:e.length,width:n,rows:e}}function Gh(r,e){const t=r.createAndFill();return new Oy(t).replace(0,t.content.size,e).doc}function pS({width:r,height:e,rows:t},n,i){if(r!=n){const s=[],o=[];for(let a=0;a<t.length;a++){const l=t[a],c=[];for(let u=s[a]||0,d=0;u<n;d++){let h=l.child(d%l.childCount);u+h.attrs.colspan>n&&(h=h.type.createChecked(Bs(h.attrs,h.attrs.colspan,u+h.attrs.colspan-n),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(V.from(c))}t=o,r=n}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const l=[],c=t[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(V.from(l))}t=s,e=i}return{width:r,height:e,rows:t}}function mS(r,e,t,n,i,s,o){const a=r.doc.type.schema,l=Dr(a);let c,u;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=t.child(d);h+=f.nodeSize;const m=[];let y;f.lastChild==null||f.lastChild.type==l.cell?y=c||(c=l.cell.createAndFill()):y=u||(u=l.header_cell.createAndFill());for(let b=e.width;b<i;b++)m.push(y);r.insert(r.mapping.slice(o).map(h-1+n),m)}if(s>e.height){const d=[];for(let m=0,y=(e.height-1)*e.width;m<Math.max(e.width,i);m++){const b=m>=e.width?!1:t.nodeAt(e.map[y+m]).type==l.header_cell;d.push(b?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,V.from(d)),f=[];for(let m=e.height;m<s;m++)f.push(h);r.insert(r.mapping.slice(o).map(n+t.nodeSize-2),f)}return!!(c||u)}function $g(r,e,t,n,i,s,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=i;c<s;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const h=t.nodeAt(d),{top:f,left:m}=e.findCell(d);r.setNodeMarkup(r.mapping.slice(a).map(d+n),null,{...h.attrs,rowspan:o-f}),r.insert(r.mapping.slice(a).map(e.positionAt(o,m,t)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),c+=h.attrs.colspan-1}}return l}function qg(r,e,t,n,i,s,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=i;c<s;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){l=!0;const h=t.nodeAt(d),f=e.colCount(d),m=r.mapping.slice(a).map(d+n);r.setNodeMarkup(m,null,Bs(h.attrs,o-f,h.attrs.colspan-(o-f))),r.insert(m+h.nodeSize,h.type.createAndFill(Bs(h.attrs,0,o-f))),c+=h.attrs.rowspan-1}}return l}function Hg(r,e,t,n,i){let s=t?r.doc.nodeAt(t-1):r.doc;if(!s)throw new Error("No table found");let o=Be.get(s);const{top:a,left:l}=n,c=l+i.width,u=a+i.height,d=r.tr;let h=0;function f(){if(s=t?d.doc.nodeAt(t-1):d.doc,!s)throw new Error("No table found");o=Be.get(s),h=d.mapping.maps.length}mS(d,o,s,t,c,u,h)&&f(),$g(d,o,s,t,l,c,a,h)&&f(),$g(d,o,s,t,l,c,u,h)&&f(),qg(d,o,s,t,a,u,l,h)&&f(),qg(d,o,s,t,a,u,c,h)&&f();for(let m=a;m<u;m++){const y=o.positionAt(m,l,s),b=o.positionAt(m,c,s);d.replace(d.mapping.slice(h).map(y+t),d.mapping.slice(h).map(b+t),new re(i.rows[m-a],0,0))}f(),d.setSelection(new He(d.doc.resolve(t+o.positionAt(a,l,s)),d.doc.resolve(t+o.positionAt(u-1,c-1,s)))),e(d)}const gS=tp({ArrowLeft:Jc("horiz",-1),ArrowRight:Jc("horiz",1),ArrowUp:Jc("vert",-1),ArrowDown:Jc("vert",1),"Shift-ArrowLeft":Yc("horiz",-1),"Shift-ArrowRight":Yc("horiz",1),"Shift-ArrowUp":Yc("vert",-1),"Shift-ArrowDown":Yc("vert",1),Backspace:Gc,"Mod-Backspace":Gc,Delete:Gc,"Mod-Delete":Gc});function C0(r,e,t){return t.eq(r.selection)?!1:(e&&e(r.tr.setSelection(t).scrollIntoView()),!0)}function Jc(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof He)return C0(t,n,pe.near(s.$headCell,e));if(r!="horiz"&&!s.empty)return!1;const o=v3(i,r,e);if(o==null)return!1;if(r=="horiz")return C0(t,n,pe.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=u3(a,r,e);let c;return l?c=pe.near(l,1):e<0?c=pe.near(t.doc.resolve(a.before(-1)),-1):c=pe.near(t.doc.resolve(a.after(-1)),1),C0(t,n,c)}}}function Yc(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof He)o=s;else{const l=v3(i,r,e);if(l==null)return!1;o=new He(t.doc.resolve(l))}const a=u3(o.$headCell,r,e);return a?C0(t,n,new He(o.$anchorCell,a)):!1}}function yS(r,e){const t=r.state.doc,n=ua(t.resolve(e));return n?(r.dispatch(r.state.tr.setSelection(new He(n))),!0):!1}function vS(r,e,t){if(!Ir(r.state))return!1;let n=hS(t);const i=r.state.selection;if(i instanceof He){n||(n={width:1,height:1,rows:[V.from(Gh(Dr(r.state.schema).cell,t))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Be.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return n=pS(n,a.right-a.left,a.bottom-a.top),Hg(r.state,r.dispatch,o,a,n),!0}else if(n){const s=mu(r.state),o=s.start(-1);return Hg(r.state,r.dispatch,o,Be.get(s.node(-1)).findCell(s.pos-o),n),!0}else return!1}function bS(r,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const n=_g(r,e.target);let i;if(e.shiftKey&&r.state.selection instanceof He)s(r.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(i=ua(r.state.selection.$anchor))!=null&&((t=Nd(r,e))===null||t===void 0?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!n)return;function s(l,c){let u=Nd(r,c);const d=ci.getState(r.state)==null;if(!u||!np(l,u))if(d)u=l;else return;const h=new He(l,u);if(d||!r.state.selection.eq(h)){const f=r.state.tr.setSelection(h);d&&f.setMeta(ci,l.pos),r.dispatch(f)}}function o(){r.root.removeEventListener("mouseup",o),r.root.removeEventListener("dragstart",o),r.root.removeEventListener("mousemove",a),ci.getState(r.state)!=null&&r.dispatch(r.state.tr.setMeta(ci,-1))}function a(l){const c=l,u=ci.getState(r.state);let d;if(u!=null)d=r.state.doc.resolve(u);else if(_g(r,c.target)!=n&&(d=Nd(r,e),!d))return o();d&&s(d,c)}r.root.addEventListener("mouseup",o),r.root.addEventListener("dragstart",o),r.root.addEventListener("mousemove",a)}function v3(r,e,t){if(!(r.state.selection instanceof se))return null;const{$head:n}=r.state.selection;for(let i=n.depth-1;i>=0;i--){const s=n.node(i);if((t<0?n.index(i):n.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=n.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return r.endOfTextblock(a)?o:null}}return null}function _g(r,e){for(;e&&e!=r.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Nd(r,e){const t=r.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:n,pos:i}=t;return n>=0&&ua(r.state.doc.resolve(n))||ua(r.state.doc.resolve(i))}var wS=class{constructor(r,e){this.node=r,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Jh(r,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(r){return r.type!=this.node.type?!1:(this.node=r,Jh(r,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(r){return r.type=="attributes"&&(r.target==this.table||this.colgroup.contains(r.target))}};function Jh(r,e,t,n,i,s){let o=0,a=!0,l=e.firstChild;const c=r.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:m}=c.child(d).attrs;for(let y=0;y<f;y++,h++){const b=i==h?s:m&&m[y],v=b?b+"px":"";if(o+=b||n,b||(a=!1),l)l.style.width!=v&&(l.style.width=v),l=l.nextSibling;else{const k=document.createElement("col");k.style.width=v,e.appendChild(k)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(t.style.width=o+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=o+"px")}}const cr=new De("tableColumnResizing");function kS({handleWidth:r=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:n=wS,lastColumnResizable:i=!0}={}){const s=new Ae({key:cr,state:{init(o,a){var l;const c=(l=s.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=Dr(a.schema).table.name;return n&&c&&(c[u]=(d,h)=>new n(d,t,h)),new xS(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=cr.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{SS(o,a,r,i)},mouseleave:o=>{CS(o)},mousedown:(o,a)=>{MS(o,a,e,t)}},decorations:o=>{const a=cr.getState(o);if(a&&a.activeHandle>-1)return DS(o,a.activeHandle)},nodeViews:{}}});return s}var xS=class M0{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,n=e.getMeta(cr);if(n&&n.setHandle!=null)return new M0(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new M0(t.activeHandle,n.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Kh(e.doc.resolve(i))||(i=-1),new M0(i,t.dragging)}return t}};function SS(r,e,t,n){if(!r.editable)return;const i=cr.getState(r.state);if(i&&!i.dragging){const s=AS(e.target);let o=-1;if(s){const{left:a,right:l}=s.getBoundingClientRect();e.clientX-a<=t?o=jg(r,e,"left",t):l-e.clientX<=t&&(o=jg(r,e,"right",t))}if(o!=i.activeHandle){if(!n&&o!==-1){const a=r.state.doc.resolve(o),l=a.node(-1),c=Be.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}b3(r,o)}}}function CS(r){if(!r.editable)return;const e=cr.getState(r.state);e&&e.activeHandle>-1&&!e.dragging&&b3(r,-1)}function MS(r,e,t,n){var i;if(!r.editable)return!1;const s=(i=r.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=cr.getState(r.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=r.state.doc.nodeAt(o.activeHandle),l=TS(r,o.activeHandle,a.attrs);r.dispatch(r.state.tr.setMeta(cr,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=cr.getState(r.state);h!=null&&h.dragging&&(NS(r,h.activeHandle,Vg(h.dragging,d,t)),r.dispatch(r.state.tr.setMeta(cr,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=cr.getState(r.state);if(h&&h.dragging){const f=Vg(h.dragging,d,t);Wg(r,h.activeHandle,f,n)}}return Wg(r,o.activeHandle,l,n),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function TS(r,e,{colspan:t,colwidth:n}){const i=n&&n[n.length-1];if(i)return i;const s=r.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=t;if(n)for(let l=0;l<t;l++)n[l]&&(o-=n[l],a--);return o/a}function AS(r){for(;r&&r.nodeName!="TD"&&r.nodeName!="TH";)r=r.classList&&r.classList.contains("ProseMirror")?null:r.parentNode;return r}function jg(r,e,t,n){const i=t=="right"?-n:n,s=r.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=ua(r.state.doc.resolve(o));if(!a)return-1;if(t=="right")return a.pos;const l=Be.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Vg(r,e,t){const n=e.clientX-r.startX;return Math.max(t,r.startWidth+n)}function b3(r,e){r.dispatch(r.state.tr.setMeta(cr,{setHandle:e}))}function NS(r,e,t){const n=r.state.doc.resolve(e),i=n.node(-1),s=Be.get(i),o=n.start(-1),a=s.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1,l=r.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+a;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==t)continue;const m=h.colwidth?h.colwidth.slice():ES(h.colspan);m[f]=t,l.setNodeMarkup(o+d,null,{...h,colwidth:m})}l.docChanged&&r.dispatch(l)}function Wg(r,e,t,n){const i=r.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=Be.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let l=r.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Jh(s,l.firstChild,l,n,a,t)}function ES(r){return Array(r).fill(0)}function DS(r,e){const t=[],n=r.doc.resolve(e),i=n.node(-1);if(!i)return $e.empty;const s=Be.get(i),o=n.start(-1),a=s.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var l;const d=s.map[u],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((l=cr.getState(r))===null||l===void 0)&&l.dragging&&t.push(Ze.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),t.push(Ze.widget(h,f))}}return $e.create(r.doc,t)}function OS({allowTableNodeSelection:r=!1}={}){return new Ae({key:ci,state:{init(){return null},apply(e,t){const n=e.getMeta(ci);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;const{deleted:i,pos:s}=e.mapping.mapResult(t);return i?null:s}},props:{decorations:_9,handleDOMEvents:{mousedown:bS},createSelectionBetween(e){return ci.getState(e.state)!=null?e.state.selection:null},handleTripleClick:yS,handleKeyDown:gS,handlePaste:vS},appendTransaction(e,t,n){return W9(n,K9(n,t),r)}})}function RS(r,e){return function(t,n){let{$from:i,$to:s,node:o}=t.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(s))return!1;let a=i.node(-1);if(a.type!=r)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=r||i.index(-2)!=i.node(-2).childCount-1)return!1;if(n){let d=V.empty,h=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-h;v>=i.depth-3;v--)d=V.from(i.node(v).copy(d));let f=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;d=d.append(V.from(r.createAndFill()));let m=i.before(i.depth-(h-1)),y=t.tr.replace(m,i.after(-f),new re(d,4-h,0)),b=-1;y.doc.nodesBetween(m,y.doc.content.size,(v,k)=>{if(b>-1)return!1;v.isTextblock&&v.content.size==0&&(b=k+1)}),b>-1&&y.setSelection(pe.near(y.doc.resolve(b))),n(y.scrollIntoView())}return!0}let l=s.pos==i.end()?a.contentMatchAt(0).defaultType:null,c=t.tr.delete(i.pos,s.pos),u=l?[null,{type:l}]:void 0;return Ja(c.doc,i.pos,2,u)?(n&&n(c.split(i.pos,2,u).scrollIntoView()),!0):!1}}function IS(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?zS(e,t,r,s):LS(e,t,s):!0:!1}}function zS(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new At(s-1,o,s,o,new re(V.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new cy(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=su(n);if(a==null)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return wc(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function LS(r,e,t){let n=r.tr,i=t.parent;for(let f=t.end,m=t.endIndex-1,y=t.startIndex;m>y;m--)f-=i.child(m).nodeSize,n.delete(f-1,f+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?V.empty:V.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return n.step(new At(d-(a?1:0),h+(l?1:0),d+1,h-1,new re((a?V.empty:V.from(i.copy(V.empty))).append(l?V.empty:V.from(i.copy(V.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function BS(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=V.from(c?r.create():null),d=new re(V.from(r.create(null,V.from(a.type.create(null,u)))),c?3:1,0),h=s.start,f=s.end;t(e.tr.step(new At(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}function PS(r){const e=new Map;if(!r||!r.type)throw new Error("mdast-util-definitions expected node");return $s(r,"definition",function(n){const i=Ug(n.identifier);i&&!e.get(i)&&e.set(i,n)}),t;function t(n){const i=Ug(n);return e.get(i)}}function Ug(r){return String(r||"").toUpperCase()}function FS(){return function(r){const e=PS(r);$s(r,function(t,n,i){if(t.type==="definition"&&i!==void 0&&typeof n=="number")return i.children.splice(n,1),[M1,n];if(t.type==="imageReference"||t.type==="linkReference"){const s=e(t.identifier);if(s&&i&&typeof n=="number")return i.children[n]=t.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:t.alt}:{type:"link",url:s.url,title:s.title,children:t.children},[M1,n]}})}}function w3(r,e){var n;if(!(e.childCount>=1&&((n=e.lastChild)==null?void 0:n.type.name)==="hardbreak")){r.next(e.content);return}const t=[];e.content.forEach((i,s,o)=>{o!==e.childCount-1&&t.push(i)}),r.next(V.fromArray(t))}function j(r,e){return Object.assign(r,{meta:{package:"@milkdown/preset-commonmark",...e}}),r}var sp=Ac("emphasis");j(sp,{displayName:"Attr<emphasis>",group:"Emphasis"});var Hs=ya("emphasis",r=>({attrs:{marker:{default:r.get(Za).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",r.get(sp.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));j(Hs.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});j(Hs.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var gu=fe("ToggleEmphasis",r=>()=>hu(Hs.type(r)));j(gu,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var k3=wt(r=>Tc(/(?:^|[^*])\*([^*]+)\*$/,Hs.type(r),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));j(k3,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var x3=wt(r=>Tc(/\b_(?![_\s])(.*?[^_\s])_$/,Hs.type(r),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));j(x3,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var op=Qt("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:r=>{const e=r.get(oe);return()=>e.call(gu.key)}}});j(op.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});j(op.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var ap=Ac("strong");j(ap,{displayName:"Attr<strong>",group:"Strong"});var ba=ya("strong",r=>({attrs:{marker:{default:r.get(Za).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",r.get(ap.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));j(ba.mark,{displayName:"MarkSchema<strong>",group:"Strong"});j(ba.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var yu=fe("ToggleStrong",r=>()=>hu(ba.type(r)));j(yu,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var S3=wt(r=>Tc(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),ba.type(r),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));j(S3,{displayName:"InputRule<strong>",group:"Strong"});var lp=Qt("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:r=>{const e=r.get(oe);return()=>e.call(yu.key)}}});j(lp.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});j(lp.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var cp=Ac("inlineCode");j(cp,{displayName:"Attr<inlineCode>",group:"InlineCode"});var Bn=ya("inlineCode",r=>({priority:100,code:!0,inclusive:!1,parseDOM:[{tag:"code"}],toDOM:e=>["code",r.get(cp.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,t,n)=>(e.withMark(t,"inlineCode",n.text||""),!0)}}));j(Bn.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});j(Bn.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var vu=fe("ToggleInlineCode",r=>()=>(e,t)=>{const{selection:n,tr:i}=e;if(n.empty)return!1;const{from:s,to:o}=n;return e.doc.rangeHasMark(s,o,Bn.type(r))?(t==null||t(i.removeMark(s,o,Bn.type(r))),!0):(Object.keys(e.schema.marks).filter(a=>a!==Bn.type.name).map(a=>e.schema.marks[a]).forEach(a=>{i.removeMark(s,o,a)}),t==null||t(i.addMark(s,o,Bn.type(r).create())),!0)});j(vu,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var C3=wt(r=>Tc(/(?:`)([^`]+)(?:`)$/,Bn.type(r)));j(C3,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var up=Qt("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:r=>{const e=r.get(oe);return()=>e.call(vu.key)}}});j(up.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});j(up.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var $S=new Set(["http:","https:","mailto:","tel:","ftp:"]);function qS(r){return r<=32||r>=127&&r<=160||r>=8203&&r<=8205||r===8232||r===8233||r===65279}function HS(r){let e="";for(const t of r)qS(t.codePointAt(0)??0)||(e+=t);return e}function _S(r){var i;if(typeof r!="string")return"";const e=r.trim();if(!e)return"";const t=HS(e),n=(i=/^([a-z][a-z0-9+.-]*):/i.exec(t))==null?void 0:i[1];return!n||$S.has(`${n.toLowerCase()}:`)?e:""}var dp=Ac("link");j(dp,{displayName:"Attr<link>",group:"Link"});var jr=ya("link",r=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...r.get(dp.key)(e),...e.attrs,href:_S(e.attrs.href)}],parseMarkdown:{match:e=>e.type==="link",runner:(e,t,n)=>{const i=t.url,s=t.title;e.openMark(n,{href:i,title:s}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));j(jr.mark,{displayName:"MarkSchema<link>",group:"Link"});var M3=fe("ToggleLink",r=>(e={})=>hu(jr.type(r),e));j(M3,{displayName:"Command<toggleLinkCommand>",group:"Link"});var T3=fe("UpdateLink",r=>(e={})=>(t,n)=>{if(!n)return!1;let i,s=-1;const{selection:o}=t,{from:a,to:l}=o;if(t.doc.nodesBetween(a,a===l?l+1:l,(m,y)=>{if(jr.type(r).isInSet(m.marks))return i=m,s=y,!1}),!i)return!1;const c=i.marks.find(({type:m})=>m===jr.type(r));if(!c)return!1;const u=s,d=s+i.nodeSize,{tr:h}=t,f=jr.type(r).create({...c.attrs,...e});return f?(n(h.removeMark(u,d,c).addMark(u,d,f).setSelection(new se(h.selection.$anchor)).scrollIntoView()),!0):!1});j(T3,{displayName:"Command<updateLinkCommand>",group:"Link"});var A3=rp("doc",()=>({content:"block+",parseMarkdown:{match:({type:r})=>r==="root",runner:(r,e,t)=>{r.injectRoot(e,t)}},toMarkdown:{match:r=>r.type.name==="doc",runner:(r,e)=>{r.openNode("root"),r.next(e.content)}}}));j(A3,{displayName:"NodeSchema<doc>",group:"Doc"});function jS(r){return V2(r,e=>{var t;return e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes((t=e.value)==null?void 0:t.trim())},(e,t)=>{if(!t.length)return;const n=t[t.length-1];if(!n)return;const i=n.children.indexOf(e);i!==-1&&n.children.splice(i,1)},!0)}var da=er("remark-preserve-empty-line",()=>()=>jS);j(da.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});j(da.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var hp=Kr("paragraph");j(hp,{displayName:"Attr<paragraph>",group:"Paragraph"});var Or=Ve("paragraph",r=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",r.get(hp.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,t)=>{var i;const n=(i=r.get(Me).state)==null?void 0:i.doc.lastChild;e.openNode("paragraph"),(!t.content||t.content.size===0)&&t!==n&&VS(r)?e.addNode("html",void 0,"<br />"):w3(e,t),e.closeNode()}}}));function VS(r){let e=!1;try{r.get(da.id),e=!0}catch{e=!1}return e}j(Or.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});j(Or.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var fp=fe("TurnIntoText",r=>()=>gl(Or.type(r)));j(fp,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var pp=Qt("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:r=>{const e=r.get(oe);return()=>e.call(fp.key)}}});j(pp.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});j(pp.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var WS=Array(6).fill(0).map((r,e)=>e+1);function US(r){return r.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var Hn=Ne(US,"headingIdGenerator");j(Hn,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var mp=Kr("heading");j(mp,{displayName:"Attr<heading>",group:"Heading"});var Pt=Ve("heading",r=>{const e=r.get(Hn.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:WS.map(t=>({tag:`h${t}`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw dn(n);return{level:t,id:n.id}}})),toDOM:t=>[`h${t.attrs.level}`,{...r.get(mp.key)(t),id:t.attrs.id||e(t)},0],parseMarkdown:{match:({type:t})=>t==="heading",runner:(t,n,i)=>{const s=n.depth;t.openNode(i,{level:s}),t.next(n.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="heading",runner:(t,n)=>{t.openNode("heading",void 0,{depth:n.attrs.level}),w3(t,n),t.closeNode()}}}});j(Pt.node,{displayName:"NodeSchema<heading>",group:"Heading"});j(Pt.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var N3=wt(r=>ep(/^(?<hashes>#+)\s$/,Pt.type(r),e=>{var s,o;const t=((o=(s=e.groups)==null?void 0:s.hashes)==null?void 0:o.length)||0,{$from:n}=r.get(Me).state.selection,i=n.node();if(i.type.name==="heading"){let a=Number(i.attrs.level)+Number(t);return a>6&&(a=6),{level:a}}return{level:t}}));j(N3,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var oi=fe("WrapInHeading",r=>e=>(e??(e=1),e<1?gl(Or.type(r)):gl(Pt.type(r),{level:e})));j(oi,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var gp=fe("DowngradeHeading",r=>()=>(e,t,n)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==Pt.type(r)||!e.selection.empty||i.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(t==null||t(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):gl(Or.type(r))(e,t,n)});j(gp,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var yp=Qt("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:r=>{const e=r.get(oe);return()=>e.call(gp.key)}}});j(yp.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});j(yp.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var vp=Kr("blockquote");j(vp,{displayName:"Attr<blockquote>",group:"Blockquote"});var wa=Ve("blockquote",r=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",r.get(vp.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));j(wa.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});j(wa.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var E3=wt(r=>Qf(/^\s*>\s$/,wa.type(r)));j(E3,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var bp=fe("WrapInBlockquote",r=>()=>Zf(wa.type(r)));j(bp,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var wp=Qt("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:r=>{const e=r.get(oe);return()=>e.call(bp.key)}}});j(wp.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});j(wp.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var kp=Kr("codeBlock",()=>({pre:{},code:{}}));j(kp,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Vr=Ve("code_block",r=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{language:e.dataset.language}}}],toDOM:e=>{const t=r.get(kp.key)(e),n=e.attrs.language,i=n&&n.length>0?{"data-language":n}:void 0;return["pre",{...t.pre,...i},["code",t.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,t,n)=>{const i=t.lang??"",s=t.value;e.openNode(n,{language:i}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,t)=>{var n;e.addNode("code",void 0,((n=t.content.firstChild)==null?void 0:n.text)||"",{lang:t.attrs.language})}}}));j(Vr.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});j(Vr.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var D3=wt(r=>ep(/^```(?<language>[a-z]*)?[\s\n]$/,Vr.type(r),e=>{var t;return{language:((t=e.groups)==null?void 0:t.language)??""}}));j(D3,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var xp=fe("CreateCodeBlock",r=>(e="")=>gl(Vr.type(r),{language:e}));j(xp,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var KS=fe("UpdateCodeBlockLanguage",()=>({pos:r,language:e}={pos:-1,language:""})=>(t,n)=>r>=0?(n==null||n(t.tr.setNodeAttribute(r,"language",e)),!0):!1);j(KS,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var Sp=Qt("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:r=>{const e=r.get(oe);return()=>e.call(xp.key)}}});j(Sp.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});j(Sp.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var Cp=Kr("image");j(Cp,{displayName:"Attr<image>",group:"Image"});var _s=Ve("image",r=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...r.get(Cp.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,t,n)=>{const i=t.url,s=t.alt,o=t.title;e.addNode(n,{src:i,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));j(_s.node,{displayName:"NodeSchema<image>",group:"Image"});j(_s.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var O3=fe("InsertImage",r=>(e={})=>(t,n)=>{if(!n)return!0;const{src:i="",alt:s="",title:o=""}=e,a=_s.type(r).create({src:i,alt:s,title:o});return a&&n(t.tr.replaceSelectionWith(a).scrollIntoView()),!0});j(O3,{displayName:"Command<insertImageCommand>",group:"Image"});var R3=fe("UpdateImage",r=>(e={})=>(t,n)=>{const i=c9(t.selection,_s.type(r));if(!i)return!1;const{node:s,pos:o}=i,a={...s.attrs},{src:l,alt:c,title:u}=e;return l!==void 0&&(a.src=l),c!==void 0&&(a.alt=c),u!==void 0&&(a.title=u),n==null||n(t.tr.setNodeMarkup(o,void 0,a).scrollIntoView()),!0});j(R3,{displayName:"Command<updateImageCommand>",group:"Image"});var GS=wt(r=>new _t(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,t,n,i)=>{const[s,o,a="",l]=t;return s?e.tr.replaceWith(n,i,_s.type(r).create({src:a,alt:o,title:l})):null}));j(GS,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var q0=Kr("hardbreak",r=>({"data-type":"hardbreak","data-is-inline":r.attrs.isInline}));j(q0,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var As=Ve("hardbreak",r=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",r.get(q0.key)(e)," "]:["br",r.get(q0.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,t,n)=>{var i;e.addNode(n,{isInline:!!((i=t.data)!=null&&i.isInline)})}},leafText:()=>`
32
+ `,r,e):!1}}});return e}function H5(r){return r.some(e=>e.type.spec.code)}function Ag(r,e,t){if(e>=t)return!1;let n=!1;return r.doc.nodesBetween(e,t,i=>(i.isInline&&H5(i.marks)&&(n=!0),!n)),n}function Jx(r,e){var t;return H5((t=r.storedMarks)!=null?t:r.doc.resolve(e).marks())}function Tc(r,e,t={}){return new _t(r,(n,i,s,o)=>{var a,l,c,u;const{tr:d}=n,h=i.length;let f=i[h-1],m=i[0],y=[],b;const v={group:f,fullMatch:m,start:s,end:o},k=(a=t.updateCaptured)==null?void 0:a.call(t,v);if(Object.assign(v,k),{group:f,fullMatch:m,start:s,end:o}=v,m===null||(f==null?void 0:f.trim())==="")return null;if(f){const M=m.search(/\S/),D=s+m.indexOf(f),O=D+f.length,z=Ag(n,s+M,D),T=O<o&&Ag(n,O,o);if(z||T||Jx(n,o))return null;y=(l=d.storedMarks)!=null?l:[],O<o&&d.delete(O,o),D>s&&d.delete(s+M,D),b=s+M+f.length;const B=(c=t.getAttr)==null?void 0:c.call(t,i);d.addMark(s,b,e.create(B)),d.setStoredMarks(y),(u=t.beforeDispatch)==null||u.call(t,{match:i,start:s,end:o,tr:d})}return d})}function Yx(r,e,t={}){return new _t(r,(n,i,s,o)=>{var a,l,c;const{tr:u}=n;let d=i[1],h=i[0];const f={group:d,fullMatch:h,start:s,end:o},m=(a=t.updateCaptured)==null?void 0:a.call(t,f);if(Object.assign(f,m),{group:d,fullMatch:h,start:s,end:o}=f,h===null||!d||d.trim()==="")return null;const y=(l=t.getAttr)==null?void 0:l.call(t,i),b=e.createAndFill(y);return b&&(u.replaceRangeWith(e.isBlock?u.doc.resolve(s).before():s,o,b),(c=t.beforeDispatch)==null||c.call(t,{match:[h,d],start:s,end:o,tr:u})),u})}var Xx=Object.defineProperty,Zx=Object.defineProperties,Qx=Object.getOwnPropertyDescriptors,Ng=Object.getOwnPropertySymbols,e9=Object.prototype.hasOwnProperty,t9=Object.prototype.propertyIsEnumerable,Eg=(r,e,t)=>e in r?Xx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,r9=(r,e)=>{for(var t in e||(e={}))e9.call(e,t)&&Eg(r,t,e[t]);if(Ng)for(var t of Ng(e))t9.call(e,t)&&Eg(r,t,e[t]);return r},n9=(r,e)=>Zx(r,Qx(e));function Dg(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function pu(r,e,t){const i=r.state.doc.content.size,s=Dg(e,0,i),o=Dg(t,0,i),a=r.coordsAtPos(s),l=r.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,m=u-c,v={top:c,bottom:u,left:d,right:h,width:f,height:m,x:d,y:c};return n9(r9({},v),{toJSON:()=>v})}function _5(r){return Object.assign(Object.create(r),r).setTime(Date.now())}function i9(r,e){return Array.isArray(r)&&r.includes(e.type)||e.type===r}function s9(r){if(r.content.childCount===1){const e=r.content.firstChild;if((e==null?void 0:e.type.name)==="text"&&e.marks.length===0)return e;if((e==null?void 0:e.type.name)==="paragraph"&&e.childCount===1){const t=e.firstChild;if((t==null?void 0:t.type.name)==="text"&&t.marks.length===0)return t}}return!1}function ln(r){return e=>{for(let t=e.depth;t>0;t-=1){const n=e.node(t);if(r(n)){const i=e.before(t),s=e.after(t);return{from:i,to:s,node:n}}}}}function o9(r,e){return ln(t=>t.type===e)(r)}function a9(r,e){const t=e.nodes[r];if(!t)throw px("node",r);return t}function j5(r){return e=>{for(let t=e.depth;t>0;t--){const n=e.node(t);if(r(n))return{pos:e.before(t),start:e.start(t),depth:t,node:n}}}}function l9(r){return e=>j5(r)(e.$from)}function c9(r,e){if(!(r instanceof ae))return;const{node:t,$from:n}=r;if(i9(e,t))return{node:t,pos:n.pos,start:n.start(n.depth),depth:n.depth}}const V5=(r,e)=>{const{selection:t,doc:n}=r;if(t instanceof ae)return{hasNode:t.node.type===e,pos:t.from,target:t.node};const{from:i,to:s}=t;let o=!1,a=-1,l=null;return n.nodesBetween(i,s,(c,u)=>l?!1:c.type===e?(o=!0,a=u,l=c,!1):!0),{hasNode:o,pos:a,target:l}},u9=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),d9=typeof navigator<"u"&&/Win/.test(navigator.platform);function h9(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))u9?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function f9(r){let e=Object.create(null);for(let t in r)e[h9(t)]=r[t];return e}function vd(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function W5(r){return new Ae({props:{handleKeyDown:tp(r)}})}function tp(r){let e=f9(r);return function(t,n){let i=K7(n),s,o=e[vd(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[vd(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(d9&&n.ctrlKey&&n.altKey)&&(s=G7[n.keyCode])&&s!=i){let a=e[vd(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var U5=class{},K5=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=r=>{var e;(e=this.top())==null||e.push(r)},this.open=r=>{this.elements.push(r)},this.close=()=>{const r=this.elements.pop();if(!r)throw S5();return r}}},p9=class G5 extends U5{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new G5(e,t,n)}},Pr,Ro,Pl,Fl,$l,Io,zo,Es,J5=(Es=class extends K5{constructor(t){super();_(this,Pr);_(this,Ro);_(this,Pl);_(this,Fl);_(this,$l);_(this,Io);_(this,zo);F(this,Pr,ke.none),F(this,Ro,n=>n.isText),F(this,Pl,(n,i)=>{if(C(this,Ro).call(this,n)&&C(this,Ro).call(this,i)&&ke.sameSet(n.marks,i.marks))return this.schema.text(n.text+i.text,n.marks)}),F(this,Fl,n=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(s=>s.spec.parseMarkdown.match(n));if(!i)throw hx(n);return i}),F(this,$l,n=>{const i=C(this,Fl).call(this,n);i.spec.parseMarkdown.runner(this,n,i)}),this.injectRoot=(n,i,s)=>(this.openNode(i,s),this.next(n.children),this),this.openNode=(n,i)=>(this.open(p9.create(n,[],i)),this),F(this,Io,()=>{F(this,Pr,ke.none);const n=this.close();return C(this,zo).call(this,n.type,n.attrs,n.content)}),this.closeNode=()=>{try{C(this,Io).call(this)}catch(n){console.error(n)}return this},F(this,zo,(n,i,s)=>{const o=n.createAndFill(i,s,C(this,Pr));if(!o)throw dx(n,i,s);return this.push(o),o}),this.addNode=(n,i,s)=>{try{C(this,zo).call(this,n,i,s)}catch(o){console.error(o)}return this},this.openMark=(n,i)=>{const s=n.create(i);return F(this,Pr,s.addToSet(C(this,Pr))),this},this.closeMark=n=>(F(this,Pr,n.removeFromSet(C(this,Pr))),this),this.addText=n=>{try{const i=this.top();if(!i)throw S5();const s=i.pop(),o=this.schema.text(n,C(this,Pr));if(!s)return i.push(o),this;const a=C(this,Pl).call(this,s,o);return a?(i.push(a),this):(i.push(s,o),this)}catch(i){return console.error(i),this}},this.build=()=>{let n;do n=C(this,Io).call(this);while(this.size());return n},this.next=(n=[])=>([n].flat().forEach(i=>C(this,$l).call(this,i)),this),this.toDoc=()=>this.build(),this.run=(n,i)=>{const s=n.runSync(n.parse(i),i);return this.next(s),this},this.schema=t}},Pr=new WeakMap,Ro=new WeakMap,Pl=new WeakMap,Fl=new WeakMap,$l=new WeakMap,Io=new WeakMap,zo=new WeakMap,Es.create=(t,n)=>{const i=new Es(t);return s=>(i.run(n,s),i.toDoc())},Es),Ds,Og=(Ds=class extends U5{constructor(e,t,n,i={}){super(),this.type=e,this.children=t,this.value=n,this.props=i,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>{var s;return(s=this.children)==null?void 0:s.pop()}}},Ds.create=(e,t,n,i={})=>new Ds(e,t,n,i),Ds),m9=r=>Object.prototype.hasOwnProperty.call(r,"size"),Lt,Lo,ql,Hl,_l,jl,Bo,Po,Vl,Wl,cs,hi,Ul,Fo,Os,g9=(Os=class extends K5{constructor(t){super();_(this,Lt);_(this,Lo);_(this,ql);_(this,Hl);_(this,_l);_(this,jl);_(this,Bo);_(this,Po);_(this,Vl);_(this,Wl);_(this,cs);_(this,hi);_(this,Ul);_(this,Fo);F(this,Lt,[]),F(this,Lo,n=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(s=>s.spec.toMarkdown.match(n));if(!i)throw fx(n.type);return i}),F(this,ql,n=>C(this,Lo).call(this,n).spec.toMarkdown.runner(this,n)),F(this,Hl,(n,i)=>C(this,Lo).call(this,n).spec.toMarkdown.runner(this,n,i)),F(this,_l,n=>{const i=a=>a.type.spec.priority??50,s=[...n].sort((a,l)=>i(a)-i(l)),o=[];return C(this,Lt).forEach(({mark:a})=>{const l=s.findIndex(c=>c.eq(a));l>=0&&o.push(...s.splice(l,1))}),o.concat(s)}),F(this,jl,n=>{const i=n==null?void 0:n.marks;let s=0;for(;s<C(this,Lt).length;){const{mark:o,spanning:a}=C(this,Lt)[s];if(a&&(i!=null&&i.some(l=>l.eq(o))))s++;else break}for(let o=C(this,Lt).length-1;o>=s;o--)C(this,Fo).call(this,C(this,Lt)[o].mark)}),F(this,Bo,(n,i)=>{C(this,_l).call(this,n.marks).every(s=>!C(this,Hl).call(this,s,n))&&C(this,ql).call(this,n),C(this,jl).call(this,i)}),F(this,Po,n=>{const{children:i}=n;return i&&(n.children=i.reduce((s,o,a)=>{if(a===0)return[o];const l=s.at(-1);if(l&&l.isMark&&o.isMark){const{children:c,...u}=o,{children:d,...h}=l;if(o.type===l.type&&c&&d&&JSON.stringify(u)===JSON.stringify(h)){const f={...h,children:[...d,...c]};return s.slice(0,-1).concat(C(this,Po).call(this,f))}}return s.concat(o)},[])),n}),F(this,Vl,n=>{const i={...n.props,type:n.type};return n.children&&(i.children=n.children),n.value&&(i.value=n.value),i}),this.openNode=(n,i,s)=>(this.open(Og.create(n,void 0,i,s)),this),F(this,Wl,(n,i)=>{let s="",o="";const a=n.children;if(a){const c=a[0],u=a.at(-1);if(u&&u.type==="text"&&u.value.endsWith(" ")){const d=u.value,h=d.trimEnd();o=d.slice(h.length),u.value=h}if(c&&c.type==="text"&&c.value.startsWith(" ")){const d=c.value,h=d.trimStart();s=d.slice(0,d.length-h.length),c.value=h}}s.length&&C(this,hi).call(this,"text",void 0,s);const l=i();return o.length&&C(this,hi).call(this,"text",void 0,o),l}),F(this,cs,(n=!1)=>{const i=this.close(),s=()=>C(this,hi).call(this,i.type,i.children,i.value,i.props);return n?C(this,Wl).call(this,i,s):s()}),this.closeNode=()=>(C(this,cs).call(this),this),F(this,hi,(n,i,s,o)=>{const a=Og.create(n,i,s,o),l=C(this,Po).call(this,C(this,Vl).call(this,a));return this.push(l),l}),this.addNode=(n,i,s,o)=>(C(this,hi).call(this,n,i,s,o),this),F(this,Ul,(n,i,s,o)=>C(this,Lt).some(a=>a.mark.eq(n))?this:(C(this,Lt).push({mark:n,spanning:s==null}),this.openNode(i,s,{...o,isMark:!0}))),F(this,Fo,n=>{let i=-1;for(let s=C(this,Lt).length-1;s>=0;s--)if(C(this,Lt)[s].mark.eq(n)){i=s;break}i<0||(C(this,Lt).splice(i,1),C(this,cs).call(this,!0))}),this.withMark=(n,i,s,o)=>(C(this,Ul).call(this,n,i,s,o),this),this.closeMark=n=>(C(this,Fo).call(this,n),this),this.build=()=>{let n=null;do n=C(this,cs).call(this);while(this.size());return n},this.next=n=>m9(n)?(n.forEach((i,s,o)=>{C(this,Bo).call(this,i,n.maybeChild(o+1)??void 0)}),this):(C(this,Bo).call(this,n),this),this.toString=n=>n.stringify(this.build()),this.run=n=>(F(this,Lt,[]),this.next(n),this),this.schema=t}},Lt=new WeakMap,Lo=new WeakMap,ql=new WeakMap,Hl=new WeakMap,_l=new WeakMap,jl=new WeakMap,Bo=new WeakMap,Po=new WeakMap,Vl=new WeakMap,Wl=new WeakMap,cs=new WeakMap,hi=new WeakMap,Ul=new WeakMap,Fo=new WeakMap,Os.create=(t,n)=>{const i=new Os(t);return s=>(i.run(s),i.toString(n))},Os);function Vn(r,e){return r.meta={package:"@milkdown/core",group:"System",...e},r}var Y5={text:(r,e,t,n)=>{const i=r.value;return/^[^*_\\]*\s+$/.test(i)?i:t.safe(i,{...n,encode:[]})},strong:(r,e,t,n)=>{const i=r.marker||t.options.strong||"*",s=t.enter("strong"),o=t.createTracker(n);let a=o.move(i+i);return a+=o.move(t.containerPhrasing(r,{before:a,after:i,...o.current()})),a+=o.move(i+i),s(),a},emphasis:(r,e,t,n)=>{const i=r.marker||t.options.emphasis||"*",s=t.enter("emphasis"),o=t.createTracker(n);let a=o.move(i);return a+=o.move(t.containerPhrasing(r,{before:a,after:i,...o.current()})),a+=o.move(i),s(),a}},Me=Se({},"editorView"),_a=Se({},"editorState"),bd=Se([],"initTimer"),_h=Se({},"editor"),yl=Se([],"inputRules"),ur=Se([],"prosePlugins"),vl=Se([],"remarkPlugins"),bl=Se([],"nodeView"),wl=Se([],"markView"),Si=Se(yh().use(vh).use(Fh),"remark"),Za=Se({handlers:Y5,encode:[]},"remarkStringifyOptions"),y0=Ur("ConfigReady");function y9(r){const e=t=>(t.record(y0),async()=>(await r(t),t.done(y0),()=>{t.clearTimer(y0)}));return Vn(e,{displayName:"Config"}),e}var Ms=Ur("InitReady");function v9(r){const e=t=>(t.inject(_h,r).inject(ur,[]).inject(vl,[]).inject(yl,[]).inject(bl,[]).inject(wl,[]).inject(Za,{handlers:Y5,encode:[]}).inject(Si,yh().use(vh).use(Fh)).inject(bd,[y0]).record(Ms),async()=>{await t.waitTimers(bd);const n=t.get(Za);return t.set(Si,yh().use(vh).use(Fh,n)),t.done(Ms),()=>{t.remove(_h).remove(ur).remove(vl).remove(yl).remove(bl).remove(wl).remove(Za).remove(Si).remove(bd).clearTimer(Ms)}});return Vn(e,{displayName:"Init"}),e}var bt=Ur("SchemaReady"),wd=Se([],"schemaTimer"),Zt=Se({},"schema"),Ci=Se([],"nodes"),Qa=Se([],"marks");function Rg(r){var e;return{...r,parseDOM:(e=r.parseDOM)==null?void 0:e.map(t=>({priority:r.priority,...t}))}}var X5=r=>(r.inject(Zt,{}).inject(Ci,[]).inject(Qa,[]).inject(wd,[Ms]).record(bt),async()=>{await r.waitTimers(wd);const e=r.get(Si),t=r.get(vl).reduce((o,a)=>o.use(a.plugin,a.options),e);r.set(Si,t);const n=Object.fromEntries(r.get(Ci).map(([o,a])=>[o,Rg(a)])),i=Object.fromEntries(r.get(Qa).map(([o,a])=>[o,Rg(a)])),s=new x8({nodes:n,marks:i});return r.set(Zt,s),r.done(bt),()=>{r.remove(Zt).remove(Ci).remove(Qa).remove(wd).clearTimer(bt)}});Vn(X5,{displayName:"Schema"});var us,xr,B2,Z5=(B2=class{constructor(){_(this,us);_(this,xr);F(this,us,new M5),F(this,xr,null),this.setCtx=r=>{F(this,xr,r)},this.chain=()=>{if(C(this,xr)==null)throw md();const r=C(this,xr),e=[],t=this.get.bind(this),n={run:()=>{const s=ga(...e),o=r.get(Me);return s(o.state,o.dispatch,o)},inline:s=>(e.push(s),n),pipe:i.bind(this)};function i(s,o){const a=t(s);return e.push(a(o)),n}return n}}get ctx(){return C(this,xr)}create(r,e){const t=r.create(C(this,us).sliceMap);return t.set(e),t}get(r){return C(this,us).get(r).get()}remove(r){return C(this,us).remove(r)}call(r,e){if(C(this,xr)==null)throw md();const t=this.get(r)(e),n=C(this,xr).get(Me);return t(n.state,n.dispatch,n)}inline(r){if(C(this,xr)==null)throw md();const e=C(this,xr).get(Me);return r(e.state,e.dispatch,e)}},us=new WeakMap,xr=new WeakMap,B2);function b9(r="cmdKey"){return Se((()=>()=>!1),r)}var oe=Se(new Z5,"commands"),kd=Se([bt],"commandsTimer"),el=Ur("CommandsReady"),Q5=r=>{const e=new Z5;return e.setCtx(r),r.inject(oe,e).inject(kd,[bt]).record(el),async()=>(await r.waitTimers(kd),r.done(el),()=>{r.remove(oe).remove(kd).clearTimer(el)})};Vn(Q5,{displayName:"Commands"});function w9(r){return r.Backspace=ga(Hx,Jf,Sx,N5),r}var ds,Wt,P2,e3=(P2=class{constructor(){_(this,ds);_(this,Wt);F(this,ds,null),F(this,Wt,[]),this.setCtx=r=>{F(this,ds,r)},this.add=r=>(C(this,Wt).push(r),()=>{F(this,Wt,C(this,Wt).filter(e=>e!==r))}),this.addObjectKeymap=r=>{const e=[];return Object.entries(r).forEach(([t,n])=>{if(typeof n=="function"){const i={key:t,onRun:()=>n};C(this,Wt).push(i),e.push(()=>{F(this,Wt,C(this,Wt).filter(s=>s!==i))})}else C(this,Wt).push(n),e.push(()=>{F(this,Wt,C(this,Wt).filter(i=>i!==n))})}),()=>{e.forEach(t=>t())}},this.addBaseKeymap=()=>{const r=w9($x);return this.addObjectKeymap(r)},this.build=()=>{const r={};return C(this,Wt).forEach(e=>{r[e.key]=[...r[e.key]||[],e]}),Object.fromEntries(Object.entries(r).map(([e,t])=>{const n=t.sort((s,o)=>(o.priority??50)-(s.priority??50));return[e,(s,o,a)=>{const l=C(this,ds);if(l==null)throw du();const c=n.map(u=>u.onRun(l));return ga(...c)(s,o,a)}]}))}}get ctx(){return C(this,ds)}},ds=new WeakMap,Wt=new WeakMap,P2),$0=Se(new e3,"keymap"),xd=Se([bt],"keymapTimer"),tl=Ur("KeymapReady"),k9=r=>{const e=new e3;return e.setCtx(r),r.inject($0,e).inject(xd,[bt]).record(tl),async()=>(await r.waitTimers(xd),r.done(tl),()=>{r.remove($0).remove(xd).clearTimer(tl)})},rl=Ur("ParserReady"),t3=(()=>{throw du()}),Ts=Se(t3,"parser"),Sd=Se([],"parserTimer"),r3=r=>(r.inject(Ts,t3).inject(Sd,[bt]).record(rl),async()=>{await r.waitTimers(Sd);const e=r.get(Si),t=r.get(Zt);return r.set(Ts,J5.create(t,e)),r.done(rl),()=>{r.remove(Ts).remove(Sd).clearTimer(rl)}});Vn(r3,{displayName:"Parser"});var nl=Ur("SerializerReady"),Cd=Se([],"serializerTimer"),n3=(()=>{throw du()}),bo=Se(n3,"serializer"),i3=r=>(r.inject(bo,n3).inject(Cd,[bt]).record(nl),async()=>{await r.waitTimers(Cd);const e=r.get(Si),t=r.get(Zt);return r.set(bo,g9.create(t,e)),r.done(nl),()=>{r.remove(bo).remove(Cd).clearTimer(nl)}});Vn(i3,{displayName:"Serializer"});var v0=Se("","defaultValue"),Md=Se(r=>r,"stateOptions"),b0=Se([],"editorStateTimer"),w0=Ur("EditorStateReady");function x9(r,e,t){if(typeof r=="string")return e(r);if(r.type==="html")return Is.fromSchema(t).parse(r.dom);if(r.type==="json")return $n.fromJSON(t,r.value);throw lx(r)}var S9=new De("MILKDOWN_STATE_TRACKER"),s3=r=>(r.inject(v0,"").inject(_a,{}).inject(Md,e=>e).inject(b0,[rl,nl,el,tl]).record(w0),async()=>{await r.waitTimers(b0);const e=r.get(Zt),t=r.get(Ts),n=r.get(yl),i=r.get(Md),s=r.get(ur),o=x9(r.get(v0),t,e),a=r.get($0),l=a.addBaseKeymap(),c=[...s,new Ae({key:S9,state:{init:()=>{},apply:(h,f,m,y)=>{r.set(_a,y)}}}),Gx({rules:n}),W5(a.build())];r.set(ur,c);const u=i({schema:e,doc:o,plugins:c}),d=mo.create(u);return r.set(_a,d),r.done(w0),()=>{l(),r.remove(v0).remove(_a).remove(Md).remove(b0).clearTimer(w0)}});Vn(s3,{displayName:"EditorState"});var kl=Se([],"pasteRule"),Td=Se([bt],"pasteRuleTimer"),k0=Ur("PasteRuleReady"),o3=r=>(r.inject(kl,[]).inject(Td,[bt]).record(k0),async()=>(await r.waitTimers(Td),r.done(k0),()=>{r.remove(kl).remove(Td).clearTimer(k0)}));Vn(o3,{displayName:"PasteRule"});var x0=Ur("EditorViewReady"),Ad=Se([],"editorViewTimer"),il=Se({},"editorViewOptions"),S0=Se(null,"root"),jh=Se(null,"rootDOM"),Vh=Se({},"rootAttrs");function C9(r,e){const t=document.createElement("div");t.className="milkdown",r.appendChild(t),e.set(jh,t);const n=e.get(Vh);return Object.entries(n).forEach(([i,s])=>t.setAttribute(i,s)),t}function M9(r){r.classList.add("editor"),r.setAttribute("role","textbox")}var T9=new De("MILKDOWN_VIEW_CLEAR"),a3=r=>(r.inject(S0,document.body).inject(Me,{}).inject(il,{}).inject(jh,null).inject(Vh,{}).inject(Ad,[w0,k0]).record(x0),async()=>{await r.wait(Ms);const e=r.get(S0)||document.body,t=typeof e=="string"?document.querySelector(e):e;r.update(ur,l=>[new Ae({key:T9,view:c=>{const u=t?C9(t,r):void 0;return(()=>{if(u&&t){const h=c.dom;t.replaceChild(u,h),u.appendChild(h)}})(),{destroy:()=>{u!=null&&u.parentNode&&(u==null||u.parentNode.replaceChild(c.dom,u)),u==null||u.remove()}}}}),...l]),await r.waitTimers(Ad);const n=r.get(_a),i=r.get(il),s=Object.fromEntries(r.get(bl)),o=Object.fromEntries(r.get(wl)),a=new y5(t,{state:n,nodeViews:s,markViews:o,transformPasted:(l,c,u)=>(r.get(kl).sort((d,h)=>(h.priority??50)-(d.priority??50)).map(d=>d.run).forEach(d=>{l=d(l,c,u)}),l),...i});return M9(a.dom),r.set(Me,a),r.done(x0),()=>{a==null||a.destroy(),r.remove(S0).remove(Me).remove(il).remove(jh).remove(Vh).remove(Ad).clearTimer(x0)}});Vn(a3,{displayName:"EditorView"});var A9=(function(r){return r.Idle="Idle",r.OnCreate="OnCreate",r.Created="Created",r.OnDestroy="OnDestroy",r.Destroyed="Destroyed",r})({}),hs,ar,En,$o,Kl,Gl,Ut,Dn,fs,Jl,ps,qo,Yl,fi,Ho,_o,N9=(_o=class{constructor(){_(this,hs);_(this,ar);_(this,En);_(this,$o);_(this,Kl);_(this,Gl);_(this,Ut);_(this,Dn);_(this,fs);_(this,Jl);_(this,ps);_(this,qo);_(this,Yl);_(this,fi);_(this,Ho);F(this,hs,!1),F(this,ar,"Idle"),F(this,En,[]),F(this,$o,()=>{}),F(this,Kl,new M5),F(this,Gl,new wx),F(this,Ut,new Map),F(this,Dn,new Map),F(this,fs,new bx(C(this,Kl),C(this,Gl))),F(this,Jl,()=>{const e=y9(async n=>{await Promise.all(C(this,En).map(i=>Promise.resolve(i(n))))}),t=[X5,r3,i3,Q5,k9,o3,s3,a3,v9(this),e];C(this,ps).call(this,t,C(this,Dn))}),F(this,ps,(e,t)=>{e.forEach(n=>{const i=C(this,fs).produce(C(this,hs)?n.meta:void 0),s=n(i);t.set(n,{ctx:i,handler:s,cleanup:void 0})})}),F(this,qo,(e,t=!1)=>Promise.all([e].flat().map(async n=>{var s;const i=(s=C(this,Ut).get(n))==null?void 0:s.cleanup;return t?C(this,Ut).delete(n):C(this,Ut).set(n,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i}))),F(this,Yl,async()=>{await Promise.all([...C(this,Dn).entries()].map(async([e,{cleanup:t}])=>typeof t=="function"?t():t)),C(this,Dn).clear()}),F(this,fi,e=>{F(this,ar,e),C(this,$o).call(this,e)}),F(this,Ho,e=>[...e.entries()].map(async([t,n])=>{const{ctx:i,handler:s}=n;if(!s)return;const o=await s();e.set(t,{ctx:i,handler:s,cleanup:o})})),this.enableInspector=(e=!0)=>(F(this,hs,e),this),this.onStatusChange=e=>(F(this,$o,e),this),this.config=e=>(C(this,En).push(e),this),this.removeConfig=e=>(F(this,En,C(this,En).filter(t=>t!==e)),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(n=>{C(this,Ut).set(n,{ctx:void 0,handler:void 0,cleanup:void 0})}),C(this,ar)==="Created"&&C(this,ps).call(this,t,C(this,Ut)),this},this.remove=async e=>C(this,ar)==="OnCreate"?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await C(this,qo).call(this,[e].flat(),!0),this),this.create=async()=>C(this,ar)==="OnCreate"?this:(C(this,ar)==="Created"&&await this.destroy(),C(this,fi).call(this,"OnCreate"),C(this,Jl).call(this),C(this,ps).call(this,[...C(this,Ut).keys()],C(this,Ut)),await Promise.all([C(this,Ho).call(this,C(this,Dn)),C(this,Ho).call(this,C(this,Ut))].flat()),C(this,fi).call(this,"Created"),this),this.destroy=async(e=!1)=>C(this,ar)==="Destroyed"||C(this,ar)==="OnDestroy"?this:C(this,ar)==="OnCreate"?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&F(this,En,[]),C(this,fi).call(this,"OnDestroy"),await C(this,qo).call(this,[...C(this,Ut).keys()],e),await C(this,Yl).call(this),C(this,fi).call(this,"Destroyed"),this),this.action=e=>e(C(this,fs)),this.inspect=()=>C(this,hs)?[...C(this,Dn).values(),...C(this,Ut).values()].map(({ctx:e})=>{var t;return(t=e==null?void 0:e.inspector)==null?void 0:t.read()}).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new _o}get ctx(){return C(this,fs)}get status(){return C(this,ar)}},hs=new WeakMap,ar=new WeakMap,En=new WeakMap,$o=new WeakMap,Kl=new WeakMap,Gl=new WeakMap,Ut=new WeakMap,Dn=new WeakMap,fs=new WeakMap,Jl=new WeakMap,ps=new WeakMap,qo=new WeakMap,Yl=new WeakMap,fi=new WeakMap,Ho=new WeakMap,_o);function l3(r,e,t){const n=r.findIndex(([s])=>s===e);if(n===-1)return[...r,t];const i=r.slice();return i[n]=t,i}function fe(r,e){const t=b9(r),n=i=>async()=>{n.key=t,await i.wait(el);const s=e(i);return i.get(oe).create(t,s),n.run=o=>i.get(oe).call(r,o),()=>{i.get(oe).remove(t)}};return n}function wt(r){const e=t=>async()=>{await t.wait(bt);const n=r(t);return t.update(yl,i=>[...i,n]),e.inputRule=n,()=>{t.update(yl,i=>i.filter(s=>s!==n))}};return e}function E9(r){const e=t=>async()=>{await t.wait(bt);const n=r(t);return t.update(kl,i=>[...i,n]),e.pasteRule=n,()=>{t.update(kl,i=>i.filter(s=>s!==n))}};return e}function D9(r,e){const t=n=>async()=>{const i=e(n);return n.update(Qa,s=>l3(s,r,[r,i])),t.id=r,t.schema=i,()=>{n.update(Qa,s=>s.filter(([o])=>o!==r))}};return t.type=n=>{const i=n.get(Zt).marks[r];if(!i)throw mx(r);return i},t}function rp(r,e){const t=n=>async()=>{const i=e(n);return n.update(Ci,s=>l3(s,r,[r,i])),t.id=r,t.schema=i,()=>{n.update(Ci,s=>s.filter(([o])=>o!==r))}};return t.type=n=>{const i=n.get(Zt).nodes[r];if(!i)throw C5(r);return i},t}function qe(r){let e;const t=n=>async()=>(await n.wait(bt),e=r(n),n.update(ur,i=>[...i,e]),()=>{n.update(ur,i=>i.filter(s=>s!==e))});return t.plugin=()=>e,t.key=()=>e.spec.key,t}function c3(r){const e=t=>async()=>{await t.wait(tl);const n=t.get($0),i=r(t),s=n.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function Ai(r,e){const t=n=>async()=>{await n.wait(bt);const i=e(n);return r.type(n)instanceof I0?n.update(bl,s=>[...s,[r.id,i]]):n.update(wl,s=>[...s,[r.id,i]]),t.view=i,t.type=r,()=>{r.type(n)instanceof I0?n.update(bl,s=>s.filter(o=>o[0]!==r.id)):n.update(wl,s=>s.filter(o=>o[0]!==r.id))}};return t}function Ne(r,e){const t=Se(r,e),n=i=>(i.inject(t),()=>()=>{i.remove(t)});return n.key=t,n}function Ve(r,e){const t=Ne(e,r),n=rp(r,s=>s.get(t.key)(s)),i=[t,n];return i.id=n.id,i.node=n,i.type=s=>n.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>Ve(r,s(e)),i}function ya(r,e){const t=Ne(e,r),n=D9(r,s=>s.get(t.key)(s)),i=[t,n];return i.id=n.id,i.mark=n,i.type=s=>n.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>ya(r,s(e)),i}function Qt(r,e){const t=Ne(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:o,priority:a}])=>[s,{shortcuts:o,priority:a}])),`${r}Keymap`),n=c3(s=>{const o=s.get(t.key),a=Object.entries(e).flatMap(([l,{command:c}])=>{const u=o[l],d=[u.shortcuts].flat(),h=u.priority;return d.map(f=>[f,{key:f,onRun:c,priority:h}])});return Object.fromEntries(a)}),i=[t,n];return i.ctx=t,i.shortcuts=n,i.key=t.key,i.keymap=n.keymap,i}var Kr=(r,e=()=>({}))=>Ne(e,`${r}Attr`),Ac=(r,e=()=>({}))=>Ne(e,`${r}Attr`);function er(r,e,t){const n=Ne(t??{},r),i=o=>async()=>{await o.wait(Ms);const a={plugin:e(o),options:o.get(n.key)};return o.update(vl,l=>[...l,a]),()=>{o.update(vl,l=>l.filter(c=>c!==a))}},s=[n,i];return s.id=r,s.plugin=i,s.options=n,s}let Wh,Uh;if(typeof WeakMap<"u"){let r=new WeakMap;Wh=e=>r.get(e),Uh=(e,t)=>(r.set(e,t),t)}else{const r=[];let t=0;Wh=n=>{for(let i=0;i<r.length;i+=2)if(r[i]==n)return r[i+1]},Uh=(n,i)=>(t==10&&(t=0),r[t++]=n,r[t++]=i)}var Be=class{constructor(r,e,t,n){this.width=r,this.height=e,this.map=t,this.problems=n}findCell(r){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=r)continue;const n=e%this.width,i=e/this.width|0;let s=n+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==t;a++)o++;return{left:n,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${r} found`)}colCount(r){for(let e=0;e<this.map.length;e++)if(this.map[e]==r)return e%this.width;throw new RangeError(`No cell with offset ${r} found`)}nextCell(r,e,t){const{left:n,right:i,top:s,bottom:o}=this.findCell(r);return e=="horiz"?(t<0?n==0:i==this.width)?null:this.map[s*this.width+(t<0?n-1:i)]:(t<0?s==0:o==this.height)?null:this.map[n+this.width*(t<0?s-1:o)]}rectBetween(r,e){const{left:t,right:n,top:i,bottom:s}=this.findCell(r),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,l),right:Math.max(n,a),bottom:Math.max(s,c)}}cellsInRect(r){const e=[],t={};for(let n=r.top;n<r.bottom;n++)for(let i=r.left;i<r.right;i++){const s=n*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==r.left&&i&&this.map[s-1]==o||n==r.top&&n&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(r,e,t){for(let n=0,i=0;;n++){const s=i+t.child(n).nodeSize;if(n==r){let o=e+r*this.width;const a=(r+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(r){return Wh(r)||Uh(r,O9(r))}};function O9(r){if(r.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+r.type.name);const e=R9(r),t=r.childCount,n=[];let i=0,s=null;const o=[];for(let c=0,u=e*t;c<u;c++)n[c]=0;for(let c=0,u=0;c<t;c++){const d=r.child(c);u++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==d.childCount)break;const y=d.child(m),{colspan:b,rowspan:v,colwidth:k}=y.attrs;for(let M=0;M<v;M++){if(M+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:v-M});break}const D=i+M*e;for(let O=0;O<b;O++){n[D+O]==0?n[D+O]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:b-O});const z=k&&k[O];if(z){const T=(D+O)%e*2,B=o[T];B==null||B!=z&&o[T+1]==1?(o[T]=z,o[T+1]=1):B==z&&o[T+1]++}}}i+=b,u+=y.nodeSize}const h=(c+1)*e;let f=0;for(;i<h;)n[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Be(e,t,n,s);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&I9(a,o,r),a}function R9(r){let e=-1,t=!1;for(let n=0;n<r.childCount;n++){const i=r.child(n);let s=0;if(t)for(let o=0;o<n;o++){const a=r.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>n&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function I9(r,e,t){r.problems||(r.problems=[]);const n={};for(let i=0;i<r.map.length;i++){const s=r.map[i];if(n[s])continue;n[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=e[(i+c)%r.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=z9(l)))[c]=u)}a&&r.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function z9(r){if(r.colwidth)return r.colwidth.slice();const e=[];for(let t=0;t<r.colspan;t++)e.push(0);return e}function Ig(r,e){if(typeof r=="string")return{};const t=r.getAttribute("data-colwidth"),n=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(o=>Number(o)):null,i=Number(r.getAttribute("colspan")||1),s={colspan:i,rowspan:Number(r.getAttribute("rowspan")||1),colwidth:n&&n.length==i?n:null};for(const o in e){const a=e[o].getFromDOM,l=a&&a(r);l!=null&&(s[o]=l)}return s}function zg(r,e){const t={};r.attrs.colspan!=1&&(t.colspan=r.attrs.colspan),r.attrs.rowspan!=1&&(t.rowspan=r.attrs.rowspan),r.attrs.colwidth&&(t["data-colwidth"]=r.attrs.colwidth.join(","));for(const n in e){const i=e[n].setDOMAttr;i&&i(r.attrs[n],t)}return t}function L9(r){if(r!==null){if(!Array.isArray(r))throw new TypeError("colwidth must be null or an array");for(const e of r)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function B9(r){const e=r.cellAttributes||{},t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:L9}};for(const n in e)t[n]={default:e[n].default,validate:e[n].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:r.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:r.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:n=>Ig(n,e)}],toDOM(n){return["td",zg(n,e),0]}},table_header:{content:r.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:n=>Ig(n,e)}],toDOM(n){return["th",zg(n,e),0]}}}}function Dr(r){let e=r.cached.tableNodeTypes;if(!e){e=r.cached.tableNodeTypes={};for(const t in r.nodes){const n=r.nodes[t],i=n.spec.tableRole;i&&(e[i]=n)}}return e}const ci=new De("selectingCells");function ua(r){for(let e=r.depth-1;e>0;e--)if(r.node(e).type.spec.tableRole=="row")return r.node(0).resolve(r.before(e+1));return null}function Ir(r){const e=r.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function mu(r){const e=r.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=ua(e.$head)||P9(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function P9(r){for(let e=r.nodeAfter,t=r.pos;e;e=e.firstChild,t++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t)}for(let e=r.nodeBefore,t=r.pos;e;e=e.lastChild,t--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t-e.nodeSize)}}function Kh(r){return r.parent.type.spec.tableRole=="row"&&!!r.nodeAfter}function F9(r){return r.node(0).resolve(r.pos+r.nodeAfter.nodeSize)}function np(r,e){return r.depth==e.depth&&r.pos>=e.start(-1)&&r.pos<=e.end(-1)}function u3(r,e,t){const n=r.node(-1),i=Be.get(n),s=r.start(-1),o=i.nextCell(r.pos-s,e,t);return o==null?null:r.node(0).resolve(s+o)}function Bs(r,e,t=1){const n={...r,colspan:r.colspan-t};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,t),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}function $9(r,e,t=1){const n={...r,colspan:r.colspan+t};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let i=0;i<t;i++)n.colwidth.splice(e,0,0)}return n}function q9(r,e,t){const n=Dr(e.type.schema).header_cell;for(let i=0;i<r.height;i++)if(e.nodeAt(r.map[t+i*r.width]).type!=n)return!1;return!0}var He=class kn extends pe{constructor(e,t=e){const n=e.node(-1),i=Be.get(n),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(u=>u!=t.pos-s);l.unshift(t.pos-s);const c=l.map(u=>{const d=n.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new Ry(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Kh(n)&&Kh(i)&&np(n,i)){const s=this.$anchorCell.node(-1)!=n.node(-1);return s&&this.isRowSelection()?kn.rowSelection(n,i):s&&this.isColSelection()?kn.colSelection(n,i):new kn(n,i)}return se.between(n,i)}content(){const e=this.$anchorCell.node(-1),t=Be.get(e),n=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),s={},o=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let u=l*t.width+i.left,d=i.left;d<i.right;d++,u++){const h=t.map[u];if(s[h])continue;s[h]=!0;const f=t.findCell(h);let m=e.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const y=i.left-f.left,b=f.right-i.right;if(y>0||b>0){let v=m.attrs;if(y>0&&(v=Bs(v,0,y)),b>0&&(v=Bs(v,v.colspan-b,b)),f.left<i.left){if(m=m.type.createAndFill(v),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(v)}`)}else m=m.type.create(v,m.content)}if(f.top<i.top||f.bottom>i.bottom){const v={...m.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?m=m.type.createAndFill(v):m=m.type.create(v,m.content)}c.push(m)}o.push(e.child(l).copy(V.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new re(V.from(a),1,1)}replace(e,t=re.empty){const n=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],c=e.mapping.slice(n);e.replace(c.map(a.pos),c.map(l.pos),o?re.empty:t)}const s=pe.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new re(V.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=Be.get(t),i=this.$anchorCell.start(-1),s=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),i=Be.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(t=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new kn(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Be.get(e),n=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-n),s=t.colCount(this.$headCell.pos-n);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==t.width}eq(e){return e instanceof kn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),i=Be.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(t=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(t=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new kn(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new kn(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new kn(e.resolve(t),e.resolve(n))}getBookmark(){return new H9(this.$anchorCell.pos,this.$headCell.pos)}};He.prototype.visible=!1;pe.jsonID("cell",He);var H9=class d3{constructor(e,t){this.anchor=e,this.head=t}map(e){return new d3(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&np(t,n)?new He(t,n):pe.near(n,1)}};function _9(r){if(!(r.selection instanceof He))return null;const e=[];return r.selection.forEachCell((t,n)=>{e.push(Ze.node(n,n+t.nodeSize,{class:"selectedCell"}))}),$e.create(r.doc,e)}function j9({$from:r,$to:e}){if(r.pos==e.pos||r.pos<e.pos-6)return!1;let t=r.pos,n=e.pos,i=r.depth;for(;i>=0&&!(r.after(i+1)<r.end(i));i--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,n--);return t==n&&/row|table/.test(r.node(i).type.spec.tableRole)}function V9({$from:r,$to:e}){let t,n;for(let i=r.depth;i>0;i--){const s=r.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}return t!==n&&e.parentOffset===0}function W9(r,e,t){const n=(e||r).selection,i=(e||r).doc;let s,o;if(n instanceof ae&&(o=n.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=He.create(i,n.from);else if(o=="row"){const a=i.resolve(n.from+1);s=He.rowSelection(a,a)}else if(!t){const a=Be.get(n.node),l=n.from+1,c=l+a.map[a.width*a.height-1];s=He.create(i,l+1,c)}}else n instanceof se&&j9(n)?s=se.create(i,n.from):n instanceof se&&V9(n)&&(s=se.create(i,n.$from.start(),n.$from.end()));return s&&(e||(e=r.tr)).setSelection(s),e}const U9=new De("fix-tables");function h3(r,e,t,n){const i=r.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const l=e.child(o);for(let c=a,u=Math.min(i,o+3);c<u;c++)if(r.child(c)==l){a=c+1,t+=l.nodeSize;continue e}n(l,t),a<i&&r.child(a).sameMarkup(l)?h3(r.child(a),l,t+1,n):l.nodesBetween(0,l.content.size,n,t+1),t+=l.nodeSize}}function K9(r,e){let t;const n=(i,s)=>{i.type.spec.tableRole=="table"&&(t=G9(r,i,s,t))};return e?e.doc!=r.doc&&h3(e.doc,r.doc,0,n):r.doc.descendants(n),t}function G9(r,e,t,n){const i=Be.get(e);if(!i.problems)return n;n||(n=r.tr);const s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){const c=i.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;n.setNodeMarkup(n.mapping.map(t+1+c.pos),null,Bs(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;n.setNodeMarkup(n.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=n.mapping.map(t);n.delete(u,u+e.nodeSize)}}let o,a;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),a=l);for(let l=0,c=t+1;l<i.height;l++){const u=e.child(l),d=c+u.nodeSize,h=s[l];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<h;b++){const v=Dr(r.schema)[f].createAndFill();v&&m.push(v)}const y=(l==0||o==l-1)&&a==l?c+1:d-1;n.insert(n.mapping.map(y),m)}c=d}return n.setMeta(U9,{fixTables:!0})}function f3(r){const e=Be.get(r),t=[],n=e.height,i=e.width;for(let s=0;s<n;s++){const o=[];for(let a=0;a<i;a++){const l=s*i+a,c=e.map[l];if(s>0){const u=l-i;if(c===e.map[u]){o.push(null);continue}}if(a>0){const u=l-1;if(c===e.map[u]){o.push(null);continue}}o.push(r.nodeAt(c))}t.push(o)}return t}function p3(r,e){const t=[],n=Be.get(r),i=n.height,s=n.width;for(let o=0;o<i;o++){const a=r.child(o),l=[];for(let u=0;u<s;u++){const d=e[o][u];if(!d)continue;const h=n.map[o*n.width+u],f=r.nodeAt(h);if(!f)continue;const m=f.type.createChecked(d.attrs,d.content,d.marks);l.push(m)}const c=a.type.createChecked(a.attrs,l,a.marks);t.push(c)}return r.type.createChecked(r.attrs,t,r.marks)}function m3(r,e,t,n){const i=e[0]>t[0]?-1:1,s=r.splice(e[0],e.length),o=s.length%2===0?1:0;let a;return a=i===-1?t[0]:t[t.length-1]-o,r.splice(a,0,...s),r}function va(r){return J9(e=>e.type.spec.tableRole==="table",r)}function J9(r,e){for(let t=e.depth;t>=0;t-=1){const n=e.node(t);if(r(n))return{node:n,pos:t===0?0:e.before(t),start:e.start(t),depth:t}}return null}function ao(r,e){const t=va(e.$from);if(!t)return;const n=Be.get(t.node);if(!(r<0||r>n.width-1))return n.cellsInRect({left:r,right:r+1,top:0,bottom:n.height}).map(i=>{const s=t.node.nodeAt(i),o=i+t.start;return{pos:o,start:o+1,node:s,depth:t.depth+2}})}function lo(r,e){const t=va(e.$from);if(!t)return;const n=Be.get(t.node);if(!(r<0||r>n.height-1))return n.cellsInRect({left:0,right:n.width,top:r,bottom:r+1}).map(i=>{const s=t.node.nodeAt(i),o=i+t.start;return{pos:o,start:o+1,node:s,depth:t.depth+2}})}function Lg(r,e,t=e){let n=e,i=t;for(let u=e;u>=0;u--){const d=ao(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.colspan+u-1;f>=n&&(n=u),f>i&&(i=f)})}for(let u=e;u<=i;u++){const d=ao(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.colspan+u-1;h.node.attrs.colspan>1&&f>i&&(i=f)})}const s=[];for(let u=n;u<=i;u++){const d=ao(u,r.selection);d&&d.length>0&&s.push(u)}n=s[0],i=s[s.length-1];const o=ao(n,r.selection),a=lo(0,r.selection);if(!o||!a)return;const l=r.doc.resolve(o[o.length-1].pos);let c;for(let u=i;u>=n;u--){const d=ao(u,r.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:r.doc.resolve(c.pos),indexes:s}}function Bg(r,e,t=e){let n=e,i=t;for(let u=e;u>=0;u--){const d=lo(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.rowspan+u-1;f>=n&&(n=u),f>i&&(i=f)})}for(let u=e;u<=i;u++){const d=lo(u,r.selection);d&&d.forEach(h=>{const f=h.node.attrs.rowspan+u-1;h.node.attrs.rowspan>1&&f>i&&(i=f)})}const s=[];for(let u=n;u<=i;u++){const d=lo(u,r.selection);d&&d.length>0&&s.push(u)}n=s[0],i=s[s.length-1];const o=lo(n,r.selection),a=ao(0,r.selection);if(!o||!a)return;const l=r.doc.resolve(o[o.length-1].pos);let c;for(let u=i;u>=n;u--){const d=lo(u,r.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:r.doc.resolve(c.pos),indexes:s}}function Pg(r){return r[0].map((e,t)=>r.map(n=>n[t]))}function Y9(r){var e,t;const{tr:n,originIndex:i,targetIndex:s,select:o,pos:a}=r,l=va(n.doc.resolve(a));if(!l)return!1;const c=(e=Lg(n,i))===null||e===void 0?void 0:e.indexes,u=(t=Lg(n,s))===null||t===void 0?void 0:t.indexes;if(!c||!u||c.includes(s))return!1;const d=X9(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!o)return!0;const h=Be.get(d),f=l.start,m=s,y=h.positionAt(h.height-1,m,d),b=n.doc.resolve(f+y),v=h.positionAt(0,m,d),k=n.doc.resolve(f+v);return n.setSelection(He.colSelection(b,k)),!0}function X9(r,e,t,n){let i=Pg(f3(r));return i=m3(i,e,t),i=Pg(i),p3(r,i)}function Z9(r){var e,t;const{tr:n,originIndex:i,targetIndex:s,select:o,pos:a}=r,l=va(n.doc.resolve(a));if(!l)return!1;const c=(e=Bg(n,i))===null||e===void 0?void 0:e.indexes,u=(t=Bg(n,s))===null||t===void 0?void 0:t.indexes;if(!c||!u||c.includes(s))return!1;const d=Q9(l.node,c,u);if(n.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!o)return!0;const h=Be.get(d),f=l.start,m=s,y=h.positionAt(m,h.width-1,d),b=n.doc.resolve(f+y),v=h.positionAt(m,0,d),k=n.doc.resolve(f+v);return n.setSelection(He.rowSelection(b,k)),!0}function Q9(r,e,t,n){let i=f3(r);return i=m3(i,e,t),p3(r,i)}function Li(r){const e=r.selection,t=mu(r),n=t.node(-1),i=t.start(-1),s=Be.get(n);return{...e instanceof He?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:n}}function g3(r,{map:e,tableStart:t,table:n},i){let s=i>0?-1:0;q9(e,n,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=n.nodeAt(l);r.setNodeMarkup(r.mapping.map(t+l),null,$9(c.attrs,i-e.colCount(l))),o+=c.attrs.rowspan-1}else{const l=s==null?Dr(n.type.schema).cell:n.nodeAt(e.map[a+s]).type,c=e.positionAt(o,i,n);r.insert(r.mapping.map(t+c),l.createAndFill())}}return r}function eS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r);e(g3(r.tr,t,t.left))}return!0}function tS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r);e(g3(r.tr,t,t.right))}return!0}function rS(r,{map:e,table:t,tableStart:n},i){const s=r.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,l=e.map[a],c=t.nodeAt(l),u=c.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)r.setNodeMarkup(r.mapping.slice(s).map(n+l),null,Bs(u,i-e.colCount(l)));else{const d=r.mapping.slice(s).map(n+l);r.delete(d,d+c.nodeSize)}o+=u.rowspan}}function nS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r),n=r.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;rS(n,t,i),i!=t.left;i--){const s=t.tableStart?n.doc.nodeAt(t.tableStart-1):n.doc;if(!s)throw new RangeError("No table found");t.table=s,t.map=Be.get(s)}e(n)}return!0}function iS(r,{map:e,table:t,tableStart:n},i){let s=0;for(let c=0;c<i;c++)s+=t.child(c).nodeSize;const o=s+t.child(i).nodeSize,a=r.mapping.maps.length;r.delete(s+n,o+n);const l=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[u-e.width]){const h=t.nodeAt(d).attrs;r.setNodeMarkup(r.mapping.slice(a).map(d+n),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const h=t.nodeAt(d),f=h.attrs,m=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),y=e.positionAt(i+1,c,t);r.insert(r.mapping.slice(a).map(n+y),m),c+=f.colspan-1}}}}function sS(r,e){if(!Ir(r))return!1;if(e){const t=Li(r),n=r.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;iS(n,t,i),i!=t.top;i--){const s=t.tableStart?n.doc.nodeAt(t.tableStart-1):n.doc;if(!s)throw new RangeError("No table found");t.table=s,t.map=Be.get(t.table)}e(n)}return!0}function oS(r,e){return function(t,n){if(!Ir(t))return!1;const i=mu(t);if(i.nodeAfter.attrs[r]===e)return!1;if(n){const s=t.tr;t.selection instanceof He?t.selection.forEachCell((o,a)=>{o.attrs[r]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[r]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[r]:e}),n(s)}return!0}}function aS(r){return function(e,t){if(!Ir(e))return!1;if(t){const n=Dr(e.schema),i=Li(e),s=e.tr,o=i.map.cellsInRect(r=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:r=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==n.header_cell&&s.setNodeMarkup(i.tableStart+o[l],n.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],n.header_cell,a[l].attrs);t(s)}return!0}}function Fg(r,e,t){const n=e.map.cellsInRect({left:0,top:0,right:r=="row"?e.map.width:1,bottom:r=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const s=e.table.nodeAt(n[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function ip(r,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?aS(r):function(t,n){if(!Ir(t))return!1;if(n){const i=Dr(t.schema),s=Li(t),o=t.tr,a=Fg("row",s,i),l=Fg("column",s,i),c=(r==="column"?a:r==="row"&&l)?1:0,u=r=="column"?{left:0,top:c,right:1,bottom:s.map.height}:r=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=r=="column"?l?i.cell:i.header_cell:r=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,m=o.doc.nodeAt(f);m&&o.setNodeMarkup(f,d,m.attrs)}),n(o)}return!0}}ip("row",{useDeprecatedLogic:!0});ip("column",{useDeprecatedLogic:!0});ip("cell",{useDeprecatedLogic:!0});function lS(r,e){if(e<0){const t=r.nodeBefore;if(t)return r.pos-t.nodeSize;for(let n=r.index(-1)-1,i=r.before();n>=0;n--){const s=r.node(-1).child(n),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(r.index()<r.parent.childCount-1)return r.pos+r.nodeAfter.nodeSize;const t=r.node(-1);for(let n=r.indexAfter(-1),i=r.after();n<t.childCount;n++){const s=t.child(n);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function y3(r){return function(e,t){if(!Ir(e))return!1;const n=lS(mu(e),r);if(n==null)return!1;if(t){const i=e.doc.resolve(n);t(e.tr.setSelection(se.between(i,F9(i))).scrollIntoView())}return!0}}function cS(r,e){const t=r.selection.$anchor;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="table")return e&&e(r.tr.delete(t.before(n),t.after(n)).scrollIntoView()),!0;return!1}function Gc(r,e){const t=r.selection;if(!(t instanceof He))return!1;if(e){const n=r.tr,i=Dr(r.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||n.replace(n.mapping.map(o+1),n.mapping.map(o+s.nodeSize-1),new re(i,0,0))}),n.docChanged&&e(n)}return!0}function uS(r){return(e,t)=>{const{from:n,to:i,select:s=!0,pos:o=e.selection.from}=r,a=e.tr;return Z9({tr:a,originIndex:n,targetIndex:i,select:s,pos:o})?(t==null||t(a),!0):!1}}function dS(r){return(e,t)=>{const{from:n,to:i,select:s=!0,pos:o=e.selection.from}=r,a=e.tr;return Y9({tr:a,originIndex:n,targetIndex:i,select:s,pos:o})?(t==null||t(a),!0):!1}}function hS(r){if(r.size===0)return null;let{content:e,openStart:t,openEnd:n}=r;for(;e.childCount==1&&(t>0&&n>0||e.child(0).type.spec.tableRole=="table");)t--,n--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,t-1),d=l<e.childCount-1?0:Math.max(0,n-1);(u||d)&&(c=Gh(Dr(o).row,new re(c,u,d)).content),a.push(c)}else if(s=="cell"||s=="header_cell")a.push(t||n?Gh(Dr(o).row,new re(e,t,n)).content:e);else return null;return fS(o,a)}function fS(r,e){const t=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let c=i;c<i+a;c++)t[c]=(t[c]||0)+l}}let n=0;for(let i=0;i<t.length;i++)n=Math.max(n,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(V.empty),t[i]<n){const s=Dr(r).cell.createAndFill(),o=[];for(let a=t[i];a<n;a++)o.push(s);e[i]=e[i].append(V.from(o))}return{height:e.length,width:n,rows:e}}function Gh(r,e){const t=r.createAndFill();return new Oy(t).replace(0,t.content.size,e).doc}function pS({width:r,height:e,rows:t},n,i){if(r!=n){const s=[],o=[];for(let a=0;a<t.length;a++){const l=t[a],c=[];for(let u=s[a]||0,d=0;u<n;d++){let h=l.child(d%l.childCount);u+h.attrs.colspan>n&&(h=h.type.createChecked(Bs(h.attrs,h.attrs.colspan,u+h.attrs.colspan-n),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(V.from(c))}t=o,r=n}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const l=[],c=t[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(V.from(l))}t=s,e=i}return{width:r,height:e,rows:t}}function mS(r,e,t,n,i,s,o){const a=r.doc.type.schema,l=Dr(a);let c,u;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=t.child(d);h+=f.nodeSize;const m=[];let y;f.lastChild==null||f.lastChild.type==l.cell?y=c||(c=l.cell.createAndFill()):y=u||(u=l.header_cell.createAndFill());for(let b=e.width;b<i;b++)m.push(y);r.insert(r.mapping.slice(o).map(h-1+n),m)}if(s>e.height){const d=[];for(let m=0,y=(e.height-1)*e.width;m<Math.max(e.width,i);m++){const b=m>=e.width?!1:t.nodeAt(e.map[y+m]).type==l.header_cell;d.push(b?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,V.from(d)),f=[];for(let m=e.height;m<s;m++)f.push(h);r.insert(r.mapping.slice(o).map(n+t.nodeSize-2),f)}return!!(c||u)}function $g(r,e,t,n,i,s,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=i;c<s;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const h=t.nodeAt(d),{top:f,left:m}=e.findCell(d);r.setNodeMarkup(r.mapping.slice(a).map(d+n),null,{...h.attrs,rowspan:o-f}),r.insert(r.mapping.slice(a).map(e.positionAt(o,m,t)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),c+=h.attrs.colspan-1}}return l}function qg(r,e,t,n,i,s,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=i;c<s;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){l=!0;const h=t.nodeAt(d),f=e.colCount(d),m=r.mapping.slice(a).map(d+n);r.setNodeMarkup(m,null,Bs(h.attrs,o-f,h.attrs.colspan-(o-f))),r.insert(m+h.nodeSize,h.type.createAndFill(Bs(h.attrs,0,o-f))),c+=h.attrs.rowspan-1}}return l}function Hg(r,e,t,n,i){let s=t?r.doc.nodeAt(t-1):r.doc;if(!s)throw new Error("No table found");let o=Be.get(s);const{top:a,left:l}=n,c=l+i.width,u=a+i.height,d=r.tr;let h=0;function f(){if(s=t?d.doc.nodeAt(t-1):d.doc,!s)throw new Error("No table found");o=Be.get(s),h=d.mapping.maps.length}mS(d,o,s,t,c,u,h)&&f(),$g(d,o,s,t,l,c,a,h)&&f(),$g(d,o,s,t,l,c,u,h)&&f(),qg(d,o,s,t,a,u,l,h)&&f(),qg(d,o,s,t,a,u,c,h)&&f();for(let m=a;m<u;m++){const y=o.positionAt(m,l,s),b=o.positionAt(m,c,s);d.replace(d.mapping.slice(h).map(y+t),d.mapping.slice(h).map(b+t),new re(i.rows[m-a],0,0))}f(),d.setSelection(new He(d.doc.resolve(t+o.positionAt(a,l,s)),d.doc.resolve(t+o.positionAt(u-1,c-1,s)))),e(d)}const gS=tp({ArrowLeft:Jc("horiz",-1),ArrowRight:Jc("horiz",1),ArrowUp:Jc("vert",-1),ArrowDown:Jc("vert",1),"Shift-ArrowLeft":Yc("horiz",-1),"Shift-ArrowRight":Yc("horiz",1),"Shift-ArrowUp":Yc("vert",-1),"Shift-ArrowDown":Yc("vert",1),Backspace:Gc,"Mod-Backspace":Gc,Delete:Gc,"Mod-Delete":Gc});function C0(r,e,t){return t.eq(r.selection)?!1:(e&&e(r.tr.setSelection(t).scrollIntoView()),!0)}function Jc(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof He)return C0(t,n,pe.near(s.$headCell,e));if(r!="horiz"&&!s.empty)return!1;const o=v3(i,r,e);if(o==null)return!1;if(r=="horiz")return C0(t,n,pe.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=u3(a,r,e);let c;return l?c=pe.near(l,1):e<0?c=pe.near(t.doc.resolve(a.before(-1)),-1):c=pe.near(t.doc.resolve(a.after(-1)),1),C0(t,n,c)}}}function Yc(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof He)o=s;else{const l=v3(i,r,e);if(l==null)return!1;o=new He(t.doc.resolve(l))}const a=u3(o.$headCell,r,e);return a?C0(t,n,new He(o.$anchorCell,a)):!1}}function yS(r,e){const t=r.state.doc,n=ua(t.resolve(e));return n?(r.dispatch(r.state.tr.setSelection(new He(n))),!0):!1}function vS(r,e,t){if(!Ir(r.state))return!1;let n=hS(t);const i=r.state.selection;if(i instanceof He){n||(n={width:1,height:1,rows:[V.from(Gh(Dr(r.state.schema).cell,t))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Be.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return n=pS(n,a.right-a.left,a.bottom-a.top),Hg(r.state,r.dispatch,o,a,n),!0}else if(n){const s=mu(r.state),o=s.start(-1);return Hg(r.state,r.dispatch,o,Be.get(s.node(-1)).findCell(s.pos-o),n),!0}else return!1}function bS(r,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const n=_g(r,e.target);let i;if(e.shiftKey&&r.state.selection instanceof He)s(r.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(i=ua(r.state.selection.$anchor))!=null&&((t=Nd(r,e))===null||t===void 0?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!n)return;function s(l,c){let u=Nd(r,c);const d=ci.getState(r.state)==null;if(!u||!np(l,u))if(d)u=l;else return;const h=new He(l,u);if(d||!r.state.selection.eq(h)){const f=r.state.tr.setSelection(h);d&&f.setMeta(ci,l.pos),r.dispatch(f)}}function o(){r.root.removeEventListener("mouseup",o),r.root.removeEventListener("dragstart",o),r.root.removeEventListener("mousemove",a),ci.getState(r.state)!=null&&r.dispatch(r.state.tr.setMeta(ci,-1))}function a(l){const c=l,u=ci.getState(r.state);let d;if(u!=null)d=r.state.doc.resolve(u);else if(_g(r,c.target)!=n&&(d=Nd(r,e),!d))return o();d&&s(d,c)}r.root.addEventListener("mouseup",o),r.root.addEventListener("dragstart",o),r.root.addEventListener("mousemove",a)}function v3(r,e,t){if(!(r.state.selection instanceof se))return null;const{$head:n}=r.state.selection;for(let i=n.depth-1;i>=0;i--){const s=n.node(i);if((t<0?n.index(i):n.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=n.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return r.endOfTextblock(a)?o:null}}return null}function _g(r,e){for(;e&&e!=r.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Nd(r,e){const t=r.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:n,pos:i}=t;return n>=0&&ua(r.state.doc.resolve(n))||ua(r.state.doc.resolve(i))}var wS=class{constructor(r,e){this.node=r,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Jh(r,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(r){return r.type!=this.node.type?!1:(this.node=r,Jh(r,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(r){return r.type=="attributes"&&(r.target==this.table||this.colgroup.contains(r.target))}};function Jh(r,e,t,n,i,s){let o=0,a=!0,l=e.firstChild;const c=r.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:m}=c.child(d).attrs;for(let y=0;y<f;y++,h++){const b=i==h?s:m&&m[y],v=b?b+"px":"";if(o+=b||n,b||(a=!1),l)l.style.width!=v&&(l.style.width=v),l=l.nextSibling;else{const k=document.createElement("col");k.style.width=v,e.appendChild(k)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(t.style.width=o+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=o+"px")}}const cr=new De("tableColumnResizing");function kS({handleWidth:r=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:n=wS,lastColumnResizable:i=!0}={}){const s=new Ae({key:cr,state:{init(o,a){var l;const c=(l=s.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=Dr(a.schema).table.name;return n&&c&&(c[u]=(d,h)=>new n(d,t,h)),new xS(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=cr.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{SS(o,a,r,i)},mouseleave:o=>{CS(o)},mousedown:(o,a)=>{MS(o,a,e,t)}},decorations:o=>{const a=cr.getState(o);if(a&&a.activeHandle>-1)return DS(o,a.activeHandle)},nodeViews:{}}});return s}var xS=class M0{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,n=e.getMeta(cr);if(n&&n.setHandle!=null)return new M0(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new M0(t.activeHandle,n.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Kh(e.doc.resolve(i))||(i=-1),new M0(i,t.dragging)}return t}};function SS(r,e,t,n){if(!r.editable)return;const i=cr.getState(r.state);if(i&&!i.dragging){const s=AS(e.target);let o=-1;if(s){const{left:a,right:l}=s.getBoundingClientRect();e.clientX-a<=t?o=jg(r,e,"left",t):l-e.clientX<=t&&(o=jg(r,e,"right",t))}if(o!=i.activeHandle){if(!n&&o!==-1){const a=r.state.doc.resolve(o),l=a.node(-1),c=Be.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}b3(r,o)}}}function CS(r){if(!r.editable)return;const e=cr.getState(r.state);e&&e.activeHandle>-1&&!e.dragging&&b3(r,-1)}function MS(r,e,t,n){var i;if(!r.editable)return!1;const s=(i=r.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=cr.getState(r.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=r.state.doc.nodeAt(o.activeHandle),l=TS(r,o.activeHandle,a.attrs);r.dispatch(r.state.tr.setMeta(cr,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=cr.getState(r.state);h!=null&&h.dragging&&(NS(r,h.activeHandle,Vg(h.dragging,d,t)),r.dispatch(r.state.tr.setMeta(cr,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=cr.getState(r.state);if(h&&h.dragging){const f=Vg(h.dragging,d,t);Wg(r,h.activeHandle,f,n)}}return Wg(r,o.activeHandle,l,n),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function TS(r,e,{colspan:t,colwidth:n}){const i=n&&n[n.length-1];if(i)return i;const s=r.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=t;if(n)for(let l=0;l<t;l++)n[l]&&(o-=n[l],a--);return o/a}function AS(r){for(;r&&r.nodeName!="TD"&&r.nodeName!="TH";)r=r.classList&&r.classList.contains("ProseMirror")?null:r.parentNode;return r}function jg(r,e,t,n){const i=t=="right"?-n:n,s=r.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=ua(r.state.doc.resolve(o));if(!a)return-1;if(t=="right")return a.pos;const l=Be.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Vg(r,e,t){const n=e.clientX-r.startX;return Math.max(t,r.startWidth+n)}function b3(r,e){r.dispatch(r.state.tr.setMeta(cr,{setHandle:e}))}function NS(r,e,t){const n=r.state.doc.resolve(e),i=n.node(-1),s=Be.get(i),o=n.start(-1),a=s.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1,l=r.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+a;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==t)continue;const m=h.colwidth?h.colwidth.slice():ES(h.colspan);m[f]=t,l.setNodeMarkup(o+d,null,{...h,colwidth:m})}l.docChanged&&r.dispatch(l)}function Wg(r,e,t,n){const i=r.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=Be.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let l=r.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Jh(s,l.firstChild,l,n,a,t)}function ES(r){return Array(r).fill(0)}function DS(r,e){const t=[],n=r.doc.resolve(e),i=n.node(-1);if(!i)return $e.empty;const s=Be.get(i),o=n.start(-1),a=s.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var l;const d=s.map[u],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((l=cr.getState(r))===null||l===void 0)&&l.dragging&&t.push(Ze.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),t.push(Ze.widget(h,f))}}return $e.create(r.doc,t)}function OS({allowTableNodeSelection:r=!1}={}){return new Ae({key:ci,state:{init(){return null},apply(e,t){const n=e.getMeta(ci);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;const{deleted:i,pos:s}=e.mapping.mapResult(t);return i?null:s}},props:{decorations:_9,handleDOMEvents:{mousedown:bS},createSelectionBetween(e){return ci.getState(e.state)!=null?e.state.selection:null},handleTripleClick:yS,handleKeyDown:gS,handlePaste:vS},appendTransaction(e,t,n){return W9(n,K9(n,t),r)}})}function RS(r,e){return function(t,n){let{$from:i,$to:s,node:o}=t.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(s))return!1;let a=i.node(-1);if(a.type!=r)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=r||i.index(-2)!=i.node(-2).childCount-1)return!1;if(n){let d=V.empty,h=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-h;v>=i.depth-3;v--)d=V.from(i.node(v).copy(d));let f=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;d=d.append(V.from(r.createAndFill()));let m=i.before(i.depth-(h-1)),y=t.tr.replace(m,i.after(-f),new re(d,4-h,0)),b=-1;y.doc.nodesBetween(m,y.doc.content.size,(v,k)=>{if(b>-1)return!1;v.isTextblock&&v.content.size==0&&(b=k+1)}),b>-1&&y.setSelection(pe.near(y.doc.resolve(b))),n(y.scrollIntoView())}return!0}let l=s.pos==i.end()?a.contentMatchAt(0).defaultType:null,c=t.tr.delete(i.pos,s.pos),u=l?[null,{type:l}]:void 0;return Ja(c.doc,i.pos,2,u)?(n&&n(c.split(i.pos,2,u).scrollIntoView()),!0):!1}}function IS(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?zS(e,t,r,s):LS(e,t,s):!0:!1}}function zS(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new At(s-1,o,s,o,new re(V.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new cy(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=su(n);if(a==null)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return wc(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function LS(r,e,t){let n=r.tr,i=t.parent;for(let f=t.end,m=t.endIndex-1,y=t.startIndex;m>y;m--)f-=i.child(m).nodeSize,n.delete(f-1,f+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?V.empty:V.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return n.step(new At(d-(a?1:0),h+(l?1:0),d+1,h-1,new re((a?V.empty:V.from(i.copy(V.empty))).append(l?V.empty:V.from(i.copy(V.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function BS(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=V.from(c?r.create():null),d=new re(V.from(r.create(null,V.from(a.type.create(null,u)))),c?3:1,0),h=s.start,f=s.end;t(e.tr.step(new At(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}function PS(r){const e=new Map;if(!r||!r.type)throw new Error("mdast-util-definitions expected node");return $s(r,"definition",function(n){const i=Ug(n.identifier);i&&!e.get(i)&&e.set(i,n)}),t;function t(n){const i=Ug(n);return e.get(i)}}function Ug(r){return String(r||"").toUpperCase()}function FS(){return function(r){const e=PS(r);$s(r,function(t,n,i){if(t.type==="definition"&&i!==void 0&&typeof n=="number")return i.children.splice(n,1),[M1,n];if(t.type==="imageReference"||t.type==="linkReference"){const s=e(t.identifier);if(s&&i&&typeof n=="number")return i.children[n]=t.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:t.alt}:{type:"link",url:s.url,title:s.title,children:t.children},[M1,n]}})}}function w3(r,e){var n;if(!(e.childCount>=1&&((n=e.lastChild)==null?void 0:n.type.name)==="hardbreak")){r.next(e.content);return}const t=[];e.content.forEach((i,s,o)=>{o!==e.childCount-1&&t.push(i)}),r.next(V.fromArray(t))}function j(r,e){return Object.assign(r,{meta:{package:"@milkdown/preset-commonmark",...e}}),r}var sp=Ac("emphasis");j(sp,{displayName:"Attr<emphasis>",group:"Emphasis"});var Hs=ya("emphasis",r=>({attrs:{marker:{default:r.get(Za).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",r.get(sp.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));j(Hs.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});j(Hs.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var gu=fe("ToggleEmphasis",r=>()=>hu(Hs.type(r)));j(gu,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var k3=wt(r=>Tc(/(?:^|[^*])\*([^*]+)\*$/,Hs.type(r),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));j(k3,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var x3=wt(r=>Tc(/\b_(?![_\s])(.*?[^_\s])_$/,Hs.type(r),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));j(x3,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var op=Qt("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:r=>{const e=r.get(oe);return()=>e.call(gu.key)}}});j(op.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});j(op.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var ap=Ac("strong");j(ap,{displayName:"Attr<strong>",group:"Strong"});var ba=ya("strong",r=>({attrs:{marker:{default:r.get(Za).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",r.get(ap.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));j(ba.mark,{displayName:"MarkSchema<strong>",group:"Strong"});j(ba.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var yu=fe("ToggleStrong",r=>()=>hu(ba.type(r)));j(yu,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var S3=wt(r=>Tc(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),ba.type(r),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));j(S3,{displayName:"InputRule<strong>",group:"Strong"});var lp=Qt("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:r=>{const e=r.get(oe);return()=>e.call(yu.key)}}});j(lp.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});j(lp.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var cp=Ac("inlineCode");j(cp,{displayName:"Attr<inlineCode>",group:"InlineCode"});var Bn=ya("inlineCode",r=>({priority:100,code:!0,inclusive:!1,parseDOM:[{tag:"code"}],toDOM:e=>["code",r.get(cp.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,t,n)=>(e.withMark(t,"inlineCode",n.text||""),!0)}}));j(Bn.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});j(Bn.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var vu=fe("ToggleInlineCode",r=>()=>(e,t)=>{const{selection:n,tr:i}=e;if(n.empty)return!1;const{from:s,to:o}=n;return e.doc.rangeHasMark(s,o,Bn.type(r))?(t==null||t(i.removeMark(s,o,Bn.type(r))),!0):(Object.keys(e.schema.marks).filter(a=>a!==Bn.type.name).map(a=>e.schema.marks[a]).forEach(a=>{i.removeMark(s,o,a)}),t==null||t(i.addMark(s,o,Bn.type(r).create())),!0)});j(vu,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var C3=wt(r=>Tc(/(?:`)([^`]+)(?:`)$/,Bn.type(r)));j(C3,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var up=Qt("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:r=>{const e=r.get(oe);return()=>e.call(vu.key)}}});j(up.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});j(up.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var $S=new Set(["http:","https:","mailto:","tel:","ftp:"]);function qS(r){return r<=32||r>=127&&r<=160||r>=8203&&r<=8205||r===8232||r===8233||r===65279}function HS(r){let e="";for(const t of r)qS(t.codePointAt(0)??0)||(e+=t);return e}function _S(r){var i;if(typeof r!="string")return"";const e=r.trim();if(!e)return"";const t=HS(e),n=(i=/^([a-z][a-z0-9+.-]*):/i.exec(t))==null?void 0:i[1];return!n||$S.has(`${n.toLowerCase()}:`)?e:""}var dp=Ac("link");j(dp,{displayName:"Attr<link>",group:"Link"});var jr=ya("link",r=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...r.get(dp.key)(e),...e.attrs,href:_S(e.attrs.href)}],parseMarkdown:{match:e=>e.type==="link",runner:(e,t,n)=>{const i=t.url,s=t.title;e.openMark(n,{href:i,title:s}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));j(jr.mark,{displayName:"MarkSchema<link>",group:"Link"});var M3=fe("ToggleLink",r=>(e={})=>hu(jr.type(r),e));j(M3,{displayName:"Command<toggleLinkCommand>",group:"Link"});var T3=fe("UpdateLink",r=>(e={})=>(t,n)=>{if(!n)return!1;let i,s=-1;const{selection:o}=t,{from:a,to:l}=o;if(t.doc.nodesBetween(a,a===l?l+1:l,(m,y)=>{if(jr.type(r).isInSet(m.marks))return i=m,s=y,!1}),!i)return!1;const c=i.marks.find(({type:m})=>m===jr.type(r));if(!c)return!1;const u=s,d=s+i.nodeSize,{tr:h}=t,f=jr.type(r).create({...c.attrs,...e});return f?(n(h.removeMark(u,d,c).addMark(u,d,f).setSelection(new se(h.selection.$anchor)).scrollIntoView()),!0):!1});j(T3,{displayName:"Command<updateLinkCommand>",group:"Link"});var A3=rp("doc",()=>({content:"block+",parseMarkdown:{match:({type:r})=>r==="root",runner:(r,e,t)=>{r.injectRoot(e,t)}},toMarkdown:{match:r=>r.type.name==="doc",runner:(r,e)=>{r.openNode("root"),r.next(e.content)}}}));j(A3,{displayName:"NodeSchema<doc>",group:"Doc"});function jS(r){return V2(r,e=>{var t;return e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes((t=e.value)==null?void 0:t.trim())},(e,t)=>{if(!t.length)return;const n=t[t.length-1];if(!n)return;const i=n.children.indexOf(e);i!==-1&&n.children.splice(i,1)},!0)}var da=er("remark-preserve-empty-line",()=>()=>jS);j(da.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});j(da.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var hp=Kr("paragraph");j(hp,{displayName:"Attr<paragraph>",group:"Paragraph"});var Or=Ve("paragraph",r=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",r.get(hp.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,t)=>{var i;const n=(i=r.get(Me).state)==null?void 0:i.doc.lastChild;e.openNode("paragraph"),(!t.content||t.content.size===0)&&t!==n&&VS(r)?e.addNode("html",void 0,"<br />"):w3(e,t),e.closeNode()}}}));function VS(r){let e=!1;try{r.get(da.id),e=!0}catch{e=!1}return e}j(Or.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});j(Or.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var fp=fe("TurnIntoText",r=>()=>gl(Or.type(r)));j(fp,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var pp=Qt("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:r=>{const e=r.get(oe);return()=>e.call(fp.key)}}});j(pp.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});j(pp.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var WS=Array(6).fill(0).map((r,e)=>e+1);function US(r){return r.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var Hn=Ne(US,"headingIdGenerator");j(Hn,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var mp=Kr("heading");j(mp,{displayName:"Attr<heading>",group:"Heading"});var Pt=Ve("heading",r=>{const e=r.get(Hn.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:WS.map(t=>({tag:`h${t}`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw dn(n);return{level:t,id:n.id}}})),toDOM:t=>[`h${t.attrs.level}`,{...r.get(mp.key)(t),id:t.attrs.id||e(t)},0],parseMarkdown:{match:({type:t})=>t==="heading",runner:(t,n,i)=>{const s=n.depth;t.openNode(i,{level:s}),t.next(n.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="heading",runner:(t,n)=>{t.openNode("heading",void 0,{depth:n.attrs.level}),w3(t,n),t.closeNode()}}}});j(Pt.node,{displayName:"NodeSchema<heading>",group:"Heading"});j(Pt.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var N3=wt(r=>ep(/^(?<hashes>#+)\s$/,Pt.type(r),e=>{var s,o;const t=((o=(s=e.groups)==null?void 0:s.hashes)==null?void 0:o.length)||0,{$from:n}=r.get(Me).state.selection,i=n.node();if(i.type.name==="heading"){let a=Number(i.attrs.level)+Number(t);return a>6&&(a=6),{level:a}}return{level:t}}));j(N3,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var oi=fe("WrapInHeading",r=>e=>(e??(e=1),e<1?gl(Or.type(r)):gl(Pt.type(r),{level:e})));j(oi,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var gp=fe("DowngradeHeading",r=>()=>(e,t,n)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==Pt.type(r)||!e.selection.empty||i.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(t==null||t(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):gl(Or.type(r))(e,t)});j(gp,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var yp=Qt("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:r=>{const e=r.get(oe);return()=>e.call(oi.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:r=>{const e=r.get(oe);return()=>e.call(gp.key)}}});j(yp.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});j(yp.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var vp=Kr("blockquote");j(vp,{displayName:"Attr<blockquote>",group:"Blockquote"});var wa=Ve("blockquote",r=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",r.get(vp.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));j(wa.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});j(wa.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var E3=wt(r=>Qf(/^\s*>\s$/,wa.type(r)));j(E3,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var bp=fe("WrapInBlockquote",r=>()=>Zf(wa.type(r)));j(bp,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var wp=Qt("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:r=>{const e=r.get(oe);return()=>e.call(bp.key)}}});j(wp.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});j(wp.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var kp=Kr("codeBlock",()=>({pre:{},code:{}}));j(kp,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Vr=Ve("code_block",r=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{language:e.dataset.language}}}],toDOM:e=>{const t=r.get(kp.key)(e),n=e.attrs.language,i=n&&n.length>0?{"data-language":n}:void 0;return["pre",{...t.pre,...i},["code",t.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,t,n)=>{const i=t.lang??"",s=t.value;e.openNode(n,{language:i}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,t)=>{var n;e.addNode("code",void 0,((n=t.content.firstChild)==null?void 0:n.text)||"",{lang:t.attrs.language})}}}));j(Vr.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});j(Vr.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var D3=wt(r=>ep(/^```(?<language>[a-z]*)?[\s\n]$/,Vr.type(r),e=>{var t;return{language:((t=e.groups)==null?void 0:t.language)??""}}));j(D3,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var xp=fe("CreateCodeBlock",r=>(e="")=>gl(Vr.type(r),{language:e}));j(xp,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var KS=fe("UpdateCodeBlockLanguage",()=>({pos:r,language:e}={pos:-1,language:""})=>(t,n)=>r>=0?(n==null||n(t.tr.setNodeAttribute(r,"language",e)),!0):!1);j(KS,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var Sp=Qt("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:r=>{const e=r.get(oe);return()=>e.call(xp.key)}}});j(Sp.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});j(Sp.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var Cp=Kr("image");j(Cp,{displayName:"Attr<image>",group:"Image"});var _s=Ve("image",r=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...r.get(Cp.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,t,n)=>{const i=t.url,s=t.alt,o=t.title;e.addNode(n,{src:i,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));j(_s.node,{displayName:"NodeSchema<image>",group:"Image"});j(_s.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var O3=fe("InsertImage",r=>(e={})=>(t,n)=>{if(!n)return!0;const{src:i="",alt:s="",title:o=""}=e,a=_s.type(r).create({src:i,alt:s,title:o});return a&&n(t.tr.replaceSelectionWith(a).scrollIntoView()),!0});j(O3,{displayName:"Command<insertImageCommand>",group:"Image"});var R3=fe("UpdateImage",r=>(e={})=>(t,n)=>{const i=c9(t.selection,_s.type(r));if(!i)return!1;const{node:s,pos:o}=i,a={...s.attrs},{src:l,alt:c,title:u}=e;return l!==void 0&&(a.src=l),c!==void 0&&(a.alt=c),u!==void 0&&(a.title=u),n==null||n(t.tr.setNodeMarkup(o,void 0,a).scrollIntoView()),!0});j(R3,{displayName:"Command<updateImageCommand>",group:"Image"});var GS=wt(r=>new _t(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,t,n,i)=>{const[s,o,a="",l]=t;return s?e.tr.replaceWith(n,i,_s.type(r).create({src:a,alt:o,title:l})):null}));j(GS,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var q0=Kr("hardbreak",r=>({"data-type":"hardbreak","data-is-inline":r.attrs.isInline}));j(q0,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var As=Ve("hardbreak",r=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",r.get(q0.key)(e)," "]:["br",r.get(q0.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,t,n)=>{var i;e.addNode(n,{isInline:!!((i=t.data)!=null&&i.isInline)})}},leafText:()=>`
33
33
  `,toMarkdown:{match:e=>e.type.name==="hardbreak",runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,`
34
34
  `):e.addNode("break")}}}));j(As.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});j(As.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var Mp=fe("InsertHardbreak",r=>()=>(e,t)=>{var s;const{selection:n,tr:i}=e;if(!(n instanceof se))return!1;if(n.empty){const o=n.$from.node();if(o.childCount>0&&((s=o.lastChild)==null?void 0:s.type.name)==="hardbreak")return t==null||t(i.replaceRangeWith(n.to-1,n.to,e.schema.node("paragraph")).setSelection(pe.near(i.doc.resolve(n.to))).scrollIntoView()),!0}return t==null||t(i.setMeta("hardbreak",!0).replaceSelectionWith(As.type(r).create()).scrollIntoView()),!0});j(Mp,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var Tp=Qt("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:r=>{const e=r.get(oe);return()=>e.call(Mp.key)}}});j(Tp.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});j(Tp.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var Ap=Kr("hr");j(Ap,{displayName:"Attr<hr>",group:"Hr"});var ka=Ve("hr",r=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",r.get(Ap.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));j(ka.node,{displayName:"NodeSchema<hr>",group:"Hr"});j(ka.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var I3=wt(r=>new _t(/^(?:---|___\s|\*\*\*\s)$/,(e,t,n,i)=>{const{tr:s}=e;return t[0]&&s.replaceWith(n-1,i,ka.type(r).create()),s}));j(I3,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var z3=fe("InsertHr",r=>()=>(e,t)=>{if(!t)return!0;const n=Or.node.type(r).create(),{tr:i,selection:s}=e,{from:o}=s,a=ka.type(r).create();if(!a)return!0;const l=i.replaceSelectionWith(a).insert(o,n),c=pe.findFrom(l.doc.resolve(o),1,!0);return c&&t(l.setSelection(c).scrollIntoView()),!0});j(z3,{displayName:"Command<insertHrCommand>",group:"Hr"});var Np=Kr("bulletList");j(Np,{displayName:"Attr<bulletList>",group:"BulletList"});var js=Ve("bullet_list",r=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...r.get(Np.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!t,runner:(e,t,n)=>{const i=t.spread??!1;e.openNode(n,{spread:i}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="bullet_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));j(js.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});j(js.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var L3=wt(r=>Qf(/^\s*([-+*])\s$/,js.type(r)));j(L3,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var Ep=fe("WrapInBulletList",r=>()=>Zf(js.type(r)));j(Ep,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var Dp=Qt("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:r=>{const e=r.get(oe);return()=>e.call(Ep.key)}}});j(Dp.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});j(Dp.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var Op=Kr("orderedList");j(Op,{displayName:"Attr<orderedList>",group:"OrderedList"});var Bi=Ve("ordered_list",r=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{spread:e.dataset.spread==="true",order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...r.get(Op.key)(e),...e.attrs.order===1?{}:{start:e.attrs.order},"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!!t,runner:(e,t,n)=>{const i=t.spread??!0;e.openNode(n,{spread:i,order:t.start??1}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="ordered_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:t.attrs.order??1,spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));j(Bi.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});j(Bi.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var B3=wt(r=>Qf(/^\s*(\d+)\.\s$/,Bi.type(r),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));j(B3,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var Rp=fe("WrapInOrderedList",r=>()=>Zf(Bi.type(r)));j(Rp,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var Ip=Qt("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:r=>{const e=r.get(oe);return()=>e.call(Rp.key)}}});j(Ip.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});j(Ip.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var zp=Kr("listItem");j(zp,{displayName:"Attr<listItem>",group:"ListItem"});var zr=Ve("list_item",r=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw dn(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...r.get(zp.key)(e),"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e})=>e==="listItem",runner:(e,t,n)=>{const i=t.label!=null?`${t.label}.`:"•",s=t.label!=null?"ordered":"bullet",o=t.spread??!0;e.openNode(n,{label:i,listType:s,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="list_item",runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));j(zr.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});j(zr.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var Lp=fe("SinkListItem",r=>()=>BS(zr.type(r)));j(Lp,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var Bp=fe("LiftListItem",r=>()=>IS(zr.type(r)));j(Bp,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var Pp=fe("SplitListItem",r=>()=>RS(zr.type(r)));j(Pp,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function JS(r){return(e,t,n)=>{const{selection:i}=e;if(!(i instanceof se))return!1;const{empty:s,$from:o}=i;return!s||o.parentOffset!==0||o.node(-1).type!==zr.type(r)?!1:A5(e,t,n)}}var Fp=fe("LiftFirstListItem",r=>()=>JS(r));j(Fp,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var $p=Qt("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:r=>{const e=r.get(oe);return()=>e.call(Pp.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:r=>{const e=r.get(oe);return()=>e.call(Lp.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:r=>{const e=r.get(oe);return()=>e.call(Bp.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:r=>{const e=r.get(oe);return()=>e.call(Fp.key)}}});j($p.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});j($p.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var P3=rp("text",()=>({group:"inline",parseMarkdown:{match:({type:r})=>r==="text",runner:(r,e)=>{r.addText(e.value)}},toMarkdown:{match:r=>r.type.name==="text",runner:(r,e)=>{r.addNode("text",void 0,e.text)}}}));j(P3,{displayName:"NodeSchema<text>",group:"Text"});var qp=Kr("html");j(qp,{displayName:"Attr<html>",group:"Html"});var Hp=Ve("html",r=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const t=document.createElement("span"),n={...r.get(qp.key)(e),"data-value":e.attrs.value,"data-type":"html"};return t.textContent=e.attrs.value,["span",n,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));j(Hp.node,{displayName:"NodeSchema<html>",group:"Html"});j(Hp.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var YS=[A3,hp,Or,Hn,mp,Pt,q0,As,vp,wa,kp,Vr,Ap,ka,Cp,_s,Np,js,Op,Bi,zp,zr,sp,Hs,ap,ba,cp,Bn,dp,jr,qp,Hp,P3].flat(),XS=[E3,L3,B3,D3,I3,N3].flat(),ZS=[k3,x3,C3,S3],co=fe("IsMarkSelected",()=>r=>e=>{if(!r)return!1;const{doc:t,selection:n}=e;return t.rangeHasMark(n.from,n.to,r)}),QS=fe("IsNoteSelected",()=>r=>e=>r?V5(e,r).hasNode:!1),Vt=fe("ClearTextInCurrentBlock",()=>()=>(r,e)=>{let t=r.tr;const{$from:n,$to:i}=t.selection,{pos:s}=n,{pos:o}=i,a=s-n.node().content.size;return a<0?!1:(t=t.deleteRange(a,o),e==null||e(t),!0)}),T0=fe("SetBlockType",()=>r=>(e,t)=>{const{nodeType:n,attrs:i=null}=r??{};if(!n)return!1;const s=e.tr,{from:o,to:a}=s.selection;try{s.setBlockType(o,a,n,i)}catch{return!1}return t==null||t(s),!0}),uo=fe("WrapInBlockType",()=>r=>(e,t)=>{const{nodeType:n,attrs:i=null}=r??{};if(!n)return!1;let s=e.tr;try{const{$from:o,$to:a}=s.selection,l=o.blockRange(a),c=l&&Ff(l,n,i);if(!c)return!1;s=s.wrap(l,c)}catch{return!1}return t==null||t(s),!0}),Xi=fe("AddBlockType",()=>r=>(e,t)=>{const{nodeType:n,attrs:i=null}=r??{};if(!n)return!1;const s=e.tr;try{const o=n instanceof $n?n:n.createAndFill(i);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return t==null||t(s),!0}),F3=fe("SelectTextNearPos",()=>r=>(e,t)=>{const{pos:n}=r??{};if(n==null)return!1;const i=(o,a,l)=>Math.min(Math.max(o,a),l),s=e.tr;try{const o=e.doc.resolve(i(n,0,e.doc.content.size));s.setSelection(se.near(o))}catch{return!1}return t==null||t(s.scrollIntoView()),!0}),eC=[fp,bp,oi,gp,xp,Mp,z3,O3,R3,Rp,Ep,Lp,Pp,Bp,Fp,gu,vu,yu,M3,T3,co,QS,Vt,T0,uo,Xi,F3],tC=[wp,Sp,Tp,yp,$p,Ip,Dp,pp,op,up,lp].flat(),_p=er("remarkAddOrderInList",()=>()=>r=>{$s(r,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((n,i)=>{n.label=i+t})}})});j(_p.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});j(_p.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var jp=er("remarkLineBreak",()=>()=>r=>{const e=/[\t ]*(?:\r?\n|\r)/g;$s(r,"text",(t,n,i)=>{if(!t.value||typeof t.value!="string")return;const s=[];let o=0;e.lastIndex=0;let a=e.exec(t.value);for(;a;){const l=a.index;o!==l&&s.push({type:"text",value:t.value.slice(o,l)}),s.push({type:"break",data:{isInline:!0}}),o=l+a[0].length,a=e.exec(t.value)}if(s.length>0&&i&&typeof n=="number")return o<t.value.length&&s.push({type:"text",value:t.value.slice(o)}),i.children.splice(n,1,...s),n+s.length})});j(jp.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});j(jp.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var Vp=er("remarkInlineLink",()=>FS);j(Vp.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});j(Vp.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var rC=r=>!!r.children,nC=r=>r.type==="html";function iC(r,e){return t(r,0,null)[0];function t(n,i,s){if(rC(n)){const o=[];for(let a=0,l=n.children.length;a<l;a++){const c=n.children[a];if(c){const u=t(c,a,n);if(u)for(let d=0,h=u.length;d<h;d++){const f=u[d];f&&o.push(f)}}}n.children=o}return e(n,i,s)}}var sC=["root","blockquote","listItem"],Wp=er("remarkHTMLTransformer",()=>()=>r=>{iC(r,(e,t,n)=>nC(e)?(n&&sC.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});j(Wp.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});j(Wp.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var Up=er("remarkMarker",()=>()=>(r,e)=>{const t=n=>e.value.charAt(n.position.start.offset);$s(r,n=>["strong","emphasis"].includes(n.type),n=>{n.marker=t(n)})});j(Up.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});j(Up.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var $3=qe(()=>{let r=!1;const e=new De("MILKDOWN_INLINE_NODES_CURSOR"),t=new Ae({key:e,state:{init(){return!1},apply(n){if(!n.selection.empty)return!1;const i=n.selection.$from,s=i.nodeBefore,o=i.nodeAfter;return!!(s&&o&&s.isInline&&!s.isText&&o.isInline&&!o.isText)}},props:{handleDOMEvents:{compositionend:(n,i)=>r?(r=!1,requestAnimationFrame(()=>{if(t.getState(n.state)){const s=n.state.selection.from;i.preventDefault(),n.dispatch(n.state.tr.insertText(i.data||"",s))}}),!0):!1,compositionstart:n=>(t.getState(n.state)&&(r=!0),!1),beforeinput:(n,i)=>{if(t.getState(n.state)&&i instanceof InputEvent&&i.data&&!r){const s=n.state.selection.from;return i.preventDefault(),n.dispatch(n.state.tr.insertText(i.data||"",s)),!0}return!1}},decorations(n){if(t.getState(n)){const i=n.selection.$from.pos,s=document.createElement("span"),o=Ze.widget(i,s,{side:-1}),a=document.createElement("span"),l=Ze.widget(i,a);return setTimeout(()=>{s.contentEditable="true",a.contentEditable="true"}),$e.create(n.doc,[o,l])}return $e.empty}}});return t});j($3,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var q3=qe(r=>new Ae({key:new De("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,t,n)=>{if(!e.length)return;const[i]=e;if(!i)return;const[s]=i.steps;if(i.getMeta("hardbreak")){if(!(s instanceof rt))return;const{from:o}=s;return n.tr.setNodeMarkup(o,As.type(r),void 0,[])}if(s instanceof In){let o=n.tr;const{from:a,to:l}=s;return n.doc.nodesBetween(a,l,(c,u)=>{c.type===As.type(r)&&(o=o.setNodeMarkup(u,As.type(r),void 0,[]))}),o}}}));j(q3,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var Kp=Ne(["table","code_block"],"hardbreakFilterNodes");j(Kp,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var H3=qe(r=>{const e=r.get(Kp.key);return new Ae({key:new De("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(t,n)=>{const i=t.getMeta("hardbreak"),[s]=t.steps;if(i&&s){const{from:o}=s,a=n.doc.resolve(o);let l=a.depth,c=!0;for(;l>0;)e.includes(a.node(l).type.name)&&(c=!1),l--;return c}return!0}})});j(H3,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var Gp=qe(r=>{const e=new De("MILKDOWN_HEADING_ID"),t=n=>{if(n.composing)return;const i=r.get(Hn.key),s=n.state.tr.setMeta("addToHistory",!1);let o=!1;const a={};n.state.doc.descendants((l,c)=>{if(l.type===Pt.type(r)){if(l.textContent.trim().length===0)return;const u=l.attrs;let d=i(l);a[d]?(a[d]+=1,d+=`-#${a[d]}`):a[d]=1,u.id!==d&&(o=!0,s.setMeta(e,!0).setNodeMarkup(c,void 0,{...u,id:d}))}}),o&&n.dispatch(s)};return new Ae({key:e,view:n=>(t(n),{update:(i,s)=>{i.state.doc.eq(s.doc)||t(i)}})})});j(Gp,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var _3=qe(r=>{const e=(t,n,i)=>{if(!i.selection||t.some(d=>d.getMeta("addToHistory")===!1||!d.isGeneric))return null;const s=Bi.type(r),o=js.type(r),a=zr.type(r),l=(d,h,f=1)=>{let m=!1;const y=`${h+f}.`;return d.label!==y&&(d.label=y,m=!0),m};let c=i.tr,u=!1;return i.doc.descendants((d,h,f,m)=>{if(d.type===o){const y=d.maybeChild(0);(y==null?void 0:y.type)===a&&y.attrs.listType==="ordered"&&(u=!0,c.setNodeMarkup(h,s,{spread:!0}),d.descendants((b,v,k,M)=>{if(b.type===a){const D={...b.attrs};l(D,M)&&(c=c.setNodeMarkup(v,void 0,D))}return!1}))}else if(d.type===a&&(f==null?void 0:f.type)===s){const y={...d.attrs};let b=!1;y.listType!=="ordered"&&(y.listType="ordered",b=!0),f!=null&&f.maybeChild(0)&&(b=l(y,m,(f==null?void 0:f.attrs.order)??1)),b&&(c=c.setNodeMarkup(h,void 0,y),u=!0)}}),u?c.setMeta("addToHistory",!1):null};return new Ae({key:new De("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});j(_3,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var oC=[q3,Kp,H3,$3,_p,Vp,jp,Wp,Up,da,Gp,_3].flat(),aC=[YS,XS,ZS,eC,tC,oC].flat(),H0=typeof navigator<"u"?navigator:null,Jp=H0&&H0.userAgent||"",lC=/Edge\/(\d+)/.exec(Jp),cC=/MSIE \d/.exec(Jp),uC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Jp),dC=!!(cC||uC||lC),hC=!dC&&!!H0&&/Apple Computer/.test(H0.vendor),j3=new De("safari-ime-span"),Yh=!1,fC={key:j3,props:{decorations:pC,handleDOMEvents:{compositionstart:()=>{Yh=!0},compositionend:()=>{Yh=!1}}}};function pC(r){const{$from:e,$to:t,to:n}=r.selection;if(Yh&&e.sameParent(t)){const i=Ze.widget(n,mC,{ignoreSelection:!0,key:"safari-ime-span"});return $e.create(r.doc,[i])}}function mC(r){const e=r.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var gC=new Ae(hC?fC:{key:j3});function de(r,e){return Object.assign(r,{meta:{package:"@milkdown/preset-gfm",...e}}),r}var Yp=Ac("strike_through");de(Yp,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var xa=ya("strike_through",r=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",r.get(Yp.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,t)=>{e.withMark(t,"delete")}}}));de(xa.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});de(xa.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var bu=fe("ToggleStrikeThrough",r=>()=>hu(xa.type(r)));de(bu,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var V3=wt(r=>Tc(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)$"),xa.type(r)));de(V3,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var Xp=Qt("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:r=>{const e=r.get(oe);return()=>e.call(bu.key)}}});de(Xp.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});de(Xp.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var Nc=B9({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:r=>r.style.textAlign||"left",setDOMAttr:(r,e)=>{e.style=`text-align: ${r||"left"}`}}}}),cn=Ve("table",()=>({...Nc.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:r=>r.type==="table",runner:(r,e,t)=>{const n=e.align,i=e.children.map((s,o)=>({...s,align:n,isHeader:o===0}));r.openNode(t),r.next(i),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="table",runner:(r,e)=>{var i;const t=(i=e.content.firstChild)==null?void 0:i.content;if(!t)return;const n=[];t.forEach(s=>{n.push(s.attrs.alignment)}),r.openNode("table",void 0,{align:n}),r.next(e.content),r.closeNode()}}}));de(cn.node,{displayName:"NodeSchema<table>",group:"Table"});de(cn.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var Ec=Ve("table_header_row",()=>({...Nc.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:r=>r instanceof HTMLElement&&r.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:r=>!!(r.type==="tableRow"&&r.isHeader),runner:(r,e,t)=>{const n=e.align,i=e.children.map((s,o)=>({...s,align:n[o],isHeader:e.isHeader}));r.openNode(t),r.next(i),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="table_header_row",runner:(r,e)=>{e.content.size!==0&&(r.openNode("tableRow",void 0,{isHeader:!0}),r.next(e.content),r.closeNode())}}}));de(Ec.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});de(Ec.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var Sa=Ve("table_row",()=>({...Nc.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:r=>r.type==="tableRow",runner:(r,e,t)=>{const n=e.align,i=e.children.map((s,o)=>({...s,align:n[o]}));r.openNode(t),r.next(i),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="table_row",runner:(r,e)=>{e.content.size!==0&&(r.openNode("tableRow"),r.next(e.content),r.closeNode())}}}));de(Sa.node,{displayName:"NodeSchema<tableRow>",group:"Table"});de(Sa.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var Ca=Ve("table_cell",()=>({...Nc.table_cell,disableDropCursor:!0,parseMarkdown:{match:r=>r.type==="tableCell"&&!r.isHeader,runner:(r,e,t)=>{const n=e.align;r.openNode(t,{alignment:n}).openNode(r.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:r=>r.type.name==="table_cell",runner:(r,e)=>{r.openNode("tableCell").next(e.content).closeNode()}}}));de(Ca.node,{displayName:"NodeSchema<tableCell>",group:"Table"});de(Ca.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var Ps=Ve("table_header",()=>({...Nc.table_header,disableDropCursor:!0,parseMarkdown:{match:r=>r.type==="tableCell"&&!!r.isHeader,runner:(r,e,t)=>{const n=e.align;r.openNode(t,{alignment:n}),r.openNode(r.schema.nodes.paragraph),r.next(e.children),r.closeNode(),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="table_header",runner:(r,e)=>{r.openNode("tableCell"),r.next(e.content),r.closeNode()}}}));de(Ps.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});de(Ps.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function Zp(r,e=3,t=3){const n=Array(t).fill(0).map(()=>Ca.type(r).createAndFill()),i=Array(t).fill(0).map(()=>Ps.type(r).createAndFill()),s=Array(e).fill(0).map((o,a)=>a===0?Ec.type(r).create(null,i):Sa.type(r).create(null,n));return cn.type(r).create(null,s)}function W3(r){return(e,t)=>n=>{t=t??n.selection.from;const i=n.doc.resolve(t),s=j5(l=>l.type.name==="table")(i),o=s?{node:s.node,from:s.start}:void 0,a=r==="row";if(o){const l=Be.get(o.node);if(e>=0&&e<(a?l.height:l.width)){const c=l.positionAt(a?e:l.height-1,a?l.width-1:e,o.node),u=n.doc.resolve(o.from+c),d=a?He.rowSelection:He.colSelection,h=l.positionAt(a?e:0,a?0:e,o.node),f=n.doc.resolve(o.from+h);return _5(n.setSelection(d(u,f)))}}return n}}var yC=W3("row"),vC=W3("col");function U3(r,e,{map:t,tableStart:n,table:i},s){const o=Array(s).fill(0).reduce((l,c,u)=>l+i.child(u).nodeSize,n),a=Array(t.width).fill(0).map((l,c)=>{const u=i.nodeAt(t.map[c]);return Ca.type(r).createAndFill({alignment:u==null?void 0:u.attrs.alignment})});return e.insert(o,Sa.type(r).create(null,a)),e}function bC(r){const e=va(r.$from);if(!e)return;const t=Be.get(e.node);return t.cellsInRect({left:0,right:t.width,top:0,bottom:t.height}).map(n=>{const i=e.node.nodeAt(n),s=n+e.start;return{pos:s,start:s+1,node:i}})}function wC(r){const e=bC(r.selection);if(e&&e[0]){const t=r.doc.resolve(e[0].pos),n=e[e.length-1];if(n){const i=r.doc.resolve(n.pos);return _5(r.setSelection(new He(i,t)))}}return r}var Qp=fe("GoToPrevTableCell",()=>()=>y3(-1));de(Qp,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var em=fe("GoToNextTableCell",()=>()=>y3(1));de(em,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var tm=fe("ExitTable",r=>()=>(e,t)=>{if(!Ir(e))return!1;const{$head:n}=e.selection,i=o9(n,cn.type(r));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,Or.type(r).createAndFill());return o.setSelection(pe.near(o.doc.resolve(s),1)).scrollIntoView(),t==null||t(o),!0});de(tm,{displayName:"Command<breakTableCommand>",group:"Table"});var K3=fe("InsertTable",r=>({row:e,col:t}={})=>(n,i)=>{const{selection:s,tr:o}=n,{from:a}=s,l=Zp(r,e,t),c=o.replaceSelectionWith(l),u=pe.findFrom(c.doc.resolve(a),1,!0);return u&&c.setSelection(u),i==null||i(c),!0});de(K3,{displayName:"Command<insertTableCommand>",group:"Table"});var wu=fe("MoveRow",()=>({from:r,to:e,pos:t}={})=>uS({from:r??0,to:e??0,pos:t}));de(wu,{displayName:"Command<moveRowCommand>",group:"Table"});var ku=fe("MoveCol",()=>({from:r,to:e,pos:t}={})=>dS({from:r??0,to:e??0,pos:t}));de(ku,{displayName:"Command<moveColCommand>",group:"Table"});var Pn=fe("SelectRow",()=>(r={index:0})=>(e,t)=>{const{tr:n}=e;return!!(t==null?void 0:t(yC(r.index,r.pos)(n)))});de(Pn,{displayName:"Command<selectRowCommand>",group:"Table"});var Fn=fe("SelectCol",()=>(r={index:0})=>(e,t)=>{const{tr:n}=e;return!!(t==null?void 0:t(vC(r.index,r.pos)(n)))});de(Fn,{displayName:"Command<selectColCommand>",group:"Table"});var G3=fe("SelectTable",()=>()=>(r,e)=>{const{tr:t}=r;return!!(e==null?void 0:e(wC(t)))});de(G3,{displayName:"Command<selectTableCommand>",group:"Table"});var xl=fe("DeleteSelectedCells",()=>()=>(r,e)=>{const{selection:t}=r;if(!(t instanceof He))return!1;const n=t.isRowSelection(),i=t.isColSelection();return n&&i?cS(r,e):i?nS(r,e):sS(r,e)});de(xl,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var rm=fe("AddColBefore",()=>()=>eS);de(rm,{displayName:"Command<addColBeforeCommand>",group:"Table"});var xu=fe("AddColAfter",()=>()=>tS);de(xu,{displayName:"Command<addColAfterCommand>",group:"Table"});var nm=fe("AddRowBefore",r=>()=>(e,t)=>{if(!Ir(e))return!1;if(t){const n=Li(e);t(U3(r,e.tr,n,n.top))}return!0});de(nm,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var Su=fe("AddRowAfter",r=>()=>(e,t)=>{if(!Ir(e))return!1;if(t){const n=Li(e);t(U3(r,e.tr,n,n.bottom))}return!0});de(Su,{displayName:"Command<addRowAfterCommand>",group:"Table"});var im=fe("SetAlign",()=>(r="left")=>oS("alignment",r));de(im,{displayName:"Command<setAlignCommand>",group:"Table"});var J3=wt(r=>new _t(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,t,n,i)=>{var l,c;const s=e.doc.resolve(n);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),cn.type(r)))return null;const o=Zp(r,Math.max(Number(((l=t.groups)==null?void 0:l.row)??0),2),Number((c=t.groups)==null?void 0:c.col)),a=e.tr.replaceRangeWith(n,i,o);return a.setSelection(se.create(a.doc,n+3)).scrollIntoView()}));de(J3,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var Y3=E9(r=>({run:(e,t,n)=>{if(n)return e;function i(c){var b;const u=c.childCount,d=((b=c.lastChild)==null?void 0:b.childCount)??0;if(u===0||d===0)return Or.type(r).create();const h=c.firstChild;if(!(d>0&&h&&h.childCount===0))return c;if(u>=3){const v=c.child(1),k=[];for(let O=0;O<v.childCount;O++){const z=v.child(O);k.push(Ps.type(r).create(z.attrs,z.content,z.marks))}const M=h.type.create(h.attrs,k),D=[];for(let O=2;O<u;O++)D.push(c.child(O));return c.type.create(c.attrs,[M,...D])}const f=Array(d).fill(0).map(()=>Ps.type(r).createAndFill()),m=new re(V.from(f),0,0),y=h.replace(0,0,m);return c.replace(0,h.nodeSize,new re(V.from(y),0,0))}function s(c){const u=Sa.type(r),d=[];let h=[],f=!1;function m(){if(h.length===0)return;const y=Ec.type(r).createAndFill(),b=cn.type(r).create(null,[y,...h]);d.push(i(b)),h=[]}return c.forEach(y=>{y.type===u?(f=!0,h.push(y)):(m(),d.push(y))}),m(),f?V.from(d):c}function o(c){let u=s(c),d=u!==c;const h=[];return u.forEach(f=>{if(f.type===cn.type(r)){const m=i(f);m!==f&&(d=!0),h.push(m)}else if(f.childCount>0){const m=o(f.content);m!==f.content?(d=!0,h.push(f.copy(m))):h.push(f)}else h.push(f)}),d?V.from(h):c}function a(c){const u=[],d=[];c.forEach(h=>d.push(h));for(let h=0;h<d.length;h++){const f=d[h],m=d[h+1];f.type===Or.type(r)&&f.content.size===0&&m&&m.type===cn.type(r)||u.push(f)}return u.length<d.length?V.from(u):c}let l=o(e.content);return l=a(l),new re(V.from(l),e.openStart,e.openEnd)}}));de(Y3,{displayName:"PasteRule<table>",group:"Table"});var sm=Qt("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:r=>{const e=r.get(oe);return()=>e.call(em.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:r=>{const e=r.get(oe);return()=>e.call(Qp.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:r=>{const e=r.get(oe);return()=>e.call(tm.key)}}});de(sm.ctx,{displayName:"KeymapCtx<table>",group:"Table"});de(sm.shortcuts,{displayName:"Keymap<table>",group:"Table"});var Ed="footnote_definition",Kg="footnoteDefinition",om=Ve("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${Ed}"]`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw dn(r);return{label:r.dataset.label}},contentElement:"dd"}],toDOM:r=>{const e=r.attrs.label;return["dl",{"data-label":e,"data-type":Ed},["dt",e],["dd",0]]},parseMarkdown:{match:({type:r})=>r===Kg,runner:(r,e,t)=>{r.openNode(t,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:r=>r.type.name===Ed,runner:(r,e)=>{r.openNode(Kg,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));de(om.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});de(om.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var Dd="footnote_reference",am=Ve("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${Dd}"]`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw dn(r);return{label:r.dataset.label}}}],toDOM:r=>{const e=r.attrs.label;return["sup",{"data-label":e,"data-type":Dd},e]},parseMarkdown:{match:({type:r})=>r==="footnoteReference",runner:(r,e,t)=>{r.addNode(t,{label:e.label})}},toMarkdown:{match:r=>r.type.name===Dd,runner:(r,e)=>{r.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));de(am.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});de(am.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var lm=zr.extendSchema(r=>e=>{const t=r(e);return{...t,attrs:{...t.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:n=>{if(!(n instanceof HTMLElement))throw dn(n);return{label:n.dataset.label,listType:n.dataset.listType,spread:n.dataset.spread==="true",checked:n.dataset.checked?n.dataset.checked==="true":null}}},...(t==null?void 0:t.parseDOM)||[]],toDOM:n=>t.toDOM&&n.attrs.checked==null?t.toDOM(n):["li",{"data-item-type":"task","data-label":n.attrs.label,"data-list-type":n.attrs.listType,"data-spread":n.attrs.spread,"data-checked":n.attrs.checked},0],parseMarkdown:{match:({type:n})=>n==="listItem",runner:(n,i,s)=>{if(i.checked==null){t.parseMarkdown.runner(n,i,s);return}const o=i.label!=null?`${i.label}.`:"•",a=i.checked!=null?!!i.checked:null,l=i.label!=null?"ordered":"bullet",c=i.spread??!0;n.openNode(s,{label:o,listType:l,spread:c,checked:a}),n.next(i.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="list_item",runner:(n,i)=>{if(i.attrs.checked==null){t.toMarkdown.runner(n,i);return}const s=i.attrs.label,o=i.attrs.listType,a=i.attrs.spread,l=i.attrs.checked;n.openNode("listItem",void 0,{label:s,listType:o,spread:a,checked:l}),n.next(i.content),n.closeNode()}}}});de(lm.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});de(lm.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var X3=wt(()=>new _t(/^\[(?<checked>\s|x)\]\s$/,(r,e,t,n)=>{var u;const i=r.doc.resolve(t);let s=0,o=i.node(s);for(;o&&o.type.name!=="list_item";)s--,o=i.node(s);if(!o||o.attrs.checked!=null)return null;const a=((u=e.groups)==null?void 0:u.checked)==="x",l=i.before(s),c=r.tr;return c.deleteRange(t,n).setNodeMarkup(l,void 0,{...o.attrs,checked:a}),c}));de(X3,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var kC=[Xp,sm].flat(),xC=[J3,X3],SC=[V3],CC=[Y3],Z3=qe(()=>gC);de(Z3,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var MC=qe(()=>kS({}));de(MC,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var Q3=qe(()=>OS({allowTableNodeSelection:!0}));de(Q3,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var cm=er("remarkGFM",()=>L7);de(cm.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});de(cm.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var TC=new De("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function AC(r,e){let t=0;return e.forEach((n,i,s)=>{n===r&&(t=s)}),t}function NC(r,e){const t=r.content.findDiffStart(e.content);if(t==null)return null;const n=r.content.findDiffEnd(e.content);return n?{from:t,to:Math.max(n.b,t)}:null}var e6=qe(()=>new Ae({key:TC,appendTransaction:(r,e,t)=>{if(e.doc===t.doc)return;const n=NC(e.doc,t.doc);if(!n)return;let i;const s=(o,a)=>{if(o.type.name!=="table_cell")return;const l=t.doc.resolve(a),c=l.node(l.depth),u=l.node(l.depth-1).firstChild;if(!u)return;const d=AC(o,c),h=u.maybeChild(d);if(!h)return;const f=h.attrs.alignment;f!==o.attrs.alignment&&(i||(i=t.tr),i.setNodeMarkup(a,void 0,{...o.attrs,alignment:f}))};return t.doc.nodesBetween(n.from,n.to,(o,a)=>o.type.name!=="table"?!0:(t.doc.nodesBetween(a,a+o.nodeSize,s),!1)),i}}));de(e6,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var EC=[e6,Z3,cm,Q3].flat(),DC=[lm,cn,Ec,Sa,Ps,Ca,om,am,Yp,xa].flat(),OC=[em,Qp,tm,K3,wu,ku,Pn,Fn,G3,xl,nm,Su,rm,xu,im,bu],RC=[DC,xC,CC,SC,kC,OC,EC].flat();const IC=/["&'<>`]/g,zC=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,LC=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,BC=/[|\\{}()[\]^$+*?.]/g,Gg=new WeakMap;function PC(r,e){if(r=r.replace(e.subset?FC(e.subset):IC,n),e.subset||e.escapeOnly)return r;return r.replace(zC,t).replace(LC,n);function t(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function n(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function FC(r){let e=Gg.get(r);return e||(e=$C(r),Gg.set(r,e)),e}function $C(r){const e=[];let t=-1;for(;++t<r.length;)e.push(r[t].replace(BC,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function qC(r){return"&#x"+r.toString(16).toUpperCase()+";"}function HC(r,e){return PC(r,Object.assign({format:qC},e))}const _C={}.hasOwnProperty,jC={},Jg=/^[^\t\n\r "#'.<=>`}]+$/,VC=/^[^\t\n\r "'<=>`}]+$/;function t6(){return{canContainEols:["textDirective"],enter:{directiveContainer:UC,directiveContainerAttributes:Rd,directiveContainerLabel:JC,directiveLeaf:KC,directiveLeafAttributes:Rd,directiveText:GC,directiveTextAttributes:Rd},exit:{directiveContainer:Fd,directiveContainerAttributeClassValue:zd,directiveContainerAttributeIdValue:Id,directiveContainerAttributeName:Bd,directiveContainerAttributeValue:Ld,directiveContainerAttributes:Pd,directiveContainerLabel:YC,directiveContainerName:Od,directiveLeaf:Fd,directiveLeafAttributeClassValue:zd,directiveLeafAttributeIdValue:Id,directiveLeafAttributeName:Bd,directiveLeafAttributeValue:Ld,directiveLeafAttributes:Pd,directiveLeafName:Od,directiveText:Fd,directiveTextAttributeClassValue:zd,directiveTextAttributeIdValue:Id,directiveTextAttributeName:Bd,directiveTextAttributeValue:Ld,directiveTextAttributes:Pd,directiveTextName:Od}}}function WC(r){const e=r||jC;if(e.quote!=='"'&&e.quote!=="'"&&e.quote!==null&&e.quote!==void 0)throw new Error("Invalid quote `"+e.quote+"`, expected `'` or `\"`");return t.peek=XC,{handlers:{containerDirective:t,leafDirective:t,textDirective:t},unsafe:[{character:"\r",inConstruct:["leafDirectiveLabel","containerDirectiveLabel"]},{character:`
35
35
  `,inConstruct:["leafDirectiveLabel","containerDirectiveLabel"]},{after:"[^\\s\\p{P}\\p{S}]",before:"[^:]",character:":",inConstruct:["phrasing"],unicode:!0},{afterNode:"textDirective",character:":",inConstruct:["phrasing"]},{atBreak:!0,before:":+",character:":"}]};function t(s,o,a,l){const c=a.createTracker(l),u=ZC(s),d=a.enter(s.type);let h=c.move(u+(s.name||""));const f=n(s,a),m=l.after.charCodeAt(0);let y;if(s.type==="containerDirective"){const b=(s.children||[])[0];y=Yg(b)?b:void 0}else y=s;if(y&&y.children&&y.children.length>0){const b=a.enter("label"),v=`${s.type}Label`,k=a.enter(v);h+=c.move("["),h+=c.move(a.containerPhrasing(y,{...c.current(),before:h,after:"]"})),h+=c.move("]"),k(),b()}else!f&&(m===45||m===95||!(ol(m)||al(m)))&&(h+=c.move("[]"));if(h+=c.move(f||(m===123?"{}":"")),s.type==="containerDirective"){const b=(s.children||[])[0];let v=s;Yg(b)&&(v=Object.assign({},s,{children:s.children.slice(1)})),v&&v.children&&v.children.length>0&&(h+=c.move(`
@@ -1228,4 +1228,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1228
1228
  fill: hsl(var(--muted-foreground)) !important;
1229
1229
  stroke: hsl(var(--muted-foreground)) !important;
1230
1230
  }
1231
- `,hz={look:"classic",fontFamily:"var(--font-sans)",themeCSS:dz},fz=()=>U7(()=>import("./mermaid.core-zxW6MBr-.js").then(r=>r.bm),__vite__mapDeps([0,1,2,3])).then(r=>(r.default.initialize(hz),r));function pz({value:r,editable:e,onChange:t,className:n,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l}){const c=V7();return L.jsx("div",{"data-theme":c,className:"dorkos-markdown contents",children:L.jsx(cz,{value:r,theme:c,editable:e,onChange:t,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l,mermaid:fz,className:W7("desktop:select-text",n)})})}const bz=Object.freeze(Object.defineProperty({__proto__:null,BlintzCanvas:pz},Symbol.toStringTag,{value:"Module"}));export{bz as B,G0 as S,nD as a,rD as b,sD as c,UE as f,J0 as i,Iv as p,wv as r,J4 as t};
1231
+ `,hz={look:"classic",fontFamily:"var(--font-sans)",themeCSS:dz},fz=()=>U7(()=>import("./mermaid.core-DNuzxE7q.js").then(r=>r.bm),__vite__mapDeps([0,1,2,3])).then(r=>(r.default.initialize(hz),r));function pz({value:r,editable:e,onChange:t,className:n,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l}){const c=V7();return L.jsx("div",{"data-theme":c,className:"dorkos-markdown contents",children:L.jsx(cz,{value:r,theme:c,editable:e,onChange:t,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l,mermaid:fz,className:W7("desktop:select-text",n)})})}const bz=Object.freeze(Object.defineProperty({__proto__:null,BlintzCanvas:pz},Symbol.toStringTag,{value:"Module"}));export{bz as B,G0 as S,nD as a,rD as b,sD as c,UE as f,J0 as i,Iv as p,wv as r,J4 as t};