@notectl/core 1.7.3 → 2.0.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 (1280) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -31
  3. package/custom-elements.json +350 -6
  4. package/dist/chunks/AttrRegistry-B2AGfTE0.mjs +2 -0
  5. package/dist/chunks/AttrRegistry-B2AGfTE0.mjs.map +1 -0
  6. package/dist/chunks/AttributedMarkCommands-BB7lzFct.mjs +2 -0
  7. package/dist/chunks/{AttributedMarkCommands-BtLea72z.mjs.map → AttributedMarkCommands-BB7lzFct.mjs.map} +1 -1
  8. package/dist/chunks/BlockTypePickerRegistry-DcSE6IXB.mjs +2 -0
  9. package/dist/chunks/BlockTypePickerRegistry-DcSE6IXB.mjs.map +1 -0
  10. package/dist/chunks/ColorGrid-CpkbKfXg.mjs +2 -0
  11. package/dist/chunks/ColorGrid-CpkbKfXg.mjs.map +1 -0
  12. package/dist/chunks/ColorPickerPopup-DRzFvt7o.mjs +2 -0
  13. package/dist/chunks/ColorPickerPopup-DRzFvt7o.mjs.map +1 -0
  14. package/dist/chunks/ColorValidation-DCSKq9B2.mjs +2 -0
  15. package/dist/chunks/{ColorValidation-CV4f1wu6.mjs.map → ColorValidation-DCSKq9B2.mjs.map} +1 -1
  16. package/dist/chunks/Commands-P9wS8qtN.mjs +2 -0
  17. package/dist/chunks/Commands-P9wS8qtN.mjs.map +1 -0
  18. package/dist/chunks/Decoration-D49mFXrH.mjs +2 -0
  19. package/dist/chunks/Decoration-D49mFXrH.mjs.map +1 -0
  20. package/dist/chunks/Document-BFYAonMF.mjs +2 -0
  21. package/dist/chunks/{Document-Brtw2jL1.mjs.map → Document-BFYAonMF.mjs.map} +1 -1
  22. package/dist/chunks/DocumentParser-DFcvVMGY.mjs +2 -0
  23. package/dist/chunks/DocumentParser-DFcvVMGY.mjs.map +1 -0
  24. package/dist/chunks/DomUtils-Cdz1eDKM.mjs +2 -0
  25. package/dist/chunks/DomUtils-Cdz1eDKM.mjs.map +1 -0
  26. package/dist/chunks/HTMLUtils-CCvQ5f83.mjs +2 -0
  27. package/dist/chunks/HTMLUtils-CCvQ5f83.mjs.map +1 -0
  28. package/dist/chunks/HeadingPlugin-DYy3IoT_.mjs +2 -0
  29. package/dist/chunks/HeadingPlugin-DYy3IoT_.mjs.map +1 -0
  30. package/dist/chunks/KeyboardNav-DsYhKKuV.mjs +2 -0
  31. package/dist/chunks/KeyboardNav-DsYhKKuV.mjs.map +1 -0
  32. package/dist/chunks/LocaleService-B6Z-wyAF.mjs +2 -0
  33. package/dist/chunks/LocaleService-B6Z-wyAF.mjs.map +1 -0
  34. package/dist/chunks/MarkCommands-B_erV7zz.mjs +2 -0
  35. package/dist/chunks/{MarkCommands-6RUJ4L3r.mjs.map → MarkCommands-B_erV7zz.mjs.map} +1 -1
  36. package/dist/chunks/NavigationQueries-ogQuObz7.mjs +2 -0
  37. package/dist/chunks/NavigationQueries-ogQuObz7.mjs.map +1 -0
  38. package/dist/chunks/NotectlEditor-4NFnXLyD.mjs +2 -0
  39. package/dist/chunks/NotectlEditor-4NFnXLyD.mjs.map +1 -0
  40. package/dist/chunks/Platform-CU6itXZo.mjs +2 -0
  41. package/dist/chunks/Platform-CU6itXZo.mjs.map +1 -0
  42. package/dist/chunks/Plugin-OzM8Oxm_.mjs +2 -0
  43. package/dist/chunks/Plugin-OzM8Oxm_.mjs.map +1 -0
  44. package/dist/chunks/PluginHelpers-DjZt0pQi.mjs +2 -0
  45. package/dist/chunks/PluginHelpers-DjZt0pQi.mjs.map +1 -0
  46. package/dist/chunks/PopupManager-BM8IT6M7.mjs +2 -0
  47. package/dist/chunks/PopupManager-BM8IT6M7.mjs.map +1 -0
  48. package/dist/chunks/PopupPositioning-DtvqMSop.mjs +2 -0
  49. package/dist/chunks/PopupPositioning-DtvqMSop.mjs.map +1 -0
  50. package/dist/chunks/PrintTypes-ehbL7ipA.mjs +2 -0
  51. package/dist/chunks/PrintTypes-ehbL7ipA.mjs.map +1 -0
  52. package/dist/chunks/RangeIterator-CNI6smOg.mjs +2 -0
  53. package/dist/chunks/{RangeIterator-Bh4Vl_6D.mjs.map → RangeIterator-CNI6smOg.mjs.map} +1 -1
  54. package/dist/chunks/Selection-6-W6Flxc.mjs +2 -0
  55. package/dist/chunks/{Selection-BRTab5hO.mjs.map → Selection-6-W6Flxc.mjs.map} +1 -1
  56. package/dist/chunks/SelectionTransactions-q71GEzgE.mjs +2 -0
  57. package/dist/chunks/SelectionTransactions-q71GEzgE.mjs.map +1 -0
  58. package/dist/chunks/ShortcutFormatting-BLKS0Gys.mjs +2 -0
  59. package/dist/chunks/ShortcutFormatting-BLKS0Gys.mjs.map +1 -0
  60. package/dist/chunks/StyleRuntime-BmsLoEa8.mjs +2 -0
  61. package/dist/chunks/{StyleRuntime-CP4NCwKT.mjs.map → StyleRuntime-BmsLoEa8.mjs.map} +1 -1
  62. package/dist/chunks/TextDirectionLocale-DB_aqrMg.mjs +2 -0
  63. package/dist/chunks/TextDirectionLocale-DB_aqrMg.mjs.map +1 -0
  64. package/dist/chunks/TypeBrands-Bp_Z_o5Y.mjs +2 -0
  65. package/dist/chunks/{TypeBrands-C09nE2qO.mjs.map → TypeBrands-Bp_Z_o5Y.mjs.map} +1 -1
  66. package/dist/chunks/ar-B93SPJT7.mjs +2 -0
  67. package/dist/chunks/ar-B93SPJT7.mjs.map +1 -0
  68. package/dist/chunks/ar-BAmGa08u.mjs +2 -0
  69. package/dist/chunks/ar-BAmGa08u.mjs.map +1 -0
  70. package/dist/chunks/ar-BYNFEVLc.mjs +2 -0
  71. package/dist/chunks/ar-BYNFEVLc.mjs.map +1 -0
  72. package/dist/chunks/ar-Bnc7y8BP.mjs +2 -0
  73. package/dist/chunks/ar-Bnc7y8BP.mjs.map +1 -0
  74. package/dist/chunks/ar-Bp3rDZky.mjs +2 -0
  75. package/dist/chunks/ar-Bp3rDZky.mjs.map +1 -0
  76. package/dist/chunks/ar-BtOQ7lro.mjs +2 -0
  77. package/dist/chunks/ar-BtOQ7lro.mjs.map +1 -0
  78. package/dist/chunks/ar-C5JEHhw9.mjs +2 -0
  79. package/dist/chunks/ar-C5JEHhw9.mjs.map +1 -0
  80. package/dist/chunks/ar-CL3QL0tw.mjs +2 -0
  81. package/dist/chunks/ar-CL3QL0tw.mjs.map +1 -0
  82. package/dist/chunks/ar-CYtG-XlN.mjs +2 -0
  83. package/dist/chunks/ar-CYtG-XlN.mjs.map +1 -0
  84. package/dist/chunks/ar-CzVj8p__.mjs +2 -0
  85. package/dist/chunks/ar-CzVj8p__.mjs.map +1 -0
  86. package/dist/chunks/ar-D7PS3e2g.mjs +2 -0
  87. package/dist/chunks/ar-D7PS3e2g.mjs.map +1 -0
  88. package/dist/chunks/ar-D8adM2Uy.mjs +2 -0
  89. package/dist/chunks/ar-D8adM2Uy.mjs.map +1 -0
  90. package/dist/chunks/ar-D9jyShaB.mjs +2 -0
  91. package/dist/chunks/ar-D9jyShaB.mjs.map +1 -0
  92. package/dist/chunks/ar-DR6OA3ZO.mjs +2 -0
  93. package/dist/chunks/ar-DR6OA3ZO.mjs.map +1 -0
  94. package/dist/chunks/ar-Deibepjm.mjs +2 -0
  95. package/dist/chunks/ar-Deibepjm.mjs.map +1 -0
  96. package/dist/chunks/ar-Dlb5riUN.mjs +2 -0
  97. package/dist/chunks/ar-Dlb5riUN.mjs.map +1 -0
  98. package/dist/chunks/ar-DmmxE2W7.mjs +2 -0
  99. package/dist/chunks/ar-DmmxE2W7.mjs.map +1 -0
  100. package/dist/chunks/ar-Ds6Z2Gzf.mjs +2 -0
  101. package/dist/chunks/ar-Ds6Z2Gzf.mjs.map +1 -0
  102. package/dist/chunks/ar-DtIHQ8nU.mjs +2 -0
  103. package/dist/chunks/ar-DtIHQ8nU.mjs.map +1 -0
  104. package/dist/chunks/ar-J8B-on-0.mjs +2 -0
  105. package/dist/chunks/ar-J8B-on-0.mjs.map +1 -0
  106. package/dist/chunks/ar-iU02mRe5.mjs +2 -0
  107. package/dist/chunks/ar-iU02mRe5.mjs.map +1 -0
  108. package/dist/chunks/ar-mSCYQYnL.mjs +2 -0
  109. package/dist/chunks/ar-mSCYQYnL.mjs.map +1 -0
  110. package/dist/chunks/color-picker-Byjl_xr9.mjs +2 -0
  111. package/dist/chunks/color-picker-Byjl_xr9.mjs.map +1 -0
  112. package/dist/chunks/de-8aCC5jBM.mjs +2 -0
  113. package/dist/chunks/de-8aCC5jBM.mjs.map +1 -0
  114. package/dist/chunks/de-B4y4ndUw.mjs +2 -0
  115. package/dist/chunks/de-B4y4ndUw.mjs.map +1 -0
  116. package/dist/chunks/de-B5fcZ0FQ.mjs +2 -0
  117. package/dist/chunks/de-B5fcZ0FQ.mjs.map +1 -0
  118. package/dist/chunks/de-BT9VmwoJ.mjs +2 -0
  119. package/dist/chunks/de-BT9VmwoJ.mjs.map +1 -0
  120. package/dist/chunks/de-BZWSyJTG.mjs +2 -0
  121. package/dist/chunks/de-BZWSyJTG.mjs.map +1 -0
  122. package/dist/chunks/de-CFD_Wgik.mjs +2 -0
  123. package/dist/chunks/de-CFD_Wgik.mjs.map +1 -0
  124. package/dist/chunks/de-CLYtb6kD.mjs +2 -0
  125. package/dist/chunks/de-CLYtb6kD.mjs.map +1 -0
  126. package/dist/chunks/de-CP5v-98M.mjs +2 -0
  127. package/dist/chunks/de-CP5v-98M.mjs.map +1 -0
  128. package/dist/chunks/de-CYJ6uWno.mjs +2 -0
  129. package/dist/chunks/de-CYJ6uWno.mjs.map +1 -0
  130. package/dist/chunks/de-ChcKkF7A.mjs +2 -0
  131. package/dist/chunks/de-ChcKkF7A.mjs.map +1 -0
  132. package/dist/chunks/de-CicoU066.mjs +2 -0
  133. package/dist/chunks/de-CicoU066.mjs.map +1 -0
  134. package/dist/chunks/de-CjLAdBt2.mjs +2 -0
  135. package/dist/chunks/de-CjLAdBt2.mjs.map +1 -0
  136. package/dist/chunks/de-CtFvAXwF.mjs +2 -0
  137. package/dist/chunks/de-CtFvAXwF.mjs.map +1 -0
  138. package/dist/chunks/de-D1OAXtxJ.mjs +2 -0
  139. package/dist/chunks/de-D1OAXtxJ.mjs.map +1 -0
  140. package/dist/chunks/de-DBbzCQrm.mjs +2 -0
  141. package/dist/chunks/de-DBbzCQrm.mjs.map +1 -0
  142. package/dist/chunks/de-DOLwx_M7.mjs +2 -0
  143. package/dist/chunks/de-DOLwx_M7.mjs.map +1 -0
  144. package/dist/chunks/de-De2miMxo.mjs +2 -0
  145. package/dist/chunks/de-De2miMxo.mjs.map +1 -0
  146. package/dist/chunks/de-OTfhhinm.mjs +2 -0
  147. package/dist/chunks/de-OTfhhinm.mjs.map +1 -0
  148. package/dist/chunks/de-PZ9-LlBp.mjs +2 -0
  149. package/dist/chunks/de-PZ9-LlBp.mjs.map +1 -0
  150. package/dist/chunks/de-UREymH-5.mjs +2 -0
  151. package/dist/chunks/de-UREymH-5.mjs.map +1 -0
  152. package/dist/chunks/de-chYdoK9q.mjs +2 -0
  153. package/dist/chunks/de-chYdoK9q.mjs.map +1 -0
  154. package/dist/chunks/de-xJh5C_pk.mjs +2 -0
  155. package/dist/chunks/de-xJh5C_pk.mjs.map +1 -0
  156. package/dist/chunks/es-B9UhsaEI.mjs +2 -0
  157. package/dist/chunks/es-B9UhsaEI.mjs.map +1 -0
  158. package/dist/chunks/es-BHGwPgrP.mjs +2 -0
  159. package/dist/chunks/es-BHGwPgrP.mjs.map +1 -0
  160. package/dist/chunks/es-BbGOZGS_.mjs +2 -0
  161. package/dist/chunks/es-BbGOZGS_.mjs.map +1 -0
  162. package/dist/chunks/es-BjPsub0k.mjs +2 -0
  163. package/dist/chunks/es-BjPsub0k.mjs.map +1 -0
  164. package/dist/chunks/es-Bk0bRDFE.mjs +2 -0
  165. package/dist/chunks/es-Bk0bRDFE.mjs.map +1 -0
  166. package/dist/chunks/es-BkS6DsrM.mjs +2 -0
  167. package/dist/chunks/es-BkS6DsrM.mjs.map +1 -0
  168. package/dist/chunks/es-BzEpr4Bk.mjs +2 -0
  169. package/dist/chunks/es-BzEpr4Bk.mjs.map +1 -0
  170. package/dist/chunks/es-C2lnWyA0.mjs +2 -0
  171. package/dist/chunks/es-C2lnWyA0.mjs.map +1 -0
  172. package/dist/chunks/es-C7e35Muh.mjs +2 -0
  173. package/dist/chunks/es-C7e35Muh.mjs.map +1 -0
  174. package/dist/chunks/es-CBk43isB.mjs +2 -0
  175. package/dist/chunks/es-CBk43isB.mjs.map +1 -0
  176. package/dist/chunks/es-CE8t9fuM.mjs +2 -0
  177. package/dist/chunks/es-CE8t9fuM.mjs.map +1 -0
  178. package/dist/chunks/es-CFjzqIbS.mjs +2 -0
  179. package/dist/chunks/es-CFjzqIbS.mjs.map +1 -0
  180. package/dist/chunks/es-Ce-AEYxc.mjs +2 -0
  181. package/dist/chunks/es-Ce-AEYxc.mjs.map +1 -0
  182. package/dist/chunks/es-Co4AJr8Y.mjs +2 -0
  183. package/dist/chunks/es-Co4AJr8Y.mjs.map +1 -0
  184. package/dist/chunks/es-Cu5_OA4X.mjs +2 -0
  185. package/dist/chunks/es-Cu5_OA4X.mjs.map +1 -0
  186. package/dist/chunks/es-Cud6JXHf.mjs +2 -0
  187. package/dist/chunks/es-Cud6JXHf.mjs.map +1 -0
  188. package/dist/chunks/es-D-II7LZC.mjs +2 -0
  189. package/dist/chunks/es-D-II7LZC.mjs.map +1 -0
  190. package/dist/chunks/es-DBBSeOaD.mjs +2 -0
  191. package/dist/chunks/es-DBBSeOaD.mjs.map +1 -0
  192. package/dist/chunks/es-DCwjeUUu.mjs +2 -0
  193. package/dist/chunks/es-DCwjeUUu.mjs.map +1 -0
  194. package/dist/chunks/es-DvgH3-WZ.mjs +2 -0
  195. package/dist/chunks/es-DvgH3-WZ.mjs.map +1 -0
  196. package/dist/chunks/es-MgguVgIs.mjs +2 -0
  197. package/dist/chunks/es-MgguVgIs.mjs.map +1 -0
  198. package/dist/chunks/es-yXjjcxgb.mjs +2 -0
  199. package/dist/chunks/es-yXjjcxgb.mjs.map +1 -0
  200. package/dist/chunks/fr-B-_yKIAY.mjs +2 -0
  201. package/dist/chunks/fr-B-_yKIAY.mjs.map +1 -0
  202. package/dist/chunks/fr-BGyF2ym0.mjs +2 -0
  203. package/dist/chunks/fr-BGyF2ym0.mjs.map +1 -0
  204. package/dist/chunks/fr-BoRJ3B2-.mjs +2 -0
  205. package/dist/chunks/fr-BoRJ3B2-.mjs.map +1 -0
  206. package/dist/chunks/fr-BrKk4SPg.mjs +2 -0
  207. package/dist/chunks/fr-BrKk4SPg.mjs.map +1 -0
  208. package/dist/chunks/fr-C-y09LKg.mjs +2 -0
  209. package/dist/chunks/fr-C-y09LKg.mjs.map +1 -0
  210. package/dist/chunks/fr-C1W7jyd6.mjs +2 -0
  211. package/dist/chunks/fr-C1W7jyd6.mjs.map +1 -0
  212. package/dist/chunks/fr-C8CtmWBj.mjs +2 -0
  213. package/dist/chunks/fr-C8CtmWBj.mjs.map +1 -0
  214. package/dist/chunks/fr-C9oiPW0k.mjs +2 -0
  215. package/dist/chunks/fr-C9oiPW0k.mjs.map +1 -0
  216. package/dist/chunks/fr-CEkk4UyZ.mjs +2 -0
  217. package/dist/chunks/fr-CEkk4UyZ.mjs.map +1 -0
  218. package/dist/chunks/fr-Ccaetiwi.mjs +2 -0
  219. package/dist/chunks/fr-Ccaetiwi.mjs.map +1 -0
  220. package/dist/chunks/fr-Ccku5KzA.mjs +2 -0
  221. package/dist/chunks/fr-Ccku5KzA.mjs.map +1 -0
  222. package/dist/chunks/fr-CfUg1FxU.mjs +2 -0
  223. package/dist/chunks/fr-CfUg1FxU.mjs.map +1 -0
  224. package/dist/chunks/fr-DDkBcjmO.mjs +2 -0
  225. package/dist/chunks/fr-DDkBcjmO.mjs.map +1 -0
  226. package/dist/chunks/fr-DNwLChcm.mjs +2 -0
  227. package/dist/chunks/fr-DNwLChcm.mjs.map +1 -0
  228. package/dist/chunks/fr-DvneSjCf.mjs +2 -0
  229. package/dist/chunks/fr-DvneSjCf.mjs.map +1 -0
  230. package/dist/chunks/fr-Dx4Qqimj.mjs +2 -0
  231. package/dist/chunks/fr-Dx4Qqimj.mjs.map +1 -0
  232. package/dist/chunks/fr-RHXmueoO.mjs +2 -0
  233. package/dist/chunks/fr-RHXmueoO.mjs.map +1 -0
  234. package/dist/chunks/fr-Wiobfk5s.mjs +2 -0
  235. package/dist/chunks/fr-Wiobfk5s.mjs.map +1 -0
  236. package/dist/chunks/fr-YMiDtWuG.mjs +2 -0
  237. package/dist/chunks/fr-YMiDtWuG.mjs.map +1 -0
  238. package/dist/chunks/fr-_Oxf0k66.mjs +2 -0
  239. package/dist/chunks/fr-_Oxf0k66.mjs.map +1 -0
  240. package/dist/chunks/fr-gurfH-7T.mjs +2 -0
  241. package/dist/chunks/fr-gurfH-7T.mjs.map +1 -0
  242. package/dist/chunks/fr-zP7EjxDL.mjs +2 -0
  243. package/dist/chunks/fr-zP7EjxDL.mjs.map +1 -0
  244. package/dist/chunks/hi-B2W8pFqK.mjs +2 -0
  245. package/dist/chunks/hi-B2W8pFqK.mjs.map +1 -0
  246. package/dist/chunks/hi-B2m69ZCq.mjs +2 -0
  247. package/dist/chunks/hi-B2m69ZCq.mjs.map +1 -0
  248. package/dist/chunks/hi-BMIt3y_-.mjs +2 -0
  249. package/dist/chunks/hi-BMIt3y_-.mjs.map +1 -0
  250. package/dist/chunks/hi-BmkfaZpg.mjs +2 -0
  251. package/dist/chunks/hi-BmkfaZpg.mjs.map +1 -0
  252. package/dist/chunks/hi-C-l_R2SO.mjs +2 -0
  253. package/dist/chunks/hi-C-l_R2SO.mjs.map +1 -0
  254. package/dist/chunks/hi-C1LhM-oY.mjs +2 -0
  255. package/dist/chunks/hi-C1LhM-oY.mjs.map +1 -0
  256. package/dist/chunks/hi-CGEbGI1l.mjs +2 -0
  257. package/dist/chunks/hi-CGEbGI1l.mjs.map +1 -0
  258. package/dist/chunks/hi-CPuhj7IA.mjs +2 -0
  259. package/dist/chunks/hi-CPuhj7IA.mjs.map +1 -0
  260. package/dist/chunks/hi-CT5WERqi.mjs +2 -0
  261. package/dist/chunks/hi-CT5WERqi.mjs.map +1 -0
  262. package/dist/chunks/hi-CbLPPQ0b.mjs +2 -0
  263. package/dist/chunks/hi-CbLPPQ0b.mjs.map +1 -0
  264. package/dist/chunks/hi-ClvEtEKe.mjs +2 -0
  265. package/dist/chunks/hi-ClvEtEKe.mjs.map +1 -0
  266. package/dist/chunks/hi-CpBWHmYH.mjs +2 -0
  267. package/dist/chunks/hi-CpBWHmYH.mjs.map +1 -0
  268. package/dist/chunks/hi-DAfl8nU_.mjs +2 -0
  269. package/dist/chunks/hi-DAfl8nU_.mjs.map +1 -0
  270. package/dist/chunks/hi-DVof3w0y.mjs +2 -0
  271. package/dist/chunks/hi-DVof3w0y.mjs.map +1 -0
  272. package/dist/chunks/hi-DtlvSQkD.mjs +2 -0
  273. package/dist/chunks/hi-DtlvSQkD.mjs.map +1 -0
  274. package/dist/chunks/hi-FH3CAJuR.mjs +2 -0
  275. package/dist/chunks/hi-FH3CAJuR.mjs.map +1 -0
  276. package/dist/chunks/hi-Ga9h9a_1.mjs +2 -0
  277. package/dist/chunks/hi-Ga9h9a_1.mjs.map +1 -0
  278. package/dist/chunks/hi-Zc17M1T-.mjs +2 -0
  279. package/dist/chunks/hi-Zc17M1T-.mjs.map +1 -0
  280. package/dist/chunks/hi-g7i0bmig.mjs +2 -0
  281. package/dist/chunks/hi-g7i0bmig.mjs.map +1 -0
  282. package/dist/chunks/hi-js2P6byR.mjs +2 -0
  283. package/dist/chunks/hi-js2P6byR.mjs.map +1 -0
  284. package/dist/chunks/hi-ntUsOspQ.mjs +2 -0
  285. package/dist/chunks/hi-ntUsOspQ.mjs.map +1 -0
  286. package/dist/chunks/hi-yxAcR3w6.mjs +2 -0
  287. package/dist/chunks/hi-yxAcR3w6.mjs.map +1 -0
  288. package/dist/chunks/index-C8xtb3SM.mjs +2 -0
  289. package/dist/chunks/index-C8xtb3SM.mjs.map +1 -0
  290. package/dist/chunks/index-DAoSt12h.mjs +2 -0
  291. package/dist/chunks/index-DAoSt12h.mjs.map +1 -0
  292. package/dist/chunks/pt--IiroJQw.mjs +2 -0
  293. package/dist/chunks/pt--IiroJQw.mjs.map +1 -0
  294. package/dist/chunks/pt-BF72W8M5.mjs +2 -0
  295. package/dist/chunks/pt-BF72W8M5.mjs.map +1 -0
  296. package/dist/chunks/pt-BX_t4luI.mjs +2 -0
  297. package/dist/chunks/pt-BX_t4luI.mjs.map +1 -0
  298. package/dist/chunks/pt-B_XJ2s9X.mjs +2 -0
  299. package/dist/chunks/pt-B_XJ2s9X.mjs.map +1 -0
  300. package/dist/chunks/pt-C-Vp7Rxj.mjs +2 -0
  301. package/dist/chunks/pt-C-Vp7Rxj.mjs.map +1 -0
  302. package/dist/chunks/pt-CD2aCZXf.mjs +2 -0
  303. package/dist/chunks/pt-CD2aCZXf.mjs.map +1 -0
  304. package/dist/chunks/pt-CFjzqIbS.mjs +2 -0
  305. package/dist/chunks/pt-CFjzqIbS.mjs.map +1 -0
  306. package/dist/chunks/pt-CHjmBegF.mjs +2 -0
  307. package/dist/chunks/pt-CHjmBegF.mjs.map +1 -0
  308. package/dist/chunks/pt-CQRzEocL.mjs +2 -0
  309. package/dist/chunks/pt-CQRzEocL.mjs.map +1 -0
  310. package/dist/chunks/pt-Cem2WxUk.mjs +2 -0
  311. package/dist/chunks/pt-Cem2WxUk.mjs.map +1 -0
  312. package/dist/chunks/pt-D6kdF3fH.mjs +2 -0
  313. package/dist/chunks/pt-D6kdF3fH.mjs.map +1 -0
  314. package/dist/chunks/pt-DJfJVeY8.mjs +2 -0
  315. package/dist/chunks/pt-DJfJVeY8.mjs.map +1 -0
  316. package/dist/chunks/pt-DfB-IaYi.mjs +2 -0
  317. package/dist/chunks/pt-DfB-IaYi.mjs.map +1 -0
  318. package/dist/chunks/pt-DlNdH9pu.mjs +2 -0
  319. package/dist/chunks/pt-DlNdH9pu.mjs.map +1 -0
  320. package/dist/chunks/pt-DrJ0-8Yo.mjs +2 -0
  321. package/dist/chunks/pt-DrJ0-8Yo.mjs.map +1 -0
  322. package/dist/chunks/pt-DsBJpgpe.mjs +2 -0
  323. package/dist/chunks/pt-DsBJpgpe.mjs.map +1 -0
  324. package/dist/chunks/pt-DwdSYJzC.mjs +2 -0
  325. package/dist/chunks/pt-DwdSYJzC.mjs.map +1 -0
  326. package/dist/chunks/pt-Dx9UkZ3j.mjs +2 -0
  327. package/dist/chunks/pt-Dx9UkZ3j.mjs.map +1 -0
  328. package/dist/chunks/pt-TuA3_GDM.mjs +2 -0
  329. package/dist/chunks/pt-TuA3_GDM.mjs.map +1 -0
  330. package/dist/chunks/pt-cN6r-f7f.mjs +2 -0
  331. package/dist/chunks/pt-cN6r-f7f.mjs.map +1 -0
  332. package/dist/chunks/pt-uNGpVM3D.mjs +2 -0
  333. package/dist/chunks/pt-uNGpVM3D.mjs.map +1 -0
  334. package/dist/chunks/pt-v1E9u-Jx.mjs +2 -0
  335. package/dist/chunks/pt-v1E9u-Jx.mjs.map +1 -0
  336. package/dist/chunks/ru-0h51zrqE.mjs +2 -0
  337. package/dist/chunks/ru-0h51zrqE.mjs.map +1 -0
  338. package/dist/chunks/ru-4S8w6UN_.mjs +2 -0
  339. package/dist/chunks/ru-4S8w6UN_.mjs.map +1 -0
  340. package/dist/chunks/ru-B0cRw90L.mjs +2 -0
  341. package/dist/chunks/ru-B0cRw90L.mjs.map +1 -0
  342. package/dist/chunks/ru-B3O7WXNM.mjs +2 -0
  343. package/dist/chunks/ru-B3O7WXNM.mjs.map +1 -0
  344. package/dist/chunks/ru-B6zVAzvI.mjs +2 -0
  345. package/dist/chunks/ru-B6zVAzvI.mjs.map +1 -0
  346. package/dist/chunks/ru-B8teJin_.mjs +2 -0
  347. package/dist/chunks/ru-B8teJin_.mjs.map +1 -0
  348. package/dist/chunks/ru-BCriPw-8.mjs +2 -0
  349. package/dist/chunks/ru-BCriPw-8.mjs.map +1 -0
  350. package/dist/chunks/ru-BNOU16E5.mjs +2 -0
  351. package/dist/chunks/ru-BNOU16E5.mjs.map +1 -0
  352. package/dist/chunks/ru-BO6BIS5W.mjs +2 -0
  353. package/dist/chunks/ru-BO6BIS5W.mjs.map +1 -0
  354. package/dist/chunks/ru-Bdy1lLuc.mjs +2 -0
  355. package/dist/chunks/ru-Bdy1lLuc.mjs.map +1 -0
  356. package/dist/chunks/ru-BgBctNVm.mjs +2 -0
  357. package/dist/chunks/ru-BgBctNVm.mjs.map +1 -0
  358. package/dist/chunks/ru-CNLx7T3O.mjs +2 -0
  359. package/dist/chunks/ru-CNLx7T3O.mjs.map +1 -0
  360. package/dist/chunks/ru-CVSCT776.mjs +2 -0
  361. package/dist/chunks/ru-CVSCT776.mjs.map +1 -0
  362. package/dist/chunks/ru-CZvkdGnf.mjs +2 -0
  363. package/dist/chunks/ru-CZvkdGnf.mjs.map +1 -0
  364. package/dist/chunks/ru-CegMPuML.mjs +2 -0
  365. package/dist/chunks/ru-CegMPuML.mjs.map +1 -0
  366. package/dist/chunks/ru-CiLrD2Nz.mjs +2 -0
  367. package/dist/chunks/ru-CiLrD2Nz.mjs.map +1 -0
  368. package/dist/chunks/ru-ClEM6OKY.mjs +2 -0
  369. package/dist/chunks/ru-ClEM6OKY.mjs.map +1 -0
  370. package/dist/chunks/ru-CrbxCeQf.mjs +2 -0
  371. package/dist/chunks/ru-CrbxCeQf.mjs.map +1 -0
  372. package/dist/chunks/ru-D3j2x2xu.mjs +2 -0
  373. package/dist/chunks/ru-D3j2x2xu.mjs.map +1 -0
  374. package/dist/chunks/ru-DdHqb4Mh.mjs +2 -0
  375. package/dist/chunks/ru-DdHqb4Mh.mjs.map +1 -0
  376. package/dist/chunks/ru-DjgNdOdJ.mjs +2 -0
  377. package/dist/chunks/ru-DjgNdOdJ.mjs.map +1 -0
  378. package/dist/chunks/ru-XKNCzkR2.mjs +2 -0
  379. package/dist/chunks/ru-XKNCzkR2.mjs.map +1 -0
  380. package/dist/chunks/zh--oNSMazK.mjs +2 -0
  381. package/dist/chunks/zh--oNSMazK.mjs.map +1 -0
  382. package/dist/chunks/zh-BfeWdPIz.mjs +2 -0
  383. package/dist/chunks/zh-BfeWdPIz.mjs.map +1 -0
  384. package/dist/chunks/zh-BnOxGKxF.mjs +2 -0
  385. package/dist/chunks/zh-BnOxGKxF.mjs.map +1 -0
  386. package/dist/chunks/zh-BqMtE-jN.mjs +2 -0
  387. package/dist/chunks/zh-BqMtE-jN.mjs.map +1 -0
  388. package/dist/chunks/zh-C3aI7A2o.mjs +2 -0
  389. package/dist/chunks/zh-C3aI7A2o.mjs.map +1 -0
  390. package/dist/chunks/zh-C6YALJZt.mjs +2 -0
  391. package/dist/chunks/zh-C6YALJZt.mjs.map +1 -0
  392. package/dist/chunks/zh-CWdTbUOP.mjs +2 -0
  393. package/dist/chunks/zh-CWdTbUOP.mjs.map +1 -0
  394. package/dist/chunks/zh-CY01pMD4.mjs +2 -0
  395. package/dist/chunks/zh-CY01pMD4.mjs.map +1 -0
  396. package/dist/chunks/zh-Cmt7n9FY.mjs +2 -0
  397. package/dist/chunks/zh-Cmt7n9FY.mjs.map +1 -0
  398. package/dist/chunks/zh-CpP2kee3.mjs +2 -0
  399. package/dist/chunks/zh-CpP2kee3.mjs.map +1 -0
  400. package/dist/chunks/zh-Cpbg4evx.mjs +2 -0
  401. package/dist/chunks/zh-Cpbg4evx.mjs.map +1 -0
  402. package/dist/chunks/zh-Cqb55JWa.mjs +2 -0
  403. package/dist/chunks/zh-Cqb55JWa.mjs.map +1 -0
  404. package/dist/chunks/zh-DCQZ6gss.mjs +2 -0
  405. package/dist/chunks/zh-DCQZ6gss.mjs.map +1 -0
  406. package/dist/chunks/zh-DG2CNTUU.mjs +2 -0
  407. package/dist/chunks/zh-DG2CNTUU.mjs.map +1 -0
  408. package/dist/chunks/zh-DTiTJbzz.mjs +2 -0
  409. package/dist/chunks/zh-DTiTJbzz.mjs.map +1 -0
  410. package/dist/chunks/zh-Da1z6qbB.mjs +2 -0
  411. package/dist/chunks/zh-Da1z6qbB.mjs.map +1 -0
  412. package/dist/chunks/zh-DlBt06Pr.mjs +2 -0
  413. package/dist/chunks/zh-DlBt06Pr.mjs.map +1 -0
  414. package/dist/chunks/zh-Dt-wVrNr.mjs +2 -0
  415. package/dist/chunks/zh-Dt-wVrNr.mjs.map +1 -0
  416. package/dist/chunks/zh-ND6vW2M-.mjs +2 -0
  417. package/dist/chunks/zh-ND6vW2M-.mjs.map +1 -0
  418. package/dist/chunks/zh-Yd3GNsa0.mjs +2 -0
  419. package/dist/chunks/zh-Yd3GNsa0.mjs.map +1 -0
  420. package/dist/chunks/zh-lhynyH6Q.mjs +2 -0
  421. package/dist/chunks/zh-lhynyH6Q.mjs.map +1 -0
  422. package/dist/chunks/zh-v9NmlEIN.mjs +2 -0
  423. package/dist/chunks/zh-v9NmlEIN.mjs.map +1 -0
  424. package/dist/commands/Commands.d.ts +9 -3
  425. package/dist/commands/Commands.d.ts.map +1 -1
  426. package/dist/commands/GapCursorCommands.d.ts.map +1 -1
  427. package/dist/commands/MovementCommands.d.ts +1 -4
  428. package/dist/commands/MovementCommands.d.ts.map +1 -1
  429. package/dist/commands/NodeSelectionCommands.d.ts +3 -1
  430. package/dist/commands/NodeSelectionCommands.d.ts.map +1 -1
  431. package/dist/commands/WordBoundary.d.ts +4 -9
  432. package/dist/commands/WordBoundary.d.ts.map +1 -1
  433. package/dist/editor/Announcer.d.ts +1 -2
  434. package/dist/editor/Announcer.d.ts.map +1 -1
  435. package/dist/{model → editor}/BuiltinSpecs.d.ts +1 -1
  436. package/dist/editor/BuiltinSpecs.d.ts.map +1 -0
  437. package/dist/editor/ContentSerializer.d.ts +24 -0
  438. package/dist/editor/ContentSerializer.d.ts.map +1 -0
  439. package/dist/editor/EditorConfigController.d.ts +38 -0
  440. package/dist/editor/EditorConfigController.d.ts.map +1 -0
  441. package/dist/editor/EditorDOM.d.ts +3 -4
  442. package/dist/editor/EditorDOM.d.ts.map +1 -1
  443. package/dist/editor/EditorEventEmitter.d.ts +30 -0
  444. package/dist/editor/EditorEventEmitter.d.ts.map +1 -0
  445. package/dist/editor/EditorLifecycleCoordinator.d.ts +24 -0
  446. package/dist/editor/EditorLifecycleCoordinator.d.ts.map +1 -0
  447. package/dist/editor/EditorLocale.d.ts +9 -0
  448. package/dist/editor/EditorLocale.d.ts.map +1 -0
  449. package/dist/editor/EditorStyleCoordinator.d.ts +9 -0
  450. package/dist/editor/EditorStyleCoordinator.d.ts.map +1 -0
  451. package/dist/editor/NotectlEditor.d.ts +20 -54
  452. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  453. package/dist/editor/PaperLayoutController.d.ts +1 -1
  454. package/dist/editor/PaperLayoutController.d.ts.map +1 -1
  455. package/dist/editor/PluginBootstrapper.d.ts +18 -0
  456. package/dist/editor/PluginBootstrapper.d.ts.map +1 -0
  457. package/dist/editor/locales/ar.d.ts +4 -0
  458. package/dist/editor/locales/ar.d.ts.map +1 -0
  459. package/dist/editor/locales/de.d.ts +4 -0
  460. package/dist/editor/locales/de.d.ts.map +1 -0
  461. package/dist/editor/locales/es.d.ts +4 -0
  462. package/dist/editor/locales/es.d.ts.map +1 -0
  463. package/dist/editor/locales/fr.d.ts +4 -0
  464. package/dist/editor/locales/fr.d.ts.map +1 -0
  465. package/dist/editor/locales/hi.d.ts +4 -0
  466. package/dist/editor/locales/hi.d.ts.map +1 -0
  467. package/dist/editor/locales/pt.d.ts +4 -0
  468. package/dist/editor/locales/pt.d.ts.map +1 -0
  469. package/dist/editor/locales/ru.d.ts +4 -0
  470. package/dist/editor/locales/ru.d.ts.map +1 -0
  471. package/dist/editor/locales/zh.d.ts +4 -0
  472. package/dist/editor/locales/zh.d.ts.map +1 -0
  473. package/dist/editor/styles/base.d.ts +1 -1
  474. package/dist/editor/styles/base.d.ts.map +1 -1
  475. package/dist/editor/styles/code-block.d.ts +1 -1
  476. package/dist/editor/styles/code-block.d.ts.map +1 -1
  477. package/dist/editor/styles/font-select.d.ts +1 -1
  478. package/dist/editor/styles/font-select.d.ts.map +1 -1
  479. package/dist/editor/styles/font-size-select.d.ts +1 -1
  480. package/dist/editor/styles/font-size-select.d.ts.map +1 -1
  481. package/dist/editor/styles/heading-select.d.ts +1 -1
  482. package/dist/editor/styles/heading-select.d.ts.map +1 -1
  483. package/dist/editor/styles/image.d.ts +1 -1
  484. package/dist/editor/styles/image.d.ts.map +1 -1
  485. package/dist/editor/styles/list.d.ts +1 -1
  486. package/dist/editor/styles/list.d.ts.map +1 -1
  487. package/dist/editor/styles/table.d.ts +1 -1
  488. package/dist/editor/styles/table.d.ts.map +1 -1
  489. package/dist/editor/styles/toolbar.d.ts +1 -1
  490. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  491. package/dist/fonts.mjs +1 -6
  492. package/dist/fonts.mjs.map +1 -1
  493. package/dist/full.d.ts +45 -0
  494. package/dist/full.d.ts.map +1 -0
  495. package/dist/full.mjs +2 -0
  496. package/dist/full.mjs.map +1 -0
  497. package/dist/html.d.ts +16 -0
  498. package/dist/html.d.ts.map +1 -0
  499. package/dist/html.mjs +2 -0
  500. package/dist/html.mjs.map +1 -0
  501. package/dist/i18n/Locale.d.ts +1 -0
  502. package/dist/i18n/Locale.d.ts.map +1 -1
  503. package/dist/i18n/index.d.ts +0 -1
  504. package/dist/i18n/index.d.ts.map +1 -1
  505. package/dist/index.d.ts +29 -93
  506. package/dist/index.d.ts.map +1 -1
  507. package/dist/input/BlockInsertion.d.ts +51 -0
  508. package/dist/input/BlockInsertion.d.ts.map +1 -0
  509. package/dist/input/ClipboardHandler.d.ts +22 -0
  510. package/dist/input/ClipboardHandler.d.ts.map +1 -1
  511. package/dist/input/CompositionTracker.d.ts +2 -1
  512. package/dist/input/CompositionTracker.d.ts.map +1 -1
  513. package/dist/{model → input}/HTMLParser.d.ts +3 -3
  514. package/dist/input/HTMLParser.d.ts.map +1 -0
  515. package/dist/input/InputHandler.d.ts +1 -1
  516. package/dist/input/InputHandler.d.ts.map +1 -1
  517. package/dist/input/InputManager.d.ts +35 -0
  518. package/dist/input/InputManager.d.ts.map +1 -0
  519. package/dist/input/InternalClipboard.d.ts +11 -1
  520. package/dist/input/InternalClipboard.d.ts.map +1 -1
  521. package/dist/input/KeyboardHandler.d.ts +12 -1
  522. package/dist/input/KeyboardHandler.d.ts.map +1 -1
  523. package/dist/input/PasteHandler.d.ts +21 -17
  524. package/dist/input/PasteHandler.d.ts.map +1 -1
  525. package/dist/model/AttrRegistry.d.ts +1 -1
  526. package/dist/model/AttrRegistry.d.ts.map +1 -1
  527. package/dist/model/BlockAlignment.d.ts +8 -0
  528. package/dist/model/BlockAlignment.d.ts.map +1 -0
  529. package/dist/model/BlockTypeLabels.d.ts +7 -0
  530. package/dist/model/BlockTypeLabels.d.ts.map +1 -0
  531. package/dist/model/CompositionState.d.ts +8 -0
  532. package/dist/model/CompositionState.d.ts.map +1 -0
  533. package/dist/{input → model}/FileHandlerRegistry.d.ts +1 -1
  534. package/dist/{input → model}/FileHandlerRegistry.d.ts.map +1 -1
  535. package/dist/model/HTMLUtils.d.ts +6 -0
  536. package/dist/model/HTMLUtils.d.ts.map +1 -1
  537. package/dist/{input → model}/InputRule.d.ts.map +1 -1
  538. package/dist/{input → model}/InputRuleRegistry.d.ts.map +1 -1
  539. package/dist/{input → model}/Keymap.d.ts.map +1 -1
  540. package/dist/{input → model}/KeymapRegistry.d.ts.map +1 -1
  541. package/dist/model/MarkSpec.d.ts +2 -2
  542. package/dist/model/MarkSpec.d.ts.map +1 -1
  543. package/dist/model/NodeSpec.d.ts +0 -3
  544. package/dist/model/NodeSpec.d.ts.map +1 -1
  545. package/dist/model/PaperSize.d.ts.map +1 -0
  546. package/dist/model/WordBoundary.d.ts +12 -0
  547. package/dist/model/WordBoundary.d.ts.map +1 -0
  548. package/dist/notectl-core.mjs +1 -3888
  549. package/dist/notectl-core.mjs.map +1 -1
  550. package/dist/notectl-core.umd.js +1 -9523
  551. package/dist/notectl-core.umd.js.map +1 -1
  552. package/dist/{view → platform}/Platform.d.ts +2 -0
  553. package/dist/platform/Platform.d.ts.map +1 -0
  554. package/dist/plugins/Plugin.d.ts +5 -5
  555. package/dist/plugins/Plugin.d.ts.map +1 -1
  556. package/dist/plugins/PluginManager.d.ts +3 -3
  557. package/dist/plugins/alignment/AlignmentLocale.d.ts +3 -10
  558. package/dist/plugins/alignment/AlignmentLocale.d.ts.map +1 -1
  559. package/dist/plugins/alignment/AlignmentPlugin.d.ts +3 -13
  560. package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
  561. package/dist/plugins/alignment/index.d.ts +3 -1
  562. package/dist/plugins/alignment/index.d.ts.map +1 -1
  563. package/dist/plugins/alignment/locales/ar.d.ts +4 -0
  564. package/dist/plugins/alignment/locales/ar.d.ts.map +1 -0
  565. package/dist/plugins/alignment/locales/de.d.ts +4 -0
  566. package/dist/plugins/alignment/locales/de.d.ts.map +1 -0
  567. package/dist/plugins/alignment/locales/es.d.ts +4 -0
  568. package/dist/plugins/alignment/locales/es.d.ts.map +1 -0
  569. package/dist/plugins/alignment/locales/fr.d.ts +4 -0
  570. package/dist/plugins/alignment/locales/fr.d.ts.map +1 -0
  571. package/dist/plugins/alignment/locales/hi.d.ts +4 -0
  572. package/dist/plugins/alignment/locales/hi.d.ts.map +1 -0
  573. package/dist/plugins/alignment/locales/pt.d.ts +4 -0
  574. package/dist/plugins/alignment/locales/pt.d.ts.map +1 -0
  575. package/dist/plugins/alignment/locales/ru.d.ts +4 -0
  576. package/dist/plugins/alignment/locales/ru.d.ts.map +1 -0
  577. package/dist/plugins/alignment/locales/zh.d.ts +4 -0
  578. package/dist/plugins/alignment/locales/zh.d.ts.map +1 -0
  579. package/dist/plugins/alignment.mjs +1 -5
  580. package/dist/plugins/alignment.mjs.map +1 -1
  581. package/dist/plugins/blockquote/BlockquoteKeyboardHandlers.d.ts +4 -0
  582. package/dist/plugins/blockquote/BlockquoteKeyboardHandlers.d.ts.map +1 -0
  583. package/dist/plugins/blockquote/BlockquoteLocale.d.ts +1 -8
  584. package/dist/plugins/blockquote/BlockquoteLocale.d.ts.map +1 -1
  585. package/dist/plugins/blockquote/BlockquotePlugin.d.ts +1 -3
  586. package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
  587. package/dist/plugins/blockquote/BlockquoteStyles.d.ts +3 -0
  588. package/dist/plugins/blockquote/BlockquoteStyles.d.ts.map +1 -0
  589. package/dist/plugins/blockquote/index.d.ts +2 -0
  590. package/dist/plugins/blockquote/index.d.ts.map +1 -1
  591. package/dist/plugins/blockquote/locales/ar.d.ts +4 -0
  592. package/dist/plugins/blockquote/locales/ar.d.ts.map +1 -0
  593. package/dist/plugins/blockquote/locales/de.d.ts +4 -0
  594. package/dist/plugins/blockquote/locales/de.d.ts.map +1 -0
  595. package/dist/plugins/blockquote/locales/es.d.ts +4 -0
  596. package/dist/plugins/blockquote/locales/es.d.ts.map +1 -0
  597. package/dist/plugins/blockquote/locales/fr.d.ts +4 -0
  598. package/dist/plugins/blockquote/locales/fr.d.ts.map +1 -0
  599. package/dist/plugins/blockquote/locales/hi.d.ts +4 -0
  600. package/dist/plugins/blockquote/locales/hi.d.ts.map +1 -0
  601. package/dist/plugins/blockquote/locales/pt.d.ts +4 -0
  602. package/dist/plugins/blockquote/locales/pt.d.ts.map +1 -0
  603. package/dist/plugins/blockquote/locales/ru.d.ts +4 -0
  604. package/dist/plugins/blockquote/locales/ru.d.ts.map +1 -0
  605. package/dist/plugins/blockquote/locales/zh.d.ts +4 -0
  606. package/dist/plugins/blockquote/locales/zh.d.ts.map +1 -0
  607. package/dist/plugins/blockquote.mjs +1 -4
  608. package/dist/plugins/blockquote.mjs.map +1 -1
  609. package/dist/plugins/caret-navigation/CaretNavigationLocale.d.ts +21 -0
  610. package/dist/plugins/caret-navigation/CaretNavigationLocale.d.ts.map +1 -0
  611. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts +2 -1
  612. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts.map +1 -1
  613. package/dist/plugins/caret-navigation/index.d.ts +2 -0
  614. package/dist/plugins/caret-navigation/index.d.ts.map +1 -1
  615. package/dist/plugins/caret-navigation/locales/ar.d.ts +4 -0
  616. package/dist/plugins/caret-navigation/locales/ar.d.ts.map +1 -0
  617. package/dist/plugins/caret-navigation/locales/de.d.ts +4 -0
  618. package/dist/plugins/caret-navigation/locales/de.d.ts.map +1 -0
  619. package/dist/plugins/caret-navigation/locales/es.d.ts +4 -0
  620. package/dist/plugins/caret-navigation/locales/es.d.ts.map +1 -0
  621. package/dist/plugins/caret-navigation/locales/fr.d.ts +4 -0
  622. package/dist/plugins/caret-navigation/locales/fr.d.ts.map +1 -0
  623. package/dist/plugins/caret-navigation/locales/hi.d.ts +4 -0
  624. package/dist/plugins/caret-navigation/locales/hi.d.ts.map +1 -0
  625. package/dist/plugins/caret-navigation/locales/pt.d.ts +4 -0
  626. package/dist/plugins/caret-navigation/locales/pt.d.ts.map +1 -0
  627. package/dist/plugins/caret-navigation/locales/ru.d.ts +4 -0
  628. package/dist/plugins/caret-navigation/locales/ru.d.ts.map +1 -0
  629. package/dist/plugins/caret-navigation/locales/zh.d.ts +4 -0
  630. package/dist/plugins/caret-navigation/locales/zh.d.ts.map +1 -0
  631. package/dist/plugins/caret-navigation.mjs +1 -4
  632. package/dist/plugins/caret-navigation.mjs.map +1 -1
  633. package/dist/plugins/code-block/CodeBlockLocale.d.ts +5 -8
  634. package/dist/plugins/code-block/CodeBlockLocale.d.ts.map +1 -1
  635. package/dist/plugins/code-block/CodeBlockNodeView.d.ts +2 -1
  636. package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
  637. package/dist/plugins/code-block/CodeBlockPlugin.d.ts +2 -2
  638. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  639. package/dist/plugins/code-block/CodeBlockService.d.ts.map +1 -1
  640. package/dist/plugins/code-block/CodeBlockTypes.d.ts +0 -1
  641. package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
  642. package/dist/plugins/code-block/index.d.ts +2 -0
  643. package/dist/plugins/code-block/index.d.ts.map +1 -1
  644. package/dist/plugins/code-block/locales/ar.d.ts +4 -0
  645. package/dist/plugins/code-block/locales/ar.d.ts.map +1 -0
  646. package/dist/plugins/code-block/locales/de.d.ts +4 -0
  647. package/dist/plugins/code-block/locales/de.d.ts.map +1 -0
  648. package/dist/plugins/code-block/locales/es.d.ts +4 -0
  649. package/dist/plugins/code-block/locales/es.d.ts.map +1 -0
  650. package/dist/plugins/code-block/locales/fr.d.ts +4 -0
  651. package/dist/plugins/code-block/locales/fr.d.ts.map +1 -0
  652. package/dist/plugins/code-block/locales/hi.d.ts +4 -0
  653. package/dist/plugins/code-block/locales/hi.d.ts.map +1 -0
  654. package/dist/plugins/code-block/locales/pt.d.ts +4 -0
  655. package/dist/plugins/code-block/locales/pt.d.ts.map +1 -0
  656. package/dist/plugins/code-block/locales/ru.d.ts +4 -0
  657. package/dist/plugins/code-block/locales/ru.d.ts.map +1 -0
  658. package/dist/plugins/code-block/locales/zh.d.ts +4 -0
  659. package/dist/plugins/code-block/locales/zh.d.ts.map +1 -0
  660. package/dist/plugins/code-block.mjs +1 -5
  661. package/dist/plugins/code-block.mjs.map +1 -1
  662. package/dist/plugins/font/FontLocale.d.ts +1 -8
  663. package/dist/plugins/font/FontLocale.d.ts.map +1 -1
  664. package/dist/plugins/font/FontPlugin.d.ts +1 -3
  665. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  666. package/dist/plugins/font/index.d.ts +2 -0
  667. package/dist/plugins/font/index.d.ts.map +1 -1
  668. package/dist/plugins/font/locales/ar.d.ts +4 -0
  669. package/dist/plugins/font/locales/ar.d.ts.map +1 -0
  670. package/dist/plugins/font/locales/de.d.ts +4 -0
  671. package/dist/plugins/font/locales/de.d.ts.map +1 -0
  672. package/dist/plugins/font/locales/es.d.ts +4 -0
  673. package/dist/plugins/font/locales/es.d.ts.map +1 -0
  674. package/dist/plugins/font/locales/fr.d.ts +4 -0
  675. package/dist/plugins/font/locales/fr.d.ts.map +1 -0
  676. package/dist/plugins/font/locales/hi.d.ts +4 -0
  677. package/dist/plugins/font/locales/hi.d.ts.map +1 -0
  678. package/dist/plugins/font/locales/pt.d.ts +4 -0
  679. package/dist/plugins/font/locales/pt.d.ts.map +1 -0
  680. package/dist/plugins/font/locales/ru.d.ts +4 -0
  681. package/dist/plugins/font/locales/ru.d.ts.map +1 -0
  682. package/dist/plugins/font/locales/zh.d.ts +4 -0
  683. package/dist/plugins/font/locales/zh.d.ts.map +1 -0
  684. package/dist/plugins/font-size/FontSizeLocale.d.ts +1 -8
  685. package/dist/plugins/font-size/FontSizeLocale.d.ts.map +1 -1
  686. package/dist/plugins/font-size/FontSizePlugin.d.ts +1 -3
  687. package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
  688. package/dist/plugins/font-size/FontSizePopup.d.ts +1 -1
  689. package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
  690. package/dist/plugins/font-size/index.d.ts +2 -0
  691. package/dist/plugins/font-size/index.d.ts.map +1 -1
  692. package/dist/plugins/font-size/locales/ar.d.ts +4 -0
  693. package/dist/plugins/font-size/locales/ar.d.ts.map +1 -0
  694. package/dist/plugins/font-size/locales/de.d.ts +4 -0
  695. package/dist/plugins/font-size/locales/de.d.ts.map +1 -0
  696. package/dist/plugins/font-size/locales/es.d.ts +4 -0
  697. package/dist/plugins/font-size/locales/es.d.ts.map +1 -0
  698. package/dist/plugins/font-size/locales/fr.d.ts +4 -0
  699. package/dist/plugins/font-size/locales/fr.d.ts.map +1 -0
  700. package/dist/plugins/font-size/locales/hi.d.ts +4 -0
  701. package/dist/plugins/font-size/locales/hi.d.ts.map +1 -0
  702. package/dist/plugins/font-size/locales/pt.d.ts +4 -0
  703. package/dist/plugins/font-size/locales/pt.d.ts.map +1 -0
  704. package/dist/plugins/font-size/locales/ru.d.ts +4 -0
  705. package/dist/plugins/font-size/locales/ru.d.ts.map +1 -0
  706. package/dist/plugins/font-size/locales/zh.d.ts +4 -0
  707. package/dist/plugins/font-size/locales/zh.d.ts.map +1 -0
  708. package/dist/plugins/font-size.mjs +1 -4
  709. package/dist/plugins/font-size.mjs.map +1 -1
  710. package/dist/plugins/font.mjs +1 -4
  711. package/dist/plugins/font.mjs.map +1 -1
  712. package/dist/plugins/gap-cursor/GapCursorLocale.d.ts +7 -0
  713. package/dist/plugins/gap-cursor/GapCursorLocale.d.ts.map +1 -0
  714. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts +7 -3
  715. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -1
  716. package/dist/plugins/gap-cursor/locales/ar.d.ts +4 -0
  717. package/dist/plugins/gap-cursor/locales/ar.d.ts.map +1 -0
  718. package/dist/plugins/gap-cursor/locales/de.d.ts +4 -0
  719. package/dist/plugins/gap-cursor/locales/de.d.ts.map +1 -0
  720. package/dist/plugins/gap-cursor/locales/es.d.ts +4 -0
  721. package/dist/plugins/gap-cursor/locales/es.d.ts.map +1 -0
  722. package/dist/plugins/gap-cursor/locales/fr.d.ts +4 -0
  723. package/dist/plugins/gap-cursor/locales/fr.d.ts.map +1 -0
  724. package/dist/plugins/gap-cursor/locales/hi.d.ts +4 -0
  725. package/dist/plugins/gap-cursor/locales/hi.d.ts.map +1 -0
  726. package/dist/plugins/gap-cursor/locales/pt.d.ts +4 -0
  727. package/dist/plugins/gap-cursor/locales/pt.d.ts.map +1 -0
  728. package/dist/plugins/gap-cursor/locales/ru.d.ts +4 -0
  729. package/dist/plugins/gap-cursor/locales/ru.d.ts.map +1 -0
  730. package/dist/plugins/gap-cursor/locales/zh.d.ts +4 -0
  731. package/dist/plugins/gap-cursor/locales/zh.d.ts.map +1 -0
  732. package/dist/plugins/gap-cursor.mjs +1 -64
  733. package/dist/plugins/gap-cursor.mjs.map +1 -1
  734. package/dist/plugins/hard-break.mjs +1 -4
  735. package/dist/plugins/hard-break.mjs.map +1 -1
  736. package/dist/plugins/heading/HeadingBlockTypePicker.d.ts +1 -1
  737. package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -1
  738. package/dist/plugins/heading/HeadingLocale.d.ts +1 -8
  739. package/dist/plugins/heading/HeadingLocale.d.ts.map +1 -1
  740. package/dist/plugins/heading/HeadingPlugin.d.ts +2 -4
  741. package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
  742. package/dist/plugins/heading/index.d.ts +3 -0
  743. package/dist/plugins/heading/index.d.ts.map +1 -1
  744. package/dist/plugins/heading/locales/ar.d.ts +4 -0
  745. package/dist/plugins/heading/locales/ar.d.ts.map +1 -0
  746. package/dist/plugins/heading/locales/de.d.ts +4 -0
  747. package/dist/plugins/heading/locales/de.d.ts.map +1 -0
  748. package/dist/plugins/heading/locales/es.d.ts +4 -0
  749. package/dist/plugins/heading/locales/es.d.ts.map +1 -0
  750. package/dist/plugins/heading/locales/fr.d.ts +4 -0
  751. package/dist/plugins/heading/locales/fr.d.ts.map +1 -0
  752. package/dist/plugins/heading/locales/hi.d.ts +4 -0
  753. package/dist/plugins/heading/locales/hi.d.ts.map +1 -0
  754. package/dist/plugins/heading/locales/pt.d.ts +4 -0
  755. package/dist/plugins/heading/locales/pt.d.ts.map +1 -0
  756. package/dist/plugins/heading/locales/ru.d.ts +4 -0
  757. package/dist/plugins/heading/locales/ru.d.ts.map +1 -0
  758. package/dist/plugins/heading/locales/zh.d.ts +4 -0
  759. package/dist/plugins/heading/locales/zh.d.ts.map +1 -0
  760. package/dist/plugins/heading.mjs +1 -4
  761. package/dist/plugins/heading.mjs.map +1 -1
  762. package/dist/plugins/highlight/HighlightLocale.d.ts +1 -8
  763. package/dist/plugins/highlight/HighlightLocale.d.ts.map +1 -1
  764. package/dist/plugins/highlight/HighlightPlugin.d.ts +1 -3
  765. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
  766. package/dist/plugins/highlight/index.d.ts +2 -0
  767. package/dist/plugins/highlight/index.d.ts.map +1 -1
  768. package/dist/plugins/highlight/locales/ar.d.ts +4 -0
  769. package/dist/plugins/highlight/locales/ar.d.ts.map +1 -0
  770. package/dist/plugins/highlight/locales/de.d.ts +4 -0
  771. package/dist/plugins/highlight/locales/de.d.ts.map +1 -0
  772. package/dist/plugins/highlight/locales/es.d.ts +4 -0
  773. package/dist/plugins/highlight/locales/es.d.ts.map +1 -0
  774. package/dist/plugins/highlight/locales/fr.d.ts +4 -0
  775. package/dist/plugins/highlight/locales/fr.d.ts.map +1 -0
  776. package/dist/plugins/highlight/locales/hi.d.ts +4 -0
  777. package/dist/plugins/highlight/locales/hi.d.ts.map +1 -0
  778. package/dist/plugins/highlight/locales/pt.d.ts +4 -0
  779. package/dist/plugins/highlight/locales/pt.d.ts.map +1 -0
  780. package/dist/plugins/highlight/locales/ru.d.ts +4 -0
  781. package/dist/plugins/highlight/locales/ru.d.ts.map +1 -0
  782. package/dist/plugins/highlight/locales/zh.d.ts +4 -0
  783. package/dist/plugins/highlight/locales/zh.d.ts.map +1 -0
  784. package/dist/plugins/highlight.mjs +1 -4
  785. package/dist/plugins/highlight.mjs.map +1 -1
  786. package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts +1 -8
  787. package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts.map +1 -1
  788. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +1 -3
  789. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
  790. package/dist/plugins/horizontal-rule/index.d.ts +2 -0
  791. package/dist/plugins/horizontal-rule/index.d.ts.map +1 -1
  792. package/dist/plugins/horizontal-rule/locales/ar.d.ts +4 -0
  793. package/dist/plugins/horizontal-rule/locales/ar.d.ts.map +1 -0
  794. package/dist/plugins/horizontal-rule/locales/de.d.ts +4 -0
  795. package/dist/plugins/horizontal-rule/locales/de.d.ts.map +1 -0
  796. package/dist/plugins/horizontal-rule/locales/es.d.ts +4 -0
  797. package/dist/plugins/horizontal-rule/locales/es.d.ts.map +1 -0
  798. package/dist/plugins/horizontal-rule/locales/fr.d.ts +4 -0
  799. package/dist/plugins/horizontal-rule/locales/fr.d.ts.map +1 -0
  800. package/dist/plugins/horizontal-rule/locales/hi.d.ts +4 -0
  801. package/dist/plugins/horizontal-rule/locales/hi.d.ts.map +1 -0
  802. package/dist/plugins/horizontal-rule/locales/pt.d.ts +4 -0
  803. package/dist/plugins/horizontal-rule/locales/pt.d.ts.map +1 -0
  804. package/dist/plugins/horizontal-rule/locales/ru.d.ts +4 -0
  805. package/dist/plugins/horizontal-rule/locales/ru.d.ts.map +1 -0
  806. package/dist/plugins/horizontal-rule/locales/zh.d.ts +4 -0
  807. package/dist/plugins/horizontal-rule/locales/zh.d.ts.map +1 -0
  808. package/dist/plugins/horizontal-rule.mjs +1 -4
  809. package/dist/plugins/horizontal-rule.mjs.map +1 -1
  810. package/dist/plugins/image/ImageLocale.d.ts +9 -8
  811. package/dist/plugins/image/ImageLocale.d.ts.map +1 -1
  812. package/dist/plugins/image/ImageNodeView.d.ts +8 -1
  813. package/dist/plugins/image/ImageNodeView.d.ts.map +1 -1
  814. package/dist/plugins/image/ImagePlugin.d.ts +2 -2
  815. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  816. package/dist/plugins/image/ImageUpload.d.ts +1 -2
  817. package/dist/plugins/image/ImageUpload.d.ts.map +1 -1
  818. package/dist/plugins/image/index.d.ts +2 -0
  819. package/dist/plugins/image/index.d.ts.map +1 -1
  820. package/dist/plugins/image/locales/ar.d.ts +4 -0
  821. package/dist/plugins/image/locales/ar.d.ts.map +1 -0
  822. package/dist/plugins/image/locales/de.d.ts +4 -0
  823. package/dist/plugins/image/locales/de.d.ts.map +1 -0
  824. package/dist/plugins/image/locales/es.d.ts +4 -0
  825. package/dist/plugins/image/locales/es.d.ts.map +1 -0
  826. package/dist/plugins/image/locales/fr.d.ts +4 -0
  827. package/dist/plugins/image/locales/fr.d.ts.map +1 -0
  828. package/dist/plugins/image/locales/hi.d.ts +4 -0
  829. package/dist/plugins/image/locales/hi.d.ts.map +1 -0
  830. package/dist/plugins/image/locales/pt.d.ts +4 -0
  831. package/dist/plugins/image/locales/pt.d.ts.map +1 -0
  832. package/dist/plugins/image/locales/ru.d.ts +4 -0
  833. package/dist/plugins/image/locales/ru.d.ts.map +1 -0
  834. package/dist/plugins/image/locales/zh.d.ts +4 -0
  835. package/dist/plugins/image/locales/zh.d.ts.map +1 -0
  836. package/dist/plugins/image.mjs +1 -6
  837. package/dist/plugins/image.mjs.map +1 -1
  838. package/dist/plugins/link/LinkLocale.d.ts +1 -8
  839. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  840. package/dist/plugins/link/LinkPlugin.d.ts +1 -3
  841. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  842. package/dist/plugins/link/index.d.ts +2 -0
  843. package/dist/plugins/link/index.d.ts.map +1 -1
  844. package/dist/plugins/link/locales/ar.d.ts +4 -0
  845. package/dist/plugins/link/locales/ar.d.ts.map +1 -0
  846. package/dist/plugins/link/locales/de.d.ts +4 -0
  847. package/dist/plugins/link/locales/de.d.ts.map +1 -0
  848. package/dist/plugins/link/locales/es.d.ts +4 -0
  849. package/dist/plugins/link/locales/es.d.ts.map +1 -0
  850. package/dist/plugins/link/locales/fr.d.ts +4 -0
  851. package/dist/plugins/link/locales/fr.d.ts.map +1 -0
  852. package/dist/plugins/link/locales/hi.d.ts +4 -0
  853. package/dist/plugins/link/locales/hi.d.ts.map +1 -0
  854. package/dist/plugins/link/locales/pt.d.ts +4 -0
  855. package/dist/plugins/link/locales/pt.d.ts.map +1 -0
  856. package/dist/plugins/link/locales/ru.d.ts +4 -0
  857. package/dist/plugins/link/locales/ru.d.ts.map +1 -0
  858. package/dist/plugins/link/locales/zh.d.ts +4 -0
  859. package/dist/plugins/link/locales/zh.d.ts.map +1 -0
  860. package/dist/plugins/link.mjs +1 -4
  861. package/dist/plugins/link.mjs.map +1 -1
  862. package/dist/plugins/list/ListLocale.d.ts +1 -8
  863. package/dist/plugins/list/ListLocale.d.ts.map +1 -1
  864. package/dist/plugins/list/ListPlugin.d.ts +1 -3
  865. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  866. package/dist/plugins/list/index.d.ts +2 -0
  867. package/dist/plugins/list/index.d.ts.map +1 -1
  868. package/dist/plugins/list/locales/ar.d.ts +4 -0
  869. package/dist/plugins/list/locales/ar.d.ts.map +1 -0
  870. package/dist/plugins/list/locales/de.d.ts +4 -0
  871. package/dist/plugins/list/locales/de.d.ts.map +1 -0
  872. package/dist/plugins/list/locales/es.d.ts +4 -0
  873. package/dist/plugins/list/locales/es.d.ts.map +1 -0
  874. package/dist/plugins/list/locales/fr.d.ts +4 -0
  875. package/dist/plugins/list/locales/fr.d.ts.map +1 -0
  876. package/dist/plugins/list/locales/hi.d.ts +4 -0
  877. package/dist/plugins/list/locales/hi.d.ts.map +1 -0
  878. package/dist/plugins/list/locales/pt.d.ts +4 -0
  879. package/dist/plugins/list/locales/pt.d.ts.map +1 -0
  880. package/dist/plugins/list/locales/ru.d.ts +4 -0
  881. package/dist/plugins/list/locales/ru.d.ts.map +1 -0
  882. package/dist/plugins/list/locales/zh.d.ts +4 -0
  883. package/dist/plugins/list/locales/zh.d.ts.map +1 -0
  884. package/dist/plugins/list.mjs +1 -4
  885. package/dist/plugins/list.mjs.map +1 -1
  886. package/dist/plugins/print/PrintLocale.d.ts +1 -8
  887. package/dist/plugins/print/PrintLocale.d.ts.map +1 -1
  888. package/dist/plugins/print/PrintPlugin.d.ts +1 -1
  889. package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
  890. package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -1
  891. package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
  892. package/dist/plugins/print/PrintTypes.d.ts +1 -1
  893. package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
  894. package/dist/plugins/print/index.d.ts +5 -0
  895. package/dist/plugins/print/index.d.ts.map +1 -0
  896. package/dist/plugins/print/locales/ar.d.ts +4 -0
  897. package/dist/plugins/print/locales/ar.d.ts.map +1 -0
  898. package/dist/plugins/print/locales/de.d.ts +4 -0
  899. package/dist/plugins/print/locales/de.d.ts.map +1 -0
  900. package/dist/plugins/print/locales/es.d.ts +4 -0
  901. package/dist/plugins/print/locales/es.d.ts.map +1 -0
  902. package/dist/plugins/print/locales/fr.d.ts +4 -0
  903. package/dist/plugins/print/locales/fr.d.ts.map +1 -0
  904. package/dist/plugins/print/locales/hi.d.ts +4 -0
  905. package/dist/plugins/print/locales/hi.d.ts.map +1 -0
  906. package/dist/plugins/print/locales/pt.d.ts +4 -0
  907. package/dist/plugins/print/locales/pt.d.ts.map +1 -0
  908. package/dist/plugins/print/locales/ru.d.ts +4 -0
  909. package/dist/plugins/print/locales/ru.d.ts.map +1 -0
  910. package/dist/plugins/print/locales/zh.d.ts +4 -0
  911. package/dist/plugins/print/locales/zh.d.ts.map +1 -0
  912. package/dist/plugins/print.mjs +2 -0
  913. package/dist/plugins/print.mjs.map +1 -0
  914. package/dist/plugins/shared/ColorGrid.d.ts.map +1 -1
  915. package/dist/plugins/shared/KeyboardNav.d.ts +17 -0
  916. package/dist/plugins/shared/KeyboardNav.d.ts.map +1 -0
  917. package/dist/plugins/shared/PluginHelpers.d.ts +10 -0
  918. package/dist/plugins/shared/PluginHelpers.d.ts.map +1 -0
  919. package/dist/plugins/shared/PopupKeyboardPatterns.d.ts +1 -1
  920. package/dist/plugins/shared/PopupKeyboardPatterns.d.ts.map +1 -1
  921. package/dist/plugins/shared/PopupManager.d.ts +2 -0
  922. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  923. package/dist/plugins/shared/PopupPositioning.d.ts +1 -0
  924. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  925. package/dist/plugins/shared/ShortcutFormatting.d.ts +9 -0
  926. package/dist/plugins/shared/ShortcutFormatting.d.ts.map +1 -0
  927. package/dist/plugins/shared/index.d.ts +12 -0
  928. package/dist/plugins/shared/index.d.ts.map +1 -0
  929. package/dist/plugins/shared.mjs +2 -0
  930. package/dist/plugins/shared.mjs.map +1 -0
  931. package/dist/plugins/strikethrough/StrikethroughLocale.d.ts +1 -8
  932. package/dist/plugins/strikethrough/StrikethroughLocale.d.ts.map +1 -1
  933. package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +1 -3
  934. package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
  935. package/dist/plugins/strikethrough/index.d.ts +2 -0
  936. package/dist/plugins/strikethrough/index.d.ts.map +1 -1
  937. package/dist/plugins/strikethrough/locales/ar.d.ts +4 -0
  938. package/dist/plugins/strikethrough/locales/ar.d.ts.map +1 -0
  939. package/dist/plugins/strikethrough/locales/de.d.ts +4 -0
  940. package/dist/plugins/strikethrough/locales/de.d.ts.map +1 -0
  941. package/dist/plugins/strikethrough/locales/es.d.ts +4 -0
  942. package/dist/plugins/strikethrough/locales/es.d.ts.map +1 -0
  943. package/dist/plugins/strikethrough/locales/fr.d.ts +4 -0
  944. package/dist/plugins/strikethrough/locales/fr.d.ts.map +1 -0
  945. package/dist/plugins/strikethrough/locales/hi.d.ts +4 -0
  946. package/dist/plugins/strikethrough/locales/hi.d.ts.map +1 -0
  947. package/dist/plugins/strikethrough/locales/pt.d.ts +4 -0
  948. package/dist/plugins/strikethrough/locales/pt.d.ts.map +1 -0
  949. package/dist/plugins/strikethrough/locales/ru.d.ts +4 -0
  950. package/dist/plugins/strikethrough/locales/ru.d.ts.map +1 -0
  951. package/dist/plugins/strikethrough/locales/zh.d.ts +4 -0
  952. package/dist/plugins/strikethrough/locales/zh.d.ts.map +1 -0
  953. package/dist/plugins/strikethrough.mjs +1 -4
  954. package/dist/plugins/strikethrough.mjs.map +1 -1
  955. package/dist/plugins/super-sub/SuperSubLocale.d.ts +1 -8
  956. package/dist/plugins/super-sub/SuperSubLocale.d.ts.map +1 -1
  957. package/dist/plugins/super-sub/SuperSubPlugin.d.ts +1 -3
  958. package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
  959. package/dist/plugins/super-sub/index.d.ts +2 -0
  960. package/dist/plugins/super-sub/index.d.ts.map +1 -1
  961. package/dist/plugins/super-sub/locales/ar.d.ts +4 -0
  962. package/dist/plugins/super-sub/locales/ar.d.ts.map +1 -0
  963. package/dist/plugins/super-sub/locales/de.d.ts +4 -0
  964. package/dist/plugins/super-sub/locales/de.d.ts.map +1 -0
  965. package/dist/plugins/super-sub/locales/es.d.ts +4 -0
  966. package/dist/plugins/super-sub/locales/es.d.ts.map +1 -0
  967. package/dist/plugins/super-sub/locales/fr.d.ts +4 -0
  968. package/dist/plugins/super-sub/locales/fr.d.ts.map +1 -0
  969. package/dist/plugins/super-sub/locales/hi.d.ts +4 -0
  970. package/dist/plugins/super-sub/locales/hi.d.ts.map +1 -0
  971. package/dist/plugins/super-sub/locales/pt.d.ts +4 -0
  972. package/dist/plugins/super-sub/locales/pt.d.ts.map +1 -0
  973. package/dist/plugins/super-sub/locales/ru.d.ts +4 -0
  974. package/dist/plugins/super-sub/locales/ru.d.ts.map +1 -0
  975. package/dist/plugins/super-sub/locales/zh.d.ts +4 -0
  976. package/dist/plugins/super-sub/locales/zh.d.ts.map +1 -0
  977. package/dist/plugins/super-sub.mjs +1 -4
  978. package/dist/plugins/super-sub.mjs.map +1 -1
  979. package/dist/plugins/table/TableCommands.d.ts +8 -8
  980. package/dist/plugins/table/TableCommands.d.ts.map +1 -1
  981. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  982. package/dist/plugins/table/TableControlsDOM.d.ts +4 -4
  983. package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
  984. package/dist/plugins/table/TableLocale.d.ts +1 -8
  985. package/dist/plugins/table/TableLocale.d.ts.map +1 -1
  986. package/dist/plugins/table/TableNavigation.d.ts +1 -1
  987. package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
  988. package/dist/plugins/table/TablePlugin.d.ts +3 -5
  989. package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
  990. package/dist/plugins/table/TableSelection.d.ts +2 -0
  991. package/dist/plugins/table/TableSelection.d.ts.map +1 -1
  992. package/dist/plugins/table/index.d.ts +0 -5
  993. package/dist/plugins/table/index.d.ts.map +1 -1
  994. package/dist/plugins/table/locales/ar.d.ts +4 -0
  995. package/dist/plugins/table/locales/ar.d.ts.map +1 -0
  996. package/dist/plugins/table/locales/de.d.ts +4 -0
  997. package/dist/plugins/table/locales/de.d.ts.map +1 -0
  998. package/dist/plugins/table/locales/es.d.ts +4 -0
  999. package/dist/plugins/table/locales/es.d.ts.map +1 -0
  1000. package/dist/plugins/table/locales/fr.d.ts +4 -0
  1001. package/dist/plugins/table/locales/fr.d.ts.map +1 -0
  1002. package/dist/plugins/table/locales/hi.d.ts +4 -0
  1003. package/dist/plugins/table/locales/hi.d.ts.map +1 -0
  1004. package/dist/plugins/table/locales/pt.d.ts +4 -0
  1005. package/dist/plugins/table/locales/pt.d.ts.map +1 -0
  1006. package/dist/plugins/table/locales/ru.d.ts +4 -0
  1007. package/dist/plugins/table/locales/ru.d.ts.map +1 -0
  1008. package/dist/plugins/table/locales/zh.d.ts +4 -0
  1009. package/dist/plugins/table/locales/zh.d.ts.map +1 -0
  1010. package/dist/plugins/table.mjs +1 -20
  1011. package/dist/plugins/table.mjs.map +1 -1
  1012. package/dist/plugins/text-color/TextColorLocale.d.ts +1 -8
  1013. package/dist/plugins/text-color/TextColorLocale.d.ts.map +1 -1
  1014. package/dist/plugins/text-color/TextColorPlugin.d.ts +1 -3
  1015. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
  1016. package/dist/plugins/text-color/index.d.ts +2 -0
  1017. package/dist/plugins/text-color/index.d.ts.map +1 -1
  1018. package/dist/plugins/text-color/locales/ar.d.ts +4 -0
  1019. package/dist/plugins/text-color/locales/ar.d.ts.map +1 -0
  1020. package/dist/plugins/text-color/locales/de.d.ts +4 -0
  1021. package/dist/plugins/text-color/locales/de.d.ts.map +1 -0
  1022. package/dist/plugins/text-color/locales/es.d.ts +4 -0
  1023. package/dist/plugins/text-color/locales/es.d.ts.map +1 -0
  1024. package/dist/plugins/text-color/locales/fr.d.ts +4 -0
  1025. package/dist/plugins/text-color/locales/fr.d.ts.map +1 -0
  1026. package/dist/plugins/text-color/locales/hi.d.ts +4 -0
  1027. package/dist/plugins/text-color/locales/hi.d.ts.map +1 -0
  1028. package/dist/plugins/text-color/locales/pt.d.ts +4 -0
  1029. package/dist/plugins/text-color/locales/pt.d.ts.map +1 -0
  1030. package/dist/plugins/text-color/locales/ru.d.ts +4 -0
  1031. package/dist/plugins/text-color/locales/ru.d.ts.map +1 -0
  1032. package/dist/plugins/text-color/locales/zh.d.ts +4 -0
  1033. package/dist/plugins/text-color/locales/zh.d.ts.map +1 -0
  1034. package/dist/plugins/text-color.mjs +1 -4
  1035. package/dist/plugins/text-color.mjs.map +1 -1
  1036. package/dist/plugins/text-direction/DirectionDetection.d.ts +17 -0
  1037. package/dist/plugins/text-direction/DirectionDetection.d.ts.map +1 -0
  1038. package/dist/plugins/text-direction/ShiftDirectionHandler.d.ts +12 -0
  1039. package/dist/plugins/text-direction/ShiftDirectionHandler.d.ts.map +1 -0
  1040. package/dist/plugins/text-direction/TextDirectionCorePlugin.d.ts +35 -0
  1041. package/dist/plugins/text-direction/TextDirectionCorePlugin.d.ts.map +1 -0
  1042. package/dist/plugins/text-direction/TextDirectionLocale.d.ts +20 -0
  1043. package/dist/plugins/text-direction/TextDirectionLocale.d.ts.map +1 -0
  1044. package/dist/plugins/text-direction/TextDirectionMiddleware.d.ts +18 -0
  1045. package/dist/plugins/text-direction/TextDirectionMiddleware.d.ts.map +1 -0
  1046. package/dist/plugins/text-direction/TextDirectionPlugin.d.ts +59 -0
  1047. package/dist/plugins/text-direction/TextDirectionPlugin.d.ts.map +1 -0
  1048. package/dist/plugins/text-direction/index.d.ts +5 -0
  1049. package/dist/plugins/text-direction/index.d.ts.map +1 -0
  1050. package/dist/plugins/text-direction/locales/ar.d.ts +4 -0
  1051. package/dist/plugins/text-direction/locales/ar.d.ts.map +1 -0
  1052. package/dist/plugins/text-direction/locales/de.d.ts +4 -0
  1053. package/dist/plugins/text-direction/locales/de.d.ts.map +1 -0
  1054. package/dist/plugins/text-direction/locales/es.d.ts +4 -0
  1055. package/dist/plugins/text-direction/locales/es.d.ts.map +1 -0
  1056. package/dist/plugins/text-direction/locales/fr.d.ts +4 -0
  1057. package/dist/plugins/text-direction/locales/fr.d.ts.map +1 -0
  1058. package/dist/plugins/text-direction/locales/hi.d.ts +4 -0
  1059. package/dist/plugins/text-direction/locales/hi.d.ts.map +1 -0
  1060. package/dist/plugins/text-direction/locales/pt.d.ts +4 -0
  1061. package/dist/plugins/text-direction/locales/pt.d.ts.map +1 -0
  1062. package/dist/plugins/text-direction/locales/ru.d.ts +4 -0
  1063. package/dist/plugins/text-direction/locales/ru.d.ts.map +1 -0
  1064. package/dist/plugins/text-direction/locales/zh.d.ts +4 -0
  1065. package/dist/plugins/text-direction/locales/zh.d.ts.map +1 -0
  1066. package/dist/plugins/text-direction-advanced/index.d.ts +5 -0
  1067. package/dist/plugins/text-direction-advanced/index.d.ts.map +1 -0
  1068. package/dist/plugins/text-direction-advanced.mjs +2 -0
  1069. package/dist/plugins/text-direction-advanced.mjs.map +1 -0
  1070. package/dist/plugins/text-direction.mjs +2 -0
  1071. package/dist/plugins/text-direction.mjs.map +1 -0
  1072. package/dist/plugins/text-formatting/TextFormattingLocale.d.ts +1 -8
  1073. package/dist/plugins/text-formatting/TextFormattingLocale.d.ts.map +1 -1
  1074. package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +1 -3
  1075. package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
  1076. package/dist/plugins/text-formatting/index.d.ts +2 -0
  1077. package/dist/plugins/text-formatting/index.d.ts.map +1 -1
  1078. package/dist/plugins/text-formatting/locales/ar.d.ts +4 -0
  1079. package/dist/plugins/text-formatting/locales/ar.d.ts.map +1 -0
  1080. package/dist/plugins/text-formatting/locales/de.d.ts +4 -0
  1081. package/dist/plugins/text-formatting/locales/de.d.ts.map +1 -0
  1082. package/dist/plugins/text-formatting/locales/es.d.ts +4 -0
  1083. package/dist/plugins/text-formatting/locales/es.d.ts.map +1 -0
  1084. package/dist/plugins/text-formatting/locales/fr.d.ts +4 -0
  1085. package/dist/plugins/text-formatting/locales/fr.d.ts.map +1 -0
  1086. package/dist/plugins/text-formatting/locales/hi.d.ts +4 -0
  1087. package/dist/plugins/text-formatting/locales/hi.d.ts.map +1 -0
  1088. package/dist/plugins/text-formatting/locales/pt.d.ts +4 -0
  1089. package/dist/plugins/text-formatting/locales/pt.d.ts.map +1 -0
  1090. package/dist/plugins/text-formatting/locales/ru.d.ts +4 -0
  1091. package/dist/plugins/text-formatting/locales/ru.d.ts.map +1 -0
  1092. package/dist/plugins/text-formatting/locales/zh.d.ts +4 -0
  1093. package/dist/plugins/text-formatting/locales/zh.d.ts.map +1 -0
  1094. package/dist/plugins/text-formatting.mjs +1 -4
  1095. package/dist/plugins/text-formatting.mjs.map +1 -1
  1096. package/dist/plugins/toolbar/ToolbarItem.d.ts +2 -18
  1097. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
  1098. package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts +5 -11
  1099. package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts.map +1 -1
  1100. package/dist/plugins/toolbar/ToolbarLocale.d.ts +2 -8
  1101. package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -1
  1102. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  1103. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -2
  1104. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  1105. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +3 -1
  1106. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  1107. package/dist/plugins/toolbar/ToolbarRenderers.d.ts +2 -1
  1108. package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -1
  1109. package/dist/plugins/toolbar/index.d.ts +4 -1
  1110. package/dist/plugins/toolbar/index.d.ts.map +1 -1
  1111. package/dist/plugins/toolbar/locales/ar.d.ts +4 -0
  1112. package/dist/plugins/toolbar/locales/ar.d.ts.map +1 -0
  1113. package/dist/plugins/toolbar/locales/de.d.ts +4 -0
  1114. package/dist/plugins/toolbar/locales/de.d.ts.map +1 -0
  1115. package/dist/plugins/toolbar/locales/es.d.ts +4 -0
  1116. package/dist/plugins/toolbar/locales/es.d.ts.map +1 -0
  1117. package/dist/plugins/toolbar/locales/fr.d.ts +4 -0
  1118. package/dist/plugins/toolbar/locales/fr.d.ts.map +1 -0
  1119. package/dist/plugins/toolbar/locales/hi.d.ts +4 -0
  1120. package/dist/plugins/toolbar/locales/hi.d.ts.map +1 -0
  1121. package/dist/plugins/toolbar/locales/pt.d.ts +4 -0
  1122. package/dist/plugins/toolbar/locales/pt.d.ts.map +1 -0
  1123. package/dist/plugins/toolbar/locales/ru.d.ts +4 -0
  1124. package/dist/plugins/toolbar/locales/ru.d.ts.map +1 -0
  1125. package/dist/plugins/toolbar/locales/zh.d.ts +4 -0
  1126. package/dist/plugins/toolbar/locales/zh.d.ts.map +1 -0
  1127. package/dist/plugins/toolbar.mjs +1 -7
  1128. package/dist/plugins/toolbar.mjs.map +1 -1
  1129. package/dist/presets/FullPreset.d.ts +4 -1
  1130. package/dist/presets/FullPreset.d.ts.map +1 -1
  1131. package/dist/presets/MinimalPreset.d.ts +3 -0
  1132. package/dist/presets/MinimalPreset.d.ts.map +1 -1
  1133. package/dist/presets/PresetTypes.d.ts +2 -0
  1134. package/dist/presets/PresetTypes.d.ts.map +1 -1
  1135. package/dist/presets/full.d.ts +17 -0
  1136. package/dist/presets/full.d.ts.map +1 -0
  1137. package/dist/presets/full.mjs +2 -0
  1138. package/dist/presets/full.mjs.map +1 -0
  1139. package/dist/presets/minimal.d.ts +17 -0
  1140. package/dist/presets/minimal.d.ts.map +1 -0
  1141. package/dist/presets/minimal.mjs +2 -0
  1142. package/dist/presets/minimal.mjs.map +1 -0
  1143. package/dist/presets.d.ts +20 -0
  1144. package/dist/presets.d.ts.map +1 -0
  1145. package/dist/presets.mjs +2 -0
  1146. package/dist/presets.mjs.map +1 -0
  1147. package/dist/serialization/CSSClassCollector.d.ts.map +1 -0
  1148. package/dist/serialization/ContentHTMLTypes.d.ts.map +1 -0
  1149. package/dist/serialization/DocumentParser.d.ts.map +1 -0
  1150. package/dist/{editor → serialization}/DocumentSerializer.d.ts +2 -0
  1151. package/dist/serialization/DocumentSerializer.d.ts.map +1 -0
  1152. package/dist/{editor → serialization}/MarkSerializer.d.ts +3 -2
  1153. package/dist/serialization/MarkSerializer.d.ts.map +1 -0
  1154. package/dist/serialization/index.d.ts +12 -0
  1155. package/dist/serialization/index.d.ts.map +1 -0
  1156. package/dist/state/BlockBoundaryMovement.d.ts +7 -0
  1157. package/dist/state/BlockBoundaryMovement.d.ts.map +1 -0
  1158. package/dist/{model/NavigationUtils.d.ts → state/NavigationQueries.d.ts} +3 -3
  1159. package/dist/state/NavigationQueries.d.ts.map +1 -0
  1160. package/dist/test/PluginTestUtils.d.ts +0 -2
  1161. package/dist/test/PluginTestUtils.d.ts.map +1 -1
  1162. package/dist/test/TestUtils.d.ts +2 -2
  1163. package/dist/test/TestUtils.d.ts.map +1 -1
  1164. package/dist/view/BlockRendering.d.ts +10 -0
  1165. package/dist/view/BlockRendering.d.ts.map +1 -0
  1166. package/dist/view/BlockWrapperManagement.d.ts +27 -0
  1167. package/dist/view/BlockWrapperManagement.d.ts.map +1 -0
  1168. package/dist/view/CaretNavigation.d.ts +1 -8
  1169. package/dist/view/CaretNavigation.d.ts.map +1 -1
  1170. package/dist/view/CursorWrapper.d.ts.map +1 -1
  1171. package/dist/view/DecorationRendering.d.ts +17 -0
  1172. package/dist/view/DecorationRendering.d.ts.map +1 -0
  1173. package/dist/view/DomUtils.d.ts +4 -0
  1174. package/dist/view/DomUtils.d.ts.map +1 -0
  1175. package/dist/view/EditorView.d.ts +7 -10
  1176. package/dist/view/EditorView.d.ts.map +1 -1
  1177. package/dist/view/GapCursorNavigation.d.ts +12 -0
  1178. package/dist/view/GapCursorNavigation.d.ts.map +1 -0
  1179. package/dist/view/InlineRendering.d.ts +11 -0
  1180. package/dist/view/InlineRendering.d.ts.map +1 -0
  1181. package/dist/view/MarkRendering.d.ts +5 -0
  1182. package/dist/view/MarkRendering.d.ts.map +1 -1
  1183. package/dist/view/Reconciler.d.ts +2 -6
  1184. package/dist/view/Reconciler.d.ts.map +1 -1
  1185. package/dist/view/SelectionSync.d.ts +41 -2
  1186. package/dist/view/SelectionSync.d.ts.map +1 -1
  1187. package/dist/view/ViewMovementCommands.d.ts.map +1 -1
  1188. package/package.json +208 -8
  1189. package/dist/chunks/AttrRegistry-D9Jx_RVb.mjs +0 -16
  1190. package/dist/chunks/AttrRegistry-D9Jx_RVb.mjs.map +0 -1
  1191. package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs +0 -80
  1192. package/dist/chunks/CaretNavigation-7JYpIKbs.mjs +0 -311
  1193. package/dist/chunks/CaretNavigation-7JYpIKbs.mjs.map +0 -1
  1194. package/dist/chunks/ColorGrid--lBQ7jCK.mjs +0 -81
  1195. package/dist/chunks/ColorGrid--lBQ7jCK.mjs.map +0 -1
  1196. package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs +0 -37
  1197. package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs.map +0 -1
  1198. package/dist/chunks/ColorValidation-CV4f1wu6.mjs +0 -39
  1199. package/dist/chunks/Document-Brtw2jL1.mjs +0 -190
  1200. package/dist/chunks/HTMLUtils-DTqQzcKR.mjs +0 -35
  1201. package/dist/chunks/HTMLUtils-DTqQzcKR.mjs.map +0 -1
  1202. package/dist/chunks/MarkCommands-6RUJ4L3r.mjs +0 -94
  1203. package/dist/chunks/NavigationUtils-Cspt2ZrK.mjs +0 -47
  1204. package/dist/chunks/NavigationUtils-Cspt2ZrK.mjs.map +0 -1
  1205. package/dist/chunks/NodeResolver-C2XYkeOi.mjs +0 -81
  1206. package/dist/chunks/NodeResolver-C2XYkeOi.mjs.map +0 -1
  1207. package/dist/chunks/NodeSpec-NZVvcCuH.mjs +0 -8
  1208. package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +0 -1
  1209. package/dist/chunks/Platform-S_xqIqcM.mjs +0 -26
  1210. package/dist/chunks/Platform-S_xqIqcM.mjs.map +0 -1
  1211. package/dist/chunks/PopupPositioning-CgjgAKjp.mjs +0 -34
  1212. package/dist/chunks/PopupPositioning-CgjgAKjp.mjs.map +0 -1
  1213. package/dist/chunks/RangeIterator-Bh4Vl_6D.mjs +0 -16
  1214. package/dist/chunks/Selection-BRTab5hO.mjs +0 -52
  1215. package/dist/chunks/StyleRuntime-CP4NCwKT.mjs +0 -235
  1216. package/dist/chunks/ToolbarItem-BpZggUGo.mjs +0 -8
  1217. package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +0 -1
  1218. package/dist/chunks/ToolbarKeyboardNav-DhpL8zNV.mjs +0 -46
  1219. package/dist/chunks/ToolbarKeyboardNav-DhpL8zNV.mjs.map +0 -1
  1220. package/dist/chunks/TypeBrands-C09nE2qO.mjs +0 -27
  1221. package/dist/chunks/index--7pBhSF4.mjs +0 -542
  1222. package/dist/chunks/index--7pBhSF4.mjs.map +0 -1
  1223. package/dist/chunks/index-BXCkjDax.mjs +0 -161
  1224. package/dist/chunks/index-BXCkjDax.mjs.map +0 -1
  1225. package/dist/chunks/index-BXtw5PNN.mjs +0 -39
  1226. package/dist/chunks/index-BXtw5PNN.mjs.map +0 -1
  1227. package/dist/chunks/index-BcDRT4K2.mjs +0 -1019
  1228. package/dist/chunks/index-BcDRT4K2.mjs.map +0 -1
  1229. package/dist/chunks/index-BjFBWBOC.mjs +0 -168
  1230. package/dist/chunks/index-BjFBWBOC.mjs.map +0 -1
  1231. package/dist/chunks/index-C1opJocO.mjs +0 -92
  1232. package/dist/chunks/index-C1opJocO.mjs.map +0 -1
  1233. package/dist/chunks/index-CCyqQ0Dz.mjs +0 -228
  1234. package/dist/chunks/index-CCyqQ0Dz.mjs.map +0 -1
  1235. package/dist/chunks/index-Cd3uJLP3.mjs +0 -73
  1236. package/dist/chunks/index-Cd3uJLP3.mjs.map +0 -1
  1237. package/dist/chunks/index-DSAuGP4n.mjs +0 -410
  1238. package/dist/chunks/index-DSAuGP4n.mjs.map +0 -1
  1239. package/dist/chunks/index-DtRfqsq5.mjs +0 -924
  1240. package/dist/chunks/index-DtRfqsq5.mjs.map +0 -1
  1241. package/dist/chunks/index-Dum8yE_t.mjs +0 -62
  1242. package/dist/chunks/index-Dum8yE_t.mjs.map +0 -1
  1243. package/dist/chunks/index-DxbQirny.mjs +0 -63
  1244. package/dist/chunks/index-DxbQirny.mjs.map +0 -1
  1245. package/dist/chunks/index-ErZ5_a1o.mjs +0 -296
  1246. package/dist/chunks/index-ErZ5_a1o.mjs.map +0 -1
  1247. package/dist/chunks/index-WpbK_s_H.mjs +0 -119
  1248. package/dist/chunks/index-WpbK_s_H.mjs.map +0 -1
  1249. package/dist/chunks/index-WrqH1wG8.mjs +0 -50
  1250. package/dist/chunks/index-WrqH1wG8.mjs.map +0 -1
  1251. package/dist/chunks/index-fsVJLutn.mjs +0 -118
  1252. package/dist/chunks/index-fsVJLutn.mjs.map +0 -1
  1253. package/dist/chunks/index-fx3KIap3.mjs +0 -50
  1254. package/dist/chunks/index-fx3KIap3.mjs.map +0 -1
  1255. package/dist/chunks/index-oOJo-ywB.mjs +0 -467
  1256. package/dist/chunks/index-oOJo-ywB.mjs.map +0 -1
  1257. package/dist/chunks/index-toj88jtL.mjs +0 -101
  1258. package/dist/chunks/index-toj88jtL.mjs.map +0 -1
  1259. package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs +0 -34
  1260. package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +0 -1
  1261. package/dist/editor/CSSClassCollector.d.ts.map +0 -1
  1262. package/dist/editor/ContentHTMLTypes.d.ts.map +0 -1
  1263. package/dist/editor/DocumentParser.d.ts.map +0 -1
  1264. package/dist/editor/DocumentSerializer.d.ts.map +0 -1
  1265. package/dist/editor/MarkSerializer.d.ts.map +0 -1
  1266. package/dist/editor/PaperSize.d.ts.map +0 -1
  1267. package/dist/i18n/resolvePluginLocale.d.ts +0 -3
  1268. package/dist/i18n/resolvePluginLocale.d.ts.map +0 -1
  1269. package/dist/model/BuiltinSpecs.d.ts.map +0 -1
  1270. package/dist/model/HTMLParser.d.ts.map +0 -1
  1271. package/dist/model/NavigationUtils.d.ts.map +0 -1
  1272. package/dist/view/Platform.d.ts.map +0 -1
  1273. /package/dist/{input → model}/InputRule.d.ts +0 -0
  1274. /package/dist/{input → model}/InputRuleRegistry.d.ts +0 -0
  1275. /package/dist/{input → model}/Keymap.d.ts +0 -0
  1276. /package/dist/{input → model}/KeymapRegistry.d.ts +0 -0
  1277. /package/dist/{editor → model}/PaperSize.d.ts +0 -0
  1278. /package/dist/{editor → serialization}/CSSClassCollector.d.ts +0 -0
  1279. /package/dist/{editor → serialization}/ContentHTMLTypes.d.ts +0 -0
  1280. /package/dist/{editor → serialization}/DocumentParser.d.ts +0 -0
@@ -1,3889 +1,2 @@
1
- import { d as S, b as C, f as T, i as R, j as L, r as M, a as I, n as N, c as O, k as _, l as H, m as $, g as K, e as U, o as W, p as V, q as J, s as Q, t as X, u as Y } from "./chunks/Document-Brtw2jL1.mjs";
2
- import { v, w, h } from "./chunks/Document-Brtw2jL1.mjs";
3
- import { f as Z, a as ee, C as te, b as ne } from "./chunks/index-oOJo-ywB.mjs";
4
- import { e, c, d, g, h as h2, i, j, k, l, m, n, o, p, q, r, s, t, u, v as v2, w as w2, x, y, z, A, B, D, E, F, G } from "./chunks/index-oOJo-ywB.mjs";
5
- import { e as se, d as re, i as ie, a as oe, c as ae, f as ce, b as le, g as he, h as de, s as ue } from "./chunks/Selection-BRTab5hO.mjs";
6
- import { j as j2, k as k2 } from "./chunks/Selection-BRTab5hO.mjs";
7
- import { d as pe, i as fe, a as ge, s as me } from "./chunks/MarkCommands-6RUJ4L3r.mjs";
8
- import { b, t as t2, c as c2, e as e2, f } from "./chunks/MarkCommands-6RUJ4L3r.mjs";
9
- import { b as ye, n as ke, i as be, m as ve } from "./chunks/TypeBrands-C09nE2qO.mjs";
10
- import { c as c3, p as p2 } from "./chunks/TypeBrands-C09nE2qO.mjs";
11
- import { a as Se } from "./chunks/AttrRegistry-D9Jx_RVb.mjs";
12
- import { b as b2, i as i2 } from "./chunks/AttrRegistry-D9Jx_RVb.mjs";
13
- import { c as we } from "./chunks/NodeSpec-NZVvcCuH.mjs";
14
- import { e as Ee, f as xe } from "./chunks/HTMLUtils-DTqQzcKR.mjs";
15
- import { a as Ce, r as Te, f as Ae } from "./chunks/NodeResolver-C2XYkeOi.mjs";
16
- import { b as b3, c as c4, w as w3 } from "./chunks/NodeResolver-C2XYkeOi.mjs";
17
- import { n as Re, g as Le, s as Me, r as Ie, d as Ne, a as Be, b as Oe, e as _e, c as De, f as Pe, h as He } from "./chunks/CaretNavigation-7JYpIKbs.mjs";
18
- import { i as i3, m as m2, j as j3 } from "./chunks/CaretNavigation-7JYpIKbs.mjs";
19
- import { d as ze, a as je, m as $e, b as Ke, s as Fe, n as Ue, c as We, e as Ve, f as Ge, i as qe, g as Je, h as Qe, r as Xe, H as Ye } from "./chunks/index-ErZ5_a1o.mjs";
20
- import { g as Ze } from "./chunks/Platform-S_xqIqcM.mjs";
21
- import { a, i as i4, b as b4 } from "./chunks/Platform-S_xqIqcM.mjs";
22
- import { E as et, S as tt, r as nt, L as st, a as rt } from "./chunks/resolvePluginLocale-B4w1OkPy.mjs";
23
- import { T as it } from "./chunks/index-BcDRT4K2.mjs";
24
- import { P, a as a2, b as b5, c as c5, d as d2, e as e3 } from "./chunks/index-BcDRT4K2.mjs";
25
- import { n as ot, a as at, f as ct } from "./chunks/ToolbarKeyboardNav-DhpL8zNV.mjs";
26
- import { a as a3, p as p3 } from "./chunks/PopupPositioning-CgjgAKjp.mjs";
27
- import { r as r2 } from "./chunks/ColorGrid--lBQ7jCK.mjs";
28
- import { D as lt, d as ht, C as dt } from "./chunks/index--7pBhSF4.mjs";
29
- import { a as a4, b as b6, c as c6, i as i5, n as n2, w as w4 } from "./chunks/index--7pBhSF4.mjs";
30
- import { f as ut } from "./chunks/ToolbarItem-BpZggUGo.mjs";
31
- import { T as pt } from "./chunks/index-Cd3uJLP3.mjs";
32
- import { a as a5, b as b7 } from "./chunks/index-Cd3uJLP3.mjs";
33
- import { H as ft } from "./chunks/index-BjFBWBOC.mjs";
34
- import { a as a6, b as b8 } from "./chunks/index-BjFBWBOC.mjs";
35
- import { L as gt } from "./chunks/index-fsVJLutn.mjs";
36
- import { a as a7, b as b9 } from "./chunks/index-fsVJLutn.mjs";
37
- import { L as mt } from "./chunks/index-CCyqQ0Dz.mjs";
38
- import { a as a8, b as b10 } from "./chunks/index-CCyqQ0Dz.mjs";
39
- import { B as yt } from "./chunks/index-Dum8yE_t.mjs";
40
- import { a as a9, b as b11 } from "./chunks/index-Dum8yE_t.mjs";
41
- import { S as kt } from "./chunks/index-BXtw5PNN.mjs";
42
- import { a as a10, b as b12 } from "./chunks/index-BXtw5PNN.mjs";
43
- import { T as bt } from "./chunks/index-fx3KIap3.mjs";
44
- import { a as a11, b as b13 } from "./chunks/index-fx3KIap3.mjs";
45
- import { H as vt } from "./chunks/index-DxbQirny.mjs";
46
- import { a as a12, b as b14 } from "./chunks/index-DxbQirny.mjs";
47
- import { A as St } from "./chunks/index-toj88jtL.mjs";
48
- import { a as a13, b as b15, c as c7, d as d3 } from "./chunks/index-toj88jtL.mjs";
49
- import { F as wt } from "./chunks/index-WpbK_s_H.mjs";
50
- import { a as a14, b as b16 } from "./chunks/index-WpbK_s_H.mjs";
51
- import { F as Et } from "./chunks/index-BXCkjDax.mjs";
52
- import { a as a15, b as b17 } from "./chunks/index-BXCkjDax.mjs";
53
- import { T as xt } from "./chunks/index-DtRfqsq5.mjs";
54
- import { a as a16, b as b18, c as c8, d as d4, e as e4, f as f2, g as g2, h as h3, i as i6, j as j4, k as k3, l as l2 } from "./chunks/index-DtRfqsq5.mjs";
55
- import { H as Ct } from "./chunks/index-WrqH1wG8.mjs";
56
- import { a as a17, b as b19 } from "./chunks/index-WrqH1wG8.mjs";
57
- import { S as Tt } from "./chunks/index-C1opJocO.mjs";
58
- import { a as a18, b as b20 } from "./chunks/index-C1opJocO.mjs";
59
- import { I as At } from "./chunks/index-DSAuGP4n.mjs";
60
- import { D as D2, a as a19, b as b21, c as c9 } from "./chunks/index-DSAuGP4n.mjs";
61
- import { GapCursorPlugin as Rt } from "./plugins/gap-cursor.mjs";
62
- import { s as Lt, b as Mt, c as It, a as Nt, u as Bt, d as Ot, r as _t } from "./chunks/StyleRuntime-CP4NCwKT.mjs";
63
- import Dt from "dompurify";
64
- import { STARTER_FONTS as Pt } from "./fonts.mjs";
65
- import { a as a20, g as g3, i as i7, r as r3 } from "./chunks/AttributedMarkCommands-BtLea72z.mjs";
66
- import { c as c10, a as a21, b as b22, i as i8, s as s2 } from "./chunks/NavigationUtils-Cspt2ZrK.mjs";
67
- import { f as f3 } from "./chunks/RangeIterator-Bh4Vl_6D.mjs";
68
- class Ht {
69
- _nodeSpecs = /* @__PURE__ */ new Map();
70
- _markSpecs = /* @__PURE__ */ new Map();
71
- _inlineNodeSpecs = /* @__PURE__ */ new Map();
72
- registerNodeSpec(e5) {
73
- if (this._nodeSpecs.has(e5.type)) throw new Error(`NodeSpec for type "${e5.type}" is already registered.`);
74
- this._nodeSpecs.set(e5.type, e5);
75
- }
76
- getNodeSpec(e5) {
77
- return this._nodeSpecs.get(e5);
78
- }
79
- removeNodeSpec(e5) {
80
- this._nodeSpecs.delete(e5);
81
- }
82
- getNodeTypes() {
83
- return [...this._nodeSpecs.keys()];
84
- }
85
- registerMarkSpec(e5) {
86
- if (this._markSpecs.has(e5.type)) throw new Error(`MarkSpec for type "${e5.type}" is already registered.`);
87
- this._markSpecs.set(e5.type, e5);
88
- }
89
- getMarkSpec(e5) {
90
- return this._markSpecs.get(e5);
91
- }
92
- removeMarkSpec(e5) {
93
- this._markSpecs.delete(e5);
94
- }
95
- getMarkTypes() {
96
- return [...this._markSpecs.keys()];
97
- }
98
- registerInlineNodeSpec(e5) {
99
- if (this._inlineNodeSpecs.has(e5.type)) throw new Error(`InlineNodeSpec for type "${e5.type}" is already registered.`);
100
- this._inlineNodeSpecs.set(e5.type, e5);
101
- }
102
- getInlineNodeSpec(e5) {
103
- return this._inlineNodeSpecs.get(e5);
104
- }
105
- removeInlineNodeSpec(e5) {
106
- this._inlineNodeSpecs.delete(e5);
107
- }
108
- getInlineNodeTypes() {
109
- return [...this._inlineNodeSpecs.keys()];
110
- }
111
- getBlockParseRules() {
112
- const e5 = [];
113
- for (const [t3, n3] of this._nodeSpecs) if (n3.parseHTML) for (const s3 of n3.parseHTML) e5.push({ rule: s3, type: t3 });
114
- return e5.sort((e6, t3) => (t3.rule.priority ?? 50) - (e6.rule.priority ?? 50));
115
- }
116
- getInlineParseRules() {
117
- const e5 = [];
118
- for (const [t3, n3] of this._inlineNodeSpecs) if (n3.parseHTML) for (const s3 of n3.parseHTML) e5.push({ rule: s3, type: t3 });
119
- return e5.sort((e6, t3) => (t3.rule.priority ?? 50) - (e6.rule.priority ?? 50));
120
- }
121
- getMarkParseRules() {
122
- const e5 = [];
123
- for (const [t3, n3] of this._markSpecs) if (n3.parseHTML) for (const s3 of n3.parseHTML) e5.push({ rule: s3, type: t3 });
124
- return e5.sort((e6, t3) => (t3.rule.priority ?? 50) - (e6.rule.priority ?? 50));
125
- }
126
- getAllowedTags() {
127
- const e5 = /* @__PURE__ */ new Set(["p", "br", "div", "span"]);
128
- for (const t3 of this._nodeSpecs.values()) if (t3.sanitize?.tags) for (const n3 of t3.sanitize.tags) e5.add(n3);
129
- for (const t3 of this._inlineNodeSpecs.values()) if (t3.sanitize?.tags) for (const n3 of t3.sanitize.tags) e5.add(n3);
130
- for (const t3 of this._markSpecs.values()) if (t3.sanitize?.tags) for (const n3 of t3.sanitize.tags) e5.add(n3);
131
- return [...e5];
132
- }
133
- getAllowedAttrs() {
134
- const e5 = /* @__PURE__ */ new Set(["style"]);
135
- for (const t3 of this._nodeSpecs.values()) if (t3.sanitize?.attrs) for (const n3 of t3.sanitize.attrs) e5.add(n3);
136
- for (const t3 of this._inlineNodeSpecs.values()) if (t3.sanitize?.attrs) for (const n3 of t3.sanitize.attrs) e5.add(n3);
137
- for (const t3 of this._markSpecs.values()) if (t3.sanitize?.attrs) for (const n3 of t3.sanitize.attrs) e5.add(n3);
138
- return [...e5];
139
- }
140
- clear() {
141
- this._nodeSpecs.clear(), this._markSpecs.clear(), this._inlineNodeSpecs.clear();
142
- }
143
- }
144
- function zt(e5, t3, n3) {
145
- const s3 = e5.getNodeSpec(t3);
146
- if (!s3?.content) return true;
147
- const r4 = e5.getNodeSpec(n3), i9 = r4?.group;
148
- for (const e6 of s3.content.allow) {
149
- if (e6 === n3) return true;
150
- if ("text" !== e6 && i9 && e6 === i9) return true;
151
- }
152
- return false;
153
- }
154
- function jt(e5, t3, n3) {
155
- const s3 = e5.getNodeSpec(t3);
156
- if (!s3?.content) return true;
157
- const { min: r4 = 0, max: i9 = Number.POSITIVE_INFINITY } = s3.content, o2 = n3.filter((e6) => "text" !== e6);
158
- if (o2.length < r4 || o2.length > i9) return false;
159
- for (const n4 of o2) if (!zt(e5, t3, n4)) return false;
160
- return true;
161
- }
162
- function $t(e5) {
163
- e5.registerNodeSpec({ type: "paragraph", group: "block", content: { allow: ["text"] }, toDOM: (e6) => we("p", e6.id), toHTML: (e6, t3) => `<p>${t3 || "<br>"}</p>`, parseHTML: [{ tag: "p" }, { tag: "div", priority: 10 }], sanitize: { tags: ["p"] } });
164
- }
165
- function Kt(e5, t3, n3) {
166
- return { children: Ft(e5.children, t3, n3) };
167
- }
168
- function Ft(e5, t3, n3) {
169
- return e5.map((e6) => {
170
- if (!S(e6)) return e6;
171
- if (e6.id === t3) return n3(e6);
172
- const s3 = Ft(e6.children, t3, n3);
173
- return s3 === e6.children ? e6 : { ...e6, children: s3 };
174
- });
175
- }
176
- function Ut(e5, t3, n3) {
177
- if (0 === t3.length) return e5;
178
- const s3 = t3[0];
179
- return s3 ? { children: e5.children.map((e6) => S(e6) && e6.id === s3 ? 1 === t3.length ? n3(e6) : Wt(e6, t3, 1, n3) : e6) } : e5;
180
- }
181
- function Wt(e5, t3, n3, s3) {
182
- const r4 = t3[n3];
183
- if (!r4) return e5;
184
- const i9 = e5.children.map((e6) => S(e6) && e6.id === r4 ? n3 === t3.length - 1 ? s3(e6) : Wt(e6, t3, n3 + 1, s3) : e6);
185
- return { ...e5, children: i9 };
186
- }
187
- function Vt(e5, t3, n3) {
188
- if (t3(e5)) return n3(e5);
189
- let s3 = false;
190
- const r4 = e5.map((e6) => {
191
- if (!S(e6)) return e6;
192
- const r5 = Vt(e6.children, t3, n3);
193
- return r5 ? (s3 = true, { ...e6, children: r5 }) : e6;
194
- });
195
- return s3 ? r4 : null;
196
- }
197
- function Gt(e5, t3, n3) {
198
- const s3 = [];
199
- let r4 = 0;
200
- for (const i9 of e5) {
201
- if (C(i9)) {
202
- const e7 = r4 + 1;
203
- e7 > t3 && r4 < n3 && s3.push(i9), r4 = e7;
204
- continue;
205
- }
206
- const e6 = r4 + i9.text.length;
207
- if (e6 <= t3 || r4 >= n3) ;
208
- else {
209
- const e7 = Math.max(0, t3 - r4), o2 = Math.min(i9.text.length, n3 - r4), a22 = i9.text.slice(e7, o2);
210
- a22.length > 0 && s3.push(T(a22, i9.marks));
211
- }
212
- r4 = e6;
213
- }
214
- return 0 === s3.length && s3.push(T("")), s3;
215
- }
216
- function qt(e5, t3, n3, s3, r4) {
217
- const i9 = [];
218
- let o2 = 0;
219
- for (const a22 of e5) {
220
- if (C(a22)) {
221
- i9.push(a22), o2 += 1;
222
- continue;
223
- }
224
- const e6 = o2 + a22.text.length;
225
- if (e6 <= t3 || o2 >= n3) i9.push(a22);
226
- else if (o2 >= t3 && e6 <= n3) {
227
- const e7 = r4 ? L(a22.marks, s3) : M(a22.marks, s3.type);
228
- i9.push(T(a22.text, e7));
229
- } else {
230
- const e7 = Math.max(0, t3 - o2), c11 = Math.min(a22.text.length, n3 - o2), l3 = a22.text.slice(0, e7), h4 = a22.text.slice(e7, c11), d5 = a22.text.slice(c11);
231
- if (l3 && i9.push(T(l3, a22.marks)), h4) {
232
- const e8 = r4 ? L(a22.marks, s3) : M(a22.marks, s3.type);
233
- i9.push(T(h4, e8));
234
- }
235
- d5 && i9.push(T(d5, a22.marks));
236
- }
237
- o2 = e6;
238
- }
239
- return i9;
240
- }
241
- function Jt(e5, t3) {
242
- if (e5.every((e6) => R(e6) || C(e6))) return t3;
243
- const n3 = e5.filter((e6) => !R(e6) && !C(e6));
244
- return [...t3, ...n3];
245
- }
246
- function Qt(e5, t3) {
247
- switch (t3.type) {
248
- case "insertText":
249
- return (function(e6, t4) {
250
- return Kt(e6, t4.blockId, (e7) => {
251
- const n3 = I(e7), s3 = t4.segments ? (function(e8, t5, n4) {
252
- const s4 = [];
253
- let r4 = 0, i9 = false;
254
- for (const o2 of e8) {
255
- if (C(o2)) {
256
- if (!i9 && t5 === r4) {
257
- for (const e10 of n4) s4.push(T(e10.text, e10.marks));
258
- i9 = true;
259
- }
260
- s4.push(o2), r4 += 1;
261
- continue;
262
- }
263
- const e9 = r4 + o2.text.length;
264
- if (!i9 && t5 >= r4 && t5 <= e9) {
265
- const e10 = t5 - r4, a22 = o2.text.slice(0, e10), c11 = o2.text.slice(e10);
266
- a22 && s4.push(T(a22, o2.marks));
267
- for (const e11 of n4) s4.push(T(e11.text, e11.marks));
268
- c11 && s4.push(T(c11, o2.marks)), i9 = true;
269
- } else s4.push(o2);
270
- r4 = e9;
271
- }
272
- if (!i9) for (const e9 of n4) s4.push(T(e9.text, e9.marks));
273
- return s4;
274
- })(n3, t4.offset, t4.segments) : (function(e8, t5, n4, s4) {
275
- const r4 = [];
276
- let i9 = 0, o2 = false;
277
- for (const a22 of e8) {
278
- if (C(a22)) {
279
- o2 || t5 !== i9 || (r4.push(T(n4, s4)), o2 = true), r4.push(a22), i9 += 1;
280
- continue;
281
- }
282
- const e9 = i9 + a22.text.length;
283
- if (!o2 && t5 >= i9 && t5 <= e9) {
284
- const e10 = t5 - i9, c11 = a22.text.slice(0, e10), l3 = a22.text.slice(e10);
285
- c11 && r4.push(T(c11, a22.marks)), r4.push(T(n4, s4)), l3 && r4.push(T(l3, a22.marks)), o2 = true;
286
- } else r4.push(a22);
287
- i9 = e9;
288
- }
289
- return o2 || r4.push(T(n4, s4)), r4;
290
- })(n3, t4.offset, t4.text, t4.marks);
291
- return { ...e7, children: Jt(e7.children, N(s3)) };
292
- });
293
- })(e5, t3);
294
- case "deleteText":
295
- return (function(e6, t4) {
296
- return Kt(e6, t4.blockId, (e7) => {
297
- const n3 = (function(e8, t5, n4) {
298
- const s3 = [];
299
- let r4 = 0;
300
- for (const i9 of e8) {
301
- if (C(i9)) {
302
- const e10 = r4 + 1;
303
- (e10 <= t5 || r4 >= n4) && s3.push(i9), r4 = e10;
304
- continue;
305
- }
306
- const e9 = r4 + i9.text.length;
307
- if (e9 <= t5 || r4 >= n4) s3.push(i9);
308
- else {
309
- const e10 = Math.max(0, t5 - r4), o2 = Math.min(i9.text.length, n4 - r4), a22 = i9.text.slice(0, e10) + i9.text.slice(o2);
310
- a22.length > 0 && s3.push(T(a22, i9.marks));
311
- }
312
- r4 = e9;
313
- }
314
- return s3;
315
- })(I(e7), t4.from, t4.to);
316
- return { ...e7, children: Jt(e7.children, N(n3)) };
317
- });
318
- })(e5, t3);
319
- case "splitBlock":
320
- return (function(e6, t4) {
321
- const n3 = Vt(e6.children, (e7) => e7.some((e8) => S(e8) && e8.id === t4.blockId), (e7) => {
322
- const n4 = e7.findIndex((e8) => S(e8) && e8.id === t4.blockId);
323
- if (-1 === n4) return e7;
324
- const s3 = e7[n4], r4 = I(s3), i9 = O(s3), o2 = Gt(r4, 0, t4.offset), a22 = Gt(r4, t4.offset, i9), c11 = { ...s3, children: N(o2) }, l3 = _(s3.type, N(a22), t4.newBlockId, s3.attrs), h4 = [...e7];
325
- return h4.splice(n4, 1, c11, l3), h4;
326
- });
327
- return n3 ? { children: n3 } : e6;
328
- })(e5, t3);
329
- case "mergeBlocks":
330
- return (function(e6, t4) {
331
- const n3 = Vt(e6.children, (e7) => e7.some((e8) => S(e8) && e8.id === t4.targetBlockId) && e7.some((e8) => S(e8) && e8.id === t4.sourceBlockId), (e7) => {
332
- const n4 = e7.findIndex((e8) => S(e8) && e8.id === t4.targetBlockId), s3 = e7.findIndex((e8) => S(e8) && e8.id === t4.sourceBlockId);
333
- if (-1 === n4 || -1 === s3) return e7;
334
- const r4 = e7[n4], i9 = e7[s3], o2 = I(r4), a22 = I(i9), c11 = N([...o2, ...a22]), l3 = { ...r4, children: c11 };
335
- return e7.filter((e8) => !S(e8) || e8.id !== t4.sourceBlockId).map((e8) => S(e8) && e8.id === t4.targetBlockId ? l3 : e8);
336
- });
337
- return n3 ? { children: n3 } : e6;
338
- })(e5, t3);
339
- case "addMark":
340
- return (function(e6, t4) {
341
- return Kt(e6, t4.blockId, (e7) => {
342
- const n3 = qt(I(e7), t4.from, t4.to, t4.mark, true);
343
- return { ...e7, children: Jt(e7.children, N(n3)) };
344
- });
345
- })(e5, t3);
346
- case "removeMark":
347
- return (function(e6, t4) {
348
- return Kt(e6, t4.blockId, (e7) => {
349
- const n3 = qt(I(e7), t4.from, t4.to, t4.mark, false);
350
- return { ...e7, children: Jt(e7.children, N(n3)) };
351
- });
352
- })(e5, t3);
353
- case "setStoredMarks":
354
- return e5;
355
- case "setBlockType":
356
- return (function(e6, t4) {
357
- return Kt(e6, t4.blockId, (e7) => ({ ...e7, type: t4.nodeType, ...t4.attrs ? { attrs: t4.attrs } : { attrs: void 0 } }));
358
- })(e5, t3);
359
- case "insertNode":
360
- return (function(e6, t4) {
361
- if (0 === t4.parentPath.length) {
362
- const n3 = [...e6.children];
363
- return n3.splice(t4.index, 0, t4.node), { children: n3 };
364
- }
365
- return Ut(e6, t4.parentPath, (e7) => {
366
- const n3 = [...e7.children];
367
- return n3.splice(t4.index, 0, t4.node), { ...e7, children: n3 };
368
- });
369
- })(e5, t3);
370
- case "removeNode":
371
- return (function(e6, t4) {
372
- if (0 === t4.parentPath.length) {
373
- const n3 = [...e6.children];
374
- return n3.splice(t4.index, 1), { children: n3 };
375
- }
376
- return Ut(e6, t4.parentPath, (e7) => {
377
- const n3 = [...e7.children];
378
- return n3.splice(t4.index, 1), { ...e7, children: n3 };
379
- });
380
- })(e5, t3);
381
- case "setNodeAttr":
382
- return (function(e6, t4) {
383
- const n3 = t4.path[t4.path.length - 1];
384
- return n3 ? Kt(e6, n3, (e7) => ({ ...e7, attrs: t4.attrs })) : e6;
385
- })(e5, t3);
386
- case "insertInlineNode":
387
- return (function(e6, t4) {
388
- return Kt(e6, t4.blockId, (e7) => {
389
- const n3 = (function(e8, t5, n4) {
390
- const s3 = [];
391
- let r4 = 0, i9 = false;
392
- for (const o2 of e8) {
393
- if (C(o2)) {
394
- i9 || t5 !== r4 || (s3.push(n4), i9 = true), s3.push(o2), r4 += 1;
395
- continue;
396
- }
397
- const e9 = r4 + o2.text.length;
398
- if (!i9 && t5 >= r4 && t5 <= e9) {
399
- const e10 = t5 - r4, a22 = o2.text.slice(0, e10), c11 = o2.text.slice(e10);
400
- a22 && s3.push(T(a22, o2.marks)), s3.push(n4), c11 && s3.push(T(c11, o2.marks)), i9 = true;
401
- } else s3.push(o2);
402
- r4 = e9;
403
- }
404
- return i9 || s3.push(n4), s3;
405
- })(I(e7), t4.offset, t4.node);
406
- return { ...e7, children: Jt(e7.children, N(n3)) };
407
- });
408
- })(e5, t3);
409
- case "removeInlineNode":
410
- return (function(e6, t4) {
411
- return Kt(e6, t4.blockId, (e7) => {
412
- const n3 = (function(e8, t5) {
413
- const n4 = [];
414
- let s3 = 0;
415
- for (const r4 of e8) C(r4) ? (s3 !== t5 && n4.push(r4), s3 += 1) : (n4.push(r4), s3 += r4.text.length);
416
- return n4;
417
- })(I(e7), t4.offset);
418
- return { ...e7, children: Jt(e7.children, N(n3)) };
419
- });
420
- })(e5, t3);
421
- case "setInlineNodeAttr":
422
- return (function(e6, t4) {
423
- return Kt(e6, t4.blockId, (e7) => {
424
- const n3 = (function(e8, t5, n4) {
425
- const s3 = [];
426
- let r4 = 0;
427
- for (const i9 of e8) C(i9) ? (r4 === t5 ? s3.push({ ...i9, attrs: n4 }) : s3.push(i9), r4 += 1) : (s3.push(i9), r4 += i9.text.length);
428
- return s3;
429
- })(I(e7), t4.offset, t4.attrs);
430
- return { ...e7, children: Jt(e7.children, n3) };
431
- });
432
- })(e5, t3);
433
- }
434
- }
435
- function Xt(e5) {
436
- switch (e5.type) {
437
- case "insertText":
438
- return { type: "deleteText", blockId: e5.blockId, from: e5.offset, to: e5.offset + e5.text.length, deletedText: e5.text, deletedMarks: e5.marks, deletedSegments: e5.segments ?? [{ text: e5.text, marks: [...e5.marks] }], ...e5.path ? { path: e5.path } : {} };
439
- case "deleteText":
440
- return { type: "insertText", blockId: e5.blockId, offset: e5.from, text: e5.deletedText, marks: e5.deletedMarks, segments: e5.deletedSegments, ...e5.path ? { path: e5.path } : {} };
441
- case "splitBlock":
442
- return { type: "mergeBlocks", targetBlockId: e5.blockId, sourceBlockId: e5.newBlockId, targetLengthBefore: e5.offset, ...e5.path ? { path: e5.path } : {} };
443
- case "mergeBlocks":
444
- return { type: "splitBlock", blockId: e5.targetBlockId, offset: e5.targetLengthBefore, newBlockId: e5.sourceBlockId, ...e5.path ? { path: e5.path } : {} };
445
- case "addMark":
446
- return { type: "removeMark", blockId: e5.blockId, from: e5.from, to: e5.to, mark: e5.mark, ...e5.path ? { path: e5.path } : {} };
447
- case "removeMark":
448
- return { type: "addMark", blockId: e5.blockId, from: e5.from, to: e5.to, mark: e5.mark, ...e5.path ? { path: e5.path } : {} };
449
- case "setStoredMarks":
450
- return { type: "setStoredMarks", marks: e5.previousMarks, previousMarks: e5.marks };
451
- case "setBlockType":
452
- return { type: "setBlockType", blockId: e5.blockId, nodeType: e5.previousNodeType, attrs: e5.previousAttrs, previousNodeType: e5.nodeType, previousAttrs: e5.attrs, ...e5.path ? { path: e5.path } : {} };
453
- case "insertNode":
454
- return { type: "removeNode", parentPath: e5.parentPath, index: e5.index, removedNode: e5.node };
455
- case "removeNode":
456
- return { type: "insertNode", parentPath: e5.parentPath, index: e5.index, node: e5.removedNode };
457
- case "setNodeAttr":
458
- return { type: "setNodeAttr", path: e5.path, attrs: e5.previousAttrs, previousAttrs: e5.attrs };
459
- case "insertInlineNode":
460
- return { type: "removeInlineNode", blockId: e5.blockId, offset: e5.offset, removedNode: e5.node, ...e5.path ? { path: e5.path } : {} };
461
- case "removeInlineNode":
462
- return { type: "insertInlineNode", blockId: e5.blockId, offset: e5.offset, node: e5.removedNode, ...e5.path ? { path: e5.path } : {} };
463
- case "setInlineNodeAttr":
464
- return { type: "setInlineNodeAttr", blockId: e5.blockId, offset: e5.offset, attrs: e5.previousAttrs, previousAttrs: e5.attrs, ...e5.path ? { path: e5.path } : {} };
465
- }
466
- }
467
- function Yt(e5) {
468
- return { steps: e5.steps.map(Xt).reverse(), selectionBefore: e5.selectionAfter, selectionAfter: e5.selectionBefore, storedMarksAfter: null, metadata: { origin: "history", timestamp: Date.now() } };
469
- }
470
- class Zt {
471
- steps = [];
472
- selection;
473
- storedMarks;
474
- selectionBefore;
475
- origin;
476
- workingDoc;
477
- _readonlyAllowed = false;
478
- constructor(e5, t3, n3 = "api", s3) {
479
- this.selection = e5, this.selectionBefore = e5, this.storedMarks = t3, this.origin = n3, this.workingDoc = s3 ?? null;
480
- }
481
- insertText(e5, t3, n3, s3, r4) {
482
- const i9 = { type: "insertText", blockId: e5, offset: t3, text: n3, marks: s3, ...r4 ? { segments: r4 } : {} };
483
- return this.steps.push(i9), this.advanceDoc(i9), this;
484
- }
485
- deleteText(e5, t3, n3, s3, r4, i9) {
486
- let o2;
487
- if (i9) o2 = i9;
488
- else if (this.workingDoc) {
489
- const i10 = Ce(this.workingDoc, e5);
490
- o2 = i10 ? H(i10, t3, n3) : [{ text: s3, marks: [...r4] }];
491
- } else o2 = [{ text: s3, marks: [...r4] }];
492
- const a22 = { type: "deleteText", blockId: e5, from: t3, to: n3, deletedText: s3, deletedMarks: r4, deletedSegments: o2 };
493
- return this.steps.push(a22), this.advanceDoc(a22), this;
494
- }
495
- deleteTextAt(e5, t3, n3) {
496
- const s3 = this.workingDoc;
497
- if (!s3) throw new Error("deleteTextAt requires a document. Use state.transaction() or provide doc to constructor.");
498
- const r4 = Ce(s3, e5);
499
- if (!r4) throw new Error(`Block "${e5}" not found in working document.`);
500
- const i9 = $(r4).slice(t3, n3), o2 = K(r4, t3), a22 = H(r4, t3, n3);
501
- return this.deleteText(e5, t3, n3, i9, o2, a22);
502
- }
503
- splitBlock(e5, t3, n3) {
504
- const s3 = { type: "splitBlock", blockId: e5, offset: t3, newBlockId: n3 };
505
- return this.steps.push(s3), this.advanceDoc(s3), this;
506
- }
507
- mergeBlocks(e5, t3, n3) {
508
- const s3 = { type: "mergeBlocks", targetBlockId: e5, sourceBlockId: t3, targetLengthBefore: n3 };
509
- return this.steps.push(s3), this.advanceDoc(s3), this;
510
- }
511
- mergeBlocksAt(e5, t3) {
512
- const n3 = this.workingDoc;
513
- if (!n3) throw new Error("mergeBlocksAt requires a document. Use state.transaction() or provide doc to constructor.");
514
- const s3 = Ce(n3, e5);
515
- if (!s3) throw new Error(`Target block "${e5}" not found in working document.`);
516
- const r4 = O(s3);
517
- return this.mergeBlocks(e5, t3, r4);
518
- }
519
- addMark(e5, t3, n3, s3) {
520
- const r4 = { type: "addMark", blockId: e5, from: t3, to: n3, mark: s3 };
521
- return this.steps.push(r4), this.advanceDoc(r4), this;
522
- }
523
- removeMark(e5, t3, n3, s3) {
524
- const r4 = { type: "removeMark", blockId: e5, from: t3, to: n3, mark: s3 };
525
- return this.steps.push(r4), this.advanceDoc(r4), this;
526
- }
527
- setBlockType(e5, t3, n3) {
528
- const s3 = this.workingDoc;
529
- if (!s3) throw new Error("setBlockType requires a document. Use state.transaction() or provide doc to constructor.");
530
- const r4 = Ce(s3, e5);
531
- if (!r4) throw new Error(`Block "${e5}" not found in working document.`);
532
- const i9 = { type: "setBlockType", blockId: e5, nodeType: t3, ...n3 ? { attrs: n3 } : {}, previousNodeType: r4.type, ...r4.attrs ? { previousAttrs: r4.attrs } : {} };
533
- return this.steps.push(i9), this.advanceDoc(i9), this;
534
- }
535
- insertNode(e5, t3, n3) {
536
- const s3 = { type: "insertNode", parentPath: e5, index: t3, node: n3 };
537
- return this.steps.push(s3), this.advanceDoc(s3), this;
538
- }
539
- removeNode(e5, t3) {
540
- const n3 = this.workingDoc;
541
- if (!n3) throw new Error("removeNode requires a document. Use state.transaction() or provide doc to constructor.");
542
- const s3 = (function(e6, t4, n4) {
543
- if (0 === t4.length) {
544
- const t5 = e6.children[n4];
545
- return t5 && S(t5) ? t5 : void 0;
546
- }
547
- const s4 = Te(e6, t4);
548
- if (!s4) return;
549
- const r5 = s4.children[n4];
550
- return r5 && S(r5) ? r5 : void 0;
551
- })(n3, e5, t3);
552
- if (!s3) throw new Error(`Node at index ${t3} not found under parent path [${e5.join(", ")}].`);
553
- const r4 = { type: "removeNode", parentPath: e5, index: t3, removedNode: s3 };
554
- return this.steps.push(r4), this.advanceDoc(r4), this;
555
- }
556
- setNodeAttr(e5, t3) {
557
- const n3 = this.workingDoc;
558
- if (!n3) throw new Error("setNodeAttr requires a document. Use state.transaction() or provide doc to constructor.");
559
- const s3 = Te(n3, e5);
560
- if (!s3) throw new Error(`Node not found at path [${e5.join(", ")}].`);
561
- const r4 = { type: "setNodeAttr", path: e5, attrs: t3, ...s3.attrs ? { previousAttrs: s3.attrs } : {} };
562
- return this.steps.push(r4), this.advanceDoc(r4), this;
563
- }
564
- insertInlineNode(e5, t3, n3) {
565
- const s3 = { type: "insertInlineNode", blockId: e5, offset: t3, node: n3 };
566
- return this.steps.push(s3), this.advanceDoc(s3), this;
567
- }
568
- removeInlineNode(e5, t3) {
569
- const n3 = this.workingDoc;
570
- if (!n3) throw new Error("removeInlineNode requires a document. Use state.transaction() or provide doc.");
571
- const s3 = Ce(n3, e5);
572
- if (!s3) throw new Error(`Block "${e5}" not found in working document.`);
573
- const r4 = U(s3, t3);
574
- if (!r4 || "inline" !== r4.kind) throw new Error(`No InlineNode at offset ${t3} in block "${e5}".`);
575
- const i9 = { type: "removeInlineNode", blockId: e5, offset: t3, removedNode: r4.node };
576
- return this.steps.push(i9), this.advanceDoc(i9), this;
577
- }
578
- setInlineNodeAttr(e5, t3, n3) {
579
- const s3 = this.workingDoc;
580
- if (!s3) throw new Error("setInlineNodeAttr requires a document. Use state.transaction() or provide doc.");
581
- const r4 = Ce(s3, e5);
582
- if (!r4) throw new Error(`Block "${e5}" not found in working document.`);
583
- const i9 = I(r4);
584
- let o2 = 0;
585
- for (const s4 of i9) {
586
- if (C(s4) && o2 === t3) {
587
- const r5 = { type: "setInlineNodeAttr", blockId: e5, offset: t3, attrs: n3, previousAttrs: s4.attrs };
588
- return this.steps.push(r5), this.advanceDoc(r5), this;
589
- }
590
- o2 += C(s4) ? 1 : s4.text.length;
591
- }
592
- throw new Error(`No InlineNode at offset ${t3} in block "${e5}".`);
593
- }
594
- readonlyAllowed() {
595
- return this._readonlyAllowed = true, this;
596
- }
597
- setSelection(e5) {
598
- return this.selection = e5, this;
599
- }
600
- setNodeSelection(e5, t3) {
601
- return this.selection = se(e5, t3), this;
602
- }
603
- setStoredMarks(e5, t3) {
604
- return this.steps.push({ type: "setStoredMarks", marks: e5, previousMarks: t3 }), this.storedMarks = e5, this;
605
- }
606
- build() {
607
- return { steps: [...this.steps], selectionBefore: this.selectionBefore, selectionAfter: this.selection, storedMarksAfter: this.storedMarks, metadata: { origin: this.origin, timestamp: Date.now(), ...this._readonlyAllowed ? { readonlyAllowed: true } : {} } };
608
- }
609
- advanceDoc(e5) {
610
- this.workingDoc && (this.workingDoc = Qt(this.workingDoc, e5));
611
- }
612
- }
613
- class en {
614
- doc;
615
- selection;
616
- storedMarks;
617
- schema;
618
- _blockMap = null;
619
- _blockOrder = null;
620
- constructor(e5, t3, n3, s3) {
621
- this.doc = e5, this.selection = t3, this.storedMarks = n3, this.schema = s3;
622
- }
623
- static create(e5) {
624
- const t3 = e5?.schema ?? pe(), n3 = e5?.doc ?? W(), s3 = n3.children[0], r4 = e5?.selection ?? re(s3 ? s3.id : ye(""), 0);
625
- return new en(n3, r4, null, t3);
626
- }
627
- transaction(e5 = "api") {
628
- return new Zt(this.selection, this.storedMarks, e5, this.doc);
629
- }
630
- apply(e5) {
631
- let t3 = this.doc;
632
- for (const n4 of e5.steps) t3 = Qt(t3, n4);
633
- const n3 = (function(e6, t4) {
634
- if (ie(t4)) return Ce(e6, t4.nodeId) ? t4 : nn(e6, t4);
635
- if (oe(t4)) return Ce(e6, t4.blockId) ? t4 : nn(e6, t4);
636
- const n4 = tn(e6, t4.anchor), s3 = tn(e6, t4.head);
637
- return n4 === t4.anchor && s3 === t4.head ? t4 : ae(n4, s3);
638
- })(t3, e5.selectionAfter);
639
- return new en(t3, n3, e5.storedMarksAfter, this.schema);
640
- }
641
- getBlock(e5) {
642
- return this._blockMap ??= (function(e6) {
643
- const t3 = /* @__PURE__ */ new Map();
644
- return (function e7(n3) {
645
- for (const s3 of n3) S(s3) && (t3.set(s3.id, s3), e7(s3.children));
646
- })(e6.children), t3;
647
- })(this.doc), this._blockMap.get(e5);
648
- }
649
- getBlockOrder() {
650
- return this._blockOrder ??= (function(e5) {
651
- const t3 = [];
652
- return (function e6(n3) {
653
- for (const s3 of n3) S(s3) && (V(s3) ? t3.push(s3.id) : e6(s3.children));
654
- })(e5.children), t3;
655
- })(this.doc), this._blockOrder;
656
- }
657
- getNodePath(e5) {
658
- return Ae(this.doc, e5);
659
- }
660
- getParent(e5) {
661
- const t3 = Ae(this.doc, e5);
662
- if (!t3 || t3.length <= 1) return;
663
- const n3 = t3[t3.length - 2];
664
- return n3 ? Ce(this.doc, n3) : void 0;
665
- }
666
- toJSON() {
667
- return { doc: this.doc, selection: this.selection };
668
- }
669
- static fromJSON(e5, t3) {
670
- return new en(e5.doc, e5.selection, null, t3 ?? pe());
671
- }
672
- }
673
- function tn(e5, t3) {
674
- const n3 = Ce(e5, t3.blockId);
675
- if (n3) {
676
- const e6 = O(n3);
677
- return t3.offset > e6 ? ce(t3.blockId, e6, t3.path) : t3;
678
- }
679
- const s3 = e5.children[0];
680
- return s3 ? ce(s3.id, 0) : t3;
681
- }
682
- function nn(e5, t3) {
683
- const n3 = sn(e5.children);
684
- return n3 ? re(n3.id, 0) : t3;
685
- }
686
- function sn(e5) {
687
- for (const t3 of e5) {
688
- if (!S(t3)) continue;
689
- if (V(t3)) return t3;
690
- const e6 = sn(t3.children);
691
- if (e6) return e6;
692
- }
693
- return null;
694
- }
695
- function rn(e5) {
696
- for (const t3 of e5.steps) if ("setStoredMarks" !== t3.type) return false;
697
- return true;
698
- }
699
- function on(e5) {
700
- return !!e5.metadata.readonlyAllowed || rn(e5);
701
- }
702
- class an {
703
- undoStack = [];
704
- redoStack = [];
705
- groupTimeoutMs;
706
- maxDepth;
707
- lastOrigin = null;
708
- constructor(e5) {
709
- this.groupTimeoutMs = e5?.groupTimeoutMs ?? 500, this.maxDepth = e5?.maxDepth ?? 100;
710
- }
711
- push(e5) {
712
- if ("history" === e5.metadata.origin) return;
713
- if (!e5.steps.some((e6) => "setStoredMarks" !== e6.type)) return void (this.lastOrigin = null);
714
- const t3 = e5.metadata.timestamp, n3 = this.undoStack[this.undoStack.length - 1];
715
- for (n3 && "input" === e5.metadata.origin && "input" === this.lastOrigin && t3 - n3.timestamp < this.groupTimeoutMs && this.isSameInputType(n3.transactions, e5) && n3 ? this.undoStack[this.undoStack.length - 1] = { transactions: [...n3.transactions, e5], timestamp: t3 } : this.undoStack.push({ transactions: [e5], timestamp: t3 }), this.lastOrigin = e5.metadata.origin, this.redoStack = []; this.undoStack.length > this.maxDepth; ) this.undoStack.shift();
716
- }
717
- undo(e5) {
718
- const t3 = this.undoStack.pop();
719
- if (!t3) return null;
720
- let n3 = e5;
721
- const s3 = [];
722
- for (let e6 = t3.transactions.length - 1; e6 >= 0; e6--) {
723
- const r4 = t3.transactions[e6];
724
- if (!r4) continue;
725
- const i9 = Yt(r4);
726
- n3 = n3.apply(i9), s3.push(...i9.steps);
727
- }
728
- return this.redoStack.push({ transactions: t3.transactions, timestamp: Date.now() }), this.lastOrigin = null, { state: n3, transaction: { steps: s3, selectionBefore: e5.selection, selectionAfter: n3.selection, storedMarksAfter: n3.storedMarks, metadata: { origin: "history", timestamp: Date.now(), historyDirection: "undo" } } };
729
- }
730
- redo(e5) {
731
- const t3 = this.redoStack.pop();
732
- if (!t3) return null;
733
- let n3 = e5;
734
- const s3 = [];
735
- for (const e6 of t3.transactions) n3 = n3.apply(e6), s3.push(...e6.steps);
736
- return this.undoStack.push({ transactions: t3.transactions, timestamp: Date.now() }), this.lastOrigin = null, { state: n3, transaction: { steps: s3, selectionBefore: e5.selection, selectionAfter: n3.selection, storedMarksAfter: n3.storedMarks, metadata: { origin: "history", timestamp: Date.now(), historyDirection: "redo" } } };
737
- }
738
- canUndo() {
739
- return this.undoStack.length > 0;
740
- }
741
- canRedo() {
742
- return this.redoStack.length > 0;
743
- }
744
- clear() {
745
- this.undoStack = [], this.redoStack = [], this.lastOrigin = null;
746
- }
747
- isSameInputType(e5, t3) {
748
- const n3 = e5[e5.length - 1];
749
- if (!n3) return false;
750
- const s3 = n3.steps[0]?.type, r4 = t3.steps[0]?.type;
751
- return s3 === r4;
752
- }
753
- }
754
- function cn(e5, t3) {
755
- const n3 = e5.selection;
756
- if (ie(n3)) return ze(e5, n3);
757
- if (oe(n3)) return null;
758
- if (!le(n3)) return je(e5);
759
- const s3 = e5.getBlock(n3.anchor.blockId);
760
- if (!s3) return null;
761
- const r4 = t3.range(s3, n3.anchor.offset);
762
- if (!r4) return t3.merge(e5);
763
- const [i9, o2] = r4;
764
- return e5.transaction("input").deleteTextAt(s3.id, i9, o2).setSelection(re(s3.id, i9)).build();
765
- }
766
- function ln(e5) {
767
- return cn(e5, { merge: Ke, range: (e6, t3) => t3 > 0 ? [t3 - 1, t3] : null });
768
- }
769
- function hn(e5) {
770
- return cn(e5, { merge: $e, range: (e6, t3) => t3 < O(e6) ? [t3, t3 + 1] : null });
771
- }
772
- class dn {
773
- constructor(e5, t3) {
774
- this.element = e5, this.getState = t3.getState, this.dispatch = t3.dispatch, this.undo = t3.undo, this.redo = t3.redo, this.keymapRegistry = t3.keymapRegistry, this.isReadOnly = t3.isReadOnly ?? (() => false), this.compositionTracker = t3.compositionTracker, this.handleKeydown = this.onKeydown.bind(this), e5.addEventListener("keydown", this.handleKeydown);
775
- }
776
- getState;
777
- dispatch;
778
- undo;
779
- redo;
780
- keymapRegistry;
781
- isReadOnly;
782
- compositionTracker;
783
- handleKeydown;
784
- onKeydown(e5) {
785
- if (this.compositionTracker?.isComposing) return;
786
- if (this.handleNodeSelectionKeys(e5)) return;
787
- if (this.handleGapCursorKeys(e5)) return;
788
- if (this.isReadOnly()) {
789
- if (this.keymapRegistry) {
790
- const t4 = un(e5), n4 = this.keymapRegistry.getKeymapsByPriority().navigation;
791
- for (let s4 = n4.length - 1; s4 >= 0; s4--) {
792
- const r4 = n4[s4]?.[t4];
793
- if (r4?.()) return void e5.preventDefault();
794
- }
795
- }
796
- return void this.handleEscape(e5);
797
- }
798
- if (this.keymapRegistry) {
799
- const t4 = un(e5), n4 = this.keymapRegistry.getKeymapsByPriority();
800
- for (const s4 of [n4.context, n4.navigation, n4.default]) for (let n5 = s4.length - 1; n5 >= 0; n5--) {
801
- const r4 = s4[n5]?.[t4];
802
- if (r4?.()) return void e5.preventDefault();
803
- }
804
- }
805
- if (this.handleGapCursorArrowFallback(e5)) return;
806
- if (this.handleTab(e5)) return;
807
- if (this.handleEscape(e5)) return;
808
- if (!e5.metaKey && !e5.ctrlKey) return;
809
- const t3 = e5.key.toLowerCase(), n3 = this.getState();
810
- let s3 = null;
811
- return "z" !== t3 || e5.shiftKey ? "z" === t3 && e5.shiftKey || "y" === t3 && !e5.shiftKey ? (e5.preventDefault(), void this.redo()) : ("a" !== t3 || e5.shiftKey || (e5.preventDefault(), s3 = Fe(n3)), void (s3 && this.dispatch(s3))) : (e5.preventDefault(), void this.undo());
812
- }
813
- handleNodeSelectionKeys(e5) {
814
- const t3 = this.getState(), n3 = t3.selection;
815
- if (!ie(n3)) return false;
816
- const s3 = e5.key;
817
- if (!("ArrowLeft" !== s3 && "ArrowUp" !== s3 && "ArrowRight" !== s3 && "ArrowDown" !== s3 || e5.shiftKey || e5.metaKey || e5.ctrlKey || e5.altKey)) {
818
- const n4 = Ue(t3, "ArrowLeft" === s3 ? "left" : "ArrowRight" === s3 ? "right" : "ArrowUp" === s3 ? "up" : "down");
819
- return !!n4 && (e5.preventDefault(), this.dispatch(n4), true);
820
- }
821
- if ("Backspace" === s3 || "Delete" === s3) {
822
- if (this.isReadOnly()) return e5.preventDefault(), true;
823
- e5.preventDefault();
824
- const s4 = ze(t3, n3);
825
- return s4 && this.dispatch(s4), true;
826
- }
827
- if ("Enter" === s3) {
828
- if (this.isReadOnly()) return e5.preventDefault(), true;
829
- e5.preventDefault();
830
- const n4 = We(t3);
831
- return n4 && this.dispatch(n4), true;
832
- }
833
- if ("Escape" === s3) {
834
- e5.preventDefault();
835
- const n4 = Ue(t3, "right");
836
- return n4 && this.dispatch(n4), true;
837
- }
838
- return false;
839
- }
840
- handleGapCursorKeys(e5) {
841
- const t3 = this.getState(), n3 = t3.selection;
842
- if (!oe(n3)) return false;
843
- const s3 = e5.key;
844
- if ("ArrowLeft" === s3 || "ArrowRight" === s3 || "ArrowUp" === s3 || "ArrowDown" === s3) return false;
845
- if ("Escape" === s3 || "Tab" === s3) return false;
846
- if (e5.ctrlKey || e5.metaKey || e5.altKey) return false;
847
- if ("Enter" === s3) {
848
- if (this.isReadOnly()) return e5.preventDefault(), true;
849
- e5.preventDefault();
850
- const n4 = We(t3);
851
- return n4 && this.dispatch(n4), true;
852
- }
853
- if ("Backspace" === s3) {
854
- if (this.isReadOnly()) return e5.preventDefault(), true;
855
- e5.preventDefault();
856
- const s4 = Ve(t3, n3);
857
- return s4 && this.dispatch(s4), true;
858
- }
859
- if ("Delete" === s3) {
860
- if (this.isReadOnly()) return e5.preventDefault(), true;
861
- e5.preventDefault();
862
- const s4 = Ge(t3, n3);
863
- return s4 && this.dispatch(s4), true;
864
- }
865
- if (1 === s3.length) {
866
- if (this.isReadOnly()) return e5.preventDefault(), true;
867
- e5.preventDefault();
868
- const n4 = qe(t3, s3);
869
- return this.dispatch(n4), true;
870
- }
871
- return false;
872
- }
873
- handleGapCursorArrowFallback(e5) {
874
- const t3 = this.getState(), n3 = t3.selection;
875
- if (!oe(n3)) return false;
876
- const s3 = e5.key;
877
- if ("ArrowLeft" !== s3 && "ArrowRight" !== s3 && "ArrowUp" !== s3 && "ArrowDown" !== s3) return false;
878
- const r4 = Re(t3, "ArrowLeft" === s3 ? "left" : "ArrowRight" === s3 ? "right" : "ArrowUp" === s3 ? "up" : "down");
879
- return !(!r4 || he(r4.selectionAfter, n3) || (e5.preventDefault(), this.dispatch(r4), 0));
880
- }
881
- handleTab(e5) {
882
- if ("Tab" !== e5.key) return false;
883
- if (e5.metaKey || e5.ctrlKey || e5.altKey) return false;
884
- if (e5.preventDefault(), e5.shiftKey) return true;
885
- const t3 = this.getState(), n3 = qe(t3, " ");
886
- return this.dispatch(n3), true;
887
- }
888
- handleEscape(e5) {
889
- return "Escape" === e5.key && (this.element.blur(), true);
890
- }
891
- destroy() {
892
- this.element.removeEventListener("keydown", this.handleKeydown);
893
- }
894
- }
895
- function un(e5) {
896
- const t3 = [];
897
- (e5.metaKey || e5.ctrlKey) && t3.push("Mod"), e5.shiftKey && t3.push("Shift"), e5.altKey && t3.push("Alt");
898
- let n3 = e5.key;
899
- return " " === n3 ? n3 = "Space" : 1 === n3.length && (n3 = n3.toUpperCase()), t3.push(n3), t3.join("-");
900
- }
901
- function pn(e5) {
902
- const t3 = e5.getMarkTypes(), n3 = /* @__PURE__ */ new Map();
903
- for (const s3 of t3) {
904
- const t4 = e5.getMarkSpec(s3);
905
- t4 && n3.set(s3, t4.rank ?? 99);
906
- }
907
- return n3;
908
- }
909
- function fn(e5, t3, n3, s3) {
910
- if ("" === e5) return "";
911
- let r4 = Ee(e5);
912
- if (0 === t3.length) return r4;
913
- const i9 = s3 ?? pn(n3), o2 = [...t3].sort((e6, t4) => (i9.get(e6.type) ?? 99) - (i9.get(t4.type) ?? 99)), a22 = [], c11 = [];
914
- for (const e6 of o2) {
915
- const t4 = n3.getMarkSpec(e6.type);
916
- if (t4?.toHTMLStyle) {
917
- const n4 = t4.toHTMLStyle(e6);
918
- n4 && a22.push(n4);
919
- } else c11.push(e6);
920
- }
921
- a22.length > 0 && (r4 = `<span style="${a22.join("; ")}">${r4}</span>`);
922
- for (const e6 of c11) {
923
- const t4 = n3.getMarkSpec(e6.type);
924
- t4?.toHTMLString && (r4 = t4.toHTMLString(e6, r4));
925
- }
926
- return r4;
927
- }
928
- function gn(e5, t3, n3, s3, r4) {
929
- if ("" === e5) return "";
930
- let i9 = Ee(e5);
931
- if (0 === t3.length) return i9;
932
- const o2 = r4 ?? pn(n3), a22 = [...t3].sort((e6, t4) => (o2.get(e6.type) ?? 99) - (o2.get(t4.type) ?? 99)), c11 = [], l3 = [];
933
- for (const e6 of a22) {
934
- const t4 = n3.getMarkSpec(e6.type);
935
- if (t4?.toHTMLStyle) {
936
- const n4 = t4.toHTMLStyle(e6);
937
- n4 && c11.push(n4);
938
- } else l3.push(e6);
939
- }
940
- if (c11.length > 0) {
941
- const e6 = c11.join("; ");
942
- i9 = `<span class="${s3.getClassName(e6)}">${i9}</span>`;
943
- }
944
- for (const e6 of l3) {
945
- const t4 = n3.getMarkSpec(e6.type);
946
- t4?.toHTMLString && (i9 = t4.toHTMLString(e6, i9));
947
- }
948
- return i9;
949
- }
950
- let mn;
951
- class yn {
952
- constructor(e5, t3) {
953
- this.element = e5, this.getState = t3.getState, this.dispatch = t3.dispatch, this.schemaRegistry = t3.schemaRegistry, this.syncSelection = t3.syncSelection, this.isReadOnly = t3.isReadOnly ?? (() => false), this.handleCopy = this.onCopy.bind(this), this.handleCut = this.onCut.bind(this), e5.addEventListener("copy", this.handleCopy), e5.addEventListener("cut", this.handleCut);
954
- }
955
- getState;
956
- dispatch;
957
- schemaRegistry;
958
- syncSelection;
959
- isReadOnly;
960
- handleCopy;
961
- handleCut;
962
- onCopy(e5) {
963
- this.syncSelection?.();
964
- const t3 = this.getState(), n3 = t3.selection;
965
- if (oe(n3)) return;
966
- if (de(n3) && le(n3)) return;
967
- e5.preventDefault();
968
- const s3 = e5.clipboardData;
969
- s3 && (ie(n3) ? this.writeNodeSelectionToClipboard(s3, t3) : this.writeTextSelectionToClipboard(s3, t3));
970
- }
971
- onCut(e5) {
972
- if (this.isReadOnly()) return;
973
- this.syncSelection?.();
974
- const t3 = this.getState(), n3 = t3.selection;
975
- if (oe(n3)) return;
976
- if (de(n3) && le(n3)) return;
977
- e5.preventDefault();
978
- const s3 = e5.clipboardData;
979
- if (s3) if (ie(n3)) {
980
- this.writeNodeSelectionToClipboard(s3, t3);
981
- const e6 = ze(t3, n3);
982
- e6 && this.dispatch(e6);
983
- } else {
984
- this.writeTextSelectionToClipboard(s3, t3);
985
- const e6 = je(t3);
986
- e6 && this.dispatch(e6);
987
- }
988
- }
989
- writeNodeSelectionToClipboard(e5, t3) {
990
- const n3 = t3.selection;
991
- if (!ie(n3)) return;
992
- const s3 = t3.getBlock(n3.nodeId);
993
- if (!s3) return;
994
- const r4 = { type: s3.type, ...s3.attrs ? { attrs: { ...s3.attrs } } : {} };
995
- e5.setData("application/x-notectl-block", JSON.stringify(r4));
996
- const i9 = this.schemaRegistry?.getNodeSpec(s3.type);
997
- i9?.toHTML && e5.setData("text/html", i9.toHTML(s3, ""));
998
- const o2 = s3.attrs, a22 = "string" == typeof o2?.alt ? o2.alt : "";
999
- e5.setData("text/plain", a22);
1000
- }
1001
- writeTextSelectionToClipboard(e5, t3) {
1002
- const n3 = t3.selection;
1003
- if (ie(n3)) return;
1004
- if (oe(n3)) return;
1005
- if (le(n3)) return;
1006
- const s3 = t3.getBlockOrder(), r4 = ue(n3, s3), i9 = s3.indexOf(r4.from.blockId), o2 = s3.indexOf(r4.to.blockId), a22 = [], c11 = [];
1007
- for (let e6 = i9; e6 <= o2; e6++) {
1008
- const n4 = s3[e6];
1009
- if (!n4) continue;
1010
- const l4 = t3.getBlock(n4);
1011
- if (!l4) continue;
1012
- const h4 = $(l4), d5 = O(l4), u2 = e6 === i9 ? r4.from.offset : 0, p4 = e6 === o2 ? r4.to.offset : d5, f4 = h4.slice(u2, p4);
1013
- a22.push(f4), c11.push({ type: l4.type, text: f4, ...l4.attrs ? { attrs: { ...l4.attrs } } : {} });
1014
- }
1015
- const l3 = a22.join("\n");
1016
- if (e5.setData("text/plain", l3), this.schemaRegistry) {
1017
- const n4 = pn(this.schemaRegistry), a23 = [];
1018
- for (let e6 = i9; e6 <= o2; e6++) {
1019
- const c12 = s3[e6];
1020
- if (!c12) continue;
1021
- const l4 = t3.getBlock(c12);
1022
- if (!l4) continue;
1023
- const h4 = e6 === i9 ? r4.from.offset : 0, d5 = e6 === o2 ? r4.to.offset : O(l4);
1024
- a23.push(this.serializeBlockRangeToHTML(l4, h4, d5, n4));
1025
- }
1026
- e5.setData("text/html", a23.join(""));
1027
- }
1028
- !(function(e6, t4) {
1029
- mn = { plainText: e6, blocks: t4 };
1030
- })(l3, c11);
1031
- }
1032
- serializeBlockRangeToHTML(e5, t3, n3, s3) {
1033
- const r4 = I(e5), i9 = [];
1034
- let o2 = 0;
1035
- for (const e6 of r4) {
1036
- const r5 = o2 + (C(e6) ? 1 : e6.text.length);
1037
- if (r5 <= t3 || o2 >= n3) o2 = r5;
1038
- else {
1039
- if (R(e6)) {
1040
- const r6 = Math.max(0, t3 - o2), a22 = Math.min(e6.text.length, n3 - o2), c11 = e6.text.slice(r6, a22);
1041
- c11.length > 0 && this.schemaRegistry && i9.push(fn(c11, e6.marks, this.schemaRegistry, s3));
1042
- } else if (C(e6)) {
1043
- const t4 = this.schemaRegistry?.getInlineNodeSpec(e6.inlineType);
1044
- t4?.toHTMLString && i9.push(t4.toHTMLString(e6));
1045
- }
1046
- o2 = r5;
1047
- }
1048
- }
1049
- return i9.join("");
1050
- }
1051
- destroy() {
1052
- this.element.removeEventListener("copy", this.handleCopy), this.element.removeEventListener("cut", this.handleCut);
1053
- }
1054
- }
1055
- class kn {
1056
- _composing = false;
1057
- _activeBlockId = null;
1058
- get isComposing() {
1059
- return this._composing;
1060
- }
1061
- get activeBlockId() {
1062
- return this._activeBlockId;
1063
- }
1064
- start(e5) {
1065
- this._composing = true, this._activeBlockId = e5;
1066
- }
1067
- end() {
1068
- this._composing = false, this._activeBlockId = null;
1069
- }
1070
- }
1071
- class bn {
1072
- _contextKeymaps = [];
1073
- _navigationKeymaps = [];
1074
- _defaultKeymaps = [];
1075
- registerKeymap(e5, t3) {
1076
- const n3 = [...this._contextKeymaps, ...this._navigationKeymaps, ...this._defaultKeymaps];
1077
- for (const t4 of Object.keys(e5)) for (const e6 of n3) if (t4 in e6) {
1078
- console.debug(`[notectl] Keymap shortcut "${t4}" is already registered and will be overridden.`);
1079
- break;
1080
- }
1081
- this.keymapArrayForPriority(t3?.priority ?? "default").push(e5);
1082
- }
1083
- getKeymaps() {
1084
- return [...this._contextKeymaps, ...this._navigationKeymaps, ...this._defaultKeymaps];
1085
- }
1086
- getKeymapsByPriority() {
1087
- return { context: [...this._contextKeymaps], navigation: [...this._navigationKeymaps], default: [...this._defaultKeymaps] };
1088
- }
1089
- removeKeymap(e5) {
1090
- for (const t3 of [this._contextKeymaps, this._navigationKeymaps, this._defaultKeymaps]) {
1091
- const n3 = t3.indexOf(e5);
1092
- if (-1 !== n3) return void t3.splice(n3, 1);
1093
- }
1094
- }
1095
- clear() {
1096
- this._contextKeymaps.length = 0, this._navigationKeymaps.length = 0, this._defaultKeymaps.length = 0;
1097
- }
1098
- keymapArrayForPriority(e5) {
1099
- switch (e5) {
1100
- case "context":
1101
- return this._contextKeymaps;
1102
- case "navigation":
1103
- return this._navigationKeymaps;
1104
- case "default":
1105
- return this._defaultKeymaps;
1106
- }
1107
- }
1108
- }
1109
- class vn {
1110
- _inputRules = [];
1111
- registerInputRule(e5) {
1112
- this._inputRules.push(e5);
1113
- }
1114
- getInputRules() {
1115
- return this._inputRules;
1116
- }
1117
- removeInputRule(e5) {
1118
- const t3 = this._inputRules.indexOf(e5);
1119
- -1 !== t3 && this._inputRules.splice(t3, 1);
1120
- }
1121
- clear() {
1122
- this._inputRules.length = 0;
1123
- }
1124
- }
1125
- class Sn {
1126
- _fileHandlers = [];
1127
- registerFileHandler(e5, t3) {
1128
- this._fileHandlers.push({ pattern: e5, handler: t3 });
1129
- }
1130
- getFileHandlers() {
1131
- return this._fileHandlers;
1132
- }
1133
- matchFileHandlers(e5) {
1134
- const t3 = [];
1135
- for (const n3 of this._fileHandlers) wn(n3.pattern, e5) && t3.push(n3.handler);
1136
- return t3;
1137
- }
1138
- removeFileHandler(e5) {
1139
- const t3 = this._fileHandlers.findIndex((t4) => t4.handler === e5);
1140
- -1 !== t3 && this._fileHandlers.splice(t3, 1);
1141
- }
1142
- clear() {
1143
- this._fileHandlers.length = 0;
1144
- }
1145
- }
1146
- function wn(e5, t3) {
1147
- if ("*" === e5 || "*/*" === e5) return true;
1148
- if (e5 === t3) return true;
1149
- if (e5.endsWith("/*")) {
1150
- const n3 = e5.slice(0, -1);
1151
- return t3.startsWith(n3);
1152
- }
1153
- return false;
1154
- }
1155
- class En {
1156
- _nodeViews = /* @__PURE__ */ new Map();
1157
- registerNodeView(e5, t3) {
1158
- if (this._nodeViews.has(e5)) throw new Error(`NodeView for type "${e5}" is already registered.`);
1159
- this._nodeViews.set(e5, t3);
1160
- }
1161
- getNodeViewFactory(e5) {
1162
- return this._nodeViews.get(e5);
1163
- }
1164
- removeNodeView(e5) {
1165
- this._nodeViews.delete(e5);
1166
- }
1167
- clear() {
1168
- this._nodeViews.clear();
1169
- }
1170
- }
1171
- class xn {
1172
- _toolbarItems = /* @__PURE__ */ new Map();
1173
- _toolbarItemPluginMap = /* @__PURE__ */ new Map();
1174
- registerToolbarItem(e5, t3) {
1175
- if (this._toolbarItems.has(e5.id)) throw new Error(`ToolbarItem with id "${e5.id}" is already registered.`);
1176
- if (this._toolbarItems.set(e5.id, e5), t3) {
1177
- const n3 = this._toolbarItemPluginMap.get(t3) ?? [];
1178
- n3.push(e5.id), this._toolbarItemPluginMap.set(t3, n3);
1179
- }
1180
- }
1181
- getToolbarItemsByPlugin(e5) {
1182
- const t3 = this._toolbarItemPluginMap.get(e5) ?? [], n3 = [];
1183
- for (const e6 of t3) {
1184
- const t4 = this._toolbarItems.get(e6);
1185
- t4 && n3.push(t4);
1186
- }
1187
- return n3;
1188
- }
1189
- getToolbarItem(e5) {
1190
- return this._toolbarItems.get(e5);
1191
- }
1192
- getToolbarItems() {
1193
- return [...this._toolbarItems.values()];
1194
- }
1195
- removeToolbarItem(e5) {
1196
- this._toolbarItems.delete(e5);
1197
- for (const [t3, n3] of this._toolbarItemPluginMap) {
1198
- const s3 = n3.indexOf(e5);
1199
- if (-1 !== s3) {
1200
- n3.splice(s3, 1), 0 === n3.length && this._toolbarItemPluginMap.delete(t3);
1201
- break;
1202
- }
1203
- }
1204
- }
1205
- clear() {
1206
- this._toolbarItems.clear(), this._toolbarItemPluginMap.clear();
1207
- }
1208
- }
1209
- class Cn {
1210
- _entries = /* @__PURE__ */ new Map();
1211
- registerBlockTypePickerEntry(e5) {
1212
- if (this._entries.has(e5.id)) throw new Error(`BlockTypePickerEntry with id "${e5.id}" is already registered.`);
1213
- this._entries.set(e5.id, e5);
1214
- }
1215
- getBlockTypePickerEntries() {
1216
- return [...this._entries.values()].sort((e5, t3) => e5.priority - t3.priority);
1217
- }
1218
- removeBlockTypePickerEntry(e5) {
1219
- this._entries.delete(e5);
1220
- }
1221
- clear() {
1222
- this._entries.clear();
1223
- }
1224
- }
1225
- function Tn(e5, t3) {
1226
- if (t3) {
1227
- const n3 = t3.getMarkSpec(e5.type);
1228
- if (n3) return n3.rank ?? 100;
1229
- }
1230
- switch (e5.type) {
1231
- case "bold":
1232
- return 0;
1233
- case "italic":
1234
- return 1;
1235
- case "underline":
1236
- return 2;
1237
- default:
1238
- return 100;
1239
- }
1240
- }
1241
- function An(e5, t3) {
1242
- if (t3) {
1243
- const n3 = t3.getMarkSpec(e5.type);
1244
- if (n3) return n3.toDOM(e5);
1245
- }
1246
- switch (e5.type) {
1247
- case "bold":
1248
- return document.createElement("strong");
1249
- case "italic":
1250
- return document.createElement("em");
1251
- case "underline":
1252
- return document.createElement("u");
1253
- default:
1254
- return document.createElement("span");
1255
- }
1256
- }
1257
- class Rn {
1258
- wrapperElement = null;
1259
- container;
1260
- registry;
1261
- constructor(e5, t3) {
1262
- this.container = e5, this.registry = t3;
1263
- }
1264
- get isActive() {
1265
- return null !== this.wrapperElement;
1266
- }
1267
- onCompositionStart(e5) {
1268
- this.cleanup();
1269
- const t3 = e5.storedMarks;
1270
- if (!t3 || 0 === t3.length) return;
1271
- const n3 = e5.selection;
1272
- if (ie(n3) || oe(n3)) return;
1273
- if (!le(n3)) return;
1274
- const s3 = document.createElement("span");
1275
- s3.setAttribute("data-cursor-wrapper", "");
1276
- const r4 = document.createTextNode("​");
1277
- let i9 = r4;
1278
- const o2 = [...t3].sort((e6, t4) => Tn(e6, this.registry) - Tn(t4, this.registry));
1279
- for (let e6 = o2.length - 1; e6 >= 0; e6--) {
1280
- const t4 = o2[e6];
1281
- if (!t4) continue;
1282
- const n4 = An(t4, this.registry);
1283
- n4.appendChild(i9), i9 = n4;
1284
- }
1285
- s3.appendChild(i9);
1286
- const a22 = Le(this.container);
1287
- if (a22 && 0 !== a22.rangeCount) {
1288
- a22.getRangeAt(0).insertNode(s3);
1289
- try {
1290
- a22.collapse(r4, r4.length);
1291
- } catch {
1292
- }
1293
- this.wrapperElement = s3;
1294
- }
1295
- }
1296
- cleanup() {
1297
- this.wrapperElement && (this.wrapperElement.remove(), this.wrapperElement = null);
1298
- }
1299
- }
1300
- const Ln = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
1301
- function Mn(e5) {
1302
- let t3 = 0;
1303
- const n3 = (n4) => {
1304
- n4.stopPropagation();
1305
- const s3 = Array.from(e5.container.querySelectorAll(e5.itemSelector));
1306
- if (0 !== s3.length) switch (n4.key) {
1307
- case "Escape":
1308
- return n4.preventDefault(), void e5.onClose();
1309
- case "ArrowDown":
1310
- return n4.preventDefault(), t3 = ct(s3, t3, 1), at(s3, t3), void s3[t3]?.focus();
1311
- case "ArrowUp":
1312
- return n4.preventDefault(), t3 = ct(s3, t3, -1), at(s3, t3), void s3[t3]?.focus();
1313
- case "Enter":
1314
- case " ": {
1315
- n4.preventDefault();
1316
- const r4 = s3[t3];
1317
- return void (r4 && e5.onActivate(r4));
1318
- }
1319
- case "Home":
1320
- return n4.preventDefault(), t3 = 0, at(s3, t3), void s3[t3]?.focus();
1321
- case "End":
1322
- return n4.preventDefault(), t3 = s3.length - 1, at(s3, t3), void s3[t3]?.focus();
1323
- }
1324
- };
1325
- return e5.container.addEventListener("keydown", n3), () => e5.container.removeEventListener("keydown", n3);
1326
- }
1327
- function In(e5) {
1328
- let t3 = 0;
1329
- const n3 = (n4) => {
1330
- const s3 = Array.from(e5.container.querySelectorAll(e5.itemSelector));
1331
- if (0 !== s3.length) switch (n4.key) {
1332
- case "Escape":
1333
- return n4.preventDefault(), void e5.onClose();
1334
- case "ArrowDown":
1335
- return n4.preventDefault(), t3 = ct(s3, t3, 1), at(s3, t3), void s3[t3]?.focus();
1336
- case "ArrowUp":
1337
- return n4.preventDefault(), t3 = ct(s3, t3, -1), at(s3, t3), void s3[t3]?.focus();
1338
- case "Enter":
1339
- case " ": {
1340
- n4.preventDefault();
1341
- const r4 = s3[t3];
1342
- return void (r4 && e5.onSelect(r4));
1343
- }
1344
- }
1345
- };
1346
- return e5.container.addEventListener("keydown", n3), () => e5.container.removeEventListener("keydown", n3);
1347
- }
1348
- function Nn(e5) {
1349
- let t3 = 0;
1350
- const n3 = e5.columns, s3 = e5.totalCells, r4 = Math.ceil(s3 / n3), i9 = (i10) => {
1351
- const o2 = Array.from(e5.container.querySelectorAll(e5.cellSelector));
1352
- if (0 !== o2.length) {
1353
- if ("Escape" === i10.key) return i10.preventDefault(), void e5.onClose();
1354
- if ("Enter" === i10.key || " " === i10.key) {
1355
- i10.preventDefault();
1356
- const n4 = o2[t3];
1357
- return void (n4 && e5.onSelect(n4));
1358
- }
1359
- if (Ln.has(i10.key)) {
1360
- i10.preventDefault();
1361
- const a22 = Math.floor(t3 / n3) + 1, c11 = t3 % n3 + 1, [l3, h4] = ot(a22, c11, r4, n3, i10.key);
1362
- let d5 = (l3 - 1) * n3 + (h4 - 1);
1363
- return d5 >= s3 && (d5 = s3 - 1), t3 = d5, at(o2, t3), o2[t3]?.focus(), void e5.onNavigate?.(t3);
1364
- }
1365
- if ("Home" === i10.key || "End" === i10.key) {
1366
- i10.preventDefault();
1367
- const r5 = Math.floor(t3 / n3) * n3, a22 = Math.min(r5 + n3 - 1, s3 - 1);
1368
- t3 = "Home" === i10.key ? r5 : a22, at(o2, t3), o2[t3]?.focus(), e5.onNavigate?.(t3);
1369
- }
1370
- }
1371
- };
1372
- return e5.container.addEventListener("keydown", i9), () => e5.container.removeEventListener("keydown", i9);
1373
- }
1374
- class Bn {
1375
- listeners = /* @__PURE__ */ new Map();
1376
- emit(e5, t3) {
1377
- const n3 = this.listeners.get(e5.id);
1378
- if (n3) for (const s3 of n3) try {
1379
- s3(t3);
1380
- } catch (t4) {
1381
- console.error(`[EventBus] Listener error on "${e5.id}":`, t4);
1382
- }
1383
- }
1384
- on(e5, t3) {
1385
- const n3 = e5.id;
1386
- this.listeners.has(n3) || this.listeners.set(n3, /* @__PURE__ */ new Set());
1387
- const s3 = this.listeners.get(n3) ?? /* @__PURE__ */ new Set();
1388
- return s3.add(t3), () => {
1389
- s3.delete(t3), 0 === s3.size && this.listeners.delete(n3);
1390
- };
1391
- }
1392
- off(e5, t3) {
1393
- const n3 = this.listeners.get(e5.id);
1394
- n3 && (n3.delete(t3), 0 === n3.size && this.listeners.delete(e5.id));
1395
- }
1396
- clear() {
1397
- this.listeners.clear();
1398
- }
1399
- }
1400
- class On {
1401
- plugins = /* @__PURE__ */ new Map();
1402
- commands = /* @__PURE__ */ new Map();
1403
- services = /* @__PURE__ */ new Map();
1404
- middlewares = [];
1405
- registrations = /* @__PURE__ */ new Map();
1406
- eventBus = new Bn();
1407
- pluginStyleSheets = [];
1408
- schemaRegistry = new Ht();
1409
- keymapRegistry = new bn();
1410
- inputRuleRegistry = new vn();
1411
- fileHandlerRegistry = new Sn();
1412
- nodeViewRegistry = new En();
1413
- toolbarRegistry = new xn();
1414
- blockTypePickerRegistry = new Cn();
1415
- middlewareSorted = null;
1416
- initOrder = [];
1417
- initialized = false;
1418
- initializing = false;
1419
- readOnly = false;
1420
- readonlyBypassActive = false;
1421
- registerService(e5, t3) {
1422
- if (this.services.has(e5.id)) throw new Error(`Service "${e5.id}" is already registered.`);
1423
- this.services.set(e5.id, t3);
1424
- }
1425
- register(e5) {
1426
- if (this.initialized || this.initializing) throw new Error(`Cannot register plugin "${e5.id}" after initialization.`);
1427
- if (this.plugins.has(e5.id)) throw new Error(`Plugin "${e5.id}" is already registered.`);
1428
- this.plugins.set(e5.id, e5);
1429
- }
1430
- async init(e5) {
1431
- if (!this.initialized && !this.initializing) {
1432
- this.initializing = true, this.initOrder = this.resolveOrder();
1433
- for (const t3 of this.initOrder) {
1434
- const n3 = this.plugins.get(t3);
1435
- if (!n3) continue;
1436
- const s3 = this.createContext(t3, e5);
1437
- try {
1438
- await n3.init(s3);
1439
- } catch (e6) {
1440
- console.error(`[PluginManager] Plugin "${t3}" failed to initialize:`, e6);
1441
- }
1442
- }
1443
- e5.onBeforeReady && await e5.onBeforeReady();
1444
- for (const e6 of this.initOrder) {
1445
- const t3 = this.plugins.get(e6);
1446
- if (t3?.onReady) try {
1447
- await t3.onReady();
1448
- } catch (t4) {
1449
- console.error(`[PluginManager] Plugin "${e6}" error in onReady:`, t4);
1450
- }
1451
- }
1452
- this.initialized = true, this.initializing = false;
1453
- }
1454
- }
1455
- notifyStateChange(e5, t3, n3) {
1456
- for (const s3 of this.initOrder) {
1457
- const r4 = this.plugins.get(s3);
1458
- if (r4?.onStateChange) try {
1459
- r4.onStateChange(e5, t3, n3);
1460
- } catch (e6) {
1461
- console.error(`[PluginManager] Plugin "${s3}" error in onStateChange:`, e6);
1462
- }
1463
- }
1464
- }
1465
- collectDecorations(e5, t3) {
1466
- let n3 = lt.empty;
1467
- for (const s3 of this.initOrder) {
1468
- const r4 = this.plugins.get(s3);
1469
- if (r4?.decorations) try {
1470
- const s4 = r4.decorations(e5, t3);
1471
- s4.isEmpty || (n3 = n3.merge(s4));
1472
- } catch (e6) {
1473
- console.error(`[PluginManager] Plugin "${s3}" error in decorations():`, e6);
1474
- }
1475
- }
1476
- return n3;
1477
- }
1478
- dispatchWithMiddleware(e5, t3, n3) {
1479
- if (0 === this.middlewares.length) return void n3(e5);
1480
- const s3 = this.getSortedMiddleware();
1481
- let r4 = 0, i9 = false;
1482
- const o2 = (e6) => {
1483
- if (r4 < s3.length) {
1484
- const n4 = s3[r4++];
1485
- if (!n4) return;
1486
- let i10 = false;
1487
- const a22 = (e7) => {
1488
- i10 || (i10 = true, o2(e7));
1489
- };
1490
- try {
1491
- n4.middleware(e6, t3, a22);
1492
- } catch (t4) {
1493
- console.error(`[PluginManager] Middleware "${n4.name}" error:`, t4), a22(e6);
1494
- }
1495
- } else i9 || (i9 = true, n3(e6));
1496
- };
1497
- o2(e5);
1498
- }
1499
- canExecuteCommand(e5) {
1500
- const t3 = this.commands.get(e5);
1501
- return !(!t3 || this.readOnly && !t3.readonlyAllowed);
1502
- }
1503
- executeCommand(e5) {
1504
- const t3 = this.commands.get(e5);
1505
- if (!t3) return false;
1506
- if (this.readOnly && !t3.readonlyAllowed) return false;
1507
- const n3 = this.readOnly && t3.readonlyAllowed;
1508
- n3 && (this.readonlyBypassActive = true);
1509
- try {
1510
- return t3.handler();
1511
- } catch (t4) {
1512
- return console.error(`[PluginManager] Command "${e5}" error:`, t4), false;
1513
- } finally {
1514
- n3 && (this.readonlyBypassActive = false);
1515
- }
1516
- }
1517
- isReadonlyBypassed() {
1518
- return this.readonlyBypassActive;
1519
- }
1520
- configurePlugin(e5, t3) {
1521
- const n3 = this.plugins.get(e5);
1522
- if (!n3) throw new Error(`Plugin "${e5}" not found.`);
1523
- if (n3.onConfigure) try {
1524
- n3.onConfigure(t3);
1525
- } catch (t4) {
1526
- console.error(`[PluginManager] Plugin "${e5}" error in onConfigure:`, t4);
1527
- }
1528
- }
1529
- isReadOnly() {
1530
- return this.readOnly;
1531
- }
1532
- setReadOnly(e5) {
1533
- if (this.readOnly !== e5) {
1534
- this.readOnly = e5;
1535
- for (const t3 of this.initOrder) {
1536
- const n3 = this.plugins.get(t3);
1537
- if (n3?.onReadOnlyChange) try {
1538
- n3.onReadOnlyChange(e5);
1539
- } catch (e6) {
1540
- console.error(`[PluginManager] Plugin "${t3}" error in onReadOnlyChange:`, e6);
1541
- }
1542
- }
1543
- }
1544
- }
1545
- getPluginIds() {
1546
- return [...this.plugins.keys()];
1547
- }
1548
- getMiddlewareChain() {
1549
- return this.getSortedMiddleware().map((e5) => ({ name: e5.name, priority: e5.priority, pluginId: e5.pluginId }));
1550
- }
1551
- get(e5) {
1552
- return this.plugins.get(e5);
1553
- }
1554
- getService(e5) {
1555
- return this.services.get(e5.id);
1556
- }
1557
- onEvent(e5, t3) {
1558
- return this.eventBus.on(e5, t3);
1559
- }
1560
- getPluginStyleSheets() {
1561
- return this.pluginStyleSheets;
1562
- }
1563
- async destroy() {
1564
- const e5 = [...this.initOrder].reverse();
1565
- for (const t3 of e5) await this.destroyPlugin(t3);
1566
- this.plugins.clear(), this.commands.clear(), this.services.clear(), this.middlewares.length = 0, this.middlewareSorted = null, this.pluginStyleSheets.length = 0, this.eventBus.clear(), this.registrations.clear(), this.schemaRegistry.clear(), this.keymapRegistry.clear(), this.inputRuleRegistry.clear(), this.fileHandlerRegistry.clear(), this.nodeViewRegistry.clear(), this.toolbarRegistry.clear(), this.blockTypePickerRegistry.clear(), this.initOrder = [], this.initialized = false;
1567
- }
1568
- async destroyPlugin(e5) {
1569
- const t3 = this.plugins.get(e5);
1570
- if (t3?.destroy) try {
1571
- await t3.destroy();
1572
- } catch (t4) {
1573
- console.error(`[PluginManager] Plugin "${e5}" error in destroy:`, t4);
1574
- }
1575
- this.cleanupRegistrations(e5);
1576
- }
1577
- cleanupRegistrations(e5) {
1578
- const t3 = this.registrations.get(e5);
1579
- if (t3) {
1580
- for (const e6 of t3.commands) this.commands.delete(e6);
1581
- for (const e6 of t3.services) this.services.delete(e6);
1582
- for (const e6 of t3.middlewares) {
1583
- const t4 = this.middlewares.indexOf(e6);
1584
- -1 !== t4 && this.middlewares.splice(t4, 1);
1585
- }
1586
- for (const e6 of t3.unsubscribers) e6();
1587
- for (const e6 of t3.nodeSpecs) this.schemaRegistry.removeNodeSpec(e6);
1588
- for (const e6 of t3.markSpecs) this.schemaRegistry.removeMarkSpec(e6);
1589
- for (const e6 of t3.inlineNodeSpecs) this.schemaRegistry.removeInlineNodeSpec(e6);
1590
- for (const e6 of t3.nodeViews) this.nodeViewRegistry.removeNodeView(e6);
1591
- for (const e6 of t3.keymaps) this.keymapRegistry.removeKeymap(e6);
1592
- for (const e6 of t3.inputRules) this.inputRuleRegistry.removeInputRule(e6);
1593
- for (const e6 of t3.toolbarItems) this.toolbarRegistry.removeToolbarItem(e6);
1594
- for (const e6 of t3.fileHandlers) this.fileHandlerRegistry.removeFileHandler(e6);
1595
- for (const e6 of t3.blockTypePickerEntries) this.blockTypePickerRegistry.removeBlockTypePickerEntry(e6);
1596
- for (const e6 of t3.stylesheets) {
1597
- const t4 = this.pluginStyleSheets.indexOf(e6);
1598
- -1 !== t4 && this.pluginStyleSheets.splice(t4, 1);
1599
- }
1600
- this.middlewareSorted = null, this.registrations.delete(e5);
1601
- }
1602
- }
1603
- getSortedMiddleware() {
1604
- return this.middlewareSorted || (this.middlewareSorted = [...this.middlewares].sort((e5, t3) => e5.priority - t3.priority)), this.middlewareSorted;
1605
- }
1606
- createContext(e5, t3) {
1607
- const n3 = { commands: [], services: [], middlewares: [], unsubscribers: [], nodeSpecs: [], markSpecs: [], inlineNodeSpecs: [], nodeViews: [], keymaps: [], inputRules: [], toolbarItems: [], fileHandlers: [], blockTypePickerEntries: [], stylesheets: [] };
1608
- this.registrations.set(e5, n3);
1609
- const s3 = { emit: (e6, t4) => this.eventBus.emit(e6, t4), on: (e6, t4) => {
1610
- const s4 = this.eventBus.on(e6, t4);
1611
- return n3.unsubscribers.push(s4), s4;
1612
- }, off: (e6, t4) => this.eventBus.off(e6, t4) };
1613
- return { getState: t3.getState, dispatch: t3.dispatch, getContainer: t3.getContainer, getPluginContainer: t3.getPluginContainer, isReadOnly: () => this.readOnly, registerCommand: (t4, s4, r4) => {
1614
- if (this.commands.has(t4)) {
1615
- const e6 = this.commands.get(t4);
1616
- throw new Error(`Command "${t4}" is already registered by plugin "${e6?.pluginId}".`);
1617
- }
1618
- const i9 = r4?.readonlyAllowed ?? false;
1619
- this.commands.set(t4, { name: t4, handler: s4, pluginId: e5, readonlyAllowed: i9 }), n3.commands.push(t4);
1620
- }, executeCommand: (e6) => this.executeCommand(e6), getEventBus: () => s3, registerMiddleware: (t4, s4) => {
1621
- const r4 = { name: s4?.name ?? (t4.name || "anonymous"), pluginId: e5, middleware: t4, priority: s4?.priority ?? 100 };
1622
- this.middlewares.push(r4), n3.middlewares.push(r4), this.middlewareSorted = null;
1623
- }, registerService: (e6, t4) => {
1624
- if (this.services.has(e6.id)) throw new Error(`Service "${e6.id}" is already registered by another plugin.`);
1625
- this.services.set(e6.id, t4), n3.services.push(e6.id);
1626
- }, getService: (e6) => this.services.get(e6.id), updateConfig: (t4) => {
1627
- const n4 = this.plugins.get(e5);
1628
- if (n4?.onConfigure) try {
1629
- n4.onConfigure(t4);
1630
- } catch (t5) {
1631
- console.error(`[PluginManager] Plugin "${e5}" error in onConfigure:`, t5);
1632
- }
1633
- }, registerNodeSpec: (e6) => {
1634
- this.schemaRegistry.registerNodeSpec(e6), n3.nodeSpecs.push(e6.type);
1635
- }, registerMarkSpec: (e6) => {
1636
- this.schemaRegistry.registerMarkSpec(e6), n3.markSpecs.push(e6.type);
1637
- }, registerNodeView: (e6, t4) => {
1638
- this.nodeViewRegistry.registerNodeView(e6, t4), n3.nodeViews.push(e6);
1639
- }, registerKeymap: (e6, t4) => {
1640
- this.keymapRegistry.registerKeymap(e6, t4), n3.keymaps.push(e6);
1641
- }, registerInputRule: (e6) => {
1642
- this.inputRuleRegistry.registerInputRule(e6), n3.inputRules.push(e6);
1643
- }, registerToolbarItem: (t4) => {
1644
- this.toolbarRegistry.registerToolbarItem(t4, e5), n3.toolbarItems.push(t4.id);
1645
- }, registerInlineNodeSpec: (e6) => {
1646
- this.schemaRegistry.registerInlineNodeSpec(e6), n3.inlineNodeSpecs.push(e6.type);
1647
- }, registerFileHandler: (e6, t4) => {
1648
- this.fileHandlerRegistry.registerFileHandler(e6, t4), n3.fileHandlers.push(t4);
1649
- }, registerBlockTypePickerEntry: (e6) => {
1650
- this.blockTypePickerRegistry.registerBlockTypePickerEntry(e6), n3.blockTypePickerEntries.push(e6.id);
1651
- }, getSchemaRegistry: () => this.schemaRegistry, getKeymapRegistry: () => this.keymapRegistry, getInputRuleRegistry: () => this.inputRuleRegistry, getFileHandlerRegistry: () => this.fileHandlerRegistry, getNodeViewRegistry: () => this.nodeViewRegistry, getToolbarRegistry: () => this.toolbarRegistry, getBlockTypePickerRegistry: () => this.blockTypePickerRegistry, registerStyleSheet: (e6) => {
1652
- const t4 = new CSSStyleSheet();
1653
- t4.replaceSync(e6), this.pluginStyleSheets.push(t4), n3.stylesheets.push(t4);
1654
- }, announce: (e6) => {
1655
- t3.announce?.(e6);
1656
- }, hasAnnouncement: () => t3.hasAnnouncement?.() ?? false };
1657
- }
1658
- resolveOrder() {
1659
- const e5 = [...this.plugins.keys()];
1660
- for (const t4 of e5) {
1661
- const e6 = this.plugins.get(t4);
1662
- if (e6) {
1663
- for (const n4 of e6.dependencies ?? []) if (!this.plugins.has(n4)) throw new Error(`Plugin "${t4}" depends on "${n4}", which is not registered.`);
1664
- }
1665
- }
1666
- const t3 = /* @__PURE__ */ new Map(), n3 = /* @__PURE__ */ new Map();
1667
- for (const s4 of e5) t3.set(s4, 0), n3.set(s4, []);
1668
- for (const s4 of e5) {
1669
- const e6 = this.plugins.get(s4), r5 = e6?.dependencies ?? [];
1670
- t3.set(s4, r5.length);
1671
- for (const e7 of r5) {
1672
- const t4 = n3.get(e7);
1673
- t4 && t4.push(s4);
1674
- }
1675
- }
1676
- const s3 = [];
1677
- for (const [e6, n4] of t3) 0 === n4 && s3.push(e6);
1678
- const r4 = [];
1679
- for (; s3.length > 0; ) {
1680
- s3.sort((e7, t4) => (this.plugins.get(e7)?.priority ?? 100) - (this.plugins.get(t4)?.priority ?? 100));
1681
- const e6 = s3.shift();
1682
- if (!e6) break;
1683
- r4.push(e6);
1684
- for (const r5 of n3.get(e6) ?? []) {
1685
- const e7 = (t3.get(r5) ?? 0) - 1;
1686
- t3.set(r5, e7), 0 === e7 && s3.push(r5);
1687
- }
1688
- }
1689
- if (r4.length !== e5.length) {
1690
- const t4 = e5.filter((e6) => !r4.includes(e6));
1691
- throw new Error(`Circular dependency detected among plugins: ${t4.join(", ")}`);
1692
- }
1693
- return r4;
1694
- }
1695
- }
1696
- const _n = { label: "Print", tooltip: (e5) => `Print (${e5})`, printingAnnouncement: "Printing" }, Dn = { en: _n, de: { label: "Drucken", tooltip: (e5) => `Drucken (${e5})`, printingAnnouncement: "Druckvorgang" }, es: { label: "Imprimir", tooltip: (e5) => `Imprimir (${e5})`, printingAnnouncement: "Imprimiendo" }, fr: { label: "Imprimer", tooltip: (e5) => `Imprimer (${e5})`, printingAnnouncement: "Impression" }, zh: { label: "打印", tooltip: (e5) => `打印 (${e5})`, printingAnnouncement: "正在打印" }, ru: { label: "Печать", tooltip: (e5) => `Печать (${e5})`, printingAnnouncement: "Печать" }, ar: { label: "طباعة", tooltip: (e5) => `طباعة (${e5})`, printingAnnouncement: "جارٍ الطباعة" }, hi: { label: "प्रिंट", tooltip: (e5) => `प्रिंट (${e5})`, printingAnnouncement: "प्रिंट हो रहा है" } };
1697
- function Pn(e5) {
1698
- return "function" == typeof e5 ? e5() : e5;
1699
- }
1700
- const Hn = 96 / 25.4, zn = { DINA4: "din-a4", DINA5: "din-a5", USLetter: "us-letter", USLegal: "us-legal" };
1701
- function jn(e5) {
1702
- return Math.round(e5 * Hn);
1703
- }
1704
- const $n = /* @__PURE__ */ new Map([[zn.DINA4, { widthMm: 210, heightMm: 297, widthPx: jn(210), heightPx: jn(297) }], [zn.DINA5, { widthMm: 148, heightMm: 210, widthPx: jn(148), heightPx: jn(210) }], [zn.USLetter, { widthMm: 215.9, heightMm: 279.4, widthPx: jn(215.9), heightPx: jn(279.4) }], [zn.USLegal, { widthMm: 215.9, heightMm: 355.6, widthPx: jn(215.9), heightPx: jn(355.6) }]]), Kn = /* @__PURE__ */ new Map([[zn.DINA4, "A4"], [zn.DINA5, "A5"], [zn.USLetter, "letter"], [zn.USLegal, "legal"]]);
1705
- function Fn(e5) {
1706
- const t3 = $n.get(e5);
1707
- if (!t3) throw new Error(`Unknown paper size: ${e5}`);
1708
- return t3;
1709
- }
1710
- const Un = 48, Wn = 56, Vn = 24;
1711
- function Gn(e5) {
1712
- return Object.values(zn).includes(e5);
1713
- }
1714
- function qn(e5) {
1715
- const t3 = Kn.get(e5);
1716
- if (!t3) throw new Error(`Unknown paper size: ${e5}`);
1717
- return t3;
1718
- }
1719
- const Jn = new tt("print"), Qn = new et("print:before"), Xn = new et("print:after"), Yn = { print() {
1720
- }, toHTML: () => "" };
1721
- class Zn {
1722
- id = "print";
1723
- name = "Print";
1724
- config;
1725
- service = null;
1726
- locale;
1727
- constructor(e5) {
1728
- this.config = e5 ?? {};
1729
- }
1730
- init(e5) {
1731
- this.locale = nt(Dn, e5, this.config.locale);
1732
- const t3 = e5.getContainer(), n3 = t3.getRootNode();
1733
- if (n3 instanceof ShadowRoot) {
1734
- const s4 = n3.host, r5 = e5.getEventBus();
1735
- this.service = /* @__PURE__ */ (function(e6, t4, n4, s5) {
1736
- function r6(e7) {
1737
- return e7 ?? {};
1738
- }
1739
- function i10(r7) {
1740
- const i11 = { options: r7, cancelled: false };
1741
- if (s5.emit(Qn, i11), i11.cancelled) return null;
1742
- const o3 = i11.options, a22 = (function(e7, t5, n5, s6 = "en") {
1743
- return ["<!DOCTYPE html>", `<html lang="${s6}">`, "<head>", '<meta charset="utf-8">', `<title>${n5.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</title>`, `<style>${e7}</style>`, "</head>", `<body>${t5}</body>`, "</html>"].join("\n");
1744
- })((function(e7, t5, n5) {
1745
- const s6 = [], r8 = (function(e8) {
1746
- const t6 = [];
1747
- for (const n6 of e8.adoptedStyleSheets) for (const e9 of n6.cssRules) t6.push(e9.cssText);
1748
- return t6.join("\n");
1749
- })(e7);
1750
- r8 && s6.push(r8);
1751
- const i12 = (function(e8) {
1752
- const t6 = getComputedStyle(e8), n6 = [];
1753
- for (let e9 = 0; e9 < t6.length; e9++) {
1754
- const s7 = t6[e9] ?? "";
1755
- if (s7.startsWith("--notectl-")) {
1756
- const e10 = t6.getPropertyValue(s7).trim();
1757
- e10 && n6.push(` ${s7}: ${e10};`);
1758
- }
1759
- }
1760
- return 0 === n6.length ? "" : `:root {
1761
- ${n6.join("\n")}
1762
- }`;
1763
- })(t5);
1764
- i12 && s6.push(i12), n5.paperSize && s6.push((function(e8) {
1765
- const t6 = getComputedStyle(e8), n6 = ["font-family", "font-size", "font-weight", "line-height", "letter-spacing", "word-spacing", "color"], s7 = [" margin: 0;"];
1766
- for (const e9 of n6) {
1767
- const n7 = t6.getPropertyValue(e9).trim();
1768
- n7 && s7.push(` ${e9}: ${n7};`);
1769
- }
1770
- return `body {
1771
- ${s7.join("\n")}
1772
- }`;
1773
- })(t5));
1774
- const o4 = (function(e8) {
1775
- const t6 = [], n6 = [];
1776
- if (e8.margin ? n6.push(` margin: ${e8.margin};`) : e8.paperSize && n6.push(" margin: 0;"), e8.paperSize || e8.orientation) {
1777
- const t7 = [e8.paperSize ? qn(e8.paperSize) : "A4"];
1778
- e8.orientation && t7.push(e8.orientation), n6.push(` size: ${t7.join(" ")};`);
1779
- }
1780
- n6.length > 0 && t6.push(`@page {
1781
- ${n6.join("\n")}
1782
- }`), e8.paperSize && t6.push(".notectl-content { padding: 48px 56px !important; }");
1783
- const s7 = [];
1784
- return s7.push("[data-notectl-no-print] { display: none !important; }"), s7.push(".notectl-code-block { white-space: pre-wrap !important; word-break: break-all !important; page-break-inside: avoid; }"), s7.push("img { page-break-inside: avoid; }"), s7.push(".notectl-table { break-inside: avoid; }"), false !== e8.printBackground && s7.push("* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }"), t6.push(`@media print {
1785
- ${s7.join("\n ")}
1786
- }`), t6.join("\n\n");
1787
- })(n5);
1788
- return o4 && s6.push(o4), n5.customCSS && s6.push(n5.customCSS), s6.join("\n\n");
1789
- })(e6, t4, o3), (function(e7, t5) {
1790
- const n5 = (function(e8) {
1791
- return (e8.querySelector(".notectl-content") ?? e8).cloneNode(true);
1792
- })(e7);
1793
- return (function(e8) {
1794
- e8.removeAttribute("contenteditable");
1795
- const t6 = ["notectl-node-selected", "notectl-content--empty"];
1796
- for (const n6 of t6) {
1797
- e8.classList.remove(n6);
1798
- for (const t7 of e8.querySelectorAll(`.${n6}`)) t7.classList.remove(n6);
1799
- }
1800
- e8.removeAttribute("data-placeholder");
1801
- })(n5), (function(e8, t6) {
1802
- if (t6.excludeBlockTypes) for (const n6 of t6.excludeBlockTypes) {
1803
- const t7 = e8.querySelectorAll(`[data-block-type="${n6}"]`);
1804
- for (const e9 of t7) e9.remove();
1805
- }
1806
- if (t6.pageBreakBefore) for (const n6 of t6.pageBreakBefore) {
1807
- const t7 = e8.querySelectorAll(`[data-block-type="${n6}"]`);
1808
- for (const e9 of t7) Lt(e9, { breakBefore: "page", pageBreakBefore: "always" });
1809
- }
1810
- })(n5, t5), (function(e8, t6) {
1811
- if (t6.header) {
1812
- const n6 = document.createElement("div");
1813
- n6.className = "notectl-print-header", n6.innerHTML = Pn(t6.header), e8.insertBefore(n6, e8.firstChild);
1814
- }
1815
- if (t6.footer) {
1816
- const n6 = document.createElement("div");
1817
- n6.className = "notectl-print-footer", n6.innerHTML = Pn(t6.footer), e8.appendChild(n6);
1818
- }
1819
- })(n5, t5), n5;
1820
- })(n4, o3).outerHTML, o3.title ?? "", t4.closest("[lang]")?.getAttribute("lang") ?? (document.documentElement.lang || "en")), c11 = { html: a22 };
1821
- return s5.emit(Xn, c11), a22;
1822
- }
1823
- return { print(e7) {
1824
- const t5 = i10(r6(e7));
1825
- if (!t5) return;
1826
- const n5 = document.createElement("iframe");
1827
- n5.style.cssText = "position:fixed;left:-9999px;width:0;height:0;border:none;", document.body.appendChild(n5);
1828
- const s6 = n5.contentDocument;
1829
- if (!s6) return void document.body.removeChild(n5);
1830
- s6.open(), s6.write(t5), s6.close();
1831
- const o3 = () => {
1832
- n5.remove();
1833
- };
1834
- n5.contentWindow ? (n5.contentWindow.addEventListener("afterprint", o3, { once: true }), n5.contentWindow.print()) : o3();
1835
- }, toHTML: (e7) => i10(r6(e7)) ?? "" };
1836
- })(n3, s4, t3, r5);
1837
- } else this.service = Yn;
1838
- e5.registerService(Jn, this.service);
1839
- const s3 = this.config.defaults ?? {}, r4 = this.service, i9 = this.locale;
1840
- e5.registerCommand("print", () => (e5.announce(i9.printingAnnouncement), r4.print(s3), true));
1841
- const o2 = this.config.keyBinding ?? "Mod-P";
1842
- if (e5.registerKeymap({ [o2]: () => (e5.executeCommand("print"), true) }), false !== this.config.showToolbarItem) {
1843
- const t4 = ut(o2);
1844
- e5.registerToolbarItem({ id: "print", group: "actions", label: this.locale.label, tooltip: this.locale.tooltip(t4), icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>', command: "print", priority: 900 });
1845
- }
1846
- }
1847
- destroy() {
1848
- this.service = null;
1849
- }
1850
- }
1851
- const es = { Light: "light", Dark: "dark", System: "system" }, ts = { name: "light", primitives: { background: "#ffffff", foreground: "#1a1a1a", mutedForeground: "#666666", border: "#d0d0d0", borderFocus: "#4a90d9", primary: "#4a90d9", primaryForeground: "#1a5fa0", primaryMuted: "#d0e0f0", surfaceRaised: "#f8f8f8", surfaceOverlay: "#ffffff", hoverBackground: "#e8e8e8", activeBackground: "#d0e0f0", danger: "#dc2626", dangerMuted: "#fee2e2", success: "#1a8c1a", shadow: "rgba(0, 0, 0, 0.15)", focusRing: "rgba(74, 144, 217, 0.2)" }, codeBlock: { background: "#f8fafc", foreground: "#334155", headerBackground: "#f1f5f9", headerForeground: "#64748b", headerBorder: "#e2e8f0" }, tooltip: { background: "#1a1a1a", foreground: "#ffffff" } }, ns = { name: "dark", primitives: { background: "#1e1e2e", foreground: "#cdd6f4", mutedForeground: "#7f849c", border: "#45475a", borderFocus: "#89b4fa", primary: "#89b4fa", primaryForeground: "#89b4fa", primaryMuted: "rgba(137, 180, 250, 0.15)", surfaceRaised: "#313244", surfaceOverlay: "#313244", hoverBackground: "#45475a", activeBackground: "rgba(137, 180, 250, 0.15)", danger: "#f38ba8", dangerMuted: "rgba(243, 139, 168, 0.15)", success: "#a6e3a1", shadow: "rgba(0, 0, 0, 0.4)", focusRing: "rgba(137, 180, 250, 0.25)" }, codeBlock: { background: "#11111b", foreground: "#cdd6f4", headerBackground: "#181825", headerForeground: "#7f849c", headerBorder: "rgba(205, 214, 244, 0.08)" }, tooltip: { background: "#585b70", foreground: "#cdd6f4" } };
1852
- function ss(e5, t3) {
1853
- return { name: t3.name, primitives: { ...e5.primitives, ...t3.primitives }, toolbar: t3.toolbar ? { ...e5.toolbar, ...t3.toolbar } : e5.toolbar, codeBlock: t3.codeBlock ? { ...e5.codeBlock, ...t3.codeBlock } : e5.codeBlock, tooltip: t3.tooltip ? { ...e5.tooltip, ...t3.tooltip } : e5.tooltip };
1854
- }
1855
- function rs(e5) {
1856
- if ("object" == typeof e5) return e5;
1857
- switch (e5) {
1858
- case es.Light:
1859
- return ts;
1860
- case es.Dark:
1861
- return ns;
1862
- default:
1863
- return ts;
1864
- }
1865
- }
1866
- const is = [["primitives.background", "--notectl-bg"], ["primitives.foreground", "--notectl-fg"], ["primitives.mutedForeground", "--notectl-fg-muted"], ["primitives.border", "--notectl-border"], ["primitives.borderFocus", "--notectl-border-focus"], ["primitives.primary", "--notectl-primary"], ["primitives.primaryForeground", "--notectl-primary-fg"], ["primitives.primaryMuted", "--notectl-primary-muted"], ["primitives.surfaceRaised", "--notectl-surface-raised"], ["primitives.surfaceOverlay", "--notectl-surface-overlay"], ["primitives.hoverBackground", "--notectl-hover-bg"], ["primitives.activeBackground", "--notectl-active-bg"], ["primitives.danger", "--notectl-danger"], ["primitives.dangerMuted", "--notectl-danger-muted"], ["primitives.success", "--notectl-success"], ["primitives.shadow", "--notectl-shadow"], ["primitives.focusRing", "--notectl-focus-ring"], ["toolbar.background", "--notectl-toolbar-bg"], ["toolbar.borderColor", "--notectl-toolbar-border"], ["codeBlock.background", "--notectl-code-block-bg"], ["codeBlock.foreground", "--notectl-code-block-color"], ["codeBlock.headerBackground", "--notectl-code-block-header-bg"], ["codeBlock.headerForeground", "--notectl-code-block-header-color"], ["codeBlock.headerBorder", "--notectl-code-block-header-border"], ["tooltip.background", "--notectl-tooltip-bg"], ["tooltip.foreground", "--notectl-tooltip-fg"]], os = /* @__PURE__ */ new Map([["--notectl-toolbar-bg", "var(--notectl-surface-raised)"], ["--notectl-toolbar-border", "var(--notectl-border)"], ["--notectl-code-block-bg", "var(--notectl-surface-raised)"], ["--notectl-code-block-color", "var(--notectl-fg)"], ["--notectl-code-block-header-bg", "var(--notectl-surface-raised)"], ["--notectl-code-block-header-color", "var(--notectl-fg-muted)"], ["--notectl-code-block-header-border", "var(--notectl-border)"], ["--notectl-tooltip-bg", "var(--notectl-fg)"], ["--notectl-tooltip-fg", "var(--notectl-bg)"]]);
1867
- function as(e5, t3) {
1868
- const n3 = t3.split(".");
1869
- let s3 = e5;
1870
- for (const e6 of n3) {
1871
- if (null == s3) return;
1872
- if ("object" != typeof s3) return;
1873
- s3 = s3[e6];
1874
- }
1875
- return "string" == typeof s3 ? s3 : void 0;
1876
- }
1877
- function cs(e5) {
1878
- const t3 = [":host {"];
1879
- for (const [n3, s3] of is) {
1880
- const r4 = as(e5, n3);
1881
- if (void 0 !== r4) t3.push(` ${s3}: ${r4};`);
1882
- else {
1883
- const e6 = os.get(s3);
1884
- e6 && t3.push(` ${s3}: ${e6};`);
1885
- }
1886
- }
1887
- return t3.push("}"), t3.join("\n");
1888
- }
1889
- function ls(e5) {
1890
- const t3 = new CSSStyleSheet();
1891
- return t3.replaceSync(cs(e5)), t3;
1892
- }
1893
- const hs = { EN: "en", DE: "de", ES: "es", FR: "fr", ZH: "zh", RU: "ru", AR: "ar", HI: "hi", BROWSER: "browser" };
1894
- function ds(e5) {
1895
- let t3 = 2166136261;
1896
- for (let n3 = 0; n3 < e5.length; n3++) t3 ^= e5.charCodeAt(n3), t3 = Math.imul(t3, 16777619);
1897
- return (t3 >>> 0).toString(36).padStart(6, "0");
1898
- }
1899
- class us {
1900
- classMap = /* @__PURE__ */ new Map();
1901
- usedHashes = /* @__PURE__ */ new Set();
1902
- getClassName(e5) {
1903
- const t3 = (function(e6) {
1904
- return e6.split(";").map((e7) => e7.trim()).filter((e7) => e7.length > 0).sort().join("; ");
1905
- })(e5), n3 = this.classMap.get(t3);
1906
- if (n3) return n3;
1907
- let s3 = ds(t3), r4 = 0;
1908
- for (; this.usedHashes.has(s3); ) r4++, s3 = ds(t3 + String(r4));
1909
- const i9 = `notectl-s-${s3}`;
1910
- return this.usedHashes.add(s3), this.classMap.set(t3, i9), i9;
1911
- }
1912
- getAlignmentClassName(e5) {
1913
- const t3 = `text-align: ${e5}`, n3 = this.classMap.get(t3);
1914
- if (n3) return n3;
1915
- const s3 = `notectl-align-${e5}`;
1916
- return this.classMap.set(t3, s3), s3;
1917
- }
1918
- toCSS() {
1919
- if (0 === this.classMap.size) return "";
1920
- const e5 = [];
1921
- for (const [t3, n3] of this.classMap) e5.push(`.${n3} { ${t3}; }`);
1922
- return e5.join("\n");
1923
- }
1924
- toStyleMap() {
1925
- const e5 = /* @__PURE__ */ new Map();
1926
- for (const [t3, n3] of this.classMap) e5.set(n3, t3);
1927
- return e5;
1928
- }
1929
- }
1930
- const ps = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]);
1931
- function fs(e5, t3) {
1932
- const n3 = { registry: t3, exportCtx: { styleAttr: (e6) => e6 ? ` style="${e6}"` : "" } }, s3 = ms(e5.children, n3), r4 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], i9 = t3 ? t3.getAllowedAttrs() : ["style"];
1933
- return Dt.sanitize(s3, { ALLOWED_TAGS: r4, ALLOWED_ATTR: i9 });
1934
- }
1935
- function gs(e5, t3) {
1936
- const n3 = new us(), s3 = /* @__PURE__ */ (function(e6) {
1937
- return { styleAttr: (t4) => t4 ? ` class="${e6.getClassName(t4)}"` : "" };
1938
- })(n3), r4 = { registry: t3, collector: n3, exportCtx: s3 }, i9 = ms(e5.children, r4), o2 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], a22 = t3 ? t3.getAllowedAttrs() : ["style", "class"];
1939
- a22.includes("class") || a22.push("class");
1940
- const c11 = a22.filter((e6) => "style" !== e6);
1941
- return { html: Dt.sanitize(i9, { ALLOWED_TAGS: o2, ALLOWED_ATTR: c11 }), css: n3.toCSS(), styleMap: n3.toStyleMap() };
1942
- }
1943
- function ms(e5, t3) {
1944
- const n3 = [];
1945
- let s3 = 0;
1946
- for (; s3 < e5.length; ) {
1947
- const r4 = e5[s3];
1948
- if (r4) if (Se(r4, "list_item")) {
1949
- const r5 = [];
1950
- for (; s3 < e5.length; ) {
1951
- const t4 = e5[s3];
1952
- if (!t4 || !Se(t4, "list_item")) break;
1953
- r5.push(t4), s3++;
1954
- }
1955
- n3.push(ys(r5, t3));
1956
- } else n3.push(bs(r4, t3)), s3++;
1957
- else s3++;
1958
- }
1959
- return n3.join("");
1960
- }
1961
- function ys(e5, t3) {
1962
- const n3 = [], s3 = [];
1963
- for (let r4 = 0; r4 < e5.length; r4++) {
1964
- const i9 = e5[r4];
1965
- if (!i9) continue;
1966
- const o2 = i9.attrs?.listType ?? "bullet", a22 = i9.attrs?.indent ?? 0, c11 = "ordered" === o2 ? "ol" : "ul";
1967
- for (; s3.length > 0; ) {
1968
- const e6 = s3[s3.length - 1];
1969
- if (!e6) break;
1970
- if (e6.indent > a22) n3.push(`</${e6.tag}></li>`), s3.pop();
1971
- else {
1972
- if (e6.indent !== a22 || e6.tag === c11) break;
1973
- n3.push(`</${e6.tag}></li>`), s3.pop();
1974
- }
1975
- }
1976
- if (0 === s3.length) n3.push(`<${c11}>`), s3.push({ tag: c11, indent: a22 });
1977
- else {
1978
- const e6 = s3[s3.length - 1];
1979
- e6 && a22 > e6.indent && (n3.push(`<${c11}>`), s3.push({ tag: c11, indent: a22 }));
1980
- }
1981
- const l3 = bs(i9, t3), h4 = e5[r4 + 1], d5 = h4 ? h4.attrs?.indent ?? 0 : void 0;
1982
- void 0 !== d5 && d5 > a22 ? n3.push(ks(l3)) : n3.push(l3);
1983
- }
1984
- for (; s3.length > 0; ) {
1985
- const e6 = s3.pop();
1986
- if (!e6) break;
1987
- n3.push(`</${e6.tag}>`), s3.length > 0 && n3.push("</li>");
1988
- }
1989
- return n3.join("");
1990
- }
1991
- function ks(e5) {
1992
- return e5.endsWith("</li>") ? e5.slice(0, -5) : e5;
1993
- }
1994
- function bs(e5, t3) {
1995
- const n3 = V(e5) ? (function(e6, t4) {
1996
- const n4 = (function(e7) {
1997
- if (e7.length <= 1) return e7;
1998
- const t5 = [];
1999
- for (const n5 of e7) {
2000
- if (C(n5)) {
2001
- t5.push(n5);
2002
- continue;
2003
- }
2004
- const e8 = t5[t5.length - 1];
2005
- e8 && R(e8) && Q(e8.marks, n5.marks) ? t5[t5.length - 1] = { type: "text", text: e8.text + n5.text, marks: e8.marks } : t5.push(n5);
2006
- }
2007
- return t5;
2008
- })(I(e6)), s4 = [], r5 = t4.registry ? pn(t4.registry) : void 0;
2009
- for (const e7 of n4) if (C(e7)) {
2010
- const n5 = t4.registry?.getInlineNodeSpec(e7.inlineType);
2011
- n5?.toHTMLString && s4.push(n5.toHTMLString(e7));
2012
- } else t4.registry && t4.collector ? s4.push(gn(e7.text, e7.marks, t4.registry, t4.collector, r5)) : t4.registry ? s4.push(fn(e7.text, e7.marks, t4.registry, r5)) : "" !== e7.text && s4.push(Ee(e7.text));
2013
- return s4.join("");
2014
- })(e5, t3) : ms(J(e5), t3), s3 = t3.registry?.getNodeSpec(e5.type);
2015
- let r4;
2016
- r4 = s3?.toHTML ? s3.toHTML(e5, n3, t3.exportCtx) : `<p>${n3 || "<br>"}</p>`;
2017
- const i9 = e5.attrs?.align;
2018
- if (i9 && "left" !== i9 && ps.has(i9)) if (t3.collector) {
2019
- const e6 = t3.collector.getAlignmentClassName(i9), n4 = r4.indexOf(">"), s4 = r4.slice(0, n4 + 1).match(/class="([^"]*)"/);
2020
- r4 = s4 ? r4.replace(`class="${s4[1]}"`, `class="${s4[1]} ${e6}"`) : r4.replace(/>/, ` class="${e6}">`);
2021
- } else {
2022
- const e6 = r4.indexOf(">"), t4 = r4.slice(0, e6 + 1).match(/style="([^"]*)"/), n4 = t4?.[1];
2023
- void 0 !== n4 ? /text-align:/.test(n4) || (r4 = r4.replace(`style="${n4}"`, `style="${n4}; text-align: ${i9}"`)) : r4 = r4.replace(/>/, ` style="text-align: ${i9}">`);
2024
- }
2025
- return r4;
2026
- }
2027
- function vs(e5, t3, n3) {
2028
- const s3 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], r4 = t3 ? t3.getAllowedAttrs() : ["style"];
2029
- n3?.styleMap && !r4.includes("class") && r4.push("class");
2030
- const i9 = document.createElement("template");
2031
- i9.innerHTML = Dt.sanitize(e5, { ALLOWED_TAGS: s3, ALLOWED_ATTR: r4 });
2032
- const o2 = i9.content;
2033
- n3?.styleMap && (function(e6, t4) {
2034
- const n4 = e6.querySelectorAll("[class]");
2035
- for (const e7 of Array.from(n4)) {
2036
- const n5 = e7, s4 = Array.from(n5.classList), r5 = [];
2037
- for (const e8 of s4) {
2038
- const s5 = t4.get(e8);
2039
- if (s5) {
2040
- const t5 = n5.getAttribute("style") ?? "", i10 = t5 && !t5.endsWith(";") ? "; " : "";
2041
- n5.setAttribute("style", t5 + i10 + s5), r5.push(e8);
2042
- }
2043
- }
2044
- for (const e8 of r5) n5.classList.remove(e8);
2045
- }
2046
- })(o2, n3.styleMap);
2047
- const a22 = t3?.getBlockParseRules() ?? [], c11 = [];
2048
- for (const e6 of Array.from(o2.childNodes)) if (e6.nodeType === Node.ELEMENT_NODE) {
2049
- const n4 = e6, s4 = n4.tagName.toLowerCase();
2050
- if ("ul" === s4 || "ol" === s4) {
2051
- Ss(n4, "ol" === s4 ? "ordered" : "bullet", 0, c11, t3);
2052
- continue;
2053
- }
2054
- const r5 = Cs(n4, a22);
2055
- if (r5) {
2056
- const e7 = ws(n4, t3), s5 = { ...r5.attrs };
2057
- xs(n4, s5), c11.push(_(ke(r5.type), e7, void 0, Object.keys(s5).length > 0 ? s5 : void 0));
2058
- continue;
2059
- }
2060
- const i10 = ws(n4, t3), o3 = {};
2061
- xs(n4, o3), c11.push(_(ke("paragraph"), i10, void 0, Object.keys(o3).length > 0 ? o3 : void 0));
2062
- } else e6.nodeType === Node.TEXT_NODE && e6.textContent?.trim() && c11.push(_(ke("paragraph"), [T(e6.textContent.trim())]));
2063
- return 0 === c11.length ? W() : W(c11);
2064
- }
2065
- function Ss(e5, t3, n3, s3, r4) {
2066
- for (const i9 of Array.from(e5.children)) {
2067
- const e6 = i9.tagName.toLowerCase();
2068
- if ("li" === e6) {
2069
- const e7 = i9, o2 = e7.querySelector(':scope > input[type="checkbox"]'), a22 = null !== o2, c11 = o2?.hasAttribute("checked") ?? false, l3 = a22 ? "checklist" : t3, h4 = ws(e7, r4, true), d5 = { listType: l3, indent: n3, checked: c11 };
2070
- s3.push(_(ke("list_item"), h4, void 0, d5));
2071
- for (const t4 of Array.from(e7.children)) {
2072
- const e8 = t4.tagName.toLowerCase();
2073
- "ul" !== e8 && "ol" !== e8 || Ss(t4, "ol" === e8 ? "ordered" : "bullet", n3 + 1, s3, r4);
2074
- }
2075
- } else "ul" !== e6 && "ol" !== e6 || Ss(i9, "ol" === e6 ? "ordered" : "bullet", n3 + 1, s3, r4);
2076
- }
2077
- }
2078
- function ws(e5, t3, n3) {
2079
- const s3 = [];
2080
- return Es(e5, [], s3, t3?.getMarkParseRules() ?? [], t3?.getInlineParseRules() ?? [], n3), s3.length > 0 ? s3 : [T("")];
2081
- }
2082
- function Es(e5, t3, n3, s3, r4, i9) {
2083
- if (e5.nodeType === Node.TEXT_NODE) {
2084
- const s4 = e5.textContent ?? "";
2085
- return void (s4 && n3.push(T(s4, [...t3])));
2086
- }
2087
- if (e5.nodeType !== Node.ELEMENT_NODE) return;
2088
- const o2 = e5, a22 = o2.tagName.toLowerCase();
2089
- if (i9 && ("ul" === a22 || "ol" === a22)) return;
2090
- if (i9 && "input" === a22 && "checkbox" === o2.getAttribute("type")) return;
2091
- for (const e6 of r4) if (e6.rule.tag === a22) {
2092
- if (e6.rule.getAttrs) {
2093
- const t4 = e6.rule.getAttrs(o2);
2094
- if (false === t4) continue;
2095
- return void n3.push(X(be(e6.type), t4));
2096
- }
2097
- return void n3.push(X(be(e6.type)));
2098
- }
2099
- const c11 = [...t3], l3 = /* @__PURE__ */ new Set();
2100
- for (const e6 of s3) if (e6.rule.tag === a22 && !l3.has(e6.type)) if (e6.rule.getAttrs) {
2101
- const t4 = e6.rule.getAttrs(o2);
2102
- if (false === t4) continue;
2103
- c11.some((t5) => t5.type === e6.type) || (c11.push({ type: ve(e6.type), ...Object.keys(t4).length > 0 ? { attrs: t4 } : {} }), l3.add(e6.type));
2104
- } else c11.some((t4) => t4.type === e6.type) || (c11.push({ type: ve(e6.type) }), l3.add(e6.type));
2105
- for (const e6 of Array.from(o2.childNodes)) Es(e6, c11, n3, s3, r4, i9);
2106
- }
2107
- function xs(e5, t3) {
2108
- const n3 = e5.style?.textAlign ?? "";
2109
- if (n3 && ps.has(n3)) t3.align = n3;
2110
- else for (const n4 of Array.from(e5.classList)) {
2111
- const e6 = n4.match(/^notectl-align-(\w+)$/), s3 = e6?.[1];
2112
- if (s3 && ps.has(s3)) return void (t3.align = s3);
2113
- }
2114
- }
2115
- function Cs(e5, t3) {
2116
- const n3 = e5.tagName.toLowerCase();
2117
- for (const s3 of t3) if (s3.rule.tag === n3) {
2118
- if (s3.rule.getAttrs) {
2119
- const t4 = s3.rule.getAttrs(e5);
2120
- if (false === t4) continue;
2121
- return { type: s3.type, attrs: t4 };
2122
- }
2123
- return { type: s3.type };
2124
- }
2125
- return null;
2126
- }
2127
- function Ts(e5, t3) {
2128
- const n3 = t3?.document ?? globalThis.document, s3 = t3?.container ?? n3.head;
2129
- if (t3?.id) {
2130
- const s4 = n3.getElementById(t3.id);
2131
- if (s4 instanceof HTMLStyleElement) return s4.textContent = e5, t3.nonce && s4.setAttribute("nonce", t3.nonce), s4;
2132
- }
2133
- const r4 = n3.createElement("style");
2134
- return r4.textContent = e5, t3?.id && (r4.id = t3.id), t3?.nonce && r4.setAttribute("nonce", t3.nonce), s3.appendChild(r4), r4;
2135
- }
2136
- function As(e5, t3) {
2137
- const n3 = (t3 ?? globalThis.document).getElementById(e5);
2138
- n3 && n3.remove();
2139
- }
2140
- const Rs = /* @__PURE__ */ new WeakSet();
2141
- function Ls(e5, t3) {
2142
- const n3 = t3?.target ?? globalThis.document, s3 = new CSSStyleSheet();
2143
- return s3.replaceSync(e5), Rs.add(s3), t3?.replace && (n3.adoptedStyleSheets = n3.adoptedStyleSheets.filter((e6) => !Rs.has(e6))), n3.adoptedStyleSheets = [...n3.adoptedStyleSheets, s3], s3;
2144
- }
2145
- function Ms(e5, t3) {
2146
- const n3 = t3 ?? globalThis.document;
2147
- n3.adoptedStyleSheets = n3.adoptedStyleSheets.filter((t4) => t4 !== e5);
2148
- }
2149
- class Is {
2150
- constructor(e5, t3) {
2151
- this.element = e5, this.getState = t3.getState, this.dispatch = t3.dispatch, this.syncSelection = t3.syncSelection, this.inputRuleRegistry = t3.inputRuleRegistry, this.isReadOnly = t3.isReadOnly ?? (() => false), this.compositionTracker = t3.compositionTracker ?? new kn(), this.handleBeforeInput = this.onBeforeInput.bind(this), this.handleCompositionStart = this.onCompositionStart.bind(this), this.handleCompositionEnd = this.onCompositionEnd.bind(this), e5.addEventListener("beforeinput", this.handleBeforeInput), e5.addEventListener("compositionstart", this.handleCompositionStart), e5.addEventListener("compositionend", this.handleCompositionEnd);
2152
- }
2153
- getState;
2154
- dispatch;
2155
- syncSelection;
2156
- inputRuleRegistry;
2157
- isReadOnly;
2158
- compositionTracker;
2159
- handleBeforeInput;
2160
- handleCompositionStart;
2161
- handleCompositionEnd;
2162
- onBeforeInput(e5) {
2163
- if (this.isReadOnly()) return;
2164
- if (this.compositionTracker.isComposing && "insertCompositionText" === e5.inputType) return;
2165
- e5.preventDefault(), "insertText" !== e5.inputType && "insertCompositionText" !== e5.inputType && this.syncSelection();
2166
- const t3 = this.getState();
2167
- let n3 = null;
2168
- switch (e5.inputType) {
2169
- case "insertText":
2170
- e5.data && (n3 = qe(t3, e5.data, "input"));
2171
- break;
2172
- case "insertParagraph":
2173
- n3 = We(t3);
2174
- break;
2175
- case "insertLineBreak":
2176
- n3 = Je(t3);
2177
- break;
2178
- case "deleteContentBackward":
2179
- case "deleteByCut":
2180
- n3 = ln(t3);
2181
- break;
2182
- case "deleteContentForward":
2183
- n3 = hn(t3);
2184
- break;
2185
- case "deleteWordBackward":
2186
- n3 = (function(e6) {
2187
- return cn(e6, { merge: Ke, range: (e7, t4) => t4 > 0 ? [ee(e7, t4), t4] : null });
2188
- })(t3);
2189
- break;
2190
- case "deleteWordForward":
2191
- n3 = (function(e6) {
2192
- return cn(e6, { merge: $e, range: (e7, t4) => t4 < O(e7) ? [t4, Z(e7, t4)] : null });
2193
- })(t3);
2194
- break;
2195
- case "deleteSoftLineBackward":
2196
- n3 = (function(e6) {
2197
- return cn(e6, { merge: Ke, range: (e7, t4) => t4 > 0 ? [0, t4] : null });
2198
- })(t3);
2199
- break;
2200
- case "deleteSoftLineForward":
2201
- n3 = (function(e6) {
2202
- return cn(e6, { merge: $e, range: (e7, t4) => {
2203
- const n4 = O(e7);
2204
- return t4 < n4 ? [t4, n4] : null;
2205
- } });
2206
- })(t3);
2207
- }
2208
- n3 && (this.dispatch(n3), "insertText" === e5.inputType && this.checkInputRules());
2209
- }
2210
- onCompositionStart(e5) {
2211
- const t3 = this.getState();
2212
- ie(t3.selection) || oe(t3.selection) || this.compositionTracker.start(t3.selection.anchor.blockId);
2213
- }
2214
- onCompositionEnd(e5) {
2215
- if (this.compositionTracker.end(), this.isReadOnly()) return;
2216
- const t3 = e5.data;
2217
- if (!t3) return;
2218
- const n3 = this.getState(), s3 = qe(n3, t3, "input");
2219
- this.dispatch(s3);
2220
- }
2221
- checkInputRules() {
2222
- if (!this.inputRuleRegistry) return;
2223
- const e5 = this.inputRuleRegistry.getInputRules();
2224
- if (0 === e5.length) return;
2225
- const t3 = this.getState();
2226
- if (ie(t3.selection) || oe(t3.selection)) return;
2227
- const { anchor: n3 } = t3.selection, s3 = t3.getBlock(n3.blockId);
2228
- if (!s3) return;
2229
- const r4 = $(s3).slice(0, n3.offset);
2230
- for (const n4 of e5) {
2231
- const e6 = n4.pattern.exec(r4);
2232
- if (e6) {
2233
- const s4 = e6.index, r5 = s4 + e6[0].length, i9 = n4.handler(t3, e6, s4, r5);
2234
- if (i9) return void this.dispatch(i9);
2235
- }
2236
- }
2237
- }
2238
- destroy() {
2239
- this.element.removeEventListener("beforeinput", this.handleBeforeInput), this.element.removeEventListener("compositionstart", this.handleCompositionStart), this.element.removeEventListener("compositionend", this.handleCompositionEnd);
2240
- }
2241
- }
2242
- function Ns(e5) {
2243
- return e5.reduce((e6, t3) => e6 + t3.text, "");
2244
- }
2245
- function Bs(e5) {
2246
- return e5.reduce((e6, t3) => e6 + t3.text.length, 0);
2247
- }
2248
- function Os(e5, t3) {
2249
- const n3 = Ae(e5.doc, t3.blockId);
2250
- if (!n3) return null;
2251
- const s3 = n3.length > 1 ? n3.slice(0, -1) : [], r4 = (0 === s3.length ? e5.doc.children : (() => {
2252
- const t4 = e5.getBlock(s3[s3.length - 1]);
2253
- return t4 ? t4.children : [];
2254
- })()).findIndex((e6) => S(e6) && e6.id === t3.blockId);
2255
- if (r4 < 0) return null;
2256
- const i9 = "before" === t3.side ? r4 : r4 + 1;
2257
- return { parentPath: s3, insertIndex: i9 };
2258
- }
2259
- function _s(e5, t3, n3) {
2260
- const s3 = Os(e5, t3);
2261
- if (!s3) return e5.transaction("paste").setSelection(t3).build();
2262
- const r4 = e5.transaction("paste");
2263
- let i9, o2 = s3.insertIndex, a22 = 0;
2264
- for (const e6 of n3) {
2265
- const t4 = Y(), n4 = Ns(e6.segments), c11 = e6.segments.map((e7) => T(e7.text, [...e7.marks])), l3 = _(e6.type, c11.length > 0 ? c11 : [T("")], t4, e6.attrs);
2266
- r4.insertNode(s3.parentPath, o2, l3), o2++, i9 = t4, a22 = n4.length;
2267
- }
2268
- return i9 && r4.setSelection(re(i9, a22)), r4.build();
2269
- }
2270
- const Ds = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "BLOCKQUOTE", "UL", "OL", "LI", "HR", "PRE", "TABLE", "THEAD", "TBODY", "TR"]), Ps = /* @__PURE__ */ new Set(["STRONG", "B", "EM", "I", "U", "S", "STRIKE", "DEL", "A", "SPAN", "BR", "SUB", "SUP", "CODE"]);
2271
- class Hs {
2272
- schema;
2273
- blockParseRules;
2274
- markParseRules;
2275
- constructor(e5) {
2276
- this.schema = e5.schema, this.blockParseRules = e5.schemaRegistry?.getBlockParseRules() ?? [], this.markParseRules = e5.schemaRegistry?.getMarkParseRules() ?? [];
2277
- }
2278
- parse(e5) {
2279
- const t3 = this.parseContainer(e5);
2280
- return 0 === t3.length ? { blocks: [{ type: this.resolveBlockType(ke("paragraph")), segments: [{ text: "", marks: [] }] }] } : { blocks: t3 };
2281
- }
2282
- parseContainer(e5) {
2283
- const t3 = [];
2284
- let n3 = [];
2285
- for (const s3 of Array.from(e5.childNodes)) if (s3.nodeType === Node.ELEMENT_NODE) {
2286
- const e6 = s3;
2287
- this.isBlockElement(e6) ? (this.flushPendingSegments(t3, n3), n3 = [], t3.push(...this.parseBlockElement(e6))) : e6.children.length > 0 && this.containsBlockDescendants(e6) ? (this.flushPendingSegments(t3, n3), n3 = [], t3.push(...this.parseContainerWithMarks(e6, this.marksFromElement(e6)))) : n3.push(...this.parseInlineNode(s3, []));
2288
- } else if (s3.nodeType === Node.TEXT_NODE) {
2289
- const e6 = s3.textContent ?? "";
2290
- e6 && n3.push({ text: e6, marks: [] });
2291
- }
2292
- return this.flushPendingSegments(t3, n3), t3;
2293
- }
2294
- parseBlockElement(e5) {
2295
- const t3 = e5.tagName, n3 = /^H([1-6])$/.exec(t3);
2296
- if (n3) {
2297
- const t4 = Number(n3[1]), s3 = this.resolveBlockType(ke("heading"));
2298
- return [{ type: s3, ...s3 === ke("heading") ? { attrs: { level: t4 } } : {}, segments: this.ensureSegments(this.parseInlineChildren(e5, [])) }];
2299
- }
2300
- switch (t3) {
2301
- case "P":
2302
- case "DIV":
2303
- return this.parseBlockWithLineBreaks(e5, this.resolveBlockType(ke("paragraph")));
2304
- case "BLOCKQUOTE":
2305
- return this.parseBlockquote(e5);
2306
- case "UL":
2307
- return this.parseList(e5, "bullet", 0);
2308
- case "OL":
2309
- return this.parseList(e5, "ordered", 0);
2310
- case "LI":
2311
- return this.parseListItem(e5, "bullet", 0);
2312
- case "HR":
2313
- return [{ type: this.resolveBlockType(ke("horizontal_rule")), segments: [] }];
2314
- case "PRE":
2315
- return [{ type: this.resolveBlockType(ke("paragraph")), segments: this.ensureSegments(this.parsePreContent(e5)) }];
2316
- case "TABLE":
2317
- case "THEAD":
2318
- case "TBODY":
2319
- case "TR":
2320
- return this.parseTableAsParagraphs(e5);
2321
- default: {
2322
- const t4 = this.matchBlockRule(e5);
2323
- return t4 ? [{ type: t4.type, ...t4.attrs ? { attrs: t4.attrs } : {}, segments: this.ensureSegments(this.parseInlineChildren(e5, [])) }] : [{ type: this.resolveBlockType(ke("paragraph")), segments: this.ensureSegments(this.parseInlineChildren(e5, [])) }];
2324
- }
2325
- }
2326
- }
2327
- parseBlockquote(e5) {
2328
- const t3 = this.resolveBlockType(ke("blockquote"));
2329
- return Array.from(e5.childNodes).some((e6) => e6.nodeType === Node.ELEMENT_NODE && this.isBlockElement(e6)) ? this.parseContainer(e5).map((e6) => ({ type: t3, segments: e6.segments })) : [{ type: t3, segments: this.ensureSegments(this.parseInlineChildren(e5, [])) }];
2330
- }
2331
- parseList(e5, t3, n3) {
2332
- const s3 = [];
2333
- for (const r4 of Array.from(e5.children)) {
2334
- const e6 = r4;
2335
- "LI" === e6.tagName ? s3.push(...this.parseListItem(e6, t3, n3)) : "UL" === e6.tagName ? s3.push(...this.parseList(e6, "bullet", n3 + 1)) : "OL" === e6.tagName && s3.push(...this.parseList(e6, "ordered", n3 + 1));
2336
- }
2337
- return s3;
2338
- }
2339
- parseListItem(e5, t3, n3) {
2340
- const s3 = [], r4 = this.resolveBlockType(ke("list_item")), i9 = this.hasCheckbox(e5), o2 = i9 ? "checklist" : t3, a22 = !!i9 && this.isCheckboxChecked(e5), c11 = [], l3 = [];
2341
- for (const t4 of Array.from(e5.childNodes)) if (t4.nodeType === Node.ELEMENT_NODE) {
2342
- const e6 = t4;
2343
- "UL" === e6.tagName || "OL" === e6.tagName ? l3.push(e6) : "INPUT" === e6.tagName && "checkbox" === e6.getAttribute("type") || (this.isBlockElement(e6) ? c11.push(...this.parseInlineChildren(e6, [])) : c11.push(...this.parseInlineNode(t4, [])));
2344
- } else if (t4.nodeType === Node.TEXT_NODE) {
2345
- const e6 = t4.textContent ?? "";
2346
- e6 && c11.push({ text: e6, marks: [] });
2347
- }
2348
- s3.push({ type: r4, attrs: { listType: o2, indent: n3, ..."checklist" === o2 ? { checked: a22 } : {} }, segments: this.ensureSegments(this.normalizeSegments(c11)) });
2349
- for (const e6 of l3) {
2350
- const t4 = "OL" === e6.tagName ? "ordered" : "bullet";
2351
- s3.push(...this.parseList(e6, t4, n3 + 1));
2352
- }
2353
- return s3;
2354
- }
2355
- parseInlineChildren(e5, t3) {
2356
- const n3 = [];
2357
- for (const s3 of Array.from(e5.childNodes)) n3.push(...this.parseInlineNode(s3, t3));
2358
- return this.normalizeSegments(n3);
2359
- }
2360
- parseInlineNode(e5, t3) {
2361
- if (e5.nodeType === Node.TEXT_NODE) {
2362
- const n4 = e5.textContent ?? "";
2363
- return n4 ? [{ text: n4, marks: this.resolveMarks(t3) }] : [];
2364
- }
2365
- if (e5.nodeType !== Node.ELEMENT_NODE) return [];
2366
- const n3 = e5, s3 = n3.tagName;
2367
- if ("BR" === s3) return [{ text: "\n", marks: this.resolveMarks(t3) }];
2368
- if (this.isBlockElement(n3) && !Ps.has(s3)) return this.parseInlineChildren(n3, t3);
2369
- const r4 = this.mergeMarks(t3, this.marksFromElement(n3));
2370
- return this.parseInlineChildren(n3, r4);
2371
- }
2372
- parsePreContent(e5) {
2373
- const t3 = e5.textContent ?? "";
2374
- return t3 ? [{ text: t3, marks: [] }] : [];
2375
- }
2376
- parseTableAsParagraphs(e5) {
2377
- const t3 = [], n3 = e5.querySelectorAll("td, th");
2378
- for (const e6 of Array.from(n3)) {
2379
- const n4 = this.parseInlineChildren(e6, []);
2380
- n4.length > 0 && n4.some((e7) => e7.text.length > 0) && t3.push({ type: this.resolveBlockType(ke("paragraph")), segments: this.ensureSegments(n4) });
2381
- }
2382
- return t3;
2383
- }
2384
- marksFromElement(e5) {
2385
- const t3 = [], n3 = e5.tagName.toLowerCase();
2386
- if (this.markParseRules.length > 0) {
2387
- const s4 = /* @__PURE__ */ new Set();
2388
- for (const r4 of this.markParseRules) if (r4.rule.tag === n3 && !s4.has(r4.type)) if (r4.rule.getAttrs) {
2389
- const n4 = r4.rule.getAttrs(e5);
2390
- if (false === n4) continue;
2391
- t3.push({ type: ve(r4.type), ...Object.keys(n4).length > 0 ? { attrs: n4 } : {} }), s4.add(r4.type);
2392
- } else t3.push({ type: ve(r4.type) }), s4.add(r4.type);
2393
- if (s4.size > 0) return t3;
2394
- }
2395
- const s3 = e5.tagName;
2396
- if ("STRONG" === s3 || "B" === s3) {
2397
- const n4 = e5.style.fontWeight, s4 = Number.parseInt(n4, 10);
2398
- "normal" === n4 || !Number.isNaN(s4) && s4 < 700 || t3.push({ type: ve("bold") });
2399
- }
2400
- if ("EM" !== s3 && "I" !== s3 || t3.push({ type: ve("italic") }), "U" === s3 && t3.push({ type: ve("underline") }), "S" !== s3 && "STRIKE" !== s3 && "DEL" !== s3 || t3.push({ type: ve("strikethrough") }), "A" === s3) {
2401
- const n4 = e5.getAttribute("href") ?? "";
2402
- t3.push({ type: ve("link"), attrs: { href: n4 } });
2403
- }
2404
- return t3;
2405
- }
2406
- mergeMarks(e5, t3) {
2407
- const n3 = [...e5];
2408
- for (const e6 of t3) n3.some((t4) => t4.type === e6.type) || n3.push(e6);
2409
- return n3;
2410
- }
2411
- resolveMarks(e5) {
2412
- return e5.filter((e6) => fe(this.schema, e6.type));
2413
- }
2414
- resolveBlockType(e5) {
2415
- return ge(this.schema, e5) ? e5 : ke("paragraph");
2416
- }
2417
- normalizeSegments(e5) {
2418
- if (0 === e5.length) return [];
2419
- const t3 = [];
2420
- for (const n3 of e5) {
2421
- const e6 = t3[t3.length - 1];
2422
- e6 && Q(e6.marks, n3.marks) ? t3[t3.length - 1] = { text: e6.text + n3.text, marks: e6.marks } : n3.text.length > 0 && t3.push(n3);
2423
- }
2424
- return t3;
2425
- }
2426
- ensureSegments(e5) {
2427
- return 0 === e5.length ? [{ text: "", marks: [] }] : e5;
2428
- }
2429
- matchBlockRule(e5) {
2430
- const t3 = e5.tagName.toLowerCase();
2431
- for (const n3 of this.blockParseRules) if (n3.rule.tag === t3) {
2432
- if (n3.rule.getAttrs) {
2433
- const t4 = n3.rule.getAttrs(e5);
2434
- if (false === t4) continue;
2435
- return { type: ke(n3.type), attrs: t4 };
2436
- }
2437
- return { type: ke(n3.type) };
2438
- }
2439
- return null;
2440
- }
2441
- isBlockElement(e5) {
2442
- if (Ds.has(e5.tagName)) return true;
2443
- const t3 = e5.tagName.toLowerCase();
2444
- return this.blockParseRules.some((e6) => e6.rule.tag === t3);
2445
- }
2446
- hasCheckbox(e5) {
2447
- return null !== e5.querySelector('input[type="checkbox"]');
2448
- }
2449
- isCheckboxChecked(e5) {
2450
- const t3 = e5.querySelector('input[type="checkbox"]');
2451
- return t3?.hasAttribute("checked") ?? false;
2452
- }
2453
- containsBlockDescendants(e5) {
2454
- for (const t3 of Array.from(e5.children)) {
2455
- if (this.isBlockElement(t3)) return true;
2456
- if (this.containsBlockDescendants(t3)) return true;
2457
- }
2458
- return false;
2459
- }
2460
- parseContainerWithMarks(e5, t3) {
2461
- const n3 = this.parseContainer(e5);
2462
- return 0 === t3.length ? n3 : n3.map((e6) => ({ ...e6, segments: this.prependMarks(e6.segments, t3) }));
2463
- }
2464
- prependMarks(e5, t3) {
2465
- return e5.map((e6) => ({ text: e6.text, marks: this.mergeMarks(t3, e6.marks) }));
2466
- }
2467
- parseBlockWithLineBreaks(e5, t3) {
2468
- const n3 = this.parseInlineChildren(e5, []);
2469
- if (!n3.some((e6) => e6.text.includes("\n"))) return [{ type: t3, segments: this.ensureSegments(n3) }];
2470
- const s3 = [];
2471
- let r4 = [];
2472
- for (const e6 of n3) {
2473
- const n4 = e6.text.split("\n");
2474
- for (let i9 = 0; i9 < n4.length; i9++) {
2475
- i9 > 0 && (s3.push({ type: t3, segments: this.ensureSegments(this.normalizeSegments(r4)) }), r4 = []);
2476
- const o2 = n4[i9] ?? "";
2477
- o2 && r4.push({ text: o2, marks: e6.marks });
2478
- }
2479
- }
2480
- return s3.push({ type: t3, segments: this.ensureSegments(this.normalizeSegments(r4)) }), s3;
2481
- }
2482
- flushPendingSegments(e5, t3) {
2483
- const n3 = this.normalizeSegments(t3);
2484
- 0 !== n3.length && (n3.every((e6) => "" === e6.text.trim()) || e5.push({ type: this.resolveBlockType(ke("paragraph")), segments: n3 }));
2485
- }
2486
- }
2487
- const zs = { 1: "x-small", 2: "small", 3: "medium", 4: "large", 5: "x-large", 6: "xx-large", 7: "xxx-large" };
2488
- function js(e5) {
2489
- return e5.toLowerCase().includes("font-size");
2490
- }
2491
- function $s(e5, t3) {
2492
- for (; e5.firstChild; ) t3.appendChild(e5.firstChild);
2493
- }
2494
- function Ks(e5) {
2495
- const t3 = e5.parentNode;
2496
- if (t3) {
2497
- for (; e5.firstChild; ) t3.insertBefore(e5.firstChild, e5);
2498
- t3.removeChild(e5);
2499
- }
2500
- }
2501
- function Fs(e5, t3) {
2502
- if (!t3) return;
2503
- const n3 = {};
2504
- let s3 = false;
2505
- for (const r4 of Object.keys(t3)) {
2506
- const i9 = t3[r4], o2 = e5?.[r4];
2507
- "string" == typeof o2 || "number" == typeof o2 || "boolean" == typeof o2 ? n3[r4] = o2 : void 0 !== i9.default && (n3[r4] = i9.default), r4 in n3 && (s3 = true);
2508
- }
2509
- return s3 ? n3 : void 0;
2510
- }
2511
- class Us {
2512
- constructor(e5, t3) {
2513
- this.element = e5, this.getState = t3.getState, this.dispatch = t3.dispatch, this.schemaRegistry = t3.schemaRegistry, this.fileHandlerRegistry = t3.fileHandlerRegistry, this.isReadOnly = t3.isReadOnly ?? (() => false), this.handlePaste = this.onPaste.bind(this), e5.addEventListener("paste", this.handlePaste);
2514
- }
2515
- getState;
2516
- dispatch;
2517
- schemaRegistry;
2518
- fileHandlerRegistry;
2519
- isReadOnly;
2520
- handlePaste;
2521
- onPaste(e5) {
2522
- if (e5.preventDefault(), this.isReadOnly()) return;
2523
- const t3 = e5.clipboardData;
2524
- if (!t3) return;
2525
- const n3 = t3.getData("application/x-notectl-block");
2526
- if (n3) return void this.handleBlockPaste(n3);
2527
- if (this.handleFilePaste(t3)) return;
2528
- const s3 = t3.getData("text/plain");
2529
- if (s3) {
2530
- const e6 = (function(e7) {
2531
- if (mn && mn.plainText === e7) return mn.blocks;
2532
- })(s3);
2533
- if (e6 && this.handleRichPaste(e6)) return;
2534
- }
2535
- const r4 = this.getState(), i9 = t3.getData("text/html");
2536
- if (i9) {
2537
- const e6 = this.extractRichData(i9);
2538
- if (e6 && this.handleRichPasteFromJson(e6)) return;
2539
- const t4 = document.createElement("template");
2540
- t4.innerHTML = i9, (function(e7) {
2541
- const t5 = Array.from(e7.querySelectorAll("font"));
2542
- for (const e8 of t5) {
2543
- const t6 = e8.getAttribute("color"), n5 = e8.getAttribute("face"), s5 = e8.getAttribute("size"), r5 = e8.getAttribute("style") ?? "";
2544
- if (!(null !== t6 || null !== n5 || null !== s5 || r5.length > 0)) {
2545
- Ks(e8);
2546
- continue;
2547
- }
2548
- const i10 = document.createElement("span"), o3 = [];
2549
- if (r5 && o3.push(r5.endsWith(";") ? r5 : `${r5};`), t6 && o3.push(`color: ${t6};`), n5 && o3.push(`font-family: ${n5};`), s5 && !js(r5)) {
2550
- const e9 = zs[s5];
2551
- e9 && o3.push(`font-size: ${e9};`);
2552
- }
2553
- Mt(i10, o3.join(" ")), $s(e8, i10), e8.parentNode?.replaceChild(i10, e8);
2554
- }
2555
- })(t4.content);
2556
- const n4 = t4.innerHTML, s4 = this.schemaRegistry ? this.schemaRegistry.getAllowedTags() : ["strong", "em", "u", "b", "i", "p", "br", "div", "span"], o2 = this.schemaRegistry ? this.schemaRegistry.getAllowedAttrs() : [], a22 = Dt.sanitize(n4, { ALLOWED_TAGS: s4, ALLOWED_ATTR: o2 });
2557
- if (this.schemaRegistry) {
2558
- const e7 = me(this.schemaRegistry), t5 = new Hs({ schema: e7, schemaRegistry: this.schemaRegistry }), n5 = document.createElement("template");
2559
- n5.innerHTML = a22;
2560
- const s5 = (function(e8, t6) {
2561
- if (0 === t6.blocks.length) return e8.transaction("paste").setSelection(e8.selection).build();
2562
- const n6 = t6.blocks[0];
2563
- return n6 ? 1 === t6.blocks.length && n6.type === ke("paragraph") ? (function(e9, t7) {
2564
- const n7 = e9.selection;
2565
- if (ie(n7)) return e9.transaction("paste").setSelection(n7).build();
2566
- if (oe(n7)) return (function(e10, t8, n8) {
2567
- const s7 = Os(e10, t8);
2568
- if (!s7) return e10.transaction("paste").setSelection(t8).build();
2569
- const r6 = Y(), i11 = Ns(n8), o4 = Bs(n8), a24 = e10.transaction("paste");
2570
- return a24.insertNode(s7.parentPath, s7.insertIndex, _(ke("paragraph"), [T("")], r6)), i11.length > 0 && a24.insertText(r6, 0, i11, [], n8), a24.setSelection(re(r6, o4)), a24.build();
2571
- })(e9, n7, t7);
2572
- const s6 = e9.transaction("paste");
2573
- le(n7) || Qe(e9, s6);
2574
- const { blockId: r5, offset: i10 } = Xe(n7, e9.getBlockOrder()), o3 = Bs(t7), a23 = Ns(t7);
2575
- return s6.insertText(r5, i10, a23, [], t7), s6.setSelection(re(r5, i10 + o3)), s6.build();
2576
- })(e8, n6.segments) : 1 === t6.blocks.length ? (function(e9, t7) {
2577
- const n7 = e9.selection;
2578
- if (ie(n7)) return e9.transaction("paste").setSelection(n7).build();
2579
- if (oe(n7)) return _s(e9, n7, [t7]);
2580
- const s6 = e9.transaction("paste");
2581
- le(n7) || Qe(e9, s6);
2582
- const { blockId: r5, offset: i10 } = Xe(n7, e9.getBlockOrder()), o3 = Bs(t7.segments), a23 = Ns(t7.segments);
2583
- return s6.setBlockType(r5, t7.type, t7.attrs), s6.insertText(r5, i10, a23, [], t7.segments), s6.setSelection(re(r5, i10 + o3)), s6.build();
2584
- })(e8, n6) : (function(e9, t7) {
2585
- const n7 = e9.selection;
2586
- if (ie(n7)) return e9.transaction("paste").setSelection(n7).build();
2587
- if (oe(n7)) return _s(e9, n7, t7.blocks);
2588
- const s6 = e9.transaction("paste");
2589
- le(n7) || Qe(e9, s6);
2590
- const r5 = e9.getBlockOrder(), { blockId: i10, offset: o3 } = Xe(n7, r5), a23 = r5.indexOf(i10), c11 = t7.blocks[0], l3 = t7.blocks[t7.blocks.length - 1];
2591
- if (!c11 || !l3) return s6.build();
2592
- const h4 = t7.blocks.slice(1, -1), d5 = Bs(c11.segments);
2593
- c11.segments.length > 0 && d5 > 0 && s6.insertText(i10, o3, Ns(c11.segments), [], c11.segments), c11.type !== ke("paragraph") && s6.setBlockType(i10, c11.type, c11.attrs);
2594
- const u2 = o3 + d5, p4 = Y();
2595
- s6.splitBlock(i10, u2, p4);
2596
- let f4 = a23 + 1;
2597
- for (const e10 of h4) {
2598
- const t8 = e10.segments.map((e11) => T(e11.text, [...e11.marks])), n8 = _(e10.type, t8.length > 0 ? t8 : void 0, Y(), e10.attrs);
2599
- s6.insertNode([], f4, n8), f4++;
2600
- }
2601
- const g4 = Bs(l3.segments);
2602
- return l3.segments.length > 0 && g4 > 0 && s6.insertText(p4, 0, Ns(l3.segments), [], l3.segments), l3.type !== ke("paragraph") && s6.setBlockType(p4, l3.type, l3.attrs), s6.setSelection(re(p4, g4)), s6.build();
2603
- })(e8, t6) : e8.transaction("paste").setSelection(e8.selection).build();
2604
- })(r4, t5.parse(n5.content));
2605
- this.dispatch(s5);
2606
- } else {
2607
- const e7 = this.extractTextFromHTML(a22);
2608
- if (e7) {
2609
- const t5 = qe(r4, e7, "paste");
2610
- this.dispatch(t5);
2611
- }
2612
- }
2613
- return;
2614
- }
2615
- if (s3) {
2616
- const e6 = qe(this.getState(), s3, "paste");
2617
- this.dispatch(e6);
2618
- }
2619
- }
2620
- handleBlockPaste(e5) {
2621
- let t3;
2622
- try {
2623
- t3 = JSON.parse(e5);
2624
- } catch {
2625
- return;
2626
- }
2627
- const n3 = t3.type;
2628
- if (!n3) return;
2629
- const s3 = this.schemaRegistry?.getNodeSpec(n3);
2630
- if (this.schemaRegistry && !s3) return;
2631
- const r4 = this.getState(), i9 = r4.selection, o2 = ie(i9) ? i9.nodeId : oe(i9) ? i9.blockId : i9.anchor.blockId, a22 = Y(), c11 = Fs(t3.attrs, s3?.attrs), l3 = _(ke(n3), [], a22, c11), h4 = this.findTableCellAncestor(r4, o2);
2632
- if (h4) {
2633
- const e6 = Ae(r4.doc, h4);
2634
- if (!e6) return;
2635
- const t4 = r4.getBlock(h4);
2636
- if (!t4) return;
2637
- const n4 = r4.transaction("paste");
2638
- return n4.insertNode(e6, t4.children.length, l3), n4.setSelection(se(a22, [...e6, a22])), void this.dispatch(n4.build());
2639
- }
2640
- const d5 = Ae(r4.doc, o2), u2 = d5 && d5.length > 1 ? d5.slice(0, -1) : [], p4 = (0 === u2.length ? r4.doc.children : (() => {
2641
- const e6 = r4.getBlock(u2[u2.length - 1]);
2642
- return e6 ? e6.children : [];
2643
- })()).findIndex((e6) => S(e6) && e6.id === o2);
2644
- if (p4 < 0) return;
2645
- const f4 = oe(i9) && "before" === i9.side ? 0 : 1, g4 = r4.transaction("paste");
2646
- g4.insertNode(u2, p4 + f4, l3), g4.setSelection(se(a22, [...u2, a22])), this.dispatch(g4.build());
2647
- }
2648
- handleRichPasteFromJson(e5) {
2649
- let t3;
2650
- try {
2651
- t3 = JSON.parse(e5);
2652
- } catch {
2653
- return false;
2654
- }
2655
- return !(!Array.isArray(t3) || 0 === t3.length) && this.handleRichPaste(t3);
2656
- }
2657
- handleRichPaste(e5) {
2658
- if (0 === e5.length) return false;
2659
- if (!e5.some((e6) => void 0 !== e6.type && "paragraph" !== e6.type)) return false;
2660
- const t3 = this.getState(), n3 = t3.selection, s3 = ie(n3) ? n3.nodeId : oe(n3) ? n3.blockId : n3.anchor.blockId, r4 = this.findTableCellAncestor(t3, s3);
2661
- return r4 ? this.insertRichBlocksIntoCell(e5, t3, s3, r4) : this.insertRichBlocksAtRoot(e5, t3, s3);
2662
- }
2663
- insertRichBlocksIntoCell(e5, t3, n3, s3) {
2664
- const r4 = Ae(t3.doc, s3);
2665
- if (!r4) return false;
2666
- const i9 = t3.getBlock(s3);
2667
- if (!i9) return false;
2668
- const o2 = t3.getBlock(n3), a22 = i9.children.findIndex((e6) => S(e6) && e6.id === n3), c11 = void 0 !== o2 && "paragraph" === o2.type && "" === $(o2);
2669
- let l3 = a22 >= 0 ? a22 + 1 : i9.children.length;
2670
- const h4 = t3.transaction("paste");
2671
- let d5, u2 = 0;
2672
- for (const t4 of e5) {
2673
- const e6 = this.validateRichBlockData(t4);
2674
- if (!e6) continue;
2675
- const n4 = Y(), s4 = e6.text ?? "", i10 = s4 ? [T(s4)] : void 0, o3 = e6.attrs ? e6.attrs : void 0, a23 = _(ke(e6.type), i10, n4, o3);
2676
- h4.insertNode(r4, l3, a23), l3++, d5 = n4, u2 = s4.length;
2677
- }
2678
- return c11 && a22 >= 0 && h4.removeNode(r4, a22), d5 && h4.setSelection(re(d5, u2)), this.dispatch(h4.build()), true;
2679
- }
2680
- insertRichBlocksAtRoot(e5, t3, n3) {
2681
- const s3 = Ae(t3.doc, n3), r4 = s3 && s3.length > 1 ? s3.slice(0, -1) : [], i9 = (0 === r4.length ? t3.doc.children : (() => {
2682
- const e6 = t3.getBlock(r4[r4.length - 1]);
2683
- return e6 ? e6.children : [];
2684
- })()).findIndex((e6) => S(e6) && e6.id === n3);
2685
- if (i9 < 0) return false;
2686
- const o2 = t3.getBlock(n3), a22 = void 0 !== o2 && "paragraph" === o2.type && "" === $(o2), c11 = t3.selection;
2687
- let l3 = i9 + (oe(c11) && "before" === c11.side ? 0 : 1);
2688
- const h4 = t3.transaction("paste");
2689
- let d5, u2 = 0;
2690
- for (const t4 of e5) {
2691
- const e6 = this.validateRichBlockData(t4);
2692
- if (!e6) continue;
2693
- const n4 = Y(), s4 = e6.text ?? "", i10 = s4 ? [T(s4)] : void 0, o3 = e6.attrs ? e6.attrs : void 0, a23 = _(ke(e6.type), i10, n4, o3);
2694
- h4.insertNode(r4, l3, a23), l3++, d5 = n4, u2 = s4.length;
2695
- }
2696
- return a22 && !oe(c11) && h4.removeNode(r4, i9), d5 && h4.setSelection(re(d5, u2)), this.dispatch(h4.build()), true;
2697
- }
2698
- validateRichBlockData(e5) {
2699
- if (!e5.type) return;
2700
- if (!this.schemaRegistry) return e5;
2701
- const t3 = this.schemaRegistry.getNodeSpec(e5.type);
2702
- if (!t3) return;
2703
- const n3 = Fs(e5.attrs, t3.attrs);
2704
- return { ...e5, attrs: n3 };
2705
- }
2706
- findTableCellAncestor(e5, t3) {
2707
- const n3 = e5.getBlock(t3);
2708
- if ("table_cell" === n3?.type) return t3;
2709
- const s3 = Ae(e5.doc, t3);
2710
- if (s3) for (const t4 of s3) {
2711
- const n4 = e5.getBlock(t4);
2712
- if ("table_cell" === n4?.type) return t4;
2713
- }
2714
- }
2715
- handleFilePaste(e5) {
2716
- if (!this.fileHandlerRegistry) return false;
2717
- const t3 = Array.from(e5.files);
2718
- if (0 === t3.length) for (let n4 = 0; n4 < e5.items.length; n4++) {
2719
- const s3 = e5.items[n4];
2720
- if (s3 && "file" === s3.kind) {
2721
- const e6 = s3.getAsFile();
2722
- e6 && t3.push(e6);
2723
- }
2724
- }
2725
- if (0 === t3.length) return false;
2726
- let n3 = false;
2727
- for (const e6 of t3) {
2728
- const t4 = this.fileHandlerRegistry.matchFileHandlers(e6.type);
2729
- for (const s3 of t4) {
2730
- const t5 = s3(e6, null);
2731
- if (true === t5 || t5 instanceof Promise) {
2732
- n3 = true;
2733
- break;
2734
- }
2735
- }
2736
- }
2737
- return n3;
2738
- }
2739
- extractRichData(e5) {
2740
- const t3 = document.createElement("template");
2741
- t3.innerHTML = e5;
2742
- const n3 = t3.content.querySelector("[data-notectl-rich]");
2743
- if (n3) return n3.getAttribute("data-notectl-rich") ?? void 0;
2744
- }
2745
- extractTextFromHTML(e5) {
2746
- const t3 = document.createElement("template");
2747
- return t3.innerHTML = e5, t3.content.textContent ?? "";
2748
- }
2749
- destroy() {
2750
- this.element.removeEventListener("paste", this.handlePaste);
2751
- }
2752
- }
2753
- function Ws(e5, t3, n3, s3) {
2754
- const r4 = t3?.doc.children ?? [], i9 = n3.doc.children, o2 = s3?.registry, a22 = s3?.nodeViews, c11 = null != s3?.compositionBlockId;
2755
- c11 || (function(e6) {
2756
- const t4 = Array.from(e6.querySelectorAll(":scope > [data-block-wrapper]"));
2757
- for (const n4 of t4) {
2758
- for (; n4.firstChild; ) e6.insertBefore(n4.firstChild, n4);
2759
- n4.remove();
2760
- }
2761
- })(e5);
2762
- const l3 = /* @__PURE__ */ new Map();
2763
- for (const t4 of (function(e6) {
2764
- const t5 = [];
2765
- for (const n4 of Array.from(e6.children)) if (n4 instanceof HTMLElement) {
2766
- if (n4.hasAttribute("data-block-id")) t5.push(n4);
2767
- else if (n4.hasAttribute("data-block-wrapper")) for (const e7 of Array.from(n4.children)) e7 instanceof HTMLElement && e7.hasAttribute("data-block-id") && t5.push(e7);
2768
- }
2769
- return t5;
2770
- })(e5)) {
2771
- const e6 = t4.getAttribute("data-block-id");
2772
- e6 && l3.set(ye(e6), t4);
2773
- }
2774
- const h4 = new Set(i9.map((e6) => e6.id));
2775
- for (const [e6, t4] of l3) if (!h4.has(e6)) {
2776
- nr(t4), l3.delete(e6);
2777
- const n4 = a22?.get(e6);
2778
- n4 && (n4.destroy?.(), a22?.delete(e6));
2779
- }
2780
- const d5 = /* @__PURE__ */ new Map();
2781
- for (const e6 of r4) d5.set(e6.id, e6);
2782
- let u2 = null;
2783
- const p4 = s3?.selectedNodeId, f4 = s3?.previousSelectedNodeId;
2784
- for (const t4 of i9) {
2785
- const n4 = l3.get(t4.id), r5 = d5.get(t4.id);
2786
- if (s3?.compositionBlockId === t4.id && n4) {
2787
- u2 = n4;
2788
- continue;
2789
- }
2790
- const i10 = s3?.oldDecorations?.find(t4.id), c12 = s3?.decorations?.find(t4.id);
2791
- if (n4 && r5 && !Vs(r5, t4, i10, c12)) u2 = n4;
2792
- else if (n4) {
2793
- const r6 = a22?.get(t4.id);
2794
- if (r6) {
2795
- if (r6.update?.(t4)) {
2796
- if (V(t4) && r6.contentDOM) {
2797
- r6.contentDOM.textContent = "";
2798
- const e6 = s3?.decorations?.findInline(t4.id);
2799
- qs(r6.contentDOM, t4, o2, e6);
2800
- }
2801
- u2 = r6.dom;
2802
- continue;
2803
- }
2804
- r6.destroy?.(), a22?.delete(t4.id);
2805
- }
2806
- const i11 = Gs(t4, o2, a22, s3);
2807
- sr(n4, i11, e5), u2 = i11;
2808
- } else {
2809
- const n5 = Gs(t4, o2, a22, s3);
2810
- rr(e5, u2, n5), u2 = n5;
2811
- }
2812
- if (p4 === t4.id) {
2813
- const e6 = a22?.get(t4.id);
2814
- if (e6) e6.selectNode?.();
2815
- else {
2816
- const e7 = l3.get(t4.id) ?? u2;
2817
- e7 instanceof HTMLElement && e7.classList.add("notectl-node-selected");
2818
- }
2819
- } else if (f4 === t4.id) {
2820
- const e6 = a22?.get(t4.id);
2821
- if (e6) e6.deselectNode?.();
2822
- else {
2823
- const e7 = l3.get(t4.id) ?? u2;
2824
- e7 instanceof HTMLElement && e7.classList.remove("notectl-node-selected");
2825
- }
2826
- }
2827
- }
2828
- if (f4 && f4 !== p4) {
2829
- const e6 = a22?.get(f4);
2830
- e6 && !h4.has(f4) && e6.deselectNode?.();
2831
- }
2832
- if (p4 && !h4.has(p4)) {
2833
- const e6 = a22?.get(p4);
2834
- e6 && e6.selectNode?.();
2835
- }
2836
- c11 || tr(e5, i9, o2);
2837
- }
2838
- function Vs(e5, t3, n3, s3) {
2839
- if (e5.type !== t3.type) return true;
2840
- if (e5.children.length !== t3.children.length) return true;
2841
- const r4 = e5.attrs, i9 = t3.attrs;
2842
- if (r4 !== i9) {
2843
- if (!r4 || !i9) return true;
2844
- const e6 = Object.keys(r4), t4 = Object.keys(i9);
2845
- if (e6.length !== t4.length) return true;
2846
- for (const t5 of e6) if (r4[t5] !== i9[t5]) return true;
2847
- }
2848
- for (let n4 = 0; n4 < e5.children.length; n4++) {
2849
- const s4 = e5.children[n4], r5 = t3.children[n4];
2850
- if (!s4 || !r5) return true;
2851
- if (R(s4) && R(r5)) {
2852
- if (s4.text !== r5.text) return true;
2853
- if (!Q(s4.marks, r5.marks)) return true;
2854
- } else if (C(s4) && C(r5)) {
2855
- if (s4.inlineType !== r5.inlineType) return true;
2856
- if (!Ys(s4.attrs, r5.attrs)) return true;
2857
- } else {
2858
- if (R(s4) || R(r5) || C(s4) || C(r5)) return true;
2859
- if (Vs(s4, r5)) return true;
2860
- }
2861
- }
2862
- const o2 = n3 ?? [], a22 = s3 ?? [];
2863
- return o2 !== a22 && !ht(o2, a22);
2864
- }
2865
- function Gs(e5, t3, n3, s3) {
2866
- const r4 = s3?.decorations?.findInline(e5.id), i9 = s3?.nodeViewRegistry;
2867
- if (i9 && t3 && n3 && s3?.getState && s3?.dispatch) {
2868
- const o2 = i9.getNodeViewFactory(e5.type);
2869
- if (o2) {
2870
- const i10 = o2(e5, s3.getState, s3.dispatch);
2871
- n3.set(e5.id, i10);
2872
- const a22 = t3.getNodeSpec(e5.type);
2873
- if (a22?.isVoid && i10.dom.setAttribute("data-void", "true"), a22?.selectable && i10.dom.setAttribute("data-selectable", "true"), i10.contentDOM && i10.contentDOM !== i10.dom && i10.contentDOM.setAttribute("data-content-dom", "true"), V(e5) && i10.contentDOM) qs(i10.contentDOM, e5, t3, r4);
2874
- else {
2875
- const r5 = J(e5), o3 = /* @__PURE__ */ new Map();
2876
- for (const e6 of r5) {
2877
- const r6 = i10.getContentDOM?.(e6.id) ?? i10.contentDOM;
2878
- if (r6) {
2879
- const i11 = Gs(e6, t3, n3, s3);
2880
- r6.appendChild(i11);
2881
- let a23 = o3.get(r6);
2882
- a23 || (a23 = [], o3.set(r6, a23)), a23.push(e6);
2883
- }
2884
- }
2885
- for (const [e6, n4] of o3) tr(e6, n4, t3);
2886
- }
2887
- return i10.dom.setAttribute("data-block-type", e5.type), er(i10.dom, e5.id, s3), i10.dom;
2888
- }
2889
- }
2890
- if (t3) {
2891
- const i10 = t3.getNodeSpec(e5.type);
2892
- if (i10) {
2893
- const o2 = i10.toDOM(e5);
2894
- if (i10.isVoid && o2.setAttribute("data-void", "true"), i10.selectable && o2.setAttribute("data-selectable", "true"), !i10.isVoid) if (V(e5)) qs(o2, e5, t3, r4);
2895
- else {
2896
- const r5 = J(e5);
2897
- for (const e6 of r5) {
2898
- const r6 = Gs(e6, t3, n3, s3);
2899
- o2.appendChild(r6);
2900
- }
2901
- tr(o2, r5, t3);
2902
- }
2903
- return o2.setAttribute("data-block-type", e5.type), er(o2, e5.id, s3), o2;
2904
- }
2905
- }
2906
- return (function(e6, t4, n4) {
2907
- const s4 = we("p", e6.id);
2908
- return s4.setAttribute("data-block-type", e6.type), qs(s4, e6, t4, n4), s4;
2909
- })(e5, t3, r4);
2910
- }
2911
- function qs(e5, t3, n3, s3) {
2912
- for (const t4 of e5.querySelectorAll("[data-cursor-wrapper]")) t4.remove();
2913
- const r4 = I(t3);
2914
- if (1 === r4.length && R(r4[0]) && "" === r4[0].text) return void e5.appendChild(document.createElement("br"));
2915
- if (s3 && 0 !== s3.length) !(function(e6, t4, n4, s4) {
2916
- let r5 = 0;
2917
- for (const i10 of t4) {
2918
- if (C(i10)) {
2919
- e6.appendChild(Xs(i10, s4)), r5 += 1;
2920
- continue;
2921
- }
2922
- const t5 = r5, o2 = r5 + i10.text.length;
2923
- if (0 === i10.text.length) {
2924
- r5 = o2;
2925
- continue;
2926
- }
2927
- const a22 = /* @__PURE__ */ new Set();
2928
- a22.add(t5), a22.add(o2);
2929
- for (const e7 of n4) {
2930
- const n5 = Math.max(t5, e7.from), s5 = Math.min(o2, e7.to);
2931
- n5 > t5 && n5 < o2 && a22.add(n5), s5 > t5 && s5 < o2 && a22.add(s5);
2932
- }
2933
- const c11 = [...a22].sort((e7, t6) => e7 - t6);
2934
- for (let r6 = 0; r6 < c11.length - 1; r6++) {
2935
- const o3 = c11[r6], a23 = c11[r6 + 1];
2936
- if (void 0 === o3 || void 0 === a23 || o3 >= a23) continue;
2937
- const l3 = o3 - t5, h4 = a23 - t5, d5 = i10.text.slice(l3, h4), u2 = [];
2938
- for (const e7 of n4) e7.from <= o3 && e7.to >= a23 && u2.push(e7);
2939
- let p4 = document.createTextNode(Js(d5));
2940
- if (i10.marks.length > 0) {
2941
- const e7 = [...i10.marks].sort((e8, t6) => Tn(e8, s4) - Tn(t6, s4));
2942
- for (let t6 = e7.length - 1; t6 >= 0; t6--) {
2943
- const n5 = e7[t6];
2944
- if (!n5) continue;
2945
- const r7 = An(n5, s4);
2946
- r7.appendChild(p4), p4 = r7;
2947
- }
2948
- }
2949
- for (const e7 of u2) {
2950
- const t6 = Zs(e7.attrs);
2951
- t6.appendChild(p4), p4 = t6;
2952
- }
2953
- e6.appendChild(p4);
2954
- }
2955
- r5 = o2;
2956
- }
2957
- })(e5, r4, s3, n3);
2958
- else for (const t4 of r4) R(t4) ? e5.appendChild(Qs(t4, n3)) : e5.appendChild(Xs(t4, n3));
2959
- const i9 = r4[r4.length - 1];
2960
- i9 && C(i9) && "hard_break" === i9.inlineType && e5.appendChild(document.createElement("br"));
2961
- }
2962
- function Js(e5) {
2963
- let t3 = e5.replace(/ {2}/g, "  ");
2964
- return t3.endsWith(" ") && (t3 = `${t3.slice(0, -1)} `), t3.startsWith(" ") && (t3 = ` ${t3.slice(1)}`), t3;
2965
- }
2966
- function Qs(e5, t3) {
2967
- if ("" === e5.text) return document.createTextNode("");
2968
- const n3 = document.createTextNode(Js(e5.text));
2969
- if (0 === e5.marks.length) return n3;
2970
- const s3 = [...e5.marks].sort((e6, n4) => Tn(e6, t3) - Tn(n4, t3));
2971
- let r4 = n3;
2972
- for (let e6 = s3.length - 1; e6 >= 0; e6--) {
2973
- const n4 = s3[e6];
2974
- if (!n4) continue;
2975
- const i9 = An(n4, t3);
2976
- i9.appendChild(r4), r4 = i9;
2977
- }
2978
- return r4;
2979
- }
2980
- function Xs(e5, t3) {
2981
- if (t3) {
2982
- const n4 = t3.getInlineNodeSpec(e5.inlineType);
2983
- if (n4) {
2984
- const t4 = n4.toDOM(e5);
2985
- return t4.setAttribute("contenteditable", "false"), t4;
2986
- }
2987
- }
2988
- const n3 = document.createElement("span");
2989
- return n3.setAttribute("data-inline-type", e5.inlineType), n3.setAttribute("contenteditable", "false"), n3;
2990
- }
2991
- function Ys(e5, t3) {
2992
- const n3 = Object.keys(e5), s3 = Object.keys(t3);
2993
- if (n3.length !== s3.length) return false;
2994
- for (const s4 of n3) if (e5[s4] !== t3[s4]) return false;
2995
- return true;
2996
- }
2997
- function Zs(e5) {
2998
- const t3 = e5.nodeName ?? "span", n3 = document.createElement(t3);
2999
- if (n3.setAttribute("data-decoration", "true"), e5.class) for (const t4 of e5.class.split(" ")) t4 && n3.classList.add(t4);
3000
- e5.style && Mt(n3, e5.style);
3001
- for (const [t4, s3] of Object.entries(e5)) "class" !== t4 && "style" !== t4 && "nodeName" !== t4 && void 0 !== s3 && n3.setAttribute(t4, s3);
3002
- return n3;
3003
- }
3004
- function er(e5, t3, n3) {
3005
- const s3 = n3?.decorations?.findNode(t3);
3006
- if (s3 && 0 !== s3.length) for (const t4 of s3) {
3007
- if (t4.attrs.class) for (const n4 of t4.attrs.class.split(" ")) n4 && e5.classList.add(n4);
3008
- t4.attrs.style && It(e5, t4.attrs.style);
3009
- }
3010
- }
3011
- function tr(e5, t3, n3) {
3012
- if (!n3) return;
3013
- const s3 = [];
3014
- let r4 = null, i9 = [];
3015
- for (const e6 of t3) {
3016
- const t4 = n3.getNodeSpec(e6.type), o2 = t4?.wrapper?.(e6);
3017
- o2 && r4 && o2.key === r4.key ? i9.push(e6.id) : o2 ? (r4 && i9.length > 0 && s3.push({ spec: r4, blockIds: i9 }), r4 = o2, i9 = [e6.id]) : (r4 && i9.length > 0 && s3.push({ spec: r4, blockIds: i9 }), r4 = null, i9 = []);
3018
- }
3019
- r4 && i9.length > 0 && s3.push({ spec: r4, blockIds: i9 });
3020
- for (const t4 of s3) {
3021
- const n4 = e5.querySelector(`[data-block-id="${t4.blockIds[0]}"]`);
3022
- if (!n4) continue;
3023
- const s4 = document.createElement(t4.spec.tag);
3024
- if (s4.setAttribute("data-block-wrapper", t4.spec.key), t4.spec.className && (s4.className = t4.spec.className), t4.spec.attrs) for (const [e6, n5] of Object.entries(t4.spec.attrs)) s4.setAttribute(e6, n5);
3025
- n4.before(s4);
3026
- for (const n5 of t4.blockIds) {
3027
- const t5 = e5.querySelector(`[data-block-id="${n5}"]`);
3028
- t5 && s4.appendChild(t5);
3029
- }
3030
- }
3031
- }
3032
- function nr(e5) {
3033
- e5.parentElement?.removeChild(e5);
3034
- }
3035
- function sr(e5, t3, n3) {
3036
- const s3 = e5.parentElement;
3037
- s3 ? s3.replaceChild(t3, e5) : n3.replaceChild(t3, e5);
3038
- }
3039
- function rr(e5, t3, n3) {
3040
- if (t3?.parentElement) {
3041
- const e6 = t3.parentElement;
3042
- return void (t3.nextSibling ? e6.insertBefore(n3, t3.nextSibling) : e6.appendChild(n3));
3043
- }
3044
- e5.firstChild ? e5.insertBefore(n3, e5.firstChild) : e5.appendChild(n3);
3045
- }
3046
- class ir {
3047
- state;
3048
- contentElement;
3049
- inputHandler;
3050
- keyboardHandler;
3051
- pasteHandler;
3052
- clipboardHandler;
3053
- history;
3054
- stateChangeCallbacks = [];
3055
- handleSelectionChange;
3056
- handleMousedown;
3057
- handleDragover;
3058
- handleDrop;
3059
- handleCompositionStartForWrapper;
3060
- handleCompositionEndForWrapper;
3061
- isUpdating = false;
3062
- pendingNodeSelectionClear = false;
3063
- pendingGapCursorClear = false;
3064
- schemaRegistry;
3065
- keymapRegistry;
3066
- fileHandlerRegistry;
3067
- nodeViewRegistry;
3068
- nodeViews = /* @__PURE__ */ new Map();
3069
- decorations = lt.empty;
3070
- getDecorations;
3071
- isReadOnly;
3072
- navigationKeymap = null;
3073
- compositionTracker = new kn();
3074
- cursorWrapper;
3075
- goalColumn = null;
3076
- preserveGoalColumn = false;
3077
- constructor(e5, t3) {
3078
- this.state = t3.state, this.contentElement = e5, this.schemaRegistry = t3.schemaRegistry, this.keymapRegistry = t3.keymapRegistry, this.fileHandlerRegistry = t3.fileHandlerRegistry, this.nodeViewRegistry = t3.nodeViewRegistry, this.getDecorations = t3.getDecorations, this.isReadOnly = t3.isReadOnly ?? (() => false), this.history = new an({ maxDepth: t3.maxHistoryDepth ?? 100 }), t3.onStateChange && this.stateChangeCallbacks.push(t3.onStateChange), this.inputHandler = new Is(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), syncSelection: () => this.syncSelectionFromDOM(), inputRuleRegistry: t3.inputRuleRegistry, isReadOnly: this.isReadOnly, compositionTracker: this.compositionTracker }), this.keyboardHandler = new dn(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), undo: () => this.undo(), redo: () => this.redo(), keymapRegistry: this.keymapRegistry, isReadOnly: this.isReadOnly, compositionTracker: this.compositionTracker }), this.pasteHandler = new Us(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), schemaRegistry: this.schemaRegistry, fileHandlerRegistry: this.fileHandlerRegistry, isReadOnly: this.isReadOnly }), this.clipboardHandler = new yn(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), schemaRegistry: this.schemaRegistry, syncSelection: () => this.syncSelectionFromDOM(), isReadOnly: this.isReadOnly }), this.cursorWrapper = new Rn(e5, this.schemaRegistry), this.handleCompositionStartForWrapper = () => {
3079
- this.cursorWrapper.onCompositionStart(this.state);
3080
- }, this.handleCompositionEndForWrapper = () => {
3081
- this.cursorWrapper.cleanup();
3082
- }, e5.addEventListener("compositionstart", this.handleCompositionStartForWrapper), e5.addEventListener("compositionend", this.handleCompositionEndForWrapper), this.handleSelectionChange = this.onSelectionChange.bind(this), document.addEventListener("selectionchange", this.handleSelectionChange), this.handleMousedown = this.onMousedown.bind(this), e5.addEventListener("mousedown", this.handleMousedown), this.handleDragover = this.onDragover.bind(this), e5.addEventListener("dragover", this.handleDragover), this.handleDrop = this.onDrop.bind(this), e5.addEventListener("drop", this.handleDrop), this.decorations = this.getDecorations?.(this.state) ?? lt.empty, Ws(e5, null, this.state, { ...this.reconcileOptions(), decorations: this.decorations }), Me(e5, this.state.selection), this.registerNavigationKeymaps();
3083
- }
3084
- getState() {
3085
- return this.state;
3086
- }
3087
- applyUpdate(e5, t3, n3) {
3088
- if (!this.isUpdating) {
3089
- this.isUpdating = true;
3090
- try {
3091
- const s3 = this.state;
3092
- this.state = e5, this.cursorWrapper.isActive && !e5.storedMarks?.length && this.cursorWrapper.cleanup(), n3?.pushHistory && "history" !== t3.metadata.origin && this.history.push(t3);
3093
- const r4 = this.decorations, i9 = this.getDecorations?.(e5, t3) ?? lt.empty;
3094
- this.decorations = i9, Ws(this.contentElement, s3, e5, { ...this.reconcileOptions(s3.selection), decorations: i9, oldDecorations: r4, compositionBlockId: this.compositionTracker.isComposing ? this.compositionTracker.activeBlockId ?? void 0 : void 0 }), this.compositionTracker.isComposing || Me(this.contentElement, e5.selection);
3095
- for (const n4 of this.stateChangeCallbacks) n4(s3, e5, t3);
3096
- this.preserveGoalColumn || (this.goalColumn = null);
3097
- } finally {
3098
- this.isUpdating = false;
3099
- }
3100
- }
3101
- }
3102
- dispatch(e5) {
3103
- const t3 = this.state.apply(e5);
3104
- this.applyUpdate(t3, e5, { pushHistory: true });
3105
- }
3106
- undo() {
3107
- if (this.isUpdating || this.isReadOnly()) return;
3108
- const e5 = this.history.undo(this.state);
3109
- e5 && this.applyUpdate(e5.state, e5.transaction);
3110
- }
3111
- redo() {
3112
- if (this.isUpdating || this.isReadOnly()) return;
3113
- const e5 = this.history.redo(this.state);
3114
- e5 && this.applyUpdate(e5.state, e5.transaction);
3115
- }
3116
- onStateChange(e5) {
3117
- return this.stateChangeCallbacks.push(e5), () => {
3118
- const t3 = this.stateChangeCallbacks.indexOf(e5);
3119
- -1 !== t3 && this.stateChangeCallbacks.splice(t3, 1);
3120
- };
3121
- }
3122
- replaceState(e5) {
3123
- if (!this.isUpdating) {
3124
- this.isUpdating = true;
3125
- try {
3126
- const t3 = this.state;
3127
- this.state = e5, this.history.clear();
3128
- const n3 = this.decorations, s3 = this.getDecorations?.(e5) ?? lt.empty;
3129
- this.decorations = s3, Ws(this.contentElement, t3, e5, { ...this.reconcileOptions(t3.selection), decorations: s3, oldDecorations: n3, compositionBlockId: this.compositionTracker.isComposing ? this.compositionTracker.activeBlockId ?? void 0 : void 0 }), this.compositionTracker.isComposing || Me(this.contentElement, e5.selection);
3130
- } finally {
3131
- this.isUpdating = false;
3132
- }
3133
- }
3134
- }
3135
- syncSelectionFromDOM() {
3136
- if (this.compositionTracker.isComposing) return;
3137
- if (this.cursorWrapper.isActive && this.cursorWrapper.cleanup(), ie(this.state.selection) && !this.pendingNodeSelectionClear) return;
3138
- if (oe(this.state.selection) && !this.pendingGapCursorClear) return;
3139
- this.pendingNodeSelectionClear = false, this.pendingGapCursorClear = false;
3140
- const e5 = Ie(this.contentElement);
3141
- if (!e5) return;
3142
- if (he(e5, this.state.selection)) return;
3143
- const t3 = this.state.transaction("input").setSelection(e5).setStoredMarks(null, this.state.storedMarks).build(), n3 = this.state.apply(t3);
3144
- this.applyUpdate(n3, t3);
3145
- }
3146
- onMousedown(e5) {
3147
- if (this.isUpdating) return;
3148
- this.goalColumn = null;
3149
- const t3 = e5.target;
3150
- if (!(t3 instanceof HTMLElement)) return;
3151
- const n3 = t3.closest("[data-block-id]");
3152
- if (!(n3 instanceof HTMLElement && this.contentElement.contains(n3))) return void ((this.contentElement.contains(t3) || t3 === this.contentElement) && this.handleClickBelowContent(e5));
3153
- if (!n3.hasAttribute("data-void") && !n3.hasAttribute("data-selectable")) return ie(this.state.selection) && (this.pendingNodeSelectionClear = true), void (oe(this.state.selection) && (this.pendingGapCursorClear = true));
3154
- const s3 = n3.querySelector("[data-content-dom]");
3155
- if (s3?.contains(t3)) return ie(this.state.selection) && (this.pendingNodeSelectionClear = true), void (oe(this.state.selection) && (this.pendingGapCursorClear = true));
3156
- e5.preventDefault(), this.contentElement.focus();
3157
- const r4 = ye(n3.getAttribute("data-block-id") ?? ""), i9 = this.buildBlockPath(n3), o2 = se(r4, i9), a22 = this.state.transaction("input").setSelection(o2).setStoredMarks(null, this.state.storedMarks).build(), c11 = this.state.apply(a22);
3158
- this.applyUpdate(c11, a22);
3159
- }
3160
- handleClickBelowContent(e5) {
3161
- if (this.isReadOnly()) return;
3162
- const t3 = this.state.getBlockOrder(), n3 = t3[t3.length - 1];
3163
- if (!n3) return;
3164
- const s3 = this.contentElement.querySelector(`[data-block-id="${n3}"]`);
3165
- if (!s3) return;
3166
- const r4 = s3.getBoundingClientRect();
3167
- if (e5.clientY <= r4.bottom) return;
3168
- const i9 = this.state.getBlock(n3);
3169
- if ("paragraph" === i9?.type && 0 === O(i9)) {
3170
- const t4 = this.state.transaction("input").setSelection(re(n3, 0)).build();
3171
- return this.dispatch(t4), void e5.preventDefault();
3172
- }
3173
- e5.preventDefault(), this.contentElement.focus();
3174
- const o2 = Y(), a22 = i9 ? O(i9) : 0, c11 = this.state.transaction("input").splitBlock(n3, a22, o2).setBlockType(o2, ke("paragraph")).setSelection(re(o2, 0)).build();
3175
- this.dispatch(c11);
3176
- }
3177
- buildBlockPath(e5) {
3178
- const t3 = [];
3179
- let n3 = e5;
3180
- for (; n3 && n3 !== this.contentElement; ) n3.hasAttribute("data-block-id") && t3.unshift(ye(n3.getAttribute("data-block-id") ?? "")), n3 = n3.parentElement;
3181
- return t3;
3182
- }
3183
- onDragover(e5) {
3184
- this.fileHandlerRegistry && e5.dataTransfer && e5.dataTransfer.types.includes("Files") && e5.preventDefault();
3185
- }
3186
- onDrop(e5) {
3187
- if (this.isReadOnly()) return;
3188
- if (!this.fileHandlerRegistry) return;
3189
- if (!e5.dataTransfer) return;
3190
- const t3 = Array.from(e5.dataTransfer.files);
3191
- if (0 === t3.length) return;
3192
- const n3 = this.getPositionFromPoint(e5.clientX, e5.clientY);
3193
- let s3 = false;
3194
- for (const e6 of t3) {
3195
- const t4 = this.fileHandlerRegistry.matchFileHandlers(e6.type);
3196
- for (const r4 of t4) {
3197
- const t5 = r4(e6, n3);
3198
- if (true === t5 || t5 instanceof Promise) {
3199
- s3 = true;
3200
- break;
3201
- }
3202
- }
3203
- }
3204
- s3 && e5.preventDefault();
3205
- }
3206
- getPositionFromPoint(e5, t3) {
3207
- const n3 = this.contentElement.getRootNode(), s3 = Ne(n3, e5, t3);
3208
- return s3 && this.contentElement.contains(s3.node) ? Be(this.contentElement, s3.node, s3.offset) : null;
3209
- }
3210
- onSelectionChange() {
3211
- if (this.isUpdating) return;
3212
- const e5 = this.contentElement.getRootNode(), t3 = "activeElement" in e5 ? e5.activeElement : document.activeElement;
3213
- (this.contentElement.contains(t3) || t3 === this.contentElement) && this.syncSelectionFromDOM();
3214
- }
3215
- reconcileOptions(e5) {
3216
- const t3 = ie(this.state.selection) ? this.state.selection.nodeId : void 0, n3 = e5 && ie(e5) ? e5.nodeId : void 0;
3217
- return { registry: this.schemaRegistry, nodeViewRegistry: this.nodeViewRegistry, nodeViews: this.nodeViews, getState: () => this.state, dispatch: (e6) => this.dispatch(e6), selectedNodeId: t3, previousSelectedNodeId: n3 };
3218
- }
3219
- registerNavigationKeymaps() {
3220
- if (!this.keymapRegistry) return;
3221
- const e5 = { ArrowLeft: "left", ArrowRight: "right", ArrowUp: "up", ArrowDown: "down" }, t3 = {};
3222
- for (const [n3, s3] of Object.entries(e5)) t3[n3] = () => this.handleNavigationArrow(s3);
3223
- this.navigationKeymap = t3, this.keymapRegistry.registerKeymap(t3, { priority: "navigation" });
3224
- }
3225
- handleNavigationArrow(e5) {
3226
- return !ie(this.state.selection) && !oe(this.state.selection) && !!le(this.state.selection) && ("left" === e5 || "right" === e5 ? this.handleHorizontalArrow(e5) : this.handleVerticalArrow(e5));
3227
- }
3228
- handleHorizontalArrow(e5) {
3229
- this.goalColumn = null;
3230
- const t3 = this.resolveLogicalHorizontalDirection(e5), n3 = Oe(this.state, t3);
3231
- if (n3) return this.dispatch(n3), this.validateSelectionAfterInlineSkip(), true;
3232
- if (!_e(this.contentElement, this.state, e5)) return false;
3233
- const s3 = De(this.state, t3);
3234
- return !!s3 && (this.dispatch(s3), true);
3235
- }
3236
- resolveLogicalHorizontalDirection(e5) {
3237
- const t3 = this.state.selection;
3238
- if (ie(t3) || oe(t3)) return e5;
3239
- const n3 = this.contentElement.querySelector(`[data-block-id="${t3.anchor.blockId}"]`);
3240
- return n3 instanceof HTMLElement && "rtl" === Ze(n3) ? "left" === e5 ? "right" : "left" : e5;
3241
- }
3242
- handleVerticalArrow(e5) {
3243
- const t3 = this.contentElement.ownerDocument.getSelection?.() ?? null, n3 = t3 ? Pe(t3) : null;
3244
- if (!_e(this.contentElement, this.state, e5, n3)) return false;
3245
- null === this.goalColumn && n3 && (this.goalColumn = n3.left), this.preserveGoalColumn = true;
3246
- const s3 = He(this.contentElement, this.state, e5, this.goalColumn);
3247
- return s3 ? (this.dispatch(s3), this.preserveGoalColumn = false, true) : (this.preserveGoalColumn = false, false);
3248
- }
3249
- validateSelectionAfterInlineSkip() {
3250
- const e5 = Ie(this.contentElement);
3251
- e5 && he(e5, this.state.selection) || Me(this.contentElement, this.state.selection);
3252
- }
3253
- destroy() {
3254
- this.cursorWrapper.cleanup(), this.inputHandler.destroy(), this.keyboardHandler.destroy(), this.pasteHandler.destroy(), this.clipboardHandler.destroy(), this.contentElement.removeEventListener("compositionstart", this.handleCompositionStartForWrapper), this.contentElement.removeEventListener("compositionend", this.handleCompositionEndForWrapper), document.removeEventListener("selectionchange", this.handleSelectionChange), this.contentElement.removeEventListener("mousedown", this.handleMousedown), this.contentElement.removeEventListener("dragover", this.handleDragover), this.contentElement.removeEventListener("drop", this.handleDrop), this.navigationKeymap && this.keymapRegistry && (this.keymapRegistry.removeKeymap(this.navigationKeymap), this.navigationKeymap = null);
3255
- for (const e5 of this.nodeViews.values()) e5.destroy?.();
3256
- this.nodeViews.clear();
3257
- }
3258
- }
3259
- const or = ["\n:host {\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 16px;\n line-height: 1.6;\n color: var(--notectl-fg);\n}\n\n.notectl-editor {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--notectl-border);\n border-radius: 6px;\n overflow: hidden;\n background: var(--notectl-bg);\n}\n\n.notectl-editor:focus-within {\n border-color: var(--notectl-border-focus);\n box-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n/* Content Area */\n.notectl-content {\n flex: 1;\n padding: 12px 16px;\n outline: none;\n min-height: var(--notectl-content-min-height, 400px);\n cursor: text;\n position: relative;\n white-space: pre-wrap;\n word-wrap: break-word;\n -moz-tab-size: 4;\n tab-size: 4;\n}\n\n.notectl-content p {\n margin: 0;\n padding: 2px 0;\n min-height: 1.6em;\n}\n\n.notectl-content p + p {\n margin-top: 0;\n}\n\n/* Horizontal Rule */\n.notectl-content hr {\n border: none;\n border-top: 1px solid var(--notectl-border);\n margin: 8px 0;\n padding: 0;\n cursor: default;\n user-select: none;\n}\n\n/* Placeholder */\n.notectl-content.notectl-content--empty::before {\n content: attr(data-placeholder);\n color: var(--notectl-fg-muted);\n pointer-events: none;\n position: absolute;\n top: 12px;\n left: 16px;\n}\n\n/* Plugin container bottom */\n.notectl-plugin-container--bottom {\n border-top: 1px solid var(--notectl-border);\n}\n\n/* Screen reader announcements */\n.notectl-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n/* Node selection */\n.notectl-node-selected {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n}\n", "\n@media (prefers-reduced-motion: reduce) {\n .notectl-toolbar-btn,\n .notectl-image__resize-handle,\n .notectl-image__size-indicator,\n .notectl-color-picker__swatch,\n .notectl-font-picker__item,\n .notectl-heading-picker__item,\n .notectl-font-size-picker__item,\n .ntbl-handle,\n .ntbl-handle-delete,\n .ntbl-insert-line,\n .ntbl-insert-btn,\n .ntbl-add-zone,\n .ntbl-add-icon,\n .ntbl-col-bar,\n .ntbl-row-bar,\n .ntbl-delete-table-btn,\n .notectl-code-block__copy {\n transition: none !important;\n }\n}\n", '\n/* Paper viewport: scroll container with centered gray background */\n.notectl-paper-viewport {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n background: var(--notectl-paper-viewport-bg, #e8e8e8);\n padding: 24px 0;\n}\n\n/* Paper surface: white page with shadow, centered */\n.notectl-paper-surface {\n margin: 0 auto;\n background: var(--notectl-bg);\n border-radius: 2px;\n box-shadow: 0 2px 8px var(--notectl-shadow, rgba(0, 0, 0, 0.15));\n transform-origin: top center;\n transition: transform 0.15s ease-out;\n}\n\n/* Content overrides in paper mode: wider document margins */\n.notectl-editor[data-paper-mode] .notectl-content {\n flex: none;\n padding: 48px 56px;\n min-height: auto;\n}\n\n/* Placeholder position override for paper mode */\n.notectl-editor[data-paper-mode] .notectl-content.notectl-content--empty::before {\n top: 48px;\n left: 56px;\n}\n\n/* Dark mode: darker viewport background */\n:host([theme="dark"]) .notectl-paper-viewport {\n --notectl-paper-viewport-bg: #181825;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .notectl-paper-surface {\n transition: none !important;\n }\n}\n'].join("\n");
3260
- let ar = null;
3261
- class cr {
3262
- themeStyleSheet = new CSSStyleSheet();
3263
- systemThemeQuery = null;
3264
- systemThemeHandler = null;
3265
- pluginSheets = [];
3266
- runtimeSheets = [];
3267
- shadow;
3268
- constructor(e5) {
3269
- this.shadow = e5;
3270
- }
3271
- apply(e5) {
3272
- if (this.cleanupSystemThemeListener(), e5 === es.System) {
3273
- this.setupSystemThemeListener();
3274
- const e6 = rs(this.getSystemTheme());
3275
- this.setThemeStyleSheet(e6);
3276
- } else this.setThemeStyleSheet(rs(e5));
3277
- }
3278
- setPluginStyleSheets(e5) {
3279
- this.pluginSheets = e5, this.refreshAdoptedStyleSheets();
3280
- }
3281
- setRuntimeStyleSheets(e5) {
3282
- this.runtimeSheets = e5, this.refreshAdoptedStyleSheets();
3283
- }
3284
- destroy() {
3285
- this.cleanupSystemThemeListener();
3286
- }
3287
- setThemeStyleSheet(e5) {
3288
- this.themeStyleSheet.replaceSync(cs(e5)), this.refreshAdoptedStyleSheets();
3289
- }
3290
- refreshAdoptedStyleSheets() {
3291
- this.shadow.adoptedStyleSheets = [this.themeStyleSheet, (ar || (ar = new CSSStyleSheet(), ar.replaceSync(or)), ar), ...this.pluginSheets, ...this.runtimeSheets];
3292
- }
3293
- setupSystemThemeListener() {
3294
- this.systemThemeQuery = window.matchMedia("(prefers-color-scheme: dark)"), this.systemThemeHandler = (e5) => {
3295
- const t3 = rs(this.getSystemTheme());
3296
- this.setThemeStyleSheet(t3);
3297
- }, this.systemThemeQuery.addEventListener("change", this.systemThemeHandler);
3298
- }
3299
- cleanupSystemThemeListener() {
3300
- this.systemThemeQuery && this.systemThemeHandler && this.systemThemeQuery.removeEventListener("change", this.systemThemeHandler), this.systemThemeQuery = null, this.systemThemeHandler = null;
3301
- }
3302
- getSystemTheme() {
3303
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? es.Dark : es.Light;
3304
- }
3305
- }
3306
- class lr {
3307
- wrapper;
3308
- content;
3309
- viewport = null;
3310
- surface = null;
3311
- viewportObserver = null;
3312
- surfaceObserver = null;
3313
- currentSize = null;
3314
- currentPaperWidthPx = 0;
3315
- currentPaperHeightPx = 0;
3316
- currentScale = 1;
3317
- compensationFrameId = null;
3318
- constructor(e5, t3) {
3319
- this.wrapper = e5, this.content = t3;
3320
- }
3321
- apply(e5) {
3322
- if (null === e5) return void this.disable();
3323
- const t3 = Fn(e5);
3324
- this.currentPaperWidthPx = t3.widthPx, this.currentPaperHeightPx = t3.heightPx, this.currentSize = e5, this.viewport || this.enable(), this.updateSurfaceDimensions(), this.wrapper.setAttribute("data-paper-mode", e5);
3325
- }
3326
- destroy() {
3327
- this.disable();
3328
- }
3329
- getPaperSize() {
3330
- return this.currentSize;
3331
- }
3332
- enable() {
3333
- this.viewport = document.createElement("div"), this.viewport.className = "notectl-paper-viewport", this.surface = document.createElement("div"), this.surface.className = "notectl-paper-surface", this.wrapper.removeChild(this.content), this.surface.appendChild(this.content), this.viewport.appendChild(this.surface);
3334
- const e5 = this.wrapper.querySelector(".notectl-plugin-container--bottom");
3335
- e5 ? this.wrapper.insertBefore(this.viewport, e5) : this.wrapper.appendChild(this.viewport), this.viewportObserver = new ResizeObserver((e6) => {
3336
- for (const t3 of e6) this.onViewportResize(t3.contentRect.width);
3337
- }), this.viewportObserver.observe(this.viewport), this.surfaceObserver = new ResizeObserver((e6) => {
3338
- for (const t3 of e6) this.onSurfaceResize(t3.contentRect.height);
3339
- }), this.surfaceObserver.observe(this.surface);
3340
- }
3341
- disable() {
3342
- if (null !== this.compensationFrameId && (cancelAnimationFrame(this.compensationFrameId), this.compensationFrameId = null), this.viewportObserver?.disconnect(), this.viewportObserver = null, this.surfaceObserver?.disconnect(), this.surfaceObserver = null, this.viewport && this.surface) {
3343
- this.surface.removeChild(this.content);
3344
- const e5 = this.wrapper.querySelector(".notectl-plugin-container--bottom");
3345
- e5 ? this.wrapper.insertBefore(this.content, e5) : this.wrapper.appendChild(this.content), this.wrapper.removeChild(this.viewport);
3346
- }
3347
- this.viewport = null, this.surface = null, this.currentSize = null, this.currentPaperWidthPx = 0, this.currentPaperHeightPx = 0, this.currentScale = 1, this.wrapper.removeAttribute("data-paper-mode");
3348
- }
3349
- updateSurfaceDimensions() {
3350
- this.surface && (Nt(this.surface, "width", `${this.currentPaperWidthPx}px`), Nt(this.surface, "minHeight", `${this.currentPaperHeightPx}px`));
3351
- }
3352
- onViewportResize(e5) {
3353
- if (!this.surface || 0 === this.currentPaperWidthPx) return;
3354
- const t3 = e5 - 48, n3 = Math.min(1, t3 / this.currentPaperWidthPx);
3355
- this.currentScale = n3, Nt(this.surface, "transform", n3 < 1 ? `scale(${n3})` : ""), this.scheduleHeightCompensation(n3);
3356
- }
3357
- onSurfaceResize(e5) {
3358
- this.surface && this.viewport && this.scheduleHeightCompensation(this.currentScale);
3359
- }
3360
- scheduleHeightCompensation(e5) {
3361
- null !== this.compensationFrameId && cancelAnimationFrame(this.compensationFrameId), this.compensationFrameId = requestAnimationFrame(() => {
3362
- this.compensationFrameId = null, this.updateHeightCompensation(e5);
3363
- });
3364
- }
3365
- updateHeightCompensation(e5) {
3366
- if (!this.surface) return;
3367
- if (e5 >= 1) return void Nt(this.surface, "marginBottom", "");
3368
- const t3 = this.surface.scrollHeight, n3 = t3 * e5 - t3;
3369
- Nt(this.surface, "marginBottom", `${n3}px`);
3370
- }
3371
- }
3372
- class hr extends HTMLElement {
3373
- view = null;
3374
- pluginManager = null;
3375
- contentElement = null;
3376
- editorWrapper = null;
3377
- topPluginContainer = null;
3378
- bottomPluginContainer = null;
3379
- announcer = null;
3380
- config = {};
3381
- eventListeners = /* @__PURE__ */ new Map();
3382
- readyPromiseResolve = null;
3383
- readyPromise;
3384
- initialized = false;
3385
- preInitPlugins = [];
3386
- themeController = null;
3387
- paperLayout = null;
3388
- runtimeStyleSheet = null;
3389
- constructor() {
3390
- super(), this.readyPromise = new Promise((e5) => {
3391
- this.readyPromiseResolve = e5;
3392
- }), this.attachShadow({ mode: "open" });
3393
- }
3394
- static get observedAttributes() {
3395
- return ["placeholder", "readonly", "theme", "paper-size"];
3396
- }
3397
- connectedCallback() {
3398
- this.initialized || this.init();
3399
- }
3400
- disconnectedCallback() {
3401
- setTimeout(() => {
3402
- this.isConnected || this.destroy();
3403
- }, 0);
3404
- }
3405
- attributeChangedCallback(e5, t3, n3) {
3406
- if ("placeholder" === e5 && this.contentElement && this.contentElement.setAttribute("data-placeholder", n3 ?? ""), "readonly" === e5 && this.contentElement) {
3407
- const e6 = null !== n3;
3408
- this.contentElement.contentEditable = e6 ? "false" : "true", e6 ? this.contentElement.setAttribute("aria-readonly", "true") : this.contentElement.removeAttribute("aria-readonly"), this.config = { ...this.config, readonly: e6 }, this.pluginManager?.setReadOnly(e6);
3409
- }
3410
- "theme" === e5 && this.themeController && this.themeController.apply(n3 ?? es.Light), "paper-size" === e5 && (null === n3 ? this.configure({ paperSize: void 0 }) : Gn(n3) && this.configure({ paperSize: n3 }));
3411
- }
3412
- registerPlugin(e5) {
3413
- if (this.initialized) throw new Error("Cannot register plugins after initialization. Register before calling init() or adding to DOM.");
3414
- this.preInitPlugins.push(e5);
3415
- }
3416
- async init(e5) {
3417
- if (this.initialized) return;
3418
- this.initialized = true, e5 && (this.config = e5);
3419
- const t3 = this.shadowRoot;
3420
- if (!t3) return;
3421
- this.themeController = new cr(t3), this.setupStyleRuntime(t3), this.themeController.apply(this.config.theme ?? es.Light);
3422
- const n3 = (function(e6) {
3423
- const t4 = document.createElement("div");
3424
- t4.className = "notectl-editor";
3425
- const n4 = document.createElement("div");
3426
- n4.className = "notectl-plugin-container--top", n4.setAttribute("data-notectl-no-print", "");
3427
- const s4 = document.createElement("div");
3428
- s4.className = "notectl-content", s4.contentEditable = e6.readonly ? "false" : "true", s4.setAttribute("role", "textbox"), s4.setAttribute("aria-multiline", "true"), s4.setAttribute("aria-label", "Rich text editor"), e6.readonly && s4.setAttribute("aria-readonly", "true"), s4.setAttribute("aria-description", "Press Escape to exit the editor"), s4.setAttribute("data-placeholder", e6.placeholder ?? "Start typing...");
3429
- const r5 = document.createElement("div");
3430
- r5.className = "notectl-plugin-container--bottom", r5.setAttribute("data-notectl-no-print", "");
3431
- const i10 = document.createElement("div");
3432
- return i10.className = "notectl-sr-only", i10.setAttribute("data-notectl-no-print", ""), i10.setAttribute("aria-live", "polite"), i10.setAttribute("aria-atomic", "true"), t4.appendChild(n4), t4.appendChild(s4), t4.appendChild(r5), t4.appendChild(i10), { wrapper: t4, content: s4, topPluginContainer: n4, bottomPluginContainer: r5, announcer: i10 };
3433
- })({ readonly: this.config.readonly, placeholder: this.config.placeholder });
3434
- this.editorWrapper = n3.wrapper, this.contentElement = n3.content, this.topPluginContainer = n3.topPluginContainer, this.bottomPluginContainer = n3.bottomPluginContainer, this.announcer = n3.announcer, t3.appendChild(this.editorWrapper), this.config.paperSize && (this.paperLayout = new lr(this.editorWrapper, this.contentElement), this.paperLayout.apply(this.config.paperSize)), this.pluginManager = new On();
3435
- const s3 = new st(this.config.locale ?? "browser");
3436
- this.pluginManager.registerService(rt, s3), $t(this.pluginManager.schemaRegistry), this.processToolbarConfig();
3437
- for (const e6 of this.config.plugins ?? []) this.pluginManager.register(e6);
3438
- for (const e6 of this.preInitPlugins) this.pluginManager.register(e6);
3439
- this.preInitPlugins = [], this.ensureTextFormattingPlugin(), this.ensureCaretNavigationPlugin(), this.ensureGapCursorPlugin(), this.contentElement.addEventListener("focus", () => this.emit("focus", void 0)), this.contentElement.addEventListener("blur", () => this.emit("blur", void 0));
3440
- const r4 = this.contentElement, i9 = this.pluginManager, o2 = this.topPluginContainer, a22 = this.bottomPluginContainer;
3441
- if (!(r4 && i9 && o2 && a22)) return;
3442
- const c11 = this.announcer;
3443
- await i9.init({ getState: () => {
3444
- if (!this.view) throw new Error("View not initialized");
3445
- return this.view.getState();
3446
- }, dispatch: (e6) => this.dispatch(e6), getContainer: () => r4, getPluginContainer: (e6) => "top" === e6 ? o2 : a22, announce: (e6) => {
3447
- c11 && (c11.textContent = e6);
3448
- }, hasAnnouncement: () => !!c11?.textContent, onBeforeReady: () => {
3449
- const e6 = me(i9.schemaRegistry), t4 = en.create({ schema: e6 });
3450
- this.view = new ir(r4, { state: t4, schemaRegistry: i9.schemaRegistry, keymapRegistry: i9.keymapRegistry, inputRuleRegistry: i9.inputRuleRegistry, fileHandlerRegistry: i9.fileHandlerRegistry, nodeViewRegistry: i9.nodeViewRegistry, maxHistoryDepth: this.config.maxHistoryDepth, getDecorations: (e7, t5) => this.pluginManager?.collectDecorations(e7, t5) ?? lt.empty, onStateChange: (e7, t5, n5) => {
3451
- this.onStateChange(e7, t5, n5);
3452
- }, isReadOnly: () => this.config.readonly ?? false }), this.updateEmptyState();
3453
- const n4 = i9.getPluginStyleSheets();
3454
- n4.length > 0 && this.themeController?.setPluginStyleSheets(n4);
3455
- } }), this.pluginManager && (this.config.readonly && this.pluginManager.setReadOnly(true), this.pluginManager.onEvent(Qn, (e6) => {
3456
- !e6.options.paperSize && this.config.paperSize && (e6.options = { ...e6.options, paperSize: this.config.paperSize });
3457
- }), this.config.autofocus && requestAnimationFrame(() => this.contentElement?.focus()), this.readyPromiseResolve?.(), this.emit("ready", void 0));
3458
- }
3459
- get isReadOnly() {
3460
- return this.config.readonly ?? false;
3461
- }
3462
- getJSON() {
3463
- if (!this.view) throw new Error("Editor not initialized");
3464
- return this.view.getState().doc;
3465
- }
3466
- setJSON(e5) {
3467
- const t3 = this.pluginManager ? me(this.pluginManager.schemaRegistry) : void 0, n3 = en.create({ doc: e5, schema: t3, selection: re(e5.children[0]?.id ?? ye(""), 0) });
3468
- this.replaceState(n3);
3469
- }
3470
- getContentHTML(e5) {
3471
- if (!this.view) throw new Error("Editor not initialized");
3472
- const t3 = this.view.getState().doc, n3 = this.pluginManager?.schemaRegistry;
3473
- if ("classes" === e5?.cssMode) {
3474
- const s4 = gs(t3, n3);
3475
- return e5.pretty ? { html: xe(s4.html), css: s4.css, styleMap: s4.styleMap } : s4;
3476
- }
3477
- const s3 = fs(t3, n3);
3478
- return e5?.pretty ? xe(s3) : s3;
3479
- }
3480
- setContentHTML(e5, t3) {
3481
- const n3 = vs(e5, this.pluginManager?.schemaRegistry, t3);
3482
- this.setJSON(n3);
3483
- }
3484
- getText() {
3485
- if (!this.view) throw new Error("Editor not initialized");
3486
- return this.view.getState().doc.children.map((e5) => $(e5)).join("\n");
3487
- }
3488
- isEmpty() {
3489
- if (!this.view) return true;
3490
- const e5 = this.view.getState().doc;
3491
- if (0 === e5.children.length) return true;
3492
- if (e5.children.length > 1) return false;
3493
- const t3 = e5.children[0];
3494
- return !t3 || "paragraph" === t3.type && "" === $(t3);
3495
- }
3496
- commands = { toggleBold: () => this.executeCommand("toggleBold"), toggleItalic: () => this.executeCommand("toggleItalic"), toggleUnderline: () => this.executeCommand("toggleUnderline"), undo: () => {
3497
- this.config.readonly || this.view?.undo();
3498
- }, redo: () => {
3499
- this.config.readonly || this.view?.redo();
3500
- }, selectAll: () => {
3501
- if (!this.view) return;
3502
- const e5 = Fe(this.view.getState());
3503
- this.dispatch(e5);
3504
- } };
3505
- can() {
3506
- const e5 = this.view?.getState().schema, t3 = this.config.readonly ?? false;
3507
- return { toggleBold: () => !t3 && !!e5 && fe(e5, "bold"), toggleItalic: () => !t3 && !!e5 && fe(e5, "italic"), toggleUnderline: () => !t3 && !!e5 && fe(e5, "underline"), undo: () => !t3 && (this.view?.history.canUndo() ?? false), redo: () => !t3 && (this.view?.history.canRedo() ?? false), selectAll: () => this.canExecuteCommand("selectAll") };
3508
- }
3509
- canExecuteCommand(e5) {
3510
- return this.pluginManager?.canExecuteCommand(e5) ?? false;
3511
- }
3512
- executeCommand(e5) {
3513
- return this.pluginManager?.executeCommand(e5) ?? false;
3514
- }
3515
- configurePlugin(e5, t3) {
3516
- this.pluginManager?.configurePlugin(e5, t3);
3517
- }
3518
- getService(e5) {
3519
- return this.pluginManager?.getService(e5);
3520
- }
3521
- onPluginEvent(e5, t3) {
3522
- return this.pluginManager?.onEvent(e5, t3) ?? (() => {
3523
- });
3524
- }
3525
- getState() {
3526
- if (!this.view) throw new Error("Editor not initialized");
3527
- return this.view.getState();
3528
- }
3529
- dispatch(e5) {
3530
- this.view && this.pluginManager && (!this.config.readonly || on(e5) || this.pluginManager.isReadonlyBypassed()) && this.pluginManager.dispatchWithMiddleware(e5, this.view.getState(), (e6) => this.view?.dispatch(e6));
3531
- }
3532
- on(e5, t3) {
3533
- this.eventListeners.has(e5) || this.eventListeners.set(e5, /* @__PURE__ */ new Set()), this.eventListeners.get(e5)?.add(t3);
3534
- }
3535
- off(e5, t3) {
3536
- this.eventListeners.get(e5)?.delete(t3);
3537
- }
3538
- whenReady() {
3539
- return this.readyPromise;
3540
- }
3541
- configure(e5) {
3542
- void 0 !== e5.placeholder && this.contentElement && this.contentElement.setAttribute("data-placeholder", e5.placeholder), void 0 !== e5.readonly && this.contentElement && (this.contentElement.contentEditable = e5.readonly ? "false" : "true", e5.readonly ? this.contentElement.setAttribute("aria-readonly", "true") : this.contentElement.removeAttribute("aria-readonly"), this.pluginManager?.setReadOnly(e5.readonly)), "paperSize" in e5 && this.applyPaperSize(e5.paperSize), this.config = { ...this.config, ...e5 };
3543
- }
3544
- setTheme(e5) {
3545
- this.config = { ...this.config, theme: e5 }, this.themeController?.apply(e5);
3546
- }
3547
- getTheme() {
3548
- return this.config.theme ?? es.Light;
3549
- }
3550
- getPaperSize() {
3551
- return this.config.paperSize;
3552
- }
3553
- destroy() {
3554
- this.paperLayout?.destroy(), this.paperLayout = null, this.teardownStyleRuntime(), this.themeController?.destroy(), this.themeController = null, this.view?.destroy();
3555
- const e5 = this.pluginManager?.destroy() ?? Promise.resolve();
3556
- return this.view = null, this.pluginManager = null, this.initialized = false, this.editorWrapper?.remove(), this.editorWrapper = null, this.contentElement = null, this.topPluginContainer = null, this.bottomPluginContainer = null, this.announcer = null, e5;
3557
- }
3558
- processToolbarConfig() {
3559
- if (!this.pluginManager || !this.config.toolbar) return;
3560
- const e5 = this.config.toolbar, t3 = Array.isArray(e5), n3 = t3 ? e5 : e5.groups, s3 = t3 ? void 0 : e5.overflow, r4 = [];
3561
- for (const e6 of n3) {
3562
- const t4 = [];
3563
- for (const n4 of e6) t4.push(n4.id), this.pluginManager.register(n4);
3564
- r4.push(t4);
3565
- }
3566
- const i9 = { groups: r4, overflow: s3 };
3567
- this.pluginManager.register(new it(i9));
3568
- }
3569
- ensureTextFormattingPlugin() {
3570
- if (!this.pluginManager) return;
3571
- if (void 0 !== this.pluginManager.get("text-formatting")) return;
3572
- const e5 = { bold: this.config.features?.bold ?? true, italic: this.config.features?.italic ?? true, underline: this.config.features?.underline ?? true };
3573
- this.pluginManager.register(new pt(e5));
3574
- }
3575
- ensureCaretNavigationPlugin() {
3576
- this.pluginManager && void 0 === this.pluginManager.get("caret-navigation") && this.pluginManager.register(new te());
3577
- }
3578
- ensureGapCursorPlugin() {
3579
- this.pluginManager && void 0 === this.pluginManager.get("gap-cursor") && this.pluginManager.register(new Rt());
3580
- }
3581
- applyPaperSize(e5) {
3582
- this.editorWrapper && this.contentElement && (e5 ? (this.paperLayout || (this.paperLayout = new lr(this.editorWrapper, this.contentElement)), this.paperLayout.apply(e5)) : this.paperLayout?.apply(null));
3583
- }
3584
- setupStyleRuntime(e5) {
3585
- Bt(e5), this.runtimeStyleSheet = Ot(), this.themeController?.setRuntimeStyleSheets(this.runtimeStyleSheet ? [this.runtimeStyleSheet] : []), _t(e5, { nonce: this.config.styleNonce, sheet: this.runtimeStyleSheet });
3586
- }
3587
- teardownStyleRuntime() {
3588
- const e5 = this.shadowRoot;
3589
- e5 && Bt(e5), this.runtimeStyleSheet = null, this.themeController?.setRuntimeStyleSheets([]);
3590
- }
3591
- emit(e5, t3) {
3592
- const n3 = this.eventListeners.get(e5);
3593
- if (n3) for (const e6 of n3) e6(t3);
3594
- }
3595
- onStateChange(e5, t3, n3) {
3596
- if (this.announcer && (this.announcer.textContent = ""), this.pluginManager?.notifyStateChange(e5, t3, n3), this.updateEmptyState(), this.emit("stateChange", { oldState: e5, newState: t3, transaction: n3 }), he(e5.selection, t3.selection) || this.emit("selectionChange", { selection: t3.selection }), !this.announcer?.textContent) {
3597
- const s3 = ne(e5, t3, n3);
3598
- s3 && this.announcer && (this.announcer.textContent = s3);
3599
- }
3600
- }
3601
- updateEmptyState() {
3602
- this.contentElement && this.contentElement.classList.toggle("notectl-content--empty", this.isEmpty());
3603
- }
3604
- replaceState(e5) {
3605
- this.view && (this.view.replaceState(e5), this.updateEmptyState());
3606
- }
3607
- }
3608
- async function dr(e5) {
3609
- const t3 = document.createElement("notectl-editor");
3610
- return await t3.init(e5), t3;
3611
- }
3612
- function ur(e5) {
3613
- return { toolbar: [[new wt({ fonts: Pt, ...e5?.font })]], plugins: [] };
3614
- }
3615
- function pr(e5) {
3616
- return { toolbar: [[new wt({ fonts: Pt, ...e5?.font }), new Et(e5?.fontSize)], [new pt(e5?.textFormatting), new kt(e5?.strikethrough), new Tt(e5?.superSub)], [new bt(e5?.textColor), new Ct(e5?.highlight)], [new ft(e5?.heading), new yt(e5?.blockquote), new dt(e5?.codeBlock)], [new St(e5?.alignment)], [new mt(e5?.list)], [new gt(e5?.link), new xt(e5?.table), new vt(e5?.horizontalRule), new At(e5?.image)], [new Zn(e5?.print)]], plugins: [new Ye()] };
3617
- }
3618
- "undefined" == typeof customElements || customElements.get("notectl-editor") || customElements.define("notectl-editor", hr);
3619
- export {
3620
- Xn as AFTER_PRINT,
3621
- a13 as ALIGNMENT_ICONS,
3622
- b15 as ALIGNMENT_LOCALES,
3623
- c7 as ALIGNMENT_LOCALE_DE,
3624
- d3 as ALIGNMENT_LOCALE_EN,
3625
- St as AlignmentPlugin,
3626
- Qn as BEFORE_PRINT,
3627
- a9 as BLOCKQUOTE_LOCALES,
3628
- b11 as BLOCKQUOTE_LOCALE_EN,
3629
- Cn as BlockTypePickerRegistry,
3630
- yt as BlockquotePlugin,
3631
- a4 as CODE_BLOCK_LOCALES,
3632
- b6 as CODE_BLOCK_LOCALE_EN,
3633
- c6 as CODE_BLOCK_SERVICE_KEY,
3634
- te as CaretNavigationPlugin,
3635
- yn as ClipboardHandler,
3636
- dt as CodeBlockPlugin,
3637
- kn as CompositionTracker,
3638
- Rn as CursorWrapper,
3639
- ns as DARK_THEME,
3640
- D2 as DEFAULT_IMAGE_KEYMAP,
3641
- lt as DecorationSet,
3642
- en as EditorState,
3643
- Bn as EventBus,
3644
- et as EventKey,
3645
- a14 as FONT_LOCALES,
3646
- b16 as FONT_LOCALE_EN,
3647
- a15 as FONT_SIZE_LOCALES,
3648
- b17 as FONT_SIZE_LOCALE_EN,
3649
- Sn as FileHandlerRegistry,
3650
- wt as FontPlugin,
3651
- Et as FontSizePlugin,
3652
- Rt as GapCursorPlugin,
3653
- a6 as HEADING_LOCALES,
3654
- b8 as HEADING_LOCALE_EN,
3655
- a17 as HIGHLIGHT_LOCALES,
3656
- b19 as HIGHLIGHT_LOCALE_EN,
3657
- a12 as HORIZONTAL_RULE_LOCALES,
3658
- b14 as HORIZONTAL_RULE_LOCALE_EN,
3659
- Ye as HardBreakPlugin,
3660
- ft as HeadingPlugin,
3661
- Ct as HighlightPlugin,
3662
- an as HistoryManager,
3663
- vt as HorizontalRulePlugin,
3664
- a19 as IMAGE_LOCALES,
3665
- b21 as IMAGE_LOCALE_EN,
3666
- c9 as IMAGE_UPLOAD_SERVICE,
3667
- At as ImagePlugin,
3668
- vn as InputRuleRegistry,
3669
- bn as KeymapRegistry,
3670
- ts as LIGHT_THEME,
3671
- a7 as LINK_LOCALES,
3672
- b9 as LINK_LOCALE_EN,
3673
- a8 as LIST_LOCALES,
3674
- b10 as LIST_LOCALE_EN,
3675
- gt as LinkPlugin,
3676
- mt as ListPlugin,
3677
- hs as Locale,
3678
- st as LocaleService,
3679
- rt as LocaleServiceKey,
3680
- En as NodeViewRegistry,
3681
- hr as NotectlEditor,
3682
- Wn as PAPER_MARGIN_HORIZONTAL_PX,
3683
- Un as PAPER_MARGIN_TOP_PX,
3684
- Vn as PAPER_VIEWPORT_PADDING_PX,
3685
- Dn as PRINT_LOCALES,
3686
- _n as PRINT_LOCALE_EN,
3687
- Jn as PRINT_SERVICE_KEY,
3688
- zn as PaperSize,
3689
- On as PluginManager,
3690
- P as PopupManager,
3691
- a2 as PopupServiceKey,
3692
- Zn as PrintPlugin,
3693
- a10 as STRIKETHROUGH_LOCALES,
3694
- b12 as STRIKETHROUGH_LOCALE_EN,
3695
- a18 as SUPER_SUB_LOCALES,
3696
- b20 as SUPER_SUB_LOCALE_EN,
3697
- Ht as SchemaRegistry,
3698
- tt as ServiceKey,
3699
- kt as StrikethroughPlugin,
3700
- Tt as SuperSubPlugin,
3701
- a16 as TABLE_LOCALES,
3702
- b18 as TABLE_LOCALE_AR,
3703
- c8 as TABLE_LOCALE_DE,
3704
- d4 as TABLE_LOCALE_EN,
3705
- e4 as TABLE_LOCALE_ES,
3706
- f2 as TABLE_LOCALE_FR,
3707
- g2 as TABLE_LOCALE_HI,
3708
- h3 as TABLE_LOCALE_RU,
3709
- i6 as TABLE_LOCALE_ZH,
3710
- a11 as TEXT_COLOR_LOCALES,
3711
- b13 as TEXT_COLOR_LOCALE_EN,
3712
- a5 as TEXT_FORMATTING_LOCALES,
3713
- b7 as TEXT_FORMATTING_LOCALE_EN,
3714
- b5 as TOOLBAR_LOCALES,
3715
- c5 as TOOLBAR_LOCALE_EN,
3716
- xt as TablePlugin,
3717
- j4 as TableSelectionServiceKey,
3718
- bt as TextColorPlugin,
3719
- pt as TextFormattingPlugin,
3720
- es as ThemePreset,
3721
- d2 as ToolbarOverflowBehavior,
3722
- it as ToolbarPlugin,
3723
- xn as ToolbarRegistry,
3724
- e3 as ToolbarServiceKey,
3725
- Zt as TransactionBuilder,
3726
- ps as VALID_ALIGNMENTS,
3727
- Ls as adoptContentStyles,
3728
- a3 as appendToRoot,
3729
- a20 as applyAttributedMark,
3730
- Qt as applyStep,
3731
- Nn as attachGridKeyboard,
3732
- In as attachListboxKeyboard,
3733
- Mn as attachMenuKeyboard,
3734
- ye as blockId,
3735
- v as blockOffsetToTextOffset,
3736
- zt as canContain,
3737
- c10 as canCrossBlockBoundary,
3738
- c3 as commandName,
3739
- we as createBlockElement,
3740
- _ as createBlockNode,
3741
- re as createCollapsedSelection,
3742
- W as createDocument,
3743
- dr as createEditor,
3744
- pr as createFullPreset,
3745
- j2 as createGapCursor,
3746
- X as createInlineNode,
3747
- ur as createMinimalPreset,
3748
- se as createNodeSelection,
3749
- ce as createPosition,
3750
- ae as createSelection,
3751
- T as createTextNode,
3752
- ss as createTheme,
3753
- ls as createThemeStyleSheet,
3754
- pe as defaultSchema,
3755
- ln as deleteBackward,
3756
- Ve as deleteBackwardAtGap,
3757
- hn as deleteForward,
3758
- Ge as deleteForwardAtGap,
3759
- ze as deleteNodeSelection,
3760
- je as deleteSelectionCommand,
3761
- _e as endOfTextblock,
3762
- Ee as escapeHTML,
3763
- e as extendCharacterBackward,
3764
- c as extendCharacterForward,
3765
- d as extendLineDown,
3766
- g as extendLineUp,
3767
- h2 as extendToBlockEnd,
3768
- i as extendToBlockStart,
3769
- j as extendToDocumentEnd,
3770
- k as extendToDocumentStart,
3771
- l as extendToLineEnd,
3772
- m as extendToLineStart,
3773
- i3 as extendTx,
3774
- n as extendWordBackward,
3775
- o as extendWordForward,
3776
- Ce as findNode,
3777
- Ae as findNodePath,
3778
- b3 as findNodeWithPath,
3779
- k3 as findTableContext,
3780
- ee as findWordBoundaryBackward,
3781
- Z as findWordBoundaryForward,
3782
- f3 as forEachBlockInRange,
3783
- xe as formatHTML,
3784
- ut as formatShortcut,
3785
- cs as generateThemeCSS,
3786
- J as getBlockChildren,
3787
- O as getBlockLength,
3788
- K as getBlockMarksAtOffset,
3789
- $ as getBlockText,
3790
- p as getBlockTypeLabel,
3791
- Pe as getCaretRectFromSelection,
3792
- U as getContentAtOffset,
3793
- I as getInlineChildren,
3794
- g3 as getMarkAttrAtSelection,
3795
- qn as getPaperCSSSize,
3796
- Fn as getPaperDimensions,
3797
- w as getTextChildren,
3798
- Ze as getTextDirection,
3799
- h as hasMark,
3800
- Ts as injectContentStyles,
3801
- i5 as inlineDecoration,
3802
- be as inlineType,
3803
- Je as insertHardBreakCommand,
3804
- qe as insertTextCommand,
3805
- Xt as invertStep,
3806
- Yt as invertTransaction,
3807
- on as isAllowedInReadonly,
3808
- i7 as isAttributedMarkActive,
3809
- S as isBlockNode,
3810
- le as isCollapsed,
3811
- a as isFirefox,
3812
- k2 as isForward,
3813
- oe as isGapCursor,
3814
- C as isInlineNode,
3815
- b2 as isInlineNodeOfType,
3816
- a21 as isInsideIsolating,
3817
- l2 as isInsideTable,
3818
- b22 as isIsolatingBlock,
3819
- V as isLeafBlock,
3820
- i4 as isMac,
3821
- b as isMarkActive,
3822
- fe as isMarkAllowed,
3823
- i2 as isMarkOfType,
3824
- Se as isNodeOfType,
3825
- ie as isNodeSelection,
3826
- rn as isSelectionOnlyTransaction,
3827
- R as isTextNode,
3828
- de as isTextSelection,
3829
- Gn as isValidPaperSize,
3830
- i8 as isVoidBlock,
3831
- b4 as isWebKit,
3832
- Q as markSetsEqual,
3833
- ve as markType,
3834
- Ke as mergeBlockBackward,
3835
- q as moveCharacterBackward,
3836
- r as moveCharacterForward,
3837
- s as moveLineDown,
3838
- t as moveLineUp,
3839
- u as moveToBlockEnd,
3840
- v2 as moveToBlockStart,
3841
- w2 as moveToDocumentEnd,
3842
- x as moveToDocumentStart,
3843
- y as moveToLineEnd,
3844
- z as moveToLineStart,
3845
- m2 as moveTx,
3846
- A as moveWordBackward,
3847
- B as moveWordForward,
3848
- De as navigateAcrossBlocks,
3849
- Ue as navigateArrowIntoVoid,
3850
- Re as navigateFromGapCursor,
3851
- He as navigateVerticalWithGoalColumn,
3852
- D as nextGraphemeSize,
3853
- n2 as nodeDecoration,
3854
- j3 as nodeSelTx,
3855
- ke as nodeType,
3856
- un as normalizeKeyDescriptor,
3857
- vs as parseHTMLToDocument,
3858
- p2 as pluginId,
3859
- p3 as positionPopup,
3860
- E as prevGraphemeSize,
3861
- $t as registerBuiltinSpecs,
3862
- Ms as removeAdoptedStyles,
3863
- r3 as removeAttributedMark,
3864
- As as removeContentStyles,
3865
- r2 as renderColorGrid,
3866
- Te as resolveNodeByPath,
3867
- c4 as resolveParentByPath,
3868
- nt as resolvePluginLocale,
3869
- rs as resolveTheme,
3870
- me as schemaFromRegistry,
3871
- Fe as selectAll,
3872
- ue as selectionRange,
3873
- he as selectionsEqual,
3874
- gs as serializeDocumentToCSS,
3875
- fs as serializeDocumentToHTML,
3876
- s2 as sharesParent,
3877
- Oe as skipInlineNode,
3878
- We as splitBlockCommand,
3879
- t2 as toggleBold,
3880
- c2 as toggleItalic,
3881
- e2 as toggleMark,
3882
- f as toggleUnderline,
3883
- jt as validateContent,
3884
- F as viewExtend,
3885
- G as viewMove,
3886
- w3 as walkNodes,
3887
- w4 as widgetDecoration
3888
- };
1
+ import{b as a,c as s,a as e,d as t,e as o,g as r,f as n,h as i,i as c,j as d,k as m,l,m as k,n as p,o as g,p as T,q as h,r as u}from"./chunks/Document-BFYAonMF.mjs";import{e as f,a as S,b as v,c as B,d as y,f as C,g as x,h as w,i as P,j as A,k as E,l as N,m as j,n as I,o as M,p as D,q as R,r as b,s as L,t as F,u as O,v as G,w as H,x as W,y as _,z,A as K,B as V,C as U,D as q,E as X,F as Q,G as Z,H as J,I as Y}from"./chunks/index-DAoSt12h.mjs";import{c as $,a as aa,b as sa,d as ea,e as ta,i as oa,f as ra,g as na,h as ia,j as ca,s as da,k as ma}from"./chunks/Selection-6-W6Flxc.mjs";import{d as la,i as ka,a as pa,s as ga,t as Ta,b as ha,c as ua,e as fa}from"./chunks/MarkCommands-B_erV7zz.mjs";import{b as Sa,c as va,i as Ba,m as ya,n as Ca,p as xa}from"./chunks/TypeBrands-Bp_Z_o5Y.mjs";import{i as wa,a as Pa,b as Aa}from"./chunks/AttrRegistry-B2AGfTE0.mjs";import{c as Ea}from"./chunks/DomUtils-Cdz1eDKM.mjs";import{e as Na,f as ja}from"./chunks/HTMLUtils-CCvQ5f83.mjs";import{C as Ia,a as Ma,b as Da,D as Ra,E as ba,c as La,F as Fa,H as Oa,I as Ga,d as Ha,K as Wa,L as _a,e as za,N as Ka,f as Va,P as Ua,S as qa,T as Xa,g as Qa,h as Za,i as Ja,j as Ya,k as $a,l as as,m as ss,n as es,o as ts,p as os,q as rs,r as ns,s as is,t as cs,u as ds,v as ms,w as ls,x as ks,y as ps,z as gs,A as Ts,B as hs}from"./chunks/NotectlEditor-4NFnXLyD.mjs";import{c as us,f as fs,a as Ss,b as vs,i as Bs,d as ys,e as Cs,r as xs,g as ws,s as Ps,w as As}from"./chunks/NavigationQueries-ogQuObz7.mjs";import{e as Es,m as Ns,n as js}from"./chunks/SelectionTransactions-q71GEzgE.mjs";import{d as Is,a as Ms,b as Ds,c as Rs,i as bs,e as Ls,m as Fs,n as Os,s as Gs,f as Hs}from"./chunks/Commands-P9wS8qtN.mjs";import{g as Ws,i as _s,a as zs,b as Ks,c as Vs}from"./chunks/Platform-CU6itXZo.mjs";import{E as Us,S as qs}from"./chunks/Plugin-OzM8Oxm_.mjs";import{D as Xs,i as Qs,n as Zs,w as Js}from"./chunks/Decoration-D49mFXrH.mjs";import{P as Ys,a as $s,b as ae,c as se,g as ee,d as te,i as oe}from"./chunks/PrintTypes-ehbL7ipA.mjs";import{L as re,a as ne}from"./chunks/LocaleService-B6Z-wyAF.mjs";import{a as ie,g as ce,i as de,r as me}from"./chunks/AttributedMarkCommands-BB7lzFct.mjs";import{f as le}from"./chunks/RangeIterator-CNI6smOg.mjs";import{n as ke}from"./chunks/index-C8xtb3SM.mjs";export{Ia as ClipboardHandler,Ma as CompositionTracker,Da as CursorWrapper,Ra as DARK_THEME,Xs as DecorationSet,ba as EditorState,La as EventBus,Us as EventKey,Fa as FileHandlerRegistry,Oa as HistoryManager,Ga as InputManager,Ha as InputRuleRegistry,Wa as KeymapRegistry,_a as LIGHT_THEME,za as Locale,re as LocaleService,ne as LocaleServiceKey,Ka as NodeViewRegistry,Va as NotectlEditor,Ys as PAPER_MARGIN_HORIZONTAL_PX,$s as PAPER_MARGIN_TOP_PX,ae as PAPER_VIEWPORT_PADDING_PX,se as PaperSize,Ua as PluginManager,qa as SchemaRegistry,qs as ServiceKey,Xa as ThemePreset,Qa as TransactionBuilder,Za as adoptContentStyles,ie as applyAttributedMark,Ja as applyStep,Sa as blockId,a as blockOffsetToTextOffset,Ya as canContain,us as canCrossBlockBoundary,va as commandName,Ea as createBlockElement,s as createBlockNode,$ as createCollapsedSelection,e as createDocument,$a as createEditor,aa as createGapCursor,t as createInlineNode,sa as createNodeSelection,ea as createPosition,ta as createSelection,o as createTextNode,as as createTheme,ss as createThemeStyleSheet,la as defaultSchema,es as deleteBackward,Is as deleteBackwardAtGap,ts as deleteForward,Ms as deleteForwardAtGap,Ds as deleteNodeSelection,Rs as deleteSelectionCommand,f as endOfTextblock,Na as escapeHTML,S as extendCharacterBackward,v as extendCharacterForward,B as extendLineDown,y as extendLineUp,C as extendToBlockEnd,x as extendToBlockStart,w as extendToDocumentEnd,P as extendToDocumentStart,A as extendToLineEnd,E as extendToLineStart,Es as extendTx,N as extendWordBackward,j as extendWordForward,fs as findNode,Ss as findNodePath,vs as findNodeWithPath,I as findWordBoundaryBackward,M as findWordBoundaryForward,le as forEachBlockInRange,ja as formatHTML,os as generateThemeCSS,r as getBlockChildren,n as getBlockLength,i as getBlockMarksAtOffset,c as getBlockText,rs as getBlockTypeLabel,D as getCaretRectFromSelection,d as getContentAtOffset,m as getInlineChildren,ce as getMarkAttrAtSelection,ee as getPaperCSSSize,te as getPaperDimensions,l as getTextChildren,Ws as getTextDirection,k as hasMark,ns as injectContentStyles,Qs as inlineDecoration,Ba as inlineType,bs as insertHardBreakCommand,Ls as insertTextCommand,is as invertStep,cs as invertTransaction,ds as isAllowedInReadonly,de as isAttributedMarkActive,p as isBlockNode,oa as isCollapsed,_s as isFirefox,ra as isForward,na as isGapCursor,g as isInlineNode,wa as isInlineNodeOfType,Bs as isInsideIsolating,ys as isIsolatingBlock,T as isLeafBlock,zs as isMac,ka as isMarkActive,pa as isMarkAllowed,Pa as isMarkOfType,Aa as isNodeOfType,ia as isNodeSelection,Ks as isRtlContext,ms as isSelectionOnlyTransaction,h as isTextNode,ca as isTextSelection,oe as isValidPaperSize,Cs as isVoidBlock,Vs as isWebKit,u as markSetsEqual,ya as markType,Fs as mergeBlockBackward,R as moveCharacterBackward,b as moveCharacterForward,L as moveLineDown,F as moveLineUp,O as moveToBlockEnd,G as moveToBlockStart,H as moveToDocumentEnd,W as moveToDocumentStart,_ as moveToLineEnd,z as moveToLineStart,Ns as moveTx,K as moveWordBackward,V as moveWordForward,U as navigateAcrossBlocks,Os as navigateArrowIntoVoid,ke as navigateFromGapCursor,q as navigateVerticalWithGoalColumn,X as nextGraphemeSize,Zs as nodeDecoration,js as nodeSelTx,Ca as nodeType,ls as normalizeKeyDescriptor,xa as pluginId,Q as prevGraphemeSize,ks as registerBuiltinSpecs,ps as removeAdoptedStyles,me as removeAttributedMark,gs as removeContentStyles,xs as resolveNodeByPath,ws as resolveParentByPath,Ts as resolveTheme,ga as schemaFromRegistry,Gs as selectAll,da as selectionRange,ma as selectionsEqual,Ps as sharesParent,Z as skipInlineNode,Hs as splitBlockCommand,Ta as toggleBold,ha as toggleItalic,ua as toggleMark,fa as toggleUnderline,hs as validateContent,J as viewExtend,Y as viewMove,As as walkNodes,Js as widgetDecoration};
3889
2
  //# sourceMappingURL=notectl-core.mjs.map