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