@notectl/core 2.4.0 → 2.4.2

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 (485) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -1
  3. package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -1
  4. package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -1
  5. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +1 -1
  6. package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -1
  7. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
  8. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
  9. package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
  10. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -1
  11. package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -1
  12. package/dist/chunks/{CaretNavigationPlugin-BxWjR7SN.mjs → CaretNavigationPlugin-BQPqqK4n.mjs} +2 -2
  13. package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs.map +1 -0
  14. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +2 -0
  15. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs.map +1 -0
  16. package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
  17. package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -1
  18. package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -1
  19. package/dist/chunks/Commands-Bk7Cl1nH.mjs +2 -0
  20. package/dist/chunks/Commands-Bk7Cl1nH.mjs.map +1 -0
  21. package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
  22. package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
  23. package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -1
  24. package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -1
  25. package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -1
  26. package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
  27. package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -1
  28. package/dist/chunks/{DocumentParser-BKUrtgw1.mjs → DocumentParser-C99N0MWF.mjs} +2 -2
  29. package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +1 -0
  30. package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
  31. package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
  32. package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -1
  33. package/dist/chunks/{FontSizePlugin-BQ9Aj8cT.mjs → FontSizePlugin-Dswra3oU.mjs} +2 -2
  34. package/dist/chunks/FontSizePlugin-Dswra3oU.mjs.map +1 -0
  35. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +2 -0
  36. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs.map +1 -0
  37. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -1
  38. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -1
  39. package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -1
  40. package/dist/chunks/{HardBreakPlugin-svNnJ9Xj.mjs → HardBreakPlugin-gjCq8prD.mjs} +2 -2
  41. package/dist/chunks/HardBreakPlugin-gjCq8prD.mjs.map +1 -0
  42. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -1
  43. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -1
  44. package/dist/chunks/{HorizontalRulePlugin-CQ5NT2Mo.mjs → HorizontalRulePlugin-YywXVZYr.mjs} +2 -2
  45. package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs.map +1 -0
  46. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +2 -0
  47. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs.map +1 -0
  48. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -1
  49. package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -1
  50. package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
  51. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +2 -0
  52. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +1 -0
  53. package/dist/chunks/{ListPlugin-DTgpvBEt.mjs → ListPlugin-U1r4p_fE.mjs} +2 -2
  54. package/dist/chunks/ListPlugin-U1r4p_fE.mjs.map +1 -0
  55. package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -1
  56. package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
  57. package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +1 -1
  58. package/dist/chunks/{MarkdownParser-CvYOvU3d.mjs → MarkdownParser-uX1p_GQk.mjs} +2 -2
  59. package/dist/chunks/MarkdownParser-uX1p_GQk.mjs.map +1 -0
  60. package/dist/chunks/{MarkdownSerializer-CdUBWWGI.mjs → MarkdownSerializer--MrgJTdJ.mjs} +2 -2
  61. package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs.map +1 -0
  62. package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
  63. package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -1
  64. package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -1
  65. package/dist/chunks/{NodeSelectionCommands-B0Sb4ux4.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
  66. package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
  67. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
  68. package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
  69. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +1 -1
  70. package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
  71. package/dist/chunks/PopupManager-Dxv0OVMo.mjs +2 -0
  72. package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +1 -0
  73. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  74. package/dist/chunks/{PrintPlugin-BxNlFk2c.mjs → PrintPlugin-DAEiEyKQ.mjs} +2 -2
  75. package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs.map +1 -0
  76. package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -1
  77. package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -1
  78. package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -1
  79. package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
  80. package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs +2 -0
  81. package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs.map +1 -0
  82. package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -1
  83. package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -1
  84. package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
  85. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +1 -1
  86. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +2 -0
  87. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs.map +1 -0
  88. package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
  89. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +1 -1
  90. package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -1
  91. package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
  92. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +1 -1
  93. package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
  94. package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -1
  95. package/dist/chunks/{TablePlugin-WPwp902E.mjs → TablePlugin-CjKThPug.mjs} +2 -2
  96. package/dist/chunks/TablePlugin-CjKThPug.mjs.map +1 -0
  97. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -1
  98. package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +1 -1
  99. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +1 -1
  100. package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +1 -1
  101. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +1 -1
  102. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
  103. package/dist/chunks/{ToolbarPlugin-DmVI7MN9.mjs → ToolbarPlugin-CgZA2hz8.mjs} +2 -2
  104. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +1 -0
  105. package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
  106. package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
  107. package/dist/chunks/{VideoPlugin-D3zGQ6QV.mjs → VideoPlugin-DJXfuNA9.mjs} +2 -2
  108. package/dist/chunks/VideoPlugin-DJXfuNA9.mjs.map +1 -0
  109. package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
  110. package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
  111. package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
  112. package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
  113. package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
  114. package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
  115. package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
  116. package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
  117. package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
  118. package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
  119. package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
  120. package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
  121. package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
  122. package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
  123. package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
  124. package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
  125. package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
  126. package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
  127. package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
  128. package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
  129. package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
  130. package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
  131. package/dist/chunks/ar-DhwCFHql.mjs +2 -0
  132. package/dist/chunks/ar-DhwCFHql.mjs.map +1 -0
  133. package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
  134. package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
  135. package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
  136. package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
  137. package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
  138. package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
  139. package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -1
  140. package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
  141. package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
  142. package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
  143. package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
  144. package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
  145. package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
  146. package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
  147. package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
  148. package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
  149. package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
  150. package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
  151. package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
  152. package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
  153. package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
  154. package/dist/chunks/de-CjLUbQmg.mjs +2 -0
  155. package/dist/chunks/de-CjLUbQmg.mjs.map +1 -0
  156. package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
  157. package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
  158. package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
  159. package/dist/chunks/de-DViI26lG.mjs.map +1 -1
  160. package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
  161. package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
  162. package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
  163. package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
  164. package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
  165. package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
  166. package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
  167. package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
  168. package/dist/chunks/es-B0Za939C.mjs.map +1 -1
  169. package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
  170. package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
  171. package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
  172. package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
  173. package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
  174. package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
  175. package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
  176. package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
  177. package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
  178. package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
  179. package/dist/chunks/es-CMSzvjOT.mjs +2 -0
  180. package/dist/chunks/es-CMSzvjOT.mjs.map +1 -0
  181. package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
  182. package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
  183. package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
  184. package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
  185. package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
  186. package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
  187. package/dist/chunks/es-DFokqQst.mjs.map +1 -1
  188. package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
  189. package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
  190. package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
  191. package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
  192. package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
  193. package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
  194. package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
  195. package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
  196. package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
  197. package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
  198. package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
  199. package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
  200. package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
  201. package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
  202. package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
  203. package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
  204. package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
  205. package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
  206. package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
  207. package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
  208. package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
  209. package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
  210. package/dist/chunks/fr-DB_OvHWH.mjs +2 -0
  211. package/dist/chunks/fr-DB_OvHWH.mjs.map +1 -0
  212. package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
  213. package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
  214. package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
  215. package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
  216. package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
  217. package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
  218. package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
  219. package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
  220. package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
  221. package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
  222. package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
  223. package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
  224. package/dist/chunks/full-BsWAZr1w.mjs +2 -0
  225. package/dist/chunks/full-BsWAZr1w.mjs.map +1 -0
  226. package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
  227. package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
  228. package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
  229. package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
  230. package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
  231. package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
  232. package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
  233. package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
  234. package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
  235. package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
  236. package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
  237. package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
  238. package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
  239. package/dist/chunks/hi-ChNQZZ1z.mjs +2 -0
  240. package/dist/chunks/hi-ChNQZZ1z.mjs.map +1 -0
  241. package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
  242. package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
  243. package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
  244. package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
  245. package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
  246. package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
  247. package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
  248. package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
  249. package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
  250. package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
  251. package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
  252. package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
  253. package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
  254. package/dist/chunks/minimal-DO7LiFTa.mjs.map +1 -1
  255. package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
  256. package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
  257. package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
  258. package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
  259. package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
  260. package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
  261. package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
  262. package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
  263. package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
  264. package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
  265. package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
  266. package/dist/chunks/pt-CI8t6oul.mjs +2 -0
  267. package/dist/chunks/pt-CI8t6oul.mjs.map +1 -0
  268. package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
  269. package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
  270. package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
  271. package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
  272. package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
  273. package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
  274. package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
  275. package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
  276. package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
  277. package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
  278. package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
  279. package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
  280. package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
  281. package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
  282. package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
  283. package/dist/chunks/register-DXLu8Njp.mjs +3 -0
  284. package/dist/chunks/register-DXLu8Njp.mjs.map +1 -0
  285. package/dist/chunks/ru-9WtNGZtl.mjs +2 -0
  286. package/dist/chunks/ru-9WtNGZtl.mjs.map +1 -0
  287. package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
  288. package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
  289. package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
  290. package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
  291. package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
  292. package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
  293. package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
  294. package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
  295. package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
  296. package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
  297. package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
  298. package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
  299. package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
  300. package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
  301. package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
  302. package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
  303. package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
  304. package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
  305. package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
  306. package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
  307. package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
  308. package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
  309. package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
  310. package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
  311. package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
  312. package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
  313. package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -1
  314. package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
  315. package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
  316. package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
  317. package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
  318. package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
  319. package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
  320. package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
  321. package/dist/chunks/zh-BrqJ4ywP.mjs +2 -0
  322. package/dist/chunks/zh-BrqJ4ywP.mjs.map +1 -0
  323. package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
  324. package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
  325. package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
  326. package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
  327. package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
  328. package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
  329. package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
  330. package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
  331. package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
  332. package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
  333. package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
  334. package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
  335. package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
  336. package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
  337. package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
  338. package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
  339. package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
  340. package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
  341. package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
  342. package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
  343. package/dist/commands/BlockInsertion.d.ts +15 -19
  344. package/dist/commands/BlockInsertion.d.ts.map +1 -1
  345. package/dist/commands/PasteCommand.d.ts.map +1 -1
  346. package/dist/commands/SelectionDeletion.d.ts +7 -5
  347. package/dist/commands/SelectionDeletion.d.ts.map +1 -1
  348. package/dist/commands/SelectionReplacement.d.ts +42 -0
  349. package/dist/commands/SelectionReplacement.d.ts.map +1 -0
  350. package/dist/editor/BlockIdentity.d.ts +16 -0
  351. package/dist/editor/BlockIdentity.d.ts.map +1 -0
  352. package/dist/editor/ContentSerializer.d.ts +13 -11
  353. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  354. package/dist/editor/NotectlEditor.d.ts +6 -5
  355. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  356. package/dist/editor/styles/link.d.ts +3 -0
  357. package/dist/editor/styles/link.d.ts.map +1 -0
  358. package/dist/fonts/math.mjs +1 -1
  359. package/dist/full.mjs +1 -1
  360. package/dist/html.mjs +1 -1
  361. package/dist/index.d.ts +1 -1
  362. package/dist/index.d.ts.map +1 -1
  363. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  364. package/dist/input/PasteHandler.d.ts.map +1 -1
  365. package/dist/input/PasteRichBlockHandler.d.ts +10 -17
  366. package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
  367. package/dist/markdown.mjs +1 -1
  368. package/dist/model/ContentModel.d.ts +6 -1
  369. package/dist/model/ContentModel.d.ts.map +1 -1
  370. package/dist/model/FileHandlerDispatcher.d.ts +3 -1
  371. package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
  372. package/dist/model/FileHandlerRegistry.d.ts +11 -2
  373. package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
  374. package/dist/notectl-core.mjs +1 -1
  375. package/dist/notectl-core.umd.js +1 -1
  376. package/dist/notectl-core.umd.js.map +1 -1
  377. package/dist/plugins/caret-navigation.mjs +1 -1
  378. package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
  379. package/dist/plugins/code-block.mjs +1 -1
  380. package/dist/plugins/font-size.mjs +1 -1
  381. package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
  382. package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
  383. package/dist/plugins/formula.mjs +1 -1
  384. package/dist/plugins/hard-break.mjs +1 -1
  385. package/dist/plugins/horizontal-rule.mjs +1 -1
  386. package/dist/plugins/image/ImageCommands.d.ts +15 -3
  387. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  388. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  389. package/dist/plugins/image.mjs +1 -1
  390. package/dist/plugins/link/LinkInteractionController.d.ts +26 -0
  391. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
  392. package/dist/plugins/link/LinkLocale.d.ts +7 -1
  393. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  394. package/dist/plugins/link/LinkNavigation.d.ts +12 -0
  395. package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
  396. package/dist/plugins/link/LinkPlugin.d.ts +4 -4
  397. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  398. package/dist/plugins/link/LinkPreview.d.ts +28 -0
  399. package/dist/plugins/link/LinkPreview.d.ts.map +1 -0
  400. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  401. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  402. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  403. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  404. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  405. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  406. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  407. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  408. package/dist/plugins/link.mjs +1 -1
  409. package/dist/plugins/list.mjs +1 -1
  410. package/dist/plugins/print.mjs +1 -1
  411. package/dist/plugins/shared/PopupManager.d.ts +5 -0
  412. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  413. package/dist/plugins/shared.mjs +1 -1
  414. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
  415. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
  416. package/dist/plugins/smart-paste.mjs +1 -1
  417. package/dist/plugins/table.mjs +1 -1
  418. package/dist/plugins/text-direction.mjs +1 -1
  419. package/dist/plugins/toolbar.mjs +1 -1
  420. package/dist/plugins/video.mjs +1 -1
  421. package/dist/presets/full.mjs +1 -1
  422. package/dist/presets.mjs +1 -1
  423. package/dist/register.mjs +1 -1
  424. package/dist/state/History.d.ts.map +1 -1
  425. package/dist/state/StepApplication.d.ts.map +1 -1
  426. package/dist/state/Steps.d.ts +3 -0
  427. package/dist/state/Steps.d.ts.map +1 -1
  428. package/dist/state/StructuralPositions.d.ts +15 -0
  429. package/dist/state/StructuralPositions.d.ts.map +1 -0
  430. package/dist/state/TransactionBuilder.d.ts +6 -14
  431. package/dist/state/TransactionBuilder.d.ts.map +1 -1
  432. package/dist/test/TestUtils.d.ts.map +1 -1
  433. package/dist/view/EditorViewEvents.d.ts.map +1 -1
  434. package/package.json +8 -8
  435. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs +0 -2
  436. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs.map +0 -1
  437. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs.map +0 -1
  438. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +0 -2
  439. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs.map +0 -1
  440. package/dist/chunks/Commands-DBBCAYBn.mjs +0 -2
  441. package/dist/chunks/Commands-DBBCAYBn.mjs.map +0 -1
  442. package/dist/chunks/ContentModel-BLC3Tez8.mjs +0 -2
  443. package/dist/chunks/ContentModel-BLC3Tez8.mjs.map +0 -1
  444. package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +0 -1
  445. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +0 -1
  446. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +0 -2
  447. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +0 -1
  448. package/dist/chunks/HardBreakPlugin-svNnJ9Xj.mjs.map +0 -1
  449. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs.map +0 -1
  450. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +0 -2
  451. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +0 -1
  452. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs +0 -2
  453. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs.map +0 -1
  454. package/dist/chunks/ListPlugin-DTgpvBEt.mjs.map +0 -1
  455. package/dist/chunks/MarkdownParser-CvYOvU3d.mjs.map +0 -1
  456. package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +0 -1
  457. package/dist/chunks/NodeSelectionCommands-B0Sb4ux4.mjs.map +0 -1
  458. package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
  459. package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
  460. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs.map +0 -1
  461. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs +0 -2
  462. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs.map +0 -1
  463. package/dist/chunks/TablePlugin-WPwp902E.mjs.map +0 -1
  464. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +0 -1
  465. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +0 -1
  466. package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
  467. package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
  468. package/dist/chunks/de-JhGflzS5.mjs +0 -2
  469. package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
  470. package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
  471. package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
  472. package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
  473. package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
  474. package/dist/chunks/full-BiQ93ERr.mjs +0 -2
  475. package/dist/chunks/full-BiQ93ERr.mjs.map +0 -1
  476. package/dist/chunks/hi-Bu799xIO.mjs +0 -2
  477. package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
  478. package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
  479. package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
  480. package/dist/chunks/register-Cb1YTAN4.mjs +0 -3
  481. package/dist/chunks/register-Cb1YTAN4.mjs.map +0 -1
  482. package/dist/chunks/ru-BxySx7an.mjs +0 -2
  483. package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
  484. package/dist/chunks/zh-DuucmOns.mjs +0 -2
  485. package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TestUtils.d.ts","sourceRoot":"","sources":["../../src/test/TestUtils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AU;IAQlB,sDAAsD;IACtD,OAAO,CAAC,MAAM;YAiCA,mBAAmB;IAgBjC,yDAAyD;IACzD,OAAO,CAAC,oBAAoB;IAU5B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;CASjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notectl/core",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "A modern and accessible rich text editor shipped as a single Web Component. Immutable state, transaction-based architecture, and a plugin system that powers every feature.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -216,16 +216,16 @@
216
216
  "build:analyze": "ANALYZE=true vite build"
217
217
  },
218
218
  "dependencies": {
219
- "dompurify": "^3.4.13"
219
+ "dompurify": "^3.4.17"
220
220
  },
221
221
  "devDependencies": {
222
- "esbuild": "^0.28.1",
223
- "happy-dom": "^20.11.1",
222
+ "esbuild": "^0.28.2",
223
+ "happy-dom": "^21.0.4",
224
224
  "lightningcss": "^1.33.0",
225
- "rollup-plugin-visualizer": "^7.0.1",
226
- "terser": "^5.49.2",
227
- "vite": "^8.2.0",
225
+ "rollup-plugin-visualizer": "^7.1.1",
226
+ "terser": "^5.51.2",
227
+ "vite": "^8.3.5",
228
228
  "vite-plugin-dts": "^4.5.4",
229
- "vitest": "^4.1.11"
229
+ "vitest": "^4.1.12"
230
230
  }
231
231
  }
