@notectl/core 2.0.8 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1098) hide show
  1. package/dist/chunks/AlignmentPlugin-bqK6ze-E.mjs +2 -0
  2. package/dist/chunks/AlignmentPlugin-bqK6ze-E.mjs.map +1 -0
  3. package/dist/chunks/BidiIsolationPlugin-SIKxfWXp.mjs +2 -0
  4. package/dist/chunks/BidiIsolationPlugin-SIKxfWXp.mjs.map +1 -0
  5. package/dist/chunks/BlockquotePlugin-BEaZSoVT.mjs +2 -0
  6. package/dist/chunks/BlockquotePlugin-BEaZSoVT.mjs.map +1 -0
  7. package/dist/chunks/CaretNavigationPlugin-DHl61oc6.mjs +2 -0
  8. package/dist/chunks/CaretNavigationPlugin-DHl61oc6.mjs.map +1 -0
  9. package/dist/chunks/CodeBlockPlugin-DglqiSNK.mjs +2 -0
  10. package/dist/chunks/CodeBlockPlugin-DglqiSNK.mjs.map +1 -0
  11. package/dist/chunks/ColorGrid-Czm0p2E9.mjs +2 -0
  12. package/dist/chunks/ColorGrid-Czm0p2E9.mjs.map +1 -0
  13. package/dist/chunks/ColorPickerPopup-CL-W380M.mjs +2 -0
  14. package/dist/chunks/ColorPickerPopup-CL-W380M.mjs.map +1 -0
  15. package/dist/chunks/DirectionDetection-Hun6-7ER.mjs +2 -0
  16. package/dist/chunks/DirectionDetection-Hun6-7ER.mjs.map +1 -0
  17. package/dist/chunks/DirectionIcons-CfaDcQ9a.mjs +2 -0
  18. package/dist/chunks/DirectionIcons-CfaDcQ9a.mjs.map +1 -0
  19. package/dist/chunks/DocumentParser-CyATBOz-.mjs +2 -0
  20. package/dist/chunks/DocumentParser-CyATBOz-.mjs.map +1 -0
  21. package/dist/chunks/FontPlugin-B-Sxa0UW.mjs +2 -0
  22. package/dist/chunks/FontPlugin-B-Sxa0UW.mjs.map +1 -0
  23. package/dist/chunks/FontSizePlugin-C1zlyXL2.mjs +2 -0
  24. package/dist/chunks/FontSizePlugin-C1zlyXL2.mjs.map +1 -0
  25. package/dist/chunks/GapCursorPlugin-nldun8cE.mjs +2 -0
  26. package/dist/chunks/GapCursorPlugin-nldun8cE.mjs.map +1 -0
  27. package/dist/chunks/HTMLUtils-brwcaufP.mjs +2 -0
  28. package/dist/chunks/HTMLUtils-brwcaufP.mjs.map +1 -0
  29. package/dist/chunks/HardBreakPlugin-DZRdsE15.mjs +2 -0
  30. package/dist/chunks/HardBreakPlugin-DZRdsE15.mjs.map +1 -0
  31. package/dist/chunks/HeadingPlugin-EPAmsEGt.mjs +2 -0
  32. package/dist/chunks/HeadingPlugin-EPAmsEGt.mjs.map +1 -0
  33. package/dist/chunks/HighlightPlugin-RN3l6pVJ.mjs +2 -0
  34. package/dist/chunks/HighlightPlugin-RN3l6pVJ.mjs.map +1 -0
  35. package/dist/chunks/HorizontalRulePlugin-BJPXzTtJ.mjs +2 -0
  36. package/dist/chunks/HorizontalRulePlugin-BJPXzTtJ.mjs.map +1 -0
  37. package/dist/chunks/ImagePlugin-CCEevNfJ.mjs +2 -0
  38. package/dist/chunks/ImagePlugin-CCEevNfJ.mjs.map +1 -0
  39. package/dist/chunks/InlineCodePlugin-B7IOgUSI.mjs +2 -0
  40. package/dist/chunks/InlineCodePlugin-B7IOgUSI.mjs.map +1 -0
  41. package/dist/chunks/LinkPlugin-Bhwg24lH.mjs +2 -0
  42. package/dist/chunks/LinkPlugin-Bhwg24lH.mjs.map +1 -0
  43. package/dist/chunks/ListPlugin-BkG6UO4x.mjs +2 -0
  44. package/dist/chunks/ListPlugin-BkG6UO4x.mjs.map +1 -0
  45. package/dist/chunks/PluginHelpers-D-MvWR98.mjs +2 -0
  46. package/dist/chunks/PluginHelpers-D-MvWR98.mjs.map +1 -0
  47. package/dist/chunks/PopupKeyboardPatterns-DQdL7RHx.mjs +2 -0
  48. package/dist/chunks/PopupKeyboardPatterns-DQdL7RHx.mjs.map +1 -0
  49. package/dist/chunks/PopupManager-CxPzNm-P.mjs +2 -0
  50. package/dist/chunks/PopupManager-CxPzNm-P.mjs.map +1 -0
  51. package/dist/chunks/PrintPlugin-DOk5IZRO.mjs +2 -0
  52. package/dist/chunks/PrintPlugin-DOk5IZRO.mjs.map +1 -0
  53. package/dist/chunks/PrintTypes-Drk6kLcl.mjs +2 -0
  54. package/dist/chunks/PrintTypes-Drk6kLcl.mjs.map +1 -0
  55. package/dist/chunks/SmartPastePlugin-DqKx94sH.mjs +2 -0
  56. package/dist/chunks/SmartPastePlugin-DqKx94sH.mjs.map +1 -0
  57. package/dist/chunks/StrikethroughPlugin-vYNzfxdy.mjs +2 -0
  58. package/dist/chunks/StrikethroughPlugin-vYNzfxdy.mjs.map +1 -0
  59. package/dist/chunks/SuperSubPlugin-BNsoXWHS.mjs +2 -0
  60. package/dist/chunks/SuperSubPlugin-BNsoXWHS.mjs.map +1 -0
  61. package/dist/chunks/TablePlugin-R-hmydrM.mjs +2 -0
  62. package/dist/chunks/TablePlugin-R-hmydrM.mjs.map +1 -0
  63. package/dist/chunks/TextColorPlugin-DQ-CB9cr.mjs +2 -0
  64. package/dist/chunks/TextColorPlugin-DQ-CB9cr.mjs.map +1 -0
  65. package/dist/chunks/TextDirectionAutoPlugin-DS_gpI8N.mjs +2 -0
  66. package/dist/chunks/TextDirectionAutoPlugin-DS_gpI8N.mjs.map +1 -0
  67. package/dist/chunks/TextDirectionPlugin-Bk3CkbYh.mjs +2 -0
  68. package/dist/chunks/TextDirectionPlugin-Bk3CkbYh.mjs.map +1 -0
  69. package/dist/chunks/TextDirectionService-DY4M8EwU.mjs +2 -0
  70. package/dist/chunks/TextDirectionService-DY4M8EwU.mjs.map +1 -0
  71. package/dist/chunks/TextFormattingPlugin-D13eP6nF.mjs +2 -0
  72. package/dist/chunks/TextFormattingPlugin-D13eP6nF.mjs.map +1 -0
  73. package/dist/chunks/ToolbarPlugin-DeH8n5d2.mjs +2 -0
  74. package/dist/chunks/ToolbarPlugin-DeH8n5d2.mjs.map +1 -0
  75. package/dist/chunks/TypedKeys-CU7aToqY.mjs +2 -0
  76. package/dist/chunks/TypedKeys-CU7aToqY.mjs.map +1 -0
  77. package/dist/chunks/XmlDetector-BtYxzBDa.mjs +2 -0
  78. package/dist/chunks/XmlDetector-BtYxzBDa.mjs.map +1 -0
  79. package/dist/chunks/XmlPatterns-DuP8GWVt.mjs +2 -0
  80. package/dist/chunks/XmlPatterns-DuP8GWVt.mjs.map +1 -0
  81. package/dist/chunks/XmlSupport-D54BdAJZ.mjs +2 -0
  82. package/dist/chunks/XmlSupport-D54BdAJZ.mjs.map +1 -0
  83. package/dist/chunks/ar-2Fkz_6nI.mjs +2 -0
  84. package/dist/chunks/ar-2Fkz_6nI.mjs.map +1 -0
  85. package/dist/chunks/ar-4ZPC8daa.mjs +2 -0
  86. package/dist/chunks/ar-4ZPC8daa.mjs.map +1 -0
  87. package/dist/chunks/ar-6I20_Djq.mjs +2 -0
  88. package/dist/chunks/ar-6I20_Djq.mjs.map +1 -0
  89. package/dist/chunks/ar-B7-Dm70S.mjs +2 -0
  90. package/dist/chunks/ar-B7-Dm70S.mjs.map +1 -0
  91. package/dist/chunks/ar-BRe0t96G.mjs +2 -0
  92. package/dist/chunks/ar-BRe0t96G.mjs.map +1 -0
  93. package/dist/chunks/ar-BnNyrtdi.mjs +2 -0
  94. package/dist/chunks/ar-BnNyrtdi.mjs.map +1 -0
  95. package/dist/chunks/ar-BsMfhWs5.mjs +2 -0
  96. package/dist/chunks/ar-BsMfhWs5.mjs.map +1 -0
  97. package/dist/chunks/ar-Bvja-bjE.mjs +2 -0
  98. package/dist/chunks/ar-Bvja-bjE.mjs.map +1 -0
  99. package/dist/chunks/ar-BxVbBvSa.mjs +2 -0
  100. package/dist/chunks/ar-BxVbBvSa.mjs.map +1 -0
  101. package/dist/chunks/ar-C5dW-co3.mjs +2 -0
  102. package/dist/chunks/ar-C5dW-co3.mjs.map +1 -0
  103. package/dist/chunks/ar-CARMr30L.mjs +2 -0
  104. package/dist/chunks/ar-CARMr30L.mjs.map +1 -0
  105. package/dist/chunks/ar-CB-pehGw.mjs +2 -0
  106. package/dist/chunks/ar-CB-pehGw.mjs.map +1 -0
  107. package/dist/chunks/ar-CEYgAxTM.mjs +2 -0
  108. package/dist/chunks/ar-CEYgAxTM.mjs.map +1 -0
  109. package/dist/chunks/ar-CO60qpZJ.mjs +2 -0
  110. package/dist/chunks/ar-CO60qpZJ.mjs.map +1 -0
  111. package/dist/chunks/ar-CtI_snUM.mjs +2 -0
  112. package/dist/chunks/ar-CtI_snUM.mjs.map +1 -0
  113. package/dist/chunks/ar-Cv1RQvhK.mjs +2 -0
  114. package/dist/chunks/ar-Cv1RQvhK.mjs.map +1 -0
  115. package/dist/chunks/ar-D5jV20Tu.mjs +2 -0
  116. package/dist/chunks/ar-D5jV20Tu.mjs.map +1 -0
  117. package/dist/chunks/ar-DJN9fQ7Z.mjs +2 -0
  118. package/dist/chunks/ar-DJN9fQ7Z.mjs.map +1 -0
  119. package/dist/chunks/ar-DPTsUnwA.mjs +2 -0
  120. package/dist/chunks/ar-DPTsUnwA.mjs.map +1 -0
  121. package/dist/chunks/ar-DZJIBD1Q.mjs +2 -0
  122. package/dist/chunks/ar-DZJIBD1Q.mjs.map +1 -0
  123. package/dist/chunks/ar-DkkbwV93.mjs +2 -0
  124. package/dist/chunks/ar-DkkbwV93.mjs.map +1 -0
  125. package/dist/chunks/ar-DmeMor8Y.mjs +2 -0
  126. package/dist/chunks/ar-DmeMor8Y.mjs.map +1 -0
  127. package/dist/chunks/ar-LnE7jPai.mjs +2 -0
  128. package/dist/chunks/ar-LnE7jPai.mjs.map +1 -0
  129. package/dist/chunks/ar-P3wW0fmA.mjs +2 -0
  130. package/dist/chunks/ar-P3wW0fmA.mjs.map +1 -0
  131. package/dist/chunks/ar-uum0DCfv.mjs +2 -0
  132. package/dist/chunks/ar-uum0DCfv.mjs.map +1 -0
  133. package/dist/chunks/color-picker-DlXhHBZ6.mjs +2 -0
  134. package/dist/chunks/color-picker-DlXhHBZ6.mjs.map +1 -0
  135. package/dist/chunks/de-8SHQu0rr.mjs +2 -0
  136. package/dist/chunks/de-8SHQu0rr.mjs.map +1 -0
  137. package/dist/chunks/de-B8a71A0X.mjs +2 -0
  138. package/dist/chunks/de-B8a71A0X.mjs.map +1 -0
  139. package/dist/chunks/de-B9weXoA1.mjs +2 -0
  140. package/dist/chunks/de-B9weXoA1.mjs.map +1 -0
  141. package/dist/chunks/de-BKm53tVU.mjs +2 -0
  142. package/dist/chunks/de-BKm53tVU.mjs.map +1 -0
  143. package/dist/chunks/de-BLWrnMfX.mjs +2 -0
  144. package/dist/chunks/de-BLWrnMfX.mjs.map +1 -0
  145. package/dist/chunks/de-BOujs1pF.mjs +2 -0
  146. package/dist/chunks/de-BOujs1pF.mjs.map +1 -0
  147. package/dist/chunks/de-B_1XleAG.mjs +2 -0
  148. package/dist/chunks/de-B_1XleAG.mjs.map +1 -0
  149. package/dist/chunks/de-BpmjrOMc.mjs +2 -0
  150. package/dist/chunks/de-BpmjrOMc.mjs.map +1 -0
  151. package/dist/chunks/de-C8OHD1fm.mjs +2 -0
  152. package/dist/chunks/de-C8OHD1fm.mjs.map +1 -0
  153. package/dist/chunks/de-CAVCXBBR.mjs +2 -0
  154. package/dist/chunks/de-CAVCXBBR.mjs.map +1 -0
  155. package/dist/chunks/de-CkMnuozT.mjs +2 -0
  156. package/dist/chunks/de-CkMnuozT.mjs.map +1 -0
  157. package/dist/chunks/de-CtDnvnnm.mjs +2 -0
  158. package/dist/chunks/de-CtDnvnnm.mjs.map +1 -0
  159. package/dist/chunks/de-Cz26vtXW.mjs +2 -0
  160. package/dist/chunks/de-Cz26vtXW.mjs.map +1 -0
  161. package/dist/chunks/de-D0BPSP3j.mjs +2 -0
  162. package/dist/chunks/de-D0BPSP3j.mjs.map +1 -0
  163. package/dist/chunks/de-D74v0paw.mjs +2 -0
  164. package/dist/chunks/de-D74v0paw.mjs.map +1 -0
  165. package/dist/chunks/de-DKj55F9g.mjs +2 -0
  166. package/dist/chunks/de-DKj55F9g.mjs.map +1 -0
  167. package/dist/chunks/de-DYuRb98l.mjs +2 -0
  168. package/dist/chunks/de-DYuRb98l.mjs.map +1 -0
  169. package/dist/chunks/de-DaK0-sdo.mjs +2 -0
  170. package/dist/chunks/de-DaK0-sdo.mjs.map +1 -0
  171. package/dist/chunks/de-Dia08Wsq.mjs +2 -0
  172. package/dist/chunks/de-Dia08Wsq.mjs.map +1 -0
  173. package/dist/chunks/de-Dp_uj2Z3.mjs +2 -0
  174. package/dist/chunks/de-Dp_uj2Z3.mjs.map +1 -0
  175. package/dist/chunks/de-DwX1CDNO.mjs +2 -0
  176. package/dist/chunks/de-DwX1CDNO.mjs.map +1 -0
  177. package/dist/chunks/de-DyF2mRfw.mjs +2 -0
  178. package/dist/chunks/de-DyF2mRfw.mjs.map +1 -0
  179. package/dist/chunks/de-X3BLBlF8.mjs +2 -0
  180. package/dist/chunks/de-X3BLBlF8.mjs.map +1 -0
  181. package/dist/chunks/de-dPC3Qk7N.mjs +2 -0
  182. package/dist/chunks/de-dPC3Qk7N.mjs.map +1 -0
  183. package/dist/chunks/de-pLGt5S7j.mjs +2 -0
  184. package/dist/chunks/de-pLGt5S7j.mjs.map +1 -0
  185. package/dist/chunks/es--xozZF4T.mjs +2 -0
  186. package/dist/chunks/es--xozZF4T.mjs.map +1 -0
  187. package/dist/chunks/es-2BjtTusm.mjs +2 -0
  188. package/dist/chunks/es-2BjtTusm.mjs.map +1 -0
  189. package/dist/chunks/es-B2rEK7_f.mjs +2 -0
  190. package/dist/chunks/es-B2rEK7_f.mjs.map +1 -0
  191. package/dist/chunks/es-B9esmUm1.mjs +2 -0
  192. package/dist/chunks/es-B9esmUm1.mjs.map +1 -0
  193. package/dist/chunks/es-BJxkHalP.mjs +2 -0
  194. package/dist/chunks/es-BJxkHalP.mjs.map +1 -0
  195. package/dist/chunks/es-BMKsnh3y.mjs +2 -0
  196. package/dist/chunks/es-BMKsnh3y.mjs.map +1 -0
  197. package/dist/chunks/es-BXFflrrU.mjs +2 -0
  198. package/dist/chunks/es-BXFflrrU.mjs.map +1 -0
  199. package/dist/chunks/es-BbX_lEEN.mjs +2 -0
  200. package/dist/chunks/es-BbX_lEEN.mjs.map +1 -0
  201. package/dist/chunks/es-BlHe_tc0.mjs +2 -0
  202. package/dist/chunks/es-BlHe_tc0.mjs.map +1 -0
  203. package/dist/chunks/es-Bu6nnEeT.mjs +2 -0
  204. package/dist/chunks/es-Bu6nnEeT.mjs.map +1 -0
  205. package/dist/chunks/es-Bx0CbUoY.mjs +2 -0
  206. package/dist/chunks/es-Bx0CbUoY.mjs.map +1 -0
  207. package/dist/chunks/es-CE9Tbsb7.mjs +2 -0
  208. package/dist/chunks/es-CE9Tbsb7.mjs.map +1 -0
  209. package/dist/chunks/es-COSomns3.mjs +2 -0
  210. package/dist/chunks/es-COSomns3.mjs.map +1 -0
  211. package/dist/chunks/es-C_7qthHu.mjs +2 -0
  212. package/dist/chunks/es-C_7qthHu.mjs.map +1 -0
  213. package/dist/chunks/es-CirfP3x1.mjs +2 -0
  214. package/dist/chunks/es-CirfP3x1.mjs.map +1 -0
  215. package/dist/chunks/es-CpF8eiPr.mjs +2 -0
  216. package/dist/chunks/es-CpF8eiPr.mjs.map +1 -0
  217. package/dist/chunks/es-D787y0ui.mjs +2 -0
  218. package/dist/chunks/es-D787y0ui.mjs.map +1 -0
  219. package/dist/chunks/es-D8iB5vwQ.mjs +2 -0
  220. package/dist/chunks/es-D8iB5vwQ.mjs.map +1 -0
  221. package/dist/chunks/es-DBb78XWu.mjs +2 -0
  222. package/dist/chunks/es-DBb78XWu.mjs.map +1 -0
  223. package/dist/chunks/es-DC6mYTD3.mjs +2 -0
  224. package/dist/chunks/es-DC6mYTD3.mjs.map +1 -0
  225. package/dist/chunks/es-Dh--mRZs.mjs +2 -0
  226. package/dist/chunks/es-Dh--mRZs.mjs.map +1 -0
  227. package/dist/chunks/es-DvPsYqFj.mjs +2 -0
  228. package/dist/chunks/es-DvPsYqFj.mjs.map +1 -0
  229. package/dist/chunks/es-DxXimuUa.mjs +2 -0
  230. package/dist/chunks/es-DxXimuUa.mjs.map +1 -0
  231. package/dist/chunks/es-mWJptxq3.mjs +2 -0
  232. package/dist/chunks/es-mWJptxq3.mjs.map +1 -0
  233. package/dist/chunks/es-qYV--o6U.mjs +2 -0
  234. package/dist/chunks/es-qYV--o6U.mjs.map +1 -0
  235. package/dist/chunks/fonts-CxtWyeNB.mjs +2 -0
  236. package/dist/chunks/fonts-CxtWyeNB.mjs.map +1 -0
  237. package/dist/chunks/fr--F426oao.mjs +2 -0
  238. package/dist/chunks/fr--F426oao.mjs.map +1 -0
  239. package/dist/chunks/fr-B0BPbbNB.mjs +2 -0
  240. package/dist/chunks/fr-B0BPbbNB.mjs.map +1 -0
  241. package/dist/chunks/fr-B4UQy0j-.mjs +2 -0
  242. package/dist/chunks/fr-B4UQy0j-.mjs.map +1 -0
  243. package/dist/chunks/fr-B4XLxkci.mjs +2 -0
  244. package/dist/chunks/fr-B4XLxkci.mjs.map +1 -0
  245. package/dist/chunks/fr-BC1Rfp9S.mjs +2 -0
  246. package/dist/chunks/fr-BC1Rfp9S.mjs.map +1 -0
  247. package/dist/chunks/fr-BRGGu0E2.mjs +2 -0
  248. package/dist/chunks/fr-BRGGu0E2.mjs.map +1 -0
  249. package/dist/chunks/fr-BoSz1pa9.mjs +2 -0
  250. package/dist/chunks/fr-BoSz1pa9.mjs.map +1 -0
  251. package/dist/chunks/fr-Bom3RFIN.mjs +2 -0
  252. package/dist/chunks/fr-Bom3RFIN.mjs.map +1 -0
  253. package/dist/chunks/fr-BtnwMUII.mjs +2 -0
  254. package/dist/chunks/fr-BtnwMUII.mjs.map +1 -0
  255. package/dist/chunks/fr-C6pglM3H.mjs +2 -0
  256. package/dist/chunks/fr-C6pglM3H.mjs.map +1 -0
  257. package/dist/chunks/fr-CDBpS6xE.mjs +2 -0
  258. package/dist/chunks/fr-CDBpS6xE.mjs.map +1 -0
  259. package/dist/chunks/fr-CN0ihkUg.mjs +2 -0
  260. package/dist/chunks/fr-CN0ihkUg.mjs.map +1 -0
  261. package/dist/chunks/fr-CNNBBeLM.mjs +2 -0
  262. package/dist/chunks/fr-CNNBBeLM.mjs.map +1 -0
  263. package/dist/chunks/fr-CVOY2y07.mjs +2 -0
  264. package/dist/chunks/fr-CVOY2y07.mjs.map +1 -0
  265. package/dist/chunks/fr-CZAbL_o0.mjs +2 -0
  266. package/dist/chunks/fr-CZAbL_o0.mjs.map +1 -0
  267. package/dist/chunks/fr-DJkPmQG_.mjs +2 -0
  268. package/dist/chunks/fr-DJkPmQG_.mjs.map +1 -0
  269. package/dist/chunks/fr-DkWdFDsR.mjs +2 -0
  270. package/dist/chunks/fr-DkWdFDsR.mjs.map +1 -0
  271. package/dist/chunks/fr-DnQHoPVo.mjs +2 -0
  272. package/dist/chunks/fr-DnQHoPVo.mjs.map +1 -0
  273. package/dist/chunks/fr-DsdueaiG.mjs +2 -0
  274. package/dist/chunks/fr-DsdueaiG.mjs.map +1 -0
  275. package/dist/chunks/fr-DxNdsa11.mjs +2 -0
  276. package/dist/chunks/fr-DxNdsa11.mjs.map +1 -0
  277. package/dist/chunks/fr-IO4_LYvE.mjs +2 -0
  278. package/dist/chunks/fr-IO4_LYvE.mjs.map +1 -0
  279. package/dist/chunks/fr-ZKDCEpww.mjs +2 -0
  280. package/dist/chunks/fr-ZKDCEpww.mjs.map +1 -0
  281. package/dist/chunks/fr-coufP_et.mjs +2 -0
  282. package/dist/chunks/fr-coufP_et.mjs.map +1 -0
  283. package/dist/chunks/fr-lYSOgOK7.mjs +2 -0
  284. package/dist/chunks/fr-lYSOgOK7.mjs.map +1 -0
  285. package/dist/chunks/fr-wobtRjcF.mjs +2 -0
  286. package/dist/chunks/fr-wobtRjcF.mjs.map +1 -0
  287. package/dist/chunks/full-BMvrL5dE.mjs +2 -0
  288. package/dist/chunks/full-BMvrL5dE.mjs.map +1 -0
  289. package/dist/chunks/hi-B0o90MFd.mjs +2 -0
  290. package/dist/chunks/hi-B0o90MFd.mjs.map +1 -0
  291. package/dist/chunks/hi-BFko34WG.mjs +2 -0
  292. package/dist/chunks/hi-BFko34WG.mjs.map +1 -0
  293. package/dist/chunks/hi-BVxSgaNT.mjs +2 -0
  294. package/dist/chunks/hi-BVxSgaNT.mjs.map +1 -0
  295. package/dist/chunks/hi-BirBQ5Ef.mjs +2 -0
  296. package/dist/chunks/hi-BirBQ5Ef.mjs.map +1 -0
  297. package/dist/chunks/hi-BnsbcSIX.mjs +2 -0
  298. package/dist/chunks/hi-BnsbcSIX.mjs.map +1 -0
  299. package/dist/chunks/hi-BoFuxLtG.mjs +2 -0
  300. package/dist/chunks/hi-BoFuxLtG.mjs.map +1 -0
  301. package/dist/chunks/hi-BptyTwAv.mjs +2 -0
  302. package/dist/chunks/hi-BptyTwAv.mjs.map +1 -0
  303. package/dist/chunks/hi-BulaYhi_.mjs +2 -0
  304. package/dist/chunks/hi-BulaYhi_.mjs.map +1 -0
  305. package/dist/chunks/hi-BzflHG6Y.mjs +2 -0
  306. package/dist/chunks/hi-BzflHG6Y.mjs.map +1 -0
  307. package/dist/chunks/hi-C7Hb-gQ_.mjs +2 -0
  308. package/dist/chunks/hi-C7Hb-gQ_.mjs.map +1 -0
  309. package/dist/chunks/hi-C_lY7kA9.mjs +2 -0
  310. package/dist/chunks/hi-C_lY7kA9.mjs.map +1 -0
  311. package/dist/chunks/hi-CkylXoIm.mjs +2 -0
  312. package/dist/chunks/hi-CkylXoIm.mjs.map +1 -0
  313. package/dist/chunks/hi-DGJTbrQi.mjs +2 -0
  314. package/dist/chunks/hi-DGJTbrQi.mjs.map +1 -0
  315. package/dist/chunks/hi-DGJgX0fG.mjs +2 -0
  316. package/dist/chunks/hi-DGJgX0fG.mjs.map +1 -0
  317. package/dist/chunks/hi-DKDYpjdr.mjs +2 -0
  318. package/dist/chunks/hi-DKDYpjdr.mjs.map +1 -0
  319. package/dist/chunks/hi-DfAX8S-T.mjs +2 -0
  320. package/dist/chunks/hi-DfAX8S-T.mjs.map +1 -0
  321. package/dist/chunks/hi-Dhq91ipt.mjs +2 -0
  322. package/dist/chunks/hi-Dhq91ipt.mjs.map +1 -0
  323. package/dist/chunks/hi-Dup389dM.mjs +2 -0
  324. package/dist/chunks/hi-Dup389dM.mjs.map +1 -0
  325. package/dist/chunks/hi-DzRFsYYN.mjs +2 -0
  326. package/dist/chunks/hi-DzRFsYYN.mjs.map +1 -0
  327. package/dist/chunks/hi-ObZRwITd.mjs +2 -0
  328. package/dist/chunks/hi-ObZRwITd.mjs.map +1 -0
  329. package/dist/chunks/hi-VvUzjfH_.mjs +2 -0
  330. package/dist/chunks/hi-VvUzjfH_.mjs.map +1 -0
  331. package/dist/chunks/hi-jWQDQkOX.mjs +2 -0
  332. package/dist/chunks/hi-jWQDQkOX.mjs.map +1 -0
  333. package/dist/chunks/hi-l3hIrp8J.mjs +2 -0
  334. package/dist/chunks/hi-l3hIrp8J.mjs.map +1 -0
  335. package/dist/chunks/hi-o8Gsu5Ly.mjs +2 -0
  336. package/dist/chunks/hi-o8Gsu5Ly.mjs.map +1 -0
  337. package/dist/chunks/hi-sxC2nk3h.mjs +2 -0
  338. package/dist/chunks/hi-sxC2nk3h.mjs.map +1 -0
  339. package/dist/chunks/minimal-pBhi4EJI.mjs +2 -0
  340. package/dist/chunks/minimal-pBhi4EJI.mjs.map +1 -0
  341. package/dist/chunks/pt--57Ug7ig.mjs +2 -0
  342. package/dist/chunks/pt--57Ug7ig.mjs.map +1 -0
  343. package/dist/chunks/pt-4j8Km9Db.mjs +2 -0
  344. package/dist/chunks/pt-4j8Km9Db.mjs.map +1 -0
  345. package/dist/chunks/pt-BTGFKCns.mjs +2 -0
  346. package/dist/chunks/pt-BTGFKCns.mjs.map +1 -0
  347. package/dist/chunks/pt-BU8Qfuoz.mjs +2 -0
  348. package/dist/chunks/pt-BU8Qfuoz.mjs.map +1 -0
  349. package/dist/chunks/pt-BYAOJxIB.mjs +2 -0
  350. package/dist/chunks/pt-BYAOJxIB.mjs.map +1 -0
  351. package/dist/chunks/pt-BjNWQm9A.mjs +2 -0
  352. package/dist/chunks/pt-BjNWQm9A.mjs.map +1 -0
  353. package/dist/chunks/pt-Bvnb_NpT.mjs +2 -0
  354. package/dist/chunks/pt-Bvnb_NpT.mjs.map +1 -0
  355. package/dist/chunks/pt-C2pkn7vo.mjs +2 -0
  356. package/dist/chunks/pt-C2pkn7vo.mjs.map +1 -0
  357. package/dist/chunks/pt-C8MhLnWx.mjs +2 -0
  358. package/dist/chunks/pt-C8MhLnWx.mjs.map +1 -0
  359. package/dist/chunks/pt-CJfYLSTe.mjs +2 -0
  360. package/dist/chunks/pt-CJfYLSTe.mjs.map +1 -0
  361. package/dist/chunks/pt-CdwVIYOK.mjs +2 -0
  362. package/dist/chunks/pt-CdwVIYOK.mjs.map +1 -0
  363. package/dist/chunks/pt-CwrVo90O.mjs +2 -0
  364. package/dist/chunks/pt-CwrVo90O.mjs.map +1 -0
  365. package/dist/chunks/pt-DD26CKCA.mjs +2 -0
  366. package/dist/chunks/pt-DD26CKCA.mjs.map +1 -0
  367. package/dist/chunks/pt-DLbf6uoo.mjs +2 -0
  368. package/dist/chunks/pt-DLbf6uoo.mjs.map +1 -0
  369. package/dist/chunks/pt-DNyNHwKh.mjs +2 -0
  370. package/dist/chunks/pt-DNyNHwKh.mjs.map +1 -0
  371. package/dist/chunks/pt-DVfMAcXb.mjs +2 -0
  372. package/dist/chunks/pt-DVfMAcXb.mjs.map +1 -0
  373. package/dist/chunks/pt-DWSFad3n.mjs +2 -0
  374. package/dist/chunks/pt-DWSFad3n.mjs.map +1 -0
  375. package/dist/chunks/pt-DZXY4i4G.mjs +2 -0
  376. package/dist/chunks/pt-DZXY4i4G.mjs.map +1 -0
  377. package/dist/chunks/pt-DfUpRhK1.mjs +2 -0
  378. package/dist/chunks/pt-DfUpRhK1.mjs.map +1 -0
  379. package/dist/chunks/pt-DlvNEDeW.mjs +2 -0
  380. package/dist/chunks/pt-DlvNEDeW.mjs.map +1 -0
  381. package/dist/chunks/pt-DzFyGwB4.mjs +2 -0
  382. package/dist/chunks/pt-DzFyGwB4.mjs.map +1 -0
  383. package/dist/chunks/pt-HhQcARW6.mjs +2 -0
  384. package/dist/chunks/pt-HhQcARW6.mjs.map +1 -0
  385. package/dist/chunks/pt-SjvTF40s.mjs +2 -0
  386. package/dist/chunks/pt-SjvTF40s.mjs.map +1 -0
  387. package/dist/chunks/pt-ihNE0VQJ.mjs +2 -0
  388. package/dist/chunks/pt-ihNE0VQJ.mjs.map +1 -0
  389. package/dist/chunks/pt-zfCjhIgy.mjs +2 -0
  390. package/dist/chunks/pt-zfCjhIgy.mjs.map +1 -0
  391. package/dist/chunks/ru-0AHodbWv.mjs +2 -0
  392. package/dist/chunks/ru-0AHodbWv.mjs.map +1 -0
  393. package/dist/chunks/ru-2MDGmLw0.mjs +2 -0
  394. package/dist/chunks/ru-2MDGmLw0.mjs.map +1 -0
  395. package/dist/chunks/ru-3VfYKfTm.mjs +2 -0
  396. package/dist/chunks/ru-3VfYKfTm.mjs.map +1 -0
  397. package/dist/chunks/ru-B-gRJ6nQ.mjs +2 -0
  398. package/dist/chunks/ru-B-gRJ6nQ.mjs.map +1 -0
  399. package/dist/chunks/ru-B6ITUB-Y.mjs +2 -0
  400. package/dist/chunks/ru-B6ITUB-Y.mjs.map +1 -0
  401. package/dist/chunks/ru-BKDWkabk.mjs +2 -0
  402. package/dist/chunks/ru-BKDWkabk.mjs.map +1 -0
  403. package/dist/chunks/ru-BMxJsSe3.mjs +2 -0
  404. package/dist/chunks/ru-BMxJsSe3.mjs.map +1 -0
  405. package/dist/chunks/ru-Bep1iHQL.mjs +2 -0
  406. package/dist/chunks/ru-Bep1iHQL.mjs.map +1 -0
  407. package/dist/chunks/ru-Blj0nqoL.mjs +2 -0
  408. package/dist/chunks/ru-Blj0nqoL.mjs.map +1 -0
  409. package/dist/chunks/ru-BqnHkmii.mjs +2 -0
  410. package/dist/chunks/ru-BqnHkmii.mjs.map +1 -0
  411. package/dist/chunks/ru-C-4AaPUK.mjs +2 -0
  412. package/dist/chunks/ru-C-4AaPUK.mjs.map +1 -0
  413. package/dist/chunks/ru-C9Nv7JJI.mjs +2 -0
  414. package/dist/chunks/ru-C9Nv7JJI.mjs.map +1 -0
  415. package/dist/chunks/ru-CJFtr1Ks.mjs +2 -0
  416. package/dist/chunks/ru-CJFtr1Ks.mjs.map +1 -0
  417. package/dist/chunks/ru-CN63yWk_.mjs +2 -0
  418. package/dist/chunks/ru-CN63yWk_.mjs.map +1 -0
  419. package/dist/chunks/ru-CcFX97-2.mjs +2 -0
  420. package/dist/chunks/ru-CcFX97-2.mjs.map +1 -0
  421. package/dist/chunks/ru-D8PhWFSp.mjs +2 -0
  422. package/dist/chunks/ru-D8PhWFSp.mjs.map +1 -0
  423. package/dist/chunks/ru-DYAncidS.mjs +2 -0
  424. package/dist/chunks/ru-DYAncidS.mjs.map +1 -0
  425. package/dist/chunks/ru-D_zXo-FA.mjs +2 -0
  426. package/dist/chunks/ru-D_zXo-FA.mjs.map +1 -0
  427. package/dist/chunks/ru-DhSPV6m0.mjs +2 -0
  428. package/dist/chunks/ru-DhSPV6m0.mjs.map +1 -0
  429. package/dist/chunks/ru-LNbpjKCw.mjs +2 -0
  430. package/dist/chunks/ru-LNbpjKCw.mjs.map +1 -0
  431. package/dist/chunks/ru-LXi1ONW4.mjs +2 -0
  432. package/dist/chunks/ru-LXi1ONW4.mjs.map +1 -0
  433. package/dist/chunks/ru-db7wsWkx.mjs +2 -0
  434. package/dist/chunks/ru-db7wsWkx.mjs.map +1 -0
  435. package/dist/chunks/ru-nZ4BjiD0.mjs +2 -0
  436. package/dist/chunks/ru-nZ4BjiD0.mjs.map +1 -0
  437. package/dist/chunks/ru-v9zumXd2.mjs +2 -0
  438. package/dist/chunks/ru-v9zumXd2.mjs.map +1 -0
  439. package/dist/chunks/ru-wK2ytv3A.mjs +2 -0
  440. package/dist/chunks/ru-wK2ytv3A.mjs.map +1 -0
  441. package/dist/chunks/src-CNK6vpUU.mjs +2 -0
  442. package/dist/chunks/src-CNK6vpUU.mjs.map +1 -0
  443. package/dist/chunks/zh-9AcCSFm0.mjs +2 -0
  444. package/dist/chunks/zh-9AcCSFm0.mjs.map +1 -0
  445. package/dist/chunks/zh-B3bJCfdB.mjs +2 -0
  446. package/dist/chunks/zh-B3bJCfdB.mjs.map +1 -0
  447. package/dist/chunks/zh-B46Dt1h7.mjs +2 -0
  448. package/dist/chunks/zh-B46Dt1h7.mjs.map +1 -0
  449. package/dist/chunks/zh-BRy2B6Og.mjs +2 -0
  450. package/dist/chunks/zh-BRy2B6Og.mjs.map +1 -0
  451. package/dist/chunks/zh-BfYi8wB2.mjs +2 -0
  452. package/dist/chunks/zh-BfYi8wB2.mjs.map +1 -0
  453. package/dist/chunks/zh-C0I3L6NA.mjs +2 -0
  454. package/dist/chunks/zh-C0I3L6NA.mjs.map +1 -0
  455. package/dist/chunks/zh-C33e4gfg.mjs +2 -0
  456. package/dist/chunks/zh-C33e4gfg.mjs.map +1 -0
  457. package/dist/chunks/zh-C9sNwnC1.mjs +2 -0
  458. package/dist/chunks/zh-C9sNwnC1.mjs.map +1 -0
  459. package/dist/chunks/zh-CACr0qSo.mjs +2 -0
  460. package/dist/chunks/zh-CACr0qSo.mjs.map +1 -0
  461. package/dist/chunks/zh-CU0hd8zq.mjs +2 -0
  462. package/dist/chunks/zh-CU0hd8zq.mjs.map +1 -0
  463. package/dist/chunks/zh-CX2zUoWR.mjs +2 -0
  464. package/dist/chunks/zh-CX2zUoWR.mjs.map +1 -0
  465. package/dist/chunks/zh-CblZ-34H.mjs +2 -0
  466. package/dist/chunks/zh-CblZ-34H.mjs.map +1 -0
  467. package/dist/chunks/zh-CicpU0g8.mjs +2 -0
  468. package/dist/chunks/zh-CicpU0g8.mjs.map +1 -0
  469. package/dist/chunks/zh-Cr3KdEZV.mjs +2 -0
  470. package/dist/chunks/zh-Cr3KdEZV.mjs.map +1 -0
  471. package/dist/chunks/zh-D24dsCiw.mjs +2 -0
  472. package/dist/chunks/zh-D24dsCiw.mjs.map +1 -0
  473. package/dist/chunks/zh-DQtLxQ3s.mjs +2 -0
  474. package/dist/chunks/zh-DQtLxQ3s.mjs.map +1 -0
  475. package/dist/chunks/zh-DR1OF5vm.mjs +2 -0
  476. package/dist/chunks/zh-DR1OF5vm.mjs.map +1 -0
  477. package/dist/chunks/zh-DS82x1KL.mjs +2 -0
  478. package/dist/chunks/zh-DS82x1KL.mjs.map +1 -0
  479. package/dist/chunks/zh-DdJA-AEY.mjs +2 -0
  480. package/dist/chunks/zh-DdJA-AEY.mjs.map +1 -0
  481. package/dist/chunks/zh-DpVlDZ9n.mjs +2 -0
  482. package/dist/chunks/zh-DpVlDZ9n.mjs.map +1 -0
  483. package/dist/chunks/zh-OWVKcbVR.mjs +2 -0
  484. package/dist/chunks/zh-OWVKcbVR.mjs.map +1 -0
  485. package/dist/chunks/zh-d19V68ib.mjs +2 -0
  486. package/dist/chunks/zh-d19V68ib.mjs.map +1 -0
  487. package/dist/chunks/zh-fSMt1FnB.mjs +2 -0
  488. package/dist/chunks/zh-fSMt1FnB.mjs.map +1 -0
  489. package/dist/chunks/zh-mLlk9Wki.mjs +2 -0
  490. package/dist/chunks/zh-mLlk9Wki.mjs.map +1 -0
  491. package/dist/chunks/zh-nnMt8E6m.mjs +2 -0
  492. package/dist/chunks/zh-nnMt8E6m.mjs.map +1 -0
  493. package/dist/editor/ContentSerializer.d.ts +10 -0
  494. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  495. package/dist/editor/EditorInitializer.d.ts.map +1 -1
  496. package/dist/editor/NotectlEditor.d.ts +25 -2
  497. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  498. package/dist/editor/styles/base.d.ts +1 -1
  499. package/dist/editor/styles/base.d.ts.map +1 -1
  500. package/dist/editor/styles/toolbar.d.ts +1 -1
  501. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  502. package/dist/fonts.mjs +1 -1
  503. package/dist/full.d.ts +2 -1
  504. package/dist/full.d.ts.map +1 -1
  505. package/dist/full.mjs +1 -1
  506. package/dist/html.mjs +1 -1
  507. package/dist/i18n/LocaleService.d.ts +1 -1
  508. package/dist/i18n/LocaleService.d.ts.map +1 -1
  509. package/dist/input/HTMLParser.d.ts.map +1 -1
  510. package/dist/model/HTMLUtils.d.ts +11 -0
  511. package/dist/model/HTMLUtils.d.ts.map +1 -1
  512. package/dist/model/TypedKeys.d.ts +23 -0
  513. package/dist/model/TypedKeys.d.ts.map +1 -0
  514. package/dist/notectl-core.mjs +1 -1
  515. package/dist/notectl-core.umd.js +1 -1
  516. package/dist/notectl-core.umd.js.map +1 -1
  517. package/dist/plugins/Plugin.d.ts +2 -12
  518. package/dist/plugins/Plugin.d.ts.map +1 -1
  519. package/dist/plugins/alignment.mjs +1 -1
  520. package/dist/plugins/bidi-isolation/BidiIsolationLocale.d.ts +12 -0
  521. package/dist/plugins/bidi-isolation/BidiIsolationLocale.d.ts.map +1 -0
  522. package/dist/plugins/bidi-isolation/BidiIsolationPlugin.d.ts +34 -0
  523. package/dist/plugins/bidi-isolation/BidiIsolationPlugin.d.ts.map +1 -0
  524. package/dist/plugins/bidi-isolation/index.d.ts +4 -0
  525. package/dist/plugins/bidi-isolation/index.d.ts.map +1 -0
  526. package/dist/plugins/bidi-isolation/locales/ar.d.ts +4 -0
  527. package/dist/plugins/bidi-isolation/locales/ar.d.ts.map +1 -0
  528. package/dist/plugins/bidi-isolation/locales/de.d.ts +4 -0
  529. package/dist/plugins/bidi-isolation/locales/de.d.ts.map +1 -0
  530. package/dist/plugins/bidi-isolation/locales/es.d.ts +4 -0
  531. package/dist/plugins/bidi-isolation/locales/es.d.ts.map +1 -0
  532. package/dist/plugins/bidi-isolation/locales/fr.d.ts +4 -0
  533. package/dist/plugins/bidi-isolation/locales/fr.d.ts.map +1 -0
  534. package/dist/plugins/bidi-isolation/locales/hi.d.ts +4 -0
  535. package/dist/plugins/bidi-isolation/locales/hi.d.ts.map +1 -0
  536. package/dist/plugins/bidi-isolation/locales/pt.d.ts +4 -0
  537. package/dist/plugins/bidi-isolation/locales/pt.d.ts.map +1 -0
  538. package/dist/plugins/bidi-isolation/locales/ru.d.ts +4 -0
  539. package/dist/plugins/bidi-isolation/locales/ru.d.ts.map +1 -0
  540. package/dist/plugins/bidi-isolation/locales/zh.d.ts +4 -0
  541. package/dist/plugins/bidi-isolation/locales/zh.d.ts.map +1 -0
  542. package/dist/plugins/bidi-isolation.mjs +1 -0
  543. package/dist/plugins/blockquote.mjs +1 -1
  544. package/dist/plugins/caret-navigation.mjs +1 -1
  545. package/dist/plugins/code-block.mjs +1 -1
  546. package/dist/plugins/font-size.mjs +1 -1
  547. package/dist/plugins/font.mjs +1 -1
  548. package/dist/plugins/gap-cursor.mjs +1 -1
  549. package/dist/plugins/hard-break.mjs +1 -1
  550. package/dist/plugins/heading.mjs +1 -1
  551. package/dist/plugins/highlight.mjs +1 -1
  552. package/dist/plugins/horizontal-rule.mjs +1 -1
  553. package/dist/plugins/image.mjs +1 -1
  554. package/dist/plugins/inline-code.mjs +1 -1
  555. package/dist/plugins/language.mjs +1 -1
  556. package/dist/plugins/link/LinkLocale.d.ts +1 -0
  557. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  558. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  559. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  560. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  561. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  562. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  563. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  564. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  565. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  566. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  567. package/dist/plugins/link.mjs +1 -1
  568. package/dist/plugins/list.mjs +1 -1
  569. package/dist/plugins/print.mjs +1 -1
  570. package/dist/plugins/shared.mjs +1 -1
  571. package/dist/plugins/smart-paste.mjs +1 -1
  572. package/dist/plugins/strikethrough.mjs +1 -1
  573. package/dist/plugins/super-sub.mjs +1 -1
  574. package/dist/plugins/table.mjs +1 -1
  575. package/dist/plugins/text-color.mjs +1 -1
  576. package/dist/plugins/text-direction/DirectionIcons.d.ts +3 -0
  577. package/dist/plugins/text-direction/DirectionIcons.d.ts.map +1 -0
  578. package/dist/plugins/text-direction/TextDirectionLocale.d.ts +0 -6
  579. package/dist/plugins/text-direction/TextDirectionLocale.d.ts.map +1 -1
  580. package/dist/plugins/text-direction/TextDirectionPlugin.d.ts +3 -30
  581. package/dist/plugins/text-direction/TextDirectionPlugin.d.ts.map +1 -1
  582. package/dist/plugins/text-direction/TextDirectionService.d.ts +9 -0
  583. package/dist/plugins/text-direction/TextDirectionService.d.ts.map +1 -0
  584. package/dist/plugins/text-direction/index.d.ts +3 -1
  585. package/dist/plugins/text-direction/index.d.ts.map +1 -1
  586. package/dist/plugins/text-direction/locales/ar.d.ts.map +1 -1
  587. package/dist/plugins/text-direction/locales/de.d.ts.map +1 -1
  588. package/dist/plugins/text-direction/locales/es.d.ts.map +1 -1
  589. package/dist/plugins/text-direction/locales/fr.d.ts.map +1 -1
  590. package/dist/plugins/text-direction/locales/hi.d.ts.map +1 -1
  591. package/dist/plugins/text-direction/locales/pt.d.ts.map +1 -1
  592. package/dist/plugins/text-direction/locales/ru.d.ts.map +1 -1
  593. package/dist/plugins/text-direction/locales/zh.d.ts.map +1 -1
  594. package/dist/plugins/text-direction-auto/TextDirectionAutoMiddleware.d.ts +5 -0
  595. package/dist/plugins/text-direction-auto/TextDirectionAutoMiddleware.d.ts.map +1 -0
  596. package/dist/plugins/text-direction-auto/TextDirectionAutoPlugin.d.ts +28 -0
  597. package/dist/plugins/text-direction-auto/TextDirectionAutoPlugin.d.ts.map +1 -0
  598. package/dist/plugins/text-direction-auto/index.d.ts +2 -0
  599. package/dist/plugins/text-direction-auto/index.d.ts.map +1 -0
  600. package/dist/plugins/text-direction-auto.mjs +1 -0
  601. package/dist/plugins/text-direction.mjs +1 -1
  602. package/dist/plugins/text-formatting.mjs +1 -1
  603. package/dist/plugins/toolbar.mjs +1 -1
  604. package/dist/presets/FullPreset.d.ts +3 -1
  605. package/dist/presets/FullPreset.d.ts.map +1 -1
  606. package/dist/presets/PresetTypes.d.ts +5 -1
  607. package/dist/presets/PresetTypes.d.ts.map +1 -1
  608. package/dist/presets/full.mjs +1 -1
  609. package/dist/presets/minimal.mjs +1 -1
  610. package/dist/presets.mjs +1 -1
  611. package/dist/serialization/BlockIdHTML.d.ts +21 -0
  612. package/dist/serialization/BlockIdHTML.d.ts.map +1 -0
  613. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  614. package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
  615. package/dist/state/EditorState.d.ts +2 -0
  616. package/dist/state/EditorState.d.ts.map +1 -1
  617. package/dist/test/TestUtils.d.ts +17 -0
  618. package/dist/test/TestUtils.d.ts.map +1 -1
  619. package/dist/view/EditorView.d.ts +18 -1
  620. package/dist/view/EditorView.d.ts.map +1 -1
  621. package/package.json +19 -9
  622. package/dist/chunks/AlignmentPlugin-D1wmhWE6.mjs +0 -2
  623. package/dist/chunks/AlignmentPlugin-D1wmhWE6.mjs.map +0 -1
  624. package/dist/chunks/BlockquotePlugin-Bwny0CP6.mjs +0 -2
  625. package/dist/chunks/BlockquotePlugin-Bwny0CP6.mjs.map +0 -1
  626. package/dist/chunks/CaretNavigationPlugin-C-rCDbu0.mjs +0 -2
  627. package/dist/chunks/CaretNavigationPlugin-C-rCDbu0.mjs.map +0 -1
  628. package/dist/chunks/CodeBlockPlugin-CNC290_q.mjs +0 -2
  629. package/dist/chunks/CodeBlockPlugin-CNC290_q.mjs.map +0 -1
  630. package/dist/chunks/ColorGrid-BUSIBKZH.mjs +0 -2
  631. package/dist/chunks/ColorGrid-BUSIBKZH.mjs.map +0 -1
  632. package/dist/chunks/ColorPickerPopup-CvE90IAu.mjs +0 -2
  633. package/dist/chunks/ColorPickerPopup-CvE90IAu.mjs.map +0 -1
  634. package/dist/chunks/DocumentParser-Cq_bFYAS.mjs +0 -2
  635. package/dist/chunks/DocumentParser-Cq_bFYAS.mjs.map +0 -1
  636. package/dist/chunks/FontPlugin-z0QF1M5q.mjs +0 -2
  637. package/dist/chunks/FontPlugin-z0QF1M5q.mjs.map +0 -1
  638. package/dist/chunks/FontSizePlugin-DYKvhu9w.mjs +0 -2
  639. package/dist/chunks/FontSizePlugin-DYKvhu9w.mjs.map +0 -1
  640. package/dist/chunks/GapCursorPlugin-uxw7W7vj.mjs +0 -2
  641. package/dist/chunks/GapCursorPlugin-uxw7W7vj.mjs.map +0 -1
  642. package/dist/chunks/HTMLUtils-B8xj8Z1x.mjs +0 -2
  643. package/dist/chunks/HTMLUtils-B8xj8Z1x.mjs.map +0 -1
  644. package/dist/chunks/HardBreakPlugin-BpXipf8h.mjs +0 -2
  645. package/dist/chunks/HardBreakPlugin-BpXipf8h.mjs.map +0 -1
  646. package/dist/chunks/HeadingPlugin-CUN746aD.mjs +0 -2
  647. package/dist/chunks/HeadingPlugin-CUN746aD.mjs.map +0 -1
  648. package/dist/chunks/HighlightPlugin-bbAi6W6k.mjs +0 -2
  649. package/dist/chunks/HighlightPlugin-bbAi6W6k.mjs.map +0 -1
  650. package/dist/chunks/HorizontalRulePlugin-D8w6paMa.mjs +0 -2
  651. package/dist/chunks/HorizontalRulePlugin-D8w6paMa.mjs.map +0 -1
  652. package/dist/chunks/ImagePlugin-De7lWcZ7.mjs +0 -2
  653. package/dist/chunks/ImagePlugin-De7lWcZ7.mjs.map +0 -1
  654. package/dist/chunks/InlineCodePlugin-DKQIYhTb.mjs +0 -2
  655. package/dist/chunks/InlineCodePlugin-DKQIYhTb.mjs.map +0 -1
  656. package/dist/chunks/LinkPlugin-BD7mcRHS.mjs +0 -2
  657. package/dist/chunks/LinkPlugin-BD7mcRHS.mjs.map +0 -1
  658. package/dist/chunks/ListPlugin-DbixSqMH.mjs +0 -2
  659. package/dist/chunks/ListPlugin-DbixSqMH.mjs.map +0 -1
  660. package/dist/chunks/Plugin-BUNGKupW.mjs +0 -2
  661. package/dist/chunks/Plugin-BUNGKupW.mjs.map +0 -1
  662. package/dist/chunks/PluginHelpers-D1QF-YaF.mjs +0 -2
  663. package/dist/chunks/PluginHelpers-D1QF-YaF.mjs.map +0 -1
  664. package/dist/chunks/PopupKeyboardPatterns-DhcUe29m.mjs +0 -2
  665. package/dist/chunks/PopupKeyboardPatterns-DhcUe29m.mjs.map +0 -1
  666. package/dist/chunks/PopupManager-DaTySyZl.mjs +0 -2
  667. package/dist/chunks/PopupManager-DaTySyZl.mjs.map +0 -1
  668. package/dist/chunks/PrintPlugin-DVRybXSN.mjs +0 -2
  669. package/dist/chunks/PrintPlugin-DVRybXSN.mjs.map +0 -1
  670. package/dist/chunks/PrintTypes-DTV3-mSe.mjs +0 -2
  671. package/dist/chunks/PrintTypes-DTV3-mSe.mjs.map +0 -1
  672. package/dist/chunks/SmartPastePlugin-i96yAnXZ.mjs +0 -2
  673. package/dist/chunks/SmartPastePlugin-i96yAnXZ.mjs.map +0 -1
  674. package/dist/chunks/StrikethroughPlugin-RGZATXUZ.mjs +0 -2
  675. package/dist/chunks/StrikethroughPlugin-RGZATXUZ.mjs.map +0 -1
  676. package/dist/chunks/SuperSubPlugin-BOWFP1Kr.mjs +0 -2
  677. package/dist/chunks/SuperSubPlugin-BOWFP1Kr.mjs.map +0 -1
  678. package/dist/chunks/TablePlugin-DZTMBkyu.mjs +0 -2
  679. package/dist/chunks/TablePlugin-DZTMBkyu.mjs.map +0 -1
  680. package/dist/chunks/TextColorPlugin-CB3RpTSQ.mjs +0 -2
  681. package/dist/chunks/TextColorPlugin-CB3RpTSQ.mjs.map +0 -1
  682. package/dist/chunks/TextDirectionCorePlugin-tNecTcrX.mjs +0 -2
  683. package/dist/chunks/TextDirectionCorePlugin-tNecTcrX.mjs.map +0 -1
  684. package/dist/chunks/TextDirectionLocale-_AUfZu9j.mjs +0 -2
  685. package/dist/chunks/TextDirectionLocale-_AUfZu9j.mjs.map +0 -1
  686. package/dist/chunks/TextFormattingPlugin-CZ6D-luc.mjs +0 -2
  687. package/dist/chunks/TextFormattingPlugin-CZ6D-luc.mjs.map +0 -1
  688. package/dist/chunks/ToolbarPlugin-2K96zYut.mjs +0 -2
  689. package/dist/chunks/ToolbarPlugin-2K96zYut.mjs.map +0 -1
  690. package/dist/chunks/XmlDetector-DlRdJOIX.mjs +0 -2
  691. package/dist/chunks/XmlDetector-DlRdJOIX.mjs.map +0 -1
  692. package/dist/chunks/XmlPatterns-Dwmn4nrg.mjs +0 -2
  693. package/dist/chunks/XmlPatterns-Dwmn4nrg.mjs.map +0 -1
  694. package/dist/chunks/XmlSupport-DG8PEZhO.mjs +0 -2
  695. package/dist/chunks/XmlSupport-DG8PEZhO.mjs.map +0 -1
  696. package/dist/chunks/ar--dzNQRg4.mjs +0 -2
  697. package/dist/chunks/ar--dzNQRg4.mjs.map +0 -1
  698. package/dist/chunks/ar-13q9ejck.mjs +0 -2
  699. package/dist/chunks/ar-13q9ejck.mjs.map +0 -1
  700. package/dist/chunks/ar-7XO2HmsM.mjs +0 -2
  701. package/dist/chunks/ar-7XO2HmsM.mjs.map +0 -1
  702. package/dist/chunks/ar-B-n_gMXb.mjs +0 -2
  703. package/dist/chunks/ar-B-n_gMXb.mjs.map +0 -1
  704. package/dist/chunks/ar-BXeE6tKj.mjs +0 -2
  705. package/dist/chunks/ar-BXeE6tKj.mjs.map +0 -1
  706. package/dist/chunks/ar-Bs3sx3Oz.mjs +0 -2
  707. package/dist/chunks/ar-Bs3sx3Oz.mjs.map +0 -1
  708. package/dist/chunks/ar-ByNQ-o3t.mjs +0 -2
  709. package/dist/chunks/ar-ByNQ-o3t.mjs.map +0 -1
  710. package/dist/chunks/ar-C9AnO0uV.mjs +0 -2
  711. package/dist/chunks/ar-C9AnO0uV.mjs.map +0 -1
  712. package/dist/chunks/ar-CL-NsFoh.mjs +0 -2
  713. package/dist/chunks/ar-CL-NsFoh.mjs.map +0 -1
  714. package/dist/chunks/ar-COx4cFpT.mjs +0 -2
  715. package/dist/chunks/ar-COx4cFpT.mjs.map +0 -1
  716. package/dist/chunks/ar-CYZYoqcc.mjs +0 -2
  717. package/dist/chunks/ar-CYZYoqcc.mjs.map +0 -1
  718. package/dist/chunks/ar-ChOxTdPI.mjs +0 -2
  719. package/dist/chunks/ar-ChOxTdPI.mjs.map +0 -1
  720. package/dist/chunks/ar-Cj6amEs9.mjs +0 -2
  721. package/dist/chunks/ar-Cj6amEs9.mjs.map +0 -1
  722. package/dist/chunks/ar-CsH2S6Vd.mjs +0 -2
  723. package/dist/chunks/ar-CsH2S6Vd.mjs.map +0 -1
  724. package/dist/chunks/ar-D2y_YvMP.mjs +0 -2
  725. package/dist/chunks/ar-D2y_YvMP.mjs.map +0 -1
  726. package/dist/chunks/ar-D57VZrg2.mjs +0 -2
  727. package/dist/chunks/ar-D57VZrg2.mjs.map +0 -1
  728. package/dist/chunks/ar-DH06YQkP.mjs +0 -2
  729. package/dist/chunks/ar-DH06YQkP.mjs.map +0 -1
  730. package/dist/chunks/ar-DJ6K9HnU.mjs +0 -2
  731. package/dist/chunks/ar-DJ6K9HnU.mjs.map +0 -1
  732. package/dist/chunks/ar-DMNNIim-.mjs +0 -2
  733. package/dist/chunks/ar-DMNNIim-.mjs.map +0 -1
  734. package/dist/chunks/ar-DW0Inc7r.mjs +0 -2
  735. package/dist/chunks/ar-DW0Inc7r.mjs.map +0 -1
  736. package/dist/chunks/ar-SwJ-tyIu.mjs +0 -2
  737. package/dist/chunks/ar-SwJ-tyIu.mjs.map +0 -1
  738. package/dist/chunks/ar-Vfk7XFaz.mjs +0 -2
  739. package/dist/chunks/ar-Vfk7XFaz.mjs.map +0 -1
  740. package/dist/chunks/ar-izXCtb2I.mjs +0 -2
  741. package/dist/chunks/ar-izXCtb2I.mjs.map +0 -1
  742. package/dist/chunks/ar-jsznaXQ0.mjs +0 -2
  743. package/dist/chunks/ar-jsznaXQ0.mjs.map +0 -1
  744. package/dist/chunks/color-picker-ChYYdC-r.mjs +0 -2
  745. package/dist/chunks/color-picker-ChYYdC-r.mjs.map +0 -1
  746. package/dist/chunks/de-3PJCshB7.mjs +0 -2
  747. package/dist/chunks/de-3PJCshB7.mjs.map +0 -1
  748. package/dist/chunks/de-B92lssMU.mjs +0 -2
  749. package/dist/chunks/de-B92lssMU.mjs.map +0 -1
  750. package/dist/chunks/de-BJ8Lo9rY.mjs +0 -2
  751. package/dist/chunks/de-BJ8Lo9rY.mjs.map +0 -1
  752. package/dist/chunks/de-BjNoeX05.mjs +0 -2
  753. package/dist/chunks/de-BjNoeX05.mjs.map +0 -1
  754. package/dist/chunks/de-Bktm7FKk.mjs +0 -2
  755. package/dist/chunks/de-Bktm7FKk.mjs.map +0 -1
  756. package/dist/chunks/de-BqHw2LVH.mjs +0 -2
  757. package/dist/chunks/de-BqHw2LVH.mjs.map +0 -1
  758. package/dist/chunks/de-BzjqF_j0.mjs +0 -2
  759. package/dist/chunks/de-BzjqF_j0.mjs.map +0 -1
  760. package/dist/chunks/de-C7Grl0t1.mjs +0 -2
  761. package/dist/chunks/de-C7Grl0t1.mjs.map +0 -1
  762. package/dist/chunks/de-CWsXH4_J.mjs +0 -2
  763. package/dist/chunks/de-CWsXH4_J.mjs.map +0 -1
  764. package/dist/chunks/de-CWwHCIzX.mjs +0 -2
  765. package/dist/chunks/de-CWwHCIzX.mjs.map +0 -1
  766. package/dist/chunks/de-ChHR-g0q.mjs +0 -2
  767. package/dist/chunks/de-ChHR-g0q.mjs.map +0 -1
  768. package/dist/chunks/de-CqJFzINs.mjs +0 -2
  769. package/dist/chunks/de-CqJFzINs.mjs.map +0 -1
  770. package/dist/chunks/de-DAPQek-i.mjs +0 -2
  771. package/dist/chunks/de-DAPQek-i.mjs.map +0 -1
  772. package/dist/chunks/de-DPzOP2Ge.mjs +0 -2
  773. package/dist/chunks/de-DPzOP2Ge.mjs.map +0 -1
  774. package/dist/chunks/de-DhenqH4M.mjs +0 -2
  775. package/dist/chunks/de-DhenqH4M.mjs.map +0 -1
  776. package/dist/chunks/de-Ds6tfD71.mjs +0 -2
  777. package/dist/chunks/de-Ds6tfD71.mjs.map +0 -1
  778. package/dist/chunks/de-DxyfCVlM.mjs +0 -2
  779. package/dist/chunks/de-DxyfCVlM.mjs.map +0 -1
  780. package/dist/chunks/de-RSzW4zsb.mjs +0 -2
  781. package/dist/chunks/de-RSzW4zsb.mjs.map +0 -1
  782. package/dist/chunks/de-YiJZ87p6.mjs +0 -2
  783. package/dist/chunks/de-YiJZ87p6.mjs.map +0 -1
  784. package/dist/chunks/de-e7G64WBM.mjs +0 -2
  785. package/dist/chunks/de-e7G64WBM.mjs.map +0 -1
  786. package/dist/chunks/de-oeen0lTL.mjs +0 -2
  787. package/dist/chunks/de-oeen0lTL.mjs.map +0 -1
  788. package/dist/chunks/de-p1zboXJW.mjs +0 -2
  789. package/dist/chunks/de-p1zboXJW.mjs.map +0 -1
  790. package/dist/chunks/de-q2xHBWVU.mjs +0 -2
  791. package/dist/chunks/de-q2xHBWVU.mjs.map +0 -1
  792. package/dist/chunks/de-zjzkzZs9.mjs +0 -2
  793. package/dist/chunks/de-zjzkzZs9.mjs.map +0 -1
  794. package/dist/chunks/es-2U-tuiWo.mjs +0 -2
  795. package/dist/chunks/es-2U-tuiWo.mjs.map +0 -1
  796. package/dist/chunks/es-8kEYE5eN.mjs +0 -2
  797. package/dist/chunks/es-8kEYE5eN.mjs.map +0 -1
  798. package/dist/chunks/es-B2B0W46I.mjs +0 -2
  799. package/dist/chunks/es-B2B0W46I.mjs.map +0 -1
  800. package/dist/chunks/es-B8Ne6vhS.mjs +0 -2
  801. package/dist/chunks/es-B8Ne6vhS.mjs.map +0 -1
  802. package/dist/chunks/es-BBaS8xrI.mjs +0 -2
  803. package/dist/chunks/es-BBaS8xrI.mjs.map +0 -1
  804. package/dist/chunks/es-BJibD3UW.mjs +0 -2
  805. package/dist/chunks/es-BJibD3UW.mjs.map +0 -1
  806. package/dist/chunks/es-BUIOf37N.mjs +0 -2
  807. package/dist/chunks/es-BUIOf37N.mjs.map +0 -1
  808. package/dist/chunks/es-BcEc0JEI.mjs +0 -2
  809. package/dist/chunks/es-BcEc0JEI.mjs.map +0 -1
  810. package/dist/chunks/es-BjomAlG3.mjs +0 -2
  811. package/dist/chunks/es-BjomAlG3.mjs.map +0 -1
  812. package/dist/chunks/es-BpgE28ol.mjs +0 -2
  813. package/dist/chunks/es-BpgE28ol.mjs.map +0 -1
  814. package/dist/chunks/es-Bq_XkuDG.mjs +0 -2
  815. package/dist/chunks/es-Bq_XkuDG.mjs.map +0 -1
  816. package/dist/chunks/es-BtTQw2t5.mjs +0 -2
  817. package/dist/chunks/es-BtTQw2t5.mjs.map +0 -1
  818. package/dist/chunks/es-BwmzRdDZ.mjs +0 -2
  819. package/dist/chunks/es-BwmzRdDZ.mjs.map +0 -1
  820. package/dist/chunks/es-Bwy7v223.mjs +0 -2
  821. package/dist/chunks/es-Bwy7v223.mjs.map +0 -1
  822. package/dist/chunks/es-C0Jm_n57.mjs +0 -2
  823. package/dist/chunks/es-C0Jm_n57.mjs.map +0 -1
  824. package/dist/chunks/es-C49UmQIT.mjs +0 -2
  825. package/dist/chunks/es-C49UmQIT.mjs.map +0 -1
  826. package/dist/chunks/es-CCAT_-nb.mjs +0 -2
  827. package/dist/chunks/es-CCAT_-nb.mjs.map +0 -1
  828. package/dist/chunks/es-CGGqdLIQ.mjs +0 -2
  829. package/dist/chunks/es-CGGqdLIQ.mjs.map +0 -1
  830. package/dist/chunks/es-CYKm6CQM.mjs +0 -2
  831. package/dist/chunks/es-CYKm6CQM.mjs.map +0 -1
  832. package/dist/chunks/es-C_L1Wdfi.mjs +0 -2
  833. package/dist/chunks/es-C_L1Wdfi.mjs.map +0 -1
  834. package/dist/chunks/es-DEo4yDI6.mjs +0 -2
  835. package/dist/chunks/es-DEo4yDI6.mjs.map +0 -1
  836. package/dist/chunks/es-D_6MYvFK.mjs +0 -2
  837. package/dist/chunks/es-D_6MYvFK.mjs.map +0 -1
  838. package/dist/chunks/es-DcYIJR0T.mjs +0 -2
  839. package/dist/chunks/es-DcYIJR0T.mjs.map +0 -1
  840. package/dist/chunks/es-y2SZmX3P.mjs +0 -2
  841. package/dist/chunks/es-y2SZmX3P.mjs.map +0 -1
  842. package/dist/chunks/fonts-CG_dDwvT.mjs +0 -2
  843. package/dist/chunks/fonts-CG_dDwvT.mjs.map +0 -1
  844. package/dist/chunks/fr-Ame1k629.mjs +0 -2
  845. package/dist/chunks/fr-Ame1k629.mjs.map +0 -1
  846. package/dist/chunks/fr-BCN045Ph.mjs +0 -2
  847. package/dist/chunks/fr-BCN045Ph.mjs.map +0 -1
  848. package/dist/chunks/fr-BQaiAAa6.mjs +0 -2
  849. package/dist/chunks/fr-BQaiAAa6.mjs.map +0 -1
  850. package/dist/chunks/fr-BR61Uevp.mjs +0 -2
  851. package/dist/chunks/fr-BR61Uevp.mjs.map +0 -1
  852. package/dist/chunks/fr-Bb-xVkAd.mjs +0 -2
  853. package/dist/chunks/fr-Bb-xVkAd.mjs.map +0 -1
  854. package/dist/chunks/fr-BhM3Ykql.mjs +0 -2
  855. package/dist/chunks/fr-BhM3Ykql.mjs.map +0 -1
  856. package/dist/chunks/fr-BqQRlsfW.mjs +0 -2
  857. package/dist/chunks/fr-BqQRlsfW.mjs.map +0 -1
  858. package/dist/chunks/fr-C81THS0v.mjs +0 -2
  859. package/dist/chunks/fr-C81THS0v.mjs.map +0 -1
  860. package/dist/chunks/fr-CC7TYK5K.mjs +0 -2
  861. package/dist/chunks/fr-CC7TYK5K.mjs.map +0 -1
  862. package/dist/chunks/fr-CXzpB6GU.mjs +0 -2
  863. package/dist/chunks/fr-CXzpB6GU.mjs.map +0 -1
  864. package/dist/chunks/fr-CjLyVnG3.mjs +0 -2
  865. package/dist/chunks/fr-CjLyVnG3.mjs.map +0 -1
  866. package/dist/chunks/fr-D66EEW9-.mjs +0 -2
  867. package/dist/chunks/fr-D66EEW9-.mjs.map +0 -1
  868. package/dist/chunks/fr-DHDNGQpl.mjs +0 -2
  869. package/dist/chunks/fr-DHDNGQpl.mjs.map +0 -1
  870. package/dist/chunks/fr-DOcFqSiX.mjs +0 -2
  871. package/dist/chunks/fr-DOcFqSiX.mjs.map +0 -1
  872. package/dist/chunks/fr-DPPHZ6H7.mjs +0 -2
  873. package/dist/chunks/fr-DPPHZ6H7.mjs.map +0 -1
  874. package/dist/chunks/fr-DVteHTTh.mjs +0 -2
  875. package/dist/chunks/fr-DVteHTTh.mjs.map +0 -1
  876. package/dist/chunks/fr-Dkeg9Am0.mjs +0 -2
  877. package/dist/chunks/fr-Dkeg9Am0.mjs.map +0 -1
  878. package/dist/chunks/fr-DnP_hh5Q.mjs +0 -2
  879. package/dist/chunks/fr-DnP_hh5Q.mjs.map +0 -1
  880. package/dist/chunks/fr-aDJE54Is.mjs +0 -2
  881. package/dist/chunks/fr-aDJE54Is.mjs.map +0 -1
  882. package/dist/chunks/fr-hStmLXCS.mjs +0 -2
  883. package/dist/chunks/fr-hStmLXCS.mjs.map +0 -1
  884. package/dist/chunks/fr-hUF51sR5.mjs +0 -2
  885. package/dist/chunks/fr-hUF51sR5.mjs.map +0 -1
  886. package/dist/chunks/fr-tK6rWhoz.mjs +0 -2
  887. package/dist/chunks/fr-tK6rWhoz.mjs.map +0 -1
  888. package/dist/chunks/fr-wqbTMwkj.mjs +0 -2
  889. package/dist/chunks/fr-wqbTMwkj.mjs.map +0 -1
  890. package/dist/chunks/fr-zO4UIZj_.mjs +0 -2
  891. package/dist/chunks/fr-zO4UIZj_.mjs.map +0 -1
  892. package/dist/chunks/full-B9IqlP6u.mjs +0 -2
  893. package/dist/chunks/full-B9IqlP6u.mjs.map +0 -1
  894. package/dist/chunks/hi-B7zs2lw-.mjs +0 -2
  895. package/dist/chunks/hi-B7zs2lw-.mjs.map +0 -1
  896. package/dist/chunks/hi-BE4pkSYX.mjs +0 -2
  897. package/dist/chunks/hi-BE4pkSYX.mjs.map +0 -1
  898. package/dist/chunks/hi-BEBdteKo.mjs +0 -2
  899. package/dist/chunks/hi-BEBdteKo.mjs.map +0 -1
  900. package/dist/chunks/hi-BFBRjxgB.mjs +0 -2
  901. package/dist/chunks/hi-BFBRjxgB.mjs.map +0 -1
  902. package/dist/chunks/hi-BGMkRr1l.mjs +0 -2
  903. package/dist/chunks/hi-BGMkRr1l.mjs.map +0 -1
  904. package/dist/chunks/hi-BKJbF0k9.mjs +0 -2
  905. package/dist/chunks/hi-BKJbF0k9.mjs.map +0 -1
  906. package/dist/chunks/hi-Bj-wENIe.mjs +0 -2
  907. package/dist/chunks/hi-Bj-wENIe.mjs.map +0 -1
  908. package/dist/chunks/hi-Bo_sc83d.mjs +0 -2
  909. package/dist/chunks/hi-Bo_sc83d.mjs.map +0 -1
  910. package/dist/chunks/hi-BqdojmVi.mjs +0 -2
  911. package/dist/chunks/hi-BqdojmVi.mjs.map +0 -1
  912. package/dist/chunks/hi-BtN2T9la.mjs +0 -2
  913. package/dist/chunks/hi-BtN2T9la.mjs.map +0 -1
  914. package/dist/chunks/hi-C2HFcJ8H.mjs +0 -2
  915. package/dist/chunks/hi-C2HFcJ8H.mjs.map +0 -1
  916. package/dist/chunks/hi-C9hGhR9D.mjs +0 -2
  917. package/dist/chunks/hi-C9hGhR9D.mjs.map +0 -1
  918. package/dist/chunks/hi-CRsCP_UU.mjs +0 -2
  919. package/dist/chunks/hi-CRsCP_UU.mjs.map +0 -1
  920. package/dist/chunks/hi-CSatC6e_.mjs +0 -2
  921. package/dist/chunks/hi-CSatC6e_.mjs.map +0 -1
  922. package/dist/chunks/hi-Cik-gmhU.mjs +0 -2
  923. package/dist/chunks/hi-Cik-gmhU.mjs.map +0 -1
  924. package/dist/chunks/hi-Co2ThMh7.mjs +0 -2
  925. package/dist/chunks/hi-Co2ThMh7.mjs.map +0 -1
  926. package/dist/chunks/hi-CrATuZJr.mjs +0 -2
  927. package/dist/chunks/hi-CrATuZJr.mjs.map +0 -1
  928. package/dist/chunks/hi-D-r5tA_n.mjs +0 -2
  929. package/dist/chunks/hi-D-r5tA_n.mjs.map +0 -1
  930. package/dist/chunks/hi-D0RKvhDO.mjs +0 -2
  931. package/dist/chunks/hi-D0RKvhDO.mjs.map +0 -1
  932. package/dist/chunks/hi-DOSbCXy_.mjs +0 -2
  933. package/dist/chunks/hi-DOSbCXy_.mjs.map +0 -1
  934. package/dist/chunks/hi-DTUY7wlZ.mjs +0 -2
  935. package/dist/chunks/hi-DTUY7wlZ.mjs.map +0 -1
  936. package/dist/chunks/hi-FhcxnL2S.mjs +0 -2
  937. package/dist/chunks/hi-FhcxnL2S.mjs.map +0 -1
  938. package/dist/chunks/hi-K71sKi2-.mjs +0 -2
  939. package/dist/chunks/hi-K71sKi2-.mjs.map +0 -1
  940. package/dist/chunks/hi-xjChf5ZY.mjs +0 -2
  941. package/dist/chunks/hi-xjChf5ZY.mjs.map +0 -1
  942. package/dist/chunks/minimal-J-u7e_pr.mjs +0 -2
  943. package/dist/chunks/minimal-J-u7e_pr.mjs.map +0 -1
  944. package/dist/chunks/pt-6uTV9TBd.mjs +0 -2
  945. package/dist/chunks/pt-6uTV9TBd.mjs.map +0 -1
  946. package/dist/chunks/pt-7ZYOqmC4.mjs +0 -2
  947. package/dist/chunks/pt-7ZYOqmC4.mjs.map +0 -1
  948. package/dist/chunks/pt-B59gJzMS.mjs +0 -2
  949. package/dist/chunks/pt-B59gJzMS.mjs.map +0 -1
  950. package/dist/chunks/pt-B65Mk0F_.mjs +0 -2
  951. package/dist/chunks/pt-B65Mk0F_.mjs.map +0 -1
  952. package/dist/chunks/pt-B9c20zi-.mjs +0 -2
  953. package/dist/chunks/pt-B9c20zi-.mjs.map +0 -1
  954. package/dist/chunks/pt-BRQRHBoW.mjs +0 -2
  955. package/dist/chunks/pt-BRQRHBoW.mjs.map +0 -1
  956. package/dist/chunks/pt-BYsPmDNG.mjs +0 -2
  957. package/dist/chunks/pt-BYsPmDNG.mjs.map +0 -1
  958. package/dist/chunks/pt-Bau_d96t.mjs +0 -2
  959. package/dist/chunks/pt-Bau_d96t.mjs.map +0 -1
  960. package/dist/chunks/pt-Bb3sODVO.mjs +0 -2
  961. package/dist/chunks/pt-Bb3sODVO.mjs.map +0 -1
  962. package/dist/chunks/pt-BieXcDHi.mjs +0 -2
  963. package/dist/chunks/pt-BieXcDHi.mjs.map +0 -1
  964. package/dist/chunks/pt-BzJZ6tis.mjs +0 -2
  965. package/dist/chunks/pt-BzJZ6tis.mjs.map +0 -1
  966. package/dist/chunks/pt-CDBahjbg.mjs +0 -2
  967. package/dist/chunks/pt-CDBahjbg.mjs.map +0 -1
  968. package/dist/chunks/pt-CQIn2xA5.mjs +0 -2
  969. package/dist/chunks/pt-CQIn2xA5.mjs.map +0 -1
  970. package/dist/chunks/pt-Cx3gdB5p.mjs +0 -2
  971. package/dist/chunks/pt-Cx3gdB5p.mjs.map +0 -1
  972. package/dist/chunks/pt-D7n_VUMD.mjs +0 -2
  973. package/dist/chunks/pt-D7n_VUMD.mjs.map +0 -1
  974. package/dist/chunks/pt-DEg_u7oB.mjs +0 -2
  975. package/dist/chunks/pt-DEg_u7oB.mjs.map +0 -1
  976. package/dist/chunks/pt-DchozfDf.mjs +0 -2
  977. package/dist/chunks/pt-DchozfDf.mjs.map +0 -1
  978. package/dist/chunks/pt-DnHYzWZI.mjs +0 -2
  979. package/dist/chunks/pt-DnHYzWZI.mjs.map +0 -1
  980. package/dist/chunks/pt-Dne18ay-.mjs +0 -2
  981. package/dist/chunks/pt-Dne18ay-.mjs.map +0 -1
  982. package/dist/chunks/pt-DxTZELCn.mjs +0 -2
  983. package/dist/chunks/pt-DxTZELCn.mjs.map +0 -1
  984. package/dist/chunks/pt-FnLj_fwL.mjs +0 -2
  985. package/dist/chunks/pt-FnLj_fwL.mjs.map +0 -1
  986. package/dist/chunks/pt-QZcGM_AW.mjs +0 -2
  987. package/dist/chunks/pt-QZcGM_AW.mjs.map +0 -1
  988. package/dist/chunks/pt-X4oj0zCg.mjs +0 -2
  989. package/dist/chunks/pt-X4oj0zCg.mjs.map +0 -1
  990. package/dist/chunks/pt-hgZhGt5D.mjs +0 -2
  991. package/dist/chunks/pt-hgZhGt5D.mjs.map +0 -1
  992. package/dist/chunks/ru-333jycve.mjs +0 -2
  993. package/dist/chunks/ru-333jycve.mjs.map +0 -1
  994. package/dist/chunks/ru-B278yBd4.mjs +0 -2
  995. package/dist/chunks/ru-B278yBd4.mjs.map +0 -1
  996. package/dist/chunks/ru-B2dlVf3F.mjs +0 -2
  997. package/dist/chunks/ru-B2dlVf3F.mjs.map +0 -1
  998. package/dist/chunks/ru-BHZdR6yk.mjs +0 -2
  999. package/dist/chunks/ru-BHZdR6yk.mjs.map +0 -1
  1000. package/dist/chunks/ru-BhXqR_wI.mjs +0 -2
  1001. package/dist/chunks/ru-BhXqR_wI.mjs.map +0 -1
  1002. package/dist/chunks/ru-BkhY_-Tu.mjs +0 -2
  1003. package/dist/chunks/ru-BkhY_-Tu.mjs.map +0 -1
  1004. package/dist/chunks/ru-BqJmK6DG.mjs +0 -2
  1005. package/dist/chunks/ru-BqJmK6DG.mjs.map +0 -1
  1006. package/dist/chunks/ru-BscEW-yr.mjs +0 -2
  1007. package/dist/chunks/ru-BscEW-yr.mjs.map +0 -1
  1008. package/dist/chunks/ru-C91kg2w_.mjs +0 -2
  1009. package/dist/chunks/ru-C91kg2w_.mjs.map +0 -1
  1010. package/dist/chunks/ru-CQoFJYQk.mjs +0 -2
  1011. package/dist/chunks/ru-CQoFJYQk.mjs.map +0 -1
  1012. package/dist/chunks/ru-CYMaDdFA.mjs +0 -2
  1013. package/dist/chunks/ru-CYMaDdFA.mjs.map +0 -1
  1014. package/dist/chunks/ru-ClE-ByL-.mjs +0 -2
  1015. package/dist/chunks/ru-ClE-ByL-.mjs.map +0 -1
  1016. package/dist/chunks/ru-CmLLEJJV.mjs +0 -2
  1017. package/dist/chunks/ru-CmLLEJJV.mjs.map +0 -1
  1018. package/dist/chunks/ru-CmlYwIPH.mjs +0 -2
  1019. package/dist/chunks/ru-CmlYwIPH.mjs.map +0 -1
  1020. package/dist/chunks/ru-D74ItjLR.mjs +0 -2
  1021. package/dist/chunks/ru-D74ItjLR.mjs.map +0 -1
  1022. package/dist/chunks/ru-DR7ji_U_.mjs +0 -2
  1023. package/dist/chunks/ru-DR7ji_U_.mjs.map +0 -1
  1024. package/dist/chunks/ru-DZ0titlK.mjs +0 -2
  1025. package/dist/chunks/ru-DZ0titlK.mjs.map +0 -1
  1026. package/dist/chunks/ru-DftPghQ8.mjs +0 -2
  1027. package/dist/chunks/ru-DftPghQ8.mjs.map +0 -1
  1028. package/dist/chunks/ru-KBX9Y7TT.mjs +0 -2
  1029. package/dist/chunks/ru-KBX9Y7TT.mjs.map +0 -1
  1030. package/dist/chunks/ru-L3ML505C.mjs +0 -2
  1031. package/dist/chunks/ru-L3ML505C.mjs.map +0 -1
  1032. package/dist/chunks/ru-VAZhjO4q.mjs +0 -2
  1033. package/dist/chunks/ru-VAZhjO4q.mjs.map +0 -1
  1034. package/dist/chunks/ru-afocv3DK.mjs +0 -2
  1035. package/dist/chunks/ru-afocv3DK.mjs.map +0 -1
  1036. package/dist/chunks/ru-gUXymxbh.mjs +0 -2
  1037. package/dist/chunks/ru-gUXymxbh.mjs.map +0 -1
  1038. package/dist/chunks/ru-qL1ebv4O.mjs +0 -2
  1039. package/dist/chunks/ru-qL1ebv4O.mjs.map +0 -1
  1040. package/dist/chunks/src-Bq4jFC-Q.mjs +0 -2
  1041. package/dist/chunks/src-Bq4jFC-Q.mjs.map +0 -1
  1042. package/dist/chunks/text-direction-advanced-S4MgVMLX.mjs +0 -2
  1043. package/dist/chunks/text-direction-advanced-S4MgVMLX.mjs.map +0 -1
  1044. package/dist/chunks/zh-B3geJFGW.mjs +0 -2
  1045. package/dist/chunks/zh-B3geJFGW.mjs.map +0 -1
  1046. package/dist/chunks/zh-B4p7M6XB.mjs +0 -2
  1047. package/dist/chunks/zh-B4p7M6XB.mjs.map +0 -1
  1048. package/dist/chunks/zh-BkwaMj9a.mjs +0 -2
  1049. package/dist/chunks/zh-BkwaMj9a.mjs.map +0 -1
  1050. package/dist/chunks/zh-BogAT6ZW.mjs +0 -2
  1051. package/dist/chunks/zh-BogAT6ZW.mjs.map +0 -1
  1052. package/dist/chunks/zh-BvMEmsyF.mjs +0 -2
  1053. package/dist/chunks/zh-BvMEmsyF.mjs.map +0 -1
  1054. package/dist/chunks/zh-BzLh1p5b.mjs +0 -2
  1055. package/dist/chunks/zh-BzLh1p5b.mjs.map +0 -1
  1056. package/dist/chunks/zh-CBMpL9ha.mjs +0 -2
  1057. package/dist/chunks/zh-CBMpL9ha.mjs.map +0 -1
  1058. package/dist/chunks/zh-CIFsVnFl.mjs +0 -2
  1059. package/dist/chunks/zh-CIFsVnFl.mjs.map +0 -1
  1060. package/dist/chunks/zh-CP6_YzAc.mjs +0 -2
  1061. package/dist/chunks/zh-CP6_YzAc.mjs.map +0 -1
  1062. package/dist/chunks/zh-CT4V3EmW.mjs +0 -2
  1063. package/dist/chunks/zh-CT4V3EmW.mjs.map +0 -1
  1064. package/dist/chunks/zh-CZCIluI_.mjs +0 -2
  1065. package/dist/chunks/zh-CZCIluI_.mjs.map +0 -1
  1066. package/dist/chunks/zh-CcMLjYrk.mjs +0 -2
  1067. package/dist/chunks/zh-CcMLjYrk.mjs.map +0 -1
  1068. package/dist/chunks/zh-CfCQsLZa.mjs +0 -2
  1069. package/dist/chunks/zh-CfCQsLZa.mjs.map +0 -1
  1070. package/dist/chunks/zh-CsyBlhtm.mjs +0 -2
  1071. package/dist/chunks/zh-CsyBlhtm.mjs.map +0 -1
  1072. package/dist/chunks/zh-D4eu30KQ.mjs +0 -2
  1073. package/dist/chunks/zh-D4eu30KQ.mjs.map +0 -1
  1074. package/dist/chunks/zh-DSfxjb4Y.mjs +0 -2
  1075. package/dist/chunks/zh-DSfxjb4Y.mjs.map +0 -1
  1076. package/dist/chunks/zh-Dj5jzeIJ.mjs +0 -2
  1077. package/dist/chunks/zh-Dj5jzeIJ.mjs.map +0 -1
  1078. package/dist/chunks/zh-DjY-jmYn.mjs +0 -2
  1079. package/dist/chunks/zh-DjY-jmYn.mjs.map +0 -1
  1080. package/dist/chunks/zh-Dt7zL1Bl.mjs +0 -2
  1081. package/dist/chunks/zh-Dt7zL1Bl.mjs.map +0 -1
  1082. package/dist/chunks/zh-bkCXy34A.mjs +0 -2
  1083. package/dist/chunks/zh-bkCXy34A.mjs.map +0 -1
  1084. package/dist/chunks/zh-cRqBrQM8.mjs +0 -2
  1085. package/dist/chunks/zh-cRqBrQM8.mjs.map +0 -1
  1086. package/dist/chunks/zh-cUJdRfxu.mjs +0 -2
  1087. package/dist/chunks/zh-cUJdRfxu.mjs.map +0 -1
  1088. package/dist/chunks/zh-qo4_i9Vd.mjs +0 -2
  1089. package/dist/chunks/zh-qo4_i9Vd.mjs.map +0 -1
  1090. package/dist/chunks/zh-tpUU3oJa.mjs +0 -2
  1091. package/dist/chunks/zh-tpUU3oJa.mjs.map +0 -1
  1092. package/dist/plugins/text-direction/TextDirectionCorePlugin.d.ts +0 -35
  1093. package/dist/plugins/text-direction/TextDirectionCorePlugin.d.ts.map +0 -1
  1094. package/dist/plugins/text-direction/TextDirectionMiddleware.d.ts +0 -18
  1095. package/dist/plugins/text-direction/TextDirectionMiddleware.d.ts.map +0 -1
  1096. package/dist/plugins/text-direction-advanced/index.d.ts +0 -5
  1097. package/dist/plugins/text-direction-advanced/index.d.ts.map +0 -1
  1098. package/dist/plugins/text-direction-advanced.mjs +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlockPlugin-DglqiSNK.mjs","names":[],"sources":["../../src/editor/styles/code-block.ts","../../src/plugins/language/LanguageRegistry.ts","../../src/plugins/code-block/CodeBlockKeyboardHandlers.ts","../../src/plugins/code-block/CodeBlockCommands.ts","../../src/plugins/code-block/CodeBlockLocale.ts","../../src/plugins/code-block/LanguagePicker.ts","../../src/plugins/code-block/CodeBlockNodeView.ts","../../src/plugins/code-block/CodeBlockTypes.ts","../../src/plugins/code-block/CodeBlockService.ts","../../src/plugins/code-block/highlighter/RegexTokenizer.ts","../../src/plugins/code-block/CodeBlockPlugin.ts"],"sourcesContent":["import { SYNTAX_TOKEN_TYPES } from '../theme/SyntaxTokenTypes.js';\n\n/** Generates per-token CSS rules from the canonical token type list. */\nfunction generateTokenCSS(): string {\n\treturn SYNTAX_TOKEN_TYPES.map(\n\t\t(type) =>\n\t\t\t`.notectl-token--${type} {\\n\\tcolor: var(--notectl-code-token-${type});\\n\\tfont-style: var(--notectl-code-token-${type}-font-style, inherit);\\n\\tfont-weight: var(--notectl-code-token-${type}-font-weight, inherit);\\n}`,\n\t).join('\\n');\n}\n\n/** Code block styles — syntax highlighting container, header, copy button. */\nexport const CODE_BLOCK_CSS = `\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${generateTokenCSS()}\n`;\n","/**\n * Internal registry that stores LanguageSupport bundles and notifies\n * subscribers with replay semantics for late subscribers.\n */\n\nimport type {\n\tLanguageRegistryListener,\n\tLanguageRegistryService,\n\tLanguageSupport,\n} from './LanguageTypes.js';\n\nexport class LanguageRegistry implements LanguageRegistryService {\n\tprivate readonly bundles = new Map<string, LanguageSupport>();\n\tprivate readonly listeners: LanguageRegistryListener[] = [];\n\n\tregister(support: LanguageSupport): void {\n\t\tthis.bundles.set(support.id, support);\n\t\tfor (const listener of this.listeners) {\n\t\t\tlistener(support);\n\t\t}\n\t}\n\n\t/**\n\t * Subscribes to language registrations.\n\t * The listener is immediately called for all already-registered bundles\n\t * (replay semantics), then called for each future registration.\n\t */\n\tonRegister(listener: LanguageRegistryListener): void {\n\t\tthis.listeners.push(listener);\n\t\tfor (const support of this.bundles.values()) {\n\t\t\tlistener(support);\n\t\t}\n\t}\n\n\tget(id: string): LanguageSupport | undefined {\n\t\treturn this.bundles.get(id);\n\t}\n\n\tgetAll(): readonly LanguageSupport[] {\n\t\treturn [...this.bundles.values()];\n\t}\n}\n","/**\n * Keyboard handlers for code-block navigation and editing.\n * Handles Enter, Backspace, Tab, Shift-Tab, Escape, Arrow keys,\n * and configurable shortcuts (Mod+Enter, toggle).\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockLength, getBlockText } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { CodeBlockConfig, CodeBlockKeymap } from './CodeBlockTypes.js';\n\n// --- Context Guard ---\n\ninterface CodeBlockContext {\n\treadonly state: EditorState;\n\treadonly block: BlockNode;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection and non-code-block blocks.\n * Returns false (not handled) if the cursor is not inside a code block.\n */\nfunction withCodeBlockContext(\n\tcontext: PluginContext,\n\thandler: (ctx: CodeBlockContext) => boolean,\n): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block || block.type !== 'code_block') return false;\n\n\treturn handler({\n\t\tstate,\n\t\tblock,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers all code-block keyboard handlers. */\nexport function registerCodeBlockKeymaps(\n\tcontext: PluginContext,\n\tconfig: CodeBlockConfig,\n\tresolvedKeymap: Readonly<Record<keyof CodeBlockKeymap, string | null>>,\n): void {\n\tconst keymap: Record<string, () => boolean> = {\n\t\tEnter: () => handleEnter(context),\n\t\tBackspace: () => handleBackspace(context),\n\t\tTab: () => handleTab(context, config),\n\t\t'Shift-Tab': () => handleShiftTab(context, config),\n\t\tEscape: () => handleEscape(context),\n\t\tArrowDown: () => handleArrowDown(context),\n\t\tArrowUp: () => handleArrowUp(context),\n\t\tArrowRight: () => handleArrowRight(context),\n\t\tArrowLeft: () => handleArrowLeft(context),\n\t};\n\n\tconst { insertAfter, toggle } = resolvedKeymap;\n\n\tif (insertAfter) {\n\t\tkeymap[insertAfter] = () => handleModEnter(context);\n\t}\n\tif (toggle) {\n\t\tkeymap[toggle] = () => context.executeCommand('toggleCodeBlock');\n\t}\n\n\tcontext.registerKeymap(keymap, { priority: 'context' });\n}\n\n// --- Handler Functions ---\n\nfunction handleBackspace(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ state, blockId, offset }) => {\n\t\tif (!isCollapsed(state.selection)) return false;\n\t\tif (offset !== 0) return false;\n\n\t\tconst tr: Transaction = state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(blockId, nodeType('paragraph'))\n\t\t\t.setSelection(state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ state, block, blockId, offset }) => {\n\t\tif (!isCollapsed(state.selection)) return false;\n\n\t\tconst text: string = getBlockText(block);\n\n\t\tif (text.endsWith('\\n') && offset === text.length) {\n\t\t\treturn exitOnDoubleEnter(context, blockId, text);\n\t\t}\n\n\t\tconst tr: Transaction = state\n\t\t\t.transaction('input')\n\t\t\t.insertText(blockId, offset, '\\n', [])\n\t\t\t.setSelection(createCollapsedSelection(blockId, offset + 1))\n\t\t\t.build();\n\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\nfunction handleTab(context: PluginContext, config: CodeBlockConfig): boolean {\n\treturn withCodeBlockContext(context, ({ state, blockId, offset }) => {\n\t\tconst indent: string = config.useSpaces ? ' '.repeat(config.spaceCount ?? 2) : '\\t';\n\n\t\tconst tr: Transaction = state\n\t\t\t.transaction('input')\n\t\t\t.insertText(blockId, offset, indent, [])\n\t\t\t.setSelection(createCollapsedSelection(blockId, offset + indent.length))\n\t\t\t.build();\n\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\nfunction handleShiftTab(context: PluginContext, config: CodeBlockConfig): boolean {\n\treturn withCodeBlockContext(context, ({ state, block, blockId, offset }) => {\n\t\tconst text: string = getBlockText(block);\n\t\tconst lineStart: number = text.lastIndexOf('\\n', offset - 1) + 1;\n\n\t\tif (config.useSpaces) {\n\t\t\tconst spaceCount: number = config.spaceCount ?? 2;\n\t\t\tconst linePrefix: string = text.slice(lineStart, lineStart + spaceCount);\n\t\t\tif (linePrefix === ' '.repeat(spaceCount)) {\n\t\t\t\tconst tr: Transaction = state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(blockId, lineStart, lineStart + spaceCount)\n\t\t\t\t\t.setSelection(createCollapsedSelection(blockId, Math.max(lineStart, offset - spaceCount)))\n\t\t\t\t\t.build();\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if (text[lineStart] === '\\t') {\n\t\t\tconst tr: Transaction = state\n\t\t\t\t.transaction('input')\n\t\t\t\t.deleteTextAt(blockId, lineStart, lineStart + 1)\n\t\t\t\t.setSelection(createCollapsedSelection(blockId, Math.max(lineStart, offset - 1)))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn true; // Consume event even if no dedent possible\n\t});\n}\n\n/**\n * Exits the code block to the next block or creates a new paragraph.\n * Exported for use by the `exitCodeBlock` command.\n */\nexport function handleEscape(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ state, blockId }) => {\n\t\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\t\tconst idx: number = blockOrder.indexOf(blockId);\n\n\t\tif (idx < blockOrder.length - 1) {\n\t\t\tconst nextId: BlockId = blockOrder[idx + 1] as BlockId;\n\t\t\tconst tr: Transaction = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setSelection(createCollapsedSelection(nextId, 0))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t} else {\n\t\t\tinsertParagraphAfter(context, blockId);\n\t\t}\n\n\t\treturn true;\n\t});\n}\n\nfunction handleArrowDown(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ state, block, blockId, offset }) => {\n\t\tif (!isCollapsed(state.selection)) return false;\n\n\t\tconst text: string = getBlockText(block);\n\t\tconst nextNewline: number = text.indexOf('\\n', offset);\n\t\tif (nextNewline !== -1) return false;\n\n\t\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\t\tconst idx: number = blockOrder.indexOf(blockId);\n\n\t\tif (idx < blockOrder.length - 1) {\n\t\t\tconst nextId: BlockId = blockOrder[idx + 1] as BlockId;\n\t\t\tconst tr: Transaction = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setSelection(createCollapsedSelection(nextId, 0))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t} else {\n\t\t\tinsertParagraphAfter(context, blockId);\n\t\t}\n\n\t\treturn true;\n\t});\n}\n\nfunction handleArrowUp(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ state, block, blockId, offset }) => {\n\t\tif (!isCollapsed(state.selection)) return false;\n\n\t\tconst text: string = getBlockText(block);\n\t\tconst firstNewline: number = text.indexOf('\\n');\n\t\tif (firstNewline !== -1 && offset > firstNewline) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\t\tconst idx: number = blockOrder.indexOf(blockId);\n\n\t\tif (idx > 0) {\n\t\t\tconst prevId: BlockId = blockOrder[idx - 1] as BlockId;\n\t\t\tconst prevBlock: BlockNode | undefined = state.getBlock(prevId);\n\t\t\tconst prevLen: number = prevBlock ? getBlockLength(prevBlock) : 0;\n\t\t\tconst tr: Transaction = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setSelection(createCollapsedSelection(prevId, prevLen))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t});\n}\n\nfunction handleArrowRight(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ state, block, blockId, offset }) => {\n\t\tif (!isCollapsed(state.selection)) return false;\n\n\t\tconst text: string = getBlockText(block);\n\t\tif (offset !== text.length) return false;\n\n\t\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\t\tconst idx: number = blockOrder.indexOf(blockId);\n\n\t\tif (idx < blockOrder.length - 1) {\n\t\t\tconst nextId: BlockId = blockOrder[idx + 1] as BlockId;\n\t\t\tconst tr: Transaction = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setSelection(createCollapsedSelection(nextId, 0))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t} else {\n\t\t\tinsertParagraphAfter(context, blockId);\n\t\t}\n\n\t\treturn true;\n\t});\n}\n\nfunction handleArrowLeft(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ state, blockId, offset }) => {\n\t\tif (!isCollapsed(state.selection)) return false;\n\t\tif (offset !== 0) return false;\n\n\t\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\t\tconst idx: number = blockOrder.indexOf(blockId);\n\n\t\tif (idx > 0) {\n\t\t\tconst prevId: BlockId = blockOrder[idx - 1] as BlockId;\n\t\t\tconst prevBlock: BlockNode | undefined = state.getBlock(prevId);\n\t\t\tconst prevLen: number = prevBlock ? getBlockLength(prevBlock) : 0;\n\t\t\tconst tr: Transaction = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setSelection(createCollapsedSelection(prevId, prevLen))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t});\n}\n\nfunction handleModEnter(context: PluginContext): boolean {\n\treturn withCodeBlockContext(context, ({ blockId }) => {\n\t\tinsertParagraphAfter(context, blockId);\n\t\treturn true;\n\t});\n}\n\n// --- Shared Helpers ---\n\nfunction insertParagraphAfter(context: PluginContext, bid: BlockId): void {\n\tconst state: EditorState = context.getState();\n\tconst block: BlockNode | undefined = state.getBlock(bid);\n\tif (!block) return;\n\n\tconst blockLength: number = getBlockLength(block);\n\tconst newId: BlockId = generateBlockId();\n\n\tconst tr: Transaction = state\n\t\t.transaction('command')\n\t\t.splitBlock(bid, blockLength, newId)\n\t\t.setBlockType(newId, nodeType('paragraph'))\n\t\t.setSelection(createCollapsedSelection(newId, 0))\n\t\t.build();\n\n\tcontext.dispatch(tr);\n}\n\nfunction exitOnDoubleEnter(context: PluginContext, bid: BlockId, text: string): boolean {\n\tconst state: EditorState = context.getState();\n\tconst trimmedLen: number = text.length - 1;\n\tconst newId: BlockId = generateBlockId();\n\n\tconst tr: Transaction = state\n\t\t.transaction('input')\n\t\t.deleteTextAt(bid, trimmedLen, text.length)\n\t\t.splitBlock(bid, trimmedLen, newId)\n\t\t.setBlockType(newId, nodeType('paragraph'))\n\t\t.setSelection(createCollapsedSelection(newId, 0))\n\t\t.build();\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n","/**\n * Command registration and implementations for code blocks.\n * Handles toggle, insert, exit, and mark stripping.\n */\n\nimport {\n\tcreateSelectionForBlockBoundary,\n\tcreateSelectionForDocumentBoundary,\n\textractParentPath,\n\tfindSiblingIndex,\n\tgetSiblings,\n} from '../../commands/CommandHelpers.js';\nimport type { BlockNode, ChildNode } from '../../model/Document.js';\nimport {\n\tcreateEmptyParagraph,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tgetInlineChildren,\n\tisBlockNode,\n\tisTextNode,\n} from '../../model/Document.js';\nimport { findNodePath } from '../../model/NodeResolver.js';\nimport type { EditorSelection } from '../../model/Selection.js';\nimport { createCollapsedSelection, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction, TransactionBuilder } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { handleEscape } from './CodeBlockKeyboardHandlers.js';\nimport type { CodeBlockConfig } from './CodeBlockTypes.js';\n\n/** Registers all code-block commands. */\nexport function registerCodeBlockCommands(context: PluginContext, config: CodeBlockConfig): void {\n\tcontext.registerCommand('toggleCodeBlock', () => toggleCodeBlock(context, config));\n\n\tcontext.registerCommand('insertCodeBlock', () => insertCodeBlock(context, config));\n\n\tcontext.registerCommand('setCodeBlockLanguage', () => false);\n\n\tcontext.registerCommand('setCodeBlockBackground', () => false);\n\n\tcontext.registerCommand('exitCodeBlock', () => handleEscape(context));\n\n\tcontext.registerCommand('deleteCodeBlock', () => deleteCodeBlock(context));\n}\n\n// --- Command Implementations ---\n\nfunction toggleCodeBlock(context: PluginContext, config: CodeBlockConfig): boolean {\n\tconst state = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(state.selection.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'code_block') {\n\t\tconst tr: Transaction = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(state.selection.anchor.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\treturn insertCodeBlock(context, config);\n}\n\nfunction insertCodeBlock(context: PluginContext, config: CodeBlockConfig): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block || block.type === 'code_block') return false;\n\n\tconst attrs: Record<string, string | number | boolean> = {\n\t\tlanguage: config.defaultLanguage ?? '',\n\t\tbackgroundColor: '',\n\t};\n\n\tconst builder: TransactionBuilder = state.transaction('command');\n\tstripAllMarks(builder, block);\n\tbuilder\n\t\t.setBlockType(sel.anchor.blockId, nodeType('code_block'), attrs)\n\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0));\n\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Deletes the code block at the current cursor position. */\nfunction deleteCodeBlock(context: PluginContext): boolean {\n\tconst state = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(state.selection.anchor.blockId);\n\tif (!block || block.type !== 'code_block') return false;\n\n\tconst tr: Transaction | null = createDeleteCodeBlockTransaction(state, block.id);\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Builds a transaction that removes a code block and repositions the cursor. */\nexport function createDeleteCodeBlockTransaction(\n\tstate: EditorState,\n\tblockId: BlockId,\n): Transaction | null {\n\tconst path: string[] | undefined = findNodePath(state.doc, blockId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\tconst siblings = getSiblings(state, parentPath);\n\tconst index: number = findSiblingIndex(siblings, blockId);\n\tif (index < 0) return null;\n\n\tconst builder = state.transaction('command');\n\n\tif (siblings.length === 1) {\n\t\tconst newId: BlockId = generateBlockId();\n\t\tbuilder.insertNode(parentPath, 0, createEmptyParagraph(newId));\n\t\tbuilder.removeNode(parentPath, 1);\n\t\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\t\treturn builder.build();\n\t}\n\n\tbuilder.removeNode(parentPath, index);\n\n\tconst selection: EditorSelection = resolvePostDeleteSelection(state, builder, siblings, index);\n\tbuilder.setSelection(selection);\n\treturn builder.build();\n}\n\n/**\n * Determines the cursor position after a code block has been removed.\n *\n * Fallback chain — the first successful step wins, guaranteeing the caller\n * always receives a valid selection:\n * 1. End of the previous block sibling.\n * 2. Start of the next block sibling.\n * 3. Start of any other selectable block in the document.\n * 4. A freshly inserted empty paragraph at the document root.\n */\nfunction resolvePostDeleteSelection(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tsiblings: readonly ChildNode[],\n\tremovedIndex: number,\n): EditorSelection {\n\tconst prevSibling = siblings[removedIndex - 1];\n\tif (prevSibling && isBlockNode(prevSibling)) {\n\t\tconst sel = createSelectionForBlockBoundary(state, prevSibling.id, 'end');\n\t\tif (sel) return sel;\n\t}\n\n\tconst nextSibling = siblings[removedIndex + 1];\n\tif (nextSibling && isBlockNode(nextSibling)) {\n\t\tconst sel = createSelectionForBlockBoundary(state, nextSibling.id, 'start');\n\t\tif (sel) return sel;\n\t}\n\n\tconst removed = siblings[removedIndex];\n\tconst excludeId: BlockId | undefined = removed && isBlockNode(removed) ? removed.id : undefined;\n\tconst docSel = createSelectionForDocumentBoundary(state, 'start', excludeId);\n\tif (docSel) return docSel;\n\n\tconst newId: BlockId = generateBlockId();\n\tbuilder.insertNode([], 0, createEmptyParagraph(newId));\n\treturn createCollapsedSelection(newId, 0);\n}\n\n/**\n * Strips all marks from a block's inline content.\n * Used when converting to code_block so no formatting carries over.\n */\nfunction stripAllMarks(builder: TransactionBuilder, block: BlockNode): void {\n\tconst blockLength: number = getBlockLength(block);\n\tif (blockLength === 0) return;\n\n\tconst inlineChildren = getInlineChildren(block);\n\tlet offset = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tif (isTextNode(child)) {\n\t\t\tif (child.text.length > 0) {\n\t\t\t\tfor (const mark of child.marks) {\n\t\t\t\t\tbuilder.removeMark(block.id, offset, offset + child.text.length, mark);\n\t\t\t\t}\n\t\t\t}\n\t\t\toffset += child.text.length;\n\t\t} else {\n\t\t\toffset += 1;\n\t\t}\n\t}\n}\n","/** Locale interface and default English locale for the CodeBlockPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface CodeBlockLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut?: string) => string;\n\treadonly enteredCodeBlock: string;\n\treadonly leftCodeBlock: string;\n\treadonly copyCodeAria: string;\n\treadonly escToExit: string;\n\treadonly codeBlockAriaLabel: (lang: string) => string;\n\treadonly copiedToClipboard: string;\n\treadonly copyFailed: string;\n\treadonly deleteCodeBlockAria: string;\n\treadonly deletedCodeBlock: string;\n\treadonly selectLanguageAria: string;\n\treadonly languageChanged: (lang: string) => string;\n\treadonly plainText: string;\n}\n\n// --- Default English Locale ---\n\nexport const CODE_BLOCK_LOCALE_EN: CodeBlockLocale = {\n\tlabel: 'Code Block',\n\ttooltip: (shortcut?: string) => (shortcut ? `Code Block (${shortcut})` : 'Code Block'),\n\tenteredCodeBlock: 'Entered code block. Press Escape to exit.',\n\tleftCodeBlock: 'Left code block.',\n\tcopyCodeAria: 'Copy code',\n\tescToExit: 'Esc to exit',\n\tcodeBlockAriaLabel: (lang: string) => `${lang} code block. Press Escape to exit.`,\n\tcopiedToClipboard: 'Copied to clipboard',\n\tcopyFailed: 'Failed to copy code',\n\tdeleteCodeBlockAria: 'Delete code block',\n\tdeletedCodeBlock: 'Code block deleted',\n\tselectLanguageAria: 'Select language',\n\tlanguageChanged: (lang: string) => `Language changed to ${lang}`,\n\tplainText: 'plain',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<CodeBlockLocale> = import.meta.glob<{\n\tdefault: CodeBlockLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadCodeBlockLocale(lang: string): Promise<CodeBlockLocale> {\n\treturn loadLocaleModule(localeModules, lang, CODE_BLOCK_LOCALE_EN);\n}\n","/**\n * Language picker popup for code blocks.\n * Opens a listbox dropdown anchored to the language button,\n * allowing users to select a syntax highlighting language.\n */\n\nimport { attachListboxKeyboard } from '../shared/PopupKeyboardPatterns.js';\nimport type { PopupServiceAPI } from '../shared/PopupManager.js';\nimport type { CodeBlockLocale } from './CodeBlockLocale.js';\n\n/** Configuration for opening the language picker popup. */\nexport interface LanguagePickerConfig {\n\treadonly anchor: HTMLElement;\n\treadonly languages: readonly string[];\n\treadonly currentLanguage: string;\n\treadonly onSelect: (language: string) => void;\n\treadonly popupManager: PopupServiceAPI;\n\treadonly locale: CodeBlockLocale;\n}\n\nconst OPTION_SELECTOR = '[role=\"option\"]';\n\n/** Opens a language picker popup anchored to the given element. */\nexport function openLanguagePicker(config: LanguagePickerConfig): void {\n\tconst { anchor, languages, currentLanguage, onSelect, popupManager, locale } = config;\n\n\tpopupManager.open({\n\t\tanchor,\n\t\tariaRole: 'listbox',\n\t\tariaLabel: locale.selectLanguageAria,\n\t\tclassName: 'notectl-language-picker',\n\t\tposition: 'below-start',\n\t\trestoreFocusTo: anchor,\n\t\tcontent(container, close) {\n\t\t\tconst normalizedCurrent: string = currentLanguage.toLowerCase();\n\n\t\t\t// \"plain\" option is always first\n\t\t\tappendOption(container, locale.plainText, '', normalizedCurrent === '');\n\n\t\t\t// Language options sorted alphabetically\n\t\t\tconst sorted: readonly string[] = [...languages].sort((a, b) => a.localeCompare(b));\n\t\t\tfor (const lang of sorted) {\n\t\t\t\tappendOption(container, lang, lang, normalizedCurrent === lang.toLowerCase());\n\t\t\t}\n\n\t\t\tattachListboxKeyboard({\n\t\t\t\tcontainer,\n\t\t\t\titemSelector: OPTION_SELECTOR,\n\t\t\t\tonSelect(item) {\n\t\t\t\t\tconst value: string = item.getAttribute('data-language') ?? '';\n\t\t\t\t\tonSelect(value);\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t\tonClose() {\n\t\t\t\t\tclose();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tcontainer.addEventListener('click', (e: Event) => {\n\t\t\t\tconst target: HTMLElement | null = (e.target as HTMLElement).closest(OPTION_SELECTOR);\n\t\t\t\tif (!target) return;\n\t\t\t\tconst value: string = target.getAttribute('data-language') ?? '';\n\t\t\t\tonSelect(value);\n\t\t\t\tclose();\n\t\t\t});\n\t\t},\n\t\tonClose() {\n\t\t\tanchor.setAttribute('aria-expanded', 'false');\n\t\t},\n\t});\n\n\tanchor.setAttribute('aria-expanded', 'true');\n}\n\nfunction appendOption(\n\tcontainer: HTMLElement,\n\tlabel: string,\n\tvalue: string,\n\tselected: boolean,\n): void {\n\tconst option: HTMLDivElement = document.createElement('div');\n\toption.className = 'notectl-language-picker__option';\n\toption.setAttribute('role', 'option');\n\toption.setAttribute('data-language', value);\n\toption.setAttribute('aria-selected', String(selected));\n\toption.setAttribute('tabindex', selected ? '0' : '-1');\n\toption.textContent = label;\n\tcontainer.appendChild(option);\n}\n","/**\n * NodeView factory for code blocks.\n * Renders <pre> with a non-editable header (language label + action buttons)\n * and a <code> content area where the Reconciler renders text.\n */\n\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport { getBlockText } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { NodeView, NodeViewFactory } from '../../view/NodeView.js';\nimport type { PopupServiceAPI } from '../shared/PopupManager.js';\nimport { createDeleteCodeBlockTransaction } from './CodeBlockCommands.js';\nimport { CODE_BLOCK_LOCALE_EN, type CodeBlockLocale } from './CodeBlockLocale.js';\nimport type { CodeBlockConfig } from './CodeBlockTypes.js';\nimport { openLanguagePicker } from './LanguagePicker.js';\n\n/** Dependencies for the language picker in the code block header. */\nexport interface LanguagePickerDeps {\n\treadonly popupManager: PopupServiceAPI;\n\treadonly getSupportedLanguages: () => readonly string[];\n}\n\nconst COPY_ICON =\n\t'<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>';\n\nconst DELETE_ICON =\n\t'<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>';\n\nconst CHEVRON_ICON =\n\t'<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>';\n\n/**\n * Copies text to the clipboard, rejecting when the Clipboard API is unavailable\n * (e.g. insecure context, missing permissions) or when the write itself fails.\n * Callers must handle rejection to give the user accurate feedback.\n */\nexport function copyTextToClipboard(text: string): Promise<void> {\n\tconst clipboard: Clipboard | undefined = globalThis.navigator?.clipboard;\n\tif (!clipboard || typeof clipboard.writeText !== 'function') {\n\t\treturn Promise.reject(new Error('Clipboard API unavailable'));\n\t}\n\treturn clipboard.writeText(text);\n}\n\n/** Creates a NodeViewFactory for code_block nodes. */\nexport function createCodeBlockNodeViewFactory(\n\tconfig: CodeBlockConfig,\n\tlocale: CodeBlockLocale = CODE_BLOCK_LOCALE_EN,\n\tpickerDeps?: LanguagePickerDeps,\n): NodeViewFactory {\n\treturn (\n\t\tnode: BlockNode,\n\t\tgetState: () => EditorState,\n\t\tdispatch: (tr: Transaction) => void,\n\t): NodeView => {\n\t\t// --- DOM Construction ---\n\t\tconst pre: HTMLElement = document.createElement('pre');\n\t\tpre.className = 'notectl-code-block';\n\t\tpre.setAttribute('data-block-id', node.id);\n\t\tpre.setAttribute('dir', 'ltr');\n\t\tpre.setAttribute('role', 'group');\n\t\tpre.setAttribute('aria-roledescription', 'code block');\n\n\t\t// Header (non-editable)\n\t\tconst header: HTMLDivElement = document.createElement('div');\n\t\theader.className = 'notectl-code-block__header';\n\t\theader.setAttribute('contenteditable', 'false');\n\n\t\tconst langBtn: HTMLButtonElement = document.createElement('button');\n\t\tlangBtn.className = 'notectl-code-block__language-btn';\n\t\tlangBtn.type = 'button';\n\t\tlangBtn.setAttribute('aria-haspopup', 'listbox');\n\t\tlangBtn.setAttribute('aria-expanded', 'false');\n\t\tlangBtn.setAttribute('aria-label', locale.selectLanguageAria);\n\n\t\tconst showCopy: boolean = config.showCopyButton !== false;\n\t\tlet copyBtn: HTMLButtonElement | null = null;\n\n\t\tif (showCopy) {\n\t\t\tcopyBtn = document.createElement('button');\n\t\t\tcopyBtn.className = 'notectl-code-block__copy';\n\t\t\tcopyBtn.setAttribute('aria-label', locale.copyCodeAria);\n\t\t\tcopyBtn.setAttribute('data-notectl-no-print', '');\n\t\t\tcopyBtn.type = 'button';\n\t\t\tcopyBtn.innerHTML = COPY_ICON;\n\t\t}\n\n\t\t// Delete button\n\t\tconst deleteBtn: HTMLButtonElement = document.createElement('button');\n\t\tdeleteBtn.className = 'notectl-code-block__delete';\n\t\tdeleteBtn.setAttribute('aria-label', locale.deleteCodeBlockAria);\n\t\tdeleteBtn.title = locale.deleteCodeBlockAria;\n\t\tdeleteBtn.setAttribute('data-notectl-no-print', '');\n\t\tdeleteBtn.type = 'button';\n\t\tdeleteBtn.innerHTML = DELETE_ICON;\n\n\t\t// Screen reader live region for action feedback\n\t\tconst announcer: HTMLSpanElement = document.createElement('span');\n\t\tannouncer.className = 'notectl-sr-only';\n\t\tannouncer.setAttribute('aria-live', 'assertive');\n\t\tannouncer.setAttribute('aria-atomic', 'true');\n\n\t\t// Actions wrapper groups buttons on the right side\n\t\tconst actions: HTMLDivElement = document.createElement('div');\n\t\tactions.className = 'notectl-code-block__actions';\n\t\tif (copyBtn) {\n\t\t\tactions.appendChild(copyBtn);\n\t\t}\n\t\tactions.appendChild(deleteBtn);\n\n\t\theader.appendChild(langBtn);\n\t\theader.appendChild(actions);\n\t\theader.appendChild(announcer);\n\n\t\t// Content area (Reconciler target)\n\t\tconst code: HTMLElement = document.createElement('code');\n\t\tcode.className = 'notectl-code-block__content';\n\n\t\t// Escape hint (visible only when focused, CSS-driven)\n\t\tconst escHint: HTMLDivElement = document.createElement('div');\n\t\tescHint.className = 'notectl-code-block__esc-hint';\n\t\tescHint.setAttribute('contenteditable', 'false');\n\t\tescHint.setAttribute('aria-hidden', 'true');\n\t\tescHint.setAttribute('data-notectl-no-print', '');\n\t\tescHint.textContent = locale.escToExit;\n\n\t\tpre.appendChild(header);\n\t\tpre.appendChild(code);\n\t\tpre.appendChild(escHint);\n\n\t\t// Apply config-level color overrides as CSS custom properties\n\t\tif (config.background) {\n\t\t\tsetStyleProperty(pre, '--notectl-code-block-bg', config.background);\n\t\t}\n\t\tif (config.headerBackground) {\n\t\t\tsetStyleProperty(pre, '--notectl-code-block-header-bg', config.headerBackground);\n\t\t}\n\t\tif (config.textColor) {\n\t\t\tsetStyleProperty(pre, '--notectl-code-block-color', config.textColor);\n\t\t}\n\t\tif (config.headerColor) {\n\t\t\tsetStyleProperty(pre, '--notectl-code-block-header-color', config.headerColor);\n\t\t}\n\n\t\tlet currentNodeId: BlockId = node.id;\n\n\t\t// --- Attribute Application ---\n\n\t\tfunction applyAttrs(n: BlockNode): void {\n\t\t\tconst lang: string = (n.attrs?.language as string) ?? '';\n\t\t\tconst langName: string = lang || locale.plainText;\n\t\t\tlangBtn.innerHTML = '';\n\t\t\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\t\t\tlabelSpan.className = 'notectl-code-block__language';\n\t\t\tlabelSpan.textContent = langName;\n\t\t\tlangBtn.appendChild(labelSpan);\n\t\t\tif (pickerDeps) {\n\t\t\t\tconst chevron: HTMLSpanElement = document.createElement('span');\n\t\t\t\tchevron.className = 'notectl-code-block__chevron';\n\t\t\t\tchevron.innerHTML = CHEVRON_ICON;\n\t\t\t\tlangBtn.appendChild(chevron);\n\t\t\t}\n\t\t\tpre.setAttribute('aria-label', locale.codeBlockAriaLabel(langName));\n\n\t\t\tif (lang) {\n\t\t\t\tcode.setAttribute('data-language', lang);\n\t\t\t} else {\n\t\t\t\tcode.removeAttribute('data-language');\n\t\t\t}\n\n\t\t\tconst bg: string = (n.attrs?.backgroundColor as string) ?? '';\n\t\t\tsetStyleProperty(pre, 'backgroundColor', bg || '');\n\t\t}\n\n\t\tapplyAttrs(node);\n\n\t\t// --- Copy Button Handler ---\n\n\t\tfunction announce(message: string): void {\n\t\t\tannouncer.textContent = message;\n\t\t\tsetTimeout(() => {\n\t\t\t\tannouncer.textContent = '';\n\t\t\t}, 1000);\n\t\t}\n\n\t\tif (copyBtn) {\n\t\t\tcopyBtn.addEventListener('click', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\n\t\t\t\tconst state: EditorState = getState();\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(currentNodeId);\n\t\t\t\tif (!block) return;\n\n\t\t\t\tconst text: string = getBlockText(block);\n\t\t\t\tcopyTextToClipboard(text).then(\n\t\t\t\t\t() => announce(locale.copiedToClipboard),\n\t\t\t\t\t() => announce(locale.copyFailed),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t// --- Delete Button Handler ---\n\n\t\tdeleteBtn.addEventListener('click', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\n\t\t\tconst state: EditorState = getState();\n\t\t\tconst tr: Transaction | null = createDeleteCodeBlockTransaction(state, currentNodeId);\n\t\t\tif (!tr) return;\n\n\t\t\tannouncer.textContent = locale.deletedCodeBlock;\n\t\t\tdispatch(tr);\n\t\t});\n\n\t\t// --- Language Picker Handler ---\n\n\t\tif (pickerDeps) {\n\t\t\tlangBtn.addEventListener('click', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\n\t\t\t\tconst state: EditorState = getState();\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(currentNodeId);\n\t\t\t\tif (!block) return;\n\n\t\t\t\tconst currentLang: string = (block.attrs?.language as string) ?? '';\n\t\t\t\topenLanguagePicker({\n\t\t\t\t\tanchor: langBtn,\n\t\t\t\t\tlanguages: pickerDeps.getSupportedLanguages(),\n\t\t\t\t\tcurrentLanguage: currentLang,\n\t\t\t\t\tlocale,\n\t\t\t\t\tpopupManager: pickerDeps.popupManager,\n\t\t\t\t\tonSelect(language: string) {\n\t\t\t\t\t\tif (language === currentLang) return;\n\n\t\t\t\t\t\tconst latest: EditorState = getState();\n\t\t\t\t\t\tconst latestBlock: BlockNode | undefined = latest.getBlock(currentNodeId);\n\t\t\t\t\t\tif (!latestBlock) return;\n\n\t\t\t\t\t\tconst path: BlockId[] | undefined = latest.getNodePath(currentNodeId);\n\t\t\t\t\t\tif (!path) return;\n\n\t\t\t\t\t\tconst newAttrs: BlockAttrs = { ...latestBlock.attrs, language };\n\t\t\t\t\t\tconst tr: Transaction = latest\n\t\t\t\t\t\t\t.transaction('command')\n\t\t\t\t\t\t\t.setNodeAttr(path, newAttrs)\n\t\t\t\t\t\t\t.build();\n\t\t\t\t\t\tdispatch(tr);\n\n\t\t\t\t\t\tconst langName: string = language || locale.plainText;\n\t\t\t\t\t\tannouncer.textContent = locale.languageChanged(langName);\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tannouncer.textContent = '';\n\t\t\t\t\t\t}, 1000);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t// --- NodeView Interface ---\n\n\t\treturn {\n\t\t\tdom: pre,\n\t\t\tcontentDOM: code,\n\n\t\t\tupdate(updatedNode: BlockNode): boolean {\n\t\t\t\tif (updatedNode.type !== 'code_block') return false;\n\t\t\t\tcurrentNodeId = updatedNode.id;\n\t\t\t\tpre.setAttribute('data-block-id', updatedNode.id);\n\t\t\t\tapplyAttrs(updatedNode);\n\t\t\t\treturn true;\n\t\t\t},\n\n\t\t\tselectNode(): void {\n\t\t\t\tpre.classList.add('notectl-code-block--selected');\n\t\t\t},\n\n\t\t\tdeselectNode(): void {\n\t\t\t\tpre.classList.remove('notectl-code-block--selected');\n\t\t\t},\n\n\t\t\tdestroy(): void {\n\t\t\t\t// No cleanup needed\n\t\t\t},\n\t\t};\n\t};\n}\n","/**\n * Types, interfaces, and constants for the code-block plugin.\n */\n\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { ServiceKey } from '../Plugin.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tcode_block: {\n\t\t\tlanguage: string;\n\t\t\tbackgroundColor: string;\n\t\t};\n\t}\n}\n\n// --- Syntax Highlighting Types ---\n\nimport type { SyntaxTokenType } from '../../editor/theme/SyntaxTokenTypes.js';\n\nexport interface SyntaxToken {\n\treadonly from: number;\n\treadonly to: number;\n\treadonly type: SyntaxTokenType | (string & {});\n}\n\nexport interface SyntaxHighlighter {\n\ttokenize(code: string, language: string): readonly SyntaxToken[];\n\tgetSupportedLanguages(): readonly string[];\n\tregisterLanguage?(def: import('./highlighter/TokenizerTypes.js').LanguageDefinition): void;\n}\n\n// --- Configuration ---\n\n/**\n * Configurable keyboard bindings for CodeBlockPlugin actions.\n * Omit a slot to use the default; set to `null` to disable the binding.\n *\n * Key descriptor format: `'Mod-Enter'`, `'Mod-Shift-M'`, etc.\n * `Mod` resolves to Cmd on macOS, Ctrl on Windows/Linux.\n */\nexport interface CodeBlockKeymap {\n\t/**\n\t * Insert a new paragraph below the code block and move the cursor there.\n\t * @default 'Mod-Enter'\n\t */\n\treadonly insertAfter?: string | null;\n\n\t/**\n\t * Toggle the current block between code block and paragraph.\n\t * @default 'Mod-Shift-M'\n\t */\n\treadonly toggle?: string | null;\n}\n\nexport const DEFAULT_KEYMAP: Readonly<Record<keyof CodeBlockKeymap, string>> = {\n\tinsertAfter: 'Mod-Enter',\n\ttoggle: 'Mod-Shift-M',\n};\n\nexport interface CodeBlockConfig {\n\treadonly highlighter?: SyntaxHighlighter;\n\treadonly defaultLanguage?: string;\n\treadonly useSpaces?: boolean;\n\treadonly spaceCount?: number;\n\treadonly showCopyButton?: boolean;\n\t/** Default body background color (overrides --notectl-code-block-bg). */\n\treadonly background?: string;\n\t/** Default header background color (overrides --notectl-code-block-header-bg). */\n\treadonly headerBackground?: string;\n\t/** Default text color (overrides --notectl-code-block-color). */\n\treadonly textColor?: string;\n\t/** Default header/label text color (overrides --notectl-code-block-header-color). */\n\treadonly headerColor?: string;\n\t/** Customize keyboard bindings for code block actions. */\n\treadonly keymap?: CodeBlockKeymap;\n\t/** Locale override for user-facing strings. */\n\treadonly locale?: import('./CodeBlockLocale.js').CodeBlockLocale;\n}\n\nexport const DEFAULT_CONFIG: CodeBlockConfig = {\n\tdefaultLanguage: '',\n\tuseSpaces: false,\n\tspaceCount: 2,\n\tshowCopyButton: true,\n};\n\n// --- Service Types ---\n\nexport interface CodeBlockService {\n\tsetLanguage(blockId: BlockId, language: string): void;\n\tgetLanguage(blockId: BlockId): string;\n\tsetBackground(blockId: BlockId, color: string): void;\n\tgetBackground(blockId: BlockId): string;\n\tisCodeBlock(blockId: BlockId): boolean;\n\tgetSupportedLanguages(): readonly string[];\n}\n\nexport const CODE_BLOCK_SERVICE_KEY = new ServiceKey<CodeBlockService>('codeBlock');\n\n// --- Syntax Highlighter Service ---\n\nexport interface SyntaxHighlighterService {\n\tregisterLanguage(def: import('./highlighter/TokenizerTypes.js').LanguageDefinition): void;\n\tgetSupportedLanguages(): readonly string[];\n\ttokenize(code: string, language: string): readonly SyntaxToken[];\n}\n\nexport const SYNTAX_HIGHLIGHTER_SERVICE_KEY = new ServiceKey<SyntaxHighlighterService>(\n\t'syntaxHighlighter',\n);\n\n// --- SVG Icon ---\n\nexport const CODE_BLOCK_ICON =\n\t'<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>';\n","/**\n * Service API for code blocks.\n * Provides language/background getters and setters.\n */\n\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { SyntaxHighlighter } from './CodeBlockTypes.js';\nimport { CODE_BLOCK_SERVICE_KEY } from './CodeBlockTypes.js';\n\n/** Registers the CodeBlockService on the given context. */\nexport function registerCodeBlockService(\n\tcontext: PluginContext,\n\tgetHighlighter: () => SyntaxHighlighter | null,\n\tgetContext: () => PluginContext | null,\n): void {\n\tcontext.registerService(CODE_BLOCK_SERVICE_KEY, {\n\t\tsetLanguage(bid: BlockId, language: string): void {\n\t\t\tsetAttr(context, bid, 'language', language);\n\t\t},\n\n\t\tgetLanguage(bid: BlockId): string {\n\t\t\tconst ctx: PluginContext | null = getContext();\n\t\t\tif (!ctx) return '';\n\t\t\tconst block: BlockNode | undefined = ctx.getState().getBlock(bid);\n\t\t\tif (!block || block.type !== 'code_block') return '';\n\t\t\treturn (block.attrs?.language as string) ?? '';\n\t\t},\n\n\t\tsetBackground(bid: BlockId, color: string): void {\n\t\t\tsetAttr(context, bid, 'backgroundColor', color);\n\t\t},\n\n\t\tgetBackground(bid: BlockId): string {\n\t\t\tconst ctx: PluginContext | null = getContext();\n\t\t\tif (!ctx) return '';\n\t\t\tconst block: BlockNode | undefined = ctx.getState().getBlock(bid);\n\t\t\tif (!block || block.type !== 'code_block') return '';\n\t\t\treturn (block.attrs?.backgroundColor as string) ?? '';\n\t\t},\n\n\t\tisCodeBlock(bid: BlockId): boolean {\n\t\t\tconst ctx: PluginContext | null = getContext();\n\t\t\tif (!ctx) return false;\n\t\t\tconst block: BlockNode | undefined = ctx.getState().getBlock(bid);\n\t\t\treturn block?.type === 'code_block';\n\t\t},\n\n\t\tgetSupportedLanguages(): readonly string[] {\n\t\t\tconst highlighter: SyntaxHighlighter | null = getHighlighter();\n\t\t\tif (!highlighter) return [];\n\t\t\treturn highlighter.getSupportedLanguages();\n\t\t},\n\t});\n}\n\n// --- Helper ---\n\nfunction setAttr(context: PluginContext, bid: BlockId, key: string, value: string): void {\n\tconst state = context.getState();\n\tconst block: BlockNode | undefined = state.getBlock(bid);\n\tif (!block || block.type !== 'code_block') return;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(bid);\n\tif (!path) return;\n\n\tconst newAttrs: BlockAttrs = { ...block.attrs, [key]: value };\n\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, newAttrs).build();\n\n\tcontext.dispatch(tr);\n}\n","/**\n * Regex-based syntax tokenizer.\n * Implements the SyntaxHighlighter interface using linear regex scanning\n * with sticky (`y`-flagged) regexes to avoid O(n) substring allocations per position.\n */\n\nimport type { SyntaxHighlighter, SyntaxToken } from '../CodeBlockTypes.js';\nimport type { LanguageDefinition } from './TokenizerTypes.js';\n\nexport class RegexTokenizer implements SyntaxHighlighter {\n\tprivate readonly languageMap = new Map<string, LanguageDefinition>();\n\n\tconstructor(languages?: readonly LanguageDefinition[]) {\n\t\tif (languages) {\n\t\t\tfor (const lang of languages) {\n\t\t\t\tthis.registerLanguageInternal(lang);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Registers a language definition. Overwrites existing definitions for the same name/aliases. */\n\tregisterLanguage(def: LanguageDefinition): void {\n\t\tthis.registerLanguageInternal(def);\n\t}\n\n\t/** Tokenizes code using the specified language. Returns empty array for unknown languages. */\n\ttokenize(code: string, language: string): readonly SyntaxToken[] {\n\t\tconst lang: LanguageDefinition | undefined = this.languageMap.get(language.toLowerCase());\n\t\tif (!lang) return [];\n\n\t\tconst tokens: SyntaxToken[] = [];\n\t\tlet pos = 0;\n\n\t\twhile (pos < code.length) {\n\t\t\tlet matched = false;\n\n\t\t\tfor (const pattern of lang.patterns) {\n\t\t\t\tpattern.pattern.lastIndex = pos;\n\t\t\t\tconst match: RegExpExecArray | null = pattern.pattern.exec(code);\n\t\t\t\tif (match && match.index === pos && match[0].length > 0) {\n\t\t\t\t\ttokens.push({\n\t\t\t\t\t\tfrom: pos,\n\t\t\t\t\t\tto: pos + match[0].length,\n\t\t\t\t\t\ttype: pattern.type,\n\t\t\t\t\t});\n\t\t\t\t\tpos += match[0].length;\n\t\t\t\t\tmatched = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!matched) {\n\t\t\t\tpos++;\n\t\t\t}\n\t\t}\n\n\t\treturn tokens;\n\t}\n\n\t/** Returns all registered language names and aliases. */\n\tgetSupportedLanguages(): readonly string[] {\n\t\tconst names = new Set<string>();\n\t\tfor (const lang of this.languageMap.values()) {\n\t\t\tnames.add(lang.name);\n\t\t\tfor (const alias of lang.aliases) {\n\t\t\t\tnames.add(alias);\n\t\t\t}\n\t\t}\n\t\treturn [...names];\n\t}\n\n\tprivate registerLanguageInternal(def: LanguageDefinition): void {\n\t\tthis.languageMap.set(def.name.toLowerCase(), def);\n\t\tfor (const alias of def.aliases) {\n\t\t\tthis.languageMap.set(alias.toLowerCase(), def);\n\t\t}\n\t}\n}\n","/**\n * CodeBlockPlugin: orchestrates code block registration by delegating to\n * focused modules for keyboard handling, commands, and service API.\n *\n * Inline responsibilities: NodeSpec, NodeView, InputRule, Toolbar,\n * Middleware, Decorations, and lifecycle hooks (focus tracking).\n */\n\nimport { addDeleteSelectionSteps } from '../../commands/Commands.js';\nimport type { Decoration, DecorationSet } from '../../decorations/Decoration.js';\nimport {\n\tinline as inlineDecoration,\n\tnode as nodeDecoration,\n} from '../../decorations/Decoration.js';\nimport { DecorationSet as DecorationSetClass } from '../../decorations/Decoration.js';\nimport { CODE_BLOCK_CSS } from '../../editor/styles/code-block.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { getBlockText } from '../../model/Document.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport type { HTMLExportContext } from '../../model/NodeSpec.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { PasteInterceptor, Plugin, PluginContext } from '../Plugin.js';\nimport { LanguageRegistry } from '../language/LanguageRegistry.js';\nimport { LANGUAGE_REGISTRY_SERVICE_KEY } from '../language/LanguageTypes.js';\nimport { JAVA_SUPPORT, JSON_SUPPORT, XML_SUPPORT } from '../language/bundles/index.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { PopupManager } from '../shared/PopupManager.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { registerCodeBlockCommands } from './CodeBlockCommands.js';\nimport { registerCodeBlockKeymaps } from './CodeBlockKeyboardHandlers.js';\nimport {\n\tCODE_BLOCK_LOCALE_EN,\n\ttype CodeBlockLocale,\n\tloadCodeBlockLocale,\n} from './CodeBlockLocale.js';\nimport { type LanguagePickerDeps, createCodeBlockNodeViewFactory } from './CodeBlockNodeView.js';\nimport { registerCodeBlockService } from './CodeBlockService.js';\nimport type {\n\tCodeBlockConfig,\n\tCodeBlockKeymap,\n\tSyntaxHighlighter,\n\tSyntaxToken,\n} from './CodeBlockTypes.js';\nimport {\n\tCODE_BLOCK_ICON,\n\tDEFAULT_CONFIG,\n\tDEFAULT_KEYMAP,\n\tSYNTAX_HIGHLIGHTER_SERVICE_KEY,\n} from './CodeBlockTypes.js';\nimport { RegexTokenizer } from './highlighter/RegexTokenizer.js';\n\nexport class CodeBlockPlugin implements Plugin {\n\treadonly id = 'code-block';\n\treadonly name = 'Code Block';\n\treadonly priority = 36;\n\n\tprivate readonly config: CodeBlockConfig;\n\tprivate readonly resolvedKeymap: Readonly<Record<keyof CodeBlockKeymap, string | null>>;\n\tprivate context: PluginContext | null = null;\n\tprivate locale!: CodeBlockLocale;\n\tprivate highlighter: SyntaxHighlighter | null = null;\n\tprivate readonly languageRegistry = new LanguageRegistry();\n\tprivate readonly tokenCache = new Map<\n\t\tBlockId,\n\t\t{\n\t\t\treadonly text: string;\n\t\t\treadonly language: string;\n\t\t\treadonly tokens: readonly SyntaxToken[];\n\t\t}\n\t>();\n\n\tconstructor(config?: Partial<CodeBlockConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t\tthis.resolvedKeymap = {\n\t\t\t...DEFAULT_KEYMAP,\n\t\t\t...config?.keymap,\n\t\t};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tCODE_BLOCK_LOCALE_EN,\n\t\t\tloadCodeBlockLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(CODE_BLOCK_CSS);\n\t\tthis.context = context;\n\n\t\tthis.initHighlighter();\n\t\tthis.registerLanguageRegistry(context);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerNodeView(context);\n\t\tregisterCodeBlockCommands(context, this.config);\n\t\tregisterCodeBlockKeymaps(context, this.config, this.resolvedKeymap);\n\t\tthis.registerInputRule(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.registerMiddleware(context);\n\t\tregisterCodeBlockService(\n\t\t\tcontext,\n\t\t\t() => this.highlighter,\n\t\t\t() => this.context,\n\t\t);\n\t\tthis.registerSyntaxHighlighterService(context);\n\t\tthis.registerPasteInterceptor(context);\n\t\tthis.patchTableCellContent(context);\n\t}\n\n\tdestroy(): void {\n\t\tthis.context = null;\n\t\tthis.highlighter = null;\n\t\tthis.tokenCache.clear();\n\t}\n\n\tonStateChange(oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tif (!this.context) return;\n\n\t\tconst oldBlockId: BlockId | null = !isTextSelection(oldState.selection)\n\t\t\t? null\n\t\t\t: oldState.selection.anchor.blockId;\n\t\tconst newBlockId: BlockId | null = !isTextSelection(newState.selection)\n\t\t\t? null\n\t\t\t: newState.selection.anchor.blockId;\n\n\t\tconst oldBlock: BlockNode | undefined = oldBlockId ? oldState.getBlock(oldBlockId) : undefined;\n\t\tconst newBlock: BlockNode | undefined = newBlockId ? newState.getBlock(newBlockId) : undefined;\n\n\t\tconst wasInCode: boolean = oldBlock?.type === 'code_block';\n\t\tconst nowInCode: boolean = newBlock?.type === 'code_block';\n\n\t\tif (!wasInCode && nowInCode) {\n\t\t\tthis.context.announce(this.locale.enteredCodeBlock);\n\t\t} else if (wasInCode && !nowInCode) {\n\t\t\tthis.context.announce(this.locale.leftCodeBlock);\n\t\t}\n\t}\n\n\tdecorations(state: EditorState): DecorationSet {\n\t\tconst decorations: Decoration[] = [];\n\n\t\tconst focusedBlockId: BlockId | null = this.getFocusedCodeBlockId(state);\n\t\tif (focusedBlockId) {\n\t\t\tdecorations.push(nodeDecoration(focusedBlockId, { class: 'notectl-code-block--focused' }));\n\t\t}\n\n\t\tif (this.highlighter) {\n\t\t\tconst activeBlockIds = new Set<BlockId>();\n\t\t\tfor (const bid of state.getBlockOrder()) {\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(bid);\n\t\t\t\tif (!block || block.type !== 'code_block') continue;\n\n\t\t\t\tconst lang: string = (block.attrs?.language as string) ?? '';\n\t\t\t\tif (!lang) continue;\n\n\t\t\t\tconst text: string = getBlockText(block);\n\t\t\t\tif (!text) continue;\n\n\t\t\t\tactiveBlockIds.add(bid);\n\t\t\t\tconst tokens: readonly SyntaxToken[] = this.getCachedTokens(bid, text, lang);\n\t\t\t\tfor (const token of tokens) {\n\t\t\t\t\tdecorations.push(\n\t\t\t\t\t\tinlineDecoration(bid, token.from, token.to, {\n\t\t\t\t\t\t\tclass: `notectl-token--${token.type}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Purge stale cache entries\n\t\t\tfor (const cachedId of this.tokenCache.keys()) {\n\t\t\t\tif (!activeBlockIds.has(cachedId)) {\n\t\t\t\t\tthis.tokenCache.delete(cachedId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (decorations.length === 0) return DecorationSetClass.empty;\n\t\treturn DecorationSetClass.create(decorations);\n\t}\n\n\t// --- NodeSpec ---\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'code_block',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\tselectable: true,\n\t\t\tattrs: {\n\t\t\t\tlanguage: { default: '' },\n\t\t\t\tbackgroundColor: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst pre: HTMLElement = createBlockElement('pre', node.id);\n\t\t\t\tpre.className = 'notectl-code-block';\n\t\t\t\tpre.setAttribute('dir', 'ltr');\n\t\t\t\tconst code: HTMLElement = document.createElement('code');\n\t\t\t\tcode.className = 'notectl-code-block__content';\n\t\t\t\tpre.appendChild(code);\n\t\t\t\treturn pre;\n\t\t\t},\n\t\t\ttoHTML(node, content, ctx?: HTMLExportContext) {\n\t\t\t\tconst lang: string = escapeHTML((node.attrs?.language as string) ?? '');\n\t\t\t\tconst bg: string = escapeHTML((node.attrs?.backgroundColor as string) ?? '');\n\t\t\t\tconst langClass: string = lang ? ` class=\"language-${lang}\"` : '';\n\t\t\t\tconst bgAttr: string = bg\n\t\t\t\t\t? (ctx?.styleAttr(`background-color: ${bg}`) ?? ` style=\"background-color: ${bg}\"`)\n\t\t\t\t\t: '';\n\t\t\t\treturn `<pre dir=\"ltr\"${bgAttr}><code${langClass}>${content || ''}</code></pre>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'pre',\n\t\t\t\t\tgetAttrs(el: HTMLElement) {\n\t\t\t\t\t\tconst code: HTMLElement | null = el.querySelector('code');\n\t\t\t\t\t\tconst langClass: string = code?.className.match(/language-(\\S+)/)?.[1] ?? '';\n\t\t\t\t\t\tconst dataLang: string = code?.getAttribute('data-language') ?? '';\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tlanguage: dataLang || langClass,\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['pre', 'code'],\n\t\t\t\tattrs: ['data-language', 'class', 'style'],\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- NodeView ---\n\n\tprivate registerNodeView(context: PluginContext): void {\n\t\tconst popupManager: PopupManager = new PopupManager(context.getContainer());\n\t\tconst highlighter = this.highlighter;\n\t\tconst pickerDeps: LanguagePickerDeps = {\n\t\t\tpopupManager,\n\t\t\tgetSupportedLanguages: () => highlighter?.getSupportedLanguages() ?? [],\n\t\t};\n\n\t\tcontext.registerNodeView(\n\t\t\t'code_block',\n\t\t\tcreateCodeBlockNodeViewFactory(this.config, this.locale, pickerDeps),\n\t\t);\n\t}\n\n\t// --- Input Rule ---\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: /^```(\\w*) $/,\n\t\t\thandler: (state, match, start, _end) => {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\tconst language: string = match[1] ?? '';\n\t\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t\tlanguage,\n\t\t\t\t\tbackgroundColor: '',\n\t\t\t\t};\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + match[0].length)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('code_block'), attrs)\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'code_block',\n\t\t\tgroup: 'block',\n\t\t\ticon: CODE_BLOCK_ICON,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(\n\t\t\t\tthis.resolvedKeymap.toggle ? formatShortcut(this.resolvedKeymap.toggle) : undefined,\n\t\t\t),\n\t\t\tcommand: 'toggleCodeBlock',\n\t\t\tisActive: (state) => {\n\t\t\t\tif (!isTextSelection(state.selection)) return false;\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(state.selection.anchor.blockId);\n\t\t\t\treturn block?.type === 'code_block';\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Middleware (Mark Prevention) ---\n\n\tprivate registerMiddleware(context: PluginContext): void {\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, state, next) => {\n\t\t\t\tconst hasMarkInCodeBlock: boolean = tr.steps.some((step) => {\n\t\t\t\t\tif (step.type !== 'addMark') return false;\n\t\t\t\t\tconst block: BlockNode | undefined = state.getBlock(step.blockId);\n\t\t\t\t\treturn block?.type === 'code_block';\n\t\t\t\t});\n\n\t\t\t\tif (!hasMarkInCodeBlock) {\n\t\t\t\t\tnext(tr);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst filtered = tr.steps.filter((step) => {\n\t\t\t\t\tif (step.type !== 'addMark') return true;\n\t\t\t\t\tconst block: BlockNode | undefined = state.getBlock(step.blockId);\n\t\t\t\t\treturn block?.type !== 'code_block';\n\t\t\t\t});\n\n\t\t\t\tnext({ ...tr, steps: filtered });\n\t\t\t},\n\t\t\t{ name: 'code-block:mark-guard', priority: 50 },\n\t\t);\n\t}\n\n\t// --- Paste Interceptor ---\n\n\tprivate registerPasteInterceptor(context: PluginContext): void {\n\t\tcontext.registerPasteInterceptor(this.handleCodeBlockPaste, {\n\t\t\tname: 'code-block:paste',\n\t\t\tpriority: 10,\n\t\t});\n\t}\n\n\tprivate readonly handleCodeBlockPaste: PasteInterceptor = (\n\t\tplainText: string,\n\t\t_html: string,\n\t\tstate: EditorState,\n\t): Transaction | null => {\n\t\tif (!plainText) return null;\n\t\tif (!isTextSelection(state.selection)) return null;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block || block.type !== 'code_block') return null;\n\n\t\tconst builder = state.transaction('paste');\n\n\t\tlet insertBlockId: BlockId = state.selection.anchor.blockId;\n\t\tlet insertOffset: number = state.selection.anchor.offset;\n\n\t\tif (!isCollapsed(state.selection)) {\n\t\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\t\tif (landingId) {\n\t\t\t\tinsertBlockId = landingId;\n\t\t\t\tinsertOffset = 0;\n\t\t\t}\n\t\t}\n\n\t\tbuilder.insertText(insertBlockId, insertOffset, plainText, []);\n\t\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + plainText.length));\n\n\t\treturn builder.build();\n\t};\n\n\t// --- Table Cell Patching ---\n\n\tprivate patchTableCellContent(context: PluginContext): void {\n\t\tconst registry = context.getSchemaRegistry();\n\t\tconst cellSpec = registry.getNodeSpec('table_cell');\n\t\tif (!cellSpec?.content) return;\n\n\t\tconst currentAllow: readonly string[] = cellSpec.content.allow ?? [];\n\t\tif (currentAllow.includes('code_block')) return;\n\n\t\tregistry.removeNodeSpec('table_cell');\n\t\tregistry.registerNodeSpec({\n\t\t\t...cellSpec,\n\t\t\tcontent: {\n\t\t\t\t...cellSpec.content,\n\t\t\t\tallow: [...currentAllow, 'code_block'],\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Highlighter Setup ---\n\n\tprivate initHighlighter(): void {\n\t\tif (this.config.highlighter) {\n\t\t\tthis.highlighter = this.config.highlighter;\n\t\t} else {\n\t\t\tthis.highlighter = new RegexTokenizer();\n\t\t}\n\t}\n\n\tprivate registerLanguageRegistry(context: PluginContext): void {\n\t\tconst highlighter: SyntaxHighlighter | null = this.highlighter;\n\t\tconst cache: Map<\n\t\t\tBlockId,\n\t\t\t{ readonly text: string; readonly language: string; readonly tokens: readonly SyntaxToken[] }\n\t\t> = this.tokenCache;\n\n\t\tthis.languageRegistry.onRegister((support) => {\n\t\t\tif (support.highlighting && highlighter?.registerLanguage) {\n\t\t\t\thighlighter.registerLanguage(support.highlighting);\n\t\t\t\tcache.clear();\n\t\t\t}\n\t\t});\n\n\t\tcontext.registerService(LANGUAGE_REGISTRY_SERVICE_KEY, this.languageRegistry);\n\n\t\tthis.languageRegistry.register(JAVA_SUPPORT);\n\t\tthis.languageRegistry.register(JSON_SUPPORT);\n\t\tthis.languageRegistry.register(XML_SUPPORT);\n\t}\n\n\tprivate registerSyntaxHighlighterService(context: PluginContext): void {\n\t\tconst tokenizer = this.highlighter;\n\t\tif (!tokenizer) return;\n\n\t\tcontext.registerService(SYNTAX_HIGHLIGHTER_SERVICE_KEY, {\n\t\t\tregisterLanguage: (def) => {\n\t\t\t\ttokenizer.registerLanguage?.(def);\n\t\t\t\tthis.tokenCache.clear();\n\t\t\t},\n\t\t\tgetSupportedLanguages: () => tokenizer.getSupportedLanguages(),\n\t\t\ttokenize: (code, language) => tokenizer.tokenize(code, language),\n\t\t});\n\t}\n\n\tprivate getCachedTokens(\n\t\tblockId: BlockId,\n\t\ttext: string,\n\t\tlanguage: string,\n\t): readonly SyntaxToken[] {\n\t\tconst cached = this.tokenCache.get(blockId);\n\t\tif (cached && cached.text === text && cached.language === language) {\n\t\t\treturn cached.tokens;\n\t\t}\n\t\tconst tokens: readonly SyntaxToken[] = this.highlighter?.tokenize(text, language) ?? [];\n\t\tthis.tokenCache.set(blockId, { text, language, tokens });\n\t\treturn tokens;\n\t}\n\n\t// --- Helpers ---\n\n\tprivate getFocusedCodeBlockId(state: EditorState): BlockId | null {\n\t\tif (!isTextSelection(state.selection)) return null;\n\t\tconst blockId: BlockId = state.selection.anchor.blockId;\n\t\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\t\tif (block?.type === 'code_block') return blockId;\n\t\treturn null;\n\t}\n}\n"],"mappings":"i9BAWA,IAAa,EAAiB,4tHAPtB,EAAmB,IACxB,GACA,mBAAmB,0CAA6C,+CAAkD,oEAAuE,+BACzL,KAAK,UCIK,EAAb,MACC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vC,SAAA,CAAW,EAAM,IAAa,EAAU,SAAS,EAAM,KAIzD,eAAA,CACC,EACA,EACA,GAEA,MAAM,EAAS,KAAK,WAAW,IAAI,GACnC,GAAI,GAAU,EAAO,OAAS,GAAQ,EAAO,WAAa,EACzD,OAAO,EAAO,OAEf,MAAM,EAAiC,KAAK,aAAa,SAAS,EAAM,IAAa,GAErF,OADA,KAAK,WAAW,IAAI,EAAS,CAAE,OAAM,WAAU,WACxC,EAKR,qBAAA,CAA8B,GAC7B,IAAK,EAAgB,EAAM,WAAY,OAAO,KAC9C,MAAM,EAAmB,EAAM,UAAU,OAAO,QAEhD,MAAoB,eADiB,EAAM,SAAS,IACzC,KAA8B,EAClC"}
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./Platform-D9TRT4Mn.mjs";import{o as a,s as r}from"./StyleRuntime-D3d1XFFe.mjs";import{r as t,t as f}from"./KeyboardNav-CsdlWnNl.mjs";var o=new Map([["#000000","Black"],["#434343","Dark Gray 4"],["#666666","Dark Gray 3"],["#999999","Dark Gray 2"],["#b7b7b7","Dark Gray 1"],["#cccccc","Light Gray 3"],["#d9d9d9","Light Gray 2"],["#efefef","Light Gray 1"],["#f3f3f3","Near White"],["#ffffff","White"],["#980000","Dark Red Berry"],["#ff0000","Red"],["#ff9900","Orange"],["#ffff00","Yellow"],["#00ff00","Green"],["#00ffff","Cyan"],["#4a86e8","Cornflower Blue"],["#0000ff","Blue"],["#9900ff","Purple"],["#ff00ff","Magenta"],["#e6b8af","Light Red Berry 3"],["#f4cccc","Light Red 3"],["#fce5cd","Light Orange 3"],["#fff2cc","Light Yellow 3"],["#d9ead3","Light Green 3"],["#d0e0e3","Light Cyan 3"],["#c9daf8","Light Cornflower Blue 3"],["#cfe2f3","Light Blue 3"],["#d9d2e9","Light Purple 3"],["#ead1dc","Light Magenta 3"],["#dd7e6b","Light Red Berry 2"],["#ea9999","Light Red 2"],["#f9cb9c","Light Orange 2"],["#ffe599","Light Yellow 2"],["#b6d7a8","Light Green 2"],["#a2c4c9","Light Cyan 2"],["#a4c2f4","Light Cornflower Blue 2"],["#9fc5e8","Light Blue 2"],["#b4a7d6","Light Purple 2"],["#d5a6bd","Light Magenta 2"],["#cc4125","Light Red Berry 1"],["#e06666","Light Red 1"],["#f6b26b","Light Orange 1"],["#ffd966","Light Yellow 1"],["#93c47d","Light Green 1"],["#76a5af","Light Cyan 1"],["#6d9eeb","Light Cornflower Blue 1"],["#6fa8dc","Light Blue 1"],["#8e7cc3","Light Purple 1"],["#c27ba0","Light Magenta 1"],["#a61c00","Dark Red Berry 1"],["#cc0000","Dark Red 1"],["#e69138","Dark Orange 1"],["#f1c232","Dark Yellow 1"],["#6aa84f","Dark Green 1"],["#45818e","Dark Cyan 1"],["#3c78d8","Dark Cornflower Blue 1"],["#3d85c6","Dark Blue 1"],["#674ea7","Dark Purple 1"],["#a64d79","Dark Magenta 1"],["#85200c","Dark Red Berry 2"],["#990000","Dark Red 2"],["#b45f06","Dark Orange 2"],["#bf9000","Dark Yellow 2"],["#38761d","Dark Green 2"],["#134f5c","Dark Cyan 2"],["#1155cc","Dark Cornflower Blue 2"],["#0b5394","Dark Blue 2"],["#351c75","Dark Purple 2"],["#741b47","Dark Magenta 2"],["#fff176","Bright Yellow"],["#aed581","Light Green"],["#4dd0e1","Bright Cyan"],["#64b5f6","Sky Blue"],["#ce93d8","Lavender"],["#f48fb1","Pink"],["#ffab91","Peach"],["#ff8a65","Coral"],["#e6ee9c","Lime"],["#80cbc4","Teal"],["#fff9c4","Pale Yellow"],["#dcedc8","Pale Green"],["#e0f7fa","Pale Cyan"],["#e3f2fd","Pale Blue"],["#f3e5f5","Pale Purple"],["#fce4ec","Pale Pink"],["#fff3e0","Pale Orange"],["#fbe9e7","Pale Red"],["#f9fbe7","Pale Lime"],["#e0f2f1","Pale Teal"],["#fff59d","Soft Yellow"],["#c5e1a5","Soft Green"],["#80deea","Soft Cyan"],["#90caf9","Soft Blue"],["#e1bee7","Soft Purple"],["#f8bbd0","Soft Pink"],["#ffcc80","Soft Orange"],["#a5d6a7","Mint"],["#ffee58","Vivid Yellow"],["#9ccc65","Vivid Green"],["#26c6da","Vivid Cyan"],["#42a5f5","Vivid Blue"],["#ab47bc","Vivid Purple"],["#ec407a","Vivid Pink"],["#ffa726","Vivid Orange"],["#ff7043","Red Orange"],["#d4e157","Vivid Lime"],["#66bb6a","Emerald"],["#fafafa","Almost White"],["#f5f5f5","Lightest Gray"],["#eeeeee","Very Light Gray"],["#e0e0e0","Silver"],["#bdbdbd","Medium Gray"],["#e8eaf6","Lavender Gray"],["#efebe9","Warm Gray"],["#eceff1","Cool Gray"]]);function n(e){return o.get(e.toLowerCase())||function(e){const a=l(e),r=Number.parseInt(a.slice(1,3),16)/255,t=Number.parseInt(a.slice(3,5),16)/255,f=Number.parseInt(a.slice(5,7),16)/255,o=Math.max(r,t,f),n=Math.min(r,t,f),i=(o+n)/2,c=o-n;if(c<.05)return i<.15?"Black":i<.35?"Dark Gray":i<.65?"Gray":i<.85?"Light Gray":"Near White";let s=0;s=o===r?60*((t-f)/c+(t<f?6:0)):o===t?60*((f-r)/c+2):60*((r-t)/c+4);let u="Red";for(const[l,g]of d)if(s<l){u=g;break}return i<.25?`Very Dark ${u}`:i<.4?`Dark ${u}`:i>.8?`Very Light ${u}`:i>.65?`Light ${u}`:u}(e)}function i(e){return function(e){const a=l(e);return.2126*c(Number.parseInt(a.slice(1,3),16)/255)+.7152*c(Number.parseInt(a.slice(3,5),16)/255)+.0722*c(Number.parseInt(a.slice(5,7),16)/255)}(e)>.3}function l(e){const a=e.toLowerCase();return 4===a.length?`#${a[1]}${a[1]}${a[2]}${a[2]}${a[3]}${a[3]}`:a}function c(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}var d=[[15,"Red"],[45,"Orange"],[65,"Yellow"],[150,"Green"],[190,"Cyan"],[250,"Blue"],[290,"Purple"],[330,"Pink"],[361,"Red"]],s=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function u(o,l){const c=l.columns,d=l.colors.length,u=Math.ceil(d/c),g=document.createElement("div");g.className="notectl-color-picker__grid",g.setAttribute("role","grid"),g.setAttribute("aria-label",l.ariaLabel);const h=[];let b=0;for(let e=0;e<u;e++){const t=document.createElement("div");t.setAttribute("role","row");for(let f=0;f<c;f++){const o=e*c+f;if(o>=d)break;const s=l.colors[o],u=n(s),g=!!l.activeColor&&l.activeColor.toLowerCase()===s.toLowerCase(),L=document.createElement("button");L.type="button",L.className="notectl-color-picker__swatch",L.setAttribute("role","gridcell");const k=l.swatchLabel?l.swatchLabel(u):`${l.ariaLabelPrefix} ${u}`;L.setAttribute("aria-label",k),L.setAttribute("aria-selected",String(g)),L.dataset.index=String(o),r(L,"backgroundColor",s),L.title=l.titleAsName?u:s,i(s)&&a(L,{border:"1px solid #d0d0d0"}),g&&(L.classList.add("notectl-color-picker__swatch--active"),b=o),L.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),l.onSelect(s)}),h.push(L),t.appendChild(L)}g.appendChild(t)}f(h,b),g.addEventListener("keydown",a=>{if("Escape"===a.key)return a.preventDefault(),a.stopPropagation(),void l.onClose();if("Enter"===a.key||" "===a.key){a.preventDefault(),a.stopPropagation();const e=a.target.dataset.index;if(void 0!==e){const a=l.colors[Number(e)];a&&l.onSelect(a)}return}if(s.has(a.key)){a.preventDefault(),a.stopPropagation();const r=Math.floor(b/c)+1,n=b%c+1,i=e(o),[l,s]=t(r,n,u,c,a.key,i);let g=(l-1)*c+(s-1);return g>=d&&(g=d-1),b=g,f(h,b),void h[b]?.focus()}if("Home"===a.key||"End"===a.key){a.preventDefault(),a.stopPropagation();const e=Math.floor(b/c)*c,r=Math.min(e+c-1,d-1);b="Home"===a.key?e:r,f(h,b),h[b]?.focus()}}),o.appendChild(g)}export{n,i as r,u as t};
2
+ //# sourceMappingURL=ColorGrid-Czm0p2E9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorGrid-Czm0p2E9.mjs","names":[],"sources":["../../src/plugins/shared/ColorNames.ts","../../src/plugins/shared/ColorGrid.ts"],"sourcesContent":["/**\n * Human-readable color name lookup for accessibility.\n *\n * Provides descriptive names for color swatches so screen readers\n * announce \"Red\" instead of \"#ff0000\". Covers all default palette\n * colors with a fallback algorithm for custom hex values.\n */\n\n// ---------------------------------------------------------------------------\n// Static name map — covers every default palette color\n// ---------------------------------------------------------------------------\n\nconst COLOR_NAME_MAP: ReadonlyMap<string, string> = new Map([\n\t// ── TextColor palette (70 colors) ──────────────────────────────────────\n\n\t// Row 1 — Grays\n\t['#000000', 'Black'],\n\t['#434343', 'Dark Gray 4'],\n\t['#666666', 'Dark Gray 3'],\n\t['#999999', 'Dark Gray 2'],\n\t['#b7b7b7', 'Dark Gray 1'],\n\t['#cccccc', 'Light Gray 3'],\n\t['#d9d9d9', 'Light Gray 2'],\n\t['#efefef', 'Light Gray 1'],\n\t['#f3f3f3', 'Near White'],\n\t['#ffffff', 'White'],\n\n\t// Row 2 — Vivid\n\t['#980000', 'Dark Red Berry'],\n\t['#ff0000', 'Red'],\n\t['#ff9900', 'Orange'],\n\t['#ffff00', 'Yellow'],\n\t['#00ff00', 'Green'],\n\t['#00ffff', 'Cyan'],\n\t['#4a86e8', 'Cornflower Blue'],\n\t['#0000ff', 'Blue'],\n\t['#9900ff', 'Purple'],\n\t['#ff00ff', 'Magenta'],\n\n\t// Row 3 — Light 3 (lightest tint)\n\t['#e6b8af', 'Light Red Berry 3'],\n\t['#f4cccc', 'Light Red 3'],\n\t['#fce5cd', 'Light Orange 3'],\n\t['#fff2cc', 'Light Yellow 3'],\n\t['#d9ead3', 'Light Green 3'],\n\t['#d0e0e3', 'Light Cyan 3'],\n\t['#c9daf8', 'Light Cornflower Blue 3'],\n\t['#cfe2f3', 'Light Blue 3'],\n\t['#d9d2e9', 'Light Purple 3'],\n\t['#ead1dc', 'Light Magenta 3'],\n\n\t// Row 4 — Light 2\n\t['#dd7e6b', 'Light Red Berry 2'],\n\t['#ea9999', 'Light Red 2'],\n\t['#f9cb9c', 'Light Orange 2'],\n\t['#ffe599', 'Light Yellow 2'],\n\t['#b6d7a8', 'Light Green 2'],\n\t['#a2c4c9', 'Light Cyan 2'],\n\t['#a4c2f4', 'Light Cornflower Blue 2'],\n\t['#9fc5e8', 'Light Blue 2'],\n\t['#b4a7d6', 'Light Purple 2'],\n\t['#d5a6bd', 'Light Magenta 2'],\n\n\t// Row 5 — Light 1\n\t['#cc4125', 'Light Red Berry 1'],\n\t['#e06666', 'Light Red 1'],\n\t['#f6b26b', 'Light Orange 1'],\n\t['#ffd966', 'Light Yellow 1'],\n\t['#93c47d', 'Light Green 1'],\n\t['#76a5af', 'Light Cyan 1'],\n\t['#6d9eeb', 'Light Cornflower Blue 1'],\n\t['#6fa8dc', 'Light Blue 1'],\n\t['#8e7cc3', 'Light Purple 1'],\n\t['#c27ba0', 'Light Magenta 1'],\n\n\t// Row 6 — Dark 1\n\t['#a61c00', 'Dark Red Berry 1'],\n\t['#cc0000', 'Dark Red 1'],\n\t['#e69138', 'Dark Orange 1'],\n\t['#f1c232', 'Dark Yellow 1'],\n\t['#6aa84f', 'Dark Green 1'],\n\t['#45818e', 'Dark Cyan 1'],\n\t['#3c78d8', 'Dark Cornflower Blue 1'],\n\t['#3d85c6', 'Dark Blue 1'],\n\t['#674ea7', 'Dark Purple 1'],\n\t['#a64d79', 'Dark Magenta 1'],\n\n\t// Row 7 — Dark 2\n\t['#85200c', 'Dark Red Berry 2'],\n\t['#990000', 'Dark Red 2'],\n\t['#b45f06', 'Dark Orange 2'],\n\t['#bf9000', 'Dark Yellow 2'],\n\t['#38761d', 'Dark Green 2'],\n\t['#134f5c', 'Dark Cyan 2'],\n\t['#1155cc', 'Dark Cornflower Blue 2'],\n\t['#0b5394', 'Dark Blue 2'],\n\t['#351c75', 'Dark Purple 2'],\n\t['#741b47', 'Dark Magenta 2'],\n\n\t// ── Highlight palette (50 colors, minus duplicates) ────────────────────\n\n\t// Row 1 — Classic highlighter (bright, vivid)\n\t['#fff176', 'Bright Yellow'],\n\t['#aed581', 'Light Green'],\n\t['#4dd0e1', 'Bright Cyan'],\n\t['#64b5f6', 'Sky Blue'],\n\t['#ce93d8', 'Lavender'],\n\t['#f48fb1', 'Pink'],\n\t['#ffab91', 'Peach'],\n\t['#ff8a65', 'Coral'],\n\t['#e6ee9c', 'Lime'],\n\t['#80cbc4', 'Teal'],\n\n\t// Row 2 — Light pastels\n\t['#fff9c4', 'Pale Yellow'],\n\t['#dcedc8', 'Pale Green'],\n\t['#e0f7fa', 'Pale Cyan'],\n\t['#e3f2fd', 'Pale Blue'],\n\t['#f3e5f5', 'Pale Purple'],\n\t['#fce4ec', 'Pale Pink'],\n\t['#fff3e0', 'Pale Orange'],\n\t['#fbe9e7', 'Pale Red'],\n\t['#f9fbe7', 'Pale Lime'],\n\t['#e0f2f1', 'Pale Teal'],\n\n\t// Row 3 — Medium pastels\n\t['#fff59d', 'Soft Yellow'],\n\t['#c5e1a5', 'Soft Green'],\n\t['#80deea', 'Soft Cyan'],\n\t['#90caf9', 'Soft Blue'],\n\t['#e1bee7', 'Soft Purple'],\n\t['#f8bbd0', 'Soft Pink'],\n\t['#ffcc80', 'Soft Orange'],\n\t// #ffab91 duplicate → Peach (already mapped)\n\t// #e6ee9c duplicate → Lime (already mapped)\n\t['#a5d6a7', 'Mint'],\n\n\t// Row 4 — Bold pastels\n\t['#ffee58', 'Vivid Yellow'],\n\t['#9ccc65', 'Vivid Green'],\n\t['#26c6da', 'Vivid Cyan'],\n\t['#42a5f5', 'Vivid Blue'],\n\t['#ab47bc', 'Vivid Purple'],\n\t['#ec407a', 'Vivid Pink'],\n\t['#ffa726', 'Vivid Orange'],\n\t['#ff7043', 'Red Orange'],\n\t['#d4e157', 'Vivid Lime'],\n\t['#66bb6a', 'Emerald'],\n\n\t// Row 5 — Grays and neutral highlights\n\t// #ffffff duplicate → White (already mapped)\n\t['#fafafa', 'Almost White'],\n\t['#f5f5f5', 'Lightest Gray'],\n\t['#eeeeee', 'Very Light Gray'],\n\t['#e0e0e0', 'Silver'],\n\t['#bdbdbd', 'Medium Gray'],\n\t['#e8eaf6', 'Lavender Gray'],\n\t['#efebe9', 'Warm Gray'],\n\t['#eceff1', 'Cool Gray'],\n\t// #fafafa duplicate → Almost White (already mapped)\n]);\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Returns a human-readable name for a hex color.\n *\n * Checks the static map first, then falls back to a computed\n * description based on hue, saturation, and lightness.\n */\nexport function getColorName(hex: string): string {\n\tconst name: string | undefined = COLOR_NAME_MAP.get(hex.toLowerCase());\n\tif (name) return name;\n\treturn describeColor(hex);\n}\n\n/**\n * Determines whether a color is light enough to need a visible\n * border when rendered on a white background (WCAG 1.4.11).\n *\n * Uses a contrast-ratio threshold of 3:1 against white.\n */\nexport function isLightColor(hex: string): boolean {\n\tconst luminance: number = relativeLuminance(hex);\n\t// Contrast ratio against white: (1.05) / (L + 0.05) < 3\n\t// ⟹ L > 1.05/3 − 0.05 = 0.3\n\tconst LIGHT_THRESHOLD = 0.3;\n\treturn luminance > LIGHT_THRESHOLD;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Expands `#RGB` to `#RRGGBB` and lowercases. */\nfunction normalizeHex(hex: string): string {\n\tconst h: string = hex.toLowerCase();\n\tif (h.length === 4) {\n\t\treturn `#${h[1]}${h[1]}${h[2]}${h[2]}${h[3]}${h[3]}`;\n\t}\n\treturn h;\n}\n\n/** Applies sRGB linearization to a single channel value (0–1). */\nfunction linearize(channel: number): number {\n\treturn channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;\n}\n\n/** Computes WCAG relative luminance from a hex color. */\nfunction relativeLuminance(hex: string): number {\n\tconst normalized: string = normalizeHex(hex);\n\tconst r: number = linearize(Number.parseInt(normalized.slice(1, 3), 16) / 255);\n\tconst g: number = linearize(Number.parseInt(normalized.slice(3, 5), 16) / 255);\n\tconst b: number = linearize(Number.parseInt(normalized.slice(5, 7), 16) / 255);\n\treturn 0.2126 * r + 0.7152 * g + 0.0722 * b;\n}\n\n/** Hue boundary table: upper bound (degrees) → name. */\nconst HUE_NAMES: readonly (readonly [number, string])[] = [\n\t[15, 'Red'],\n\t[45, 'Orange'],\n\t[65, 'Yellow'],\n\t[150, 'Green'],\n\t[190, 'Cyan'],\n\t[250, 'Blue'],\n\t[290, 'Purple'],\n\t[330, 'Pink'],\n\t[361, 'Red'],\n];\n\n/**\n * Generates a descriptive name from a hex color using HSL analysis.\n * Produces names like \"Dark Blue\", \"Light Green\", or \"Gray\".\n */\nfunction describeColor(hex: string): string {\n\tconst normalized: string = normalizeHex(hex);\n\tconst rRaw: number = Number.parseInt(normalized.slice(1, 3), 16) / 255;\n\tconst gRaw: number = Number.parseInt(normalized.slice(3, 5), 16) / 255;\n\tconst bRaw: number = Number.parseInt(normalized.slice(5, 7), 16) / 255;\n\n\tconst max: number = Math.max(rRaw, gRaw, bRaw);\n\tconst min: number = Math.min(rRaw, gRaw, bRaw);\n\tconst lightness: number = (max + min) / 2;\n\tconst delta: number = max - min;\n\n\t// Achromatic\n\tif (delta < 0.05) {\n\t\tif (lightness < 0.15) return 'Black';\n\t\tif (lightness < 0.35) return 'Dark Gray';\n\t\tif (lightness < 0.65) return 'Gray';\n\t\tif (lightness < 0.85) return 'Light Gray';\n\t\treturn 'Near White';\n\t}\n\n\t// Compute hue in degrees\n\tlet hue = 0;\n\tif (max === rRaw) {\n\t\thue = ((gRaw - bRaw) / delta + (gRaw < bRaw ? 6 : 0)) * 60;\n\t} else if (max === gRaw) {\n\t\thue = ((bRaw - rRaw) / delta + 2) * 60;\n\t} else {\n\t\thue = ((rRaw - gRaw) / delta + 4) * 60;\n\t}\n\n\t// Look up hue name\n\tlet hueName = 'Red';\n\tfor (const [threshold, name] of HUE_NAMES) {\n\t\tif (hue < threshold) {\n\t\t\thueName = name;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Lightness modifier\n\tif (lightness < 0.25) return `Very Dark ${hueName}`;\n\tif (lightness < 0.4) return `Dark ${hueName}`;\n\tif (lightness > 0.8) return `Very Light ${hueName}`;\n\tif (lightness > 0.65) return `Light ${hueName}`;\n\treturn hueName;\n}\n","/**\n * Shared color grid rendering with WAI-ARIA grid pattern and keyboard\n * navigation. Used by ColorPickerPopup (text-color, highlight) and\n * TableBorderColor.\n */\n\nimport { isRtlContext } from '../../platform/Platform.js';\nimport { setStyleProperties, setStyleProperty } from '../../style/StyleRuntime.js';\nimport { getColorName, isLightColor } from './ColorNames.js';\nimport { applyRovingTabindex, navigateGrid } from './KeyboardNav.js';\n\n// --- Types ---\n\nexport interface ColorGridConfig {\n\treadonly colors: readonly string[];\n\treadonly columns: number;\n\treadonly ariaLabel: string;\n\treadonly ariaLabelPrefix: string;\n\treadonly activeColor: string | null;\n\treadonly onSelect: (color: string) => void;\n\treadonly onClose: () => void;\n\t/** Optional custom label formatter for swatch aria-labels. Defaults to `${prefix} ${colorName}`. */\n\treadonly swatchLabel?: (colorName: string) => string;\n\t/** When true, swatch title shows human-readable color name instead of hex. */\n\treadonly titleAsName?: boolean;\n}\n\n// --- Constants ---\n\nconst GRID_NAV_KEYS: ReadonlySet<string> = new Set([\n\t'ArrowUp',\n\t'ArrowDown',\n\t'ArrowLeft',\n\t'ArrowRight',\n]);\nconst LIGHT_COLOR_BORDER = '1px solid #d0d0d0';\n\n// --- Rendering ---\n\n/**\n * Renders an accessible color grid into the given container.\n * Creates a `role=\"grid\"` with rows of `role=\"gridcell\"` swatch buttons.\n * Provides arrow key, Home/End, Enter/Space, and Escape keyboard navigation.\n */\nexport function renderColorGrid(container: HTMLElement, config: ColorGridConfig): void {\n\tconst columns: number = config.columns;\n\tconst totalSwatches: number = config.colors.length;\n\tconst totalRows: number = Math.ceil(totalSwatches / columns);\n\n\tconst grid: HTMLDivElement = document.createElement('div');\n\tgrid.className = 'notectl-color-picker__grid';\n\tgrid.setAttribute('role', 'grid');\n\tgrid.setAttribute('aria-label', config.ariaLabel);\n\n\tconst swatches: HTMLButtonElement[] = [];\n\tlet focusedIndex = 0;\n\n\tfor (let rowIdx = 0; rowIdx < totalRows; rowIdx++) {\n\t\tconst row: HTMLDivElement = document.createElement('div');\n\t\trow.setAttribute('role', 'row');\n\n\t\tfor (let colIdx = 0; colIdx < columns; colIdx++) {\n\t\t\tconst swatchIdx: number = rowIdx * columns + colIdx;\n\t\t\tif (swatchIdx >= totalSwatches) break;\n\n\t\t\tconst color: string = config.colors[swatchIdx] as string;\n\t\t\tconst colorName: string = getColorName(color);\n\t\t\tconst isActive: boolean =\n\t\t\t\t!!config.activeColor && config.activeColor.toLowerCase() === color.toLowerCase();\n\n\t\t\tconst swatch: HTMLButtonElement = document.createElement('button');\n\t\t\tswatch.type = 'button';\n\t\t\tswatch.className = 'notectl-color-picker__swatch';\n\t\t\tswatch.setAttribute('role', 'gridcell');\n\t\t\tconst label: string = config.swatchLabel\n\t\t\t\t? config.swatchLabel(colorName)\n\t\t\t\t: `${config.ariaLabelPrefix} ${colorName}`;\n\t\t\tswatch.setAttribute('aria-label', label);\n\t\t\tswatch.setAttribute('aria-selected', String(isActive));\n\t\t\tswatch.dataset.index = String(swatchIdx);\n\t\t\tsetStyleProperty(swatch, 'backgroundColor', color);\n\t\t\tswatch.title = config.titleAsName ? colorName : color;\n\n\t\t\tif (isLightColor(color)) {\n\t\t\t\tsetStyleProperties(swatch, {\n\t\t\t\t\tborder: LIGHT_COLOR_BORDER,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (isActive) {\n\t\t\t\tswatch.classList.add('notectl-color-picker__swatch--active');\n\t\t\t\tfocusedIndex = swatchIdx;\n\t\t\t}\n\n\t\t\tswatch.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tconfig.onSelect(color);\n\t\t\t});\n\n\t\t\tswatches.push(swatch);\n\t\t\trow.appendChild(swatch);\n\t\t}\n\n\t\tgrid.appendChild(row);\n\t}\n\n\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\n\tgrid.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconfig.onClose();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst target = e.target as HTMLElement;\n\t\t\tconst idx: string | undefined = target.dataset.index;\n\t\t\tif (idx !== undefined) {\n\t\t\t\tconst color: string | undefined = config.colors[Number(idx)];\n\t\t\t\tif (color) {\n\t\t\t\t\tconfig.onSelect(color);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (GRID_NAV_KEYS.has(e.key)) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns) + 1;\n\t\t\tconst currentCol: number = (focusedIndex % columns) + 1;\n\n\t\t\tconst rtl: boolean = isRtlContext(container);\n\t\t\tconst [newRow, newCol] = navigateGrid(\n\t\t\t\tcurrentRow,\n\t\t\t\tcurrentCol,\n\t\t\t\ttotalRows,\n\t\t\t\tcolumns,\n\t\t\t\te.key as 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\t\t\t\trtl,\n\t\t\t);\n\n\t\t\tlet newIdx: number = (newRow - 1) * columns + (newCol - 1);\n\t\t\tif (newIdx >= totalSwatches) {\n\t\t\t\tnewIdx = totalSwatches - 1;\n\t\t\t}\n\n\t\t\tfocusedIndex = newIdx;\n\t\t\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\t\t\tswatches[focusedIndex]?.focus();\n\t\t\treturn;\n\t\t}\n\n\t\tif (e.key === 'Home' || e.key === 'End') {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tconst currentRow: number = Math.floor(focusedIndex / columns);\n\t\t\tconst rowStart: number = currentRow * columns;\n\t\t\tconst rowEnd: number = Math.min(rowStart + columns - 1, totalSwatches - 1);\n\n\t\t\tfocusedIndex = e.key === 'Home' ? rowStart : rowEnd;\n\t\t\tapplyRovingTabindex(swatches as readonly HTMLButtonElement[], focusedIndex);\n\t\t\tswatches[focusedIndex]?.focus();\n\t\t}\n\t});\n\n\tcontainer.appendChild(grid);\n}\n"],"mappings":"yJAYA,IAAM,EAA8C,IAAI,IAAI,CAI3D,CAAC,UAAW,SACZ,CAAC,UAAW,eACZ,CAAC,UAAW,eACZ,CAAC,UAAW,eACZ,CAAC,UAAW,eACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,cACZ,CAAC,UAAW,SAGZ,CAAC,UAAW,kBACZ,CAAC,UAAW,OACZ,CAAC,UAAW,UACZ,CAAC,UAAW,UACZ,CAAC,UAAW,SACZ,CAAC,UAAW,QACZ,CAAC,UAAW,mBACZ,CAAC,UAAW,QACZ,CAAC,UAAW,UACZ,CAAC,UAAW,WAGZ,CAAC,UAAW,qBACZ,CAAC,UAAW,eACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,iBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,2BACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,mBAGZ,CAAC,UAAW,qBACZ,CAAC,UAAW,eACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,iBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,2BACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,mBAGZ,CAAC,UAAW,qBACZ,CAAC,UAAW,eACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,kBACZ,CAAC,UAAW,iBACZ,CAAC,UAAW,gBACZ,CAAC,UAAW,2BACZ,CAAC,UAA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BZDKMjR-.mjs";import{i as t,n as o,t as r}from"./AttributedMarkCommands-35jTbVRg.mjs";import{t as a}from"./ColorValidation-CiGxVsqd.mjs";import{t as n}from"./ColorGrid-Czm0p2E9.mjs";function s(e,t){return o(e,t,e=>e.attrs.color??null)}function l(e,t){return null!==s(e,t)}function i(t,o,n,s){if(!a(s))return!1;const l=r(o,{type:e(n),attrs:{color:s}});return!!l&&(t.dispatch(l),!0)}function c(o,r,a){const n=t(r,e(a));return!!n&&(o.dispatch(n),!0)}function m(e,t,o){e.classList.add("notectl-color-picker");const r=s(t.getState(),o.markType),a=o.columns||10,l=t.getContainer(),c=document.createElement("button");c.type="button",c.className="notectl-color-picker__default",c.textContent=o.resetLabel,c.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),t.executeCommand(o.resetCommand),o.onClose({restoreFocusTo:l})}),c.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),o.onClose())}),e.appendChild(c),n(e,{colors:o.colors,columns:a,ariaLabel:`${o.ariaLabelPrefix} color picker`,ariaLabelPrefix:o.ariaLabelPrefix,activeColor:r,onSelect:e=>{i(t,t.getState(),o.markType,e),o.onClose({restoreFocusTo:l})},onClose:o.onClose})}export{c as a,l as i,i as n,s as r,m as t};
2
+ //# sourceMappingURL=ColorPickerPopup-CL-W380M.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorPickerPopup-CL-W380M.mjs","names":[],"sources":["../../src/plugins/shared/ColorMarkOperations.ts","../../src/plugins/shared/ColorPickerPopup.ts"],"sourcesContent":["/**\n * Shared color mark operations for color-based mark plugins.\n * All functions are parameterized by mark type name so they work\n * identically for TextColor, Highlight, or any future color mark.\n *\n * Delegates to the generic AttributedMarkCommands helpers for the\n * collapsed-vs-range branching logic.\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport type { MarkAttrRegistry } from '../../model/AttrRegistry.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { isValidCSSColor } from './ColorValidation.js';\n\n/** Color mark type names that have `{ color: string }` attrs. */\nexport type ColorMarkType = {\n\t[K in keyof MarkAttrRegistry]: MarkAttrRegistry[K] extends { color: string } ? K : never;\n}[keyof MarkAttrRegistry];\n\n/**\n * Returns the active color value for the given mark type at the current\n * selection, or `null` if the mark is not present.\n */\nexport function getActiveColor(state: EditorState, markTypeName: ColorMarkType): string | null {\n\treturn getMarkAttrAtSelection(state, markTypeName, (m) => m.attrs.color ?? null);\n}\n\n/** Returns `true` when the given color mark is active at the current selection. */\nexport function isColorMarkActive(state: EditorState, markTypeName: ColorMarkType): boolean {\n\treturn getActiveColor(state, markTypeName) !== null;\n}\n\n/**\n * Applies the given color to the selection. For collapsed selections,\n * sets stored marks. For range selections, removes then re-adds the mark.\n */\nexport function applyColorMark(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tmarkTypeName: ColorMarkType,\n\tcolor: string,\n): boolean {\n\tif (!isValidCSSColor(color)) return false;\n\n\tconst mark = { type: markType(markTypeName), attrs: { color } };\n\tconst tr = applyAttributedMark(state, mark);\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/**\n * Removes the given color mark from the selection.\n * Returns `false` when the mark was not present.\n */\nexport function removeColorMark(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tmarkTypeName: ColorMarkType,\n): boolean {\n\tconst tr = removeAttributedMark(state, markType(markTypeName));\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n","/**\n * Shared color picker popup rendering with WAI-ARIA grid keyboard navigation.\n * Used by TextColorPlugin and HighlightPlugin.\n * Delegates grid rendering to the shared ColorGrid module.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport { renderColorGrid } from './ColorGrid.js';\nimport type { ColorMarkType } from './ColorMarkOperations.js';\nimport { applyColorMark, getActiveColor } from './ColorMarkOperations.js';\nimport type { PopupCloseOptions } from './PopupManager.js';\n\n/** Configuration for `renderColorPickerPopup`. */\nexport interface ColorPickerConfig {\n\treadonly markType: ColorMarkType;\n\treadonly colors: readonly string[];\n\treadonly columns: number;\n\treadonly resetLabel: string;\n\treadonly resetCommand: string;\n\treadonly ariaLabelPrefix: string;\n\treadonly onClose: (options?: PopupCloseOptions) => void;\n}\n\nconst COLUMNS = 10;\n\n/**\n * Renders an accessible color picker popup into `container`.\n *\n * Features:\n * - WAI-ARIA `role=\"grid\"` with row/gridcell structure\n * - Arrow key navigation (wraps around, clamps on partial last row)\n * - Enter/Space selects color and closes popup\n * - Escape closes popup\n * - Roving tabindex on swatches\n */\nexport function renderColorPickerPopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ColorPickerConfig,\n): void {\n\tcontainer.classList.add('notectl-color-picker');\n\n\tconst state = context.getState();\n\tconst activeColor: string | null = getActiveColor(state, config.markType);\n\tconst columns: number = config.columns || COLUMNS;\n\tconst contentElement: HTMLElement = context.getContainer();\n\n\t// --- Reset button ---\n\tconst resetBtn: HTMLButtonElement = document.createElement('button');\n\tresetBtn.type = 'button';\n\tresetBtn.className = 'notectl-color-picker__default';\n\tresetBtn.textContent = config.resetLabel;\n\tresetBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tcontext.executeCommand(config.resetCommand);\n\t\tconfig.onClose({ restoreFocusTo: contentElement });\n\t});\n\tresetBtn.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.onClose();\n\t\t}\n\t});\n\tcontainer.appendChild(resetBtn);\n\n\t// --- Color grid (delegated to shared ColorGrid) ---\n\trenderColorGrid(container, {\n\t\tcolors: config.colors,\n\t\tcolumns,\n\t\tariaLabel: `${config.ariaLabelPrefix} color picker`,\n\t\tariaLabelPrefix: config.ariaLabelPrefix,\n\t\tactiveColor,\n\t\tonSelect: (color: string) => {\n\t\t\tapplyColorMark(context, context.getState(), config.markType, color);\n\t\t\tconfig.onClose({ restoreFocusTo: contentElement });\n\t\t},\n\t\tonClose: config.onClose,\n\t});\n}\n"],"mappings":"sNA6BA,SAAgB,EAAe,EAAoB,GAClD,OAAO,EAAuB,EAAO,EAAe,GAAM,EAAE,MAAM,OAAS,MAI5E,SAAgB,EAAkB,EAAoB,GACrD,OAA+C,OAAxC,EAAe,EAAO,GAO9B,SAAgB,EACf,EACA,EACA,EACA,GAEA,IAAK,EAAgB,GAAQ,OAAO,EAGpC,MAAM,EAAK,EAAoB,EADlB,CAAE,KAAM,EAAS,GAAe,MAAO,CAAE,WAEtD,QAAK,IAEL,EAAQ,SAAS,IACV,GAOR,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAK,EAAqB,EAAO,EAAS,IAChD,QAAK,IAEL,EAAQ,SAAS,IACV,GCpCR,SAAgB,EACf,EACA,EACA,GAEA,EAAU,UAAU,IAAI,wBAGxB,MAAM,EAA6B,EADrB,EAAQ,WACmC,EAAO,UAC1D,EAAkB,EAAO,SArBhB,GAsBT,EAA8B,EAAQ,eAGtC,EAA8B,SAAS,cAAc,UAC3D,EAAS,KAAO,SAChB,EAAS,UAAY,gCACrB,EAAS,YAAc,EAAO,WAC9B,EAAS,iBAAiB,YAAc,IACvC,EAAE,iBACF,EAAE,kBACF,EAAQ,eAAe,EAAO,cAC9B,EAAO,QAAQ,CAAE,eAAgB,MAElC,EAAS,iBAAiB,UAAY,IACvB,WAAV,EAAE,MACL,EAAE,iBACF,EAAO,aAGT,EAAU,YAAY,GAGtB,EAAgB,EAAW,CAC1B,OAAQ,EAAO,OACf,UACA,UAAW,GAAG,EAAO,+BACrB,gBAAiB,EAAO,gBACxB,cACA,SAAW,IACV,EAAe,EAAS,EAAQ,WAAY,EAAO,SAAU,GAC7D,EAAO,QAAQ,CAAE,eAAgB,KAElC,QAAS,EAAO"}
@@ -0,0 +1,2 @@
1
+ import{y as r}from"./Document-_qdGR4vh.mjs";var t=/[\p{Script=Hebrew}\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}\p{Script=Nko}\p{Script=Samaritan}\p{Script=Adlam}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}\p{Script=Yezidi}\p{Script=Old_South_Arabian}\p{Script=Old_North_Arabian}\p{Script=Avestan}\p{Script=Imperial_Aramaic}\p{Script=Phoenician}\p{Script=Lydian}\u200F\u061C]/u,i=/[\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}\p{Script=Armenian}\p{Script=Devanagari}\p{Script=Bengali}\p{Script=Gurmukhi}\p{Script=Gujarati}\p{Script=Oriya}\p{Script=Tamil}\p{Script=Telugu}\p{Script=Kannada}\p{Script=Malayalam}\p{Script=Sinhala}\p{Script=Thai}\p{Script=Lao}\p{Script=Tibetan}\p{Script=Myanmar}\p{Script=Georgian}\p{Script=Hangul}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}\p{Script=Ethiopic}\p{Script=Cherokee}\p{Script=Khmer}\u200E]/u;function p(r){const p=r.search(t),a=r.search(i);return-1===p&&-1===a?null:-1===p?"ltr":-1===a||p<a?"rtl":"ltr"}function a(r){const t=r.attrs?.dir;return"ltr"===t||"rtl"===t?t:"auto"}function c(t,i,p){const a=function(t,i){if(0===i.length)return t.doc.children;const p=i[i.length-1];if(!p)return[];const a=t.getBlock(p);return a?a.children.filter(r):[]}(t,i);for(let r=p-1;r>=0;r--){const t=a[r]?.attrs?.dir;if("ltr"===t||"rtl"===t)return t}for(let r=p;r<a.length;r++){const t=a[r]?.attrs?.dir;if("ltr"===t||"rtl"===t)return t}}export{c as n,a as r,p as t};
2
+ //# sourceMappingURL=DirectionDetection-Hun6-7ER.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectionDetection-Hun6-7ER.mjs","names":[],"sources":["../../src/plugins/text-direction/DirectionDetection.ts"],"sourcesContent":["/**\n * Direction detection utilities for the TextDirectionPlugin.\n * Detects text direction based on the first strong directional character\n * and finds sibling block direction for inheritance.\n */\n\nimport { type BlockNode, isBlockNode } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TextDirection } from './TextDirectionPlugin.js';\n\n// --- RTL Detection ---\n\n/**\n * Regex matching strong RTL characters using Unicode Script property escapes.\n * Auto-maintained by the Unicode standard — no manual code-point ranges needed.\n * Covers all RTL scripts: Hebrew, Arabic, Syriac, Thaana, N'Ko, Samaritan,\n * Mandaic, Adlam, Hanifi Rohingya, Mende Kikakui, Yezidi, and historic scripts.\n * Includes U+200F (RLM) and U+061C (ALM) as strong directional markers.\n */\nconst RTL_CHAR_RE: RegExp =\n\t/[\\p{Script=Hebrew}\\p{Script=Arabic}\\p{Script=Syriac}\\p{Script=Thaana}\\p{Script=Mandaic}\\p{Script=Nko}\\p{Script=Samaritan}\\p{Script=Adlam}\\p{Script=Hanifi_Rohingya}\\p{Script=Mende_Kikakui}\\p{Script=Yezidi}\\p{Script=Old_South_Arabian}\\p{Script=Old_North_Arabian}\\p{Script=Avestan}\\p{Script=Imperial_Aramaic}\\p{Script=Phoenician}\\p{Script=Lydian}\\u200F\\u061C]/u;\n\n/**\n * Regex matching strong LTR characters using Unicode Script property escapes.\n * Covers all major LTR scripts: Latin, Greek, Cyrillic, Armenian, Indic scripts,\n * Southeast Asian scripts, East Asian scripts, Georgian, Ethiopic, and more.\n * Includes U+200E (LRM) as a strong directional marker.\n */\nconst LTR_CHAR_RE: RegExp =\n\t/[\\p{Script=Latin}\\p{Script=Greek}\\p{Script=Cyrillic}\\p{Script=Armenian}\\p{Script=Devanagari}\\p{Script=Bengali}\\p{Script=Gurmukhi}\\p{Script=Gujarati}\\p{Script=Oriya}\\p{Script=Tamil}\\p{Script=Telugu}\\p{Script=Kannada}\\p{Script=Malayalam}\\p{Script=Sinhala}\\p{Script=Thai}\\p{Script=Lao}\\p{Script=Tibetan}\\p{Script=Myanmar}\\p{Script=Georgian}\\p{Script=Hangul}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Han}\\p{Script=Ethiopic}\\p{Script=Cherokee}\\p{Script=Khmer}\\u200E]/u;\n\n/**\n * Detects the dominant text direction based on the first strong directional character.\n * Returns `null` if no strong character is found (all neutral/numeric/whitespace).\n */\nexport function detectTextDirection(text: string): TextDirection | null {\n\tconst rtlIdx: number = text.search(RTL_CHAR_RE);\n\tconst ltrIdx: number = text.search(LTR_CHAR_RE);\n\n\tif (rtlIdx === -1 && ltrIdx === -1) return null;\n\tif (rtlIdx === -1) return 'ltr';\n\tif (ltrIdx === -1) return 'rtl';\n\treturn rtlIdx < ltrIdx ? 'rtl' : 'ltr';\n}\n\n// --- Block Direction Accessor ---\n\n/** Returns the current `dir` attribute of a block, defaulting to `'auto'`. */\nexport function getBlockDir(block: BlockNode): TextDirection {\n\tconst dir: unknown = block.attrs?.dir;\n\tif (dir === 'ltr' || dir === 'rtl') return dir;\n\treturn 'auto';\n}\n\n// --- Sibling Direction Lookup ---\n\n/**\n * Finds the `dir` attribute of the nearest sibling with an explicit direction\n * (not `'auto'`) before the insert position, walking backwards.\n */\nexport function findSiblingDirection(\n\tstate: EditorState,\n\tparentPath: readonly BlockId[],\n\tindex: number,\n): TextDirection | undefined {\n\tconst siblings: readonly BlockNode[] = getSiblings(state, parentPath);\n\n\t// Walk backward first (preceding siblings take priority)\n\tfor (let i: number = index - 1; i >= 0; i--) {\n\t\tconst dir: unknown = siblings[i]?.attrs?.dir;\n\t\tif (dir === 'ltr' || dir === 'rtl') return dir;\n\t}\n\n\t// Walk forward when no backward sibling has explicit direction\n\tfor (let i: number = index; i < siblings.length; i++) {\n\t\tconst dir: unknown = siblings[i]?.attrs?.dir;\n\t\tif (dir === 'ltr' || dir === 'rtl') return dir;\n\t}\n\n\treturn undefined;\n}\n\n/** Returns the sibling list for the given parent path. */\nfunction getSiblings(state: EditorState, parentPath: readonly BlockId[]): readonly BlockNode[] {\n\tif (parentPath.length === 0) {\n\t\treturn state.doc.children;\n\t}\n\n\tconst parentId: BlockId | undefined = parentPath[parentPath.length - 1];\n\tif (!parentId) return [];\n\tconst parent: BlockNode | undefined = state.getBlock(parentId);\n\tif (!parent) return [];\n\n\treturn parent.children.filter(isBlockNode);\n}\n"],"mappings":"4CAoBA,IAAM,EACL,wWAQK,EACL,udAMD,SAAgB,EAAoB,GACnC,MAAM,EAAiB,EAAK,OAAO,GAC7B,EAAiB,EAAK,OAAO,GAEnC,OAAe,IAAX,IAA4B,IAAX,EAAsB,MAC5B,IAAX,EAAsB,OACX,IAAX,GACG,EAAS,EADU,MACO,MAMlC,SAAgB,EAAY,GAC3B,MAAM,EAAe,EAAM,OAAO,IAClC,MAAY,QAAR,GAAyB,QAAR,EAAsB,EACpC,OASR,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAkBP,SAAqB,EAAoB,GACxC,GAA0B,IAAtB,EAAW,OACd,OAAO,EAAM,IAAI,SAGlB,MAAM,EAAgC,EAAW,EAAW,OAAS,GACrE,IAAK,EAAU,MAAO,GACtB,MAAM,EAAgC,EAAM,SAAS,GACrD,OAAK,EAEE,EAAO,SAAS,OAAO,GAFV,GA1BmB,CAAY,EAAO,GAG1D,IAAK,IAAI,EAAY,EAAQ,EAAG,GAAK,EAAG,IAAK,CAC5C,MAAM,EAAe,EAAS,IAAI,OAAO,IACzC,GAAY,QAAR,GAAyB,QAAR,EAAe,OAAO,EAI5C,IAAK,IAAI,EAAY,EAAO,EAAI,EAAS,OAAQ,IAAK,CACrD,MAAM,EAAe,EAAS,IAAI,OAAO,IACzC,GAAY,QAAR,GAAyB,QAAR,EAAe,OAAO"}
@@ -0,0 +1,2 @@
1
+ var v={ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm12 8l-4-4v3H5v2h12v3l4-4z"/></svg>',rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',auto:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm3 8l-4-4v3H3v2h5v3l4-4zm7 0v-3l4 4-4 4v-3h-5v-2h5z"/></svg>'};export{v as t};
2
+ //# sourceMappingURL=DirectionIcons-CfaDcQ9a.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectionIcons-CfaDcQ9a.mjs","names":[],"sources":["../../src/plugins/text-direction/DirectionIcons.ts"],"sourcesContent":["/**\n * Direction icon SVGs shared between `TextDirectionPlugin` (block-level\n * dropdown) and `BidiIsolationPlugin` (inline dropdown items).\n */\n\nimport type { TextDirection } from './TextDirectionService.js';\n\nexport const DIRECTION_ICONS: Readonly<Record<TextDirection, string>> = {\n\tltr: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm12 8l-4-4v3H5v2h12v3l4-4z\"/></svg>',\n\trtl: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zM8 14l-4 4 4 4v-3h12v-2H8v-3z\"/></svg>',\n\tauto: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm3 8l-4-4v3H3v2h5v3l4-4zm7 0v-3l4 4-4 4v-3h-5v-2h5z\"/></svg>',\n};\n"],"mappings":"AAOA,IAAa,EAA2D,CACvE,IAAK,mKACL,IAAK,wKACL,KAAM"}
@@ -0,0 +1,2 @@
1
+ import{C as t,S as e,b as s,g as n,i as r,l as o,o as i,r as c,s as l,x as a}from"./Document-_qdGR4vh.mjs";import{a as u,i as f,r as p,t as d}from"./TypeBrands-BZDKMjR-.mjs";import{r as g}from"./AttrRegistry-nDKtHK87.mjs";import{n as h,r as y,t as m}from"./HTMLUtils-brwcaufP.mjs";import A from"dompurify";var b=/^[A-Za-z0-9_-]{1,64}$/;function L(t){return b.test(t)}function T(t,e){const s=t.getAttribute("data-block-id");if(s&&L(s)&&!e.has(s))return e.add(s),d(s)}function M(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0).toString(36).padStart(6,"0")}var k=class{classMap=/* @__PURE__ */new Map;usedHashes=/* @__PURE__ */new Set;getClassName(t){const e=function(t){return t.split(";").map(t=>t.trim()).filter(t=>t.length>0).sort().join("; ")}(t),s=this.classMap.get(e);if(s)return s;let n=M(e),r=0;for(;this.usedHashes.has(n);)r++,n=M(e+String(r));const o=`notectl-s-${n}`;return this.usedHashes.add(n),this.classMap.set(e,o),o}getAlignmentClassName(t){const e=`text-align: ${t}`,s=this.classMap.get(e);if(s)return s;const n=`notectl-align-${t}`;return this.classMap.set(e,n),n}toCSS(){if(0===this.classMap.size)return"";const t=[];for(const[e,s]of this.classMap)t.push(`.${s} { ${e}; }`);return t.join("\n")}toStyleMap(){const t=/* @__PURE__ */new Map;for(const[e,s]of this.classMap)t.set(s,e);return t}};function S(t){const e=t.getMarkTypes(),s=/* @__PURE__ */new Map;for(const n of e){const e=t.getMarkSpec(n);e&&s.set(n,e.rank??99)}return s}function $(t,e,s,n,r){if(""===t)return"";let o=y(t);if(0===e.length)return o;const i=n??S(s),c=[...e].sort((t,e)=>(i.get(t.type)??99)-(i.get(e.type)??99)),l=[],a=[];for(const u of c){const t=s.getMarkSpec(u.type);if(t?.toHTMLStyle){const e=t.toHTMLStyle(u);e&&l.push(e)}else a.push(u)}if(l.length>0){const t=l.join("; "),e=r?r.styleAttr(t):` style="${t}"`;e&&(o=`<span${e}>${o}</span>`)}for(const u of a){const t=s.getMarkSpec(u.type);t?.toHTMLString&&(o=t.toHTMLString(u,o,r))}return o}function x(t,e,s,n,r,o){if(""===t)return"";let i=y(t);if(0===e.length)return i;const c=r??S(s),l=[...e].sort((t,e)=>(c.get(t.type)??99)-(c.get(e.type)??99)),a=[],u=[];for(const f of l){const t=s.getMarkSpec(f.type);if(t?.toHTMLStyle){const e=t.toHTMLStyle(f);e&&a.push(e)}else u.push(f)}if(a.length>0){const t=a.join("; ");i=`<span class="${n.getClassName(t)}">${i}</span>`}for(const f of u){const t=s.getMarkSpec(f.type);t?.toHTMLString&&(i=t.toHTMLString(f,i,o))}return i}var N=new Set(["start","center","end","justify"]),E={left:"start",right:"end"},w=new Set(["ltr","rtl"]);function v(t){return{styleAttr:e=>e?` class="${t.getClassName(e)}"`:""}}function C(t,e,s){const n=function(t){let e=t.indexOf("<");for(;e>=0;){const s=t[e+1];if(s&&/[A-Za-z]/.test(s)){let s;for(let n=e+2;n<t.length;n++){const r=t[n]??"";if(s)r===s&&(s=void 0);else if('"'!==r&&"'"!==r){if(">"===r)return{start:e,end:n}}else s=r}return}e=t.indexOf("<",e+1)}}(t);if(!n)return t;const r=t.slice(n.start,n.end+1),o=new RegExp(`\\s${e}\\s*=\\s*("([^"]*)"|'([^']*)')`),i=r.match(o);if(i){const c=i[2]??i[3]??"";if("style"===e&&/(?:^|;)\s*text-align\s*:/i.test(c))return t;const l=` ${e}="${c}${"style"===e?"; ":" "}${s}"`,a=r.replace(o,l);return`${t.slice(0,n.start)}${a}${t.slice(n.end+1)}`}const c=r.endsWith("/>")?`${r.slice(0,-2)} ${e}="${s}"/>`:`${r.slice(0,-1)} ${e}="${s}">`;return`${t.slice(0,n.start)}${c}${t.slice(n.end+1)}`}function _(t,e){const s={registry:e,exportCtx:{styleAttr:t=>t?` style="${t}"`:""}},n=j(t.children,s),r=e?e.getAllowedTags():["p","br","div","span"],o=e?e.getAllowedAttrs():["style","dir"];return o.includes("data-block-id")||o.push("data-block-id"),A.sanitize(n,{ALLOWED_TAGS:r,ALLOWED_ATTR:o,ALLOWED_URI_REGEXP:m})}function O(t,e){const s=new k,n={registry:e,collector:s,exportCtx:v(s)},r=j(t.children,n),o=e?e.getAllowedTags():["p","br","div","span"],i=e?e.getAllowedAttrs():["style","class","dir"];i.includes("class")||i.push("class"),i.includes("data-block-id")||i.push("data-block-id");const c=i.filter(t=>"style"!==t);return{html:A.sanitize(r,{ALLOWED_TAGS:o,ALLOWED_ATTR:c,ALLOWED_URI_REGEXP:m}),css:s.toCSS(),styleMap:s.toStyleMap()}}function j(t,e){const s=[];let n=0;for(;n<t.length;){const r=t[n];if(r)if(g(r,"list_item")){const r=[];for(;n<t.length;){const e=t[n];if(!e||!g(e,"list_item"))break;r.push(e),n++}s.push(H(r,e))}else s.push(D(r,e)),n++;else n++}return s.join("")}function H(t,e){const s=[],n=[];for(let r=0;r<t.length;r++){const o=t[r];if(!o)continue;const i=o.attrs?.listType??"bullet",c=o.attrs?.indent??0,l="ordered"===i?"ol":"ul";for(;n.length>0;){const t=n[n.length-1];if(!t)break;if(t.indent>c)s.push(`</${t.tag}></li>`),n.pop();else{if(t.indent!==c||t.tag===l)break;s.push(`</${t.tag}></li>`),n.pop()}}if(0===n.length)s.push(`<${l}>`),n.push({tag:l,indent:c});else{const t=n[n.length-1];t&&c>t.indent&&(s.push(`<${l}>`),n.push({tag:l,indent:c}))}const a=D(o,e),u=t[r+1],f=u?u.attrs?.indent??0:void 0;void 0!==f&&f>c?s.push(R(a)):s.push(a)}for(;n.length>0;){const t=n.pop();if(!t)break;s.push(`</${t.tag}>`),n.length>0&&s.push("</li>")}return s.join("")}function R(t){return t.endsWith("</li>")?t.slice(0,-5):t}function D(r,i){const c=a(r)?function(r,o){const i=function(n){if(n.length<=1)return n;const r=[];for(const o of n){if(s(o)){r.push(o);continue}const n=r[r.length-1];n&&e(n)&&t(n.marks,o.marks)?r[r.length-1]={type:"text",text:n.text+o.text,marks:n.marks}:r.push(o)}return r}(n(r)),c=[],l=o.registry?S(o.registry):void 0;for(const t of i)if(s(t)){const e=o.registry?.getInlineNodeSpec(t.inlineType);e?.toHTMLString&&c.push(e.toHTMLString(t))}else o.registry&&o.collector?c.push(x(t.text,t.marks,o.registry,o.collector,l,o.exportCtx)):o.registry?c.push($(t.text,t.marks,o.registry,l,o.exportCtx)):""!==t.text&&c.push(y(t.text));return c.join("")}(r,i):j(o(r),i),l=i.registry?.getNodeSpec(r.type);let u;if(u=l?.toHTML?l.toHTML(r,c,i.exportCtx):`<p>${c||"<br>"}</p>`,L(r.id)){const t=u.indexOf(">");u.slice(0,t+1).includes(" data-block-id=")||(u=C(u,"data-block-id",h(r.id)))}const f=r.attrs?.align,p=f?E[f]??f:void 0;if(p&&"start"!==p&&N.has(p)){const t=h(p);if(i.collector){const t=i.collector.getAlignmentClassName(p);u=C(u,"class",h(t))}else u=C(u,"style",`text-align: ${t}`)}const d=r.attrs?.dir;if(d&&w.has(d)){const t=u.indexOf(">");u.slice(0,t+1).includes(" dir=")||(u=C(u,"dir",h(d)))}return u}function W(t,e,s){const n=e?e.getAllowedTags():["p","br","div","span"],o=e?e.getAllowedAttrs():["style","dir"];o.includes("data-block-id")||o.push("data-block-id"),s?.styleMap&&!o.includes("class")&&o.push("class");const i=document.createElement("template");i.innerHTML=A.sanitize(t,{ALLOWED_TAGS:n,ALLOWED_ATTR:o,ALLOWED_URI_REGEXP:m});const c=i.content;s?.styleMap&&function(t,e){const s=t.querySelectorAll("[class]");for(const n of Array.from(s)){const t=n,s=Array.from(t.classList),r=[];for(const n of s){const s=e.get(n);if(s){const e=t.getAttribute("style")??"",o=e&&!e.endsWith(";")?"; ":"";t.setAttribute("style",e+o+s),r.push(n)}}for(const e of r)t.classList.remove(e)}}(c,s.styleMap);const l=e?.getBlockParseRules()??[],a=[],u=/* @__PURE__ */new Set;for(const r of Array.from(c.childNodes))I(r,a,l,u,e);return 0===a.length?r():r(a)}function I(t,e,s,n,r){if(t.nodeType===Node.ELEMENT_NODE){const o=t,i=o.tagName.toLowerCase();if("ul"===i||"ol"===i){const t="ol"===i?"ordered":"bullet",s=o.getAttribute("dir");return void P(o,t,0,e,n,r,s&&w.has(s)?s:void 0)}if("table"===i)return void function(t,e,s,n){const r=[],o=function(t){const e=[];for(const s of Array.from(t.children)){const t=s.tagName.toLowerCase();if("tr"===t)e.push(s);else if("thead"===t||"tbody"===t||"tfoot"===t)for(const n of Array.from(s.children))"tr"===n.tagName.toLowerCase()&&e.push(n)}return e}(t);for(const i of o){const t=[];for(const e of Array.from(i.children)){const r=e.tagName.toLowerCase();if("td"!==r&&"th"!==r)continue;const o=e,i=X(o,s,n),l={};G(o,l);const a=c(u("table_cell"),i,T(o,s),Object.keys(l).length>0?l:void 0);t.push(a)}t.length>0&&r.push(c(u("table_row"),t,T(i,s)))}if(r.length>0){const n={};!function(t,e){const s=t.getAttribute("style")??"",n=z.exec(s);n?.[1]&&(e.borderColor="transparent"===n[1]?"none":n[1])}(t,n),e.push(c(u("table"),r,T(t,s),Object.keys(n).length>0?n:void 0))}}(o,e,n,r);const a=function(t,e){const s=t.tagName.toLowerCase();for(const n of e)if(n.rule.tag===s){if(n.rule.getAttrs){const e=n.rule.getAttrs(t);if(!1===e)continue;return{type:n.type,attrs:e}}return{type:n.type}}return null}(o,s);if(a){const t=r?.getNodeSpec(a.type),s=t?.isVoid?[l("")]:U(o,r),i={...a.attrs};return t?.attrs?.align&&F(o,i),t?.attrs?.dir&&q(o,i),void e.push(c(u(a.type),s,T(o,n),Object.keys(i).length>0?i:void 0))}const f=U(o,r),p={};F(o,p),q(o,p),e.push(c(u("paragraph"),f,T(o,n),Object.keys(p).length>0?p:void 0))}else t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()&&e.push(c(u("paragraph"),[l(t.textContent.trim())]))}function P(t,e,s,n,r,o,i){for(const l of Array.from(t.children)){const t=l.tagName.toLowerCase();if("li"===t){const t=l,a=t.querySelector(':scope > input[type="checkbox"]'),f=null!==a,p=a?.hasAttribute("checked")??!1,d=f?"checklist":e,g=U(t,o,!0),h={listType:d,indent:s,checked:p},y=t.getAttribute("dir"),m=y&&w.has(y)?y:i;m&&(h.dir=m),n.push(c(u("list_item"),g,T(t,r),h));for(const e of Array.from(t.children)){const t=e.tagName.toLowerCase();if("ul"===t||"ol"===t){const i="ol"===t?"ordered":"bullet",c=e.getAttribute("dir");P(e,i,s+1,n,r,o,c&&w.has(c)?c:m)}}}else if("ul"===t||"ol"===t){const e="ol"===t?"ordered":"bullet",c=l.getAttribute("dir");P(l,e,s+1,n,r,o,c&&w.has(c)?c:i)}}}var z=/--ntbl-bc:\s*(#[0-9a-fA-F]{3,8}|transparent)/;function G(t,e){const s=t.getAttribute("colspan");if(s){const t=Number.parseInt(s,10);t>1&&(e.colspan=t)}const n=t.getAttribute("rowspan");if(n){const t=Number.parseInt(n,10);t>1&&(e.rowspan=t)}}function X(t,e,s){const n=s?.getBlockParseRules()??[],r=[];for(const o of Array.from(t.childNodes))I(o,r,n,e,s);if(0===r.length){const e=U(t,s);r.push(c(u("paragraph"),e))}return r}function U(t,e,n){const r=[];return B(t,[],r,e?.getMarkParseRules()??[],e?.getInlineParseRules()??[],n),1===r.length&&s(r[0])&&"hard_break"===r[0].inlineType?[l("")]:r.length>0?r:[l("")]}function B(t,e,s,n,r,o){if(t.nodeType===Node.TEXT_NODE){const n=t.textContent??"";return void(n&&s.push(l(n,[...e])))}if(t.nodeType!==Node.ELEMENT_NODE)return;const c=t,a=c.tagName.toLowerCase();if(o&&("ul"===a||"ol"===a))return;if(o&&"input"===a&&"checkbox"===c.getAttribute("type"))return;for(const l of r)if(l.rule.tag===a){if(l.rule.getAttrs){const t=l.rule.getAttrs(c);if(!1===t)continue;return void s.push(i(p(l.type),t))}return void s.push(i(p(l.type)))}const u=[...e],d=/* @__PURE__ */new Set;for(const i of n)if(i.rule.tag===a&&!d.has(i.type))if(i.rule.getAttrs){const t=i.rule.getAttrs(c);if(!1===t)continue;u.some(t=>t.type===i.type)||(u.push({type:f(i.type),...Object.keys(t).length>0?{attrs:t}:{}}),d.add(i.type))}else u.some(t=>t.type===i.type)||(u.push({type:f(i.type)}),d.add(i.type));for(const i of Array.from(c.childNodes))B(i,u,s,n,r,o)}function q(t,e){const s=t.getAttribute("dir");if(s&&w.has(s))return void(e.dir=s);const n=t.style?.direction??"";n&&w.has(n)&&(e.dir=n)}var Z={left:"start",right:"end"};function F(t,e){let s=t.style?.textAlign??"";const n=Z[s];if(n&&(s=n),s&&N.has(s))e.align=s;else for(const r of Array.from(t.classList)){let t=r.match(/^notectl-align-(\w+)$/)?.[1];const s=Z[t??""];if(s&&(t=s),t&&N.has(t))return void(e.align=t)}}export{_ as a,O as i,N as n,S as o,w as r,$ as s,W as t};
2
+ //# sourceMappingURL=DocumentParser-CyATBOz-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentParser-CyATBOz-.mjs","names":[],"sources":["../../src/serialization/BlockIdHTML.ts","../../src/serialization/CSSClassCollector.ts","../../src/serialization/MarkSerializer.ts","../../src/serialization/DocumentSerializer.ts","../../src/serialization/DocumentParser.ts"],"sourcesContent":["/**\n * Shared rules for the `data-block-id` HTML wire format.\n *\n * Block identity round-trips through `getContentHTML` → `setContentHTML` so the\n * caret-preserving `EditorView.replaceState()` keeps the cursor on the same block\n * across content sync (Angular signal forms, RxJS pipes — see ARCHITECTURE §9.1).\n * Both serializer and parser must agree on the same shape; this module is the\n * single source of truth.\n */\n\nimport { type BlockId, blockId } from '../model/TypeBrands.js';\n\n/**\n * Conservative pattern for `data-block-id` values: alphanumeric, underscore,\n * hyphen, max 64 chars. Defense-in-depth — IDs flow in-memory only, but we keep\n * the wire shape narrow to rule out attribute-injection vectors and to allow\n * `escapeAttr` to be a no-op for valid IDs.\n */\nexport const SAFE_BLOCK_ID_PATTERN: RegExp = /^[A-Za-z0-9_-]{1,64}$/;\n\n/** True if `value` is shaped like a safe `data-block-id`. */\nexport function isSafeBlockId(value: string): boolean {\n\treturn SAFE_BLOCK_ID_PATTERN.test(value);\n}\n\n/**\n * Adopts the `data-block-id` attribute from a parsed element so that block\n * identity survives an HTML round-trip. Returns `undefined` (caller generates\n * a fresh ID) when:\n * - the attribute is missing (e.g. user-pasted external HTML),\n * - the value is malformed,\n * - or the value collides with an already-adopted ID in this parse pass\n * (e.g. concatenated HTML from two documents).\n */\nexport function adoptBlockId(el: Element, used: Set<string>): BlockId | undefined {\n\tconst raw: string | null = el.getAttribute('data-block-id');\n\tif (!raw) return undefined;\n\tif (!isSafeBlockId(raw)) return undefined;\n\tif (used.has(raw)) return undefined;\n\tused.add(raw);\n\treturn blockId(raw);\n}\n","/**\n * CSSClassCollector: maps CSS declarations to unique class names during serialization.\n * Deduplicates identical declaration sets and produces a minimal stylesheet.\n * Uses content-hash (FNV-1a) for deterministic, document-order-independent class names.\n */\n\n/** Prefix for generated style class names (avoids collisions with user classes). */\nconst CLASS_PREFIX = 'notectl-s-';\n\n/** Base for hash encoding output. */\nconst HASH_BASE = 36;\n/** Pad length for consistent 6-char hashes. */\nconst HASH_PAD_LENGTH = 6;\n\n/**\n * Normalizes a CSS declarations string by sorting individual declarations alphabetically.\n * This ensures `\"color: red; font-size: 14px\"` and `\"font-size: 14px; color: red\"` map\n * to the same class name.\n */\nfunction normalizeDeclarations(declarations: string): string {\n\treturn declarations\n\t\t.split(';')\n\t\t.map((d) => d.trim())\n\t\t.filter((d) => d.length > 0)\n\t\t.sort()\n\t\t.join('; ');\n}\n\n/** FNV-1a 32-bit offset basis. */\nconst FNV_OFFSET_BASIS = 0x811c9dc5;\n/** FNV-1a 32-bit prime. */\nconst FNV_PRIME = 0x01000193;\n\n/**\n * FNV-1a 32-bit hash function.\n * Fast, no crypto dependency, excellent distribution for short strings.\n */\nfunction fnv1aHash(input: string): string {\n\tlet hash: number = FNV_OFFSET_BASIS;\n\tfor (let i = 0; i < input.length; i++) {\n\t\thash ^= input.charCodeAt(i);\n\t\thash = Math.imul(hash, FNV_PRIME);\n\t}\n\t// Convert to unsigned 32-bit, then to base-36, padded to 6 chars\n\tconst unsigned: number = hash >>> 0;\n\treturn unsigned.toString(HASH_BASE).padStart(HASH_PAD_LENGTH, '0');\n}\n\n/**\n * Stateful collector that assigns CSS class names to unique declaration sets.\n * Used during a single serialization pass, then produces the collected stylesheet.\n *\n * Class names are deterministic: the same declarations always produce the same\n * class name, regardless of encounter order across documents.\n */\nexport class CSSClassCollector {\n\t/** Maps normalized declarations → class name. */\n\tprivate readonly classMap: Map<string, string> = new Map();\n\t/** Tracks used hashes to handle the (extremely rare) collision case. */\n\tprivate readonly usedHashes: Set<string> = new Set();\n\n\t/**\n\t * Returns the class name for the given CSS declarations.\n\t * If the same (normalized) declarations were seen before, returns the existing class.\n\t */\n\tgetClassName(declarations: string): string {\n\t\tconst normalized: string = normalizeDeclarations(declarations);\n\t\tconst existing: string | undefined = this.classMap.get(normalized);\n\t\tif (existing) return existing;\n\n\t\tlet hash: string = fnv1aHash(normalized);\n\t\tlet suffix = 0;\n\t\t// Collision handling: append suffix counter if the hash is already in use\n\t\t// for a different declarations string\n\t\twhile (this.usedHashes.has(hash)) {\n\t\t\tsuffix++;\n\t\t\thash = fnv1aHash(normalized + String(suffix));\n\t\t}\n\n\t\tconst className: string = `${CLASS_PREFIX}${hash}`;\n\t\tthis.usedHashes.add(hash);\n\t\tthis.classMap.set(normalized, className);\n\t\treturn className;\n\t}\n\n\t/**\n\t * Returns the semantic alignment class name for a given alignment value.\n\t * Unlike style classes, alignment classes use descriptive names.\n\t */\n\tgetAlignmentClassName(alignment: string): string {\n\t\tconst declarations: string = `text-align: ${alignment}`;\n\t\tconst existing: string | undefined = this.classMap.get(declarations);\n\t\tif (existing) return existing;\n\n\t\tconst className = `notectl-align-${alignment}`;\n\t\tthis.classMap.set(declarations, className);\n\t\treturn className;\n\t}\n\n\t/** Produces CSS rules for all collected classes. Returns empty string if none collected. */\n\ttoCSS(): string {\n\t\tif (this.classMap.size === 0) return '';\n\n\t\tconst rules: string[] = [];\n\t\tfor (const [declarations, className] of this.classMap) {\n\t\t\trules.push(`.${className} { ${declarations}; }`);\n\t\t}\n\t\treturn rules.join('\\n');\n\t}\n\n\t/**\n\t * Returns a map from class name → CSS declarations for round-trip support.\n\t * Used by `setContentHTML` to rehydrate class-based HTML.\n\t */\n\ttoStyleMap(): ReadonlyMap<string, string> {\n\t\tconst map = new Map<string, string>();\n\t\tfor (const [declarations, className] of this.classMap) {\n\t\t\tmap.set(className, declarations);\n\t\t}\n\t\treturn map;\n\t}\n}\n","/**\n * MarkSerializer: shared mark serialization logic for DocumentSerializer and ClipboardHandler.\n * Separates style-based marks (merged into a single `<span style>`) from tag-based marks\n * (nested wrappers in rank order).\n */\n\nimport type { Mark } from '../model/Document.js';\nimport { escapeHTML } from '../model/HTMLUtils.js';\nimport type { MarkSpec } from '../model/MarkSpec.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport type { CSSClassCollector } from './CSSClassCollector.js';\n\n/** Builds a map of mark type name to rank from the registry (compute once per pass). */\nexport function buildMarkOrder(registry: SchemaRegistry): Map<string, number> {\n\tconst types: readonly string[] = registry.getMarkTypes();\n\tconst order = new Map<string, number>();\n\tfor (const t of types) {\n\t\tconst spec: MarkSpec | undefined = registry.getMarkSpec(t);\n\t\tif (spec) order.set(t, spec.rank ?? 99);\n\t}\n\treturn order;\n}\n\n/**\n * Serializes text with marks to HTML.\n * Style-based marks (`toHTMLStyle`) are merged into a single `<span style=\"...\">`.\n * Tag-based marks (`toHTMLString`) wrap the content in rank order.\n */\nexport function serializeMarksToHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\tif (text === '') return '';\n\n\tlet html: string = escapeHTML(text);\n\n\tif (marks.length === 0) return html;\n\n\tconst order: Map<string, number> = markOrder ?? buildMarkOrder(registry);\n\tconst sortedMarks: Mark[] = [...marks].sort(\n\t\t(a, b) => (order.get(a.type) ?? 99) - (order.get(b.type) ?? 99),\n\t);\n\n\tconst styleParts: string[] = [];\n\tconst tagMarks: Mark[] = [];\n\n\tfor (const mark of sortedMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLStyle) {\n\t\t\tconst style: string | null = markSpec.toHTMLStyle(mark);\n\t\t\tif (style) {\n\t\t\t\tstyleParts.push(style);\n\t\t\t}\n\t\t} else {\n\t\t\ttagMarks.push(mark);\n\t\t}\n\t}\n\n\t// Wrap with merged style span first (closest to text)\n\tif (styleParts.length > 0) {\n\t\tconst declarations: string = styleParts.join('; ');\n\t\tconst attr: string = exportCtx ? exportCtx.styleAttr(declarations) : ` style=\"${declarations}\"`;\n\t\tif (attr) {\n\t\t\thtml = `<span${attr}>${html}</span>`;\n\t\t}\n\t}\n\n\t// Then wrap with tag-based marks in rank order\n\tfor (const mark of tagMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLString) {\n\t\t\thtml = markSpec.toHTMLString(mark, html, exportCtx);\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/**\n * Serializes text with marks to HTML using CSS class names instead of inline styles.\n * Style-based marks (`toHTMLStyle`) are collected into a `CSSClassCollector` and emitted\n * as `<span class=\"...\">`. Tag-based marks (`toHTMLString`) wrap identically to the inline path.\n */\nexport function serializeMarksToClassHTML(\n\ttext: string,\n\tmarks: readonly Mark[],\n\tregistry: SchemaRegistry,\n\tcollector: CSSClassCollector,\n\tmarkOrder?: Map<string, number>,\n\texportCtx?: HTMLExportContext,\n): string {\n\tif (text === '') return '';\n\n\tlet html: string = escapeHTML(text);\n\n\tif (marks.length === 0) return html;\n\n\tconst order: Map<string, number> = markOrder ?? buildMarkOrder(registry);\n\tconst sortedMarks: Mark[] = [...marks].sort(\n\t\t(a, b) => (order.get(a.type) ?? 99) - (order.get(b.type) ?? 99),\n\t);\n\n\tconst styleParts: string[] = [];\n\tconst tagMarks: Mark[] = [];\n\n\tfor (const mark of sortedMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLStyle) {\n\t\t\tconst style: string | null = markSpec.toHTMLStyle(mark);\n\t\t\tif (style) {\n\t\t\t\tstyleParts.push(style);\n\t\t\t}\n\t\t} else {\n\t\t\ttagMarks.push(mark);\n\t\t}\n\t}\n\n\t// Wrap with class-based span (closest to text)\n\tif (styleParts.length > 0) {\n\t\tconst declarations: string = styleParts.join('; ');\n\t\tconst className: string = collector.getClassName(declarations);\n\t\thtml = `<span class=\"${className}\">${html}</span>`;\n\t}\n\n\t// Then wrap with tag-based marks in rank order\n\tfor (const mark of tagMarks) {\n\t\tconst markSpec: MarkSpec | undefined = registry.getMarkSpec(mark.type);\n\t\tif (markSpec?.toHTMLString) {\n\t\t\thtml = markSpec.toHTMLString(mark, html, exportCtx);\n\t\t}\n\t}\n\n\treturn html;\n}\n","/**\n * DocumentSerializer: converts an immutable Document into sanitized HTML.\n * Pure functions — operates on Document/SchemaRegistry, no class state.\n */\n\nimport DOMPurify from 'dompurify';\nimport { isNodeOfType } from '../model/AttrRegistry.js';\nimport type { BlockNode, Document, InlineNode, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockChildren,\n\tgetInlineChildren,\n\tisInlineNode,\n\tisLeafBlock,\n\tisTextNode,\n\tmarkSetsEqual,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP, escapeAttr, escapeHTML } from '../model/HTMLUtils.js';\nimport type { HTMLExportContext } from '../model/NodeSpec.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { isSafeBlockId } from './BlockIdHTML.js';\nimport { CSSClassCollector } from './CSSClassCollector.js';\nimport type { ContentCSSResult } from './ContentHTMLTypes.js';\nimport {\n\tbuildMarkOrder,\n\tserializeMarksToClassHTML,\n\tserializeMarksToHTML,\n} from './MarkSerializer.js';\n\n/** Internal context threaded through all serialization helpers. */\ninterface SerializerContext {\n\treadonly registry?: SchemaRegistry;\n\treadonly collector?: CSSClassCollector;\n\treadonly exportCtx?: HTMLExportContext;\n}\n\n/** Known-safe alignment values accepted by the serializer (defense-in-depth). */\nexport const VALID_ALIGNMENTS: ReadonlySet<string> = new Set(['start', 'center', 'end', 'justify']);\n\n/** Legacy physical → logical alignment mapping (mirrors DocumentParser). */\nconst LEGACY_ALIGNMENT_MAP: Readonly<Record<string, string>> = { left: 'start', right: 'end' };\n\n/** Known-safe direction values (defense-in-depth). `auto` is excluded — it's the default. */\nexport const VALID_DIRECTIONS: ReadonlySet<string> = new Set(['ltr', 'rtl']);\n\n/** Creates an HTMLExportContext for inline style mode. */\nfunction createInlineExportContext(): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tif (!declarations) return '';\n\t\t\treturn ` style=\"${declarations}\"`;\n\t\t},\n\t};\n}\n\n/** Creates an HTMLExportContext for CSS class mode. */\nfunction createClassExportContext(collector: CSSClassCollector): HTMLExportContext {\n\treturn {\n\t\tstyleAttr(declarations: string): string {\n\t\t\tif (!declarations) return '';\n\t\t\tconst className: string = collector.getClassName(declarations);\n\t\t\treturn ` class=\"${className}\"`;\n\t\t},\n\t};\n}\n\n/**\n * Injects or merges an attribute into the first opening tag of an HTML fragment.\n * Values are expected to be pre-escaped by the caller.\n */\nfunction injectAttrIntoFirstTag(html: string, attr: string, value: string): string {\n\tconst firstTagRange: { start: number; end: number } | undefined = findFirstOpeningTagRange(html);\n\tif (!firstTagRange) return html;\n\tconst firstTag: string = html.slice(firstTagRange.start, firstTagRange.end + 1);\n\tconst pattern: RegExp = new RegExp(`\\\\s${attr}\\\\s*=\\\\s*(\\\"([^\\\"]*)\\\"|'([^']*)')`);\n\tconst existing: RegExpMatchArray | null = firstTag.match(pattern);\n\tif (existing) {\n\t\tconst existingValue: string = existing[2] ?? existing[3] ?? '';\n\t\tif (attr === 'style' && /(?:^|;)\\s*text-align\\s*:/i.test(existingValue)) {\n\t\t\treturn html;\n\t\t}\n\t\tconst sep: string = attr === 'style' ? '; ' : ' ';\n\t\tconst mergedAttr: string = ` ${attr}=\"${existingValue}${sep}${value}\"`;\n\t\tconst nextFirstTag: string = firstTag.replace(pattern, mergedAttr);\n\t\treturn `${html.slice(0, firstTagRange.start)}${nextFirstTag}${html.slice(firstTagRange.end + 1)}`;\n\t}\n\tconst isSelfClosing: boolean = firstTag.endsWith('/>');\n\tconst injectedFirstTag: string = isSelfClosing\n\t\t? `${firstTag.slice(0, -2)} ${attr}=\"${value}\"/>`\n\t\t: `${firstTag.slice(0, -1)} ${attr}=\"${value}\">`;\n\treturn `${html.slice(0, firstTagRange.start)}${injectedFirstTag}${html.slice(firstTagRange.end + 1)}`;\n}\n\n/** Finds the first opening tag range, treating `>` inside quotes as attribute text. */\nfunction findFirstOpeningTagRange(html: string): { start: number; end: number } | undefined {\n\tlet start: number = html.indexOf('<');\n\twhile (start >= 0) {\n\t\tconst nextChar: string | undefined = html[start + 1];\n\t\tif (nextChar && /[A-Za-z]/.test(nextChar)) {\n\t\t\tlet quote: '\"' | \"'\" | undefined;\n\t\t\tfor (let i = start + 2; i < html.length; i++) {\n\t\t\t\tconst char: string = html[i] ?? '';\n\t\t\t\tif (quote) {\n\t\t\t\t\tif (char === quote) quote = undefined;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '\"' || char === \"'\") {\n\t\t\t\t\tquote = char;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (char === '>') {\n\t\t\t\t\treturn { start, end: i };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tstart = html.indexOf('<', start + 1);\n\t}\n\treturn undefined;\n}\n\n/** Serializes a full document to sanitized HTML, wrapping list items in `<ul>`/`<ol>`. */\nexport function serializeDocumentToHTML(doc: Document, registry?: SchemaRegistry): string {\n\tconst exportCtx: HTMLExportContext = createInlineExportContext();\n\tconst ctx: SerializerContext = { registry, exportCtx };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir'];\n\n\t// `data-block-id` carries block identity across content round-trips\n\t// (`setContentHTML(getContentHTML())`) — without it, the parser would generate\n\t// fresh IDs and any preserved selection would clamp to the document start.\n\tif (!allowedAttrs.includes('data-block-id')) {\n\t\tallowedAttrs.push('data-block-id');\n\t}\n\n\treturn DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: allowedAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t});\n}\n\n/**\n * Serializes a document to HTML with CSS class names instead of inline styles.\n * Returns the HTML and a collected stylesheet with only the rules actually used.\n */\nexport function serializeDocumentToCSS(doc: Document, registry?: SchemaRegistry): ContentCSSResult {\n\tconst collector = new CSSClassCollector();\n\tconst exportCtx: HTMLExportContext = createClassExportContext(collector);\n\tconst ctx: SerializerContext = { registry, collector, exportCtx };\n\tconst html: string = serializeBlocks(doc.children, ctx);\n\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'class', 'dir'];\n\n\t// In class mode, allow `class` attribute through DOMPurify\n\tif (!allowedAttrs.includes('class')) {\n\t\tallowedAttrs.push('class');\n\t}\n\n\t// `data-block-id` carries block identity across content round-trips. See\n\t// note in `serializeDocumentToHTML`.\n\tif (!allowedAttrs.includes('data-block-id')) {\n\t\tallowedAttrs.push('data-block-id');\n\t}\n\n\t// Defense-in-depth: strip `style` attribute in class mode to guarantee\n\t// zero inline styles — even from third-party plugins that forgot to use ctx.styleAttr().\n\tconst filteredAttrs: string[] = allowedAttrs.filter((a) => a !== 'style');\n\n\tconst sanitizedHTML: string = DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: filteredAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t});\n\n\treturn { html: sanitizedHTML, css: collector.toCSS(), styleMap: collector.toStyleMap() };\n}\n\n/** Serializes a sequence of blocks to HTML, grouping consecutive list items into wrappers. */\nfunction serializeBlocks(blocks: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tlet i = 0;\n\n\twhile (i < blocks.length) {\n\t\tconst block: BlockNode | undefined = blocks[i];\n\t\tif (!block) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isNodeOfType(block, 'list_item')) {\n\t\t\t// Collect consecutive list items\n\t\t\tconst listItems: BlockNode[] = [];\n\t\t\twhile (i < blocks.length) {\n\t\t\t\tconst item: BlockNode | undefined = blocks[i];\n\t\t\t\tif (!item || !isNodeOfType(item, 'list_item')) break;\n\t\t\t\tlistItems.push(item);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tparts.push(serializeListGroup(listItems, ctx));\n\t\t} else {\n\t\t\tparts.push(serializeBlock(block, ctx));\n\t\t\ti++;\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Serializes a group of consecutive list items into properly nested `<ul>`/`<ol>` wrappers.\n * Uses a stack-based algorithm to handle indent-based nesting.\n * Produces valid HTML5: nested lists open *inside* the parent `<li>`.\n */\nfunction serializeListGroup(items: readonly BlockNode[], ctx: SerializerContext): string {\n\tconst parts: string[] = [];\n\tconst stack: { tag: string; indent: number }[] = [];\n\n\tfor (let idx = 0; idx < items.length; idx++) {\n\t\tconst item: BlockNode | undefined = items[idx];\n\t\tif (!item) continue;\n\n\t\tconst listType: string = (item.attrs?.listType as string) ?? 'bullet';\n\t\tconst indent: number = (item.attrs?.indent as number) ?? 0;\n\t\tconst tag: string = listType === 'ordered' ? 'ol' : 'ul';\n\t\t// Pop wrapper levels that are deeper than current indent,\n\t\t// or at the same level when the tag type changes\n\t\twhile (stack.length > 0) {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (!top) break;\n\n\t\t\tif (top.indent > indent) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else if (top.indent === indent && top.tag !== tag) {\n\t\t\t\tparts.push(`</${top.tag}></li>`);\n\t\t\t\tstack.pop();\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (stack.length === 0) {\n\t\t\tparts.push(`<${tag}>`);\n\t\t\tstack.push({ tag, indent });\n\t\t} else {\n\t\t\tconst top = stack[stack.length - 1];\n\t\t\tif (top && indent > top.indent) {\n\t\t\t\tparts.push(`<${tag}>`);\n\t\t\t\tstack.push({ tag, indent });\n\t\t\t}\n\t\t}\n\n\t\tconst content: string = serializeBlock(item, ctx);\n\n\t\t// Look ahead: if the next item is deeper, strip </li> so the nested\n\t\t// list opens inside this <li> (valid HTML5 nesting).\n\t\tconst nextItem: BlockNode | undefined = items[idx + 1];\n\t\tconst nextIndent: number | undefined = nextItem\n\t\t\t? ((nextItem.attrs?.indent as number) ?? 0)\n\t\t\t: undefined;\n\n\t\tif (nextIndent !== undefined && nextIndent > indent) {\n\t\t\tparts.push(stripTrailingLiClose(content));\n\t\t} else {\n\t\t\tparts.push(content);\n\t\t}\n\t}\n\n\t// Close all remaining open wrappers\n\twhile (stack.length > 0) {\n\t\tconst top = stack.pop();\n\t\tif (!top) break;\n\t\tparts.push(`</${top.tag}>`);\n\t\tif (stack.length > 0) {\n\t\t\tparts.push('</li>');\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/** Removes the trailing `</li>` from serialized list item HTML. */\nfunction stripTrailingLiClose(html: string): string {\n\tconst suffix = '</li>';\n\tif (html.endsWith(suffix)) {\n\t\treturn html.slice(0, -suffix.length);\n\t}\n\treturn html;\n}\n\n/** Serializes a single block to HTML using its NodeSpec. */\nfunction serializeBlock(block: BlockNode, ctx: SerializerContext): string {\n\tconst content: string = isLeafBlock(block)\n\t\t? serializeInlineContent(block, ctx)\n\t\t: serializeBlocks(getBlockChildren(block), ctx);\n\tconst spec = ctx.registry?.getNodeSpec(block.type);\n\n\tlet html: string;\n\tif (spec?.toHTML) {\n\t\thtml = spec.toHTML(block, content, ctx.exportCtx);\n\t} else {\n\t\thtml = `<p>${content || '<br>'}</p>`;\n\t}\n\n\t// Centrally inject `data-block-id` so each `NodeSpec.toHTML` is relieved of\n\t// the responsibility — and the round-trip identity contract holds for every\n\t// block type, including ones added by future plugins. The serializer's\n\t// allowlist passes `data-block-id` through DOMPurify. Skip if the spec\n\t// already emits one (mirrors the existing `dir` defense-in-depth pattern).\n\t// `escapeAttr` is defense-in-depth — `isSafeBlockId` already excludes any\n\t// character that would need escaping.\n\tif (isSafeBlockId(block.id)) {\n\t\tconst firstTagEnd: number = html.indexOf('>');\n\t\tconst firstTag: string = html.slice(0, firstTagEnd + 1);\n\t\tif (!firstTag.includes(' data-block-id=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'data-block-id', escapeAttr(block.id));\n\t\t}\n\t}\n\n\t// Inject alignment into the first opening tag (validated against allowlist).\n\tconst rawAlign: string | undefined = (block.attrs as Record<string, unknown>)?.align as\n\t\t| string\n\t\t| undefined;\n\tconst align: string | undefined = rawAlign\n\t\t? (LEGACY_ALIGNMENT_MAP[rawAlign] ?? rawAlign)\n\t\t: undefined;\n\tif (align && align !== 'start' && VALID_ALIGNMENTS.has(align)) {\n\t\tconst safeAlign: string = escapeAttr(align);\n\t\tif (ctx.collector) {\n\t\t\tconst className: string = ctx.collector.getAlignmentClassName(align);\n\t\t\thtml = injectAttrIntoFirstTag(html, 'class', escapeAttr(className));\n\t\t} else {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'style', `text-align: ${safeAlign}`);\n\t\t}\n\t}\n\n\t// Defense-in-depth: inject dir into the first opening tag if not already present.\n\t// NodeSpec toHTML may already inject it; this ensures it survives even without a plugin.\n\tconst dir: string | undefined = (block.attrs as Record<string, unknown>)?.dir as\n\t\t| string\n\t\t| undefined;\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tconst firstTagEnd: number = html.indexOf('>');\n\t\tconst firstTag: string = html.slice(0, firstTagEnd + 1);\n\t\tif (!firstTag.includes(' dir=')) {\n\t\t\thtml = injectAttrIntoFirstTag(html, 'dir', escapeAttr(dir));\n\t\t}\n\t}\n\n\treturn html;\n}\n\n/** Serializes inline children (TextNode + InlineNode) of a block. */\nfunction serializeInlineContent(block: BlockNode, ctx: SerializerContext): string {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tconst merged: readonly (TextNode | InlineNode)[] = mergeAdjacentTextNodes(children);\n\tconst parts: string[] = [];\n\tconst markOrder: Map<string, number> | undefined = ctx.registry\n\t\t? buildMarkOrder(ctx.registry)\n\t\t: undefined;\n\n\tfor (const child of merged) {\n\t\tif (isInlineNode(child)) {\n\t\t\tconst inlineSpec = ctx.registry?.getInlineNodeSpec(child.inlineType);\n\t\t\tif (inlineSpec?.toHTMLString) {\n\t\t\t\tparts.push(inlineSpec.toHTMLString(child));\n\t\t\t}\n\t\t} else if (ctx.registry && ctx.collector) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToClassHTML(\n\t\t\t\t\tchild.text,\n\t\t\t\t\tchild.marks,\n\t\t\t\t\tctx.registry,\n\t\t\t\t\tctx.collector,\n\t\t\t\t\tmarkOrder,\n\t\t\t\t\tctx.exportCtx,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (ctx.registry) {\n\t\t\tparts.push(\n\t\t\t\tserializeMarksToHTML(child.text, child.marks, ctx.registry, markOrder, ctx.exportCtx),\n\t\t\t);\n\t\t} else if (child.text !== '') {\n\t\t\tparts.push(escapeHTML(child.text));\n\t\t}\n\t}\n\n\treturn parts.join('');\n}\n\n/**\n * Merges adjacent TextNodes that share identical mark sets.\n * InlineNodes act as merge boundaries.\n */\nfunction mergeAdjacentTextNodes(\n\tchildren: readonly (TextNode | InlineNode)[],\n): readonly (TextNode | InlineNode)[] {\n\tif (children.length <= 1) return children;\n\n\tconst result: (TextNode | InlineNode)[] = [];\n\n\tfor (const child of children) {\n\t\tif (isInlineNode(child)) {\n\t\t\tresult.push(child);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst prev: TextNode | InlineNode | undefined = result[result.length - 1];\n\t\tif (prev && isTextNode(prev) && markSetsEqual(prev.marks, child.marks)) {\n\t\t\tresult[result.length - 1] = {\n\t\t\t\ttype: 'text',\n\t\t\t\ttext: prev.text + child.text,\n\t\t\t\tmarks: prev.marks,\n\t\t\t};\n\t\t} else {\n\t\t\tresult.push(child);\n\t\t}\n\t}\n\n\treturn result;\n}\n","/**\n * DocumentParser: converts sanitized HTML strings into immutable Document instances.\n * Pure functions — no class state, no DOM mutation beyond a temporary `<template>`.\n */\n\nimport DOMPurify from 'dompurify';\nimport type { BlockNode, Document, InlineNode, Mark, TextNode } from '../model/Document.js';\nimport {\n\tcreateBlockNode,\n\tcreateDocument,\n\tcreateInlineNode,\n\tcreateTextNode,\n\tisInlineNode,\n} from '../model/Document.js';\nimport { SAFE_URI_REGEXP } from '../model/HTMLUtils.js';\nimport type { ParseRule } from '../model/ParseRule.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport { type InlineTypeName, inlineType, markType, nodeType } from '../model/TypeBrands.js';\nimport { adoptBlockId } from './BlockIdHTML.js';\nimport { VALID_ALIGNMENTS, VALID_DIRECTIONS } from './DocumentSerializer.js';\n\n/** Options for `parseHTMLToDocument` when importing class-based HTML. */\nexport interface ParseHTMLOptions {\n\t/**\n\t * Style map from a previous `getContentHTML({ cssMode: 'classes' })` call.\n\t * Used to rehydrate class-based HTML back into styled content.\n\t */\n\treadonly styleMap?: ReadonlyMap<string, string>;\n}\n\n/** Parses an HTML string into a Document, applying sanitization and schema parse rules. */\nexport function parseHTMLToDocument(\n\thtml: string,\n\tregistry?: SchemaRegistry,\n\toptions?: ParseHTMLOptions,\n): Document {\n\tconst allowedTags: string[] = registry ? registry.getAllowedTags() : ['p', 'br', 'div', 'span'];\n\tconst allowedAttrs: string[] = registry ? registry.getAllowedAttrs() : ['style', 'dir'];\n\n\t// `data-block-id` carries block identity across `setContentHTML(getContentHTML())`.\n\t// Whitelist it through DOMPurify so the adoption logic below sees it.\n\tif (!allowedAttrs.includes('data-block-id')) {\n\t\tallowedAttrs.push('data-block-id');\n\t}\n\n\t// When a styleMap is provided, also allow `class` through DOMPurify\n\t// so we can read class names and rehydrate styles before parsing.\n\tif (options?.styleMap && !allowedAttrs.includes('class')) {\n\t\tallowedAttrs.push('class');\n\t}\n\n\tconst template = document.createElement('template');\n\ttemplate.innerHTML = DOMPurify.sanitize(html, {\n\t\tALLOWED_TAGS: allowedTags,\n\t\tALLOWED_ATTR: allowedAttrs,\n\t\tALLOWED_URI_REGEXP: SAFE_URI_REGEXP,\n\t});\n\tconst root: DocumentFragment = template.content;\n\n\t// Rehydrate class-based HTML: convert notectl class names back to inline styles\n\tif (options?.styleMap) {\n\t\trehydrateClasses(root, options.styleMap);\n\t}\n\n\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst blocks: BlockNode[] = [];\n\tconst adoptedIds = new Set<string>();\n\n\tfor (const child of Array.from(root.childNodes)) {\n\t\tparseChildNode(child, blocks, blockRules, adoptedIds, registry);\n\t}\n\n\tif (blocks.length === 0) return createDocument();\n\treturn createDocument(blocks);\n}\n\n/**\n * Parses a single child node into block(s), handling all supported block types:\n * lists, tables, block parse rules (headings, blockquotes, code blocks, images, hr),\n * and fallback paragraphs. Used by both top-level parsing and table cell content parsing.\n */\nfunction parseChildNode(\n\tchild: ChildNode,\n\tblocks: BlockNode[],\n\tblockRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n): void {\n\tif (child.nodeType === Node.ELEMENT_NODE) {\n\t\tconst el = child as HTMLElement;\n\t\tconst tag: string = el.tagName.toLowerCase();\n\n\t\t// Lists need cross-element logic — handle before parse rules\n\t\tif (tag === 'ul' || tag === 'ol') {\n\t\t\tconst listType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst listDir: string | null = el.getAttribute('dir');\n\t\t\tconst parentDir: string | undefined =\n\t\t\t\tlistDir && VALID_DIRECTIONS.has(listDir) ? listDir : undefined;\n\t\t\tparseListElement(el, listType, 0, blocks, adoptedIds, registry, parentDir);\n\t\t\treturn;\n\t\t}\n\n\t\t// Tables produce nested block structure: table > table_row > table_cell > paragraph\n\t\tif (tag === 'table') {\n\t\t\tparseTableElement(el, blocks, adoptedIds, registry);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try block parse rules\n\t\tconst match = matchBlockParseRule(el, blockRules);\n\t\tif (match) {\n\t\t\tconst spec = registry?.getNodeSpec(match.type);\n\t\t\tconst children: (TextNode | InlineNode)[] = spec?.isVoid\n\t\t\t\t? [createTextNode('')]\n\t\t\t\t: parseElementToInlineContent(el, registry);\n\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t...(match.attrs as Record<string, string | number | boolean> | undefined),\n\t\t\t};\n\t\t\tif (spec?.attrs?.align) {\n\t\t\t\textractAlignment(el, attrs);\n\t\t\t}\n\t\t\tif (spec?.attrs?.dir) {\n\t\t\t\textractDirection(el, attrs);\n\t\t\t}\n\t\t\tblocks.push(\n\t\t\t\tcreateBlockNode(\n\t\t\t\t\tnodeType(match.type),\n\t\t\t\t\tchildren,\n\t\t\t\t\tadoptBlockId(el, adoptedIds),\n\t\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Fallback to paragraph\n\t\tconst inlineContent = parseElementToInlineContent(el, registry);\n\t\tconst attrs: Record<string, string | number | boolean> = {};\n\t\textractAlignment(el, attrs);\n\t\textractDirection(el, attrs);\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('paragraph'),\n\t\t\t\tinlineContent,\n\t\t\t\tadoptBlockId(el, adoptedIds),\n\t\t\t\tObject.keys(attrs).length > 0 ? attrs : undefined,\n\t\t\t),\n\t\t);\n\t} else if (child.nodeType === Node.TEXT_NODE && child.textContent?.trim()) {\n\t\tblocks.push(createBlockNode(nodeType('paragraph'), [createTextNode(child.textContent.trim())]));\n\t}\n}\n\n/**\n * Recursively parses a list element (`<ul>` or `<ol>`), creating list_item blocks\n * with correct indent depth. Handles nested lists inside `<li>` elements.\n */\nfunction parseListElement(\n\tlistEl: Element,\n\tlistType: string,\n\tdepth: number,\n\tblocks: BlockNode[],\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n\tparentDir?: string,\n): void {\n\tfor (const child of Array.from(listEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\n\t\tif (tag === 'li') {\n\t\t\tconst li: HTMLElement = child as HTMLElement;\n\n\t\t\t// Check for checklist: <input type=\"checkbox\">\n\t\t\tconst checkbox: HTMLInputElement | null = li.querySelector(':scope > input[type=\"checkbox\"]');\n\t\t\tconst isChecklist: boolean = checkbox !== null;\n\t\t\tconst checked: boolean = checkbox?.hasAttribute('checked') ?? false;\n\n\t\t\tconst resolvedType: string = isChecklist ? 'checklist' : listType;\n\n\t\t\tconst inlineContent = parseElementToInlineContent(li, registry, true);\n\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\tlistType: resolvedType,\n\t\t\t\tindent: depth,\n\t\t\t\tchecked,\n\t\t\t};\n\n\t\t\t// Propagate direction: item's own dir > parent list dir\n\t\t\tconst liDir: string | null = li.getAttribute('dir');\n\t\t\tconst effectiveDir: string | undefined =\n\t\t\t\tliDir && VALID_DIRECTIONS.has(liDir) ? liDir : parentDir;\n\t\t\tif (effectiveDir) {\n\t\t\t\tattrs.dir = effectiveDir;\n\t\t\t}\n\n\t\t\tblocks.push(\n\t\t\t\tcreateBlockNode(nodeType('list_item'), inlineContent, adoptBlockId(li, adoptedIds), attrs),\n\t\t\t);\n\n\t\t\t// Check for nested lists inside this <li>\n\t\t\tfor (const liChild of Array.from(li.children)) {\n\t\t\t\tconst liChildTag: string = liChild.tagName.toLowerCase();\n\t\t\t\tif (liChildTag === 'ul' || liChildTag === 'ol') {\n\t\t\t\t\tconst nestedType: string = liChildTag === 'ol' ? 'ordered' : 'bullet';\n\t\t\t\t\tconst nestedDir: string | null = liChild.getAttribute('dir');\n\t\t\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : effectiveDir;\n\t\t\t\t\tparseListElement(\n\t\t\t\t\t\tliChild,\n\t\t\t\t\t\tnestedType,\n\t\t\t\t\t\tdepth + 1,\n\t\t\t\t\t\tblocks,\n\t\t\t\t\t\tadoptedIds,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t\tnestedEffectiveDir,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (tag === 'ul' || tag === 'ol') {\n\t\t\t// Direct nested list without wrapping <li> — increment depth\n\t\t\tconst nestedType: string = tag === 'ol' ? 'ordered' : 'bullet';\n\t\t\tconst nestedDir: string | null = child.getAttribute('dir');\n\t\t\tconst nestedEffectiveDir: string | undefined =\n\t\t\t\tnestedDir && VALID_DIRECTIONS.has(nestedDir) ? nestedDir : parentDir;\n\t\t\tparseListElement(\n\t\t\t\tchild,\n\t\t\t\tnestedType,\n\t\t\t\tdepth + 1,\n\t\t\t\tblocks,\n\t\t\t\tadoptedIds,\n\t\t\t\tregistry,\n\t\t\t\tnestedEffectiveDir,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Parses a `<table>` element into nested block structure:\n * table > table_row > table_cell > paragraph.\n * Handles `<thead>`, `<tbody>`, `<tfoot>` transparently.\n */\nfunction parseTableElement(\n\ttableEl: Element,\n\tblocks: BlockNode[],\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n): void {\n\tconst rows: BlockNode[] = [];\n\n\t// Collect <tr> elements, handling <thead>/<tbody>/<tfoot> wrappers\n\tconst rowElements: Element[] = collectTableRows(tableEl);\n\n\tfor (const trEl of rowElements) {\n\t\tconst cells: BlockNode[] = [];\n\n\t\tfor (const cellChild of Array.from(trEl.children)) {\n\t\t\tconst cellTag: string = cellChild.tagName.toLowerCase();\n\t\t\tif (cellTag !== 'td' && cellTag !== 'th') continue;\n\n\t\t\tconst cellEl: HTMLElement = cellChild as HTMLElement;\n\t\t\tconst cellContent: BlockNode[] = parseTableCellContent(cellEl, adoptedIds, registry);\n\t\t\tconst cellAttrs: Record<string, string | number | boolean> = {};\n\t\t\textractCellSpanAttrs(cellEl, cellAttrs);\n\t\t\tconst cellBlock: BlockNode = createBlockNode(\n\t\t\t\tnodeType('table_cell'),\n\t\t\t\tcellContent,\n\t\t\t\tadoptBlockId(cellEl, adoptedIds),\n\t\t\t\tObject.keys(cellAttrs).length > 0 ? cellAttrs : undefined,\n\t\t\t);\n\t\t\tcells.push(cellBlock);\n\t\t}\n\n\t\tif (cells.length > 0) {\n\t\t\trows.push(createBlockNode(nodeType('table_row'), cells, adoptBlockId(trEl, adoptedIds)));\n\t\t}\n\t}\n\n\tif (rows.length > 0) {\n\t\tconst tableAttrs: Record<string, string | number | boolean> = {};\n\t\textractTableBorderColor(tableEl as HTMLElement, tableAttrs);\n\t\tblocks.push(\n\t\t\tcreateBlockNode(\n\t\t\t\tnodeType('table'),\n\t\t\t\trows,\n\t\t\t\tadoptBlockId(tableEl, adoptedIds),\n\t\t\t\tObject.keys(tableAttrs).length > 0 ? tableAttrs : undefined,\n\t\t\t),\n\t\t);\n\t}\n}\n\n/** Collects `<tr>` elements from a table, traversing through `<thead>`/`<tbody>`/`<tfoot>`. */\nfunction collectTableRows(tableEl: Element): Element[] {\n\tconst rows: Element[] = [];\n\tfor (const child of Array.from(tableEl.children)) {\n\t\tconst tag: string = child.tagName.toLowerCase();\n\t\tif (tag === 'tr') {\n\t\t\trows.push(child);\n\t\t} else if (tag === 'thead' || tag === 'tbody' || tag === 'tfoot') {\n\t\t\tfor (const nested of Array.from(child.children)) {\n\t\t\t\tif (nested.tagName.toLowerCase() === 'tr') {\n\t\t\t\t\trows.push(nested);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn rows;\n}\n\n/** Regex to extract the `--ntbl-bc` CSS custom property from inline styles. */\nconst BORDER_COLOR_RE = /--ntbl-bc:\\s*(#[0-9a-fA-F]{3,8}|transparent)/;\n\n/** Extracts `borderColor` from a table element's inline style (`--ntbl-bc` CSS variable). */\nfunction extractTableBorderColor(\n\tel: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst style: string = el.getAttribute('style') ?? '';\n\tconst match: RegExpMatchArray | null = BORDER_COLOR_RE.exec(style);\n\tif (!match?.[1]) return;\n\tattrs.borderColor = match[1] === 'transparent' ? 'none' : match[1];\n}\n\n/** Extracts `colspan` and `rowspan` attributes from a table cell element. */\nfunction extractCellSpanAttrs(\n\tel: HTMLElement,\n\tattrs: Record<string, string | number | boolean>,\n): void {\n\tconst colspan: string | null = el.getAttribute('colspan');\n\tif (colspan) {\n\t\tconst value: number = Number.parseInt(colspan, 10);\n\t\tif (value > 1) attrs.colspan = value;\n\t}\n\tconst rowspan: string | null = el.getAttribute('rowspan');\n\tif (rowspan) {\n\t\tconst value: number = Number.parseInt(rowspan, 10);\n\t\tif (value > 1) attrs.rowspan = value;\n\t}\n}\n\n/** Parses a table cell's content into blocks, supporting all block types (lists, quotes, etc.). */\nfunction parseTableCellContent(\n\tcellEl: HTMLElement,\n\tadoptedIds: Set<string>,\n\tregistry?: SchemaRegistry,\n): BlockNode[] {\n\tconst blockRules = registry?.getBlockParseRules() ?? [];\n\tconst cellBlocks: BlockNode[] = [];\n\n\tfor (const child of Array.from(cellEl.childNodes)) {\n\t\tparseChildNode(child, cellBlocks, blockRules, adoptedIds, registry);\n\t}\n\n\t// No blocks produced: treat entire cell content as one paragraph\n\tif (cellBlocks.length === 0) {\n\t\tconst inlineContent = parseElementToInlineContent(cellEl, registry);\n\t\tcellBlocks.push(createBlockNode(nodeType('paragraph'), inlineContent));\n\t}\n\n\treturn cellBlocks;\n}\n\n/**\n * Parses an HTML element's inline children into (TextNode | InlineNode)[].\n * Applies mark parse rules and inline node parse rules.\n */\nfunction parseElementToInlineContent(\n\tel: HTMLElement,\n\tregistry?: SchemaRegistry,\n\tskipNestedLists?: boolean,\n): (TextNode | InlineNode)[] {\n\tconst result: (TextNode | InlineNode)[] = [];\n\tconst markRules = registry?.getMarkParseRules() ?? [];\n\tconst inlineRules = registry?.getInlineParseRules() ?? [];\n\twalkElement(el, [], result, markRules, inlineRules, skipNestedLists);\n\n\t// A lone <br> as the only content of a block is a placeholder for an empty\n\t// paragraph (e.g. `<p><br></p>`), not a real hard break. Normalize to empty text.\n\tif (result.length === 1 && isInlineNode(result[0]) && result[0].inlineType === 'hard_break') {\n\t\treturn [createTextNode('')];\n\t}\n\n\treturn result.length > 0 ? result : [createTextNode('')];\n}\n\n/**\n * Recursively walks DOM nodes, collecting marks from parse rules,\n * matching inline node parse rules, and producing TextNodes/InlineNodes.\n */\nfunction walkElement(\n\tnode: Node,\n\tcurrentMarks: Mark[],\n\tresult: (TextNode | InlineNode)[],\n\tmarkRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tinlineRules: readonly { readonly rule: ParseRule; readonly type: string }[],\n\tskipNestedLists?: boolean,\n): void {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\tconst text: string = node.textContent ?? '';\n\t\tif (text) {\n\t\t\tresult.push(createTextNode(text, [...currentMarks]));\n\t\t}\n\t\treturn;\n\t}\n\n\tif (node.nodeType !== Node.ELEMENT_NODE) return;\n\n\tconst el = node as HTMLElement;\n\tconst tag: string = el.tagName.toLowerCase();\n\n\t// Skip nested lists inside <li> (handled by parseListElement)\n\tif (skipNestedLists && (tag === 'ul' || tag === 'ol')) return;\n\n\t// Skip checkbox inputs inside list items (already handled by parseListElement)\n\tif (skipNestedLists && tag === 'input' && el.getAttribute('type') === 'checkbox') return;\n\n\t// Try inline node parse rules first (atomic — no recursion)\n\tfor (const entry of inlineRules) {\n\t\tif (entry.rule.tag !== tag) continue;\n\n\t\tif (entry.rule.getAttrs) {\n\t\t\tconst attrs = entry.rule.getAttrs(el);\n\t\t\tif (attrs === false) continue;\n\t\t\tresult.push(\n\t\t\t\tcreateInlineNode(\n\t\t\t\t\tinlineType(entry.type) as InlineTypeName,\n\t\t\t\t\tattrs as Readonly<Record<string, string | number | boolean>>,\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tresult.push(createInlineNode(inlineType(entry.type) as InlineTypeName));\n\t\treturn;\n\t}\n\n\tconst marks: Mark[] = [...currentMarks];\n\n\t// Try mark parse rules — collect all matching marks for this element\n\tconst matchedTypes = new Set<string>();\n\tfor (const entry of markRules) {\n\t\tif (entry.rule.tag !== tag) continue;\n\t\tif (matchedTypes.has(entry.type)) continue;\n\n\t\tif (entry.rule.getAttrs) {\n\t\t\tconst attrs = entry.rule.getAttrs(el);\n\t\t\tif (attrs === false) continue;\n\t\t\tif (!marks.some((m) => m.type === entry.type)) {\n\t\t\t\tmarks.push({\n\t\t\t\t\ttype: markType(entry.type),\n\t\t\t\t\t...(Object.keys(attrs).length > 0 ? { attrs } : {}),\n\t\t\t\t} as Mark);\n\t\t\t\tmatchedTypes.add(entry.type);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!marks.some((m) => m.type === entry.type)) {\n\t\t\t\tmarks.push({ type: markType(entry.type) });\n\t\t\t\tmatchedTypes.add(entry.type);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const child of Array.from(el.childNodes)) {\n\t\twalkElement(child, marks, result, markRules, inlineRules, skipNestedLists);\n\t}\n}\n\n/** Extracts a validated `dir` attribute or inline `direction` style from an element. */\nfunction extractDirection(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\tconst dir: string | null = el.getAttribute('dir');\n\tif (dir && VALID_DIRECTIONS.has(dir)) {\n\t\tattrs.dir = dir;\n\t\treturn;\n\t}\n\n\t// Fallback: check inline style `direction: rtl/ltr` (common in paste from Word/Docs)\n\tconst styleDir: string = el.style?.direction ?? '';\n\tif (styleDir && VALID_DIRECTIONS.has(styleDir)) {\n\t\tattrs.dir = styleDir;\n\t}\n}\n\n/** Legacy physical → logical alignment mapping for backward-compatible parsing. */\nconst LEGACY_ALIGNMENT_MAP: Readonly<Record<string, string>> = { left: 'start', right: 'end' };\n\n/** Extracts validated `text-align` from an element's style or class and adds it to attrs. */\nfunction extractAlignment(el: HTMLElement, attrs: Record<string, string | number | boolean>): void {\n\t// Check inline style first (works for both normal and rehydrated HTML)\n\tlet align: string = el.style?.textAlign ?? '';\n\tconst mappedAlign: string | undefined = LEGACY_ALIGNMENT_MAP[align];\n\tif (mappedAlign) align = mappedAlign;\n\tif (align && VALID_ALIGNMENTS.has(align)) {\n\t\tattrs.align = align;\n\t\treturn;\n\t}\n\n\t// Check for notectl-align-* class names (from class-based HTML)\n\tfor (const cls of Array.from(el.classList)) {\n\t\tconst match: RegExpMatchArray | null = cls.match(/^notectl-align-(\\w+)$/);\n\t\tlet alignValue: string | undefined = match?.[1];\n\t\tconst mappedAlignValue: string | undefined = LEGACY_ALIGNMENT_MAP[alignValue ?? ''];\n\t\tif (mappedAlignValue) alignValue = mappedAlignValue;\n\t\tif (alignValue && VALID_ALIGNMENTS.has(alignValue)) {\n\t\t\tattrs.align = alignValue;\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n/**\n * Rehydrates class-based HTML by converting notectl class names back to inline styles.\n * This allows existing parse rules (which read inline styles) to work unchanged.\n */\nfunction rehydrateClasses(root: DocumentFragment, styleMap: ReadonlyMap<string, string>): void {\n\tconst elements: NodeListOf<Element> = root.querySelectorAll('[class]');\n\tfor (const el of Array.from(elements)) {\n\t\tconst htmlEl = el as HTMLElement;\n\t\tconst classes: string[] = Array.from(htmlEl.classList);\n\t\tconst toRemove: string[] = [];\n\n\t\tfor (const cls of classes) {\n\t\t\tconst declarations: string | undefined = styleMap.get(cls);\n\t\t\tif (declarations) {\n\t\t\t\t// Append declarations to existing inline style\n\t\t\t\tconst existing: string = htmlEl.getAttribute('style') ?? '';\n\t\t\t\tconst separator: string = existing && !existing.endsWith(';') ? '; ' : '';\n\t\t\t\thtmlEl.setAttribute('style', existing + separator + declarations);\n\t\t\t\ttoRemove.push(cls);\n\t\t\t}\n\t\t}\n\n\t\t// Remove rehydrated class names\n\t\tfor (const cls of toRemove) {\n\t\t\thtmlEl.classList.remove(cls);\n\t\t}\n\t}\n}\n\n/** Matches an element against block parse rules. Returns matched type and attrs. */\nfunction matchBlockParseRule(\n\tel: HTMLElement,\n\trules: readonly { readonly rule: ParseRule; readonly type: string }[],\n): { readonly type: string; readonly attrs?: Record<string, unknown> } | null {\n\tconst tag: string = el.tagName.toLowerCase();\n\tfor (const entry of rules) {\n\t\tif (entry.rule.tag !== tag) continue;\n\t\tif (entry.rule.getAttrs) {\n\t\t\tconst attrs = entry.rule.getAttrs(el);\n\t\t\tif (attrs === false) continue;\n\t\t\treturn { type: entry.type, attrs };\n\t\t}\n\t\treturn { type: entry.type };\n\t}\n\treturn null;\n}\n"],"mappings":"kTAkBA,IAAa,EAAgC,wBAG7C,SAAgB,EAAc,GAC7B,OAAO,EAAsB,KAAK,GAYnC,SAAgB,EAAa,EAAa,GACzC,MAAM,EAAqB,EAAG,aAAa,iBAC3C,GAAK,GACA,EAAc,KACf,EAAK,IAAI,GAEb,OADA,EAAK,IAAI,GACF,EAAQ,GCHhB,SAAS,EAAU,GAClB,IAAI,EAToB,WAUxB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IACjC,GAAQ,EAAM,WAAW,GACzB,EAAO,KAAK,KAAK,EAVD,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,MAAQ,OAKf,IAAK,MAAM,KAAO,MAAM,KAAK,EAAG,WAAY,CAE3C,IAAI,EADmC,EAAI,MAAM,2BACJ,GAC7C,MAAM,EAAuC,EAAqB,GAAc,IAEhF,GADI,IAAkB,EAAa,GAC/B,GAAc,EAAiB,IAAI,GAEtC,YADA,EAAM,MAAQ"}
@@ -0,0 +1,2 @@
1
+ import{i as t}from"./TypeBrands-BZDKMjR-.mjs";import{r as e}from"./HTMLUtils-brwcaufP.mjs";import{i as n,n as o,r as i,t as r}from"./AttributedMarkCommands-35jTbVRg.mjs";import{r as s,s as a}from"./StyleRuntime-D3d1XFFe.mjs";import{i as l,o as c}from"./PluginHelpers-D-MvWR98.mjs";import{n as m}from"./ColorValidation-CiGxVsqd.mjs";var p={label:"Font",tooltip:"Font Family"},f=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-P3wW0fmA.mjs"),"./locales/de.ts":()=>import("./de-D74v0paw.mjs"),"./locales/es.ts":()=>import("./es-CE9Tbsb7.mjs"),"./locales/fr.ts":()=>import("./fr-wobtRjcF.mjs"),"./locales/hi.ts":()=>import("./hi-DfAX8S-T.mjs"),"./locales/pt.ts":()=>import("./pt-HhQcARW6.mjs"),"./locales/ru.ts":()=>import("./ru-B6ITUB-Y.mjs"),"./locales/zh.ts":()=>import("./zh-DR1OF5vm.mjs")});async function d(t){return c(f,t,p)}var h=class{id="font";name="Font";priority=22;config;locale;injectedStyleElement=null;context=null;constructor(t){this.config=t}async init(t){this.locale=await l(t,this.config.locale,p,d),t.registerStyleSheet("\n/* Font Select — Width overrides for combobox button */\n.notectl-toolbar-btn--font {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-font-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-font-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__label {\n\tflex: 1;\n}\n\n.notectl-font-picker__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 8px;\n}\n"),this.context=t,this.registerMarkSpec(t),this.registerCommands(t),this.config.fonts.length>0&&this.registerToolbarItem(t),this.injectFontFaces()}destroy(){this.injectedStyleElement?.remove(),this.injectedStyleElement=null,this.context=null}registerMarkSpec(t){t.registerMarkSpec({type:"font",rank:6,attrs:{family:{default:""}},toDOM(t){const e=document.createElement("span"),n=t.attrs?.family??"";return n&&a(e,"fontFamily",n),e},toHTMLString:(t,n,o)=>{const i=String(t.attrs?.family??"");if(!i||!m(i))return n;const r=`font-family: ${e(i)}`;return`<span${o?.styleAttr(r)??` style="${r}"`}>${n}</span>`},toHTMLStyle:t=>{const n=String(t.attrs?.family??"");return n&&m(n)?`font-family: ${e(n)}`:null},parseHTML:[{tag:"span",getAttrs:t=>{const e=t.style.fontFamily;return!!e&&{family:e.replace(/"/g,"'")}}}],sanitize:{tags:["span"]}})}registerCommands(t){t.registerCommand("removeFont",()=>{const e=t.getState();return this.removeFont(t,e)}),t.registerCommand("setFont",()=>!1)}get defaultFont(){if(this.config.defaultFont){const t=this.config.fonts.find(t=>t.name===this.config.defaultFont);if(t)return t}return this.config.fonts[0]}registerToolbarItem(t){t.registerToolbarItem({id:"font",group:"format",label:this.locale.label,tooltip:this.locale.tooltip,command:"removeFont",popupType:"combobox",getLabel:t=>this.resolveFontName(this.getActiveFont(t)),renderPopup:(t,e,n)=>{this.renderFontPopup(t,e,n)},isActive:t=>this.isFontActive(t)})}resolveFontName(t){return t?this.config.fonts.find(e=>e.family===t)?.name??(t.split(",")[0]??"").trim().replace(/['"]/g,""):this.defaultFont?.name??this.locale.label}isFontActive(t){return i(t,"font")}getActiveFont(t){return o(t,"font",t=>t.attrs.family??null)}applyFont(e,n,o){const i=r(n,{type:t("font"),attrs:{family:o}});return!!i&&(e.dispatch(i),!0)}removeFont(e,o){const i=n(o,t("font"));return!!i&&(e.dispatch(i),!0)}injectFontFaces(){const t=[];for(const o of this.config.fonts)if(o.fontFaces?.length)for(const e of o.fontFaces){const n=[`font-family: '${(o.family.split(",")[0]??"").trim().replace(/['"]/g,"")}'`,`src: ${e.src}`];e.weight&&n.push(`font-weight: ${e.weight}`),e.style&&n.push(`font-style: ${e.style}`),n.push(`font-display: ${e.display??"swap"}`),t.push(`@font-face {\n\t${n.join(";\n\t")};\n}`)}if(0===t.length)return;const e=document.createElement("style");e.setAttribute("data-notectl-fonts","");const n=this.context?s(this.context.getContainer()):void 0;n&&e.setAttribute("nonce",n),e.textContent=t.join("\n\n"),document.head.appendChild(e),this.injectedStyleElement=e}renderFontPopup(t,e,n){t.classList.add("notectl-font-picker");const o=e.getState(),i=this.getActiveFont(o),r=this.defaultFont?.family,s=e.getContainer(),a=document.createElement("div");a.className="notectl-font-picker__list",a.setAttribute("role","listbox"),a.setAttribute("aria-label",this.locale.label);for(const l of this.config.fonts){const t=void 0!==r&&l.family===r,o=t&&!i||i===l.family,c=this.createFontItem(l.name,l.family,o,o=>{o.preventDefault(),o.stopPropagation(),t?e.executeCommand("removeFont"):this.applyFont(e,e.getState(),l.family),n({restoreFocusTo:s})});l.category&&c.setAttribute("data-category",l.category),a.appendChild(c)}t.appendChild(a)}createFontItem(t,e,n,o){const i=document.createElement("button");i.type="button",i.className="notectl-font-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(n)),n&&i.classList.add("notectl-font-picker__item--active");const r=document.createElement("span");r.className="notectl-font-picker__check",r.textContent=n?"✓":"",i.appendChild(r);const s=document.createElement("span");return s.className="notectl-font-picker__label",s.textContent=t,e&&a(s,"fontFamily",e),i.appendChild(s),i.addEventListener("mousedown",o),i}};export{p as n,d as r,h as t};
2
+ //# sourceMappingURL=FontPlugin-B-Sxa0UW.mjs.map