@@ -1,2 +0,0 @@
1
- import{c as t}from"./HTMLUtils-DTpsjZyK.mjs";import{B as n,E as e,K as r,L as o,R as s,g as i,j as c,k as a,p as f,q as u}from"./Document-ssR6hBzG.mjs";import{r as d}from"./NodeResolver-F4RtpoEd.mjs";import{c as l,d as p,i as h,n as m,p as g,u as y}from"./Selection-DC6AOGgF.mjs";import{a as I,r as b}from"./TypeBrands-Ch9856Gb.mjs";import{i as k}from"./NavigationQueries-CaKfccu7.mjs";import{t as v}from"./ContentModel-BLC3Tez8.mjs";function x(t,n){if(0===n.length)return t.doc.children;const e=t.getBlock(n[n.length-1]);return e?e.children:[]}function N(t,n){if(l(t))return{blockId:t.anchor.blockId,offset:t.anchor.offset};const e=g(t,n);return{blockId:e.from.blockId,offset:e.from.offset}}function j(t){return t&&t.length>1?t.slice(0,-1):[]}function B(t,n){return t.findIndex(t=>s(t)&&t.id===n)}function P(t,n){const e=j(d(t.doc,n)),r=x(t,e);return{parentPath:e,siblings:r,index:B(r,n)}}function A(t){if(n(t))return t.id;for(const n of t.children)if(s(n))return A(n);return t.id}function T(t){if(n(t))return t.id;for(let n=t.children.length-1;n>=0;n--){const e=t.children[n];if(e&&s(e))return T(e)}return t.id}function E(t,n,e){const r=t.getBlock(n);if(!r)return null;if(k(t,n)){const e=t.getNodePath(n);return e?h(n,e):null}const o="start"===e?A(r):T(r),s=t.getBlock(o);if(!s)return null;const i="start"===e?0:a(s);return m(o,i)}function S(t,n,e){const r=t.doc.children,o="start"===n?r.map((t,n)=>n):r.map((t,n)=>r.length-1-n);for(const i of o){const o=r[i];if(!o||!s(o))continue;if(void 0!==e&&o.id===e)continue;const c=E(t,o.id,n);if(c)return c}return null}function _(t,n,e){const r=j(d(t.doc,n)),o=B(x(t,r),n);if(!(o<0))return{parentPath:r,anchorIndex:o,isAnchorEmpty:V(t,n,e)}}function w(t,n,e,r){const o=d(t.doc,e);if(!o)return;const i=t.getBlock(e);return i?{parentPath:o,anchorIndex:i.children.findIndex(t=>s(t)&&t.id===n),isAnchorEmpty:V(t,n,r)}:void 0}function C(t,n){if("table_cell"===t.getBlock(n)?.type)return n;const e=d(t.doc,n);if(e)for(const r of e)if("table_cell"===t.getBlock(r)?.type)return r}function F(t){return p(t)?t.nodeId:y(t)?t.blockId:t.anchor.blockId}function L(t,n,e,r,o,s){const i=C(t,e);if(i){const o=w(t,e,i,s);if(!o)return!1;const c=o.anchorIndex+1;n.insertNode(o.parentPath,c,r),o.isAnchorEmpty&&o.anchorIndex>=0&&n.removeNode(o.parentPath,o.anchorIndex)}else{const i=_(t,e,s);if(!i)return!1;const c=y(o)&&"before"===o.side?0:1;n.insertNode(i.parentPath,i.anchorIndex+c,r),i.isAnchorEmpty&&!y(o)&&n.removeNode(i.parentPath,i.anchorIndex)}return!0}function M(t,n){const e=d(t.doc,n),r=e&&e.length>0?e[0]:n;return t.doc.children.findIndex(t=>t.id===r)}function O(t,n,e){return!n||e.every(e=>v(t,n,e.type))}function R(t,n){const e=M(t,n);if(-1!==e)return{parentPath:[],anchorIndex:e,isAnchorEmpty:!1}}function q(t){return"paragraph"===t.type&&0===a(t)}function z(t,n,e,r){return D(t,n,e,[r])}function D(t,n,e,r){if(0===r.length)return;const o=M(t,e);if(-1===o)return;const s=t.doc.children[o],i=t.doc.children[o+1];let c=o+1;for(const f of r)n.insertNode([],c,f),c++;const a=s&&k(t,s.id)&&i&&q(i)?i:void 0;let u;return a?u=a:(u=f(I("paragraph")),n.insertNode([],c,u)),s&&q(s)&&n.removeNode([],o),u}function H(t,n){const r=t.children.map(t=>s(t)?H(t,e()):t);return f(t.type,r,n,t.attrs,t.htmlId)}function K(t,n){if(t.id===n)return t;for(const e of t.children){if(!s(e))continue;const t=K(e,n);if(t)return t}}function Q(t,n,e=!1){if(!n)return;const r={};let o=!1;for(const s of Object.keys(n)){const i=n[s],c=t?.[s];"string"==typeof c||"number"==typeof c&&Number.isFinite(c)||"boolean"==typeof c?r[s]=c:e&&i.allowArray&&U(c)?r[s]=Object.freeze([...c]):void 0!==i.default&&(r[s]=i.default),s in r&&(o=!0)}return o?r:void 0}function U(t){return Array.isArray(t)&&t.every(t=>null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t&&Number.isFinite(t))}function V(t,n,e){const r=t.getBlock(n);return!!r&&!(e?.getNodeSpec(r.type))?.isVoid&&""===c(r)}function G(n,e){if(!n.type)return;if(!e)return n;const r=e.getNodeSpec(n.type);if(!r)return;const o=Q(n.attrs,r.attrs,!0),s=t(n.htmlId),i=n.segments?function(t,n){const e=[];for(const r of t){if("inline"===r.kind){const t=n.getInlineNodeSpec(r.inlineType);if(!t)continue;const o=Q(r.attrs,t.attrs);e.push({kind:"inline",inlineType:r.inlineType,...o?{attrs:o}:{}});continue}e.push(r)}return e}(n.segments,e):void 0,{htmlId:c,...a}=n;return{...a,...s?{htmlId:s}:{},...o?{attrs:o}:{},...i?{segments:i}:n.segments?{segments:[]}:{}}}function J(t){const n=e(),o=function(t){const n=Y(t);return 0===n.length?void 0:r(n)}(t),s=t.attrs?t.attrs:void 0;return f(I(t.type),o,n,s,t.htmlId)}function W(t,n){const e=[];for(const r of t){const t=G(r,n);t&&e.push(X(t))}return{blocks:e}}function X(t){const n=t.attrs?t.attrs:void 0;return{type:I(t.type),...n?{attrs:n}:{},segments:Y(t)}}function Y(t){if(t.segments&&t.segments.length>0)return function(t){const n=[];for(const e of t){if("inline"===e.kind){n.push(o(i(b(e.inlineType),e.attrs)));continue}if(0===e.text.length)continue;const t=e.marks.map(t=>({type:t.type,...t.attrs?{attrs:t.attrs}:{}}));n.push(u(e.text,t))}return n}(t.segments);const n=t.text??"";return n?[u(n)]:[]}export{x as C,B as S,P as T,E as _,C as a,A as b,D as c,w as d,R as f,G as g,Q as h,K as i,q as l,W as m,H as n,L as o,_ as p,J as r,z as s,O as t,F as u,S as v,N as w,T as x,j as y};
2
- //# sourceMappingURL=BlockInsertion-CxKdCKJd.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockInsertion-CxKdCKJd.mjs","names":[],"sources":["../../src/commands/CommandHelpers.ts","../../src/commands/BlockInsertion.ts"],"sourcesContent":["/**\n * Shared helpers used across multiple command modules.\n *\n * - {@link getSiblings} — resolves a parent path to its child list\n * - {@link resolveInsertPoint} — normalizes a text selection to a single insert position\n */\n\nimport type { BlockNode, ChildNode, Document } from '../model/Document.js';\nimport { getBlockLength, isBlockNode, isLeafBlock } from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tisCollapsed,\n\tselectionRange,\n} from '../model/Selection.js';\nimport type { EditorSelection, Selection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\n\n/** The resolved insert position within a single block. */\nexport interface InsertPoint {\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/** Resolves the children of a parent path: doc root or a nested block. */\nexport function getSiblings(\n\tstate: EditorState,\n\tparentPath: readonly BlockId[],\n): readonly ChildNode[] {\n\tif (parentPath.length === 0) return state.doc.children;\n\tconst parent: BlockNode | undefined = state.getBlock(\n\t\tparentPath[parentPath.length - 1] as BlockId,\n\t);\n\treturn parent ? parent.children : [];\n}\n\n/**\n * Normalizes a text selection to a single insert point.\n *\n * - Collapsed selection → anchor position.\n * - Range selection → normalized `from` position (document-order start).\n */\nexport function resolveInsertPoint(sel: Selection, blockOrder: readonly BlockId[]): InsertPoint {\n\tif (isCollapsed(sel)) {\n\t\treturn { blockId: sel.anchor.blockId, offset: sel.anchor.offset };\n\t}\n\tconst range = selectionRange(sel, blockOrder);\n\treturn { blockId: range.from.blockId, offset: range.from.offset };\n}\n\n/** Extracts the parent path from a full node path (all elements except the last). */\nexport function extractParentPath(path: readonly string[] | undefined): BlockId[] {\n\treturn path && path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n}\n\n/** Finds the index of a block by ID within a sibling list. */\nexport function findSiblingIndex(siblings: readonly ChildNode[], targetId: BlockId): number {\n\treturn siblings.findIndex((c) => isBlockNode(c) && c.id === targetId);\n}\n\n/** A block's parent path, its sibling list, and its index within that list. */\nexport interface SiblingContext {\n\treadonly parentPath: BlockId[];\n\treadonly siblings: readonly ChildNode[];\n\treadonly index: number;\n}\n\n/**\n * Resolves a node's parent path, sibling list, and index among its siblings.\n * `index` is `-1` when the node is not found; callers that require the node to\n * exist should guard on `index < 0`.\n */\nexport function resolveSiblingContext(state: EditorState, nodeId: BlockId): SiblingContext {\n\tconst parentPath: BlockId[] = extractParentPath(findNodePath(state.doc, nodeId));\n\tconst siblings: readonly ChildNode[] = getSiblings(state, parentPath);\n\tconst index: number = findSiblingIndex(siblings, nodeId);\n\treturn { parentPath, siblings, index };\n}\n\n/** Finds the first leaf block ID in a subtree. */\nexport function findFirstLeafBlockId(node: BlockNode): BlockId {\n\tif (isLeafBlock(node)) return node.id;\n\n\tfor (const child of node.children) {\n\t\tif (!isBlockNode(child)) continue;\n\t\treturn findFirstLeafBlockId(child);\n\t}\n\n\treturn node.id;\n}\n\n/** Finds the last leaf block ID in a subtree. */\nexport function findLastLeafBlockId(node: BlockNode): BlockId {\n\tif (isLeafBlock(node)) return node.id;\n\n\tfor (let i = node.children.length - 1; i >= 0; i--) {\n\t\tconst child = node.children[i];\n\t\tif (child && isBlockNode(child)) {\n\t\t\treturn findLastLeafBlockId(child);\n\t\t}\n\t}\n\n\treturn node.id;\n}\n\n/**\n * Resolves a valid editor selection at the start or end of a block subtree.\n * Void blocks become NodeSelections; text-capable blocks resolve to leaf cursors.\n */\nexport function createSelectionForBlockBoundary(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tboundary: 'start' | 'end',\n): EditorSelection | null {\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tif (isVoidBlock(state, blockId)) {\n\t\tconst path = state.getNodePath(blockId);\n\t\treturn path ? createNodeSelection(blockId, path) : null;\n\t}\n\n\tconst leafId: BlockId =\n\t\tboundary === 'start' ? findFirstLeafBlockId(block) : findLastLeafBlockId(block);\n\tconst leaf = state.getBlock(leafId);\n\tif (!leaf) return null;\n\n\tconst offset = boundary === 'start' ? 0 : getBlockLength(leaf);\n\treturn createCollapsedSelection(leafId, offset);\n}\n\n/**\n * Resolves a valid editor selection anywhere in the document, starting from\n * the first (or last) top-level block and deferring per-block resolution to\n * {@link createSelectionForBlockBoundary}. Useful as a last-resort fallback\n * after deletions when neighbouring siblings cannot provide a selection.\n *\n * @param state The editor state to query.\n * @param boundary `'start'` walks document order; `'end'` walks reverse.\n * @param excludeBlockId Optional block id to skip (e.g. the block about to\n * be removed by the caller's transaction).\n * @returns A valid selection, or `null` if no selectable block exists.\n */\nexport function createSelectionForDocumentBoundary(\n\tstate: EditorState,\n\tboundary: 'start' | 'end',\n\texcludeBlockId?: BlockId,\n): EditorSelection | null {\n\tconst children: readonly ChildNode[] = state.doc.children;\n\tconst indices: readonly number[] =\n\t\tboundary === 'start'\n\t\t\t? children.map((_, i) => i)\n\t\t\t: children.map((_, i) => children.length - 1 - i);\n\n\tfor (const i of indices) {\n\t\tconst child = children[i];\n\t\tif (!child || !isBlockNode(child)) continue;\n\t\tif (excludeBlockId !== undefined && child.id === excludeBlockId) continue;\n\n\t\tconst sel = createSelectionForBlockBoundary(state, child.id, boundary);\n\t\tif (sel) return sel;\n\t}\n\n\treturn null;\n}\n\n/** Returns the root-level block IDs in document order. */\nexport function getRootBlockIds(doc: Document): readonly BlockId[] {\n\treturn doc.children.map((child) => child.id);\n}\n","/**\n * Block insertion utilities for paste/clipboard operations and block-object\n * commands (table, image, horizontal rule, display formula).\n *\n * Provides context resolution (parent path, anchor index, empty detection)\n * for inserting blocks into the document tree — both at root level and\n * inside table cells — plus the shared primitive that drops a block-level\n * object onto its own line. Also contains pure helpers for block cloning,\n * recursive lookup, and attribute sanitization against a NodeSpec.\n */\n\nimport { canContain } from '../model/ContentModel.js';\nimport type { ContentSlice, SliceBlock } from '../model/ContentSlice.js';\nimport {\n\ttype BlockAttrArrayValue,\n\ttype BlockAttrValue,\n\ttype BlockAttrs,\n\ttype BlockNode,\n\ttype ChildNode,\n\ttype ContentSegment,\n\ttype InlineNode,\n\ttype Mark,\n\ttype TextNode,\n\tcreateBlockNode,\n\tcreateInlineNode,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tgetBlockText,\n\tinlineSegment,\n\tisBlockNode,\n\tsegmentsToInlineChildren,\n\ttextSegment,\n} from '../model/Document.js';\nimport { normalizeHTMLId } from '../model/HTMLUtils.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { AttrSpec } from '../model/NodeSpec.js';\nimport type { RichBlockData, RichSegment } from '../model/RichBlockData.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport type { EditorSelection } from '../model/Selection.js';\nimport { isGapCursor, isNodeSelection } from '../model/Selection.js';\nimport type { BlockId, NodeTypeName } from '../model/TypeBrands.js';\nimport { inlineType, nodeType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\nimport { extractParentPath, findSiblingIndex, getSiblings } from './CommandHelpers.js';\n\n/**\n * Resolved insertion target within the document tree.\n * Contains everything needed to insert blocks at a specific anchor position.\n */\nexport interface InsertionContext {\n\treadonly parentPath: readonly BlockId[];\n\treadonly anchorIndex: number;\n\treadonly isAnchorEmpty: boolean;\n}\n\n/**\n * Resolves an insertion context for root-level (or nested-parent-level) insertion.\n * Computes the parent path, anchor index among siblings, and whether the anchor is empty.\n */\nexport function resolveRootInsertionContext(\n\tstate: EditorState,\n\tanchorBlockId: BlockId,\n\tschemaRegistry?: SchemaRegistry,\n): InsertionContext | undefined {\n\tconst path: readonly string[] | undefined = findNodePath(state.doc, anchorBlockId);\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\n\tconst siblings: readonly ChildNode[] = getSiblings(state, parentPath);\n\tconst anchorIndex: number = findSiblingIndex(siblings, anchorBlockId);\n\tif (anchorIndex < 0) return undefined;\n\n\tconst isAnchorEmpty: boolean = isBlockEmpty(state, anchorBlockId, schemaRegistry);\n\treturn { parentPath, anchorIndex, isAnchorEmpty };\n}\n\n/**\n * Resolves an insertion context within a table cell.\n * The parent path points to the cell itself; siblings are the cell's children.\n */\nexport function resolveCellInsertionContext(\n\tstate: EditorState,\n\tanchorBlockId: BlockId,\n\tcellId: BlockId,\n\tschemaRegistry?: SchemaRegistry,\n): InsertionContext | undefined {\n\tconst cellPath: BlockId[] | undefined = findNodePath(state.doc, cellId) as BlockId[] | undefined;\n\tif (!cellPath) return undefined;\n\n\tconst cell: BlockNode | undefined = state.getBlock(cellId);\n\tif (!cell) return undefined;\n\n\tconst anchorIndex: number = cell.children.findIndex(\n\t\t(c) => isBlockNode(c) && c.id === anchorBlockId,\n\t);\n\n\tconst isAnchorEmpty: boolean = isBlockEmpty(state, anchorBlockId, schemaRegistry);\n\treturn { parentPath: cellPath, anchorIndex, isAnchorEmpty };\n}\n\n/**\n * Finds a table_cell ancestor for the given block.\n * Walks the node path upward, returning the first table_cell BlockId found.\n */\nexport function findTableCellAncestor(state: EditorState, blockId: BlockId): BlockId | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\tif (block?.type === 'table_cell') return blockId;\n\n\tconst path: BlockId[] | undefined = findNodePath(state.doc, blockId) as BlockId[] | undefined;\n\tif (!path) return undefined;\n\n\tfor (const id of path) {\n\t\tconst node: BlockNode | undefined = state.getBlock(id as BlockId);\n\t\tif (node?.type === 'table_cell') return id as BlockId;\n\t}\n\treturn undefined;\n}\n\n/**\n * Resolves the anchor block ID from the current editor selection.\n * Handles text selection, node selection, and gap cursor uniformly.\n */\nexport function resolveAnchorBlockId(selection: EditorSelection): BlockId {\n\tif (isNodeSelection(selection)) return selection.nodeId;\n\tif (isGapCursor(selection)) return selection.blockId;\n\treturn selection.anchor.blockId;\n}\n\n/**\n * Inserts a block node after the anchor position, resolving cell vs root context.\n * Removes the anchor block if it is empty (matching standard paste behavior).\n * Returns true on success, false if context resolution fails.\n */\nexport function insertBlockAfterAnchor(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\tblock: BlockNode,\n\tselection: EditorSelection,\n\tschemaRegistry?: SchemaRegistry,\n): boolean {\n\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\n\tif (cellId) {\n\t\tconst ctx: InsertionContext | undefined = resolveCellInsertionContext(\n\t\t\tstate,\n\t\t\tanchorBlockId,\n\t\t\tcellId,\n\t\t\tschemaRegistry,\n\t\t);\n\t\tif (!ctx) return false;\n\n\t\tconst insertIndex: number = ctx.anchorIndex + 1;\n\t\tbuilder.insertNode(ctx.parentPath, insertIndex, block);\n\n\t\tif (ctx.isAnchorEmpty && ctx.anchorIndex >= 0) {\n\t\t\tbuilder.removeNode(ctx.parentPath, ctx.anchorIndex);\n\t\t}\n\t} else {\n\t\tconst ctx: InsertionContext | undefined = resolveRootInsertionContext(\n\t\t\tstate,\n\t\t\tanchorBlockId,\n\t\t\tschemaRegistry,\n\t\t);\n\t\tif (!ctx) return false;\n\n\t\tconst insertOffset: number = isGapCursor(selection) && selection.side === 'before' ? 0 : 1;\n\t\tbuilder.insertNode(ctx.parentPath, ctx.anchorIndex + insertOffset, block);\n\n\t\tif (ctx.isAnchorEmpty && !isGapCursor(selection)) {\n\t\t\tbuilder.removeNode(ctx.parentPath, ctx.anchorIndex);\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Document-root index of the top-level block that contains `blockId` — the block\n * itself when it already lives at the document root. Returns -1 when the block is\n * not part of the document. Block-level objects always live at the root, so an\n * insertion triggered from inside a container (e.g. a table cell) escapes to the\n * top level via this lookup.\n */\nexport function topLevelBlockIndex(state: EditorState, blockId: BlockId): number {\n\tconst path: readonly string[] | undefined = findNodePath(state.doc, blockId);\n\tconst topId: BlockId = path && path.length > 0 ? (path[0] as BlockId) : blockId;\n\treturn state.doc.children.findIndex((b) => b.id === topId);\n}\n\n/**\n * True when a container of `containerType` may hold every block in `blocks`,\n * per its {@link import('../model/NodeSpec.js').NodeSpec} content rule. An\n * undefined `containerType` denotes the document root, which imposes no\n * restriction. Used to keep paste from creating schema-invalid nesting, such as\n * a `table` dropped into a `table_cell` (#166).\n */\nexport function canContainerHoldBlocks(\n\tregistry: SchemaRegistry,\n\tcontainerType: string | undefined,\n\tblocks: readonly BlockNode[],\n): boolean {\n\tif (!containerType) return true;\n\treturn blocks.every((block) => canContain(registry, containerType, block.type));\n}\n\n/**\n * Insertion context that escapes to the document root: blocks are placed after\n * the top-level ancestor of `anchorBlockId` (e.g. the outer table when the caret\n * sits inside a cell). The anchor is never treated as empty, so the originating\n * container keeps its own content. Returns undefined when the anchor is not part\n * of the document.\n */\nexport function resolveRootEscapeContext(\n\tstate: EditorState,\n\tanchorBlockId: BlockId,\n): InsertionContext | undefined {\n\tconst topIndex: number = topLevelBlockIndex(state, anchorBlockId);\n\tif (topIndex === -1) return undefined;\n\treturn { parentPath: [], anchorIndex: topIndex, isAnchorEmpty: false };\n}\n\n/**\n * True when the block is a blank-line paragraph. Inline-aware: a paragraph that\n * holds only an atomic inline node (e.g. an inline formula) has width > 0 and is\n * therefore never treated as blank, so it is never silently removed.\n */\nexport function isEmptyParagraph(block: BlockNode): boolean {\n\treturn block.type === 'paragraph' && getBlockLength(block) === 0;\n}\n\n/**\n * Places a block-level object on its own line at the document root: the object\n * followed by a trailing empty paragraph, so a void/atomic object always has an\n * editable line after it. The object is inserted after the top-level ancestor of\n * the current selection; when that ancestor is a blank-line paragraph it is\n * consumed, so the object is never preceded by a stray empty paragraph (#152).\n *\n * Only an empty *paragraph* is consumed — an empty heading or list item is\n * deliberate structure — and the emptiness test is inline-aware (see\n * {@link isEmptyParagraph}). This is intentionally stricter than\n * {@link insertBlockAfterAnchor}, which the paste pipeline uses with a text-only\n * emptiness notion.\n *\n * A void anchor (image, display formula) already owns a trailing empty paragraph\n * as its escape line. In that case the object is placed before that paragraph and\n * the paragraph is reused as the object's trailing line, so a second blank line\n * never stacks up (#158).\n *\n * Selection is the caller's concern, since objects differ (a cursor inside a new\n * table vs. a node selection on an image or display formula). Returns the\n * trailing paragraph after the object, or undefined when the selection has no\n * resolvable anchor.\n */\nexport function insertBlockObjectOnOwnLine(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\tobject: BlockNode,\n): BlockNode | undefined {\n\treturn insertBlockObjectsOnOwnLines(state, builder, anchorBlockId, [object]);\n}\n\n/**\n * Places a sequence of block-level objects on their own lines at the document\n * root, sharing a single trailing empty paragraph. Generalizes\n * {@link insertBlockObjectOnOwnLine} for inserting several objects at once (e.g.\n * pasting two or more standalone formulas, #159); for a single object the two\n * behave identically. The anchor-consumption (#152) and void-anchor trailing\n * reuse (#158) rules apply once, around the whole run.\n *\n * Returns the trailing paragraph after the last object, or undefined when the\n * anchor or object list is empty.\n */\nexport function insertBlockObjectsOnOwnLines(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\tobjects: readonly BlockNode[],\n): BlockNode | undefined {\n\tif (objects.length === 0) return undefined;\n\n\tconst topIndex: number = topLevelBlockIndex(state, anchorBlockId);\n\tif (topIndex === -1) return undefined;\n\n\tconst anchor: BlockNode | undefined = state.doc.children[topIndex];\n\tconst following: BlockNode | undefined = state.doc.children[topIndex + 1];\n\n\tlet insertAt: number = topIndex + 1;\n\tfor (const object of objects) {\n\t\tbuilder.insertNode([], insertAt, object);\n\t\tinsertAt++;\n\t}\n\n\t// A void anchor already owns a trailing empty paragraph as its escape line;\n\t// reuse it so a second blank line never stacks up (#158). Otherwise add one.\n\tconst reusableTrailing: BlockNode | undefined =\n\t\tanchor && isVoidBlock(state, anchor.id) && following && isEmptyParagraph(following)\n\t\t\t? following\n\t\t\t: undefined;\n\tlet trailing: BlockNode;\n\tif (reusableTrailing) {\n\t\ttrailing = reusableTrailing;\n\t} else {\n\t\ttrailing = createBlockNode(nodeType('paragraph'));\n\t\tbuilder.insertNode([], insertAt, trailing);\n\t}\n\n\t// Drop a blank-line paragraph anchor so the objects are not preceded by a\n\t// stray empty paragraph (#152).\n\tif (anchor && isEmptyParagraph(anchor)) {\n\t\tbuilder.removeNode([], topIndex);\n\t}\n\n\treturn trailing;\n}\n\n/** Recursively clones a block tree, assigning new IDs to all block nodes. */\nexport function cloneBlockWithNewIds(block: BlockNode, newId: BlockId): BlockNode {\n\tconst children = block.children.map((child) => {\n\t\tif (isBlockNode(child)) {\n\t\t\treturn cloneBlockWithNewIds(child, generateBlockId());\n\t\t}\n\t\treturn child;\n\t});\n\treturn createBlockNode(block.type, children, newId, block.attrs, block.htmlId);\n}\n\n/** Recursively searches a block tree for a block with the given ID (DFS). */\nexport function findBlockRecursive(block: BlockNode, blockId: BlockId): BlockNode | undefined {\n\tif (block.id === blockId) return block;\n\tfor (const child of block.children) {\n\t\tif (!isBlockNode(child)) continue;\n\t\tconst found: BlockNode | undefined = findBlockRecursive(child, blockId);\n\t\tif (found) return found;\n\t}\n\treturn undefined;\n}\n\n/**\n * Validates incoming attributes against the declared AttrSpec.\n * Only declared keys are kept. Block callers may opt into immutable flat arrays\n * for specs that explicitly set `allowArray`; all other structured values fall\n * back to defaults or are removed.\n */\nexport function sanitizeAttrs(\n\tincoming: Record<string, unknown> | undefined,\n\tspecAttrs: Readonly<Record<string, AttrSpec>> | undefined,\n\tallowStructured = false,\n): BlockAttrs | undefined {\n\tif (!specAttrs) return undefined;\n\n\tconst result: Record<string, BlockAttrValue> = {};\n\tlet hasKeys = false;\n\n\tfor (const key of Object.keys(specAttrs)) {\n\t\tconst spec: AttrSpec = specAttrs[key] as AttrSpec;\n\t\tconst raw: unknown = incoming?.[key];\n\n\t\tif (\n\t\t\ttypeof raw === 'string' ||\n\t\t\t(typeof raw === 'number' && Number.isFinite(raw)) ||\n\t\t\ttypeof raw === 'boolean'\n\t\t) {\n\t\t\tresult[key] = raw;\n\t\t} else if (allowStructured && spec.allowArray && isBlockAttrArray(raw)) {\n\t\t\tresult[key] = Object.freeze([...raw]);\n\t\t} else if (spec.default !== undefined) {\n\t\t\tresult[key] = spec.default;\n\t\t}\n\t\tif (key in result) hasKeys = true;\n\t}\n\n\treturn hasKeys ? result : undefined;\n}\n\nfunction isBlockAttrArray(value: unknown): value is readonly BlockAttrArrayValue[] {\n\treturn (\n\t\tArray.isArray(value) &&\n\t\tvalue.every(\n\t\t\t(item: unknown): boolean =>\n\t\t\t\titem === null ||\n\t\t\t\ttypeof item === 'string' ||\n\t\t\t\ttypeof item === 'boolean' ||\n\t\t\t\t(typeof item === 'number' && Number.isFinite(item)),\n\t\t)\n\t);\n}\n\n/** Checks whether a block is empty (has no text and is not a void block). */\nfunction isBlockEmpty(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tschemaRegistry?: SchemaRegistry,\n): boolean {\n\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\tif (!block) return false;\n\n\tconst spec = schemaRegistry?.getNodeSpec(block.type);\n\treturn !spec?.isVoid && getBlockText(block) === '';\n}\n\n// --- Rich block creation ---\n\n/**\n * Validates a rich block against the schema registry.\n * Returns undefined for blocks with unknown types; sanitizes attributes\n * against the declared spec.\n */\nexport function validateRichBlockData(\n\traw: RichBlockData,\n\tschemaRegistry?: SchemaRegistry,\n): RichBlockData | undefined {\n\tif (!raw.type) return undefined;\n\tif (!schemaRegistry) return raw;\n\n\tconst spec = schemaRegistry.getNodeSpec(raw.type);\n\tif (!spec) return undefined;\n\n\tconst attrs: BlockAttrs | undefined = sanitizeAttrs(raw.attrs, spec.attrs, true);\n\tconst htmlId: string | undefined = normalizeHTMLId(raw.htmlId);\n\tconst segments: RichSegment[] | undefined = raw.segments\n\t\t? sanitizeRichSegments(raw.segments, schemaRegistry)\n\t\t: undefined;\n\tconst { htmlId: _rawHTMLId, ...rest } = raw;\n\treturn {\n\t\t...rest,\n\t\t...(htmlId ? { htmlId } : {}),\n\t\t...(attrs ? { attrs } : {}),\n\t\t...(segments ? { segments } : raw.segments ? { segments: [] } : {}),\n\t};\n}\n\n/**\n * Creates a BlockNode from validated rich block data.\n * Converts segments or plain text into inline children.\n */\nexport function createBlockFromRichData(blockData: RichBlockData): BlockNode {\n\tconst newId: BlockId = generateBlockId();\n\tconst children: readonly (TextNode | InlineNode)[] | undefined =\n\t\tcreateChildrenFromRichBlock(blockData);\n\tconst attrs: BlockAttrs | undefined = blockData.attrs\n\t\t? (blockData.attrs as BlockAttrs)\n\t\t: undefined;\n\n\treturn createBlockNode(\n\t\tnodeType(blockData.type) as NodeTypeName,\n\t\tchildren,\n\t\tnewId,\n\t\tattrs,\n\t\tblockData.htmlId,\n\t);\n}\n\n/**\n * Creates inline children from rich block data.\n * Uses mark-preserving segments when available, falls back to plain text.\n * Returns undefined for content-free blocks (e.g. void blocks).\n */\nfunction createChildrenFromRichBlock(\n\tblockData: RichBlockData,\n): readonly (TextNode | InlineNode)[] | undefined {\n\tconst segments: readonly ContentSegment[] = richBlockToContentSegments(blockData);\n\tif (segments.length === 0) return undefined;\n\treturn segmentsToInlineChildren(segments);\n}\n\n/**\n * Converts rich block data into a paste {@link ContentSlice}. Blocks that fail\n * schema validation (unknown type or filtered attributes) are dropped, so the\n * resulting slice can be fed straight into the canonical paste strategy\n * ({@link import('./PasteCommand.js').pasteSlice}).\n */\nexport function richBlocksToSlice(\n\tblocks: readonly RichBlockData[],\n\tschemaRegistry?: SchemaRegistry,\n): ContentSlice {\n\tconst sliceBlocks: SliceBlock[] = [];\n\tfor (const raw of blocks) {\n\t\tconst blockData: RichBlockData | undefined = validateRichBlockData(raw, schemaRegistry);\n\t\tif (!blockData) continue;\n\t\tsliceBlocks.push(richBlockToSliceBlock(blockData));\n\t}\n\treturn { blocks: sliceBlocks };\n}\n\n/** Converts a single validated rich block into a {@link SliceBlock}. */\nfunction richBlockToSliceBlock(blockData: RichBlockData): SliceBlock {\n\tconst attrs: BlockAttrs | undefined = blockData.attrs\n\t\t? (blockData.attrs as BlockAttrs)\n\t\t: undefined;\n\treturn {\n\t\ttype: nodeType(blockData.type) as NodeTypeName,\n\t\t...(attrs ? { attrs } : {}),\n\t\tsegments: richBlockToContentSegments(blockData),\n\t};\n}\n\n/** Builds content segments from a rich block, falling back to plain text. */\nfunction richBlockToContentSegments(blockData: RichBlockData): readonly ContentSegment[] {\n\tif (blockData.segments && blockData.segments.length > 0) {\n\t\treturn richSegmentsToContentSegments(blockData.segments);\n\t}\n\tconst text: string = blockData.text ?? '';\n\treturn text ? [textSegment(text)] : [];\n}\n\n/** Converts rich segments into content segments (marked text and inline nodes). */\nfunction richSegmentsToContentSegments(\n\tsegments: readonly RichSegment[],\n): readonly ContentSegment[] {\n\tconst result: ContentSegment[] = [];\n\tfor (const seg of segments) {\n\t\tif (seg.kind === 'inline') {\n\t\t\tresult.push(\n\t\t\t\tinlineSegment(\n\t\t\t\t\tcreateInlineNode(\n\t\t\t\t\t\tinlineType(seg.inlineType),\n\t\t\t\t\t\tseg.attrs as Readonly<Record<string, string | number | boolean>> | undefined,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tif (seg.text.length === 0) continue;\n\t\tconst marks: readonly Mark[] = seg.marks.map((m) => ({\n\t\t\ttype: m.type as Mark['type'],\n\t\t\t...(m.attrs ? { attrs: m.attrs as Mark['attrs'] } : {}),\n\t\t}));\n\t\tresult.push(textSegment(seg.text, marks));\n\t}\n\treturn result;\n}\n\nfunction sanitizeRichSegments(\n\tsegments: readonly RichSegment[],\n\tschemaRegistry: SchemaRegistry,\n): RichSegment[] {\n\tconst sanitized: RichSegment[] = [];\n\tfor (const segment of segments) {\n\t\tif (segment.kind === 'inline') {\n\t\t\tconst spec = schemaRegistry.getInlineNodeSpec(segment.inlineType);\n\t\t\tif (!spec) continue;\n\t\t\tconst attrs = sanitizeAttrs(segment.attrs, spec.attrs);\n\t\t\tsanitized.push({\n\t\t\t\tkind: 'inline',\n\t\t\t\tinlineType: segment.inlineType,\n\t\t\t\t...(attrs ? { attrs } : {}),\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tsanitized.push(segment);\n\t}\n\treturn sanitized;\n}\n"],"mappings":"kbA4BA,SAAgB,EACf,EACA,GAEA,GAA0B,IAAtB,EAAW,OAAc,OAAO,EAAM,IAAI,SAC9C,MAAM,EAAgC,EAAM,SAC3C,EAAW,EAAW,OAAS,IAEhC,OAAO,EAAS,EAAO,SAAW,EACnC,CAQA,SAAgB,EAAmB,EAAgB,GAClD,GAAI,EAAY,GACf,MAAO,CAAE,QAAS,EAAI,OAAO,Q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ACL,EAAY,KAAK,EAAsB,GACxC,CACA,MAAO,CAAE,OAAQ,EAClB,CAGA,SAAS,EAAsB,GAC9B,MAAM,EAAgC,EAAU,MAC5C,EAAU,WACX,EACH,MAAO,CACN,KAAM,EAAS,EAAU,SACrB,EAAQ,CAAE,SAAU,CAAC,EACzB,SAAU,EAA2B,GAEvC,CAGA,SAAS,EAA2B,GACnC,GAAI,EAAU,UAAY,EAAU,SAAS,OAAS,EACrD,OAOF,SACC,GAEA,MAAM,EAA2B,GACjC,IAAK,MAAM,KAAO,EAAU,CAC3B,GAAiB,WAAb,EAAI,KAAmB,CAC1B,EAAO,KACN,EACC,EACC,EAAW,EAAI,YACf,EAAI,SAIP,QACD,CACA,GAAwB,IAApB,EAAI,KAAK,OAAc,SAC3B,MAAM,EAAyB,EAAI,MAAM,IAAK,IAAA,CAC7C,KAAM,EAAE,QACJ,EAAE,MAAQ,CAAE,MAAO,EAAE,OAA2B,CAAC,KAEtD,EAAO,KAAK,EAAY,EAAI,KAAM,GACnC,CACA,OAAO,CACR,CA/BS,CAA8B,EAAU,UAEhD,MAAM,EAAe,EAAU,MAAQ,GACvC,OAAO,EAAO,CAAC,EAAY,IAAS,EACrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CaretNavigationPlugin-BxWjR7SN.mjs","names":[],"sources":["../../src/model/GraphemeUtils.ts","../../src/model/WordBoundary.ts","../../src/view/DomPointUtils.ts","../../src/view/CaretNavigation.ts","../../src/state/BlockBoundaryMovement.ts","../../src/commands/MovementCommands.ts","../../src/view/ViewMovementCommands.ts","../../src/plugins/caret-navigation/CaretNavigationLocale.ts","../../src/plugins/caret-navigation/CaretNavigationPlugin.ts"],"sourcesContent":["/**\n * Grapheme-cluster utilities for correct character navigation.\n *\n * Uses `Intl.Segmenter` (with `granularity: 'grapheme'`) to correctly\n * handle multi-code-unit characters such as emoji, ZWJ sequences, and\n * combining characters. Falls back to +1/-1 when `Intl.Segmenter` is\n * not available.\n */\n\nconst SEGMENTER_SUPPORTED: boolean = typeof Intl !== 'undefined' && 'Segmenter' in Intl;\nconst SEGMENTER: Intl.Segmenter | null = SEGMENTER_SUPPORTED\n\t? new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n\t: null;\n\n/**\n * Returns the number of UTF-16 code units to advance from `offset` to the next\n * grapheme-cluster boundary. Returns 0 if `offset` is at or past the end.\n *\n * Callers normally pass an offset that already sits on a cluster boundary, in\n * which case this is the full width of the cluster starting at `offset`. When\n * `offset` lands inside a cluster, the remaining units up to that cluster's end\n * are returned so navigation snaps forward to the next boundary (rather than\n * skipping the rest of the current cluster).\n */\nexport function nextGraphemeSize(text: string, offset: number): number {\n\tif (offset >= text.length || text.length === 0) return 0;\n\n\tif (SEGMENTER) {\n\t\tfor (const segment of SEGMENTER.segment(text)) {\n\t\t\tconst end: number = segment.index + segment.segment.length;\n\t\t\tif (end > offset) {\n\t\t\t\treturn end - offset;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\treturn 1;\n}\n\n/**\n * Returns the number of UTF-16 code units in the grapheme cluster\n * immediately before `offset`. Returns 0 if `offset` is 0 or the\n * string is empty.\n */\nexport function prevGraphemeSize(text: string, offset: number): number {\n\tif (offset <= 0 || text.length === 0) return 0;\n\n\tif (SEGMENTER) {\n\t\tlet lastSize = 1;\n\t\tfor (const segment of SEGMENTER.segment(text)) {\n\t\t\tif (segment.index + segment.segment.length >= offset) {\n\t\t\t\tlastSize = segment.segment.length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlastSize = segment.segment.length;\n\t\t}\n\t\treturn lastSize;\n\t}\n\n\treturn 1;\n}\n","/**\n * Word boundary detection for delete-word and word-movement commands.\n * InlineNodes act as word boundaries.\n */\n\nimport { type BlockNode, getBlockLength, getContentAtOffset } from './Document.js';\n\n/**\n * Finds the word boundary backward from the given offset.\n * InlineNodes act as word boundaries.\n */\nexport function findWordBoundaryBackward(block: BlockNode, offset: number): number {\n\tlet pos = offset - 1;\n\t// Skip trailing whitespace\n\twhile (pos >= 0) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (!/\\s/.test(content.char)) break;\n\t\tpos--;\n\t}\n\t// If at InlineNode, delete just it (treat as word boundary)\n\tif (pos >= 0) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (content?.kind === 'inline') return pos;\n\t}\n\t// Skip word characters until whitespace or InlineNode\n\twhile (pos >= 0) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (/\\s/.test(content.char)) break;\n\t\tpos--;\n\t}\n\treturn pos + 1;\n}\n\n/**\n * Finds the word boundary forward from the given offset.\n * InlineNodes act as word boundaries.\n */\nexport function findWordBoundaryForward(block: BlockNode, offset: number): number {\n\tconst len = getBlockLength(block);\n\tlet pos = offset;\n\t// Skip word characters first\n\twhile (pos < len) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (/\\s/.test(content.char)) break;\n\t\tpos++;\n\t}\n\t// If at InlineNode and haven't moved, delete just the InlineNode\n\tif (pos === offset && pos < len) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (content?.kind === 'inline') return pos + 1;\n\t}\n\t// Skip trailing whitespace\n\twhile (pos < len) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (!/\\s/.test(content.char)) break;\n\t\tpos++;\n\t}\n\treturn pos;\n}\n","/**\n * Utilities for resolving a DOM position from screen coordinates.\n *\n * Provides a fallback chain: `caretPositionFromPoint` → `caretRangeFromPoint`\n * → document fallback (when root is a ShadowRoot).\n */\n\n/** Result of resolving a DOM position from screen coordinates. */\nexport interface DomPoint {\n\treadonly node: Node;\n\treadonly offset: number;\n}\n\n/**\n * Tries `caretPositionFromPoint` (standard) then `caretRangeFromPoint`\n * (WebKit fallback) on a single target to resolve a DOM position.\n */\nfunction tryCaretFromPoint(target: Document | ShadowRoot, x: number, y: number): DomPoint | null {\n\tif ('caretPositionFromPoint' in target) {\n\t\tconst cp = (target as Document).caretPositionFromPoint(x, y);\n\t\tif (cp) {\n\t\t\treturn { node: cp.offsetNode, offset: cp.offset };\n\t\t}\n\t}\n\n\tif ('caretRangeFromPoint' in target) {\n\t\tconst range = (target as Document).caretRangeFromPoint(x, y);\n\t\tif (range) {\n\t\t\treturn { node: range.startContainer, offset: range.startOffset };\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * Resolves a DOM position from screen coordinates using the best available API.\n *\n * Tries the given root first, then falls back to the ownerDocument when the\n * root is a ShadowRoot and the first attempt returned nothing.\n */\nexport function domPositionFromPoint(\n\troot: Document | ShadowRoot,\n\tx: number,\n\ty: number,\n\townerDoc?: Document,\n): DomPoint | null {\n\treturn (\n\t\ttryCaretFromPoint(root, x, y) ??\n\t\t(ownerDoc && root !== ownerDoc ? tryCaretFromPoint(ownerDoc, x, y) : null)\n\t);\n}\n","/**\n * Caret navigation utilities for layout-aware cursor movement.\n *\n * Provides `endOfTextblock()` for detecting visual block boundaries,\n * `navigateAcrossBlocks()` for cross-block cursor transitions, and\n * `navigateVerticalWithGoalColumn()` for column-preserving vertical nav.\n */\n\nimport { type BlockNode, getBlockLength, getContentAtOffset } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { getTextDirection } from '../platform/Platform.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { type AdjacentBlock, resolveAdjacentBlock } from '../state/NavigationQueries.js';\nimport { moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { domPositionFromPoint } from './DomPointUtils.js';\nimport { findBlockAncestor } from './DomUtils.js';\nimport type { SelectionEndpoints } from './SelectionSync.js';\nimport { domPositionToState, getSelection, readDOMSelectionEndpoints } from './SelectionSync.js';\n\nexport { navigateFromGapCursor } from './GapCursorNavigation.js';\n\n/** Inset in pixels from block edge for vertical goal-column probing. */\nconst BLOCK_EDGE_INSET_PX = 2;\n\n/** Minimum vertical movement (pixels) for a Selection.modify probe to be considered a real move. */\nconst VERTICAL_MOVEMENT_THRESHOLD_PX = 1;\n\nexport type CaretDirection = 'left' | 'right' | 'up' | 'down';\n\n/**\n * Checks whether the cursor is at the visual edge of its text block.\n *\n * For horizontal directions (left/right), uses a pure offset check.\n * For vertical directions (up/down), tries `Selection.modify` probing\n * to detect visual line boundaries, falling back to offset heuristic.\n *\n * An optional `caretRect` parameter avoids redundant `getBoundingClientRect`\n * calls when the caller already measured the caret position.\n */\nexport function endOfTextblock(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: CaretDirection,\n\tcaretRect?: DOMRect | null,\n): boolean {\n\tconst sel = state.selection;\n\n\tif (!isTextSelection(sel)) return false;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tconst offset: number = sel.anchor.offset;\n\tconst blockLength: number = getBlockLength(block);\n\n\t// Horizontal: direction-aware offset check\n\tconst blockEl: Element | null = container.querySelector(\n\t\t`[data-block-id=\"${sel.anchor.blockId}\"]`,\n\t);\n\tconst isRtl: boolean = blockEl instanceof HTMLElement && getTextDirection(blockEl) === 'rtl';\n\n\tif (direction === 'left') return isRtl ? offset === blockLength : offset === 0;\n\tif (direction === 'right') return isRtl ? offset === 0 : offset === blockLength;\n\n\t// Vertical: quick offset check first\n\tif (direction === 'up' && offset === 0) return true;\n\tif (direction === 'down' && offset === blockLength) return true;\n\n\t// Vertical: try Selection.modify probing for multi-line blocks\n\tconst domSel: globalThis.Selection | null = getSelection();\n\tif (!domSel || !domSel.modify) {\n\t\t// Fallback: offset heuristic (no Selection.modify in test environments)\n\t\treturn direction === 'up' ? offset === 0 : offset === blockLength;\n\t}\n\n\treturn probeVerticalBoundary(container, domSel, direction, caretRect);\n}\n\n/**\n * Creates a transaction to move the cursor to an adjacent block.\n *\n * Returns `null` if navigation is not possible (document boundary,\n * isolating boundary, or no adjacent block).\n */\nexport function navigateAcrossBlocks(\n\tstate: EditorState,\n\tdirection: CaretDirection,\n): Transaction | null {\n\tconst target: AdjacentBlock | null = resolveNavigationTarget(state, direction);\n\tif (!target) return null;\n\n\tif (target.isVoid) return nodeSelTx(state, target.targetId);\n\n\t// Target is text → collapsed selection at start or end\n\tconst targetBlock = state.getBlock(target.targetId);\n\tif (!targetBlock) return null;\n\n\tconst targetOffset: number =\n\t\tdirection === 'right' || direction === 'down' ? 0 : getBlockLength(targetBlock);\n\n\treturn moveTx(state, target.targetId, targetOffset);\n}\n\n/**\n * Navigates vertically using a goal column for visual column preservation.\n *\n * Uses `caretPositionFromPoint` / `caretRangeFromPoint` to find the offset\n * in the target block that is closest to the given goalColumn X coordinate.\n * Falls back to start/end offset when goal column positioning is unavailable.\n */\nexport function navigateVerticalWithGoalColumn(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: 'up' | 'down',\n\tgoalColumn: number | null,\n): Transaction | null {\n\tconst target: AdjacentBlock | null = resolveNavigationTarget(state, direction);\n\tif (!target) return null;\n\n\t// Void → NodeSelection (goalColumn irrelevant)\n\tif (target.isVoid) return nodeSelTx(state, target.targetId);\n\n\tconst targetBlock = state.getBlock(target.targetId);\n\tif (!targetBlock) return null;\n\tconst blockLen: number = getBlockLength(targetBlock);\n\n\t// Try to resolve position using goalColumn\n\tif (goalColumn !== null) {\n\t\tconst position = resolveGoalColumnPosition(container, target.targetId, direction, goalColumn);\n\t\tif (position) return moveTx(state, position.blockId, position.offset);\n\t}\n\n\t// Offset-clamp fallback: preserve the absolute character offset, clamped to\n\t// the target block length. This handles cases where DOM-based goal column\n\t// resolution fails (e.g. Shadow DOM <li> elements) by keeping the cursor\n\t// at the same character column when possible.\n\tif (isTextSelection(state.selection) && isCollapsed(state.selection)) {\n\t\tconst sourceOffset: number = state.selection.anchor.offset;\n\t\tconst clampedOffset: number = Math.min(sourceOffset, blockLen);\n\t\treturn moveTx(state, target.targetId, clampedOffset);\n\t}\n\n\t// Final fallback: start (down) or end (up)\n\tconst fallbackOffset: number = direction === 'down' ? 0 : blockLen;\n\treturn moveTx(state, target.targetId, fallbackOffset);\n}\n\n/**\n * Skips over an InlineNode atomically when arrowing left/right.\n *\n * Returns a transaction moving the cursor past the InlineNode,\n * or `null` if the adjacent content is not an InlineNode (or\n * the direction is vertical).\n */\nexport function skipInlineNode(state: EditorState, direction: CaretDirection): Transaction | null {\n\tif (direction === 'up' || direction === 'down') return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\tif (!isCollapsed(sel)) return null;\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\n\treturn direction === 'right'\n\t\t? skipInlineNodeRight(state, blockId, block, offset)\n\t\t: skipInlineNodeLeft(state, blockId, block, offset);\n}\n\nfunction skipInlineNodeRight(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tblock: BlockNode,\n\toffset: number,\n): Transaction | null {\n\tconst content = getContentAtOffset(block, offset);\n\tif (!content || content.kind !== 'inline') return null;\n\treturn moveTx(state, blockId, offset + 1);\n}\n\nfunction skipInlineNodeLeft(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tblock: BlockNode,\n\toffset: number,\n): Transaction | null {\n\tif (offset === 0) return null;\n\tconst content = getContentAtOffset(block, offset - 1);\n\tif (!content || content.kind !== 'inline') return null;\n\treturn moveTx(state, blockId, offset - 1);\n}\n\n/**\n * Returns the bounding rect of the current caret position, or null.\n *\n * When `container` is provided, validates that `getRangeAt(0)` is inside\n * the container before using its rects. In Shadow DOM, `getRangeAt(0)` may\n * return a cross-boundary range whose rects reflect the shadow host position\n * rather than the actual caret position (e.g. inside `<li>` elements).\n * Falls back to composed selection endpoints via `readDOMSelectionEndpoints()`.\n */\nexport function getCaretRectFromSelection(\n\tdomSel: globalThis.Selection,\n\tcontainer?: HTMLElement,\n): DOMRect | null {\n\t// Standard path: use getRangeAt(0) directly, but only if the range\n\t// is inside the container (avoids cross-boundary rects in Shadow DOM)\n\tif (domSel.rangeCount > 0) {\n\t\tconst range: Range = domSel.getRangeAt(0);\n\t\tconst rangeInContainer: boolean = !container || container.contains(range.startContainer);\n\n\t\tif (rangeInContainer) {\n\t\t\tconst rects: DOMRectList = range.getClientRects();\n\t\t\tif (rects.length > 0) return rects[0] ?? null;\n\t\t\tconst rect: DOMRect = range.getBoundingClientRect();\n\t\t\tif (rect.height > 0) return rect;\n\t\t}\n\t}\n\n\t// Composed endpoint path: handles Shadow DOM cases where getRangeAt(0)\n\t// crosses the shadow boundary (e.g. <li> elements in wrapper <ul>/<ol>)\n\tif (container) {\n\t\tconst endpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\t\tif (endpoints) {\n\t\t\ttry {\n\t\t\t\tconst range: Range = document.createRange();\n\t\t\t\trange.setStart(endpoints.anchorNode, endpoints.anchorOffset);\n\t\t\t\trange.setEnd(endpoints.focusNode, endpoints.focusOffset);\n\t\t\t\tconst rects: DOMRectList = range.getClientRects();\n\t\t\t\tif (rects.length > 0) return rects[0] ?? null;\n\t\t\t\treturn range.getBoundingClientRect();\n\t\t\t} catch {\n\t\t\t\t// Unable to create range from endpoints\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Resolves the adjacent block in the given direction for cross-block navigation.\n * Performs boundary checks, isolating checks, and void detection.\n */\nfunction resolveNavigationTarget(\n\tstate: EditorState,\n\tdirection: CaretDirection,\n): AdjacentBlock | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\tconst forward: boolean = direction === 'right' || direction === 'down';\n\treturn resolveAdjacentBlock(state, sel.anchor.blockId, forward);\n}\n\n/**\n * Computes the Y coordinate for vertical goal-column probing.\n *\n * Uses the block element's computed padding to ensure the probe point\n * lands inside the text content area, not in the padding zone.\n * Firefox's `caretPositionFromPoint` returns the end-of-text position\n * when probing in the padding area below the content, which breaks\n * ArrowUp column preservation.\n */\nfunction computeProbeY(blockEl: Element, rect: DOMRect, direction: 'up' | 'down'): number {\n\tif (!(blockEl instanceof HTMLElement)) {\n\t\treturn direction === 'down'\n\t\t\t? rect.top + BLOCK_EDGE_INSET_PX\n\t\t\t: rect.bottom - BLOCK_EDGE_INSET_PX;\n\t}\n\n\tconst style: CSSStyleDeclaration = getComputedStyle(blockEl);\n\tconst paddingTop: number = Number.parseFloat(style.paddingTop) || 0;\n\tconst paddingBottom: number = Number.parseFloat(style.paddingBottom) || 0;\n\n\treturn direction === 'down'\n\t\t? rect.top + paddingTop + BLOCK_EDGE_INSET_PX\n\t\t: rect.bottom - paddingBottom - BLOCK_EDGE_INSET_PX;\n}\n\n/**\n * Resolves an editor position in the target block by using the goalColumn\n * X coordinate and `caretPositionFromPoint` / `caretRangeFromPoint`.\n *\n * Returns `null` when the point-to-caret API is unavailable, when the\n * resolved DOM node falls outside the target block, or when the resulting\n * position doesn't belong to the target block — triggering the fallback\n * (block-end for up, block-start for down) in `navigateVerticalWithGoalColumn`.\n */\nfunction resolveGoalColumnPosition(\n\tcontainer: HTMLElement,\n\ttargetId: BlockId,\n\tdirection: 'up' | 'down',\n\tgoalColumn: number,\n): { blockId: BlockId; offset: number } | null {\n\tconst blockEl: Element | null = container.querySelector(`[data-block-id=\"${targetId}\"]`);\n\tif (!blockEl) return null;\n\n\tconst rect: DOMRect = blockEl.getBoundingClientRect();\n\tconst y: number = computeProbeY(blockEl, rect, direction);\n\t// Clamp goalColumn within the block's horizontal bounds to avoid\n\t// caretPositionFromPoint returning unexpected results for out-of-bounds X.\n\tconst clampedX: number = Math.min(Math.max(goalColumn, rect.left), rect.right - 1);\n\n\tconst root: Document | ShadowRoot = container.getRootNode() as Document | ShadowRoot;\n\tconst domPoint = domPositionFromPoint(root, clampedX, y, container.ownerDocument);\n\tif (!domPoint) return null;\n\n\t// Verify the DOM node is inside the target block\n\tif (!blockEl.contains(domPoint.node)) return null;\n\n\tconst position = domPositionToState(container, domPoint.node, domPoint.offset);\n\tif (!position) return null;\n\n\t// Ensure the resolved position is in the target block\n\tif (position.blockId !== targetId) return null;\n\n\treturn position;\n}\n\n/**\n * Probes whether the cursor is at the top/bottom visual line of a block.\n *\n * Strategy:\n * 1. `Selection.modify('move', direction, 'line')` — moves one visual line.\n * 2. If the cursor left the block or didn't move, it's at the boundary.\n * 3. Cross-check with `getBoundingClientRect`: compare the caret rect before\n * and after the probe. If the vertical position didn't change, the probe\n * hit the block edge even though `Selection.modify` reported movement\n * (can happen with certain inline element layouts).\n *\n * Original DOM selection is always restored before returning.\n */\nfunction probeVerticalBoundary(\n\tcontainer: HTMLElement,\n\tdomSel: globalThis.Selection,\n\tdirection: 'up' | 'down',\n\tpreReadRect?: DOMRect | null,\n): boolean {\n\t// Save original DOM selection (using composed ranges for Shadow DOM)\n\tconst origEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\n\t// Cannot determine position → safe default: not at boundary (let browser handle)\n\tif (!origEndpoints) return false;\n\n\tconst origRect: DOMRect | null = preReadRect ?? getCaretRectFromSelection(domSel, container);\n\tconst dirStr: string = direction === 'up' ? 'backward' : 'forward';\n\n\ttry {\n\t\tdomSel.modify('move', dirStr, 'line');\n\n\t\t// Read post-modify endpoints via composed ranges\n\t\tconst postEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\t\tif (!postEndpoints) return false;\n\n\t\t// Check if the new position is still within the same block\n\t\tconst origBlock: HTMLElement | null = findBlockAncestor(container, origEndpoints.focusNode);\n\t\tconst newBlock: HTMLElement | null = findBlockAncestor(container, postEndpoints.focusNode);\n\n\t\t// Moved to a different block → definitely at boundary\n\t\tif (origBlock !== newBlock) return true;\n\n\t\t// Selection didn't move at all → at boundary\n\t\tconst didNotMove: boolean =\n\t\t\tpostEndpoints.anchorNode === origEndpoints.anchorNode &&\n\t\t\tpostEndpoints.anchorOffset === origEndpoints.anchorOffset &&\n\t\t\tpostEndpoints.focusNode === origEndpoints.focusNode &&\n\t\t\tpostEndpoints.focusOffset === origEndpoints.focusOffset;\n\t\tif (didNotMove) return true;\n\n\t\t// Cross-check with getBoundingClientRect: if vertical position unchanged,\n\t\t// the probe was a no-op visually (edge case with inline elements)\n\t\tif (origRect) {\n\t\t\tconst newRect: DOMRect | null = getCaretRectFromSelection(domSel, container);\n\t\t\tif (newRect) {\n\t\t\t\tconst verticalDelta: number = Math.abs(newRect.top - origRect.top);\n\t\t\t\tif (verticalDelta < VERTICAL_MOVEMENT_THRESHOLD_PX) return true;\n\t\t\t}\n\t\t}\n\n\t\t// Stayed in same block and moved vertically → not at boundary\n\t\treturn false;\n\t} finally {\n\t\t// Restore original selection\n\t\ttry {\n\t\t\tdomSel.setBaseAndExtent(\n\t\t\t\torigEndpoints.anchorNode,\n\t\t\t\torigEndpoints.anchorOffset,\n\t\t\t\torigEndpoints.focusNode,\n\t\t\t\torigEndpoints.focusOffset,\n\t\t\t);\n\t\t} catch {\n\t\t\t// Selection restore may fail if DOM changed\n\t\t}\n\t}\n}\n","/**\n * Block boundary movement: pure state-level functions for moving\n * the cursor to the start or end of the current block.\n *\n * These only depend on model/ and state/ types, so they belong\n * at the state layer rather than in commands/.\n */\n\nimport { getBlockLength } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from './EditorState.js';\nimport { moveTx } from './SelectionTransactions.js';\nimport type { Transaction } from './Transaction.js';\n\n/** Moves the cursor to the start of the current block. */\nexport function moveToBlockStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\n\tif (offset === 0) return null;\n\treturn moveTx(state, blockId, 0);\n}\n\n/** Moves the cursor to the end of the current block. */\nexport function moveToBlockEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\n\tif (offset === blockLen) return null;\n\treturn moveTx(state, blockId, blockLen);\n}\n","/**\n * Model-based movement commands for programmatic cursor navigation.\n *\n * All functions are pure: they take an EditorState and return a Transaction\n * or `null` (when the movement is not applicable). None touch the DOM.\n *\n * Move commands produce a collapsed cursor. Extend commands keep the anchor\n * and move the head, producing a range selection. All clear storedMarks.\n */\n\nimport {\n\tblockOffsetToTextOffset,\n\tgetBlockLength,\n\tgetBlockText,\n\tgetContentAtOffset,\n} from '../model/Document.js';\nimport { nextGraphemeSize, prevGraphemeSize } from '../model/GraphemeUtils.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { canCrossBlockBoundary, isVoidBlock } from '../state/NavigationQueries.js';\nimport { extendTx, moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\n\n// Re-export block boundary movement from state layer\nexport { moveToBlockEnd, moveToBlockStart } from '../state/BlockBoundaryMovement.js';\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Resolves the effective head position from any text selection. */\nfunction resolveHead(state: EditorState): { blockId: BlockId; offset: number } | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\treturn { blockId: sel.head.blockId, offset: sel.head.offset };\n}\n\n/** Returns the adjacent block ID in the given direction, or `null`. */\nfunction adjacentBlockId(\n\tstate: EditorState,\n\tcurrentBlockId: BlockId,\n\tdirection: 'forward' | 'backward',\n): BlockId | null {\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst idx: number = blockOrder.indexOf(currentBlockId);\n\tif (idx < 0) return null;\n\tconst targetIdx: number = direction === 'forward' ? idx + 1 : idx - 1;\n\tif (targetIdx < 0 || targetIdx >= blockOrder.length) return null;\n\treturn blockOrder[targetIdx] ?? null;\n}\n\n// ---------------------------------------------------------------------------\n// Character Movement\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor one character forward, skipping InlineNodes atomically. */\nexport function moveCharacterForward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\t// If range selection, collapse to head\n\tif (!isCollapsed(sel)) {\n\t\treturn moveTx(state, sel.head.blockId, sel.head.offset);\n\t}\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\tconst blockLen: number = getBlockLength(block);\n\n\tif (offset < blockLen) {\n\t\t// InlineNode: skip atomically (+1)\n\t\tconst content = getContentAtOffset(block, offset);\n\t\tif (content?.kind === 'inline') {\n\t\t\treturn moveTx(state, blockId, offset + 1);\n\t\t}\n\t\t// Text: advance by one grapheme cluster\n\t\tconst text: string = getBlockText(block);\n\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\tconst step: number = nextGraphemeSize(text, textOffset) || 1;\n\t\treturn moveTx(state, blockId, offset + step);\n\t}\n\n\t// At block end → cross-block\n\tconst nextId: BlockId | null = adjacentBlockId(state, blockId, 'forward');\n\tif (!nextId) return null;\n\tif (!canCrossBlockBoundary(state, blockId, nextId)) return null;\n\n\tif (isVoidBlock(state, nextId)) return nodeSelTx(state, nextId);\n\n\treturn moveTx(state, nextId, 0);\n}\n\n/** Moves the cursor one character backward, skipping InlineNodes atomically. */\nexport function moveCharacterBackward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\t// If range selection, collapse to head\n\tif (!isCollapsed(sel)) {\n\t\treturn moveTx(state, sel.head.blockId, sel.head.offset);\n\t}\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\n\tif (offset > 0) {\n\t\t// InlineNode: skip atomically (-1)\n\t\tconst content = getContentAtOffset(block, offset - 1);\n\t\tif (content?.kind === 'inline') {\n\t\t\treturn moveTx(state, blockId, offset - 1);\n\t\t}\n\t\t// Text: retreat by one grapheme cluster\n\t\tconst text: string = getBlockText(block);\n\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\tconst step: number = prevGraphemeSize(text, textOffset) || 1;\n\t\treturn moveTx(state, blockId, offset - step);\n\t}\n\n\t// At block start → cross-block\n\tconst prevId: BlockId | null = adjacentBlockId(state, blockId, 'backward');\n\tif (!prevId) return null;\n\tif (!canCrossBlockBoundary(state, blockId, prevId)) return null;\n\n\tif (isVoidBlock(state, prevId)) return nodeSelTx(state, prevId);\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\treturn moveTx(state, prevId, getBlockLength(prevBlock));\n}\n\n// ---------------------------------------------------------------------------\n// Document Boundary Movement\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor to the beginning of the document. */\nexport function moveToDocumentStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst firstId: BlockId | undefined = blockOrder[0];\n\tif (!firstId) return null;\n\n\tif (isVoidBlock(state, firstId)) return nodeSelTx(state, firstId);\n\n\treturn moveTx(state, firstId, 0);\n}\n\n/** Moves the cursor to the end of the document. */\nexport function moveToDocumentEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst lastId: BlockId | undefined = blockOrder[blockOrder.length - 1];\n\tif (!lastId) return null;\n\n\tif (isVoidBlock(state, lastId)) return nodeSelTx(state, lastId);\n\n\tconst lastBlock = state.getBlock(lastId);\n\tif (!lastBlock) return null;\n\treturn moveTx(state, lastId, getBlockLength(lastBlock));\n}\n\n// ---------------------------------------------------------------------------\n// Extend (Selection Extension) Commands\n// ---------------------------------------------------------------------------\n\n/** Extends the selection one character forward. */\nexport function extendCharacterForward(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\n\tif (head.offset < blockLen) {\n\t\tconst content = getContentAtOffset(block, head.offset);\n\t\tconst step: number =\n\t\t\tcontent?.kind === 'inline'\n\t\t\t\t? 1\n\t\t\t\t: nextGraphemeSize(getBlockText(block), blockOffsetToTextOffset(block, head.offset)) || 1;\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, head.offset + step);\n\t}\n\n\t// Cross-block\n\tconst nextId: BlockId | null = adjacentBlockId(state, head.blockId, 'forward');\n\tif (!nextId) return null;\n\tif (!canCrossBlockBoundary(state, head.blockId, nextId)) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, nextId, 0);\n}\n\n/** Extends the selection one character backward. */\nexport function extendCharacterBackward(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tif (head.offset > 0) {\n\t\tconst block = state.getBlock(head.blockId);\n\t\tif (!block) return null;\n\t\tconst content = getContentAtOffset(block, head.offset - 1);\n\t\tconst step: number =\n\t\t\tcontent?.kind === 'inline'\n\t\t\t\t? 1\n\t\t\t\t: prevGraphemeSize(getBlockText(block), blockOffsetToTextOffset(block, head.offset)) || 1;\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, head.offset - step);\n\t}\n\n\t// Cross-block\n\tconst prevId: BlockId | null = adjacentBlockId(state, head.blockId, 'backward');\n\tif (!prevId) return null;\n\tif (!canCrossBlockBoundary(state, head.blockId, prevId)) return null;\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, prevId, getBlockLength(prevBlock));\n}\n\n/** Extends the selection to the start of the current block. */\nexport function extendToBlockStart(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tif (head.offset === 0) return null;\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, 0);\n}\n\n/** Extends the selection to the end of the current block. */\nexport function extendToBlockEnd(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\tif (head.offset === blockLen) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, blockLen);\n}\n\n/** Extends the selection to the start of the document. */\nexport function extendToDocumentStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst firstId: BlockId | undefined = blockOrder[0];\n\tif (!firstId) return null;\n\n\t// No-op if head is already at document start\n\tif (sel.head.blockId === firstId && sel.head.offset === 0) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, firstId, 0);\n}\n\n/** Extends the selection to the end of the document. */\nexport function extendToDocumentEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst lastId: BlockId | undefined = blockOrder[blockOrder.length - 1];\n\tif (!lastId) return null;\n\n\tconst lastBlock = state.getBlock(lastId);\n\tif (!lastBlock) return null;\n\n\tconst lastBlockLen: number = getBlockLength(lastBlock);\n\n\t// No-op if head is already at document end\n\tif (sel.head.blockId === lastId && sel.head.offset === lastBlockLen) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, lastId, lastBlockLen);\n}\n","/**\n * View-based movement commands that use the browser's `Selection.modify()` API\n * for word, line-boundary, and line granularity movement.\n *\n * Falls back to model-based commands when `Selection.modify` is unavailable\n * (e.g. in happy-dom test environments).\n */\n\nimport { getBlockLength, getContentAtOffset } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { findWordBoundaryBackward, findWordBoundaryForward } from '../model/WordBoundary.js';\nimport { moveToBlockEnd, moveToBlockStart } from '../state/BlockBoundaryMovement.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport {\n\tcanCrossBlockBoundary,\n\tisVoidBlock,\n\tresolveAdjacentBlock,\n} from '../state/NavigationQueries.js';\nimport { extendTx, moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { navigateAcrossBlocks } from './CaretNavigation.js';\nimport type { SelectionEndpoints } from './SelectionSync.js';\nimport { getSelection, readDOMSelectionEndpoints, readSelectionFromDOM } from './SelectionSync.js';\n\ntype Direction = 'forward' | 'backward';\ntype Granularity = 'word' | 'lineboundary' | 'line';\n\n// ---------------------------------------------------------------------------\n// Core view movement\n// ---------------------------------------------------------------------------\n\n/**\n * Moves the cursor using `Selection.modify('move', direction, granularity)`.\n * Falls back to model-based movement when the API is unavailable.\n */\nexport function viewMove(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\treturn viewModifySelection(container, state, 'move', direction, granularity);\n}\n\n/**\n * Extends the selection using `Selection.modify('extend', direction, granularity)`.\n * Falls back to model-based extension when the API is unavailable.\n */\nexport function viewExtend(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\treturn viewModifySelection(container, state, 'extend', direction, granularity);\n}\n\n/**\n * Shared implementation for viewMove and viewExtend.\n * Uses Selection.modify() with save/restore of DOM selection,\n * with fallback to model-based movement.\n */\nfunction viewModifySelection(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tmode: 'move' | 'extend',\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst fallback = mode === 'move' ? fallbackMove : fallbackExtend;\n\n\tconst domSel: globalThis.Selection | null = getSelection();\n\tif (!domSel?.modify) {\n\t\treturn fallback(state, direction, granularity);\n\t}\n\n\tconst origEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\tif (!origEndpoints) return fallback(state, direction, granularity);\n\n\ttry {\n\t\tdomSel.modify(mode, direction, granularity);\n\n\t\tconst newSel = readSelectionFromDOM(container);\n\t\tif (!newSel) return null;\n\n\t\t// For move: check anchor; for extend: check head\n\t\tconst oldBlockId: BlockId = mode === 'move' ? sel.anchor.blockId : sel.head.blockId;\n\t\tconst newPosition = mode === 'move' ? newSel.anchor : newSel.head;\n\t\tconst newBlockId: BlockId = newPosition.blockId;\n\n\t\tif (newBlockId !== oldBlockId && !canCrossBlockBoundary(state, oldBlockId, newBlockId)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet newOffset: number = newPosition.offset;\n\n\t\t// InlineNode boundary correction\n\t\tconst block = state.getBlock(newBlockId);\n\t\tif (block) {\n\t\t\tconst content = getContentAtOffset(block, newOffset);\n\t\t\tif (content?.kind === 'inline' && direction === 'forward') {\n\t\t\t\tnewOffset = Math.min(newOffset + 1, getBlockLength(block));\n\t\t\t}\n\t\t}\n\n\t\tif (mode === 'move') {\n\t\t\tif (isVoidBlock(state, newBlockId)) return nodeSelTx(state, newBlockId);\n\t\t\treturn moveTx(state, newBlockId, newOffset);\n\t\t}\n\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, newBlockId, newOffset);\n\t} finally {\n\t\ttry {\n\t\t\tdomSel.setBaseAndExtent(\n\t\t\t\torigEndpoints.anchorNode,\n\t\t\t\torigEndpoints.anchorOffset,\n\t\t\t\torigEndpoints.focusNode,\n\t\t\t\torigEndpoints.focusOffset,\n\t\t\t);\n\t\t} catch {\n\t\t\t// Restore may fail if DOM changed\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Fallback (model-based) when Selection.modify is unavailable\n// ---------------------------------------------------------------------------\n\nfunction fallbackMove(\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tif (granularity === 'word') {\n\t\treturn fallbackWordMove(state, direction);\n\t}\n\tif (granularity === 'lineboundary') {\n\t\treturn direction === 'forward' ? moveToBlockEnd(state) : moveToBlockStart(state);\n\t}\n\t// granularity === 'line' → cross-block\n\tconst caretDir = direction === 'forward' ? 'down' : 'up';\n\treturn navigateAcrossBlocks(state, caretDir);\n}\n\nfunction fallbackExtend(\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst head = sel.head;\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tlet newOffset: number = head.offset;\n\n\tif (granularity === 'word') {\n\t\tnewOffset =\n\t\t\tdirection === 'forward'\n\t\t\t\t? findWordBoundaryForward(block, head.offset)\n\t\t\t\t: findWordBoundaryBackward(block, head.offset);\n\t} else if (granularity === 'lineboundary') {\n\t\tnewOffset = direction === 'forward' ? getBlockLength(block) : 0;\n\t} else {\n\t\t// line: extend to next block boundary\n\t\tconst adj = resolveAdjacentBlock(state, head.blockId, direction === 'forward');\n\t\tif (!adj) return null;\n\t\t// Cannot extend a text selection into a void block\n\t\tif (adj.isVoid) return null;\n\n\t\tconst targetBlock = state.getBlock(adj.targetId);\n\t\tif (!targetBlock) return null;\n\n\t\tconst targetOffset: number = direction === 'forward' ? 0 : getBlockLength(targetBlock);\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, adj.targetId, targetOffset);\n\t}\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, newOffset);\n}\n\nfunction fallbackWordMove(state: EditorState, direction: Direction): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst newOffset: number =\n\t\tdirection === 'forward'\n\t\t\t? findWordBoundaryForward(block, offset)\n\t\t\t: findWordBoundaryBackward(block, offset);\n\n\tif (newOffset === offset) {\n\t\t// At block boundary — try crossing blocks\n\t\treturn fallbackCrossBlock(state, blockId, direction);\n\t}\n\n\treturn moveTx(state, blockId, newOffset);\n}\n\n/**\n * Crosses a block boundary from `blockId` in the given direction.\n * Checks `canCrossBlockBoundary` and handles void blocks (→ NodeSelection).\n */\nfunction fallbackCrossBlock(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tdirection: Direction,\n): Transaction | null {\n\tconst adj = resolveAdjacentBlock(state, blockId, direction === 'forward');\n\tif (!adj) return null;\n\n\tif (adj.isVoid) return nodeSelTx(state, adj.targetId);\n\n\tconst targetBlock = state.getBlock(adj.targetId);\n\tif (!targetBlock) return null;\n\n\tconst targetOffset: number = direction === 'forward' ? 0 : getBlockLength(targetBlock);\n\treturn moveTx(state, adj.targetId, targetOffset);\n}\n\n// ---------------------------------------------------------------------------\n// Convenience wrappers\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor one word forward. */\nexport function moveWordForward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'word');\n}\n\n/** Moves the cursor one word backward. */\nexport function moveWordBackward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'word');\n}\n\n/** Moves the cursor to the start of the line (visual). */\nexport function moveToLineStart(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'lineboundary');\n}\n\n/** Moves the cursor to the end of the line (visual). */\nexport function moveToLineEnd(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'lineboundary');\n}\n\n/** Moves the cursor one visual line up. */\nexport function moveLineUp(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'line');\n}\n\n/** Moves the cursor one visual line down. */\nexport function moveLineDown(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'line');\n}\n\n/** Extends the selection one word forward. */\nexport function extendWordForward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'word');\n}\n\n/** Extends the selection one word backward. */\nexport function extendWordBackward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'word');\n}\n\n/** Extends the selection to the start of the line. */\nexport function extendToLineStart(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'lineboundary');\n}\n\n/** Extends the selection to the end of the line. */\nexport function extendToLineEnd(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'lineboundary');\n}\n\n/** Extends the selection one visual line up. */\nexport function extendLineUp(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'line');\n}\n\n/** Extends the selection one visual line down. */\nexport function extendLineDown(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'line');\n}\n","/** Locale interface and default English locale for the CaretNavigationPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface CaretNavigationLocale {\n\treadonly paragraph: string;\n\treadonly heading1: string;\n\treadonly heading2: string;\n\treadonly heading3: string;\n\treadonly heading4: string;\n\treadonly heading5: string;\n\treadonly heading6: string;\n\treadonly codeBlock: string;\n\treadonly blockquote: string;\n\treadonly listItem: string;\n\treadonly horizontalRule: string;\n\treadonly image: string;\n\treadonly table: string;\n}\n\n// --- Default English Locale ---\n\nexport const CARET_NAVIGATION_LOCALE_EN: CaretNavigationLocale = {\n\tparagraph: 'Paragraph',\n\theading1: 'Heading 1',\n\theading2: 'Heading 2',\n\theading3: 'Heading 3',\n\theading4: 'Heading 4',\n\theading5: 'Heading 5',\n\theading6: 'Heading 6',\n\tcodeBlock: 'Code Block',\n\tblockquote: 'Block Quote',\n\tlistItem: 'List Item',\n\thorizontalRule: 'Horizontal Rule',\n\timage: 'Image',\n\ttable: 'Table',\n};\n\n// --- Block Type → Locale Key Mapping ---\n\nconst BLOCK_TYPE_KEY_MAP: Readonly<Record<string, keyof CaretNavigationLocale>> = {\n\tparagraph: 'paragraph',\n\tcode_block: 'codeBlock',\n\tblockquote: 'blockquote',\n\tlist_item: 'listItem',\n\thorizontal_rule: 'horizontalRule',\n\timage: 'image',\n\ttable: 'table',\n};\n\n/** Resolves a block type + attrs to a localized label string. */\nexport function resolveBlockLabel(\n\tlocale: CaretNavigationLocale,\n\ttypeName: string,\n\tattrs?: Record<string, unknown>,\n): string {\n\tif (typeName === 'heading' && attrs?.level) {\n\t\tconst key = `heading${attrs.level}` as keyof CaretNavigationLocale;\n\t\tif (key in locale) return locale[key];\n\t}\n\tconst key: keyof CaretNavigationLocale | undefined = BLOCK_TYPE_KEY_MAP[typeName];\n\treturn key ? locale[key] : typeName;\n}\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<CaretNavigationLocale> = import.meta.glob<{\n\tdefault: CaretNavigationLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadCaretNavigationLocale(lang: string): Promise<CaretNavigationLocale> {\n\treturn loadLocaleModule(localeModules, lang, CARET_NAVIGATION_LOCALE_EN);\n}\n","/**\n * CaretNavigationPlugin: registers platform-aware keymaps for all\n * programmatic movement commands (character, word, line, document).\n *\n * Movement priorities use 'navigation' to match GapCursorPlugin.\n * Also announces block-type changes to screen readers on cross-block navigation.\n */\n\nimport {\n\textendCharacterBackward,\n\textendCharacterForward,\n\textendToDocumentEnd,\n\textendToDocumentStart,\n\tmoveToDocumentEnd,\n\tmoveToDocumentStart,\n} from '../../commands/MovementCommands.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { getTextDirection, isMac } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport {\n\textendLineDown,\n\textendLineUp,\n\textendToLineEnd,\n\textendToLineStart,\n\textendWordBackward,\n\textendWordForward,\n\tmoveLineDown,\n\tmoveLineUp,\n\tmoveToLineEnd,\n\tmoveToLineStart,\n\tmoveWordBackward,\n\tmoveWordForward,\n} from '../../view/ViewMovementCommands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport {\n\tCARET_NAVIGATION_LOCALE_EN,\n\ttype CaretNavigationLocale,\n\tloadCaretNavigationLocale,\n\tresolveBlockLabel,\n} from './CaretNavigationLocale.js';\n\ntype ViewCommandFn = (container: HTMLElement, state: EditorState) => Transaction | null;\ntype ViewCommandKey = `${'word' | 'lineboundary' | 'line'}:${'forward' | 'backward'}`;\ntype ViewCommandLookup = Readonly<Record<ViewCommandKey, ViewCommandFn>>;\n\nconst VIEW_MOVE_FNS: ViewCommandLookup = {\n\t'word:forward': moveWordForward,\n\t'word:backward': moveWordBackward,\n\t'lineboundary:forward': moveToLineEnd,\n\t'lineboundary:backward': moveToLineStart,\n\t'line:forward': moveLineDown,\n\t'line:backward': moveLineUp,\n};\n\nconst VIEW_EXTEND_FNS: ViewCommandLookup = {\n\t'word:forward': extendWordForward,\n\t'word:backward': extendWordBackward,\n\t'lineboundary:forward': extendToLineEnd,\n\t'lineboundary:backward': extendToLineStart,\n\t'line:forward': extendLineDown,\n\t'line:backward': extendLineUp,\n};\n\n/** Debounce delay for block-type announcements (ms). */\nconst ANNOUNCE_DEBOUNCE_MS = 150;\n\nexport class CaretNavigationPlugin implements Plugin {\n\treadonly id = 'caret-navigation';\n\treadonly name = 'Caret Navigation';\n\treadonly priority = 4;\n\n\tprivate context: PluginContext | null = null;\n\tprivate lastAnnouncedBlockId: BlockId | null = null;\n\tprivate announceTimer: ReturnType<typeof setTimeout> | null = null;\n\tprivate announce: ((text: string) => void) | null = null;\n\tprivate locale: CaretNavigationLocale = CARET_NAVIGATION_LOCALE_EN;\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tundefined,\n\t\t\tCARET_NAVIGATION_LOCALE_EN,\n\t\t\tloadCaretNavigationLocale,\n\t\t);\n\n\t\tthis.context = context;\n\t\tthis.announce = (text: string) => context.announce(text);\n\t\tconst mac: boolean = isMac();\n\n\t\tconst keymap: Record<string, () => boolean> = {\n\t\t\t// --- Character movement (no modifier) ---\n\t\t\t// Handled natively by browser for basic cases, but Shift+Arrow\n\t\t\t// needs programmatic extend to correctly clear storedMarks.\n\n\t\t\t// --- Character extend ---\n\t\t\t'Shift-ArrowRight': () => this.extendCharacterVisual('right'),\n\t\t\t'Shift-ArrowLeft': () => this.extendCharacterVisual('left'),\n\n\t\t\t// --- Line extend ---\n\t\t\t'Shift-ArrowUp': () => this.viewExtendCommand('backward', 'line'),\n\t\t\t'Shift-ArrowDown': () => this.viewExtendCommand('forward', 'line'),\n\n\t\t\t// --- Word movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Alt-ArrowRight': () => this.viewMoveVisual('right', 'word'),\n\t\t\t\t\t\t'Alt-ArrowLeft': () => this.viewMoveVisual('left', 'word'),\n\t\t\t\t\t\t'Shift-Alt-ArrowRight': () => this.viewExtendVisual('right', 'word'),\n\t\t\t\t\t\t'Shift-Alt-ArrowLeft': () => this.viewExtendVisual('left', 'word'),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t'Mod-ArrowRight': () => this.viewMoveVisual('right', 'word'),\n\t\t\t\t\t\t'Mod-ArrowLeft': () => this.viewMoveVisual('left', 'word'),\n\t\t\t\t\t\t'Mod-Shift-ArrowRight': () => this.viewExtendVisual('right', 'word'),\n\t\t\t\t\t\t'Mod-Shift-ArrowLeft': () => this.viewExtendVisual('left', 'word'),\n\t\t\t\t\t}),\n\n\t\t\t// --- Line boundary movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Mod-ArrowLeft': () => this.viewMoveVisual('left', 'lineboundary'),\n\t\t\t\t\t\t'Mod-ArrowRight': () => this.viewMoveVisual('right', 'lineboundary'),\n\t\t\t\t\t\t'Mod-Shift-ArrowLeft': () => this.viewExtendVisual('left', 'lineboundary'),\n\t\t\t\t\t\t'Mod-Shift-ArrowRight': () => this.viewExtendVisual('right', 'lineboundary'),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tHome: () => this.viewMoveCommand('backward', 'lineboundary'),\n\t\t\t\t\t\tEnd: () => this.viewMoveCommand('forward', 'lineboundary'),\n\t\t\t\t\t\t'Shift-Home': () => this.viewExtendCommand('backward', 'lineboundary'),\n\t\t\t\t\t\t'Shift-End': () => this.viewExtendCommand('forward', 'lineboundary'),\n\t\t\t\t\t}),\n\n\t\t\t// --- Document boundary movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Mod-ArrowUp': () => this.modelCommand(moveToDocumentStart),\n\t\t\t\t\t\t'Mod-ArrowDown': () => this.modelCommand(moveToDocumentEnd),\n\t\t\t\t\t\t'Mod-Shift-ArrowUp': () => this.modelCommand(extendToDocumentStart),\n\t\t\t\t\t\t'Mod-Shift-ArrowDown': () => this.modelCommand(extendToDocumentEnd),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t'Mod-Home': () => this.modelCommand(moveToDocumentStart),\n\t\t\t\t\t\t'Mod-End': () => this.modelCommand(moveToDocumentEnd),\n\t\t\t\t\t\t'Mod-Shift-Home': () => this.modelCommand(extendToDocumentStart),\n\t\t\t\t\t\t'Mod-Shift-End': () => this.modelCommand(extendToDocumentEnd),\n\t\t\t\t\t}),\n\t\t};\n\n\t\tcontext.registerKeymap(keymap, { priority: 'navigation' });\n\t}\n\n\t/** Announces block-type on cross-block cursor movement (debounced). */\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tconst newSel = newState.selection;\n\n\t\t// Only announce for collapsed text selections\n\t\tif (!isCollapsed(newSel) || !isTextSelection(newSel)) {\n\t\t\tif (this.announceTimer !== null) {\n\t\t\t\tclearTimeout(this.announceTimer);\n\t\t\t\tthis.announceTimer = null;\n\t\t\t}\n\t\t\tthis.lastAnnouncedBlockId = null;\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlockId: BlockId = newSel.anchor.blockId;\n\t\tif (newBlockId === this.lastAnnouncedBlockId) return;\n\n\t\t// First observed block (initial focus) — remember but don't announce\n\t\tif (this.lastAnnouncedBlockId === null) {\n\t\t\tthis.lastAnnouncedBlockId = newBlockId;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lastAnnouncedBlockId = newBlockId;\n\n\t\t// Debounce rapid navigation\n\t\tif (this.announceTimer !== null) clearTimeout(this.announceTimer);\n\t\tthis.announceTimer = setTimeout(() => {\n\t\t\tthis.announceTimer = null;\n\t\t\t// Skip if another plugin already announced (e.g. CodeBlockPlugin's \"Left code block\")\n\t\t\tif (this.context?.hasAnnouncement()) return;\n\t\t\tconst block = newState.getBlock(newBlockId);\n\t\t\tif (!block) return;\n\t\t\tconst label: string = resolveBlockLabel(\n\t\t\t\tthis.locale,\n\t\t\t\tblock.type,\n\t\t\t\tblock.attrs as Record<string, unknown> | undefined,\n\t\t\t);\n\t\t\tthis.announce?.(label);\n\t\t}, ANNOUNCE_DEBOUNCE_MS);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.announceTimer !== null) clearTimeout(this.announceTimer);\n\t\tthis.announceTimer = null;\n\t\tthis.announce = null;\n\t\tthis.context = null;\n\t}\n\n\t/** Dispatches a model-based movement command (no DOM needed). */\n\tprivate modelCommand(fn: (state: EditorState) => Transaction | null): boolean {\n\t\tif (!this.context) return false;\n\t\tconst tr: Transaction | null = fn(this.context.getState());\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Extends selection by one character based on visual left/right intent. */\n\tprivate extendCharacterVisual(visual: 'left' | 'right'): boolean {\n\t\tif (!this.context) return false;\n\t\tconst state: EditorState = this.context.getState();\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(state, visual);\n\t\tconst tr: Transaction | null =\n\t\t\tdir === 'forward' ? extendCharacterForward(state) : extendCharacterBackward(state);\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Dispatches a view-based movement command (uses container + Selection.modify). */\n\tprivate viewMoveCommand(\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\treturn this.dispatchViewCommand(VIEW_MOVE_FNS, direction, granularity);\n\t}\n\n\t/** Dispatches a view-based move command with visual direction mapping for RTL. */\n\tprivate viewMoveVisual(visual: 'left' | 'right', granularity: 'word' | 'lineboundary'): boolean {\n\t\tif (!this.context) return false;\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(\n\t\t\tthis.context.getState(),\n\t\t\tvisual,\n\t\t);\n\t\treturn this.viewMoveCommand(dir, granularity);\n\t}\n\n\t/** Dispatches a view-based extend command. */\n\tprivate viewExtendCommand(\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\treturn this.dispatchViewCommand(VIEW_EXTEND_FNS, direction, granularity);\n\t}\n\n\tprivate dispatchViewCommand(\n\t\tlookup: ViewCommandLookup,\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\tif (!this.context) return false;\n\t\tconst fn: ViewCommandFn | undefined = lookup[`${granularity}:${direction}`];\n\t\tif (!fn) return false;\n\t\tconst tr: Transaction | null = fn(this.context.getContainer(), this.context.getState());\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Dispatches a view-based extend command with visual direction mapping for RTL. */\n\tprivate viewExtendVisual(\n\t\tvisual: 'left' | 'right',\n\t\tgranularity: 'word' | 'lineboundary',\n\t): boolean {\n\t\tif (!this.context) return false;\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(\n\t\t\tthis.context.getState(),\n\t\t\tvisual,\n\t\t);\n\t\treturn this.viewExtendCommand(dir, granularity);\n\t}\n\n\t/**\n\t * Resolves logical movement direction from visual left/right intent.\n\t * In RTL blocks, visual directions are mirrored in offset space.\n\t */\n\tprivate resolveLogicalHorizontalDirection(\n\t\tstate: EditorState,\n\t\tvisual: 'left' | 'right',\n\t): 'forward' | 'backward' {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) {\n\t\t\treturn visual === 'left' ? 'backward' : 'forward';\n\t\t}\n\t\tconst container: HTMLElement | undefined = this.context?.getContainer();\n\t\tif (!container) return visual === 'left' ? 'backward' : 'forward';\n\t\tconst blockEl: Element | null = container.querySelector(\n\t\t\t`[data-block-id=\"${sel.head.blockId}\"]`,\n\t\t);\n\t\tconst isRtl: boolean = blockEl instanceof HTMLElement && getTextDirection(blockEl) === 'rtl';\n\t\tif (!isRtl) return visual === 'left' ? 'backward' : 'forward';\n\t\treturn visual === 'left' ? 'forward' : 'backward';\n\t}\n}\n"],"mappings":"4dAUA,IAAM,EAD+C,oBAAT,MAAwB,cAAe,KAEhF,IAAI,KAAK,eAAU,EAAW,CAAE,YAAa,aAC7C,KAYH,SAAgB,EAAiB,EAAc,GAC9C,GAAI,GAAU,EAAK,QAA0B,IAAhB,EAAK,OAAc,OAAO,EAEvD,GAAI,EAAW,CACd,IAAK,MAAM,KAAW,EAAU,QAAQ,GAAO,CAC9C,MAAM,EAAc,EAAQ,MAAQ,EAAQ,QAAQ,OACpD,GAAI,EAAM,EACT,OAAO,EAAM,CAEf,CACA,OAAO,CACR,CAEA,OAAO,CACR,CAOA,SAAgB,EAAiB,EAAc,GAC9C,GAAI,GAAU,GAAqB,IAAhB,EAAK,OAAc,OAAO,EAE7C,GAAI,EAAW,CACd,IAAI,EAAW,EACf,IAAK,MAAM,KAAW,EAAU,QAAQ,GAAO,CAC9C,GAAI,EAAQ,MAAQ,EAAQ,QAAQ,QAAU,EAAQ,CACrD,EAAW,EAAQ,QAAQ,OAC3B,KACD,CACA,EAAW,EAAQ,QAAQ,MAC5B,CACA,OAAO,CACR,CAEA,OAAO,CACR,CClDA,SAAgB,EAAyB,EAAkB,GAC1D,IAAI,EAAM,EAAS,EAEnB,KAAO,GAAO,GAAG,CAChB,MAAM,EAAU,EAAmB,EAAO,GAC1C,IAAK,GAA4B,WAAjB,EAAQ,KAAmB,MAC3C,IAAK,KAAK,KAAK,EAAQ,MAAO,MAC9B,GACD,CAEA,GAAI,GAAO,GAEY,WADN,EAAmB,EAAO,IAC7B,KAAmB,OAAO,EAGxC,KAAO,GAAO,GAAG,CAChB,MAAM,EAAU,EAAmB,EAAO,GAC1C,IAAK,GAA4B,WAAjB,EAAQ,K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as c,V as s,h as i,j as a,k as l}from"./Document-ssR6hBzG.mjs";import{r as d}from"./NodeResolver-F4RtpoEd.mjs";import{a as u,c as g,f as p,l as f,n as h,o as k,p as b}from"./Selection-DC6AOGgF.mjs";import{a as m}from"./TypeBrands-Ch9856Gb.mjs";import{C as v,S as x,_ as y,v as C,y as S}from"./BlockInsertion-CxKdCKJd.mjs";import{t as w}from"./Commands-DBBCAYBn.mjs";import{a as I,i as _,t as B}from"./Decoration-BoFcdSXk.mjs";import{t as A}from"./SyntaxTokenTypes-BUCOMtL8.mjs";import{n as T}from"./TypedKeys-CA4bfw9O.mjs";import{c as L,o as M}from"./PluginHelpers-B3gk3VB3.mjs";import{c as O}from"./StyleRuntime-C0RSqKzG.mjs";import{n as P}from"./DomUtils-Bf7JLFlx.mjs";import{t as N}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as E}from"./PopupManager-Jz5JrUdC.mjs";import{a as j,i as z,n as $,o as q,r as D,t as H}from"./xml-BsV44TrJ.mjs";import{n as R}from"./PopupKeyboardPatterns-BcwdDxRq.mjs";var V=`\n/* Code Block — uses theme custom properties */\n.notectl-code-block {\n\tposition: relative;\n\tmargin: 8px 0;\n\tborder-radius: 6px;\n\tbackground: var(--notectl-code-block-bg);\n\tcolor: var(--notectl-code-block-color);\n\tfont-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;\n\tfont-size: 14px;\n\tline-height: 1.5;\n\toverflow: hidden;\n}\n\n.notectl-code-block__header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 6px 12px;\n\tbackground: var(--notectl-code-block-header-bg);\n\tborder-bottom: 1px solid var(--notectl-code-block-header-border);\n\tfont-size: 12px;\n\tcolor: var(--notectl-code-block-header-color);\n\tuser-select: none;\n}\n\n.notectl-code-block__language-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 4px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 2px 6px;\n\tfont-size: inherit;\n\tfont-family: inherit;\n\ttransition: background 0.15s;\n}\n\n.notectl-code-block__language-btn:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-code-block__language-btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-code-block__language {\n\tfont-weight: 500;\n\tletter-spacing: 0.02em;\n}\n\n.notectl-code-block__chevron {\n\tdisplay: inline-flex;\n\talign-items: center;\n\topacity: 0.6;\n}\n\n.notectl-code-block__actions {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n}\n\n.notectl-code-block__copy,\n.notectl-code-block__delete {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 24px;\n\theight: 24px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 0;\n\ttransition: background 0.15s, color 0.15s;\n}\n\n.notectl-code-block__copy:hover,\n.notectl-code-block__delete:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n\tcolor: var(--notectl-code-block-color);\n}\n\n.notectl-code-block__copy svg,\n.notectl-code-block__delete svg {\n\tfill: currentColor;\n}\n\n.notectl-code-block__content {\n\tdisplay: block;\n\tpadding: 12px 16px;\n\twhite-space: pre-wrap;\n\tword-wrap: break-word;\n\ttab-size: 4;\n\t-moz-tab-size: 4;\n\toutline: none;\n\tmin-height: 1.5em;\n}\n\n.notectl-code-block--selected {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n.notectl-code-block__esc-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: 4px;\n\tinset-inline-end: 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-code-block-header-color);\n\topacity: 0.5;\n\tpointer-events: none;\n\tuser-select: none;\n\tfont-family: system-ui, sans-serif;\n}\n\n.notectl-code-block--focused .notectl-code-block__esc-hint {\n\tdisplay: block;\n}\n\n/* Language picker popup */\n.notectl-language-picker {\n\tmin-width: 120px;\n\tmax-height: 200px;\n\toverflow-y: auto;\n\tpadding: 4px;\n\tbackground: var(--notectl-surface-raised, #fff);\n\tborder: 1px solid var(--notectl-border, #e0e0e0);\n\tborder-radius: 6px;\n\tbox-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n}\n\n.notectl-language-picker__option {\n\tpadding: 6px 10px;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg, #333);\n\twhite-space: nowrap;\n}\n\n.notectl-language-picker__option:hover {\n\tbackground: rgba(128, 128, 128, 0.1);\n}\n\n.notectl-language-picker__option:focus {\n\toutline: none;\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-language-picker__option[aria-selected="true"] {\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary, #2563eb);\n}\n\n/* Syntax highlighting token classes — generated from canonical token type list */\n${A.map(t=>`.notectl-token--${t} {\n\tcolor: var(--notectl-code-token-${t});\n\tfont-style: var(--notectl-code-token-${t}-font-style, inherit);\n\tfont-weight: var(--notectl-code-token-${t}-font-weight, inherit);\n}`).join("\n")}\n`,F=[{open:"(",close:")",kind:"bracket"},{open:"[",close:"]",kind:"bracket"},{open:"{",close:"}",kind:"bracket"},{open:'"',close:'"',kind:"quote"},{open:"'",close:"'",kind:"quote"},{open:"`",close:"`",kind:"quote"}],K=new Map(F.map(t=>[t.open,t])),W=new Map(F.filter(t=>"bracket"===t.kind).map(t=>[t.close,t]));var U=/* @__PURE__ */new Set(["{","[","("]),J={"}":"{","]":"[",")":"("};function X(t,e){const n=t.lastIndexOf("\n",e-1)+1,o=t.indexOf("\n",e);return{start:n,end:-1===o?t.length:o}}function Y(t,e){const{start:n,end:o}=X(t,e);let r=n;for(;r<o;){const e=t[r];if(" "!==e&&"\t"!==e)break;r++}return t.slice(n,r)}function Z(t,e){return t?" ".repeat(e):"\t"}function G(t,e,n){if(0===t.length)return{removed:"",rest:t};if(!e&&"\t"===t[0])return{removed:"\t",rest:t.slice(1)};let o=0;for(;o<n&&" "===t[o];)o++;return{removed:t.slice(0,o),rest:t.slice(o)}}var Q=class{buckets=/* @__PURE__ */new Map;push(t,e){const n=this.buckets.get(t.blockId)??[];n.push({pos:t,char:e}),this.buckets.set(t.blockId,n)}take(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const r=n[o];if(r&&r.pos.offset===e)return n.splice(o,1),0===n.length&&this.buckets.delete(t),r}}peek(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const t=n[o];if(t&&t.pos.offset===e)return t}}clearBlock(t){this.buckets.delete(t)}clear(){this.buckets.clear()}sizeForBlock(t){return this.buckets.get(t)?.length??0}get size(){let t=0;for(const e of this.buckets.values())t+=e.length;return t}migrate(t){if(t.isEmpty)return;const e=/* @__PURE__ */new Map;for(const n of this.buckets.values())for(const o of n){const n=t.mapResult(o.pos,1);if(n.deleted)continue;const r={pos:n.pos,char:o.char},c=n.pos.blockId,s=e.get(c)??[];s.push(r),e.set(c,s)}this.buckets.clear();for(const[n,o]of e)this.buckets.set(n,o)}static makePos(t,e){return u(t,e)}},tt=class{resolvedIndent;resolvedPairing;getTokenAt;getCompositionState;pairs=new Q;pendingPairOps=[];constructor(t){this.resolvedIndent=t.resolvedIndent,this.resolvedPairing=t.resolvedPairing,this.getTokenAt=t.getTokenAt,this.getCompositionState=t.getCompositionState}get pairStack(){return this.pairs}clear(){this.pairs.clear(),this.pendingPairOps.length=0}syncOnStateChange(t,e){this.pairs.size>0&&!e.mapping.isEmpty&&this.pairs.migrate(e.mapping);for(const n of this.pendingPairOps)"push"===n.kind?this.pairs.push(u(n.blockId,n.offset),n.char):this.pairs.take(n.blockId,n.offset);this.pendingPairOps.length=0;for(const n of e.steps){if("setBlockType"!==n.type)continue;const e=t.getBlock(n.blockId);e&&"code_block"===e.type||this.pairs.clearBlock(n.blockId)}}handleTextInput=(t,e)=>{this.pendingPairOps.length=0;const n=this.getCompositionState();if(!n)return null;if(n.isComposing)return null;if(!p(e.selection))return null;if(1!==t.length)return null;const o=e.selection,r=e.getBlock(o.anchor.blockId);if(!r||"code_block"!==r.type)return null;const c=this.tryDedentOnCloseBracket(e,r,t);if(c)return c;const s=function(t){const{state:e,char:n,config:o}=t;if(!p(e.selection))return{kind:"passthrough"};const r=e.selection,c=K.get(n);if(c&&!g(r)&&function(t,e){switch(e.surround){case"never":return!1;case"brackets":return"bracket"===t.kind;case"quotes":return"quote"===t.kind;case"languageDefined":return!0}}(c,o)){const e=function(t,e,n){const{state:o}=n,r=o.getBlockOrder(),c=b(e,r);return c.from.blockId!==c.to.blockId||c.from.blockId!==n.blockId?null:{kind:"wrap",open:t.open,close:t.close}}(c,r,t);if(e)return e}return g(r)?o.overtype&&function(t,e){if(!function(t){const e=K.get(t);return"quote"===e?.kind?e:W.get(t)}(e))return!1;const n=t.state.selection;if(!p(n))return!1;const o=a(t.block),r=n.anchor.offset;if(o[r]!==e)return!1;const c=t.pairStack.peek(t.blockId,r);return Boolean(c&&c.char===e)}(t,n)?{kind:"overtype"}:c&&function(t,e){const n="quote"===t.kind?e.config.quotes:e.config.brackets;if("never"===n)return!1;const o=e.state.selection;if(!p(o))return!0;const r=a(e.block),c=o.anchor.offset;if("quote"===t.kind&&"'"===t.open&&function(t,e){if(e<=0)return!1;const n=t[e-1];return!!n&&/[A-Za-z0-9_]/.test(n)}(r,c))return!1;if("always"===n)return!0;if("beforeWhitespace"===n)return function(t,e){if(e>=t.length)return!0;const n=t[e];return!n||!!/\s/.test(n)||!!W.has(n)}(r,c);if("quote"===t.kind){const t=e.getTokenAt(e.blockId,c);return!t||"string"!==t.type&&"comment"!==t.type}return!0}(c,t)?{kind:"pair",close:c.close}:{kind:"passthrough"}:{kind:"passthrough"}}({state:e,block:r,blockId:o.anchor.blockId,char:t,config:this.resolvedPairing,pairStack:this.pairs,getTokenAt:this.getTokenAt});switch(s.kind){case"pair":return this.buildAutoPairTransaction(e,o.anchor.blockId,s.close,t);case"overtype":return this.buildOvertypeTransaction(e,o.anchor.blockId);case"wrap":return this.buildWrapTransaction(e,o.anchor.blockId,s.open,s.close);case"passthrough":return null}};tryDedentOnCloseBracket(t,e,n){if("brackets"!==this.resolvedIndent.mode)return null;if("}"!==n&&"]"!==n&&")"!==n)return null;const o=t.selection;if(!p(o)||!g(o))return null;const r=a(e),c=o.anchor.offset;if(!function(t,e){const{start:n}=X(t,e);for(let o=n;o<e;o++){const e=t[o];if(" "!==e&&"\t"!==e)return!1}return!0}(r,c))return null;const{start:s}=X(r,c);if(s===c)return null;const i=o.anchor.blockId,l=this.findTrackedCloseAfter(r,c,n,i);if(null!==l)return t.transaction("input").deleteTextAt(i,s,l).setSelection(h(i,s+1)).build();const d=G(r.slice(s,c),this.resolvedIndent.useSpaces,this.resolvedIndent.spaceCount);if(0===d.removed.length)return null;const u=c-d.removed.length;return t.transaction("input").deleteTextAt(i,u,c).insertText(i,u,n,[]).setSelection(h(i,u+1)).build()}findTrackedCloseAfter(t,e,n,o){for(let r=e;r<t.length;r++){const e=t[r];if(" "!==e&&"\t"!==e&&"\n"!==e){if(e===n){const t=this.pairs.peek(o,r);if(t&&t.char===n)return r}return null}}return null}buildAutoPairTransaction(t,e,n,o){const r=t.selection;if(!p(r))throw new Error("buildAutoPairTransaction requires a text selection");const c=r.anchor.offset,s=`${o}${n}`,i=t.transaction("input").insertText(e,c,s,[]).setSelection(h(e,c+1)).build();return this.pendingPairOps.push({kind:"push",blockId:e,offset:c+1,char:n}),i}buildOvertypeTransaction(t,e){const n=t.selection;if(!p(n))throw new Error("buildOvertypeTransaction requires a text selection");const o=n.anchor.offset;return this.pendingPairOps.push({kind:"take",blockId:e,offset:o}),t.transaction("input").setSelection(h(e,o+1)).build()}buildWrapTransaction(t,e,n,o){const r=t.selection;if(!p(r))throw new Error("buildWrapTransaction requires a text selection");const c=function(t,e){const n=b(t,e);return{fromOffset:n.from.offset,toOffset:n.to.offset}}(r,t.getBlockOrder()),s=b(r,t.getBlockOrder()).from===r.anchor,i=c.fromOffset+1,a=c.toOffset+1,l=s?i:a,d=s?a:i;return t.transaction("input").insertText(e,c.toOffset,o,[]).insertText(e,c.fromOffset,n,[]).setSelection({anchor:{blockId:e,offset:l},head:{blockId:e,offset:d}}).build()}};function et(t,e){const n=t.getState();if(!p(n.selection))return!1;const o=n.selection,r=n.getBlock(o.anchor.blockId);return!(!r||"code_block"!==r.type)&&e({state:n,sel:o,block:r,blockId:o.anchor.blockId,offset:o.anchor.offset})}function nt(t,e,n,r){const c={Enter:()=>function(t,e){return et(t,({state:n,block:r,blockId:c,offset:s})=>{if(!g(n.selection))return!1;const i=a(r);if(i.endsWith("\n")&&s===i.length)return function(t,e,n){const r=t.getState(),c=n.length-1,s=o(),i=r.transaction("input").deleteTextAt(e,c,n.length).splitBlock(e,c,s).setBlockType(s,m("paragraph")).setSelection(h(s,0)).build();return t.dispatch(i),!0}(t,c,i);const l=Z(e.indent.useSpaces,e.indent.spaceCount);if("brackets"===e.indent.mode&&function(t,e){return function(t,e){if(e<=0||e>=t.length)return!1;const n=t[e-1],o=t[e];return!(!n||!o)&&J[o]===n}(t,e)}(i,s)){const e=Y(i,s),o=`\n${e}${l}\n${e}`,r=s+1+e.length+l.length,a=n.transaction("input").insertText(c,s,o,[]).setSelection(h(c,r)).build();return t.dispatch(a),!0}const d=`\n${function(t,e,n,o){if("none"===n)return"";const r=Y(t,e);return"keep"===n?r:function(t,e){const n=function(t,e){const{start:n}=X(t,e);for(let o=e-1;o>=n;o--){const e=t[o];if(e&&" "!==e&&"\t"!==e)return e}return""}(t,e);return U.has(n)}(t,e)?r+o:r}(i,s,e.indent.mode,l)}`,u=n.transaction("input").insertText(c,s,d,[]).setSelection(h(c,s+d.length)).build();return t.dispatch(u),!0})}(t,r),Backspace:()=>function(t,e){return et(t,({state:n,block:o,blockId:r,offset:c})=>{if(!g(n.selection))return!1;if(e.pairing.deletePair&&c>0){const s=a(o),i=s[c-1],l=s[c];if(i&&l&&function(t,e){switch(t){case"(":return")"===e;case"[":return"]"===e;case"{":return"}"===e;case'"':case"'":case"`":return e===t;default:return!1}}(i,l)){const o=e.pairStack.peek(r,c);if(o&&o.char===l){const e=n.transaction("input").deleteTextAt(r,c-1,c+1).setSelection(h(r,c-1)).build();return t.dispatch(e),!0}}}if(0!==c)return!1;const s=n.transaction("input").setBlockType(r,m("paragraph")).setSelection(n.selection).build();return t.dispatch(s),!0})}(t,r),Tab:()=>function(t,e){return et(t,({state:n,sel:o,block:r,blockId:c,offset:s})=>{const i=Z(e.indent.useSpaces,e.indent.spaceCount);if(g(o)){const e=n.transaction("input").insertText(c,s,i,[]).setSelection(h(c,s+i.length)).build();return t.dispatch(e),!0}if(o.anchor.blockId!==c||o.head.blockId!==c)return!1;const l=a(r),d=b(o,n.getBlockOrder()),u=d.from.offset,p=d.to.offset;if(!l.slice(u,p).includes("\n")){const e=n.transaction("input").deleteTextAt(c,u,p).insertText(c,u,i,[]).setSelection(h(c,u+i.length)).build();return t.dispatch(e),!0}const m=function(t,e,n,o){const r=t.lastIndexOf("\n",e-1)+1,c=[];let s=0,i=r;for(;i<n;){c.push({offset:i,text:o}),s++;const e=t.indexOf("\n",i);if(-1===e||e>=n)break;i=e+1}return{inserts:c,totalInserted:s*o.length,lineCount:s,lineStart:r}}(l,u,p,i),v=n.transaction("input");for(let t=m.inserts.length-1;t>=0;t--){const e=m.inserts[t];e&&v.insertText(c,e.offset,e.text,[])}const x=f(o,n.getBlockOrder()),y=m.lineStart,C=p+m.totalInserted,S=x?y:C,w=x?C:y;return v.setSelection(k({blockId:c,offset:S},{blockId:c,offset:w})),t.dispatch(v.build()),m.lineCount>=2&&t.announce(e.locale().indentedNLines(m.lineCount)),!0})}(t,r),"Shift-Tab":()=>function(t,e){return et(t,({state:n,sel:o,block:r,blockId:c,offset:s})=>{const i=a(r);if(g(o))return ot(t,n,c,s,i,e);if(o.anchor.blockId!==c||o.head.blockId!==c)return!1;const l=b(o,n.getBlockOrder()),d=l.from.offset,u=l.to.offset;if(!i.slice(d,u).includes("\n"))return ot(t,n,c,s,i,e);const p=function(t,e,n,o,r){const c=t.lastIndexOf("\n",e-1)+1,s=[];let i=0,a=0,l=c;for(;l<n;){a++;const e=G(t.slice(l),o,r);e.removed.length>0&&(s.push({from:l,to:l+e.removed.length}),i+=e.removed.length);const c=t.indexOf("\n",l);if(-1===c||c>=n)break;l=c+1}return{deletes:s,totalRemoved:i,lineCount:a,lineStart:c}}(i,d,u,e.indent.useSpaces,e.indent.spaceCount);if(0===p.totalRemoved)return!0;const h=n.transaction("input");for(let t=p.deletes.length-1;t>=0;t--){const e=p.deletes[t];e&&h.deleteTextAt(c,e.from,e.to)}const m=f(o,n.getBlockOrder()),v=p.lineStart,x=u-p.totalRemoved,y=m?v:Math.max(v,x),C=m?Math.max(v,x):v;return h.setSelection(k({blockId:c,offset:y},{blockId:c,offset:C})),t.dispatch(h.build()),p.lineCount>=2&&t.announce(e.locale().dedentedNLines(p.lineCount)),!0})}(t,r),Escape:()=>rt(t),ArrowDown:()=>function(t){return et(t,({state:e,block:n,blockId:o,offset:r})=>!!g(e.selection)&&-1===a(n).indexOf("\n",r)&&(st(t,e,o),!0))}(t),ArrowUp:()=>function(t){return et(t,({state:e,block:n,blockId:o,offset:r})=>{if(!g(e.selection))return!1;const c=a(n).indexOf("\n");return!(-1!==c&&r>c)&&it(t,e,o)})}(t),ArrowRight:()=>function(t){return et(t,({state:e,block:n,blockId:o,offset:r})=>!!g(e.selection)&&r===a(n).length&&(st(t,e,o),!0))}(t),ArrowLeft:()=>function(t){return et(t,({state:e,blockId:n,offset:o})=>!!g(e.selection)&&0===o&&it(t,e,n))}(t)},{insertAfter:s,toggle:i}=n;s&&(c[s]=()=>function(t){return et(t,({blockId:e})=>(ct(t,e),!0))}(t)),i&&(c[i]=()=>t.executeCommand("toggleCodeBlock")),t.registerKeymap(c,{priority:"context"})}function ot(t,e,n,o,r,c){const{start:s}=X(r,o),i=G(r.slice(s),c.indent.useSpaces,c.indent.spaceCount);if(0===i.removed.length)return!0;const a=e.transaction("input").deleteTextAt(n,s,s+i.removed.length).setSelection(h(n,Math.max(s,o-i.removed.length))).build();return t.dispatch(a),!0}function rt(t){return et(t,({state:e,blockId:n})=>(st(t,e,n),!0))}function ct(t,e){const n=t.getState(),r=n.getBlock(e);if(!r)return;const c=l(r),s=o(),i=n.transaction("command").splitBlock(e,c,s).setBlockType(s,m("paragraph")).setSelection(h(s,0)).build();t.dispatch(i)}function st(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<o.length-1){const n=o[r+1],c=e.transaction("command").setSelection(h(n,0)).build();return void t.dispatch(c)}ct(t,n)}function it(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<=0)return!1;const c=o[r-1],s=e.getBlock(c),i=s?l(s):0,a=e.transaction("command").setSelection(h(c,i)).build();return t.dispatch(a),!0}function at(t,e){const n=t.getState(),o=n.selection;if(!p(o))return!1;const c=n.getBlock(o.anchor.blockId);if(!c||"code_block"===c.type)return!1;const i={language:e.defaultLanguage??"",backgroundColor:""},a=n.transaction("command");return function(t,e){if(0===l(e))return;const n=r(e);let o=0;for(const r of n)if(s(r)){if(r.text.length>0)for(const n of r.marks)t.removeMark(e.id,o,o+r.text.length,n);o+=r.text.length}else o+=1}(a,c),a.setBlockType(o.anchor.blockId,m("code_block"),i).setSelection(h(o.anchor.blockId,0)),t.dispatch(a.build()),!0}function lt(t,e){const n=d(t.doc,e);if(!n)return null;const r=S(n),s=v(t,r),a=x(s,e);if(a<0)return null;const l=t.transaction("command");if(1===s.length){const t=o();return l.insertNode(r,0,i(t)),l.removeNode(r,1),l.setSelection(h(t,0)),l.build()}l.removeNode(r,a);const u=function(t,e,n,r){const s=n[r-1];if(s&&c(s)){const e=y(t,s.id,"end");if(e)return e}const a=n[r+1];if(a&&c(a)){const e=y(t,a.id,"start");if(e)return e}const l=n[r],d=l&&c(l)?l.id:void 0,u=C(t,"start",d);if(u)return u;const g=o();return e.insertNode([],0,i(g)),h(g,0)}(t,l,s,a);return l.setSelection(u),l.build()}var dt=class{bundles=/* @__PURE__ */new Map;listeners=[];register(t){this.bundles.set(t.id,t);for(const e of this.listeners)e(t)}onRegister(t){this.listeners.push(t);for(const e of this.bundles.values())t(e)}get(t){return this.bundles.get(t)}getAll(){return[...this.bundles.values()]}},ut={insertAfter:"Mod-Enter",toggle:"Mod-Shift-M"},gt={defaultLanguage:"",useSpaces:!1,spaceCount:2,showCopyButton:!0},pt=new T("codeBlock"),ft=new T("syntaxHighlighter"),ht=class{languageMap=/* @__PURE__ */new Map;constructor(t){if(t)for(const e of t)this.registerLanguageInternal(e)}registerLanguage(t){this.registerLanguageInternal(t)}tokenize(t,e){const n=this.languageMap.get(e.toLowerCase());if(!n)return[];const o=[];for(const r of j(t,n))o.push({from:r.from,to:r.to,type:r.type});return o}getSupportedLanguages(){const t=/* @__PURE__ */new Set;for(const e of this.languageMap.values()){t.add(e.name);for(const n of e.aliases)t.add(n)}return[...t]}registerLanguageInternal(t){this.languageMap.set(t.name.toLowerCase(),t);for(const e of t.aliases)this.languageMap.set(e.toLowerCase(),t)}},kt=[{id:z.name,displayName:"Java",aliases:z.aliases,highlighting:z},{id:D.name,displayName:"JSON",aliases:D.aliases,highlighting:D},{id:$.name,displayName:"TypeScript",aliases:$.aliases,highlighting:$},{id:H.name,displayName:"XML",aliases:H.aliases,highlighting:H}],bt={label:"Code Block",tooltip:t=>t?`Code Block (${t})`:"Code Block",enteredCodeBlock:"Entered code block. Press Escape to exit.",leftCodeBlock:"Left code block.",copyCodeAria:"Copy code",escToExit:"Esc to exit",codeBlockAriaLabel:t=>`${t} code block. Press Escape to exit.`,copiedToClipboard:"Copied to clipboard",copyFailed:"Failed to copy code",deleteCodeBlockAria:"Delete code block",deletedCodeBlock:"Code block deleted",selectLanguageAria:"Select language",languageChanged:t=>`Language changed to ${t}`,plainText:"plain",indentedNLines:t=>1===t?"1 line indented":`${t} lines indented`,dedentedNLines:t=>1===t?"1 line dedented":`${t} lines dedented`},mt=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--Isa9OHJ.mjs"),"./locales/de.ts":()=>import("./de-Dl4QFHMa.mjs"),"./locales/es.ts":()=>import("./es-DD01rZ6N.mjs"),"./locales/fr.ts":()=>import("./fr-CfhyYN-t.mjs"),"./locales/hi.ts":()=>import("./hi-B2YB3Bo4.mjs"),"./locales/pt.ts":()=>import("./pt-DYMyMgKQ.mjs"),"./locales/ru.ts":()=>import("./ru-l73diFXn.mjs"),"./locales/zh.ts":()=>import("./zh-Baxh6v0j.mjs")});async function vt(t){return L(mt,t,bt)}var xt='[role="option"]';function yt(t,e,n,o){const r=document.createElement("div");r.className="notectl-language-picker__option",r.setAttribute("role","option"),r.setAttribute("data-language",n),r.setAttribute("aria-selected",String(o)),r.setAttribute("tabindex",o?"0":"-1"),r.textContent=e,t.appendChild(r)}function Ct(t,e,n,o){const r=t.getState(),c=r.getBlock(e);if(!c||"code_block"!==c.type)return;const s=r.getNodePath(e);if(!s)return;const i={...c.attrs,[n]:o},a=r.transaction("command").setNodeAttr(s,i).build();t.dispatch(a)}var St=class{entries=/* @__PURE__ */new Map;getTokens(t,e,n,o){const r=this.entries.get(t);if(r&&r.text===e&&r.language===n)return r.tokens;const c=o?.tokenize(e,n)??[];return this.entries.set(t,{text:e,language:n,tokens:c}),c}findTokenAt(t,e){const n=this.entries.get(t);if(!n)return;const o=n.tokens;let r=0,c=o.length-1;for(;r<=c;){const t=r+c>>>1,n=o[t];if(!n)return;if(e<n.from)c=t-1;else{if(!(e>=n.to))return n;r=t+1}}}retain(t){for(const e of this.entries.keys())t.has(e)||this.entries.delete(e)}clear(){this.entries.clear()}},wt=class{id="code-block";name="Code Block";priority=36;config;resolvedIndent;resolvedPairing;resolvedKeymap;context=null;locale;highlighter=null;tokenCache=new St;autoPair;constructor(t){this.config={...gt,...t},this.resolvedIndent=function(t){const e=t.indent?.useSpaces??t.useSpaces??false,n=t.indent?.spaceCount??t.spaceCount??2,o=Math.max(1,Math.min(16,Math.trunc(n)));return{mode:t.indent?.mode??"brackets",useSpaces:e,spaceCount:o}}(this.config),this.resolvedPairing=function(t){const e=t.pairing;return{brackets:e?.brackets??"languageDefined",quotes:e?.quotes??"languageDefined",overtype:e?.overtype??true,deletePair:e?.deletePair??true,surround:e?.surround??"languageDefined"}}(this.config),this.resolvedKeymap={...ut,...t?.keymap},this.autoPair=new tt({resolvedIndent:this.resolvedIndent,resolvedPairing:this.resolvedPairing,getTokenAt:(t,e)=>this.tokenCache.findTokenAt(t,e),getCompositionState:()=>this.context?.getCompositionState()??null})}async init(o){this.locale=await M(o,this.config.locale,bt,vt),o.registerStyleSheet(V),this.context=o,this.highlighter=function(t,e,n){const o=e.highlighter??new ht,r=/* @__PURE__ */new Map,c=new dt;c.onRegister(t=>{const e=t.highlighting;e&&o.registerLanguage&&r.get(t.id)!==e&&(o.registerLanguage(e),r.set(t.id,e),n.clear())}),t.registerService(q,c);for(const s of kt)c.register(s);return t.registerService(ft,{registerLanguage:t=>{o.registerLanguage?.(t),n.clear()},getSupportedLanguages:()=>o.getSupportedLanguages(),tokenize:(t,e)=>o.tokenize(t,e),getTokenAt:(t,e)=>n.findTokenAt(t,e)}),o}(o,this.config,this.tokenCache),function(o){o.registerNodeSpec({type:"code_block",group:"block",content:{allow:["text"]},selectable:!0,attrs:{language:{default:""},backgroundColor:{default:""}},toDOM(t){const e=P("pre",t.id);e.className="notectl-code-block",e.setAttribute("dir","ltr"),e.setAttribute("part","code-block");const n=document.createElement("code");return n.className="notectl-code-block__content",n.setAttribute("part","code-block-content"),e.appendChild(n),e},toHTML(o,r,c){const s=t(o.attrs?.language??""),i=String(o.attrs?.backgroundColor??""),a=s?` class="language-${s}"`:"";return`<pre dir="ltr"${e(i)?n(`background-color: ${i}`,c):""}><code${a}>${r||""}</code></pre>`},parseHTML:[{tag:"pre",getAttrs(t){const e=t.querySelector("code"),n=e?.className.match(/language-(\S+)/)?.[1]??"";return{language:(e?.getAttribute("data-language")??"")||n}}}],sanitize:{tags:["pre","code"],attrs:["data-language","class","style"]}})}(o),this.registerNodeView(o),function(t,e){t.registerCommand("toggleCodeBlock",()=>function(t,e){const n=t.getState();if(!p(n.selection))return!1;const o=n.getBlock(n.selection.anchor.blockId);if(!o)return!1;if("code_block"===o.type){const e=n.transaction("command").setBlockType(n.selection.anchor.blockId,m("paragraph")).setSelection(n.selection).build();return t.dispatch(e),!0}return at(t,e)}(t,e)),t.registerCommand("insertCodeBlock",()=>at(t,e)),t.registerCommand("setCodeBlockLanguage",()=>!1),t.registerCommand("setCodeBlockBackground",()=>!1),t.registerCommand("exitCodeBlock",()=>rt(t)),t.registerCommand("deleteCodeBlock",()=>function(t){const e=t.getState();if(!p(e.selection))return!1;const n=e.getBlock(e.selection.anchor.blockId);if(!n||"code_block"!==n.type)return!1;const o=lt(e,n.id);return!!o&&(t.dispatch(o),!0)}(t))}(o,this.config),nt(o,this.config,this.resolvedKeymap,{indent:this.resolvedIndent,pairing:this.resolvedPairing,pairStack:this.autoPair.pairStack,locale:()=>this.locale}),!1!==this.config.inputRule&&function(t){t.registerInputRule({pattern:/^```(\w*) $/,handler:(t,e,n,o)=>{const r=t.selection;if(!p(r))return null;if(!g(r))return null;const c=t.getBlock(r.anchor.blockId);if(!c||"paragraph"!==c.type)return null;const s={language:e[1]??"",backgroundColor:""};return t.transaction("input").deleteTextAt(r.anchor.blockId,n,n+e[0].length).setBlockType(r.anchor.blockId,m("code_block"),s).setSelection(h(r.anchor.blockId,0)).build()}})}(o),function(t,e,n){t.registerToolbarItem({id:"code_block",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"/><path d="M11 14.17L8.83 12 11 9.83 9.59 8.41 6 12l3.59 3.59L11 14.17zm3.41 1.42L18 12l-3.59-3.59L13 9.83 15.17 12 13 14.17l1.41 1.42z"/></svg>',label:e.label,tooltip:e.tooltip(n?N(n):void 0),command:"toggleCodeBlock",isActive:t=>!!p(t.selection)&&"code_block"===t.getBlock(t.selection.anchor.blockId)?.type})}(o,this.locale,this.resolvedKeymap.toggle),function(t){t.registerMiddleware((t,e,n)=>{if(!t.steps.some(t=>"addMark"===t.type&&"code_block"===e.getBlock(t.blockId)?.type))return void n(t);const o=t.steps.filter(t=>"addMark"!==t.type||"code_block"!==e.getBlock(t.blockId)?.type);n({...t,steps:o})},{name:"code-block:mark-guard",priority:50})}(o),function(t,e,n){t.registerService(pt,{setLanguage(e,n){Ct(t,e,"language",n)},getLanguage(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.language??"":""},setBackground(e,n){Ct(t,e,"backgroundColor",n)},getBackground(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.backgroundColor??"":""},isCodeBlock(t){const e=n();return!!e&&"code_block"===e.getState().getBlock(t)?.type},getSupportedLanguages(){const t=e();return t?t.getSupportedLanguages():[]}})}(o,()=>this.highlighter,()=>this.context),function(t){t.registerPasteInterceptor((t,e,n)=>{if(!t)return null;if(!p(n.selection))return null;const o=n.getBlock(n.selection.anchor.blockId);if(!o||"code_block"!==o.type)return null;const r=n.transaction("paste");let c=n.selection.anchor.blockId,s=n.selection.anchor.offset;if(!g(n.selection)){const t=w(n,r);t&&(c=t,s=0)}return r.insertText(c,s,t,[]),r.setSelection(h(c,s+t.length)),r.build()},{name:"code-block:paste",priority:10})}(o),o.registerTextInputInterceptor(this.autoPair.handleTextInput,{name:"code-block:auto-pair",priority:10}),function(t){t.registerNodeSpecExtension("table_cell",t=>!t.content||t.content.allow.includes("code_block")?t:{...t,content:{...t.content,allow:[...t.content.allow,"code_block"]}})}(o)}destroy(){this.context=null,this.highlighter=null,this.tokenCache.clear(),this.autoPair.clear()}onStateChange(t,e,n){if(this.autoPair.syncOnStateChange(e,n),!this.context)return;const o=p(t.selection)?t.selection.anchor.blockId:null,r=p(e.selection)?e.selection.anchor.blockId:null,c=o?t.getBlock(o):void 0,s=r?e.getBlock(r):void 0,i="code_block"===c?.type,a="code_block"===s?.type;!i&&a?this.context.announce(this.locale.enteredCodeBlock):i&&!a&&this.context.announce(this.locale.leftCodeBlock)}decorations(t){return function(t,e){const n=[],o=function(t){if(!p(t.selection))return null;const e=t.selection.anchor.blockId;return"code_block"===t.getBlock(e)?.type?e:null}(t);if(o&&n.push(I(o,{class:"notectl-code-block--focused"})),e.highlighter){const o=/* @__PURE__ */new Set;for(const r of t.getBlockOrder()){const c=t.getBlock(r);if(!c||"code_block"!==c.type)continue;const s=c.attrs?.language??"";if(!s)continue;const i=a(c);if(!i)continue;o.add(r);const l=e.tokenCache.getTokens(r,i,s,e.highlighter);for(const t of l)n.push(_(r,t.from,t.to,{class:`notectl-token--${t.type}`}))}e.tokenCache.retain(o)}return 0===n.length?B.empty:B.create(n)}(t,{highlighter:this.highlighter,tokenCache:this.tokenCache})}registerNodeView(t){const e=new E(t.getContainer()),n=this.highlighter,o={popupManager:e,getSupportedLanguages:()=>n?.getSupportedLanguages()??[]};t.registerNodeView("code_block",function(t,e=bt,n){return(o,r,c)=>{const s=document.createElement("pre");s.className="notectl-code-block",s.setAttribute("data-block-id",o.id),s.setAttribute("dir","ltr"),s.setAttribute("role","group"),s.setAttribute("aria-roledescription","code block"),s.setAttribute("part","code-block");const i=document.createElement("div");i.className="notectl-code-block__header",i.setAttribute("contenteditable","false"),i.setAttribute("part","code-block-header");const l=document.createElement("button");l.className="notectl-code-block__language-btn",l.type="button",l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-label",e.selectLanguageAria);let d=null;!1!==t.showCopyButton&&(d=document.createElement("button"),d.className="notectl-code-block__copy",d.setAttribute("aria-label",e.copyCodeAria),d.setAttribute("data-notectl-no-print",""),d.type="button",d.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>');const u=document.createElement("button");u.className="notectl-code-block__delete",u.setAttribute("aria-label",e.deleteCodeBlockAria),u.title=e.deleteCodeBlockAria,u.setAttribute("data-notectl-no-print",""),u.type="button",u.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>';const g=document.createElement("span");g.className="notectl-sr-only",g.setAttribute("aria-live","assertive"),g.setAttribute("aria-atomic","true");const p=document.createElement("div");p.className="notectl-code-block__actions",d&&p.appendChild(d),p.appendChild(u),i.appendChild(l),i.appendChild(p),i.appendChild(g);const f=document.createElement("code");f.className="notectl-code-block__content",f.setAttribute("part","code-block-content");const h=document.createElement("div");h.className="notectl-code-block__esc-hint",h.setAttribute("contenteditable","false"),h.setAttribute("aria-hidden","true"),h.setAttribute("data-notectl-no-print",""),h.textContent=e.escToExit,s.appendChild(i),s.appendChild(f),s.appendChild(h),t.background&&O(s,"--notectl-code-block-bg",t.background),t.headerBackground&&O(s,"--notectl-code-block-header-bg",t.headerBackground),t.textColor&&O(s,"--notectl-code-block-color",t.textColor),t.headerColor&&O(s,"--notectl-code-block-header-color",t.headerColor);let k=o.id;function b(t){const o=t.attrs?.language??"",r=o||e.plainText;l.innerHTML="";const c=document.createElement("span");if(c.className="notectl-code-block__language",c.textContent=r,l.appendChild(c),n){const t=document.createElement("span");t.className="notectl-code-block__chevron",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="10" height="10"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',l.appendChild(t)}s.setAttribute("aria-label",e.codeBlockAriaLabel(r)),o?f.setAttribute("data-language",o):f.removeAttribute("data-language");const i=t.attrs?.backgroundColor??"";O(s,"backgroundColor",i||"")}function m(t){g.textContent=t,setTimeout(()=>{g.textContent=""},1e3)}return b(o),d&&d.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=r().getBlock(k);n&&function(t){const e=globalThis.navigator?.clipboard;return e&&"function"==typeof e.writeText?e.writeText(t):Promise.reject(/* @__PURE__ */new Error("Clipboard API unavailable"))}(a(n)).then(()=>m(e.copiedToClipboard),()=>m(e.copyFailed))}),u.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=lt(r(),k);n&&(g.textContent=e.deletedCodeBlock,c(n))}),n&&l.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const o=r().getBlock(k);if(!o)return;const s=o.attrs?.language??"";!function(t){const{anchor:e,languages:n,currentLanguage:o,onSelect:r,popupManager:c,locale:s}=t;c.open({anchor:e,ariaRole:"listbox",ariaLabel:s.selectLanguageAria,className:"notectl-language-picker",position:"below-start",restoreFocusTo:e,content(t,e){const c=o.toLowerCase();yt(t,s.plainText,"",""===c);const i=[...n].sort((t,e)=>t.localeCompare(e));for(const n of i)yt(t,n,n,c===n.toLowerCase());R({container:t,itemSelector:xt,onSelect(t){const n=t.getAttribute("data-language")??"";r(n),e()},onClose(){e()}}),t.addEventListener("click",t=>{const n=t.target.closest(xt);if(!n)return;const o=n.getAttribute("data-language")??"";r(o),e()})},onClose(){e.setAttribute("aria-expanded","false")}}),e.setAttribute("aria-expanded","true")}({anchor:l,languages:n.getSupportedLanguages(),currentLanguage:s,locale:e,popupManager:n.popupManager,onSelect(t){if(t===s)return;const n=r(),o=n.getBlock(k);if(!o)return;const i=n.getNodePath(k);if(!i)return;const a={...o.attrs,language:t};c(n.transaction("command").setNodeAttr(i,a).build());const l=t||e.plainText;m(e.languageChanged(l))}})}),{dom:s,contentDOM:f,update:t=>"code_block"===t.type&&(k=t.id,s.setAttribute("data-block-id",t.id),b(t),!0),selectNode(){s.classList.add("notectl-code-block--selected")},deselectNode(){s.classList.remove("notectl-code-block--selected")},destroy(){}}}}(this.config,this.locale,o))}};export{pt as a,ht as i,bt as n,ft as o,vt as r,wt as t};
2
- //# sourceMappingURL=CodeBlockPlugin-BIrkK4ER.mjs.map